@adyen/lume 0.1.8 → 0.2.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.
@@ -1,3007 +0,0 @@
1
- import D, { isRef as Bt, reactive as lt, computed as v, ref as $, watch as N, defineComponent as L, toRefs as w, onBeforeMount as oe, onMounted as V, onBeforeUnmount as gt, watchEffect as Mt, toRef as se, defineAsyncComponent as ht } from "vue";
2
- import { sankeyLinkHorizontal as ie, sankey as le, sankeyJustify as ue } from "d3-sankey";
3
- import { format as ce, ticks as de, scaleBand as J, scaleLinear as Q, line as fe, area as pe } from "d3";
4
- import { createPopper as ve } from "@popperjs/core";
5
- function ot(e) {
6
- return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? ot = function(t) {
7
- return typeof t;
8
- } : ot = function(t) {
9
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
10
- }, ot(e);
11
- }
12
- function he(e) {
13
- return _e(e) || me(e) || ge();
14
- }
15
- function _e(e) {
16
- if (Array.isArray(e)) {
17
- for (var t = 0, n = new Array(e.length); t < e.length; t++)
18
- n[t] = e[t];
19
- return n;
20
- }
21
- }
22
- function me(e) {
23
- if (Symbol.iterator in Object(e) || Object.prototype.toString.call(e) === "[object Arguments]")
24
- return Array.from(e);
25
- }
26
- function ge() {
27
- throw new TypeError("Invalid attempt to spread non-iterable instance");
28
- }
29
- var at = typeof window < "u";
30
- function ye(e) {
31
- return Array.isArray(e) || ot(e) === "object" ? Object.freeze(e) : e;
32
- }
33
- function be(e) {
34
- var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
35
- return e.reduce(function(n, r) {
36
- var a = r.passengers[0], o = typeof a == "function" ? a(t) : r.passengers;
37
- return n.concat(o);
38
- }, []);
39
- }
40
- function xe(e, t) {
41
- return e.map(function(n, r) {
42
- return [r, n];
43
- }).sort(function(n, r) {
44
- return t(n[1], r[1]) || n[0] - r[0];
45
- }).map(function(n) {
46
- return n[1];
47
- });
48
- }
49
- function St(e, t) {
50
- return t.reduce(function(n, r) {
51
- return e.hasOwnProperty(r) && (n[r] = e[r]), n;
52
- }, {});
53
- }
54
- var Ht = {}, Te = {}, Ae = {}, Oe = D.extend({
55
- data: function() {
56
- return {
57
- transports: Ht,
58
- targets: Te,
59
- sources: Ae,
60
- trackInstances: at
61
- };
62
- },
63
- methods: {
64
- open: function(t) {
65
- if (!!at) {
66
- var n = t.to, r = t.from, a = t.passengers, o = t.order, s = o === void 0 ? 1 / 0 : o;
67
- if (!(!n || !r || !a)) {
68
- var l = {
69
- to: n,
70
- from: r,
71
- passengers: ye(a),
72
- order: s
73
- }, i = Object.keys(this.transports);
74
- i.indexOf(n) === -1 && D.set(this.transports, n, []);
75
- var u = this.$_getTransportIndex(l), h = this.transports[n].slice(0);
76
- u === -1 ? h.push(l) : h[u] = l, this.transports[n] = xe(h, function(c, f) {
77
- return c.order - f.order;
78
- });
79
- }
80
- }
81
- },
82
- close: function(t) {
83
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, r = t.to, a = t.from;
84
- if (!(!r || !a && n === !1) && !!this.transports[r])
85
- if (n)
86
- this.transports[r] = [];
87
- else {
88
- var o = this.$_getTransportIndex(t);
89
- if (o >= 0) {
90
- var s = this.transports[r].slice(0);
91
- s.splice(o, 1), this.transports[r] = s;
92
- }
93
- }
94
- },
95
- registerTarget: function(t, n, r) {
96
- !at || (this.trackInstances && !r && this.targets[t] && console.warn("[portal-vue]: Target ".concat(t, " already exists")), this.$set(this.targets, t, Object.freeze([n])));
97
- },
98
- unregisterTarget: function(t) {
99
- this.$delete(this.targets, t);
100
- },
101
- registerSource: function(t, n, r) {
102
- !at || (this.trackInstances && !r && this.sources[t] && console.warn("[portal-vue]: source ".concat(t, " already exists")), this.$set(this.sources, t, Object.freeze([n])));
103
- },
104
- unregisterSource: function(t) {
105
- this.$delete(this.sources, t);
106
- },
107
- hasTarget: function(t) {
108
- return !!(this.targets[t] && this.targets[t][0]);
109
- },
110
- hasSource: function(t) {
111
- return !!(this.sources[t] && this.sources[t][0]);
112
- },
113
- hasContentFor: function(t) {
114
- return !!this.transports[t] && !!this.transports[t].length;
115
- },
116
- $_getTransportIndex: function(t) {
117
- var n = t.to, r = t.from;
118
- for (var a in this.transports[n])
119
- if (this.transports[n][a].from === r)
120
- return +a;
121
- return -1;
122
- }
123
- }
124
- }), P = new Oe(Ht), $e = 1, yt = D.extend({
125
- name: "portal",
126
- props: {
127
- disabled: {
128
- type: Boolean
129
- },
130
- name: {
131
- type: String,
132
- default: function() {
133
- return String($e++);
134
- }
135
- },
136
- order: {
137
- type: Number,
138
- default: 0
139
- },
140
- slim: {
141
- type: Boolean
142
- },
143
- slotProps: {
144
- type: Object,
145
- default: function() {
146
- return {};
147
- }
148
- },
149
- tag: {
150
- type: String,
151
- default: "DIV"
152
- },
153
- to: {
154
- type: String,
155
- default: function() {
156
- return String(Math.round(Math.random() * 1e7));
157
- }
158
- }
159
- },
160
- created: function() {
161
- var t = this;
162
- this.$nextTick(function() {
163
- P.registerSource(t.name, t);
164
- });
165
- },
166
- mounted: function() {
167
- this.disabled || this.sendUpdate();
168
- },
169
- updated: function() {
170
- this.disabled ? this.clear() : this.sendUpdate();
171
- },
172
- beforeDestroy: function() {
173
- P.unregisterSource(this.name), this.clear();
174
- },
175
- watch: {
176
- to: function(t, n) {
177
- n && n !== t && this.clear(n), this.sendUpdate();
178
- }
179
- },
180
- methods: {
181
- clear: function(t) {
182
- var n = {
183
- from: this.name,
184
- to: t || this.to
185
- };
186
- P.close(n);
187
- },
188
- normalizeSlots: function() {
189
- return this.$scopedSlots.default ? [this.$scopedSlots.default] : this.$slots.default;
190
- },
191
- normalizeOwnChildren: function(t) {
192
- return typeof t == "function" ? t(this.slotProps) : t;
193
- },
194
- sendUpdate: function() {
195
- var t = this.normalizeSlots();
196
- if (t) {
197
- var n = {
198
- from: this.name,
199
- to: this.to,
200
- passengers: he(t),
201
- order: this.order
202
- };
203
- P.open(n);
204
- } else
205
- this.clear();
206
- }
207
- },
208
- render: function(t) {
209
- var n = this.$slots.default || this.$scopedSlots.default || [], r = this.tag;
210
- return n && this.disabled ? n.length <= 1 && this.slim ? this.normalizeOwnChildren(n)[0] : t(r, [this.normalizeOwnChildren(n)]) : this.slim ? t() : t(r, {
211
- class: {
212
- "v-portal": !0
213
- },
214
- style: {
215
- display: "none"
216
- },
217
- key: "v-portal-placeholder"
218
- });
219
- }
220
- }), bt = D.extend({
221
- name: "portalTarget",
222
- props: {
223
- multiple: {
224
- type: Boolean,
225
- default: !1
226
- },
227
- name: {
228
- type: String,
229
- required: !0
230
- },
231
- slim: {
232
- type: Boolean,
233
- default: !1
234
- },
235
- slotProps: {
236
- type: Object,
237
- default: function() {
238
- return {};
239
- }
240
- },
241
- tag: {
242
- type: String,
243
- default: "div"
244
- },
245
- transition: {
246
- type: [String, Object, Function]
247
- }
248
- },
249
- data: function() {
250
- return {
251
- transports: P.transports,
252
- firstRender: !0
253
- };
254
- },
255
- created: function() {
256
- var t = this;
257
- this.$nextTick(function() {
258
- P.registerTarget(t.name, t);
259
- });
260
- },
261
- watch: {
262
- ownTransports: function() {
263
- this.$emit("change", this.children().length > 0);
264
- },
265
- name: function(t, n) {
266
- P.unregisterTarget(n), P.registerTarget(t, this);
267
- }
268
- },
269
- mounted: function() {
270
- var t = this;
271
- this.transition && this.$nextTick(function() {
272
- t.firstRender = !1;
273
- });
274
- },
275
- beforeDestroy: function() {
276
- P.unregisterTarget(this.name);
277
- },
278
- computed: {
279
- ownTransports: function() {
280
- var t = this.transports[this.name] || [];
281
- return this.multiple ? t : t.length === 0 ? [] : [t[t.length - 1]];
282
- },
283
- passengers: function() {
284
- return be(this.ownTransports, this.slotProps);
285
- }
286
- },
287
- methods: {
288
- children: function() {
289
- return this.passengers.length !== 0 ? this.passengers : this.$scopedSlots.default ? this.$scopedSlots.default(this.slotProps) : this.$slots.default || [];
290
- },
291
- noWrapper: function() {
292
- var t = this.slim && !this.transition;
293
- return t && this.children().length > 1 && console.warn("[portal-vue]: PortalTarget with `slim` option received more than one child element."), t;
294
- }
295
- },
296
- render: function(t) {
297
- var n = this.noWrapper(), r = this.children(), a = this.transition || this.tag;
298
- return n ? r[0] : this.slim && !a ? t() : t(a, {
299
- props: {
300
- tag: this.transition && this.tag ? this.tag : void 0
301
- },
302
- class: {
303
- "vue-portal-target": !0
304
- }
305
- }, r);
306
- }
307
- }), ke = 0, Le = ["disabled", "name", "order", "slim", "slotProps", "tag", "to"], Se = ["multiple", "transition"];
308
- D.extend({
309
- name: "MountingPortal",
310
- inheritAttrs: !1,
311
- props: {
312
- append: {
313
- type: [Boolean, String]
314
- },
315
- bail: {
316
- type: Boolean
317
- },
318
- mountTo: {
319
- type: String,
320
- required: !0
321
- },
322
- disabled: {
323
- type: Boolean
324
- },
325
- name: {
326
- type: String,
327
- default: function() {
328
- return "mounted_" + String(ke++);
329
- }
330
- },
331
- order: {
332
- type: Number,
333
- default: 0
334
- },
335
- slim: {
336
- type: Boolean
337
- },
338
- slotProps: {
339
- type: Object,
340
- default: function() {
341
- return {};
342
- }
343
- },
344
- tag: {
345
- type: String,
346
- default: "DIV"
347
- },
348
- to: {
349
- type: String,
350
- default: function() {
351
- return String(Math.round(Math.random() * 1e7));
352
- }
353
- },
354
- multiple: {
355
- type: Boolean,
356
- default: !1
357
- },
358
- targetSlim: {
359
- type: Boolean
360
- },
361
- targetSlotProps: {
362
- type: Object,
363
- default: function() {
364
- return {};
365
- }
366
- },
367
- targetTag: {
368
- type: String,
369
- default: "div"
370
- },
371
- transition: {
372
- type: [String, Object, Function]
373
- }
374
- },
375
- created: function() {
376
- if (!(typeof document > "u")) {
377
- var t = document.querySelector(this.mountTo);
378
- if (!t) {
379
- console.error("[portal-vue]: Mount Point '".concat(this.mountTo, "' not found in document"));
380
- return;
381
- }
382
- var n = this.$props;
383
- if (P.targets[n.name]) {
384
- n.bail ? console.warn("[portal-vue]: Target ".concat(n.name, ` is already mounted.
385
- Aborting because 'bail: true' is set`)) : this.portalTarget = P.targets[n.name];
386
- return;
387
- }
388
- var r = n.append;
389
- if (r) {
390
- var a = typeof r == "string" ? r : "DIV", o = document.createElement(a);
391
- t.appendChild(o), t = o;
392
- }
393
- var s = St(this.$props, Se);
394
- s.slim = this.targetSlim, s.tag = this.targetTag, s.slotProps = this.targetSlotProps, s.name = this.to, this.portalTarget = new bt({
395
- el: t,
396
- parent: this.$parent || this,
397
- propsData: s
398
- });
399
- }
400
- },
401
- beforeDestroy: function() {
402
- var t = this.portalTarget;
403
- if (this.append) {
404
- var n = t.$el;
405
- n.parentNode.removeChild(n);
406
- }
407
- t.$destroy();
408
- },
409
- render: function(t) {
410
- if (!this.portalTarget)
411
- return console.warn("[portal-vue] Target wasn't mounted"), t();
412
- if (!this.$scopedSlots.manual) {
413
- var n = St(this.$props, Le);
414
- return t(yt, {
415
- props: n,
416
- attrs: this.$attrs,
417
- on: this.$listeners,
418
- scopedSlots: this.$scopedSlots
419
- }, this.$slots.default);
420
- }
421
- var r = this.$scopedSlots.manual({
422
- to: this.to
423
- });
424
- return Array.isArray(r) && (r = r[0]), r || t();
425
- }
426
- });
427
- var M = /* @__PURE__ */ ((e) => (e.Skyblue = "skyblue", e.Royalblue = "royalblue", e.Violet = "violet", e.Darkteal = "darkteal", e.Gold = "gold", e))(M || {}), xt = /* @__PURE__ */ ((e) => (e.SkyTeal = "skyblue-darkteal", e.VioletRoyal = "violet-royalblue", e.VioletTeal = "violet-darkteal", e.GoldTeal = "gold-darkteal", e.GoldRoyal = "gold-royalblue", e))(xt || {}), Tt = /* @__PURE__ */ ((e) => (e["01"] = "01", e["02"] = "02", e["03"] = "03", e["04"] = "04", e["05"] = "05", e["06"] = "06", e["07"] = "07", e["08"] = "08", e["09"] = "09", e))(Tt || {});
428
- const T = {
429
- HORIZONTAL: "horizontal",
430
- VERTICAL: "vertical"
431
- }, we = {
432
- SINGLE: "single",
433
- GROUPED: "grouped",
434
- STACKED: "stacked"
435
- }, Z = {
436
- VERTICAL: {
437
- top: 16,
438
- right: 0,
439
- bottom: 28,
440
- left: 24
441
- },
442
- HORIZONTAL: {
443
- top: 16,
444
- right: 0,
445
- bottom: 28,
446
- left: 24
447
- }
448
- }, jt = "No data", Ce = 20, Ie = 0.33, Ne = 0.5, De = 1, At = [
449
- "auto",
450
- "auto-start",
451
- "auto-end",
452
- "top",
453
- "top-start",
454
- "top-end",
455
- "right",
456
- "right-start",
457
- "right-end",
458
- "bottom",
459
- "bottom-start",
460
- "bottom-end",
461
- "left",
462
- "left-start",
463
- "left-end"
464
- ];
465
- var W = /* @__PURE__ */ ((e) => (e.Categorical = "categorical", e.Sequential = "sequential", e.Divergent = "divergent", e))(W || {});
466
- function Re() {
467
- return process.env.NODE_ENV === "production";
468
- }
469
- function Ft(e) {
470
- return (e == null ? void 0 : e.map(
471
- (t) => t.values.map((n) => n == null ? void 0 : n.value).flat()
472
- ).flat()) || [];
473
- }
474
- function ut(e) {
475
- return e.length === 1;
476
- }
477
- function _t(e) {
478
- return !!e && typeof e == "object" && !Array.isArray(e);
479
- }
480
- function Vt(e, t) {
481
- const n = structuredClone(e);
482
- return Object.entries(t).forEach(([r, a]) => {
483
- n[r] = _t(e[r]) && _t(a) ? Vt(e[r], a) : a;
484
- }), n;
485
- }
486
- function Pe(e) {
487
- return e != null && _t(e) && "value" in e;
488
- }
489
- function U(e) {
490
- return (e == null ? void 0 : e.bandwidth) !== void 0;
491
- }
492
- function Ot(e) {
493
- return U(e) ? e.bandwidth() : Math.max(...e.range()) / Math.max(...e.domain());
494
- }
495
- const Ee = (e, t) => {
496
- if (!e)
497
- throw new Error("Data is not a valid array");
498
- if (e.length === 0)
499
- throw new Error("Cannot get highest value from empty array");
500
- e.forEach(({ values: n }) => {
501
- if (n.length - 1 < t)
502
- throw new Error("Index exceeds length of at least one of the datasets");
503
- });
504
- };
505
- function Gt(e, t) {
506
- var n;
507
- return Ee(e, t), ((n = e.reduce(
508
- (r, a) => {
509
- var o, s, l, i;
510
- return ((s = (o = r.values[t]) == null ? void 0 : o.value) != null ? s : 0) > ((i = (l = a.values[t]) == null ? void 0 : l.value) != null ? i : 0) ? r : a;
511
- }
512
- ).values[t]) == null ? void 0 : n.value) || 0;
513
- }
514
- function st(e) {
515
- const t = Bt(e) ? e.value : e;
516
- if (!t)
517
- throw new Error("No empty array can be created from specified data value");
518
- const n = Math.max(
519
- ...t.map((r) => r.values.length),
520
- 0
521
- );
522
- return Array(n).fill(null);
523
- }
524
- function Be(e) {
525
- return U(e) ? e.domain().length : Math.max(...e.domain());
526
- }
527
- function Me(e, t) {
528
- return (n) => Math.round(e * (1 - n) + t * n);
529
- }
530
- function R(e) {
531
- var t;
532
- return typeof e == "string" || typeof e == "number" ? e : (t = e.id) != null ? t : e.label;
533
- }
534
- function zt(e, t) {
535
- return t.length && t.indexOf(e) === -1;
536
- }
537
- function He(e, t, n) {
538
- const r = n ? e.length - t : t, a = e.slice(0, r);
539
- return e.slice(r).concat(a);
540
- }
541
- function q(e) {
542
- if (e.groups) {
543
- const t = Object.keys(e);
544
- return Object.assign(
545
- {},
546
- ...t.map((n) => n !== "groups" ? { [n]: e[n] } : {})
547
- );
548
- }
549
- return e;
550
- }
551
- const je = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce(
552
- (t, n) => t += (n &= 63) < 36 ? n.toString(36) : n < 62 ? (n - 26).toString(36).toUpperCase() : n > 62 ? "-" : "_",
553
- ""
554
- );
555
- var tt = /* @__PURE__ */ ((e) => (e.DatasetLength = `Our guidelines highly recommend not having more than 5 datasets in one chart.
556
- Learn more: https://lume.design/guidelines/datasets`, e.ColorLoop = "Colors will loop around after the 5th dataset. You can prevent this by setting specific colors for your datasets.", e.InvalidFormat = "The string provided to format is invalid. Please refer to https://github.com/d3/d3-format for valid arguments.", e.NotContainedInSvg = "This component is an `SVGElement`, thus it is required to be inside an `<svg>` container.", e))(tt || {});
557
- const Fe = "[lume] ";
558
- function ct(e, t = !0) {
559
- t && Re() || console.warn(Fe + "Warning: " + e);
560
- }
561
- const Ve = W.Categorical, Ge = M.Skyblue, ze = xt.SkyTeal;
562
- function We(e) {
563
- return e === W.Divergent ? ze : Ge;
564
- }
565
- function Ze(e) {
566
- return Object.values(Tt).includes(e);
567
- }
568
- function wt(e, t) {
569
- return t === W.Divergent ? Object.values(xt).includes(e) : Object.values({ ...M, ...Tt }).includes(
570
- e
571
- );
572
- }
573
- function qe(e, t) {
574
- const n = Object.values(M).indexOf(e);
575
- return He(Object.values(M), n)[t];
576
- }
577
- function Xe(e, t) {
578
- const n = 50 + t * 10;
579
- return `${e}-${n}`;
580
- }
581
- function Ue(e, t) {
582
- const n = (t + 1) * 10;
583
- return `${e}-${n}`;
584
- }
585
- function Ct(e, t, n) {
586
- switch (t) {
587
- default:
588
- case W.Categorical:
589
- return Ze(e) ? e : qe(e, n);
590
- case W.Sequential:
591
- return Xe(e, n);
592
- case W.Divergent:
593
- return Ue(e, n);
594
- }
595
- }
596
- function Ye(e, t, n = Ve, r) {
597
- return wt(e, n) ? e : (r > 4 && (ct(tt.ColorLoop), r = r % 5), wt(t, n) ? Ct(t, n, r) : Ct(We(n), n, r));
598
- }
599
- function Ke(e) {
600
- return e.map((t) => Pe(t) ? t : { value: t });
601
- }
602
- function Je(e) {
603
- return e.__internal === !0;
604
- }
605
- const Wt = (e = null) => ({
606
- data: {
607
- type: Array,
608
- required: !0,
609
- validator: e || void 0
610
- },
611
- labels: {
612
- type: Array,
613
- default: void 0
614
- },
615
- color: {
616
- type: String,
617
- default: M.Skyblue
618
- }
619
- });
620
- function dt(e, t, n, r, a) {
621
- const o = lt({
622
- width: 0,
623
- height: 0
624
- }), s = je(12), l = v(() => {
625
- var h;
626
- return e.value.length > 5 && ct(tt.DatasetLength), (h = e.value) == null ? void 0 : h.map(
627
- (c, f) => {
628
- if (Je(c))
629
- return c;
630
- const p = Ke(c.values), d = Ye(
631
- c.color,
632
- n == null ? void 0 : n.value,
633
- r == null ? void 0 : r.value.colorPalette,
634
- f
635
- );
636
- return {
637
- ...c,
638
- values: p,
639
- color: d,
640
- __internal: !0
641
- };
642
- }
643
- );
644
- }), i = v(() => Array.isArray(t.value) ? t.value : st(e.value).map((h, c) => c));
645
- function u(h) {
646
- const c = (a == null ? void 0 : a.value) === T.HORIZONTAL ? st(e).length * (Ce * 2) : h.height;
647
- D.set(o, "width", h.width), D.set(o, "height", c);
648
- }
649
- return {
650
- chartID: s,
651
- computedLabels: i,
652
- containerSize: o,
653
- internalData: l,
654
- updateSize: u
655
- };
656
- }
657
- const Zt = (e) => {
658
- let t = null;
659
- switch (typeof e) {
660
- case "string":
661
- try {
662
- t = ce(e);
663
- } catch {
664
- ct(tt.InvalidFormat), t = null;
665
- }
666
- break;
667
- case "function":
668
- t = e;
669
- break;
670
- default:
671
- t = null;
672
- }
673
- function n(r) {
674
- return t ? t(r) : r;
675
- }
676
- return n;
677
- }, ft = () => ({
678
- options: {
679
- type: Object,
680
- default: () => ({})
681
- }
682
- });
683
- function F(e, t) {
684
- return { allOptions: v(() => {
685
- const r = Bt(t) ? t == null ? void 0 : t.value : t;
686
- return r ? Vt(r, e.value) : e.value;
687
- }) };
688
- }
689
- const Qe = 0.15;
690
- function tn(e, t, n) {
691
- const r = $(), a = v(() => Math.max(...e.value.range())), o = v(() => t.value.length);
692
- function s() {
693
- if (!t.value)
694
- return;
695
- const i = t.value.reduce(
696
- (h, c) => h + c.getBoundingClientRect().width,
697
- 0
698
- ), u = Math.ceil(i / o.value);
699
- r.value = u + u * Qe;
700
- }
701
- function l(i) {
702
- if (!t.value)
703
- return !0;
704
- const u = t.value.length;
705
- if (i === 0)
706
- return !0;
707
- const h = a.value / u, c = typeof n == "number" && n > 0 && n + 1 || Math.ceil(r.value / h);
708
- return i % c === 0;
709
- }
710
- return N(t, s), { showTick: l };
711
- }
712
- function pt(e) {
713
- e != null && e.closest("svg") || ct(tt.NotContainedInSvg);
714
- }
715
- const qt = {
716
- gridLines: !1,
717
- withTitle: !0,
718
- showTicks: !0,
719
- tickCount: 10,
720
- tickFormat: null,
721
- tickPadding: 8
722
- }, en = {
723
- ...qt,
724
- withTitle: !1,
725
- skip: !0
726
- }, nn = {
727
- ...qt,
728
- gridLines: !0
729
- }, rn = 12, an = 8, on = function(e, t, n) {
730
- const r = v(() => e.value.step() * e.value.paddingInner() / 2);
731
- function a(i) {
732
- return {
733
- transform: `translate(${e.value(i) - r.value}, 0)`
734
- };
735
- }
736
- function o() {
737
- return {
738
- x: -8,
739
- width: e.value.step() + 16,
740
- height: n.value.tickPadding + rn + an
741
- };
742
- }
743
- function s() {
744
- const i = e.value.step() / 2;
745
- return {
746
- x1: i,
747
- x2: i,
748
- y1: -t.value.height
749
- };
750
- }
751
- function l() {
752
- return {
753
- x: e.value.step() / 2,
754
- y: n.value.tickPadding,
755
- dy: "0.8em",
756
- "text-anchor": "middle"
757
- };
758
- }
759
- return {
760
- getGridLinesAttributes: s,
761
- getTickGhostAttributes: o,
762
- getTickGroupAttributes: a,
763
- getTickLabelAttributes: l
764
- };
765
- }, sn = function(e, t, n) {
766
- const r = v(() => e.value.step() * e.value.paddingInner() / 2);
767
- function a(i) {
768
- return {
769
- transform: `translate(0, ${e.value(i) - r.value})`
770
- };
771
- }
772
- function o() {
773
- return {
774
- x: -43,
775
- width: 42,
776
- height: e.value.step()
777
- };
778
- }
779
- function s() {
780
- const i = e.value.step() / 2;
781
- return {
782
- y1: i,
783
- y2: i,
784
- x1: t.value.width
785
- };
786
- }
787
- function l() {
788
- return {
789
- x: -n.value.tickPadding,
790
- y: e.value.step() / 2,
791
- "text-anchor": "end",
792
- "alignment-baseline": "middle"
793
- };
794
- }
795
- return {
796
- getGridLinesAttributes: s,
797
- getTickGhostAttributes: o,
798
- getTickGroupAttributes: a,
799
- getTickLabelAttributes: l
800
- };
801
- }, ln = function(e, t, n) {
802
- function r(l) {
803
- return {
804
- transform: `translate(${e.value(l)}, 0)`
805
- };
806
- }
807
- function a() {
808
- return {};
809
- }
810
- function o() {
811
- return {
812
- y1: -t.value.height
813
- };
814
- }
815
- function s() {
816
- return {
817
- y: n.value.tickPadding,
818
- dy: "0.8em",
819
- "text-anchor": "middle"
820
- };
821
- }
822
- return {
823
- getGridLinesAttributes: o,
824
- getTickGhostAttributes: a,
825
- getTickGroupAttributes: r,
826
- getTickLabelAttributes: s
827
- };
828
- }, un = function(e, t, n) {
829
- function r(l) {
830
- return {
831
- transform: `translate(0, ${e.value(l)})`
832
- };
833
- }
834
- function a() {
835
- return {};
836
- }
837
- function o() {
838
- return {
839
- x1: t.value.width
840
- };
841
- }
842
- function s() {
843
- return {
844
- x: -n.value.tickPadding,
845
- dy: "0.4em",
846
- "text-anchor": "end"
847
- };
848
- }
849
- return {
850
- getGridLinesAttributes: o,
851
- getTickGhostAttributes: a,
852
- getTickGroupAttributes: r,
853
- getTickLabelAttributes: s
854
- };
855
- }, cn = {
856
- "x-band-scale-axis": on,
857
- "y-band-scale-axis": sn,
858
- "x-linear-scale-axis": ln,
859
- "y-linear-scale-axis": un
860
- }, dn = {
861
- bandScale: "band-scale-axis",
862
- linearScale: "linear-scale-axis"
863
- }, fn = ["bottom", "left"], It = {
864
- x: "bottom",
865
- y: "left"
866
- }, pn = L({
867
- components: { VuePortal: yt, VuePortalTarget: bt },
868
- props: {
869
- scale: {
870
- type: Function,
871
- required: !0
872
- },
873
- type: {
874
- type: String,
875
- default: void 0,
876
- validator: (e) => e in It
877
- },
878
- position: {
879
- type: String,
880
- default: void 0,
881
- validator: (e) => fn.includes(e)
882
- },
883
- containerSize: {
884
- type: Object,
885
- default: () => ({ width: 0, height: 0 })
886
- },
887
- hoveredIndex: {
888
- type: Number,
889
- default: -1
890
- },
891
- orientation: {
892
- type: String,
893
- default: T.VERTICAL
894
- },
895
- ...ft()
896
- },
897
- setup(e, t) {
898
- const { scale: n, containerSize: r, hoveredIndex: a, options: o, orientation: s } = w(e), l = lt({}), i = $(null), u = $(!1), h = $(null), { chartID: c } = dt(), f = v(
899
- () => e.type ? It[e.type] : e.position
900
- ), p = v(
901
- () => e.type || (f.value === "left" ? "y" : "x")
902
- ), d = v(
903
- () => p.value === "x" && s.value === T.VERTICAL || p.value === "y" && s.value === T.HORIZONTAL
904
- ), { allOptions: _ } = F(
905
- o,
906
- p.value === "x" ? en : nn
907
- ), { showTick: y } = tn(n, i, _.value.skip), m = v(
908
- () => {
909
- var k;
910
- return `translate(0, ${p.value === "x" ? (k = r.value) == null ? void 0 : k.height : 0})`;
911
- }
912
- ), g = v(() => {
913
- if (n.value.step)
914
- return n.value.domain();
915
- const { tickCount: k } = _.value, [I, H] = n.value.domain();
916
- return de(I, H, k);
917
- }), b = v(() => {
918
- const { tickFormat: k } = _.value;
919
- return Zt(k);
920
- });
921
- function x(k) {
922
- const { showTicks: I } = _.value;
923
- return I === !1 ? "" : b.value(k);
924
- }
925
- function O(k) {
926
- d.value && t.emit("tick-mouseover", k);
927
- }
928
- function E(k) {
929
- return _.value.withHover && d.value && a.value === k;
930
- }
931
- function B(k) {
932
- return `${c}-${p.value}-tick--${k}`;
933
- }
934
- function C() {
935
- u.value = !0;
936
- const k = n.value.step ? "bandScale" : "linearScale", I = cn[`${p.value}-${dn[k]}`];
937
- Object.entries(I(n, r, _) || []).forEach(
938
- ([H, j]) => {
939
- l[H] = j;
940
- }
941
- ), u.value = !1;
942
- }
943
- return oe(async () => {
944
- C(), N(n, C, { flush: "sync" });
945
- }), V(() => pt(h.value)), {
946
- allOptions: _,
947
- axisTransform: m,
948
- chartID: c,
949
- computedPosition: f,
950
- computedType: p,
951
- formatTick: x,
952
- getTickId: B,
953
- isHovering: E,
954
- isLoading: u,
955
- mixins: l,
956
- onTickMouseover: O,
957
- root: h,
958
- shouldHover: d,
959
- showTick: y,
960
- tickRefs: i,
961
- ticks: g
962
- };
963
- }
964
- });
965
- function S(e, t, n, r, a, o, s, l) {
966
- var i = typeof e == "function" ? e.options : e;
967
- t && (i.render = t, i.staticRenderFns = n, i._compiled = !0), r && (i.functional = !0), o && (i._scopeId = "data-v-" + o);
968
- var u;
969
- if (s ? (u = function(f) {
970
- f = f || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !f && typeof __VUE_SSR_CONTEXT__ < "u" && (f = __VUE_SSR_CONTEXT__), a && a.call(this, f), f && f._registeredComponents && f._registeredComponents.add(s);
971
- }, i._ssrRegister = u) : a && (u = l ? function() {
972
- a.call(
973
- this,
974
- (i.functional ? this.parent : this).$root.$options.shadowRoot
975
- );
976
- } : a), u)
977
- if (i.functional) {
978
- i._injectStyles = u;
979
- var h = i.render;
980
- i.render = function(p, d) {
981
- return u.call(d), h(p, d);
982
- };
983
- } else {
984
- var c = i.beforeCreate;
985
- i.beforeCreate = c ? [].concat(c, u) : [u];
986
- }
987
- return {
988
- exports: e,
989
- options: i
990
- };
991
- }
992
- var vn = function() {
993
- var t = this, n = t._self._c;
994
- return t._self._setupProxy, t.scale && !t.isLoading ? n("g", { ref: "root", staticClass: "axis", attrs: { transform: t.axisTransform, "data-j-axis": "" } }, [t.computedType === "x" ? n("defs", [n("linearGradient", { attrs: { id: "lume-tick-gradient" } }, [n("stop", { attrs: { offset: "0%", "stop-color": "rgba(255,255,255,0)" } }), n("stop", { attrs: { offset: "10%", "stop-color": "var(--lume-chart-background-color)" } }), n("stop", { attrs: { offset: "90%", "stop-color": "var(--lume-chart-background-color)" } }), n("stop", { attrs: { offset: "100%", "stop-color": "rgba(255,255,255,0)" } })], 1)], 1) : t._e(), t._l(t.ticks, function(r, a) {
995
- return n("vue-portal", { key: r, attrs: { slim: "", disabled: !t.isHovering(a), to: `${t.chartID}-${t.computedType}-hovered-portal` } }, [n("g", t._b({ staticClass: "axis__tick", class: {
996
- "axis__tick--hovered": t.isHovering(a),
997
- "axis__tick--hidden": t.allOptions.skip && !t.showTick(a)
998
- }, attrs: { id: t.getTickId(a), "data-j-axis__tick": "" } }, "g", t.mixins.getTickGroupAttributes(r), !1), [n("g", { staticClass: "axis__tick-label lume-typography--axis", attrs: { "pointer-events": "all", "data-j-axis__tick-label": "" }, on: { mouseover: function(o) {
999
- return t.onTickMouseover(a);
1000
- } } }, [n("rect", t._b({ staticClass: "axis__ghost", attrs: { fill: "url(#lume-tick-gradient)" } }, "rect", t.mixins.getTickGhostAttributes(), !1)), n("text", t._b({ ref: "tickRefs", refInFor: !0, staticClass: "axis__label" }, "text", t.mixins.getTickLabelAttributes(), !1), [t._v(" " + t._s(t.formatTick(r)) + " ")])]), t.allOptions.gridLines ? n("line", t._b({ staticClass: "axis__grid-line" }, "line", t.mixins.getGridLinesAttributes(), !1)) : t._e()])]);
1001
- }), n("vue-portal-target", { attrs: { name: `${t.chartID}-${t.computedType}-hovered-portal`, slim: "" } })], 2) : t._e();
1002
- }, hn = [], _n = /* @__PURE__ */ S(
1003
- pn,
1004
- vn,
1005
- hn,
1006
- !1,
1007
- null,
1008
- "43f07b68",
1009
- null,
1010
- null
1011
- );
1012
- const mn = _n.exports;
1013
- function gn() {
1014
- const e = $(), t = lt({
1015
- dimensions: {}
1016
- }), n = new ResizeObserver((r) => {
1017
- r.forEach((a) => {
1018
- t.dimensions = a.contentRect;
1019
- });
1020
- });
1021
- return V(() => {
1022
- n.observe(e.value);
1023
- }), gt(() => {
1024
- n.unobserve(e.value);
1025
- }), { resizeState: t, resizeRef: e };
1026
- }
1027
- const yn = {
1028
- left: 0,
1029
- right: 0,
1030
- top: 0,
1031
- bottom: 0
1032
- }, bn = L({
1033
- props: {
1034
- margins: {
1035
- type: Object,
1036
- default: () => ({})
1037
- },
1038
- containerSize: {
1039
- type: Object,
1040
- default: () => ({ width: 0, height: 0 })
1041
- },
1042
- transparentBackground: {
1043
- type: Boolean,
1044
- default: !1
1045
- },
1046
- noMinSize: {
1047
- type: Boolean,
1048
- default: !1
1049
- }
1050
- },
1051
- setup(e, t) {
1052
- const { margins: n, containerSize: r } = w(e), a = $(null), { resizeRef: o, resizeState: s } = gn(), l = v(() => ({
1053
- ...yn,
1054
- ...n.value
1055
- })), i = v(
1056
- () => r.value.height + l.value.top + l.value.bottom
1057
- );
1058
- return Mt(() => {
1059
- if (!a.value)
1060
- return;
1061
- const { width: u } = s.dimensions, { height: h } = a.value.getBoundingClientRect();
1062
- if (!u || !h)
1063
- return;
1064
- const c = u - l.value.left - l.value.right, f = h - l.value.top - l.value.bottom, p = {
1065
- width: c > 0 ? c : 0,
1066
- height: f > 0 ? f : 0,
1067
- outerWidth: u,
1068
- outerHeight: h
1069
- };
1070
- t.emit("resize", p);
1071
- }), { computedMargins: l, resizeRef: o, root: a, svgHeight: i };
1072
- }
1073
- });
1074
- var xn = function() {
1075
- var t = this, n = t._self._c;
1076
- return t._self._setupProxy, n("div", { ref: "resizeRef", staticClass: "lume-chart-container", class: {
1077
- "lume-chart-container--minimum": !t.noMinSize
1078
- }, attrs: { "data-j-chart-container": "" } }, [t._t("header"), n("svg", { ref: "root", staticClass: "lume-chart-container__svg", class: {
1079
- "lume-chart-container__svg--transparent": t.transparentBackground
1080
- }, attrs: { height: t.svgHeight, "data-j-chart-container__root": "" }, on: { mouseleave: function(r) {
1081
- return t.$emit("mouseleave", r);
1082
- } } }, [n("g", { staticClass: "lume-chart-container__group", attrs: { transform: `translate(${t.computedMargins.left}, ${t.computedMargins.top})`, "data-j-chart-container__group": "" } }, [t._t("default")], 2)]), t._t("footer"), t._t("extra")], 2);
1083
- }, Tn = [], An = /* @__PURE__ */ S(
1084
- bn,
1085
- xn,
1086
- Tn,
1087
- !1,
1088
- null,
1089
- "7aa5be81",
1090
- null,
1091
- null
1092
- );
1093
- const On = An.exports, $n = L({
1094
- props: {
1095
- data: {
1096
- type: Array,
1097
- validator: (e) => !!e && e.every((t) => "color" in t && "label" in t),
1098
- required: !0
1099
- }
1100
- }
1101
- });
1102
- var kn = function() {
1103
- var t = this, n = t._self._c;
1104
- return t._self._setupProxy, n("div", { staticClass: "lume-chart-legend", attrs: { "data-j-chart-legend": "" } }, t._l(t.data, function(r, a) {
1105
- return n("div", { key: `legend-item-${a}`, staticClass: "lume-chart-legend__item lume-typography--body", attrs: { tabindex: "0", "data-j-chart-legend__symbol-wrapper": "" }, on: { click: function(o) {
1106
- return t.$emit("click", a);
1107
- } } }, [n("span", { staticClass: "lume-chart-legend__symbol", class: `lume-background-color--${r.color}`, attrs: { "data-j-chart-legend__symbol": "" } }), t._v(" " + t._s(r.label) + " ")]);
1108
- }), 0);
1109
- }, Ln = [], Sn = /* @__PURE__ */ S(
1110
- $n,
1111
- kn,
1112
- Ln,
1113
- !1,
1114
- null,
1115
- "22aa3668",
1116
- null,
1117
- null
1118
- );
1119
- const wn = Sn.exports, Cn = L({
1120
- props: {
1121
- targetElement: {
1122
- type: Element,
1123
- required: !0
1124
- },
1125
- items: {
1126
- type: Array,
1127
- required: !0
1128
- },
1129
- position: {
1130
- type: String,
1131
- default: "auto",
1132
- validator: (e) => At.includes(e)
1133
- },
1134
- fixedPositioning: {
1135
- type: Boolean,
1136
- default: !1
1137
- },
1138
- modifiers: {
1139
- type: Array,
1140
- default: null
1141
- },
1142
- title: {
1143
- type: [String, Number],
1144
- default: null
1145
- },
1146
- summary: {
1147
- type: String,
1148
- default: null
1149
- },
1150
- ...ft()
1151
- },
1152
- setup(e) {
1153
- const t = $(null), { items: n, options: r } = w(e), a = $(null), { allOptions: o } = F(r), s = v(
1154
- () => {
1155
- var _;
1156
- return (_ = o.value.fixedPositioning) != null ? _ : e.fixedPositioning;
1157
- }
1158
- ), l = v(
1159
- () => s.value ? "fixed" : "absolute"
1160
- ), i = v(() => [
1161
- {
1162
- name: "computeStyles",
1163
- options: {
1164
- adaptive: !1
1165
- }
1166
- },
1167
- {
1168
- name: "offset",
1169
- options: { offset: [0, o.value.offset || 8] }
1170
- },
1171
- ...e.modifiers || []
1172
- ]), u = v(
1173
- () => o.value.showTitle !== !1 && e.title != null
1174
- ), h = v(() => Zt(o.value.valueFormat)), c = v(
1175
- () => {
1176
- var _, y;
1177
- return ((_ = n.value) == null ? void 0 : _.find((m) => m.isSummary)) || {
1178
- label: (y = o.value.summary) != null ? y : e.summary
1179
- };
1180
- }
1181
- );
1182
- function f() {
1183
- e.targetElement && t.value && (a.value = ve(e.targetElement, t.value, {
1184
- placement: e.position,
1185
- strategy: l.value,
1186
- modifiers: i.value
1187
- }));
1188
- }
1189
- function p() {
1190
- a.value && a.value.destroy();
1191
- }
1192
- function d() {
1193
- !a.value || (t.value.classList.add("lume-tooltip--animated"), e.targetElement ? function() {
1194
- a.value.state.elements.reference = e.targetElement, a.value.update();
1195
- }() : p());
1196
- }
1197
- return N(() => e.targetElement, d), V(f), gt(p), {
1198
- allModifiers: i,
1199
- allOptions: o,
1200
- summaryItem: c,
1201
- formatValue: h,
1202
- popper: a,
1203
- root: t,
1204
- showTitle: u,
1205
- strategy: l
1206
- };
1207
- }
1208
- });
1209
- var In = function() {
1210
- var t = this, n = t._self._c;
1211
- return t._self._setupProxy, n("div", { ref: "root", staticClass: "lume-tooltip lume-typography--caption", attrs: { "data-j-tooltip": "" } }, [t._t("default", function() {
1212
- return [t.showTitle ? n("div", { staticClass: "lume-tooltip__title", attrs: { "data-j-tooltip__title": "" } }, [t._v(" " + t._s(t.title) + " ")]) : t._e(), n("ul", { staticClass: "lume-tooltip__items" }, [t.summaryItem.label ? [n("li", { staticClass: "lume-tooltip__item", attrs: { "data-j-tooltip__summary-item": "" } }, [n("span", [t._v(" " + t._s(t.summaryItem.label) + " ")]), t.summaryItem.value ? n("strong", { staticClass: "lume-tooltip__value" }, [t._v(" " + t._s(t.formatValue(t.summaryItem.value)) + " ")]) : t._e()]), t._m(0)] : t._e(), t._l(t.items, function(r) {
1213
- return n("li", { key: r.label, staticClass: "lume-tooltip__item", attrs: { "data-j-tooltip__item": "" } }, [n("span", { staticClass: "lume-tooltip__symbol", class: [`lume-background-color--${r.color}`], attrs: { "data-j-tooltip__item__symbol": "" } }), n("span", { attrs: { "data-j-tooltip__item__label": "" } }, [t._v(" " + t._s(r.label) + " ")]), n("strong", { staticClass: "lume-tooltip__value", attrs: { "data-j-tooltip__item__value": "" } }, [t._v(" " + t._s(t.formatValue(r.value)) + " ")])]);
1214
- })], 2)];
1215
- })], 2);
1216
- }, Nn = [function() {
1217
- var e = this, t = e._self._c;
1218
- return e._self._setupProxy, t("li", { staticClass: "lume-tooltip__break" }, [t("hr")]);
1219
- }], Dn = /* @__PURE__ */ S(
1220
- Cn,
1221
- In,
1222
- Nn,
1223
- !1,
1224
- null,
1225
- "e6deede1",
1226
- null,
1227
- null
1228
- );
1229
- const Rn = Dn.exports;
1230
- function Pn(e, t, n, r) {
1231
- const a = v(() => n.value > 0 && n.value < 1), o = v(
1232
- () => r.value > 0 && r.value < 1
1233
- ), s = v(
1234
- () => a.value ? e.value - 0.5 : e.value
1235
- ), l = v(
1236
- () => o.value ? t.value - 0.5 : t.value
1237
- );
1238
- return { computedX: s, computedY: l, shouldHaveMinWidth: a, shouldHaveMinHeight: o };
1239
- }
1240
- function En(e, t, n, r) {
1241
- const a = $(0), o = $(0), s = v(() => `${e.value + n.value / 2}px ${t.value + r.value / 2}px`);
1242
- return V(() => {
1243
- a.value = n.value, o.value = r.value;
1244
- }), N(n, (l) => a.value = l), N(r, (l) => o.value = l), { computedWidth: a, computedHeight: o, transformOrigin: s };
1245
- }
1246
- const Bn = L({
1247
- props: {
1248
- x: {
1249
- type: Number,
1250
- default: 0
1251
- },
1252
- y: {
1253
- type: Number,
1254
- default: 0
1255
- },
1256
- width: {
1257
- type: Number,
1258
- required: !0
1259
- },
1260
- height: {
1261
- type: Number,
1262
- required: !0
1263
- },
1264
- classList: {
1265
- type: [String, Array],
1266
- default: ""
1267
- },
1268
- isFaded: {
1269
- type: Boolean,
1270
- default: !1
1271
- },
1272
- isNegative: {
1273
- type: Boolean,
1274
- default: !1
1275
- },
1276
- transition: {
1277
- type: [String, Boolean],
1278
- default: !1
1279
- }
1280
- },
1281
- setup(e) {
1282
- const { x: t, y: n, width: r, height: a, transition: o, classList: s } = w(e), l = $(null), i = v(
1283
- () => typeof s.value == "string" ? [s.value] : s.value
1284
- ), u = v(() => o.value === "width"), h = v(
1285
- () => o.value === "height"
1286
- ), c = En(t, n, r, a), { computedX: f, computedY: p, shouldHaveMinWidth: d, shouldHaveMinHeight: _ } = Pn(t, n, r, a), y = v(() => d.value ? 1 : (u.value ? c.computedWidth : r).value), m = v(() => _.value ? 1 : (h.value ? c.computedHeight : a).value), g = u.value || h.value ? c.transformOrigin : null;
1287
- return V(() => pt(l.value)), {
1288
- computedClasses: i,
1289
- computedWidth: y,
1290
- computedHeight: m,
1291
- computedX: f,
1292
- computedY: p,
1293
- root: l,
1294
- shouldTransitionWidth: u,
1295
- shouldTransitionHeight: h,
1296
- transformOrigin: g
1297
- };
1298
- }
1299
- });
1300
- var Mn = function() {
1301
- var t = this, n = t._self._c;
1302
- return t._self._setupProxy, n("rect", { ref: "root", staticClass: "lume-bar", class: [
1303
- {
1304
- "lume-fill--faded": t.isFaded,
1305
- "lume-bar--negative": t.isNegative,
1306
- "lume-bar--transition-width": t.shouldTransitionWidth,
1307
- "lume-bar--transition-height": t.shouldTransitionHeight
1308
- },
1309
- ...t.computedClasses
1310
- ], style: { transformOrigin: t.transformOrigin }, attrs: { x: t.computedX, y: t.computedY, width: t.computedWidth, height: t.computedHeight, "data-j-bar": "" } });
1311
- }, Hn = [], jn = /* @__PURE__ */ S(
1312
- Bn,
1313
- Mn,
1314
- Hn,
1315
- !1,
1316
- null,
1317
- "43471964",
1318
- null,
1319
- null
1320
- );
1321
- const $t = jn.exports, Fn = 1, Vn = 2, Gn = L({
1322
- props: {
1323
- pathDefinition: {
1324
- type: String,
1325
- required: !0
1326
- },
1327
- color: {
1328
- type: String,
1329
- default: M.Skyblue
1330
- },
1331
- index: {
1332
- type: Number,
1333
- required: !0
1334
- },
1335
- width: {
1336
- type: Number,
1337
- default: Vn
1338
- },
1339
- dashed: {
1340
- type: Boolean,
1341
- default: !1
1342
- },
1343
- xScale: {
1344
- type: Function,
1345
- required: !0
1346
- },
1347
- transition: {
1348
- type: Boolean,
1349
- default: !0
1350
- }
1351
- },
1352
- setup(e) {
1353
- const t = $(null), n = v(
1354
- () => Fn / (Be(e.xScale) - 1)
1355
- ), r = v(() => e.index < 2 ? 0 : e.transition && (e.index - 1) * n.value);
1356
- return V(() => pt(t.value)), {
1357
- animationDelay: r,
1358
- animationDuration: n,
1359
- root: t
1360
- };
1361
- }
1362
- });
1363
- var zn = function() {
1364
- var t = this, n = t._self._c;
1365
- return t._self._setupProxy, n("path", { ref: "root", staticClass: "lume-line", class: {
1366
- [`lume-stroke--${t.color}`]: !0,
1367
- "lume-line--dashed": t.dashed,
1368
- "lume-line--transition": t.transition
1369
- }, style: {
1370
- animationDelay: t.transition && t.animationDelay + "s",
1371
- animationDuration: t.transition && t.animationDuration + "s"
1372
- }, attrs: { d: t.pathDefinition, "stroke-width": t.width, "data-j-line": "" } });
1373
- }, Wn = [], Zn = /* @__PURE__ */ S(
1374
- Gn,
1375
- zn,
1376
- Wn,
1377
- !1,
1378
- null,
1379
- "a9d50090",
1380
- null,
1381
- null
1382
- );
1383
- const qn = Zn.exports, Xn = 4, Un = L({
1384
- props: {
1385
- color: {
1386
- type: String,
1387
- default: M.Skyblue
1388
- },
1389
- radius: {
1390
- type: Number,
1391
- default: Xn
1392
- },
1393
- value: {
1394
- type: Number,
1395
- required: !0
1396
- },
1397
- index: {
1398
- type: Number,
1399
- required: !0
1400
- },
1401
- active: {
1402
- type: Boolean,
1403
- default: !1
1404
- },
1405
- xScale: {
1406
- type: Function,
1407
- required: !0
1408
- },
1409
- yScale: {
1410
- type: Function,
1411
- required: !0
1412
- }
1413
- },
1414
- setup(e) {
1415
- const t = $(null), n = v(() => Ot(e.xScale) / 2), r = v(() => e.xScale.domain()), a = v(
1416
- () => U(e.xScale) ? e.xScale(r.value[e.index]) + n.value : e.xScale(e.index)
1417
- ), o = v(() => e.yScale(e.value)), s = v(() => e.radius / 2);
1418
- return V(() => pt(t.value)), { cx: a, cy: o, root: t, strokeWidth: s };
1419
- }
1420
- });
1421
- var Yn = function() {
1422
- var t = this, n = t._self._c;
1423
- return t._self._setupProxy, n("circle", { ref: "root", staticClass: "lume-point", class: `lume-stroke--${t.color}`, attrs: { cx: t.cx, cy: t.cy, r: t.active ? t.radius : 0, "stroke-width": t.strokeWidth, "data-j-point": "" } });
1424
- }, Kn = [], Jn = /* @__PURE__ */ S(
1425
- Un,
1426
- Yn,
1427
- Kn,
1428
- !1,
1429
- null,
1430
- "d65961d4",
1431
- null,
1432
- null
1433
- );
1434
- const Qn = Jn.exports, kt = () => ({
1435
- data: {
1436
- type: Array,
1437
- required: !0
1438
- },
1439
- labels: {
1440
- type: Array,
1441
- default: () => []
1442
- },
1443
- xScale: {
1444
- type: Function,
1445
- required: !0
1446
- },
1447
- yScale: {
1448
- type: Function,
1449
- required: !0
1450
- },
1451
- hoveredIndex: {
1452
- type: Number,
1453
- default: -1
1454
- },
1455
- options: {
1456
- type: Object,
1457
- default: () => ({})
1458
- }
1459
- }), tr = L({
1460
- components: { LumeBar: $t },
1461
- props: {
1462
- ...kt(),
1463
- orientation: {
1464
- type: String,
1465
- default: T.VERTICAL
1466
- }
1467
- },
1468
- setup(e, t) {
1469
- const { data: n, orientation: r, xScale: a, yScale: o } = w(e), s = v(() => st(n));
1470
- function l(u) {
1471
- const h = r.value === T.HORIZONTAL ? o.value : a.value, c = h.domain(), f = Ot(h), p = U(h) ? h(c[u]) : h(u) - f / 2;
1472
- return r.value === T.HORIZONTAL ? {
1473
- width: Math.max(...a.value.range()),
1474
- height: f,
1475
- transform: `translate(0, ${p})`
1476
- } : {
1477
- width: f,
1478
- height: Math.max(...o.value.range()),
1479
- transform: `translate(${p}, 0)`
1480
- };
1481
- }
1482
- function i(u) {
1483
- t.emit("mouseover", u);
1484
- }
1485
- return { getOverlayBarAttributes: l, handleMouseover: i, overlayData: s };
1486
- }
1487
- });
1488
- var er = function() {
1489
- var t = this, n = t._self._c;
1490
- return t._self._setupProxy, n("g", { staticClass: "lume-overlay-group" }, t._l(t.overlayData, function(r, a) {
1491
- return n("lume-bar", t._b({ key: `overlay-${a}`, attrs: { "data-j-lume-overlay-group": a, transition: !1, "class-list": "lume-fill--transparent" }, nativeOn: { mouseover: function(o) {
1492
- return t.handleMouseover(a);
1493
- } } }, "lume-bar", t.getOverlayBarAttributes(a), !1));
1494
- }), 1);
1495
- }, nr = [], rr = /* @__PURE__ */ S(
1496
- tr,
1497
- er,
1498
- nr,
1499
- !1,
1500
- null,
1501
- null,
1502
- null,
1503
- null
1504
- );
1505
- const ar = rr.exports, or = () => ({
1506
- xScale: {
1507
- type: Function,
1508
- default: null
1509
- },
1510
- yScale: {
1511
- type: Function,
1512
- default: null
1513
- }
1514
- });
1515
- function sr(e, t, n, r, a) {
1516
- const o = $(null), s = $(null);
1517
- function l() {
1518
- const { width: i, height: u } = n;
1519
- !i && !u || !t.value || !e.value || (r.value === T.HORIZONTAL ? (o.value = Dt(
1520
- e.value,
1521
- i,
1522
- r.value,
1523
- a.value.startOnZero
1524
- ), s.value = Nt(t.value, u)) : (o.value = Nt(t.value, i), s.value = Dt(
1525
- e.value,
1526
- u,
1527
- r.value,
1528
- a.value.startOnZero
1529
- )));
1530
- }
1531
- return Mt(l), { xScale: o, yScale: s };
1532
- }
1533
- function Nt(e, t) {
1534
- const n = [0, t];
1535
- return J().range(n).domain(e);
1536
- }
1537
- function Dt(e, t, n, r) {
1538
- const a = Ft(e).filter((h) => h != null), o = [0, t];
1539
- if (a.length === 0)
1540
- return Q().range(o).domain([0, 0]).nice();
1541
- const s = Math.min(...a), l = r && s > 0 ? 0 : s, i = Math.max(...a), u = n === T.HORIZONTAL ? [l, i] : [i, l];
1542
- return Q().range(o).domain(u).nice();
1543
- }
1544
- function Rt(e) {
1545
- return (e == null ? void 0 : e.range) !== void 0 || (e == null ? void 0 : e.copy) !== void 0;
1546
- }
1547
- function mt(e, t) {
1548
- return U(e) ? e.bandwidth() / 2 + e(e.domain()[t]) : e(t);
1549
- }
1550
- function it(e, t, {
1551
- padding: n,
1552
- paddingInner: r,
1553
- paddingOuter: a
1554
- } = {}) {
1555
- const o = n != null ? n : t === T.HORIZONTAL ? Ne : Ie;
1556
- return e.copy().paddingInner(r != null ? r : o).paddingOuter(a != null ? a : o / 2);
1557
- }
1558
- function ir(e) {
1559
- return Object.values(T).includes(e);
1560
- }
1561
- const G = (e, t = !0, n = !0) => ({
1562
- ...Wt(e),
1563
- ...n ? or() : {},
1564
- ...ft(),
1565
- title: {
1566
- type: String,
1567
- default: null
1568
- },
1569
- ...t ? {
1570
- orientation: {
1571
- type: String,
1572
- default: T.VERTICAL,
1573
- validator: ir
1574
- }
1575
- } : {},
1576
- classList: {
1577
- type: [String, Array],
1578
- default: () => []
1579
- }
1580
- });
1581
- function lr(e) {
1582
- return { hasNegativeValues: v(
1583
- () => Ft(e.value).some((n) => n < 0)
1584
- ) };
1585
- }
1586
- function ur(e, t, n, r) {
1587
- const a = v(
1588
- () => r.value === T.HORIZONTAL
1589
- ), o = v(
1590
- () => {
1591
- var u;
1592
- return e.height - (a != null && a.value ? 0 : ((u = n.value) == null ? void 0 : u.call(n, 0)) || 0);
1593
- }
1594
- ), s = v(
1595
- () => {
1596
- var u;
1597
- return a != null && a.value ? ((u = t.value) == null ? void 0 : u.call(t, 0)) || 0 : e.width;
1598
- }
1599
- ), l = v(
1600
- () => {
1601
- var u;
1602
- return a != null && a.value ? "translate(0, 0)" : `translate(0, ${((u = n.value) == null ? void 0 : u.call(n, 0)) || 0})`;
1603
- }
1604
- );
1605
- return { negativeBarAttributes: v(() => ({
1606
- width: s.value,
1607
- height: o.value,
1608
- transform: l.value
1609
- })) };
1610
- }
1611
- function cr(e, t) {
1612
- return e.reduce((n, r) => {
1613
- var o;
1614
- const a = (o = r.values[t]) == null ? void 0 : o.value;
1615
- return a > 0 && (n += a), n;
1616
- }, 0);
1617
- }
1618
- const Pt = {
1619
- "stacked-bar": cr
1620
- };
1621
- function dr(e, t, n, r, a) {
1622
- const o = v(() => (l) => {
1623
- var c;
1624
- let i = a.value && Pt[a.value] ? Pt[a.value](e.value, l) : Gt(e.value, l);
1625
- ((c = a == null ? void 0 : a.value) == null ? void 0 : c.includes("bar")) && i < 0 && (i = 0);
1626
- const u = r.value === T.HORIZONTAL ? t.value(i) : mt(t.value, l), h = r.value === T.HORIZONTAL ? mt(n.value, l) : n.value(i);
1627
- return {
1628
- cx: u,
1629
- cy: h
1630
- };
1631
- });
1632
- function s(l) {
1633
- return e.value.map(({ color: i, label: u, values: h }) => {
1634
- var c, f, p, d, _;
1635
- return {
1636
- color: ((c = h[l]) == null ? void 0 : c.color) || i,
1637
- label: u,
1638
- value: (_ = (d = (f = h[l]) == null ? void 0 : f.label) != null ? d : (p = h[l]) == null ? void 0 : p.value) != null ? _ : jt
1639
- };
1640
- });
1641
- }
1642
- return { getTooltipAnchorAttributes: o, getTooltipItems: s };
1643
- }
1644
- function fr() {
1645
- const e = lt({
1646
- opened: !1,
1647
- targetElement: null
1648
- });
1649
- return { tooltipConfig: e, showTooltip: (r) => {
1650
- D.set(e, "opened", !0), D.set(e, "targetElement", r);
1651
- }, hideTooltip: () => {
1652
- D.set(e, "opened", !1), D.set(e, "targetElement", null);
1653
- } };
1654
- }
1655
- const pr = L({
1656
- components: {
1657
- LumeAxis: mn,
1658
- LumeBar: $t,
1659
- LumeChartContainer: On,
1660
- LumeChartLegend: wn,
1661
- LumeOverlayGroup: ar,
1662
- LumeTooltip: Rn,
1663
- VuePortal: yt,
1664
- VuePortalTarget: bt
1665
- },
1666
- props: {
1667
- ...G(),
1668
- chartType: {
1669
- type: String,
1670
- default: null
1671
- }
1672
- },
1673
- setup(e, t) {
1674
- const { data: n, labels: r, color: a, options: o, orientation: s, chartType: l } = w(e), i = $(-1), u = $(null), h = $(null), { allOptions: c } = F(o), { internalData: f, computedLabels: p, containerSize: d, updateSize: _, chartID: y } = dt(n, r, a, c, s), { xScale: m, yScale: g } = sr(
1675
- f,
1676
- p,
1677
- d,
1678
- s,
1679
- c
1680
- ), b = v(() => {
1681
- var A;
1682
- return e.xScale ? Rt(e.xScale) ? e.xScale : (A = e.xScale) == null ? void 0 : A.call(e, f.value, r.value, d) : m.value;
1683
- }), x = v(() => {
1684
- var A;
1685
- return e.yScale ? Rt(e.yScale) ? e.yScale : (A = e.yScale) == null ? void 0 : A.call(e, f.value, r.value, d) : g.value;
1686
- }), O = v(() => ({
1687
- ...c.value.xAxisOptions,
1688
- withHover: s.value === T.VERTICAL
1689
- })), E = v(() => ({
1690
- ...c.value.yAxisOptions,
1691
- withHover: s.value === T.HORIZONTAL
1692
- })), B = v(() => {
1693
- var A;
1694
- return (A = c.value.xAxisOptions) == null ? void 0 : A.title;
1695
- }), C = v(() => {
1696
- var A;
1697
- return (A = c.value.yAxisOptions) == null ? void 0 : A.title;
1698
- }), k = v(() => {
1699
- var A;
1700
- return ((A = c.value.xAxisOptions) == null ? void 0 : A.withTitle) !== !1 && B.value;
1701
- }), I = v(() => {
1702
- var A;
1703
- return ((A = c.value.yAxisOptions) == null ? void 0 : A.withTitle) !== !1 && C.value;
1704
- }), H = v(
1705
- () => {
1706
- var A;
1707
- return c.value.withTooltip !== !1 && !((A = c.value.tooltipOptions) != null && A.targetElement);
1708
- }
1709
- ), j = v(() => {
1710
- const A = [], { noBaseScales: X } = c.value;
1711
- return X || A.push(() => !!(b.value && x.value)), A.every((rt) => rt() === !0);
1712
- }), { hasNegativeValues: et } = lr(f), { negativeBarAttributes: nt } = ur(
1713
- d,
1714
- b,
1715
- x,
1716
- s
1717
- ), { tooltipConfig: z, showTooltip: vt, hideTooltip: Qt } = fr(), { getTooltipAnchorAttributes: te, getTooltipItems: ee } = dr(
1718
- f,
1719
- b,
1720
- x,
1721
- s,
1722
- l
1723
- ), ne = v(
1724
- () => {
1725
- var A;
1726
- return ((A = c.value.tooltipOptions) == null ? void 0 : A.position) || "top";
1727
- }
1728
- );
1729
- function re(A) {
1730
- var rt;
1731
- c.value.withHover !== !1 && (i.value = A);
1732
- const X = (rt = c.value.tooltipOptions) != null && rt.targetElement ? c.value.tooltipOptions.targetElement === "self" ? h.value.$el : c.value.tooltipOptions.targetElement : u.value[A];
1733
- c.value.withTooltip !== !1 && vt(X);
1734
- }
1735
- function ae() {
1736
- Qt(), i.value = -1;
1737
- }
1738
- return V(() => {
1739
- var A, X;
1740
- (X = (A = t.slots).groups) != null && X.call(A) || console.error('"groups" `<slot>` must have content.');
1741
- }), {
1742
- allOptions: c,
1743
- internalData: f,
1744
- chartContainer: h,
1745
- computedLabels: p,
1746
- computedXAxisOptions: O,
1747
- computedXScale: b,
1748
- computedYAxisOptions: E,
1749
- computedYScale: x,
1750
- containerSize: d,
1751
- getEmptyArrayFromData: st,
1752
- getTooltipAnchorAttributes: te,
1753
- getTooltipItems: ee,
1754
- handleMouseleave: ae,
1755
- hasNegativeValues: et,
1756
- hoveredIndex: i,
1757
- isReady: j,
1758
- mouseOverHandler: re,
1759
- negativeBarAttributes: nt,
1760
- shouldGenerateTooltipAnchors: H,
1761
- showXAxisTitle: k,
1762
- showYAxisTitle: I,
1763
- tooltipAnchor: u,
1764
- tooltipAnchorRadius: De,
1765
- tooltipConfig: z,
1766
- tooltipPosition: ne,
1767
- updateSize: _,
1768
- xAxisTitle: B,
1769
- yAxisTitle: C,
1770
- chartID: y
1771
- };
1772
- }
1773
- });
1774
- var vr = function() {
1775
- var t = this, n = t._self._c;
1776
- return t._self._setupProxy, n("lume-chart-container", { ref: "chartContainer", attrs: { margins: t.allOptions.margins, "container-size": t.containerSize, "no-min-size": t.allOptions.noMinSize, "transparent-background": t.allOptions.transparentBackground, "data-j-lume-chart": "" }, on: { resize: t.updateSize, mouseleave: t.handleMouseleave }, scopedSlots: t._u([{ key: "header", fn: function() {
1777
- return [n("div", { staticClass: "lume-chart__header" }, [n("div", { staticClass: "lume-chart__header-section" }, [t.title ? n("h1", { staticClass: "lume-chart__title lume-chart-title lume-typography--display" }, [t._v(" " + t._s(t.title) + " ")]) : t._e(), n("div", { staticClass: "lume-chart__controls" }, [t._t("controls")], 2)]), n("div", { staticClass: "lume-chart__header-section" }, [t.showYAxisTitle ? n("h3", { staticClass: "lume-chart__axis-title lume-axis-title lume-typography--body" }, [t._v(" " + t._s(t.yAxisTitle) + " ")]) : t._e(), t.allOptions.withLegend !== !1 ? n("vue-portal", { attrs: { disabled: t.allOptions.legendPosition !== "bottom", to: `legend-bottom-${t.chartID}`, slim: "" } }, [n("lume-chart-legend", { staticClass: "lume-chart__legend", attrs: { data: t.internalData, "data-j-lume-chart__legend": "" }, on: { click: function(r) {
1778
- return t.$emit("click", r);
1779
- } } })], 1) : t._e()], 1)])];
1780
- }, proxy: !0 }, { key: "footer", fn: function() {
1781
- return [t.showXAxisTitle ? n("h3", { staticClass: "lume-chart__axis-title lume-chart__axis-title--centered lume-axis-title" }, [t._v(" " + t._s(t.xAxisTitle) + " ")]) : t._e(), n("vue-portal-target", { attrs: { name: `legend-bottom-${t.chartID}`, slim: "" } })];
1782
- }, proxy: !0 }, { key: "extra", fn: function() {
1783
- return [t._t("tooltip", function() {
1784
- return [t.allOptions.withTooltip !== !1 && t.tooltipConfig.opened ? n("lume-tooltip", t._b({ attrs: { position: t.tooltipPosition, title: t.computedLabels[t.hoveredIndex], items: t.getTooltipItems(t.hoveredIndex), options: t.allOptions.tooltipOptions, "data-j-lume-chart__tooltip": "" } }, "lume-tooltip", t.tooltipConfig, !1), [t._t("tooltip-content", null, { data: t.internalData, labels: t.computedLabels, hoveredIndex: t.hoveredIndex })], 2) : t._e()];
1785
- }, { data: t.internalData, labels: t.computedLabels, withTooltip: t.allOptions.withTooltip !== !1, hoveredIndex: t.hoveredIndex, options: t.allOptions.tooltipOptions }, t.tooltipConfig)];
1786
- }, proxy: !0 }], null, !0) }, [t.isReady ? [t.hasNegativeValues ? n("lume-bar", t._b({ attrs: { "class-list": "lume-fill--negative", transition: !1, "data-j-lume-chart__negative-values": "" } }, "lume-bar", t.negativeBarAttributes, !1)) : t._e(), t.allOptions.withAxes !== !1 ? t._t("axes", function() {
1787
- return [n("lume-axis", { attrs: { type: "x", scale: t.computedXScale, "container-size": t.containerSize, options: t.computedXAxisOptions, "hovered-index": t.hoveredIndex, orientation: t.orientation, "data-j-lume-chart__x-axis": "" }, on: { "tick-mouseover": function(r) {
1788
- return t.mouseOverHandler(r);
1789
- } } }), n("lume-axis", { attrs: { type: "y", scale: t.computedYScale, "container-size": t.containerSize, options: t.computedYAxisOptions, "hovered-index": t.hoveredIndex, orientation: t.orientation, "data-j-lume-chart__y-axis": "" }, on: { "tick-mouseover": function(r) {
1790
- return t.mouseOverHandler(r);
1791
- } } })];
1792
- }, { xScale: t.computedXScale, yScale: t.computedYScale, containerSize: t.containerSize, options: t.allOptions, hoveredIndex: t.hoveredIndex }) : t._e(), t._t("groups", null, { data: t.internalData, labels: t.computedLabels, options: t.allOptions, orientation: t.orientation, xScale: t.computedXScale, yScale: t.computedYScale, hoveredIndex: t.hoveredIndex, containerSize: t.containerSize, transition: t.allOptions.withTransition !== !1, classList: t.classList }), t.allOptions.withHover !== !1 ? n("lume-overlay-group", { attrs: { data: t.internalData, orientation: t.orientation, "x-scale": t.computedXScale, "y-scale": t.computedYScale, "data-j-lume-chart__overlay-group": "" }, on: { mouseover: t.mouseOverHandler } }) : t._e(), t.shouldGenerateTooltipAnchors ? n("g", t._l(t.getEmptyArrayFromData(t.internalData), function(r, a) {
1793
- return n("circle", t._b({ key: `anchor-${a}`, ref: "tooltipAnchor", refInFor: !0, staticClass: "lume-fill--transparent", attrs: { r: t.tooltipAnchorRadius } }, "circle", t.getTooltipAnchorAttributes(a), !1));
1794
- }), 0) : t._e()] : t._e()], 2);
1795
- }, hr = [], _r = /* @__PURE__ */ S(
1796
- pr,
1797
- vr,
1798
- hr,
1799
- !1,
1800
- null,
1801
- "5119f57e",
1802
- null,
1803
- null
1804
- );
1805
- const Y = _r.exports, mr = 8, gr = L({
1806
- props: {
1807
- linkPaths: {
1808
- type: Array,
1809
- default: () => []
1810
- },
1811
- isGhost: {
1812
- type: Boolean,
1813
- default: !1
1814
- },
1815
- containerWidth: {
1816
- type: Number,
1817
- default: 0
1818
- },
1819
- highlightedLinkIds: {
1820
- type: Array,
1821
- default: () => []
1822
- }
1823
- },
1824
- setup(e) {
1825
- const { highlightedLinkIds: t, isGhost: n } = w(e), r = v(
1826
- () => n.value ? mr : 0
1827
- );
1828
- function a(o) {
1829
- return {
1830
- [`lume-stroke--${o.color}`]: !n.value,
1831
- "lume-stroke--transparent": n.value,
1832
- "lume-alluvial-path-group__link--ghost": n.value,
1833
- "lume-alluvial-path-group__link--faded": zt(
1834
- o.id,
1835
- t.value
1836
- )
1837
- };
1838
- }
1839
- return { getClasses: a, ghostStrokeWidthOffset: r };
1840
- }
1841
- });
1842
- var yr = function() {
1843
- var t = this, n = t._self._c;
1844
- return t._self._setupProxy, n("g", { staticClass: "lume-alluvial-path-group" }, t._l(t.linkPaths, function(r) {
1845
- return n("path", { key: `link_${r.id}`, staticClass: "lume-alluvial-path-group__link", class: t.getClasses(r), attrs: { id: t.isGhost ? `${r.id}__ghost` : r.id, d: r.d, "stroke-dasharray": t.containerWidth, "stroke-dashoffset": t.containerWidth, "stroke-width": r.strokeWidth + t.ghostStrokeWidthOffset, "data-j-alluvial-path__path": "" }, on: { mouseover: function(a) {
1846
- return t.$emit("mouseover", r.link);
1847
- }, mouseout: function(a) {
1848
- return t.$emit("mouseout");
1849
- } } });
1850
- }), 0);
1851
- }, br = [], xr = /* @__PURE__ */ S(
1852
- gr,
1853
- yr,
1854
- br,
1855
- !1,
1856
- null,
1857
- "ce6a9b03",
1858
- null,
1859
- null
1860
- );
1861
- const Tr = xr.exports, Xt = "03", K = 8, Ar = 200;
1862
- function Or(e, t, n) {
1863
- let r = !1;
1864
- gt(() => {
1865
- r = !0;
1866
- });
1867
- const a = v(() => Math.max(...n.value.nodes.map(({ depth: p }) => p))), o = v(() => {
1868
- if (e.value.highlightedLink === null && e.value.highlightedNode === null)
1869
- return {};
1870
- if (t.value.getHighlightedElements)
1871
- return t.value.getHighlightedElements({
1872
- link: e.value.highlightedLink,
1873
- node: e.value.highlightedNode,
1874
- links: n.value.links
1875
- });
1876
- if (e.value.highlightedNode) {
1877
- const p = [
1878
- ...e.value.highlightedNode.sourceLinks,
1879
- ...e.value.highlightedNode.targetLinks
1880
- ];
1881
- return {
1882
- links: p,
1883
- nodes: new Map(
1884
- p.reduce((d, { source: _, target: y, value: m }) => _ === e.value.highlightedNode ? [...d, [R(y), m]] : [...d, [R(_), m]], [])
1885
- )
1886
- };
1887
- }
1888
- return {
1889
- links: [e.value.highlightedLink],
1890
- nodes: /* @__PURE__ */ new Map([
1891
- [
1892
- R(e.value.highlightedLink.target),
1893
- e.value.highlightedLink.value
1894
- ]
1895
- ])
1896
- };
1897
- });
1898
- function s(p) {
1899
- return typeof p == "string" || typeof p == "number" ? p : p == null ? void 0 : p.id;
1900
- }
1901
- function l(p = n.value.links) {
1902
- const d = p.map(
1903
- (y) => `link_${s(y.source)}:${s(y.target)}`
1904
- );
1905
- return { nodeIds: p.reduce(
1906
- (y, { source: m, target: g }) => [
1907
- ...y,
1908
- `node-block-${s(m)}`,
1909
- `node-block-${s(g)}`
1910
- ],
1911
- []
1912
- ), linkIds: d };
1913
- }
1914
- function i(p, d, _) {
1915
- const y = Date.now(), m = e.value.nodeBlocks.find(
1916
- (x) => x.id === `node-block-${p}`
1917
- ), g = Me(d, _), b = () => {
1918
- if (r)
1919
- return;
1920
- let O = (Date.now() - y) / Ar;
1921
- O > 1 && (O = 1), D.set(m.node, "transitionValue", g(O)), O < 1 && requestAnimationFrame(b);
1922
- };
1923
- requestAnimationFrame(b);
1924
- }
1925
- function u({ values: p, updatingNodes: d = [], isEntering: _ = !1 }) {
1926
- const y = new Set(d), m = (b) => _ ? b.value : p.get(R(b)), g = (b) => _ ? p.get(R(b)) : b.value;
1927
- n.value.nodes.filter((b) => y.has(b)).forEach((b) => {
1928
- i(
1929
- R(b),
1930
- m(b),
1931
- g(b)
1932
- );
1933
- });
1934
- }
1935
- function h(p) {
1936
- const d = ie();
1937
- return p.map((_) => {
1938
- var y;
1939
- return {
1940
- id: `link_${R(_.source)}:${R(
1941
- _.target
1942
- )}`,
1943
- d: d(_),
1944
- color: _.color || ((y = _.source) == null ? void 0 : y.color) || Xt,
1945
- strokeWidth: Math.max(1, _.width),
1946
- link: _
1947
- };
1948
- });
1949
- }
1950
- function c(p) {
1951
- return p.map((d) => ({
1952
- id: `node-block-${R(d)}`,
1953
- rect: {
1954
- width: d.x1 - d.x0,
1955
- height: d.y1 - d.y0
1956
- },
1957
- textTransform: {
1958
- x: d.depth > 0 ? d.x1 + K : d.x0 - K,
1959
- y: (d.y1 + d.y0) / 2
1960
- },
1961
- node: d
1962
- }));
1963
- }
1964
- function f({ nodes: p, links: d }) {
1965
- p == null || d == null || (e.value.nodeBlocks = c(p), e.value.linkPaths = h(d));
1966
- }
1967
- return {
1968
- highlightedElements: o,
1969
- highlightLinks: l,
1970
- updateNodes: u,
1971
- renderChart: f,
1972
- maxDepth: a
1973
- };
1974
- }
1975
- function $r(e, t, n) {
1976
- function r(c) {
1977
- var f, p;
1978
- return (p = (f = t.value) == null ? void 0 : f.nodes) == null ? void 0 : p.reduce(
1979
- (d, _) => Math.max(d, _[c]),
1980
- -1 / 0
1981
- );
1982
- }
1983
- function a(c, f) {
1984
- return s(f) - s(c);
1985
- }
1986
- function o(c) {
1987
- var f, p;
1988
- return (p = (f = n.value) == null ? void 0 : f.find((d) => d.id === `node-text-${c.id}`)) == null ? void 0 : p.getBBox();
1989
- }
1990
- function s({ label: c, value: f }) {
1991
- var p;
1992
- return Math.max(
1993
- c.length,
1994
- ((p = e.value.valueFormatter(f)) == null ? void 0 : p.length) || 0
1995
- );
1996
- }
1997
- const l = v(() => {
1998
- var p, d, _, y;
1999
- const c = r("x1"), f = (d = (p = t.value.nodes) == null ? void 0 : p.filter(({ x1: m }) => m === c).sort(a)) == null ? void 0 : d[0];
2000
- return f == null ? 0 : (y = (_ = o(f)) == null ? void 0 : _.width) != null ? y : 0;
2001
- }), i = v(() => {
2002
- var p, d, _, y, m, g;
2003
- const c = (d = (p = t.value) == null ? void 0 : p.nodes) == null ? void 0 : d.reduce(
2004
- (b, { y0: x }) => Math.min(b, x),
2005
- 1 / 0
2006
- ), f = (y = (_ = t.value) == null ? void 0 : _.nodes) == null ? void 0 : y.find(({ y0: b }) => b === c);
2007
- return f == null ? 0 : Math.abs((g = (m = o(f)) == null ? void 0 : m.y) != null ? g : 0);
2008
- }), u = v(() => {
2009
- var p, d, _, y;
2010
- const c = r("y1"), f = (d = (p = t.value) == null ? void 0 : p.nodes) == null ? void 0 : d.find(({ y1: m }) => m === c);
2011
- return f == null ? 0 : Math.abs((y = (_ = o(f)) == null ? void 0 : _.y) != null ? y : 0);
2012
- });
2013
- return {
2014
- leftMostNodeLabelWidth: v(() => {
2015
- var f, p, d, _;
2016
- const c = (p = (f = t.value.nodes) == null ? void 0 : f.filter(({ depth: y }) => y === 0).sort(a)) == null ? void 0 : p[0];
2017
- return c == null ? 0 : (_ = (d = o(c)) == null ? void 0 : d.width) != null ? _ : 0;
2018
- }),
2019
- rightMostNodeLabelWidth: l,
2020
- topMostNodeLabelExtraHeight: i,
2021
- bottomMostNodeLabelExtraHeight: u
2022
- };
2023
- }
2024
- const kr = {
2025
- values: [],
2026
- nodePadding: 16,
2027
- nodeWidth: 16,
2028
- nodeAlign: ue,
2029
- valueFormatter: (e) => String(e)
2030
- }, Lr = {
2031
- highlightedLink: null,
2032
- highlightedNode: null,
2033
- leftExtent: 0,
2034
- rightExtent: 0,
2035
- topExtent: 0,
2036
- bottomExtent: 0,
2037
- nodeBlocks: [],
2038
- linkPaths: []
2039
- };
2040
- function Sr(e, t) {
2041
- const n = $({ ...Lr, containerSize: t }), r = v(() => e.value.values.map(({ label: l, color: i, value: u }) => ({
2042
- label: l,
2043
- color: i,
2044
- id: u
2045
- }))), a = v(() => e.value.values.map(
2046
- (l) => {
2047
- var i;
2048
- return (i = l.targets) == null ? void 0 : i.map(({ node: u, value: h, color: c }) => {
2049
- var f;
2050
- return {
2051
- source: (f = l.value) != null ? f : l.label,
2052
- color: c,
2053
- target: u,
2054
- value: h
2055
- };
2056
- });
2057
- }
2058
- ).filter(Boolean).reduce((l, i) => [...l, ...i], [])), o = v(() => {
2059
- const { leftExtent: l, rightExtent: i, topExtent: u, bottomExtent: h, containerSize: c } = n.value;
2060
- return le().nodeId(R).nodeWidth(e.value.nodeWidth).nodeSort(e.value.nodeSort).nodePadding(20).nodeAlign(e.value.nodeAlign).extent([
2061
- [l, u],
2062
- [i, c.height - h]
2063
- ]);
2064
- }), s = v(() => o.value({
2065
- nodes: r.value.map((l) => ({ ...l })),
2066
- links: a.value.map((l) => ({ ...l }))
2067
- }));
2068
- return {
2069
- nodes: r,
2070
- links: a,
2071
- graph: s,
2072
- alluvialInstance: n
2073
- };
2074
- }
2075
- function wr(e) {
2076
- var n;
2077
- const t = (n = e.value) == null ? void 0 : n[0];
2078
- if (!!t)
2079
- return $({
2080
- ...kr,
2081
- ...t
2082
- });
2083
- }
2084
- const Cr = L({
2085
- components: { LumeAlluvialPathGroup: Tr },
2086
- props: {
2087
- ...G(ut)
2088
- },
2089
- setup(e, t) {
2090
- const n = se(e, "data"), r = $([]), a = $([]), o = $(null), s = wr(n), { graph: l, alluvialInstance: i } = Sr(
2091
- s,
2092
- t.attrs.containerSize
2093
- ), {
2094
- leftMostNodeLabelWidth: u,
2095
- rightMostNodeLabelWidth: h,
2096
- topMostNodeLabelExtraHeight: c,
2097
- bottomMostNodeLabelExtraHeight: f
2098
- } = $r(s, l, o), {
2099
- highlightedElements: p,
2100
- highlightLinks: d,
2101
- updateNodes: _,
2102
- renderChart: y,
2103
- maxDepth: m
2104
- } = Or(i, s, l);
2105
- return N(p, function(g, b) {
2106
- var I, H, j, et, nt;
2107
- const x = g.nodes != null && g.links != null, O = new Set((I = g.links) != null ? I : []), { nodes: E = /* @__PURE__ */ new Map() } = (x ? g : b) || {}, { nodeIds: B, linkIds: C } = d(
2108
- (j = (H = l.value) == null ? void 0 : H.links) == null ? void 0 : j.filter((z) => O.has(z))
2109
- );
2110
- ((z = [], vt = []) => {
2111
- a.value = z, r.value = vt;
2112
- })(B, C), _({
2113
- isEntering: x,
2114
- values: E,
2115
- updatingNodes: (nt = (et = l.value) == null ? void 0 : et.nodes) == null ? void 0 : nt.filter(
2116
- (z) => E.has(R(z))
2117
- )
2118
- });
2119
- }), N(
2120
- l,
2121
- (g) => y({ nodes: g.nodes, links: g.links })
2122
- ), N(
2123
- u,
2124
- (g) => i.value.leftExtent = g + K
2125
- ), N(
2126
- h,
2127
- (g) => i.value.rightExtent = i.value.containerSize.width - (g + K)
2128
- ), N(
2129
- f,
2130
- (g) => i.value.bottomExtent = g
2131
- ), N(
2132
- c,
2133
- (g) => i.value.topExtent = g
2134
- ), N(
2135
- i.value.containerSize,
2136
- (g) => i.value.rightExtent = g.width - (h.value + K)
2137
- ), {
2138
- alluvialInstance: i,
2139
- computedData: s,
2140
- defaultColor: Xt,
2141
- highlightedLinkIds: r,
2142
- highlightedNodeIds: a,
2143
- isNodeOrLinkFaded: zt,
2144
- maxDepth: m,
2145
- nodeText: o
2146
- };
2147
- }
2148
- });
2149
- var Ir = function() {
2150
- var t = this, n = t._self._c;
2151
- return t._self._setupProxy, t.alluvialInstance ? n("g", { staticClass: "lume-alluvial-group", attrs: { "data-j-alluvial-group": "" } }, [t._l(t.alluvialInstance.nodeBlocks, function(r, a) {
2152
- return n("g", { key: `node-block_${a}`, staticClass: "lume-alluvial-group__node", class: {
2153
- "lume-alluvial-group__node--faded": t.isNodeOrLinkFaded(
2154
- r.id,
2155
- t.highlightedNodeIds
2156
- )
2157
- }, attrs: { id: `${r.id}`, "data-j-alluvial-group__node-block": "" } }, [n("rect", { class: `lume-alluvial-group__node-block--${r.node.color || t.defaultColor}`, attrs: { transform: `translate(${r.node.x0},${r.node.y0})`, height: r.rect.height, width: r.rect.width }, on: { mouseover: function(o) {
2158
- t.alluvialInstance.highlightedNode = r.node;
2159
- }, mouseout: function(o) {
2160
- t.alluvialInstance.highlightedNode = null;
2161
- } } }), n("text", { ref: "nodeText", refInFor: !0, staticClass: "lume-alluvial-group__node-text lume-typography--caption", class: {
2162
- "lume-alluvial-group__node-text--right": r.node.depth === 0,
2163
- "lume-alluvial-group__node-text--color": r.node.depth === t.maxDepth
2164
- }, attrs: { id: `node-text-${r.node.id}`, transform: `translate(${r.textTransform.x},${r.textTransform.y})` } }, [n("tspan", { staticClass: "lume-alluvial-group__node-title", domProps: { textContent: t._s(r.node.label) } }), n("tspan", { staticClass: "lume-alluvial-group__node-value", attrs: { x: "0", dy: "1.2em" }, domProps: { textContent: t._s(
2165
- t.computedData.valueFormatter(
2166
- r.node.transitionValue || r.node.value
2167
- )
2168
- ) } })])]);
2169
- }), n("lume-alluvial-path-group", { attrs: { "link-paths": t.alluvialInstance.linkPaths, "is-ghost": "", "data-j-alluvial-group__ghost-path": "" }, on: { mouseover: function(r) {
2170
- t.alluvialInstance.highlightedLink = r;
2171
- }, mouseout: function(r) {
2172
- t.alluvialInstance.highlightedLink = null;
2173
- } } }), n("lume-alluvial-path-group", { attrs: { "link-paths": t.alluvialInstance.linkPaths, "container-width": t.alluvialInstance.containerSize.width, "highlighted-link-ids": t.highlightedLinkIds, "data-j-alluvial-group__path": "" }, on: { mouseover: function(r) {
2174
- t.alluvialInstance.highlightedLink = r;
2175
- }, mouseout: function(r) {
2176
- t.alluvialInstance.highlightedLink = null;
2177
- } } })], 2) : t._e();
2178
- }, Nr = [], Dr = /* @__PURE__ */ S(
2179
- Cr,
2180
- Ir,
2181
- Nr,
2182
- !1,
2183
- null,
2184
- "9b0ccc03",
2185
- null,
2186
- null
2187
- );
2188
- const Rr = Dr.exports, Pr = {
2189
- margins: {
2190
- top: 0,
2191
- right: 0,
2192
- bottom: 0,
2193
- left: 0
2194
- },
2195
- withAxes: !1,
2196
- withTooltip: !1,
2197
- withHover: !1,
2198
- withLegend: !1
2199
- }, Er = L({
2200
- components: { LumeChart: Y, LumeAlluvialGroup: Rr },
2201
- props: {
2202
- ...G(ut, !1, !1)
2203
- },
2204
- setup(e, t) {
2205
- const { options: n } = w(e), { allOptions: r } = F(n, Pr);
2206
- function a(o) {
2207
- return {
2208
- ...o,
2209
- noBaseScales: !0
2210
- };
2211
- }
2212
- return {
2213
- allOptions: r,
2214
- getAlluvialDiagramOptions: a,
2215
- slots: q(t.slots)
2216
- };
2217
- }
2218
- });
2219
- var Br = function() {
2220
- var t = this, n = t._self._c;
2221
- return t._self._setupProxy, n("lume-chart", t._b({ attrs: { options: t.getAlluvialDiagramOptions(t.allOptions), "data-j-alluvial-diagram": "" }, scopedSlots: t._u([{ key: "groups", fn: function(r) {
2222
- return [n("lume-alluvial-group", t._b({}, "lume-alluvial-group", r, !1))];
2223
- } }, t._l(t.slots, function(r, a) {
2224
- return { key: a, fn: function(o) {
2225
- return [t._t(a, null, null, o || {})];
2226
- } };
2227
- })], null, !0) }, "lume-chart", t.$props, !1));
2228
- }, Mr = [], Hr = /* @__PURE__ */ S(
2229
- Er,
2230
- Br,
2231
- Mr,
2232
- !1,
2233
- null,
2234
- null,
2235
- null,
2236
- null
2237
- );
2238
- const Va = Hr.exports;
2239
- var Ut = /* @__PURE__ */ ((e) => (e.grouped = "grouped", e.stacked = "stacked", e))(Ut || {});
2240
- const Et = {
2241
- single: "lume-single-bar-chart",
2242
- grouped: "lume-grouped-bar-chart",
2243
- stacked: "lume-stacked-bar-chart"
2244
- }, jr = L({
2245
- components: {
2246
- LumeSingleBarChart: ht(
2247
- () => import("./25ccdedf.js")
2248
- ),
2249
- LumeGroupedBarChart: ht(
2250
- () => import("./6f5e659c.js")
2251
- ),
2252
- LumeStackedBarChart: ht(
2253
- () => import("./97d72066.js")
2254
- )
2255
- },
2256
- props: {
2257
- ...G(),
2258
- type: {
2259
- type: String,
2260
- default: null,
2261
- validator: (e) => e in Ut || e == null
2262
- }
2263
- },
2264
- setup(e, t) {
2265
- function n(a) {
2266
- return {
2267
- ...a,
2268
- startOnZero: !0,
2269
- tooltipOptions: {
2270
- ...(a == null ? void 0 : a.tooltipOptions) || {},
2271
- position: e.orientation === T.HORIZONTAL && "right"
2272
- }
2273
- };
2274
- }
2275
- return {
2276
- component: v(() => {
2277
- if (!!e.data) {
2278
- if (ut(e.data))
2279
- return Et.single;
2280
- if (!e.type)
2281
- throw new Error(
2282
- "Bar chart needs a type when there's multiple datasets."
2283
- );
2284
- return Et[e.type];
2285
- }
2286
- }),
2287
- getBarChartOptions: n,
2288
- slots: q(t.slots)
2289
- };
2290
- }
2291
- });
2292
- var Fr = function() {
2293
- var t = this, n = t._self._c;
2294
- return t._self._setupProxy, n(t.component, t._g(t._b({ tag: "component", attrs: { options: t.getBarChartOptions(t.options) }, scopedSlots: t._u([t._l(t.slots, function(r, a) {
2295
- return { key: a, fn: function(o) {
2296
- return [t._t(a, null, null, o || {})];
2297
- } };
2298
- })], null, !0) }, "component", t.$props, !1), t.$listeners));
2299
- }, Vr = [], Gr = /* @__PURE__ */ S(
2300
- jr,
2301
- Fr,
2302
- Vr,
2303
- !1,
2304
- null,
2305
- null,
2306
- null,
2307
- null
2308
- );
2309
- const Ga = Gr.exports;
2310
- function zr(e) {
2311
- return Object.values(we).includes(e) || e == null;
2312
- }
2313
- function Wr(e) {
2314
- return Object.values(T).includes(e);
2315
- }
2316
- const Zr = (e = !1) => ({
2317
- type: {
2318
- type: String,
2319
- default: null,
2320
- validator: zr
2321
- },
2322
- ...e ? {
2323
- orientation: {
2324
- type: String,
2325
- default: T.VERTICAL,
2326
- validator: Wr
2327
- }
2328
- } : {}
2329
- });
2330
- function Yt(e) {
2331
- const t = v(() => e.value.map((r) => ({
2332
- ...r,
2333
- values: r.values.map((a) => ({
2334
- ...a,
2335
- value: (a == null ? void 0 : a.value) || 0
2336
- }))
2337
- }))), n = v(() => {
2338
- var r;
2339
- return (r = t.value) == null ? void 0 : r.reduce((a, o) => (o.values.forEach((s, l) => {
2340
- a[l] ? a[l].push(s) : a[l] = [s];
2341
- }), a), []);
2342
- });
2343
- return { multiBarData: t, groupedData: n };
2344
- }
2345
- function qr(e, t) {
2346
- return e.value.length === 1 ? "single" : t.value;
2347
- }
2348
- function Xr(e, t, n, r) {
2349
- const a = v(
2350
- () => r.value === T.HORIZONTAL
2351
- );
2352
- function o(i) {
2353
- Math.min(...i.domain()) > 0 && console.error("Bar linear scale domain cannot start above 0!");
2354
- }
2355
- const s = v(() => {
2356
- const { padding: i, paddingInner: u, paddingOuter: h } = n.value;
2357
- return a.value ? (() => (o(e.value), e.value))() : it(
2358
- e.value,
2359
- r.value,
2360
- { padding: i, paddingInner: u, paddingOuter: h }
2361
- );
2362
- }), l = v(() => {
2363
- const { padding: i, paddingInner: u, paddingOuter: h } = n.value;
2364
- return a.value ? it(
2365
- t.value,
2366
- r.value,
2367
- { padding: i, paddingInner: u, paddingOuter: h }
2368
- ) : (() => (o(t.value), t.value))();
2369
- });
2370
- return { barXScale: s, barYScale: l };
2371
- }
2372
- const Ur = "skyblue";
2373
- function Yr(e, t, n, r, a, o) {
2374
- const s = v(
2375
- () => r.value === T.HORIZONTAL
2376
- );
2377
- function l(c, f) {
2378
- let p, d;
2379
- return s.value ? (p = c >= 0 ? t.value(0) : t.value(c), d = n.value(n.value.domain()[f])) : (p = t.value(t.value.domain()[f]), d = c < 0 ? n.value(0) : n.value(c)), { x: p, y: d };
2380
- }
2381
- function i(c) {
2382
- return s.value ? c < 0 ? t.value(0) - t.value(c) : t.value(c) - t.value(0) : t.value.bandwidth();
2383
- }
2384
- function u(c) {
2385
- return s.value ? n.value.bandwidth() : c < 0 ? n.value(c) - n.value(0) : n.value(0) - n.value(c);
2386
- }
2387
- function h(c, f, p) {
2388
- var O;
2389
- const { value: d, color: _ } = c, y = (O = _ != null ? _ : e.value[f].color) != null ? O : Ur, { x: m, y: g } = l(d, p), b = i(d), x = u(d);
2390
- return {
2391
- classList: [`lume-fill--${y}`, ...o],
2392
- x: m,
2393
- y: g,
2394
- width: b,
2395
- height: x,
2396
- isFaded: a.value !== -1 && a.value !== p,
2397
- isNegative: d < 0
2398
- };
2399
- }
2400
- return { barAttributeGenerator: h };
2401
- }
2402
- function Kr(e, t, n, r, a, o) {
2403
- const s = v(
2404
- () => r.value === T.HORIZONTAL
2405
- ), l = v(() => J().domain(e.value.map((d, _) => _)).range([0, t.value.bandwidth()]).padding(0)), i = v(() => J().domain(e.value.map((d, _) => _)).range([0, n.value.bandwidth()]).padding(0));
2406
- function u(d, _, y) {
2407
- if (s.value)
2408
- return d >= 0 ? t.value(0) : t.value(d);
2409
- const m = t.value.domain();
2410
- return t.value(m[_]) + l.value(y);
2411
- }
2412
- function h(d, _, y) {
2413
- if (s.value) {
2414
- const m = n.value.domain();
2415
- return n.value(m[_]) + i.value(y);
2416
- }
2417
- return d < 0 ? n.value(0) : n.value(d);
2418
- }
2419
- function c(d) {
2420
- return s.value ? d < 0 ? t.value(0) - t.value(d) : t.value(d) - t.value(0) : l.value.bandwidth();
2421
- }
2422
- function f(d) {
2423
- return s.value ? i.value.bandwidth() : d < 0 ? n.value(d) - n.value(0) : n.value(0) - n.value(d);
2424
- }
2425
- function p(d, _, y) {
2426
- var C;
2427
- const { value: m, color: g } = d, b = (C = g != null ? g : e.value[_].color) != null ? C : Object.values(M)[_], x = u(m, y, _), O = h(m, y, _), E = c(m), B = f(m);
2428
- return {
2429
- classList: [`lume-fill--${b}`, ...o],
2430
- x,
2431
- y: O,
2432
- width: E,
2433
- height: B,
2434
- isFaded: a.value !== -1 && a.value !== y,
2435
- isNegative: m < 0
2436
- };
2437
- }
2438
- return { barAttributeGenerator: p };
2439
- }
2440
- function Jr(e, t) {
2441
- const n = v(
2442
- () => t.value === T.HORIZONTAL
2443
- ), r = v(() => {
2444
- const l = e.value.map(
2445
- (i) => i.filter((u) => u.value < 0).reduce((u, h) => u + h.value, 0)
2446
- );
2447
- return Math.min(...l);
2448
- }), a = v(() => {
2449
- const l = e.value.map(
2450
- (i) => i.reduce(
2451
- (u, h) => h.value >= 0 ? u + h.value : u,
2452
- 0
2453
- )
2454
- );
2455
- return Math.max(...l);
2456
- });
2457
- function o(l, i, u) {
2458
- return n.value ? Q().domain([r.value, a.value]).range([0, u.width]) : it(
2459
- J().domain(i == null ? void 0 : i.map((h) => h)).range([0, u.width])
2460
- );
2461
- }
2462
- function s(l, i, u) {
2463
- return n.value ? it(
2464
- J().domain(i == null ? void 0 : i.map((h) => h)).range([0, u.height])
2465
- ) : Q().domain([a.value, r.value]).range([0, u.height]);
2466
- }
2467
- return { stackedXScaleGenerator: o, stackedYScaleGenerator: s };
2468
- }
2469
- function Qr(e, t, n, r, a, o) {
2470
- const s = v(
2471
- () => r.value === T.HORIZONTAL
2472
- ), l = v(
2473
- () => s.value ? n.value.domain() : t.value.domain()
2474
- ), i = v(
2475
- () => e.value.map((m) => m.values.map((g) => g == null ? void 0 : g.value))
2476
- );
2477
- function u(m, g, b) {
2478
- let x, O;
2479
- return s.value ? (x = t.value(m >= 0 ? 0 + b : m + b), O = n.value(l.value[g])) : (x = t.value(l.value[g]), O = n.value(m >= 0 ? m + b : 0 + b)), { x, y: O };
2480
- }
2481
- function h(m) {
2482
- return s.value ? t.value(m) - t.value(0) : t.value.bandwidth();
2483
- }
2484
- function c(m) {
2485
- return s.value ? t.value(0) - t.value(m) : t.value.bandwidth();
2486
- }
2487
- function f(m) {
2488
- return s.value ? n.value.bandwidth() : n.value(0) - n.value(m);
2489
- }
2490
- function p(m) {
2491
- return s.value ? n.value.bandwidth() : n.value(m) - n.value(0);
2492
- }
2493
- function d(m, g) {
2494
- return m ? i.value.reduce((b, x, O) => (O < m && x[g] >= 0 && (b += x[g]), b), 0) : 0;
2495
- }
2496
- function _(m, g) {
2497
- return m ? i.value.reduce((b, x, O) => (O < m && x[g] < 0 && (b += x[g]), b), 0) : 0;
2498
- }
2499
- function y(m, g, b) {
2500
- var j;
2501
- const { value: x, color: O } = m, E = x >= 0 ? h(x) : c(x), B = x >= 0 ? f(x) : p(x), C = x >= 0 ? d(g, b) : _(g, b), { x: k, y: I } = u(x, b, C);
2502
- return {
2503
- classList: [`lume-fill--${(j = O != null ? O : e.value[g].color) != null ? j : Object.values(M)[g]}`, ...o],
2504
- width: E,
2505
- height: B,
2506
- x: k,
2507
- y: I,
2508
- isFaded: a.value !== -1 && a.value !== b,
2509
- isNegative: x < 0
2510
- };
2511
- }
2512
- return { barAttributeGenerator: y };
2513
- }
2514
- const ta = {
2515
- single: Yr,
2516
- grouped: Kr,
2517
- stacked: Qr
2518
- }, ea = L({
2519
- components: { LumeBar: $t },
2520
- props: {
2521
- ...kt(),
2522
- classList: {
2523
- type: [String, Array],
2524
- default: () => []
2525
- },
2526
- ...Zr(!0),
2527
- transition: {
2528
- type: Boolean,
2529
- default: !0
2530
- }
2531
- },
2532
- setup(e) {
2533
- const {
2534
- data: t,
2535
- hoveredIndex: n,
2536
- options: r,
2537
- orientation: a,
2538
- transition: o,
2539
- type: s,
2540
- xScale: l,
2541
- yScale: i,
2542
- classList: u
2543
- } = w(e), { groupedData: h } = Yt(t), { barXScale: c, barYScale: f } = Xr(
2544
- l,
2545
- i,
2546
- r,
2547
- a
2548
- ), p = v(() => typeof u.value == "string" ? [u.value] : u.value), d = v(() => {
2549
- const y = qr(t, s), { barAttributeGenerator: m } = ta[y](
2550
- t,
2551
- c,
2552
- f,
2553
- a,
2554
- n,
2555
- p.value
2556
- );
2557
- return m;
2558
- }), _ = v(() => {
2559
- if (!!o.value)
2560
- return a.value === T.HORIZONTAL ? "width" : "height";
2561
- });
2562
- return {
2563
- barXScale: c,
2564
- barYScale: f,
2565
- computedTransition: _,
2566
- getBarAttributes: d,
2567
- groupedData: h
2568
- };
2569
- }
2570
- });
2571
- var na = function() {
2572
- var t = this, n = t._self._c;
2573
- return t._self._setupProxy, n("g", { staticClass: "lume-bar-group", attrs: { "data-j-bars-group": "" } }, t._l(t.groupedData, function(r, a) {
2574
- return n("g", { key: a }, t._l(r, function(o, s) {
2575
- return n("lume-bar", t._b({ key: `bar-${s}`, attrs: { transition: t.computedTransition, "data-j-lume-bar": "" } }, "lume-bar", t.getBarAttributes(o, s, a, r), !1));
2576
- }), 1);
2577
- }), 0);
2578
- }, ra = [], aa = /* @__PURE__ */ S(
2579
- ea,
2580
- na,
2581
- ra,
2582
- !1,
2583
- null,
2584
- null,
2585
- null,
2586
- null
2587
- );
2588
- const Lt = aa.exports, oa = {
2589
- [T.VERTICAL]: {
2590
- withTooltip: !0,
2591
- xAxisOptions: {},
2592
- yAxisOptions: { gridLines: !0 },
2593
- margins: Z.VERTICAL
2594
- },
2595
- [T.HORIZONTAL]: {
2596
- withTooltip: !0,
2597
- xAxisOptions: { gridLines: !0 },
2598
- yAxisOptions: { gridLines: !1 },
2599
- margins: Z.HORIZONTAL
2600
- }
2601
- }, sa = L({
2602
- components: { LumeChart: Y, LumeBarGroup: Lt },
2603
- props: {
2604
- ...G(ut)
2605
- },
2606
- setup(e, t) {
2607
- const { orientation: n, options: r } = w(e), a = v(
2608
- () => oa[n.value || T.VERTICAL]
2609
- ), { allOptions: o } = F(r, a);
2610
- return { allOptions: o, slots: q(t.slots) };
2611
- }
2612
- });
2613
- var ia = function() {
2614
- var t = this, n = t._self._c;
2615
- return t._self._setupProxy, n("lume-chart", t._b({ attrs: { "chart-type": "single-bar", options: t.allOptions, "data-j-single-bar-chart": "" }, scopedSlots: t._u([{ key: "groups", fn: function(r) {
2616
- return [n("lume-bar-group", t._b({ attrs: { orientation: t.orientation } }, "lume-bar-group", r, !1))];
2617
- } }, t._l(t.slots, function(r, a) {
2618
- return { key: a, fn: function(o) {
2619
- return [t._t(a, null, null, o || {})];
2620
- } };
2621
- })], null, !0) }, "lume-chart", t.$props, !1));
2622
- }, la = [], ua = /* @__PURE__ */ S(
2623
- sa,
2624
- ia,
2625
- la,
2626
- !1,
2627
- null,
2628
- null,
2629
- null,
2630
- null
2631
- );
2632
- const za = ua.exports, ca = {
2633
- [T.VERTICAL]: {
2634
- withTooltip: !0,
2635
- xAxisOptions: {},
2636
- yAxisOptions: { gridLines: !0 },
2637
- margins: Z.VERTICAL
2638
- },
2639
- [T.HORIZONTAL]: {
2640
- withTooltip: !0,
2641
- xAxisOptions: { gridLines: !0 },
2642
- yAxisOptions: { gridLines: !1 },
2643
- margins: Z.HORIZONTAL,
2644
- tooltipOptions: { position: At[6] }
2645
- }
2646
- }, da = L({
2647
- components: { LumeChart: Y, LumeBarGroup: Lt },
2648
- props: {
2649
- ...G()
2650
- },
2651
- setup(e, t) {
2652
- const { orientation: n, options: r } = w(e), a = v(
2653
- () => ca[n.value || T.VERTICAL]
2654
- ), { allOptions: o } = F(r, a);
2655
- return { allOptions: o, slots: q(t.slots) };
2656
- }
2657
- });
2658
- var fa = function() {
2659
- var t = this, n = t._self._c;
2660
- return t._self._setupProxy, n("lume-chart", t._b({ attrs: { "chart-type": "grouped-bar", options: t.allOptions, "data-j-grouped-bar-chart": "" }, scopedSlots: t._u([{ key: "groups", fn: function(r) {
2661
- return [n("lume-bar-group", t._b({ attrs: { type: "grouped" } }, "lume-bar-group", r, !1))];
2662
- } }, t._l(t.slots, function(r, a) {
2663
- return { key: a, fn: function(o) {
2664
- return [t._t(a, null, null, o || {})];
2665
- } };
2666
- })], null, !0) }, "lume-chart", t.$props, !1));
2667
- }, pa = [], va = /* @__PURE__ */ S(
2668
- da,
2669
- fa,
2670
- pa,
2671
- !1,
2672
- null,
2673
- null,
2674
- null,
2675
- null
2676
- );
2677
- const Wa = va.exports, ha = {
2678
- [T.VERTICAL]: {
2679
- withTooltip: !0,
2680
- xAxisOptions: {},
2681
- yAxisOptions: { gridLines: !0 },
2682
- margins: Z.VERTICAL
2683
- },
2684
- [T.HORIZONTAL]: {
2685
- withTooltip: !0,
2686
- xAxisOptions: { gridLines: !0 },
2687
- yAxisOptions: { gridLines: !1 },
2688
- margins: Z.HORIZONTAL,
2689
- tooltipOptions: { position: At[6] }
2690
- }
2691
- }, _a = L({
2692
- components: { LumeChart: Y, LumeBarGroup: Lt },
2693
- props: {
2694
- ...G()
2695
- },
2696
- setup(e, t) {
2697
- const { data: n, orientation: r, options: a } = w(e), o = v(
2698
- () => ha[r.value || T.VERTICAL]
2699
- ), { allOptions: s } = F(a, o), { internalData: l } = dt(n), { groupedData: i } = Yt(l), { stackedXScaleGenerator: u, stackedYScaleGenerator: h } = Jr(
2700
- i,
2701
- r
2702
- );
2703
- return {
2704
- allOptions: s,
2705
- stackedXScaleGenerator: u,
2706
- stackedYScaleGenerator: h,
2707
- slots: q(t.slots)
2708
- };
2709
- }
2710
- });
2711
- var ma = function() {
2712
- var t = this, n = t._self._c;
2713
- return t._self._setupProxy, n("lume-chart", t._b({ attrs: { "chart-type": "stacked-bar", options: t.allOptions, "x-scale": t.stackedXScaleGenerator, "y-scale": t.stackedYScaleGenerator, "data-j-stacked-bar-chart": "" }, scopedSlots: t._u([{ key: "groups", fn: function(r) {
2714
- return [n("lume-bar-group", t._b({ attrs: { type: "stacked" } }, "lume-bar-group", r, !1))];
2715
- } }, t._l(t.slots, function(r, a) {
2716
- return { key: a, fn: function(o) {
2717
- return [t._t(a, null, null, o || {})];
2718
- } };
2719
- })], null, !0) }, "lume-chart", t.$props, !1));
2720
- }, ga = [], ya = /* @__PURE__ */ S(
2721
- _a,
2722
- ma,
2723
- ga,
2724
- !1,
2725
- null,
2726
- null,
2727
- null,
2728
- null
2729
- );
2730
- const Za = ya.exports;
2731
- function Kt(e) {
2732
- function t(o) {
2733
- let s = null;
2734
- return o == null ? void 0 : o.reduce((l, i, u) => (i == null || i.value == null ? (s ? s.push(u) : s = [u], u === (o == null ? void 0 : o.length) - 1 && l.push(s)) : s && (l.push(s), s = null), l), []);
2735
- }
2736
- function n(o, s, l, i) {
2737
- const c = Math.abs(o - s) / (l + 1) * (i + 1);
2738
- return o > s ? o - c : o + c;
2739
- }
2740
- function r(o) {
2741
- return function(l) {
2742
- return !!o.find(
2743
- (i) => i.includes(l) || i.includes(l - 1)
2744
- );
2745
- };
2746
- }
2747
- return { computedLineData: v(() => e.value.map((o) => {
2748
- const s = t(o.values);
2749
- return {
2750
- ...o,
2751
- isDashed: r(s),
2752
- values: o.values.map((l, i) => {
2753
- var h, c;
2754
- const u = s.find(
2755
- (f) => f.includes(i)
2756
- );
2757
- if (u) {
2758
- const f = u[0] - 1, p = u[u.length - 1] + 1;
2759
- let d = (h = o.values[f]) == null ? void 0 : h.value, _ = (c = o.values[p]) == null ? void 0 : c.value;
2760
- return d == null && (d = _), _ == null && (_ = d), {
2761
- value: n(
2762
- d,
2763
- _,
2764
- u.length,
2765
- u.indexOf(i)
2766
- ),
2767
- label: jt
2768
- };
2769
- }
2770
- return l;
2771
- })
2772
- };
2773
- })) };
2774
- }
2775
- function ba(e, t) {
2776
- const n = Ot(e) / 2;
2777
- return (r, a) => e(e.domain()[t + (a - 1)]) + n;
2778
- }
2779
- function xa(e, t) {
2780
- return (n, r) => e(t + (r - 1));
2781
- }
2782
- function Ta(e, t, n, r) {
2783
- return fe().x(
2784
- U(n) ? ba(n, e) : xa(n, e)
2785
- ).y((o) => r(o))(t);
2786
- }
2787
- const Aa = L({
2788
- components: { LumeLine: qn, LumePoint: Qn },
2789
- props: {
2790
- ...kt(),
2791
- withPoints: {
2792
- type: Boolean,
2793
- default: !0
2794
- },
2795
- transition: {
2796
- type: Boolean,
2797
- default: !0
2798
- }
2799
- },
2800
- setup(e) {
2801
- const { data: t, options: n, xScale: r, yScale: a } = w(e), o = v(() => {
2802
- if (t.value.every((p) => p.isDashed))
2803
- return t.value;
2804
- const { computedLineData: f } = Kt(t);
2805
- return f.value;
2806
- }), s = v(() => {
2807
- if (e.hoveredIndex === -1)
2808
- return;
2809
- const f = Gt(t.value, e.hoveredIndex);
2810
- return {
2811
- d: `M ${mt(r.value, e.hoveredIndex)},${a.value.range()[1]}
2812
- V ${a.value(f)}`
2813
- };
2814
- }), l = v(
2815
- () => {
2816
- var f;
2817
- return ((f = n.value) == null ? void 0 : f.lineWidth) * 2 || void 0;
2818
- }
2819
- );
2820
- function i(f) {
2821
- return o.value[f].values;
2822
- }
2823
- function u(f, p) {
2824
- var _, y;
2825
- const d = f === 0 ? [] : [
2826
- (_ = i(p)[f - 1]) == null ? void 0 : _.value,
2827
- (y = i(p)[f]) == null ? void 0 : y.value
2828
- ];
2829
- return Ta(
2830
- f,
2831
- d,
2832
- r.value,
2833
- a.value
2834
- ) || "";
2835
- }
2836
- function h(f, p) {
2837
- var d;
2838
- return (d = i(p)[f]) == null ? void 0 : d.value;
2839
- }
2840
- function c(f) {
2841
- return e.hoveredIndex === f;
2842
- }
2843
- return {
2844
- computedGroupData: o,
2845
- getPathDefinition: u,
2846
- getPointValue: h,
2847
- isPointActive: c,
2848
- overlayLineAttributes: s,
2849
- pointRadius: l
2850
- };
2851
- }
2852
- });
2853
- var Oa = function() {
2854
- var t = this, n = t._self._c;
2855
- return t._self._setupProxy, n("g", { staticClass: "lume-line-group", attrs: { "data-j-lume-line-group": "" } }, [n("path", t._b({ staticClass: "lume-line-group__overlay-line", attrs: { "data-j-lume-line-group__overlay-line": "" } }, "path", t.overlayLineAttributes, !1)), t._l(t.computedGroupData, function(r, a) {
2856
- return n("g", { key: r.label, staticClass: "lume-line-group__group" }, [n("g", { staticClass: "lume-line-group__lines" }, t._l(r.values, function(o, s) {
2857
- return n("lume-line", { key: `line-${s}`, attrs: { "path-definition": t.getPathDefinition(s, a), color: r.color, dashed: r.isDashed(s), index: s, transition: t.transition, width: t.options.lineWidth, "x-scale": t.xScale } });
2858
- }), 1), t.withPoints ? n("g", { staticClass: "lume-line-group__points", attrs: { "data-j-lume-line-group__points": "" } }, t._l(r.values, function(o, s) {
2859
- return n("lume-point", { key: `point-${s}`, attrs: { active: t.isPointActive(s), color: r.color, index: s, radius: t.pointRadius, value: t.getPointValue(s, a), "x-scale": t.xScale, "y-scale": t.yScale } });
2860
- }), 1) : t._e()]);
2861
- })], 2);
2862
- }, $a = [], ka = /* @__PURE__ */ S(
2863
- Aa,
2864
- Oa,
2865
- $a,
2866
- !1,
2867
- null,
2868
- "10fed727",
2869
- null,
2870
- null
2871
- );
2872
- const Jt = ka.exports, La = {
2873
- margins: Z.VERTICAL,
2874
- startOnZero: !0,
2875
- withTooltip: !0,
2876
- xAxisOptions: {},
2877
- yAxisOptions: { gridLines: !0 }
2878
- }, Sa = L({
2879
- components: { LumeChart: Y, LumeLineGroup: Jt },
2880
- props: {
2881
- ...G(null, !1)
2882
- },
2883
- setup(e, t) {
2884
- const { options: n } = w(e), { allOptions: r } = F(n, La);
2885
- return { allOptions: r, slots: q(t.slots) };
2886
- }
2887
- });
2888
- var wa = function() {
2889
- var t = this, n = t._self._c;
2890
- return t._self._setupProxy, n("lume-chart", t._b({ attrs: { "chart-type": "line", options: t.allOptions, "data-j-lume-line-chart": "" }, scopedSlots: t._u([{ key: "groups", fn: function(r) {
2891
- return [n("lume-line-group", t._b({}, "lume-line-group", r, !1))];
2892
- } }, t._l(t.slots, function(r, a) {
2893
- return { key: a, fn: function(o) {
2894
- return [t._t(a, null, null, o || {})];
2895
- } };
2896
- })], null, !0) }, "lume-chart", t.$props, !1));
2897
- }, Ca = [], Ia = /* @__PURE__ */ S(
2898
- Sa,
2899
- wa,
2900
- Ca,
2901
- !1,
2902
- null,
2903
- null,
2904
- null,
2905
- null
2906
- );
2907
- const qa = Ia.exports;
2908
- function Na(e) {
2909
- return { areaPathDefinition: v(
2910
- () => function(n, r) {
2911
- if (!n || !r)
2912
- return;
2913
- const a = e.value[0].values;
2914
- return pe().x((o, s) => n(s)).y0(r(Math.min(...r.domain()))).y1((o) => r(o.value))(a);
2915
- }
2916
- ) };
2917
- }
2918
- const Da = {
2919
- margins: {
2920
- top: 0,
2921
- right: 0,
2922
- bottom: 0,
2923
- left: 0
2924
- },
2925
- withAxes: !1,
2926
- showArea: !0,
2927
- startOnZero: !0,
2928
- withLegend: !1,
2929
- tooltipOptions: {
2930
- showTitle: !1
2931
- }
2932
- }, Ra = L({
2933
- components: { LumeChart: Y, LumeLineGroup: Jt },
2934
- props: {
2935
- ...Wt(null),
2936
- ...ft()
2937
- },
2938
- setup(e, t) {
2939
- const { data: n, options: r } = w(e), { internalData: a } = dt(n), { allOptions: o } = F(r, Da), { computedLineData: s } = Kt(a), { areaPathDefinition: l } = Na(s), i = v(() => a.value[0].color), u = v(
2940
- () => n.value[0].areaColor || i.value
2941
- );
2942
- function h(f) {
2943
- return {
2944
- ...f,
2945
- noMinSize: !0
2946
- };
2947
- }
2948
- function c(f, p, d) {
2949
- return Q().range([0, d.width]).domain([0, f[0].values.length - 1]);
2950
- }
2951
- return {
2952
- allOptions: o,
2953
- areaColor: u,
2954
- areaPathDefinition: l,
2955
- computedColor: i,
2956
- getSparklineOptions: h,
2957
- xScaleGenerator: c,
2958
- slots: q(t.slots)
2959
- };
2960
- }
2961
- });
2962
- var Pa = function() {
2963
- var t = this, n = t._self._c;
2964
- return t._self._setupProxy, n("lume-chart", t._b({ attrs: { "chart-type": "line", options: t.getSparklineOptions(t.allOptions), "x-scale": t.xScaleGenerator }, scopedSlots: t._u([{ key: "groups", fn: function(r) {
2965
- return [t.allOptions.showArea ? n("path", { class: [
2966
- "sparkline-chart__area",
2967
- `lume-fill--${t.areaColor || t.computedColor}`,
2968
- "lume-fill--faded"
2969
- ], attrs: { d: t.areaPathDefinition(r.xScale, r.yScale), "data-j-sparkline__area": "" } }) : t._e(), n("lume-line-group", t._b({ attrs: { "with-points": !1 } }, "lume-line-group", r, !1))];
2970
- } }, t._l(t.slots, function(r, a) {
2971
- return { key: a, fn: function(o) {
2972
- return [t._t(a, null, null, o || {})];
2973
- } };
2974
- })], null, !0) }, "lume-chart", t.$props, !1));
2975
- }, Ea = [], Ba = /* @__PURE__ */ S(
2976
- Ra,
2977
- Pa,
2978
- Ea,
2979
- !1,
2980
- null,
2981
- "76a94ce0",
2982
- null,
2983
- null
2984
- );
2985
- const Xa = Ba.exports;
2986
- export {
2987
- mn as L,
2988
- Ga as a,
2989
- za as b,
2990
- Wa as c,
2991
- Za as d,
2992
- qa as e,
2993
- Xa as f,
2994
- Y as g,
2995
- On as h,
2996
- wn as i,
2997
- Rn as j,
2998
- $t as k,
2999
- Va as l,
3000
- qn as m,
3001
- Qn as n,
3002
- Rr as o,
3003
- Lt as p,
3004
- Jt as q,
3005
- ar as r
3006
- };
3007
- //# sourceMappingURL=55f09e14.js.map