react-use-echarts 0.0.11 → 1.0.0

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.es.js CHANGED
@@ -1,83 +1,1096 @@
1
- import { useRef as v, useCallback as a, useEffect as u } from "react";
2
- import * as k from "echarts";
3
- const M = ({
4
- /** Chart configuration */
5
- option: f,
6
- /** Theme name */
7
- theme: i,
8
- /** Skip merging with previous options */
9
- notMerge: l = !1,
10
- /** Enable lazy update mode */
11
- lazyUpdate: b = !1,
12
- /** Display loading animation */
13
- showLoading: p = !1,
14
- /** Loading animation config */
15
- loadingOption: O,
16
- /** Event handlers map */
17
- onEvents: s
18
- }) => {
19
- const c = v(null), n = v(void 0), C = () => n.current, d = a(
20
- () => ({
21
- option: f,
22
- theme: i,
23
- notMerge: l,
24
- lazyUpdate: b,
25
- showLoading: p,
26
- loadingOption: O,
27
- onEvents: s
28
- }),
29
- [f, i, l, b, p, O, s]
30
- ), o = a(() => {
31
- if (c.current && !n.current) {
32
- const e = k.init(c.current, i);
33
- n.current = e;
34
- const r = d();
35
- return r.onEvents && Object.entries(r.onEvents).forEach(
36
- ([t, { handler: h, query: g, context: z }]) => {
37
- g ? e.on(t, g, h, z) : e.on(t, h, z);
38
- }
39
- ), r.showLoading ? e.showLoading(r.loadingOption) : e.hideLoading(), e.setOption(r.option, {
40
- notMerge: r.notMerge,
41
- lazyUpdate: r.lazyUpdate
42
- }), e;
43
- }
44
- return n.current;
45
- }, [d, i]), R = a(
46
- (e, r) => {
47
- queueMicrotask(() => {
48
- const t = n.current || o();
49
- t && t.setOption(e, r);
50
- });
51
- },
52
- [o]
53
- );
54
- return u(() => {
55
- const e = n.current;
56
- if (!e || !c.current) return;
57
- let r;
58
- try {
59
- r = new ResizeObserver(() => {
60
- e.resize();
61
- }), r.observe(c.current);
62
- } catch (t) {
63
- console.warn("ResizeObserver not available:", t);
64
- }
65
- return () => {
66
- r?.disconnect();
67
- };
68
- }, []), u(() => {
69
- c.current && queueMicrotask(o);
70
- }, [c, o]), u(() => () => {
71
- const e = n.current;
72
- e && (s && Object.entries(s).forEach(([r, { handler: t }]) => {
73
- e.off(r, t);
74
- }), e.dispose(), n.current = void 0);
75
- }, [s]), {
76
- chartRef: c,
77
- setOption: R,
78
- getInstance: C
79
- };
80
- };
81
- export {
82
- M as useEcharts
83
- };
1
+ import { useEffect, useLayoutEffect, useRef, useState } from "react";
2
+ import * as echarts from "echarts";
3
+ var __commonJSMin = (e, l) => () => (l || e((l = { exports: {} }).exports, l), l.exports), __require = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, l) => (typeof require < "u" ? require : e)[l] }) : e)(function(e) {
4
+ if (typeof require < "u") return require.apply(this, arguments);
5
+ throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function.");
6
+ }), require_react_compiler_runtime_production = /* @__PURE__ */ __commonJSMin(((e) => {
7
+ var l = __require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
8
+ e.c = function(e) {
9
+ return l.H.useMemoCache(e);
10
+ };
11
+ })), require_react_compiler_runtime_development = /* @__PURE__ */ __commonJSMin(((e) => {
12
+ process.env.NODE_ENV !== "production" && (function() {
13
+ var l = __require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
14
+ e.c = function(e) {
15
+ var u = l.H;
16
+ return u === null && console.error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."), u.useMemoCache(e);
17
+ };
18
+ })();
19
+ })), import_compiler_runtime = (/* @__PURE__ */ __commonJSMin(((e, l) => {
20
+ process.env.NODE_ENV === "production" ? l.exports = require_react_compiler_runtime_production() : l.exports = require_react_compiler_runtime_development();
21
+ })))();
22
+ function useLazyInit(l, f = !1) {
23
+ let p = f !== !1, [m, h] = useState(!p), g = useRef(f);
24
+ return g.current = f, useEffect(() => {
25
+ if (!p || m) return;
26
+ let e = l.current;
27
+ if (!e) return;
28
+ let u = g.current, d = {
29
+ root: null,
30
+ rootMargin: "50px",
31
+ threshold: .1,
32
+ ...typeof u == "object" ? u : {}
33
+ }, f = new IntersectionObserver((e) => {
34
+ let [l] = e;
35
+ l.isIntersecting && (h(!0), f.disconnect());
36
+ }, d);
37
+ return f.observe(e), () => {
38
+ f.disconnect();
39
+ };
40
+ }, [
41
+ l,
42
+ p,
43
+ m
44
+ ]), m;
45
+ }
46
+ var instanceCache = /* @__PURE__ */ new WeakMap(), trackedElements = /* @__PURE__ */ new Set();
47
+ function getCachedInstance(e) {
48
+ return instanceCache.get(e)?.instance;
49
+ }
50
+ function setCachedInstance(e, l) {
51
+ let u = instanceCache.get(e);
52
+ return u ? (u.refCount += 1, u.instance) : (instanceCache.set(e, {
53
+ instance: l,
54
+ refCount: 1
55
+ }), trackedElements.add(e), l);
56
+ }
57
+ function replaceCachedInstance(e, l) {
58
+ let u = instanceCache.get(e);
59
+ return u ? (u.instance.dispose(), u.instance = l, l) : (instanceCache.set(e, {
60
+ instance: l,
61
+ refCount: 1
62
+ }), trackedElements.add(e), l);
63
+ }
64
+ function releaseCachedInstance(e) {
65
+ let l = instanceCache.get(e);
66
+ l && (--l.refCount, l.refCount <= 0 && (l.instance.dispose(), instanceCache.delete(e), trackedElements.delete(e)));
67
+ }
68
+ function getReferenceCount(e) {
69
+ return instanceCache.get(e)?.refCount ?? 0;
70
+ }
71
+ function clearInstanceCache() {
72
+ for (let e of trackedElements) instanceCache.get(e)?.instance.dispose();
73
+ instanceCache = /* @__PURE__ */ new WeakMap(), trackedElements.clear();
74
+ }
75
+ var groupRegistry = /* @__PURE__ */ new Map();
76
+ function addToGroup(e, l) {
77
+ let u = groupRegistry.get(l);
78
+ u || (u = /* @__PURE__ */ new Set(), groupRegistry.set(l, u)), u.add(e), u.size > 1 && echarts.connect(l);
79
+ }
80
+ function removeFromGroup(e, l) {
81
+ let u = groupRegistry.get(l);
82
+ u && (u.delete(e), u.size === 0 ? (groupRegistry.delete(l), echarts.disconnect(l)) : u.size === 1 ? echarts.disconnect(l) : echarts.connect(l));
83
+ }
84
+ function updateGroup(e, l, u) {
85
+ l && removeFromGroup(e, l), u && addToGroup(e, u);
86
+ }
87
+ function getGroupInstances(e) {
88
+ let l = groupRegistry.get(e);
89
+ return l ? Array.from(l) : [];
90
+ }
91
+ function getInstanceGroup(e) {
92
+ for (let [l, u] of groupRegistry.entries()) if (u.has(e)) return l;
93
+ }
94
+ function isInGroup(e) {
95
+ return getInstanceGroup(e) !== void 0;
96
+ }
97
+ function clearGroups() {
98
+ for (let e of groupRegistry.keys()) echarts.disconnect(e);
99
+ groupRegistry.clear();
100
+ }
101
+ var themeRegistry = new Map([
102
+ ["light", {
103
+ color: [
104
+ "#5470c6",
105
+ "#91cc75",
106
+ "#fac858",
107
+ "#ee6666",
108
+ "#73c0de",
109
+ "#3ba272",
110
+ "#fc8452",
111
+ "#9a60b4",
112
+ "#ea7ccc"
113
+ ],
114
+ backgroundColor: "rgba(0,0,0,0)",
115
+ textStyle: {},
116
+ title: { textStyle: { color: "#464646" } },
117
+ line: {
118
+ itemStyle: { borderWidth: 1 },
119
+ lineStyle: { width: 2 },
120
+ symbolSize: 4,
121
+ symbol: "emptyCircle",
122
+ smooth: !1
123
+ },
124
+ radar: {
125
+ itemStyle: { borderWidth: 1 },
126
+ lineStyle: { width: 2 },
127
+ symbolSize: 4,
128
+ symbol: "emptyCircle",
129
+ smooth: !1
130
+ },
131
+ bar: { itemStyle: {
132
+ barBorderWidth: 0,
133
+ barBorderColor: "#ccc"
134
+ } },
135
+ pie: { itemStyle: {
136
+ borderWidth: 0,
137
+ borderColor: "#ccc"
138
+ } },
139
+ scatter: { itemStyle: {
140
+ borderWidth: 0,
141
+ borderColor: "#ccc"
142
+ } },
143
+ boxplot: { itemStyle: {
144
+ borderWidth: 0,
145
+ borderColor: "#ccc"
146
+ } },
147
+ parallel: { itemStyle: {
148
+ borderWidth: 0,
149
+ borderColor: "#ccc"
150
+ } },
151
+ sankey: { itemStyle: {
152
+ borderWidth: 0,
153
+ borderColor: "#ccc"
154
+ } },
155
+ funnel: { itemStyle: {
156
+ borderWidth: 0,
157
+ borderColor: "#ccc"
158
+ } },
159
+ gauge: { itemStyle: {
160
+ borderWidth: 0,
161
+ borderColor: "#ccc"
162
+ } },
163
+ candlestick: { itemStyle: {
164
+ color: "#eb5454",
165
+ color0: "#47b262",
166
+ borderColor: "#eb5454",
167
+ borderColor0: "#47b262",
168
+ borderWidth: 1
169
+ } },
170
+ graph: {
171
+ itemStyle: {
172
+ borderWidth: 0,
173
+ borderColor: "#ccc"
174
+ },
175
+ lineStyle: {
176
+ width: 1,
177
+ color: "#aaa"
178
+ },
179
+ symbolSize: 4,
180
+ symbol: "emptyCircle",
181
+ smooth: !1,
182
+ color: [
183
+ "#5470c6",
184
+ "#91cc75",
185
+ "#fac858",
186
+ "#ee6666",
187
+ "#73c0de",
188
+ "#3ba272",
189
+ "#fc8452",
190
+ "#9a60b4",
191
+ "#ea7ccc"
192
+ ],
193
+ label: { color: "#eee" }
194
+ },
195
+ map: {
196
+ itemStyle: {
197
+ areaColor: "#eee",
198
+ borderColor: "#444",
199
+ borderWidth: .5
200
+ },
201
+ label: { color: "#000" },
202
+ emphasis: {
203
+ itemStyle: {
204
+ areaColor: "rgba(255,215,0,0.8)",
205
+ borderColor: "#444",
206
+ borderWidth: 1
207
+ },
208
+ label: { color: "rgb(100,0,0)" }
209
+ }
210
+ },
211
+ geo: {
212
+ itemStyle: {
213
+ areaColor: "#eee",
214
+ borderColor: "#444",
215
+ borderWidth: .5
216
+ },
217
+ label: { color: "#000" },
218
+ emphasis: {
219
+ itemStyle: {
220
+ areaColor: "rgba(255,215,0,0.8)",
221
+ borderColor: "#444",
222
+ borderWidth: 1
223
+ },
224
+ label: { color: "rgb(100,0,0)" }
225
+ }
226
+ },
227
+ categoryAxis: {
228
+ axisLine: {
229
+ show: !0,
230
+ lineStyle: { color: "#333" }
231
+ },
232
+ axisTick: {
233
+ show: !0,
234
+ lineStyle: { color: "#333" }
235
+ },
236
+ axisLabel: {
237
+ show: !0,
238
+ color: "#333"
239
+ },
240
+ splitLine: {
241
+ show: !1,
242
+ lineStyle: { color: ["#ccc"] }
243
+ },
244
+ splitArea: {
245
+ show: !1,
246
+ areaStyle: { color: ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"] }
247
+ }
248
+ },
249
+ valueAxis: {
250
+ axisLine: {
251
+ show: !0,
252
+ lineStyle: { color: "#333" }
253
+ },
254
+ axisTick: {
255
+ show: !0,
256
+ lineStyle: { color: "#333" }
257
+ },
258
+ axisLabel: {
259
+ show: !0,
260
+ color: "#333"
261
+ },
262
+ splitLine: {
263
+ show: !0,
264
+ lineStyle: { color: ["#ccc"] }
265
+ },
266
+ splitArea: {
267
+ show: !1,
268
+ areaStyle: { color: ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"] }
269
+ }
270
+ },
271
+ logAxis: {
272
+ axisLine: {
273
+ show: !0,
274
+ lineStyle: { color: "#333" }
275
+ },
276
+ axisTick: {
277
+ show: !0,
278
+ lineStyle: { color: "#333" }
279
+ },
280
+ axisLabel: {
281
+ show: !0,
282
+ color: "#333"
283
+ },
284
+ splitLine: {
285
+ show: !0,
286
+ lineStyle: { color: ["#ccc"] }
287
+ },
288
+ splitArea: {
289
+ show: !1,
290
+ areaStyle: { color: ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"] }
291
+ }
292
+ },
293
+ timeAxis: {
294
+ axisLine: {
295
+ show: !0,
296
+ lineStyle: { color: "#333" }
297
+ },
298
+ axisTick: {
299
+ show: !0,
300
+ lineStyle: { color: "#333" }
301
+ },
302
+ axisLabel: {
303
+ show: !0,
304
+ color: "#333"
305
+ },
306
+ splitLine: {
307
+ show: !0,
308
+ lineStyle: { color: ["#ccc"] }
309
+ },
310
+ splitArea: {
311
+ show: !1,
312
+ areaStyle: { color: ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"] }
313
+ }
314
+ },
315
+ toolbox: {
316
+ iconStyle: { borderColor: "#999" },
317
+ emphasis: { iconStyle: { borderColor: "#666" } }
318
+ },
319
+ legend: { textStyle: { color: "#333" } },
320
+ tooltip: { axisPointer: {
321
+ lineStyle: {
322
+ color: "#ccc",
323
+ width: 1
324
+ },
325
+ crossStyle: {
326
+ color: "#ccc",
327
+ width: 1
328
+ }
329
+ } },
330
+ timeline: {
331
+ lineStyle: {
332
+ color: "#293c55",
333
+ width: 1
334
+ },
335
+ itemStyle: {
336
+ color: "#293c55",
337
+ borderWidth: 1
338
+ },
339
+ controlStyle: {
340
+ color: "#293c55",
341
+ borderColor: "#293c55",
342
+ borderWidth: .5
343
+ },
344
+ checkpointStyle: {
345
+ color: "#e43c59",
346
+ borderColor: "#c23531"
347
+ },
348
+ label: { color: "#293c55" },
349
+ emphasis: {
350
+ itemStyle: { color: "#a9334c" },
351
+ controlStyle: {
352
+ color: "#293c55",
353
+ borderColor: "#293c55",
354
+ borderWidth: .5
355
+ },
356
+ label: { color: "#293c55" }
357
+ }
358
+ },
359
+ visualMap: { color: [
360
+ "#bf444c",
361
+ "#d88273",
362
+ "#f6efa6"
363
+ ] },
364
+ dataZoom: {
365
+ backgroundColor: "rgba(47,69,84,0)",
366
+ dataBackgroundColor: "rgba(255,255,255,0.3)",
367
+ fillerColor: "rgba(167,183,204,0.4)",
368
+ handleColor: "#a7b7cc",
369
+ handleSize: "100%",
370
+ textStyle: { color: "#333" }
371
+ },
372
+ markPoint: {
373
+ label: { color: "#eee" },
374
+ emphasis: { label: { color: "#eee" } }
375
+ }
376
+ }],
377
+ ["dark", {
378
+ color: [
379
+ "#4992ff",
380
+ "#7cffb2",
381
+ "#fddd60",
382
+ "#ff6e76",
383
+ "#58d9f9",
384
+ "#05c091",
385
+ "#ff8a45",
386
+ "#8d4eda",
387
+ "#dd79ff"
388
+ ],
389
+ backgroundColor: "rgba(0,0,0,0)",
390
+ textStyle: {},
391
+ title: { textStyle: { color: "#cccccc" } },
392
+ line: {
393
+ itemStyle: { borderWidth: 1 },
394
+ lineStyle: { width: 2 },
395
+ symbolSize: 4,
396
+ symbol: "emptyCircle",
397
+ smooth: !1
398
+ },
399
+ radar: {
400
+ itemStyle: { borderWidth: 1 },
401
+ lineStyle: { width: 2 },
402
+ symbolSize: 4,
403
+ symbol: "emptyCircle",
404
+ smooth: !1
405
+ },
406
+ bar: { itemStyle: {
407
+ barBorderWidth: 0,
408
+ barBorderColor: "#cccccc"
409
+ } },
410
+ pie: { itemStyle: {
411
+ borderWidth: 0,
412
+ borderColor: "#cccccc"
413
+ } },
414
+ scatter: { itemStyle: {
415
+ borderWidth: 0,
416
+ borderColor: "#cccccc"
417
+ } },
418
+ boxplot: { itemStyle: {
419
+ borderWidth: 0,
420
+ borderColor: "#cccccc"
421
+ } },
422
+ parallel: { itemStyle: {
423
+ borderWidth: 0,
424
+ borderColor: "#cccccc"
425
+ } },
426
+ sankey: { itemStyle: {
427
+ borderWidth: 0,
428
+ borderColor: "#cccccc"
429
+ } },
430
+ funnel: { itemStyle: {
431
+ borderWidth: 0,
432
+ borderColor: "#cccccc"
433
+ } },
434
+ gauge: { itemStyle: {
435
+ borderWidth: 0,
436
+ borderColor: "#cccccc"
437
+ } },
438
+ candlestick: { itemStyle: {
439
+ color: "#eb5454",
440
+ color0: "#47b262",
441
+ borderColor: "#eb5454",
442
+ borderColor0: "#47b262",
443
+ borderWidth: 1
444
+ } },
445
+ graph: {
446
+ itemStyle: {
447
+ borderWidth: 0,
448
+ borderColor: "#cccccc"
449
+ },
450
+ lineStyle: {
451
+ width: 1,
452
+ color: "#aaaaaa"
453
+ },
454
+ symbolSize: 4,
455
+ symbol: "emptyCircle",
456
+ smooth: !1,
457
+ color: [
458
+ "#4992ff",
459
+ "#7cffb2",
460
+ "#fddd60",
461
+ "#ff6e76",
462
+ "#58d9f9",
463
+ "#05c091",
464
+ "#ff8a45",
465
+ "#8d4eda",
466
+ "#dd79ff"
467
+ ],
468
+ label: { color: "#cccccc" }
469
+ },
470
+ map: {
471
+ itemStyle: {
472
+ areaColor: "#2a2a2a",
473
+ borderColor: "#444444",
474
+ borderWidth: .5
475
+ },
476
+ label: { color: "#cccccc" },
477
+ emphasis: {
478
+ itemStyle: {
479
+ areaColor: "rgba(255,215,0,0.8)",
480
+ borderColor: "#444444",
481
+ borderWidth: 1
482
+ },
483
+ label: { color: "rgb(100,0,0)" }
484
+ }
485
+ },
486
+ geo: {
487
+ itemStyle: {
488
+ areaColor: "#2a2a2a",
489
+ borderColor: "#444444",
490
+ borderWidth: .5
491
+ },
492
+ label: { color: "#cccccc" },
493
+ emphasis: {
494
+ itemStyle: {
495
+ areaColor: "rgba(255,215,0,0.8)",
496
+ borderColor: "#444444",
497
+ borderWidth: 1
498
+ },
499
+ label: { color: "rgb(100,0,0)" }
500
+ }
501
+ },
502
+ categoryAxis: {
503
+ axisLine: {
504
+ show: !0,
505
+ lineStyle: { color: "#cccccc" }
506
+ },
507
+ axisTick: {
508
+ show: !0,
509
+ lineStyle: { color: "#cccccc" }
510
+ },
511
+ axisLabel: {
512
+ show: !0,
513
+ color: "#cccccc"
514
+ },
515
+ splitLine: {
516
+ show: !1,
517
+ lineStyle: { color: ["#444444"] }
518
+ },
519
+ splitArea: {
520
+ show: !1,
521
+ areaStyle: { color: ["rgba(255,255,255,0.05)", "rgba(255,255,255,0.1)"] }
522
+ }
523
+ },
524
+ valueAxis: {
525
+ axisLine: {
526
+ show: !0,
527
+ lineStyle: { color: "#cccccc" }
528
+ },
529
+ axisTick: {
530
+ show: !0,
531
+ lineStyle: { color: "#cccccc" }
532
+ },
533
+ axisLabel: {
534
+ show: !0,
535
+ color: "#cccccc"
536
+ },
537
+ splitLine: {
538
+ show: !0,
539
+ lineStyle: { color: ["#444444"] }
540
+ },
541
+ splitArea: {
542
+ show: !1,
543
+ areaStyle: { color: ["rgba(255,255,255,0.05)", "rgba(255,255,255,0.1)"] }
544
+ }
545
+ },
546
+ logAxis: {
547
+ axisLine: {
548
+ show: !0,
549
+ lineStyle: { color: "#cccccc" }
550
+ },
551
+ axisTick: {
552
+ show: !0,
553
+ lineStyle: { color: "#cccccc" }
554
+ },
555
+ axisLabel: {
556
+ show: !0,
557
+ color: "#cccccc"
558
+ },
559
+ splitLine: {
560
+ show: !0,
561
+ lineStyle: { color: ["#444444"] }
562
+ },
563
+ splitArea: {
564
+ show: !1,
565
+ areaStyle: { color: ["rgba(255,255,255,0.05)", "rgba(255,255,255,0.1)"] }
566
+ }
567
+ },
568
+ timeAxis: {
569
+ axisLine: {
570
+ show: !0,
571
+ lineStyle: { color: "#cccccc" }
572
+ },
573
+ axisTick: {
574
+ show: !0,
575
+ lineStyle: { color: "#cccccc" }
576
+ },
577
+ axisLabel: {
578
+ show: !0,
579
+ color: "#cccccc"
580
+ },
581
+ splitLine: {
582
+ show: !0,
583
+ lineStyle: { color: ["#444444"] }
584
+ },
585
+ splitArea: {
586
+ show: !1,
587
+ areaStyle: { color: ["rgba(255,255,255,0.05)", "rgba(255,255,255,0.1)"] }
588
+ }
589
+ },
590
+ toolbox: {
591
+ iconStyle: { borderColor: "#cccccc" },
592
+ emphasis: { iconStyle: { borderColor: "#ffffff" } }
593
+ },
594
+ legend: { textStyle: { color: "#cccccc" } },
595
+ tooltip: { axisPointer: {
596
+ lineStyle: {
597
+ color: "#cccccc",
598
+ width: 1
599
+ },
600
+ crossStyle: {
601
+ color: "#cccccc",
602
+ width: 1
603
+ }
604
+ } },
605
+ timeline: {
606
+ lineStyle: {
607
+ color: "#cccccc",
608
+ width: 1
609
+ },
610
+ itemStyle: {
611
+ color: "#cccccc",
612
+ borderWidth: 1
613
+ },
614
+ controlStyle: {
615
+ color: "#cccccc",
616
+ borderColor: "#cccccc",
617
+ borderWidth: .5
618
+ },
619
+ checkpointStyle: {
620
+ color: "#e43c59",
621
+ borderColor: "#c23531"
622
+ },
623
+ label: { color: "#cccccc" },
624
+ emphasis: {
625
+ itemStyle: { color: "#a9334c" },
626
+ controlStyle: {
627
+ color: "#cccccc",
628
+ borderColor: "#cccccc",
629
+ borderWidth: .5
630
+ },
631
+ label: { color: "#cccccc" }
632
+ }
633
+ },
634
+ visualMap: { color: [
635
+ "#ff6e76",
636
+ "#fddd60",
637
+ "#7cffb2"
638
+ ] },
639
+ dataZoom: {
640
+ backgroundColor: "rgba(47,69,84,0)",
641
+ dataBackgroundColor: "rgba(255,255,255,0.3)",
642
+ fillerColor: "rgba(167,183,204,0.4)",
643
+ handleColor: "#a7b7cc",
644
+ handleSize: "100%",
645
+ textStyle: { color: "#cccccc" }
646
+ },
647
+ markPoint: {
648
+ label: { color: "#cccccc" },
649
+ emphasis: { label: { color: "#cccccc" } }
650
+ }
651
+ }],
652
+ ["macarons", {
653
+ color: [
654
+ "#2ec7c9",
655
+ "#b6a2de",
656
+ "#5ab1ef",
657
+ "#ffb980",
658
+ "#d87a80",
659
+ "#8d98b3",
660
+ "#e5cf0d",
661
+ "#97b552",
662
+ "#95706d",
663
+ "#dc69aa",
664
+ "#07a2a4",
665
+ "#9a7fd1",
666
+ "#588dd5",
667
+ "#f5994e",
668
+ "#c05050",
669
+ "#59678c",
670
+ "#c9ab00",
671
+ "#7eb00a",
672
+ "#6f5553",
673
+ "#c14089"
674
+ ],
675
+ backgroundColor: "rgba(0,0,0,0)",
676
+ textStyle: {},
677
+ title: { textStyle: { color: "#008acd" } },
678
+ line: {
679
+ itemStyle: { borderWidth: 1 },
680
+ lineStyle: { width: 2 },
681
+ symbolSize: 3,
682
+ symbol: "emptyCircle",
683
+ smooth: !0
684
+ },
685
+ radar: {
686
+ itemStyle: { borderWidth: 1 },
687
+ lineStyle: { width: 2 },
688
+ symbolSize: 3,
689
+ symbol: "emptyCircle",
690
+ smooth: !0
691
+ },
692
+ bar: { itemStyle: {
693
+ barBorderWidth: 0,
694
+ barBorderColor: "#ccc"
695
+ } },
696
+ pie: { itemStyle: {
697
+ borderWidth: 0,
698
+ borderColor: "#ccc"
699
+ } },
700
+ scatter: { itemStyle: {
701
+ borderWidth: 0,
702
+ borderColor: "#ccc"
703
+ } },
704
+ boxplot: { itemStyle: {
705
+ borderWidth: 0,
706
+ borderColor: "#ccc"
707
+ } },
708
+ parallel: { itemStyle: {
709
+ borderWidth: 0,
710
+ borderColor: "#ccc"
711
+ } },
712
+ sankey: { itemStyle: {
713
+ borderWidth: 0,
714
+ borderColor: "#ccc"
715
+ } },
716
+ funnel: { itemStyle: {
717
+ borderWidth: 0,
718
+ borderColor: "#ccc"
719
+ } },
720
+ gauge: { itemStyle: {
721
+ borderWidth: 0,
722
+ borderColor: "#ccc"
723
+ } },
724
+ candlestick: { itemStyle: {
725
+ color: "#d87a80",
726
+ color0: "#2ec7c9",
727
+ borderColor: "#d87a80",
728
+ borderColor0: "#2ec7c9",
729
+ borderWidth: 1
730
+ } },
731
+ graph: {
732
+ itemStyle: {
733
+ borderWidth: 0,
734
+ borderColor: "#ccc"
735
+ },
736
+ lineStyle: {
737
+ width: 1,
738
+ color: "#aaa"
739
+ },
740
+ symbolSize: 3,
741
+ symbol: "emptyCircle",
742
+ smooth: !0,
743
+ color: [
744
+ "#2ec7c9",
745
+ "#b6a2de",
746
+ "#5ab1ef",
747
+ "#ffb980",
748
+ "#d87a80",
749
+ "#8d98b3",
750
+ "#e5cf0d",
751
+ "#97b552",
752
+ "#95706d",
753
+ "#dc69aa",
754
+ "#07a2a4",
755
+ "#9a7fd1",
756
+ "#588dd5",
757
+ "#f5994e",
758
+ "#c05050",
759
+ "#59678c",
760
+ "#c9ab00",
761
+ "#7eb00a",
762
+ "#6f5553",
763
+ "#c14089"
764
+ ],
765
+ label: { color: "#eee" }
766
+ },
767
+ map: {
768
+ itemStyle: {
769
+ areaColor: "#dddddd",
770
+ borderColor: "#eeeeee",
771
+ borderWidth: .5
772
+ },
773
+ label: { color: "#d87a80" },
774
+ emphasis: {
775
+ itemStyle: {
776
+ areaColor: "rgba(254,153,78,1)",
777
+ borderColor: "#444",
778
+ borderWidth: 1
779
+ },
780
+ label: { color: "rgb(100,0,0)" }
781
+ }
782
+ },
783
+ geo: {
784
+ itemStyle: {
785
+ areaColor: "#dddddd",
786
+ borderColor: "#eeeeee",
787
+ borderWidth: .5
788
+ },
789
+ label: { color: "#d87a80" },
790
+ emphasis: {
791
+ itemStyle: {
792
+ areaColor: "rgba(254,153,78,1)",
793
+ borderColor: "#444",
794
+ borderWidth: 1
795
+ },
796
+ label: { color: "rgb(100,0,0)" }
797
+ }
798
+ },
799
+ categoryAxis: {
800
+ axisLine: {
801
+ show: !0,
802
+ lineStyle: { color: "#008acd" }
803
+ },
804
+ axisTick: {
805
+ show: !0,
806
+ lineStyle: { color: "#333" }
807
+ },
808
+ axisLabel: {
809
+ show: !0,
810
+ color: "#333"
811
+ },
812
+ splitLine: {
813
+ show: !1,
814
+ lineStyle: { color: ["#eee"] }
815
+ },
816
+ splitArea: {
817
+ show: !1,
818
+ areaStyle: { color: ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"] }
819
+ }
820
+ },
821
+ valueAxis: {
822
+ axisLine: {
823
+ show: !0,
824
+ lineStyle: { color: "#008acd" }
825
+ },
826
+ axisTick: {
827
+ show: !0,
828
+ lineStyle: { color: "#333" }
829
+ },
830
+ axisLabel: {
831
+ show: !0,
832
+ color: "#333"
833
+ },
834
+ splitLine: {
835
+ show: !0,
836
+ lineStyle: { color: ["#eee"] }
837
+ },
838
+ splitArea: {
839
+ show: !1,
840
+ areaStyle: { color: ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"] }
841
+ }
842
+ },
843
+ logAxis: {
844
+ axisLine: {
845
+ show: !0,
846
+ lineStyle: { color: "#008acd" }
847
+ },
848
+ axisTick: {
849
+ show: !0,
850
+ lineStyle: { color: "#333" }
851
+ },
852
+ axisLabel: {
853
+ show: !0,
854
+ color: "#333"
855
+ },
856
+ splitLine: {
857
+ show: !0,
858
+ lineStyle: { color: ["#eee"] }
859
+ },
860
+ splitArea: {
861
+ show: !1,
862
+ areaStyle: { color: ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"] }
863
+ }
864
+ },
865
+ timeAxis: {
866
+ axisLine: {
867
+ show: !0,
868
+ lineStyle: { color: "#008acd" }
869
+ },
870
+ axisTick: {
871
+ show: !0,
872
+ lineStyle: { color: "#333" }
873
+ },
874
+ axisLabel: {
875
+ show: !0,
876
+ color: "#333"
877
+ },
878
+ splitLine: {
879
+ show: !0,
880
+ lineStyle: { color: ["#eee"] }
881
+ },
882
+ splitArea: {
883
+ show: !1,
884
+ areaStyle: { color: ["rgba(250,250,250,0.3)", "rgba(200,200,200,0.3)"] }
885
+ }
886
+ },
887
+ toolbox: {
888
+ iconStyle: { borderColor: "#2ec7c9" },
889
+ emphasis: { iconStyle: { borderColor: "#18a4a6" } }
890
+ },
891
+ legend: { textStyle: { color: "#333333" } },
892
+ tooltip: { axisPointer: {
893
+ lineStyle: {
894
+ color: "#008acd",
895
+ width: "1"
896
+ },
897
+ crossStyle: {
898
+ color: "#008acd",
899
+ width: "1"
900
+ }
901
+ } },
902
+ timeline: {
903
+ lineStyle: {
904
+ color: "#008acd",
905
+ width: 1
906
+ },
907
+ itemStyle: {
908
+ color: "#008acd",
909
+ borderWidth: 1
910
+ },
911
+ controlStyle: {
912
+ color: "#008acd",
913
+ borderColor: "#008acd",
914
+ borderWidth: .5
915
+ },
916
+ checkpointStyle: {
917
+ color: "#2ec7c9",
918
+ borderColor: "#2ec7c9"
919
+ },
920
+ label: { color: "#008acd" },
921
+ emphasis: {
922
+ itemStyle: { color: "#a9334c" },
923
+ controlStyle: {
924
+ color: "#008acd",
925
+ borderColor: "#008acd",
926
+ borderWidth: .5
927
+ },
928
+ label: { color: "#008acd" }
929
+ }
930
+ },
931
+ visualMap: { color: ["#5ab1ef", "#e0ffff"] },
932
+ dataZoom: {
933
+ backgroundColor: "rgba(47,69,84,0)",
934
+ dataBackgroundColor: "rgba(239,239,255,0.3)",
935
+ fillerColor: "rgba(182,162,222,0.2)",
936
+ handleColor: "#008acd",
937
+ handleSize: "100%",
938
+ textStyle: { color: "#333333" }
939
+ },
940
+ markPoint: {
941
+ label: { color: "#eeeeee" },
942
+ emphasis: { label: { color: "#eeeeee" } }
943
+ }
944
+ }]
945
+ ]), customThemeCache = /* @__PURE__ */ new WeakMap(), customThemeCounter = 0;
946
+ function registerBuiltinThemes() {
947
+ for (let [e, l] of themeRegistry.entries()) echarts.registerTheme(e, l);
948
+ }
949
+ function getBuiltinTheme(e) {
950
+ return themeRegistry.get(e) || null;
951
+ }
952
+ function isBuiltinTheme(e) {
953
+ return themeRegistry.has(e);
954
+ }
955
+ function registerCustomTheme(e, l) {
956
+ echarts.registerTheme(e, l);
957
+ }
958
+ function getOrRegisterCustomTheme(e) {
959
+ let l = customThemeCache.get(e);
960
+ if (l) return l;
961
+ let u = `__custom_theme_${customThemeCounter++}`;
962
+ return echarts.registerTheme(u, e), customThemeCache.set(e, u), u;
963
+ }
964
+ function getAvailableThemes() {
965
+ return Array.from(themeRegistry.keys());
966
+ }
967
+ registerBuiltinThemes();
968
+ function resolveThemeName(e) {
969
+ return e == null ? null : typeof e == "string" && isBuiltinTheme(e) ? e : typeof e == "object" ? getOrRegisterCustomTheme(e) : null;
970
+ }
971
+ function bindEvents(e, l) {
972
+ if (l) for (let [u, { handler: d, query: f, context: p }] of Object.entries(l)) f ? e.on(u, f, d, p) : e.on(u, d, p);
973
+ }
974
+ function unbindEvents(e, l) {
975
+ if (l) for (let [u, { handler: d }] of Object.entries(l)) e.off(u, d);
976
+ }
977
+ function useEcharts(d, p) {
978
+ let m = (0, import_compiler_runtime.c)(53), { option: h, theme: g, renderer: _, lazyInit: v, group: y, setOptionOpts: b, showLoading: x, loadingOption: S, onEvents: C } = p, w = _ === void 0 ? "canvas" : _, T = v === void 0 ? !1 : v, E = x === void 0 ? !1 : x, D = useRef(void 0), O = useRef(void 0), k = useRef(C), A, j;
979
+ m[0] === C ? (A = m[1], j = m[2]) : (A = () => {
980
+ k.current = C;
981
+ }, j = [C], m[0] = C, m[1] = A, m[2] = j), useEffect(A, j);
982
+ let M = useLazyInit(d, T), N;
983
+ m[3] === d ? N = m[4] : (N = () => {
984
+ if (d.current) return getCachedInstance(d.current);
985
+ }, m[3] = d, m[4] = N);
986
+ let P = N, F;
987
+ m[5] !== d || m[6] !== w || m[7] !== M || m[8] !== g ? (F = () => {
988
+ let e = d.current;
989
+ if (!e || !M) return;
990
+ let l = getCachedInstance(e);
991
+ if (!l) {
992
+ let u = resolveThemeName(g);
993
+ l = echarts.init(e, u, { renderer: w }), setCachedInstance(e, l), O.current = g;
994
+ }
995
+ return l;
996
+ }, m[5] = d, m[6] = w, m[7] = M, m[8] = g, m[9] = F) : F = m[9];
997
+ let I = F, L;
998
+ m[10] !== P || m[11] !== I || m[12] !== b ? (L = (e, l) => {
999
+ queueMicrotask(() => {
1000
+ let u = P() || I();
1001
+ if (u) {
1002
+ let d = {
1003
+ ...b,
1004
+ ...l
1005
+ };
1006
+ u.setOption(e, d);
1007
+ }
1008
+ });
1009
+ }, m[10] = P, m[11] = I, m[12] = b, m[13] = L) : L = m[13];
1010
+ let R = L, z;
1011
+ m[14] === P ? z = m[15] : (z = () => {
1012
+ P()?.resize();
1013
+ }, m[14] = P, m[15] = z);
1014
+ let B = z, V, H;
1015
+ m[16] !== I || m[17] !== S || m[18] !== h || m[19] !== d || m[20] !== b || m[21] !== M || m[22] !== E ? (H = () => {
1016
+ if (!M) return;
1017
+ let e = d.current;
1018
+ if (!e) return;
1019
+ let l = I();
1020
+ if (l) return l.setOption(h, b), E && l.showLoading(S), bindEvents(l, k.current), () => {
1021
+ let l = getCachedInstance(e);
1022
+ if (!l) return;
1023
+ let u = D.current;
1024
+ u && updateGroup(l, u, void 0), unbindEvents(l, k.current), releaseCachedInstance(e);
1025
+ };
1026
+ }, V = [
1027
+ M,
1028
+ I,
1029
+ h,
1030
+ b,
1031
+ E,
1032
+ S,
1033
+ d
1034
+ ], m[16] = I, m[17] = S, m[18] = h, m[19] = d, m[20] = b, m[21] = M, m[22] = E, m[23] = V, m[24] = H) : (V = m[23], H = m[24]), useLayoutEffect(H, V);
1035
+ let U, W;
1036
+ m[25] !== P || m[26] !== h || m[27] !== b ? (U = () => {
1037
+ let e = P();
1038
+ e && e.setOption(h, b);
1039
+ }, W = [
1040
+ P,
1041
+ h,
1042
+ b
1043
+ ], m[25] = P, m[26] = h, m[27] = b, m[28] = U, m[29] = W) : (U = m[28], W = m[29]), useEffect(U, W);
1044
+ let G, K;
1045
+ m[30] !== h || m[31] !== d || m[32] !== w || m[33] !== b || m[34] !== g ? (G = () => {
1046
+ let e = d.current;
1047
+ if (!e || !getCachedInstance(e) || O.current === g) return;
1048
+ let l = resolveThemeName(g), u = echarts.init(e, l, { renderer: w });
1049
+ replaceCachedInstance(e, u), O.current = g, u.setOption(h, b), bindEvents(u, k.current);
1050
+ }, K = [
1051
+ d,
1052
+ g,
1053
+ w,
1054
+ h,
1055
+ b
1056
+ ], m[30] = h, m[31] = d, m[32] = w, m[33] = b, m[34] = g, m[35] = G, m[36] = K) : (G = m[35], K = m[36]), useEffect(G, K);
1057
+ let q, J;
1058
+ m[37] !== P || m[38] !== S || m[39] !== E ? (q = () => {
1059
+ let e = P();
1060
+ e && (E ? e.showLoading(S) : e.hideLoading());
1061
+ }, J = [
1062
+ P,
1063
+ E,
1064
+ S
1065
+ ], m[37] = P, m[38] = S, m[39] = E, m[40] = q, m[41] = J) : (q = m[40], J = m[41]), useEffect(q, J);
1066
+ let Y, X;
1067
+ m[42] !== P || m[43] !== y ? (Y = () => {
1068
+ let e = P();
1069
+ e && (updateGroup(e, D.current, y), D.current = y);
1070
+ }, X = [P, y], m[42] = P, m[43] = y, m[44] = Y, m[45] = X) : (Y = m[44], X = m[45]), useEffect(Y, X);
1071
+ let Z, Q;
1072
+ m[46] === d ? (Z = m[47], Q = m[48]) : (Z = () => {
1073
+ let e = d.current;
1074
+ if (!e) return;
1075
+ let l;
1076
+ try {
1077
+ l = new ResizeObserver(() => {
1078
+ getCachedInstance(e)?.resize();
1079
+ }), l.observe(e);
1080
+ } catch (e) {
1081
+ let l = e;
1082
+ console.warn("ResizeObserver not available:", l);
1083
+ }
1084
+ return () => {
1085
+ l?.disconnect();
1086
+ };
1087
+ }, Q = [d], m[46] = d, m[47] = Z, m[48] = Q), useEffect(Z, Q);
1088
+ let $;
1089
+ return m[49] !== P || m[50] !== B || m[51] !== R ? ($ = {
1090
+ setOption: R,
1091
+ getInstance: P,
1092
+ resize: B
1093
+ }, m[49] = P, m[50] = B, m[51] = R, m[52] = $) : $ = m[52], $;
1094
+ }
1095
+ var use_echarts_default = useEcharts;
1096
+ export { addToGroup, clearGroups, clearInstanceCache, getAvailableThemes, getBuiltinTheme, getCachedInstance, getGroupInstances, getInstanceGroup, getReferenceCount, isBuiltinTheme, isInGroup, registerBuiltinThemes, registerCustomTheme, releaseCachedInstance, removeFromGroup, replaceCachedInstance, setCachedInstance, updateGroup, use_echarts_default as useEcharts, useLazyInit };