{“ast”:null,“code”:“'use strict';nnfunction _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); }nnmodule.exports = ansiHTML; // Reference to github.com/sindresorhus/ansi-regexnnvar _regANSI = /(?:(?:\u001b\[)|\u009b)(?:(?:{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b/;nvar _defColors = {n reset: ['fff', '000'],n // [FOREGROUD_COLOR, BACKGROUND_COLOR]n black: '000',n red: 'ff0000',n green: '209805',n yellow: 'e8bf03',n blue: '0000ff',n magenta: 'ff00ff',n cyan: '00ffee',n lightgrey: 'f0f0f0',n darkgrey: '888'n};nvar _styles = {n 30: 'black',n 31: 'red',n 32: 'green',n 33: 'yellow',n 34: 'blue',n 35: 'magenta',n 36: 'cyan',n 37: 'lightgrey'n};nvar _openTags = {n '1': 'font-weight:bold',n // boldn '2': 'opacity:0.5',n // dimn '3': '',n // italicn '4': '<u>',n // underscoren '8': 'display:none',n // hiddenn '9': '<del>' // deletenn};nvar _closeTags = {n '23': '',n // reset italicn '24': '</u>',n // reset underscoren '29': '</del>' // reset deletenn};n[0, 21, 22, 27, 28, 39, 49].forEach(function (n) {n _closeTags = '</span>';n});n/**n * Converts text with ANSI color codes to HTML markup.n * @param {String} textn * @returns {*}n */nnfunction ansiHTML(text) {n // Returns the text if the string has no ANSI escape code.n if (!_regANSI.test(text)) {n return text;n } // Cache opened sequence.nnn var ansiCodes = []; // Replace with markup.nn var ret = text.replace(/\033\[(\d+)*m/g, function (match, seq) {n var ot = _openTags;nn if (ot) {n // If current sequence has been opened, close it.n if (!!~ansiCodes.indexOf(seq)) {n // eslint-disable-line no-extra-boolean-castn ansiCodes.pop();n return '</span>';n } // Open tag.nnn ansiCodes.push(seq);n return ot === '<' ? ot : '<span style="' + ot + ';">';n }nn var ct = _closeTags;nn if (ct) {n // Pop sequencen ansiCodes.pop();n return ct;n }nn return '';n }); // Make sure tags are closed.nn var l = ansiCodes.length;n l > 0 && (ret += Array(l + 1).join('</span>'));n return ret;n}n/**n * Customize colors.n * @param {Object} colors reference to _defColorsn */nnnansiHTML.setColors = function (colors) {n if (_typeof(colors) !== 'object') {n throw new Error('`colors` parameter must be an Object.');n }nn var _finalColors = {};nn for (var key in _defColors) {n var hex = colors.hasOwnProperty(key) ? colors : null;nn if (!hex) {n _finalColors = _defColors;n continue;n }nn if ('reset' === key) {n if (typeof hex === 'string') {n hex = [hex];n }nn if (!Array.isArray(hex) || hex.length === 0 || hex.some(function (h) {n return typeof h !== 'string';n })) {n throw new Error('The value of `' + key + '` property must be an Array and each item could only be a hex string, e.g.: FF0000');n }nn var defHexColor = _defColors;nn if (!hex) {n hex = defHexColor;n }nn if (hex.length === 1 || !hex) {n hex = [hex];n hex.push(defHexColor);n }nn hex = hex.slice(0, 2);n } else if (typeof hex !== 'string') {n throw new Error('The value of `' + key + '` property must be a hex string, e.g.: FF0000');n }nn _finalColors = hex;n }nn _setTags(_finalColors);n};n/**n * Reset colors.n */nnnansiHTML.reset = function () {n _setTags(_defColors);n};n/**n * Expose tags, including open and close.n * @type {Object}n */nnnansiHTML.tags = {};nnif (Object.defineProperty) {n Object.defineProperty(ansiHTML.tags, 'open', {n get: function get() {n return _openTags;n }n });n Object.defineProperty(ansiHTML.tags, 'close', {n get: function get() {n return _closeTags;n }n });n} else {n ansiHTML.tags.open = _openTags;n ansiHTML.tags.close = _closeTags;n}nnfunction _setTags(colors) {n // reset alln _openTags = 'font-weight:normal;opacity:1;color:#' + colors.reset + ';background:#' + colors.reset; // inversenn _openTags = 'color:#' + colors.reset + ';background:#' + colors.reset; // dark greynn _openTags = 'color:#' + colors.darkgrey;nn for (var code in _styles) {n var color = _styles;n var oriColor = colors || '000';n _openTags = 'color:#' + oriColor;n code = parseInt(code);n _openTags[(code + 10).toString()] = 'background:#' + oriColor;n }n}nnansiHTML.reset();”,“map”:null,“metadata”:{},“sourceType”:“module”}