@hybridcore/ui 1.5.78 → 1.5.80

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.
@@ -0,0 +1,836 @@
1
+ import { S as ae, L as $, T as F, C as te, m as P, R as ie, k as se, X as oe, G as Y, e as I, i as ne, l as we, j as he, n as ye, a as le, b as Te, A as Pe, c as Fe, d as Le, D as De, f as Ae, V as Ce, h as Oe, o as Xe, g as $e, p as re } from "../../../AxisRendererY-CFo972D5.js";
2
+ import { useThemeProps as Me } from "@mui/material";
3
+ import { useRef as Q, useLayoutEffect as Ye } from "react";
4
+ class H extends ae {
5
+ constructor() {
6
+ super(...arguments), Object.defineProperty(this, "itemContainers", {
7
+ enumerable: !0,
8
+ configurable: !0,
9
+ writable: !0,
10
+ value: this.addDisposer(new $(F.new({}), () => te._new(this._root, {
11
+ themeTags: P(this.itemContainers.template.get("themeTags", []), ["legend", "item"]),
12
+ themeTagsSelf: P(this.itemContainers.template.get("themeTagsSelf", []), ["itemcontainer"]),
13
+ background: ie.new(this._root, {
14
+ themeTags: P(this.itemContainers.template.get("themeTags", []), ["legend", "item", "background"]),
15
+ themeTagsSelf: P(this.itemContainers.template.get("themeTagsSelf", []), ["itemcontainer"])
16
+ })
17
+ }, [this.itemContainers.template])))
18
+ }), Object.defineProperty(this, "markers", {
19
+ enumerable: !0,
20
+ configurable: !0,
21
+ writable: !0,
22
+ value: this.addDisposer(new $(F.new({}), () => te._new(this._root, {
23
+ themeTags: P(this.markers.template.get("themeTags", []), ["legend", "marker"])
24
+ }, [this.markers.template])))
25
+ }), Object.defineProperty(this, "labels", {
26
+ enumerable: !0,
27
+ configurable: !0,
28
+ writable: !0,
29
+ value: this.addDisposer(new $(F.new({}), () => se._new(this._root, {
30
+ themeTags: P(this.labels.template.get("themeTags", []), ["legend", "label"])
31
+ }, [this.labels.template])))
32
+ }), Object.defineProperty(this, "valueLabels", {
33
+ enumerable: !0,
34
+ configurable: !0,
35
+ writable: !0,
36
+ value: this.addDisposer(new $(F.new({}), () => se._new(this._root, {
37
+ themeTags: P(this.valueLabels.template.get("themeTags", []), ["legend", "label", "value"])
38
+ }, [this.valueLabels.template])))
39
+ }), Object.defineProperty(this, "markerRectangles", {
40
+ enumerable: !0,
41
+ configurable: !0,
42
+ writable: !0,
43
+ value: this.addDisposer(new $(F.new({}), () => ie._new(this._root, {
44
+ themeTags: P(this.markerRectangles.template.get("themeTags", []), ["legend", "marker", "rectangle"])
45
+ }, [this.markerRectangles.template])))
46
+ });
47
+ }
48
+ _afterNew() {
49
+ this._settings.themeTags = P(this._settings.themeTags, ["legend"]), this.fields.push("name", "stroke", "fill"), super._afterNew();
50
+ }
51
+ /**
52
+ * @ignore
53
+ */
54
+ makeItemContainer(e) {
55
+ const t = this.children.push(this.itemContainers.make());
56
+ return t._setDataItem(e), this.itemContainers.push(t), t.states.create("disabled", {}), t;
57
+ }
58
+ /**
59
+ * @ignore
60
+ */
61
+ makeMarker() {
62
+ const e = this.markers.make();
63
+ return this.markers.push(e), e.states.create("disabled", {}), e;
64
+ }
65
+ /**
66
+ * @ignore
67
+ */
68
+ makeLabel() {
69
+ const e = this.labels.make();
70
+ return e.states.create("disabled", {}), e;
71
+ }
72
+ /**
73
+ * @ignore
74
+ */
75
+ makeValueLabel() {
76
+ const e = this.valueLabels.make();
77
+ return e.states.create("disabled", {}), e;
78
+ }
79
+ /**
80
+ * @ignore
81
+ */
82
+ makeMarkerRectangle() {
83
+ const e = this.markerRectangles.make();
84
+ return e.states.create("disabled", {}), e;
85
+ }
86
+ processDataItem(e) {
87
+ super.processDataItem(e);
88
+ const t = this.makeItemContainer(e), i = this.get("nameField"), l = this.get("fillField"), h = this.get("strokeField");
89
+ if (t) {
90
+ const f = this.get("clickTarget", "itemContainer"), n = e.dataContext;
91
+ n && n.set && n.set("legendDataItem", e), t._setDataItem(e), e.set("itemContainer", t);
92
+ const c = this.makeMarker();
93
+ if (c) {
94
+ t.children.push(c), c._setDataItem(e), e.set("marker", c);
95
+ const s = this.get("useDefaultMarker"), a = c.children.push(this.makeMarkerRectangle());
96
+ let d = e.get("fill"), m = e.get("stroke");
97
+ e.set("markerRectangle", a), n && n.get && (d = n.get(l, d), m = n.get(h, m)), m || (m = d), s ? n.on && (n.on(l, () => {
98
+ a.set("fill", n.get(l));
99
+ }), n.on(h, () => {
100
+ a.set("stroke", n.get(h));
101
+ })) : n && n.createLegendMarker && n.createLegendMarker(), a.setAll({ fill: d, stroke: m });
102
+ const p = n.component;
103
+ p && p.updateLegendMarker && p.updateLegendMarker(n);
104
+ }
105
+ const r = this.makeLabel();
106
+ if (r) {
107
+ t.children.push(r), r._setDataItem(e), e.set("label", r), r.text.on("text", () => {
108
+ t.setRaw("ariaLabel", r.text._getText() + (this.get("clickTarget") !== "none" ? "; " + this._t("Press ENTER to toggle") : "")), t.markDirtyAccessibility();
109
+ }), n && n.get && e.set("name", n.get(i));
110
+ let s = e.get("name");
111
+ s && r.set("text", s);
112
+ }
113
+ const o = this.makeValueLabel();
114
+ if (o && (t.children.push(o), o._setDataItem(e), e.set("valueLabel", o)), n && n.show && (n.on("visible", (s) => {
115
+ t.set("disabled", !s);
116
+ }), n.get("visible") || t.set("disabled", !0), f != "none")) {
117
+ let s = t;
118
+ f == "marker" && (s = c), this._addClickEvents(s, n, e);
119
+ }
120
+ this.children.values.sort((s, a) => {
121
+ const d = s.dataItem.dataContext, m = a.dataItem.dataContext;
122
+ if (d && m) {
123
+ const p = this.data.indexOf(d), g = this.data.indexOf(m);
124
+ if (p > g)
125
+ return 1;
126
+ if (p < g)
127
+ return -1;
128
+ }
129
+ return 0;
130
+ }), n && n.updateLegendValue && n.updateLegendValue();
131
+ }
132
+ }
133
+ _addClickEvents(e, t, i) {
134
+ e.set("cursorOverStyle", "pointer"), e.events.on("pointerover", () => {
135
+ const l = t.component;
136
+ l && l.hoverDataItem && l.hoverDataItem(t);
137
+ }), e.events.on("pointerout", () => {
138
+ const l = t.component;
139
+ l && l.hoverDataItem && l.unhoverDataItem(t);
140
+ }), e.events.on("click", () => {
141
+ const l = i.get("label").text._getText();
142
+ t.show && t.isHidden && (t.isHidden() || t.get("visible") === !1) ? (t.show(), e.set("disabled", !1), this._root.readerAlert(this._t("%1 shown", this._root.locale, l))) : t.hide && (t.hide(), e.set("disabled", !0), this._root.readerAlert(this._t("%1 hidden", this._root.locale, l)));
143
+ });
144
+ }
145
+ /**
146
+ * @ignore
147
+ */
148
+ disposeDataItem(e) {
149
+ super.disposeDataItem(e);
150
+ const t = e.dataContext;
151
+ t && t.get && t.get("legendDataItem") == e && t.set("legendDataItem", void 0);
152
+ let i = e.get("itemContainer");
153
+ i && (this.itemContainers.removeValue(i), i.dispose());
154
+ let l = e.get("marker");
155
+ l && (this.markers.removeValue(l), l.dispose());
156
+ let h = e.get("markerRectangle");
157
+ h && (this.markerRectangles.removeValue(h), h.dispose());
158
+ let f = e.get("label");
159
+ f && (this.labels.removeValue(f), f.dispose());
160
+ let n = e.get("valueLabel");
161
+ n && (this.valueLabels.removeValue(n), n.dispose());
162
+ }
163
+ }
164
+ Object.defineProperty(H, "className", {
165
+ enumerable: !0,
166
+ configurable: !0,
167
+ writable: !0,
168
+ value: "Legend"
169
+ });
170
+ Object.defineProperty(H, "classNames", {
171
+ enumerable: !0,
172
+ configurable: !0,
173
+ writable: !0,
174
+ value: ae.classNames.concat([H.className])
175
+ });
176
+ function w(u) {
177
+ return function() {
178
+ return u;
179
+ };
180
+ }
181
+ const U = Math.PI, J = 2 * U, S = 1e-6, Se = J - S;
182
+ function ue(u) {
183
+ this._ += u[0];
184
+ for (let e = 1, t = u.length; e < t; ++e)
185
+ this._ += arguments[e] + u[e];
186
+ }
187
+ function Re(u) {
188
+ let e = Math.floor(u);
189
+ if (!(e >= 0)) throw new Error(`invalid digits: ${u}`);
190
+ if (e > 15) return ue;
191
+ const t = 10 ** e;
192
+ return function(i) {
193
+ this._ += i[0];
194
+ for (let l = 1, h = i.length; l < h; ++l)
195
+ this._ += Math.round(arguments[l] * t) / t + i[l];
196
+ };
197
+ }
198
+ class je {
199
+ constructor(e) {
200
+ this._x0 = this._y0 = // start of current subpath
201
+ this._x1 = this._y1 = null, this._ = "", this._append = e == null ? ue : Re(e);
202
+ }
203
+ moveTo(e, t) {
204
+ this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}`;
205
+ }
206
+ closePath() {
207
+ this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
208
+ }
209
+ lineTo(e, t) {
210
+ this._append`L${this._x1 = +e},${this._y1 = +t}`;
211
+ }
212
+ quadraticCurveTo(e, t, i, l) {
213
+ this._append`Q${+e},${+t},${this._x1 = +i},${this._y1 = +l}`;
214
+ }
215
+ bezierCurveTo(e, t, i, l, h, f) {
216
+ this._append`C${+e},${+t},${+i},${+l},${this._x1 = +h},${this._y1 = +f}`;
217
+ }
218
+ arcTo(e, t, i, l, h) {
219
+ if (e = +e, t = +t, i = +i, l = +l, h = +h, h < 0) throw new Error(`negative radius: ${h}`);
220
+ let f = this._x1, n = this._y1, c = i - e, r = l - t, o = f - e, s = n - t, a = o * o + s * s;
221
+ if (this._x1 === null)
222
+ this._append`M${this._x1 = e},${this._y1 = t}`;
223
+ else if (a > S) if (!(Math.abs(s * c - r * o) > S) || !h)
224
+ this._append`L${this._x1 = e},${this._y1 = t}`;
225
+ else {
226
+ let d = i - f, m = l - n, p = c * c + r * r, g = d * d + m * m, v = Math.sqrt(p), y = Math.sqrt(a), _ = h * Math.tan((U - Math.acos((p + a - g) / (2 * v * y))) / 2), x = _ / y, D = _ / v;
227
+ Math.abs(x - 1) > S && this._append`L${e + x * o},${t + x * s}`, this._append`A${h},${h},0,0,${+(s * d > o * m)},${this._x1 = e + D * c},${this._y1 = t + D * r}`;
228
+ }
229
+ }
230
+ arc(e, t, i, l, h, f) {
231
+ if (e = +e, t = +t, i = +i, f = !!f, i < 0) throw new Error(`negative radius: ${i}`);
232
+ let n = i * Math.cos(l), c = i * Math.sin(l), r = e + n, o = t + c, s = 1 ^ f, a = f ? l - h : h - l;
233
+ this._x1 === null ? this._append`M${r},${o}` : (Math.abs(this._x1 - r) > S || Math.abs(this._y1 - o) > S) && this._append`L${r},${o}`, i && (a < 0 && (a = a % J + J), a > Se ? this._append`A${i},${i},0,1,${s},${e - n},${t - c}A${i},${i},0,1,${s},${this._x1 = r},${this._y1 = o}` : a > S && this._append`A${i},${i},0,${+(a >= U)},${s},${this._x1 = e + i * Math.cos(h)},${this._y1 = t + i * Math.sin(h)}`);
234
+ }
235
+ rect(e, t, i, l) {
236
+ this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}h${i = +i}v${+l}h${-i}Z`;
237
+ }
238
+ toString() {
239
+ return this._;
240
+ }
241
+ }
242
+ function ce(u) {
243
+ let e = 3;
244
+ return u.digits = function(t) {
245
+ if (!arguments.length) return e;
246
+ if (t == null)
247
+ e = null;
248
+ else {
249
+ const i = Math.floor(t);
250
+ if (!(i >= 0)) throw new RangeError(`invalid digits: ${t}`);
251
+ e = i;
252
+ }
253
+ return u;
254
+ }, () => new je(e);
255
+ }
256
+ function fe(u) {
257
+ return typeof u == "object" && "length" in u ? u : Array.from(u);
258
+ }
259
+ function de(u) {
260
+ this._context = u;
261
+ }
262
+ de.prototype = {
263
+ areaStart: function() {
264
+ this._line = 0;
265
+ },
266
+ areaEnd: function() {
267
+ this._line = NaN;
268
+ },
269
+ lineStart: function() {
270
+ this._point = 0;
271
+ },
272
+ lineEnd: function() {
273
+ (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
274
+ },
275
+ point: function(u, e) {
276
+ switch (u = +u, e = +e, this._point) {
277
+ case 0:
278
+ this._point = 1, this._line ? this._context.lineTo(u, e) : this._context.moveTo(u, e);
279
+ break;
280
+ case 1:
281
+ this._point = 2;
282
+ default:
283
+ this._context.lineTo(u, e);
284
+ break;
285
+ }
286
+ }
287
+ };
288
+ function pe(u) {
289
+ return new de(u);
290
+ }
291
+ function me(u) {
292
+ return u[0];
293
+ }
294
+ function ge(u) {
295
+ return u[1];
296
+ }
297
+ function be(u, e) {
298
+ var t = w(!0), i = null, l = pe, h = null, f = ce(n);
299
+ u = typeof u == "function" ? u : u === void 0 ? me : w(u), e = typeof e == "function" ? e : e === void 0 ? ge : w(e);
300
+ function n(c) {
301
+ var r, o = (c = fe(c)).length, s, a = !1, d;
302
+ for (i == null && (h = l(d = f())), r = 0; r <= o; ++r)
303
+ !(r < o && t(s = c[r], r, c)) === a && ((a = !a) ? h.lineStart() : h.lineEnd()), a && h.point(+u(s, r, c), +e(s, r, c));
304
+ if (d) return h = null, d + "" || null;
305
+ }
306
+ return n.x = function(c) {
307
+ return arguments.length ? (u = typeof c == "function" ? c : w(+c), n) : u;
308
+ }, n.y = function(c) {
309
+ return arguments.length ? (e = typeof c == "function" ? c : w(+c), n) : e;
310
+ }, n.defined = function(c) {
311
+ return arguments.length ? (t = typeof c == "function" ? c : w(!!c), n) : t;
312
+ }, n.curve = function(c) {
313
+ return arguments.length ? (l = c, i != null && (h = l(i)), n) : l;
314
+ }, n.context = function(c) {
315
+ return arguments.length ? (c == null ? i = h = null : h = l(i = c), n) : i;
316
+ }, n;
317
+ }
318
+ function Ee(u, e, t) {
319
+ var i = null, l = w(!0), h = null, f = pe, n = null, c = ce(r);
320
+ u = typeof u == "function" ? u : u === void 0 ? me : w(+u), e = typeof e == "function" ? e : w(e === void 0 ? 0 : +e), t = typeof t == "function" ? t : t === void 0 ? ge : w(+t);
321
+ function r(s) {
322
+ var a, d, m, p = (s = fe(s)).length, g, v = !1, y, _ = new Array(p), x = new Array(p);
323
+ for (h == null && (n = f(y = c())), a = 0; a <= p; ++a) {
324
+ if (!(a < p && l(g = s[a], a, s)) === v)
325
+ if (v = !v)
326
+ d = a, n.areaStart(), n.lineStart();
327
+ else {
328
+ for (n.lineEnd(), n.lineStart(), m = a - 1; m >= d; --m)
329
+ n.point(_[m], x[m]);
330
+ n.lineEnd(), n.areaEnd();
331
+ }
332
+ v && (_[a] = +u(g, a, s), x[a] = +e(g, a, s), n.point(i ? +i(g, a, s) : _[a], t ? +t(g, a, s) : x[a]));
333
+ }
334
+ if (y) return n = null, y + "" || null;
335
+ }
336
+ function o() {
337
+ return be().defined(l).curve(f).context(h);
338
+ }
339
+ return r.x = function(s) {
340
+ return arguments.length ? (u = typeof s == "function" ? s : w(+s), i = null, r) : u;
341
+ }, r.x0 = function(s) {
342
+ return arguments.length ? (u = typeof s == "function" ? s : w(+s), r) : u;
343
+ }, r.x1 = function(s) {
344
+ return arguments.length ? (i = s == null ? null : typeof s == "function" ? s : w(+s), r) : i;
345
+ }, r.y = function(s) {
346
+ return arguments.length ? (e = typeof s == "function" ? s : w(+s), t = null, r) : e;
347
+ }, r.y0 = function(s) {
348
+ return arguments.length ? (e = typeof s == "function" ? s : w(+s), r) : e;
349
+ }, r.y1 = function(s) {
350
+ return arguments.length ? (t = s == null ? null : typeof s == "function" ? s : w(+s), r) : t;
351
+ }, r.lineX0 = r.lineY0 = function() {
352
+ return o().x(u).y(e);
353
+ }, r.lineY1 = function() {
354
+ return o().x(u).y(t);
355
+ }, r.lineX1 = function() {
356
+ return o().x(i).y(e);
357
+ }, r.defined = function(s) {
358
+ return arguments.length ? (l = typeof s == "function" ? s : w(!!s), r) : l;
359
+ }, r.curve = function(s) {
360
+ return arguments.length ? (f = s, h != null && (n = f(h)), r) : f;
361
+ }, r.context = function(s) {
362
+ return arguments.length ? (s == null ? h = n = null : n = f(h = s), r) : h;
363
+ }, r;
364
+ }
365
+ class z extends oe {
366
+ constructor() {
367
+ super(...arguments), Object.defineProperty(this, "_endIndex", {
368
+ enumerable: !0,
369
+ configurable: !0,
370
+ writable: !0,
371
+ value: void 0
372
+ }), Object.defineProperty(this, "_strokeGenerator", {
373
+ enumerable: !0,
374
+ configurable: !0,
375
+ writable: !0,
376
+ value: be()
377
+ }), Object.defineProperty(this, "_fillGenerator", {
378
+ enumerable: !0,
379
+ configurable: !0,
380
+ writable: !0,
381
+ value: Ee()
382
+ }), Object.defineProperty(this, "_legendStroke", {
383
+ enumerable: !0,
384
+ configurable: !0,
385
+ writable: !0,
386
+ value: void 0
387
+ }), Object.defineProperty(this, "_legendFill", {
388
+ enumerable: !0,
389
+ configurable: !0,
390
+ writable: !0,
391
+ value: void 0
392
+ }), Object.defineProperty(this, "strokes", {
393
+ enumerable: !0,
394
+ configurable: !0,
395
+ writable: !0,
396
+ value: this.addDisposer(new $(F.new({}), () => Y._new(this._root, {
397
+ themeTags: P(this.strokes.template.get("themeTags", []), ["line", "series", "stroke"])
398
+ }, [this.strokes.template])))
399
+ }), Object.defineProperty(this, "fills", {
400
+ enumerable: !0,
401
+ configurable: !0,
402
+ writable: !0,
403
+ value: this.addDisposer(new $(F.new({}), () => Y._new(this._root, {
404
+ themeTags: P(this.strokes.template.get("themeTags", []), ["line", "series", "fill"])
405
+ }, [this.fills.template])))
406
+ }), Object.defineProperty(this, "_fillTemplate", {
407
+ enumerable: !0,
408
+ configurable: !0,
409
+ writable: !0,
410
+ value: void 0
411
+ }), Object.defineProperty(this, "_strokeTemplate", {
412
+ enumerable: !0,
413
+ configurable: !0,
414
+ writable: !0,
415
+ value: void 0
416
+ }), Object.defineProperty(this, "_previousPoint", {
417
+ enumerable: !0,
418
+ configurable: !0,
419
+ writable: !0,
420
+ value: [0, 0, 0, 0]
421
+ }), Object.defineProperty(this, "_dindex", {
422
+ enumerable: !0,
423
+ configurable: !0,
424
+ writable: !0,
425
+ value: 0
426
+ }), Object.defineProperty(this, "_sindex", {
427
+ enumerable: !0,
428
+ configurable: !0,
429
+ writable: !0,
430
+ value: 0
431
+ });
432
+ }
433
+ _afterNew() {
434
+ this._fillGenerator.y0(function(e) {
435
+ return e[3];
436
+ }), this._fillGenerator.x0(function(e) {
437
+ return e[2];
438
+ }), this._fillGenerator.y1(function(e) {
439
+ return e[1];
440
+ }), this._fillGenerator.x1(function(e) {
441
+ return e[0];
442
+ }), super._afterNew();
443
+ }
444
+ /**
445
+ * @ignore
446
+ */
447
+ makeStroke(e) {
448
+ const t = this.mainContainer.children.push(e.make());
449
+ return e.push(t), t;
450
+ }
451
+ /**
452
+ * @ignore
453
+ */
454
+ makeFill(e) {
455
+ const t = this.mainContainer.children.push(e.make());
456
+ return e.push(t), t;
457
+ }
458
+ _updateChildren() {
459
+ this._strokeTemplate = void 0, this._fillTemplate = void 0;
460
+ let e = this.get("xAxis"), t = this.get("yAxis");
461
+ if (this.isDirty("stroke")) {
462
+ const i = this.get("stroke");
463
+ this.strokes.template.set("stroke", i);
464
+ const l = this._legendStroke;
465
+ l && l.states.lookup("default").set("stroke", i);
466
+ }
467
+ if (this.isDirty("fill")) {
468
+ const i = this.get("fill");
469
+ this.fills.template.set("fill", i);
470
+ const l = this._legendFill;
471
+ l && l.states.lookup("default").set("fill", i);
472
+ }
473
+ if (this.isDirty("fillPattern")) {
474
+ const i = this.get("fillPattern");
475
+ this.fills.template.set("fillPattern", i);
476
+ const l = this._legendFill;
477
+ l && l.states.lookup("default").set("fillPattern", i);
478
+ }
479
+ if (this.isDirty("curveFactory")) {
480
+ const i = this.get("curveFactory");
481
+ i && (this._strokeGenerator.curve(i), this._fillGenerator.curve(i));
482
+ }
483
+ if (e.inited && t.inited) {
484
+ if (this._axesDirty || this._valuesDirty || this._stackDirty || this.isDirty("vcx") || this.isDirty("vcy") || this._sizeDirty || this.isDirty("connect") || this.isDirty("curveFactory")) {
485
+ this.fills.each((o) => {
486
+ o.setPrivate("visible", !1);
487
+ }), this.strokes.each((o) => {
488
+ o.setPrivate("visible", !1);
489
+ }), this.axisRanges.each((o) => {
490
+ let s = o.fills;
491
+ s && s.each((d) => {
492
+ d.setPrivate("visible", !1);
493
+ });
494
+ let a = o.strokes;
495
+ a && a.each((d) => {
496
+ d.setPrivate("visible", !1);
497
+ });
498
+ });
499
+ let i = this.startIndex(), l = this.strokes.template.get("templateField"), h = this.fills.template.get("templateField"), f = !0, n = !0;
500
+ l && (f = !1), h && (n = !1);
501
+ for (let o = i - 1; o >= 0; o--) {
502
+ let s = this.dataItems[o], a = !0, d = s.dataContext;
503
+ if (l && d[l] && (f = !0), h && d[h] && (n = !0), I(this._valueFields, (m) => {
504
+ le(s.get(m)) || (a = !1);
505
+ }), a && f && n) {
506
+ i = o;
507
+ break;
508
+ }
509
+ }
510
+ let c = this.dataItems.length, r = this.endIndex();
511
+ if (r < c) {
512
+ r++;
513
+ for (let o = r; o < c; o++) {
514
+ let s = this.dataItems[o], a = !0;
515
+ if (I(this._valueFields, (d) => {
516
+ le(s.get(d)) || (a = !1);
517
+ }), a) {
518
+ r = o + 1;
519
+ break;
520
+ }
521
+ }
522
+ }
523
+ if (i > 0 && i--, this._endIndex = r, this._clearGraphics(), this._sindex = 0, this._dindex = i, this.dataItems.length == 1)
524
+ this._startSegment(0);
525
+ else
526
+ for (; this._dindex < r - 1; )
527
+ this._startSegment(this._dindex), this._sindex++;
528
+ }
529
+ } else
530
+ this._skipped = !0;
531
+ super._updateChildren();
532
+ }
533
+ _clearGraphics() {
534
+ this.strokes.clear(), this.fills.clear(), this.axisRanges.each((e) => {
535
+ e.fills.clear(), e.strokes.clear();
536
+ });
537
+ }
538
+ _startSegment(e) {
539
+ let t = this._endIndex, i = t;
540
+ const l = this.get("autoGapCount"), h = this.get("connect"), f = this.makeFill(this.fills), n = this._fillTemplate, c = this.fills.template;
541
+ n && n != c && (f.template = n), f.setPrivate("visible", !0);
542
+ const r = this.makeStroke(this.strokes), o = this._strokeTemplate;
543
+ o && o != this.strokes.template && (r.template = o), r.setPrivate("visible", !0);
544
+ let s = this.get("xAxis"), a = this.get("yAxis"), d = this.get("baseAxis"), m = this.get("vcx", 1), p = this.get("vcy", 1), g = this._xField, v = this._yField, y = this._xOpenField, _ = this._yOpenField;
545
+ const x = this.get("openValueXField"), D = this.get("openValueYField");
546
+ x || (y = this._xField), D || (_ = this._yField);
547
+ const G = this.get("stacked"), W = s.basePosition(), q = a.basePosition();
548
+ let j;
549
+ d === a ? j = this._yField : j = this._xField;
550
+ const A = [];
551
+ let k = [];
552
+ A.push(k);
553
+ const M = this.strokes.template.get("templateField"), C = this.fills.template.get("templateField");
554
+ let L = this.get("locationX", 0.5), X = this.get("locationY", 0.5), _e = this.get("openLocationX", L), ke = this.get("openLocationY", X);
555
+ const ve = this.get("minDistance", 0);
556
+ let T, K = this.fills.template.get("visible");
557
+ this.axisRanges.length > 0 && (K = !0);
558
+ let ee = !1;
559
+ (G || x || D) && (ee = !0);
560
+ const Z = {
561
+ points: k,
562
+ segments: A,
563
+ stacked: G,
564
+ getOpen: ee,
565
+ basePosX: W,
566
+ basePosY: q,
567
+ fillVisible: K,
568
+ xField: g,
569
+ yField: v,
570
+ xOpenField: y,
571
+ yOpenField: _,
572
+ vcx: m,
573
+ vcy: p,
574
+ baseAxis: d,
575
+ xAxis: s,
576
+ yAxis: a,
577
+ locationX: L,
578
+ locationY: X,
579
+ openLocationX: _e,
580
+ openLocationY: ke,
581
+ minDistance: ve
582
+ };
583
+ let N = this._strokeTemplate, V = this._fillTemplate;
584
+ for (T = e; T < i; T++) {
585
+ this._dindex = T;
586
+ const O = this._dataItems[T];
587
+ let R = O.get(g), B = O.get(v);
588
+ if (R == null || B == null ? h || (k = [], A.push(k), Z.points = k) : this._getPoints(O, Z), M) {
589
+ let b = O.dataContext[M];
590
+ if (b)
591
+ if (b instanceof F || (b = F.new(b)), this._strokeTemplate = b, T > e) {
592
+ i = T;
593
+ break;
594
+ } else
595
+ N = b, r.template = b;
596
+ }
597
+ if (C) {
598
+ let b = O.dataContext[C];
599
+ if (b)
600
+ if (b instanceof F || (b = F.new(b)), this._fillTemplate = b, T > e) {
601
+ i = T;
602
+ break;
603
+ } else
604
+ V = b, f.template = b;
605
+ }
606
+ if (!h) {
607
+ let b = this.dataItems[T + 1];
608
+ b && d.shouldGap(O, b, l, j) && (k = [], A.push(k), Z.points = k);
609
+ }
610
+ }
611
+ f.setRaw("userData", [e, T]), r.setRaw("userData", [e, T]), T === t && this._endLine(k, A[0][0]), r && this._drawStroke(r, A), f && this._drawFill(f, A), this.axisRanges.each((O) => {
612
+ const R = O.container, B = O.fills, b = this.makeFill(B);
613
+ R && R.children.push(b), b.setPrivate("visible", !0), this._drawFill(b, A);
614
+ const xe = O.strokes, E = this.makeStroke(xe);
615
+ R && R.children.push(E), N && N != this.strokes.template && (E.template = N), V && V != this.fills.template && (b.template = V), E.setPrivate("visible", !0), this._drawStroke(E, A), b.setRaw("userData", [e, T]), E.setRaw("userData", [e, T]);
616
+ });
617
+ }
618
+ _getPoints(e, t) {
619
+ let i = t.points, l = e.get("locationX", t.locationX), h = e.get("locationY", t.locationY);
620
+ const f = this.get("exactLocationX", !1), n = this.get("exactLocationY", !1);
621
+ let c = t.xAxis.getDataItemPositionX(e, t.xField, l, t.vcx, f), r = t.yAxis.getDataItemPositionY(e, t.yField, h, t.vcy, n);
622
+ if (this._shouldInclude(c)) {
623
+ const o = this.getPoint(c, r), s = [o.x, o.y];
624
+ if (o.x += this._x, o.y += this._y, e.set("point", o), t.fillVisible) {
625
+ let a = c, d = r;
626
+ if (t.baseAxis === t.xAxis ? d = t.basePosY : t.baseAxis === t.yAxis && (a = t.basePosX), t.getOpen) {
627
+ let p = e.get(t.xOpenField), g = e.get(t.yOpenField);
628
+ if (p != null && g != null) {
629
+ let v = e.get("openLocationX", t.openLocationX), y = e.get("openLocationY", t.openLocationY);
630
+ if (t.stacked) {
631
+ let _ = e.get("stackToItemX"), x = e.get("stackToItemY");
632
+ _ ? (a = t.xAxis.getDataItemPositionX(_, t.xField, v, _.component.get("vcx"), f), ne(a) && (a = t.basePosX)) : t.yAxis === t.baseAxis ? a = t.basePosX : a = t.xAxis.getDataItemPositionX(e, t.xOpenField, v, t.vcx, f), x ? (d = t.yAxis.getDataItemPositionY(x, t.yField, y, x.component.get("vcy"), n), ne(d) && (d = t.basePosY)) : t.xAxis === t.baseAxis ? d = t.basePosY : d = t.yAxis.getDataItemPositionY(e, t.yOpenField, y, t.vcy, n);
633
+ } else
634
+ a = t.xAxis.getDataItemPositionX(e, t.xOpenField, v, t.vcx, f), d = t.yAxis.getDataItemPositionY(e, t.yOpenField, y, t.vcy, n);
635
+ }
636
+ }
637
+ let m = this.getPoint(a, d);
638
+ s[2] = m.x, s[3] = m.y;
639
+ }
640
+ if (t.minDistance > 0) {
641
+ const a = s[0], d = s[1], m = s[2], p = s[3], g = this._previousPoint, v = g[0], y = g[1], _ = g[2], x = g[3];
642
+ (Math.hypot(a - v, d - y) > t.minDistance || m && p && Math.hypot(m - _, p - x) > t.minDistance) && (i.push(s), this._previousPoint = s);
643
+ } else
644
+ i.push(s);
645
+ }
646
+ }
647
+ _endLine(e, t) {
648
+ }
649
+ _drawStroke(e, t) {
650
+ e.get("visible") && !e.get("forceHidden") && e.set("draw", (i) => {
651
+ I(t, (l) => {
652
+ this._strokeGenerator.context(i), this._strokeGenerator(l);
653
+ });
654
+ });
655
+ }
656
+ _drawFill(e, t) {
657
+ e.get("visible") && !e.get("forceHidden") && e.set("draw", (i) => {
658
+ I(t, (l) => {
659
+ this._fillGenerator.context(i), this._fillGenerator(l);
660
+ });
661
+ });
662
+ }
663
+ _processAxisRange(e) {
664
+ super._processAxisRange(e), e.fills = new $(F.new({}), () => Y._new(this._root, {
665
+ themeTags: P(e.fills.template.get("themeTags", []), ["line", "series", "fill"])
666
+ }, [this.fills.template, e.fills.template])), e.strokes = new $(F.new({}), () => Y._new(this._root, {
667
+ themeTags: P(e.strokes.template.get("themeTags", []), ["line", "series", "stroke"])
668
+ }, [this.strokes.template, e.strokes.template]));
669
+ }
670
+ /**
671
+ * @ignore
672
+ */
673
+ createLegendMarker(e) {
674
+ const t = this.get("legendDataItem");
675
+ if (t) {
676
+ const i = t.get("marker"), l = t.get("markerRectangle");
677
+ l && l.setPrivate("visible", !1), i.set("background", we.new(i._root, { fillOpacity: 0, fill: he(0) }));
678
+ const h = i.children.push(Y._new(i._root, {
679
+ themeTags: ["line", "series", "legend", "marker", "stroke"],
680
+ interactive: !1
681
+ }, [this.strokes.template]));
682
+ this._legendStroke = h;
683
+ const f = i.children.push(Y._new(i._root, {
684
+ themeTags: ["line", "series", "legend", "marker", "fill"]
685
+ }, [this.fills.template]));
686
+ this._legendFill = f;
687
+ const n = this._root.interfaceColors.get("disabled");
688
+ if (h.states.create("disabled", { fill: n, stroke: n }), f.states.create("disabled", { fill: n, stroke: n }), this.bullets.length > 0) {
689
+ const c = this.bullets.getIndex(0);
690
+ if (c) {
691
+ const r = c(i._root, this, new ye(this, { legend: !0 }, {}));
692
+ if (r) {
693
+ const o = r.get("sprite");
694
+ o instanceof Y && o.states.create("disabled", { fill: n, stroke: n }), o && (o.setAll({
695
+ tooltipText: void 0,
696
+ tooltipHTML: void 0,
697
+ focusable: void 0,
698
+ focusableGroup: void 0,
699
+ ariaLabel: void 0
700
+ }), i.children.push(o), o.setAll({ x: i.width() / 2, y: i.height() / 2 }), i.events.on("boundschanged", () => {
701
+ o.setAll({ x: i.width() / 2, y: i.height() / 2 });
702
+ }));
703
+ }
704
+ }
705
+ }
706
+ }
707
+ }
708
+ }
709
+ Object.defineProperty(z, "className", {
710
+ enumerable: !0,
711
+ configurable: !0,
712
+ writable: !0,
713
+ value: "LineSeries"
714
+ });
715
+ Object.defineProperty(z, "classNames", {
716
+ enumerable: !0,
717
+ configurable: !0,
718
+ writable: !0,
719
+ value: oe.classNames.concat([z.className])
720
+ });
721
+ const Ie = (u) => {
722
+ const e = Me({
723
+ props: u,
724
+ name: "MuiHighlightLineChart"
725
+ }), {
726
+ seriesData: t,
727
+ height: i = "500px",
728
+ width: l = "100%",
729
+ chartId: h = "highlight-line-chart",
730
+ showLegend: f = !0,
731
+ loading: n = !1,
732
+ emptyMessage: c = "No data available",
733
+ sx: r,
734
+ ...o
735
+ } = e, s = {
736
+ ...e,
737
+ height: i,
738
+ width: l,
739
+ chartId: h,
740
+ showLegend: f,
741
+ loading: n,
742
+ emptyMessage: c
743
+ }, a = Q(null), d = Q(null), m = Q(null);
744
+ return Ye(() => {
745
+ if (!m.current) return;
746
+ const p = Te.new(m.current);
747
+ d.current = p, p.setThemes([Pe.new(p)]);
748
+ const g = p.container.children.push(
749
+ Fe.new(p, {
750
+ panX: !0,
751
+ panY: !0,
752
+ wheelX: "panX",
753
+ wheelY: "zoomX",
754
+ pinchZoomX: !0
755
+ })
756
+ );
757
+ a.current = g, g.set(
758
+ "cursor",
759
+ Le.new(p, {
760
+ behavior: "zoomX"
761
+ })
762
+ ).lineY.set("visible", !1);
763
+ const v = g.xAxes.push(
764
+ De.new(p, {
765
+ maxDeviation: 0.3,
766
+ baseInterval: { timeUnit: "day", count: 1 },
767
+ renderer: Ae.new(p, {
768
+ minorGridEnabled: !0
769
+ })
770
+ })
771
+ ), y = g.yAxes.push(
772
+ Ce.new(p, {
773
+ renderer: Oe.new(p, {})
774
+ })
775
+ ), _ = [], x = Xe.new(p, {});
776
+ t.forEach((k, M) => {
777
+ const C = k.color ? he(k.color) : x.getIndex(M), L = g.series.push(
778
+ z.new(p, {
779
+ name: k.name,
780
+ xAxis: v,
781
+ yAxis: y,
782
+ valueYField: "value",
783
+ valueXField: "date",
784
+ stroke: C,
785
+ fill: C,
786
+ tooltip: $e.new(p, {
787
+ labelText: "{name}: {valueY}"
788
+ })
789
+ })
790
+ );
791
+ L.strokes.template.setAll({
792
+ strokeWidth: 2
793
+ }), L.data.setAll(k.data), _.push(L);
794
+ });
795
+ let D = null;
796
+ f && (D = g.children.push(
797
+ H.new(p, {
798
+ centerX: re(50),
799
+ x: re(50),
800
+ layout: p.horizontalLayout
801
+ })
802
+ ), D.data.setAll(g.series.values));
803
+ const G = 1, W = 0.2, q = 4, j = (k) => {
804
+ var L;
805
+ const C = (L = k.target.dataItem) == null ? void 0 : L.dataContext;
806
+ C && (C.strokes.template.set("strokeOpacity", 1), C.strokes.template.set("strokeWidth", q), _.forEach((X) => {
807
+ X !== C && (X.strokes.template.set("strokeOpacity", W), X.strokes.template.set("strokeWidth", 1));
808
+ }));
809
+ }, A = (k) => {
810
+ var L;
811
+ ((L = k.target.dataItem) == null ? void 0 : L.dataContext) && _.forEach((X) => {
812
+ X.strokes.template.set("strokeOpacity", G), X.strokes.template.set("strokeWidth", 2);
813
+ });
814
+ };
815
+ return D && (D.markers.template.events.on("pointerover", j), D.markers.template.events.on("pointerout", A)), g.appear(1e3, 100), _.forEach((k, M) => {
816
+ k.appear(1e3, 100 * (M + 1));
817
+ }), () => {
818
+ p.dispose();
819
+ };
820
+ }, [h, t, f]), {
821
+ chartDivRef: m,
822
+ seriesData: t,
823
+ height: i,
824
+ width: l,
825
+ chartId: h,
826
+ showLegend: f,
827
+ loading: n,
828
+ emptyMessage: c,
829
+ sx: r,
830
+ other: o,
831
+ ownerState: s
832
+ };
833
+ };
834
+ export {
835
+ Ie as useHighlightLineChartLogic
836
+ };