1 line
14 KiB
JSON
1 line
14 KiB
JSON
{"ast":null,"code":"'use strict';\n\nmodule.exports = ansiHTML;\n\n// Reference to https://github.com/sindresorhus/ansi-regex\nvar _regANSI = /(?:(?:\\u001b\\[)|\\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\\u001b[A-M]/;\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 // bold\n '2': 'opacity:0.5',\n // dim\n '3': '<i>',\n // italic\n '4': '<u>',\n // underscore\n '8': 'display:none',\n // hidden\n '9': '<del>' // delete\n};\nvar _closeTags = {\n '23': '</i>',\n // reset italic\n '24': '</u>',\n // reset underscore\n '29': '</del>' // reset delete\n};\n[0, 21, 22, 27, 28, 39, 49].forEach(function (n) {\n _closeTags[n] = '</span>';\n});\n\n/**\n * Converts text with ANSI color codes to HTML markup.\n * @param {String} text\n * @returns {*}\n */\nfunction ansiHTML(text) {\n // Returns the text if the string has no ANSI escape code.\n if (!_regANSI.test(text)) {\n return text;\n }\n\n // Cache opened sequence.\n var ansiCodes = [];\n // Replace with markup.\n var ret = text.replace(/\\033\\[(\\d+)m/g, function (match, seq) {\n var ot = _openTags[seq];\n if (ot) {\n // If current sequence has been opened, close it.\n if (!!~ansiCodes.indexOf(seq)) {\n // eslint-disable-line no-extra-boolean-cast\n ansiCodes.pop();\n return '</span>';\n }\n // Open tag.\n ansiCodes.push(seq);\n return ot[0] === '<' ? ot : '<span style=\"' + ot + ';\">';\n }\n var ct = _closeTags[seq];\n if (ct) {\n // Pop sequence\n ansiCodes.pop();\n return ct;\n }\n return '';\n });\n\n // Make sure tags are closed.\n var l = ansiCodes.length;\n l > 0 && (ret += Array(l + 1).join('</span>'));\n return ret;\n}\n\n/**\n * Customize colors.\n * @param {Object} colors reference to _defColors\n */\nansiHTML.setColors = function (colors) {\n if (typeof colors !== 'object') {\n throw new Error('`colors` parameter must be an Object.');\n }\n var _finalColors = {};\n for (var key in _defColors) {\n var hex = colors.hasOwnProperty(key) ? colors[key] : null;\n if (!hex) {\n _finalColors[key] = _defColors[key];\n continue;\n }\n if ('reset' === key) {\n if (typeof hex === 'string') {\n hex = [hex];\n }\n 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 }\n var defHexColor = _defColors[key];\n if (!hex[0]) {\n hex[0] = defHexColor[0];\n }\n if (hex.length === 1 || !hex[1]) {\n hex = [hex[0]];\n hex.push(defHexColor[1]);\n }\n 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 }\n _finalColors[key] = hex;\n }\n _setTags(_finalColors);\n};\n\n/**\n * Reset colors.\n */\nansiHTML.reset = function () {\n _setTags(_defColors);\n};\n\n/**\n * Expose tags, including open and close.\n * @type {Object}\n */\nansiHTML.tags = {};\nif (Object.defineProperty) {\n Object.defineProperty(ansiHTML.tags, 'open', {\n get: function () {\n return _openTags;\n }\n });\n Object.defineProperty(ansiHTML.tags, 'close', {\n get: function () {\n return _closeTags;\n }\n });\n} else {\n ansiHTML.tags.open = _openTags;\n ansiHTML.tags.close = _closeTags;\n}\nfunction _setTags(colors) {\n // reset all\n _openTags['0'] = 'font-weight:normal;opacity:1;color:#' + colors.reset[0] + ';background:#' + colors.reset[1];\n // inverse\n _openTags['7'] = 'color:#' + colors.reset[1] + ';background:#' + colors.reset[0];\n // dark grey\n _openTags['90'] = 'color:#' + colors.darkgrey;\n for (var code in _styles) {\n var color = _styles[code];\n var oriColor = colors[color] || '000';\n _openTags[code] = 'color:#' + oriColor;\n code = parseInt(code);\n _openTags[(code + 10).toString()] = 'background:#' + oriColor;\n }\n}\nansiHTML.reset();","map":{"version":3,"names":["module","exports","ansiHTML","_regANSI","_defColors","reset","black","red","green","yellow","blue","magenta","cyan","lightgrey","darkgrey","_styles","_openTags","_closeTags","forEach","n","text","test","ansiCodes","ret","replace","match","seq","ot","indexOf","pop","push","ct","l","length","Array","join","setColors","colors","Error","_finalColors","key","hex","hasOwnProperty","isArray","some","h","defHexColor","slice","_setTags","tags","Object","defineProperty","get","open","close","code","color","oriColor","parseInt","toString"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/ansi-html-community/index.js"],"sourcesContent":["'use strict'\n\nmodule.exports = ansiHTML\n\n// Reference to https://github.com/sindresorhus/ansi-regex\nvar _regANSI = /(?:(?:\\u001b\\[)|\\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\\u001b[A-M]/\n\nvar _defColors = {\n reset: ['fff', '000'], // [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', // bold\n '2': 'opacity:0.5', // dim\n '3': '<i>', // italic\n '4': '<u>', // underscore\n '8': 'display:none', // hidden\n '9': '<del>' // delete\n}\nvar _closeTags = {\n '23': '</i>', // reset italic\n '24': '</u>', // reset underscore\n '29': '</del>' // reset delete\n}\n\n;[0, 21, 22, 27, 28, 39, 49].forEach(function (n) {\n _closeTags[n] = '</span>'\n})\n\n/**\n * Converts text with ANSI color codes to HTML markup.\n * @param {String} text\n * @returns {*}\n */\nfunction ansiHTML (text) {\n // Returns the text if the string has no ANSI escape code.\n if (!_regANSI.test(text)) {\n return text\n }\n\n // Cache opened sequence.\n var ansiCodes = []\n // Replace with markup.\n var ret = text.replace(/\\033\\[(\\d+)m/g, function (match, seq) {\n var ot = _openTags[seq]\n if (ot) {\n // If current sequence has been opened, close it.\n if (!!~ansiCodes.indexOf(seq)) { // eslint-disable-line no-extra-boolean-cast\n ansiCodes.pop()\n return '</span>'\n }\n // Open tag.\n ansiCodes.push(seq)\n return ot[0] === '<' ? ot : '<span style=\"' + ot + ';\">'\n }\n\n var ct = _closeTags[seq]\n if (ct) {\n // Pop sequence\n ansiCodes.pop()\n return ct\n }\n return ''\n })\n\n // Make sure tags are closed.\n var l = ansiCodes.length\n ;(l > 0) && (ret += Array(l + 1).join('</span>'))\n\n return ret\n}\n\n/**\n * Customize colors.\n * @param {Object} colors reference to _defColors\n */\nansiHTML.setColors = function (colors) {\n if (typeof colors !== 'object') {\n throw new Error('`colors` parameter must be an Object.')\n }\n\n var _finalColors = {}\n for (var key in _defColors) {\n var hex = colors.hasOwnProperty(key) ? colors[key] : null\n if (!hex) {\n _finalColors[key] = _defColors[key]\n continue\n }\n if ('reset' === key) {\n if (typeof hex === 'string') {\n hex = [hex]\n }\n 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 }\n var defHexColor = _defColors[key]\n if (!hex[0]) {\n hex[0] = defHexColor[0]\n }\n if (hex.length === 1 || !hex[1]) {\n hex = [hex[0]]\n hex.push(defHexColor[1])\n }\n\n 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 }\n _finalColors[key] = hex\n }\n _setTags(_finalColors)\n}\n\n/**\n * Reset colors.\n */\nansiHTML.reset = function () {\n _setTags(_defColors)\n}\n\n/**\n * Expose tags, including open and close.\n * @type {Object}\n */\nansiHTML.tags = {}\n\nif (Object.defineProperty) {\n Object.defineProperty(ansiHTML.tags, 'open', {\n get: function () { return _openTags }\n })\n Object.defineProperty(ansiHTML.tags, 'close', {\n get: function () { return _closeTags }\n })\n} else {\n ansiHTML.tags.open = _openTags\n ansiHTML.tags.close = _closeTags\n}\n\nfunction _setTags (colors) {\n // reset all\n _openTags['0'] = 'font-weight:normal;opacity:1;color:#' + colors.reset[0] + ';background:#' + colors.reset[1]\n // inverse\n _openTags['7'] = 'color:#' + colors.reset[1] + ';background:#' + colors.reset[0]\n // dark grey\n _openTags['90'] = 'color:#' + colors.darkgrey\n\n for (var code in _styles) {\n var color = _styles[code]\n var oriColor = colors[color] || '000'\n _openTags[code] = 'color:#' + oriColor\n code = parseInt(code)\n _openTags[(code + 10).toString()] = 'background:#' + oriColor\n }\n}\n\nansiHTML.reset()\n"],"mappings":"AAAA,YAAY;;AAEZA,MAAM,CAACC,OAAO,GAAGC,QAAQ;;AAEzB;AACA,IAAIC,QAAQ,GAAG,sFAAsF;AAErG,IAAIC,UAAU,GAAG;EACfC,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;EAAE;EACvBC,KAAK,EAAE,KAAK;EACZC,GAAG,EAAE,QAAQ;EACbC,KAAK,EAAE,QAAQ;EACfC,MAAM,EAAE,QAAQ;EAChBC,IAAI,EAAE,QAAQ;EACdC,OAAO,EAAE,QAAQ;EACjBC,IAAI,EAAE,QAAQ;EACdC,SAAS,EAAE,QAAQ;EACnBC,QAAQ,EAAE;AACZ,CAAC;AACD,IAAIC,OAAO,GAAG;EACZ,EAAE,EAAE,OAAO;EACX,EAAE,EAAE,KAAK;EACT,EAAE,EAAE,OAAO;EACX,EAAE,EAAE,QAAQ;EACZ,EAAE,EAAE,MAAM;EACV,EAAE,EAAE,SAAS;EACb,EAAE,EAA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