@leofcoin/chain 1.0.5 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/.jsdoc.json +29 -0
  2. package/chain.js +25 -14
  3. package/dist/chain.browser.js +25 -1826
  4. package/dist/chain.browser.min.js +1 -1
  5. package/dist/chain.js +25 -14
  6. package/dist/node.browser.js +1058 -1083
  7. package/dist/node.browser.min.js +1 -1
  8. package/docs/@leofcoin/chain/1.0.7/chain.js.html +738 -0
  9. package/docs/@leofcoin/chain/1.0.7/contracts_factory.js.html +182 -0
  10. package/docs/@leofcoin/chain/1.0.7/contracts_nameService.js.html +231 -0
  11. package/docs/@leofcoin/chain/1.0.7/contracts_proxies_factoryProxy.js.html +135 -0
  12. package/docs/@leofcoin/chain/1.0.7/contracts_proxies_nameServiceProxy.js.html +135 -0
  13. package/docs/@leofcoin/chain/1.0.7/contracts_proxies_nativeTokenProxy.js.html +135 -0
  14. package/docs/@leofcoin/chain/1.0.7/contracts_proxies_validatorsProxy.js.html +135 -0
  15. package/docs/@leofcoin/chain/1.0.7/contracts_proxies_votingProxy.js.html +135 -0
  16. package/docs/@leofcoin/chain/1.0.7/contracts_validators.js.html +242 -0
  17. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Bold-webfont.eot +0 -0
  18. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Bold-webfont.svg +1830 -0
  19. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Bold-webfont.woff +0 -0
  20. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  21. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
  22. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  23. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Italic-webfont.eot +0 -0
  24. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Italic-webfont.svg +1830 -0
  25. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Italic-webfont.woff +0 -0
  26. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Light-webfont.eot +0 -0
  27. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Light-webfont.svg +1831 -0
  28. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Light-webfont.woff +0 -0
  29. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  30. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
  31. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  32. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Regular-webfont.eot +0 -0
  33. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Regular-webfont.svg +1831 -0
  34. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Regular-webfont.woff +0 -0
  35. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Semibold-webfont.eot +0 -0
  36. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Semibold-webfont.svg +1830 -0
  37. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Semibold-webfont.ttf +0 -0
  38. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-Semibold-webfont.woff +0 -0
  39. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
  40. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-SemiboldItalic-webfont.svg +1830 -0
  41. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  42. package/docs/@leofcoin/chain/1.0.7/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  43. package/docs/@leofcoin/chain/1.0.7/global.html +1153 -0
  44. package/docs/@leofcoin/chain/1.0.7/icons/home.svg +4 -0
  45. package/docs/@leofcoin/chain/1.0.7/icons/search.svg +4 -0
  46. package/docs/@leofcoin/chain/1.0.7/index.html +125 -0
  47. package/docs/@leofcoin/chain/1.0.7/machine.js.html +252 -0
  48. package/docs/@leofcoin/chain/1.0.7/scripts/linenumber.js +23 -0
  49. package/docs/@leofcoin/chain/1.0.7/scripts/pagelocation.js +89 -0
  50. package/docs/@leofcoin/chain/1.0.7/standards_roles.js.html +188 -0
  51. package/docs/@leofcoin/chain/1.0.7/standards_token.js.html +260 -0
  52. package/docs/@leofcoin/chain/1.0.7/styles/collapse.css +27 -0
  53. package/docs/@leofcoin/chain/1.0.7/styles/jsdoc-default.css +953 -0
  54. package/docs/@leofcoin/chain/1.0.7/styles/prettify-jsdoc.css +111 -0
  55. package/docs/@leofcoin/chain/1.0.7/styles/prettify-tomorrow.css +138 -0
  56. package/out/@leofcoin/chain/1.0.7/chain.js.html +645 -0
  57. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Bold-webfont.eot +0 -0
  58. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Bold-webfont.svg +1830 -0
  59. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Bold-webfont.woff +0 -0
  60. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  61. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
  62. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  63. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Italic-webfont.eot +0 -0
  64. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Italic-webfont.svg +1830 -0
  65. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Italic-webfont.woff +0 -0
  66. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Light-webfont.eot +0 -0
  67. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Light-webfont.svg +1831 -0
  68. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Light-webfont.woff +0 -0
  69. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  70. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
  71. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  72. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Regular-webfont.eot +0 -0
  73. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Regular-webfont.svg +1831 -0
  74. package/out/@leofcoin/chain/1.0.7/fonts/OpenSans-Regular-webfont.woff +0 -0
  75. package/out/@leofcoin/chain/1.0.7/global.html +477 -0
  76. package/out/@leofcoin/chain/1.0.7/index.html +69 -0
  77. package/out/@leofcoin/chain/1.0.7/machine.js.html +180 -0
  78. package/out/@leofcoin/chain/1.0.7/scripts/linenumber.js +25 -0
  79. package/out/@leofcoin/chain/1.0.7/scripts/prettify/Apache-License-2.0.txt +202 -0
  80. package/out/@leofcoin/chain/1.0.7/scripts/prettify/lang-css.js +2 -0
  81. package/out/@leofcoin/chain/1.0.7/scripts/prettify/prettify.js +28 -0
  82. package/out/@leofcoin/chain/1.0.7/styles/jsdoc-default.css +358 -0
  83. package/out/@leofcoin/chain/1.0.7/styles/prettify-jsdoc.css +111 -0
  84. package/out/@leofcoin/chain/1.0.7/styles/prettify-tomorrow.css +132 -0
  85. package/package.json +6 -3
  86. package/src/chain.js +24 -3
  87. package/src/machine.js +2 -3
  88. package/src/utils/utils.js +0 -9
@@ -1,176 +1,5 @@
1
1
  /******/ var __webpack_modules__ = ({
2
2
 
3
- /***/ 6434:
4
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
5
-
6
- /* module decorator */ module = __webpack_require__.nmd(module);
7
-
8
-
9
- const wrapAnsi16 = (fn, offset) => (...args) => {
10
- const code = fn(...args);
11
- return `\u001B[${code + offset}m`;
12
- };
13
-
14
- const wrapAnsi256 = (fn, offset) => (...args) => {
15
- const code = fn(...args);
16
- return `\u001B[${38 + offset};5;${code}m`;
17
- };
18
-
19
- const wrapAnsi16m = (fn, offset) => (...args) => {
20
- const rgb = fn(...args);
21
- return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
22
- };
23
-
24
- const ansi2ansi = n => n;
25
- const rgb2rgb = (r, g, b) => [r, g, b];
26
-
27
- const setLazyProperty = (object, property, get) => {
28
- Object.defineProperty(object, property, {
29
- get: () => {
30
- const value = get();
31
-
32
- Object.defineProperty(object, property, {
33
- value,
34
- enumerable: true,
35
- configurable: true
36
- });
37
-
38
- return value;
39
- },
40
- enumerable: true,
41
- configurable: true
42
- });
43
- };
44
-
45
- /** @type {typeof import('color-convert')} */
46
- let colorConvert;
47
- const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
48
- if (colorConvert === undefined) {
49
- colorConvert = __webpack_require__(2085);
50
- }
51
-
52
- const offset = isBackground ? 10 : 0;
53
- const styles = {};
54
-
55
- for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
56
- const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
57
- if (sourceSpace === targetSpace) {
58
- styles[name] = wrap(identity, offset);
59
- } else if (typeof suite === 'object') {
60
- styles[name] = wrap(suite[targetSpace], offset);
61
- }
62
- }
63
-
64
- return styles;
65
- };
66
-
67
- function assembleStyles() {
68
- const codes = new Map();
69
- const styles = {
70
- modifier: {
71
- reset: [0, 0],
72
- // 21 isn't widely supported and 22 does the same thing
73
- bold: [1, 22],
74
- dim: [2, 22],
75
- italic: [3, 23],
76
- underline: [4, 24],
77
- inverse: [7, 27],
78
- hidden: [8, 28],
79
- strikethrough: [9, 29]
80
- },
81
- color: {
82
- black: [30, 39],
83
- red: [31, 39],
84
- green: [32, 39],
85
- yellow: [33, 39],
86
- blue: [34, 39],
87
- magenta: [35, 39],
88
- cyan: [36, 39],
89
- white: [37, 39],
90
-
91
- // Bright color
92
- blackBright: [90, 39],
93
- redBright: [91, 39],
94
- greenBright: [92, 39],
95
- yellowBright: [93, 39],
96
- blueBright: [94, 39],
97
- magentaBright: [95, 39],
98
- cyanBright: [96, 39],
99
- whiteBright: [97, 39]
100
- },
101
- bgColor: {
102
- bgBlack: [40, 49],
103
- bgRed: [41, 49],
104
- bgGreen: [42, 49],
105
- bgYellow: [43, 49],
106
- bgBlue: [44, 49],
107
- bgMagenta: [45, 49],
108
- bgCyan: [46, 49],
109
- bgWhite: [47, 49],
110
-
111
- // Bright color
112
- bgBlackBright: [100, 49],
113
- bgRedBright: [101, 49],
114
- bgGreenBright: [102, 49],
115
- bgYellowBright: [103, 49],
116
- bgBlueBright: [104, 49],
117
- bgMagentaBright: [105, 49],
118
- bgCyanBright: [106, 49],
119
- bgWhiteBright: [107, 49]
120
- }
121
- };
122
-
123
- // Alias bright black as gray (and grey)
124
- styles.color.gray = styles.color.blackBright;
125
- styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
126
- styles.color.grey = styles.color.blackBright;
127
- styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
128
-
129
- for (const [groupName, group] of Object.entries(styles)) {
130
- for (const [styleName, style] of Object.entries(group)) {
131
- styles[styleName] = {
132
- open: `\u001B[${style[0]}m`,
133
- close: `\u001B[${style[1]}m`
134
- };
135
-
136
- group[styleName] = styles[styleName];
137
-
138
- codes.set(style[0], style[1]);
139
- }
140
-
141
- Object.defineProperty(styles, groupName, {
142
- value: group,
143
- enumerable: false
144
- });
145
- }
146
-
147
- Object.defineProperty(styles, 'codes', {
148
- value: codes,
149
- enumerable: false
150
- });
151
-
152
- styles.color.close = '\u001B[39m';
153
- styles.bgColor.close = '\u001B[49m';
154
-
155
- setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
156
- setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
157
- setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
158
- setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
159
- setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
160
- setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
161
-
162
- return styles;
163
- }
164
-
165
- // Make the export immutable
166
- Object.defineProperty(module, 'exports', {
167
- enumerable: true,
168
- get: assembleStyles
169
- });
170
-
171
-
172
- /***/ }),
173
-
174
3
  /***/ 9742:
175
4
  /***/ (function(__unused_webpack_module, exports) {
176
5
 
@@ -5893,1626 +5722,6 @@ function BufferBigIntNotDefined () {
5893
5722
  }
5894
5723
 
5895
5724
 
5896
- /***/ }),
5897
-
5898
- /***/ 4061:
5899
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
5900
-
5901
-
5902
- const ansiStyles = __webpack_require__(6434);
5903
- const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(8555);
5904
- const {
5905
- stringReplaceAll,
5906
- stringEncaseCRLFWithFirstIndex
5907
- } = __webpack_require__(3559);
5908
-
5909
- const {isArray} = Array;
5910
-
5911
- // `supportsColor.level` → `ansiStyles.color[name]` mapping
5912
- const levelMapping = [
5913
- 'ansi',
5914
- 'ansi',
5915
- 'ansi256',
5916
- 'ansi16m'
5917
- ];
5918
-
5919
- const styles = Object.create(null);
5920
-
5921
- const applyOptions = (object, options = {}) => {
5922
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
5923
- throw new Error('The `level` option should be an integer from 0 to 3');
5924
- }
5925
-
5926
- // Detect level if not set manually
5927
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
5928
- object.level = options.level === undefined ? colorLevel : options.level;
5929
- };
5930
-
5931
- class ChalkClass {
5932
- constructor(options) {
5933
- // eslint-disable-next-line no-constructor-return
5934
- return chalkFactory(options);
5935
- }
5936
- }
5937
-
5938
- const chalkFactory = options => {
5939
- const chalk = {};
5940
- applyOptions(chalk, options);
5941
-
5942
- chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
5943
-
5944
- Object.setPrototypeOf(chalk, Chalk.prototype);
5945
- Object.setPrototypeOf(chalk.template, chalk);
5946
-
5947
- chalk.template.constructor = () => {
5948
- throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
5949
- };
5950
-
5951
- chalk.template.Instance = ChalkClass;
5952
-
5953
- return chalk.template;
5954
- };
5955
-
5956
- function Chalk(options) {
5957
- return chalkFactory(options);
5958
- }
5959
-
5960
- for (const [styleName, style] of Object.entries(ansiStyles)) {
5961
- styles[styleName] = {
5962
- get() {
5963
- const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
5964
- Object.defineProperty(this, styleName, {value: builder});
5965
- return builder;
5966
- }
5967
- };
5968
- }
5969
-
5970
- styles.visible = {
5971
- get() {
5972
- const builder = createBuilder(this, this._styler, true);
5973
- Object.defineProperty(this, 'visible', {value: builder});
5974
- return builder;
5975
- }
5976
- };
5977
-
5978
- const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
5979
-
5980
- for (const model of usedModels) {
5981
- styles[model] = {
5982
- get() {
5983
- const {level} = this;
5984
- return function (...arguments_) {
5985
- const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
5986
- return createBuilder(this, styler, this._isEmpty);
5987
- };
5988
- }
5989
- };
5990
- }
5991
-
5992
- for (const model of usedModels) {
5993
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
5994
- styles[bgModel] = {
5995
- get() {
5996
- const {level} = this;
5997
- return function (...arguments_) {
5998
- const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
5999
- return createBuilder(this, styler, this._isEmpty);
6000
- };
6001
- }
6002
- };
6003
- }
6004
-
6005
- const proto = Object.defineProperties(() => {}, {
6006
- ...styles,
6007
- level: {
6008
- enumerable: true,
6009
- get() {
6010
- return this._generator.level;
6011
- },
6012
- set(level) {
6013
- this._generator.level = level;
6014
- }
6015
- }
6016
- });
6017
-
6018
- const createStyler = (open, close, parent) => {
6019
- let openAll;
6020
- let closeAll;
6021
- if (parent === undefined) {
6022
- openAll = open;
6023
- closeAll = close;
6024
- } else {
6025
- openAll = parent.openAll + open;
6026
- closeAll = close + parent.closeAll;
6027
- }
6028
-
6029
- return {
6030
- open,
6031
- close,
6032
- openAll,
6033
- closeAll,
6034
- parent
6035
- };
6036
- };
6037
-
6038
- const createBuilder = (self, _styler, _isEmpty) => {
6039
- const builder = (...arguments_) => {
6040
- if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
6041
- // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
6042
- return applyStyle(builder, chalkTag(builder, ...arguments_));
6043
- }
6044
-
6045
- // Single argument is hot path, implicit coercion is faster than anything
6046
- // eslint-disable-next-line no-implicit-coercion
6047
- return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
6048
- };
6049
-
6050
- // We alter the prototype because we must return a function, but there is
6051
- // no way to create a function with a different prototype
6052
- Object.setPrototypeOf(builder, proto);
6053
-
6054
- builder._generator = self;
6055
- builder._styler = _styler;
6056
- builder._isEmpty = _isEmpty;
6057
-
6058
- return builder;
6059
- };
6060
-
6061
- const applyStyle = (self, string) => {
6062
- if (self.level <= 0 || !string) {
6063
- return self._isEmpty ? '' : string;
6064
- }
6065
-
6066
- let styler = self._styler;
6067
-
6068
- if (styler === undefined) {
6069
- return string;
6070
- }
6071
-
6072
- const {openAll, closeAll} = styler;
6073
- if (string.indexOf('\u001B') !== -1) {
6074
- while (styler !== undefined) {
6075
- // Replace any instances already present with a re-opening code
6076
- // otherwise only the part of the string until said closing code
6077
- // will be colored, and the rest will simply be 'plain'.
6078
- string = stringReplaceAll(string, styler.close, styler.open);
6079
-
6080
- styler = styler.parent;
6081
- }
6082
- }
6083
-
6084
- // We can move both next actions out of loop, because remaining actions in loop won't have
6085
- // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
6086
- // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
6087
- const lfIndex = string.indexOf('\n');
6088
- if (lfIndex !== -1) {
6089
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
6090
- }
6091
-
6092
- return openAll + string + closeAll;
6093
- };
6094
-
6095
- let template;
6096
- const chalkTag = (chalk, ...strings) => {
6097
- const [firstString] = strings;
6098
-
6099
- if (!isArray(firstString) || !isArray(firstString.raw)) {
6100
- // If chalk() was called by itself or with a string,
6101
- // return the string itself as a string.
6102
- return strings.join(' ');
6103
- }
6104
-
6105
- const arguments_ = strings.slice(1);
6106
- const parts = [firstString.raw[0]];
6107
-
6108
- for (let i = 1; i < firstString.length; i++) {
6109
- parts.push(
6110
- String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
6111
- String(firstString.raw[i])
6112
- );
6113
- }
6114
-
6115
- if (template === undefined) {
6116
- template = __webpack_require__(9515);
6117
- }
6118
-
6119
- return template(chalk, parts.join(''));
6120
- };
6121
-
6122
- Object.defineProperties(Chalk.prototype, styles);
6123
-
6124
- const chalk = Chalk(); // eslint-disable-line new-cap
6125
- chalk.supportsColor = stdoutColor;
6126
- chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
6127
- chalk.stderr.supportsColor = stderrColor;
6128
-
6129
- module.exports = chalk;
6130
-
6131
-
6132
- /***/ }),
6133
-
6134
- /***/ 9515:
6135
- /***/ (function(module) {
6136
-
6137
-
6138
- const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
6139
- const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
6140
- const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
6141
- const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
6142
-
6143
- const ESCAPES = new Map([
6144
- ['n', '\n'],
6145
- ['r', '\r'],
6146
- ['t', '\t'],
6147
- ['b', '\b'],
6148
- ['f', '\f'],
6149
- ['v', '\v'],
6150
- ['0', '\0'],
6151
- ['\\', '\\'],
6152
- ['e', '\u001B'],
6153
- ['a', '\u0007']
6154
- ]);
6155
-
6156
- function unescape(c) {
6157
- const u = c[0] === 'u';
6158
- const bracket = c[1] === '{';
6159
-
6160
- if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
6161
- return String.fromCharCode(parseInt(c.slice(1), 16));
6162
- }
6163
-
6164
- if (u && bracket) {
6165
- return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
6166
- }
6167
-
6168
- return ESCAPES.get(c) || c;
6169
- }
6170
-
6171
- function parseArguments(name, arguments_) {
6172
- const results = [];
6173
- const chunks = arguments_.trim().split(/\s*,\s*/g);
6174
- let matches;
6175
-
6176
- for (const chunk of chunks) {
6177
- const number = Number(chunk);
6178
- if (!Number.isNaN(number)) {
6179
- results.push(number);
6180
- } else if ((matches = chunk.match(STRING_REGEX))) {
6181
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
6182
- } else {
6183
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
6184
- }
6185
- }
6186
-
6187
- return results;
6188
- }
6189
-
6190
- function parseStyle(style) {
6191
- STYLE_REGEX.lastIndex = 0;
6192
-
6193
- const results = [];
6194
- let matches;
6195
-
6196
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
6197
- const name = matches[1];
6198
-
6199
- if (matches[2]) {
6200
- const args = parseArguments(name, matches[2]);
6201
- results.push([name].concat(args));
6202
- } else {
6203
- results.push([name]);
6204
- }
6205
- }
6206
-
6207
- return results;
6208
- }
6209
-
6210
- function buildStyle(chalk, styles) {
6211
- const enabled = {};
6212
-
6213
- for (const layer of styles) {
6214
- for (const style of layer.styles) {
6215
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
6216
- }
6217
- }
6218
-
6219
- let current = chalk;
6220
- for (const [styleName, styles] of Object.entries(enabled)) {
6221
- if (!Array.isArray(styles)) {
6222
- continue;
6223
- }
6224
-
6225
- if (!(styleName in current)) {
6226
- throw new Error(`Unknown Chalk style: ${styleName}`);
6227
- }
6228
-
6229
- current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
6230
- }
6231
-
6232
- return current;
6233
- }
6234
-
6235
- module.exports = (chalk, temporary) => {
6236
- const styles = [];
6237
- const chunks = [];
6238
- let chunk = [];
6239
-
6240
- // eslint-disable-next-line max-params
6241
- temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
6242
- if (escapeCharacter) {
6243
- chunk.push(unescape(escapeCharacter));
6244
- } else if (style) {
6245
- const string = chunk.join('');
6246
- chunk = [];
6247
- chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
6248
- styles.push({inverse, styles: parseStyle(style)});
6249
- } else if (close) {
6250
- if (styles.length === 0) {
6251
- throw new Error('Found extraneous } in Chalk template literal');
6252
- }
6253
-
6254
- chunks.push(buildStyle(chalk, styles)(chunk.join('')));
6255
- chunk = [];
6256
- styles.pop();
6257
- } else {
6258
- chunk.push(character);
6259
- }
6260
- });
6261
-
6262
- chunks.push(chunk.join(''));
6263
-
6264
- if (styles.length > 0) {
6265
- const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
6266
- throw new Error(errMessage);
6267
- }
6268
-
6269
- return chunks.join('');
6270
- };
6271
-
6272
-
6273
- /***/ }),
6274
-
6275
- /***/ 3559:
6276
- /***/ (function(module) {
6277
-
6278
-
6279
-
6280
- const stringReplaceAll = (string, substring, replacer) => {
6281
- let index = string.indexOf(substring);
6282
- if (index === -1) {
6283
- return string;
6284
- }
6285
-
6286
- const substringLength = substring.length;
6287
- let endIndex = 0;
6288
- let returnValue = '';
6289
- do {
6290
- returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
6291
- endIndex = index + substringLength;
6292
- index = string.indexOf(substring, endIndex);
6293
- } while (index !== -1);
6294
-
6295
- returnValue += string.substr(endIndex);
6296
- return returnValue;
6297
- };
6298
-
6299
- const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
6300
- let endIndex = 0;
6301
- let returnValue = '';
6302
- do {
6303
- const gotCR = string[index - 1] === '\r';
6304
- returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
6305
- endIndex = index + 1;
6306
- index = string.indexOf('\n', endIndex);
6307
- } while (index !== -1);
6308
-
6309
- returnValue += string.substr(endIndex);
6310
- return returnValue;
6311
- };
6312
-
6313
- module.exports = {
6314
- stringReplaceAll,
6315
- stringEncaseCRLFWithFirstIndex
6316
- };
6317
-
6318
-
6319
- /***/ }),
6320
-
6321
- /***/ 8168:
6322
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
6323
-
6324
- /* MIT license */
6325
- /* eslint-disable no-mixed-operators */
6326
- const cssKeywords = __webpack_require__(8874);
6327
-
6328
- // NOTE: conversions should only return primitive values (i.e. arrays, or
6329
- // values that give correct `typeof` results).
6330
- // do not use box values types (i.e. Number(), String(), etc.)
6331
-
6332
- const reverseKeywords = {};
6333
- for (const key of Object.keys(cssKeywords)) {
6334
- reverseKeywords[cssKeywords[key]] = key;
6335
- }
6336
-
6337
- const convert = {
6338
- rgb: {channels: 3, labels: 'rgb'},
6339
- hsl: {channels: 3, labels: 'hsl'},
6340
- hsv: {channels: 3, labels: 'hsv'},
6341
- hwb: {channels: 3, labels: 'hwb'},
6342
- cmyk: {channels: 4, labels: 'cmyk'},
6343
- xyz: {channels: 3, labels: 'xyz'},
6344
- lab: {channels: 3, labels: 'lab'},
6345
- lch: {channels: 3, labels: 'lch'},
6346
- hex: {channels: 1, labels: ['hex']},
6347
- keyword: {channels: 1, labels: ['keyword']},
6348
- ansi16: {channels: 1, labels: ['ansi16']},
6349
- ansi256: {channels: 1, labels: ['ansi256']},
6350
- hcg: {channels: 3, labels: ['h', 'c', 'g']},
6351
- apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
6352
- gray: {channels: 1, labels: ['gray']}
6353
- };
6354
-
6355
- module.exports = convert;
6356
-
6357
- // Hide .channels and .labels properties
6358
- for (const model of Object.keys(convert)) {
6359
- if (!('channels' in convert[model])) {
6360
- throw new Error('missing channels property: ' + model);
6361
- }
6362
-
6363
- if (!('labels' in convert[model])) {
6364
- throw new Error('missing channel labels property: ' + model);
6365
- }
6366
-
6367
- if (convert[model].labels.length !== convert[model].channels) {
6368
- throw new Error('channel and label counts mismatch: ' + model);
6369
- }
6370
-
6371
- const {channels, labels} = convert[model];
6372
- delete convert[model].channels;
6373
- delete convert[model].labels;
6374
- Object.defineProperty(convert[model], 'channels', {value: channels});
6375
- Object.defineProperty(convert[model], 'labels', {value: labels});
6376
- }
6377
-
6378
- convert.rgb.hsl = function (rgb) {
6379
- const r = rgb[0] / 255;
6380
- const g = rgb[1] / 255;
6381
- const b = rgb[2] / 255;
6382
- const min = Math.min(r, g, b);
6383
- const max = Math.max(r, g, b);
6384
- const delta = max - min;
6385
- let h;
6386
- let s;
6387
-
6388
- if (max === min) {
6389
- h = 0;
6390
- } else if (r === max) {
6391
- h = (g - b) / delta;
6392
- } else if (g === max) {
6393
- h = 2 + (b - r) / delta;
6394
- } else if (b === max) {
6395
- h = 4 + (r - g) / delta;
6396
- }
6397
-
6398
- h = Math.min(h * 60, 360);
6399
-
6400
- if (h < 0) {
6401
- h += 360;
6402
- }
6403
-
6404
- const l = (min + max) / 2;
6405
-
6406
- if (max === min) {
6407
- s = 0;
6408
- } else if (l <= 0.5) {
6409
- s = delta / (max + min);
6410
- } else {
6411
- s = delta / (2 - max - min);
6412
- }
6413
-
6414
- return [h, s * 100, l * 100];
6415
- };
6416
-
6417
- convert.rgb.hsv = function (rgb) {
6418
- let rdif;
6419
- let gdif;
6420
- let bdif;
6421
- let h;
6422
- let s;
6423
-
6424
- const r = rgb[0] / 255;
6425
- const g = rgb[1] / 255;
6426
- const b = rgb[2] / 255;
6427
- const v = Math.max(r, g, b);
6428
- const diff = v - Math.min(r, g, b);
6429
- const diffc = function (c) {
6430
- return (v - c) / 6 / diff + 1 / 2;
6431
- };
6432
-
6433
- if (diff === 0) {
6434
- h = 0;
6435
- s = 0;
6436
- } else {
6437
- s = diff / v;
6438
- rdif = diffc(r);
6439
- gdif = diffc(g);
6440
- bdif = diffc(b);
6441
-
6442
- if (r === v) {
6443
- h = bdif - gdif;
6444
- } else if (g === v) {
6445
- h = (1 / 3) + rdif - bdif;
6446
- } else if (b === v) {
6447
- h = (2 / 3) + gdif - rdif;
6448
- }
6449
-
6450
- if (h < 0) {
6451
- h += 1;
6452
- } else if (h > 1) {
6453
- h -= 1;
6454
- }
6455
- }
6456
-
6457
- return [
6458
- h * 360,
6459
- s * 100,
6460
- v * 100
6461
- ];
6462
- };
6463
-
6464
- convert.rgb.hwb = function (rgb) {
6465
- const r = rgb[0];
6466
- const g = rgb[1];
6467
- let b = rgb[2];
6468
- const h = convert.rgb.hsl(rgb)[0];
6469
- const w = 1 / 255 * Math.min(r, Math.min(g, b));
6470
-
6471
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
6472
-
6473
- return [h, w * 100, b * 100];
6474
- };
6475
-
6476
- convert.rgb.cmyk = function (rgb) {
6477
- const r = rgb[0] / 255;
6478
- const g = rgb[1] / 255;
6479
- const b = rgb[2] / 255;
6480
-
6481
- const k = Math.min(1 - r, 1 - g, 1 - b);
6482
- const c = (1 - r - k) / (1 - k) || 0;
6483
- const m = (1 - g - k) / (1 - k) || 0;
6484
- const y = (1 - b - k) / (1 - k) || 0;
6485
-
6486
- return [c * 100, m * 100, y * 100, k * 100];
6487
- };
6488
-
6489
- function comparativeDistance(x, y) {
6490
- /*
6491
- See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
6492
- */
6493
- return (
6494
- ((x[0] - y[0]) ** 2) +
6495
- ((x[1] - y[1]) ** 2) +
6496
- ((x[2] - y[2]) ** 2)
6497
- );
6498
- }
6499
-
6500
- convert.rgb.keyword = function (rgb) {
6501
- const reversed = reverseKeywords[rgb];
6502
- if (reversed) {
6503
- return reversed;
6504
- }
6505
-
6506
- let currentClosestDistance = Infinity;
6507
- let currentClosestKeyword;
6508
-
6509
- for (const keyword of Object.keys(cssKeywords)) {
6510
- const value = cssKeywords[keyword];
6511
-
6512
- // Compute comparative distance
6513
- const distance = comparativeDistance(rgb, value);
6514
-
6515
- // Check if its less, if so set as closest
6516
- if (distance < currentClosestDistance) {
6517
- currentClosestDistance = distance;
6518
- currentClosestKeyword = keyword;
6519
- }
6520
- }
6521
-
6522
- return currentClosestKeyword;
6523
- };
6524
-
6525
- convert.keyword.rgb = function (keyword) {
6526
- return cssKeywords[keyword];
6527
- };
6528
-
6529
- convert.rgb.xyz = function (rgb) {
6530
- let r = rgb[0] / 255;
6531
- let g = rgb[1] / 255;
6532
- let b = rgb[2] / 255;
6533
-
6534
- // Assume sRGB
6535
- r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
6536
- g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
6537
- b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
6538
-
6539
- const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
6540
- const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
6541
- const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
6542
-
6543
- return [x * 100, y * 100, z * 100];
6544
- };
6545
-
6546
- convert.rgb.lab = function (rgb) {
6547
- const xyz = convert.rgb.xyz(rgb);
6548
- let x = xyz[0];
6549
- let y = xyz[1];
6550
- let z = xyz[2];
6551
-
6552
- x /= 95.047;
6553
- y /= 100;
6554
- z /= 108.883;
6555
-
6556
- x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
6557
- y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
6558
- z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
6559
-
6560
- const l = (116 * y) - 16;
6561
- const a = 500 * (x - y);
6562
- const b = 200 * (y - z);
6563
-
6564
- return [l, a, b];
6565
- };
6566
-
6567
- convert.hsl.rgb = function (hsl) {
6568
- const h = hsl[0] / 360;
6569
- const s = hsl[1] / 100;
6570
- const l = hsl[2] / 100;
6571
- let t2;
6572
- let t3;
6573
- let val;
6574
-
6575
- if (s === 0) {
6576
- val = l * 255;
6577
- return [val, val, val];
6578
- }
6579
-
6580
- if (l < 0.5) {
6581
- t2 = l * (1 + s);
6582
- } else {
6583
- t2 = l + s - l * s;
6584
- }
6585
-
6586
- const t1 = 2 * l - t2;
6587
-
6588
- const rgb = [0, 0, 0];
6589
- for (let i = 0; i < 3; i++) {
6590
- t3 = h + 1 / 3 * -(i - 1);
6591
- if (t3 < 0) {
6592
- t3++;
6593
- }
6594
-
6595
- if (t3 > 1) {
6596
- t3--;
6597
- }
6598
-
6599
- if (6 * t3 < 1) {
6600
- val = t1 + (t2 - t1) * 6 * t3;
6601
- } else if (2 * t3 < 1) {
6602
- val = t2;
6603
- } else if (3 * t3 < 2) {
6604
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
6605
- } else {
6606
- val = t1;
6607
- }
6608
-
6609
- rgb[i] = val * 255;
6610
- }
6611
-
6612
- return rgb;
6613
- };
6614
-
6615
- convert.hsl.hsv = function (hsl) {
6616
- const h = hsl[0];
6617
- let s = hsl[1] / 100;
6618
- let l = hsl[2] / 100;
6619
- let smin = s;
6620
- const lmin = Math.max(l, 0.01);
6621
-
6622
- l *= 2;
6623
- s *= (l <= 1) ? l : 2 - l;
6624
- smin *= lmin <= 1 ? lmin : 2 - lmin;
6625
- const v = (l + s) / 2;
6626
- const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
6627
-
6628
- return [h, sv * 100, v * 100];
6629
- };
6630
-
6631
- convert.hsv.rgb = function (hsv) {
6632
- const h = hsv[0] / 60;
6633
- const s = hsv[1] / 100;
6634
- let v = hsv[2] / 100;
6635
- const hi = Math.floor(h) % 6;
6636
-
6637
- const f = h - Math.floor(h);
6638
- const p = 255 * v * (1 - s);
6639
- const q = 255 * v * (1 - (s * f));
6640
- const t = 255 * v * (1 - (s * (1 - f)));
6641
- v *= 255;
6642
-
6643
- switch (hi) {
6644
- case 0:
6645
- return [v, t, p];
6646
- case 1:
6647
- return [q, v, p];
6648
- case 2:
6649
- return [p, v, t];
6650
- case 3:
6651
- return [p, q, v];
6652
- case 4:
6653
- return [t, p, v];
6654
- case 5:
6655
- return [v, p, q];
6656
- }
6657
- };
6658
-
6659
- convert.hsv.hsl = function (hsv) {
6660
- const h = hsv[0];
6661
- const s = hsv[1] / 100;
6662
- const v = hsv[2] / 100;
6663
- const vmin = Math.max(v, 0.01);
6664
- let sl;
6665
- let l;
6666
-
6667
- l = (2 - s) * v;
6668
- const lmin = (2 - s) * vmin;
6669
- sl = s * vmin;
6670
- sl /= (lmin <= 1) ? lmin : 2 - lmin;
6671
- sl = sl || 0;
6672
- l /= 2;
6673
-
6674
- return [h, sl * 100, l * 100];
6675
- };
6676
-
6677
- // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
6678
- convert.hwb.rgb = function (hwb) {
6679
- const h = hwb[0] / 360;
6680
- let wh = hwb[1] / 100;
6681
- let bl = hwb[2] / 100;
6682
- const ratio = wh + bl;
6683
- let f;
6684
-
6685
- // Wh + bl cant be > 1
6686
- if (ratio > 1) {
6687
- wh /= ratio;
6688
- bl /= ratio;
6689
- }
6690
-
6691
- const i = Math.floor(6 * h);
6692
- const v = 1 - bl;
6693
- f = 6 * h - i;
6694
-
6695
- if ((i & 0x01) !== 0) {
6696
- f = 1 - f;
6697
- }
6698
-
6699
- const n = wh + f * (v - wh); // Linear interpolation
6700
-
6701
- let r;
6702
- let g;
6703
- let b;
6704
- /* eslint-disable max-statements-per-line,no-multi-spaces */
6705
- switch (i) {
6706
- default:
6707
- case 6:
6708
- case 0: r = v; g = n; b = wh; break;
6709
- case 1: r = n; g = v; b = wh; break;
6710
- case 2: r = wh; g = v; b = n; break;
6711
- case 3: r = wh; g = n; b = v; break;
6712
- case 4: r = n; g = wh; b = v; break;
6713
- case 5: r = v; g = wh; b = n; break;
6714
- }
6715
- /* eslint-enable max-statements-per-line,no-multi-spaces */
6716
-
6717
- return [r * 255, g * 255, b * 255];
6718
- };
6719
-
6720
- convert.cmyk.rgb = function (cmyk) {
6721
- const c = cmyk[0] / 100;
6722
- const m = cmyk[1] / 100;
6723
- const y = cmyk[2] / 100;
6724
- const k = cmyk[3] / 100;
6725
-
6726
- const r = 1 - Math.min(1, c * (1 - k) + k);
6727
- const g = 1 - Math.min(1, m * (1 - k) + k);
6728
- const b = 1 - Math.min(1, y * (1 - k) + k);
6729
-
6730
- return [r * 255, g * 255, b * 255];
6731
- };
6732
-
6733
- convert.xyz.rgb = function (xyz) {
6734
- const x = xyz[0] / 100;
6735
- const y = xyz[1] / 100;
6736
- const z = xyz[2] / 100;
6737
- let r;
6738
- let g;
6739
- let b;
6740
-
6741
- r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
6742
- g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
6743
- b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
6744
-
6745
- // Assume sRGB
6746
- r = r > 0.0031308
6747
- ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
6748
- : r * 12.92;
6749
-
6750
- g = g > 0.0031308
6751
- ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
6752
- : g * 12.92;
6753
-
6754
- b = b > 0.0031308
6755
- ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
6756
- : b * 12.92;
6757
-
6758
- r = Math.min(Math.max(0, r), 1);
6759
- g = Math.min(Math.max(0, g), 1);
6760
- b = Math.min(Math.max(0, b), 1);
6761
-
6762
- return [r * 255, g * 255, b * 255];
6763
- };
6764
-
6765
- convert.xyz.lab = function (xyz) {
6766
- let x = xyz[0];
6767
- let y = xyz[1];
6768
- let z = xyz[2];
6769
-
6770
- x /= 95.047;
6771
- y /= 100;
6772
- z /= 108.883;
6773
-
6774
- x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
6775
- y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
6776
- z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
6777
-
6778
- const l = (116 * y) - 16;
6779
- const a = 500 * (x - y);
6780
- const b = 200 * (y - z);
6781
-
6782
- return [l, a, b];
6783
- };
6784
-
6785
- convert.lab.xyz = function (lab) {
6786
- const l = lab[0];
6787
- const a = lab[1];
6788
- const b = lab[2];
6789
- let x;
6790
- let y;
6791
- let z;
6792
-
6793
- y = (l + 16) / 116;
6794
- x = a / 500 + y;
6795
- z = y - b / 200;
6796
-
6797
- const y2 = y ** 3;
6798
- const x2 = x ** 3;
6799
- const z2 = z ** 3;
6800
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
6801
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
6802
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
6803
-
6804
- x *= 95.047;
6805
- y *= 100;
6806
- z *= 108.883;
6807
-
6808
- return [x, y, z];
6809
- };
6810
-
6811
- convert.lab.lch = function (lab) {
6812
- const l = lab[0];
6813
- const a = lab[1];
6814
- const b = lab[2];
6815
- let h;
6816
-
6817
- const hr = Math.atan2(b, a);
6818
- h = hr * 360 / 2 / Math.PI;
6819
-
6820
- if (h < 0) {
6821
- h += 360;
6822
- }
6823
-
6824
- const c = Math.sqrt(a * a + b * b);
6825
-
6826
- return [l, c, h];
6827
- };
6828
-
6829
- convert.lch.lab = function (lch) {
6830
- const l = lch[0];
6831
- const c = lch[1];
6832
- const h = lch[2];
6833
-
6834
- const hr = h / 360 * 2 * Math.PI;
6835
- const a = c * Math.cos(hr);
6836
- const b = c * Math.sin(hr);
6837
-
6838
- return [l, a, b];
6839
- };
6840
-
6841
- convert.rgb.ansi16 = function (args, saturation = null) {
6842
- const [r, g, b] = args;
6843
- let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
6844
-
6845
- value = Math.round(value / 50);
6846
-
6847
- if (value === 0) {
6848
- return 30;
6849
- }
6850
-
6851
- let ansi = 30
6852
- + ((Math.round(b / 255) << 2)
6853
- | (Math.round(g / 255) << 1)
6854
- | Math.round(r / 255));
6855
-
6856
- if (value === 2) {
6857
- ansi += 60;
6858
- }
6859
-
6860
- return ansi;
6861
- };
6862
-
6863
- convert.hsv.ansi16 = function (args) {
6864
- // Optimization here; we already know the value and don't need to get
6865
- // it converted for us.
6866
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
6867
- };
6868
-
6869
- convert.rgb.ansi256 = function (args) {
6870
- const r = args[0];
6871
- const g = args[1];
6872
- const b = args[2];
6873
-
6874
- // We use the extended greyscale palette here, with the exception of
6875
- // black and white. normal palette only has 4 greyscale shades.
6876
- if (r === g && g === b) {
6877
- if (r < 8) {
6878
- return 16;
6879
- }
6880
-
6881
- if (r > 248) {
6882
- return 231;
6883
- }
6884
-
6885
- return Math.round(((r - 8) / 247) * 24) + 232;
6886
- }
6887
-
6888
- const ansi = 16
6889
- + (36 * Math.round(r / 255 * 5))
6890
- + (6 * Math.round(g / 255 * 5))
6891
- + Math.round(b / 255 * 5);
6892
-
6893
- return ansi;
6894
- };
6895
-
6896
- convert.ansi16.rgb = function (args) {
6897
- let color = args % 10;
6898
-
6899
- // Handle greyscale
6900
- if (color === 0 || color === 7) {
6901
- if (args > 50) {
6902
- color += 3.5;
6903
- }
6904
-
6905
- color = color / 10.5 * 255;
6906
-
6907
- return [color, color, color];
6908
- }
6909
-
6910
- const mult = (~~(args > 50) + 1) * 0.5;
6911
- const r = ((color & 1) * mult) * 255;
6912
- const g = (((color >> 1) & 1) * mult) * 255;
6913
- const b = (((color >> 2) & 1) * mult) * 255;
6914
-
6915
- return [r, g, b];
6916
- };
6917
-
6918
- convert.ansi256.rgb = function (args) {
6919
- // Handle greyscale
6920
- if (args >= 232) {
6921
- const c = (args - 232) * 10 + 8;
6922
- return [c, c, c];
6923
- }
6924
-
6925
- args -= 16;
6926
-
6927
- let rem;
6928
- const r = Math.floor(args / 36) / 5 * 255;
6929
- const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
6930
- const b = (rem % 6) / 5 * 255;
6931
-
6932
- return [r, g, b];
6933
- };
6934
-
6935
- convert.rgb.hex = function (args) {
6936
- const integer = ((Math.round(args[0]) & 0xFF) << 16)
6937
- + ((Math.round(args[1]) & 0xFF) << 8)
6938
- + (Math.round(args[2]) & 0xFF);
6939
-
6940
- const string = integer.toString(16).toUpperCase();
6941
- return '000000'.substring(string.length) + string;
6942
- };
6943
-
6944
- convert.hex.rgb = function (args) {
6945
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
6946
- if (!match) {
6947
- return [0, 0, 0];
6948
- }
6949
-
6950
- let colorString = match[0];
6951
-
6952
- if (match[0].length === 3) {
6953
- colorString = colorString.split('').map(char => {
6954
- return char + char;
6955
- }).join('');
6956
- }
6957
-
6958
- const integer = parseInt(colorString, 16);
6959
- const r = (integer >> 16) & 0xFF;
6960
- const g = (integer >> 8) & 0xFF;
6961
- const b = integer & 0xFF;
6962
-
6963
- return [r, g, b];
6964
- };
6965
-
6966
- convert.rgb.hcg = function (rgb) {
6967
- const r = rgb[0] / 255;
6968
- const g = rgb[1] / 255;
6969
- const b = rgb[2] / 255;
6970
- const max = Math.max(Math.max(r, g), b);
6971
- const min = Math.min(Math.min(r, g), b);
6972
- const chroma = (max - min);
6973
- let grayscale;
6974
- let hue;
6975
-
6976
- if (chroma < 1) {
6977
- grayscale = min / (1 - chroma);
6978
- } else {
6979
- grayscale = 0;
6980
- }
6981
-
6982
- if (chroma <= 0) {
6983
- hue = 0;
6984
- } else
6985
- if (max === r) {
6986
- hue = ((g - b) / chroma) % 6;
6987
- } else
6988
- if (max === g) {
6989
- hue = 2 + (b - r) / chroma;
6990
- } else {
6991
- hue = 4 + (r - g) / chroma;
6992
- }
6993
-
6994
- hue /= 6;
6995
- hue %= 1;
6996
-
6997
- return [hue * 360, chroma * 100, grayscale * 100];
6998
- };
6999
-
7000
- convert.hsl.hcg = function (hsl) {
7001
- const s = hsl[1] / 100;
7002
- const l = hsl[2] / 100;
7003
-
7004
- const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
7005
-
7006
- let f = 0;
7007
- if (c < 1.0) {
7008
- f = (l - 0.5 * c) / (1.0 - c);
7009
- }
7010
-
7011
- return [hsl[0], c * 100, f * 100];
7012
- };
7013
-
7014
- convert.hsv.hcg = function (hsv) {
7015
- const s = hsv[1] / 100;
7016
- const v = hsv[2] / 100;
7017
-
7018
- const c = s * v;
7019
- let f = 0;
7020
-
7021
- if (c < 1.0) {
7022
- f = (v - c) / (1 - c);
7023
- }
7024
-
7025
- return [hsv[0], c * 100, f * 100];
7026
- };
7027
-
7028
- convert.hcg.rgb = function (hcg) {
7029
- const h = hcg[0] / 360;
7030
- const c = hcg[1] / 100;
7031
- const g = hcg[2] / 100;
7032
-
7033
- if (c === 0.0) {
7034
- return [g * 255, g * 255, g * 255];
7035
- }
7036
-
7037
- const pure = [0, 0, 0];
7038
- const hi = (h % 1) * 6;
7039
- const v = hi % 1;
7040
- const w = 1 - v;
7041
- let mg = 0;
7042
-
7043
- /* eslint-disable max-statements-per-line */
7044
- switch (Math.floor(hi)) {
7045
- case 0:
7046
- pure[0] = 1; pure[1] = v; pure[2] = 0; break;
7047
- case 1:
7048
- pure[0] = w; pure[1] = 1; pure[2] = 0; break;
7049
- case 2:
7050
- pure[0] = 0; pure[1] = 1; pure[2] = v; break;
7051
- case 3:
7052
- pure[0] = 0; pure[1] = w; pure[2] = 1; break;
7053
- case 4:
7054
- pure[0] = v; pure[1] = 0; pure[2] = 1; break;
7055
- default:
7056
- pure[0] = 1; pure[1] = 0; pure[2] = w;
7057
- }
7058
- /* eslint-enable max-statements-per-line */
7059
-
7060
- mg = (1.0 - c) * g;
7061
-
7062
- return [
7063
- (c * pure[0] + mg) * 255,
7064
- (c * pure[1] + mg) * 255,
7065
- (c * pure[2] + mg) * 255
7066
- ];
7067
- };
7068
-
7069
- convert.hcg.hsv = function (hcg) {
7070
- const c = hcg[1] / 100;
7071
- const g = hcg[2] / 100;
7072
-
7073
- const v = c + g * (1.0 - c);
7074
- let f = 0;
7075
-
7076
- if (v > 0.0) {
7077
- f = c / v;
7078
- }
7079
-
7080
- return [hcg[0], f * 100, v * 100];
7081
- };
7082
-
7083
- convert.hcg.hsl = function (hcg) {
7084
- const c = hcg[1] / 100;
7085
- const g = hcg[2] / 100;
7086
-
7087
- const l = g * (1.0 - c) + 0.5 * c;
7088
- let s = 0;
7089
-
7090
- if (l > 0.0 && l < 0.5) {
7091
- s = c / (2 * l);
7092
- } else
7093
- if (l >= 0.5 && l < 1.0) {
7094
- s = c / (2 * (1 - l));
7095
- }
7096
-
7097
- return [hcg[0], s * 100, l * 100];
7098
- };
7099
-
7100
- convert.hcg.hwb = function (hcg) {
7101
- const c = hcg[1] / 100;
7102
- const g = hcg[2] / 100;
7103
- const v = c + g * (1.0 - c);
7104
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
7105
- };
7106
-
7107
- convert.hwb.hcg = function (hwb) {
7108
- const w = hwb[1] / 100;
7109
- const b = hwb[2] / 100;
7110
- const v = 1 - b;
7111
- const c = v - w;
7112
- let g = 0;
7113
-
7114
- if (c < 1) {
7115
- g = (v - c) / (1 - c);
7116
- }
7117
-
7118
- return [hwb[0], c * 100, g * 100];
7119
- };
7120
-
7121
- convert.apple.rgb = function (apple) {
7122
- return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
7123
- };
7124
-
7125
- convert.rgb.apple = function (rgb) {
7126
- return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
7127
- };
7128
-
7129
- convert.gray.rgb = function (args) {
7130
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
7131
- };
7132
-
7133
- convert.gray.hsl = function (args) {
7134
- return [0, 0, args[0]];
7135
- };
7136
-
7137
- convert.gray.hsv = convert.gray.hsl;
7138
-
7139
- convert.gray.hwb = function (gray) {
7140
- return [0, 100, gray[0]];
7141
- };
7142
-
7143
- convert.gray.cmyk = function (gray) {
7144
- return [0, 0, 0, gray[0]];
7145
- };
7146
-
7147
- convert.gray.lab = function (gray) {
7148
- return [gray[0], 0, 0];
7149
- };
7150
-
7151
- convert.gray.hex = function (gray) {
7152
- const val = Math.round(gray[0] / 100 * 255) & 0xFF;
7153
- const integer = (val << 16) + (val << 8) + val;
7154
-
7155
- const string = integer.toString(16).toUpperCase();
7156
- return '000000'.substring(string.length) + string;
7157
- };
7158
-
7159
- convert.rgb.gray = function (rgb) {
7160
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
7161
- return [val / 255 * 100];
7162
- };
7163
-
7164
-
7165
- /***/ }),
7166
-
7167
- /***/ 2085:
7168
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
7169
-
7170
- const conversions = __webpack_require__(8168);
7171
- const route = __webpack_require__(4111);
7172
-
7173
- const convert = {};
7174
-
7175
- const models = Object.keys(conversions);
7176
-
7177
- function wrapRaw(fn) {
7178
- const wrappedFn = function (...args) {
7179
- const arg0 = args[0];
7180
- if (arg0 === undefined || arg0 === null) {
7181
- return arg0;
7182
- }
7183
-
7184
- if (arg0.length > 1) {
7185
- args = arg0;
7186
- }
7187
-
7188
- return fn(args);
7189
- };
7190
-
7191
- // Preserve .conversion property if there is one
7192
- if ('conversion' in fn) {
7193
- wrappedFn.conversion = fn.conversion;
7194
- }
7195
-
7196
- return wrappedFn;
7197
- }
7198
-
7199
- function wrapRounded(fn) {
7200
- const wrappedFn = function (...args) {
7201
- const arg0 = args[0];
7202
-
7203
- if (arg0 === undefined || arg0 === null) {
7204
- return arg0;
7205
- }
7206
-
7207
- if (arg0.length > 1) {
7208
- args = arg0;
7209
- }
7210
-
7211
- const result = fn(args);
7212
-
7213
- // We're assuming the result is an array here.
7214
- // see notice in conversions.js; don't use box types
7215
- // in conversion functions.
7216
- if (typeof result === 'object') {
7217
- for (let len = result.length, i = 0; i < len; i++) {
7218
- result[i] = Math.round(result[i]);
7219
- }
7220
- }
7221
-
7222
- return result;
7223
- };
7224
-
7225
- // Preserve .conversion property if there is one
7226
- if ('conversion' in fn) {
7227
- wrappedFn.conversion = fn.conversion;
7228
- }
7229
-
7230
- return wrappedFn;
7231
- }
7232
-
7233
- models.forEach(fromModel => {
7234
- convert[fromModel] = {};
7235
-
7236
- Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
7237
- Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
7238
-
7239
- const routes = route(fromModel);
7240
- const routeModels = Object.keys(routes);
7241
-
7242
- routeModels.forEach(toModel => {
7243
- const fn = routes[toModel];
7244
-
7245
- convert[fromModel][toModel] = wrapRounded(fn);
7246
- convert[fromModel][toModel].raw = wrapRaw(fn);
7247
- });
7248
- });
7249
-
7250
- module.exports = convert;
7251
-
7252
-
7253
- /***/ }),
7254
-
7255
- /***/ 4111:
7256
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
7257
-
7258
- const conversions = __webpack_require__(8168);
7259
-
7260
- /*
7261
- This function routes a model to all other models.
7262
-
7263
- all functions that are routed have a property `.conversion` attached
7264
- to the returned synthetic function. This property is an array
7265
- of strings, each with the steps in between the 'from' and 'to'
7266
- color models (inclusive).
7267
-
7268
- conversions that are not possible simply are not included.
7269
- */
7270
-
7271
- function buildGraph() {
7272
- const graph = {};
7273
- // https://jsperf.com/object-keys-vs-for-in-with-closure/3
7274
- const models = Object.keys(conversions);
7275
-
7276
- for (let len = models.length, i = 0; i < len; i++) {
7277
- graph[models[i]] = {
7278
- // http://jsperf.com/1-vs-infinity
7279
- // micro-opt, but this is simple.
7280
- distance: -1,
7281
- parent: null
7282
- };
7283
- }
7284
-
7285
- return graph;
7286
- }
7287
-
7288
- // https://en.wikipedia.org/wiki/Breadth-first_search
7289
- function deriveBFS(fromModel) {
7290
- const graph = buildGraph();
7291
- const queue = [fromModel]; // Unshift -> queue -> pop
7292
-
7293
- graph[fromModel].distance = 0;
7294
-
7295
- while (queue.length) {
7296
- const current = queue.pop();
7297
- const adjacents = Object.keys(conversions[current]);
7298
-
7299
- for (let len = adjacents.length, i = 0; i < len; i++) {
7300
- const adjacent = adjacents[i];
7301
- const node = graph[adjacent];
7302
-
7303
- if (node.distance === -1) {
7304
- node.distance = graph[current].distance + 1;
7305
- node.parent = current;
7306
- queue.unshift(adjacent);
7307
- }
7308
- }
7309
- }
7310
-
7311
- return graph;
7312
- }
7313
-
7314
- function link(from, to) {
7315
- return function (args) {
7316
- return to(from(args));
7317
- };
7318
- }
7319
-
7320
- function wrapConversion(toModel, graph) {
7321
- const path = [graph[toModel].parent, toModel];
7322
- let fn = conversions[graph[toModel].parent][toModel];
7323
-
7324
- let cur = graph[toModel].parent;
7325
- while (graph[cur].parent) {
7326
- path.unshift(graph[cur].parent);
7327
- fn = link(conversions[graph[cur].parent][cur], fn);
7328
- cur = graph[cur].parent;
7329
- }
7330
-
7331
- fn.conversion = path;
7332
- return fn;
7333
- }
7334
-
7335
- module.exports = function (fromModel) {
7336
- const graph = deriveBFS(fromModel);
7337
- const conversion = {};
7338
-
7339
- const models = Object.keys(graph);
7340
- for (let len = models.length, i = 0; i < len; i++) {
7341
- const toModel = models[i];
7342
- const node = graph[toModel];
7343
-
7344
- if (node.parent === null) {
7345
- // No possible conversion, or this node is the source model.
7346
- continue;
7347
- }
7348
-
7349
- conversion[toModel] = wrapConversion(toModel, graph);
7350
- }
7351
-
7352
- return conversion;
7353
- };
7354
-
7355
-
7356
-
7357
- /***/ }),
7358
-
7359
- /***/ 8874:
7360
- /***/ (function(module) {
7361
-
7362
-
7363
-
7364
- module.exports = {
7365
- "aliceblue": [240, 248, 255],
7366
- "antiquewhite": [250, 235, 215],
7367
- "aqua": [0, 255, 255],
7368
- "aquamarine": [127, 255, 212],
7369
- "azure": [240, 255, 255],
7370
- "beige": [245, 245, 220],
7371
- "bisque": [255, 228, 196],
7372
- "black": [0, 0, 0],
7373
- "blanchedalmond": [255, 235, 205],
7374
- "blue": [0, 0, 255],
7375
- "blueviolet": [138, 43, 226],
7376
- "brown": [165, 42, 42],
7377
- "burlywood": [222, 184, 135],
7378
- "cadetblue": [95, 158, 160],
7379
- "chartreuse": [127, 255, 0],
7380
- "chocolate": [210, 105, 30],
7381
- "coral": [255, 127, 80],
7382
- "cornflowerblue": [100, 149, 237],
7383
- "cornsilk": [255, 248, 220],
7384
- "crimson": [220, 20, 60],
7385
- "cyan": [0, 255, 255],
7386
- "darkblue": [0, 0, 139],
7387
- "darkcyan": [0, 139, 139],
7388
- "darkgoldenrod": [184, 134, 11],
7389
- "darkgray": [169, 169, 169],
7390
- "darkgreen": [0, 100, 0],
7391
- "darkgrey": [169, 169, 169],
7392
- "darkkhaki": [189, 183, 107],
7393
- "darkmagenta": [139, 0, 139],
7394
- "darkolivegreen": [85, 107, 47],
7395
- "darkorange": [255, 140, 0],
7396
- "darkorchid": [153, 50, 204],
7397
- "darkred": [139, 0, 0],
7398
- "darksalmon": [233, 150, 122],
7399
- "darkseagreen": [143, 188, 143],
7400
- "darkslateblue": [72, 61, 139],
7401
- "darkslategray": [47, 79, 79],
7402
- "darkslategrey": [47, 79, 79],
7403
- "darkturquoise": [0, 206, 209],
7404
- "darkviolet": [148, 0, 211],
7405
- "deeppink": [255, 20, 147],
7406
- "deepskyblue": [0, 191, 255],
7407
- "dimgray": [105, 105, 105],
7408
- "dimgrey": [105, 105, 105],
7409
- "dodgerblue": [30, 144, 255],
7410
- "firebrick": [178, 34, 34],
7411
- "floralwhite": [255, 250, 240],
7412
- "forestgreen": [34, 139, 34],
7413
- "fuchsia": [255, 0, 255],
7414
- "gainsboro": [220, 220, 220],
7415
- "ghostwhite": [248, 248, 255],
7416
- "gold": [255, 215, 0],
7417
- "goldenrod": [218, 165, 32],
7418
- "gray": [128, 128, 128],
7419
- "green": [0, 128, 0],
7420
- "greenyellow": [173, 255, 47],
7421
- "grey": [128, 128, 128],
7422
- "honeydew": [240, 255, 240],
7423
- "hotpink": [255, 105, 180],
7424
- "indianred": [205, 92, 92],
7425
- "indigo": [75, 0, 130],
7426
- "ivory": [255, 255, 240],
7427
- "khaki": [240, 230, 140],
7428
- "lavender": [230, 230, 250],
7429
- "lavenderblush": [255, 240, 245],
7430
- "lawngreen": [124, 252, 0],
7431
- "lemonchiffon": [255, 250, 205],
7432
- "lightblue": [173, 216, 230],
7433
- "lightcoral": [240, 128, 128],
7434
- "lightcyan": [224, 255, 255],
7435
- "lightgoldenrodyellow": [250, 250, 210],
7436
- "lightgray": [211, 211, 211],
7437
- "lightgreen": [144, 238, 144],
7438
- "lightgrey": [211, 211, 211],
7439
- "lightpink": [255, 182, 193],
7440
- "lightsalmon": [255, 160, 122],
7441
- "lightseagreen": [32, 178, 170],
7442
- "lightskyblue": [135, 206, 250],
7443
- "lightslategray": [119, 136, 153],
7444
- "lightslategrey": [119, 136, 153],
7445
- "lightsteelblue": [176, 196, 222],
7446
- "lightyellow": [255, 255, 224],
7447
- "lime": [0, 255, 0],
7448
- "limegreen": [50, 205, 50],
7449
- "linen": [250, 240, 230],
7450
- "magenta": [255, 0, 255],
7451
- "maroon": [128, 0, 0],
7452
- "mediumaquamarine": [102, 205, 170],
7453
- "mediumblue": [0, 0, 205],
7454
- "mediumorchid": [186, 85, 211],
7455
- "mediumpurple": [147, 112, 219],
7456
- "mediumseagreen": [60, 179, 113],
7457
- "mediumslateblue": [123, 104, 238],
7458
- "mediumspringgreen": [0, 250, 154],
7459
- "mediumturquoise": [72, 209, 204],
7460
- "mediumvioletred": [199, 21, 133],
7461
- "midnightblue": [25, 25, 112],
7462
- "mintcream": [245, 255, 250],
7463
- "mistyrose": [255, 228, 225],
7464
- "moccasin": [255, 228, 181],
7465
- "navajowhite": [255, 222, 173],
7466
- "navy": [0, 0, 128],
7467
- "oldlace": [253, 245, 230],
7468
- "olive": [128, 128, 0],
7469
- "olivedrab": [107, 142, 35],
7470
- "orange": [255, 165, 0],
7471
- "orangered": [255, 69, 0],
7472
- "orchid": [218, 112, 214],
7473
- "palegoldenrod": [238, 232, 170],
7474
- "palegreen": [152, 251, 152],
7475
- "paleturquoise": [175, 238, 238],
7476
- "palevioletred": [219, 112, 147],
7477
- "papayawhip": [255, 239, 213],
7478
- "peachpuff": [255, 218, 185],
7479
- "peru": [205, 133, 63],
7480
- "pink": [255, 192, 203],
7481
- "plum": [221, 160, 221],
7482
- "powderblue": [176, 224, 230],
7483
- "purple": [128, 0, 128],
7484
- "rebeccapurple": [102, 51, 153],
7485
- "red": [255, 0, 0],
7486
- "rosybrown": [188, 143, 143],
7487
- "royalblue": [65, 105, 225],
7488
- "saddlebrown": [139, 69, 19],
7489
- "salmon": [250, 128, 114],
7490
- "sandybrown": [244, 164, 96],
7491
- "seagreen": [46, 139, 87],
7492
- "seashell": [255, 245, 238],
7493
- "sienna": [160, 82, 45],
7494
- "silver": [192, 192, 192],
7495
- "skyblue": [135, 206, 235],
7496
- "slateblue": [106, 90, 205],
7497
- "slategray": [112, 128, 144],
7498
- "slategrey": [112, 128, 144],
7499
- "snow": [255, 250, 250],
7500
- "springgreen": [0, 255, 127],
7501
- "steelblue": [70, 130, 180],
7502
- "tan": [210, 180, 140],
7503
- "teal": [0, 128, 128],
7504
- "thistle": [216, 191, 216],
7505
- "tomato": [255, 99, 71],
7506
- "turquoise": [64, 224, 208],
7507
- "violet": [238, 130, 238],
7508
- "wheat": [245, 222, 179],
7509
- "white": [255, 255, 255],
7510
- "whitesmoke": [245, 245, 245],
7511
- "yellow": [255, 255, 0],
7512
- "yellowgreen": [154, 205, 50]
7513
- };
7514
-
7515
-
7516
5725
  /***/ }),
7517
5726
 
7518
5727
  /***/ 7187:
@@ -14764,18 +12973,6 @@ function simpleEnd(buf) {
14764
12973
  return buf && buf.length ? this.write(buf) : '';
14765
12974
  }
14766
12975
 
14767
- /***/ }),
14768
-
14769
- /***/ 8555:
14770
- /***/ (function(module) {
14771
-
14772
-
14773
- module.exports = {
14774
- stdout: false,
14775
- stderr: false
14776
- };
14777
-
14778
-
14779
12976
  /***/ }),
14780
12977
 
14781
12978
  /***/ 4927:
@@ -18170,24 +16367,6 @@ function parseEther(ether) {
18170
16367
  return parseUnits(ether, 18);
18171
16368
  }
18172
16369
  //# sourceMappingURL=index.js.map
18173
- // EXTERNAL MODULE: ./node_modules/chalk/source/index.js
18174
- var source = __webpack_require__(4061);
18175
- var source_default = /*#__PURE__*/__webpack_require__.n(source);
18176
- ;// CONCATENATED MODULE: ./src/utils/utils.js
18177
- // import { promisify } from 'util'
18178
- // import { writeFile, readFile } from 'fs'
18179
-
18180
-
18181
- ;
18182
-
18183
- const info = text => console.log(source_default().blueBright(text))
18184
-
18185
- const subinfo = text => console.log(source_default().magentaBright(text))
18186
-
18187
-
18188
- // export const write = promisify(writeFile)
18189
- // export const read = promisify(readFile)
18190
-
18191
16370
  // EXTERNAL MODULE: ./node_modules/vm-browserify/index.js
18192
16371
  var vm_browserify = __webpack_require__(5140);
18193
16372
  // EXTERNAL MODULE: ./node_modules/protons/src/index.js
@@ -19133,7 +17312,6 @@ const calculateReward = (validators, fees) => {
19133
17312
 
19134
17313
 
19135
17314
 
19136
-
19137
17315
  // import State from './state'
19138
17316
 
19139
17317
  class Machine {
@@ -19193,8 +17371,8 @@ console.log(e);
19193
17371
  globalThis.msg = this.#createMessage(contractMessage.decoded.creator)
19194
17372
  // globalThis.msg = {sender: contractMessage.decoded.creator}
19195
17373
  this.#contracts[contractMessage.hash] = new Contract(...params)
19196
- info(`loaded contract: ${contractMessage.hash}`);
19197
- subinfo(`size: ${Math.round((contractMessage.encoded.length / 1024) * 100) / 100} kb`);
17374
+ debug(`loaded contract: ${contractMessage.hash}`);
17375
+ debug(`size: ${Math.round((contractMessage.encoded.length / 1024) * 100) / 100} kb`);
19198
17376
  } catch (e) {
19199
17377
  console.log(e);
19200
17378
  console.warn(`removing contract ${contractMessage.hash}`);
@@ -19417,7 +17595,7 @@ class Chain {
19417
17595
  console.log(this.#blocks);
19418
17596
  let blocksSynced = localIndex > 0 ? localIndex - index : index
19419
17597
  blocksSynced += 1
19420
- info(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`)
17598
+ debug(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`)
19421
17599
 
19422
17600
  const end = this.#blocks.length
19423
17601
  const start = (this.#blocks.length) - blocksSynced
@@ -19531,7 +17709,7 @@ class Chain {
19531
17709
  this.#lastBlock = {hash: blockMessage.hash, ...blockMessage.decoded}
19532
17710
  await blockStore.put(blockMessage.hash, blockMessage.encoded)
19533
17711
  await chainStore.put('lastBlock', new TextEncoder().encode(blockMessage.hash))
19534
- info(`added block: ${blockMessage.hash}`)
17712
+ debug(`added block: ${blockMessage.hash}`)
19535
17713
  let promises = []
19536
17714
  let contracts = []
19537
17715
  for (let transaction of blockMessage.decoded.transactions) {
@@ -19730,6 +17908,11 @@ class Chain {
19730
17908
  *
19731
17909
  * example: [hash]
19732
17910
  * createTransaction('0x0', 'createContract', [hash])
17911
+ *
17912
+ * @param {String} to - the contract address for the contract to interact with
17913
+ * @param {String} method - the method/function to run
17914
+ * @param {Array} params - array of paramters to apply to the contract method
17915
+ * @param {Number} nonce - total transaction count [optional]
19733
17916
  */
19734
17917
  createTransaction(to, method, params, nonce) {
19735
17918
  return this.createTransactionFrom(peernet.id, to, method, params, nonce)
@@ -19738,6 +17921,12 @@ class Chain {
19738
17921
  * every tx done is trough contracts so no need for amount
19739
17922
  * data is undefined when nothing is returned
19740
17923
  * error is thrown on error so undefined data doesn't mean there is an error...
17924
+ *
17925
+ * @param {String} from - the sender address
17926
+ * @param {String} to - the contract address for the contract to interact with
17927
+ * @param {String} method - the method/function to run
17928
+ * @param {Array} params - array of paramters to apply to the contract method
17929
+ * @param {Number} nonce - total transaction count [optional]
19741
17930
  */
19742
17931
  async createTransactionFrom(from, to, method, params, nonce) {
19743
17932
  if (nonce === undefined) {
@@ -19782,6 +17971,7 @@ class Chain {
19782
17971
 
19783
17972
  /**
19784
17973
  *
17974
+ * @param {String} contract - a contract string (see plugins/deployContract)
19785
17975
  */
19786
17976
  async deployContract(contract, params = []) {
19787
17977
  globalThis.msg = {sender: peernet.id, call: this.call}
@@ -19851,6 +18041,15 @@ class Chain {
19851
18041
  return this.#machine.deleteAll()
19852
18042
  }
19853
18043
 
18044
+ /**
18045
+ * lookup an address for a registered name using the builtin nameService
18046
+ * @check nameService
18047
+ *
18048
+ * @param {String} - contractName
18049
+ * @returns {String} - address
18050
+ *
18051
+ * @example chain.lookup('myCoolContractName') // qmqsfddfdgfg...
18052
+ */
19854
18053
  lookup(name) {
19855
18054
  return this.call(lib.nameService, 'lookup', [name])
19856
18055
  }