@nethru/kit 1.0.3 → 1.0.4
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.
- package/dist/index.esm.js +1879 -1873
- package/dist/index.js +1879 -1871
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,1003 +1,218 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var material = require('@mui/material');
|
|
3
4
|
var React$1 = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
6
|
var Highcharts$1 = require('highcharts');
|
|
5
7
|
var HighchartsReact = require('highcharts-react-official');
|
|
6
8
|
var highchartsAccessibility = require('highcharts/modules/accessibility');
|
|
7
9
|
var highchartsAnnotations = require('highcharts/modules/annotations');
|
|
8
10
|
var colors = require('@nethru/ui/base/colors');
|
|
9
|
-
var material = require('@mui/material');
|
|
10
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
var iconsMaterial = require('@mui/icons-material');
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
let globalConfig = {
|
|
14
|
+
apiUrl: ''
|
|
15
|
+
};
|
|
16
|
+
function configure$1(config) {
|
|
17
|
+
globalConfig = {
|
|
18
|
+
...globalConfig,
|
|
19
|
+
...config
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function getConfig() {
|
|
23
|
+
return globalConfig;
|
|
15
24
|
}
|
|
16
25
|
|
|
17
|
-
|
|
26
|
+
function ok$1() {}
|
|
27
|
+
|
|
28
|
+
function unreachable() {}
|
|
18
29
|
|
|
19
30
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
31
|
+
* @typedef Options
|
|
32
|
+
* Configuration for `stringify`.
|
|
33
|
+
* @property {boolean} [padLeft=true]
|
|
34
|
+
* Whether to pad a space before a token.
|
|
35
|
+
* @property {boolean} [padRight=false]
|
|
36
|
+
* Whether to pad a space after a token.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Serialize an array of strings or numbers to comma-separated tokens.
|
|
23
42
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
43
|
+
* @param {Array<string|number>} values
|
|
44
|
+
* List of tokens.
|
|
45
|
+
* @param {Options} [options]
|
|
46
|
+
* Configuration for `stringify` (optional).
|
|
47
|
+
* @returns {string}
|
|
48
|
+
* Comma-separated tokens.
|
|
49
|
+
*/
|
|
50
|
+
function stringify$1(values, options) {
|
|
51
|
+
const settings = {};
|
|
52
|
+
|
|
53
|
+
// Ensure the last empty entry is seen.
|
|
54
|
+
const input = values[values.length - 1] === '' ? [...values, ''] : values;
|
|
55
|
+
|
|
56
|
+
return input
|
|
57
|
+
.join(
|
|
58
|
+
(settings.padRight ? ' ' : '') +
|
|
59
|
+
',' +
|
|
60
|
+
(settings.padLeft === false ? '' : ' ')
|
|
61
|
+
)
|
|
62
|
+
.trim()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @typedef Options
|
|
67
|
+
* Configuration.
|
|
68
|
+
* @property {boolean | null | undefined} [jsx=false]
|
|
69
|
+
* Support JSX identifiers (default: `false`).
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
const nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
73
|
+
const nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
74
|
+
|
|
75
|
+
/** @type {Options} */
|
|
76
|
+
const emptyOptions$2 = {};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Checks if the given value is a valid identifier name.
|
|
26
80
|
*
|
|
27
|
-
*
|
|
81
|
+
* @param {string} name
|
|
82
|
+
* Identifier to check.
|
|
83
|
+
* @param {Options | null | undefined} [options]
|
|
84
|
+
* Configuration (optional).
|
|
85
|
+
* @returns {boolean}
|
|
86
|
+
* Whether `name` can be an identifier.
|
|
28
87
|
*/
|
|
88
|
+
function name(name, options) {
|
|
89
|
+
const settings = emptyOptions$2;
|
|
90
|
+
const re = settings.jsx ? nameReJsx : nameRe;
|
|
91
|
+
return re.test(name)
|
|
92
|
+
}
|
|
29
93
|
|
|
30
|
-
|
|
94
|
+
/**
|
|
95
|
+
* @typedef {import('hast').Nodes} Nodes
|
|
96
|
+
*/
|
|
31
97
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
98
|
+
// HTML whitespace expression.
|
|
99
|
+
// See <https://infra.spec.whatwg.org/#ascii-whitespace>.
|
|
100
|
+
const re = /[ \t\n\f\r]/g;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Check if the given value is *inter-element whitespace*.
|
|
104
|
+
*
|
|
105
|
+
* @param {Nodes | string} thing
|
|
106
|
+
* Thing to check (`Node` or `string`).
|
|
107
|
+
* @returns {boolean}
|
|
108
|
+
* Whether the `value` is inter-element whitespace (`boolean`): consisting of
|
|
109
|
+
* zero or more of space, tab (`\t`), line feed (`\n`), carriage return
|
|
110
|
+
* (`\r`), or form feed (`\f`); if a node is passed it must be a `Text` node,
|
|
111
|
+
* whose `value` field is checked.
|
|
112
|
+
*/
|
|
113
|
+
function whitespace(thing) {
|
|
114
|
+
return typeof thing === 'object'
|
|
115
|
+
? thing.type === 'text'
|
|
116
|
+
? empty$1(thing.value)
|
|
117
|
+
: false
|
|
118
|
+
: empty$1(thing)
|
|
39
119
|
}
|
|
40
120
|
|
|
41
|
-
|
|
121
|
+
/**
|
|
122
|
+
* @param {string} value
|
|
123
|
+
* @returns {boolean}
|
|
124
|
+
*/
|
|
125
|
+
function empty$1(value) {
|
|
126
|
+
return value.replace(re, '') === ''
|
|
127
|
+
}
|
|
42
128
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
title: {
|
|
68
|
-
text: undefined
|
|
69
|
-
},
|
|
70
|
-
tooltip: {
|
|
71
|
-
pointFormat: '<span><b>{point.y}</b> ({point.percentage:.1f}%)</span>',
|
|
72
|
-
style: {
|
|
73
|
-
fontFamily: fontFamily$1,
|
|
74
|
-
fontSize: '13px'
|
|
75
|
-
},
|
|
76
|
-
useHTML: true
|
|
77
|
-
},
|
|
78
|
-
plotOptions: {
|
|
79
|
-
pie: {
|
|
80
|
-
size: size,
|
|
81
|
-
allowPointSelect: true,
|
|
82
|
-
cursor: 'pointer',
|
|
83
|
-
dataLabels: {
|
|
84
|
-
enabled: true,
|
|
85
|
-
format: '{point.name}<br><b>{point.y}</b> ({point.percentage:.1f}%)',
|
|
86
|
-
distance: 20,
|
|
87
|
-
style: {
|
|
88
|
-
fontSize: '13px',
|
|
89
|
-
fontWeight: '100',
|
|
90
|
-
textOutline: 'none',
|
|
91
|
-
fontFamily: fontFamily$1
|
|
92
|
-
},
|
|
93
|
-
connectorColor: '#666',
|
|
94
|
-
connectorWidth: 1,
|
|
95
|
-
overflow: 'allow',
|
|
96
|
-
crop: false
|
|
97
|
-
},
|
|
98
|
-
showInLegend: false
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
series: [{
|
|
102
|
-
type: 'pie',
|
|
103
|
-
name: '',
|
|
104
|
-
colorByPoint: true,
|
|
105
|
-
data: chartData
|
|
106
|
-
}],
|
|
107
|
-
credits: {
|
|
108
|
-
enabled: false
|
|
109
|
-
},
|
|
110
|
-
accessibility: {
|
|
111
|
-
enabled: false
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
}, [data, width, height, size, colors]);
|
|
115
|
-
return /*#__PURE__*/React$1.createElement("div", {
|
|
116
|
-
style: styles$7.chartWrapper
|
|
117
|
-
}, /*#__PURE__*/React$1.createElement("div", {
|
|
118
|
-
style: {
|
|
119
|
-
...styles$7.chartContainer,
|
|
120
|
-
width,
|
|
121
|
-
height,
|
|
122
|
-
position: 'relative'
|
|
123
|
-
}
|
|
124
|
-
}, noData && /*#__PURE__*/React$1.createElement(CheckerboardBackground, {
|
|
125
|
-
width: width,
|
|
126
|
-
height: height
|
|
127
|
-
}), /*#__PURE__*/React$1.createElement("div", {
|
|
128
|
-
style: {
|
|
129
|
-
position: 'relative',
|
|
130
|
-
zIndex: 1
|
|
129
|
+
/**
|
|
130
|
+
* @import {Schema as SchemaType, Space} from 'property-information'
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
/** @type {SchemaType} */
|
|
134
|
+
class Schema {
|
|
135
|
+
/**
|
|
136
|
+
* @param {SchemaType['property']} property
|
|
137
|
+
* Property.
|
|
138
|
+
* @param {SchemaType['normal']} normal
|
|
139
|
+
* Normal.
|
|
140
|
+
* @param {Space | undefined} [space]
|
|
141
|
+
* Space.
|
|
142
|
+
* @returns
|
|
143
|
+
* Schema.
|
|
144
|
+
*/
|
|
145
|
+
constructor(property, normal, space) {
|
|
146
|
+
this.normal = normal;
|
|
147
|
+
this.property = property;
|
|
148
|
+
|
|
149
|
+
if (space) {
|
|
150
|
+
this.space = space;
|
|
131
151
|
}
|
|
132
|
-
}, /*#__PURE__*/React$1.createElement(HighchartsReact, {
|
|
133
|
-
highcharts: Highcharts$1,
|
|
134
|
-
options: options
|
|
135
|
-
}))), /*#__PURE__*/React$1.createElement("div", {
|
|
136
|
-
style: styles$7.agentName
|
|
137
|
-
}, data.name));
|
|
138
|
-
};
|
|
139
|
-
const fontFamily$1 = 'Pretendard, -apple-system, BlinkMacSystemFont, sans-serif';
|
|
140
|
-
const styles$7 = {
|
|
141
|
-
chartWrapper: {
|
|
142
|
-
background: 'transparent',
|
|
143
|
-
textAlign: 'center',
|
|
144
|
-
display: 'flex',
|
|
145
|
-
flexDirection: 'column',
|
|
146
|
-
justifyContent: 'center',
|
|
147
|
-
alignItems: 'center'
|
|
148
|
-
},
|
|
149
|
-
chartContainer: {
|
|
150
|
-
display: 'flex',
|
|
151
|
-
alignItems: 'center',
|
|
152
|
-
justifyContent: 'center'
|
|
153
|
-
},
|
|
154
|
-
agentName: {
|
|
155
|
-
fontSize: '12px',
|
|
156
|
-
fontWeight: '100',
|
|
157
|
-
marginTop: '-30px',
|
|
158
|
-
color: '#333'
|
|
159
152
|
}
|
|
160
|
-
}
|
|
161
|
-
const CheckerboardBackground = ({
|
|
162
|
-
width,
|
|
163
|
-
height
|
|
164
|
-
}) => {
|
|
165
|
-
const circleSize = Math.min(width, height) * 0.47;
|
|
166
|
-
return /*#__PURE__*/React$1.createElement("div", {
|
|
167
|
-
style: {
|
|
168
|
-
position: 'absolute',
|
|
169
|
-
width: circleSize,
|
|
170
|
-
height: circleSize,
|
|
171
|
-
borderRadius: '50%',
|
|
172
|
-
backgroundImage: `
|
|
173
|
-
linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
|
|
174
|
-
linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
|
|
175
|
-
linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
|
|
176
|
-
linear-gradient(-45deg, transparent 75%, #e0e0e0 75%)
|
|
177
|
-
`,
|
|
178
|
-
backgroundSize: '10px 10px',
|
|
179
|
-
backgroundPosition: '0 0, 0 5px, 5px -5px, -5px 0px',
|
|
180
|
-
backgroundColor: '#ffffff',
|
|
181
|
-
zIndex: 0
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
};
|
|
185
|
-
const checkerboardPattern = () => ({
|
|
186
|
-
pattern: {
|
|
187
|
-
path: {
|
|
188
|
-
d: 'M 0 0 L 5 5 M 4.5 -0.5 L 5.5 0.5 M -0.5 4.5 L 0.5 5.5',
|
|
189
|
-
stroke: '#d0d0d0',
|
|
190
|
-
strokeWidth: 1
|
|
191
|
-
},
|
|
192
|
-
width: 5,
|
|
193
|
-
height: 5,
|
|
194
|
-
backgroundColor: '#ffffff',
|
|
195
|
-
opacity: 1
|
|
196
|
-
}
|
|
197
|
-
});
|
|
153
|
+
}
|
|
198
154
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
title: {
|
|
228
|
-
text: undefined
|
|
229
|
-
},
|
|
230
|
-
tooltip: {
|
|
231
|
-
pointFormat: '<span><b>{point.y}</b></span>',
|
|
232
|
-
style: {
|
|
233
|
-
fontFamily: fontFamily,
|
|
234
|
-
fontSize: '13px',
|
|
235
|
-
fontWeight: '100'
|
|
236
|
-
},
|
|
237
|
-
useHTML: true
|
|
238
|
-
},
|
|
239
|
-
plotOptions: {
|
|
240
|
-
column: {
|
|
241
|
-
//size: size
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
xAxis: {
|
|
245
|
-
categories: data.categories,
|
|
246
|
-
crosshair: true,
|
|
247
|
-
labels: {
|
|
248
|
-
style: {
|
|
249
|
-
color: '#777',
|
|
250
|
-
fontFamily: fontFamily,
|
|
251
|
-
fontWeight: '400'
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
lineColor: '#aaa'
|
|
255
|
-
},
|
|
256
|
-
yAxis: {
|
|
257
|
-
title: {
|
|
258
|
-
text: undefined
|
|
259
|
-
},
|
|
260
|
-
labels: {
|
|
261
|
-
style: {
|
|
262
|
-
fontFamily: fontFamily,
|
|
263
|
-
fontSize: '12px',
|
|
264
|
-
fontWeight: '100'
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
gridLineColor: '#f9f9f9'
|
|
268
|
-
},
|
|
269
|
-
legend: {
|
|
270
|
-
layout: 'vertical',
|
|
271
|
-
itemStyle: {
|
|
272
|
-
fontFamily: fontFamily,
|
|
273
|
-
fontSize: '12px',
|
|
274
|
-
fontWeight: '100'
|
|
275
|
-
},
|
|
276
|
-
useHTML: true
|
|
277
|
-
},
|
|
278
|
-
series: series,
|
|
279
|
-
colors: colors,
|
|
280
|
-
credits: {
|
|
281
|
-
enabled: false
|
|
282
|
-
},
|
|
283
|
-
accessibility: {
|
|
284
|
-
enabled: false
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
}, [data, width, height, series, colors]);
|
|
288
|
-
return /*#__PURE__*/React$1.createElement("div", {
|
|
289
|
-
style: styles$6.chartWrapper
|
|
290
|
-
}, /*#__PURE__*/React$1.createElement(HighchartsReact, {
|
|
291
|
-
highcharts: Highcharts$1,
|
|
292
|
-
options: options
|
|
293
|
-
}));
|
|
294
|
-
};
|
|
295
|
-
const fontFamily = 'Pretendard, -apple-system, BlinkMacSystemFont, sans-serif';
|
|
296
|
-
const styles$6 = {
|
|
297
|
-
chartWrapper: {
|
|
298
|
-
background: 'transparent',
|
|
299
|
-
textAlign: 'center',
|
|
300
|
-
display: 'flex',
|
|
301
|
-
flexDirection: 'column',
|
|
302
|
-
justifyContent: 'center',
|
|
303
|
-
alignItems: 'center'
|
|
155
|
+
Schema.prototype.normal = {};
|
|
156
|
+
Schema.prototype.property = {};
|
|
157
|
+
Schema.prototype.space = undefined;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @import {Info, Space} from 'property-information'
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @param {ReadonlyArray<Schema>} definitions
|
|
166
|
+
* Definitions.
|
|
167
|
+
* @param {Space | undefined} [space]
|
|
168
|
+
* Space.
|
|
169
|
+
* @returns {Schema}
|
|
170
|
+
* Schema.
|
|
171
|
+
*/
|
|
172
|
+
function merge(definitions, space) {
|
|
173
|
+
/** @type {Record<string, Info>} */
|
|
174
|
+
const property = {};
|
|
175
|
+
/** @type {Record<string, string>} */
|
|
176
|
+
const normal = {};
|
|
177
|
+
|
|
178
|
+
for (const definition of definitions) {
|
|
179
|
+
Object.assign(property, definition.property);
|
|
180
|
+
Object.assign(normal, definition.normal);
|
|
304
181
|
}
|
|
305
|
-
};
|
|
306
|
-
const alphas = ['ff', 'bb', '77', '33'];
|
|
307
182
|
|
|
308
|
-
|
|
309
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
310
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
311
|
-
var t = arguments[e];
|
|
312
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
313
|
-
}
|
|
314
|
-
return n;
|
|
315
|
-
}, _extends.apply(null, arguments);
|
|
183
|
+
return new Schema(property, normal, space)
|
|
316
184
|
}
|
|
317
185
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
function
|
|
328
|
-
return
|
|
329
|
-
}
|
|
330
|
-
function formatPercent(value) {
|
|
331
|
-
return value !== undefined ? `${value.toLocaleString()}%` : '-';
|
|
332
|
-
}
|
|
333
|
-
function formatDuration(value) {
|
|
334
|
-
value = toValue(value);
|
|
335
|
-
if (!value) return '-';
|
|
336
|
-
let day = Math.floor(value / (60 * 60 * 24));
|
|
337
|
-
let hour = Math.floor(value / (60 * 60)) - day * 24;
|
|
338
|
-
let minute = Math.floor(value / 60) - (day * 24 + hour) * 60;
|
|
339
|
-
let second = Math.round(value % 60);
|
|
340
|
-
day = day > 0 ? `${day.toLocaleString()}일 ` : '';
|
|
341
|
-
hour = hour > 0 ? `${hour >= 10 ? hour : '0' + hour}시간 ` : '';
|
|
342
|
-
minute = `${minute >= 10 ? minute : '0' + minute}분 `;
|
|
343
|
-
second = `${second >= 10 ? second : '0' + second}초`;
|
|
344
|
-
return `${day}${hour}${minute}${second}`;
|
|
345
|
-
}
|
|
346
|
-
function formatBytes(value) {
|
|
347
|
-
return value !== undefined ? `${value.toLocaleString()} bytes` : '-';
|
|
186
|
+
/**
|
|
187
|
+
* Get the cleaned case insensitive form of an attribute or property.
|
|
188
|
+
*
|
|
189
|
+
* @param {string} value
|
|
190
|
+
* An attribute-like or property-like name.
|
|
191
|
+
* @returns {string}
|
|
192
|
+
* Value that can be used to look up the properly cased property on a
|
|
193
|
+
* `Schema`.
|
|
194
|
+
*/
|
|
195
|
+
function normalize$1(value) {
|
|
196
|
+
return value.toLowerCase()
|
|
348
197
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const preset = ['#003f5c', '#a05195', '#665191', '#2f4b7c', '#d45087', '#f95d6a', '#ff7c43', '#ffa600'];
|
|
368
|
-
all$1.map(color => color[0]);
|
|
369
|
-
|
|
370
|
-
highchartsAccessibility(Highcharts$1);
|
|
371
|
-
highchartsAnnotations(Highcharts$1);
|
|
372
|
-
function Chart(props) {
|
|
373
|
-
const [legendLimitEnabled, setLegendLimitEnabled] = React$1.useState(props.legendLimit > 0);
|
|
374
|
-
const [options, setOptions] = React$1.useState(toOptions(props, legendLimitEnabled));
|
|
375
|
-
React$1.useEffect(() => {
|
|
376
|
-
if (props.delay) setTimeout(() => setOptions(toOptions(props, legendLimitEnabled, handleLegendItemClick)), props.delay);else setOptions(toOptions(props, legendLimitEnabled, handleLegendItemClick));
|
|
377
|
-
// eslint-disable-next-line
|
|
378
|
-
}, [props]);
|
|
379
|
-
const handleLegendItemClick = React$1.useCallback(() => setLegendLimitEnabled(false), []);
|
|
380
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, options && /*#__PURE__*/React.createElement(HighchartsReact, {
|
|
381
|
-
highcharts: Highcharts$1,
|
|
382
|
-
options: options
|
|
383
|
-
}));
|
|
384
|
-
}
|
|
385
|
-
function toOptions(props, legendLimitEnabled, handleLegendItemClick) {
|
|
386
|
-
const {
|
|
387
|
-
title = '',
|
|
388
|
-
type,
|
|
389
|
-
categorize,
|
|
390
|
-
stacking,
|
|
391
|
-
showLegend = true,
|
|
392
|
-
showDataLabel,
|
|
393
|
-
xAxisType,
|
|
394
|
-
xAxisLabel = true,
|
|
395
|
-
xAxisLabelFormat,
|
|
396
|
-
xAxisTickInterval,
|
|
397
|
-
yAxisLabelEnabled = true,
|
|
398
|
-
yAxisLabelFormat,
|
|
399
|
-
yAxisTickInterval = null,
|
|
400
|
-
yAxisPlotLines = [],
|
|
401
|
-
opacity = 1,
|
|
402
|
-
innerSize = 0,
|
|
403
|
-
colors: customColors,
|
|
404
|
-
backgroundColor = undefined,
|
|
405
|
-
xPlotIndex,
|
|
406
|
-
dimension,
|
|
407
|
-
metrics,
|
|
408
|
-
records = [],
|
|
409
|
-
metas,
|
|
410
|
-
height = 200,
|
|
411
|
-
legendLimit,
|
|
412
|
-
legendAlign = 'center',
|
|
413
|
-
tooltip = {},
|
|
414
|
-
secondaryXAxis = []
|
|
415
|
-
} = props;
|
|
416
|
-
const {
|
|
417
|
-
outside
|
|
418
|
-
} = tooltip;
|
|
419
|
-
const pie = type === 'pie';
|
|
420
|
-
const centers = pieCenters(metrics.length);
|
|
421
|
-
const size = pieSize(metrics.length);
|
|
422
|
-
const colors$1 = customColors ? customColors : preset;
|
|
423
|
-
const categories = records.map(record => record[dimension]);
|
|
424
|
-
const mainXAxis = records.map(r => r.time);
|
|
425
|
-
const chartColorHandlers = {
|
|
426
|
-
line: (colors, index) => ({
|
|
427
|
-
color: colors[index],
|
|
428
|
-
mainColor: colors[index]
|
|
429
|
-
}),
|
|
430
|
-
area: (colors, index) => ({
|
|
431
|
-
color: colors[index][0],
|
|
432
|
-
mainColor: colors[index][1]
|
|
433
|
-
}),
|
|
434
|
-
gradient: (colors, index) => ({
|
|
435
|
-
color: {
|
|
436
|
-
linearGradient: {
|
|
437
|
-
x1: 0,
|
|
438
|
-
y1: 0,
|
|
439
|
-
x2: 0,
|
|
440
|
-
y2: 1
|
|
441
|
-
},
|
|
442
|
-
stops: [[0, `${colors[index][0]}`], [0.95, `${colors[index][1]}`]]
|
|
443
|
-
},
|
|
444
|
-
mainColor: colors[index][2]
|
|
445
|
-
})
|
|
446
|
-
};
|
|
447
|
-
const series = metrics.map(({
|
|
448
|
-
chartType,
|
|
449
|
-
metric
|
|
450
|
-
}, index) => {
|
|
451
|
-
const type = chartType === 'gradient' ? 'area' : chartType;
|
|
452
|
-
const {
|
|
453
|
-
color,
|
|
454
|
-
mainColor
|
|
455
|
-
} = chartColorHandlers[chartType](colors$1, index);
|
|
456
|
-
const meta = metas[metric];
|
|
457
|
-
let option = {
|
|
458
|
-
type: type,
|
|
459
|
-
name: meta ? meta.name : '',
|
|
460
|
-
data: records.map(record => {
|
|
461
|
-
const data = record.metric[metric] ?? null;
|
|
462
|
-
return pie ? {
|
|
463
|
-
name: record[dimension],
|
|
464
|
-
y: data
|
|
465
|
-
} : data;
|
|
466
|
-
}),
|
|
467
|
-
custom: {
|
|
468
|
-
type: meta ? meta.type : '',
|
|
469
|
-
pointerNames: meta?.pointerNames ?? null
|
|
470
|
-
},
|
|
471
|
-
center: centers[index] || [null, null],
|
|
472
|
-
size: size,
|
|
473
|
-
point: {
|
|
474
|
-
events: {
|
|
475
|
-
render: function () {
|
|
476
|
-
this.graphic.attr({
|
|
477
|
-
zIndex: this.y === 0 ? -1 : ZIndex.COMPARE_CHART_BASE - index
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
},
|
|
482
|
-
showInLegend: pie && index > 0 ? false : true,
|
|
483
|
-
color: color,
|
|
484
|
-
lineColor: mainColor,
|
|
485
|
-
lineWidth: 2,
|
|
486
|
-
marker: {
|
|
487
|
-
fillColor: mainColor
|
|
488
|
-
},
|
|
489
|
-
metric: metric
|
|
490
|
-
};
|
|
491
|
-
if (legendLimitEnabled) option = {
|
|
492
|
-
...option,
|
|
493
|
-
visible: index < legendLimit
|
|
494
|
-
};
|
|
495
|
-
return option;
|
|
496
|
-
});
|
|
497
|
-
const yPlotLines = yAxisPlotLines.map((line, index) => {
|
|
498
|
-
return {
|
|
499
|
-
value: line.value,
|
|
500
|
-
width: 1,
|
|
501
|
-
color: line.color,
|
|
502
|
-
dashStyle: "Dash",
|
|
503
|
-
zIndex: ZIndex.AVERAGE_LINE_BASE + index,
|
|
504
|
-
label: {
|
|
505
|
-
text: line.label,
|
|
506
|
-
align: line.labelAlign,
|
|
507
|
-
style: {
|
|
508
|
-
color: line.labelColor,
|
|
509
|
-
opacity: 0.7,
|
|
510
|
-
fontSize: "12px",
|
|
511
|
-
padding: '1px 5px'
|
|
512
|
-
},
|
|
513
|
-
y: -8,
|
|
514
|
-
useHTML: true
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
|
-
});
|
|
518
|
-
const xPlotBands = [{
|
|
519
|
-
from: xPlotIndex,
|
|
520
|
-
to: categories.length - 1,
|
|
521
|
-
color: 'rgba(0, 0, 0, 0.03)',
|
|
522
|
-
zIndex: ZIndex.NOW_BAND
|
|
523
|
-
}];
|
|
524
|
-
const xPlotLines = [{
|
|
525
|
-
color: "#aaa",
|
|
526
|
-
width: 1,
|
|
527
|
-
value: xPlotIndex,
|
|
528
|
-
zIndex: ZIndex.NOW_BORDER,
|
|
529
|
-
label: {
|
|
530
|
-
text: "현재",
|
|
531
|
-
rotation: 0,
|
|
532
|
-
x: 5,
|
|
533
|
-
y: 13,
|
|
534
|
-
style: {
|
|
535
|
-
fontWeight: 500,
|
|
536
|
-
lineHeight: "16.8px",
|
|
537
|
-
color: "#333",
|
|
538
|
-
fontSize: "12px"
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
}];
|
|
542
|
-
return {
|
|
543
|
-
chart: {
|
|
544
|
-
type: type.toLowerCase(),
|
|
545
|
-
height: height,
|
|
546
|
-
backgroundColor,
|
|
547
|
-
events: {
|
|
548
|
-
render: secondaryXAxis.length === 0 ? undefined : function () {
|
|
549
|
-
const chart = this;
|
|
550
|
-
const visibleSeries = chart.series.filter(s => s.visible);
|
|
551
|
-
let newCategories = null;
|
|
552
|
-
if (visibleSeries.length === 1 && visibleSeries[0].options.metric === 'prev') {
|
|
553
|
-
newCategories = secondaryXAxis;
|
|
554
|
-
} else {
|
|
555
|
-
newCategories = mainXAxis;
|
|
556
|
-
}
|
|
557
|
-
const isSame = JSON.stringify(chart.xAxis[0].categories) === JSON.stringify(newCategories);
|
|
558
|
-
if (!isSame) {
|
|
559
|
-
chart.xAxis[0].setCategories(newCategories);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
},
|
|
564
|
-
title: {
|
|
565
|
-
text: ''
|
|
566
|
-
},
|
|
567
|
-
subtitle: {
|
|
568
|
-
text: title
|
|
569
|
-
},
|
|
570
|
-
colors: colors$1,
|
|
571
|
-
xAxis: {
|
|
572
|
-
type: xAxisType,
|
|
573
|
-
labels: {
|
|
574
|
-
enabled: xAxisLabel,
|
|
575
|
-
autoRotation: false,
|
|
576
|
-
format: xAxisLabelFormat ? `{value:${xAxisLabelFormat}}` : undefined,
|
|
577
|
-
style: {
|
|
578
|
-
color: colors.grey[600]
|
|
579
|
-
}
|
|
580
|
-
},
|
|
581
|
-
categories: categorize ? categories : undefined,
|
|
582
|
-
tickWidth: 1,
|
|
583
|
-
tickInterval: xAxisTickInterval ?? (xAxisType === 'datetime' ? records.length / 20 : 1),
|
|
584
|
-
lineColor: colors.grey[900],
|
|
585
|
-
tickColor: colors.grey[900],
|
|
586
|
-
crosshair: true,
|
|
587
|
-
startOnTick: true,
|
|
588
|
-
plotBands: xPlotIndex !== undefined ? xPlotBands : undefined,
|
|
589
|
-
plotLines: xPlotIndex !== undefined ? xPlotLines : undefined
|
|
590
|
-
},
|
|
591
|
-
yAxis: {
|
|
592
|
-
title: {
|
|
593
|
-
text: ''
|
|
594
|
-
},
|
|
595
|
-
labels: {
|
|
596
|
-
enabled: yAxisLabelEnabled,
|
|
597
|
-
formatter: yAxisLabelFormat,
|
|
598
|
-
style: {
|
|
599
|
-
color: colors.grey[600]
|
|
600
|
-
}
|
|
601
|
-
},
|
|
602
|
-
tickInterval: yAxisTickInterval,
|
|
603
|
-
gridLineColor: '#f8f8f8',
|
|
604
|
-
plotLines: yPlotLines
|
|
605
|
-
},
|
|
606
|
-
plotOptions: {
|
|
607
|
-
series: {
|
|
608
|
-
opacity: opacity,
|
|
609
|
-
stacking: stackingType(stacking),
|
|
610
|
-
showInLegend: showLegend,
|
|
611
|
-
dataLabels: {
|
|
612
|
-
enabled: showDataLabel
|
|
613
|
-
},
|
|
614
|
-
colorByPoint: pie,
|
|
615
|
-
lineWidth: 2,
|
|
616
|
-
marker: {
|
|
617
|
-
enabled: false,
|
|
618
|
-
symbol: 'circle'
|
|
619
|
-
},
|
|
620
|
-
cursor: 'pointer',
|
|
621
|
-
point: {
|
|
622
|
-
events: {}
|
|
623
|
-
},
|
|
624
|
-
events: {
|
|
625
|
-
legendItemClick: handleLegendItemClick
|
|
626
|
-
}
|
|
627
|
-
},
|
|
628
|
-
pie: {
|
|
629
|
-
allowPointSelect: true,
|
|
630
|
-
innerSize: `${innerSize}%`
|
|
631
|
-
}
|
|
632
|
-
},
|
|
633
|
-
legend: {
|
|
634
|
-
align: legendAlign,
|
|
635
|
-
verticalAlign: 'top',
|
|
636
|
-
enabled: showLegend
|
|
637
|
-
},
|
|
638
|
-
tooltip: {
|
|
639
|
-
followPointer: false,
|
|
640
|
-
shared: true,
|
|
641
|
-
shadow: false,
|
|
642
|
-
useHTML: true,
|
|
643
|
-
formatter: function () {
|
|
644
|
-
return tooltipFormatter(this, tooltip);
|
|
645
|
-
},
|
|
646
|
-
outside: outside,
|
|
647
|
-
style: {
|
|
648
|
-
zIndex: 2000
|
|
649
|
-
}
|
|
650
|
-
},
|
|
651
|
-
series: series,
|
|
652
|
-
time: {
|
|
653
|
-
useUTC: false,
|
|
654
|
-
getTimezoneOffset: function () {
|
|
655
|
-
return new Date().getTimezoneOffset();
|
|
656
|
-
}
|
|
657
|
-
},
|
|
658
|
-
credits: {
|
|
659
|
-
enabled: false
|
|
660
|
-
}
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
const tooltipFormatter = (_this, props) => {
|
|
664
|
-
const {
|
|
665
|
-
headerVisible = true,
|
|
666
|
-
dateFormat,
|
|
667
|
-
headerTime,
|
|
668
|
-
legendColors = []
|
|
669
|
-
} = props;
|
|
670
|
-
let tooltip = '<div style="font-size: 14px;padding: 12px; min-width: 200px;">';
|
|
671
|
-
if (headerVisible) {
|
|
672
|
-
const xDate = new Date(_this.x);
|
|
673
|
-
const date = formatDate(xDate, dateFormat);
|
|
674
|
-
tooltip += `<div style="display: flex; justify-content: space-between; font-weight: bold; font-size: 12px;">
|
|
675
|
-
<span style="font-size: 12px; color: #333;">${date}</span>`;
|
|
676
|
-
if (headerTime) {
|
|
677
|
-
const time = formatDate(xDate, '%H:%M');
|
|
678
|
-
tooltip += `<span style="font-size: 12px; color: #333;">${time}</span>`;
|
|
679
|
-
}
|
|
680
|
-
tooltip += '</div>';
|
|
681
|
-
}
|
|
682
|
-
_this.points.forEach(point => {
|
|
683
|
-
const type = point.series.options.custom.type;
|
|
684
|
-
const value = type !== 'TO_PERCENT' ? format(point.y, type) : formatToPercent(_this.percentage / 100);
|
|
685
|
-
const name = point.series.name;
|
|
686
|
-
let color = type !== 'TO_PERCENT' ? point.series.color : point.color;
|
|
687
|
-
if (legendColors.length !== 0) {
|
|
688
|
-
color = legendColors[point.series.index];
|
|
689
|
-
}
|
|
690
|
-
tooltip += `<div style="display: flex; flex-direction: column; gap: 8px;">
|
|
691
|
-
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 15px;">
|
|
692
|
-
<span style="width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; background-color: ${color}"></span>
|
|
693
|
-
<span style="flex-grow: 1; font-size: 14px; padding-right: 20px;">${name}</span>
|
|
694
|
-
<span style="font-weight: bold; font-size: 14px;">${value}</span>
|
|
695
|
-
</div>
|
|
696
|
-
</div>`;
|
|
697
|
-
});
|
|
698
|
-
tooltip += '</div>';
|
|
699
|
-
return tooltip;
|
|
700
|
-
};
|
|
701
|
-
function formatDate(data, format) {
|
|
702
|
-
return Highcharts$1.dateFormat(format, data.getTime() - data.getTimezoneOffset() * 60000);
|
|
703
|
-
}
|
|
704
|
-
const ZIndex = {
|
|
705
|
-
AVERAGE_LINE_BASE: 10,
|
|
706
|
-
COMPARE_CHART_BASE: 5,
|
|
707
|
-
NOW_BORDER: 2,
|
|
708
|
-
NOW_BAND: 1
|
|
709
|
-
};
|
|
710
|
-
function stackingType(stacking) {
|
|
711
|
-
return stacking ? stacking.toLowerCase() : '';
|
|
712
|
-
}
|
|
713
|
-
function pieCenters(count) {
|
|
714
|
-
switch (count) {
|
|
715
|
-
case 2:
|
|
716
|
-
return [['25%', '50%'], ['75%', '50%']];
|
|
717
|
-
case 3:
|
|
718
|
-
return [['25%', '25%'], ['75%', '25%'], ['50%', '75%']];
|
|
719
|
-
case 4:
|
|
720
|
-
return [['25%', '25%'], ['75%', '25%'], ['25%', '75%'], ['75%', '75%']];
|
|
721
|
-
default:
|
|
722
|
-
return [];
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
function pieSize(count) {
|
|
726
|
-
switch (count) {
|
|
727
|
-
case 3:
|
|
728
|
-
return '50%';
|
|
729
|
-
case 4:
|
|
730
|
-
return '25%';
|
|
731
|
-
default:
|
|
732
|
-
return null;
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
function TrendChart({
|
|
737
|
-
colorIndex = 0,
|
|
738
|
-
legendColors,
|
|
739
|
-
isDaily,
|
|
740
|
-
isRealtime,
|
|
741
|
-
...props
|
|
742
|
-
}) {
|
|
743
|
-
const colors = React$1.useMemo(() => {
|
|
744
|
-
return all$1[colorIndex % all$1.length];
|
|
745
|
-
}, [colorIndex]);
|
|
746
|
-
const tooltip = React$1.useMemo(() => ({
|
|
747
|
-
dateFormat: isRealtime ? '%H:%M' : '%Y-%m-%d',
|
|
748
|
-
headerTime: !isDaily && !isRealtime,
|
|
749
|
-
outside: props.tooltipOutSide,
|
|
750
|
-
legendColors
|
|
751
|
-
}), [isRealtime, isDaily, props.tooltipOutSide, legendColors]);
|
|
752
|
-
return /*#__PURE__*/React.createElement(Chart, _extends({
|
|
753
|
-
type: "areaspline",
|
|
754
|
-
categorize: true,
|
|
755
|
-
xAxisType: "datetime",
|
|
756
|
-
xAxisLabelFormat: isDaily ? '%m-%d' : '%H:%M',
|
|
757
|
-
colors: colors,
|
|
758
|
-
tooltip: tooltip
|
|
759
|
-
}, props));
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
function StackedAreaTrendChart({
|
|
763
|
-
metrics,
|
|
764
|
-
records,
|
|
765
|
-
isDaily = false,
|
|
766
|
-
xPlotIndex,
|
|
767
|
-
xAxisTickInterval,
|
|
768
|
-
yAxisLabelEnabled = false,
|
|
769
|
-
legendLimit = 3,
|
|
770
|
-
colors = defaultColors,
|
|
771
|
-
...props
|
|
772
|
-
}) {
|
|
773
|
-
const _metrics = React$1.useMemo(() => {
|
|
774
|
-
return metrics.map(m => ({
|
|
775
|
-
metric: m.id,
|
|
776
|
-
chartType: 'area'
|
|
777
|
-
}));
|
|
778
|
-
}, [metrics]);
|
|
779
|
-
const metas = React$1.useMemo(() => {
|
|
780
|
-
const result = {
|
|
781
|
-
time: {
|
|
782
|
-
name: "일시",
|
|
783
|
-
type: "DATE"
|
|
784
|
-
}
|
|
785
|
-
};
|
|
786
|
-
metrics.forEach(m => {
|
|
787
|
-
result[m.id] = {
|
|
788
|
-
name: m.name,
|
|
789
|
-
type: "NUMBER"
|
|
790
|
-
};
|
|
791
|
-
});
|
|
792
|
-
return result;
|
|
793
|
-
}, [metrics]);
|
|
794
|
-
return /*#__PURE__*/React.createElement(TrendChart, _extends({
|
|
795
|
-
dimension: "time",
|
|
796
|
-
stacking: "normal",
|
|
797
|
-
metrics: _metrics,
|
|
798
|
-
metas: metas,
|
|
799
|
-
records: records,
|
|
800
|
-
isRealtime: xPlotIndex !== undefined,
|
|
801
|
-
isDaily: isDaily,
|
|
802
|
-
xPlotIndex: xPlotIndex,
|
|
803
|
-
xAxisTickInterval: xAxisTickInterval,
|
|
804
|
-
yAxisLabelEnabled: yAxisLabelEnabled,
|
|
805
|
-
legendLimit: legendLimit,
|
|
806
|
-
colors: colors
|
|
807
|
-
}, props));
|
|
808
|
-
}
|
|
809
|
-
const defaultColors = [["rgba(54,115,237,0.8)", "#3673ed"], ["rgba(149,77,241,0.8)", "#954df1"], ["#4dc391", "#20b476"], ["#fbba3d", "#faa90c"], ["#f2426d", "#ef1348"]];
|
|
810
|
-
|
|
811
|
-
function ok$1() {}
|
|
812
|
-
|
|
813
|
-
function unreachable() {}
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
* @typedef Options
|
|
817
|
-
* Configuration for `stringify`.
|
|
818
|
-
* @property {boolean} [padLeft=true]
|
|
819
|
-
* Whether to pad a space before a token.
|
|
820
|
-
* @property {boolean} [padRight=false]
|
|
821
|
-
* Whether to pad a space after a token.
|
|
822
|
-
*/
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
/**
|
|
826
|
-
* Serialize an array of strings or numbers to comma-separated tokens.
|
|
827
|
-
*
|
|
828
|
-
* @param {Array<string|number>} values
|
|
829
|
-
* List of tokens.
|
|
830
|
-
* @param {Options} [options]
|
|
831
|
-
* Configuration for `stringify` (optional).
|
|
832
|
-
* @returns {string}
|
|
833
|
-
* Comma-separated tokens.
|
|
834
|
-
*/
|
|
835
|
-
function stringify$1(values, options) {
|
|
836
|
-
const settings = {};
|
|
837
|
-
|
|
838
|
-
// Ensure the last empty entry is seen.
|
|
839
|
-
const input = values[values.length - 1] === '' ? [...values, ''] : values;
|
|
840
|
-
|
|
841
|
-
return input
|
|
842
|
-
.join(
|
|
843
|
-
(settings.padRight ? ' ' : '') +
|
|
844
|
-
',' +
|
|
845
|
-
(settings.padLeft === false ? '' : ' ')
|
|
846
|
-
)
|
|
847
|
-
.trim()
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
/**
|
|
851
|
-
* @typedef Options
|
|
852
|
-
* Configuration.
|
|
853
|
-
* @property {boolean | null | undefined} [jsx=false]
|
|
854
|
-
* Support JSX identifiers (default: `false`).
|
|
855
|
-
*/
|
|
856
|
-
|
|
857
|
-
const nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
858
|
-
const nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
859
|
-
|
|
860
|
-
/** @type {Options} */
|
|
861
|
-
const emptyOptions$2 = {};
|
|
862
|
-
|
|
863
|
-
/**
|
|
864
|
-
* Checks if the given value is a valid identifier name.
|
|
865
|
-
*
|
|
866
|
-
* @param {string} name
|
|
867
|
-
* Identifier to check.
|
|
868
|
-
* @param {Options | null | undefined} [options]
|
|
869
|
-
* Configuration (optional).
|
|
870
|
-
* @returns {boolean}
|
|
871
|
-
* Whether `name` can be an identifier.
|
|
872
|
-
*/
|
|
873
|
-
function name(name, options) {
|
|
874
|
-
const settings = emptyOptions$2;
|
|
875
|
-
const re = settings.jsx ? nameReJsx : nameRe;
|
|
876
|
-
return re.test(name)
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
/**
|
|
880
|
-
* @typedef {import('hast').Nodes} Nodes
|
|
881
|
-
*/
|
|
882
|
-
|
|
883
|
-
// HTML whitespace expression.
|
|
884
|
-
// See <https://infra.spec.whatwg.org/#ascii-whitespace>.
|
|
885
|
-
const re = /[ \t\n\f\r]/g;
|
|
886
|
-
|
|
887
|
-
/**
|
|
888
|
-
* Check if the given value is *inter-element whitespace*.
|
|
889
|
-
*
|
|
890
|
-
* @param {Nodes | string} thing
|
|
891
|
-
* Thing to check (`Node` or `string`).
|
|
892
|
-
* @returns {boolean}
|
|
893
|
-
* Whether the `value` is inter-element whitespace (`boolean`): consisting of
|
|
894
|
-
* zero or more of space, tab (`\t`), line feed (`\n`), carriage return
|
|
895
|
-
* (`\r`), or form feed (`\f`); if a node is passed it must be a `Text` node,
|
|
896
|
-
* whose `value` field is checked.
|
|
897
|
-
*/
|
|
898
|
-
function whitespace(thing) {
|
|
899
|
-
return typeof thing === 'object'
|
|
900
|
-
? thing.type === 'text'
|
|
901
|
-
? empty$1(thing.value)
|
|
902
|
-
: false
|
|
903
|
-
: empty$1(thing)
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
/**
|
|
907
|
-
* @param {string} value
|
|
908
|
-
* @returns {boolean}
|
|
909
|
-
*/
|
|
910
|
-
function empty$1(value) {
|
|
911
|
-
return value.replace(re, '') === ''
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
/**
|
|
915
|
-
* @import {Schema as SchemaType, Space} from 'property-information'
|
|
916
|
-
*/
|
|
917
|
-
|
|
918
|
-
/** @type {SchemaType} */
|
|
919
|
-
class Schema {
|
|
920
|
-
/**
|
|
921
|
-
* @param {SchemaType['property']} property
|
|
922
|
-
* Property.
|
|
923
|
-
* @param {SchemaType['normal']} normal
|
|
924
|
-
* Normal.
|
|
925
|
-
* @param {Space | undefined} [space]
|
|
926
|
-
* Space.
|
|
927
|
-
* @returns
|
|
928
|
-
* Schema.
|
|
929
|
-
*/
|
|
930
|
-
constructor(property, normal, space) {
|
|
931
|
-
this.normal = normal;
|
|
932
|
-
this.property = property;
|
|
933
|
-
|
|
934
|
-
if (space) {
|
|
935
|
-
this.space = space;
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
Schema.prototype.normal = {};
|
|
941
|
-
Schema.prototype.property = {};
|
|
942
|
-
Schema.prototype.space = undefined;
|
|
943
|
-
|
|
944
|
-
/**
|
|
945
|
-
* @import {Info, Space} from 'property-information'
|
|
946
|
-
*/
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
/**
|
|
950
|
-
* @param {ReadonlyArray<Schema>} definitions
|
|
951
|
-
* Definitions.
|
|
952
|
-
* @param {Space | undefined} [space]
|
|
953
|
-
* Space.
|
|
954
|
-
* @returns {Schema}
|
|
955
|
-
* Schema.
|
|
956
|
-
*/
|
|
957
|
-
function merge(definitions, space) {
|
|
958
|
-
/** @type {Record<string, Info>} */
|
|
959
|
-
const property = {};
|
|
960
|
-
/** @type {Record<string, string>} */
|
|
961
|
-
const normal = {};
|
|
962
|
-
|
|
963
|
-
for (const definition of definitions) {
|
|
964
|
-
Object.assign(property, definition.property);
|
|
965
|
-
Object.assign(normal, definition.normal);
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
return new Schema(property, normal, space)
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
/**
|
|
972
|
-
* Get the cleaned case insensitive form of an attribute or property.
|
|
973
|
-
*
|
|
974
|
-
* @param {string} value
|
|
975
|
-
* An attribute-like or property-like name.
|
|
976
|
-
* @returns {string}
|
|
977
|
-
* Value that can be used to look up the properly cased property on a
|
|
978
|
-
* `Schema`.
|
|
979
|
-
*/
|
|
980
|
-
function normalize$1(value) {
|
|
981
|
-
return value.toLowerCase()
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
/**
|
|
985
|
-
* @import {Info as InfoType} from 'property-information'
|
|
986
|
-
*/
|
|
987
|
-
|
|
988
|
-
/** @type {InfoType} */
|
|
989
|
-
class Info {
|
|
990
|
-
/**
|
|
991
|
-
* @param {string} property
|
|
992
|
-
* Property.
|
|
993
|
-
* @param {string} attribute
|
|
994
|
-
* Attribute.
|
|
995
|
-
* @returns
|
|
996
|
-
* Info.
|
|
997
|
-
*/
|
|
998
|
-
constructor(property, attribute) {
|
|
999
|
-
this.attribute = attribute;
|
|
1000
|
-
this.property = property;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @import {Info as InfoType} from 'property-information'
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
/** @type {InfoType} */
|
|
204
|
+
class Info {
|
|
205
|
+
/**
|
|
206
|
+
* @param {string} property
|
|
207
|
+
* Property.
|
|
208
|
+
* @param {string} attribute
|
|
209
|
+
* Attribute.
|
|
210
|
+
* @returns
|
|
211
|
+
* Info.
|
|
212
|
+
*/
|
|
213
|
+
constructor(property, attribute) {
|
|
214
|
+
this.attribute = attribute;
|
|
215
|
+
this.property = property;
|
|
1001
216
|
}
|
|
1002
217
|
}
|
|
1003
218
|
|
|
@@ -1029,14 +244,14 @@ function increment() {
|
|
|
1029
244
|
}
|
|
1030
245
|
|
|
1031
246
|
var types = /*#__PURE__*/Object.freeze({
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
247
|
+
__proto__: null,
|
|
248
|
+
boolean: boolean,
|
|
249
|
+
booleanish: booleanish,
|
|
250
|
+
commaOrSpaceSeparated: commaOrSpaceSeparated,
|
|
251
|
+
commaSeparated: commaSeparated,
|
|
252
|
+
number: number,
|
|
253
|
+
overloadedBoolean: overloadedBoolean,
|
|
254
|
+
spaceSeparated: spaceSeparated
|
|
1040
255
|
});
|
|
1041
256
|
|
|
1042
257
|
/**
|
|
@@ -2276,6 +1491,10 @@ function stringify(values) {
|
|
|
2276
1491
|
return values.join(' ').trim()
|
|
2277
1492
|
}
|
|
2278
1493
|
|
|
1494
|
+
function getDefaultExportFromCjs (x) {
|
|
1495
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
2279
1498
|
var cjs$2 = {};
|
|
2280
1499
|
|
|
2281
1500
|
var cjs$1;
|
|
@@ -4040,12 +3259,12 @@ function one(value, includeImageAlt, includeHtml) {
|
|
|
4040
3259
|
}
|
|
4041
3260
|
|
|
4042
3261
|
if ('children' in value) {
|
|
4043
|
-
return all(value.children, includeImageAlt, includeHtml)
|
|
3262
|
+
return all$1(value.children, includeImageAlt, includeHtml)
|
|
4044
3263
|
}
|
|
4045
3264
|
}
|
|
4046
3265
|
|
|
4047
3266
|
if (Array.isArray(value)) {
|
|
4048
|
-
return all(value, includeImageAlt, includeHtml)
|
|
3267
|
+
return all$1(value, includeImageAlt, includeHtml)
|
|
4049
3268
|
}
|
|
4050
3269
|
|
|
4051
3270
|
return ''
|
|
@@ -4063,7 +3282,7 @@ function one(value, includeImageAlt, includeHtml) {
|
|
|
4063
3282
|
* @returns {string}
|
|
4064
3283
|
* Serialized nodes.
|
|
4065
3284
|
*/
|
|
4066
|
-
function all(values, includeImageAlt, includeHtml) {
|
|
3285
|
+
function all$1(values, includeImageAlt, includeHtml) {
|
|
4067
3286
|
/** @type {Array<string>} */
|
|
4068
3287
|
const result = [];
|
|
4069
3288
|
let index = -1;
|
|
@@ -14015,16 +13234,16 @@ const disable = {
|
|
|
14015
13234
|
};
|
|
14016
13235
|
|
|
14017
13236
|
var defaultConstructs = /*#__PURE__*/Object.freeze({
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
13237
|
+
__proto__: null,
|
|
13238
|
+
attentionMarkers: attentionMarkers,
|
|
13239
|
+
contentInitial: contentInitial,
|
|
13240
|
+
disable: disable,
|
|
13241
|
+
document: document$1,
|
|
13242
|
+
flow: flow,
|
|
13243
|
+
flowInitial: flowInitial,
|
|
13244
|
+
insideSpan: insideSpan,
|
|
13245
|
+
string: string,
|
|
13246
|
+
text: text$1
|
|
14028
13247
|
});
|
|
14029
13248
|
|
|
14030
13249
|
/**
|
|
@@ -20727,985 +19946,1623 @@ class Processor extends CallableInstance {
|
|
|
20727
19946
|
assertNode(tree);
|
|
20728
19947
|
this.freeze();
|
|
20729
19948
|
|
|
20730
|
-
const transformers = this.transformers;
|
|
19949
|
+
const transformers = this.transformers;
|
|
19950
|
+
|
|
19951
|
+
if (!done && typeof file === 'function') {
|
|
19952
|
+
done = file;
|
|
19953
|
+
file = undefined;
|
|
19954
|
+
}
|
|
19955
|
+
|
|
19956
|
+
return done ? executor(undefined, done) : new Promise(executor)
|
|
19957
|
+
|
|
19958
|
+
// Note: `void`s needed for TS.
|
|
19959
|
+
/**
|
|
19960
|
+
* @param {(
|
|
19961
|
+
* ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |
|
|
19962
|
+
* undefined
|
|
19963
|
+
* )} resolve
|
|
19964
|
+
* @param {(error: Error) => undefined | void} reject
|
|
19965
|
+
* @returns {undefined}
|
|
19966
|
+
*/
|
|
19967
|
+
function executor(resolve, reject) {
|
|
19968
|
+
const realFile = vfile(file);
|
|
19969
|
+
transformers.run(tree, realFile, realDone);
|
|
19970
|
+
|
|
19971
|
+
/**
|
|
19972
|
+
* @param {Error | undefined} error
|
|
19973
|
+
* @param {Node} outputTree
|
|
19974
|
+
* @param {VFile} file
|
|
19975
|
+
* @returns {undefined}
|
|
19976
|
+
*/
|
|
19977
|
+
function realDone(error, outputTree, file) {
|
|
19978
|
+
const resultingTree =
|
|
19979
|
+
/** @type {TailTree extends undefined ? Node : TailTree} */ (
|
|
19980
|
+
outputTree || tree
|
|
19981
|
+
);
|
|
19982
|
+
|
|
19983
|
+
if (error) {
|
|
19984
|
+
reject(error);
|
|
19985
|
+
} else if (resolve) {
|
|
19986
|
+
resolve(resultingTree);
|
|
19987
|
+
} else {
|
|
19988
|
+
done(undefined, resultingTree, file);
|
|
19989
|
+
}
|
|
19990
|
+
}
|
|
19991
|
+
}
|
|
19992
|
+
}
|
|
19993
|
+
|
|
19994
|
+
/**
|
|
19995
|
+
* Run *transformers* on a syntax tree.
|
|
19996
|
+
*
|
|
19997
|
+
* An error is thrown if asynchronous transforms are configured.
|
|
19998
|
+
*
|
|
19999
|
+
* > **Note**: `runSync` freezes the processor if not already *frozen*.
|
|
20000
|
+
*
|
|
20001
|
+
* > **Note**: `runSync` performs the run phase, not other phases.
|
|
20002
|
+
*
|
|
20003
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
20004
|
+
* Tree to transform and inspect.
|
|
20005
|
+
* @param {Compatible | undefined} [file]
|
|
20006
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
20007
|
+
* `new VFile(x)`.
|
|
20008
|
+
* @returns {TailTree extends undefined ? Node : TailTree}
|
|
20009
|
+
* Transformed tree.
|
|
20010
|
+
*/
|
|
20011
|
+
runSync(tree, file) {
|
|
20012
|
+
/** @type {boolean} */
|
|
20013
|
+
let complete = false;
|
|
20014
|
+
/** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */
|
|
20015
|
+
let result;
|
|
20016
|
+
|
|
20017
|
+
this.run(tree, file, realDone);
|
|
20018
|
+
|
|
20019
|
+
assertDone('runSync', 'run', complete);
|
|
20020
|
+
return result
|
|
20021
|
+
|
|
20022
|
+
/**
|
|
20023
|
+
* @type {RunCallback<TailTree extends undefined ? Node : TailTree>}
|
|
20024
|
+
*/
|
|
20025
|
+
function realDone(error, tree) {
|
|
20026
|
+
bail(error);
|
|
20027
|
+
result = tree;
|
|
20028
|
+
complete = true;
|
|
20029
|
+
}
|
|
20030
|
+
}
|
|
20031
|
+
|
|
20032
|
+
/**
|
|
20033
|
+
* Compile a syntax tree.
|
|
20034
|
+
*
|
|
20035
|
+
* > **Note**: `stringify` freezes the processor if not already *frozen*.
|
|
20036
|
+
*
|
|
20037
|
+
* > **Note**: `stringify` performs the stringify phase, not the run phase
|
|
20038
|
+
* > or other phases.
|
|
20039
|
+
*
|
|
20040
|
+
* @param {CompileTree extends undefined ? Node : CompileTree} tree
|
|
20041
|
+
* Tree to compile.
|
|
20042
|
+
* @param {Compatible | undefined} [file]
|
|
20043
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
20044
|
+
* `new VFile(x)`.
|
|
20045
|
+
* @returns {CompileResult extends undefined ? Value : CompileResult}
|
|
20046
|
+
* Textual representation of the tree (see note).
|
|
20047
|
+
*
|
|
20048
|
+
* > **Note**: unified typically compiles by serializing: most compilers
|
|
20049
|
+
* > return `string` (or `Uint8Array`).
|
|
20050
|
+
* > Some compilers, such as the one configured with
|
|
20051
|
+
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
20052
|
+
* > React tree).
|
|
20053
|
+
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
20054
|
+
* > result values.
|
|
20055
|
+
* >
|
|
20056
|
+
* > To register custom results in TypeScript, add them to
|
|
20057
|
+
* > {@linkcode CompileResultMap}.
|
|
20058
|
+
*
|
|
20059
|
+
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
20060
|
+
*/
|
|
20061
|
+
stringify(tree, file) {
|
|
20062
|
+
this.freeze();
|
|
20063
|
+
const realFile = vfile(file);
|
|
20064
|
+
const compiler = this.compiler || this.Compiler;
|
|
20065
|
+
assertCompiler('stringify', compiler);
|
|
20066
|
+
assertNode(tree);
|
|
20067
|
+
|
|
20068
|
+
return compiler(tree, realFile)
|
|
20069
|
+
}
|
|
20070
|
+
|
|
20071
|
+
/**
|
|
20072
|
+
* Configure the processor to use a plugin, a list of usable values, or a
|
|
20073
|
+
* preset.
|
|
20074
|
+
*
|
|
20075
|
+
* If the processor is already using a plugin, the previous plugin
|
|
20076
|
+
* configuration is changed based on the options that are passed in.
|
|
20077
|
+
* In other words, the plugin is not added a second time.
|
|
20078
|
+
*
|
|
20079
|
+
* > **Note**: `use` cannot be called on *frozen* processors.
|
|
20080
|
+
* > Call the processor first to create a new unfrozen processor.
|
|
20081
|
+
*
|
|
20082
|
+
* @example
|
|
20083
|
+
* There are many ways to pass plugins to `.use()`.
|
|
20084
|
+
* This example gives an overview:
|
|
20085
|
+
*
|
|
20086
|
+
* ```js
|
|
20087
|
+
* import {unified} from 'unified'
|
|
20088
|
+
*
|
|
20089
|
+
* unified()
|
|
20090
|
+
* // Plugin with options:
|
|
20091
|
+
* .use(pluginA, {x: true, y: true})
|
|
20092
|
+
* // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
|
|
20093
|
+
* .use(pluginA, {y: false, z: true})
|
|
20094
|
+
* // Plugins:
|
|
20095
|
+
* .use([pluginB, pluginC])
|
|
20096
|
+
* // Two plugins, the second with options:
|
|
20097
|
+
* .use([pluginD, [pluginE, {}]])
|
|
20098
|
+
* // Preset with plugins and settings:
|
|
20099
|
+
* .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
|
|
20100
|
+
* // Settings only:
|
|
20101
|
+
* .use({settings: {position: false}})
|
|
20102
|
+
* ```
|
|
20103
|
+
*
|
|
20104
|
+
* @template {Array<unknown>} [Parameters=[]]
|
|
20105
|
+
* @template {Node | string | undefined} [Input=undefined]
|
|
20106
|
+
* @template [Output=Input]
|
|
20107
|
+
*
|
|
20108
|
+
* @overload
|
|
20109
|
+
* @param {Preset | null | undefined} [preset]
|
|
20110
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20111
|
+
*
|
|
20112
|
+
* @overload
|
|
20113
|
+
* @param {PluggableList} list
|
|
20114
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20115
|
+
*
|
|
20116
|
+
* @overload
|
|
20117
|
+
* @param {Plugin<Parameters, Input, Output>} plugin
|
|
20118
|
+
* @param {...(Parameters | [boolean])} parameters
|
|
20119
|
+
* @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
|
|
20120
|
+
*
|
|
20121
|
+
* @param {PluggableList | Plugin | Preset | null | undefined} value
|
|
20122
|
+
* Usable value.
|
|
20123
|
+
* @param {...unknown} parameters
|
|
20124
|
+
* Parameters, when a plugin is given as a usable value.
|
|
20125
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20126
|
+
* Current processor.
|
|
20127
|
+
*/
|
|
20128
|
+
use(value, ...parameters) {
|
|
20129
|
+
const attachers = this.attachers;
|
|
20130
|
+
const namespace = this.namespace;
|
|
20131
|
+
|
|
20132
|
+
assertUnfrozen('use', this.frozen);
|
|
20133
|
+
|
|
20134
|
+
if (value === null || value === undefined) ; else if (typeof value === 'function') {
|
|
20135
|
+
addPlugin(value, parameters);
|
|
20136
|
+
} else if (typeof value === 'object') {
|
|
20137
|
+
if (Array.isArray(value)) {
|
|
20138
|
+
addList(value);
|
|
20139
|
+
} else {
|
|
20140
|
+
addPreset(value);
|
|
20141
|
+
}
|
|
20142
|
+
} else {
|
|
20143
|
+
throw new TypeError('Expected usable value, not `' + value + '`')
|
|
20144
|
+
}
|
|
20145
|
+
|
|
20146
|
+
return this
|
|
20147
|
+
|
|
20148
|
+
/**
|
|
20149
|
+
* @param {Pluggable} value
|
|
20150
|
+
* @returns {undefined}
|
|
20151
|
+
*/
|
|
20152
|
+
function add(value) {
|
|
20153
|
+
if (typeof value === 'function') {
|
|
20154
|
+
addPlugin(value, []);
|
|
20155
|
+
} else if (typeof value === 'object') {
|
|
20156
|
+
if (Array.isArray(value)) {
|
|
20157
|
+
const [plugin, ...parameters] =
|
|
20158
|
+
/** @type {PluginTuple<Array<unknown>>} */ (value);
|
|
20159
|
+
addPlugin(plugin, parameters);
|
|
20160
|
+
} else {
|
|
20161
|
+
addPreset(value);
|
|
20162
|
+
}
|
|
20163
|
+
} else {
|
|
20164
|
+
throw new TypeError('Expected usable value, not `' + value + '`')
|
|
20165
|
+
}
|
|
20166
|
+
}
|
|
20167
|
+
|
|
20168
|
+
/**
|
|
20169
|
+
* @param {Preset} result
|
|
20170
|
+
* @returns {undefined}
|
|
20171
|
+
*/
|
|
20172
|
+
function addPreset(result) {
|
|
20173
|
+
if (!('plugins' in result) && !('settings' in result)) {
|
|
20174
|
+
throw new Error(
|
|
20175
|
+
'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'
|
|
20176
|
+
)
|
|
20177
|
+
}
|
|
20178
|
+
|
|
20179
|
+
addList(result.plugins);
|
|
20180
|
+
|
|
20181
|
+
if (result.settings) {
|
|
20182
|
+
namespace.settings = extend(true, namespace.settings, result.settings);
|
|
20183
|
+
}
|
|
20184
|
+
}
|
|
20185
|
+
|
|
20186
|
+
/**
|
|
20187
|
+
* @param {PluggableList | null | undefined} plugins
|
|
20188
|
+
* @returns {undefined}
|
|
20189
|
+
*/
|
|
20190
|
+
function addList(plugins) {
|
|
20191
|
+
let index = -1;
|
|
20731
20192
|
|
|
20732
|
-
|
|
20733
|
-
|
|
20734
|
-
|
|
20193
|
+
if (plugins === null || plugins === undefined) ; else if (Array.isArray(plugins)) {
|
|
20194
|
+
while (++index < plugins.length) {
|
|
20195
|
+
const thing = plugins[index];
|
|
20196
|
+
add(thing);
|
|
20197
|
+
}
|
|
20198
|
+
} else {
|
|
20199
|
+
throw new TypeError('Expected a list of plugins, not `' + plugins + '`')
|
|
20200
|
+
}
|
|
20735
20201
|
}
|
|
20736
20202
|
|
|
20737
|
-
return done ? executor(undefined, done) : new Promise(executor)
|
|
20738
|
-
|
|
20739
|
-
// Note: `void`s needed for TS.
|
|
20740
20203
|
/**
|
|
20741
|
-
* @param {
|
|
20742
|
-
*
|
|
20743
|
-
* undefined
|
|
20744
|
-
* )} resolve
|
|
20745
|
-
* @param {(error: Error) => undefined | void} reject
|
|
20204
|
+
* @param {Plugin} plugin
|
|
20205
|
+
* @param {Array<unknown>} parameters
|
|
20746
20206
|
* @returns {undefined}
|
|
20747
20207
|
*/
|
|
20748
|
-
function
|
|
20749
|
-
|
|
20750
|
-
|
|
20208
|
+
function addPlugin(plugin, parameters) {
|
|
20209
|
+
let index = -1;
|
|
20210
|
+
let entryIndex = -1;
|
|
20751
20211
|
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20757
|
-
|
|
20758
|
-
function realDone(error, outputTree, file) {
|
|
20759
|
-
const resultingTree =
|
|
20760
|
-
/** @type {TailTree extends undefined ? Node : TailTree} */ (
|
|
20761
|
-
outputTree || tree
|
|
20762
|
-
);
|
|
20212
|
+
while (++index < attachers.length) {
|
|
20213
|
+
if (attachers[index][0] === plugin) {
|
|
20214
|
+
entryIndex = index;
|
|
20215
|
+
break
|
|
20216
|
+
}
|
|
20217
|
+
}
|
|
20763
20218
|
|
|
20764
|
-
|
|
20765
|
-
|
|
20766
|
-
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
|
|
20219
|
+
if (entryIndex === -1) {
|
|
20220
|
+
attachers.push([plugin, ...parameters]);
|
|
20221
|
+
}
|
|
20222
|
+
// Only set if there was at least a `primary` value, otherwise we’d change
|
|
20223
|
+
// `arguments.length`.
|
|
20224
|
+
else if (parameters.length > 0) {
|
|
20225
|
+
let [primary, ...rest] = parameters;
|
|
20226
|
+
const currentPrimary = attachers[entryIndex][1];
|
|
20227
|
+
if (isPlainObject(currentPrimary) && isPlainObject(primary)) {
|
|
20228
|
+
primary = extend(true, currentPrimary, primary);
|
|
20770
20229
|
}
|
|
20230
|
+
|
|
20231
|
+
attachers[entryIndex] = [plugin, primary, ...rest];
|
|
20771
20232
|
}
|
|
20772
20233
|
}
|
|
20773
20234
|
}
|
|
20235
|
+
}
|
|
20774
20236
|
|
|
20775
|
-
|
|
20776
|
-
|
|
20777
|
-
|
|
20778
|
-
|
|
20779
|
-
|
|
20780
|
-
|
|
20781
|
-
|
|
20782
|
-
|
|
20783
|
-
|
|
20784
|
-
|
|
20785
|
-
|
|
20786
|
-
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
20795
|
-
|
|
20796
|
-
|
|
20237
|
+
// Note: this returns a *callable* instance.
|
|
20238
|
+
// That’s why it’s documented as a function.
|
|
20239
|
+
/**
|
|
20240
|
+
* Create a new processor.
|
|
20241
|
+
*
|
|
20242
|
+
* @example
|
|
20243
|
+
* This example shows how a new processor can be created (from `remark`) and linked
|
|
20244
|
+
* to **stdin**(4) and **stdout**(4).
|
|
20245
|
+
*
|
|
20246
|
+
* ```js
|
|
20247
|
+
* import process from 'node:process'
|
|
20248
|
+
* import concatStream from 'concat-stream'
|
|
20249
|
+
* import {remark} from 'remark'
|
|
20250
|
+
*
|
|
20251
|
+
* process.stdin.pipe(
|
|
20252
|
+
* concatStream(function (buf) {
|
|
20253
|
+
* process.stdout.write(String(remark().processSync(buf)))
|
|
20254
|
+
* })
|
|
20255
|
+
* )
|
|
20256
|
+
* ```
|
|
20257
|
+
*
|
|
20258
|
+
* @returns
|
|
20259
|
+
* New *unfrozen* processor (`processor`).
|
|
20260
|
+
*
|
|
20261
|
+
* This processor is configured to work the same as its ancestor.
|
|
20262
|
+
* When the descendant processor is configured in the future it does not
|
|
20263
|
+
* affect the ancestral processor.
|
|
20264
|
+
*/
|
|
20265
|
+
const unified = new Processor().freeze();
|
|
20266
|
+
|
|
20267
|
+
/**
|
|
20268
|
+
* Assert a parser is available.
|
|
20269
|
+
*
|
|
20270
|
+
* @param {string} name
|
|
20271
|
+
* @param {unknown} value
|
|
20272
|
+
* @returns {asserts value is Parser}
|
|
20273
|
+
*/
|
|
20274
|
+
function assertParser(name, value) {
|
|
20275
|
+
if (typeof value !== 'function') {
|
|
20276
|
+
throw new TypeError('Cannot `' + name + '` without `parser`')
|
|
20277
|
+
}
|
|
20278
|
+
}
|
|
20279
|
+
|
|
20280
|
+
/**
|
|
20281
|
+
* Assert a compiler is available.
|
|
20282
|
+
*
|
|
20283
|
+
* @param {string} name
|
|
20284
|
+
* @param {unknown} value
|
|
20285
|
+
* @returns {asserts value is Compiler}
|
|
20286
|
+
*/
|
|
20287
|
+
function assertCompiler(name, value) {
|
|
20288
|
+
if (typeof value !== 'function') {
|
|
20289
|
+
throw new TypeError('Cannot `' + name + '` without `compiler`')
|
|
20290
|
+
}
|
|
20291
|
+
}
|
|
20292
|
+
|
|
20293
|
+
/**
|
|
20294
|
+
* Assert the processor is not frozen.
|
|
20295
|
+
*
|
|
20296
|
+
* @param {string} name
|
|
20297
|
+
* @param {unknown} frozen
|
|
20298
|
+
* @returns {asserts frozen is false}
|
|
20299
|
+
*/
|
|
20300
|
+
function assertUnfrozen(name, frozen) {
|
|
20301
|
+
if (frozen) {
|
|
20302
|
+
throw new Error(
|
|
20303
|
+
'Cannot call `' +
|
|
20304
|
+
name +
|
|
20305
|
+
'` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'
|
|
20306
|
+
)
|
|
20307
|
+
}
|
|
20308
|
+
}
|
|
20309
|
+
|
|
20310
|
+
/**
|
|
20311
|
+
* Assert `node` is a unist node.
|
|
20312
|
+
*
|
|
20313
|
+
* @param {unknown} node
|
|
20314
|
+
* @returns {asserts node is Node}
|
|
20315
|
+
*/
|
|
20316
|
+
function assertNode(node) {
|
|
20317
|
+
// `isPlainObj` unfortunately uses `any` instead of `unknown`.
|
|
20318
|
+
// type-coverage:ignore-next-line
|
|
20319
|
+
if (!isPlainObject(node) || typeof node.type !== 'string') {
|
|
20320
|
+
throw new TypeError('Expected node, got `' + node + '`')
|
|
20321
|
+
// Fine.
|
|
20322
|
+
}
|
|
20323
|
+
}
|
|
20324
|
+
|
|
20325
|
+
/**
|
|
20326
|
+
* Assert that `complete` is `true`.
|
|
20327
|
+
*
|
|
20328
|
+
* @param {string} name
|
|
20329
|
+
* @param {string} asyncName
|
|
20330
|
+
* @param {unknown} complete
|
|
20331
|
+
* @returns {asserts complete is true}
|
|
20332
|
+
*/
|
|
20333
|
+
function assertDone(name, asyncName, complete) {
|
|
20334
|
+
if (!complete) {
|
|
20335
|
+
throw new Error(
|
|
20336
|
+
'`' + name + '` finished async. Use `' + asyncName + '` instead'
|
|
20337
|
+
)
|
|
20338
|
+
}
|
|
20339
|
+
}
|
|
20340
|
+
|
|
20341
|
+
/**
|
|
20342
|
+
* @param {Compatible | undefined} [value]
|
|
20343
|
+
* @returns {VFile}
|
|
20344
|
+
*/
|
|
20345
|
+
function vfile(value) {
|
|
20346
|
+
return looksLikeAVFile(value) ? value : new VFile(value)
|
|
20347
|
+
}
|
|
20348
|
+
|
|
20349
|
+
/**
|
|
20350
|
+
* @param {Compatible | undefined} [value]
|
|
20351
|
+
* @returns {value is VFile}
|
|
20352
|
+
*/
|
|
20353
|
+
function looksLikeAVFile(value) {
|
|
20354
|
+
return Boolean(
|
|
20355
|
+
value &&
|
|
20356
|
+
typeof value === 'object' &&
|
|
20357
|
+
'message' in value &&
|
|
20358
|
+
'messages' in value
|
|
20359
|
+
)
|
|
20360
|
+
}
|
|
20361
|
+
|
|
20362
|
+
/**
|
|
20363
|
+
* @param {unknown} [value]
|
|
20364
|
+
* @returns {value is Value}
|
|
20365
|
+
*/
|
|
20366
|
+
function looksLikeAValue(value) {
|
|
20367
|
+
return typeof value === 'string' || isUint8Array(value)
|
|
20368
|
+
}
|
|
20369
|
+
|
|
20370
|
+
/**
|
|
20371
|
+
* Assert `value` is an `Uint8Array`.
|
|
20372
|
+
*
|
|
20373
|
+
* @param {unknown} value
|
|
20374
|
+
* thing.
|
|
20375
|
+
* @returns {value is Uint8Array}
|
|
20376
|
+
* Whether `value` is an `Uint8Array`.
|
|
20377
|
+
*/
|
|
20378
|
+
function isUint8Array(value) {
|
|
20379
|
+
return Boolean(
|
|
20380
|
+
value &&
|
|
20381
|
+
typeof value === 'object' &&
|
|
20382
|
+
'byteLength' in value &&
|
|
20383
|
+
'byteOffset' in value
|
|
20384
|
+
)
|
|
20385
|
+
}
|
|
20386
|
+
|
|
20387
|
+
/**
|
|
20388
|
+
* @import {Element, Nodes, Parents, Root} from 'hast'
|
|
20389
|
+
* @import {Root as MdastRoot} from 'mdast'
|
|
20390
|
+
* @import {ComponentType, JSX, ReactElement, ReactNode} from 'react'
|
|
20391
|
+
* @import {Options as RemarkRehypeOptions} from 'remark-rehype'
|
|
20392
|
+
* @import {BuildVisitor} from 'unist-util-visit'
|
|
20393
|
+
* @import {PluggableList, Processor} from 'unified'
|
|
20394
|
+
*/
|
|
20395
|
+
|
|
20396
|
+
|
|
20397
|
+
const changelog =
|
|
20398
|
+
'https://github.com/remarkjs/react-markdown/blob/main/changelog.md';
|
|
20797
20399
|
|
|
20798
|
-
|
|
20400
|
+
/** @type {PluggableList} */
|
|
20401
|
+
const emptyPlugins = [];
|
|
20402
|
+
/** @type {Readonly<RemarkRehypeOptions>} */
|
|
20403
|
+
const emptyRemarkRehypeOptions = {allowDangerousHtml: true};
|
|
20404
|
+
const safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;
|
|
20799
20405
|
|
|
20800
|
-
|
|
20801
|
-
|
|
20406
|
+
// Mutable because we `delete` any time it’s used and a message is sent.
|
|
20407
|
+
/** @type {ReadonlyArray<Readonly<Deprecation>>} */
|
|
20408
|
+
const deprecations = [
|
|
20409
|
+
{from: 'astPlugins', id: 'remove-buggy-html-in-markdown-parser'},
|
|
20410
|
+
{from: 'allowDangerousHtml', id: 'remove-buggy-html-in-markdown-parser'},
|
|
20411
|
+
{
|
|
20412
|
+
from: 'allowNode',
|
|
20413
|
+
id: 'replace-allownode-allowedtypes-and-disallowedtypes',
|
|
20414
|
+
to: 'allowElement'
|
|
20415
|
+
},
|
|
20416
|
+
{
|
|
20417
|
+
from: 'allowedTypes',
|
|
20418
|
+
id: 'replace-allownode-allowedtypes-and-disallowedtypes',
|
|
20419
|
+
to: 'allowedElements'
|
|
20420
|
+
},
|
|
20421
|
+
{from: 'className', id: 'remove-classname'},
|
|
20422
|
+
{
|
|
20423
|
+
from: 'disallowedTypes',
|
|
20424
|
+
id: 'replace-allownode-allowedtypes-and-disallowedtypes',
|
|
20425
|
+
to: 'disallowedElements'
|
|
20426
|
+
},
|
|
20427
|
+
{from: 'escapeHtml', id: 'remove-buggy-html-in-markdown-parser'},
|
|
20428
|
+
{from: 'includeElementIndex', id: '#remove-includeelementindex'},
|
|
20429
|
+
{
|
|
20430
|
+
from: 'includeNodeIndex',
|
|
20431
|
+
id: 'change-includenodeindex-to-includeelementindex'
|
|
20432
|
+
},
|
|
20433
|
+
{from: 'linkTarget', id: 'remove-linktarget'},
|
|
20434
|
+
{from: 'plugins', id: 'change-plugins-to-remarkplugins', to: 'remarkPlugins'},
|
|
20435
|
+
{from: 'rawSourcePos', id: '#remove-rawsourcepos'},
|
|
20436
|
+
{from: 'renderers', id: 'change-renderers-to-components', to: 'components'},
|
|
20437
|
+
{from: 'source', id: 'change-source-to-children', to: 'children'},
|
|
20438
|
+
{from: 'sourcePos', id: '#remove-sourcepos'},
|
|
20439
|
+
{from: 'transformImageUri', id: '#add-urltransform', to: 'urlTransform'},
|
|
20440
|
+
{from: 'transformLinkUri', id: '#add-urltransform', to: 'urlTransform'}
|
|
20441
|
+
];
|
|
20802
20442
|
|
|
20803
|
-
|
|
20804
|
-
|
|
20805
|
-
|
|
20806
|
-
|
|
20807
|
-
|
|
20808
|
-
|
|
20809
|
-
|
|
20810
|
-
|
|
20811
|
-
|
|
20443
|
+
/**
|
|
20444
|
+
* Component to render markdown.
|
|
20445
|
+
*
|
|
20446
|
+
* This is a synchronous component.
|
|
20447
|
+
* When using async plugins,
|
|
20448
|
+
* see {@linkcode MarkdownAsync} or {@linkcode MarkdownHooks}.
|
|
20449
|
+
*
|
|
20450
|
+
* @param {Readonly<Options>} options
|
|
20451
|
+
* Props.
|
|
20452
|
+
* @returns {ReactElement}
|
|
20453
|
+
* React element.
|
|
20454
|
+
*/
|
|
20455
|
+
function Markdown(options) {
|
|
20456
|
+
const processor = createProcessor(options);
|
|
20457
|
+
const file = createFile(options);
|
|
20458
|
+
return post(processor.runSync(processor.parse(file), file), options)
|
|
20459
|
+
}
|
|
20812
20460
|
|
|
20813
|
-
|
|
20814
|
-
|
|
20815
|
-
|
|
20816
|
-
|
|
20817
|
-
|
|
20818
|
-
|
|
20819
|
-
|
|
20820
|
-
|
|
20821
|
-
|
|
20822
|
-
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
|
|
20827
|
-
* Textual representation of the tree (see note).
|
|
20828
|
-
*
|
|
20829
|
-
* > **Note**: unified typically compiles by serializing: most compilers
|
|
20830
|
-
* > return `string` (or `Uint8Array`).
|
|
20831
|
-
* > Some compilers, such as the one configured with
|
|
20832
|
-
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
20833
|
-
* > React tree).
|
|
20834
|
-
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
20835
|
-
* > result values.
|
|
20836
|
-
* >
|
|
20837
|
-
* > To register custom results in TypeScript, add them to
|
|
20838
|
-
* > {@linkcode CompileResultMap}.
|
|
20839
|
-
*
|
|
20840
|
-
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
20841
|
-
*/
|
|
20842
|
-
stringify(tree, file) {
|
|
20843
|
-
this.freeze();
|
|
20844
|
-
const realFile = vfile(file);
|
|
20845
|
-
const compiler = this.compiler || this.Compiler;
|
|
20846
|
-
assertCompiler('stringify', compiler);
|
|
20847
|
-
assertNode(tree);
|
|
20461
|
+
/**
|
|
20462
|
+
* Set up the `unified` processor.
|
|
20463
|
+
*
|
|
20464
|
+
* @param {Readonly<Options>} options
|
|
20465
|
+
* Props.
|
|
20466
|
+
* @returns {Processor<MdastRoot, MdastRoot, Root, undefined, undefined>}
|
|
20467
|
+
* Result.
|
|
20468
|
+
*/
|
|
20469
|
+
function createProcessor(options) {
|
|
20470
|
+
const rehypePlugins = options.rehypePlugins || emptyPlugins;
|
|
20471
|
+
const remarkPlugins = options.remarkPlugins || emptyPlugins;
|
|
20472
|
+
const remarkRehypeOptions = options.remarkRehypeOptions
|
|
20473
|
+
? {...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions}
|
|
20474
|
+
: emptyRemarkRehypeOptions;
|
|
20848
20475
|
|
|
20849
|
-
|
|
20850
|
-
|
|
20476
|
+
const processor = unified()
|
|
20477
|
+
.use(remarkParse)
|
|
20478
|
+
.use(remarkPlugins)
|
|
20479
|
+
.use(remarkRehype, remarkRehypeOptions)
|
|
20480
|
+
.use(rehypePlugins);
|
|
20851
20481
|
|
|
20852
|
-
|
|
20853
|
-
|
|
20854
|
-
* preset.
|
|
20855
|
-
*
|
|
20856
|
-
* If the processor is already using a plugin, the previous plugin
|
|
20857
|
-
* configuration is changed based on the options that are passed in.
|
|
20858
|
-
* In other words, the plugin is not added a second time.
|
|
20859
|
-
*
|
|
20860
|
-
* > **Note**: `use` cannot be called on *frozen* processors.
|
|
20861
|
-
* > Call the processor first to create a new unfrozen processor.
|
|
20862
|
-
*
|
|
20863
|
-
* @example
|
|
20864
|
-
* There are many ways to pass plugins to `.use()`.
|
|
20865
|
-
* This example gives an overview:
|
|
20866
|
-
*
|
|
20867
|
-
* ```js
|
|
20868
|
-
* import {unified} from 'unified'
|
|
20869
|
-
*
|
|
20870
|
-
* unified()
|
|
20871
|
-
* // Plugin with options:
|
|
20872
|
-
* .use(pluginA, {x: true, y: true})
|
|
20873
|
-
* // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
|
|
20874
|
-
* .use(pluginA, {y: false, z: true})
|
|
20875
|
-
* // Plugins:
|
|
20876
|
-
* .use([pluginB, pluginC])
|
|
20877
|
-
* // Two plugins, the second with options:
|
|
20878
|
-
* .use([pluginD, [pluginE, {}]])
|
|
20879
|
-
* // Preset with plugins and settings:
|
|
20880
|
-
* .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
|
|
20881
|
-
* // Settings only:
|
|
20882
|
-
* .use({settings: {position: false}})
|
|
20883
|
-
* ```
|
|
20884
|
-
*
|
|
20885
|
-
* @template {Array<unknown>} [Parameters=[]]
|
|
20886
|
-
* @template {Node | string | undefined} [Input=undefined]
|
|
20887
|
-
* @template [Output=Input]
|
|
20888
|
-
*
|
|
20889
|
-
* @overload
|
|
20890
|
-
* @param {Preset | null | undefined} [preset]
|
|
20891
|
-
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20892
|
-
*
|
|
20893
|
-
* @overload
|
|
20894
|
-
* @param {PluggableList} list
|
|
20895
|
-
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20896
|
-
*
|
|
20897
|
-
* @overload
|
|
20898
|
-
* @param {Plugin<Parameters, Input, Output>} plugin
|
|
20899
|
-
* @param {...(Parameters | [boolean])} parameters
|
|
20900
|
-
* @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
|
|
20901
|
-
*
|
|
20902
|
-
* @param {PluggableList | Plugin | Preset | null | undefined} value
|
|
20903
|
-
* Usable value.
|
|
20904
|
-
* @param {...unknown} parameters
|
|
20905
|
-
* Parameters, when a plugin is given as a usable value.
|
|
20906
|
-
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20907
|
-
* Current processor.
|
|
20908
|
-
*/
|
|
20909
|
-
use(value, ...parameters) {
|
|
20910
|
-
const attachers = this.attachers;
|
|
20911
|
-
const namespace = this.namespace;
|
|
20482
|
+
return processor
|
|
20483
|
+
}
|
|
20912
20484
|
|
|
20913
|
-
|
|
20485
|
+
/**
|
|
20486
|
+
* Set up the virtual file.
|
|
20487
|
+
*
|
|
20488
|
+
* @param {Readonly<Options>} options
|
|
20489
|
+
* Props.
|
|
20490
|
+
* @returns {VFile}
|
|
20491
|
+
* Result.
|
|
20492
|
+
*/
|
|
20493
|
+
function createFile(options) {
|
|
20494
|
+
const children = options.children || '';
|
|
20495
|
+
const file = new VFile();
|
|
20914
20496
|
|
|
20915
|
-
|
|
20916
|
-
|
|
20917
|
-
|
|
20918
|
-
if (Array.isArray(value)) {
|
|
20919
|
-
addList(value);
|
|
20920
|
-
} else {
|
|
20921
|
-
addPreset(value);
|
|
20922
|
-
}
|
|
20923
|
-
} else {
|
|
20924
|
-
throw new TypeError('Expected usable value, not `' + value + '`')
|
|
20925
|
-
}
|
|
20497
|
+
if (typeof children === 'string') {
|
|
20498
|
+
file.value = children;
|
|
20499
|
+
}
|
|
20926
20500
|
|
|
20927
|
-
|
|
20501
|
+
return file
|
|
20502
|
+
}
|
|
20928
20503
|
|
|
20929
|
-
|
|
20930
|
-
|
|
20931
|
-
|
|
20932
|
-
|
|
20933
|
-
|
|
20934
|
-
|
|
20935
|
-
|
|
20936
|
-
|
|
20937
|
-
|
|
20938
|
-
|
|
20939
|
-
|
|
20940
|
-
|
|
20941
|
-
|
|
20942
|
-
|
|
20943
|
-
|
|
20944
|
-
|
|
20945
|
-
|
|
20946
|
-
|
|
20504
|
+
/**
|
|
20505
|
+
* Process the result from unified some more.
|
|
20506
|
+
*
|
|
20507
|
+
* @param {Nodes} tree
|
|
20508
|
+
* Tree.
|
|
20509
|
+
* @param {Readonly<Options>} options
|
|
20510
|
+
* Props.
|
|
20511
|
+
* @returns {ReactElement}
|
|
20512
|
+
* React element.
|
|
20513
|
+
*/
|
|
20514
|
+
function post(tree, options) {
|
|
20515
|
+
const allowedElements = options.allowedElements;
|
|
20516
|
+
const allowElement = options.allowElement;
|
|
20517
|
+
const components = options.components;
|
|
20518
|
+
const disallowedElements = options.disallowedElements;
|
|
20519
|
+
const skipHtml = options.skipHtml;
|
|
20520
|
+
const unwrapDisallowed = options.unwrapDisallowed;
|
|
20521
|
+
const urlTransform = options.urlTransform || defaultUrlTransform;
|
|
20522
|
+
|
|
20523
|
+
for (const deprecation of deprecations) {
|
|
20524
|
+
if (Object.hasOwn(options, deprecation.from)) {
|
|
20525
|
+
unreachable(
|
|
20526
|
+
'Unexpected `' +
|
|
20527
|
+
deprecation.from +
|
|
20528
|
+
'` prop, ' +
|
|
20529
|
+
(deprecation.to
|
|
20530
|
+
? 'use `' + deprecation.to + '` instead'
|
|
20531
|
+
: 'remove it') +
|
|
20532
|
+
' (see <' +
|
|
20533
|
+
changelog +
|
|
20534
|
+
'#' +
|
|
20535
|
+
deprecation.id +
|
|
20536
|
+
'> for more info)'
|
|
20537
|
+
);
|
|
20947
20538
|
}
|
|
20539
|
+
}
|
|
20948
20540
|
|
|
20949
|
-
|
|
20950
|
-
* @param {Preset} result
|
|
20951
|
-
* @returns {undefined}
|
|
20952
|
-
*/
|
|
20953
|
-
function addPreset(result) {
|
|
20954
|
-
if (!('plugins' in result) && !('settings' in result)) {
|
|
20955
|
-
throw new Error(
|
|
20956
|
-
'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'
|
|
20957
|
-
)
|
|
20958
|
-
}
|
|
20541
|
+
visit(tree, transform);
|
|
20959
20542
|
|
|
20960
|
-
|
|
20543
|
+
return toJsxRuntime(tree, {
|
|
20544
|
+
Fragment: jsxRuntime.Fragment,
|
|
20545
|
+
components,
|
|
20546
|
+
ignoreInvalidStyle: true,
|
|
20547
|
+
jsx: jsxRuntime.jsx,
|
|
20548
|
+
jsxs: jsxRuntime.jsxs,
|
|
20549
|
+
passKeys: true,
|
|
20550
|
+
passNode: true
|
|
20551
|
+
})
|
|
20961
20552
|
|
|
20962
|
-
|
|
20963
|
-
|
|
20553
|
+
/** @type {BuildVisitor<Root>} */
|
|
20554
|
+
function transform(node, index, parent) {
|
|
20555
|
+
if (node.type === 'raw' && parent && typeof index === 'number') {
|
|
20556
|
+
if (skipHtml) {
|
|
20557
|
+
parent.children.splice(index, 1);
|
|
20558
|
+
} else {
|
|
20559
|
+
parent.children[index] = {type: 'text', value: node.value};
|
|
20964
20560
|
}
|
|
20561
|
+
|
|
20562
|
+
return index
|
|
20965
20563
|
}
|
|
20966
20564
|
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
*/
|
|
20971
|
-
function addList(plugins) {
|
|
20972
|
-
let index = -1;
|
|
20565
|
+
if (node.type === 'element') {
|
|
20566
|
+
/** @type {string} */
|
|
20567
|
+
let key;
|
|
20973
20568
|
|
|
20974
|
-
|
|
20975
|
-
|
|
20976
|
-
|
|
20977
|
-
|
|
20569
|
+
for (key in urlAttributes) {
|
|
20570
|
+
if (
|
|
20571
|
+
Object.hasOwn(urlAttributes, key) &&
|
|
20572
|
+
Object.hasOwn(node.properties, key)
|
|
20573
|
+
) {
|
|
20574
|
+
const value = node.properties[key];
|
|
20575
|
+
const test = urlAttributes[key];
|
|
20576
|
+
if (test === null || test.includes(node.tagName)) {
|
|
20577
|
+
node.properties[key] = urlTransform(String(value || ''), key, node);
|
|
20578
|
+
}
|
|
20978
20579
|
}
|
|
20979
|
-
} else {
|
|
20980
|
-
throw new TypeError('Expected a list of plugins, not `' + plugins + '`')
|
|
20981
20580
|
}
|
|
20982
20581
|
}
|
|
20983
20582
|
|
|
20984
|
-
|
|
20985
|
-
|
|
20986
|
-
|
|
20987
|
-
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
let index = -1;
|
|
20991
|
-
let entryIndex = -1;
|
|
20583
|
+
if (node.type === 'element') {
|
|
20584
|
+
let remove = allowedElements
|
|
20585
|
+
? !allowedElements.includes(node.tagName)
|
|
20586
|
+
: disallowedElements
|
|
20587
|
+
? disallowedElements.includes(node.tagName)
|
|
20588
|
+
: false;
|
|
20992
20589
|
|
|
20993
|
-
|
|
20994
|
-
|
|
20995
|
-
entryIndex = index;
|
|
20996
|
-
break
|
|
20997
|
-
}
|
|
20590
|
+
if (!remove && allowElement && typeof index === 'number') {
|
|
20591
|
+
remove = !allowElement(node, index, parent);
|
|
20998
20592
|
}
|
|
20999
20593
|
|
|
21000
|
-
if (
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
|
|
21004
|
-
|
|
21005
|
-
else if (parameters.length > 0) {
|
|
21006
|
-
let [primary, ...rest] = parameters;
|
|
21007
|
-
const currentPrimary = attachers[entryIndex][1];
|
|
21008
|
-
if (isPlainObject(currentPrimary) && isPlainObject(primary)) {
|
|
21009
|
-
primary = extend(true, currentPrimary, primary);
|
|
20594
|
+
if (remove && parent && typeof index === 'number') {
|
|
20595
|
+
if (unwrapDisallowed && node.children) {
|
|
20596
|
+
parent.children.splice(index, 1, ...node.children);
|
|
20597
|
+
} else {
|
|
20598
|
+
parent.children.splice(index, 1);
|
|
21010
20599
|
}
|
|
21011
20600
|
|
|
21012
|
-
|
|
20601
|
+
return index
|
|
21013
20602
|
}
|
|
21014
20603
|
}
|
|
21015
20604
|
}
|
|
21016
20605
|
}
|
|
21017
20606
|
|
|
21018
|
-
// Note: this returns a *callable* instance.
|
|
21019
|
-
// That’s why it’s documented as a function.
|
|
21020
20607
|
/**
|
|
21021
|
-
*
|
|
21022
|
-
*
|
|
21023
|
-
* @example
|
|
21024
|
-
* This example shows how a new processor can be created (from `remark`) and linked
|
|
21025
|
-
* to **stdin**(4) and **stdout**(4).
|
|
21026
|
-
*
|
|
21027
|
-
* ```js
|
|
21028
|
-
* import process from 'node:process'
|
|
21029
|
-
* import concatStream from 'concat-stream'
|
|
21030
|
-
* import {remark} from 'remark'
|
|
21031
|
-
*
|
|
21032
|
-
* process.stdin.pipe(
|
|
21033
|
-
* concatStream(function (buf) {
|
|
21034
|
-
* process.stdout.write(String(remark().processSync(buf)))
|
|
21035
|
-
* })
|
|
21036
|
-
* )
|
|
21037
|
-
* ```
|
|
21038
|
-
*
|
|
21039
|
-
* @returns
|
|
21040
|
-
* New *unfrozen* processor (`processor`).
|
|
20608
|
+
* Make a URL safe.
|
|
21041
20609
|
*
|
|
21042
|
-
*
|
|
21043
|
-
*
|
|
21044
|
-
*
|
|
20610
|
+
* @satisfies {UrlTransform}
|
|
20611
|
+
* @param {string} value
|
|
20612
|
+
* URL.
|
|
20613
|
+
* @returns {string}
|
|
20614
|
+
* Safe URL.
|
|
21045
20615
|
*/
|
|
21046
|
-
|
|
20616
|
+
function defaultUrlTransform(value) {
|
|
20617
|
+
// Same as:
|
|
20618
|
+
// <https://github.com/micromark/micromark/blob/929275e/packages/micromark-util-sanitize-uri/dev/index.js#L34>
|
|
20619
|
+
// But without the `encode` part.
|
|
20620
|
+
const colon = value.indexOf(':');
|
|
20621
|
+
const questionMark = value.indexOf('?');
|
|
20622
|
+
const numberSign = value.indexOf('#');
|
|
20623
|
+
const slash = value.indexOf('/');
|
|
21047
20624
|
|
|
21048
|
-
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
|
|
21052
|
-
|
|
21053
|
-
|
|
21054
|
-
|
|
21055
|
-
|
|
21056
|
-
|
|
21057
|
-
|
|
20625
|
+
if (
|
|
20626
|
+
// If there is no protocol, it’s relative.
|
|
20627
|
+
colon === -1 ||
|
|
20628
|
+
// If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
|
|
20629
|
+
(slash !== -1 && colon > slash) ||
|
|
20630
|
+
(questionMark !== -1 && colon > questionMark) ||
|
|
20631
|
+
(numberSign !== -1 && colon > numberSign) ||
|
|
20632
|
+
// It is a protocol, it should be allowed.
|
|
20633
|
+
safeProtocol.test(value.slice(0, colon))
|
|
20634
|
+
) {
|
|
20635
|
+
return value
|
|
21058
20636
|
}
|
|
20637
|
+
|
|
20638
|
+
return ''
|
|
21059
20639
|
}
|
|
21060
20640
|
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
|
|
21065
|
-
|
|
21066
|
-
|
|
21067
|
-
|
|
21068
|
-
|
|
21069
|
-
|
|
21070
|
-
|
|
20641
|
+
function styleInject(css, ref) {
|
|
20642
|
+
if ( ref === void 0 ) ref = {};
|
|
20643
|
+
var insertAt = ref.insertAt;
|
|
20644
|
+
|
|
20645
|
+
if (typeof document === 'undefined') { return; }
|
|
20646
|
+
|
|
20647
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
20648
|
+
var style = document.createElement('style');
|
|
20649
|
+
style.type = 'text/css';
|
|
20650
|
+
|
|
20651
|
+
if (insertAt === 'top') {
|
|
20652
|
+
if (head.firstChild) {
|
|
20653
|
+
head.insertBefore(style, head.firstChild);
|
|
20654
|
+
} else {
|
|
20655
|
+
head.appendChild(style);
|
|
20656
|
+
}
|
|
20657
|
+
} else {
|
|
20658
|
+
head.appendChild(style);
|
|
21071
20659
|
}
|
|
21072
|
-
}
|
|
21073
20660
|
|
|
21074
|
-
|
|
21075
|
-
|
|
21076
|
-
|
|
21077
|
-
|
|
21078
|
-
* @param {unknown} frozen
|
|
21079
|
-
* @returns {asserts frozen is false}
|
|
21080
|
-
*/
|
|
21081
|
-
function assertUnfrozen(name, frozen) {
|
|
21082
|
-
if (frozen) {
|
|
21083
|
-
throw new Error(
|
|
21084
|
-
'Cannot call `' +
|
|
21085
|
-
name +
|
|
21086
|
-
'` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'
|
|
21087
|
-
)
|
|
20661
|
+
if (style.styleSheet) {
|
|
20662
|
+
style.styleSheet.cssText = css;
|
|
20663
|
+
} else {
|
|
20664
|
+
style.appendChild(document.createTextNode(css));
|
|
21088
20665
|
}
|
|
21089
20666
|
}
|
|
21090
20667
|
|
|
21091
|
-
|
|
21092
|
-
|
|
21093
|
-
|
|
21094
|
-
|
|
21095
|
-
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
|
|
21104
|
-
|
|
20668
|
+
var css_248z = ".markdown-content{word-wrap:break-word;line-height:1.6;white-space:normal}.markdown-content p{margin:0 0 .75rem}.markdown-content p:last-child{margin-bottom:0}.markdown-content h1,.markdown-content h2,.markdown-content h3,.markdown-content h4,.markdown-content h5,.markdown-content h6{font-weight:600;line-height:1.3;margin:1rem 0 .5rem}.markdown-content h1:first-child,.markdown-content h2:first-child,.markdown-content h3:first-child{margin-top:0}.markdown-content h1{font-size:1.5em}.markdown-content h2{font-size:1.3em}.markdown-content h3{font-size:1.15em}.markdown-content h4{font-size:1.05em}.markdown-content ol,.markdown-content ul{margin:.5rem 0;padding-left:1.5rem}.markdown-content li{margin:.25rem 0}.markdown-content code{background:rgba(0,0,0,.05);border-radius:.25rem;font-family:Courier New,monospace;font-size:.9em;padding:.15rem .3rem}.message.user .markdown-content code{background:hsla(0,0%,100%,.2)}.markdown-content pre{background:rgba(0,0,0,.05);border-radius:.375rem;margin:.5rem 0;overflow-x:auto;padding:.75rem}.markdown-content pre code{background:transparent;padding:0}.message.user .markdown-content pre{background:hsla(0,0%,100%,.15)}.markdown-content strong{font-weight:700}.markdown-content em{font-style:italic}.markdown-content a{color:#667eea;text-decoration:underline}.message.user .markdown-content a{color:hsla(0,0%,100%,.95)}.markdown-content blockquote{border-left:3px solid #667eea;color:#666;margin:.75rem 0;padding-left:1rem}.message.user .markdown-content blockquote{border-left-color:hsla(0,0%,100%,.5);color:hsla(0,0%,100%,.9)}.markdown-content hr{border:none;border-top:1px solid #e5e7eb;margin:1rem 0}.message.user .markdown-content hr{border-top-color:hsla(0,0%,100%,.3)}.markdown-content table{border-collapse:collapse;margin:.75rem 0;width:100%}.markdown-content td,.markdown-content th{border:1px solid #e5e7eb;padding:.5rem;text-align:left}.markdown-content th{background:rgba(0,0,0,.05);font-weight:600}.message.user .markdown-content td,.message.user .markdown-content th{border-color:hsla(0,0%,100%,.3)}.message.user .markdown-content th{background:hsla(0,0%,100%,.15)}";
|
|
20669
|
+
styleInject(css_248z);
|
|
20670
|
+
|
|
20671
|
+
function MarkdownContent({
|
|
20672
|
+
content
|
|
20673
|
+
}) {
|
|
20674
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20675
|
+
className: "markdown-content"
|
|
20676
|
+
}, /*#__PURE__*/React.createElement(Markdown, null, content));
|
|
20677
|
+
}
|
|
20678
|
+
|
|
20679
|
+
const ToolContext = /*#__PURE__*/React$1.createContext();
|
|
20680
|
+
function ToolContextProvider({
|
|
20681
|
+
message,
|
|
20682
|
+
children
|
|
20683
|
+
}) {
|
|
20684
|
+
const kinds = React$1.useMemo(() => message.kinds ?? [], [message]);
|
|
20685
|
+
const tools = React$1.useMemo(() => message.content.filter(c => c.type === 'tool'), [message]);
|
|
20686
|
+
const configMap = React$1.useMemo(() => makeTaskConfigs(tools), [tools]);
|
|
20687
|
+
return /*#__PURE__*/React.createElement(ToolContext.Provider, {
|
|
20688
|
+
value: {
|
|
20689
|
+
kinds: kinds,
|
|
20690
|
+
tools,
|
|
20691
|
+
configMap
|
|
20692
|
+
}
|
|
20693
|
+
}, children);
|
|
20694
|
+
}
|
|
20695
|
+
function useToolContext() {
|
|
20696
|
+
return React$1.useContext(ToolContext);
|
|
20697
|
+
}
|
|
20698
|
+
function makeTaskConfigs(tools) {
|
|
20699
|
+
const map = new Map();
|
|
20700
|
+
tools.filter(t => t.name === 'search-task-by-keyword').forEach(tool => {
|
|
20701
|
+
tool.result?.result?.forEach(item => {
|
|
20702
|
+
map.set(item.taskId, item.name);
|
|
20703
|
+
});
|
|
20704
|
+
});
|
|
20705
|
+
return map;
|
|
20706
|
+
}
|
|
20707
|
+
|
|
20708
|
+
var dayjs_min$1 = {exports: {}};
|
|
21105
20709
|
|
|
21106
|
-
|
|
21107
|
-
* Assert that `complete` is `true`.
|
|
21108
|
-
*
|
|
21109
|
-
* @param {string} name
|
|
21110
|
-
* @param {string} asyncName
|
|
21111
|
-
* @param {unknown} complete
|
|
21112
|
-
* @returns {asserts complete is true}
|
|
21113
|
-
*/
|
|
21114
|
-
function assertDone(name, asyncName, complete) {
|
|
21115
|
-
if (!complete) {
|
|
21116
|
-
throw new Error(
|
|
21117
|
-
'`' + name + '` finished async. Use `' + asyncName + '` instead'
|
|
21118
|
-
)
|
|
21119
|
-
}
|
|
21120
|
-
}
|
|
20710
|
+
var dayjs_min = dayjs_min$1.exports;
|
|
21121
20711
|
|
|
21122
|
-
|
|
21123
|
-
|
|
21124
|
-
|
|
21125
|
-
|
|
21126
|
-
|
|
21127
|
-
|
|
20712
|
+
var hasRequiredDayjs_min;
|
|
20713
|
+
|
|
20714
|
+
function requireDayjs_min () {
|
|
20715
|
+
if (hasRequiredDayjs_min) return dayjs_min$1.exports;
|
|
20716
|
+
hasRequiredDayjs_min = 1;
|
|
20717
|
+
(function (module, exports$1) {
|
|
20718
|
+
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
20719
|
+
} (dayjs_min$1));
|
|
20720
|
+
return dayjs_min$1.exports;
|
|
21128
20721
|
}
|
|
21129
20722
|
|
|
21130
|
-
|
|
21131
|
-
|
|
21132
|
-
|
|
21133
|
-
|
|
21134
|
-
|
|
21135
|
-
|
|
21136
|
-
|
|
21137
|
-
|
|
21138
|
-
|
|
21139
|
-
|
|
21140
|
-
|
|
20723
|
+
var dayjs_minExports = requireDayjs_min();
|
|
20724
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
20725
|
+
|
|
20726
|
+
var isoWeek$2 = {exports: {}};
|
|
20727
|
+
|
|
20728
|
+
var isoWeek$1 = isoWeek$2.exports;
|
|
20729
|
+
|
|
20730
|
+
var hasRequiredIsoWeek;
|
|
20731
|
+
|
|
20732
|
+
function requireIsoWeek () {
|
|
20733
|
+
if (hasRequiredIsoWeek) return isoWeek$2.exports;
|
|
20734
|
+
hasRequiredIsoWeek = 1;
|
|
20735
|
+
(function (module, exports$1) {
|
|
20736
|
+
!function(e,t){module.exports=t();}(isoWeek$1,(function(){var e="day";return function(t,i,s){var a=function(t){return t.add(4-t.isoWeekday(),e)},d=i.prototype;d.isoWeekYear=function(){return a(this).year()},d.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),e);var i,d,n,o,r=a(this),u=(i=this.isoWeekYear(),d=this.$u,n=(d?s.utc:s)().year(i).startOf("year"),o=4-n.isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,e));return r.diff(u,"week")+1},d.isoWeekday=function(e){return this.$utils().u(e)?this.day()||7:this.day(this.day()%7?e:e-7)};var n=d.startOf;d.startOf=function(e,t){var i=this.$utils(),s=!!i.u(t)||t;return "isoweek"===i.p(e)?s?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):n.bind(this)(e,t)};}}));
|
|
20737
|
+
} (isoWeek$2));
|
|
20738
|
+
return isoWeek$2.exports;
|
|
21141
20739
|
}
|
|
21142
20740
|
|
|
21143
|
-
|
|
21144
|
-
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
|
|
21148
|
-
|
|
20741
|
+
var isoWeekExports = requireIsoWeek();
|
|
20742
|
+
var isoWeek = /*@__PURE__*/getDefaultExportFromCjs(isoWeekExports);
|
|
20743
|
+
|
|
20744
|
+
var relativeTime$2 = {exports: {}};
|
|
20745
|
+
|
|
20746
|
+
var relativeTime$1 = relativeTime$2.exports;
|
|
20747
|
+
|
|
20748
|
+
var hasRequiredRelativeTime;
|
|
20749
|
+
|
|
20750
|
+
function requireRelativeTime () {
|
|
20751
|
+
if (hasRequiredRelativeTime) return relativeTime$2.exports;
|
|
20752
|
+
hasRequiredRelativeTime = 1;
|
|
20753
|
+
(function (module, exports$1) {
|
|
20754
|
+
!function(r,e){module.exports=e();}(relativeTime$1,(function(){return function(r,e,t){r=r||{};var n=e.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function i(r,e,t,o){return n.fromToBase(r,e,t,o)}t.en.relativeTime=o,n.fromToBase=function(e,n,i,d,u){for(var f,a,s,l=i.$locale().relativeTime||o,h=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],m=h.length,c=0;c<m;c+=1){var y=h[c];y.d&&(f=d?t(e).diff(i,y.d,true):i.diff(e,y.d,true));var p=(r.rounding||Math.round)(Math.abs(f));if(s=f>0,p<=y.r||!y.r){p<=1&&c>0&&(y=h[c-1]);var v=l[y.l];u&&(p=u(""+p)),a="string"==typeof v?v.replace("%d",p):v(p,n,y.l,s);break}}if(n)return a;var M=s?l.future:l.past;return "function"==typeof M?M(a):M.replace("%s",a)},n.to=function(r,e){return i(r,e,this,true)},n.from=function(r,e){return i(r,e,this)};var d=function(r){return r.$u?t.utc():t()};n.toNow=function(r){return this.to(d(this),r)},n.fromNow=function(r){return this.from(d(this),r)};}}));
|
|
20755
|
+
} (relativeTime$2));
|
|
20756
|
+
return relativeTime$2.exports;
|
|
21149
20757
|
}
|
|
21150
20758
|
|
|
21151
|
-
|
|
21152
|
-
|
|
21153
|
-
|
|
21154
|
-
|
|
21155
|
-
|
|
21156
|
-
|
|
21157
|
-
|
|
21158
|
-
|
|
21159
|
-
|
|
21160
|
-
|
|
21161
|
-
|
|
21162
|
-
|
|
21163
|
-
|
|
21164
|
-
|
|
21165
|
-
|
|
20759
|
+
var relativeTimeExports = requireRelativeTime();
|
|
20760
|
+
var relativeTime = /*@__PURE__*/getDefaultExportFromCjs(relativeTimeExports);
|
|
20761
|
+
|
|
20762
|
+
var isSameOrBefore$2 = {exports: {}};
|
|
20763
|
+
|
|
20764
|
+
var isSameOrBefore$1 = isSameOrBefore$2.exports;
|
|
20765
|
+
|
|
20766
|
+
var hasRequiredIsSameOrBefore;
|
|
20767
|
+
|
|
20768
|
+
function requireIsSameOrBefore () {
|
|
20769
|
+
if (hasRequiredIsSameOrBefore) return isSameOrBefore$2.exports;
|
|
20770
|
+
hasRequiredIsSameOrBefore = 1;
|
|
20771
|
+
(function (module, exports$1) {
|
|
20772
|
+
!function(e,i){module.exports=i();}(isSameOrBefore$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
20773
|
+
} (isSameOrBefore$2));
|
|
20774
|
+
return isSameOrBefore$2.exports;
|
|
21166
20775
|
}
|
|
21167
20776
|
|
|
21168
|
-
|
|
21169
|
-
|
|
21170
|
-
* @import {Root as MdastRoot} from 'mdast'
|
|
21171
|
-
* @import {ComponentType, JSX, ReactElement, ReactNode} from 'react'
|
|
21172
|
-
* @import {Options as RemarkRehypeOptions} from 'remark-rehype'
|
|
21173
|
-
* @import {BuildVisitor} from 'unist-util-visit'
|
|
21174
|
-
* @import {PluggableList, Processor} from 'unified'
|
|
21175
|
-
*/
|
|
20777
|
+
var isSameOrBeforeExports = requireIsSameOrBefore();
|
|
20778
|
+
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
|
|
21176
20779
|
|
|
20780
|
+
var isSameOrAfter$2 = {exports: {}};
|
|
21177
20781
|
|
|
21178
|
-
|
|
21179
|
-
'https://github.com/remarkjs/react-markdown/blob/main/changelog.md';
|
|
20782
|
+
var isSameOrAfter$1 = isSameOrAfter$2.exports;
|
|
21180
20783
|
|
|
21181
|
-
|
|
21182
|
-
const emptyPlugins = [];
|
|
21183
|
-
/** @type {Readonly<RemarkRehypeOptions>} */
|
|
21184
|
-
const emptyRemarkRehypeOptions = {allowDangerousHtml: true};
|
|
21185
|
-
const safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;
|
|
20784
|
+
var hasRequiredIsSameOrAfter;
|
|
21186
20785
|
|
|
21187
|
-
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
|
|
21192
|
-
|
|
21193
|
-
|
|
21194
|
-
|
|
21195
|
-
|
|
21196
|
-
|
|
21197
|
-
|
|
21198
|
-
|
|
21199
|
-
|
|
21200
|
-
|
|
21201
|
-
|
|
21202
|
-
|
|
21203
|
-
|
|
21204
|
-
|
|
21205
|
-
|
|
21206
|
-
|
|
21207
|
-
|
|
21208
|
-
|
|
21209
|
-
|
|
21210
|
-
|
|
21211
|
-
|
|
21212
|
-
|
|
21213
|
-
|
|
21214
|
-
|
|
21215
|
-
|
|
21216
|
-
|
|
21217
|
-
|
|
21218
|
-
|
|
21219
|
-
|
|
21220
|
-
|
|
21221
|
-
|
|
21222
|
-
|
|
20786
|
+
function requireIsSameOrAfter () {
|
|
20787
|
+
if (hasRequiredIsSameOrAfter) return isSameOrAfter$2.exports;
|
|
20788
|
+
hasRequiredIsSameOrAfter = 1;
|
|
20789
|
+
(function (module, exports$1) {
|
|
20790
|
+
!function(e,t){module.exports=t();}(isSameOrAfter$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
20791
|
+
} (isSameOrAfter$2));
|
|
20792
|
+
return isSameOrAfter$2.exports;
|
|
20793
|
+
}
|
|
20794
|
+
|
|
20795
|
+
var isSameOrAfterExports = requireIsSameOrAfter();
|
|
20796
|
+
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
|
|
20797
|
+
|
|
20798
|
+
dayjs.extend(relativeTime);
|
|
20799
|
+
dayjs.extend(isoWeek);
|
|
20800
|
+
dayjs.extend(isSameOrBefore);
|
|
20801
|
+
dayjs.extend(isSameOrAfter);
|
|
20802
|
+
dayjs.locale('ko');
|
|
20803
|
+
const isToday = (from, to) => {
|
|
20804
|
+
const now = new Date();
|
|
20805
|
+
const date = new Date(now.toLocaleString('en-US', {
|
|
20806
|
+
timeZone: 'Asia/Seoul'
|
|
20807
|
+
}));
|
|
20808
|
+
const today = date.getFullYear() + String(date.getMonth() + 1).padStart(2, '0') + String(date.getDate()).padStart(2, '0');
|
|
20809
|
+
return from === today && to === today;
|
|
20810
|
+
};
|
|
20811
|
+
const isOneDay = (from, to) => {
|
|
20812
|
+
return from === to;
|
|
20813
|
+
};
|
|
20814
|
+
const formatDateRange = (from, to) => {
|
|
20815
|
+
const fromDate = dayjs(from, 'YYYYMMDD');
|
|
20816
|
+
const toDate = dayjs(to, 'YYYYMMDD');
|
|
20817
|
+
const today = dayjs().startOf('day');
|
|
20818
|
+
if (from === to) return formatSingleDate(fromDate, today);
|
|
20819
|
+
return formatRange(fromDate, toDate, today);
|
|
20820
|
+
};
|
|
20821
|
+
const formatSingleDate = (date, today) => {
|
|
20822
|
+
const diffDays = today.diff(date, 'day');
|
|
20823
|
+
if (diffDays === 0) return '오늘';
|
|
20824
|
+
if (diffDays === 1) return '어제';
|
|
20825
|
+
if (diffDays === 2) return '그제';
|
|
20826
|
+
return date.format('YYYY년 M월 D일');
|
|
20827
|
+
};
|
|
20828
|
+
const formatRange = (fromDate, toDate, today) => {
|
|
20829
|
+
const thisWeekStart = today.startOf('week'); // 일요일
|
|
20830
|
+
const thisWeekEnd = today.endOf('week'); // 토요일
|
|
20831
|
+
|
|
20832
|
+
if (fromDate.isSame(thisWeekStart, 'day') && (toDate.isSame(today, 'day') || toDate.isSame(thisWeekEnd, 'day'))) {
|
|
20833
|
+
return '이번주';
|
|
20834
|
+
}
|
|
20835
|
+
const lastWeekStart = today.subtract(1, 'week').startOf('week');
|
|
20836
|
+
const lastWeekEnd = today.subtract(1, 'week').endOf('week');
|
|
20837
|
+
if (fromDate.isSame(lastWeekStart, 'day') && toDate.isSame(lastWeekEnd, 'day')) {
|
|
20838
|
+
return '지난주';
|
|
20839
|
+
}
|
|
20840
|
+
const twoWeeksAgoStart = today.subtract(2, 'week').startOf('week');
|
|
20841
|
+
const twoWeeksAgoEnd = today.subtract(2, 'week').endOf('week');
|
|
20842
|
+
if (fromDate.isSame(twoWeeksAgoStart, 'day') && toDate.isSame(twoWeeksAgoEnd, 'day')) {
|
|
20843
|
+
return '지지난주';
|
|
20844
|
+
}
|
|
20845
|
+
const thisMonthStart = today.startOf('month');
|
|
20846
|
+
const thisMonthEnd = today.endOf('month');
|
|
20847
|
+
if (fromDate.isSame(thisMonthStart, 'day') && (toDate.isSame(today, 'day') || toDate.isSame(thisMonthEnd, 'day'))) {
|
|
20848
|
+
return '이번달';
|
|
20849
|
+
}
|
|
20850
|
+
const lastMonthStart = today.subtract(1, 'month').startOf('month');
|
|
20851
|
+
const lastMonthEnd = today.subtract(1, 'month').endOf('month');
|
|
20852
|
+
if (fromDate.isSame(lastMonthStart, 'day') && toDate.isSame(lastMonthEnd, 'day')) {
|
|
20853
|
+
return '지난달';
|
|
20854
|
+
}
|
|
20855
|
+
const twoMonthsAgoStart = today.subtract(2, 'month').startOf('month');
|
|
20856
|
+
const twoMonthsAgoEnd = today.subtract(2, 'month').endOf('month');
|
|
20857
|
+
if (fromDate.isSame(twoMonthsAgoStart, 'day') && toDate.isSame(twoMonthsAgoEnd, 'day')) {
|
|
20858
|
+
return '지지난달';
|
|
20859
|
+
}
|
|
20860
|
+
const fromFormatted = formatDateInRange(fromDate, today);
|
|
20861
|
+
const toFormatted = formatDateInRange(toDate, today);
|
|
20862
|
+
return `${fromFormatted} ~ ${toFormatted}`;
|
|
20863
|
+
};
|
|
20864
|
+
const formatDateInRange = (date, today) => {
|
|
20865
|
+
const diffDays = today.diff(date, 'day');
|
|
20866
|
+
if (diffDays === 0) return '오늘';
|
|
20867
|
+
if (diffDays === 1) return '어제';
|
|
20868
|
+
if (diffDays === 2) return '그제';
|
|
20869
|
+
return date.format('YYYY년 M월 D일');
|
|
20870
|
+
};
|
|
20871
|
+
|
|
20872
|
+
var patternFill = {exports: {}};
|
|
21223
20873
|
|
|
21224
20874
|
/**
|
|
21225
|
-
*
|
|
20875
|
+
* Highcharts JS v11.3.0 (2024-01-10)
|
|
21226
20876
|
*
|
|
21227
|
-
*
|
|
21228
|
-
* When using async plugins,
|
|
21229
|
-
* see {@linkcode MarkdownAsync} or {@linkcode MarkdownHooks}.
|
|
20877
|
+
* Module for adding patterns and images as point fills.
|
|
21230
20878
|
*
|
|
21231
|
-
*
|
|
21232
|
-
*
|
|
21233
|
-
* @returns {ReactElement}
|
|
21234
|
-
* React element.
|
|
21235
|
-
*/
|
|
21236
|
-
function Markdown(options) {
|
|
21237
|
-
const processor = createProcessor(options);
|
|
21238
|
-
const file = createFile(options);
|
|
21239
|
-
return post(processor.runSync(processor.parse(file), file), options)
|
|
21240
|
-
}
|
|
21241
|
-
|
|
21242
|
-
/**
|
|
21243
|
-
* Set up the `unified` processor.
|
|
20879
|
+
* (c) 2010-2024 Highsoft AS
|
|
20880
|
+
* Author: Torstein Hønsi, Øystein Moseng
|
|
21244
20881
|
*
|
|
21245
|
-
*
|
|
21246
|
-
* Props.
|
|
21247
|
-
* @returns {Processor<MdastRoot, MdastRoot, Root, undefined, undefined>}
|
|
21248
|
-
* Result.
|
|
20882
|
+
* License: www.highcharts.com/license
|
|
21249
20883
|
*/
|
|
21250
|
-
function createProcessor(options) {
|
|
21251
|
-
const rehypePlugins = options.rehypePlugins || emptyPlugins;
|
|
21252
|
-
const remarkPlugins = options.remarkPlugins || emptyPlugins;
|
|
21253
|
-
const remarkRehypeOptions = options.remarkRehypeOptions
|
|
21254
|
-
? {...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions}
|
|
21255
|
-
: emptyRemarkRehypeOptions;
|
|
21256
20884
|
|
|
21257
|
-
|
|
21258
|
-
.use(remarkParse)
|
|
21259
|
-
.use(remarkPlugins)
|
|
21260
|
-
.use(remarkRehype, remarkRehypeOptions)
|
|
21261
|
-
.use(rehypePlugins);
|
|
20885
|
+
var hasRequiredPatternFill;
|
|
21262
20886
|
|
|
21263
|
-
|
|
20887
|
+
function requirePatternFill () {
|
|
20888
|
+
if (hasRequiredPatternFill) return patternFill.exports;
|
|
20889
|
+
hasRequiredPatternFill = 1;
|
|
20890
|
+
(function (module) {
|
|
20891
|
+
!function(t){module.exports?(t.default=t,module.exports=t):t("undefined"!=typeof Highcharts?Highcharts:void 0);}(function(t){var e=t?t._modules:{};function r(t,e,r,i){t.hasOwnProperty(e)||(t[e]=i.apply(null,r),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:e,module:t[e]}})));}r(e,"Extensions/PatternFill.js",[e["Core/Animation/AnimationUtilities.js"],e["Core/Defaults.js"],e["Core/Globals.js"],e["Core/Utilities.js"]],function(t,e,r,i){let{animObject:a}=t,{getOptions:o}=e,{composed:n}=r,{addEvent:s,defined:h,erase:l,extend:p,merge:c,pick:d,pushUnique:f,removeEvent:u,wrap:g}=i,m=function(){let t=[],e=o().colors,r=0;for(let i of ["M 0 0 L 5 5 M 4.5 -0.5 L 5.5 0.5 M -0.5 4.5 L 0.5 5.5","M 0 5 L 5 0 M -0.5 0.5 L 0.5 -0.5 M 4.5 5.5 L 5.5 4.5","M 2 0 L 2 5 M 4 0 L 4 5","M 0 2 L 5 2 M 0 4 L 5 4","M 0 1.5 L 2.5 1.5 L 2.5 0 M 2.5 5 L 2.5 3.5 L 5 3.5"])t.push({path:i,color:e[r++],width:5,height:5,patternTransform:"scale(1.4 1.4)"});for(let i of(r=5,["M 0 0 L 5 10 L 10 0","M 3 3 L 8 3 L 8 8 L 3 8 Z","M 5 5 m -4 0 a 4 4 0 1 1 8 0 a 4 4 0 1 1 -8 0","M 0 0 L 10 10 M 9 -1 L 11 1 M -1 9 L 1 11","M 0 10 L 10 0 M -1 1 L 1 -1 M 9 11 L 11 9"]))t.push({path:i,color:e[r],width:10,height:10}),r+=5;return t}();function y(t,e){let r=JSON.stringify(t),i=r.length||0,a=0,o=0,n;if(e){n=Math.max(Math.floor(i/500),1);for(let t=0;t<i;t+=n)a+=r.charCodeAt(t);a&=a;}for(;o<i;++o)a=(a<<5)-a+r.charCodeAt(o),a&=a;return a.toString(16).replace("-","1")}function x(){if(this.renderer&&(this.renderer.defIds||[]).filter(t=>t&&t.indexOf&&0===t.indexOf("highcharts-pattern-")).length){for(let t of this.series)if(t.visible)for(let e of t.points){let t=e.options&&e.options.color;t&&t.pattern&&(t.pattern._width="defer",t.pattern._height="defer");}this.redraw(false);}}function w(){let t={},e=this.renderer,r=(e.defIds||[]).filter(t=>t.indexOf&&0===t.indexOf("highcharts-pattern-"));if(r.length)for(let i of([].forEach.call(this.renderTo.querySelectorAll('[color^="url("], [fill^="url("], [stroke^="url("]'),r=>{let i=r.getAttribute("fill")||r.getAttribute("color")||r.getAttribute("stroke");if(i){let r=i.replace(e.url,"").replace("url(#","").replace(")","");t[r]=true;}}),r))!t[i]&&(l(e.defIds,i),e.patternElements[i]&&(e.patternElements[i].destroy(),delete e.patternElements[i]));}function M(){let t=this.options.color;t&&t.pattern&&("string"==typeof t.pattern.path&&(t.pattern.path={d:t.pattern.path}),this.color=this.options.color=c(this.series.options.color,t));}function L(t){let e=t.args[0],r=t.args[1],i=t.args[2],a=this.chartIndex||0,o=e.pattern,n="#333333";if(void 0!==e.patternIndex&&m&&(o=m[e.patternIndex]),!o)return true;if(o.image||"string"==typeof o.path||o.path&&o.path.d){let t=i.parentNode&&i.parentNode.getAttribute("class");t=t&&t.indexOf("highcharts-legend")>-1,("defer"===o._width||"defer"===o._height)&&_.call({graphic:{element:i}},o),(t||!o.id)&&((o=c({},o)).id="highcharts-pattern-"+a+"-"+y(o)+y(o,true)),this.addPattern(o,!this.forExport&&d(o.animation,this.globalAnimation,{duration:100})),n=`url(${this.url}#${o.id+(this.forExport?"-export":"")})`;}else n=o.color||n;return i.setAttribute(r,n),e.toString=function(){return n},false}function b(){let t=this.chart.isResizing;if(this.isDirtyData||t||!this.chart.hasRendered)for(let e of this.points){let r=e.options&&e.options.color;r&&r.pattern&&(t&&!(e.shapeArgs&&e.shapeArgs.width&&e.shapeArgs.height)?(r.pattern._width="defer",r.pattern._height="defer"):e.calculatePatternDimensions(r.pattern));}}function _(t){if(t.width&&t.height)return;let e=this.graphic&&(this.graphic.getBBox&&this.graphic.getBBox(true)||this.graphic.element&&this.graphic.element.getBBox())||{},r=this.shapeArgs;if(r&&(e.width=r.width||e.width,e.height=r.height||e.height,e.x=r.x||e.x,e.y=r.y||e.y),t.image){if(!e.width||!e.height){t._width="defer",t._height="defer";let e=this.series.chart.mapView&&this.series.chart.mapView.getSVGTransform().scaleY;h(e)&&e<0&&(t._inverted=true);return}t.aspectRatio&&(e.aspectRatio=e.width/e.height,t.aspectRatio>e.aspectRatio?e.aspectWidth=e.height*t.aspectRatio:e.aspectHeight=e.width/t.aspectRatio),t._width=t.width||Math.ceil(e.aspectWidth||e.width),t._height=t.height||Math.ceil(e.aspectHeight||e.height);}t.width||(t._x=t.x||0,t._x+=e.x-Math.round(e.aspectWidth?Math.abs(e.aspectWidth-e.width)/2:0)),t.height||(t._y=t.y||0,t._y+=e.y-Math.round(e.aspectHeight?Math.abs(e.aspectHeight-e.height)/2:0));}function A(t,e){let r=d(e,true),o=a(r),n=t.color||"#333333",s=t.height||("number"==typeof t._height?t._height:0)||32,h=t.width||("number"==typeof t._width?t._width:0)||32,l,p=t.id,c;if(!p&&(this.idCounter=this.idCounter||0,p="highcharts-pattern-"+this.idCounter+"-"+(this.chartIndex||0),++this.idCounter),this.forExport&&(p+="-export"),this.defIds=this.defIds||[],this.defIds.indexOf(p)>-1)return;this.defIds.push(p);let f={id:p,patternUnits:"userSpaceOnUse",patternContentUnits:t.patternContentUnits||"userSpaceOnUse",width:h,height:s,x:t._x||t.x||0,y:t._y||t.y||0};t._inverted&&(f.patternTransform="scale(1, -1)",t.patternTransform&&(t.patternTransform+=" scale(1, -1)")),t.patternTransform&&(f.patternTransform=t.patternTransform);let g=this.createElement("pattern").attr(f).add(this.defs);if(g.id=p,t.path){if(c=i.isObject(t.path)?t.path:{d:t.path},t.backgroundColor){var m;m=t.backgroundColor,this.rect(0,0,h,s).attr({fill:m}).add(g);}l={d:c.d},this.styledMode||(l.stroke=c.stroke||n,l["stroke-width"]=d(c.strokeWidth,2),l.fill=c.fill||"none"),c.transform&&(l.transform=c.transform),this.createElement("path").attr(l).add(g),g.color=n;}else t.image&&(r?this.image(t.image,0,0,h,s,function(){this.animate({opacity:d(t.opacity,1)},o),u(this.element,"load");}).attr({opacity:0}).add(g):this.image(t.image,0,0,h,s).add(g));return t.image&&r||void 0===t.opacity||[].forEach.call(g.element.childNodes,e=>{e.setAttribute("opacity",t.opacity);}),this.patternElements=this.patternElements||{},this.patternElements[p]=g,g}function C(t){let e=this.options.color;e&&e.pattern&&!e.pattern.color?(delete this.options.color,t.apply(this,[].slice.call(arguments,1)),e.pattern.color=this.color,this.color=this.options.color=e):t.apply(this,[].slice.call(arguments,1));}function E(){if(!this.chart?.mapView)return;let t=this.chart,e=t.renderer,r=e.patternElements;e.defIds?.length&&r&&this.points.filter(function(t){return !!t.graphic&&(t.graphic.element.hasAttribute("fill")||t.graphic.element.hasAttribute("color")||t.graphic.element.hasAttribute("stroke"))&&!t.options.color?.pattern?.image&&!!t.group?.scaleX&&!!t.group?.scaleY}).map(function(t){let r=(t.graphic?.element.getAttribute("fill")||t.graphic?.element.getAttribute("color")||t.graphic?.element.getAttribute("stroke")||"").replace(e.url,"").replace("url(#","").replace(")","");return [r,{x:t.group?.scaleX||1,y:t.group?.scaleY||1}]}).filter(function([t,e],r,i){return ""!==t&&-1!==t.indexOf("highcharts-pattern-")&&!i.some(function([e,i],a){return e===t&&a<r})}).forEach(function([t,e]){r[t].scaleX=1/e.x,r[t].scaleY=1/e.y,r[t].updateTransform("patternTransform");});}return {compose:function t(e,r,i){let a=r.prototype.pointClass;f(n,t)&&(s(e,"endResize",x),s(e,"redraw",w),p(a.prototype,{calculatePatternDimensions:_}),s(a,"afterInit",M),s(r,"render",b),g(r.prototype,"getColor",C),s(r,"afterRender",E),s(r,"mapZoomComplete",E),p(i.prototype,{addPattern:A}),s(i,"complexColor",L));},patterns:m}}),r(e,"masters/modules/pattern-fill.src.js",[e["Core/Globals.js"],e["Extensions/PatternFill.js"]],function(t,e){t.patterns=e.patterns,e.compose(t.Chart,t.Series,t.SVGRenderer);});});
|
|
20892
|
+
} (patternFill));
|
|
20893
|
+
return patternFill.exports;
|
|
21264
20894
|
}
|
|
21265
20895
|
|
|
21266
|
-
|
|
21267
|
-
* Set up the virtual file.
|
|
21268
|
-
*
|
|
21269
|
-
* @param {Readonly<Options>} options
|
|
21270
|
-
* Props.
|
|
21271
|
-
* @returns {VFile}
|
|
21272
|
-
* Result.
|
|
21273
|
-
*/
|
|
21274
|
-
function createFile(options) {
|
|
21275
|
-
const children = options.children || '';
|
|
21276
|
-
const file = new VFile();
|
|
20896
|
+
requirePatternFill();
|
|
21277
20897
|
|
|
21278
|
-
|
|
21279
|
-
|
|
20898
|
+
const ColumnChart = ({
|
|
20899
|
+
data,
|
|
20900
|
+
width,
|
|
20901
|
+
height = 230
|
|
20902
|
+
}) => {
|
|
20903
|
+
const series = React$1.useMemo(() => {
|
|
20904
|
+
return data.series.map((item, sindex) => ({
|
|
20905
|
+
...item,
|
|
20906
|
+
data: item.data.map((value, index) => ({
|
|
20907
|
+
y: value,
|
|
20908
|
+
color: data.colors[index % data.colors.length] + alphas[sindex % alphas.length]
|
|
20909
|
+
}))
|
|
20910
|
+
}));
|
|
20911
|
+
}, [data]);
|
|
20912
|
+
const colors = React$1.useMemo(() => {
|
|
20913
|
+
return data.series.map((_, index) => data.colors[0] + alphas[index % alphas.length]);
|
|
20914
|
+
}, [data]);
|
|
20915
|
+
const options = React$1.useMemo(() => {
|
|
20916
|
+
return {
|
|
20917
|
+
chart: {
|
|
20918
|
+
type: 'column',
|
|
20919
|
+
backgroundColor: 'transparent',
|
|
20920
|
+
width: width,
|
|
20921
|
+
height: height,
|
|
20922
|
+
style: {
|
|
20923
|
+
fontFamily: fontFamily$1
|
|
20924
|
+
}
|
|
20925
|
+
},
|
|
20926
|
+
title: {
|
|
20927
|
+
text: undefined
|
|
20928
|
+
},
|
|
20929
|
+
tooltip: {
|
|
20930
|
+
pointFormat: '<span><b>{point.y}</b></span>',
|
|
20931
|
+
style: {
|
|
20932
|
+
fontFamily: fontFamily$1,
|
|
20933
|
+
fontSize: '13px',
|
|
20934
|
+
fontWeight: '100'
|
|
20935
|
+
},
|
|
20936
|
+
useHTML: true
|
|
20937
|
+
},
|
|
20938
|
+
plotOptions: {
|
|
20939
|
+
column: {
|
|
20940
|
+
//size: size
|
|
20941
|
+
}
|
|
20942
|
+
},
|
|
20943
|
+
xAxis: {
|
|
20944
|
+
categories: data.categories,
|
|
20945
|
+
crosshair: true,
|
|
20946
|
+
labels: {
|
|
20947
|
+
style: {
|
|
20948
|
+
color: '#777',
|
|
20949
|
+
fontFamily: fontFamily$1,
|
|
20950
|
+
fontWeight: '400'
|
|
20951
|
+
}
|
|
20952
|
+
},
|
|
20953
|
+
lineColor: '#aaa'
|
|
20954
|
+
},
|
|
20955
|
+
yAxis: {
|
|
20956
|
+
title: {
|
|
20957
|
+
text: undefined
|
|
20958
|
+
},
|
|
20959
|
+
labels: {
|
|
20960
|
+
style: {
|
|
20961
|
+
fontFamily: fontFamily$1,
|
|
20962
|
+
fontSize: '12px',
|
|
20963
|
+
fontWeight: '100'
|
|
20964
|
+
}
|
|
20965
|
+
},
|
|
20966
|
+
gridLineColor: '#f9f9f9'
|
|
20967
|
+
},
|
|
20968
|
+
legend: {
|
|
20969
|
+
layout: 'vertical',
|
|
20970
|
+
itemStyle: {
|
|
20971
|
+
fontFamily: fontFamily$1,
|
|
20972
|
+
fontSize: '12px',
|
|
20973
|
+
fontWeight: '100'
|
|
20974
|
+
},
|
|
20975
|
+
useHTML: true
|
|
20976
|
+
},
|
|
20977
|
+
series: series,
|
|
20978
|
+
colors: colors,
|
|
20979
|
+
credits: {
|
|
20980
|
+
enabled: false
|
|
20981
|
+
},
|
|
20982
|
+
accessibility: {
|
|
20983
|
+
enabled: false
|
|
20984
|
+
}
|
|
20985
|
+
};
|
|
20986
|
+
}, [data, width, height, series, colors]);
|
|
20987
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
20988
|
+
style: styles$7.chartWrapper
|
|
20989
|
+
}, /*#__PURE__*/React$1.createElement(HighchartsReact, {
|
|
20990
|
+
highcharts: Highcharts$1,
|
|
20991
|
+
options: options
|
|
20992
|
+
}));
|
|
20993
|
+
};
|
|
20994
|
+
const fontFamily$1 = 'Pretendard, -apple-system, BlinkMacSystemFont, sans-serif';
|
|
20995
|
+
const styles$7 = {
|
|
20996
|
+
chartWrapper: {
|
|
20997
|
+
background: 'transparent',
|
|
20998
|
+
textAlign: 'center',
|
|
20999
|
+
display: 'flex',
|
|
21000
|
+
flexDirection: 'column',
|
|
21001
|
+
justifyContent: 'center',
|
|
21002
|
+
alignItems: 'center'
|
|
21280
21003
|
}
|
|
21004
|
+
};
|
|
21005
|
+
const alphas = ['ff', 'bb', '77', '33'];
|
|
21281
21006
|
|
|
21282
|
-
|
|
21007
|
+
const ColumnChartContent = ({
|
|
21008
|
+
tools = []
|
|
21009
|
+
}) => {
|
|
21010
|
+
const {
|
|
21011
|
+
configMap
|
|
21012
|
+
} = useToolContext();
|
|
21013
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, tools.length > 0 && /*#__PURE__*/React$1.createElement("div", {
|
|
21014
|
+
style: {
|
|
21015
|
+
display: 'flex',
|
|
21016
|
+
justifyContent: 'center',
|
|
21017
|
+
marginBottom: '30px'
|
|
21018
|
+
}
|
|
21019
|
+
}, /*#__PURE__*/React$1.createElement(ColumnChart, {
|
|
21020
|
+
data: toData$1(tools, configMap)
|
|
21021
|
+
})));
|
|
21022
|
+
};
|
|
21023
|
+
function toData$1(tools, configMap) {
|
|
21024
|
+
const items = [];
|
|
21025
|
+
const hasConvert = tools.some(content => content.result?.result[0]?.metric?.filter !== undefined);
|
|
21026
|
+
tools.sort((a, b) => a.arguments.from.localeCompare(b.arguments.from)).forEach(content => {
|
|
21027
|
+
const {
|
|
21028
|
+
taskId,
|
|
21029
|
+
from,
|
|
21030
|
+
to
|
|
21031
|
+
} = content.arguments;
|
|
21032
|
+
const item = {
|
|
21033
|
+
name: `<b>${configMap.get(taskId)}</b> <span style="font-size:10px">(${formatDateRange(from, to)})</span>`,
|
|
21034
|
+
data: []
|
|
21035
|
+
};
|
|
21036
|
+
const result = reduce(content.result.result);
|
|
21037
|
+
item.data.push(result.input);
|
|
21038
|
+
item.data.push(result.output);
|
|
21039
|
+
if (hasConvert) item.data.push(result.filter);
|
|
21040
|
+
item.data.push(result.error);
|
|
21041
|
+
items.push(item);
|
|
21042
|
+
});
|
|
21043
|
+
return {
|
|
21044
|
+
colors: hasConvert ? ['#333333', '#2652a8', '#b47813', '#aa1a32'] : ['#333333', '#2652a8', '#aa1a32'],
|
|
21045
|
+
categories: hasConvert ? ['입력', '처리', '필터', '에러'] : ['입력', '처리', '에러'],
|
|
21046
|
+
series: items
|
|
21047
|
+
};
|
|
21048
|
+
}
|
|
21049
|
+
function reduce(data) {
|
|
21050
|
+
return data.reduce((acc, item) => {
|
|
21051
|
+
acc.input += item.metric.input;
|
|
21052
|
+
acc.output += item.metric.output;
|
|
21053
|
+
acc.filter += item.metric.filter;
|
|
21054
|
+
acc.error += item.metric.error;
|
|
21055
|
+
return acc;
|
|
21056
|
+
}, {
|
|
21057
|
+
input: 0,
|
|
21058
|
+
output: 0,
|
|
21059
|
+
filter: 0,
|
|
21060
|
+
error: 0
|
|
21061
|
+
});
|
|
21283
21062
|
}
|
|
21284
21063
|
|
|
21285
|
-
|
|
21286
|
-
|
|
21287
|
-
|
|
21288
|
-
|
|
21289
|
-
|
|
21290
|
-
* @param {Readonly<Options>} options
|
|
21291
|
-
* Props.
|
|
21292
|
-
* @returns {ReactElement}
|
|
21293
|
-
* React element.
|
|
21294
|
-
*/
|
|
21295
|
-
function post(tree, options) {
|
|
21296
|
-
const allowedElements = options.allowedElements;
|
|
21297
|
-
const allowElement = options.allowElement;
|
|
21298
|
-
const components = options.components;
|
|
21299
|
-
const disallowedElements = options.disallowedElements;
|
|
21300
|
-
const skipHtml = options.skipHtml;
|
|
21301
|
-
const unwrapDisallowed = options.unwrapDisallowed;
|
|
21302
|
-
const urlTransform = options.urlTransform || defaultUrlTransform;
|
|
21303
|
-
|
|
21304
|
-
for (const deprecation of deprecations) {
|
|
21305
|
-
if (Object.hasOwn(options, deprecation.from)) {
|
|
21306
|
-
unreachable(
|
|
21307
|
-
'Unexpected `' +
|
|
21308
|
-
deprecation.from +
|
|
21309
|
-
'` prop, ' +
|
|
21310
|
-
(deprecation.to
|
|
21311
|
-
? 'use `' + deprecation.to + '` instead'
|
|
21312
|
-
: 'remove it') +
|
|
21313
|
-
' (see <' +
|
|
21314
|
-
changelog +
|
|
21315
|
-
'#' +
|
|
21316
|
-
deprecation.id +
|
|
21317
|
-
'> for more info)'
|
|
21318
|
-
);
|
|
21064
|
+
function _extends() {
|
|
21065
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
21066
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
21067
|
+
var t = arguments[e];
|
|
21068
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
21319
21069
|
}
|
|
21320
|
-
|
|
21070
|
+
return n;
|
|
21071
|
+
}, _extends.apply(null, arguments);
|
|
21072
|
+
}
|
|
21321
21073
|
|
|
21322
|
-
|
|
21074
|
+
function toValue(value) {
|
|
21075
|
+
return value && typeof value === 'object' ? value.value : value;
|
|
21076
|
+
}
|
|
21077
|
+
function toPercent(value) {
|
|
21078
|
+
return Math.round(value * 100 * 100) / 100;
|
|
21079
|
+
}
|
|
21080
|
+
function formatNumber(value) {
|
|
21081
|
+
return value !== undefined ? value.toLocaleString() : '-';
|
|
21082
|
+
}
|
|
21083
|
+
function formatToPercent(value) {
|
|
21084
|
+
return formatPercent(toPercent(value));
|
|
21085
|
+
}
|
|
21086
|
+
function formatPercent(value) {
|
|
21087
|
+
return value !== undefined ? `${value.toLocaleString()}%` : '-';
|
|
21088
|
+
}
|
|
21089
|
+
function formatDuration(value) {
|
|
21090
|
+
value = toValue(value);
|
|
21091
|
+
if (!value) return '-';
|
|
21092
|
+
let day = Math.floor(value / (60 * 60 * 24));
|
|
21093
|
+
let hour = Math.floor(value / (60 * 60)) - day * 24;
|
|
21094
|
+
let minute = Math.floor(value / 60) - (day * 24 + hour) * 60;
|
|
21095
|
+
let second = Math.round(value % 60);
|
|
21096
|
+
day = day > 0 ? `${day.toLocaleString()}일 ` : '';
|
|
21097
|
+
hour = hour > 0 ? `${hour >= 10 ? hour : '0' + hour}시간 ` : '';
|
|
21098
|
+
minute = `${minute >= 10 ? minute : '0' + minute}분 `;
|
|
21099
|
+
second = `${second >= 10 ? second : '0' + second}초`;
|
|
21100
|
+
return `${day}${hour}${minute}${second}`;
|
|
21101
|
+
}
|
|
21102
|
+
function formatBytes(value) {
|
|
21103
|
+
return value !== undefined ? `${value.toLocaleString()} bytes` : '-';
|
|
21104
|
+
}
|
|
21105
|
+
function format(value, type) {
|
|
21106
|
+
switch (type) {
|
|
21107
|
+
case 'TO_PERCENT':
|
|
21108
|
+
return formatToPercent(value);
|
|
21109
|
+
case 'DURATION':
|
|
21110
|
+
return formatDuration(value);
|
|
21111
|
+
case 'BYTES':
|
|
21112
|
+
return formatBytes(value);
|
|
21113
|
+
case 'PERCENT':
|
|
21114
|
+
return formatPercent(value);
|
|
21115
|
+
default:
|
|
21116
|
+
return formatNumber(value);
|
|
21117
|
+
}
|
|
21118
|
+
}
|
|
21323
21119
|
|
|
21324
|
-
|
|
21325
|
-
|
|
21326
|
-
|
|
21327
|
-
|
|
21328
|
-
|
|
21329
|
-
jsxs: jsxRuntime.jsxs,
|
|
21330
|
-
passKeys: true,
|
|
21331
|
-
passNode: true
|
|
21332
|
-
})
|
|
21120
|
+
const all = [[colors.blue[500]], [colors.purple[500], '#4168a6', '#81a7e1'], [colors.green[500], '#debb7f', '#ecdbbe'], [colors.yellow[500], '#1b8286', '#4ab3b6'], [colors.red[500]], [colors.orange[500]], [colors.lime[500]], ['#54AAF9'], ['#BB4ECD'], ['#6DDBBA'], ['#FFE81C'], ['#FA7EBA'], ['#F55713'], ['#51B304'], ['#1559B2'], ['#733FAB'], ['#1C7B5F'], ['#D87500'], ['#C91E48'], ['#2F862F']];
|
|
21121
|
+
[[colors.blue[400], colors.blue[500]], [colors.purple[400], colors.purple[500]], [colors.green[400], colors.green[500]], [colors.yellow[400], colors.yellow[500]], [colors.red[400], colors.red[500]], [colors.orange[400], colors.orange[500]], [colors.lime[400], colors.lime[500]]];
|
|
21122
|
+
[[material.alpha(colors.blue[500], 0.2), 'transparent', colors.blue[300]], [material.alpha(colors.purple[500], 0.2), 'transparent', colors.purple[500]], [material.alpha(colors.green[500], 0.2), 'transparent', colors.green[500]], [material.alpha(colors.yellow[500], 0.2), 'transparent', colors.yellow[500]], [material.alpha(colors.red[500], 0.2), 'transparent', colors.red[500]], [material.alpha(colors.orange[500], 0.2), 'transparent', colors.orange[500]], [material.alpha(colors.lime[500], 0.2), 'transparent', colors.lime[500]]];
|
|
21123
|
+
const preset = ['#003f5c', '#a05195', '#665191', '#2f4b7c', '#d45087', '#f95d6a', '#ff7c43', '#ffa600'];
|
|
21124
|
+
all.map(color => color[0]);
|
|
21333
21125
|
|
|
21334
|
-
|
|
21335
|
-
|
|
21336
|
-
|
|
21337
|
-
|
|
21338
|
-
|
|
21339
|
-
|
|
21340
|
-
|
|
21126
|
+
highchartsAccessibility(Highcharts$1);
|
|
21127
|
+
highchartsAnnotations(Highcharts$1);
|
|
21128
|
+
function Chart(props) {
|
|
21129
|
+
const [legendLimitEnabled, setLegendLimitEnabled] = React$1.useState(props.legendLimit > 0);
|
|
21130
|
+
const [options, setOptions] = React$1.useState(toOptions(props, legendLimitEnabled));
|
|
21131
|
+
React$1.useEffect(() => {
|
|
21132
|
+
if (props.delay) setTimeout(() => setOptions(toOptions(props, legendLimitEnabled, handleLegendItemClick)), props.delay);else setOptions(toOptions(props, legendLimitEnabled, handleLegendItemClick));
|
|
21133
|
+
// eslint-disable-next-line
|
|
21134
|
+
}, [props]);
|
|
21135
|
+
const handleLegendItemClick = React$1.useCallback(() => setLegendLimitEnabled(false), []);
|
|
21136
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, options && /*#__PURE__*/React.createElement(HighchartsReact, {
|
|
21137
|
+
highcharts: Highcharts$1,
|
|
21138
|
+
options: options
|
|
21139
|
+
}));
|
|
21140
|
+
}
|
|
21141
|
+
function toOptions(props, legendLimitEnabled, handleLegendItemClick) {
|
|
21142
|
+
const {
|
|
21143
|
+
title = '',
|
|
21144
|
+
type,
|
|
21145
|
+
categorize,
|
|
21146
|
+
stacking,
|
|
21147
|
+
showLegend = true,
|
|
21148
|
+
showDataLabel,
|
|
21149
|
+
xAxisType,
|
|
21150
|
+
xAxisLabel = true,
|
|
21151
|
+
xAxisLabelFormat,
|
|
21152
|
+
xAxisTickInterval,
|
|
21153
|
+
yAxisLabelEnabled = true,
|
|
21154
|
+
yAxisLabelFormat,
|
|
21155
|
+
yAxisTickInterval = null,
|
|
21156
|
+
yAxisPlotLines = [],
|
|
21157
|
+
opacity = 1,
|
|
21158
|
+
innerSize = 0,
|
|
21159
|
+
colors: customColors,
|
|
21160
|
+
backgroundColor = undefined,
|
|
21161
|
+
xPlotIndex,
|
|
21162
|
+
dimension,
|
|
21163
|
+
metrics,
|
|
21164
|
+
records = [],
|
|
21165
|
+
metas,
|
|
21166
|
+
height = 200,
|
|
21167
|
+
legendLimit,
|
|
21168
|
+
legendAlign = 'center',
|
|
21169
|
+
tooltip = {},
|
|
21170
|
+
secondaryXAxis = []
|
|
21171
|
+
} = props;
|
|
21172
|
+
const {
|
|
21173
|
+
outside
|
|
21174
|
+
} = tooltip;
|
|
21175
|
+
const pie = type === 'pie';
|
|
21176
|
+
const centers = pieCenters(metrics.length);
|
|
21177
|
+
const size = pieSize(metrics.length);
|
|
21178
|
+
const colors$1 = customColors ? customColors : preset;
|
|
21179
|
+
const categories = records.map(record => record[dimension]);
|
|
21180
|
+
const mainXAxis = records.map(r => r.time);
|
|
21181
|
+
const chartColorHandlers = {
|
|
21182
|
+
line: (colors, index) => ({
|
|
21183
|
+
color: colors[index],
|
|
21184
|
+
mainColor: colors[index]
|
|
21185
|
+
}),
|
|
21186
|
+
area: (colors, index) => ({
|
|
21187
|
+
color: colors[index][0],
|
|
21188
|
+
mainColor: colors[index][1]
|
|
21189
|
+
}),
|
|
21190
|
+
gradient: (colors, index) => ({
|
|
21191
|
+
color: {
|
|
21192
|
+
linearGradient: {
|
|
21193
|
+
x1: 0,
|
|
21194
|
+
y1: 0,
|
|
21195
|
+
x2: 0,
|
|
21196
|
+
y2: 1
|
|
21197
|
+
},
|
|
21198
|
+
stops: [[0, `${colors[index][0]}`], [0.95, `${colors[index][1]}`]]
|
|
21199
|
+
},
|
|
21200
|
+
mainColor: colors[index][2]
|
|
21201
|
+
})
|
|
21202
|
+
};
|
|
21203
|
+
const series = metrics.map(({
|
|
21204
|
+
chartType,
|
|
21205
|
+
metric
|
|
21206
|
+
}, index) => {
|
|
21207
|
+
const type = chartType === 'gradient' ? 'area' : chartType;
|
|
21208
|
+
const {
|
|
21209
|
+
color,
|
|
21210
|
+
mainColor
|
|
21211
|
+
} = chartColorHandlers[chartType](colors$1, index);
|
|
21212
|
+
const meta = metas[metric];
|
|
21213
|
+
let option = {
|
|
21214
|
+
type: type,
|
|
21215
|
+
name: meta ? meta.name : '',
|
|
21216
|
+
data: records.map(record => {
|
|
21217
|
+
const data = record.metric[metric] ?? null;
|
|
21218
|
+
return pie ? {
|
|
21219
|
+
name: record[dimension],
|
|
21220
|
+
y: data
|
|
21221
|
+
} : data;
|
|
21222
|
+
}),
|
|
21223
|
+
custom: {
|
|
21224
|
+
type: meta ? meta.type : '',
|
|
21225
|
+
pointerNames: meta?.pointerNames ?? null
|
|
21226
|
+
},
|
|
21227
|
+
center: centers[index] || [null, null],
|
|
21228
|
+
size: size,
|
|
21229
|
+
point: {
|
|
21230
|
+
events: {
|
|
21231
|
+
render: function () {
|
|
21232
|
+
this.graphic.attr({
|
|
21233
|
+
zIndex: this.y === 0 ? -1 : ZIndex.COMPARE_CHART_BASE - index
|
|
21234
|
+
});
|
|
21235
|
+
}
|
|
21236
|
+
}
|
|
21237
|
+
},
|
|
21238
|
+
showInLegend: pie && index > 0 ? false : true,
|
|
21239
|
+
color: color,
|
|
21240
|
+
lineColor: mainColor,
|
|
21241
|
+
lineWidth: 2,
|
|
21242
|
+
marker: {
|
|
21243
|
+
fillColor: mainColor
|
|
21244
|
+
},
|
|
21245
|
+
metric: metric
|
|
21246
|
+
};
|
|
21247
|
+
if (legendLimitEnabled) option = {
|
|
21248
|
+
...option,
|
|
21249
|
+
visible: index < legendLimit
|
|
21250
|
+
};
|
|
21251
|
+
return option;
|
|
21252
|
+
});
|
|
21253
|
+
const yPlotLines = yAxisPlotLines.map((line, index) => {
|
|
21254
|
+
return {
|
|
21255
|
+
value: line.value,
|
|
21256
|
+
width: 1,
|
|
21257
|
+
color: line.color,
|
|
21258
|
+
dashStyle: "Dash",
|
|
21259
|
+
zIndex: ZIndex.AVERAGE_LINE_BASE + index,
|
|
21260
|
+
label: {
|
|
21261
|
+
text: line.label,
|
|
21262
|
+
align: line.labelAlign,
|
|
21263
|
+
style: {
|
|
21264
|
+
color: line.labelColor,
|
|
21265
|
+
opacity: 0.7,
|
|
21266
|
+
fontSize: "12px",
|
|
21267
|
+
padding: '1px 5px'
|
|
21268
|
+
},
|
|
21269
|
+
y: -8,
|
|
21270
|
+
useHTML: true
|
|
21271
|
+
}
|
|
21272
|
+
};
|
|
21273
|
+
});
|
|
21274
|
+
const xPlotBands = [{
|
|
21275
|
+
from: xPlotIndex,
|
|
21276
|
+
to: categories.length - 1,
|
|
21277
|
+
color: 'rgba(0, 0, 0, 0.03)',
|
|
21278
|
+
zIndex: ZIndex.NOW_BAND
|
|
21279
|
+
}];
|
|
21280
|
+
const xPlotLines = [{
|
|
21281
|
+
color: "#aaa",
|
|
21282
|
+
width: 1,
|
|
21283
|
+
value: xPlotIndex,
|
|
21284
|
+
zIndex: ZIndex.NOW_BORDER,
|
|
21285
|
+
label: {
|
|
21286
|
+
text: "현재",
|
|
21287
|
+
rotation: 0,
|
|
21288
|
+
x: 5,
|
|
21289
|
+
y: 13,
|
|
21290
|
+
style: {
|
|
21291
|
+
fontWeight: 500,
|
|
21292
|
+
lineHeight: "16.8px",
|
|
21293
|
+
color: "#333",
|
|
21294
|
+
fontSize: "12px"
|
|
21341
21295
|
}
|
|
21342
|
-
|
|
21343
|
-
return index
|
|
21344
21296
|
}
|
|
21345
|
-
|
|
21346
|
-
|
|
21347
|
-
|
|
21348
|
-
|
|
21349
|
-
|
|
21350
|
-
|
|
21351
|
-
|
|
21352
|
-
|
|
21353
|
-
|
|
21354
|
-
|
|
21355
|
-
|
|
21356
|
-
|
|
21357
|
-
|
|
21358
|
-
|
|
21297
|
+
}];
|
|
21298
|
+
return {
|
|
21299
|
+
chart: {
|
|
21300
|
+
type: type.toLowerCase(),
|
|
21301
|
+
height: height,
|
|
21302
|
+
backgroundColor,
|
|
21303
|
+
events: {
|
|
21304
|
+
render: secondaryXAxis.length === 0 ? undefined : function () {
|
|
21305
|
+
const chart = this;
|
|
21306
|
+
const visibleSeries = chart.series.filter(s => s.visible);
|
|
21307
|
+
let newCategories = null;
|
|
21308
|
+
if (visibleSeries.length === 1 && visibleSeries[0].options.metric === 'prev') {
|
|
21309
|
+
newCategories = secondaryXAxis;
|
|
21310
|
+
} else {
|
|
21311
|
+
newCategories = mainXAxis;
|
|
21312
|
+
}
|
|
21313
|
+
const isSame = JSON.stringify(chart.xAxis[0].categories) === JSON.stringify(newCategories);
|
|
21314
|
+
if (!isSame) {
|
|
21315
|
+
chart.xAxis[0].setCategories(newCategories);
|
|
21359
21316
|
}
|
|
21360
21317
|
}
|
|
21361
21318
|
}
|
|
21362
|
-
}
|
|
21363
|
-
|
|
21364
|
-
|
|
21365
|
-
|
|
21366
|
-
|
|
21367
|
-
|
|
21368
|
-
|
|
21369
|
-
|
|
21370
|
-
|
|
21371
|
-
|
|
21372
|
-
|
|
21373
|
-
|
|
21374
|
-
|
|
21375
|
-
|
|
21376
|
-
|
|
21377
|
-
|
|
21378
|
-
} else {
|
|
21379
|
-
parent.children.splice(index, 1);
|
|
21319
|
+
},
|
|
21320
|
+
title: {
|
|
21321
|
+
text: ''
|
|
21322
|
+
},
|
|
21323
|
+
subtitle: {
|
|
21324
|
+
text: title
|
|
21325
|
+
},
|
|
21326
|
+
colors: colors$1,
|
|
21327
|
+
xAxis: {
|
|
21328
|
+
type: xAxisType,
|
|
21329
|
+
labels: {
|
|
21330
|
+
enabled: xAxisLabel,
|
|
21331
|
+
autoRotation: false,
|
|
21332
|
+
format: xAxisLabelFormat ? `{value:${xAxisLabelFormat}}` : undefined,
|
|
21333
|
+
style: {
|
|
21334
|
+
color: colors.grey[600]
|
|
21380
21335
|
}
|
|
21381
|
-
|
|
21382
|
-
|
|
21336
|
+
},
|
|
21337
|
+
categories: categorize ? categories : undefined,
|
|
21338
|
+
tickWidth: 1,
|
|
21339
|
+
tickInterval: xAxisTickInterval ?? (xAxisType === 'datetime' ? records.length / 20 : 1),
|
|
21340
|
+
lineColor: colors.grey[900],
|
|
21341
|
+
tickColor: colors.grey[900],
|
|
21342
|
+
crosshair: true,
|
|
21343
|
+
startOnTick: true,
|
|
21344
|
+
plotBands: xPlotIndex !== undefined ? xPlotBands : undefined,
|
|
21345
|
+
plotLines: xPlotIndex !== undefined ? xPlotLines : undefined
|
|
21346
|
+
},
|
|
21347
|
+
yAxis: {
|
|
21348
|
+
title: {
|
|
21349
|
+
text: ''
|
|
21350
|
+
},
|
|
21351
|
+
labels: {
|
|
21352
|
+
enabled: yAxisLabelEnabled,
|
|
21353
|
+
formatter: yAxisLabelFormat,
|
|
21354
|
+
style: {
|
|
21355
|
+
color: colors.grey[600]
|
|
21356
|
+
}
|
|
21357
|
+
},
|
|
21358
|
+
tickInterval: yAxisTickInterval,
|
|
21359
|
+
gridLineColor: '#f8f8f8',
|
|
21360
|
+
plotLines: yPlotLines
|
|
21361
|
+
},
|
|
21362
|
+
plotOptions: {
|
|
21363
|
+
series: {
|
|
21364
|
+
opacity: opacity,
|
|
21365
|
+
stacking: stackingType(stacking),
|
|
21366
|
+
showInLegend: showLegend,
|
|
21367
|
+
dataLabels: {
|
|
21368
|
+
enabled: showDataLabel
|
|
21369
|
+
},
|
|
21370
|
+
colorByPoint: pie,
|
|
21371
|
+
lineWidth: 2,
|
|
21372
|
+
marker: {
|
|
21373
|
+
enabled: false,
|
|
21374
|
+
symbol: 'circle'
|
|
21375
|
+
},
|
|
21376
|
+
cursor: 'pointer',
|
|
21377
|
+
point: {
|
|
21378
|
+
events: {}
|
|
21379
|
+
},
|
|
21380
|
+
events: {
|
|
21381
|
+
legendItemClick: handleLegendItemClick
|
|
21382
|
+
}
|
|
21383
|
+
},
|
|
21384
|
+
pie: {
|
|
21385
|
+
allowPointSelect: true,
|
|
21386
|
+
innerSize: `${innerSize}%`
|
|
21383
21387
|
}
|
|
21388
|
+
},
|
|
21389
|
+
legend: {
|
|
21390
|
+
align: legendAlign,
|
|
21391
|
+
verticalAlign: 'top',
|
|
21392
|
+
enabled: showLegend
|
|
21393
|
+
},
|
|
21394
|
+
tooltip: {
|
|
21395
|
+
followPointer: false,
|
|
21396
|
+
shared: true,
|
|
21397
|
+
shadow: false,
|
|
21398
|
+
useHTML: true,
|
|
21399
|
+
formatter: function () {
|
|
21400
|
+
return tooltipFormatter(this, tooltip);
|
|
21401
|
+
},
|
|
21402
|
+
outside: outside,
|
|
21403
|
+
style: {
|
|
21404
|
+
zIndex: 2000
|
|
21405
|
+
}
|
|
21406
|
+
},
|
|
21407
|
+
series: series,
|
|
21408
|
+
time: {
|
|
21409
|
+
useUTC: false,
|
|
21410
|
+
getTimezoneOffset: function () {
|
|
21411
|
+
return new Date().getTimezoneOffset();
|
|
21412
|
+
}
|
|
21413
|
+
},
|
|
21414
|
+
credits: {
|
|
21415
|
+
enabled: false
|
|
21384
21416
|
}
|
|
21385
|
-
}
|
|
21386
|
-
}
|
|
21387
|
-
|
|
21388
|
-
/**
|
|
21389
|
-
* Make a URL safe.
|
|
21390
|
-
*
|
|
21391
|
-
* @satisfies {UrlTransform}
|
|
21392
|
-
* @param {string} value
|
|
21393
|
-
* URL.
|
|
21394
|
-
* @returns {string}
|
|
21395
|
-
* Safe URL.
|
|
21396
|
-
*/
|
|
21397
|
-
function defaultUrlTransform(value) {
|
|
21398
|
-
// Same as:
|
|
21399
|
-
// <https://github.com/micromark/micromark/blob/929275e/packages/micromark-util-sanitize-uri/dev/index.js#L34>
|
|
21400
|
-
// But without the `encode` part.
|
|
21401
|
-
const colon = value.indexOf(':');
|
|
21402
|
-
const questionMark = value.indexOf('?');
|
|
21403
|
-
const numberSign = value.indexOf('#');
|
|
21404
|
-
const slash = value.indexOf('/');
|
|
21405
|
-
|
|
21406
|
-
if (
|
|
21407
|
-
// If there is no protocol, it’s relative.
|
|
21408
|
-
colon === -1 ||
|
|
21409
|
-
// If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
|
|
21410
|
-
(slash !== -1 && colon > slash) ||
|
|
21411
|
-
(questionMark !== -1 && colon > questionMark) ||
|
|
21412
|
-
(numberSign !== -1 && colon > numberSign) ||
|
|
21413
|
-
// It is a protocol, it should be allowed.
|
|
21414
|
-
safeProtocol.test(value.slice(0, colon))
|
|
21415
|
-
) {
|
|
21416
|
-
return value
|
|
21417
|
-
}
|
|
21418
|
-
|
|
21419
|
-
return ''
|
|
21420
|
-
}
|
|
21421
|
-
|
|
21422
|
-
function styleInject(css, ref) {
|
|
21423
|
-
if ( ref === void 0 ) ref = {};
|
|
21424
|
-
var insertAt = ref.insertAt;
|
|
21425
|
-
|
|
21426
|
-
if (typeof document === 'undefined') { return; }
|
|
21427
|
-
|
|
21428
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
21429
|
-
var style = document.createElement('style');
|
|
21430
|
-
style.type = 'text/css';
|
|
21431
|
-
|
|
21432
|
-
if (insertAt === 'top') {
|
|
21433
|
-
if (head.firstChild) {
|
|
21434
|
-
head.insertBefore(style, head.firstChild);
|
|
21435
|
-
} else {
|
|
21436
|
-
head.appendChild(style);
|
|
21437
|
-
}
|
|
21438
|
-
} else {
|
|
21439
|
-
head.appendChild(style);
|
|
21440
|
-
}
|
|
21441
|
-
|
|
21442
|
-
if (style.styleSheet) {
|
|
21443
|
-
style.styleSheet.cssText = css;
|
|
21444
|
-
} else {
|
|
21445
|
-
style.appendChild(document.createTextNode(css));
|
|
21446
|
-
}
|
|
21447
|
-
}
|
|
21448
|
-
|
|
21449
|
-
var css_248z = ".markdown-content{word-wrap:break-word;line-height:1.6;white-space:normal}.markdown-content p{margin:0 0 .75rem}.markdown-content p:last-child{margin-bottom:0}.markdown-content h1,.markdown-content h2,.markdown-content h3,.markdown-content h4,.markdown-content h5,.markdown-content h6{font-weight:600;line-height:1.3;margin:1rem 0 .5rem}.markdown-content h1:first-child,.markdown-content h2:first-child,.markdown-content h3:first-child{margin-top:0}.markdown-content h1{font-size:1.5em}.markdown-content h2{font-size:1.3em}.markdown-content h3{font-size:1.15em}.markdown-content h4{font-size:1.05em}.markdown-content ol,.markdown-content ul{margin:.5rem 0;padding-left:1.5rem}.markdown-content li{margin:.25rem 0}.markdown-content code{background:rgba(0,0,0,.05);border-radius:.25rem;font-family:Courier New,monospace;font-size:.9em;padding:.15rem .3rem}.message.user .markdown-content code{background:hsla(0,0%,100%,.2)}.markdown-content pre{background:rgba(0,0,0,.05);border-radius:.375rem;margin:.5rem 0;overflow-x:auto;padding:.75rem}.markdown-content pre code{background:transparent;padding:0}.message.user .markdown-content pre{background:hsla(0,0%,100%,.15)}.markdown-content strong{font-weight:700}.markdown-content em{font-style:italic}.markdown-content a{color:#667eea;text-decoration:underline}.message.user .markdown-content a{color:hsla(0,0%,100%,.95)}.markdown-content blockquote{border-left:3px solid #667eea;color:#666;margin:.75rem 0;padding-left:1rem}.message.user .markdown-content blockquote{border-left-color:hsla(0,0%,100%,.5);color:hsla(0,0%,100%,.9)}.markdown-content hr{border:none;border-top:1px solid #e5e7eb;margin:1rem 0}.message.user .markdown-content hr{border-top-color:hsla(0,0%,100%,.3)}.markdown-content table{border-collapse:collapse;margin:.75rem 0;width:100%}.markdown-content td,.markdown-content th{border:1px solid #e5e7eb;padding:.5rem;text-align:left}.markdown-content th{background:rgba(0,0,0,.05);font-weight:600}.message.user .markdown-content td,.message.user .markdown-content th{border-color:hsla(0,0%,100%,.3)}.message.user .markdown-content th{background:hsla(0,0%,100%,.15)}";
|
|
21450
|
-
styleInject(css_248z);
|
|
21451
|
-
|
|
21452
|
-
function MarkdownContent({
|
|
21453
|
-
content
|
|
21454
|
-
}) {
|
|
21455
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
21456
|
-
className: "markdown-content"
|
|
21457
|
-
}, /*#__PURE__*/React.createElement(Markdown, null, content));
|
|
21417
|
+
};
|
|
21458
21418
|
}
|
|
21459
|
-
|
|
21460
|
-
const
|
|
21461
|
-
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
|
|
21465
|
-
|
|
21466
|
-
|
|
21467
|
-
|
|
21468
|
-
|
|
21469
|
-
|
|
21470
|
-
|
|
21471
|
-
|
|
21472
|
-
|
|
21419
|
+
const tooltipFormatter = (_this, props) => {
|
|
21420
|
+
const {
|
|
21421
|
+
headerVisible = true,
|
|
21422
|
+
dateFormat,
|
|
21423
|
+
headerTime,
|
|
21424
|
+
legendColors = []
|
|
21425
|
+
} = props;
|
|
21426
|
+
let tooltip = '<div style="font-size: 14px;padding: 12px; min-width: 200px;">';
|
|
21427
|
+
if (headerVisible) {
|
|
21428
|
+
const xDate = new Date(_this.x);
|
|
21429
|
+
const date = formatDate(xDate, dateFormat);
|
|
21430
|
+
tooltip += `<div style="display: flex; justify-content: space-between; font-weight: bold; font-size: 12px;">
|
|
21431
|
+
<span style="font-size: 12px; color: #333;">${date}</span>`;
|
|
21432
|
+
if (headerTime) {
|
|
21433
|
+
const time = formatDate(xDate, '%H:%M');
|
|
21434
|
+
tooltip += `<span style="font-size: 12px; color: #333;">${time}</span>`;
|
|
21473
21435
|
}
|
|
21474
|
-
|
|
21475
|
-
}
|
|
21476
|
-
|
|
21477
|
-
|
|
21478
|
-
|
|
21479
|
-
|
|
21480
|
-
|
|
21481
|
-
|
|
21482
|
-
|
|
21483
|
-
|
|
21484
|
-
|
|
21436
|
+
tooltip += '</div>';
|
|
21437
|
+
}
|
|
21438
|
+
_this.points.forEach(point => {
|
|
21439
|
+
const type = point.series.options.custom.type;
|
|
21440
|
+
const value = type !== 'TO_PERCENT' ? format(point.y, type) : formatToPercent(_this.percentage / 100);
|
|
21441
|
+
const name = point.series.name;
|
|
21442
|
+
let color = type !== 'TO_PERCENT' ? point.series.color : point.color;
|
|
21443
|
+
if (legendColors.length !== 0) {
|
|
21444
|
+
color = legendColors[point.series.index];
|
|
21445
|
+
}
|
|
21446
|
+
tooltip += `<div style="display: flex; flex-direction: column; gap: 8px;">
|
|
21447
|
+
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 15px;">
|
|
21448
|
+
<span style="width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; background-color: ${color}"></span>
|
|
21449
|
+
<span style="flex-grow: 1; font-size: 14px; padding-right: 20px;">${name}</span>
|
|
21450
|
+
<span style="font-weight: bold; font-size: 14px;">${value}</span>
|
|
21451
|
+
</div>
|
|
21452
|
+
</div>`;
|
|
21485
21453
|
});
|
|
21486
|
-
|
|
21487
|
-
|
|
21488
|
-
|
|
21489
|
-
var dayjs_min$1 = {exports: {}};
|
|
21490
|
-
|
|
21491
|
-
var dayjs_min = dayjs_min$1.exports;
|
|
21492
|
-
|
|
21493
|
-
var hasRequiredDayjs_min;
|
|
21494
|
-
|
|
21495
|
-
function requireDayjs_min () {
|
|
21496
|
-
if (hasRequiredDayjs_min) return dayjs_min$1.exports;
|
|
21497
|
-
hasRequiredDayjs_min = 1;
|
|
21498
|
-
(function (module, exports$1) {
|
|
21499
|
-
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
21500
|
-
} (dayjs_min$1));
|
|
21501
|
-
return dayjs_min$1.exports;
|
|
21502
|
-
}
|
|
21503
|
-
|
|
21504
|
-
var dayjs_minExports = requireDayjs_min();
|
|
21505
|
-
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
21506
|
-
|
|
21507
|
-
var isoWeek$2 = {exports: {}};
|
|
21508
|
-
|
|
21509
|
-
var isoWeek$1 = isoWeek$2.exports;
|
|
21510
|
-
|
|
21511
|
-
var hasRequiredIsoWeek;
|
|
21512
|
-
|
|
21513
|
-
function requireIsoWeek () {
|
|
21514
|
-
if (hasRequiredIsoWeek) return isoWeek$2.exports;
|
|
21515
|
-
hasRequiredIsoWeek = 1;
|
|
21516
|
-
(function (module, exports$1) {
|
|
21517
|
-
!function(e,t){module.exports=t();}(isoWeek$1,(function(){var e="day";return function(t,i,s){var a=function(t){return t.add(4-t.isoWeekday(),e)},d=i.prototype;d.isoWeekYear=function(){return a(this).year()},d.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),e);var i,d,n,o,r=a(this),u=(i=this.isoWeekYear(),d=this.$u,n=(d?s.utc:s)().year(i).startOf("year"),o=4-n.isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,e));return r.diff(u,"week")+1},d.isoWeekday=function(e){return this.$utils().u(e)?this.day()||7:this.day(this.day()%7?e:e-7)};var n=d.startOf;d.startOf=function(e,t){var i=this.$utils(),s=!!i.u(t)||t;return "isoweek"===i.p(e)?s?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):n.bind(this)(e,t)};}}));
|
|
21518
|
-
} (isoWeek$2));
|
|
21519
|
-
return isoWeek$2.exports;
|
|
21520
|
-
}
|
|
21521
|
-
|
|
21522
|
-
var isoWeekExports = requireIsoWeek();
|
|
21523
|
-
var isoWeek = /*@__PURE__*/getDefaultExportFromCjs(isoWeekExports);
|
|
21524
|
-
|
|
21525
|
-
var relativeTime$2 = {exports: {}};
|
|
21526
|
-
|
|
21527
|
-
var relativeTime$1 = relativeTime$2.exports;
|
|
21528
|
-
|
|
21529
|
-
var hasRequiredRelativeTime;
|
|
21530
|
-
|
|
21531
|
-
function requireRelativeTime () {
|
|
21532
|
-
if (hasRequiredRelativeTime) return relativeTime$2.exports;
|
|
21533
|
-
hasRequiredRelativeTime = 1;
|
|
21534
|
-
(function (module, exports$1) {
|
|
21535
|
-
!function(r,e){module.exports=e();}(relativeTime$1,(function(){return function(r,e,t){r=r||{};var n=e.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function i(r,e,t,o){return n.fromToBase(r,e,t,o)}t.en.relativeTime=o,n.fromToBase=function(e,n,i,d,u){for(var f,a,s,l=i.$locale().relativeTime||o,h=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],m=h.length,c=0;c<m;c+=1){var y=h[c];y.d&&(f=d?t(e).diff(i,y.d,true):i.diff(e,y.d,true));var p=(r.rounding||Math.round)(Math.abs(f));if(s=f>0,p<=y.r||!y.r){p<=1&&c>0&&(y=h[c-1]);var v=l[y.l];u&&(p=u(""+p)),a="string"==typeof v?v.replace("%d",p):v(p,n,y.l,s);break}}if(n)return a;var M=s?l.future:l.past;return "function"==typeof M?M(a):M.replace("%s",a)},n.to=function(r,e){return i(r,e,this,true)},n.from=function(r,e){return i(r,e,this)};var d=function(r){return r.$u?t.utc():t()};n.toNow=function(r){return this.to(d(this),r)},n.fromNow=function(r){return this.from(d(this),r)};}}));
|
|
21536
|
-
} (relativeTime$2));
|
|
21537
|
-
return relativeTime$2.exports;
|
|
21538
|
-
}
|
|
21539
|
-
|
|
21540
|
-
var relativeTimeExports = requireRelativeTime();
|
|
21541
|
-
var relativeTime = /*@__PURE__*/getDefaultExportFromCjs(relativeTimeExports);
|
|
21542
|
-
|
|
21543
|
-
var isSameOrBefore$2 = {exports: {}};
|
|
21544
|
-
|
|
21545
|
-
var isSameOrBefore$1 = isSameOrBefore$2.exports;
|
|
21546
|
-
|
|
21547
|
-
var hasRequiredIsSameOrBefore;
|
|
21548
|
-
|
|
21549
|
-
function requireIsSameOrBefore () {
|
|
21550
|
-
if (hasRequiredIsSameOrBefore) return isSameOrBefore$2.exports;
|
|
21551
|
-
hasRequiredIsSameOrBefore = 1;
|
|
21552
|
-
(function (module, exports$1) {
|
|
21553
|
-
!function(e,i){module.exports=i();}(isSameOrBefore$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
21554
|
-
} (isSameOrBefore$2));
|
|
21555
|
-
return isSameOrBefore$2.exports;
|
|
21556
|
-
}
|
|
21557
|
-
|
|
21558
|
-
var isSameOrBeforeExports = requireIsSameOrBefore();
|
|
21559
|
-
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
|
|
21560
|
-
|
|
21561
|
-
var isSameOrAfter$2 = {exports: {}};
|
|
21562
|
-
|
|
21563
|
-
var isSameOrAfter$1 = isSameOrAfter$2.exports;
|
|
21564
|
-
|
|
21565
|
-
var hasRequiredIsSameOrAfter;
|
|
21566
|
-
|
|
21567
|
-
function requireIsSameOrAfter () {
|
|
21568
|
-
if (hasRequiredIsSameOrAfter) return isSameOrAfter$2.exports;
|
|
21569
|
-
hasRequiredIsSameOrAfter = 1;
|
|
21570
|
-
(function (module, exports$1) {
|
|
21571
|
-
!function(e,t){module.exports=t();}(isSameOrAfter$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
21572
|
-
} (isSameOrAfter$2));
|
|
21573
|
-
return isSameOrAfter$2.exports;
|
|
21574
|
-
}
|
|
21575
|
-
|
|
21576
|
-
var isSameOrAfterExports = requireIsSameOrAfter();
|
|
21577
|
-
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
|
|
21578
|
-
|
|
21579
|
-
dayjs.extend(relativeTime);
|
|
21580
|
-
dayjs.extend(isoWeek);
|
|
21581
|
-
dayjs.extend(isSameOrBefore);
|
|
21582
|
-
dayjs.extend(isSameOrAfter);
|
|
21583
|
-
dayjs.locale('ko');
|
|
21584
|
-
const isToday = (from, to) => {
|
|
21585
|
-
const now = new Date();
|
|
21586
|
-
const date = new Date(now.toLocaleString('en-US', {
|
|
21587
|
-
timeZone: 'Asia/Seoul'
|
|
21588
|
-
}));
|
|
21589
|
-
const today = date.getFullYear() + String(date.getMonth() + 1).padStart(2, '0') + String(date.getDate()).padStart(2, '0');
|
|
21590
|
-
return from === today && to === today;
|
|
21591
|
-
};
|
|
21592
|
-
const isOneDay = (from, to) => {
|
|
21593
|
-
return from === to;
|
|
21594
|
-
};
|
|
21595
|
-
const formatDateRange = (from, to) => {
|
|
21596
|
-
const fromDate = dayjs(from, 'YYYYMMDD');
|
|
21597
|
-
const toDate = dayjs(to, 'YYYYMMDD');
|
|
21598
|
-
const today = dayjs().startOf('day');
|
|
21599
|
-
if (from === to) return formatSingleDate(fromDate, today);
|
|
21600
|
-
return formatRange(fromDate, toDate, today);
|
|
21454
|
+
tooltip += '</div>';
|
|
21455
|
+
return tooltip;
|
|
21601
21456
|
};
|
|
21602
|
-
|
|
21603
|
-
|
|
21604
|
-
|
|
21605
|
-
|
|
21606
|
-
|
|
21607
|
-
|
|
21457
|
+
function formatDate(data, format) {
|
|
21458
|
+
return Highcharts$1.dateFormat(format, data.getTime() - data.getTimezoneOffset() * 60000);
|
|
21459
|
+
}
|
|
21460
|
+
const ZIndex = {
|
|
21461
|
+
AVERAGE_LINE_BASE: 10,
|
|
21462
|
+
COMPARE_CHART_BASE: 5,
|
|
21463
|
+
NOW_BORDER: 2,
|
|
21464
|
+
NOW_BAND: 1
|
|
21608
21465
|
};
|
|
21609
|
-
|
|
21610
|
-
|
|
21611
|
-
|
|
21612
|
-
|
|
21613
|
-
|
|
21614
|
-
|
|
21615
|
-
|
|
21616
|
-
|
|
21617
|
-
|
|
21618
|
-
|
|
21619
|
-
|
|
21620
|
-
|
|
21621
|
-
|
|
21622
|
-
const twoWeeksAgoEnd = today.subtract(2, 'week').endOf('week');
|
|
21623
|
-
if (fromDate.isSame(twoWeeksAgoStart, 'day') && toDate.isSame(twoWeeksAgoEnd, 'day')) {
|
|
21624
|
-
return '지지난주';
|
|
21625
|
-
}
|
|
21626
|
-
const thisMonthStart = today.startOf('month');
|
|
21627
|
-
const thisMonthEnd = today.endOf('month');
|
|
21628
|
-
if (fromDate.isSame(thisMonthStart, 'day') && (toDate.isSame(today, 'day') || toDate.isSame(thisMonthEnd, 'day'))) {
|
|
21629
|
-
return '이번달';
|
|
21630
|
-
}
|
|
21631
|
-
const lastMonthStart = today.subtract(1, 'month').startOf('month');
|
|
21632
|
-
const lastMonthEnd = today.subtract(1, 'month').endOf('month');
|
|
21633
|
-
if (fromDate.isSame(lastMonthStart, 'day') && toDate.isSame(lastMonthEnd, 'day')) {
|
|
21634
|
-
return '지난달';
|
|
21635
|
-
}
|
|
21636
|
-
const twoMonthsAgoStart = today.subtract(2, 'month').startOf('month');
|
|
21637
|
-
const twoMonthsAgoEnd = today.subtract(2, 'month').endOf('month');
|
|
21638
|
-
if (fromDate.isSame(twoMonthsAgoStart, 'day') && toDate.isSame(twoMonthsAgoEnd, 'day')) {
|
|
21639
|
-
return '지지난달';
|
|
21466
|
+
function stackingType(stacking) {
|
|
21467
|
+
return stacking ? stacking.toLowerCase() : '';
|
|
21468
|
+
}
|
|
21469
|
+
function pieCenters(count) {
|
|
21470
|
+
switch (count) {
|
|
21471
|
+
case 2:
|
|
21472
|
+
return [['25%', '50%'], ['75%', '50%']];
|
|
21473
|
+
case 3:
|
|
21474
|
+
return [['25%', '25%'], ['75%', '25%'], ['50%', '75%']];
|
|
21475
|
+
case 4:
|
|
21476
|
+
return [['25%', '25%'], ['75%', '25%'], ['25%', '75%'], ['75%', '75%']];
|
|
21477
|
+
default:
|
|
21478
|
+
return [];
|
|
21640
21479
|
}
|
|
21641
|
-
const fromFormatted = formatDateInRange(fromDate, today);
|
|
21642
|
-
const toFormatted = formatDateInRange(toDate, today);
|
|
21643
|
-
return `${fromFormatted} ~ ${toFormatted}`;
|
|
21644
|
-
};
|
|
21645
|
-
const formatDateInRange = (date, today) => {
|
|
21646
|
-
const diffDays = today.diff(date, 'day');
|
|
21647
|
-
if (diffDays === 0) return '오늘';
|
|
21648
|
-
if (diffDays === 1) return '어제';
|
|
21649
|
-
if (diffDays === 2) return '그제';
|
|
21650
|
-
return date.format('YYYY년 M월 D일');
|
|
21651
|
-
};
|
|
21652
|
-
|
|
21653
|
-
const ColumnChartContent = ({
|
|
21654
|
-
tools = []
|
|
21655
|
-
}) => {
|
|
21656
|
-
const {
|
|
21657
|
-
configMap
|
|
21658
|
-
} = useToolContext();
|
|
21659
|
-
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, tools.length > 0 && /*#__PURE__*/React$1.createElement("div", {
|
|
21660
|
-
style: {
|
|
21661
|
-
display: 'flex',
|
|
21662
|
-
justifyContent: 'center',
|
|
21663
|
-
marginBottom: '30px'
|
|
21664
|
-
}
|
|
21665
|
-
}, /*#__PURE__*/React$1.createElement(ColumnChart, {
|
|
21666
|
-
data: toData$1(tools, configMap)
|
|
21667
|
-
})));
|
|
21668
|
-
};
|
|
21669
|
-
function toData$1(tools, configMap) {
|
|
21670
|
-
const items = [];
|
|
21671
|
-
const hasConvert = tools.some(content => content.result?.result[0]?.metric?.filter !== undefined);
|
|
21672
|
-
tools.sort((a, b) => a.arguments.from.localeCompare(b.arguments.from)).forEach(content => {
|
|
21673
|
-
const {
|
|
21674
|
-
taskId,
|
|
21675
|
-
from,
|
|
21676
|
-
to
|
|
21677
|
-
} = content.arguments;
|
|
21678
|
-
const item = {
|
|
21679
|
-
name: `<b>${configMap.get(taskId)}</b> <span style="font-size:10px">(${formatDateRange(from, to)})</span>`,
|
|
21680
|
-
data: []
|
|
21681
|
-
};
|
|
21682
|
-
const result = reduce(content.result.result);
|
|
21683
|
-
item.data.push(result.input);
|
|
21684
|
-
item.data.push(result.output);
|
|
21685
|
-
if (hasConvert) item.data.push(result.filter);
|
|
21686
|
-
item.data.push(result.error);
|
|
21687
|
-
items.push(item);
|
|
21688
|
-
});
|
|
21689
|
-
return {
|
|
21690
|
-
colors: hasConvert ? ['#333333', '#2652a8', '#b47813', '#aa1a32'] : ['#333333', '#2652a8', '#aa1a32'],
|
|
21691
|
-
categories: hasConvert ? ['입력', '처리', '필터', '에러'] : ['입력', '처리', '에러'],
|
|
21692
|
-
series: items
|
|
21693
|
-
};
|
|
21694
21480
|
}
|
|
21695
|
-
function
|
|
21696
|
-
|
|
21697
|
-
|
|
21698
|
-
|
|
21699
|
-
|
|
21700
|
-
|
|
21701
|
-
|
|
21702
|
-
|
|
21703
|
-
|
|
21704
|
-
|
|
21705
|
-
|
|
21706
|
-
|
|
21707
|
-
|
|
21481
|
+
function pieSize(count) {
|
|
21482
|
+
switch (count) {
|
|
21483
|
+
case 3:
|
|
21484
|
+
return '50%';
|
|
21485
|
+
case 4:
|
|
21486
|
+
return '25%';
|
|
21487
|
+
default:
|
|
21488
|
+
return null;
|
|
21489
|
+
}
|
|
21490
|
+
}
|
|
21491
|
+
|
|
21492
|
+
function TrendChart({
|
|
21493
|
+
colorIndex = 0,
|
|
21494
|
+
legendColors,
|
|
21495
|
+
isDaily,
|
|
21496
|
+
isRealtime,
|
|
21497
|
+
...props
|
|
21498
|
+
}) {
|
|
21499
|
+
const colors = React$1.useMemo(() => {
|
|
21500
|
+
return all[colorIndex % all.length];
|
|
21501
|
+
}, [colorIndex]);
|
|
21502
|
+
const tooltip = React$1.useMemo(() => ({
|
|
21503
|
+
dateFormat: isRealtime ? '%H:%M' : '%Y-%m-%d',
|
|
21504
|
+
headerTime: !isDaily && !isRealtime,
|
|
21505
|
+
outside: props.tooltipOutSide,
|
|
21506
|
+
legendColors
|
|
21507
|
+
}), [isRealtime, isDaily, props.tooltipOutSide, legendColors]);
|
|
21508
|
+
return /*#__PURE__*/React.createElement(Chart, _extends({
|
|
21509
|
+
type: "areaspline",
|
|
21510
|
+
categorize: true,
|
|
21511
|
+
xAxisType: "datetime",
|
|
21512
|
+
xAxisLabelFormat: isDaily ? '%m-%d' : '%H:%M',
|
|
21513
|
+
colors: colors,
|
|
21514
|
+
tooltip: tooltip
|
|
21515
|
+
}, props));
|
|
21516
|
+
}
|
|
21517
|
+
|
|
21518
|
+
function StackedAreaTrendChart({
|
|
21519
|
+
metrics,
|
|
21520
|
+
records,
|
|
21521
|
+
isDaily = false,
|
|
21522
|
+
xPlotIndex,
|
|
21523
|
+
xAxisTickInterval,
|
|
21524
|
+
yAxisLabelEnabled = false,
|
|
21525
|
+
legendLimit = 3,
|
|
21526
|
+
colors = defaultColors,
|
|
21527
|
+
...props
|
|
21528
|
+
}) {
|
|
21529
|
+
const _metrics = React$1.useMemo(() => {
|
|
21530
|
+
return metrics.map(m => ({
|
|
21531
|
+
metric: m.id,
|
|
21532
|
+
chartType: 'area'
|
|
21533
|
+
}));
|
|
21534
|
+
}, [metrics]);
|
|
21535
|
+
const metas = React$1.useMemo(() => {
|
|
21536
|
+
const result = {
|
|
21537
|
+
time: {
|
|
21538
|
+
name: "일시",
|
|
21539
|
+
type: "DATE"
|
|
21540
|
+
}
|
|
21541
|
+
};
|
|
21542
|
+
metrics.forEach(m => {
|
|
21543
|
+
result[m.id] = {
|
|
21544
|
+
name: m.name,
|
|
21545
|
+
type: "NUMBER"
|
|
21546
|
+
};
|
|
21547
|
+
});
|
|
21548
|
+
return result;
|
|
21549
|
+
}, [metrics]);
|
|
21550
|
+
return /*#__PURE__*/React.createElement(TrendChart, _extends({
|
|
21551
|
+
dimension: "time",
|
|
21552
|
+
stacking: "normal",
|
|
21553
|
+
metrics: _metrics,
|
|
21554
|
+
metas: metas,
|
|
21555
|
+
records: records,
|
|
21556
|
+
isRealtime: xPlotIndex !== undefined,
|
|
21557
|
+
isDaily: isDaily,
|
|
21558
|
+
xPlotIndex: xPlotIndex,
|
|
21559
|
+
xAxisTickInterval: xAxisTickInterval,
|
|
21560
|
+
yAxisLabelEnabled: yAxisLabelEnabled,
|
|
21561
|
+
legendLimit: legendLimit,
|
|
21562
|
+
colors: colors
|
|
21563
|
+
}, props));
|
|
21708
21564
|
}
|
|
21565
|
+
const defaultColors = [["rgba(54,115,237,0.8)", "#3673ed"], ["rgba(149,77,241,0.8)", "#954df1"], ["#4dc391", "#20b476"], ["#fbba3d", "#faa90c"], ["#f2426d", "#ef1348"]];
|
|
21709
21566
|
|
|
21710
21567
|
function StackedAreaChartContent({
|
|
21711
21568
|
tools
|
|
@@ -21799,6 +21656,162 @@ function xPlotIndex(tools) {
|
|
|
21799
21656
|
}
|
|
21800
21657
|
}
|
|
21801
21658
|
|
|
21659
|
+
const PieChart = ({
|
|
21660
|
+
data,
|
|
21661
|
+
width = 230,
|
|
21662
|
+
height = 180,
|
|
21663
|
+
size = '60%',
|
|
21664
|
+
colors = ['#2652a8', '#b47813', '#aa1a32']
|
|
21665
|
+
}) => {
|
|
21666
|
+
const noData = data.metrics.some(m => m.transparent);
|
|
21667
|
+
const options = React$1.useMemo(() => {
|
|
21668
|
+
const chartData = data.metrics.filter(metric => metric.transparent || metric.value > 0).map((metric, index) => ({
|
|
21669
|
+
name: metric.label,
|
|
21670
|
+
y: metric.value,
|
|
21671
|
+
color: metric.transparent ? checkerboardPattern() : colors[index % colors.length]
|
|
21672
|
+
}));
|
|
21673
|
+
return {
|
|
21674
|
+
chart: {
|
|
21675
|
+
type: 'pie',
|
|
21676
|
+
backgroundColor: 'transparent',
|
|
21677
|
+
width: width,
|
|
21678
|
+
height: height,
|
|
21679
|
+
style: {
|
|
21680
|
+
fontFamily: fontFamily
|
|
21681
|
+
}
|
|
21682
|
+
},
|
|
21683
|
+
title: {
|
|
21684
|
+
text: undefined
|
|
21685
|
+
},
|
|
21686
|
+
tooltip: {
|
|
21687
|
+
pointFormat: '<span><b>{point.y}</b> ({point.percentage:.1f}%)</span>',
|
|
21688
|
+
style: {
|
|
21689
|
+
fontFamily: fontFamily,
|
|
21690
|
+
fontSize: '13px'
|
|
21691
|
+
},
|
|
21692
|
+
useHTML: true
|
|
21693
|
+
},
|
|
21694
|
+
plotOptions: {
|
|
21695
|
+
pie: {
|
|
21696
|
+
size: size,
|
|
21697
|
+
allowPointSelect: true,
|
|
21698
|
+
cursor: 'pointer',
|
|
21699
|
+
dataLabels: {
|
|
21700
|
+
enabled: true,
|
|
21701
|
+
format: '{point.name}<br><b>{point.y}</b> ({point.percentage:.1f}%)',
|
|
21702
|
+
distance: 20,
|
|
21703
|
+
style: {
|
|
21704
|
+
fontSize: '13px',
|
|
21705
|
+
fontWeight: '100',
|
|
21706
|
+
textOutline: 'none',
|
|
21707
|
+
fontFamily: fontFamily
|
|
21708
|
+
},
|
|
21709
|
+
connectorColor: '#666',
|
|
21710
|
+
connectorWidth: 1,
|
|
21711
|
+
overflow: 'allow',
|
|
21712
|
+
crop: false
|
|
21713
|
+
},
|
|
21714
|
+
showInLegend: false
|
|
21715
|
+
}
|
|
21716
|
+
},
|
|
21717
|
+
series: [{
|
|
21718
|
+
type: 'pie',
|
|
21719
|
+
name: '',
|
|
21720
|
+
colorByPoint: true,
|
|
21721
|
+
data: chartData
|
|
21722
|
+
}],
|
|
21723
|
+
credits: {
|
|
21724
|
+
enabled: false
|
|
21725
|
+
},
|
|
21726
|
+
accessibility: {
|
|
21727
|
+
enabled: false
|
|
21728
|
+
}
|
|
21729
|
+
};
|
|
21730
|
+
}, [data, width, height, size, colors]);
|
|
21731
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
21732
|
+
style: styles$6.chartWrapper
|
|
21733
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
21734
|
+
style: {
|
|
21735
|
+
...styles$6.chartContainer,
|
|
21736
|
+
width,
|
|
21737
|
+
height,
|
|
21738
|
+
position: 'relative'
|
|
21739
|
+
}
|
|
21740
|
+
}, noData && /*#__PURE__*/React$1.createElement(CheckerboardBackground, {
|
|
21741
|
+
width: width,
|
|
21742
|
+
height: height
|
|
21743
|
+
}), /*#__PURE__*/React$1.createElement("div", {
|
|
21744
|
+
style: {
|
|
21745
|
+
position: 'relative',
|
|
21746
|
+
zIndex: 1
|
|
21747
|
+
}
|
|
21748
|
+
}, /*#__PURE__*/React$1.createElement(HighchartsReact, {
|
|
21749
|
+
highcharts: Highcharts$1,
|
|
21750
|
+
options: options
|
|
21751
|
+
}))), /*#__PURE__*/React$1.createElement("div", {
|
|
21752
|
+
style: styles$6.agentName
|
|
21753
|
+
}, data.name));
|
|
21754
|
+
};
|
|
21755
|
+
const fontFamily = 'Pretendard, -apple-system, BlinkMacSystemFont, sans-serif';
|
|
21756
|
+
const styles$6 = {
|
|
21757
|
+
chartWrapper: {
|
|
21758
|
+
background: 'transparent',
|
|
21759
|
+
textAlign: 'center',
|
|
21760
|
+
display: 'flex',
|
|
21761
|
+
flexDirection: 'column',
|
|
21762
|
+
justifyContent: 'center',
|
|
21763
|
+
alignItems: 'center'
|
|
21764
|
+
},
|
|
21765
|
+
chartContainer: {
|
|
21766
|
+
display: 'flex',
|
|
21767
|
+
alignItems: 'center',
|
|
21768
|
+
justifyContent: 'center'
|
|
21769
|
+
},
|
|
21770
|
+
agentName: {
|
|
21771
|
+
fontSize: '12px',
|
|
21772
|
+
fontWeight: '100',
|
|
21773
|
+
marginTop: '-30px',
|
|
21774
|
+
color: '#333'
|
|
21775
|
+
}
|
|
21776
|
+
};
|
|
21777
|
+
const CheckerboardBackground = ({
|
|
21778
|
+
width,
|
|
21779
|
+
height
|
|
21780
|
+
}) => {
|
|
21781
|
+
const circleSize = Math.min(width, height) * 0.47;
|
|
21782
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
21783
|
+
style: {
|
|
21784
|
+
position: 'absolute',
|
|
21785
|
+
width: circleSize,
|
|
21786
|
+
height: circleSize,
|
|
21787
|
+
borderRadius: '50%',
|
|
21788
|
+
backgroundImage: `
|
|
21789
|
+
linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
|
|
21790
|
+
linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
|
|
21791
|
+
linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
|
|
21792
|
+
linear-gradient(-45deg, transparent 75%, #e0e0e0 75%)
|
|
21793
|
+
`,
|
|
21794
|
+
backgroundSize: '10px 10px',
|
|
21795
|
+
backgroundPosition: '0 0, 0 5px, 5px -5px, -5px 0px',
|
|
21796
|
+
backgroundColor: '#ffffff',
|
|
21797
|
+
zIndex: 0
|
|
21798
|
+
}
|
|
21799
|
+
});
|
|
21800
|
+
};
|
|
21801
|
+
const checkerboardPattern = () => ({
|
|
21802
|
+
pattern: {
|
|
21803
|
+
path: {
|
|
21804
|
+
d: 'M 0 0 L 5 5 M 4.5 -0.5 L 5.5 0.5 M -0.5 4.5 L 0.5 5.5',
|
|
21805
|
+
stroke: '#d0d0d0',
|
|
21806
|
+
strokeWidth: 1
|
|
21807
|
+
},
|
|
21808
|
+
width: 5,
|
|
21809
|
+
height: 5,
|
|
21810
|
+
backgroundColor: '#ffffff',
|
|
21811
|
+
opacity: 1
|
|
21812
|
+
}
|
|
21813
|
+
});
|
|
21814
|
+
|
|
21802
21815
|
const PieChartContent = ({
|
|
21803
21816
|
tool
|
|
21804
21817
|
}) => {
|
|
@@ -22198,13 +22211,6 @@ const styles$1 = {
|
|
|
22198
22211
|
}
|
|
22199
22212
|
};
|
|
22200
22213
|
|
|
22201
|
-
let globalConfig = {
|
|
22202
|
-
apiUrl: ''
|
|
22203
|
-
};
|
|
22204
|
-
function getConfig() {
|
|
22205
|
-
return globalConfig;
|
|
22206
|
-
}
|
|
22207
|
-
|
|
22208
22214
|
const {
|
|
22209
22215
|
apiUrl
|
|
22210
22216
|
} = getConfig();
|
|
@@ -22333,3 +22339,5 @@ exports.AiChat = AiChat;
|
|
|
22333
22339
|
exports.ColumnChart = ColumnChart;
|
|
22334
22340
|
exports.PieChart = PieChart;
|
|
22335
22341
|
exports.StackedAreaTrendChart = StackedAreaTrendChart;
|
|
22342
|
+
exports.configure = configure$1;
|
|
22343
|
+
exports.getConfig = getConfig;
|