UNPKG

opennms

Version:

Client API for the OpenNMS network monitoring platform

1 lines 15.8 kB
{"remainingRequest":"/data/node_modules/babel-loader/lib/index.js!/data/node_modules/colors/lib/colors.js","dependencies":[{"path":"/data/node_modules/colors/lib/colors.js","mtime":1553611387044},{"path":"/data/.babelrc","mtime":1553611371556},{"path":"/data/node_modules/cache-loader/dist/cjs.js","mtime":1553611387012},{"path":"/data/node_modules/babel-loader/lib/index.js","mtime":1553611386992}],"contextDependencies":[],"result":["'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n/*\n\nThe MIT License (MIT)\n\nOriginal Library \n - Copyright (c) Marak Squires\n\nAdditional functionality\n - Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n*/\n\nvar colors = {};\nmodule['exports'] = colors;\n\ncolors.themes = {};\n\nvar ansiStyles = colors.styles = require('./styles');\nvar defineProps = Object.defineProperties;\n\ncolors.supportsColor = require('./system/supports-colors');\n\nif (typeof colors.enabled === \"undefined\") {\n colors.enabled = colors.supportsColor;\n}\n\ncolors.stripColors = colors.strip = function (str) {\n return (\"\" + str).replace(/\\x1B\\[\\d+m/g, '');\n};\n\nvar stylize = colors.stylize = function stylize(str, style) {\n if (!colors.enabled) {\n return str + '';\n }\n\n return ansiStyles[style].open + str + ansiStyles[style].close;\n};\n\nvar matchOperatorsRe = /[|\\\\{}()[\\]^$+*?.]/g;\nvar escapeStringRegexp = function escapeStringRegexp(str) {\n if (typeof str !== 'string') {\n throw new TypeError('Expected a string');\n }\n return str.replace(matchOperatorsRe, '\\\\$&');\n};\n\nfunction build(_styles) {\n var builder = function builder() {\n return applyStyle.apply(builder, arguments);\n };\n builder._styles = _styles;\n // __proto__ is used because we must return a function, but there is\n // no way to create a function with a different prototype.\n builder.__proto__ = proto;\n return builder;\n}\n\nvar styles = function () {\n var ret = {};\n ansiStyles.grey = ansiStyles.gray;\n Object.keys(ansiStyles).forEach(function (key) {\n ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');\n ret[key] = {\n get: function get() {\n return build(this._styles.concat(key));\n }\n };\n });\n return ret;\n}();\n\nvar proto = defineProps(function colors() {}, styles);\n\nfunction applyStyle() {\n var args = arguments;\n var argsLen = args.length;\n var str = argsLen !== 0 && String(arguments[0]);\n if (argsLen > 1) {\n for (var a = 1; a < argsLen; a++) {\n str += ' ' + args[a];\n }\n }\n\n if (!colors.enabled || !str) {\n return str;\n }\n\n var nestedStyles = this._styles;\n\n var i = nestedStyles.length;\n while (i--) {\n var code = ansiStyles[nestedStyles[i]];\n str = code.open + str.replace(code.closeRe, code.open) + code.close;\n }\n\n return str;\n}\n\nfunction applyTheme(theme) {\n for (var style in theme) {\n (function (style) {\n colors[style] = function (str) {\n if (_typeof(theme[style]) === 'object') {\n var out = str;\n for (var i in theme[style]) {\n out = colors[theme[style][i]](out);\n }\n return out;\n }\n return colors[theme[style]](str);\n };\n })(style);\n }\n}\n\ncolors.setTheme = function (theme) {\n if (typeof theme === 'string') {\n try {\n colors.themes[theme] = require(theme);\n applyTheme(colors.themes[theme]);\n return colors.themes[theme];\n } catch (err) {\n console.log(err);\n return err;\n }\n } else {\n applyTheme(theme);\n }\n};\n\nfunction init() {\n var ret = {};\n Object.keys(styles).forEach(function (name) {\n ret[name] = {\n get: function get() {\n return build([name]);\n }\n };\n });\n return ret;\n}\n\nvar sequencer = function sequencer(map, str) {\n var exploded = str.split(\"\"),\n i = 0;\n exploded = exploded.map(map);\n return exploded.join(\"\");\n};\n\n// custom formatter methods\ncolors.trap = require('./custom/trap');\ncolors.zalgo = require('./custom/zalgo');\n\n// maps\ncolors.maps = {};\ncolors.maps.america = require('./maps/america');\ncolors.maps.zebra = require('./maps/zebra');\ncolors.maps.rainbow = require('./maps/rainbow');\ncolors.maps.random = require('./maps/random');\n\nfor (var map in colors.maps) {\n (function (map) {\n colors[map] = function (str) {\n return sequencer(colors.maps[map], str);\n };\n })(map);\n}\n\ndefineProps(colors, init());",{"version":3,"sources":["node_modules/colors/lib/colors.js"],"names":["colors","module","themes","ansiStyles","styles","require","defineProps","Object","defineProperties","supportsColor","enabled","stripColors","strip","str","replace","stylize","style","open","close","matchOperatorsRe","escapeStringRegexp","TypeError","build","_styles","builder","applyStyle","apply","arguments","__proto__","proto","ret","grey","gray","keys","forEach","key","closeRe","RegExp","get","concat","args","argsLen","length","String","a","nestedStyles","i","code","applyTheme","theme","out","setTheme","err","console","log","init","name","sequencer","map","exploded","split","join","trap","zalgo","maps","america","zebra","rainbow","random"],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAIA,SAAS,EAAb;AACAC,OAAO,SAAP,IAAoBD,MAApB;;AAEAA,OAAOE,MAAP,GAAgB,EAAhB;;AAEA,IAAIC,aAAaH,OAAOI,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AOA,SAAO1B,GAAP;AACD;;AAED,IAAI2B,YAAY,SAASA,SAAT,CAAoBC,GAApB,EAAyB7C,GAAzB,EAA8B;AAC5C,MAAI8C,WAAW9C,IAAI+C,KAAJ,CAAU,EAAV,CAAf;AAAA,MAA8Bd,IAAI,CAAlC;AACAa,aAAWA,SAASD,GAAT,CAAaA,GAAb,CAAX;AACA,SAAOC,SAASE,IAAT,CAAc,EAAd,CAAP;AACD,CAJD;;AAMA;AACA7D,OAAO8D,IAAP,GAAczD,QAAQ,eAAR,CAAd;AACAL,OAAO+D,KAAP,GAAe1D,QAAQ,gBAAR,CAAf;;AAEA;AACAL,OAAOgE,IAAP,GAAc,EAAd;AACAhE,OAAOgE,IAAP,CAAYC,OAAZ,GAAsB5D,QAAQ,gBAAR,CAAtB;AACAL,OAAOgE,IAAP,CAAYE,KAAZ,GAAoB7D,QAAQ,cAAR,CAApB;AACAL,OAAOgE,IAAP,CAAYG,OAAZ,GAAsB9D,QAAQ,gBAAR,CAAtB;AACAL,OAAOgE,IAAP,CAAYI,MAAZ,GAAqB/D,QAAQ,eAAR,CAArB;;AAEA,KAAK,IAAIqD,GAAT,IAAgB1D,OAAOgE,IAAvB,EAA6B;AAC3B,GAAC,UAASN,GAAT,EAAa;AACZ1D,WAAO0D,GAAP,IAAc,UAAU7C,GAAV,EAAe;AAC3B,aAAO4C,UAAUzD,OAAOgE,IAAP,CAAYN,GAAZ,CAAV,EAA4B7C,GAA5B,CAAP;AACD,KAFD;AAGD,GAJD,EAIG6C,GAJH;AAKD;;AAEDpD,YAAYN,MAAZ,EAAoBuD,MAApB","file":"colors.js","sourceRoot":"/data","sourcesContent":["/*\n\nThe MIT License (MIT)\n\nOriginal Library \n - Copyright (c) Marak Squires\n\nAdditional functionality\n - Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n*/\n\nvar colors = {};\nmodule['exports'] = colors;\n\ncolors.themes = {};\n\nvar ansiStyles = colors.styles = require('./styles');\nvar defineProps = Object.defineProperties;\n\ncolors.supportsColor = require('./system/supports-colors');\n\nif (typeof colors.enabled === \"undefined\") {\n colors.enabled = colors.supportsColor;\n}\n\ncolors.stripColors = colors.strip = function(str){\n return (\"\" + str).replace(/\\x1B\\[\\d+m/g, '');\n};\n\n\nvar stylize = colors.stylize = function stylize (str, style) {\n if (!colors.enabled) {\n return str+'';\n }\n\n return ansiStyles[style].open + str + ansiStyles[style].close;\n}\n\nvar matchOperatorsRe = /[|\\\\{}()[\\]^$+*?.]/g;\nvar escapeStringRegexp = function (str) {\n if (typeof str !== 'string') {\n throw new TypeError('Expected a string');\n }\n return str.replace(matchOperatorsRe, '\\\\$&');\n}\n\nfunction build(_styles) {\n var builder = function builder() {\n return applyStyle.apply(builder, arguments);\n };\n builder._styles = _styles;\n // __proto__ is used because we must return a function, but there is\n // no way to create a function with a different prototype.\n builder.__proto__ = proto;\n return builder;\n}\n\nvar styles = (function () {\n var ret = {};\n ansiStyles.grey = ansiStyles.gray;\n Object.keys(ansiStyles).forEach(function (key) {\n ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');\n ret[key] = {\n get: function () {\n return build(this._styles.concat(key));\n }\n };\n });\n return ret;\n})();\n\nvar proto = defineProps(function colors() {}, styles);\n\nfunction applyStyle() {\n var args = arguments;\n var argsLen = args.length;\n var str = argsLen !== 0 && String(arguments[0]);\n if (argsLen > 1) {\n for (var a = 1; a < argsLen; a++) {\n str += ' ' + args[a];\n }\n }\n\n if (!colors.enabled || !str) {\n return str;\n }\n\n var nestedStyles = this._styles;\n\n var i = nestedStyles.length;\n while (i--) {\n var code = ansiStyles[nestedStyles[i]];\n str = code.open + str.replace(code.closeRe, code.open) + code.close;\n }\n\n return str;\n}\n\nfunction applyTheme (theme) {\n for (var style in theme) {\n (function(style){\n colors[style] = function(str){\n if (typeof theme[style] === 'object'){\n var out = str;\n for (var i in theme[style]){\n out = colors[theme[style][i]](out);\n }\n return out;\n }\n return colors[theme[style]](str);\n };\n })(style)\n }\n}\n\ncolors.setTheme = function (theme) {\n if (typeof theme === 'string') {\n try {\n colors.themes[theme] = require(theme);\n applyTheme(colors.themes[theme]);\n return colors.themes[theme];\n } catch (err) {\n console.log(err);\n return err;\n }\n } else {\n applyTheme(theme);\n }\n};\n\nfunction init() {\n var ret = {};\n Object.keys(styles).forEach(function (name) {\n ret[name] = {\n get: function () {\n return build([name]);\n }\n };\n });\n return ret;\n}\n\nvar sequencer = function sequencer (map, str) {\n var exploded = str.split(\"\"), i = 0;\n exploded = exploded.map(map);\n return exploded.join(\"\");\n};\n\n// custom formatter methods\ncolors.trap = require('./custom/trap');\ncolors.zalgo = require('./custom/zalgo');\n\n// maps\ncolors.maps = {};\ncolors.maps.america = require('./maps/america');\ncolors.maps.zebra = require('./maps/zebra');\ncolors.maps.rainbow = require('./maps/rainbow');\ncolors.maps.random = require('./maps/random')\n\nfor (var map in colors.maps) {\n (function(map){\n colors[map] = function (str) {\n return sequencer(colors.maps[map], str);\n }\n })(map)\n}\n\ndefineProps(colors, init());"]}]}