-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = global || self, global.prettier = factory());
-}(this, (function () { 'use strict';
-
- var name = "prettier";
- var version = "2.0.5";
- var description = "Prettier is an opinionated code formatter";
- var bin = "./bin/prettier.js";
- var repository = "prettier/prettier";
- var homepage = "https://prettier.io";
- var author = "James Long";
- var license = "MIT";
- var main = "./index.js";
- var engines = {
- node: ">=10.13.0"
- };
- var dependencies = {
- "@angular/compiler": "9.0.5",
- "@babel/code-frame": "7.8.0",
- "@babel/parser": "7.9.4",
- "@glimmer/syntax": "0.50.0",
- "@iarna/toml": "2.2.3",
- "@typescript-eslint/typescript-estree": "2.26.0",
- "angular-estree-parser": "1.3.0",
- "angular-html-parser": "1.4.0",
- camelcase: "5.3.1",
- chalk: "4.0.0",
- "ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540",
- "cjk-regex": "2.0.0",
- cosmiconfig: "6.0.0",
- dashify: "2.0.0",
- dedent: "0.7.0",
- diff: "4.0.2",
- editorconfig: "0.15.3",
- "editorconfig-to-prettier": "0.1.1",
- "escape-string-regexp": "2.0.0",
- esutils: "2.0.3",
- "fast-glob": "3.2.2",
- "find-parent-dir": "0.3.0",
- "find-project-root": "1.1.1",
- "flow-parser": "0.122.0",
- "get-stream": "5.1.0",
- globby: "11.0.0",
- graphql: "15.0.0",
- "html-element-attributes": "2.2.1",
- "html-styles": "1.0.0",
- "html-tag-names": "1.1.5",
- ignore: "4.0.6",
- "jest-docblock": "25.2.6",
- "json-stable-stringify": "1.0.1",
- leven: "3.1.0",
- "lines-and-columns": "1.1.6",
- "linguist-languages": "7.9.0",
- lodash: "4.17.15",
- mem: "6.0.1",
- minimatch: "3.0.4",
- minimist: "1.2.5",
- "n-readlines": "1.0.0",
- "please-upgrade-node": "3.2.0",
- "postcss-less": "3.1.4",
- "postcss-media-query-parser": "0.2.3",
- "postcss-scss": "2.0.0",
- "postcss-selector-parser": "2.2.3",
- "postcss-values-parser": "2.0.1",
- "regexp-util": "1.2.2",
- "remark-math": "1.0.6",
- "remark-parse": "5.0.0",
- resolve: "1.16.1",
- semver: "7.1.3",
- srcset: "2.0.1",
- "string-width": "4.2.0",
- typescript: "3.8.3",
- "unicode-regex": "3.0.0",
- unified: "9.0.0",
- vnopts: "1.0.2",
- "yaml-unist-parser": "1.1.1"
- };
- var devDependencies = {
- "@babel/core": "7.9.0",
- "@babel/preset-env": "7.9.0",
- "@rollup/plugin-alias": "3.0.1",
- "@rollup/plugin-commonjs": "11.0.2",
- "@rollup/plugin-json": "4.0.2",
- "@rollup/plugin-node-resolve": "7.1.1",
- "@rollup/plugin-replace": "2.3.1",
- "babel-loader": "8.1.0",
- benchmark: "2.1.4",
- "builtin-modules": "3.1.0",
- codecov: "3.6.5",
- "cross-env": "7.0.2",
- cspell: "4.0.55",
- eslint: "6.8.0",
- "eslint-config-prettier": "6.10.1",
- "eslint-formatter-friendly": "7.0.0",
- "eslint-plugin-import": "2.20.2",
- "eslint-plugin-prettier": "3.1.2",
- "eslint-plugin-react": "7.19.0",
- "eslint-plugin-unicorn": "18.0.1",
- execa: "4.0.0",
- jest: "25.2.7",
- "jest-snapshot-serializer-ansi": "1.0.0",
- "jest-snapshot-serializer-raw": "1.1.0",
- "jest-watch-typeahead": "0.5.0",
- prettier: "2.0.4",
- rimraf: "3.0.2",
- rollup: "2.3.2",
- "rollup-plugin-babel": "4.4.0",
- "rollup-plugin-node-globals": "1.4.0",
- "rollup-plugin-terser": "5.3.0",
- shelljs: "0.8.3",
- "snapshot-diff": "0.7.0",
- "strip-ansi": "6.0.0",
- "synchronous-promise": "2.0.10",
- tempy: "0.5.0",
- "terser-webpack-plugin": "2.3.5",
- webpack: "4.42.1"
- };
- var scripts = {
- prepublishOnly: "echo \"Error: must publish from dist/\" && exit 1",
- "prepare-release": "yarn && yarn build && yarn test:dist",
- test: "jest",
- "test:dist": "cross-env NODE_ENV=production jest",
- "test:dist-standalone": "cross-env NODE_ENV=production TEST_STANDALONE=1 jest tests/",
- "test:integration": "jest tests_integration",
- "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",
- "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",
- "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",
- "lint:typecheck": "tsc",
- "lint:eslint": "cross-env EFF_NO_LINK_RULES=true eslint . --format friendly",
- "lint:changelog": "node ./scripts/lint-changelog.js",
- "lint:prettier": "prettier \"**/*.{md,json,yml,html,css}\" --check",
- "lint:dist": "eslint --no-eslintrc --no-ignore --env=es6,browser --parser-options=ecmaVersion:2016 \"dist/!(bin-prettier|index|third-party).js\"",
- "lint:spellcheck": "cspell {bin,scripts,src,website}/**/*.js {docs,website/blog,changelog_unreleased}/**/*.md",
- "lint:deps": "node ./scripts/check-deps.js",
- build: "node --max-old-space-size=3072 ./scripts/build/build.js",
- "build-docs": "node ./scripts/build-docs.js"
- };
- var _package = {
- name: name,
- version: version,
- description: description,
- bin: bin,
- repository: repository,
- homepage: homepage,
- author: author,
- license: license,
- main: main,
- engines: engines,
- dependencies: dependencies,
- devDependencies: devDependencies,
- scripts: scripts
- };
-
- var _package$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name,
- version: version,
- description: description,
- bin: bin,
- repository: repository,
- homepage: homepage,
- author: author,
- license: license,
- main: main,
- engines: engines,
- dependencies: dependencies,
- devDependencies: devDependencies,
- scripts: scripts,
- 'default': _package
- });
-
- function Diff() {}
-
- Diff.prototype = {
- diff: function diff(oldString, newString) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var callback = options.callback;
-
- if (typeof options === 'function') {
- callback = options;
- options = {};
- }
-
- this.options = options;
- var self = this;
-
- function done(value) {
- if (callback) {
- setTimeout(function () {
- callback(undefined, value);
- }, 0);
- return true;
- } else {
- return value;
- }
- } // Allow subclasses to massage the input prior to running
-
-
- oldString = this.castInput(oldString);
- newString = this.castInput(newString);
- oldString = this.removeEmpty(this.tokenize(oldString));
- newString = this.removeEmpty(this.tokenize(newString));
- var newLen = newString.length,
- oldLen = oldString.length;
- var editLength = 1;
- var maxEditLength = newLen + oldLen;
- var bestPath = [{
- newPos: -1,
- components: []
- }]; // Seed editLength = 0, i.e. the content starts with the same values
-
- var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
-
- if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
- // Identity per the equality and tokenizer
- return done([{
- value: this.join(newString),
- count: newString.length
- }]);
- } // Main worker method. checks all permutations of a given edit length for acceptance.
-
-
- function execEditLength() {
- for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
- var basePath = void 0;
-
- var addPath = bestPath[diagonalPath - 1],
- removePath = bestPath[diagonalPath + 1],
- _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
-
- if (addPath) {
- // No one else is going to attempt to use this value, clear it
- bestPath[diagonalPath - 1] = undefined;
- }
-
- var canAdd = addPath && addPath.newPos + 1 < newLen,
- canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
-
- if (!canAdd && !canRemove) {
- // If this path is a terminal then prune
- bestPath[diagonalPath] = undefined;
- continue;
- } // Select the diagonal that we want to branch from. We select the prior
- // path whose position in the new string is the farthest from the origin
- // and does not pass the bounds of the diff graph
-
-
- if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
- basePath = clonePath(removePath);
- self.pushComponent(basePath.components, undefined, true);
- } else {
- basePath = addPath; // No need to clone, we've pulled it from the list
-
- basePath.newPos++;
- self.pushComponent(basePath.components, true, undefined);
- }
-
- _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
-
- if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
- return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
- } else {
- // Otherwise track this path as a potential candidate and continue.
- bestPath[diagonalPath] = basePath;
- }
- }
-
- editLength++;
- } // Performs the length of edit iteration. Is a bit fugly as this has to support the
- // sync and async mode which is never fun. Loops over execEditLength until a value
- // is produced.
-
-
- if (callback) {
- (function exec() {
- setTimeout(function () {
- // This should not happen, but we want to be safe.
-
- /* istanbul ignore next */
- if (editLength > maxEditLength) {
- return callback();
- }
-
- if (!execEditLength()) {
- exec();
- }
- }, 0);
- })();
- } else {
- while (editLength <= maxEditLength) {
- var ret = execEditLength();
-
- if (ret) {
- return ret;
- }
- }
- }
- },
- pushComponent: function pushComponent(components, added, removed) {
- var last = components[components.length - 1];
-
- if (last && last.added === added && last.removed === removed) {
- // We need to clone here as the component clone operation is just
- // as shallow array clone
- components[components.length - 1] = {
- count: last.count + 1,
- added: added,
- removed: removed
- };
- } else {
- components.push({
- count: 1,
- added: added,
- removed: removed
- });
- }
- },
- extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
- var newLen = newString.length,
- oldLen = oldString.length,
- newPos = basePath.newPos,
- oldPos = newPos - diagonalPath,
- commonCount = 0;
-
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
- newPos++;
- oldPos++;
- commonCount++;
- }
-
- if (commonCount) {
- basePath.components.push({
- count: commonCount
- });
- }
-
- basePath.newPos = newPos;
- return oldPos;
- },
- equals: function equals(left, right) {
- if (this.options.comparator) {
- return this.options.comparator(left, right);
- } else {
- return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
- }
- },
- removeEmpty: function removeEmpty(array) {
- var ret = [];
-
- for (var i = 0; i < array.length; i++) {
- if (array[i]) {
- ret.push(array[i]);
- }
- }
-
- return ret;
- },
- castInput: function castInput(value) {
- return value;
- },
- tokenize: function tokenize(value) {
- return value.split('');
- },
- join: function join(chars) {
- return chars.join('');
- }
- };
-
- function buildValues(diff, components, newString, oldString, useLongestToken) {
- var componentPos = 0,
- componentLen = components.length,
- newPos = 0,
- oldPos = 0;
-
- for (; componentPos < componentLen; componentPos++) {
- var component = components[componentPos];
-
- if (!component.removed) {
- if (!component.added && useLongestToken) {
- var value = newString.slice(newPos, newPos + component.count);
- value = value.map(function (value, i) {
- var oldValue = oldString[oldPos + i];
- return oldValue.length > value.length ? oldValue : value;
- });
- component.value = diff.join(value);
- } else {
- component.value = diff.join(newString.slice(newPos, newPos + component.count));
- }
-
- newPos += component.count; // Common case
-
- if (!component.added) {
- oldPos += component.count;
- }
- } else {
- component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
- oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
- // The diffing algorithm is tied to add then remove output and this is the simplest
- // route to get the desired output with minimal overhead.
-
- if (componentPos && components[componentPos - 1].added) {
- var tmp = components[componentPos - 1];
- components[componentPos - 1] = components[componentPos];
- components[componentPos] = tmp;
- }
- }
- } // Special case handle for when one terminal is ignored (i.e. whitespace).
- // For this case we merge the terminal into the prior string and drop the change.
- // This is only available for string mode.
-
-
- var lastComponent = components[componentLen - 1];
-
- if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
- components[componentLen - 2].value += lastComponent.value;
- components.pop();
- }
-
- return components;
- }
-
- function clonePath(path) {
- return {
- newPos: path.newPos,
- components: path.components.slice(0)
- };
- }
-
- var characterDiff = new Diff();
-
- function diffChars(oldStr, newStr, options) {
- return characterDiff.diff(oldStr, newStr, options);
- }
-
- function generateOptions(options, defaults) {
- if (typeof options === 'function') {
- defaults.callback = options;
- } else if (options) {
- for (var name in options) {
- /* istanbul ignore else */
- if (options.hasOwnProperty(name)) {
- defaults[name] = options[name];
- }
- }
- }
-
- return defaults;
- } //
- // Ranges and exceptions:
- // Latin-1 Supplement, 0080–00FF
- // - U+00D7 × Multiplication sign
- // - U+00F7 ÷ Division sign
- // Latin Extended-A, 0100–017F
- // Latin Extended-B, 0180–024F
- // IPA Extensions, 0250–02AF
- // Spacing Modifier Letters, 02B0–02FF
- // - U+02C7 ˇ ˇ Caron
- // - U+02D8 ˘ ˘ Breve
- // - U+02D9 ˙ ˙ Dot Above
- // - U+02DA ˚ ˚ Ring Above
- // - U+02DB ˛ ˛ Ogonek
- // - U+02DC ˜ ˜ Small Tilde
- // - U+02DD ˝ ˝ Double Acute Accent
- // Latin Extended Additional, 1E00–1EFF
-
-
- var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
- var reWhitespace = /\S/;
- var wordDiff = new Diff();
-
- wordDiff.equals = function (left, right) {
- if (this.options.ignoreCase) {
- left = left.toLowerCase();
- right = right.toLowerCase();
- }
-
- return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
- };
-
- wordDiff.tokenize = function (value) {
- 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.
-
- for (var i = 0; i < tokens.length - 1; i++) {
- // If we have an empty string in the next field and we have only word chars before and after, merge
- if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
- tokens[i] += tokens[i + 2];
- tokens.splice(i + 1, 2);
- i--;
- }
- }
-
- return tokens;
- };
-
- function diffWords(oldStr, newStr, options) {
- options = generateOptions(options, {
- ignoreWhitespace: true
- });
- return wordDiff.diff(oldStr, newStr, options);
- }
-
- function diffWordsWithSpace(oldStr, newStr, options) {
- return wordDiff.diff(oldStr, newStr, options);
- }
-
- var lineDiff = new Diff();
-
- lineDiff.tokenize = function (value) {
- var retLines = [],
- linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
-
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
- linesAndNewlines.pop();
- } // Merge the content and line separators into single tokens
-
-
- for (var i = 0; i < linesAndNewlines.length; i++) {
- var line = linesAndNewlines[i];
-
- if (i % 2 && !this.options.newlineIsToken) {
- retLines[retLines.length - 1] += line;
- } else {
- if (this.options.ignoreWhitespace) {
- line = line.trim();
- }
-
- retLines.push(line);
- }
- }
-
- return retLines;
- };
-
- function diffLines(oldStr, newStr, callback) {
- return lineDiff.diff(oldStr, newStr, callback);
- }
-
- function diffTrimmedLines(oldStr, newStr, callback) {
- var options = generateOptions(callback, {
- ignoreWhitespace: true
- });
- return lineDiff.diff(oldStr, newStr, options);
- }
-
- var sentenceDiff = new Diff();
-
- sentenceDiff.tokenize = function (value) {
- return value.split(/(\S.+?[.!?])(?=\s+|$)/);
- };
-
- function diffSentences(oldStr, newStr, callback) {
- return sentenceDiff.diff(oldStr, newStr, callback);
- }
-
- var cssDiff = new Diff();
-
- cssDiff.tokenize = function (value) {
- return value.split(/([{}:;,]|\s+)/);
- };
-
- function diffCss(oldStr, newStr, callback) {
- return cssDiff.diff(oldStr, newStr, callback);
- }
-
- function _typeof(obj) {
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
- _typeof = function _typeof(obj) {
- return typeof obj;
- };
- } else {
- _typeof = function _typeof(obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
- };
- }
-
- return _typeof(obj);
- }
-
- function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
- }
-
- function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) {
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
-
- return arr2;
- }
- }
-
- function _iterableToArray(iter) {
- if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
- }
-
- function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance");
- }
-
- var objectPrototypeToString = Object.prototype.toString;
- var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
- // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
-
- jsonDiff.useLongestToken = true;
- jsonDiff.tokenize = lineDiff.tokenize;
-
- jsonDiff.castInput = function (value) {
- var _this$options = this.options,
- undefinedReplacement = _this$options.undefinedReplacement,
- _this$options$stringi = _this$options.stringifyReplacer,
- stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) {
- return typeof v === 'undefined' ? undefinedReplacement : v;
- } : _this$options$stringi;
- return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
- };
-
- jsonDiff.equals = function (left, right) {
- return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
- };
-
- function diffJson(oldObj, newObj, options) {
- return jsonDiff.diff(oldObj, newObj, options);
- } // This function handles the presence of circular references by bailing out when encountering an
- // object that is already on the "stack" of items being processed. Accepts an optional replacer
-
-
- function canonicalize(obj, stack, replacementStack, replacer, key) {
- stack = stack || [];
- replacementStack = replacementStack || [];
-
- if (replacer) {
- obj = replacer(key, obj);
- }
-
- var i;
-
- for (i = 0; i < stack.length; i += 1) {
- if (stack[i] === obj) {
- return replacementStack[i];
- }
- }
-
- var canonicalizedObj;
-
- if ('[object Array]' === objectPrototypeToString.call(obj)) {
- stack.push(obj);
- canonicalizedObj = new Array(obj.length);
- replacementStack.push(canonicalizedObj);
-
- for (i = 0; i < obj.length; i += 1) {
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
- }
-
- stack.pop();
- replacementStack.pop();
- return canonicalizedObj;
- }
-
- if (obj && obj.toJSON) {
- obj = obj.toJSON();
- }
-
- if (_typeof(obj) === 'object' && obj !== null) {
- stack.push(obj);
- canonicalizedObj = {};
- replacementStack.push(canonicalizedObj);
-
- var sortedKeys = [],
- _key;
-
- for (_key in obj) {
- /* istanbul ignore else */
- if (obj.hasOwnProperty(_key)) {
- sortedKeys.push(_key);
- }
- }
-
- sortedKeys.sort();
-
- for (i = 0; i < sortedKeys.length; i += 1) {
- _key = sortedKeys[i];
- canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
- }
-
- stack.pop();
- replacementStack.pop();
- } else {
- canonicalizedObj = obj;
- }
-
- return canonicalizedObj;
- }
-
- var arrayDiff = new Diff();
-
- arrayDiff.tokenize = function (value) {
- return value.slice();
- };
-
- arrayDiff.join = arrayDiff.removeEmpty = function (value) {
- return value;
- };
-
- function diffArrays(oldArr, newArr, callback) {
- return arrayDiff.diff(oldArr, newArr, callback);
- }
-
- function parsePatch(uniDiff) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
- delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
- list = [],
- i = 0;
-
- function parseIndex() {
- var index = {};
- list.push(index); // Parse diff metadata
-
- while (i < diffstr.length) {
- var line = diffstr[i]; // File header found, end parsing diff metadata
-
- if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
- break;
- } // Diff index
-
-
- var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
-
- if (header) {
- index.index = header[1];
- }
-
- i++;
- } // Parse file headers if they are defined. Unified diff requires them, but
- // there's no technical issues to have an isolated hunk without file header
-
-
- parseFileHeader(index);
- parseFileHeader(index); // Parse hunks
-
- index.hunks = [];
-
- while (i < diffstr.length) {
- var _line = diffstr[i];
-
- if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
- break;
- } else if (/^@@/.test(_line)) {
- index.hunks.push(parseHunk());
- } else if (_line && options.strict) {
- // Ignore unexpected content unless in strict mode
- throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
- } else {
- i++;
- }
- }
- } // Parses the --- and +++ headers, if none are found, no lines
- // are consumed.
-
-
- function parseFileHeader(index) {
- var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
-
- if (fileHeader) {
- var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
- var data = fileHeader[2].split('\t', 2);
- var fileName = data[0].replace(/\\\\/g, '\\');
-
- if (/^".*"$/.test(fileName)) {
- fileName = fileName.substr(1, fileName.length - 2);
- }
-
- index[keyPrefix + 'FileName'] = fileName;
- index[keyPrefix + 'Header'] = (data[1] || '').trim();
- i++;
- }
- } // Parses a hunk
- // This assumes that we are at the start of a hunk.
-
-
- function parseHunk() {
- var chunkHeaderIndex = i,
- chunkHeaderLine = diffstr[i++],
- chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
- var hunk = {
- oldStart: +chunkHeader[1],
- oldLines: +chunkHeader[2] || 1,
- newStart: +chunkHeader[3],
- newLines: +chunkHeader[4] || 1,
- lines: [],
- linedelimiters: []
- };
- var addCount = 0,
- removeCount = 0;
-
- for (; i < diffstr.length; i++) {
- // Lines starting with '---' could be mistaken for the "remove line" operation
- // But they could be the header for the next file. Therefore prune such cases out.
- if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
- break;
- }
-
- var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
-
- if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
- hunk.lines.push(diffstr[i]);
- hunk.linedelimiters.push(delimiters[i] || '\n');
-
- if (operation === '+') {
- addCount++;
- } else if (operation === '-') {
- removeCount++;
- } else if (operation === ' ') {
- addCount++;
- removeCount++;
- }
- } else {
- break;
- }
- } // Handle the empty block count case
-
-
- if (!addCount && hunk.newLines === 1) {
- hunk.newLines = 0;
- }
-
- if (!removeCount && hunk.oldLines === 1) {
- hunk.oldLines = 0;
- } // Perform optional sanity checking
-
-
- if (options.strict) {
- if (addCount !== hunk.newLines) {
- throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
- }
-
- if (removeCount !== hunk.oldLines) {
- throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
- }
- }
-
- return hunk;
- }
-
- while (i < diffstr.length) {
- parseIndex();
- }
-
- return list;
- } // Iterator that traverses in the range of [min, max], stepping
- // by distance from a given start position. I.e. for [0, 4], with
- // start of 2, this will iterate 2, 3, 1, 4, 0.
-
-
- function distanceIterator(start, minLine, maxLine) {
- var wantForward = true,
- backwardExhausted = false,
- forwardExhausted = false,
- localOffset = 1;
- return function iterator() {
- if (wantForward && !forwardExhausted) {
- if (backwardExhausted) {
- localOffset++;
- } else {
- wantForward = false;
- } // Check if trying to fit beyond text length, and if not, check it fits
- // after offset location (or desired location on first iteration)
-
-
- if (start + localOffset <= maxLine) {
- return localOffset;
- }
-
- forwardExhausted = true;
- }
-
- if (!backwardExhausted) {
- if (!forwardExhausted) {
- wantForward = true;
- } // Check if trying to fit before text beginning, and if not, check it fits
- // before offset location
-
-
- if (minLine <= start - localOffset) {
- return -localOffset++;
- }
-
- backwardExhausted = true;
- return iterator();
- } // We tried to fit hunk before text beginning and beyond text length, then
- // hunk can't fit on the text. Return undefined
-
- };
- }
-
- function applyPatch(source, uniDiff) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
-
- if (typeof uniDiff === 'string') {
- uniDiff = parsePatch(uniDiff);
- }
-
- if (Array.isArray(uniDiff)) {
- if (uniDiff.length > 1) {
- throw new Error('applyPatch only works with a single input.');
- }
-
- uniDiff = uniDiff[0];
- } // Apply the diff to the input
-
-
- var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
- delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
- hunks = uniDiff.hunks,
- compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) {
- return line === patchContent;
- },
- errorCount = 0,
- fuzzFactor = options.fuzzFactor || 0,
- minLine = 0,
- offset = 0,
- removeEOFNL,
- addEOFNL;
- /**
- * Checks if the hunk exactly fits on the provided location
- */
-
-
- function hunkFits(hunk, toPos) {
- for (var j = 0; j < hunk.lines.length; j++) {
- var line = hunk.lines[j],
- operation = line.length > 0 ? line[0] : ' ',
- content = line.length > 0 ? line.substr(1) : line;
-
- if (operation === ' ' || operation === '-') {
- // Context sanity check
- if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
- errorCount++;
-
- if (errorCount > fuzzFactor) {
- return false;
- }
- }
-
- toPos++;
- }
- }
-
- return true;
- } // Search best fit offsets for each hunk based on the previous ones
-
-
- for (var i = 0; i < hunks.length; i++) {
- var hunk = hunks[i],
- maxLine = lines.length - hunk.oldLines,
- localOffset = 0,
- toPos = offset + hunk.oldStart - 1;
- var iterator = distanceIterator(toPos, minLine, maxLine);
-
- for (; localOffset !== undefined; localOffset = iterator()) {
- if (hunkFits(hunk, toPos + localOffset)) {
- hunk.offset = offset += localOffset;
- break;
- }
- }
-
- if (localOffset === undefined) {
- return false;
- } // Set lower text limit to end of the current hunk, so next ones don't try
- // to fit over already patched text
-
-
- minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
- } // Apply patch hunks
-
-
- var diffOffset = 0;
-
- for (var _i = 0; _i < hunks.length; _i++) {
- var _hunk = hunks[_i],
- _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
-
- diffOffset += _hunk.newLines - _hunk.oldLines;
-
- if (_toPos < 0) {
- // Creating a new file
- _toPos = 0;
- }
-
- for (var j = 0; j < _hunk.lines.length; j++) {
- var line = _hunk.lines[j],
- operation = line.length > 0 ? line[0] : ' ',
- content = line.length > 0 ? line.substr(1) : line,
- delimiter = _hunk.linedelimiters[j];
-
- if (operation === ' ') {
- _toPos++;
- } else if (operation === '-') {
- lines.splice(_toPos, 1);
- delimiters.splice(_toPos, 1);
- /* istanbul ignore else */
- } else if (operation === '+') {
- lines.splice(_toPos, 0, content);
- delimiters.splice(_toPos, 0, delimiter);
- _toPos++;
- } else if (operation === '\\') {
- var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
-
- if (previousOperation === '+') {
- removeEOFNL = true;
- } else if (previousOperation === '-') {
- addEOFNL = true;
- }
- }
- }
- } // Handle EOFNL insertion/removal
-
-
- if (removeEOFNL) {
- while (!lines[lines.length - 1]) {
- lines.pop();
- delimiters.pop();
- }
- } else if (addEOFNL) {
- lines.push('');
- delimiters.push('\n');
- }
-
- for (var _k = 0; _k < lines.length - 1; _k++) {
- lines[_k] = lines[_k] + delimiters[_k];
- }
-
- return lines.join('');
- } // Wrapper that supports multiple file patches via callbacks.
-
-
- function applyPatches(uniDiff, options) {
- if (typeof uniDiff === 'string') {
- uniDiff = parsePatch(uniDiff);
- }
-
- var currentIndex = 0;
-
- function processIndex() {
- var index = uniDiff[currentIndex++];
-
- if (!index) {
- return options.complete();
- }
-
- options.loadFile(index, function (err, data) {
- if (err) {
- return options.complete(err);
- }
-
- var updatedContent = applyPatch(data, index, options);
- options.patched(index, updatedContent, function (err) {
- if (err) {
- return options.complete(err);
- }
-
- processIndex();
- });
- });
- }
-
- processIndex();
- }
-
- function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
- if (!options) {
- options = {};
- }
-
- if (typeof options.context === 'undefined') {
- options.context = 4;
- }
-
- var diff = diffLines(oldStr, newStr, options);
- diff.push({
- value: '',
- lines: []
- }); // Append an empty value to make cleanup easier
-
- function contextLines(lines) {
- return lines.map(function (entry) {
- return ' ' + entry;
- });
- }
-
- var hunks = [];
- var oldRangeStart = 0,
- newRangeStart = 0,
- curRange = [],
- oldLine = 1,
- newLine = 1;
-
- var _loop = function _loop(i) {
- var current = diff[i],
- lines = current.lines || current.value.replace(/\n$/, '').split('\n');
- current.lines = lines;
-
- if (current.added || current.removed) {
- var _curRange; // If we have previous context, start with that
-
-
- if (!oldRangeStart) {
- var prev = diff[i - 1];
- oldRangeStart = oldLine;
- newRangeStart = newLine;
-
- if (prev) {
- curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
- oldRangeStart -= curRange.length;
- newRangeStart -= curRange.length;
- }
- } // Output our changes
-
-
- (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) {
- return (current.added ? '+' : '-') + entry;
- }))); // Track the updated file position
-
-
- if (current.added) {
- newLine += lines.length;
- } else {
- oldLine += lines.length;
- }
- } else {
- // Identical context lines. Track line changes
- if (oldRangeStart) {
- // Close out any changes that have been output (or join overlapping)
- if (lines.length <= options.context * 2 && i < diff.length - 2) {
- var _curRange2; // Overlapping
-
-
- (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines)));
- } else {
- var _curRange3; // end the range and output
-
-
- var contextSize = Math.min(lines.length, options.context);
-
- (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize))));
-
- var hunk = {
- oldStart: oldRangeStart,
- oldLines: oldLine - oldRangeStart + contextSize,
- newStart: newRangeStart,
- newLines: newLine - newRangeStart + contextSize,
- lines: curRange
- };
-
- if (i >= diff.length - 2 && lines.length <= options.context) {
- // EOF is inside this hunk
- var oldEOFNewline = /\n$/.test(oldStr);
- var newEOFNewline = /\n$/.test(newStr);
- var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
-
- if (!oldEOFNewline && noNlBeforeAdds) {
- // special case: old has no eol and no trailing context; no-nl can end up before adds
- curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
- }
-
- if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
- curRange.push('\\ No newline at end of file');
- }
- }
-
- hunks.push(hunk);
- oldRangeStart = 0;
- newRangeStart = 0;
- curRange = [];
- }
- }
-
- oldLine += lines.length;
- newLine += lines.length;
- }
- };
-
- for (var i = 0; i < diff.length; i++) {
- _loop(i);
- }
-
- return {
- oldFileName: oldFileName,
- newFileName: newFileName,
- oldHeader: oldHeader,
- newHeader: newHeader,
- hunks: hunks
- };
- }
-
- function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
- var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
- var ret = [];
-
- if (oldFileName == newFileName) {
- ret.push('Index: ' + oldFileName);
- }
-
- ret.push('===================================================================');
- ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
- ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
-
- for (var i = 0; i < diff.hunks.length; i++) {
- var hunk = diff.hunks[i];
- ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
- ret.push.apply(ret, hunk.lines);
- }
-
- return ret.join('\n') + '\n';
- }
-
- function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
- return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
- }
-
- function arrayEqual(a, b) {
- if (a.length !== b.length) {
- return false;
- }
-
- return arrayStartsWith(a, b);
- }
-
- function arrayStartsWith(array, start) {
- if (start.length > array.length) {
- return false;
- }
-
- for (var i = 0; i < start.length; i++) {
- if (start[i] !== array[i]) {
- return false;
- }
- }
-
- return true;
- }
-
- function calcLineCount(hunk) {
- var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines),
- oldLines = _calcOldNewLineCount.oldLines,
- newLines = _calcOldNewLineCount.newLines;
-
- if (oldLines !== undefined) {
- hunk.oldLines = oldLines;
- } else {
- delete hunk.oldLines;
- }
-
- if (newLines !== undefined) {
- hunk.newLines = newLines;
- } else {
- delete hunk.newLines;
- }
- }
-
- function merge(mine, theirs, base) {
- mine = loadPatch(mine, base);
- theirs = loadPatch(theirs, base);
- var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning.
- // Leaving sanity checks on this to the API consumer that may know more about the
- // meaning in their own context.
-
- if (mine.index || theirs.index) {
- ret.index = mine.index || theirs.index;
- }
-
- if (mine.newFileName || theirs.newFileName) {
- if (!fileNameChanged(mine)) {
- // No header or no change in ours, use theirs (and ours if theirs does not exist)
- ret.oldFileName = theirs.oldFileName || mine.oldFileName;
- ret.newFileName = theirs.newFileName || mine.newFileName;
- ret.oldHeader = theirs.oldHeader || mine.oldHeader;
- ret.newHeader = theirs.newHeader || mine.newHeader;
- } else if (!fileNameChanged(theirs)) {
- // No header or no change in theirs, use ours
- ret.oldFileName = mine.oldFileName;
- ret.newFileName = mine.newFileName;
- ret.oldHeader = mine.oldHeader;
- ret.newHeader = mine.newHeader;
- } else {
- // Both changed... figure it out
- ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
- ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
- ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
- ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
- }
- }
-
- ret.hunks = [];
- var mineIndex = 0,
- theirsIndex = 0,
- mineOffset = 0,
- theirsOffset = 0;
-
- while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
- var mineCurrent = mine.hunks[mineIndex] || {
- oldStart: Infinity
- },
- theirsCurrent = theirs.hunks[theirsIndex] || {
- oldStart: Infinity
- };
-
- if (hunkBefore(mineCurrent, theirsCurrent)) {
- // This patch does not overlap with any of the others, yay.
- ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
- mineIndex++;
- theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
- } else if (hunkBefore(theirsCurrent, mineCurrent)) {
- // This patch does not overlap with any of the others, yay.
- ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
- theirsIndex++;
- mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
- } else {
- // Overlap, merge as best we can
- var mergedHunk = {
- oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
- oldLines: 0,
- newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
- newLines: 0,
- lines: []
- };
- mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
- theirsIndex++;
- mineIndex++;
- ret.hunks.push(mergedHunk);
- }
- }
-
- return ret;
- }
-
- function loadPatch(param, base) {
- if (typeof param === 'string') {
- if (/^@@/m.test(param) || /^Index:/m.test(param)) {
- return parsePatch(param)[0];
- }
-
- if (!base) {
- throw new Error('Must provide a base reference or pass in a patch');
- }
-
- return structuredPatch(undefined, undefined, base, param);
- }
-
- return param;
- }
-
- function fileNameChanged(patch) {
- return patch.newFileName && patch.newFileName !== patch.oldFileName;
- }
-
- function selectField(index, mine, theirs) {
- if (mine === theirs) {
- return mine;
- } else {
- index.conflict = true;
- return {
- mine: mine,
- theirs: theirs
- };
- }
- }
-
- function hunkBefore(test, check) {
- return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
- }
-
- function cloneHunk(hunk, offset) {
- return {
- oldStart: hunk.oldStart,
- oldLines: hunk.oldLines,
- newStart: hunk.newStart + offset,
- newLines: hunk.newLines,
- lines: hunk.lines
- };
- }
-
- function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
- // This will generally result in a conflicted hunk, but there are cases where the context
- // is the only overlap where we can successfully merge the content here.
- var mine = {
- offset: mineOffset,
- lines: mineLines,
- index: 0
- },
- their = {
- offset: theirOffset,
- lines: theirLines,
- index: 0
- }; // Handle any leading content
-
- insertLeading(hunk, mine, their);
- insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each.
-
- while (mine.index < mine.lines.length && their.index < their.lines.length) {
- var mineCurrent = mine.lines[mine.index],
- theirCurrent = their.lines[their.index];
-
- if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
- // Both modified ...
- mutualChange(hunk, mine, their);
- } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
- var _hunk$lines; // Mine inserted
-
-
- (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine)));
- } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
- var _hunk$lines2; // Theirs inserted
-
-
- (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their)));
- } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
- // Mine removed or edited
- removal(hunk, mine, their);
- } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
- // Their removed or edited
- removal(hunk, their, mine, true);
- } else if (mineCurrent === theirCurrent) {
- // Context identity
- hunk.lines.push(mineCurrent);
- mine.index++;
- their.index++;
- } else {
- // Context mismatch
- conflict(hunk, collectChange(mine), collectChange(their));
- }
- } // Now push anything that may be remaining
-
-
- insertTrailing(hunk, mine);
- insertTrailing(hunk, their);
- calcLineCount(hunk);
- }
-
- function mutualChange(hunk, mine, their) {
- var myChanges = collectChange(mine),
- theirChanges = collectChange(their);
-
- if (allRemoves(myChanges) && allRemoves(theirChanges)) {
- // Special case for remove changes that are supersets of one another
- if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
- var _hunk$lines3;
-
- (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges));
-
- return;
- } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
- var _hunk$lines4;
-
- (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges));
-
- return;
- }
- } else if (arrayEqual(myChanges, theirChanges)) {
- var _hunk$lines5;
-
- (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges));
-
- return;
- }
-
- conflict(hunk, myChanges, theirChanges);
- }
-
- function removal(hunk, mine, their, swap) {
- var myChanges = collectChange(mine),
- theirChanges = collectContext(their, myChanges);
-
- if (theirChanges.merged) {
- var _hunk$lines6;
-
- (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged));
- } else {
- conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
- }
- }
-
- function conflict(hunk, mine, their) {
- hunk.conflict = true;
- hunk.lines.push({
- conflict: true,
- mine: mine,
- theirs: their
- });
- }
-
- function insertLeading(hunk, insert, their) {
- while (insert.offset < their.offset && insert.index < insert.lines.length) {
- var line = insert.lines[insert.index++];
- hunk.lines.push(line);
- insert.offset++;
- }
- }
-
- function insertTrailing(hunk, insert) {
- while (insert.index < insert.lines.length) {
- var line = insert.lines[insert.index++];
- hunk.lines.push(line);
- }
- }
-
- function collectChange(state) {
- var ret = [],
- operation = state.lines[state.index][0];
-
- while (state.index < state.lines.length) {
- var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
-
- if (operation === '-' && line[0] === '+') {
- operation = '+';
- }
-
- if (operation === line[0]) {
- ret.push(line);
- state.index++;
- } else {
- break;
- }
- }
-
- return ret;
- }
-
- function collectContext(state, matchChanges) {
- var changes = [],
- merged = [],
- matchIndex = 0,
- contextChanges = false,
- conflicted = false;
-
- while (matchIndex < matchChanges.length && state.index < state.lines.length) {
- var change = state.lines[state.index],
- match = matchChanges[matchIndex]; // Once we've hit our add, then we are done
-
- if (match[0] === '+') {
- break;
- }
-
- contextChanges = contextChanges || change[0] !== ' ';
- merged.push(match);
- matchIndex++; // Consume any additions in the other block as a conflict to attempt
- // to pull in the remaining context after this
-
- if (change[0] === '+') {
- conflicted = true;
-
- while (change[0] === '+') {
- changes.push(change);
- change = state.lines[++state.index];
- }
- }
-
- if (match.substr(1) === change.substr(1)) {
- changes.push(change);
- state.index++;
- } else {
- conflicted = true;
- }
- }
-
- if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
- conflicted = true;
- }
-
- if (conflicted) {
- return changes;
- }
-
- while (matchIndex < matchChanges.length) {
- merged.push(matchChanges[matchIndex++]);
- }
-
- return {
- merged: merged,
- changes: changes
- };
- }
-
- function allRemoves(changes) {
- return changes.reduce(function (prev, change) {
- return prev && change[0] === '-';
- }, true);
- }
-
- function skipRemoveSuperset(state, removeChanges, delta) {
- for (var i = 0; i < delta; i++) {
- var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
-
- if (state.lines[state.index + i] !== ' ' + changeContent) {
- return false;
- }
- }
-
- state.index += delta;
- return true;
- }
-
- function calcOldNewLineCount(lines) {
- var oldLines = 0;
- var newLines = 0;
- lines.forEach(function (line) {
- if (typeof line !== 'string') {
- var myCount = calcOldNewLineCount(line.mine);
- var theirCount = calcOldNewLineCount(line.theirs);
-
- if (oldLines !== undefined) {
- if (myCount.oldLines === theirCount.oldLines) {
- oldLines += myCount.oldLines;
- } else {
- oldLines = undefined;
- }
- }
-
- if (newLines !== undefined) {
- if (myCount.newLines === theirCount.newLines) {
- newLines += myCount.newLines;
- } else {
- newLines = undefined;
- }
- }
- } else {
- if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
- newLines++;
- }
-
- if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
- oldLines++;
- }
- }
- });
- return {
- oldLines: oldLines,
- newLines: newLines
- };
- } // See: http://code.google.com/p/google-diff-match-patch/wiki/API
-
-
- function convertChangesToDMP(changes) {
- var ret = [],
- change,
- operation;
-
- for (var i = 0; i < changes.length; i++) {
- change = changes[i];
-
- if (change.added) {
- operation = 1;
- } else if (change.removed) {
- operation = -1;
- } else {
- operation = 0;
- }
-
- ret.push([operation, change.value]);
- }
-
- return ret;
- }
-
- function convertChangesToXML(changes) {
- var ret = [];
-
- for (var i = 0; i < changes.length; i++) {
- var change = changes[i];
-
- if (change.added) {
- ret.push('<ins>');
- } else if (change.removed) {
- ret.push('<del>');
- }
-
- ret.push(escapeHTML(change.value));
-
- if (change.added) {
- ret.push('</ins>');
- } else if (change.removed) {
- ret.push('</del>');
- }
- }
-
- return ret.join('');
- }
-
- function escapeHTML(s) {
- var n = s;
- n = n.replace(/&/g, '&');
- n = n.replace(/</g, '<');
- n = n.replace(/>/g, '>');
- n = n.replace(/"/g, '"');
- return n;
- }
-
- var index_es6 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- Diff: Diff,
- diffChars: diffChars,
- diffWords: diffWords,
- diffWordsWithSpace: diffWordsWithSpace,
- diffLines: diffLines,
- diffTrimmedLines: diffTrimmedLines,
- diffSentences: diffSentences,
- diffCss: diffCss,
- diffJson: diffJson,
- diffArrays: diffArrays,
- structuredPatch: structuredPatch,
- createTwoFilesPatch: createTwoFilesPatch,
- createPatch: createPatch,
- applyPatch: applyPatch,
- applyPatches: applyPatches,
- parsePatch: parsePatch,
- merge: merge,
- convertChangesToDMP: convertChangesToDMP,
- convertChangesToXML: convertChangesToXML,
- canonicalize: canonicalize
- });
-
- var _shim_fs = {};
-
- var _shim_fs$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- 'default': _shim_fs
- });
-
- const sep = /[\\/]/;
- function extname(path) {
- const filename = basename(path);
- const dotIndex = filename.lastIndexOf(".");
- if (dotIndex === -1) return "";
- return filename.slice(dotIndex);
- }
- function basename(path) {
- return path.split(sep).pop();
- }
- function isAbsolute() {
- return true;
- }
-
- var path = /*#__PURE__*/Object.freeze({
- __proto__: null,
- extname: extname,
- basename: basename,
- isAbsolute: isAbsolute
- });
-
- var global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
-
- var lookup = [];
- var revLookup = [];
- var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
- var inited = false;
-
- function init() {
- inited = true;
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
-
- for (var i = 0, len = code.length; i < len; ++i) {
- lookup[i] = code[i];
- revLookup[code.charCodeAt(i)] = i;
- }
-
- revLookup['-'.charCodeAt(0)] = 62;
- revLookup['_'.charCodeAt(0)] = 63;
- }
-
- function toByteArray(b64) {
- if (!inited) {
- init();
- }
-
- var i, j, l, tmp, placeHolders, arr;
- var len = b64.length;
-
- if (len % 4 > 0) {
- throw new Error('Invalid string. Length must be a multiple of 4');
- } // the number of equal signs (place holders)
- // if there are two placeholders, than the two characters before it
- // represent one byte
- // if there is only one, then the three characters before it represent 2 bytes
- // this is just a cheap hack to not do indexOf twice
-
-
- placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0; // base64 is 4/3 + up to two characters of the original data
-
- arr = new Arr(len * 3 / 4 - placeHolders); // if there are placeholders, only get up to the last complete 4 chars
-
- l = placeHolders > 0 ? len - 4 : len;
- var L = 0;
-
- for (i = 0, j = 0; i < l; i += 4, j += 3) {
- tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
- arr[L++] = tmp >> 16 & 0xFF;
- arr[L++] = tmp >> 8 & 0xFF;
- arr[L++] = tmp & 0xFF;
- }
-
- if (placeHolders === 2) {
- tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
- arr[L++] = tmp & 0xFF;
- } else if (placeHolders === 1) {
- tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
- arr[L++] = tmp >> 8 & 0xFF;
- arr[L++] = tmp & 0xFF;
- }
-
- return arr;
- }
-
- function tripletToBase64(num) {
- return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
- }
-
- function encodeChunk(uint8, start, end) {
- var tmp;
- var output = [];
-
- for (var i = start; i < end; i += 3) {
- tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
- output.push(tripletToBase64(tmp));
- }
-
- return output.join('');
- }
-
- function fromByteArray(uint8) {
- if (!inited) {
- init();
- }
-
- var tmp;
- var len = uint8.length;
- var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
-
- var output = '';
- var parts = [];
- var maxChunkLength = 16383; // must be multiple of 3
- // go through the array every three bytes, we'll deal with trailing stuff later
-
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
- parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
- } // pad the end with zeros, but make sure to not forget the extra bytes
-
-
- if (extraBytes === 1) {
- tmp = uint8[len - 1];
- output += lookup[tmp >> 2];
- output += lookup[tmp << 4 & 0x3F];
- output += '==';
- } else if (extraBytes === 2) {
- tmp = (uint8[len - 2] << 8) + uint8[len - 1];
- output += lookup[tmp >> 10];
- output += lookup[tmp >> 4 & 0x3F];
- output += lookup[tmp << 2 & 0x3F];
- output += '=';
- }
-
- parts.push(output);
- return parts.join('');
- }
-
- function read(buffer, offset, isLE, mLen, nBytes) {
- var e, m;
- var eLen = nBytes * 8 - mLen - 1;
- var eMax = (1 << eLen) - 1;
- var eBias = eMax >> 1;
- var nBits = -7;
- var i = isLE ? nBytes - 1 : 0;
- var d = isLE ? -1 : 1;
- var s = buffer[offset + i];
- i += d;
- e = s & (1 << -nBits) - 1;
- s >>= -nBits;
- nBits += eLen;
-
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
-
- m = e & (1 << -nBits) - 1;
- e >>= -nBits;
- nBits += mLen;
-
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
-
- if (e === 0) {
- e = 1 - eBias;
- } else if (e === eMax) {
- return m ? NaN : (s ? -1 : 1) * Infinity;
- } else {
- m = m + Math.pow(2, mLen);
- e = e - eBias;
- }
-
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
- }
- function write(buffer, value, offset, isLE, mLen, nBytes) {
- var e, m, c;
- var eLen = nBytes * 8 - mLen - 1;
- var eMax = (1 << eLen) - 1;
- var eBias = eMax >> 1;
- var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
- var i = isLE ? 0 : nBytes - 1;
- var d = isLE ? 1 : -1;
- var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
- value = Math.abs(value);
-
- if (isNaN(value) || value === Infinity) {
- m = isNaN(value) ? 1 : 0;
- e = eMax;
- } else {
- e = Math.floor(Math.log(value) / Math.LN2);
-
- if (value * (c = Math.pow(2, -e)) < 1) {
- e--;
- c *= 2;
- }
-
- if (e + eBias >= 1) {
- value += rt / c;
- } else {
- value += rt * Math.pow(2, 1 - eBias);
- }
-
- if (value * c >= 2) {
- e++;
- c /= 2;
- }
-
- if (e + eBias >= eMax) {
- m = 0;
- e = eMax;
- } else if (e + eBias >= 1) {
- m = (value * c - 1) * Math.pow(2, mLen);
- e = e + eBias;
- } else {
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
- e = 0;
- }
- }
-
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
-
- e = e << mLen | m;
- eLen += mLen;
-
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
-
- buffer[offset + i - d] |= s * 128;
- }
-
- var toString = {}.toString;
- var isArray = Array.isArray || function (arr) {
- return toString.call(arr) == '[object Array]';
- };
-
- var INSPECT_MAX_BYTES = 50;
- /**
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
- * === true Use Uint8Array implementation (fastest)
- * === false Use Object implementation (most compatible, even IE6)
- *
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
- * Opera 11.6+, iOS 4.2+.
- *
- * Due to various browser bugs, sometimes the Object implementation will be used even
- * when the browser supports typed arrays.
- *
- * Note:
- *
- * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
- * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
- *
- * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
- *
- * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
- * incorrect length in some situations.
-
- * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
- * get the Object implementation, which is slower but behaves correctly.
- */
-
- Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined ? global$1.TYPED_ARRAY_SUPPORT : true;
-
- function kMaxLength() {
- return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;
- }
-
- function createBuffer(that, length) {
- if (kMaxLength() < length) {
- throw new RangeError('Invalid typed array length');
- }
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- // Return an augmented `Uint8Array` instance, for best performance
- that = new Uint8Array(length);
- that.__proto__ = Buffer.prototype;
- } else {
- // Fallback: Return an object instance of the Buffer class
- if (that === null) {
- that = new Buffer(length);
- }
-
- that.length = length;
- }
-
- return that;
- }
- /**
- * The Buffer constructor returns instances of `Uint8Array` that have their
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
- * returns a single octet.
- *
- * The `Uint8Array` prototype remains unmodified.
- */
-
-
- function Buffer(arg, encodingOrOffset, length) {
- if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
- return new Buffer(arg, encodingOrOffset, length);
- } // Common case.
-
-
- if (typeof arg === 'number') {
- if (typeof encodingOrOffset === 'string') {
- throw new Error('If encoding is specified then the first argument must be a string');
- }
-
- return allocUnsafe(this, arg);
- }
-
- return from(this, arg, encodingOrOffset, length);
- }
- Buffer.poolSize = 8192; // not used by this implementation
- // TODO: Legacy, not needed anymore. Remove in next major version.
-
- Buffer._augment = function (arr) {
- arr.__proto__ = Buffer.prototype;
- return arr;
- };
-
- function from(that, value, encodingOrOffset, length) {
- if (typeof value === 'number') {
- throw new TypeError('"value" argument must not be a number');
- }
-
- if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
- return fromArrayBuffer(that, value, encodingOrOffset, length);
- }
-
- if (typeof value === 'string') {
- return fromString(that, value, encodingOrOffset);
- }
-
- return fromObject(that, value);
- }
- /**
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
- * if value is a number.
- * Buffer.from(str[, encoding])
- * Buffer.from(array)
- * Buffer.from(buffer)
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
- **/
-
-
- Buffer.from = function (value, encodingOrOffset, length) {
- return from(null, value, encodingOrOffset, length);
- };
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- Buffer.prototype.__proto__ = Uint8Array.prototype;
- Buffer.__proto__ = Uint8Array;
- }
-
- function assertSize(size) {
- if (typeof size !== 'number') {
- throw new TypeError('"size" argument must be a number');
- } else if (size < 0) {
- throw new RangeError('"size" argument must not be negative');
- }
- }
-
- function alloc(that, size, fill, encoding) {
- assertSize(size);
-
- if (size <= 0) {
- return createBuffer(that, size);
- }
-
- if (fill !== undefined) {
- // Only pay attention to encoding if it's a string. This
- // prevents accidentally sending in a number that would
- // be interpretted as a start offset.
- return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
- }
-
- return createBuffer(that, size);
- }
- /**
- * Creates a new filled Buffer instance.
- * alloc(size[, fill[, encoding]])
- **/
-
-
- Buffer.alloc = function (size, fill, encoding) {
- return alloc(null, size, fill, encoding);
- };
-
- function allocUnsafe(that, size) {
- assertSize(size);
- that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
-
- if (!Buffer.TYPED_ARRAY_SUPPORT) {
- for (var i = 0; i < size; ++i) {
- that[i] = 0;
- }
- }
-
- return that;
- }
- /**
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
- * */
-
-
- Buffer.allocUnsafe = function (size) {
- return allocUnsafe(null, size);
- };
- /**
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
- */
-
-
- Buffer.allocUnsafeSlow = function (size) {
- return allocUnsafe(null, size);
- };
-
- function fromString(that, string, encoding) {
- if (typeof encoding !== 'string' || encoding === '') {
- encoding = 'utf8';
- }
-
- if (!Buffer.isEncoding(encoding)) {
- throw new TypeError('"encoding" must be a valid string encoding');
- }
-
- var length = byteLength(string, encoding) | 0;
- that = createBuffer(that, length);
- var actual = that.write(string, encoding);
-
- if (actual !== length) {
- // Writing a hex string, for example, that contains invalid characters will
- // cause everything after the first invalid character to be ignored. (e.g.
- // 'abxxcd' will be treated as 'ab')
- that = that.slice(0, actual);
- }
-
- return that;
- }
-
- function fromArrayLike(that, array) {
- var length = array.length < 0 ? 0 : checked(array.length) | 0;
- that = createBuffer(that, length);
-
- for (var i = 0; i < length; i += 1) {
- that[i] = array[i] & 255;
- }
-
- return that;
- }
-
- function fromArrayBuffer(that, array, byteOffset, length) {
- array.byteLength; // this throws if `array` is not a valid ArrayBuffer
-
- if (byteOffset < 0 || array.byteLength < byteOffset) {
- throw new RangeError('\'offset\' is out of bounds');
- }
-
- if (array.byteLength < byteOffset + (length || 0)) {
- throw new RangeError('\'length\' is out of bounds');
- }
-
- if (byteOffset === undefined && length === undefined) {
- array = new Uint8Array(array);
- } else if (length === undefined) {
- array = new Uint8Array(array, byteOffset);
- } else {
- array = new Uint8Array(array, byteOffset, length);
- }
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- // Return an augmented `Uint8Array` instance, for best performance
- that = array;
- that.__proto__ = Buffer.prototype;
- } else {
- // Fallback: Return an object instance of the Buffer class
- that = fromArrayLike(that, array);
- }
-
- return that;
- }
-
- function fromObject(that, obj) {
- if (internalIsBuffer(obj)) {
- var len = checked(obj.length) | 0;
- that = createBuffer(that, len);
-
- if (that.length === 0) {
- return that;
- }
-
- obj.copy(that, 0, 0, len);
- return that;
- }
-
- if (obj) {
- if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {
- if (typeof obj.length !== 'number' || isnan(obj.length)) {
- return createBuffer(that, 0);
- }
-
- return fromArrayLike(that, obj);
- }
-
- if (obj.type === 'Buffer' && isArray(obj.data)) {
- return fromArrayLike(that, obj.data);
- }
- }
-
- throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');
- }
-
- function checked(length) {
- // Note: cannot use `length < kMaxLength()` here because that fails when
- // length is NaN (which is otherwise coerced to zero.)
- if (length >= kMaxLength()) {
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');
- }
-
- return length | 0;
- }
- Buffer.isBuffer = isBuffer;
-
- function internalIsBuffer(b) {
- return !!(b != null && b._isBuffer);
- }
-
- Buffer.compare = function compare(a, b) {
- if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
- throw new TypeError('Arguments must be Buffers');
- }
-
- if (a === b) return 0;
- var x = a.length;
- var y = b.length;
-
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
- if (a[i] !== b[i]) {
- x = a[i];
- y = b[i];
- break;
- }
- }
-
- if (x < y) return -1;
- if (y < x) return 1;
- return 0;
- };
-
- Buffer.isEncoding = function isEncoding(encoding) {
- switch (String(encoding).toLowerCase()) {
- case 'hex':
- case 'utf8':
- case 'utf-8':
- case 'ascii':
- case 'latin1':
- case 'binary':
- case 'base64':
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return true;
-
- default:
- return false;
- }
- };
-
- Buffer.concat = function concat(list, length) {
- if (!isArray(list)) {
- throw new TypeError('"list" argument must be an Array of Buffers');
- }
-
- if (list.length === 0) {
- return Buffer.alloc(0);
- }
-
- var i;
-
- if (length === undefined) {
- length = 0;
-
- for (i = 0; i < list.length; ++i) {
- length += list[i].length;
- }
- }
-
- var buffer = Buffer.allocUnsafe(length);
- var pos = 0;
-
- for (i = 0; i < list.length; ++i) {
- var buf = list[i];
-
- if (!internalIsBuffer(buf)) {
- throw new TypeError('"list" argument must be an Array of Buffers');
- }
-
- buf.copy(buffer, pos);
- pos += buf.length;
- }
-
- return buffer;
- };
-
- function byteLength(string, encoding) {
- if (internalIsBuffer(string)) {
- return string.length;
- }
-
- if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
- return string.byteLength;
- }
-
- if (typeof string !== 'string') {
- string = '' + string;
- }
-
- var len = string.length;
- if (len === 0) return 0; // Use a for loop to avoid recursion
-
- var loweredCase = false;
-
- for (;;) {
- switch (encoding) {
- case 'ascii':
- case 'latin1':
- case 'binary':
- return len;
-
- case 'utf8':
- case 'utf-8':
- case undefined:
- return utf8ToBytes(string).length;
-
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return len * 2;
-
- case 'hex':
- return len >>> 1;
-
- case 'base64':
- return base64ToBytes(string).length;
-
- default:
- if (loweredCase) return utf8ToBytes(string).length; // assume utf8
-
- encoding = ('' + encoding).toLowerCase();
- loweredCase = true;
- }
- }
- }
-
- Buffer.byteLength = byteLength;
-
- function slowToString(encoding, start, end) {
- var loweredCase = false; // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
- // property of a typed array.
- // This behaves neither like String nor Uint8Array in that we set start/end
- // to their upper/lower bounds if the value passed is out of range.
- // undefined is handled specially as per ECMA-262 6th Edition,
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
-
- if (start === undefined || start < 0) {
- start = 0;
- } // Return early if start > this.length. Done here to prevent potential uint32
- // coercion fail below.
-
-
- if (start > this.length) {
- return '';
- }
-
- if (end === undefined || end > this.length) {
- end = this.length;
- }
-
- if (end <= 0) {
- return '';
- } // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
-
-
- end >>>= 0;
- start >>>= 0;
-
- if (end <= start) {
- return '';
- }
-
- if (!encoding) encoding = 'utf8';
-
- while (true) {
- switch (encoding) {
- case 'hex':
- return hexSlice(this, start, end);
-
- case 'utf8':
- case 'utf-8':
- return utf8Slice(this, start, end);
-
- case 'ascii':
- return asciiSlice(this, start, end);
-
- case 'latin1':
- case 'binary':
- return latin1Slice(this, start, end);
-
- case 'base64':
- return base64Slice(this, start, end);
-
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return utf16leSlice(this, start, end);
-
- default:
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
- encoding = (encoding + '').toLowerCase();
- loweredCase = true;
- }
- }
- } // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
- // Buffer instances.
-
-
- Buffer.prototype._isBuffer = true;
-
- function swap(b, n, m) {
- var i = b[n];
- b[n] = b[m];
- b[m] = i;
- }
-
- Buffer.prototype.swap16 = function swap16() {
- var len = this.length;
-
- if (len % 2 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 16-bits');
- }
-
- for (var i = 0; i < len; i += 2) {
- swap(this, i, i + 1);
- }
-
- return this;
- };
-
- Buffer.prototype.swap32 = function swap32() {
- var len = this.length;
-
- if (len % 4 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 32-bits');
- }
-
- for (var i = 0; i < len; i += 4) {
- swap(this, i, i + 3);
- swap(this, i + 1, i + 2);
- }
-
- return this;
- };
-
- Buffer.prototype.swap64 = function swap64() {
- var len = this.length;
-
- if (len % 8 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 64-bits');
- }
-
- for (var i = 0; i < len; i += 8) {
- swap(this, i, i + 7);
- swap(this, i + 1, i + 6);
- swap(this, i + 2, i + 5);
- swap(this, i + 3, i + 4);
- }
-
- return this;
- };
-
- Buffer.prototype.toString = function toString() {
- var length = this.length | 0;
- if (length === 0) return '';
- if (arguments.length === 0) return utf8Slice(this, 0, length);
- return slowToString.apply(this, arguments);
- };
-
- Buffer.prototype.equals = function equals(b) {
- if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer');
- if (this === b) return true;
- return Buffer.compare(this, b) === 0;
- };
-
- Buffer.prototype.inspect = function inspect() {
- var str = '';
- var max = INSPECT_MAX_BYTES;
-
- if (this.length > 0) {
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
- if (this.length > max) str += ' ... ';
- }
-
- return '<Buffer ' + str + '>';
- };
-
- Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
- if (!internalIsBuffer(target)) {
- throw new TypeError('Argument must be a Buffer');
- }
-
- if (start === undefined) {
- start = 0;
- }
-
- if (end === undefined) {
- end = target ? target.length : 0;
- }
-
- if (thisStart === undefined) {
- thisStart = 0;
- }
-
- if (thisEnd === undefined) {
- thisEnd = this.length;
- }
-
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
- throw new RangeError('out of range index');
- }
-
- if (thisStart >= thisEnd && start >= end) {
- return 0;
- }
-
- if (thisStart >= thisEnd) {
- return -1;
- }
-
- if (start >= end) {
- return 1;
- }
-
- start >>>= 0;
- end >>>= 0;
- thisStart >>>= 0;
- thisEnd >>>= 0;
- if (this === target) return 0;
- var x = thisEnd - thisStart;
- var y = end - start;
- var len = Math.min(x, y);
- var thisCopy = this.slice(thisStart, thisEnd);
- var targetCopy = target.slice(start, end);
-
- for (var i = 0; i < len; ++i) {
- if (thisCopy[i] !== targetCopy[i]) {
- x = thisCopy[i];
- y = targetCopy[i];
- break;
- }
- }
-
- if (x < y) return -1;
- if (y < x) return 1;
- return 0;
- }; // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
- //
- // Arguments:
- // - buffer - a Buffer to search
- // - val - a string, Buffer, or number
- // - byteOffset - an index into `buffer`; will be clamped to an int32
- // - encoding - an optional encoding, relevant is val is a string
- // - dir - true for indexOf, false for lastIndexOf
-
-
- function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
- // Empty buffer means no match
- if (buffer.length === 0) return -1; // Normalize byteOffset
-
- if (typeof byteOffset === 'string') {
- encoding = byteOffset;
- byteOffset = 0;
- } else if (byteOffset > 0x7fffffff) {
- byteOffset = 0x7fffffff;
- } else if (byteOffset < -0x80000000) {
- byteOffset = -0x80000000;
- }
-
- byteOffset = +byteOffset; // Coerce to Number.
-
- if (isNaN(byteOffset)) {
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
- byteOffset = dir ? 0 : buffer.length - 1;
- } // Normalize byteOffset: negative offsets start from the end of the buffer
-
-
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
-
- if (byteOffset >= buffer.length) {
- if (dir) return -1;else byteOffset = buffer.length - 1;
- } else if (byteOffset < 0) {
- if (dir) byteOffset = 0;else return -1;
- } // Normalize val
-
-
- if (typeof val === 'string') {
- val = Buffer.from(val, encoding);
- } // Finally, search either indexOf (if dir is true) or lastIndexOf
-
-
- if (internalIsBuffer(val)) {
- // Special case: looking for empty string/buffer always fails
- if (val.length === 0) {
- return -1;
- }
-
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
- } else if (typeof val === 'number') {
- val = val & 0xFF; // Search for a byte value [0-255]
-
- if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {
- if (dir) {
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
- } else {
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
- }
- }
-
- return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
- }
-
- throw new TypeError('val must be string, number or Buffer');
- }
-
- function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
- var indexSize = 1;
- var arrLength = arr.length;
- var valLength = val.length;
-
- if (encoding !== undefined) {
- encoding = String(encoding).toLowerCase();
-
- if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
- if (arr.length < 2 || val.length < 2) {
- return -1;
- }
-
- indexSize = 2;
- arrLength /= 2;
- valLength /= 2;
- byteOffset /= 2;
- }
- }
-
- function read(buf, i) {
- if (indexSize === 1) {
- return buf[i];
- } else {
- return buf.readUInt16BE(i * indexSize);
- }
- }
-
- var i;
-
- if (dir) {
- var foundIndex = -1;
-
- for (i = byteOffset; i < arrLength; i++) {
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
- if (foundIndex === -1) foundIndex = i;
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
- } else {
- if (foundIndex !== -1) i -= i - foundIndex;
- foundIndex = -1;
- }
- }
- } else {
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
-
- for (i = byteOffset; i >= 0; i--) {
- var found = true;
-
- for (var j = 0; j < valLength; j++) {
- if (read(arr, i + j) !== read(val, j)) {
- found = false;
- break;
- }
- }
-
- if (found) return i;
- }
- }
-
- return -1;
- }
-
- Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
- return this.indexOf(val, byteOffset, encoding) !== -1;
- };
-
- Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
- };
-
- Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
- };
-
- function hexWrite(buf, string, offset, length) {
- offset = Number(offset) || 0;
- var remaining = buf.length - offset;
-
- if (!length) {
- length = remaining;
- } else {
- length = Number(length);
-
- if (length > remaining) {
- length = remaining;
- }
- } // must be an even number of digits
-
-
- var strLen = string.length;
- if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');
-
- if (length > strLen / 2) {
- length = strLen / 2;
- }
-
- for (var i = 0; i < length; ++i) {
- var parsed = parseInt(string.substr(i * 2, 2), 16);
- if (isNaN(parsed)) return i;
- buf[offset + i] = parsed;
- }
-
- return i;
- }
-
- function utf8Write(buf, string, offset, length) {
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
- }
-
- function asciiWrite(buf, string, offset, length) {
- return blitBuffer(asciiToBytes(string), buf, offset, length);
- }
-
- function latin1Write(buf, string, offset, length) {
- return asciiWrite(buf, string, offset, length);
- }
-
- function base64Write(buf, string, offset, length) {
- return blitBuffer(base64ToBytes(string), buf, offset, length);
- }
-
- function ucs2Write(buf, string, offset, length) {
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
- }
-
- Buffer.prototype.write = function write(string, offset, length, encoding) {
- // Buffer#write(string)
- if (offset === undefined) {
- encoding = 'utf8';
- length = this.length;
- offset = 0; // Buffer#write(string, encoding)
- } else if (length === undefined && typeof offset === 'string') {
- encoding = offset;
- length = this.length;
- offset = 0; // Buffer#write(string, offset[, length][, encoding])
- } else if (isFinite(offset)) {
- offset = offset | 0;
-
- if (isFinite(length)) {
- length = length | 0;
- if (encoding === undefined) encoding = 'utf8';
- } else {
- encoding = length;
- length = undefined;
- } // legacy write(string, encoding, offset, length) - remove in v0.13
-
- } else {
- throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
- }
-
- var remaining = this.length - offset;
- if (length === undefined || length > remaining) length = remaining;
-
- if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
- throw new RangeError('Attempt to write outside buffer bounds');
- }
-
- if (!encoding) encoding = 'utf8';
- var loweredCase = false;
-
- for (;;) {
- switch (encoding) {
- case 'hex':
- return hexWrite(this, string, offset, length);
-
- case 'utf8':
- case 'utf-8':
- return utf8Write(this, string, offset, length);
-
- case 'ascii':
- return asciiWrite(this, string, offset, length);
-
- case 'latin1':
- case 'binary':
- return latin1Write(this, string, offset, length);
-
- case 'base64':
- // Warning: maxLength not taken into account in base64Write
- return base64Write(this, string, offset, length);
-
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return ucs2Write(this, string, offset, length);
-
- default:
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
- encoding = ('' + encoding).toLowerCase();
- loweredCase = true;
- }
- }
- };
-
- Buffer.prototype.toJSON = function toJSON() {
- return {
- type: 'Buffer',
- data: Array.prototype.slice.call(this._arr || this, 0)
- };
- };
-
- function base64Slice(buf, start, end) {
- if (start === 0 && end === buf.length) {
- return fromByteArray(buf);
- } else {
- return fromByteArray(buf.slice(start, end));
- }
- }
-
- function utf8Slice(buf, start, end) {
- end = Math.min(buf.length, end);
- var res = [];
- var i = start;
-
- while (i < end) {
- var firstByte = buf[i];
- var codePoint = null;
- var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
-
- if (i + bytesPerSequence <= end) {
- var secondByte, thirdByte, fourthByte, tempCodePoint;
-
- switch (bytesPerSequence) {
- case 1:
- if (firstByte < 0x80) {
- codePoint = firstByte;
- }
-
- break;
-
- case 2:
- secondByte = buf[i + 1];
-
- if ((secondByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
-
- if (tempCodePoint > 0x7F) {
- codePoint = tempCodePoint;
- }
- }
-
- break;
-
- case 3:
- secondByte = buf[i + 1];
- thirdByte = buf[i + 2];
-
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
-
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
- codePoint = tempCodePoint;
- }
- }
-
- break;
-
- case 4:
- secondByte = buf[i + 1];
- thirdByte = buf[i + 2];
- fourthByte = buf[i + 3];
-
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
-
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
- codePoint = tempCodePoint;
- }
- }
-
- }
- }
-
- if (codePoint === null) {
- // we did not generate a valid codePoint so insert a
- // replacement char (U+FFFD) and advance only 1 byte
- codePoint = 0xFFFD;
- bytesPerSequence = 1;
- } else if (codePoint > 0xFFFF) {
- // encode to utf16 (surrogate pair dance)
- codePoint -= 0x10000;
- res.push(codePoint >>> 10 & 0x3FF | 0xD800);
- codePoint = 0xDC00 | codePoint & 0x3FF;
- }
-
- res.push(codePoint);
- i += bytesPerSequence;
- }
-
- return decodeCodePointsArray(res);
- } // Based on http://stackoverflow.com/a/22747272/680742, the browser with
- // the lowest limit is Chrome, with 0x10000 args.
- // We go 1 magnitude less, for safety
-
-
- var MAX_ARGUMENTS_LENGTH = 0x1000;
-
- function decodeCodePointsArray(codePoints) {
- var len = codePoints.length;
-
- if (len <= MAX_ARGUMENTS_LENGTH) {
- return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
- } // Decode in chunks to avoid "call stack size exceeded".
-
-
- var res = '';
- var i = 0;
-
- while (i < len) {
- res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
- }
-
- return res;
- }
-
- function asciiSlice(buf, start, end) {
- var ret = '';
- end = Math.min(buf.length, end);
-
- for (var i = start; i < end; ++i) {
- ret += String.fromCharCode(buf[i] & 0x7F);
- }
-
- return ret;
- }
-
- function latin1Slice(buf, start, end) {
- var ret = '';
- end = Math.min(buf.length, end);
-
- for (var i = start; i < end; ++i) {
- ret += String.fromCharCode(buf[i]);
- }
-
- return ret;
- }
-
- function hexSlice(buf, start, end) {
- var len = buf.length;
- if (!start || start < 0) start = 0;
- if (!end || end < 0 || end > len) end = len;
- var out = '';
-
- for (var i = start; i < end; ++i) {
- out += toHex(buf[i]);
- }
-
- return out;
- }
-
- function utf16leSlice(buf, start, end) {
- var bytes = buf.slice(start, end);
- var res = '';
-
- for (var i = 0; i < bytes.length; i += 2) {
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
- }
-
- return res;
- }
-
- Buffer.prototype.slice = function slice(start, end) {
- var len = this.length;
- start = ~~start;
- end = end === undefined ? len : ~~end;
-
- if (start < 0) {
- start += len;
- if (start < 0) start = 0;
- } else if (start > len) {
- start = len;
- }
-
- if (end < 0) {
- end += len;
- if (end < 0) end = 0;
- } else if (end > len) {
- end = len;
- }
-
- if (end < start) end = start;
- var newBuf;
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- newBuf = this.subarray(start, end);
- newBuf.__proto__ = Buffer.prototype;
- } else {
- var sliceLen = end - start;
- newBuf = new Buffer(sliceLen, undefined);
-
- for (var i = 0; i < sliceLen; ++i) {
- newBuf[i] = this[i + start];
- }
- }
-
- return newBuf;
- };
- /*
- * Need to make sure that buffer isn't trying to write out of bounds.
- */
-
-
- function checkOffset(offset, ext, length) {
- if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
- }
-
- Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
- offset = offset | 0;
- byteLength = byteLength | 0;
- if (!noAssert) checkOffset(offset, byteLength, this.length);
- var val = this[offset];
- var mul = 1;
- var i = 0;
-
- while (++i < byteLength && (mul *= 0x100)) {
- val += this[offset + i] * mul;
- }
-
- return val;
- };
-
- Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
- offset = offset | 0;
- byteLength = byteLength | 0;
-
- if (!noAssert) {
- checkOffset(offset, byteLength, this.length);
- }
-
- var val = this[offset + --byteLength];
- var mul = 1;
-
- while (byteLength > 0 && (mul *= 0x100)) {
- val += this[offset + --byteLength] * mul;
- }
-
- return val;
- };
-
- Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 1, this.length);
- return this[offset];
- };
-
- Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length);
- return this[offset] | this[offset + 1] << 8;
- };
-
- Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length);
- return this[offset] << 8 | this[offset + 1];
- };
-
- Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length);
- return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
- };
-
- Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length);
- return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
- };
-
- Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
- offset = offset | 0;
- byteLength = byteLength | 0;
- if (!noAssert) checkOffset(offset, byteLength, this.length);
- var val = this[offset];
- var mul = 1;
- var i = 0;
-
- while (++i < byteLength && (mul *= 0x100)) {
- val += this[offset + i] * mul;
- }
-
- mul *= 0x80;
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
- return val;
- };
-
- Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
- offset = offset | 0;
- byteLength = byteLength | 0;
- if (!noAssert) checkOffset(offset, byteLength, this.length);
- var i = byteLength;
- var mul = 1;
- var val = this[offset + --i];
-
- while (i > 0 && (mul *= 0x100)) {
- val += this[offset + --i] * mul;
- }
-
- mul *= 0x80;
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
- return val;
- };
-
- Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 1, this.length);
- if (!(this[offset] & 0x80)) return this[offset];
- return (0xff - this[offset] + 1) * -1;
- };
-
- Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length);
- var val = this[offset] | this[offset + 1] << 8;
- return val & 0x8000 ? val | 0xFFFF0000 : val;
- };
-
- Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length);
- var val = this[offset + 1] | this[offset] << 8;
- return val & 0x8000 ? val | 0xFFFF0000 : val;
- };
-
- Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length);
- return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
- };
-
- Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length);
- return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
- };
-
- Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length);
- return read(this, offset, true, 23, 4);
- };
-
- Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length);
- return read(this, offset, false, 23, 4);
- };
-
- Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 8, this.length);
- return read(this, offset, true, 52, 8);
- };
-
- Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
- if (!noAssert) checkOffset(offset, 8, this.length);
- return read(this, offset, false, 52, 8);
- };
-
- function checkInt(buf, value, offset, ext, max, min) {
- if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
- if (offset + ext > buf.length) throw new RangeError('Index out of range');
- }
-
- Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
- value = +value;
- offset = offset | 0;
- byteLength = byteLength | 0;
-
- if (!noAssert) {
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
- checkInt(this, value, offset, byteLength, maxBytes, 0);
- }
-
- var mul = 1;
- var i = 0;
- this[offset] = value & 0xFF;
-
- while (++i < byteLength && (mul *= 0x100)) {
- this[offset + i] = value / mul & 0xFF;
- }
-
- return offset + byteLength;
- };
-
- Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
- value = +value;
- offset = offset | 0;
- byteLength = byteLength | 0;
-
- if (!noAssert) {
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
- checkInt(this, value, offset, byteLength, maxBytes, 0);
- }
-
- var i = byteLength - 1;
- var mul = 1;
- this[offset + i] = value & 0xFF;
-
- while (--i >= 0 && (mul *= 0x100)) {
- this[offset + i] = value / mul & 0xFF;
- }
-
- return offset + byteLength;
- };
-
- Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
- value = +value;
- offset = offset | 0;
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
- this[offset] = value & 0xff;
- return offset + 1;
- };
-
- function objectWriteUInt16(buf, value, offset, littleEndian) {
- if (value < 0) value = 0xffff + value + 1;
-
- for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
- buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
- }
- }
-
- Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
- value = +value;
- offset = offset | 0;
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = value & 0xff;
- this[offset + 1] = value >>> 8;
- } else {
- objectWriteUInt16(this, value, offset, true);
- }
-
- return offset + 2;
- };
-
- Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
- value = +value;
- offset = offset | 0;
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = value >>> 8;
- this[offset + 1] = value & 0xff;
- } else {
- objectWriteUInt16(this, value, offset, false);
- }
-
- return offset + 2;
- };
-
- function objectWriteUInt32(buf, value, offset, littleEndian) {
- if (value < 0) value = 0xffffffff + value + 1;
-
- for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
- buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;
- }
- }
-
- Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
- value = +value;
- offset = offset | 0;
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset + 3] = value >>> 24;
- this[offset + 2] = value >>> 16;
- this[offset + 1] = value >>> 8;
- this[offset] = value & 0xff;
- } else {
- objectWriteUInt32(this, value, offset, true);
- }
-
- return offset + 4;
- };
-
- Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
- value = +value;
- offset = offset | 0;
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = value >>> 24;
- this[offset + 1] = value >>> 16;
- this[offset + 2] = value >>> 8;
- this[offset + 3] = value & 0xff;
- } else {
- objectWriteUInt32(this, value, offset, false);
- }
-
- return offset + 4;
- };
-
- Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
- value = +value;
- offset = offset | 0;
-
- if (!noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1);
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
- }
-
- var i = 0;
- var mul = 1;
- var sub = 0;
- this[offset] = value & 0xFF;
-
- while (++i < byteLength && (mul *= 0x100)) {
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
- sub = 1;
- }
-
- this[offset + i] = (value / mul >> 0) - sub & 0xFF;
- }
-
- return offset + byteLength;
- };
-
- Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
- value = +value;
- offset = offset | 0;
-
- if (!noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1);
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
- }
-
- var i = byteLength - 1;
- var mul = 1;
- var sub = 0;
- this[offset + i] = value & 0xFF;
-
- while (--i >= 0 && (mul *= 0x100)) {
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
- sub = 1;
- }
-
- this[offset + i] = (value / mul >> 0) - sub & 0xFF;
- }
-
- return offset + byteLength;
- };
-
- Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
- value = +value;
- offset = offset | 0;
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
- if (value < 0) value = 0xff + value + 1;
- this[offset] = value & 0xff;
- return offset + 1;
- };
-
- Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
- value = +value;
- offset = offset | 0;
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = value & 0xff;
- this[offset + 1] = value >>> 8;
- } else {
- objectWriteUInt16(this, value, offset, true);
- }
-
- return offset + 2;
- };
-
- Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
- value = +value;
- offset = offset | 0;
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = value >>> 8;
- this[offset + 1] = value & 0xff;
- } else {
- objectWriteUInt16(this, value, offset, false);
- }
-
- return offset + 2;
- };
-
- Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
- value = +value;
- offset = offset | 0;
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = value & 0xff;
- this[offset + 1] = value >>> 8;
- this[offset + 2] = value >>> 16;
- this[offset + 3] = value >>> 24;
- } else {
- objectWriteUInt32(this, value, offset, true);
- }
-
- return offset + 4;
- };
-
- Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
- value = +value;
- offset = offset | 0;
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
- if (value < 0) value = 0xffffffff + value + 1;
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = value >>> 24;
- this[offset + 1] = value >>> 16;
- this[offset + 2] = value >>> 8;
- this[offset + 3] = value & 0xff;
- } else {
- objectWriteUInt32(this, value, offset, false);
- }
-
- return offset + 4;
- };
-
- function checkIEEE754(buf, value, offset, ext, max, min) {
- if (offset + ext > buf.length) throw new RangeError('Index out of range');
- if (offset < 0) throw new RangeError('Index out of range');
- }
-
- function writeFloat(buf, value, offset, littleEndian, noAssert) {
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 4);
- }
-
- write(buf, value, offset, littleEndian, 23, 4);
- return offset + 4;
- }
-
- Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
- return writeFloat(this, value, offset, true, noAssert);
- };
-
- Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
- return writeFloat(this, value, offset, false, noAssert);
- };
-
- function writeDouble(buf, value, offset, littleEndian, noAssert) {
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 8);
- }
-
- write(buf, value, offset, littleEndian, 52, 8);
- return offset + 8;
- }
-
- Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
- return writeDouble(this, value, offset, true, noAssert);
- };
-
- Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
- return writeDouble(this, value, offset, false, noAssert);
- }; // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
-
-
- Buffer.prototype.copy = function copy(target, targetStart, start, end) {
- if (!start) start = 0;
- if (!end && end !== 0) end = this.length;
- if (targetStart >= target.length) targetStart = target.length;
- if (!targetStart) targetStart = 0;
- if (end > 0 && end < start) end = start; // Copy 0 bytes; we're done
-
- if (end === start) return 0;
- if (target.length === 0 || this.length === 0) return 0; // Fatal error conditions
-
- if (targetStart < 0) {
- throw new RangeError('targetStart out of bounds');
- }
-
- if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');
- if (end < 0) throw new RangeError('sourceEnd out of bounds'); // Are we oob?
-
- if (end > this.length) end = this.length;
-
- if (target.length - targetStart < end - start) {
- end = target.length - targetStart + start;
- }
-
- var len = end - start;
- var i;
-
- if (this === target && start < targetStart && targetStart < end) {
- // descending copy from end
- for (i = len - 1; i >= 0; --i) {
- target[i + targetStart] = this[i + start];
- }
- } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
- // ascending copy from start
- for (i = 0; i < len; ++i) {
- target[i + targetStart] = this[i + start];
- }
- } else {
- Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
- }
-
- return len;
- }; // Usage:
- // buffer.fill(number[, offset[, end]])
- // buffer.fill(buffer[, offset[, end]])
- // buffer.fill(string[, offset[, end]][, encoding])
-
-
- Buffer.prototype.fill = function fill(val, start, end, encoding) {
- // Handle string cases:
- if (typeof val === 'string') {
- if (typeof start === 'string') {
- encoding = start;
- start = 0;
- end = this.length;
- } else if (typeof end === 'string') {
- encoding = end;
- end = this.length;
- }
-
- if (val.length === 1) {
- var code = val.charCodeAt(0);
-
- if (code < 256) {
- val = code;
- }
- }
-
- if (encoding !== undefined && typeof encoding !== 'string') {
- throw new TypeError('encoding must be a string');
- }
-
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
- throw new TypeError('Unknown encoding: ' + encoding);
- }
- } else if (typeof val === 'number') {
- val = val & 255;
- } // Invalid ranges are not set to a default, so can range check early.
-
-
- if (start < 0 || this.length < start || this.length < end) {
- throw new RangeError('Out of range index');
- }
-
- if (end <= start) {
- return this;
- }
-
- start = start >>> 0;
- end = end === undefined ? this.length : end >>> 0;
- if (!val) val = 0;
- var i;
-
- if (typeof val === 'number') {
- for (i = start; i < end; ++i) {
- this[i] = val;
- }
- } else {
- var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString());
- var len = bytes.length;
-
- for (i = 0; i < end - start; ++i) {
- this[i + start] = bytes[i % len];
- }
- }
-
- return this;
- }; // HELPER FUNCTIONS
- // ================
-
-
- var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
-
- function base64clean(str) {
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
- str = stringtrim(str).replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to ''
-
- if (str.length < 2) return ''; // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
-
- while (str.length % 4 !== 0) {
- str = str + '=';
- }
-
- return str;
- }
-
- function stringtrim(str) {
- if (str.trim) return str.trim();
- return str.replace(/^\s+|\s+$/g, '');
- }
-
- function toHex(n) {
- if (n < 16) return '0' + n.toString(16);
- return n.toString(16);
- }
-
- function utf8ToBytes(string, units) {
- units = units || Infinity;
- var codePoint;
- var length = string.length;
- var leadSurrogate = null;
- var bytes = [];
-
- for (var i = 0; i < length; ++i) {
- codePoint = string.charCodeAt(i); // is surrogate component
-
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
- // last char was a lead
- if (!leadSurrogate) {
- // no lead yet
- if (codePoint > 0xDBFF) {
- // unexpected trail
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
- continue;
- } else if (i + 1 === length) {
- // unpaired lead
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
- continue;
- } // valid lead
-
-
- leadSurrogate = codePoint;
- continue;
- } // 2 leads in a row
-
-
- if (codePoint < 0xDC00) {
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
- leadSurrogate = codePoint;
- continue;
- } // valid surrogate pair
-
-
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
- } else if (leadSurrogate) {
- // valid bmp char, but last char was a lead
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
- }
-
- leadSurrogate = null; // encode utf8
-
- if (codePoint < 0x80) {
- if ((units -= 1) < 0) break;
- bytes.push(codePoint);
- } else if (codePoint < 0x800) {
- if ((units -= 2) < 0) break;
- bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
- } else if (codePoint < 0x10000) {
- if ((units -= 3) < 0) break;
- bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
- } else if (codePoint < 0x110000) {
- if ((units -= 4) < 0) break;
- bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
- } else {
- throw new Error('Invalid code point');
- }
- }
-
- return bytes;
- }
-
- function asciiToBytes(str) {
- var byteArray = [];
-
- for (var i = 0; i < str.length; ++i) {
- // Node's code seems to be doing this and not & 0x7F..
- byteArray.push(str.charCodeAt(i) & 0xFF);
- }
-
- return byteArray;
- }
-
- function utf16leToBytes(str, units) {
- var c, hi, lo;
- var byteArray = [];
-
- for (var i = 0; i < str.length; ++i) {
- if ((units -= 2) < 0) break;
- c = str.charCodeAt(i);
- hi = c >> 8;
- lo = c % 256;
- byteArray.push(lo);
- byteArray.push(hi);
- }
-
- return byteArray;
- }
-
- function base64ToBytes(str) {
- return toByteArray(base64clean(str));
- }
-
- function blitBuffer(src, dst, offset, length) {
- for (var i = 0; i < length; ++i) {
- if (i + offset >= dst.length || i >= src.length) break;
- dst[i + offset] = src[i];
- }
-
- return i;
- }
-
- function isnan(val) {
- return val !== val; // eslint-disable-line no-self-compare
- } // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
- // The _isBuffer check is for Safari 5-7 support, because it's missing
- // Object.prototype.constructor. Remove this eventually
-
-
- function isBuffer(obj) {
- return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj));
- }
-
- function isFastBuffer(obj) {
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
- } // For Node v0.10 support. Remove this eventually.
-
-
- function isSlowBuffer(obj) {
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0));
- }
-
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
-
- function unwrapExports (x) {
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
- }
-
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
-
- function getCjsExportFromNamespace (n) {
- return n && n['default'] || n;
- }
-
- var fs = getCjsExportFromNamespace(_shim_fs$1);
-
- /**
- * @class
- */
-
-
- class LineByLine {
- constructor(file, options) {
- options = options || {};
- if (!options.readChunk) options.readChunk = 1024;
-
- if (!options.newLineCharacter) {
- options.newLineCharacter = 0x0a; //linux line ending
- } else {
- options.newLineCharacter = options.newLineCharacter.charCodeAt(0);
- }
-
- if (typeof file === 'number') {
- this.fd = file;
- } else {
- this.fd = fs.openSync(file, 'r');
- }
-
- this.options = options;
- this.newLineCharacter = options.newLineCharacter;
- this.reset();
- }
-
- _searchInBuffer(buffer, hexNeedle) {
- let found = -1;
-
- for (let i = 0; i <= buffer.length; i++) {
- let b_byte = buffer[i];
-
- if (b_byte === hexNeedle) {
- found = i;
- break;
- }
- }
-
- return found;
- }
-
- reset() {
- this.eofReached = false;
- this.linesCache = [];
- this.fdPosition = 0;
- }
-
- close() {
- fs.closeSync(this.fd);
- this.fd = null;
- }
-
- _extractLines(buffer) {
- let line;
- const lines = [];
- let bufferPosition = 0;
- let lastNewLineBufferPosition = 0;
-
- while (true) {
- let bufferPositionValue = buffer[bufferPosition++];
-
- if (bufferPositionValue === this.newLineCharacter) {
- line = buffer.slice(lastNewLineBufferPosition, bufferPosition);
- lines.push(line);
- lastNewLineBufferPosition = bufferPosition;
- } else if (!bufferPositionValue) {
- break;
- }
- }
-
- let leftovers = buffer.slice(lastNewLineBufferPosition, bufferPosition);
-
- if (leftovers.length) {
- lines.push(leftovers);
- }
-
- return lines;
- }
-
- _readChunk(lineLeftovers) {
- let totalBytesRead = 0;
- let bytesRead;
- const buffers = [];
-
- do {
- const readBuffer = new Buffer(this.options.readChunk);
- bytesRead = fs.readSync(this.fd, readBuffer, 0, this.options.readChunk, this.fdPosition);
- totalBytesRead = totalBytesRead + bytesRead;
- this.fdPosition = this.fdPosition + bytesRead;
- buffers.push(readBuffer);
- } while (bytesRead && this._searchInBuffer(buffers[buffers.length - 1], this.options.newLineCharacter) === -1);
-
- let bufferData = Buffer.concat(buffers);
-
- if (bytesRead < this.options.readChunk) {
- this.eofReached = true;
- bufferData = bufferData.slice(0, totalBytesRead);
- }
-
- if (totalBytesRead) {
- this.linesCache = this._extractLines(bufferData);
-
- if (lineLeftovers) {
- this.linesCache[0] = Buffer.concat([lineLeftovers, this.linesCache[0]]);
- }
- }
-
- return totalBytesRead;
- }
-
- next() {
- if (!this.fd) return false;
- let line = false;
-
- if (this.eofReached && this.linesCache.length === 0) {
- return line;
- }
-
- let bytesRead;
-
- if (!this.linesCache.length) {
- bytesRead = this._readChunk();
- }
-
- if (this.linesCache.length) {
- line = this.linesCache.shift();
- const lastLineCharacter = line[line.length - 1];
-
- if (lastLineCharacter !== 0x0a) {
- bytesRead = this._readChunk(line);
-
- if (bytesRead) {
- line = this.linesCache.shift();
- }
- }
- }
-
- if (this.eofReached && this.linesCache.length === 0) {
- this.close();
- }
-
- if (line && line[line.length - 1] === this.newLineCharacter) {
- line = line.slice(0, line.length - 1);
- }
-
- return line;
- }
-
- }
-
- var readlines = LineByLine;
-
- /**
- * The inverse of `_.toPairs`; this method returns an object composed
- * from key-value `pairs`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Array
- * @param {Array} pairs The key-value pairs.
- * @returns {Object} Returns the new object.
- * @example
- *
- * _.fromPairs([['a', 1], ['b', 2]]);
- * // => { 'a': 1, 'b': 2 }
- */
- function fromPairs(pairs) {
- var index = -1,
- length = pairs == null ? 0 : pairs.length,
- result = {};
-
- while (++index < length) {
- var pair = pairs[index];
- result[pair[0]] = pair[1];
- }
-
- return result;
- }
-
- var fromPairs_1 = fromPairs;
-
- class ConfigError extends Error {}
-
- class DebugError extends Error {}
-
- class UndefinedParserError extends Error {}
-
- var errors = {
- ConfigError,
- DebugError,
- UndefinedParserError
- };
-
- function _objectWithoutPropertiesLoose(source, excluded) {
- if (source == null) return {};
- var target = {};
- var sourceKeys = Object.keys(source);
- var key, i;
-
- for (i = 0; i < sourceKeys.length; i++) {
- key = sourceKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- target[key] = source[key];
- }
-
- return target;
- }
-
- function _taggedTemplateLiteral(strings, raw) {
- if (!raw) {
- raw = strings.slice(0);
- }
-
- return Object.freeze(Object.defineProperties(strings, {
- raw: {
- value: Object.freeze(raw)
- }
- }));
- }
-
- // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
-
- function defaultSetTimout() {
- throw new Error('setTimeout has not been defined');
- }
-
- function defaultClearTimeout() {
- throw new Error('clearTimeout has not been defined');
- }
-
- var cachedSetTimeout = defaultSetTimout;
- var cachedClearTimeout = defaultClearTimeout;
-
- if (typeof global$1.setTimeout === 'function') {
- cachedSetTimeout = setTimeout;
- }
-
- if (typeof global$1.clearTimeout === 'function') {
- cachedClearTimeout = clearTimeout;
- }
-
- function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- //normal enviroments in sane situations
- return setTimeout(fun, 0);
- } // if setTimeout wasn't available but was latter defined
-
-
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- cachedSetTimeout = setTimeout;
- return setTimeout(fun, 0);
- }
-
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedSetTimeout(fun, 0);
- } catch (e) {
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedSetTimeout.call(null, fun, 0);
- } catch (e) {
- // 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
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
- }
-
- function runClearTimeout(marker) {
- if (cachedClearTimeout === clearTimeout) {
- //normal enviroments in sane situations
- return clearTimeout(marker);
- } // if clearTimeout wasn't available but was latter defined
-
-
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- cachedClearTimeout = clearTimeout;
- return clearTimeout(marker);
- }
-
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedClearTimeout(marker);
- } catch (e) {
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedClearTimeout.call(null, marker);
- } catch (e) {
- // 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.
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
- return cachedClearTimeout.call(this, marker);
- }
- }
- }
-
- var queue = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
-
- function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
-
- draining = false;
-
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
-
- if (queue.length) {
- drainQueue();
- }
- }
-
- function drainQueue() {
- if (draining) {
- return;
- }
-
- var timeout = runTimeout(cleanUpNextTick);
- draining = true;
- var len = queue.length;
-
- while (len) {
- currentQueue = queue;
- queue = [];
-
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
-
- queueIndex = -1;
- len = queue.length;
- }
-
- currentQueue = null;
- draining = false;
- runClearTimeout(timeout);
- }
-
- function nextTick(fun) {
- var args = new Array(arguments.length - 1);
-
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
-
- queue.push(new Item(fun, args));
-
- if (queue.length === 1 && !draining) {
- runTimeout(drainQueue);
- }
- } // v8 likes predictible objects
-
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
-
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
-
- var title = 'browser';
- var platform = 'browser';
- var browser = true;
- var env = {};
- var argv = [];
- var version$1 = ''; // empty string to avoid regexp issues
-
- var versions = {};
- var release = {};
- var config = {};
-
- function noop() {}
-
- var on = noop;
- var addListener = noop;
- var once = noop;
- var off = noop;
- var removeListener = noop;
- var removeAllListeners = noop;
- var emit = noop;
- function binding(name) {
- throw new Error('process.binding is not supported');
- }
- function cwd() {
- return '/';
- }
- function chdir(dir) {
- throw new Error('process.chdir is not supported');
- }
- function umask() {
- return 0;
- } // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
-
- var performance = global$1.performance || {};
-
- var performanceNow = performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow || function () {
- return new Date().getTime();
- }; // generate timestamp or delta
- // see http://nodejs.org/api/process.html#process_process_hrtime
-
-
- function hrtime(previousTimestamp) {
- var clocktime = performanceNow.call(performance) * 1e-3;
- var seconds = Math.floor(clocktime);
- var nanoseconds = Math.floor(clocktime % 1 * 1e9);
-
- if (previousTimestamp) {
- seconds = seconds - previousTimestamp[0];
- nanoseconds = nanoseconds - previousTimestamp[1];
-
- if (nanoseconds < 0) {
- seconds--;
- nanoseconds += 1e9;
- }
- }
-
- return [seconds, nanoseconds];
- }
- var startTime = new Date();
- function uptime() {
- var currentTime = new Date();
- var dif = currentTime - startTime;
- return dif / 1000;
- }
- var process = {
- nextTick: nextTick,
- title: title,
- browser: browser,
- env: env,
- argv: argv,
- version: version$1,
- versions: versions,
- on: on,
- addListener: addListener,
- once: once,
- off: off,
- removeListener: removeListener,
- removeAllListeners: removeAllListeners,
- emit: emit,
- binding: binding,
- cwd: cwd,
- chdir: chdir,
- umask: umask,
- hrtime: hrtime,
- platform: platform,
- release: release,
- config: config,
- uptime: uptime
- };
-
- const debug = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error('SEMVER', ...args) : () => {};
- var debug_1 = debug;
-
- // Note: this is the semver.org version of the spec that it implements
- // Not necessarily the package version of this code.
- const SEMVER_SPEC_VERSION = '2.0.0';
- const MAX_LENGTH = 256;
- const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
- /* istanbul ignore next */
- 9007199254740991; // Max safe segment length for coercion.
-
- const MAX_SAFE_COMPONENT_LENGTH = 16;
- var constants = {
- SEMVER_SPEC_VERSION,
- MAX_LENGTH,
- MAX_SAFE_INTEGER,
- MAX_SAFE_COMPONENT_LENGTH
- };
-
- var re_1 = createCommonjsModule(function (module, exports) {
- const {
- MAX_SAFE_COMPONENT_LENGTH
- } = constants;
- exports = module.exports = {}; // The actual regexps go on exports.re
-
- const re = exports.re = [];
- const src = exports.src = [];
- const t = exports.t = {};
- let R = 0;
-
- const createToken = (name, value, isGlobal) => {
- const index = R++;
- debug_1(index, value);
- t[name] = index;
- src[index] = value;
- re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
- }; // The following Regular Expressions can be used for tokenizing,
- // validating, and parsing SemVer version strings.
- // ## Numeric Identifier
- // A single `0`, or a non-zero digit followed by zero or more digits.
-
-
- createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
- createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+'); // ## Non-numeric Identifier
- // Zero or more digits, followed by a letter or hyphen, and then zero or
- // more letters, digits, or hyphens.
-
- createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*'); // ## Main Version
- // Three dot-separated numeric identifiers.
-
- createToken('MAINVERSION', "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")"));
- createToken('MAINVERSIONLOOSE', "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")")); // ## Pre-release Version Identifier
- // A numeric identifier, or a non-numeric identifier.
-
- createToken('PRERELEASEIDENTIFIER', "(?:".concat(src[t.NUMERICIDENTIFIER], "|").concat(src[t.NONNUMERICIDENTIFIER], ")"));
- createToken('PRERELEASEIDENTIFIERLOOSE', "(?:".concat(src[t.NUMERICIDENTIFIERLOOSE], "|").concat(src[t.NONNUMERICIDENTIFIER], ")")); // ## Pre-release Version
- // Hyphen, followed by one or more dot-separated pre-release version
- // identifiers.
-
- createToken('PRERELEASE', "(?:-(".concat(src[t.PRERELEASEIDENTIFIER], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIER], ")*))"));
- createToken('PRERELEASELOOSE', "(?:-?(".concat(src[t.PRERELEASEIDENTIFIERLOOSE], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIERLOOSE], ")*))")); // ## Build Metadata Identifier
- // Any combination of digits, letters, or hyphens.
-
- createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+'); // ## Build Metadata
- // Plus sign, followed by one or more period-separated build metadata
- // identifiers.
-
- createToken('BUILD', "(?:\\+(".concat(src[t.BUILDIDENTIFIER], "(?:\\.").concat(src[t.BUILDIDENTIFIER], ")*))")); // ## Full Version String
- // A main version, followed optionally by a pre-release version and
- // build metadata.
- // Note that the only major, minor, patch, and pre-release sections of
- // the version string are capturing groups. The build metadata is not a
- // capturing group, because it should not ever be used in version
- // comparison.
-
- createToken('FULLPLAIN', "v?".concat(src[t.MAINVERSION]).concat(src[t.PRERELEASE], "?").concat(src[t.BUILD], "?"));
- createToken('FULL', "^".concat(src[t.FULLPLAIN], "$")); // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
- // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
- // common in the npm registry.
-
- createToken('LOOSEPLAIN', "[v=\\s]*".concat(src[t.MAINVERSIONLOOSE]).concat(src[t.PRERELEASELOOSE], "?").concat(src[t.BUILD], "?"));
- createToken('LOOSE', "^".concat(src[t.LOOSEPLAIN], "$"));
- createToken('GTLT', '((?:<|>)?=?)'); // Something like "2.*" or "1.2.x".
- // Note that "x.x" is a valid xRange identifer, meaning "any version"
- // Only the first item is strictly required.
-
- createToken('XRANGEIDENTIFIERLOOSE', "".concat(src[t.NUMERICIDENTIFIERLOOSE], "|x|X|\\*"));
- createToken('XRANGEIDENTIFIER', "".concat(src[t.NUMERICIDENTIFIER], "|x|X|\\*"));
- createToken('XRANGEPLAIN', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:".concat(src[t.PRERELEASE], ")?").concat(src[t.BUILD], "?") + ")?)?");
- createToken('XRANGEPLAINLOOSE', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:".concat(src[t.PRERELEASELOOSE], ")?").concat(src[t.BUILD], "?") + ")?)?");
- createToken('XRANGE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAIN], "$"));
- createToken('XRANGELOOSE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAINLOOSE], "$")); // Coercion.
- // Extract anything that could conceivably be a part of a valid semver
-
- 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])");
- createToken('COERCERTL', src[t.COERCE], true); // Tilde ranges.
- // Meaning is "reasonably at or greater than"
-
- createToken('LONETILDE', '(?:~>?)');
- createToken('TILDETRIM', "(\\s*)".concat(src[t.LONETILDE], "\\s+"), true);
- exports.tildeTrimReplace = '$1~';
- createToken('TILDE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAIN], "$"));
- createToken('TILDELOOSE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAINLOOSE], "$")); // Caret ranges.
- // Meaning is "at least and backwards compatible with"
-
- createToken('LONECARET', '(?:\\^)');
- createToken('CARETTRIM', "(\\s*)".concat(src[t.LONECARET], "\\s+"), true);
- exports.caretTrimReplace = '$1^';
- createToken('CARET', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAIN], "$"));
- createToken('CARETLOOSE', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAINLOOSE], "$")); // A simple gt/lt/eq thing, or just "" to indicate "any version"
-
- createToken('COMPARATORLOOSE', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], ")$|^$"));
- createToken('COMPARATOR', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.FULLPLAIN], ")$|^$")); // An expression to strip any whitespace between the gtlt and the thing
- // it modifies, so that `> 1.2.3` ==> `>1.2.3`
-
- createToken('COMPARATORTRIM', "(\\s*)".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], "|").concat(src[t.XRANGEPLAIN], ")"), true);
- exports.comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4`
- // Note that these all use the loose form, because they'll be
- // checked against either the strict or loose comparator form
- // later.
-
- createToken('HYPHENRANGE', "^\\s*(".concat(src[t.XRANGEPLAIN], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAIN], ")") + "\\s*$");
- createToken('HYPHENRANGELOOSE', "^\\s*(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s*$"); // Star ranges basically just allow anything at all.
-
- createToken('STAR', '(<|>)?=?\\s*\\*');
- });
- var re_2 = re_1.re;
- var re_3 = re_1.src;
- var re_4 = re_1.t;
- var re_5 = re_1.tildeTrimReplace;
- var re_6 = re_1.caretTrimReplace;
- var re_7 = re_1.comparatorTrimReplace;
-
- const numeric = /^[0-9]+$/;
-
- const compareIdentifiers = (a, b) => {
- const anum = numeric.test(a);
- const bnum = numeric.test(b);
-
- if (anum && bnum) {
- a = +a;
- b = +b;
- }
-
- return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
- };
-
- const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
-
- var identifiers = {
- compareIdentifiers,
- rcompareIdentifiers
- };
-
- const {
- MAX_LENGTH: MAX_LENGTH$1,
- MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1
- } = constants;
- const {
- re,
- t
- } = re_1;
- const {
- compareIdentifiers: compareIdentifiers$1
- } = identifiers;
-
- class SemVer {
- constructor(version, options) {
- if (!options || typeof options !== 'object') {
- options = {
- loose: !!options,
- includePrerelease: false
- };
- }
-
- if (version instanceof SemVer) {
- if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
- return version;
- } else {
- version = version.version;
- }
- } else if (typeof version !== 'string') {
- throw new TypeError("Invalid Version: ".concat(version));
- }
-
- if (version.length > MAX_LENGTH$1) {
- throw new TypeError("version is longer than ".concat(MAX_LENGTH$1, " characters"));
- }
-
- debug_1('SemVer', version, options);
- this.options = options;
- this.loose = !!options.loose; // this isn't actually relevant for versions, but keep it so that we
- // don't run into trouble passing this.options around.
-
- this.includePrerelease = !!options.includePrerelease;
- const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
-
- if (!m) {
- throw new TypeError("Invalid Version: ".concat(version));
- }
-
- this.raw = version; // these are actually numbers
-
- this.major = +m[1];
- this.minor = +m[2];
- this.patch = +m[3];
-
- if (this.major > MAX_SAFE_INTEGER$1 || this.major < 0) {
- throw new TypeError('Invalid major version');
- }
-
- if (this.minor > MAX_SAFE_INTEGER$1 || this.minor < 0) {
- throw new TypeError('Invalid minor version');
- }
-
- if (this.patch > MAX_SAFE_INTEGER$1 || this.patch < 0) {
- throw new TypeError('Invalid patch version');
- } // numberify any prerelease numeric ids
-
-
- if (!m[4]) {
- this.prerelease = [];
- } else {
- this.prerelease = m[4].split('.').map(id => {
- if (/^[0-9]+$/.test(id)) {
- const num = +id;
-
- if (num >= 0 && num < MAX_SAFE_INTEGER$1) {
- return num;
- }
- }
-
- return id;
- });
- }
-
- this.build = m[5] ? m[5].split('.') : [];
- this.format();
- }
-
- format() {
- this.version = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
-
- if (this.prerelease.length) {
- this.version += "-".concat(this.prerelease.join('.'));
- }
-
- return this.version;
- }
-
- toString() {
- return this.version;
- }
-
- compare(other) {
- debug_1('SemVer.compare', this.version, this.options, other);
-
- if (!(other instanceof SemVer)) {
- if (typeof other === 'string' && other === this.version) {
- return 0;
- }
-
- other = new SemVer(other, this.options);
- }
-
- if (other.version === this.version) {
- return 0;
- }
-
- return this.compareMain(other) || this.comparePre(other);
- }
-
- compareMain(other) {
- if (!(other instanceof SemVer)) {
- other = new SemVer(other, this.options);
- }
-
- return compareIdentifiers$1(this.major, other.major) || compareIdentifiers$1(this.minor, other.minor) || compareIdentifiers$1(this.patch, other.patch);
- }
-
- comparePre(other) {
- if (!(other instanceof SemVer)) {
- other = new SemVer(other, this.options);
- } // NOT having a prerelease is > having one
-
-
- if (this.prerelease.length && !other.prerelease.length) {
- return -1;
- } else if (!this.prerelease.length && other.prerelease.length) {
- return 1;
- } else if (!this.prerelease.length && !other.prerelease.length) {
- return 0;
- }
-
- let i = 0;
-
- do {
- const a = this.prerelease[i];
- const b = other.prerelease[i];
- debug_1('prerelease compare', i, a, b);
-
- if (a === undefined && b === undefined) {
- return 0;
- } else if (b === undefined) {
- return 1;
- } else if (a === undefined) {
- return -1;
- } else if (a === b) {
- continue;
- } else {
- return compareIdentifiers$1(a, b);
- }
- } while (++i);
- }
-
- compareBuild(other) {
- if (!(other instanceof SemVer)) {
- other = new SemVer(other, this.options);
- }
-
- let i = 0;
-
- do {
- const a = this.build[i];
- const b = other.build[i];
- debug_1('prerelease compare', i, a, b);
-
- if (a === undefined && b === undefined) {
- return 0;
- } else if (b === undefined) {
- return 1;
- } else if (a === undefined) {
- return -1;
- } else if (a === b) {
- continue;
- } else {
- return compareIdentifiers$1(a, b);
- }
- } while (++i);
- } // preminor will bump the version up to the next minor release, and immediately
- // down to pre-release. premajor and prepatch work the same way.
-
-
- inc(release, identifier) {
- switch (release) {
- case 'premajor':
- this.prerelease.length = 0;
- this.patch = 0;
- this.minor = 0;
- this.major++;
- this.inc('pre', identifier);
- break;
-
- case 'preminor':
- this.prerelease.length = 0;
- this.patch = 0;
- this.minor++;
- this.inc('pre', identifier);
- break;
-
- case 'prepatch':
- // If this is already a prerelease, it will bump to the next version
- // drop any prereleases that might already exist, since they are not
- // relevant at this point.
- this.prerelease.length = 0;
- this.inc('patch', identifier);
- this.inc('pre', identifier);
- break;
- // If the input is a non-prerelease version, this acts the same as
- // prepatch.
-
- case 'prerelease':
- if (this.prerelease.length === 0) {
- this.inc('patch', identifier);
- }
-
- this.inc('pre', identifier);
- break;
-
- case 'major':
- // If this is a pre-major version, bump up to the same major version.
- // Otherwise increment major.
- // 1.0.0-5 bumps to 1.0.0
- // 1.1.0 bumps to 2.0.0
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
- this.major++;
- }
-
- this.minor = 0;
- this.patch = 0;
- this.prerelease = [];
- break;
-
- case 'minor':
- // If this is a pre-minor version, bump up to the same minor version.
- // Otherwise increment minor.
- // 1.2.0-5 bumps to 1.2.0
- // 1.2.1 bumps to 1.3.0
- if (this.patch !== 0 || this.prerelease.length === 0) {
- this.minor++;
- }
-
- this.patch = 0;
- this.prerelease = [];
- break;
-
- case 'patch':
- // If this is not a pre-release version, it will increment the patch.
- // If it is a pre-release it will bump up to the same patch version.
- // 1.2.0-5 patches to 1.2.0
- // 1.2.0 patches to 1.2.1
- if (this.prerelease.length === 0) {
- this.patch++;
- }
-
- this.prerelease = [];
- break;
- // This probably shouldn't be used publicly.
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
-
- case 'pre':
- if (this.prerelease.length === 0) {
- this.prerelease = [0];
- } else {
- let i = this.prerelease.length;
-
- while (--i >= 0) {
- if (typeof this.prerelease[i] === 'number') {
- this.prerelease[i]++;
- i = -2;
- }
- }
-
- if (i === -1) {
- // didn't increment anything
- this.prerelease.push(0);
- }
- }
-
- if (identifier) {
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
- if (this.prerelease[0] === identifier) {
- if (isNaN(this.prerelease[1])) {
- this.prerelease = [identifier, 0];
- }
- } else {
- this.prerelease = [identifier, 0];
- }
- }
-
- break;
-
- default:
- throw new Error("invalid increment argument: ".concat(release));
- }
-
- this.format();
- this.raw = this.version;
- return this;
- }
-
- }
-
- var semver = SemVer;
-
- const compare = (a, b, loose) => new semver(a, loose).compare(new semver(b, loose));
-
- var compare_1 = compare;
-
- const lt = (a, b, loose) => compare_1(a, b, loose) < 0;
-
- var lt_1 = lt;
-
- const gte = (a, b, loose) => compare_1(a, b, loose) >= 0;
-
- var gte_1 = gte;
-
- var arrayify = (object, keyName) => Object.entries(object).map(([key, value]) => Object.assign({
- [keyName]: key
- }, value));
-
- var dedent_1 = createCommonjsModule(function (module) {
-
- function dedent(strings) {
- var raw = void 0;
-
- if (typeof strings === "string") {
- // dedent can be used as a plain function
- raw = [strings];
- } else {
- raw = strings.raw;
- } // first, perform interpolation
-
-
- var result = "";
-
- for (var i = 0; i < raw.length; i++) {
- result += raw[i]. // join lines when there is a suppressed newline
- replace(/\\\n[ \t]*/g, ""). // handle escaped backticks
- replace(/\\`/g, "`");
-
- if (i < (arguments.length <= 1 ? 0 : arguments.length - 1)) {
- result += arguments.length <= i + 1 ? undefined : arguments[i + 1];
- }
- } // now strip indentation
-
-
- var lines = result.split("\n");
- var mindent = null;
- lines.forEach(function (l) {
- var m = l.match(/^(\s+)\S+/);
-
- if (m) {
- var indent = m[1].length;
-
- if (!mindent) {
- // this is the first indented line
- mindent = indent;
- } else {
- mindent = Math.min(mindent, indent);
- }
- }
- });
-
- if (mindent !== null) {
- result = lines.map(function (l) {
- return l[0] === " " ? l.slice(mindent) : l;
- }).join("\n");
- } // dedent eats leading and trailing whitespace too
-
-
- result = result.trim(); // handle escaped newlines at the end to ensure they don't get stripped too
-
- return result.replace(/\\n/g, "\n");
- }
-
- {
- module.exports = dedent;
- }
- });
-
- function _templateObject6() {
- 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 "]);
-
- _templateObject6 = function _templateObject6() {
- return data;
- };
-
- return data;
- }
-
- function _templateObject5() {
- 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 "]);
-
- _templateObject5 = function _templateObject5() {
- return data;
- };
-
- return data;
- }
-
- function _templateObject4() {
- 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 "]);
-
- _templateObject4 = function _templateObject4() {
- return data;
- };
-
- return data;
- }
-
- function _templateObject3() {
- 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 "]);
-
- _templateObject3 = function _templateObject3() {
- return data;
- };
-
- return data;
- }
-
- function _templateObject2() {
- 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 "]);
-
- _templateObject2 = function _templateObject2() {
- return data;
- };
-
- return data;
- }
-
- function _templateObject() {
- 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 "]);
-
- _templateObject = function _templateObject() {
- return data;
- };
-
- return data;
- }
-
- const CATEGORY_CONFIG = "Config";
- const CATEGORY_EDITOR = "Editor";
- const CATEGORY_FORMAT = "Format";
- const CATEGORY_OTHER = "Other";
- const CATEGORY_OUTPUT = "Output";
- const CATEGORY_GLOBAL = "Global";
- const CATEGORY_SPECIAL = "Special";
- /**
- * @typedef {Object} OptionInfo
- * @property {string} [since] - available since version
- * @property {string} category
- * @property {'int' | 'boolean' | 'choice' | 'path'} type
- * @property {boolean} [array] - indicate it's an array of the specified type
- * @property {OptionValueInfo} [default]
- * @property {OptionRangeInfo} [range] - for type int
- * @property {string} description
- * @property {string} [deprecated] - deprecated since version
- * @property {OptionRedirectInfo} [redirect] - redirect deprecated option
- * @property {(value: any) => boolean} [exception]
- * @property {OptionChoiceInfo[]} [choices] - for type choice
- * @property {string} [cliName]
- * @property {string} [cliCategory]
- * @property {string} [cliDescription]
- *
- * @typedef {number | boolean | string} OptionValue
- * @typedef {OptionValue | [{ value: OptionValue[] }] | Array<{ since: string, value: OptionValue}>} OptionValueInfo
- *
- * @typedef {Object} OptionRedirectInfo
- * @property {string} option
- * @property {OptionValue} value
- *
- * @typedef {Object} OptionRangeInfo
- * @property {number} start - recommended range start
- * @property {number} end - recommended range end
- * @property {number} step - recommended range step
- *
- * @typedef {Object} OptionChoiceInfo
- * @property {boolean | string} value - boolean for the option that is originally boolean type
- * @property {string} description
- * @property {string} [since] - undefined if available since the first version of the option
- * @property {string} [deprecated] - deprecated since version
- * @property {OptionValueInfo} [redirect] - redirect deprecated value
- */
-
- /** @type {{ [name: string]: OptionInfo }} */
-
- const options = {
- cursorOffset: {
- since: "1.4.0",
- category: CATEGORY_SPECIAL,
- type: "int",
- default: -1,
- range: {
- start: -1,
- end: Infinity,
- step: 1
- },
- description: dedent_1(_templateObject()),
- cliCategory: CATEGORY_EDITOR
- },
- endOfLine: {
- since: "1.15.0",
- category: CATEGORY_GLOBAL,
- type: "choice",
- default: [{
- since: "1.15.0",
- value: "auto"
- }, {
- since: "2.0.0",
- value: "lf"
- }],
- description: "Which end of line characters to apply.",
- choices: [{
- value: "lf",
- description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
- }, {
- value: "crlf",
- description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
- }, {
- value: "cr",
- description: "Carriage Return character only (\\r), used very rarely"
- }, {
- value: "auto",
- description: dedent_1(_templateObject2())
- }]
- },
- filepath: {
- since: "1.4.0",
- category: CATEGORY_SPECIAL,
- type: "path",
- description: "Specify the input filepath. This will be used to do parser inference.",
- cliName: "stdin-filepath",
- cliCategory: CATEGORY_OTHER,
- cliDescription: "Path to the file to pretend that stdin comes from."
- },
- insertPragma: {
- since: "1.8.0",
- category: CATEGORY_SPECIAL,
- type: "boolean",
- default: false,
- description: "Insert @format pragma into file's first docblock comment.",
- cliCategory: CATEGORY_OTHER
- },
- parser: {
- since: "0.0.10",
- category: CATEGORY_GLOBAL,
- type: "choice",
- default: [{
- since: "0.0.10",
- value: "babylon"
- }, {
- since: "1.13.0",
- value: undefined
- }],
- description: "Which parser to use.",
- exception: value => typeof value === "string" || typeof value === "function",
- choices: [{
- value: "flow",
- description: "Flow"
- }, {
- value: "babel",
- since: "1.16.0",
- description: "JavaScript"
- }, {
- value: "babel-flow",
- since: "1.16.0",
- description: "Flow"
- }, {
- value: "babel-ts",
- since: "2.0.0",
- description: "TypeScript"
- }, {
- value: "typescript",
- since: "1.4.0",
- description: "TypeScript"
- }, {
- value: "css",
- since: "1.7.1",
- description: "CSS"
- }, {
- value: "less",
- since: "1.7.1",
- description: "Less"
- }, {
- value: "scss",
- since: "1.7.1",
- description: "SCSS"
- }, {
- value: "json",
- since: "1.5.0",
- description: "JSON"
- }, {
- value: "json5",
- since: "1.13.0",
- description: "JSON5"
- }, {
- value: "json-stringify",
- since: "1.13.0",
- description: "JSON.stringify"
- }, {
- value: "graphql",
- since: "1.5.0",
- description: "GraphQL"
- }, {
- value: "markdown",
- since: "1.8.0",
- description: "Markdown"
- }, {
- value: "mdx",
- since: "1.15.0",
- description: "MDX"
- }, {
- value: "vue",
- since: "1.10.0",
- description: "Vue"
- }, {
- value: "yaml",
- since: "1.14.0",
- description: "YAML"
- }, {
- value: "glimmer",
- since: null,
- description: "Handlebars"
- }, {
- value: "html",
- since: "1.15.0",
- description: "HTML"
- }, {
- value: "angular",
- since: "1.15.0",
- description: "Angular"
- }, {
- value: "lwc",
- since: "1.17.0",
- description: "Lightning Web Components"
- }]
- },
- plugins: {
- since: "1.10.0",
- type: "path",
- array: true,
- default: [{
- value: []
- }],
- category: CATEGORY_GLOBAL,
- description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
- exception: value => typeof value === "string" || typeof value === "object",
- cliName: "plugin",
- cliCategory: CATEGORY_CONFIG
- },
- pluginSearchDirs: {
- since: "1.13.0",
- type: "path",
- array: true,
- default: [{
- value: []
- }],
- category: CATEGORY_GLOBAL,
- description: dedent_1(_templateObject3()),
- exception: value => typeof value === "string" || typeof value === "object",
- cliName: "plugin-search-dir",
- cliCategory: CATEGORY_CONFIG
- },
- printWidth: {
- since: "0.0.0",
- category: CATEGORY_GLOBAL,
- type: "int",
- default: 80,
- description: "The line length where Prettier will try wrap.",
- range: {
- start: 0,
- end: Infinity,
- step: 1
- }
- },
- rangeEnd: {
- since: "1.4.0",
- category: CATEGORY_SPECIAL,
- type: "int",
- default: Infinity,
- range: {
- start: 0,
- end: Infinity,
- step: 1
- },
- description: dedent_1(_templateObject4()),
- cliCategory: CATEGORY_EDITOR
- },
- rangeStart: {
- since: "1.4.0",
- category: CATEGORY_SPECIAL,
- type: "int",
- default: 0,
- range: {
- start: 0,
- end: Infinity,
- step: 1
- },
- description: dedent_1(_templateObject5()),
- cliCategory: CATEGORY_EDITOR
- },
- requirePragma: {
- since: "1.7.0",
- category: CATEGORY_SPECIAL,
- type: "boolean",
- default: false,
- description: dedent_1(_templateObject6()),
- cliCategory: CATEGORY_OTHER
- },
- tabWidth: {
- type: "int",
- category: CATEGORY_GLOBAL,
- default: 2,
- description: "Number of spaces per indentation level.",
- range: {
- start: 0,
- end: Infinity,
- step: 1
- }
- },
- useTabs: {
- since: "1.0.0",
- category: CATEGORY_GLOBAL,
- type: "boolean",
- default: false,
- description: "Indent with tabs instead of spaces."
- }
- };
- var coreOptions = {
- CATEGORY_CONFIG,
- CATEGORY_EDITOR,
- CATEGORY_FORMAT,
- CATEGORY_OTHER,
- CATEGORY_OUTPUT,
- CATEGORY_GLOBAL,
- CATEGORY_SPECIAL,
- options
- };
-
- var require$$0 = getCjsExportFromNamespace(_package$1);
-
- const semver$1 = {
- compare: compare_1,
- lt: lt_1,
- gte: gte_1
- };
- const currentVersion = require$$0.version;
- const coreOptions$1 = coreOptions.options;
- /**
- * Strings in `plugins` and `pluginSearchDirs` are handled by a wrapped version
- * of this function created by `withPlugins`. Don't pass them here directly.
- * @param {object} param0
- * @param {(string | object)[]=} param0.plugins Strings are resolved by `withPlugins`.
- * @param {string[]=} param0.pluginSearchDirs Added by `withPlugins`.
- * @param {boolean=} param0.showUnreleased
- * @param {boolean=} param0.showDeprecated
- * @param {boolean=} param0.showInternal
- */
-
- function getSupportInfo({
- plugins = [],
- showUnreleased = false,
- showDeprecated = false,
- showInternal = false
- } = {}) {
- // pre-release version is smaller than the normal version in semver,
- // we need to treat it as the normal one so as to test new features.
- const version = currentVersion.split("-", 1)[0];
- const options = arrayify(Object.assign({}, ...plugins.map(({
- options
- }) => 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 => {
- option = Object.assign({}, option);
-
- if (Array.isArray(option.default)) {
- 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;
- }
-
- if (Array.isArray(option.choices)) {
- option.choices = option.choices.filter(option => filterSince(option) && filterDeprecated(option));
- }
-
- const filteredPlugins = plugins.filter(plugin => plugin.defaultOptions && plugin.defaultOptions[option.name] !== undefined);
- const pluginDefaults = filteredPlugins.reduce((reduced, plugin) => {
- reduced[plugin.name] = plugin.defaultOptions[option.name];
- return reduced;
- }, {});
- return Object.assign({}, option, {
- pluginDefaults
- });
- });
- const languages = plugins.reduce((all, plugin) => all.concat(plugin.languages || []), []).filter(filterSince);
- return {
- languages,
- options
- };
-
- function filterSince(object) {
- return showUnreleased || !("since" in object) || object.since && semver$1.gte(version, object.since);
- }
-
- function filterDeprecated(object) {
- return showDeprecated || !("deprecated" in object) || object.deprecated && semver$1.lt(version, object.deprecated);
- }
-
- function mapInternal(object) {
- if (showInternal) {
- return object;
- }
-
- const newObject = _objectWithoutPropertiesLoose(object, ["cliName", "cliCategory", "cliDescription"]);
-
- return newObject;
- }
- }
-
- var support = {
- getSupportInfo
- };
-
- /*! *****************************************************************************\r
- Copyright (c) Microsoft Corporation. All rights reserved.\r
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use\r
- this file except in compliance with the License. You may obtain a copy of the\r
- License at http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r
- MERCHANTABLITY OR NON-INFRINGEMENT.\r
-\r
- See the Apache Version 2.0 License for specific language governing permissions\r
- and limitations under the License.\r
- ***************************************************************************** */
-
- /* global Reflect, Promise */
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
- };
-
- return _extendStatics(d, b);
- };
-
- function __extends(d, b) {
- _extendStatics(d, b);
-
- function __() {
- this.constructor = d;
- }
-
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- }
-
- var _assign = function __assign() {
- _assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
-
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
-
- return t;
- };
-
- return _assign.apply(this, arguments);
- };
- function __rest(s, e) {
- var t = {};
-
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
-
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
- }
- return t;
- }
- function __decorate(decorators, target, key, desc) {
- var c = arguments.length,
- r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
- d;
- 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;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
- }
- function __param(paramIndex, decorator) {
- return function (target, key) {
- decorator(target, key, paramIndex);
- };
- }
- function __metadata(metadataKey, metadataValue) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
- }
- function __awaiter(thisArg, _arguments, P, generator) {
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) {
- try {
- step(generator.next(value));
- } catch (e) {
- reject(e);
- }
- }
-
- function rejected(value) {
- try {
- step(generator["throw"](value));
- } catch (e) {
- reject(e);
- }
- }
-
- function step(result) {
- result.done ? resolve(result.value) : new P(function (resolve) {
- resolve(result.value);
- }).then(fulfilled, rejected);
- }
-
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- }
- function __generator(thisArg, body) {
- var _ = {
- label: 0,
- sent: function sent() {
- if (t[0] & 1) throw t[1];
- return t[1];
- },
- trys: [],
- ops: []
- },
- f,
- y,
- t,
- g;
- return g = {
- next: verb(0),
- "throw": verb(1),
- "return": verb(2)
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
- return this;
- }), g;
-
- function verb(n) {
- return function (v) {
- return step([n, v]);
- };
- }
-
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
-
- while (_) try {
- 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;
- if (y = 0, t) op = [op[0] & 2, t.value];
-
- switch (op[0]) {
- case 0:
- case 1:
- t = op;
- break;
-
- case 4:
- _.label++;
- return {
- value: op[1],
- done: false
- };
-
- case 5:
- _.label++;
- y = op[1];
- op = [0];
- continue;
-
- case 7:
- op = _.ops.pop();
-
- _.trys.pop();
-
- continue;
-
- default:
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
- _ = 0;
- continue;
- }
-
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
- _.label = op[1];
- break;
- }
-
- if (op[0] === 6 && _.label < t[1]) {
- _.label = t[1];
- t = op;
- break;
- }
-
- if (t && _.label < t[2]) {
- _.label = t[2];
-
- _.ops.push(op);
-
- break;
- }
-
- if (t[2]) _.ops.pop();
-
- _.trys.pop();
-
- continue;
- }
-
- op = body.call(thisArg, _);
- } catch (e) {
- op = [6, e];
- y = 0;
- } finally {
- f = t = 0;
- }
-
- if (op[0] & 5) throw op[1];
- return {
- value: op[0] ? op[1] : void 0,
- done: true
- };
- }
- }
- function __exportStar(m, exports) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
- }
- function __values(o) {
- var m = typeof Symbol === "function" && o[Symbol.iterator],
- i = 0;
- if (m) return m.call(o);
- return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- }
- function __read(o, n) {
- var m = typeof Symbol === "function" && o[Symbol.iterator];
- if (!m) return o;
- var i = m.call(o),
- r,
- ar = [],
- e;
-
- try {
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
- } catch (error) {
- e = {
- error: error
- };
- } finally {
- try {
- if (r && !r.done && (m = i["return"])) m.call(i);
- } finally {
- if (e) throw e.error;
- }
- }
-
- return ar;
- }
- function __spread() {
- for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
-
- return ar;
- }
- function __spreadArrays() {
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
-
- 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];
-
- return r;
- }
- function __await(v) {
- return this instanceof __await ? (this.v = v, this) : new __await(v);
- }
- function __asyncGenerator(thisArg, _arguments, generator) {
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
- var g = generator.apply(thisArg, _arguments || []),
- i,
- q = [];
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () {
- return this;
- }, i;
-
- function verb(n) {
- if (g[n]) i[n] = function (v) {
- return new Promise(function (a, b) {
- q.push([n, v, a, b]) > 1 || resume(n, v);
- });
- };
- }
-
- function resume(n, v) {
- try {
- step(g[n](v));
- } catch (e) {
- settle(q[0][3], e);
- }
- }
-
- function step(r) {
- r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
- }
-
- function fulfill(value) {
- resume("next", value);
- }
-
- function reject(value) {
- resume("throw", value);
- }
-
- function settle(f, v) {
- if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
- }
- }
- function __asyncDelegator(o) {
- var i, p;
- return i = {}, verb("next"), verb("throw", function (e) {
- throw e;
- }), verb("return"), i[Symbol.iterator] = function () {
- return this;
- }, i;
-
- function verb(n, f) {
- i[n] = o[n] ? function (v) {
- return (p = !p) ? {
- value: __await(o[n](v)),
- done: n === "return"
- } : f ? f(v) : v;
- } : f;
- }
- }
- function __asyncValues(o) {
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
- var m = o[Symbol.asyncIterator],
- i;
- 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 () {
- return this;
- }, i);
-
- function verb(n) {
- i[n] = o[n] && function (v) {
- return new Promise(function (resolve, reject) {
- v = o[n](v), settle(resolve, reject, v.done, v.value);
- });
- };
- }
-
- function settle(resolve, reject, d, v) {
- Promise.resolve(v).then(function (v) {
- resolve({
- value: v,
- done: d
- });
- }, reject);
- }
- }
- function __makeTemplateObject(cooked, raw) {
- if (Object.defineProperty) {
- Object.defineProperty(cooked, "raw", {
- value: raw
- });
- } else {
- cooked.raw = raw;
- }
-
- return cooked;
- }
- function __importStar(mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
- result.default = mod;
- return result;
- }
- function __importDefault(mod) {
- return mod && mod.__esModule ? mod : {
- default: mod
- };
- }
-
- var tslib_es6 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- __extends: __extends,
- get __assign () { return _assign; },
- __rest: __rest,
- __decorate: __decorate,
- __param: __param,
- __metadata: __metadata,
- __awaiter: __awaiter,
- __generator: __generator,
- __exportStar: __exportStar,
- __values: __values,
- __read: __read,
- __spread: __spread,
- __spreadArrays: __spreadArrays,
- __await: __await,
- __asyncGenerator: __asyncGenerator,
- __asyncDelegator: __asyncDelegator,
- __asyncValues: __asyncValues,
- __makeTemplateObject: __makeTemplateObject,
- __importStar: __importStar,
- __importDefault: __importDefault
- });
-
- var api = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.apiDescriptor = {
- key: _key => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(_key) ? _key : JSON.stringify(_key),
-
- value(value) {
- if (value === null || typeof value !== 'object') {
- return JSON.stringify(value);
- }
-
- if (Array.isArray(value)) {
- return "[".concat(value.map(subValue => exports.apiDescriptor.value(subValue)).join(', '), "]");
- }
-
- const keys = Object.keys(value);
- return keys.length === 0 ? '{}' : "{ ".concat(keys.map(key => "".concat(exports.apiDescriptor.key(key), ": ").concat(exports.apiDescriptor.value(value[key]))).join(', '), " }");
- },
-
- pair: ({
- key,
- value
- }) => exports.apiDescriptor.value({
- [key]: value
- })
- };
- });
- unwrapExports(api);
- var api_1 = api.apiDescriptor;
-
- var tslib_1 = getCjsExportFromNamespace(tslib_es6);
-
- var descriptors = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- tslib_1.__exportStar(api, exports);
- });
- unwrapExports(descriptors);
-
- var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
-
- var escapeStringRegexp = function escapeStringRegexp(str) {
- if (typeof str !== 'string') {
- throw new TypeError('Expected a string');
- }
-
- return str.replace(matchOperatorsRe, '\\$&');
- };
-
- var colorName = {
- "aliceblue": [240, 248, 255],
- "antiquewhite": [250, 235, 215],
- "aqua": [0, 255, 255],
- "aquamarine": [127, 255, 212],
- "azure": [240, 255, 255],
- "beige": [245, 245, 220],
- "bisque": [255, 228, 196],
- "black": [0, 0, 0],
- "blanchedalmond": [255, 235, 205],
- "blue": [0, 0, 255],
- "blueviolet": [138, 43, 226],
- "brown": [165, 42, 42],
- "burlywood": [222, 184, 135],
- "cadetblue": [95, 158, 160],
- "chartreuse": [127, 255, 0],
- "chocolate": [210, 105, 30],
- "coral": [255, 127, 80],
- "cornflowerblue": [100, 149, 237],
- "cornsilk": [255, 248, 220],
- "crimson": [220, 20, 60],
- "cyan": [0, 255, 255],
- "darkblue": [0, 0, 139],
- "darkcyan": [0, 139, 139],
- "darkgoldenrod": [184, 134, 11],
- "darkgray": [169, 169, 169],
- "darkgreen": [0, 100, 0],
- "darkgrey": [169, 169, 169],
- "darkkhaki": [189, 183, 107],
- "darkmagenta": [139, 0, 139],
- "darkolivegreen": [85, 107, 47],
- "darkorange": [255, 140, 0],
- "darkorchid": [153, 50, 204],
- "darkred": [139, 0, 0],
- "darksalmon": [233, 150, 122],
- "darkseagreen": [143, 188, 143],
- "darkslateblue": [72, 61, 139],
- "darkslategray": [47, 79, 79],
- "darkslategrey": [47, 79, 79],
- "darkturquoise": [0, 206, 209],
- "darkviolet": [148, 0, 211],
- "deeppink": [255, 20, 147],
- "deepskyblue": [0, 191, 255],
- "dimgray": [105, 105, 105],
- "dimgrey": [105, 105, 105],
- "dodgerblue": [30, 144, 255],
- "firebrick": [178, 34, 34],
- "floralwhite": [255, 250, 240],
- "forestgreen": [34, 139, 34],
- "fuchsia": [255, 0, 255],
- "gainsboro": [220, 220, 220],
- "ghostwhite": [248, 248, 255],
- "gold": [255, 215, 0],
- "goldenrod": [218, 165, 32],
- "gray": [128, 128, 128],
- "green": [0, 128, 0],
- "greenyellow": [173, 255, 47],
- "grey": [128, 128, 128],
- "honeydew": [240, 255, 240],
- "hotpink": [255, 105, 180],
- "indianred": [205, 92, 92],
- "indigo": [75, 0, 130],
- "ivory": [255, 255, 240],
- "khaki": [240, 230, 140],
- "lavender": [230, 230, 250],
- "lavenderblush": [255, 240, 245],
- "lawngreen": [124, 252, 0],
- "lemonchiffon": [255, 250, 205],
- "lightblue": [173, 216, 230],
- "lightcoral": [240, 128, 128],
- "lightcyan": [224, 255, 255],
- "lightgoldenrodyellow": [250, 250, 210],
- "lightgray": [211, 211, 211],
- "lightgreen": [144, 238, 144],
- "lightgrey": [211, 211, 211],
- "lightpink": [255, 182, 193],
- "lightsalmon": [255, 160, 122],
- "lightseagreen": [32, 178, 170],
- "lightskyblue": [135, 206, 250],
- "lightslategray": [119, 136, 153],
- "lightslategrey": [119, 136, 153],
- "lightsteelblue": [176, 196, 222],
- "lightyellow": [255, 255, 224],
- "lime": [0, 255, 0],
- "limegreen": [50, 205, 50],
- "linen": [250, 240, 230],
- "magenta": [255, 0, 255],
- "maroon": [128, 0, 0],
- "mediumaquamarine": [102, 205, 170],
- "mediumblue": [0, 0, 205],
- "mediumorchid": [186, 85, 211],
- "mediumpurple": [147, 112, 219],
- "mediumseagreen": [60, 179, 113],
- "mediumslateblue": [123, 104, 238],
- "mediumspringgreen": [0, 250, 154],
- "mediumturquoise": [72, 209, 204],
- "mediumvioletred": [199, 21, 133],
- "midnightblue": [25, 25, 112],
- "mintcream": [245, 255, 250],
- "mistyrose": [255, 228, 225],
- "moccasin": [255, 228, 181],
- "navajowhite": [255, 222, 173],
- "navy": [0, 0, 128],
- "oldlace": [253, 245, 230],
- "olive": [128, 128, 0],
- "olivedrab": [107, 142, 35],
- "orange": [255, 165, 0],
- "orangered": [255, 69, 0],
- "orchid": [218, 112, 214],
- "palegoldenrod": [238, 232, 170],
- "palegreen": [152, 251, 152],
- "paleturquoise": [175, 238, 238],
- "palevioletred": [219, 112, 147],
- "papayawhip": [255, 239, 213],
- "peachpuff": [255, 218, 185],
- "peru": [205, 133, 63],
- "pink": [255, 192, 203],
- "plum": [221, 160, 221],
- "powderblue": [176, 224, 230],
- "purple": [128, 0, 128],
- "rebeccapurple": [102, 51, 153],
- "red": [255, 0, 0],
- "rosybrown": [188, 143, 143],
- "royalblue": [65, 105, 225],
- "saddlebrown": [139, 69, 19],
- "salmon": [250, 128, 114],
- "sandybrown": [244, 164, 96],
- "seagreen": [46, 139, 87],
- "seashell": [255, 245, 238],
- "sienna": [160, 82, 45],
- "silver": [192, 192, 192],
- "skyblue": [135, 206, 235],
- "slateblue": [106, 90, 205],
- "slategray": [112, 128, 144],
- "slategrey": [112, 128, 144],
- "snow": [255, 250, 250],
- "springgreen": [0, 255, 127],
- "steelblue": [70, 130, 180],
- "tan": [210, 180, 140],
- "teal": [0, 128, 128],
- "thistle": [216, 191, 216],
- "tomato": [255, 99, 71],
- "turquoise": [64, 224, 208],
- "violet": [238, 130, 238],
- "wheat": [245, 222, 179],
- "white": [255, 255, 255],
- "whitesmoke": [245, 245, 245],
- "yellow": [255, 255, 0],
- "yellowgreen": [154, 205, 50]
- };
-
- var conversions = createCommonjsModule(function (module) {
- /* MIT license */
- // NOTE: conversions should only return primitive values (i.e. arrays, or
- // values that give correct `typeof` results).
- // do not use box values types (i.e. Number(), String(), etc.)
- var reverseKeywords = {};
-
- for (var key in colorName) {
- if (colorName.hasOwnProperty(key)) {
- reverseKeywords[colorName[key]] = key;
- }
- }
-
- var convert = module.exports = {
- rgb: {
- channels: 3,
- labels: 'rgb'
- },
- hsl: {
- channels: 3,
- labels: 'hsl'
- },
- hsv: {
- channels: 3,
- labels: 'hsv'
- },
- hwb: {
- channels: 3,
- labels: 'hwb'
- },
- cmyk: {
- channels: 4,
- labels: 'cmyk'
- },
- xyz: {
- channels: 3,
- labels: 'xyz'
- },
- lab: {
- channels: 3,
- labels: 'lab'
- },
- lch: {
- channels: 3,
- labels: 'lch'
- },
- hex: {
- channels: 1,
- labels: ['hex']
- },
- keyword: {
- channels: 1,
- labels: ['keyword']
- },
- ansi16: {
- channels: 1,
- labels: ['ansi16']
- },
- ansi256: {
- channels: 1,
- labels: ['ansi256']
- },
- hcg: {
- channels: 3,
- labels: ['h', 'c', 'g']
- },
- apple: {
- channels: 3,
- labels: ['r16', 'g16', 'b16']
- },
- gray: {
- channels: 1,
- labels: ['gray']
- }
- }; // hide .channels and .labels properties
-
- for (var model in convert) {
- if (convert.hasOwnProperty(model)) {
- if (!('channels' in convert[model])) {
- throw new Error('missing channels property: ' + model);
- }
-
- if (!('labels' in convert[model])) {
- throw new Error('missing channel labels property: ' + model);
- }
-
- if (convert[model].labels.length !== convert[model].channels) {
- throw new Error('channel and label counts mismatch: ' + model);
- }
-
- var channels = convert[model].channels;
- var labels = convert[model].labels;
- delete convert[model].channels;
- delete convert[model].labels;
- Object.defineProperty(convert[model], 'channels', {
- value: channels
- });
- Object.defineProperty(convert[model], 'labels', {
- value: labels
- });
- }
- }
-
- convert.rgb.hsl = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var min = Math.min(r, g, b);
- var max = Math.max(r, g, b);
- var delta = max - min;
- var h;
- var s;
- var l;
-
- if (max === min) {
- h = 0;
- } else if (r === max) {
- h = (g - b) / delta;
- } else if (g === max) {
- h = 2 + (b - r) / delta;
- } else if (b === max) {
- h = 4 + (r - g) / delta;
- }
-
- h = Math.min(h * 60, 360);
-
- if (h < 0) {
- h += 360;
- }
-
- l = (min + max) / 2;
-
- if (max === min) {
- s = 0;
- } else if (l <= 0.5) {
- s = delta / (max + min);
- } else {
- s = delta / (2 - max - min);
- }
-
- return [h, s * 100, l * 100];
- };
-
- convert.rgb.hsv = function (rgb) {
- var rdif;
- var gdif;
- var bdif;
- var h;
- var s;
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var v = Math.max(r, g, b);
- var diff = v - Math.min(r, g, b);
-
- var diffc = function diffc(c) {
- return (v - c) / 6 / diff + 1 / 2;
- };
-
- if (diff === 0) {
- h = s = 0;
- } else {
- s = diff / v;
- rdif = diffc(r);
- gdif = diffc(g);
- bdif = diffc(b);
-
- if (r === v) {
- h = bdif - gdif;
- } else if (g === v) {
- h = 1 / 3 + rdif - bdif;
- } else if (b === v) {
- h = 2 / 3 + gdif - rdif;
- }
-
- if (h < 0) {
- h += 1;
- } else if (h > 1) {
- h -= 1;
- }
- }
-
- return [h * 360, s * 100, v * 100];
- };
-
- convert.rgb.hwb = function (rgb) {
- var r = rgb[0];
- var g = rgb[1];
- var b = rgb[2];
- var h = convert.rgb.hsl(rgb)[0];
- var w = 1 / 255 * Math.min(r, Math.min(g, b));
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
- return [h, w * 100, b * 100];
- };
-
- convert.rgb.cmyk = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var c;
- var m;
- var y;
- var k;
- k = Math.min(1 - r, 1 - g, 1 - b);
- c = (1 - r - k) / (1 - k) || 0;
- m = (1 - g - k) / (1 - k) || 0;
- y = (1 - b - k) / (1 - k) || 0;
- return [c * 100, m * 100, y * 100, k * 100];
- };
- /**
- * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
- * */
-
-
- function comparativeDistance(x, y) {
- return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
- }
-
- convert.rgb.keyword = function (rgb) {
- var reversed = reverseKeywords[rgb];
-
- if (reversed) {
- return reversed;
- }
-
- var currentClosestDistance = Infinity;
- var currentClosestKeyword;
-
- for (var keyword in colorName) {
- if (colorName.hasOwnProperty(keyword)) {
- var value = colorName[keyword]; // Compute comparative distance
-
- var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
-
- if (distance < currentClosestDistance) {
- currentClosestDistance = distance;
- currentClosestKeyword = keyword;
- }
- }
- }
-
- return currentClosestKeyword;
- };
-
- convert.keyword.rgb = function (keyword) {
- return colorName[keyword];
- };
-
- convert.rgb.xyz = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255; // assume sRGB
-
- r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
- g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
- b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
- var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
- var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
- var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
- return [x * 100, y * 100, z * 100];
- };
-
- convert.rgb.lab = function (rgb) {
- var xyz = convert.rgb.xyz(rgb);
- var x = xyz[0];
- var y = xyz[1];
- var z = xyz[2];
- var l;
- var a;
- var b;
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
- l = 116 * y - 16;
- a = 500 * (x - y);
- b = 200 * (y - z);
- return [l, a, b];
- };
-
- convert.hsl.rgb = function (hsl) {
- var h = hsl[0] / 360;
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var t1;
- var t2;
- var t3;
- var rgb;
- var val;
-
- if (s === 0) {
- val = l * 255;
- return [val, val, val];
- }
-
- if (l < 0.5) {
- t2 = l * (1 + s);
- } else {
- t2 = l + s - l * s;
- }
-
- t1 = 2 * l - t2;
- rgb = [0, 0, 0];
-
- for (var i = 0; i < 3; i++) {
- t3 = h + 1 / 3 * -(i - 1);
-
- if (t3 < 0) {
- t3++;
- }
-
- if (t3 > 1) {
- t3--;
- }
-
- if (6 * t3 < 1) {
- val = t1 + (t2 - t1) * 6 * t3;
- } else if (2 * t3 < 1) {
- val = t2;
- } else if (3 * t3 < 2) {
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
- } else {
- val = t1;
- }
-
- rgb[i] = val * 255;
- }
-
- return rgb;
- };
-
- convert.hsl.hsv = function (hsl) {
- var h = hsl[0];
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var smin = s;
- var lmin = Math.max(l, 0.01);
- var sv;
- var v;
- l *= 2;
- s *= l <= 1 ? l : 2 - l;
- smin *= lmin <= 1 ? lmin : 2 - lmin;
- v = (l + s) / 2;
- sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
- return [h, sv * 100, v * 100];
- };
-
- convert.hsv.rgb = function (hsv) {
- var h = hsv[0] / 60;
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var hi = Math.floor(h) % 6;
- var f = h - Math.floor(h);
- var p = 255 * v * (1 - s);
- var q = 255 * v * (1 - s * f);
- var t = 255 * v * (1 - s * (1 - f));
- v *= 255;
-
- switch (hi) {
- case 0:
- return [v, t, p];
-
- case 1:
- return [q, v, p];
-
- case 2:
- return [p, v, t];
-
- case 3:
- return [p, q, v];
-
- case 4:
- return [t, p, v];
-
- case 5:
- return [v, p, q];
- }
- };
-
- convert.hsv.hsl = function (hsv) {
- var h = hsv[0];
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var vmin = Math.max(v, 0.01);
- var lmin;
- var sl;
- var l;
- l = (2 - s) * v;
- lmin = (2 - s) * vmin;
- sl = s * vmin;
- sl /= lmin <= 1 ? lmin : 2 - lmin;
- sl = sl || 0;
- l /= 2;
- return [h, sl * 100, l * 100];
- }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
-
-
- convert.hwb.rgb = function (hwb) {
- var h = hwb[0] / 360;
- var wh = hwb[1] / 100;
- var bl = hwb[2] / 100;
- var ratio = wh + bl;
- var i;
- var v;
- var f;
- var n; // wh + bl cant be > 1
-
- if (ratio > 1) {
- wh /= ratio;
- bl /= ratio;
- }
-
- i = Math.floor(6 * h);
- v = 1 - bl;
- f = 6 * h - i;
-
- if ((i & 0x01) !== 0) {
- f = 1 - f;
- }
-
- n = wh + f * (v - wh); // linear interpolation
-
- var r;
- var g;
- var b;
-
- switch (i) {
- default:
- case 6:
- case 0:
- r = v;
- g = n;
- b = wh;
- break;
-
- case 1:
- r = n;
- g = v;
- b = wh;
- break;
-
- case 2:
- r = wh;
- g = v;
- b = n;
- break;
-
- case 3:
- r = wh;
- g = n;
- b = v;
- break;
-
- case 4:
- r = n;
- g = wh;
- b = v;
- break;
-
- case 5:
- r = v;
- g = wh;
- b = n;
- break;
- }
-
- return [r * 255, g * 255, b * 255];
- };
-
- convert.cmyk.rgb = function (cmyk) {
- var c = cmyk[0] / 100;
- var m = cmyk[1] / 100;
- var y = cmyk[2] / 100;
- var k = cmyk[3] / 100;
- var r;
- var g;
- var b;
- r = 1 - Math.min(1, c * (1 - k) + k);
- g = 1 - Math.min(1, m * (1 - k) + k);
- b = 1 - Math.min(1, y * (1 - k) + k);
- return [r * 255, g * 255, b * 255];
- };
-
- convert.xyz.rgb = function (xyz) {
- var x = xyz[0] / 100;
- var y = xyz[1] / 100;
- var z = xyz[2] / 100;
- var r;
- var g;
- var b;
- r = x * 3.2406 + y * -1.5372 + z * -0.4986;
- g = x * -0.9689 + y * 1.8758 + z * 0.0415;
- b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB
-
- r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
- g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
- b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
- r = Math.min(Math.max(0, r), 1);
- g = Math.min(Math.max(0, g), 1);
- b = Math.min(Math.max(0, b), 1);
- return [r * 255, g * 255, b * 255];
- };
-
- convert.xyz.lab = function (xyz) {
- var x = xyz[0];
- var y = xyz[1];
- var z = xyz[2];
- var l;
- var a;
- var b;
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
- l = 116 * y - 16;
- a = 500 * (x - y);
- b = 200 * (y - z);
- return [l, a, b];
- };
-
- convert.lab.xyz = function (lab) {
- var l = lab[0];
- var a = lab[1];
- var b = lab[2];
- var x;
- var y;
- var z;
- y = (l + 16) / 116;
- x = a / 500 + y;
- z = y - b / 200;
- var y2 = Math.pow(y, 3);
- var x2 = Math.pow(x, 3);
- var z2 = Math.pow(z, 3);
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
- x *= 95.047;
- y *= 100;
- z *= 108.883;
- return [x, y, z];
- };
-
- convert.lab.lch = function (lab) {
- var l = lab[0];
- var a = lab[1];
- var b = lab[2];
- var hr;
- var h;
- var c;
- hr = Math.atan2(b, a);
- h = hr * 360 / 2 / Math.PI;
-
- if (h < 0) {
- h += 360;
- }
-
- c = Math.sqrt(a * a + b * b);
- return [l, c, h];
- };
-
- convert.lch.lab = function (lch) {
- var l = lch[0];
- var c = lch[1];
- var h = lch[2];
- var a;
- var b;
- var hr;
- hr = h / 360 * 2 * Math.PI;
- a = c * Math.cos(hr);
- b = c * Math.sin(hr);
- return [l, a, b];
- };
-
- convert.rgb.ansi16 = function (args) {
- var r = args[0];
- var g = args[1];
- var b = args[2];
- var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
-
- value = Math.round(value / 50);
-
- if (value === 0) {
- return 30;
- }
-
- var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
-
- if (value === 2) {
- ansi += 60;
- }
-
- return ansi;
- };
-
- convert.hsv.ansi16 = function (args) {
- // optimization here; we already know the value and don't need to get
- // it converted for us.
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
- };
-
- convert.rgb.ansi256 = function (args) {
- var r = args[0];
- var g = args[1];
- var b = args[2]; // we use the extended greyscale palette here, with the exception of
- // black and white. normal palette only has 4 greyscale shades.
-
- if (r === g && g === b) {
- if (r < 8) {
- return 16;
- }
-
- if (r > 248) {
- return 231;
- }
-
- return Math.round((r - 8) / 247 * 24) + 232;
- }
-
- var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
- return ansi;
- };
-
- convert.ansi16.rgb = function (args) {
- var color = args % 10; // handle greyscale
-
- if (color === 0 || color === 7) {
- if (args > 50) {
- color += 3.5;
- }
-
- color = color / 10.5 * 255;
- return [color, color, color];
- }
-
- var mult = (~~(args > 50) + 1) * 0.5;
- var r = (color & 1) * mult * 255;
- var g = (color >> 1 & 1) * mult * 255;
- var b = (color >> 2 & 1) * mult * 255;
- return [r, g, b];
- };
-
- convert.ansi256.rgb = function (args) {
- // handle greyscale
- if (args >= 232) {
- var c = (args - 232) * 10 + 8;
- return [c, c, c];
- }
-
- args -= 16;
- var rem;
- var r = Math.floor(args / 36) / 5 * 255;
- var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
- var b = rem % 6 / 5 * 255;
- return [r, g, b];
- };
-
- convert.rgb.hex = function (args) {
- var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
- var string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
-
- convert.hex.rgb = function (args) {
- var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
-
- if (!match) {
- return [0, 0, 0];
- }
-
- var colorString = match[0];
-
- if (match[0].length === 3) {
- colorString = colorString.split('').map(function (char) {
- return char + char;
- }).join('');
- }
-
- var integer = parseInt(colorString, 16);
- var r = integer >> 16 & 0xFF;
- var g = integer >> 8 & 0xFF;
- var b = integer & 0xFF;
- return [r, g, b];
- };
-
- convert.rgb.hcg = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var max = Math.max(Math.max(r, g), b);
- var min = Math.min(Math.min(r, g), b);
- var chroma = max - min;
- var grayscale;
- var hue;
-
- if (chroma < 1) {
- grayscale = min / (1 - chroma);
- } else {
- grayscale = 0;
- }
-
- if (chroma <= 0) {
- hue = 0;
- } else if (max === r) {
- hue = (g - b) / chroma % 6;
- } else if (max === g) {
- hue = 2 + (b - r) / chroma;
- } else {
- hue = 4 + (r - g) / chroma + 4;
- }
-
- hue /= 6;
- hue %= 1;
- return [hue * 360, chroma * 100, grayscale * 100];
- };
-
- convert.hsl.hcg = function (hsl) {
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var c = 1;
- var f = 0;
-
- if (l < 0.5) {
- c = 2.0 * s * l;
- } else {
- c = 2.0 * s * (1.0 - l);
- }
-
- if (c < 1.0) {
- f = (l - 0.5 * c) / (1.0 - c);
- }
-
- return [hsl[0], c * 100, f * 100];
- };
-
- convert.hsv.hcg = function (hsv) {
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var c = s * v;
- var f = 0;
-
- if (c < 1.0) {
- f = (v - c) / (1 - c);
- }
-
- return [hsv[0], c * 100, f * 100];
- };
-
- convert.hcg.rgb = function (hcg) {
- var h = hcg[0] / 360;
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
-
- if (c === 0.0) {
- return [g * 255, g * 255, g * 255];
- }
-
- var pure = [0, 0, 0];
- var hi = h % 1 * 6;
- var v = hi % 1;
- var w = 1 - v;
- var mg = 0;
-
- switch (Math.floor(hi)) {
- case 0:
- pure[0] = 1;
- pure[1] = v;
- pure[2] = 0;
- break;
-
- case 1:
- pure[0] = w;
- pure[1] = 1;
- pure[2] = 0;
- break;
-
- case 2:
- pure[0] = 0;
- pure[1] = 1;
- pure[2] = v;
- break;
-
- case 3:
- pure[0] = 0;
- pure[1] = w;
- pure[2] = 1;
- break;
-
- case 4:
- pure[0] = v;
- pure[1] = 0;
- pure[2] = 1;
- break;
-
- default:
- pure[0] = 1;
- pure[1] = 0;
- pure[2] = w;
- }
-
- mg = (1.0 - c) * g;
- return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
- };
-
- convert.hcg.hsv = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var v = c + g * (1.0 - c);
- var f = 0;
-
- if (v > 0.0) {
- f = c / v;
- }
-
- return [hcg[0], f * 100, v * 100];
- };
-
- convert.hcg.hsl = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var l = g * (1.0 - c) + 0.5 * c;
- var s = 0;
-
- if (l > 0.0 && l < 0.5) {
- s = c / (2 * l);
- } else if (l >= 0.5 && l < 1.0) {
- s = c / (2 * (1 - l));
- }
-
- return [hcg[0], s * 100, l * 100];
- };
-
- convert.hcg.hwb = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var v = c + g * (1.0 - c);
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
- };
-
- convert.hwb.hcg = function (hwb) {
- var w = hwb[1] / 100;
- var b = hwb[2] / 100;
- var v = 1 - b;
- var c = v - w;
- var g = 0;
-
- if (c < 1) {
- g = (v - c) / (1 - c);
- }
-
- return [hwb[0], c * 100, g * 100];
- };
-
- convert.apple.rgb = function (apple) {
- return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
- };
-
- convert.rgb.apple = function (rgb) {
- return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
- };
-
- convert.gray.rgb = function (args) {
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
- };
-
- convert.gray.hsl = convert.gray.hsv = function (args) {
- return [0, 0, args[0]];
- };
-
- convert.gray.hwb = function (gray) {
- return [0, 100, gray[0]];
- };
-
- convert.gray.cmyk = function (gray) {
- return [0, 0, 0, gray[0]];
- };
-
- convert.gray.lab = function (gray) {
- return [gray[0], 0, 0];
- };
-
- convert.gray.hex = function (gray) {
- var val = Math.round(gray[0] / 100 * 255) & 0xFF;
- var integer = (val << 16) + (val << 8) + val;
- var string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
-
- convert.rgb.gray = function (rgb) {
- var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
- return [val / 255 * 100];
- };
- });
- var conversions_1 = conversions.rgb;
- var conversions_2 = conversions.hsl;
- var conversions_3 = conversions.hsv;
- var conversions_4 = conversions.hwb;
- var conversions_5 = conversions.cmyk;
- var conversions_6 = conversions.xyz;
- var conversions_7 = conversions.lab;
- var conversions_8 = conversions.lch;
- var conversions_9 = conversions.hex;
- var conversions_10 = conversions.keyword;
- var conversions_11 = conversions.ansi16;
- var conversions_12 = conversions.ansi256;
- var conversions_13 = conversions.hcg;
- var conversions_14 = conversions.apple;
- var conversions_15 = conversions.gray;
-
- /*
- this function routes a model to all other models.
-
- all functions that are routed have a property `.conversion` attached
- to the returned synthetic function. This property is an array
- of strings, each with the steps in between the 'from' and 'to'
- color models (inclusive).
-
- conversions that are not possible simply are not included.
- */
-
- function buildGraph() {
- var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
-
- var models = Object.keys(conversions);
-
- for (var len = models.length, i = 0; i < len; i++) {
- graph[models[i]] = {
- // http://jsperf.com/1-vs-infinity
- // micro-opt, but this is simple.
- distance: -1,
- parent: null
- };
- }
-
- return graph;
- } // https://en.wikipedia.org/wiki/Breadth-first_search
-
-
- function deriveBFS(fromModel) {
- var graph = buildGraph();
- var queue = [fromModel]; // unshift -> queue -> pop
-
- graph[fromModel].distance = 0;
-
- while (queue.length) {
- var current = queue.pop();
- var adjacents = Object.keys(conversions[current]);
-
- for (var len = adjacents.length, i = 0; i < len; i++) {
- var adjacent = adjacents[i];
- var node = graph[adjacent];
-
- if (node.distance === -1) {
- node.distance = graph[current].distance + 1;
- node.parent = current;
- queue.unshift(adjacent);
- }
- }
- }
-
- return graph;
- }
-
- function link(from, to) {
- return function (args) {
- return to(from(args));
- };
- }
-
- function wrapConversion(toModel, graph) {
- var path = [graph[toModel].parent, toModel];
- var fn = conversions[graph[toModel].parent][toModel];
- var cur = graph[toModel].parent;
-
- while (graph[cur].parent) {
- path.unshift(graph[cur].parent);
- fn = link(conversions[graph[cur].parent][cur], fn);
- cur = graph[cur].parent;
- }
-
- fn.conversion = path;
- return fn;
- }
-
- var route = function route(fromModel) {
- var graph = deriveBFS(fromModel);
- var conversion = {};
- var models = Object.keys(graph);
-
- for (var len = models.length, i = 0; i < len; i++) {
- var toModel = models[i];
- var node = graph[toModel];
-
- if (node.parent === null) {
- // no possible conversion, or this node is the source model.
- continue;
- }
-
- conversion[toModel] = wrapConversion(toModel, graph);
- }
-
- return conversion;
- };
-
- var convert = {};
- var models = Object.keys(conversions);
-
- function wrapRaw(fn) {
- var wrappedFn = function wrappedFn(args) {
- if (args === undefined || args === null) {
- return args;
- }
-
- if (arguments.length > 1) {
- args = Array.prototype.slice.call(arguments);
- }
-
- return fn(args);
- }; // preserve .conversion property if there is one
-
-
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
-
- return wrappedFn;
- }
-
- function wrapRounded(fn) {
- var wrappedFn = function wrappedFn(args) {
- if (args === undefined || args === null) {
- return args;
- }
-
- if (arguments.length > 1) {
- args = Array.prototype.slice.call(arguments);
- }
-
- var result = fn(args); // we're assuming the result is an array here.
- // see notice in conversions.js; don't use box types
- // in conversion functions.
-
- if (typeof result === 'object') {
- for (var len = result.length, i = 0; i < len; i++) {
- result[i] = Math.round(result[i]);
- }
- }
-
- return result;
- }; // preserve .conversion property if there is one
-
-
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
-
- return wrappedFn;
- }
-
- models.forEach(function (fromModel) {
- convert[fromModel] = {};
- Object.defineProperty(convert[fromModel], 'channels', {
- value: conversions[fromModel].channels
- });
- Object.defineProperty(convert[fromModel], 'labels', {
- value: conversions[fromModel].labels
- });
- var routes = route(fromModel);
- var routeModels = Object.keys(routes);
- routeModels.forEach(function (toModel) {
- var fn = routes[toModel];
- convert[fromModel][toModel] = wrapRounded(fn);
- convert[fromModel][toModel].raw = wrapRaw(fn);
- });
- });
- var colorConvert = convert;
-
- var ansiStyles = createCommonjsModule(function (module) {
-
- const wrapAnsi16 = (fn, offset) => function () {
- const code = fn.apply(colorConvert, arguments);
- return "\x1B[".concat(code + offset, "m");
- };
-
- const wrapAnsi256 = (fn, offset) => function () {
- const code = fn.apply(colorConvert, arguments);
- return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
- };
-
- const wrapAnsi16m = (fn, offset) => function () {
- const rgb = fn.apply(colorConvert, arguments);
- return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
- };
-
- function assembleStyles() {
- const codes = new Map();
- const styles = {
- modifier: {
- reset: [0, 0],
- // 21 isn't widely supported and 22 does the same thing
- bold: [1, 22],
- dim: [2, 22],
- italic: [3, 23],
- underline: [4, 24],
- inverse: [7, 27],
- hidden: [8, 28],
- strikethrough: [9, 29]
- },
- color: {
- black: [30, 39],
- red: [31, 39],
- green: [32, 39],
- yellow: [33, 39],
- blue: [34, 39],
- magenta: [35, 39],
- cyan: [36, 39],
- white: [37, 39],
- gray: [90, 39],
- // Bright color
- redBright: [91, 39],
- greenBright: [92, 39],
- yellowBright: [93, 39],
- blueBright: [94, 39],
- magentaBright: [95, 39],
- cyanBright: [96, 39],
- whiteBright: [97, 39]
- },
- bgColor: {
- bgBlack: [40, 49],
- bgRed: [41, 49],
- bgGreen: [42, 49],
- bgYellow: [43, 49],
- bgBlue: [44, 49],
- bgMagenta: [45, 49],
- bgCyan: [46, 49],
- bgWhite: [47, 49],
- // Bright color
- bgBlackBright: [100, 49],
- bgRedBright: [101, 49],
- bgGreenBright: [102, 49],
- bgYellowBright: [103, 49],
- bgBlueBright: [104, 49],
- bgMagentaBright: [105, 49],
- bgCyanBright: [106, 49],
- bgWhiteBright: [107, 49]
- }
- }; // Fix humans
-
- styles.color.grey = styles.color.gray;
-
- for (const groupName of Object.keys(styles)) {
- const group = styles[groupName];
-
- for (const styleName of Object.keys(group)) {
- const style = group[styleName];
- styles[styleName] = {
- open: "\x1B[".concat(style[0], "m"),
- close: "\x1B[".concat(style[1], "m")
- };
- group[styleName] = styles[styleName];
- codes.set(style[0], style[1]);
- }
-
- Object.defineProperty(styles, groupName, {
- value: group,
- enumerable: false
- });
- Object.defineProperty(styles, 'codes', {
- value: codes,
- enumerable: false
- });
- }
-
- const ansi2ansi = n => n;
-
- const rgb2rgb = (r, g, b) => [r, g, b];
-
- styles.color.close = '\u001B[39m';
- styles.bgColor.close = '\u001B[49m';
- styles.color.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 0)
- };
- styles.color.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 0)
- };
- styles.color.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 0)
- };
- styles.bgColor.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 10)
- };
- styles.bgColor.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 10)
- };
- styles.bgColor.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 10)
- };
-
- for (let key of Object.keys(colorConvert)) {
- if (typeof colorConvert[key] !== 'object') {
- continue;
- }
-
- const suite = colorConvert[key];
-
- if (key === 'ansi16') {
- key = 'ansi';
- }
-
- if ('ansi16' in suite) {
- styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
- styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
- }
-
- if ('ansi256' in suite) {
- styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
- styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
- }
-
- if ('rgb' in suite) {
- styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
- styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
- }
- }
-
- return styles;
- } // Make the export immutable
-
-
- Object.defineProperty(module, 'exports', {
- enumerable: true,
- get: assembleStyles
- });
- });
-
- var require$$0$1 = {
- EOL: "\n"
- };
-
- var hasFlag = (flag, argv) => {
- argv = argv || process.argv;
- const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
- const pos = argv.indexOf(prefix + flag);
- const terminatorPos = argv.indexOf('--');
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
- };
-
- const env$1 = process.env;
- let forceColor;
-
- if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
- forceColor = false;
- } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
- forceColor = true;
- }
-
- if ('FORCE_COLOR' in env$1) {
- forceColor = env$1.FORCE_COLOR.length === 0 || parseInt(env$1.FORCE_COLOR, 10) !== 0;
- }
-
- function translateLevel(level) {
- if (level === 0) {
- return false;
- }
-
- return {
- level,
- hasBasic: true,
- has256: level >= 2,
- has16m: level >= 3
- };
- }
-
- function supportsColor(stream) {
- if (forceColor === false) {
- return 0;
- }
-
- if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
- return 3;
- }
-
- if (hasFlag('color=256')) {
- return 2;
- }
-
- if (stream && !stream.isTTY && forceColor !== true) {
- return 0;
- }
-
- const min = forceColor ? 1 : 0;
-
- if (process.platform === 'win32') {
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
- // libuv that enables 256 color output on Windows. Anything earlier and it
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
- // release that supports 256 colors. Windows 10 build 14931 is the first release
- // that supports 16m/TrueColor.
- const osRelease = require$$0$1.release().split('.');
-
- if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
- }
-
- return 1;
- }
-
- if ('CI' in env$1) {
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') {
- return 1;
- }
-
- return min;
- }
-
- if ('TEAMCITY_VERSION' in env$1) {
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
- }
-
- if (env$1.COLORTERM === 'truecolor') {
- return 3;
- }
-
- if ('TERM_PROGRAM' in env$1) {
- const version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
-
- switch (env$1.TERM_PROGRAM) {
- case 'iTerm.app':
- return version >= 3 ? 3 : 2;
-
- case 'Apple_Terminal':
- return 2;
- // No default
- }
- }
-
- if (/-256(color)?$/i.test(env$1.TERM)) {
- return 2;
- }
-
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
- return 1;
- }
-
- if ('COLORTERM' in env$1) {
- return 1;
- }
-
- if (env$1.TERM === 'dumb') {
- return min;
- }
-
- return min;
- }
-
- function getSupportLevel(stream) {
- const level = supportsColor(stream);
- return translateLevel(level);
- }
-
- var supportsColor_1 = {
- supportsColor: getSupportLevel,
- stdout: getSupportLevel(process.stdout),
- stderr: getSupportLevel(process.stderr)
- };
-
- const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
- const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
- const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
- const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
- const ESCAPES = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
-
- function unescape(c) {
- if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) {
- return String.fromCharCode(parseInt(c.slice(1), 16));
- }
-
- return ESCAPES.get(c) || c;
- }
-
- function parseArguments(name, args) {
- const results = [];
- const chunks = args.trim().split(/\s*,\s*/g);
- let matches;
-
- for (const chunk of chunks) {
- if (!isNaN(chunk)) {
- results.push(Number(chunk));
- } else if (matches = chunk.match(STRING_REGEX)) {
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
- } else {
- throw new Error("Invalid Chalk template style argument: ".concat(chunk, " (in style '").concat(name, "')"));
- }
- }
-
- return results;
- }
-
- function parseStyle(style) {
- STYLE_REGEX.lastIndex = 0;
- const results = [];
- let matches;
-
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
- const name = matches[1];
-
- if (matches[2]) {
- const args = parseArguments(name, matches[2]);
- results.push([name].concat(args));
- } else {
- results.push([name]);
- }
- }
-
- return results;
- }
-
- function buildStyle(chalk, styles) {
- const enabled = {};
-
- for (const layer of styles) {
- for (const style of layer.styles) {
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
- }
- }
-
- let current = chalk;
-
- for (const styleName of Object.keys(enabled)) {
- if (Array.isArray(enabled[styleName])) {
- if (!(styleName in current)) {
- throw new Error("Unknown Chalk style: ".concat(styleName));
- }
-
- if (enabled[styleName].length > 0) {
- current = current[styleName].apply(current, enabled[styleName]);
- } else {
- current = current[styleName];
- }
- }
- }
-
- return current;
- }
-
- var templates = (chalk, tmp) => {
- const styles = [];
- const chunks = [];
- let chunk = []; // eslint-disable-next-line max-params
-
- tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
- if (escapeChar) {
- chunk.push(unescape(escapeChar));
- } else if (style) {
- const str = chunk.join('');
- chunk = [];
- chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
- styles.push({
- inverse,
- styles: parseStyle(style)
- });
- } else if (close) {
- if (styles.length === 0) {
- throw new Error('Found extraneous } in Chalk template literal');
- }
-
- chunks.push(buildStyle(chalk, styles)(chunk.join('')));
- chunk = [];
- styles.pop();
- } else {
- chunk.push(chr);
- }
- });
- chunks.push(chunk.join(''));
-
- if (styles.length > 0) {
- const errMsg = "Chalk template literal is missing ".concat(styles.length, " closing bracket").concat(styles.length === 1 ? '' : 's', " (`}`)");
- throw new Error(errMsg);
- }
-
- return chunks.join('');
- };
-
- var chalk = createCommonjsModule(function (module) {
-
- const stdoutColor = supportsColor_1.stdout;
- const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping
-
- const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such
-
- const skipModels = new Set(['gray']);
- const styles = Object.create(null);
-
- function applyOptions(obj, options) {
- options = options || {}; // Detect level if not set manually
-
- const scLevel = stdoutColor ? stdoutColor.level : 0;
- obj.level = options.level === undefined ? scLevel : options.level;
- obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
- }
-
- function Chalk(options) {
- // We check for this.template here since calling `chalk.constructor()`
- // by itself will have a `this` of a previously constructed chalk object
- if (!this || !(this instanceof Chalk) || this.template) {
- const chalk = {};
- applyOptions(chalk, options);
-
- chalk.template = function () {
- const args = [].slice.call(arguments);
- return chalkTag.apply(null, [chalk.template].concat(args));
- };
-
- Object.setPrototypeOf(chalk, Chalk.prototype);
- Object.setPrototypeOf(chalk.template, chalk);
- chalk.template.constructor = Chalk;
- return chalk.template;
- }
-
- applyOptions(this, options);
- } // Use bright blue on Windows as the normal blue color is illegible
-
-
- if (isSimpleWindowsTerm) {
- ansiStyles.blue.open = '\u001B[94m';
- }
-
- for (const key of Object.keys(ansiStyles)) {
- ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
- styles[key] = {
- get() {
- const codes = ansiStyles[key];
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
- }
-
- };
- }
-
- styles.visible = {
- get() {
- return build.call(this, this._styles || [], true, 'visible');
- }
-
- };
- ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
-
- for (const model of Object.keys(ansiStyles.color.ansi)) {
- if (skipModels.has(model)) {
- continue;
- }
-
- styles[model] = {
- get() {
- const level = this.level;
- return function () {
- const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
- const codes = {
- open,
- close: ansiStyles.color.close,
- closeRe: ansiStyles.color.closeRe
- };
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
- };
- }
-
- };
- }
-
- ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
-
- for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
- if (skipModels.has(model)) {
- continue;
- }
-
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
- styles[bgModel] = {
- get() {
- const level = this.level;
- return function () {
- const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
- const codes = {
- open,
- close: ansiStyles.bgColor.close,
- closeRe: ansiStyles.bgColor.closeRe
- };
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
- };
- }
-
- };
- }
-
- const proto = Object.defineProperties(() => {}, styles);
-
- function build(_styles, _empty, key) {
- const builder = function builder() {
- return applyStyle.apply(builder, arguments);
- };
-
- builder._styles = _styles;
- builder._empty = _empty;
- const self = this;
- Object.defineProperty(builder, 'level', {
- enumerable: true,
-
- get() {
- return self.level;
- },
-
- set(level) {
- self.level = level;
- }
-
- });
- Object.defineProperty(builder, 'enabled', {
- enumerable: true,
-
- get() {
- return self.enabled;
- },
-
- set(enabled) {
- self.enabled = enabled;
- }
-
- }); // See below for fix regarding invisible grey/dim combination on Windows
-
- builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is
- // no way to create a function with a different prototype
-
- builder.__proto__ = proto; // eslint-disable-line no-proto
-
- return builder;
- }
-
- function applyStyle() {
- // Support varags, but simply cast to string in case there's only one arg
- const args = arguments;
- const argsLen = args.length;
- let str = String(arguments[0]);
-
- if (argsLen === 0) {
- return '';
- }
-
- if (argsLen > 1) {
- // Don't slice `arguments`, it prevents V8 optimizations
- for (let a = 1; a < argsLen; a++) {
- str += ' ' + args[a];
- }
- }
-
- if (!this.enabled || this.level <= 0 || !str) {
- return this._empty ? '' : str;
- } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
- // see https://github.com/chalk/chalk/issues/58
- // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
-
-
- const originalDim = ansiStyles.dim.open;
-
- if (isSimpleWindowsTerm && this.hasGrey) {
- ansiStyles.dim.open = '';
- }
-
- for (const code of this._styles.slice().reverse()) {
- // Replace any instances already present with a re-opening code
- // otherwise only the part of the string until said closing code
- // will be colored, and the rest will simply be 'plain'.
- str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen
- // after next line to fix a bleed issue on macOS
- // https://github.com/chalk/chalk/pull/92
-
- str = str.replace(/\r?\n/g, "".concat(code.close, "$&").concat(code.open));
- } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
-
-
- ansiStyles.dim.open = originalDim;
- return str;
- }
-
- function chalkTag(chalk, strings) {
- if (!Array.isArray(strings)) {
- // If chalk() was called by itself or with a string,
- // return the string itself as a string.
- return [].slice.call(arguments, 1).join(' ');
- }
-
- const args = [].slice.call(arguments, 2);
- const parts = [strings.raw[0]];
-
- for (let i = 1; i < strings.length; i++) {
- parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
- parts.push(String(strings.raw[i]));
- }
-
- return templates(chalk, parts.join(''));
- }
-
- Object.defineProperties(Chalk.prototype, styles);
- module.exports = Chalk(); // eslint-disable-line new-cap
-
- module.exports.supportsColor = stdoutColor;
- module.exports.default = module.exports; // For TypeScript
- });
- var chalk_1 = chalk.supportsColor;
-
- var common = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- exports.commonDeprecatedHandler = (keyOrPair, redirectTo, {
- descriptor
- }) => {
- const messages = ["".concat(chalk.default.yellow(typeof keyOrPair === 'string' ? descriptor.key(keyOrPair) : descriptor.pair(keyOrPair)), " is deprecated")];
-
- if (redirectTo) {
- messages.push("we now treat it as ".concat(chalk.default.blue(typeof redirectTo === 'string' ? descriptor.key(redirectTo) : descriptor.pair(redirectTo))));
- }
-
- return messages.join('; ') + '.';
- };
- });
- unwrapExports(common);
- var common_1 = common.commonDeprecatedHandler;
-
- var deprecated = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- tslib_1.__exportStar(common, exports);
- });
- unwrapExports(deprecated);
-
- var common$1 = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- 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(' ');
- });
- unwrapExports(common$1);
- var common_1$1 = common$1.commonInvalidHandler;
-
- var invalid = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- tslib_1.__exportStar(common$1, exports);
- });
- unwrapExports(invalid);
-
- /* eslint-disable no-nested-ternary */
-
- var arr = [];
- var charCodeCache = [];
-
- var leven = function leven(a, b) {
- if (a === b) {
- return 0;
- }
-
- var swap = a; // Swapping the strings if `a` is longer than `b` so we know which one is the
- // shortest & which one is the longest
-
- if (a.length > b.length) {
- a = b;
- b = swap;
- }
-
- var aLen = a.length;
- var bLen = b.length;
-
- if (aLen === 0) {
- return bLen;
- }
-
- if (bLen === 0) {
- return aLen;
- } // Performing suffix trimming:
- // We can linearly drop suffix common to both strings since they
- // don't increase distance at all
- // Note: `~-` is the bitwise way to perform a `- 1` operation
-
-
- while (aLen > 0 && a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen)) {
- aLen--;
- bLen--;
- }
-
- if (aLen === 0) {
- return bLen;
- } // Performing prefix trimming
- // We can linearly drop prefix common to both strings since they
- // don't increase distance at all
-
-
- var start = 0;
-
- while (start < aLen && a.charCodeAt(start) === b.charCodeAt(start)) {
- start++;
- }
-
- aLen -= start;
- bLen -= start;
-
- if (aLen === 0) {
- return bLen;
- }
-
- var bCharCode;
- var ret;
- var tmp;
- var tmp2;
- var i = 0;
- var j = 0;
-
- while (i < aLen) {
- charCodeCache[start + i] = a.charCodeAt(start + i);
- arr[i] = ++i;
- }
-
- while (j < bLen) {
- bCharCode = b.charCodeAt(start + j);
- tmp = j++;
- ret = j;
-
- for (i = 0; i < aLen; i++) {
- tmp2 = bCharCode === charCodeCache[start + i] ? tmp : tmp + 1;
- tmp = arr[i];
- ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
- }
- }
-
- return ret;
- };
-
- var leven_1 = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- exports.levenUnknownHandler = (key, value, {
- descriptor,
- logger,
- schemas
- }) => {
- const messages = ["Ignored unknown option ".concat(chalk.default.yellow(descriptor.pair({
- key,
- value
- })), ".")];
- const suggestion = Object.keys(schemas).sort().find(knownKey => leven(key, knownKey) < 3);
-
- if (suggestion) {
- messages.push("Did you mean ".concat(chalk.default.blue(descriptor.key(suggestion)), "?"));
- }
-
- logger.warn(messages.join(' '));
- };
- });
- unwrapExports(leven_1);
- var leven_2 = leven_1.levenUnknownHandler;
-
- var unknown = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- tslib_1.__exportStar(leven_1, exports);
- });
- unwrapExports(unknown);
-
- var handlers = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- tslib_1.__exportStar(deprecated, exports);
-
- tslib_1.__exportStar(invalid, exports);
-
- tslib_1.__exportStar(unknown, exports);
- });
- unwrapExports(handlers);
-
- var schema = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- const HANDLER_KEYS = ['default', 'expected', 'validate', 'deprecated', 'forward', 'redirect', 'overlap', 'preprocess', 'postprocess'];
-
- function createSchema(SchemaConstructor, parameters) {
- const schema = new SchemaConstructor(parameters);
- const subSchema = Object.create(schema);
-
- for (const handlerKey of HANDLER_KEYS) {
- if (handlerKey in parameters) {
- subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema, Schema.prototype[handlerKey].length);
- }
- }
-
- return subSchema;
- }
-
- exports.createSchema = createSchema;
-
- class Schema {
- constructor(parameters) {
- this.name = parameters.name;
- }
-
- static create(parameters) {
- // @ts-ignore: https://github.com/Microsoft/TypeScript/issues/5863
- return createSchema(this, parameters);
- }
-
- default(_utils) {
- return undefined;
- } // istanbul ignore next: this is actually an abstract method but we need a placeholder to get `function.length`
-
-
- expected(_utils) {
- return 'nothing';
- } // istanbul ignore next: this is actually an abstract method but we need a placeholder to get `function.length`
-
-
- validate(_value, _utils) {
- return false;
- }
-
- deprecated(_value, _utils) {
- return false;
- }
-
- forward(_value, _utils) {
- return undefined;
- }
-
- redirect(_value, _utils) {
- return undefined;
- }
-
- overlap(currentValue, _newValue, _utils) {
- return currentValue;
- }
-
- preprocess(value, _utils) {
- return value;
- }
-
- postprocess(value, _utils) {
- return value;
- }
-
- }
-
- exports.Schema = Schema;
-
- function normalizeHandler(handler, superSchema, handlerArgumentsLength) {
- return typeof handler === 'function' ? (...args) => handler(...args.slice(0, handlerArgumentsLength - 1), superSchema, ...args.slice(handlerArgumentsLength - 1)) : () => handler;
- }
- });
- unwrapExports(schema);
- var schema_1 = schema.createSchema;
- var schema_2 = schema.Schema;
-
- var alias = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- class AliasSchema extends schema.Schema {
- constructor(parameters) {
- super(parameters);
- this._sourceName = parameters.sourceName;
- }
-
- expected(utils) {
- return utils.schemas[this._sourceName].expected(utils);
- }
-
- validate(value, utils) {
- return utils.schemas[this._sourceName].validate(value, utils);
- }
-
- redirect(_value, _utils) {
- return this._sourceName;
- }
-
- }
-
- exports.AliasSchema = AliasSchema;
- });
- unwrapExports(alias);
- var alias_1 = alias.AliasSchema;
-
- var any = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- class AnySchema extends schema.Schema {
- expected() {
- return 'anything';
- }
-
- validate() {
- return true;
- }
-
- }
-
- exports.AnySchema = AnySchema;
- });
- unwrapExports(any);
- var any_1 = any.AnySchema;
-
- var array = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- class ArraySchema extends schema.Schema {
- constructor(_a) {
- var {
- valueSchema,
- name = valueSchema.name
- } = _a,
- handlers = tslib_1.__rest(_a, ["valueSchema", "name"]);
-
- super(Object.assign({}, handlers, {
- name
- }));
- this._valueSchema = valueSchema;
- }
-
- expected(utils) {
- return "an array of ".concat(this._valueSchema.expected(utils));
- }
-
- validate(value, utils) {
- if (!Array.isArray(value)) {
- return false;
- }
-
- const invalidValues = [];
-
- for (const subValue of value) {
- const subValidateResult = utils.normalizeValidateResult(this._valueSchema.validate(subValue, utils), subValue);
-
- if (subValidateResult !== true) {
- invalidValues.push(subValidateResult.value);
- }
- }
-
- return invalidValues.length === 0 ? true : {
- value: invalidValues
- };
- }
-
- deprecated(value, utils) {
- const deprecatedResult = [];
-
- for (const subValue of value) {
- const subDeprecatedResult = utils.normalizeDeprecatedResult(this._valueSchema.deprecated(subValue, utils), subValue);
-
- if (subDeprecatedResult !== false) {
- deprecatedResult.push(...subDeprecatedResult.map(({
- value: deprecatedValue
- }) => ({
- value: [deprecatedValue]
- })));
- }
- }
-
- return deprecatedResult;
- }
-
- forward(value, utils) {
- const forwardResult = [];
-
- for (const subValue of value) {
- const subForwardResult = utils.normalizeForwardResult(this._valueSchema.forward(subValue, utils), subValue);
- forwardResult.push(...subForwardResult.map(wrapTransferResult));
- }
-
- return forwardResult;
- }
-
- redirect(value, utils) {
- const remain = [];
- const redirect = [];
-
- for (const subValue of value) {
- const subRedirectResult = utils.normalizeRedirectResult(this._valueSchema.redirect(subValue, utils), subValue);
-
- if ('remain' in subRedirectResult) {
- remain.push(subRedirectResult.remain);
- }
-
- redirect.push(...subRedirectResult.redirect.map(wrapTransferResult));
- }
-
- return remain.length === 0 ? {
- redirect
- } : {
- redirect,
- remain
- };
- }
-
- overlap(currentValue, newValue) {
- return currentValue.concat(newValue);
- }
-
- }
-
- exports.ArraySchema = ArraySchema;
-
- function wrapTransferResult({
- from,
- to
- }) {
- return {
- from: [from],
- to
- };
- }
- });
- unwrapExports(array);
- var array_1 = array.ArraySchema;
-
- var boolean_1 = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- class BooleanSchema extends schema.Schema {
- expected() {
- return 'true or false';
- }
-
- validate(value) {
- return typeof value === 'boolean';
- }
-
- }
-
- exports.BooleanSchema = BooleanSchema;
- });
- unwrapExports(boolean_1);
- var boolean_2 = boolean_1.BooleanSchema;
-
- var utils = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- function recordFromArray(array, mainKey) {
- const record = Object.create(null);
-
- for (const value of array) {
- const key = value[mainKey]; // istanbul ignore next
-
- if (record[key]) {
- throw new Error("Duplicate ".concat(mainKey, " ").concat(JSON.stringify(key)));
- } // @ts-ignore
-
-
- record[key] = value;
- }
-
- return record;
- }
-
- exports.recordFromArray = recordFromArray;
-
- function mapFromArray(array, mainKey) {
- const map = new Map();
-
- for (const value of array) {
- const key = value[mainKey]; // istanbul ignore next
-
- if (map.has(key)) {
- throw new Error("Duplicate ".concat(mainKey, " ").concat(JSON.stringify(key)));
- }
-
- map.set(key, value);
- }
-
- return map;
- }
-
- exports.mapFromArray = mapFromArray;
-
- function createAutoChecklist() {
- const map = Object.create(null);
- return id => {
- const idString = JSON.stringify(id);
-
- if (map[idString]) {
- return true;
- }
-
- map[idString] = true;
- return false;
- };
- }
-
- exports.createAutoChecklist = createAutoChecklist;
-
- function partition(array, predicate) {
- const trueArray = [];
- const falseArray = [];
-
- for (const value of array) {
- if (predicate(value)) {
- trueArray.push(value);
- } else {
- falseArray.push(value);
- }
- }
-
- return [trueArray, falseArray];
- }
-
- exports.partition = partition;
-
- function isInt(value) {
- return value === Math.floor(value);
- }
-
- exports.isInt = isInt;
-
- function comparePrimitive(a, b) {
- if (a === b) {
- return 0;
- }
-
- const typeofA = typeof a;
- const typeofB = typeof b;
- const orders = ['undefined', 'object', 'boolean', 'number', 'string'];
-
- if (typeofA !== typeofB) {
- return orders.indexOf(typeofA) - orders.indexOf(typeofB);
- }
-
- if (typeofA !== 'string') {
- return Number(a) - Number(b);
- }
-
- return a.localeCompare(b);
- }
-
- exports.comparePrimitive = comparePrimitive;
-
- function normalizeDefaultResult(result) {
- return result === undefined ? {} : result;
- }
-
- exports.normalizeDefaultResult = normalizeDefaultResult;
-
- function normalizeValidateResult(result, value) {
- return result === true ? true : result === false ? {
- value
- } : result;
- }
-
- exports.normalizeValidateResult = normalizeValidateResult;
-
- function normalizeDeprecatedResult(result, value, doNotNormalizeTrue = false) {
- return result === false ? false : result === true ? doNotNormalizeTrue ? true : [{
- value
- }] : 'value' in result ? [result] : result.length === 0 ? false : result;
- }
-
- exports.normalizeDeprecatedResult = normalizeDeprecatedResult;
-
- function normalizeTransferResult(result, value) {
- return typeof result === 'string' || 'key' in result ? {
- from: value,
- to: result
- } : 'from' in result ? {
- from: result.from,
- to: result.to
- } : {
- from: value,
- to: result.to
- };
- }
-
- exports.normalizeTransferResult = normalizeTransferResult;
-
- function normalizeForwardResult(result, value) {
- return result === undefined ? [] : Array.isArray(result) ? result.map(transferResult => normalizeTransferResult(transferResult, value)) : [normalizeTransferResult(result, value)];
- }
-
- exports.normalizeForwardResult = normalizeForwardResult;
-
- function normalizeRedirectResult(result, value) {
- const redirect = normalizeForwardResult(typeof result === 'object' && 'redirect' in result ? result.redirect : result, value);
- return redirect.length === 0 ? {
- remain: value,
- redirect
- } : typeof result === 'object' && 'remain' in result ? {
- remain: result.remain,
- redirect
- } : {
- redirect
- };
- }
-
- exports.normalizeRedirectResult = normalizeRedirectResult;
- });
- unwrapExports(utils);
- var utils_1 = utils.recordFromArray;
- var utils_2 = utils.mapFromArray;
- var utils_3 = utils.createAutoChecklist;
- var utils_4 = utils.partition;
- var utils_5 = utils.isInt;
- var utils_6 = utils.comparePrimitive;
- var utils_7 = utils.normalizeDefaultResult;
- var utils_8 = utils.normalizeValidateResult;
- var utils_9 = utils.normalizeDeprecatedResult;
- var utils_10 = utils.normalizeTransferResult;
- var utils_11 = utils.normalizeForwardResult;
- var utils_12 = utils.normalizeRedirectResult;
-
- var choice = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- class ChoiceSchema extends schema.Schema {
- constructor(parameters) {
- super(parameters);
- this._choices = utils.mapFromArray(parameters.choices.map(choice => choice && typeof choice === 'object' ? choice : {
- value: choice
- }), 'value');
- }
-
- expected({
- descriptor
- }) {
- 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);
- const head = choiceValues.slice(0, -2);
- const tail = choiceValues.slice(-2);
- return head.concat(tail.join(' or ')).join(', ');
- }
-
- validate(value) {
- return this._choices.has(value);
- }
-
- deprecated(value) {
- const choiceInfo = this._choices.get(value);
-
- return choiceInfo && choiceInfo.deprecated ? {
- value
- } : false;
- }
-
- forward(value) {
- const choiceInfo = this._choices.get(value);
-
- return choiceInfo ? choiceInfo.forward : undefined;
- }
-
- redirect(value) {
- const choiceInfo = this._choices.get(value);
-
- return choiceInfo ? choiceInfo.redirect : undefined;
- }
-
- }
-
- exports.ChoiceSchema = ChoiceSchema;
- });
- unwrapExports(choice);
- var choice_1 = choice.ChoiceSchema;
-
- var number = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- class NumberSchema extends schema.Schema {
- expected() {
- return 'a number';
- }
-
- validate(value, _utils) {
- return typeof value === 'number';
- }
-
- }
-
- exports.NumberSchema = NumberSchema;
- });
- unwrapExports(number);
- var number_1 = number.NumberSchema;
-
- var integer = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- class IntegerSchema extends number.NumberSchema {
- expected() {
- return 'an integer';
- }
-
- validate(value, utils$1) {
- return utils$1.normalizeValidateResult(super.validate(value, utils$1), value) === true && utils.isInt(value);
- }
-
- }
-
- exports.IntegerSchema = IntegerSchema;
- });
- unwrapExports(integer);
- var integer_1 = integer.IntegerSchema;
-
- var string = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- class StringSchema extends schema.Schema {
- expected() {
- return 'a string';
- }
-
- validate(value) {
- return typeof value === 'string';
- }
-
- }
-
- exports.StringSchema = StringSchema;
- });
- unwrapExports(string);
- var string_1 = string.StringSchema;
-
- var schemas = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- tslib_1.__exportStar(alias, exports);
-
- tslib_1.__exportStar(any, exports);
-
- tslib_1.__exportStar(array, exports);
-
- tslib_1.__exportStar(boolean_1, exports);
-
- tslib_1.__exportStar(choice, exports);
-
- tslib_1.__exportStar(integer, exports);
-
- tslib_1.__exportStar(number, exports);
-
- tslib_1.__exportStar(string, exports);
- });
- unwrapExports(schemas);
-
- var defaults = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.defaultDescriptor = api.apiDescriptor;
- exports.defaultUnknownHandler = leven_1.levenUnknownHandler;
- exports.defaultInvalidHandler = invalid.commonInvalidHandler;
- exports.defaultDeprecatedHandler = common.commonDeprecatedHandler;
- });
- unwrapExports(defaults);
- var defaults_1 = defaults.defaultDescriptor;
- var defaults_2 = defaults.defaultUnknownHandler;
- var defaults_3 = defaults.defaultInvalidHandler;
- var defaults_4 = defaults.defaultDeprecatedHandler;
-
- var normalize = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- exports.normalize = (options, schemas, opts) => new Normalizer(schemas, opts).normalize(options);
-
- class Normalizer {
- constructor(schemas, opts) {
- // istanbul ignore next
- const {
- logger = console,
- descriptor = defaults.defaultDescriptor,
- unknown = defaults.defaultUnknownHandler,
- invalid = defaults.defaultInvalidHandler,
- deprecated = defaults.defaultDeprecatedHandler
- } = opts || {};
- this._utils = {
- descriptor,
- logger:
- /* istanbul ignore next */
- logger || {
- warn: () => {}
- },
- schemas: utils.recordFromArray(schemas, 'name'),
- normalizeDefaultResult: utils.normalizeDefaultResult,
- normalizeDeprecatedResult: utils.normalizeDeprecatedResult,
- normalizeForwardResult: utils.normalizeForwardResult,
- normalizeRedirectResult: utils.normalizeRedirectResult,
- normalizeValidateResult: utils.normalizeValidateResult
- };
- this._unknownHandler = unknown;
- this._invalidHandler = invalid;
- this._deprecatedHandler = deprecated;
- this.cleanHistory();
- }
-
- cleanHistory() {
- this._hasDeprecationWarned = utils.createAutoChecklist();
- }
-
- normalize(options) {
- const normalized = {};
- const restOptionsArray = [options];
-
- const applyNormalization = () => {
- while (restOptionsArray.length !== 0) {
- const currentOptions = restOptionsArray.shift();
-
- const transferredOptionsArray = this._applyNormalization(currentOptions, normalized);
-
- restOptionsArray.push(...transferredOptionsArray);
- }
- };
-
- applyNormalization();
-
- for (const key of Object.keys(this._utils.schemas)) {
- const schema = this._utils.schemas[key];
-
- if (!(key in normalized)) {
- const defaultResult = utils.normalizeDefaultResult(schema.default(this._utils));
-
- if ('value' in defaultResult) {
- restOptionsArray.push({
- [key]: defaultResult.value
- });
- }
- }
- }
-
- applyNormalization();
-
- for (const key of Object.keys(this._utils.schemas)) {
- const schema = this._utils.schemas[key];
-
- if (key in normalized) {
- normalized[key] = schema.postprocess(normalized[key], this._utils);
- }
- }
-
- return normalized;
- }
-
- _applyNormalization(options, normalized) {
- const transferredOptionsArray = [];
- const [knownOptionNames, unknownOptionNames] = utils.partition(Object.keys(options), key => key in this._utils.schemas);
-
- for (const key of knownOptionNames) {
- const schema = this._utils.schemas[key];
- const value = schema.preprocess(options[key], this._utils);
- const validateResult = utils.normalizeValidateResult(schema.validate(value, this._utils), value);
-
- if (validateResult !== true) {
- const {
- value: invalidValue
- } = validateResult;
-
- const errorMessageOrError = this._invalidHandler(key, invalidValue, this._utils);
-
- throw typeof errorMessageOrError === 'string' ? new Error(errorMessageOrError) :
- /* istanbul ignore next*/
- errorMessageOrError;
- }
-
- const appendTransferredOptions = ({
- from,
- to
- }) => {
- transferredOptionsArray.push(typeof to === 'string' ? {
- [to]: from
- } : {
- [to.key]: to.value
- });
- };
-
- const warnDeprecated = ({
- value: currentValue,
- redirectTo
- }) => {
- const deprecatedResult = utils.normalizeDeprecatedResult(schema.deprecated(currentValue, this._utils), value,
- /* doNotNormalizeTrue */
- true);
-
- if (deprecatedResult === false) {
- return;
- }
-
- if (deprecatedResult === true) {
- if (!this._hasDeprecationWarned(key)) {
- this._utils.logger.warn(this._deprecatedHandler(key, redirectTo, this._utils));
- }
- } else {
- for (const {
- value: deprecatedValue
- } of deprecatedResult) {
- const pair = {
- key,
- value: deprecatedValue
- };
-
- if (!this._hasDeprecationWarned(pair)) {
- const redirectToPair = typeof redirectTo === 'string' ? {
- key: redirectTo,
- value: deprecatedValue
- } : redirectTo;
-
- this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils));
- }
- }
- }
- };
-
- const forwardResult = utils.normalizeForwardResult(schema.forward(value, this._utils), value);
- forwardResult.forEach(appendTransferredOptions);
- const redirectResult = utils.normalizeRedirectResult(schema.redirect(value, this._utils), value);
- redirectResult.redirect.forEach(appendTransferredOptions);
-
- if ('remain' in redirectResult) {
- const remainingValue = redirectResult.remain;
- normalized[key] = key in normalized ? schema.overlap(normalized[key], remainingValue, this._utils) : remainingValue;
- warnDeprecated({
- value: remainingValue
- });
- }
-
- for (const {
- from,
- to
- } of redirectResult.redirect) {
- warnDeprecated({
- value: from,
- redirectTo: to
- });
- }
- }
-
- for (const key of unknownOptionNames) {
- const value = options[key];
-
- const unknownResult = this._unknownHandler(key, value, this._utils);
-
- if (unknownResult) {
- for (const unknownKey of Object.keys(unknownResult)) {
- const unknownOption = {
- [unknownKey]: unknownResult[unknownKey]
- };
-
- if (unknownKey in this._utils.schemas) {
- transferredOptionsArray.push(unknownOption);
- } else {
- Object.assign(normalized, unknownOption);
- }
- }
- }
- }
-
- return transferredOptionsArray;
- }
-
- }
-
- exports.Normalizer = Normalizer;
- });
- unwrapExports(normalize);
- var normalize_1 = normalize.normalize;
- var normalize_2 = normalize.Normalizer;
-
- var lib = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- tslib_1.__exportStar(descriptors, exports);
-
- tslib_1.__exportStar(handlers, exports);
-
- tslib_1.__exportStar(schemas, exports);
-
- tslib_1.__exportStar(normalize, exports);
-
- tslib_1.__exportStar(schema, exports);
- });
- unwrapExports(lib);
-
- const array$1 = [];
- const charCodeCache$1 = [];
-
- const leven$1 = (left, right) => {
- if (left === right) {
- return 0;
- }
-
- const swap = left; // Swapping the strings if `a` is longer than `b` so we know which one is the
- // shortest & which one is the longest
-
- if (left.length > right.length) {
- left = right;
- right = swap;
- }
-
- let leftLength = left.length;
- let rightLength = right.length; // Performing suffix trimming:
- // We can linearly drop suffix common to both strings since they
- // don't increase distance at all
- // Note: `~-` is the bitwise way to perform a `- 1` operation
-
- while (leftLength > 0 && left.charCodeAt(~-leftLength) === right.charCodeAt(~-rightLength)) {
- leftLength--;
- rightLength--;
- } // Performing prefix trimming
- // We can linearly drop prefix common to both strings since they
- // don't increase distance at all
-
-
- let start = 0;
-
- while (start < leftLength && left.charCodeAt(start) === right.charCodeAt(start)) {
- start++;
- }
-
- leftLength -= start;
- rightLength -= start;
-
- if (leftLength === 0) {
- return rightLength;
- }
-
- let bCharCode;
- let result;
- let temp;
- let temp2;
- let i = 0;
- let j = 0;
-
- while (i < leftLength) {
- charCodeCache$1[i] = left.charCodeAt(start + i);
- array$1[i] = ++i;
- }
-
- while (j < rightLength) {
- bCharCode = right.charCodeAt(start + j);
- temp = j++;
- result = j;
-
- for (i = 0; i < leftLength; i++) {
- temp2 = bCharCode === charCodeCache$1[i] ? temp : temp + 1;
- temp = array$1[i]; // eslint-disable-next-line no-multi-assign
-
- result = array$1[i] = temp > result ? temp2 > result ? result + 1 : temp2 : temp2 > temp ? temp + 1 : temp2;
- }
- }
-
- return result;
- };
-
- var leven_1$1 = leven$1; // TODO: Remove this for the next major release
-
- var default_1 = leven$1;
- leven_1$1.default = default_1;
-
- var colorName$1 = {
- "aliceblue": [240, 248, 255],
- "antiquewhite": [250, 235, 215],
- "aqua": [0, 255, 255],
- "aquamarine": [127, 255, 212],
- "azure": [240, 255, 255],
- "beige": [245, 245, 220],
- "bisque": [255, 228, 196],
- "black": [0, 0, 0],
- "blanchedalmond": [255, 235, 205],
- "blue": [0, 0, 255],
- "blueviolet": [138, 43, 226],
- "brown": [165, 42, 42],
- "burlywood": [222, 184, 135],
- "cadetblue": [95, 158, 160],
- "chartreuse": [127, 255, 0],
- "chocolate": [210, 105, 30],
- "coral": [255, 127, 80],
- "cornflowerblue": [100, 149, 237],
- "cornsilk": [255, 248, 220],
- "crimson": [220, 20, 60],
- "cyan": [0, 255, 255],
- "darkblue": [0, 0, 139],
- "darkcyan": [0, 139, 139],
- "darkgoldenrod": [184, 134, 11],
- "darkgray": [169, 169, 169],
- "darkgreen": [0, 100, 0],
- "darkgrey": [169, 169, 169],
- "darkkhaki": [189, 183, 107],
- "darkmagenta": [139, 0, 139],
- "darkolivegreen": [85, 107, 47],
- "darkorange": [255, 140, 0],
- "darkorchid": [153, 50, 204],
- "darkred": [139, 0, 0],
- "darksalmon": [233, 150, 122],
- "darkseagreen": [143, 188, 143],
- "darkslateblue": [72, 61, 139],
- "darkslategray": [47, 79, 79],
- "darkslategrey": [47, 79, 79],
- "darkturquoise": [0, 206, 209],
- "darkviolet": [148, 0, 211],
- "deeppink": [255, 20, 147],
- "deepskyblue": [0, 191, 255],
- "dimgray": [105, 105, 105],
- "dimgrey": [105, 105, 105],
- "dodgerblue": [30, 144, 255],
- "firebrick": [178, 34, 34],
- "floralwhite": [255, 250, 240],
- "forestgreen": [34, 139, 34],
- "fuchsia": [255, 0, 255],
- "gainsboro": [220, 220, 220],
- "ghostwhite": [248, 248, 255],
- "gold": [255, 215, 0],
- "goldenrod": [218, 165, 32],
- "gray": [128, 128, 128],
- "green": [0, 128, 0],
- "greenyellow": [173, 255, 47],
- "grey": [128, 128, 128],
- "honeydew": [240, 255, 240],
- "hotpink": [255, 105, 180],
- "indianred": [205, 92, 92],
- "indigo": [75, 0, 130],
- "ivory": [255, 255, 240],
- "khaki": [240, 230, 140],
- "lavender": [230, 230, 250],
- "lavenderblush": [255, 240, 245],
- "lawngreen": [124, 252, 0],
- "lemonchiffon": [255, 250, 205],
- "lightblue": [173, 216, 230],
- "lightcoral": [240, 128, 128],
- "lightcyan": [224, 255, 255],
- "lightgoldenrodyellow": [250, 250, 210],
- "lightgray": [211, 211, 211],
- "lightgreen": [144, 238, 144],
- "lightgrey": [211, 211, 211],
- "lightpink": [255, 182, 193],
- "lightsalmon": [255, 160, 122],
- "lightseagreen": [32, 178, 170],
- "lightskyblue": [135, 206, 250],
- "lightslategray": [119, 136, 153],
- "lightslategrey": [119, 136, 153],
- "lightsteelblue": [176, 196, 222],
- "lightyellow": [255, 255, 224],
- "lime": [0, 255, 0],
- "limegreen": [50, 205, 50],
- "linen": [250, 240, 230],
- "magenta": [255, 0, 255],
- "maroon": [128, 0, 0],
- "mediumaquamarine": [102, 205, 170],
- "mediumblue": [0, 0, 205],
- "mediumorchid": [186, 85, 211],
- "mediumpurple": [147, 112, 219],
- "mediumseagreen": [60, 179, 113],
- "mediumslateblue": [123, 104, 238],
- "mediumspringgreen": [0, 250, 154],
- "mediumturquoise": [72, 209, 204],
- "mediumvioletred": [199, 21, 133],
- "midnightblue": [25, 25, 112],
- "mintcream": [245, 255, 250],
- "mistyrose": [255, 228, 225],
- "moccasin": [255, 228, 181],
- "navajowhite": [255, 222, 173],
- "navy": [0, 0, 128],
- "oldlace": [253, 245, 230],
- "olive": [128, 128, 0],
- "olivedrab": [107, 142, 35],
- "orange": [255, 165, 0],
- "orangered": [255, 69, 0],
- "orchid": [218, 112, 214],
- "palegoldenrod": [238, 232, 170],
- "palegreen": [152, 251, 152],
- "paleturquoise": [175, 238, 238],
- "palevioletred": [219, 112, 147],
- "papayawhip": [255, 239, 213],
- "peachpuff": [255, 218, 185],
- "peru": [205, 133, 63],
- "pink": [255, 192, 203],
- "plum": [221, 160, 221],
- "powderblue": [176, 224, 230],
- "purple": [128, 0, 128],
- "rebeccapurple": [102, 51, 153],
- "red": [255, 0, 0],
- "rosybrown": [188, 143, 143],
- "royalblue": [65, 105, 225],
- "saddlebrown": [139, 69, 19],
- "salmon": [250, 128, 114],
- "sandybrown": [244, 164, 96],
- "seagreen": [46, 139, 87],
- "seashell": [255, 245, 238],
- "sienna": [160, 82, 45],
- "silver": [192, 192, 192],
- "skyblue": [135, 206, 235],
- "slateblue": [106, 90, 205],
- "slategray": [112, 128, 144],
- "slategrey": [112, 128, 144],
- "snow": [255, 250, 250],
- "springgreen": [0, 255, 127],
- "steelblue": [70, 130, 180],
- "tan": [210, 180, 140],
- "teal": [0, 128, 128],
- "thistle": [216, 191, 216],
- "tomato": [255, 99, 71],
- "turquoise": [64, 224, 208],
- "violet": [238, 130, 238],
- "wheat": [245, 222, 179],
- "white": [255, 255, 255],
- "whitesmoke": [245, 245, 245],
- "yellow": [255, 255, 0],
- "yellowgreen": [154, 205, 50]
- };
-
- /* MIT license */
-
- /* eslint-disable no-mixed-operators */
- // NOTE: conversions should only return primitive values (i.e. arrays, or
- // values that give correct `typeof` results).
- // do not use box values types (i.e. Number(), String(), etc.)
-
- const reverseKeywords = {};
-
- for (const key of Object.keys(colorName$1)) {
- reverseKeywords[colorName$1[key]] = key;
- }
-
- const convert$1 = {
- rgb: {
- channels: 3,
- labels: 'rgb'
- },
- hsl: {
- channels: 3,
- labels: 'hsl'
- },
- hsv: {
- channels: 3,
- labels: 'hsv'
- },
- hwb: {
- channels: 3,
- labels: 'hwb'
- },
- cmyk: {
- channels: 4,
- labels: 'cmyk'
- },
- xyz: {
- channels: 3,
- labels: 'xyz'
- },
- lab: {
- channels: 3,
- labels: 'lab'
- },
- lch: {
- channels: 3,
- labels: 'lch'
- },
- hex: {
- channels: 1,
- labels: ['hex']
- },
- keyword: {
- channels: 1,
- labels: ['keyword']
- },
- ansi16: {
- channels: 1,
- labels: ['ansi16']
- },
- ansi256: {
- channels: 1,
- labels: ['ansi256']
- },
- hcg: {
- channels: 3,
- labels: ['h', 'c', 'g']
- },
- apple: {
- channels: 3,
- labels: ['r16', 'g16', 'b16']
- },
- gray: {
- channels: 1,
- labels: ['gray']
- }
- };
- var conversions$1 = convert$1; // Hide .channels and .labels properties
-
- for (const model of Object.keys(convert$1)) {
- if (!('channels' in convert$1[model])) {
- throw new Error('missing channels property: ' + model);
- }
-
- if (!('labels' in convert$1[model])) {
- throw new Error('missing channel labels property: ' + model);
- }
-
- if (convert$1[model].labels.length !== convert$1[model].channels) {
- throw new Error('channel and label counts mismatch: ' + model);
- }
-
- const {
- channels,
- labels
- } = convert$1[model];
- delete convert$1[model].channels;
- delete convert$1[model].labels;
- Object.defineProperty(convert$1[model], 'channels', {
- value: channels
- });
- Object.defineProperty(convert$1[model], 'labels', {
- value: labels
- });
- }
-
- convert$1.rgb.hsl = function (rgb) {
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
- const min = Math.min(r, g, b);
- const max = Math.max(r, g, b);
- const delta = max - min;
- let h;
- let s;
-
- if (max === min) {
- h = 0;
- } else if (r === max) {
- h = (g - b) / delta;
- } else if (g === max) {
- h = 2 + (b - r) / delta;
- } else if (b === max) {
- h = 4 + (r - g) / delta;
- }
-
- h = Math.min(h * 60, 360);
-
- if (h < 0) {
- h += 360;
- }
-
- const l = (min + max) / 2;
-
- if (max === min) {
- s = 0;
- } else if (l <= 0.5) {
- s = delta / (max + min);
- } else {
- s = delta / (2 - max - min);
- }
-
- return [h, s * 100, l * 100];
- };
-
- convert$1.rgb.hsv = function (rgb) {
- let rdif;
- let gdif;
- let bdif;
- let h;
- let s;
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
- const v = Math.max(r, g, b);
- const diff = v - Math.min(r, g, b);
-
- const diffc = function diffc(c) {
- return (v - c) / 6 / diff + 1 / 2;
- };
-
- if (diff === 0) {
- h = 0;
- s = 0;
- } else {
- s = diff / v;
- rdif = diffc(r);
- gdif = diffc(g);
- bdif = diffc(b);
-
- if (r === v) {
- h = bdif - gdif;
- } else if (g === v) {
- h = 1 / 3 + rdif - bdif;
- } else if (b === v) {
- h = 2 / 3 + gdif - rdif;
- }
-
- if (h < 0) {
- h += 1;
- } else if (h > 1) {
- h -= 1;
- }
- }
-
- return [h * 360, s * 100, v * 100];
- };
-
- convert$1.rgb.hwb = function (rgb) {
- const r = rgb[0];
- const g = rgb[1];
- let b = rgb[2];
- const h = convert$1.rgb.hsl(rgb)[0];
- const w = 1 / 255 * Math.min(r, Math.min(g, b));
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
- return [h, w * 100, b * 100];
- };
-
- convert$1.rgb.cmyk = function (rgb) {
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
- const k = Math.min(1 - r, 1 - g, 1 - b);
- const c = (1 - r - k) / (1 - k) || 0;
- const m = (1 - g - k) / (1 - k) || 0;
- const y = (1 - b - k) / (1 - k) || 0;
- return [c * 100, m * 100, y * 100, k * 100];
- };
-
- function comparativeDistance(x, y) {
- /*
- See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
- */
- return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
- }
-
- convert$1.rgb.keyword = function (rgb) {
- const reversed = reverseKeywords[rgb];
-
- if (reversed) {
- return reversed;
- }
-
- let currentClosestDistance = Infinity;
- let currentClosestKeyword;
-
- for (const keyword of Object.keys(colorName$1)) {
- const value = colorName$1[keyword]; // Compute comparative distance
-
- const distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
-
- if (distance < currentClosestDistance) {
- currentClosestDistance = distance;
- currentClosestKeyword = keyword;
- }
- }
-
- return currentClosestKeyword;
- };
-
- convert$1.keyword.rgb = function (keyword) {
- return colorName$1[keyword];
- };
-
- convert$1.rgb.xyz = function (rgb) {
- let r = rgb[0] / 255;
- let g = rgb[1] / 255;
- let b = rgb[2] / 255; // Assume sRGB
-
- r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
- g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
- b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
- const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
- const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
- const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
- return [x * 100, y * 100, z * 100];
- };
-
- convert$1.rgb.lab = function (rgb) {
- const xyz = convert$1.rgb.xyz(rgb);
- let x = xyz[0];
- let y = xyz[1];
- let z = xyz[2];
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
- y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
- z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
- const l = 116 * y - 16;
- const a = 500 * (x - y);
- const b = 200 * (y - z);
- return [l, a, b];
- };
-
- convert$1.hsl.rgb = function (hsl) {
- const h = hsl[0] / 360;
- const s = hsl[1] / 100;
- const l = hsl[2] / 100;
- let t2;
- let t3;
- let val;
-
- if (s === 0) {
- val = l * 255;
- return [val, val, val];
- }
-
- if (l < 0.5) {
- t2 = l * (1 + s);
- } else {
- t2 = l + s - l * s;
- }
-
- const t1 = 2 * l - t2;
- const rgb = [0, 0, 0];
-
- for (let i = 0; i < 3; i++) {
- t3 = h + 1 / 3 * -(i - 1);
-
- if (t3 < 0) {
- t3++;
- }
-
- if (t3 > 1) {
- t3--;
- }
-
- if (6 * t3 < 1) {
- val = t1 + (t2 - t1) * 6 * t3;
- } else if (2 * t3 < 1) {
- val = t2;
- } else if (3 * t3 < 2) {
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
- } else {
- val = t1;
- }
-
- rgb[i] = val * 255;
- }
-
- return rgb;
- };
-
- convert$1.hsl.hsv = function (hsl) {
- const h = hsl[0];
- let s = hsl[1] / 100;
- let l = hsl[2] / 100;
- let smin = s;
- const lmin = Math.max(l, 0.01);
- l *= 2;
- s *= l <= 1 ? l : 2 - l;
- smin *= lmin <= 1 ? lmin : 2 - lmin;
- const v = (l + s) / 2;
- const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
- return [h, sv * 100, v * 100];
- };
-
- convert$1.hsv.rgb = function (hsv) {
- const h = hsv[0] / 60;
- const s = hsv[1] / 100;
- let v = hsv[2] / 100;
- const hi = Math.floor(h) % 6;
- const f = h - Math.floor(h);
- const p = 255 * v * (1 - s);
- const q = 255 * v * (1 - s * f);
- const t = 255 * v * (1 - s * (1 - f));
- v *= 255;
-
- switch (hi) {
- case 0:
- return [v, t, p];
-
- case 1:
- return [q, v, p];
-
- case 2:
- return [p, v, t];
-
- case 3:
- return [p, q, v];
-
- case 4:
- return [t, p, v];
-
- case 5:
- return [v, p, q];
- }
- };
-
- convert$1.hsv.hsl = function (hsv) {
- const h = hsv[0];
- const s = hsv[1] / 100;
- const v = hsv[2] / 100;
- const vmin = Math.max(v, 0.01);
- let sl;
- let l;
- l = (2 - s) * v;
- const lmin = (2 - s) * vmin;
- sl = s * vmin;
- sl /= lmin <= 1 ? lmin : 2 - lmin;
- sl = sl || 0;
- l /= 2;
- return [h, sl * 100, l * 100];
- }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
-
-
- convert$1.hwb.rgb = function (hwb) {
- const h = hwb[0] / 360;
- let wh = hwb[1] / 100;
- let bl = hwb[2] / 100;
- const ratio = wh + bl;
- let f; // Wh + bl cant be > 1
-
- if (ratio > 1) {
- wh /= ratio;
- bl /= ratio;
- }
-
- const i = Math.floor(6 * h);
- const v = 1 - bl;
- f = 6 * h - i;
-
- if ((i & 0x01) !== 0) {
- f = 1 - f;
- }
-
- const n = wh + f * (v - wh); // Linear interpolation
-
- let r;
- let g;
- let b;
- /* eslint-disable max-statements-per-line,no-multi-spaces */
-
- switch (i) {
- default:
- case 6:
- case 0:
- r = v;
- g = n;
- b = wh;
- break;
-
- case 1:
- r = n;
- g = v;
- b = wh;
- break;
-
- case 2:
- r = wh;
- g = v;
- b = n;
- break;
-
- case 3:
- r = wh;
- g = n;
- b = v;
- break;
-
- case 4:
- r = n;
- g = wh;
- b = v;
- break;
-
- case 5:
- r = v;
- g = wh;
- b = n;
- break;
- }
- /* eslint-enable max-statements-per-line,no-multi-spaces */
-
-
- return [r * 255, g * 255, b * 255];
- };
-
- convert$1.cmyk.rgb = function (cmyk) {
- const c = cmyk[0] / 100;
- const m = cmyk[1] / 100;
- const y = cmyk[2] / 100;
- const k = cmyk[3] / 100;
- const r = 1 - Math.min(1, c * (1 - k) + k);
- const g = 1 - Math.min(1, m * (1 - k) + k);
- const b = 1 - Math.min(1, y * (1 - k) + k);
- return [r * 255, g * 255, b * 255];
- };
-
- convert$1.xyz.rgb = function (xyz) {
- const x = xyz[0] / 100;
- const y = xyz[1] / 100;
- const z = xyz[2] / 100;
- let r;
- let g;
- let b;
- r = x * 3.2406 + y * -1.5372 + z * -0.4986;
- g = x * -0.9689 + y * 1.8758 + z * 0.0415;
- b = x * 0.0557 + y * -0.2040 + z * 1.0570; // Assume sRGB
-
- r = r > 0.0031308 ? 1.055 * r ** (1.0 / 2.4) - 0.055 : r * 12.92;
- g = g > 0.0031308 ? 1.055 * g ** (1.0 / 2.4) - 0.055 : g * 12.92;
- b = b > 0.0031308 ? 1.055 * b ** (1.0 / 2.4) - 0.055 : b * 12.92;
- r = Math.min(Math.max(0, r), 1);
- g = Math.min(Math.max(0, g), 1);
- b = Math.min(Math.max(0, b), 1);
- return [r * 255, g * 255, b * 255];
- };
-
- convert$1.xyz.lab = function (xyz) {
- let x = xyz[0];
- let y = xyz[1];
- let z = xyz[2];
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
- y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
- z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
- const l = 116 * y - 16;
- const a = 500 * (x - y);
- const b = 200 * (y - z);
- return [l, a, b];
- };
-
- convert$1.lab.xyz = function (lab) {
- const l = lab[0];
- const a = lab[1];
- const b = lab[2];
- let x;
- let y;
- let z;
- y = (l + 16) / 116;
- x = a / 500 + y;
- z = y - b / 200;
- const y2 = y ** 3;
- const x2 = x ** 3;
- const z2 = z ** 3;
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
- x *= 95.047;
- y *= 100;
- z *= 108.883;
- return [x, y, z];
- };
-
- convert$1.lab.lch = function (lab) {
- const l = lab[0];
- const a = lab[1];
- const b = lab[2];
- let h;
- const hr = Math.atan2(b, a);
- h = hr * 360 / 2 / Math.PI;
-
- if (h < 0) {
- h += 360;
- }
-
- const c = Math.sqrt(a * a + b * b);
- return [l, c, h];
- };
-
- convert$1.lch.lab = function (lch) {
- const l = lch[0];
- const c = lch[1];
- const h = lch[2];
- const hr = h / 360 * 2 * Math.PI;
- const a = c * Math.cos(hr);
- const b = c * Math.sin(hr);
- return [l, a, b];
- };
-
- convert$1.rgb.ansi16 = function (args, saturation = null) {
- const [r, g, b] = args;
- let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
-
- value = Math.round(value / 50);
-
- if (value === 0) {
- return 30;
- }
-
- let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
-
- if (value === 2) {
- ansi += 60;
- }
-
- return ansi;
- };
-
- convert$1.hsv.ansi16 = function (args) {
- // Optimization here; we already know the value and don't need to get
- // it converted for us.
- return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
- };
-
- convert$1.rgb.ansi256 = function (args) {
- const r = args[0];
- const g = args[1];
- const b = args[2]; // We use the extended greyscale palette here, with the exception of
- // black and white. normal palette only has 4 greyscale shades.
-
- if (r === g && g === b) {
- if (r < 8) {
- return 16;
- }
-
- if (r > 248) {
- return 231;
- }
-
- return Math.round((r - 8) / 247 * 24) + 232;
- }
-
- const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
- return ansi;
- };
-
- convert$1.ansi16.rgb = function (args) {
- let color = args % 10; // Handle greyscale
-
- if (color === 0 || color === 7) {
- if (args > 50) {
- color += 3.5;
- }
-
- color = color / 10.5 * 255;
- return [color, color, color];
- }
-
- const mult = (~~(args > 50) + 1) * 0.5;
- const r = (color & 1) * mult * 255;
- const g = (color >> 1 & 1) * mult * 255;
- const b = (color >> 2 & 1) * mult * 255;
- return [r, g, b];
- };
-
- convert$1.ansi256.rgb = function (args) {
- // Handle greyscale
- if (args >= 232) {
- const c = (args - 232) * 10 + 8;
- return [c, c, c];
- }
-
- args -= 16;
- let rem;
- const r = Math.floor(args / 36) / 5 * 255;
- const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
- const b = rem % 6 / 5 * 255;
- return [r, g, b];
- };
-
- convert$1.rgb.hex = function (args) {
- const integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
- const string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
-
- convert$1.hex.rgb = function (args) {
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
-
- if (!match) {
- return [0, 0, 0];
- }
-
- let colorString = match[0];
-
- if (match[0].length === 3) {
- colorString = colorString.split('').map(char => {
- return char + char;
- }).join('');
- }
-
- const integer = parseInt(colorString, 16);
- const r = integer >> 16 & 0xFF;
- const g = integer >> 8 & 0xFF;
- const b = integer & 0xFF;
- return [r, g, b];
- };
-
- convert$1.rgb.hcg = function (rgb) {
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
- const max = Math.max(Math.max(r, g), b);
- const min = Math.min(Math.min(r, g), b);
- const chroma = max - min;
- let grayscale;
- let hue;
-
- if (chroma < 1) {
- grayscale = min / (1 - chroma);
- } else {
- grayscale = 0;
- }
-
- if (chroma <= 0) {
- hue = 0;
- } else if (max === r) {
- hue = (g - b) / chroma % 6;
- } else if (max === g) {
- hue = 2 + (b - r) / chroma;
- } else {
- hue = 4 + (r - g) / chroma;
- }
-
- hue /= 6;
- hue %= 1;
- return [hue * 360, chroma * 100, grayscale * 100];
- };
-
- convert$1.hsl.hcg = function (hsl) {
- const s = hsl[1] / 100;
- const l = hsl[2] / 100;
- const c = l < 0.5 ? 2.0 * s * l : 2.0 * s * (1.0 - l);
- let f = 0;
-
- if (c < 1.0) {
- f = (l - 0.5 * c) / (1.0 - c);
- }
-
- return [hsl[0], c * 100, f * 100];
- };
-
- convert$1.hsv.hcg = function (hsv) {
- const s = hsv[1] / 100;
- const v = hsv[2] / 100;
- const c = s * v;
- let f = 0;
-
- if (c < 1.0) {
- f = (v - c) / (1 - c);
- }
-
- return [hsv[0], c * 100, f * 100];
- };
-
- convert$1.hcg.rgb = function (hcg) {
- const h = hcg[0] / 360;
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
-
- if (c === 0.0) {
- return [g * 255, g * 255, g * 255];
- }
-
- const pure = [0, 0, 0];
- const hi = h % 1 * 6;
- const v = hi % 1;
- const w = 1 - v;
- let mg = 0;
- /* eslint-disable max-statements-per-line */
-
- switch (Math.floor(hi)) {
- case 0:
- pure[0] = 1;
- pure[1] = v;
- pure[2] = 0;
- break;
-
- case 1:
- pure[0] = w;
- pure[1] = 1;
- pure[2] = 0;
- break;
-
- case 2:
- pure[0] = 0;
- pure[1] = 1;
- pure[2] = v;
- break;
-
- case 3:
- pure[0] = 0;
- pure[1] = w;
- pure[2] = 1;
- break;
-
- case 4:
- pure[0] = v;
- pure[1] = 0;
- pure[2] = 1;
- break;
-
- default:
- pure[0] = 1;
- pure[1] = 0;
- pure[2] = w;
- }
- /* eslint-enable max-statements-per-line */
-
-
- mg = (1.0 - c) * g;
- return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
- };
-
- convert$1.hcg.hsv = function (hcg) {
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
- const v = c + g * (1.0 - c);
- let f = 0;
-
- if (v > 0.0) {
- f = c / v;
- }
-
- return [hcg[0], f * 100, v * 100];
- };
-
- convert$1.hcg.hsl = function (hcg) {
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
- const l = g * (1.0 - c) + 0.5 * c;
- let s = 0;
-
- if (l > 0.0 && l < 0.5) {
- s = c / (2 * l);
- } else if (l >= 0.5 && l < 1.0) {
- s = c / (2 * (1 - l));
- }
-
- return [hcg[0], s * 100, l * 100];
- };
-
- convert$1.hcg.hwb = function (hcg) {
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
- const v = c + g * (1.0 - c);
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
- };
-
- convert$1.hwb.hcg = function (hwb) {
- const w = hwb[1] / 100;
- const b = hwb[2] / 100;
- const v = 1 - b;
- const c = v - w;
- let g = 0;
-
- if (c < 1) {
- g = (v - c) / (1 - c);
- }
-
- return [hwb[0], c * 100, g * 100];
- };
-
- convert$1.apple.rgb = function (apple) {
- return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
- };
-
- convert$1.rgb.apple = function (rgb) {
- return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
- };
-
- convert$1.gray.rgb = function (args) {
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
- };
-
- convert$1.gray.hsl = function (args) {
- return [0, 0, args[0]];
- };
-
- convert$1.gray.hsv = convert$1.gray.hsl;
-
- convert$1.gray.hwb = function (gray) {
- return [0, 100, gray[0]];
- };
-
- convert$1.gray.cmyk = function (gray) {
- return [0, 0, 0, gray[0]];
- };
-
- convert$1.gray.lab = function (gray) {
- return [gray[0], 0, 0];
- };
-
- convert$1.gray.hex = function (gray) {
- const val = Math.round(gray[0] / 100 * 255) & 0xFF;
- const integer = (val << 16) + (val << 8) + val;
- const string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
-
- convert$1.rgb.gray = function (rgb) {
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
- return [val / 255 * 100];
- };
-
- /*
- This function routes a model to all other models.
-
- all functions that are routed have a property `.conversion` attached
- to the returned synthetic function. This property is an array
- of strings, each with the steps in between the 'from' and 'to'
- color models (inclusive).
-
- conversions that are not possible simply are not included.
- */
-
- function buildGraph$1() {
- const graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
-
- const models = Object.keys(conversions$1);
-
- for (let len = models.length, i = 0; i < len; i++) {
- graph[models[i]] = {
- // http://jsperf.com/1-vs-infinity
- // micro-opt, but this is simple.
- distance: -1,
- parent: null
- };
- }
-
- return graph;
- } // https://en.wikipedia.org/wiki/Breadth-first_search
-
-
- function deriveBFS$1(fromModel) {
- const graph = buildGraph$1();
- const queue = [fromModel]; // Unshift -> queue -> pop
-
- graph[fromModel].distance = 0;
-
- while (queue.length) {
- const current = queue.pop();
- const adjacents = Object.keys(conversions$1[current]);
-
- for (let len = adjacents.length, i = 0; i < len; i++) {
- const adjacent = adjacents[i];
- const node = graph[adjacent];
-
- if (node.distance === -1) {
- node.distance = graph[current].distance + 1;
- node.parent = current;
- queue.unshift(adjacent);
- }
- }
- }
-
- return graph;
- }
-
- function link$1(from, to) {
- return function (args) {
- return to(from(args));
- };
- }
-
- function wrapConversion$1(toModel, graph) {
- const path = [graph[toModel].parent, toModel];
- let fn = conversions$1[graph[toModel].parent][toModel];
- let cur = graph[toModel].parent;
-
- while (graph[cur].parent) {
- path.unshift(graph[cur].parent);
- fn = link$1(conversions$1[graph[cur].parent][cur], fn);
- cur = graph[cur].parent;
- }
-
- fn.conversion = path;
- return fn;
- }
-
- var route$1 = function route(fromModel) {
- const graph = deriveBFS$1(fromModel);
- const conversion = {};
- const models = Object.keys(graph);
-
- for (let len = models.length, i = 0; i < len; i++) {
- const toModel = models[i];
- const node = graph[toModel];
-
- if (node.parent === null) {
- // No possible conversion, or this node is the source model.
- continue;
- }
-
- conversion[toModel] = wrapConversion$1(toModel, graph);
- }
-
- return conversion;
- };
-
- const convert$2 = {};
- const models$1 = Object.keys(conversions$1);
-
- function wrapRaw$1(fn) {
- const wrappedFn = function wrappedFn(...args) {
- const arg0 = args[0];
-
- if (arg0 === undefined || arg0 === null) {
- return arg0;
- }
-
- if (arg0.length > 1) {
- args = arg0;
- }
-
- return fn(args);
- }; // Preserve .conversion property if there is one
-
-
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
-
- return wrappedFn;
- }
-
- function wrapRounded$1(fn) {
- const wrappedFn = function wrappedFn(...args) {
- const arg0 = args[0];
-
- if (arg0 === undefined || arg0 === null) {
- return arg0;
- }
-
- if (arg0.length > 1) {
- args = arg0;
- }
-
- const result = fn(args); // We're assuming the result is an array here.
- // see notice in conversions.js; don't use box types
- // in conversion functions.
-
- if (typeof result === 'object') {
- for (let len = result.length, i = 0; i < len; i++) {
- result[i] = Math.round(result[i]);
- }
- }
-
- return result;
- }; // Preserve .conversion property if there is one
-
-
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
-
- return wrappedFn;
- }
-
- models$1.forEach(fromModel => {
- convert$2[fromModel] = {};
- Object.defineProperty(convert$2[fromModel], 'channels', {
- value: conversions$1[fromModel].channels
- });
- Object.defineProperty(convert$2[fromModel], 'labels', {
- value: conversions$1[fromModel].labels
- });
- const routes = route$1(fromModel);
- const routeModels = Object.keys(routes);
- routeModels.forEach(toModel => {
- const fn = routes[toModel];
- convert$2[fromModel][toModel] = wrapRounded$1(fn);
- convert$2[fromModel][toModel].raw = wrapRaw$1(fn);
- });
- });
- var colorConvert$1 = convert$2;
-
- var ansiStyles$1 = createCommonjsModule(function (module) {
-
- const wrapAnsi16 = (fn, offset) => (...args) => {
- const code = fn(...args);
- return "\x1B[".concat(code + offset, "m");
- };
-
- const wrapAnsi256 = (fn, offset) => (...args) => {
- const code = fn(...args);
- return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
- };
-
- const wrapAnsi16m = (fn, offset) => (...args) => {
- const rgb = fn(...args);
- return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
- };
-
- const ansi2ansi = n => n;
-
- const rgb2rgb = (r, g, b) => [r, g, b];
-
- const setLazyProperty = (object, property, _get) => {
- Object.defineProperty(object, property, {
- get: () => {
- const value = _get();
-
- Object.defineProperty(object, property, {
- value,
- enumerable: true,
- configurable: true
- });
- return value;
- },
- enumerable: true,
- configurable: true
- });
- };
- /** @type {typeof import('color-convert')} */
-
-
- let colorConvert;
-
- const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
- if (colorConvert === undefined) {
- colorConvert = colorConvert$1;
- }
-
- const offset = isBackground ? 10 : 0;
- const styles = {};
-
- for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
- const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
-
- if (sourceSpace === targetSpace) {
- styles[name] = wrap(identity, offset);
- } else if (typeof suite === 'object') {
- styles[name] = wrap(suite[targetSpace], offset);
- }
- }
-
- return styles;
- };
-
- function assembleStyles() {
- const codes = new Map();
- const styles = {
- modifier: {
- reset: [0, 0],
- // 21 isn't widely supported and 22 does the same thing
- bold: [1, 22],
- dim: [2, 22],
- italic: [3, 23],
- underline: [4, 24],
- inverse: [7, 27],
- hidden: [8, 28],
- strikethrough: [9, 29]
- },
- color: {
- black: [30, 39],
- red: [31, 39],
- green: [32, 39],
- yellow: [33, 39],
- blue: [34, 39],
- magenta: [35, 39],
- cyan: [36, 39],
- white: [37, 39],
- // Bright color
- blackBright: [90, 39],
- redBright: [91, 39],
- greenBright: [92, 39],
- yellowBright: [93, 39],
- blueBright: [94, 39],
- magentaBright: [95, 39],
- cyanBright: [96, 39],
- whiteBright: [97, 39]
- },
- bgColor: {
- bgBlack: [40, 49],
- bgRed: [41, 49],
- bgGreen: [42, 49],
- bgYellow: [43, 49],
- bgBlue: [44, 49],
- bgMagenta: [45, 49],
- bgCyan: [46, 49],
- bgWhite: [47, 49],
- // Bright color
- bgBlackBright: [100, 49],
- bgRedBright: [101, 49],
- bgGreenBright: [102, 49],
- bgYellowBright: [103, 49],
- bgBlueBright: [104, 49],
- bgMagentaBright: [105, 49],
- bgCyanBright: [106, 49],
- bgWhiteBright: [107, 49]
- }
- }; // Alias bright black as gray (and grey)
-
- styles.color.gray = styles.color.blackBright;
- styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
- styles.color.grey = styles.color.blackBright;
- styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
-
- for (const [groupName, group] of Object.entries(styles)) {
- for (const [styleName, style] of Object.entries(group)) {
- styles[styleName] = {
- open: "\x1B[".concat(style[0], "m"),
- close: "\x1B[".concat(style[1], "m")
- };
- group[styleName] = styles[styleName];
- codes.set(style[0], style[1]);
- }
-
- Object.defineProperty(styles, groupName, {
- value: group,
- enumerable: false
- });
- }
-
- Object.defineProperty(styles, 'codes', {
- value: codes,
- enumerable: false
- });
- styles.color.close = '\u001B[39m';
- styles.bgColor.close = '\u001B[49m';
- setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
- setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
- setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
- setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
- setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
- setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
- return styles;
- } // Make the export immutable
-
-
- Object.defineProperty(module, 'exports', {
- enumerable: true,
- get: assembleStyles
- });
- });
-
- var tty = {
- isatty() {
- return false;
- }
-
- };
-
- var hasFlag$1 = (flag, argv = process.argv) => {
- const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
- const position = argv.indexOf(prefix + flag);
- const terminatorPosition = argv.indexOf('--');
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
- };
-
- const {
- env: env$2
- } = process;
- let forceColor$1;
-
- if (hasFlag$1('no-color') || hasFlag$1('no-colors') || hasFlag$1('color=false') || hasFlag$1('color=never')) {
- forceColor$1 = 0;
- } else if (hasFlag$1('color') || hasFlag$1('colors') || hasFlag$1('color=true') || hasFlag$1('color=always')) {
- forceColor$1 = 1;
- }
-
- if ('FORCE_COLOR' in env$2) {
- if (env$2.FORCE_COLOR === 'true') {
- forceColor$1 = 1;
- } else if (env$2.FORCE_COLOR === 'false') {
- forceColor$1 = 0;
- } else {
- forceColor$1 = env$2.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env$2.FORCE_COLOR, 10), 3);
- }
- }
-
- function translateLevel$1(level) {
- if (level === 0) {
- return false;
- }
-
- return {
- level,
- hasBasic: true,
- has256: level >= 2,
- has16m: level >= 3
- };
- }
-
- function supportsColor$1(haveStream, streamIsTTY) {
- if (forceColor$1 === 0) {
- return 0;
- }
-
- if (hasFlag$1('color=16m') || hasFlag$1('color=full') || hasFlag$1('color=truecolor')) {
- return 3;
- }
-
- if (hasFlag$1('color=256')) {
- return 2;
- }
-
- if (haveStream && !streamIsTTY && forceColor$1 === undefined) {
- return 0;
- }
-
- const min = forceColor$1 || 0;
-
- if (env$2.TERM === 'dumb') {
- return min;
- }
-
- if (process.platform === 'win32') {
- // Windows 10 build 10586 is the first Windows release that supports 256 colors.
- // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
- const osRelease = require$$0$1.release().split('.');
-
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
- }
-
- return 1;
- }
-
- if ('CI' in env$2) {
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$2) || env$2.CI_NAME === 'codeship') {
- return 1;
- }
-
- return min;
- }
-
- if ('TEAMCITY_VERSION' in env$2) {
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$2.TEAMCITY_VERSION) ? 1 : 0;
- }
-
- if ('GITHUB_ACTIONS' in env$2) {
- return 1;
- }
-
- if (env$2.COLORTERM === 'truecolor') {
- return 3;
- }
-
- if ('TERM_PROGRAM' in env$2) {
- const version = parseInt((env$2.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
-
- switch (env$2.TERM_PROGRAM) {
- case 'iTerm.app':
- return version >= 3 ? 3 : 2;
-
- case 'Apple_Terminal':
- return 2;
- // No default
- }
- }
-
- if (/-256(color)?$/i.test(env$2.TERM)) {
- return 2;
- }
-
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$2.TERM)) {
- return 1;
- }
-
- if ('COLORTERM' in env$2) {
- return 1;
- }
-
- return min;
- }
-
- function getSupportLevel$1(stream) {
- const level = supportsColor$1(stream, stream && stream.isTTY);
- return translateLevel$1(level);
- }
-
- var supportsColor_1$1 = {
- supportsColor: getSupportLevel$1,
- stdout: translateLevel$1(supportsColor$1(true, tty.isatty(1))),
- stderr: translateLevel$1(supportsColor$1(true, tty.isatty(2)))
- };
-
- const stringReplaceAll = (string, substring, replacer) => {
- let index = string.indexOf(substring);
-
- if (index === -1) {
- return string;
- }
-
- const substringLength = substring.length;
- let endIndex = 0;
- let returnValue = '';
-
- do {
- returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
- endIndex = index + substringLength;
- index = string.indexOf(substring, endIndex);
- } while (index !== -1);
-
- returnValue += string.substr(endIndex);
- return returnValue;
- };
-
- const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
- let endIndex = 0;
- let returnValue = '';
-
- do {
- const gotCR = string[index - 1] === '\r';
- returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
- endIndex = index + 1;
- index = string.indexOf('\n', endIndex);
- } while (index !== -1);
-
- returnValue += string.substr(endIndex);
- return returnValue;
- };
-
- var util = {
- stringReplaceAll,
- stringEncaseCRLFWithFirstIndex
- };
-
- 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;
- const STYLE_REGEX$1 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
- const STRING_REGEX$1 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
- const ESCAPE_REGEX$1 = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
- const ESCAPES$1 = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
-
- function unescape$1(c) {
- const u = c[0] === 'u';
- const bracket = c[1] === '{';
-
- if (u && !bracket && c.length === 5 || c[0] === 'x' && c.length === 3) {
- return String.fromCharCode(parseInt(c.slice(1), 16));
- }
-
- if (u && bracket) {
- return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
- }
-
- return ESCAPES$1.get(c) || c;
- }
-
- function parseArguments$1(name, arguments_) {
- const results = [];
- const chunks = arguments_.trim().split(/\s*,\s*/g);
- let matches;
-
- for (const chunk of chunks) {
- const number = Number(chunk);
-
- if (!Number.isNaN(number)) {
- results.push(number);
- } else if (matches = chunk.match(STRING_REGEX$1)) {
- results.push(matches[2].replace(ESCAPE_REGEX$1, (m, escape, character) => escape ? unescape$1(escape) : character));
- } else {
- throw new Error("Invalid Chalk template style argument: ".concat(chunk, " (in style '").concat(name, "')"));
- }
- }
-
- return results;
- }
-
- function parseStyle$1(style) {
- STYLE_REGEX$1.lastIndex = 0;
- const results = [];
- let matches;
-
- while ((matches = STYLE_REGEX$1.exec(style)) !== null) {
- const name = matches[1];
-
- if (matches[2]) {
- const args = parseArguments$1(name, matches[2]);
- results.push([name].concat(args));
- } else {
- results.push([name]);
- }
- }
-
- return results;
- }
-
- function buildStyle$1(chalk, styles) {
- const enabled = {};
-
- for (const layer of styles) {
- for (const style of layer.styles) {
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
- }
- }
-
- let current = chalk;
-
- for (const [styleName, styles] of Object.entries(enabled)) {
- if (!Array.isArray(styles)) {
- continue;
- }
-
- if (!(styleName in current)) {
- throw new Error("Unknown Chalk style: ".concat(styleName));
- }
-
- current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
- }
-
- return current;
- }
-
- var templates$1 = (chalk, temporary) => {
- const styles = [];
- const chunks = [];
- let chunk = []; // eslint-disable-next-line max-params
-
- temporary.replace(TEMPLATE_REGEX$1, (m, escapeCharacter, inverse, style, close, character) => {
- if (escapeCharacter) {
- chunk.push(unescape$1(escapeCharacter));
- } else if (style) {
- const string = chunk.join('');
- chunk = [];
- chunks.push(styles.length === 0 ? string : buildStyle$1(chalk, styles)(string));
- styles.push({
- inverse,
- styles: parseStyle$1(style)
- });
- } else if (close) {
- if (styles.length === 0) {
- throw new Error('Found extraneous } in Chalk template literal');
- }
-
- chunks.push(buildStyle$1(chalk, styles)(chunk.join('')));
- chunk = [];
- styles.pop();
- } else {
- chunk.push(character);
- }
- });
- chunks.push(chunk.join(''));
-
- if (styles.length > 0) {
- const errMessage = "Chalk template literal is missing ".concat(styles.length, " closing bracket").concat(styles.length === 1 ? '' : 's', " (`}`)");
- throw new Error(errMessage);
- }
-
- return chunks.join('');
- };
-
- const {
- stdout: stdoutColor,
- stderr: stderrColor
- } = supportsColor_1$1;
- const {
- stringReplaceAll: stringReplaceAll$1,
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
- } = util; // `supportsColor.level` → `ansiStyles.color[name]` mapping
-
- const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
- const styles = Object.create(null);
-
- const applyOptions = (object, options = {}) => {
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
- throw new Error('The `level` option should be an integer from 0 to 3');
- } // Detect level if not set manually
-
-
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
- object.level = options.level === undefined ? colorLevel : options.level;
- };
-
- class ChalkClass {
- constructor(options) {
- // eslint-disable-next-line no-constructor-return
- return chalkFactory(options);
- }
-
- }
-
- const chalkFactory = options => {
- const chalk = {};
- applyOptions(chalk, options);
-
- chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
-
- Object.setPrototypeOf(chalk, Chalk.prototype);
- Object.setPrototypeOf(chalk.template, chalk);
-
- chalk.template.constructor = () => {
- throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
- };
-
- chalk.template.Instance = ChalkClass;
- return chalk.template;
- };
-
- function Chalk(options) {
- return chalkFactory(options);
- }
-
- for (const [styleName, style] of Object.entries(ansiStyles$1)) {
- styles[styleName] = {
- get() {
- const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
- Object.defineProperty(this, styleName, {
- value: builder
- });
- return builder;
- }
-
- };
- }
-
- styles.visible = {
- get() {
- const builder = createBuilder(this, this._styler, true);
- Object.defineProperty(this, 'visible', {
- value: builder
- });
- return builder;
- }
-
- };
- const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
-
- for (const model of usedModels) {
- styles[model] = {
- get() {
- const {
- level
- } = this;
- return function (...arguments_) {
- const styler = createStyler(ansiStyles$1.color[levelMapping[level]][model](...arguments_), ansiStyles$1.color.close, this._styler);
- return createBuilder(this, styler, this._isEmpty);
- };
- }
-
- };
- }
-
- for (const model of usedModels) {
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
- styles[bgModel] = {
- get() {
- const {
- level
- } = this;
- return function (...arguments_) {
- const styler = createStyler(ansiStyles$1.bgColor[levelMapping[level]][model](...arguments_), ansiStyles$1.bgColor.close, this._styler);
- return createBuilder(this, styler, this._isEmpty);
- };
- }
-
- };
- }
-
- const proto = Object.defineProperties(() => {}, Object.assign({}, styles, {
- level: {
- enumerable: true,
-
- get() {
- return this._generator.level;
- },
-
- set(level) {
- this._generator.level = level;
- }
-
- }
- }));
-
- const createStyler = (open, close, parent) => {
- let openAll;
- let closeAll;
-
- if (parent === undefined) {
- openAll = open;
- closeAll = close;
- } else {
- openAll = parent.openAll + open;
- closeAll = close + parent.closeAll;
- }
-
- return {
- open,
- close,
- openAll,
- closeAll,
- parent
- };
- };
-
- const createBuilder = (self, _styler, _isEmpty) => {
- const builder = (...arguments_) => {
- // Single argument is hot path, implicit coercion is faster than anything
- // eslint-disable-next-line no-implicit-coercion
- return applyStyle(builder, arguments_.length === 1 ? '' + arguments_[0] : arguments_.join(' '));
- }; // We alter the prototype because we must return a function, but there is
- // no way to create a function with a different prototype
-
-
- Object.setPrototypeOf(builder, proto);
- builder._generator = self;
- builder._styler = _styler;
- builder._isEmpty = _isEmpty;
- return builder;
- };
-
- const applyStyle = (self, string) => {
- if (self.level <= 0 || !string) {
- return self._isEmpty ? '' : string;
- }
-
- let styler = self._styler;
-
- if (styler === undefined) {
- return string;
- }
-
- const {
- openAll,
- closeAll
- } = styler;
-
- if (string.indexOf('\u001B') !== -1) {
- while (styler !== undefined) {
- // Replace any instances already present with a re-opening code
- // otherwise only the part of the string until said closing code
- // will be colored, and the rest will simply be 'plain'.
- string = stringReplaceAll$1(string, styler.close, styler.open);
- styler = styler.parent;
- }
- } // We can move both next actions out of loop, because remaining actions in loop won't have
- // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
- // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
-
-
- const lfIndex = string.indexOf('\n');
-
- if (lfIndex !== -1) {
- string = stringEncaseCRLFWithFirstIndex$1(string, closeAll, openAll, lfIndex);
- }
-
- return openAll + string + closeAll;
- };
-
- let template;
-
- const chalkTag = (chalk, ...strings) => {
- const [firstString] = strings;
-
- if (!Array.isArray(firstString)) {
- // If chalk() was called by itself or with a string,
- // return the string itself as a string.
- return strings.join(' ');
- }
-
- const arguments_ = strings.slice(1);
- const parts = [firstString.raw[0]];
-
- for (let i = 1; i < firstString.length; i++) {
- parts.push(String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), String(firstString.raw[i]));
- }
-
- if (template === undefined) {
- template = templates$1;
- }
-
- return template(chalk, parts.join(''));
- };
-
- Object.defineProperties(Chalk.prototype, styles);
- const chalk$1 = Chalk(); // eslint-disable-line new-cap
-
- chalk$1.supportsColor = stdoutColor;
- chalk$1.stderr = Chalk({
- level: stderrColor ? stderrColor.level : 0
- }); // eslint-disable-line new-cap
-
- chalk$1.stderr.supportsColor = stderrColor;
- var source = chalk$1;
-
- const cliDescriptor = {
- key: _key => _key.length === 1 ? "-".concat(_key) : "--".concat(_key),
- value: _value => lib.apiDescriptor.value(_value),
- pair: ({
- key,
- value
- }) => value === false ? "--no-".concat(key) : value === true ? cliDescriptor.key(key) : value === "" ? "".concat(cliDescriptor.key(key), " without an argument") : "".concat(cliDescriptor.key(key), "=").concat(value)
- };
-
- class FlagSchema extends lib.ChoiceSchema {
- constructor({
- name,
- flags
- }) {
- super({
- name,
- choices: flags
- });
- this._flags = flags.slice().sort();
- }
-
- preprocess(value, utils) {
- if (typeof value === "string" && value.length !== 0 && !this._flags.includes(value)) {
- const suggestion = this._flags.find(flag => leven_1$1(flag, value) < 3);
-
- if (suggestion) {
- utils.logger.warn(["Unknown flag ".concat(source.yellow(utils.descriptor.value(value)), ","), "did you mean ".concat(source.blue(utils.descriptor.value(suggestion)), "?")].join(" "));
- return suggestion;
- }
- }
-
- return value;
- }
-
- expected() {
- return "a flag";
- }
-
- }
-
- let hasDeprecationWarned;
-
- function normalizeOptions(options, optionInfos, {
- logger,
- isCLI = false,
- passThrough = false
- } = {}) {
- const unknown = !passThrough ? lib.levenUnknownHandler : Array.isArray(passThrough) ? (key, value) => !passThrough.includes(key) ? undefined : {
- [key]: value
- } : (key, value) => ({
- [key]: value
- });
- const descriptor = isCLI ? cliDescriptor : lib.apiDescriptor;
- const schemas = optionInfosToSchemas(optionInfos, {
- isCLI
- });
- const normalizer = new lib.Normalizer(schemas, {
- logger,
- unknown,
- descriptor
- });
- const shouldSuppressDuplicateDeprecationWarnings = logger !== false;
-
- if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
- normalizer._hasDeprecationWarned = hasDeprecationWarned;
- }
-
- const normalized = normalizer.normalize(options);
-
- if (shouldSuppressDuplicateDeprecationWarnings) {
- hasDeprecationWarned = normalizer._hasDeprecationWarned;
- }
-
- return normalized;
- }
-
- function optionInfosToSchemas(optionInfos, {
- isCLI
- }) {
- const schemas = [];
-
- if (isCLI) {
- schemas.push(lib.AnySchema.create({
- name: "_"
- }));
- }
-
- for (const optionInfo of optionInfos) {
- schemas.push(optionInfoToSchema(optionInfo, {
- isCLI,
- optionInfos
- }));
-
- if (optionInfo.alias && isCLI) {
- schemas.push(lib.AliasSchema.create({
- name: optionInfo.alias,
- sourceName: optionInfo.name
- }));
- }
- }
-
- return schemas;
- }
-
- function optionInfoToSchema(optionInfo, {
- isCLI,
- optionInfos
- }) {
- let SchemaConstructor;
- const parameters = {
- name: optionInfo.name
- };
- const handlers = {};
-
- switch (optionInfo.type) {
- case "int":
- SchemaConstructor = lib.IntegerSchema;
-
- if (isCLI) {
- parameters.preprocess = value => Number(value);
- }
-
- break;
-
- case "string":
- SchemaConstructor = lib.StringSchema;
- break;
-
- case "choice":
- SchemaConstructor = lib.ChoiceSchema;
- parameters.choices = optionInfo.choices.map(choiceInfo => typeof choiceInfo === "object" && choiceInfo.redirect ? Object.assign({}, choiceInfo, {
- redirect: {
- to: {
- key: optionInfo.name,
- value: choiceInfo.redirect
- }
- }
- }) : choiceInfo);
- break;
-
- case "boolean":
- SchemaConstructor = lib.BooleanSchema;
- break;
-
- case "flag":
- SchemaConstructor = FlagSchema;
- parameters.flags = optionInfos.map(optionInfo => [].concat(optionInfo.alias || [], optionInfo.description ? optionInfo.name : [], optionInfo.oppositeDescription ? "no-".concat(optionInfo.name) : [])).reduce((a, b) => a.concat(b), []);
- break;
-
- case "path":
- SchemaConstructor = lib.StringSchema;
- break;
-
- default:
- throw new Error("Unexpected type ".concat(optionInfo.type));
- }
-
- if (optionInfo.exception) {
- parameters.validate = (value, schema, utils) => {
- return optionInfo.exception(value) || schema.validate(value, utils);
- };
- } else {
- parameters.validate = (value, schema, utils) => {
- return value === undefined || schema.validate(value, utils);
- };
- }
-
- if (optionInfo.redirect) {
- handlers.redirect = value => !value ? undefined : {
- to: {
- key: optionInfo.redirect.option,
- value: optionInfo.redirect.value
- }
- };
- }
-
- if (optionInfo.deprecated) {
- handlers.deprecated = true;
- } // allow CLI overriding, e.g., prettier package.json --tab-width 1 --tab-width 2
-
-
- if (isCLI && !optionInfo.array) {
- const originalPreprocess = parameters.preprocess || (x => x);
-
- parameters.preprocess = (value, schema, utils) => schema.preprocess(originalPreprocess(Array.isArray(value) ? value[value.length - 1] : value), utils);
- }
-
- return optionInfo.array ? lib.ArraySchema.create(Object.assign({}, isCLI ? {
- preprocess: v => [].concat(v)
- } : {}, {}, handlers, {
- valueSchema: SchemaConstructor.create(parameters)
- })) : SchemaConstructor.create(Object.assign({}, parameters, {}, handlers));
- }
-
- function normalizeApiOptions(options, optionInfos, opts) {
- return normalizeOptions(options, optionInfos, opts);
- }
-
- function normalizeCliOptions(options, optionInfos, opts) {
- return normalizeOptions(options, optionInfos, Object.assign({
- isCLI: true
- }, opts));
- }
-
- var optionsNormalizer = {
- normalizeApiOptions,
- normalizeCliOptions
- };
-
- var getLast = arr => arr[arr.length - 1];
-
- function locStart(node, opts) {
- opts = opts || {}; // Handle nodes with decorators. They should start at the first decorator
-
- if (!opts.ignoreDecorators && node.declaration && node.declaration.decorators && node.declaration.decorators.length > 0) {
- return locStart(node.declaration.decorators[0]);
- }
-
- if (!opts.ignoreDecorators && node.decorators && node.decorators.length > 0) {
- return locStart(node.decorators[0]);
- }
-
- if (node.__location) {
- return node.__location.startOffset;
- }
-
- if (node.range) {
- return node.range[0];
- }
-
- if (typeof node.start === "number") {
- return node.start;
- }
-
- if (node.loc) {
- return node.loc.start;
- }
-
- return null;
- }
-
- function locEnd(node) {
- const endNode = node.nodes && getLast(node.nodes);
-
- if (endNode && node.source && !node.source.end) {
- node = endNode;
- }
-
- if (node.__location) {
- return node.__location.endOffset;
- }
-
- const loc = node.range ? node.range[1] : typeof node.end === "number" ? node.end : null;
-
- if (node.typeAnnotation) {
- return Math.max(loc, locEnd(node.typeAnnotation));
- }
-
- if (node.loc && !loc) {
- return node.loc.end;
- }
-
- return loc;
- }
-
- function composeLoc(startNode, endNodeOrLength = startNode) {
- const length = typeof endNodeOrLength === "number" ? endNodeOrLength : -1;
- const start = locStart(startNode);
- const end = length !== -1 ? start + length : locEnd(endNodeOrLength);
- const startLoc = startNode.loc.start;
- return {
- start,
- end,
- range: [start, end],
- loc: {
- start: startLoc,
- end: length !== -1 ? {
- line: startLoc.line,
- column: startLoc.column + length
- } : endNodeOrLength.loc.end
- }
- };
- }
-
- var loc = {
- locStart,
- locEnd,
- composeLoc
- };
-
- var jsTokens = createCommonjsModule(function (module, exports) {
- // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell
- // License: MIT. (See LICENSE.)
- Object.defineProperty(exports, "__esModule", {
- value: true
- }); // This regex comes from regex.coffee, and is inserted here by generate-index.js
- // (run `npm run build`).
-
- 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;
-
- exports.matchToToken = function (match) {
- var token = {
- type: "invalid",
- value: match[0],
- closed: undefined
- };
- 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";
- return token;
- };
- });
- unwrapExports(jsTokens);
- var jsTokens_1 = jsTokens.matchToToken;
-
- var ast = createCommonjsModule(function (module) {
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
-
- function isExpression(node) {
- if (node == null) {
- return false;
- }
-
- switch (node.type) {
- case 'ArrayExpression':
- case 'AssignmentExpression':
- case 'BinaryExpression':
- case 'CallExpression':
- case 'ConditionalExpression':
- case 'FunctionExpression':
- case 'Identifier':
- case 'Literal':
- case 'LogicalExpression':
- case 'MemberExpression':
- case 'NewExpression':
- case 'ObjectExpression':
- case 'SequenceExpression':
- case 'ThisExpression':
- case 'UnaryExpression':
- case 'UpdateExpression':
- return true;
- }
-
- return false;
- }
-
- function isIterationStatement(node) {
- if (node == null) {
- return false;
- }
-
- switch (node.type) {
- case 'DoWhileStatement':
- case 'ForInStatement':
- case 'ForStatement':
- case 'WhileStatement':
- return true;
- }
-
- return false;
- }
-
- function isStatement(node) {
- if (node == null) {
- return false;
- }
-
- switch (node.type) {
- case 'BlockStatement':
- case 'BreakStatement':
- case 'ContinueStatement':
- case 'DebuggerStatement':
- case 'DoWhileStatement':
- case 'EmptyStatement':
- case 'ExpressionStatement':
- case 'ForInStatement':
- case 'ForStatement':
- case 'IfStatement':
- case 'LabeledStatement':
- case 'ReturnStatement':
- case 'SwitchStatement':
- case 'ThrowStatement':
- case 'TryStatement':
- case 'VariableDeclaration':
- case 'WhileStatement':
- case 'WithStatement':
- return true;
- }
-
- return false;
- }
-
- function isSourceElement(node) {
- return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
- }
-
- function trailingStatement(node) {
- switch (node.type) {
- case 'IfStatement':
- if (node.alternate != null) {
- return node.alternate;
- }
-
- return node.consequent;
-
- case 'LabeledStatement':
- case 'ForStatement':
- case 'ForInStatement':
- case 'WhileStatement':
- case 'WithStatement':
- return node.body;
- }
-
- return null;
- }
-
- function isProblematicIfStatement(node) {
- var current;
-
- if (node.type !== 'IfStatement') {
- return false;
- }
-
- if (node.alternate == null) {
- return false;
- }
-
- current = node.consequent;
-
- do {
- if (current.type === 'IfStatement') {
- if (current.alternate == null) {
- return true;
- }
- }
-
- current = trailingStatement(current);
- } while (current);
-
- return false;
- }
-
- module.exports = {
- isExpression: isExpression,
- isStatement: isStatement,
- isIterationStatement: isIterationStatement,
- isSourceElement: isSourceElement,
- isProblematicIfStatement: isProblematicIfStatement,
- trailingStatement: trailingStatement
- };
- })();
- /* vim: set sw=4 ts=4 et tw=80 : */
-
- });
- var ast_1 = ast.isExpression;
- var ast_2 = ast.isStatement;
- var ast_3 = ast.isIterationStatement;
- var ast_4 = ast.isSourceElement;
- var ast_5 = ast.isProblematicIfStatement;
- var ast_6 = ast.trailingStatement;
-
- var code = createCommonjsModule(function (module) {
- /*
- Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com>
- Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
-
- var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; // See `tools/generate-identifier-regex.js`.
-
- ES5Regex = {
- // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierStart:
- 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]/,
- // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierPart:
- 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]/
- };
- ES6Regex = {
- // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierStart:
- 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]/,
- // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierPart:
- 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]/
- };
-
- function isDecimalDigit(ch) {
- return 0x30 <= ch && ch <= 0x39; // 0..9
- }
-
- function isHexDigit(ch) {
- return 0x30 <= ch && ch <= 0x39 || // 0..9
- 0x61 <= ch && ch <= 0x66 || // a..f
- 0x41 <= ch && ch <= 0x46; // A..F
- }
-
- function isOctalDigit(ch) {
- return ch >= 0x30 && ch <= 0x37; // 0..7
- } // 7.2 White Space
-
-
- NON_ASCII_WHITESPACES = [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF];
-
- function isWhiteSpace(ch) {
- return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
- } // 7.3 Line Terminators
-
-
- function isLineTerminator(ch) {
- return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
- } // 7.6 Identifier Names and Identifiers
-
-
- function fromCodePoint(cp) {
- if (cp <= 0xFFFF) {
- return String.fromCharCode(cp);
- }
-
- var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
- var cu2 = String.fromCharCode((cp - 0x10000) % 0x400 + 0xDC00);
- return cu1 + cu2;
- }
-
- IDENTIFIER_START = new Array(0x80);
-
- for (ch = 0; ch < 0x80; ++ch) {
- IDENTIFIER_START[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
- ch >= 0x41 && ch <= 0x5A || // A..Z
- ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
- }
-
- IDENTIFIER_PART = new Array(0x80);
-
- for (ch = 0; ch < 0x80; ++ch) {
- IDENTIFIER_PART[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
- ch >= 0x41 && ch <= 0x5A || // A..Z
- ch >= 0x30 && ch <= 0x39 || // 0..9
- ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
- }
-
- function isIdentifierStartES5(ch) {
- return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
- }
-
- function isIdentifierPartES5(ch) {
- return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
- }
-
- function isIdentifierStartES6(ch) {
- return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
- }
-
- function isIdentifierPartES6(ch) {
- return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
- }
-
- module.exports = {
- isDecimalDigit: isDecimalDigit,
- isHexDigit: isHexDigit,
- isOctalDigit: isOctalDigit,
- isWhiteSpace: isWhiteSpace,
- isLineTerminator: isLineTerminator,
- isIdentifierStartES5: isIdentifierStartES5,
- isIdentifierPartES5: isIdentifierPartES5,
- isIdentifierStartES6: isIdentifierStartES6,
- isIdentifierPartES6: isIdentifierPartES6
- };
- })();
- /* vim: set sw=4 ts=4 et tw=80 : */
-
- });
- var code_1 = code.isDecimalDigit;
- var code_2 = code.isHexDigit;
- var code_3 = code.isOctalDigit;
- var code_4 = code.isWhiteSpace;
- var code_5 = code.isLineTerminator;
- var code_6 = code.isIdentifierStartES5;
- var code_7 = code.isIdentifierPartES5;
- var code_8 = code.isIdentifierStartES6;
- var code_9 = code.isIdentifierPartES6;
-
- var keyword = createCommonjsModule(function (module) {
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
-
- var code$1 = code;
-
- function isStrictModeReservedWordES6(id) {
- switch (id) {
- case 'implements':
- case 'interface':
- case 'package':
- case 'private':
- case 'protected':
- case 'public':
- case 'static':
- case 'let':
- return true;
-
- default:
- return false;
- }
- }
-
- function isKeywordES5(id, strict) {
- // yield should not be treated as keyword under non-strict mode.
- if (!strict && id === 'yield') {
- return false;
- }
-
- return isKeywordES6(id, strict);
- }
-
- function isKeywordES6(id, strict) {
- if (strict && isStrictModeReservedWordES6(id)) {
- return true;
- }
-
- switch (id.length) {
- case 2:
- return id === 'if' || id === 'in' || id === 'do';
-
- case 3:
- return id === 'var' || id === 'for' || id === 'new' || id === 'try';
-
- case 4:
- return id === 'this' || id === 'else' || id === 'case' || id === 'void' || id === 'with' || id === 'enum';
-
- case 5:
- return id === 'while' || id === 'break' || id === 'catch' || id === 'throw' || id === 'const' || id === 'yield' || id === 'class' || id === 'super';
-
- case 6:
- return id === 'return' || id === 'typeof' || id === 'delete' || id === 'switch' || id === 'export' || id === 'import';
-
- case 7:
- return id === 'default' || id === 'finally' || id === 'extends';
-
- case 8:
- return id === 'function' || id === 'continue' || id === 'debugger';
-
- case 10:
- return id === 'instanceof';
-
- default:
- return false;
- }
- }
-
- function isReservedWordES5(id, strict) {
- return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
- }
-
- function isReservedWordES6(id, strict) {
- return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
- }
-
- function isRestrictedWord(id) {
- return id === 'eval' || id === 'arguments';
- }
-
- function isIdentifierNameES5(id) {
- var i, iz, ch;
-
- if (id.length === 0) {
- return false;
- }
-
- ch = id.charCodeAt(0);
-
- if (!code$1.isIdentifierStartES5(ch)) {
- return false;
- }
-
- for (i = 1, iz = id.length; i < iz; ++i) {
- ch = id.charCodeAt(i);
-
- if (!code$1.isIdentifierPartES5(ch)) {
- return false;
- }
- }
-
- return true;
- }
-
- function decodeUtf16(lead, trail) {
- return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
- }
-
- function isIdentifierNameES6(id) {
- var i, iz, ch, lowCh, check;
-
- if (id.length === 0) {
- return false;
- }
-
- check = code$1.isIdentifierStartES6;
-
- for (i = 0, iz = id.length; i < iz; ++i) {
- ch = id.charCodeAt(i);
-
- if (0xD800 <= ch && ch <= 0xDBFF) {
- ++i;
-
- if (i >= iz) {
- return false;
- }
-
- lowCh = id.charCodeAt(i);
-
- if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
- return false;
- }
-
- ch = decodeUtf16(ch, lowCh);
- }
-
- if (!check(ch)) {
- return false;
- }
-
- check = code$1.isIdentifierPartES6;
- }
-
- return true;
- }
-
- function isIdentifierES5(id, strict) {
- return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
- }
-
- function isIdentifierES6(id, strict) {
- return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
- }
-
- module.exports = {
- isKeywordES5: isKeywordES5,
- isKeywordES6: isKeywordES6,
- isReservedWordES5: isReservedWordES5,
- isReservedWordES6: isReservedWordES6,
- isRestrictedWord: isRestrictedWord,
- isIdentifierNameES5: isIdentifierNameES5,
- isIdentifierNameES6: isIdentifierNameES6,
- isIdentifierES5: isIdentifierES5,
- isIdentifierES6: isIdentifierES6
- };
- })();
- /* vim: set sw=4 ts=4 et tw=80 : */
-
- });
- var keyword_1 = keyword.isKeywordES5;
- var keyword_2 = keyword.isKeywordES6;
- var keyword_3 = keyword.isReservedWordES5;
- var keyword_4 = keyword.isReservedWordES6;
- var keyword_5 = keyword.isRestrictedWord;
- var keyword_6 = keyword.isIdentifierNameES5;
- var keyword_7 = keyword.isIdentifierNameES6;
- var keyword_8 = keyword.isIdentifierES5;
- var keyword_9 = keyword.isIdentifierES6;
-
- var utils$1 = createCommonjsModule(function (module, exports) {
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
-
- exports.ast = ast;
- exports.code = code;
- exports.keyword = keyword;
- })();
- /* vim: set sw=4 ts=4 et tw=80 : */
-
- });
- var utils_1$1 = utils$1.ast;
- var utils_2$1 = utils$1.code;
- var utils_3$1 = utils$1.keyword;
-
- var matchOperatorsRe$1 = /[|\\{}()[\]^$+*?.]/g;
-
- var escapeStringRegexp$1 = function escapeStringRegexp(str) {
- if (typeof str !== 'string') {
- throw new TypeError('Expected a string');
- }
-
- return str.replace(matchOperatorsRe$1, '\\$&');
- };
-
- var colorName$2 = {
- "aliceblue": [240, 248, 255],
- "antiquewhite": [250, 235, 215],
- "aqua": [0, 255, 255],
- "aquamarine": [127, 255, 212],
- "azure": [240, 255, 255],
- "beige": [245, 245, 220],
- "bisque": [255, 228, 196],
- "black": [0, 0, 0],
- "blanchedalmond": [255, 235, 205],
- "blue": [0, 0, 255],
- "blueviolet": [138, 43, 226],
- "brown": [165, 42, 42],
- "burlywood": [222, 184, 135],
- "cadetblue": [95, 158, 160],
- "chartreuse": [127, 255, 0],
- "chocolate": [210, 105, 30],
- "coral": [255, 127, 80],
- "cornflowerblue": [100, 149, 237],
- "cornsilk": [255, 248, 220],
- "crimson": [220, 20, 60],
- "cyan": [0, 255, 255],
- "darkblue": [0, 0, 139],
- "darkcyan": [0, 139, 139],
- "darkgoldenrod": [184, 134, 11],
- "darkgray": [169, 169, 169],
- "darkgreen": [0, 100, 0],
- "darkgrey": [169, 169, 169],
- "darkkhaki": [189, 183, 107],
- "darkmagenta": [139, 0, 139],
- "darkolivegreen": [85, 107, 47],
- "darkorange": [255, 140, 0],
- "darkorchid": [153, 50, 204],
- "darkred": [139, 0, 0],
- "darksalmon": [233, 150, 122],
- "darkseagreen": [143, 188, 143],
- "darkslateblue": [72, 61, 139],
- "darkslategray": [47, 79, 79],
- "darkslategrey": [47, 79, 79],
- "darkturquoise": [0, 206, 209],
- "darkviolet": [148, 0, 211],
- "deeppink": [255, 20, 147],
- "deepskyblue": [0, 191, 255],
- "dimgray": [105, 105, 105],
- "dimgrey": [105, 105, 105],
- "dodgerblue": [30, 144, 255],
- "firebrick": [178, 34, 34],
- "floralwhite": [255, 250, 240],
- "forestgreen": [34, 139, 34],
- "fuchsia": [255, 0, 255],
- "gainsboro": [220, 220, 220],
- "ghostwhite": [248, 248, 255],
- "gold": [255, 215, 0],
- "goldenrod": [218, 165, 32],
- "gray": [128, 128, 128],
- "green": [0, 128, 0],
- "greenyellow": [173, 255, 47],
- "grey": [128, 128, 128],
- "honeydew": [240, 255, 240],
- "hotpink": [255, 105, 180],
- "indianred": [205, 92, 92],
- "indigo": [75, 0, 130],
- "ivory": [255, 255, 240],
- "khaki": [240, 230, 140],
- "lavender": [230, 230, 250],
- "lavenderblush": [255, 240, 245],
- "lawngreen": [124, 252, 0],
- "lemonchiffon": [255, 250, 205],
- "lightblue": [173, 216, 230],
- "lightcoral": [240, 128, 128],
- "lightcyan": [224, 255, 255],
- "lightgoldenrodyellow": [250, 250, 210],
- "lightgray": [211, 211, 211],
- "lightgreen": [144, 238, 144],
- "lightgrey": [211, 211, 211],
- "lightpink": [255, 182, 193],
- "lightsalmon": [255, 160, 122],
- "lightseagreen": [32, 178, 170],
- "lightskyblue": [135, 206, 250],
- "lightslategray": [119, 136, 153],
- "lightslategrey": [119, 136, 153],
- "lightsteelblue": [176, 196, 222],
- "lightyellow": [255, 255, 224],
- "lime": [0, 255, 0],
- "limegreen": [50, 205, 50],
- "linen": [250, 240, 230],
- "magenta": [255, 0, 255],
- "maroon": [128, 0, 0],
- "mediumaquamarine": [102, 205, 170],
- "mediumblue": [0, 0, 205],
- "mediumorchid": [186, 85, 211],
- "mediumpurple": [147, 112, 219],
- "mediumseagreen": [60, 179, 113],
- "mediumslateblue": [123, 104, 238],
- "mediumspringgreen": [0, 250, 154],
- "mediumturquoise": [72, 209, 204],
- "mediumvioletred": [199, 21, 133],
- "midnightblue": [25, 25, 112],
- "mintcream": [245, 255, 250],
- "mistyrose": [255, 228, 225],
- "moccasin": [255, 228, 181],
- "navajowhite": [255, 222, 173],
- "navy": [0, 0, 128],
- "oldlace": [253, 245, 230],
- "olive": [128, 128, 0],
- "olivedrab": [107, 142, 35],
- "orange": [255, 165, 0],
- "orangered": [255, 69, 0],
- "orchid": [218, 112, 214],
- "palegoldenrod": [238, 232, 170],
- "palegreen": [152, 251, 152],
- "paleturquoise": [175, 238, 238],
- "palevioletred": [219, 112, 147],
- "papayawhip": [255, 239, 213],
- "peachpuff": [255, 218, 185],
- "peru": [205, 133, 63],
- "pink": [255, 192, 203],
- "plum": [221, 160, 221],
- "powderblue": [176, 224, 230],
- "purple": [128, 0, 128],
- "rebeccapurple": [102, 51, 153],
- "red": [255, 0, 0],
- "rosybrown": [188, 143, 143],
- "royalblue": [65, 105, 225],
- "saddlebrown": [139, 69, 19],
- "salmon": [250, 128, 114],
- "sandybrown": [244, 164, 96],
- "seagreen": [46, 139, 87],
- "seashell": [255, 245, 238],
- "sienna": [160, 82, 45],
- "silver": [192, 192, 192],
- "skyblue": [135, 206, 235],
- "slateblue": [106, 90, 205],
- "slategray": [112, 128, 144],
- "slategrey": [112, 128, 144],
- "snow": [255, 250, 250],
- "springgreen": [0, 255, 127],
- "steelblue": [70, 130, 180],
- "tan": [210, 180, 140],
- "teal": [0, 128, 128],
- "thistle": [216, 191, 216],
- "tomato": [255, 99, 71],
- "turquoise": [64, 224, 208],
- "violet": [238, 130, 238],
- "wheat": [245, 222, 179],
- "white": [255, 255, 255],
- "whitesmoke": [245, 245, 245],
- "yellow": [255, 255, 0],
- "yellowgreen": [154, 205, 50]
- };
-
- var conversions$2 = createCommonjsModule(function (module) {
- /* MIT license */
- // NOTE: conversions should only return primitive values (i.e. arrays, or
- // values that give correct `typeof` results).
- // do not use box values types (i.e. Number(), String(), etc.)
- var reverseKeywords = {};
-
- for (var key in colorName$2) {
- if (colorName$2.hasOwnProperty(key)) {
- reverseKeywords[colorName$2[key]] = key;
- }
- }
-
- var convert = module.exports = {
- rgb: {
- channels: 3,
- labels: 'rgb'
- },
- hsl: {
- channels: 3,
- labels: 'hsl'
- },
- hsv: {
- channels: 3,
- labels: 'hsv'
- },
- hwb: {
- channels: 3,
- labels: 'hwb'
- },
- cmyk: {
- channels: 4,
- labels: 'cmyk'
- },
- xyz: {
- channels: 3,
- labels: 'xyz'
- },
- lab: {
- channels: 3,
- labels: 'lab'
- },
- lch: {
- channels: 3,
- labels: 'lch'
- },
- hex: {
- channels: 1,
- labels: ['hex']
- },
- keyword: {
- channels: 1,
- labels: ['keyword']
- },
- ansi16: {
- channels: 1,
- labels: ['ansi16']
- },
- ansi256: {
- channels: 1,
- labels: ['ansi256']
- },
- hcg: {
- channels: 3,
- labels: ['h', 'c', 'g']
- },
- apple: {
- channels: 3,
- labels: ['r16', 'g16', 'b16']
- },
- gray: {
- channels: 1,
- labels: ['gray']
- }
- }; // hide .channels and .labels properties
-
- for (var model in convert) {
- if (convert.hasOwnProperty(model)) {
- if (!('channels' in convert[model])) {
- throw new Error('missing channels property: ' + model);
- }
-
- if (!('labels' in convert[model])) {
- throw new Error('missing channel labels property: ' + model);
- }
-
- if (convert[model].labels.length !== convert[model].channels) {
- throw new Error('channel and label counts mismatch: ' + model);
- }
-
- var channels = convert[model].channels;
- var labels = convert[model].labels;
- delete convert[model].channels;
- delete convert[model].labels;
- Object.defineProperty(convert[model], 'channels', {
- value: channels
- });
- Object.defineProperty(convert[model], 'labels', {
- value: labels
- });
- }
- }
-
- convert.rgb.hsl = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var min = Math.min(r, g, b);
- var max = Math.max(r, g, b);
- var delta = max - min;
- var h;
- var s;
- var l;
-
- if (max === min) {
- h = 0;
- } else if (r === max) {
- h = (g - b) / delta;
- } else if (g === max) {
- h = 2 + (b - r) / delta;
- } else if (b === max) {
- h = 4 + (r - g) / delta;
- }
-
- h = Math.min(h * 60, 360);
-
- if (h < 0) {
- h += 360;
- }
-
- l = (min + max) / 2;
-
- if (max === min) {
- s = 0;
- } else if (l <= 0.5) {
- s = delta / (max + min);
- } else {
- s = delta / (2 - max - min);
- }
-
- return [h, s * 100, l * 100];
- };
-
- convert.rgb.hsv = function (rgb) {
- var rdif;
- var gdif;
- var bdif;
- var h;
- var s;
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var v = Math.max(r, g, b);
- var diff = v - Math.min(r, g, b);
-
- var diffc = function diffc(c) {
- return (v - c) / 6 / diff + 1 / 2;
- };
-
- if (diff === 0) {
- h = s = 0;
- } else {
- s = diff / v;
- rdif = diffc(r);
- gdif = diffc(g);
- bdif = diffc(b);
-
- if (r === v) {
- h = bdif - gdif;
- } else if (g === v) {
- h = 1 / 3 + rdif - bdif;
- } else if (b === v) {
- h = 2 / 3 + gdif - rdif;
- }
-
- if (h < 0) {
- h += 1;
- } else if (h > 1) {
- h -= 1;
- }
- }
-
- return [h * 360, s * 100, v * 100];
- };
-
- convert.rgb.hwb = function (rgb) {
- var r = rgb[0];
- var g = rgb[1];
- var b = rgb[2];
- var h = convert.rgb.hsl(rgb)[0];
- var w = 1 / 255 * Math.min(r, Math.min(g, b));
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
- return [h, w * 100, b * 100];
- };
-
- convert.rgb.cmyk = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var c;
- var m;
- var y;
- var k;
- k = Math.min(1 - r, 1 - g, 1 - b);
- c = (1 - r - k) / (1 - k) || 0;
- m = (1 - g - k) / (1 - k) || 0;
- y = (1 - b - k) / (1 - k) || 0;
- return [c * 100, m * 100, y * 100, k * 100];
- };
- /**
- * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
- * */
-
-
- function comparativeDistance(x, y) {
- return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
- }
-
- convert.rgb.keyword = function (rgb) {
- var reversed = reverseKeywords[rgb];
-
- if (reversed) {
- return reversed;
- }
-
- var currentClosestDistance = Infinity;
- var currentClosestKeyword;
-
- for (var keyword in colorName$2) {
- if (colorName$2.hasOwnProperty(keyword)) {
- var value = colorName$2[keyword]; // Compute comparative distance
-
- var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
-
- if (distance < currentClosestDistance) {
- currentClosestDistance = distance;
- currentClosestKeyword = keyword;
- }
- }
- }
-
- return currentClosestKeyword;
- };
-
- convert.keyword.rgb = function (keyword) {
- return colorName$2[keyword];
- };
-
- convert.rgb.xyz = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255; // assume sRGB
-
- r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
- g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
- b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
- var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
- var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
- var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
- return [x * 100, y * 100, z * 100];
- };
-
- convert.rgb.lab = function (rgb) {
- var xyz = convert.rgb.xyz(rgb);
- var x = xyz[0];
- var y = xyz[1];
- var z = xyz[2];
- var l;
- var a;
- var b;
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
- l = 116 * y - 16;
- a = 500 * (x - y);
- b = 200 * (y - z);
- return [l, a, b];
- };
-
- convert.hsl.rgb = function (hsl) {
- var h = hsl[0] / 360;
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var t1;
- var t2;
- var t3;
- var rgb;
- var val;
-
- if (s === 0) {
- val = l * 255;
- return [val, val, val];
- }
-
- if (l < 0.5) {
- t2 = l * (1 + s);
- } else {
- t2 = l + s - l * s;
- }
-
- t1 = 2 * l - t2;
- rgb = [0, 0, 0];
-
- for (var i = 0; i < 3; i++) {
- t3 = h + 1 / 3 * -(i - 1);
-
- if (t3 < 0) {
- t3++;
- }
-
- if (t3 > 1) {
- t3--;
- }
-
- if (6 * t3 < 1) {
- val = t1 + (t2 - t1) * 6 * t3;
- } else if (2 * t3 < 1) {
- val = t2;
- } else if (3 * t3 < 2) {
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
- } else {
- val = t1;
- }
-
- rgb[i] = val * 255;
- }
-
- return rgb;
- };
-
- convert.hsl.hsv = function (hsl) {
- var h = hsl[0];
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var smin = s;
- var lmin = Math.max(l, 0.01);
- var sv;
- var v;
- l *= 2;
- s *= l <= 1 ? l : 2 - l;
- smin *= lmin <= 1 ? lmin : 2 - lmin;
- v = (l + s) / 2;
- sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
- return [h, sv * 100, v * 100];
- };
-
- convert.hsv.rgb = function (hsv) {
- var h = hsv[0] / 60;
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var hi = Math.floor(h) % 6;
- var f = h - Math.floor(h);
- var p = 255 * v * (1 - s);
- var q = 255 * v * (1 - s * f);
- var t = 255 * v * (1 - s * (1 - f));
- v *= 255;
-
- switch (hi) {
- case 0:
- return [v, t, p];
-
- case 1:
- return [q, v, p];
-
- case 2:
- return [p, v, t];
-
- case 3:
- return [p, q, v];
-
- case 4:
- return [t, p, v];
-
- case 5:
- return [v, p, q];
- }
- };
-
- convert.hsv.hsl = function (hsv) {
- var h = hsv[0];
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var vmin = Math.max(v, 0.01);
- var lmin;
- var sl;
- var l;
- l = (2 - s) * v;
- lmin = (2 - s) * vmin;
- sl = s * vmin;
- sl /= lmin <= 1 ? lmin : 2 - lmin;
- sl = sl || 0;
- l /= 2;
- return [h, sl * 100, l * 100];
- }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
-
-
- convert.hwb.rgb = function (hwb) {
- var h = hwb[0] / 360;
- var wh = hwb[1] / 100;
- var bl = hwb[2] / 100;
- var ratio = wh + bl;
- var i;
- var v;
- var f;
- var n; // wh + bl cant be > 1
-
- if (ratio > 1) {
- wh /= ratio;
- bl /= ratio;
- }
-
- i = Math.floor(6 * h);
- v = 1 - bl;
- f = 6 * h - i;
-
- if ((i & 0x01) !== 0) {
- f = 1 - f;
- }
-
- n = wh + f * (v - wh); // linear interpolation
-
- var r;
- var g;
- var b;
-
- switch (i) {
- default:
- case 6:
- case 0:
- r = v;
- g = n;
- b = wh;
- break;
-
- case 1:
- r = n;
- g = v;
- b = wh;
- break;
-
- case 2:
- r = wh;
- g = v;
- b = n;
- break;
-
- case 3:
- r = wh;
- g = n;
- b = v;
- break;
-
- case 4:
- r = n;
- g = wh;
- b = v;
- break;
-
- case 5:
- r = v;
- g = wh;
- b = n;
- break;
- }
-
- return [r * 255, g * 255, b * 255];
- };
-
- convert.cmyk.rgb = function (cmyk) {
- var c = cmyk[0] / 100;
- var m = cmyk[1] / 100;
- var y = cmyk[2] / 100;
- var k = cmyk[3] / 100;
- var r;
- var g;
- var b;
- r = 1 - Math.min(1, c * (1 - k) + k);
- g = 1 - Math.min(1, m * (1 - k) + k);
- b = 1 - Math.min(1, y * (1 - k) + k);
- return [r * 255, g * 255, b * 255];
- };
-
- convert.xyz.rgb = function (xyz) {
- var x = xyz[0] / 100;
- var y = xyz[1] / 100;
- var z = xyz[2] / 100;
- var r;
- var g;
- var b;
- r = x * 3.2406 + y * -1.5372 + z * -0.4986;
- g = x * -0.9689 + y * 1.8758 + z * 0.0415;
- b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB
-
- r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
- g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
- b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
- r = Math.min(Math.max(0, r), 1);
- g = Math.min(Math.max(0, g), 1);
- b = Math.min(Math.max(0, b), 1);
- return [r * 255, g * 255, b * 255];
- };
-
- convert.xyz.lab = function (xyz) {
- var x = xyz[0];
- var y = xyz[1];
- var z = xyz[2];
- var l;
- var a;
- var b;
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
- l = 116 * y - 16;
- a = 500 * (x - y);
- b = 200 * (y - z);
- return [l, a, b];
- };
-
- convert.lab.xyz = function (lab) {
- var l = lab[0];
- var a = lab[1];
- var b = lab[2];
- var x;
- var y;
- var z;
- y = (l + 16) / 116;
- x = a / 500 + y;
- z = y - b / 200;
- var y2 = Math.pow(y, 3);
- var x2 = Math.pow(x, 3);
- var z2 = Math.pow(z, 3);
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
- x *= 95.047;
- y *= 100;
- z *= 108.883;
- return [x, y, z];
- };
-
- convert.lab.lch = function (lab) {
- var l = lab[0];
- var a = lab[1];
- var b = lab[2];
- var hr;
- var h;
- var c;
- hr = Math.atan2(b, a);
- h = hr * 360 / 2 / Math.PI;
-
- if (h < 0) {
- h += 360;
- }
-
- c = Math.sqrt(a * a + b * b);
- return [l, c, h];
- };
-
- convert.lch.lab = function (lch) {
- var l = lch[0];
- var c = lch[1];
- var h = lch[2];
- var a;
- var b;
- var hr;
- hr = h / 360 * 2 * Math.PI;
- a = c * Math.cos(hr);
- b = c * Math.sin(hr);
- return [l, a, b];
- };
-
- convert.rgb.ansi16 = function (args) {
- var r = args[0];
- var g = args[1];
- var b = args[2];
- var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
-
- value = Math.round(value / 50);
-
- if (value === 0) {
- return 30;
- }
-
- var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
-
- if (value === 2) {
- ansi += 60;
- }
-
- return ansi;
- };
-
- convert.hsv.ansi16 = function (args) {
- // optimization here; we already know the value and don't need to get
- // it converted for us.
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
- };
-
- convert.rgb.ansi256 = function (args) {
- var r = args[0];
- var g = args[1];
- var b = args[2]; // we use the extended greyscale palette here, with the exception of
- // black and white. normal palette only has 4 greyscale shades.
-
- if (r === g && g === b) {
- if (r < 8) {
- return 16;
- }
-
- if (r > 248) {
- return 231;
- }
-
- return Math.round((r - 8) / 247 * 24) + 232;
- }
-
- var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
- return ansi;
- };
-
- convert.ansi16.rgb = function (args) {
- var color = args % 10; // handle greyscale
-
- if (color === 0 || color === 7) {
- if (args > 50) {
- color += 3.5;
- }
-
- color = color / 10.5 * 255;
- return [color, color, color];
- }
-
- var mult = (~~(args > 50) + 1) * 0.5;
- var r = (color & 1) * mult * 255;
- var g = (color >> 1 & 1) * mult * 255;
- var b = (color >> 2 & 1) * mult * 255;
- return [r, g, b];
- };
-
- convert.ansi256.rgb = function (args) {
- // handle greyscale
- if (args >= 232) {
- var c = (args - 232) * 10 + 8;
- return [c, c, c];
- }
-
- args -= 16;
- var rem;
- var r = Math.floor(args / 36) / 5 * 255;
- var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
- var b = rem % 6 / 5 * 255;
- return [r, g, b];
- };
-
- convert.rgb.hex = function (args) {
- var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
- var string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
-
- convert.hex.rgb = function (args) {
- var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
-
- if (!match) {
- return [0, 0, 0];
- }
-
- var colorString = match[0];
-
- if (match[0].length === 3) {
- colorString = colorString.split('').map(function (char) {
- return char + char;
- }).join('');
- }
-
- var integer = parseInt(colorString, 16);
- var r = integer >> 16 & 0xFF;
- var g = integer >> 8 & 0xFF;
- var b = integer & 0xFF;
- return [r, g, b];
- };
-
- convert.rgb.hcg = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var max = Math.max(Math.max(r, g), b);
- var min = Math.min(Math.min(r, g), b);
- var chroma = max - min;
- var grayscale;
- var hue;
-
- if (chroma < 1) {
- grayscale = min / (1 - chroma);
- } else {
- grayscale = 0;
- }
-
- if (chroma <= 0) {
- hue = 0;
- } else if (max === r) {
- hue = (g - b) / chroma % 6;
- } else if (max === g) {
- hue = 2 + (b - r) / chroma;
- } else {
- hue = 4 + (r - g) / chroma + 4;
- }
-
- hue /= 6;
- hue %= 1;
- return [hue * 360, chroma * 100, grayscale * 100];
- };
-
- convert.hsl.hcg = function (hsl) {
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var c = 1;
- var f = 0;
-
- if (l < 0.5) {
- c = 2.0 * s * l;
- } else {
- c = 2.0 * s * (1.0 - l);
- }
-
- if (c < 1.0) {
- f = (l - 0.5 * c) / (1.0 - c);
- }
-
- return [hsl[0], c * 100, f * 100];
- };
-
- convert.hsv.hcg = function (hsv) {
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var c = s * v;
- var f = 0;
-
- if (c < 1.0) {
- f = (v - c) / (1 - c);
- }
-
- return [hsv[0], c * 100, f * 100];
- };
-
- convert.hcg.rgb = function (hcg) {
- var h = hcg[0] / 360;
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
-
- if (c === 0.0) {
- return [g * 255, g * 255, g * 255];
- }
-
- var pure = [0, 0, 0];
- var hi = h % 1 * 6;
- var v = hi % 1;
- var w = 1 - v;
- var mg = 0;
-
- switch (Math.floor(hi)) {
- case 0:
- pure[0] = 1;
- pure[1] = v;
- pure[2] = 0;
- break;
-
- case 1:
- pure[0] = w;
- pure[1] = 1;
- pure[2] = 0;
- break;
-
- case 2:
- pure[0] = 0;
- pure[1] = 1;
- pure[2] = v;
- break;
-
- case 3:
- pure[0] = 0;
- pure[1] = w;
- pure[2] = 1;
- break;
-
- case 4:
- pure[0] = v;
- pure[1] = 0;
- pure[2] = 1;
- break;
-
- default:
- pure[0] = 1;
- pure[1] = 0;
- pure[2] = w;
- }
-
- mg = (1.0 - c) * g;
- return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
- };
-
- convert.hcg.hsv = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var v = c + g * (1.0 - c);
- var f = 0;
-
- if (v > 0.0) {
- f = c / v;
- }
-
- return [hcg[0], f * 100, v * 100];
- };
-
- convert.hcg.hsl = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var l = g * (1.0 - c) + 0.5 * c;
- var s = 0;
-
- if (l > 0.0 && l < 0.5) {
- s = c / (2 * l);
- } else if (l >= 0.5 && l < 1.0) {
- s = c / (2 * (1 - l));
- }
-
- return [hcg[0], s * 100, l * 100];
- };
-
- convert.hcg.hwb = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var v = c + g * (1.0 - c);
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
- };
-
- convert.hwb.hcg = function (hwb) {
- var w = hwb[1] / 100;
- var b = hwb[2] / 100;
- var v = 1 - b;
- var c = v - w;
- var g = 0;
-
- if (c < 1) {
- g = (v - c) / (1 - c);
- }
-
- return [hwb[0], c * 100, g * 100];
- };
-
- convert.apple.rgb = function (apple) {
- return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
- };
-
- convert.rgb.apple = function (rgb) {
- return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
- };
-
- convert.gray.rgb = function (args) {
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
- };
-
- convert.gray.hsl = convert.gray.hsv = function (args) {
- return [0, 0, args[0]];
- };
-
- convert.gray.hwb = function (gray) {
- return [0, 100, gray[0]];
- };
-
- convert.gray.cmyk = function (gray) {
- return [0, 0, 0, gray[0]];
- };
-
- convert.gray.lab = function (gray) {
- return [gray[0], 0, 0];
- };
-
- convert.gray.hex = function (gray) {
- var val = Math.round(gray[0] / 100 * 255) & 0xFF;
- var integer = (val << 16) + (val << 8) + val;
- var string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
-
- convert.rgb.gray = function (rgb) {
- var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
- return [val / 255 * 100];
- };
- });
- var conversions_1$1 = conversions$2.rgb;
- var conversions_2$1 = conversions$2.hsl;
- var conversions_3$1 = conversions$2.hsv;
- var conversions_4$1 = conversions$2.hwb;
- var conversions_5$1 = conversions$2.cmyk;
- var conversions_6$1 = conversions$2.xyz;
- var conversions_7$1 = conversions$2.lab;
- var conversions_8$1 = conversions$2.lch;
- var conversions_9$1 = conversions$2.hex;
- var conversions_10$1 = conversions$2.keyword;
- var conversions_11$1 = conversions$2.ansi16;
- var conversions_12$1 = conversions$2.ansi256;
- var conversions_13$1 = conversions$2.hcg;
- var conversions_14$1 = conversions$2.apple;
- var conversions_15$1 = conversions$2.gray;
-
- /*
- this function routes a model to all other models.
-
- all functions that are routed have a property `.conversion` attached
- to the returned synthetic function. This property is an array
- of strings, each with the steps in between the 'from' and 'to'
- color models (inclusive).
-
- conversions that are not possible simply are not included.
- */
-
- function buildGraph$2() {
- var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
-
- var models = Object.keys(conversions$2);
-
- for (var len = models.length, i = 0; i < len; i++) {
- graph[models[i]] = {
- // http://jsperf.com/1-vs-infinity
- // micro-opt, but this is simple.
- distance: -1,
- parent: null
- };
- }
-
- return graph;
- } // https://en.wikipedia.org/wiki/Breadth-first_search
-
-
- function deriveBFS$2(fromModel) {
- var graph = buildGraph$2();
- var queue = [fromModel]; // unshift -> queue -> pop
-
- graph[fromModel].distance = 0;
-
- while (queue.length) {
- var current = queue.pop();
- var adjacents = Object.keys(conversions$2[current]);
-
- for (var len = adjacents.length, i = 0; i < len; i++) {
- var adjacent = adjacents[i];
- var node = graph[adjacent];
-
- if (node.distance === -1) {
- node.distance = graph[current].distance + 1;
- node.parent = current;
- queue.unshift(adjacent);
- }
- }
- }
-
- return graph;
- }
-
- function link$2(from, to) {
- return function (args) {
- return to(from(args));
- };
- }
-
- function wrapConversion$2(toModel, graph) {
- var path = [graph[toModel].parent, toModel];
- var fn = conversions$2[graph[toModel].parent][toModel];
- var cur = graph[toModel].parent;
-
- while (graph[cur].parent) {
- path.unshift(graph[cur].parent);
- fn = link$2(conversions$2[graph[cur].parent][cur], fn);
- cur = graph[cur].parent;
- }
-
- fn.conversion = path;
- return fn;
- }
-
- var route$2 = function route(fromModel) {
- var graph = deriveBFS$2(fromModel);
- var conversion = {};
- var models = Object.keys(graph);
-
- for (var len = models.length, i = 0; i < len; i++) {
- var toModel = models[i];
- var node = graph[toModel];
-
- if (node.parent === null) {
- // no possible conversion, or this node is the source model.
- continue;
- }
-
- conversion[toModel] = wrapConversion$2(toModel, graph);
- }
-
- return conversion;
- };
-
- var convert$3 = {};
- var models$2 = Object.keys(conversions$2);
-
- function wrapRaw$2(fn) {
- var wrappedFn = function wrappedFn(args) {
- if (args === undefined || args === null) {
- return args;
- }
-
- if (arguments.length > 1) {
- args = Array.prototype.slice.call(arguments);
- }
-
- return fn(args);
- }; // preserve .conversion property if there is one
-
-
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
-
- return wrappedFn;
- }
-
- function wrapRounded$2(fn) {
- var wrappedFn = function wrappedFn(args) {
- if (args === undefined || args === null) {
- return args;
- }
-
- if (arguments.length > 1) {
- args = Array.prototype.slice.call(arguments);
- }
-
- var result = fn(args); // we're assuming the result is an array here.
- // see notice in conversions.js; don't use box types
- // in conversion functions.
-
- if (typeof result === 'object') {
- for (var len = result.length, i = 0; i < len; i++) {
- result[i] = Math.round(result[i]);
- }
- }
-
- return result;
- }; // preserve .conversion property if there is one
-
-
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
-
- return wrappedFn;
- }
-
- models$2.forEach(function (fromModel) {
- convert$3[fromModel] = {};
- Object.defineProperty(convert$3[fromModel], 'channels', {
- value: conversions$2[fromModel].channels
- });
- Object.defineProperty(convert$3[fromModel], 'labels', {
- value: conversions$2[fromModel].labels
- });
- var routes = route$2(fromModel);
- var routeModels = Object.keys(routes);
- routeModels.forEach(function (toModel) {
- var fn = routes[toModel];
- convert$3[fromModel][toModel] = wrapRounded$2(fn);
- convert$3[fromModel][toModel].raw = wrapRaw$2(fn);
- });
- });
- var colorConvert$2 = convert$3;
-
- var ansiStyles$2 = createCommonjsModule(function (module) {
-
- const wrapAnsi16 = (fn, offset) => function () {
- const code = fn.apply(colorConvert$2, arguments);
- return "\x1B[".concat(code + offset, "m");
- };
-
- const wrapAnsi256 = (fn, offset) => function () {
- const code = fn.apply(colorConvert$2, arguments);
- return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
- };
-
- const wrapAnsi16m = (fn, offset) => function () {
- const rgb = fn.apply(colorConvert$2, arguments);
- return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
- };
-
- function assembleStyles() {
- const codes = new Map();
- const styles = {
- modifier: {
- reset: [0, 0],
- // 21 isn't widely supported and 22 does the same thing
- bold: [1, 22],
- dim: [2, 22],
- italic: [3, 23],
- underline: [4, 24],
- inverse: [7, 27],
- hidden: [8, 28],
- strikethrough: [9, 29]
- },
- color: {
- black: [30, 39],
- red: [31, 39],
- green: [32, 39],
- yellow: [33, 39],
- blue: [34, 39],
- magenta: [35, 39],
- cyan: [36, 39],
- white: [37, 39],
- gray: [90, 39],
- // Bright color
- redBright: [91, 39],
- greenBright: [92, 39],
- yellowBright: [93, 39],
- blueBright: [94, 39],
- magentaBright: [95, 39],
- cyanBright: [96, 39],
- whiteBright: [97, 39]
- },
- bgColor: {
- bgBlack: [40, 49],
- bgRed: [41, 49],
- bgGreen: [42, 49],
- bgYellow: [43, 49],
- bgBlue: [44, 49],
- bgMagenta: [45, 49],
- bgCyan: [46, 49],
- bgWhite: [47, 49],
- // Bright color
- bgBlackBright: [100, 49],
- bgRedBright: [101, 49],
- bgGreenBright: [102, 49],
- bgYellowBright: [103, 49],
- bgBlueBright: [104, 49],
- bgMagentaBright: [105, 49],
- bgCyanBright: [106, 49],
- bgWhiteBright: [107, 49]
- }
- }; // Fix humans
-
- styles.color.grey = styles.color.gray;
-
- for (const groupName of Object.keys(styles)) {
- const group = styles[groupName];
-
- for (const styleName of Object.keys(group)) {
- const style = group[styleName];
- styles[styleName] = {
- open: "\x1B[".concat(style[0], "m"),
- close: "\x1B[".concat(style[1], "m")
- };
- group[styleName] = styles[styleName];
- codes.set(style[0], style[1]);
- }
-
- Object.defineProperty(styles, groupName, {
- value: group,
- enumerable: false
- });
- Object.defineProperty(styles, 'codes', {
- value: codes,
- enumerable: false
- });
- }
-
- const ansi2ansi = n => n;
-
- const rgb2rgb = (r, g, b) => [r, g, b];
-
- styles.color.close = '\u001B[39m';
- styles.bgColor.close = '\u001B[49m';
- styles.color.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 0)
- };
- styles.color.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 0)
- };
- styles.color.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 0)
- };
- styles.bgColor.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 10)
- };
- styles.bgColor.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 10)
- };
- styles.bgColor.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 10)
- };
-
- for (let key of Object.keys(colorConvert$2)) {
- if (typeof colorConvert$2[key] !== 'object') {
- continue;
- }
-
- const suite = colorConvert$2[key];
-
- if (key === 'ansi16') {
- key = 'ansi';
- }
-
- if ('ansi16' in suite) {
- styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
- styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
- }
-
- if ('ansi256' in suite) {
- styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
- styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
- }
-
- if ('rgb' in suite) {
- styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
- styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
- }
- }
-
- return styles;
- } // Make the export immutable
-
-
- Object.defineProperty(module, 'exports', {
- enumerable: true,
- get: assembleStyles
- });
- });
-
- const env$3 = process.env;
- let forceColor$2;
-
- if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
- forceColor$2 = false;
- } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
- forceColor$2 = true;
- }
-
- if ('FORCE_COLOR' in env$3) {
- forceColor$2 = env$3.FORCE_COLOR.length === 0 || parseInt(env$3.FORCE_COLOR, 10) !== 0;
- }
-
- function translateLevel$2(level) {
- if (level === 0) {
- return false;
- }
-
- return {
- level,
- hasBasic: true,
- has256: level >= 2,
- has16m: level >= 3
- };
- }
-
- function supportsColor$2(stream) {
- if (forceColor$2 === false) {
- return 0;
- }
-
- if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
- return 3;
- }
-
- if (hasFlag('color=256')) {
- return 2;
- }
-
- if (stream && !stream.isTTY && forceColor$2 !== true) {
- return 0;
- }
-
- const min = forceColor$2 ? 1 : 0;
-
- if (process.platform === 'win32') {
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
- // libuv that enables 256 color output on Windows. Anything earlier and it
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
- // release that supports 256 colors. Windows 10 build 14931 is the first release
- // that supports 16m/TrueColor.
- const osRelease = require$$0$1.release().split('.');
-
- if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
- }
-
- return 1;
- }
-
- if ('CI' in env$3) {
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$3) || env$3.CI_NAME === 'codeship') {
- return 1;
- }
-
- return min;
- }
-
- if ('TEAMCITY_VERSION' in env$3) {
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$3.TEAMCITY_VERSION) ? 1 : 0;
- }
-
- if (env$3.COLORTERM === 'truecolor') {
- return 3;
- }
-
- if ('TERM_PROGRAM' in env$3) {
- const version = parseInt((env$3.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
-
- switch (env$3.TERM_PROGRAM) {
- case 'iTerm.app':
- return version >= 3 ? 3 : 2;
-
- case 'Apple_Terminal':
- return 2;
- // No default
- }
- }
-
- if (/-256(color)?$/i.test(env$3.TERM)) {
- return 2;
- }
-
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$3.TERM)) {
- return 1;
- }
-
- if ('COLORTERM' in env$3) {
- return 1;
- }
-
- if (env$3.TERM === 'dumb') {
- return min;
- }
-
- return min;
- }
-
- function getSupportLevel$2(stream) {
- const level = supportsColor$2(stream);
- return translateLevel$2(level);
- }
-
- var supportsColor_1$2 = {
- supportsColor: getSupportLevel$2,
- stdout: getSupportLevel$2(process.stdout),
- stderr: getSupportLevel$2(process.stderr)
- };
-
- const TEMPLATE_REGEX$2 = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
- const STYLE_REGEX$2 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
- const STRING_REGEX$2 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
- const ESCAPE_REGEX$2 = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
- const ESCAPES$2 = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
-
- function unescape$2(c) {
- if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) {
- return String.fromCharCode(parseInt(c.slice(1), 16));
- }
-
- return ESCAPES$2.get(c) || c;
- }
-
- function parseArguments$2(name, args) {
- const results = [];
- const chunks = args.trim().split(/\s*,\s*/g);
- let matches;
-
- for (const chunk of chunks) {
- if (!isNaN(chunk)) {
- results.push(Number(chunk));
- } else if (matches = chunk.match(STRING_REGEX$2)) {
- results.push(matches[2].replace(ESCAPE_REGEX$2, (m, escape, chr) => escape ? unescape$2(escape) : chr));
- } else {
- throw new Error("Invalid Chalk template style argument: ".concat(chunk, " (in style '").concat(name, "')"));
- }
- }
-
- return results;
- }
-
- function parseStyle$2(style) {
- STYLE_REGEX$2.lastIndex = 0;
- const results = [];
- let matches;
-
- while ((matches = STYLE_REGEX$2.exec(style)) !== null) {
- const name = matches[1];
-
- if (matches[2]) {
- const args = parseArguments$2(name, matches[2]);
- results.push([name].concat(args));
- } else {
- results.push([name]);
- }
- }
-
- return results;
- }
-
- function buildStyle$2(chalk, styles) {
- const enabled = {};
-
- for (const layer of styles) {
- for (const style of layer.styles) {
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
- }
- }
-
- let current = chalk;
-
- for (const styleName of Object.keys(enabled)) {
- if (Array.isArray(enabled[styleName])) {
- if (!(styleName in current)) {
- throw new Error("Unknown Chalk style: ".concat(styleName));
- }
-
- if (enabled[styleName].length > 0) {
- current = current[styleName].apply(current, enabled[styleName]);
- } else {
- current = current[styleName];
- }
- }
- }
-
- return current;
- }
-
- var templates$2 = (chalk, tmp) => {
- const styles = [];
- const chunks = [];
- let chunk = []; // eslint-disable-next-line max-params
-
- tmp.replace(TEMPLATE_REGEX$2, (m, escapeChar, inverse, style, close, chr) => {
- if (escapeChar) {
- chunk.push(unescape$2(escapeChar));
- } else if (style) {
- const str = chunk.join('');
- chunk = [];
- chunks.push(styles.length === 0 ? str : buildStyle$2(chalk, styles)(str));
- styles.push({
- inverse,
- styles: parseStyle$2(style)
- });
- } else if (close) {
- if (styles.length === 0) {
- throw new Error('Found extraneous } in Chalk template literal');
- }
-
- chunks.push(buildStyle$2(chalk, styles)(chunk.join('')));
- chunk = [];
- styles.pop();
- } else {
- chunk.push(chr);
- }
- });
- chunks.push(chunk.join(''));
-
- if (styles.length > 0) {
- const errMsg = "Chalk template literal is missing ".concat(styles.length, " closing bracket").concat(styles.length === 1 ? '' : 's', " (`}`)");
- throw new Error(errMsg);
- }
-
- return chunks.join('');
- };
-
- var chalk$2 = createCommonjsModule(function (module) {
-
- const stdoutColor = supportsColor_1$2.stdout;
- const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping
-
- const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such
-
- const skipModels = new Set(['gray']);
- const styles = Object.create(null);
-
- function applyOptions(obj, options) {
- options = options || {}; // Detect level if not set manually
-
- const scLevel = stdoutColor ? stdoutColor.level : 0;
- obj.level = options.level === undefined ? scLevel : options.level;
- obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
- }
-
- function Chalk(options) {
- // We check for this.template here since calling `chalk.constructor()`
- // by itself will have a `this` of a previously constructed chalk object
- if (!this || !(this instanceof Chalk) || this.template) {
- const chalk = {};
- applyOptions(chalk, options);
-
- chalk.template = function () {
- const args = [].slice.call(arguments);
- return chalkTag.apply(null, [chalk.template].concat(args));
- };
-
- Object.setPrototypeOf(chalk, Chalk.prototype);
- Object.setPrototypeOf(chalk.template, chalk);
- chalk.template.constructor = Chalk;
- return chalk.template;
- }
-
- applyOptions(this, options);
- } // Use bright blue on Windows as the normal blue color is illegible
-
-
- if (isSimpleWindowsTerm) {
- ansiStyles$2.blue.open = '\u001B[94m';
- }
-
- for (const key of Object.keys(ansiStyles$2)) {
- ansiStyles$2[key].closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$2[key].close), 'g');
- styles[key] = {
- get() {
- const codes = ansiStyles$2[key];
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
- }
-
- };
- }
-
- styles.visible = {
- get() {
- return build.call(this, this._styles || [], true, 'visible');
- }
-
- };
- ansiStyles$2.color.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$2.color.close), 'g');
-
- for (const model of Object.keys(ansiStyles$2.color.ansi)) {
- if (skipModels.has(model)) {
- continue;
- }
-
- styles[model] = {
- get() {
- const level = this.level;
- return function () {
- const open = ansiStyles$2.color[levelMapping[level]][model].apply(null, arguments);
- const codes = {
- open,
- close: ansiStyles$2.color.close,
- closeRe: ansiStyles$2.color.closeRe
- };
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
- };
- }
-
- };
- }
-
- ansiStyles$2.bgColor.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$2.bgColor.close), 'g');
-
- for (const model of Object.keys(ansiStyles$2.bgColor.ansi)) {
- if (skipModels.has(model)) {
- continue;
- }
-
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
- styles[bgModel] = {
- get() {
- const level = this.level;
- return function () {
- const open = ansiStyles$2.bgColor[levelMapping[level]][model].apply(null, arguments);
- const codes = {
- open,
- close: ansiStyles$2.bgColor.close,
- closeRe: ansiStyles$2.bgColor.closeRe
- };
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
- };
- }
-
- };
- }
-
- const proto = Object.defineProperties(() => {}, styles);
-
- function build(_styles, _empty, key) {
- const builder = function builder() {
- return applyStyle.apply(builder, arguments);
- };
-
- builder._styles = _styles;
- builder._empty = _empty;
- const self = this;
- Object.defineProperty(builder, 'level', {
- enumerable: true,
-
- get() {
- return self.level;
- },
-
- set(level) {
- self.level = level;
- }
-
- });
- Object.defineProperty(builder, 'enabled', {
- enumerable: true,
-
- get() {
- return self.enabled;
- },
-
- set(enabled) {
- self.enabled = enabled;
- }
-
- }); // See below for fix regarding invisible grey/dim combination on Windows
-
- builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is
- // no way to create a function with a different prototype
-
- builder.__proto__ = proto; // eslint-disable-line no-proto
-
- return builder;
- }
-
- function applyStyle() {
- // Support varags, but simply cast to string in case there's only one arg
- const args = arguments;
- const argsLen = args.length;
- let str = String(arguments[0]);
-
- if (argsLen === 0) {
- return '';
- }
-
- if (argsLen > 1) {
- // Don't slice `arguments`, it prevents V8 optimizations
- for (let a = 1; a < argsLen; a++) {
- str += ' ' + args[a];
- }
- }
-
- if (!this.enabled || this.level <= 0 || !str) {
- return this._empty ? '' : str;
- } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
- // see https://github.com/chalk/chalk/issues/58
- // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
-
-
- const originalDim = ansiStyles$2.dim.open;
-
- if (isSimpleWindowsTerm && this.hasGrey) {
- ansiStyles$2.dim.open = '';
- }
-
- for (const code of this._styles.slice().reverse()) {
- // Replace any instances already present with a re-opening code
- // otherwise only the part of the string until said closing code
- // will be colored, and the rest will simply be 'plain'.
- str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen
- // after next line to fix a bleed issue on macOS
- // https://github.com/chalk/chalk/pull/92
-
- str = str.replace(/\r?\n/g, "".concat(code.close, "$&").concat(code.open));
- } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
-
-
- ansiStyles$2.dim.open = originalDim;
- return str;
- }
-
- function chalkTag(chalk, strings) {
- if (!Array.isArray(strings)) {
- // If chalk() was called by itself or with a string,
- // return the string itself as a string.
- return [].slice.call(arguments, 1).join(' ');
- }
-
- const args = [].slice.call(arguments, 2);
- const parts = [strings.raw[0]];
-
- for (let i = 1; i < strings.length; i++) {
- parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
- parts.push(String(strings.raw[i]));
- }
-
- return templates$2(chalk, parts.join(''));
- }
-
- Object.defineProperties(Chalk.prototype, styles);
- module.exports = Chalk(); // eslint-disable-line new-cap
-
- module.exports.supportsColor = stdoutColor;
- module.exports.default = module.exports; // For TypeScript
- });
- var chalk_1$1 = chalk$2.supportsColor;
-
- var lib$1 = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.shouldHighlight = shouldHighlight;
- exports.getChalk = getChalk;
- exports.default = highlight;
-
- var _jsTokens = _interopRequireWildcard(jsTokens);
-
- var _esutils = _interopRequireDefault(utils$1);
-
- var _chalk = _interopRequireDefault(chalk$2);
-
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
-
- function _getRequireWildcardCache() {
- if (typeof WeakMap !== "function") return null;
- var cache = new WeakMap();
-
- _getRequireWildcardCache = function _getRequireWildcardCache() {
- return cache;
- };
-
- return cache;
- }
-
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- }
-
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
- return {
- default: obj
- };
- }
-
- var cache = _getRequireWildcardCache();
-
- if (cache && cache.has(obj)) {
- return cache.get(obj);
- }
-
- var newObj = {};
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
-
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
-
- if (desc && (desc.get || desc.set)) {
- Object.defineProperty(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
-
- newObj.default = obj;
-
- if (cache) {
- cache.set(obj, newObj);
- }
-
- return newObj;
- }
-
- function getDefs(chalk) {
- return {
- keyword: chalk.cyan,
- capitalized: chalk.yellow,
- jsx_tag: chalk.yellow,
- punctuator: chalk.yellow,
- number: chalk.magenta,
- string: chalk.green,
- regex: chalk.magenta,
- comment: chalk.grey,
- invalid: chalk.white.bgRed.bold
- };
- }
-
- const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
- const JSX_TAG = /^[a-z][\w-]*$/i;
- const BRACKET = /^[()[\]{}]$/;
-
- function getTokenType(match) {
- const [offset, text] = match.slice(-2);
- const token = (0, _jsTokens.matchToToken)(match);
-
- if (token.type === "name") {
- if (_esutils.default.keyword.isReservedWordES6(token.value)) {
- return "keyword";
- }
-
- if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
- return "jsx_tag";
- }
-
- if (token.value[0] !== token.value[0].toLowerCase()) {
- return "capitalized";
- }
- }
-
- if (token.type === "punctuator" && BRACKET.test(token.value)) {
- return "bracket";
- }
-
- if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
- return "punctuator";
- }
-
- return token.type;
- }
-
- function highlightTokens(defs, text) {
- return text.replace(_jsTokens.default, function (...args) {
- const type = getTokenType(args);
- const colorize = defs[type];
-
- if (colorize) {
- return args[0].split(NEWLINE).map(str => colorize(str)).join("\n");
- } else {
- return args[0];
- }
- });
- }
-
- function shouldHighlight(options) {
- return _chalk.default.supportsColor || options.forceColor;
- }
-
- function getChalk(options) {
- let chalk = _chalk.default;
-
- if (options.forceColor) {
- chalk = new _chalk.default.constructor({
- enabled: true,
- level: 1
- });
- }
-
- return chalk;
- }
-
- function highlight(code, options = {}) {
- if (shouldHighlight(options)) {
- const chalk = getChalk(options);
- const defs = getDefs(chalk);
- return highlightTokens(defs, code);
- } else {
- return code;
- }
- }
- });
- unwrapExports(lib$1);
- var lib_1 = lib$1.shouldHighlight;
- var lib_2 = lib$1.getChalk;
-
- var lib$2 = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.codeFrameColumns = codeFrameColumns;
- exports.default = _default;
-
- var _highlight = _interopRequireWildcard(lib$1);
-
- function _getRequireWildcardCache() {
- if (typeof WeakMap !== "function") return null;
- var cache = new WeakMap();
-
- _getRequireWildcardCache = function _getRequireWildcardCache() {
- return cache;
- };
-
- return cache;
- }
-
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- }
-
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
- return {
- default: obj
- };
- }
-
- var cache = _getRequireWildcardCache();
-
- if (cache && cache.has(obj)) {
- return cache.get(obj);
- }
-
- var newObj = {};
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
-
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
-
- if (desc && (desc.get || desc.set)) {
- Object.defineProperty(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
-
- newObj.default = obj;
-
- if (cache) {
- cache.set(obj, newObj);
- }
-
- return newObj;
- }
-
- let deprecationWarningShown = false;
-
- function getDefs(chalk) {
- return {
- gutter: chalk.grey,
- marker: chalk.red.bold,
- message: chalk.red.bold
- };
- }
-
- const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
-
- function getMarkerLines(loc, source, opts) {
- const startLoc = Object.assign({
- column: 0,
- line: -1
- }, loc.start);
- const endLoc = Object.assign({}, startLoc, {}, loc.end);
- const {
- linesAbove = 2,
- linesBelow = 3
- } = opts || {};
- const startLine = startLoc.line;
- const startColumn = startLoc.column;
- const endLine = endLoc.line;
- const endColumn = endLoc.column;
- let start = Math.max(startLine - (linesAbove + 1), 0);
- let end = Math.min(source.length, endLine + linesBelow);
-
- if (startLine === -1) {
- start = 0;
- }
-
- if (endLine === -1) {
- end = source.length;
- }
-
- const lineDiff = endLine - startLine;
- const markerLines = {};
-
- if (lineDiff) {
- for (let i = 0; i <= lineDiff; i++) {
- const lineNumber = i + startLine;
-
- if (!startColumn) {
- markerLines[lineNumber] = true;
- } else if (i === 0) {
- const sourceLength = source[lineNumber - 1].length;
- markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
- } else if (i === lineDiff) {
- markerLines[lineNumber] = [0, endColumn];
- } else {
- const sourceLength = source[lineNumber - i].length;
- markerLines[lineNumber] = [0, sourceLength];
- }
- }
- } else {
- if (startColumn === endColumn) {
- if (startColumn) {
- markerLines[startLine] = [startColumn, 0];
- } else {
- markerLines[startLine] = true;
- }
- } else {
- markerLines[startLine] = [startColumn, endColumn - startColumn];
- }
- }
-
- return {
- start,
- end,
- markerLines
- };
- }
-
- function codeFrameColumns(rawLines, loc, opts = {}) {
- const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
- const chalk = (0, _highlight.getChalk)(opts);
- const defs = getDefs(chalk);
-
- const maybeHighlight = (chalkFn, string) => {
- return highlighted ? chalkFn(string) : string;
- };
-
- const lines = rawLines.split(NEWLINE);
- const {
- start,
- end,
- markerLines
- } = getMarkerLines(loc, lines, opts);
- const hasColumns = loc.start && typeof loc.start.column === "number";
- const numberMaxWidth = String(end).length;
- const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
- let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
- const number = start + 1 + index;
- const paddedNumber = " ".concat(number).slice(-numberMaxWidth);
- const gutter = " ".concat(paddedNumber, " | ");
- const hasMarker = markerLines[number];
- const lastMarkerLine = !markerLines[number + 1];
-
- if (hasMarker) {
- let markerLine = "";
-
- if (Array.isArray(hasMarker)) {
- const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
- const numberOfMarkers = hasMarker[1] || 1;
- markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
-
- if (lastMarkerLine && opts.message) {
- markerLine += " " + maybeHighlight(defs.message, opts.message);
- }
- }
-
- return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
- } else {
- return " ".concat(maybeHighlight(defs.gutter, gutter)).concat(line);
- }
- }).join("\n");
-
- if (opts.message && !hasColumns) {
- frame = "".concat(" ".repeat(numberMaxWidth + 1)).concat(opts.message, "\n").concat(frame);
- }
-
- if (highlighted) {
- return chalk.reset(frame);
- } else {
- return frame;
- }
- }
-
- function _default(rawLines, lineNumber, colNumber, opts = {}) {
- if (!deprecationWarningShown) {
- deprecationWarningShown = true;
- const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
-
- if (process.emitWarning) {
- process.emitWarning(message, "DeprecationWarning");
- } else {
- const deprecationError = new Error(message);
- deprecationError.name = "DeprecationWarning";
- console.warn(new Error(message));
- }
- }
-
- colNumber = Math.max(colNumber, 0);
- const location = {
- start: {
- column: colNumber,
- line: lineNumber
- }
- };
- return codeFrameColumns(rawLines, location, opts);
- }
- });
- unwrapExports(lib$2);
- var lib_1$1 = lib$2.codeFrameColumns;
-
- const {
- ConfigError: ConfigError$1
- } = errors;
- const {
- locStart: locStart$1,
- locEnd: locEnd$1
- } = loc; // Use defineProperties()/getOwnPropertyDescriptor() to prevent
- // triggering the parsers getters.
-
- const ownNames = Object.getOwnPropertyNames;
- const ownDescriptor = Object.getOwnPropertyDescriptor;
-
- function getParsers(options) {
- const parsers = {};
-
- for (const plugin of options.plugins) {
- if (!plugin.parsers) {
- continue;
- }
-
- for (const name of ownNames(plugin.parsers)) {
- Object.defineProperty(parsers, name, ownDescriptor(plugin.parsers, name));
- }
- }
-
- return parsers;
- }
-
- function resolveParser(opts, parsers) {
- parsers = parsers || getParsers(opts);
-
- if (typeof opts.parser === "function") {
- // Custom parser API always works with JavaScript.
- return {
- parse: opts.parser,
- astFormat: "estree",
- locStart: locStart$1,
- locEnd: locEnd$1
- };
- }
-
- if (typeof opts.parser === "string") {
- if (Object.prototype.hasOwnProperty.call(parsers, opts.parser)) {
- return parsers[opts.parser];
- }
- /* istanbul ignore next */
-
-
- {
- throw new ConfigError$1("Couldn't resolve parser \"".concat(opts.parser, "\". Parsers must be explicitly added to the standalone bundle."));
- }
- }
- }
-
- function parse(text, opts) {
- const parsers = getParsers(opts); // Create a new object {parserName: parseFn}. Uses defineProperty() to only call
- // the parsers getters when actually calling the parser `parse` function.
-
- const parsersForCustomParserApi = Object.keys(parsers).reduce((object, parserName) => Object.defineProperty(object, parserName, {
- enumerable: true,
-
- get() {
- return parsers[parserName].parse;
- }
-
- }), {});
- const parser = resolveParser(opts, parsers);
-
- try {
- if (parser.preprocess) {
- text = parser.preprocess(text, opts);
- }
-
- return {
- text,
- ast: parser.parse(text, parsersForCustomParserApi, opts)
- };
- } catch (error) {
- const {
- loc
- } = error;
-
- if (loc) {
- const codeFrame = lib$2;
- error.codeFrame = codeFrame.codeFrameColumns(text, loc, {
- highlightCode: true
- });
- error.message += "\n" + error.codeFrame;
- throw error;
- }
- /* istanbul ignore next */
-
-
- throw error.stack;
- }
- }
-
- var parser = {
- parse,
- resolveParser
- };
-
- const {
- UndefinedParserError: UndefinedParserError$1
- } = errors;
- const {
- getSupportInfo: getSupportInfo$1
- } = support;
- const {
- resolveParser: resolveParser$1
- } = parser;
- const hiddenDefaults = {
- astFormat: "estree",
- printer: {},
- originalText: undefined,
- locStart: null,
- locEnd: null
- }; // Copy options and fill in default values.
-
- function normalize$1(options, opts) {
- opts = opts || {};
- const rawOptions = Object.assign({}, options);
- const supportOptions = getSupportInfo$1({
- plugins: options.plugins,
- showUnreleased: true,
- showDeprecated: true
- }).options;
- const defaults = Object.assign({}, hiddenDefaults, {}, fromPairs_1(supportOptions.filter(optionInfo => optionInfo.default !== undefined).map(option => [option.name, option.default])));
-
- if (!rawOptions.parser) {
- if (!rawOptions.filepath) {
- const logger = opts.logger || console;
- 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.");
- rawOptions.parser = "babel";
- } else {
- rawOptions.parser = inferParser(rawOptions.filepath, rawOptions.plugins);
-
- if (!rawOptions.parser) {
- throw new UndefinedParserError$1("No parser could be inferred for file: ".concat(rawOptions.filepath));
- }
- }
- }
-
- const parser = resolveParser$1(optionsNormalizer.normalizeApiOptions(rawOptions, [supportOptions.find(x => x.name === "parser")], {
- passThrough: true,
- logger: false
- }));
- rawOptions.astFormat = parser.astFormat;
- rawOptions.locEnd = parser.locEnd;
- rawOptions.locStart = parser.locStart;
- const plugin = getPlugin(rawOptions);
- rawOptions.printer = plugin.printers[rawOptions.astFormat];
- const pluginDefaults = supportOptions.filter(optionInfo => optionInfo.pluginDefaults && optionInfo.pluginDefaults[plugin.name] !== undefined).reduce((reduced, optionInfo) => Object.assign(reduced, {
- [optionInfo.name]: optionInfo.pluginDefaults[plugin.name]
- }), {});
- const mixedDefaults = Object.assign({}, defaults, {}, pluginDefaults);
- Object.keys(mixedDefaults).forEach(k => {
- if (rawOptions[k] == null) {
- rawOptions[k] = mixedDefaults[k];
- }
- });
-
- if (rawOptions.parser === "json") {
- rawOptions.trailingComma = "none";
- }
-
- return optionsNormalizer.normalizeApiOptions(rawOptions, supportOptions, Object.assign({
- passThrough: Object.keys(hiddenDefaults)
- }, opts));
- }
-
- function getPlugin(options) {
- const {
- astFormat
- } = options;
-
- if (!astFormat) {
- throw new Error("getPlugin() requires astFormat to be set");
- }
-
- const printerPlugin = options.plugins.find(plugin => plugin.printers && plugin.printers[astFormat]);
-
- if (!printerPlugin) {
- throw new Error("Couldn't find plugin for AST format \"".concat(astFormat, "\""));
- }
-
- return printerPlugin;
- }
-
- function getInterpreter(filepath) {
- if (typeof filepath !== "string") {
- return "";
- }
-
- let fd;
-
- try {
- fd = fs.openSync(filepath, "r");
- } catch (err) {
- // istanbul ignore next
- return "";
- }
-
- try {
- const liner = new readlines(fd);
- const firstLine = liner.next().toString("utf8"); // #!/bin/env node, #!/usr/bin/env node
-
- const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/);
-
- if (m1) {
- return m1[1];
- } // #!/bin/node, #!/usr/bin/node, #!/usr/local/bin/node
-
-
- const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/);
-
- if (m2) {
- return m2[1];
- }
-
- return "";
- } catch (err) {
- // There are some weird cases where paths are missing, causing Jest
- // failures. It's unclear what these correspond to in the real world.
- return "";
- } finally {
- try {
- // There are some weird cases where paths are missing, causing Jest
- // failures. It's unclear what these correspond to in the real world.
- fs.closeSync(fd);
- } catch (err) {// nop
- }
- }
- }
-
- function inferParser(filepath, plugins) {
- const filename = path.basename(filepath).toLowerCase();
- const languages = getSupportInfo$1({
- plugins
- }).languages.filter(language => language.since !== null); // If the file has no extension, we can try to infer the language from the
- // interpreter in the shebang line, if any; but since this requires FS access,
- // do it last.
-
- let language = languages.find(language => language.extensions && language.extensions.some(extension => filename.endsWith(extension)) || language.filenames && language.filenames.find(name => name.toLowerCase() === filename));
-
- if (!language && !filename.includes(".")) {
- const interpreter = getInterpreter(filepath);
- language = languages.find(language => language.interpreters && language.interpreters.includes(interpreter));
- }
-
- return language && language.parsers[0];
- }
-
- var options$1 = {
- normalize: normalize$1,
- hiddenDefaults,
- inferParser
- };
-
- function massageAST(ast, options, parent) {
- if (Array.isArray(ast)) {
- return ast.map(e => massageAST(e, options, parent)).filter(Boolean);
- }
-
- if (!ast || typeof ast !== "object") {
- return ast;
- }
-
- const newObj = {};
-
- for (const key of Object.keys(ast)) {
- if (typeof ast[key] !== "function") {
- newObj[key] = massageAST(ast[key], options, ast);
- }
- }
-
- if (options.printer.massageAstNode) {
- const result = options.printer.massageAstNode(ast, newObj, parent);
-
- if (result === null) {
- return undefined;
- }
-
- if (result) {
- return result;
- }
- }
-
- return newObj;
- }
-
- var massageAst = massageAST;
-
- function assert() {}
-
- assert.ok = function () {};
-
- assert.strictEqual = function () {};
-
- /**
- * @param {Doc[]} parts
- * @returns Doc
- */
-
-
- function concat(parts) {
- // access the internals of a document directly.
- // if(parts.length === 1) {
- // // If it's a single document, no need to concat it.
- // return parts[0];
- // }
-
-
- return {
- type: "concat",
- parts
- };
- }
- /**
- * @param {Doc} contents
- * @returns Doc
- */
-
-
- function indent(contents) {
-
- return {
- type: "indent",
- contents
- };
- }
- /**
- * @param {number} n
- * @param {Doc} contents
- * @returns Doc
- */
-
-
- function align(n, contents) {
-
- return {
- type: "align",
- contents,
- n
- };
- }
- /**
- * @param {Doc} contents
- * @param {object} [opts] - TBD ???
- * @returns Doc
- */
-
-
- function group(contents, opts) {
- opts = opts || {};
-
- return {
- type: "group",
- id: opts.id,
- contents,
- break: !!opts.shouldBreak,
- expandedStates: opts.expandedStates
- };
- }
- /**
- * @param {Doc} contents
- * @returns Doc
- */
-
-
- function dedentToRoot(contents) {
- return align(-Infinity, contents);
- }
- /**
- * @param {Doc} contents
- * @returns Doc
- */
-
-
- function markAsRoot(contents) {
- // @ts-ignore - TBD ???:
- return align({
- type: "root"
- }, contents);
- }
- /**
- * @param {Doc} contents
- * @returns Doc
- */
-
-
- function dedent(contents) {
- return align(-1, contents);
- }
- /**
- * @param {Doc[]} states
- * @param {object} [opts] - TBD ???
- * @returns Doc
- */
-
-
- function conditionalGroup(states, opts) {
- return group(states[0], Object.assign({}, opts, {
- expandedStates: states
- }));
- }
- /**
- * @param {Doc[]} parts
- * @returns Doc
- */
-
-
- function fill(parts) {
-
- return {
- type: "fill",
- parts
- };
- }
- /**
- * @param {Doc} [breakContents]
- * @param {Doc} [flatContents]
- * @param {object} [opts] - TBD ???
- * @returns Doc
- */
-
-
- function ifBreak(breakContents, flatContents, opts) {
- opts = opts || {};
-
- return {
- type: "if-break",
- breakContents,
- flatContents,
- groupId: opts.groupId
- };
- }
- /**
- * @param {Doc} contents
- * @returns Doc
- */
-
-
- function lineSuffix(contents) {
-
- return {
- type: "line-suffix",
- contents
- };
- }
-
- const lineSuffixBoundary = {
- type: "line-suffix-boundary"
- };
- const breakParent = {
- type: "break-parent"
- };
- const trim = {
- type: "trim"
- };
- const line = {
- type: "line"
- };
- const softline = {
- type: "line",
- soft: true
- };
- const hardline = concat([{
- type: "line",
- hard: true
- }, breakParent]);
- const literalline = concat([{
- type: "line",
- hard: true,
- literal: true
- }, breakParent]);
- const cursor = {
- type: "cursor",
- placeholder: Symbol("cursor")
- };
- /**
- * @param {Doc} sep
- * @param {Doc[]} arr
- * @returns Doc
- */
-
- function join(sep, arr) {
- const res = [];
-
- for (let i = 0; i < arr.length; i++) {
- if (i !== 0) {
- res.push(sep);
- }
-
- res.push(arr[i]);
- }
-
- return concat(res);
- }
- /**
- * @param {Doc} doc
- * @param {number} size
- * @param {number} tabWidth
- */
-
-
- function addAlignmentToDoc(doc, size, tabWidth) {
- let aligned = doc;
-
- if (size > 0) {
- // Use indent to add tabs for all the levels of tabs we need
- for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
- aligned = indent(aligned);
- } // Use align for all the spaces that are needed
-
-
- aligned = align(size % tabWidth, aligned); // size is absolute from 0 and not relative to the current
- // indentation, so we use -Infinity to reset the indentation to 0
-
- aligned = align(-Infinity, aligned);
- }
-
- return aligned;
- }
-
- var docBuilders = {
- concat,
- join,
- line,
- softline,
- hardline,
- literalline,
- group,
- conditionalGroup,
- fill,
- lineSuffix,
- lineSuffixBoundary,
- cursor,
- breakParent,
- ifBreak,
- trim,
- indent,
- align,
- addAlignmentToDoc,
- markAsRoot,
- dedentToRoot,
- dedent
- };
-
- var ansiRegex = ({
- onlyFirst = false
- } = {}) => {
- const pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|');
- return new RegExp(pattern, onlyFirst ? undefined : 'g');
- };
-
- var stripAnsi = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
-
- /* eslint-disable yoda */
-
- const isFullwidthCodePoint = codePoint => {
- if (Number.isNaN(codePoint)) {
- return false;
- } // Code points are derived from:
- // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
-
-
- if (codePoint >= 0x1100 && (codePoint <= 0x115F || // Hangul Jamo
- codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
- codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
- // CJK Radicals Supplement .. Enclosed CJK Letters and Months
- 0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
- 0x3250 <= codePoint && codePoint <= 0x4DBF || // CJK Unified Ideographs .. Yi Radicals
- 0x4E00 <= codePoint && codePoint <= 0xA4C6 || // Hangul Jamo Extended-A
- 0xA960 <= codePoint && codePoint <= 0xA97C || // Hangul Syllables
- 0xAC00 <= codePoint && codePoint <= 0xD7A3 || // CJK Compatibility Ideographs
- 0xF900 <= codePoint && codePoint <= 0xFAFF || // Vertical Forms
- 0xFE10 <= codePoint && codePoint <= 0xFE19 || // CJK Compatibility Forms .. Small Form Variants
- 0xFE30 <= codePoint && codePoint <= 0xFE6B || // Halfwidth and Fullwidth Forms
- 0xFF01 <= codePoint && codePoint <= 0xFF60 || 0xFFE0 <= codePoint && codePoint <= 0xFFE6 || // Kana Supplement
- 0x1B000 <= codePoint && codePoint <= 0x1B001 || // Enclosed Ideographic Supplement
- 0x1F200 <= codePoint && codePoint <= 0x1F251 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
- 0x20000 <= codePoint && codePoint <= 0x3FFFD)) {
- return true;
- }
-
- return false;
- };
-
- var isFullwidthCodePoint_1 = isFullwidthCodePoint;
- var default_1$1 = isFullwidthCodePoint;
- isFullwidthCodePoint_1.default = default_1$1;
-
- var emojiRegex = function emojiRegex() {
- // https://mths.be/emoji
- 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;
- };
-
- const stringWidth = string => {
- string = string.replace(emojiRegex(), ' ');
-
- if (typeof string !== 'string' || string.length === 0) {
- return 0;
- }
-
- string = stripAnsi(string);
- let width = 0;
-
- for (let i = 0; i < string.length; i++) {
- const code = string.codePointAt(i); // Ignore control characters
-
- if (code <= 0x1F || code >= 0x7F && code <= 0x9F) {
- continue;
- } // Ignore combining characters
-
-
- if (code >= 0x300 && code <= 0x36F) {
- continue;
- } // Surrogates
-
-
- if (code > 0xFFFF) {
- i++;
- }
-
- width += isFullwidthCodePoint_1(code) ? 2 : 1;
- }
-
- return width;
- };
-
- var stringWidth_1 = stringWidth; // TODO: remove this in the next major version
-
- var default_1$2 = stringWidth;
- stringWidth_1.default = default_1$2;
-
- const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
-
- var escapeStringRegexp$2 = string => {
- if (typeof string !== 'string') {
- throw new TypeError('Expected a string');
- }
-
- return string.replace(matchOperatorsRegex, '\\$&');
- };
-
- const notAsciiRegex = /[^\x20-\x7F]/;
-
- function getPenultimate(arr) {
- if (arr.length > 1) {
- return arr[arr.length - 2];
- }
-
- return null;
- }
- /**
- * @typedef {{backwards?: boolean}} SkipOptions
- */
-
- /**
- * @param {string | RegExp} chars
- * @returns {(text: string, index: number | false, opts?: SkipOptions) => number | false}
- */
-
-
- function skip(chars) {
- return (text, index, opts) => {
- const backwards = opts && opts.backwards; // Allow `skip` functions to be threaded together without having
- // to check for failures (did someone say monads?).
-
- if (index === false) {
- return false;
- }
-
- const {
- length
- } = text;
- let cursor = index;
-
- while (cursor >= 0 && cursor < length) {
- const c = text.charAt(cursor);
-
- if (chars instanceof RegExp) {
- if (!chars.test(c)) {
- return cursor;
- }
- } else if (!chars.includes(c)) {
- return cursor;
- }
-
- backwards ? cursor-- : cursor++;
- }
-
- if (cursor === -1 || cursor === length) {
- // If we reached the beginning or end of the file, return the
- // out-of-bounds cursor. It's up to the caller to handle this
- // correctly. We don't want to indicate `false` though if it
- // actually skipped valid characters.
- return cursor;
- }
-
- return false;
- };
- }
- /**
- * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
- */
-
-
- const skipWhitespace = skip(/\s/);
- /**
- * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
- */
-
- const skipSpaces = skip(" \t");
- /**
- * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
- */
-
- const skipToLineEnd = skip(",; \t");
- /**
- * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
- */
-
- const skipEverythingButNewLine = skip(/[^\r\n]/);
- /**
- * @param {string} text
- * @param {number | false} index
- * @returns {number | false}
- */
-
- function skipInlineComment(text, index) {
- if (index === false) {
- return false;
- }
-
- if (text.charAt(index) === "/" && text.charAt(index + 1) === "*") {
- for (let i = index + 2; i < text.length; ++i) {
- if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
- return i + 2;
- }
- }
- }
-
- return index;
- }
- /**
- * @param {string} text
- * @param {number | false} index
- * @returns {number | false}
- */
-
-
- function skipTrailingComment(text, index) {
- if (index === false) {
- return false;
- }
-
- if (text.charAt(index) === "/" && text.charAt(index + 1) === "/") {
- return skipEverythingButNewLine(text, index);
- }
-
- return index;
- } // This one doesn't use the above helper function because it wants to
- // test \r\n in order and `skip` doesn't support ordering and we only
- // want to skip one newline. It's simple to implement.
-
- /**
- * @param {string} text
- * @param {number | false} index
- * @param {SkipOptions=} opts
- * @returns {number | false}
- */
-
-
- function skipNewline(text, index, opts) {
- const backwards = opts && opts.backwards;
-
- if (index === false) {
- return false;
- }
-
- const atIndex = text.charAt(index);
-
- if (backwards) {
- if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
- return index - 2;
- }
-
- if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
- return index - 1;
- }
- } else {
- if (atIndex === "\r" && text.charAt(index + 1) === "\n") {
- return index + 2;
- }
-
- if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
- return index + 1;
- }
- }
-
- return index;
- }
- /**
- * @param {string} text
- * @param {number} index
- * @param {SkipOptions=} opts
- * @returns {boolean}
- */
-
-
- function hasNewline(text, index, opts) {
- opts = opts || {};
- const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
- const idx2 = skipNewline(text, idx, opts);
- return idx !== idx2;
- }
- /**
- * @param {string} text
- * @param {number} start
- * @param {number} end
- * @returns {boolean}
- */
-
-
- function hasNewlineInRange(text, start, end) {
- for (let i = start; i < end; ++i) {
- if (text.charAt(i) === "\n") {
- return true;
- }
- }
-
- return false;
- } // Note: this function doesn't ignore leading comments unlike isNextLineEmpty
-
- /**
- * @template N
- * @param {string} text
- * @param {N} node
- * @param {(node: N) => number} locStart
- */
-
-
- function isPreviousLineEmpty(text, node, locStart) {
- /** @type {number | false} */
- let idx = locStart(node) - 1;
- idx = skipSpaces(text, idx, {
- backwards: true
- });
- idx = skipNewline(text, idx, {
- backwards: true
- });
- idx = skipSpaces(text, idx, {
- backwards: true
- });
- const idx2 = skipNewline(text, idx, {
- backwards: true
- });
- return idx !== idx2;
- }
- /**
- * @param {string} text
- * @param {number} index
- * @returns {boolean}
- */
-
-
- function isNextLineEmptyAfterIndex(text, index) {
- /** @type {number | false} */
- let oldIdx = null;
- /** @type {number | false} */
-
- let idx = index;
-
- while (idx !== oldIdx) {
- // We need to skip all the potential trailing inline comments
- oldIdx = idx;
- idx = skipToLineEnd(text, idx);
- idx = skipInlineComment(text, idx);
- idx = skipSpaces(text, idx);
- }
-
- idx = skipTrailingComment(text, idx);
- idx = skipNewline(text, idx);
- return idx !== false && hasNewline(text, idx);
- }
- /**
- * @template N
- * @param {string} text
- * @param {N} node
- * @param {(node: N) => number} locEnd
- * @returns {boolean}
- */
-
-
- function isNextLineEmpty(text, node, locEnd) {
- return isNextLineEmptyAfterIndex(text, locEnd(node));
- }
- /**
- * @param {string} text
- * @param {number} idx
- * @returns {number | false}
- */
-
-
- function getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, idx) {
- /** @type {number | false} */
- let oldIdx = null;
- /** @type {number | false} */
-
- let nextIdx = idx;
-
- while (nextIdx !== oldIdx) {
- oldIdx = nextIdx;
- nextIdx = skipSpaces(text, nextIdx);
- nextIdx = skipInlineComment(text, nextIdx);
- nextIdx = skipTrailingComment(text, nextIdx);
- nextIdx = skipNewline(text, nextIdx);
- }
-
- return nextIdx;
- }
- /**
- * @template N
- * @param {string} text
- * @param {N} node
- * @param {(node: N) => number} locEnd
- * @returns {number | false}
- */
-
-
- function getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
- return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(node));
- }
- /**
- * @template N
- * @param {string} text
- * @param {N} node
- * @param {(node: N) => number} locEnd
- * @returns {string}
- */
-
-
- function getNextNonSpaceNonCommentCharacter(text, node, locEnd) {
- return text.charAt( // @ts-ignore => TBD: can return false, should we define a fallback?
- getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd));
- }
- /**
- * @param {string} text
- * @param {number} index
- * @param {SkipOptions=} opts
- * @returns {boolean}
- */
-
-
- function hasSpaces(text, index, opts) {
- opts = opts || {};
- const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
- return idx !== index;
- }
- /**
- * @param {{range?: [number, number], start?: number}} node
- * @param {number} index
- */
-
-
- function setLocStart(node, index) {
- if (node.range) {
- node.range[0] = index;
- } else {
- node.start = index;
- }
- }
- /**
- * @param {{range?: [number, number], end?: number}} node
- * @param {number} index
- */
-
-
- function setLocEnd(node, index) {
- if (node.range) {
- node.range[1] = index;
- } else {
- node.end = index;
- }
- }
-
- const PRECEDENCE = {};
- [["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].forEach((tier, i) => {
- tier.forEach(op => {
- PRECEDENCE[op] = i;
- });
- });
-
- function getPrecedence(op) {
- return PRECEDENCE[op];
- }
-
- const equalityOperators = {
- "==": true,
- "!=": true,
- "===": true,
- "!==": true
- };
- const multiplicativeOperators = {
- "*": true,
- "/": true,
- "%": true
- };
- const bitshiftOperators = {
- ">>": true,
- ">>>": true,
- "<<": true
- };
-
- function shouldFlatten(parentOp, nodeOp) {
- if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) {
- return false;
- } // ** is right-associative
- // x ** y ** z --> x ** (y ** z)
-
-
- if (parentOp === "**") {
- return false;
- } // x == y == z --> (x == y) == z
-
-
- if (equalityOperators[parentOp] && equalityOperators[nodeOp]) {
- return false;
- } // x * y % z --> (x * y) % z
-
-
- if (nodeOp === "%" && multiplicativeOperators[parentOp] || parentOp === "%" && multiplicativeOperators[nodeOp]) {
- return false;
- } // x * y / z --> (x * y) / z
- // x / y * z --> (x / y) * z
-
-
- if (nodeOp !== parentOp && multiplicativeOperators[nodeOp] && multiplicativeOperators[parentOp]) {
- return false;
- } // x << y << z --> (x << y) << z
-
-
- if (bitshiftOperators[parentOp] && bitshiftOperators[nodeOp]) {
- return false;
- }
-
- return true;
- }
-
- function isBitwiseOperator(operator) {
- return !!bitshiftOperators[operator] || operator === "|" || operator === "^" || operator === "&";
- } // Tests if an expression starts with `{`, or (if forbidFunctionClassAndDoExpr
- // holds) `function`, `class`, or `do {}`. Will be overzealous if there's
- // already necessary grouping parentheses.
-
-
- function startsWithNoLookaheadToken(node, forbidFunctionClassAndDoExpr) {
- node = getLeftMost(node);
-
- switch (node.type) {
- case "FunctionExpression":
- case "ClassExpression":
- case "DoExpression":
- return forbidFunctionClassAndDoExpr;
-
- case "ObjectExpression":
- return true;
-
- case "MemberExpression":
- case "OptionalMemberExpression":
- return startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
-
- case "TaggedTemplateExpression":
- if (node.tag.type === "FunctionExpression") {
- // IIFEs are always already parenthesized
- return false;
- }
-
- return startsWithNoLookaheadToken(node.tag, forbidFunctionClassAndDoExpr);
-
- case "CallExpression":
- case "OptionalCallExpression":
- if (node.callee.type === "FunctionExpression") {
- // IIFEs are always already parenthesized
- return false;
- }
-
- return startsWithNoLookaheadToken(node.callee, forbidFunctionClassAndDoExpr);
-
- case "ConditionalExpression":
- return startsWithNoLookaheadToken(node.test, forbidFunctionClassAndDoExpr);
-
- case "UpdateExpression":
- return !node.prefix && startsWithNoLookaheadToken(node.argument, forbidFunctionClassAndDoExpr);
-
- case "BindExpression":
- return node.object && startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
-
- case "SequenceExpression":
- return startsWithNoLookaheadToken(node.expressions[0], forbidFunctionClassAndDoExpr);
-
- case "TSAsExpression":
- return startsWithNoLookaheadToken(node.expression, forbidFunctionClassAndDoExpr);
-
- default:
- return false;
- }
- }
-
- function getLeftMost(node) {
- if (node.left) {
- return getLeftMost(node.left);
- }
-
- return node;
- }
- /**
- * @param {string} value
- * @param {number} tabWidth
- * @param {number=} startIndex
- * @returns {number}
- */
-
-
- function getAlignmentSize(value, tabWidth, startIndex) {
- startIndex = startIndex || 0;
- let size = 0;
-
- for (let i = startIndex; i < value.length; ++i) {
- if (value[i] === "\t") {
- // Tabs behave in a way that they are aligned to the nearest
- // multiple of tabWidth:
- // 0 -> 4, 1 -> 4, 2 -> 4, 3 -> 4
- // 4 -> 8, 5 -> 8, 6 -> 8, 7 -> 8 ...
- size = size + tabWidth - size % tabWidth;
- } else {
- size++;
- }
- }
-
- return size;
- }
- /**
- * @param {string} value
- * @param {number} tabWidth
- * @returns {number}
- */
-
-
- function getIndentSize(value, tabWidth) {
- const lastNewlineIndex = value.lastIndexOf("\n");
-
- if (lastNewlineIndex === -1) {
- return 0;
- }
-
- return getAlignmentSize( // All the leading whitespaces
- value.slice(lastNewlineIndex + 1).match(/^[ \t]*/)[0], tabWidth);
- }
- /**
- * @typedef {'"' | "'"} Quote
- */
-
- /**
- *
- * @param {string} raw
- * @param {Quote} preferredQuote
- * @returns {Quote}
- */
-
-
- function getPreferredQuote(raw, preferredQuote) {
- // `rawContent` is the string exactly like it appeared in the input source
- // code, without its enclosing quotes.
- const rawContent = raw.slice(1, -1);
- /** @type {{ quote: '"', regex: RegExp }} */
-
- const double = {
- quote: '"',
- regex: /"/g
- };
- /** @type {{ quote: "'", regex: RegExp }} */
-
- const single = {
- quote: "'",
- regex: /'/g
- };
- const preferred = preferredQuote === "'" ? single : double;
- const alternate = preferred === single ? double : single;
- let result = preferred.quote; // If `rawContent` contains at least one of the quote preferred for enclosing
- // the string, we might want to enclose with the alternate quote instead, to
- // minimize the number of escaped quotes.
-
- if (rawContent.includes(preferred.quote) || rawContent.includes(alternate.quote)) {
- const numPreferredQuotes = (rawContent.match(preferred.regex) || []).length;
- const numAlternateQuotes = (rawContent.match(alternate.regex) || []).length;
- result = numPreferredQuotes > numAlternateQuotes ? alternate.quote : preferred.quote;
- }
-
- return result;
- }
-
- function printString(raw, options, isDirectiveLiteral) {
- // `rawContent` is the string exactly like it appeared in the input source
- // code, without its enclosing quotes.
- const rawContent = raw.slice(1, -1); // Check for the alternate quote, to determine if we're allowed to swap
- // the quotes on a DirectiveLiteral.
-
- const canChangeDirectiveQuotes = !rawContent.includes('"') && !rawContent.includes("'");
- /** @type {Quote} */
-
- const enclosingQuote = options.parser === "json" ? '"' : options.__isInHtmlAttribute ? "'" : getPreferredQuote(raw, options.singleQuote ? "'" : '"'); // Directives are exact code unit sequences, which means that you can't
- // change the escape sequences they use.
- // See https://github.com/prettier/prettier/issues/1555
- // and https://tc39.github.io/ecma262/#directive-prologue
-
- if (isDirectiveLiteral) {
- if (canChangeDirectiveQuotes) {
- return enclosingQuote + rawContent + enclosingQuote;
- }
-
- return raw;
- } // It might sound unnecessary to use `makeString` even if the string already
- // is enclosed with `enclosingQuote`, but it isn't. The string could contain
- // unnecessary escapes (such as in `"\'"`). Always using `makeString` makes
- // sure that we consistently output the minimum amount of escaped quotes.
-
-
- return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.embeddedInHtml));
- }
- /**
- * @param {string} rawContent
- * @param {Quote} enclosingQuote
- * @param {boolean=} unescapeUnnecessaryEscapes
- * @returns {string}
- */
-
-
- function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
- const otherQuote = enclosingQuote === '"' ? "'" : '"'; // Matches _any_ escape and unescaped quotes (both single and double).
-
- const regex = /\\([\s\S])|(['"])/g; // Escape and unescape single and double quotes as needed to be able to
- // enclose `rawContent` with `enclosingQuote`.
-
- const newContent = rawContent.replace(regex, (match, escaped, quote) => {
- // If we matched an escape, and the escaped character is a quote of the
- // other type than we intend to enclose the string with, there's no need for
- // it to be escaped, so return it _without_ the backslash.
- if (escaped === otherQuote) {
- return escaped;
- } // If we matched an unescaped quote and it is of the _same_ type as we
- // intend to enclose the string with, it must be escaped, so return it with
- // a backslash.
-
-
- if (quote === enclosingQuote) {
- return "\\" + quote;
- }
-
- if (quote) {
- return quote;
- } // Unescape any unnecessarily escaped character.
- // Adapted from https://github.com/eslint/eslint/blob/de0b4ad7bd820ade41b1f606008bea68683dc11a/lib/rules/no-useless-escape.js#L27
-
-
- return unescapeUnnecessaryEscapes && /^[^\\nrvtbfux\r\n\u2028\u2029"'0-7]$/.test(escaped) ? escaped : "\\" + escaped;
- });
- return enclosingQuote + newContent + enclosingQuote;
- }
-
- function printNumber(rawNumber) {
- return rawNumber.toLowerCase() // Remove unnecessary plus and zeroes from scientific notation.
- .replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/, "$1$2$3") // Remove unnecessary scientific notation (1e0).
- .replace(/^([+-]?[\d.]+)e[+-]?0+$/, "$1") // Make sure numbers always start with a digit.
- .replace(/^([+-])?\./, "$10.") // Remove extraneous trailing decimal zeroes.
- .replace(/(\.\d+?)0+(?=e|$)/, "$1") // Remove trailing dot.
- .replace(/\.(?=e|$)/, "");
- }
- /**
- * @param {string} str
- * @param {string} target
- * @returns {number}
- */
-
-
- function getMaxContinuousCount(str, target) {
- const results = str.match(new RegExp("(".concat(escapeStringRegexp$2(target), ")+"), "g"));
-
- if (results === null) {
- return 0;
- }
-
- return results.reduce((maxCount, result) => Math.max(maxCount, result.length / target.length), 0);
- }
-
- function getMinNotPresentContinuousCount(str, target) {
- const matches = str.match(new RegExp("(".concat(escapeStringRegexp$2(target), ")+"), "g"));
-
- if (matches === null) {
- return 0;
- }
-
- const countPresent = new Map();
- let max = 0;
-
- for (const match of matches) {
- const count = match.length / target.length;
- countPresent.set(count, true);
-
- if (count > max) {
- max = count;
- }
- }
-
- for (let i = 1; i < max; i++) {
- if (!countPresent.get(i)) {
- return i;
- }
- }
-
- return max + 1;
- }
- /**
- * @param {string} text
- * @returns {number}
- */
-
-
- function getStringWidth(text) {
- if (!text) {
- return 0;
- } // shortcut to avoid needless string `RegExp`s, replacements, and allocations within `string-width`
-
-
- if (!notAsciiRegex.test(text)) {
- return text.length;
- }
-
- return stringWidth_1(text);
- }
-
- function hasIgnoreComment(path) {
- const node = path.getValue();
- return hasNodeIgnoreComment(node);
- }
-
- function hasNodeIgnoreComment(node) {
- return node && (node.comments && node.comments.length > 0 && node.comments.some(comment => isNodeIgnoreComment(comment) && !comment.unignore) || node.prettierIgnore);
- }
-
- function isNodeIgnoreComment(comment) {
- return comment.value.trim() === "prettier-ignore";
- }
-
- function addCommentHelper(node, comment) {
- const comments = node.comments || (node.comments = []);
- comments.push(comment);
- comment.printed = false; // For some reason, TypeScript parses `// x` inside of JSXText as a comment
- // We already "print" it via the raw text, we don't need to re-print it as a
- // comment
-
- if (node.type === "JSXText") {
- comment.printed = true;
- }
- }
-
- function addLeadingComment(node, comment) {
- comment.leading = true;
- comment.trailing = false;
- addCommentHelper(node, comment);
- }
-
- function addDanglingComment(node, comment) {
- comment.leading = false;
- comment.trailing = false;
- addCommentHelper(node, comment);
- }
-
- function addTrailingComment(node, comment) {
- comment.leading = false;
- comment.trailing = true;
- addCommentHelper(node, comment);
- }
-
- function isWithinParentArrayProperty(path, propertyName) {
- const node = path.getValue();
- const parent = path.getParentNode();
-
- if (parent == null) {
- return false;
- }
-
- if (!Array.isArray(parent[propertyName])) {
- return false;
- }
-
- const key = path.getName();
- return parent[propertyName][key] === node;
- }
-
- function replaceEndOfLineWith(text, replacement) {
- const parts = [];
-
- for (const part of text.split("\n")) {
- if (parts.length !== 0) {
- parts.push(replacement);
- }
-
- parts.push(part);
- }
-
- return parts;
- }
-
- var util$1 = {
- replaceEndOfLineWith,
- getStringWidth,
- getMaxContinuousCount,
- getMinNotPresentContinuousCount,
- getPrecedence,
- shouldFlatten,
- isBitwiseOperator,
- getPenultimate,
- getLast,
- getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
- getNextNonSpaceNonCommentCharacterIndex,
- getNextNonSpaceNonCommentCharacter,
- skip,
- skipWhitespace,
- skipSpaces,
- skipToLineEnd,
- skipEverythingButNewLine,
- skipInlineComment,
- skipTrailingComment,
- skipNewline,
- isNextLineEmptyAfterIndex,
- isNextLineEmpty,
- isPreviousLineEmpty,
- hasNewline,
- hasNewlineInRange,
- hasSpaces,
- setLocStart,
- setLocEnd,
- startsWithNoLookaheadToken,
- getAlignmentSize,
- getIndentSize,
- getPreferredQuote,
- printString,
- printNumber,
- hasIgnoreComment,
- hasNodeIgnoreComment,
- isNodeIgnoreComment,
- makeString,
- addLeadingComment,
- addDanglingComment,
- addTrailingComment,
- isWithinParentArrayProperty
- };
-
- function guessEndOfLine(text) {
- const index = text.indexOf("\r");
-
- if (index >= 0) {
- return text.charAt(index + 1) === "\n" ? "crlf" : "cr";
- }
-
- return "lf";
- }
-
- function convertEndOfLineToChars(value) {
- switch (value) {
- case "cr":
- return "\r";
-
- case "crlf":
- return "\r\n";
-
- default:
- return "\n";
- }
- }
-
- var endOfLine = {
- guessEndOfLine,
- convertEndOfLineToChars
- };
-
- const {
- getStringWidth: getStringWidth$1
- } = util$1;
- const {
- convertEndOfLineToChars: convertEndOfLineToChars$1
- } = endOfLine;
- const {
- concat: concat$1,
- fill: fill$1,
- cursor: cursor$1
- } = docBuilders;
- /** @type {Record<symbol, typeof MODE_BREAK | typeof MODE_FLAT>} */
-
- let groupModeMap;
- const MODE_BREAK = 1;
- const MODE_FLAT = 2;
-
- function rootIndent() {
- return {
- value: "",
- length: 0,
- queue: []
- };
- }
-
- function makeIndent(ind, options) {
- return generateInd(ind, {
- type: "indent"
- }, options);
- }
-
- function makeAlign(ind, n, options) {
- return n === -Infinity ? ind.root || rootIndent() : n < 0 ? generateInd(ind, {
- type: "dedent"
- }, options) : !n ? ind : n.type === "root" ? Object.assign({}, ind, {
- root: ind
- }) : typeof n === "string" ? generateInd(ind, {
- type: "stringAlign",
- n
- }, options) : generateInd(ind, {
- type: "numberAlign",
- n
- }, options);
- }
-
- function generateInd(ind, newPart, options) {
- const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : ind.queue.concat(newPart);
- let value = "";
- let length = 0;
- let lastTabs = 0;
- let lastSpaces = 0;
-
- for (const part of queue) {
- switch (part.type) {
- case "indent":
- flush();
-
- if (options.useTabs) {
- addTabs(1);
- } else {
- addSpaces(options.tabWidth);
- }
-
- break;
-
- case "stringAlign":
- flush();
- value += part.n;
- length += part.n.length;
- break;
-
- case "numberAlign":
- lastTabs += 1;
- lastSpaces += part.n;
- break;
-
- /* istanbul ignore next */
-
- default:
- throw new Error("Unexpected type '".concat(part.type, "'"));
- }
- }
-
- flushSpaces();
- return Object.assign({}, ind, {
- value,
- length,
- queue
- });
-
- function addTabs(count) {
- value += "\t".repeat(count);
- length += options.tabWidth * count;
- }
-
- function addSpaces(count) {
- value += " ".repeat(count);
- length += count;
- }
-
- function flush() {
- if (options.useTabs) {
- flushTabs();
- } else {
- flushSpaces();
- }
- }
-
- function flushTabs() {
- if (lastTabs > 0) {
- addTabs(lastTabs);
- }
-
- resetLast();
- }
-
- function flushSpaces() {
- if (lastSpaces > 0) {
- addSpaces(lastSpaces);
- }
-
- resetLast();
- }
-
- function resetLast() {
- lastTabs = 0;
- lastSpaces = 0;
- }
- }
-
- function trim$1(out) {
- if (out.length === 0) {
- return 0;
- }
-
- let trimCount = 0; // Trim whitespace at the end of line
-
- while (out.length > 0 && typeof out[out.length - 1] === "string" && out[out.length - 1].match(/^[ \t]*$/)) {
- trimCount += out.pop().length;
- }
-
- if (out.length && typeof out[out.length - 1] === "string") {
- const trimmed = out[out.length - 1].replace(/[ \t]*$/, "");
- trimCount += out[out.length - 1].length - trimmed.length;
- out[out.length - 1] = trimmed;
- }
-
- return trimCount;
- }
-
- function fits(next, restCommands, width, options, mustBeFlat) {
- let restIdx = restCommands.length;
- const cmds = [next]; // `out` is only used for width counting because `trim` requires to look
- // backwards for space characters.
-
- const out = [];
-
- while (width >= 0) {
- if (cmds.length === 0) {
- if (restIdx === 0) {
- return true;
- }
-
- cmds.push(restCommands[restIdx - 1]);
- restIdx--;
- continue;
- }
-
- const [ind, mode, doc] = cmds.pop();
-
- if (typeof doc === "string") {
- out.push(doc);
- width -= getStringWidth$1(doc);
- } else {
- switch (doc.type) {
- case "concat":
- for (let i = doc.parts.length - 1; i >= 0; i--) {
- cmds.push([ind, mode, doc.parts[i]]);
- }
-
- break;
-
- case "indent":
- cmds.push([makeIndent(ind, options), mode, doc.contents]);
- break;
-
- case "align":
- cmds.push([makeAlign(ind, doc.n, options), mode, doc.contents]);
- break;
-
- case "trim":
- width += trim$1(out);
- break;
-
- case "group":
- if (mustBeFlat && doc.break) {
- return false;
- }
-
- cmds.push([ind, doc.break ? MODE_BREAK : mode, doc.contents]);
-
- if (doc.id) {
- groupModeMap[doc.id] = cmds[cmds.length - 1][1];
- }
-
- break;
-
- case "fill":
- for (let i = doc.parts.length - 1; i >= 0; i--) {
- cmds.push([ind, mode, doc.parts[i]]);
- }
-
- break;
-
- case "if-break":
- {
- const groupMode = doc.groupId ? groupModeMap[doc.groupId] : mode;
-
- if (groupMode === MODE_BREAK) {
- if (doc.breakContents) {
- cmds.push([ind, mode, doc.breakContents]);
- }
- }
-
- if (groupMode === MODE_FLAT) {
- if (doc.flatContents) {
- cmds.push([ind, mode, doc.flatContents]);
- }
- }
-
- break;
- }
-
- case "line":
- switch (mode) {
- // fallthrough
- case MODE_FLAT:
- if (!doc.hard) {
- if (!doc.soft) {
- out.push(" ");
- width -= 1;
- }
-
- break;
- }
-
- return true;
-
- case MODE_BREAK:
- return true;
- }
-
- break;
- }
- }
- }
-
- return false;
- }
-
- function printDocToString(doc, options) {
- groupModeMap = {};
- const width = options.printWidth;
- const newLine = convertEndOfLineToChars$1(options.endOfLine);
- let pos = 0; // cmds is basically a stack. We've turned a recursive call into a
- // while loop which is much faster. The while loop below adds new
- // cmds to the array instead of recursively calling `print`.
-
- const cmds = [[rootIndent(), MODE_BREAK, doc]];
- const out = [];
- let shouldRemeasure = false;
- let lineSuffix = [];
-
- while (cmds.length !== 0) {
- const [ind, mode, doc] = cmds.pop();
-
- if (typeof doc === "string") {
- const formatted = newLine !== "\n" && doc.includes("\n") ? doc.replace(/\n/g, newLine) : doc;
- out.push(formatted);
- pos += getStringWidth$1(formatted);
- } else {
- switch (doc.type) {
- case "cursor":
- out.push(cursor$1.placeholder);
- break;
-
- case "concat":
- for (let i = doc.parts.length - 1; i >= 0; i--) {
- cmds.push([ind, mode, doc.parts[i]]);
- }
-
- break;
-
- case "indent":
- cmds.push([makeIndent(ind, options), mode, doc.contents]);
- break;
-
- case "align":
- cmds.push([makeAlign(ind, doc.n, options), mode, doc.contents]);
- break;
-
- case "trim":
- pos -= trim$1(out);
- break;
-
- case "group":
- switch (mode) {
- case MODE_FLAT:
- if (!shouldRemeasure) {
- cmds.push([ind, doc.break ? MODE_BREAK : MODE_FLAT, doc.contents]);
- break;
- }
-
- // fallthrough
-
- case MODE_BREAK:
- {
- shouldRemeasure = false;
- const next = [ind, MODE_FLAT, doc.contents];
- const rem = width - pos;
-
- if (!doc.break && fits(next, cmds, rem, options)) {
- cmds.push(next);
- } else {
- // Expanded states are a rare case where a document
- // can manually provide multiple representations of
- // itself. It provides an array of documents
- // going from the least expanded (most flattened)
- // representation first to the most expanded. If a
- // group has these, we need to manually go through
- // these states and find the first one that fits.
- if (doc.expandedStates) {
- const mostExpanded = doc.expandedStates[doc.expandedStates.length - 1];
-
- if (doc.break) {
- cmds.push([ind, MODE_BREAK, mostExpanded]);
- break;
- } else {
- for (let i = 1; i < doc.expandedStates.length + 1; i++) {
- if (i >= doc.expandedStates.length) {
- cmds.push([ind, MODE_BREAK, mostExpanded]);
- break;
- } else {
- const state = doc.expandedStates[i];
- const cmd = [ind, MODE_FLAT, state];
-
- if (fits(cmd, cmds, rem, options)) {
- cmds.push(cmd);
- break;
- }
- }
- }
- }
- } else {
- cmds.push([ind, MODE_BREAK, doc.contents]);
- }
- }
-
- break;
- }
- }
-
- if (doc.id) {
- groupModeMap[doc.id] = cmds[cmds.length - 1][1];
- }
-
- break;
- // Fills each line with as much code as possible before moving to a new
- // line with the same indentation.
- //
- // Expects doc.parts to be an array of alternating content and
- // whitespace. The whitespace contains the linebreaks.
- //
- // For example:
- // ["I", line, "love", line, "monkeys"]
- // or
- // [{ type: group, ... }, softline, { type: group, ... }]
- //
- // It uses this parts structure to handle three main layout cases:
- // * The first two content items fit on the same line without
- // breaking
- // -> output the first content item and the whitespace "flat".
- // * Only the first content item fits on the line without breaking
- // -> output the first content item "flat" and the whitespace with
- // "break".
- // * Neither content item fits on the line without breaking
- // -> output the first content item and the whitespace with "break".
-
- case "fill":
- {
- const rem = width - pos;
- const {
- parts
- } = doc;
-
- if (parts.length === 0) {
- break;
- }
-
- const [content, whitespace] = parts;
- const contentFlatCmd = [ind, MODE_FLAT, content];
- const contentBreakCmd = [ind, MODE_BREAK, content];
- const contentFits = fits(contentFlatCmd, [], rem, options, true);
-
- if (parts.length === 1) {
- if (contentFits) {
- cmds.push(contentFlatCmd);
- } else {
- cmds.push(contentBreakCmd);
- }
-
- break;
- }
-
- const whitespaceFlatCmd = [ind, MODE_FLAT, whitespace];
- const whitespaceBreakCmd = [ind, MODE_BREAK, whitespace];
-
- if (parts.length === 2) {
- if (contentFits) {
- cmds.push(whitespaceFlatCmd);
- cmds.push(contentFlatCmd);
- } else {
- cmds.push(whitespaceBreakCmd);
- cmds.push(contentBreakCmd);
- }
-
- break;
- } // At this point we've handled the first pair (context, separator)
- // and will create a new fill doc for the rest of the content.
- // Ideally we wouldn't mutate the array here but copying all the
- // elements to a new array would make this algorithm quadratic,
- // which is unusable for large arrays (e.g. large texts in JSX).
-
-
- parts.splice(0, 2);
- const remainingCmd = [ind, mode, fill$1(parts)];
- const secondContent = parts[0];
- const firstAndSecondContentFlatCmd = [ind, MODE_FLAT, concat$1([content, whitespace, secondContent])];
- const firstAndSecondContentFits = fits(firstAndSecondContentFlatCmd, [], rem, options, true);
-
- if (firstAndSecondContentFits) {
- cmds.push(remainingCmd);
- cmds.push(whitespaceFlatCmd);
- cmds.push(contentFlatCmd);
- } else if (contentFits) {
- cmds.push(remainingCmd);
- cmds.push(whitespaceBreakCmd);
- cmds.push(contentFlatCmd);
- } else {
- cmds.push(remainingCmd);
- cmds.push(whitespaceBreakCmd);
- cmds.push(contentBreakCmd);
- }
-
- break;
- }
-
- case "if-break":
- {
- const groupMode = doc.groupId ? groupModeMap[doc.groupId] : mode;
-
- if (groupMode === MODE_BREAK) {
- if (doc.breakContents) {
- cmds.push([ind, mode, doc.breakContents]);
- }
- }
-
- if (groupMode === MODE_FLAT) {
- if (doc.flatContents) {
- cmds.push([ind, mode, doc.flatContents]);
- }
- }
-
- break;
- }
-
- case "line-suffix":
- lineSuffix.push([ind, mode, doc.contents]);
- break;
-
- case "line-suffix-boundary":
- if (lineSuffix.length > 0) {
- cmds.push([ind, mode, {
- type: "line",
- hard: true
- }]);
- }
-
- break;
-
- case "line":
- switch (mode) {
- case MODE_FLAT:
- if (!doc.hard) {
- if (!doc.soft) {
- out.push(" ");
- pos += 1;
- }
-
- break;
- } else {
- // This line was forced into the output even if we
- // were in flattened mode, so we need to tell the next
- // group that no matter what, it needs to remeasure
- // because the previous measurement didn't accurately
- // capture the entire expression (this is necessary
- // for nested groups)
- shouldRemeasure = true;
- }
-
- // fallthrough
-
- case MODE_BREAK:
- if (lineSuffix.length) {
- cmds.push([ind, mode, doc]);
- cmds.push(...lineSuffix.reverse());
- lineSuffix = [];
- break;
- }
-
- if (doc.literal) {
- if (ind.root) {
- out.push(newLine, ind.root.value);
- pos = ind.root.length;
- } else {
- out.push(newLine);
- pos = 0;
- }
- } else {
- pos -= trim$1(out);
- out.push(newLine + ind.value);
- pos = ind.length;
- }
-
- break;
- }
-
- break;
- }
- }
- }
-
- const cursorPlaceholderIndex = out.indexOf(cursor$1.placeholder);
-
- if (cursorPlaceholderIndex !== -1) {
- const otherCursorPlaceholderIndex = out.indexOf(cursor$1.placeholder, cursorPlaceholderIndex + 1);
- const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
- const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
- const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
- return {
- formatted: beforeCursor + aroundCursor + afterCursor,
- cursorNodeStart: beforeCursor.length,
- cursorNodeText: aroundCursor
- };
- }
-
- return {
- formatted: out.join("")
- };
- }
-
- var docPrinter = {
- printDocToString
- };
-
- const traverseDocOnExitStackMarker = {};
-
- function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
- const docsStack = [doc];
-
- while (docsStack.length !== 0) {
- const doc = docsStack.pop();
-
- if (doc === traverseDocOnExitStackMarker) {
- onExit(docsStack.pop());
- continue;
- }
-
- let shouldRecurse = true;
-
- if (onEnter) {
- if (onEnter(doc) === false) {
- shouldRecurse = false;
- }
- }
-
- if (onExit) {
- docsStack.push(doc);
- docsStack.push(traverseDocOnExitStackMarker);
- }
-
- if (shouldRecurse) {
- // When there are multiple parts to process,
- // the parts need to be pushed onto the stack in reverse order,
- // so that they are processed in the original order
- // when the stack is popped.
- if (doc.type === "concat" || doc.type === "fill") {
- for (let ic = doc.parts.length, i = ic - 1; i >= 0; --i) {
- docsStack.push(doc.parts[i]);
- }
- } else if (doc.type === "if-break") {
- if (doc.flatContents) {
- docsStack.push(doc.flatContents);
- }
-
- if (doc.breakContents) {
- docsStack.push(doc.breakContents);
- }
- } else if (doc.type === "group" && doc.expandedStates) {
- if (shouldTraverseConditionalGroups) {
- for (let ic = doc.expandedStates.length, i = ic - 1; i >= 0; --i) {
- docsStack.push(doc.expandedStates[i]);
- }
- } else {
- docsStack.push(doc.contents);
- }
- } else if (doc.contents) {
- docsStack.push(doc.contents);
- }
- }
- }
- }
-
- function mapDoc(doc, cb) {
- if (doc.type === "concat" || doc.type === "fill") {
- const parts = doc.parts.map(part => mapDoc(part, cb));
- return cb(Object.assign({}, doc, {
- parts
- }));
- } else if (doc.type === "if-break") {
- const breakContents = doc.breakContents && mapDoc(doc.breakContents, cb);
- const flatContents = doc.flatContents && mapDoc(doc.flatContents, cb);
- return cb(Object.assign({}, doc, {
- breakContents,
- flatContents
- }));
- } else if (doc.contents) {
- const contents = mapDoc(doc.contents, cb);
- return cb(Object.assign({}, doc, {
- contents
- }));
- }
-
- return cb(doc);
- }
-
- function findInDoc(doc, fn, defaultValue) {
- let result = defaultValue;
- let hasStopped = false;
-
- function findInDocOnEnterFn(doc) {
- const maybeResult = fn(doc);
-
- if (maybeResult !== undefined) {
- hasStopped = true;
- result = maybeResult;
- }
-
- if (hasStopped) {
- return false;
- }
- }
-
- traverseDoc(doc, findInDocOnEnterFn);
- return result;
- }
-
- function isEmpty(n) {
- return typeof n === "string" && n.length === 0;
- }
-
- function isLineNextFn(doc) {
- if (typeof doc === "string") {
- return false;
- }
-
- if (doc.type === "line") {
- return true;
- }
- }
-
- function isLineNext(doc) {
- return findInDoc(doc, isLineNextFn, false);
- }
-
- function willBreakFn(doc) {
- if (doc.type === "group" && doc.break) {
- return true;
- }
-
- if (doc.type === "line" && doc.hard) {
- return true;
- }
-
- if (doc.type === "break-parent") {
- return true;
- }
- }
-
- function willBreak(doc) {
- return findInDoc(doc, willBreakFn, false);
- }
-
- function breakParentGroup(groupStack) {
- if (groupStack.length > 0) {
- const parentGroup = groupStack[groupStack.length - 1]; // Breaks are not propagated through conditional groups because
- // the user is expected to manually handle what breaks.
-
- if (!parentGroup.expandedStates) {
- parentGroup.break = true;
- }
- }
-
- return null;
- }
-
- function propagateBreaks(doc) {
- const alreadyVisitedSet = new Set();
- const groupStack = [];
-
- function propagateBreaksOnEnterFn(doc) {
- if (doc.type === "break-parent") {
- breakParentGroup(groupStack);
- }
-
- if (doc.type === "group") {
- groupStack.push(doc);
-
- if (alreadyVisitedSet.has(doc)) {
- return false;
- }
-
- alreadyVisitedSet.add(doc);
- }
- }
-
- function propagateBreaksOnExitFn(doc) {
- if (doc.type === "group") {
- const group = groupStack.pop();
-
- if (group.break) {
- breakParentGroup(groupStack);
- }
- }
- }
-
- traverseDoc(doc, propagateBreaksOnEnterFn, propagateBreaksOnExitFn,
- /* shouldTraverseConditionalGroups */
- true);
- }
-
- function removeLinesFn(doc) {
- // Force this doc into flat mode by statically converting all
- // lines into spaces (or soft lines into nothing). Hard lines
- // should still output because there's too great of a chance
- // of breaking existing assumptions otherwise.
- if (doc.type === "line" && !doc.hard) {
- return doc.soft ? "" : " ";
- } else if (doc.type === "if-break") {
- return doc.flatContents || "";
- }
-
- return doc;
- }
-
- function removeLines(doc) {
- return mapDoc(doc, removeLinesFn);
- }
-
- function stripTrailingHardline(doc) {
- // HACK remove ending hardline, original PR: #1984
- if (doc.type === "concat" && doc.parts.length !== 0) {
- const lastPart = doc.parts[doc.parts.length - 1];
-
- if (lastPart.type === "concat") {
- if (lastPart.parts.length === 2 && lastPart.parts[0].hard && lastPart.parts[1].type === "break-parent") {
- return {
- type: "concat",
- parts: doc.parts.slice(0, -1)
- };
- }
-
- return {
- type: "concat",
- parts: doc.parts.slice(0, -1).concat(stripTrailingHardline(lastPart))
- };
- }
- }
-
- return doc;
- }
-
- var docUtils = {
- isEmpty,
- willBreak,
- isLineNext,
- traverseDoc,
- findInDoc,
- mapDoc,
- propagateBreaks,
- removeLines,
- stripTrailingHardline
- };
-
- function flattenDoc(doc) {
- if (doc.type === "concat") {
- const res = [];
-
- for (let i = 0; i < doc.parts.length; ++i) {
- const doc2 = doc.parts[i];
-
- if (typeof doc2 !== "string" && doc2.type === "concat") {
- res.push(...flattenDoc(doc2).parts);
- } else {
- const flattened = flattenDoc(doc2);
-
- if (flattened !== "") {
- res.push(flattened);
- }
- }
- }
-
- return Object.assign({}, doc, {
- parts: res
- });
- } else if (doc.type === "if-break") {
- return Object.assign({}, doc, {
- breakContents: doc.breakContents != null ? flattenDoc(doc.breakContents) : null,
- flatContents: doc.flatContents != null ? flattenDoc(doc.flatContents) : null
- });
- } else if (doc.type === "group") {
- return Object.assign({}, doc, {
- contents: flattenDoc(doc.contents),
- expandedStates: doc.expandedStates ? doc.expandedStates.map(flattenDoc) : doc.expandedStates
- });
- } else if (doc.contents) {
- return Object.assign({}, doc, {
- contents: flattenDoc(doc.contents)
- });
- }
-
- return doc;
- }
-
- function printDoc(doc) {
- if (typeof doc === "string") {
- return JSON.stringify(doc);
- }
-
- if (doc.type === "line") {
- if (doc.literal) {
- return "literalline";
- }
-
- if (doc.hard) {
- return "hardline";
- }
-
- if (doc.soft) {
- return "softline";
- }
-
- return "line";
- }
-
- if (doc.type === "break-parent") {
- return "breakParent";
- }
-
- if (doc.type === "trim") {
- return "trim";
- }
-
- if (doc.type === "concat") {
- return "[" + doc.parts.map(printDoc).join(", ") + "]";
- }
-
- if (doc.type === "indent") {
- return "indent(" + printDoc(doc.contents) + ")";
- }
-
- if (doc.type === "align") {
- 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) + ")";
- }
-
- if (doc.type === "if-break") {
- return "ifBreak(" + printDoc(doc.breakContents) + (doc.flatContents ? ", " + printDoc(doc.flatContents) : "") + ")";
- }
-
- if (doc.type === "group") {
- if (doc.expandedStates) {
- return "conditionalGroup(" + "[" + doc.expandedStates.map(printDoc).join(",") + "])";
- }
-
- return (doc.break ? "wrappedGroup" : "group") + "(" + printDoc(doc.contents) + ")";
- }
-
- if (doc.type === "fill") {
- return "fill" + "(" + doc.parts.map(printDoc).join(", ") + ")";
- }
-
- if (doc.type === "line-suffix") {
- return "lineSuffix(" + printDoc(doc.contents) + ")";
- }
-
- if (doc.type === "line-suffix-boundary") {
- return "lineSuffixBoundary";
- }
-
- throw new Error("Unknown doc type " + doc.type);
- }
-
- var docDebug = {
- printDocToDebug(doc) {
- return printDoc(flattenDoc(doc));
- }
-
- };
-
- var document = {
- builders: docBuilders,
- printer: docPrinter,
- utils: docUtils,
- debug: docDebug
- };
-
- const {
- getMaxContinuousCount: getMaxContinuousCount$1,
- getStringWidth: getStringWidth$2,
- getAlignmentSize: getAlignmentSize$1,
- getIndentSize: getIndentSize$1,
- skip: skip$1,
- skipWhitespace: skipWhitespace$1,
- skipSpaces: skipSpaces$1,
- skipNewline: skipNewline$1,
- skipToLineEnd: skipToLineEnd$1,
- skipEverythingButNewLine: skipEverythingButNewLine$1,
- skipInlineComment: skipInlineComment$1,
- skipTrailingComment: skipTrailingComment$1,
- hasNewline: hasNewline$1,
- hasNewlineInRange: hasNewlineInRange$1,
- hasSpaces: hasSpaces$1,
- isNextLineEmpty: isNextLineEmpty$1,
- isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$1,
- isPreviousLineEmpty: isPreviousLineEmpty$1,
- getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$1,
- makeString: makeString$1,
- addLeadingComment: addLeadingComment$1,
- addDanglingComment: addDanglingComment$1,
- addTrailingComment: addTrailingComment$1
- } = util$1;
- var utilShared = {
- getMaxContinuousCount: getMaxContinuousCount$1,
- getStringWidth: getStringWidth$2,
- getAlignmentSize: getAlignmentSize$1,
- getIndentSize: getIndentSize$1,
- skip: skip$1,
- skipWhitespace: skipWhitespace$1,
- skipSpaces: skipSpaces$1,
- skipNewline: skipNewline$1,
- skipToLineEnd: skipToLineEnd$1,
- skipEverythingButNewLine: skipEverythingButNewLine$1,
- skipInlineComment: skipInlineComment$1,
- skipTrailingComment: skipTrailingComment$1,
- hasNewline: hasNewline$1,
- hasNewlineInRange: hasNewlineInRange$1,
- hasSpaces: hasSpaces$1,
- isNextLineEmpty: isNextLineEmpty$1,
- isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$1,
- isPreviousLineEmpty: isPreviousLineEmpty$1,
- getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$1,
- makeString: makeString$1,
- addLeadingComment: addLeadingComment$1,
- addDanglingComment: addDanglingComment$1,
- addTrailingComment: addTrailingComment$1
- };
-
- const {
- concat: concat$2,
- line: line$1,
- hardline: hardline$1,
- breakParent: breakParent$1,
- indent: indent$1,
- lineSuffix: lineSuffix$1,
- join: join$1,
- cursor: cursor$2
- } = document.builders;
- const {
- hasNewline: hasNewline$2,
- skipNewline: skipNewline$2,
- isPreviousLineEmpty: isPreviousLineEmpty$2
- } = util$1;
- const {
- addLeadingComment: addLeadingComment$2,
- addDanglingComment: addDanglingComment$2,
- addTrailingComment: addTrailingComment$2
- } = utilShared;
- const childNodesCacheKey = Symbol("child-nodes");
-
- function getSortedChildNodes(node, options, resultArray) {
- if (!node) {
- return;
- }
-
- const {
- printer,
- locStart,
- locEnd
- } = options;
-
- if (resultArray) {
- if (printer.canAttachComment && printer.canAttachComment(node)) {
- // This reverse insertion sort almost always takes constant
- // time because we almost always (maybe always?) append the
- // nodes in order anyway.
- let i;
-
- for (i = resultArray.length - 1; i >= 0; --i) {
- if (locStart(resultArray[i]) <= locStart(node) && locEnd(resultArray[i]) <= locEnd(node)) {
- break;
- }
- }
-
- resultArray.splice(i + 1, 0, node);
- return;
- }
- } else if (node[childNodesCacheKey]) {
- return node[childNodesCacheKey];
- }
-
- 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]);
-
- if (!childNodes) {
- return;
- }
-
- if (!resultArray) {
- Object.defineProperty(node, childNodesCacheKey, {
- value: resultArray = [],
- enumerable: false
- });
- }
-
- childNodes.forEach(childNode => {
- getSortedChildNodes(childNode, options, resultArray);
- });
- return resultArray;
- } // As efficiently as possible, decorate the comment object with
- // .precedingNode, .enclosingNode, and/or .followingNode properties, at
- // least one of which is guaranteed to be defined.
-
-
- function decorateComment(node, comment, options) {
- const {
- locStart,
- locEnd
- } = options;
- const childNodes = getSortedChildNodes(node, options);
- let precedingNode;
- let followingNode; // Time to dust off the old binary search robes and wizard hat.
-
- let left = 0;
- let right = childNodes.length;
-
- while (left < right) {
- const middle = left + right >> 1;
- const child = childNodes[middle];
-
- if (locStart(child) - locStart(comment) <= 0 && locEnd(comment) - locEnd(child) <= 0) {
- // The comment is completely contained by this child node.
- comment.enclosingNode = child;
- decorateComment(child, comment, options);
- return; // Abandon the binary search at this level.
- }
-
- if (locEnd(child) - locStart(comment) <= 0) {
- // This child node falls completely before the comment.
- // Because we will never consider this node or any nodes
- // before it again, this node must be the closest preceding
- // node we have encountered so far.
- precedingNode = child;
- left = middle + 1;
- continue;
- }
-
- if (locEnd(comment) - locStart(child) <= 0) {
- // This child node falls completely after the comment.
- // Because we will never consider this node or any nodes after
- // it again, this node must be the closest following node we
- // have encountered so far.
- followingNode = child;
- right = middle;
- continue;
- }
- /* istanbul ignore next */
-
-
- throw new Error("Comment location overlaps with node location");
- } // We don't want comments inside of different expressions inside of the same
- // template literal to move to another expression.
-
-
- if (comment.enclosingNode && comment.enclosingNode.type === "TemplateLiteral") {
- const {
- quasis
- } = comment.enclosingNode;
- const commentIndex = findExpressionIndexForComment(quasis, comment, options);
-
- if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options) !== commentIndex) {
- precedingNode = null;
- }
-
- if (followingNode && findExpressionIndexForComment(quasis, followingNode, options) !== commentIndex) {
- followingNode = null;
- }
- }
-
- if (precedingNode) {
- comment.precedingNode = precedingNode;
- }
-
- if (followingNode) {
- comment.followingNode = followingNode;
- }
- }
-
- function attach(comments, ast, text, options) {
- if (!Array.isArray(comments)) {
- return;
- }
-
- const tiesToBreak = [];
- const {
- locStart,
- locEnd
- } = options;
- comments.forEach((comment, i) => {
- if (options.parser === "json" || options.parser === "json5" || options.parser === "__js_expression" || options.parser === "__vue_expression") {
- if (locStart(comment) - locStart(ast) <= 0) {
- addLeadingComment$2(ast, comment);
- return;
- }
-
- if (locEnd(comment) - locEnd(ast) >= 0) {
- addTrailingComment$2(ast, comment);
- return;
- }
- }
-
- decorateComment(ast, comment, options);
- const {
- precedingNode,
- enclosingNode,
- followingNode
- } = comment;
- const pluginHandleOwnLineComment = options.printer.handleComments && options.printer.handleComments.ownLine ? options.printer.handleComments.ownLine : () => false;
- const pluginHandleEndOfLineComment = options.printer.handleComments && options.printer.handleComments.endOfLine ? options.printer.handleComments.endOfLine : () => false;
- const pluginHandleRemainingComment = options.printer.handleComments && options.printer.handleComments.remaining ? options.printer.handleComments.remaining : () => false;
- const isLastComment = comments.length - 1 === i;
-
- if (hasNewline$2(text, locStart(comment), {
- backwards: true
- })) {
- // If a comment exists on its own line, prefer a leading comment.
- // We also need to check if it's the first line of the file.
- if (pluginHandleOwnLineComment(comment, text, options, ast, isLastComment)) ; else if (followingNode) {
- // Always a leading comment.
- addLeadingComment$2(followingNode, comment);
- } else if (precedingNode) {
- addTrailingComment$2(precedingNode, comment);
- } else if (enclosingNode) {
- addDanglingComment$2(enclosingNode, comment);
- } else {
- // There are no nodes, let's attach it to the root of the ast
-
- /* istanbul ignore next */
- addDanglingComment$2(ast, comment);
- }
- } else if (hasNewline$2(text, locEnd(comment))) {
- if (pluginHandleEndOfLineComment(comment, text, options, ast, isLastComment)) ; else if (precedingNode) {
- // There is content before this comment on the same line, but
- // none after it, so prefer a trailing comment of the previous node.
- addTrailingComment$2(precedingNode, comment);
- } else if (followingNode) {
- addLeadingComment$2(followingNode, comment);
- } else if (enclosingNode) {
- addDanglingComment$2(enclosingNode, comment);
- } else {
- // There are no nodes, let's attach it to the root of the ast
-
- /* istanbul ignore next */
- addDanglingComment$2(ast, comment);
- }
- } else {
- if (pluginHandleRemainingComment(comment, text, options, ast, isLastComment)) ; else if (precedingNode && followingNode) {
- // Otherwise, text exists both before and after the comment on
- // the same line. If there is both a preceding and following
- // node, use a tie-breaking algorithm to determine if it should
- // be attached to the next or previous node. In the last case,
- // simply attach the right node;
- const tieCount = tiesToBreak.length;
-
- if (tieCount > 0) {
- const lastTie = tiesToBreak[tieCount - 1];
-
- if (lastTie.followingNode !== comment.followingNode) {
- breakTies(tiesToBreak, text, options);
- }
- }
-
- tiesToBreak.push(comment);
- } else if (precedingNode) {
- addTrailingComment$2(precedingNode, comment);
- } else if (followingNode) {
- addLeadingComment$2(followingNode, comment);
- } else if (enclosingNode) {
- addDanglingComment$2(enclosingNode, comment);
- } else {
- // There are no nodes, let's attach it to the root of the ast
-
- /* istanbul ignore next */
- addDanglingComment$2(ast, comment);
- }
- }
- });
- breakTies(tiesToBreak, text, options);
- comments.forEach(comment => {
- // These node references were useful for breaking ties, but we
- // don't need them anymore, and they create cycles in the AST that
- // may lead to infinite recursion if we don't delete them here.
- delete comment.precedingNode;
- delete comment.enclosingNode;
- delete comment.followingNode;
- });
- }
-
- function breakTies(tiesToBreak, text, options) {
- const tieCount = tiesToBreak.length;
-
- if (tieCount === 0) {
- return;
- }
-
- const {
- precedingNode,
- followingNode,
- enclosingNode
- } = tiesToBreak[0];
- const gapRegExp = options.printer.getGapRegex && options.printer.getGapRegex(enclosingNode) || /^[\s(]*$/;
- let gapEndPos = options.locStart(followingNode); // Iterate backwards through tiesToBreak, examining the gaps
- // between the tied comments. In order to qualify as leading, a
- // comment must be separated from followingNode by an unbroken series of
- // gaps (or other comments). Gaps should only contain whitespace or open
- // parentheses.
-
- let indexOfFirstLeadingComment;
-
- for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
- const comment = tiesToBreak[indexOfFirstLeadingComment - 1];
- assert.strictEqual(comment.precedingNode, precedingNode);
- assert.strictEqual(comment.followingNode, followingNode);
- const gap = text.slice(options.locEnd(comment), gapEndPos);
-
- if (gapRegExp.test(gap)) {
- gapEndPos = options.locStart(comment);
- } else {
- // The gap string contained something other than whitespace or open
- // parentheses.
- break;
- }
- }
-
- tiesToBreak.forEach((comment, i) => {
- if (i < indexOfFirstLeadingComment) {
- addTrailingComment$2(precedingNode, comment);
- } else {
- addLeadingComment$2(followingNode, comment);
- }
- });
- tiesToBreak.length = 0;
- }
-
- function printComment(commentPath, options) {
- const comment = commentPath.getValue();
- comment.printed = true;
- return options.printer.printComment(commentPath, options);
- }
-
- function findExpressionIndexForComment(quasis, comment, options) {
- const startPos = options.locStart(comment) - 1;
-
- for (let i = 1; i < quasis.length; ++i) {
- if (startPos < getQuasiRange(quasis[i]).start) {
- return i - 1;
- }
- } // We haven't found it, it probably means that some of the locations are off.
- // Let's just return the first one.
-
- /* istanbul ignore next */
-
-
- return 0;
- }
-
- function getQuasiRange(expr) {
- if (expr.start !== undefined) {
- // Babel
- return {
- start: expr.start,
- end: expr.end
- };
- } // Flow
-
-
- return {
- start: expr.range[0],
- end: expr.range[1]
- };
- }
-
- function printLeadingComment(commentPath, print, options) {
- const comment = commentPath.getValue();
- const contents = printComment(commentPath, options);
-
- if (!contents) {
- return "";
- }
-
- const isBlock = options.printer.isBlockComment && options.printer.isBlockComment(comment); // Leading block comments should see if they need to stay on the
- // same line or not.
-
- if (isBlock) {
- const lineBreak = hasNewline$2(options.originalText, options.locEnd(comment)) ? hasNewline$2(options.originalText, options.locStart(comment), {
- backwards: true
- }) ? hardline$1 : line$1 : " ";
- return concat$2([contents, lineBreak]);
- }
-
- return concat$2([contents, hardline$1]);
- }
-
- function printTrailingComment(commentPath, print, options) {
- const comment = commentPath.getValue();
- const contents = printComment(commentPath, options);
-
- if (!contents) {
- return "";
- }
-
- const isBlock = options.printer.isBlockComment && options.printer.isBlockComment(comment); // We don't want the line to break
- // when the parentParentNode is a ClassDeclaration/-Expression
- // And the parentNode is in the superClass property
-
- const parentNode = commentPath.getNode(1);
- const parentParentNode = commentPath.getNode(2);
- const isParentSuperClass = parentParentNode && (parentParentNode.type === "ClassDeclaration" || parentParentNode.type === "ClassExpression") && parentParentNode.superClass === parentNode;
-
- if (hasNewline$2(options.originalText, options.locStart(comment), {
- backwards: true
- })) {
- // This allows comments at the end of nested structures:
- // {
- // x: 1,
- // y: 2
- // // A comment
- // }
- // Those kinds of comments are almost always leading comments, but
- // here it doesn't go "outside" the block and turns it into a
- // trailing comment for `2`. We can simulate the above by checking
- // if this a comment on its own line; normal trailing comments are
- // always at the end of another expression.
- const isLineBeforeEmpty = isPreviousLineEmpty$2(options.originalText, comment, options.locStart);
- return lineSuffix$1(concat$2([hardline$1, isLineBeforeEmpty ? hardline$1 : "", contents]));
- } else if (isBlock || isParentSuperClass) {
- // Trailing block comments never need a newline
- return concat$2([" ", contents]);
- }
-
- return concat$2([lineSuffix$1(concat$2([" ", contents])), !isBlock ? breakParent$1 : ""]);
- }
-
- function printDanglingComments(path, options, sameIndent, filter) {
- const parts = [];
- const node = path.getValue();
-
- if (!node || !node.comments) {
- return "";
- }
-
- path.each(commentPath => {
- const comment = commentPath.getValue();
-
- if (comment && !comment.leading && !comment.trailing && (!filter || filter(comment))) {
- parts.push(printComment(commentPath, options));
- }
- }, "comments");
-
- if (parts.length === 0) {
- return "";
- }
-
- if (sameIndent) {
- return join$1(hardline$1, parts);
- }
-
- return indent$1(concat$2([hardline$1, join$1(hardline$1, parts)]));
- }
-
- function prependCursorPlaceholder(path, options, printed) {
- if (path.getNode() === options.cursorNode && path.getValue()) {
- return concat$2([cursor$2, printed, cursor$2]);
- }
-
- return printed;
- }
-
- function printComments(path, print, options, needsSemi) {
- const value = path.getValue();
- const printed = print(path);
- const comments = value && value.comments;
-
- if (!comments || comments.length === 0) {
- return prependCursorPlaceholder(path, options, printed);
- }
-
- const leadingParts = [];
- const trailingParts = [needsSemi ? ";" : "", printed];
- path.each(commentPath => {
- const comment = commentPath.getValue();
- const {
- leading,
- trailing
- } = comment;
-
- if (leading) {
- const contents = printLeadingComment(commentPath, print, options);
-
- if (!contents) {
- return;
- }
-
- leadingParts.push(contents);
- const text = options.originalText;
- const index = skipNewline$2(text, options.locEnd(comment));
-
- if (index !== false && hasNewline$2(text, index)) {
- leadingParts.push(hardline$1);
- }
- } else if (trailing) {
- trailingParts.push(printTrailingComment(commentPath, print, options));
- }
- }, "comments");
- return prependCursorPlaceholder(path, options, concat$2(leadingParts.concat(trailingParts)));
- }
-
- var comments = {
- attach,
- printComments,
- printDanglingComments,
- getSortedChildNodes
- };
-
- function getNodeHelper(path, count) {
- const stackIndex = getNodeStackIndexHelper(path.stack, count);
- return stackIndex === -1 ? null : path.stack[stackIndex];
- }
-
- function getNodeStackIndexHelper(stack, count) {
- for (let i = stack.length - 1; i >= 0; i -= 2) {
- const value = stack[i];
-
- if (value && !Array.isArray(value) && --count < 0) {
- return i;
- }
- }
-
- return -1;
- }
-
- class FastPath {
- constructor(value) {
- this.stack = [value];
- } // The name of the current property is always the penultimate element of
- // this.stack, and always a String.
-
-
- getName() {
- const {
- stack
- } = this;
- const {
- length
- } = stack;
-
- if (length > 1) {
- return stack[length - 2];
- } // Since the name is always a string, null is a safe sentinel value to
- // return if we do not know the name of the (root) value.
-
- /* istanbul ignore next */
-
-
- return null;
- } // The value of the current property is always the final element of
- // this.stack.
-
-
- getValue() {
- return getLast(this.stack);
- }
-
- getNode(count = 0) {
- return getNodeHelper(this, count);
- }
-
- getParentNode(count = 0) {
- return getNodeHelper(this, count + 1);
- } // Temporarily push properties named by string arguments given after the
- // callback function onto this.stack, then call the callback with a
- // reference to this (modified) FastPath object. Note that the stack will
- // be restored to its original state after the callback is finished, so it
- // is probably a mistake to retain a reference to the path.
-
-
- call(callback, ...names) {
- const {
- stack
- } = this;
- const {
- length
- } = stack;
- let value = getLast(stack);
-
- for (const name of names) {
- value = value[name];
- stack.push(name, value);
- }
-
- const result = callback(this);
- stack.length = length;
- return result;
- }
-
- callParent(callback, count = 0) {
- const stackIndex = getNodeStackIndexHelper(this.stack, count + 1);
- const parentValues = this.stack.splice(stackIndex + 1);
- const result = callback(this);
- this.stack.push(...parentValues);
- return result;
- } // Similar to FastPath.prototype.call, except that the value obtained by
- // accessing this.getValue()[name1][name2]... should be array-like. The
- // callback will be called with a reference to this path object for each
- // element of the array.
-
-
- each(callback, ...names) {
- const {
- stack
- } = this;
- const {
- length
- } = stack;
- let value = getLast(stack);
-
- for (const name of names) {
- value = value[name];
- stack.push(name, value);
- }
-
- for (let i = 0; i < value.length; ++i) {
- if (i in value) {
- stack.push(i, value[i]); // If the callback needs to know the value of i, call
- // path.getName(), assuming path is the parameter name.
-
- callback(this);
- stack.length -= 2;
- }
- }
-
- stack.length = length;
- } // Similar to FastPath.prototype.each, except that the results of the
- // callback function invocations are stored in an array and returned at
- // the end of the iteration.
-
-
- map(callback, ...names) {
- const {
- stack
- } = this;
- const {
- length
- } = stack;
- let value = getLast(stack);
-
- for (const name of names) {
- value = value[name];
- stack.push(name, value);
- }
-
- const result = new Array(value.length);
-
- for (let i = 0; i < value.length; ++i) {
- if (i in value) {
- stack.push(i, value[i]);
- result[i] = callback(this, i);
- stack.length -= 2;
- }
- }
-
- stack.length = length;
- return result;
- }
- /**
- * @param {...(
- * | ((node: any, name: string | null, number: number | null) => boolean)
- * | undefined
- * )} predicates
- */
-
-
- match(...predicates) {
- let stackPointer = this.stack.length - 1;
- let name = null;
- let node = this.stack[stackPointer--];
-
- for (const predicate of predicates) {
- if (node === undefined) {
- return false;
- } // skip index/array
-
-
- let number = null;
-
- if (typeof name === "number") {
- number = name;
- name = this.stack[stackPointer--];
- node = this.stack[stackPointer--];
- }
-
- if (predicate && !predicate(node, name, number)) {
- return false;
- }
-
- name = this.stack[stackPointer--];
- node = this.stack[stackPointer--];
- }
-
- return true;
- }
-
- }
-
- var fastPath = FastPath;
-
- const {
- normalize: normalize$2
- } = options$1;
-
- function printSubtree(path, print, options, printAstToDoc) {
- if (options.printer.embed) {
- return options.printer.embed(path, print, (text, partialNextOptions) => textToDoc(text, partialNextOptions, options, printAstToDoc), options);
- }
- }
-
- function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc) {
- const nextOptions = normalize$2(Object.assign({}, parentOptions, {}, partialNextOptions, {
- parentParser: parentOptions.parser,
- embeddedInHtml: !!(parentOptions.embeddedInHtml || parentOptions.parser === "html" || parentOptions.parser === "vue" || parentOptions.parser === "angular" || parentOptions.parser === "lwc"),
- originalText: text
- }), {
- passThrough: true
- });
- const result = parser.parse(text, nextOptions);
- const {
- ast
- } = result;
- text = result.text;
- const astComments = ast.comments;
- delete ast.comments;
- comments.attach(astComments, ast, text, nextOptions);
- return printAstToDoc(ast, nextOptions);
- }
-
- var multiparser = {
- printSubtree
- };
-
- const doc = document;
- const docBuilders$1 = doc.builders;
- const {
- concat: concat$3,
- hardline: hardline$2,
- addAlignmentToDoc: addAlignmentToDoc$1
- } = docBuilders$1;
- const docUtils$1 = doc.utils;
- /**
- * Takes an abstract syntax tree (AST) and recursively converts it to a
- * document (series of printing primitives).
- *
- * This is done by descending down the AST recursively. The recursion
- * involves two functions that call each other:
- *
- * 1. printGenerically(), which is defined as an inner function here.
- * It basically takes care of node caching.
- * 2. callPluginPrintFunction(), which checks for some options, and
- * ultimately calls the print() function provided by the plugin.
- *
- * The plugin function will call printGenerically() again for child nodes
- * of the current node, which will do its housekeeping, then call the
- * plugin function again, and so on.
- *
- * All the while, these functions pass a "path" variable around, which
- * is a stack-like data structure (FastPath) that maintains the current
- * state of the recursion. It is called "path", because it represents
- * the path to the current node through the Abstract Syntax Tree.
- */
-
- function printAstToDoc(ast, options, alignmentSize = 0) {
- const {
- printer
- } = options;
-
- if (printer.preprocess) {
- ast = printer.preprocess(ast, options);
- }
-
- const cache = new Map();
-
- function printGenerically(path, args) {
- const node = path.getValue();
- const shouldCache = node && typeof node === "object" && args === undefined;
-
- if (shouldCache && cache.has(node)) {
- return cache.get(node);
- } // We let JSXElement print its comments itself because it adds () around
- // UnionTypeAnnotation has to align the child without the comments
-
-
- let res;
-
- if (printer.willPrintOwnComments && printer.willPrintOwnComments(path, options)) {
- res = callPluginPrintFunction(path, options, printGenerically, args);
- } else {
- // printComments will call the plugin print function and check for
- // comments to print
- res = comments.printComments(path, p => callPluginPrintFunction(p, options, printGenerically, args), options, args && args.needsSemi);
- }
-
- if (shouldCache) {
- cache.set(node, res);
- }
-
- return res;
- }
-
- let doc = printGenerically(new fastPath(ast));
-
- if (alignmentSize > 0) {
- // Add a hardline to make the indents take effect
- // It should be removed in index.js format()
- doc = addAlignmentToDoc$1(concat$3([hardline$2, doc]), alignmentSize, options.tabWidth);
- }
-
- docUtils$1.propagateBreaks(doc);
- return doc;
- }
-
- function callPluginPrintFunction(path, options, printPath, args) {
- assert.ok(path instanceof fastPath);
- const node = path.getValue();
- const {
- printer
- } = options; // Escape hatch
-
- if (printer.hasPrettierIgnore && printer.hasPrettierIgnore(path)) {
- return options.originalText.slice(options.locStart(node), options.locEnd(node));
- }
-
- if (node) {
- try {
- // Potentially switch to a different parser
- const sub = multiparser.printSubtree(path, printPath, options, printAstToDoc);
-
- if (sub) {
- return sub;
- }
- } catch (error) {
- /* istanbul ignore if */
- if (commonjsGlobal.PRETTIER_DEBUG) {
- throw error;
- } // Continue with current parser
-
- }
- }
-
- return printer.print(path, options, printPath, args);
- }
-
- var astToDoc = printAstToDoc;
-
- function findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts) {
- let resultStartNode = startNodeAndParents.node;
- let resultEndNode = endNodeAndParents.node;
-
- if (resultStartNode === resultEndNode) {
- return {
- startNode: resultStartNode,
- endNode: resultEndNode
- };
- }
-
- for (const endParent of endNodeAndParents.parentNodes) {
- if (endParent.type !== "Program" && endParent.type !== "File" && opts.locStart(endParent) >= opts.locStart(startNodeAndParents.node)) {
- resultEndNode = endParent;
- } else {
- break;
- }
- }
-
- for (const startParent of startNodeAndParents.parentNodes) {
- if (startParent.type !== "Program" && startParent.type !== "File" && opts.locEnd(startParent) <= opts.locEnd(endNodeAndParents.node)) {
- resultStartNode = startParent;
- } else {
- break;
- }
- }
-
- return {
- startNode: resultStartNode,
- endNode: resultEndNode
- };
- }
-
- function findNodeAtOffset(node, offset, options, predicate, parentNodes) {
- predicate = predicate || (() => true);
-
- parentNodes = parentNodes || [];
- const start = options.locStart(node, options.locStart);
- const end = options.locEnd(node, options.locEnd);
-
- if (start <= offset && offset <= end) {
- for (const childNode of comments.getSortedChildNodes(node, options)) {
- const childResult = findNodeAtOffset(childNode, offset, options, predicate, [node].concat(parentNodes));
-
- if (childResult) {
- return childResult;
- }
- }
-
- if (predicate(node)) {
- return {
- node,
- parentNodes
- };
- }
- }
- } // See https://www.ecma-international.org/ecma-262/5.1/#sec-A.5
-
-
- function isSourceElement(opts, node) {
- if (node == null) {
- return false;
- } // JS and JS like to avoid repetitions
-
-
- const jsSourceElements = ["FunctionDeclaration", "BlockStatement", "BreakStatement", "ContinueStatement", "DebuggerStatement", "DoWhileStatement", "EmptyStatement", "ExpressionStatement", "ForInStatement", "ForStatement", "IfStatement", "LabeledStatement", "ReturnStatement", "SwitchStatement", "ThrowStatement", "TryStatement", "VariableDeclaration", "WhileStatement", "WithStatement", "ClassDeclaration", // ES 2015
- "ImportDeclaration", // Module
- "ExportDefaultDeclaration", // Module
- "ExportNamedDeclaration", // Module
- "ExportAllDeclaration", // Module
- "TypeAlias", // Flow
- "InterfaceDeclaration", // Flow, TypeScript
- "TypeAliasDeclaration", // TypeScript
- "ExportAssignment", // TypeScript
- "ExportDeclaration" // TypeScript
- ];
- const jsonSourceElements = ["ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral"];
- const graphqlSourceElements = ["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"];
-
- switch (opts.parser) {
- case "flow":
- case "babel":
- case "babel-flow":
- case "babel-ts":
- case "typescript":
- return jsSourceElements.includes(node.type);
-
- case "json":
- return jsonSourceElements.includes(node.type);
-
- case "graphql":
- return graphqlSourceElements.includes(node.kind);
-
- case "vue":
- return node.tag !== "root";
- }
-
- return false;
- }
-
- function calculateRange(text, opts, ast) {
- // Contract the range so that it has non-whitespace characters at its endpoints.
- // This ensures we can format a range that doesn't end on a node.
- const rangeStringOrig = text.slice(opts.rangeStart, opts.rangeEnd);
- const startNonWhitespace = Math.max(opts.rangeStart + rangeStringOrig.search(/\S/), opts.rangeStart);
- let endNonWhitespace;
-
- for (endNonWhitespace = opts.rangeEnd; endNonWhitespace > opts.rangeStart; --endNonWhitespace) {
- if (text[endNonWhitespace - 1].match(/\S/)) {
- break;
- }
- }
-
- const startNodeAndParents = findNodeAtOffset(ast, startNonWhitespace, opts, node => isSourceElement(opts, node));
- const endNodeAndParents = findNodeAtOffset(ast, endNonWhitespace, opts, node => isSourceElement(opts, node));
-
- if (!startNodeAndParents || !endNodeAndParents) {
- return {
- rangeStart: 0,
- rangeEnd: 0
- };
- }
-
- const siblingAncestors = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts);
- const {
- startNode,
- endNode
- } = siblingAncestors;
- const rangeStart = Math.min(opts.locStart(startNode, opts.locStart), opts.locStart(endNode, opts.locStart));
- const rangeEnd = Math.max(opts.locEnd(startNode, opts.locEnd), opts.locEnd(endNode, opts.locEnd));
- return {
- rangeStart,
- rangeEnd
- };
- }
-
- var rangeUtil = {
- calculateRange,
- findNodeAtOffset
- };
-
- var diff = getCjsExportFromNamespace(index_es6);
-
- const normalizeOptions$1 = options$1.normalize;
- const {
- guessEndOfLine: guessEndOfLine$1,
- convertEndOfLineToChars: convertEndOfLineToChars$2
- } = endOfLine;
- const {
- printer: {
- printDocToString: printDocToString$1
- },
- debug: {
- printDocToDebug
- }
- } = document;
- const BOM = "\uFEFF";
- const CURSOR = Symbol("cursor");
- const PLACEHOLDERS = {
- cursorOffset: "<<<PRETTIER_CURSOR>>>",
- rangeStart: "<<<PRETTIER_RANGE_START>>>",
- rangeEnd: "<<<PRETTIER_RANGE_END>>>"
- };
-
- function ensureAllCommentsPrinted(astComments) {
- if (!astComments) {
- return;
- }
-
- for (let i = 0; i < astComments.length; ++i) {
- if (util$1.isNodeIgnoreComment(astComments[i])) {
- // If there's a prettier-ignore, we're not printing that sub-tree so we
- // don't know if the comments was printed or not.
- return;
- }
- }
-
- astComments.forEach(comment => {
- if (!comment.printed) {
- throw new Error('Comment "' + comment.value.trim() + '" was not printed. Please report this error!');
- }
-
- delete comment.printed;
- });
- }
-
- function attachComments(text, ast, opts) {
- const astComments = ast.comments;
-
- if (astComments) {
- delete ast.comments;
- comments.attach(astComments, ast, text, opts);
- }
-
- ast.tokens = [];
- opts.originalText = opts.parser === "yaml" ? text : text.trimEnd();
- return astComments;
- }
-
- function coreFormat(text, opts, addAlignmentSize) {
- if (!text || !text.trim().length) {
- return {
- formatted: "",
- cursorOffset: 0
- };
- }
-
- addAlignmentSize = addAlignmentSize || 0;
- const parsed = parser.parse(text, opts);
- const {
- ast
- } = parsed;
- text = parsed.text;
-
- if (opts.cursorOffset >= 0) {
- const nodeResult = rangeUtil.findNodeAtOffset(ast, opts.cursorOffset, opts);
-
- if (nodeResult && nodeResult.node) {
- opts.cursorNode = nodeResult.node;
- }
- }
-
- const astComments = attachComments(text, ast, opts);
- const doc = astToDoc(ast, opts, addAlignmentSize);
- const result = printDocToString$1(doc, opts);
- ensureAllCommentsPrinted(astComments); // Remove extra leading indentation as well as the added indentation after last newline
-
- if (addAlignmentSize > 0) {
- const trimmed = result.formatted.trim();
-
- if (result.cursorNodeStart !== undefined) {
- result.cursorNodeStart -= result.formatted.indexOf(trimmed);
- }
-
- result.formatted = trimmed + convertEndOfLineToChars$2(opts.endOfLine);
- }
-
- if (opts.cursorOffset >= 0) {
- let oldCursorNodeStart;
- let oldCursorNodeText;
- let cursorOffsetRelativeToOldCursorNode;
- let newCursorNodeStart;
- let newCursorNodeText;
-
- if (opts.cursorNode && result.cursorNodeText) {
- oldCursorNodeStart = opts.locStart(opts.cursorNode);
- oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode));
- cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart;
- newCursorNodeStart = result.cursorNodeStart;
- newCursorNodeText = result.cursorNodeText;
- } else {
- oldCursorNodeStart = 0;
- oldCursorNodeText = text;
- cursorOffsetRelativeToOldCursorNode = opts.cursorOffset;
- newCursorNodeStart = 0;
- newCursorNodeText = result.formatted;
- }
-
- if (oldCursorNodeText === newCursorNodeText) {
- return {
- formatted: result.formatted,
- cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode
- };
- } // diff old and new cursor node texts, with a special cursor
- // symbol inserted to find out where it moves to
-
-
- const oldCursorNodeCharArray = oldCursorNodeText.split("");
- oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR);
- const newCursorNodeCharArray = newCursorNodeText.split("");
- const cursorNodeDiff = diff.diffArrays(oldCursorNodeCharArray, newCursorNodeCharArray);
- let cursorOffset = newCursorNodeStart;
-
- for (const entry of cursorNodeDiff) {
- if (entry.removed) {
- if (entry.value.includes(CURSOR)) {
- break;
- }
- } else {
- cursorOffset += entry.count;
- }
- }
-
- return {
- formatted: result.formatted,
- cursorOffset
- };
- }
-
- return {
- formatted: result.formatted
- };
- }
-
- function formatRange(text, opts) {
- const parsed = parser.parse(text, opts);
- const {
- ast
- } = parsed;
- text = parsed.text;
- const range = rangeUtil.calculateRange(text, opts, ast);
- const {
- rangeStart,
- rangeEnd
- } = range;
- const rangeString = text.slice(rangeStart, rangeEnd); // Try to extend the range backwards to the beginning of the line.
- // This is so we can detect indentation correctly and restore it.
- // Use `Math.min` since `lastIndexOf` returns 0 when `rangeStart` is 0
-
- const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1);
- const indentString = text.slice(rangeStart2, rangeStart);
- const alignmentSize = util$1.getAlignmentSize(indentString, opts.tabWidth);
- const rangeResult = coreFormat(rangeString, Object.assign({}, opts, {
- rangeStart: 0,
- rangeEnd: Infinity,
- // track the cursor offset only if it's within our range
- cursorOffset: opts.cursorOffset >= rangeStart && opts.cursorOffset < rangeEnd ? opts.cursorOffset - rangeStart : -1
- }), alignmentSize); // Since the range contracts to avoid trailing whitespace,
- // we need to remove the newline that was inserted by the `format` call.
-
- const rangeTrimmed = rangeResult.formatted.trimEnd();
- const rangeLeft = text.slice(0, rangeStart);
- const rangeRight = text.slice(rangeEnd);
- let {
- cursorOffset
- } = opts;
-
- if (opts.cursorOffset >= rangeEnd) {
- // handle the case where the cursor was past the end of the range
- cursorOffset = opts.cursorOffset - rangeEnd + (rangeStart + rangeTrimmed.length);
- } else if (rangeResult.cursorOffset !== undefined) {
- // handle the case where the cursor was in the range
- cursorOffset = rangeResult.cursorOffset + rangeStart;
- } // keep the cursor as it was if it was before the start of the range
-
-
- let formatted;
-
- if (opts.endOfLine === "lf") {
- formatted = rangeLeft + rangeTrimmed + rangeRight;
- } else {
- const eol = convertEndOfLineToChars$2(opts.endOfLine);
-
- if (cursorOffset >= 0) {
- const parts = [rangeLeft, rangeTrimmed, rangeRight];
- let partIndex = 0;
- let partOffset = cursorOffset;
-
- while (partIndex < parts.length) {
- const part = parts[partIndex];
-
- if (partOffset < part.length) {
- parts[partIndex] = parts[partIndex].slice(0, partOffset) + PLACEHOLDERS.cursorOffset + parts[partIndex].slice(partOffset);
- break;
- }
-
- partIndex++;
- partOffset -= part.length;
- }
-
- const [newRangeLeft, newRangeTrimmed, newRangeRight] = parts;
- formatted = (newRangeLeft.replace(/\n/g, eol) + newRangeTrimmed + newRangeRight.replace(/\n/g, eol)).replace(PLACEHOLDERS.cursorOffset, (_, index) => {
- cursorOffset = index;
- return "";
- });
- } else {
- formatted = rangeLeft.replace(/\n/g, eol) + rangeTrimmed + rangeRight.replace(/\n/g, eol);
- }
- }
-
- return {
- formatted,
- cursorOffset
- };
- }
-
- function format(text, opts) {
- const selectedParser = parser.resolveParser(opts);
- const hasPragma = !selectedParser.hasPragma || selectedParser.hasPragma(text);
-
- if (opts.requirePragma && !hasPragma) {
- return {
- formatted: text
- };
- }
-
- if (opts.endOfLine === "auto") {
- opts.endOfLine = guessEndOfLine$1(text);
- }
-
- const hasCursor = opts.cursorOffset >= 0;
- const hasRangeStart = opts.rangeStart > 0;
- const hasRangeEnd = opts.rangeEnd < text.length; // get rid of CR/CRLF parsing
-
- if (text.includes("\r")) {
- const offsetKeys = [hasCursor && "cursorOffset", hasRangeStart && "rangeStart", hasRangeEnd && "rangeEnd"].filter(Boolean).sort((aKey, bKey) => opts[aKey] - opts[bKey]);
-
- for (let i = offsetKeys.length - 1; i >= 0; i--) {
- const key = offsetKeys[i];
- text = text.slice(0, opts[key]) + PLACEHOLDERS[key] + text.slice(opts[key]);
- }
-
- text = text.replace(/\r\n?/g, "\n");
-
- for (let i = 0; i < offsetKeys.length; i++) {
- const key = offsetKeys[i];
- text = text.replace(PLACEHOLDERS[key], (_, index) => {
- opts[key] = index;
- return "";
- });
- }
- }
-
- const hasUnicodeBOM = text.charAt(0) === BOM;
-
- if (hasUnicodeBOM) {
- text = text.slice(1);
-
- if (hasCursor) {
- opts.cursorOffset++;
- }
-
- if (hasRangeStart) {
- opts.rangeStart++;
- }
-
- if (hasRangeEnd) {
- opts.rangeEnd++;
- }
- }
-
- if (!hasCursor) {
- opts.cursorOffset = -1;
- }
-
- if (opts.rangeStart < 0) {
- opts.rangeStart = 0;
- }
-
- if (opts.rangeEnd > text.length) {
- opts.rangeEnd = text.length;
- }
-
- const result = hasRangeStart || hasRangeEnd ? formatRange(text, opts) : coreFormat(opts.insertPragma && opts.printer.insertPragma && !hasPragma ? opts.printer.insertPragma(text) : text, opts);
-
- if (hasUnicodeBOM) {
- result.formatted = BOM + result.formatted;
-
- if (hasCursor) {
- result.cursorOffset++;
- }
- }
-
- return result;
- }
-
- var core = {
- formatWithCursor(text, opts) {
- opts = normalizeOptions$1(opts);
- return format(text, opts);
- },
-
- parse(text, opts, massage) {
- opts = normalizeOptions$1(opts);
-
- if (text.includes("\r")) {
- text = text.replace(/\r\n?/g, "\n");
- }
-
- const parsed = parser.parse(text, opts);
-
- if (massage) {
- parsed.ast = massageAst(parsed.ast, opts);
- }
-
- return parsed;
- },
-
- formatAST(ast, opts) {
- opts = normalizeOptions$1(opts);
- const doc = astToDoc(ast, opts);
- return printDocToString$1(doc, opts);
- },
-
- // Doesn't handle shebang for now
- formatDoc(doc, opts) {
- const debug = printDocToDebug(doc);
- opts = normalizeOptions$1(Object.assign({}, opts, {
- parser: "babel"
- }));
- return format(debug, opts).formatted;
- },
-
- printToDoc(text, opts) {
- opts = normalizeOptions$1(opts);
- const parsed = parser.parse(text, opts);
- const {
- ast
- } = parsed;
- text = parsed.text;
- attachComments(text, ast, opts);
- return astToDoc(ast, opts);
- },
-
- printDocToString(doc, opts) {
- return printDocToString$1(doc, normalizeOptions$1(opts));
- }
-
- };
-
- function clean(ast, newObj, parent) {
- ["raw", // front-matter
- "raws", "sourceIndex", "source", "before", "after", "trailingComma"].forEach(name => {
- delete newObj[name];
- });
-
- if (ast.type === "yaml") {
- delete newObj.value;
- } // --insert-pragma
-
-
- if (ast.type === "css-comment" && parent.type === "css-root" && parent.nodes.length !== 0 && ( // first non-front-matter comment
- parent.nodes[0] === ast || (parent.nodes[0].type === "yaml" || parent.nodes[0].type === "toml") && parent.nodes[1] === ast)) {
- /**
- * something
- *
- * @format
- */
- delete newObj.text; // standalone pragma
-
- if (/^\*\s*@(format|prettier)\s*$/.test(ast.text)) {
- return null;
- }
- }
-
- if (ast.type === "media-query" || ast.type === "media-query-list" || ast.type === "media-feature-expression") {
- delete newObj.value;
- }
-
- if (ast.type === "css-rule") {
- delete newObj.params;
- }
-
- if (ast.type === "selector-combinator") {
- newObj.value = newObj.value.replace(/\s+/g, " ");
- }
-
- if (ast.type === "media-feature") {
- newObj.value = newObj.value.replace(/ /g, "");
- }
-
- 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") {
- newObj.value = newObj.value.toLowerCase();
- }
-
- if (ast.type === "css-decl") {
- newObj.prop = newObj.prop.toLowerCase();
- }
-
- if (ast.type === "css-atrule" || ast.type === "css-import") {
- newObj.name = newObj.name.toLowerCase();
- }
-
- if (ast.type === "value-number") {
- newObj.unit = newObj.unit.toLowerCase();
- }
-
- 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) {
- newObj.value = cleanCSSStrings(newObj.value);
- }
-
- if (ast.type === "selector-attribute") {
- newObj.attribute = newObj.attribute.trim();
-
- if (newObj.namespace) {
- if (typeof newObj.namespace === "string") {
- newObj.namespace = newObj.namespace.trim();
-
- if (newObj.namespace.length === 0) {
- newObj.namespace = true;
- }
- }
- }
-
- if (newObj.value) {
- newObj.value = newObj.value.trim().replace(/^['"]|['"]$/g, "");
- delete newObj.quoted;
- }
- }
-
- 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) {
- newObj.value = newObj.value.replace(/([\d.eE+-]+)([a-zA-Z]*)/g, (match, numStr, unit) => {
- const num = Number(numStr);
- return isNaN(num) ? match : num + unit.toLowerCase();
- });
- }
-
- if (ast.type === "selector-tag") {
- const lowercasedValue = ast.value.toLowerCase();
-
- if (["from", "to"].includes(lowercasedValue)) {
- newObj.value = lowercasedValue;
- }
- } // Workaround when `postcss-values-parser` parse `not`, `and` or `or` keywords as `value-func`
-
-
- if (ast.type === "css-atrule" && ast.name.toLowerCase() === "supports") {
- delete newObj.value;
- } // Workaround for SCSS nested properties
-
-
- if (ast.type === "selector-unknown") {
- delete newObj.value;
- }
- }
-
- function cleanCSSStrings(value) {
- return value.replace(/'/g, '"').replace(/\\([^a-fA-F\d])/g, "$1");
- }
-
- var clean_1 = clean;
-
- const {
- builders: {
- hardline: hardline$3,
- literalline: literalline$1,
- concat: concat$4,
- markAsRoot: markAsRoot$1
- },
- utils: {
- mapDoc: mapDoc$1
- }
- } = document;
-
- function embed(path, print, textToDoc
- /*, options */
- ) {
- const node = path.getValue();
-
- if (node.type === "yaml") {
- return markAsRoot$1(concat$4(["---", hardline$3, node.value.trim() ? replaceNewlinesWithLiterallines(textToDoc(node.value, {
- parser: "yaml"
- })) : "", "---", hardline$3]));
- }
-
- return null;
-
- function replaceNewlinesWithLiterallines(doc) {
- 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);
- }
- }
-
- var embed_1 = embed;
-
- const detectNewline = string => {
- if (typeof string !== 'string') {
- throw new TypeError('Expected a string');
- }
-
- const newlines = string.match(/(?:\r?\n)/g) || [];
-
- if (newlines.length === 0) {
- return;
- }
-
- const crlf = newlines.filter(newline => newline === '\r\n').length;
- const lf = newlines.length - crlf;
- return crlf > lf ? '\r\n' : '\n';
- };
-
- var detectNewline_1 = detectNewline;
-
- var graceful = string => typeof string === 'string' && detectNewline(string) || '\n';
- detectNewline_1.graceful = graceful;
-
- var build = createCommonjsModule(function (module, exports) {
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.extract = extract;
- exports.strip = strip;
- exports.parse = parse;
- exports.parseWithComments = parseWithComments;
- exports.print = print;
-
- function _os() {
- const data = require$$0$1;
-
- _os = function _os() {
- return data;
- };
-
- return data;
- }
-
- function _detectNewline() {
- const data = _interopRequireDefault(detectNewline_1);
-
- _detectNewline = function _detectNewline() {
- return data;
- };
-
- return data;
- }
-
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-
- const commentEndRe = /\*\/$/;
- const commentStartRe = /^\/\*\*/;
- const docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
- const lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g;
- const ltrimNewlineRe = /^(\r?\n)+/;
- const multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
- const propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
- const stringStartRe = /(\r?\n|^) *\* ?/g;
-
- function extract(contents) {
- const match = contents.match(docblockRe);
- return match ? match[0].trimLeft() : '';
- }
-
- function strip(contents) {
- const match = contents.match(docblockRe);
- return match && match[0] ? contents.substring(match[0].length) : contents;
- }
-
- function parse(docblock) {
- return parseWithComments(docblock).pragmas;
- }
-
- function parseWithComments(docblock) {
- const line = (0, _detectNewline().default)(docblock) || _os().EOL;
-
- docblock = docblock.replace(commentStartRe, '').replace(commentEndRe, '').replace(stringStartRe, '$1'); // Normalize multi-line directives
-
- let prev = '';
-
- while (prev !== docblock) {
- prev = docblock;
- docblock = docblock.replace(multilineRe, "".concat(line, "$1 $2").concat(line));
- }
-
- docblock = docblock.replace(ltrimNewlineRe, '').trimRight();
- const result = Object.create(null);
- const comments = docblock.replace(propertyRe, '').replace(ltrimNewlineRe, '').trimRight();
- let match;
-
- while (match = propertyRe.exec(docblock)) {
- // strip linecomments from pragmas
- const nextPragma = match[2].replace(lineCommentRe, '');
-
- if (typeof result[match[1]] === 'string' || Array.isArray(result[match[1]])) {
- result[match[1]] = [].concat(result[match[1]], nextPragma);
- } else {
- result[match[1]] = nextPragma;
- }
- }
-
- return {
- comments,
- pragmas: result
- };
- }
-
- function print({
- comments = '',
- pragmas = {}
- }) {
- const line = (0, _detectNewline().default)(comments) || _os().EOL;
-
- const head = '/**';
- const start = ' *';
- const tail = ' */';
- const keys = Object.keys(pragmas);
- const printedObject = keys.map(key => printKeyValues(key, pragmas[key])).reduce((arr, next) => arr.concat(next), []).map(keyValue => start + ' ' + keyValue + line).join('');
-
- if (!comments) {
- if (keys.length === 0) {
- return '';
- }
-
- if (keys.length === 1 && !Array.isArray(pragmas[keys[0]])) {
- const value = pragmas[keys[0]];
- return "".concat(head, " ").concat(printKeyValues(keys[0], value)[0]).concat(tail);
- }
- }
-
- const printedComments = comments.split(line).map(textLine => "".concat(start, " ").concat(textLine)).join(line) + line;
- return head + line + (comments ? printedComments : '') + (comments && keys.length ? start + line : '') + printedObject + tail;
- }
-
- function printKeyValues(key, valueOrArray) {
- return [].concat(valueOrArray).map(value => "@".concat(key, " ").concat(value).trim());
- }
- });
- unwrapExports(build);
- var build_1 = build.extract;
- var build_2 = build.strip;
- var build_3 = build.parse;
- var build_4 = build.parseWithComments;
- var build_5 = build.print;
-
- function hasPragma(text) {
- const pragmas = Object.keys(build.parse(build.extract(text)));
- return pragmas.includes("prettier") || pragmas.includes("format");
- }
-
- function insertPragma(text) {
- const parsedDocblock = build.parseWithComments(build.extract(text));
- const pragmas = Object.assign({
- format: ""
- }, parsedDocblock.pragmas);
- const newDocblock = build.print({
- pragmas,
- comments: parsedDocblock.comments.replace(/^(\s+?\r?\n)+/, "") // remove leading newlines
-
- }).replace(/(\r\n|\r)/g, "\n"); // normalise newlines (mitigate use of os.EOL by jest-docblock)
-
- const strippedText = build.strip(text);
- const separatingNewlines = strippedText.startsWith("\n") ? "\n" : "\n\n";
- return newDocblock + separatingNewlines + strippedText;
- }
-
- var pragma = {
- hasPragma,
- insertPragma
- };
-
- const DELIMITER_MAP = {
- "---": "yaml",
- "+++": "toml"
- };
-
- function parse$1(text) {
- const delimiterRegex = Object.keys(DELIMITER_MAP).map(escapeStringRegexp$2).join("|");
- const match = text.match( // trailing spaces after delimiters are allowed
- new RegExp("^(".concat(delimiterRegex, ")[^\\n\\S]*\\n(?:([\\s\\S]*?)\\n)?\\1[^\\n\\S]*(\\n|$)")));
-
- if (match === null) {
- return {
- frontMatter: null,
- content: text
- };
- }
-
- const [raw, delimiter, value] = match;
- return {
- frontMatter: {
- type: DELIMITER_MAP[delimiter],
- value,
- raw: raw.replace(/\n$/, "")
- },
- content: raw.replace(/[^\n]/g, " ") + text.slice(raw.length)
- };
- }
-
- var frontMatter = parse$1;
-
- function hasPragma$1(text) {
- return pragma.hasPragma(frontMatter(text).content);
- }
-
- function insertPragma$1(text) {
- const {
- frontMatter: frontMatter$1,
- content
- } = frontMatter(text);
- return (frontMatter$1 ? frontMatter$1.raw + "\n\n" : "") + pragma.insertPragma(content);
- }
-
- var pragma$1 = {
- hasPragma: hasPragma$1,
- insertPragma: insertPragma$1
- };
-
- var lineColumnToIndex = function lineColumnToIndex(lineColumn, text) {
- let index = 0;
-
- for (let i = 0; i < lineColumn.line - 1; ++i) {
- index = text.indexOf("\n", index) + 1;
-
- if (index === -1) {
- return -1;
- }
- }
-
- return index + lineColumn.column;
- };
-
- const {
- getLast: getLast$1,
- skipEverythingButNewLine: skipEverythingButNewLine$2
- } = util$1;
-
- function calculateLocStart(node, text) {
- if (node.source) {
- return lineColumnToIndex(node.source.start, text) - 1;
- }
-
- return null;
- }
-
- function calculateLocEnd(node, text) {
- if (node.type === "css-comment" && node.inline) {
- return skipEverythingButNewLine$2(text, node.source.startOffset);
- }
-
- const endNode = node.nodes && getLast$1(node.nodes);
-
- if (endNode && node.source && !node.source.end) {
- node = endNode;
- }
-
- if (node.source && node.source.end) {
- return lineColumnToIndex(node.source.end, text);
- }
-
- return null;
- }
-
- function calculateLoc(node, text) {
- if (node && typeof node === "object") {
- if (node.source) {
- node.source.startOffset = calculateLocStart(node, text);
- node.source.endOffset = calculateLocEnd(node, text);
- }
-
- for (const key in node) {
- calculateLoc(node[key], text);
- }
- }
- }
- /**
- * Workaround for a bug: quotes in inline comments corrupt loc data of subsequent nodes.
- * This function replaces the quotes with U+FFFE and U+FFFF. Later, when the comments are printed,
- * their content is extracted from the original text or restored by replacing the placeholder
- * characters back with quotes.
- * - https://github.com/prettier/prettier/issues/7780
- * - https://github.com/shellscape/postcss-less/issues/145
- * - About noncharacters (U+FFFE and U+FFFF): http://www.unicode.org/faq/private_use.html#nonchar1
- * @param text {string}
- */
-
-
- function replaceQuotesInInlineComments(text) {
- /** @typedef { 'initial' | 'single-quotes' | 'double-quotes' | 'url' | 'comment-block' | 'comment-inline' } State */
-
- /** @type {State} */
- let state = "initial";
- /** @type {State} */
-
- let stateToReturnFromQuotes = "initial";
- let inlineCommentStartIndex;
- let inlineCommentContainsQuotes = false;
- const inlineCommentsToReplace = [];
-
- for (let i = 0; i < text.length; i++) {
- const c = text[i];
-
- switch (state) {
- case "initial":
- if (c === "'") {
- state = "single-quotes";
- continue;
- }
-
- if (c === '"') {
- state = "double-quotes";
- continue;
- }
-
- if ((c === "u" || c === "U") && text.slice(i, i + 4).toLowerCase() === "url(") {
- state = "url";
- i += 3;
- continue;
- }
-
- if (c === "*" && text[i - 1] === "/") {
- state = "comment-block";
- continue;
- }
-
- if (c === "/" && text[i - 1] === "/") {
- state = "comment-inline";
- inlineCommentStartIndex = i - 1;
- continue;
- }
-
- continue;
-
- case "single-quotes":
- if (c === "'" && text[i - 1] !== "\\") {
- state = stateToReturnFromQuotes;
- stateToReturnFromQuotes = "initial";
- }
-
- if (c === "\n" || c === "\r") {
- return text; // invalid input
- }
-
- continue;
-
- case "double-quotes":
- if (c === '"' && text[i - 1] !== "\\") {
- state = stateToReturnFromQuotes;
- stateToReturnFromQuotes = "initial";
- }
-
- if (c === "\n" || c === "\r") {
- return text; // invalid input
- }
-
- continue;
-
- case "url":
- if (c === ")") {
- state = "initial";
- }
-
- if (c === "\n" || c === "\r") {
- return text; // invalid input
- }
-
- if (c === "'") {
- state = "single-quotes";
- stateToReturnFromQuotes = "url";
- continue;
- }
-
- if (c === '"') {
- state = "double-quotes";
- stateToReturnFromQuotes = "url";
- continue;
- }
-
- continue;
-
- case "comment-block":
- if (c === "/" && text[i - 1] === "*") {
- state = "initial";
- }
-
- continue;
-
- case "comment-inline":
- if (c === '"' || c === "'") {
- inlineCommentContainsQuotes = true;
- }
-
- if (c === "\n" || c === "\r") {
- if (inlineCommentContainsQuotes) {
- inlineCommentsToReplace.push([inlineCommentStartIndex, i]);
- }
-
- state = "initial";
- inlineCommentContainsQuotes = false;
- }
-
- continue;
- }
- }
-
- for (const [start, end] of inlineCommentsToReplace) {
- text = text.slice(0, start) + text.slice(start, end).replace(/'/g, "\ufffe").replace(/"/g, "\uffff") + text.slice(end);
- }
-
- return text;
- }
-
- function restoreQuotesInInlineComments(text) {
- return text.replace(/\ufffe/g, "'").replace(/\uffff/g, '"');
- }
-
- var loc$1 = {
- calculateLoc,
- replaceQuotesInInlineComments,
- restoreQuotesInInlineComments
- };
-
- 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"];
-
- function getAncestorCounter(path, typeOrTypes) {
- const types = [].concat(typeOrTypes);
- let counter = -1;
- let ancestorNode;
-
- while (ancestorNode = path.getParentNode(++counter)) {
- if (types.includes(ancestorNode.type)) {
- return counter;
- }
- }
-
- return -1;
- }
-
- function getAncestorNode(path, typeOrTypes) {
- const counter = getAncestorCounter(path, typeOrTypes);
- return counter === -1 ? null : path.getParentNode(counter);
- }
-
- function getPropOfDeclNode(path) {
- const declAncestorNode = getAncestorNode(path, "css-decl");
- return declAncestorNode && declAncestorNode.prop && declAncestorNode.prop.toLowerCase();
- }
-
- function isSCSS(parser, text) {
- const hasExplicitParserChoice = parser === "less" || parser === "scss";
- const IS_POSSIBLY_SCSS = /(\w\s*:\s*[^}:]+|#){|@import[^\n]+(?:url|,)/;
- return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text);
- }
-
- function isWideKeywords(value) {
- return ["initial", "inherit", "unset", "revert"].includes(value.toLowerCase());
- }
-
- function isKeyframeAtRuleKeywords(path, value) {
- const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
- return atRuleAncestorNode && atRuleAncestorNode.name && atRuleAncestorNode.name.toLowerCase().endsWith("keyframes") && ["from", "to"].includes(value.toLowerCase());
- }
-
- function maybeToLowerCase(value) {
- return value.includes("$") || value.includes("@") || value.includes("#") || value.startsWith("%") || value.startsWith("--") || value.startsWith(":--") || value.includes("(") && value.includes(")") ? value : value.toLowerCase();
- }
-
- function insideValueFunctionNode(path, functionName) {
- const funcAncestorNode = getAncestorNode(path, "value-func");
- return funcAncestorNode && funcAncestorNode.value && funcAncestorNode.value.toLowerCase() === functionName;
- }
-
- function insideICSSRuleNode(path) {
- const ruleAncestorNode = getAncestorNode(path, "css-rule");
- return ruleAncestorNode && ruleAncestorNode.raws && ruleAncestorNode.raws.selector && (ruleAncestorNode.raws.selector.startsWith(":import") || ruleAncestorNode.raws.selector.startsWith(":export"));
- }
-
- function insideAtRuleNode(path, atRuleNameOrAtRuleNames) {
- const atRuleNames = [].concat(atRuleNameOrAtRuleNames);
- const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
- return atRuleAncestorNode && atRuleNames.includes(atRuleAncestorNode.name.toLowerCase());
- }
-
- function insideURLFunctionInImportAtRuleNode(path) {
- const node = path.getValue();
- const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
- return atRuleAncestorNode && atRuleAncestorNode.name === "import" && node.groups[0].value === "url" && node.groups.length === 2;
- }
-
- function isURLFunctionNode(node) {
- return node.type === "value-func" && node.value.toLowerCase() === "url";
- }
-
- function isLastNode(path, node) {
- const parentNode = path.getParentNode();
-
- if (!parentNode) {
- return false;
- }
-
- const {
- nodes
- } = parentNode;
- return nodes && nodes.indexOf(node) === nodes.length - 1;
- }
-
- function isDetachedRulesetDeclarationNode(node) {
- // If a Less file ends up being parsed with the SCSS parser, Less
- // variable declarations will be parsed as atrules with names ending
- // with a colon, so keep the original case then.
- if (!node.selector) {
- return false;
- }
-
- return typeof node.selector === "string" && /^@.+:.*$/.test(node.selector) || node.selector.value && /^@.+:.*$/.test(node.selector.value);
- }
-
- function isForKeywordNode(node) {
- return node.type === "value-word" && ["from", "through", "end"].includes(node.value);
- }
-
- function isIfElseKeywordNode(node) {
- return node.type === "value-word" && ["and", "or", "not"].includes(node.value);
- }
-
- function isEachKeywordNode(node) {
- return node.type === "value-word" && node.value === "in";
- }
-
- function isMultiplicationNode(node) {
- return node.type === "value-operator" && node.value === "*";
- }
-
- function isDivisionNode(node) {
- return node.type === "value-operator" && node.value === "/";
- }
-
- function isAdditionNode(node) {
- return node.type === "value-operator" && node.value === "+";
- }
-
- function isSubtractionNode(node) {
- return node.type === "value-operator" && node.value === "-";
- }
-
- function isModuloNode(node) {
- return node.type === "value-operator" && node.value === "%";
- }
-
- function isMathOperatorNode(node) {
- return isMultiplicationNode(node) || isDivisionNode(node) || isAdditionNode(node) || isSubtractionNode(node) || isModuloNode(node);
- }
-
- function isEqualityOperatorNode(node) {
- return node.type === "value-word" && ["==", "!="].includes(node.value);
- }
-
- function isRelationalOperatorNode(node) {
- return node.type === "value-word" && ["<", ">", "<=", ">="].includes(node.value);
- }
-
- function isSCSSControlDirectiveNode(node) {
- return node.type === "css-atrule" && ["if", "else", "for", "each", "while"].includes(node.name);
- }
-
- function isSCSSNestedPropertyNode(node) {
- if (!node.selector) {
- return false;
- }
-
- return node.selector.replace(/\/\*.*?\*\//, "").replace(/\/\/.*?\n/, "").trim().endsWith(":");
- }
-
- function isDetachedRulesetCallNode(node) {
- return node.raws && node.raws.params && /^\(\s*\)$/.test(node.raws.params);
- }
-
- function isTemplatePlaceholderNode(node) {
- return node.name.startsWith("prettier-placeholder");
- }
-
- function isTemplatePropNode(node) {
- return node.prop.startsWith("@prettier-placeholder");
- }
-
- function isPostcssSimpleVarNode(currentNode, nextNode) {
- return currentNode.value === "$$" && currentNode.type === "value-func" && nextNode && nextNode.type === "value-word" && !nextNode.raws.before;
- }
-
- function hasComposesNode(node) {
- return node.value && node.value.type === "value-root" && node.value.group && node.value.group.type === "value-value" && node.prop.toLowerCase() === "composes";
- }
-
- function hasParensAroundNode(node) {
- 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;
- }
-
- function hasEmptyRawBefore(node) {
- return node.raws && node.raws.before === "";
- }
-
- function isKeyValuePairNode(node) {
- return node.type === "value-comma_group" && node.groups && node.groups[1] && node.groups[1].type === "value-colon";
- }
-
- function isKeyValuePairInParenGroupNode(node) {
- return node.type === "value-paren_group" && node.groups && node.groups[0] && isKeyValuePairNode(node.groups[0]);
- }
-
- function isSCSSMapItemNode(path) {
- const node = path.getValue(); // Ignore empty item (i.e. `$key: ()`)
-
- if (node.groups.length === 0) {
- return false;
- }
-
- const parentParentNode = path.getParentNode(1); // Check open parens contain key/value pair (i.e. `(key: value)` and `(key: (value, other-value)`)
-
- if (!isKeyValuePairInParenGroupNode(node) && !(parentParentNode && isKeyValuePairInParenGroupNode(parentParentNode))) {
- return false;
- }
-
- const declNode = getAncestorNode(path, "css-decl"); // SCSS map declaration (i.e. `$map: (key: value, other-key: other-value)`)
-
- if (declNode && declNode.prop && declNode.prop.startsWith("$")) {
- return true;
- } // List as value of key inside SCSS map (i.e. `$map: (key: (value other-value other-other-value))`)
-
-
- if (isKeyValuePairInParenGroupNode(parentParentNode)) {
- return true;
- } // SCSS Map is argument of function (i.e. `func((key: value, other-key: other-value))`)
-
-
- if (parentParentNode.type === "value-func") {
- return true;
- }
-
- return false;
- }
-
- function isInlineValueCommentNode(node) {
- return node.type === "value-comment" && node.inline;
- }
-
- function isHashNode(node) {
- return node.type === "value-word" && node.value === "#";
- }
-
- function isLeftCurlyBraceNode(node) {
- return node.type === "value-word" && node.value === "{";
- }
-
- function isRightCurlyBraceNode(node) {
- return node.type === "value-word" && node.value === "}";
- }
-
- function isWordNode(node) {
- return ["value-word", "value-atword"].includes(node.type);
- }
-
- function isColonNode(node) {
- return node.type === "value-colon";
- }
-
- function isMediaAndSupportsKeywords(node) {
- return node.value && ["not", "and", "or"].includes(node.value.toLowerCase());
- }
-
- function isColorAdjusterFuncNode(node) {
- if (node.type !== "value-func") {
- return false;
- }
-
- return colorAdjusterFunctions.includes(node.value.toLowerCase());
- } // TODO: only check `less` when we don't use `less` to parse `css`
-
-
- function isLessParser(options) {
- return options.parser === "css" || options.parser === "less";
- }
-
- function lastLineHasInlineComment(text) {
- return /\/\//.test(text.split(/[\r\n]/).pop());
- }
-
- var utils$2 = {
- getAncestorCounter,
- getAncestorNode,
- getPropOfDeclNode,
- maybeToLowerCase,
- insideValueFunctionNode,
- insideICSSRuleNode,
- insideAtRuleNode,
- insideURLFunctionInImportAtRuleNode,
- isKeyframeAtRuleKeywords,
- isWideKeywords,
- isSCSS,
- isLastNode,
- isLessParser,
- isSCSSControlDirectiveNode,
- isDetachedRulesetDeclarationNode,
- isRelationalOperatorNode,
- isEqualityOperatorNode,
- isMultiplicationNode,
- isDivisionNode,
- isAdditionNode,
- isSubtractionNode,
- isModuloNode,
- isMathOperatorNode,
- isEachKeywordNode,
- isForKeywordNode,
- isURLFunctionNode,
- isIfElseKeywordNode,
- hasComposesNode,
- hasParensAroundNode,
- hasEmptyRawBefore,
- isSCSSNestedPropertyNode,
- isDetachedRulesetCallNode,
- isTemplatePlaceholderNode,
- isTemplatePropNode,
- isPostcssSimpleVarNode,
- isKeyValuePairNode,
- isKeyValuePairInParenGroupNode,
- isSCSSMapItemNode,
- isInlineValueCommentNode,
- isHashNode,
- isLeftCurlyBraceNode,
- isRightCurlyBraceNode,
- isWordNode,
- isColonNode,
- isMediaAndSupportsKeywords,
- isColorAdjusterFuncNode,
- lastLineHasInlineComment
- };
-
- const {
- insertPragma: insertPragma$2
- } = pragma$1;
- const {
- printNumber: printNumber$1,
- printString: printString$1,
- hasIgnoreComment: hasIgnoreComment$1,
- hasNewline: hasNewline$3
- } = util$1;
- const {
- isNextLineEmpty: isNextLineEmpty$2
- } = utilShared;
- const {
- restoreQuotesInInlineComments: restoreQuotesInInlineComments$1
- } = loc$1;
- const {
- builders: {
- concat: concat$5,
- join: join$2,
- line: line$2,
- hardline: hardline$4,
- softline: softline$1,
- group: group$1,
- fill: fill$2,
- indent: indent$2,
- dedent: dedent$1,
- ifBreak: ifBreak$1
- },
- utils: {
- removeLines: removeLines$1
- }
- } = document;
- const {
- getAncestorNode: getAncestorNode$1,
- getPropOfDeclNode: getPropOfDeclNode$1,
- maybeToLowerCase: maybeToLowerCase$1,
- insideValueFunctionNode: insideValueFunctionNode$1,
- insideICSSRuleNode: insideICSSRuleNode$1,
- insideAtRuleNode: insideAtRuleNode$1,
- insideURLFunctionInImportAtRuleNode: insideURLFunctionInImportAtRuleNode$1,
- isKeyframeAtRuleKeywords: isKeyframeAtRuleKeywords$1,
- isWideKeywords: isWideKeywords$1,
- isSCSS: isSCSS$1,
- isLastNode: isLastNode$1,
- isLessParser: isLessParser$1,
- isSCSSControlDirectiveNode: isSCSSControlDirectiveNode$1,
- isDetachedRulesetDeclarationNode: isDetachedRulesetDeclarationNode$1,
- isRelationalOperatorNode: isRelationalOperatorNode$1,
- isEqualityOperatorNode: isEqualityOperatorNode$1,
- isMultiplicationNode: isMultiplicationNode$1,
- isDivisionNode: isDivisionNode$1,
- isAdditionNode: isAdditionNode$1,
- isSubtractionNode: isSubtractionNode$1,
- isMathOperatorNode: isMathOperatorNode$1,
- isEachKeywordNode: isEachKeywordNode$1,
- isForKeywordNode: isForKeywordNode$1,
- isURLFunctionNode: isURLFunctionNode$1,
- isIfElseKeywordNode: isIfElseKeywordNode$1,
- hasComposesNode: hasComposesNode$1,
- hasParensAroundNode: hasParensAroundNode$1,
- hasEmptyRawBefore: hasEmptyRawBefore$1,
- isKeyValuePairNode: isKeyValuePairNode$1,
- isDetachedRulesetCallNode: isDetachedRulesetCallNode$1,
- isTemplatePlaceholderNode: isTemplatePlaceholderNode$1,
- isTemplatePropNode: isTemplatePropNode$1,
- isPostcssSimpleVarNode: isPostcssSimpleVarNode$1,
- isSCSSMapItemNode: isSCSSMapItemNode$1,
- isInlineValueCommentNode: isInlineValueCommentNode$1,
- isHashNode: isHashNode$1,
- isLeftCurlyBraceNode: isLeftCurlyBraceNode$1,
- isRightCurlyBraceNode: isRightCurlyBraceNode$1,
- isWordNode: isWordNode$1,
- isColonNode: isColonNode$1,
- isMediaAndSupportsKeywords: isMediaAndSupportsKeywords$1,
- isColorAdjusterFuncNode: isColorAdjusterFuncNode$1,
- lastLineHasInlineComment: lastLineHasInlineComment$1
- } = utils$2;
-
- function shouldPrintComma(options) {
- switch (options.trailingComma) {
- case "all":
- case "es5":
- return true;
-
- case "none":
- default:
- return false;
- }
- }
-
- function genericPrint(path, options, print) {
- const node = path.getValue();
- /* istanbul ignore if */
-
- if (!node) {
- return "";
- }
-
- if (typeof node === "string") {
- return node;
- }
-
- switch (node.type) {
- case "yaml":
- case "toml":
- return concat$5([node.raw, hardline$4]);
-
- case "css-root":
- {
- const nodes = printNodeSequence(path, options, print);
-
- if (nodes.parts.length) {
- return concat$5([nodes, options.__isHTMLStyleAttribute ? "" : hardline$4]);
- }
-
- return nodes;
- }
-
- case "css-comment":
- {
- const isInlineComment = node.inline || node.raws.inline;
- const text = options.originalText.slice(options.locStart(node), options.locEnd(node));
- return isInlineComment ? text.trimEnd() : text;
- }
-
- case "css-rule":
- {
- 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) ? ";" : ""]) : ";"]);
- }
-
- case "css-decl":
- {
- const parentNode = path.getParentNode();
- 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] !== ";" ? "" : ";"]);
- }
-
- case "css-atrule":
- {
- const parentNode = path.getParentNode();
- const isTemplatePlaceholderNodeWithoutSemiColon = isTemplatePlaceholderNode$1(node) && !parentNode.raws.semicolon && options.originalText[options.locEnd(node) - 1] !== ";";
-
- if (isLessParser$1(options)) {
- if (node.mixin) {
- return concat$5([path.call(print, "selector"), node.important ? " !important" : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
- }
-
- if (node.function) {
- return concat$5([node.name, concat$5([path.call(print, "params")]), isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
- }
-
- if (node.variable) {
- 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 ? "" : ";"]);
- }
- }
-
- return concat$5(["@", // If a Less file ends up being parsed with the SCSS parser, Less
- // variable declarations will be parsed as at-rules with names ending
- // with a colon, so keep the original case then.
- 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 ? "" : ";"]);
- }
- // postcss-media-query-parser
-
- case "media-query-list":
- {
- const parts = [];
- path.each(childPath => {
- const node = childPath.getValue();
-
- if (node.type === "media-query" && node.value === "") {
- return;
- }
-
- parts.push(childPath.call(print));
- }, "nodes");
- return group$1(indent$2(join$2(line$2, parts)));
- }
-
- case "media-query":
- {
- return concat$5([join$2(" ", path.map(print, "nodes")), isLastNode$1(path, node) ? "" : ","]);
- }
-
- case "media-type":
- {
- return adjustNumbers(adjustStrings(node.value, options));
- }
-
- case "media-feature-expression":
- {
- if (!node.nodes) {
- return node.value;
- }
-
- return concat$5(["(", concat$5(path.map(print, "nodes")), ")"]);
- }
-
- case "media-feature":
- {
- return maybeToLowerCase$1(adjustStrings(node.value.replace(/ +/g, " "), options));
- }
-
- case "media-colon":
- {
- return concat$5([node.value, " "]);
- }
-
- case "media-value":
- {
- return adjustNumbers(adjustStrings(node.value, options));
- }
-
- case "media-keyword":
- {
- return adjustStrings(node.value, options);
- }
-
- case "media-url":
- {
- return adjustStrings(node.value.replace(/^url\(\s+/gi, "url(").replace(/\s+\)$/gi, ")"), options);
- }
-
- case "media-unknown":
- {
- return node.value;
- }
- // postcss-selector-parser
-
- case "selector-root":
- {
- 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"))]));
- }
-
- case "selector-selector":
- {
- return group$1(indent$2(concat$5(path.map(print, "nodes"))));
- }
-
- case "selector-comment":
- {
- return node.value;
- }
-
- case "selector-string":
- {
- return adjustStrings(node.value, options);
- }
-
- case "selector-tag":
- {
- const parentNode = path.getParentNode();
- const index = parentNode && parentNode.nodes.indexOf(node);
- const prevNode = index && parentNode.nodes[index - 1];
- 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)]);
- }
-
- case "selector-id":
- {
- return concat$5(["#", node.value]);
- }
-
- case "selector-class":
- {
- return concat$5([".", adjustNumbers(adjustStrings(node.value, options))]);
- }
-
- case "selector-attribute":
- {
- 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" : "", "]"]);
- }
-
- case "selector-combinator":
- {
- if (node.value === "+" || node.value === ">" || node.value === "~" || node.value === ">>>") {
- const parentNode = path.getParentNode();
- const leading = parentNode.type === "selector-selector" && parentNode.nodes[0] === node ? "" : line$2;
- return concat$5([leading, node.value, isLastNode$1(path, node) ? "" : " "]);
- }
-
- const leading = node.value.trim().startsWith("(") ? line$2 : "";
- const value = adjustNumbers(adjustStrings(node.value.trim(), options)) || line$2;
- return concat$5([leading, value]);
- }
-
- case "selector-universal":
- {
- return concat$5([node.namespace ? concat$5([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", node.value]);
- }
-
- case "selector-pseudo":
- {
- return concat$5([maybeToLowerCase$1(node.value), node.nodes && node.nodes.length > 0 ? concat$5(["(", join$2(", ", path.map(print, "nodes")), ")"]) : ""]);
- }
-
- case "selector-nesting":
- {
- return node.value;
- }
-
- case "selector-unknown":
- {
- const ruleAncestorNode = getAncestorNode$1(path, "css-rule"); // Nested SCSS property
-
- if (ruleAncestorNode && ruleAncestorNode.isSCSSNesterProperty) {
- return adjustNumbers(adjustStrings(maybeToLowerCase$1(node.value), options));
- } // originalText has to be used for Less, see replaceQuotesInInlineComments in loc.js
-
-
- const parentNode = path.getParentNode();
-
- if (parentNode.raws && parentNode.raws.selector) {
- const start = options.locStart(parentNode);
- const end = start + parentNode.raws.selector.length;
- return options.originalText.slice(start, end).trim();
- }
-
- return node.value;
- }
- // postcss-values-parser
-
- case "value-value":
- case "value-root":
- {
- return path.call(print, "group");
- }
-
- case "value-comment":
- {
- return concat$5([node.inline ? "//" : "/*", // see replaceQuotesInInlineComments in loc.js
- // value-* nodes don't have correct location data, so we have to rely on placeholder characters.
- restoreQuotesInInlineComments$1(node.value), node.inline ? "" : "*/"]);
- }
-
- case "value-comma_group":
- {
- const parentNode = path.getParentNode();
- const parentParentNode = path.getParentNode(1);
- const declAncestorProp = getPropOfDeclNode$1(path);
- const isGridValue = declAncestorProp && parentNode.type === "value-value" && (declAncestorProp === "grid" || declAncestorProp.startsWith("grid-template"));
- const atRuleAncestorNode = getAncestorNode$1(path, "css-atrule");
- const isControlDirective = atRuleAncestorNode && isSCSSControlDirectiveNode$1(atRuleAncestorNode);
- const printed = path.map(print, "groups");
- const parts = [];
- const insideURLFunction = insideValueFunctionNode$1(path, "url");
- let insideSCSSInterpolationInString = false;
- let didBreak = false;
-
- for (let i = 0; i < node.groups.length; ++i) {
- parts.push(printed[i]);
- const iPrevNode = node.groups[i - 1];
- const iNode = node.groups[i];
- const iNextNode = node.groups[i + 1];
- const iNextNextNode = node.groups[i + 2];
-
- if (insideURLFunction) {
- if (iNextNode && isAdditionNode$1(iNextNode) || isAdditionNode$1(iNode)) {
- parts.push(" ");
- }
-
- continue;
- } // Ignore after latest node (i.e. before semicolon)
-
-
- if (!iNextNode) {
- continue;
- } // styled.div` background: var(--${one}); `
-
-
- if (!iPrevNode && iNode.value === "--" && iNextNode.type === "value-atword") {
- continue;
- } // Ignore spaces before/after string interpolation (i.e. `"#{my-fn("_")}"`)
-
-
- const isStartSCSSInterpolationInString = iNode.type === "value-string" && iNode.value.startsWith("#{");
- const isEndingSCSSInterpolationInString = insideSCSSInterpolationInString && iNextNode.type === "value-string" && iNextNode.value.endsWith("}");
-
- if (isStartSCSSInterpolationInString || isEndingSCSSInterpolationInString) {
- insideSCSSInterpolationInString = !insideSCSSInterpolationInString;
- continue;
- }
-
- if (insideSCSSInterpolationInString) {
- continue;
- } // Ignore colon (i.e. `:`)
-
-
- if (isColonNode$1(iNode) || isColonNode$1(iNextNode)) {
- continue;
- } // Ignore `@` in Less (i.e. `@@var;`)
-
-
- if (iNode.type === "value-atword" && iNode.value === "") {
- continue;
- } // Ignore `~` in Less (i.e. `content: ~"^//* some horrible but needed css hack";`)
-
-
- if (iNode.value === "~") {
- continue;
- } // Ignore escape `\`
-
-
- if (iNode.value && iNode.value.includes("\\") && iNextNode && iNextNode.type !== "value-comment") {
- continue;
- } // Ignore escaped `/`
-
-
- if (iPrevNode && iPrevNode.value && iPrevNode.value.indexOf("\\") === iPrevNode.value.length - 1 && iNode.type === "value-operator" && iNode.value === "/") {
- continue;
- } // Ignore `\` (i.e. `$variable: \@small;`)
-
-
- if (iNode.value === "\\") {
- continue;
- } // Ignore `$$` (i.e. `background-color: $$(style)Color;`)
-
-
- if (isPostcssSimpleVarNode$1(iNode, iNextNode)) {
- continue;
- } // Ignore spaces after `#` and after `{` and before `}` in SCSS interpolation (i.e. `#{variable}`)
-
-
- if (isHashNode$1(iNode) || isLeftCurlyBraceNode$1(iNode) || isRightCurlyBraceNode$1(iNextNode) || isLeftCurlyBraceNode$1(iNextNode) && hasEmptyRawBefore$1(iNextNode) || isRightCurlyBraceNode$1(iNode) && hasEmptyRawBefore$1(iNextNode)) {
- continue;
- } // Ignore css variables and interpolation in SCSS (i.e. `--#{$var}`)
-
-
- if (iNode.value === "--" && isHashNode$1(iNextNode)) {
- continue;
- } // Formatting math operations
-
-
- const isMathOperator = isMathOperatorNode$1(iNode);
- const isNextMathOperator = isMathOperatorNode$1(iNextNode); // Print spaces before and after math operators beside SCSS interpolation as is
- // (i.e. `#{$var}+5`, `#{$var} +5`, `#{$var}+ 5`, `#{$var} + 5`)
- // (i.e. `5+#{$var}`, `5 +#{$var}`, `5+ #{$var}`, `5 + #{$var}`)
-
- if ((isMathOperator && isHashNode$1(iNextNode) || isNextMathOperator && isRightCurlyBraceNode$1(iNode)) && hasEmptyRawBefore$1(iNextNode)) {
- continue;
- } // Print spaces before and after addition and subtraction math operators as is in `calc` function
- // due to the fact that it is not valid syntax
- // (i.e. `calc(1px+1px)`, `calc(1px+ 1px)`, `calc(1px +1px)`, `calc(1px + 1px)`)
-
-
- if (insideValueFunctionNode$1(path, "calc") && (isAdditionNode$1(iNode) || isAdditionNode$1(iNextNode) || isSubtractionNode$1(iNode) || isSubtractionNode$1(iNextNode)) && hasEmptyRawBefore$1(iNextNode)) {
- continue;
- } // Print spaces after `+` and `-` in color adjuster functions as is (e.g. `color(red l(+ 20%))`)
- // Adjusters with signed numbers (e.g. `color(red l(+20%))`) output as-is.
-
-
- const isColorAdjusterNode = (isAdditionNode$1(iNode) || isSubtractionNode$1(iNode)) && i === 0 && (iNextNode.type === "value-number" || iNextNode.isHex) && parentParentNode && isColorAdjusterFuncNode$1(parentParentNode) && !hasEmptyRawBefore$1(iNextNode);
- const requireSpaceBeforeOperator = iNextNextNode && iNextNextNode.type === "value-func" || iNextNextNode && isWordNode$1(iNextNextNode) || iNode.type === "value-func" || isWordNode$1(iNode);
- const requireSpaceAfterOperator = iNextNode.type === "value-func" || isWordNode$1(iNextNode) || iPrevNode && iPrevNode.type === "value-func" || iPrevNode && isWordNode$1(iPrevNode); // Formatting `/`, `+`, `-` sign
-
- 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)))) {
- continue;
- } // Add `hardline` after inline comment (i.e. `// comment\n foo: bar;`)
-
-
- if (isInlineValueCommentNode$1(iNode)) {
- parts.push(hardline$4);
- continue;
- } // Handle keywords in SCSS control directive
-
-
- if (isControlDirective && (isEqualityOperatorNode$1(iNextNode) || isRelationalOperatorNode$1(iNextNode) || isIfElseKeywordNode$1(iNextNode) || isEachKeywordNode$1(iNode) || isForKeywordNode$1(iNode))) {
- parts.push(" ");
- continue;
- } // At-rule `namespace` should be in one line
-
-
- if (atRuleAncestorNode && atRuleAncestorNode.name.toLowerCase() === "namespace") {
- parts.push(" ");
- continue;
- } // Formatting `grid` property
-
-
- if (isGridValue) {
- if (iNode.source && iNextNode.source && iNode.source.start.line !== iNextNode.source.start.line) {
- parts.push(hardline$4);
- didBreak = true;
- } else {
- parts.push(" ");
- }
-
- continue;
- } // Add `space` before next math operation
- // Note: `grip` property have `/` delimiter and it is not math operation, so
- // `grid` property handles above
-
-
- if (isNextMathOperator) {
- parts.push(" ");
- continue;
- } // Be default all values go through `line`
-
-
- parts.push(line$2);
- }
-
- if (didBreak) {
- parts.unshift(hardline$4);
- }
-
- if (isControlDirective) {
- return group$1(indent$2(concat$5(parts)));
- } // Indent is not needed for import url when url is very long
- // and node has two groups
- // when type is value-comma_group
- // example @import url("verylongurl") projection,tv
-
-
- if (insideURLFunctionInImportAtRuleNode$1(path)) {
- return group$1(fill$2(parts));
- }
-
- return group$1(indent$2(fill$2(parts)));
- }
-
- case "value-paren_group":
- {
- const parentNode = path.getParentNode();
-
- 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:"))) {
- return concat$5([node.open ? path.call(print, "open") : "", join$2(",", path.map(print, "groups")), node.close ? path.call(print, "close") : ""]);
- }
-
- if (!node.open) {
- const printed = path.map(print, "groups");
- const res = [];
-
- for (let i = 0; i < printed.length; i++) {
- if (i !== 0) {
- res.push(concat$5([",", line$2]));
- }
-
- res.push(printed[i]);
- }
-
- return group$1(indent$2(fill$2(res)));
- }
-
- const isSCSSMapItem = isSCSSMapItemNode$1(path);
- const lastItem = node.groups[node.groups.length - 1];
- const isLastItemComment = lastItem && lastItem.type === "value-comment";
- 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 => {
- const node = childPath.getValue();
- const printed = print(childPath); // Key/Value pair in open paren already indented
-
- if (isKeyValuePairNode$1(node) && node.type === "value-comma_group" && node.groups && node.groups[2] && node.groups[2].type === "value-paren_group") {
- printed.contents.contents.parts[1] = group$1(printed.contents.contents.parts[1]);
- return group$1(dedent$1(printed));
- }
-
- return printed;
- }, "groups"))])), ifBreak$1(!isLastItemComment && isSCSS$1(options.parser, options.originalText) && isSCSSMapItem && shouldPrintComma(options) ? "," : ""), softline$1, node.close ? path.call(print, "close") : ""]), {
- shouldBreak: isSCSSMapItem
- });
- }
-
- case "value-func":
- {
- return concat$5([node.value, insideAtRuleNode$1(path, "supports") && isMediaAndSupportsKeywords$1(node) ? " " : "", path.call(print, "group")]);
- }
-
- case "value-paren":
- {
- return node.value;
- }
-
- case "value-number":
- {
- return concat$5([printCssNumber(node.value), maybeToLowerCase$1(node.unit)]);
- }
-
- case "value-operator":
- {
- return node.value;
- }
-
- case "value-word":
- {
- if (node.isColor && node.isHex || isWideKeywords$1(node.value)) {
- return node.value.toLowerCase();
- }
-
- return node.value;
- }
-
- case "value-colon":
- {
- return concat$5([node.value, // Don't add spaces on `:` in `url` function (i.e. `url(fbglyph: cross-outline, fig-white)`)
- insideValueFunctionNode$1(path, "url") ? "" : line$2]);
- }
-
- case "value-comma":
- {
- return concat$5([node.value, " "]);
- }
-
- case "value-string":
- {
- return printString$1(node.raws.quote + node.value + node.raws.quote, options);
- }
-
- case "value-atword":
- {
- return concat$5(["@", node.value]);
- }
-
- case "value-unicode-range":
- {
- return node.value;
- }
-
- case "value-unknown":
- {
- return node.value;
- }
-
- default:
- /* istanbul ignore next */
- throw new Error("Unknown postcss type ".concat(JSON.stringify(node.type)));
- }
- }
-
- function printNodeSequence(path, options, print) {
- const node = path.getValue();
- const parts = [];
- let i = 0;
- path.map(pathChild => {
- const prevNode = node.nodes[i - 1];
-
- if (prevNode && prevNode.type === "css-comment" && prevNode.text.trim() === "prettier-ignore") {
- const childNode = pathChild.getValue();
- parts.push(options.originalText.slice(options.locStart(childNode), options.locEnd(childNode)));
- } else {
- parts.push(pathChild.call(print));
- }
-
- if (i !== node.nodes.length - 1) {
- if (node.nodes[i + 1].type === "css-comment" && !hasNewline$3(options.originalText, options.locStart(node.nodes[i + 1]), {
- backwards: true
- }) && 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") {
- parts.push(" ");
- } else {
- parts.push(options.__isHTMLStyleAttribute ? line$2 : hardline$4);
-
- if (isNextLineEmpty$2(options.originalText, pathChild.getValue(), options.locEnd) && node.nodes[i].type !== "yaml" && node.nodes[i].type !== "toml") {
- parts.push(hardline$4);
- }
- }
- }
-
- i++;
- }, "nodes");
- return concat$5(parts);
- }
-
- const STRING_REGEX$3 = /(['"])(?:(?!\1)[^\\]|\\[\s\S])*\1/g;
- const NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g;
- const STANDARD_UNIT_REGEX = /[a-zA-Z]+/g;
- const WORD_PART_REGEX = /[$@]?[a-zA-Z_\u0080-\uFFFF][\w\-\u0080-\uFFFF]*/g;
- 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");
-
- function adjustStrings(value, options) {
- return value.replace(STRING_REGEX$3, match => printString$1(match, options));
- }
-
- function quoteAttributeValue(value, options) {
- const quote = options.singleQuote ? "'" : '"';
- return value.includes('"') || value.includes("'") ? value : quote + value + quote;
- }
-
- function adjustNumbers(value) {
- return value.replace(ADJUST_NUMBERS_REGEX, (match, quote, wordPart, number, unit) => !wordPart && number ? printCssNumber(number) + maybeToLowerCase$1(unit || "") : match);
- }
-
- function printCssNumber(rawNumber) {
- return printNumber$1(rawNumber) // Remove trailing `.0`.
- .replace(/\.0(?=$|e)/, "");
- }
-
- var printerPostcss = {
- print: genericPrint,
- embed: embed_1,
- insertPragma: insertPragma$2,
- hasPrettierIgnore: hasIgnoreComment$1,
- massageAstNode: clean_1
- };
-
- const CATEGORY_COMMON = "Common"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
-
- var commonOptions = {
- bracketSpacing: {
- since: "0.0.0",
- category: CATEGORY_COMMON,
- type: "boolean",
- default: true,
- description: "Print spaces between brackets.",
- oppositeDescription: "Do not print spaces between brackets."
- },
- singleQuote: {
- since: "0.0.0",
- category: CATEGORY_COMMON,
- type: "boolean",
- default: false,
- description: "Use single quotes instead of double quotes."
- },
- proseWrap: {
- since: "1.8.2",
- category: CATEGORY_COMMON,
- type: "choice",
- default: [{
- since: "1.8.2",
- value: true
- }, {
- since: "1.9.0",
- value: "preserve"
- }],
- description: "How to wrap prose.",
- choices: [{
- since: "1.9.0",
- value: "always",
- description: "Wrap prose if it exceeds the print width."
- }, {
- since: "1.9.0",
- value: "never",
- description: "Do not wrap prose."
- }, {
- since: "1.9.0",
- value: "preserve",
- description: "Wrap prose as-is."
- }]
- }
- };
-
- var options$2 = {
- singleQuote: commonOptions.singleQuote
- };
-
- var createLanguage = function createLanguage(linguistData, override) {
- const {
- languageId
- } = linguistData,
- rest = _objectWithoutPropertiesLoose(linguistData, ["languageId"]);
-
- return Object.assign({
- linguistLanguageId: languageId
- }, rest, {}, override(linguistData));
- };
-
- var name$1 = "CSS";
- var type = "markup";
- var tmScope = "source.css";
- var aceMode = "css";
- var codemirrorMode = "css";
- var codemirrorMimeType = "text/css";
- var color = "#563d7c";
- var extensions = [
- ".css"
- ];
- var languageId = 50;
- var CSS = {
- name: name$1,
- type: type,
- tmScope: tmScope,
- aceMode: aceMode,
- codemirrorMode: codemirrorMode,
- codemirrorMimeType: codemirrorMimeType,
- color: color,
- extensions: extensions,
- languageId: languageId
- };
-
- var CSS$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$1,
- type: type,
- tmScope: tmScope,
- aceMode: aceMode,
- codemirrorMode: codemirrorMode,
- codemirrorMimeType: codemirrorMimeType,
- color: color,
- extensions: extensions,
- languageId: languageId,
- 'default': CSS
- });
-
- var name$2 = "PostCSS";
- var type$1 = "markup";
- var tmScope$1 = "source.postcss";
- var group$2 = "CSS";
- var extensions$1 = [
- ".pcss",
- ".postcss"
- ];
- var aceMode$1 = "text";
- var languageId$1 = 262764437;
- var PostCSS = {
- name: name$2,
- type: type$1,
- tmScope: tmScope$1,
- group: group$2,
- extensions: extensions$1,
- aceMode: aceMode$1,
- languageId: languageId$1
- };
-
- var PostCSS$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$2,
- type: type$1,
- tmScope: tmScope$1,
- group: group$2,
- extensions: extensions$1,
- aceMode: aceMode$1,
- languageId: languageId$1,
- 'default': PostCSS
- });
-
- var name$3 = "Less";
- var type$2 = "markup";
- var group$3 = "CSS";
- var extensions$2 = [
- ".less"
- ];
- var tmScope$2 = "source.css.less";
- var aceMode$2 = "less";
- var codemirrorMode$1 = "css";
- var codemirrorMimeType$1 = "text/css";
- var languageId$2 = 198;
- var Less = {
- name: name$3,
- type: type$2,
- group: group$3,
- extensions: extensions$2,
- tmScope: tmScope$2,
- aceMode: aceMode$2,
- codemirrorMode: codemirrorMode$1,
- codemirrorMimeType: codemirrorMimeType$1,
- languageId: languageId$2
- };
-
- var Less$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$3,
- type: type$2,
- group: group$3,
- extensions: extensions$2,
- tmScope: tmScope$2,
- aceMode: aceMode$2,
- codemirrorMode: codemirrorMode$1,
- codemirrorMimeType: codemirrorMimeType$1,
- languageId: languageId$2,
- 'default': Less
- });
-
- var name$4 = "SCSS";
- var type$3 = "markup";
- var tmScope$3 = "source.css.scss";
- var group$4 = "CSS";
- var aceMode$3 = "scss";
- var codemirrorMode$2 = "css";
- var codemirrorMimeType$2 = "text/x-scss";
- var extensions$3 = [
- ".scss"
- ];
- var languageId$3 = 329;
- var SCSS = {
- name: name$4,
- type: type$3,
- tmScope: tmScope$3,
- group: group$4,
- aceMode: aceMode$3,
- codemirrorMode: codemirrorMode$2,
- codemirrorMimeType: codemirrorMimeType$2,
- extensions: extensions$3,
- languageId: languageId$3
- };
-
- var SCSS$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$4,
- type: type$3,
- tmScope: tmScope$3,
- group: group$4,
- aceMode: aceMode$3,
- codemirrorMode: codemirrorMode$2,
- codemirrorMimeType: codemirrorMimeType$2,
- extensions: extensions$3,
- languageId: languageId$3,
- 'default': SCSS
- });
-
- var require$$0$2 = getCjsExportFromNamespace(CSS$1);
-
- var require$$1 = getCjsExportFromNamespace(PostCSS$1);
-
- var require$$2 = getCjsExportFromNamespace(Less$1);
-
- var require$$3 = getCjsExportFromNamespace(SCSS$1);
-
- const languages = [createLanguage(require$$0$2, () => ({
- since: "1.4.0",
- parsers: ["css"],
- vscodeLanguageIds: ["css"]
- })), createLanguage(require$$1, () => ({
- since: "1.4.0",
- parsers: ["css"],
- vscodeLanguageIds: ["postcss"]
- })), createLanguage(require$$2, () => ({
- since: "1.4.0",
- parsers: ["less"],
- vscodeLanguageIds: ["less"]
- })), createLanguage(require$$3, () => ({
- since: "1.4.0",
- parsers: ["scss"],
- vscodeLanguageIds: ["scss"]
- }))];
- const printers = {
- postcss: printerPostcss
- };
- var languageCss = {
- languages,
- options: options$2,
- printers
- };
-
- function hasPragma$2(text) {
- return /^\s*#[^\n\S]*@(format|prettier)\s*(\n|$)/.test(text);
- }
-
- function insertPragma$3(text) {
- return "# @format\n\n" + text;
- }
-
- var pragma$2 = {
- hasPragma: hasPragma$2,
- insertPragma: insertPragma$3
- };
-
- const {
- concat: concat$6,
- join: join$3,
- hardline: hardline$5,
- line: line$3,
- softline: softline$2,
- group: group$5,
- indent: indent$3,
- ifBreak: ifBreak$2
- } = document.builders;
- const {
- hasIgnoreComment: hasIgnoreComment$2
- } = util$1;
- const {
- isNextLineEmpty: isNextLineEmpty$3
- } = utilShared;
- const {
- insertPragma: insertPragma$4
- } = pragma$2;
-
- function genericPrint$1(path, options, print) {
- const n = path.getValue();
-
- if (!n) {
- return "";
- }
-
- if (typeof n === "string") {
- return n;
- }
-
- switch (n.kind) {
- case "Document":
- {
- const parts = [];
- path.map((pathChild, index) => {
- parts.push(concat$6([pathChild.call(print)]));
-
- if (index !== n.definitions.length - 1) {
- parts.push(hardline$5);
-
- if (isNextLineEmpty$3(options.originalText, pathChild.getValue(), options.locEnd)) {
- parts.push(hardline$5);
- }
- }
- }, "definitions");
- return concat$6([concat$6(parts), hardline$5]);
- }
-
- case "OperationDefinition":
- {
- const hasOperation = options.originalText[options.locStart(n)] !== "{";
- const hasName = !!n.name;
- 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")]);
- }
-
- case "FragmentDefinition":
- {
- 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")]);
- }
-
- case "SelectionSet":
- {
- return concat$6(["{", indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(selectionsPath => printSequence(selectionsPath, options, print), "selections"))])), hardline$5, "}"]);
- }
-
- case "Field":
- {
- 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")]));
- }
-
- case "Name":
- {
- return n.value;
- }
-
- case "StringValue":
- {
- if (n.block) {
- return concat$6(['"""', hardline$5, join$3(hardline$5, n.value.replace(/"""/g, "\\$&").split("\n")), hardline$5, '"""']);
- }
-
- return concat$6(['"', n.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"']);
- }
-
- case "IntValue":
- case "FloatValue":
- case "EnumValue":
- {
- return n.value;
- }
-
- case "BooleanValue":
- {
- return n.value ? "true" : "false";
- }
-
- case "NullValue":
- {
- return "null";
- }
-
- case "Variable":
- {
- return concat$6(["$", path.call(print, "name")]);
- }
-
- case "ListValue":
- {
- 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, "]"]));
- }
-
- case "ObjectValue":
- {
- 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 ? " " : ""), "}"]));
- }
-
- case "ObjectField":
- case "Argument":
- {
- return concat$6([path.call(print, "name"), ": ", path.call(print, "value")]);
- }
-
- case "Directive":
- {
- 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, ")"])) : ""]);
- }
-
- case "NamedType":
- {
- return path.call(print, "name");
- }
-
- case "VariableDefinition":
- {
- return concat$6([path.call(print, "variable"), ": ", path.call(print, "type"), n.defaultValue ? concat$6([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]);
- }
-
- case "TypeExtensionDefinition":
- {
- return concat$6(["extend ", path.call(print, "definition")]);
- }
-
- case "ObjectTypeExtension":
- case "ObjectTypeDefinition":
- {
- 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, "}"]) : ""]);
- }
-
- case "FieldDefinition":
- {
- 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)]);
- }
-
- case "DirectiveDefinition":
- {
- 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"))])]);
- }
-
- case "EnumTypeExtension":
- case "EnumTypeDefinition":
- {
- 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, "}"]) : ""]);
- }
-
- case "EnumValueDefinition":
- {
- return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", path.call(print, "name"), printDirectives(path, print, n)]);
- }
-
- case "InputValueDefinition":
- {
- 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)]);
- }
-
- case "InputObjectTypeExtension":
- case "InputObjectTypeDefinition":
- {
- 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, "}"]) : ""]);
- }
-
- case "SchemaDefinition":
- {
- 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, "}"]);
- }
-
- case "OperationTypeDefinition":
- {
- return concat$6([path.call(print, "operation"), ": ", path.call(print, "type")]);
- }
-
- case "InterfaceTypeExtension":
- case "InterfaceTypeDefinition":
- {
- 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, "}"]) : ""]);
- }
-
- case "FragmentSpread":
- {
- return concat$6(["...", path.call(print, "name"), printDirectives(path, print, n)]);
- }
-
- case "InlineFragment":
- {
- return concat$6(["...", n.typeCondition ? concat$6([" on ", path.call(print, "typeCondition")]) : "", printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
- }
-
- case "UnionTypeExtension":
- case "UnionTypeDefinition":
- {
- 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"))]))]) : ""]))]));
- }
-
- case "ScalarTypeExtension":
- case "ScalarTypeDefinition":
- {
- return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", n.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", path.call(print, "name"), printDirectives(path, print, n)]);
- }
-
- case "NonNullType":
- {
- return concat$6([path.call(print, "type"), "!"]);
- }
-
- case "ListType":
- {
- return concat$6(["[", path.call(print, "type"), "]"]);
- }
-
- default:
- /* istanbul ignore next */
- throw new Error("unknown graphql type: " + JSON.stringify(n.kind));
- }
- }
-
- function printDirectives(path, print, n) {
- if (n.directives.length === 0) {
- return "";
- }
-
- return concat$6([" ", group$5(indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", " "), softline$2]), path.map(print, "directives"))])))]);
- }
-
- function printSequence(sequencePath, options, print) {
- const count = sequencePath.getValue().length;
- return sequencePath.map((path, i) => {
- const printed = print(path);
-
- if (isNextLineEmpty$3(options.originalText, path.getValue(), options.locEnd) && i < count - 1) {
- return concat$6([printed, hardline$5]);
- }
-
- return printed;
- });
- }
-
- function canAttachComment(node) {
- return node.kind && node.kind !== "Comment";
- }
-
- function printComment$1(commentPath) {
- const comment = commentPath.getValue();
-
- if (comment.kind === "Comment") {
- return "#" + comment.value.trimEnd();
- }
-
- throw new Error("Not a comment: " + JSON.stringify(comment));
- }
-
- function determineInterfaceSeparatorBetween(first, second, options) {
- const textBetween = options.originalText.slice(first.loc.end, second.loc.start).replace(/#.*/g, "").trim();
- return textBetween === "," ? ", " : " & ";
- }
-
- function printInterfaces(path, options, print) {
- const node = path.getNode();
- const parts = [];
- const {
- interfaces
- } = node;
- const printed = path.map(node => print(node), "interfaces");
-
- for (let index = 0; index < interfaces.length; index++) {
- const interfaceNode = interfaces[index];
-
- if (index > 0) {
- parts.push(determineInterfaceSeparatorBetween(interfaces[index - 1], interfaceNode, options));
- }
-
- parts.push(printed[index]);
- }
-
- return parts;
- }
-
- function clean$1(node, newNode
- /*, parent*/
- ) {
- delete newNode.loc;
- delete newNode.comments;
- }
-
- var printerGraphql = {
- print: genericPrint$1,
- massageAstNode: clean$1,
- hasPrettierIgnore: hasIgnoreComment$2,
- insertPragma: insertPragma$4,
- printComment: printComment$1,
- canAttachComment
- };
-
- var options$3 = {
- bracketSpacing: commonOptions.bracketSpacing
- };
-
- var name$5 = "GraphQL";
- var type$4 = "data";
- var extensions$4 = [
- ".graphql",
- ".gql",
- ".graphqls"
- ];
- var tmScope$4 = "source.graphql";
- var aceMode$4 = "text";
- var languageId$4 = 139;
- var GraphQL = {
- name: name$5,
- type: type$4,
- extensions: extensions$4,
- tmScope: tmScope$4,
- aceMode: aceMode$4,
- languageId: languageId$4
- };
-
- var GraphQL$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$5,
- type: type$4,
- extensions: extensions$4,
- tmScope: tmScope$4,
- aceMode: aceMode$4,
- languageId: languageId$4,
- 'default': GraphQL
- });
-
- var require$$0$3 = getCjsExportFromNamespace(GraphQL$1);
-
- const languages$1 = [createLanguage(require$$0$3, () => ({
- since: "1.5.0",
- parsers: ["graphql"],
- vscodeLanguageIds: ["graphql"]
- }))];
- const printers$1 = {
- graphql: printerGraphql
- };
- var languageGraphql = {
- languages: languages$1,
- options: options$3,
- printers: printers$1
- };
-
- var clean$2 = function clean(ast, newNode) {
- delete newNode.loc;
- delete newNode.selfClosing; // (Glimmer/HTML) ignore TextNode whitespace
-
- if (ast.type === "TextNode") {
- const trimmed = ast.chars.trim();
-
- if (!trimmed) {
- return null;
- }
-
- newNode.chars = trimmed;
- }
- };
-
- function isUppercase(string) {
- return string.toUpperCase() === string;
- }
-
- function isGlimmerComponent(node) {
- return isNodeOfSomeType(node, ["ElementNode"]) && typeof node.tag === "string" && (isUppercase(node.tag[0]) || node.tag.includes("."));
- }
-
- function isWhitespaceNode(node) {
- return isNodeOfSomeType(node, ["TextNode"]) && !/\S/.test(node.chars);
- }
-
- function isNodeOfSomeType(node, types) {
- return node && types.some(type => node.type === type);
- }
-
- function isParentOfSomeType(path, types) {
- const parentNode = path.getParentNode(0);
- return isNodeOfSomeType(parentNode, types);
- }
-
- function isPreviousNodeOfSomeType(path, types) {
- const previousNode = getPreviousNode(path);
- return isNodeOfSomeType(previousNode, types);
- }
-
- function isNextNodeOfSomeType(path, types) {
- const nextNode = getNextNode(path);
- return isNodeOfSomeType(nextNode, types);
- }
-
- function getSiblingNode(path, offset) {
- const node = path.getValue();
- const parentNode = path.getParentNode(0) || {};
- const children = parentNode.children || parentNode.body || [];
- const index = children.indexOf(node);
- return index !== -1 && children[index + offset];
- }
-
- function getPreviousNode(path, lookBack = 1) {
- return getSiblingNode(path, -lookBack);
- }
-
- function getNextNode(path) {
- return getSiblingNode(path, 1);
- }
-
- function isPrettierIgnoreNode(node) {
- return isNodeOfSomeType(node, ["MustacheCommentStatement"]) && typeof node.value === "string" && node.value.trim() === "prettier-ignore";
- }
-
- function hasPrettierIgnore(path) {
- const node = path.getValue();
- const previousPreviousNode = getPreviousNode(path, 2);
- return isPrettierIgnoreNode(node) || isPrettierIgnoreNode(previousPreviousNode);
- }
-
- var utils$3 = {
- getNextNode,
- getPreviousNode,
- hasPrettierIgnore,
- isGlimmerComponent,
- isNextNodeOfSomeType,
- isNodeOfSomeType,
- isParentOfSomeType,
- isPreviousNodeOfSomeType,
- isWhitespaceNode
- };
-
- const {
- concat: concat$7,
- join: join$4,
- softline: softline$3,
- hardline: hardline$6,
- line: line$4,
- group: group$6,
- indent: indent$4,
- ifBreak: ifBreak$3
- } = document.builders;
- const {
- getNextNode: getNextNode$1,
- getPreviousNode: getPreviousNode$1,
- hasPrettierIgnore: hasPrettierIgnore$1,
- isGlimmerComponent: isGlimmerComponent$1,
- isNextNodeOfSomeType: isNextNodeOfSomeType$1,
- isParentOfSomeType: isParentOfSomeType$1,
- isPreviousNodeOfSomeType: isPreviousNodeOfSomeType$1,
- isWhitespaceNode: isWhitespaceNode$1
- } = utils$3; // http://w3c.github.io/html/single-page.html#void-elements
-
- 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:
- // https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/syntax/lib/generation/print.ts
-
- function print(path, options, print) {
- const n = path.getValue();
- /* istanbul ignore if*/
-
- if (!n) {
- return "";
- }
-
- if (hasPrettierIgnore$1(path)) {
- const startOffset = locationToOffset(options.originalText, n.loc.start.line - 1, n.loc.start.column);
- const endOffset = locationToOffset(options.originalText, n.loc.end.line - 1, n.loc.end.column);
- const ignoredText = options.originalText.slice(startOffset, endOffset);
- return ignoredText;
- }
-
- switch (n.type) {
- case "Block":
- case "Program":
- case "Template":
- {
- return group$6(concat$7(path.map(print, "body")));
- }
-
- case "ElementNode":
- {
- const hasChildren = n.children.length > 0;
- const hasNonWhitespaceChildren = n.children.some(n => !isWhitespaceNode$1(n));
- const isVoid = isGlimmerComponent$1(n) && (!hasChildren || !hasNonWhitespaceChildren) || voidTags.includes(n.tag);
- const closeTagForNoBreak = isVoid ? concat$7([" />", softline$3]) : ">";
- const closeTagForBreak = isVoid ? "/>" : ">";
-
- 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"))]));
-
- const nextNode = getNextNode$1(path);
- 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 : ""]);
- }
-
- case "BlockStatement":
- {
- const pp = path.getParentNode(1);
- const isElseIf = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === n && pp.inverse.body[0].path.parts[0] === "if";
- const hasElseIf = n.inverse && n.inverse.body.length === 1 && n.inverse.body[0].type === "BlockStatement" && n.inverse.body[0].path.parts[0] === "if";
- const indentElse = hasElseIf ? a => a : indent$4;
- const inverseElseStatement = (n.inverseStrip.open ? "{{~" : "{{") + "else" + (n.inverseStrip.close ? "~}}" : "}}");
-
- if (n.inverse) {
- 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)])]);
- } else if (isElseIf) {
- 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")]))]);
- }
-
- const hasNonWhitespaceChildren = n.program.body.some(n => !isWhitespaceNode$1(n));
- 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)]))]);
- }
-
- case "ElementModifierStatement":
- {
- return group$6(concat$7(["{{", printPathParams(path, print), softline$3, "}}"]));
- }
-
- case "MustacheStatement":
- {
- const isEscaped = n.escaped === false;
- const {
- open: openStrip,
- close: closeStrip
- } = n.strip;
- const opening = (isEscaped ? "{{{" : "{{") + (openStrip ? "~" : "");
- const closing = (closeStrip ? "~" : "") + (isEscaped ? "}}}" : "}}");
- const leading = isParentOfSomeType$1(path, ["AttrNode", "ConcatStatement", "ElementNode"]) ? [opening, indent$4(softline$3)] : [opening];
- return group$6(concat$7([...leading, printPathParams(path, print), softline$3, closing]));
- }
-
- case "SubExpression":
- {
- const params = printParams(path, print);
- const printedParams = params.length > 0 ? indent$4(concat$7([line$4, group$6(join$4(line$4, params))])) : "";
- return group$6(concat$7(["(", printPath(path, print), printedParams, softline$3, ")"]));
- }
-
- case "AttrNode":
- {
- const isText = n.value.type === "TextNode";
- const isEmptyText = isText && n.value.chars === ""; // If the text is empty and the value's loc start and end columns are the
- // same, there is no value for this AttrNode and it should be printed
- // without the `=""`. Example: `<img data-test>` -> `<img data-test>`
-
- const isEmptyValue = isEmptyText && n.value.loc.start.column === n.value.loc.end.column;
-
- if (isEmptyValue) {
- return concat$7([n.name]);
- }
-
- const value = path.call(print, "value");
- const quotedValue = isText ? printStringLiteral(value.parts.join(), options) : value;
- return concat$7([n.name, "=", quotedValue]);
- }
-
- case "ConcatStatement":
- {
- return concat$7(['"', concat$7(path.map(partPath => print(partPath), "parts").filter(a => a !== "")), '"']);
- }
-
- case "Hash":
- {
- return concat$7([join$4(line$4, path.map(print, "pairs"))]);
- }
-
- case "HashPair":
- {
- return concat$7([n.key, "=", path.call(print, "value")]);
- }
-
- case "TextNode":
- {
- const maxLineBreaksToPreserve = 2;
- const isFirstElement = !getPreviousNode$1(path);
- const isLastElement = !getNextNode$1(path);
- const isWhitespaceOnly = !/\S/.test(n.chars);
- const lineBreaksCount = countNewLines(n.chars);
- const hasBlockParent = path.getParentNode(0).type === "Block";
- const hasElementParent = path.getParentNode(0).type === "ElementNode";
- const hasTemplateParent = path.getParentNode(0).type === "Template";
- let leadingLineBreaksCount = countLeadingNewLines(n.chars);
- let trailingLineBreaksCount = countTrailingNewLines(n.chars);
-
- if ((isFirstElement || isLastElement) && isWhitespaceOnly && (hasBlockParent || hasElementParent || hasTemplateParent)) {
- return "";
- }
-
- if (isWhitespaceOnly && lineBreaksCount) {
- leadingLineBreaksCount = Math.min(lineBreaksCount, maxLineBreaksToPreserve);
- trailingLineBreaksCount = 0;
- } else {
- if (isNextNodeOfSomeType$1(path, ["BlockStatement", "ElementNode"])) {
- trailingLineBreaksCount = Math.max(trailingLineBreaksCount, 1);
- }
-
- if (isPreviousNodeOfSomeType$1(path, ["ElementNode"]) || isPreviousNodeOfSomeType$1(path, ["BlockStatement"])) {
- leadingLineBreaksCount = Math.max(leadingLineBreaksCount, 1);
- }
- }
-
- let leadingSpace = "";
- let trailingSpace = ""; // preserve a space inside of an attribute node where whitespace present,
- // when next to mustache statement.
-
- const inAttrNode = path.stack.includes("attributes");
-
- if (inAttrNode) {
- const parentNode = path.getParentNode(0);
- const isConcat = parentNode.type === "ConcatStatement";
-
- if (isConcat) {
- const {
- parts
- } = parentNode;
- const partIndex = parts.indexOf(n);
-
- if (partIndex > 0) {
- const partType = parts[partIndex - 1].type;
- const isMustache = partType === "MustacheStatement";
-
- if (isMustache) {
- leadingSpace = " ";
- }
- }
-
- if (partIndex < parts.length - 1) {
- const partType = parts[partIndex + 1].type;
- const isMustache = partType === "MustacheStatement";
-
- if (isMustache) {
- trailingSpace = " ";
- }
- }
- }
- } else {
- if (trailingLineBreaksCount === 0 && isNextNodeOfSomeType$1(path, ["MustacheStatement"])) {
- trailingSpace = " ";
- }
-
- if (leadingLineBreaksCount === 0 && isPreviousNodeOfSomeType$1(path, ["MustacheStatement"])) {
- leadingSpace = " ";
- }
-
- if (isFirstElement) {
- leadingLineBreaksCount = 0;
- leadingSpace = "";
- }
-
- if (isLastElement) {
- trailingLineBreaksCount = 0;
- trailingSpace = "";
- }
- }
-
- return concat$7([...generateHardlines(leadingLineBreaksCount, maxLineBreaksToPreserve), n.chars.replace(/^[\s ]+/g, leadingSpace).replace(/[\s ]+$/, trailingSpace), ...generateHardlines(trailingLineBreaksCount, maxLineBreaksToPreserve)].filter(Boolean));
- }
-
- case "MustacheCommentStatement":
- {
- const dashes = n.value.includes("}}") ? "--" : "";
- return concat$7(["{{!", dashes, n.value, dashes, "}}"]);
- }
-
- case "PathExpression":
- {
- return n.original;
- }
-
- case "BooleanLiteral":
- {
- return String(n.value);
- }
-
- case "CommentStatement":
- {
- return concat$7(["<!--", n.value, "-->"]);
- }
-
- case "StringLiteral":
- {
- return printStringLiteral(n.value, options);
- }
-
- case "NumberLiteral":
- {
- return String(n.value);
- }
-
- case "UndefinedLiteral":
- {
- return "undefined";
- }
-
- case "NullLiteral":
- {
- return "null";
- }
-
- /* istanbul ignore next */
-
- default:
- throw new Error("unknown glimmer type: " + JSON.stringify(n.type));
- }
- }
-
- function printChildren(path, options, print) {
- return concat$7(path.map((childPath, childIndex) => {
- const childNode = path.getValue();
- const isFirstNode = childIndex === 0;
- const isLastNode = childIndex === path.getParentNode(0).children.length - 1;
- const isLastNodeInMultiNodeList = isLastNode && !isFirstNode;
- const isWhitespace = isWhitespaceNode$1(childNode);
-
- if (isWhitespace && isLastNodeInMultiNodeList) {
- return print(childPath, options, print);
- } else if (isFirstNode) {
- return concat$7([softline$3, print(childPath, options, print)]);
- }
-
- return print(childPath, options, print);
- }, "children"));
- }
- /**
- * Prints a string literal with the correct surrounding quotes based on
- * `options.singleQuote` and the number of escaped quotes contained in
- * the string literal. This function is the glimmer equivalent of `printString`
- * in `common/util`, but has differences because of the way escaped characters
- * are treated in hbs string literals.
- * @param {string} stringLiteral - the string literal value
- * @param {object} options - the prettier options object
- */
-
-
- function printStringLiteral(stringLiteral, options) {
- const double = {
- quote: '"',
- regex: /"/g
- };
- const single = {
- quote: "'",
- regex: /'/g
- };
- const preferred = options.singleQuote ? single : double;
- const alternate = preferred === single ? double : single;
- let shouldUseAlternateQuote = false; // If `stringLiteral` contains at least one of the quote preferred for
- // enclosing the string, we might want to enclose with the alternate quote
- // instead, to minimize the number of escaped quotes.
-
- if (stringLiteral.includes(preferred.quote) || stringLiteral.includes(alternate.quote)) {
- const numPreferredQuotes = (stringLiteral.match(preferred.regex) || []).length;
- const numAlternateQuotes = (stringLiteral.match(alternate.regex) || []).length;
- shouldUseAlternateQuote = numPreferredQuotes > numAlternateQuotes;
- }
-
- const enclosingQuote = shouldUseAlternateQuote ? alternate : preferred;
- const escapedStringLiteral = stringLiteral.replace(enclosingQuote.regex, "\\".concat(enclosingQuote.quote));
- return concat$7([enclosingQuote.quote, escapedStringLiteral, enclosingQuote.quote]);
- }
-
- function printPath(path, print) {
- return path.call(print, "path");
- }
-
- function printParams(path, print) {
- const node = path.getValue();
- let parts = [];
-
- if (node.params.length > 0) {
- parts = parts.concat(path.map(print, "params"));
- }
-
- if (node.hash && node.hash.pairs.length > 0) {
- parts.push(path.call(print, "hash"));
- }
-
- return parts;
- }
-
- function printPathParams(path, print) {
- const printedPath = printPath(path, print);
- const printedParams = printParams(path, print);
- const parts = [printedPath, ...printedParams];
- return indent$4(group$6(join$4(line$4, parts)));
- }
-
- function printBlockParams(path) {
- const block = path.getValue();
-
- if (!block.program || !block.program.blockParams.length) {
- return "";
- }
-
- return concat$7([" as |", block.program.blockParams.join(" "), "|"]);
- }
-
- function printOpenBlock(path, print, {
- open: isOpenStrip = false,
- close: isCloseStrip = false
- } = {}) {
- return group$6(concat$7([isOpenStrip ? "{{~#" : "{{#", printPathParams(path, print), printBlockParams(path), softline$3, isCloseStrip ? "~}}" : "}}"]));
- }
-
- function printCloseBlock(path, print, {
- open: isOpenStrip = false,
- close: isCloseStrip = false
- } = {}) {
- return concat$7([isOpenStrip ? "{{~/" : "{{/", path.call(print, "path"), isCloseStrip ? "~}}" : "}}"]);
- }
-
- function countNewLines(string) {
- /* istanbul ignore next */
- string = typeof string === "string" ? string : "";
- return string.split("\n").length - 1;
- }
-
- function countLeadingNewLines(string) {
- /* istanbul ignore next */
- string = typeof string === "string" ? string : "";
- const newLines = (string.match(/^([^\S\r\n]*[\r\n])+/g) || [])[0] || "";
- return countNewLines(newLines);
- }
-
- function countTrailingNewLines(string) {
- /* istanbul ignore next */
- string = typeof string === "string" ? string : "";
- const newLines = (string.match(/([\r\n][^\S\r\n]*)+$/g) || [])[0] || "";
- return countNewLines(newLines);
- }
-
- function generateHardlines(number = 0, max = 0) {
- return new Array(Math.min(number, max)).fill(hardline$6);
- }
- /* istanbul ignore next
- https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/compiler/lib/location.ts#L5-L29
- */
-
-
- function locationToOffset(source, line, column) {
- let seenLines = 0;
- let seenChars = 0; // eslint-disable-next-line no-constant-condition
-
- while (true) {
- if (seenChars === source.length) {
- return null;
- }
-
- let nextLine = source.indexOf("\n", seenChars);
-
- if (nextLine === -1) {
- nextLine = source.length;
- }
-
- if (seenLines === line) {
- if (seenChars + column > nextLine) {
- return null;
- }
-
- return seenChars + column;
- } else if (nextLine === -1) {
- return null;
- }
-
- seenLines += 1;
- seenChars = nextLine + 1;
- }
- }
-
- var printerGlimmer = {
- print,
- massageAstNode: clean$2
- };
-
- var name$6 = "Handlebars";
- var type$5 = "markup";
- var group$7 = "HTML";
- var aliases = [
- "hbs",
- "htmlbars"
- ];
- var extensions$5 = [
- ".handlebars",
- ".hbs"
- ];
- var tmScope$5 = "text.html.handlebars";
- var aceMode$5 = "handlebars";
- var languageId$5 = 155;
- var Handlebars = {
- name: name$6,
- type: type$5,
- group: group$7,
- aliases: aliases,
- extensions: extensions$5,
- tmScope: tmScope$5,
- aceMode: aceMode$5,
- languageId: languageId$5
- };
-
- var Handlebars$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$6,
- type: type$5,
- group: group$7,
- aliases: aliases,
- extensions: extensions$5,
- tmScope: tmScope$5,
- aceMode: aceMode$5,
- languageId: languageId$5,
- 'default': Handlebars
- });
-
- var require$$0$4 = getCjsExportFromNamespace(Handlebars$1);
-
- const languages$2 = [createLanguage(require$$0$4, () => ({
- since: null,
- // unreleased
- parsers: ["glimmer"],
- vscodeLanguageIds: ["handlebars"]
- }))];
- const printers$2 = {
- glimmer: printerGlimmer
- };
- var languageHandlebars = {
- languages: languages$2,
- printers: printers$2
- };
-
- var clean$3 = function clean(ast, newNode) {
- delete newNode.sourceSpan;
- delete newNode.startSourceSpan;
- delete newNode.endSourceSpan;
- delete newNode.nameSpan;
- delete newNode.valueSpan;
-
- if (ast.type === "text" || ast.type === "comment") {
- return null;
- } // may be formatted by multiparser
-
-
- if (ast.type === "yaml" || ast.type === "toml") {
- return null;
- }
-
- if (ast.type === "attribute") {
- delete newNode.value;
- }
-
- if (ast.type === "docType") {
- delete newNode.value;
- }
- };
-
- var json = {
- "CSS_DISPLAY_TAGS": {
- "area": "none",
- "base": "none",
- "basefont": "none",
- "datalist": "none",
- "head": "none",
- "link": "none",
- "meta": "none",
- "noembed": "none",
- "noframes": "none",
- "param": "none",
- "rp": "none",
- "script": "block",
- "source": "block",
- "style": "none",
- "template": "inline",
- "track": "block",
- "title": "none",
- "html": "block",
- "body": "block",
- "address": "block",
- "blockquote": "block",
- "center": "block",
- "div": "block",
- "figure": "block",
- "figcaption": "block",
- "footer": "block",
- "form": "block",
- "header": "block",
- "hr": "block",
- "legend": "block",
- "listing": "block",
- "main": "block",
- "p": "block",
- "plaintext": "block",
- "pre": "block",
- "xmp": "block",
- "slot": "contents",
- "ruby": "ruby",
- "rt": "ruby-text",
- "article": "block",
- "aside": "block",
- "h1": "block",
- "h2": "block",
- "h3": "block",
- "h4": "block",
- "h5": "block",
- "h6": "block",
- "hgroup": "block",
- "nav": "block",
- "section": "block",
- "dir": "block",
- "dd": "block",
- "dl": "block",
- "dt": "block",
- "ol": "block",
- "ul": "block",
- "li": "list-item",
- "table": "table",
- "caption": "table-caption",
- "colgroup": "table-column-group",
- "col": "table-column",
- "thead": "table-header-group",
- "tbody": "table-row-group",
- "tfoot": "table-footer-group",
- "tr": "table-row",
- "td": "table-cell",
- "th": "table-cell",
- "fieldset": "block",
- "button": "inline-block",
- "video": "inline-block",
- "audio": "inline-block"
- },
- "CSS_DISPLAY_DEFAULT": "inline",
- "CSS_WHITE_SPACE_TAGS": {
- "listing": "pre",
- "plaintext": "pre",
- "pre": "pre",
- "xmp": "pre",
- "nobr": "nowrap",
- "table": "initial",
- "textarea": "pre-wrap"
- },
- "CSS_WHITE_SPACE_DEFAULT": "normal"
- };
-
- var index = [
- "a",
- "abbr",
- "acronym",
- "address",
- "applet",
- "area",
- "article",
- "aside",
- "audio",
- "b",
- "base",
- "basefont",
- "bdi",
- "bdo",
- "bgsound",
- "big",
- "blink",
- "blockquote",
- "body",
- "br",
- "button",
- "canvas",
- "caption",
- "center",
- "cite",
- "code",
- "col",
- "colgroup",
- "command",
- "content",
- "data",
- "datalist",
- "dd",
- "del",
- "details",
- "dfn",
- "dialog",
- "dir",
- "div",
- "dl",
- "dt",
- "element",
- "em",
- "embed",
- "fieldset",
- "figcaption",
- "figure",
- "font",
- "footer",
- "form",
- "frame",
- "frameset",
- "h1",
- "h2",
- "h3",
- "h4",
- "h5",
- "h6",
- "head",
- "header",
- "hgroup",
- "hr",
- "html",
- "i",
- "iframe",
- "image",
- "img",
- "input",
- "ins",
- "isindex",
- "kbd",
- "keygen",
- "label",
- "legend",
- "li",
- "link",
- "listing",
- "main",
- "map",
- "mark",
- "marquee",
- "math",
- "menu",
- "menuitem",
- "meta",
- "meter",
- "multicol",
- "nav",
- "nextid",
- "nobr",
- "noembed",
- "noframes",
- "noscript",
- "object",
- "ol",
- "optgroup",
- "option",
- "output",
- "p",
- "param",
- "picture",
- "plaintext",
- "pre",
- "progress",
- "q",
- "rb",
- "rbc",
- "rp",
- "rt",
- "rtc",
- "ruby",
- "s",
- "samp",
- "script",
- "section",
- "select",
- "shadow",
- "slot",
- "small",
- "source",
- "spacer",
- "span",
- "strike",
- "strong",
- "style",
- "sub",
- "summary",
- "sup",
- "svg",
- "table",
- "tbody",
- "td",
- "template",
- "textarea",
- "tfoot",
- "th",
- "thead",
- "time",
- "title",
- "tr",
- "track",
- "tt",
- "u",
- "ul",
- "var",
- "video",
- "wbr",
- "xmp"
- ];
-
- var htmlTagNames = /*#__PURE__*/Object.freeze({
- __proto__: null,
- 'default': index
- });
-
- var a = [
- "accesskey",
- "charset",
- "coords",
- "download",
- "href",
- "hreflang",
- "name",
- "ping",
- "referrerpolicy",
- "rel",
- "rev",
- "shape",
- "tabindex",
- "target",
- "type"
- ];
- var abbr = [
- "title"
- ];
- var applet = [
- "align",
- "alt",
- "archive",
- "code",
- "codebase",
- "height",
- "hspace",
- "name",
- "object",
- "vspace",
- "width"
- ];
- var area = [
- "accesskey",
- "alt",
- "coords",
- "download",
- "href",
- "hreflang",
- "nohref",
- "ping",
- "referrerpolicy",
- "rel",
- "shape",
- "tabindex",
- "target",
- "type"
- ];
- var audio = [
- "autoplay",
- "controls",
- "crossorigin",
- "loop",
- "muted",
- "preload",
- "src"
- ];
- var base = [
- "href",
- "target"
- ];
- var basefont = [
- "color",
- "face",
- "size"
- ];
- var bdo = [
- "dir"
- ];
- var blockquote = [
- "cite"
- ];
- var body = [
- "alink",
- "background",
- "bgcolor",
- "link",
- "text",
- "vlink"
- ];
- var br = [
- "clear"
- ];
- var button = [
- "accesskey",
- "autofocus",
- "disabled",
- "form",
- "formaction",
- "formenctype",
- "formmethod",
- "formnovalidate",
- "formtarget",
- "name",
- "tabindex",
- "type",
- "value"
- ];
- var canvas = [
- "height",
- "width"
- ];
- var caption = [
- "align"
- ];
- var col = [
- "align",
- "char",
- "charoff",
- "span",
- "valign",
- "width"
- ];
- var colgroup = [
- "align",
- "char",
- "charoff",
- "span",
- "valign",
- "width"
- ];
- var data = [
- "value"
- ];
- var del = [
- "cite",
- "datetime"
- ];
- var details = [
- "open"
- ];
- var dfn = [
- "title"
- ];
- var dialog = [
- "open"
- ];
- var dir = [
- "compact"
- ];
- var div = [
- "align"
- ];
- var dl = [
- "compact"
- ];
- var embed$1 = [
- "height",
- "src",
- "type",
- "width"
- ];
- var fieldset = [
- "disabled",
- "form",
- "name"
- ];
- var font = [
- "color",
- "face",
- "size"
- ];
- var form = [
- "accept",
- "accept-charset",
- "action",
- "autocomplete",
- "enctype",
- "method",
- "name",
- "novalidate",
- "target"
- ];
- var frame = [
- "frameborder",
- "longdesc",
- "marginheight",
- "marginwidth",
- "name",
- "noresize",
- "scrolling",
- "src"
- ];
- var frameset = [
- "cols",
- "rows"
- ];
- var h1 = [
- "align"
- ];
- var h2 = [
- "align"
- ];
- var h3 = [
- "align"
- ];
- var h4 = [
- "align"
- ];
- var h5 = [
- "align"
- ];
- var h6 = [
- "align"
- ];
- var head = [
- "profile"
- ];
- var hr = [
- "align",
- "noshade",
- "size",
- "width"
- ];
- var html = [
- "manifest",
- "version"
- ];
- var iframe = [
- "align",
- "allow",
- "allowfullscreen",
- "allowpaymentrequest",
- "allowusermedia",
- "frameborder",
- "height",
- "longdesc",
- "marginheight",
- "marginwidth",
- "name",
- "referrerpolicy",
- "sandbox",
- "scrolling",
- "src",
- "srcdoc",
- "width"
- ];
- var img = [
- "align",
- "alt",
- "border",
- "crossorigin",
- "decoding",
- "height",
- "hspace",
- "ismap",
- "longdesc",
- "name",
- "referrerpolicy",
- "sizes",
- "src",
- "srcset",
- "usemap",
- "vspace",
- "width"
- ];
- var input = [
- "accept",
- "accesskey",
- "align",
- "alt",
- "autocomplete",
- "autofocus",
- "checked",
- "dirname",
- "disabled",
- "form",
- "formaction",
- "formenctype",
- "formmethod",
- "formnovalidate",
- "formtarget",
- "height",
- "ismap",
- "list",
- "max",
- "maxlength",
- "min",
- "minlength",
- "multiple",
- "name",
- "pattern",
- "placeholder",
- "readonly",
- "required",
- "size",
- "src",
- "step",
- "tabindex",
- "title",
- "type",
- "usemap",
- "value",
- "width"
- ];
- var ins = [
- "cite",
- "datetime"
- ];
- var isindex = [
- "prompt"
- ];
- var label = [
- "accesskey",
- "for",
- "form"
- ];
- var legend = [
- "accesskey",
- "align"
- ];
- var li = [
- "type",
- "value"
- ];
- var link$3 = [
- "as",
- "charset",
- "color",
- "crossorigin",
- "href",
- "hreflang",
- "imagesizes",
- "imagesrcset",
- "integrity",
- "media",
- "nonce",
- "referrerpolicy",
- "rel",
- "rev",
- "sizes",
- "target",
- "title",
- "type"
- ];
- var map = [
- "name"
- ];
- var menu = [
- "compact"
- ];
- var meta = [
- "charset",
- "content",
- "http-equiv",
- "name",
- "scheme"
- ];
- var meter = [
- "high",
- "low",
- "max",
- "min",
- "optimum",
- "value"
- ];
- var object = [
- "align",
- "archive",
- "border",
- "classid",
- "codebase",
- "codetype",
- "data",
- "declare",
- "form",
- "height",
- "hspace",
- "name",
- "standby",
- "tabindex",
- "type",
- "typemustmatch",
- "usemap",
- "vspace",
- "width"
- ];
- var ol = [
- "compact",
- "reversed",
- "start",
- "type"
- ];
- var optgroup = [
- "disabled",
- "label"
- ];
- var option = [
- "disabled",
- "label",
- "selected",
- "value"
- ];
- var output = [
- "for",
- "form",
- "name"
- ];
- var p = [
- "align"
- ];
- var param = [
- "name",
- "type",
- "value",
- "valuetype"
- ];
- var pre = [
- "width"
- ];
- var progress = [
- "max",
- "value"
- ];
- var q = [
- "cite"
- ];
- var script = [
- "async",
- "charset",
- "crossorigin",
- "defer",
- "integrity",
- "language",
- "nomodule",
- "nonce",
- "referrerpolicy",
- "src",
- "type"
- ];
- var select = [
- "autocomplete",
- "autofocus",
- "disabled",
- "form",
- "multiple",
- "name",
- "required",
- "size",
- "tabindex"
- ];
- var slot = [
- "name"
- ];
- var source$1 = [
- "media",
- "sizes",
- "src",
- "srcset",
- "type"
- ];
- var style = [
- "media",
- "nonce",
- "title",
- "type"
- ];
- var table = [
- "align",
- "bgcolor",
- "border",
- "cellpadding",
- "cellspacing",
- "frame",
- "rules",
- "summary",
- "width"
- ];
- var tbody = [
- "align",
- "char",
- "charoff",
- "valign"
- ];
- var td = [
- "abbr",
- "align",
- "axis",
- "bgcolor",
- "char",
- "charoff",
- "colspan",
- "headers",
- "height",
- "nowrap",
- "rowspan",
- "scope",
- "valign",
- "width"
- ];
- var textarea = [
- "accesskey",
- "autocomplete",
- "autofocus",
- "cols",
- "dirname",
- "disabled",
- "form",
- "maxlength",
- "minlength",
- "name",
- "placeholder",
- "readonly",
- "required",
- "rows",
- "tabindex",
- "wrap"
- ];
- var tfoot = [
- "align",
- "char",
- "charoff",
- "valign"
- ];
- var th = [
- "abbr",
- "align",
- "axis",
- "bgcolor",
- "char",
- "charoff",
- "colspan",
- "headers",
- "height",
- "nowrap",
- "rowspan",
- "scope",
- "valign",
- "width"
- ];
- var thead = [
- "align",
- "char",
- "charoff",
- "valign"
- ];
- var time = [
- "datetime"
- ];
- var tr = [
- "align",
- "bgcolor",
- "char",
- "charoff",
- "valign"
- ];
- var track = [
- "default",
- "kind",
- "label",
- "src",
- "srclang"
- ];
- var ul = [
- "compact",
- "type"
- ];
- var video = [
- "autoplay",
- "controls",
- "crossorigin",
- "height",
- "loop",
- "muted",
- "playsinline",
- "poster",
- "preload",
- "src",
- "width"
- ];
- var index$1 = {
- "*": [
- "accesskey",
- "autocapitalize",
- "autofocus",
- "class",
- "contenteditable",
- "dir",
- "draggable",
- "enterkeyhint",
- "hidden",
- "id",
- "inputmode",
- "is",
- "itemid",
- "itemprop",
- "itemref",
- "itemscope",
- "itemtype",
- "lang",
- "nonce",
- "slot",
- "spellcheck",
- "style",
- "tabindex",
- "title",
- "translate"
- ],
- a: a,
- abbr: abbr,
- applet: applet,
- area: area,
- audio: audio,
- base: base,
- basefont: basefont,
- bdo: bdo,
- blockquote: blockquote,
- body: body,
- br: br,
- button: button,
- canvas: canvas,
- caption: caption,
- col: col,
- colgroup: colgroup,
- data: data,
- del: del,
- details: details,
- dfn: dfn,
- dialog: dialog,
- dir: dir,
- div: div,
- dl: dl,
- embed: embed$1,
- fieldset: fieldset,
- font: font,
- form: form,
- frame: frame,
- frameset: frameset,
- h1: h1,
- h2: h2,
- h3: h3,
- h4: h4,
- h5: h5,
- h6: h6,
- head: head,
- hr: hr,
- html: html,
- iframe: iframe,
- img: img,
- input: input,
- ins: ins,
- isindex: isindex,
- label: label,
- legend: legend,
- li: li,
- link: link$3,
- map: map,
- menu: menu,
- meta: meta,
- meter: meter,
- object: object,
- ol: ol,
- optgroup: optgroup,
- option: option,
- output: output,
- p: p,
- param: param,
- pre: pre,
- progress: progress,
- q: q,
- script: script,
- select: select,
- slot: slot,
- source: source$1,
- style: style,
- table: table,
- tbody: tbody,
- td: td,
- textarea: textarea,
- tfoot: tfoot,
- th: th,
- thead: thead,
- time: time,
- tr: tr,
- track: track,
- ul: ul,
- video: video
- };
-
- var htmlElementAttributes = /*#__PURE__*/Object.freeze({
- __proto__: null,
- a: a,
- abbr: abbr,
- applet: applet,
- area: area,
- audio: audio,
- base: base,
- basefont: basefont,
- bdo: bdo,
- blockquote: blockquote,
- body: body,
- br: br,
- button: button,
- canvas: canvas,
- caption: caption,
- col: col,
- colgroup: colgroup,
- data: data,
- del: del,
- details: details,
- dfn: dfn,
- dialog: dialog,
- dir: dir,
- div: div,
- dl: dl,
- embed: embed$1,
- fieldset: fieldset,
- font: font,
- form: form,
- frame: frame,
- frameset: frameset,
- h1: h1,
- h2: h2,
- h3: h3,
- h4: h4,
- h5: h5,
- h6: h6,
- head: head,
- hr: hr,
- html: html,
- iframe: iframe,
- img: img,
- input: input,
- ins: ins,
- isindex: isindex,
- label: label,
- legend: legend,
- li: li,
- link: link$3,
- map: map,
- menu: menu,
- meta: meta,
- meter: meter,
- object: object,
- ol: ol,
- optgroup: optgroup,
- option: option,
- output: output,
- p: p,
- param: param,
- pre: pre,
- progress: progress,
- q: q,
- script: script,
- select: select,
- slot: slot,
- source: source$1,
- style: style,
- table: table,
- tbody: tbody,
- td: td,
- textarea: textarea,
- tfoot: tfoot,
- th: th,
- thead: thead,
- time: time,
- tr: tr,
- track: track,
- ul: ul,
- video: video,
- 'default': index$1
- });
-
- var htmlTagNames$1 = getCjsExportFromNamespace(htmlTagNames);
-
- var htmlElementAttributes$1 = getCjsExportFromNamespace(htmlElementAttributes);
-
- const {
- CSS_DISPLAY_TAGS,
- CSS_DISPLAY_DEFAULT,
- CSS_WHITE_SPACE_TAGS,
- CSS_WHITE_SPACE_DEFAULT
- } = json;
- const HTML_TAGS = arrayToMap(htmlTagNames$1);
- const HTML_ELEMENT_ATTRIBUTES = mapObject(htmlElementAttributes$1, arrayToMap);
-
- function arrayToMap(array) {
- const map = Object.create(null);
-
- for (const value of array) {
- map[value] = true;
- }
-
- return map;
- }
-
- function mapObject(object, fn) {
- const newObject = Object.create(null);
-
- for (const key of Object.keys(object)) {
- newObject[key] = fn(object[key], key);
- }
-
- return newObject;
- }
-
- function shouldPreserveContent(node, options) {
- if (!node.endSourceSpan) {
- return false;
- }
-
- if (node.type === "element" && node.fullName === "template" && node.attrMap.lang && node.attrMap.lang !== "html") {
- return true;
- } // unterminated node in ie conditional comment
- // e.g. <!--[if lt IE 9]><html><![endif]-->
-
-
- if (node.type === "ieConditionalComment" && node.lastChild && !node.lastChild.isSelfClosing && !node.lastChild.endSourceSpan) {
- return true;
- } // incomplete html in ie conditional comment
- // e.g. <!--[if lt IE 9]></div><![endif]-->
-
-
- if (node.type === "ieConditionalComment" && !node.complete) {
- return true;
- } // top-level elements (excluding <template>, <style> and <script>) in Vue SFC are considered custom block
- // custom blocks can be written in other languages so we should preserve them to not break the code
-
-
- 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>
- "html"].includes(node.fullName)) {
- return true;
- } // TODO: handle non-text children in <pre>
-
-
- if (isPreLikeNode(node) && node.children.some(child => child.type !== "text" && child.type !== "interpolation")) {
- return true;
- }
-
- return false;
- }
-
- function hasPrettierIgnore$2(node) {
- if (node.type === "attribute") {
- return false;
- }
-
- if (!node.parent) {
- return false;
- }
-
- if (typeof node.index !== "number" || node.index === 0) {
- return false;
- }
-
- const prevNode = node.parent.children[node.index - 1];
- return isPrettierIgnore(prevNode);
- }
-
- function isPrettierIgnore(node) {
- return node.type === "comment" && node.value.trim() === "prettier-ignore";
- }
-
- function getPrettierIgnoreAttributeCommentData(value) {
- const match = value.trim().match(/^prettier-ignore-attribute(?:\s+([^]+))?$/);
-
- if (!match) {
- return false;
- }
-
- if (!match[1]) {
- return true;
- }
-
- return match[1].split(/\s+/);
- }
- /** there's no opening/closing tag or it's considered not breakable */
-
-
- function isTextLikeNode(node) {
- return node.type === "text" || node.type === "comment";
- }
-
- function isScriptLikeTag(node) {
- return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style" || isUnknownNamespace(node) && (node.name === "script" || node.name === "style"));
- }
-
- function isFrontMatterNode(node) {
- return node.type === "yaml" || node.type === "toml";
- }
-
- function canHaveInterpolation(node) {
- return node.children && !isScriptLikeTag(node);
- }
-
- function isWhitespaceSensitiveNode(node) {
- return isScriptLikeTag(node) || node.type === "interpolation" || isIndentationSensitiveNode(node);
- }
-
- function isIndentationSensitiveNode(node) {
- return getNodeCssStyleWhiteSpace(node).startsWith("pre");
- }
-
- function isLeadingSpaceSensitiveNode(node) {
- const isLeadingSpaceSensitive = _isLeadingSpaceSensitiveNode();
-
- if (isLeadingSpaceSensitive && !node.prev && node.parent && node.parent.tagDefinition && node.parent.tagDefinition.ignoreFirstLf) {
- return node.type === "interpolation";
- }
-
- return isLeadingSpaceSensitive;
-
- function _isLeadingSpaceSensitiveNode() {
- if (isFrontMatterNode(node)) {
- return false;
- }
-
- if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) {
- return true;
- }
-
- if (!node.parent || node.parent.cssDisplay === "none") {
- return false;
- }
-
- if (isPreLikeNode(node.parent)) {
- return true;
- }
-
- if (!node.prev && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || !isFirstChildLeadingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
- return false;
- }
-
- if (node.prev && !isNextLeadingSpaceSensitiveCssDisplay(node.prev.cssDisplay)) {
- return false;
- }
-
- return true;
- }
- }
-
- function isTrailingSpaceSensitiveNode(node) {
- if (isFrontMatterNode(node)) {
- return false;
- }
-
- if ((node.type === "text" || node.type === "interpolation") && node.next && (node.next.type === "text" || node.next.type === "interpolation")) {
- return true;
- }
-
- if (!node.parent || node.parent.cssDisplay === "none") {
- return false;
- }
-
- if (isPreLikeNode(node.parent)) {
- return true;
- }
-
- if (!node.next && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || !isLastChildTrailingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
- return false;
- }
-
- if (node.next && !isPrevTrailingSpaceSensitiveCssDisplay(node.next.cssDisplay)) {
- return false;
- }
-
- return true;
- }
-
- function isDanglingSpaceSensitiveNode(node) {
- return isDanglingSpaceSensitiveCssDisplay(node.cssDisplay) && !isScriptLikeTag(node);
- }
-
- function forceNextEmptyLine(node) {
- return isFrontMatterNode(node) || node.next && node.sourceSpan.end.line + 1 < node.next.sourceSpan.start.line;
- }
- /** firstChild leadingSpaces and lastChild trailingSpaces */
-
-
- function forceBreakContent(node) {
- 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));
- }
- /** spaces between children */
-
-
- function forceBreakChildren(node) {
- return node.type === "element" && node.children.length !== 0 && (["html", "head", "ul", "ol", "select"].includes(node.name) || node.cssDisplay.startsWith("table") && node.cssDisplay !== "table-cell");
- }
-
- function preferHardlineAsLeadingSpaces(node) {
- return preferHardlineAsSurroundingSpaces(node) || node.prev && preferHardlineAsTrailingSpaces(node.prev) || hasSurroundingLineBreak(node);
- }
-
- function preferHardlineAsTrailingSpaces(node) {
- return preferHardlineAsSurroundingSpaces(node) || node.type === "element" && node.fullName === "br" || hasSurroundingLineBreak(node);
- }
-
- function hasSurroundingLineBreak(node) {
- return hasLeadingLineBreak(node) && hasTrailingLineBreak(node);
- }
-
- function hasLeadingLineBreak(node) {
- 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);
- }
-
- function hasTrailingLineBreak(node) {
- 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);
- }
-
- function preferHardlineAsSurroundingSpaces(node) {
- switch (node.type) {
- case "ieConditionalComment":
- case "comment":
- case "directive":
- return true;
-
- case "element":
- return ["script", "select"].includes(node.name);
- }
-
- return false;
- }
-
- function getLastDescendant(node) {
- return node.lastChild ? getLastDescendant(node.lastChild) : node;
- }
-
- function hasNonTextChild(node) {
- return node.children && node.children.some(child => child.type !== "text");
- }
-
- function inferScriptParser(node) {
- if (node.name === "script" && !node.attrMap.src) {
- 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") {
- return "babel";
- }
-
- if (node.attrMap.type === "application/x-typescript" || node.attrMap.lang === "ts" || node.attrMap.lang === "tsx") {
- return "typescript";
- }
-
- if (node.attrMap.type === "text/markdown") {
- return "markdown";
- }
-
- if (node.attrMap.type.endsWith("json") || node.attrMap.type.endsWith("importmap")) {
- return "json";
- }
-
- if (node.attrMap.type === "text/x-handlebars-template") {
- return "glimmer";
- }
- }
-
- if (node.name === "style") {
- if (!node.attrMap.lang || node.attrMap.lang === "postcss" || node.attrMap.lang === "css") {
- return "css";
- }
-
- if (node.attrMap.lang === "scss") {
- return "scss";
- }
-
- if (node.attrMap.lang === "less") {
- return "less";
- }
- }
-
- return null;
- }
-
- function isBlockLikeCssDisplay(cssDisplay) {
- return cssDisplay === "block" || cssDisplay === "list-item" || cssDisplay.startsWith("table");
- }
-
- function isFirstChildLeadingSpaceSensitiveCssDisplay(cssDisplay) {
- return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
- }
-
- function isLastChildTrailingSpaceSensitiveCssDisplay(cssDisplay) {
- return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
- }
-
- function isPrevTrailingSpaceSensitiveCssDisplay(cssDisplay) {
- return !isBlockLikeCssDisplay(cssDisplay);
- }
-
- function isNextLeadingSpaceSensitiveCssDisplay(cssDisplay) {
- return !isBlockLikeCssDisplay(cssDisplay);
- }
-
- function isDanglingSpaceSensitiveCssDisplay(cssDisplay) {
- return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
- }
-
- function isPreLikeNode(node) {
- return getNodeCssStyleWhiteSpace(node).startsWith("pre");
- }
-
- function countParents(path, predicate = () => true) {
- let counter = 0;
-
- for (let i = path.stack.length - 1; i >= 0; i--) {
- const value = path.stack[i];
-
- if (value && typeof value === "object" && !Array.isArray(value) && predicate(value)) {
- counter++;
- }
- }
-
- return counter;
- }
-
- function hasParent(node, fn) {
- let current = node;
-
- while (current) {
- if (fn(current)) {
- return true;
- }
-
- current = current.parent;
- }
-
- return false;
- }
-
- function getNodeCssStyleDisplay(node, options) {
- if (node.prev && node.prev.type === "comment") {
- // <!-- display: block -->
- const match = node.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/);
-
- if (match) {
- return match[1];
- }
- }
-
- let isInSvgForeignObject = false;
-
- if (node.type === "element" && node.namespace === "svg") {
- if (hasParent(node, parent => parent.fullName === "svg:foreignObject")) {
- isInSvgForeignObject = true;
- } else {
- return node.name === "svg" ? "inline-block" : "block";
- }
- }
-
- switch (options.htmlWhitespaceSensitivity) {
- case "strict":
- return "inline";
-
- case "ignore":
- return "block";
-
- default:
- return node.type === "element" && (!node.namespace || isInSvgForeignObject || isUnknownNamespace(node)) && CSS_DISPLAY_TAGS[node.name] || CSS_DISPLAY_DEFAULT;
- }
- }
-
- function isUnknownNamespace(node) {
- return node.type === "element" && !node.hasExplicitNamespace && !["html", "svg"].includes(node.namespace);
- }
-
- function getNodeCssStyleWhiteSpace(node) {
- return node.type === "element" && (!node.namespace || isUnknownNamespace(node)) && CSS_WHITE_SPACE_TAGS[node.name] || CSS_WHITE_SPACE_DEFAULT;
- }
-
- function getMinIndentation(text) {
- let minIndentation = Infinity;
-
- for (const lineText of text.split("\n")) {
- if (lineText.length === 0) {
- continue;
- }
-
- if (/\S/.test(lineText[0])) {
- return 0;
- }
-
- const indentation = lineText.match(/^\s*/)[0].length;
-
- if (lineText.length === indentation) {
- continue;
- }
-
- if (indentation < minIndentation) {
- minIndentation = indentation;
- }
- }
-
- return minIndentation === Infinity ? 0 : minIndentation;
- }
-
- function dedentString(text, minIndent = getMinIndentation(text)) {
- return minIndent === 0 ? text : text.split("\n").map(lineText => lineText.slice(minIndent)).join("\n");
- }
-
- function normalizeParts(parts) {
- const newParts = [];
- const restParts = parts.slice();
-
- while (restParts.length !== 0) {
- const part = restParts.shift();
-
- if (!part) {
- continue;
- }
-
- if (part.type === "concat") {
- restParts.unshift(...part.parts);
- continue;
- }
-
- if (newParts.length !== 0 && typeof newParts[newParts.length - 1] === "string" && typeof part === "string") {
- newParts.push(newParts.pop() + part);
- continue;
- }
-
- newParts.push(part);
- }
-
- return newParts;
- }
-
- function identity(x) {
- return x;
- }
-
- function shouldNotPrintClosingTag(node, options) {
- return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore$2(node) || shouldPreserveContent(node.parent, options));
- }
-
- function countChars(text, char) {
- let counter = 0;
-
- for (let i = 0; i < text.length; i++) {
- if (text[i] === char) {
- counter++;
- }
- }
-
- return counter;
- }
-
- function unescapeQuoteEntities(text) {
- return text.replace(/'/g, "'").replace(/"/g, '"');
- }
-
- var utils$4 = {
- HTML_ELEMENT_ATTRIBUTES,
- HTML_TAGS,
- canHaveInterpolation,
- countChars,
- countParents,
- dedentString,
- forceBreakChildren,
- forceBreakContent,
- forceNextEmptyLine,
- getLastDescendant,
- getNodeCssStyleDisplay,
- getNodeCssStyleWhiteSpace,
- getPrettierIgnoreAttributeCommentData,
- hasPrettierIgnore: hasPrettierIgnore$2,
- identity,
- inferScriptParser,
- isDanglingSpaceSensitiveNode,
- isFrontMatterNode,
- isIndentationSensitiveNode,
- isLeadingSpaceSensitiveNode,
- isPreLikeNode,
- isScriptLikeTag,
- isTextLikeNode,
- isTrailingSpaceSensitiveNode,
- isWhitespaceSensitiveNode,
- isUnknownNamespace,
- normalizeParts,
- preferHardlineAsLeadingSpaces,
- preferHardlineAsTrailingSpaces,
- shouldNotPrintClosingTag,
- shouldPreserveContent,
- unescapeQuoteEntities
- };
-
- const {
- canHaveInterpolation: canHaveInterpolation$1,
- getNodeCssStyleDisplay: getNodeCssStyleDisplay$1,
- isDanglingSpaceSensitiveNode: isDanglingSpaceSensitiveNode$1,
- isIndentationSensitiveNode: isIndentationSensitiveNode$1,
- isLeadingSpaceSensitiveNode: isLeadingSpaceSensitiveNode$1,
- isTrailingSpaceSensitiveNode: isTrailingSpaceSensitiveNode$1,
- isWhitespaceSensitiveNode: isWhitespaceSensitiveNode$1
- } = utils$4;
- const PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeIeConditonalStartEndCommentIntoElementOpeningTag, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addHasHtmComponentClosingTag, addIsSpaceSensitive, mergeSimpleElementIntoText];
-
- function preprocess(ast, options) {
- for (const fn of PREPROCESS_PIPELINE) {
- ast = fn(ast, options);
- }
-
- return ast;
- }
-
- function removeIgnorableFirstLf(ast
- /*, options */
- ) {
- return ast.map(node => {
- if (node.type === "element" && node.tagDefinition.ignoreFirstLf && node.children.length !== 0 && node.children[0].type === "text" && node.children[0].value[0] === "\n") {
- const [text, ...rest] = node.children;
- return node.clone({
- children: text.value.length === 1 ? rest : [text.clone({
- value: text.value.slice(1)
- }), ...rest]
- });
- }
-
- return node;
- });
- }
-
- function mergeIeConditonalStartEndCommentIntoElementOpeningTag(ast
- /*, options */
- ) {
- /**
- * <!--[if ...]><!--><target><!--<![endif]-->
- */
- 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;
-
- return ast.map(node => {
- if (node.children) {
- const isTargetResults = node.children.map(isTarget);
-
- if (isTargetResults.some(Boolean)) {
- const newChildren = [];
-
- for (let i = 0; i < node.children.length; i++) {
- const child = node.children[i];
-
- if (isTargetResults[i + 1]) {
- // ieConditionalStartComment
- continue;
- }
-
- if (isTargetResults[i]) {
- const ieConditionalStartComment = child.prev;
- const ieConditionalEndComment = child.firstChild;
- const ParseSourceSpan = child.sourceSpan.constructor;
- const startSourceSpan = new ParseSourceSpan(ieConditionalStartComment.sourceSpan.start, ieConditionalEndComment.sourceSpan.end);
- const sourceSpan = new ParseSourceSpan(startSourceSpan.start, child.sourceSpan.end);
- newChildren.push(child.clone({
- condition: ieConditionalStartComment.condition,
- sourceSpan,
- startSourceSpan,
- children: child.children.slice(1)
- }));
- continue;
- }
-
- newChildren.push(child);
- }
-
- return node.clone({
- children: newChildren
- });
- }
- }
-
- return node;
- });
- }
-
- function mergeNodeIntoText(ast, shouldMerge, getValue) {
- return ast.map(node => {
- if (node.children) {
- const shouldMergeResults = node.children.map(shouldMerge);
-
- if (shouldMergeResults.some(Boolean)) {
- const newChildren = [];
-
- for (let i = 0; i < node.children.length; i++) {
- const child = node.children[i];
-
- if (child.type !== "text" && !shouldMergeResults[i]) {
- newChildren.push(child);
- continue;
- }
-
- const newChild = child.type === "text" ? child : child.clone({
- type: "text",
- value: getValue(child)
- });
-
- if (newChildren.length === 0 || newChildren[newChildren.length - 1].type !== "text") {
- newChildren.push(newChild);
- continue;
- }
-
- const lastChild = newChildren.pop();
- const ParseSourceSpan = lastChild.sourceSpan.constructor;
- newChildren.push(lastChild.clone({
- value: lastChild.value + newChild.value,
- sourceSpan: new ParseSourceSpan(lastChild.sourceSpan.start, newChild.sourceSpan.end)
- }));
- }
-
- return node.clone({
- children: newChildren
- });
- }
- }
-
- return node;
- });
- }
-
- function mergeCdataIntoText(ast
- /*, options */
- ) {
- return mergeNodeIntoText(ast, node => node.type === "cdata", node => "<![CDATA[".concat(node.value, "]]>"));
- }
-
- function mergeSimpleElementIntoText(ast
- /*, options */
- ) {
- const isSimpleElement = node => node.type === "element" && node.attrs.length === 0 && node.children.length === 1 && node.firstChild.type === "text" && // \xA0: non-breaking whitespace
- !/[^\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";
-
- return ast.map(node => {
- if (node.children) {
- const isSimpleElementResults = node.children.map(isSimpleElement);
-
- if (isSimpleElementResults.some(Boolean)) {
- const newChildren = [];
-
- for (let i = 0; i < node.children.length; i++) {
- const child = node.children[i];
-
- if (isSimpleElementResults[i]) {
- const lastChild = newChildren.pop();
- const nextChild = node.children[++i];
- const ParseSourceSpan = node.sourceSpan.constructor;
- const {
- isTrailingSpaceSensitive,
- hasTrailingSpaces
- } = nextChild;
- newChildren.push(lastChild.clone({
- value: lastChild.value + "<".concat(child.rawName, ">") + child.firstChild.value + "</".concat(child.rawName, ">") + nextChild.value,
- sourceSpan: new ParseSourceSpan(lastChild.sourceSpan.start, nextChild.sourceSpan.end),
- isTrailingSpaceSensitive,
- hasTrailingSpaces
- }));
- } else {
- newChildren.push(child);
- }
- }
-
- return node.clone({
- children: newChildren
- });
- }
- }
-
- return node;
- });
- }
-
- function extractInterpolation(ast, options) {
- if (options.parser === "html") {
- return ast;
- }
-
- const interpolationRegex = /\{\{([\s\S]+?)\}\}/g;
- return ast.map(node => {
- if (!canHaveInterpolation$1(node)) {
- return node;
- }
-
- const newChildren = [];
-
- for (const child of node.children) {
- if (child.type !== "text") {
- newChildren.push(child);
- continue;
- }
-
- const ParseSourceSpan = child.sourceSpan.constructor;
- let startSourceSpan = child.sourceSpan.start;
- let endSourceSpan = null;
- const components = child.value.split(interpolationRegex);
-
- for (let i = 0; i < components.length; i++, startSourceSpan = endSourceSpan) {
- const value = components[i];
-
- if (i % 2 === 0) {
- endSourceSpan = startSourceSpan.moveBy(value.length);
-
- if (value.length !== 0) {
- newChildren.push({
- type: "text",
- value,
- sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan)
- });
- }
-
- continue;
- }
-
- endSourceSpan = startSourceSpan.moveBy(value.length + 4); // `{{` + `}}`
-
- newChildren.push({
- type: "interpolation",
- sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan),
- children: value.length === 0 ? [] : [{
- type: "text",
- value,
- sourceSpan: new ParseSourceSpan(startSourceSpan.moveBy(2), endSourceSpan.moveBy(-2))
- }]
- });
- }
- }
-
- return node.clone({
- children: newChildren
- });
- });
- }
- /**
- * - add `hasLeadingSpaces` field
- * - add `hasTrailingSpaces` field
- * - add `hasDanglingSpaces` field for parent nodes
- * - add `isWhitespaceSensitive`, `isIndentationSensitive` field for text nodes
- * - remove insensitive whitespaces
- */
-
-
- function extractWhitespaces(ast
- /*, options*/
- ) {
- const TYPE_WHITESPACE = "whitespace";
- return ast.map(node => {
- if (!node.children) {
- return node;
- }
-
- if (node.children.length === 0 || node.children.length === 1 && node.children[0].type === "text" && node.children[0].value.trim().length === 0) {
- return node.clone({
- children: [],
- hasDanglingSpaces: node.children.length !== 0
- });
- }
-
- const isWhitespaceSensitive = isWhitespaceSensitiveNode$1(node);
- const isIndentationSensitive = isIndentationSensitiveNode$1(node);
- return node.clone({
- isWhitespaceSensitive,
- isIndentationSensitive,
- children: node.children // extract whitespace nodes
- .reduce((newChildren, child) => {
- if (child.type !== "text" || isWhitespaceSensitive) {
- return newChildren.concat(child);
- }
-
- const localChildren = [];
- const [, leadingSpaces, text, trailingSpaces] = child.value.match(/^(\s*)([\s\S]*?)(\s*)$/);
-
- if (leadingSpaces) {
- localChildren.push({
- type: TYPE_WHITESPACE
- });
- }
-
- const ParseSourceSpan = child.sourceSpan.constructor;
-
- if (text) {
- localChildren.push({
- type: "text",
- value: text,
- sourceSpan: new ParseSourceSpan(child.sourceSpan.start.moveBy(leadingSpaces.length), child.sourceSpan.end.moveBy(-trailingSpaces.length))
- });
- }
-
- if (trailingSpaces) {
- localChildren.push({
- type: TYPE_WHITESPACE
- });
- }
-
- return newChildren.concat(localChildren);
- }, []) // set hasLeadingSpaces/hasTrailingSpaces and filter whitespace nodes
- .reduce((newChildren, child, i, children) => {
- if (child.type === TYPE_WHITESPACE) {
- return newChildren;
- }
-
- const hasLeadingSpaces = i !== 0 && children[i - 1].type === TYPE_WHITESPACE;
- const hasTrailingSpaces = i !== children.length - 1 && children[i + 1].type === TYPE_WHITESPACE;
- return newChildren.concat(Object.assign({}, child, {
- hasLeadingSpaces,
- hasTrailingSpaces
- }));
- }, [])
- });
- });
- }
-
- function addIsSelfClosing(ast
- /*, options */
- ) {
- return ast.map(node => Object.assign(node, {
- isSelfClosing: !node.children || node.type === "element" && (node.tagDefinition.isVoid || // self-closing
- node.startSourceSpan === node.endSourceSpan)
- }));
- }
-
- function addHasHtmComponentClosingTag(ast, options) {
- return ast.map(node => node.type !== "element" ? node : Object.assign(node, {
- hasHtmComponentClosingTag: node.endSourceSpan && /^<\s*\/\s*\/\s*>$/.test(options.originalText.slice(node.endSourceSpan.start.offset, node.endSourceSpan.end.offset))
- }));
- }
-
- function addCssDisplay(ast, options) {
- return ast.map(node => Object.assign(node, {
- cssDisplay: getNodeCssStyleDisplay$1(node, options)
- }));
- }
- /**
- * - add `isLeadingSpaceSensitive` field
- * - add `isTrailingSpaceSensitive` field
- * - add `isDanglingSpaceSensitive` field for parent nodes
- */
-
-
- function addIsSpaceSensitive(ast
- /*, options */
- ) {
- return ast.map(node => {
- if (!node.children) {
- return node;
- }
-
- if (node.children.length === 0) {
- return node.clone({
- isDanglingSpaceSensitive: isDanglingSpaceSensitiveNode$1(node)
- });
- }
-
- return node.clone({
- children: node.children.map(child => {
- return Object.assign({}, child, {
- isLeadingSpaceSensitive: isLeadingSpaceSensitiveNode$1(child),
- isTrailingSpaceSensitive: isTrailingSpaceSensitiveNode$1(child)
- });
- }).map((child, index, children) => Object.assign({}, child, {
- isLeadingSpaceSensitive: index === 0 ? child.isLeadingSpaceSensitive : children[index - 1].isTrailingSpaceSensitive && child.isLeadingSpaceSensitive,
- isTrailingSpaceSensitive: index === children.length - 1 ? child.isTrailingSpaceSensitive : children[index + 1].isLeadingSpaceSensitive && child.isTrailingSpaceSensitive
- }))
- });
- });
- }
-
- var preprocess_1 = preprocess;
-
- function hasPragma$3(text) {
- return /^\s*<!--\s*@(format|prettier)\s*-->/.test(text);
- }
-
- function insertPragma$5(text) {
- return "<!-- @format -->\n\n" + text.replace(/^\s*\n/, "");
- }
-
- var pragma$3 = {
- hasPragma: hasPragma$3,
- insertPragma: insertPragma$5
- };
-
- const {
- builders: {
- concat: concat$8,
- group: group$8
- }
- } = document;
- /**
- * v-for="... in ..."
- * v-for="... of ..."
- * v-for="(..., ...) in ..."
- * v-for="(..., ...) of ..."
- */
-
- function printVueFor(value, textToDoc) {
- const {
- left,
- operator,
- right
- } = parseVueFor(value);
- return concat$8([group$8(textToDoc("function _(".concat(left, ") {}"), {
- parser: "babel",
- __isVueForBindingLeft: true
- })), " ", operator, " ", textToDoc(right, {
- parser: "__js_expression"
- })]);
- } // modified from https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/parser/index.js#L370-L387
-
-
- function parseVueFor(value) {
- const forAliasRE = /([^]*?)\s+(in|of)\s+([^]*)/;
- const forIteratorRE = /,([^,}\]]*)(?:,([^,}\]]*))?$/;
- const stripParensRE = /^\(|\)$/g;
- const inMatch = value.match(forAliasRE);
-
- if (!inMatch) {
- return;
- }
-
- const res = {};
- res.for = inMatch[3].trim();
- const alias = inMatch[1].trim().replace(stripParensRE, "");
- const iteratorMatch = alias.match(forIteratorRE);
-
- if (iteratorMatch) {
- res.alias = alias.replace(forIteratorRE, "");
- res.iterator1 = iteratorMatch[1].trim();
-
- if (iteratorMatch[2]) {
- res.iterator2 = iteratorMatch[2].trim();
- }
- } else {
- res.alias = alias;
- }
-
- return {
- left: "".concat([res.alias, res.iterator1, res.iterator2].filter(Boolean).join(",")),
- operator: inMatch[2],
- right: res.for
- };
- }
-
- function printVueSlotScope(value, textToDoc) {
- return textToDoc("function _(".concat(value, ") {}"), {
- parser: "babel",
- __isVueSlotScope: true
- });
- }
-
- function isVueEventBindingExpression(eventBindingValue) {
- // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/codegen/events.js#L3-L4
- // arrow function or anonymous function
- const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/; // simple member expression chain (a, a.b, a['b'], a["b"], a[0], a[b])
-
- 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
-
- const value = eventBindingValue.trim();
- return fnExpRE.test(value) || simplePathRE.test(value);
- }
-
- var syntaxVue = {
- isVueEventBindingExpression,
- printVueFor,
- printVueSlotScope
- };
-
- const integerRegex = /^\d+$/;
-
- function deepUnique(array) {
- return array.sort().filter((element, index) => {
- return JSON.stringify(element) !== JSON.stringify(array[index - 1]);
- });
- }
-
- var parse$2 = string => {
- return deepUnique(string.split(',').map(part => {
- const result = {};
- part.trim().split(/\s+/).forEach((element, index) => {
- if (index === 0) {
- result.url = element;
- return;
- }
-
- const value = element.slice(0, element.length - 1);
- const postfix = element[element.length - 1];
- const integerValue = parseInt(value, 10);
- const floatValue = parseFloat(value);
-
- if (postfix === 'w' && integerRegex.test(value)) {
- result.width = integerValue;
- } else if (postfix === 'h' && integerRegex.test(value)) {
- result.height = integerValue;
- } else if (postfix === 'x' && !Number.isNaN(floatValue)) {
- result.density = floatValue;
- } else {
- throw new Error("Invalid srcset descriptor: ".concat(element));
- }
- });
- return result;
- }));
- };
-
- var stringify = array => {
- return [...new Set(array.map(element => {
- if (!element.url) {
- throw new Error('URL is required');
- }
-
- const result = [element.url];
-
- if (element.width) {
- result.push("".concat(element.width, "w"));
- }
-
- if (element.height) {
- result.push("".concat(element.height, "h"));
- }
-
- if (element.density) {
- result.push("".concat(element.density, "x"));
- }
-
- return result.join(' ');
- }))].join(', ');
- };
-
- var srcset = {
- parse: parse$2,
- stringify: stringify
- };
-
- const {
- builders: {
- concat: concat$9,
- ifBreak: ifBreak$4,
- join: join$5,
- line: line$5
- }
- } = document;
- const parseSrcset = srcset.parse;
-
- function printImgSrcset(value) {
- const srcset = parseSrcset(value);
- const hasW = srcset.some(src => src.width);
- const hasH = srcset.some(src => src.height);
- const hasX = srcset.some(src => src.density);
-
- if (hasW + hasH + hasX > 1) {
- throw new Error("Mixed descriptor in srcset is not supported");
- }
-
- const key = hasW ? "width" : hasH ? "height" : "density";
- const unit = hasW ? "w" : hasH ? "h" : "x";
-
- const getMax = values => Math.max(...values);
-
- const urls = srcset.map(src => src.url);
- const maxUrlLength = getMax(urls.map(url => url.length));
- const descriptors = srcset.map(src => src[key]).map(descriptor => descriptor ? descriptor.toString() : "");
- const descriptorLeftLengths = descriptors.map(descriptor => {
- const index = descriptor.indexOf(".");
- return index === -1 ? descriptor.length : index;
- });
- const maxDescriptorLeftLength = getMax(descriptorLeftLengths);
- return join$5(concat$9([",", line$5]), urls.map((url, index) => {
- const parts = [url];
- const descriptor = descriptors[index];
-
- if (descriptor) {
- const urlPadding = maxUrlLength - url.length + 1;
- const descriptorPadding = maxDescriptorLeftLength - descriptorLeftLengths[index];
- const alignment = " ".repeat(urlPadding + descriptorPadding);
- parts.push(ifBreak$4(alignment, " "), descriptor + unit);
- }
-
- return concat$9(parts);
- }));
- }
-
- function printClassNames(value) {
- return value.trim().split(/\s+/).join(" ");
- }
-
- var syntaxAttribute = {
- printImgSrcset,
- printClassNames
- };
-
- const {
- builders,
- utils: {
- stripTrailingHardline: stripTrailingHardline$1,
- mapDoc: mapDoc$2
- }
- } = document;
- const {
- breakParent: breakParent$2,
- dedentToRoot: dedentToRoot$1,
- fill: fill$3,
- group: group$9,
- hardline: hardline$7,
- ifBreak: ifBreak$5,
- indent: indent$5,
- join: join$6,
- line: line$6,
- literalline: literalline$2,
- markAsRoot: markAsRoot$2,
- softline: softline$4
- } = builders;
- const {
- countChars: countChars$1,
- countParents: countParents$1,
- dedentString: dedentString$1,
- forceBreakChildren: forceBreakChildren$1,
- forceBreakContent: forceBreakContent$1,
- forceNextEmptyLine: forceNextEmptyLine$1,
- getLastDescendant: getLastDescendant$1,
- getPrettierIgnoreAttributeCommentData: getPrettierIgnoreAttributeCommentData$1,
- hasPrettierIgnore: hasPrettierIgnore$3,
- inferScriptParser: inferScriptParser$1,
- isScriptLikeTag: isScriptLikeTag$1,
- isTextLikeNode: isTextLikeNode$1,
- normalizeParts: normalizeParts$1,
- preferHardlineAsLeadingSpaces: preferHardlineAsLeadingSpaces$1,
- shouldNotPrintClosingTag: shouldNotPrintClosingTag$1,
- shouldPreserveContent: shouldPreserveContent$1,
- unescapeQuoteEntities: unescapeQuoteEntities$1
- } = utils$4;
- const {
- replaceEndOfLineWith: replaceEndOfLineWith$1
- } = util$1;
- const {
- insertPragma: insertPragma$6
- } = pragma$3;
- const {
- printVueFor: printVueFor$1,
- printVueSlotScope: printVueSlotScope$1,
- isVueEventBindingExpression: isVueEventBindingExpression$1
- } = syntaxVue;
- const {
- printImgSrcset: printImgSrcset$1,
- printClassNames: printClassNames$1
- } = syntaxAttribute;
-
- function concat$a(parts) {
- const newParts = normalizeParts$1(parts);
- return newParts.length === 0 ? "" : newParts.length === 1 ? newParts[0] : builders.concat(newParts);
- }
-
- function embed$2(path, print, textToDoc, options) {
- const node = path.getValue();
-
- switch (node.type) {
- case "text":
- {
- if (isScriptLikeTag$1(node.parent)) {
- const parser = inferScriptParser$1(node.parent);
-
- if (parser) {
- const value = parser === "markdown" ? dedentString$1(node.value.replace(/^[^\S\n]*?\n/, "")) : node.value;
- return builders.concat([concat$a([breakParent$2, printOpeningTagPrefix(node, options), stripTrailingHardline$1(textToDoc(value, {
- parser
- })), printClosingTagSuffix(node, options)])]);
- }
- } else if (node.parent.type === "interpolation") {
- return concat$a([indent$5(concat$a([line$6, textToDoc(node.value, Object.assign({
- __isInHtmlInterpolation: true
- }, options.parser === "angular" ? {
- parser: "__ng_interpolation",
- trailingComma: "none"
- } : options.parser === "vue" ? {
- parser: "__vue_expression"
- } : {
- parser: "__js_expression"
- }))])), node.parent.next && needsToBorrowPrevClosingTagEndMarker(node.parent.next) ? " " : line$6]);
- }
-
- break;
- }
-
- case "attribute":
- {
- if (!node.value) {
- break;
- } // lit-html: html`<my-element obj=${obj}></my-element>`
-
-
- if (/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
- return concat$a([node.rawName, "=", node.value]);
- } // lwc: html`<my-element data-for={value}></my-element>`
-
-
- if (options.parser === "lwc") {
- const interpolationRegex = /^\{[\s\S]*\}$/;
-
- if (interpolationRegex.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
- return concat$a([node.rawName, "=", node.value]);
- }
- }
-
- const embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, (code, opts) => // strictly prefer single quote to avoid unnecessary html entity escape
- textToDoc(code, Object.assign({
- __isInHtmlAttribute: true
- }, opts)), options);
-
- if (embeddedAttributeValueDoc) {
- return concat$a([node.rawName, '="', group$9(mapDoc$2(embeddedAttributeValueDoc, doc => typeof doc === "string" ? doc.replace(/"/g, """) : doc)), '"']);
- }
-
- break;
- }
-
- case "yaml":
- return markAsRoot$2(concat$a(["---", hardline$7, node.value.trim().length === 0 ? "" : textToDoc(node.value, {
- parser: "yaml"
- }), "---"]));
- }
- }
-
- function genericPrint$2(path, options, print) {
- const node = path.getValue();
-
- switch (node.type) {
- case "root":
- if (options.__onHtmlRoot) {
- options.__onHtmlRoot(node);
- } // use original concat to not break stripTrailingHardline
-
-
- return builders.concat([group$9(printChildren$1(path, options, print)), hardline$7]);
-
- case "element":
- case "ieConditionalComment":
- {
- /**
- * do not break:
- *
- * <div>{{
- * ~
- * interpolation
- * }}</div>
- * ~
- *
- * exception: break if the opening tag breaks
- *
- * <div
- * long
- * ~
- * >{{
- * interpolation
- * }}</div
- * ~
- * >
- */
- const shouldHugContent = node.children.length === 1 && node.firstChild.type === "interpolation" && node.firstChild.isLeadingSpaceSensitive && !node.firstChild.hasLeadingSpaces && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces;
- const attrGroupId = Symbol("element-attr-group-id");
- return concat$a([group$9(concat$a([group$9(printOpeningTag(path, options, print), {
- id: attrGroupId
- }), 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, {
- groupId: attrGroupId
- }) : isScriptLikeTag$1(node) && node.parent.type === "root" && options.parser === "vue" && !options.vueIndentScriptAndStyle ? childrenDoc : indent$5(childrenDoc))(concat$a([shouldHugContent ? ifBreak$5(softline$4, "", {
- groupId: attrGroupId
- }) : 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, "", {
- groupId: attrGroupId
- }) : 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) ?
- /**
- * <div>
- * <pre>
- * something
- * </pre>
- * ~
- * </div>
- */
- "" : softline$4])])), printClosingTag(node, options)]);
- }
-
- case "ieConditionalStartComment":
- case "ieConditionalEndComment":
- return concat$a([printOpeningTagStart(node), printClosingTagEnd(node)]);
-
- case "interpolation":
- return concat$a([printOpeningTagStart(node, options), concat$a(path.map(print, "children")), printClosingTagEnd(node, options)]);
-
- case "text":
- {
- if (node.parent.type === "interpolation") {
- // replace the trailing literalline with hardline for better readability
- const trailingNewlineRegex = /\n[^\S\n]*?$/;
- const hasTrailingNewline = trailingNewlineRegex.test(node.value);
- const value = hasTrailingNewline ? node.value.replace(trailingNewlineRegex, "") : node.value;
- return concat$a([concat$a(replaceEndOfLineWith$1(value, literalline$2)), hasTrailingNewline ? hardline$7 : ""]);
- }
-
- return fill$3(normalizeParts$1([].concat(printOpeningTagPrefix(node, options), getTextValueParts(node), printClosingTagSuffix(node, options))));
- }
-
- case "docType":
- return concat$a([group$9(concat$a([printOpeningTagStart(node, options), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")])), printClosingTagEnd(node, options)]);
-
- case "comment":
- {
- return concat$a([printOpeningTagPrefix(node, options), concat$a(replaceEndOfLineWith$1(options.originalText.slice(options.locStart(node), options.locEnd(node)), literalline$2)), printClosingTagSuffix(node, options)]);
- }
-
- case "attribute":
- {
- if (node.value === null) {
- return node.rawName;
- }
-
- const value = unescapeQuoteEntities$1(node.value);
- const singleQuoteCount = countChars$1(value, "'");
- const doubleQuoteCount = countChars$1(value, '"');
- const quote = singleQuoteCount < doubleQuoteCount ? "'" : '"';
- return concat$a([node.rawName, concat$a(["=", quote, concat$a(replaceEndOfLineWith$1(quote === '"' ? value.replace(/"/g, """) : value.replace(/'/g, "'"), literalline$2)), quote])]);
- }
-
- case "yaml":
- case "toml":
- return concat$a(replaceEndOfLineWith$1(node.raw, literalline$2));
-
- default:
- throw new Error("Unexpected node type ".concat(node.type));
- }
- }
-
- function printChildren$1(path, options, print) {
- const node = path.getValue();
-
- if (forceBreakChildren$1(node)) {
- return concat$a([breakParent$2, concat$a(path.map(childPath => {
- const childNode = childPath.getValue();
- const prevBetweenLine = !childNode.prev ? "" : printBetweenLine(childNode.prev, childNode);
- return concat$a([!prevBetweenLine ? "" : concat$a([prevBetweenLine, forceNextEmptyLine$1(childNode.prev) ? hardline$7 : ""]), printChild(childPath)]);
- }, "children"))]);
- }
-
- const groupIds = node.children.map(() => Symbol(""));
- return concat$a(path.map((childPath, childIndex) => {
- const childNode = childPath.getValue();
-
- if (isTextLikeNode$1(childNode)) {
- if (childNode.prev && isTextLikeNode$1(childNode.prev)) {
- const prevBetweenLine = printBetweenLine(childNode.prev, childNode);
-
- if (prevBetweenLine) {
- if (forceNextEmptyLine$1(childNode.prev)) {
- return concat$a([hardline$7, hardline$7, printChild(childPath)]);
- }
-
- return concat$a([prevBetweenLine, printChild(childPath)]);
- }
- }
-
- return printChild(childPath);
- }
-
- const prevParts = [];
- const leadingParts = [];
- const trailingParts = [];
- const nextParts = [];
- const prevBetweenLine = childNode.prev ? printBetweenLine(childNode.prev, childNode) : "";
- const nextBetweenLine = childNode.next ? printBetweenLine(childNode, childNode.next) : "";
-
- if (prevBetweenLine) {
- if (forceNextEmptyLine$1(childNode.prev)) {
- prevParts.push(hardline$7, hardline$7);
- } else if (prevBetweenLine === hardline$7) {
- prevParts.push(hardline$7);
- } else {
- if (isTextLikeNode$1(childNode.prev)) {
- leadingParts.push(prevBetweenLine);
- } else {
- leadingParts.push(ifBreak$5("", softline$4, {
- groupId: groupIds[childIndex - 1]
- }));
- }
- }
- }
-
- if (nextBetweenLine) {
- if (forceNextEmptyLine$1(childNode)) {
- if (isTextLikeNode$1(childNode.next)) {
- nextParts.push(hardline$7, hardline$7);
- }
- } else if (nextBetweenLine === hardline$7) {
- if (isTextLikeNode$1(childNode.next)) {
- nextParts.push(hardline$7);
- }
- } else {
- trailingParts.push(nextBetweenLine);
- }
- }
-
- return concat$a([].concat(prevParts, group$9(concat$a([concat$a(leadingParts), group$9(concat$a([printChild(childPath), concat$a(trailingParts)]), {
- id: groupIds[childIndex]
- })])), nextParts));
- }, "children"));
-
- function printChild(childPath) {
- const child = childPath.getValue();
-
- if (hasPrettierIgnore$3(child)) {
- 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)));
- }
-
- if (shouldPreserveContent$1(child, options)) {
- 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)));
- }
-
- return print(childPath);
- }
-
- function printBetweenLine(prevNode, nextNode) {
- 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) ||
- /**
- * 123<a
- * ~
- * ><b>
- */
- nextNode.firstChild ||
- /**
- * 123<!--
- * ~
- * -->
- */
- nextNode.isSelfClosing ||
- /**
- * 123<span
- * ~
- * attr
- */
- nextNode.type === "element" && nextNode.attrs.length !== 0) ||
- /**
- * <img
- * src="long"
- * ~
- * />123
- */
- prevNode.type === "element" && prevNode.isSelfClosing && needsToBorrowPrevClosingTagEndMarker(nextNode) ? "" : !nextNode.isLeadingSpaceSensitive || preferHardlineAsLeadingSpaces$1(nextNode) ||
- /**
- * Want to write us a letter? Use our<a
- * ><b><a>mailing address</a></b></a
- * ~
- * >.
- */
- needsToBorrowPrevClosingTagEndMarker(nextNode) && prevNode.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild) && prevNode.lastChild.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild.lastChild) ? hardline$7 : nextNode.hasLeadingSpaces ? line$6 : softline$4;
- }
- }
-
- function printOpeningTag(path, options, print) {
- const node = path.getValue();
- const forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0;
- return concat$a([printOpeningTagStart(node, options), !node.attrs || node.attrs.length === 0 ? node.isSelfClosing ?
- /**
- * <br />
- * ^
- */
- " " : "" : concat$a([indent$5(concat$a([forceNotToBreakAttrContent ? " " : line$6, join$6(line$6, (ignoreAttributeData => {
- const hasPrettierIgnoreAttribute = typeof ignoreAttributeData === "boolean" ? () => ignoreAttributeData : Array.isArray(ignoreAttributeData) ? attr => ignoreAttributeData.includes(attr.rawName) : () => false;
- return path.map(attrPath => {
- const attr = attrPath.getValue();
- return hasPrettierIgnoreAttribute(attr) ? concat$a(replaceEndOfLineWith$1(options.originalText.slice(options.locStart(attr), options.locEnd(attr)), literalline$2)) : print(attrPath);
- }, "attrs");
- })(node.prev && node.prev.type === "comment" && getPrettierIgnoreAttributeCommentData$1(node.prev.value)))])),
- /**
- * 123<a
- * attr
- * ~
- * >456
- */
- node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ||
- /**
- * <span
- * >123<meta
- * ~
- * /></span>
- */
- node.isSelfClosing && needsToBorrowLastChildClosingTagEndMarker(node.parent) ? node.isSelfClosing ? " " : "" : node.isSelfClosing ? forceNotToBreakAttrContent ? " " : line$6 : forceNotToBreakAttrContent ? "" : softline$4]), node.isSelfClosing ? "" : printOpeningTagEnd(node)]);
- }
-
- function printOpeningTagStart(node, options) {
- return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : concat$a([printOpeningTagPrefix(node, options), printOpeningTagStartMarker(node)]);
- }
-
- function printOpeningTagEnd(node) {
- return node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ? "" : printOpeningTagEndMarker(node);
- }
-
- function printClosingTag(node, options) {
- return concat$a([node.isSelfClosing ? "" : printClosingTagStart(node, options), printClosingTagEnd(node, options)]);
- }
-
- function printClosingTagStart(node, options) {
- return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : concat$a([printClosingTagPrefix(node, options), printClosingTagStartMarker(node, options)]);
- }
-
- function printClosingTagEnd(node, options) {
- return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : concat$a([printClosingTagEndMarker(node, options), printClosingTagSuffix(node, options)]);
- }
-
- function needsToBorrowNextOpeningTagStartMarker(node) {
- /**
- * 123<p
- * ^^
- * >
- */
- return node.next && !isTextLikeNode$1(node.next) && isTextLikeNode$1(node) && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces;
- }
-
- function needsToBorrowParentOpeningTagEndMarker(node) {
- /**
- * <p
- * >123
- * ^
- *
- * <p
- * ><a
- * ^
- */
- return !node.prev && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
- }
-
- function needsToBorrowPrevClosingTagEndMarker(node) {
- /**
- * <p></p
- * >123
- * ^
- *
- * <p></p
- * ><a
- * ^
- */
- return node.prev && !isTextLikeNode$1(node.prev) && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
- }
-
- function needsToBorrowLastChildClosingTagEndMarker(node) {
- /**
- * <p
- * ><a></a
- * ></p
- * ^
- * >
- */
- return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && !isTextLikeNode$1(getLastDescendant$1(node.lastChild));
- }
-
- function needsToBorrowParentClosingTagStartMarker(node) {
- /**
- * <p>
- * 123</p
- * ^^^
- * >
- *
- * 123</b
- * ></a
- * ^^^
- * >
- */
- return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && isTextLikeNode$1(getLastDescendant$1(node));
- }
-
- function printOpeningTagPrefix(node, options) {
- return needsToBorrowParentOpeningTagEndMarker(node) ? printOpeningTagEndMarker(node.parent) : needsToBorrowPrevClosingTagEndMarker(node) ? printClosingTagEndMarker(node.prev, options) : "";
- }
-
- function printClosingTagPrefix(node, options) {
- return needsToBorrowLastChildClosingTagEndMarker(node) ? printClosingTagEndMarker(node.lastChild, options) : "";
- }
-
- function printClosingTagSuffix(node, options) {
- return needsToBorrowParentClosingTagStartMarker(node) ? printClosingTagStartMarker(node.parent, options) : needsToBorrowNextOpeningTagStartMarker(node) ? printOpeningTagStartMarker(node.next) : "";
- }
-
- function printOpeningTagStartMarker(node) {
- switch (node.type) {
- case "ieConditionalComment":
- case "ieConditionalStartComment":
- return "<!--[if ".concat(node.condition);
-
- case "ieConditionalEndComment":
- return "<!--<!";
-
- case "interpolation":
- return "{{";
-
- case "docType":
- return "<!DOCTYPE";
-
- case "element":
- if (node.condition) {
- return "<!--[if ".concat(node.condition, "]><!--><").concat(node.rawName);
- }
-
- // fall through
-
- default:
- return "<".concat(node.rawName);
- }
- }
-
- function printOpeningTagEndMarker(node) {
- assert(!node.isSelfClosing);
-
- switch (node.type) {
- case "ieConditionalComment":
- return "]>";
-
- case "element":
- if (node.condition) {
- return "><!--<![endif]-->";
- }
-
- // fall through
-
- default:
- return ">";
- }
- }
-
- function printClosingTagStartMarker(node, options) {
- assert(!node.isSelfClosing);
-
- if (shouldNotPrintClosingTag$1(node, options)) {
- return "";
- }
-
- switch (node.type) {
- case "ieConditionalComment":
- return "<!";
-
- case "element":
- if (node.hasHtmComponentClosingTag) {
- return "<//";
- }
-
- // fall through
-
- default:
- return "</".concat(node.rawName);
- }
- }
-
- function printClosingTagEndMarker(node, options) {
- if (shouldNotPrintClosingTag$1(node, options)) {
- return "";
- }
-
- switch (node.type) {
- case "ieConditionalComment":
- case "ieConditionalEndComment":
- return "[endif]-->";
-
- case "ieConditionalStartComment":
- return "]><!-->";
-
- case "interpolation":
- return "}}";
-
- case "element":
- if (node.isSelfClosing) {
- return "/>";
- }
-
- // fall through
-
- default:
- return ">";
- }
- }
-
- function getTextValueParts(node, value = node.value) {
- 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
- join$6(line$6, value.split(/[\t\n\f\r ]+/)).parts;
- }
-
- function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
- const isKeyMatched = patterns => new RegExp(patterns.join("|")).test(node.fullName);
-
- const getValue = () => unescapeQuoteEntities$1(node.value);
-
- let shouldHug = false;
-
- const __onHtmlBindingRoot = (root, options) => {
- 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;
-
- if (rootNode && (rootNode.type === "ObjectExpression" || rootNode.type === "ArrayExpression" || options.parser === "__vue_expression" && (rootNode.type === "TemplateLiteral" || rootNode.type === "StringLiteral"))) {
- shouldHug = true;
- }
- };
-
- const printHug = doc => group$9(doc);
-
- const printExpand = (doc, canHaveTrailingWhitespace = true) => group$9(concat$a([indent$5(concat$a([softline$4, doc])), canHaveTrailingWhitespace ? softline$4 : ""]));
-
- const printMaybeHug = doc => shouldHug ? printHug(doc) : printExpand(doc);
-
- const textToDoc = (code, opts) => originalTextToDoc(code, Object.assign({
- __onHtmlBindingRoot
- }, opts));
-
- if (node.fullName === "srcset" && (node.parent.fullName === "img" || node.parent.fullName === "source")) {
- return printExpand(printImgSrcset$1(getValue()));
- }
-
- if (node.fullName === "class" && !options.parentParser) {
- const value = getValue();
-
- if (!value.includes("{{")) {
- return printClassNames$1(value);
- }
- }
-
- if (node.fullName === "style" && !options.parentParser) {
- const value = getValue();
-
- if (!value.includes("{{")) {
- return printExpand(textToDoc(value, {
- parser: "css",
- __isHTMLStyleAttribute: true
- }));
- }
- }
-
- if (options.parser === "vue") {
- if (node.fullName === "v-for") {
- return printVueFor$1(getValue(), textToDoc);
- }
-
- if (node.fullName === "slot-scope") {
- return printVueSlotScope$1(getValue(), textToDoc);
- }
- /**
- * @click="jsStatement"
- * @click="jsExpression"
- * v-on:click="jsStatement"
- * v-on:click="jsExpression"
- */
-
-
- const vueEventBindingPatterns = ["^@", "^v-on:"];
- /**
- * :class="vueExpression"
- * v-bind:id="vueExpression"
- */
-
- const vueExpressionBindingPatterns = ["^:", "^v-bind:"];
- /**
- * v-if="jsExpression"
- */
-
- const jsExpressionBindingPatterns = ["^v-"];
-
- if (isKeyMatched(vueEventBindingPatterns)) {
- const value = getValue();
- return printMaybeHug(isVueEventBindingExpression$1(value) ? textToDoc(value, {
- parser: "__js_expression"
- }) : stripTrailingHardline$1(textToDoc(value, {
- parser: "__vue_event_binding"
- })));
- }
-
- if (isKeyMatched(vueExpressionBindingPatterns)) {
- return printMaybeHug(textToDoc(getValue(), {
- parser: "__vue_expression"
- }));
- }
-
- if (isKeyMatched(jsExpressionBindingPatterns)) {
- return printMaybeHug(textToDoc(getValue(), {
- parser: "__js_expression"
- }));
- }
- }
-
- if (options.parser === "angular") {
- const ngTextToDoc = (code, opts) => // angular does not allow trailing comma
- textToDoc(code, Object.assign({}, opts, {
- trailingComma: "none"
- }));
- /**
- * *directive="angularDirective"
- */
-
-
- const ngDirectiveBindingPatterns = ["^\\*"];
- /**
- * (click)="angularStatement"
- * on-click="angularStatement"
- */
-
- const ngStatementBindingPatterns = ["^\\(.+\\)$", "^on-"];
- /**
- * [target]="angularExpression"
- * bind-target="angularExpression"
- * [(target)]="angularExpression"
- * bindon-target="angularExpression"
- */
-
- const ngExpressionBindingPatterns = ["^\\[.+\\]$", "^bind(on)?-", // Unofficial rudimentary support for some of the most used directives of AngularJS 1.x
- "^ng-(if|show|hide|class|style)$"];
- /**
- * i18n="longDescription"
- * i18n-attr="longDescription"
- */
-
- const ngI18nPatterns = ["^i18n(-.+)?$"];
-
- if (isKeyMatched(ngStatementBindingPatterns)) {
- return printMaybeHug(ngTextToDoc(getValue(), {
- parser: "__ng_action"
- }));
- }
-
- if (isKeyMatched(ngExpressionBindingPatterns)) {
- return printMaybeHug(ngTextToDoc(getValue(), {
- parser: "__ng_binding"
- }));
- }
-
- if (isKeyMatched(ngI18nPatterns)) {
- const value = getValue().trim();
- return printExpand(fill$3(getTextValueParts(node, value)), !value.includes("@@"));
- }
-
- if (isKeyMatched(ngDirectiveBindingPatterns)) {
- return printMaybeHug(ngTextToDoc(getValue(), {
- parser: "__ng_directive"
- }));
- }
-
- const interpolationRegex = /\{\{([\s\S]+?)\}\}/g;
- const value = getValue();
-
- if (interpolationRegex.test(value)) {
- const parts = [];
- value.split(interpolationRegex).forEach((part, index) => {
- if (index % 2 === 0) {
- parts.push(concat$a(replaceEndOfLineWith$1(part, literalline$2)));
- } else {
- try {
- parts.push(group$9(concat$a(["{{", indent$5(concat$a([line$6, ngTextToDoc(part, {
- parser: "__ng_interpolation",
- __isInHtmlInterpolation: true // to avoid unexpected `}}`
-
- })])), line$6, "}}"])));
- } catch (e) {
- parts.push("{{", concat$a(replaceEndOfLineWith$1(part, literalline$2)), "}}");
- }
- }
- });
- return group$9(concat$a(parts));
- }
- }
-
- return null;
- }
-
- var printerHtml = {
- preprocess: preprocess_1,
- print: genericPrint$2,
- insertPragma: insertPragma$6,
- massageAstNode: clean$3,
- embed: embed$2
- };
-
- const CATEGORY_HTML = "HTML"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
-
- var options$4 = {
- htmlWhitespaceSensitivity: {
- since: "1.15.0",
- category: CATEGORY_HTML,
- type: "choice",
- default: "css",
- description: "How to handle whitespaces in HTML.",
- choices: [{
- value: "css",
- description: "Respect the default value of CSS display property."
- }, {
- value: "strict",
- description: "Whitespaces are considered sensitive."
- }, {
- value: "ignore",
- description: "Whitespaces are considered insensitive."
- }]
- },
- vueIndentScriptAndStyle: {
- since: "1.19.0",
- category: CATEGORY_HTML,
- type: "boolean",
- default: false,
- description: "Indent script and style tags in Vue files."
- }
- };
-
- var name$7 = "HTML";
- var type$6 = "markup";
- var tmScope$6 = "text.html.basic";
- var aceMode$6 = "html";
- var codemirrorMode$3 = "htmlmixed";
- var codemirrorMimeType$3 = "text/html";
- var color$1 = "#e34c26";
- var aliases$1 = [
- "xhtml"
- ];
- var extensions$6 = [
- ".html",
- ".htm",
- ".html.hl",
- ".inc",
- ".st",
- ".xht",
- ".xhtml"
- ];
- var languageId$6 = 146;
- var HTML = {
- name: name$7,
- type: type$6,
- tmScope: tmScope$6,
- aceMode: aceMode$6,
- codemirrorMode: codemirrorMode$3,
- codemirrorMimeType: codemirrorMimeType$3,
- color: color$1,
- aliases: aliases$1,
- extensions: extensions$6,
- languageId: languageId$6
- };
-
- var HTML$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$7,
- type: type$6,
- tmScope: tmScope$6,
- aceMode: aceMode$6,
- codemirrorMode: codemirrorMode$3,
- codemirrorMimeType: codemirrorMimeType$3,
- color: color$1,
- aliases: aliases$1,
- extensions: extensions$6,
- languageId: languageId$6,
- 'default': HTML
- });
-
- var name$8 = "Vue";
- var type$7 = "markup";
- var color$2 = "#2c3e50";
- var extensions$7 = [
- ".vue"
- ];
- var tmScope$7 = "text.html.vue";
- var aceMode$7 = "html";
- var languageId$7 = 391;
- var Vue = {
- name: name$8,
- type: type$7,
- color: color$2,
- extensions: extensions$7,
- tmScope: tmScope$7,
- aceMode: aceMode$7,
- languageId: languageId$7
- };
-
- var Vue$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$8,
- type: type$7,
- color: color$2,
- extensions: extensions$7,
- tmScope: tmScope$7,
- aceMode: aceMode$7,
- languageId: languageId$7,
- 'default': Vue
- });
-
- var require$$0$5 = getCjsExportFromNamespace(HTML$1);
-
- var require$$1$1 = getCjsExportFromNamespace(Vue$1);
-
- const languages$3 = [createLanguage(require$$0$5, () => ({
- name: "Angular",
- since: "1.15.0",
- parsers: ["angular"],
- vscodeLanguageIds: ["html"],
- extensions: [".component.html"],
- filenames: []
- })), createLanguage(require$$0$5, data => ({
- since: "1.15.0",
- parsers: ["html"],
- vscodeLanguageIds: ["html"],
- extensions: data.extensions.concat([".mjml" // MJML is considered XML in Linguist but it should be formatted as HTML
- ])
- })), createLanguage(require$$0$5, () => ({
- name: "Lightning Web Components",
- since: "1.17.0",
- parsers: ["lwc"],
- vscodeLanguageIds: ["html"],
- extensions: [],
- filenames: []
- })), createLanguage(require$$1$1, () => ({
- since: "1.10.0",
- parsers: ["vue"],
- vscodeLanguageIds: ["vue"]
- }))];
- const printers$3 = {
- html: printerHtml
- };
- var languageHtml = {
- languages: languages$3,
- printers: printers$3,
- options: options$4
- };
-
- const {
- addLeadingComment: addLeadingComment$3,
- addTrailingComment: addTrailingComment$3,
- addDanglingComment: addDanglingComment$3,
- getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$2
- } = utilShared;
-
- function handleOwnLineComment(comment, text, options, ast, isLastComment) {
- const {
- precedingNode,
- enclosingNode,
- followingNode
- } = comment;
- 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);
- }
-
- function handleEndOfLineComment(comment, text, options, ast, isLastComment) {
- const {
- precedingNode,
- enclosingNode,
- followingNode
- } = comment;
- 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);
- }
-
- function handleRemainingComment(comment, text, options, ast, isLastComment) {
- const {
- precedingNode,
- enclosingNode,
- followingNode
- } = comment;
-
- 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)) {
- return true;
- }
-
- return false;
- }
-
- function addBlockStatementFirstComment(node, comment) {
- const body = node.body.filter(n => n.type !== "EmptyStatement");
-
- if (body.length === 0) {
- addDanglingComment$3(node, comment);
- } else {
- addLeadingComment$3(body[0], comment);
- }
- }
-
- function addBlockOrNotComment(node, comment) {
- if (node.type === "BlockStatement") {
- addBlockStatementFirstComment(node, comment);
- } else {
- addLeadingComment$3(node, comment);
- }
- }
-
- function handleClosureTypeCastComments(followingNode, comment) {
- if (followingNode && isTypeCastComment(comment)) {
- addLeadingComment$3(followingNode, comment);
- return true;
- }
-
- return false;
- } // There are often comments before the else clause of if statements like
- //
- // if (1) { ... }
- // // comment
- // else { ... }
- //
- // They are being attached as leading comments of the BlockExpression which
- // is not well printed. What we want is to instead move the comment inside
- // of the block and make it leadingComment of the first element of the block
- // or dangling comment of the block if there is nothing inside
- //
- // if (1) { ... }
- // else {
- // // comment
- // ...
- // }
-
-
- function handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) {
- if (!enclosingNode || enclosingNode.type !== "IfStatement" || !followingNode) {
- return false;
- } // We unfortunately have no way using the AST or location of nodes to know
- // if the comment is positioned before the condition parenthesis:
- // if (a /* comment */) {}
- // The only workaround I found is to look at the next character to see if
- // it is a ).
-
-
- const nextCharacter = util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd);
-
- if (nextCharacter === ")") {
- addTrailingComment$3(precedingNode, comment);
- return true;
- } // Comments before `else`:
- // - treat as trailing comments of the consequent, if it's a BlockStatement
- // - treat as a dangling comment otherwise
-
-
- if (precedingNode === enclosingNode.consequent && followingNode === enclosingNode.alternate) {
- if (precedingNode.type === "BlockStatement") {
- addTrailingComment$3(precedingNode, comment);
- } else {
- addDanglingComment$3(enclosingNode, comment);
- }
-
- return true;
- }
-
- if (followingNode.type === "BlockStatement") {
- addBlockStatementFirstComment(followingNode, comment);
- return true;
- }
-
- if (followingNode.type === "IfStatement") {
- addBlockOrNotComment(followingNode.consequent, comment);
- return true;
- } // For comments positioned after the condition parenthesis in an if statement
- // before the consequent without brackets on, such as
- // if (a) /* comment */ true,
- // we look at the next character to see if the following node
- // is the consequent for the if statement
-
-
- if (enclosingNode.consequent === followingNode) {
- addLeadingComment$3(followingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) {
- if (!enclosingNode || enclosingNode.type !== "WhileStatement" || !followingNode) {
- return false;
- } // We unfortunately have no way using the AST or location of nodes to know
- // if the comment is positioned before the condition parenthesis:
- // while (a /* comment */) {}
- // The only workaround I found is to look at the next character to see if
- // it is a ).
-
-
- const nextCharacter = util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd);
-
- if (nextCharacter === ")") {
- addTrailingComment$3(precedingNode, comment);
- return true;
- }
-
- if (followingNode.type === "BlockStatement") {
- addBlockStatementFirstComment(followingNode, comment);
- return true;
- }
-
- return false;
- } // Same as IfStatement but for TryStatement
-
-
- function handleTryStatementComments(enclosingNode, precedingNode, followingNode, comment) {
- if (!enclosingNode || enclosingNode.type !== "TryStatement" && enclosingNode.type !== "CatchClause" || !followingNode) {
- return false;
- }
-
- if (enclosingNode.type === "CatchClause" && precedingNode) {
- addTrailingComment$3(precedingNode, comment);
- return true;
- }
-
- if (followingNode.type === "BlockStatement") {
- addBlockStatementFirstComment(followingNode, comment);
- return true;
- }
-
- if (followingNode.type === "TryStatement") {
- addBlockOrNotComment(followingNode.finalizer, comment);
- return true;
- }
-
- if (followingNode.type === "CatchClause") {
- addBlockOrNotComment(followingNode.body, comment);
- return true;
- }
-
- return false;
- }
-
- function handleMemberExpressionComments(enclosingNode, followingNode, comment) {
- if (enclosingNode && (enclosingNode.type === "MemberExpression" || enclosingNode.type === "OptionalMemberExpression") && followingNode && followingNode.type === "Identifier") {
- addLeadingComment$3(enclosingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleConditionalExpressionComments(enclosingNode, precedingNode, followingNode, comment, text, options) {
- const isSameLineAsPrecedingNode = precedingNode && !util$1.hasNewlineInRange(text, options.locEnd(precedingNode), options.locStart(comment));
-
- if ((!precedingNode || !isSameLineAsPrecedingNode) && enclosingNode && enclosingNode.type === "ConditionalExpression" && followingNode) {
- addLeadingComment$3(followingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleObjectPropertyAssignment(enclosingNode, precedingNode, comment) {
- if (enclosingNode && (enclosingNode.type === "ObjectProperty" || enclosingNode.type === "Property") && enclosingNode.shorthand && enclosingNode.key === precedingNode && enclosingNode.value.type === "AssignmentPattern") {
- addTrailingComment$3(enclosingNode.value.left, comment);
- return true;
- }
-
- return false;
- }
-
- function handleClassComments(enclosingNode, precedingNode, followingNode, comment) {
- if (enclosingNode && (enclosingNode.type === "ClassDeclaration" || enclosingNode.type === "ClassExpression") && enclosingNode.decorators && enclosingNode.decorators.length > 0 && !(followingNode && followingNode.type === "Decorator")) {
- if (!enclosingNode.decorators || enclosingNode.decorators.length === 0) {
- addLeadingComment$3(enclosingNode, comment);
- } else {
- addTrailingComment$3(enclosingNode.decorators[enclosingNode.decorators.length - 1], comment);
- }
-
- return true;
- }
-
- return false;
- }
-
- function handleMethodNameComments(text, enclosingNode, precedingNode, comment, options) {
- // This is only needed for estree parsers (flow, typescript) to attach
- // after a method name:
- // obj = { fn /*comment*/() {} };
- if (enclosingNode && precedingNode && ( // "MethodDefinition" is handled in getCommentChildNodes
- enclosingNode.type === "Property" || enclosingNode.type === "TSDeclareMethod" || enclosingNode.type === "TSAbstractMethodDefinition") && precedingNode.type === "Identifier" && enclosingNode.key === precedingNode && // special Property case: { key: /*comment*/(value) };
- // comment should be attached to value instead of key
- util$1.getNextNonSpaceNonCommentCharacter(text, precedingNode, options.locEnd) !== ":") {
- addTrailingComment$3(precedingNode, comment);
- return true;
- } // Print comments between decorators and class methods as a trailing comment
- // on the decorator node instead of the method node
-
-
- if (precedingNode && enclosingNode && precedingNode.type === "Decorator" && (enclosingNode.type === "ClassMethod" || enclosingNode.type === "ClassProperty" || enclosingNode.type === "TSAbstractClassProperty" || enclosingNode.type === "TSAbstractMethodDefinition" || enclosingNode.type === "TSDeclareMethod" || enclosingNode.type === "MethodDefinition")) {
- addTrailingComment$3(precedingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleFunctionNameComments(text, enclosingNode, precedingNode, comment, options) {
- if (util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) !== "(") {
- return false;
- }
-
- if (precedingNode && enclosingNode && (enclosingNode.type === "FunctionDeclaration" || enclosingNode.type === "FunctionExpression" || enclosingNode.type === "ClassMethod" || enclosingNode.type === "MethodDefinition" || enclosingNode.type === "ObjectMethod")) {
- addTrailingComment$3(precedingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleCommentAfterArrowParams(text, enclosingNode, comment, options) {
- if (!(enclosingNode && enclosingNode.type === "ArrowFunctionExpression")) {
- return false;
- }
-
- const index = getNextNonSpaceNonCommentCharacterIndex$2(text, comment, options.locEnd);
-
- if (text.slice(index, index + 2) === "=>") {
- addDanglingComment$3(enclosingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleCommentInEmptyParens(text, enclosingNode, comment, options) {
- if (util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) !== ")") {
- return false;
- } // Only add dangling comments to fix the case when no params are present,
- // i.e. a function without any argument.
-
-
- if (enclosingNode && (isRealFunctionLikeNode(enclosingNode) && // `params` vs `parameters` - see https://github.com/babel/babel/issues/9231
- (enclosingNode.params || enclosingNode.parameters).length === 0 || (enclosingNode.type === "CallExpression" || enclosingNode.type === "OptionalCallExpression" || enclosingNode.type === "NewExpression") && enclosingNode.arguments.length === 0)) {
- addDanglingComment$3(enclosingNode, comment);
- return true;
- }
-
- if (enclosingNode && enclosingNode.type === "MethodDefinition" && enclosingNode.value.params.length === 0) {
- addDanglingComment$3(enclosingNode.value, comment);
- return true;
- }
-
- return false;
- }
-
- function handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) {
- // Flow function type definitions
- if (precedingNode && precedingNode.type === "FunctionTypeParam" && enclosingNode && enclosingNode.type === "FunctionTypeAnnotation" && followingNode && followingNode.type !== "FunctionTypeParam") {
- addTrailingComment$3(precedingNode, comment);
- return true;
- } // Real functions and TypeScript function type definitions
-
-
- if (precedingNode && (precedingNode.type === "Identifier" || precedingNode.type === "AssignmentPattern") && enclosingNode && isRealFunctionLikeNode(enclosingNode) && util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) === ")") {
- addTrailingComment$3(precedingNode, comment);
- return true;
- }
-
- if (enclosingNode && enclosingNode.type === "FunctionDeclaration" && followingNode && followingNode.type === "BlockStatement") {
- const functionParamRightParenIndex = (() => {
- if ((enclosingNode.params || enclosingNode.parameters).length !== 0) {
- return util$1.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, options.locEnd(util$1.getLast(enclosingNode.params || enclosingNode.parameters)));
- }
-
- const functionParamLeftParenIndex = util$1.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, options.locEnd(enclosingNode.id));
- return util$1.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, functionParamLeftParenIndex + 1);
- })();
-
- if (options.locStart(comment) > functionParamRightParenIndex) {
- addBlockStatementFirstComment(followingNode, comment);
- return true;
- }
- }
-
- return false;
- }
-
- function handleImportSpecifierComments(enclosingNode, comment) {
- if (enclosingNode && enclosingNode.type === "ImportSpecifier") {
- addLeadingComment$3(enclosingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleLabeledStatementComments(enclosingNode, comment) {
- if (enclosingNode && enclosingNode.type === "LabeledStatement") {
- addLeadingComment$3(enclosingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleBreakAndContinueStatementComments(enclosingNode, comment) {
- if (enclosingNode && (enclosingNode.type === "ContinueStatement" || enclosingNode.type === "BreakStatement") && !enclosingNode.label) {
- addTrailingComment$3(enclosingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleCallExpressionComments(precedingNode, enclosingNode, comment) {
- if (enclosingNode && (enclosingNode.type === "CallExpression" || enclosingNode.type === "OptionalCallExpression") && precedingNode && enclosingNode.callee === precedingNode && enclosingNode.arguments.length > 0) {
- addLeadingComment$3(enclosingNode.arguments[0], comment);
- return true;
- }
-
- return false;
- }
-
- function handleUnionTypeComments(precedingNode, enclosingNode, followingNode, comment) {
- if (enclosingNode && (enclosingNode.type === "UnionTypeAnnotation" || enclosingNode.type === "TSUnionType")) {
- if (util$1.isNodeIgnoreComment(comment)) {
- followingNode.prettierIgnore = true;
- comment.unignore = true;
- }
-
- if (precedingNode) {
- addTrailingComment$3(precedingNode, comment);
- return true;
- }
-
- return false;
- }
-
- if (followingNode && (followingNode.type === "UnionTypeAnnotation" || followingNode.type === "TSUnionType") && util$1.isNodeIgnoreComment(comment)) {
- followingNode.types[0].prettierIgnore = true;
- comment.unignore = true;
- }
-
- return false;
- }
-
- function handlePropertyComments(enclosingNode, comment) {
- if (enclosingNode && (enclosingNode.type === "Property" || enclosingNode.type === "ObjectProperty")) {
- addLeadingComment$3(enclosingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleOnlyComments(enclosingNode, ast, comment, isLastComment) {
- // With Flow the enclosingNode is undefined so use the AST instead.
- if (ast && ast.body && ast.body.length === 0) {
- if (isLastComment) {
- addDanglingComment$3(ast, comment);
- } else {
- addLeadingComment$3(ast, comment);
- }
-
- return true;
- } else if (enclosingNode && enclosingNode.type === "Program" && enclosingNode.body.length === 0 && enclosingNode.directives && enclosingNode.directives.length === 0) {
- if (isLastComment) {
- addDanglingComment$3(enclosingNode, comment);
- } else {
- addLeadingComment$3(enclosingNode, comment);
- }
-
- return true;
- }
-
- return false;
- }
-
- function handleForComments(enclosingNode, precedingNode, comment) {
- if (enclosingNode && (enclosingNode.type === "ForInStatement" || enclosingNode.type === "ForOfStatement")) {
- addLeadingComment$3(enclosingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleImportDeclarationComments(text, enclosingNode, precedingNode, comment, options) {
- if (precedingNode && precedingNode.type === "ImportSpecifier" && enclosingNode && enclosingNode.type === "ImportDeclaration" && util$1.hasNewline(text, options.locEnd(comment))) {
- addTrailingComment$3(precedingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleAssignmentPatternComments(enclosingNode, comment) {
- if (enclosingNode && enclosingNode.type === "AssignmentPattern") {
- addLeadingComment$3(enclosingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleTypeAliasComments(enclosingNode, followingNode, comment) {
- if (enclosingNode && enclosingNode.type === "TypeAlias") {
- addLeadingComment$3(enclosingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleVariableDeclaratorComments(enclosingNode, followingNode, comment) {
- if (enclosingNode && (enclosingNode.type === "VariableDeclarator" || enclosingNode.type === "AssignmentExpression") && followingNode && (followingNode.type === "ObjectExpression" || followingNode.type === "ArrayExpression" || followingNode.type === "TemplateLiteral" || followingNode.type === "TaggedTemplateExpression" || isBlockComment(comment))) {
- addLeadingComment$3(followingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleTSFunctionTrailingComments(text, enclosingNode, followingNode, comment, options) {
- if (!followingNode && enclosingNode && (enclosingNode.type === "TSMethodSignature" || enclosingNode.type === "TSDeclareFunction" || enclosingNode.type === "TSAbstractMethodDefinition") && util$1.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) === ";") {
- addTrailingComment$3(enclosingNode, comment);
- return true;
- }
-
- return false;
- }
-
- function handleTSMappedTypeComments(text, enclosingNode, precedingNode, followingNode, comment) {
- if (!enclosingNode || enclosingNode.type !== "TSMappedType") {
- return false;
- }
-
- if (followingNode && followingNode.type === "TSTypeParameter" && followingNode.name) {
- addLeadingComment$3(followingNode.name, comment);
- return true;
- }
-
- if (precedingNode && precedingNode.type === "TSTypeParameter" && precedingNode.constraint) {
- addTrailingComment$3(precedingNode.constraint, comment);
- return true;
- }
-
- return false;
- }
-
- function isBlockComment(comment) {
- return comment.type === "Block" || comment.type === "CommentBlock";
- }
-
- function hasLeadingComment(node, fn = () => true) {
- if (node.leadingComments) {
- return node.leadingComments.some(fn);
- }
-
- if (node.comments) {
- return node.comments.some(comment => comment.leading && fn(comment));
- }
-
- return false;
- }
-
- function isRealFunctionLikeNode(node) {
- 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";
- }
-
- function getGapRegex(enclosingNode) {
- if (enclosingNode && enclosingNode.type !== "BinaryExpression" && enclosingNode.type !== "LogicalExpression") {
- // Support degenerate single-element unions and intersections.
- // E.g.: `type A = /* 1 */ & B`
- return /^[\s(&|]*$/;
- }
- }
-
- function getCommentChildNodes(node, options) {
- // Prevent attaching comments to FunctionExpression in this case:
- // class Foo {
- // bar() // comment
- // {
- // baz();
- // }
- // }
- 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) {
- return [...(node.decorators || []), node.key, node.value.body];
- }
- }
-
- function isTypeCastComment(comment) {
- return isBlockComment(comment) && comment.value[0] === "*" && // TypeScript expects the type to be enclosed in curly brackets, however
- // Closure Compiler accepts types in parens and even without any delimiters at all.
- // That's why we just search for "@type".
- /@type\b/.test(comment.value);
- }
-
- var comments$1 = {
- handleOwnLineComment,
- handleEndOfLineComment,
- handleRemainingComment,
- hasLeadingComment,
- isBlockComment,
- isTypeCastComment,
- getGapRegex,
- getCommentChildNodes
- };
-
- const {
- isBlockComment: isBlockComment$1,
- hasLeadingComment: hasLeadingComment$1
- } = comments$1;
- const {
- builders: {
- indent: indent$6,
- join: join$7,
- line: line$7,
- hardline: hardline$8,
- softline: softline$5,
- literalline: literalline$3,
- concat: concat$b,
- group: group$a,
- dedentToRoot: dedentToRoot$2
- },
- utils: {
- mapDoc: mapDoc$3,
- stripTrailingHardline: stripTrailingHardline$2
- }
- } = document;
-
- function embed$3(path, print, textToDoc, options) {
- const node = path.getValue();
- const parent = path.getParentNode();
- const parentParent = path.getParentNode(1);
-
- switch (node.type) {
- case "TemplateLiteral":
- {
- const isCss = [isStyledJsx, isStyledComponents, isCssProp, isAngularComponentStyles].some(isIt => isIt(path));
-
- if (isCss) {
- // Get full template literal with expressions replaced by placeholders
- const rawQuasis = node.quasis.map(q => q.value.raw);
- let placeholderID = 0;
- const text = rawQuasis.reduce((prevVal, currVal, idx) => {
- return idx === 0 ? currVal : prevVal + "@prettier-placeholder-" + placeholderID++ + "-id" + currVal;
- }, "");
- const doc = textToDoc(text, {
- parser: "scss"
- });
- return transformCssDoc(doc, path, print);
- }
- /*
- * react-relay and graphql-tag
- * graphql`...`
- * graphql.experimental`...`
- * gql`...`
- *
- * This intentionally excludes Relay Classic tags, as Prettier does not
- * support Relay Classic formatting.
- */
-
-
- if (isGraphQL(path)) {
- const expressionDocs = node.expressions ? path.map(print, "expressions") : [];
- const numQuasis = node.quasis.length;
-
- if (numQuasis === 1 && node.quasis[0].value.raw.trim() === "") {
- return "``";
- }
-
- const parts = [];
-
- for (let i = 0; i < numQuasis; i++) {
- const templateElement = node.quasis[i];
- const isFirst = i === 0;
- const isLast = i === numQuasis - 1;
- const text = templateElement.value.cooked; // Bail out if any of the quasis have an invalid escape sequence
- // (which would make the `cooked` value be `null` or `undefined`)
-
- if (typeof text !== "string") {
- return null;
- }
-
- const lines = text.split("\n");
- const numLines = lines.length;
- const expressionDoc = expressionDocs[i];
- const startsWithBlankLine = numLines > 2 && lines[0].trim() === "" && lines[1].trim() === "";
- const endsWithBlankLine = numLines > 2 && lines[numLines - 1].trim() === "" && lines[numLines - 2].trim() === "";
- const commentsAndWhitespaceOnly = lines.every(line => /^\s*(?:#[^\r\n]*)?$/.test(line)); // Bail out if an interpolation occurs within a comment.
-
- if (!isLast && /#[^\r\n]*$/.test(lines[numLines - 1])) {
- return null;
- }
-
- let doc = null;
-
- if (commentsAndWhitespaceOnly) {
- doc = printGraphqlComments(lines);
- } else {
- doc = stripTrailingHardline$2(textToDoc(text, {
- parser: "graphql"
- }));
- }
-
- if (doc) {
- doc = escapeTemplateCharacters(doc, false);
-
- if (!isFirst && startsWithBlankLine) {
- parts.push("");
- }
-
- parts.push(doc);
-
- if (!isLast && endsWithBlankLine) {
- parts.push("");
- }
- } else if (!isFirst && !isLast && startsWithBlankLine) {
- parts.push("");
- }
-
- if (expressionDoc) {
- parts.push(concat$b(["${", expressionDoc, "}"]));
- }
- }
-
- return concat$b(["`", indent$6(concat$b([hardline$8, join$7(hardline$8, parts)])), hardline$8, "`"]);
- }
-
- const htmlParser = isHtml(path) ? "html" : isAngularComponentTemplate(path) ? "angular" : undefined;
-
- if (htmlParser) {
- return printHtmlTemplateLiteral(path, print, textToDoc, htmlParser, options);
- }
-
- break;
- }
-
- case "TemplateElement":
- {
- /**
- * md`...`
- * markdown`...`
- */
- if (parentParent && parentParent.type === "TaggedTemplateExpression" && parent.quasis.length === 1 && parentParent.tag.type === "Identifier" && (parentParent.tag.name === "md" || parentParent.tag.name === "markdown")) {
- const text = parent.quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g, (_, backslashes) => "\\".repeat(backslashes.length / 2) + "`");
- const indentation = getIndentation(text);
- const hasIndent = indentation !== "";
- 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]);
- }
-
- break;
- }
- }
-
- function printMarkdown(text) {
- const doc = textToDoc(text, {
- parser: "markdown",
- __inJsTemplate: true
- });
- return stripTrailingHardline$2(escapeTemplateCharacters(doc, true));
- }
- }
-
- function getIndentation(str) {
- const firstMatchedIndent = str.match(/^([^\S\n]*)\S/m);
- return firstMatchedIndent === null ? "" : firstMatchedIndent[1];
- }
-
- function uncook(cookedValue) {
- return cookedValue.replace(/([\\`]|\$\{)/g, "\\$1");
- }
-
- function escapeTemplateCharacters(doc, raw) {
- return mapDoc$3(doc, currentDoc => {
- if (!currentDoc.parts) {
- return currentDoc;
- }
-
- const parts = [];
- currentDoc.parts.forEach(part => {
- if (typeof part === "string") {
- parts.push(raw ? part.replace(/(\\*)`/g, "$1$1\\`") : uncook(part));
- } else {
- parts.push(part);
- }
- });
- return Object.assign({}, currentDoc, {
- parts
- });
- });
- }
-
- function transformCssDoc(quasisDoc, path, print) {
- const parentNode = path.getValue();
- const isEmpty = parentNode.quasis.length === 1 && !parentNode.quasis[0].value.raw.trim();
-
- if (isEmpty) {
- return "``";
- }
-
- const expressionDocs = parentNode.expressions ? path.map(print, "expressions") : [];
- const newDoc = replacePlaceholders(quasisDoc, expressionDocs);
- /* istanbul ignore if */
-
- if (!newDoc) {
- throw new Error("Couldn't insert all the expressions");
- }
-
- return concat$b(["`", indent$6(concat$b([hardline$8, stripTrailingHardline$2(newDoc)])), softline$5, "`"]);
- } // Search all the placeholders in the quasisDoc tree
- // and replace them with the expression docs one by one
- // returns a new doc with all the placeholders replaced,
- // or null if it couldn't replace any expression
-
-
- function replacePlaceholders(quasisDoc, expressionDocs) {
- if (!expressionDocs || !expressionDocs.length) {
- return quasisDoc;
- }
-
- const expressions = expressionDocs.slice();
- let replaceCounter = 0;
- const newDoc = mapDoc$3(quasisDoc, doc => {
- if (!doc || !doc.parts || !doc.parts.length) {
- return doc;
- }
-
- let {
- parts
- } = doc;
- const atIndex = parts.indexOf("@");
- const placeholderIndex = atIndex + 1;
-
- if (atIndex > -1 && typeof parts[placeholderIndex] === "string" && parts[placeholderIndex].startsWith("prettier-placeholder")) {
- // If placeholder is split, join it
- const at = parts[atIndex];
- const placeholder = parts[placeholderIndex];
- const rest = parts.slice(placeholderIndex + 1);
- parts = parts.slice(0, atIndex).concat([at + placeholder]).concat(rest);
- }
-
- const atPlaceholderIndex = parts.findIndex(part => typeof part === "string" && part.startsWith("@prettier-placeholder"));
-
- if (atPlaceholderIndex > -1) {
- const placeholder = parts[atPlaceholderIndex];
- const rest = parts.slice(atPlaceholderIndex + 1);
- const placeholderMatch = placeholder.match(/@prettier-placeholder-(.+)-id([\s\S]*)/);
- const placeholderID = placeholderMatch[1]; // When the expression has a suffix appended, like:
- // animation: linear ${time}s ease-out;
-
- const suffix = placeholderMatch[2];
- const expression = expressions[placeholderID];
- replaceCounter++;
- parts = parts.slice(0, atPlaceholderIndex).concat(["${", expression, "}" + suffix]).concat(rest);
- }
-
- return Object.assign({}, doc, {
- parts
- });
- });
- return expressions.length === replaceCounter ? newDoc : null;
- }
-
- function printGraphqlComments(lines) {
- const parts = [];
- let seenComment = false;
- lines.map(textLine => textLine.trim()).forEach((textLine, i, array) => {
- // Lines are either whitespace only, or a comment (with potential whitespace
- // around it). Drop whitespace-only lines.
- if (textLine === "") {
- return;
- }
-
- if (array[i - 1] === "" && seenComment) {
- // If a non-first comment is preceded by a blank (whitespace only) line,
- // add in a blank line.
- parts.push(concat$b([hardline$8, textLine]));
- } else {
- parts.push(textLine);
- }
-
- seenComment = true;
- }); // If `lines` was whitespace only, return `null`.
-
- return parts.length === 0 ? null : join$7(hardline$8, parts);
- }
- /**
- * Template literal in these contexts:
- * <style jsx>{`div{color:red}`}</style>
- * css``
- * css.global``
- * css.resolve``
- */
-
-
- function isStyledJsx(path) {
- const node = path.getValue();
- const parent = path.getParentNode();
- const parentParent = path.getParentNode(1);
- 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");
- }
- /**
- * Angular Components can have:
- * - Inline HTML template
- * - Inline CSS styles
- *
- * ...which are both within template literals somewhere
- * inside of the Component decorator factory.
- *
- * E.g.
- * @Component({
- * template: `<div>...</div>`,
- * styles: [`h1 { color: blue; }`]
- * })
- */
-
-
- function isAngularComponentStyles(path) {
- 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);
- }
-
- function isAngularComponentTemplate(path) {
- 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);
- }
-
- 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"];
- /**
- * styled-components template literals
- */
-
- function isStyledComponents(path) {
- const parent = path.getParentNode();
-
- if (!parent || parent.type !== "TaggedTemplateExpression") {
- return false;
- }
-
- const {
- tag
- } = parent;
-
- switch (tag.type) {
- case "MemberExpression":
- return (// styled.foo``
- isStyledIdentifier(tag.object) || // Component.extend``
- isStyledExtend(tag)
- );
-
- case "CallExpression":
- return (// styled(Component)``
- isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && ( // styled.foo.attrs({})``
- isStyledIdentifier(tag.callee.object.object) || // Component.extend.attrs({})``
- isStyledExtend(tag.callee.object)) || // styled(Component).attrs({})``
- tag.callee.object.type === "CallExpression" && isStyledIdentifier(tag.callee.object.callee))
- );
-
- case "Identifier":
- // css``
- return tag.name === "css";
-
- default:
- return false;
- }
- }
- /**
- * JSX element with CSS prop
- */
-
-
- function isCssProp(path) {
- const parent = path.getParentNode();
- const parentParent = path.getParentNode(1);
- return parentParent && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" && parentParent.name.type === "JSXIdentifier" && parentParent.name.name === "css";
- }
-
- function isStyledIdentifier(node) {
- return node.type === "Identifier" && node.name === "styled";
- }
-
- function isStyledExtend(node) {
- return /^[A-Z]/.test(node.object.name) && node.property.name === "extend";
- }
- /*
- * react-relay and graphql-tag
- * graphql`...`
- * graphql.experimental`...`
- * gql`...`
- * GraphQL comment block
- *
- * This intentionally excludes Relay Classic tags, as Prettier does not
- * support Relay Classic formatting.
- */
-
-
- function isGraphQL(path) {
- const node = path.getValue();
- const parent = path.getParentNode();
- 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");
- }
-
- function hasLanguageComment(node, languageName) {
- // This checks for a leading comment that is exactly `/* GraphQL */`
- // In order to be in line with other implementations of this comment tag
- // we will not trim the comment value and we will expect exactly one space on
- // either side of the GraphQL string
- // Also see ./clean.js
- return hasLeadingComment$1(node, comment => isBlockComment$1(comment) && comment.value === " ".concat(languageName, " "));
- }
- /**
- * - html`...`
- * - HTML comment block
- */
-
-
- function isHtml(path) {
- 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");
- } // The counter is needed to distinguish nested embeds.
-
-
- let htmlTemplateLiteralCounter = 0;
-
- function printHtmlTemplateLiteral(path, print, textToDoc, parser, options) {
- const node = path.getValue();
- const counter = htmlTemplateLiteralCounter;
- htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0;
-
- const composePlaceholder = index => "PRETTIER_HTML_PLACEHOLDER_".concat(index, "_").concat(counter, "_IN_JS");
-
- const text = node.quasis.map((quasi, index, quasis) => index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index)).join("");
- const expressionDocs = path.map(print, "expressions");
-
- if (expressionDocs.length === 0 && text.trim().length === 0) {
- return "``";
- }
-
- const placeholderRegex = new RegExp(composePlaceholder("(\\d+)"), "g");
- let topLevelCount = 0;
- const contentDoc = mapDoc$3(stripTrailingHardline$2(textToDoc(text, {
- parser,
-
- __onHtmlRoot(root) {
- topLevelCount = root.children.length;
- }
-
- })), doc => {
- if (typeof doc !== "string") {
- return doc;
- }
-
- const parts = [];
- const components = doc.split(placeholderRegex);
-
- for (let i = 0; i < components.length; i++) {
- let component = components[i];
-
- if (i % 2 === 0) {
- if (component) {
- component = uncook(component);
-
- if (options.embeddedInHtml) {
- component = component.replace(/<\/(script)\b/gi, "<\\/$1");
- }
-
- parts.push(component);
- }
-
- continue;
- }
-
- const placeholderIndex = +component;
- parts.push(concat$b(["${", group$a(expressionDocs[placeholderIndex]), "}"]));
- }
-
- return concat$b(parts);
- });
- const leadingWhitespace = /^\s/.test(text) ? " " : "";
- const trailingWhitespace = /\s$/.test(text) ? " " : "";
- const linebreak = options.htmlWhitespaceSensitivity === "ignore" ? hardline$8 : leadingWhitespace && trailingWhitespace ? line$7 : null;
-
- if (linebreak) {
- return group$a(concat$b(["`", indent$6(concat$b([linebreak, group$a(contentDoc)])), linebreak, "`"]));
- }
-
- return group$a(concat$b(["`", leadingWhitespace, topLevelCount > 1 ? indent$6(group$a(contentDoc)) : group$a(contentDoc), trailingWhitespace, "`"]));
- }
-
- var embed_1$1 = embed$3;
-
- function clean$4(ast, newObj, parent) {
- ["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "flags", "errors"].forEach(name => {
- delete newObj[name];
- });
-
- if (ast.loc && ast.loc.source === null) {
- delete newObj.loc.source;
- }
-
- if (ast.type === "BigIntLiteral") {
- newObj.value = newObj.value.toLowerCase();
- } // We remove extra `;` and add them when needed
-
-
- if (ast.type === "EmptyStatement") {
- return null;
- } // We move text around, including whitespaces and add {" "}
-
-
- if (ast.type === "JSXText") {
- return null;
- }
-
- if (ast.type === "JSXExpressionContainer" && ast.expression.type === "Literal" && ast.expression.value === " ") {
- return null;
- } // (TypeScript) Ignore `static` in `constructor(static p) {}`
- // and `export` in `constructor(export p) {}`
-
-
- if (ast.type === "TSParameterProperty" && ast.accessibility === null && !ast.readonly) {
- return {
- type: "Identifier",
- name: ast.parameter.name,
- typeAnnotation: newObj.parameter.typeAnnotation,
- decorators: newObj.decorators
- };
- } // (TypeScript) ignore empty `specifiers` array
-
-
- if (ast.type === "TSNamespaceExportDeclaration" && ast.specifiers && ast.specifiers.length === 0) {
- delete newObj.specifiers;
- } // We convert <div></div> to <div />
-
-
- if (ast.type === "JSXOpeningElement") {
- delete newObj.selfClosing;
- }
-
- if (ast.type === "JSXElement") {
- delete newObj.closingElement;
- } // We change {'key': value} into {key: value}
-
-
- 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")) {
- delete newObj.key;
- }
-
- if (ast.type === "OptionalMemberExpression" && ast.optional === false) {
- newObj.type = "MemberExpression";
- delete newObj.optional;
- } // Remove raw and cooked values from TemplateElement when it's CSS
- // styled-jsx
-
-
- if (ast.type === "JSXElement" && ast.openingElement.name.name === "style" && ast.openingElement.attributes.some(attr => attr.name.name === "jsx")) {
- const templateLiterals = newObj.children.filter(child => child.type === "JSXExpressionContainer" && child.expression.type === "TemplateLiteral").map(container => container.expression);
- const quasis = templateLiterals.reduce((quasis, templateLiteral) => quasis.concat(templateLiteral.quasis), []);
- quasis.forEach(q => delete q.value);
- } // CSS template literals in css prop
-
-
- if (ast.type === "JSXAttribute" && ast.name.name === "css" && ast.value.type === "JSXExpressionContainer" && ast.value.expression.type === "TemplateLiteral") {
- newObj.value.expression.quasis.forEach(q => delete q.value);
- } // Angular Components: Inline HTML template and Inline CSS styles
-
-
- const expression = ast.expression || ast.callee;
-
- if (ast.type === "Decorator" && expression.type === "CallExpression" && expression.callee.name === "Component" && expression.arguments.length === 1) {
- const astProps = ast.expression.arguments[0].properties;
- newObj.expression.arguments[0].properties.forEach((prop, index) => {
- let templateLiteral = null;
-
- switch (astProps[index].key.name) {
- case "styles":
- if (prop.value.type === "ArrayExpression") {
- templateLiteral = prop.value.elements[0];
- }
-
- break;
-
- case "template":
- if (prop.value.type === "TemplateLiteral") {
- templateLiteral = prop.value;
- }
-
- break;
- }
-
- if (templateLiteral) {
- templateLiteral.quasis.forEach(q => delete q.value);
- }
- });
- } // styled-components, graphql, markdown
-
-
- 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")) {
- newObj.quasi.quasis.forEach(quasi => delete quasi.value);
- }
-
- if (ast.type === "TemplateLiteral") {
- // This checks for a leading comment that is exactly `/* GraphQL */`
- // In order to be in line with other implementations of this comment tag
- // we will not trim the comment value and we will expect exactly one space on
- // either side of the GraphQL string
- // Also see ./embed.js
- const hasLanguageComment = ast.leadingComments && ast.leadingComments.some(comment => comment.type === "CommentBlock" && ["GraphQL", "HTML"].some(languageName => comment.value === " ".concat(languageName, " ")));
-
- if (hasLanguageComment || parent.type === "CallExpression" && parent.callee.name === "graphql") {
- newObj.quasis.forEach(quasi => delete quasi.value);
- }
- }
- }
-
- var clean_1$1 = clean$4;
-
- const {
- getLast: getLast$2,
- hasNewline: hasNewline$4,
- hasNewlineInRange: hasNewlineInRange$2,
- hasIgnoreComment: hasIgnoreComment$3,
- hasNodeIgnoreComment: hasNodeIgnoreComment$1,
- skipWhitespace: skipWhitespace$2
- } = util$1;
- const isIdentifierName = utils$1.keyword.isIdentifierNameES5; // We match any whitespace except line terminators because
- // Flow annotation comments cannot be split across lines. For example:
- //
- // (this /*
- // : any */).foo = 5;
- //
- // is not picked up by Flow (see https://github.com/facebook/flow/issues/7050), so
- // removing the newline would create a type annotation that the user did not intend
- // to create.
-
- const NON_LINE_TERMINATING_WHITE_SPACE = "(?:(?=.)\\s)";
- const FLOW_SHORTHAND_ANNOTATION = new RegExp("^".concat(NON_LINE_TERMINATING_WHITE_SPACE, "*:"));
- const FLOW_ANNOTATION = new RegExp("^".concat(NON_LINE_TERMINATING_WHITE_SPACE, "*::"));
-
- function hasFlowShorthandAnnotationComment(node) {
- // https://flow.org/en/docs/types/comments/
- // Syntax example: const r = new (window.Request /*: Class<Request> */)("");
- return node.extra && node.extra.parenthesized && node.trailingComments && node.trailingComments[0].value.match(FLOW_SHORTHAND_ANNOTATION);
- }
-
- function hasFlowAnnotationComment(comments) {
- return comments && comments[0].value.match(FLOW_ANNOTATION);
- }
-
- function hasNode(node, fn) {
- if (!node || typeof node !== "object") {
- return false;
- }
-
- if (Array.isArray(node)) {
- return node.some(value => hasNode(value, fn));
- }
-
- const result = fn(node);
- return typeof result === "boolean" ? result : Object.keys(node).some(key => hasNode(node[key], fn));
- }
-
- function hasNakedLeftSide(node) {
- 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";
- }
-
- function getLeftSide(node) {
- if (node.expressions) {
- return node.expressions[0];
- }
-
- return node.left || node.test || node.callee || node.object || node.tag || node.argument || node.expression;
- }
-
- function getLeftSidePathName(path, node) {
- if (node.expressions) {
- return ["expressions", 0];
- }
-
- if (node.left) {
- return ["left"];
- }
-
- if (node.test) {
- return ["test"];
- }
-
- if (node.object) {
- return ["object"];
- }
-
- if (node.callee) {
- return ["callee"];
- }
-
- if (node.tag) {
- return ["tag"];
- }
-
- if (node.argument) {
- return ["argument"];
- }
-
- if (node.expression) {
- return ["expression"];
- }
-
- throw new Error("Unexpected node has no left side", node);
- }
-
- const exportDeclarationTypes = new Set(["ExportDefaultDeclaration", "ExportDefaultSpecifier", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration"]);
-
- function isExportDeclaration(node) {
- return node && exportDeclarationTypes.has(node.type);
- }
-
- function getParentExportDeclaration(path) {
- const parentNode = path.getParentNode();
-
- if (path.getName() === "declaration" && isExportDeclaration(parentNode)) {
- return parentNode;
- }
-
- return null;
- }
-
- function isLiteral(node) {
- 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";
- }
-
- function isNumericLiteral(node) {
- return node.type === "NumericLiteral" || node.type === "Literal" && typeof node.value === "number";
- }
-
- function isStringLiteral(node) {
- return node.type === "StringLiteral" || node.type === "Literal" && typeof node.value === "string";
- }
-
- function isObjectType(n) {
- return n.type === "ObjectTypeAnnotation" || n.type === "TSTypeLiteral";
- }
-
- function isFunctionOrArrowExpression(node) {
- return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
- }
-
- function isFunctionOrArrowExpressionWithBody(node) {
- return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement";
- }
-
- function isTemplateLiteral(node) {
- return node.type === "TemplateLiteral";
- } // `inject` is used in AngularJS 1.x, `async` in Angular 2+
- // example: https://docs.angularjs.org/guide/unit-testing#using-beforeall-
-
-
- function isAngularTestWrapper(node) {
- return (node.type === "CallExpression" || node.type === "OptionalCallExpression") && node.callee.type === "Identifier" && (node.callee.name === "async" || node.callee.name === "inject" || node.callee.name === "fakeAsync");
- }
-
- function isJSXNode(node) {
- return node.type === "JSXElement" || node.type === "JSXFragment";
- }
-
- function isTheOnlyJSXElementInMarkdown(options, path) {
- if (options.parentParser !== "markdown" && options.parentParser !== "mdx") {
- return false;
- }
-
- const node = path.getNode();
-
- if (!node.expression || !isJSXNode(node.expression)) {
- return false;
- }
-
- const parent = path.getParentNode();
- return parent.type === "Program" && parent.body.length === 1;
- } // Detect an expression node representing `{" "}`
-
-
- function isJSXWhitespaceExpression(node) {
- return node.type === "JSXExpressionContainer" && isLiteral(node.expression) && node.expression.value === " " && !node.expression.comments;
- }
-
- function isMemberExpressionChain(node) {
- if (node.type !== "MemberExpression" && node.type !== "OptionalMemberExpression") {
- return false;
- }
-
- if (node.object.type === "Identifier") {
- return true;
- }
-
- return isMemberExpressionChain(node.object);
- }
-
- function isGetterOrSetter(node) {
- return node.kind === "get" || node.kind === "set";
- }
-
- function sameLocStart(nodeA, nodeB, options) {
- return options.locStart(nodeA) === options.locStart(nodeB);
- } // TODO: This is a bad hack and we need a better way to distinguish between
- // arrow functions and otherwise
-
-
- function isFunctionNotation(node, options) {
- return isGetterOrSetter(node) || sameLocStart(node, node.value, options);
- } // Hack to differentiate between the following two which have the same ast
- // type T = { method: () => void };
- // type T = { method(): void };
-
-
- function isObjectTypePropertyAFunction(node, options) {
- return (node.type === "ObjectTypeProperty" || node.type === "ObjectTypeInternalSlot") && node.value.type === "FunctionTypeAnnotation" && !node.static && !isFunctionNotation(node, options);
- } // Hack to differentiate between the following two which have the same ast
- // declare function f(a): void;
- // var f: (a) => void;
-
-
- function isTypeAnnotationAFunction(node, options) {
- return (node.type === "TypeAnnotation" || node.type === "TSTypeAnnotation") && node.typeAnnotation.type === "FunctionTypeAnnotation" && !node.static && !sameLocStart(node, node.typeAnnotation, options);
- }
-
- const binaryishNodeTypes = new Set(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]);
-
- function isBinaryish(node) {
- return binaryishNodeTypes.has(node.type);
- }
-
- function isMemberish(node) {
- return node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "BindExpression" && node.object;
- }
-
- function isSimpleFlowType(node) {
- const flowTypeAnnotations = ["AnyTypeAnnotation", "NullLiteralTypeAnnotation", "GenericTypeAnnotation", "ThisTypeAnnotation", "NumberTypeAnnotation", "VoidTypeAnnotation", "EmptyTypeAnnotation", "MixedTypeAnnotation", "BooleanTypeAnnotation", "BooleanLiteralTypeAnnotation", "StringTypeAnnotation"];
- return node && flowTypeAnnotations.includes(node.type) && !(node.type === "GenericTypeAnnotation" && node.typeParameters);
- }
-
- const unitTestRe = /^(skip|[fx]?(it|describe|test))$/;
-
- function isSkipOrOnlyBlock(node) {
- 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");
- }
-
- function isUnitTestSetUp(n) {
- const unitTestSetUpRe = /^(before|after)(Each|All)$/;
- return n.callee.type === "Identifier" && unitTestSetUpRe.test(n.callee.name) && n.arguments.length === 1;
- } // eg; `describe("some string", (done) => {})`
-
-
- function isTestCall(n, parent) {
- if (n.type !== "CallExpression") {
- return false;
- }
-
- if (n.arguments.length === 1) {
- if (isAngularTestWrapper(n) && parent && isTestCall(parent)) {
- return isFunctionOrArrowExpression(n.arguments[0]);
- }
-
- if (isUnitTestSetUp(n)) {
- return isAngularTestWrapper(n.arguments[0]);
- }
- } else if (n.arguments.length === 2 || n.arguments.length === 3) {
- if ((n.callee.type === "Identifier" && unitTestRe.test(n.callee.name) || isSkipOrOnlyBlock(n)) && (isTemplateLiteral(n.arguments[0]) || isStringLiteral(n.arguments[0]))) {
- // it("name", () => { ... }, 2500)
- if (n.arguments[2] && !isNumericLiteral(n.arguments[2])) {
- return false;
- }
-
- return (n.arguments.length === 2 ? isFunctionOrArrowExpression(n.arguments[1]) : isFunctionOrArrowExpressionWithBody(n.arguments[1]) && n.arguments[1].params.length <= 1) || isAngularTestWrapper(n.arguments[1]);
- }
- }
-
- return false;
- }
-
- function hasLeadingComment$2(node) {
- return node.comments && node.comments.some(comment => comment.leading);
- }
-
- function hasTrailingComment(node) {
- return node.comments && node.comments.some(comment => comment.trailing);
- }
-
- function isCallOrOptionalCallExpression(node) {
- return node.type === "CallExpression" || node.type === "OptionalCallExpression";
- }
-
- function hasDanglingComments(node) {
- return node.comments && node.comments.some(comment => !comment.leading && !comment.trailing);
- }
- /** identify if an angular expression seems to have side effects */
-
-
- function hasNgSideEffect(path) {
- return hasNode(path.getValue(), node => {
- switch (node.type) {
- case undefined:
- return false;
-
- case "CallExpression":
- case "OptionalCallExpression":
- case "AssignmentExpression":
- return true;
- }
- });
- }
-
- function isNgForOf(node, index, parentNode) {
- return node.type === "NGMicrosyntaxKeyedExpression" && node.key.name === "of" && index === 1 && parentNode.body[0].type === "NGMicrosyntaxLet" && parentNode.body[0].value === null;
- }
- /** @param node {import("estree").TemplateLiteral} */
-
-
- function isSimpleTemplateLiteral(node) {
- if (node.expressions.length === 0) {
- return false;
- }
-
- return node.expressions.every(expr => {
- // Disallow comments since printDocToString can't print them here
- if (expr.comments) {
- return false;
- } // Allow `x` and `this`
-
-
- if (expr.type === "Identifier" || expr.type === "ThisExpression") {
- return true;
- } // Allow `a.b.c`, `a.b[c]`, and `this.x.y`
-
-
- if (expr.type === "MemberExpression" || expr.type === "OptionalMemberExpression") {
- let head = expr;
-
- while (head.type === "MemberExpression" || head.type === "OptionalMemberExpression") {
- if (head.property.type !== "Identifier" && head.property.type !== "Literal" && head.property.type !== "StringLiteral" && head.property.type !== "NumericLiteral") {
- return false;
- }
-
- head = head.object;
-
- if (head.comments) {
- return false;
- }
- }
-
- if (head.type === "Identifier" || head.type === "ThisExpression") {
- return true;
- }
-
- return false;
- }
-
- return false;
- });
- }
-
- function getFlowVariance(path) {
- if (!path.variance) {
- return null;
- } // Babel 7.0 currently uses variance node type, and flow should
- // follow suit soon:
- // https://github.com/babel/babel/issues/4722
-
-
- const variance = path.variance.kind || path.variance;
-
- switch (variance) {
- case "plus":
- return "+";
-
- case "minus":
- return "-";
-
- default:
- /* istanbul ignore next */
- return variance;
- }
- }
-
- function classPropMayCauseASIProblems(path) {
- const node = path.getNode();
-
- if (node.type !== "ClassProperty") {
- return false;
- }
-
- const name = node.key && node.key.name; // this isn't actually possible yet with most parsers available today
- // so isn't properly tested yet.
-
- if ((name === "static" || name === "get" || name === "set") && !node.value && !node.typeAnnotation) {
- return true;
- }
- }
-
- function classChildNeedsASIProtection(node) {
- if (!node) {
- return;
- }
-
- if (node.static || node.accessibility // TypeScript
- ) {
- return false;
- }
-
- if (!node.computed) {
- const name = node.key && node.key.name;
-
- if (name === "in" || name === "instanceof") {
- return true;
- }
- }
-
- switch (node.type) {
- case "ClassProperty":
- case "TSAbstractClassProperty":
- return node.computed;
-
- case "MethodDefinition": // Flow
-
- case "TSAbstractMethodDefinition": // TypeScript
-
- case "ClassMethod":
- case "ClassPrivateMethod":
- {
- // Babel
- const isAsync = node.value ? node.value.async : node.async;
- const isGenerator = node.value ? node.value.generator : node.generator;
-
- if (isAsync || node.kind === "get" || node.kind === "set") {
- return false;
- }
-
- if (node.computed || isGenerator) {
- return true;
- }
-
- return false;
- }
-
- case "TSIndexSignature":
- return true;
-
- default:
- /* istanbul ignore next */
- return false;
- }
- }
-
- function getTypeScriptMappedTypeModifier(tokenNode, keyword) {
- if (tokenNode === "+") {
- return "+" + keyword;
- } else if (tokenNode === "-") {
- return "-" + keyword;
- }
-
- return keyword;
- }
-
- function hasNewlineBetweenOrAfterDecorators(node, options) {
- 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)));
- } // Only space, newline, carriage return, and tab are treated as whitespace
- // inside JSX.
-
-
- const jsxWhitespaceChars = " \n\r\t";
- const matchJsxWhitespaceRegex = new RegExp("([" + jsxWhitespaceChars + "]+)");
- const containsNonJsxWhitespaceRegex = new RegExp("[^" + jsxWhitespaceChars + "]"); // Meaningful if it contains non-whitespace characters,
- // or it contains whitespace without a new line.
-
- function isMeaningfulJSXText(node) {
- return isLiteral(node) && (containsNonJsxWhitespaceRegex.test(rawText(node)) || !/\n/.test(rawText(node)));
- }
-
- function hasJsxIgnoreComment(path) {
- const node = path.getValue();
- const parent = path.getParentNode();
-
- if (!parent || !node || !isJSXNode(node) || !isJSXNode(parent)) {
- return false;
- } // Lookup the previous sibling, ignoring any empty JSXText elements
-
-
- const index = parent.children.indexOf(node);
- let prevSibling = null;
-
- for (let i = index; i > 0; i--) {
- const candidate = parent.children[i - 1];
-
- if (candidate.type === "JSXText" && !isMeaningfulJSXText(candidate)) {
- continue;
- }
-
- prevSibling = candidate;
- break;
- }
-
- return prevSibling && prevSibling.type === "JSXExpressionContainer" && prevSibling.expression.type === "JSXEmptyExpression" && prevSibling.expression.comments && prevSibling.expression.comments.find(comment => comment.value.trim() === "prettier-ignore");
- }
-
- function isEmptyJSXElement(node) {
- if (node.children.length === 0) {
- return true;
- }
-
- if (node.children.length > 1) {
- return false;
- } // if there is one text child and does not contain any meaningful text
- // we can treat the element as empty.
-
-
- const child = node.children[0];
- return isLiteral(child) && !isMeaningfulJSXText(child);
- }
-
- function hasPrettierIgnore$4(path) {
- return hasIgnoreComment$3(path) || hasJsxIgnoreComment(path);
- }
-
- function isLastStatement(path) {
- const parent = path.getParentNode();
-
- if (!parent) {
- return true;
- }
-
- const node = path.getValue();
- const body = (parent.body || parent.consequent).filter(stmt => stmt.type !== "EmptyStatement");
- return body && body[body.length - 1] === node;
- }
-
- function isFlowAnnotationComment(text, typeAnnotation, options) {
- const start = options.locStart(typeAnnotation);
- const end = skipWhitespace$2(text, options.locEnd(typeAnnotation));
- return text.slice(start, start + 2) === "/*" && text.slice(end, end + 2) === "*/";
- }
-
- function hasLeadingOwnLineComment(text, node, options) {
- if (isJSXNode(node)) {
- return hasNodeIgnoreComment$1(node);
- }
-
- const res = node.comments && node.comments.some(comment => comment.leading && hasNewline$4(text, options.locEnd(comment)));
- return res;
- } // This recurses the return argument, looking for the first token
- // (the leftmost leaf node) and, if it (or its parents) has any
- // leadingComments, returns true (so it can be wrapped in parens).
-
-
- function returnArgumentHasLeadingComment(options, argument) {
- if (hasLeadingOwnLineComment(options.originalText, argument, options)) {
- return true;
- }
-
- if (hasNakedLeftSide(argument)) {
- let leftMost = argument;
- let newLeftMost;
-
- while (newLeftMost = getLeftSide(leftMost)) {
- leftMost = newLeftMost;
-
- if (hasLeadingOwnLineComment(options.originalText, leftMost, options)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- function isStringPropSafeToCoerceToIdentifier(node, options) {
- return isStringLiteral(node.key) && isIdentifierName(node.key.value) && options.parser !== "json" && // With `--strictPropertyInitialization`, TS treats properties with quoted names differently than unquoted ones.
- // See https://github.com/microsoft/TypeScript/pull/20075
- !((options.parser === "typescript" || options.parser === "babel-ts") && node.type === "ClassProperty");
- }
-
- function isJestEachTemplateLiteral(node, parentNode) {
- /**
- * describe.each`table`(name, fn)
- * describe.only.each`table`(name, fn)
- * describe.skip.each`table`(name, fn)
- * test.each`table`(name, fn)
- * test.only.each`table`(name, fn)
- * test.skip.each`table`(name, fn)
- *
- * Ref: https://github.com/facebook/jest/pull/6102
- */
- const jestEachTriggerRegex = /^[xf]?(describe|it|test)$/;
- 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));
- }
-
- function templateLiteralHasNewLines(template) {
- return template.quasis.some(quasi => quasi.value.raw.includes("\n"));
- }
-
- function isTemplateOnItsOwnLine(n, text, options) {
- return (n.type === "TemplateLiteral" && templateLiteralHasNewLines(n) || n.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(n.quasi)) && !hasNewline$4(text, options.locStart(n), {
- backwards: true
- });
- }
-
- function needsHardlineAfterDanglingComment(node) {
- if (!node.comments) {
- return false;
- }
-
- const lastDanglingComment = getLast$2(node.comments.filter(comment => !comment.leading && !comment.trailing));
- return lastDanglingComment && !comments$1.isBlockComment(lastDanglingComment);
- } // If we have nested conditional expressions, we want to print them in JSX mode
- // if there's at least one JSXElement somewhere in the tree.
- //
- // A conditional expression chain like this should be printed in normal mode,
- // because there aren't JSXElements anywhere in it:
- //
- // isA ? "A" : isB ? "B" : isC ? "C" : "Unknown";
- //
- // But a conditional expression chain like this should be printed in JSX mode,
- // because there is a JSXElement in the last ConditionalExpression:
- //
- // isA ? "A" : isB ? "B" : isC ? "C" : <span className="warning">Unknown</span>;
- //
- // This type of ConditionalExpression chain is structured like this in the AST:
- //
- // ConditionalExpression {
- // test: ...,
- // consequent: ...,
- // alternate: ConditionalExpression {
- // test: ...,
- // consequent: ...,
- // alternate: ConditionalExpression {
- // test: ...,
- // consequent: ...,
- // alternate: ...,
- // }
- // }
- // }
- //
- // We want to traverse over that shape and convert it into a flat structure so
- // that we can find if there's a JSXElement somewhere inside.
-
-
- function getConditionalChainContents(node) {
- // Given this code:
- //
- // // Using a ConditionalExpression as the consequent is uncommon, but should
- // // be handled.
- // A ? B : C ? D : E ? F ? G : H : I
- //
- // which has this AST:
- //
- // ConditionalExpression {
- // test: Identifier(A),
- // consequent: Identifier(B),
- // alternate: ConditionalExpression {
- // test: Identifier(C),
- // consequent: Identifier(D),
- // alternate: ConditionalExpression {
- // test: Identifier(E),
- // consequent: ConditionalExpression {
- // test: Identifier(F),
- // consequent: Identifier(G),
- // alternate: Identifier(H),
- // },
- // alternate: Identifier(I),
- // }
- // }
- // }
- //
- // we should return this Array:
- //
- // [
- // Identifier(A),
- // Identifier(B),
- // Identifier(C),
- // Identifier(D),
- // Identifier(E),
- // Identifier(F),
- // Identifier(G),
- // Identifier(H),
- // Identifier(I)
- // ];
- //
- // This loses the information about whether each node was the test,
- // consequent, or alternate, but we don't care about that here- we are only
- // flattening this structure to find if there's any JSXElements inside.
- const nonConditionalExpressions = [];
-
- function recurse(node) {
- if (node.type === "ConditionalExpression") {
- recurse(node.test);
- recurse(node.consequent);
- recurse(node.alternate);
- } else {
- nonConditionalExpressions.push(node);
- }
- }
-
- recurse(node);
- return nonConditionalExpressions;
- }
-
- function conditionalExpressionChainContainsJSX(node) {
- return Boolean(getConditionalChainContents(node).find(isJSXNode));
- } // Logic to check for args with multiple anonymous functions. For instance,
- // the following call should be split on multiple lines for readability:
- // source.pipe(map((x) => x + x), filter((x) => x % 2 === 0))
-
-
- function isFunctionCompositionArgs(args) {
- if (args.length <= 1) {
- return false;
- }
-
- let count = 0;
-
- for (const arg of args) {
- if (isFunctionOrArrowExpression(arg)) {
- count += 1;
-
- if (count > 1) {
- return true;
- }
- } else if (isCallOrOptionalCallExpression(arg)) {
- for (const childArg of arg.arguments) {
- if (isFunctionOrArrowExpression(childArg)) {
- return true;
- }
- }
- }
- }
-
- return false;
- } // Logic to determine if a call is a “long curried function call”.
- // See https://github.com/prettier/prettier/issues/1420.
- //
- // `connect(a, b, c)(d)`
- // In the above call expression, the second call is the parent node and the
- // first call is the current node.
-
-
- function isLongCurriedCallExpression(path) {
- const node = path.getValue();
- const parent = path.getParentNode();
- return isCallOrOptionalCallExpression(node) && isCallOrOptionalCallExpression(parent) && parent.callee === node && node.arguments.length > parent.arguments.length && parent.arguments.length > 0;
- }
- /**
- * @param {import('estree').Node} node
- * @param {number} depth
- * @returns {boolean}
- */
-
-
- function isSimpleCallArgument(node, depth) {
- if (depth >= 2) {
- return false;
- }
-
- const isChildSimple = child => isSimpleCallArgument(child, depth + 1);
-
- const regexpPattern = node.type === "Literal" && node.regex && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
-
- if (regexpPattern && regexpPattern.length > 5) {
- return false;
- }
-
- 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") {
- return true;
- }
-
- if (node.type === "TemplateLiteral") {
- return node.expressions.every(isChildSimple);
- }
-
- if (node.type === "ObjectExpression") {
- return node.properties.every(p => !p.computed && (p.shorthand || p.value && isChildSimple(p.value)));
- }
-
- if (node.type === "ArrayExpression") {
- return node.elements.every(x => x == null || isChildSimple(x));
- }
-
- if (node.type === "CallExpression" || node.type === "OptionalCallExpression" || node.type === "NewExpression") {
- return isSimpleCallArgument(node.callee, depth) && node.arguments.every(isChildSimple);
- }
-
- if (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") {
- return isSimpleCallArgument(node.object, depth) && isSimpleCallArgument(node.property, depth);
- }
-
- if (node.type === "UnaryExpression" && (node.operator === "!" || node.operator === "-")) {
- return isSimpleCallArgument(node.argument, depth);
- }
-
- if (node.type === "TSNonNullExpression") {
- return isSimpleCallArgument(node.expression, depth);
- }
-
- return false;
- }
-
- function rawText(node) {
- return node.extra ? node.extra.raw : node.raw;
- }
-
- function identity$1(x) {
- return x;
- }
-
- function isTSXFile(options) {
- return options.filepath && /\.tsx$/i.test(options.filepath);
- }
-
- var utils$5 = {
- classChildNeedsASIProtection,
- classPropMayCauseASIProblems,
- conditionalExpressionChainContainsJSX,
- getFlowVariance,
- getLeftSidePathName,
- getParentExportDeclaration,
- getTypeScriptMappedTypeModifier,
- hasDanglingComments,
- hasFlowAnnotationComment,
- hasFlowShorthandAnnotationComment,
- hasLeadingComment: hasLeadingComment$2,
- hasLeadingOwnLineComment,
- hasNakedLeftSide,
- hasNewlineBetweenOrAfterDecorators,
- hasNgSideEffect,
- hasNode,
- hasPrettierIgnore: hasPrettierIgnore$4,
- hasTrailingComment,
- identity: identity$1,
- isBinaryish,
- isCallOrOptionalCallExpression,
- isEmptyJSXElement,
- isExportDeclaration,
- isFlowAnnotationComment,
- isFunctionCompositionArgs,
- isFunctionNotation,
- isFunctionOrArrowExpression,
- isGetterOrSetter,
- isJestEachTemplateLiteral,
- isJSXNode,
- isJSXWhitespaceExpression,
- isLastStatement,
- isLiteral,
- isLongCurriedCallExpression,
- isSimpleCallArgument,
- isMeaningfulJSXText,
- isMemberExpressionChain,
- isMemberish,
- isNgForOf,
- isNumericLiteral,
- isObjectType,
- isObjectTypePropertyAFunction,
- isSimpleFlowType,
- isSimpleTemplateLiteral,
- isStringLiteral,
- isStringPropSafeToCoerceToIdentifier,
- isTemplateOnItsOwnLine,
- isTestCall,
- isTheOnlyJSXElementInMarkdown,
- isTSXFile,
- isTypeAnnotationAFunction,
- matchJsxWhitespaceRegex,
- needsHardlineAfterDanglingComment,
- rawText,
- returnArgumentHasLeadingComment
- };
-
- const {
- getLeftSidePathName: getLeftSidePathName$1,
- hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$1,
- hasNakedLeftSide: hasNakedLeftSide$1,
- hasNode: hasNode$1
- } = utils$5;
-
- function needsParens(path, options) {
- const parent = path.getParentNode();
-
- if (!parent) {
- return false;
- }
-
- const name = path.getName();
- const node = path.getNode(); // If the value of this path is some child of a Node and not a Node
- // itself, then it doesn't need parentheses. Only Node objects (in
- // fact, only Expression nodes) need parentheses.
-
- if (path.getValue() !== node) {
- return false;
- } // to avoid unexpected `}}` in HTML interpolations
-
-
- if (options.__isInHtmlInterpolation && !options.bracketSpacing && endsWithRightBracket(node) && isFollowedByRightBracket(path)) {
- return true;
- } // Only statements don't need parentheses.
-
-
- if (isStatement(node)) {
- return false;
- }
-
- if ( // Preserve parens if we have a Flow annotation comment, unless we're using the Flow
- // parser. The Flow parser turns Flow comments into type annotation nodes in its
- // AST, which we handle separately.
- options.parser !== "flow" && hasFlowShorthandAnnotationComment$1(path.getValue())) {
- return true;
- } // Identifiers never need parentheses.
-
-
- if (node.type === "Identifier") {
- // ...unless those identifiers are embed placeholders. They might be substituted by complex
- // expressions, so the parens around them should not be dropped. Example (JS-in-HTML-in-JS):
- // let tpl = html`<script> f((${expr}) / 2); </script>`;
- // If the inner JS formatter removes the parens, the expression might change its meaning:
- // f((a + b) / 2) vs f(a + b / 2)
- if (node.extra && node.extra.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(node.name)) {
- return true;
- }
-
- return false;
- }
-
- if (parent.type === "ParenthesizedExpression") {
- return false;
- } // Add parens around the extends clause of a class. It is needed for almost
- // all expressions.
-
-
- 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")) {
- return true;
- }
-
- if (parent.type === "ExportDefaultDeclaration") {
- return (// `export default function` or `export default class` can't be followed by
- // anything after. So an expression like `export default (function(){}).toString()`
- // needs to be followed by a parentheses
- shouldWrapFunctionForExportDefault(path, options) || // `export default (foo, bar)` also needs parentheses
- node.type === "SequenceExpression"
- );
- }
-
- if (parent.type === "Decorator" && parent.expression === node) {
- let hasCallExpression = false;
- let hasMemberExpression = false;
- let current = node;
-
- while (current) {
- switch (current.type) {
- case "MemberExpression":
- hasMemberExpression = true;
- current = current.object;
- break;
-
- case "CallExpression":
- if (
- /** @(x().y) */
- hasMemberExpression ||
- /** @(x().y()) */
- hasCallExpression) {
- return true;
- }
-
- hasCallExpression = true;
- current = current.callee;
- break;
-
- case "Identifier":
- return false;
-
- default:
- return true;
- }
- }
-
- return true;
- }
-
- if (parent.type === "ArrowFunctionExpression" && parent.body === node && node.type !== "SequenceExpression" && // these have parens added anyway
- util$1.startsWithNoLookaheadToken(node,
- /* forbidFunctionClassAndDoExpr */
- false) || parent.type === "ExpressionStatement" && util$1.startsWithNoLookaheadToken(node,
- /* forbidFunctionClassAndDoExpr */
- true)) {
- return true;
- }
-
- switch (node.type) {
- case "SpreadElement":
- case "SpreadProperty":
- return parent.type === "MemberExpression" && name === "object" && parent.object === node;
-
- case "UpdateExpression":
- if (parent.type === "UnaryExpression") {
- return node.prefix && (node.operator === "++" && parent.operator === "+" || node.operator === "--" && parent.operator === "-");
- }
-
- // else fallthrough
-
- case "UnaryExpression":
- switch (parent.type) {
- case "UnaryExpression":
- return node.operator === parent.operator && (node.operator === "+" || node.operator === "-");
-
- case "BindExpression":
- return true;
-
- case "MemberExpression":
- case "OptionalMemberExpression":
- return name === "object";
-
- case "TaggedTemplateExpression":
- return true;
-
- case "NewExpression":
- case "CallExpression":
- case "OptionalCallExpression":
- return name === "callee";
-
- case "BinaryExpression":
- return parent.operator === "**" && name === "left";
-
- case "TSNonNullExpression":
- return true;
-
- default:
- return false;
- }
-
- case "BinaryExpression":
- {
- if (parent.type === "UpdateExpression") {
- return true;
- }
-
- const isLeftOfAForStatement = node => {
- let i = 0;
-
- while (node) {
- const parent = path.getParentNode(i++);
-
- if (!parent) {
- return false;
- }
-
- if (parent.type === "ForStatement" && parent.init === node) {
- return true;
- }
-
- node = parent;
- }
-
- return false;
- };
-
- if (node.operator === "in" && isLeftOfAForStatement(node)) {
- return true;
- }
- }
- // fallthrough
-
- case "TSTypeAssertion":
- case "TSAsExpression":
- case "LogicalExpression":
- switch (parent.type) {
- case "ConditionalExpression":
- return node.type === "TSAsExpression";
-
- case "CallExpression":
- case "NewExpression":
- case "OptionalCallExpression":
- return name === "callee";
-
- case "ClassExpression":
- case "ClassDeclaration":
- return name === "superClass" && parent.superClass === node;
-
- case "TSTypeAssertion":
- case "TaggedTemplateExpression":
- case "UnaryExpression":
- case "JSXSpreadAttribute":
- case "SpreadElement":
- case "SpreadProperty":
- case "BindExpression":
- case "AwaitExpression":
- case "TSAsExpression":
- case "TSNonNullExpression":
- case "UpdateExpression":
- return true;
-
- case "MemberExpression":
- case "OptionalMemberExpression":
- return name === "object";
-
- case "AssignmentExpression":
- return parent.left === node && (node.type === "TSTypeAssertion" || node.type === "TSAsExpression");
-
- case "LogicalExpression":
- if (node.type === "LogicalExpression") {
- return parent.operator !== node.operator;
- }
-
- // else fallthrough
-
- case "BinaryExpression":
- {
- if (!node.operator && node.type !== "TSTypeAssertion") {
- return true;
- }
-
- const po = parent.operator;
- const pp = util$1.getPrecedence(po);
- const no = node.operator;
- const np = util$1.getPrecedence(no);
-
- if (pp > np) {
- return true;
- }
-
- if (pp === np && name === "right") {
- assert.strictEqual(parent.right, node);
- return true;
- }
-
- if (pp === np && !util$1.shouldFlatten(po, no)) {
- return true;
- }
-
- if (pp < np && no === "%") {
- return po === "+" || po === "-";
- } // Add parenthesis when working with bitwise operators
- // It's not strictly needed but helps with code understanding
-
-
- if (util$1.isBitwiseOperator(po)) {
- return true;
- }
-
- return false;
- }
-
- default:
- return false;
- }
-
- case "SequenceExpression":
- switch (parent.type) {
- case "ReturnStatement":
- return false;
-
- case "ForStatement":
- // Although parentheses wouldn't hurt around sequence
- // expressions in the head of for loops, traditional style
- // dictates that e.g. i++, j++ should not be wrapped with
- // parentheses.
- return false;
-
- case "ExpressionStatement":
- return name !== "expression";
-
- case "ArrowFunctionExpression":
- // We do need parentheses, but SequenceExpressions are handled
- // specially when printing bodies of arrow functions.
- return name !== "body";
-
- default:
- // Otherwise err on the side of overparenthesization, adding
- // explicit exceptions above if this proves overzealous.
- return true;
- }
-
- case "YieldExpression":
- if (parent.type === "UnaryExpression" || parent.type === "AwaitExpression" || parent.type === "TSAsExpression" || parent.type === "TSNonNullExpression") {
- return true;
- }
-
- // else fallthrough
-
- case "AwaitExpression":
- switch (parent.type) {
- case "TaggedTemplateExpression":
- case "UnaryExpression":
- case "BinaryExpression":
- case "LogicalExpression":
- case "SpreadElement":
- case "SpreadProperty":
- case "TSAsExpression":
- case "TSNonNullExpression":
- case "BindExpression":
- return true;
-
- case "MemberExpression":
- case "OptionalMemberExpression":
- return name === "object";
-
- case "NewExpression":
- case "CallExpression":
- case "OptionalCallExpression":
- return name === "callee";
-
- case "ConditionalExpression":
- return parent.test === node;
-
- default:
- return false;
- }
-
- case "TSJSDocFunctionType":
- case "TSConditionalType":
- if (parent.type === "TSConditionalType" && node === parent.extendsType) {
- return true;
- }
-
- // fallthrough
-
- case "TSFunctionType":
- case "TSConstructorType":
- if (parent.type === "TSConditionalType" && node === parent.checkType) {
- return true;
- }
-
- // fallthrough
-
- case "TSUnionType":
- case "TSIntersectionType":
- if (parent.type === "TSUnionType" || parent.type === "TSIntersectionType") {
- return true;
- }
-
- // fallthrough
-
- case "TSTypeOperator":
- case "TSInferType":
- 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);
-
- case "ArrayTypeAnnotation":
- return parent.type === "NullableTypeAnnotation";
-
- case "IntersectionTypeAnnotation":
- case "UnionTypeAnnotation":
- return parent.type === "ArrayTypeAnnotation" || parent.type === "NullableTypeAnnotation" || parent.type === "IntersectionTypeAnnotation" || parent.type === "UnionTypeAnnotation";
-
- case "NullableTypeAnnotation":
- return parent.type === "ArrayTypeAnnotation";
-
- case "FunctionTypeAnnotation":
- {
- const ancestor = parent.type === "NullableTypeAnnotation" ? path.getParentNode(1) : parent;
- return ancestor.type === "UnionTypeAnnotation" || ancestor.type === "IntersectionTypeAnnotation" || ancestor.type === "ArrayTypeAnnotation" || // We should check ancestor's parent to know whether the parentheses
- // are really needed, but since ??T doesn't make sense this check
- // will almost never be true.
- ancestor.type === "NullableTypeAnnotation";
- }
-
- case "StringLiteral":
- case "NumericLiteral":
- case "Literal":
- if (typeof node.value === "string" && parent.type === "ExpressionStatement" && ( // TypeScript workaround for https://github.com/JamesHenry/typescript-estree/issues/2
- // See corresponding workaround in printer.js case: "Literal"
- options.parser !== "typescript" && !parent.directive || options.parser === "typescript" && options.originalText.charAt(options.locStart(node) - 1) === "(")) {
- // To avoid becoming a directive
- const grandParent = path.getParentNode(1);
- return grandParent.type === "Program" || grandParent.type === "BlockStatement";
- }
-
- return parent.type === "MemberExpression" && typeof node.value === "number" && name === "object" && parent.object === node;
-
- case "AssignmentExpression":
- {
- const grandParent = path.getParentNode(1);
-
- if (parent.type === "ArrowFunctionExpression" && parent.body === node) {
- return true;
- } else if (parent.type === "ClassProperty" && parent.key === node && parent.computed) {
- return false;
- } else if (parent.type === "TSPropertySignature" && parent.name === node) {
- return false;
- } else if (parent.type === "ForStatement" && (parent.init === node || parent.update === node)) {
- return false;
- } else if (parent.type === "ExpressionStatement") {
- return node.left.type === "ObjectPattern";
- } else if (parent.type === "TSPropertySignature" && parent.key === node) {
- return false;
- } else if (parent.type === "AssignmentExpression") {
- return false;
- } else if (parent.type === "SequenceExpression" && grandParent && grandParent.type === "ForStatement" && (grandParent.init === parent || grandParent.update === parent)) {
- return false;
- } else if (parent.type === "Property" && parent.value === node) {
- return false;
- } else if (parent.type === "NGChainedExpression") {
- return false;
- }
-
- return true;
- }
-
- case "ConditionalExpression":
- switch (parent.type) {
- case "TaggedTemplateExpression":
- case "UnaryExpression":
- case "SpreadElement":
- case "SpreadProperty":
- case "BinaryExpression":
- case "LogicalExpression":
- case "NGPipeExpression":
- case "ExportDefaultDeclaration":
- case "AwaitExpression":
- case "JSXSpreadAttribute":
- case "TSTypeAssertion":
- case "TypeCastExpression":
- case "TSAsExpression":
- case "TSNonNullExpression":
- return true;
-
- case "NewExpression":
- case "CallExpression":
- case "OptionalCallExpression":
- return name === "callee";
-
- case "ConditionalExpression":
- return name === "test" && parent.test === node;
-
- case "MemberExpression":
- case "OptionalMemberExpression":
- return name === "object";
-
- default:
- return false;
- }
-
- case "FunctionExpression":
- switch (parent.type) {
- case "NewExpression":
- case "CallExpression":
- case "OptionalCallExpression":
- // Not always necessary, but it's clearer to the reader if IIFEs are wrapped in parentheses.
- // Is necessary if it is `expression` of `ExpressionStatement`.
- return name === "callee";
-
- case "TaggedTemplateExpression":
- return true;
- // This is basically a kind of IIFE.
-
- default:
- return false;
- }
-
- case "ArrowFunctionExpression":
- switch (parent.type) {
- case "NewExpression":
- case "CallExpression":
- case "OptionalCallExpression":
- return name === "callee";
-
- case "MemberExpression":
- case "OptionalMemberExpression":
- return name === "object";
-
- case "TSAsExpression":
- case "BindExpression":
- case "TaggedTemplateExpression":
- case "UnaryExpression":
- case "LogicalExpression":
- case "BinaryExpression":
- case "AwaitExpression":
- case "TSTypeAssertion":
- return true;
-
- case "ConditionalExpression":
- return name === "test";
-
- default:
- return false;
- }
-
- case "ClassExpression":
- switch (parent.type) {
- case "NewExpression":
- return name === "callee" && parent.callee === node;
-
- default:
- return false;
- }
-
- case "OptionalMemberExpression":
- case "OptionalCallExpression":
- if (parent.type === "MemberExpression" && name === "object" || (parent.type === "CallExpression" || parent.type === "NewExpression") && name === "callee") {
- return true;
- }
-
- // fallthrough
-
- case "CallExpression":
- case "MemberExpression":
- case "TaggedTemplateExpression":
- case "TSNonNullExpression":
- if ((parent.type === "BindExpression" || parent.type === "NewExpression") && name === "callee") {
- let object = node;
-
- while (object) {
- switch (object.type) {
- case "CallExpression":
- case "OptionalCallExpression":
- return true;
-
- case "MemberExpression":
- case "OptionalMemberExpression":
- case "BindExpression":
- object = object.object;
- break;
- // tagged templates are basically member expressions from a grammar perspective
- // see https://tc39.github.io/ecma262/#prod-MemberExpression
-
- case "TaggedTemplateExpression":
- object = object.tag;
- break;
-
- case "TSNonNullExpression":
- object = object.expression;
- break;
-
- default:
- return false;
- }
- }
- }
-
- return false;
-
- case "BindExpression":
- return (parent.type === "BindExpression" || parent.type === "NewExpression") && name === "callee" || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && name === "object";
-
- case "NGPipeExpression":
- 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") {
- return false;
- }
-
- return true;
-
- case "JSXFragment":
- case "JSXElement":
- 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";
-
- case "TypeAnnotation":
- return name === "returnType" && parent.type === "ArrowFunctionExpression" && includesFunctionTypeInObjectType(node);
- }
-
- return false;
- }
-
- function isStatement(node) {
- 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";
- }
-
- function includesFunctionTypeInObjectType(node) {
- return hasNode$1(node, n1 => n1.type === "ObjectTypeAnnotation" && hasNode$1(n1, n2 => n2.type === "FunctionTypeAnnotation" || undefined) || undefined);
- }
-
- function endsWithRightBracket(node) {
- switch (node.type) {
- case "ObjectExpression":
- return true;
-
- default:
- return false;
- }
- }
-
- function isFollowedByRightBracket(path) {
- const node = path.getValue();
- const parent = path.getParentNode();
- const name = path.getName();
-
- switch (parent.type) {
- case "NGPipeExpression":
- if (typeof name === "number" && parent.arguments[name] === node && parent.arguments.length - 1 === name) {
- return path.callParent(isFollowedByRightBracket);
- }
-
- break;
-
- case "ObjectProperty":
- if (name === "value") {
- const parentParent = path.getParentNode(1);
- return parentParent.properties[parentParent.properties.length - 1] === parent;
- }
-
- break;
-
- case "BinaryExpression":
- case "LogicalExpression":
- if (name === "right") {
- return path.callParent(isFollowedByRightBracket);
- }
-
- break;
-
- case "ConditionalExpression":
- if (name === "alternate") {
- return path.callParent(isFollowedByRightBracket);
- }
-
- break;
-
- case "UnaryExpression":
- if (parent.prefix) {
- return path.callParent(isFollowedByRightBracket);
- }
-
- break;
- }
-
- return false;
- }
-
- function shouldWrapFunctionForExportDefault(path, options) {
- const node = path.getValue();
- const parent = path.getParentNode();
-
- if (node.type === "FunctionExpression" || node.type === "ClassExpression") {
- return parent.type === "ExportDefaultDeclaration" || // in some cases the function is already wrapped
- // (e.g. `export default (function() {})();`)
- // in this case we don't need to add extra parens
- !needsParens(path, options);
- }
-
- if (!hasNakedLeftSide$1(node) || parent.type !== "ExportDefaultDeclaration" && needsParens(path, options)) {
- return false;
- }
-
- return path.call(childPath => shouldWrapFunctionForExportDefault(childPath, options), ...getLeftSidePathName$1(path, node));
- }
-
- var needsParens_1 = needsParens;
-
- const {
- builders: {
- concat: concat$c,
- join: join$8,
- line: line$8
- }
- } = document;
-
- function printHtmlBinding(path, options, print) {
- const node = path.getValue();
-
- if (options.__onHtmlBindingRoot && path.getName() === null) {
- options.__onHtmlBindingRoot(node, options);
- }
-
- if (node.type !== "File") {
- return;
- }
-
- if (options.__isVueForBindingLeft) {
- return path.call(functionDeclarationPath => {
- const {
- params
- } = functionDeclarationPath.getValue();
- return concat$c([params.length > 1 ? "(" : "", join$8(concat$c([",", line$8]), functionDeclarationPath.map(print, "params")), params.length > 1 ? ")" : ""]);
- }, "program", "body", 0);
- }
-
- if (options.__isVueSlotScope) {
- return path.call(functionDeclarationPath => join$8(concat$c([",", line$8]), functionDeclarationPath.map(print, "params")), "program", "body", 0);
- }
- } // based on https://github.com/prettier/prettier/blob/master/src/language-html/syntax-vue.js isVueEventBindingExpression()
-
-
- function isVueEventBindingExpression$2(node) {
- switch (node.type) {
- case "MemberExpression":
- switch (node.property.type) {
- case "Identifier":
- case "NumericLiteral":
- case "StringLiteral":
- return isVueEventBindingExpression$2(node.object);
- }
-
- return false;
-
- case "Identifier":
- return true;
-
- default:
- return false;
- }
- }
-
- var htmlBinding = {
- isVueEventBindingExpression: isVueEventBindingExpression$2,
- printHtmlBinding
- };
-
- function preprocess$1(ast, options) {
- switch (options.parser) {
- case "json":
- case "json5":
- case "json-stringify":
- case "__js_expression":
- case "__vue_expression":
- return Object.assign({}, ast, {
- type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
- node: ast,
- comments: [],
- rootMarker: options.rootMarker
- });
-
- default:
- return ast;
- }
- }
-
- var preprocess_1$1 = preprocess$1;
-
- const {
- shouldFlatten: shouldFlatten$1,
- getNextNonSpaceNonCommentCharacter: getNextNonSpaceNonCommentCharacter$1,
- hasNewline: hasNewline$5,
- hasNewlineInRange: hasNewlineInRange$3,
- getLast: getLast$3,
- getStringWidth: getStringWidth$3,
- printString: printString$2,
- printNumber: printNumber$2,
- hasIgnoreComment: hasIgnoreComment$4,
- hasNodeIgnoreComment: hasNodeIgnoreComment$2,
- getPenultimate: getPenultimate$1,
- startsWithNoLookaheadToken: startsWithNoLookaheadToken$1,
- getIndentSize: getIndentSize$2,
- getPreferredQuote: getPreferredQuote$1
- } = util$1;
- const {
- isNextLineEmpty: isNextLineEmpty$4,
- isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$2,
- getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$3
- } = utilShared;
- const {
- insertPragma: insertPragma$7
- } = pragma;
- const {
- printHtmlBinding: printHtmlBinding$1,
- isVueEventBindingExpression: isVueEventBindingExpression$3
- } = htmlBinding;
- const {
- classChildNeedsASIProtection: classChildNeedsASIProtection$1,
- classPropMayCauseASIProblems: classPropMayCauseASIProblems$1,
- conditionalExpressionChainContainsJSX: conditionalExpressionChainContainsJSX$1,
- getFlowVariance: getFlowVariance$1,
- getLeftSidePathName: getLeftSidePathName$2,
- getParentExportDeclaration: getParentExportDeclaration$1,
- getTypeScriptMappedTypeModifier: getTypeScriptMappedTypeModifier$1,
- hasDanglingComments: hasDanglingComments$1,
- hasFlowAnnotationComment: hasFlowAnnotationComment$1,
- hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$2,
- hasLeadingComment: hasLeadingComment$3,
- hasLeadingOwnLineComment: hasLeadingOwnLineComment$1,
- hasNakedLeftSide: hasNakedLeftSide$2,
- hasNewlineBetweenOrAfterDecorators: hasNewlineBetweenOrAfterDecorators$1,
- hasNgSideEffect: hasNgSideEffect$1,
- hasPrettierIgnore: hasPrettierIgnore$5,
- hasTrailingComment: hasTrailingComment$1,
- identity: identity$2,
- isBinaryish: isBinaryish$1,
- isCallOrOptionalCallExpression: isCallOrOptionalCallExpression$1,
- isEmptyJSXElement: isEmptyJSXElement$1,
- isExportDeclaration: isExportDeclaration$1,
- isFlowAnnotationComment: isFlowAnnotationComment$1,
- isFunctionCompositionArgs: isFunctionCompositionArgs$1,
- isFunctionNotation: isFunctionNotation$1,
- isFunctionOrArrowExpression: isFunctionOrArrowExpression$1,
- isGetterOrSetter: isGetterOrSetter$1,
- isJestEachTemplateLiteral: isJestEachTemplateLiteral$1,
- isJSXNode: isJSXNode$1,
- isJSXWhitespaceExpression: isJSXWhitespaceExpression$1,
- isLastStatement: isLastStatement$1,
- isLiteral: isLiteral$1,
- isLongCurriedCallExpression: isLongCurriedCallExpression$1,
- isMeaningfulJSXText: isMeaningfulJSXText$1,
- isMemberExpressionChain: isMemberExpressionChain$1,
- isMemberish: isMemberish$1,
- isNgForOf: isNgForOf$1,
- isNumericLiteral: isNumericLiteral$1,
- isObjectType: isObjectType$1,
- isObjectTypePropertyAFunction: isObjectTypePropertyAFunction$1,
- isSimpleCallArgument: isSimpleCallArgument$1,
- isSimpleFlowType: isSimpleFlowType$1,
- isSimpleTemplateLiteral: isSimpleTemplateLiteral$1,
- isStringLiteral: isStringLiteral$1,
- isStringPropSafeToCoerceToIdentifier: isStringPropSafeToCoerceToIdentifier$1,
- isTemplateOnItsOwnLine: isTemplateOnItsOwnLine$1,
- isTestCall: isTestCall$1,
- isTheOnlyJSXElementInMarkdown: isTheOnlyJSXElementInMarkdown$1,
- isTSXFile: isTSXFile$1,
- isTypeAnnotationAFunction: isTypeAnnotationAFunction$1,
- matchJsxWhitespaceRegex: matchJsxWhitespaceRegex$1,
- needsHardlineAfterDanglingComment: needsHardlineAfterDanglingComment$1,
- rawText: rawText$1,
- returnArgumentHasLeadingComment: returnArgumentHasLeadingComment$1
- } = utils$5;
- const needsQuoteProps = new WeakMap();
- const {
- builders: {
- concat: concat$d,
- join: join$9,
- line: line$9,
- hardline: hardline$9,
- softline: softline$6,
- literalline: literalline$4,
- group: group$b,
- indent: indent$7,
- align: align$1,
- conditionalGroup: conditionalGroup$1,
- fill: fill$4,
- ifBreak: ifBreak$6,
- breakParent: breakParent$3,
- lineSuffixBoundary: lineSuffixBoundary$1,
- addAlignmentToDoc: addAlignmentToDoc$2,
- dedent: dedent$2
- },
- utils: {
- willBreak: willBreak$1,
- isLineNext: isLineNext$1,
- isEmpty: isEmpty$1,
- removeLines: removeLines$2
- },
- printer: {
- printDocToString: printDocToString$2
- }
- } = document;
- let uid = 0;
-
- function shouldPrintComma$1(options, level) {
- level = level || "es5";
-
- switch (options.trailingComma) {
- case "all":
- if (level === "all") {
- return true;
- }
-
- // fallthrough
-
- case "es5":
- if (level === "es5") {
- return true;
- }
-
- // fallthrough
-
- case "none":
- default:
- return false;
- }
- }
-
- function genericPrint$3(path, options, printPath, args) {
- const node = path.getValue();
- let needsParens = false;
- const linesWithoutParens = printPathNoParens(path, options, printPath, args);
-
- if (!node || isEmpty$1(linesWithoutParens)) {
- return linesWithoutParens;
- }
-
- const parentExportDecl = getParentExportDeclaration$1(path);
- const decorators = [];
-
- 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
- // was written before the export, the export will be responsible
- // for printing the decorators.
- !(parentExportDecl && options.locStart(parentExportDecl, {
- ignoreDecorators: true
- }) > options.locStart(node.decorators[0]))) {
- const shouldBreak = node.type === "ClassExpression" || node.type === "ClassDeclaration" || hasNewlineBetweenOrAfterDecorators$1(node, options);
- const separator = shouldBreak ? hardline$9 : line$9;
- path.each(decoratorPath => {
- let decorator = decoratorPath.getValue();
-
- if (decorator.expression) {
- decorator = decorator.expression;
- } else {
- decorator = decorator.callee;
- }
-
- decorators.push(printPath(decoratorPath), separator);
- }, "decorators");
-
- if (parentExportDecl) {
- decorators.unshift(hardline$9);
- }
- } 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,
- // otherwise they are printed by the node.declaration
- options.locStart(node, {
- ignoreDecorators: true
- }) > options.locStart(node.declaration.decorators[0])) {
- // Export declarations are responsible for printing any decorators
- // that logically apply to node.declaration.
- path.each(decoratorPath => {
- const decorator = decoratorPath.getValue();
- const prefix = decorator.type === "Decorator" ? "" : "@";
- decorators.push(prefix, printPath(decoratorPath), hardline$9);
- }, "declaration", "decorators");
- } else {
- // Nodes with decorators can't have parentheses, so we can avoid
- // computing pathNeedsParens() except in this case.
- needsParens = needsParens_1(path, options);
- }
-
- const parts = [];
-
- if (needsParens) {
- parts.unshift("(");
- }
-
- parts.push(linesWithoutParens);
-
- if (needsParens) {
- const node = path.getValue();
-
- if (hasFlowShorthandAnnotationComment$2(node)) {
- parts.push(" /*");
- parts.push(node.trailingComments[0].value.trimStart());
- parts.push("*/");
- node.trailingComments[0].printed = true;
- }
-
- parts.push(")");
- }
-
- if (decorators.length > 0) {
- return group$b(concat$d(decorators.concat(parts)));
- }
-
- return concat$d(parts);
- }
-
- function printDecorators(path, options, print) {
- const node = path.getValue();
- return group$b(concat$d([join$9(line$9, path.map(print, "decorators")), hasNewlineBetweenOrAfterDecorators$1(node, options) ? hardline$9 : line$9]));
- }
- /**
- * The following is the shared logic for
- * ternary operators, namely ConditionalExpression
- * and TSConditionalType
- * @typedef {Object} OperatorOptions
- * @property {() => Array<string | Doc>} beforeParts - Parts to print before the `?`.
- * @property {(breakClosingParen: boolean) => Array<string | Doc>} afterParts - Parts to print after the conditional expression.
- * @property {boolean} shouldCheckJsx - Whether to check for and print in JSX mode.
- * @property {string} conditionalNodeType - The type of the conditional expression node, ie "ConditionalExpression" or "TSConditionalType".
- * @property {string} consequentNodePropertyName - The property at which the consequent node can be found on the main node, eg "consequent".
- * @property {string} alternateNodePropertyName - The property at which the alternate node can be found on the main node, eg "alternate".
- * @property {string[]} testNodePropertyNames - The properties at which the test nodes can be found on the main node, eg "test".
- * @param {FastPath} path - The path to the ConditionalExpression/TSConditionalType node.
- * @param {Options} options - Prettier options
- * @param {Function} print - Print function to call recursively
- * @param {OperatorOptions} operatorOptions
- * @returns Doc
- */
-
-
- function printTernaryOperator(path, options, print, operatorOptions) {
- const node = path.getValue();
- const consequentNode = node[operatorOptions.consequentNodePropertyName];
- const alternateNode = node[operatorOptions.alternateNodePropertyName];
- const parts = []; // We print a ConditionalExpression in either "JSX mode" or "normal mode".
- // See tests/jsx/conditional-expression.js for more info.
-
- let jsxMode = false;
- const parent = path.getParentNode();
- const isParentTest = parent.type === operatorOptions.conditionalNodeType && operatorOptions.testNodePropertyNames.some(prop => parent[prop] === node);
- let forceNoIndent = parent.type === operatorOptions.conditionalNodeType && !isParentTest; // Find the outermost non-ConditionalExpression parent, and the outermost
- // ConditionalExpression parent. We'll use these to determine if we should
- // print in JSX mode.
-
- let currentParent;
- let previousParent;
- let i = 0;
-
- do {
- previousParent = currentParent || node;
- currentParent = path.getParentNode(i);
- i++;
- } while (currentParent && currentParent.type === operatorOptions.conditionalNodeType && operatorOptions.testNodePropertyNames.every(prop => currentParent[prop] !== previousParent));
-
- const firstNonConditionalParent = currentParent || parent;
- const lastConditionalParent = previousParent;
-
- if (operatorOptions.shouldCheckJsx && (isJSXNode$1(node[operatorOptions.testNodePropertyNames[0]]) || isJSXNode$1(consequentNode) || isJSXNode$1(alternateNode) || conditionalExpressionChainContainsJSX$1(lastConditionalParent))) {
- jsxMode = true;
- forceNoIndent = true; // Even though they don't need parens, we wrap (almost) everything in
- // parens when using ?: within JSX, because the parens are analogous to
- // curly braces in an if statement.
-
- 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:
- // * Nested conditional expressions in alternates
- // * null
- // * undefined
-
-
- const isNil = node => node.type === "NullLiteral" || node.type === "Literal" && node.value === null || node.type === "Identifier" && node.name === "undefined";
-
- 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)));
- } else {
- // normal mode
- 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))]);
- 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));
- } // We want a whole chain of ConditionalExpressions to all
- // break if any of them break. That means we should only group around the
- // outer-most ConditionalExpression.
-
-
- const maybeGroup = doc => parent === firstNonConditionalParent ? group$b(doc) : doc; // Break the closing paren to keep the chain right after it:
- // (a
- // ? b
- // : c
- // ).call()
-
-
- const breakClosingParen = !jsxMode && (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression" || parent.type === "NGPipeExpression" && parent.left === node) && !parent.computed;
- const result = maybeGroup(concat$d([].concat((testDoc =>
- /**
- * a
- * ? b
- * : multiline
- * test
- * node
- * ^^ align(2)
- * ? d
- * : e
- */
- 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))));
- return isParentTest ? group$b(concat$d([indent$7(concat$d([softline$6, result])), softline$6])) : result;
- }
-
- function printPathNoParens(path, options, print, args) {
- const n = path.getValue();
- const semi = options.semi ? ";" : "";
-
- if (!n) {
- return "";
- }
-
- if (typeof n === "string") {
- return n;
- }
-
- const htmlBinding = printHtmlBinding$1(path, options, print);
-
- if (htmlBinding) {
- return htmlBinding;
- }
-
- let parts = [];
-
- switch (n.type) {
- case "JsExpressionRoot":
- return path.call(print, "node");
-
- case "JsonRoot":
- return concat$d([path.call(print, "node"), hardline$9]);
-
- case "File":
- // Print @babel/parser's InterpreterDirective here so that
- // leading comments on the `Program` node get printed after the hashbang.
- if (n.program && n.program.interpreter) {
- parts.push(path.call(programPath => programPath.call(print, "interpreter"), "program"));
- }
-
- parts.push(path.call(print, "program"));
- return concat$d(parts);
-
- case "Program":
- // Babel 6
- if (n.directives) {
- path.each(childPath => {
- parts.push(print(childPath), semi, hardline$9);
-
- if (isNextLineEmpty$4(options.originalText, childPath.getValue(), options.locEnd)) {
- parts.push(hardline$9);
- }
- }, "directives");
- }
-
- parts.push(path.call(bodyPath => {
- return printStatementSequence(bodyPath, options, print);
- }, "body"));
- parts.push(comments.printDanglingComments(path, options,
- /* sameIndent */
- true)); // Only force a trailing newline if there were any contents.
-
- if (!n.body.every(({
- type
- }) => type === "EmptyStatement") || n.comments) {
- parts.push(hardline$9);
- }
-
- return concat$d(parts);
- // Babel extension.
-
- case "EmptyStatement":
- return "";
-
- case "ExpressionStatement":
- // Detect Flow-parsed directives
- if (n.directive) {
- return concat$d([nodeStr(n.expression, options, true), semi]);
- }
-
- if (options.parser === "__vue_event_binding") {
- const parent = path.getParentNode();
-
- if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === n) {
- return concat$d([path.call(print, "expression"), isVueEventBindingExpression$3(n.expression) ? ";" : ""]);
- }
- } // Do not append semicolon after the only JSX element in a program
-
-
- return concat$d([path.call(print, "expression"), isTheOnlyJSXElementInMarkdown$1(options, path) ? "" : semi]);
- // Babel non-standard node. Used for Closure-style type casts. See postprocess.js.
-
- case "ParenthesizedExpression":
- {
- const shouldHug = !n.expression.comments;
-
- if (shouldHug) {
- return concat$d(["(", path.call(print, "expression"), ")"]);
- }
-
- return group$b(concat$d(["(", indent$7(concat$d([softline$6, path.call(print, "expression")])), softline$6, ")"]));
- }
-
- case "AssignmentExpression":
- return printAssignment(n.left, path.call(print, "left"), concat$d([" ", n.operator]), n.right, path.call(print, "right"), options);
-
- case "BinaryExpression":
- case "LogicalExpression":
- case "NGPipeExpression":
- {
- const parent = path.getParentNode();
- const parentParent = path.getParentNode(1);
- const isInsideParenthesis = n !== parent.body && (parent.type === "IfStatement" || parent.type === "WhileStatement" || parent.type === "SwitchStatement" || parent.type === "DoWhileStatement");
- const parts = printBinaryishExpressions(path, print, options,
- /* isNested */
- false, isInsideParenthesis); // if (
- // this.hasPlugin("dynamicImports") && this.lookahead().type === tt.parenLeft
- // ) {
- //
- // looks super weird, we want to break the children if the parent breaks
- //
- // if (
- // this.hasPlugin("dynamicImports") &&
- // this.lookahead().type === tt.parenLeft
- // ) {
-
- if (isInsideParenthesis) {
- return concat$d(parts);
- } // Break between the parens in
- // unaries or in a member or specific call expression, i.e.
- //
- // (
- // a &&
- // b &&
- // c
- // ).call()
-
-
- if ((parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.callee === n || parent.type === "UnaryExpression" || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && !parent.computed) {
- return group$b(concat$d([indent$7(concat$d([softline$6, concat$d(parts)])), softline$6]));
- } // Avoid indenting sub-expressions in some cases where the first sub-expression is already
- // indented accordingly. We should indent sub-expressions where the first case isn't indented.
-
-
- 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";
- const shouldIndentIfInlining = parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator" || parent.type === "ClassProperty" || parent.type === "TSAbstractClassProperty" || parent.type === "ClassPrivateProperty" || parent.type === "ObjectProperty" || parent.type === "Property";
- const samePrecedenceSubExpression = isBinaryish$1(n.left) && shouldFlatten$1(n.operator, n.left.operator);
-
- if (shouldNotIndent || shouldInlineLogicalExpression(n) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression(n) && shouldIndentIfInlining) {
- return group$b(concat$d(parts));
- }
-
- if (parts.length === 0) {
- return "";
- } // If the right part is a JSX node, we include it in a separate group to
- // prevent it breaking the whole chain, so we can print the expression like:
- //
- // foo && bar && (
- // <Foo>
- // <Bar />
- // </Foo>
- // )
-
-
- const hasJSX = isJSXNode$1(n.right);
- const rest = concat$d(hasJSX ? parts.slice(1, -1) : parts.slice(1));
- const groupId = Symbol("logicalChain-" + ++uid);
- const chain = group$b(concat$d([// Don't include the initial expression in the indentation
- // level. The first item is guaranteed to be the first
- // left-most expression.
- parts.length > 0 ? parts[0] : "", indent$7(rest)]), {
- id: groupId
- });
-
- if (!hasJSX) {
- return chain;
- }
-
- const jsxPart = getLast$3(parts);
- return group$b(concat$d([chain, ifBreak$6(indent$7(jsxPart), jsxPart, {
- groupId
- })]));
- }
-
- case "AssignmentPattern":
- return concat$d([path.call(print, "left"), " = ", path.call(print, "right")]);
-
- case "TSTypeAssertion":
- {
- const shouldBreakAfterCast = !(n.expression.type === "ArrayExpression" || n.expression.type === "ObjectExpression");
- const castGroup = group$b(concat$d(["<", indent$7(concat$d([softline$6, path.call(print, "typeAnnotation")])), softline$6, ">"]));
- const exprContents = concat$d([ifBreak$6("("), indent$7(concat$d([softline$6, path.call(print, "expression")])), softline$6, ifBreak$6(")")]);
-
- if (shouldBreakAfterCast) {
- return conditionalGroup$1([concat$d([castGroup, path.call(print, "expression")]), concat$d([castGroup, group$b(exprContents, {
- shouldBreak: true
- })]), concat$d([castGroup, path.call(print, "expression")])]);
- }
-
- return group$b(concat$d([castGroup, path.call(print, "expression")]));
- }
-
- case "OptionalMemberExpression":
- case "MemberExpression":
- {
- const parent = path.getParentNode();
- let firstNonMemberParent;
- let i = 0;
-
- do {
- firstNonMemberParent = path.getParentNode(i);
- i++;
- } while (firstNonMemberParent && (firstNonMemberParent.type === "MemberExpression" || firstNonMemberParent.type === "OptionalMemberExpression" || firstNonMemberParent.type === "TSNonNullExpression"));
-
- 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";
- return concat$d([path.call(print, "object"), shouldInline ? printMemberLookup(path, options, print) : group$b(indent$7(concat$d([softline$6, printMemberLookup(path, options, print)])))]);
- }
-
- case "MetaProperty":
- return concat$d([path.call(print, "meta"), ".", path.call(print, "property")]);
-
- case "BindExpression":
- if (n.object) {
- parts.push(path.call(print, "object"));
- }
-
- parts.push(group$b(indent$7(concat$d([softline$6, printBindExpressionCallee(path, options, print)]))));
- return concat$d(parts);
-
- case "Identifier":
- {
- return concat$d([n.name, printOptionalToken(path), printTypeAnnotation(path, options, print)]);
- }
-
- case "V8IntrinsicIdentifier":
- return concat$d(["%", n.name]);
-
- case "SpreadElement":
- case "SpreadElementPattern":
- case "SpreadProperty":
- case "SpreadPropertyPattern":
- case "RestElement":
- case "ObjectTypeSpreadProperty":
- return concat$d(["...", path.call(print, "argument"), printTypeAnnotation(path, options, print)]);
-
- case "FunctionDeclaration":
- case "FunctionExpression":
- parts.push(printFunctionDeclaration(path, print, options));
-
- if (!n.body) {
- parts.push(semi);
- }
-
- return concat$d(parts);
-
- case "ArrowFunctionExpression":
- {
- if (n.async) {
- parts.push("async ");
- }
-
- if (shouldPrintParamsWithoutParens(path, options)) {
- parts.push(path.call(print, "params", 0));
- } else {
- parts.push(group$b(concat$d([printFunctionParams(path, print, options,
- /* expandLast */
- args && (args.expandLastArg || args.expandFirstArg),
- /* printTypeParams */
- true), printReturnType(path, print, options)])));
- }
-
- const dangling = comments.printDanglingComments(path, options,
- /* sameIndent */
- true, comment => {
- const nextCharacter = getNextNonSpaceNonCommentCharacterIndex$3(options.originalText, comment, options.locEnd);
- return options.originalText.slice(nextCharacter, nextCharacter + 2) === "=>";
- });
-
- if (dangling) {
- parts.push(" ", dangling);
- }
-
- parts.push(" =>");
- const body = path.call(bodyPath => print(bodyPath, args), "body"); // We want to always keep these types of nodes on the same line
- // as the arrow.
-
- 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")) {
- return group$b(concat$d([concat$d(parts), " ", body]));
- } // We handle sequence expressions as the body of arrows specially,
- // so that the required parentheses end up on their own lines.
-
-
- if (n.body.type === "SequenceExpression") {
- return group$b(concat$d([concat$d(parts), group$b(concat$d([" (", indent$7(concat$d([softline$6, body])), softline$6, ")"]))]));
- } // if the arrow function is expanded as last argument, we are adding a
- // level of indentation and need to add a softline to align the closing )
- // with the opening (, or if it's inside a JSXExpression (e.g. an attribute)
- // we should align the expression's closing } with the line with the opening {.
-
-
- const shouldAddSoftLine = (args && args.expandLastArg || path.getParentNode().type === "JSXExpressionContainer") && !(n.comments && n.comments.length);
- const printTrailingComma = args && args.expandLastArg && shouldPrintComma$1(options, "all"); // In order to avoid confusion between
- // a => a ? a : a
- // a <= a ? a : a
-
- const shouldAddParens = n.body.type === "ConditionalExpression" && !startsWithNoLookaheadToken$1(n.body,
- /* forbidFunctionAndClass */
- false);
- 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]) : ""]))]));
- }
-
- case "YieldExpression":
- parts.push("yield");
-
- if (n.delegate) {
- parts.push("*");
- }
-
- if (n.argument) {
- parts.push(" ", path.call(print, "argument"));
- }
-
- return concat$d(parts);
-
- case "AwaitExpression":
- {
- parts.push("await ", path.call(print, "argument"));
- const parent = path.getParentNode();
-
- if ((parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.callee === n || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && parent.object === n) {
- return group$b(concat$d([indent$7(concat$d([softline$6, concat$d(parts)])), softline$6]));
- }
-
- return concat$d(parts);
- }
-
- case "ImportSpecifier":
- if (n.importKind) {
- parts.push(path.call(print, "importKind"), " ");
- }
-
- parts.push(path.call(print, "imported"));
-
- if (n.local && n.local.name !== n.imported.name) {
- parts.push(" as ", path.call(print, "local"));
- }
-
- return concat$d(parts);
-
- case "ExportSpecifier":
- parts.push(path.call(print, "local"));
-
- if (n.exported && n.exported.name !== n.local.name) {
- parts.push(" as ", path.call(print, "exported"));
- }
-
- return concat$d(parts);
-
- case "ImportNamespaceSpecifier":
- parts.push("* as ");
- parts.push(path.call(print, "local"));
- return concat$d(parts);
-
- case "ImportDefaultSpecifier":
- return path.call(print, "local");
-
- case "TSExportAssignment":
- return concat$d(["export = ", path.call(print, "expression"), semi]);
-
- case "ExportDefaultDeclaration":
- case "ExportNamedDeclaration":
- return printExportDeclaration(path, options, print);
-
- case "ExportAllDeclaration":
- parts.push("export ");
-
- if (n.exportKind === "type") {
- parts.push("type ");
- }
-
- parts.push("* ");
-
- if (n.exported) {
- parts.push("as ", path.call(print, "exported"), " ");
- }
-
- parts.push("from ", path.call(print, "source"), semi);
- return concat$d(parts);
-
- case "ExportNamespaceSpecifier":
- case "ExportDefaultSpecifier":
- return path.call(print, "exported");
-
- case "ImportDeclaration":
- {
- parts.push("import ");
-
- if (n.importKind && n.importKind !== "value") {
- parts.push(n.importKind + " ");
- }
-
- const standalones = [];
- const grouped = [];
-
- if (n.specifiers && n.specifiers.length > 0) {
- path.each(specifierPath => {
- const value = specifierPath.getValue();
-
- if (value.type === "ImportDefaultSpecifier" || value.type === "ImportNamespaceSpecifier") {
- standalones.push(print(specifierPath));
- } else {
- grouped.push(print(specifierPath));
- }
- }, "specifiers");
-
- if (standalones.length > 0) {
- parts.push(join$9(", ", standalones));
- }
-
- if (standalones.length > 0 && grouped.length > 0) {
- parts.push(", ");
- }
-
- if (grouped.length === 1 && standalones.length === 0 && n.specifiers && !n.specifiers.some(node => node.comments)) {
- parts.push(concat$d(["{", options.bracketSpacing ? " " : "", concat$d(grouped), options.bracketSpacing ? " " : "", "}"]));
- } else if (grouped.length >= 1) {
- 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, "}"])));
- }
-
- parts.push(" from ");
- } else if (n.importKind && n.importKind === "type" || // import {} from 'x'
- /{\s*}/.test(options.originalText.slice(options.locStart(n), options.locStart(n.source)))) {
- parts.push("{} from ");
- }
-
- parts.push(path.call(print, "source"), semi);
- return concat$d(parts);
- }
-
- case "Import":
- return "import";
-
- case "TSModuleBlock":
- case "BlockStatement":
- {
- const naked = path.call(bodyPath => {
- return printStatementSequence(bodyPath, options, print);
- }, "body");
- const hasContent = n.body.find(node => node.type !== "EmptyStatement");
- const hasDirectives = n.directives && n.directives.length > 0;
- const parent = path.getParentNode();
- const parentParent = path.getParentNode(1);
-
- 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")) {
- return "{}";
- }
-
- parts.push("{"); // Babel 6
-
- if (hasDirectives) {
- path.each(childPath => {
- parts.push(indent$7(concat$d([hardline$9, print(childPath), semi])));
-
- if (isNextLineEmpty$4(options.originalText, childPath.getValue(), options.locEnd)) {
- parts.push(hardline$9);
- }
- }, "directives");
- }
-
- if (hasContent) {
- parts.push(indent$7(concat$d([hardline$9, naked])));
- }
-
- parts.push(comments.printDanglingComments(path, options));
- parts.push(hardline$9, "}");
- return concat$d(parts);
- }
-
- case "ReturnStatement":
- return concat$d(["return", printReturnAndThrowArgument(path, options, print)]);
-
- case "NewExpression":
- case "OptionalCallExpression":
- case "CallExpression":
- {
- const isNew = n.type === "NewExpression";
- const optional = printOptionalToken(path);
-
- if ( // We want to keep CommonJS- and AMD-style require calls, and AMD-style
- // define calls, as a unit.
- // e.g. `define(["some/lib", (lib) => {`
- !isNew && n.callee.type === "Identifier" && (n.callee.name === "require" || n.callee.name === "define") || // Template literals as single arguments
- n.arguments.length === 1 && isTemplateOnItsOwnLine$1(n.arguments[0], options.originalText, options) || // Keep test declarations on a single line
- // e.g. `it('long name', () => {`
- !isNew && isTestCall$1(n, path.getParentNode())) {
- return concat$d([isNew ? "new " : "", path.call(print, "callee"), optional, printFunctionTypeParameters(path, options, print), concat$d(["(", join$9(", ", path.map(print, "arguments")), ")"])]);
- } // Inline Flow annotation comments following Identifiers in Call nodes need to
- // stay with the Identifier. For example:
- //
- // foo /*:: <SomeGeneric> */(bar);
- //
- // Here, we ensure that such comments stay between the Identifier and the Callee.
-
-
- const isIdentifierWithFlowAnnotation = n.callee.type === "Identifier" && hasFlowAnnotationComment$1(n.callee.trailingComments);
-
- if (isIdentifierWithFlowAnnotation) {
- n.callee.trailingComments[0].printed = true;
- } // We detect calls on member lookups and possibly print them in a
- // special chain format. See `printMemberChain` for more info.
-
-
- if (!isNew && isMemberish$1(n.callee) && !path.call(path => needsParens_1(path, options), "callee")) {
- return printMemberChain(path, options, print);
- }
-
- 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.
- // See `isLongCurriedCallExpression` for more info.
-
- if (isCallOrOptionalCallExpression$1(n.callee)) {
- return group$b(contents);
- }
-
- return contents;
- }
-
- case "TSInterfaceDeclaration":
- if (n.declare) {
- parts.push("declare ");
- }
-
- parts.push(n.abstract ? "abstract " : "", printTypeScriptModifiers(path, options, print), "interface ", path.call(print, "id"), n.typeParameters ? path.call(print, "typeParameters") : "", " ");
-
- if (n.extends && n.extends.length) {
- 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"))), " "]))));
- }
-
- parts.push(path.call(print, "body"));
- return concat$d(parts);
-
- case "ObjectTypeInternalSlot":
- return concat$d([n.static ? "static " : "", "[[", path.call(print, "id"), "]]", printOptionalToken(path), n.method ? "" : ": ", path.call(print, "value")]);
-
- case "ObjectExpression":
- case "ObjectPattern":
- case "ObjectTypeAnnotation":
- case "TSInterfaceBody":
- case "TSTypeLiteral":
- {
- let propertiesField;
-
- if (n.type === "TSTypeLiteral") {
- propertiesField = "members";
- } else if (n.type === "TSInterfaceBody") {
- propertiesField = "body";
- } else {
- propertiesField = "properties";
- }
-
- const isTypeAnnotation = n.type === "ObjectTypeAnnotation";
- const fields = [];
-
- if (isTypeAnnotation) {
- fields.push("indexers", "callProperties", "internalSlots");
- }
-
- fields.push(propertiesField);
- const firstProperty = fields.map(field => n[field][0]).sort((a, b) => options.locStart(a) - options.locStart(b))[0];
- const parent = path.getParentNode(0);
- const isFlowInterfaceLikeBody = isTypeAnnotation && parent && (parent.type === "InterfaceDeclaration" || parent.type === "DeclareInterface" || parent.type === "DeclareClass") && path.getName() === "body";
- 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));
- const separator = isFlowInterfaceLikeBody ? ";" : n.type === "TSInterfaceBody" || n.type === "TSTypeLiteral" ? ifBreak$6(semi, ";") : ",";
- const leftBrace = n.exact ? "{|" : "{";
- const rightBrace = n.exact ? "|}" : "}"; // Unfortunately, things are grouped together in the ast can be
- // interleaved in the source code. So we need to reorder them before
- // printing them.
-
- const propsAndLoc = [];
- fields.forEach(field => {
- path.each(childPath => {
- const node = childPath.getValue();
- propsAndLoc.push({
- node,
- printed: print(childPath),
- loc: options.locStart(node)
- });
- }, field);
- });
- let separatorParts = [];
- const props = propsAndLoc.sort((a, b) => a.loc - b.loc).map(prop => {
- const result = concat$d(separatorParts.concat(group$b(prop.printed)));
- separatorParts = [separator, line$9];
-
- if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignatureDeclaration") && hasNodeIgnoreComment$2(prop.node)) {
- separatorParts.shift();
- }
-
- if (isNextLineEmpty$4(options.originalText, prop.node, options.locEnd)) {
- separatorParts.push(hardline$9);
- }
-
- return result;
- });
-
- if (n.inexact) {
- let printed;
-
- if (hasDanglingComments$1(n)) {
- const hasLineComments = !n.comments.every(comments$1.isBlockComment);
- const printedDanglingComments = comments.printDanglingComments(path, options,
- /* sameIndent */
- true);
- printed = concat$d([printedDanglingComments, hasLineComments || hasNewline$5(options.originalText, options.locEnd(n.comments[n.comments.length - 1])) ? hardline$9 : line$9, "..."]);
- } else {
- printed = "...";
- }
-
- props.push(concat$d(separatorParts.concat(printed)));
- }
-
- const lastElem = getLast$3(n[propertiesField]);
- const canHaveTrailingSeparator = !(n.inexact || lastElem && (lastElem.type === "RestElement" || hasNodeIgnoreComment$2(lastElem)));
- let content;
-
- if (props.length === 0) {
- if (!hasDanglingComments$1(n)) {
- return concat$d([leftBrace, rightBrace, printTypeAnnotation(path, options, print)]);
- }
-
- content = group$b(concat$d([leftBrace, comments.printDanglingComments(path, options), softline$6, rightBrace, printOptionalToken(path), printTypeAnnotation(path, options, print)]));
- } else {
- 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)]);
- } // If we inline the object as first argument of the parent, we don't want
- // to create another group so that the object breaks before the return
- // type
-
-
- 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)) {
- return content;
- }
-
- return group$b(content, {
- shouldBreak
- });
- }
- // Babel 6
-
- case "ObjectProperty": // Non-standard AST node type.
-
- case "Property":
- if (n.method || n.kind === "get" || n.kind === "set") {
- return printMethod(path, options, print);
- }
-
- if (n.shorthand) {
- parts.push(path.call(print, "value"));
- } else {
- parts.push(printAssignment(n.key, printPropertyKey(path, options, print), ":", n.value, path.call(print, "value"), options));
- }
-
- return concat$d(parts);
- // Babel 6
-
- case "ClassMethod":
- case "ClassPrivateMethod":
- case "MethodDefinition":
- case "TSAbstractMethodDefinition":
- case "TSDeclareMethod":
- if (n.decorators && n.decorators.length !== 0) {
- parts.push(printDecorators(path, options, print));
- }
-
- if (n.accessibility) {
- parts.push(n.accessibility + " ");
- }
-
- if (n.static) {
- parts.push("static ");
- }
-
- if (n.type === "TSAbstractMethodDefinition" || n.abstract) {
- parts.push("abstract ");
- }
-
- parts.push(printMethod(path, options, print));
- return concat$d(parts);
-
- case "ObjectMethod":
- return printMethod(path, options, print);
-
- case "Decorator":
- return concat$d(["@", path.call(print, "expression"), path.call(print, "callee")]);
-
- case "ArrayExpression":
- case "ArrayPattern":
- if (n.elements.length === 0) {
- if (!hasDanglingComments$1(n)) {
- parts.push("[]");
- } else {
- parts.push(group$b(concat$d(["[", comments.printDanglingComments(path, options), softline$6, "]"])));
- }
- } else {
- const lastElem = getLast$3(n.elements);
- const canHaveTrailingComma = !(lastElem && lastElem.type === "RestElement"); // JavaScript allows you to have empty elements in an array which
- // changes its length based on the number of commas. The algorithm
- // is that if the last argument is null, we need to force insert
- // a comma to ensure JavaScript recognizes it.
- // [,].length === 1
- // [1,].length === 1
- // [1,,].length === 2
- //
- // Note that getLast returns null if the array is empty, but
- // we already check for an empty array just above so we are safe
-
- const needsForcedTrailingComma = canHaveTrailingComma && lastElem === null;
- const shouldBreak = n.elements.length > 1 && n.elements.every((element, i, elements) => {
- const elementType = element && element.type;
-
- if (elementType !== "ArrayExpression" && elementType !== "ObjectExpression") {
- return false;
- }
-
- const nextElement = elements[i + 1];
-
- if (nextElement && elementType !== nextElement.type) {
- return false;
- }
-
- const itemsKey = elementType === "ArrayExpression" ? "elements" : "properties";
- return element[itemsKey] && element[itemsKey].length > 1;
- });
- 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,
- /* sameIndent */
- true), softline$6, "]"]), {
- shouldBreak
- }));
- }
-
- parts.push(printOptionalToken(path), printTypeAnnotation(path, options, print));
- return concat$d(parts);
-
- case "SequenceExpression":
- {
- const parent = path.getParentNode(0);
-
- if (parent.type === "ExpressionStatement" || parent.type === "ForStatement") {
- // For ExpressionStatements and for-loop heads, which are among
- // the few places a SequenceExpression appears unparenthesized, we want
- // to indent expressions after the first.
- const parts = [];
- path.each(p => {
- if (p.getName() === 0) {
- parts.push(print(p));
- } else {
- parts.push(",", indent$7(concat$d([line$9, print(p)])));
- }
- }, "expressions");
- return group$b(concat$d(parts));
- }
-
- return group$b(concat$d([join$9(concat$d([",", line$9]), path.map(print, "expressions"))]));
- }
-
- case "ThisExpression":
- return "this";
-
- case "Super":
- return "super";
-
- case "NullLiteral":
- // Babel 6 Literal split
- return "null";
-
- case "RegExpLiteral":
- // Babel 6 Literal split
- return printRegex(n);
-
- case "NumericLiteral":
- // Babel 6 Literal split
- return printNumber$2(n.extra.raw);
-
- case "BigIntLiteral":
- // babel: n.extra.raw, typescript: n.raw, flow: n.bigint
- return (n.bigint || (n.extra ? n.extra.raw : n.raw)).toLowerCase();
-
- case "BooleanLiteral": // Babel 6 Literal split
-
- case "StringLiteral": // Babel 6 Literal split
-
- case "Literal":
- {
- if (n.regex) {
- return printRegex(n.regex);
- }
-
- if (typeof n.value === "number") {
- return printNumber$2(n.raw);
- }
-
- if (typeof n.value !== "string") {
- return "" + n.value;
- } // TypeScript workaround for https://github.com/JamesHenry/typescript-estree/issues/2
- // See corresponding workaround in needs-parens.js
-
-
- const grandParent = path.getParentNode(1);
- const isTypeScriptDirective = options.parser === "typescript" && typeof n.value === "string" && grandParent && (grandParent.type === "Program" || grandParent.type === "BlockStatement");
- return nodeStr(n, options, isTypeScriptDirective);
- }
-
- case "Directive":
- return path.call(print, "value");
- // Babel 6
-
- case "DirectiveLiteral":
- return nodeStr(n, options);
-
- case "UnaryExpression":
- parts.push(n.operator);
-
- if (/[a-z]$/.test(n.operator)) {
- parts.push(" ");
- }
-
- if (n.argument.comments && n.argument.comments.length > 0) {
- parts.push(group$b(concat$d(["(", indent$7(concat$d([softline$6, path.call(print, "argument")])), softline$6, ")"])));
- } else {
- parts.push(path.call(print, "argument"));
- }
-
- return concat$d(parts);
-
- case "UpdateExpression":
- parts.push(path.call(print, "argument"), n.operator);
-
- if (n.prefix) {
- parts.reverse();
- }
-
- return concat$d(parts);
-
- case "ConditionalExpression":
- return printTernaryOperator(path, options, print, {
- beforeParts: () => [path.call(print, "test")],
- afterParts: breakClosingParen => [breakClosingParen ? softline$6 : ""],
- shouldCheckJsx: true,
- conditionalNodeType: "ConditionalExpression",
- consequentNodePropertyName: "consequent",
- alternateNodePropertyName: "alternate",
- testNodePropertyNames: ["test"]
- });
-
- case "VariableDeclaration":
- {
- const printed = path.map(childPath => {
- return print(childPath);
- }, "declarations"); // We generally want to terminate all variable declarations with a
- // semicolon, except when they in the () part of for loops.
-
- const parentNode = path.getParentNode();
- const isParentForLoop = parentNode.type === "ForStatement" || parentNode.type === "ForInStatement" || parentNode.type === "ForOfStatement";
- const hasValue = n.declarations.some(decl => decl.init);
- let firstVariable;
-
- if (printed.length === 1 && !n.declarations[0].comments) {
- firstVariable = printed[0];
- } else if (printed.length > 0) {
- // Indent first var to comply with eslint one-var rule
- firstVariable = indent$7(printed[0]);
- }
-
- 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]))))];
-
- if (!(isParentForLoop && parentNode.body !== n)) {
- parts.push(semi);
- }
-
- return group$b(concat$d(parts));
- }
-
- case "TSTypeAliasDeclaration":
- {
- if (n.declare) {
- parts.push("declare ");
- }
-
- const printed = printAssignmentRight(n.id, n.typeAnnotation, n.typeAnnotation && path.call(print, "typeAnnotation"), options);
- parts.push("type ", path.call(print, "id"), path.call(print, "typeParameters"), " =", printed, semi);
- return group$b(concat$d(parts));
- }
-
- case "VariableDeclarator":
- return printAssignment(n.id, path.call(print, "id"), " =", n.init, n.init && path.call(print, "init"), options);
-
- case "WithStatement":
- return group$b(concat$d(["with (", path.call(print, "object"), ")", adjustClause(n.body, path.call(print, "body"))]));
-
- case "IfStatement":
- {
- const con = adjustClause(n.consequent, path.call(print, "consequent"));
- const opening = group$b(concat$d(["if (", group$b(concat$d([indent$7(concat$d([softline$6, path.call(print, "test")])), softline$6])), ")", con]));
- parts.push(opening);
-
- if (n.alternate) {
- const commentOnOwnLine = hasTrailingComment$1(n.consequent) && n.consequent.comments.some(comment => comment.trailing && !comments$1.isBlockComment(comment)) || needsHardlineAfterDanglingComment$1(n);
- const elseOnSameLine = n.consequent.type === "BlockStatement" && !commentOnOwnLine;
- parts.push(elseOnSameLine ? " " : hardline$9);
-
- if (hasDanglingComments$1(n)) {
- parts.push(comments.printDanglingComments(path, options, true), commentOnOwnLine ? hardline$9 : " ");
- }
-
- parts.push("else", group$b(adjustClause(n.alternate, path.call(print, "alternate"), n.alternate.type === "IfStatement")));
- }
-
- return concat$d(parts);
- }
-
- case "ForStatement":
- {
- const body = adjustClause(n.body, path.call(print, "body")); // We want to keep dangling comments above the loop to stay consistent.
- // Any comment positioned between the for statement and the parentheses
- // is going to be printed before the statement.
-
- const dangling = comments.printDanglingComments(path, options,
- /* sameLine */
- true);
- const printedComments = dangling ? concat$d([dangling, softline$6]) : "";
-
- if (!n.init && !n.test && !n.update) {
- return concat$d([printedComments, group$b(concat$d(["for (;;)", body]))]);
- }
-
- 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]))]);
- }
-
- case "WhileStatement":
- 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"))]));
-
- case "ForInStatement":
- // Note: esprima can't actually parse "for each (".
- 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"))]));
-
- case "ForOfStatement":
- 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"))]));
-
- case "DoWhileStatement":
- {
- const clause = adjustClause(n.body, path.call(print, "body"));
- const doBody = group$b(concat$d(["do", clause]));
- parts = [doBody];
-
- if (n.body.type === "BlockStatement") {
- parts.push(" ");
- } else {
- parts.push(hardline$9);
- }
-
- parts.push("while (");
- parts.push(group$b(concat$d([indent$7(concat$d([softline$6, path.call(print, "test")])), softline$6])), ")", semi);
- return concat$d(parts);
- }
-
- case "DoExpression":
- return concat$d(["do ", path.call(print, "body")]);
-
- case "BreakStatement":
- parts.push("break");
-
- if (n.label) {
- parts.push(" ", path.call(print, "label"));
- }
-
- parts.push(semi);
- return concat$d(parts);
-
- case "ContinueStatement":
- parts.push("continue");
-
- if (n.label) {
- parts.push(" ", path.call(print, "label"));
- }
-
- parts.push(semi);
- return concat$d(parts);
-
- case "LabeledStatement":
- if (n.body.type === "EmptyStatement") {
- return concat$d([path.call(print, "label"), ":;"]);
- }
-
- return concat$d([path.call(print, "label"), ": ", path.call(print, "body")]);
-
- case "TryStatement":
- 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")]) : ""]);
-
- case "CatchClause":
- if (n.param) {
- 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), {
- backwards: true
- }));
- const param = path.call(print, "param");
- return concat$d(["catch ", hasComments ? concat$d(["(", indent$7(concat$d([softline$6, param])), softline$6, ") "]) : concat$d(["(", param, ") "]), path.call(print, "body")]);
- }
-
- return concat$d(["catch ", path.call(print, "body")]);
-
- case "ThrowStatement":
- return concat$d(["throw", printReturnAndThrowArgument(path, options, print)]);
- // Note: ignoring n.lexical because it has no printing consequences.
-
- case "SwitchStatement":
- 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 => {
- const caseNode = casePath.getValue();
- return concat$d([casePath.call(print), n.cases.indexOf(caseNode) !== n.cases.length - 1 && isNextLineEmpty$4(options.originalText, caseNode, options.locEnd) ? hardline$9 : ""]);
- }, "cases"))])) : "", hardline$9, "}"]);
-
- case "SwitchCase":
- {
- if (n.test) {
- parts.push("case ", path.call(print, "test"), ":");
- } else {
- parts.push("default:");
- }
-
- const consequent = n.consequent.filter(node => node.type !== "EmptyStatement");
-
- if (consequent.length > 0) {
- const cons = path.call(consequentPath => {
- return printStatementSequence(consequentPath, options, print);
- }, "consequent");
- parts.push(consequent.length === 1 && consequent[0].type === "BlockStatement" ? concat$d([" ", cons]) : indent$7(concat$d([hardline$9, cons])));
- }
-
- return concat$d(parts);
- }
- // JSX extensions below.
-
- case "DebuggerStatement":
- return concat$d(["debugger", semi]);
-
- case "JSXAttribute":
- parts.push(path.call(print, "name"));
-
- if (n.value) {
- let res;
-
- if (isStringLiteral$1(n.value)) {
- const raw = rawText$1(n.value); // Unescape all quotes so we get an accurate preferred quote
-
- let final = raw.replace(/'/g, "'").replace(/"/g, '"');
- const quote = getPreferredQuote$1(final, options.jsxSingleQuote ? "'" : '"');
- const escape = quote === "'" ? "'" : """;
- final = final.slice(1, -1).replace(new RegExp(quote, "g"), escape);
- res = concat$d([quote, final, quote]);
- } else {
- res = path.call(print, "value");
- }
-
- parts.push("=", res);
- }
-
- return concat$d(parts);
-
- case "JSXIdentifier":
- return "" + n.name;
-
- case "JSXNamespacedName":
- return join$9(":", [path.call(print, "namespace"), path.call(print, "name")]);
-
- case "JSXMemberExpression":
- return join$9(".", [path.call(print, "object"), path.call(print, "property")]);
-
- case "TSQualifiedName":
- return join$9(".", [path.call(print, "left"), path.call(print, "right")]);
-
- case "JSXSpreadAttribute":
- case "JSXSpreadChild":
- {
- return concat$d(["{", path.call(p => {
- const printed = concat$d(["...", print(p)]);
- const n = p.getValue();
-
- if (!n.comments || !n.comments.length) {
- return printed;
- }
-
- return concat$d([indent$7(concat$d([softline$6, comments.printComments(p, () => printed, options)])), softline$6]);
- }, n.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"]);
- }
-
- case "JSXExpressionContainer":
- {
- const parent = path.getParentNode(0);
- const hasComments = n.expression.comments && n.expression.comments.length > 0;
- 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)));
-
- if (shouldInline) {
- return group$b(concat$d(["{", path.call(print, "expression"), lineSuffixBoundary$1, "}"]));
- }
-
- return group$b(concat$d(["{", indent$7(concat$d([softline$6, path.call(print, "expression")])), softline$6, lineSuffixBoundary$1, "}"]));
- }
-
- case "JSXFragment":
- case "JSXElement":
- {
- const elem = comments.printComments(path, () => printJSXElement(path, options, print), options);
- return maybeWrapJSXElementInParens(path, elem, options);
- }
-
- case "JSXOpeningElement":
- {
- const n = path.getValue();
- 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
-
- if (n.selfClosing && !n.attributes.length && !nameHasComments) {
- return concat$d(["<", path.call(print, "name"), path.call(print, "typeParameters"), " />"]);
- } // don't break up opening elements with a single long text attribute
-
-
- 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:
- // <div
- // // comment
- // attr="value"
- // >
- // <div
- // attr="value"
- // // comment
- // >
- !nameHasComments && (!n.attributes[0].comments || !n.attributes[0].comments.length)) {
- return group$b(concat$d(["<", path.call(print, "name"), path.call(print, "typeParameters"), " ", concat$d(path.map(print, "attributes")), n.selfClosing ? " />" : ">"]));
- }
-
- const lastAttrHasTrailingComments = n.attributes.length && hasTrailingComment$1(getLast$3(n.attributes));
- const bracketSameLine = // Simple tags (no attributes and no comment in tag name) should be
- // kept unbroken regardless of `jsxBracketSameLine`
- !n.attributes.length && !nameHasComments || options.jsxBracketSameLine && ( // We should print the bracket in a new line for the following cases:
- // <div
- // // comment
- // >
- // <div
- // attr // comment
- // >
- !nameHasComments || n.attributes.length) && !lastAttrHasTrailingComments; // We should print the opening element expanded if any prop value is a
- // string literal with newlines
-
- const shouldBreak = n.attributes && n.attributes.some(attr => attr.value && isStringLiteral$1(attr.value) && attr.value.value.includes("\n"));
- 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 ? "" : ">"]), {
- shouldBreak
- });
- }
-
- case "JSXClosingElement":
- return concat$d(["</", path.call(print, "name"), ">"]);
-
- case "JSXOpeningFragment":
- case "JSXClosingFragment":
- {
- const hasComment = n.comments && n.comments.length;
- const hasOwnLineComment = hasComment && !n.comments.every(comments$1.isBlockComment);
- const isOpeningFragment = n.type === "JSXOpeningFragment";
- return concat$d([isOpeningFragment ? "<" : "</", indent$7(concat$d([hasOwnLineComment ? hardline$9 : hasComment && !isOpeningFragment ? " " : "", comments.printDanglingComments(path, options, true)])), hasOwnLineComment ? hardline$9 : "", ">"]);
- }
-
- case "JSXText":
- /* istanbul ignore next */
- throw new Error("JSXTest should be handled by JSXElement");
-
- case "JSXEmptyExpression":
- {
- const requiresHardline = n.comments && !n.comments.every(comments$1.isBlockComment);
- return concat$d([comments.printDanglingComments(path, options,
- /* sameIndent */
- !requiresHardline), requiresHardline ? hardline$9 : ""]);
- }
-
- case "ClassBody":
- if (!n.comments && n.body.length === 0) {
- return "{}";
- }
-
- return concat$d(["{", n.body.length > 0 ? indent$7(concat$d([hardline$9, path.call(bodyPath => {
- return printStatementSequence(bodyPath, options, print);
- }, "body")])) : comments.printDanglingComments(path, options), hardline$9, "}"]);
-
- case "ClassProperty":
- case "TSAbstractClassProperty":
- case "ClassPrivateProperty":
- {
- if (n.decorators && n.decorators.length !== 0) {
- parts.push(printDecorators(path, options, print));
- }
-
- if (n.accessibility) {
- parts.push(n.accessibility + " ");
- }
-
- if (n.declare) {
- parts.push("declare ");
- }
-
- if (n.static) {
- parts.push("static ");
- }
-
- if (n.type === "TSAbstractClassProperty" || n.abstract) {
- parts.push("abstract ");
- }
-
- if (n.readonly) {
- parts.push("readonly ");
- }
-
- const variance = getFlowVariance$1(n);
-
- if (variance) {
- parts.push(variance);
- }
-
- parts.push(printPropertyKey(path, options, print), printOptionalToken(path), printTypeAnnotation(path, options, print));
-
- if (n.value) {
- parts.push(" =", printAssignmentRight(n.key, n.value, path.call(print, "value"), options));
- }
-
- parts.push(semi);
- return group$b(concat$d(parts));
- }
-
- case "ClassDeclaration":
- case "ClassExpression":
- if (n.declare) {
- parts.push("declare ");
- }
-
- parts.push(concat$d(printClass(path, options, print)));
- return concat$d(parts);
-
- case "TSInterfaceHeritage":
- case "TSExpressionWithTypeArguments":
- // Babel AST
- parts.push(path.call(print, "expression"));
-
- if (n.typeParameters) {
- parts.push(path.call(print, "typeParameters"));
- }
-
- return concat$d(parts);
-
- case "TemplateElement":
- return join$9(literalline$4, n.value.raw.split(/\r?\n/g));
-
- case "TemplateLiteral":
- {
- let expressions = path.map(print, "expressions");
- const parentNode = path.getParentNode();
-
- if (isJestEachTemplateLiteral$1(n, parentNode)) {
- const printed = printJestEachTemplateLiteral(n, expressions, options);
-
- if (printed) {
- return printed;
- }
- }
-
- const isSimple = isSimpleTemplateLiteral$1(n);
-
- if (isSimple) {
- expressions = expressions.map(doc => printDocToString$2(doc, Object.assign({}, options, {
- printWidth: Infinity
- })).formatted);
- }
-
- parts.push(lineSuffixBoundary$1, "`");
- path.each(childPath => {
- const i = childPath.getName();
- parts.push(print(childPath));
-
- if (i < expressions.length) {
- // For a template literal of the following form:
- // `someQuery {
- // ${call({
- // a,
- // b,
- // })}
- // }`
- // the expression is on its own line (there is a \n in the previous
- // quasi literal), therefore we want to indent the JavaScript
- // expression inside at the beginning of ${ instead of the beginning
- // of the `.
- const {
- tabWidth
- } = options;
- const quasi = childPath.getValue();
- const indentSize = getIndentSize$2(quasi.value.raw, tabWidth);
- let printed = expressions[i];
-
- if (!isSimple) {
- // Breaks at the template element boundaries (${ and }) are preferred to breaking
- // in the middle of a MemberExpression
- 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])) {
- printed = concat$d([indent$7(concat$d([softline$6, printed])), softline$6]);
- }
- }
-
- const aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$1(-Infinity, printed) : addAlignmentToDoc$2(printed, indentSize, tabWidth);
- parts.push(group$b(concat$d(["${", aligned, lineSuffixBoundary$1, "}"])));
- }
- }, "quasis");
- parts.push("`");
- return concat$d(parts);
- }
- // These types are unprintable because they serve as abstract
- // supertypes for other (printable) types.
-
- case "TaggedTemplateExpression":
- return concat$d([path.call(print, "tag"), path.call(print, "typeParameters"), path.call(print, "quasi")]);
-
- case "Node":
- case "Printable":
- case "SourceLocation":
- case "Position":
- case "Statement":
- case "Function":
- case "Pattern":
- case "Expression":
- case "Declaration":
- case "Specifier":
- case "NamedSpecifier":
- case "Comment":
- case "MemberTypeAnnotation": // Flow
-
- case "Type":
- /* istanbul ignore next */
- throw new Error("unprintable type: " + JSON.stringify(n.type));
- // Type Annotations for Facebook Flow, typically stripped out or
- // transformed away before printing.
-
- case "TypeAnnotation":
- case "TSTypeAnnotation":
- if (n.typeAnnotation) {
- return path.call(print, "typeAnnotation");
- }
- /* istanbul ignore next */
-
-
- return "";
-
- case "TSTupleType":
- case "TupleTypeAnnotation":
- {
- const typesField = n.type === "TSTupleType" ? "elementTypes" : "types";
- const hasRest = n[typesField].length > 0 && getLast$3(n[typesField]).type === "TSRestType";
- 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,
- /* sameIndent */
- true), softline$6, "]"]));
- }
-
- case "ExistsTypeAnnotation":
- return "*";
-
- case "EmptyTypeAnnotation":
- return "empty";
-
- case "AnyTypeAnnotation":
- return "any";
-
- case "MixedTypeAnnotation":
- return "mixed";
-
- case "ArrayTypeAnnotation":
- return concat$d([path.call(print, "elementType"), "[]"]);
-
- case "BooleanTypeAnnotation":
- return "boolean";
-
- case "BooleanLiteralTypeAnnotation":
- return "" + n.value;
-
- case "DeclareClass":
- return printFlowDeclaration(path, printClass(path, options, print));
-
- case "TSDeclareFunction":
- // For TypeScript the TSDeclareFunction node shares the AST
- // structure with FunctionDeclaration
- return concat$d([n.declare ? "declare " : "", printFunctionDeclaration(path, print, options), semi]);
-
- case "DeclareFunction":
- return printFlowDeclaration(path, ["function ", path.call(print, "id"), n.predicate ? " " : "", path.call(print, "predicate"), semi]);
-
- case "DeclareModule":
- return printFlowDeclaration(path, ["module ", path.call(print, "id"), " ", path.call(print, "body")]);
-
- case "DeclareModuleExports":
- return printFlowDeclaration(path, ["module.exports", ": ", path.call(print, "typeAnnotation"), semi]);
-
- case "DeclareVariable":
- return printFlowDeclaration(path, ["var ", path.call(print, "id"), semi]);
-
- case "DeclareExportAllDeclaration":
- return concat$d(["declare export * from ", path.call(print, "source")]);
-
- case "DeclareExportDeclaration":
- return concat$d(["declare ", printExportDeclaration(path, options, print)]);
-
- case "DeclareOpaqueType":
- case "OpaqueType":
- {
- parts.push("opaque type ", path.call(print, "id"), path.call(print, "typeParameters"));
-
- if (n.supertype) {
- parts.push(": ", path.call(print, "supertype"));
- }
-
- if (n.impltype) {
- parts.push(" = ", path.call(print, "impltype"));
- }
-
- parts.push(semi);
-
- if (n.type === "DeclareOpaqueType") {
- return printFlowDeclaration(path, parts);
- }
-
- return concat$d(parts);
- }
-
- case "EnumDeclaration":
- return concat$d(["enum ", path.call(print, "id"), " ", path.call(print, "body")]);
-
- case "EnumBooleanBody":
- case "EnumNumberBody":
- case "EnumStringBody":
- case "EnumSymbolBody":
- {
- if (n.type === "EnumSymbolBody" || n.explicitType) {
- let type = null;
-
- switch (n.type) {
- case "EnumBooleanBody":
- type = "boolean";
- break;
-
- case "EnumNumberBody":
- type = "number";
- break;
-
- case "EnumStringBody":
- type = "string";
- break;
-
- case "EnumSymbolBody":
- type = "symbol";
- break;
- }
-
- parts.push("of ", type, " ");
- }
-
- if (n.members.length === 0) {
- parts.push(group$b(concat$d(["{", comments.printDanglingComments(path, options), softline$6, "}"])));
- } else {
- parts.push(group$b(concat$d(["{", indent$7(concat$d([hardline$9, printArrayItems(path, options, "members", print), shouldPrintComma$1(options) ? "," : ""])), comments.printDanglingComments(path, options,
- /* sameIndent */
- true), hardline$9, "}"])));
- }
-
- return concat$d(parts);
- }
-
- case "EnumBooleanMember":
- case "EnumNumberMember":
- case "EnumStringMember":
- return concat$d([path.call(print, "id"), " = ", typeof n.init === "object" ? path.call(print, "init") : String(n.init)]);
-
- case "EnumDefaultedMember":
- return path.call(print, "id");
-
- case "FunctionTypeAnnotation":
- case "TSFunctionType":
- {
- // FunctionTypeAnnotation is ambiguous:
- // declare function foo(a: B): void; OR
- // var A: (a: B) => void;
- const parent = path.getParentNode(0);
- const parentParent = path.getParentNode(1);
- const parentParentParent = path.getParentNode(2);
- 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");
- let needsColon = isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation"); // Sadly we can't put it inside of FastPath::needsColon because we are
- // printing ":" as part of the expression and it would put parenthesis
- // around :(
-
- const needsParens = needsColon && isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation") && parentParent.type === "ArrowFunctionExpression";
-
- if (isObjectTypePropertyAFunction$1(parent, options)) {
- isArrowFunctionTypeAnnotation = true;
- needsColon = true;
- }
-
- if (needsParens) {
- parts.push("(");
- }
-
- parts.push(printFunctionParams(path, print, options,
- /* expandArg */
- false,
- /* printTypeParams */
- true)); // The returnType is not wrapped in a TypeAnnotation, so the colon
- // needs to be added separately.
-
- if (n.returnType || n.predicate || n.typeAnnotation) {
- parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path.call(print, "returnType"), path.call(print, "predicate"), path.call(print, "typeAnnotation"));
- }
-
- if (needsParens) {
- parts.push(")");
- }
-
- return group$b(concat$d(parts));
- }
-
- case "TSRestType":
- return concat$d(["...", path.call(print, "typeAnnotation")]);
-
- case "TSOptionalType":
- return concat$d([path.call(print, "typeAnnotation"), "?"]);
-
- case "FunctionTypeParam":
- return concat$d([path.call(print, "name"), printOptionalToken(path), n.name ? ": " : "", path.call(print, "typeAnnotation")]);
-
- case "GenericTypeAnnotation":
- return concat$d([path.call(print, "id"), path.call(print, "typeParameters")]);
-
- case "DeclareInterface":
- case "InterfaceDeclaration":
- case "InterfaceTypeAnnotation":
- {
- if (n.type === "DeclareInterface" || n.declare) {
- parts.push("declare ");
- }
-
- parts.push("interface");
-
- if (n.type === "DeclareInterface" || n.type === "InterfaceDeclaration") {
- parts.push(" ", path.call(print, "id"), path.call(print, "typeParameters"));
- }
-
- if (n.extends.length > 0) {
- 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")))]))));
- }
-
- parts.push(" ", path.call(print, "body"));
- return group$b(concat$d(parts));
- }
-
- case "ClassImplements":
- case "InterfaceExtends":
- return concat$d([path.call(print, "id"), path.call(print, "typeParameters")]);
-
- case "TSClassImplements":
- return concat$d([path.call(print, "expression"), path.call(print, "typeParameters")]);
-
- case "TSIntersectionType":
- case "IntersectionTypeAnnotation":
- {
- const types = path.map(print, "types");
- const result = [];
- let wasIndented = false;
-
- for (let i = 0; i < types.length; ++i) {
- if (i === 0) {
- result.push(types[i]);
- } else if (isObjectType$1(n.types[i - 1]) && isObjectType$1(n.types[i])) {
- // If both are objects, don't indent
- result.push(concat$d([" & ", wasIndented ? indent$7(types[i]) : types[i]]));
- } else if (!isObjectType$1(n.types[i - 1]) && !isObjectType$1(n.types[i])) {
- // If no object is involved, go to the next line if it breaks
- result.push(indent$7(concat$d([" &", line$9, types[i]])));
- } else {
- // If you go from object to non-object or vis-versa, then inline it
- if (i > 1) {
- wasIndented = true;
- }
-
- result.push(" & ", i > 1 ? indent$7(types[i]) : types[i]);
- }
- }
-
- return group$b(concat$d(result));
- }
-
- case "TSUnionType":
- case "UnionTypeAnnotation":
- {
- // single-line variation
- // A | B | C
- // multi-line variation
- // | A
- // | B
- // | C
- const parent = path.getParentNode(); // If there's a leading comment, the parent is doing the indentation
-
- 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)); // {
- // a: string
- // } | null | void
- // should be inlined and not be printed in the multi-line variant
-
- const shouldHug = shouldHugType(n); // We want to align the children but without its comment, so it looks like
- // | child1
- // // comment
- // | child2
-
- const printed = path.map(typePath => {
- let printedType = typePath.call(print);
-
- if (!shouldHug) {
- printedType = align$1(2, printedType);
- }
-
- return comments.printComments(typePath, () => printedType, options);
- }, "types");
-
- if (shouldHug) {
- return join$9(" | ", printed);
- }
-
- const shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment$1(options.originalText, n, options);
- const code = concat$d([ifBreak$6(concat$d([shouldAddStartLine ? line$9 : "", "| "])), join$9(concat$d([line$9, "| "]), printed)]);
-
- if (needsParens_1(path, options)) {
- return group$b(concat$d([indent$7(code), softline$6]));
- }
-
- if (parent.type === "TupleTypeAnnotation" && parent.types.length > 1 || parent.type === "TSTupleType" && parent.elementTypes.length > 1) {
- return group$b(concat$d([indent$7(concat$d([ifBreak$6(concat$d(["(", softline$6])), code])), softline$6, ifBreak$6(")")]));
- }
-
- return group$b(shouldIndent ? indent$7(code) : code);
- }
-
- case "NullableTypeAnnotation":
- return concat$d(["?", path.call(print, "typeAnnotation")]);
-
- case "TSNullKeyword":
- case "NullLiteralTypeAnnotation":
- return "null";
-
- case "ThisTypeAnnotation":
- return "this";
-
- case "NumberTypeAnnotation":
- return "number";
-
- case "SymbolTypeAnnotation":
- return "symbol";
-
- case "ObjectTypeCallProperty":
- if (n.static) {
- parts.push("static ");
- }
-
- parts.push(path.call(print, "value"));
- return concat$d(parts);
-
- case "ObjectTypeIndexer":
- {
- const variance = getFlowVariance$1(n);
- return concat$d([variance || "", "[", path.call(print, "id"), n.id ? ": " : "", path.call(print, "key"), "]: ", path.call(print, "value")]);
- }
-
- case "ObjectTypeProperty":
- {
- const variance = getFlowVariance$1(n);
- let modifier = "";
-
- if (n.proto) {
- modifier = "proto ";
- } else if (n.static) {
- modifier = "static ";
- }
-
- return concat$d([modifier, isGetterOrSetter$1(n) ? n.kind + " " : "", variance || "", printPropertyKey(path, options, print), printOptionalToken(path), isFunctionNotation$1(n, options) ? "" : ": ", path.call(print, "value")]);
- }
-
- case "QualifiedTypeIdentifier":
- return concat$d([path.call(print, "qualification"), ".", path.call(print, "id")]);
-
- case "StringLiteralTypeAnnotation":
- return nodeStr(n, options);
-
- case "NumberLiteralTypeAnnotation":
- assert.strictEqual(typeof n.value, "number");
-
- if (n.extra != null) {
- return printNumber$2(n.extra.raw);
- }
-
- return printNumber$2(n.raw);
-
- case "StringTypeAnnotation":
- return "string";
-
- case "DeclareTypeAlias":
- case "TypeAlias":
- {
- if (n.type === "DeclareTypeAlias" || n.declare) {
- parts.push("declare ");
- }
-
- const printed = printAssignmentRight(n.id, n.right, path.call(print, "right"), options);
- parts.push("type ", path.call(print, "id"), path.call(print, "typeParameters"), " =", printed, semi);
- return group$b(concat$d(parts));
- }
-
- case "TypeCastExpression":
- {
- return concat$d(["(", path.call(print, "expression"), printTypeAnnotation(path, options, print), ")"]);
- }
-
- case "TypeParameterDeclaration":
- case "TypeParameterInstantiation":
- {
- const value = path.getValue();
- 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
- // because we know for sure that this is a type definition.
-
- const commentSyntax = commentStart >= 0 && options.originalText.slice(commentStart).match(/^\/\*\s*::/);
-
- if (commentSyntax) {
- return concat$d(["/*:: ", printTypeParameters(path, options, print, "params"), " */"]);
- }
-
- return printTypeParameters(path, options, print, "params");
- }
-
- case "TSTypeParameterDeclaration":
- case "TSTypeParameterInstantiation":
- return printTypeParameters(path, options, print, "params");
-
- case "TSTypeParameter":
- case "TypeParameter":
- {
- const parent = path.getParentNode();
-
- if (parent.type === "TSMappedType") {
- parts.push("[", path.call(print, "name"));
-
- if (n.constraint) {
- parts.push(" in ", path.call(print, "constraint"));
- }
-
- parts.push("]");
- return concat$d(parts);
- }
-
- const variance = getFlowVariance$1(n);
-
- if (variance) {
- parts.push(variance);
- }
-
- parts.push(path.call(print, "name"));
-
- if (n.bound) {
- parts.push(": ");
- parts.push(path.call(print, "bound"));
- }
-
- if (n.constraint) {
- parts.push(" extends ", path.call(print, "constraint"));
- }
-
- if (n.default) {
- parts.push(" = ", path.call(print, "default"));
- } // Keep comma if the file extension is .tsx and
- // has one type parameter that isn't extend with any types.
- // Because, otherwise formatted result will be invalid as tsx.
-
-
- const grandParent = path.getNode(2);
-
- if (parent.params && parent.params.length === 1 && isTSXFile$1(options) && !n.constraint && grandParent.type === "ArrowFunctionExpression") {
- parts.push(",");
- }
-
- return concat$d(parts);
- }
-
- case "TypeofTypeAnnotation":
- return concat$d(["typeof ", path.call(print, "argument")]);
-
- case "VoidTypeAnnotation":
- return "void";
-
- case "InferredPredicate":
- return "%checks";
- // Unhandled types below. If encountered, nodes of these types should
- // be either left alone or desugared into AST types that are fully
- // supported by the pretty-printer.
-
- case "DeclaredPredicate":
- return concat$d(["%checks(", path.call(print, "value"), ")"]);
-
- case "TSAbstractKeyword":
- return "abstract";
-
- case "TSAnyKeyword":
- return "any";
-
- case "TSAsyncKeyword":
- return "async";
-
- case "TSBooleanKeyword":
- return "boolean";
-
- case "TSBigIntKeyword":
- return "bigint";
-
- case "TSConstKeyword":
- return "const";
-
- case "TSDeclareKeyword":
- return "declare";
-
- case "TSExportKeyword":
- return "export";
-
- case "TSNeverKeyword":
- return "never";
-
- case "TSNumberKeyword":
- return "number";
-
- case "TSObjectKeyword":
- return "object";
-
- case "TSProtectedKeyword":
- return "protected";
-
- case "TSPrivateKeyword":
- return "private";
-
- case "TSPublicKeyword":
- return "public";
-
- case "TSReadonlyKeyword":
- return "readonly";
-
- case "TSSymbolKeyword":
- return "symbol";
-
- case "TSStaticKeyword":
- return "static";
-
- case "TSStringKeyword":
- return "string";
-
- case "TSUndefinedKeyword":
- return "undefined";
-
- case "TSUnknownKeyword":
- return "unknown";
-
- case "TSVoidKeyword":
- return "void";
-
- case "TSAsExpression":
- return concat$d([path.call(print, "expression"), " as ", path.call(print, "typeAnnotation")]);
-
- case "TSArrayType":
- return concat$d([path.call(print, "elementType"), "[]"]);
-
- case "TSPropertySignature":
- {
- if (n.export) {
- parts.push("export ");
- }
-
- if (n.accessibility) {
- parts.push(n.accessibility + " ");
- }
-
- if (n.static) {
- parts.push("static ");
- }
-
- if (n.readonly) {
- parts.push("readonly ");
- }
-
- parts.push(printPropertyKey(path, options, print), printOptionalToken(path));
-
- if (n.typeAnnotation) {
- parts.push(": ");
- parts.push(path.call(print, "typeAnnotation"));
- } // This isn't valid semantically, but it's in the AST so we can print it.
-
-
- if (n.initializer) {
- parts.push(" = ", path.call(print, "initializer"));
- }
-
- return concat$d(parts);
- }
-
- case "TSParameterProperty":
- if (n.accessibility) {
- parts.push(n.accessibility + " ");
- }
-
- if (n.export) {
- parts.push("export ");
- }
-
- if (n.static) {
- parts.push("static ");
- }
-
- if (n.readonly) {
- parts.push("readonly ");
- }
-
- parts.push(path.call(print, "parameter"));
- return concat$d(parts);
-
- case "TSTypeReference":
- return concat$d([path.call(print, "typeName"), printTypeParameters(path, options, print, "typeParameters")]);
-
- case "TSTypeQuery":
- return concat$d(["typeof ", path.call(print, "exprName")]);
-
- case "TSIndexSignature":
- {
- const parent = path.getParentNode(); // The typescript parser accepts multiple parameters here. If you're
- // using them, it makes sense to have a trailing comma. But if you
- // aren't, this is more like a computed property name than an array.
- // So we leave off the trailing comma when there's just one parameter.
-
- const trailingComma = n.parameters.length > 1 ? ifBreak$6(shouldPrintComma$1(options) ? "," : "") : "";
- 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]));
- 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 : ""]);
- }
-
- case "TSTypePredicate":
- return concat$d([n.asserts ? "asserts " : "", path.call(print, "parameterName"), n.typeAnnotation ? concat$d([" is ", path.call(print, "typeAnnotation")]) : ""]);
-
- case "TSNonNullExpression":
- return concat$d([path.call(print, "expression"), "!"]);
-
- case "TSThisType":
- return "this";
-
- case "TSImportType":
- 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")]);
-
- case "TSLiteralType":
- return path.call(print, "literal");
-
- case "TSIndexedAccessType":
- return concat$d([path.call(print, "objectType"), "[", path.call(print, "indexType"), "]"]);
-
- case "TSConstructSignatureDeclaration":
- case "TSCallSignatureDeclaration":
- case "TSConstructorType":
- {
- if (n.type !== "TSCallSignatureDeclaration") {
- parts.push("new ");
- }
-
- parts.push(group$b(printFunctionParams(path, print, options,
- /* expandArg */
- false,
- /* printTypeParams */
- true)));
-
- if (n.returnType || n.typeAnnotation) {
- const isType = n.type === "TSConstructorType";
- parts.push(isType ? " => " : ": ", path.call(print, "returnType"), path.call(print, "typeAnnotation"));
- }
-
- return concat$d(parts);
- }
-
- case "TSTypeOperator":
- return concat$d([n.operator, " ", path.call(print, "typeAnnotation")]);
-
- case "TSMappedType":
- {
- const shouldBreak = hasNewlineInRange$3(options.originalText, options.locStart(n), options.locEnd(n));
- 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,
- /* sameIndent */
- true), options.bracketSpacing ? line$9 : softline$6, "}"]), {
- shouldBreak
- });
- }
-
- case "TSMethodSignature":
- 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,
- /* expandArg */
- false,
- /* printTypeParams */
- true));
-
- if (n.returnType || n.typeAnnotation) {
- parts.push(": ", path.call(print, "returnType"), path.call(print, "typeAnnotation"));
- }
-
- return group$b(concat$d(parts));
-
- case "TSNamespaceExportDeclaration":
- parts.push("export as namespace ", path.call(print, "id"));
-
- if (options.semi) {
- parts.push(";");
- }
-
- return group$b(concat$d(parts));
-
- case "TSEnumDeclaration":
- if (n.declare) {
- parts.push("declare ");
- }
-
- if (n.modifiers) {
- parts.push(printTypeScriptModifiers(path, options, print));
- }
-
- if (n.const) {
- parts.push("const ");
- }
-
- parts.push("enum ", path.call(print, "id"), " ");
-
- if (n.members.length === 0) {
- parts.push(group$b(concat$d(["{", comments.printDanglingComments(path, options), softline$6, "}"])));
- } else {
- 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,
- /* sameIndent */
- true), hardline$9, "}"])));
- }
-
- return concat$d(parts);
-
- case "TSEnumMember":
- parts.push(path.call(print, "id"));
-
- if (n.initializer) {
- parts.push(" = ", path.call(print, "initializer"));
- }
-
- return concat$d(parts);
-
- case "TSImportEqualsDeclaration":
- if (n.isExport) {
- parts.push("export ");
- }
-
- parts.push("import ", path.call(print, "id"), " = ", path.call(print, "moduleReference"));
-
- if (options.semi) {
- parts.push(";");
- }
-
- return group$b(concat$d(parts));
-
- case "TSExternalModuleReference":
- return concat$d(["require(", path.call(print, "expression"), ")"]);
-
- case "TSModuleDeclaration":
- {
- const parent = path.getParentNode();
- const isExternalModule = isLiteral$1(n.id);
- const parentIsDeclaration = parent.type === "TSModuleDeclaration";
- const bodyIsDeclaration = n.body && n.body.type === "TSModuleDeclaration";
-
- if (parentIsDeclaration) {
- parts.push(".");
- } else {
- if (n.declare) {
- parts.push("declare ");
- }
-
- parts.push(printTypeScriptModifiers(path, options, print));
- const textBetweenNodeAndItsId = options.originalText.slice(options.locStart(n), options.locStart(n.id)); // Global declaration looks like this:
- // (declare)? global { ... }
-
- const isGlobalDeclaration = n.id.type === "Identifier" && n.id.name === "global" && !/namespace|module/.test(textBetweenNodeAndItsId);
-
- if (!isGlobalDeclaration) {
- parts.push(isExternalModule || /(^|\s)module(\s|$)/.test(textBetweenNodeAndItsId) ? "module " : "namespace ");
- }
- }
-
- parts.push(path.call(print, "id"));
-
- if (bodyIsDeclaration) {
- parts.push(path.call(print, "body"));
- } else if (n.body) {
- parts.push(" ", group$b(path.call(print, "body")));
- } else {
- parts.push(semi);
- }
-
- return concat$d(parts);
- }
-
- case "PrivateName":
- return concat$d(["#", path.call(print, "id")]);
- // TODO: Temporary auto-generated node type. To remove when typescript-estree has proper support for private fields.
-
- case "TSPrivateIdentifier":
- return n.escapedText;
-
- case "TSConditionalType":
- return printTernaryOperator(path, options, print, {
- beforeParts: () => [path.call(print, "checkType"), " ", "extends", " ", path.call(print, "extendsType")],
- afterParts: () => [],
- shouldCheckJsx: false,
- conditionalNodeType: "TSConditionalType",
- consequentNodePropertyName: "trueType",
- alternateNodePropertyName: "falseType",
- testNodePropertyNames: ["checkType", "extendsType"]
- });
-
- case "TSInferType":
- return concat$d(["infer", " ", path.call(print, "typeParameter")]);
-
- case "InterpreterDirective":
- parts.push("#!", n.value, hardline$9);
-
- if (isNextLineEmpty$4(options.originalText, n, options.locEnd)) {
- parts.push(hardline$9);
- }
-
- return concat$d(parts);
-
- case "NGRoot":
- return concat$d([].concat(path.call(print, "node"), !n.node.comments || n.node.comments.length === 0 ? [] : concat$d([" //", n.node.comments[0].value.trimEnd()])));
-
- case "NGChainedExpression":
- return group$b(join$9(concat$d([";", line$9]), path.map(childPath => hasNgSideEffect$1(childPath) ? print(childPath) : concat$d(["(", print(childPath), ")"]), "expressions")));
-
- case "NGEmptyExpression":
- return "";
-
- case "NGQuotedExpression":
- return concat$d([n.prefix, ": ", n.value.trim()]);
-
- case "NGMicrosyntax":
- return concat$d(path.map((childPath, index) => concat$d([index === 0 ? "" : isNgForOf$1(childPath.getValue(), index, n) ? " " : concat$d([";", line$9]), print(childPath)]), "body"));
-
- case "NGMicrosyntaxKey":
- return /^[a-z_$][a-z0-9_$]*(-[a-z_$][a-z0-9_$])*$/i.test(n.name) ? n.name : JSON.stringify(n.name);
-
- case "NGMicrosyntaxExpression":
- return concat$d([path.call(print, "expression"), n.alias === null ? "" : concat$d([" as ", path.call(print, "alias")])]);
-
- case "NGMicrosyntaxKeyedExpression":
- {
- const index = path.getName();
- const parentNode = path.getParentNode();
- 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";
- return concat$d([path.call(print, "key"), shouldNotPrintColon ? " " : ": ", path.call(print, "expression")]);
- }
-
- case "NGMicrosyntaxLet":
- return concat$d(["let ", path.call(print, "key"), n.value === null ? "" : concat$d([" = ", path.call(print, "value")])]);
-
- case "NGMicrosyntaxAs":
- return concat$d([path.call(print, "key"), " as ", path.call(print, "alias")]);
-
- case "ArgumentPlaceholder":
- return "?";
- // These are not valid TypeScript. Printing them just for the sake of error recovery.
-
- case "TSJSDocAllType":
- return "*";
-
- case "TSJSDocUnknownType":
- return "?";
-
- case "TSJSDocNullableType":
- return concat$d(["?", path.call(print, "typeAnnotation")]);
-
- case "TSJSDocNonNullableType":
- return concat$d(["!", path.call(print, "typeAnnotation")]);
-
- case "TSJSDocFunctionType":
- return concat$d(["function(", // The parameters could be here, but typescript-estree doesn't convert them anyway (throws an error).
- "): ", path.call(print, "typeAnnotation")]);
-
- default:
- /* istanbul ignore next */
- throw new Error("unknown type: " + JSON.stringify(n.type));
- }
- }
-
- function printStatementSequence(path, options, print) {
- const printed = [];
- const bodyNode = path.getNode();
- const isClass = bodyNode.type === "ClassBody";
- path.map((stmtPath, i) => {
- const stmt = stmtPath.getValue(); // Just in case the AST has been modified to contain falsy
- // "statements," it's safer simply to skip them.
-
- /* istanbul ignore if */
-
- if (!stmt) {
- return;
- } // Skip printing EmptyStatement nodes to avoid leaving stray
- // semicolons lying around.
-
-
- if (stmt.type === "EmptyStatement") {
- return;
- }
-
- const stmtPrinted = print(stmtPath);
- const text = options.originalText;
- const parts = []; // in no-semi mode, prepend statement with semicolon if it might break ASI
- // don't prepend the only JSX element in a program with semicolon
-
- if (!options.semi && !isClass && !isTheOnlyJSXElementInMarkdown$1(options, stmtPath) && stmtNeedsASIProtection(stmtPath, options)) {
- if (stmt.comments && stmt.comments.some(comment => comment.leading)) {
- parts.push(print(stmtPath, {
- needsSemi: true
- }));
- } else {
- parts.push(";", stmtPrinted);
- }
- } else {
- parts.push(stmtPrinted);
- }
-
- if (!options.semi && isClass) {
- if (classPropMayCauseASIProblems$1(stmtPath)) {
- parts.push(";");
- } else if (stmt.type === "ClassProperty") {
- const nextChild = bodyNode.body[i + 1];
-
- if (classChildNeedsASIProtection$1(nextChild)) {
- parts.push(";");
- }
- }
- }
-
- if (isNextLineEmpty$4(text, stmt, options.locEnd) && !isLastStatement$1(stmtPath)) {
- parts.push(hardline$9);
- }
-
- printed.push(concat$d(parts));
- });
- return join$9(hardline$9, printed);
- }
-
- function printPropertyKey(path, options, print) {
- const node = path.getNode();
-
- if (node.computed) {
- return concat$d(["[", path.call(print, "key"), "]"]);
- }
-
- const parent = path.getParentNode();
- const {
- key
- } = node;
-
- if (node.type === "ClassPrivateProperty" && // flow has `Identifier` key, and babel has `PrivateName` key
- key.type === "Identifier") {
- return concat$d(["#", path.call(print, "key")]);
- }
-
- if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
- const objectHasStringProp = (parent.properties || parent.body || parent.members).some(prop => !prop.computed && prop.key && isStringLiteral$1(prop.key) && !isStringPropSafeToCoerceToIdentifier$1(prop, options));
- needsQuoteProps.set(parent, objectHasStringProp);
- }
-
- if (key.type === "Identifier" && (options.parser === "json" || options.quoteProps === "consistent" && needsQuoteProps.get(parent))) {
- // a -> "a"
- const prop = printString$2(JSON.stringify(key.name), options);
- return path.call(keyPath => comments.printComments(keyPath, () => prop, options), "key");
- }
-
- if (isStringPropSafeToCoerceToIdentifier$1(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
- // 'a' -> a
- return path.call(keyPath => comments.printComments(keyPath, () => key.value, options), "key");
- }
-
- return path.call(print, "key");
- }
-
- function printMethod(path, options, print) {
- const node = path.getNode();
- const {
- kind
- } = node;
- const value = node.value || node;
- const parts = [];
-
- if (!kind || kind === "init" || kind === "method" || kind === "constructor") {
- if (value.async) {
- parts.push("async ");
- }
-
- if (value.generator) {
- parts.push("*");
- }
- } else {
- assert.ok(kind === "get" || kind === "set");
- parts.push(kind, " ");
- }
-
- 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"));
- return concat$d(parts);
- }
-
- function printMethodInternal(path, options, print) {
- const parts = [printFunctionTypeParameters(path, options, print), group$b(concat$d([printFunctionParams(path, print, options), printReturnType(path, print, options)]))];
-
- if (path.getNode().body) {
- parts.push(" ", path.call(print, "body"));
- } else {
- parts.push(options.semi ? ";" : "");
- }
-
- return concat$d(parts);
- }
-
- function couldGroupArg(arg) {
- 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
- // https://github.com/prettier/prettier/issues/4070
- // export class Thing implements OtherThing {
- // do: (type: Type) => Provider<Prop> = memoize(
- // (type: ObjectType): Provider<Opts> => {}
- // );
- // }
- // https://github.com/prettier/prettier/issues/6099
- // app.get("/", (req, res): void => {
- // res.send("Hello World!");
- // });
- !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));
- }
-
- function shouldGroupLastArg(args) {
- const lastArg = getLast$3(args);
- const penultimateArg = getPenultimate$1(args);
- return !hasLeadingComment$3(lastArg) && !hasTrailingComment$1(lastArg) && couldGroupArg(lastArg) && ( // If the last two arguments are of the same type,
- // disable last element expansion.
- !penultimateArg || penultimateArg.type !== lastArg.type);
- }
-
- function shouldGroupFirstArg(args) {
- if (args.length !== 2) {
- return false;
- }
-
- const [firstArg, secondArg] = args;
- 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);
- }
-
- function printJestEachTemplateLiteral(node, expressions, options) {
- /**
- * a | b | expected
- * ${1} | ${1} | ${2}
- * ${1} | ${2} | ${3}
- * ${2} | ${1} | ${3}
- */
- const headerNames = node.quasis[0].value.raw.trim().split(/\s*\|\s*/);
-
- if (headerNames.length > 1 || headerNames.some(headerName => headerName.length !== 0)) {
- const parts = [];
- const stringifiedExpressions = expressions.map(doc => "${" + printDocToString$2(doc, Object.assign({}, options, {
- printWidth: Infinity,
- endOfLine: "lf"
- })).formatted + "}");
- const tableBody = [{
- hasLineBreak: false,
- cells: []
- }];
-
- for (let i = 1; i < node.quasis.length; i++) {
- const row = tableBody[tableBody.length - 1];
- const correspondingExpression = stringifiedExpressions[i - 1];
- row.cells.push(correspondingExpression);
-
- if (correspondingExpression.includes("\n")) {
- row.hasLineBreak = true;
- }
-
- if (node.quasis[i].value.raw.includes("\n")) {
- tableBody.push({
- hasLineBreak: false,
- cells: []
- });
- }
- }
-
- const maxColumnCount = Math.max(headerNames.length, ...tableBody.map(row => row.cells.length));
- const maxColumnWidths = Array.from({
- length: maxColumnCount
- }).fill(0);
- const table = [{
- cells: headerNames
- }, ...tableBody.filter(row => row.cells.length !== 0)];
-
- for (const {
- cells
- } of table.filter(row => !row.hasLineBreak)) {
- cells.forEach((cell, index) => {
- maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$3(cell));
- });
- }
-
- 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, "`");
- return concat$d(parts);
- }
- }
-
- function printArgumentsList(path, options, print) {
- const node = path.getValue();
- const args = node.arguments;
-
- if (args.length === 0) {
- return concat$d(["(", comments.printDanglingComments(path, options,
- /* sameIndent */
- true), ")"]);
- } // useEffect(() => { ... }, [foo, bar, baz])
-
-
- 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)) {
- return concat$d(["(", path.call(print, "arguments", 0), ", ", path.call(print, "arguments", 1), ")"]);
- } // func(
- // ({
- // a,
- // b
- // }) => {}
- // );
-
-
- function shouldBreakForArrowFunctionInArguments(arg, argPath) {
- if (!arg || arg.type !== "ArrowFunctionExpression" || !arg.body || arg.body.type !== "BlockStatement" || !arg.params || arg.params.length < 1) {
- return false;
- }
-
- let shouldBreak = false;
- argPath.each(paramPath => {
- const printed = concat$d([print(paramPath)]);
- shouldBreak = shouldBreak || willBreak$1(printed);
- }, "params");
- return shouldBreak;
- }
-
- let anyArgEmptyLine = false;
- let shouldBreakForArrowFunction = false;
- let hasEmptyLineFollowingFirstArg = false;
- const lastArgIndex = args.length - 1;
- const printedArguments = path.map((argPath, index) => {
- const arg = argPath.getNode();
- const parts = [print(argPath)];
-
- if (index === lastArgIndex) ; else if (isNextLineEmpty$4(options.originalText, arg, options.locEnd)) {
- if (index === 0) {
- hasEmptyLineFollowingFirstArg = true;
- }
-
- anyArgEmptyLine = true;
- parts.push(",", hardline$9, hardline$9);
- } else {
- parts.push(",", line$9);
- }
-
- shouldBreakForArrowFunction = shouldBreakForArrowFunctionInArguments(arg, argPath);
- return concat$d(parts);
- }, "arguments");
- const maybeTrailingComma = // Dynamic imports cannot have trailing commas
- !(node.callee && node.callee.type === "Import") && shouldPrintComma$1(options, "all") ? "," : "";
-
- function allArgsBrokenOut() {
- return group$b(concat$d(["(", indent$7(concat$d([line$9, concat$d(printedArguments)])), maybeTrailingComma, line$9, ")"]), {
- shouldBreak: true
- });
- }
-
- if (path.getParentNode().type !== "Decorator" && isFunctionCompositionArgs$1(args)) {
- return allArgsBrokenOut();
- }
-
- const shouldGroupFirst = shouldGroupFirstArg(args);
- const shouldGroupLast = shouldGroupLastArg(args);
-
- if (shouldGroupFirst || shouldGroupLast) {
- 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
-
- let printedExpanded;
- let i = 0;
- path.each(argPath => {
- if (shouldGroupFirst && i === 0) {
- printedExpanded = [concat$d([argPath.call(p => print(p, {
- expandFirstArg: true
- })), printedArguments.length > 1 ? "," : "", hasEmptyLineFollowingFirstArg ? hardline$9 : line$9, hasEmptyLineFollowingFirstArg ? hardline$9 : ""])].concat(printedArguments.slice(1));
- }
-
- if (shouldGroupLast && i === args.length - 1) {
- printedExpanded = printedArguments.slice(0, -1).concat(argPath.call(p => print(p, {
- expandLastArg: true
- })));
- }
-
- i++;
- }, "arguments");
- const somePrintedArgumentsWillBreak = printedArguments.some(willBreak$1);
- const simpleConcat = concat$d(["(", concat$d(printedExpanded), ")"]);
- 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], {
- shouldBreak: true
- }), concat$d(printedExpanded.slice(1)), ")"]) : concat$d(["(", concat$d(printedArguments.slice(0, -1)), group$b(getLast$3(printedExpanded), {
- shouldBreak: true
- }), ")"]), allArgsBrokenOut()], {
- shouldBreak
- })]);
- }
-
- const contents = concat$d(["(", indent$7(concat$d([softline$6, concat$d(printedArguments)])), ifBreak$6(maybeTrailingComma), softline$6, ")"]);
-
- if (isLongCurriedCallExpression$1(path)) {
- // By not wrapping the arguments in a group, the printer prioritizes
- // breaking up these arguments rather than the args of the parent call.
- return contents;
- }
-
- return group$b(contents, {
- shouldBreak: printedArguments.some(willBreak$1) || anyArgEmptyLine
- });
- }
-
- function printTypeAnnotation(path, options, print) {
- const node = path.getValue();
-
- if (!node.typeAnnotation) {
- return "";
- }
-
- const parentNode = path.getParentNode();
- const isDefinite = node.definite || parentNode && parentNode.type === "VariableDeclarator" && parentNode.definite;
- const isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node;
-
- if (isFlowAnnotationComment$1(options.originalText, node.typeAnnotation, options)) {
- return concat$d([" /*: ", path.call(print, "typeAnnotation"), " */"]);
- }
-
- return concat$d([isFunctionDeclarationIdentifier ? "" : isDefinite ? "!: " : ": ", path.call(print, "typeAnnotation")]);
- }
-
- function printFunctionTypeParameters(path, options, print) {
- const fun = path.getValue();
-
- if (fun.typeArguments) {
- return path.call(print, "typeArguments");
- }
-
- if (fun.typeParameters) {
- return path.call(print, "typeParameters");
- }
-
- return "";
- }
-
- function printFunctionParams(path, print, options, expandArg, printTypeParams) {
- const fun = path.getValue();
- const parent = path.getParentNode();
- const paramsField = fun.parameters ? "parameters" : "params";
- const isParametersInTestCall = isTestCall$1(parent);
- const shouldHugParameters = shouldHugArguments(fun);
- const shouldExpandParameters = expandArg && !(fun[paramsField] && fun[paramsField].some(n => n.comments));
- const typeParams = printTypeParams ? printFunctionTypeParameters(path, options, print) : "";
- let printed = [];
-
- if (fun[paramsField]) {
- const lastArgIndex = fun[paramsField].length - 1;
- printed = path.map((childPath, index) => {
- const parts = [];
- const param = childPath.getValue();
- parts.push(print(childPath));
-
- if (index === lastArgIndex) {
- if (fun.rest) {
- parts.push(",", line$9);
- }
- } else if (isParametersInTestCall || shouldHugParameters || shouldExpandParameters) {
- parts.push(", ");
- } else if (isNextLineEmpty$4(options.originalText, param, options.locEnd)) {
- parts.push(",", hardline$9, hardline$9);
- } else {
- parts.push(",", line$9);
- }
-
- return concat$d(parts);
- }, paramsField);
- }
-
- if (fun.rest) {
- printed.push(concat$d(["...", path.call(print, "rest")]));
- }
-
- if (printed.length === 0) {
- return concat$d([typeParams, "(", comments.printDanglingComments(path, options,
- /* sameIndent */
- true, comment => getNextNonSpaceNonCommentCharacter$1(options.originalText, comment, options.locEnd) === ")"), ")"]);
- }
-
- const lastParam = getLast$3(fun[paramsField]); // If the parent is a call with the first/last argument expansion and this is the
- // params of the first/last argument, we don't want the arguments to break and instead
- // want the whole expression to be on a new line.
- //
- // Good: Bad:
- // verylongcall( verylongcall((
- // (a, b) => { a,
- // } b,
- // }) ) => {
- // })
-
- if (shouldExpandParameters) {
- return group$b(concat$d([removeLines$2(typeParams), "(", concat$d(printed.map(removeLines$2)), ")"]));
- } // Single object destructuring should hug
- //
- // function({
- // a,
- // b,
- // c
- // }) {}
-
-
- const hasNotParameterDecorator = fun[paramsField].every(param => !param.decorators);
-
- if (shouldHugParameters && hasNotParameterDecorator) {
- return concat$d([typeParams, "(", concat$d(printed), ")"]);
- } // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})`
-
-
- if (isParametersInTestCall) {
- return concat$d([typeParams, "(", concat$d(printed), ")"]);
- }
-
- 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;
-
- if (isFlowShorthandWithOneArg) {
- if (options.arrowParens === "always") {
- return concat$d(["(", concat$d(printed), ")"]);
- }
-
- return concat$d(printed);
- }
-
- const canHaveTrailingComma = !(lastParam && lastParam.type === "RestElement") && !fun.rest;
- return concat$d([typeParams, "(", indent$7(concat$d([softline$6, concat$d(printed)])), ifBreak$6(canHaveTrailingComma && shouldPrintComma$1(options, "all") ? "," : ""), softline$6, ")"]);
- }
-
- function shouldPrintParamsWithoutParens(path, options) {
- if (options.arrowParens === "always") {
- return false;
- }
-
- if (options.arrowParens === "avoid") {
- const node = path.getValue();
- return canPrintParamsWithoutParens(node);
- } // Fallback default; should be unreachable
-
-
- return false;
- }
-
- function canPrintParamsWithoutParens(node) {
- 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;
- }
-
- function printFunctionDeclaration(path, print, options) {
- const n = path.getValue();
- const parts = [];
-
- if (n.async) {
- parts.push("async ");
- }
-
- if (n.generator) {
- parts.push("function* ");
- } else {
- parts.push("function ");
- }
-
- if (n.id) {
- parts.push(path.call(print, "id"));
- }
-
- parts.push(printFunctionTypeParameters(path, options, print), group$b(concat$d([printFunctionParams(path, print, options), printReturnType(path, print, options)])), n.body ? " " : "", path.call(print, "body"));
- return concat$d(parts);
- }
-
- function printReturnType(path, print, options) {
- const n = path.getValue();
- const returnType = path.call(print, "returnType");
-
- if (n.returnType && isFlowAnnotationComment$1(options.originalText, n.returnType, options)) {
- return concat$d([" /*: ", returnType, " */"]);
- }
-
- const parts = [returnType]; // prepend colon to TypeScript type annotation
-
- if (n.returnType && n.returnType.typeAnnotation) {
- parts.unshift(": ");
- }
-
- if (n.predicate) {
- // The return type will already add the colon, but otherwise we
- // need to do it ourselves
- parts.push(n.returnType ? " " : ": ", path.call(print, "predicate"));
- }
-
- return concat$d(parts);
- }
-
- function printExportDeclaration(path, options, print) {
- const decl = path.getValue();
- const semi = options.semi ? ";" : "";
- const parts = ["export "];
- const isDefault = decl.default || decl.type === "ExportDefaultDeclaration";
-
- if (isDefault) {
- parts.push("default ");
- }
-
- parts.push(comments.printDanglingComments(path, options,
- /* sameIndent */
- true));
-
- if (needsHardlineAfterDanglingComment$1(decl)) {
- parts.push(hardline$9);
- }
-
- if (decl.declaration) {
- parts.push(path.call(print, "declaration"));
-
- 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") {
- parts.push(semi);
- }
- } else {
- if (decl.specifiers && decl.specifiers.length > 0) {
- const specifiers = [];
- const defaultSpecifiers = [];
- const namespaceSpecifiers = [];
- path.each(specifierPath => {
- const specifierType = path.getValue().type;
-
- if (specifierType === "ExportSpecifier") {
- specifiers.push(print(specifierPath));
- } else if (specifierType === "ExportDefaultSpecifier") {
- defaultSpecifiers.push(print(specifierPath));
- } else if (specifierType === "ExportNamespaceSpecifier") {
- namespaceSpecifiers.push(concat$d(["* as ", print(specifierPath)]));
- }
- }, "specifiers");
- const isNamespaceFollowed = namespaceSpecifiers.length !== 0 && specifiers.length !== 0;
- const isDefaultFollowed = defaultSpecifiers.length !== 0 && (namespaceSpecifiers.length !== 0 || specifiers.length !== 0);
- const canBreak = specifiers.length > 1 || defaultSpecifiers.length > 0 || decl.specifiers && decl.specifiers.some(node => node.comments);
- let printed = "";
-
- if (specifiers.length !== 0) {
- if (canBreak) {
- 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, "}"]));
- } else {
- printed = concat$d(["{", options.bracketSpacing ? " " : "", concat$d(specifiers), options.bracketSpacing ? " " : "", "}"]);
- }
- }
-
- parts.push(decl.exportKind === "type" ? "type " : "", concat$d(defaultSpecifiers), concat$d([isDefaultFollowed ? ", " : ""]), concat$d(namespaceSpecifiers), concat$d([isNamespaceFollowed ? ", " : ""]), printed);
- } else {
- parts.push("{}");
- }
-
- if (decl.source) {
- parts.push(" from ", path.call(print, "source"));
- }
-
- parts.push(semi);
- }
-
- return concat$d(parts);
- }
-
- function printFlowDeclaration(path, parts) {
- const parentExportDecl = getParentExportDeclaration$1(path);
-
- if (parentExportDecl) {
- assert.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
- } else {
- // If the parent node has type DeclareExportDeclaration, then it
- // will be responsible for printing the "declare" token. Otherwise
- // it needs to be printed with this non-exported declaration node.
- parts.unshift("declare ");
- }
-
- return concat$d(parts);
- }
-
- function printTypeScriptModifiers(path, options, print) {
- const n = path.getValue();
-
- if (!n.modifiers || !n.modifiers.length) {
- return "";
- }
-
- return concat$d([join$9(" ", path.map(print, "modifiers")), " "]);
- }
-
- function printTypeParameters(path, options, print, paramsKey) {
- const n = path.getValue();
-
- if (!n[paramsKey]) {
- return "";
- } // for TypeParameterDeclaration typeParameters is a single node
-
-
- if (!Array.isArray(n[paramsKey])) {
- return path.call(print, paramsKey);
- }
-
- const grandparent = path.getNode(2);
- const greatGrandParent = path.getNode(3);
- const greatGreatGrandParent = path.getNode(4);
- const isParameterInTestCall = grandparent != null && isTestCall$1(grandparent);
- 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.
- 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");
-
- function printDanglingCommentsForInline(n) {
- if (!hasDanglingComments$1(n)) {
- return "";
- }
-
- const hasOnlyBlockComments = n.comments.every(comments$1.isBlockComment);
- const printed = comments.printDanglingComments(path, options,
- /* sameIndent */
- hasOnlyBlockComments);
-
- if (hasOnlyBlockComments) {
- return printed;
- }
-
- return concat$d([printed, hardline$9]);
- }
-
- if (shouldInline) {
- return concat$d(["<", join$9(", ", path.map(print, paramsKey)), printDanglingCommentsForInline(n), ">"]);
- }
-
- 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, ">"]));
- }
-
- function printClass(path, options, print) {
- const n = path.getValue();
- const parts = [];
-
- if (n.abstract) {
- parts.push("abstract ");
- }
-
- parts.push("class");
-
- if (n.id) {
- parts.push(" ", path.call(print, "id"));
- }
-
- parts.push(path.call(print, "typeParameters"));
- const partsGroup = [];
-
- if (n.superClass) {
- const printed = concat$d(["extends ", path.call(print, "superClass"), path.call(print, "superTypeParameters")]); // Keep old behaviour of extends in same line
- // If there is only on extends and there are not comments
-
- if ((!n.implements || n.implements.length === 0) && (!n.superClass.comments || n.superClass.comments.length === 0)) {
- parts.push(concat$d([" ", path.call(superClass => comments.printComments(superClass, () => printed, options), "superClass")]));
- } else {
- partsGroup.push(group$b(concat$d([line$9, path.call(superClass => comments.printComments(superClass, () => printed, options), "superClass")])));
- }
- } else if (n.extends && n.extends.length > 0) {
- parts.push(" extends ", join$9(", ", path.map(print, "extends")));
- }
-
- if (n.mixins && n.mixins.length > 0) {
- partsGroup.push(line$9, "mixins ", group$b(indent$7(join$9(concat$d([",", line$9]), path.map(print, "mixins")))));
- }
-
- if (n.implements && n.implements.length > 0) {
- partsGroup.push(line$9, "implements", group$b(indent$7(concat$d([line$9, join$9(concat$d([",", line$9]), path.map(print, "implements"))]))));
- }
-
- if (partsGroup.length > 0) {
- parts.push(group$b(indent$7(concat$d(partsGroup))));
- }
-
- if (n.body && n.body.comments && hasLeadingOwnLineComment$1(options.originalText, n.body, options)) {
- parts.push(hardline$9);
- } else {
- parts.push(" ");
- }
-
- parts.push(path.call(print, "body"));
- return parts;
- }
-
- function printOptionalToken(path) {
- const node = path.getValue();
-
- if (!node.optional || // It's an optional computed method parsed by typescript-estree.
- // "?" is printed in `printMethod`.
- node.type === "Identifier" && node === path.getParentNode().key) {
- return "";
- }
-
- if (node.type === "OptionalCallExpression" || node.type === "OptionalMemberExpression" && node.computed) {
- return "?.";
- }
-
- return "?";
- }
-
- function printMemberLookup(path, options, print) {
- const property = path.call(print, "property");
- const n = path.getValue();
- const optional = printOptionalToken(path);
-
- if (!n.computed) {
- return concat$d([optional, ".", property]);
- }
-
- if (!n.property || isNumericLiteral$1(n.property)) {
- return concat$d([optional, "[", property, "]"]);
- }
-
- return group$b(concat$d([optional, "[", indent$7(concat$d([softline$6, property])), softline$6, "]"]));
- }
-
- function printBindExpressionCallee(path, options, print) {
- return concat$d(["::", path.call(print, "callee")]);
- } // We detect calls on member expressions specially to format a
- // common pattern better. The pattern we are looking for is this:
- //
- // arr
- // .map(x => x + 1)
- // .filter(x => x > 10)
- // .some(x => x % 2)
- //
- // The way it is structured in the AST is via a nested sequence of
- // MemberExpression and CallExpression. We need to traverse the AST
- // and make groups out of it to print it in the desired way.
-
-
- function printMemberChain(path, options, print) {
- // The first phase is to linearize the AST by traversing it down.
- //
- // a().b()
- // has the following AST structure:
- // CallExpression(MemberExpression(CallExpression(Identifier)))
- // and we transform it into
- // [Identifier, CallExpression, MemberExpression, CallExpression]
- const printedNodes = []; // Here we try to retain one typed empty line after each call expression or
- // the first group whether it is in parentheses or not
-
- function shouldInsertEmptyLineAfter(node) {
- const {
- originalText
- } = options;
- const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex$3(originalText, node, options.locEnd);
- const nextChar = originalText.charAt(nextCharIndex); // if it is cut off by a parenthesis, we only account for one typed empty
- // line after that parenthesis
-
- if (nextChar === ")") {
- return isNextLineEmptyAfterIndex$2(originalText, nextCharIndex + 1, options.locEnd);
- }
-
- return isNextLineEmpty$4(originalText, node, options.locEnd);
- }
-
- function rec(path) {
- const node = path.getValue();
-
- if ((node.type === "CallExpression" || node.type === "OptionalCallExpression") && (isMemberish$1(node.callee) || node.callee.type === "CallExpression" || node.callee.type === "OptionalCallExpression")) {
- printedNodes.unshift({
- node,
- printed: concat$d([comments.printComments(path, () => concat$d([printOptionalToken(path), printFunctionTypeParameters(path, options, print), printArgumentsList(path, options, print)]), options), shouldInsertEmptyLineAfter(node) ? hardline$9 : ""])
- });
- path.call(callee => rec(callee), "callee");
- } else if (isMemberish$1(node)) {
- printedNodes.unshift({
- node,
- needsParens: needsParens_1(path, options),
- printed: comments.printComments(path, () => node.type === "OptionalMemberExpression" || node.type === "MemberExpression" ? printMemberLookup(path, options, print) : printBindExpressionCallee(path, options, print), options)
- });
- path.call(object => rec(object), "object");
- } else if (node.type === "TSNonNullExpression") {
- printedNodes.unshift({
- node,
- printed: comments.printComments(path, () => "!", options)
- });
- path.call(expression => rec(expression), "expression");
- } else {
- printedNodes.unshift({
- node,
- printed: path.call(print)
- });
- }
- } // Note: the comments of the root node have already been printed, so we
- // need to extract this first call without printing them as they would
- // if handled inside of the recursive call.
-
-
- const node = path.getValue();
- printedNodes.unshift({
- node,
- printed: concat$d([printOptionalToken(path), printFunctionTypeParameters(path, options, print), printArgumentsList(path, options, print)])
- });
- path.call(callee => rec(callee), "callee"); // Once we have a linear list of printed nodes, we want to create groups out
- // of it.
- //
- // a().b.c().d().e
- // will be grouped as
- // [
- // [Identifier, CallExpression],
- // [MemberExpression, MemberExpression, CallExpression],
- // [MemberExpression, CallExpression],
- // [MemberExpression],
- // ]
- // so that we can print it as
- // a()
- // .b.c()
- // .d()
- // .e
- // The first group is the first node followed by
- // - as many CallExpression as possible
- // < fn()()() >.something()
- // - as many array accessors as possible
- // < fn()[0][1][2] >.something()
- // - then, as many MemberExpression as possible but the last one
- // < this.items >.something()
-
- const groups = [];
- let currentGroup = [printedNodes[0]];
- let i = 1;
-
- for (; i < printedNodes.length; ++i) {
- 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)) {
- currentGroup.push(printedNodes[i]);
- } else {
- break;
- }
- }
-
- if (printedNodes[0].node.type !== "CallExpression" && printedNodes[0].node.type !== "OptionalCallExpression") {
- for (; i + 1 < printedNodes.length; ++i) {
- if (isMemberish$1(printedNodes[i].node) && isMemberish$1(printedNodes[i + 1].node)) {
- currentGroup.push(printedNodes[i]);
- } else {
- break;
- }
- }
- }
-
- groups.push(currentGroup);
- currentGroup = []; // Then, each following group is a sequence of MemberExpression followed by
- // a sequence of CallExpression. To compute it, we keep adding things to the
- // group until we has seen a CallExpression in the past and reach a
- // MemberExpression
-
- let hasSeenCallExpression = false;
-
- for (; i < printedNodes.length; ++i) {
- if (hasSeenCallExpression && isMemberish$1(printedNodes[i].node)) {
- // [0] should be appended at the end of the group instead of the
- // beginning of the next one
- if (printedNodes[i].node.computed && isNumericLiteral$1(printedNodes[i].node.property)) {
- currentGroup.push(printedNodes[i]);
- continue;
- }
-
- groups.push(currentGroup);
- currentGroup = [];
- hasSeenCallExpression = false;
- }
-
- if (printedNodes[i].node.type === "CallExpression" || printedNodes[i].node.type === "OptionalCallExpression") {
- hasSeenCallExpression = true;
- }
-
- currentGroup.push(printedNodes[i]);
-
- if (printedNodes[i].node.comments && printedNodes[i].node.comments.some(comment => comment.trailing)) {
- groups.push(currentGroup);
- currentGroup = [];
- hasSeenCallExpression = false;
- }
- }
-
- if (currentGroup.length > 0) {
- groups.push(currentGroup);
- } // There are cases like Object.keys(), Observable.of(), _.values() where
- // they are the subject of all the chained calls and therefore should
- // be kept on the same line:
- //
- // Object.keys(items)
- // .filter(x => x)
- // .map(x => x)
- //
- // In order to detect those cases, we use an heuristic: if the first
- // node is an identifier with the name starting with a capital
- // letter or just a sequence of _$. The rationale is that they are
- // likely to be factories.
-
-
- function isFactory(name) {
- return /^[A-Z]|^[_$]+$/.test(name);
- } // In case the Identifier is shorter than tab width, we can keep the
- // first call in a single line, if it's an ExpressionStatement.
- //
- // d3.scaleLinear()
- // .domain([0, 100])
- // .range([0, width]);
- //
-
-
- function isShort(name) {
- return name.length <= options.tabWidth;
- }
-
- function shouldNotWrap(groups) {
- const parent = path.getParentNode();
- const isExpression = parent && parent.type === "ExpressionStatement";
- const hasComputed = groups[1].length && groups[1][0].node.computed;
-
- if (groups[0].length === 1) {
- const firstNode = groups[0][0].node;
- return firstNode.type === "ThisExpression" || firstNode.type === "Identifier" && (isFactory(firstNode.name) || isExpression && isShort(firstNode.name) || hasComputed);
- }
-
- const lastNode = getLast$3(groups[0]).node;
- return (lastNode.type === "MemberExpression" || lastNode.type === "OptionalMemberExpression") && lastNode.property.type === "Identifier" && (isFactory(lastNode.property.name) || hasComputed);
- }
-
- const shouldMerge = groups.length >= 2 && !groups[1][0].node.comments && shouldNotWrap(groups);
-
- function printGroup(printedGroup) {
- const printed = printedGroup.map(tuple => tuple.printed); // Checks if the last node (i.e. the parent node) needs parens and print
- // accordingly
-
- if (printedGroup.length > 0 && printedGroup[printedGroup.length - 1].needsParens) {
- return concat$d(["(", ...printed, ")"]);
- }
-
- return concat$d(printed);
- }
-
- function printIndentedGroup(groups) {
- if (groups.length === 0) {
- return "";
- }
-
- return indent$7(group$b(concat$d([hardline$9, join$9(hardline$9, groups.map(printGroup))])));
- }
-
- const printedGroups = groups.map(printGroup);
- const oneLine = concat$d(printedGroups);
- const cutoff = shouldMerge ? 3 : 2;
- const flatGroups = groups.reduce((res, group) => res.concat(group), []);
- 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
- // render everything concatenated together.
-
- if (groups.length <= cutoff && !hasComment) {
- if (isLongCurriedCallExpression$1(path)) {
- return oneLine;
- }
-
- return group$b(oneLine);
- } // Find out the last node in the first group and check if it has an
- // empty line after
-
-
- const lastNodeBeforeIndent = getLast$3(shouldMerge ? groups.slice(1, 2)[0] : groups[0]).node;
- const shouldHaveEmptyLineBeforeIndent = lastNodeBeforeIndent.type !== "CallExpression" && lastNodeBeforeIndent.type !== "OptionalCallExpression" && shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
- 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))]);
- const callExpressions = printedNodes.map(({
- node
- }) => node).filter(isCallOrOptionalCallExpression$1); // We don't want to print in one line if the chain has:
- // * A comment.
- // * Non-trivial arguments.
- // * Any group but the last one has a hard line.
- // If the last group is a function it's okay to inline if it fits.
-
- if (hasComment || callExpressions.length > 2 && callExpressions.some(expr => !expr.arguments.every(arg => isSimpleCallArgument$1(arg, 0))) || printedGroups.slice(0, -1).some(willBreak$1) ||
- /**
- * scopes.filter(scope => scope.value !== '').map((scope, i) => {
- * // multi line content
- * })
- */
- ((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))) {
- return group$b(expanded);
- }
-
- return concat$d([// We only need to check `oneLine` because if `expanded` is chosen
- // that means that the parent group has already been broken
- // naturally
- willBreak$1(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent$3 : "", conditionalGroup$1([oneLine, expanded])]);
- }
-
- function separatorNoWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
- if (isFacebookTranslationTag) {
- return "";
- }
-
- if (childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement) {
- return child.length === 1 ? softline$6 : hardline$9;
- }
-
- return softline$6;
- }
-
- function separatorWithWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
- if (isFacebookTranslationTag) {
- return hardline$9;
- }
-
- if (child.length === 1) {
- return childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement ? hardline$9 : softline$6;
- }
-
- return hardline$9;
- } // JSX Children are strange, mostly for two reasons:
- // 1. JSX reads newlines into string values, instead of skipping them like JS
- // 2. up to one whitespace between elements within a line is significant,
- // but not between lines.
- //
- // Leading, trailing, and lone whitespace all need to
- // turn themselves into the rather ugly `{' '}` when breaking.
- //
- // We print JSX using the `fill` doc primitive.
- // This requires that we give it an array of alternating
- // content and whitespace elements.
- // To ensure this we add dummy `""` content elements as needed.
-
-
- function printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag) {
- const n = path.getValue();
- const children = []; // using `map` instead of `each` because it provides `i`
-
- path.map((childPath, i) => {
- const child = childPath.getValue();
-
- if (isLiteral$1(child)) {
- const text = rawText$1(child); // Contains a non-whitespace character
-
- if (isMeaningfulJSXText$1(child)) {
- const words = text.split(matchJsxWhitespaceRegex$1); // Starts with whitespace
-
- if (words[0] === "") {
- children.push("");
- words.shift();
-
- if (/\n/.test(words[0])) {
- const next = n.children[i + 1];
- children.push(separatorWithWhitespace(isFacebookTranslationTag, words[1], child, next));
- } else {
- children.push(jsxWhitespace);
- }
-
- words.shift();
- }
-
- let endWhitespace; // Ends with whitespace
-
- if (getLast$3(words) === "") {
- words.pop();
- endWhitespace = words.pop();
- } // This was whitespace only without a new line.
-
-
- if (words.length === 0) {
- return;
- }
-
- words.forEach((word, i) => {
- if (i % 2 === 1) {
- children.push(line$9);
- } else {
- children.push(word);
- }
- });
-
- if (endWhitespace !== undefined) {
- if (/\n/.test(endWhitespace)) {
- const next = n.children[i + 1];
- children.push(separatorWithWhitespace(isFacebookTranslationTag, getLast$3(children), child, next));
- } else {
- children.push(jsxWhitespace);
- }
- } else {
- const next = n.children[i + 1];
- children.push(separatorNoWhitespace(isFacebookTranslationTag, getLast$3(children), child, next));
- }
- } else if (/\n/.test(text)) {
- // Keep (up to one) blank line between tags/expressions/text.
- // Note: We don't keep blank lines between text elements.
- if (text.match(/\n/g).length > 1) {
- children.push("");
- children.push(hardline$9);
- }
- } else {
- children.push("");
- children.push(jsxWhitespace);
- }
- } else {
- const printedChild = print(childPath);
- children.push(printedChild);
- const next = n.children[i + 1];
- const directlyFollowedByMeaningfulText = next && isMeaningfulJSXText$1(next);
-
- if (directlyFollowedByMeaningfulText) {
- const firstWord = rawText$1(next).trim().split(matchJsxWhitespaceRegex$1)[0];
- children.push(separatorNoWhitespace(isFacebookTranslationTag, firstWord, child, next));
- } else {
- children.push(hardline$9);
- }
- }
- }, "children");
- return children;
- } // JSX expands children from the inside-out, instead of the outside-in.
- // This is both to break children before attributes,
- // and to ensure that when children break, their parents do as well.
- //
- // Any element that is written without any newlines and fits on a single line
- // is left that way.
- // Not only that, any user-written-line containing multiple JSX siblings
- // should also be kept on one line if possible,
- // so each user-written-line is wrapped in its own group.
- //
- // Elements that contain newlines or don't fit on a single line (recursively)
- // are fully-split, using hardline and shouldBreak: true.
- //
- // To support that case properly, all leading and trailing spaces
- // are stripped from the list of children, and replaced with a single hardline.
-
-
- function printJSXElement(path, options, print) {
- const n = path.getValue();
-
- if (n.type === "JSXElement" && isEmptyJSXElement$1(n)) {
- return concat$d([path.call(print, "openingElement"), path.call(print, "closingElement")]);
- }
-
- const openingLines = n.type === "JSXElement" ? path.call(print, "openingElement") : path.call(print, "openingFragment");
- const closingLines = n.type === "JSXElement" ? path.call(print, "closingElement") : path.call(print, "closingFragment");
-
- if (n.children.length === 1 && n.children[0].type === "JSXExpressionContainer" && (n.children[0].expression.type === "TemplateLiteral" || n.children[0].expression.type === "TaggedTemplateExpression")) {
- return concat$d([openingLines, concat$d(path.map(print, "children")), closingLines]);
- } // Convert `{" "}` to text nodes containing a space.
- // This makes it easy to turn them into `jsxWhitespace` which
- // can then print as either a space or `{" "}` when breaking.
-
-
- n.children = n.children.map(child => {
- if (isJSXWhitespaceExpression$1(child)) {
- return {
- type: "JSXText",
- value: " ",
- raw: " "
- };
- }
-
- return child;
- });
- const containsTag = n.children.filter(isJSXNode$1).length > 0;
- const containsMultipleExpressions = n.children.filter(child => child.type === "JSXExpressionContainer").length > 1;
- const containsMultipleAttributes = n.type === "JSXElement" && n.openingElement.attributes.length > 1; // Record any breaks. Should never go from true to false, only false to true.
-
- let forcedBreak = willBreak$1(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions;
- const isMdxBlock = path.getParentNode().rootMarker === "mdx";
- const rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
- const jsxWhitespace = isMdxBlock ? concat$d([" "]) : ifBreak$6(concat$d([rawJsxWhitespace, softline$6]), " ");
- const isFacebookTranslationTag = n.openingElement && n.openingElement.name && n.openingElement.name.name === "fbt";
- const children = printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag);
- const containsText = n.children.some(child => isMeaningfulJSXText$1(child)); // We can end up we multiple whitespace elements with empty string
- // content between them.
- // We need to remove empty whitespace and softlines before JSX whitespace
- // to get the correct output.
-
- for (let i = children.length - 2; i >= 0; i--) {
- const isPairOfEmptyStrings = children[i] === "" && children[i + 1] === "";
- const isPairOfHardlines = children[i] === hardline$9 && children[i + 1] === "" && children[i + 2] === hardline$9;
- const isLineFollowedByJSXWhitespace = (children[i] === softline$6 || children[i] === hardline$9) && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
- const isJSXWhitespaceFollowedByLine = children[i] === jsxWhitespace && children[i + 1] === "" && (children[i + 2] === softline$6 || children[i + 2] === hardline$9);
- const isDoubleJSXWhitespace = children[i] === jsxWhitespace && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
- 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;
-
- if (isPairOfHardlines && containsText || isPairOfEmptyStrings || isLineFollowedByJSXWhitespace || isDoubleJSXWhitespace || isPairOfHardOrSoftLines) {
- children.splice(i, 2);
- } else if (isJSXWhitespaceFollowedByLine) {
- children.splice(i + 1, 2);
- }
- } // Trim trailing lines (or empty strings)
-
-
- while (children.length && (isLineNext$1(getLast$3(children)) || isEmpty$1(getLast$3(children)))) {
- children.pop();
- } // Trim leading lines (or empty strings)
-
-
- while (children.length && (isLineNext$1(children[0]) || isEmpty$1(children[0])) && (isLineNext$1(children[1]) || isEmpty$1(children[1]))) {
- children.shift();
- children.shift();
- } // Tweak how we format children if outputting this element over multiple lines.
- // Also detect whether we will force this element to output over multiple lines.
-
-
- const multilineChildren = [];
- children.forEach((child, i) => {
- // There are a number of situations where we need to ensure we display
- // whitespace as `{" "}` when outputting this element over multiple lines.
- if (child === jsxWhitespace) {
- if (i === 1 && children[i - 1] === "") {
- if (children.length === 2) {
- // Solitary whitespace
- multilineChildren.push(rawJsxWhitespace);
- return;
- } // Leading whitespace
-
-
- multilineChildren.push(concat$d([rawJsxWhitespace, hardline$9]));
- return;
- } else if (i === children.length - 1) {
- // Trailing whitespace
- multilineChildren.push(rawJsxWhitespace);
- return;
- } else if (children[i - 1] === "" && children[i - 2] === hardline$9) {
- // Whitespace after line break
- multilineChildren.push(rawJsxWhitespace);
- return;
- }
- }
-
- multilineChildren.push(child);
-
- if (willBreak$1(child)) {
- forcedBreak = true;
- }
- }); // If there is text we use `fill` to fit as much onto each line as possible.
- // When there is no text (just tags and expressions) we use `group`
- // to output each on a separate line.
-
- const content = containsText ? fill$4(multilineChildren) : group$b(concat$d(multilineChildren), {
- shouldBreak: true
- });
-
- if (isMdxBlock) {
- return content;
- }
-
- const multiLineElem = group$b(concat$d([openingLines, indent$7(concat$d([hardline$9, content])), hardline$9, closingLines]));
-
- if (forcedBreak) {
- return multiLineElem;
- }
-
- return conditionalGroup$1([group$b(concat$d([openingLines, concat$d(children), closingLines])), multiLineElem]);
- }
-
- function maybeWrapJSXElementInParens(path, elem, options) {
- const parent = path.getParentNode();
-
- if (!parent) {
- return elem;
- }
-
- const NO_WRAP_PARENTS = {
- ArrayExpression: true,
- JSXAttribute: true,
- JSXElement: true,
- JSXExpressionContainer: true,
- JSXFragment: true,
- ExpressionStatement: true,
- CallExpression: true,
- OptionalCallExpression: true,
- ConditionalExpression: true,
- JsExpressionRoot: true
- };
-
- if (NO_WRAP_PARENTS[parent.type]) {
- return elem;
- }
-
- const shouldBreak = path.match(undefined, node => node.type === "ArrowFunctionExpression", isCallOrOptionalCallExpression$1, node => node.type === "JSXExpressionContainer");
- const needsParens = needsParens_1(path, options);
- return group$b(concat$d([needsParens ? "" : ifBreak$6("("), indent$7(concat$d([softline$6, elem])), softline$6, needsParens ? "" : ifBreak$6(")")]), {
- shouldBreak
- });
- }
-
- function shouldInlineLogicalExpression(node) {
- if (node.type !== "LogicalExpression") {
- return false;
- }
-
- if (node.right.type === "ObjectExpression" && node.right.properties.length !== 0) {
- return true;
- }
-
- if (node.right.type === "ArrayExpression" && node.right.elements.length !== 0) {
- return true;
- }
-
- if (isJSXNode$1(node.right)) {
- return true;
- }
-
- return false;
- } // For binary expressions to be consistent, we need to group
- // subsequent operators with the same precedence level under a single
- // group. Otherwise they will be nested such that some of them break
- // onto new lines but not all. Operators with the same precedence
- // level should either all break or not. Because we group them by
- // precedence level and the AST is structured based on precedence
- // level, things are naturally broken up correctly, i.e. `&&` is
- // broken before `+`.
-
-
- function printBinaryishExpressions(path, print, options, isNested, isInsideParenthesis) {
- let parts = [];
- const node = path.getValue(); // We treat BinaryExpression and LogicalExpression nodes the same.
-
- if (isBinaryish$1(node)) {
- // Put all operators with the same precedence level in the same
- // group. The reason we only need to do this with the `left`
- // expression is because given an expression like `1 + 2 - 3`, it
- // is always parsed like `((1 + 2) - 3)`, meaning the `left` side
- // is where the rest of the expression will exist. Binary
- // expressions on the right side mean they have a difference
- // precedence level and should be treated as a separate group, so
- // print them normally. (This doesn't hold for the `**` operator,
- // which is unique in that it is right-associative.)
- if (shouldFlatten$1(node.operator, node.left.operator)) {
- // Flatten them out by recursively calling this function.
- parts = parts.concat(path.call(left => printBinaryishExpressions(left, print, options,
- /* isNested */
- true, isInsideParenthesis), "left"));
- } else {
- parts.push(path.call(print, "left"));
- }
-
- const shouldInline = shouldInlineLogicalExpression(node);
- const lineBeforeOperator = (node.operator === "|>" || node.type === "NGPipeExpression" || node.operator === "|" && options.parser === "__vue_expression") && !hasLeadingOwnLineComment$1(options.originalText, node.right, options);
- const operator = node.type === "NGPipeExpression" ? "|" : node.operator;
- 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))))]))) : "";
- 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
- // in order to avoid having a small right part like -1 be on its own line.
-
- const parent = path.getParentNode();
- const shouldGroup = !(isInsideParenthesis && node.type === "LogicalExpression") && parent.type !== node.type && node.left.type !== node.type && node.right.type !== node.type;
- parts.push(" ", shouldGroup ? group$b(right) : right); // The root comments are already printed, but we need to manually print
- // the other ones since we don't call the normal print on BinaryExpression,
- // only for the left and right parts
-
- if (isNested && node.comments) {
- parts = comments.printComments(path, () => concat$d(parts), options);
- }
- } else {
- // Our stopping case. Simply print the node normally.
- parts.push(path.call(print));
- }
-
- return parts;
- }
-
- function printAssignmentRight(leftNode, rightNode, printedRight, options) {
- if (hasLeadingOwnLineComment$1(options.originalText, rightNode, options)) {
- return indent$7(concat$d([line$9, printedRight]));
- }
-
- 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
- options.parser !== "json" && options.parser !== "json5" || rightNode.type === "SequenceExpression";
-
- if (canBreak) {
- return group$b(indent$7(concat$d([line$9, printedRight])));
- }
-
- return concat$d([" ", printedRight]);
- }
-
- function printAssignment(leftNode, printedLeft, operator, rightNode, printedRight, options) {
- if (!rightNode) {
- return printedLeft;
- }
-
- const printed = printAssignmentRight(leftNode, rightNode, printedRight, options);
- return group$b(concat$d([printedLeft, operator, printed]));
- }
-
- function adjustClause(node, clause, forceSpace) {
- if (node.type === "EmptyStatement") {
- return ";";
- }
-
- if (node.type === "BlockStatement" || forceSpace) {
- return concat$d([" ", clause]);
- }
-
- return indent$7(concat$d([line$9, clause]));
- }
-
- function nodeStr(node, options, isFlowOrTypeScriptDirectiveLiteral) {
- const raw = rawText$1(node);
- const isDirectiveLiteral = isFlowOrTypeScriptDirectiveLiteral || node.type === "DirectiveLiteral";
- return printString$2(raw, options, isDirectiveLiteral);
- }
-
- function printRegex(node) {
- const flags = node.flags.split("").sort().join("");
- return "/".concat(node.pattern, "/").concat(flags);
- }
-
- function exprNeedsASIProtection(path, options) {
- const node = path.getValue();
- 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;
-
- if (maybeASIProblem) {
- return true;
- }
-
- if (!hasNakedLeftSide$2(node)) {
- return false;
- }
-
- return path.call(childPath => exprNeedsASIProtection(childPath, options), ...getLeftSidePathName$2(path, node));
- }
-
- function stmtNeedsASIProtection(path, options) {
- const node = path.getNode();
-
- if (node.type !== "ExpressionStatement") {
- return false;
- }
-
- return path.call(childPath => exprNeedsASIProtection(childPath, options), "expression");
- }
-
- function shouldHugType(node) {
- if (isSimpleFlowType$1(node) || isObjectType$1(node)) {
- return true;
- }
-
- if (node.type === "UnionTypeAnnotation" || node.type === "TSUnionType") {
- const voidCount = node.types.filter(n => n.type === "VoidTypeAnnotation" || n.type === "TSVoidKeyword" || n.type === "NullLiteralTypeAnnotation" || n.type === "TSNullKeyword").length;
- const hasObject = node.types.some(n => n.type === "ObjectTypeAnnotation" || n.type === "TSTypeLiteral" || // This is a bit aggressive but captures Array<{x}>
- n.type === "GenericTypeAnnotation" || n.type === "TSTypeReference");
-
- if (node.types.length - 1 === voidCount && hasObject) {
- return true;
- }
- }
-
- return false;
- }
-
- function shouldHugArguments(fun) {
- if (!fun || fun.rest) {
- return false;
- }
-
- const params = fun.params || fun.parameters;
-
- if (!params || params.length !== 1) {
- return false;
- }
-
- const param = params[0];
- 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));
- }
-
- function printArrayItems(path, options, printPath, print) {
- const printedElements = [];
- let separatorParts = [];
- path.each(childPath => {
- printedElements.push(concat$d(separatorParts));
- printedElements.push(group$b(print(childPath)));
- separatorParts = [",", line$9];
-
- if (childPath.getValue() && isNextLineEmpty$4(options.originalText, childPath.getValue(), options.locEnd)) {
- separatorParts.push(softline$6);
- }
- }, printPath);
- return concat$d(printedElements);
- }
-
- function printReturnAndThrowArgument(path, options, print) {
- const node = path.getValue();
- const semi = options.semi ? ";" : "";
- const parts = [];
-
- if (node.argument) {
- if (returnArgumentHasLeadingComment$1(options, node.argument)) {
- parts.push(concat$d([" (", indent$7(concat$d([hardline$9, path.call(print, "argument")])), hardline$9, ")"]));
- } else if (isBinaryish$1(node.argument) || node.argument.type === "SequenceExpression") {
- parts.push(group$b(concat$d([ifBreak$6(" (", " "), indent$7(concat$d([softline$6, path.call(print, "argument")])), softline$6, ifBreak$6(")")])));
- } else {
- parts.push(" ", path.call(print, "argument"));
- }
- }
-
- const lastComment = Array.isArray(node.comments) && node.comments[node.comments.length - 1];
- const isLastCommentLine = lastComment && (lastComment.type === "CommentLine" || lastComment.type === "Line");
-
- if (isLastCommentLine) {
- parts.push(semi);
- }
-
- if (hasDanglingComments$1(node)) {
- parts.push(" ", comments.printDanglingComments(path, options,
- /* sameIndent */
- true));
- }
-
- if (!isLastCommentLine) {
- parts.push(semi);
- }
-
- return concat$d(parts);
- }
-
- function willPrintOwnComments(path
- /*, options */
- ) {
- const node = path.getValue();
- const parent = path.getParentNode();
- 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");
- }
-
- function canAttachComment$1(node) {
- return node.type && node.type !== "CommentBlock" && node.type !== "CommentLine" && node.type !== "Line" && node.type !== "Block" && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import";
- }
-
- function printComment$2(commentPath, options) {
- const comment = commentPath.getValue();
-
- switch (comment.type) {
- case "CommentBlock":
- case "Block":
- {
- if (isIndentableBlockComment(comment)) {
- const printed = printIndentableBlockComment(comment); // We need to prevent an edge case of a previous trailing comment
- // printed as a `lineSuffix` which causes the comments to be
- // interleaved. See https://github.com/prettier/prettier/issues/4412
-
- if (comment.trailing && !hasNewline$5(options.originalText, options.locStart(comment), {
- backwards: true
- })) {
- return concat$d([hardline$9, printed]);
- }
-
- return printed;
- }
-
- const commentEnd = options.locEnd(comment);
- const isInsideFlowComment = options.originalText.slice(commentEnd - 3, commentEnd) === "*-/";
- return "/*" + comment.value + (isInsideFlowComment ? "*-/" : "*/");
- }
-
- case "CommentLine":
- case "Line":
- // Print shebangs with the proper comment characters
- if (options.originalText.slice(options.locStart(comment)).startsWith("#!")) {
- return "#!" + comment.value.trimEnd();
- }
-
- return "//" + comment.value.trimEnd();
-
- default:
- throw new Error("Not a comment: " + JSON.stringify(comment));
- }
- }
-
- function isIndentableBlockComment(comment) {
- // If the comment has multiple lines and every line starts with a star
- // we can fix the indentation of each line. The stars in the `/*` and
- // `*/` delimiters are not included in the comment value, so add them
- // back first.
- const lines = "*".concat(comment.value, "*").split("\n");
- return lines.length > 1 && lines.every(line => line.trim()[0] === "*");
- }
-
- function printIndentableBlockComment(comment) {
- const lines = comment.value.split("\n");
- return concat$d(["/*", join$9(hardline$9, lines.map((line, index) => index === 0 ? line.trimEnd() : " " + (index < lines.length - 1 ? line.trim() : line.trimStart()))), "*/"]);
- }
-
- var printerEstree = {
- preprocess: preprocess_1$1,
- print: genericPrint$3,
- embed: embed_1$1,
- insertPragma: insertPragma$7,
- massageAstNode: clean_1$1,
- hasPrettierIgnore: hasPrettierIgnore$5,
- willPrintOwnComments,
- canAttachComment: canAttachComment$1,
- printComment: printComment$2,
- isBlockComment: comments$1.isBlockComment,
- handleComments: {
- ownLine: comments$1.handleOwnLineComment,
- endOfLine: comments$1.handleEndOfLineComment,
- remaining: comments$1.handleRemainingComment
- },
- getGapRegex: comments$1.getGapRegex,
- getCommentChildNodes: comments$1.getCommentChildNodes
- };
-
- const {
- concat: concat$e,
- hardline: hardline$a,
- indent: indent$8,
- join: join$a
- } = document.builders;
-
- function genericPrint$4(path, options, print) {
- const node = path.getValue();
-
- switch (node.type) {
- case "JsonRoot":
- return concat$e([path.call(print, "node"), hardline$a]);
-
- case "ArrayExpression":
- 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, "]"]);
-
- case "ObjectExpression":
- 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, "}"]);
-
- case "ObjectProperty":
- return concat$e([path.call(print, "key"), ": ", path.call(print, "value")]);
-
- case "UnaryExpression":
- return concat$e([node.operator === "+" ? "" : node.operator, path.call(print, "argument")]);
-
- case "NullLiteral":
- return "null";
-
- case "BooleanLiteral":
- return node.value ? "true" : "false";
-
- case "StringLiteral":
- case "NumericLiteral":
- return JSON.stringify(node.value);
-
- case "Identifier":
- return JSON.stringify(node.name);
-
- default:
- /* istanbul ignore next */
- throw new Error("unknown type: " + JSON.stringify(node.type));
- }
- }
-
- function clean$5(node, newNode
- /*, parent*/
- ) {
- delete newNode.start;
- delete newNode.end;
- delete newNode.extra;
- delete newNode.loc;
- delete newNode.comments;
- delete newNode.errors;
-
- if (node.type === "Identifier") {
- return {
- type: "StringLiteral",
- value: node.name
- };
- }
-
- if (node.type === "UnaryExpression" && node.operator === "+") {
- return newNode.argument;
- }
- }
-
- var printerEstreeJson = {
- preprocess: preprocess_1$1,
- print: genericPrint$4,
- massageAstNode: clean$5
- };
-
- const CATEGORY_JAVASCRIPT = "JavaScript"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
-
- var options$5 = {
- arrowParens: {
- since: "1.9.0",
- category: CATEGORY_JAVASCRIPT,
- type: "choice",
- default: [{
- since: "1.9.0",
- value: "avoid"
- }, {
- since: "2.0.0",
- value: "always"
- }],
- description: "Include parentheses around a sole arrow function parameter.",
- choices: [{
- value: "always",
- description: "Always include parens. Example: `(x) => x`"
- }, {
- value: "avoid",
- description: "Omit parens when possible. Example: `x => x`"
- }]
- },
- bracketSpacing: commonOptions.bracketSpacing,
- jsxBracketSameLine: {
- since: "0.17.0",
- category: CATEGORY_JAVASCRIPT,
- type: "boolean",
- default: false,
- description: "Put > on the last line instead of at a new line."
- },
- semi: {
- since: "1.0.0",
- category: CATEGORY_JAVASCRIPT,
- type: "boolean",
- default: true,
- description: "Print semicolons.",
- oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them."
- },
- singleQuote: commonOptions.singleQuote,
- jsxSingleQuote: {
- since: "1.15.0",
- category: CATEGORY_JAVASCRIPT,
- type: "boolean",
- default: false,
- description: "Use single quotes in JSX."
- },
- quoteProps: {
- since: "1.17.0",
- category: CATEGORY_JAVASCRIPT,
- type: "choice",
- default: "as-needed",
- description: "Change when properties in objects are quoted.",
- choices: [{
- value: "as-needed",
- description: "Only add quotes around object properties where required."
- }, {
- value: "consistent",
- description: "If at least one property in an object requires quotes, quote all properties."
- }, {
- value: "preserve",
- description: "Respect the input use of quotes in object properties."
- }]
- },
- trailingComma: {
- since: "0.0.0",
- category: CATEGORY_JAVASCRIPT,
- type: "choice",
- default: [{
- since: "0.0.0",
- value: false
- }, {
- since: "0.19.0",
- value: "none"
- }, {
- since: "2.0.0",
- value: "es5"
- }],
- description: "Print trailing commas wherever possible when multi-line.",
- choices: [{
- value: "es5",
- description: "Trailing commas where valid in ES5 (objects, arrays, etc.)"
- }, {
- value: "none",
- description: "No trailing commas."
- }, {
- value: "all",
- description: "Trailing commas wherever possible (including function arguments)."
- }]
- }
- };
-
- var name$9 = "JavaScript";
- var type$8 = "programming";
- var tmScope$8 = "source.js";
- var aceMode$8 = "javascript";
- var codemirrorMode$4 = "javascript";
- var codemirrorMimeType$4 = "text/javascript";
- var color$3 = "#f1e05a";
- var aliases$2 = [
- "js",
- "node"
- ];
- var extensions$8 = [
- ".js",
- "._js",
- ".bones",
- ".cjs",
- ".es",
- ".es6",
- ".frag",
- ".gs",
- ".jake",
- ".jsb",
- ".jscad",
- ".jsfl",
- ".jsm",
- ".jss",
- ".mjs",
- ".njs",
- ".pac",
- ".sjs",
- ".ssjs",
- ".xsjs",
- ".xsjslib"
- ];
- var filenames = [
- "Jakefile"
- ];
- var interpreters = [
- "chakra",
- "d8",
- "gjs",
- "js",
- "node",
- "qjs",
- "rhino",
- "v8",
- "v8-shell"
- ];
- var languageId$8 = 183;
- var JavaScript = {
- name: name$9,
- type: type$8,
- tmScope: tmScope$8,
- aceMode: aceMode$8,
- codemirrorMode: codemirrorMode$4,
- codemirrorMimeType: codemirrorMimeType$4,
- color: color$3,
- aliases: aliases$2,
- extensions: extensions$8,
- filenames: filenames,
- interpreters: interpreters,
- languageId: languageId$8
- };
-
- var JavaScript$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$9,
- type: type$8,
- tmScope: tmScope$8,
- aceMode: aceMode$8,
- codemirrorMode: codemirrorMode$4,
- codemirrorMimeType: codemirrorMimeType$4,
- color: color$3,
- aliases: aliases$2,
- extensions: extensions$8,
- filenames: filenames,
- interpreters: interpreters,
- languageId: languageId$8,
- 'default': JavaScript
- });
-
- var name$a = "JSX";
- var type$9 = "programming";
- var group$c = "JavaScript";
- var extensions$9 = [
- ".jsx"
- ];
- var tmScope$9 = "source.js.jsx";
- var aceMode$9 = "javascript";
- var codemirrorMode$5 = "jsx";
- var codemirrorMimeType$5 = "text/jsx";
- var languageId$9 = 178;
- var JSX = {
- name: name$a,
- type: type$9,
- group: group$c,
- extensions: extensions$9,
- tmScope: tmScope$9,
- aceMode: aceMode$9,
- codemirrorMode: codemirrorMode$5,
- codemirrorMimeType: codemirrorMimeType$5,
- languageId: languageId$9
- };
-
- var JSX$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$a,
- type: type$9,
- group: group$c,
- extensions: extensions$9,
- tmScope: tmScope$9,
- aceMode: aceMode$9,
- codemirrorMode: codemirrorMode$5,
- codemirrorMimeType: codemirrorMimeType$5,
- languageId: languageId$9,
- 'default': JSX
- });
-
- var name$b = "TypeScript";
- var type$a = "programming";
- var color$4 = "#2b7489";
- var aliases$3 = [
- "ts"
- ];
- var interpreters$1 = [
- "deno",
- "ts-node"
- ];
- var extensions$a = [
- ".ts"
- ];
- var tmScope$a = "source.ts";
- var aceMode$a = "typescript";
- var codemirrorMode$6 = "javascript";
- var codemirrorMimeType$6 = "application/typescript";
- var languageId$a = 378;
- var TypeScript = {
- name: name$b,
- type: type$a,
- color: color$4,
- aliases: aliases$3,
- interpreters: interpreters$1,
- extensions: extensions$a,
- tmScope: tmScope$a,
- aceMode: aceMode$a,
- codemirrorMode: codemirrorMode$6,
- codemirrorMimeType: codemirrorMimeType$6,
- languageId: languageId$a
- };
-
- var TypeScript$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$b,
- type: type$a,
- color: color$4,
- aliases: aliases$3,
- interpreters: interpreters$1,
- extensions: extensions$a,
- tmScope: tmScope$a,
- aceMode: aceMode$a,
- codemirrorMode: codemirrorMode$6,
- codemirrorMimeType: codemirrorMimeType$6,
- languageId: languageId$a,
- 'default': TypeScript
- });
-
- var name$c = "TSX";
- var type$b = "programming";
- var group$d = "TypeScript";
- var extensions$b = [
- ".tsx"
- ];
- var tmScope$b = "source.tsx";
- var aceMode$b = "javascript";
- var codemirrorMode$7 = "jsx";
- var codemirrorMimeType$7 = "text/jsx";
- var languageId$b = 94901924;
- var TSX = {
- name: name$c,
- type: type$b,
- group: group$d,
- extensions: extensions$b,
- tmScope: tmScope$b,
- aceMode: aceMode$b,
- codemirrorMode: codemirrorMode$7,
- codemirrorMimeType: codemirrorMimeType$7,
- languageId: languageId$b
- };
-
- var TSX$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$c,
- type: type$b,
- group: group$d,
- extensions: extensions$b,
- tmScope: tmScope$b,
- aceMode: aceMode$b,
- codemirrorMode: codemirrorMode$7,
- codemirrorMimeType: codemirrorMimeType$7,
- languageId: languageId$b,
- 'default': TSX
- });
-
- var name$d = "JSON";
- var type$c = "data";
- var tmScope$c = "source.json";
- var aceMode$c = "json";
- var codemirrorMode$8 = "javascript";
- var codemirrorMimeType$8 = "application/json";
- var searchable = false;
- var extensions$c = [
- ".json",
- ".avsc",
- ".geojson",
- ".gltf",
- ".har",
- ".ice",
- ".JSON-tmLanguage",
- ".jsonl",
- ".mcmeta",
- ".tfstate",
- ".tfstate.backup",
- ".topojson",
- ".webapp",
- ".webmanifest",
- ".yy",
- ".yyp"
- ];
- var filenames$1 = [
- ".arcconfig",
- ".htmlhintrc",
- ".tern-config",
- ".tern-project",
- ".watchmanconfig",
- "composer.lock",
- "mcmod.info"
- ];
- var languageId$c = 174;
- var _JSON = {
- name: name$d,
- type: type$c,
- tmScope: tmScope$c,
- aceMode: aceMode$c,
- codemirrorMode: codemirrorMode$8,
- codemirrorMimeType: codemirrorMimeType$8,
- searchable: searchable,
- extensions: extensions$c,
- filenames: filenames$1,
- languageId: languageId$c
- };
-
- var _JSON$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$d,
- type: type$c,
- tmScope: tmScope$c,
- aceMode: aceMode$c,
- codemirrorMode: codemirrorMode$8,
- codemirrorMimeType: codemirrorMimeType$8,
- searchable: searchable,
- extensions: extensions$c,
- filenames: filenames$1,
- languageId: languageId$c,
- 'default': _JSON
- });
-
- var name$e = "JSON with Comments";
- var type$d = "data";
- var group$e = "JSON";
- var tmScope$d = "source.js";
- var aceMode$d = "javascript";
- var codemirrorMode$9 = "javascript";
- var codemirrorMimeType$9 = "text/javascript";
- var aliases$4 = [
- "jsonc"
- ];
- var extensions$d = [
- ".jsonc",
- ".sublime-build",
- ".sublime-commands",
- ".sublime-completions",
- ".sublime-keymap",
- ".sublime-macro",
- ".sublime-menu",
- ".sublime-mousemap",
- ".sublime-project",
- ".sublime-settings",
- ".sublime-theme",
- ".sublime-workspace",
- ".sublime_metrics",
- ".sublime_session"
- ];
- var filenames$2 = [
- ".babelrc",
- ".eslintrc.json",
- ".jscsrc",
- ".jshintrc",
- ".jslintrc",
- "jsconfig.json",
- "language-configuration.json",
- "tsconfig.json"
- ];
- var languageId$d = 423;
- var JSON_with_Comments = {
- name: name$e,
- type: type$d,
- group: group$e,
- tmScope: tmScope$d,
- aceMode: aceMode$d,
- codemirrorMode: codemirrorMode$9,
- codemirrorMimeType: codemirrorMimeType$9,
- aliases: aliases$4,
- extensions: extensions$d,
- filenames: filenames$2,
- languageId: languageId$d
- };
-
- var JSON_with_Comments$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$e,
- type: type$d,
- group: group$e,
- tmScope: tmScope$d,
- aceMode: aceMode$d,
- codemirrorMode: codemirrorMode$9,
- codemirrorMimeType: codemirrorMimeType$9,
- aliases: aliases$4,
- extensions: extensions$d,
- filenames: filenames$2,
- languageId: languageId$d,
- 'default': JSON_with_Comments
- });
-
- var name$f = "JSON5";
- var type$e = "data";
- var extensions$e = [
- ".json5"
- ];
- var tmScope$e = "source.js";
- var aceMode$e = "javascript";
- var codemirrorMode$a = "javascript";
- var codemirrorMimeType$a = "application/json";
- var languageId$e = 175;
- var JSON5 = {
- name: name$f,
- type: type$e,
- extensions: extensions$e,
- tmScope: tmScope$e,
- aceMode: aceMode$e,
- codemirrorMode: codemirrorMode$a,
- codemirrorMimeType: codemirrorMimeType$a,
- languageId: languageId$e
- };
-
- var JSON5$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$f,
- type: type$e,
- extensions: extensions$e,
- tmScope: tmScope$e,
- aceMode: aceMode$e,
- codemirrorMode: codemirrorMode$a,
- codemirrorMimeType: codemirrorMimeType$a,
- languageId: languageId$e,
- 'default': JSON5
- });
-
- var require$$0$6 = getCjsExportFromNamespace(JavaScript$1);
-
- var require$$1$2 = getCjsExportFromNamespace(JSX$1);
-
- var require$$2$1 = getCjsExportFromNamespace(TypeScript$1);
-
- var require$$3$1 = getCjsExportFromNamespace(TSX$1);
-
- var require$$4 = getCjsExportFromNamespace(_JSON$1);
-
- var require$$5 = getCjsExportFromNamespace(JSON_with_Comments$1);
-
- var require$$6 = getCjsExportFromNamespace(JSON5$1);
-
- const languages$4 = [createLanguage(require$$0$6, data => ({
- since: "0.0.0",
- parsers: ["babel", "flow"],
- vscodeLanguageIds: ["javascript", "mongo"],
- interpreters: data.interpreters.concat(["nodejs"])
- })), createLanguage(require$$0$6, () => ({
- name: "Flow",
- since: "0.0.0",
- parsers: ["babel", "flow"],
- vscodeLanguageIds: ["javascript"],
- aliases: [],
- filenames: [],
- extensions: [".js.flow"]
- })), createLanguage(require$$1$2, () => ({
- since: "0.0.0",
- parsers: ["babel", "flow"],
- vscodeLanguageIds: ["javascriptreact"]
- })), createLanguage(require$$2$1, () => ({
- since: "1.4.0",
- parsers: ["typescript", "babel-ts"],
- vscodeLanguageIds: ["typescript"]
- })), createLanguage(require$$3$1, () => ({
- since: "1.4.0",
- parsers: ["typescript", "babel-ts"],
- vscodeLanguageIds: ["typescriptreact"]
- })), createLanguage(require$$4, () => ({
- name: "JSON.stringify",
- since: "1.13.0",
- parsers: ["json-stringify"],
- vscodeLanguageIds: ["json"],
- extensions: [],
- // .json file defaults to json instead of json-stringify
- filenames: ["package.json", "package-lock.json", "composer.json"]
- })), createLanguage(require$$4, data => ({
- since: "1.5.0",
- parsers: ["json"],
- vscodeLanguageIds: ["json"],
- filenames: data.filenames.concat([".prettierrc"])
- })), createLanguage(require$$5, data => ({
- since: "1.5.0",
- parsers: ["json"],
- vscodeLanguageIds: ["jsonc"],
- filenames: data.filenames.concat([".eslintrc"])
- })), createLanguage(require$$6, () => ({
- since: "1.13.0",
- parsers: ["json5"],
- vscodeLanguageIds: ["json5"]
- }))];
- const printers$4 = {
- estree: printerEstree,
- "estree-json": printerEstreeJson
- };
- var languageJs = {
- languages: languages$4,
- options: options$5,
- printers: printers$4
- };
-
- var json$1 = {
- "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]",
- "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]",
- "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]"
- };
-
- const {
- cjkPattern,
- kPattern,
- punctuationPattern
- } = json$1;
- const {
- getLast: getLast$4
- } = util$1;
- const INLINE_NODE_TYPES = ["liquidNode", "inlineCode", "emphasis", "strong", "delete", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break", "inlineMath"];
- const INLINE_NODE_WRAPPER_TYPES = INLINE_NODE_TYPES.concat(["tableCell", "paragraph", "heading"]);
- const kRegex = new RegExp(kPattern);
- const punctuationRegex = new RegExp(punctuationPattern);
- /**
- * split text into whitespaces and words
- * @param {string} text
- * @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
- */
-
- function splitText(text, options) {
- const KIND_NON_CJK = "non-cjk";
- const KIND_CJ_LETTER = "cj-letter";
- const KIND_K_LETTER = "k-letter";
- const KIND_CJK_PUNCTUATION = "cjk-punctuation";
- const nodes = [];
- (options.proseWrap === "preserve" ? text : text.replace(new RegExp("(".concat(cjkPattern, ")\n(").concat(cjkPattern, ")"), "g"), "$1$2")).split(/([ \t\n]+)/).forEach((token, index, tokens) => {
- // whitespace
- if (index % 2 === 1) {
- nodes.push({
- type: "whitespace",
- value: /\n/.test(token) ? "\n" : " "
- });
- return;
- } // word separated by whitespace
-
-
- if ((index === 0 || index === tokens.length - 1) && token === "") {
- return;
- }
-
- token.split(new RegExp("(".concat(cjkPattern, ")"))).forEach((innerToken, innerIndex, innerTokens) => {
- if ((innerIndex === 0 || innerIndex === innerTokens.length - 1) && innerToken === "") {
- return;
- } // non-CJK word
-
-
- if (innerIndex % 2 === 0) {
- if (innerToken !== "") {
- appendNode({
- type: "word",
- value: innerToken,
- kind: KIND_NON_CJK,
- hasLeadingPunctuation: punctuationRegex.test(innerToken[0]),
- hasTrailingPunctuation: punctuationRegex.test(getLast$4(innerToken))
- });
- }
-
- return;
- } // CJK character
-
-
- appendNode(punctuationRegex.test(innerToken) ? {
- type: "word",
- value: innerToken,
- kind: KIND_CJK_PUNCTUATION,
- hasLeadingPunctuation: true,
- hasTrailingPunctuation: true
- } : {
- type: "word",
- value: innerToken,
- kind: kRegex.test(innerToken) ? KIND_K_LETTER : KIND_CJ_LETTER,
- hasLeadingPunctuation: false,
- hasTrailingPunctuation: false
- });
- });
- });
- return nodes;
-
- function appendNode(node) {
- const lastNode = getLast$4(nodes);
-
- if (lastNode && lastNode.type === "word") {
- 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) {
- nodes.push({
- type: "whitespace",
- value: " "
- });
- } else if (!isBetween(KIND_NON_CJK, KIND_CJK_PUNCTUATION) && // disallow leading/trailing full-width whitespace
- ![lastNode.value, node.value].some(value => /\u3000/.test(value))) {
- nodes.push({
- type: "whitespace",
- value: ""
- });
- }
- }
-
- nodes.push(node);
-
- function isBetween(kind1, kind2) {
- return lastNode.kind === kind1 && node.kind === kind2 || lastNode.kind === kind2 && node.kind === kind1;
- }
- }
- }
-
- function getOrderedListItemInfo(orderListItem, originalText) {
- const [, numberText, marker, leadingSpaces] = originalText.slice(orderListItem.position.start.offset, orderListItem.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/);
- return {
- numberText,
- marker,
- leadingSpaces
- };
- }
-
- function hasGitDiffFriendlyOrderedList(node, options) {
- if (!node.ordered) {
- return false;
- }
-
- if (node.children.length < 2) {
- return false;
- }
-
- const firstNumber = Number(getOrderedListItemInfo(node.children[0], options.originalText).numberText);
- const secondNumber = Number(getOrderedListItemInfo(node.children[1], options.originalText).numberText);
-
- if (firstNumber === 0 && node.children.length > 2) {
- const thirdNumber = Number(getOrderedListItemInfo(node.children[2], options.originalText).numberText);
- return secondNumber === 1 && thirdNumber === 1;
- }
-
- return secondNumber === 1;
- } // workaround for https://github.com/remarkjs/remark/issues/351
- // leading and trailing newlines are stripped by remark
-
-
- function getFencedCodeBlockValue(node, originalText) {
- const text = originalText.slice(node.position.start.offset, node.position.end.offset);
- const leadingSpaceCount = text.match(/^\s*/)[0].length;
- const replaceRegex = new RegExp("^\\s{0,".concat(leadingSpaceCount, "}"));
- const lineContents = text.split("\n");
- const markerStyle = text[leadingSpaceCount]; // ` or ~
-
- 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
- // https://spec.commonmark.org/0.28/#example-93: The closing code fence must be at least as long as the opening fence
-
- const hasEndMarker = new RegExp("^\\s{0,3}".concat(marker)).test(lineContents[lineContents.length - 1].slice(getIndent(lineContents.length - 1)));
- return lineContents.slice(1, hasEndMarker ? -1 : undefined).map((x, i) => x.slice(getIndent(i + 1)).replace(replaceRegex, "")).join("\n");
-
- function getIndent(lineIndex) {
- return node.position.indent[lineIndex - 1] - 1;
- }
- }
-
- function mapAst(ast, handler) {
- return function preorder(node, index, parentStack) {
- parentStack = parentStack || [];
- const newNode = Object.assign({}, handler(node, index, parentStack));
-
- if (newNode.children) {
- newNode.children = newNode.children.map((child, index) => {
- return preorder(child, index, [newNode].concat(parentStack));
- });
- }
-
- return newNode;
- }(ast, null, null);
- }
-
- var utils$6 = {
- mapAst,
- splitText,
- punctuationPattern,
- getFencedCodeBlockValue,
- getOrderedListItemInfo,
- hasGitDiffFriendlyOrderedList,
- INLINE_NODE_TYPES,
- INLINE_NODE_WRAPPER_TYPES
- };
-
- const {
- builders: {
- hardline: hardline$b,
- literalline: literalline$5,
- concat: concat$f,
- markAsRoot: markAsRoot$3
- },
- utils: {
- mapDoc: mapDoc$4
- }
- } = document;
- const {
- getFencedCodeBlockValue: getFencedCodeBlockValue$1
- } = utils$6;
-
- function embed$4(path, print, textToDoc, options) {
- const node = path.getValue();
-
- if (node.type === "code" && node.lang !== null) {
- // only look for the first string so as to support [markdown-preview-enhanced](https://shd101wyy.github.io/markdown-preview-enhanced/#/code-chunk)
- const langMatch = node.lang.match(/^[A-Za-z0-9_-]+/);
- const lang = langMatch ? langMatch[0] : "";
- const parser = getParserName(lang);
-
- if (parser) {
- const styleUnit = options.__inJsTemplate ? "~" : "`";
- const style = styleUnit.repeat(Math.max(3, util$1.getMaxContinuousCount(node.value, styleUnit) + 1));
- const doc = textToDoc(getFencedCodeBlockValue$1(node, options.originalText), {
- parser
- });
- return markAsRoot$3(concat$f([style, node.lang, hardline$b, replaceNewlinesWithLiterallines(doc), style]));
- }
- }
-
- if (node.type === "yaml") {
- return markAsRoot$3(concat$f(["---", hardline$b, node.value && node.value.trim() ? replaceNewlinesWithLiterallines(textToDoc(node.value, {
- parser: "yaml"
- })) : "", "---"]));
- } // MDX
-
-
- switch (node.type) {
- case "importExport":
- return textToDoc(node.value, {
- parser: "babel"
- });
-
- case "jsx":
- return textToDoc("<$>".concat(node.value, "</$>"), {
- parser: "__js_expression",
- rootMarker: "mdx"
- });
- }
-
- return null;
-
- function getParserName(lang) {
- const supportInfo = support.getSupportInfo({
- plugins: options.plugins
- });
- 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)));
-
- if (language) {
- return language.parsers[0];
- }
-
- return null;
- }
-
- function replaceNewlinesWithLiterallines(doc) {
- 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);
- }
- }
-
- var embed_1$2 = embed$4;
-
- const pragmas = ["format", "prettier"];
-
- function startWithPragma(text) {
- const pragma = "@(".concat(pragmas.join("|"), ")");
- 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");
- const matched = text.match(regex);
- return matched && matched.index === 0;
- }
-
- var pragma$4 = {
- startWithPragma,
- hasPragma: text => startWithPragma(frontMatter(text).content.trimStart()),
- insertPragma: text => {
- const extracted = frontMatter(text);
- const pragma = "<!-- @".concat(pragmas[0], " -->");
- return extracted.frontMatter ? "".concat(extracted.frontMatter.raw, "\n\n").concat(pragma, "\n\n").concat(extracted.content) : "".concat(pragma, "\n\n").concat(extracted.content);
- }
- };
-
- const {
- getOrderedListItemInfo: getOrderedListItemInfo$1,
- mapAst: mapAst$1,
- splitText: splitText$1
- } = utils$6; // 0x0 ~ 0x10ffff
- // eslint-disable-next-line no-control-regex
-
- const isSingleCharRegex = /^([\u0000-\uffff]|[\ud800-\udbff][\udc00-\udfff])$/;
-
- function preprocess$2(ast, options) {
- ast = restoreUnescapedCharacter(ast, options);
- ast = mergeContinuousTexts(ast);
- ast = transformInlineCode(ast);
- ast = transformIndentedCodeblockAndMarkItsParentList(ast, options);
- ast = markAlignedList(ast, options);
- ast = splitTextIntoSentences(ast, options);
- ast = transformImportExport(ast);
- ast = mergeContinuousImportExport(ast);
- return ast;
- }
-
- function transformImportExport(ast) {
- return mapAst$1(ast, node => {
- if (node.type !== "import" && node.type !== "export") {
- return node;
- }
-
- return Object.assign({}, node, {
- type: "importExport"
- });
- });
- }
-
- function transformInlineCode(ast) {
- return mapAst$1(ast, node => {
- if (node.type !== "inlineCode") {
- return node;
- }
-
- return Object.assign({}, node, {
- value: node.value.replace(/\s+/g, " ")
- });
- });
- }
-
- function restoreUnescapedCharacter(ast, options) {
- return mapAst$1(ast, node => {
- return node.type !== "text" ? node : Object.assign({}, node, {
- value: node.value !== "*" && node.value !== "_" && node.value !== "$" && // handle these cases in printer
- 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
- });
- });
- }
-
- function mergeContinuousImportExport(ast) {
- return mergeChildren(ast, (prevNode, node) => prevNode.type === "importExport" && node.type === "importExport", (prevNode, node) => ({
- type: "importExport",
- value: prevNode.value + "\n\n" + node.value,
- position: {
- start: prevNode.position.start,
- end: node.position.end
- }
- }));
- }
-
- function mergeChildren(ast, shouldMerge, mergeNode) {
- return mapAst$1(ast, node => {
- if (!node.children) {
- return node;
- }
-
- const children = node.children.reduce((current, child) => {
- const lastChild = current[current.length - 1];
-
- if (lastChild && shouldMerge(lastChild, child)) {
- current.splice(-1, 1, mergeNode(lastChild, child));
- } else {
- current.push(child);
- }
-
- return current;
- }, []);
- return Object.assign({}, node, {
- children
- });
- });
- }
-
- function mergeContinuousTexts(ast) {
- return mergeChildren(ast, (prevNode, node) => prevNode.type === "text" && node.type === "text", (prevNode, node) => ({
- type: "text",
- value: prevNode.value + node.value,
- position: {
- start: prevNode.position.start,
- end: node.position.end
- }
- }));
- }
-
- function splitTextIntoSentences(ast, options) {
- return mapAst$1(ast, (node, index, [parentNode]) => {
- if (node.type !== "text") {
- return node;
- }
-
- let {
- value
- } = node;
-
- if (parentNode.type === "paragraph") {
- if (index === 0) {
- value = value.trimStart();
- }
-
- if (index === parentNode.children.length - 1) {
- value = value.trimEnd();
- }
- }
-
- return {
- type: "sentence",
- position: node.position,
- children: splitText$1(value, options)
- };
- });
- }
-
- function transformIndentedCodeblockAndMarkItsParentList(ast, options) {
- return mapAst$1(ast, (node, index, parentStack) => {
- if (node.type === "code") {
- // the first char may point to `\n`, e.g. `\n\t\tbar`, just ignore it
- const isIndented = /^\n?( {4,}|\t)/.test(options.originalText.slice(node.position.start.offset, node.position.end.offset));
- node.isIndented = isIndented;
-
- if (isIndented) {
- for (let i = 0; i < parentStack.length; i++) {
- const parent = parentStack[i]; // no need to check checked items
-
- if (parent.hasIndentedCodeblock) {
- break;
- }
-
- if (parent.type === "list") {
- parent.hasIndentedCodeblock = true;
- }
- }
- }
- }
-
- return node;
- });
- }
-
- function markAlignedList(ast, options) {
- return mapAst$1(ast, (node, index, parentStack) => {
- if (node.type === "list" && node.children.length !== 0) {
- // if one of its parents is not aligned, it's not possible to be aligned in sub-lists
- for (let i = 0; i < parentStack.length; i++) {
- const parent = parentStack[i];
-
- if (parent.type === "list" && !parent.isAligned) {
- node.isAligned = false;
- return node;
- }
- }
-
- node.isAligned = isAligned(node);
- }
-
- return node;
- });
-
- function getListItemStart(listItem) {
- return listItem.children.length === 0 ? -1 : listItem.children[0].position.start.column - 1;
- }
-
- function isAligned(list) {
- if (!list.ordered) {
- /**
- * - 123
- * - 123
- */
- return true;
- }
-
- const [firstItem, secondItem] = list.children;
- const firstInfo = getOrderedListItemInfo$1(firstItem, options.originalText);
-
- if (firstInfo.leadingSpaces.length > 1) {
- /**
- * 1. 123
- *
- * 1. 123
- * 1. 123
- */
- return true;
- }
-
- const firstStart = getListItemStart(firstItem);
-
- if (firstStart === -1) {
- /**
- * 1.
- *
- * 1.
- * 1.
- */
- return false;
- }
-
- if (list.children.length === 1) {
- /**
- * aligned:
- *
- * 11. 123
- *
- * not aligned:
- *
- * 1. 123
- */
- return firstStart % options.tabWidth === 0;
- }
-
- const secondStart = getListItemStart(secondItem);
-
- if (firstStart !== secondStart) {
- /**
- * 11. 123
- * 1. 123
- *
- * 1. 123
- * 11. 123
- */
- return false;
- }
-
- if (firstStart % options.tabWidth === 0) {
- /**
- * 11. 123
- * 12. 123
- */
- return true;
- }
- /**
- * aligned:
- *
- * 11. 123
- * 1. 123
- *
- * not aligned:
- *
- * 1. 123
- * 2. 123
- */
-
-
- const secondInfo = getOrderedListItemInfo$1(secondItem, options.originalText);
- return secondInfo.leadingSpaces.length > 1;
- }
- }
-
- var preprocess_1$2 = preprocess$2;
-
- const {
- builders: {
- breakParent: breakParent$4,
- concat: concat$g,
- join: join$b,
- line: line$a,
- literalline: literalline$6,
- markAsRoot: markAsRoot$4,
- hardline: hardline$c,
- softline: softline$7,
- ifBreak: ifBreak$7,
- fill: fill$5,
- align: align$2,
- indent: indent$9,
- group: group$f
- },
- utils: {
- mapDoc: mapDoc$5
- },
- printer: {
- printDocToString: printDocToString$3
- }
- } = document;
- const {
- getFencedCodeBlockValue: getFencedCodeBlockValue$2,
- hasGitDiffFriendlyOrderedList: hasGitDiffFriendlyOrderedList$1,
- splitText: splitText$2,
- punctuationPattern: punctuationPattern$1,
- INLINE_NODE_TYPES: INLINE_NODE_TYPES$1,
- INLINE_NODE_WRAPPER_TYPES: INLINE_NODE_WRAPPER_TYPES$1
- } = utils$6;
- const {
- replaceEndOfLineWith: replaceEndOfLineWith$2
- } = util$1;
- const TRAILING_HARDLINE_NODES = ["importExport"];
- const SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link"];
- const SIBLING_NODE_TYPES = ["listItem", "definition", "footnoteDefinition"];
-
- function genericPrint$5(path, options, print) {
- const node = path.getValue();
-
- if (shouldRemainTheSameContent(path)) {
- 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)));
- }
-
- switch (node.type) {
- case "root":
- if (node.children.length === 0) {
- return "";
- }
-
- return concat$g([normalizeDoc(printRoot(path, options, print)), !TRAILING_HARDLINE_NODES.includes(getLastDescendantNode(node).type) ? hardline$c : ""]);
-
- case "paragraph":
- return printChildren$2(path, options, print, {
- postprocessor: fill$5
- });
-
- case "sentence":
- return printChildren$2(path, options, print);
-
- case "word":
- return node.value.replace(/[*$]/g, "\\$&") // escape all `*` and `$` (math)
- .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, "\\_"));
- // escape all `_` except concating with non-punctuation, e.g. `1_2_3` is not considered emphasis
-
- case "whitespace":
- {
- const parentNode = path.getParentNode();
- const index = parentNode.children.indexOf(node);
- const nextNode = parentNode.children[index + 1];
- const proseWrap = // leading char that may cause different syntax
- nextNode && /^>|^([-+*]|#{1,6}|[0-9]+[.)])$/.test(nextNode.value) ? "never" : options.proseWrap;
- return printLine(path, node.value, {
- proseWrap
- });
- }
-
- case "emphasis":
- {
- const parentNode = path.getParentNode();
- const index = parentNode.children.indexOf(node);
- const prevNode = parentNode.children[index - 1];
- const nextNode = parentNode.children[index + 1];
- const hasPrevOrNextWord = // `1*2*3` is considered emphasis but `1_2_3` is not
- 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;
- const style = hasPrevOrNextWord || getAncestorNode$2(path, "emphasis") ? "*" : "_";
- return concat$g([style, printChildren$2(path, options, print), style]);
- }
-
- case "strong":
- return concat$g(["**", printChildren$2(path, options, print), "**"]);
-
- case "delete":
- return concat$g(["~~", printChildren$2(path, options, print), "~~"]);
-
- case "inlineCode":
- {
- const backtickCount = util$1.getMinNotPresentContinuousCount(node.value, "`");
- const style = "`".repeat(backtickCount || 1);
- const gap = backtickCount ? " " : "";
- return concat$g([style, gap, node.value, gap, style]);
- }
-
- case "link":
- switch (options.originalText[node.position.start.offset]) {
- case "<":
- {
- const mailto = "mailto:";
- const url = // <hello@example.com> is parsed as { url: "mailto:hello@example.com" }
- 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;
- return concat$g(["<", url, ">"]);
- }
-
- case "[":
- return concat$g(["[", printChildren$2(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
-
- default:
- return options.originalText.slice(node.position.start.offset, node.position.end.offset);
- }
-
- case "image":
- return concat$g(["![", node.alt || "", "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
-
- case "blockquote":
- return concat$g(["> ", align$2("> ", printChildren$2(path, options, print))]);
-
- case "heading":
- return concat$g(["#".repeat(node.depth) + " ", printChildren$2(path, options, print)]);
-
- case "code":
- {
- if (node.isIndented) {
- // indented code block
- const alignment = " ".repeat(4);
- return align$2(alignment, concat$g([alignment, concat$g(replaceEndOfLineWith$2(node.value, hardline$c))]));
- } // fenced code block
-
-
- const styleUnit = options.__inJsTemplate ? "~" : "`";
- const style = styleUnit.repeat(Math.max(3, util$1.getMaxContinuousCount(node.value, styleUnit) + 1));
- return concat$g([style, node.lang || "", hardline$c, concat$g(replaceEndOfLineWith$2(getFencedCodeBlockValue$2(node, options.originalText), hardline$c)), hardline$c, style]);
- }
-
- case "yaml":
- case "toml":
- return options.originalText.slice(node.position.start.offset, node.position.end.offset);
-
- case "html":
- {
- const parentNode = path.getParentNode();
- const value = parentNode.type === "root" && util$1.getLast(parentNode.children) === node ? node.value.trimEnd() : node.value;
- const isHtmlComment = /^<!--[\s\S]*-->$/.test(value);
- return concat$g(replaceEndOfLineWith$2(value, isHtmlComment ? hardline$c : markAsRoot$4(literalline$6)));
- }
-
- case "list":
- {
- const nthSiblingIndex = getNthListSiblingIndex(node, path.getParentNode());
- const isGitDiffFriendlyOrderedList = hasGitDiffFriendlyOrderedList$1(node, options);
- return printChildren$2(path, options, print, {
- processor: (childPath, index) => {
- const prefix = getPrefix();
- const childNode = childPath.getValue();
-
- if (childNode.children.length === 2 && childNode.children[1].type === "html" && childNode.children[0].position.start.column !== childNode.children[1].position.start.column) {
- return concat$g([prefix, printListItem(childPath, options, print, prefix)]);
- }
-
- return concat$g([prefix, align$2(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))]);
-
- function getPrefix() {
- const rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* ";
- return node.isAligned ||
- /* workaround for https://github.com/remarkjs/remark/issues/315 */
- node.hasIndentedCodeblock ? alignListPrefix(rawPrefix, options) : rawPrefix;
- }
- }
- });
- }
-
- case "thematicBreak":
- {
- const counter = getAncestorCounter$1(path, "list");
-
- if (counter === -1) {
- return "---";
- }
-
- const nthSiblingIndex = getNthListSiblingIndex(path.getParentNode(counter), path.getParentNode(counter + 1));
- return nthSiblingIndex % 2 === 0 ? "***" : "---";
- }
-
- case "linkReference":
- return concat$g(["[", printChildren$2(path, options, print), "]", node.referenceType === "full" ? concat$g(["[", node.identifier, "]"]) : node.referenceType === "collapsed" ? "[]" : ""]);
-
- case "imageReference":
- switch (node.referenceType) {
- case "full":
- return concat$g(["![", node.alt || "", "][", node.identifier, "]"]);
-
- default:
- return concat$g(["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""]);
- }
-
- case "definition":
- {
- const lineOrSpace = options.proseWrap === "always" ? line$a : " ";
- 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)])]))]));
- }
-
- case "footnote":
- return concat$g(["[^", printChildren$2(path, options, print), "]"]);
-
- case "footnoteReference":
- return concat$g(["[^", node.identifier, "]"]);
-
- case "footnoteDefinition":
- {
- const nextNode = path.getParentNode().children[path.getName() + 1];
- 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);
- 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, {
- processor: (childPath, index) => {
- return index === 0 ? group$f(concat$g([softline$7, childPath.call(print)])) : childPath.call(print);
- }
- })), nextNode && nextNode.type === "footnoteDefinition" ? softline$7 : ""]))]);
- }
-
- case "table":
- return printTable(path, options, print);
-
- case "tableCell":
- return printChildren$2(path, options, print);
-
- case "break":
- return /\s/.test(options.originalText[node.position.start.offset]) ? concat$g([" ", markAsRoot$4(literalline$6)]) : concat$g(["\\", hardline$c]);
-
- case "liquidNode":
- return concat$g(replaceEndOfLineWith$2(node.value, hardline$c));
- // MDX
-
- case "importExport":
- case "jsx":
- return node.value;
- // fallback to the original text if multiparser failed
-
- case "math":
- return concat$g(["$$", hardline$c, node.value ? concat$g([concat$g(replaceEndOfLineWith$2(node.value, hardline$c)), hardline$c]) : "", "$$"]);
-
- case "inlineMath":
- {
- // remark-math trims content but we don't want to remove whitespaces
- // since it's very possible that it's recognized as math accidentally
- return options.originalText.slice(options.locStart(node), options.locEnd(node));
- }
-
- case "tableRow": // handled in "table"
-
- case "listItem": // handled in "list"
-
- default:
- throw new Error("Unknown markdown type ".concat(JSON.stringify(node.type)));
- }
- }
-
- function printListItem(path, options, print, listPrefix) {
- const node = path.getValue();
- const prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
- return concat$g([prefix, printChildren$2(path, options, print, {
- processor: (childPath, index) => {
- if (index === 0 && childPath.getValue().type !== "list") {
- return align$2(" ".repeat(prefix.length), childPath.call(print));
- }
-
- const alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3) // 4+ will cause indented code block
- );
- return concat$g([alignment, align$2(alignment, childPath.call(print))]);
- }
- })]);
- }
-
- function alignListPrefix(prefix, options) {
- const additionalSpaces = getAdditionalSpaces();
- return prefix + " ".repeat(additionalSpaces >= 4 ? 0 : additionalSpaces // 4+ will cause indented code block
- );
-
- function getAdditionalSpaces() {
- const restSpaces = prefix.length % options.tabWidth;
- return restSpaces === 0 ? 0 : options.tabWidth - restSpaces;
- }
- }
-
- function getNthListSiblingIndex(node, parentNode) {
- return getNthSiblingIndex(node, parentNode, siblingNode => siblingNode.ordered === node.ordered);
- }
-
- function getNthSiblingIndex(node, parentNode, condition) {
- condition = condition || (() => true);
-
- let index = -1;
-
- for (const childNode of parentNode.children) {
- if (childNode.type === node.type && condition(childNode)) {
- index++;
- } else {
- index = -1;
- }
-
- if (childNode === node) {
- return index;
- }
- }
- }
-
- function getAncestorCounter$1(path, typeOrTypes) {
- const types = [].concat(typeOrTypes);
- let counter = -1;
- let ancestorNode;
-
- while (ancestorNode = path.getParentNode(++counter)) {
- if (types.includes(ancestorNode.type)) {
- return counter;
- }
- }
-
- return -1;
- }
-
- function getAncestorNode$2(path, typeOrTypes) {
- const counter = getAncestorCounter$1(path, typeOrTypes);
- return counter === -1 ? null : path.getParentNode(counter);
- }
-
- function printLine(path, value, options) {
- if (options.proseWrap === "preserve" && value === "\n") {
- return hardline$c;
- }
-
- const isBreakable = options.proseWrap === "always" && !getAncestorNode$2(path, SINGLE_LINE_NODE_TYPES);
- return value !== "" ? isBreakable ? line$a : " " : isBreakable ? softline$7 : "";
- }
-
- function printTable(path, options, print) {
- const hardlineWithoutBreakParent = hardline$c.parts[0];
- const node = path.getValue();
- const contents = []; // { [rowIndex: number]: { [columnIndex: number]: string } }
-
- path.map(rowPath => {
- const rowContents = [];
- rowPath.map(cellPath => {
- rowContents.push(printDocToString$3(cellPath.call(print), options).formatted);
- }, "children");
- contents.push(rowContents);
- }, "children"); // Get the width of each column
-
- 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 (---, :--, :-:, --:)
- );
- const alignedTable = join$b(hardlineWithoutBreakParent, [printRow(contents[0]), printSeparator(), join$b(hardlineWithoutBreakParent, contents.slice(1).map(rowContents => printRow(rowContents)))]);
-
- if (options.proseWrap !== "never") {
- return concat$g([breakParent$4, alignedTable]);
- } // Only if the --prose-wrap never is set and it exceeds the print width.
-
-
- const compactTable = join$b(hardlineWithoutBreakParent, [printRow(contents[0],
- /* isCompact */
- true), printSeparator(
- /* isCompact */
- true), join$b(hardlineWithoutBreakParent, contents.slice(1).map(rowContents => printRow(rowContents,
- /* isCompact */
- true)))]);
- return concat$g([breakParent$4, group$f(ifBreak$7(compactTable, alignedTable))]);
-
- function printSeparator(isCompact) {
- return concat$g(["| ", join$b(" | ", columnMaxWidths.map((width, index) => {
- const spaces = isCompact ? 3 : width;
-
- switch (node.align[index]) {
- case "left":
- return ":" + "-".repeat(spaces - 1);
-
- case "right":
- return "-".repeat(spaces - 1) + ":";
-
- case "center":
- return ":" + "-".repeat(spaces - 2) + ":";
-
- default:
- return "-".repeat(spaces);
- }
- })), " |"]);
- }
-
- function printRow(rowContents, isCompact) {
- return concat$g(["| ", join$b(" | ", isCompact ? rowContents : rowContents.map((rowContent, columnIndex) => {
- switch (node.align[columnIndex]) {
- case "right":
- return alignRight(rowContent, columnMaxWidths[columnIndex]);
-
- case "center":
- return alignCenter(rowContent, columnMaxWidths[columnIndex]);
-
- default:
- return alignLeft(rowContent, columnMaxWidths[columnIndex]);
- }
- })), " |"]);
- }
-
- function alignLeft(text, width) {
- const spaces = width - util$1.getStringWidth(text);
- return concat$g([text, " ".repeat(spaces)]);
- }
-
- function alignRight(text, width) {
- const spaces = width - util$1.getStringWidth(text);
- return concat$g([" ".repeat(spaces), text]);
- }
-
- function alignCenter(text, width) {
- const spaces = width - util$1.getStringWidth(text);
- const left = Math.floor(spaces / 2);
- const right = spaces - left;
- return concat$g([" ".repeat(left), text, " ".repeat(right)]);
- }
- }
-
- function printRoot(path, options, print) {
- /** @typedef {{ index: number, offset: number }} IgnorePosition */
-
- /** @type {Array<{start: IgnorePosition, end: IgnorePosition}>} */
- const ignoreRanges = [];
- /** @type {IgnorePosition | null} */
-
- let ignoreStart = null;
- const {
- children
- } = path.getValue();
- children.forEach((childNode, index) => {
- switch (isPrettierIgnore$1(childNode)) {
- case "start":
- if (ignoreStart === null) {
- ignoreStart = {
- index,
- offset: childNode.position.end.offset
- };
- }
-
- break;
-
- case "end":
- if (ignoreStart !== null) {
- ignoreRanges.push({
- start: ignoreStart,
- end: {
- index,
- offset: childNode.position.start.offset
- }
- });
- ignoreStart = null;
- }
-
- break;
- }
- });
- return printChildren$2(path, options, print, {
- processor: (childPath, index) => {
- if (ignoreRanges.length !== 0) {
- const ignoreRange = ignoreRanges[0];
-
- if (index === ignoreRange.start.index) {
- return concat$g([children[ignoreRange.start.index].value, options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), children[ignoreRange.end.index].value]);
- }
-
- if (ignoreRange.start.index < index && index < ignoreRange.end.index) {
- return false;
- }
-
- if (index === ignoreRange.end.index) {
- ignoreRanges.shift();
- return false;
- }
- }
-
- return childPath.call(print);
- }
- });
- }
-
- function printChildren$2(path, options, print, events) {
- events = events || {};
- const postprocessor = events.postprocessor || concat$g;
-
- const processor = events.processor || (childPath => childPath.call(print));
-
- const node = path.getValue();
- const parts = [];
- let lastChildNode;
- path.map((childPath, index) => {
- const childNode = childPath.getValue();
- const result = processor(childPath, index);
-
- if (result !== false) {
- const data = {
- parts,
- prevNode: lastChildNode,
- parentNode: node,
- options
- };
-
- if (!shouldNotPrePrintHardline(childNode, data)) {
- parts.push(hardline$c);
-
- if (lastChildNode && TRAILING_HARDLINE_NODES.includes(lastChildNode.type)) {
- if (shouldPrePrintTripleHardline(childNode, data)) {
- parts.push(hardline$c);
- }
- } else {
- if (shouldPrePrintDoubleHardline(childNode, data) || shouldPrePrintTripleHardline(childNode, data)) {
- parts.push(hardline$c);
- }
-
- if (shouldPrePrintTripleHardline(childNode, data)) {
- parts.push(hardline$c);
- }
- }
- }
-
- parts.push(result);
- lastChildNode = childNode;
- }
- }, "children");
- return postprocessor(parts);
- }
-
- function getLastDescendantNode(node) {
- let current = node;
-
- while (current.children && current.children.length !== 0) {
- current = current.children[current.children.length - 1];
- }
-
- return current;
- }
- /** @return {false | 'next' | 'start' | 'end'} */
-
-
- function isPrettierIgnore$1(node) {
- if (node.type !== "html") {
- return false;
- }
-
- const match = node.value.match(/^<!--\s*prettier-ignore(?:-(start|end))?\s*-->$/);
- return match === null ? false : match[1] ? match[1] : "next";
- }
-
- function shouldNotPrePrintHardline(node, data) {
- const isFirstNode = data.parts.length === 0;
- const isInlineNode = INLINE_NODE_TYPES$1.includes(node.type);
- const isInlineHTML = node.type === "html" && INLINE_NODE_WRAPPER_TYPES$1.includes(data.parentNode.type);
- return isFirstNode || isInlineNode || isInlineHTML;
- }
-
- function shouldPrePrintDoubleHardline(node, data) {
- const isSequence = (data.prevNode && data.prevNode.type) === node.type;
- const isSiblingNode = isSequence && SIBLING_NODE_TYPES.includes(node.type);
- const isInTightListItem = data.parentNode.type === "listItem" && !data.parentNode.loose;
- const isPrevNodeLooseListItem = data.prevNode && data.prevNode.type === "listItem" && data.prevNode.loose;
- const isPrevNodePrettierIgnore = isPrettierIgnore$1(data.prevNode) === "next";
- const isBlockHtmlWithoutBlankLineBetweenPrevHtml = node.type === "html" && data.prevNode && data.prevNode.type === "html" && data.prevNode.position.end.line + 1 === node.position.start.line;
- 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;
- return isPrevNodeLooseListItem || !(isSiblingNode || isInTightListItem || isPrevNodePrettierIgnore || isBlockHtmlWithoutBlankLineBetweenPrevHtml || isHtmlDirectAfterListItem);
- }
-
- function shouldPrePrintTripleHardline(node, data) {
- const isPrevNodeList = data.prevNode && data.prevNode.type === "list";
- const isIndentedCode = node.type === "code" && node.isIndented;
- return isPrevNodeList && isIndentedCode;
- }
-
- function shouldRemainTheSameContent(path) {
- const ancestorNode = getAncestorNode$2(path, ["linkReference", "imageReference"]);
- return ancestorNode && (ancestorNode.type !== "linkReference" || ancestorNode.referenceType !== "full");
- }
-
- function normalizeDoc(doc) {
- return mapDoc$5(doc, currentDoc => {
- if (!currentDoc.parts) {
- return currentDoc;
- }
-
- if (currentDoc.type === "concat" && currentDoc.parts.length === 1) {
- return currentDoc.parts[0];
- }
-
- const parts = currentDoc.parts.reduce((parts, part) => {
- if (part.type === "concat") {
- parts.push(...part.parts);
- } else if (part !== "") {
- parts.push(part);
- }
-
- return parts;
- }, []);
- return Object.assign({}, currentDoc, {
- parts: normalizeParts$2(parts)
- });
- });
- }
-
- function printUrl(url, dangerousCharOrChars) {
- const dangerousChars = [" "].concat(dangerousCharOrChars || []);
- return new RegExp(dangerousChars.map(x => "\\".concat(x)).join("|")).test(url) ? "<".concat(url, ">") : url;
- }
-
- function printTitle(title, options, printSpace) {
- if (printSpace == null) {
- printSpace = true;
- }
-
- if (!title) {
- return "";
- }
-
- if (printSpace) {
- return " " + printTitle(title, options, false);
- }
-
- if (title.includes('"') && title.includes("'") && !title.includes(")")) {
- return "(".concat(title, ")"); // avoid escaped quotes
- } // faster than using RegExps: https://jsperf.com/performance-of-match-vs-split
-
-
- const singleCount = title.split("'").length - 1;
- const doubleCount = title.split('"').length - 1;
- const quote = singleCount > doubleCount ? '"' : doubleCount > singleCount ? "'" : options.singleQuote ? "'" : '"';
- title = title.replace(new RegExp("(".concat(quote, ")"), "g"), "\\$1");
- return "".concat(quote).concat(title).concat(quote);
- }
-
- function normalizeParts$2(parts) {
- return parts.reduce((current, part) => {
- const lastPart = util$1.getLast(current);
-
- if (typeof lastPart === "string" && typeof part === "string") {
- current.splice(-1, 1, lastPart + part);
- } else {
- current.push(part);
- }
-
- return current;
- }, []);
- }
-
- function clamp(value, min, max) {
- return value < min ? min : value > max ? max : value;
- }
-
- function clean$6(ast, newObj, parent) {
- delete newObj.position;
- delete newObj.raw; // front-matter
- // for codeblock
-
- if (ast.type === "code" || ast.type === "yaml" || ast.type === "import" || ast.type === "export" || ast.type === "jsx") {
- delete newObj.value;
- }
-
- if (ast.type === "list") {
- delete newObj.isAligned;
- } // texts can be splitted or merged
-
-
- if (ast.type === "text") {
- return null;
- }
-
- if (ast.type === "inlineCode") {
- newObj.value = ast.value.replace(/[ \t\n]+/g, " ");
- } // for insert pragma
-
-
- 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)) {
- return null;
- }
- }
-
- function hasPrettierIgnore$6(path) {
- const index = +path.getName();
-
- if (index === 0) {
- return false;
- }
-
- const prevNode = path.getParentNode().children[index - 1];
- return isPrettierIgnore$1(prevNode) === "next";
- }
-
- var printerMarkdown = {
- preprocess: preprocess_1$2,
- print: genericPrint$5,
- embed: embed_1$2,
- massageAstNode: clean$6,
- hasPrettierIgnore: hasPrettierIgnore$6,
- insertPragma: pragma$4.insertPragma
- };
-
- var options$6 = {
- proseWrap: commonOptions.proseWrap,
- singleQuote: commonOptions.singleQuote
- };
-
- var name$g = "Markdown";
- var type$f = "prose";
- var aliases$5 = [
- "pandoc"
- ];
- var aceMode$f = "markdown";
- var codemirrorMode$b = "gfm";
- var codemirrorMimeType$b = "text/x-gfm";
- var wrap = true;
- var extensions$f = [
- ".md",
- ".markdown",
- ".mdown",
- ".mdwn",
- ".mdx",
- ".mkd",
- ".mkdn",
- ".mkdown",
- ".ronn",
- ".workbook"
- ];
- var filenames$3 = [
- "contents.lr"
- ];
- var tmScope$f = "source.gfm";
- var languageId$f = 222;
- var Markdown = {
- name: name$g,
- type: type$f,
- aliases: aliases$5,
- aceMode: aceMode$f,
- codemirrorMode: codemirrorMode$b,
- codemirrorMimeType: codemirrorMimeType$b,
- wrap: wrap,
- extensions: extensions$f,
- filenames: filenames$3,
- tmScope: tmScope$f,
- languageId: languageId$f
- };
-
- var Markdown$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$g,
- type: type$f,
- aliases: aliases$5,
- aceMode: aceMode$f,
- codemirrorMode: codemirrorMode$b,
- codemirrorMimeType: codemirrorMimeType$b,
- wrap: wrap,
- extensions: extensions$f,
- filenames: filenames$3,
- tmScope: tmScope$f,
- languageId: languageId$f,
- 'default': Markdown
- });
-
- var require$$0$7 = getCjsExportFromNamespace(Markdown$1);
-
- const languages$5 = [createLanguage(require$$0$7, data => ({
- since: "1.8.0",
- parsers: ["markdown"],
- vscodeLanguageIds: ["markdown"],
- filenames: data.filenames.concat(["README"]),
- extensions: data.extensions.filter(extension => extension !== ".mdx")
- })), createLanguage(require$$0$7, () => ({
- name: "MDX",
- since: "1.15.0",
- parsers: ["mdx"],
- vscodeLanguageIds: ["mdx"],
- filenames: [],
- extensions: [".mdx"]
- }))];
- const printers$5 = {
- mdast: printerMarkdown
- };
- var languageMarkdown = {
- languages: languages$5,
- options: options$6,
- printers: printers$5
- };
-
- function isPragma(text) {
- return /^\s*@(prettier|format)\s*$/.test(text);
- }
-
- function hasPragma$4(text) {
- return /^\s*#[^\n\S]*@(prettier|format)\s*?(\n|$)/.test(text);
- }
-
- function insertPragma$8(text) {
- return "# @format\n\n".concat(text);
- }
-
- var pragma$5 = {
- isPragma,
- hasPragma: hasPragma$4,
- insertPragma: insertPragma$8
- };
-
- const {
- getLast: getLast$5
- } = util$1;
-
- function getAncestorCount(path, filter) {
- let counter = 0;
- const pathStackLength = path.stack.length - 1;
-
- for (let i = 0; i < pathStackLength; i++) {
- const value = path.stack[i];
-
- if (isNode(value) && filter(value)) {
- counter++;
- }
- }
-
- return counter;
- }
- /**
- * @param {any} value
- * @param {string[]=} types
- */
-
-
- function isNode(value, types) {
- return value && typeof value.type === "string" && (!types || types.includes(value.type));
- }
-
- function mapNode(node, callback, parent) {
- return callback("children" in node ? Object.assign({}, node, {
- children: node.children.map(childNode => mapNode(childNode, callback, node))
- }) : node, parent);
- }
-
- function defineShortcut(x, key, getter) {
- Object.defineProperty(x, key, {
- get: getter,
- enumerable: false
- });
- }
-
- function isNextLineEmpty$5(node, text) {
- let newlineCount = 0;
- const textLength = text.length;
-
- for (let i = node.position.end.offset - 1; i < textLength; i++) {
- const char = text[i];
-
- if (char === "\n") {
- newlineCount++;
- }
-
- if (newlineCount === 1 && /\S/.test(char)) {
- return false;
- }
-
- if (newlineCount === 2) {
- return true;
- }
- }
-
- return false;
- }
-
- function isLastDescendantNode(path) {
- const node = path.getValue();
-
- switch (node.type) {
- case "tag":
- case "anchor":
- case "comment":
- return false;
- }
-
- const pathStackLength = path.stack.length;
-
- for (let i = 1; i < pathStackLength; i++) {
- const item = path.stack[i];
- const parentItem = path.stack[i - 1];
-
- if (Array.isArray(parentItem) && typeof item === "number" && item !== parentItem.length - 1) {
- return false;
- }
- }
-
- return true;
- }
-
- function getLastDescendantNode$1(node) {
- return "children" in node && node.children.length !== 0 ? getLastDescendantNode$1(getLast$5(node.children)) : node;
- }
-
- function isPrettierIgnore$2(comment) {
- return comment.value.trim() === "prettier-ignore";
- }
-
- function hasPrettierIgnore$7(path) {
- const node = path.getValue();
-
- if (node.type === "documentBody") {
- const document = path.getParentNode();
- return hasEndComments(document.head) && isPrettierIgnore$2(getLast$5(document.head.endComments));
- }
-
- return hasLeadingComments(node) && isPrettierIgnore$2(getLast$5(node.leadingComments));
- }
-
- function isEmptyNode(node) {
- return (!node.children || node.children.length === 0) && !hasComments(node);
- }
-
- function hasComments(node) {
- return hasLeadingComments(node) || hasMiddleComments(node) || hasIndicatorComment(node) || hasTrailingComment$2(node) || hasEndComments(node);
- }
-
- function hasLeadingComments(node) {
- return node && node.leadingComments && node.leadingComments.length !== 0;
- }
-
- function hasMiddleComments(node) {
- return node && node.middleComments && node.middleComments.length !== 0;
- }
-
- function hasIndicatorComment(node) {
- return node && node.indicatorComment;
- }
-
- function hasTrailingComment$2(node) {
- return node && node.trailingComment;
- }
-
- function hasEndComments(node) {
- return node && node.endComments && node.endComments.length !== 0;
- }
- /**
- * " a b c d e f " -> [" a b", "c d", "e f "]
- */
-
-
- function splitWithSingleSpace(text) {
- const parts = [];
- let lastPart = undefined;
-
- for (const part of text.split(/( +)/g)) {
- if (part !== " ") {
- if (lastPart === " ") {
- parts.push(part);
- } else {
- parts.push((parts.pop() || "") + part);
- }
- } else if (lastPart === undefined) {
- parts.unshift("");
- }
-
- lastPart = part;
- }
-
- if (lastPart === " ") {
- parts.push((parts.pop() || "") + " ");
- }
-
- if (parts[0] === "") {
- parts.shift();
- parts.unshift(" " + (parts.shift() || ""));
- }
-
- return parts;
- }
-
- function getFlowScalarLineContents(nodeType, content, options) {
- 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());
-
- if (options.proseWrap === "preserve") {
- return rawLineContents.map(lineContent => lineContent.length === 0 ? [] : [lineContent]);
- }
-
- 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
- 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);
- }
-
- function getBlockValueLineContents(node, {
- parentIndent,
- isLastDescendant,
- options
- }) {
- 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 `|`
- .match(/^[^\n]*?\n([\s\S]*)$/)[1];
- const leadingSpaceCount = node.indent === null ? (match => match ? match[1].length : Infinity)(content.match(/^( *)\S/m)) : node.indent - 1 + parentIndent;
- const rawLineContents = content.split("\n").map(lineContent => lineContent.slice(leadingSpaceCount));
-
- if (options.proseWrap === "preserve" || node.type === "blockLiteral") {
- return removeUnnecessaryTrailingNewlines(rawLineContents.map(lineContent => lineContent.length === 0 ? [] : [lineContent]));
- }
-
- 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
- reduced.length !== 0 && /\s$/.test(getLast$5(reduced)) ? reduced.concat(reduced.pop() + " " + word) : reduced.concat(word), [])).map(lineContentWords => options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords));
-
- function removeUnnecessaryTrailingNewlines(lineContents) {
- if (node.chomping === "keep") {
- return getLast$5(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
- }
-
- let trailingNewlineCount = 0;
-
- for (let i = lineContents.length - 1; i >= 0; i--) {
- if (lineContents[i].length === 0) {
- trailingNewlineCount++;
- } else {
- break;
- }
- }
-
- return trailingNewlineCount === 0 ? lineContents : trailingNewlineCount >= 2 && !isLastDescendant ? // next empty line
- lineContents.slice(0, -(trailingNewlineCount - 1)) : lineContents.slice(0, -trailingNewlineCount);
- }
- }
-
- var utils$7 = {
- getLast: getLast$5,
- getAncestorCount,
- isNode,
- isEmptyNode,
- mapNode,
- defineShortcut,
- isNextLineEmpty: isNextLineEmpty$5,
- isLastDescendantNode,
- getBlockValueLineContents,
- getFlowScalarLineContents,
- getLastDescendantNode: getLastDescendantNode$1,
- hasPrettierIgnore: hasPrettierIgnore$7,
- hasLeadingComments,
- hasMiddleComments,
- hasIndicatorComment,
- hasTrailingComment: hasTrailingComment$2,
- hasEndComments
- };
-
- const {
- insertPragma: insertPragma$9,
- isPragma: isPragma$1
- } = pragma$5;
- const {
- getAncestorCount: getAncestorCount$1,
- getBlockValueLineContents: getBlockValueLineContents$1,
- getFlowScalarLineContents: getFlowScalarLineContents$1,
- getLast: getLast$6,
- getLastDescendantNode: getLastDescendantNode$2,
- hasLeadingComments: hasLeadingComments$1,
- hasMiddleComments: hasMiddleComments$1,
- hasIndicatorComment: hasIndicatorComment$1,
- hasTrailingComment: hasTrailingComment$3,
- hasEndComments: hasEndComments$1,
- hasPrettierIgnore: hasPrettierIgnore$8,
- isLastDescendantNode: isLastDescendantNode$1,
- isNextLineEmpty: isNextLineEmpty$6,
- isNode: isNode$1,
- isEmptyNode: isEmptyNode$1,
- defineShortcut: defineShortcut$1,
- mapNode: mapNode$1
- } = utils$7;
- const docBuilders$2 = document.builders;
- const {
- conditionalGroup: conditionalGroup$2,
- breakParent: breakParent$5,
- concat: concat$h,
- dedent: dedent$3,
- dedentToRoot: dedentToRoot$3,
- fill: fill$6,
- group: group$g,
- hardline: hardline$d,
- ifBreak: ifBreak$8,
- join: join$c,
- line: line$b,
- lineSuffix: lineSuffix$2,
- literalline: literalline$7,
- markAsRoot: markAsRoot$5,
- softline: softline$8
- } = docBuilders$2;
- const {
- replaceEndOfLineWith: replaceEndOfLineWith$3
- } = util$1;
-
- function preprocess$3(ast) {
- return mapNode$1(ast, defineShortcuts);
- }
-
- function defineShortcuts(node) {
- switch (node.type) {
- case "document":
- defineShortcut$1(node, "head", () => node.children[0]);
- defineShortcut$1(node, "body", () => node.children[1]);
- break;
-
- case "documentBody":
- case "sequenceItem":
- case "flowSequenceItem":
- case "mappingKey":
- case "mappingValue":
- defineShortcut$1(node, "content", () => node.children[0]);
- break;
-
- case "mappingItem":
- case "flowMappingItem":
- defineShortcut$1(node, "key", () => node.children[0]);
- defineShortcut$1(node, "value", () => node.children[1]);
- break;
- }
-
- return node;
- }
-
- function genericPrint$6(path, options, print) {
- const node = path.getValue();
- const parentNode = path.getParentNode();
- const tag = !node.tag ? "" : path.call(print, "tag");
- const anchor = !node.anchor ? "" : path.call(print, "anchor");
- const nextEmptyLine = isNode$1(node, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !isLastDescendantNode$1(path) ? printNextEmptyLine(path, options.originalText) : "";
- 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"))])) : ""]);
- }
-
- function _print(node, parentNode, path, options, print) {
- switch (node.type) {
- case "root":
- return concat$h([join$c(hardline$d, path.map((childPath, index) => {
- const document = node.children[index];
- const nextDocument = node.children[index + 1];
- 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, "---"])]);
- }, "children")), node.children.length === 0 || (lastDescendantNode => isNode$1(lastDescendantNode, ["blockLiteral", "blockFolded"]) && lastDescendantNode.chomping === "keep")(getLastDescendantNode$2(node)) ? "" : hardline$d]);
-
- case "document":
- {
- const nextDocument = parentNode.children[path.getName() + 1];
- 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));
- }
-
- case "documentHead":
- return join$c(hardline$d, [].concat(path.map(print, "children"), path.map(print, "endComments")));
-
- case "documentBody":
- {
- const children = join$c(hardline$d, path.map(print, "children")).parts;
- const endComments = join$c(hardline$d, path.map(print, "endComments")).parts;
- 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)
- "" : // an extra newline for better readability
- concat$h([hardline$d, hardline$d]) : hardline$d)(getLastDescendantNode$2(node));
- return concat$h([].concat(children, separator, endComments));
- }
-
- case "directive":
- return concat$h(["%", join$c(" ", [node.name].concat(node.parameters))]);
-
- case "comment":
- return concat$h(["#", node.value]);
-
- case "alias":
- return concat$h(["*", node.value]);
-
- case "tag":
- return options.originalText.slice(node.position.start.offset, node.position.end.offset);
-
- case "anchor":
- return concat$h(["&", node.value]);
-
- case "plain":
- return printFlowScalarContent(node.type, options.originalText.slice(node.position.start.offset, node.position.end.offset), options);
-
- case "quoteDouble":
- case "quoteSingle":
- {
- const singleQuote = "'";
- const doubleQuote = '"';
- const raw = options.originalText.slice(node.position.start.offset + 1, node.position.end.offset - 1);
-
- if (node.type === "quoteSingle" && raw.includes("\\") || node.type === "quoteDouble" && /\\[^"]/.test(raw)) {
- // only quoteDouble can use escape chars
- // and quoteSingle do not need to escape backslashes
- const originalQuote = node.type === "quoteDouble" ? doubleQuote : singleQuote;
- return concat$h([originalQuote, printFlowScalarContent(node.type, raw, options), originalQuote]);
- } else if (raw.includes(doubleQuote)) {
- return concat$h([singleQuote, printFlowScalarContent(node.type, node.type === "quoteDouble" ? raw // double quote needs to be escaped by backslash in quoteDouble
- .replace(/\\"/g, doubleQuote).replace(/'/g, singleQuote.repeat(2)) : raw, options), singleQuote]);
- }
-
- if (raw.includes(singleQuote)) {
- return concat$h([doubleQuote, printFlowScalarContent(node.type, node.type === "quoteSingle" ? // single quote needs to be escaped by 2 single quotes in quoteSingle
- raw.replace(/''/g, singleQuote) : raw, options), doubleQuote]);
- }
-
- const quote = options.singleQuote ? singleQuote : doubleQuote;
- return concat$h([quote, printFlowScalarContent(node.type, raw, options), quote]);
- }
-
- case "blockFolded":
- case "blockLiteral":
- {
- const parentIndent = getAncestorCount$1(path, ancestorNode => isNode$1(ancestorNode, ["sequence", "mapping"]));
- const isLastDescendant = isLastDescendantNode$1(path);
- 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, {
- parentIndent,
- isLastDescendant,
- options
- }).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) : ""), []))))]);
- }
-
- case "sequence":
- return join$c(hardline$d, path.map(print, "children"));
-
- case "sequenceItem":
- return concat$h(["- ", align$3(2, !node.content ? "" : path.call(print, "content"))]);
-
- case "mappingKey":
- return !node.content ? "" : path.call(print, "content");
-
- case "mappingValue":
- return !node.content ? "" : path.call(print, "content");
-
- case "mapping":
- return join$c(hardline$d, path.map(print, "children"));
-
- case "mappingItem":
- case "flowMappingItem":
- {
- const isEmptyMappingKey = isEmptyNode$1(node.key);
- const isEmptyMappingValue = isEmptyNode$1(node.value);
-
- if (isEmptyMappingKey && isEmptyMappingValue) {
- return concat$h([": "]);
- }
-
- const key = path.call(print, "key");
- const value = path.call(print, "value");
-
- if (isEmptyMappingValue) {
- 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)]);
- }
-
- if (isEmptyMappingKey) {
- return concat$h([": ", align$3(2, value)]);
- }
-
- const groupId = Symbol("mappingKey");
- const forceExplicitKey = hasLeadingComments$1(node.value) || !isInlineNode(node.key.content);
- 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
- 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), {
- id: groupId
- })])), 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])), {
- groupId
- })])]);
- }
-
- case "flowMapping":
- case "flowSequence":
- {
- const openMarker = node.type === "flowMapping" ? "{" : "[";
- const closeMarker = node.type === "flowMapping" ? "}" : "]";
- const bracketSpacing = node.type === "flowMapping" && node.children.length !== 0 && options.bracketSpacing ? line$b : softline$8;
-
- const isLastItemEmptyMappingItem = node.children.length !== 0 && (lastItem => lastItem.type === "flowMappingItem" && isEmptyNode$1(lastItem.key) && isEmptyNode$1(lastItem.value))(getLast$6(node.children));
-
- 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]);
- }
-
- case "flowSequenceItem":
- return path.call(print, "content");
- // istanbul ignore next
-
- default:
- throw new Error("Unexpected node type ".concat(node.type));
- }
-
- function indent(doc) {
- return docBuilders$2.align(" ".repeat(options.tabWidth), doc);
- }
- }
-
- function align$3(n, doc) {
- return typeof n === "number" && n > 0 ? docBuilders$2.align(" ".repeat(n), doc) : docBuilders$2.align(n, doc);
- }
-
- function isInlineNode(node) {
- if (!node) {
- return true;
- }
-
- switch (node.type) {
- case "plain":
- case "quoteDouble":
- case "quoteSingle":
- case "alias":
- case "flowMapping":
- case "flowSequence":
- return true;
-
- default:
- return false;
- }
- }
-
- function isSingleLineNode(node) {
- if (!node) {
- return true;
- }
-
- switch (node.type) {
- case "plain":
- case "quoteDouble":
- case "quoteSingle":
- return node.position.start.line === node.position.end.line;
-
- case "alias":
- return true;
-
- default:
- return false;
- }
- }
-
- function shouldPrintDocumentBody(document) {
- return document.body.children.length !== 0 || hasEndComments$1(document.body);
- }
-
- function shouldPrintDocumentEndMarker(document, nextDocument) {
- return (
- /**
- *... # trailingComment
- */
- hasTrailingComment$3(document) || nextDocument && (
- /**
- * ...
- * %DIRECTIVE
- * ---
- */
- nextDocument.head.children.length !== 0 ||
- /**
- * ...
- * # endComment
- * ---
- */
- hasEndComments$1(nextDocument.head))
- );
- }
-
- function shouldPrintDocumentHeadEndMarker(document, nextDocument, root, options) {
- if (
- /**
- * ---
- * preserve the first document head end marker
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).prettier=t()}(this,(function(){"use strict";function e(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function t(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var n={name:"prettier",version:"2.2.1",description:"Prettier is an opinionated code formatter",bin:"./bin/prettier.js",repository:"prettier/prettier",homepage:"https://prettier.io",author:"James Long",license:"MIT",main:"./index.js",browser:"./standalone.js",unpkg:"./standalone.js",engines:{node:">=10.13.0"},files:["index.js","standalone.js","src","bin"],dependencies:{"@angular/compiler":"10.2.3","@babel/code-frame":"7.10.4","@babel/parser":"7.12.5","@glimmer/syntax":"0.66.0","@iarna/toml":"2.2.5","@typescript-eslint/typescript-estree":"4.8.1","angular-estree-parser":"2.2.1","angular-html-parser":"1.7.1",camelcase:"6.2.0",chalk:"4.1.0","ci-info":"watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540","cjk-regex":"2.0.0",cosmiconfig:"7.0.0",dashify:"2.0.0",diff:"5.0.0",editorconfig:"0.15.3","editorconfig-to-prettier":"0.2.0","escape-string-regexp":"4.0.0",espree:"7.3.0",esutils:"2.0.3","fast-glob":"3.2.4","fast-json-stable-stringify":"2.1.0","find-parent-dir":"0.3.0","flow-parser":"0.138.0","get-stdin":"8.0.0",globby:"11.0.1",graphql:"15.4.0","html-element-attributes":"2.3.0","html-styles":"1.0.0","html-tag-names":"1.1.5","html-void-elements":"1.0.5",ignore:"4.0.6","jest-docblock":"26.0.0",json5:"2.1.3",leven:"3.1.0","lines-and-columns":"1.1.6","linguist-languages":"7.12.1",lodash:"4.17.20",mem:"8.0.0",meriyah:"3.1.6",minimatch:"3.0.4",minimist:"1.2.5","n-readlines":"1.0.1",outdent:"0.7.1","parse-srcset":"ikatyang/parse-srcset#54eb9c1cb21db5c62b4d0e275d7249516df6f0ee","please-upgrade-node":"3.2.0","postcss-less":"3.1.4","postcss-media-query-parser":"0.2.3","postcss-scss":"2.1.1","postcss-selector-parser":"2.2.3","postcss-values-parser":"2.0.1","regexp-util":"1.2.2","remark-footnotes":"2.0.0","remark-math":"3.0.1","remark-parse":"8.0.3",resolve:"1.19.0",semver:"7.3.2","string-width":"4.2.0",typescript:"4.1.2","unicode-regex":"3.0.0",unified:"9.2.0",vnopts:"1.0.2","yaml-unist-parser":"1.3.1"},devDependencies:{"@babel/core":"7.12.3","@babel/preset-env":"7.12.1","@babel/types":"7.12.6","@glimmer/reference":"0.66.0","@rollup/plugin-alias":"3.1.1","@rollup/plugin-babel":"5.2.1","@rollup/plugin-commonjs":"16.0.0","@rollup/plugin-json":"4.1.0","@rollup/plugin-node-resolve":"10.0.0","@rollup/plugin-replace":"2.3.4","@types/estree":"0.0.45","@types/node":"14.14.0","@typescript-eslint/types":"4.8.1","babel-jest":"26.6.3","babel-loader":"8.2.1",benchmark:"2.1.4","builtin-modules":"3.1.0","cross-env":"7.0.2",cspell:"4.2.2",eslint:"7.13.0","eslint-config-prettier":"6.15.0","eslint-formatter-friendly":"7.0.0","eslint-plugin-import":"2.22.1","eslint-plugin-jest":"24.1.3","eslint-plugin-prettier-internal-rules":"file:scripts/tools/eslint-plugin-prettier-internal-rules","eslint-plugin-react":"7.21.5","eslint-plugin-unicorn":"23.0.0",execa:"4.1.0",jest:"26.6.3","jest-snapshot-serializer-ansi":"1.0.0","jest-snapshot-serializer-raw":"1.1.0","jest-watch-typeahead":"0.6.1","npm-run-all":"4.1.5","path-browserify":"1.0.1",prettier:"2.2.0",rimraf:"3.0.2",rollup:"2.33.3","rollup-plugin-node-globals":"1.4.0","rollup-plugin-terser":"7.0.2",shelljs:"0.8.4","snapshot-diff":"0.8.1","strip-ansi":"6.0.0","synchronous-promise":"2.0.15",tempy:"1.0.0","terser-webpack-plugin":"5.0.3",webpack:"5.5.1"},scripts:{prepublishOnly:'echo "Error: must publish from dist/" && exit 1',"prepare-release":"yarn && yarn build && yarn test:dist",test:"jest","test:dev-package":"cross-env INSTALL_PACKAGE=1 jest","test:dist":"cross-env NODE_ENV=production jest","test:dist-standalone":"cross-env NODE_ENV=production TEST_STANDALONE=1 jest","test:integration":"jest tests_integration","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","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","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",lint:"run-p lint:*","lint:typecheck":"tsc","lint:eslint":"cross-env EFF_NO_LINK_RULES=true eslint . --format friendly","lint:changelog":"node ./scripts/lint-changelog.js","lint:prettier":'prettier . "!test*" --check',"lint:dist":'eslint --no-eslintrc --no-ignore --env=es6,browser --parser-options=ecmaVersion:2018 "dist/!(bin-prettier|index|third-party).js"',"lint:spellcheck":'cspell "**/*" ".github/**/*"',"lint:deps":"node ./scripts/check-deps.js",fix:"run-s fix:eslint fix:prettier","fix:eslint":"yarn lint:eslint --fix","fix:prettier":"yarn lint:prettier --write",build:"node --max-old-space-size=3072 ./scripts/build/build.js","build-docs":"node ./scripts/build-docs.js"}};function r(){}function o(e,t,n,r,o){for(var u=0,i=t.length,a=0,s=0;u<i;u++){var c=t[u];if(c.removed){if(c.value=e.join(r.slice(s,s+c.count)),s+=c.count,u&&t[u-1].added){var l=t[u-1];t[u-1]=t[u],t[u]=l}}else{if(!c.added&&o){var p=n.slice(a,a+c.count);p=p.map((function(e,t){var n=r[s+t];return n.length>e.length?n:e})),c.value=e.join(p)}else c.value=e.join(n.slice(a,a+c.count));a+=c.count,c.added||(s+=c.count)}}var d=t[i-1];return i>1&&"string"==typeof d.value&&(d.added||d.removed)&&e.equals("",d.value)&&(t[i-2].value+=d.value,t.pop()),t}function u(e){return{newPos:e.newPos,components:e.components.slice(0)}}r.prototype={diff:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.callback;"function"==typeof n&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout((function(){r(void 0,e)}),0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e));var s=(t=this.removeEmpty(this.tokenize(t))).length,c=e.length,l=1,p=s+c,d=[{newPos:-1,components:[]}],f=this.extractCommon(d[0],t,e,0);if(d[0].newPos+1>=s&&f+1>=c)return a([{value:this.join(t),count:t.length}]);function h(){for(var n=-1*l;n<=l;n+=2){var r=void 0,p=d[n-1],f=d[n+1],h=(f?f.newPos:0)-n;p&&(d[n-1]=void 0);var m=p&&p.newPos+1<s,g=f&&0<=h&&h<c;if(m||g){if(!m||g&&p.newPos<f.newPos?(r=u(f),i.pushComponent(r.components,void 0,!0)):((r=p).newPos++,i.pushComponent(r.components,!0,void 0)),h=i.extractCommon(r,t,e,n),r.newPos+1>=s&&h+1>=c)return a(o(i,r.components,t,e,i.useLongestToken));d[n]=r}else d[n]=void 0}l++}if(r)!function e(){setTimeout((function(){if(l>p)return r();h()||e()}),0)}();else for(;l<=p;){var m=h();if(m)return m}},pushComponent:function(e,t,n){var r=e[e.length-1];r&&r.added===t&&r.removed===n?e[e.length-1]={count:r.count+1,added:t,removed:n}:e.push({count:1,added:t,removed:n})},extractCommon:function(e,t,n,r){for(var o=t.length,u=n.length,i=e.newPos,a=i-r,s=0;i+1<o&&a+1<u&&this.equals(t[i+1],n[a+1]);)i++,a++,s++;return s&&e.components.push({count:s}),e.newPos=i,a},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};var i=new r;function a(e,t){if("function"==typeof e)t.callback=e;else if(e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var s=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,c=/\S/,l=new r;l.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!c.test(e)&&!c.test(t)},l.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&s.test(t[n])&&s.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};var p=new r;function d(e,t,n){return p.diff(e,t,n)}p.tokenize=function(e){var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var o=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=o:(this.options.ignoreWhitespace&&(o=o.trim()),t.push(o))}return t};var f=new r;f.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var h=new r;function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e){return function(e){if(Array.isArray(e))return D(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return D(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}h.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};var y=Object.prototype.toString,E=new r;function C(e,t,n,r,o){var u,i;for(t=t||[],n=n||[],r&&(e=r(o,e)),u=0;u<t.length;u+=1)if(t[u]===e)return n[u];if("[object Array]"===y.call(e)){for(t.push(e),i=new Array(e.length),n.push(i),u=0;u<e.length;u+=1)i[u]=C(e[u],t,n,r,o);return t.pop(),n.pop(),i}if(e&&e.toJSON&&(e=e.toJSON()),"object"===m(e)&&null!==e){t.push(e),i={},n.push(i);var a,s=[];for(a in e)e.hasOwnProperty(a)&&s.push(a);for(s.sort(),u=0;u<s.length;u+=1)i[a=s[u]]=C(e[a],t,n,r,a);t.pop(),n.pop()}else i=e;return i}E.useLongestToken=!0,E.tokenize=p.tokenize,E.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,o=void 0===r?function(e,t){return void 0===t?n:t}:r;return"string"==typeof e?e:JSON.stringify(C(e,null,null,o),o," ")},E.equals=function(e,t){return r.prototype.equals.call(E,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"))};var b=new r;function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.split(/\r\n|[\n\v\f\r\x85]/),r=e.match(/\r\n|[\n\v\f\r\x85]/g)||[],o=[],u=0;function i(){var e={};for(o.push(e);u<n.length;){var r=n[u];if(/^(\-\-\-|\+\+\+|@@)\s/.test(r))break;var i=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(r);i&&(e.index=i[1]),u++}for(a(e),a(e),e.hunks=[];u<n.length;){var c=n[u];if(/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(c))break;if(/^@@/.test(c))e.hunks.push(s());else{if(c&&t.strict)throw new Error("Unknown line "+(u+1)+" "+JSON.stringify(c));u++}}}function a(e){var t=/^(---|\+\+\+)\s+(.*)$/.exec(n[u]);if(t){var r="---"===t[1]?"old":"new",o=t[2].split("\t",2),i=o[0].replace(/\\\\/g,"\\");/^".*"$/.test(i)&&(i=i.substr(1,i.length-2)),e[r+"FileName"]=i,e[r+"Header"]=(o[1]||"").trim(),u++}}function s(){var e=u,o=n[u++].split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),i={oldStart:+o[1],oldLines:void 0===o[2]?1:+o[2],newStart:+o[3],newLines:void 0===o[4]?1:+o[4],lines:[],linedelimiters:[]};0===i.oldLines&&(i.oldStart+=1),0===i.newLines&&(i.newStart+=1);for(var a=0,s=0;u<n.length&&!(0===n[u].indexOf("--- ")&&u+2<n.length&&0===n[u+1].indexOf("+++ ")&&0===n[u+2].indexOf("@@"));u++){var c=0==n[u].length&&u!=n.length-1?" ":n[u][0];if("+"!==c&&"-"!==c&&" "!==c&&"\\"!==c)break;i.lines.push(n[u]),i.linedelimiters.push(r[u]||"\n"),"+"===c?a++:"-"===c?s++:" "===c&&(a++,s++)}if(a||1!==i.newLines||(i.newLines=0),s||1!==i.oldLines||(i.oldLines=0),t.strict){if(a!==i.newLines)throw new Error("Added line count did not match for hunk at line "+(e+1));if(s!==i.oldLines)throw new Error("Removed line count did not match for hunk at line "+(e+1))}return i}for(;u<n.length;)i();return o}function A(e,t,n){var r=!0,o=!1,u=!1,i=1;return function a(){if(r&&!u){if(o?i++:r=!1,e+i<=n)return i;u=!0}if(!o)return u||(r=!0),t<=e-i?-i++:(o=!0,a())}}function F(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof t&&(t=v(t)),Array.isArray(t)){if(t.length>1)throw new Error("applyPatch only works with a single input.");t=t[0]}var r,o,u=e.split(/\r\n|[\n\v\f\r\x85]/),i=e.match(/\r\n|[\n\v\f\r\x85]/g)||[],a=t.hunks,s=n.compareLine||function(e,t,n,r){return t===r},c=0,l=n.fuzzFactor||0,p=0,d=0;function f(e,t){for(var n=0;n<e.lines.length;n++){var r=e.lines[n],o=r.length>0?r[0]:" ",i=r.length>0?r.substr(1):r;if(" "===o||"-"===o){if(!s(t+1,u[t],o,i)&&++c>l)return!1;t++}}return!0}for(var h=0;h<a.length;h++){for(var m=a[h],g=u.length-m.oldLines,D=0,y=d+m.oldStart-1,E=A(y,p,g);void 0!==D;D=E())if(f(m,y+D)){m.offset=d+=D;break}if(void 0===D)return!1;p=m.offset+m.oldStart+m.oldLines}for(var C=0,b=0;b<a.length;b++){var F=a[b],x=F.oldStart+F.offset+C-1;C+=F.newLines-F.oldLines;for(var S=0;S<F.lines.length;S++){var w=F.lines[S],T=w.length>0?w[0]:" ",B=w.length>0?w.substr(1):w,N=F.linedelimiters[S];if(" "===T)x++;else if("-"===T)u.splice(x,1),i.splice(x,1);else if("+"===T)u.splice(x,0,B),i.splice(x,0,N),x++;else if("\\"===T){var k=F.lines[S-1]?F.lines[S-1][0]:null;"+"===k?r=!0:"-"===k&&(o=!0)}}}if(r)for(;!u[u.length-1];)u.pop(),i.pop();else o&&(u.push(""),i.push("\n"));for(var P=0;P<u.length-1;P++)u[P]=u[P]+i[P];return u.join("")}function x(e,t,n,r,o,u,i){i||(i={}),void 0===i.context&&(i.context=4);var a=d(n,r,i);function s(e){return e.map((function(e){return" "+e}))}a.push({value:"",lines:[]});for(var c=[],l=0,p=0,f=[],h=1,m=1,D=function(e){var t=a[e],o=t.lines||t.value.replace(/\n$/,"").split("\n");if(t.lines=o,t.added||t.removed){var u;if(!l){var d=a[e-1];l=h,p=m,d&&(f=i.context>0?s(d.lines.slice(-i.context)):[],l-=f.length,p-=f.length)}(u=f).push.apply(u,g(o.map((function(e){return(t.added?"+":"-")+e})))),t.added?m+=o.length:h+=o.length}else{if(l)if(o.length<=2*i.context&&e<a.length-2){var D;(D=f).push.apply(D,g(s(o)))}else{var y,E=Math.min(o.length,i.context);(y=f).push.apply(y,g(s(o.slice(0,E))));var C={oldStart:l,oldLines:h-l+E,newStart:p,newLines:m-p+E,lines:f};if(e>=a.length-2&&o.length<=i.context){var b=/\n$/.test(n),v=/\n$/.test(r),A=0==o.length&&f.length>C.oldLines;!b&&A&&n.length>0&&f.splice(C.oldLines,0,"\\ No newline at end of file"),(b||A)&&v||f.push("\\ No newline at end of file")}c.push(C),l=0,p=0,f=[]}h+=o.length,m+=o.length}},y=0;y<a.length;y++)D(y);return{oldFileName:e,newFileName:t,oldHeader:o,newHeader:u,hunks:c}}function S(e,t,n,r,o,u,i){return function(e){var t=[];e.oldFileName==e.newFileName&&t.push("Index: "+e.oldFileName),t.push("==================================================================="),t.push("--- "+e.oldFileName+(void 0===e.oldHeader?"":"\t"+e.oldHeader)),t.push("+++ "+e.newFileName+(void 0===e.newHeader?"":"\t"+e.newHeader));for(var n=0;n<e.hunks.length;n++){var r=e.hunks[n];0===r.oldLines&&(r.oldStart-=1),0===r.newLines&&(r.newStart-=1),t.push("@@ -"+r.oldStart+","+r.oldLines+" +"+r.newStart+","+r.newLines+" @@"),t.push.apply(t,r.lines)}return t.join("\n")+"\n"}(x(e,t,n,r,o,u,i))}function w(e,t){if(t.length>e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function T(e){var t=W(e.lines),n=t.oldLines,r=t.newLines;void 0!==n?e.oldLines=n:delete e.oldLines,void 0!==r?e.newLines=r:delete e.newLines}function B(e,t){if("string"==typeof e){if(/^@@/m.test(e)||/^Index:/m.test(e))return v(e)[0];if(!t)throw new Error("Must provide a base reference or pass in a patch");return x(void 0,void 0,t,e)}return e}function N(e){return e.newFileName&&e.newFileName!==e.oldFileName}function k(e,t,n){return t===n?t:(e.conflict=!0,{mine:t,theirs:n})}function P(e,t){return e.oldStart<t.oldStart&&e.oldStart+e.oldLines<t.oldStart}function O(e,t){return{oldStart:e.oldStart,oldLines:e.oldLines,newStart:e.newStart+t,newLines:e.newLines,lines:e.lines}}function I(e,t,n,r,o){var u={offset:t,lines:n,index:0},i={offset:r,lines:o,index:0};for(_(e,u,i),_(e,i,u);u.index<u.lines.length&&i.index<i.lines.length;){var a=u.lines[u.index],s=i.lines[i.index];if("-"!==a[0]&&"+"!==a[0]||"-"!==s[0]&&"+"!==s[0])if("+"===a[0]&&" "===s[0]){var c;(c=e.lines).push.apply(c,g(V(u)))}else if("+"===s[0]&&" "===a[0]){var l;(l=e.lines).push.apply(l,g(V(i)))}else"-"===a[0]&&" "===s[0]?M(e,u,i):"-"===s[0]&&" "===a[0]?M(e,i,u,!0):a===s?(e.lines.push(a),u.index++,i.index++):j(e,V(u),V(i));else L(e,u,i)}R(e,u),R(e,i),T(e)}function L(e,t,n){var r=V(t),o=V(n);if($(r)&&$(o)){var u,i;if(w(r,o)&&q(n,r,r.length-o.length))return void(u=e.lines).push.apply(u,g(r));if(w(o,r)&&q(t,o,o.length-r.length))return void(i=e.lines).push.apply(i,g(o))}else if(function(e,t){return e.length===t.length&&w(e,t)}(r,o)){var a;return void(a=e.lines).push.apply(a,g(r))}j(e,r,o)}function M(e,t,n,r){var o,u=V(t),i=function(e,t){var n=[],r=[],o=0,u=!1,i=!1;for(;o<t.length&&e.index<e.lines.length;){var a=e.lines[e.index],s=t[o];if("+"===s[0])break;if(u=u||" "!==a[0],r.push(s),o++,"+"===a[0])for(i=!0;"+"===a[0];)n.push(a),a=e.lines[++e.index];s.substr(1)===a.substr(1)?(n.push(a),e.index++):i=!0}"+"===(t[o]||"")[0]&&u&&(i=!0);if(i)return n;for(;o<t.length;)r.push(t[o++]);return{merged:r,changes:n}}(n,u);i.merged?(o=e.lines).push.apply(o,g(i.merged)):j(e,r?i:u,r?u:i)}function j(e,t,n){e.conflict=!0,e.lines.push({conflict:!0,mine:t,theirs:n})}function _(e,t,n){for(;t.offset<n.offset&&t.index<t.lines.length;){var r=t.lines[t.index++];e.lines.push(r),t.offset++}}function R(e,t){for(;t.index<t.lines.length;){var n=t.lines[t.index++];e.lines.push(n)}}function V(e){for(var t=[],n=e.lines[e.index][0];e.index<e.lines.length;){var r=e.lines[e.index];if("-"===n&&"+"===r[0]&&(n="+"),n!==r[0])break;t.push(r),e.index++}return t}function $(e){return e.reduce((function(e,t){return e&&"-"===t[0]}),!0)}function q(e,t,n){for(var r=0;r<n;r++){var o=t[t.length-n+r].substr(1);if(e.lines[e.index+r]!==" "+o)return!1}return e.index+=n,!0}function W(e){var t=0,n=0;return e.forEach((function(e){if("string"!=typeof e){var r=W(e.mine),o=W(e.theirs);void 0!==t&&(r.oldLines===o.oldLines?t+=r.oldLines:t=void 0),void 0!==n&&(r.newLines===o.newLines?n+=r.newLines:n=void 0)}else void 0===n||"+"!==e[0]&&" "!==e[0]||n++,void 0===t||"-"!==e[0]&&" "!==e[0]||t++})),{oldLines:t,newLines:n}}function U(e){var t=e;return t=(t=(t=(t=t.replace(/&/g,"&")).replace(/</g,"<")).replace(/>/g,">")).replace(/"/g,""")}b.tokenize=function(e){return e.slice()},b.join=b.removeEmpty=function(e){return e};var J=Object.freeze({__proto__:null,Diff:r,applyPatch:F,applyPatches:function(e,t){"string"==typeof e&&(e=v(e));var n=0;!function r(){var o=e[n++];if(!o)return t.complete();t.loadFile(o,(function(e,n){if(e)return t.complete(e);var u=F(n,o,t);t.patched(o,u,(function(e){if(e)return t.complete(e);r()}))}))}()},canonicalize:C,convertChangesToDMP:function(e){for(var t,n,r=[],o=0;o<e.length;o++)n=(t=e[o]).added?1:t.removed?-1:0,r.push([n,t.value]);return r},convertChangesToXML:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r.added?t.push("<ins>"):r.removed&&t.push("<del>"),t.push(U(r.value)),r.added?t.push("</ins>"):r.removed&&t.push("</del>")}return t.join("")},createPatch:function(e,t,n,r,o,u){return S(e,e,t,n,r,o,u)},createTwoFilesPatch:S,diffArrays:function(e,t,n){return b.diff(e,t,n)},diffChars:function(e,t,n){return i.diff(e,t,n)},diffCss:function(e,t,n){return h.diff(e,t,n)},diffJson:function(e,t,n){return E.diff(e,t,n)},diffLines:d,diffSentences:function(e,t,n){return f.diff(e,t,n)},diffTrimmedLines:function(e,t,n){var r=a(n,{ignoreWhitespace:!0});return p.diff(e,t,r)},diffWords:function(e,t,n){return n=a(n,{ignoreWhitespace:!0}),l.diff(e,t,n)},diffWordsWithSpace:function(e,t,n){return l.diff(e,t,n)},merge:function(e,t,n){e=B(e,n),t=B(t,n);var r={};(e.index||t.index)&&(r.index=e.index||t.index),(e.newFileName||t.newFileName)&&(N(e)?N(t)?(r.oldFileName=k(r,e.oldFileName,t.oldFileName),r.newFileName=k(r,e.newFileName,t.newFileName),r.oldHeader=k(r,e.oldHeader,t.oldHeader),r.newHeader=k(r,e.newHeader,t.newHeader)):(r.oldFileName=e.oldFileName,r.newFileName=e.newFileName,r.oldHeader=e.oldHeader,r.newHeader=e.newHeader):(r.oldFileName=t.oldFileName||e.oldFileName,r.newFileName=t.newFileName||e.newFileName,r.oldHeader=t.oldHeader||e.oldHeader,r.newHeader=t.newHeader||e.newHeader)),r.hunks=[];for(var o=0,u=0,i=0,a=0;o<e.hunks.length||u<t.hunks.length;){var s=e.hunks[o]||{oldStart:1/0},c=t.hunks[u]||{oldStart:1/0};if(P(s,c))r.hunks.push(O(s,i)),o++,a+=s.newLines-s.oldLines;else if(P(c,s))r.hunks.push(O(c,a)),u++,i+=c.newLines-c.oldLines;else{var l={oldStart:Math.min(s.oldStart,c.oldStart),oldLines:0,newStart:Math.min(s.newStart+i,c.oldStart+a),newLines:0,lines:[]};I(l,s.oldStart,s.lines,c.oldStart,c.lines),u++,o++,r.hunks.push(l)}}return r},parsePatch:v,structuredPatch:x});function z(e){return{type:"concat",parts:e}}function H(e){return{type:"indent",contents:e}}function G(e,t){return{type:"align",contents:t,n:e}}function X(e,t){return{type:"group",id:(t=t||{}).id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}const Y={type:"break-parent"},K=z([{type:"line",hard:!0},Y]),Q=z([{type:"line",hard:!0,literal:!0},Y]);var Z={concat:z,join:function(e,t){const n=[];for(let r=0;r<t.length;r++)0!==r&&n.push(e),n.push(t[r]);return z(n)},line:{type:"line"},softline:{type:"line",soft:!0},hardline:K,literalline:Q,group:X,conditionalGroup:function(e,t){return X(e[0],Object.assign({},t,{expandedStates:e}))},fill:function(e){return{type:"fill",parts:e}},lineSuffix:function(e){return{type:"line-suffix",contents:e}},lineSuffixBoundary:{type:"line-suffix-boundary"},cursor:{type:"cursor",placeholder:Symbol("cursor")},breakParent:Y,ifBreak:function(e,t,n){return{type:"if-break",breakContents:e,flatContents:t,groupId:(n=n||{}).groupId}},trim:{type:"trim"},indent:H,align:G,addAlignmentToDoc:function(e,t,n){let r=e;if(t>0){for(let e=0;e<Math.floor(t/n);++e)r=H(r);r=G(t%n,r),r=G(-1/0,r)}return r},markAsRoot:function(e){return G({type:"root"},e)},dedentToRoot:function(e){return G(-1/0,e)},dedent:function(e){return G(-1,e)}},ee=e=>"string"==typeof e?e.replace((({onlyFirst:e=!1}={})=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")})(),""):e;const te=e=>!Number.isNaN(e)&&(e>=4352&&(e<=4447||9001===e||9002===e||11904<=e&&e<=12871&&12351!==e||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141));var ne=te,re=te;ne.default=re;const oe=e=>{if("string"!=typeof(e=e.replace(/\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," "))||0===e.length)return 0;e=ee(e);let t=0;for(let n=0;n<e.length;n++){const r=e.codePointAt(n);r<=31||r>=127&&r<=159||(r>=768&&r<=879||(r>65535&&n++,t+=ne(r)?2:1))}return t};var ue=oe,ie=oe;ue.default=ie;var ae=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")},se=e=>e[e.length-1],ce="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function le(){throw new Error("setTimeout has not been defined")}function pe(){throw new Error("clearTimeout has not been defined")}var de=le,fe=pe;function he(e){if(de===setTimeout)return setTimeout(e,0);if((de===le||!de)&&setTimeout)return de=setTimeout,setTimeout(e,0);try{return de(e,0)}catch(t){try{return de.call(null,e,0)}catch(t){return de.call(this,e,0)}}}"function"==typeof ce.setTimeout&&(de=setTimeout),"function"==typeof ce.clearTimeout&&(fe=clearTimeout);var me,ge=[],De=!1,ye=-1;function Ee(){De&&me&&(De=!1,me.length?ge=me.concat(ge):ye=-1,ge.length&&Ce())}function Ce(){if(!De){var e=he(Ee);De=!0;for(var t=ge.length;t;){for(me=ge,ge=[];++ye<t;)me&&me[ye].run();ye=-1,t=ge.length}me=null,De=!1,function(e){if(fe===clearTimeout)return clearTimeout(e);if((fe===pe||!fe)&&clearTimeout)return fe=clearTimeout,clearTimeout(e);try{fe(e)}catch(t){try{return fe.call(null,e)}catch(t){return fe.call(this,e)}}}(e)}}function be(e,t){this.fun=e,this.array=t}be.prototype.run=function(){this.fun.apply(null,this.array)};function ve(){}var Ae=ve,Fe=ve,xe=ve,Se=ve,we=ve,Te=ve,Be=ve;var Ne=ce.performance||{},ke=Ne.now||Ne.mozNow||Ne.msNow||Ne.oNow||Ne.webkitNow||function(){return(new Date).getTime()};var Pe=new Date;var Oe={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];ge.push(new be(e,t)),1!==ge.length||De||he(Ce)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Ae,addListener:Fe,once:xe,off:Se,removeListener:we,removeAllListeners:Te,emit:Be,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*ke.call(Ne),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Pe)/1e3}};var Ie="object"==typeof Oe&&Oe.env&&Oe.env.NODE_DEBUG&&/\bsemver\b/i.test(Oe.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var Le={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},Me="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function je(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}function _e(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re=je((function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n}=Le,r=(t=e.exports={}).re=[],o=t.src=[],u=t.t={};let i=0;const a=(e,t,n)=>{const a=i++;Ie(a,t),u[e]=a,o[a]=t,r[a]=new RegExp(t,n?"g":void 0)};a("NUMERICIDENTIFIER","0|[1-9]\\d*"),a("NUMERICIDENTIFIERLOOSE","[0-9]+"),a("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),a("MAINVERSION","(".concat(o[u.NUMERICIDENTIFIER],")\\.")+"(".concat(o[u.NUMERICIDENTIFIER],")\\.")+"(".concat(o[u.NUMERICIDENTIFIER],")")),a("MAINVERSIONLOOSE","(".concat(o[u.NUMERICIDENTIFIERLOOSE],")\\.")+"(".concat(o[u.NUMERICIDENTIFIERLOOSE],")\\.")+"(".concat(o[u.NUMERICIDENTIFIERLOOSE],")")),a("PRERELEASEIDENTIFIER","(?:".concat(o[u.NUMERICIDENTIFIER],"|").concat(o[u.NONNUMERICIDENTIFIER],")")),a("PRERELEASEIDENTIFIERLOOSE","(?:".concat(o[u.NUMERICIDENTIFIERLOOSE],"|").concat(o[u.NONNUMERICIDENTIFIER],")")),a("PRERELEASE","(?:-(".concat(o[u.PRERELEASEIDENTIFIER],"(?:\\.").concat(o[u.PRERELEASEIDENTIFIER],")*))")),a("PRERELEASELOOSE","(?:-?(".concat(o[u.PRERELEASEIDENTIFIERLOOSE],"(?:\\.").concat(o[u.PRERELEASEIDENTIFIERLOOSE],")*))")),a("BUILDIDENTIFIER","[0-9A-Za-z-]+"),a("BUILD","(?:\\+(".concat(o[u.BUILDIDENTIFIER],"(?:\\.").concat(o[u.BUILDIDENTIFIER],")*))")),a("FULLPLAIN","v?".concat(o[u.MAINVERSION]).concat(o[u.PRERELEASE],"?").concat(o[u.BUILD],"?")),a("FULL","^".concat(o[u.FULLPLAIN],"$")),a("LOOSEPLAIN","[v=\\s]*".concat(o[u.MAINVERSIONLOOSE]).concat(o[u.PRERELEASELOOSE],"?").concat(o[u.BUILD],"?")),a("LOOSE","^".concat(o[u.LOOSEPLAIN],"$")),a("GTLT","((?:<|>)?=?)"),a("XRANGEIDENTIFIERLOOSE","".concat(o[u.NUMERICIDENTIFIERLOOSE],"|x|X|\\*")),a("XRANGEIDENTIFIER","".concat(o[u.NUMERICIDENTIFIER],"|x|X|\\*")),a("XRANGEPLAIN","[v=\\s]*(".concat(o[u.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(o[u.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(o[u.XRANGEIDENTIFIER],")")+"(?:".concat(o[u.PRERELEASE],")?").concat(o[u.BUILD],"?")+")?)?"),a("XRANGEPLAINLOOSE","[v=\\s]*(".concat(o[u.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(o[u.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(o[u.XRANGEIDENTIFIERLOOSE],")")+"(?:".concat(o[u.PRERELEASELOOSE],")?").concat(o[u.BUILD],"?")+")?)?"),a("XRANGE","^".concat(o[u.GTLT],"\\s*").concat(o[u.XRANGEPLAIN],"$")),a("XRANGELOOSE","^".concat(o[u.GTLT],"\\s*").concat(o[u.XRANGEPLAINLOOSE],"$")),a("COERCE","".concat("(^|[^\\d])(\\d{1,").concat(n,"})")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:$|[^\\d])"),a("COERCERTL",o[u.COERCE],!0),a("LONETILDE","(?:~>?)"),a("TILDETRIM","(\\s*)".concat(o[u.LONETILDE],"\\s+"),!0),t.tildeTrimReplace="$1~",a("TILDE","^".concat(o[u.LONETILDE]).concat(o[u.XRANGEPLAIN],"$")),a("TILDELOOSE","^".concat(o[u.LONETILDE]).concat(o[u.XRANGEPLAINLOOSE],"$")),a("LONECARET","(?:\\^)"),a("CARETTRIM","(\\s*)".concat(o[u.LONECARET],"\\s+"),!0),t.caretTrimReplace="$1^",a("CARET","^".concat(o[u.LONECARET]).concat(o[u.XRANGEPLAIN],"$")),a("CARETLOOSE","^".concat(o[u.LONECARET]).concat(o[u.XRANGEPLAINLOOSE],"$")),a("COMPARATORLOOSE","^".concat(o[u.GTLT],"\\s*(").concat(o[u.LOOSEPLAIN],")$|^$")),a("COMPARATOR","^".concat(o[u.GTLT],"\\s*(").concat(o[u.FULLPLAIN],")$|^$")),a("COMPARATORTRIM","(\\s*)".concat(o[u.GTLT],"\\s*(").concat(o[u.LOOSEPLAIN],"|").concat(o[u.XRANGEPLAIN],")"),!0),t.comparatorTrimReplace="$1$2$3",a("HYPHENRANGE","^\\s*(".concat(o[u.XRANGEPLAIN],")")+"\\s+-\\s+"+"(".concat(o[u.XRANGEPLAIN],")")+"\\s*$"),a("HYPHENRANGELOOSE","^\\s*(".concat(o[u.XRANGEPLAINLOOSE],")")+"\\s+-\\s+"+"(".concat(o[u.XRANGEPLAINLOOSE],")")+"\\s*$"),a("STAR","(<|>)?=?\\s*\\*"),a("GTE0","^\\s*>=\\s*0.0.0\\s*$"),a("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}));const Ve=/^[0-9]+$/,$e=(e,t)=>{const n=Ve.test(e),r=Ve.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1};var qe={compareIdentifiers:$e,rcompareIdentifiers:(e,t)=>$e(t,e)};const{MAX_LENGTH:We,MAX_SAFE_INTEGER:Ue}=Le,{re:Je,t:ze}=Re,{compareIdentifiers:He}=qe;class Ge{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof Ge){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: ".concat(e));if(e.length>We)throw new TypeError("version is longer than ".concat(We," characters"));Ie("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?Je[ze.LOOSE]:Je[ze.FULL]);if(!n)throw new TypeError("Invalid Version: ".concat(e));if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Ue||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ue||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ue||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<Ue)return t}return e})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version="".concat(this.major,".").concat(this.minor,".").concat(this.patch),this.prerelease.length&&(this.version+="-".concat(this.prerelease.join("."))),this.version}toString(){return this.version}compare(e){if(Ie("SemVer.compare",this.version,this.options,e),!(e instanceof Ge)){if("string"==typeof e&&e===this.version)return 0;e=new Ge(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof Ge||(e=new Ge(e,this.options)),He(this.major,e.major)||He(this.minor,e.minor)||He(this.patch,e.patch)}comparePre(e){if(e instanceof Ge||(e=new Ge(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],r=e.prerelease[t];if(Ie("prerelease compare",t,n,r),void 0===n&&void 0===r)return 0;if(void 0===r)return 1;if(void 0===n)return-1;if(n!==r)return He(n,r)}while(++t)}compareBuild(e){e instanceof Ge||(e=new Ge(e,this.options));let t=0;do{const n=this.build[t],r=e.build[t];if(Ie("prerelease compare",t,n,r),void 0===n&&void 0===r)return 0;if(void 0===r)return 1;if(void 0===n)return-1;if(n!==r)return He(n,r)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: ".concat(e))}return this.format(),this.raw=this.version,this}}var Xe=Ge;var Ye=(e,t,n)=>new Xe(e,n).compare(new Xe(t,n));var Ke=(e,t,n)=>Ye(e,t,n)<0;var Qe=(e,t,n)=>Ye(e,t,n)>=0,Ze=je((function(e,t){function n(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]}function r(){return"undefined"!=typeof WeakMap?new WeakMap:{add:n,delete:n,get:n,set:n,has:function(e){return!1}}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.prototype.hasOwnProperty,u=function(e,t){return o.call(e,t)};function i(e,t){for(var n in t)u(t,n)&&(e[n]=t[n]);return e}var a=/^[ \t]*(?:\r\n|\r|\n)/,s=/(?:\r\n|\r|\n)[ \t]*$/,c=/^(?:[\r\n]|$)/,l=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,p=/^[ \t]*[\r\n][ \t\r\n]*$/;function d(e,t,n){var r=0,o=e[0].match(l);o&&(r=o[1].length);var u=new RegExp("(\\r\\n|\\r|\\n).{0,"+r+"}","g");t&&(e=e.slice(1));var i=n.newline,c=n.trimLeadingNewline,p=n.trimTrailingNewline,d="string"==typeof i,f=e.length;return e.map((function(e,t){return e=e.replace(u,"$1"),0===t&&c&&(e=e.replace(a,"")),t===f-1&&p&&(e=e.replace(s,"")),d&&(e=e.replace(/\r\n|\n|\r/g,(function(e){return i}))),e}))}function f(e,t){for(var n="",r=0,o=e.length;r<o;r++)n+=e[r],r<o-1&&(n+=t[r]);return n}function h(e){return u(e,"raw")&&u(e,"length")}var m=function e(t){var n=r(),o=r();return i((function r(u){for(var a=[],s=1;s<arguments.length;s++)a[s-1]=arguments[s];if(h(u)){var l=u,g=(a[0]===r||a[0]===m)&&p.test(l[0])&&c.test(l[1]),D=g?o:n,y=D.get(l);if(y||(y=d(l,g,t),D.set(l,y)),0===a.length)return y[0];var E=f(y,g?a.slice(1):a);return E}return e(i(i({},t),u||{}))}),{string:function(e){return d([e],!1,t)[0]}})}({trimLeadingNewline:!0,trimTrailingNewline:!0});t.outdent=m,t.default=m;try{e.exports=m,Object.defineProperty(m,"__esModule",{value:!0}),m.default=m,m.outdent=m}catch(e){}}));function et(){const e=t(["\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 "]);return et=function(){return e},e}function tt(){const e=t(["\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 "]);return tt=function(){return e},e}function nt(){const e=t(["\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 "]);return nt=function(){return e},e}function rt(){const e=t(["\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 "]);return rt=function(){return e},e}function ot(){const e=t(["\n Maintain existing\n (mixed values within one file are normalised by looking at what's used after the first line)\n "]);return ot=function(){return e},e}function ut(){const e=t(["\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 "]);return ut=function(){return e},e}const{outdent:it}=Ze,at="Config",st="Editor",ct="Other",lt="Global",pt="Special",dt={cursorOffset:{since:"1.4.0",category:pt,type:"int",default:-1,range:{start:-1,end:1/0,step:1},description:it(ut()),cliCategory:st},endOfLine:{since:"1.15.0",category:lt,type:"choice",default:[{since:"1.15.0",value:"auto"},{since:"2.0.0",value:"lf"}],description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:it(ot())}]},filepath:{since:"1.4.0",category:pt,type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:ct,cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{since:"1.8.0",category:pt,type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:ct},parser:{since:"0.0.10",category:lt,type:"choice",default:[{since:"0.0.10",value:"babylon"},{since:"1.13.0",value:void 0}],description:"Which parser to use.",exception:e=>"string"==typeof e||"function"==typeof e,choices:[{value:"flow",description:"Flow"},{value:"babel",since:"1.16.0",description:"JavaScript"},{value:"babel-flow",since:"1.16.0",description:"Flow"},{value:"babel-ts",since:"2.0.0",description:"TypeScript"},{value:"typescript",since:"1.4.0",description:"TypeScript"},{value:"espree",since:"2.2.0",description:"JavaScript"},{value:"meriyah",since:"2.2.0",description:"JavaScript"},{value:"css",since:"1.7.1",description:"CSS"},{value:"less",since:"1.7.1",description:"Less"},{value:"scss",since:"1.7.1",description:"SCSS"},{value:"json",since:"1.5.0",description:"JSON"},{value:"json5",since:"1.13.0",description:"JSON5"},{value:"json-stringify",since:"1.13.0",description:"JSON.stringify"},{value:"graphql",since:"1.5.0",description:"GraphQL"},{value:"markdown",since:"1.8.0",description:"Markdown"},{value:"mdx",since:"1.15.0",description:"MDX"},{value:"vue",since:"1.10.0",description:"Vue"},{value:"yaml",since:"1.14.0",description:"YAML"},{value:"glimmer",since:null,description:"Handlebars"},{value:"html",since:"1.15.0",description:"HTML"},{value:"angular",since:"1.15.0",description:"Angular"},{value:"lwc",since:"1.17.0",description:"Lightning Web Components"}]},plugins:{since:"1.10.0",type:"path",array:!0,default:[{value:[]}],category:lt,description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:e=>"string"==typeof e||"object"==typeof e,cliName:"plugin",cliCategory:at},pluginSearchDirs:{since:"1.13.0",type:"path",array:!0,default:[{value:[]}],category:lt,description:it(rt()),exception:e=>"string"==typeof e||"object"==typeof e,cliName:"plugin-search-dir",cliCategory:at},printWidth:{since:"0.0.0",category:lt,type:"int",default:80,description:"The line length where Prettier will try wrap.",range:{start:0,end:1/0,step:1}},rangeEnd:{since:"1.4.0",category:pt,type:"int",default:1/0,range:{start:0,end:1/0,step:1},description:it(nt()),cliCategory:st},rangeStart:{since:"1.4.0",category:pt,type:"int",default:0,range:{start:0,end:1/0,step:1},description:it(tt()),cliCategory:st},requirePragma:{since:"1.7.0",category:pt,type:"boolean",default:!1,description:it(et()),cliCategory:ct},tabWidth:{type:"int",category:lt,default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{since:"1.0.0",category:lt,type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{since:"2.1.0",category:lt,type:"choice",default:[{since:"2.1.0",value:"auto"}],description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};const ft={compare:Ye,lt:Ke,gte:Qe},ht=n.version,mt={CATEGORY_CONFIG:at,CATEGORY_EDITOR:st,CATEGORY_FORMAT:"Format",CATEGORY_OTHER:ct,CATEGORY_OUTPUT:"Output",CATEGORY_GLOBAL:lt,CATEGORY_SPECIAL:pt,options:dt}.options;var gt={getSupportInfo:function({plugins:t=[],showUnreleased:n=!1,showDeprecated:r=!1,showInternal:o=!1}={}){const u=ht.split("-",1)[0],i=t.reduce(((e,t)=>e.concat(t.languages||[])),[]).filter(s),a=((e,t)=>Object.entries(e).map((([e,n])=>Object.assign({[t]:e},n))))(Object.assign({},...t.map((({options:e})=>e)),mt),"name").filter((e=>s(e)&&c(e))).sort(((e,t)=>e.name===t.name?0:e.name<t.name?-1:1)).map((function(t){if(o)return t;return e(t,["cliName","cliCategory","cliDescription"])})).map((e=>{e=Object.assign({},e),Array.isArray(e.default)&&(e.default=1===e.default.length?e.default[0].value:e.default.filter(s).sort(((e,t)=>ft.compare(t.since,e.since)))[0].value),Array.isArray(e.choices)&&(e.choices=e.choices.filter((e=>s(e)&&c(e))),"parser"===e.name&&function(e,t,n){const r=new Set(e.choices.map((e=>e.value)));for(const o of t)if(o.parsers)for(const t of o.parsers)if(!r.has(t)){r.add(t);const u=n.find((e=>e.parsers&&e.parsers[t]));let i=o.name;u&&u.name&&(i+=" (plugin: ".concat(u.name,")")),e.choices.push({value:t,description:i})}}(e,i,t));const n=t.filter((t=>t.defaultOptions&&void 0!==t.defaultOptions[e.name])).reduce(((t,n)=>(t[n.name]=n.defaultOptions[e.name],t)),{});return Object.assign({},e,{pluginDefaults:n})}));return{languages:i,options:a};function s(e){return n||!("since"in e)||e.since&&ft.gte(u,e.since)}function c(e){return r||!("deprecated"in e)||e.deprecated&&ft.lt(u,e.deprecated)}}};const{getSupportInfo:Dt}=gt,yt=/[^\x20-\x7F]/;function Et(e){return(t,n,r)=>{const o=r&&r.backwards;if(!1===n)return!1;const{length:u}=t;let i=n;for(;i>=0&&i<u;){const n=t.charAt(i);if(e instanceof RegExp){if(!e.test(n))return i}else if(!e.includes(n))return i;o?i--:i++}return(-1===i||i===u)&&i}}const Ct=Et(/\s/),bt=Et(" \t"),vt=Et(",; \t"),At=Et(/[^\n\r]/);function Ft(e,t){if(!1===t)return!1;if("/"===e.charAt(t)&&"*"===e.charAt(t+1))for(let n=t+2;n<e.length;++n)if("*"===e.charAt(n)&&"/"===e.charAt(n+1))return n+2;return t}function xt(e,t){return!1!==t&&("/"===e.charAt(t)&&"/"===e.charAt(t+1)?At(e,t):t)}function St(e,t,n){const r=n&&n.backwards;if(!1===t)return!1;const o=e.charAt(t);if(r){if("\r"===e.charAt(t-1)&&"\n"===o)return t-2;if("\n"===o||"\r"===o||"\u2028"===o||"\u2029"===o)return t-1}else{if("\r"===o&&"\n"===e.charAt(t+1))return t+2;if("\n"===o||"\r"===o||"\u2028"===o||"\u2029"===o)return t+1}return t}function wt(e,t,n){const r=bt(e,(n=n||{}).backwards?t-1:t,n);return r!==St(e,r,n)}function Tt(e,t){let n=null,r=t;for(;r!==n;)n=r,r=vt(e,r),r=Ft(e,r),r=bt(e,r);return r=xt(e,r),r=St(e,r),!1!==r&&wt(e,r)}function Bt(e,t){let n=null,r=t;for(;r!==n;)n=r,r=bt(e,r),r=Ft(e,r),r=xt(e,r),r=St(e,r);return r}function Nt(e,t,n){return Bt(e,n(t))}function kt(e,t,n){let r=0;for(let o=n=n||0;o<e.length;++o)"\t"===e[o]?r=r+t-r%t:r++;return r}function Pt(e,t){const n=e.slice(1,-1),r={quote:'"',regex:/"/g},o={quote:"'",regex:/'/g},u="'"===t?o:r,i=u===o?r:o;let a=u.quote;if(n.includes(u.quote)||n.includes(i.quote)){a=(n.match(u.regex)||[]).length>(n.match(i.regex)||[]).length?i.quote:u.quote}return a}function Ot(e,t,n){const r='"'===t?"'":'"',o=e.replace(/\\([\S\s])|(["'])/g,((e,o,u)=>o===r?o:u===t?"\\"+u:u||(n&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(o)?o:"\\"+o)));return t+o+t}function It(e,t){(e.comments||(e.comments=[])).push(t),t.printed=!1,"JSXText"===e.type&&(t.printed=!0)}var Lt={inferParserByLanguage:function(e,t){const{languages:n}=Dt({plugins:t.plugins}),r=n.find((({name:t})=>t.toLowerCase()===e))||n.find((({aliases:t})=>Array.isArray(t)&&t.includes(e)))||n.find((({extensions:t})=>Array.isArray(t)&&t.includes(".".concat(e))));return r&&r.parsers[0]},replaceEndOfLineWith:function(e,t){const n=[];for(const r of e.split("\n"))0!==n.length&&n.push(t),n.push(r);return n},getStringWidth:function(e){return e?yt.test(e)?ue(e):e.length:0},getMaxContinuousCount:function(e,t){const n=e.match(new RegExp("(".concat(ae(t),")+"),"g"));return null===n?0:n.reduce(((e,n)=>Math.max(e,n.length/t.length)),0)},getMinNotPresentContinuousCount:function(e,t){const n=e.match(new RegExp("(".concat(ae(t),")+"),"g"));if(null===n)return 0;const r=new Map;let o=0;for(const e of n){const n=e.length/t.length;r.set(n,!0),n>o&&(o=n)}for(let e=1;e<o;e++)if(!r.get(e))return e;return o+1},getPenultimate:e=>e[e.length-2],getLast:se,getNextNonSpaceNonCommentCharacterIndexWithStartIndex:Bt,getNextNonSpaceNonCommentCharacterIndex:Nt,getNextNonSpaceNonCommentCharacter:function(e,t,n){return e.charAt(Nt(e,t,n))},skip:Et,skipWhitespace:Ct,skipSpaces:bt,skipToLineEnd:vt,skipEverythingButNewLine:At,skipInlineComment:Ft,skipTrailingComment:xt,skipNewline:St,isNextLineEmptyAfterIndex:Tt,isNextLineEmpty:function(e,t,n){return Tt(e,n(t))},isPreviousLineEmpty:function(e,t,n){let r=n(t)-1;return r=bt(e,r,{backwards:!0}),r=St(e,r,{backwards:!0}),r=bt(e,r,{backwards:!0}),r!==St(e,r,{backwards:!0})},hasNewline:wt,hasNewlineInRange:function(e,t,n){for(let r=t;r<n;++r)if("\n"===e.charAt(r))return!0;return!1},hasSpaces:function(e,t,n){return bt(e,(n=n||{}).backwards?t-1:t,n)!==t},getAlignmentSize:kt,getIndentSize:function(e,t){const n=e.lastIndexOf("\n");return-1===n?0:kt(e.slice(n+1).match(/^[\t ]*/)[0],t)},getPreferredQuote:Pt,printString:function(e,t,n){const r=e.slice(1,-1),o=!r.includes('"')&&!r.includes("'"),u="json"===t.parser?'"':t.__isInHtmlAttribute?"'":Pt(e,t.singleQuote?"'":'"');return n?o?u+r+u:e:Ot(r,u,!("css"===t.parser||"less"===t.parser||"scss"===t.parser||t.embeddedInHtml))},printNumber:function(e){return e.toLowerCase().replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/,"$1$2$3").replace(/^([+-]?[\d.]+)e[+-]?0+$/,"$1").replace(/^([+-])?\./,"$10.").replace(/(\.\d+?)0+(?=e|$)/,"$1").replace(/\.(?=e|$)/,"")},isNodeIgnoreComment:function(e){return"prettier-ignore"===e.value.trim()},makeString:Ot,addLeadingComment:function(e,t){t.leading=!0,t.trailing=!1,It(e,t)},addDanglingComment:function(e,t,n){t.leading=!1,t.trailing=!1,n&&(t.marker=n),It(e,t)},addTrailingComment:function(e,t){t.leading=!1,t.trailing=!0,It(e,t)},isFrontMatterNode:function(e){return e&&"front-matter"===e.type},getShebang:function(e){if(!e.startsWith("#!"))return"";const t=e.indexOf("\n");return-1===t?e:e.slice(0,t)}};var Mt={guessEndOfLine:function(e){const t=e.indexOf("\r");return t>=0?"\n"===e.charAt(t+1)?"crlf":"cr":"lf"},convertEndOfLineToChars:function(e){switch(e){case"cr":return"\r";case"crlf":return"\r\n";default:return"\n"}},countEndOfLineChars:function(e,t){let n;if("\n"===t)n=/\n/g;else if("\r"===t)n=/\r/g;else{if("\r\n"!==t)throw new Error('Unexpected "eol" '.concat(JSON.stringify(t),"."));n=/\r\n/g}const r=e.match(n);return r?r.length:0},normalizeEndOfLine:function(e){return e.replace(/\r\n?/g,"\n")}};const{getStringWidth:jt}=Lt,{convertEndOfLineToChars:_t}=Mt,{concat:Rt,fill:Vt,cursor:$t}=Z;let qt;function Wt(e,t){return Jt(e,{type:"indent"},t)}function Ut(e,t,n){if(t===-1/0)return e.root||{value:"",length:0,queue:[]};if(t<0)return Jt(e,{type:"dedent"},n);if(!t)return e;if("root"===t.type)return Object.assign({},e,{root:e});return Jt(e,{type:"string"==typeof t?"stringAlign":"numberAlign",n:t},n)}function Jt(e,t,n){const r="dedent"===t.type?e.queue.slice(0,-1):e.queue.concat(t);let o="",u=0,i=0,a=0;for(const e of r)switch(e.type){case"indent":l(),n.useTabs?s(1):c(n.tabWidth);break;case"stringAlign":l(),o+=e.n,u+=e.n.length;break;case"numberAlign":i+=1,a+=e.n;break;default:throw new Error("Unexpected type '".concat(e.type,"'"))}return p(),Object.assign({},e,{value:o,length:u,queue:r});function s(e){o+="\t".repeat(e),u+=n.tabWidth*e}function c(e){o+=" ".repeat(e),u+=e}function l(){n.useTabs?function(){i>0&&s(i);d()}():p()}function p(){a>0&&c(a),d()}function d(){i=0,a=0}}function zt(e){if(0===e.length)return 0;let t=0;for(;e.length>0&&"string"==typeof e[e.length-1]&&e[e.length-1].match(/^[\t ]*$/);)t+=e.pop().length;if(e.length&&"string"==typeof e[e.length-1]){const n=e[e.length-1].replace(/[\t ]*$/,"");t+=e[e.length-1].length-n.length,e[e.length-1]=n}return t}function Ht(e,t,n,r,o){let u=t.length;const i=[e],a=[];for(;n>=0;){if(0===i.length){if(0===u)return!0;i.push(t[u-1]),u--;continue}const[e,s,c]=i.pop();if("string"==typeof c)a.push(c),n-=jt(c);else switch(c.type){case"concat":for(let t=c.parts.length-1;t>=0;t--)i.push([e,s,c.parts[t]]);break;case"indent":i.push([Wt(e,r),s,c.contents]);break;case"align":i.push([Ut(e,c.n,r),s,c.contents]);break;case"trim":n+=zt(a);break;case"group":if(o&&c.break)return!1;i.push([e,c.break?1:s,c.contents]),c.id&&(qt[c.id]=i[i.length-1][1]);break;case"fill":for(let t=c.parts.length-1;t>=0;t--)i.push([e,s,c.parts[t]]);break;case"if-break":{const t=c.groupId?qt[c.groupId]:s;1===t&&c.breakContents&&i.push([e,s,c.breakContents]),2===t&&c.flatContents&&i.push([e,s,c.flatContents]);break}case"line":switch(s){case 2:if(!c.hard){c.soft||(a.push(" "),n-=1);break}return!0;case 1:return!0}}}return!1}var Gt={printDocToString:function(e,t){qt={};const n=t.printWidth,r=_t(t.endOfLine);let o=0;const u=[[{value:"",length:0,queue:[]},1,e]],i=[];let a=!1,s=[];for(;0!==u.length;){const[e,c,l]=u.pop();if("string"==typeof l){const e="\n"!==r&&l.includes("\n")?l.replace(/\n/g,r):l;i.push(e),o+=jt(e)}else switch(l.type){case"cursor":i.push($t.placeholder);break;case"concat":for(let t=l.parts.length-1;t>=0;t--)u.push([e,c,l.parts[t]]);break;case"indent":u.push([Wt(e,t),c,l.contents]);break;case"align":u.push([Ut(e,l.n,t),c,l.contents]);break;case"trim":o-=zt(i);break;case"group":switch(c){case 2:if(!a){u.push([e,l.break?1:2,l.contents]);break}case 1:{a=!1;const r=[e,2,l.contents],i=n-o;if(!l.break&&Ht(r,u,i,t))u.push(r);else if(l.expandedStates){const n=l.expandedStates[l.expandedStates.length-1];if(l.break){u.push([e,1,n]);break}for(let r=1;r<l.expandedStates.length+1;r++){if(r>=l.expandedStates.length){u.push([e,1,n]);break}{const n=[e,2,l.expandedStates[r]];if(Ht(n,u,i,t)){u.push(n);break}}}}else u.push([e,1,l.contents]);break}}l.id&&(qt[l.id]=u[u.length-1][1]);break;case"fill":{const r=n-o,{parts:i}=l;if(0===i.length)break;const[a,s]=i,p=[e,2,a],d=[e,1,a],f=Ht(p,[],r,t,!0);if(1===i.length){f?u.push(p):u.push(d);break}const h=[e,2,s],m=[e,1,s];if(2===i.length){f?(u.push(h),u.push(p)):(u.push(m),u.push(d));break}i.splice(0,2);const g=[e,c,Vt(i)],D=i[0];Ht([e,2,Rt([a,s,D])],[],r,t,!0)?(u.push(g),u.push(h),u.push(p)):f?(u.push(g),u.push(m),u.push(p)):(u.push(g),u.push(m),u.push(d));break}case"if-break":{const t=l.groupId?qt[l.groupId]:c;1===t&&l.breakContents&&u.push([e,c,l.breakContents]),2===t&&l.flatContents&&u.push([e,c,l.flatContents]);break}case"line-suffix":s.push([e,c,l.contents]);break;case"line-suffix-boundary":s.length>0&&u.push([e,c,{type:"line",hard:!0}]);break;case"line":switch(c){case 2:if(!l.hard){l.soft||(i.push(" "),o+=1);break}a=!0;case 1:if(s.length){u.push([e,c,l]),u.push(...s.reverse()),s=[];break}l.literal?e.root?(i.push(r,e.root.value),o=e.root.length):(i.push(r),o=0):(o-=zt(i),i.push(r+e.value),o=e.length)}}0===u.length&&s.length&&(u.push(...s.reverse()),s=[])}const c=i.indexOf($t.placeholder);if(-1!==c){const e=i.indexOf($t.placeholder,c+1),t=i.slice(0,c).join(""),n=i.slice(c+1,e).join("");return{formatted:t+n+i.slice(e+1).join(""),cursorNodeStart:t.length,cursorNodeText:n}}return{formatted:i.join("")}}};const{literalline:Xt,concat:Yt}=Z,Kt={};function Qt(e,t,n,r){const o=[e];for(;0!==o.length;){const e=o.pop();if(e!==Kt){if(n&&o.push(e,Kt),!t||!1!==t(e))if("concat"===e.type||"fill"===e.type)for(let t=e.parts.length-1;t>=0;--t)o.push(e.parts[t]);else if("if-break"===e.type)e.flatContents&&o.push(e.flatContents),e.breakContents&&o.push(e.breakContents);else if("group"===e.type&&e.expandedStates)if(r)for(let t=e.expandedStates.length-1;t>=0;--t)o.push(e.expandedStates[t]);else o.push(e.contents);else e.contents&&o.push(e.contents)}else n(o.pop())}}function Zt(e,t){if("concat"===e.type||"fill"===e.type){const n=e.parts.map((e=>Zt(e,t)));return t(Object.assign({},e,{parts:n}))}if("if-break"===e.type){const n=e.breakContents&&Zt(e.breakContents,t),r=e.flatContents&&Zt(e.flatContents,t);return t(Object.assign({},e,{breakContents:n,flatContents:r}))}if(e.contents){const n=Zt(e.contents,t);return t(Object.assign({},e,{contents:n}))}return t(e)}function en(e,t,n){let r=n,o=!1;return Qt(e,(function(e){const n=t(e);if(void 0!==n&&(o=!0,r=n),o)return!1})),r}function tn(e){return"string"!=typeof e&&("line"===e.type||void 0)}function nn(e){return!("group"!==e.type||!e.break)||(!("line"!==e.type||!e.hard)||("break-parent"===e.type||void 0))}function rn(e){if(e.length>0){const t=e[e.length-1];t.expandedStates||(t.break=!0)}return null}function on(e){return"line"!==e.type||e.hard?"if-break"===e.type?e.flatContents||"":e:e.soft?"":" "}function un(e){const t=[],n=e.filter(Boolean);for(;0!==n.length;){const e=n.shift();e&&("concat"!==e.type?0===t.length||"string"!=typeof t[t.length-1]||"string"!=typeof e?t.push(e):t[t.length-1]+=e:n.unshift(...e.parts))}return t}function an(e){if("concat"===e.type){const t=[];for(let n=0;n<e.parts.length;++n){const r=e.parts[n];if("string"!=typeof r&&"concat"===r.type)t.push(...an(r).parts);else{const e=an(r);""!==e&&t.push(e)}}return Object.assign({},e,{parts:t})}return"if-break"===e.type?Object.assign({},e,{breakContents:null!=e.breakContents?an(e.breakContents):null,flatContents:null!=e.flatContents?an(e.flatContents):null}):"group"===e.type?Object.assign({},e,{contents:an(e.contents),expandedStates:e.expandedStates?e.expandedStates.map(an):e.expandedStates}):e.contents?Object.assign({},e,{contents:an(e.contents)}):e}function sn(e){if("string"==typeof e)return JSON.stringify(e);if("line"===e.type)return e.literal?"literalline":e.hard?"hardline":e.soft?"softline":"line";if("break-parent"===e.type)return"breakParent";if("trim"===e.type)return"trim";if("concat"===e.type)return"["+e.parts.map(sn).join(", ")+"]";if("indent"===e.type)return"indent("+sn(e.contents)+")";if("align"===e.type)return e.n===-1/0?"dedentToRoot("+sn(e.contents)+")":e.n<0?"dedent("+sn(e.contents)+")":"root"===e.n.type?"markAsRoot("+sn(e.contents)+")":"align("+JSON.stringify(e.n)+", "+sn(e.contents)+")";if("if-break"===e.type)return"ifBreak("+sn(e.breakContents)+(e.flatContents?", "+sn(e.flatContents):"")+")";if("group"===e.type)return e.expandedStates?"conditionalGroup(["+e.expandedStates.map(sn).join(",")+"])":(e.break?"wrappedGroup":"group")+"("+sn(e.contents)+")";if("fill"===e.type)return"fill("+e.parts.map(sn).join(", ")+")";if("line-suffix"===e.type)return"lineSuffix("+sn(e.contents)+")";if("line-suffix-boundary"===e.type)return"lineSuffixBoundary";throw new Error("Unknown doc type "+e.type)}var cn={builders:Z,printer:Gt,utils:{isEmpty:function(e){return"string"==typeof e&&0===e.length},willBreak:function(e){return en(e,nn,!1)},isLineNext:function(e){return en(e,tn,!1)},traverseDoc:Qt,findInDoc:en,mapDoc:Zt,propagateBreaks:function(e){const t=new Set,n=[];Qt(e,(function(e){if("break-parent"===e.type&&rn(n),"group"===e.type){if(n.push(e),t.has(e))return!1;t.add(e)}}),(function(e){if("group"===e.type){n.pop().break&&rn(n)}}),!0)},removeLines:function(e){return Zt(e,on)},stripTrailingHardline:function e(t,n=!1){if("concat"===t.type&&0!==t.parts.length){const r=n?function(e){let t,{parts:n}=e;for(let r=e.parts.length;r>0&&!t;r--)t=n[r-1];return"group"===t.type&&(n=t.contents.parts),n}(t):t.parts,o=r[r.length-1];if("concat"===o.type)return 2===o.parts.length&&o.parts[0].hard&&"break-parent"===o.parts[1].type?{type:"concat",parts:r.slice(0,-1)}:{type:"concat",parts:t.parts.slice(0,-1).concat(e(o))}}return t},normalizeParts:un,normalizeDoc:function(e){return Zt(e,(e=>e.parts?Object.assign({},e,{parts:un(e.parts)}):e))},replaceNewlinesWithLiterallines:function(e){return Zt(e,(e=>"string"==typeof e&&e.includes("\n")?Yt(e.split(/(\n)/g).map(((e,t)=>t%2==0?e:Xt))):e))}},debug:{printDocToDebug:e=>sn(an(e))}};const ln=()=>!1,pn=()=>"";var dn={existsSync:ln,readFileSync:pn},fn=Object.freeze({__proto__:null,existsSync:ln,readFileSync:pn,default:dn});function hn(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function mn(e,t){for(var n,r="",o=0,u=-1,i=0,a=0;a<=e.length;++a){if(a<e.length)n=e.charCodeAt(a);else{if(47===n)break;n=47}if(47===n){if(u===a-1||1===i);else if(u!==a-1&&2===i){if(r.length<2||2!==o||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){var s=r.lastIndexOf("/");if(s!==r.length-1){-1===s?(r="",o=0):o=(r=r.slice(0,s)).length-1-r.lastIndexOf("/"),u=a,i=0;continue}}else if(2===r.length||1===r.length){r="",o=0,u=a,i=0;continue}t&&(r.length>0?r+="/..":r="..",o=2)}else r.length>0?r+="/"+e.slice(u+1,a):r=e.slice(u+1,a),o=a-u-1;u=a,i=0}else 46===n&&-1!==i?++i:i=-1}return r}var gn={resolve:function(){for(var e,t="",n=!1,r=arguments.length-1;r>=-1&&!n;r--){var o;r>=0?o=arguments[r]:(void 0===e&&(e=Oe.cwd()),o=e),hn(o),0!==o.length&&(t=o+"/"+t,n=47===o.charCodeAt(0))}return t=mn(t,!n),n?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(hn(e),0===e.length)return".";var t=47===e.charCodeAt(0),n=47===e.charCodeAt(e.length-1);return 0!==(e=mn(e,!t)).length||t||(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return hn(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];hn(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":gn.normalize(e)},relative:function(e,t){if(hn(e),hn(t),e===t)return"";if((e=gn.resolve(e))===(t=gn.resolve(t)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var r=e.length,o=r-n,u=1;u<t.length&&47===t.charCodeAt(u);++u);for(var i=t.length-u,a=o<i?o:i,s=-1,c=0;c<=a;++c){if(c===a){if(i>a){if(47===t.charCodeAt(u+c))return t.slice(u+c+1);if(0===c)return t.slice(u+c)}else o>a&&(47===e.charCodeAt(n+c)?s=c:0===c&&(s=0));break}var l=e.charCodeAt(n+c);if(l!==t.charCodeAt(u+c))break;47===l&&(s=c)}var p="";for(c=n+s+1;c<=r;++c)c!==r&&47!==e.charCodeAt(c)||(0===p.length?p+="..":p+="/..");return p.length>0?p+t.slice(u+s):(u+=s,47===t.charCodeAt(u)&&++u,t.slice(u))},_makeLong:function(e){return e},dirname:function(e){if(hn(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,r=-1,o=!0,u=e.length-1;u>=1;--u)if(47===(t=e.charCodeAt(u))){if(!o){r=u;break}}else o=!1;return-1===r?n?"/":".":n&&1===r?"//":e.slice(0,r)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');hn(e);var n,r=0,o=-1,u=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var i=t.length-1,a=-1;for(n=e.length-1;n>=0;--n){var s=e.charCodeAt(n);if(47===s){if(!u){r=n+1;break}}else-1===a&&(u=!1,a=n+1),i>=0&&(s===t.charCodeAt(i)?-1==--i&&(o=n):(i=-1,o=a))}return r===o?o=a:-1===o&&(o=e.length),e.slice(r,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!u){r=n+1;break}}else-1===o&&(u=!1,o=n+1);return-1===o?"":e.slice(r,o)},extname:function(e){hn(e);for(var t=-1,n=0,r=-1,o=!0,u=0,i=e.length-1;i>=0;--i){var a=e.charCodeAt(i);if(47!==a)-1===r&&(o=!1,r=i+1),46===a?-1===t?t=i:1!==u&&(u=1):-1!==t&&(u=-1);else if(!o){n=i+1;break}}return-1===t||-1===r||0===u||1===u&&t===r-1&&t===n+1?"":e.slice(t,r)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+r:n+e+r:r}("/",e)},parse:function(e){hn(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,r=e.charCodeAt(0),o=47===r;o?(t.root="/",n=1):n=0;for(var u=-1,i=0,a=-1,s=!0,c=e.length-1,l=0;c>=n;--c)if(47!==(r=e.charCodeAt(c)))-1===a&&(s=!1,a=c+1),46===r?-1===u?u=c:1!==l&&(l=1):-1!==u&&(l=-1);else if(!s){i=c+1;break}return-1===u||-1===a||0===l||1===l&&u===a-1&&u===i+1?-1!==a&&(t.base=t.name=0===i&&o?e.slice(1,a):e.slice(i,a)):(0===i&&o?(t.name=e.slice(1,u),t.base=e.slice(1,a)):(t.name=e.slice(i,u),t.base=e.slice(i,a)),t.ext=e.slice(u,a)),i>0?t.dir=e.slice(0,i-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};gn.posix=gn;var Dn=gn,yn=Object.freeze(Object.assign(Object.create(null),Dn,{default:Dn,__moduleExports:Dn})),En=[],Cn=[],bn="undefined"!=typeof Uint8Array?Uint8Array:Array,vn=!1;function An(){vn=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;t<n;++t)En[t]=e[t],Cn[e.charCodeAt(t)]=t;Cn["-".charCodeAt(0)]=62,Cn["_".charCodeAt(0)]=63}function Fn(e,t,n){for(var r,o,u=[],i=t;i<n;i+=3)r=(e[i]<<16)+(e[i+1]<<8)+e[i+2],u.push(En[(o=r)>>18&63]+En[o>>12&63]+En[o>>6&63]+En[63&o]);return u.join("")}function xn(e){var t;vn||An();for(var n=e.length,r=n%3,o="",u=[],i=16383,a=0,s=n-r;a<s;a+=i)u.push(Fn(e,a,a+i>s?s:a+i));return 1===r?(t=e[n-1],o+=En[t>>2],o+=En[t<<4&63],o+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],o+=En[t>>10],o+=En[t>>4&63],o+=En[t<<2&63],o+="="),u.push(o),u.join("")}function Sn(e,t,n,r,o){var u,i,a=8*o-r-1,s=(1<<a)-1,c=s>>1,l=-7,p=n?o-1:0,d=n?-1:1,f=e[t+p];for(p+=d,u=f&(1<<-l)-1,f>>=-l,l+=a;l>0;u=256*u+e[t+p],p+=d,l-=8);for(i=u&(1<<-l)-1,u>>=-l,l+=r;l>0;i=256*i+e[t+p],p+=d,l-=8);if(0===u)u=1-c;else{if(u===s)return i?NaN:1/0*(f?-1:1);i+=Math.pow(2,r),u-=c}return(f?-1:1)*i*Math.pow(2,u-r)}function wn(e,t,n,r,o,u){var i,a,s,c=8*u-o-1,l=(1<<c)-1,p=l>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:u-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=l):(i=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-i))<1&&(i--,s*=2),(t+=i+p>=1?d/s:d*Math.pow(2,1-p))*s>=2&&(i++,s/=2),i+p>=l?(a=0,i=l):i+p>=1?(a=(t*s-1)*Math.pow(2,o),i+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,o),i=0));o>=8;e[n+f]=255&a,f+=h,a/=256,o-=8);for(i=i<<o|a,c+=o;c>0;e[n+f]=255&i,f+=h,i/=256,c-=8);e[n+f-h]|=128*m}var Tn={}.toString,Bn=Array.isArray||function(e){return"[object Array]"==Tn.call(e)};function Nn(){return Pn.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function kn(e,t){if(Nn()<t)throw new RangeError("Invalid typed array length");return Pn.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Pn.prototype:(null===e&&(e=new Pn(t)),e.length=t),e}function Pn(e,t,n){if(!(Pn.TYPED_ARRAY_SUPPORT||this instanceof Pn))return new Pn(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Ln(this,e)}return On(this,e,t,n)}function On(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);Pn.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Pn.prototype:e=Mn(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!Pn.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Rn(t,n),o=(e=kn(e,r)).write(t,n);o!==r&&(e=e.slice(0,o));return e}(e,t,n):function(e,t){if(_n(t)){var n=0|jn(t.length);return 0===(e=kn(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?kn(e,0):Mn(e,t);if("Buffer"===t.type&&Bn(t.data))return Mn(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function In(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function Ln(e,t){if(In(t),e=kn(e,t<0?0:0|jn(t)),!Pn.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function Mn(e,t){var n=t.length<0?0:0|jn(t.length);e=kn(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function jn(e){if(e>=Nn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Nn().toString(16)+" bytes");return 0|e}function _n(e){return!(null==e||!e._isBuffer)}function Rn(e,t){if(_n(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return dr(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return fr(e).length;default:if(r)return dr(e).length;t=(""+t).toLowerCase(),r=!0}}function Vn(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return tr(this,t,n);case"utf8":case"utf-8":return Kn(this,t,n);case"ascii":return Zn(this,t,n);case"latin1":case"binary":return er(this,t,n);case"base64":return Yn(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nr(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function $n(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function qn(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=Pn.from(t,r)),_n(t))return 0===t.length?-1:Wn(e,t,n,r,o);if("number"==typeof t)return t&=255,Pn.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Wn(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function Wn(e,t,n,r,o){var u,i=1,a=e.length,s=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;i=2,a/=2,s/=2,n/=2}function c(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o){var l=-1;for(u=n;u<a;u++)if(c(e,u)===c(t,-1===l?0:u-l)){if(-1===l&&(l=u),u-l+1===s)return l*i}else-1!==l&&(u-=u-l),l=-1}else for(n+s>a&&(n=a-s),u=n;u>=0;u--){for(var p=!0,d=0;d<s;d++)if(c(e,u+d)!==c(t,d)){p=!1;break}if(p)return u}return-1}function Un(e,t,n,r){n=Number(n)||0;var o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;var u=t.length;if(u%2!=0)throw new TypeError("Invalid hex string");r>u/2&&(r=u/2);for(var i=0;i<r;++i){var a=parseInt(t.substr(2*i,2),16);if(isNaN(a))return i;e[n+i]=a}return i}function Jn(e,t,n,r){return hr(dr(t,e.length-n),e,n,r)}function zn(e,t,n,r){return hr(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function Hn(e,t,n,r){return zn(e,t,n,r)}function Gn(e,t,n,r){return hr(fr(t),e,n,r)}function Xn(e,t,n,r){return hr(function(e,t){for(var n,r,o,u=[],i=0;i<e.length&&!((t-=2)<0);++i)r=(n=e.charCodeAt(i))>>8,o=n%256,u.push(o),u.push(r);return u}(t,e.length-n),e,n,r)}function Yn(e,t,n){return 0===t&&n===e.length?xn(e):xn(e.slice(t,n))}function Kn(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o<n;){var u,i,a,s,c=e[o],l=null,p=c>239?4:c>223?3:c>191?2:1;if(o+p<=n)switch(p){case 1:c<128&&(l=c);break;case 2:128==(192&(u=e[o+1]))&&(s=(31&c)<<6|63&u)>127&&(l=s);break;case 3:u=e[o+1],i=e[o+2],128==(192&u)&&128==(192&i)&&(s=(15&c)<<12|(63&u)<<6|63&i)>2047&&(s<55296||s>57343)&&(l=s);break;case 4:u=e[o+1],i=e[o+2],a=e[o+3],128==(192&u)&&128==(192&i)&&128==(192&a)&&(s=(15&c)<<18|(63&u)<<12|(63&i)<<6|63&a)>65535&&s<1114112&&(l=s)}null===l?(l=65533,p=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=p}return function(e){var t=e.length;if(t<=Qn)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Qn));return n}(r)}Pn.TYPED_ARRAY_SUPPORT=void 0===ce.TYPED_ARRAY_SUPPORT||ce.TYPED_ARRAY_SUPPORT,Pn.poolSize=8192,Pn._augment=function(e){return e.__proto__=Pn.prototype,e},Pn.from=function(e,t,n){return On(null,e,t,n)},Pn.TYPED_ARRAY_SUPPORT&&(Pn.prototype.__proto__=Uint8Array.prototype,Pn.__proto__=Uint8Array),Pn.alloc=function(e,t,n){return function(e,t,n,r){return In(t),t<=0?kn(e,t):void 0!==n?"string"==typeof r?kn(e,t).fill(n,r):kn(e,t).fill(n):kn(e,t)}(null,e,t,n)},Pn.allocUnsafe=function(e){return Ln(null,e)},Pn.allocUnsafeSlow=function(e){return Ln(null,e)},Pn.isBuffer=function(e){return null!=e&&(!!e._isBuffer||mr(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&mr(e.slice(0,0))}(e))},Pn.compare=function(e,t){if(!_n(e)||!_n(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,u=Math.min(n,r);o<u;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},Pn.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Pn.concat=function(e,t){if(!Bn(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Pn.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=Pn.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var u=e[n];if(!_n(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(r,o),o+=u.length}return r},Pn.byteLength=Rn,Pn.prototype._isBuffer=!0,Pn.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)$n(this,t,t+1);return this},Pn.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)$n(this,t,t+3),$n(this,t+1,t+2);return this},Pn.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)$n(this,t,t+7),$n(this,t+1,t+6),$n(this,t+2,t+5),$n(this,t+3,t+4);return this},Pn.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Kn(this,0,e):Vn.apply(this,arguments)},Pn.prototype.equals=function(e){if(!_n(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Pn.compare(this,e)},Pn.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Pn.prototype.compare=function(e,t,n,r,o){if(!_n(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var u=(o>>>=0)-(r>>>=0),i=(n>>>=0)-(t>>>=0),a=Math.min(u,i),s=this.slice(r,o),c=e.slice(t,n),l=0;l<a;++l)if(s[l]!==c[l]){u=s[l],i=c[l];break}return u<i?-1:i<u?1:0},Pn.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},Pn.prototype.indexOf=function(e,t,n){return qn(this,e,t,n,!0)},Pn.prototype.lastIndexOf=function(e,t,n){return qn(this,e,t,n,!1)},Pn.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var u=!1;;)switch(r){case"hex":return Un(this,e,t,n);case"utf8":case"utf-8":return Jn(this,e,t,n);case"ascii":return zn(this,e,t,n);case"latin1":case"binary":return Hn(this,e,t,n);case"base64":return Gn(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xn(this,e,t,n);default:if(u)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),u=!0}},Pn.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Qn=4096;function Zn(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function er(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function tr(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var o="",u=t;u<n;++u)o+=pr(e[u]);return o}function nr(e,t,n){for(var r=e.slice(t,n),o="",u=0;u<r.length;u+=2)o+=String.fromCharCode(r[u]+256*r[u+1]);return o}function rr(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function or(e,t,n,r,o,u){if(!_n(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<u)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function ur(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,u=Math.min(e.length-n,2);o<u;++o)e[n+o]=(t&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function ir(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,u=Math.min(e.length-n,4);o<u;++o)e[n+o]=t>>>8*(r?o:3-o)&255}function ar(e,t,n,r,o,u){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function sr(e,t,n,r,o){return o||ar(e,0,n,4),wn(e,t,n,r,23,4),n+4}function cr(e,t,n,r,o){return o||ar(e,0,n,8),wn(e,t,n,r,52,8),n+8}Pn.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),Pn.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=Pn.prototype;else{var o=t-e;n=new Pn(o,void 0);for(var u=0;u<o;++u)n[u]=this[u+e]}return n},Pn.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||rr(e,t,this.length);for(var r=this[e],o=1,u=0;++u<t&&(o*=256);)r+=this[e+u]*o;return r},Pn.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||rr(e,t,this.length);for(var r=this[e+--t],o=1;t>0&&(o*=256);)r+=this[e+--t]*o;return r},Pn.prototype.readUInt8=function(e,t){return t||rr(e,1,this.length),this[e]},Pn.prototype.readUInt16LE=function(e,t){return t||rr(e,2,this.length),this[e]|this[e+1]<<8},Pn.prototype.readUInt16BE=function(e,t){return t||rr(e,2,this.length),this[e]<<8|this[e+1]},Pn.prototype.readUInt32LE=function(e,t){return t||rr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Pn.prototype.readUInt32BE=function(e,t){return t||rr(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Pn.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||rr(e,t,this.length);for(var r=this[e],o=1,u=0;++u<t&&(o*=256);)r+=this[e+u]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*t)),r},Pn.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||rr(e,t,this.length);for(var r=t,o=1,u=this[e+--r];r>0&&(o*=256);)u+=this[e+--r]*o;return u>=(o*=128)&&(u-=Math.pow(2,8*t)),u},Pn.prototype.readInt8=function(e,t){return t||rr(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Pn.prototype.readInt16LE=function(e,t){t||rr(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},Pn.prototype.readInt16BE=function(e,t){t||rr(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},Pn.prototype.readInt32LE=function(e,t){return t||rr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Pn.prototype.readInt32BE=function(e,t){return t||rr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Pn.prototype.readFloatLE=function(e,t){return t||rr(e,4,this.length),Sn(this,e,!0,23,4)},Pn.prototype.readFloatBE=function(e,t){return t||rr(e,4,this.length),Sn(this,e,!1,23,4)},Pn.prototype.readDoubleLE=function(e,t){return t||rr(e,8,this.length),Sn(this,e,!0,52,8)},Pn.prototype.readDoubleBE=function(e,t){return t||rr(e,8,this.length),Sn(this,e,!1,52,8)},Pn.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||or(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,u=0;for(this[t]=255&e;++u<n&&(o*=256);)this[t+u]=e/o&255;return t+n},Pn.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||or(this,e,t,n,Math.pow(2,8*n)-1,0);var o=n-1,u=1;for(this[t+o]=255&e;--o>=0&&(u*=256);)this[t+o]=e/u&255;return t+n},Pn.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||or(this,e,t,1,255,0),Pn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Pn.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||or(this,e,t,2,65535,0),Pn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ur(this,e,t,!0),t+2},Pn.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||or(this,e,t,2,65535,0),Pn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ur(this,e,t,!1),t+2},Pn.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||or(this,e,t,4,4294967295,0),Pn.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):ir(this,e,t,!0),t+4},Pn.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||or(this,e,t,4,4294967295,0),Pn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ir(this,e,t,!1),t+4},Pn.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);or(this,e,t,n,o-1,-o)}var u=0,i=1,a=0;for(this[t]=255&e;++u<n&&(i*=256);)e<0&&0===a&&0!==this[t+u-1]&&(a=1),this[t+u]=(e/i>>0)-a&255;return t+n},Pn.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);or(this,e,t,n,o-1,-o)}var u=n-1,i=1,a=0;for(this[t+u]=255&e;--u>=0&&(i*=256);)e<0&&0===a&&0!==this[t+u+1]&&(a=1),this[t+u]=(e/i>>0)-a&255;return t+n},Pn.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||or(this,e,t,1,127,-128),Pn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Pn.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||or(this,e,t,2,32767,-32768),Pn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ur(this,e,t,!0),t+2},Pn.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||or(this,e,t,2,32767,-32768),Pn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ur(this,e,t,!1),t+2},Pn.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||or(this,e,t,4,2147483647,-2147483648),Pn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):ir(this,e,t,!0),t+4},Pn.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||or(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Pn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ir(this,e,t,!1),t+4},Pn.prototype.writeFloatLE=function(e,t,n){return sr(this,e,t,!0,n)},Pn.prototype.writeFloatBE=function(e,t,n){return sr(this,e,t,!1,n)},Pn.prototype.writeDoubleLE=function(e,t,n){return cr(this,e,t,!0,n)},Pn.prototype.writeDoubleBE=function(e,t,n){return cr(this,e,t,!1,n)},Pn.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var o,u=r-n;if(this===e&&n<t&&t<r)for(o=u-1;o>=0;--o)e[o+t]=this[o+n];else if(u<1e3||!Pn.TYPED_ARRAY_SUPPORT)for(o=0;o<u;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+u),t);return u},Pn.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Pn.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var u;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(u=t;u<n;++u)this[u]=e;else{var i=_n(e)?e:dr(new Pn(e,r).toString()),a=i.length;for(u=0;u<n-t;++u)this[u+t]=i[u%a]}return this};var lr=/[^+\/0-9A-Za-z-_]/g;function pr(e){return e<16?"0"+e.toString(16):e.toString(16)}function dr(e,t){var n;t=t||1/0;for(var r=e.length,o=null,u=[],i=0;i<r;++i){if((n=e.charCodeAt(i))>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&u.push(239,191,189);continue}if(i+1===r){(t-=3)>-1&&u.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&u.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&u.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;u.push(n)}else if(n<2048){if((t-=2)<0)break;u.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;u.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;u.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return u}function fr(e){return function(e){var t,n,r,o,u,i;vn||An();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u="="===e[a-2]?2:"="===e[a-1]?1:0,i=new bn(3*a/4-u),r=u>0?a-4:a;var s=0;for(t=0,n=0;t<r;t+=4,n+=3)o=Cn[e.charCodeAt(t)]<<18|Cn[e.charCodeAt(t+1)]<<12|Cn[e.charCodeAt(t+2)]<<6|Cn[e.charCodeAt(t+3)],i[s++]=o>>16&255,i[s++]=o>>8&255,i[s++]=255&o;return 2===u?(o=Cn[e.charCodeAt(t)]<<2|Cn[e.charCodeAt(t+1)]>>4,i[s++]=255&o):1===u&&(o=Cn[e.charCodeAt(t)]<<10|Cn[e.charCodeAt(t+1)]<<4|Cn[e.charCodeAt(t+2)]>>2,i[s++]=o>>8&255,i[s++]=255&o),i}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(lr,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function hr(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function mr(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var gr=_e(fn);var Dr=class{constructor(e,t){(t=t||{}).readChunk||(t.readChunk=1024),t.newLineCharacter?t.newLineCharacter=t.newLineCharacter.charCodeAt(0):t.newLineCharacter=10,this.fd="number"==typeof e?e:gr.openSync(e,"r"),this.options=t,this.newLineCharacter=t.newLineCharacter,this.reset()}_searchInBuffer(e,t){let n=-1;for(let r=0;r<=e.length;r++){if(e[r]===t){n=r;break}}return n}reset(){this.eofReached=!1,this.linesCache=[],this.fdPosition=0}close(){gr.closeSync(this.fd),this.fd=null}_extractLines(e){let t;const n=[];let r=0,o=0;for(;;){let u=e[r++];if(u===this.newLineCharacter)t=e.slice(o,r),n.push(t),o=r;else if(void 0===u)break}let u=e.slice(o,r);return u.length&&n.push(u),n}_readChunk(e){let t,n=0;const r=[];do{const e=new Pn(this.options.readChunk);t=gr.readSync(this.fd,e,0,this.options.readChunk,this.fdPosition),n+=t,this.fdPosition=this.fdPosition+t,r.push(e)}while(t&&-1===this._searchInBuffer(r[r.length-1],this.options.newLineCharacter));let o=Pn.concat(r);return t<this.options.readChunk&&(this.eofReached=!0,o=o.slice(0,n)),n&&(this.linesCache=this._extractLines(o),e&&(this.linesCache[0]=Pn.concat([e,this.linesCache[0]]))),n}next(){if(!this.fd)return!1;let e,t=!1;if(this.eofReached&&0===this.linesCache.length)return t;if(this.linesCache.length||(e=this._readChunk()),this.linesCache.length){t=this.linesCache.shift();t[t.length-1]!==this.newLineCharacter&&(e=this._readChunk(t),e&&(t=this.linesCache.shift()))}return this.eofReached&&0===this.linesCache.length&&this.close(),t&&t[t.length-1]===this.newLineCharacter&&(t=t.slice(0,t.length-1)),t}};var yr=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r};class Er extends Error{}class Cr extends Error{}class br extends Error{}var vr={ConfigError:Er,DebugError:Cr,UndefinedParserError:br},Ar=function(e,t){return(Ar=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};
+/*! *****************************************************************************
+ Copyright (c) Microsoft Corporation.
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE.
+ ***************************************************************************** */var Fr=function(){return(Fr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function xr(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Sr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,u=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=u.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}return i}function wr(e){return this instanceof wr?(this.v=e,this):new wr(e)}var Tr=Object.freeze({__proto__:null,__extends:function(e,t){function n(){this.constructor=e}Ar(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},get __assign(){return Fr},__rest:function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},__decorate:function(e,t,n,r){var o,u=arguments.length,i=u<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(u<3?o(i):u>3?o(t,n,i):o(t,n))||i);return u>3&&i&&Object.defineProperty(t,n,i),i},__param:function(e,t){return function(n,r){t(n,r,e)}},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__awaiter:function(e,t,n,r){return new(n||(n=Promise))((function(o,u){function i(e){try{s(r.next(e))}catch(e){u(e)}}function a(e){try{s(r.throw(e))}catch(e){u(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}s((r=r.apply(e,t||[])).next())}))},__generator:function(e,t){var n,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}},__createBinding:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]},__exportStar:function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])},__values:xr,__read:Sr,__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Sr(arguments[t]));return e},__spreadArrays:function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var u=arguments[t],i=0,a=u.length;i<a;i++,o++)r[o]=u[i];return r},__await:wr,__asyncGenerator:function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),u=[];return r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r;function i(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){u.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=o[e](t)).value instanceof wr?Promise.resolve(n.value.v).then(s,c):l(u[0][2],n)}catch(e){l(u[0][3],e)}var n}function s(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),u.shift(),u.length&&a(u[0][0],u[0][1])}},__asyncDelegator:function(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:wr(e[r](t)),done:"return"===r}:o?o(t):t}:o}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=xr(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__classPrivateFieldGet:function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},__classPrivateFieldSet:function(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}}),Br=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.apiDescriptor={key:e=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(e)?e:JSON.stringify(e),value(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return"[".concat(e.map((e=>t.apiDescriptor.value(e))).join(", "),"]");const n=Object.keys(e);return 0===n.length?"{}":"{ ".concat(n.map((n=>"".concat(t.apiDescriptor.key(n),": ").concat(t.apiDescriptor.value(e[n])))).join(", ")," }")},pair:({key:e,value:n})=>t.apiDescriptor.value({[e]:n})}})),Nr=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Tr.__exportStar(Br,t)})),kr=/[|\\{}()[\]^$+*?.]/g,Pr=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(kr,"\\$&")},Or={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Ir=je((function(e){var t={};for(var n in Or)Or.hasOwnProperty(n)&&(t[Or[n]]=n);var r=e.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var o in r)if(r.hasOwnProperty(o)){if(!("channels"in r[o]))throw new Error("missing channels property: "+o);if(!("labels"in r[o]))throw new Error("missing channel labels property: "+o);if(r[o].labels.length!==r[o].channels)throw new Error("channel and label counts mismatch: "+o);var u=r[o].channels,i=r[o].labels;delete r[o].channels,delete r[o].labels,Object.defineProperty(r[o],"channels",{value:u}),Object.defineProperty(r[o],"labels",{value:i})}r.rgb.hsl=function(e){var t,n,r=e[0]/255,o=e[1]/255,u=e[2]/255,i=Math.min(r,o,u),a=Math.max(r,o,u),s=a-i;return a===i?t=0:r===a?t=(o-u)/s:o===a?t=2+(u-r)/s:u===a&&(t=4+(r-o)/s),(t=Math.min(60*t,360))<0&&(t+=360),n=(i+a)/2,[t,100*(a===i?0:n<=.5?s/(a+i):s/(2-a-i)),100*n]},r.rgb.hsv=function(e){var t,n,r,o,u,i=e[0]/255,a=e[1]/255,s=e[2]/255,c=Math.max(i,a,s),l=c-Math.min(i,a,s),p=function(e){return(c-e)/6/l+.5};return 0===l?o=u=0:(u=l/c,t=p(i),n=p(a),r=p(s),i===c?o=r-n:a===c?o=1/3+t-r:s===c&&(o=2/3+n-t),o<0?o+=1:o>1&&(o-=1)),[360*o,100*u,100*c]},r.rgb.hwb=function(e){var t=e[0],n=e[1],o=e[2];return[r.rgb.hsl(e)[0],100*(1/255*Math.min(t,Math.min(n,o))),100*(o=1-1/255*Math.max(t,Math.max(n,o)))]},r.rgb.cmyk=function(e){var t,n=e[0]/255,r=e[1]/255,o=e[2]/255;return[100*((1-n-(t=Math.min(1-n,1-r,1-o)))/(1-t)||0),100*((1-r-t)/(1-t)||0),100*((1-o-t)/(1-t)||0),100*t]},r.rgb.keyword=function(e){var n=t[e];if(n)return n;var r,o,u,i=1/0;for(var a in Or)if(Or.hasOwnProperty(a)){var s=Or[a],c=(o=e,u=s,Math.pow(o[0]-u[0],2)+Math.pow(o[1]-u[1],2)+Math.pow(o[2]-u[2],2));c<i&&(i=c,r=a)}return r},r.keyword.rgb=function(e){return Or[e]},r.rgb.xyz=function(e){var t=e[0]/255,n=e[1]/255,r=e[2]/255;return[100*(.4124*(t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)),100*(.2126*t+.7152*n+.0722*r),100*(.0193*t+.1192*n+.9505*r)]},r.rgb.lab=function(e){var t=r.rgb.xyz(e),n=t[0],o=t[1],u=t[2];return o/=100,u/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116)-16,500*(n-o),200*(o-(u=u>.008856?Math.pow(u,1/3):7.787*u+16/116))]},r.hsl.rgb=function(e){var t,n,r,o,u,i=e[0]/360,a=e[1]/100,s=e[2]/100;if(0===a)return[u=255*s,u,u];t=2*s-(n=s<.5?s*(1+a):s+a-s*a),o=[0,0,0];for(var c=0;c<3;c++)(r=i+1/3*-(c-1))<0&&r++,r>1&&r--,u=6*r<1?t+6*(n-t)*r:2*r<1?n:3*r<2?t+(n-t)*(2/3-r)*6:t,o[c]=255*u;return o},r.hsl.hsv=function(e){var t=e[0],n=e[1]/100,r=e[2]/100,o=n,u=Math.max(r,.01);return n*=(r*=2)<=1?r:2-r,o*=u<=1?u:2-u,[t,100*(0===r?2*o/(u+o):2*n/(r+n)),100*((r+n)/2)]},r.hsv.rgb=function(e){var t=e[0]/60,n=e[1]/100,r=e[2]/100,o=Math.floor(t)%6,u=t-Math.floor(t),i=255*r*(1-n),a=255*r*(1-n*u),s=255*r*(1-n*(1-u));switch(r*=255,o){case 0:return[r,s,i];case 1:return[a,r,i];case 2:return[i,r,s];case 3:return[i,a,r];case 4:return[s,i,r];case 5:return[r,i,a]}},r.hsv.hsl=function(e){var t,n,r,o=e[0],u=e[1]/100,i=e[2]/100,a=Math.max(i,.01);return r=(2-u)*i,n=u*a,[o,100*(n=(n/=(t=(2-u)*a)<=1?t:2-t)||0),100*(r/=2)]},r.hwb.rgb=function(e){var t,n,r,o,u,i,a,s=e[0]/360,c=e[1]/100,l=e[2]/100,p=c+l;switch(p>1&&(c/=p,l/=p),r=6*s-(t=Math.floor(6*s)),0!=(1&t)&&(r=1-r),o=c+r*((n=1-l)-c),t){default:case 6:case 0:u=n,i=o,a=c;break;case 1:u=o,i=n,a=c;break;case 2:u=c,i=n,a=o;break;case 3:u=c,i=o,a=n;break;case 4:u=o,i=c,a=n;break;case 5:u=n,i=c,a=o}return[255*u,255*i,255*a]},r.cmyk.rgb=function(e){var t=e[0]/100,n=e[1]/100,r=e[2]/100,o=e[3]/100;return[255*(1-Math.min(1,t*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o)),255*(1-Math.min(1,r*(1-o)+o))]},r.xyz.rgb=function(e){var t,n,r,o=e[0]/100,u=e[1]/100,i=e[2]/100;return n=-.9689*o+1.8758*u+.0415*i,r=.0557*o+-.204*u+1.057*i,t=(t=3.2406*o+-1.5372*u+-.4986*i)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,[255*(t=Math.min(Math.max(0,t),1)),255*(n=Math.min(Math.max(0,n),1)),255*(r=Math.min(Math.max(0,r),1))]},r.xyz.lab=function(e){var t=e[0],n=e[1],r=e[2];return n/=100,r/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(t-n),200*(n-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},r.lab.xyz=function(e){var t,n,r,o=e[0];t=e[1]/500+(n=(o+16)/116),r=n-e[2]/200;var u=Math.pow(n,3),i=Math.pow(t,3),a=Math.pow(r,3);return n=u>.008856?u:(n-16/116)/7.787,t=i>.008856?i:(t-16/116)/7.787,r=a>.008856?a:(r-16/116)/7.787,[t*=95.047,n*=100,r*=108.883]},r.lab.lch=function(e){var t,n=e[0],r=e[1],o=e[2];return(t=360*Math.atan2(o,r)/2/Math.PI)<0&&(t+=360),[n,Math.sqrt(r*r+o*o),t]},r.lch.lab=function(e){var t,n=e[0],r=e[1];return t=e[2]/360*2*Math.PI,[n,r*Math.cos(t),r*Math.sin(t)]},r.rgb.ansi16=function(e){var t=e[0],n=e[1],o=e[2],u=1 in arguments?arguments[1]:r.rgb.hsv(e)[2];if(0===(u=Math.round(u/50)))return 30;var i=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(t/255));return 2===u&&(i+=60),i},r.hsv.ansi16=function(e){return r.rgb.ansi16(r.hsv.rgb(e),e[2])},r.rgb.ansi256=function(e){var t=e[0],n=e[1],r=e[2];return t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},r.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},r.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var n;return e-=16,[Math.floor(e/36)/5*255,Math.floor((n=e%36)/6)/5*255,n%6/5*255]},r.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},r.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var n=t[0];3===t[0].length&&(n=n.split("").map((function(e){return e+e})).join(""));var r=parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},r.rgb.hcg=function(e){var t,n=e[0]/255,r=e[1]/255,o=e[2]/255,u=Math.max(Math.max(n,r),o),i=Math.min(Math.min(n,r),o),a=u-i;return t=a<=0?0:u===n?(r-o)/a%6:u===r?2+(o-n)/a:4+(n-r)/a+4,t/=6,[360*(t%=1),100*a,100*(a<1?i/(1-a):0)]},r.hsl.hcg=function(e){var t=e[1]/100,n=e[2]/100,r=1,o=0;return(r=n<.5?2*t*n:2*t*(1-n))<1&&(o=(n-.5*r)/(1-r)),[e[0],100*r,100*o]},r.hsv.hcg=function(e){var t=e[1]/100,n=e[2]/100,r=t*n,o=0;return r<1&&(o=(n-r)/(1-r)),[e[0],100*r,100*o]},r.hcg.rgb=function(e){var t=e[0]/360,n=e[1]/100,r=e[2]/100;if(0===n)return[255*r,255*r,255*r];var o,u=[0,0,0],i=t%1*6,a=i%1,s=1-a;switch(Math.floor(i)){case 0:u[0]=1,u[1]=a,u[2]=0;break;case 1:u[0]=s,u[1]=1,u[2]=0;break;case 2:u[0]=0,u[1]=1,u[2]=a;break;case 3:u[0]=0,u[1]=s,u[2]=1;break;case 4:u[0]=a,u[1]=0,u[2]=1;break;default:u[0]=1,u[1]=0,u[2]=s}return o=(1-n)*r,[255*(n*u[0]+o),255*(n*u[1]+o),255*(n*u[2]+o)]},r.hcg.hsv=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t),r=0;return n>0&&(r=t/n),[e[0],100*r,100*n]},r.hcg.hsl=function(e){var t=e[1]/100,n=e[2]/100*(1-t)+.5*t,r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],100*r,100*n]},r.hcg.hwb=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},r.hwb.hcg=function(e){var t=e[1]/100,n=1-e[2]/100,r=n-t,o=0;return r<1&&(o=(n-r)/(1-r)),[e[0],100*r,100*o]},r.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},r.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},r.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},r.gray.hsl=r.gray.hsv=function(e){return[0,0,e[0]]},r.gray.hwb=function(e){return[0,100,e[0]]},r.gray.cmyk=function(e){return[0,0,0,e[0]]},r.gray.lab=function(e){return[e[0],0,0]},r.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},r.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}}));function Lr(e){var t=function(){for(var e={},t=Object.keys(Ir),n=t.length,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}(),n=[e];for(t[e].distance=0;n.length;)for(var r=n.pop(),o=Object.keys(Ir[r]),u=o.length,i=0;i<u;i++){var a=o[i],s=t[a];-1===s.distance&&(s.distance=t[r].distance+1,s.parent=r,n.unshift(a))}return t}function Mr(e,t){return function(n){return t(e(n))}}function jr(e,t){for(var n=[t[e].parent,e],r=Ir[t[e].parent][e],o=t[e].parent;t[o].parent;)n.unshift(t[o].parent),r=Mr(Ir[t[o].parent][o],r),o=t[o].parent;return r.conversion=n,r}var _r={};Object.keys(Ir).forEach((function(e){_r[e]={},Object.defineProperty(_r[e],"channels",{value:Ir[e].channels}),Object.defineProperty(_r[e],"labels",{value:Ir[e].labels});var t=function(e){for(var t=Lr(e),n={},r=Object.keys(t),o=r.length,u=0;u<o;u++){var i=r[u];null!==t[i].parent&&(n[i]=jr(i,t))}return n}(e);Object.keys(t).forEach((function(n){var r=t[n];_r[e][n]=function(e){var t=function(t){if(null==t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var n=e(t);if("object"==typeof n)for(var r=n.length,o=0;o<r;o++)n[o]=Math.round(n[o]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}(r),_r[e][n].raw=function(e){var t=function(t){return null==t?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(r)}))}));var Rr=_r,Vr=je((function(e){const t=(e,t)=>function(){const n=e.apply(Rr,arguments);return"\x1b[".concat(n+t,"m")},n=(e,t)=>function(){const n=e.apply(Rr,arguments);return"\x1b[".concat(38+t,";5;").concat(n,"m")},r=(e,t)=>function(){const n=e.apply(Rr,arguments);return"\x1b[".concat(38+t,";2;").concat(n[0],";").concat(n[1],";").concat(n[2],"m")};Object.defineProperty(e,"exports",{enumerable:!0,get:function(){const e=new Map,o={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};o.color.grey=o.color.gray;for(const t of Object.keys(o)){const n=o[t];for(const t of Object.keys(n)){const r=n[t];o[t]={open:"\x1b[".concat(r[0],"m"),close:"\x1b[".concat(r[1],"m")},n[t]=o[t],e.set(r[0],r[1])}Object.defineProperty(o,t,{value:n,enumerable:!1}),Object.defineProperty(o,"codes",{value:e,enumerable:!1})}const u=e=>e,i=(e,t,n)=>[e,t,n];o.color.close="\x1b[39m",o.bgColor.close="\x1b[49m",o.color.ansi={ansi:t(u,0)},o.color.ansi256={ansi256:n(u,0)},o.color.ansi16m={rgb:r(i,0)},o.bgColor.ansi={ansi:t(u,10)},o.bgColor.ansi256={ansi256:n(u,10)},o.bgColor.ansi16m={rgb:r(i,10)};for(let e of Object.keys(Rr)){if("object"!=typeof Rr[e])continue;const u=Rr[e];"ansi16"===e&&(e="ansi"),"ansi16"in u&&(o.color.ansi[e]=t(u.ansi16,0),o.bgColor.ansi[e]=t(u.ansi16,10)),"ansi256"in u&&(o.color.ansi256[e]=n(u.ansi256,0),o.bgColor.ansi256[e]=n(u.ansi256,10)),"rgb"in u&&(o.color.ansi16m[e]=r(u.rgb,0),o.bgColor.ansi16m[e]=r(u.rgb,10))}return o}})})),$r=(e,t)=>{t=t||Oe.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return-1!==r&&(-1===o||r<o)},qr=_e(Object.freeze({__proto__:null,default:{EOL:"\n",platform:()=>"browser",cpus:()=>[{model:"Prettier"}]}}));const Wr=Oe.env;let Ur;function Jr(e){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(function(e){if(!1===Ur)return 0;if($r("color=16m")||$r("color=full")||$r("color=truecolor"))return 3;if($r("color=256"))return 2;if(e&&!e.isTTY&&!0!==Ur)return 0;const t=Ur?1:0;if("win32"===Oe.platform){const e=qr.release().split(".");return Number(Oe.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in Wr)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in Wr))||"codeship"===Wr.CI_NAME?1:t;if("TEAMCITY_VERSION"in Wr)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Wr.TEAMCITY_VERSION)?1:0;if("truecolor"===Wr.COLORTERM)return 3;if("TERM_PROGRAM"in Wr){const e=parseInt((Wr.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Wr.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Wr.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Wr.TERM)||"COLORTERM"in Wr?1:(Wr.TERM,t)}(e))}$r("no-color")||$r("no-colors")||$r("color=false")?Ur=!1:($r("color")||$r("colors")||$r("color=true")||$r("color=always"))&&(Ur=!0),"FORCE_COLOR"in Wr&&(Ur=0===Wr.FORCE_COLOR.length||0!==parseInt(Wr.FORCE_COLOR,10));var zr={supportsColor:Jr,stdout:Jr(Oe.stdout),stderr:Jr(Oe.stderr)};const Hr=/(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Gr=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Xr=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Yr=/\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi,Kr=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1b"],["a","\x07"]]);function Qr(e){return"u"===e[0]&&5===e.length||"x"===e[0]&&3===e.length?String.fromCharCode(parseInt(e.slice(1),16)):Kr.get(e)||e}function Zr(e,t){const n=[],r=t.trim().split(/\s*,\s*/g);let o;for(const t of r)if(isNaN(t)){if(!(o=t.match(Xr)))throw new Error("Invalid Chalk template style argument: ".concat(t," (in style '").concat(e,"')"));n.push(o[2].replace(Yr,((e,t,n)=>t?Qr(t):n)))}else n.push(Number(t));return n}function eo(e){Gr.lastIndex=0;const t=[];let n;for(;null!==(n=Gr.exec(e));){const e=n[1];if(n[2]){const r=Zr(e,n[2]);t.push([e].concat(r))}else t.push([e])}return t}function to(e,t){const n={};for(const e of t)for(const t of e.styles)n[t[0]]=e.inverse?null:t.slice(1);let r=e;for(const e of Object.keys(n))if(Array.isArray(n[e])){if(!(e in r))throw new Error("Unknown Chalk style: ".concat(e));r=n[e].length>0?r[e].apply(r,n[e]):r[e]}return r}var no=(e,t)=>{const n=[],r=[];let o=[];if(t.replace(Hr,((t,u,i,a,s,c)=>{if(u)o.push(Qr(u));else if(a){const t=o.join("");o=[],r.push(0===n.length?t:to(e,n)(t)),n.push({inverse:i,styles:eo(a)})}else if(s){if(0===n.length)throw new Error("Found extraneous } in Chalk template literal");r.push(to(e,n)(o.join(""))),o=[],n.pop()}else o.push(c)})),r.push(o.join("")),n.length>0){const e="Chalk template literal is missing ".concat(n.length," closing bracket").concat(1===n.length?"":"s"," (`}`)");throw new Error(e)}return r.join("")},ro=je((function(e){const t=zr.stdout,n="win32"===Oe.platform&&!(Oe.env.TERM||"").toLowerCase().startsWith("xterm"),r=["ansi","ansi","ansi256","ansi16m"],o=new Set(["gray"]),u=Object.create(null);function i(e,n){n=n||{};const r=t?t.level:0;e.level=void 0===n.level?r:n.level,e.enabled="enabled"in n?n.enabled:e.level>0}function a(e){if(!this||!(this instanceof a)||this.template){const t={};return i(t,e),t.template=function(){const e=[].slice.call(arguments);return p.apply(null,[t.template].concat(e))},Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=a,t.template}i(this,e)}n&&(Vr.blue.open="\x1b[94m");for(const e of Object.keys(Vr))Vr[e].closeRe=new RegExp(Pr(Vr[e].close),"g"),u[e]={get(){const t=Vr[e];return c.call(this,this._styles?this._styles.concat(t):[t],this._empty,e)}};u.visible={get(){return c.call(this,this._styles||[],!0,"visible")}},Vr.color.closeRe=new RegExp(Pr(Vr.color.close),"g");for(const e of Object.keys(Vr.color.ansi))o.has(e)||(u[e]={get(){const t=this.level;return function(){const n=Vr.color[r[t]][e].apply(null,arguments),o={open:n,close:Vr.color.close,closeRe:Vr.color.closeRe};return c.call(this,this._styles?this._styles.concat(o):[o],this._empty,e)}}});Vr.bgColor.closeRe=new RegExp(Pr(Vr.bgColor.close),"g");for(const e of Object.keys(Vr.bgColor.ansi)){if(o.has(e))continue;u["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const t=this.level;return function(){const n=Vr.bgColor[r[t]][e].apply(null,arguments),o={open:n,close:Vr.bgColor.close,closeRe:Vr.bgColor.closeRe};return c.call(this,this._styles?this._styles.concat(o):[o],this._empty,e)}}}}const s=Object.defineProperties((()=>{}),u);function c(e,t,n){const r=function(){return l.apply(r,arguments)};r._styles=e,r._empty=t;const o=this;return Object.defineProperty(r,"level",{enumerable:!0,get:()=>o.level,set(e){o.level=e}}),Object.defineProperty(r,"enabled",{enumerable:!0,get:()=>o.enabled,set(e){o.enabled=e}}),r.hasGrey=this.hasGrey||"gray"===n||"grey"===n,r.__proto__=s,r}function l(){const e=arguments,t=e.length;let r=String(arguments[0]);if(0===t)return"";if(t>1)for(let n=1;n<t;n++)r+=" "+e[n];if(!this.enabled||this.level<=0||!r)return this._empty?"":r;const o=Vr.dim.open;n&&this.hasGrey&&(Vr.dim.open="");for(const e of this._styles.slice().reverse())r=e.open+r.replace(e.closeRe,e.open)+e.close,r=r.replace(/\r?\n/g,"".concat(e.close,"$&").concat(e.open));return Vr.dim.open=o,r}function p(e,t){if(!Array.isArray(t))return[].slice.call(arguments,1).join(" ");const n=[].slice.call(arguments,2),r=[t.raw[0]];for(let e=1;e<t.length;e++)r.push(String(n[e-1]).replace(/[{}\\]/g,"\\$&")),r.push(String(t.raw[e]));return no(e,r.join(""))}Object.defineProperties(a.prototype,u),e.exports=a(),e.exports.supportsColor=t,e.exports.default=e.exports})),oo=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.commonDeprecatedHandler=(e,t,{descriptor:n})=>{const r=["".concat(ro.default.yellow("string"==typeof e?n.key(e):n.pair(e))," is deprecated")];return t&&r.push("we now treat it as ".concat(ro.default.blue("string"==typeof t?n.key(t):n.pair(t)))),r.join("; ")+"."}})),uo=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Tr.__exportStar(oo,t)})),io=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.commonInvalidHandler=(e,t,n)=>["Invalid ".concat(ro.default.red(n.descriptor.key(e))," value."),"Expected ".concat(ro.default.blue(n.schemas[e].expected(n)),","),"but received ".concat(ro.default.red(n.descriptor.value(t)),".")].join(" ")})),ao=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Tr.__exportStar(io,t)})),so=[],co=[],lo=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.levenUnknownHandler=(e,t,{descriptor:n,logger:r,schemas:o})=>{const u=["Ignored unknown option ".concat(ro.default.yellow(n.pair({key:e,value:t})),".")],i=Object.keys(o).sort().find((t=>function(e,t){if(e===t)return 0;var n=e;e.length>t.length&&(e=t,t=n);var r=e.length,o=t.length;if(0===r)return o;if(0===o)return r;for(;r>0&&e.charCodeAt(~-r)===t.charCodeAt(~-o);)r--,o--;if(0===r)return o;for(var u,i,a,s,c=0;c<r&&e.charCodeAt(c)===t.charCodeAt(c);)c++;if(o-=c,0==(r-=c))return o;for(var l=0,p=0;l<r;)co[c+l]=e.charCodeAt(c+l),so[l]=++l;for(;p<o;)for(u=t.charCodeAt(c+p),a=p++,i=p,l=0;l<r;l++)s=u===co[c+l]?a:a+1,a=so[l],i=so[l]=a>i?s>i?i+1:s:s>a?a+1:s;return i}(e,t)<3));i&&u.push("Did you mean ".concat(ro.default.blue(n.key(i)),"?")),r.warn(u.join(" "))}})),po=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Tr.__exportStar(lo,t)})),fo=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Tr.__exportStar(uo,t),Tr.__exportStar(ao,t),Tr.__exportStar(po,t)})),ho=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function r(e,t){const r=new e(t),i=Object.create(r);for(const e of n)e in t&&(i[e]=u(t[e],r,o.prototype[e].length));return i}t.createSchema=r;class o{constructor(e){this.name=e.name}static create(e){return r(this,e)}default(e){}expected(e){return"nothing"}validate(e,t){return!1}deprecated(e,t){return!1}forward(e,t){}redirect(e,t){}overlap(e,t,n){return e}preprocess(e,t){return e}postprocess(e,t){return e}}function u(e,t,n){return"function"==typeof e?(...r)=>e(...r.slice(0,n-1),t,...r.slice(n-1)):()=>e}t.Schema=o})),mo=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});class n extends ho.Schema{constructor(e){super(e),this._sourceName=e.sourceName}expected(e){return e.schemas[this._sourceName].expected(e)}validate(e,t){return t.schemas[this._sourceName].validate(e,t)}redirect(e,t){return this._sourceName}}t.AliasSchema=n})),go=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});class n extends ho.Schema{expected(){return"anything"}validate(){return!0}}t.AnySchema=n})),Do=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});class n extends ho.Schema{constructor(e){var{valueSchema:t,name:n=t.name}=e,r=Tr.__rest(e,["valueSchema","name"]);super(Object.assign({},r,{name:n})),this._valueSchema=t}expected(e){return"an array of ".concat(this._valueSchema.expected(e))}validate(e,t){if(!Array.isArray(e))return!1;const n=[];for(const r of e){const e=t.normalizeValidateResult(this._valueSchema.validate(r,t),r);!0!==e&&n.push(e.value)}return 0===n.length||{value:n}}deprecated(e,t){const n=[];for(const r of e){const e=t.normalizeDeprecatedResult(this._valueSchema.deprecated(r,t),r);!1!==e&&n.push(...e.map((({value:e})=>({value:[e]}))))}return n}forward(e,t){const n=[];for(const o of e){const e=t.normalizeForwardResult(this._valueSchema.forward(o,t),o);n.push(...e.map(r))}return n}redirect(e,t){const n=[],o=[];for(const u of e){const e=t.normalizeRedirectResult(this._valueSchema.redirect(u,t),u);"remain"in e&&n.push(e.remain),o.push(...e.redirect.map(r))}return 0===n.length?{redirect:o}:{redirect:o,remain:n}}overlap(e,t){return e.concat(t)}}function r({from:e,to:t}){return{from:[e],to:t}}t.ArraySchema=n})),yo=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});class n extends ho.Schema{expected(){return"true or false"}validate(e){return"boolean"==typeof e}}t.BooleanSchema=n})),Eo=je((function(e,t){function n(e,t){return"string"==typeof e||"key"in e?{from:t,to:e}:"from"in e?{from:e.from,to:e.to}:{from:t,to:e.to}}function r(e,t){return void 0===e?[]:Array.isArray(e)?e.map((e=>n(e,t))):[n(e,t)]}Object.defineProperty(t,"__esModule",{value:!0}),t.recordFromArray=function(e,t){const n=Object.create(null);for(const r of e){const e=r[t];if(n[e])throw new Error("Duplicate ".concat(t," ").concat(JSON.stringify(e)));n[e]=r}return n},t.mapFromArray=function(e,t){const n=new Map;for(const r of e){const e=r[t];if(n.has(e))throw new Error("Duplicate ".concat(t," ").concat(JSON.stringify(e)));n.set(e,r)}return n},t.createAutoChecklist=function(){const e=Object.create(null);return t=>{const n=JSON.stringify(t);return!!e[n]||(e[n]=!0,!1)}},t.partition=function(e,t){const n=[],r=[];for(const o of e)t(o)?n.push(o):r.push(o);return[n,r]},t.isInt=function(e){return e===Math.floor(e)},t.comparePrimitive=function(e,t){if(e===t)return 0;const n=typeof e,r=typeof t,o=["undefined","object","boolean","number","string"];return n!==r?o.indexOf(n)-o.indexOf(r):"string"!==n?Number(e)-Number(t):e.localeCompare(t)},t.normalizeDefaultResult=function(e){return void 0===e?{}:e},t.normalizeValidateResult=function(e,t){return!0===e||(!1===e?{value:t}:e)},t.normalizeDeprecatedResult=function(e,t,n=!1){return!1!==e&&(!0===e?!!n||[{value:t}]:"value"in e?[e]:0!==e.length&&e)},t.normalizeTransferResult=n,t.normalizeForwardResult=r,t.normalizeRedirectResult=function(e,t){const n=r("object"==typeof e&&"redirect"in e?e.redirect:e,t);return 0===n.length?{remain:t,redirect:n}:"object"==typeof e&&"remain"in e?{remain:e.remain,redirect:n}:{redirect:n}}})),Co=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});class n extends ho.Schema{constructor(e){super(e),this._choices=Eo.mapFromArray(e.choices.map((e=>e&&"object"==typeof e?e:{value:e})),"value")}expected({descriptor:e}){const t=Array.from(this._choices.keys()).map((e=>this._choices.get(e))).filter((e=>!e.deprecated)).map((e=>e.value)).sort(Eo.comparePrimitive).map(e.value),n=t.slice(0,-2),r=t.slice(-2);return n.concat(r.join(" or ")).join(", ")}validate(e){return this._choices.has(e)}deprecated(e){const t=this._choices.get(e);return!(!t||!t.deprecated)&&{value:e}}forward(e){const t=this._choices.get(e);return t?t.forward:void 0}redirect(e){const t=this._choices.get(e);return t?t.redirect:void 0}}t.ChoiceSchema=n})),bo=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});class n extends ho.Schema{expected(){return"a number"}validate(e,t){return"number"==typeof e}}t.NumberSchema=n})),vo=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});class n extends bo.NumberSchema{expected(){return"an integer"}validate(e,t){return!0===t.normalizeValidateResult(super.validate(e,t),e)&&Eo.isInt(e)}}t.IntegerSchema=n})),Ao=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});class n extends ho.Schema{expected(){return"a string"}validate(e){return"string"==typeof e}}t.StringSchema=n})),Fo=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Tr.__exportStar(mo,t),Tr.__exportStar(go,t),Tr.__exportStar(Do,t),Tr.__exportStar(yo,t),Tr.__exportStar(Co,t),Tr.__exportStar(vo,t),Tr.__exportStar(bo,t),Tr.__exportStar(Ao,t)})),xo=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.defaultDescriptor=Br.apiDescriptor,t.defaultUnknownHandler=lo.levenUnknownHandler,t.defaultInvalidHandler=ao.commonInvalidHandler,t.defaultDeprecatedHandler=oo.commonDeprecatedHandler})),So=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.normalize=(e,t,r)=>new n(t,r).normalize(e);class n{constructor(e,t){const{logger:n=console,descriptor:r=xo.defaultDescriptor,unknown:o=xo.defaultUnknownHandler,invalid:u=xo.defaultInvalidHandler,deprecated:i=xo.defaultDeprecatedHandler}=t||{};this._utils={descriptor:r,logger:n||{warn:()=>{}},schemas:Eo.recordFromArray(e,"name"),normalizeDefaultResult:Eo.normalizeDefaultResult,normalizeDeprecatedResult:Eo.normalizeDeprecatedResult,normalizeForwardResult:Eo.normalizeForwardResult,normalizeRedirectResult:Eo.normalizeRedirectResult,normalizeValidateResult:Eo.normalizeValidateResult},this._unknownHandler=o,this._invalidHandler=u,this._deprecatedHandler=i,this.cleanHistory()}cleanHistory(){this._hasDeprecationWarned=Eo.createAutoChecklist()}normalize(e){const t={},n=[e],r=()=>{for(;0!==n.length;){const e=n.shift(),r=this._applyNormalization(e,t);n.push(...r)}};r();for(const e of Object.keys(this._utils.schemas)){const r=this._utils.schemas[e];if(!(e in t)){const t=Eo.normalizeDefaultResult(r.default(this._utils));"value"in t&&n.push({[e]:t.value})}}r();for(const e of Object.keys(this._utils.schemas)){const n=this._utils.schemas[e];e in t&&(t[e]=n.postprocess(t[e],this._utils))}return t}_applyNormalization(e,t){const n=[],[r,o]=Eo.partition(Object.keys(e),(e=>e in this._utils.schemas));for(const o of r){const r=this._utils.schemas[o],u=r.preprocess(e[o],this._utils),i=Eo.normalizeValidateResult(r.validate(u,this._utils),u);if(!0!==i){const{value:e}=i,t=this._invalidHandler(o,e,this._utils);throw"string"==typeof t?new Error(t):t}const a=({from:e,to:t})=>{n.push("string"==typeof t?{[t]:e}:{[t.key]:t.value})},s=({value:e,redirectTo:t})=>{const n=Eo.normalizeDeprecatedResult(r.deprecated(e,this._utils),u,!0);if(!1!==n)if(!0===n)this._hasDeprecationWarned(o)||this._utils.logger.warn(this._deprecatedHandler(o,t,this._utils));else for(const{value:e}of n){const n={key:o,value:e};if(!this._hasDeprecationWarned(n)){const r="string"==typeof t?{key:t,value:e}:t;this._utils.logger.warn(this._deprecatedHandler(n,r,this._utils))}}};Eo.normalizeForwardResult(r.forward(u,this._utils),u).forEach(a);const c=Eo.normalizeRedirectResult(r.redirect(u,this._utils),u);if(c.redirect.forEach(a),"remain"in c){const e=c.remain;t[o]=o in t?r.overlap(t[o],e,this._utils):e,s({value:e})}for(const{from:e,to:t}of c.redirect)s({value:e,redirectTo:t})}for(const r of o){const o=e[r],u=this._unknownHandler(r,o,this._utils);if(u)for(const e of Object.keys(u)){const r={[e]:u[e]};e in this._utils.schemas?n.push(r):Object.assign(t,r)}}return n}}t.Normalizer=n})),wo=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Tr.__exportStar(Nr,t),Tr.__exportStar(fo,t),Tr.__exportStar(Fo,t),Tr.__exportStar(So,t),Tr.__exportStar(ho,t)}));const To=[],Bo=[],No=(e,t)=>{if(e===t)return 0;const n=e;e.length>t.length&&(e=t,t=n);let r=e.length,o=t.length;for(;r>0&&e.charCodeAt(~-r)===t.charCodeAt(~-o);)r--,o--;let u,i,a,s,c=0;for(;c<r&&e.charCodeAt(c)===t.charCodeAt(c);)c++;if(r-=c,o-=c,0===r)return o;let l=0,p=0;for(;l<r;)Bo[l]=e.charCodeAt(c+l),To[l]=++l;for(;p<o;)for(u=t.charCodeAt(c+p),a=p++,i=p,l=0;l<r;l++)s=u===Bo[l]?a:a+1,a=To[l],i=To[l]=a>i?s>i?i+1:s:s>a?a+1:s;return i};var ko=No,Po=No;ko.default=Po;var Oo={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const Io={};for(const e of Object.keys(Oo))Io[Oo[e]]=e;const Lo={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var Mo=Lo;for(const e of Object.keys(Lo)){if(!("channels"in Lo[e]))throw new Error("missing channels property: "+e);if(!("labels"in Lo[e]))throw new Error("missing channel labels property: "+e);if(Lo[e].labels.length!==Lo[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:n}=Lo[e];delete Lo[e].channels,delete Lo[e].labels,Object.defineProperty(Lo[e],"channels",{value:t}),Object.defineProperty(Lo[e],"labels",{value:n})}function jo(e){const t=function(){const e={},t=Object.keys(Mo);for(let n=t.length,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}(),n=[e];for(t[e].distance=0;n.length;){const e=n.pop(),r=Object.keys(Mo[e]);for(let o=r.length,u=0;u<o;u++){const o=r[u],i=t[o];-1===i.distance&&(i.distance=t[e].distance+1,i.parent=e,n.unshift(o))}}return t}function _o(e,t){return function(n){return t(e(n))}}function Ro(e,t){const n=[t[e].parent,e];let r=Mo[t[e].parent][e],o=t[e].parent;for(;t[o].parent;)n.unshift(t[o].parent),r=_o(Mo[t[o].parent][o],r),o=t[o].parent;return r.conversion=n,r}Lo.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(t,n,r),u=Math.max(t,n,r),i=u-o;let a,s;u===o?a=0:t===u?a=(n-r)/i:n===u?a=2+(r-t)/i:r===u&&(a=4+(t-n)/i),a=Math.min(60*a,360),a<0&&(a+=360);const c=(o+u)/2;return s=u===o?0:c<=.5?i/(u+o):i/(2-u-o),[a,100*s,100*c]},Lo.rgb.hsv=function(e){let t,n,r,o,u;const i=e[0]/255,a=e[1]/255,s=e[2]/255,c=Math.max(i,a,s),l=c-Math.min(i,a,s),p=function(e){return(c-e)/6/l+.5};return 0===l?(o=0,u=0):(u=l/c,t=p(i),n=p(a),r=p(s),i===c?o=r-n:a===c?o=1/3+t-r:s===c&&(o=2/3+n-t),o<0?o+=1:o>1&&(o-=1)),[360*o,100*u,100*c]},Lo.rgb.hwb=function(e){const t=e[0],n=e[1];let r=e[2];const o=Lo.rgb.hsl(e)[0],u=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[o,100*u,100*r]},Lo.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(1-t,1-n,1-r);return[100*((1-t-o)/(1-o)||0),100*((1-n-o)/(1-o)||0),100*((1-r-o)/(1-o)||0),100*o]},Lo.rgb.keyword=function(e){const t=Io[e];if(t)return t;let n,r=1/0;for(const t of Object.keys(Oo)){const i=(u=Oo[t],((o=e)[0]-u[0])**2+(o[1]-u[1])**2+(o[2]-u[2])**2);i<r&&(r=i,n=t)}var o,u;return n},Lo.keyword.rgb=function(e){return Oo[e]},Lo.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;return[100*(.4124*t+.3576*n+.1805*r),100*(.2126*t+.7152*n+.0722*r),100*(.0193*t+.1192*n+.9505*r)]},Lo.rgb.lab=function(e){const t=Lo.rgb.xyz(e);let n=t[0],r=t[1],o=t[2];n/=95.047,r/=100,o/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;return[116*r-16,500*(n-r),200*(r-o)]},Lo.hsl.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;let o,u,i;if(0===n)return i=255*r,[i,i,i];o=r<.5?r*(1+n):r+n-r*n;const a=2*r-o,s=[0,0,0];for(let e=0;e<3;e++)u=t+1/3*-(e-1),u<0&&u++,u>1&&u--,i=6*u<1?a+6*(o-a)*u:2*u<1?o:3*u<2?a+(o-a)*(2/3-u)*6:a,s[e]=255*i;return s},Lo.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,r=e[2]/100,o=n;const u=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,o*=u<=1?u:2-u;return[t,100*(0===r?2*o/(u+o):2*n/(r+n)),100*((r+n)/2)]},Lo.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let r=e[2]/100;const o=Math.floor(t)%6,u=t-Math.floor(t),i=255*r*(1-n),a=255*r*(1-n*u),s=255*r*(1-n*(1-u));switch(r*=255,o){case 0:return[r,s,i];case 1:return[a,r,i];case 2:return[i,r,s];case 3:return[i,a,r];case 4:return[s,i,r];case 5:return[r,i,a]}},Lo.hsv.hsl=function(e){const t=e[0],n=e[1]/100,r=e[2]/100,o=Math.max(r,.01);let u,i;i=(2-n)*r;const a=(2-n)*o;return u=n*o,u/=a<=1?a:2-a,u=u||0,i/=2,[t,100*u,100*i]},Lo.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,r=e[2]/100;const o=n+r;let u;o>1&&(n/=o,r/=o);const i=Math.floor(6*t),a=1-r;u=6*t-i,0!=(1&i)&&(u=1-u);const s=n+u*(a-n);let c,l,p;switch(i){default:case 6:case 0:c=a,l=s,p=n;break;case 1:c=s,l=a,p=n;break;case 2:c=n,l=a,p=s;break;case 3:c=n,l=s,p=a;break;case 4:c=s,l=n,p=a;break;case 5:c=a,l=n,p=s}return[255*c,255*l,255*p]},Lo.cmyk.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100,o=e[3]/100;return[255*(1-Math.min(1,t*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o)),255*(1-Math.min(1,r*(1-o)+o))]},Lo.xyz.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100;let o,u,i;return o=3.2406*t+-1.5372*n+-.4986*r,u=-.9689*t+1.8758*n+.0415*r,i=.0557*t+-.204*n+1.057*r,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,u=u>.0031308?1.055*u**(1/2.4)-.055:12.92*u,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,o=Math.min(Math.max(0,o),1),u=Math.min(Math.max(0,u),1),i=Math.min(Math.max(0,i),1),[255*o,255*u,255*i]},Lo.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];t/=95.047,n/=100,r/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116;return[116*n-16,500*(t-n),200*(n-r)]},Lo.lab.xyz=function(e){let t,n,r;n=(e[0]+16)/116,t=e[1]/500+n,r=n-e[2]/200;const o=n**3,u=t**3,i=r**3;return n=o>.008856?o:(n-16/116)/7.787,t=u>.008856?u:(t-16/116)/7.787,r=i>.008856?i:(r-16/116)/7.787,t*=95.047,n*=100,r*=108.883,[t,n,r]},Lo.lab.lch=function(e){const t=e[0],n=e[1],r=e[2];let o;o=360*Math.atan2(r,n)/2/Math.PI,o<0&&(o+=360);return[t,Math.sqrt(n*n+r*r),o]},Lo.lch.lab=function(e){const t=e[0],n=e[1],r=e[2]/360*2*Math.PI;return[t,n*Math.cos(r),n*Math.sin(r)]},Lo.rgb.ansi16=function(e,t=null){const[n,r,o]=e;let u=null===t?Lo.rgb.hsv(e)[2]:t;if(u=Math.round(u/50),0===u)return 30;let i=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return 2===u&&(i+=60),i},Lo.hsv.ansi16=function(e){return Lo.rgb.ansi16(Lo.hsv.rgb(e),e[2])},Lo.rgb.ansi256=function(e){const t=e[0],n=e[1],r=e[2];if(t===n&&n===r)return t<8?16:t>248?231:Math.round((t-8)/247*24)+232;return 16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},Lo.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},Lo.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;e-=16;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},Lo.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},Lo.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];3===t[0].length&&(n=n.split("").map((e=>e+e)).join(""));const r=parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},Lo.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.max(Math.max(t,n),r),u=Math.min(Math.min(t,n),r),i=o-u;let a,s;return a=i<1?u/(1-i):0,s=i<=0?0:o===t?(n-r)/i%6:o===n?2+(r-t)/i:4+(t-n)/i,s/=6,s%=1,[360*s,100*i,100*a]},Lo.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n);let o=0;return r<1&&(o=(n-.5*r)/(1-r)),[e[0],100*r,100*o]},Lo.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=t*n;let o=0;return r<1&&(o=(n-r)/(1-r)),[e[0],100*r,100*o]},Lo.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;if(0===n)return[255*r,255*r,255*r];const o=[0,0,0],u=t%1*6,i=u%1,a=1-i;let s=0;switch(Math.floor(u)){case 0:o[0]=1,o[1]=i,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=i;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=i,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return s=(1-n)*r,[255*(n*o[0]+s),255*(n*o[1]+s),255*(n*o[2]+s)]},Lo.hcg.hsv=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);let r=0;return n>0&&(r=t/n),[e[0],100*r,100*n]},Lo.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],100*r,100*n]},Lo.hcg.hwb=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},Lo.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,r=n-t;let o=0;return r<1&&(o=(n-r)/(1-r)),[e[0],100*r,100*o]},Lo.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},Lo.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},Lo.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},Lo.gray.hsl=function(e){return[0,0,e[0]]},Lo.gray.hsv=Lo.gray.hsl,Lo.gray.hwb=function(e){return[0,100,e[0]]},Lo.gray.cmyk=function(e){return[0,0,0,e[0]]},Lo.gray.lab=function(e){return[e[0],0,0]},Lo.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},Lo.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};const Vo={};Object.keys(Mo).forEach((e=>{Vo[e]={},Object.defineProperty(Vo[e],"channels",{value:Mo[e].channels}),Object.defineProperty(Vo[e],"labels",{value:Mo[e].labels});const t=function(e){const t=jo(e),n={},r=Object.keys(t);for(let e=r.length,o=0;o<e;o++){const e=r[o];null!==t[e].parent&&(n[e]=Ro(e,t))}return n}(e);Object.keys(t).forEach((n=>{const r=t[n];Vo[e][n]=function(e){const t=function(...t){const n=t[0];if(null==n)return n;n.length>1&&(t=n);const r=e(t);if("object"==typeof r)for(let e=r.length,t=0;t<e;t++)r[t]=Math.round(r[t]);return r};return"conversion"in e&&(t.conversion=e.conversion),t}(r),Vo[e][n].raw=function(e){const t=function(...t){const n=t[0];return null==n?n:(n.length>1&&(t=n),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(r)}))}));var $o=Vo,qo=je((function(e){const t=(e,t)=>(...n)=>{const r=e(...n);return"\x1b[".concat(r+t,"m")},n=(e,t)=>(...n)=>{const r=e(...n);return"\x1b[".concat(38+t,";5;").concat(r,"m")},r=(e,t)=>(...n)=>{const r=e(...n);return"\x1b[".concat(38+t,";2;").concat(r[0],";").concat(r[1],";").concat(r[2],"m")},o=e=>e,u=(e,t,n)=>[e,t,n],i=(e,t,n)=>{Object.defineProperty(e,t,{get:()=>{const r=n();return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0}),r},enumerable:!0,configurable:!0})};let a;const s=(e,t,n,r)=>{void 0===a&&(a=$o);const o=r?10:0,u={};for(const[r,i]of Object.entries(a)){const a="ansi16"===r?"ansi":r;r===t?u[a]=e(n,o):"object"==typeof i&&(u[a]=e(i[t],o))}return u};Object.defineProperty(e,"exports",{enumerable:!0,get:function(){const e=new Map,a={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};a.color.gray=a.color.blackBright,a.bgColor.bgGray=a.bgColor.bgBlackBright,a.color.grey=a.color.blackBright,a.bgColor.bgGrey=a.bgColor.bgBlackBright;for(const[t,n]of Object.entries(a)){for(const[t,r]of Object.entries(n))a[t]={open:"\x1b[".concat(r[0],"m"),close:"\x1b[".concat(r[1],"m")},n[t]=a[t],e.set(r[0],r[1]);Object.defineProperty(a,t,{value:n,enumerable:!1})}return Object.defineProperty(a,"codes",{value:e,enumerable:!1}),a.color.close="\x1b[39m",a.bgColor.close="\x1b[49m",i(a.color,"ansi",(()=>s(t,"ansi16",o,!1))),i(a.color,"ansi256",(()=>s(n,"ansi256",o,!1))),i(a.color,"ansi16m",(()=>s(r,"rgb",u,!1))),i(a.bgColor,"ansi",(()=>s(t,"ansi16",o,!0))),i(a.bgColor,"ansi256",(()=>s(n,"ansi256",o,!0))),i(a.bgColor,"ansi16m",(()=>s(r,"rgb",u,!0))),a}})})),Wo={isatty:()=>!1},Uo=(e,t=Oe.argv)=>{const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return-1!==r&&(-1===o||r<o)},Jo=_e(Object.freeze({__proto__:null,default:Wo}));const{env:zo}=Oe;let Ho;function Go(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Xo(e,t){if(0===Ho)return 0;if(Uo("color=16m")||Uo("color=full")||Uo("color=truecolor"))return 3;if(Uo("color=256"))return 2;if(e&&!t&&void 0===Ho)return 0;const n=Ho||0;if("dumb"===zo.TERM)return n;if("win32"===Oe.platform){const e=qr.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in zo)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in zo))||"codeship"===zo.CI_NAME?1:n;if("TEAMCITY_VERSION"in zo)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(zo.TEAMCITY_VERSION)?1:0;if("GITHUB_ACTIONS"in zo)return 1;if("truecolor"===zo.COLORTERM)return 3;if("TERM_PROGRAM"in zo){const e=parseInt((zo.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(zo.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(zo.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(zo.TERM)||"COLORTERM"in zo?1:n}Uo("no-color")||Uo("no-colors")||Uo("color=false")||Uo("color=never")?Ho=0:(Uo("color")||Uo("colors")||Uo("color=true")||Uo("color=always"))&&(Ho=1),"FORCE_COLOR"in zo&&(Ho="true"===zo.FORCE_COLOR?1:"false"===zo.FORCE_COLOR?0:0===zo.FORCE_COLOR.length?1:Math.min(parseInt(zo.FORCE_COLOR,10),3));var Yo={supportsColor:function(e){return Go(Xo(e,e&&e.isTTY))},stdout:Go(Xo(!0,Jo.isatty(1))),stderr:Go(Xo(!0,Jo.isatty(2)))};var Ko={stringReplaceAll:(e,t,n)=>{let r=e.indexOf(t);if(-1===r)return e;const o=t.length;let u=0,i="";do{i+=e.substr(u,r-u)+t+n,u=r+o,r=e.indexOf(t,u)}while(-1!==r);return i+=e.substr(u),i},stringEncaseCRLFWithFirstIndex:(e,t,n,r)=>{let o=0,u="";do{const i="\r"===e[r-1];u+=e.substr(o,(i?r-1:r)-o)+t+(i?"\r\n":"\n")+n,o=r+1,r=e.indexOf("\n",o)}while(-1!==r);return u+=e.substr(o),u}};const Qo=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Zo=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,eu=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,tu=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,nu=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1b"],["a","\x07"]]);function ru(e){const t="u"===e[0],n="{"===e[1];return t&&!n&&5===e.length||"x"===e[0]&&3===e.length?String.fromCharCode(parseInt(e.slice(1),16)):t&&n?String.fromCodePoint(parseInt(e.slice(2,-1),16)):nu.get(e)||e}function ou(e,t){const n=[],r=t.trim().split(/\s*,\s*/g);let o;for(const t of r){const r=Number(t);if(Number.isNaN(r)){if(!(o=t.match(eu)))throw new Error("Invalid Chalk template style argument: ".concat(t," (in style '").concat(e,"')"));n.push(o[2].replace(tu,((e,t,n)=>t?ru(t):n)))}else n.push(r)}return n}function uu(e){Zo.lastIndex=0;const t=[];let n;for(;null!==(n=Zo.exec(e));){const e=n[1];if(n[2]){const r=ou(e,n[2]);t.push([e].concat(r))}else t.push([e])}return t}function iu(e,t){const n={};for(const e of t)for(const t of e.styles)n[t[0]]=e.inverse?null:t.slice(1);let r=e;for(const[e,t]of Object.entries(n))if(Array.isArray(t)){if(!(e in r))throw new Error("Unknown Chalk style: ".concat(e));r=t.length>0?r[e](...t):r[e]}return r}var au=(e,t)=>{const n=[],r=[];let o=[];if(t.replace(Qo,((t,u,i,a,s,c)=>{if(u)o.push(ru(u));else if(a){const t=o.join("");o=[],r.push(0===n.length?t:iu(e,n)(t)),n.push({inverse:i,styles:uu(a)})}else if(s){if(0===n.length)throw new Error("Found extraneous } in Chalk template literal");r.push(iu(e,n)(o.join(""))),o=[],n.pop()}else o.push(c)})),r.push(o.join("")),n.length>0){const e="Chalk template literal is missing ".concat(n.length," closing bracket").concat(1===n.length?"":"s"," (`}`)");throw new Error(e)}return r.join("")};const{stdout:su,stderr:cu}=Yo,{stringReplaceAll:lu,stringEncaseCRLFWithFirstIndex:pu}=Ko,{isArray:du}=Array,fu=["ansi","ansi","ansi256","ansi16m"],hu=Object.create(null);class mu{constructor(e){return gu(e)}}const gu=e=>{const t={};return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const n=su?su.level:0;e.level=void 0===t.level?n:t.level})(t,e),t.template=(...e)=>Fu(t.template,...e),Object.setPrototypeOf(t,Du.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},t.template.Instance=mu,t.template};function Du(e){return gu(e)}for(const[e,t]of Object.entries(qo))hu[e]={get(){const n=bu(this,Cu(t.open,t.close,this._styler),this._isEmpty);return Object.defineProperty(this,e,{value:n}),n}};hu.visible={get(){const e=bu(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:e}),e}};const yu=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const e of yu)hu[e]={get(){const{level:t}=this;return function(...n){const r=Cu(qo.color[fu[t]][e](...n),qo.color.close,this._styler);return bu(this,r,this._isEmpty)}}};for(const e of yu){hu["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...n){const r=Cu(qo.bgColor[fu[t]][e](...n),qo.bgColor.close,this._styler);return bu(this,r,this._isEmpty)}}}}const Eu=Object.defineProperties((()=>{}),Object.assign({},hu,{level:{enumerable:!0,get(){return this._generator.level},set(e){this._generator.level=e}}})),Cu=(e,t,n)=>{let r,o;return void 0===n?(r=e,o=t):(r=n.openAll+e,o=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:o,parent:n}},bu=(e,t,n)=>{const r=(...e)=>du(e[0])&&du(e[0].raw)?vu(r,Fu(r,...e)):vu(r,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(r,Eu),r._generator=e,r._styler=t,r._isEmpty=n,r},vu=(e,t)=>{if(e.level<=0||!t)return e._isEmpty?"":t;let n=e._styler;if(void 0===n)return t;const{openAll:r,closeAll:o}=n;if(-1!==t.indexOf("\x1b"))for(;void 0!==n;)t=lu(t,n.close,n.open),n=n.parent;const u=t.indexOf("\n");return-1!==u&&(t=pu(t,o,r,u)),r+t+o};let Au;const Fu=(e,...t)=>{const[n]=t;if(!du(n)||!du(n.raw))return t.join(" ");const r=t.slice(1),o=[n.raw[0]];for(let e=1;e<n.length;e++)o.push(String(r[e-1]).replace(/[{}\\]/g,"\\$&"),String(n.raw[e]));return void 0===Au&&(Au=au),Au(e,o.join(""))};Object.defineProperties(Du.prototype,hu);const xu=Du();xu.supportsColor=su,xu.stderr=Du({level:cu?cu.level:0}),xu.stderr.supportsColor=cu;var Su=xu;var wu=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e},Tu="object"==typeof Me&&Me&&Me.Object===Object&&Me,Bu="object"==typeof self&&self&&self.Object===Object&&self,Nu=(Tu||Bu||Function("return this")()).Symbol,ku=Object.prototype,Pu=ku.hasOwnProperty,Ou=ku.toString,Iu=Nu?Nu.toStringTag:void 0;var Lu=function(e){var t=Pu.call(e,Iu),n=e[Iu];try{e[Iu]=void 0;var r=!0}catch(e){}var o=Ou.call(e);return r&&(t?e[Iu]=n:delete e[Iu]),o},Mu=Object.prototype.toString;var ju=function(e){return Mu.call(e)},_u=Nu?Nu.toStringTag:void 0;var Ru=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":_u&&_u in Object(e)?Lu(e):ju(e)};var Vu=function(e){return null!=e&&"object"==typeof e};var $u=function(e){return Vu(e)&&"[object Arguments]"==Ru(e)},qu=Object.prototype,Wu=qu.hasOwnProperty,Uu=qu.propertyIsEnumerable,Ju=$u(function(){return arguments}())?$u:function(e){return Vu(e)&&Wu.call(e,"callee")&&!Uu.call(e,"callee")},zu=Array.isArray,Hu=Nu?Nu.isConcatSpreadable:void 0;var Gu=function(e){return zu(e)||Ju(e)||!!(Hu&&e&&e[Hu])};var Xu=function e(t,n,r,o,u){var i=-1,a=t.length;for(r||(r=Gu),u||(u=[]);++i<a;){var s=t[i];n>0&&r(s)?n>1?e(s,n-1,r,o,u):wu(u,s):o||(u[u.length]=s)}return u};var Yu=function(e){return(null==e?0:e.length)?Xu(e,1):[]};const Ku={key:e=>1===e.length?"-".concat(e):"--".concat(e),value:e=>wo.apiDescriptor.value(e),pair:({key:e,value:t})=>!1===t?"--no-".concat(e):!0===t?Ku.key(e):""===t?"".concat(Ku.key(e)," without an argument"):"".concat(Ku.key(e),"=").concat(t)};class Qu extends wo.ChoiceSchema{constructor({name:e,flags:t}){super({name:e,choices:t}),this._flags=t.slice().sort()}preprocess(e,t){if("string"==typeof e&&0!==e.length&&!this._flags.includes(e)){const n=this._flags.find((t=>ko(t,e)<3));if(n)return t.logger.warn(["Unknown flag ".concat(Su.yellow(t.descriptor.value(e)),","),"did you mean ".concat(Su.blue(t.descriptor.value(n)),"?")].join(" ")),n}return e}expected(){return"a flag"}}let Zu;function ei(t,n,{logger:r,isCLI:o=!1,passThrough:u=!1}={}){const i=u?Array.isArray(u)?(e,t)=>u.includes(e)?{[e]:t}:void 0:(e,t)=>({[e]:t}):(t,n,r)=>{const o=e(r.schemas,["_"]);return wo.levenUnknownHandler(t,n,Object.assign({},r,{schemas:o}))},a=o?Ku:wo.apiDescriptor,s=function(e,{isCLI:t}){const n=[];t&&n.push(wo.AnySchema.create({name:"_"}));for(const r of e)n.push(ti(r,{isCLI:t,optionInfos:e})),r.alias&&t&&n.push(wo.AliasSchema.create({name:r.alias,sourceName:r.name}));return n}(n,{isCLI:o}),c=new wo.Normalizer(s,{logger:r,unknown:i,descriptor:a}),l=!1!==r;l&&Zu&&(c._hasDeprecationWarned=Zu);const p=c.normalize(t);return l&&(Zu=c._hasDeprecationWarned),p}function ti(e,{isCLI:t,optionInfos:n}){let r;const o={name:e.name},u={};switch(e.type){case"int":r=wo.IntegerSchema,t&&(o.preprocess=e=>Number(e));break;case"string":r=wo.StringSchema;break;case"choice":r=wo.ChoiceSchema,o.choices=e.choices.map((t=>"object"==typeof t&&t.redirect?Object.assign({},t,{redirect:{to:{key:e.name,value:t.redirect}}}):t));break;case"boolean":r=wo.BooleanSchema;break;case"flag":r=Qu,o.flags=Yu(n.map((e=>[e.alias,e.description&&e.name,e.oppositeDescription&&"no-".concat(e.name)].filter(Boolean))));break;case"path":r=wo.StringSchema;break;default:throw new Error("Unexpected type ".concat(e.type))}if(e.exception?o.validate=(t,n,r)=>e.exception(t)||n.validate(t,r):o.validate=(e,t,n)=>void 0===e||t.validate(e,n),e.redirect&&(u.redirect=t=>t?{to:{key:e.redirect.option,value:e.redirect.value}}:void 0),e.deprecated&&(u.deprecated=!0),t&&!e.array){const e=o.preprocess||(e=>e);o.preprocess=(t,n,r)=>n.preprocess(e(Array.isArray(t)?t[t.length-1]:t),r)}return e.array?wo.ArraySchema.create(Object.assign({},t?{preprocess:e=>[].concat(e)}:{},u,{valueSchema:r.create(o)})):r.create(Object.assign({},o,u))}var ni={normalizeApiOptions:function(e,t,n){return ei(e,t,n)},normalizeCliOptions:function(e,t,n){return ei(e,t,Object.assign({isCLI:!0},n))}};function ri(e,t){const{ignoreDecorators:n}=t||{};if(!n){const t=e.declaration&&e.declaration.decorators||e.decorators;if(t&&t.length>0)return ri(t[0])}return e.range?e.range[0]:e.start}function oi(e){const t=e.range?e.range[1]:e.end;return e.typeAnnotation?Math.max(t,oi(e.typeAnnotation)):t}function ui(e,t){return ri(e)===ri(t)}var ii={locStart:ri,locEnd:oi,composeLoc:function(e,t=e){const n=ri(e);return[n,"number"==typeof t?n+t:oi(t)]},hasSameLocStart:ui,hasSameLoc:function(e,t){return ui(e,t)&&function(e,t){return oi(e)===oi(t)}(e,t)}},ai=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.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,t.matchToToken=function(e){var t={type:"invalid",value:e[0],closed:void 0};return e[1]?(t.type="string",t.closed=!(!e[3]&&!e[4])):e[5]?t.type="comment":e[6]?(t.type="comment",t.closed=!!e[7]):e[8]?t.type="regex":e[9]?t.type="number":e[10]?t.type="name":e[11]?t.type="punctuator":e[12]&&(t.type="whitespace"),t}})),si=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isIdentifierStart=c,t.isIdentifierChar=l,t.isIdentifierName=function(e){let t=!0;for(let n=0,r=Array.from(e);n<r.length;n++){const e=r[n].codePointAt(0);if(t){if(!c(e))return!1;t=!1}else if(!l(e))return!1}return!t};let n="\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\u0560-\u0588\u05d0-\u05ea\u05ef-\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\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\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\u09fc\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\u0d04-\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\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\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-\u1878\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\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\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-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\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-\uab69\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",r="\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";const o=new RegExp("["+n+"]"),u=new RegExp("["+n+r+"]");n=r=null;const i=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938],a=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function s(e,t){let n=65536;for(let r=0,o=t.length;r<o;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function c(e){return e<65?36===e:e<=90||(e<97?95===e:e<=122||(e<=65535?e>=170&&o.test(String.fromCharCode(e)):s(e,i)))}function l(e){return e<48?36===e:e<58||!(e<65)&&(e<=90||(e<97?95===e:e<=122||(e<=65535?e>=170&&u.test(String.fromCharCode(e)):s(e,i)||s(e,a))))}})),ci=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isReservedWord=a,t.isStrictReservedWord=s,t.isStrictBindOnlyReservedWord=c,t.isStrictBindReservedWord=function(e,t){return s(e,t)||c(e)},t.isKeyword=function(e){return o.has(e)};const n=["implements","interface","let","package","private","protected","public","static","yield"],r=["eval","arguments"],o=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"]),u=new Set(n),i=new Set(r);function a(e,t){return t&&"await"===e||"enum"===e}function s(e,t){return a(e,t)||u.has(e)}function c(e){return i.has(e)}})),li=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isIdentifierName",{enumerable:!0,get:function(){return si.isIdentifierName}}),Object.defineProperty(t,"isIdentifierChar",{enumerable:!0,get:function(){return si.isIdentifierChar}}),Object.defineProperty(t,"isIdentifierStart",{enumerable:!0,get:function(){return si.isIdentifierStart}}),Object.defineProperty(t,"isReservedWord",{enumerable:!0,get:function(){return ci.isReservedWord}}),Object.defineProperty(t,"isStrictBindOnlyReservedWord",{enumerable:!0,get:function(){return ci.isStrictBindOnlyReservedWord}}),Object.defineProperty(t,"isStrictBindReservedWord",{enumerable:!0,get:function(){return ci.isStrictBindReservedWord}}),Object.defineProperty(t,"isStrictReservedWord",{enumerable:!0,get:function(){return ci.isStrictReservedWord}}),Object.defineProperty(t,"isKeyword",{enumerable:!0,get:function(){return ci.isKeyword}})})),pi=/[|\\{}()[\]^$+*?.]/g,di=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(pi,"\\$&")},fi={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},hi=je((function(e){var t={};for(var n in fi)fi.hasOwnProperty(n)&&(t[fi[n]]=n);var r=e.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var o in r)if(r.hasOwnProperty(o)){if(!("channels"in r[o]))throw new Error("missing channels property: "+o);if(!("labels"in r[o]))throw new Error("missing channel labels property: "+o);if(r[o].labels.length!==r[o].channels)throw new Error("channel and label counts mismatch: "+o);var u=r[o].channels,i=r[o].labels;delete r[o].channels,delete r[o].labels,Object.defineProperty(r[o],"channels",{value:u}),Object.defineProperty(r[o],"labels",{value:i})}r.rgb.hsl=function(e){var t,n,r=e[0]/255,o=e[1]/255,u=e[2]/255,i=Math.min(r,o,u),a=Math.max(r,o,u),s=a-i;return a===i?t=0:r===a?t=(o-u)/s:o===a?t=2+(u-r)/s:u===a&&(t=4+(r-o)/s),(t=Math.min(60*t,360))<0&&(t+=360),n=(i+a)/2,[t,100*(a===i?0:n<=.5?s/(a+i):s/(2-a-i)),100*n]},r.rgb.hsv=function(e){var t,n,r,o,u,i=e[0]/255,a=e[1]/255,s=e[2]/255,c=Math.max(i,a,s),l=c-Math.min(i,a,s),p=function(e){return(c-e)/6/l+.5};return 0===l?o=u=0:(u=l/c,t=p(i),n=p(a),r=p(s),i===c?o=r-n:a===c?o=1/3+t-r:s===c&&(o=2/3+n-t),o<0?o+=1:o>1&&(o-=1)),[360*o,100*u,100*c]},r.rgb.hwb=function(e){var t=e[0],n=e[1],o=e[2];return[r.rgb.hsl(e)[0],100*(1/255*Math.min(t,Math.min(n,o))),100*(o=1-1/255*Math.max(t,Math.max(n,o)))]},r.rgb.cmyk=function(e){var t,n=e[0]/255,r=e[1]/255,o=e[2]/255;return[100*((1-n-(t=Math.min(1-n,1-r,1-o)))/(1-t)||0),100*((1-r-t)/(1-t)||0),100*((1-o-t)/(1-t)||0),100*t]},r.rgb.keyword=function(e){var n=t[e];if(n)return n;var r,o,u,i=1/0;for(var a in fi)if(fi.hasOwnProperty(a)){var s=fi[a],c=(o=e,u=s,Math.pow(o[0]-u[0],2)+Math.pow(o[1]-u[1],2)+Math.pow(o[2]-u[2],2));c<i&&(i=c,r=a)}return r},r.keyword.rgb=function(e){return fi[e]},r.rgb.xyz=function(e){var t=e[0]/255,n=e[1]/255,r=e[2]/255;return[100*(.4124*(t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)),100*(.2126*t+.7152*n+.0722*r),100*(.0193*t+.1192*n+.9505*r)]},r.rgb.lab=function(e){var t=r.rgb.xyz(e),n=t[0],o=t[1],u=t[2];return o/=100,u/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116)-16,500*(n-o),200*(o-(u=u>.008856?Math.pow(u,1/3):7.787*u+16/116))]},r.hsl.rgb=function(e){var t,n,r,o,u,i=e[0]/360,a=e[1]/100,s=e[2]/100;if(0===a)return[u=255*s,u,u];t=2*s-(n=s<.5?s*(1+a):s+a-s*a),o=[0,0,0];for(var c=0;c<3;c++)(r=i+1/3*-(c-1))<0&&r++,r>1&&r--,u=6*r<1?t+6*(n-t)*r:2*r<1?n:3*r<2?t+(n-t)*(2/3-r)*6:t,o[c]=255*u;return o},r.hsl.hsv=function(e){var t=e[0],n=e[1]/100,r=e[2]/100,o=n,u=Math.max(r,.01);return n*=(r*=2)<=1?r:2-r,o*=u<=1?u:2-u,[t,100*(0===r?2*o/(u+o):2*n/(r+n)),100*((r+n)/2)]},r.hsv.rgb=function(e){var t=e[0]/60,n=e[1]/100,r=e[2]/100,o=Math.floor(t)%6,u=t-Math.floor(t),i=255*r*(1-n),a=255*r*(1-n*u),s=255*r*(1-n*(1-u));switch(r*=255,o){case 0:return[r,s,i];case 1:return[a,r,i];case 2:return[i,r,s];case 3:return[i,a,r];case 4:return[s,i,r];case 5:return[r,i,a]}},r.hsv.hsl=function(e){var t,n,r,o=e[0],u=e[1]/100,i=e[2]/100,a=Math.max(i,.01);return r=(2-u)*i,n=u*a,[o,100*(n=(n/=(t=(2-u)*a)<=1?t:2-t)||0),100*(r/=2)]},r.hwb.rgb=function(e){var t,n,r,o,u,i,a,s=e[0]/360,c=e[1]/100,l=e[2]/100,p=c+l;switch(p>1&&(c/=p,l/=p),r=6*s-(t=Math.floor(6*s)),0!=(1&t)&&(r=1-r),o=c+r*((n=1-l)-c),t){default:case 6:case 0:u=n,i=o,a=c;break;case 1:u=o,i=n,a=c;break;case 2:u=c,i=n,a=o;break;case 3:u=c,i=o,a=n;break;case 4:u=o,i=c,a=n;break;case 5:u=n,i=c,a=o}return[255*u,255*i,255*a]},r.cmyk.rgb=function(e){var t=e[0]/100,n=e[1]/100,r=e[2]/100,o=e[3]/100;return[255*(1-Math.min(1,t*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o)),255*(1-Math.min(1,r*(1-o)+o))]},r.xyz.rgb=function(e){var t,n,r,o=e[0]/100,u=e[1]/100,i=e[2]/100;return n=-.9689*o+1.8758*u+.0415*i,r=.0557*o+-.204*u+1.057*i,t=(t=3.2406*o+-1.5372*u+-.4986*i)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,[255*(t=Math.min(Math.max(0,t),1)),255*(n=Math.min(Math.max(0,n),1)),255*(r=Math.min(Math.max(0,r),1))]},r.xyz.lab=function(e){var t=e[0],n=e[1],r=e[2];return n/=100,r/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(t-n),200*(n-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},r.lab.xyz=function(e){var t,n,r,o=e[0];t=e[1]/500+(n=(o+16)/116),r=n-e[2]/200;var u=Math.pow(n,3),i=Math.pow(t,3),a=Math.pow(r,3);return n=u>.008856?u:(n-16/116)/7.787,t=i>.008856?i:(t-16/116)/7.787,r=a>.008856?a:(r-16/116)/7.787,[t*=95.047,n*=100,r*=108.883]},r.lab.lch=function(e){var t,n=e[0],r=e[1],o=e[2];return(t=360*Math.atan2(o,r)/2/Math.PI)<0&&(t+=360),[n,Math.sqrt(r*r+o*o),t]},r.lch.lab=function(e){var t,n=e[0],r=e[1];return t=e[2]/360*2*Math.PI,[n,r*Math.cos(t),r*Math.sin(t)]},r.rgb.ansi16=function(e){var t=e[0],n=e[1],o=e[2],u=1 in arguments?arguments[1]:r.rgb.hsv(e)[2];if(0===(u=Math.round(u/50)))return 30;var i=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(t/255));return 2===u&&(i+=60),i},r.hsv.ansi16=function(e){return r.rgb.ansi16(r.hsv.rgb(e),e[2])},r.rgb.ansi256=function(e){var t=e[0],n=e[1],r=e[2];return t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},r.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},r.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var n;return e-=16,[Math.floor(e/36)/5*255,Math.floor((n=e%36)/6)/5*255,n%6/5*255]},r.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},r.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var n=t[0];3===t[0].length&&(n=n.split("").map((function(e){return e+e})).join(""));var r=parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},r.rgb.hcg=function(e){var t,n=e[0]/255,r=e[1]/255,o=e[2]/255,u=Math.max(Math.max(n,r),o),i=Math.min(Math.min(n,r),o),a=u-i;return t=a<=0?0:u===n?(r-o)/a%6:u===r?2+(o-n)/a:4+(n-r)/a+4,t/=6,[360*(t%=1),100*a,100*(a<1?i/(1-a):0)]},r.hsl.hcg=function(e){var t=e[1]/100,n=e[2]/100,r=1,o=0;return(r=n<.5?2*t*n:2*t*(1-n))<1&&(o=(n-.5*r)/(1-r)),[e[0],100*r,100*o]},r.hsv.hcg=function(e){var t=e[1]/100,n=e[2]/100,r=t*n,o=0;return r<1&&(o=(n-r)/(1-r)),[e[0],100*r,100*o]},r.hcg.rgb=function(e){var t=e[0]/360,n=e[1]/100,r=e[2]/100;if(0===n)return[255*r,255*r,255*r];var o,u=[0,0,0],i=t%1*6,a=i%1,s=1-a;switch(Math.floor(i)){case 0:u[0]=1,u[1]=a,u[2]=0;break;case 1:u[0]=s,u[1]=1,u[2]=0;break;case 2:u[0]=0,u[1]=1,u[2]=a;break;case 3:u[0]=0,u[1]=s,u[2]=1;break;case 4:u[0]=a,u[1]=0,u[2]=1;break;default:u[0]=1,u[1]=0,u[2]=s}return o=(1-n)*r,[255*(n*u[0]+o),255*(n*u[1]+o),255*(n*u[2]+o)]},r.hcg.hsv=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t),r=0;return n>0&&(r=t/n),[e[0],100*r,100*n]},r.hcg.hsl=function(e){var t=e[1]/100,n=e[2]/100*(1-t)+.5*t,r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],100*r,100*n]},r.hcg.hwb=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},r.hwb.hcg=function(e){var t=e[1]/100,n=1-e[2]/100,r=n-t,o=0;return r<1&&(o=(n-r)/(1-r)),[e[0],100*r,100*o]},r.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},r.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},r.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},r.gray.hsl=r.gray.hsv=function(e){return[0,0,e[0]]},r.gray.hwb=function(e){return[0,100,e[0]]},r.gray.cmyk=function(e){return[0,0,0,e[0]]},r.gray.lab=function(e){return[e[0],0,0]},r.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},r.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}}));function mi(e){var t=function(){for(var e={},t=Object.keys(hi),n=t.length,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}(),n=[e];for(t[e].distance=0;n.length;)for(var r=n.pop(),o=Object.keys(hi[r]),u=o.length,i=0;i<u;i++){var a=o[i],s=t[a];-1===s.distance&&(s.distance=t[r].distance+1,s.parent=r,n.unshift(a))}return t}function gi(e,t){return function(n){return t(e(n))}}function Di(e,t){for(var n=[t[e].parent,e],r=hi[t[e].parent][e],o=t[e].parent;t[o].parent;)n.unshift(t[o].parent),r=gi(hi[t[o].parent][o],r),o=t[o].parent;return r.conversion=n,r}var yi={};Object.keys(hi).forEach((function(e){yi[e]={},Object.defineProperty(yi[e],"channels",{value:hi[e].channels}),Object.defineProperty(yi[e],"labels",{value:hi[e].labels});var t=function(e){for(var t=mi(e),n={},r=Object.keys(t),o=r.length,u=0;u<o;u++){var i=r[u];null!==t[i].parent&&(n[i]=Di(i,t))}return n}(e);Object.keys(t).forEach((function(n){var r=t[n];yi[e][n]=function(e){var t=function(t){if(null==t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var n=e(t);if("object"==typeof n)for(var r=n.length,o=0;o<r;o++)n[o]=Math.round(n[o]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}(r),yi[e][n].raw=function(e){var t=function(t){return null==t?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(r)}))}));var Ei=yi,Ci=je((function(e){const t=(e,t)=>function(){const n=e.apply(Ei,arguments);return"\x1b[".concat(n+t,"m")},n=(e,t)=>function(){const n=e.apply(Ei,arguments);return"\x1b[".concat(38+t,";5;").concat(n,"m")},r=(e,t)=>function(){const n=e.apply(Ei,arguments);return"\x1b[".concat(38+t,";2;").concat(n[0],";").concat(n[1],";").concat(n[2],"m")};Object.defineProperty(e,"exports",{enumerable:!0,get:function(){const e=new Map,o={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};o.color.grey=o.color.gray;for(const t of Object.keys(o)){const n=o[t];for(const t of Object.keys(n)){const r=n[t];o[t]={open:"\x1b[".concat(r[0],"m"),close:"\x1b[".concat(r[1],"m")},n[t]=o[t],e.set(r[0],r[1])}Object.defineProperty(o,t,{value:n,enumerable:!1}),Object.defineProperty(o,"codes",{value:e,enumerable:!1})}const u=e=>e,i=(e,t,n)=>[e,t,n];o.color.close="\x1b[39m",o.bgColor.close="\x1b[49m",o.color.ansi={ansi:t(u,0)},o.color.ansi256={ansi256:n(u,0)},o.color.ansi16m={rgb:r(i,0)},o.bgColor.ansi={ansi:t(u,10)},o.bgColor.ansi256={ansi256:n(u,10)},o.bgColor.ansi16m={rgb:r(i,10)};for(let e of Object.keys(Ei)){if("object"!=typeof Ei[e])continue;const u=Ei[e];"ansi16"===e&&(e="ansi"),"ansi16"in u&&(o.color.ansi[e]=t(u.ansi16,0),o.bgColor.ansi[e]=t(u.ansi16,10)),"ansi256"in u&&(o.color.ansi256[e]=n(u.ansi256,0),o.bgColor.ansi256[e]=n(u.ansi256,10)),"rgb"in u&&(o.color.ansi16m[e]=r(u.rgb,0),o.bgColor.ansi16m[e]=r(u.rgb,10))}return o}})}));const bi=Oe.env;let vi;function Ai(e){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(function(e){if(!1===vi)return 0;if($r("color=16m")||$r("color=full")||$r("color=truecolor"))return 3;if($r("color=256"))return 2;if(e&&!e.isTTY&&!0!==vi)return 0;const t=vi?1:0;if("win32"===Oe.platform){const e=qr.release().split(".");return Number(Oe.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in bi)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in bi))||"codeship"===bi.CI_NAME?1:t;if("TEAMCITY_VERSION"in bi)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(bi.TEAMCITY_VERSION)?1:0;if("truecolor"===bi.COLORTERM)return 3;if("TERM_PROGRAM"in bi){const e=parseInt((bi.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(bi.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(bi.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(bi.TERM)||"COLORTERM"in bi?1:(bi.TERM,t)}(e))}$r("no-color")||$r("no-colors")||$r("color=false")?vi=!1:($r("color")||$r("colors")||$r("color=true")||$r("color=always"))&&(vi=!0),"FORCE_COLOR"in bi&&(vi=0===bi.FORCE_COLOR.length||0!==parseInt(bi.FORCE_COLOR,10));var Fi={supportsColor:Ai,stdout:Ai(Oe.stdout),stderr:Ai(Oe.stderr)};const xi=/(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Si=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,wi=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Ti=/\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi,Bi=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1b"],["a","\x07"]]);function Ni(e){return"u"===e[0]&&5===e.length||"x"===e[0]&&3===e.length?String.fromCharCode(parseInt(e.slice(1),16)):Bi.get(e)||e}function ki(e,t){const n=[],r=t.trim().split(/\s*,\s*/g);let o;for(const t of r)if(isNaN(t)){if(!(o=t.match(wi)))throw new Error("Invalid Chalk template style argument: ".concat(t," (in style '").concat(e,"')"));n.push(o[2].replace(Ti,((e,t,n)=>t?Ni(t):n)))}else n.push(Number(t));return n}function Pi(e){Si.lastIndex=0;const t=[];let n;for(;null!==(n=Si.exec(e));){const e=n[1];if(n[2]){const r=ki(e,n[2]);t.push([e].concat(r))}else t.push([e])}return t}function Oi(e,t){const n={};for(const e of t)for(const t of e.styles)n[t[0]]=e.inverse?null:t.slice(1);let r=e;for(const e of Object.keys(n))if(Array.isArray(n[e])){if(!(e in r))throw new Error("Unknown Chalk style: ".concat(e));r=n[e].length>0?r[e].apply(r,n[e]):r[e]}return r}var Ii=(e,t)=>{const n=[],r=[];let o=[];if(t.replace(xi,((t,u,i,a,s,c)=>{if(u)o.push(Ni(u));else if(a){const t=o.join("");o=[],r.push(0===n.length?t:Oi(e,n)(t)),n.push({inverse:i,styles:Pi(a)})}else if(s){if(0===n.length)throw new Error("Found extraneous } in Chalk template literal");r.push(Oi(e,n)(o.join(""))),o=[],n.pop()}else o.push(c)})),r.push(o.join("")),n.length>0){const e="Chalk template literal is missing ".concat(n.length," closing bracket").concat(1===n.length?"":"s"," (`}`)");throw new Error(e)}return r.join("")},Li=je((function(e){const t=Fi.stdout,n="win32"===Oe.platform&&!(Oe.env.TERM||"").toLowerCase().startsWith("xterm"),r=["ansi","ansi","ansi256","ansi16m"],o=new Set(["gray"]),u=Object.create(null);function i(e,n){n=n||{};const r=t?t.level:0;e.level=void 0===n.level?r:n.level,e.enabled="enabled"in n?n.enabled:e.level>0}function a(e){if(!this||!(this instanceof a)||this.template){const t={};return i(t,e),t.template=function(){const e=[].slice.call(arguments);return p.apply(null,[t.template].concat(e))},Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=a,t.template}i(this,e)}n&&(Ci.blue.open="\x1b[94m");for(const e of Object.keys(Ci))Ci[e].closeRe=new RegExp(di(Ci[e].close),"g"),u[e]={get(){const t=Ci[e];return c.call(this,this._styles?this._styles.concat(t):[t],this._empty,e)}};u.visible={get(){return c.call(this,this._styles||[],!0,"visible")}},Ci.color.closeRe=new RegExp(di(Ci.color.close),"g");for(const e of Object.keys(Ci.color.ansi))o.has(e)||(u[e]={get(){const t=this.level;return function(){const n=Ci.color[r[t]][e].apply(null,arguments),o={open:n,close:Ci.color.close,closeRe:Ci.color.closeRe};return c.call(this,this._styles?this._styles.concat(o):[o],this._empty,e)}}});Ci.bgColor.closeRe=new RegExp(di(Ci.bgColor.close),"g");for(const e of Object.keys(Ci.bgColor.ansi)){if(o.has(e))continue;u["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const t=this.level;return function(){const n=Ci.bgColor[r[t]][e].apply(null,arguments),o={open:n,close:Ci.bgColor.close,closeRe:Ci.bgColor.closeRe};return c.call(this,this._styles?this._styles.concat(o):[o],this._empty,e)}}}}const s=Object.defineProperties((()=>{}),u);function c(e,t,n){const r=function(){return l.apply(r,arguments)};r._styles=e,r._empty=t;const o=this;return Object.defineProperty(r,"level",{enumerable:!0,get:()=>o.level,set(e){o.level=e}}),Object.defineProperty(r,"enabled",{enumerable:!0,get:()=>o.enabled,set(e){o.enabled=e}}),r.hasGrey=this.hasGrey||"gray"===n||"grey"===n,r.__proto__=s,r}function l(){const e=arguments,t=e.length;let r=String(arguments[0]);if(0===t)return"";if(t>1)for(let n=1;n<t;n++)r+=" "+e[n];if(!this.enabled||this.level<=0||!r)return this._empty?"":r;const o=Ci.dim.open;n&&this.hasGrey&&(Ci.dim.open="");for(const e of this._styles.slice().reverse())r=e.open+r.replace(e.closeRe,e.open)+e.close,r=r.replace(/\r?\n/g,"".concat(e.close,"$&").concat(e.open));return Ci.dim.open=o,r}function p(e,t){if(!Array.isArray(t))return[].slice.call(arguments,1).join(" ");const n=[].slice.call(arguments,2),r=[t.raw[0]];for(let e=1;e<t.length;e++)r.push(String(n[e-1]).replace(/[{}\\]/g,"\\$&")),r.push(String(t.raw[e]));return Ii(e,r.join(""))}Object.defineProperties(a.prototype,u),e.exports=a(),e.exports.supportsColor=t,e.exports.default=e.exports})),Mi=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.shouldHighlight=c,t.getChalk=l,t.default=function(e,t={}){if(c(t)){const n=l(t);return function(e,t){return t.replace(r.default,(function(...t){const n=function(e){const[t,n]=e.slice(-2),o=(0,r.matchToToken)(e);if("name"===o.type){if((0,li.isKeyword)(o.value)||(0,li.isReservedWord)(o.value))return"keyword";if(a.test(o.value)&&("<"===n[t-1]||"</"==n.substr(t-2,2)))return"jsx_tag";if(o.value[0]!==o.value[0].toLowerCase())return"capitalized"}if("punctuator"===o.type&&s.test(o.value))return"bracket";if("invalid"===o.type&&("@"===o.value||"#"===o.value))return"punctuator";return o.type}(t),o=e[n];return o?t[0].split(i).map((e=>o(e))).join("\n"):t[0]}))}(function(e){return{keyword:e.cyan,capitalized:e.yellow,jsx_tag:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.grey,invalid:e.white.bgRed.bold}}(n),e)}return e};var n,r=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=r?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=e[o]}n.default=e,t&&t.set(e,n);return n}(ai),o=(n=Li)&&n.__esModule?n:{default:n};function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}const i=/\r\n|[\n\r\u2028\u2029]/,a=/^[a-z][\w-]*$/i,s=/^[()[\]{}]$/;function c(e){return o.default.supportsColor||e.forceColor}function l(e){let t=o.default;return e.forceColor&&(t=new o.default.constructor({enabled:!0,level:1})),t}})),ji=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.codeFrameColumns=i,t.default=function(e,t,n,r={}){if(!o){o=!0;const e="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";if(Oe.emitWarning)Oe.emitWarning(e,"DeprecationWarning");else{new Error(e).name="DeprecationWarning",console.warn(new Error(e))}}n=Math.max(n,0);return i(e,{start:{column:n,line:t}},r)};var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=r();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)){var i=o?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u]}n.default=e,t&&t.set(e,n);return n}(Mi);function r(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return r=function(){return e},e}let o=!1;const u=/\r\n|[\n\r\u2028\u2029]/;function i(e,t,r={}){const o=(r.highlightCode||r.forceColor)&&(0,n.shouldHighlight)(r),i=(0,n.getChalk)(r),a=function(e){return{gutter:e.grey,marker:e.red.bold,message:e.red.bold}}(i),s=(e,t)=>o?e(t):t,c=e.split(u),{start:l,end:p,markerLines:d}=function(e,t,n){const r=Object.assign({column:0,line:-1},e.start),o=Object.assign({},r,e.end),{linesAbove:u=2,linesBelow:i=3}=n||{},a=r.line,s=r.column,c=o.line,l=o.column;let p=Math.max(a-(u+1),0),d=Math.min(t.length,c+i);-1===a&&(p=0),-1===c&&(d=t.length);const f=c-a,h={};if(f)for(let e=0;e<=f;e++){const n=e+a;if(s)if(0===e){const e=t[n-1].length;h[n]=[s,e-s+1]}else if(e===f)h[n]=[0,l];else{const r=t[n-e].length;h[n]=[0,r]}else h[n]=!0}else h[a]=s===l?!s||[s,0]:[s,l-s];return{start:p,end:d,markerLines:h}}(t,c,r),f=t.start&&"number"==typeof t.start.column,h=String(p).length;let m=(o?(0,n.default)(e,r):e).split(u).slice(l,p).map(((e,t)=>{const n=l+1+t,o=" ".concat(n).slice(-h),u=" ".concat(o," | "),i=d[n],c=!d[n+1];if(i){let t="";if(Array.isArray(i)){const n=e.slice(0,Math.max(i[0]-1,0)).replace(/[^\t]/g," "),o=i[1]||1;t=["\n ",s(a.gutter,u.replace(/\d/g," ")),n,s(a.marker,"^").repeat(o)].join(""),c&&r.message&&(t+=" "+s(a.message,r.message))}return[s(a.marker,">"),s(a.gutter,u),e,t].join("")}return" ".concat(s(a.gutter,u)).concat(e)})).join("\n");return r.message&&!f&&(m="".concat(" ".repeat(h+1)).concat(r.message,"\n").concat(m)),o?i.reset(m):m}})),_i=_e(yn);const{ConfigError:Ri}=vr,{locStart:Vi,locEnd:$i}=ii,qi=Object.getOwnPropertyNames,Wi=Object.getOwnPropertyDescriptor;function Ui(e){const t={};for(const n of e.plugins)if(n.parsers)for(const e of qi(n.parsers))Object.defineProperty(t,e,Wi(n.parsers,e));return t}function Ji(e,t){if(t=t||Ui(e),"function"==typeof e.parser)return{parse:e.parser,astFormat:"estree",locStart:Vi,locEnd:$i};if("string"==typeof e.parser){if(Object.prototype.hasOwnProperty.call(t,e.parser))return t[e.parser];throw new Ri("Couldn't resolve parser \"".concat(e.parser,'". Parsers must be explicitly added to the standalone bundle.'))}}var zi={parse:function(e,t){const n=Ui(t),r=Object.keys(n).reduce(((e,t)=>Object.defineProperty(e,t,{enumerable:!0,get:()=>n[t].parse})),{}),o=Ji(t,n);try{return o.preprocess&&(e=o.preprocess(e,t)),{text:e,ast:o.parse(e,r,t)}}catch(t){const{loc:n}=t;if(n){const{codeFrameColumns:r}=ji;throw t.codeFrame=r(e,n,{highlightCode:!0}),t.message+="\n"+t.codeFrame,t}throw t.stack}},resolveParser:Ji};const{UndefinedParserError:Hi}=vr,{getSupportInfo:Gi}=gt,{resolveParser:Xi}=zi,Yi={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};function Ki(e,t){const n=_i.basename(e).toLowerCase(),r=Gi({plugins:t}).languages.filter((e=>null!==e.since));let o=r.find((e=>e.extensions&&e.extensions.some((e=>n.endsWith(e)))||e.filenames&&e.filenames.some((e=>e.toLowerCase()===n))));if(!o&&!n.includes(".")){const t=function(e){if("string"!=typeof e)return"";let t;try{t=gr.openSync(e,"r")}catch(e){return""}try{const e=new Dr(t).next().toString("utf8"),n=e.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/);if(n)return n[1];const r=e.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/);return r?r[1]:""}catch(e){return""}finally{try{gr.closeSync(t)}catch(e){}}}(e);o=r.find((e=>e.interpreters&&e.interpreters.includes(t)))}return o&&o.parsers[0]}var Qi={normalize:function(e,t){t=t||{};const n=Object.assign({},e),r=Gi({plugins:e.plugins,showUnreleased:!0,showDeprecated:!0}).options,o=Object.assign({},Yi,yr(r.filter((e=>void 0!==e.default)).map((e=>[e.name,e.default]))));if(!n.parser)if(n.filepath){if(n.parser=Ki(n.filepath,n.plugins),!n.parser)throw new Hi("No parser could be inferred for file: ".concat(n.filepath))}else{(t.logger||console).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."),n.parser="babel"}const u=Xi(ni.normalizeApiOptions(n,[r.find((e=>"parser"===e.name))],{passThrough:!0,logger:!1}));n.astFormat=u.astFormat,n.locEnd=u.locEnd,n.locStart=u.locStart;const i=function(e){const{astFormat:t}=e;if(!t)throw new Error("getPlugin() requires astFormat to be set");const n=e.plugins.find((e=>e.printers&&e.printers[t]));if(!n)throw new Error("Couldn't find plugin for AST format \"".concat(t,'"'));return n}(n);n.printer=i.printers[n.astFormat];const a=r.filter((e=>e.pluginDefaults&&void 0!==e.pluginDefaults[i.name])).reduce(((e,t)=>Object.assign(e,{[t.name]:t.pluginDefaults[i.name]})),{}),s=Object.assign({},o,a);return Object.keys(s).forEach((e=>{null==n[e]&&(n[e]=s[e])})),"json"===n.parser&&(n.trailingComma="none"),ni.normalizeApiOptions(n,r,Object.assign({passThrough:Object.keys(Yi)},t))},hiddenDefaults:Yi,inferParser:Ki};var Zi=function e(t,n,r){if(Array.isArray(t))return t.map((t=>e(t,n,r))).filter(Boolean);if(!t||"object"!=typeof t)return t;const o=n.printer.massageAstNode;let u;u=o&&o.ignoredProperties?o.ignoredProperties:new Set;const i={};for(const r of Object.keys(t))u.has(r)||"function"==typeof t[r]||(i[r]=e(t[r],n,t));if(o){const e=o(t,i,r);if(null===e)return;if(e)return e}return i};function ea(){}ea.ok=function(){},ea.strictEqual=function(){};var ta=_e(Object.freeze({__proto__:null,default:ea}));const{builders:{concat:na,line:ra,hardline:oa,breakParent:ua,indent:ia,lineSuffix:aa,join:sa,cursor:ca}}=cn,{hasNewline:la,skipNewline:pa,skipSpaces:da,isPreviousLineEmpty:fa,addLeadingComment:ha,addDanglingComment:ma,addTrailingComment:ga}=Lt,Da=Symbol("child-nodes");function ya(e,t,n){if(!e)return;const{printer:r,locStart:o,locEnd:u}=t;if(n){if(r.canAttachComment&&r.canAttachComment(e)){let t;for(t=n.length-1;t>=0&&!(o(n[t])<=o(e)&&u(n[t])<=u(e));--t);return void n.splice(t+1,0,e)}}else if(e[Da])return e[Da];const i=r.getCommentChildNodes&&r.getCommentChildNodes(e,t)||"object"==typeof e&&Object.keys(e).filter((e=>"enclosingNode"!==e&&"precedingNode"!==e&&"followingNode"!==e&&"tokens"!==e&&"comments"!==e)).map((t=>e[t]));return i?(n||Object.defineProperty(e,Da,{value:n=[],enumerable:!1}),i.forEach((e=>{ya(e,t,n)})),n):void 0}function Ea(e,t,n){const{locStart:r,locEnd:o}=n,u=r(t),i=o(t),a=ya(e,n);let s,c,l=0,p=a.length;for(;l<p;){const e=l+p>>1,d=a[e],f=r(d),h=o(d);if(f<=u&&i<=h)return t.enclosingNode=d,void Ea(d,t,n);if(f<=u)s=d,l=e+1;else{if(!(i<=f))throw new Error("Comment location overlaps with node location");c=d,p=e}}if(t.enclosingNode&&"TemplateLiteral"===t.enclosingNode.type){const{quasis:e}=t.enclosingNode,r=va(e,t,n);s&&va(e,s,n)!==r&&(s=null),c&&va(e,c,n)!==r&&(c=null)}s&&(t.precedingNode=s),c&&(t.followingNode=c)}function Ca(e,t,n){const r=e.length;if(0===r)return;const{precedingNode:o,followingNode:u,enclosingNode:i}=e[0],a=n.printer.getGapRegex&&n.printer.getGapRegex(i)||/^[\s(]*$/;let s,c=n.locStart(u);for(s=r;s>0;--s){const r=e[s-1];ta.strictEqual(r.precedingNode,o),ta.strictEqual(r.followingNode,u);const i=t.slice(n.locEnd(r),c);if(!a.test(i))break;c=n.locStart(r)}e.forEach(((e,t)=>{t<s?ga(o,e):ha(u,e)}));for(const e of[o,u])e.comments&&e.comments.length>1&&e.comments.sort(((e,t)=>n.locStart(e)-n.locStart(t)));e.length=0}function ba(e,t){return e.getValue().printed=!0,t.printer.printComment(e,t)}function va(e,t,n){const r=n.locStart(t)-1;for(let t=1;t<e.length;++t)if(r<n.locStart(e[t]))return t-1;return 0}function Aa(e,t,n){return e.getNode()===t.cursorNode&&e.getValue()?na([ca,n,ca]):n}var Fa={attach:function(e,t,n,r){if(!Array.isArray(e))return;const o=[],{locStart:u,locEnd:i}=r;e.forEach(((a,s)=>{if("json"===r.parser||"json5"===r.parser||"__js_expression"===r.parser||"__vue_expression"===r.parser){if(u(a)-u(t)<=0)return void ha(t,a);if(i(a)-i(t)>=0)return void ga(t,a)}Ea(t,a,r);const{precedingNode:c,enclosingNode:l,followingNode:p}=a,d=r.printer.handleComments&&r.printer.handleComments.ownLine?r.printer.handleComments.ownLine:()=>!1,f=r.printer.handleComments&&r.printer.handleComments.endOfLine?r.printer.handleComments.endOfLine:()=>!1,h=r.printer.handleComments&&r.printer.handleComments.remaining?r.printer.handleComments.remaining:()=>!1,m=e.length-1===s;if(la(n,u(a),{backwards:!0}))d(a,n,r,t,m)||(p?ha(p,a):c?ga(c,a):ma(l||t,a));else if(la(n,i(a)))f(a,n,r,t,m)||(c?ga(c,a):p?ha(p,a):ma(l||t,a));else if(h(a,n,r,t,m));else if(c&&p){const e=o.length;if(e>0){o[e-1].followingNode!==a.followingNode&&Ca(o,n,r)}o.push(a)}else c?ga(c,a):p?ha(p,a):ma(l||t,a)})),Ca(o,n,r),e.forEach((e=>{delete e.precedingNode,delete e.enclosingNode,delete e.followingNode}))},printComments:function(e,t,n,r){const o=e.getValue(),u=t(e),i=o&&o.comments;if(!i||0===i.length)return Aa(e,n,u);const a=[],s=[r?";":"",u];return e.each((e=>{const t=e.getValue(),{leading:r,trailing:o}=t;if(r){const r=function(e,t){const n=e.getValue(),r=ba(e,t);if(!r)return"";if(t.printer.isBlockComment&&t.printer.isBlockComment(n)){const e=la(t.originalText,t.locEnd(n))?la(t.originalText,t.locStart(n),{backwards:!0})?oa:ra:" ";return na([r,e])}return na([r,oa])}(e,n);if(!r)return;a.push(r);const o=n.originalText,u=pa(o,da(o,n.locEnd(t)));!1!==u&&la(o,u)&&a.push(oa)}else o&&s.push(function(e,t){const n=e.getValue(),r=ba(e,t);if(!r)return"";const{printer:o,originalText:u,locStart:i}=t,a=o.isBlockComment&&o.isBlockComment(n);if(la(u,i(n),{backwards:!0})){const e=fa(u,n,i);return aa(na([oa,e?oa:"",r]))}let s=na([" ",r]);return a||(s=na([aa(s),ua])),s}(e,n))}),"comments"),Aa(e,n,na(a.concat(s)))},printDanglingComments:function(e,t,n,r){const o=[],u=e.getValue();return u&&u.comments?(e.each((e=>{const n=e.getValue();!n||n.leading||n.trailing||r&&!r(n)||o.push(ba(e,t))}),"comments"),0===o.length?"":n?sa(oa,o):ia(na([oa,sa(oa,o)]))):""},getSortedChildNodes:ya,ensureAllCommentsPrinted:function(e){e&&e.forEach((e=>{if(!e.printed)throw new Error('Comment "'+e.value.trim()+'" was not printed. Please report this error!');delete e.printed}))}};function xa(e,t){const n=Sa(e.stack,t);return-1===n?null:e.stack[n]}function Sa(e,t){for(let n=e.length-1;n>=0;n-=2){const r=e[n];if(r&&!Array.isArray(r)&&--t<0)return n}return-1}var wa=class{constructor(e){this.stack=[e]}getName(){const{stack:e}=this,{length:t}=e;return t>1?e[t-2]:null}getValue(){return se(this.stack)}getNode(e=0){return xa(this,e)}getParentNode(e=0){return xa(this,e+1)}call(e,...t){const{stack:n}=this,{length:r}=n;let o=se(n);for(const e of t)o=o[e],n.push(e,o);const u=e(this);return n.length=r,u}callParent(e,t=0){const n=Sa(this.stack,t+1),r=this.stack.splice(n+1),o=e(this);return this.stack.push(...r),o}each(e,...t){const{stack:n}=this,{length:r}=n;let o=se(n);for(const e of t)o=o[e],n.push(e,o);for(let t=0;t<o.length;++t)n.push(t,o[t]),e(this,t),n.length-=2;n.length=r}map(e,...t){const n=[];return this.each(((t,r)=>{n[r]=e(t,r)}),...t),n}match(...e){let t=this.stack.length-1,n=null,r=this.stack[t--];for(const o of e){if(void 0===r)return!1;let e=null;if("number"==typeof n&&(e=n,n=this.stack[t--],r=this.stack[t--]),o&&!o(r,n,e))return!1;n=this.stack[t--],r=this.stack[t--]}return!0}};const{utils:{stripTrailingHardline:Ta}}=cn,{normalize:Ba}=Qi;var Na={printSubtree:function(e,t,n,r){if(n.printer.embed&&"auto"===n.embeddedLanguageFormatting)return n.printer.embed(e,t,((e,t,o)=>function(e,t,n,r,{stripTrailingHardline:o=!1}={}){const u=Ba(Object.assign({},n,t,{parentParser:n.parser,embeddedInHtml:!(!n.embeddedInHtml&&"html"!==n.parser&&"vue"!==n.parser&&"angular"!==n.parser&&"lwc"!==n.parser),originalText:e}),{passThrough:!0}),i=zi.parse(e,u),{ast:a}=i;e=i.text;const s=a.comments;delete a.comments,Fa.attach(s,a,e,u),u[Symbol.for("comments")]=s||[],u[Symbol.for("tokens")]=a.tokens||[];const c=r(a,u);if(Fa.ensureAllCommentsPrinted(s),o)return"string"==typeof c?c.replace(/(?:\r?\n)*$/,""):Ta(c,!0);return c}(e,t,n,r,o)),n)}};const ka=cn,Pa=ka.builders,{concat:Oa,hardline:Ia,addAlignmentToDoc:La}=Pa,Ma=ka.utils;function ja(e,t,n=0){const{printer:r}=t;r.preprocess&&(e=r.preprocess(e,t));const o=new Map;let u=function e(n,u){const i=n.getValue(),a=i&&"object"==typeof i&&void 0===u;if(a&&o.has(i))return o.get(i);let s;return s=r.willPrintOwnComments&&r.willPrintOwnComments(n,t)?_a(n,t,e,u):Fa.printComments(n,(n=>_a(n,t,e,u)),t,u&&u.needsSemi),a&&o.set(i,s),s}(new wa(e));return n>0&&(u=La(Oa([Ia,u]),n,t.tabWidth)),Ma.propagateBreaks(u),u}function _a(e,t,n,r){ta.ok(e instanceof wa);const o=e.getValue(),{printer:u}=t;if(u.hasPrettierIgnore&&u.hasPrettierIgnore(e))return function(e,t){const{originalText:n,[Symbol.for("comments")]:r,locStart:o,locEnd:u}=t,i=o(e),a=u(e);for(const e of r)o(e)>=i&&u(e)<=a&&(e.printed=!0);return n.slice(i,a)}(o,t);if(o)try{const r=Na.printSubtree(e,n,t,ja);if(r)return r}catch(e){if(Me.PRETTIER_DEBUG)throw e}return u.print(e,t,n,r)}var Ra=ja;function Va(e,t,n,r,o=[]){if(!(t<n.locStart(e)||t>n.locEnd(e))){for(const u of Fa.getSortedChildNodes(e,n)){const i=Va(u,t,n,r,[e,...o]);if(i)return i}return!r||r(e)?{node:e,parentNodes:o}:void 0}}const $a=new Set(["ObjectExpression","ArrayExpression","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral"]),qa=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefinition","EnumValueDefinition","InputValueDefinition","InputObjectTypeDefinition","SchemaDefinition","OperationTypeDefinition","InterfaceTypeDefinition","UnionTypeDefinition","ScalarTypeDefinition"]);function Wa(e,t){if(null==t)return!1;switch(e.parser){case"flow":case"babel":case"babel-flow":case"babel-ts":case"typescript":case"espree":case"meriyah":return function(e){return"Directive"===e||"TypeAlias"===e||"TSExportAssignment"===e||e.startsWith("Declare")||e.startsWith("TSDeclare")||e.endsWith("Statement")||e.endsWith("Declaration")}(t.type);case"json":return $a.has(t.type);case"graphql":return qa.has(t.kind);case"vue":return"root"!==t.tag}return!1}var Ua={calculateRange:function(e,t,n){const r=e.slice(t.rangeStart,t.rangeEnd),o=Math.max(t.rangeStart+r.search(/\S/),t.rangeStart);let u;for(u=t.rangeEnd;u>t.rangeStart&&!/\S/.test(e[u-1]);--u);const i=Va(n,o,t,(e=>Wa(t,e))),a=Va(n,u,t,(e=>Wa(t,e)));if(!i||!a)return{rangeStart:0,rangeEnd:0};const{startNode:s,endNode:c}=function(e,t,n){let r=e.node,o=t.node;if(r===o)return{startNode:r,endNode:o};for(const r of t.parentNodes){if(!("Program"!==r.type&&"File"!==r.type&&n.locStart(r)>=n.locStart(e.node)))break;o=r}for(const o of e.parentNodes){if(!("Program"!==o.type&&"File"!==o.type&&n.locEnd(o)<=n.locEnd(t.node)))break;r=o}return{startNode:r,endNode:o}}(i,a,t);return{rangeStart:Math.min(t.locStart(s),t.locStart(c)),rangeEnd:Math.max(t.locEnd(s),t.locEnd(c))}},findNodeAtOffset:Va};const{printer:{printDocToString:Ja},debug:{printDocToDebug:za}}=cn,{getAlignmentSize:Ha}=Lt,{guessEndOfLine:Ga,convertEndOfLineToChars:Xa,countEndOfLineChars:Ya,normalizeEndOfLine:Ka}=Mt,Qa=Qi.normalize,Za=Symbol("cursor");function es(e,t,n){const r=t.comments;return r&&(delete t.comments,Fa.attach(r,t,e,n)),n[Symbol.for("comments")]=r||[],n[Symbol.for("tokens")]=t.tokens||[],n.originalText=e,r}function ts(e,t,n){if(!e||!e.trim().length)return{formatted:"",cursorOffset:-1};n=n||0;const{ast:r,text:o}=zi.parse(e,t);if(t.cursorOffset>=0){const e=Ua.findNodeAtOffset(r,t.cursorOffset,t);e&&e.node&&(t.cursorNode=e.node)}const u=es(o,r,t),i=Ra(r,t,n),a=Ja(i,t);if(Fa.ensureAllCommentsPrinted(u),n>0){const e=a.formatted.trim();void 0!==a.cursorNodeStart&&(a.cursorNodeStart-=a.formatted.indexOf(e)),a.formatted=e+Xa(t.endOfLine)}if(t.cursorOffset>=0){let e,n,r,u,i;if(t.cursorNode&&a.cursorNodeText?(e=t.locStart(t.cursorNode),n=o.slice(e,t.locEnd(t.cursorNode)),r=t.cursorOffset-e,u=a.cursorNodeStart,i=a.cursorNodeText):(e=0,n=o,r=t.cursorOffset,u=0,i=a.formatted),n===i)return{formatted:a.formatted,cursorOffset:u+r};const s=n.split("");s.splice(r,0,Za);const c=i.split(""),l=J.diffArrays(s,c);let p=u;for(const e of l)if(e.removed){if(e.value.includes(Za))break}else p+=e.count;return{formatted:a.formatted,cursorOffset:p}}return{formatted:a.formatted,cursorOffset:-1}}function ns(e,t,n){return"number"!=typeof t||isNaN(t)||t<0||t>e.length?n:t}function rs(e,t){let{cursorOffset:n,rangeStart:r,rangeEnd:o}=t;return n=ns(e,n,-1),r=ns(e,r,0),o=ns(e,o,e.length),Object.assign({},t,{cursorOffset:n,rangeStart:r,rangeEnd:o})}function os(e,t){let{cursorOffset:n,rangeStart:r,rangeEnd:o,endOfLine:u}=rs(e,t);const i="\ufeff"===e.charAt(0);if(i&&(e=e.slice(1),n--,r--,o--),"auto"===u&&(u=Ga(e)),e.includes("\r")){const t=t=>Ya(e.slice(0,Math.max(t,0)),"\r\n");n-=t(n),r-=t(r),o-=t(o),e=Ka(e)}return{hasBOM:i,text:e,options:rs(e,Object.assign({},t,{cursorOffset:n,rangeStart:r,rangeEnd:o,endOfLine:u}))}}function us(e,t){let{hasBOM:n,text:r,options:o}=os(e,Qa(t));const u=zi.resolveParser(o),i=!u.hasPragma||u.hasPragma(r);if(o.requirePragma&&!i)return{formatted:e,cursorOffset:t.cursorOffset};let a;return o.rangeStart>0||o.rangeEnd<r.length?a=function(e,t){const{ast:n,text:r}=zi.parse(e,t),{rangeStart:o,rangeEnd:u}=Ua.calculateRange(r,t,n),i=r.slice(o,u),a=Math.min(o,r.lastIndexOf("\n",o)+1),s=r.slice(a,o).match(/^\s*/)[0],c=Ha(s,t.tabWidth),l=ts(i,Object.assign({},t,{rangeStart:0,rangeEnd:1/0,cursorOffset:t.cursorOffset>o&&t.cursorOffset<u?t.cursorOffset-o:-1,endOfLine:"lf"}),c),p=l.formatted.trimEnd();let{cursorOffset:d}=t;d>=u?d=t.cursorOffset+(p.length-i.length):l.cursorOffset>=0&&(d=l.cursorOffset+o);let f=r.slice(0,o)+p+r.slice(u);if("lf"!==t.endOfLine){const e=Xa(t.endOfLine);d>=0&&"\r\n"===e&&(d+=Ya(f.slice(0,d),"\n")),f=f.replace(/\n/g,e)}return{formatted:f,cursorOffset:d}}(r,o):(!i&&o.insertPragma&&o.printer.insertPragma&&(r=o.printer.insertPragma(r)),a=ts(r,o)),n&&(a.formatted="\ufeff"+a.formatted,a.cursorOffset>=0&&a.cursorOffset++),a}var is={formatWithCursor:us,parse(e,t,n){const{text:r,options:o}=os(e,Qa(t)),u=zi.parse(r,o);return n&&(u.ast=Zi(u.ast,o)),u},formatAST(e,t){t=Qa(t);const n=Ra(e,t);return Ja(n,t)},formatDoc:(e,t)=>us(za(e),Object.assign({},t,{parser:"babel"})).formatted,printToDoc(e,t){t=Qa(t);const{ast:n,text:r}=zi.parse(e,t);return es(r,n,t),Ra(n,t)},printDocToString:(e,t)=>Ja(e,Qa(t))};const{getMaxContinuousCount:as,getStringWidth:ss,getAlignmentSize:cs,getIndentSize:ls,skip:ps,skipWhitespace:ds,skipSpaces:fs,skipNewline:hs,skipToLineEnd:ms,skipEverythingButNewLine:gs,skipInlineComment:Ds,skipTrailingComment:ys,hasNewline:Es,hasNewlineInRange:Cs,hasSpaces:bs,isNextLineEmpty:vs,isNextLineEmptyAfterIndex:As,isPreviousLineEmpty:Fs,getNextNonSpaceNonCommentCharacterIndex:xs,makeString:Ss,addLeadingComment:ws,addDanglingComment:Ts,addTrailingComment:Bs}=Lt;var Ns={getMaxContinuousCount:as,getStringWidth:ss,getAlignmentSize:cs,getIndentSize:ls,skip:ps,skipWhitespace:ds,skipSpaces:fs,skipNewline:hs,skipToLineEnd:ms,skipEverythingButNewLine:gs,skipInlineComment:Ds,skipTrailingComment:ys,hasNewline:Es,hasNewlineInRange:Cs,hasSpaces:bs,isNextLineEmpty:vs,isNextLineEmptyAfterIndex:As,isPreviousLineEmpty:Fs,getNextNonSpaceNonCommentCharacterIndex:xs,makeString:Ss,addLeadingComment:ws,addDanglingComment:Ts,addTrailingComment:Bs},ks=function(t,n){const{languageId:r}=t,o=e(t,["languageId"]);return Object.assign({linguistLanguageId:r},o,n(t))},Ps=je((function(e){!function(){function t(e){if(null==e)return!1;switch(e.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function n(e){switch(e.type){case"IfStatement":return null!=e.alternate?e.alternate:e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}e.exports={isExpression:function(e){if(null==e)return!1;switch(e.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1},isStatement:t,isIterationStatement:function(e){if(null==e)return!1;switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1},isSourceElement:function(e){return t(e)||null!=e&&"FunctionDeclaration"===e.type},isProblematicIfStatement:function(e){var t;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;t=e.consequent;do{if("IfStatement"===t.type&&null==t.alternate)return!0;t=n(t)}while(t);return!1},trailingStatement:n}}()})),Os=je((function(e){!function(){var t,n,r,o,u,i;function a(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(Math.floor((e-65536)/1024)+55296)+String.fromCharCode((e-65536)%1024+56320)}for(n={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]/,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]/},t={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]/,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]/},r=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],o=new Array(128),i=0;i<128;++i)o[i]=i>=97&&i<=122||i>=65&&i<=90||36===i||95===i;for(u=new Array(128),i=0;i<128;++i)u[i]=i>=97&&i<=122||i>=65&&i<=90||i>=48&&i<=57||36===i||95===i;e.exports={isDecimalDigit:function(e){return 48<=e&&e<=57},isHexDigit:function(e){return 48<=e&&e<=57||97<=e&&e<=102||65<=e&&e<=70},isOctalDigit:function(e){return e>=48&&e<=55},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&r.indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStartES5:function(e){return e<128?o[e]:n.NonAsciiIdentifierStart.test(a(e))},isIdentifierPartES5:function(e){return e<128?u[e]:n.NonAsciiIdentifierPart.test(a(e))},isIdentifierStartES6:function(e){return e<128?o[e]:t.NonAsciiIdentifierStart.test(a(e))},isIdentifierPartES6:function(e){return e<128?u[e]:t.NonAsciiIdentifierPart.test(a(e))}}}()})),Is=je((function(e){!function(){var t=Os;function n(e,t){return!(!t&&"yield"===e)&&r(e,t)}function r(e,t){if(t&&function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function o(e,t){return"null"===e||"true"===e||"false"===e||n(e,t)}function u(e,t){return"null"===e||"true"===e||"false"===e||r(e,t)}function i(e){var n,r,o;if(0===e.length)return!1;if(o=e.charCodeAt(0),!t.isIdentifierStartES5(o))return!1;for(n=1,r=e.length;n<r;++n)if(o=e.charCodeAt(n),!t.isIdentifierPartES5(o))return!1;return!0}function a(e){var n,r,o,u,i;if(0===e.length)return!1;for(i=t.isIdentifierStartES6,n=0,r=e.length;n<r;++n){if(55296<=(o=e.charCodeAt(n))&&o<=56319){if(++n>=r)return!1;if(!(56320<=(u=e.charCodeAt(n))&&u<=57343))return!1;o=1024*(o-55296)+(u-56320)+65536}if(!i(o))return!1;i=t.isIdentifierPartES6}return!0}e.exports={isKeywordES5:n,isKeywordES6:r,isReservedWordES5:o,isReservedWordES6:u,isRestrictedWord:function(e){return"eval"===e||"arguments"===e},isIdentifierNameES5:i,isIdentifierNameES6:a,isIdentifierES5:function(e,t){return i(e)&&!o(e,t)},isIdentifierES6:function(e,t){return a(e)&&!u(e,t)}}}()}));const Ls=je((function(e,t){t.ast=Ps,t.code=Os,t.keyword=Is})).keyword.isIdentifierNameES5,{getLast:Ms,hasNewline:js,hasNewlineInRange:_s,skipWhitespace:Rs}=Lt,{locStart:Vs,locEnd:$s,hasSameLocStart:qs}=ii,Ws="(?:(?=.)\\s)",Us=new RegExp("^".concat(Ws,"*:")),Js=new RegExp("^".concat(Ws,"*::"));function zs(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e))return e.some((e=>zs(e,t)));const n=t(e);return"boolean"==typeof n?n:Object.keys(e).some((n=>zs(e[n],t)))}function Hs(e){return"AssignmentExpression"===e.type||"BinaryExpression"===e.type||"LogicalExpression"===e.type||"NGPipeExpression"===e.type||"ConditionalExpression"===e.type||"CallExpression"===e.type||"OptionalCallExpression"===e.type||"MemberExpression"===e.type||"OptionalMemberExpression"===e.type||"SequenceExpression"===e.type||"TaggedTemplateExpression"===e.type||"BindExpression"===e.type||"UpdateExpression"===e.type&&!e.prefix||"TSAsExpression"===e.type||"TSNonNullExpression"===e.type}function Gs(e){return"Block"===e.type||"CommentBlock"===e.type||"MultiLine"===e.type}const Xs=new Set(["ExportDefaultDeclaration","ExportDefaultSpecifier","DeclareExportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"]);function Ys(e){return e&&Xs.has(e.type)}function Ks(e){return"BooleanLiteral"===e.type||"DirectiveLiteral"===e.type||"Literal"===e.type||"NullLiteral"===e.type||"NumericLiteral"===e.type||"BigIntLiteral"===e.type||"DecimalLiteral"===e.type||"RegExpLiteral"===e.type||"StringLiteral"===e.type||"TemplateLiteral"===e.type||"TSTypeLiteral"===e.type||"JSXText"===e.type}function Qs(e){return"NumericLiteral"===e.type||"Literal"===e.type&&"number"==typeof e.value}function Zs(e){return"StringLiteral"===e.type||"Literal"===e.type&&"string"==typeof e.value}function ec(e){return"FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type}function tc(e){return!("CallExpression"!==e.type&&"OptionalCallExpression"!==e.type||"Identifier"!==e.callee.type||"async"!==e.callee.name&&"inject"!==e.callee.name&&"fakeAsync"!==e.callee.name)}function nc(e){return"JSXElement"===e.type||"JSXFragment"===e.type}function rc(e){return"get"===e.kind||"set"===e.kind}function oc(e){return rc(e)||qs(e,e.value)}const uc=new Set(["BinaryExpression","LogicalExpression","NGPipeExpression"]);const ic=new Set(["AnyTypeAnnotation","TSAnyKeyword","NullLiteralTypeAnnotation","TSNullKeyword","ThisTypeAnnotation","TSThisType","NumberTypeAnnotation","TSNumberKeyword","VoidTypeAnnotation","TSVoidKeyword","BooleanTypeAnnotation","TSBooleanKeyword","BigIntTypeAnnotation","TSBigIntKeyword","SymbolTypeAnnotation","TSSymbolKeyword","StringTypeAnnotation","TSStringKeyword","BooleanLiteralTypeAnnotation","StringLiteralTypeAnnotation","BigIntLiteralTypeAnnotation","NumberLiteralTypeAnnotation","TSLiteralType","TSTemplateLiteralType","EmptyTypeAnnotation","MixedTypeAnnotation","TSNeverKeyword","TSObjectKeyword","TSUndefinedKeyword","TSUnknownKeyword"]);const ac=/^(skip|[fx]?(it|describe|test))$/;function sc(e){return"CallExpression"===e.type||"OptionalCallExpression"===e.type}const cc=new RegExp("([ \n\r\t]+)"),lc=new RegExp("[^ \n\r\t]");function pc(e){return Ks(e)&&(lc.test(mc(e))||!/\n/.test(mc(e)))}function dc(e,t){if(nc(t))return xc(t);return t.comments&&t.comments.some((t=>t.leading&&js(e,$s(t))))}function fc(e){return/^(\d+|\d+\.\d+)$/.test(e)}function hc(e){return e.quasis.some((e=>e.value.raw.includes("\n")))}function mc(e){return e.extra?e.extra.raw:e.raw}const gc={"==":!0,"!=":!0,"===":!0,"!==":!0},Dc={"*":!0,"/":!0,"%":!0},yc={">>":!0,">>>":!0,"<<":!0};const Ec={};function Cc(e){return Ec[e]}[["|>"],["??"],["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"],["**"]].forEach(((e,t)=>{e.forEach((e=>{Ec[e]=t}))}));const bc=new WeakMap;function vc(e){if(bc.has(e))return bc.get(e);const t=[];return e.this&&t.push(e.this),Array.isArray(e.parameters)?t.push(...e.parameters):Array.isArray(e.params)&&t.push(...e.params),e.rest&&t.push(e.rest),bc.set(e,t),t}const Ac=new WeakMap;function Fc(e){return"prettier-ignore"===e.value.trim()}function xc(e){return e&&(e.comments&&e.comments.length>0&&e.comments.some((e=>Fc(e)&&!e.unignore))||e.prettierIgnore)}function Sc(e){return xc(e.getValue())}var wc={classChildNeedsASIProtection:function(e){if(e){if(e.static||e.accessibility)return!1;if(!e.computed){const t=e.key&&e.key.name;if("in"===t||"instanceof"===t)return!0}switch(e.type){case"ClassProperty":case"FieldDefinition":case"TSAbstractClassProperty":return e.computed;case"MethodDefinition":case"TSAbstractMethodDefinition":case"ClassMethod":case"ClassPrivateMethod":{const t=e.value?e.value.async:e.async,n=e.value?e.value.generator:e.generator;return!t&&"get"!==e.kind&&"set"!==e.kind&&!(!e.computed&&!n)}case"TSIndexSignature":return!0;default:return!1}}},classPropMayCauseASIProblems:function(e){const t=e.getNode();if("ClassProperty"!==t.type&&"FieldDefinition"!==t.type)return!1;const n=t.key&&t.key.name;return!("static"!==n&&"get"!==n&&"set"!==n||t.value||t.typeAnnotation)||void 0},getFunctionParameters:vc,iterateFunctionParametersPath:function(e,t){const n=e.getValue();let r=0;const o=e=>t(e,r++);n.this&&e.call(o,"this"),Array.isArray(n.parameters)?e.each(o,"parameters"):Array.isArray(n.params)&&e.each(o,"params"),n.rest&&e.call(o,"rest")},getCallArguments:function(e){if(Ac.has(e))return Ac.get(e);const t="ImportExpression"===e.type?[e.source]:e.arguments;return Ac.set(e,t),t},iterateCallArgumentsPath:function(e,t){"ImportExpression"===e.getValue().type?e.call((e=>t(e,0)),"source"):e.each(t,"arguments")},hasRestParameter:function(e){if(e.rest)return!0;const t=vc(e);return t.length>0&&"RestElement"===Ms(t).type},getLeftSidePathName:function(e,t){if(t.expressions)return["expressions",0];if(t.left)return["left"];if(t.test)return["test"];if(t.object)return["object"];if(t.callee)return["callee"];if(t.tag)return["tag"];if(t.argument)return["argument"];if(t.expression)return["expression"];throw new Error("Unexpected node has no left side.")},getParentExportDeclaration:function(e){const t=e.getParentNode();return"declaration"===e.getName()&&Ys(t)?t:null},getTypeScriptMappedTypeModifier:function(e,t){return"+"===e?"+"+t:"-"===e?"-"+t:t},hasDanglingComments:function(e){return e.comments&&e.comments.some((e=>!e.leading&&!e.trailing))},hasFlowAnnotationComment:function(e){return e&&Gs(e[0])&&Js.test(e[0].value)},hasFlowShorthandAnnotationComment:function(e){return e.extra&&e.extra.parenthesized&&e.trailingComments&&Gs(e.trailingComments[0])&&Us.test(e.trailingComments[0].value)},hasLeadingComment:function(e){return e.comments&&e.comments.some((e=>e.leading))},hasLeadingOwnLineComment:dc,hasNakedLeftSide:Hs,hasNewlineBetweenOrAfterDecorators:function(e,t){return _s(t.originalText,Vs(e.decorators[0]),$s(Ms(e.decorators)))||js(t.originalText,$s(Ms(e.decorators)))},hasNgSideEffect:function(e){return zs(e.getValue(),(e=>{switch(e.type){case void 0:return!1;case"CallExpression":case"OptionalCallExpression":case"AssignmentExpression":return!0}}))},hasNode:zs,hasPrettierIgnore:function(e){return Sc(e)||function(e){const t=e.getValue(),n=e.getParentNode();if(!(n&&t&&nc(t)&&nc(n)))return!1;let r=null;for(let e=n.children.indexOf(t);e>0;e--){const t=n.children[e-1];if("JSXText"!==t.type||pc(t)){r=t;break}}return r&&"JSXExpressionContainer"===r.type&&"JSXEmptyExpression"===r.expression.type&&r.expression.comments&&r.expression.comments.some((e=>Fc(e)))}(e)},hasTrailingComment:function(e){return e.comments&&e.comments.some((e=>e.trailing))},hasTrailingLineComment:function(e){return e.comments&&e.comments.some((e=>e.trailing&&!Gs(e)))},hasIgnoreComment:Sc,hasNodeIgnoreComment:xc,identity:function(e){return e},isBinaryish:function(e){return uc.has(e.type)},isBlockComment:Gs,isLineComment:function(e){return"Line"===e.type||"CommentLine"===e.type||"SingleLine"===e.type||"HashbangComment"===e.type||"HTMLOpen"===e.type||"HTMLClose"===e.type},isPrettierIgnoreComment:Fc,isCallOrOptionalCallExpression:sc,isEmptyJSXElement:function(e){if(0===e.children.length)return!0;if(e.children.length>1)return!1;const t=e.children[0];return Ks(t)&&!pc(t)},isExportDeclaration:Ys,isFlowAnnotationComment:function(e,t){const n=Vs(t),r=Rs(e,$s(t));return!1!==r&&"/*"===e.slice(n,n+2)&&"*/"===e.slice(r,r+2)},isFunctionCompositionArgs:function(e){if(e.length<=1)return!1;let t=0;for(const n of e)if(ec(n)){if(t+=1,t>1)return!0}else if(sc(n))for(const e of n.arguments)if(ec(e))return!0;return!1},isFunctionNotation:oc,isFunctionOrArrowExpression:ec,isGetterOrSetter:rc,isJestEachTemplateLiteral:function(e,t){const n=/^[fx]?(describe|it|test)$/;return"TaggedTemplateExpression"===t.type&&t.quasi===e&&"MemberExpression"===t.tag.type&&"Identifier"===t.tag.property.type&&"each"===t.tag.property.name&&("Identifier"===t.tag.object.type&&n.test(t.tag.object.name)||"MemberExpression"===t.tag.object.type&&"Identifier"===t.tag.object.property.type&&("only"===t.tag.object.property.name||"skip"===t.tag.object.property.name)&&"Identifier"===t.tag.object.object.type&&n.test(t.tag.object.object.name))},isJSXNode:nc,isJSXWhitespaceExpression:function(e){return"JSXExpressionContainer"===e.type&&Ks(e.expression)&&" "===e.expression.value&&!e.expression.comments},isLastStatement:function(e){const t=e.getParentNode();if(!t)return!0;const n=e.getValue(),r=(t.body||t.consequent).filter((e=>"EmptyStatement"!==e.type));return r[r.length-1]===n},isLiteral:Ks,isLongCurriedCallExpression:function(e){const t=e.getValue(),n=e.getParentNode();return sc(t)&&sc(n)&&n.callee===t&&t.arguments.length>n.arguments.length&&n.arguments.length>0},isSimpleCallArgument:function e(t,n){if(n>=2)return!1;const r=t=>e(t,n+1),o="Literal"===t.type&&"regex"in t&&t.regex.pattern||"RegExpLiteral"===t.type&&t.pattern;return!(o&&o.length>5)&&("Literal"===t.type||"BigIntLiteral"===t.type||"DecimalLiteral"===t.type||"BooleanLiteral"===t.type||"NullLiteral"===t.type||"NumericLiteral"===t.type||"RegExpLiteral"===t.type||"StringLiteral"===t.type||"Identifier"===t.type||"ThisExpression"===t.type||"Super"===t.type||"PrivateName"===t.type||"ArgumentPlaceholder"===t.type||"Import"===t.type||("TemplateLiteral"===t.type?t.expressions.every(r):"ObjectExpression"===t.type?t.properties.every((e=>!e.computed&&(e.shorthand||e.value&&r(e.value)))):"ArrayExpression"===t.type?t.elements.every((e=>null===e||r(e))):"ImportExpression"===t.type?r(t.source):"CallExpression"===t.type||"OptionalCallExpression"===t.type||"NewExpression"===t.type?e(t.callee,n)&&t.arguments.every(r):"MemberExpression"===t.type||"OptionalMemberExpression"===t.type?e(t.object,n)&&e(t.property,n):"UnaryExpression"!==t.type||"!"!==t.operator&&"-"!==t.operator?"TSNonNullExpression"===t.type&&e(t.expression,n):e(t.argument,n)))},isMeaningfulJSXText:pc,isMemberExpressionChain:function e(t){return("MemberExpression"===t.type||"OptionalMemberExpression"===t.type)&&("Identifier"===t.object.type||e(t.object))},isMemberish:function(e){return"MemberExpression"===e.type||"OptionalMemberExpression"===e.type||"BindExpression"===e.type&&Boolean(e.object)},isNgForOf:function(e,t,n){return"NGMicrosyntaxKeyedExpression"===e.type&&"of"===e.key.name&&1===t&&"NGMicrosyntaxLet"===n.body[0].type&&null===n.body[0].value},isNumericLiteral:Qs,isObjectType:function(e){return"ObjectTypeAnnotation"===e.type||"TSTypeLiteral"===e.type},isObjectTypePropertyAFunction:function(e){return!("ObjectTypeProperty"!==e.type&&"ObjectTypeInternalSlot"!==e.type||"FunctionTypeAnnotation"!==e.value.type||e.static||oc(e))},isSimpleType:function(e){return!!e&&(!("GenericTypeAnnotation"!==e.type&&"TSTypeReference"!==e.type||e.typeParameters)||!!ic.has(e.type))},isSimpleNumber:fc,isSimpleTemplateLiteral:function(e){let t="expressions";"TSTemplateLiteralType"===e.type&&(t="types");const n=e[t];return 0!==n.length&&n.every((e=>{if(e.comments)return!1;if("Identifier"===e.type||"ThisExpression"===e.type)return!0;if("MemberExpression"===e.type||"OptionalMemberExpression"===e.type){let t=e;for(;"MemberExpression"===t.type||"OptionalMemberExpression"===t.type;){if("Identifier"!==t.property.type&&"Literal"!==t.property.type&&"StringLiteral"!==t.property.type&&"NumericLiteral"!==t.property.type)return!1;if(t=t.object,t.comments)return!1}return"Identifier"===t.type||"ThisExpression"===t.type}return!1}))},isStringLiteral:Zs,isStringPropSafeToUnquote:function(e,t){return"json"!==t.parser&&Zs(e.key)&&mc(e.key).slice(1,-1)===e.key.value&&(Ls(e.key.value)&&!(("typescript"===t.parser||"babel-ts"===t.parser)&&"ClassProperty"===e.type)||fc(e.key.value)&&String(Number(e.key.value))===e.key.value&&("babel"===t.parser||"espree"===t.parser||"meriyah"===t.parser))},isTemplateOnItsOwnLine:function(e,t){return("TemplateLiteral"===e.type&&hc(e)||"TaggedTemplateExpression"===e.type&&hc(e.quasi))&&!js(t,Vs(e),{backwards:!0})},isTestCall:function e(t,n){if("CallExpression"!==t.type)return!1;if(1===t.arguments.length){if(tc(t)&&n&&e(n))return ec(t.arguments[0]);if("Identifier"===(r=t).callee.type&&/^(before|after)(Each|All)$/.test(r.callee.name)&&1===r.arguments.length)return tc(t.arguments[0])}else if((2===t.arguments.length||3===t.arguments.length)&&("Identifier"===t.callee.type&&ac.test(t.callee.name)||function(e){return("MemberExpression"===e.callee.type||"OptionalMemberExpression"===e.callee.type)&&"Identifier"===e.callee.object.type&&"Identifier"===e.callee.property.type&&ac.test(e.callee.object.name)&&("only"===e.callee.property.name||"skip"===e.callee.property.name)}(t))&&(function(e){return"TemplateLiteral"===e.type}(t.arguments[0])||Zs(t.arguments[0])))return!(t.arguments[2]&&!Qs(t.arguments[2]))&&((2===t.arguments.length?ec(t.arguments[1]):function(e){return"FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type&&"BlockStatement"===e.body.type}(t.arguments[1])&&vc(t.arguments[1]).length<=1)||tc(t.arguments[1]));var r;return!1},isTheOnlyJSXElementInMarkdown:function(e,t){if("markdown"!==e.parentParser&&"mdx"!==e.parentParser)return!1;const n=t.getNode();if(!n.expression||!nc(n.expression))return!1;const r=t.getParentNode();return"Program"===r.type&&1===r.body.length},isTSXFile:function(e){return e.filepath&&/\.tsx$/i.test(e.filepath)},isTypeAnnotationAFunction:function(e){return!("TypeAnnotation"!==e.type&&"TSTypeAnnotation"!==e.type||"FunctionTypeAnnotation"!==e.typeAnnotation.type||e.static||qs(e,e.typeAnnotation))},matchJsxWhitespaceRegex:cc,needsHardlineAfterDanglingComment:function(e){if(!e.comments)return!1;const t=Ms(e.comments.filter((e=>!e.leading&&!e.trailing)));return t&&!Gs(t)},rawText:mc,returnArgumentHasLeadingComment:function(e,t){if(dc(e.originalText,t))return!0;if(Hs(t)){let r,o=t;for(;r=(n=o).expressions?n.expressions[0]:n.left||n.test||n.callee||n.object||n.tag||n.argument||n.expression;)if(o=r,dc(e.originalText,o))return!0}var n;return!1},shouldPrintComma:function(e,t="es5"){return"es5"===e.trailingComma&&"es5"===t||"all"===e.trailingComma&&("all"===t||"es5"===t)},isBitwiseOperator:function(e){return!!yc[e]||"|"===e||"^"===e||"&"===e},shouldFlatten:function(e,t){return Cc(t)===Cc(e)&&("**"!==e&&((!gc[e]||!gc[t])&&(!("%"===t&&Dc[e]||"%"===e&&Dc[t])&&((t===e||!Dc[t]||!Dc[e])&&(!yc[e]||!yc[t])))))},startsWithNoLookaheadToken:function e(t,n){switch((t=function(e){for(;e.left;)e=e.left;return e}(t)).type){case"FunctionExpression":case"ClassExpression":case"DoExpression":return n;case"ObjectExpression":return!0;case"MemberExpression":case"OptionalMemberExpression":return e(t.object,n);case"TaggedTemplateExpression":return"FunctionExpression"!==t.tag.type&&e(t.tag,n);case"CallExpression":case"OptionalCallExpression":return"FunctionExpression"!==t.callee.type&&e(t.callee,n);case"ConditionalExpression":return e(t.test,n);case"UpdateExpression":return!t.prefix&&e(t.argument,n);case"BindExpression":return t.object&&e(t.object,n);case"SequenceExpression":return e(t.expressions[0],n);case"TSAsExpression":return e(t.expression,n);default:return!1}},getPrecedence:Cc};const{getLast:Tc,hasNewline:Bc,getNextNonSpaceNonCommentCharacterIndexWithStartIndex:Nc,getNextNonSpaceNonCommentCharacter:kc,hasNewlineInRange:Pc,addLeadingComment:Oc,addTrailingComment:Ic,addDanglingComment:Lc,getNextNonSpaceNonCommentCharacterIndex:Mc}=Lt,{isBlockComment:jc,getFunctionParameters:_c,isPrettierIgnoreComment:Rc,isJSXNode:Vc,hasFlowShorthandAnnotationComment:$c,hasFlowAnnotationComment:qc,hasIgnoreComment:Wc}=wc,{locStart:Uc,locEnd:Jc}=ii;function zc(e,t){const n=(e.body||e.properties).find((({type:e})=>"EmptyStatement"!==e));n?Oc(n,t):Lc(e,t)}function Hc(e,t){"BlockStatement"===e.type?zc(e,t):Oc(e,t)}function Gc(e,t){const{precedingNode:n,enclosingNode:r,followingNode:o}=e;if(!r||"IfStatement"!==r.type||!o)return!1;return")"===kc(t,e,Jc)?(Ic(n,e),!0):n===r.consequent&&o===r.alternate?("BlockStatement"===n.type?Ic(n,e):Lc(r,e),!0):"BlockStatement"===o.type?(zc(o,e),!0):"IfStatement"===o.type?(Hc(o.consequent,e),!0):r.consequent===o&&(Oc(o,e),!0)}function Xc(e,t){const{precedingNode:n,enclosingNode:r,followingNode:o}=e;if(!r||"WhileStatement"!==r.type||!o)return!1;return")"===kc(t,e,Jc)?(Ic(n,e),!0):"BlockStatement"===o.type?(zc(o,e),!0):r.body===o&&(Oc(o,e),!0)}function Yc(e){const{precedingNode:t,enclosingNode:n,followingNode:r}=e;return!(!n||"TryStatement"!==n.type&&"CatchClause"!==n.type||!r)&&("CatchClause"===n.type&&t?(Ic(t,e),!0):"BlockStatement"===r.type?(zc(r,e),!0):"TryStatement"===r.type?(Hc(r.finalizer,e),!0):"CatchClause"===r.type&&(Hc(r.body,e),!0))}function Kc(e){const{precedingNode:t,enclosingNode:n,followingNode:r}=e;if(n&&("ClassDeclaration"===n.type||"ClassExpression"===n.type||"DeclareClass"===n.type||"DeclareInterface"===n.type||"InterfaceDeclaration"===n.type||"TSInterfaceDeclaration"===n.type)){if(n.decorators&&n.decorators.length>0&&(!r||"Decorator"!==r.type))return Ic(n.decorators[n.decorators.length-1],e),!0;if(n.body&&r===n.body)return zc(n.body,e),!0;if(r)for(const o of["implements","extends","mixins"])if(n[o]&&r===n[o][0])return!t||t!==n.id&&t!==n.typeParameters&&t!==n.superClass?Lc(n,e,o):Ic(t,e),!0}return!1}function Qc(e,t){const{precedingNode:n,enclosingNode:r}=e;return(r&&n&&("Property"===r.type||"TSDeclareMethod"===r.type||"TSAbstractMethodDefinition"===r.type)&&"Identifier"===n.type&&r.key===n&&":"!==kc(t,n,Jc)||!(!n||!r||"Decorator"!==n.type||"ClassMethod"!==r.type&&"ClassProperty"!==r.type&&"FieldDefinition"!==r.type&&"TSAbstractClassProperty"!==r.type&&"TSAbstractMethodDefinition"!==r.type&&"TSDeclareMethod"!==r.type&&"MethodDefinition"!==r.type))&&(Ic(n,e),!0)}function Zc(e,t){const{precedingNode:n,enclosingNode:r,followingNode:o}=e;if(n&&"FunctionTypeParam"===n.type&&r&&"FunctionTypeAnnotation"===r.type&&o&&"FunctionTypeParam"!==o.type)return Ic(n,e),!0;if(n&&("Identifier"===n.type||"AssignmentPattern"===n.type)&&r&&ol(r)&&")"===kc(t,e,Jc))return Ic(n,e),!0;if(r&&"FunctionDeclaration"===r.type&&o&&"BlockStatement"===o.type){const n=(()=>{const e=_c(r);if(0!==e.length)return Nc(t,Jc(Tc(e)));const n=Nc(t,Jc(r.id));return!1!==n&&Nc(t,n+1)})();if(Uc(e)>n)return zc(o,e),!0}return!1}function el(e){const{enclosingNode:t}=e;return!(!t||"ImportSpecifier"!==t.type)&&(Oc(t,e),!0)}function tl(e){const{enclosingNode:t}=e;return!(!t||"LabeledStatement"!==t.type)&&(Oc(t,e),!0)}function nl(e,t,n){const{enclosingNode:r}=e;return t&&t.body&&0===t.body.length?(n?Lc(t,e):Oc(t,e),!0):!(!r||"Program"!==r.type||0!==r.body.length||!r.directives||0!==r.directives.length)&&(n?Lc(r,e):Oc(r,e),!0)}function rl(e){const{enclosingNode:t,followingNode:n}=e;if(Rc(e)&&t&&"TSMappedType"===t.type&&n&&"TSTypeParameter"===n.type&&n.constraint)return t.prettierIgnore=!0,e.unignore=!0,!0}function ol(e){return"ArrowFunctionExpression"===e.type||"FunctionExpression"===e.type||"FunctionDeclaration"===e.type||"ObjectMethod"===e.type||"ClassMethod"===e.type||"TSDeclareFunction"===e.type||"TSCallSignatureDeclaration"===e.type||"TSConstructSignatureDeclaration"===e.type||"TSMethodSignature"===e.type||"TSConstructorType"===e.type||"TSFunctionType"===e.type||"TSDeclareMethod"===e.type}function ul(e){return jc(e)&&"*"===e.value[0]&&/@type\b/.test(e.value)}var il={handleOwnLineComment:function(e,t,n,r,o){return rl(e)||Zc(e,t)||function(e){const{enclosingNode:t,followingNode:n}=e;if(t&&("MemberExpression"===t.type||"OptionalMemberExpression"===t.type)&&n&&"Identifier"===n.type)return Oc(t,e),!0;return!1}(e)||Gc(e,t)||Xc(e,t)||Yc(e)||Kc(e)||el(e)||function(e){const{enclosingNode:t}=e;if(t&&("ForInStatement"===t.type||"ForOfStatement"===t.type))return Oc(t,e),!0;return!1}(e)||function(e){const{precedingNode:t,enclosingNode:n,followingNode:r}=e;if(n&&("UnionTypeAnnotation"===n.type||"TSUnionType"===n.type))return Rc(e)&&(r.prettierIgnore=!0,e.unignore=!0),!!t&&(Ic(t,e),!0);r&&("UnionTypeAnnotation"===r.type||"TSUnionType"===r.type)&&Rc(e)&&(r.types[0].prettierIgnore=!0,e.unignore=!0);return!1}(e)||nl(e,r,o)||function(e,t){const{precedingNode:n,enclosingNode:r}=e;if(n&&"ImportSpecifier"===n.type&&r&&"ImportDeclaration"===r.type&&Bc(t,Jc(e)))return Ic(n,e),!0;return!1}(e,t)||function(e){const{enclosingNode:t}=e;if(t&&"AssignmentPattern"===t.type)return Oc(t,e),!0;return!1}(e)||Qc(e,t)||tl(e)},handleEndOfLineComment:function(e,t,n,r,o){return function(e){const{followingNode:t}=e;if(t&&ul(e))return Oc(t,e),!0;return!1}(e)||Zc(e,t)||function(e,t){const{precedingNode:n,enclosingNode:r,followingNode:o}=e,u=n&&!Pc(t,Jc(n),Uc(e));if((!n||!u)&&r&&("ConditionalExpression"===r.type||"TSConditionalType"===r.type)&&o)return Oc(o,e),!0;return!1}(e,t)||el(e)||Gc(e,t)||Xc(e,t)||Yc(e)||Kc(e)||tl(e)||function(e){const{precedingNode:t,enclosingNode:n}=e;if(n&&("CallExpression"===n.type||"OptionalCallExpression"===n.type)&&t&&n.callee===t&&n.arguments.length>0)return Oc(n.arguments[0],e),!0;return!1}(e)||function(e){const{enclosingNode:t}=e;if(t&&("Property"===t.type||"ObjectProperty"===t.type))return Oc(t,e),!0;return!1}(e)||nl(e,r,o)||function(e){const{enclosingNode:t}=e;if(t&&"TypeAlias"===t.type)return Oc(t,e),!0;return!1}(e)||function(e){const{enclosingNode:t,followingNode:n}=e;if(t&&("VariableDeclarator"===t.type||"AssignmentExpression"===t.type)&&n&&("ObjectExpression"===n.type||"ArrayExpression"===n.type||"TemplateLiteral"===n.type||"TaggedTemplateExpression"===n.type||jc(e)))return Oc(n,e),!0;return!1}(e)},handleRemainingComment:function(e,t,n,r,o){return!!(rl(e)||Gc(e,t)||Xc(e,t)||function(e){const{precedingNode:t,enclosingNode:n}=e;if(n&&("ObjectProperty"===n.type||"Property"===n.type)&&n.shorthand&&n.key===t&&"AssignmentPattern"===n.value.type)return Ic(n.value.left,e),!0;return!1}(e)||function(e,t){if(")"!==kc(t,e,Jc))return!1;const{enclosingNode:n}=e;if(n&&(ol(n)&&0===_c(n).length||("CallExpression"===n.type||"OptionalCallExpression"===n.type||"NewExpression"===n.type)&&0===n.arguments.length))return Lc(n,e),!0;if(n&&"MethodDefinition"===n.type&&0===_c(n.value).length)return Lc(n.value,e),!0;return!1}(e,t)||Qc(e,t)||nl(e,r,o)||function(e,t){const{enclosingNode:n}=e;if(!n||"ArrowFunctionExpression"!==n.type)return!1;const r=Mc(t,e,Jc);if(!1!==r&&"=>"===t.slice(r,r+2))return Lc(n,e),!0;return!1}(e,t)||function(e,t){if("("!==kc(t,e,Jc))return!1;const{precedingNode:n,enclosingNode:r}=e;if(n&&r&&("FunctionDeclaration"===r.type||"FunctionExpression"===r.type||"ClassMethod"===r.type||"MethodDefinition"===r.type||"ObjectMethod"===r.type))return Ic(n,e),!0;return!1}(e,t)||function(e){const{precedingNode:t,enclosingNode:n,followingNode:r}=e;if(!n||"TSMappedType"!==n.type)return!1;if(r&&"TSTypeParameter"===r.type&&r.name)return Oc(r.name,e),!0;if(t&&"TSTypeParameter"===t.type&&t.constraint)return Ic(t.constraint,e),!0;return!1}(e)||function(e){const{enclosingNode:t}=e;if(t&&("ContinueStatement"===t.type||"BreakStatement"===t.type)&&!t.label)return Ic(t,e),!0;return!1}(e)||function(e,t){const{enclosingNode:n,followingNode:r}=e;if(!r&&n&&("TSMethodSignature"===n.type||"TSDeclareFunction"===n.type||"TSAbstractMethodDefinition"===n.type)&&";"===kc(t,e,Jc))return Ic(n,e),!0;return!1}(e,t))},hasLeadingComment:function(e,t=(()=>!0)){return e.leadingComments?e.leadingComments.some(t):!!e.comments&&e.comments.some((e=>e.leading&&t(e)))},isTypeCastComment:ul,getGapRegex:function(e){if(e&&"BinaryExpression"!==e.type&&"LogicalExpression"!==e.type)return/^[\s&(|]*$/},getCommentChildNodes:function(e,t){if(("typescript"===t.parser||"flow"===t.parser||"espree"===t.parser||"meriyah"===t.parser)&&"MethodDefinition"===e.type&&e.value&&"FunctionExpression"===e.value.type&&0===_c(e.value).length&&!e.value.returnType&&(!e.value.typeParameters||0===e.value.typeParameters.length)&&e.value.body)return[...e.decorators||[],e.key,e.value.body]},willPrintOwnComments:function(e){const t=e.getValue(),n=e.getParentNode();return(t&&(Vc(t)||$c(t)||n&&("CallExpression"===n.type||"OptionalCallExpression"===n.type)&&(qc(t.leadingComments)||qc(t.trailingComments)))||n&&("JSXSpreadAttribute"===n.type||"JSXSpreadChild"===n.type||"UnionTypeAnnotation"===n.type||"TSUnionType"===n.type||("ClassDeclaration"===n.type||"ClassExpression"===n.type)&&n.superClass===t))&&(!Wc(e)||"UnionTypeAnnotation"===n.type||"TSUnionType"===n.type)}};const{getStringWidth:al,getIndentSize:sl}=Lt,{builders:{concat:cl,join:ll,hardline:pl,softline:dl,group:fl,indent:hl,align:ml,lineSuffixBoundary:gl,addAlignmentToDoc:Dl},printer:{printDocToString:yl},utils:{mapDoc:El}}=cn,{isBinaryish:Cl,isJestEachTemplateLiteral:bl,isSimpleTemplateLiteral:vl}=wc;function Al(e){return e.replace(/([\\`]|\${)/g,"\\$1")}var Fl={printTemplateLiteral:function(e,t,n){const r=e.getValue();if("TemplateLiteral"===r.type&&bl(r,e.getParentNode())){const r=function(e,t,n){const r=e.getNode(),o=r.quasis[0].value.raw.trim().split(/\s*\|\s*/);if(o.length>1||o.some((e=>0!==e.length))){t.__inJestEach=!0;const u=e.map(n,"expressions");t.__inJestEach=!1;const i=[],a=u.map((e=>"${"+yl(e,Object.assign({},t,{printWidth:1/0,endOfLine:"lf"})).formatted+"}")),s=[{hasLineBreak:!1,cells:[]}];for(let e=1;e<r.quasis.length;e++){const t=s[s.length-1],n=a[e-1];t.cells.push(n),n.includes("\n")&&(t.hasLineBreak=!0),r.quasis[e].value.raw.includes("\n")&&s.push({hasLineBreak:!1,cells:[]})}const c=Math.max(o.length,...s.map((e=>e.cells.length))),l=Array.from({length:c}).fill(0),p=[{cells:o},...s.filter((e=>0!==e.cells.length))];for(const{cells:e}of p.filter((e=>!e.hasLineBreak)))e.forEach(((e,t)=>{l[t]=Math.max(l[t],al(e))}));return i.push(gl,"`",hl(cl([pl,ll(pl,p.map((e=>ll(" | ",e.cells.map(((t,n)=>e.hasLineBreak?t:t+" ".repeat(l[n]-al(t))))))))])),pl,"`"),cl(i)}}(e,n,t);if(r)return r}let o="expressions";"TSTemplateLiteralType"===r.type&&(o="types");const u=[];let i=e.map(t,o);const a=vl(r);return a&&(i=i.map((e=>yl(e,Object.assign({},n,{printWidth:1/0})).formatted))),u.push(gl,"`"),e.each((e=>{const s=e.getName();if(u.push(t(e)),s<i.length){const{tabWidth:t}=n,c=e.getValue(),l=sl(c.value.raw,t);let p=i[s];if(!a){const e=r[o][s];(e.comments&&e.comments.length||"MemberExpression"===e.type||"OptionalMemberExpression"===e.type||"ConditionalExpression"===e.type||"SequenceExpression"===e.type||"TSAsExpression"===e.type||Cl(e))&&(p=cl([hl(cl([dl,p])),dl]))}const d=0===l&&c.value.raw.endsWith("\n")?ml(-1/0,p):Dl(p,l,t);u.push(fl(cl(["${",d,gl,"}"])))}}),"quasis"),u.push("`"),cl(u)},printTemplateExpressions:function(e,t){return e.map((e=>function(e,t){const n=e.getValue();let r=t(e);return n.comments&&n.comments.length&&(r=fl(cl([hl(cl([dl,r])),dl]))),cl(["${",r,gl,"}"])}(e,t)),"expressions")},escapeTemplateCharacters:function(e,t){return El(e,(e=>{if(!e.parts)return e;const n=e.parts.map((e=>"string"==typeof e?t?e.replace(/(\\*)`/g,"$1$1\\`"):Al(e):e));return Object.assign({},e,{parts:n})}))},uncookTemplateElementValue:Al};const{builders:{indent:xl,softline:Sl,literalline:wl,concat:Tl,dedentToRoot:Bl}}=cn,{escapeTemplateCharacters:Nl}=Fl;var kl=function(e,t,n){let r=e.getValue().quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g,((e,t)=>"\\".repeat(t.length/2)+"`"));const o=function(e){const t=e.match(/^([^\S\n]*)\S/m);return null===t?"":t[1]}(r),u=""!==o;u&&(r=r.replace(new RegExp("^".concat(o),"gm"),""));const i=Nl(n(r,{parser:"markdown",__inJsTemplate:!0},{stripTrailingHardline:!0}),!0);return Tl(["`",u?xl(Tl([Sl,i])):Tl([wl,Bl(i)]),Sl,"`"])};const{builders:{indent:Pl,hardline:Ol,softline:Il,concat:Ll},utils:{mapDoc:Ml,replaceNewlinesWithLiterallines:jl}}=cn,{printTemplateExpressions:_l}=Fl;var Rl=function(e,t,n){const r=e.getValue(),o=r.quasis.map((e=>e.value.raw));let u=0;return function(e,t,n){if(1===t.quasis.length&&!t.quasis[0].value.raw.trim())return"``";const r=function(e,t){if(!t||!t.length)return e;let n=0;const r=Ml(e,(e=>{if(!e||!e.parts||!e.parts.length)return e;let{parts:r}=e;const o=r.indexOf("@"),u=o+1;if(o>-1&&"string"==typeof r[u]&&r[u].startsWith("prettier-placeholder")){const e=r[o],t=r[u],n=r.slice(u+1);r=r.slice(0,o).concat([e+t]).concat(n)}const i=[];return r.forEach((e=>{"string"==typeof e&&e.includes("@prettier-placeholder")?e.split(/@prettier-placeholder-(\d+)-id/).forEach(((e,r)=>{r%2!=0?(i.push(t[e]),n++):i.push(jl(e))})):i.push(e)})),Object.assign({},e,{parts:i})}));return t.length===n?r:null}(e,n);if(!r)throw new Error("Couldn't insert all the expressions");return Ll(["`",Pl(Ll([Ol,r])),Il,"`"])}(n(o.reduce(((e,t,n)=>0===n?t:e+"@prettier-placeholder-"+u+++"-id"+t),""),{parser:"scss"},{stripTrailingHardline:!0}),r,_l(e,t))};const{builders:{indent:Vl,join:$l,hardline:ql,concat:Wl}}=cn,{escapeTemplateCharacters:Ul,printTemplateExpressions:Jl}=Fl;function zl(e){const t=[];let n=!1;return e.map((e=>e.trim())).forEach(((e,r,o)=>{""!==e&&(""===o[r-1]&&n?t.push(Wl([ql,e])):t.push(e),n=!0)})),0===t.length?null:$l(ql,t)}var Hl=function(e,t,n){const r=e.getValue(),o=r.quasis.length;if(1===o&&""===r.quasis[0].value.raw.trim())return"``";const u=Jl(e,t),i=[];for(let e=0;e<o;e++){const t=0===e,a=e===o-1,s=r.quasis[e].value.cooked,c=s.split("\n"),l=c.length,p=u[e],d=l>2&&""===c[0].trim()&&""===c[1].trim(),f=l>2&&""===c[l-1].trim()&&""===c[l-2].trim(),h=c.every((e=>/^\s*(?:#[^\n\r]*)?$/.test(e)));if(!a&&/#[^\n\r]*$/.test(c[l-1]))return null;let m=null;m=h?zl(c):n(s,{parser:"graphql"},{stripTrailingHardline:!0}),m?(m=Ul(m,!1),!t&&d&&i.push(""),i.push(m),!a&&f&&i.push("")):t||a||!d||i.push(""),p&&i.push(p)}return Wl(["`",Vl(Wl([ql,$l(ql,i)])),ql,"`"])};const{builders:{indent:Gl,line:Xl,hardline:Yl,concat:Kl,group:Ql},utils:{mapDoc:Zl}}=cn,{printTemplateExpressions:ep,uncookTemplateElementValue:tp}=Fl;let np=0;var rp=function(e,t,n,r,{parser:o}){const u=e.getValue(),i=np;np=np+1>>>0;const a=e=>"PRETTIER_HTML_PLACEHOLDER_".concat(e,"_").concat(i,"_IN_JS"),s=u.quasis.map(((e,t,n)=>t===n.length-1?e.value.cooked:e.value.cooked+a(t))).join(""),c=ep(e,t);if(0===c.length&&0===s.trim().length)return"``";const l=new RegExp(a("(\\d+)"),"g");let p=0;const d=n(s,{parser:o,__onHtmlRoot(e){p=e.children.length}},{stripTrailingHardline:!0}),f=Zl(d,(e=>{if("string"!=typeof e)return e;const t=[],n=e.split(l);for(let e=0;e<n.length;e++){let o=n[e];if(e%2==0){o&&(o=tp(o),r.embeddedInHtml&&(o=o.replace(/<\/(script)\b/gi,"<\\/$1")),t.push(o));continue}const u=+o;t.push(c[u])}return Kl(t)})),h=/^\s/.test(s)?" ":"",m=/\s$/.test(s)?" ":"",g="ignore"===r.htmlWhitespaceSensitivity?Yl:h&&m?Xl:null;return Ql(Kl(g?["`",Gl(Kl([g,Ql(f)])),g,"`"]:["`",h,p>1?Gl(Ql(f)):Ql(f),m,"`"]))};const{isBlockComment:op}=wc,{hasLeadingComment:up}=il;function ip(e){return function(e){const t=e.getValue(),n=e.getParentNode(),r=e.getParentNode(1);return r&&t.quasis&&"JSXExpressionContainer"===n.type&&"JSXElement"===r.type&&"style"===r.openingElement.name.name&&r.openingElement.attributes.some((e=>"jsx"===e.name.name))||n&&"TaggedTemplateExpression"===n.type&&"Identifier"===n.tag.type&&"css"===n.tag.name||n&&"TaggedTemplateExpression"===n.type&&"MemberExpression"===n.tag.type&&"css"===n.tag.object.name&&("global"===n.tag.property.name||"resolve"===n.tag.property.name)}(e)||function(e){const t=e.getParentNode();if(!t||"TaggedTemplateExpression"!==t.type)return!1;const{tag:n}=t;switch(n.type){case"MemberExpression":return sp(n.object)||cp(n);case"CallExpression":return sp(n.callee)||"MemberExpression"===n.callee.type&&("MemberExpression"===n.callee.object.type&&(sp(n.callee.object.object)||cp(n.callee.object))||"CallExpression"===n.callee.object.type&&sp(n.callee.object.callee));case"Identifier":return"css"===n.name;default:return!1}}(e)||function(e){const t=e.getParentNode(),n=e.getParentNode(1);return n&&"JSXExpressionContainer"===t.type&&"JSXAttribute"===n.type&&"JSXIdentifier"===n.name.type&&"css"===n.name.name}(e)||function(e){return e.match((e=>"TemplateLiteral"===e.type),((e,t)=>"ArrayExpression"===e.type&&"elements"===t),((e,t)=>("Property"===e.type||"ObjectProperty"===e.type)&&"Identifier"===e.key.type&&"styles"===e.key.name&&"value"===t),...ap)}(e)?"css":function(e){const t=e.getValue(),n=e.getParentNode();return lp(t,"GraphQL")||n&&("TaggedTemplateExpression"===n.type&&("MemberExpression"===n.tag.type&&"graphql"===n.tag.object.name&&"experimental"===n.tag.property.name||"Identifier"===n.tag.type&&("gql"===n.tag.name||"graphql"===n.tag.name))||"CallExpression"===n.type&&"Identifier"===n.callee.type&&"graphql"===n.callee.name)}(e)?"graphql":function(e){return lp(e.getValue(),"HTML")||e.match((e=>"TemplateLiteral"===e.type),((e,t)=>"TaggedTemplateExpression"===e.type&&"Identifier"===e.tag.type&&"html"===e.tag.name&&"quasi"===t))}(e)?"html":function(e){return e.match((e=>"TemplateLiteral"===e.type),((e,t)=>("Property"===e.type||"ObjectProperty"===e.type)&&"Identifier"===e.key.type&&"template"===e.key.name&&"value"===t),...ap)}(e)?"angular":function(e){const t=e.getValue(),n=e.getParentNode();return n&&"TaggedTemplateExpression"===n.type&&1===t.quasis.length&&"Identifier"===n.tag.type&&("md"===n.tag.name||"markdown"===n.tag.name)}(e)?"markdown":void 0}const ap=[(e,t)=>"ObjectExpression"===e.type&&"properties"===t,(e,t)=>"CallExpression"===e.type&&"Identifier"===e.callee.type&&"Component"===e.callee.name&&"arguments"===t,(e,t)=>"Decorator"===e.type&&"expression"===t];function sp(e){return"Identifier"===e.type&&"styled"===e.name}function cp(e){return/^[A-Z]/.test(e.object.name)&&"extend"===e.property.name}function lp(e,t){return up(e,(e=>op(e)&&e.value===" ".concat(t," ")))}var pp=function(e,t,n,r){const o=e.getValue();if("TemplateLiteral"!==o.type||function({quasis:e}){return e.some((({value:{cooked:e}})=>null===e))}(o))return;const u=ip(e);return u?"markdown"===u?kl(e,t,n):"css"===u?Rl(e,t,n):"graphql"===u?Hl(e,t,n):"html"===u||"angular"===u?rp(e,t,n,r,{parser:u}):void 0:void 0};const{isBlockComment:dp}=wc,fp=new Set(["range","raw","comments","leadingComments","trailingComments","innerComments","extra","start","end","loc","flags","errors","tokens"]);function hp(e,t,n){if("Program"===e.type&&delete t.sourceType,"BigIntLiteral"!==e.type&&"BigIntLiteralTypeAnnotation"!==e.type||t.value&&(t.value=t.value.toLowerCase()),"BigIntLiteral"!==e.type&&"Literal"!==e.type||t.bigint&&(t.bigint=t.bigint.toLowerCase()),"DecimalLiteral"===e.type&&(t.value=Number(t.value)),"EmptyStatement"===e.type)return null;if("JSXText"===e.type)return null;if("JSXExpressionContainer"===e.type&&("Literal"===e.expression.type||"StringLiteral"===e.expression.type)&&" "===e.expression.value)return null;if("Property"!==e.type&&"ObjectProperty"!==e.type&&"MethodDefinition"!==e.type&&"ClassProperty"!==e.type&&"ClassMethod"!==e.type&&"FieldDefinition"!==e.type&&"TSDeclareMethod"!==e.type&&"TSPropertySignature"!==e.type&&"ObjectTypeProperty"!==e.type||"object"!=typeof e.key||!e.key||"Literal"!==e.key.type&&"NumericLiteral"!==e.key.type&&"StringLiteral"!==e.key.type&&"Identifier"!==e.key.type||delete t.key,"OptionalMemberExpression"===e.type&&!1===e.optional&&(t.type="MemberExpression",delete t.optional),"JSXElement"===e.type&&"style"===e.openingElement.name.name&&e.openingElement.attributes.some((e=>"jsx"===e.name.name))){t.children.filter((e=>"JSXExpressionContainer"===e.type&&"TemplateLiteral"===e.expression.type)).map((e=>e.expression)).reduce(((e,t)=>e.concat(t.quasis)),[]).forEach((e=>delete e.value))}"JSXAttribute"===e.type&&"css"===e.name.name&&"JSXExpressionContainer"===e.value.type&&"TemplateLiteral"===e.value.expression.type&&t.value.expression.quasis.forEach((e=>delete e.value)),"JSXAttribute"===e.type&&e.value&&"Literal"===e.value.type&&/["']|"|'/.test(e.value.value)&&(t.value.value=t.value.value.replace(/["']|"|'/g,'"'));const r=e.expression||e.callee;if("Decorator"===e.type&&"CallExpression"===r.type&&"Component"===r.callee.name&&1===r.arguments.length){const n=e.expression.arguments[0].properties;t.expression.arguments[0].properties.forEach(((e,t)=>{let r=null;switch(n[t].key.name){case"styles":"ArrayExpression"===e.value.type&&(r=e.value.elements[0]);break;case"template":"TemplateLiteral"===e.value.type&&(r=e.value)}r&&r.quasis.forEach((e=>delete e.value))}))}if("TaggedTemplateExpression"!==e.type||"MemberExpression"!==e.tag.type&&("Identifier"!==e.tag.type||"gql"!==e.tag.name&&"graphql"!==e.tag.name&&"css"!==e.tag.name&&"md"!==e.tag.name&&"markdown"!==e.tag.name&&"html"!==e.tag.name)&&"CallExpression"!==e.tag.type||t.quasi.quasis.forEach((e=>delete e.value)),"TemplateLiteral"===e.type){(e.leadingComments&&e.leadingComments.some((e=>dp(e)&&["GraphQL","HTML"].some((t=>e.value===" ".concat(t," ")))))||"CallExpression"===n.type&&"graphql"===n.callee.name)&&t.quasis.forEach((e=>delete e.value)),e.leadingComments||t.quasis.forEach((e=>{e.value&&delete e.value.cooked}))}"InterpreterDirective"===e.type&&(t.value=t.value.trimEnd())}hp.ignoredProperties=fp;var mp=hp;const gp=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");const t=e.match(/(?:\r?\n)/g)||[];if(0===t.length)return;const n=t.filter((e=>"\r\n"===e)).length;return n>t.length-n?"\r\n":"\n"};var Dp=gp;Dp.graceful=e=>"string"==typeof e&&gp(e)||"\n";var yp=je((function(e,t){function n(){const e=qr;return n=function(){return e},e}function r(){const e=(t=Dp)&&t.__esModule?t:{default:t};var t;return r=function(){return e},e}Object.defineProperty(t,"__esModule",{value:!0}),t.extract=function(e){const t=e.match(i);return t?t[0].trimLeft():""},t.strip=function(e){const t=e.match(i);return t&&t[0]?e.substring(t[0].length):e},t.parse=function(e){return f(e).pragmas},t.parseWithComments=f,t.print=function({comments:e="",pragmas:t={}}){const o=(0,r().default)(e)||n().EOL,u=" *",i=Object.keys(t),a=i.map((e=>h(e,t[e]))).reduce(((e,t)=>e.concat(t)),[]).map((e=>" * "+e+o)).join("");if(!e){if(0===i.length)return"";if(1===i.length&&!Array.isArray(t[i[0]])){const e=t[i[0]];return"".concat("/**"," ").concat(h(i[0],e)[0]).concat(" */")}}const s=e.split(o).map((e=>"".concat(u," ").concat(e))).join(o)+o;return"/**"+o+(e?s:"")+(e&&i.length?u+o:"")+a+" */"};const o=/\*\/$/,u=/^\/\*\*/,i=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,a=/(^|\s+)\/\/([^\r\n]*)/g,s=/^(\r?\n)+/,c=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g,l=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g,p=/(\r?\n|^) *\* ?/g,d=[];function f(e){const t=(0,r().default)(e)||n().EOL;e=e.replace(u,"").replace(o,"").replace(p,"$1");let i="";for(;i!==e;)i=e,e=e.replace(c,"".concat(t,"$1 $2").concat(t));e=e.replace(s,"").trimRight();const f=Object.create(null),h=e.replace(l,"").replace(s,"").trimRight();let m;for(;m=l.exec(e);){const e=m[2].replace(a,"");"string"==typeof f[m[1]]||Array.isArray(f[m[1]])?f[m[1]]=d.concat(f[m[1]],e):f[m[1]]=e}return{comments:h,pragmas:f}}function h(e,t){return d.concat(t).map((t=>"@".concat(e," ").concat(t).trim()))}}));const{parseWithComments:Ep,strip:Cp,extract:bp,print:vp}=yp,{getShebang:Ap}=Lt,{normalizeEndOfLine:Fp}=Mt;function xp(e){const t=Ap(e);t&&(e=e.slice(t.length+1));const n=bp(e),{pragmas:r,comments:o}=Ep(n);return{shebang:t,text:e,pragmas:r,comments:o}}var Sp={hasPragma:function(e){const t=Object.keys(xp(e).pragmas);return t.includes("prettier")||t.includes("format")},insertPragma:function(e){const{shebang:t,text:n,pragmas:r,comments:o}=xp(e),u=Cp(n),i=vp({pragmas:Object.assign({format:""},r),comments:o.trimStart()});return(t?"".concat(t,"\n"):"")+Fp(i)+(u.startsWith("\n")?"\n":"\n\n")+u}};const{getFunctionParameters:wp,getLeftSidePathName:Tp,hasFlowShorthandAnnotationComment:Bp,hasNakedLeftSide:Np,hasNode:kp,isBitwiseOperator:Pp,startsWithNoLookaheadToken:Op,shouldFlatten:Ip,getPrecedence:Lp}=wc;function Mp(e,t){const n=e.getParentNode();if(!n)return!1;const r=e.getName(),o=e.getNode();if(t.__isInHtmlInterpolation&&!t.bracketSpacing&&function(e){switch(e.type){case"ObjectExpression":return!0;default:return!1}}(o)&&jp(e))return!0;if(function(e){return"BlockStatement"===e.type||"BreakStatement"===e.type||"ClassBody"===e.type||"ClassDeclaration"===e.type||"ClassMethod"===e.type||"ClassProperty"===e.type||"FieldDefinition"===e.type||"ClassPrivateProperty"===e.type||"ContinueStatement"===e.type||"DebuggerStatement"===e.type||"DeclareClass"===e.type||"DeclareExportAllDeclaration"===e.type||"DeclareExportDeclaration"===e.type||"DeclareFunction"===e.type||"DeclareInterface"===e.type||"DeclareModule"===e.type||"DeclareModuleExports"===e.type||"DeclareVariable"===e.type||"DoWhileStatement"===e.type||"EnumDeclaration"===e.type||"ExportAllDeclaration"===e.type||"ExportDefaultDeclaration"===e.type||"ExportNamedDeclaration"===e.type||"ExpressionStatement"===e.type||"ForInStatement"===e.type||"ForOfStatement"===e.type||"ForStatement"===e.type||"FunctionDeclaration"===e.type||"IfStatement"===e.type||"ImportDeclaration"===e.type||"InterfaceDeclaration"===e.type||"LabeledStatement"===e.type||"MethodDefinition"===e.type||"ReturnStatement"===e.type||"SwitchStatement"===e.type||"ThrowStatement"===e.type||"TryStatement"===e.type||"TSDeclareFunction"===e.type||"TSEnumDeclaration"===e.type||"TSImportEqualsDeclaration"===e.type||"TSInterfaceDeclaration"===e.type||"TSModuleDeclaration"===e.type||"TSNamespaceExportDeclaration"===e.type||"TypeAlias"===e.type||"VariableDeclaration"===e.type||"WhileStatement"===e.type||"WithStatement"===e.type}(o))return!1;if("flow"!==t.parser&&Bp(e.getValue()))return!0;if("Identifier"===o.type)return!!(o.extra&&o.extra.parenthesized&&/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(o.name));switch(n.type){case"ParenthesizedExpression":return!1;case"ClassDeclaration":case"ClassExpression":if("superClass"===r&&("ArrowFunctionExpression"===o.type||"AssignmentExpression"===o.type||"AwaitExpression"===o.type||"BinaryExpression"===o.type||"ConditionalExpression"===o.type||"LogicalExpression"===o.type||"NewExpression"===o.type||"ObjectExpression"===o.type||"ParenthesizedExpression"===o.type||"SequenceExpression"===o.type||"TaggedTemplateExpression"===o.type||"UnaryExpression"===o.type||"UpdateExpression"===o.type||"YieldExpression"===o.type))return!0;break;case"ExportDefaultDeclaration":return _p(e,t)||"SequenceExpression"===o.type;case"Decorator":if("expression"===r){let e=!1,t=!1,n=o;for(;n;)switch(n.type){case"MemberExpression":t=!0,n=n.object;break;case"CallExpression":if(t||e)return!0;e=!0,n=n.callee;break;case"Identifier":return!1;default:return!0}return!0}break;case"ExpressionStatement":if(Op(o,!0))return!0;break;case"ArrowFunctionExpression":if("body"===r&&"SequenceExpression"!==o.type&&Op(o,!1))return!0}switch(o.type){case"SpreadElement":case"SpreadProperty":return"object"===r&&"MemberExpression"===n.type;case"UpdateExpression":if("UnaryExpression"===n.type)return o.prefix&&("++"===o.operator&&"+"===n.operator||"--"===o.operator&&"-"===n.operator);case"UnaryExpression":switch(n.type){case"UnaryExpression":return o.operator===n.operator&&("+"===o.operator||"-"===o.operator);case"BindExpression":return!0;case"MemberExpression":case"OptionalMemberExpression":return"object"===r;case"TaggedTemplateExpression":return!0;case"NewExpression":case"CallExpression":case"OptionalCallExpression":return"callee"===r;case"BinaryExpression":return"left"===r&&"**"===n.operator;case"TSNonNullExpression":return!0;default:return!1}case"BinaryExpression":if("UpdateExpression"===n.type||"PipelineTopicExpression"===n.type&&"|>"===o.operator)return!0;if("in"===o.operator&&function(e){let t=0,n=e.getValue();for(;n;){const r=e.getParentNode(t++);if(r&&"ForStatement"===r.type&&r.init===n)return!0;n=r}return!1}(e))return!0;if("|>"===o.operator&&o.extra&&o.extra.parenthesized){const t=e.getParentNode(1);if("BinaryExpression"===t.type&&"|>"===t.operator)return!0}case"TSTypeAssertion":case"TSAsExpression":case"LogicalExpression":switch(n.type){case"ConditionalExpression":return"TSAsExpression"===o.type;case"CallExpression":case"NewExpression":case"OptionalCallExpression":return"callee"===r;case"ClassExpression":case"ClassDeclaration":return"superClass"===r;case"TSTypeAssertion":case"TaggedTemplateExpression":case"UnaryExpression":case"JSXSpreadAttribute":case"SpreadElement":case"SpreadProperty":case"BindExpression":case"AwaitExpression":case"TSAsExpression":case"TSNonNullExpression":case"UpdateExpression":return!0;case"MemberExpression":case"OptionalMemberExpression":return"object"===r;case"AssignmentExpression":return"left"===r&&("TSTypeAssertion"===o.type||"TSAsExpression"===o.type);case"LogicalExpression":if("LogicalExpression"===o.type)return n.operator!==o.operator;case"BinaryExpression":{const{operator:e,type:t}=o;if(!e&&"TSTypeAssertion"!==t)return!0;const u=Lp(e),i=n.operator,a=Lp(i);return a>u||("right"===r&&a===u||(a===u&&!Ip(i,e)||(a<u&&"%"===e?"+"===i||"-"===i:!!Pp(i))))}default:return!1}case"SequenceExpression":switch(n.type){case"ReturnStatement":case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==r;case"ArrowFunctionExpression":return"body"!==r;default:return!0}case"YieldExpression":if("UnaryExpression"===n.type||"AwaitExpression"===n.type||"TSAsExpression"===n.type||"TSNonNullExpression"===n.type)return!0;case"AwaitExpression":switch(n.type){case"TaggedTemplateExpression":case"UnaryExpression":case"LogicalExpression":case"SpreadElement":case"SpreadProperty":case"TSAsExpression":case"TSNonNullExpression":case"BindExpression":return!0;case"MemberExpression":case"OptionalMemberExpression":return"object"===r;case"NewExpression":case"CallExpression":case"OptionalCallExpression":return"callee"===r;case"ConditionalExpression":return"test"===r;case"BinaryExpression":return!(!o.argument&&"|>"===n.operator);default:return!1}case"TSJSDocFunctionType":case"TSConditionalType":if("extendsType"===r&&"TSConditionalType"===n.type)return!0;case"TSFunctionType":case"TSConstructorType":if("checkType"===r&&"TSConditionalType"===n.type)return!0;case"TSUnionType":case"TSIntersectionType":if("TSUnionType"===n.type||"TSIntersectionType"===n.type)return!0;case"TSInferType":if("TSInferType"===o.type&&"TSRestType"===n.type)return!1;case"TSTypeOperator":return"TSArrayType"===n.type||"TSOptionalType"===n.type||"TSRestType"===n.type||"objectType"===r&&"TSIndexedAccessType"===n.type||"TSTypeOperator"===n.type||"TSTypeAnnotation"===n.type&&/^TSJSDoc/.test(e.getParentNode(1).type);case"ArrayTypeAnnotation":return"NullableTypeAnnotation"===n.type;case"IntersectionTypeAnnotation":case"UnionTypeAnnotation":return"ArrayTypeAnnotation"===n.type||"NullableTypeAnnotation"===n.type||"IntersectionTypeAnnotation"===n.type||"UnionTypeAnnotation"===n.type;case"NullableTypeAnnotation":return"ArrayTypeAnnotation"===n.type;case"FunctionTypeAnnotation":{const t="NullableTypeAnnotation"===n.type?e.getParentNode(1):n;return"UnionTypeAnnotation"===t.type||"IntersectionTypeAnnotation"===t.type||"ArrayTypeAnnotation"===t.type||"NullableTypeAnnotation"===t.type||"FunctionTypeParam"===n.type&&null===n.name&&wp(o).some((e=>e.typeAnnotation&&"NullableTypeAnnotation"===e.typeAnnotation.type))}case"StringLiteral":case"NumericLiteral":case"Literal":if("string"==typeof o.value&&"ExpressionStatement"===n.type&&!n.directive){const t=e.getParentNode(1);return"Program"===t.type||"BlockStatement"===t.type}return"object"===r&&"MemberExpression"===n.type&&"number"==typeof o.value;case"AssignmentExpression":{const t=e.getParentNode(1);return"body"===r&&"ArrowFunctionExpression"===n.type||("key"!==r||"ClassProperty"!==n.type&&"FieldDefinition"!==n.type||!n.computed)&&(("init"!==r&&"update"!==r||"ForStatement"!==n.type)&&("ExpressionStatement"===n.type?"ObjectPattern"===o.left.type:("key"!==r||"TSPropertySignature"!==n.type)&&("AssignmentExpression"!==n.type&&(("SequenceExpression"!==n.type||!t||"ForStatement"!==t.type||t.init!==n&&t.update!==n)&&(("value"!==r||"Property"!==n.type||!t||"ObjectPattern"!==t.type||!t.properties.includes(n))&&"NGChainedExpression"!==n.type)))))}case"ConditionalExpression":switch(n.type){case"TaggedTemplateExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":case"NGPipeExpression":case"ExportDefaultDeclaration":case"AwaitExpression":case"JSXSpreadAttribute":case"TSTypeAssertion":case"TypeCastExpression":case"TSAsExpression":case"TSNonNullExpression":return!0;case"NewExpression":case"CallExpression":case"OptionalCallExpression":return"callee"===r;case"ConditionalExpression":return"test"===r;case"MemberExpression":case"OptionalMemberExpression":return"object"===r;default:return!1}case"FunctionExpression":switch(n.type){case"NewExpression":case"CallExpression":case"OptionalCallExpression":return"callee"===r;case"TaggedTemplateExpression":return!0;default:return!1}case"ArrowFunctionExpression":switch(n.type){case"PipelineTopicExpression":return!(!o.extra||!o.extra.parenthesized);case"BinaryExpression":return"|>"!==n.operator||o.extra&&o.extra.parenthesized;case"NewExpression":case"CallExpression":case"OptionalCallExpression":return"callee"===r;case"MemberExpression":case"OptionalMemberExpression":return"object"===r;case"TSAsExpression":case"BindExpression":case"TaggedTemplateExpression":case"UnaryExpression":case"LogicalExpression":case"AwaitExpression":case"TSTypeAssertion":return!0;case"ConditionalExpression":return"test"===r;default:return!1}case"ClassExpression":switch(n.type){case"NewExpression":return"callee"===r;default:return!1}case"OptionalMemberExpression":case"OptionalCallExpression":{const t=e.getParentNode(1);if("object"===r&&"MemberExpression"===n.type||"callee"===r&&("CallExpression"===n.type||"NewExpression"===n.type)||"TSNonNullExpression"===n.type&&"MemberExpression"===t.type&&t.object===n)return!0}case"CallExpression":case"MemberExpression":case"TaggedTemplateExpression":case"TSNonNullExpression":if("callee"===r&&("BindExpression"===n.type||"NewExpression"===n.type)){let e=o;for(;e;)switch(e.type){case"CallExpression":case"OptionalCallExpression":return!0;case"MemberExpression":case"OptionalMemberExpression":case"BindExpression":e=e.object;break;case"TaggedTemplateExpression":e=e.tag;break;case"TSNonNullExpression":e=e.expression;break;default:return!1}}return!1;case"BindExpression":return"callee"===r&&("BindExpression"===n.type||"NewExpression"===n.type)||"object"===r&&("MemberExpression"===n.type||"OptionalMemberExpression"===n.type);case"NGPipeExpression":return!("NGRoot"===n.type||"NGMicrosyntaxExpression"===n.type||!("ObjectProperty"!==n.type||o.extra&&o.extra.parenthesized)||"ArrayExpression"===n.type||("CallExpression"===n.type||"OptionalCallExpression"===n.type)&&n.arguments[r]===o||"right"===r&&"NGPipeExpression"===n.type||"property"===r&&"MemberExpression"===n.type||"AssignmentExpression"===n.type);case"JSXFragment":case"JSXElement":return"callee"===r||"left"===r&&"BinaryExpression"===n.type&&"<"===n.operator||"ArrayExpression"!==n.type&&"ArrowFunctionExpression"!==n.type&&"AssignmentExpression"!==n.type&&"AssignmentPattern"!==n.type&&"BinaryExpression"!==n.type&&"CallExpression"!==n.type&&"NewExpression"!==n.type&&"ConditionalExpression"!==n.type&&"ExpressionStatement"!==n.type&&"JsExpressionRoot"!==n.type&&"JSXAttribute"!==n.type&&"JSXElement"!==n.type&&"JSXExpressionContainer"!==n.type&&"JSXFragment"!==n.type&&"LogicalExpression"!==n.type&&"ObjectProperty"!==n.type&&"OptionalCallExpression"!==n.type&&"Property"!==n.type&&"ReturnStatement"!==n.type&&"ThrowStatement"!==n.type&&"TypeCastExpression"!==n.type&&"VariableDeclarator"!==n.type&&"YieldExpression"!==n.type;case"TypeAnnotation":return"returnType"===r&&"ArrowFunctionExpression"===n.type&&function(e){return kp(e,(e=>"ObjectTypeAnnotation"===e.type&&kp(e,(e=>"FunctionTypeAnnotation"===e.type||void 0))||void 0))}(o)}return!1}function jp(e){const t=e.getValue(),n=e.getParentNode(),r=e.getName();switch(n.type){case"NGPipeExpression":if("number"==typeof r&&n.arguments[r]===t&&n.arguments.length-1===r)return e.callParent(jp);break;case"ObjectProperty":if("value"===r){const t=e.getParentNode(1);return t.properties[t.properties.length-1]===n}break;case"BinaryExpression":case"LogicalExpression":if("right"===r)return e.callParent(jp);break;case"ConditionalExpression":if("alternate"===r)return e.callParent(jp);break;case"UnaryExpression":if(n.prefix)return e.callParent(jp)}return!1}function _p(e,t){const n=e.getValue(),r=e.getParentNode();return"FunctionExpression"===n.type||"ClassExpression"===n.type?"ExportDefaultDeclaration"===r.type||!Mp(e,t):!(!Np(n)||"ExportDefaultDeclaration"!==r.type&&Mp(e,t))&&e.call((e=>_p(e,t)),...Tp(e,n))}var Rp=Mp;const{builders:{concat:Vp,join:$p,line:qp,group:Wp,softline:Up,indent:Jp}}=cn;var zp={isVueEventBindingExpression:function e(t){switch(t.type){case"MemberExpression":switch(t.property.type){case"Identifier":case"NumericLiteral":case"StringLiteral":return e(t.object)}return!1;case"Identifier":return!0;default:return!1}},printHtmlBinding:function(e,t,n){const r=e.getValue();if(t.__onHtmlBindingRoot&&null===e.getName()&&t.__onHtmlBindingRoot(r,t),"File"===r.type)return t.__isVueForBindingLeft?e.call((e=>{const t=$p(Vp([",",qp]),e.map(n,"params")),{params:r}=e.getValue();return 1===r.length?t:Vp(["(",Jp(Vp([Up,Wp(t)])),Up,")"])}),"program","body",0):t.__isVueBindings?e.call((e=>$p(Vp([",",qp]),e.map(n,"params"))),"program","body",0):void 0}};var Hp=function(e,t){switch(t.parser){case"json":case"json5":case"json-stringify":case"__js_expression":case"__vue_expression":return Object.assign({},e,{type:t.parser.startsWith("__")?"JsExpressionRoot":"JsonRoot",node:e,comments:[],rootMarker:t.rootMarker});default:return e}};const{builders:{concat:Gp,group:Xp,indent:Yp,join:Kp,line:Qp,hardline:Zp}}=cn,{hasNewlineBetweenOrAfterDecorators:ed,getParentExportDeclaration:td}=wc;var nd={printOptionalToken:function(e){const t=e.getValue();return!t.optional||"Identifier"===t.type&&t===e.getParentNode().key?"":"OptionalCallExpression"===t.type||"OptionalMemberExpression"===t.type&&t.computed?"?.":"?"},printFunctionTypeParameters:function(e,t,n){const r=e.getValue();return r.typeArguments?e.call(n,"typeArguments"):r.typeParameters?e.call(n,"typeParameters"):""},printBindExpressionCallee:function(e,t,n){return Gp(["::",e.call(n,"callee")])},printTypeScriptModifiers:function(e,t,n){const r=e.getValue();return r.modifiers&&r.modifiers.length?Gp([Kp(" ",e.map(n,"modifiers"))," "]):""},printDecorators:function(e,t,n){const r=e.getValue();return Xp(Gp([Kp(Qp,e.map(n,"decorators")),ed(r,t)?Zp:Qp]))},printFlowDeclaration:function(e,t){const n=td(e);return n?(ta.strictEqual(n.type,"DeclareExportDeclaration"),t):Gp(["declare ",t])},adjustClause:function(e,t,n){return"EmptyStatement"===e.type?";":"BlockStatement"===e.type||n?Gp([" ",t]):Yp(Gp([Qp,t]))}};const{builders:{concat:rd,softline:od,group:ud,indent:id,join:ad,line:sd,ifBreak:cd,hardline:ld}}=cn,{printDanglingComments:pd}=Fa,{hasDanglingComments:dd,shouldPrintComma:fd,needsHardlineAfterDanglingComment:hd}=wc,{locStart:md,hasSameLoc:gd}=ii;function Dd(e,t,n){const r=e.getValue();if(!r.source)return"";const o=[];return Ed(r,t)||o.push(" from"),o.push(" ",e.call(n,"source")),rd(o)}function yd(e,t,n){const r=e.getValue();if(Ed(r,t))return"";const o=[" "];if(r.specifiers&&r.specifiers.length>0){const u=[],i=[];if(e.each((t=>{const r=e.getValue().type;if("ExportNamespaceSpecifier"===r||"ExportDefaultSpecifier"===r||"ImportNamespaceSpecifier"===r||"ImportDefaultSpecifier"===r)u.push(n(t));else{if("ExportSpecifier"!==r&&"ImportSpecifier"!==r)throw new Error("Unknown specifier type ".concat(JSON.stringify(r)));i.push(n(t))}}),"specifiers"),o.push(ad(", ",u)),0!==i.length){0!==u.length&&o.push(", ");i.length>1||u.length>0||r.specifiers.some((e=>e.comments))?o.push(ud(rd(["{",id(rd([t.bracketSpacing?sd:od,ad(rd([",",sd]),i)])),cd(fd(t)?",":""),t.bracketSpacing?sd:od,"}"]))):o.push(rd(["{",t.bracketSpacing?" ":"",rd(i),t.bracketSpacing?" ":"","}"]))}}else o.push("{}");return rd(o)}function Ed(e,t){const{type:n,importKind:r,source:o,specifiers:u}=e;return!("ImportDeclaration"!==n||Array.isArray(u)&&u.length>0||"type"===r)&&!/{\s*}/.test(t.originalText.slice(md(e),md(o)))}function Cd(e,t,n){const r=e.getNode();return Array.isArray(r.assertions)&&0!==r.assertions.length?rd([" assert {",t.bracketSpacing?" ":"",ad(", ",e.map(n,"assertions")),t.bracketSpacing?" ":"","}"]):""}var bd={printImportDeclaration:function(e,t,n){const r=e.getValue(),o=t.semi?";":"",u=[],{importKind:i}=r;return u.push("import"),i&&"value"!==i&&u.push(" ",i),u.push(yd(e,t,n),Dd(e,t,n),Cd(e,t,n)),u.push(o),rd(u)},printExportDeclaration:function(e,t,n){const r=e.getValue(),o=[],{type:u,exportKind:i,declaration:a}=r;return"DeclareExportDeclaration"===u&&o.push("declare "),o.push("export"),(r.default||"ExportDefaultDeclaration"===u)&&o.push(" default"),dd(r)&&(o.push(" ",pd(e,t,!0)),hd(r)&&o.push(ld)),a?o.push(" ",e.call(n,"declaration")):o.push("type"===i?" type":"",yd(e,t,n),Dd(e,t,n),Cd(e,t,n)),function(e,t){if(!t.semi)return!1;const{type:n,declaration:r}=e,o=e.default||"ExportDefaultDeclaration"===n;if(!r)return!0;const{type:u}=r;if(o&&"ClassDeclaration"!==u&&"FunctionDeclaration"!==u&&"TSInterfaceDeclaration"!==u&&"DeclareClass"!==u&&"DeclareFunction"!==u&&"TSDeclareFunction"!==u&&"EnumDeclaration"!==u)return!0;return!1}(r,t)&&o.push(";"),rd(o)},printExportAllDeclaration:function(e,t,n){const r=e.getValue();let o=t.semi?";":"";const u=[],{type:i,exportKind:a,exported:s}=r;return"DeclareExportAllDeclaration"===i&&(u.push("declare "),o=""),u.push("export"),"type"===a&&u.push(" type"),u.push(" *"),s&&u.push(" as ",e.call(n,"exported")),u.push(Dd(e,t,n),Cd(e,t,n),o),rd(u)},printModuleSpecifier:function(e,t,n){const r=e.getNode(),{type:o,importKind:u}=r,i=[];"ImportSpecifier"===o&&u&&i.push(u," ");const a=o.startsWith("Import"),s=a?"imported":"local",c=a?"local":"exported";let l="",p="";return"ExportNamespaceSpecifier"===o||"ImportNamespaceSpecifier"===o?l="*":r[s]&&(l=e.call(n,s)),!r[c]||r[s]&&gd(r[s],r[c])||(p=e.call(n,c)),i.push(l,l&&p?" as ":"",p),rd(i)}};const{hasNewlineInRange:vd}=Lt,{isJSXNode:Ad,isBlockComment:Fd}=wc,{locStart:xd,locEnd:Sd}=ii,{builders:{concat:wd,line:Td,softline:Bd,group:Nd,indent:kd,align:Pd,ifBreak:Od,dedent:Id,breakParent:Ld}}=cn;var Md=function(e,t,n,r){const o=e.getValue(),u=o[r.consequentNodePropertyName],i=o[r.alternateNodePropertyName],a=[];let s=!1;const c=e.getParentNode(),l=c.type===r.conditionalNodeType&&r.testNodePropertyNames.some((e=>c[e]===o));let p,d,f=c.type===r.conditionalNodeType&&!l,h=0;do{d=p||o,p=e.getParentNode(h),h++}while(p&&p.type===r.conditionalNodeType&&r.testNodePropertyNames.every((e=>p[e]!==d)));const m=p||c,g=d;if(r.shouldCheckJsx&&(Ad(o[r.testNodePropertyNames[0]])||Ad(u)||Ad(i)||function(e){return function(e){const t=[];return function e(n){"ConditionalExpression"===n.type?(e(n.test),e(n.consequent),e(n.alternate)):t.push(n)}(e),t}(e).some(Ad)}(g))){s=!0,f=!0;const t=e=>wd([Od("(",""),kd(wd([Bd,e])),Bd,Od(")","")]),o=e=>"NullLiteral"===e.type||"Literal"===e.type&&null===e.value||"Identifier"===e.type&&"undefined"===e.name;a.push(" ? ",o(u)?e.call(n,r.consequentNodePropertyName):t(e.call(n,r.consequentNodePropertyName))," : ",i.type===r.conditionalNodeType||o(i)?e.call(n,r.alternateNodePropertyName):t(e.call(n,r.alternateNodePropertyName)))}else{const s=wd([Td,"? ",u.type===r.conditionalNodeType?Od("","("):"",Pd(2,e.call(n,r.consequentNodePropertyName)),u.type===r.conditionalNodeType?Od("",")"):"",Td,": ",i.type===r.conditionalNodeType?e.call(n,r.alternateNodePropertyName):Pd(2,e.call(n,r.alternateNodePropertyName))]);a.push(c.type!==r.conditionalNodeType||c[r.alternateNodePropertyName]===o||l?s:t.useTabs?Id(kd(s)):Pd(Math.max(0,t.tabWidth-2),s))}const D=Yu([...r.testNodePropertyNames.map((e=>o[e].comments)),u.comments,i.comments]).filter(Boolean).some((e=>Fd(e)&&vd(t.originalText,xd(e),Sd(e)))),y=!s&&("MemberExpression"===c.type||"OptionalMemberExpression"===c.type||"NGPipeExpression"===c.type&&c.left===o)&&!c.computed,E=(e=>c===m?Nd(e,{shouldBreak:D}):D?wd([e,Ld]):e)(wd([].concat((C=wd(r.beforeParts()),c.type===r.conditionalNodeType&&c[r.alternateNodePropertyName]===o?Pd(2,C):C),f?wd(a):kd(wd(a)),r.afterParts(y))));var C;return l?Nd(wd([kd(wd([Bd,E])),Bd])):E};const{getNextNonSpaceNonCommentCharacter:jd,isNextLineEmpty:_d}=Lt,{printDanglingComments:Rd}=Fa,{builders:{concat:Vd,line:$d,hardline:qd,softline:Wd,group:Ud,indent:Jd,ifBreak:zd},utils:{removeLines:Hd}}=cn,{getFunctionParameters:Gd,iterateFunctionParametersPath:Xd,isSimpleType:Yd,isTestCall:Kd,isTypeAnnotationAFunction:Qd,isObjectType:Zd,isObjectTypePropertyAFunction:ef,hasRestParameter:tf,shouldPrintComma:nf}=wc,{locEnd:rf}=ii,{printFunctionTypeParameters:of}=nd;function uf(e){if(!e)return!1;const t=Gd(e);if(1!==t.length)return!1;const[n]=t;return!n.comments&&("ObjectPattern"===n.type||"ArrayPattern"===n.type||"Identifier"===n.type&&n.typeAnnotation&&("TypeAnnotation"===n.typeAnnotation.type||"TSTypeAnnotation"===n.typeAnnotation.type)&&Zd(n.typeAnnotation.typeAnnotation)||"FunctionTypeParam"===n.type&&Zd(n.typeAnnotation)||"AssignmentPattern"===n.type&&("ObjectPattern"===n.left.type||"ArrayPattern"===n.left.type)&&("Identifier"===n.right.type||"ObjectExpression"===n.right.type&&0===n.right.properties.length||"ArrayExpression"===n.right.type&&0===n.right.elements.length))}var af={printFunctionParameters:function(e,t,n,r,o){const u=e.getValue(),i=Gd(u),a=o?of(e,n,t):"";if(0===i.length)return Vd([a,"(",Rd(e,n,!0,(e=>")"===jd(n.originalText,e,rf))),")"]);const s=e.getParentNode(),c=Kd(s),l=uf(u),p=r&&!i.some((e=>e.comments)),d=[];if(Xd(e,((e,r)=>{const o=r===i.length-1;o&&u.rest&&d.push("..."),d.push(e.call(t)),o||(d.push(","),c||l||p?d.push(" "):_d(n.originalText,i[r],rf)?d.push(qd,qd):d.push($d))})),p)return Ud(Vd([Hd(a),"(",Vd(d.map(Hd)),")"]));const f=i.every((e=>!e.decorators));return l&&f||c?Vd([a,"(",Vd(d),")"]):(ef(s)||Qd(s)||"TypeAlias"===s.type||"UnionTypeAnnotation"===s.type||"TSUnionType"===s.type||"IntersectionTypeAnnotation"===s.type||"FunctionTypeAnnotation"===s.type&&s.returnType===u)&&1===i.length&&null===i[0].name&&u.this!==i[0]&&i[0].typeAnnotation&&null===u.typeParameters&&Yd(i[0].typeAnnotation)&&!u.rest?"always"===n.arrowParens?Vd(["(",Vd(d),")"]):Vd(d):Vd([a,"(",Jd(Vd([Wd,Vd(d)])),zd(!tf(u)&&nf(n,"all")?",":""),Wd,")"])},shouldHugFunctionParameters:uf};const{builders:{concat:sf}}=cn,{isFlowAnnotationComment:cf,isSimpleType:lf,isObjectType:pf}=wc;var df={printTypeAnnotation:function(e,t,n){const r=e.getValue();if(!r.typeAnnotation)return"";const o=e.getParentNode(),u=r.definite||o&&"VariableDeclarator"===o.type&&o.definite,i="DeclareFunction"===o.type&&o.id===r;return cf(t.originalText,r.typeAnnotation)?sf([" /*: ",e.call(n,"typeAnnotation")," */"]):sf([i?"":u?"!: ":": ",e.call(n,"typeAnnotation")])},shouldHugType:function(e){if(lf(e)||pf(e))return!0;if("UnionTypeAnnotation"===e.type||"TSUnionType"===e.type){const t=e.types.filter((e=>"VoidTypeAnnotation"===e.type||"TSVoidKeyword"===e.type||"NullLiteralTypeAnnotation"===e.type||"TSNullKeyword"===e.type)).length,n=e.types.some((e=>"ObjectTypeAnnotation"===e.type||"TSTypeLiteral"===e.type||"GenericTypeAnnotation"===e.type||"TSTypeReference"===e.type));if(e.types.length-1===t&&n)return!0}return!1}};const{printDanglingComments:ff}=Fa,{builders:{concat:hf,line:mf,softline:gf,group:Df,indent:yf,ifBreak:Ef}}=cn,{getLast:Cf,isNextLineEmpty:bf}=Lt,{hasDanglingComments:vf,shouldPrintComma:Af}=wc,{locEnd:Ff}=ii,{printOptionalToken:xf}=nd,{printTypeAnnotation:Sf}=df;function wf(e,t,n,r){const o=[];let u=[];return e.each((e=>{o.push(hf(u)),o.push(Df(r(e))),u=[",",mf],e.getValue()&&bf(t.originalText,e.getValue(),Ff)&&u.push(gf)}),n),hf(o)}var Tf={printArray:function(e,t,n){const r=e.getValue(),o=[],u="TupleExpression"===r.type?"#[":"[";if(0===r.elements.length)vf(r)?o.push(Df(hf([u,ff(e,t),gf,"]"]))):o.push(u,"]");else{const i=Cf(r.elements),a=!(i&&"RestElement"===i.type),s=a&&null===i,c=!t.__inJestEach&&r.elements.length>1&&r.elements.every(((e,t,n)=>{const r=e&&e.type;if("ArrayExpression"!==r&&"ObjectExpression"!==r)return!1;const o=n[t+1];if(o&&r!==o.type)return!1;const u="ArrayExpression"===r?"elements":"properties";return e[u]&&e[u].length>1}));o.push(Df(hf([u,yf(hf([gf,wf(e,t,"elements",n)])),s?",":"",Ef(a&&!s&&Af(t)?",":""),ff(e,t,!0),gf,"]"]),{shouldBreak:c}))}return o.push(xf(e),Sf(e,t,n)),hf(o)},printArrayItems:wf};const{printDanglingComments:Bf}=Fa,{builders:{concat:Nf,line:kf,softline:Pf,group:Of,indent:If,ifBreak:Lf,hardline:Mf}}=cn,{getLast:jf,isNextLineEmpty:_f,hasNewlineInRange:Rf,hasNewline:Vf}=Lt,{hasDanglingComments:$f,shouldPrintComma:qf,hasNodeIgnoreComment:Wf,isBlockComment:Uf}=wc,{locStart:Jf,locEnd:zf}=ii,{printOptionalToken:Hf}=nd,{shouldHugFunctionParameters:Gf}=af,{printTypeAnnotation:Xf,shouldHugType:Yf}=df;var Kf={printObject:function(e,t,n){const r=t.semi?";":"",o=e.getValue();let u;u="TSTypeLiteral"===o.type?"members":"TSInterfaceBody"===o.type?"body":"properties";const i="ObjectTypeAnnotation"===o.type,a=[];i&&a.push("indexers","callProperties","internalSlots"),a.push(u);const s=a.map((e=>o[e][0])).sort(((e,t)=>Jf(e)-Jf(t)))[0],c=e.getParentNode(0),l=i&&c&&("InterfaceDeclaration"===c.type||"DeclareInterface"===c.type||"DeclareClass"===c.type)&&"body"===e.getName(),p="TSInterfaceBody"===o.type||l||"ObjectPattern"===o.type&&"FunctionDeclaration"!==c.type&&"FunctionExpression"!==c.type&&"ArrowFunctionExpression"!==c.type&&"ObjectMethod"!==c.type&&"ClassMethod"!==c.type&&"ClassPrivateMethod"!==c.type&&"AssignmentPattern"!==c.type&&"CatchClause"!==c.type&&o.properties.some((e=>e.value&&("ObjectPattern"===e.value.type||"ArrayPattern"===e.value.type)))||"ObjectPattern"!==o.type&&s&&Rf(t.originalText,Jf(o),Jf(s)),d=l?";":"TSInterfaceBody"===o.type||"TSTypeLiteral"===o.type?Lf(r,";"):",",f="RecordExpression"===o.type?"#{":o.exact?"{|":"{",h=o.exact?"|}":"}",m=[];a.forEach((t=>{e.each((e=>{const t=e.getValue();m.push({node:t,printed:n(e),loc:Jf(t)})}),t)}));let g=[];const D=m.sort(((e,t)=>e.loc-t.loc)).map((e=>{const n=Nf(g.concat(Of(e.printed)));return g=[d,kf],"TSPropertySignature"!==e.node.type&&"TSMethodSignature"!==e.node.type&&"TSConstructSignatureDeclaration"!==e.node.type||!Wf(e.node)||g.shift(),_f(t.originalText,e.node,zf)&&g.push(Mf),n}));if(o.inexact){let n;if($f(o)){const r=!o.comments.every((e=>Uf(e))),u=Bf(e,t,!0);n=Nf([u,r||Vf(t.originalText,zf(o.comments[o.comments.length-1]))?Mf:kf,"..."])}else n="...";D.push(Nf(g.concat(n)))}const y=jf(o[u]),E=!(o.inexact||y&&"RestElement"===y.type||y&&("TSPropertySignature"===y.type||"TSCallSignatureDeclaration"===y.type||"TSMethodSignature"===y.type||"TSConstructSignatureDeclaration"===y.type)&&Wf(y));let C;if(0===D.length){if(!$f(o))return Nf([f,h,Xf(e,t,n)]);C=Of(Nf([f,Bf(e,t),Pf,h,Hf(e),Xf(e,t,n)]))}else C=Nf([f,If(Nf([t.bracketSpacing?kf:Pf,Nf(D)])),Lf(E&&(","!==d||qf(t))?d:""),Nf([t.bracketSpacing?kf:Pf,h]),Hf(e),Xf(e,t,n)]);return e.match((e=>"ObjectPattern"===e.type&&!e.decorators),((e,t,n)=>Gf(e)&&("params"===t||"parameters"===t||"this"===t||"rest"===t)&&0===n))||e.match(Yf,((e,t)=>"typeAnnotation"===t),((e,t)=>"typeAnnotation"===t),((e,t,n)=>Gf(e)&&("params"===t||"parameters"===t||"this"===t||"rest"===t)&&0===n))?C:Of(C,{shouldBreak:p})}};const{printComments:Qf,printDanglingComments:Zf}=Fa,{builders:{concat:eh,line:th,hardline:nh,softline:rh,group:oh,indent:uh,conditionalGroup:ih,fill:ah,ifBreak:sh,lineSuffixBoundary:ch},utils:{willBreak:lh,isLineNext:ph,isEmpty:dh}}=cn,{getLast:fh,getPreferredQuote:hh}=Lt,{hasTrailingComment:mh,isEmptyJSXElement:gh,isJSXWhitespaceExpression:Dh,isJSXNode:yh,isMeaningfulJSXText:Eh,matchJsxWhitespaceRegex:Ch,rawText:bh,isLiteral:vh,isCallOrOptionalCallExpression:Ah,isStringLiteral:Fh,isBinaryish:xh,isBlockComment:Sh}=wc,{willPrintOwnComments:wh}=il;function Th(e,t,n){const r=e.getValue();if("JSXElement"===r.type&&gh(r))return eh([e.call(n,"openingElement"),e.call(n,"closingElement")]);const o="JSXElement"===r.type?e.call(n,"openingElement"):e.call(n,"openingFragment"),u="JSXElement"===r.type?e.call(n,"closingElement"):e.call(n,"closingFragment");if(1===r.children.length&&"JSXExpressionContainer"===r.children[0].type&&("TemplateLiteral"===r.children[0].expression.type||"TaggedTemplateExpression"===r.children[0].expression.type))return eh([o,eh(e.map(n,"children")),u]);r.children=r.children.map((e=>Dh(e)?{type:"JSXText",value:" ",raw:" "}:e));const i=r.children.filter(yh).length>0,a=r.children.filter((e=>"JSXExpressionContainer"===e.type)).length>1,s="JSXElement"===r.type&&r.openingElement.attributes.length>1;let c=lh(o)||i||s||a;const l="mdx"===e.getParentNode().rootMarker,p=t.singleQuote?"{' '}":'{" "}',d=l?eh([" "]):sh(eh([p,rh])," "),f=r.openingElement&&r.openingElement.name&&"fbt"===r.openingElement.name.name,h=function(e,t,n,r,o){const u=e.getValue(),i=[];return e.each(((e,t)=>{const a=e.getValue();if(vh(a)){const e=bh(a);if(Eh(a)){const n=e.split(Ch);if(""===n[0]){if(i.push(""),n.shift(),/\n/.test(n[0])){const e=u.children[t+1];i.push(Nh(o,n[1],a,e))}else i.push(r);n.shift()}let s;if(""===fh(n)&&(n.pop(),s=n.pop()),0===n.length)return;if(n.forEach(((e,t)=>{t%2==1?i.push(th):i.push(e)})),void 0!==s)if(/\n/.test(s)){const e=u.children[t+1];i.push(Nh(o,fh(i),a,e))}else i.push(r);else{const e=u.children[t+1];i.push(Bh(o,fh(i),a,e))}}else/\n/.test(e)?e.match(/\n/g).length>1&&(i.push(""),i.push(nh)):(i.push(""),i.push(r))}else{const r=n(e);i.push(r);const s=u.children[t+1];if(s&&Eh(s)){const e=bh(s).trim().split(Ch)[0];i.push(Bh(o,e,a,s))}else i.push(nh)}}),"children"),i}(e,0,n,d,f),m=r.children.some((e=>Eh(e)));for(let e=h.length-2;e>=0;e--){const t=""===h[e]&&""===h[e+1],n=h[e]===nh&&""===h[e+1]&&h[e+2]===nh,r=(h[e]===rh||h[e]===nh)&&""===h[e+1]&&h[e+2]===d,o=h[e]===d&&""===h[e+1]&&(h[e+2]===rh||h[e+2]===nh),u=h[e]===d&&""===h[e+1]&&h[e+2]===d,i=h[e]===rh&&""===h[e+1]&&h[e+2]===nh||h[e]===nh&&""===h[e+1]&&h[e+2]===rh;n&&m||t||r||u||i?h.splice(e,2):o&&h.splice(e+1,2)}for(;h.length&&(ph(fh(h))||dh(fh(h)));)h.pop();for(;h.length&&(ph(h[0])||dh(h[0]))&&(ph(h[1])||dh(h[1]));)h.shift(),h.shift();const g=[];h.forEach(((e,t)=>{if(e===d){if(1===t&&""===h[t-1])return 2===h.length?void g.push(p):void g.push(eh([p,nh]));if(t===h.length-1)return void g.push(p);if(""===h[t-1]&&h[t-2]===nh)return void g.push(p)}g.push(e),lh(e)&&(c=!0)}));const D=m?ah(g):oh(eh(g),{shouldBreak:!0});if(l)return D;const y=oh(eh([o,uh(eh([nh,D])),nh,u]));return c?y:ih([oh(eh([o,eh(h),u])),y])}function Bh(e,t,n,r){return e?"":"JSXElement"===n.type&&!n.closingElement||r&&"JSXElement"===r.type&&!r.closingElement?1===t.length?rh:nh:rh}function Nh(e,t,n,r){return e?nh:1===t.length?"JSXElement"===n.type&&!n.closingElement||r&&"JSXElement"===r.type&&!r.closingElement?nh:rh:nh}function kh(e,t,n){const r=e.getValue();return eh(["{",e.call((e=>{const r=eh(["...",n(e)]),o=e.getValue();return o.comments&&o.comments.length&&wh(e)?eh([uh(eh([rh,Qf(e,(()=>r),t)])),rh]):r}),"JSXSpreadAttribute"===r.type?"argument":"expression"),"}"])}var Ph={printJsxElement:function(e,t,n){const r=Qf(e,(()=>Th(e,t,n)),t);return function(e,t,n){const r=e.getParentNode();if(!r)return t;if({ArrayExpression:!0,JSXAttribute:!0,JSXElement:!0,JSXExpressionContainer:!0,JSXFragment:!0,ExpressionStatement:!0,CallExpression:!0,OptionalCallExpression:!0,ConditionalExpression:!0,JsExpressionRoot:!0}[r.type])return t;const o=e.match(void 0,(e=>"ArrowFunctionExpression"===e.type),Ah,(e=>"JSXExpressionContainer"===e.type)),u=Rp(e,n);return oh(eh([u?"":sh("("),uh(eh([rh,t])),rh,u?"":sh(")")]),{shouldBreak:o})}(e,r,t)},printJsxAttribute:function(e,t,n){const r=e.getValue(),o=[];if(o.push(e.call(n,"name")),r.value){let u;if(Fh(r.value)){let e=bh(r.value).replace(/'/g,"'").replace(/"/g,'"');const n=hh(e,t.jsxSingleQuote?"'":'"'),o="'"===n?"'":""";e=e.slice(1,-1).replace(new RegExp(n,"g"),o),u=eh([n,e,n])}else u=e.call(n,"value");o.push("=",u)}return eh(o)},printJsxOpeningElement:function(e,t,n){const r=e.getValue(),o=r.name&&r.name.comments&&r.name.comments.length>0||r.typeParameters&&r.typeParameters.comments&&r.typeParameters.comments.length>0;if(r.selfClosing&&!r.attributes.length&&!o)return eh(["<",e.call(n,"name"),e.call(n,"typeParameters")," />"]);if(r.attributes&&1===r.attributes.length&&r.attributes[0].value&&Fh(r.attributes[0].value)&&!r.attributes[0].value.value.includes("\n")&&!o&&(!r.attributes[0].comments||!r.attributes[0].comments.length))return oh(eh(["<",e.call(n,"name"),e.call(n,"typeParameters")," ",eh(e.map(n,"attributes")),r.selfClosing?" />":">"]));const u=r.attributes.length&&mh(fh(r.attributes)),i=!r.attributes.length&&!o||t.jsxBracketSameLine&&(!o||r.attributes.length)&&!u,a=r.attributes&&r.attributes.some((e=>e.value&&Fh(e.value)&&e.value.value.includes("\n")));return oh(eh(["<",e.call(n,"name"),e.call(n,"typeParameters"),eh([uh(eh(e.map((e=>eh([th,n(e)])),"attributes"))),r.selfClosing?th:i?">":rh]),r.selfClosing?"/>":i?"":">"]),{shouldBreak:a})},printJsxClosingElement:function(e,t,n){return eh(["</",e.call(n,"name"),">"])},printJsxOpeningClosingFragment:function(e,t){const n=e.getValue(),r=n.comments&&n.comments.length,o=r&&!n.comments.every((e=>Sh(e))),u="JSXOpeningFragment"===n.type;return eh([u?"<":"</",uh(eh([o?nh:r&&!u?" ":"",Zf(e,t,!0)])),o?nh:"",">"])},printJsxExpressionContainer:function(e,t,n){const r=e.getValue(),o=e.getParentNode(0),u=r.expression.comments&&r.expression.comments.length>0,i="JSXEmptyExpression"===r.expression.type||!u&&("ArrayExpression"===r.expression.type||"ObjectExpression"===r.expression.type||"ArrowFunctionExpression"===r.expression.type||"CallExpression"===r.expression.type||"OptionalCallExpression"===r.expression.type||"FunctionExpression"===r.expression.type||"TemplateLiteral"===r.expression.type||"TaggedTemplateExpression"===r.expression.type||"DoExpression"===r.expression.type||yh(o)&&("ConditionalExpression"===r.expression.type||xh(r.expression)));return oh(eh(i?["{",e.call(n,"expression"),ch,"}"]:["{",uh(eh([rh,e.call(n,"expression")])),rh,ch,"}"]))},printJsxEmptyExpression:function(e,t){const n=e.getValue(),r=n.comments&&!n.comments.every((e=>Sh(e)));return eh([Zf(e,t,!r),r?nh:""])},printJsxSpreadAttribute:kh,printJsxSpreadChild:kh};const{printDanglingComments:Oh}=Fa,{builders:{concat:Ih,join:Lh,line:Mh,hardline:jh,softline:_h,group:Rh,indent:Vh,ifBreak:$h}}=cn,{hasDanglingComments:qh,isTestCall:Wh,isBlockComment:Uh,shouldPrintComma:Jh}=wc,{shouldHugType:zh}=df,Hh=new WeakMap;function Gh(e){return Hh.has(e)||Hh.set(e,Symbol("typeParameters")),Hh.get(e)}function Xh(e,t){const n=e.getValue();if(!qh(n))return"";const r=n.comments.every((e=>Uh(e))),o=Oh(e,t,r);return r?o:Ih([o,jh])}var Yh={printTypeParameters:function(e,t,n,r){const o=e.getValue();if(!o[r])return"";if(!Array.isArray(o[r]))return e.call(n,r);const u=e.getNode(2);return null!=u&&Wh(u)||0===o[r].length||1===o[r].length&&(zh(o[r][0])||"GenericTypeAnnotation"===o[r][0].type&&zh(o[r][0].id)||"TSTypeReference"===o[r][0].type&&zh(o[r][0].typeName)||"NullableTypeAnnotation"===o[r][0].type)?Ih(["<",Lh(", ",e.map(n,r)),Xh(e,t),">"]):Rh(Ih(["<",Vh(Ih([_h,Lh(Ih([",",Mh]),e.map(n,r))])),$h("typescript"!==t.parser&&"babel-ts"!==t.parser&&Jh(t,"all")?",":""),_h,">"]),{id:Gh(o)})},getTypeParametersGroupId:Gh};const{printComments:Kh}=Fa,{printString:Qh,printNumber:Zh}=Lt,{builders:{concat:em}}=cn,{isNumericLiteral:tm,isSimpleNumber:nm,isStringLiteral:rm,isStringPropSafeToUnquote:om,rawText:um}=wc,im=new WeakMap;var am={printPropertyKey:function(e,t,n){const r=e.getNode();if(r.computed)return em(["[",e.call(n,"key"),"]"]);const o=e.getParentNode(),{key:u}=r;if("ClassPrivateProperty"===r.type&&"Identifier"===u.type)return em(["#",e.call(n,"key")]);if("consistent"===t.quoteProps&&!im.has(o)){const e=(o.properties||o.body||o.members).some((e=>!e.computed&&e.key&&rm(e.key)&&!om(e,t)));im.set(o,e)}if(("Identifier"===u.type||tm(u)&&nm(Zh(um(u)))&&String(u.value)===Zh(um(u))&&"typescript"!==t.parser&&"babel-ts"!==t.parser)&&("json"===t.parser||"consistent"===t.quoteProps&&im.get(o))){const n=Qh(JSON.stringify("Identifier"===u.type?u.name:u.value.toString()),t);return e.call((e=>Kh(e,(()=>n),t)),"key")}return om(r,t)&&("as-needed"===t.quoteProps||"consistent"===t.quoteProps&&!im.get(o))?e.call((e=>Kh(e,(()=>/^\d/.test(u.value)?Zh(u.value):u.value),t)),"key"):e.call(n,"key")}};const{printDanglingComments:sm}=Fa,{getNextNonSpaceNonCommentCharacterIndex:cm}=Lt,{builders:{concat:lm,line:pm,softline:dm,group:fm,indent:hm,ifBreak:mm,hardline:gm}}=cn,{getFunctionParameters:Dm,hasDanglingComments:ym,hasLeadingOwnLineComment:Em,isFlowAnnotationComment:Cm,isJSXNode:bm,isTemplateOnItsOwnLine:vm,shouldPrintComma:Am,startsWithNoLookaheadToken:Fm,returnArgumentHasLeadingComment:xm,isBinaryish:Sm,isLineComment:wm}=wc,{locEnd:Tm}=ii,{printFunctionParameters:Bm}=af,{printPropertyKey:Nm}=am,{printFunctionTypeParameters:km}=nd;function Pm(e,t,n){const r=[km(e,t,n),fm(lm([Bm(e,n,t),Im(e,n,t)]))];return e.getNode().body?r.push(" ",e.call(n,"body")):r.push(t.semi?";":""),lm(r)}function Om(e,t){if("always"===t.arrowParens)return!1;if("avoid"===t.arrowParens){return function(e){const t=Dm(e);return!(1!==t.length||e.typeParameters||ym(e)||"Identifier"!==t[0].type||t[0].typeAnnotation||t[0].comments||t[0].optional||e.predicate||e.returnType)}(e.getValue())}return!1}function Im(e,t,n){const r=e.getValue(),o=e.call(t,"returnType");if(r.returnType&&Cm(n.originalText,r.returnType))return lm([" /*: ",o," */"]);const u=[o];return r.returnType&&r.returnType.typeAnnotation&&u.unshift(": "),r.predicate&&u.push(r.returnType?" ":": ",e.call(t,"predicate")),lm(u)}var Lm={printFunctionDeclaration:function(e,t,n,r){const o=e.getValue(),u=[];return o.async&&u.push("async "),o.generator?u.push("function* "):u.push("function "),o.id&&u.push(e.call(t,"id")),u.push(km(e,n,t),fm(lm([Bm(e,t,n,r),Im(e,t,n)])),o.body?" ":"",e.call(t,"body")),lm(u)},printArrowFunctionExpression:function(e,t,n,r){const o=e.getValue(),u=[];o.async&&u.push("async "),Om(e,t)?u.push(e.call(n,"params",0)):u.push(fm(lm([Bm(e,n,t,r&&(r.expandLastArg||r.expandFirstArg),!0),Im(e,n,t)])));const i=sm(e,t,!0,(e=>{const n=cm(t.originalText,e,Tm);return!1!==n&&"=>"===t.originalText.slice(n,n+2)}));i&&u.push(" ",i),u.push(" =>");const a=e.call((e=>n(e,r)),"body");if(!Em(t.originalText,o.body)&&("ArrayExpression"===o.body.type||"ObjectExpression"===o.body.type||"BlockStatement"===o.body.type||bm(o.body)||vm(o.body,t.originalText)||"ArrowFunctionExpression"===o.body.type||"DoExpression"===o.body.type))return fm(lm([lm(u)," ",a]));if("SequenceExpression"===o.body.type)return fm(lm([lm(u),fm(lm([" (",hm(lm([dm,a])),dm,")"]))]));const s=(r&&r.expandLastArg||"JSXExpressionContainer"===e.getParentNode().type)&&!(o.comments&&o.comments.length),c=r&&r.expandLastArg&&Am(t,"all"),l="ConditionalExpression"===o.body.type&&!Fm(o.body,!1);return fm(lm([lm(u),fm(lm([hm(lm([pm,l?mm("","("):"",a,l?mm("",")"):""])),s?lm([mm(c?",":""),dm]):""]))]))},printMethod:function(e,t,n){const r=e.getNode(),{kind:o}=r,u=r.value||r,i=[];return o&&"init"!==o&&"method"!==o&&"constructor"!==o?(ta.ok("get"===o||"set"===o),i.push(o," ")):u.async&&i.push("async "),u.generator&&i.push("*"),i.push(Nm(e,t,n),r.optional||r.key.optional?"?":"",r===u?Pm(e,t,n):e.call((e=>Pm(e,t,n)),"value")),lm(i)},printReturnAndThrowArgument:function(e,t,n){const r=e.getValue(),o=t.semi?";":"",u=[];r.argument&&(xm(t,r.argument)?u.push(lm([" (",hm(lm([gm,e.call(n,"argument")])),gm,")"])):Sm(r.argument)||"SequenceExpression"===r.argument.type?u.push(fm(lm([mm(" ("," "),hm(lm([dm,e.call(n,"argument")])),dm,mm(")")]))):u.push(" ",e.call(n,"argument")));const i=Array.isArray(r.comments)&&r.comments[r.comments.length-1],a=i&&wm(i);return a&&u.push(o),ym(r)&&u.push(" ",sm(e,t,!0)),a||u.push(o),lm(u)},shouldPrintParamsWithoutParens:Om};const{printComments:Mm,printDanglingComments:jm}=Fa,{builders:{concat:_m,join:Rm,line:Vm,hardline:$m,softline:qm,group:Wm,indent:Um,ifBreak:Jm}}=cn,{hasTrailingComment:zm,hasTrailingLineComment:Hm}=wc,{getTypeParametersGroupId:Gm}=Yh,{printMethod:Xm}=Lm,{printDecorators:Ym}=nd;function Km(e){return e.typeParameters&&!Hm(e.typeParameters)&&!function(e){return["superClass","extends","mixins","implements"].filter((t=>!!e[t])).length>1}(e)}function Qm(e,t,n,r){const o=e.getValue();if(!o[r]||0===o[r].length)return"";const u=jm(e,t,!0,(({marker:e})=>e===r));return _m([Km(o)?Jm(" ",Vm,{groupId:Gm(o.typeParameters)}):Vm,u,u&&$m,r,Wm(Um(_m([Vm,Rm(_m([",",Vm]),e.map(n,r))])))])}function Zm(e,t,n){const r=e.call(n,"superClass");return"AssignmentExpression"===e.getParentNode().type?Wm(Jm(_m(["(",Um(_m([qm,r])),qm,")"]),r)):r}var eg={printClass:function(e,t,n){const r=e.getValue(),o=[];r.abstract&&o.push("abstract "),o.push("class");const u=r.id&&zm(r.id)||r.superClass&&r.superClass.comments&&0!==r.superClass.comments.length||r.extends&&0!==r.extends.length||r.mixins&&0!==r.mixins.length||r.implements&&0!==r.implements.length,i=[],a=[];if(r.id&&i.push(" ",e.call(n,"id")),i.push(e.call(n,"typeParameters")),r.superClass){const r=_m(["extends ",Zm(e,t,n),e.call(n,"superTypeParameters")]),o=e.call((e=>Mm(e,(()=>r),t)),"superClass");u?a.push(Vm,Wm(o)):a.push(" ",o)}else a.push(Qm(e,t,n,"extends"));if(a.push(Qm(e,t,n,"mixins")),a.push(Qm(e,t,n,"implements")),u){const e=_m(a);Km(r)?o.push(Wm(_m(i.concat(Jm(Um(e),e))))):o.push(Wm(Um(_m(i.concat(e)))))}else o.push(...i,...a);return o.push(" ",e.call(n,"body")),_m(o)},printClassMethod:function(e,t,n){const r=e.getValue(),o=[];return r.decorators&&0!==r.decorators.length&&o.push(Ym(e,t,n)),r.accessibility&&o.push(r.accessibility+" "),r.static&&o.push("static "),("TSAbstractMethodDefinition"===r.type||r.abstract)&&o.push("abstract "),o.push(Xm(e,t,n)),_m(o)}};const{getLast:tg,getPenultimate:ng,isNextLineEmpty:rg}=Lt,{getFunctionParameters:og,iterateFunctionParametersPath:ug,hasLeadingComment:ig,hasTrailingComment:ag,isFunctionCompositionArgs:sg,isJSXNode:cg,isLongCurriedCallExpression:lg,shouldPrintComma:pg,getCallArguments:dg,iterateCallArgumentsPath:fg}=wc,{locEnd:hg}=ii,{builders:{concat:mg,line:gg,hardline:Dg,softline:yg,group:Eg,indent:Cg,conditionalGroup:bg,ifBreak:vg,breakParent:Ag},utils:{willBreak:Fg}}=cn;function xg(e){return"ObjectExpression"===e.type&&(e.properties.length>0||e.comments)||"ArrayExpression"===e.type&&(e.elements.length>0||e.comments)||"TSTypeAssertion"===e.type&&xg(e.expression)||"TSAsExpression"===e.type&&xg(e.expression)||"FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type&&(!e.returnType||!e.returnType.typeAnnotation||"TSTypeReference"!==e.returnType.typeAnnotation.type)&&("BlockStatement"===e.body.type||"ArrowFunctionExpression"===e.body.type||"ObjectExpression"===e.body.type||"ArrayExpression"===e.body.type||"CallExpression"===e.body.type||"OptionalCallExpression"===e.body.type||"ConditionalExpression"===e.body.type||cg(e.body))}var Sg=function(e,t,n){const r=e.getValue(),o="ImportExpression"===r.type,u=dg(r);if(0===u.length)return mg(["(",Fa.printDanglingComments(e,t,!0),")"]);if(2===u.length&&"ArrowFunctionExpression"===u[0].type&&0===og(u[0]).length&&"BlockStatement"===u[0].body.type&&"ArrayExpression"===u[1].type&&!u.some((e=>e.comments)))return mg(["(",e.call(n,"arguments",0),", ",e.call(n,"arguments",1),")"]);let i=!1,a=!1,s=!1;const c=u.length-1,l=[];fg(e,((e,r)=>{const o=e.getNode(),u=[n(e)];r===c||(rg(t.originalText,o,hg)?(0===r&&(s=!0),i=!0,u.push(",",Dg,Dg)):u.push(",",gg)),a=function(e,t){if(!e||"ArrowFunctionExpression"!==e.type||!e.body||"BlockStatement"!==e.body.type||0===og(e).length)return!1;let r=!1;return ug(t,(e=>{r=r||Fg(mg([n(e)]))})),r}(o,e),l.push(mg(u))}));const p=o||r.callee&&"Import"===r.callee.type||!pg(t,"all")?"":",";function d(){return Eg(mg(["(",Cg(mg([gg,mg(l)])),p,gg,")"]),{shouldBreak:!0})}if("Decorator"!==e.getParentNode().type&&sg(u))return d();const f=function(e){if(2!==e.length)return!1;const[t,n]=e;return!(t.comments&&t.comments.length||"FunctionExpression"!==t.type&&("ArrowFunctionExpression"!==t.type||"BlockStatement"!==t.body.type)||"FunctionExpression"===n.type||"ArrowFunctionExpression"===n.type||"ConditionalExpression"===n.type||xg(n))}(u),h=function(e){const t=tg(e),n=ng(e);return!ig(t)&&!ag(t)&&xg(t)&&(!n||n.type!==t.type)}(u);if(f||h){const t=(f?l.slice(1).some(Fg):l.slice(0,-1).some(Fg))||i||a;let o=[];fg(e,((e,t)=>{f&&0===t&&(o=[mg([e.call((e=>n(e,{expandFirstArg:!0}))),l.length>1?",":"",s?Dg:gg,s?Dg:""])].concat(l.slice(1))),h&&t===u.length-1&&(o=l.slice(0,-1).concat(e.call((e=>n(e,{expandLastArg:!0})))))}));const c=l.some(Fg),p=mg(["(",mg(o),")"]);return mg([c?Ag:"",bg([c||r.typeArguments||r.typeParameters?vg(d(),p):p,mg(f?["(",Eg(o[0],{shouldBreak:!0}),mg(o.slice(1)),")"]:["(",mg(l.slice(0,-1)),Eg(tg(o),{shouldBreak:!0}),")"]),d()],{shouldBreak:t})])}const m=mg(["(",Cg(mg([yg,mg(l)])),vg(p),yg,")"]);return lg(e)?m:Eg(m,{shouldBreak:l.some(Fg)||i})};const{builders:{concat:wg,softline:Tg,group:Bg,indent:Ng}}=cn,{isNumericLiteral:kg}=wc,{printOptionalToken:Pg}=nd;function Og(e,t,n){const r=e.call(n,"property"),o=e.getValue(),u=Pg(e);return o.computed?!o.property||kg(o.property)?wg([u,"[",r,"]"]):Bg(wg([u,"[",Ng(wg([Tg,r])),Tg,"]"])):wg([u,".",r])}var Ig={printMemberExpression:function(e,t,n){const r=e.getValue(),o=e.getParentNode();let u,i=0;do{u=e.getParentNode(i),i++}while(u&&("MemberExpression"===u.type||"OptionalMemberExpression"===u.type||"TSNonNullExpression"===u.type));const a=u&&("NewExpression"===u.type||"BindExpression"===u.type||"VariableDeclarator"===u.type&&"Identifier"!==u.id.type||"AssignmentExpression"===u.type&&"Identifier"!==u.left.type)||r.computed||"Identifier"===r.object.type&&"Identifier"===r.property.type&&"MemberExpression"!==o.type&&"OptionalMemberExpression"!==o.type;return wg([e.call(n,"object"),a?Og(e,t,n):Bg(Ng(wg([Tg,Og(e,t,n)])))])},printMemberLookup:Og};const{getLast:Lg,isNextLineEmpty:Mg,isNextLineEmptyAfterIndex:jg,getNextNonSpaceNonCommentCharacterIndex:_g}=Lt,{hasLeadingComment:Rg,hasTrailingComment:Vg,isCallOrOptionalCallExpression:$g,isFunctionOrArrowExpression:qg,isLongCurriedCallExpression:Wg,isMemberish:Ug,isNumericLiteral:Jg,isSimpleCallArgument:zg}=wc,{locEnd:Hg}=ii,{builders:{concat:Gg,join:Xg,hardline:Yg,group:Kg,indent:Qg,conditionalGroup:Zg,breakParent:eD},utils:{willBreak:tD}}=cn,{printMemberLookup:nD}=Ig,{printOptionalToken:rD,printFunctionTypeParameters:oD,printBindExpressionCallee:uD}=nd;var iD=function(e,t,n){const r=e.getParentNode(),o=!r||"ExpressionStatement"===r.type,u=[];function i(e){const{originalText:n}=t,r=_g(n,e,Hg);return")"===n.charAt(r)?!1!==r&&jg(n,r+1):Mg(n,e,Hg)}function a(e){const r=e.getValue();$g(r)&&(Ug(r.callee)||$g(r.callee))?(u.unshift({node:r,printed:Gg([Fa.printComments(e,(()=>Gg([rD(e),oD(e,t,n),Sg(e,t,n)])),t),i(r)?Yg:""])}),e.call((e=>a(e)),"callee")):Ug(r)?(u.unshift({node:r,needsParens:Rp(e,t),printed:Fa.printComments(e,(()=>"OptionalMemberExpression"===r.type||"MemberExpression"===r.type?nD(e,t,n):uD(e,t,n)),t)}),e.call((e=>a(e)),"object")):"TSNonNullExpression"===r.type?(u.unshift({node:r,printed:Fa.printComments(e,(()=>"!"),t)}),e.call((e=>a(e)),"expression")):u.unshift({node:r,printed:e.call(n)})}const s=e.getValue();u.unshift({node:s,printed:Gg([rD(e),oD(e,t,n),Sg(e,t,n)])}),s.callee&&e.call((e=>a(e)),"callee");const c=[];let l=[u[0]],p=1;for(;p<u.length&&("TSNonNullExpression"===u[p].node.type||$g(u[p].node)||("MemberExpression"===u[p].node.type||"OptionalMemberExpression"===u[p].node.type)&&u[p].node.computed&&Jg(u[p].node.property));++p)l.push(u[p]);if(!$g(u[0].node))for(;p+1<u.length&&(Ug(u[p].node)&&Ug(u[p+1].node));++p)l.push(u[p]);c.push(l),l=[];let d=!1;for(;p<u.length;++p){if(d&&Ug(u[p].node)){if(u[p].node.computed&&Jg(u[p].node.property)){l.push(u[p]);continue}c.push(l),l=[],d=!1}($g(u[p].node)||"ImportExpression"===u[p].node.type)&&(d=!0),l.push(u[p]),u[p].node.comments&&u[p].node.comments.some((e=>e.trailing))&&(c.push(l),l=[],d=!1)}function f(e){return/^[A-Z]|^[$_]+$/.test(e)}l.length>0&&c.push(l);const h=c.length>=2&&!c[1][0].node.comments&&function(e){const n=e[1].length&&e[1][0].node.computed;if(1===e[0].length){const r=e[0][0].node;return"ThisExpression"===r.type||"Identifier"===r.type&&(f(r.name)||o&&function(e){return e.length<=t.tabWidth}(r.name)||n)}const r=Lg(e[0]).node;return("MemberExpression"===r.type||"OptionalMemberExpression"===r.type)&&"Identifier"===r.property.type&&(f(r.property.name)||n)}(c);function m(e){const t=e.map((e=>e.printed));return e.length>0&&e[e.length-1].needsParens?Gg(["(",...t,")"]):Gg(t)}const g=c.map(m),D=Gg(g),y=h?3:2,E=Yu(c),C=E.slice(1,-1).some((e=>Rg(e.node)))||E.slice(0,-1).some((e=>Vg(e.node)))||c[y]&&Rg(c[y][0].node);if(c.length<=y&&!C)return Wg(e)?D:Kg(D);const b=Lg(c[h?1:0]).node,v=!$g(b)&&i(b),A=Gg([m(c[0]),h?Gg(c.slice(1,2).map(m)):"",v?Yg:"",function(e){return 0===e.length?"":Qg(Kg(Gg([Yg,Xg(Yg,e.map(m))])))}(c.slice(h?2:1))]),F=u.map((({node:e})=>e)).filter($g);return C||F.length>2&&F.some((e=>!e.arguments.every((e=>zg(e,0)))))||g.slice(0,-1).some(tD)||function(){const e=Lg(Lg(c)).node,t=Lg(g);return $g(e)&&tD(t)&&F.slice(0,-1).some((e=>e.arguments.some(qg)))}()?Kg(A):Gg([tD(D)||v?eD:"",Zg([D,A])])};const{builders:{concat:aD,join:sD,group:cD}}=cn,{getCallArguments:lD,hasFlowAnnotationComment:pD,isCallOrOptionalCallExpression:dD,isMemberish:fD,isTemplateOnItsOwnLine:hD,isTestCall:mD,iterateCallArgumentsPath:gD}=wc,{printOptionalToken:DD,printFunctionTypeParameters:yD}=nd;var ED={printCallExpression:function(e,t,n){const r=e.getValue(),o="NewExpression"===r.type,u="ImportExpression"===r.type,i=DD(e),a=lD(r);if(a.length>0&&(!u&&!o&&"Identifier"===r.callee.type&&("require"===r.callee.name||"define"===r.callee.name)||1===a.length&&hD(a[0],t.originalText)||!o&&mD(r,e.getParentNode()))){const r=[];return gD(e,(e=>{r.push(n(e))})),aD([o?"new ":"",e.call(n,"callee"),i,yD(e,t,n),aD(["(",sD(", ",r),")"])])}const s=("babel"===t.parser||"babel-flow"===t.parser)&&r.callee&&"Identifier"===r.callee.type&&pD(r.callee.trailingComments);if(s&&(r.callee.trailingComments[0].printed=!0),!u&&!o&&fD(r.callee)&&!e.call((e=>Rp(e,t)),"callee"))return iD(e,t,n);const c=aD([o?"new ":"",u?"import":e.call(n,"callee"),i,s?"/*:: ".concat(r.callee.trailingComments[0].value.slice(2).trim()," */"):"",yD(e,t,n),Sg(e,t,n)]);return u||dD(r.callee)?cD(c):c}};const{builders:{concat:CD,join:bD,line:vD,group:AD,indent:FD,ifBreak:xD}}=cn,{hasTrailingComment:SD,hasTrailingLineComment:wD,identity:TD}=wc,{getTypeParametersGroupId:BD}=Yh,{printTypeScriptModifiers:ND}=nd;var kD={printInterface:function(e,t,n){const r=e.getValue(),o=[];("DeclareInterface"===r.type||r.declare)&&o.push("declare "),"TSInterfaceDeclaration"===r.type&&o.push(r.abstract?"abstract ":"",ND(e,t,n)),o.push("interface");const u=[],i=[];"InterfaceTypeAnnotation"!==r.type&&u.push(" ",e.call(n,"id"),e.call(n,"typeParameters"));const a=r.typeParameters&&!wD(r.typeParameters);if(r.extends&&0!==r.extends.length&&i.push(a?xD(" ",vD,{groupId:BD(r.typeParameters)}):vD,"extends ",(1===r.extends.length?TD:FD)(bD(CD([",",vD]),e.map(n,"extends")))),r.id&&SD(r.id)||r.extends&&0!==r.extends.length){const e=CD(i);a?o.push(AD(CD(u.concat(xD(FD(e),e))))):o.push(AD(FD(CD(u.concat(e)))))}else o.push(...u,...i);return o.push(" ",e.call(n,"body")),AD(CD(o))}};const{printComments:PD}=Fa,{getLast:OD}=Lt,{builders:{concat:ID,join:LD,line:MD,softline:jD,group:_D,indent:RD,align:VD,ifBreak:$D},utils:{normalizeParts:qD}}=cn,{hasLeadingOwnLineComment:WD,hasTrailingLineComment:UD,isBinaryish:JD,isJSXNode:zD,shouldFlatten:HD}=wc;let GD=0;function XD(e,t,n,r,o){let u=[];const i=e.getValue();if(JD(i)){HD(i.operator,i.left.operator)?u=u.concat(e.call((e=>XD(e,t,n,!0,o)),"left")):u.push(_D(e.call(t,"left")));const a=YD(i),s=("|>"===i.operator||"NGPipeExpression"===i.type||"|"===i.operator&&"__vue_expression"===n.parser)&&!WD(n.originalText,i.right),c="NGPipeExpression"===i.type?"|":i.operator,l="NGPipeExpression"===i.type&&0!==i.arguments.length?_D(RD(ID([jD,": ",LD(ID([jD,":",$D(" ")]),e.map(t,"arguments").map((e=>VD(2,_D(e)))))]))):"",p=ID(a?[c," ",e.call(t,"right"),l]:[s?MD:"",c,s?" ":MD,e.call(t,"right"),l]),d=e.getParentNode(),f=UD(i.left),h=f||!(o&&"LogicalExpression"===i.type)&&d.type!==i.type&&i.left.type!==i.type&&i.right.type!==i.type;u.push(s?"":" ",h?_D(p,{shouldBreak:f}):p),r&&i.comments&&(u=qD(PD(e,(()=>ID(u)),n).parts))}else u.push(_D(e.call(t)));return u}function YD(e){return"LogicalExpression"===e.type&&("ObjectExpression"===e.right.type&&0!==e.right.properties.length||("ArrayExpression"===e.right.type&&0!==e.right.elements.length||!!zD(e.right)))}var KD={printBinaryishExpression:function(e,t,n){const r=e.getValue(),o=e.getParentNode(),u=e.getParentNode(1),i=r!==o.body&&("IfStatement"===o.type||"WhileStatement"===o.type||"SwitchStatement"===o.type||"DoWhileStatement"===o.type),a=XD(e,n,t,!1,i);if(i)return ID(a);if(("CallExpression"===o.type||"OptionalCallExpression"===o.type)&&o.callee===r||"UnaryExpression"===o.type||("MemberExpression"===o.type||"OptionalMemberExpression"===o.type)&&!o.computed)return _D(ID([RD(ID([jD,ID(a)])),jD]));const s="ReturnStatement"===o.type||"ThrowStatement"===o.type||"JSXExpressionContainer"===o.type&&"JSXAttribute"===u.type||"|"!==r.operator&&"JsExpressionRoot"===o.type||"NGPipeExpression"!==r.type&&("NGRoot"===o.type&&"__ng_binding"===t.parser||"NGMicrosyntaxExpression"===o.type&&"NGMicrosyntax"===u.type&&1===u.body.length)||r===o.body&&"ArrowFunctionExpression"===o.type||r!==o.body&&"ForStatement"===o.type||"ConditionalExpression"===o.type&&"ReturnStatement"!==u.type&&"ThrowStatement"!==u.type&&"CallExpression"!==u.type&&"OptionalCallExpression"!==u.type||"TemplateLiteral"===o.type,c="AssignmentExpression"===o.type||"VariableDeclarator"===o.type||"ClassProperty"===o.type||"FieldDefinition"===o.type||"TSAbstractClassProperty"===o.type||"ClassPrivateProperty"===o.type||"ObjectProperty"===o.type||"Property"===o.type,l=JD(r.left)&&HD(r.operator,r.left.operator);if(s||YD(r)&&!l||!YD(r)&&c)return _D(ID(a));if(0===a.length)return"";const p=zD(r.right),d=a.findIndex((e=>"string"!=typeof e&&"group"===e.type)),f=a.slice(0,-1===d?1:d+1),h=ID(a.slice(f.length,p?-1:void 0)),m=Symbol("logicalChain-"+ ++GD),g=_D(ID([...f,RD(h)]),{id:m});if(!p)return g;const D=OD(a);return _D(ID([g,$D(RD(D),D,{groupId:m})]))},shouldInlineLogicalExpression:YD};const{builders:{concat:QD,line:ZD,group:ey,indent:ty}}=cn,{hasLeadingOwnLineComment:ny,isBinaryish:ry,isMemberExpressionChain:oy,isStringLiteral:uy}=wc,{shouldInlineLogicalExpression:iy}=KD;function ay(e,t,n,r,o,u){if(!r)return t;const i=sy(e,r,o,u);return ey(QD([t,n,i]))}function sy(e,t,n,r){if(ny(r.originalText,t))return ty(QD([ZD,n]));return ry(t)&&!iy(t)||"ConditionalExpression"===t.type&&ry(t.test)&&!iy(t.test)||"StringLiteralTypeAnnotation"===t.type||"ClassExpression"===t.type&&t.decorators&&t.decorators.length||("Identifier"===e.type||uy(e)||"MemberExpression"===e.type)&&(uy(t)||oy(t))&&"json"!==r.parser&&"json5"!==r.parser||"SequenceExpression"===t.type?ey(ty(QD([ZD,n]))):QD([" ",n])}var cy={printVariableDeclarator:function(e,t,n){const r=e.getValue();return ay(r.id,e.call(n,"id")," =",r.init,r.init&&e.call(n,"init"),t)},printAssignmentExpression:function(e,t,n){const r=e.getValue();return ay(r.left,e.call(n,"left"),QD([" ",r.operator]),r.right,e.call(n,"right"),t)},printAssignment:ay,printAssignmentRight:sy};const{isNextLineEmpty:ly}=Lt,{builders:{concat:py,join:dy,hardline:fy}}=cn,{classChildNeedsASIProtection:hy,classPropMayCauseASIProblems:my,getLeftSidePathName:gy,hasNakedLeftSide:Dy,isJSXNode:yy,isLastStatement:Ey,isTheOnlyJSXElementInMarkdown:Cy}=wc,{locEnd:by}=ii,{shouldPrintParamsWithoutParens:vy}=Lm;function Ay({path:e,index:t,bodyNode:n,isClass:r},o,u){const i=e.getValue();if(!i)return;if("EmptyStatement"===i.type)return;const a=u(e),s=o.originalText,c=[];if(o.semi||r||Cy(o,e)||!function(e,t){if("ExpressionStatement"!==e.getNode().type)return!1;return e.call((e=>Fy(e,t)),"expression")}(e,o)?c.push(a):i.comments&&i.comments.some((e=>e.leading))?c.push(u(e,{needsSemi:!0})):c.push(";",a),!o.semi&&r)if(my(e))c.push(";");else if("ClassProperty"===i.type||"FieldDefinition"===i.type){const e=n.body[t+1];hy(e)&&c.push(";")}return ly(s,i,by)&&!Ey(e)&&c.push(fy),py(c)}function Fy(e,t){const n=e.getValue();return!!(Rp(e,t)||"ParenthesizedExpression"===n.type||"TypeCastExpression"===n.type||"ArrowFunctionExpression"===n.type&&!vy(e,t)||"ArrayExpression"===n.type||"ArrayPattern"===n.type||"UnaryExpression"===n.type&&n.prefix&&("+"===n.operator||"-"===n.operator)||"TemplateLiteral"===n.type||"TemplateElement"===n.type||yy(n)||"BindExpression"===n.type&&!n.object||"RegExpLiteral"===n.type||"Literal"===n.type&&n.pattern||"Literal"===n.type&&n.regex)||!!Dy(n)&&e.call((e=>Fy(e,t)),...gy(e,n))}var xy={printStatementSequence:function(e,t,n){const r=e.getNode(),o="ClassBody"===r.type,u=e.map(((u,i)=>Ay({path:e,index:i,bodyNode:r,isClass:o},t,n))).filter(Boolean);return dy(fy,u)}};const{printDanglingComments:Sy}=Fa,{isNextLineEmpty:wy}=Lt,{builders:{concat:Ty,hardline:By,indent:Ny}}=cn,{hasDanglingComments:ky}=wc,{locEnd:Py}=ii,{printStatementSequence:Oy}=xy;var Iy={printBlock:function(e,t,n){const r=e.getValue(),o=[],u=t.semi?";":"",i=e.call((e=>Oy(e,t,n)),"body");"StaticBlock"===r.type&&o.push("static ");const a=r.body.some((e=>"EmptyStatement"!==e.type)),s=r.directives&&r.directives.length>0,c=e.getParentNode(),l=e.getParentNode(1);return a||s||ky(r)||"ArrowFunctionExpression"!==c.type&&"FunctionExpression"!==c.type&&"FunctionDeclaration"!==c.type&&"ObjectMethod"!==c.type&&"ClassMethod"!==c.type&&"ClassPrivateMethod"!==c.type&&"ForStatement"!==c.type&&"WhileStatement"!==c.type&&"DoWhileStatement"!==c.type&&"DoExpression"!==c.type&&("CatchClause"!==c.type||l.finalizer)&&"TSModuleDeclaration"!==c.type&&"TSDeclareFunction"!==c.type&&"StaticBlock"!==r.type?(o.push("{"),s&&e.each((e=>{o.push(Ny(Ty([By,n(e),u]))),wy(t.originalText,e.getValue(),Py)&&o.push(By)}),"directives"),a&&o.push(Ny(Ty([By,i]))),o.push(Sy(e,t)),o.push(By,"}"),Ty(o)):Ty([...o,"{}"])}};const{hasNewline:Ly}=Lt,{builders:{concat:My,join:jy,hardline:_y}}=cn,{isLineComment:Ry,isBlockComment:Vy}=wc,{locStart:$y,locEnd:qy}=ii;var Wy={printComment:function(e,t){const n=e.getValue();if(Ry(n))return t.originalText.slice($y(n),qy(n)).trimEnd();if(Vy(n)){if(function(e){const t="*".concat(e.value,"*").split("\n");return t.length>1&&t.every((e=>"*"===e.trim()[0]))}(n)){const e=function(e){const t=e.value.split("\n");return My(["/*",jy(_y,t.map(((e,n)=>0===n?e.trimEnd():" "+(n<t.length-1?e.trim():e.trimStart())))),"*/"])}(n);return n.trailing&&!Ly(t.originalText,$y(n),{backwards:!0})?My([_y,e]):e}const e=qy(n),r="*-/"===t.originalText.slice(e-3,e);return"/*"+n.value+(r?"*-/":"*/")}throw new Error("Not a comment: "+JSON.stringify(n))}};const{hasNewline:Uy,hasNewlineInRange:Jy,getLast:zy,printString:Hy,printNumber:Gy,isNextLineEmpty:Xy}=Lt,{builders:{concat:Yy,join:Ky,line:Qy,hardline:Zy,softline:eE,literalline:tE,group:nE,indent:rE,align:oE,conditionalGroup:uE,ifBreak:iE},utils:{isEmpty:aE}}=cn,{insertPragma:sE}=Sp,{printHtmlBinding:cE,isVueEventBindingExpression:lE}=zp,{getFunctionParameters:pE,getCallArguments:dE,getParentExportDeclaration:fE,getTypeScriptMappedTypeModifier:hE,hasDanglingComments:mE,hasFlowShorthandAnnotationComment:gE,hasLeadingOwnLineComment:DE,hasNewlineBetweenOrAfterDecorators:yE,hasNgSideEffect:EE,hasPrettierIgnore:CE,hasTrailingComment:bE,isExportDeclaration:vE,isFunctionNotation:AE,isGetterOrSetter:FE,isLiteral:xE,isNgForOf:SE,isObjectType:wE,isObjectTypePropertyAFunction:TE,isTheOnlyJSXElementInMarkdown:BE,isTSXFile:NE,isBlockComment:kE,needsHardlineAfterDanglingComment:PE,rawText:OE,shouldPrintComma:IE}=wc,{locStart:LE,locEnd:ME}=ii,{printOptionalToken:jE,printBindExpressionCallee:_E,printTypeScriptModifiers:RE,printDecorators:VE,printFlowDeclaration:$E,adjustClause:qE}=nd,{printImportDeclaration:WE,printExportDeclaration:UE,printExportAllDeclaration:JE,printModuleSpecifier:zE}=bd,{printFunctionParameters:HE}=af,{printTemplateLiteral:GE}=Fl,{printArray:XE,printArrayItems:YE}=Tf,{printObject:KE}=Kf,{printTypeAnnotation:QE,shouldHugType:ZE}=df,{printJsxElement:eC,printJsxAttribute:tC,printJsxOpeningElement:nC,printJsxClosingElement:rC,printJsxOpeningClosingFragment:oC,printJsxExpressionContainer:uC,printJsxEmptyExpression:iC,printJsxSpreadAttribute:aC,printJsxSpreadChild:sC}=Ph,{printClass:cC,printClassMethod:lC}=eg,{printTypeParameters:pC}=Yh,{printPropertyKey:dC}=am,{printFunctionDeclaration:fC,printArrowFunctionExpression:hC,printMethod:mC,printReturnAndThrowArgument:gC}=Lm,{printCallExpression:DC}=ED,{printInterface:yC}=kD,{printVariableDeclarator:EC,printAssignmentExpression:CC,printAssignment:bC,printAssignmentRight:vC}=cy,{printBinaryishExpression:AC}=KD,{printStatementSequence:FC}=xy,{printMemberExpression:xC}=Ig,{printBlock:SC}=Iy,{printComment:wC}=Wy;function TC(e,t,n){const r=OE(e),o=n||"DirectiveLiteral"===e.type;return Hy(r,t,o)}function BC(e){const t=e.flags.split("").sort().join("");return"/".concat(e.pattern,"/").concat(t)}var NC={preprocess:Hp,print:function(e,t,n,r){const o=e.getValue();let u=!1;const i=function(e,t,n,r){const o=e.getValue(),u=t.semi?";":"";if(!o)return"";if("string"==typeof o)return o;const i=cE(e,t,n);if(i)return i;let a=[];switch(o.type){case"JsExpressionRoot":return e.call(n,"node");case"JsonRoot":return Yy([e.call(n,"node"),Zy]);case"File":return o.program&&o.program.interpreter&&a.push(e.call((e=>e.call(n,"interpreter")),"program")),a.push(e.call(n,"program")),Yy(a);case"Program":{const r=!o.body.every((({type:e})=>"EmptyStatement"===e))||o.comments;if(o.directives){const i=o.directives.length;e.each(((e,o)=>{a.push(n(e),u,Zy),(o<i-1||r)&&Xy(t.originalText,e.getValue(),ME)&&a.push(Zy)}),"directives")}return a.push(e.call((e=>FC(e,t,n)),"body")),a.push(Fa.printDanglingComments(e,t,!0)),r&&a.push(Zy),Yy(a)}case"EmptyStatement":return"";case"ExpressionStatement":if(o.directive)return Yy([TC(o.expression,t,!0),u]);if("__vue_event_binding"===t.parser){const t=e.getParentNode();if("Program"===t.type&&1===t.body.length&&t.body[0]===o)return Yy([e.call(n,"expression"),lE(o.expression)?";":""])}return Yy([e.call(n,"expression"),BE(t,e)?"":u]);case"ParenthesizedExpression":return!o.expression.comments?Yy(["(",e.call(n,"expression"),")"]):nE(Yy(["(",rE(Yy([eE,e.call(n,"expression")])),eE,")"]));case"AssignmentExpression":return CC(e,t,n);case"VariableDeclarator":return EC(e,t,n);case"BinaryExpression":case"LogicalExpression":case"NGPipeExpression":return AC(e,t,n);case"AssignmentPattern":return Yy([e.call(n,"left")," = ",e.call(n,"right")]);case"TSTypeAssertion":{const t=!("ArrayExpression"===o.expression.type||"ObjectExpression"===o.expression.type),r=nE(Yy(["<",rE(Yy([eE,e.call(n,"typeAnnotation")])),eE,">"])),u=Yy([iE("("),rE(Yy([eE,e.call(n,"expression")])),eE,iE(")")]);return t?uE([Yy([r,e.call(n,"expression")]),Yy([r,nE(u,{shouldBreak:!0})]),Yy([r,e.call(n,"expression")])]):nE(Yy([r,e.call(n,"expression")]))}case"OptionalMemberExpression":case"MemberExpression":return xC(e,t,n);case"MetaProperty":return Yy([e.call(n,"meta"),".",e.call(n,"property")]);case"BindExpression":return o.object&&a.push(e.call(n,"object")),a.push(nE(rE(Yy([eE,_E(e,t,n)])))),Yy(a);case"Identifier":return Yy([o.name,jE(e),QE(e,t,n)]);case"V8IntrinsicIdentifier":return Yy(["%",o.name]);case"SpreadElement":case"SpreadElementPattern":case"SpreadProperty":case"SpreadPropertyPattern":case"RestElement":case"ObjectTypeSpreadProperty":return Yy(["...",e.call(n,"argument"),QE(e,t,n)]);case"FunctionDeclaration":case"FunctionExpression":return a.push(fC(e,n,t,r&&r.expandLastArg&&dE(e.getParentNode()).length>1)),o.body||a.push(u),Yy(a);case"ArrowFunctionExpression":return hC(e,t,n,r);case"YieldExpression":return a.push("yield"),o.delegate&&a.push("*"),o.argument&&a.push(" ",e.call(n,"argument")),Yy(a);case"AwaitExpression":{a.push("await"),o.argument&&a.push(" ",e.call(n,"argument"));const t=e.getParentNode();return("CallExpression"===t.type||"OptionalCallExpression"===t.type)&&t.callee===o||("MemberExpression"===t.type||"OptionalMemberExpression"===t.type)&&t.object===o?nE(Yy([rE(Yy([eE,Yy(a)])),eE])):Yy(a)}case"TSExportAssignment":return Yy(["export = ",e.call(n,"expression"),u]);case"ExportDefaultDeclaration":case"ExportNamedDeclaration":case"DeclareExportDeclaration":return UE(e,t,n);case"ExportAllDeclaration":case"DeclareExportAllDeclaration":return JE(e,t,n);case"ImportDeclaration":return WE(e,t,n);case"ImportSpecifier":case"ExportSpecifier":case"ImportNamespaceSpecifier":case"ExportNamespaceSpecifier":case"ImportDefaultSpecifier":case"ExportDefaultSpecifier":return zE(e,t,n);case"ImportAttribute":return Yy([e.call(n,"key"),": ",e.call(n,"value")]);case"Import":return"import";case"TSModuleBlock":case"BlockStatement":case"StaticBlock":return SC(e,t,n);case"ThrowStatement":case"ReturnStatement":return Yy(["ReturnStatement"===o.type?"return":"throw",gC(e,t,n)]);case"NewExpression":case"ImportExpression":case"OptionalCallExpression":case"CallExpression":return DC(e,t,n);case"ObjectTypeInternalSlot":return Yy([o.static?"static ":"","[[",e.call(n,"id"),"]]",jE(e),o.method?"":": ",e.call(n,"value")]);case"ObjectExpression":case"ObjectPattern":case"ObjectTypeAnnotation":case"TSInterfaceBody":case"TSTypeLiteral":case"RecordExpression":return KE(e,t,n);case"ObjectProperty":case"Property":return o.method||"get"===o.kind||"set"===o.kind?mC(e,t,n):(o.shorthand?a.push(e.call(n,"value")):a.push(bC(o.key,dC(e,t,n),":",o.value,e.call(n,"value"),t)),Yy(a));case"ClassMethod":case"ClassPrivateMethod":case"MethodDefinition":case"TSAbstractMethodDefinition":case"TSDeclareMethod":return lC(e,t,n);case"ObjectMethod":return mC(e,t,n);case"Decorator":return Yy(["@",e.call(n,"expression"),e.call(n,"callee")]);case"ArrayExpression":case"ArrayPattern":case"TupleExpression":return XE(e,t,n);case"SequenceExpression":{const t=e.getParentNode(0);if("ExpressionStatement"===t.type||"ForStatement"===t.type){const t=[];return e.each((e=>{0===e.getName()?t.push(n(e)):t.push(",",rE(Yy([Qy,n(e)])))}),"expressions"),nE(Yy(t))}return nE(Yy([Ky(Yy([",",Qy]),e.map(n,"expressions"))]))}case"ThisExpression":return"this";case"Super":return"super";case"NullLiteral":return"null";case"RegExpLiteral":return BC(o);case"NumericLiteral":return Gy(o.extra.raw);case"DecimalLiteral":return Gy(o.value)+"m";case"BigIntLiteral":return(o.bigint||o.extra.raw).toLowerCase();case"BooleanLiteral":case"StringLiteral":case"Literal":return o.regex?BC(o.regex):o.bigint?o.raw.toLowerCase():"number"==typeof o.value?Gy(o.raw):"string"!=typeof o.value?""+o.value:TC(o,t);case"Directive":return e.call(n,"value");case"DirectiveLiteral":return TC(o,t);case"UnaryExpression":return a.push(o.operator),/[a-z]$/.test(o.operator)&&a.push(" "),o.argument.comments&&o.argument.comments.length>0?a.push(nE(Yy(["(",rE(Yy([eE,e.call(n,"argument")])),eE,")"]))):a.push(e.call(n,"argument")),Yy(a);case"UpdateExpression":return a.push(e.call(n,"argument"),o.operator),o.prefix&&a.reverse(),Yy(a);case"ConditionalExpression":return Md(e,t,n,{beforeParts:()=>[e.call(n,"test")],afterParts:e=>[e?eE:""],shouldCheckJsx:!0,conditionalNodeType:"ConditionalExpression",consequentNodePropertyName:"consequent",alternateNodePropertyName:"alternate",testNodePropertyNames:["test"]});case"VariableDeclaration":{const t=e.map((e=>n(e)),"declarations"),r=e.getParentNode(),i="ForStatement"===r.type||"ForInStatement"===r.type||"ForOfStatement"===r.type,s=o.declarations.some((e=>e.init));let c;return 1!==t.length||o.declarations[0].comments?t.length>0&&(c=rE(t[0])):c=t[0],a=[o.declare?"declare ":"",o.kind,c?Yy([" ",c]):"",rE(Yy(t.slice(1).map((e=>Yy([",",s&&!i?Zy:Qy,e])))))],i&&r.body!==o||a.push(u),nE(Yy(a))}case"TSTypeAliasDeclaration":{o.declare&&a.push("declare ");const r=vC(o.id,o.typeAnnotation,o.typeAnnotation&&e.call(n,"typeAnnotation"),t);return a.push("type ",e.call(n,"id"),e.call(n,"typeParameters")," =",r,u),nE(Yy(a))}case"WithStatement":return nE(Yy(["with (",e.call(n,"object"),")",qE(o.body,e.call(n,"body"))]));case"IfStatement":{const r=qE(o.consequent,e.call(n,"consequent")),u=nE(Yy(["if (",nE(Yy([rE(Yy([eE,e.call(n,"test")])),eE])),")",r]));if(a.push(u),o.alternate){const r=bE(o.consequent)&&o.consequent.comments.some((e=>e.trailing&&!kE(e)))||PE(o),u="BlockStatement"===o.consequent.type&&!r;a.push(u?" ":Zy),mE(o)&&a.push(Fa.printDanglingComments(e,t,!0),r?Zy:" "),a.push("else",nE(qE(o.alternate,e.call(n,"alternate"),"IfStatement"===o.alternate.type)))}return Yy(a)}case"ForStatement":{const r=qE(o.body,e.call(n,"body")),u=Fa.printDanglingComments(e,t,!0),i=u?Yy([u,eE]):"";return o.init||o.test||o.update?Yy([i,nE(Yy(["for (",nE(Yy([rE(Yy([eE,e.call(n,"init"),";",Qy,e.call(n,"test"),";",Qy,e.call(n,"update")])),eE])),")",r]))]):Yy([i,nE(Yy(["for (;;)",r]))])}case"WhileStatement":return nE(Yy(["while (",nE(Yy([rE(Yy([eE,e.call(n,"test")])),eE])),")",qE(o.body,e.call(n,"body"))]));case"ForInStatement":return nE(Yy(["for (",e.call(n,"left")," in ",e.call(n,"right"),")",qE(o.body,e.call(n,"body"))]));case"ForOfStatement":return nE(Yy(["for",o.await?" await":""," (",e.call(n,"left")," of ",e.call(n,"right"),")",qE(o.body,e.call(n,"body"))]));case"DoWhileStatement":{const t=qE(o.body,e.call(n,"body")),r=nE(Yy(["do",t]));return a=[r],"BlockStatement"===o.body.type?a.push(" "):a.push(Zy),a.push("while ("),a.push(nE(Yy([rE(Yy([eE,e.call(n,"test")])),eE])),")",u),Yy(a)}case"DoExpression":return Yy(["do ",e.call(n,"body")]);case"BreakStatement":return a.push("break"),o.label&&a.push(" ",e.call(n,"label")),a.push(u),Yy(a);case"ContinueStatement":return a.push("continue"),o.label&&a.push(" ",e.call(n,"label")),a.push(u),Yy(a);case"LabeledStatement":return"EmptyStatement"===o.body.type?Yy([e.call(n,"label"),":;"]):Yy([e.call(n,"label"),": ",e.call(n,"body")]);case"TryStatement":return Yy(["try ",e.call(n,"block"),o.handler?Yy([" ",e.call(n,"handler")]):"",o.finalizer?Yy([" finally ",e.call(n,"finalizer")]):""]);case"CatchClause":if(o.param){const r=o.param.comments&&o.param.comments.some((e=>!kE(e)||e.leading&&Uy(t.originalText,ME(e))||e.trailing&&Uy(t.originalText,LE(e),{backwards:!0}))),u=e.call(n,"param");return Yy(["catch ",Yy(r?["(",rE(Yy([eE,u])),eE,") "]:["(",u,") "]),e.call(n,"body")])}return Yy(["catch ",e.call(n,"body")]);case"SwitchStatement":return Yy([nE(Yy(["switch (",rE(Yy([eE,e.call(n,"discriminant")])),eE,")"]))," {",o.cases.length>0?rE(Yy([Zy,Ky(Zy,e.map((e=>{const r=e.getValue();return Yy([e.call(n),o.cases.indexOf(r)!==o.cases.length-1&&Xy(t.originalText,r,ME)?Zy:""])}),"cases"))])):"",Zy,"}"]);case"SwitchCase":{o.test?a.push("case ",e.call(n,"test"),":"):a.push("default:");const r=o.consequent.filter((e=>"EmptyStatement"!==e.type));if(r.length>0){const o=e.call((e=>FC(e,t,n)),"consequent");a.push(1===r.length&&"BlockStatement"===r[0].type?Yy([" ",o]):rE(Yy([Zy,o])))}return Yy(a)}case"DebuggerStatement":return Yy(["debugger",u]);case"JSXAttribute":return tC(e,t,n);case"JSXIdentifier":return""+o.name;case"JSXNamespacedName":return Ky(":",[e.call(n,"namespace"),e.call(n,"name")]);case"JSXMemberExpression":return Ky(".",[e.call(n,"object"),e.call(n,"property")]);case"TSQualifiedName":return Ky(".",[e.call(n,"left"),e.call(n,"right")]);case"JSXSpreadAttribute":return aC(e,t,n);case"JSXSpreadChild":return sC(e,t,n);case"JSXExpressionContainer":return uC(e,t,n);case"JSXFragment":case"JSXElement":return eC(e,t,n);case"JSXOpeningElement":return nC(e,t,n);case"JSXClosingElement":return rC(e,t,n);case"JSXOpeningFragment":case"JSXClosingFragment":return oC(e,t);case"JSXText":throw new Error("JSXTest should be handled by JSXElement");case"JSXEmptyExpression":return iC(e,t);case"ClassBody":return o.comments||0!==o.body.length?Yy(["{",o.body.length>0?rE(Yy([Zy,e.call((e=>FC(e,t,n)),"body")])):Fa.printDanglingComments(e,t),Zy,"}"]):"{}";case"ClassProperty":case"FieldDefinition":case"TSAbstractClassProperty":case"ClassPrivateProperty":return o.decorators&&0!==o.decorators.length&&a.push(VE(e,t,n)),o.accessibility&&a.push(o.accessibility+" "),o.declare&&a.push("declare "),o.static&&a.push("static "),("TSAbstractClassProperty"===o.type||o.abstract)&&a.push("abstract "),o.readonly&&a.push("readonly "),o.variance&&a.push(e.call(n,"variance")),a.push(dC(e,t,n),jE(e),QE(e,t,n)),o.value&&a.push(" =",vC(o.key,o.value,e.call(n,"value"),t)),a.push(u),nE(Yy(a));case"ClassDeclaration":case"ClassExpression":return o.declare&&a.push("declare "),a.push(cC(e,t,n)),Yy(a);case"TSInterfaceHeritage":case"TSExpressionWithTypeArguments":return a.push(e.call(n,"expression")),o.typeParameters&&a.push(e.call(n,"typeParameters")),Yy(a);case"TemplateElement":return Ky(tE,o.value.raw.split(/\r?\n/g));case"TSTemplateLiteralType":case"TemplateLiteral":return GE(e,n,t);case"TaggedTemplateExpression":return Yy([e.call(n,"tag"),e.call(n,"typeParameters"),e.call(n,"quasi")]);case"Node":case"Printable":case"SourceLocation":case"Position":case"Statement":case"Function":case"Pattern":case"Expression":case"Declaration":case"Specifier":case"NamedSpecifier":case"Comment":case"MemberTypeAnnotation":case"Type":throw new Error("unprintable type: "+JSON.stringify(o.type));case"TypeAnnotation":case"TSTypeAnnotation":return o.typeAnnotation?e.call(n,"typeAnnotation"):"";case"TSNamedTupleMember":return Yy([e.call(n,"label"),o.optional?"?":"",": ",e.call(n,"elementType")]);case"TSTupleType":case"TupleTypeAnnotation":{const r="TSTupleType"===o.type?"elementTypes":"types",u=o[r].length>0&&"TSRestType"===zy(o[r]).type;return nE(Yy(["[",rE(Yy([eE,YE(e,t,r,n)])),iE(IE(t,"all")&&!u?",":""),Fa.printDanglingComments(e,t,!0),eE,"]"]))}case"ExistsTypeAnnotation":return"*";case"EmptyTypeAnnotation":return"empty";case"MixedTypeAnnotation":return"mixed";case"ArrayTypeAnnotation":return Yy([e.call(n,"elementType"),"[]"]);case"BooleanLiteralTypeAnnotation":return""+o.value;case"DeclareClass":return $E(e,cC(e,t,n));case"TSDeclareFunction":return Yy([o.declare?"declare ":"",fC(e,n,t),u]);case"DeclareFunction":return $E(e,Yy(["function ",e.call(n,"id"),o.predicate?" ":"",e.call(n,"predicate"),u]));case"DeclareModule":return $E(e,Yy(["module ",e.call(n,"id")," ",e.call(n,"body")]));case"DeclareModuleExports":return $E(e,Yy(["module.exports",": ",e.call(n,"typeAnnotation"),u]));case"DeclareVariable":return $E(e,Yy(["var ",e.call(n,"id"),u]));case"DeclareOpaqueType":case"OpaqueType":return a.push("opaque type ",e.call(n,"id"),e.call(n,"typeParameters")),o.supertype&&a.push(": ",e.call(n,"supertype")),o.impltype&&a.push(" = ",e.call(n,"impltype")),a.push(u),"DeclareOpaqueType"===o.type?$E(e,Yy(a)):Yy(a);case"EnumDeclaration":return Yy(["enum ",e.call(n,"id")," ",e.call(n,"body")]);case"EnumBooleanBody":case"EnumNumberBody":case"EnumStringBody":case"EnumSymbolBody":if("EnumSymbolBody"===o.type||o.explicitType){let e=null;switch(o.type){case"EnumBooleanBody":e="boolean";break;case"EnumNumberBody":e="number";break;case"EnumStringBody":e="string";break;case"EnumSymbolBody":e="symbol"}a.push("of ",e," ")}if(0!==o.members.length||o.hasUnknownMembers){const r=o.members.length?[Zy,YE(e,t,"members",n),o.hasUnknownMembers||IE(t)?",":""]:[];a.push(nE(Yy(["{",rE(Yy([...r,...o.hasUnknownMembers?[Zy,"..."]:[]])),Fa.printDanglingComments(e,t,!0),Zy,"}"])))}else a.push(nE(Yy(["{",Fa.printDanglingComments(e,t),eE,"}"])));return Yy(a);case"EnumBooleanMember":case"EnumNumberMember":case"EnumStringMember":return Yy([e.call(n,"id")," = ","object"==typeof o.init?e.call(n,"init"):String(o.init)]);case"EnumDefaultedMember":return e.call(n,"id");case"FunctionTypeAnnotation":case"TSFunctionType":{const r=e.getParentNode(0),u=e.getParentNode(1),i=e.getParentNode(2);let s="TSFunctionType"===o.type||!(("ObjectTypeProperty"===r.type||"ObjectTypeInternalSlot"===r.type)&&!r.variance&&!r.optional&&LE(r)===LE(o)||"ObjectTypeCallProperty"===r.type||i&&"DeclareFunction"===i.type),c=s&&("TypeAnnotation"===r.type||"TSTypeAnnotation"===r.type);const l=c&&s&&("TypeAnnotation"===r.type||"TSTypeAnnotation"===r.type)&&"ArrowFunctionExpression"===u.type;return TE(r)&&(s=!0,c=!0),l&&a.push("("),a.push(HE(e,n,t,!1,!0)),(o.returnType||o.predicate||o.typeAnnotation)&&a.push(s?" => ":": ",e.call(n,"returnType"),e.call(n,"predicate"),e.call(n,"typeAnnotation")),l&&a.push(")"),nE(Yy(a))}case"TSRestType":return Yy(["...",e.call(n,"typeAnnotation")]);case"TSOptionalType":return Yy([e.call(n,"typeAnnotation"),"?"]);case"FunctionTypeParam":{const t=o.name?e.call(n,"name"):e.getParentNode().this===o?"this":"";return Yy([t,jE(e),t?": ":"",e.call(n,"typeAnnotation")])}case"DeclareInterface":case"InterfaceDeclaration":case"InterfaceTypeAnnotation":case"TSInterfaceDeclaration":return yC(e,t,n);case"ClassImplements":case"InterfaceExtends":return Yy([e.call(n,"id"),e.call(n,"typeParameters")]);case"TSClassImplements":return Yy([e.call(n,"expression"),e.call(n,"typeParameters")]);case"TSIntersectionType":case"IntersectionTypeAnnotation":{const t=e.map(n,"types"),r=[];let u=!1;for(let e=0;e<t.length;++e)0===e?r.push(t[e]):wE(o.types[e-1])&&wE(o.types[e])?r.push(Yy([" & ",u?rE(t[e]):t[e]])):wE(o.types[e-1])||wE(o.types[e])?(e>1&&(u=!0),r.push(" & ",e>1?rE(t[e]):t[e])):r.push(rE(Yy([" &",Qy,t[e]])));return nE(Yy(r))}case"TSUnionType":case"UnionTypeAnnotation":{const r=e.getParentNode(),u=!("TypeParameterInstantiation"===r.type||"TSTypeParameterInstantiation"===r.type||"GenericTypeAnnotation"===r.type||"TSTypeReference"===r.type||"TSTypeAssertion"===r.type||"TupleTypeAnnotation"===r.type||"TSTupleType"===r.type||"FunctionTypeParam"===r.type&&!r.name&&e.getParentNode(1).this!==r||("TypeAlias"===r.type||"VariableDeclarator"===r.type||"TSTypeAliasDeclaration"===r.type)&&DE(t.originalText,o)),i=ZE(o),a=e.map((e=>{let r=e.call(n);return i||(r=oE(2,r)),Fa.printComments(e,(()=>r),t)}),"types");if(i)return Ky(" | ",a);const s=u&&!DE(t.originalText,o),c=Yy([iE(Yy([s?Qy:"","| "])),Ky(Yy([Qy,"| "]),a)]);return Rp(e,t)?nE(Yy([rE(c),eE])):"TupleTypeAnnotation"===r.type&&r.types.length>1||"TSTupleType"===r.type&&r.elementTypes.length>1?nE(Yy([rE(Yy([iE(Yy(["(",eE])),c])),eE,iE(")")])):nE(u?rE(c):c)}case"NullableTypeAnnotation":return Yy(["?",e.call(n,"typeAnnotation")]);case"Variance":{const{kind:e}=o;return ta.ok("plus"===e||"minus"===e),"plus"===e?"+":"-"}case"ObjectTypeCallProperty":return o.static&&a.push("static "),a.push(e.call(n,"value")),Yy(a);case"ObjectTypeIndexer":return Yy([o.variance?e.call(n,"variance"):"","[",e.call(n,"id"),o.id?": ":"",e.call(n,"key"),"]: ",e.call(n,"value")]);case"ObjectTypeProperty":{let r="";return o.proto?r="proto ":o.static&&(r="static "),Yy([r,FE(o)?o.kind+" ":"",o.variance?e.call(n,"variance"):"",dC(e,t,n),jE(e),AE(o)?"":": ",e.call(n,"value")])}case"QualifiedTypeIdentifier":return Yy([e.call(n,"qualification"),".",e.call(n,"id")]);case"StringLiteralTypeAnnotation":return TC(o,t);case"NumberLiteralTypeAnnotation":ta.strictEqual(typeof o.value,"number");case"BigIntLiteralTypeAnnotation":return null!=o.extra?Gy(o.extra.raw):Gy(o.raw);case"DeclareTypeAlias":case"TypeAlias":{("DeclareTypeAlias"===o.type||o.declare)&&a.push("declare ");const r=vC(o.id,o.right,e.call(n,"right"),t);return a.push("type ",e.call(n,"id"),e.call(n,"typeParameters")," =",r,u),nE(Yy(a))}case"TypeCastExpression":return Yy(["(",e.call(n,"expression"),QE(e,t,n),")"]);case"TypeParameterDeclaration":case"TypeParameterInstantiation":{const r=pC(e,t,n,"params");if("flow"===t.parser){const e=LE(o),n=ME(o),u=t.originalText.lastIndexOf("/*",e),i=t.originalText.indexOf("*/",n);if(-1!==u&&-1!==i){const e=t.originalText.slice(u+2,i).trim();if(e.startsWith("::")&&!e.includes("/*")&&!e.includes("*/"))return Yy(["/*:: ",r," */"])}}return r}case"TSTypeParameterDeclaration":case"TSTypeParameterInstantiation":return pC(e,t,n,"params");case"TSTypeParameter":case"TypeParameter":{const r=e.getParentNode();if("TSMappedType"===r.type)return a.push("[",e.call(n,"name")),o.constraint&&a.push(" in ",e.call(n,"constraint")),r.nameType&&a.push(" as ",e.callParent((e=>e.call(n,"nameType")))),a.push("]"),Yy(a);o.variance&&a.push(e.call(n,"variance")),a.push(e.call(n,"name")),o.bound&&(a.push(": "),a.push(e.call(n,"bound"))),o.constraint&&a.push(" extends ",e.call(n,"constraint")),o.default&&a.push(" = ",e.call(n,"default"));const u=e.getNode(2);return 1===pE(r).length&&NE(t)&&!o.constraint&&"ArrowFunctionExpression"===u.type&&a.push(","),Yy(a)}case"TypeofTypeAnnotation":return Yy(["typeof ",e.call(n,"argument")]);case"InferredPredicate":return"%checks";case"DeclaredPredicate":return Yy(["%checks(",e.call(n,"value"),")"]);case"TSAbstractKeyword":return"abstract";case"AnyTypeAnnotation":case"TSAnyKeyword":return"any";case"TSAsyncKeyword":return"async";case"BooleanTypeAnnotation":case"TSBooleanKeyword":return"boolean";case"BigIntTypeAnnotation":case"TSBigIntKeyword":return"bigint";case"TSConstKeyword":return"const";case"TSDeclareKeyword":return"declare";case"TSExportKeyword":return"export";case"NullLiteralTypeAnnotation":case"TSNullKeyword":return"null";case"TSNeverKeyword":return"never";case"NumberTypeAnnotation":case"TSNumberKeyword":return"number";case"TSObjectKeyword":return"object";case"TSProtectedKeyword":return"protected";case"TSPrivateKeyword":return"private";case"TSPublicKeyword":return"public";case"TSReadonlyKeyword":return"readonly";case"SymbolTypeAnnotation":case"TSSymbolKeyword":return"symbol";case"TSStaticKeyword":return"static";case"StringTypeAnnotation":case"TSStringKeyword":return"string";case"TSUndefinedKeyword":return"undefined";case"TSUnknownKeyword":return"unknown";case"VoidTypeAnnotation":case"TSVoidKeyword":return"void";case"TSAsExpression":return Yy([e.call(n,"expression")," as ",e.call(n,"typeAnnotation")]);case"TSArrayType":return Yy([e.call(n,"elementType"),"[]"]);case"TSPropertySignature":return o.export&&a.push("export "),o.accessibility&&a.push(o.accessibility+" "),o.static&&a.push("static "),o.readonly&&a.push("readonly "),a.push(dC(e,t,n),jE(e)),o.typeAnnotation&&(a.push(": "),a.push(e.call(n,"typeAnnotation"))),o.initializer&&a.push(" = ",e.call(n,"initializer")),Yy(a);case"TSParameterProperty":return o.accessibility&&a.push(o.accessibility+" "),o.export&&a.push("export "),o.static&&a.push("static "),o.readonly&&a.push("readonly "),a.push(e.call(n,"parameter")),Yy(a);case"GenericTypeAnnotation":case"TSTypeReference":return Yy([e.call(n,"TSTypeReference"===o.type?"typeName":"id"),pC(e,t,n,"typeParameters")]);case"TSTypeQuery":return Yy(["typeof ",e.call(n,"exprName")]);case"TSIndexSignature":{const r=e.getParentNode(),i=o.parameters.length>1?iE(IE(t)?",":""):"",a=nE(Yy([rE(Yy([eE,Ky(Yy([", ",eE]),e.map(n,"parameters"))])),i,eE]));return Yy([o.export?"export ":"",o.accessibility?Yy([o.accessibility," "]):"",o.static?"static ":"",o.readonly?"readonly ":"",o.declare?"declare ":"","[",o.parameters?a:"",o.typeAnnotation?"]: ":"]",o.typeAnnotation?e.call(n,"typeAnnotation"):"","ClassBody"===r.type?u:""])}case"TSTypePredicate":return Yy([o.asserts?"asserts ":"",e.call(n,"parameterName"),o.typeAnnotation?Yy([" is ",e.call(n,"typeAnnotation")]):""]);case"TSNonNullExpression":return Yy([e.call(n,"expression"),"!"]);case"ThisTypeAnnotation":case"TSThisType":return"this";case"TSImportType":return Yy([o.isTypeOf?"typeof ":"","import(",e.call(n,o.parameter?"parameter":"argument"),")",o.qualifier?Yy([".",e.call(n,"qualifier")]):"",pC(e,t,n,"typeParameters")]);case"TSLiteralType":return e.call(n,"literal");case"TSIndexedAccessType":return Yy([e.call(n,"objectType"),"[",e.call(n,"indexType"),"]"]);case"TSConstructSignatureDeclaration":case"TSCallSignatureDeclaration":case"TSConstructorType":if("TSCallSignatureDeclaration"!==o.type&&a.push("new "),a.push(nE(HE(e,n,t,!1,!0))),o.returnType||o.typeAnnotation){const t="TSConstructorType"===o.type;a.push(t?" => ":": ",e.call(n,"returnType"),e.call(n,"typeAnnotation"))}return Yy(a);case"TSTypeOperator":return Yy([o.operator," ",e.call(n,"typeAnnotation")]);case"TSMappedType":{const r=Jy(t.originalText,LE(o),ME(o));return nE(Yy(["{",rE(Yy([t.bracketSpacing?Qy:eE,o.readonly?Yy([hE(o.readonly,"readonly")," "]):"",RE(e,t,n),e.call(n,"typeParameter"),o.optional?hE(o.optional,"?"):"",o.typeAnnotation?": ":"",e.call(n,"typeAnnotation"),iE(u,"")])),Fa.printDanglingComments(e,t,!0),t.bracketSpacing?Qy:eE,"}"]),{shouldBreak:r})}case"TSMethodSignature":return a.push(o.accessibility?Yy([o.accessibility," "]):"",o.export?"export ":"",o.static?"static ":"",o.readonly?"readonly ":"",o.computed?"[":"",e.call(n,"key"),o.computed?"]":"",jE(e),HE(e,n,t,!1,!0)),(o.returnType||o.typeAnnotation)&&a.push(": ",e.call(n,"returnType"),e.call(n,"typeAnnotation")),nE(Yy(a));case"TSNamespaceExportDeclaration":return a.push("export as namespace ",e.call(n,"id")),t.semi&&a.push(";"),nE(Yy(a));case"TSEnumDeclaration":return o.declare&&a.push("declare "),o.modifiers&&a.push(RE(e,t,n)),o.const&&a.push("const "),a.push("enum ",e.call(n,"id")," "),0===o.members.length?a.push(nE(Yy(["{",Fa.printDanglingComments(e,t),eE,"}"]))):a.push(nE(Yy(["{",rE(Yy([Zy,YE(e,t,"members",n),IE(t,"es5")?",":""])),Fa.printDanglingComments(e,t,!0),Zy,"}"]))),Yy(a);case"TSEnumMember":return a.push(e.call(n,"id")),o.initializer&&a.push(" = ",e.call(n,"initializer")),Yy(a);case"TSImportEqualsDeclaration":return o.isExport&&a.push("export "),a.push("import ",e.call(n,"id")," = ",e.call(n,"moduleReference")),t.semi&&a.push(";"),nE(Yy(a));case"TSExternalModuleReference":return Yy(["require(",e.call(n,"expression"),")"]);case"TSModuleDeclaration":{const r=e.getParentNode(),i=xE(o.id),s="TSModuleDeclaration"===r.type,c=o.body&&"TSModuleDeclaration"===o.body.type;if(s)a.push(".");else{o.declare&&a.push("declare "),a.push(RE(e,t,n));const r=t.originalText.slice(LE(o),LE(o.id));"Identifier"===o.id.type&&"global"===o.id.name&&!/namespace|module/.test(r)||a.push(i||/(^|\s)module(\s|$)/.test(r)?"module ":"namespace ")}return a.push(e.call(n,"id")),c?a.push(e.call(n,"body")):o.body?a.push(" ",nE(e.call(n,"body"))):a.push(u),Yy(a)}case"PrivateName":return Yy(["#",e.call(n,o.id?"id":"name")]);case"TSPrivateIdentifier":return o.escapedText;case"TSConditionalType":return Md(e,t,n,{beforeParts:()=>[e.call(n,"checkType")," ","extends"," ",e.call(n,"extendsType")],afterParts:()=>[],shouldCheckJsx:!1,conditionalNodeType:"TSConditionalType",consequentNodePropertyName:"trueType",alternateNodePropertyName:"falseType",testNodePropertyNames:["checkType","extendsType"]});case"TSInferType":return Yy(["infer"," ",e.call(n,"typeParameter")]);case"InterpreterDirective":return a.push("#!",o.value,Zy),Xy(t.originalText,o,ME)&&a.push(Zy),Yy(a);case"NGRoot":return Yy([].concat(e.call(n,"node"),o.node.comments&&0!==o.node.comments.length?Yy([" //",o.node.comments[0].value.trimEnd()]):[]));case"NGChainedExpression":return nE(Ky(Yy([";",Qy]),e.map((e=>EE(e)?n(e):Yy(["(",n(e),")"])),"expressions")));case"NGEmptyExpression":return"";case"NGQuotedExpression":return Yy([o.prefix,": ",o.value.trim()]);case"NGMicrosyntax":return Yy(e.map(((e,t)=>Yy([0===t?"":SE(e.getValue(),t,o)?" ":Yy([";",Qy]),n(e)])),"body"));case"NGMicrosyntaxKey":return/^[$_a-z][\w$]*(-[$_a-z][\w$])*$/i.test(o.name)?o.name:JSON.stringify(o.name);case"NGMicrosyntaxExpression":return Yy([e.call(n,"expression"),null===o.alias?"":Yy([" as ",e.call(n,"alias")])]);case"NGMicrosyntaxKeyedExpression":{const t=e.getName(),r=e.getParentNode(),u=SE(o,t,r)||(1===t&&("then"===o.key.name||"else"===o.key.name)||2===t&&"else"===o.key.name&&"NGMicrosyntaxKeyedExpression"===r.body[t-1].type&&"then"===r.body[t-1].key.name)&&"NGMicrosyntaxExpression"===r.body[0].type;return Yy([e.call(n,"key"),u?" ":": ",e.call(n,"expression")])}case"NGMicrosyntaxLet":return Yy(["let ",e.call(n,"key"),null===o.value?"":Yy([" = ",e.call(n,"value")])]);case"NGMicrosyntaxAs":return Yy([e.call(n,"key")," as ",e.call(n,"alias")]);case"PipelineBareFunction":return e.call(n,"callee");case"PipelineTopicExpression":return e.call(n,"expression");case"PipelinePrimaryTopicReference":return a.push("#"),Yy(a);case"ArgumentPlaceholder":return"?";case"TSJSDocAllType":return"*";case"TSJSDocUnknownType":return"?";case"TSJSDocNullableType":return Yy(["?",e.call(n,"typeAnnotation")]);case"TSJSDocNonNullableType":return Yy(["!",e.call(n,"typeAnnotation")]);case"TSJSDocFunctionType":return Yy(["function(","): ",e.call(n,"typeAnnotation")]);default:throw new Error("unknown type: "+JSON.stringify(o.type))}}(e,t,n,r);if(!o||aE(i))return i;const a=fE(e),s=[];if("ClassMethod"===o.type||"ClassPrivateMethod"===o.type||"ClassProperty"===o.type||"FieldDefinition"===o.type||"TSAbstractClassProperty"===o.type||"ClassPrivateProperty"===o.type||"MethodDefinition"===o.type||"TSAbstractMethodDefinition"===o.type||"TSDeclareMethod"===o.type);else if(o.decorators&&o.decorators.length>0&&!(a&&LE(a,{ignoreDecorators:!0})>LE(o.decorators[0]))){const r="ClassExpression"===o.type||"ClassDeclaration"===o.type||yE(o,t)?Zy:Qy;e.each((e=>{let t=e.getValue();t=t.expression?t.expression:t.callee,s.push(n(e),r)}),"decorators"),a&&s.unshift(Zy)}else vE(o)&&o.declaration&&o.declaration.decorators&&o.declaration.decorators.length>0&&LE(o,{ignoreDecorators:!0})>LE(o.declaration.decorators[0])?e.each((e=>{const t="Decorator"===e.getValue().type?"":"@";s.push(t,n(e),Zy)}),"declaration","decorators"):u=Rp(e,t);const c=[];if(u&&c.unshift("("),c.push(i),u){const t=e.getValue();gE(t)&&(c.push(" /*"),c.push(t.trailingComments[0].value.trimStart()),c.push("*/"),t.trailingComments[0].printed=!0),c.push(")")}return s.length>0?nE(Yy(s.concat(c))):Yy(c)},embed:pp,insertPragma:sE,massageAstNode:mp,hasPrettierIgnore:CE,willPrintOwnComments:il.willPrintOwnComments,canAttachComment:function(e){return e.type&&"CommentBlock"!==e.type&&"CommentLine"!==e.type&&"Line"!==e.type&&"Block"!==e.type&&"EmptyStatement"!==e.type&&"TemplateElement"!==e.type&&"Import"!==e.type},printComment:wC,isBlockComment:kE,handleComments:{ownLine:il.handleOwnLineComment,endOfLine:il.handleEndOfLineComment,remaining:il.handleRemainingComment},getGapRegex:il.getGapRegex,getCommentChildNodes:il.getCommentChildNodes};const{builders:{concat:kC,hardline:PC,indent:OC,join:IC}}=cn;const LC=new Set(["start","end","extra","loc","comments","errors","range"]);function MC(e,t){const{type:n}=e;return"Identifier"===n?{type:"StringLiteral",value:e.name}:"UnaryExpression"===n&&"+"===e.operator?t.argument:void 0}MC.ignoredProperties=LC;var jC={preprocess:Hp,print:function(e,t,n){const r=e.getValue();switch(r.type){case"JsonRoot":return kC([e.call(n,"node"),PC]);case"ArrayExpression":return 0===r.elements.length?"[]":kC(["[",OC(kC([PC,IC(kC([",",PC]),e.map(n,"elements"))])),PC,"]"]);case"ObjectExpression":return 0===r.properties.length?"{}":kC(["{",OC(kC([PC,IC(kC([",",PC]),e.map(n,"properties"))])),PC,"}"]);case"ObjectProperty":return kC([e.call(n,"key"),": ",e.call(n,"value")]);case"UnaryExpression":return kC(["+"===r.operator?"":r.operator,e.call(n,"argument")]);case"NullLiteral":return"null";case"BooleanLiteral":return r.value?"true":"false";case"StringLiteral":case"NumericLiteral":return JSON.stringify(r.value);case"Identifier":return JSON.stringify(r.name);default:throw new Error("unknown type: "+JSON.stringify(r.type))}},massageAstNode:MC};const _C="Common";var RC={bracketSpacing:{since:"0.0.0",category:_C,type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},singleQuote:{since:"0.0.0",category:_C,type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{since:"1.8.2",category:_C,type:"choice",default:[{since:"1.8.2",value:!0},{since:"1.9.0",value:"preserve"}],description:"How to wrap prose.",choices:[{since:"1.9.0",value:"always",description:"Wrap prose if it exceeds the print width."},{since:"1.9.0",value:"never",description:"Do not wrap prose."},{since:"1.9.0",value:"preserve",description:"Wrap prose as-is."}]}};const VC="JavaScript";var $C={arrowParens:{since:"1.9.0",category:VC,type:"choice",default:[{since:"1.9.0",value:"avoid"},{since:"2.0.0",value:"always"}],description:"Include parentheses around a sole arrow function parameter.",choices:[{value:"always",description:"Always include parens. Example: `(x) => x`"},{value:"avoid",description:"Omit parens when possible. Example: `x => x`"}]},bracketSpacing:RC.bracketSpacing,jsxBracketSameLine:{since:"0.17.0",category:VC,type:"boolean",default:!1,description:"Put > on the last line instead of at a new line."},semi:{since:"1.0.0",category:VC,type:"boolean",default:!0,description:"Print semicolons.",oppositeDescription:"Do not print semicolons, except at the beginning of lines which may need them."},singleQuote:RC.singleQuote,jsxSingleQuote:{since:"1.15.0",category:VC,type:"boolean",default:!1,description:"Use single quotes in JSX."},quoteProps:{since:"1.17.0",category:VC,type:"choice",default:"as-needed",description:"Change when properties in objects are quoted.",choices:[{value:"as-needed",description:"Only add quotes around object properties where required."},{value:"consistent",description:"If at least one property in an object requires quotes, quote all properties."},{value:"preserve",description:"Respect the input use of quotes in object properties."}]},trailingComma:{since:"0.0.0",category:VC,type:"choice",default:[{since:"0.0.0",value:!1},{since:"0.19.0",value:"none"},{since:"2.0.0",value:"es5"}],description:"Print trailing commas wherever possible when multi-line.",choices:[{value:"es5",description:"Trailing commas where valid in ES5 (objects, arrays, etc.)"},{value:"none",description:"No trailing commas."},{value:"all",description:"Trailing commas wherever possible (including function arguments)."}]}},qC={name:"JavaScript",type:"programming",tmScope:"source.js",aceMode:"javascript",codemirrorMode:"javascript",codemirrorMimeType:"text/javascript",color:"#f1e05a",aliases:["js","node"],extensions:[".js","._js",".bones",".cjs",".es",".es6",".frag",".gs",".jake",".jsb",".jscad",".jsfl",".jsm",".jss",".mjs",".njs",".pac",".sjs",".ssjs",".xsjs",".xsjslib"],filenames:["Jakefile"],interpreters:["chakra","d8","gjs","js","node","nodejs","qjs","rhino","v8","v8-shell"],languageId:183},WC={name:"JSX",type:"programming",group:"JavaScript",extensions:[".jsx"],tmScope:"source.js.jsx",aceMode:"javascript",codemirrorMode:"jsx",codemirrorMimeType:"text/jsx",languageId:178},UC={name:"TypeScript",type:"programming",color:"#2b7489",aliases:["ts"],interpreters:["deno","ts-node"],extensions:[".ts"],tmScope:"source.ts",aceMode:"typescript",codemirrorMode:"javascript",codemirrorMimeType:"application/typescript",languageId:378},JC={name:"TSX",type:"programming",group:"TypeScript",extensions:[".tsx"],tmScope:"source.tsx",aceMode:"javascript",codemirrorMode:"jsx",codemirrorMimeType:"text/jsx",languageId:94901924},zC={name:"JSON",type:"data",tmScope:"source.json",aceMode:"json",codemirrorMode:"javascript",codemirrorMimeType:"application/json",searchable:!1,extensions:[".json",".avsc",".geojson",".gltf",".har",".ice",".JSON-tmLanguage",".jsonl",".mcmeta",".tfstate",".tfstate.backup",".topojson",".webapp",".webmanifest",".yy",".yyp"],filenames:[".arcconfig",".htmlhintrc",".tern-config",".tern-project",".watchmanconfig","composer.lock","mcmod.info"],languageId:174},HC={name:"JSON with Comments",type:"data",group:"JSON",tmScope:"source.js",aceMode:"javascript",codemirrorMode:"javascript",codemirrorMimeType:"text/javascript",aliases:["jsonc"],extensions:[".jsonc",".sublime-build",".sublime-commands",".sublime-completions",".sublime-keymap",".sublime-macro",".sublime-menu",".sublime-mousemap",".sublime-project",".sublime-settings",".sublime-theme",".sublime-workspace",".sublime_metrics",".sublime_session"],filenames:[".babelrc",".eslintrc.json",".jscsrc",".jshintrc",".jslintrc","devcontainer.json","jsconfig.json","language-configuration.json","tsconfig.json","tslint.json"],languageId:423},GC={name:"JSON5",type:"data",extensions:[".json5"],tmScope:"source.js",aceMode:"javascript",codemirrorMode:"javascript",codemirrorMimeType:"application/json",languageId:175};var XC={languages:[ks(qC,(e=>({since:"0.0.0",parsers:["babel","espree","meriyah","babel-flow","babel-ts","flow","typescript"],vscodeLanguageIds:["javascript","mongo"],extensions:[...e.extensions,".wxs"]}))),ks(qC,(()=>({name:"Flow",since:"0.0.0",parsers:["flow","babel-flow"],vscodeLanguageIds:["javascript"],aliases:[],filenames:[],extensions:[".js.flow"]}))),ks(WC,(()=>({since:"0.0.0",parsers:["babel","babel-flow","babel-ts","flow","typescript","espree","meriyah"],vscodeLanguageIds:["javascriptreact"]}))),ks(UC,(()=>({since:"1.4.0",parsers:["typescript","babel-ts"],vscodeLanguageIds:["typescript"]}))),ks(JC,(()=>({since:"1.4.0",parsers:["typescript","babel-ts"],vscodeLanguageIds:["typescriptreact"]}))),ks(zC,(()=>({name:"JSON.stringify",since:"1.13.0",parsers:["json-stringify"],vscodeLanguageIds:["json"],extensions:[],filenames:["package.json","package-lock.json","composer.json"]}))),ks(zC,(e=>({since:"1.5.0",parsers:["json"],vscodeLanguageIds:["json"],filenames:[...e.filenames,".prettierrc"],extensions:e.extensions.filter((e=>".jsonl"!==e))}))),ks(HC,(e=>({since:"1.5.0",parsers:["json"],vscodeLanguageIds:["jsonc"],filenames:[...e.filenames,".eslintrc"]}))),ks(GC,(()=>({since:"1.13.0",parsers:["json5"],vscodeLanguageIds:["json5"]})))],options:$C,printers:{estree:NC,"estree-json":jC},parsers:{get babel(){return{}.parsers.babel},get"babel-flow"(){return{}.parsers["babel-flow"]},get"babel-ts"(){return{}.parsers["babel-ts"]},get json(){return{}.parsers.json},get json5(){return{}.parsers.json5},get"json-stringify"(){return{}.parsers["json-stringify"]},get __js_expression(){return{}.parsers.__js_expression},get __vue_expression(){return{}.parsers.__vue_expression},get __vue_event_binding(){return{}.parsers.__vue_event_binding},get flow(){return{}.parsers.flow},get typescript(){return{}.parsers.typescript},get __ng_action(){return{}.parsers.__ng_action},get __ng_binding(){return{}.parsers.__ng_binding},get __ng_interpolation(){return{}.parsers.__ng_interpolation},get __ng_directive(){return{}.parsers.__ng_directive},get espree(){return{}.parsers.espree},get meriyah(){return{}.parsers.meriyah}}};const{isFrontMatterNode:YC}=Lt,KC=new Set(["raw","raws","sourceIndex","source","before","after","trailingComma"]);function QC(e,t,n){if(YC(e)&&"yaml"===e.lang&&delete t.value,"css-comment"===e.type&&"css-root"===n.type&&0!==n.nodes.length){if((n.nodes[0]===e||YC(n.nodes[0])&&n.nodes[1]===e)&&(delete t.text,/^\*\s*@(format|prettier)\s*$/.test(e.text)))return null;if("css-root"===n.type&&se(n.nodes)===e)return null}if("value-root"===e.type&&delete t.text,"media-query"!==e.type&&"media-query-list"!==e.type&&"media-feature-expression"!==e.type||delete t.value,"css-rule"===e.type&&delete t.params,"selector-combinator"===e.type&&(t.value=t.value.replace(/\s+/g," ")),"media-feature"===e.type&&(t.value=t.value.replace(/ /g,"")),("value-word"===e.type&&(e.isColor&&e.isHex||["initial","inherit","unset","revert"].includes(t.value.replace().toLowerCase()))||"media-feature"===e.type||"selector-root-invalid"===e.type||"selector-pseudo"===e.type)&&(t.value=t.value.toLowerCase()),"css-decl"===e.type&&(t.prop=t.prop.toLowerCase()),"css-atrule"!==e.type&&"css-import"!==e.type||(t.name=t.name.toLowerCase()),"value-number"===e.type&&(t.unit=t.unit.toLowerCase()),"media-feature"!==e.type&&"media-keyword"!==e.type&&"media-type"!==e.type&&"media-unknown"!==e.type&&"media-url"!==e.type&&"media-value"!==e.type&&"selector-attribute"!==e.type&&"selector-string"!==e.type&&"selector-class"!==e.type&&"selector-combinator"!==e.type&&"value-string"!==e.type||!t.value||(t.value=t.value.replace(/'/g,'"').replace(/\\([^\dA-Fa-f])/g,"$1")),"selector-attribute"===e.type&&(t.attribute=t.attribute.trim(),t.namespace&&"string"==typeof t.namespace&&(t.namespace=t.namespace.trim(),0===t.namespace.length&&(t.namespace=!0)),t.value&&(t.value=t.value.trim().replace(/^["']|["']$/g,""),delete t.quoted)),"media-value"!==e.type&&"media-type"!==e.type&&"value-number"!==e.type&&"selector-root-invalid"!==e.type&&"selector-class"!==e.type&&"selector-combinator"!==e.type&&"selector-tag"!==e.type||!t.value||(t.value=t.value.replace(/([\d+.Ee-]+)([A-Za-z]*)/g,((e,t,n)=>{const r=Number(t);return isNaN(r)?e:r+n.toLowerCase()}))),"selector-tag"===e.type){const n=e.value.toLowerCase();["from","to"].includes(n)&&(t.value=n)}"css-atrule"===e.type&&"supports"===e.name.toLowerCase()&&delete t.value,"selector-unknown"===e.type&&delete t.value}QC.ignoredProperties=KC;var ZC=QC;const{builders:{hardline:eb,concat:tb,markAsRoot:nb}}=cn,rb={"---":"yaml","+++":"toml"};var ob={parse:function(e){const t=Object.keys(rb).map(ae).join("|"),n=e.match(new RegExp("^(".concat(t,")([^\\n]*)\\n(?:([\\s\\S]*?)\\n)?\\1[^\\n\\S]*(\\n|$)")));if(null===n)return{frontMatter:null,content:e};const[r,o,u,i]=n;let a=rb[o];return"toml"!==a&&u&&u.trim()&&(a=u.trim()),{frontMatter:{type:"front-matter",lang:a,value:i,raw:r.replace(/\n$/,"")},content:r.replace(/[^\n]/g," ")+e.slice(r.length)}},print:function(e,t){if("yaml"===e.lang){const n=e.value.trim(),r=n?t(n,{parser:"yaml"},{stripTrailingHardline:!0}):"";return nb(tb(["---",eb,r,r?eb:"","---"]))}}};const{builders:{hardline:ub,concat:ib}}=cn,{print:ab}=ob;var sb=function(e,t,n){const r=e.getValue();if("front-matter"===r.type){const e=ab(r,n);return e?ib([e,ub]):""}};const{parse:cb}=ob;var lb={hasPragma:function(e){return Sp.hasPragma(cb(e).content)},insertPragma:function(e){const{frontMatter:t,content:n}=cb(e);return(t?t.raw+"\n\n":"")+Sp.insertPragma(n)}};const pb=new Set(["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"]);function db(e,t){const n=[].concat(t);let r,o=-1;for(;r=e.getParentNode(++o);)if(n.includes(r.type))return o;return-1}function fb(e,t){const n=db(e,t);return-1===n?null:e.getParentNode(n)}function hb(e){return"value-operator"===e.type&&"*"===e.value}function mb(e){return"value-operator"===e.type&&"/"===e.value}function gb(e){return"value-operator"===e.type&&"+"===e.value}function Db(e){return"value-operator"===e.type&&"-"===e.value}function yb(e){return"value-operator"===e.type&&"%"===e.value}function Eb(e){return"value-comma_group"===e.type&&e.groups&&e.groups[1]&&"value-colon"===e.groups[1].type}function Cb(e){return"value-paren_group"===e.type&&e.groups&&e.groups[0]&&Eb(e.groups[0])}var bb={getAncestorCounter:db,getAncestorNode:fb,getPropOfDeclNode:function(e){const t=fb(e,"css-decl");return t&&t.prop&&t.prop.toLowerCase()},hasSCSSInterpolation:function(e){if(e&&e.length)for(let t=e.length-1;t>0;t--)if("word"===e[t].type&&"{"===e[t].value&&"word"===e[t-1].type&&e[t-1].value.endsWith("#"))return!0;return!1},hasStringOrFunction:function(e){if(e&&e.length)for(let t=0;t<e.length;t++)if("string"===e[t].type||"func"===e[t].type)return!0;return!1},maybeToLowerCase:function(e){return e.includes("$")||e.includes("@")||e.includes("#")||e.startsWith("%")||e.startsWith("--")||e.startsWith(":--")||e.includes("(")&&e.includes(")")?e:e.toLowerCase()},insideValueFunctionNode:function(e,t){const n=fb(e,"value-func");return n&&n.value&&n.value.toLowerCase()===t},insideICSSRuleNode:function(e){const t=fb(e,"css-rule");return t&&t.raws&&t.raws.selector&&(t.raws.selector.startsWith(":import")||t.raws.selector.startsWith(":export"))},insideAtRuleNode:function(e,t){const n=[].concat(t),r=fb(e,"css-atrule");return r&&n.includes(r.name.toLowerCase())},insideURLFunctionInImportAtRuleNode:function(e){const t=e.getValue(),n=fb(e,"css-atrule");return n&&"import"===n.name&&"url"===t.groups[0].value&&2===t.groups.length},isKeyframeAtRuleKeywords:function(e,t){const n=fb(e,"css-atrule");return n&&n.name&&n.name.toLowerCase().endsWith("keyframes")&&["from","to"].includes(t.toLowerCase())},isWideKeywords:function(e){return["initial","inherit","unset","revert"].includes(e.toLowerCase())},isSCSS:function(e,t){return"less"===e||"scss"===e?"scss"===e:/(\w\s*:\s*[^:}]+|#){|@import[^\n]+(?:url|,)/.test(t)},isSCSSVariable:function(e){return!(!e||"word"!==e.type||!e.value.startsWith("$"))},isLastNode:function(e,t){const n=e.getParentNode();if(!n)return!1;const{nodes:r}=n;return r&&r.indexOf(t)===r.length-1},isLessParser:function(e){return"css"===e.parser||"less"===e.parser},isSCSSControlDirectiveNode:function(e){return"css-atrule"===e.type&&["if","else","for","each","while"].includes(e.name)},isDetachedRulesetDeclarationNode:function(e){return!!e.selector&&("string"==typeof e.selector&&/^@.+:.*$/.test(e.selector)||e.selector.value&&/^@.+:.*$/.test(e.selector.value))},isRelationalOperatorNode:function(e){return"value-word"===e.type&&["<",">","<=",">="].includes(e.value)},isEqualityOperatorNode:function(e){return"value-word"===e.type&&["==","!="].includes(e.value)},isMultiplicationNode:hb,isDivisionNode:mb,isAdditionNode:gb,isSubtractionNode:Db,isModuloNode:yb,isMathOperatorNode:function(e){return hb(e)||mb(e)||gb(e)||Db(e)||yb(e)},isEachKeywordNode:function(e){return"value-word"===e.type&&"in"===e.value},isForKeywordNode:function(e){return"value-word"===e.type&&["from","through","end"].includes(e.value)},isURLFunctionNode:function(e){return"value-func"===e.type&&"url"===e.value.toLowerCase()},isIfElseKeywordNode:function(e){return"value-word"===e.type&&["and","or","not"].includes(e.value)},hasComposesNode:function(e){return e.value&&"value-root"===e.value.type&&e.value.group&&"value-value"===e.value.group.type&&"composes"===e.prop.toLowerCase()},hasParensAroundNode:function(e){return e.value&&e.value.group&&e.value.group.group&&"value-paren_group"===e.value.group.group.type&&null!==e.value.group.group.open&&null!==e.value.group.group.close},hasEmptyRawBefore:function(e){return e.raws&&""===e.raws.before},isSCSSNestedPropertyNode:function(e){return!!e.selector&&e.selector.replace(/\/\*.*?\*\//,"").replace(/\/\/.*?\n/,"").trim().endsWith(":")},isDetachedRulesetCallNode:function(e){return e.raws&&e.raws.params&&/^\(\s*\)$/.test(e.raws.params)},isTemplatePlaceholderNode:function(e){return e.name.startsWith("prettier-placeholder")},isTemplatePropNode:function(e){return e.prop.startsWith("@prettier-placeholder")},isPostcssSimpleVarNode:function(e,t){return"$$"===e.value&&"value-func"===e.type&&t&&"value-word"===t.type&&!t.raws.before},isKeyValuePairNode:Eb,isKeyValuePairInParenGroupNode:Cb,isSCSSMapItemNode:function(e){const t=e.getValue();if(0===t.groups.length)return!1;const n=e.getParentNode(1);if(!(Cb(t)||n&&Cb(n)))return!1;const r=fb(e,"css-decl");return!!(r&&r.prop&&r.prop.startsWith("$"))||(!!Cb(n)||"value-func"===n.type)},isInlineValueCommentNode:function(e){return"value-comment"===e.type&&e.inline},isHashNode:function(e){return"value-word"===e.type&&"#"===e.value},isLeftCurlyBraceNode:function(e){return"value-word"===e.type&&"{"===e.value},isRightCurlyBraceNode:function(e){return"value-word"===e.type&&"}"===e.value},isWordNode:function(e){return["value-word","value-atword"].includes(e.type)},isColonNode:function(e){return"value-colon"===e.type},isMediaAndSupportsKeywords:function(e){return e.value&&["not","and","or"].includes(e.value.toLowerCase())},isColorAdjusterFuncNode:function(e){return"value-func"===e.type&&pb.has(e.value.toLowerCase())},lastLineHasInlineComment:function(e){return/\/\//.test(e.split(/[\n\r]/).pop())},stringifyNode:function e(t){if(t.groups){return(t.open&&t.open.value?t.open.value:"")+t.groups.reduce(((n,r,o)=>n+e(r)+("comma_group"===t.groups[0].type&&o!==t.groups.length-1?",":"")),"")+(t.close&&t.close.value?t.close.value:"")}const n=t.raws&&t.raws.before?t.raws.before:"",r=t.raws&&t.raws.quote?t.raws.quote:"";return n+r+("atword"===t.type?"@":"")+(t.value?t.value:"")+r+(t.unit?t.unit:"")+(t.group?e(t.group):"")+(t.raws&&t.raws.after?t.raws.after:"")},isAtWordPlaceholderNode:function(e){return e&&"value-atword"===e.type&&e.value.startsWith("prettier-placeholder-")}},vb=function(e,t){let n=0;for(let r=0;r<e.line-1;++r)n=t.indexOf("\n",n)+1;return n+e.column};const{getLast:Ab,skipEverythingButNewLine:Fb}=Lt;function xb(e,t){return"number"==typeof e.sourceIndex?e.sourceIndex:e.source?vb(e.source.start,t)-1:null}function Sb(e,t){if("css-comment"===e.type&&e.inline)return Fb(t,e.source.startOffset);const n=e.nodes&&Ab(e.nodes);return n&&e.source&&!e.source.end&&(e=n),e.source&&e.source.end?vb(e.source.end,t):null}function wb(e,t,n){e.source&&(e.source.startOffset=xb(e,n)+t,e.source.endOffset=Sb(e,n)+t);for(const r in e){const o=e[r];"source"!==r&&o&&"object"==typeof o&&wb(o,t,n)}}function Tb(e){let t=e.source.startOffset;return"string"==typeof e.prop&&(t+=e.prop.length),"css-atrule"===e.type&&"string"==typeof e.name&&(t+=1+e.name.length+e.raws.afterName.match(/^\s*:?\s*/)[0].length),"css-atrule"!==e.type&&e.raws&&"string"==typeof e.raws.between&&(t+=e.raws.between.length),t}var Bb={locStart:function(e){return e.source.startOffset},locEnd:function(e){return e.source.endOffset},calculateLoc:function e(t,n){t.source&&(t.source.startOffset=xb(t,n),t.source.endOffset=Sb(t,n));for(const r in t){const o=t[r];"source"!==r&&o&&"object"==typeof o&&("value-root"===o.type||"value-unknown"===o.type?wb(o,Tb(t),o.text||o.value):e(o,n))}},replaceQuotesInInlineComments:function(e){let t,n="initial",r="initial",o=!1;const u=[];for(let i=0;i<e.length;i++){const a=e[i];switch(n){case"initial":if("'"===a){n="single-quotes";continue}if('"'===a){n="double-quotes";continue}if(("u"===a||"U"===a)&&"url("===e.slice(i,i+4).toLowerCase()){n="url",i+=3;continue}if("*"===a&&"/"===e[i-1]){n="comment-block";continue}if("/"===a&&"/"===e[i-1]){n="comment-inline",t=i-1;continue}continue;case"single-quotes":if("'"===a&&"\\"!==e[i-1]&&(n=r,r="initial"),"\n"===a||"\r"===a)return e;continue;case"double-quotes":if('"'===a&&"\\"!==e[i-1]&&(n=r,r="initial"),"\n"===a||"\r"===a)return e;continue;case"url":if(")"===a&&(n="initial"),"\n"===a||"\r"===a)return e;if("'"===a){n="single-quotes",r="url";continue}if('"'===a){n="double-quotes",r="url";continue}continue;case"comment-block":"/"===a&&"*"===e[i-1]&&(n="initial");continue;case"comment-inline":'"'!==a&&"'"!==a&&"*"!==a||(o=!0),"\n"!==a&&"\r"!==a||(o&&u.push([t,i]),n="initial",o=!1);continue}}for(const[t,n]of u)e=e.slice(0,t)+e.slice(t,n).replace(/["'*]/g," ")+e.slice(n);return e}};const{printNumber:Nb,printString:kb,hasNewline:Pb,isFrontMatterNode:Ob,isNextLineEmpty:Ib}=Lt,{builders:{concat:Lb,join:Mb,line:jb,hardline:_b,softline:Rb,group:Vb,fill:$b,indent:qb,dedent:Wb,ifBreak:Ub,breakParent:Jb},utils:{removeLines:zb}}=cn,{insertPragma:Hb}=lb,{getAncestorNode:Gb,getPropOfDeclNode:Xb,maybeToLowerCase:Yb,insideValueFunctionNode:Kb,insideICSSRuleNode:Qb,insideAtRuleNode:Zb,insideURLFunctionInImportAtRuleNode:ev,isKeyframeAtRuleKeywords:tv,isWideKeywords:nv,isSCSS:rv,isLastNode:ov,isLessParser:uv,isSCSSControlDirectiveNode:iv,isDetachedRulesetDeclarationNode:av,isRelationalOperatorNode:sv,isEqualityOperatorNode:cv,isMultiplicationNode:lv,isDivisionNode:pv,isAdditionNode:dv,isSubtractionNode:fv,isMathOperatorNode:hv,isEachKeywordNode:mv,isForKeywordNode:gv,isURLFunctionNode:Dv,isIfElseKeywordNode:yv,hasComposesNode:Ev,hasParensAroundNode:Cv,hasEmptyRawBefore:bv,isKeyValuePairNode:vv,isDetachedRulesetCallNode:Av,isTemplatePlaceholderNode:Fv,isTemplatePropNode:xv,isPostcssSimpleVarNode:Sv,isSCSSMapItemNode:wv,isInlineValueCommentNode:Tv,isHashNode:Bv,isLeftCurlyBraceNode:Nv,isRightCurlyBraceNode:kv,isWordNode:Pv,isColonNode:Ov,isMediaAndSupportsKeywords:Iv,isColorAdjusterFuncNode:Lv,lastLineHasInlineComment:Mv,isAtWordPlaceholderNode:jv}=bb,{locStart:_v,locEnd:Rv}=Bb;function Vv(e){return"es5"===e.trailingComma||"all"===e.trailingComma}function $v(e,t,n){const r=e.getValue(),o=[];return e.each(((e,u)=>{const i=r.nodes[u-1];if(i&&"css-comment"===i.type&&"prettier-ignore"===i.text.trim()){const n=e.getValue();o.push(t.originalText.slice(_v(n),Rv(n)))}else o.push(e.call(n));u!==r.nodes.length-1&&("css-comment"===r.nodes[u+1].type&&!Pb(t.originalText,_v(r.nodes[u+1]),{backwards:!0})&&!Ob(r.nodes[u])||"css-atrule"===r.nodes[u+1].type&&"else"===r.nodes[u+1].name&&"css-comment"!==r.nodes[u].type?o.push(" "):(o.push(t.__isHTMLStyleAttribute?jb:_b),Ib(t.originalText,e.getValue(),Rv)&&!Ob(r.nodes[u])&&o.push(_b)))}),"nodes"),Lb(o)}const qv=/(["'])(?:(?!\1)[^\\]|\\[\S\s])*\1/g,Wv=new RegExp(qv.source+"|"+"(".concat(/[$@]?[A-Z_a-z\u0080-\uFFFF][\w\u0080-\uFFFF-]*/g.source,")?")+"(".concat(/(?:\d*\.\d+|\d+\.?)(?:[Ee][+-]?\d+)?/g.source,")")+"(".concat(/[A-Za-z]+/g.source,")?"),"g");function Uv(e,t){return e.replace(qv,(e=>kb(e,t)))}function Jv(e,t){const n=t.singleQuote?"'":'"';return e.includes('"')||e.includes("'")?e:n+e+n}function zv(e){return e.replace(Wv,((e,t,n,r,o)=>!n&&r?Hv(r)+Yb(o||""):e))}function Hv(e){return Nb(e).replace(/\.0(?=$|e)/,"")}var Gv={print:function(e,t,n){const r=e.getValue();if(!r)return"";if("string"==typeof r)return r;switch(r.type){case"front-matter":return Lb([r.raw,_b]);case"css-root":{const o=$v(e,t,n),u=r.raws.after.trim();return Lb([o,u?" ".concat(u):"",o.parts.length?_b:""])}case"css-comment":{const e=r.inline||r.raws.inline,n=t.originalText.slice(_v(r),Rv(r));return e?n.trimEnd():n}case"css-rule":return Lb([e.call(n,"selector"),r.important?" !important":"",r.nodes?Lb([r.selector&&"selector-unknown"===r.selector.type&&Mv(r.selector.value)?jb:" ","{",r.nodes.length>0?qb(Lb([_b,$v(e,t,n)])):"",_b,"}",av(r)?";":""]):";"]);case"css-decl":{const o=e.getParentNode(),{between:u}=r.raws,i=u.trim(),a=":"===i;let s=Ev(r)?zb(e.call(n,"value")):e.call(n,"value");return!a&&Mv(i)&&(s=qb(Lb([_b,Wb(s)]))),Lb([r.raws.before.replace(/[\s;]/g,""),Qb(e)?r.prop:Yb(r.prop),i.startsWith("//")?" ":"",i,r.extend?"":" ",uv(t)&&r.extend&&r.selector?Lb(["extend(",e.call(n,"selector"),")"]):"",s,r.raws.important?r.raws.important.replace(/\s*!\s*important/i," !important"):r.important?" !important":"",r.raws.scssDefault?r.raws.scssDefault.replace(/\s*!default/i," !default"):r.scssDefault?" !default":"",r.raws.scssGlobal?r.raws.scssGlobal.replace(/\s*!global/i," !global"):r.scssGlobal?" !global":"",r.nodes?Lb([" {",qb(Lb([Rb,$v(e,t,n)])),Rb,"}"]):xv(r)&&!o.raws.semicolon&&";"!==t.originalText[Rv(r)-1]?"":t.__isHTMLStyleAttribute&&ov(e,r)?Ub(";",""):";"])}case"css-atrule":{const o=e.getParentNode(),u=Fv(r)&&!o.raws.semicolon&&";"!==t.originalText[Rv(r)-1];if(uv(t)){if(r.mixin)return Lb([e.call(n,"selector"),r.important?" !important":"",u?"":";"]);if(r.function)return Lb([r.name,Lb([e.call(n,"params")]),u?"":";"]);if(r.variable)return Lb(["@",r.name,": ",r.value?Lb([e.call(n,"value")]):"",r.raws.between.trim()?r.raws.between.trim()+" ":"",r.nodes?Lb(["{",qb(Lb([r.nodes.length>0?Rb:"",$v(e,t,n)])),Rb,"}"]):"",u?"":";"])}return Lb(["@",Av(r)||r.name.endsWith(":")?r.name:Yb(r.name),r.params?Lb([Av(r)?"":Fv(r)?""===r.raws.afterName?"":r.name.endsWith(":")?" ":/^\s*\n\s*\n/.test(r.raws.afterName)?Lb([_b,_b]):/^\s*\n/.test(r.raws.afterName)?_b:" ":" ",e.call(n,"params")]):"",r.selector?qb(Lb([" ",e.call(n,"selector")])):"",r.value?Vb(Lb([" ",e.call(n,"value"),iv(r)?Cv(r)?" ":jb:""])):"else"===r.name?" ":"",r.nodes?Lb([iv(r)?"":r.selector&&!r.selector.nodes&&"string"==typeof r.selector.value&&Mv(r.selector.value)||!r.selector&&"string"==typeof r.params&&Mv(r.params)?jb:" ","{",qb(Lb([r.nodes.length>0?Rb:"",$v(e,t,n)])),Rb,"}"]):u?"":";"])}case"media-query-list":{const t=[];return e.each((e=>{const r=e.getValue();"media-query"===r.type&&""===r.value||t.push(e.call(n))}),"nodes"),Vb(qb(Mb(jb,t)))}case"media-query":return Lb([Mb(" ",e.map(n,"nodes")),ov(e,r)?"":","]);case"media-type":return zv(Uv(r.value,t));case"media-feature-expression":return r.nodes?Lb(["(",Lb(e.map(n,"nodes")),")"]):r.value;case"media-feature":return Yb(Uv(r.value.replace(/ +/g," "),t));case"media-colon":return Lb([r.value," "]);case"media-value":return zv(Uv(r.value,t));case"media-keyword":return Uv(r.value,t);case"media-url":return Uv(r.value.replace(/^url\(\s+/gi,"url(").replace(/\s+\)$/gi,")"),t);case"media-unknown":return r.value;case"selector-root":return Vb(Lb([Zb(e,"custom-selector")?Lb([Gb(e,"css-atrule").customSelector,jb]):"",Mb(Lb([",",Zb(e,["extend","custom-selector","nest"])?jb:_b]),e.map(n,"nodes"))]));case"selector-selector":return Vb(qb(Lb(e.map(n,"nodes"))));case"selector-comment":return r.value;case"selector-string":return Uv(r.value,t);case"selector-tag":{const t=e.getParentNode(),n=t&&t.nodes.indexOf(r),o=n&&t.nodes[n-1];return Lb([r.namespace?Lb([!0===r.namespace?"":r.namespace.trim(),"|"]):"","selector-nesting"===o.type?r.value:zv(tv(e,r.value)?r.value.toLowerCase():r.value)])}case"selector-id":return Lb(["#",r.value]);case"selector-class":return Lb([".",zv(Uv(r.value,t))]);case"selector-attribute":return Lb(["[",r.namespace?Lb([!0===r.namespace?"":r.namespace.trim(),"|"]):"",r.attribute.trim(),r.operator?r.operator:"",r.value?Jv(Uv(r.value.trim(),t),t):"",r.insensitive?" i":"","]"]);case"selector-combinator":{if("+"===r.value||">"===r.value||"~"===r.value||">>>"===r.value){const t=e.getParentNode(),n="selector-selector"===t.type&&t.nodes[0]===r?"":jb;return Lb([n,r.value,ov(e,r)?"":" "])}const n=r.value.trim().startsWith("(")?jb:"",o=zv(Uv(r.value.trim(),t))||jb;return Lb([n,o])}case"selector-universal":return Lb([r.namespace?Lb([!0===r.namespace?"":r.namespace.trim(),"|"]):"",r.value]);case"selector-pseudo":return Lb([Yb(r.value),r.nodes&&r.nodes.length>0?Lb(["(",Mb(", ",e.map(n,"nodes")),")"]):""]);case"selector-nesting":return r.value;case"selector-unknown":{const n=Gb(e,"css-rule");if(n&&n.isSCSSNesterProperty)return zv(Uv(Yb(r.value),t));const o=e.getParentNode();if(o.raws&&o.raws.selector){const e=_v(o),n=e+o.raws.selector.length;return t.originalText.slice(e,n).trim()}const u=e.getParentNode(1);if("value-paren_group"===o.type&&u&&"value-func"===u.type&&"selector"===u.value){const e=_v(o.open)+1,n=Rv(o.close)-1,r=t.originalText.slice(e,n).trim();return Mv(r)?Lb([Jb,r]):r}return r.value}case"value-value":case"value-root":return e.call(n,"group");case"value-comment":return t.originalText.slice(_v(r),Rv(r));case"value-comma_group":{const t=e.getParentNode(),o=e.getParentNode(1),u=Xb(e),i=u&&"value-value"===t.type&&("grid"===u||u.startsWith("grid-template")),a=Gb(e,"css-atrule"),s=a&&iv(a),c=e.map(n,"groups"),l=[],p=Kb(e,"url");let d=!1,f=!1;for(let n=0;n<r.groups.length;++n){l.push(c[n]);const u=r.groups[n-1],h=r.groups[n],m=r.groups[n+1],g=r.groups[n+2];if(p){(m&&dv(m)||dv(h))&&l.push(" ");continue}if(!m)continue;if("value-word"===h.type&&h.value.endsWith("-")&&jv(m))continue;const D="value-string"===h.type&&h.value.startsWith("#{"),y=d&&"value-string"===m.type&&m.value.endsWith("}");if(D||y){d=!d;continue}if(d)continue;if(Ov(h)||Ov(m))continue;if("value-atword"===h.type&&""===h.value)continue;if("~"===h.value)continue;if(h.value&&h.value.includes("\\")&&m&&"value-comment"!==m.type)continue;if(u&&u.value&&u.value.indexOf("\\")===u.value.length-1&&"value-operator"===h.type&&"/"===h.value)continue;if("\\"===h.value)continue;if(Sv(h,m))continue;if(Bv(h)||Nv(h)||kv(m)||Nv(m)&&bv(m)||kv(h)&&bv(m))continue;if("--"===h.value&&Bv(m))continue;const E=hv(h),C=hv(m);if((E&&Bv(m)||C&&kv(h))&&bv(m))continue;if(Kb(e,"calc")&&(dv(h)||dv(m)||fv(h)||fv(m))&&bv(m))continue;const b=(dv(h)||fv(h))&&0===n&&("value-number"===m.type||m.isHex)&&o&&Lv(o)&&!bv(m),v=g&&"value-func"===g.type||g&&Pv(g)||"value-func"===h.type||Pv(h),A="value-func"===m.type||Pv(m)||u&&"value-func"===u.type||u&&Pv(u);if(lv(m)||lv(h)||Kb(e,"calc")||b||!(pv(m)&&!v||pv(h)&&!A||dv(m)&&!v||dv(h)&&!A||fv(m)||fv(h))||!(bv(m)||E&&(!u||u&&hv(u))))if(Tv(h)){if("value-paren_group"===t.type){l.push(Wb(_b));continue}l.push(_b)}else s&&(cv(m)||sv(m)||yv(m)||mv(h)||gv(h))||a&&"namespace"===a.name.toLowerCase()?l.push(" "):i?h.source&&m.source&&h.source.start.line!==m.source.start.line?(l.push(_b),f=!0):l.push(" "):C?l.push(" "):m&&"..."===m.value||jv(h)&&jv(m)&&Rv(h)===_v(m)||l.push(jb)}return f&&l.unshift(_b),s?Vb(qb(Lb(l))):ev(e)?Vb($b(l)):Vb(qb($b(l)))}case"value-paren_group":{const o=e.getParentNode();if(o&&Dv(o)&&(1===r.groups.length||r.groups.length>0&&"value-comma_group"===r.groups[0].type&&r.groups[0].groups.length>0&&"value-word"===r.groups[0].groups[0].type&&r.groups[0].groups[0].value.startsWith("data:")))return Lb([r.open?e.call(n,"open"):"",Mb(",",e.map(n,"groups")),r.close?e.call(n,"close"):""]);if(!r.open){const t=e.map(n,"groups"),r=[];for(let e=0;e<t.length;e++)0!==e&&r.push(Lb([",",jb])),r.push(t[e]);return Vb(qb($b(r)))}const u=wv(e),i=r.groups[r.groups.length-1],a=i&&"value-comment"===i.type;return Vb(Lb([r.open?e.call(n,"open"):"",qb(Lb([Rb,Mb(Lb([",",jb]),e.map((e=>{const t=e.getValue(),r=n(e);return vv(t)&&"value-comma_group"===t.type&&t.groups&&t.groups[2]&&"value-paren_group"===t.groups[2].type?(r.contents.contents.parts[1]=Vb(r.contents.contents.parts[1]),Vb(Wb(r))):r}),"groups"))])),Ub(!a&&rv(t.parser,t.originalText)&&u&&Vv(t)?",":""),Rb,r.close?e.call(n,"close"):""]),{shouldBreak:u})}case"value-func":return Lb([r.value,Zb(e,"supports")&&Iv(r)?" ":"",e.call(n,"group")]);case"value-paren":return r.value;case"value-number":return Lb([Hv(r.value),Yb(r.unit)]);case"value-operator":return r.value;case"value-word":return r.isColor&&r.isHex||nv(r.value)?r.value.toLowerCase():r.value;case"value-colon":{const t=e.getParentNode(),n=t&&t.groups.indexOf(r),o=n&&t.groups[n-1];return Lb([r.value,o&&"\\"===o.value[o.value.length-1]||Kb(e,"url")?"":jb])}case"value-comma":return Lb([r.value," "]);case"value-string":return kb(r.raws.quote+r.value+r.raws.quote,t);case"value-atword":return Lb(["@",r.value]);case"value-unicode-range":case"value-unknown":return r.value;default:throw new Error("Unknown postcss type ".concat(JSON.stringify(r.type)))}},embed:sb,insertPragma:Hb,massageAstNode:ZC},Xv={singleQuote:RC.singleQuote},Yv={name:"PostCSS",type:"markup",tmScope:"source.postcss",group:"CSS",extensions:[".pcss",".postcss"],aceMode:"text",languageId:262764437},Kv={name:"Less",type:"markup",color:"#1d365d",extensions:[".less"],tmScope:"source.css.less",aceMode:"less",codemirrorMode:"css",codemirrorMimeType:"text/css",languageId:198},Qv={name:"SCSS",type:"markup",color:"#c6538c",tmScope:"source.css.scss",aceMode:"scss",codemirrorMode:"css",codemirrorMimeType:"text/x-scss",extensions:[".scss"],languageId:329};var Zv={languages:[ks({name:"CSS",type:"markup",tmScope:"source.css",aceMode:"css",codemirrorMode:"css",codemirrorMimeType:"text/css",color:"#563d7c",extensions:[".css"],languageId:50},(e=>({since:"1.4.0",parsers:["css"],vscodeLanguageIds:["css"],extensions:[...e.extensions,".wxss"]}))),ks(Yv,(()=>({since:"1.4.0",parsers:["css"],vscodeLanguageIds:["postcss"]}))),ks(Kv,(()=>({since:"1.4.0",parsers:["less"],vscodeLanguageIds:["less"]}))),ks(Qv,(()=>({since:"1.4.0",parsers:["scss"],vscodeLanguageIds:["scss"]})))],options:Xv,printers:{postcss:Gv},parsers:{get css(){return{}.parsers.css},get less(){return{}.parsers.less},get scss(){return{}.parsers.scss}}};var eA={locStart:function(e){return e.loc.start.offset},locEnd:function(e){return e.loc.end.offset}};function tA(e,t){if("TextNode"===e.type){const n=e.chars.trim();if(!n)return null;t.chars=n}}tA.ignoredProperties=new Set(["loc","selfClosing"]);var nA=tA;const rA=new Set(["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","isindex","keygen","link","menuitem","meta","nextid","param","source","track","wbr"]);function oA(e){return uA(e,["TextNode"])&&!/\S/.test(e.chars)}function uA(e,t){return e&&t.some((t=>e.type===t))}function iA(e,t){const n=e.getValue(),r=e.getParentNode(0)||{},o=r.children||r.body||r.parts||[],u=o.indexOf(n);return-1!==u&&o[u+t]}function aA(e,t=1){return iA(e,-t)}function sA(e){return iA(e,1)}function cA(e){return uA(e,["MustacheCommentStatement"])&&"string"==typeof e.value&&"prettier-ignore"===e.value.trim()}var lA={getNextNode:sA,getPreviousNode:aA,hasPrettierIgnore:function(e){const t=e.getValue(),n=aA(e,2);return cA(t)||cA(n)},isNextNodeOfSomeType:function(e,t){return uA(sA(e),t)},isNodeOfSomeType:uA,isParentOfSomeType:function(e,t){return uA(e.getParentNode(0),t)},isPreviousNodeOfSomeType:function(e,t){return uA(aA(e),t)},isVoid:function(e){return function(e){return uA(e,["ElementNode"])&&"string"==typeof e.tag&&(function(e){return e.toUpperCase()===e}(e.tag[0])||e.tag.includes("."))}(e)&&e.children.every((e=>oA(e)))||rA.has(e.tag)},isWhitespaceNode:oA};const{builders:{concat:pA,group:dA,hardline:fA,ifBreak:hA,indent:mA,join:gA,line:DA,softline:yA}}=cn,{locStart:EA,locEnd:CA}=eA,{getNextNode:bA,getPreviousNode:vA,hasPrettierIgnore:AA,isNextNodeOfSomeType:FA,isNodeOfSomeType:xA,isParentOfSomeType:SA,isPreviousNodeOfSomeType:wA,isVoid:TA,isWhitespaceNode:BA}=lA;function NA(e,t){const n=e.getValue();return pA(["<",n.tag,kA(e,t),rF(n),OA(n)])}function kA(e,t){const n=e.getValue();return mA(pA([n.attributes.length?DA:"",gA(DA,e.map(t,"attributes")),n.modifiers.length?DA:"",gA(DA,e.map(t,"modifiers")),n.comments.length?DA:"",gA(DA,e.map(t,"comments"))]))}function PA(e,t,n){return pA(e.map(((e,r)=>0===r?pA([yA,n(e,t,n)]):n(e,t,n)),"children"))}function OA(e){return TA(e)?hA(pA([yA,"/>"]),pA([" />",yA])):hA(pA([yA,">"]),">")}function IA(e){const t=!1===e.escaped?"{{{":"{{",n=e.strip&&e.strip.open?"~":"";return pA([t,n])}function LA(e){const t=!1===e.escaped?"}}}":"}}",n=e.strip&&e.strip.close?"~":"";return pA([n,t])}function MA(e){const t=IA(e),n=e.openStrip.open?"~":"";return pA([t,n,"#"])}function jA(e){const t=LA(e),n=e.openStrip.close?"~":"";return pA([n,t])}function _A(e){const t=IA(e),n=e.closeStrip.open?"~":"";return pA([t,n,"/"])}function RA(e){const t=LA(e),n=e.closeStrip.close?"~":"";return pA([n,t])}function VA(e){const t=IA(e),n=e.inverseStrip.open?"~":"";return pA([t,n])}function $A(e){const t=LA(e),n=e.inverseStrip.close?"~":"";return pA([n,t])}function qA(e,t){const n=e.getValue();return dA(pA([MA(n),eF(e,t),rF(n.program),yA,jA(n)]))}function WA(e){return pA([fA,VA(e),"else",$A(e)])}function UA(e,t){const n=e.getParentNode(1);return pA([VA(n),"else ",eF(e,t),$A(n)])}function JA(e,t){const n=e.getValue();return pA([zA(n)?yA:fA,_A(n),e.call(t,"path"),RA(n)])}function zA(e){return xA(e,["BlockStatement"])&&e.program.body.every((e=>BA(e)))}function HA(e){return xA(e,["BlockStatement"])&&e.inverse}function GA(e,t){if(zA(e.getValue()))return"";const n=e.call(t,"program");return mA(pA([fA,n]))}function XA(e,t){const n=e.getValue(),r=e.call(t,"inverse"),o=pA([fA,r]);return function(e){return HA(e)&&1===e.inverse.body.length&&xA(e.inverse.body[0],["BlockStatement"])&&"if"===e.inverse.body[0].path.parts[0]}(n)?o:HA(n)?pA([WA(n),mA(o)]):""}function YA(e){return(e="string"==typeof e?e:"").split("\n").length-1}function KA(e=0,t=0){return new Array(Math.min(e,t)).fill(fA)}function QA(e,t){const n={quote:'"',regex:/"/g},r={quote:"'",regex:/'/g},o=t.singleQuote?r:n,u=o===r?n:r;let i=!1;if(e.includes(o.quote)||e.includes(u.quote)){i=(e.match(o.regex)||[]).length>(e.match(u.regex)||[]).length}const a=i?u:o,s=e.replace(a.regex,"\\".concat(a.quote));return pA([a.quote,s,a.quote])}function ZA(e,t){const n=tF(e,t),r=nF(e,t);return r?mA(pA([n,DA,dA(r)])):n}function eF(e,t){const n=tF(e,t),r=nF(e,t);return r?mA(dA(pA([n,DA,r]))):n}function tF(e,t){return e.call(t,"path")}function nF(e,t){const n=e.getValue(),r=[];if(n.params.length){const n=e.map(t,"params");r.push(...n)}if(n.hash&&n.hash.pairs.length>0){const n=e.call(t,"hash");r.push(n)}return r.length?gA(DA,r):""}function rF(e){return e&&e.blockParams.length?pA([" as |",e.blockParams.join(" "),"|"]):""}var oF={print:function(e,t,n){const r=e.getValue();if(!r)return"";if(AA(e))return t.originalText.slice(EA(r),CA(r));switch(r.type){case"Block":case"Program":case"Template":return dA(pA(e.map(n,"body")));case"ElementNode":{const o=FA(e,["ElementNode"])?fA:"";if(TA(r))return pA([dA(NA(e,n)),o]);const u=r.children.every((e=>BA(e)));return pA([dA(NA(e,n)),dA(pA([u?"":mA(PA(e,t,n)),r.children.length?fA:"",pA(["</",r.tag,">"])])),o])}case"BlockStatement":{const t=e.getParentNode(1),o=t&&t.inverse&&1===t.inverse.body.length&&t.inverse.body[0]===r&&"if"===t.inverse.body[0].path.parts[0];return pA(o?[UA(e,n),GA(e,n),XA(e,n)]:[qA(e,n),dA(pA([GA(e,n),XA(e,n),JA(e,n)]))])}case"ElementModifierStatement":return dA(pA(["{{",eF(e,n),yA,"}}"]));case"MustacheStatement":{const t=SA(e,["AttrNode","ConcatStatement"]),o=SA(e,["ElementNode"])&&0===r.hash.pairs.length&&function(e){return 0===e.params.length}(r),u=t||o;return dA(pA([IA(r),u?mA(yA):"",eF(e,n),yA,LA(r)]))}case"SubExpression":return dA(pA(["(",ZA(e,n),yA,")"]));case"AttrNode":{const o="TextNode"===r.value.type;if(o&&""===r.value.chars&&EA(r.value)===CA(r.value))return pA([r.name]);const u=e.call(n,"value"),i=o?QA(u.parts.join(),t):u;return pA([r.name,"=",i])}case"ConcatStatement":{const r=t.singleQuote?"'":'"';return pA([r,...e.map((e=>n(e)),"parts"),r])}case"Hash":return pA([gA(DA,e.map(n,"pairs"))]);case"HashPair":return pA([r.key,"=",e.call(n,"value")]);case"TextNode":{const t=2,n=!vA(e),o=!bA(e),u=!/\S/.test(r.chars),i=YA(r.chars);let a=function(e){return YA(((e="string"==typeof e?e:"").match(/^([^\S\n\r]*[\n\r])+/g)||[])[0]||"")}(r.chars),s=function(e){return YA(((e="string"==typeof e?e:"").match(/([\n\r][^\S\n\r]*)+$/g)||[])[0]||"")}(r.chars);if((n||o)&&u&&SA(e,["Block","ElementNode","Template"]))return"";u&&i?(a=Math.min(i,t),s=0):(FA(e,["BlockStatement","ElementNode"])&&(s=Math.max(s,1)),wA(e,["BlockStatement","ElementNode"])&&(a=Math.max(a,1)));if(e.stack.includes("attributes")){if(!function(e,t){return SA(e,["AttrNode"])&&e.getParentNode().name.toLowerCase()===t||SA(e,["ConcatStatement"])&&e.getParentNode(1).name.toLowerCase()===t}(e,"class"))return pA([r.chars]);let n="",o="";return SA(e,["ConcatStatement"])&&(wA(e,["MustacheStatement"])&&(n=" "),FA(e,["MustacheStatement"])&&(o=" ")),pA([...KA(a,t),r.chars.replace(/^\s+/g,n).replace(/\s+$/,o),...KA(s,t)])}let c="",l="";0===s&&FA(e,["MustacheStatement"])&&(l=" "),0===a&&wA(e,["MustacheStatement"])&&(c=" "),n&&(a=0,c=""),o&&(s=0,l="");let p=r.chars;return p.startsWith("{{")&&p.includes("}}")&&(p="\\"+p),pA([...KA(a,t),p.replace(/^\s+/g,c).replace(/\s+$/,l),...KA(s,t)])}case"MustacheCommentStatement":{const e=r.value.includes("}}")?"--":"";return pA(["{{!",e,r.value,e,"}}"])}case"PathExpression":return r.original;case"BooleanLiteral":return String(r.value);case"CommentStatement":return pA(["\x3c!--",r.value,"--\x3e"]);case"StringLiteral":return QA(r.value,t);case"NumberLiteral":return String(r.value);case"UndefinedLiteral":return"undefined";case"NullLiteral":return"null";default:throw new Error("unknown glimmer type: "+JSON.stringify(r.type))}},massageAstNode:nA};var uF={languages:[ks({name:"Handlebars",type:"markup",color:"#f7931e",aliases:["hbs","htmlbars"],extensions:[".handlebars",".hbs"],tmScope:"text.html.handlebars",aceMode:"handlebars",languageId:155},(()=>({since:null,parsers:["glimmer"],vscodeLanguageIds:["handlebars"]})))],printers:{glimmer:oF},parsers:{get glimmer(){return{}.parsers.glimmer}}};var iF={hasPragma:function(e){return/^\s*#[^\S\n]*@(format|prettier)\s*(\n|$)/.test(e)},insertPragma:function(e){return"# @format\n\n"+e}};var aF={locStart:function(e){return"number"==typeof e.start?e.start:e.loc&&e.loc.start},locEnd:function(e){return"number"==typeof e.end?e.end:e.loc&&e.loc.end}};const{builders:{concat:sF,join:cF,hardline:lF,line:pF,softline:dF,group:fF,indent:hF,ifBreak:mF}}=cn,{isNextLineEmpty:gF}=Lt,{insertPragma:DF}=iF,{locStart:yF,locEnd:EF}=aF;function CF(e,t,n){if(0===n.directives.length)return"";const r=cF(pF,e.map(t,"directives"));return"FragmentDefinition"===n.kind||"OperationDefinition"===n.kind?fF(sF([pF,r])):sF([" ",fF(hF(sF([dF,r])))])}function bF(e,t,n){const r=e.getValue().length;return e.map(((e,o)=>{const u=n(e);return gF(t.originalText,e.getValue(),EF)&&o<r-1?sF([u,lF]):u}))}function vF(e,t,n){const r=e.getNode(),o=[],{interfaces:u}=r,i=e.map((e=>n(e)),"interfaces");for(let e=0;e<u.length;e++){const n=u[e];o.push(i[e]);const r=u[e+1];if(r){const e=t.originalText.slice(n.loc.end,r.loc.start),u=e.includes("#"),i=e.replace(/#.*/g,"").trim();o.push(","===i?",":" &"),o.push(u?pF:" ")}}return o}function AF(){}AF.ignoredProperties=new Set(["loc","comments"]);var FF={print:function(e,t,n){const r=e.getValue();if(!r)return"";if("string"==typeof r)return r;switch(r.kind){case"Document":{const o=[];return e.each(((e,u)=>{o.push(sF([e.call(n)])),u!==r.definitions.length-1&&(o.push(lF),gF(t.originalText,e.getValue(),EF)&&o.push(lF))}),"definitions"),sF([sF(o),lF])}case"OperationDefinition":{const o="{"!==t.originalText[yF(r)],u=!!r.name;return sF([o?r.operation:"",o&&u?sF([" ",e.call(n,"name")]):"",r.variableDefinitions&&r.variableDefinitions.length?fF(sF(["(",hF(sF([dF,cF(sF([mF("",", "),dF]),e.map(n,"variableDefinitions"))])),dF,")"])):"",CF(e,n,r),r.selectionSet&&(o||u)?" ":"",e.call(n,"selectionSet")])}case"FragmentDefinition":return sF(["fragment ",e.call(n,"name"),r.variableDefinitions&&r.variableDefinitions.length?fF(sF(["(",hF(sF([dF,cF(sF([mF("",", "),dF]),e.map(n,"variableDefinitions"))])),dF,")"])):""," on ",e.call(n,"typeCondition"),CF(e,n,r)," ",e.call(n,"selectionSet")]);case"SelectionSet":return sF(["{",hF(sF([lF,cF(lF,e.call((e=>bF(e,t,n)),"selections"))])),lF,"}"]);case"Field":return fF(sF([r.alias?sF([e.call(n,"alias"),": "]):"",e.call(n,"name"),r.arguments.length>0?fF(sF(["(",hF(sF([dF,cF(sF([mF("",", "),dF]),e.call((e=>bF(e,t,n)),"arguments"))])),dF,")"])):"",CF(e,n,r),r.selectionSet?" ":"",e.call(n,"selectionSet")]));case"Name":return r.value;case"StringValue":return r.block?sF(['"""',lF,cF(lF,r.value.replace(/"""/g,"\\$&").split("\n")),lF,'"""']):sF(['"',r.value.replace(/["\\]/g,"\\$&").replace(/\n/g,"\\n"),'"']);case"IntValue":case"FloatValue":case"EnumValue":return r.value;case"BooleanValue":return r.value?"true":"false";case"NullValue":return"null";case"Variable":return sF(["$",e.call(n,"name")]);case"ListValue":return fF(sF(["[",hF(sF([dF,cF(sF([mF("",", "),dF]),e.map(n,"values"))])),dF,"]"]));case"ObjectValue":return fF(sF(["{",t.bracketSpacing&&r.fields.length>0?" ":"",hF(sF([dF,cF(sF([mF("",", "),dF]),e.map(n,"fields"))])),dF,mF("",t.bracketSpacing&&r.fields.length>0?" ":""),"}"]));case"ObjectField":case"Argument":return sF([e.call(n,"name"),": ",e.call(n,"value")]);case"Directive":return sF(["@",e.call(n,"name"),r.arguments.length>0?fF(sF(["(",hF(sF([dF,cF(sF([mF("",", "),dF]),e.call((e=>bF(e,t,n)),"arguments"))])),dF,")"])):""]);case"NamedType":return e.call(n,"name");case"VariableDefinition":return sF([e.call(n,"variable"),": ",e.call(n,"type"),r.defaultValue?sF([" = ",e.call(n,"defaultValue")]):"",CF(e,n,r)]);case"ObjectTypeExtension":case"ObjectTypeDefinition":return sF([e.call(n,"description"),r.description?lF:"","ObjectTypeExtension"===r.kind?"extend ":"","type ",e.call(n,"name"),r.interfaces.length>0?sF([" implements ",sF(vF(e,t,n))]):"",CF(e,n,r),r.fields.length>0?sF([" {",hF(sF([lF,cF(lF,e.call((e=>bF(e,t,n)),"fields"))])),lF,"}"]):""]);case"FieldDefinition":return sF([e.call(n,"description"),r.description?lF:"",e.call(n,"name"),r.arguments.length>0?fF(sF(["(",hF(sF([dF,cF(sF([mF("",", "),dF]),e.call((e=>bF(e,t,n)),"arguments"))])),dF,")"])):"",": ",e.call(n,"type"),CF(e,n,r)]);case"DirectiveDefinition":return sF([e.call(n,"description"),r.description?lF:"","directive ","@",e.call(n,"name"),r.arguments.length>0?fF(sF(["(",hF(sF([dF,cF(sF([mF("",", "),dF]),e.call((e=>bF(e,t,n)),"arguments"))])),dF,")"])):"",r.repeatable?" repeatable":"",sF([" on ",cF(" | ",e.map(n,"locations"))])]);case"EnumTypeExtension":case"EnumTypeDefinition":return sF([e.call(n,"description"),r.description?lF:"","EnumTypeExtension"===r.kind?"extend ":"","enum ",e.call(n,"name"),CF(e,n,r),r.values.length>0?sF([" {",hF(sF([lF,cF(lF,e.call((e=>bF(e,t,n)),"values"))])),lF,"}"]):""]);case"EnumValueDefinition":return sF([e.call(n,"description"),r.description?lF:"",e.call(n,"name"),CF(e,n,r)]);case"InputValueDefinition":return sF([e.call(n,"description"),r.description?r.description.block?lF:pF:"",e.call(n,"name"),": ",e.call(n,"type"),r.defaultValue?sF([" = ",e.call(n,"defaultValue")]):"",CF(e,n,r)]);case"InputObjectTypeExtension":case"InputObjectTypeDefinition":return sF([e.call(n,"description"),r.description?lF:"","InputObjectTypeExtension"===r.kind?"extend ":"","input ",e.call(n,"name"),CF(e,n,r),r.fields.length>0?sF([" {",hF(sF([lF,cF(lF,e.call((e=>bF(e,t,n)),"fields"))])),lF,"}"]):""]);case"SchemaDefinition":return sF(["schema",CF(e,n,r)," {",r.operationTypes.length>0?hF(sF([lF,cF(lF,e.call((e=>bF(e,t,n)),"operationTypes"))])):"",lF,"}"]);case"OperationTypeDefinition":return sF([e.call(n,"operation"),": ",e.call(n,"type")]);case"InterfaceTypeExtension":case"InterfaceTypeDefinition":return sF([e.call(n,"description"),r.description?lF:"","InterfaceTypeExtension"===r.kind?"extend ":"","interface ",e.call(n,"name"),r.interfaces.length>0?sF([" implements ",sF(vF(e,t,n))]):"",CF(e,n,r),r.fields.length>0?sF([" {",hF(sF([lF,cF(lF,e.call((e=>bF(e,t,n)),"fields"))])),lF,"}"]):""]);case"FragmentSpread":return sF(["...",e.call(n,"name"),CF(e,n,r)]);case"InlineFragment":return sF(["...",r.typeCondition?sF([" on ",e.call(n,"typeCondition")]):"",CF(e,n,r)," ",e.call(n,"selectionSet")]);case"UnionTypeExtension":case"UnionTypeDefinition":return fF(sF([e.call(n,"description"),r.description?lF:"",fF(sF(["UnionTypeExtension"===r.kind?"extend ":"","union ",e.call(n,"name"),CF(e,n,r),r.types.length>0?sF([" =",mF(""," "),hF(sF([mF(sF([pF," "])),cF(sF([pF,"| "]),e.map(n,"types"))]))]):""]))]));case"ScalarTypeExtension":case"ScalarTypeDefinition":return sF([e.call(n,"description"),r.description?lF:"","ScalarTypeExtension"===r.kind?"extend ":"","scalar ",e.call(n,"name"),CF(e,n,r)]);case"NonNullType":return sF([e.call(n,"type"),"!"]);case"ListType":return sF(["[",e.call(n,"type"),"]"]);default:throw new Error("unknown graphql type: "+JSON.stringify(r.kind))}},massageAstNode:AF,hasPrettierIgnore:function(e){const t=e.getValue();return t&&Array.isArray(t.comments)&&t.comments.some((e=>"prettier-ignore"===e.value.trim()))},insertPragma:DF,printComment:function(e){const t=e.getValue();if("Comment"===t.kind)return"#"+t.value.trimEnd();throw new Error("Not a comment: "+JSON.stringify(t))},canAttachComment:function(e){return e.kind&&"Comment"!==e.kind}},xF={bracketSpacing:RC.bracketSpacing};var SF={languages:[ks({name:"GraphQL",type:"data",color:"#e10098",extensions:[".graphql",".gql",".graphqls"],tmScope:"source.graphql",aceMode:"text",languageId:139},(()=>({since:"1.5.0",parsers:["graphql"],vscodeLanguageIds:["graphql"]})))],options:xF,printers:{graphql:FF},parsers:{get graphql(){return{}.parsers.graphql}}};var wF={locStart:function(e){return e.position.start.offset},locEnd:function(e){return e.position.end.offset}};const{getLast:TF}=Lt,{locStart:BF,locEnd:NF}=wF,{cjkPattern:kF,kPattern:PF,punctuationPattern:OF}={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])(?:[\\ufe00-\\ufe0f]|\\udb40[\\udd00-\\uddef])?",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]",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]"},IF=["liquidNode","inlineCode","emphasis","strong","delete","wikiLink","link","linkReference","image","imageReference","footnote","footnoteReference","sentence","whitespace","word","break","inlineMath"],LF=IF.concat(["tableCell","paragraph","heading"]),MF=new RegExp(PF),jF=new RegExp(OF);function _F(e,t){const[,n,r,o]=t.slice(e.position.start.offset,e.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/);return{numberText:n,marker:r,leadingSpaces:o}}var RF={mapAst:function(e,t){return function e(n,r,o){o=o||[];const u=Object.assign({},t(n,r,o));return u.children&&(u.children=u.children.map(((t,n)=>e(t,n,[u].concat(o))))),u}(e,null,null)},splitText:function(e,t){const n="non-cjk",r="cj-letter",o="cjk-punctuation",u=[];return("preserve"===t.proseWrap?e:e.replace(new RegExp("(".concat(kF,")\n(").concat(kF,")"),"g"),"$1$2")).split(/([\t\n ]+)/).forEach(((e,t,a)=>{t%2!=1?(0!==t&&t!==a.length-1||""!==e)&&e.split(new RegExp("(".concat(kF,")"))).forEach(((e,t,u)=>{(0!==t&&t!==u.length-1||""!==e)&&(t%2!=0?i(jF.test(e)?{type:"word",value:e,kind:o,hasLeadingPunctuation:!0,hasTrailingPunctuation:!0}:{type:"word",value:e,kind:MF.test(e)?"k-letter":r,hasLeadingPunctuation:!1,hasTrailingPunctuation:!1}):""!==e&&i({type:"word",value:e,kind:n,hasLeadingPunctuation:jF.test(e[0]),hasTrailingPunctuation:jF.test(TF(e))}))})):u.push({type:"whitespace",value:/\n/.test(e)?"\n":" "})})),u;function i(e){const t=TF(u);var i,a;t&&"word"===t.type&&(t.kind===n&&e.kind===r&&!t.hasTrailingPunctuation||t.kind===r&&e.kind===n&&!e.hasLeadingPunctuation?u.push({type:"whitespace",value:" "}):(i=n,a=o,t.kind===i&&e.kind===a||t.kind===a&&e.kind===i||[t.value,e.value].some((e=>/\u3000/.test(e)))||u.push({type:"whitespace",value:""}))),u.push(e)}},punctuationPattern:OF,getFencedCodeBlockValue:function(e,t){const{value:n}=e;return e.position.end.offset===t.length&&n.endsWith("\n")&&t.endsWith("\n")?n.slice(0,-1):n},getOrderedListItemInfo:_F,hasGitDiffFriendlyOrderedList:function(e,t){if(!e.ordered)return!1;if(e.children.length<2)return!1;const n=Number(_F(e.children[0],t.originalText).numberText),r=Number(_F(e.children[1],t.originalText).numberText);if(0===n&&e.children.length>2){const n=Number(_F(e.children[2],t.originalText).numberText);return 1===r&&1===n}return 1===r},INLINE_NODE_TYPES:IF,INLINE_NODE_WRAPPER_TYPES:LF,isAutolink:function(e){if(!e||"link"!==e.type||1!==e.children.length)return!1;const t=e.children[0];return t&&BF(e)===BF(t)&&NF(e)===NF(t)}};const{inferParserByLanguage:VF,getMaxContinuousCount:$F}=Lt,{builders:{hardline:qF,concat:WF,markAsRoot:UF},utils:{replaceNewlinesWithLiterallines:JF}}=cn,{print:zF}=ob,{getFencedCodeBlockValue:HF}=RF;var GF=function(e,t,n,r){const o=e.getValue();if("code"===o.type&&null!==o.lang){const e=VF(o.lang,r);if(e){const t=r.__inJsTemplate?"~":"`",u=t.repeat(Math.max(3,$F(o.value,t)+1)),i=n(HF(o,r.originalText),{parser:e},{stripTrailingHardline:!0});return UF(WF([u,o.lang,o.meta?" "+o.meta:"",qF,JF(i),qF,u]))}}switch(o.type){case"front-matter":return zF(o,n);case"importExport":return WF([n(o.value,{parser:"babel"},{stripTrailingHardline:!0}),qF]);case"jsx":return n("<$>".concat(o.value,"</$>"),{parser:"__js_expression",rootMarker:"mdx"},{stripTrailingHardline:!0})}return null};const{parse:XF}=ob,YF=["format","prettier"];function KF(e){const t="@(".concat(YF.join("|"),")"),n=new RegExp(["\x3c!--\\s*".concat(t,"\\s*--\x3e"),"\x3c!--.*\r?\n[\\s\\S]*(^|\n)[^\\S\n]*".concat(t,"[^\\S\n]*($|\n)[\\s\\S]*\n.*--\x3e")].join("|"),"m"),r=e.match(n);return r&&0===r.index}var QF={startWithPragma:KF,hasPragma:e=>KF(XF(e).content.trimStart()),insertPragma:e=>{const t=XF(e),n="\x3c!-- @".concat(YF[0]," --\x3e");return t.frontMatter?"".concat(t.frontMatter.raw,"\n\n").concat(n,"\n\n").concat(t.content):"".concat(n,"\n\n").concat(t.content)}};const{getOrderedListItemInfo:ZF,mapAst:ex,splitText:tx}=RF,nx=/^([\u0000-\uffff]|[\ud800-\udbff][\udc00-\udfff])$/;function rx(e,t,n){return ex(e,(e=>{if(!e.children)return e;const r=e.children.reduce(((e,r)=>{const o=e[e.length-1];return o&&t(o,r)?e.splice(-1,1,n(o,r)):e.push(r),e}),[]);return Object.assign({},e,{children:r})}))}var ox=function(e,t){return e=function(e){return rx(e,((e,t)=>"importExport"===e.type&&"importExport"===t.type),((e,t)=>({type:"importExport",value:e.value+"\n\n"+t.value,position:{start:e.position.start,end:t.position.end}})))}(e=function(e){return ex(e,(e=>"import"!==e.type&&"export"!==e.type?e:Object.assign({},e,{type:"importExport"})))}(e=function(e,t){return ex(e,((e,n,[r])=>{if("text"!==e.type)return e;let{value:o}=e;return"paragraph"===r.type&&(0===n&&(o=o.trimStart()),n===r.children.length-1&&(o=o.trimEnd())),{type:"sentence",position:e.position,children:tx(o,t)}}))}(e=function(e,t){return ex(e,((e,t,n)=>{if("list"===e.type&&0!==e.children.length){for(let t=0;t<n.length;t++){const r=n[t];if("list"===r.type&&!r.isAligned)return e.isAligned=!1,e}e.isAligned=r(e)}return e}));function n(e){return 0===e.children.length?-1:e.children[0].position.start.column-1}function r(e){if(!e.ordered)return!0;const[r,o]=e.children;if(ZF(r,t.originalText).leadingSpaces.length>1)return!0;const u=n(r);if(-1===u)return!1;if(1===e.children.length)return u%t.tabWidth==0;if(u!==n(o))return!1;if(u%t.tabWidth==0)return!0;return ZF(o,t.originalText).leadingSpaces.length>1}}(e=function(e,t){return ex(e,((e,n,r)=>{if("code"===e.type){const n=/^\n?( {4,}|\t)/.test(t.originalText.slice(e.position.start.offset,e.position.end.offset));if(e.isIndented=n,n)for(let e=0;e<r.length;e++){const t=r[e];if(t.hasIndentedCodeblock)break;"list"===t.type&&(t.hasIndentedCodeblock=!0)}}return e}))}(e=function(e){return ex(e,(e=>"inlineCode"!==e.type?e:Object.assign({},e,{value:e.value.replace(/\s+/g," ")})))}(e=function(e){return rx(e,((e,t)=>"text"===e.type&&"text"===t.type),((e,t)=>({type:"text",value:e.value+t.value,position:{start:e.position.start,end:t.position.end}})))}(e=function(e,t){return ex(e,(e=>"text"===e.type&&"*"!==e.value&&"_"!==e.value&&nx.test(e.value)&&e.position.end.offset-e.position.start.offset!==e.value.length?Object.assign({},e,{value:t.originalText.slice(e.position.start.offset,e.position.end.offset)}):e))}(e,t))),t),t),t)))};const{isFrontMatterNode:ux}=Lt,{startWithPragma:ix}=QF,ax=new Set(["position","raw"]);function sx(e,t,n){return"front-matter"!==e.type&&"code"!==e.type&&"yaml"!==e.type&&"import"!==e.type&&"export"!==e.type&&"jsx"!==e.type||delete t.value,"list"===e.type&&delete t.isAligned,"list"!==e.type&&"listItem"!==e.type||(delete t.spread,delete t.loose),"text"===e.type?null:("inlineCode"===e.type&&(t.value=e.value.replace(/[\t\n ]+/g," ")),"wikiLink"===e.type&&(t.value=e.value.trim().replace(/[\t\n]+/g," ")),"definition"!==e.type&&"linkReference"!==e.type||(t.label=e.label.trim().replace(/[\t\n ]+/g," ").toLowerCase()),"definition"!==e.type&&"link"!==e.type&&"image"!==e.type||!e.title||(t.title=e.title.replace(/\\(["')])/g,"$1")),n&&"root"===n.type&&n.children.length>0&&(n.children[0]===e||ux(n.children[0])&&n.children[1]===e)&&"html"===e.type&&ix(e.value)?null:void 0)}sx.ignoredProperties=ax;var cx=sx;const{getLast:lx,getMinNotPresentContinuousCount:px,getMaxContinuousCount:dx,getStringWidth:fx}=Lt,{builders:{breakParent:hx,concat:mx,join:gx,line:Dx,literalline:yx,markAsRoot:Ex,hardline:Cx,softline:bx,ifBreak:vx,fill:Ax,align:Fx,indent:xx,group:Sx},utils:{normalizeDoc:wx},printer:{printDocToString:Tx}}=cn,{replaceEndOfLineWith:Bx}=Lt,{insertPragma:Nx}=QF,{locStart:kx,locEnd:Px}=wF,{getFencedCodeBlockValue:Ox,hasGitDiffFriendlyOrderedList:Ix,splitText:Lx,punctuationPattern:Mx,INLINE_NODE_TYPES:jx,INLINE_NODE_WRAPPER_TYPES:_x,isAutolink:Rx}=RF,Vx=new Set(["importExport"]),$x=["heading","tableCell","link","wikiLink"],qx=new Set(["listItem","definition","footnoteDefinition"]);function Wx(e,t,n,r){const o=e.getValue(),u=null===o.checked?"":o.checked?"[x] ":"[ ] ";return mx([u,Xx(e,t,n,{processor:(e,o)=>{if(0===o&&"list"!==e.getValue().type)return Fx(" ".repeat(u.length),e.call(n));const i=" ".repeat((a=t.tabWidth-r.length,c=3,a<(s=0)?s:a>c?c:a));var a,s,c;return mx([i,Fx(i,e.call(n))])}})])}function Ux(e,t){return function(e,t,n){n=n||(()=>!0);let r=-1;for(const o of t.children)if(o.type===e.type&&n(o)?r++:r=-1,o===e)return r}(e,t,(t=>t.ordered===e.ordered))}function Jx(e,t){const n=[].concat(t);let r,o=-1;for(;r=e.getParentNode(++o);)if(n.includes(r.type))return o;return-1}function zx(e,t){const n=Jx(e,t);return-1===n?null:e.getParentNode(n)}function Hx(e,t,n){if("preserve"===n.proseWrap&&"\n"===t)return Cx;const r="always"===n.proseWrap&&!zx(e,$x);return""!==t?r?Dx:" ":r?bx:""}function Gx(e,t,n){const r=[];let o=null;const{children:u}=e.getValue();return u.forEach(((e,t)=>{switch(Kx(e)){case"start":null===o&&(o={index:t,offset:e.position.end.offset});break;case"end":null!==o&&(r.push({start:o,end:{index:t,offset:e.position.start.offset}}),o=null)}})),Xx(e,t,n,{processor:(e,o)=>{if(0!==r.length){const e=r[0];if(o===e.start.index)return mx([u[e.start.index].value,t.originalText.slice(e.start.offset,e.end.offset),u[e.end.index].value]);if(e.start.index<o&&o<e.end.index)return!1;if(o===e.end.index)return r.shift(),!1}return e.call(n)}})}function Xx(e,t,n,r){const o=(r=r||{}).postprocessor||mx,u=r.processor||(e=>e.call(n)),i=e.getValue(),a=[];let s;return e.each(((e,n)=>{const r=e.getValue(),o=u(e,n);if(!1!==o){const e={parts:a,prevNode:s,parentNode:i,options:t};(function(e,t){const n=0===t.parts.length,r=jx.includes(e.type),o="html"===e.type&&_x.includes(t.parentNode.type);return n||r||o})(r,e)||(a.push(Cx),s&&Vx.has(s.type)||(function(e,t){const n=(t.prevNode&&t.prevNode.type)===e.type&&qx.has(e.type),r="listItem"===t.parentNode.type&&!t.parentNode.loose,o=t.prevNode&&"listItem"===t.prevNode.type&&t.prevNode.loose,u="next"===Kx(t.prevNode),i="html"===e.type&&t.prevNode&&"html"===t.prevNode.type&&t.prevNode.position.end.line+1===e.position.start.line,a="html"===e.type&&"listItem"===t.parentNode.type&&t.prevNode&&"paragraph"===t.prevNode.type&&t.prevNode.position.end.line+1===e.position.start.line;return o||!(n||r||u||i||a)}(r,e)||Qx(r,e))&&a.push(Cx),Qx(r,e)&&a.push(Cx)),a.push(o),s=r}}),"children"),o(a)}function Yx(e){let t=e;for(;t.children&&0!==t.children.length;)t=t.children[t.children.length-1];return t}function Kx(e){if("html"!==e.type)return!1;const t=e.value.match(/^<!--\s*prettier-ignore(?:-(start|end))?\s*-->$/);return null!==t&&(t[1]?t[1]:"next")}function Qx(e,t){const n=t.prevNode&&"list"===t.prevNode.type,r="code"===e.type&&e.isIndented;return n&&r}function Zx(e,t){const n=[" "].concat(t||[]);return new RegExp(n.map((e=>"\\".concat(e))).join("|")).test(e)?"<".concat(e,">"):e}function eS(e,t,n){if(null==n&&(n=!0),!e)return"";if(n)return" "+eS(e,t,!1);if((e=e.replace(/\\(["')])/g,"$1")).includes('"')&&e.includes("'")&&!e.includes(")"))return"(".concat(e,")");const r=e.split("'").length-1,o=e.split('"').length-1,u=r>o?'"':o>r||t.singleQuote?"'":'"';return e=(e=e.replace(/\\/,"\\\\")).replace(new RegExp("(".concat(u,")"),"g"),"\\$1"),"".concat(u).concat(e).concat(u)}var tS={preprocess:ox,print:function(e,t,n){const r=e.getValue();if(function(e){const t=zx(e,["linkReference","imageReference"]);return t&&("linkReference"!==t.type||"full"!==t.referenceType)}(e))return mx(Lx(t.originalText.slice(r.position.start.offset,r.position.end.offset),t).map((n=>"word"===n.type?n.value:""===n.value?"":Hx(e,n.value,t))));switch(r.type){case"front-matter":return t.originalText.slice(r.position.start.offset,r.position.end.offset);case"root":return 0===r.children.length?"":mx([wx(Gx(e,t,n)),Vx.has(Yx(r).type)?"":Cx]);case"paragraph":return Xx(e,t,n,{postprocessor:Ax});case"sentence":return Xx(e,t,n);case"word":{let t=r.value.replace(/\*/g,"\\$&").replace(new RegExp(["(^|".concat(Mx,")(_+)"),"(_+)(".concat(Mx,"|$)")].join("|"),"g"),((e,t,n,r,o)=>(n?"".concat(t).concat(n):"".concat(r).concat(o)).replace(/_/g,"\\_")));const n=(e,t,n)=>"sentence"===e.type&&0===n,o=(e,t,n)=>Rx(e.children[n-1]);return t!==r.value&&(e.match(void 0,n,o)||e.match(void 0,n,((e,t,n)=>"emphasis"===e.type&&0===n),o))&&(t=t.replace(/^(\\?[*_])+/,(e=>e.replace(/\\/g,"")))),t}case"whitespace":{const n=e.getParentNode(),o=n.children.indexOf(r),u=n.children[o+1],i=u&&/^>|^([*+-]|#{1,6}|\d+[).])$/.test(u.value)?"never":t.proseWrap;return Hx(e,r.value,{proseWrap:i})}case"emphasis":{let o;if(Rx(r.children[0]))o=t.originalText[r.position.start.offset];else{const t=e.getParentNode(),n=t.children.indexOf(r),u=t.children[n-1],i=t.children[n+1];o=u&&"sentence"===u.type&&u.children.length>0&&"word"===lx(u.children).type&&!lx(u.children).hasTrailingPunctuation||i&&"sentence"===i.type&&i.children.length>0&&"word"===i.children[0].type&&!i.children[0].hasLeadingPunctuation||zx(e,"emphasis")?"*":"_"}return mx([o,Xx(e,t,n),o])}case"strong":return mx(["**",Xx(e,t,n),"**"]);case"delete":return mx(["~~",Xx(e,t,n),"~~"]);case"inlineCode":{const e=px(r.value,"`"),t="`".repeat(e||1),n=e&&!/^\s/.test(r.value)?" ":"";return mx([t,n,r.value,n,t])}case"wikiLink":{let e="";return e="preserve"===t.proseWrap?r.value:r.value.replace(/[\t\n]+/g," "),mx(["[[",e,"]]"])}case"link":switch(t.originalText[r.position.start.offset]){case"<":{const e="mailto:",n=r.url.startsWith(e)&&t.originalText.slice(r.position.start.offset+1,r.position.start.offset+1+e.length)!==e?r.url.slice(e.length):r.url;return mx(["<",n,">"])}case"[":return mx(["[",Xx(e,t,n),"](",Zx(r.url,")"),eS(r.title,t),")"]);default:return t.originalText.slice(r.position.start.offset,r.position.end.offset)}case"image":return mx(["![",r.alt||"","](",Zx(r.url,")"),eS(r.title,t),")"]);case"blockquote":return mx(["> ",Fx("> ",Xx(e,t,n))]);case"heading":return mx(["#".repeat(r.depth)+" ",Xx(e,t,n)]);case"code":{if(r.isIndented){const e=" ".repeat(4);return Fx(e,mx([e,mx(Bx(r.value,Cx))]))}const e=t.__inJsTemplate?"~":"`",n=e.repeat(Math.max(3,dx(r.value,e)+1));return mx([n,r.lang||"",r.meta?" "+r.meta:"",Cx,mx(Bx(Ox(r,t.originalText),Cx)),Cx,n])}case"html":{const t=e.getParentNode(),n="root"===t.type&&lx(t.children)===r?r.value.trimEnd():r.value,o=/^<!--[\S\s]*-->$/.test(n);return mx(Bx(n,o?Cx:Ex(yx)))}case"list":{const o=Ux(r,e.getParentNode()),u=Ix(r,t);return Xx(e,t,n,{processor:(e,i)=>{const a=function(){const e=r.ordered?(0===i?r.start:u?1:r.start+i)+(o%2==0?". ":") "):o%2==0?"- ":"* ";return r.isAligned||r.hasIndentedCodeblock?function(e,t){const n=r();return e+" ".repeat(n>=4?0:n);function r(){const n=e.length%t.tabWidth;return 0===n?0:t.tabWidth-n}}(e,t):e}(),s=e.getValue();return 2===s.children.length&&"html"===s.children[1].type&&s.children[0].position.start.column!==s.children[1].position.start.column?mx([a,Wx(e,t,n,a)]):mx([a,Fx(" ".repeat(a.length),Wx(e,t,n,a))])}})}case"thematicBreak":{const t=Jx(e,"list");if(-1===t)return"---";return Ux(e.getParentNode(t),e.getParentNode(t+1))%2==0?"***":"---"}case"linkReference":return mx(["[",Xx(e,t,n),"]","full"===r.referenceType?mx(["[",r.identifier,"]"]):"collapsed"===r.referenceType?"[]":""]);case"imageReference":switch(r.referenceType){case"full":return mx(["![",r.alt||"","][",r.identifier,"]"]);default:return mx(["![",r.alt,"]","collapsed"===r.referenceType?"[]":""])}case"definition":{const e="always"===t.proseWrap?Dx:" ";return Sx(mx([mx(["[",r.identifier,"]:"]),xx(mx([e,Zx(r.url),null===r.title?"":mx([e,eS(r.title,t,!1)])]))]))}case"footnote":return mx(["[^",Xx(e,t,n),"]"]);case"footnoteReference":return mx(["[^",r.identifier,"]"]);case"footnoteDefinition":{const o=e.getParentNode().children[e.getName()+1],u=1===r.children.length&&"paragraph"===r.children[0].type&&("never"===t.proseWrap||"preserve"===t.proseWrap&&r.children[0].position.start.line===r.children[0].position.end.line);return mx(["[^",r.identifier,"]: ",u?Xx(e,t,n):Sx(mx([Fx(" ".repeat(4),Xx(e,t,n,{processor:(e,t)=>0===t?Sx(mx([bx,e.call(n)])):e.call(n)})),o&&"footnoteDefinition"===o.type?bx:""]))])}case"table":return function(e,t,n){const r=Cx.parts[0],o=e.getValue(),u=[],i=e.map((e=>e.map(((e,r)=>{const o=Tx(e.call(n),t).formatted,i=fx(o);return u[r]=Math.max(u[r]||3,i),{text:o,width:i}}),"children")),"children"),a=c(!1);if("never"!==t.proseWrap)return mx([hx,a]);const s=c(!0);return mx([hx,Sx(vx(s,a))]);function c(e){const t=[p(i[0],e),l(e)];return i.length>1&&t.push(gx(r,i.slice(1).map((t=>p(t,e))))),gx(r,t)}function l(e){const t=u.map(((t,n)=>{const r=o.align[n],u="center"===r||"left"===r?":":"-",i="center"===r||"right"===r?":":"-",a=e?"-":"-".repeat(t-2);return"".concat(u).concat(a).concat(i)}));return"| ".concat(t.join(" | ")," |")}function p(e,t){const n=e.map((({text:e,width:n},r)=>{if(t)return e;const i=u[r]-n,a=o.align[r];let s=0;"right"===a?s=i:"center"===a&&(s=Math.floor(i/2));const c=i-s;return"".concat(" ".repeat(s)).concat(e).concat(" ".repeat(c))}));return"| ".concat(n.join(" | ")," |")}}(e,t,n);case"tableCell":return Xx(e,t,n);case"break":return/\s/.test(t.originalText[r.position.start.offset])?mx([" ",Ex(yx)]):mx(["\\",Cx]);case"liquidNode":return mx(Bx(r.value,Cx));case"importExport":return mx([r.value,Cx]);case"jsx":return r.value;case"math":return mx(["$$",Cx,r.value?mx([mx(Bx(r.value,Cx)),Cx]):"","$$"]);case"inlineMath":return t.originalText.slice(kx(r),Px(r));case"tableRow":case"listItem":default:throw new Error("Unknown markdown type ".concat(JSON.stringify(r.type)))}},embed:GF,massageAstNode:cx,hasPrettierIgnore:function(e){const t=+e.getName();return 0!==t&&"next"===Kx(e.getParentNode().children[t-1])},insertPragma:Nx},nS={proseWrap:RC.proseWrap,singleQuote:RC.singleQuote},rS={name:"Markdown",type:"prose",color:"#083fa1",aliases:["pandoc"],aceMode:"markdown",codemirrorMode:"gfm",codemirrorMimeType:"text/x-gfm",wrap:!0,extensions:[".md",".markdown",".mdown",".mdwn",".mdx",".mkd",".mkdn",".mkdown",".ronn",".workbook"],filenames:["contents.lr"],tmScope:"source.gfm",languageId:222};var oS={languages:[ks(rS,(e=>({since:"1.8.0",parsers:["markdown"],vscodeLanguageIds:["markdown"],filenames:e.filenames.concat(["README"]),extensions:e.extensions.filter((e=>".mdx"!==e))}))),ks(rS,(()=>({name:"MDX",since:"1.15.0",parsers:["mdx"],vscodeLanguageIds:["mdx"],filenames:[],extensions:[".mdx"]})))],options:nS,printers:{mdast:tS},parsers:{get remark(){return{}.parsers.remark},get markdown(){return{}.parsers.remark},get mdx(){return{}.parsers.mdx}}};const{isFrontMatterNode:uS}=Lt,iS=new Set(["sourceSpan","startSourceSpan","endSourceSpan","nameSpan","valueSpan"]);function aS(e,t){return"text"===e.type||"comment"===e.type||uS(e)||"yaml"===e.type||"toml"===e.type?null:("attribute"===e.type&&delete t.value,void("docType"===e.type&&delete t.value))}aS.ignoredProperties=iS;var sS=aS,cS={"*":["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","hidden","id","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","slot","spellcheck","style","tabindex","title","translate"],a:["accesskey","charset","coords","download","href","hreflang","name","ping","referrerpolicy","rel","rev","shape","tabindex","target","type"],abbr:["title"],applet:["align","alt","archive","code","codebase","height","hspace","name","object","vspace","width"],area:["accesskey","alt","coords","download","href","hreflang","nohref","ping","referrerpolicy","rel","shape","tabindex","target","type"],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],base:["href","target"],basefont:["color","face","size"],bdo:["dir"],blockquote:["cite"],body:["alink","background","bgcolor","link","text","vlink"],br:["clear"],button:["accesskey","autofocus","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","name","tabindex","type","value"],canvas:["height","width"],caption:["align"],col:["align","char","charoff","span","valign","width"],colgroup:["align","char","charoff","span","valign","width"],data:["value"],del:["cite","datetime"],details:["open"],dfn:["title"],dialog:["open"],dir:["compact"],div:["align"],dl:["compact"],embed:["height","src","type","width"],fieldset:["disabled","form","name"],font:["color","face","size"],form:["accept","accept-charset","action","autocomplete","enctype","method","name","novalidate","target"],frame:["frameborder","longdesc","marginheight","marginwidth","name","noresize","scrolling","src"],frameset:["cols","rows"],h1:["align"],h2:["align"],h3:["align"],h4:["align"],h5:["align"],h6:["align"],head:["profile"],hr:["align","noshade","size","width"],html:["manifest","version"],iframe:["align","allow","allowfullscreen","allowpaymentrequest","allowusermedia","frameborder","height","loading","longdesc","marginheight","marginwidth","name","referrerpolicy","sandbox","scrolling","src","srcdoc","width"],img:["align","alt","border","crossorigin","decoding","height","hspace","ismap","loading","longdesc","name","referrerpolicy","sizes","src","srcset","usemap","vspace","width"],input:["accept","accesskey","align","alt","autocomplete","autofocus","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","ismap","list","max","maxlength","min","minlength","multiple","name","pattern","placeholder","readonly","required","size","src","step","tabindex","title","type","usemap","value","width"],ins:["cite","datetime"],isindex:["prompt"],label:["accesskey","for","form"],legend:["accesskey","align"],li:["type","value"],link:["as","charset","color","crossorigin","disabled","href","hreflang","imagesizes","imagesrcset","integrity","media","nonce","referrerpolicy","rel","rev","sizes","target","title","type"],map:["name"],menu:["compact"],meta:["charset","content","http-equiv","name","scheme"],meter:["high","low","max","min","optimum","value"],object:["align","archive","border","classid","codebase","codetype","data","declare","form","height","hspace","name","standby","tabindex","type","typemustmatch","usemap","vspace","width"],ol:["compact","reversed","start","type"],optgroup:["disabled","label"],option:["disabled","label","selected","value"],output:["for","form","name"],p:["align"],param:["name","type","value","valuetype"],pre:["width"],progress:["max","value"],q:["cite"],script:["async","charset","crossorigin","defer","integrity","language","nomodule","nonce","referrerpolicy","src","type"],select:["autocomplete","autofocus","disabled","form","multiple","name","required","size","tabindex"],slot:["name"],source:["media","sizes","src","srcset","type"],style:["media","nonce","title","type"],table:["align","bgcolor","border","cellpadding","cellspacing","frame","rules","summary","width"],tbody:["align","char","charoff","valign"],td:["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],textarea:["accesskey","autocomplete","autofocus","cols","dirname","disabled","form","maxlength","minlength","name","placeholder","readonly","required","rows","tabindex","wrap"],tfoot:["align","char","charoff","valign"],th:["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],thead:["align","char","charoff","valign"],time:["datetime"],tr:["align","bgcolor","char","charoff","valign"],track:["default","kind","label","src","srclang"],ul:["compact","type"],video:["autoplay","controls","crossorigin","height","loop","muted","playsinline","poster","preload","src","width"]};const{inferParserByLanguage:lS,isFrontMatterNode:pS}=Lt,{CSS_DISPLAY_TAGS:dS,CSS_DISPLAY_DEFAULT:fS,CSS_WHITE_SPACE_TAGS:hS,CSS_WHITE_SPACE_DEFAULT:mS}={CSS_DISPLAY_TAGS:{area:"none",base:"none",basefont:"none",datalist:"none",head:"none",link:"none",meta:"none",noembed:"none",noframes:"none",param:"block",rp:"none",script:"block",source:"block",style:"none",template:"inline",track:"block",title:"none",html:"block",body:"block",address:"block",blockquote:"block",center:"block",div:"block",figure:"block",figcaption:"block",footer:"block",form:"block",header:"block",hr:"block",legend:"block",listing:"block",main:"block",p:"block",plaintext:"block",pre:"block",xmp:"block",slot:"contents",ruby:"ruby",rt:"ruby-text",article:"block",aside:"block",h1:"block",h2:"block",h3:"block",h4:"block",h5:"block",h6:"block",hgroup:"block",nav:"block",section:"block",dir:"block",dd:"block",dl:"block",dt:"block",ol:"block",ul:"block",li:"list-item",table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell",fieldset:"block",button:"inline-block",details:"block",summary:"block",dialog:"block",meter:"inline-block",progress:"inline-block",object:"inline-block",video:"inline-block",audio:"inline-block",select:"inline-block",option:"block",optgroup:"block"},CSS_DISPLAY_DEFAULT:"inline",CSS_WHITE_SPACE_TAGS:{listing:"pre",plaintext:"pre",pre:"pre",xmp:"pre",nobr:"nowrap",table:"initial",textarea:"pre-wrap"},CSS_WHITE_SPACE_DEFAULT:"normal"},gS=bS(["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","bgsound","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","element","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","main","map","mark","marquee","math","menu","menuitem","meta","meter","multicol","nav","nextid","nobr","noembed","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","plaintext","pre","progress","q","rb","rbc","rp","rt","rtc","ruby","s","samp","script","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xmp"]),DS=function(e,t){const n=Object.create(null);for(const r of Object.keys(e))n[r]=t(e[r],r);return n}(cS,bS),yS=new Set(["\t","\n","\f","\r"," "]),ES=e=>e.replace(/[\t\n\f\r ]+$/,""),CS=e=>e.match(/^[\t\n\f\r ]*/)[0];function bS(e){const t=Object.create(null);for(const n of e)t[n]=!0;return t}function vS(e,t){return!("ieConditionalComment"!==e.type||!e.lastChild||e.lastChild.isSelfClosing||e.lastChild.endSourceSpan)||("ieConditionalComment"===e.type&&!e.complete||(!(!IS(e)||!e.children.some((e=>"text"!==e.type&&"interpolation"!==e.type)))||!(!VS(e,t)||FS(e)||"interpolation"===e.type)))}function AS(e){if("attribute"===e.type)return!1;if(!e.parent)return!1;if("number"!=typeof e.index||0===e.index)return!1;return function(e){return"comment"===e.type&&"prettier-ignore"===e.value.trim()}(e.parent.children[e.index-1])}function FS(e){return"element"===e.type&&("script"===e.fullName||"style"===e.fullName||"svg:style"===e.fullName||LS(e)&&("script"===e.name||"style"===e.name))}function xS(e){return MS(e).startsWith("pre")}function SS(e){return"element"===e.type&&0!==e.children.length&&(["html","head","ul","ol","select"].includes(e.name)||e.cssDisplay.startsWith("table")&&"table-cell"!==e.cssDisplay)}function wS(e){return kS(e)||"element"===e.type&&"br"===e.fullName||TS(e)}function TS(e){return BS(e)&&NS(e)}function BS(e){return e.hasLeadingSpaces&&(e.prev?e.prev.sourceSpan.end.line<e.sourceSpan.start.line:"root"===e.parent.type||e.parent.startSourceSpan.end.line<e.sourceSpan.start.line)}function NS(e){return e.hasTrailingSpaces&&(e.next?e.next.sourceSpan.start.line>e.sourceSpan.end.line:"root"===e.parent.type||e.parent.endSourceSpan&&e.parent.endSourceSpan.start.line>e.sourceSpan.end.line)}function kS(e){switch(e.type){case"ieConditionalComment":case"comment":case"directive":return!0;case"element":return["script","select"].includes(e.name)}return!1}function PS(e){const{type:t,lang:n}=e.attrMap;return"module"===t||"text/javascript"===t||"text/babel"===t||"application/javascript"===t||"jsx"===n?"babel":"application/x-typescript"===t||"ts"===n||"tsx"===n?"typescript":"text/markdown"===t?"markdown":"text/html"===t?"html":t&&(t.endsWith("json")||t.endsWith("importmap"))?"json":"text/x-handlebars-template"===t?"glimmer":void 0}function OS(e){return"block"===e||"list-item"===e||e.startsWith("table")}function IS(e){return MS(e).startsWith("pre")}function LS(e){return"element"===e.type&&!e.hasExplicitNamespace&&!["html","svg"].includes(e.namespace)}function MS(e){return"element"===e.type&&(!e.namespace||LS(e))&&hS[e.name]||mS}const jS=new Set(["template","style","script"]);function _S(e,t){return RS(e,t)&&!jS.has(e.fullName)}function RS(e,t){return"vue"===t.parser&&"element"===e.type&&"root"===e.parent.type&&"html"!==e.fullName.toLowerCase()}function VS(e,t){return RS(e,t)&&(_S(e,t)||e.attrMap.lang&&"html"!==e.attrMap.lang)}var $S={HTML_ELEMENT_ATTRIBUTES:DS,HTML_TAGS:gS,htmlTrim:e=>(e=>e.replace(/^[\t\n\f\r ]+/,""))(ES(e)),htmlTrimPreserveIndentation:e=>(e=>e.replace(/^[\t\f\r ]*?\n/g,""))(ES(e)),splitByHtmlWhitespace:e=>e.split(/[\t\n\f\r ]+/),hasHtmlWhitespace:e=>/[\t\n\f\r ]/.test(e),getLeadingAndTrailingHtmlWhitespace:e=>{const[,t,n,r]=e.match(/^([\t\n\f\r ]*)([\S\s]*?)([\t\n\f\r ]*)$/);return{leadingWhitespace:t,trailingWhitespace:r,text:n}},canHaveInterpolation:function(e){return e.children&&!FS(e)},countChars:function(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n},countParents:function(e,t){let n=0;for(let r=e.stack.length-1;r>=0;r--){const o=e.stack[r];o&&"object"==typeof o&&!Array.isArray(o)&&t(o)&&n++}return n},dedentString:function(e,t=function(e){let t=1/0;for(const n of e.split("\n")){if(0===n.length)continue;if(!yS.has(n[0]))return 0;const e=CS(n).length;n.length!==e&&e<t&&(t=e)}return t===1/0?0:t}(e)){return 0===t?e:e.split("\n").map((e=>e.slice(t))).join("\n")},forceBreakChildren:SS,forceBreakContent:function(e){return SS(e)||"element"===e.type&&0!==e.children.length&&(["body","script","style"].includes(e.name)||e.children.some((e=>function(e){return e.children&&e.children.some((e=>"text"!==e.type))}(e))))||e.firstChild&&e.firstChild===e.lastChild&&"text"!==e.firstChild.type&&BS(e.firstChild)&&(!e.lastChild.isTrailingSpaceSensitive||NS(e.lastChild))},forceNextEmptyLine:function(e){return pS(e)||e.next&&e.sourceSpan.end&&e.sourceSpan.end.line+1<e.next.sourceSpan.start.line},getLastDescendant:function e(t){return t.lastChild?e(t.lastChild):t},getNodeCssStyleDisplay:function(e,t){if(e.prev&&"comment"===e.prev.type){const t=e.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/);if(t)return t[1]}let n=!1;if("element"===e.type&&"svg"===e.namespace){if(!function(e,t){let n=e;for(;n;){if(t(n))return!0;n=n.parent}return!1}(e,(e=>"svg:foreignObject"===e.fullName)))return"svg"===e.name?"inline-block":"block";n=!0}switch(t.htmlWhitespaceSensitivity){case"strict":return"inline";case"ignore":return"block";default:return"vue"===t.parser&&e.parent&&"root"===e.parent.type?"block":"element"===e.type&&(!e.namespace||n||LS(e))&&dS[e.name]||fS}},getNodeCssStyleWhiteSpace:MS,getPrettierIgnoreAttributeCommentData:function(e){const t=e.trim().match(/^prettier-ignore-attribute(?:\s+([^]+))?$/);return!!t&&(!t[1]||t[1].split(/\s+/))},hasPrettierIgnore:AS,inferScriptParser:function(e,t){return"script"!==e.name||e.attrMap.src?"style"===e.name?function(e){const{lang:t}=e.attrMap;return t&&"postcss"!==t&&"css"!==t?"scss"===t?"scss":"less"===t?"less":void 0:"css"}(e):t&&VS(e,t)?PS(e)||!("src"in e.attrMap)&&lS(e.attrMap.lang,t):void 0:e.attrMap.lang||e.attrMap.type?PS(e):"babel"},isVueCustomBlock:_S,isVueNonHtmlBlock:VS,isVueSlotAttribute:function(e){const t=e.fullName;return"#"===t.charAt(0)||"slot-scope"===t||"v-slot"===t||t.startsWith("v-slot:")},isVueSfcBindingsAttribute:function(e,t){const n=e.parent;if(!RS(n,t))return!1;const r=n.fullName,o=e.fullName;return"script"===r&&"setup"===o||"style"===r&&"vars"===o},isDanglingSpaceSensitiveNode:function(e){return!(t=e.cssDisplay,OS(t)||"inline-block"===t||FS(e));var t},isIndentationSensitiveNode:xS,isLeadingSpaceSensitiveNode:function(e,t){const n=function(){if(pS(e))return!1;if(("text"===e.type||"interpolation"===e.type)&&e.prev&&("text"===e.prev.type||"interpolation"===e.prev.type))return!0;if(!e.parent||"none"===e.parent.cssDisplay)return!1;if(IS(e.parent))return!0;if(!e.prev&&("root"===e.parent.type||IS(e)&&e.parent||FS(e.parent)||_S(e.parent,t)||(n=e.parent.cssDisplay,OS(n)||"inline-block"===n)))return!1;var n;if(e.prev&&!function(e){return!OS(e)}(e.prev.cssDisplay))return!1;return!0}();return n&&!e.prev&&e.parent&&e.parent.tagDefinition&&e.parent.tagDefinition.ignoreFirstLf?"interpolation"===e.type:n},isPreLikeNode:IS,isScriptLikeTag:FS,isTextLikeNode:function(e){return"text"===e.type||"comment"===e.type},isTrailingSpaceSensitiveNode:function(e,t){return!pS(e)&&(!("text"!==e.type&&"interpolation"!==e.type||!e.next||"text"!==e.next.type&&"interpolation"!==e.next.type)||!(!e.parent||"none"===e.parent.cssDisplay)&&(!!IS(e.parent)||!(!e.next&&("root"===e.parent.type||IS(e)&&e.parent||FS(e.parent)||_S(e.parent,t)||(n=e.parent.cssDisplay,OS(n)||"inline-block"===n)))&&!(e.next&&!function(e){return!OS(e)}(e.next.cssDisplay))));var n},isWhitespaceSensitiveNode:function(e){return FS(e)||"interpolation"===e.type||xS(e)},isUnknownNamespace:LS,preferHardlineAsLeadingSpaces:function(e){return kS(e)||e.prev&&wS(e.prev)||TS(e)},preferHardlineAsTrailingSpaces:wS,shouldNotPrintClosingTag:function(e,t){return!e.isSelfClosing&&!e.endSourceSpan&&(AS(e)||vS(e.parent,t))},shouldPreserveContent:vS,unescapeQuoteEntities:function(e){return e.replace(/'/g,"'").replace(/"/g,'"')}},qS=je((function(e,t){function n(e){return t.$0<=e&&e<=t.$9}
+/**
+ * @license
+ * Copyright Google Inc. All Rights Reserved.
+ *
+ * Use of this source code is governed by an MIT-style license that can be
+ * found in the LICENSE file at https://angular.io/license
*/
- root.children[0] === document && /---(\s|$)/.test(options.originalText.slice(options.locStart(document), options.locStart(document) + 4)) ||
- /**
- * %DIRECTIVE
- * ---
+Object.defineProperty(t,"__esModule",{value:!0}),t.$EOF=0,t.$BSPACE=8,t.$TAB=9,t.$LF=10,t.$VTAB=11,t.$FF=12,t.$CR=13,t.$SPACE=32,t.$BANG=33,t.$DQ=34,t.$HASH=35,t.$$=36,t.$PERCENT=37,t.$AMPERSAND=38,t.$SQ=39,t.$LPAREN=40,t.$RPAREN=41,t.$STAR=42,t.$PLUS=43,t.$COMMA=44,t.$MINUS=45,t.$PERIOD=46,t.$SLASH=47,t.$COLON=58,t.$SEMICOLON=59,t.$LT=60,t.$EQ=61,t.$GT=62,t.$QUESTION=63,t.$0=48,t.$7=55,t.$9=57,t.$A=65,t.$E=69,t.$F=70,t.$X=88,t.$Z=90,t.$LBRACKET=91,t.$BACKSLASH=92,t.$RBRACKET=93,t.$CARET=94,t.$_=95,t.$a=97,t.$b=98,t.$e=101,t.$f=102,t.$n=110,t.$r=114,t.$t=116,t.$u=117,t.$v=118,t.$x=120,t.$z=122,t.$LBRACE=123,t.$BAR=124,t.$RBRACE=125,t.$NBSP=160,t.$PIPE=124,t.$TILDA=126,t.$AT=64,t.$BT=96,t.isWhitespace=function(e){return e>=t.$TAB&&e<=t.$SPACE||e==t.$NBSP},t.isDigit=n,t.isAsciiLetter=function(e){return e>=t.$a&&e<=t.$z||e>=t.$A&&e<=t.$Z},t.isAsciiHexDigit=function(e){return e>=t.$a&&e<=t.$f||e>=t.$A&&e<=t.$F||n(e)},t.isNewLine=function(e){return e===t.$LF||e===t.$CR},t.isOctalDigit=function(e){return t.$0<=e&&e<=t.$7}})),WS=je((function(e,t){
+/**
+ * @license
+ * Copyright Google Inc. All Rights Reserved.
+ *
+ * Use of this source code is governed by an MIT-style license that can be
+ * found in the LICENSE file at https://angular.io/license
*/
- document.head.children.length !== 0 ||
- /**
- * # end comment
- * ---
+Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(e,t,n){this.filePath=e,this.name=t,this.members=n}assertNoMembers(){if(this.members.length)throw new Error("Illegal state: symbol without members expected, but got ".concat(JSON.stringify(this),"."))}}t.StaticSymbol=n;t.StaticSymbolCache=class{constructor(){this.cache=new Map}get(e,t,r){const o=(r=r||[]).length?".".concat(r.join(".")):"",u='"'.concat(e,'".').concat(t).concat(o);let i=this.cache.get(u);return i||(i=new n(e,t,r),this.cache.set(u,i)),i}}})),US=je((function(e,t){
+/**
+ * @license
+ * Copyright Google Inc. All Rights Reserved.
+ *
+ * Use of this source code is governed by an MIT-style license that can be
+ * found in the LICENSE file at https://angular.io/license
*/
- hasEndComments$1(document.head) ||
- /**
- * --- # trailing comment
+Object.defineProperty(t,"__esModule",{value:!0});const n=/-+([a-z0-9])/g;function r(e,t,n){const r=e.indexOf(t);return-1==r?n:[e.slice(0,r).trim(),e.slice(r+1).trim()]}function o(e,t,n){return Array.isArray(e)?t.visitArray(e,n):"object"==typeof(r=e)&&null!==r&&Object.getPrototypeOf(r)===a?t.visitStringMap(e,n):null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e?t.visitPrimitive(e,n):t.visitOther(e,n);var r}t.dashCaseToCamelCase=function(e){return e.replace(n,((...e)=>e[1].toUpperCase()))},t.splitAtColon=function(e,t){return r(e,":",t)},t.splitAtPeriod=function(e,t){return r(e,".",t)},t.visitValue=o,t.isDefined=function(e){return null!=e},t.noUndefined=function(e){return void 0===e?null:e};t.ValueTransformer=class{visitArray(e,t){return e.map((e=>o(e,this,t)))}visitStringMap(e,t){const n={};return Object.keys(e).forEach((r=>{n[r]=o(e[r],this,t)})),n}visitPrimitive(e,t){return e}visitOther(e,t){return e}},t.SyncAsync={assertSync:e=>{if(s(e))throw new Error("Illegal state: value cannot be a promise");return e},then:(e,t)=>s(e)?e.then(t):t(e),all:e=>e.some(s)?Promise.all(e):e},t.error=function(e){throw new Error("Internal Error: ".concat(e))},t.syntaxError=function(e,t){const n=Error(e);return n[u]=!0,t&&(n[i]=t),n};const u="ngSyntaxError",i="ngParseErrors";t.isSyntaxError=function(e){return e[u]},t.getParseErrors=function(e){return e[i]||[]},t.escapeRegExp=function(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};const a=Object.getPrototypeOf({});function s(e){return!!e&&"function"==typeof e.then}t.utf8Encode=function(e){let t="";for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=55296&&r<=56319&&e.length>n+1){const t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(n++,r=(r-55296<<10)+t-56320+65536)}r<=127?t+=String.fromCharCode(r):r<=2047?t+=String.fromCharCode(r>>6&31|192,63&r|128):r<=65535?t+=String.fromCharCode(r>>12|224,r>>6&63|128,63&r|128):r<=2097151&&(t+=String.fromCharCode(r>>18&7|240,r>>12&63|128,r>>6&63|128,63&r|128))}return t},t.stringify=function e(t){if("string"==typeof t)return t;if(t instanceof Array)return"["+t.map(e).join(", ")+"]";if(null==t)return""+t;if(t.overriddenName)return"".concat(t.overriddenName);if(t.name)return"".concat(t.name);if(!t.toString)return"object";const n=t.toString();if(null==n)return""+n;const r=n.indexOf("\n");return-1===r?n:n.substring(0,r)},t.resolveForwardRef=function(e){return"function"==typeof e&&e.hasOwnProperty("__forward_ref__")?e():e},t.isPromise=s;t.Version=class{constructor(e){this.full=e;const t=e.split(".");this.major=t[0],this.minor=t[1],this.patch=t.slice(2).join(".")}};const c="undefined"!=typeof window&&window,l="undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,p=void 0!==Me&&Me||c||l;t.global=p})),JS=je((function(e,t){
+/**
+ * @license
+ * Copyright Google Inc. All Rights Reserved.
+ *
+ * Use of this source code is governed by an MIT-style license that can be
+ * found in the LICENSE file at https://angular.io/license
*/
- hasTrailingComment$3(document.head)) {
- return "head";
- }
-
- if (shouldPrintDocumentEndMarker(document, nextDocument)) {
- return false;
- }
-
- return nextDocument ? "root" : false;
- }
-
- function isAbsolutelyPrintedAsSingleLineNode(node, options) {
- if (!node) {
- return true;
- }
-
- switch (node.type) {
- case "plain":
- case "quoteSingle":
- case "quoteDouble":
- break;
-
- case "alias":
- return true;
-
- default:
- return false;
- }
-
- if (options.proseWrap === "preserve") {
- return node.position.start.line === node.position.end.line;
- }
-
- if ( // backslash-newline
- /\\$/m.test(options.originalText.slice(node.position.start.offset, node.position.end.offset))) {
- return false;
- }
-
- switch (options.proseWrap) {
- case "never":
- return !node.value.includes("\n");
-
- case "always":
- return !/[\n ]/.test(node.value);
- // istanbul ignore next
-
- default:
- return false;
- }
- }
-
- function needsSpaceInFrontOfMappingValue(node) {
- return node.key.content && node.key.content.type === "alias";
- }
-
- function printNextEmptyLine(path, originalText) {
- const node = path.getValue();
- const root = path.stack[0];
- root.isNextEmptyLinePrintedChecklist = root.isNextEmptyLinePrintedChecklist || [];
-
- if (!root.isNextEmptyLinePrintedChecklist[node.position.end.line]) {
- if (isNextLineEmpty$6(node, originalText)) {
- root.isNextEmptyLinePrintedChecklist[node.position.end.line] = true;
- return softline$8;
- }
- }
-
- return "";
- }
-
- function printFlowScalarContent(nodeType, content, options) {
- const lineContents = getFlowScalarLineContents$1(nodeType, content, options);
- return join$c(hardline$d, lineContents.map(lineContentWords => fill$6(join$c(line$b, lineContentWords).parts)));
- }
-
- function clean$7(node, newNode
- /*, parent */
- ) {
- if (isNode$1(newNode)) {
- delete newNode.position;
-
- switch (newNode.type) {
- case "comment":
- // insert pragma
- if (isPragma$1(newNode.value)) {
- return null;
- }
-
- break;
-
- case "quoteDouble":
- case "quoteSingle":
- newNode.type = "quote";
- break;
- }
- }
- }
-
- var printerYaml = {
- preprocess: preprocess$3,
- print: genericPrint$6,
- massageAstNode: clean$7,
- insertPragma: insertPragma$9
- };
-
- var options$7 = {
- bracketSpacing: commonOptions.bracketSpacing,
- singleQuote: commonOptions.singleQuote,
- proseWrap: commonOptions.proseWrap
- };
-
- var name$h = "YAML";
- var type$g = "data";
- var tmScope$g = "source.yaml";
- var aliases$6 = [
- "yml"
- ];
- var extensions$g = [
- ".yml",
- ".mir",
- ".reek",
- ".rviz",
- ".sublime-syntax",
- ".syntax",
- ".yaml",
- ".yaml-tmlanguage",
- ".yaml.sed",
- ".yml.mysql"
- ];
- var filenames$4 = [
- ".clang-format",
- ".clang-tidy",
- ".gemrc",
- "glide.lock",
- "yarn.lock"
- ];
- var aceMode$g = "yaml";
- var codemirrorMode$c = "yaml";
- var codemirrorMimeType$c = "text/x-yaml";
- var languageId$g = 407;
- var YAML = {
- name: name$h,
- type: type$g,
- tmScope: tmScope$g,
- aliases: aliases$6,
- extensions: extensions$g,
- filenames: filenames$4,
- aceMode: aceMode$g,
- codemirrorMode: codemirrorMode$c,
- codemirrorMimeType: codemirrorMimeType$c,
- languageId: languageId$g
- };
-
- var YAML$1 = /*#__PURE__*/Object.freeze({
- __proto__: null,
- name: name$h,
- type: type$g,
- tmScope: tmScope$g,
- aliases: aliases$6,
- extensions: extensions$g,
- filenames: filenames$4,
- aceMode: aceMode$g,
- codemirrorMode: codemirrorMode$c,
- codemirrorMimeType: codemirrorMimeType$c,
- languageId: languageId$g,
- 'default': YAML
- });
-
- var require$$0$8 = getCjsExportFromNamespace(YAML$1);
-
- const languages$6 = [createLanguage(require$$0$8, data => ({
- since: "1.14.0",
- parsers: ["yaml"],
- vscodeLanguageIds: ["yaml"],
- // yarn.lock is not YAML: https://github.com/yarnpkg/yarn/issues/5629
- filenames: data.filenames.filter(filename => filename !== "yarn.lock")
- }))];
- var languageYaml = {
- languages: languages$6,
- printers: {
- yaml: printerYaml
- },
- options: options$7
- };
-
- const {
- version: version$2
- } = require$$0;
- const {
- getSupportInfo: getSupportInfo$2
- } = support;
- const internalPlugins = [languageCss, languageGraphql, languageHandlebars, languageHtml, languageJs, languageMarkdown, languageYaml];
-
- function withPlugins(fn, optsArgIdx = 1 // Usually `opts` is the 2nd argument
- ) {
- return (...args) => {
- const opts = args[optsArgIdx] || {};
- const plugins = opts.plugins || [];
- args[optsArgIdx] = Object.assign({}, opts, {
- plugins: [...internalPlugins, ...(Array.isArray(plugins) ? plugins : Object.values(plugins))]
- });
- return fn(...args);
- };
- }
-
- const formatWithCursor = withPlugins(core.formatWithCursor);
- var standalone = {
- formatWithCursor,
-
- format(text, opts) {
- return formatWithCursor(text, opts).formatted;
- },
-
- check(text, opts) {
- const {
- formatted
- } = formatWithCursor(text, opts);
- return formatted === text;
- },
-
- doc: document,
- getSupportInfo: withPlugins(getSupportInfo$2, 0),
- version: version$2,
- util: utilShared,
- __debug: {
- parse: withPlugins(core.parse),
- formatAST: withPlugins(core.formatAST),
- formatDoc: withPlugins(core.formatDoc),
- printToDoc: withPlugins(core.printToDoc),
- printDocToString: withPlugins(core.printDocToString)
- }
- };
-
- var standalone$1 = standalone;
-
- return standalone$1;
-
-})));
+Object.defineProperty(t,"__esModule",{value:!0});const n=/^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;function r(e){return e.replace(/\W/g,"_")}t.sanitizeIdentifier=r;let o=0;function u(e){if(!e||!e.reference)return null;const t=e.reference;if(t instanceof WS.StaticSymbol)return t.name;if(t.__anonymousType)return t.__anonymousType;let n=US.stringify(t);return n.indexOf("(")>=0?(n="anonymous_".concat(o++),t.__anonymousType=n):n=r(n),n}var i;t.identifierName=u,t.identifierModuleUrl=function(e){const t=e.reference;return t instanceof WS.StaticSymbol?t.filePath:"./".concat(US.stringify(t))},t.viewClassName=function(e,t){return"View_".concat(u({reference:e}),"_").concat(t)},t.rendererTypeName=function(e){return"RenderType_".concat(u({reference:e}))},t.hostViewClassName=function(e){return"HostView_".concat(u({reference:e}))},t.componentFactoryName=function(e){return"".concat(u({reference:e}),"NgFactory")},function(e){e[e.Pipe=0]="Pipe",e[e.Directive=1]="Directive",e[e.NgModule=2]="NgModule",e[e.Injectable=3]="Injectable"}(i=t.CompileSummaryKind||(t.CompileSummaryKind={})),t.tokenName=function(e){return null!=e.value?r(e.value):u(e.identifier)},t.tokenReference=function(e){return null!=e.identifier?e.identifier.reference:e.value};t.CompileStylesheetMetadata=class{constructor({moduleUrl:e,styles:t,styleUrls:n}={}){this.moduleUrl=e||null,this.styles=s(t),this.styleUrls=s(n)}};t.CompileTemplateMetadata=class{constructor({encapsulation:e,template:t,templateUrl:n,htmlAst:r,styles:o,styleUrls:u,externalStylesheets:i,animations:a,ngContentSelectors:l,interpolation:p,isInline:d,preserveWhitespaces:f}){if(this.encapsulation=e,this.template=t,this.templateUrl=n,this.htmlAst=r,this.styles=s(o),this.styleUrls=s(u),this.externalStylesheets=s(i),this.animations=a?c(a):[],this.ngContentSelectors=l||[],p&&2!=p.length)throw new Error("'interpolation' should have a start and an end symbol.");this.interpolation=p,this.isInline=d,this.preserveWhitespaces=f}toSummary(){return{ngContentSelectors:this.ngContentSelectors,encapsulation:this.encapsulation,styles:this.styles,animations:this.animations}}};class a{static create({isHost:e,type:t,isComponent:r,selector:o,exportAs:u,changeDetection:i,inputs:s,outputs:c,host:l,providers:p,viewProviders:d,queries:f,guards:h,viewQueries:m,entryComponents:g,template:D,componentViewType:y,rendererType:E,componentFactory:C}){const b={},v={},A={};null!=l&&Object.keys(l).forEach((e=>{const t=l[e],r=e.match(n);null===r?A[e]=t:null!=r[1]?v[r[1]]=t:null!=r[2]&&(b[r[2]]=t)}));const F={};null!=s&&s.forEach((e=>{const t=US.splitAtColon(e,[e,e]);F[t[0]]=t[1]}));const x={};return null!=c&&c.forEach((e=>{const t=US.splitAtColon(e,[e,e]);x[t[0]]=t[1]})),new a({isHost:e,type:t,isComponent:!!r,selector:o,exportAs:u,changeDetection:i,inputs:F,outputs:x,hostListeners:b,hostProperties:v,hostAttributes:A,providers:p,viewProviders:d,queries:f,guards:h,viewQueries:m,entryComponents:g,template:D,componentViewType:y,rendererType:E,componentFactory:C})}constructor({isHost:e,type:t,isComponent:n,selector:r,exportAs:o,changeDetection:u,inputs:i,outputs:a,hostListeners:c,hostProperties:l,hostAttributes:p,providers:d,viewProviders:f,queries:h,guards:m,viewQueries:g,entryComponents:D,template:y,componentViewType:E,rendererType:C,componentFactory:b}){this.isHost=!!e,this.type=t,this.isComponent=n,this.selector=r,this.exportAs=o,this.changeDetection=u,this.inputs=i,this.outputs=a,this.hostListeners=c,this.hostProperties=l,this.hostAttributes=p,this.providers=s(d),this.viewProviders=s(f),this.queries=s(h),this.guards=m,this.viewQueries=s(g),this.entryComponents=s(D),this.template=y,this.componentViewType=E,this.rendererType=C,this.componentFactory=b}toSummary(){return{summaryKind:i.Directive,type:this.type,isComponent:this.isComponent,selector:this.selector,exportAs:this.exportAs,inputs:this.inputs,outputs:this.outputs,hostListeners:this.hostListeners,hostProperties:this.hostProperties,hostAttributes:this.hostAttributes,providers:this.providers,viewProviders:this.viewProviders,queries:this.queries,guards:this.guards,viewQueries:this.viewQueries,entryComponents:this.entryComponents,changeDetection:this.changeDetection,template:this.template&&this.template.toSummary(),componentViewType:this.componentViewType,rendererType:this.rendererType,componentFactory:this.componentFactory}}}t.CompileDirectiveMetadata=a;t.CompilePipeMetadata=class{constructor({type:e,name:t,pure:n}){this.type=e,this.name=t,this.pure=!!n}toSummary(){return{summaryKind:i.Pipe,type:this.type,name:this.name,pure:this.pure}}};t.CompileShallowModuleMetadata=class{};t.CompileNgModuleMetadata=class{constructor({type:e,providers:t,declaredDirectives:n,exportedDirectives:r,declaredPipes:o,exportedPipes:u,entryComponents:i,bootstrapComponents:a,importedModules:c,exportedModules:l,schemas:p,transitiveModule:d,id:f}){this.type=e||null,this.declaredDirectives=s(n),this.exportedDirectives=s(r),this.declaredPipes=s(o),this.exportedPipes=s(u),this.providers=s(t),this.entryComponents=s(i),this.bootstrapComponents=s(a),this.importedModules=s(c),this.exportedModules=s(l),this.schemas=s(p),this.id=f||null,this.transitiveModule=d||null}toSummary(){const e=this.transitiveModule;return{summaryKind:i.NgModule,type:this.type,entryComponents:e.entryComponents,providers:e.providers,modules:e.modules,exportedDirectives:e.exportedDirectives,exportedPipes:e.exportedPipes}}};function s(e){return e||[]}t.TransitiveCompileNgModuleMetadata=class{constructor(){this.directivesSet=new Set,this.directives=[],this.exportedDirectivesSet=new Set,this.exportedDirectives=[],this.pipesSet=new Set,this.pipes=[],this.exportedPipesSet=new Set,this.exportedPipes=[],this.modulesSet=new Set,this.modules=[],this.entryComponentsSet=new Set,this.entryComponents=[],this.providers=[]}addProvider(e,t){this.providers.push({provider:e,module:t})}addDirective(e){this.directivesSet.has(e.reference)||(this.directivesSet.add(e.reference),this.directives.push(e))}addExportedDirective(e){this.exportedDirectivesSet.has(e.reference)||(this.exportedDirectivesSet.add(e.reference),this.exportedDirectives.push(e))}addPipe(e){this.pipesSet.has(e.reference)||(this.pipesSet.add(e.reference),this.pipes.push(e))}addExportedPipe(e){this.exportedPipesSet.has(e.reference)||(this.exportedPipesSet.add(e.reference),this.exportedPipes.push(e))}addModule(e){this.modulesSet.has(e.reference)||(this.modulesSet.add(e.reference),this.modules.push(e))}addEntryComponent(e){this.entryComponentsSet.has(e.componentType)||(this.entryComponentsSet.add(e.componentType),this.entryComponents.push(e))}};function c(e){return e.reduce(((e,t)=>{const n=Array.isArray(t)?c(t):t;return e.concat(n)}),[])}function l(e){return e.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/,"ng:///")}t.ProviderMeta=class{constructor(e,{useClass:t,useValue:n,useExisting:r,useFactory:o,deps:u,multi:i}){this.token=e,this.useClass=t||null,this.useValue=n,this.useExisting=r,this.useFactory=o||null,this.dependencies=u||null,this.multi=!!i}},t.flatten=c,t.templateSourceUrl=function(e,t,n){let r;return r=n.isInline?t.type.reference instanceof WS.StaticSymbol?"".concat(t.type.reference.filePath,".").concat(t.type.reference.name,".html"):"".concat(u(e),"/").concat(u(t.type),".html"):n.templateUrl,t.type.reference instanceof WS.StaticSymbol?r:l(r)},t.sharedStylesheetJitUrl=function(e,t){const n=e.moduleUrl.split(/\/\\/g),r=n[n.length-1];return l("css/".concat(t).concat(r,".ngstyle.js"))},t.ngModuleJitUrl=function(e){return l("".concat(u(e.type),"/module.ngfactory.js"))},t.templateJitUrl=function(e,t){return l("".concat(u(e),"/").concat(u(t.type),".ngfactory.js"))}})),zS=je((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});
+/**
+ * @license
+ * Copyright Google Inc. All Rights Reserved.
+ *
+ * Use of this source code is governed by an MIT-style license that can be
+ * found in the LICENSE file at https://angular.io/license
+ */
+class n{constructor(e,t,n,r){this.file=e,this.offset=t,this.line=n,this.col=r}toString(){return null!=this.offset?"".concat(this.file.url,"@").concat(this.line,":").concat(this.col):this.file.url}moveBy(e){const t=this.file.content,r=t.length;let o=this.offset,u=this.line,i=this.col;for(;o>0&&e<0;){o--,e++;if(t.charCodeAt(o)==qS.$LF){u--;const e=t.substr(0,o-1).lastIndexOf(String.fromCharCode(qS.$LF));i=e>0?o-e:o}else i--}for(;o<r&&e>0;){const n=t.charCodeAt(o);o++,e--,n==qS.$LF?(u++,i=0):i++}return new n(this.file,o,u,i)}getContext(e,t){const n=this.file.content;let r=this.offset;if(null!=r){r>n.length-1&&(r=n.length-1);let o=r,u=0,i=0;for(;u<e&&r>0&&(r--,u++,"\n"!=n[r]||++i!=t););for(u=0,i=0;u<e&&o<n.length-1&&(o++,u++,"\n"!=n[o]||++i!=t););return{before:n.substring(r,this.offset),after:n.substring(this.offset,o+1)}}return null}}t.ParseLocation=n;class r{constructor(e,t){this.content=e,this.url=t}}t.ParseSourceFile=r;class o{constructor(e,t,n=null){this.start=e,this.end=t,this.details=n}toString(){return this.start.file.content.substring(this.start.offset,this.end.offset)}}var u;t.ParseSourceSpan=o,t.EMPTY_PARSE_LOCATION=new n(new r("",""),0,0,0),t.EMPTY_SOURCE_SPAN=new o(t.EMPTY_PARSE_LOCATION,t.EMPTY_PARSE_LOCATION),function(e){e[e.WARNING=0]="WARNING",e[e.ERROR=1]="ERROR"}(u=t.ParseErrorLevel||(t.ParseErrorLevel={}));t.ParseError=class{constructor(e,t,n=u.ERROR){this.span=e,this.msg=t,this.level=n}contextualMessage(){const e=this.span.start.getContext(100,3);return e?"".concat(this.msg,' ("').concat(e.before,"[").concat(u[this.level]," ->]").concat(e.after,'")'):this.msg}toString(){const e=this.span.details?", ".concat(this.span.details):"";return"".concat(this.contextualMessage(),": ").concat(this.span.start).concat(e)}},t.typeSourceSpan=function(e,t){const u=JS.identifierModuleUrl(t),i=null!=u?"in ".concat(e," ").concat(JS.identifierName(t)," in ").concat(u):"in ".concat(e," ").concat(JS.identifierName(t)),a=new r("",i);return new o(new n(a,-1,-1,-1),new n(a,-1,-1,-1))},t.r3JitTypeSourceSpan=function(e,t,u){const i="in ".concat(e," ").concat(t," in ").concat(u),a=new r("",i);return new o(new n(a,-1,-1,-1),new n(a,-1,-1,-1))}}));const{ParseSourceSpan:HS}=zS,{htmlTrim:GS,getLeadingAndTrailingHtmlWhitespace:XS,hasHtmlWhitespace:YS,canHaveInterpolation:KS,getNodeCssStyleDisplay:QS,isDanglingSpaceSensitiveNode:ZS,isIndentationSensitiveNode:ew,isLeadingSpaceSensitiveNode:tw,isTrailingSpaceSensitiveNode:nw,isWhitespaceSensitiveNode:rw}=$S,ow=[function(e){return e.map((e=>{if("element"===e.type&&e.tagDefinition.ignoreFirstLf&&0!==e.children.length&&"text"===e.children[0].type&&"\n"===e.children[0].value[0]){const[t,...n]=e.children;return e.clone({children:1===t.value.length?n:[t.clone({value:t.value.slice(1)}),...n]})}return e}))},function(e){const t=e=>"element"===e.type&&e.prev&&"ieConditionalStartComment"===e.prev.type&&e.prev.sourceSpan.end.offset===e.startSourceSpan.start.offset&&e.firstChild&&"ieConditionalEndComment"===e.firstChild.type&&e.firstChild.sourceSpan.start.offset===e.startSourceSpan.end.offset;return e.map((e=>{if(e.children){const n=e.children.map(t);if(n.some(Boolean)){const t=[];for(let r=0;r<e.children.length;r++){const o=e.children[r];if(!n[r+1])if(n[r]){const e=o.prev,n=o.firstChild,r=new HS(e.sourceSpan.start,n.sourceSpan.end),u=new HS(r.start,o.sourceSpan.end);t.push(o.clone({condition:e.condition,sourceSpan:u,startSourceSpan:r,children:o.children.slice(1)}))}else t.push(o)}return e.clone({children:t})}}return e}))},function(e){return function(e,t,n){return e.map((e=>{if(e.children){const r=e.children.map(t);if(r.some(Boolean)){const t=[];for(let o=0;o<e.children.length;o++){const u=e.children[o];if("text"!==u.type&&!r[o]){t.push(u);continue}const i="text"===u.type?u:u.clone({type:"text",value:n(u)});if(0===t.length||"text"!==t[t.length-1].type){t.push(i);continue}const a=t.pop();t.push(a.clone({value:a.value+i.value,sourceSpan:new HS(a.sourceSpan.start,i.sourceSpan.end)}))}return e.clone({children:t})}}return e}))}(e,(e=>"cdata"===e.type),(e=>"<![CDATA[".concat(e.value,"]]>")))},function(e,t){if("html"===t.parser)return e;const n=/{{([\S\s]+?)}}/g;return e.map((e=>{if(!KS(e))return e;const t=[];for(const r of e.children){if("text"!==r.type){t.push(r);continue}let e=r.sourceSpan.start,o=null;const u=r.value.split(n);for(let n=0;n<u.length;n++,e=o){const r=u[n];n%2!=0?(o=e.moveBy(r.length+4),t.push({type:"interpolation",sourceSpan:new HS(e,o),children:0===r.length?[]:[{type:"text",value:r,sourceSpan:new HS(e.moveBy(2),o.moveBy(-2))}]})):(o=e.moveBy(r.length),0!==r.length&&t.push({type:"text",value:r,sourceSpan:new HS(e,o)}))}}return e.clone({children:t})}))},function(e){const t="whitespace";return e.map((e=>{if(!e.children)return e;if(0===e.children.length||1===e.children.length&&"text"===e.children[0].type&&0===GS(e.children[0].value).length)return e.clone({children:[],hasDanglingSpaces:0!==e.children.length});const n=rw(e),r=ew(e);return e.clone({isWhitespaceSensitive:n,isIndentationSensitive:r,children:e.children.reduce(((e,r)=>{if("text"!==r.type||n)return e.concat(r);const o=[],{leadingWhitespace:u,text:i,trailingWhitespace:a}=XS(r.value);return u&&o.push({type:t}),i&&o.push({type:"text",value:i,sourceSpan:new HS(r.sourceSpan.start.moveBy(u.length),r.sourceSpan.end.moveBy(-a.length))}),a&&o.push({type:t}),e.concat(o)}),[]).reduce(((e,n,r,o)=>{if(n.type===t)return e;const u=0!==r&&o[r-1].type===t,i=r!==o.length-1&&o[r+1].type===t;return e.concat(Object.assign({},n,{hasLeadingSpaces:u,hasTrailingSpaces:i}))}),[])})}))},function(e,t){return e.map((e=>Object.assign(e,{cssDisplay:QS(e,t)})))},function(e){return e.map((e=>Object.assign(e,{isSelfClosing:!e.children||"element"===e.type&&(e.tagDefinition.isVoid||e.startSourceSpan===e.endSourceSpan)})))},function(e,t){return e.map((e=>"element"!==e.type?e:Object.assign(e,{hasHtmComponentClosingTag:e.endSourceSpan&&/^<\s*\/\s*\/\s*>$/.test(t.originalText.slice(e.endSourceSpan.start.offset,e.endSourceSpan.end.offset))})))},function(e,t){return e.map((e=>e.children?0===e.children.length?e.clone({isDanglingSpaceSensitive:ZS(e)}):e.clone({children:e.children.map((e=>Object.assign({},e,{isLeadingSpaceSensitive:tw(e,t),isTrailingSpaceSensitive:nw(e,t)}))).map(((e,t,n)=>Object.assign({},e,{isLeadingSpaceSensitive:(0===t||n[t-1].isTrailingSpaceSensitive)&&e.isLeadingSpaceSensitive,isTrailingSpaceSensitive:(t===n.length-1||n[t+1].isLeadingSpaceSensitive)&&e.isTrailingSpaceSensitive})))}):e))},function(e){const t=e=>"element"===e.type&&0===e.attrs.length&&1===e.children.length&&"text"===e.firstChild.type&&!YS(e.children[0].value)&&!e.firstChild.hasLeadingSpaces&&!e.firstChild.hasTrailingSpaces&&e.isLeadingSpaceSensitive&&!e.hasLeadingSpaces&&e.isTrailingSpaceSensitive&&!e.hasTrailingSpaces&&e.prev&&"text"===e.prev.type&&e.next&&"text"===e.next.type;return e.map((e=>{if(e.children){const n=e.children.map(t);if(n.some(Boolean)){const t=[];for(let r=0;r<e.children.length;r++){const o=e.children[r];if(n[r]){const n=t.pop(),u=e.children[++r],{isTrailingSpaceSensitive:i,hasTrailingSpaces:a}=u;t.push(n.clone({value:n.value+"<".concat(o.rawName,">")+o.firstChild.value+"</".concat(o.rawName,">")+u.value,sourceSpan:new HS(n.sourceSpan.start,u.sourceSpan.end),isTrailingSpaceSensitive:i,hasTrailingSpaces:a}))}else t.push(o)}return e.clone({children:t})}}return e}))}];var uw=function(e,t){for(const n of ow)e=n(e,t);return e};var iw={hasPragma:function(e){return/^\s*<!--\s*@(format|prettier)\s*-->/.test(e)},insertPragma:function(e){return"\x3c!-- @format --\x3e\n\n"+e.replace(/^\s*\n/,"")}};var aw={locStart:function(e){return e.sourceSpan.start.offset},locEnd:function(e){return e.sourceSpan.end.offset}};const{builders:{concat:sw,group:cw}}=cn;var lw={isVueEventBindingExpression:function(e){const t=e.trim();return/^([\w$]+|\([^)]*?\))\s*=>|^function\s*\(/.test(t)||/^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[$A-Z_a-z][\w$]*])*$/.test(t)},printVueFor:function(e,t){const{left:n,operator:r,right:o}=function(e){const t=/([^]*?)\s+(in|of)\s+([^]*)/,n=/,([^,\]}]*)(?:,([^,\]}]*))?$/,r=/^\(|\)$/g,o=e.match(t);if(!o)return;const u={};u.for=o[3].trim();const i=o[1].trim().replace(r,""),a=i.match(n);a?(u.alias=i.replace(n,""),u.iterator1=a[1].trim(),a[2]&&(u.iterator2=a[2].trim())):u.alias=i;return{left:"".concat([u.alias,u.iterator1,u.iterator2].filter(Boolean).join(",")),operator:o[2],right:u.for}}(e);return sw([cw(t("function _(".concat(n,") {}"),{parser:"babel",__isVueForBindingLeft:!0}))," ",r," ",t(o,{parser:"__js_expression"},{stripTrailingHardline:!0})])},printVueBindings:function(e,t){return t("function _(".concat(e,") {}"),{parser:"babel",__isVueBindings:!0},{stripTrailingHardline:!0})}},pw=je((function(e){!function(t,n){e.exports?e.exports=n():t.parseSrcset=n()}(Me,(function(){return function(e,t){var n=t&&t.logger||console;function r(e){return" "===e||"\t"===e||"\n"===e||"\f"===e||"\r"===e}function o(t){var n,r=t.exec(e.substring(D));if(r)return n=r[0],D+=n.length,n}for(var u,i,a,s,c,l=e.length,p=/^[ \t\n\r\u000c]+/,d=/^[, \t\n\r\u000c]+/,f=/^[^ \t\n\r\u000c]+/,h=/[,]+$/,m=/^\d+$/,g=/^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,D=0,y=[];;){if(o(d),D>=l)return y;u=o(f),i=[],","===u.slice(-1)?(u=u.replace(h,""),C()):E()}function E(){for(o(p),a="",s="in descriptor";;){if(c=e.charAt(D),"in descriptor"===s)if(r(c))a&&(i.push(a),a="",s="after descriptor");else{if(","===c)return D+=1,a&&i.push(a),void C();if("("===c)a+=c,s="in parens";else{if(""===c)return a&&i.push(a),void C();a+=c}}else if("in parens"===s)if(")"===c)a+=c,s="in descriptor";else{if(""===c)return i.push(a),void C();a+=c}else if("after descriptor"===s)if(r(c));else{if(""===c)return void C();s="in descriptor",D-=1}D+=1}}function C(){var t,r,o,a,s,c,l,p,d,f=!1,h={};for(a=0;a<i.length;a++)c=(s=i[a])[s.length-1],l=s.substring(0,s.length-1),p=parseInt(l,10),d=parseFloat(l),m.test(l)&&"w"===c?((t||r)&&(f=!0),0===p?f=!0:t=p):g.test(l)&&"x"===c?((t||r||o)&&(f=!0),d<0?f=!0:r=d):m.test(l)&&"h"===c?((o||r)&&(f=!0),0===p?f=!0:o=p):f=!0;f?n&&n.error&&n.error("Invalid srcset descriptor found in '"+e+"' at '"+s+"'."):(h.url=u,t&&(h.w=t),r&&(h.d=r),o&&(h.h=o),y.push(h))}}}))}));const{builders:{concat:dw,ifBreak:fw,join:hw,line:mw}}=cn;var gw={printImgSrcset:function(e){const t=pw(e,{logger:{error(e){throw new Error(e)}}}),n=t.some((({w:e})=>e)),r=t.some((({h:e})=>e));if(n+r+t.some((({d:e})=>e))>1)throw new Error("Mixed descriptor in srcset is not supported");const o=n?"w":r?"h":"d",u=n?"w":r?"h":"x",i=e=>Math.max(...e),a=t.map((e=>e.url)),s=i(a.map((e=>e.length))),c=t.map((e=>e[o])).map((e=>e?e.toString():"")),l=c.map((e=>{const t=e.indexOf(".");return-1===t?e.length:t})),p=i(l);return hw(dw([",",mw]),a.map(((e,t)=>{const n=[e],r=c[t];if(r){const o=s-e.length+1,i=p-l[t],a=" ".repeat(o+i);n.push(fw(a," "),r+u)}return dw(n)})))},printClassNames:function(e){return e.trim().split(/\s+/).join(" ")}};const{builders:Dw,utils:{mapDoc:yw,normalizeParts:Ew}}=cn,{replaceEndOfLineWith:Cw}=Lt,{print:bw}=ob,{breakParent:vw,dedentToRoot:Aw,fill:Fw,group:xw,hardline:Sw,ifBreak:ww,indent:Tw,join:Bw,line:Nw,literalline:kw,softline:Pw}=Dw,{htmlTrimPreserveIndentation:Ow,splitByHtmlWhitespace:Iw,countChars:Lw,countParents:Mw,dedentString:jw,forceBreakChildren:_w,forceBreakContent:Rw,forceNextEmptyLine:Vw,getLastDescendant:$w,getPrettierIgnoreAttributeCommentData:qw,hasPrettierIgnore:Ww,inferScriptParser:Uw,isVueCustomBlock:Jw,isVueNonHtmlBlock:zw,isVueSlotAttribute:Hw,isVueSfcBindingsAttribute:Gw,isScriptLikeTag:Xw,isTextLikeNode:Yw,preferHardlineAsLeadingSpaces:Kw,shouldNotPrintClosingTag:Qw,shouldPreserveContent:Zw,unescapeQuoteEntities:eT,isPreLikeNode:tT}=$S,{insertPragma:nT}=iw,{locStart:rT,locEnd:oT}=aw,{printVueFor:uT,printVueBindings:iT,isVueEventBindingExpression:aT}=lw,{printImgSrcset:sT,printClassNames:cT}=gw;function lT(e){const t=Ew(e);return 0===t.length?"":1===t.length?t[0]:Dw.concat(t)}function pT(e,t,n){const r=e.getValue();if(_w(r))return lT([vw,lT(e.map((e=>{const t=e.getValue(),n=t.prev?i(t.prev,t):"";return lT([n?lT([n,Vw(t.prev)?Sw:""]):"",u(e)])}),"children"))]);const o=r.children.map((()=>Symbol("")));return lT(e.map(((e,t)=>{const n=e.getValue();if(Yw(n)){if(n.prev&&Yw(n.prev)){const t=i(n.prev,n);if(t)return Vw(n.prev)?lT([Sw,Sw,u(e)]):lT([t,u(e)])}return u(e)}const r=[],a=[],s=[],c=[],l=n.prev?i(n.prev,n):"",p=n.next?i(n,n.next):"";return l&&(Vw(n.prev)?r.push(Sw,Sw):l===Sw?r.push(Sw):Yw(n.prev)?a.push(l):a.push(ww("",Pw,{groupId:o[t-1]}))),p&&(Vw(n)?Yw(n.next)&&c.push(Sw,Sw):p===Sw?Yw(n.next)&&c.push(Sw):s.push(p)),lT([].concat(r,xw(lT([lT(a),xw(lT([u(e),lT(s)]),{id:o[t]})])),c))}),"children"));function u(e){const r=e.getValue();return Ww(r)?lT([].concat(xT(r,t),Cw(t.originalText.slice(rT(r)+(r.prev&&CT(r.prev)?TT(r).length:0),oT(r)-(r.next&&vT(r.next)?kT(r,t).length:0)),kw),wT(r,t))):n(e)}function i(e,t){return Yw(e)&&Yw(t)?e.isTrailingSpaceSensitive?e.hasTrailingSpaces?Kw(t)?Sw:Nw:"":Kw(t)?Sw:Pw:CT(e)&&(Ww(t)||t.firstChild||t.isSelfClosing||"element"===t.type&&0!==t.attrs.length)||"element"===e.type&&e.isSelfClosing&&vT(t)?"":!t.isLeadingSpaceSensitive||Kw(t)||vT(t)&&e.lastChild&&FT(e.lastChild)&&e.lastChild.lastChild&&FT(e.lastChild.lastChild)?Sw:t.hasLeadingSpaces?Nw:Pw}}function dT(e,t){let n=e.startSourceSpan.end.offset;e.firstChild&&bT(e.firstChild)&&(n-=BT(e).length);let r=e.endSourceSpan.start.offset;return e.lastChild&&FT(e.lastChild)?r+=NT(e,t).length:AT(e)&&(r-=kT(e.lastChild,t).length),t.originalText.slice(n,r)}function fT(e,t,n){const r=e.getValue();if(!r.attrs||0===r.attrs.length)return r.isSelfClosing?" ":"";const o=r.prev&&"comment"===r.prev.type&&qw(r.prev.value),u="boolean"==typeof o?()=>o:Array.isArray(o)?e=>o.includes(e.rawName):()=>!1,i=e.map((e=>{const r=e.getValue();return u(r)?lT(Cw(t.originalText.slice(rT(r),oT(r)),kw)):n(e)}),"attrs"),a="element"===r.type&&"script"===r.fullName&&1===r.attrs.length&&"src"===r.attrs[0].fullName&&0===r.children.length,s=[Tw(lT([a?" ":Nw,Bw(Nw,i)]))];return r.firstChild&&bT(r.firstChild)||r.isSelfClosing&&AT(r.parent)||a?s.push(r.isSelfClosing?" ":""):s.push(r.isSelfClosing?Nw:Pw),lT(s)}function hT(e,t,n){const r=e.getValue();return lT([mT(r,t),fT(e,t,n),r.isSelfClosing?"":gT(r)])}function mT(e,t){return e.prev&&CT(e.prev)?"":lT([xT(e,t),TT(e)])}function gT(e){return e.firstChild&&bT(e.firstChild)?"":BT(e)}function DT(e,t){return lT([e.isSelfClosing?"":yT(e,t),ET(e,t)])}function yT(e,t){return e.lastChild&&FT(e.lastChild)?"":lT([ST(e,t),NT(e,t)])}function ET(e,t){return(e.next?vT(e.next):AT(e.parent))?"":lT([kT(e,t),wT(e,t)])}function CT(e){return e.next&&!Yw(e.next)&&Yw(e)&&e.isTrailingSpaceSensitive&&!e.hasTrailingSpaces}function bT(e){return!e.prev&&e.isLeadingSpaceSensitive&&!e.hasLeadingSpaces}function vT(e){return e.prev&&"docType"!==e.prev.type&&!Yw(e.prev)&&e.isLeadingSpaceSensitive&&!e.hasLeadingSpaces}function AT(e){return e.lastChild&&e.lastChild.isTrailingSpaceSensitive&&!e.lastChild.hasTrailingSpaces&&!Yw($w(e.lastChild))&&!tT(e)}function FT(e){return!e.next&&!e.hasTrailingSpaces&&e.isTrailingSpaceSensitive&&Yw($w(e))}function xT(e,t){return bT(e)?BT(e.parent):vT(e)?kT(e.prev,t):""}function ST(e,t){return AT(e)?kT(e.lastChild,t):""}function wT(e,t){return FT(e)?NT(e.parent,t):CT(e)?TT(e.next):""}function TT(e){switch(e.type){case"ieConditionalComment":case"ieConditionalStartComment":return"\x3c!--[if ".concat(e.condition);case"ieConditionalEndComment":return"\x3c!--<!";case"interpolation":return"{{";case"docType":return"<!DOCTYPE";case"element":if(e.condition)return"\x3c!--[if ".concat(e.condition,"]>\x3c!--\x3e<").concat(e.rawName);default:return"<".concat(e.rawName)}}function BT(e){switch(ta(!e.isSelfClosing),e.type){case"ieConditionalComment":return"]>";case"element":if(e.condition)return">\x3c!--<![endif]--\x3e";default:return">"}}function NT(e,t){if(ta(!e.isSelfClosing),Qw(e,t))return"";switch(e.type){case"ieConditionalComment":return"<!";case"element":if(e.hasHtmComponentClosingTag)return"<//";default:return"</".concat(e.rawName)}}function kT(e,t){if(Qw(e,t))return"";switch(e.type){case"ieConditionalComment":case"ieConditionalEndComment":return"[endif]--\x3e";case"ieConditionalStartComment":return"]>\x3c!--\x3e";case"interpolation":return"}}";case"element":if(e.isSelfClosing)return"/>";default:return">"}}function PT(e,t=e.value){return e.parent.isWhitespaceSensitive?e.parent.isIndentationSensitive?Cw(t,kw):Cw(jw(Ow(t)),Sw):Bw(Nw,Iw(t)).parts}var OT={preprocess:uw,print:function(e,t,n){const r=e.getValue();switch(r.type){case"front-matter":return lT(Cw(r.raw,kw));case"root":return t.__onHtmlRoot&&t.__onHtmlRoot(r),Dw.concat([xw(pT(e,t,n)),Sw]);case"element":case"ieConditionalComment":{if(Zw(r,t))return lT([].concat(xT(r,t),xw(hT(e,t,n)),Cw(dT(r,t),kw),DT(r,t),wT(r,t)));const u=1===r.children.length&&"interpolation"===r.firstChild.type&&r.firstChild.isLeadingSpaceSensitive&&!r.firstChild.hasLeadingSpaces&&r.lastChild.isTrailingSpaceSensitive&&!r.lastChild.hasTrailingSpaces,i=Symbol("element-attr-group-id");return lT([xw(lT([xw(hT(e,t,n),{id:i}),0===r.children.length?r.hasDanglingSpaces&&r.isDanglingSpaceSensitive?Nw:"":lT([Rw(r)?vw:"",(o=lT([u?ww(Pw,"",{groupId:i}):r.firstChild.hasLeadingSpaces&&r.firstChild.isLeadingSpaceSensitive?Nw:"text"===r.firstChild.type&&r.isWhitespaceSensitive&&r.isIndentationSensitive?Aw(Pw):Pw,pT(e,t,n)]),u?ww(Tw(o),o,{groupId:i}):!Xw(r)&&!Jw(r,t)||"root"!==r.parent.type||"vue"!==t.parser||t.vueIndentScriptAndStyle?Tw(o):o),(r.next?vT(r.next):AT(r.parent))?r.lastChild.hasTrailingSpaces&&r.lastChild.isTrailingSpaceSensitive?" ":"":u?ww(Pw,"",{groupId:i}):r.lastChild.hasTrailingSpaces&&r.lastChild.isTrailingSpaceSensitive?Nw:("comment"===r.lastChild.type||"text"===r.lastChild.type&&r.isWhitespaceSensitive&&r.isIndentationSensitive)&&new RegExp("\\n[\\t ]{".concat(t.tabWidth*Mw(e,(e=>e.parent&&"root"!==e.parent.type)),"}$")).test(r.lastChild.value)?"":Pw])])),DT(r,t)])}case"ieConditionalStartComment":case"ieConditionalEndComment":return lT([mT(r),ET(r)]);case"interpolation":return lT([mT(r,t),lT(e.map(n,"children")),ET(r,t)]);case"text":if("interpolation"===r.parent.type){const e=/\n[^\S\n]*?$/,t=e.test(r.value),n=t?r.value.replace(e,""):r.value;return lT([lT(Cw(n,kw)),t?Sw:""])}return Fw(Ew([].concat(xT(r,t),PT(r),wT(r,t))));case"docType":return lT([xw(lT([mT(r,t)," ",r.value.replace(/^html\b/i,"html").replace(/\s+/g," ")])),ET(r,t)]);case"comment":return lT([xT(r,t),lT(Cw(t.originalText.slice(rT(r),oT(r)),kw)),wT(r,t)]);case"attribute":{if(null===r.value)return r.rawName;const e=eT(r.value),t=Lw(e,"'")<Lw(e,'"')?"'":'"';return lT([r.rawName,lT(["=",t,lT(Cw('"'===t?e.replace(/"/g,"""):e.replace(/'/g,"'"),kw)),t])])}default:throw new Error("Unexpected node type ".concat(r.type))}var o},insertPragma:nT,massageAstNode:sS,embed:function(e,t,n,r){const o=e.getValue();switch(o.type){case"element":if(Xw(o)||"interpolation"===o.type)return;if(!o.isSelfClosing&&zw(o,r)){const u=Uw(o,r);if(!u)return;const i=dT(o,r);let a=/^\s*$/.test(i),s="";return a||(s=n(Ow(i),{parser:u},{stripTrailingHardline:!0}),a=""===s),lT([xT(o,r),xw(hT(e,r,t)),a?"":Sw,s,a?"":Sw,DT(o,r),wT(o,r)])}break;case"text":if(Xw(o.parent)){const e=Uw(o.parent);if(e){const t="markdown"===e?jw(o.value.replace(/^[^\S\n]*?\n/,"")):o.value,u={parser:e};if("html"===r.parser&&"babel"===e){let e="script";const{attrMap:t}=o.parent;t&&("module"===t.type||"text/babel"===t.type&&"module"===t["data-type"])&&(e="module"),u.__babelSourceType=e}return Dw.concat([lT([vw,xT(o,r),n(t,u,{stripTrailingHardline:!0}),wT(o,r)])])}}else if("interpolation"===o.parent.type)return lT([Tw(lT([Nw,n(o.value,Object.assign({__isInHtmlInterpolation:!0},"angular"===r.parser?{parser:"__ng_interpolation",trailingComma:"none"}:"vue"===r.parser?{parser:"__vue_expression"}:{parser:"__js_expression"}),{stripTrailingHardline:!0})])),o.parent.next&&vT(o.parent.next)?" ":Nw]);break;case"attribute":{if(!o.value)break;if(/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(r.originalText.slice(o.valueSpan.start.offset,o.valueSpan.end.offset)))return lT([o.rawName,"=",o.value]);if("lwc"===r.parser){if(/^{[\S\s]*}$/.test(r.originalText.slice(o.valueSpan.start.offset,o.valueSpan.end.offset)))return lT([o.rawName,"=",o.value])}const e=function(e,t,n){const r=t=>new RegExp(t.join("|")).test(e.fullName),o=()=>eT(e.value);let u=!1;const i=(e,t)=>{const n="NGRoot"===e.type?"NGMicrosyntax"===e.node.type&&1===e.node.body.length&&"NGMicrosyntaxExpression"===e.node.body[0].type?e.node.body[0].expression:e.node:"JsExpressionRoot"===e.type?e.node:e;!n||"ObjectExpression"!==n.type&&"ArrayExpression"!==n.type&&("__vue_expression"!==t.parser||"TemplateLiteral"!==n.type&&"StringLiteral"!==n.type)||(u=!0)},a=e=>xw(e),s=(e,t=!0)=>xw(lT([Tw(lT([Pw,e])),t?Pw:""])),c=e=>u?a(e):s(e),l=(e,n)=>t(e,Object.assign({__onHtmlBindingRoot:i},n),{stripTrailingHardline:!0});if("srcset"===e.fullName&&("img"===e.parent.fullName||"source"===e.parent.fullName))return s(sT(o()));if("class"===e.fullName&&!n.parentParser){const e=o();if(!e.includes("{{"))return cT(e)}if("style"===e.fullName&&!n.parentParser){const e=o();if(!e.includes("{{"))return s(l(e,{parser:"css",__isHTMLStyleAttribute:!0}))}if("vue"===n.parser){if("v-for"===e.fullName)return uT(o(),l);if(Hw(e)||Gw(e,n))return iT(o(),l);const t=["^:","^v-bind:"],u=["^v-"];if(r(["^@","^v-on:"])){const e=o();return c(l(e,{parser:aT(e)?"__js_expression":"__vue_event_binding"}))}if(r(t))return c(l(o(),{parser:"__vue_expression"}));if(r(u))return c(l(o(),{parser:"__js_expression"}))}if("angular"===n.parser){const t=(e,t)=>l(e,Object.assign({},t,{trailingComma:"none"})),n=["^\\*"],u=["^\\[.+\\]$","^bind(on)?-","^ng-(if|show|hide|class|style)$"],i=["^i18n(-.+)?$"];if(r(["^\\(.+\\)$","^on-"]))return c(t(o(),{parser:"__ng_action"}));if(r(u))return c(t(o(),{parser:"__ng_binding"}));if(r(i)){const t=o().trim();return s(Fw(PT(e,t)),!t.includes("@@"))}if(r(n))return c(t(o(),{parser:"__ng_directive"}));const a=/{{([\S\s]+?)}}/g,p=o();if(a.test(p)){const e=[];return p.split(a).forEach(((n,r)=>{if(r%2==0)e.push(lT(Cw(n,kw)));else try{e.push(xw(lT(["{{",Tw(lT([Nw,t(n,{parser:"__ng_interpolation",__isInHtmlInterpolation:!0})])),Nw,"}}"])))}catch(t){e.push("{{",lT(Cw(n,kw)),"}}")}})),xw(lT(e))}}return null}(o,((e,t)=>n(e,Object.assign({__isInHtmlAttribute:!0},t),{stripTrailingHardline:!0})),r);if(e)return lT([o.rawName,'="',xw(yw(e,(e=>"string"==typeof e?e.replace(/"/g,"""):e))),'"']);break}case"front-matter":return bw(o,n)}}};const IT="HTML";var LT={htmlWhitespaceSensitivity:{since:"1.15.0",category:IT,type:"choice",default:"css",description:"How to handle whitespaces in HTML.",choices:[{value:"css",description:"Respect the default value of CSS display property."},{value:"strict",description:"Whitespaces are considered sensitive."},{value:"ignore",description:"Whitespaces are considered insensitive."}]},vueIndentScriptAndStyle:{since:"1.19.0",category:IT,type:"boolean",default:!1,description:"Indent script and style tags in Vue files."}},MT={name:"HTML",type:"markup",tmScope:"text.html.basic",aceMode:"html",codemirrorMode:"htmlmixed",codemirrorMimeType:"text/html",color:"#e34c26",aliases:["xhtml"],extensions:[".html",".htm",".html.hl",".inc",".st",".xht",".xhtml"],languageId:146},jT={name:"Vue",type:"markup",color:"#2c3e50",extensions:[".vue"],tmScope:"text.html.vue",aceMode:"html",languageId:391};var _T={languages:[ks(MT,(()=>({name:"Angular",since:"1.15.0",parsers:["angular"],vscodeLanguageIds:["html"],extensions:[".component.html"],filenames:[]}))),ks(MT,(e=>({since:"1.15.0",parsers:["html"],vscodeLanguageIds:["html"],extensions:e.extensions.concat([".mjml"])}))),ks(MT,(()=>({name:"Lightning Web Components",since:"1.17.0",parsers:["lwc"],vscodeLanguageIds:["html"],extensions:[],filenames:[]}))),ks(jT,(()=>({since:"1.10.0",parsers:["vue"],vscodeLanguageIds:["vue"]})))],printers:{html:OT},options:LT,parsers:{get html(){return{}.parsers.html},get vue(){return{}.parsers.vue},get angular(){return{}.parsers.angular},get lwc(){return{}.parsers.lwc}}};var RT={isPragma:function(e){return/^\s*@(prettier|format)\s*$/.test(e)},hasPragma:function(e){return/^\s*#[^\S\n]*@(prettier|format)\s*?(\n|$)/.test(e)},insertPragma:function(e){return"# @format\n\n".concat(e)}};var VT={locStart:function(e){return e.position.start.offset},locEnd:function(e){return e.position.end.offset}};const{getLast:$T}=Lt;function qT(e,t){return e&&"string"==typeof e.type&&(!t||t.includes(e.type))}function WT(e){return"prettier-ignore"===e.value.trim()}function UT(e){return e&&e.leadingComments&&0!==e.leadingComments.length}function JT(e){return e&&e.middleComments&&0!==e.middleComments.length}function zT(e){return e&&e.indicatorComment}function HT(e){return e&&e.trailingComment}function GT(e){return e&&e.endComments&&0!==e.endComments.length}function XT(e){const t=[];let n;for(const r of e.split(/( +)/g))" "!==r?" "===n?t.push(r):t.push((t.pop()||"")+r):void 0===n&&t.unshift(""),n=r;return" "===n&&t.push((t.pop()||"")+" "),""===t[0]&&(t.shift(),t.unshift(" "+(t.shift()||""))),t}var YT={getLast:$T,getAncestorCount:function(e,t){let n=0;const r=e.stack.length-1;for(let o=0;o<r;o++){const r=e.stack[o];qT(r)&&t(r)&&n++}return n},isNode:qT,isEmptyNode:function(e){return!(e.children&&0!==e.children.length||function(e){return UT(e)||JT(e)||zT(e)||HT(e)||GT(e)}(e))},mapNode:function e(t,n,r){return n("children"in t?Object.assign({},t,{children:t.children.map((r=>e(r,n,t)))}):t,r)},defineShortcut:function(e,t,n){Object.defineProperty(e,t,{get:n,enumerable:!1})},isNextLineEmpty:function(e,t){let n=0;const r=t.length;for(let o=e.position.end.offset-1;o<r;o++){const e=t[o];if("\n"===e&&n++,1===n&&/\S/.test(e))return!1;if(2===n)return!0}return!1},isLastDescendantNode:function(e){switch(e.getValue().type){case"tag":case"anchor":case"comment":return!1}const t=e.stack.length;for(let n=1;n<t;n++){const t=e.stack[n],r=e.stack[n-1];if(Array.isArray(r)&&"number"==typeof t&&t!==r.length-1)return!1}return!0},getBlockValueLineContents:function(e,{parentIndent:t,isLastDescendant:n,options:r}){const o=e.position.start.line===e.position.end.line?"":r.originalText.slice(e.position.start.offset,e.position.end.offset).match(/^[^\n]*?\n([\S\s]*)$/)[1],u=null===e.indent?(i=o.match(/^( *)\S/m))?i[1].length:1/0:e.indent-1+t;var i;const a=o.split("\n").map((e=>e.slice(u)));return"preserve"===r.proseWrap||"blockLiteral"===e.type?s(a.map((e=>0===e.length?[]:[e]))):s(a.map((e=>0===e.length?[]:XT(e))).reduce(((e,t,n)=>0===n||0===a[n-1].length||0===t.length||/^\s/.test(t[0])||/^\s|\s$/.test($T(e))?e.concat([t]):e.concat([e.pop().concat(t)])),[]).map((e=>e.reduce(((e,t)=>0!==e.length&&/\s$/.test($T(e))?e.concat(e.pop()+" "+t):e.concat(t)),[]))).map((e=>"never"===r.proseWrap?[e.join(" ")]:e)));function s(t){if("keep"===e.chomping)return 0===$T(t).length?t.slice(0,-1):t;let r=0;for(let e=t.length-1;e>=0&&0===t[e].length;e--)r++;return 0===r?t:r>=2&&!n?t.slice(0,-(r-1)):t.slice(0,-r)}},getFlowScalarLineContents:function(e,t,n){const r=t.split("\n").map(((e,t,n)=>0===t&&t===n.length-1?e:0!==t&&t!==n.length-1?e.trim():0===t?e.trimEnd():e.trimStart()));return"preserve"===n.proseWrap?r.map((e=>0===e.length?[]:[e])):r.map((e=>0===e.length?[]:XT(e))).reduce(((t,n,o)=>0===o||0===r[o-1].length||0===n.length||"quoteDouble"===e&&$T($T(t)).endsWith("\\")?t.concat([n]):t.concat([t.pop().concat(n)])),[]).map((e=>"never"===n.proseWrap?[e.join(" ")]:e))},getLastDescendantNode:function e(t){return"children"in t&&0!==t.children.length?e($T(t.children)):t},hasPrettierIgnore:function(e){const t=e.getValue();if("documentBody"===t.type){const t=e.getParentNode();return GT(t.head)&&WT($T(t.head.endComments))}return UT(t)&&WT($T(t.leadingComments))},hasLeadingComments:UT,hasMiddleComments:JT,hasIndicatorComment:zT,hasTrailingComment:HT,hasEndComments:GT};const KT=cn.builders,{conditionalGroup:QT,breakParent:ZT,concat:eB,dedent:tB,dedentToRoot:nB,fill:rB,group:oB,hardline:uB,ifBreak:iB,join:aB,line:sB,lineSuffix:cB,literalline:lB,markAsRoot:pB,softline:dB}=KT,{replaceEndOfLineWith:fB,isPreviousLineEmpty:hB}=Lt,{insertPragma:mB,isPragma:gB}=RT,{locStart:DB}=VT,{getAncestorCount:yB,getBlockValueLineContents:EB,getFlowScalarLineContents:CB,getLast:bB,getLastDescendantNode:vB,hasLeadingComments:AB,hasMiddleComments:FB,hasIndicatorComment:xB,hasTrailingComment:SB,hasEndComments:wB,hasPrettierIgnore:TB,isLastDescendantNode:BB,isNextLineEmpty:NB,isNode:kB,isEmptyNode:PB,defineShortcut:OB,mapNode:IB}=YT;function LB(e){switch(e.type){case"document":OB(e,"head",(()=>e.children[0])),OB(e,"body",(()=>e.children[1]));break;case"documentBody":case"sequenceItem":case"flowSequenceItem":case"mappingKey":case"mappingValue":OB(e,"content",(()=>e.children[0]));break;case"mappingItem":case"flowMappingItem":OB(e,"key",(()=>e.children[0])),OB(e,"value",(()=>e.children[1]))}return e}function MB(e,t,n,r,o){switch(e.type){case"root":return eB([aB(uB,n.map(((t,r)=>{const u=e.children[r],i=e.children[r+1];return eB([o(t),VB(u,i)?eB([uB,"...",SB(u)?eB([" ",n.call(o,"trailingComment")]):""]):!i||SB(i.head)?"":eB([uB,"---"])])}),"children")),0===e.children.length||(i=vB(e),kB(i,["blockLiteral","blockFolded"])&&"keep"===i.chomping)?"":uB]);case"document":{const u=t.children[n.getName()+1];return aB(uB,["head"===$B(e,u,t,r)?aB(uB,[0===e.head.children.length&&0===e.head.endComments.length?"":n.call(o,"head"),eB(["---",SB(e.head)?eB([" ",n.call(o,"head","trailingComment")]):""])].filter(Boolean)):"",RB(e)?n.call(o,"body"):""].filter(Boolean))}case"documentHead":return aB(uB,[].concat(n.map(o,"children"),n.map(o,"endComments")));case"documentBody":{const t=aB(uB,n.map(o,"children")).parts,r=aB(uB,n.map(o,"endComments")).parts,u=0===t.length||0===r.length?"":(e=>kB(e,["blockFolded","blockLiteral"])?"keep"===e.chomping?"":eB([uB,uB]):uB)(vB(e));return eB([].concat(t,u,r))}case"directive":return eB(["%",aB(" ",[e.name].concat(e.parameters))]);case"comment":return eB(["#",e.value]);case"alias":return eB(["*",e.value]);case"tag":return r.originalText.slice(e.position.start.offset,e.position.end.offset);case"anchor":return eB(["&",e.value]);case"plain":return HB(e.type,r.originalText.slice(e.position.start.offset,e.position.end.offset),r);case"quoteDouble":case"quoteSingle":{const t="'",n='"',o=r.originalText.slice(e.position.start.offset+1,e.position.end.offset-1);if("quoteSingle"===e.type&&o.includes("\\")||"quoteDouble"===e.type&&/\\[^"]/.test(o)){const u="quoteDouble"===e.type?n:t;return eB([u,HB(e.type,o,r),u])}if(o.includes(n))return eB([t,HB(e.type,"quoteDouble"===e.type?o.replace(/\\"/g,n).replace(/'/g,t.repeat(2)):o,r),t]);if(o.includes(t))return eB([n,HB(e.type,"quoteSingle"===e.type?o.replace(/''/g,t):o,r),n]);const u=r.singleQuote?t:n;return eB([u,HB(e.type,o,r),u])}case"blockFolded":case"blockLiteral":{const t=yB(n,(e=>kB(e,["sequence","mapping"]))),u=BB(n);return eB(["blockFolded"===e.type?">":"|",null===e.indent?"":e.indent.toString(),"clip"===e.chomping?"":"keep"===e.chomping?"+":"-",xB(e)?eB([" ",n.call(o,"indicatorComment")]):"",(null===e.indent?tB:nB)(jB(null===e.indent?r.tabWidth:e.indent-1+t,eB(EB(e,{parentIndent:t,isLastDescendant:u,options:r}).reduce(((t,n,r,o)=>t.concat(0===r?uB:"",rB(aB(sB,n).parts),r!==o.length-1?0===n.length?uB:pB(lB):"keep"===e.chomping&&u?0===n.length?nB(uB):nB(lB):"")),[]))))])}case"sequence":return aB(uB,n.map(o,"children"));case"sequenceItem":return eB(["- ",jB(2,e.content?n.call(o,"content"):"")]);case"mappingKey":case"mappingValue":return e.content?n.call(o,"content"):"";case"mapping":return aB(uB,n.map(o,"children"));case"mappingItem":case"flowMappingItem":{const u=PB(e.key),i=PB(e.value);if(u&&i)return eB([": "]);const s=n.call(o,"key"),c=n.call(o,"value");if(i)return"flowMappingItem"===e.type&&"flowMapping"===t.type?s:"mappingItem"!==e.type||!qB(e.key.content,r)||SB(e.key.content)||t.tag&&"tag:yaml.org,2002:set"===t.tag.value?eB(["? ",jB(2,s)]):eB([s,WB(e)?" ":"",":"]);if(u)return eB([": ",jB(2,c)]);const l=Symbol("mappingKey");return AB(e.value)||!_B(e.key.content)?eB(["? ",jB(2,s),uB,aB("",n.map(o,"value","leadingComments").map((e=>eB([e,uB])))),": ",jB(2,c)]):!function(e){if(!e)return!0;switch(e.type){case"plain":case"quoteDouble":case"quoteSingle":return e.position.start.line===e.position.end.line;case"alias":return!0;default:return!1}}(e.key.content)||AB(e.key.content)||FB(e.key.content)||SB(e.key.content)||wB(e.key)||AB(e.value.content)||FB(e.value.content)||wB(e.value)||!qB(e.value.content,r)?QT([eB([oB(eB([iB("? "),oB(jB(2,s),{id:l})])),iB(eB([uB,": ",jB(2,c)]),a(eB([WB(e)?" ":"",":",AB(e.value.content)||wB(e.value)&&e.value.content&&!kB(e.value.content,["mapping","sequence"])||"mapping"===t.type&&SB(e.key.content)&&_B(e.value.content)||kB(e.value.content,["mapping","sequence"])&&null===e.value.content.tag&&null===e.value.content.anchor?uB:e.value.content?sB:"",c])),{groupId:l})])]):eB([s,WB(e)?" ":"",": ",c])}case"flowMapping":case"flowSequence":{const t="flowMapping"===e.type?"{":"[",i="flowMapping"===e.type?"}":"]",s="flowMapping"===e.type&&0!==e.children.length&&r.bracketSpacing?sB:dB,c=0!==e.children.length&&("flowMappingItem"===(u=bB(e.children)).type&&PB(u.key)&&PB(u.value)),l="none"===r.trailingComma?"":iB(",","");return eB([t,a(eB([s,eB(n.map(((t,n)=>eB([o(t),n===e.children.length-1?"":eB([",",sB,e.children[n].position.start.line!==e.children[n+1].position.start.line?zB(t,r.originalText):""])])),"children")),l,wB(e)?eB([uB,aB(uB,n.map(o,"endComments"))]):""])),c?"":s,i])}case"flowSequenceItem":return n.call(o,"content");default:throw new Error("Unexpected node type ".concat(e.type))}var u,i;function a(e){return KT.align(" ".repeat(r.tabWidth),e)}}function jB(e,t){return"number"==typeof e&&e>0?KT.align(" ".repeat(e),t):KT.align(e,t)}function _B(e){if(!e)return!0;switch(e.type){case"plain":case"quoteDouble":case"quoteSingle":case"alias":case"flowMapping":case"flowSequence":return!0;default:return!1}}function RB(e){return 0!==e.body.children.length||wB(e.body)}function VB(e,t){return SB(e)||t&&(0!==t.head.children.length||wB(t.head))}function $B(e,t,n,r){return n.children[0]===e&&/---(\s|$)/.test(r.originalText.slice(DB(e),DB(e)+4))||0!==e.head.children.length||wB(e.head)||SB(e.head)?"head":!VB(e,t)&&(!!t&&"root")}function qB(e,t){if(!e)return!0;switch(e.type){case"plain":case"quoteSingle":case"quoteDouble":break;case"alias":return!0;default:return!1}if("preserve"===t.proseWrap)return e.position.start.line===e.position.end.line;if(/\\$/m.test(t.originalText.slice(e.position.start.offset,e.position.end.offset)))return!1;switch(t.proseWrap){case"never":return!e.value.includes("\n");case"always":return!/[\n ]/.test(e.value);default:return!1}}function WB(e){return e.key.content&&"alias"===e.key.content.type}function UB(e){return wB(e)&&!kB(e,["documentHead","documentBody","flowMapping","flowSequence"])}const JB=new WeakMap;function zB(e,t){const n=e.getValue(),r=e.stack[0];let o;return JB.has(r)?o=JB.get(r):(o=new Set,JB.set(r,o)),o.has(n.position.end.line)||(o.add(n.position.end.line),!NB(n,t)||UB(e.getParentNode()))?"":dB}function HB(e,t,n){const r=CB(e,t,n);return aB(uB,r.map((e=>rB(aB(sB,e).parts))))}var GB={preprocess:function(e){return IB(e,LB)},print:function(e,t,n){const r=e.getValue(),o=e.getParentNode(),u=r.tag?e.call(n,"tag"):"",i=r.anchor?e.call(n,"anchor"):"",a=kB(r,["mapping","sequence","comment","directive","mappingItem","sequenceItem"])&&!BB(e)?zB(e,t.originalText):"";return eB(["mappingValue"!==r.type&&AB(r)?eB([aB(uB,e.map(n,"leadingComments")),uB]):"",u,u&&i?" ":"",i,u||i?kB(r,["sequence","mapping"])&&!FB(r)?uB:" ":"",FB(r)?eB([1===r.middleComments.length?"":uB,aB(uB,e.map(n,"middleComments")),uB]):"",TB(e)?eB(fB(t.originalText.slice(r.position.start.offset,r.position.end.offset).trimEnd(),lB)):oB(MB(r,o,e,t,n)),SB(r)&&!kB(r,["document","documentHead"])?cB(eB(["mappingValue"!==r.type||r.content?" ":"","mappingKey"===o.type&&"mapping"===e.getParentNode(2).type&&_B(r)?"":ZT,e.call(n,"trailingComment")])):"",UB(r)?jB("sequenceItem"===r.type?2:0,eB([uB,aB(uB,e.map((e=>eB([hB(t.originalText,e.getValue(),DB)?uB:"",n(e)])),"endComments"))])):"",a])},massageAstNode:function(e,t){if(kB(t))switch(delete t.position,t.type){case"comment":if(gB(t.value))return null;break;case"quoteDouble":case"quoteSingle":t.type="quote"}},insertPragma:mB},XB={bracketSpacing:RC.bracketSpacing,singleQuote:RC.singleQuote,proseWrap:RC.proseWrap};var YB=[XC,Zv,uF,SF,oS,_T,{languages:[ks({name:"YAML",type:"data",color:"#cb171e",tmScope:"source.yaml",aliases:["yml"],extensions:[".yml",".mir",".reek",".rviz",".sublime-syntax",".syntax",".yaml",".yaml-tmlanguage",".yaml.sed",".yml.mysql"],filenames:[".clang-format",".clang-tidy",".gemrc","glide.lock","yarn.lock"],aceMode:"yaml",codemirrorMode:"yaml",codemirrorMimeType:"text/x-yaml",languageId:407},(e=>({since:"1.14.0",parsers:["yaml"],vscodeLanguageIds:["yaml","ansible","home-assistant"],filenames:e.filenames.filter((e=>"yarn.lock"!==e))})))],printers:{yaml:GB},options:XB,parsers:{get yaml(){return{}.parsers.yaml}}}];const{version:KB}=n,{getSupportInfo:QB}=gt,ZB=YB.map((t=>e(t,["parsers"])));function eN(e,t=1){return(...n)=>{const r=n[t]||{},o=r.plugins||[];return n[t]=Object.assign({},r,{plugins:[...ZB,...Array.isArray(o)?o:Object.values(o)]}),e(...n)}}const tN=eN(is.formatWithCursor);return{formatWithCursor:tN,format:(e,t)=>tN(e,t).formatted,check(e,t){const{formatted:n}=tN(e,t);return n===e},doc:cn,getSupportInfo:eN(QB,0),version:KB,util:Ns,__debug:{parse:eN(is.parse),formatAST:eN(is.formatAST),formatDoc:eN(is.formatDoc),printToDoc:eN(is.printToDoc),printDocToString:eN(is.printDocToString)}}}));