@feedmepos/mf-report 5.26.4 → 5.26.5-beta.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.
Files changed (29) hide show
  1. package/dist/{App-swq2ECTF.js → App-QcOCU8rc.js} +60 -60
  2. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-D2CpsvxS.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-De-0BpSa.js} +1 -1
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-_zBaKDEK.js → Default.vue_vue_type_script_setup_true_lang-3blnkA-n.js} +1 -1
  4. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-hP3sZIfZ.js +4777 -0
  5. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-Dun5PD4W.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-DHPUtfOs.js} +2521 -2562
  6. package/dist/{InsightView-zWCeytWt.js → InsightView-_wb0GqpG.js} +4 -4
  7. package/dist/{Integration-DYCTpXlU.js → Integration-DyGkKMsa.js} +3 -3
  8. package/dist/{Integrations-ClLIVRa8.js → Integrations-C5ZsHxmd.js} +2 -2
  9. package/dist/{Layout-B4fXLMaj.js → Layout-CmMa2qs4.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-KKttveoS.js → MenuTab.vue_vue_type_script_setup_true_lang-BsE2UhQ5.js} +4 -4
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-CH7w1ORf.js → NavigationTab.vue_vue_type_script_setup_true_lang-ewnLHyBz.js} +3 -3
  12. package/dist/{OverviewView-BhXfogDe.js → OverviewView-DCz3S4k6.js} +4 -4
  13. package/dist/{Report-BwmFIgo-.js → Report-Bksdpnal.js} +3 -3
  14. package/dist/{ReportEditor-CTQ8vCNs.js → ReportEditor-BHONojQQ.js} +228 -228
  15. package/dist/{ReportView-ZCaT-MkZ.js → ReportView-vhrQCIHU.js} +6 -6
  16. package/dist/{Setting-Co8VUFhL.js → Setting-CwwCAzJH.js} +3 -3
  17. package/dist/{Template-22RXwi-V.js → Template-DVYVtNYg.js} +3 -3
  18. package/dist/TileEditor-BXCFEix_.js +4027 -0
  19. package/dist/TransitionFade-B2T5r_vC.js +3360 -0
  20. package/dist/{app-B8enBaoM.js → app-DnkOgWGu.js} +1470 -993
  21. package/dist/app.js +1 -1
  22. package/dist/assets/{formatChartData.worker-CM3TtVoi.js → formatChartData.worker-BwOf9WPp.js} +5 -5
  23. package/dist/assets/{processTableData.worker-BTFUd91t.js → processTableData.worker-BlwP8Wjn.js} +5 -5
  24. package/dist/style.css +1 -1
  25. package/dist/{useRestaurantPermission-Bc9WzEui.js → useRestaurantPermission-CQKnU3lQ.js} +1 -1
  26. package/package.json +1 -1
  27. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-BoRLpJ9M.js +0 -4924
  28. package/dist/TileEditor-Bs4LL9Bo.js +0 -3863
  29. package/dist/TransitionFade-BYmuDYSd.js +0 -2379
@@ -0,0 +1,4777 @@
1
+ import { computed as b, defineComponent as Be, ref as L, watch as Se, onMounted as Vt, onBeforeUnmount as no, resolveComponent as ie, createBlock as de, openBlock as Y, Transition as No, withCtx as xe, createElementBlock as re, createCommentVNode as me, createElementVNode as j, unref as s, normalizeStyle as Ie, withModifiers as Zt, toDisplayString as Te, createVNode as se, Fragment as Ve, renderList as Ft, normalizeClass as we, nextTick as $o, mergeModels as ze, useModel as He, renderSlot as Qe, h as qt, createSlots as zo, resolveDynamicComponent as oo, toRaw as Ho, markRaw as Wo, createTextVNode as Oo, onUnmounted as ao, withDirectives as Uo, vShow as Ko } from "vue";
2
+ import { W as ee, j as Xo, S as It, v as Bt, k as Yo, l as dn, m as ro, d as Eo, q as qo, R as pt, n as Go } from "./GlobalFilterSelect.vue_vue_type_script_setup_true_lang-DHPUtfOs.js";
3
+ import { i as Qt, a as nn, u as lo } from "./app-DnkOgWGu.js";
4
+ import { d as gn } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-De-0BpSa.js";
5
+ import { storeToRefs as At } from "pinia";
6
+ import { detectLocale as so } from "@feedmepos/mf-common";
7
+ import { C as vn } from "./chart-DDDh8zNk.js";
8
+ import { useBreakpoints as Nt, useSnackbar as Ln, components as jo } from "@feedmepos/ui-library";
9
+ import { u as it } from "./vue-i18n-DVWuTfed.js";
10
+ import { b as io, _ as Nn } from "./SelectComponent.vue_vue_type_script_setup_true_lang-BL1jpiXN.js";
11
+ import { r as lt } from "./i18n-CI_sQ5d_.js";
12
+ var yn = /* @__PURE__ */ ((e) => (e.line = "LINE", e.bar = "BAR", e))(yn || {}), Je = /* @__PURE__ */ ((e) => (e.top = "TOP", e.bottom = "BOTTOM", e))(Je || {}), bn = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(bn || {}), Cn = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(Cn || {}), xn = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(xn || {}), wn = /* @__PURE__ */ ((e) => (e.right = "right", e.left = "left", e))(wn || {}), _n = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e.right = "right", e.left = "left", e.chartArea = "chartArea", e))(_n || {}), ye = /* @__PURE__ */ ((e) => (e.series = "SERIES", e.metric = "METRIC", e.breakdown = "BREAKDOWN", e))(ye || {});
13
+ ee.Circular, ee.Table, ee.BarChart, ee.LineChart, ee.StackBarChart, ee.ClusteredStackBarChart, ee.StackLineChart, ee.Scorecard, ee.Spacer;
14
+ const Jo = [
15
+ {
16
+ type: ee.Circular,
17
+ showLabel: !1,
18
+ // TODO: temporarily removed show label as it has no function
19
+ showDrillDimension: !0,
20
+ showRollup: !1,
21
+ showSearchBar: !1
22
+ },
23
+ {
24
+ type: ee.Table,
25
+ showLabel: !1,
26
+ showDrillDimension: !0,
27
+ showRollup: !0,
28
+ showSearchBar: !0
29
+ },
30
+ {
31
+ type: ee.BarChart,
32
+ showLabel: !1,
33
+ // TODO: temporarily removed show label as it has no function
34
+ showDrillDimension: !0,
35
+ showRollup: !1,
36
+ showSearchBar: !1
37
+ },
38
+ {
39
+ type: ee.LineChart,
40
+ showLabel: !1,
41
+ // TODO: temporarily removed show label as it has no function
42
+ showDrillDimension: !0,
43
+ showRollup: !0,
44
+ showSearchBar: !1
45
+ },
46
+ {
47
+ type: ee.StackBarChart,
48
+ showLabel: !1,
49
+ // TODO: temporarily removed show label as it has no function
50
+ showDrillDimension: !0,
51
+ showRollup: !0,
52
+ showSearchBar: !1
53
+ },
54
+ {
55
+ type: ee.ClusteredStackBarChart,
56
+ showLabel: !1,
57
+ // TODO: temporarily removed show label as it has no function
58
+ showDrillDimension: !0,
59
+ showRollup: !0,
60
+ showSearchBar: !1
61
+ },
62
+ {
63
+ type: ee.StackLineChart,
64
+ showLabel: !1,
65
+ // TODO: temporarily removed show label as it has no function
66
+ showDrillDimension: !0,
67
+ showRollup: !0,
68
+ showSearchBar: !1
69
+ },
70
+ {
71
+ type: ee.Scorecard,
72
+ showLabel: !1,
73
+ showDrillDimension: !1,
74
+ showRollup: !1,
75
+ showSearchBar: !1
76
+ },
77
+ {
78
+ type: ee.Spacer,
79
+ showLabel: !1,
80
+ showDrillDimension: !1,
81
+ showRollup: !1,
82
+ showSearchBar: !1
83
+ }
84
+ ];
85
+ function fn(e) {
86
+ const t = [e.schemaName, e.name];
87
+ return "option" in e && e.option && t.push(e.option), "aggregation" in e && e.aggregation && t.push(e.aggregation), t.push(e.label.replace(/[^\p{L}\p{N}_]+/gu, "")), t.join("_").toLowerCase();
88
+ }
89
+ function Zo(e, t) {
90
+ switch (e) {
91
+ case ee.BarChart:
92
+ case ee.LineChart:
93
+ case ee.StackBarChart:
94
+ case ee.ClusteredStackBarChart:
95
+ case ee.StackLineChart:
96
+ return Array.isArray(t == null ? void 0 : t.datasets) && Array.isArray(t == null ? void 0 : t.xAxis) && t.datasets.length > 0 && t.xAxis.length > 0;
97
+ case ee.Table:
98
+ return Array.isArray(t == null ? void 0 : t.rows) && Array.isArray(t == null ? void 0 : t.columns) && t.rows.length > 0 && t.columns.length > 0;
99
+ case ee.Circular:
100
+ return Array.isArray(t == null ? void 0 : t.datasets) && t.datasets.length > 0;
101
+ case ee.Scorecard:
102
+ return !0;
103
+ case ee.Spacer:
104
+ return !0;
105
+ }
106
+ }
107
+ const yt = [
108
+ "#36A2EB",
109
+ "#007BA7",
110
+ "#FF5D53",
111
+ "#73C8E6",
112
+ "#FCA23E",
113
+ "#F09BBE",
114
+ "#FFD232",
115
+ "#50BE9B",
116
+ "#8358D4",
117
+ "#9B5046"
118
+ ];
119
+ function uo(e) {
120
+ const t = Math.max(1, Math.floor(e));
121
+ return Array.from({ length: t }, (n, o) => {
122
+ const a = yt[o % yt.length], i = Math.floor(o / yt.length);
123
+ return i === 0 ? a : on(a, Math.min(0.18 * i, 0.72));
124
+ });
125
+ }
126
+ const Tl = yt.map(() => "solid");
127
+ function gt({
128
+ datasetIndex: e,
129
+ label: t
130
+ }) {
131
+ const n = typeof t == "string" ? t.trim().toLowerCase().replace(/\s+/g, " ") : "";
132
+ return `${e}:${n}`;
133
+ }
134
+ function Qo(e) {
135
+ return e === "dashed" || e === "dotted" ? e : "solid";
136
+ }
137
+ function ea(e, t = !1) {
138
+ if (e == null)
139
+ return t ? [5, 5] : void 0;
140
+ const n = Qo(e);
141
+ if (n === "dashed")
142
+ return [8, 6];
143
+ if (n === "dotted")
144
+ return [2, 4];
145
+ }
146
+ function ke({
147
+ datasetIndex: e,
148
+ isCompare: t,
149
+ metricCount: n,
150
+ mode: o
151
+ }) {
152
+ if (o !== ye.metric)
153
+ return e;
154
+ const a = Number.isFinite(n) ? Number(n) : 0;
155
+ return a <= 0 ? e : t ? e >= a ? (e - a) % a : Math.max(0, (e - 1 + a) % a) : e % a;
156
+ }
157
+ function co({
158
+ datasets: e,
159
+ datasetIndex: t
160
+ }) {
161
+ var i;
162
+ const n = e[t];
163
+ if (!(n != null && n.isCompare))
164
+ return t;
165
+ const o = [];
166
+ let a = -1;
167
+ if (e.forEach((r, c) => {
168
+ if (r != null && r.isCompare) {
169
+ c <= t && (a += 1);
170
+ return;
171
+ }
172
+ o.push(c);
173
+ }), a >= 0 && a < o.length)
174
+ return o[a];
175
+ for (let r = t - 1; r >= 0; r -= 1)
176
+ if (((i = e[r]) == null ? void 0 : i.isCompare) !== !0)
177
+ return r;
178
+ return t;
179
+ }
180
+ function $t({
181
+ datasets: e,
182
+ datasetIndex: t
183
+ }) {
184
+ var a;
185
+ const n = co({
186
+ datasets: e,
187
+ datasetIndex: t
188
+ });
189
+ let o = 0;
190
+ for (let i = 0; i < e.length; i += 1)
191
+ if (((a = e[i]) == null ? void 0 : a.isCompare) !== !0) {
192
+ if (i === n)
193
+ return o;
194
+ o += 1;
195
+ }
196
+ return n;
197
+ }
198
+ const ta = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
199
+ function Rt(e) {
200
+ if (!e)
201
+ return null;
202
+ const t = e.trim();
203
+ if (!ta.test(t))
204
+ return null;
205
+ if (t.length === 4) {
206
+ const [, n, o, a] = t;
207
+ return `#${n}${n}${o}${o}${a}${a}`.toUpperCase();
208
+ }
209
+ return t.toUpperCase();
210
+ }
211
+ function na(e) {
212
+ const t = Rt(e) ?? "#000000";
213
+ return {
214
+ red: Number.parseInt(t.slice(1, 3), 16),
215
+ green: Number.parseInt(t.slice(3, 5), 16),
216
+ blue: Number.parseInt(t.slice(5, 7), 16)
217
+ };
218
+ }
219
+ function fo(e) {
220
+ const t = Math.max(
221
+ yt.length,
222
+ Array.isArray(e) ? e.length : 0
223
+ ), n = uo(t);
224
+ return !Array.isArray(e) || e.length === 0 ? n : n.map((o, a) => Rt(e[a]) ?? o);
225
+ }
226
+ function mo(e, t) {
227
+ const { red: n, green: o, blue: a } = na(e);
228
+ return `rgba(${n}, ${o}, ${a}, ${t})`;
229
+ }
230
+ function on(e, t) {
231
+ const n = Rt(e) ?? "#000000", o = (a) => {
232
+ const i = Number.parseInt(n.slice(a, a + 2), 16);
233
+ return Math.round(i + (255 - i) * t).toString(16).padStart(2, "0").toUpperCase();
234
+ };
235
+ return `#${o(1)}${o(3)}${o(5)}`;
236
+ }
237
+ const oa = 0.25, ho = 0.7;
238
+ function po(e) {
239
+ return on(e, oa);
240
+ }
241
+ function $n(e) {
242
+ return Math.min(0.55 + (e - 1) * 0.18, 0.95);
243
+ }
244
+ function Ze({
245
+ index: e,
246
+ isCompare: t,
247
+ opacity: n,
248
+ customColors: o
249
+ }) {
250
+ const a = fo(o), i = a[e % a.length], r = t ? po(i) : i;
251
+ let c = typeof n == "number" ? n : 1;
252
+ return t && (c = c * ho), mo(r, c);
253
+ }
254
+ function Ct({
255
+ fallbackIndex: e,
256
+ metricCount: t
257
+ }) {
258
+ return Number.isInteger(t) && Number(t) > 0 ? Math.floor(e / Number(t)) : e;
259
+ }
260
+ function _t({
261
+ breakdownIndex: e,
262
+ metricIndex: t,
263
+ metricCount: n,
264
+ isCompare: o,
265
+ opacity: a,
266
+ breakdownColors: i,
267
+ useSecondaryMetricShades: r,
268
+ colorMode: c,
269
+ customColors: d
270
+ }) {
271
+ const m = Number.isInteger(n) && Number(n) > 0 ? Number(n) : 1, A = Number.isInteger(t) && Number(t) >= 0 ? Number(t) : 0, C = r !== !1, w = e * m + A, v = c === "clustered" ? uo(Math.max(yt.length, e + 1)) : fo(d), p = Rt(i == null ? void 0 : i[e * m]) ?? v[e % v.length], F = C && A > 0 ? on(p, $n(A)) : Rt(i == null ? void 0 : i[w]) ?? (A > 0 ? on(p, $n(A)) : p), k = o ? po(F) : F;
272
+ let M = typeof a == "number" ? a : 1;
273
+ return o && (M = M * ho), mo(k, M);
274
+ }
275
+ function go(e, t, n) {
276
+ if (e === "" || t === "")
277
+ return null;
278
+ let o = (d) => d == null ? void 0 : d.replace(/,/g, "");
279
+ n === "ID" && (o = (d) => d == null ? void 0 : d.replace(/\./g, "").replace(/,/g, "."));
280
+ const a = Number(o(e)), i = Number(o(t));
281
+ if (isNaN(a) || isNaN(i))
282
+ return null;
283
+ let r = 0;
284
+ i === 0 ? a === 0 ? r = 0 : r = 1 : r = (a - i) / i;
285
+ const c = aa(r);
286
+ return {
287
+ value: isNaN(r) ? "" : `${(r * 100).toFixed(0)}%`,
288
+ icon: c
289
+ };
290
+ }
291
+ function aa(e) {
292
+ return e > 0 ? {
293
+ name: "moving",
294
+ color: "#1F7735",
295
+ tailwind: "fm-color-system-success-100"
296
+ } : e < 0 ? {
297
+ name: "trending_down",
298
+ color: "#99231D",
299
+ tailwind: "fm-color-system-error-100"
300
+ } : {
301
+ name: "equal",
302
+ color: "#C7C7CC",
303
+ tailwind: "fm-color-neutral-gray-100"
304
+ };
305
+ }
306
+ function zt(e) {
307
+ return Object.entries(e).map(([t, n]) => `${t}:${n}`).join(";");
308
+ }
309
+ function vo(e) {
310
+ return {
311
+ mode: "index",
312
+ intersect: !1,
313
+ axis: e,
314
+ backgroundColor: "rgba(255, 255, 255, 0.86)",
315
+ titleColor: "#111827",
316
+ bodyColor: "#374151",
317
+ borderColor: "rgba(255, 255, 255, 0.65)",
318
+ borderWidth: 1,
319
+ cornerRadius: 10,
320
+ padding: {
321
+ top: 8,
322
+ right: 10,
323
+ bottom: 8,
324
+ left: 10
325
+ },
326
+ boxPadding: 3,
327
+ bodySpacing: 5,
328
+ caretPadding: 6,
329
+ caretSize: 5,
330
+ titleAlign: "left",
331
+ bodyAlign: "left",
332
+ multiKeyBackground: "#ffffff",
333
+ usePointStyle: !1,
334
+ titleFont: {
335
+ size: 13,
336
+ weight: 600
337
+ },
338
+ bodyFont: {
339
+ size: 12,
340
+ weight: 500
341
+ },
342
+ titleMarginBottom: 6
343
+ };
344
+ }
345
+ const ra = zt({
346
+ display: "block",
347
+ padding: "0",
348
+ background: "none",
349
+ border: "none",
350
+ color: "#2563eb",
351
+ "font-size": "12px",
352
+ "font-weight": "600",
353
+ cursor: "pointer",
354
+ "text-align": "left",
355
+ "pointer-events": "auto"
356
+ }), la = {
357
+ "font-size": "13px",
358
+ "font-weight": "600",
359
+ color: "#111827",
360
+ "text-align": "left",
361
+ "white-space": "normal",
362
+ "word-break": "break-word",
363
+ "overflow-wrap": "anywhere"
364
+ }, sa = zt({
365
+ display: "flex",
366
+ "align-items": "flex-start",
367
+ "font-size": "13px",
368
+ "font-weight": "500",
369
+ color: "#1f2937",
370
+ "text-align": "left",
371
+ "line-height": "1.35",
372
+ margin: "0 0 3px",
373
+ overflow: "hidden"
374
+ }), ia = zt({
375
+ flex: "1 1 auto",
376
+ "min-width": "0",
377
+ "white-space": "normal",
378
+ "word-break": "break-word",
379
+ "overflow-wrap": "anywhere"
380
+ }), ua = {
381
+ display: "inline-block",
382
+ width: "10px",
383
+ height: "10px",
384
+ "border-radius": "2px",
385
+ border: "1px solid rgba(17, 24, 39, 0.28)",
386
+ "box-sizing": "border-box",
387
+ "margin-right": "8px",
388
+ flex: "0 0 auto"
389
+ }, ca = {
390
+ display: "inline-block",
391
+ width: "10px",
392
+ height: "10px",
393
+ "border-radius": "9999px",
394
+ border: "1px solid rgba(255, 255, 255, 0.9)",
395
+ "box-shadow": "0 0 0 1px rgba(17, 24, 39, 0.28)",
396
+ "box-sizing": "border-box",
397
+ "margin-right": "8px",
398
+ flex: "0 0 auto"
399
+ };
400
+ function da() {
401
+ return {
402
+ ...vo(),
403
+ mode: "nearest",
404
+ intersect: !0,
405
+ usePointStyle: !0,
406
+ callbacks: {
407
+ label: (e) => {
408
+ const t = e.label || "", n = typeof e.parsed == "number" ? e.parsed : 0, a = (Array.isArray(e.dataset.data) ? e.dataset.data : []).reduce((r, c) => r + Number(c || 0), 0), i = a > 0 ? (n / a * 100).toFixed(1) : "0.0";
409
+ return `${t}: ${n.toLocaleString()} (${i}%)`;
410
+ }
411
+ }
412
+ };
413
+ }
414
+ const fa = "rgba(0, 0, 0, 0.3)";
415
+ function zn(e) {
416
+ if (typeof document > "u" || typeof window > "u")
417
+ return;
418
+ const t = String((e == null ? void 0 : e.id) ?? "");
419
+ if (!t)
420
+ return;
421
+ const n = document.querySelector(
422
+ `#comparison-tooltip-${t}`
423
+ );
424
+ n && (n.__onViewportChange && (window.removeEventListener("scroll", n.__onViewportChange, !0), window.removeEventListener("resize", n.__onViewportChange)), n.remove());
425
+ }
426
+ function mn(e, t, n, o) {
427
+ const { left: a, right: i, top: r, bottom: c } = n;
428
+ e.save(), e.beginPath(), e.lineWidth = 1, e.strokeStyle = fa, e.setLineDash([5, 5]), t ? (e.moveTo(a, o), e.lineTo(i, o)) : (e.moveTo(o, r), e.lineTo(o, c)), e.stroke(), e.restore();
429
+ }
430
+ function ma(e, t) {
431
+ if (typeof document > "u")
432
+ return;
433
+ const n = String((e == null ? void 0 : e.id) ?? "");
434
+ if (!n)
435
+ return;
436
+ const o = document.querySelector(
437
+ `#comparison-tooltip-${n}`
438
+ );
439
+ if (!o || o.style.opacity !== "1")
440
+ return;
441
+ const a = Number(t ? o.dataset.caretY : o.dataset.caretX);
442
+ return Number.isFinite(a) ? a : void 0;
443
+ }
444
+ function ha(e, t, n) {
445
+ var p;
446
+ if (!n)
447
+ return;
448
+ const o = ((p = e.options) == null ? void 0 : p.indexAxis) === "y", a = e.tooltip, i = (a == null ? void 0 : a.getActiveElements()) ?? [];
449
+ if (i.length === 0) {
450
+ const F = ma(e, o);
451
+ F !== void 0 && mn(e.ctx, o, e.chartArea, F);
452
+ return;
453
+ }
454
+ const r = e.scales.x, c = e.scales.y;
455
+ if (!r || !c)
456
+ return;
457
+ const d = i[0];
458
+ if (!d)
459
+ return;
460
+ if (t === "bar") {
461
+ const k = (o ? c : r).getPixelForValue(d.index);
462
+ mn(e.ctx, o, e.chartArea, k);
463
+ return;
464
+ }
465
+ if (!d.element)
466
+ return;
467
+ const m = d.element, A = o ? c : r, C = o ? m.y : m.x, w = A.getPixelForValue(d.index), v = C ?? w;
468
+ mn(e.ctx, o, e.chartArea, v);
469
+ }
470
+ function Ht(e) {
471
+ let t = !1, n = !1;
472
+ return {
473
+ id: "crosshair",
474
+ afterDatasetsDraw: (o) => {
475
+ ha(o, e, n);
476
+ },
477
+ afterEvent: (o, a) => {
478
+ n = a.inChartArea === !0;
479
+ },
480
+ beforeTooltipDraw: (o) => {
481
+ var i;
482
+ const a = o.ctx;
483
+ (((i = o.tooltip) == null ? void 0 : i.opacity) ?? 0) > 0 && (a.save(), a.shadowColor = "rgba(17, 24, 39, 0.14)", a.shadowBlur = 12, a.shadowOffsetX = 0, a.shadowOffsetY = 4, t = !0);
484
+ },
485
+ afterTooltipDraw: (o) => {
486
+ t && (o.ctx.restore(), t = !1);
487
+ },
488
+ beforeDestroy: (o) => {
489
+ zn(o);
490
+ },
491
+ afterDestroy: (o) => {
492
+ zn(o);
493
+ }
494
+ };
495
+ }
496
+ const pa = Number.POSITIVE_INFINITY, Sn = 2, ga = 1, va = 0.2, ya = 120, ba = 320, Ca = 24, { breakpoints: vt } = Nt(), Dn = "report-v5:locationchange";
497
+ let Hn = !1;
498
+ const xa = "report.widget.comparisonTooltip";
499
+ function Wn() {
500
+ window.dispatchEvent(new Event(Dn));
501
+ }
502
+ function wa() {
503
+ if (Hn)
504
+ return;
505
+ Hn = !0;
506
+ const e = window.history.pushState.bind(window.history), t = window.history.replaceState.bind(window.history);
507
+ window.history.pushState = function(...o) {
508
+ const a = e(...o);
509
+ return Wn(), a;
510
+ }, window.history.replaceState = function(...o) {
511
+ const a = t(...o);
512
+ return Wn(), a;
513
+ };
514
+ }
515
+ function _a(e, t) {
516
+ const n = t.split(".");
517
+ let o = e;
518
+ for (const a of n) {
519
+ if (!o || typeof o != "object" || !(a in o))
520
+ return;
521
+ o = o[a];
522
+ }
523
+ return typeof o == "string" ? o : void 0;
524
+ }
525
+ function Pn(e) {
526
+ const t = `${xa}.${e}`, n = so(), o = Qt[n];
527
+ return _a(o, t) ?? t;
528
+ }
529
+ function yo() {
530
+ return Pn("viewBreakdown");
531
+ }
532
+ function Sa() {
533
+ return Pn("current");
534
+ }
535
+ function ka() {
536
+ return Pn("compared");
537
+ }
538
+ function On(e, t) {
539
+ const n = e.trim();
540
+ return n.length === 0 ? t : `${n} · ${t}`;
541
+ }
542
+ function Ta(e) {
543
+ return e == null ? null : typeof e != "string" ? [] : e.split("#").map((t) => t.trim()).filter((t) => t.length > 0);
544
+ }
545
+ function La(e) {
546
+ return e.dash === !0 || e.isCompare === !0;
547
+ }
548
+ function Da(e) {
549
+ return typeof e.label == "string" ? e.label : "N/A";
550
+ }
551
+ function Pa(e, t) {
552
+ let n;
553
+ return Array.isArray(e.data) && t < e.data.length && (n = e.data[t]), typeof n != "number" ? NaN : n;
554
+ }
555
+ function Ia(e, t) {
556
+ return `${e}: ${isNaN(t) ? "" : t.toLocaleString()}`;
557
+ }
558
+ function Ma(e, t) {
559
+ return e.type === "bar" ? !0 : t === "bar";
560
+ }
561
+ function Ba(e, t, n) {
562
+ const o = Mt(e.borderColor, t) || Mt(e.color, t), a = Mt(e.backgroundColor, t), i = Mt(e.pointBorderColor, t), r = Mt(e.pointBackgroundColor, t);
563
+ return n ? Un(a, r, o, i) : Un(o, i, a, r);
564
+ }
565
+ function Aa(e) {
566
+ return e.trim().toLowerCase();
567
+ }
568
+ function Mt(e, t) {
569
+ if (typeof e == "string") return e;
570
+ if (Array.isArray(e)) {
571
+ const n = e[t];
572
+ return typeof n == "string" ? n : void 0;
573
+ }
574
+ }
575
+ function Fa(e) {
576
+ if (typeof e != "string") return "#9ca3af";
577
+ const t = e.trim();
578
+ return /^[-#(),.%\sa-zA-Z0-9]+$/.test(t) ? t : "#9ca3af";
579
+ }
580
+ function Ra(e) {
581
+ const t = e.replace(/\s+/g, "").toLowerCase();
582
+ return !!(t === "transparent" || /^rgba\([^)]*,0(?:\.0+)?\)$/.test(t) || /^hsla\([^)]*,0(?:\.0+)?\)$/.test(t) || t === "#0000" || t === "#00000000");
583
+ }
584
+ function Un(...e) {
585
+ for (const t of e) {
586
+ if (!t) continue;
587
+ const n = Fa(t);
588
+ if (!Ra(n))
589
+ return n;
590
+ }
591
+ return "#9ca3af";
592
+ }
593
+ function kn(e) {
594
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\"/g, "&quot;").replace(/'/g, "&#39;");
595
+ }
596
+ function Va(e) {
597
+ const t = typeof e == "number" ? e : typeof e == "string" ? Number(e) : Number.NaN;
598
+ return Number.isFinite(t) ? Math.max(Sn, Math.floor(t)) : pa;
599
+ }
600
+ function Na(e) {
601
+ return e <= 0 ? 320 : vt.value.xs || vt.value.sm || e <= 640 ? Math.max(160, Math.floor(e * 0.38)) : vt.value.md || e <= 900 ? Math.max(200, Math.floor(e * 0.46)) : vt.value.lg || e <= 1200 ? Math.max(240, Math.floor(e * 0.54)) : Math.max(280, Math.floor(e * 0.62));
602
+ }
603
+ function In(e, t) {
604
+ const n = window.innerHeight, o = Na(n), a = t ? Math.max(120, t.clientHeight - 16) : Number.POSITIVE_INFINITY, i = Math.max(120, Math.min(o, a));
605
+ e.style.maxHeight = `${i}px`;
606
+ }
607
+ function st() {
608
+ return vt.value.xs || vt.value.sm;
609
+ }
610
+ function bt(e) {
611
+ return e.dataset.pinned === "true";
612
+ }
613
+ function bo(e, t) {
614
+ if (t) {
615
+ e.dataset.pinned = "true";
616
+ return;
617
+ }
618
+ delete e.dataset.pinned;
619
+ }
620
+ function Co(e) {
621
+ return {
622
+ maxTooltipItems: Va(e == null ? void 0 : e.maxTooltipItems)
623
+ };
624
+ }
625
+ function $a(e) {
626
+ e.__lastPhoneTapAt = void 0, e.__lastPhoneTapX = void 0, e.__lastPhoneTapY = void 0, e.__lastPhoneTapDatasetIndex = void 0, e.__lastPhoneTapDataIndex = void 0;
627
+ }
628
+ function za(e, t, n, o, a, i) {
629
+ e.__lastPhoneTapAt = o, e.__lastPhoneTapX = t, e.__lastPhoneTapY = n, e.__lastPhoneTapDatasetIndex = a, e.__lastPhoneTapDataIndex = i;
630
+ }
631
+ function Ha(e, t, n) {
632
+ return e.__lastPhoneTapDatasetIndex === t && e.__lastPhoneTapDataIndex === n;
633
+ }
634
+ function Wa(e, t, n, o) {
635
+ if (!Number.isFinite(e.__lastPhoneTapAt) || !Number.isFinite(e.__lastPhoneTapX) || !Number.isFinite(e.__lastPhoneTapY))
636
+ return !1;
637
+ const a = o - e.__lastPhoneTapAt;
638
+ if (a < 0 || a > ba)
639
+ return !1;
640
+ const i = t - e.__lastPhoneTapX, r = n - e.__lastPhoneTapY;
641
+ return Math.hypot(i, r) <= Ca;
642
+ }
643
+ function Kn(e) {
644
+ return {
645
+ text: `${e.datasetLabel}: ${0 .toLocaleString()}`,
646
+ color: "#cbd5e1",
647
+ isBar: e.isBar,
648
+ value: "-",
649
+ datasetLabel: e.datasetLabel,
650
+ matchingKey: e.matchingKey
651
+ };
652
+ }
653
+ function Oa(e) {
654
+ return zt({
655
+ ...la,
656
+ margin: `${e ? "8px" : "0"} 0 4px`
657
+ });
658
+ }
659
+ function Ua(e, t) {
660
+ return zt({
661
+ ...e ? ua : ca,
662
+ background: t
663
+ });
664
+ }
665
+ function Ka(e) {
666
+ return `<button type="button" data-tooltip-full-details="true" style="${ra}">${kn(e)}</button>`;
667
+ }
668
+ function xo(e, t, n, o, a, i, r, c) {
669
+ var N;
670
+ const d = (N = e[0]) == null ? void 0 : N.label, m = Ta(d), C = !!(m != null && m[1]) ? On((m == null ? void 0 : m[0]) ?? "", Sa()) : (m == null ? void 0 : m[0]) ?? "", w = m != null && m[1] ? On(m[1], ka()) : void 0, v = [], p = [], F = /* @__PURE__ */ new Set();
671
+ i.forEach((V, K) => {
672
+ if (F.has(K))
673
+ return;
674
+ const Z = V ?? {};
675
+ if (Z.isSpacer === !0)
676
+ return;
677
+ const X = Da(Z), O = Pa(Z, r), T = Ma(Z, c), u = {
678
+ text: Ia(X, O),
679
+ color: Ba(Z, r, T),
680
+ isBar: T,
681
+ value: O,
682
+ datasetLabel: X,
683
+ matchingKey: Aa(X)
684
+ };
685
+ if (w && La(Z)) {
686
+ p.push(u);
687
+ return;
688
+ }
689
+ v.push(u);
690
+ });
691
+ const k = v.slice(0, o), M = /* @__PURE__ */ new Map();
692
+ p.forEach((V) => {
693
+ const K = M.get(V.matchingKey);
694
+ if (!K) {
695
+ M.set(V.matchingKey, [V]);
696
+ return;
697
+ }
698
+ K.push(V);
699
+ });
700
+ const z = w ? k.map((V) => {
701
+ const K = M.get(V.matchingKey);
702
+ return !K || K.length === 0 ? Kn(V) : K.shift() ?? Kn(V);
703
+ }) : [], q = v.length > k.length || p.length > z.length, I = (V, K = !1) => `<div style="${Oa(K)}">${kn(V)}</div>`, H = (V) => {
704
+ const K = Ua(V.isBar, V.color);
705
+ return `<div style="${sa}"><span style="${K}"></span><span style="${ia}">${kn(V.text)}</span></div>`;
706
+ };
707
+ let x = "";
708
+ C.length > 0 && (x += I(C)), x += k.map((V) => H(V)).join(""), w && z.length > 0 && (x += I(w, x.length > 0), x += z.map((V) => H(V)).join("")), a && q && (x += Ka(n));
709
+ const B = [
710
+ {
711
+ title: C,
712
+ values: v
713
+ },
714
+ {
715
+ title: w ?? "",
716
+ values: p
717
+ }
718
+ ].filter((V) => V.values.length > 0);
719
+ return {
720
+ html: x,
721
+ detailsPayload: { sections: B },
722
+ hasCollapsedValues: q
723
+ };
724
+ }
725
+ function Xn(e) {
726
+ return e.scrollHeight - e.clientHeight > ga;
727
+ }
728
+ function Gt(e, t, n, o, a, i, r, c, d) {
729
+ const m = xo(
730
+ t,
731
+ n,
732
+ o,
733
+ a,
734
+ i,
735
+ r,
736
+ c,
737
+ d
738
+ );
739
+ return e.innerHTML !== m.html && (e.innerHTML = m.html, ar(e)), m;
740
+ }
741
+ function Xa(e, t, n, o, a, i, r, c, d) {
742
+ if (Number.isFinite(a))
743
+ return {
744
+ markup: Gt(
745
+ e,
746
+ t,
747
+ n,
748
+ o,
749
+ a,
750
+ i,
751
+ r,
752
+ c,
753
+ d
754
+ ),
755
+ maxTooltipItems: a
756
+ };
757
+ const m = Math.max(Sn, t.length);
758
+ let A = m, C = Gt(
759
+ e,
760
+ t,
761
+ n,
762
+ o,
763
+ m,
764
+ i,
765
+ r,
766
+ c,
767
+ d
768
+ );
769
+ if (!Xn(e))
770
+ return {
771
+ markup: C,
772
+ maxTooltipItems: m
773
+ };
774
+ let w = Sn, v = m;
775
+ for (; w <= v; ) {
776
+ const F = Math.floor((w + v) / 2), k = Gt(
777
+ e,
778
+ t,
779
+ n,
780
+ o,
781
+ F,
782
+ i,
783
+ r,
784
+ c,
785
+ d
786
+ );
787
+ if (Xn(e)) {
788
+ v = F - 1;
789
+ continue;
790
+ }
791
+ A = F, C = k, w = F + 1;
792
+ }
793
+ return {
794
+ markup: A === m ? C : Gt(
795
+ e,
796
+ t,
797
+ n,
798
+ o,
799
+ A,
800
+ i,
801
+ r,
802
+ c,
803
+ d
804
+ ),
805
+ maxTooltipItems: A
806
+ };
807
+ }
808
+ function Yn(e, t) {
809
+ const n = Math.max(0, Math.min(1, t)), o = e.trim();
810
+ if (o.startsWith("#")) {
811
+ const r = o.slice(1), c = r.length === 3 ? `${r[0]}${r[0]}${r[1]}${r[1]}${r[2]}${r[2]}` : r.length === 4 ? `${r[0]}${r[0]}${r[1]}${r[1]}${r[2]}${r[2]}` : r.length >= 6 ? r.slice(0, 6) : "";
812
+ if (/^[0-9a-fA-F]{6}$/.test(c)) {
813
+ const d = Number.parseInt(c.slice(0, 2), 16), m = Number.parseInt(c.slice(2, 4), 16), A = Number.parseInt(c.slice(4, 6), 16);
814
+ return `rgba(${d}, ${m}, ${A}, ${n})`;
815
+ }
816
+ }
817
+ const a = o.match(/^rgba?\(([^)]+)\)$/i);
818
+ if (a) {
819
+ const r = a[1].split(",").map((c) => c.trim());
820
+ if (r.length >= 3) {
821
+ const [c, d, m] = r;
822
+ return `rgba(${c}, ${d}, ${m}, ${n})`;
823
+ }
824
+ }
825
+ const i = o.match(/^hsla?\(([^)]+)\)$/i);
826
+ if (i) {
827
+ const r = i[1].split(",").map((c) => c.trim());
828
+ if (r.length >= 3) {
829
+ const [c, d, m] = r;
830
+ return `hsla(${c}, ${d}, ${m}, ${n})`;
831
+ }
832
+ }
833
+ return e;
834
+ }
835
+ function jt(e, t) {
836
+ return typeof e == "string" ? Yn(e, t) : Array.isArray(e) ? e.map(
837
+ (n) => typeof n == "string" ? Yn(n, t) : n
838
+ ) : e;
839
+ }
840
+ function Ya(e) {
841
+ e.__tooltipOriginalStyle || (e.__tooltipOriginalStyle = {
842
+ borderColor: Reflect.get(e, "borderColor"),
843
+ backgroundColor: Reflect.get(e, "backgroundColor"),
844
+ pointBorderColor: Reflect.get(e, "pointBorderColor"),
845
+ pointBackgroundColor: Reflect.get(e, "pointBackgroundColor")
846
+ });
847
+ }
848
+ function Ea(e) {
849
+ const t = e.__tooltipOriginalStyle;
850
+ t && (Reflect.set(e, "borderColor", t.borderColor), Reflect.set(e, "backgroundColor", t.backgroundColor), Reflect.set(e, "pointBorderColor", t.pointBorderColor), Reflect.set(e, "pointBackgroundColor", t.pointBackgroundColor));
851
+ }
852
+ function qa(e, t) {
853
+ const n = e.__tooltipOriginalStyle;
854
+ n && (Reflect.set(e, "borderColor", jt(n.borderColor, t)), Reflect.set(e, "backgroundColor", jt(n.backgroundColor, t)), Reflect.set(e, "pointBorderColor", jt(n.pointBorderColor, t)), Reflect.set(
855
+ e,
856
+ "pointBackgroundColor",
857
+ jt(n.pointBackgroundColor, t)
858
+ ));
859
+ }
860
+ function Tn(e) {
861
+ var o;
862
+ if (!e || typeof e != "object")
863
+ return !1;
864
+ const t = e;
865
+ if (t.destroyed === !0 || typeof t.update != "function" || !Array.isArray((o = t.data) == null ? void 0 : o.datasets))
866
+ return !1;
867
+ const n = t.canvas;
868
+ return !(n != null && (!n.isConnected || !n.ownerDocument));
869
+ }
870
+ function en(e, t) {
871
+ if (!Tn(e))
872
+ return;
873
+ const n = e.data.datasets;
874
+ if (n.length !== 0) {
875
+ if (n.forEach((o, a) => {
876
+ Ya(o), !t || a === t.datasetIndex ? Ea(o) : qa(o, va);
877
+ }), typeof e.setActiveElements == "function")
878
+ try {
879
+ t ? e.setActiveElements([
880
+ {
881
+ datasetIndex: t.datasetIndex,
882
+ index: t.dataIndex
883
+ }
884
+ ]) : e.setActiveElements([]);
885
+ } catch {
886
+ return;
887
+ }
888
+ try {
889
+ e.update("none");
890
+ } catch {
891
+ return;
892
+ }
893
+ }
894
+ }
895
+ function wo(e) {
896
+ const t = e, n = t == null ? void 0 : t.chart;
897
+ if (Tn(n))
898
+ return n;
899
+ const o = t == null ? void 0 : t.$el;
900
+ if (!o)
901
+ return null;
902
+ const a = o.querySelector("canvas");
903
+ if (!(a instanceof HTMLCanvasElement))
904
+ return null;
905
+ const i = vn.getChart(a);
906
+ return Tn(i) ? i : null;
907
+ }
908
+ function Ga(e) {
909
+ const t = window.getComputedStyle(e);
910
+ return [t.overflow, t.overflowX, t.overflowY].some((o) => o !== "visible");
911
+ }
912
+ function Mn(e) {
913
+ let t = e.parentElement ?? e, n = t;
914
+ for (; n && n.parentElement && n.parentElement !== document.body && n.parentElement !== document.documentElement; )
915
+ Ga(n) && (t = n.parentElement), n = n.parentElement;
916
+ return window.getComputedStyle(t).position === "static" && (t.style.position = "relative"), t;
917
+ }
918
+ function Bn(e, t, n, o, a, i, r = "center", c = !1) {
919
+ const d = t.getBoundingClientRect(), m = n.getBoundingClientRect(), A = n.scrollLeft, C = n.scrollTop, w = n.clientWidth, v = n.clientHeight, p = e;
920
+ (!Number.isFinite(p.__cachedWidth) || !Number.isFinite(p.__cachedHeight) || p.__measurementHostWidth !== w || p.__measurementHostHeight !== v) && (p.__cachedWidth = e.offsetWidth, p.__cachedHeight = e.offsetHeight, p.__measurementHostWidth = w, p.__measurementHostHeight = v);
921
+ const k = p.__cachedWidth ?? e.offsetWidth, M = p.__cachedHeight ?? e.offsetHeight, z = 8, q = d.left - m.left + A + o, I = d.top - m.top + C + a, H = c ? r === "left" ? q - k - z : q + z : r === "left" ? q - k - z : r === "right" ? q + z : q - k / 2, x = c ? I + z : i ? I - M / 2 : I + z, B = A + z;
922
+ let N = C + z;
923
+ const V = document.querySelector('[data-menu-tab="true"]');
924
+ if (V) {
925
+ const u = V.getBoundingClientRect().bottom - m.top + C + z;
926
+ N = Math.max(N, u);
927
+ }
928
+ const K = Math.max(B, A + w - k - z), Z = Math.max(N, C + v - M - z), X = Math.round(Math.min(Math.max(B, H), K)), O = Math.round(Math.min(Math.max(N, x), Z));
929
+ p.__lastLeftPx === X && p.__lastTopPx === O || (p.__lastLeftPx = X, p.__lastTopPx = O, e.style.left = `${X}px`, e.style.top = `${O}px`);
930
+ }
931
+ function _o(e) {
932
+ return e.dataset.anchorDirection === "left" ? "left" : e.dataset.anchorDirection === "right" ? "right" : "center";
933
+ }
934
+ function ja(e, t, n, o, a, i, r) {
935
+ const c = t.getBoundingClientRect(), d = o - c.left, m = a - c.top;
936
+ !Number.isFinite(d) || !Number.isFinite(m) || (e.dataset.cursorCanvasX = String(d), e.dataset.cursorCanvasY = String(m), e.dataset.caretX = String(d), e.dataset.caretY = String(m), e.dataset.anchorDirection = r, Bn(
937
+ e,
938
+ t,
939
+ n,
940
+ d,
941
+ m,
942
+ i,
943
+ r,
944
+ !0
945
+ ));
946
+ }
947
+ function Ja(e) {
948
+ const t = document.createElement("div");
949
+ return t.id = e, t.dataset.comparisonTooltip = "true", t.style.background = "linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.86))", t.style.border = "1px solid rgba(255, 255, 255, 0.58)", t.style.borderRadius = "10px", t.style.boxShadow = "0 8px 24px rgba(15, 23, 42, 0.18)", t.style.color = "#111827", t.style.left = "0", t.style.opacity = "0", In(t), t.style.maxWidth = "min(360px, calc(100% - 16px))", t.style.overflow = "hidden", t.style.padding = "8px 10px", t.style.pointerEvents = "none", t.style.position = "absolute", t.style.textAlign = "left", t.style.top = "0", t.style.transform = "none", t.style.willChange = "left, top", t.style.whiteSpace = "normal", t.style.wordBreak = "normal", t.style.overflowWrap = "normal", t.style.zIndex = "10", t;
950
+ }
951
+ function Za(e) {
952
+ e.__onViewportChange && (window.removeEventListener("scroll", e.__onViewportChange, !0), window.removeEventListener("resize", e.__onViewportChange));
953
+ }
954
+ function Qa(e) {
955
+ e.__onNavigationChange && (window.removeEventListener(Dn, e.__onNavigationChange), window.removeEventListener("popstate", e.__onNavigationChange), window.removeEventListener("hashchange", e.__onNavigationChange), window.removeEventListener("beforeunload", e.__onNavigationChange));
956
+ }
957
+ function er(e) {
958
+ e.__disconnectObserver && (e.__disconnectObserver.disconnect(), e.__disconnectObserver = void 0);
959
+ }
960
+ function An(e, t) {
961
+ xt(e), So(e), Za(e), Qa(e), er(e), e.__onDetailsClick && e.removeEventListener("click", e.__onDetailsClick), e.__onTooltipPointerEnter && e.removeEventListener("pointerenter", e.__onTooltipPointerEnter), e.__onTooltipPointerLeave && e.removeEventListener("pointerleave", e.__onTooltipPointerLeave), t && e.__onCanvasPointerEnter && t.removeEventListener("pointerenter", e.__onCanvasPointerEnter), t && e.__onCanvasPointerMove && t.removeEventListener("pointermove", e.__onCanvasPointerMove), t && e.__onCanvasPointerLeave && t.removeEventListener("pointerleave", e.__onCanvasPointerLeave), t && e.__onCanvasClick && t.removeEventListener("click", e.__onCanvasClick), t && e.__onCanvasPointerUp && t.removeEventListener("pointerup", e.__onCanvasPointerUp), e.remove();
962
+ }
963
+ function tr(e, t, n) {
964
+ e.__onNavigationChange || (wa(), e.__onNavigationChange = () => {
965
+ if (!n.isConnected) {
966
+ An(e, n);
967
+ return;
968
+ }
969
+ Re(e, t, !0);
970
+ }, window.addEventListener(Dn, e.__onNavigationChange), window.addEventListener("popstate", e.__onNavigationChange), window.addEventListener("hashchange", e.__onNavigationChange), window.addEventListener("beforeunload", e.__onNavigationChange));
971
+ }
972
+ function nr(e, t) {
973
+ e.__disconnectObserver || document.body && (e.__disconnectObserver = new MutationObserver(() => {
974
+ t.isConnected || An(e, t);
975
+ }), e.__disconnectObserver.observe(document.body, {
976
+ childList: !0,
977
+ subtree: !0
978
+ }));
979
+ }
980
+ function or(e, t, n) {
981
+ Array.from(
982
+ e.querySelectorAll('[data-comparison-tooltip="true"]')
983
+ ).forEach((a) => {
984
+ a.id !== t && An(a, n);
985
+ });
986
+ }
987
+ function xt(e) {
988
+ typeof e.__hideTimeoutId == "number" && (window.clearTimeout(e.__hideTimeoutId), e.__hideTimeoutId = void 0);
989
+ }
990
+ function So(e) {
991
+ typeof e.__cursorRafId == "number" && (window.cancelAnimationFrame(e.__cursorRafId), e.__cursorRafId = void 0);
992
+ }
993
+ function ar(e) {
994
+ e.__cachedWidth = void 0, e.__cachedHeight = void 0, e.__measurementHostWidth = void 0, e.__measurementHostHeight = void 0;
995
+ }
996
+ function En(e, t, n, o, a) {
997
+ e.__pendingCursorClientX = o, e.__pendingCursorClientY = a, typeof e.__cursorRafId != "number" && (e.__cursorRafId = window.requestAnimationFrame(() => {
998
+ e.__cursorRafId = void 0;
999
+ const i = e.__pendingCursorClientX, r = e.__pendingCursorClientY;
1000
+ if (e.__pendingCursorClientX = void 0, e.__pendingCursorClientY = void 0, !Number.isFinite(i) || !Number.isFinite(r))
1001
+ return;
1002
+ const c = Mn(t);
1003
+ e.parentElement !== c && c.appendChild(e), ja(
1004
+ e,
1005
+ t,
1006
+ c,
1007
+ i,
1008
+ r,
1009
+ n,
1010
+ _o(e)
1011
+ );
1012
+ }));
1013
+ }
1014
+ function Re(e, t, n = !1) {
1015
+ bt(e) && !n || (xt(e), So(e), bo(e, !1), $a(e), e.__pendingCursorClientX = void 0, e.__pendingCursorClientY = void 0, e.__detailsPayload = void 0, e.__lastLeftPx = void 0, e.__lastTopPx = void 0, delete e.dataset.cursorCanvasX, delete e.dataset.cursorCanvasY, e.__isTooltipHovered = !1, e.style.pointerEvents = "none", e.style.opacity = "0", en(t));
1016
+ }
1017
+ function qn(e, t, n = ya) {
1018
+ e.__isTooltipHovered || (xt(e), e.__hideTimeoutId = window.setTimeout(() => {
1019
+ e.__isTooltipHovered || Re(e, t);
1020
+ }, n));
1021
+ }
1022
+ function rr(e, t, n, o, a) {
1023
+ const { maxTooltipItems: i } = Co(a);
1024
+ e.__onCanvasPointerEnter || (e.__onCanvasPointerEnter = (r) => {
1025
+ if (!(st() && bt(e)) && (En(
1026
+ e,
1027
+ t,
1028
+ o,
1029
+ r.clientX,
1030
+ r.clientY
1031
+ ), typeof (n == null ? void 0 : n.update) == "function"))
1032
+ try {
1033
+ n.update("none");
1034
+ } catch {
1035
+ return;
1036
+ }
1037
+ }, t.addEventListener("pointerenter", e.__onCanvasPointerEnter, {
1038
+ passive: !0
1039
+ })), e.__onCanvasPointerMove || (e.__onCanvasPointerMove = (r) => {
1040
+ st() && bt(e) || En(
1041
+ e,
1042
+ t,
1043
+ o,
1044
+ r.clientX,
1045
+ r.clientY
1046
+ );
1047
+ }, t.addEventListener("pointermove", e.__onCanvasPointerMove, {
1048
+ passive: !0
1049
+ })), e.__onCanvasPointerLeave || (e.__onCanvasPointerLeave = () => {
1050
+ st() && bt(e) || Re(e, n);
1051
+ }, t.addEventListener("pointerleave", e.__onCanvasPointerLeave, {
1052
+ passive: !0
1053
+ })), e.__onCanvasClick || (e.__onCanvasClick = (r) => {
1054
+ var k, M;
1055
+ if (st() || !(a != null && a.onViewFullDetails) || !e.__detailsPayload || e.style.opacity !== "1")
1056
+ return;
1057
+ const c = (z) => {
1058
+ var B, N, V, K;
1059
+ if (z.length === 0)
1060
+ return !1;
1061
+ const q = (B = z.find(
1062
+ (Z) => typeof Z.dataIndex == "number"
1063
+ )) == null ? void 0 : B.dataIndex, I = ((N = n == null ? void 0 : n.data) == null ? void 0 : N.datasets) ?? [], H = (V = n == null ? void 0 : n.config) == null ? void 0 : V.type, x = xo(
1064
+ z,
1065
+ o,
1066
+ (a == null ? void 0 : a.viewFullDetailsLabel) ?? yo(),
1067
+ i,
1068
+ !0,
1069
+ I,
1070
+ q,
1071
+ H
1072
+ ).detailsPayload;
1073
+ return (K = a.onViewFullDetails) == null || K.call(a, x, n), Re(e, n), !0;
1074
+ }, d = ((k = n == null ? void 0 : n.tooltip) == null ? void 0 : k.dataPoints) ?? [];
1075
+ if (c(d))
1076
+ return;
1077
+ const m = n == null ? void 0 : n.getElementsAtEventForMode;
1078
+ if (typeof m != "function")
1079
+ return;
1080
+ const A = m.call(
1081
+ n,
1082
+ r,
1083
+ "nearest",
1084
+ { intersect: !0 },
1085
+ !1
1086
+ ), C = m.call(
1087
+ n,
1088
+ r,
1089
+ "index",
1090
+ { intersect: !1 },
1091
+ !1
1092
+ ), v = (A.length > 0 ? A : C).filter((z) => typeof z.datasetIndex == "number" && typeof z.index == "number").map((z) => ({ datasetIndex: z.datasetIndex, index: z.index }));
1093
+ if (v.length === 0)
1094
+ return;
1095
+ const p = n == null ? void 0 : n.tooltip;
1096
+ if (typeof (p == null ? void 0 : p.setActiveElements) != "function")
1097
+ return;
1098
+ p.setActiveElements(v, {
1099
+ x: r.offsetX,
1100
+ y: r.offsetY
1101
+ });
1102
+ try {
1103
+ n.update("none");
1104
+ } catch {
1105
+ return;
1106
+ }
1107
+ const F = ((M = n == null ? void 0 : n.tooltip) == null ? void 0 : M.dataPoints) ?? [];
1108
+ c(F);
1109
+ }, t.addEventListener("click", e.__onCanvasClick)), e.__onCanvasPointerUp || (e.__onCanvasPointerUp = (r) => {
1110
+ if (st()) {
1111
+ const c = n == null ? void 0 : n.getElementsAtEventForMode, d = n == null ? void 0 : n.tooltip;
1112
+ if (typeof c != "function" || typeof (d == null ? void 0 : d.setActiveElements) != "function")
1113
+ return;
1114
+ const m = c.call(
1115
+ n,
1116
+ r,
1117
+ "nearest",
1118
+ { intersect: !0 },
1119
+ !1
1120
+ ), A = c.call(
1121
+ n,
1122
+ r,
1123
+ "index",
1124
+ { intersect: !1 },
1125
+ !1
1126
+ ), w = (m.length > 0 ? m : A).filter((M) => typeof M.datasetIndex == "number" && typeof M.index == "number").map((M) => ({
1127
+ datasetIndex: M.datasetIndex,
1128
+ index: M.index
1129
+ }));
1130
+ if (w.length === 0) {
1131
+ Re(e, n, !0);
1132
+ return;
1133
+ }
1134
+ const v = w[0], p = Ha(
1135
+ e,
1136
+ v.datasetIndex,
1137
+ v.index
1138
+ ), F = Number.isFinite(e.__lastPhoneTapAt), k = p && Wa(e, r.offsetX, r.offsetY, r.timeStamp);
1139
+ if (F && !k && p) {
1140
+ Re(e, n, !0);
1141
+ return;
1142
+ }
1143
+ bo(e, !0), xt(e), e.dataset.cursorCanvasX = String(r.offsetX), e.dataset.cursorCanvasY = String(r.offsetY), e.dataset.caretX = String(r.offsetX), e.dataset.caretY = String(r.offsetY), d.setActiveElements(w, {
1144
+ x: r.offsetX,
1145
+ y: r.offsetY
1146
+ });
1147
+ try {
1148
+ n.update("none");
1149
+ } catch {
1150
+ return;
1151
+ }
1152
+ if (k && (a != null && a.onViewFullDetails) && e.__detailsPayload) {
1153
+ a.onViewFullDetails(e.__detailsPayload, n), Re(e, n);
1154
+ return;
1155
+ }
1156
+ za(
1157
+ e,
1158
+ r.offsetX,
1159
+ r.offsetY,
1160
+ r.timeStamp,
1161
+ v.datasetIndex,
1162
+ v.index
1163
+ );
1164
+ return;
1165
+ }
1166
+ e.__onCanvasClick && e.__onCanvasClick(r);
1167
+ }, t.addEventListener("pointerup", e.__onCanvasPointerUp)), a != null && a.onViewFullDetails && (e.__onDetailsClick || (e.__onDetailsClick = (r) => {
1168
+ var m;
1169
+ const c = r.target;
1170
+ c != null && c.closest('[data-tooltip-full-details="true"]') && (r.preventDefault(), r.stopPropagation(), e.__detailsPayload && ((m = a.onViewFullDetails) == null || m.call(a, e.__detailsPayload, n), Re(e, n)));
1171
+ }, e.addEventListener("click", e.__onDetailsClick)), e.__onTooltipPointerEnter || (e.__onTooltipPointerEnter = () => {
1172
+ e.__isTooltipHovered = !0, xt(e);
1173
+ }, e.addEventListener("pointerenter", e.__onTooltipPointerEnter)), e.__onTooltipPointerLeave || (e.__onTooltipPointerLeave = () => {
1174
+ e.__isTooltipHovered = !1, Re(e, n);
1175
+ }, e.addEventListener("pointerleave", e.__onTooltipPointerLeave)));
1176
+ }
1177
+ function lr(e, t, n) {
1178
+ e.__onViewportChange || (e.__onViewportChange = () => {
1179
+ if (e.style.opacity !== "1")
1180
+ return;
1181
+ const o = Number(e.dataset.caretX), a = Number(e.dataset.caretY), i = _o(e);
1182
+ if (!Number.isFinite(o) || !Number.isFinite(a)) {
1183
+ e.style.opacity = "0";
1184
+ return;
1185
+ }
1186
+ const r = Mn(t);
1187
+ e.parentElement !== r && r.appendChild(e), In(e, r), Bn(
1188
+ e,
1189
+ t,
1190
+ r,
1191
+ o,
1192
+ a,
1193
+ n,
1194
+ i,
1195
+ !0
1196
+ );
1197
+ }, window.addEventListener("scroll", e.__onViewportChange, {
1198
+ capture: !0,
1199
+ passive: !0
1200
+ }), window.addEventListener("resize", e.__onViewportChange, {
1201
+ passive: !0
1202
+ }));
1203
+ }
1204
+ function sr(e, t) {
1205
+ const { maxTooltipItems: n } = Co(t);
1206
+ return ({ chart: o, tooltip: a }) => {
1207
+ var X, O, T, u;
1208
+ if (typeof document > "u" || typeof window > "u")
1209
+ return;
1210
+ const i = o == null ? void 0 : o.canvas;
1211
+ if (!(i instanceof HTMLCanvasElement))
1212
+ return;
1213
+ const r = Mn(i), c = `comparison-tooltip-${String(o.id)}`;
1214
+ let d = document.querySelector(`#${c}`);
1215
+ if (d || (d = Ja(c)), d.parentElement !== r && r.appendChild(d), In(d, r), lr(d, i, e), tr(d, o, i), nr(d, i), rr(d, i, o, e, t), ((a == null ? void 0 : a.opacity) ?? 0) === 0) {
1216
+ if (st() && bt(d))
1217
+ return;
1218
+ t != null && t.onViewFullDetails ? qn(d, o) : Re(d, o);
1219
+ return;
1220
+ }
1221
+ const m = (a == null ? void 0 : a.dataPoints) ?? [];
1222
+ if (m.length === 0) {
1223
+ if (st() && bt(d))
1224
+ return;
1225
+ t != null && t.onViewFullDetails ? qn(d, o) : Re(d, o);
1226
+ return;
1227
+ }
1228
+ or(r, c, i), xt(d);
1229
+ const A = (t == null ? void 0 : t.viewFullDetailsLabel) ?? yo(), C = !!(t != null && t.onViewFullDetails), w = (X = m.find((y) => typeof y.dataIndex == "number")) == null ? void 0 : X.dataIndex, v = ((O = o == null ? void 0 : o.data) == null ? void 0 : O.datasets) ?? [], p = (T = o == null ? void 0 : o.config) == null ? void 0 : T.type, {
1230
+ markup: { detailsPayload: F, hasCollapsedValues: k }
1231
+ } = Xa(
1232
+ d,
1233
+ m,
1234
+ e,
1235
+ A,
1236
+ n,
1237
+ C,
1238
+ v,
1239
+ w,
1240
+ p
1241
+ ), M = C && k;
1242
+ d.__detailsPayload = M ? F : void 0, d.style.pointerEvents = M ? "auto" : "none";
1243
+ const z = typeof (a == null ? void 0 : a.caretX) == "number" ? a.caretX : 0, q = Number(d.dataset.cursorCanvasX), I = Number(d.dataset.cursorCanvasY);
1244
+ if (!(Number.isFinite(q) && Number.isFinite(I))) {
1245
+ d.style.opacity = "0";
1246
+ return;
1247
+ }
1248
+ const x = (u = o == null ? void 0 : o.scales) == null ? void 0 : u.x, B = x && typeof x.getPixelForValue == "function" ? x.getPixelForValue(0) : NaN, N = e ? m.reduce((y, P) => {
1249
+ const W = P == null ? void 0 : P.element, $ = W == null ? void 0 : W.x;
1250
+ if (typeof $ != "number" || !Number.isFinite($))
1251
+ return y;
1252
+ if (!Number.isFinite(y))
1253
+ return $;
1254
+ const S = Number.isFinite(B) ? B : z, G = Math.abs(y - S);
1255
+ return Math.abs($ - S) > G ? $ : y;
1256
+ }, Number.NaN) : Number.NaN, V = q, K = I, Z = e ? Number.isFinite(B) && Number.isFinite(N) && N < B ? "left" : "right" : "center";
1257
+ Bn(
1258
+ d,
1259
+ i,
1260
+ r,
1261
+ V,
1262
+ K,
1263
+ e,
1264
+ Z,
1265
+ !0
1266
+ ), d.dataset.caretX = String(V), d.dataset.caretY = String(K), d.dataset.anchorDirection = Z, d.style.opacity = "1";
1267
+ };
1268
+ }
1269
+ function ko(e = !1, t) {
1270
+ return {
1271
+ ...vo(e ? "y" : "x"),
1272
+ enabled: !1,
1273
+ external: sr(e, t)
1274
+ };
1275
+ }
1276
+ const Gn = "en-US";
1277
+ function jn(e, t) {
1278
+ const n = t.split(".");
1279
+ let o = e;
1280
+ for (const a of n) {
1281
+ if (!o || typeof o != "object" || !(a in o))
1282
+ return;
1283
+ o = o[a];
1284
+ }
1285
+ return typeof o == "string" ? o : void 0;
1286
+ }
1287
+ function ir() {
1288
+ const e = so(), t = "report.widget.legend.comparison";
1289
+ return `(${jn(Qt[e] ?? Qt[Gn], t) ?? jn(Qt[Gn], t) ?? "Comparison"})`;
1290
+ }
1291
+ function To(e) {
1292
+ function o(C, w, v) {
1293
+ if (C.measureText(w).width <= v) return w;
1294
+ const p = "…";
1295
+ let F = 0, k = w.length;
1296
+ for (; F < k; ) {
1297
+ const M = Math.floor((F + k) / 2), z = w.slice(0, M) + p;
1298
+ C.measureText(z).width <= v ? F = M + 1 : k = M;
1299
+ }
1300
+ return w.slice(0, F - 1) + p;
1301
+ }
1302
+ function a(C) {
1303
+ const w = C == null ? "" : String(C), [v] = w.split("#");
1304
+ return (v ?? w).trim();
1305
+ }
1306
+ function i(C, w) {
1307
+ const v = C == null ? "" : String(C).trim();
1308
+ if (v.length === 0) return v;
1309
+ const p = ir();
1310
+ return v.endsWith(` ${p}`) || v.endsWith(p) ? v : (w == null ? void 0 : w.dash) === !0 || (w == null ? void 0 : w.isCompare) === !0 ? `${v} ${p}` : v;
1311
+ }
1312
+ const r = b(() => ({
1313
+ display: e.showLabel,
1314
+ align: e.labelAlign,
1315
+ anchor: e.labelAnchor,
1316
+ rotation: e.labelRotation,
1317
+ offset: e.labelOffset,
1318
+ font: {
1319
+ size: e.labelFontSize
1320
+ },
1321
+ color: (C) => {
1322
+ const w = C.chart.data.datasets[C.datasetIndex];
1323
+ return w.borderColor ? Array.isArray(w.borderColor) ? w.borderColor[C.dataIndex] : w.borderColor : w.backgroundColor ? Array.isArray(w.backgroundColor) ? w.backgroundColor[C.dataIndex] : w.backgroundColor : "#000";
1324
+ },
1325
+ formatter: (C) => C.toLocaleString("en-US")
1326
+ })), c = b(() => ({
1327
+ display: e.showX,
1328
+ position: e.xPosition,
1329
+ grid: {
1330
+ display: e.showXGrid
1331
+ },
1332
+ ticks: {
1333
+ display: e.showXTick,
1334
+ padding: 8,
1335
+ callback: function(C) {
1336
+ if ((e == null ? void 0 : e.isTransposed) === !0) return a(C);
1337
+ let v = String(C);
1338
+ const p = this;
1339
+ p && typeof p.getLabelForValue == "function" && (v = p.getLabelForValue(C)), v = a(v);
1340
+ const F = p == null ? void 0 : p.chart, k = p == null ? void 0 : p.ctx, M = F.height * 0.25;
1341
+ if (k && M > 0) {
1342
+ k.save();
1343
+ const q = k.measureText(v).width > M ? o(k, v, M) : v;
1344
+ return k.restore(), q;
1345
+ }
1346
+ return v;
1347
+ },
1348
+ font: {
1349
+ size: e.xTickFontSize
1350
+ }
1351
+ },
1352
+ title: {
1353
+ display: e.showXTitle,
1354
+ text: e.xTitle,
1355
+ font: {
1356
+ size: e.xTitleFontSize
1357
+ }
1358
+ },
1359
+ afterBuildTicks: (C) => {
1360
+ const w = Array.isArray(C == null ? void 0 : C.ticks) ? C.ticks : [];
1361
+ if (w.length === 0) return;
1362
+ const v = a(C.getLabelForValue(w[0].value)), p = !isNaN(Number(v));
1363
+ C.options.ticks.minRotation = p || w.length < 10 ? 0 : 90;
1364
+ },
1365
+ afterFit: (C) => {
1366
+ if (!(e != null && e.isTransposed)) {
1367
+ const w = C.chart.height * 0.4;
1368
+ C.height > w && (C.height = w);
1369
+ }
1370
+ }
1371
+ })), d = b(() => ({
1372
+ display: e.showY,
1373
+ position: e.yPosition,
1374
+ grid: {
1375
+ display: e.showYGrid
1376
+ },
1377
+ ticks: {
1378
+ display: e.showYTick,
1379
+ padding: 8,
1380
+ font: {
1381
+ size: e.yTickFontSize
1382
+ },
1383
+ callback: function(C) {
1384
+ if (!((e == null ? void 0 : e.isTransposed) === !0)) return a(C);
1385
+ let v = String(C);
1386
+ const p = this;
1387
+ p && typeof p.getLabelForValue == "function" && (v = p.getLabelForValue(C)), v = a(v);
1388
+ const F = p == null ? void 0 : p.chart, k = p == null ? void 0 : p.ctx, M = F.width * 0.4;
1389
+ if (k && M > 0) {
1390
+ k.save();
1391
+ const q = k.measureText(v).width > M ? o(k, v, M) : v;
1392
+ return k.restore(), q;
1393
+ }
1394
+ return v;
1395
+ }
1396
+ },
1397
+ title: {
1398
+ display: e.showYTitle,
1399
+ text: e.yTitle,
1400
+ font: {
1401
+ size: e.yTitleFontSize
1402
+ }
1403
+ }
1404
+ })), m = b(() => ({
1405
+ display: e.showLegend,
1406
+ position: e.legendPosition,
1407
+ usePointStyle: e.usePointStyle,
1408
+ labels: {
1409
+ usePointStyle: e.usePointStyle ?? !0,
1410
+ padding: 12,
1411
+ color: e.legendColor ?? "#6b6b6b",
1412
+ font: {
1413
+ size: e.legendFontSize
1414
+ },
1415
+ generateLabels: (C) => {
1416
+ var p;
1417
+ const w = e.legendColor ?? "#6b6b6b", v = ((p = C == null ? void 0 : C.data) == null ? void 0 : p.datasets) || [];
1418
+ if (v.length === 0) return [];
1419
+ if (v.length === 1 && Array.isArray(v[0].backgroundColor) && v[0].backgroundColor.length > 1 && Array.isArray(v[0].data)) {
1420
+ const F = v[0];
1421
+ return C.data.labels.map((M, z) => {
1422
+ const q = F.backgroundColor[z];
1423
+ return {
1424
+ text: M,
1425
+ fontColor: w,
1426
+ color: w,
1427
+ fillStyle: q,
1428
+ strokeStyle: q,
1429
+ datasetIndex: 0,
1430
+ index: z,
1431
+ hidden: C.getDataVisibility ? !C.getDataVisibility(z) : !1
1432
+ };
1433
+ });
1434
+ }
1435
+ return C.data.datasets.map((F, k) => {
1436
+ const M = F.borderColor || F.backgroundColor;
1437
+ return {
1438
+ text: i(F.label, F),
1439
+ fontColor: w,
1440
+ color: w,
1441
+ fillStyle: M,
1442
+ strokeStyle: M,
1443
+ datasetIndex: k,
1444
+ hidden: !C.isDatasetVisible(k)
1445
+ };
1446
+ });
1447
+ }
1448
+ }
1449
+ })), A = b(() => e.isTransposed);
1450
+ return { datalabels: r, xCfg: c, yCfg: d, isTransposed: A, legend: m };
1451
+ }
1452
+ const ur = {
1453
+ key: 0,
1454
+ class: "pointer-events-none fixed inset-0 z-[120] flex justify-end"
1455
+ }, cr = ["aria-label"], dr = { class: "relative z-20 flex shrink-0 items-center bg-fm-color-neutral-white justify-between sm:px-5" }, fr = { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary min-w-0 flex-1 pr-3" }, mr = { class: "flex items-center gap-1.5" }, hr = {
1456
+ key: 0,
1457
+ class: "pb-2 fm-typo-en-body-lg-600 text-fm-color-typo-primary"
1458
+ }, pr = ["onMouseenter", "onFocus"], gr = { class: "min-w-0 flex flex-1 items-center gap-2.5 pr-2" }, vr = { class: "min-w-0 break-all text-fm-color-typo-secondary" }, yr = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-secondary shrink-0 text-right tabular-nums" }, br = {
1459
+ key: 1,
1460
+ class: "flex justify-center px-2 pt-2"
1461
+ }, Jn = 500, Cr = 320, Jt = 30, Wt = /* @__PURE__ */ Be({
1462
+ __name: "TooltipDetailSidesheet",
1463
+ props: {
1464
+ modelValue: { type: Boolean },
1465
+ detailsPayload: {}
1466
+ },
1467
+ emits: ["update:modelValue", "value-hover", "value-leave"],
1468
+ setup(e, { emit: t }) {
1469
+ const n = e, o = t, { t: a } = it(), i = L(null), r = L(Jn), c = L(!1), d = L({}), m = b({
1470
+ get: () => n.modelValue,
1471
+ set: (T) => o("update:modelValue", T)
1472
+ }), A = b(() => {
1473
+ var T;
1474
+ return (((T = n.detailsPayload) == null ? void 0 : T.sections) ?? []).filter((u) => u.values.length > 0);
1475
+ }), C = b(
1476
+ () => A.value.map((T, u) => {
1477
+ const y = M(T.title, u), P = Math.min(d.value[y] ?? Jt, T.values.length);
1478
+ return {
1479
+ ...T,
1480
+ key: y,
1481
+ visibleValues: T.values.slice(0, P),
1482
+ hasMore: P < T.values.length,
1483
+ remainingCount: T.values.length - P
1484
+ };
1485
+ })
1486
+ ), w = b(() => ({
1487
+ width: `${r.value}px`,
1488
+ maxWidth: "94vw"
1489
+ }));
1490
+ function v(T) {
1491
+ return T.value == null || T.value === "" ? "-" : typeof T.value == "number" ? Number.isFinite(T.value) ? T.value.toLocaleString() : "-" : String(T.value);
1492
+ }
1493
+ function p(T) {
1494
+ const u = T.text ?? "", y = u.lastIndexOf(":");
1495
+ return y > -1 ? u.slice(0, y).trim() : u;
1496
+ }
1497
+ function F(T) {
1498
+ o("value-hover", T);
1499
+ }
1500
+ function k() {
1501
+ o("value-leave");
1502
+ }
1503
+ function M(T, u) {
1504
+ return `${T || "section"}-${u}`;
1505
+ }
1506
+ function z() {
1507
+ d.value = A.value.reduce(
1508
+ (T, u, y) => (T[M(u.title, y)] = Jt, T),
1509
+ {}
1510
+ );
1511
+ }
1512
+ function q(T) {
1513
+ d.value = {
1514
+ ...d.value,
1515
+ [T]: (d.value[T] ?? Jt) + Jt
1516
+ };
1517
+ }
1518
+ function I() {
1519
+ k(), m.value = !1;
1520
+ }
1521
+ function H() {
1522
+ return typeof window > "u" ? Jn : Math.floor(window.innerWidth * 0.94);
1523
+ }
1524
+ function x(T) {
1525
+ const u = H(), y = Math.min(Cr, u);
1526
+ return Math.min(u, Math.max(y, Math.floor(T)));
1527
+ }
1528
+ function B(T) {
1529
+ typeof window > "u" || (r.value = x(window.innerWidth - T));
1530
+ }
1531
+ function N() {
1532
+ c.value = !1, document.removeEventListener("pointermove", V), document.removeEventListener("pointerup", N), document.removeEventListener("pointercancel", N);
1533
+ }
1534
+ function V(T) {
1535
+ c.value && B(T.clientX);
1536
+ }
1537
+ function K(T) {
1538
+ m.value && (c.value = !0, B(T.clientX), document.addEventListener("pointermove", V), document.addEventListener("pointerup", N), document.addEventListener("pointercancel", N));
1539
+ }
1540
+ function Z() {
1541
+ r.value = x(r.value);
1542
+ }
1543
+ function X(T) {
1544
+ var P;
1545
+ if (!m.value)
1546
+ return;
1547
+ const u = T.target;
1548
+ if (!(u instanceof Node))
1549
+ return;
1550
+ const y = u instanceof Element ? u : null;
1551
+ y != null && y.closest('[data-tooltip-full-details="true"]') || (P = i.value) != null && P.contains(u) || I();
1552
+ }
1553
+ function O(T) {
1554
+ m.value && T.key === "Escape" && I();
1555
+ }
1556
+ return Se([A, m], () => {
1557
+ m.value && z();
1558
+ }), Vt(() => {
1559
+ r.value = x(r.value), z(), document.addEventListener("pointerdown", X, !0), document.addEventListener("keydown", O), window.addEventListener("resize", Z);
1560
+ }), no(() => {
1561
+ N(), document.removeEventListener("pointerdown", X, !0), document.removeEventListener("keydown", O), window.removeEventListener("resize", Z);
1562
+ }), (T, u) => {
1563
+ const y = ie("FmButton");
1564
+ return Y(), de(No, {
1565
+ "enter-active-class": "transform transition duration-200 ease-out",
1566
+ "enter-from-class": "translate-x-full opacity-0",
1567
+ "enter-to-class": "translate-x-0 opacity-100",
1568
+ "leave-active-class": "transform transition duration-150 ease-in",
1569
+ "leave-from-class": "translate-x-0 opacity-100",
1570
+ "leave-to-class": "translate-x-full opacity-0"
1571
+ }, {
1572
+ default: xe(() => [
1573
+ m.value ? (Y(), re("div", ur, [
1574
+ j("div", {
1575
+ ref_key: "panelRef",
1576
+ ref: i,
1577
+ class: "glassmorphism pointer-events-auto relative ml-auto flex h-full flex-col px-24 py-3 overflow-hidden rounded-l-2xl border border-fm-color-border-secondary bg-fm-color-neutral-white duration-200 ease-out",
1578
+ style: Ie(w.value),
1579
+ role: "dialog",
1580
+ "aria-modal": "false",
1581
+ "aria-label": s(a)("report.widget.comparisonTooltip.fullBreakdownTitle")
1582
+ }, [
1583
+ j("div", {
1584
+ class: "absolute left-0 top-0 z-40 h-full w-3 -translate-x-1/2 cursor-ew-resize",
1585
+ onPointerdown: Zt(K, ["prevent"])
1586
+ }, null, 32),
1587
+ j("div", dr, [
1588
+ j("div", fr, Te(s(a)("report.widget.comparisonTooltip.fullBreakdownTitle")), 1),
1589
+ j("div", mr, [
1590
+ se(y, {
1591
+ class: "relative z-30 h-9 w-9 shrink-0",
1592
+ variant: "tertiary",
1593
+ icon: "close",
1594
+ "aria-label": s(a)("report.dynamic.common.close"),
1595
+ onClick: I
1596
+ }, null, 8, ["aria-label"])
1597
+ ])
1598
+ ]),
1599
+ j("div", {
1600
+ class: "flex flex-1 flex-col gap-4 overflow-y-auto px-4 py-4 sm:px-5",
1601
+ onMouseleave: k
1602
+ }, [
1603
+ (Y(!0), re(Ve, null, Ft(C.value, (P, W) => (Y(), re("div", {
1604
+ key: P.key,
1605
+ class: "flex flex-col gap-2 rounded-2xl bg-fm-color-neutral-white/45 py-3"
1606
+ }, [
1607
+ P.title ? (Y(), re("p", hr, Te(P.title), 1)) : me("", !0),
1608
+ (Y(!0), re(Ve, null, Ft(P.visibleValues, ($, S) => (Y(), re("button", {
1609
+ key: `${$.text}-${S}`,
1610
+ type: "button",
1611
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary flex w-full items-start justify-between gap-3 bg-transparent px-2 py-1.5 text-left transition-colors hover:bg-fm-color-opacity-sm focus-visible:bg-fm-color-opacity-sm focus-visible:outline-none",
1612
+ onMouseenter: (G) => F($),
1613
+ onFocus: (G) => F($),
1614
+ onMouseleave: k,
1615
+ onBlur: k
1616
+ }, [
1617
+ j("span", gr, [
1618
+ j("span", {
1619
+ class: we([
1620
+ "inline-block h-3 w-3 shrink-0 box-border",
1621
+ $.isBar ? "rounded-sm border border-fm-color-neutral-gray-400" : "rounded-full border border-white shadow-[0_0_0_1px_rgba(17,24,39,0.28)]"
1622
+ ]),
1623
+ style: Ie({ backgroundColor: $.color })
1624
+ }, null, 6),
1625
+ j("span", vr, Te(p($)), 1)
1626
+ ]),
1627
+ j("span", yr, Te(v($)), 1)
1628
+ ], 40, pr))), 128)),
1629
+ P.hasMore ? (Y(), re("div", br, [
1630
+ se(y, {
1631
+ class: "w-full",
1632
+ variant: "tertiary",
1633
+ size: "sm",
1634
+ label: `${s(a)("report.widget.legend.viewMore")} (${P.remainingCount})`,
1635
+ onClick: ($) => q(P.key)
1636
+ }, null, 8, ["label", "onClick"])
1637
+ ])) : me("", !0)
1638
+ ]))), 128))
1639
+ ], 32)
1640
+ ], 12, cr)
1641
+ ])) : me("", !0)
1642
+ ]),
1643
+ _: 1
1644
+ });
1645
+ };
1646
+ }
1647
+ }), xr = {
1648
+ type: "button",
1649
+ class: "inline-flex cursor-pointer select-none items-center gap-1 rounded px-1 py-0.5 border-none bg-transparent text-fm-color-system-info-300 leading-[1.4]",
1650
+ style: { fontSize: "var(--legend-font-size)" }
1651
+ }, wr = ["aria-pressed", "onClick"], _r = ["title"], Sr = {
1652
+ key: 0,
1653
+ class: "chart-legend-item relative z-[2] inline-flex max-w-full cursor-pointer select-none pointer-events-auto"
1654
+ }, kr = 36, Zn = 2, Qn = 16, Tr = 50, Lr = 6, Dr = /* @__PURE__ */ Be({
1655
+ __name: "ChartLegendPanel",
1656
+ props: {
1657
+ chartRef: {},
1658
+ enabled: { type: Boolean },
1659
+ position: {},
1660
+ textColor: {},
1661
+ fontSize: {},
1662
+ legendUpdateKey: {},
1663
+ hiddenDatasetKeys: {},
1664
+ hiddenDataPointIndexes: {},
1665
+ chartColorBinding: {},
1666
+ chartColors: {},
1667
+ chartBreakdownColors: {},
1668
+ chartUseSecondaryMetricShades: { type: Boolean },
1669
+ metricCount: {},
1670
+ usePointStyle: { type: Boolean }
1671
+ },
1672
+ emits: ["toggleDatasetVisibility", "toggleDataPointVisibility"],
1673
+ setup(e, { emit: t }) {
1674
+ const n = e, o = t, { t: a, locale: i } = it(), r = L([]), c = L(0), d = L(!1), m = L(!1), A = L(0), C = L(null), w = L(null), v = L(null), p = L(null), F = L(!1), k = L(0), M = L(0), z = L(!1), q = L(0), I = L(0), H = b(() => n.enabled !== !1), x = b(() => n.position === "left" || n.position === "right");
1675
+ let B = null;
1676
+ const N = b(
1677
+ () => d.value && m.value && F.value
1678
+ ), V = b(() => ({
1679
+ height: `${Math.max(0, k.value)}px`,
1680
+ transform: `translateY(${Math.max(0, M.value)}px)`
1681
+ })), K = b(() => typeof n.textColor == "string" && n.textColor.trim().length > 0 ? n.textColor : "#6b6b6b"), Z = b(() => typeof n.fontSize == "number" && Number.isFinite(n.fontSize) && n.fontSize > 0 ? n.fontSize : 12);
1682
+ function X(l) {
1683
+ O({ height: l, width: 0 });
1684
+ }
1685
+ function O({ height: l, width: h }) {
1686
+ var g;
1687
+ const f = (g = n.chartRef) == null ? void 0 : g.$el;
1688
+ f instanceof HTMLElement && (f.style.setProperty("--legend-panel-height", `${Math.max(0, Math.floor(l))}px`), f.style.setProperty("--legend-panel-width", `${Math.max(0, Math.floor(h))}px`));
1689
+ }
1690
+ function T() {
1691
+ B != null && (window.clearTimeout(B), B = null);
1692
+ }
1693
+ function u() {
1694
+ const l = wo(
1695
+ n.chartRef
1696
+ );
1697
+ if (l)
1698
+ return l;
1699
+ const h = C.value, f = [h == null ? void 0 : h.parentElement, h == null ? void 0 : h.closest(".h-full"), h];
1700
+ for (const g of f) {
1701
+ if (!(g instanceof HTMLElement))
1702
+ continue;
1703
+ const R = g.querySelector("canvas");
1704
+ if (!(R instanceof HTMLCanvasElement))
1705
+ continue;
1706
+ const U = vn.getChart(R);
1707
+ if (U)
1708
+ return U;
1709
+ }
1710
+ return null;
1711
+ }
1712
+ function y() {
1713
+ P();
1714
+ }
1715
+ function P() {
1716
+ var g;
1717
+ const l = (g = C.value) == null ? void 0 : g.getBoundingClientRect(), h = Number((l == null ? void 0 : l.height) ?? 0), f = Number((l == null ? void 0 : l.width) ?? 0);
1718
+ if (Number.isFinite(h) && h >= 0) {
1719
+ O({
1720
+ height: x.value ? 0 : h,
1721
+ width: x.value && Number.isFinite(f) && f >= 0 ? f : 0
1722
+ });
1723
+ return;
1724
+ }
1725
+ O({ height: 0, width: 0 });
1726
+ }
1727
+ function W() {
1728
+ const l = v.value;
1729
+ if (!l) {
1730
+ F.value = !1, k.value = 0, M.value = 0;
1731
+ return;
1732
+ }
1733
+ const h = l.clientHeight, f = l.scrollHeight, g = l.scrollTop, R = f > h + 1;
1734
+ if (F.value = R, !R || h <= 0) {
1735
+ k.value = 0, M.value = 0;
1736
+ return;
1737
+ }
1738
+ const U = h, E = Math.max(18, Math.round(h / f * U)), J = Math.max(0, U - E), D = Math.max(1, f - h), le = Math.round(g / D * J);
1739
+ k.value = E, M.value = le;
1740
+ }
1741
+ function $() {
1742
+ W();
1743
+ }
1744
+ function S(l) {
1745
+ const h = v.value, f = w.value;
1746
+ if (!h || !f || !F.value)
1747
+ return;
1748
+ const g = f.getBoundingClientRect(), R = l.clientY - g.top, U = Math.max(0, R - k.value / 2), E = Math.max(1, h.clientHeight - k.value), J = Math.min(1, U / E), D = Math.max(0, h.scrollHeight - h.clientHeight);
1749
+ h.scrollTop = J * D, W();
1750
+ }
1751
+ function G(l) {
1752
+ F.value && (z.value = !0, q.value = l.clientY, I.value = M.value);
1753
+ }
1754
+ function Q(l) {
1755
+ if (!z.value)
1756
+ return;
1757
+ const h = v.value;
1758
+ if (!h)
1759
+ return;
1760
+ const f = l.clientY - q.value, g = Math.max(1, h.clientHeight - k.value), U = Math.min(g, Math.max(0, I.value + f)) / g, E = Math.max(0, h.scrollHeight - h.clientHeight);
1761
+ h.scrollTop = U * E, W();
1762
+ }
1763
+ function ne() {
1764
+ z.value && (z.value = !1);
1765
+ }
1766
+ function oe() {
1767
+ var h;
1768
+ const l = [(h = n.chartRef) == null ? void 0 : h.$el, C.value];
1769
+ for (const f of l) {
1770
+ if (!(f instanceof HTMLElement))
1771
+ continue;
1772
+ const g = f.closest('[class*="fm-card"]');
1773
+ if (g)
1774
+ return g;
1775
+ }
1776
+ for (const f of l) {
1777
+ if (!(f instanceof HTMLElement))
1778
+ continue;
1779
+ const g = f.closest(".h-full") ?? f.parentElement;
1780
+ if (g)
1781
+ return g;
1782
+ }
1783
+ return null;
1784
+ }
1785
+ function ge() {
1786
+ var f, g, R, U;
1787
+ const l = (g = (f = C.value) == null ? void 0 : f.closest(".chart-layout")) == null ? void 0 : g.parentElement;
1788
+ if (l instanceof HTMLElement)
1789
+ return l;
1790
+ const h = (R = n.chartRef) == null ? void 0 : R.$el;
1791
+ if (h instanceof HTMLElement) {
1792
+ const E = (U = h.closest(".chart-layout")) == null ? void 0 : U.parentElement;
1793
+ if (E instanceof HTMLElement)
1794
+ return E;
1795
+ }
1796
+ return null;
1797
+ }
1798
+ function ae() {
1799
+ var f, g, R, U;
1800
+ const l = ((f = C.value) == null ? void 0 : f.closest(".chart-layout")) ?? ((U = (R = (g = n.chartRef) == null ? void 0 : g.$el) == null ? void 0 : R.closest) == null ? void 0 : U.call(R, ".chart-layout")) ?? null;
1801
+ if (!(l instanceof HTMLElement))
1802
+ return null;
1803
+ const h = Number(l.getBoundingClientRect().width);
1804
+ return Number.isFinite(h) && h > 0 ? h : null;
1805
+ }
1806
+ function pe() {
1807
+ const l = ge();
1808
+ if (l) {
1809
+ const E = Number(l.getBoundingClientRect().height);
1810
+ if (Number.isFinite(E) && E > 0)
1811
+ return E;
1812
+ }
1813
+ const h = oe();
1814
+ if (!h)
1815
+ return null;
1816
+ const f = window.getComputedStyle(h), g = parseFloat(f.paddingTop) || 0, R = parseFloat(f.paddingBottom) || 0, U = h.getBoundingClientRect().height - g - R;
1817
+ return Number.isFinite(U) && U > 0 ? U : null;
1818
+ }
1819
+ function be() {
1820
+ const l = ge();
1821
+ if (l) {
1822
+ const E = Number(l.getBoundingClientRect().width);
1823
+ if (Number.isFinite(E) && E > 0)
1824
+ return E;
1825
+ }
1826
+ const h = oe();
1827
+ if (!h)
1828
+ return null;
1829
+ const f = window.getComputedStyle(h), g = parseFloat(f.paddingLeft) || 0, R = parseFloat(f.paddingRight) || 0, U = h.getBoundingClientRect().width - g - R;
1830
+ return Number.isFinite(U) && U > 0 ? U : null;
1831
+ }
1832
+ function Ae() {
1833
+ const l = u(), h = Number(l == null ? void 0 : l.height), f = pe();
1834
+ if (x.value)
1835
+ return Number.isFinite(h) && h > 0 ? Math.max(0, Math.floor(h - Qn)) : f != null ? Math.max(0, Math.floor(f - Qn)) : 120;
1836
+ if (f != null) {
1837
+ const g = f * 0.3, R = f - kr, U = Math.min(g, R);
1838
+ return Math.max(0, Math.floor(U));
1839
+ }
1840
+ return Number.isFinite(h) && h > 0 ? Math.max(0, Math.floor(h * 0.3)) : 120;
1841
+ }
1842
+ function Ue() {
1843
+ var U;
1844
+ if (x.value) {
1845
+ const E = be();
1846
+ if (E != null)
1847
+ return Math.max(0, Math.floor(E * 0.3));
1848
+ const J = u(), D = Number(J == null ? void 0 : J.width);
1849
+ return Number.isFinite(D) && D > 0 ? Math.max(0, Math.floor(D * 0.3)) : 180;
1850
+ }
1851
+ const l = ae();
1852
+ if (l != null)
1853
+ return Math.max(0, Math.floor(l * 0.3));
1854
+ const h = u(), f = Number(h == null ? void 0 : h.width), g = Number(((U = C.value) == null ? void 0 : U.getBoundingClientRect().width) ?? 0);
1855
+ if (Number.isFinite(f) && f > 0) {
1856
+ const E = f + (Number.isFinite(g) ? g : 0);
1857
+ return Math.max(0, Math.floor(E * 0.3));
1858
+ }
1859
+ const R = be();
1860
+ return R != null ? Math.max(0, Math.floor(R * 0.3)) : 180;
1861
+ }
1862
+ function et(l, h) {
1863
+ const f = n.chartColorBinding;
1864
+ if (f) {
1865
+ const U = typeof l.datasetIndex == "number" ? l.datasetIndex : h, E = Number.isInteger(n.metricCount) && Number(n.metricCount) > 0 ? Number(n.metricCount) : Math.max(1, Number(r.value.length));
1866
+ if (f === ye.breakdown) {
1867
+ const D = Ct({
1868
+ fallbackIndex: U,
1869
+ metricCount: E
1870
+ }), le = ke({
1871
+ datasetIndex: U,
1872
+ metricCount: E,
1873
+ mode: ye.metric
1874
+ });
1875
+ return _t({
1876
+ breakdownIndex: D,
1877
+ metricIndex: le,
1878
+ metricCount: E,
1879
+ breakdownColors: n.chartBreakdownColors,
1880
+ useSecondaryMetricShades: n.chartUseSecondaryMetricShades,
1881
+ customColors: n.chartColors
1882
+ });
1883
+ }
1884
+ if (f === ye.metric) {
1885
+ const D = ke({
1886
+ datasetIndex: U,
1887
+ metricCount: E,
1888
+ mode: ye.metric
1889
+ });
1890
+ return Ze({ index: D, customColors: n.chartColors });
1891
+ }
1892
+ const J = typeof l.index == "number" ? l.index : U;
1893
+ return Ze({ index: J, customColors: n.chartColors });
1894
+ }
1895
+ const g = l;
1896
+ return _e(l.fillStyle) || _e(l.strokeStyle) || _e(g.color) || "#9ca3af";
1897
+ }
1898
+ function _e(l) {
1899
+ return typeof l == "string" && l.trim().length > 0 ? l : Array.isArray(l) ? l.map((f) => _e(f)).find((f) => typeof f == "string" && f.trim().length > 0) ?? "" : "";
1900
+ }
1901
+ function St(l) {
1902
+ return Array.isArray(n.hiddenDataPointIndexes) ? n.hiddenDataPointIndexes.includes(l) : !1;
1903
+ }
1904
+ function Ke(l) {
1905
+ return Array.isArray(l) ? l : [];
1906
+ }
1907
+ function tt(l) {
1908
+ if (l.length <= 1)
1909
+ return l;
1910
+ const h = Number.isInteger(n.metricCount) && Number(n.metricCount) > 0 ? Number(n.metricCount) : 1;
1911
+ return [...l.map((g, R) => {
1912
+ const U = typeof g.datasetIndex == "number" ? g.datasetIndex : R, E = Ct({
1913
+ fallbackIndex: U,
1914
+ metricCount: h
1915
+ });
1916
+ return {
1917
+ item: g,
1918
+ originalIndex: R,
1919
+ breakdownIndex: E
1920
+ };
1921
+ })].sort((g, R) => g.breakdownIndex !== R.breakdownIndex ? g.breakdownIndex - R.breakdownIndex : g.originalIndex - R.originalIndex).map((g) => g.item);
1922
+ }
1923
+ function ut(l) {
1924
+ if (l.length <= 1)
1925
+ return l;
1926
+ const h = /* @__PURE__ */ new Map(), f = [];
1927
+ for (const g of l) {
1928
+ const R = typeof g.index == "number", U = g.datasetIndex, E = typeof U == "number" && !R, J = typeof g.text == "string" ? g.text.trim() : "";
1929
+ if (!E || !J) {
1930
+ f.push(g);
1931
+ continue;
1932
+ }
1933
+ const D = J.toLowerCase(), le = h.get(D);
1934
+ if (le == null) {
1935
+ f.push({
1936
+ ...g,
1937
+ datasetIndexes: [U],
1938
+ datasetKeys: typeof g.datasetKey == "string" && g.datasetKey.trim().length > 0 ? [g.datasetKey] : []
1939
+ }), h.set(D, f.length - 1);
1940
+ continue;
1941
+ }
1942
+ const he = f[le];
1943
+ if (!he)
1944
+ continue;
1945
+ const ve = new Set(
1946
+ Array.isArray(he.datasetIndexes) ? he.datasetIndexes : typeof he.datasetIndex == "number" ? [he.datasetIndex] : []
1947
+ );
1948
+ ve.add(U);
1949
+ const te = new Set(
1950
+ Array.isArray(he.datasetKeys) ? he.datasetKeys : typeof he.datasetKey == "string" && he.datasetKey.trim().length > 0 ? [he.datasetKey] : []
1951
+ );
1952
+ typeof g.datasetKey == "string" && g.datasetKey.trim().length > 0 && te.add(g.datasetKey), f[le] = {
1953
+ ...he,
1954
+ datasetIndexes: Array.from(ve).sort((ce, fe) => ce - fe),
1955
+ datasetKeys: Array.from(te),
1956
+ hidden: he.hidden === !0 && g.hidden === !0
1957
+ };
1958
+ }
1959
+ return f;
1960
+ }
1961
+ function ct(l) {
1962
+ var D, le, he, ve, te, ce;
1963
+ const h = l == null ? void 0 : l.legend;
1964
+ if (typeof (h == null ? void 0 : h.buildLabels) == "function")
1965
+ try {
1966
+ h.buildLabels();
1967
+ } catch {
1968
+ }
1969
+ const f = Ke(h == null ? void 0 : h.legendItems);
1970
+ if (f.length > 0)
1971
+ return f;
1972
+ const g = (le = (D = l == null ? void 0 : l.options) == null ? void 0 : D.plugins) == null ? void 0 : le.legend, R = g == null ? void 0 : g.labels, U = R == null ? void 0 : R.generateLabels, E = (ce = (te = (ve = (he = vn.defaults) == null ? void 0 : he.plugins) == null ? void 0 : ve.legend) == null ? void 0 : te.labels) == null ? void 0 : ce.generateLabels;
1973
+ let J = Ke(
1974
+ typeof U == "function" ? U(l) : []
1975
+ );
1976
+ return J.length === 0 && typeof E == "function" && (J = Ke(E(l))), typeof (R == null ? void 0 : R.filter) == "function" && (J = J.filter((fe) => R.filter(fe, l.data))), typeof (R == null ? void 0 : R.sort) == "function" && (J = [...J].sort((fe, Le) => R.sort(fe, Le, l.data))), (g == null ? void 0 : g.reverse) === !0 && (J = [...J].reverse()), J;
1977
+ }
1978
+ function dt(l) {
1979
+ var f;
1980
+ return (Array.isArray((f = l == null ? void 0 : l.data) == null ? void 0 : f.datasets) ? l.data.datasets : []).map((g, R) => {
1981
+ const U = _e((g == null ? void 0 : g.borderColor) ?? (g == null ? void 0 : g.backgroundColor)), E = gt({
1982
+ datasetIndex: R,
1983
+ label: g == null ? void 0 : g.label
1984
+ });
1985
+ return {
1986
+ text: Xe.value(g == null ? void 0 : g.label, g),
1987
+ fillStyle: U,
1988
+ strokeStyle: U,
1989
+ datasetIndex: R,
1990
+ datasetKey: E,
1991
+ hidden: Array.isArray(n.hiddenDatasetKeys) ? n.hiddenDatasetKeys.includes(E) : typeof l.isDatasetVisible == "function" ? !l.isDatasetVisible(R) : !1
1992
+ };
1993
+ });
1994
+ }
1995
+ const ft = b(() => `(${a("report.widget.legend.comparison")})`), Xe = b(
1996
+ () => (l, h) => {
1997
+ const f = l == null ? "" : String(l).trim();
1998
+ if (f.length === 0) return f;
1999
+ const g = ft.value;
2000
+ return f.endsWith(` ${g}`) || f.endsWith(g) ? f : (h == null ? void 0 : h.dash) === !0 || (h == null ? void 0 : h.isCompare) === !0 ? `${f} ${g}` : f;
2001
+ }
2002
+ );
2003
+ function Ye(l, h) {
2004
+ if (!Array.isArray(l) || l.length === 0)
2005
+ return [];
2006
+ const f = l, g = f[0], R = Array.isArray(g == null ? void 0 : g.labels) ? g.labels : [], U = Array.isArray(h == null ? void 0 : h.metrics) ? h.metrics : [], E = R.length > 0 ? R : U, J = g == null ? void 0 : g.backgroundColor;
2007
+ return f.length === 1 && Array.isArray(J) && J.length > 1 ? J.map((D, le) => ({
2008
+ text: E[le] == null || String(E[le]).trim().length === 0 ? `Series ${le + 1}` : String(E[le]),
2009
+ fillStyle: _e(D),
2010
+ strokeStyle: _e(D),
2011
+ datasetIndex: 0,
2012
+ index: le,
2013
+ hidden: St(le)
2014
+ })) : f.map((D, le) => ({
2015
+ datasetKey: gt({
2016
+ datasetIndex: le,
2017
+ label: D == null ? void 0 : D.label
2018
+ }),
2019
+ text: Xe.value(D == null ? void 0 : D.label, D),
2020
+ fillStyle: _e(
2021
+ (D == null ? void 0 : D.color) ?? (D == null ? void 0 : D.borderColor) ?? (D == null ? void 0 : D.backgroundColor) ?? (D == null ? void 0 : D.pointBackgroundColor)
2022
+ ),
2023
+ strokeStyle: _e(
2024
+ (D == null ? void 0 : D.color) ?? (D == null ? void 0 : D.borderColor) ?? (D == null ? void 0 : D.backgroundColor) ?? (D == null ? void 0 : D.pointBorderColor)
2025
+ ),
2026
+ datasetIndex: le,
2027
+ hidden: Array.isArray(n.hiddenDatasetKeys) ? n.hiddenDatasetKeys.includes(
2028
+ gt({
2029
+ datasetIndex: le,
2030
+ label: D == null ? void 0 : D.label
2031
+ })
2032
+ ) : !!(D != null && D.hidden)
2033
+ }));
2034
+ }
2035
+ function Ut() {
2036
+ var h;
2037
+ const l = (h = n.chartRef) == null ? void 0 : h.datasets;
2038
+ return Array.isArray(l) ? l : [];
2039
+ }
2040
+ function Ee(l, h) {
2041
+ return typeof l.datasetKey == "string" && l.datasetKey.trim().length > 0 ? `dataset-key:${l.datasetKey}` : typeof l.datasetIndex == "number" && typeof l.index == "number" ? `dataset:${l.datasetIndex}-item:${l.index}` : typeof l.datasetIndex == "number" ? `dataset:${l.datasetIndex}` : typeof l.index == "number" ? `item:${l.index}` : typeof l.text == "string" && l.text.trim().length > 0 ? `text:${l.text.trim()}` : `fallback:${h}`;
2042
+ }
2043
+ function Kt() {
2044
+ const l = p.value;
2045
+ return l ? Math.ceil(l.getBoundingClientRect().width) : 0;
2046
+ }
2047
+ function Xt() {
2048
+ const l = p.value;
2049
+ return l ? Math.ceil(l.getBoundingClientRect().height) : 0;
2050
+ }
2051
+ function Yt(l, h) {
2052
+ var ve;
2053
+ const f = v.value;
2054
+ if (!f || l.length === 0)
2055
+ return 0;
2056
+ const g = Math.max(0, h - Zn), R = window.getComputedStyle(f);
2057
+ if (R.flexDirection.startsWith("column")) {
2058
+ const te = Number.parseFloat(R.rowGap || R.gap || "0") || 0, ce = Xt();
2059
+ let fe = 0, Le = 0;
2060
+ for (let $e = 0; $e < l.length; $e += 1) {
2061
+ const Fe = l[$e];
2062
+ if (!Fe)
2063
+ continue;
2064
+ const je = fe + (Le > 0 ? te : 0) + Fe.offsetHeight, at = l.length - ($e + 1) > 0 ? te + ce : 0;
2065
+ if (je + at > g)
2066
+ break;
2067
+ fe = je, Le += 1;
2068
+ }
2069
+ return Le > 0 ? Le : 1;
2070
+ }
2071
+ const E = ((ve = l[0]) == null ? void 0 : ve.offsetTop) ?? 0, J = l.filter(
2072
+ (te) => te.offsetTop - E + te.offsetHeight <= g
2073
+ );
2074
+ if (J.length === 0)
2075
+ return 0;
2076
+ if (J.length >= l.length)
2077
+ return J.length;
2078
+ const D = Kt();
2079
+ if (D <= 0)
2080
+ return Math.max(1, J.length - 1);
2081
+ const le = Number.parseFloat(R.columnGap || R.gap || "0") || 0, he = f.clientWidth;
2082
+ for (let te = J.length; te > 0; te -= 1) {
2083
+ const ce = J.slice(0, te), fe = ce[ce.length - 1];
2084
+ if (!fe)
2085
+ continue;
2086
+ if (fe.offsetLeft + fe.offsetWidth + le + D <= he)
2087
+ return te;
2088
+ }
2089
+ return 1;
2090
+ }
2091
+ function kt() {
2092
+ const l = v.value;
2093
+ if (!l) {
2094
+ m.value = !1, A.value = 0, c.value = 0, y(), W();
2095
+ return;
2096
+ }
2097
+ const h = Array.from(
2098
+ l.querySelectorAll(".chart-legend-item[data-legend-data='true']")
2099
+ );
2100
+ if (h.length === 0) {
2101
+ m.value = !1, A.value = 0, c.value = 0, y(), W();
2102
+ return;
2103
+ }
2104
+ const f = Array.from(new Set(h.map((te) => te.offsetTop))).sort((te, ce) => te - ce), g = !d.value && r.value.length > h.length, R = !d.value && !g, U = R || A.value <= 0 ? Ae() : A.value;
2105
+ if ((R || A.value <= 0) && (A.value = U), g) {
2106
+ const te = Ae();
2107
+ if (te > 0 && (A.value = te), window.getComputedStyle(l).flexDirection.startsWith("column") && c.value < r.value.length) {
2108
+ const Le = Math.max(0, A.value - Zn), $e = l.scrollHeight;
2109
+ if ($e + 1 < Le) {
2110
+ const Fe = h.map((De) => De.offsetHeight).filter((De) => Number.isFinite(De) && De > 0), je = Fe.length > 0 ? Fe.reduce((De, at) => De + at, 0) / Fe.length : 0;
2111
+ if (je > 0) {
2112
+ const De = window.getComputedStyle(l), at = Number.parseFloat(De.rowGap || De.gap || "0") || 0, un = Math.max(1, je + at), Et = Le - $e, Pt = Math.floor(Et / un);
2113
+ if (Pt > 0) {
2114
+ c.value = Math.min(
2115
+ r.value.length,
2116
+ c.value + Pt
2117
+ ), We();
2118
+ return;
2119
+ }
2120
+ }
2121
+ }
2122
+ }
2123
+ m.value = !0, y(), W();
2124
+ return;
2125
+ }
2126
+ const E = f[0] ?? 0, J = f[f.length - 1] ?? E, D = h.filter((te) => te.offsetTop === J), le = Math.max(...D.map((te) => te.offsetHeight), 0), he = Math.max(0, J - E + le), ve = Yt(h, U);
2127
+ (R || c.value <= 0) && (c.value = Math.max(0, ve)), m.value = he > U, y(), W();
2128
+ }
2129
+ function We() {
2130
+ $o(() => {
2131
+ kt(), window.requestAnimationFrame(() => {
2132
+ kt(), P(), W();
2133
+ });
2134
+ });
2135
+ }
2136
+ const Tt = b(() => {
2137
+ const l = {
2138
+ "--legend-text-color": K.value,
2139
+ "--legend-font-size": `${Z.value}px`
2140
+ }, h = Ae();
2141
+ if (x.value) {
2142
+ const f = Ue();
2143
+ return {
2144
+ ...l,
2145
+ width: "fit-content",
2146
+ maxWidth: `${f}px`,
2147
+ maxHeight: `${h}px`,
2148
+ minWidth: "0",
2149
+ flex: "0 1 auto"
2150
+ };
2151
+ }
2152
+ return {
2153
+ ...l,
2154
+ maxHeight: `${h}px`,
2155
+ flex: "0 0 auto"
2156
+ };
2157
+ }), qe = b(() => {
2158
+ if (d.value || !m.value)
2159
+ return r.value;
2160
+ const l = Math.max(1, c.value), h = x.value ? l : Math.max(0, l - 1);
2161
+ return r.value.slice(0, Math.min(h, r.value.length));
2162
+ }), nt = b(() => H.value ? m.value && d.value ? {
2163
+ flex: "1 1 auto",
2164
+ minHeight: "0",
2165
+ overflowY: "auto"
2166
+ } : m.value ? {
2167
+ overflow: "hidden"
2168
+ } : {} : {});
2169
+ function Lt() {
2170
+ var g;
2171
+ if (!H.value) {
2172
+ r.value = [], c.value = 0, d.value = !1, m.value = !1, A.value = 0, O({ height: 0, width: 0 });
2173
+ return;
2174
+ }
2175
+ c.value = 0, m.value = !1, A.value = 0;
2176
+ const l = u();
2177
+ if (!l) {
2178
+ r.value = tt(
2179
+ Ye(n.legendUpdateKey, n.chartRef)
2180
+ ), We();
2181
+ return;
2182
+ }
2183
+ try {
2184
+ r.value = ct(l);
2185
+ } catch {
2186
+ r.value = [];
2187
+ }
2188
+ const h = Array.isArray((g = l == null ? void 0 : l.data) == null ? void 0 : g.datasets) ? l.data.datasets : [];
2189
+ r.value.length === 0 && (r.value = Ye(n.legendUpdateKey, n.chartRef)), r.value.length === 0 && (r.value = dt(l)), r.value = ut(tt(r.value));
2190
+ const f = Array.isArray(n.legendUpdateKey) && n.legendUpdateKey.length > 0 || !Array.isArray(n.legendUpdateKey) && !!n.legendUpdateKey;
2191
+ r.value.length === 0 && !(h.length > 0 || f) && X(0), We();
2192
+ }
2193
+ function Ce(l) {
2194
+ return Array.isArray(l.datasetIndexes) && l.datasetIndexes.length > 0 ? l.datasetIndexes.filter((h) => Number.isInteger(h)) : typeof l.datasetIndex == "number" ? [l.datasetIndex] : [];
2195
+ }
2196
+ function an(l, h) {
2197
+ return Array.isArray(l.datasetKeys) && l.datasetKeys.length > 0 ? l.datasetKeys.filter((f) => typeof f == "string" && f.trim().length > 0) : typeof l.datasetKey == "string" && l.datasetKey.trim().length > 0 ? [l.datasetKey] : h.map(
2198
+ (f) => gt({
2199
+ datasetIndex: f,
2200
+ label: l.text
2201
+ })
2202
+ );
2203
+ }
2204
+ function Dt(l, h) {
2205
+ r.value = r.value.map(
2206
+ (f) => l(f) ? {
2207
+ ...f,
2208
+ hidden: h
2209
+ } : f
2210
+ );
2211
+ }
2212
+ function rn(l, h, f) {
2213
+ var R;
2214
+ typeof l.setDatasetVisibility == "function" ? l.setDatasetVisibility(h, f) : f && typeof l.show == "function" ? l.show(h) : !f && typeof l.hide == "function" && l.hide(h);
2215
+ const g = Array.isArray((R = l == null ? void 0 : l.data) == null ? void 0 : R.datasets) ? l.data.datasets[h] : null;
2216
+ g && typeof g == "object" && (g.hidden = !f);
2217
+ }
2218
+ function ln(l, h) {
2219
+ var E;
2220
+ if (typeof l.toggleDataVisibility == "function") {
2221
+ l.toggleDataVisibility(h);
2222
+ return;
2223
+ }
2224
+ const f = Array.isArray((E = l == null ? void 0 : l.data) == null ? void 0 : E.datasets) ? l.data.datasets[0] : null, g = Array.isArray(f == null ? void 0 : f.data) ? f.data : [];
2225
+ if (h < 0 || h >= g.length)
2226
+ return;
2227
+ const R = typeof l.getDatasetMeta == "function" ? l.getDatasetMeta(0) : null, U = Array.isArray(R == null ? void 0 : R.data) ? R.data[h] : null;
2228
+ U && typeof U.hidden == "boolean" && (U.hidden = !U.hidden);
2229
+ }
2230
+ function ot(l = 0) {
2231
+ Lt();
2232
+ const h = u(), f = r.value.length > 0;
2233
+ if (h || f || l >= Lr) {
2234
+ T();
2235
+ return;
2236
+ }
2237
+ T(), B = window.setTimeout(() => {
2238
+ ot(l + 1);
2239
+ }, Tr);
2240
+ }
2241
+ function Ge(l, h) {
2242
+ var he;
2243
+ const f = u(), g = String(((he = f == null ? void 0 : f.config) == null ? void 0 : he.type) ?? ""), R = g === "pie" || g === "doughnut" || g === "polarArea", U = typeof l.index == "number" ? l.index : typeof h == "number" ? h : null;
2244
+ if ((R || typeof l.index == "number") && typeof U == "number") {
2245
+ if (Array.isArray(n.hiddenDataPointIndexes)) {
2246
+ o("toggleDataPointVisibility", { itemIndex: U });
2247
+ return;
2248
+ }
2249
+ f && (ln(f, U), f.update());
2250
+ const ve = f && typeof f.getDataVisibility == "function" ? !f.getDataVisibility(U) : l.hidden !== !0;
2251
+ Dt(
2252
+ (te) => typeof te.index == "number" ? te.index === U : te.datasetIndex === l.datasetIndex && te.text === l.text,
2253
+ ve
2254
+ );
2255
+ return;
2256
+ }
2257
+ const J = Ce(l), D = an(l, J);
2258
+ if (Array.isArray(n.hiddenDatasetKeys) && J.length > 0) {
2259
+ J.forEach((ve, te) => {
2260
+ o("toggleDatasetVisibility", {
2261
+ datasetIndex: ve,
2262
+ datasetKey: D[te] ?? gt({
2263
+ datasetIndex: ve,
2264
+ label: l.text
2265
+ })
2266
+ });
2267
+ });
2268
+ return;
2269
+ }
2270
+ const le = Ut();
2271
+ if (!f) {
2272
+ if (J.length > 0) {
2273
+ const ve = l.hidden !== !0;
2274
+ J.forEach((te) => {
2275
+ const ce = le[te];
2276
+ ce && typeof ce == "object" && (ce.hidden = ve);
2277
+ }), Dt(
2278
+ (te) => Ee(te, 0) === Ee(l, 0),
2279
+ ve
2280
+ );
2281
+ }
2282
+ return;
2283
+ }
2284
+ if (J.length > 0) {
2285
+ const te = !J.every(
2286
+ (ce) => typeof f.isDatasetVisible == "function" ? f.isDatasetVisible(ce) : l.hidden !== !0
2287
+ );
2288
+ J.forEach((ce) => {
2289
+ rn(f, ce, te);
2290
+ const fe = le[ce];
2291
+ fe && typeof fe == "object" && (fe.hidden = !te);
2292
+ }), f.update(), Dt(
2293
+ (ce) => Ee(ce, 0) === Ee(l, 0),
2294
+ !te
2295
+ );
2296
+ }
2297
+ }
2298
+ function sn() {
2299
+ d.value = !0, We();
2300
+ }
2301
+ function Ne() {
2302
+ d.value = !1, v.value && (v.value.scrollTop = 0), We();
2303
+ }
2304
+ return Vt(() => {
2305
+ ot(), window.addEventListener("mousemove", Q), window.addEventListener("mouseup", ne);
2306
+ }), Se(
2307
+ () => [
2308
+ n.enabled,
2309
+ n.legendUpdateKey,
2310
+ n.hiddenDatasetKeys,
2311
+ n.hiddenDataPointIndexes,
2312
+ i.value
2313
+ ],
2314
+ () => {
2315
+ Lt();
2316
+ }
2317
+ ), no(() => {
2318
+ z.value = !1, T(), O({ height: 0, width: 0 }), window.removeEventListener("mousemove", Q), window.removeEventListener("mouseup", ne);
2319
+ }), (l, h) => H.value ? (Y(), re("div", {
2320
+ key: 0,
2321
+ ref_key: "legendPanelRef",
2322
+ ref: C,
2323
+ class: we(["chart-legend-panel relative z-[2] flex min-w-0 flex-col overflow-hidden pointer-events-auto", {
2324
+ "self-stretch h-full pt-2": x.value,
2325
+ "mb-2": !x.value && l.position === "top",
2326
+ "mt-2": !x.value && l.position === "bottom"
2327
+ }]),
2328
+ style: Ie(Tt.value)
2329
+ }, [
2330
+ j("div", {
2331
+ ref_key: "legendScrollShellRef",
2332
+ ref: w,
2333
+ class: "relative z-[2] flex flex-1 min-h-0 flex-col overflow-hidden"
2334
+ }, [
2335
+ j("div", {
2336
+ ref_key: "legendToggleMeasureRef",
2337
+ ref: p,
2338
+ class: "absolute invisible pointer-events-none left-0 top-0 z-[2] inline-flex max-w-full select-none"
2339
+ }, [
2340
+ j("button", xr, Te(s(a)("report.widget.legend.viewMore")), 1)
2341
+ ], 512),
2342
+ j("ul", {
2343
+ ref_key: "legendListRef",
2344
+ ref: v,
2345
+ class: we(["chart-legend-list m-0 flex list-none p-0", [
2346
+ x.value ? "flex-row flex-wrap justify-start gap-x-3 gap-y-2 pt-1" : "flex-wrap justify-center gap-x-2 gap-y-1 pt-1"
2347
+ ]]),
2348
+ style: Ie(nt.value),
2349
+ onScroll: $
2350
+ }, [
2351
+ (Y(!0), re(Ve, null, Ft(qe.value, (f, g) => (Y(), re("li", {
2352
+ key: Ee(f, g),
2353
+ class: we(["chart-legend-item relative z-[2] inline-flex max-w-full cursor-pointer select-none pointer-events-auto", {
2354
+ "opacity-45": f.hidden
2355
+ }]),
2356
+ "data-legend-data": "true"
2357
+ }, [
2358
+ j("button", {
2359
+ type: "button",
2360
+ class: we(["inline-flex max-w-full items-center gap-1.5 border-none bg-transparent p-0", { "justify-start text-left": x.value }]),
2361
+ "aria-pressed": f.hidden === !0 ? "false" : "true",
2362
+ onClick: Zt((R) => Ge(f, g), ["stop"])
2363
+ }, [
2364
+ n.usePointStyle !== !1 ? (Y(), re("span", {
2365
+ key: 0,
2366
+ class: "h-5 w-5 shrink-0 rounded-full",
2367
+ style: Ie({ backgroundColor: et(f, g) })
2368
+ }, null, 4)) : (Y(), re("span", {
2369
+ key: 1,
2370
+ class: "h-5 w-5 shrink-0 rounded-sm border border-solid border-gray-300",
2371
+ style: Ie({
2372
+ backgroundColor: et(f, g),
2373
+ borderColor: "#c7c7cc"
2374
+ })
2375
+ }, null, 4)),
2376
+ j("span", {
2377
+ class: we(["chart-legend-text leading-[1.4]", {
2378
+ "max-w-[120px] whitespace-nowrap overflow-hidden text-left": x.value,
2379
+ "whitespace-nowrap overflow-hidden": !x.value,
2380
+ "line-through": f.hidden
2381
+ }]),
2382
+ title: f.text ?? ""
2383
+ }, Te(f.text), 11, _r)
2384
+ ], 10, wr)
2385
+ ], 2))), 128)),
2386
+ m.value ? (Y(), re("li", Sr, [
2387
+ j("button", {
2388
+ type: "button",
2389
+ class: "inline-flex max-w-full cursor-pointer select-none underline items-center gap-1 rounded px-1 py-0.5 border-none bg-transparent text-fm-color-system-info-300 leading-[1.4] transition-colors hover:bg-black/5",
2390
+ style: { fontSize: "var(--legend-font-size)" },
2391
+ onClick: h[0] || (h[0] = Zt((f) => d.value ? Ne() : sn(), ["stop"]))
2392
+ }, Te(d.value ? s(a)("report.widget.legend.viewLess") : s(a)("report.widget.legend.viewMore")), 1)
2393
+ ])) : me("", !0)
2394
+ ], 38),
2395
+ N.value ? (Y(), re("div", {
2396
+ key: 0,
2397
+ class: "absolute top-0 right-0 h-full w-2 rounded-full bg-transparent",
2398
+ onMousedown: S
2399
+ }, [
2400
+ j("div", {
2401
+ class: "absolute left-0 w-full rounded-full bg-gray-500/60 cursor-pointer hover:bg-gray-500/85",
2402
+ style: Ie(V.value),
2403
+ onMousedown: Zt(G, ["stop"])
2404
+ }, null, 36)
2405
+ ], 32)) : me("", !0)
2406
+ ], 512)
2407
+ ], 6)) : me("", !0);
2408
+ }
2409
+ }), Me = /* @__PURE__ */ io(Dr, [["__scopeId", "data-v-a258ca90"]]);
2410
+ function Pr(e, t) {
2411
+ const { t: n } = it(), { breakpoints: o } = Nt(), a = L(!1), i = L(null), r = L(null);
2412
+ function c() {
2413
+ return wo(e.value) ?? r.value;
2414
+ }
2415
+ function d(v) {
2416
+ a.value = v, !v && (i.value = null, en(c()), r.value = null);
2417
+ }
2418
+ function m(v, p) {
2419
+ i.value = v, r.value = p ?? c(), a.value = !0;
2420
+ }
2421
+ function A(v) {
2422
+ en(c(), v.focusTarget);
2423
+ }
2424
+ function C() {
2425
+ en(c());
2426
+ }
2427
+ const w = b(() => ({
2428
+ viewFullDetailsLabel: o.value.xs || o.value.sm ? n("report.widget.comparisonTooltip.doubleClickViewBreakdown") : n("report.widget.comparisonTooltip.viewBreakdown"),
2429
+ onViewFullDetails: m,
2430
+ maxTooltipItems: s(t == null ? void 0 : t.maxTooltipItems)
2431
+ }));
2432
+ return {
2433
+ isTooltipDetailsSheetOpen: a,
2434
+ tooltipDetailsPayload: i,
2435
+ tooltipOptions: w,
2436
+ handleTooltipDetailsSheetVisibility: d,
2437
+ handleTooltipDetailsHover: A,
2438
+ handleTooltipDetailsLeave: C
2439
+ };
2440
+ }
2441
+ function Ir(e) {
2442
+ const t = L([]), n = b(() => new Set(t.value));
2443
+ function o(r, c) {
2444
+ return gt({
2445
+ datasetIndex: c,
2446
+ label: r == null ? void 0 : r.label
2447
+ });
2448
+ }
2449
+ function a(r, c) {
2450
+ return n.value.has(o(r, c));
2451
+ }
2452
+ function i({ datasetIndex: r, datasetKey: c }) {
2453
+ const d = c ?? o(e.value[r], r);
2454
+ if (n.value.has(d)) {
2455
+ t.value = t.value.filter((m) => m !== d);
2456
+ return;
2457
+ }
2458
+ t.value = [...t.value, d];
2459
+ }
2460
+ return Se(
2461
+ e,
2462
+ (r) => {
2463
+ const c = new Set(
2464
+ r.map((m, A) => o(m, A))
2465
+ ), d = t.value.filter((m) => c.has(m));
2466
+ d.length !== t.value.length && (t.value = d);
2467
+ },
2468
+ { immediate: !0 }
2469
+ ), {
2470
+ hiddenDatasetKeys: t,
2471
+ isDatasetHidden: a,
2472
+ toggleDatasetVisibility: i
2473
+ };
2474
+ }
2475
+ function Ot({ chartRef: e, model: t, baseDatasets: n }) {
2476
+ const o = b(() => t.value.maxTooltipItems), {
2477
+ isTooltipDetailsSheetOpen: a,
2478
+ tooltipDetailsPayload: i,
2479
+ tooltipOptions: r,
2480
+ handleTooltipDetailsSheetVisibility: c,
2481
+ handleTooltipDetailsHover: d,
2482
+ handleTooltipDetailsLeave: m
2483
+ } = Pr(e, {
2484
+ maxTooltipItems: o
2485
+ }), { datalabels: A, xCfg: C, yCfg: w, isTransposed: v, legend: p } = To(t.value), F = b(
2486
+ () => ko(t.value.isTransposed === !0, r.value)
2487
+ ), k = b(() => {
2488
+ const N = p.value.position;
2489
+ return !N || N === "top" || N === "bottom" || N === "left" || N === "right";
2490
+ }), M = b(() => p.value.position ?? "top"), z = b(
2491
+ () => M.value === "left" || M.value === "right"
2492
+ ), q = b(
2493
+ () => M.value === "top" || M.value === "left"
2494
+ ), { hiddenDatasetKeys: I, isDatasetHidden: H, toggleDatasetVisibility: x } = Ir(n), B = b(() => n.value.map((N, V) => ({
2495
+ ...N,
2496
+ hidden: H(N, V)
2497
+ })));
2498
+ return {
2499
+ isTooltipDetailsSheetOpen: a,
2500
+ tooltipDetailsPayload: i,
2501
+ handleTooltipDetailsSheetVisibility: c,
2502
+ handleTooltipDetailsHover: d,
2503
+ handleTooltipDetailsLeave: m,
2504
+ comparisonTooltip: F,
2505
+ datalabels: A,
2506
+ xCfg: C,
2507
+ yCfg: w,
2508
+ isTransposed: v,
2509
+ legend: p,
2510
+ useCustomLegend: k,
2511
+ legendPosition: M,
2512
+ isLegendSide: z,
2513
+ isLegendBeforeChart: q,
2514
+ hiddenDatasetKeys: I,
2515
+ toggleDatasetVisibility: x,
2516
+ datasets: B
2517
+ };
2518
+ }
2519
+ const Mr = { class: "widget-content" }, hn = 1, eo = "rgba(0, 0, 0, 0)", Br = /* @__PURE__ */ Be({
2520
+ __name: "WidgetBarchart",
2521
+ props: /* @__PURE__ */ ze({
2522
+ tileIndex: {}
2523
+ }, {
2524
+ modelValue: { required: !0 },
2525
+ modelModifiers: {}
2526
+ }),
2527
+ emits: ["update:modelValue"],
2528
+ setup(e) {
2529
+ const t = He(e, "modelValue"), n = L(null), o = b(() => {
2530
+ var u;
2531
+ return ((u = t.value.data) == null ? void 0 : u.datasets) ?? [];
2532
+ }), a = b(() => {
2533
+ var u;
2534
+ return ((u = t.value.data) == null ? void 0 : u.xAxis) ?? [];
2535
+ }), i = b(() => a.value.length === 1 && o.value.length > 1 && o.value.every((u) => u.values.length === 1 && u.isCompare !== !0)), r = b(() => i.value ? o.value.map((u) => u.name) : a.value), c = b(() => a.value.length === 1 && o.value.some((u) => u.isCompare === !0)), d = Ht("bar");
2536
+ function m(u) {
2537
+ return {
2538
+ label: `__comparison_gap__${u}`,
2539
+ data: [0],
2540
+ backgroundColor: eo,
2541
+ borderColor: eo,
2542
+ minBarLength: 0,
2543
+ barPercentage: hn,
2544
+ isSpacer: !0
2545
+ };
2546
+ }
2547
+ const A = b(() => o.value.length > 0 ? [
2548
+ ...o.value.map((u, y) => {
2549
+ const P = $t({
2550
+ datasets: o.value,
2551
+ datasetIndex: y
2552
+ }), W = ke({
2553
+ datasetIndex: P,
2554
+ isCompare: !1,
2555
+ metricCount: t.value.metricCount,
2556
+ mode: t.value.chartColorBinding
2557
+ }), $ = ke({
2558
+ datasetIndex: P,
2559
+ isCompare: !1,
2560
+ metricCount: t.value.metricCount,
2561
+ mode: ye.metric
2562
+ });
2563
+ let S = u.values;
2564
+ i.value && (S = o.value.map(
2565
+ (oe, ge) => ge === y ? u.values[0] : NaN
2566
+ ));
2567
+ const G = t.value.chartColorBinding === ye.breakdown, Q = Ct({
2568
+ fallbackIndex: P,
2569
+ metricCount: t.value.metricCount
2570
+ }), ne = S.map((oe) => oe === null ? NaN : Number(oe));
2571
+ return {
2572
+ label: u.name,
2573
+ data: ne,
2574
+ dash: !!u.isCompare,
2575
+ minBarLength: void 0,
2576
+ barPercentage: c.value ? hn : void 0,
2577
+ backgroundColor: G ? _t({
2578
+ breakdownIndex: Q,
2579
+ metricIndex: $,
2580
+ metricCount: t.value.metricCount,
2581
+ isCompare: u.isCompare,
2582
+ breakdownColors: t.value.chartBreakdownColors,
2583
+ useSecondaryMetricShades: t.value.chartUseSecondaryMetricShades,
2584
+ customColors: t.value.chartColors
2585
+ }) : Ze({
2586
+ index: W,
2587
+ isCompare: u.isCompare,
2588
+ customColors: t.value.chartColors
2589
+ })
2590
+ };
2591
+ })
2592
+ ] : []), {
2593
+ isTooltipDetailsSheetOpen: C,
2594
+ tooltipDetailsPayload: w,
2595
+ handleTooltipDetailsSheetVisibility: v,
2596
+ handleTooltipDetailsHover: p,
2597
+ handleTooltipDetailsLeave: F,
2598
+ comparisonTooltip: k,
2599
+ datalabels: M,
2600
+ xCfg: z,
2601
+ yCfg: q,
2602
+ isTransposed: I,
2603
+ legend: H,
2604
+ useCustomLegend: x,
2605
+ legendPosition: B,
2606
+ isLegendSide: N,
2607
+ isLegendBeforeChart: V,
2608
+ hiddenDatasetKeys: K,
2609
+ toggleDatasetVisibility: Z,
2610
+ datasets: X
2611
+ } = Ot({
2612
+ chartRef: n,
2613
+ model: t,
2614
+ baseDatasets: A
2615
+ }), O = b(() => {
2616
+ if (!c.value)
2617
+ return X.value;
2618
+ const u = [];
2619
+ return X.value.forEach((y, P) => {
2620
+ u.push({
2621
+ ...y,
2622
+ barPercentage: hn
2623
+ });
2624
+ const W = X.value[P + 1];
2625
+ y.dash === !0 && W && u.push(m(P));
2626
+ }), u;
2627
+ }), T = b(() => ({
2628
+ display: !1,
2629
+ labels: {
2630
+ filter: (u, y) => {
2631
+ var P, W;
2632
+ return !((W = (P = y.datasets) == null ? void 0 : P[u.datasetIndex ?? -1]) != null && W.isSpacer);
2633
+ }
2634
+ }
2635
+ }));
2636
+ return (u, y) => {
2637
+ var W, $, S, G, Q, ne;
2638
+ const P = ie("FmBarChart");
2639
+ return Y(), re(Ve, null, [
2640
+ j("div", Mr, [
2641
+ Qe(u.$slots, "menu"),
2642
+ j("div", {
2643
+ class: we(["chart-layout", {
2644
+ "chart-layout--side": s(x) && (s(H).display ?? !1) && s(N)
2645
+ }])
2646
+ }, [
2647
+ s(x) && (s(H).display ?? !1) && s(V) ? (Y(), de(Me, {
2648
+ key: 0,
2649
+ "chart-ref": n.value,
2650
+ enabled: s(H).display ?? !1,
2651
+ position: s(B),
2652
+ "text-color": (W = s(H).labels) == null ? void 0 : W.color,
2653
+ "font-size": (S = ($ = s(H).labels) == null ? void 0 : $.font) == null ? void 0 : S.size,
2654
+ "legend-update-key": s(X),
2655
+ "use-point-style": t.value.usePointStyle ?? !0,
2656
+ "chart-color-binding": t.value.chartColorBinding,
2657
+ "chart-colors": t.value.chartColors,
2658
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
2659
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
2660
+ "metric-count": t.value.metricCount,
2661
+ "hidden-dataset-keys": s(K),
2662
+ onToggleDatasetVisibility: s(Z)
2663
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : me("", !0),
2664
+ se(P, {
2665
+ ref_key: "chartRef",
2666
+ ref: n,
2667
+ class: "bar-chart",
2668
+ datasets: O.value,
2669
+ "x-axis": { categories: r.value },
2670
+ "x-cfg": s(z),
2671
+ "y-cfg": s(q),
2672
+ transpose: s(I),
2673
+ legend: T.value,
2674
+ tooltip: s(k),
2675
+ datalabels: s(M),
2676
+ plugins: [s(d)],
2677
+ "maintain-aspect-ratio": !1
2678
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "tooltip", "datalabels", "plugins"]),
2679
+ s(x) && (s(H).display ?? !1) && !s(V) ? (Y(), de(Me, {
2680
+ key: 1,
2681
+ "chart-ref": n.value,
2682
+ enabled: s(H).display ?? !1,
2683
+ position: s(B),
2684
+ "text-color": (G = s(H).labels) == null ? void 0 : G.color,
2685
+ "font-size": (ne = (Q = s(H).labels) == null ? void 0 : Q.font) == null ? void 0 : ne.size,
2686
+ "legend-update-key": s(X),
2687
+ "use-point-style": t.value.usePointStyle ?? !0,
2688
+ "chart-color-binding": t.value.chartColorBinding,
2689
+ "chart-colors": t.value.chartColors,
2690
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
2691
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
2692
+ "metric-count": t.value.metricCount,
2693
+ "hidden-dataset-keys": s(K),
2694
+ onToggleDatasetVisibility: s(Z)
2695
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : me("", !0)
2696
+ ], 2)
2697
+ ]),
2698
+ se(Wt, {
2699
+ "model-value": s(C),
2700
+ "details-payload": s(w),
2701
+ "onUpdate:modelValue": s(v),
2702
+ onValueHover: s(p),
2703
+ onValueLeave: s(F)
2704
+ }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
2705
+ ], 64);
2706
+ };
2707
+ }
2708
+ }), Ar = { class: "widget-content" }, Fr = /* @__PURE__ */ Be({
2709
+ __name: "WidgetCircular",
2710
+ props: /* @__PURE__ */ ze({
2711
+ tileIndex: {}
2712
+ }, {
2713
+ modelValue: { required: !0 },
2714
+ modelModifiers: {}
2715
+ }),
2716
+ emits: ["update:modelValue"],
2717
+ setup(e) {
2718
+ const t = He(e, "modelValue"), { breakpoints: n } = Nt(), o = L(null), a = L([]), { datalabels: i, legend: r } = To(t.value), c = b(() => {
2719
+ const I = Array.isArray(t.value.data.datasets) ? t.value.data.datasets.map((H) => H.name) : [];
2720
+ return I.length > 0 ? I : Array.isArray(t.value.data.metrics) ? t.value.data.metrics.map((H) => String(H)) : [];
2721
+ }), d = b(() => {
2722
+ let I = [];
2723
+ return Array.isArray(t.value.data.datasets) && t.value.data.datasets.length > 0 && (I = [
2724
+ {
2725
+ label: c.value[0] ?? (Array.isArray(t.value.data.metrics) && t.value.data.metrics.length > 0 ? String(t.value.data.metrics[0]) : "Series"),
2726
+ labels: c.value,
2727
+ data: t.value.data.datasets.map(
2728
+ (x, B) => a.value.includes(B) ? null : x.value
2729
+ ),
2730
+ backgroundColor: t.value.data.datasets.map(
2731
+ (x, B) => Ze({ index: B, customColors: t.value.chartColors })
2732
+ )
2733
+ }
2734
+ ]), I;
2735
+ });
2736
+ Se(
2737
+ () => t.value.data.datasets,
2738
+ (I) => {
2739
+ const H = new Set(
2740
+ Array.isArray(I) ? I.map((x, B) => B) : []
2741
+ );
2742
+ a.value = a.value.filter(
2743
+ (x) => H.has(x)
2744
+ );
2745
+ },
2746
+ { deep: !0 }
2747
+ );
2748
+ const m = b(() => typeof t.value.legendFontSize == "number" ? t.value.legendFontSize : n.value.lg ? 12 : 8), A = b(() => {
2749
+ const I = r.value.position;
2750
+ return !I || I === "top" || I === "bottom" || I === "left" || I === "right";
2751
+ }), C = b(() => r.value.display !== !1), w = b(() => A.value && C.value), v = b(() => r.value.position ?? "top"), p = b(
2752
+ () => v.value === "left" || v.value === "right"
2753
+ ), F = b(
2754
+ () => v.value === "top" || v.value === "left"
2755
+ ), k = b(() => {
2756
+ var H;
2757
+ const I = (H = r.value.labels) == null ? void 0 : H.color;
2758
+ return typeof I == "string" && I.trim().length > 0 ? I : t.value.legendColor ?? "#6b6b6b";
2759
+ }), M = b(() => m.value), z = da();
2760
+ function q({ itemIndex: I }) {
2761
+ if (a.value.includes(I)) {
2762
+ a.value = a.value.filter(
2763
+ (H) => H !== I
2764
+ );
2765
+ return;
2766
+ }
2767
+ a.value = [...a.value, I];
2768
+ }
2769
+ return (I, H) => {
2770
+ const x = ie("FmPieChart");
2771
+ return Y(), re("div", Ar, [
2772
+ Qe(I.$slots, "menu"),
2773
+ j("div", {
2774
+ class: we(["chart-layout", {
2775
+ "chart-layout--side": w.value && p.value
2776
+ }])
2777
+ }, [
2778
+ w.value && F.value ? (Y(), de(Me, {
2779
+ key: 0,
2780
+ "chart-ref": o.value,
2781
+ enabled: C.value,
2782
+ position: v.value,
2783
+ "text-color": k.value,
2784
+ "font-size": M.value,
2785
+ "legend-update-key": d.value,
2786
+ "use-point-style": t.value.usePointStyle ?? !0,
2787
+ "chart-color-binding": t.value.chartColorBinding,
2788
+ "chart-colors": t.value.chartColors,
2789
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
2790
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
2791
+ "metric-count": t.value.metricCount,
2792
+ "hidden-data-point-indexes": a.value,
2793
+ onToggleDataPointVisibility: q
2794
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-data-point-indexes"])) : me("", !0),
2795
+ se(x, {
2796
+ ref_key: "chartRef",
2797
+ ref: o,
2798
+ class: "circular",
2799
+ percentage: "70%",
2800
+ datasets: d.value,
2801
+ metrics: c.value,
2802
+ tooltip: s(z),
2803
+ variant: "doughnut",
2804
+ legend: {
2805
+ display: !1
2806
+ },
2807
+ datalabels: s(i),
2808
+ "maintain-aspect-ratio": !1
2809
+ }, null, 8, ["datasets", "metrics", "tooltip", "datalabels"]),
2810
+ w.value && !F.value ? (Y(), de(Me, {
2811
+ key: 1,
2812
+ "chart-ref": o.value,
2813
+ enabled: C.value,
2814
+ position: v.value,
2815
+ "text-color": k.value,
2816
+ "font-size": M.value,
2817
+ "legend-update-key": d.value,
2818
+ "use-point-style": t.value.usePointStyle ?? !0,
2819
+ "chart-color-binding": t.value.chartColorBinding,
2820
+ "chart-colors": t.value.chartColors,
2821
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
2822
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
2823
+ "metric-count": t.value.metricCount,
2824
+ "hidden-data-point-indexes": a.value,
2825
+ onToggleDataPointVisibility: q
2826
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-data-point-indexes"])) : me("", !0)
2827
+ ], 2)
2828
+ ]);
2829
+ };
2830
+ }
2831
+ });
2832
+ function tn(e) {
2833
+ if (e == null || e === "")
2834
+ return "";
2835
+ const t = String(e), n = Number(t);
2836
+ if (isNaN(n)) return t;
2837
+ const [o, a] = t.split("."), i = new Intl.NumberFormat("en-US").format(Number(o));
2838
+ return a !== void 0 ? `${i}.${a}` : i;
2839
+ }
2840
+ const Rr = { class: "flex flex-col gap-1" }, Vr = { class: "fm-typo-en-title-md-600" }, Nr = { class: "flex gap-2" }, $r = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, zr = { key: 0 }, Hr = { key: 1 }, Wr = /* @__PURE__ */ Be({
2841
+ __name: "WidgetScorecard",
2842
+ props: {
2843
+ modelValue: { required: !0 },
2844
+ modelModifiers: {}
2845
+ },
2846
+ emits: ["update:modelValue"],
2847
+ setup(e) {
2848
+ const t = He(e, "modelValue"), { t: n } = it(), { compareDateRange: o, defaultDateSetting: a } = At(nn()), { country: i } = lo(), r = b(() => {
2849
+ var p;
2850
+ return ((p = t.value.data) == null ? void 0 : p.value) || "";
2851
+ }), c = b(() => tn(r.value)), d = b(() => {
2852
+ const { data: p } = t.value;
2853
+ return p != null && p.comparison ? go(r.value, p.comparison, i) : null;
2854
+ });
2855
+ function m(p) {
2856
+ switch (p) {
2857
+ case yn.bar:
2858
+ return "bar";
2859
+ case yn.line:
2860
+ return "line";
2861
+ default:
2862
+ return "line";
2863
+ }
2864
+ }
2865
+ const A = b(() => {
2866
+ var p;
2867
+ return (p = t.value.data) == null ? void 0 : p.sparkline;
2868
+ }), C = b(() => ({
2869
+ display: !1,
2870
+ beginAtZero: !1,
2871
+ grace: "20%"
2872
+ })), w = b(() => A.value.datasets.map((p) => ({
2873
+ label: p.name,
2874
+ data: p.values,
2875
+ fill: !0,
2876
+ color: "#36a2eb"
2877
+ }))), v = b(() => ko(!1));
2878
+ return (p, F) => {
2879
+ const k = ie("FmIcon"), M = ie("FmChip"), z = ie("FmTooltip"), q = ie("FmLineChart");
2880
+ return Y(), re("div", Rr, [
2881
+ Qe(p.$slots, "menu"),
2882
+ j("p", Vr, Te(c.value), 1),
2883
+ j("div", Nr, [
2884
+ se(z, {
2885
+ disabled: d.value === null,
2886
+ placement: "right",
2887
+ "hide-arrow": "",
2888
+ variant: "rich"
2889
+ }, {
2890
+ content: xe(() => {
2891
+ var I;
2892
+ return [
2893
+ j("span", $r, Te(`vs. ${(I = s(a).defaultCompareType) == null ? void 0 : I.split("_").join(" ")}`), 1)
2894
+ ];
2895
+ }),
2896
+ default: xe(() => [
2897
+ d.value ? (Y(), de(M, {
2898
+ key: 0,
2899
+ icon: d.value.icon.name,
2900
+ class: we(`bg-${d.value.icon.tailwind}`),
2901
+ compact: ""
2902
+ }, {
2903
+ default: xe(() => [
2904
+ se(k, {
2905
+ name: d.value.icon.name,
2906
+ color: d.value.icon.color
2907
+ }, null, 8, ["name", "color"]),
2908
+ j("p", {
2909
+ class: "fm-typo-en-body-md-600",
2910
+ style: Ie({ color: d.value.icon.color })
2911
+ }, Te(d.value.value), 5)
2912
+ ]),
2913
+ _: 1
2914
+ }, 8, ["icon", "class"])) : me("", !0),
2915
+ s(o).endDate != null && s(o).startDate != null && d.value === null ? (Y(), de(M, {
2916
+ key: 1,
2917
+ class: "invisible pointer-events-none",
2918
+ "aria-hidden": "true",
2919
+ compact: ""
2920
+ }, {
2921
+ default: xe(() => [
2922
+ se(k, {
2923
+ name: "arrow_upward",
2924
+ color: "#C7C7CC"
2925
+ }),
2926
+ F[0] || (F[0] = j("p", { class: "fm-typo-en-body-md-600" }, " ", -1))
2927
+ ]),
2928
+ _: 1
2929
+ })) : me("", !0)
2930
+ ]),
2931
+ _: 1
2932
+ }, 8, ["disabled"])
2933
+ ]),
2934
+ A.value ? (Y(), re("div", zr, [
2935
+ m(A.value.type) === "line" ? (Y(), de(q, {
2936
+ key: 0,
2937
+ class: "sparkline",
2938
+ datasets: w.value,
2939
+ legend: {
2940
+ display: !1
2941
+ },
2942
+ datalabels: { display: !1 },
2943
+ "x-axis": { categories: A.value.dimensions },
2944
+ "y-cfg": C.value,
2945
+ "x-cfg": { display: !1 },
2946
+ tooltip: v.value,
2947
+ "maintain-aspect-ratio": !1
2948
+ }, null, 8, ["datasets", "x-axis", "y-cfg", "tooltip"])) : me("", !0)
2949
+ ])) : (Y(), re("div", Hr, F[1] || (F[1] = [
2950
+ j("div", { class: "sparkline" }, [
2951
+ j("div", { class: "flex flex-col gap-8" }, [
2952
+ j("div"),
2953
+ j("div")
2954
+ ]),
2955
+ j("div", { class: "grow" })
2956
+ ], -1)
2957
+ ])))
2958
+ ]);
2959
+ };
2960
+ }
2961
+ }), Or = {};
2962
+ function Ur(e, t) {
2963
+ const n = ie("FmMenuDivider");
2964
+ return Y(), de(n);
2965
+ }
2966
+ const Kr = /* @__PURE__ */ io(Or, [["render", Ur]]), Xr = "/assets/processTableData.worker-BlwP8Wjn.js", Yr = { class: "my-4" }, Er = {
2967
+ class: "border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm",
2968
+ style: { backgroundColor: "#f9f9f9" }
2969
+ }, qr = { class: "font-bold" }, Gr = { class: "text-fm-color-neutral-gray-300" }, jr = /* @__PURE__ */ Be({
2970
+ __name: "WidgetTable",
2971
+ props: /* @__PURE__ */ ze({
2972
+ tileIndex: {}
2973
+ }, {
2974
+ modelValue: { required: !0 },
2975
+ modelModifiers: {}
2976
+ }),
2977
+ emits: ["update:modelValue"],
2978
+ setup(e) {
2979
+ const { t, te: n } = it(), o = He(e, "modelValue"), { country: a } = lo(), { clearTileSorts: i, setTileSorts: r } = Xo(), c = Ln(), d = e, m = L([]), A = L(null), C = b(() => {
2980
+ var u;
2981
+ return ((u = o.value.data) == null ? void 0 : u.columns) || [{ label: "", key: "" }];
2982
+ }), w = b(() => {
2983
+ var u;
2984
+ return ((u = o.value.data) == null ? void 0 : u.rows) || [];
2985
+ }), v = b(() => o.value.colWidths ?? null), p = b(
2986
+ () => o.value.rowHeight && o.value.rowHeight > 0 ? o.value.rowHeight : 48
2987
+ );
2988
+ function F() {
2989
+ const u = `${p.value}px`;
2990
+ return {
2991
+ height: u,
2992
+ minHeight: u
2993
+ };
2994
+ }
2995
+ function k(u) {
2996
+ var P;
2997
+ const y = u ? (P = v.value) == null ? void 0 : P[u] : void 0;
2998
+ if (!(!y || y <= 0))
2999
+ return `${y}px`;
3000
+ }
3001
+ function M(u) {
3002
+ const y = k(u);
3003
+ if (y)
3004
+ return {
3005
+ boxSizing: "border-box",
3006
+ width: y,
3007
+ minWidth: y,
3008
+ maxWidth: y
3009
+ };
3010
+ }
3011
+ const z = b(() => o.value.filterText), q = b(() => {
3012
+ var y;
3013
+ const u = (y = o.value.grandTotalLabel) == null ? void 0 : y.trim();
3014
+ return u && u.length > 0 ? u : lt(t, n, "Grand total", "other");
3015
+ }), I = b(() => {
3016
+ var u, y;
3017
+ if (!(z.value && z.value.trim().length > 0 || !((u = w.value[0]) != null && u.isRollup) && !((y = w.value[w.value.length - 1]) != null && y.isRollup))) {
3018
+ if (o.value.rollupPosition === Je.top || o.value.rollupPosition === void 0)
3019
+ return Je.top;
3020
+ if (o.value.rollupPosition === Je.bottom)
3021
+ return Je.bottom;
3022
+ }
3023
+ }), H = b(() => {
3024
+ const u = p.value, y = 34.5, P = 32, W = I.value !== void 0 ? 1 : 0, $ = (A.value ? A.value.$el.offsetHeight : 0) - u;
3025
+ return Math.floor(($ - y - P) / u) - W;
3026
+ }), x = b(() => {
3027
+ var y, P;
3028
+ let u = [];
3029
+ switch (I.value) {
3030
+ case Je.top:
3031
+ u = [...((y = w.value[0]) == null ? void 0 : y.cells) || []].map((W, $) => {
3032
+ var S;
3033
+ return {
3034
+ main: W,
3035
+ comparison: (S = w.value[0]) == null ? void 0 : S.comparisonCells[$],
3036
+ rowType: C.value[$].type
3037
+ };
3038
+ });
3039
+ break;
3040
+ case Je.bottom:
3041
+ u = [...((P = w.value[w.value.length - 1]) == null ? void 0 : P.cells) || []].map((W, $) => {
3042
+ var S;
3043
+ return {
3044
+ main: W,
3045
+ comparison: (S = w.value[w.value.length - 1]) == null ? void 0 : S.comparisonCells[$],
3046
+ rowType: C.value[$].type
3047
+ };
3048
+ });
3049
+ break;
3050
+ }
3051
+ return u.length > 0 && u[0].main === "" && (u[0].main = q.value), u;
3052
+ });
3053
+ function B(u) {
3054
+ let y = (u == null ? void 0 : u.main) || "";
3055
+ return !u || u.main === "" || !u.comparison ? {
3056
+ main: y
3057
+ } : (y.includes("#") && !y.startsWith("#") && (y = y.split("#")[0]), {
3058
+ main: y,
3059
+ comparison: u == null ? void 0 : u.comparison,
3060
+ difference: go(u.main, u.comparison, s(a))
3061
+ });
3062
+ }
3063
+ Vt(() => {
3064
+ i();
3065
+ });
3066
+ const N = L([]);
3067
+ let V = 0, K;
3068
+ function Z() {
3069
+ var $;
3070
+ if (!(($ = o.value) != null && $.data)) {
3071
+ N.value = [];
3072
+ return;
3073
+ }
3074
+ const u = ++V, y = (o.value.data.rows || []).map((S) => ({
3075
+ isRollup: S.isRollup,
3076
+ cells: Array.isArray(S.cells) ? [...S.cells] : [],
3077
+ comparisonCells: Array.isArray(S.comparisonCells) ? [...S.comparisonCells] : []
3078
+ })), P = (o.value.data.columns || []).map((S) => ({
3079
+ key: S.key,
3080
+ type: S.type,
3081
+ label: S.label
3082
+ })), W = {
3083
+ rows: y,
3084
+ columns: P,
3085
+ filter: z.value ?? "",
3086
+ globalSorts: Ho(m.value).map((S) => ({
3087
+ key: S.key,
3088
+ type: S.type
3089
+ })),
3090
+ grandTotalPosition: I.value,
3091
+ pageSize: H.value
3092
+ };
3093
+ Yo(Xr, W).then((S) => {
3094
+ u === V && (S != null && S.error ? (c.open({ message: "Failed to process table data. Please retry.", type: "error" }), console.log(S.error), N.value = []) : N.value = Wo(S.data || []));
3095
+ });
3096
+ }
3097
+ Se(
3098
+ () => m.value,
3099
+ (u) => {
3100
+ d.tileIndex === void 0 || d.tileIndex === null || r(d.tileIndex, u);
3101
+ },
3102
+ { immediate: !0, deep: !0 }
3103
+ );
3104
+ const X = b(() => {
3105
+ var P, W;
3106
+ const u = ((P = o.value.data) == null ? void 0 : P.rows) || [], y = ((W = o.value.data) == null ? void 0 : W.columns) || [];
3107
+ return JSON.stringify({
3108
+ rowsLength: u.length,
3109
+ columns: y.map(($) => ({ key: $.key, type: $.type, label: $.label })),
3110
+ filter: z.value ?? "",
3111
+ globalSorts: m.value.map(($) => ({ key: $.key, type: $.type })),
3112
+ grandTotalPosition: I.value,
3113
+ pageSize: H.value
3114
+ });
3115
+ });
3116
+ Se(
3117
+ () => X.value,
3118
+ () => {
3119
+ clearTimeout(K), K = setTimeout(Z, 200);
3120
+ },
3121
+ { immediate: !0 }
3122
+ );
3123
+ function O(u) {
3124
+ const y = m.value.find((P) => P.key === u);
3125
+ if (!y) {
3126
+ m.value.push({ key: u, type: It.Asc });
3127
+ return;
3128
+ }
3129
+ y.type === It.Asc ? y.type = It.Desc : y.type === It.Desc && (m.value = m.value.filter((P) => P.key !== u));
3130
+ }
3131
+ const T = b(() => {
3132
+ var u;
3133
+ return (u = o.value.data) != null && u.columns ? o.value.data.columns.map((y, P) => {
3134
+ const W = lt(t, n, y.label, "other"), $ = m.value.find((ne) => ne.key === y.key), S = !!$, G = M(y.key), Q = S ? $.type === It.Asc ? "arrow_upward" : "arrow_downward" : "unfold_more";
3135
+ return {
3136
+ accessorKey: y.key,
3137
+ header: () => {
3138
+ const ne = ie("FmIcon");
3139
+ return qt(
3140
+ "button",
3141
+ {
3142
+ type: "button",
3143
+ class: `w-full flex items-center gap-1 group/select-header select-none ${y.type === "NUMERIC" ? "justify-end" : "justify-start"} ${S ? "text-fm-color-typo-primary" : "text-fm-color-neutral-gray-400"}`,
3144
+ onClick: () => O(y.key)
3145
+ },
3146
+ [
3147
+ qt(
3148
+ "span",
3149
+ { class: `${y.type === "NUMERIC" ? "text-right" : ""} whitespace-nowrap` },
3150
+ W
3151
+ ),
3152
+ qt(ne, {
3153
+ name: Q,
3154
+ color: S ? "primary" : "neutral-gray-400",
3155
+ size: "sm",
3156
+ class: "transition-transform",
3157
+ style: Q === "arrow_upward" ? "transform: translateY(-1px);" : ""
3158
+ })
3159
+ ]
3160
+ );
3161
+ },
3162
+ cell: (ne) => {
3163
+ var ae, pe;
3164
+ const oe = B(ne.getValue()), ge = (pe = (ae = ne == null ? void 0 : ne.row) == null ? void 0 : ae.original) == null ? void 0 : pe.isRollup;
3165
+ return qt(
3166
+ "div",
3167
+ {
3168
+ class: [
3169
+ ge ? "fm-typo-en-body-md-600 text-fm-color-typo-primary" : "fm-typo-en-body-md-400",
3170
+ y.type === "NUMERIC" ? "text-right justify-end" : "",
3171
+ "flex items-center w-full min-w-0",
3172
+ "whitespace-nowrap"
3173
+ ].join(" "),
3174
+ style: F()
3175
+ },
3176
+ [y.type === "NUMERIC" ? tn(oe.main) : oe.main]
3177
+ );
3178
+ },
3179
+ meta: G,
3180
+ enableSorting: !1
3181
+ };
3182
+ }) : [];
3183
+ });
3184
+ return (u, y) => {
3185
+ const P = ie("FmTable");
3186
+ return Y(), re(Ve, null, [
3187
+ j("div", Yr, [
3188
+ Qe(u.$slots, "menu")
3189
+ ]),
3190
+ se(P, {
3191
+ ref_key: "table",
3192
+ ref: A,
3193
+ "column-defs": T.value,
3194
+ "row-data": N.value,
3195
+ "search-value": z.value,
3196
+ "page-size": H.value,
3197
+ "shrink-at": !1,
3198
+ "force-mobile-footer": !0,
3199
+ class: "scrollbar-hide-table",
3200
+ "pin-header-row": !0,
3201
+ "auto-reset-page-index": !0
3202
+ }, zo({ _: 2 }, [
3203
+ I.value ? {
3204
+ name: "pin-top",
3205
+ fn: xe(() => [
3206
+ (Y(), de(oo(I.value === s(Je).bottom ? "tfoot" : "tbody"), null, {
3207
+ default: xe(() => [
3208
+ j("tr", Er, [
3209
+ (Y(!0), re(Ve, null, Ft(x.value, (W, $) => {
3210
+ var S;
3211
+ return Y(), re("td", {
3212
+ key: `${s(Bt)()}_${$}`,
3213
+ class: "text-fm-color-typo-primary px-16",
3214
+ style: Ie({ ...F(), ...M((S = C.value[$]) == null ? void 0 : S.key) })
3215
+ }, [
3216
+ j("span", {
3217
+ class: we([
3218
+ "flex items-center text-fm-color-typo-secondary gap-2",
3219
+ W.rowType === "NUMERIC" ? "text-right justify-end" : "",
3220
+ "w-full min-w-0",
3221
+ "whitespace-nowrap"
3222
+ ]),
3223
+ style: Ie(F())
3224
+ }, [
3225
+ j("p", qr, Te(W.rowType === "NUMERIC" ? s(tn)(W.main) : W.main), 1),
3226
+ j("p", Gr, Te(W.comparison ? W.rowType === "NUMERIC" ? `(${s(tn)(W.comparison)})` : `(${W.comparison})` : ""), 1)
3227
+ ], 6)
3228
+ ], 4);
3229
+ }), 128))
3230
+ ])
3231
+ ]),
3232
+ _: 1
3233
+ }))
3234
+ ]),
3235
+ key: "0"
3236
+ } : void 0
3237
+ ]), 1032, ["column-defs", "row-data", "search-value", "page-size"])
3238
+ ], 64);
3239
+ };
3240
+ }
3241
+ }), Jr = { class: "widget-content" }, Zr = /* @__PURE__ */ Be({
3242
+ __name: "WidgetStackBarChart",
3243
+ props: /* @__PURE__ */ ze({
3244
+ tileIndex: {}
3245
+ }, {
3246
+ modelValue: { required: !0 },
3247
+ modelModifiers: {}
3248
+ }),
3249
+ emits: ["update:modelValue"],
3250
+ setup(e) {
3251
+ const t = He(e, "modelValue"), n = L(null), o = b(() => {
3252
+ var u;
3253
+ return ((u = t.value.data) == null ? void 0 : u.xAxis) || [];
3254
+ }), a = b(() => {
3255
+ var T;
3256
+ return ((T = t.value.data) == null ? void 0 : T.datasets) ?? [];
3257
+ }), i = Ht("bar"), r = b(() => t.value.stackBarOverlap === !0), c = b(() => r.value === !1), d = b(() => ({
3258
+ ...q.value,
3259
+ stacked: c.value
3260
+ })), m = b(() => ({
3261
+ ...I.value,
3262
+ stacked: c.value
3263
+ }));
3264
+ function A({
3265
+ datasetIndex: T,
3266
+ colorIndex: u,
3267
+ breakdownIndex: y
3268
+ }) {
3269
+ var S;
3270
+ const P = t.value.chartColorBinding === ye.metric ? u : t.value.chartColorBinding === ye.breakdown ? y : T, W = (S = t.value.chartColorLayers) == null ? void 0 : S[P], $ = Number(W);
3271
+ return Number.isInteger($) && $ > 0 ? $ : P + 1;
3272
+ }
3273
+ const C = b(() => {
3274
+ if (a.value.length > 0) {
3275
+ const T = a.value.map((u, y) => {
3276
+ const P = $t({
3277
+ datasets: a.value,
3278
+ datasetIndex: y
3279
+ }), W = ke({
3280
+ datasetIndex: P,
3281
+ isCompare: !1,
3282
+ metricCount: t.value.metricCount,
3283
+ mode: t.value.chartColorBinding
3284
+ }), $ = ke({
3285
+ datasetIndex: P,
3286
+ isCompare: !1,
3287
+ metricCount: t.value.metricCount,
3288
+ mode: ye.metric
3289
+ }), S = Ct({
3290
+ fallbackIndex: P,
3291
+ metricCount: t.value.metricCount
3292
+ }), G = A({
3293
+ datasetIndex: P,
3294
+ colorIndex: W,
3295
+ breakdownIndex: S
3296
+ }), ne = u.values.map((oe) => oe === null ? NaN : Number(oe));
3297
+ return {
3298
+ dataset: {
3299
+ label: u.name,
3300
+ data: ne,
3301
+ dash: !!u.isCompare,
3302
+ minBarLength: void 0,
3303
+ grouped: r.value ? !1 : void 0,
3304
+ order: r.value ? G : void 0,
3305
+ backgroundColor: t.value.chartColorBinding === ye.breakdown ? _t({
3306
+ breakdownIndex: S,
3307
+ metricIndex: $,
3308
+ metricCount: t.value.metricCount,
3309
+ isCompare: u.isCompare,
3310
+ breakdownColors: t.value.chartBreakdownColors,
3311
+ useSecondaryMetricShades: t.value.chartUseSecondaryMetricShades,
3312
+ customColors: t.value.chartColors
3313
+ }) : Ze({
3314
+ index: W,
3315
+ isCompare: u.isCompare,
3316
+ customColors: t.value.chartColors
3317
+ })
3318
+ }
3319
+ };
3320
+ });
3321
+ return r.value ? T.map((u) => u.dataset) : T.map((u) => u.dataset);
3322
+ } else
3323
+ return [];
3324
+ }), {
3325
+ isTooltipDetailsSheetOpen: w,
3326
+ tooltipDetailsPayload: v,
3327
+ handleTooltipDetailsSheetVisibility: p,
3328
+ handleTooltipDetailsHover: F,
3329
+ handleTooltipDetailsLeave: k,
3330
+ comparisonTooltip: M,
3331
+ datalabels: z,
3332
+ xCfg: q,
3333
+ yCfg: I,
3334
+ isTransposed: H,
3335
+ legend: x,
3336
+ useCustomLegend: B,
3337
+ legendPosition: N,
3338
+ isLegendSide: V,
3339
+ isLegendBeforeChart: K,
3340
+ hiddenDatasetKeys: Z,
3341
+ toggleDatasetVisibility: X,
3342
+ datasets: O
3343
+ } = Ot({
3344
+ chartRef: n,
3345
+ model: t,
3346
+ baseDatasets: C
3347
+ });
3348
+ return (T, u) => {
3349
+ var P, W, $, S, G, Q;
3350
+ const y = ie("FmBarChart");
3351
+ return Y(), re(Ve, null, [
3352
+ j("div", Jr, [
3353
+ Qe(T.$slots, "menu"),
3354
+ j("div", {
3355
+ class: we(["chart-layout", {
3356
+ "chart-layout--side": s(B) && (s(x).display ?? !1) && s(V)
3357
+ }])
3358
+ }, [
3359
+ s(B) && (s(x).display ?? !1) && s(K) ? (Y(), de(Me, {
3360
+ key: 0,
3361
+ "chart-ref": n.value,
3362
+ enabled: s(x).display ?? !1,
3363
+ position: s(N),
3364
+ "text-color": (P = s(x).labels) == null ? void 0 : P.color,
3365
+ "font-size": ($ = (W = s(x).labels) == null ? void 0 : W.font) == null ? void 0 : $.size,
3366
+ "legend-update-key": s(O),
3367
+ "use-point-style": t.value.usePointStyle ?? !0,
3368
+ "chart-color-binding": t.value.chartColorBinding,
3369
+ "chart-colors": t.value.chartColors,
3370
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
3371
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3372
+ "metric-count": t.value.metricCount,
3373
+ "hidden-dataset-keys": s(Z),
3374
+ onToggleDatasetVisibility: s(X)
3375
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : me("", !0),
3376
+ se(y, {
3377
+ ref_key: "chartRef",
3378
+ ref: n,
3379
+ class: "bar-chart",
3380
+ datasets: s(O),
3381
+ "x-axis": { categories: o.value },
3382
+ "x-cfg": d.value,
3383
+ "y-cfg": m.value,
3384
+ transpose: s(H),
3385
+ stacked: c.value,
3386
+ legend: {
3387
+ display: !1
3388
+ },
3389
+ tooltip: s(M),
3390
+ plugins: [s(i)],
3391
+ datalabels: s(z),
3392
+ "maintain-aspect-ratio": !1
3393
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "stacked", "tooltip", "plugins", "datalabels"]),
3394
+ s(B) && (s(x).display ?? !1) && !s(K) ? (Y(), de(Me, {
3395
+ key: 1,
3396
+ "chart-ref": n.value,
3397
+ enabled: s(x).display ?? !1,
3398
+ position: s(N),
3399
+ "text-color": (S = s(x).labels) == null ? void 0 : S.color,
3400
+ "font-size": (Q = (G = s(x).labels) == null ? void 0 : G.font) == null ? void 0 : Q.size,
3401
+ "legend-update-key": s(O),
3402
+ "use-point-style": t.value.usePointStyle ?? !0,
3403
+ "chart-color-binding": t.value.chartColorBinding,
3404
+ "chart-colors": t.value.chartColors,
3405
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
3406
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3407
+ "metric-count": t.value.metricCount,
3408
+ "hidden-dataset-keys": s(Z),
3409
+ onToggleDatasetVisibility: s(X)
3410
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : me("", !0)
3411
+ ], 2)
3412
+ ]),
3413
+ se(Wt, {
3414
+ "model-value": s(w),
3415
+ "details-payload": s(v),
3416
+ "onUpdate:modelValue": s(p),
3417
+ onValueHover: s(F),
3418
+ onValueLeave: s(k)
3419
+ }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
3420
+ ], 64);
3421
+ };
3422
+ }
3423
+ }), Qr = { class: "widget-content" }, pn = 1, to = "rgba(0, 0, 0, 0)", el = /* @__PURE__ */ Be({
3424
+ __name: "WidgetClusteredStackBarchart",
3425
+ props: /* @__PURE__ */ ze({
3426
+ tileIndex: {}
3427
+ }, {
3428
+ modelValue: { required: !0 },
3429
+ modelModifiers: {}
3430
+ }),
3431
+ emits: ["update:modelValue"],
3432
+ setup(e) {
3433
+ const t = He(e, "modelValue"), n = L(null), o = b(() => {
3434
+ var S;
3435
+ return ((S = t.value.data) == null ? void 0 : S.xAxis) || [];
3436
+ }), a = b(() => {
3437
+ var S;
3438
+ return ((S = t.value.data) == null ? void 0 : S.datasets) ?? [];
3439
+ }), i = Ht("bar"), r = b(() => t.value.stackBarOverlap === !0), c = b(() => r.value === !1), d = b(() => o.value.length === 1 && a.value.some((S) => S.isCompare === !0)), m = b(() => ({
3440
+ ...B.value,
3441
+ stacked: c.value
3442
+ })), A = b(() => ({
3443
+ ...N.value,
3444
+ stacked: c.value
3445
+ }));
3446
+ function C(S) {
3447
+ const G = " - ", Q = S.lastIndexOf(G);
3448
+ return Q < 0 ? {
3449
+ clusterKey: S,
3450
+ metricLabel: S
3451
+ } : {
3452
+ clusterKey: S.slice(0, Q),
3453
+ metricLabel: S.slice(Q + G.length)
3454
+ };
3455
+ }
3456
+ function w(S, G) {
3457
+ if (typeof S == "string") {
3458
+ const Q = S.trim();
3459
+ if (Q.length > 0)
3460
+ return Q;
3461
+ }
3462
+ return `Series ${G + 1}`;
3463
+ }
3464
+ function v({
3465
+ datasetIndex: S,
3466
+ colorIndex: G
3467
+ }) {
3468
+ var ge;
3469
+ const Q = t.value.chartColorBinding === ye.metric ? G : S, ne = (ge = t.value.chartColorLayers) == null ? void 0 : ge[Q], oe = Number(ne);
3470
+ return Number.isInteger(oe) && oe > 0 ? oe : Q + 1;
3471
+ }
3472
+ function p(S) {
3473
+ return {
3474
+ label: `__comparison_gap__${S}`,
3475
+ tooltipLabel: `__comparison_gap__${S}`,
3476
+ data: [0],
3477
+ grouped: !0,
3478
+ stack: `__comparison_gap__${S}`,
3479
+ backgroundColor: to,
3480
+ borderColor: to,
3481
+ minBarLength: 0,
3482
+ barPercentage: pn,
3483
+ isSpacer: !0
3484
+ };
3485
+ }
3486
+ const F = b(() => {
3487
+ if (a.value.length === 0)
3488
+ return [];
3489
+ const S = a.value.map((ae, pe) => ({
3490
+ source: ae,
3491
+ index: pe,
3492
+ name: w(ae == null ? void 0 : ae.name, pe),
3493
+ values: (ae == null ? void 0 : ae.values) ?? []
3494
+ })), G = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map();
3495
+ for (const ae of S) {
3496
+ const { clusterKey: pe, metricLabel: be } = C(ae.name);
3497
+ Q.has(pe) || Q.set(pe, Q.size), G.has(be) || G.set(be, G.size);
3498
+ }
3499
+ const ne = Math.max(G.size, 1), oe = t.value.chartColorBinding === ye.breakdown, ge = t.value.chartUseSecondaryMetricShades !== !1;
3500
+ return S.map((ae) => {
3501
+ var Xe;
3502
+ const pe = $t({
3503
+ datasets: a.value,
3504
+ datasetIndex: ae.index
3505
+ }), be = co({
3506
+ datasets: a.value,
3507
+ datasetIndex: ae.index
3508
+ }), Ae = ke({
3509
+ datasetIndex: pe,
3510
+ isCompare: !1,
3511
+ metricCount: t.value.metricCount,
3512
+ mode: t.value.chartColorBinding
3513
+ }), { clusterKey: Ue, metricLabel: et } = C(ae.name), _e = ((Xe = S[be]) == null ? void 0 : Xe.name) ?? ae.name, { clusterKey: St, metricLabel: Ke } = C(_e), tt = ke({
3514
+ datasetIndex: pe,
3515
+ isCompare: !1,
3516
+ metricCount: ne,
3517
+ mode: ye.breakdown
3518
+ }), ut = G.get(Ke) ?? 0, ct = oe ? _t({
3519
+ breakdownIndex: tt,
3520
+ metricIndex: ut,
3521
+ metricCount: ne,
3522
+ isCompare: ae.source.isCompare,
3523
+ breakdownColors: t.value.chartBreakdownColors,
3524
+ useSecondaryMetricShades: ge,
3525
+ colorMode: "clustered"
3526
+ }) : Ze({
3527
+ index: Ae,
3528
+ isCompare: ae.source.isCompare,
3529
+ customColors: t.value.chartColors
3530
+ }), dt = v({
3531
+ datasetIndex: pe,
3532
+ colorIndex: Ae
3533
+ }), ft = ae.values.map((Ye) => Ye === null ? NaN : Number(Ye));
3534
+ return {
3535
+ label: ae.name,
3536
+ tooltipLabel: `${Ue} - ${et}`,
3537
+ data: ft,
3538
+ dash: !!ae.source.isCompare,
3539
+ minBarLength: void 0,
3540
+ barPercentage: d.value ? pn : void 0,
3541
+ grouped: !0,
3542
+ order: r.value ? dt : void 0,
3543
+ stack: ae.source.isCompare ? `${Ue}__compare` : `${Ue}__main`,
3544
+ backgroundColor: ct
3545
+ };
3546
+ });
3547
+ }), {
3548
+ isTooltipDetailsSheetOpen: k,
3549
+ tooltipDetailsPayload: M,
3550
+ handleTooltipDetailsSheetVisibility: z,
3551
+ handleTooltipDetailsHover: q,
3552
+ handleTooltipDetailsLeave: I,
3553
+ comparisonTooltip: H,
3554
+ datalabels: x,
3555
+ xCfg: B,
3556
+ yCfg: N,
3557
+ isTransposed: V,
3558
+ legend: K,
3559
+ useCustomLegend: Z,
3560
+ legendPosition: X,
3561
+ isLegendSide: O,
3562
+ isLegendBeforeChart: T,
3563
+ hiddenDatasetKeys: u,
3564
+ toggleDatasetVisibility: y,
3565
+ datasets: P
3566
+ } = Ot({
3567
+ chartRef: n,
3568
+ model: t,
3569
+ baseDatasets: F
3570
+ }), W = b(() => {
3571
+ if (!d.value)
3572
+ return P.value;
3573
+ const S = [];
3574
+ return P.value.forEach((G, Q) => {
3575
+ S.push({
3576
+ ...G,
3577
+ barPercentage: pn
3578
+ });
3579
+ const ne = P.value[Q + 1];
3580
+ G.dash === !0 && ne && S.push(p(Q));
3581
+ }), S;
3582
+ }), $ = b(() => ({
3583
+ display: !1,
3584
+ labels: {
3585
+ filter: (S, G) => {
3586
+ var Q, ne;
3587
+ return !((ne = (Q = G.datasets) == null ? void 0 : Q[S.datasetIndex ?? -1]) != null && ne.isSpacer);
3588
+ }
3589
+ }
3590
+ }));
3591
+ return (S, G) => {
3592
+ var ne, oe, ge, ae, pe, be;
3593
+ const Q = ie("FmBarChart");
3594
+ return Y(), re(Ve, null, [
3595
+ j("div", Qr, [
3596
+ Qe(S.$slots, "menu"),
3597
+ j("div", {
3598
+ class: we(["chart-layout", {
3599
+ "chart-layout--side": s(Z) && (s(K).display ?? !1) && s(O)
3600
+ }])
3601
+ }, [
3602
+ s(Z) && (s(K).display ?? !1) && s(T) ? (Y(), de(Me, {
3603
+ key: 0,
3604
+ "chart-ref": n.value,
3605
+ enabled: s(K).display ?? !1,
3606
+ position: s(X),
3607
+ "text-color": (ne = s(K).labels) == null ? void 0 : ne.color,
3608
+ "font-size": (ge = (oe = s(K).labels) == null ? void 0 : oe.font) == null ? void 0 : ge.size,
3609
+ "legend-update-key": s(P),
3610
+ "use-point-style": t.value.usePointStyle ?? !0,
3611
+ "chart-color-binding": t.value.chartColorBinding,
3612
+ "chart-colors": t.value.chartColors,
3613
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
3614
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3615
+ "metric-count": t.value.metricCount,
3616
+ "hidden-dataset-keys": s(u),
3617
+ onToggleDatasetVisibility: s(y)
3618
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : me("", !0),
3619
+ se(Q, {
3620
+ ref_key: "chartRef",
3621
+ ref: n,
3622
+ class: "bar-chart",
3623
+ datasets: W.value,
3624
+ "x-axis": { categories: o.value },
3625
+ "x-cfg": m.value,
3626
+ "y-cfg": A.value,
3627
+ transpose: s(V),
3628
+ stacked: c.value,
3629
+ legend: $.value,
3630
+ tooltip: s(H),
3631
+ plugins: [s(i)],
3632
+ datalabels: s(x),
3633
+ "maintain-aspect-ratio": !1
3634
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "stacked", "legend", "tooltip", "plugins", "datalabels"]),
3635
+ s(Z) && (s(K).display ?? !1) && !s(T) ? (Y(), de(Me, {
3636
+ key: 1,
3637
+ "chart-ref": n.value,
3638
+ enabled: s(K).display ?? !1,
3639
+ position: s(X),
3640
+ "text-color": (ae = s(K).labels) == null ? void 0 : ae.color,
3641
+ "font-size": (be = (pe = s(K).labels) == null ? void 0 : pe.font) == null ? void 0 : be.size,
3642
+ "legend-update-key": s(P),
3643
+ "use-point-style": t.value.usePointStyle ?? !0,
3644
+ "chart-color-binding": t.value.chartColorBinding,
3645
+ "chart-colors": t.value.chartColors,
3646
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
3647
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3648
+ "metric-count": t.value.metricCount,
3649
+ "hidden-dataset-keys": s(u),
3650
+ onToggleDatasetVisibility: s(y)
3651
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : me("", !0)
3652
+ ], 2)
3653
+ ]),
3654
+ se(Wt, {
3655
+ "model-value": s(k),
3656
+ "details-payload": s(M),
3657
+ "onUpdate:modelValue": s(z),
3658
+ onValueHover: s(q),
3659
+ onValueLeave: s(I)
3660
+ }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
3661
+ ], 64);
3662
+ };
3663
+ }
3664
+ });
3665
+ function tl(e) {
3666
+ const t = Reflect.get(e, "lineStyle"), n = Reflect.get(e, "dash") === !0;
3667
+ return ea(t, n);
3668
+ }
3669
+ function Lo(e = "report-line-style-plugin") {
3670
+ return {
3671
+ id: e,
3672
+ beforeDatasetsUpdate(t) {
3673
+ var o;
3674
+ (((o = t == null ? void 0 : t.data) == null ? void 0 : o.datasets) ?? []).forEach((a) => {
3675
+ const i = a;
3676
+ Reflect.set(i, "borderDash", tl(i));
3677
+ });
3678
+ }
3679
+ };
3680
+ }
3681
+ const nl = { class: "widget-content" }, ol = /* @__PURE__ */ Be({
3682
+ __name: "WidgetStackLineChart",
3683
+ props: /* @__PURE__ */ ze({
3684
+ tileIndex: {}
3685
+ }, {
3686
+ modelValue: { required: !0 },
3687
+ modelModifiers: {}
3688
+ }),
3689
+ emits: ["update:modelValue"],
3690
+ setup(e) {
3691
+ const t = He(e, "modelValue"), n = L(null), o = b(() => {
3692
+ var X;
3693
+ return ((X = t.value.data) == null ? void 0 : X.xAxis) ?? [];
3694
+ }), a = b(
3695
+ () => o.value.length === 1 && r.value.length > 0 && r.value.every((X) => X.values.length === 1)
3696
+ ), i = b(() => a.value ? ["", o.value[0], ""] : o.value), r = b(() => {
3697
+ var X;
3698
+ return ((X = t.value.data) == null ? void 0 : X.datasets) ?? [];
3699
+ }), c = Ht("line"), d = Lo("report-line-style-plugin-stack-line"), m = b(() => r.value.length > 0 ? [
3700
+ ...r.value.map((X, O) => {
3701
+ var oe;
3702
+ const T = $t({
3703
+ datasets: r.value,
3704
+ datasetIndex: O
3705
+ });
3706
+ let u = X.values;
3707
+ a.value && (u = [NaN, u[0], NaN]);
3708
+ const y = u.map((ge) => ge === null ? NaN : Number(ge)), P = ke({
3709
+ datasetIndex: T,
3710
+ isCompare: !1,
3711
+ metricCount: t.value.metricCount,
3712
+ mode: t.value.chartColorBinding
3713
+ }), W = ke({
3714
+ datasetIndex: T,
3715
+ isCompare: !1,
3716
+ metricCount: t.value.metricCount,
3717
+ mode: ye.metric
3718
+ }), $ = ke({
3719
+ datasetIndex: O,
3720
+ isCompare: X.isCompare,
3721
+ metricCount: t.value.metricCount,
3722
+ mode: t.value.lineStyleBinding
3723
+ }), S = (oe = t.value.lineStyles) == null ? void 0 : oe[$], G = t.value.chartColorBinding === ye.breakdown, Q = Ct({
3724
+ fallbackIndex: T,
3725
+ metricCount: t.value.metricCount
3726
+ }), ne = G ? _t({
3727
+ breakdownIndex: Q,
3728
+ metricIndex: W,
3729
+ metricCount: t.value.metricCount,
3730
+ isCompare: X.isCompare,
3731
+ breakdownColors: t.value.chartBreakdownColors,
3732
+ useSecondaryMetricShades: t.value.chartUseSecondaryMetricShades,
3733
+ customColors: t.value.chartColors
3734
+ }) : Ze({
3735
+ index: P,
3736
+ isCompare: X.isCompare,
3737
+ customColors: t.value.chartColors
3738
+ });
3739
+ return {
3740
+ label: X.name,
3741
+ data: y,
3742
+ dash: X.isCompare,
3743
+ lineStyle: S,
3744
+ fill: !0,
3745
+ color: ne,
3746
+ pointRadius: a.value ? 4 : void 0,
3747
+ pointHoverRadius: a.value ? 6 : void 0,
3748
+ pointBackgroundColor: a.value ? ne : void 0,
3749
+ pointBorderColor: a.value ? ne : void 0,
3750
+ pointBorderWidth: a.value ? 2 : void 0
3751
+ };
3752
+ })
3753
+ ] : []), {
3754
+ isTooltipDetailsSheetOpen: A,
3755
+ tooltipDetailsPayload: C,
3756
+ handleTooltipDetailsSheetVisibility: w,
3757
+ handleTooltipDetailsHover: v,
3758
+ handleTooltipDetailsLeave: p,
3759
+ comparisonTooltip: F,
3760
+ datalabels: k,
3761
+ xCfg: M,
3762
+ yCfg: z,
3763
+ isTransposed: q,
3764
+ legend: I,
3765
+ useCustomLegend: H,
3766
+ legendPosition: x,
3767
+ isLegendSide: B,
3768
+ isLegendBeforeChart: N,
3769
+ hiddenDatasetKeys: V,
3770
+ toggleDatasetVisibility: K,
3771
+ datasets: Z
3772
+ } = Ot({
3773
+ chartRef: n,
3774
+ model: t,
3775
+ baseDatasets: m
3776
+ });
3777
+ return (X, O) => {
3778
+ var u, y, P, W, $, S;
3779
+ const T = ie("FmLineChart");
3780
+ return Y(), re(Ve, null, [
3781
+ j("div", nl, [
3782
+ Qe(X.$slots, "menu"),
3783
+ j("div", {
3784
+ class: we(["chart-layout", {
3785
+ "chart-layout--side": s(H) && (s(I).display ?? !1) && s(B)
3786
+ }])
3787
+ }, [
3788
+ s(H) && (s(I).display ?? !1) && s(N) ? (Y(), de(Me, {
3789
+ key: 0,
3790
+ "chart-ref": n.value,
3791
+ enabled: s(I).display ?? !1,
3792
+ position: s(x),
3793
+ "text-color": (u = s(I).labels) == null ? void 0 : u.color,
3794
+ "font-size": (P = (y = s(I).labels) == null ? void 0 : y.font) == null ? void 0 : P.size,
3795
+ "legend-update-key": s(Z),
3796
+ "use-point-style": t.value.usePointStyle ?? !0,
3797
+ "chart-color-binding": t.value.chartColorBinding,
3798
+ "chart-colors": t.value.chartColors,
3799
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
3800
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3801
+ "metric-count": t.value.metricCount,
3802
+ "hidden-dataset-keys": s(V),
3803
+ onToggleDatasetVisibility: s(K)
3804
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : me("", !0),
3805
+ se(T, {
3806
+ ref_key: "chartRef",
3807
+ ref: n,
3808
+ class: "line-chart",
3809
+ datasets: s(Z),
3810
+ "x-axis": { categories: i.value },
3811
+ "x-cfg": s(M),
3812
+ "y-cfg": s(z),
3813
+ transpose: s(q),
3814
+ legend: {
3815
+ display: !1
3816
+ },
3817
+ tooltip: s(F),
3818
+ plugins: [s(c), s(d)],
3819
+ stacked: !0,
3820
+ datalabels: s(k),
3821
+ "maintain-aspect-ratio": !1
3822
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "tooltip", "plugins", "datalabels"]),
3823
+ s(H) && (s(I).display ?? !1) && !s(N) ? (Y(), de(Me, {
3824
+ key: 1,
3825
+ "chart-ref": n.value,
3826
+ enabled: s(I).display ?? !1,
3827
+ position: s(x),
3828
+ "text-color": (W = s(I).labels) == null ? void 0 : W.color,
3829
+ "font-size": (S = ($ = s(I).labels) == null ? void 0 : $.font) == null ? void 0 : S.size,
3830
+ "legend-update-key": s(Z),
3831
+ "use-point-style": t.value.usePointStyle ?? !0,
3832
+ "chart-color-binding": t.value.chartColorBinding,
3833
+ "chart-colors": t.value.chartColors,
3834
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
3835
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3836
+ "metric-count": t.value.metricCount,
3837
+ "hidden-dataset-keys": s(V),
3838
+ onToggleDatasetVisibility: s(K)
3839
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : me("", !0)
3840
+ ], 2)
3841
+ ]),
3842
+ se(Wt, {
3843
+ "model-value": s(A),
3844
+ "details-payload": s(C),
3845
+ "onUpdate:modelValue": s(w),
3846
+ onValueHover: s(v),
3847
+ onValueLeave: s(p)
3848
+ }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
3849
+ ], 64);
3850
+ };
3851
+ }
3852
+ }), wt = [
3853
+ "col-span-1",
3854
+ "col-span-2",
3855
+ "col-span-3",
3856
+ "col-span-4",
3857
+ "col-span-5",
3858
+ "col-span-6",
3859
+ "col-span-7",
3860
+ "col-span-8",
3861
+ "col-span-9",
3862
+ "col-span-10",
3863
+ "col-span-11",
3864
+ "col-span-12"
3865
+ ];
3866
+ function al(e) {
3867
+ return e < 12 ? wt[e - 1] : wt[11];
3868
+ }
3869
+ function rl(e) {
3870
+ return e < 12 ? wt[Math.min(11, e * 2 - 1)] : wt[11];
3871
+ }
3872
+ function ll(e) {
3873
+ return e < 12 ? wt[Math.min(11, e * 3 - 1)] : wt[11];
3874
+ }
3875
+ const sl = { class: "widget-content" }, il = /* @__PURE__ */ Be({
3876
+ __name: "WidgetLinechart",
3877
+ props: /* @__PURE__ */ ze({
3878
+ tileIndex: {}
3879
+ }, {
3880
+ modelValue: { required: !0 },
3881
+ modelModifiers: {}
3882
+ }),
3883
+ emits: ["update:modelValue"],
3884
+ setup(e) {
3885
+ const t = He(e, "modelValue"), n = L(null), o = b(() => {
3886
+ var O;
3887
+ return ((O = t.value.data) == null ? void 0 : O.datasets) ?? [];
3888
+ }), a = b(() => {
3889
+ var O;
3890
+ return ((O = t.value.data) == null ? void 0 : O.xAxis) ?? [];
3891
+ }), i = b(() => a.value.length === 1 && o.value.length > 1 && o.value.every((O) => O.values.length === 1 && O.isCompare !== !0)), r = b(
3892
+ () => a.value.length === 1 && o.value.length > 0 && o.value.every((O) => O.values.length === 1)
3893
+ ), c = b(() => i.value ? o.value.map((O) => O.name) : r.value ? ["", a.value[0], ""] : a.value), d = Ht("line"), m = Lo("report-line-style-plugin-line"), A = b(() => o.value.length > 0 ? [
3894
+ ...o.value.map((O, T) => {
3895
+ var pe;
3896
+ const u = $t({
3897
+ datasets: o.value,
3898
+ datasetIndex: T
3899
+ }), y = ke({
3900
+ datasetIndex: u,
3901
+ isCompare: !1,
3902
+ metricCount: t.value.metricCount,
3903
+ mode: t.value.chartColorBinding
3904
+ }), P = ke({
3905
+ datasetIndex: u,
3906
+ isCompare: !1,
3907
+ metricCount: t.value.metricCount,
3908
+ mode: ye.metric
3909
+ }), W = Ze({
3910
+ index: y,
3911
+ isCompare: O.isCompare,
3912
+ customColors: t.value.chartColors
3913
+ }), $ = t.value.chartColorBinding === ye.breakdown, S = Ct({
3914
+ fallbackIndex: u,
3915
+ metricCount: t.value.metricCount
3916
+ }), G = $ ? _t({
3917
+ breakdownIndex: S,
3918
+ metricIndex: P,
3919
+ metricCount: t.value.metricCount,
3920
+ isCompare: O.isCompare,
3921
+ breakdownColors: t.value.chartBreakdownColors,
3922
+ useSecondaryMetricShades: t.value.chartUseSecondaryMetricShades,
3923
+ customColors: t.value.chartColors
3924
+ }) : W;
3925
+ let Q = O.values;
3926
+ i.value ? Q = o.value.map(
3927
+ (be, Ae) => Ae === T ? O.values[0] : NaN
3928
+ ) : r.value && (Q = [NaN, Q[0], NaN]);
3929
+ const ne = Q.map((be) => be === null ? NaN : Number(be)), oe = r.value || i.value, ge = ke({
3930
+ datasetIndex: T,
3931
+ isCompare: O.isCompare,
3932
+ metricCount: t.value.metricCount,
3933
+ mode: t.value.lineStyleBinding
3934
+ }), ae = (pe = t.value.lineStyles) == null ? void 0 : pe[ge];
3935
+ return {
3936
+ label: O.name,
3937
+ data: ne,
3938
+ dash: !!O.isCompare,
3939
+ lineStyle: ae,
3940
+ fill: !1,
3941
+ color: G,
3942
+ pointRadius: oe ? 4 : void 0,
3943
+ pointHoverRadius: oe ? 6 : void 0,
3944
+ pointBackgroundColor: oe ? G : void 0,
3945
+ pointBorderColor: oe ? G : void 0,
3946
+ pointBorderWidth: oe ? 2 : void 0
3947
+ };
3948
+ })
3949
+ ] : []), {
3950
+ isTooltipDetailsSheetOpen: C,
3951
+ tooltipDetailsPayload: w,
3952
+ handleTooltipDetailsSheetVisibility: v,
3953
+ handleTooltipDetailsHover: p,
3954
+ handleTooltipDetailsLeave: F,
3955
+ comparisonTooltip: k,
3956
+ datalabels: M,
3957
+ xCfg: z,
3958
+ yCfg: q,
3959
+ isTransposed: I,
3960
+ legend: H,
3961
+ useCustomLegend: x,
3962
+ legendPosition: B,
3963
+ isLegendSide: N,
3964
+ isLegendBeforeChart: V,
3965
+ hiddenDatasetKeys: K,
3966
+ toggleDatasetVisibility: Z,
3967
+ datasets: X
3968
+ } = Ot({
3969
+ chartRef: n,
3970
+ model: t,
3971
+ baseDatasets: A
3972
+ });
3973
+ return (O, T) => {
3974
+ var y, P, W, $, S, G;
3975
+ const u = ie("FmLineChart");
3976
+ return Y(), re(Ve, null, [
3977
+ j("div", sl, [
3978
+ Qe(O.$slots, "menu"),
3979
+ j("div", {
3980
+ class: we(["chart-layout", {
3981
+ "chart-layout--side": s(x) && (s(H).display ?? !1) && s(N)
3982
+ }])
3983
+ }, [
3984
+ s(x) && (s(H).display ?? !1) && s(V) ? (Y(), de(Me, {
3985
+ key: 0,
3986
+ "chart-ref": n.value,
3987
+ enabled: s(H).display ?? !1,
3988
+ position: s(B),
3989
+ "text-color": (y = s(H).labels) == null ? void 0 : y.color,
3990
+ "font-size": (W = (P = s(H).labels) == null ? void 0 : P.font) == null ? void 0 : W.size,
3991
+ "legend-update-key": s(X),
3992
+ "chart-color-binding": t.value.chartColorBinding,
3993
+ "chart-colors": t.value.chartColors,
3994
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
3995
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3996
+ "metric-count": t.value.metricCount,
3997
+ "hidden-dataset-keys": s(K),
3998
+ "use-point-style": t.value.usePointStyle ?? !0,
3999
+ onToggleDatasetVisibility: s(Z)
4000
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "use-point-style", "onToggleDatasetVisibility"])) : me("", !0),
4001
+ se(u, {
4002
+ ref_key: "chartRef",
4003
+ ref: n,
4004
+ class: "line-chart",
4005
+ datasets: s(X),
4006
+ "x-axis": { categories: c.value },
4007
+ "x-cfg": s(z),
4008
+ "y-cfg": s(q),
4009
+ transpose: s(I),
4010
+ legend: {
4011
+ display: !1
4012
+ },
4013
+ tooltip: s(k),
4014
+ datalabels: s(M),
4015
+ plugins: [s(d), s(m)],
4016
+ "maintain-aspect-ratio": !1
4017
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "tooltip", "datalabels", "plugins"]),
4018
+ s(x) && (s(H).display ?? !1) && !s(V) ? (Y(), de(Me, {
4019
+ key: 1,
4020
+ "chart-ref": n.value,
4021
+ enabled: s(H).display ?? !1,
4022
+ position: s(B),
4023
+ "text-color": ($ = s(H).labels) == null ? void 0 : $.color,
4024
+ "font-size": (G = (S = s(H).labels) == null ? void 0 : S.font) == null ? void 0 : G.size,
4025
+ "legend-update-key": s(X),
4026
+ "chart-color-binding": t.value.chartColorBinding,
4027
+ "chart-colors": t.value.chartColors,
4028
+ "chart-breakdown-colors": t.value.chartBreakdownColors,
4029
+ "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
4030
+ "metric-count": t.value.metricCount,
4031
+ "hidden-dataset-keys": s(K),
4032
+ "use-point-style": t.value.usePointStyle ?? !0,
4033
+ onToggleDatasetVisibility: s(Z)
4034
+ }, null, 8, ["chart-ref", "enabled", "position", "text-color", "font-size", "legend-update-key", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "use-point-style", "onToggleDatasetVisibility"])) : me("", !0)
4035
+ ], 2)
4036
+ ]),
4037
+ se(Wt, {
4038
+ "model-value": s(C),
4039
+ "details-payload": s(w),
4040
+ "onUpdate:modelValue": s(v),
4041
+ onValueHover: s(p),
4042
+ onValueLeave: s(F)
4043
+ }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
4044
+ ], 64);
4045
+ };
4046
+ }
4047
+ }), ul = { class: "flex flex-col gap-16" }, cl = { class: "flex flex-row" }, dl = /* @__PURE__ */ Be({
4048
+ __name: "PdfOrientationDialog",
4049
+ props: /* @__PURE__ */ ze({
4050
+ reportType: {},
4051
+ index: {}
4052
+ }, {
4053
+ modelValue: { type: Boolean, required: !0 },
4054
+ modelModifiers: {}
4055
+ }),
4056
+ emits: ["update:modelValue"],
4057
+ setup(e) {
4058
+ const { t } = it(), { FmForm: n } = jo, o = e, a = L(), i = He(e, "modelValue"), r = L(!0), c = L(!1), d = Ln(), { selectedLocationIds: m, dateRange: A, timeRange: C } = At(nn()), w = L(dn.PORTRAIT);
4059
+ function v() {
4060
+ var F;
4061
+ (F = a.value) == null || F.validateInputs();
4062
+ }
4063
+ async function p() {
4064
+ c.value = !0;
4065
+ try {
4066
+ o.index != null && await ro({
4067
+ reportType: o.reportType,
4068
+ index: o.index,
4069
+ orientationTypes: [w.value],
4070
+ isCombinedLocationLayout: r.value,
4071
+ timeRange: C.value,
4072
+ dateRange: A.value,
4073
+ locationIds: m.value
4074
+ });
4075
+ } catch (F) {
4076
+ d.open({ message: F.message, type: "error" });
4077
+ } finally {
4078
+ c.value = !1;
4079
+ }
4080
+ }
4081
+ return (F, k) => {
4082
+ const M = ie("FmRadio"), z = ie("FmRadioGroup"), q = ie("FmButton"), I = ie("FmDialog");
4083
+ return Y(), de(I, {
4084
+ modelValue: i.value,
4085
+ "onUpdate:modelValue": k[2] || (k[2] = (H) => i.value = H),
4086
+ overlay: !0,
4087
+ "z-index": 10
4088
+ }, {
4089
+ "dialog-header": xe(() => k[3] || (k[3] = [
4090
+ Oo("Select Orientation")
4091
+ ])),
4092
+ default: xe(() => [
4093
+ se(s(n), {
4094
+ ref_key: "form",
4095
+ ref: a,
4096
+ onValidationSuccess: p
4097
+ }, {
4098
+ default: xe(() => [
4099
+ j("div", ul, [
4100
+ se(z, {
4101
+ modelValue: w.value,
4102
+ "onUpdate:modelValue": k[0] || (k[0] = (H) => w.value = H)
4103
+ }, {
4104
+ default: xe(() => [
4105
+ se(M, {
4106
+ value: s(dn).PORTRAIT,
4107
+ label: s(t)("report.common.portrait")
4108
+ }, null, 8, ["value", "label"]),
4109
+ se(M, {
4110
+ value: s(dn).LANDSCAPE,
4111
+ label: s(t)("report.common.landscape")
4112
+ }, null, 8, ["value", "label"])
4113
+ ]),
4114
+ _: 1
4115
+ }, 8, ["modelValue"])
4116
+ ]),
4117
+ j("div", cl, [
4118
+ k[4] || (k[4] = j("div", { class: "grow" }, null, -1)),
4119
+ se(q, {
4120
+ label: s(t)("report.common.cancel"),
4121
+ variant: "tertiary",
4122
+ onClick: k[1] || (k[1] = (H) => i.value = !1)
4123
+ }, null, 8, ["label"]),
4124
+ j("div", null, [
4125
+ se(q, {
4126
+ label: s(t)("report.common.download"),
4127
+ loading: c.value,
4128
+ onClick: v
4129
+ }, null, 8, ["label", "loading"])
4130
+ ])
4131
+ ])
4132
+ ]),
4133
+ _: 1
4134
+ }, 512)
4135
+ ]),
4136
+ _: 1
4137
+ }, 8, ["modelValue"]);
4138
+ };
4139
+ }
4140
+ });
4141
+ function fl(e) {
4142
+ const { breakpoints: t } = Nt(), { containerRef: n, isTable: o = L(!0) } = e;
4143
+ let a = L(1), i = null, r = null, c = null, d = null, m = null, A = null;
4144
+ function C() {
4145
+ return n.value ? n.value.querySelector("table") : null;
4146
+ }
4147
+ function w() {
4148
+ var N;
4149
+ const x = [];
4150
+ n.value && n.value.querySelectorAll("div,section,main,article,aside").forEach((V) => {
4151
+ if (V.scrollWidth > V.clientWidth) {
4152
+ const K = window.getComputedStyle(V);
4153
+ (K.overflowX === "auto" || K.overflowX === "scroll") && x.push(V);
4154
+ }
4155
+ });
4156
+ let B = (N = n.value) == null ? void 0 : N.parentElement;
4157
+ for (; B; ) {
4158
+ if (B.scrollWidth > B.clientWidth) {
4159
+ const V = window.getComputedStyle(B);
4160
+ (V.overflowX === "auto" || V.overflowX === "scroll") && x.push(B);
4161
+ }
4162
+ B = B.parentElement;
4163
+ }
4164
+ return x;
4165
+ }
4166
+ function v() {
4167
+ if (I(), !o.value || !n.value || (r = C(), !r) || (c = r.querySelector("thead"), !c)) return;
4168
+ i = document.createElement("div"), i.className = "sticky-header-clone", i.style.cssText = `
4169
+ position: fixed;
4170
+ top: ${a.value}px;
4171
+ left: 0;
4172
+ right: 0;
4173
+ z-index: 9;
4174
+ overflow: hidden;
4175
+ pointer-events: none;
4176
+ visibility: hidden;
4177
+ `;
4178
+ const x = document.createElement("table");
4179
+ x.className = r.className, x.style.cssText = `
4180
+ table-layout: fixed;
4181
+ width: ${r.offsetWidth}px;
4182
+ margin: 0;
4183
+ border-collapse: collapse;
4184
+ pointer-events: auto;
4185
+ `;
4186
+ const B = c.cloneNode(!0);
4187
+ B.style.cssText = "pointer-events: auto;", p(c, B), x.appendChild(B), i.appendChild(x), document.body.appendChild(i), M(), z(), q(), k();
4188
+ }
4189
+ function p(x, B) {
4190
+ const N = x.querySelectorAll("th, td"), V = B.querySelectorAll("th, td");
4191
+ N.forEach((K, Z) => {
4192
+ const X = V[Z];
4193
+ if (!X) return;
4194
+ const O = K, T = window.getComputedStyle(O);
4195
+ Object.assign(X.style, {
4196
+ width: `${O.offsetWidth}px`,
4197
+ minWidth: `${O.offsetWidth}px`,
4198
+ maxWidth: `${O.offsetWidth}px`,
4199
+ height: `${O.offsetHeight}px`,
4200
+ padding: T.padding,
4201
+ backgroundColor: T.backgroundColor,
4202
+ borderBottom: T.borderBottom,
4203
+ fontSize: T.fontSize,
4204
+ fontWeight: T.fontWeight,
4205
+ textAlign: T.textAlign,
4206
+ verticalAlign: T.verticalAlign,
4207
+ boxSizing: "border-box",
4208
+ cursor: T.cursor || "pointer",
4209
+ pointerEvents: "auto"
4210
+ }), X.onclick = (u) => {
4211
+ u.preventDefault(), u.stopPropagation();
4212
+ const y = O.querySelector(
4213
+ "button, a, [role='button']"
4214
+ );
4215
+ y ? y.click() : O.click();
4216
+ };
4217
+ });
4218
+ }
4219
+ function F() {
4220
+ const x = t.value.xs || t.value.sm, B = document.querySelector('[data-editor-header="true"]'), N = document.querySelector('[data-menu-tab="true"]');
4221
+ if (x && !B)
4222
+ return 1;
4223
+ if (B)
4224
+ return B.getBoundingClientRect().bottom;
4225
+ if (N) {
4226
+ let V = N;
4227
+ for (; V; ) {
4228
+ if (window.getComputedStyle(V).position === "sticky")
4229
+ return V.getBoundingClientRect().bottom;
4230
+ V = V.parentElement;
4231
+ }
4232
+ return N.getBoundingClientRect().bottom;
4233
+ }
4234
+ return a.value;
4235
+ }
4236
+ function k() {
4237
+ if (!i || !r || !c || !n.value) return;
4238
+ const x = n.value.getBoundingClientRect(), B = r.getBoundingClientRect(), N = c.getBoundingClientRect(), V = F();
4239
+ if (!(B.top <= V && B.bottom >= V + N.height)) {
4240
+ i.style.visibility = "hidden";
4241
+ return;
4242
+ }
4243
+ i.style.visibility = "visible", i.style.top = `${V}px`;
4244
+ const Z = window.getComputedStyle(n.value), X = parseFloat(Z.paddingLeft) || 0, O = parseFloat(Z.paddingRight) || 0, T = x.left + X, u = x.right - O, y = Math.max(T, x.left), P = Math.min(u, x.right), W = Math.max(0, P - y);
4245
+ if (W <= 0) {
4246
+ i.style.visibility = "hidden";
4247
+ return;
4248
+ }
4249
+ i.style.left = `${y}px`, i.style.width = `${W}px`;
4250
+ const $ = i.querySelector("table");
4251
+ $ && ($.style.width = `${r.offsetWidth}px`, $.style.marginLeft = `${N.left - y}px`);
4252
+ }
4253
+ function M() {
4254
+ var B;
4255
+ m = () => requestAnimationFrame(k), window.addEventListener("scroll", m, { passive: !0 }), w().forEach((N) => {
4256
+ m && N.addEventListener("scroll", m, { passive: !0 });
4257
+ });
4258
+ let x = (B = n.value) == null ? void 0 : B.parentElement;
4259
+ for (; x; )
4260
+ x !== document.body && (x.scrollHeight > x.clientHeight || x.scrollWidth > x.clientWidth) && x.addEventListener("scroll", m, { passive: !0 }), x = x.parentElement;
4261
+ }
4262
+ function z() {
4263
+ d = new ResizeObserver(() => {
4264
+ if (c && i) {
4265
+ const x = i.querySelector("thead");
4266
+ x && p(c, x);
4267
+ const B = i.querySelector("table");
4268
+ B && r && (B.style.width = `${r.offsetWidth}px`);
4269
+ }
4270
+ k();
4271
+ }), n.value && d.observe(n.value), r && d.observe(r);
4272
+ }
4273
+ function q() {
4274
+ if (!c) return;
4275
+ const x = gn(() => v(), 100), B = () => {
4276
+ if (c && i) {
4277
+ const N = i.querySelector("thead");
4278
+ N && p(c, N), k();
4279
+ }
4280
+ };
4281
+ A = new MutationObserver((N) => {
4282
+ N.some((K) => K.type === "childList" ? K.addedNodes.length > 0 || K.removedNodes.length > 0 : !1) ? x() : B();
4283
+ }), A.observe(c, {
4284
+ childList: !0,
4285
+ subtree: !0,
4286
+ attributes: !0,
4287
+ characterData: !0
4288
+ });
4289
+ }
4290
+ function I() {
4291
+ var x;
4292
+ if (i && (i.remove(), i = null), m) {
4293
+ window.removeEventListener("scroll", m), w().forEach((N) => {
4294
+ m && N.removeEventListener("scroll", m);
4295
+ });
4296
+ let B = (x = n.value) == null ? void 0 : x.parentElement;
4297
+ for (; B; )
4298
+ B.removeEventListener("scroll", m), B = B.parentElement;
4299
+ m = null;
4300
+ }
4301
+ d && (d.disconnect(), d = null), A && (A.disconnect(), A = null), r = null, c = null;
4302
+ }
4303
+ function H() {
4304
+ v();
4305
+ }
4306
+ return Se(o, (x) => {
4307
+ x ? v() : I();
4308
+ }), Se(a, () => {
4309
+ i && (i.style.top = `${a.value}px`, k());
4310
+ }), Se(n, () => {
4311
+ n.value && o.value && setTimeout(v, 100);
4312
+ }), Vt(() => {
4313
+ o.value && setTimeout(v, 100);
4314
+ }), ao(() => {
4315
+ I();
4316
+ }), { refresh: H, cleanup: I };
4317
+ }
4318
+ const ml = {
4319
+ key: 1,
4320
+ class: "grow"
4321
+ }, hl = {
4322
+ key: 2,
4323
+ class: "flex"
4324
+ }, Ll = /* @__PURE__ */ Be({
4325
+ __name: "DynamicWidget",
4326
+ props: /* @__PURE__ */ ze({
4327
+ index: {
4328
+ type: Number,
4329
+ default: 0
4330
+ },
4331
+ hideExport: {
4332
+ type: Boolean,
4333
+ default: !1
4334
+ },
4335
+ customScreenWidth: {
4336
+ type: Number,
4337
+ required: !1,
4338
+ default: void 0
4339
+ },
4340
+ isEditingStyle: {
4341
+ type: Boolean,
4342
+ default: !1
4343
+ }
4344
+ }, {
4345
+ modelValue: { required: !0, default: () => {
4346
+ } },
4347
+ modelModifiers: {}
4348
+ }),
4349
+ emits: /* @__PURE__ */ ze(["update:table-response"], ["update:modelValue"]),
4350
+ setup(e, { emit: t }) {
4351
+ const n = L(!0), o = He(e, "modelValue"), a = t, i = o.value.widget.config, { t: r, te: c, locale: d } = it(), m = e, A = L(null), C = b(() => o.value.widget.type === ee.Table), w = b(() => {
4352
+ var _;
4353
+ return (_ = A.value) == null ? void 0 : _.$el;
4354
+ }), { refresh: v } = fl({
4355
+ containerRef: w,
4356
+ isTable: C
4357
+ }), p = L(i.rollup), F = L(Bt()), k = L(i.drillDimension), M = b(() => {
4358
+ if (fe.value.length > 0) {
4359
+ const _ = fe.value.findIndex(
4360
+ (ue) => ue.value === k.value
4361
+ );
4362
+ return _ >= 0 ? _ : 0;
4363
+ } else
4364
+ return -1;
4365
+ }), z = b(() => M.value !== 0), q = b(
4366
+ () => M.value != fe.value.length - 1
4367
+ ), I = L(i.showTitle ?? !0), H = L(i.titleFontSize ?? 14), x = L(i.titleBold ?? !1), B = L(i.titleItalic ?? !1), N = L(i.titleUnderline ?? !1), V = L(
4368
+ Array.isArray(i.chartColors) ? [...i.chartColors] : void 0
4369
+ ), K = L(
4370
+ Array.isArray(i.chartColorLayers) ? [...i.chartColorLayers] : void 0
4371
+ ), Z = L(
4372
+ Array.isArray(i.chartBreakdownColors) ? [...i.chartBreakdownColors] : void 0
4373
+ ), X = L(i.chartUseSecondaryMetricShades ?? !0), O = L(i.chartColorBinding), T = L(
4374
+ Array.isArray(i.lineStyles) ? [...i.lineStyles] : void 0
4375
+ ), u = L(i.lineStyleBinding), y = L(i.showLabel ?? !1), P = L(i.labelAlign ?? Cn.center), W = L(i.labelAnchor ?? bn.center), $ = L(i.labelRotation ?? 0), S = L(i.labelOffset ?? 0), G = L(i.labelFontSize ?? 12), Q = b(() => i.showSearchBar), ne = L(i.showX ?? !0), oe = L(i.xPosition ?? xn.bottom), ge = L(i.showXGrid ?? !1), ae = L(i.showXTick ?? !0), pe = L(i.xTickFontSize ?? 12), be = L(i.showXTitle ?? !1), Ae = L(i.xTitle ?? ""), Ue = L(i.xTitleFontSize ?? 12), et = L(i.showY ?? !0), _e = L(i.yPosition ?? wn.left), St = L(i.showYGrid ?? !1), Ke = L(i.showYTick ?? !0), tt = L(i.yTickFontSize ?? 12), ut = L(i.showYTitle ?? !1), ct = L(i.yTitle ?? ""), dt = L(i.yTitleFontSize ?? 12), ft = L(i.showLegend ?? void 0), Xe = L(i.legendPosition ?? _n.top), Ye = L(i.usePointStyle ?? !0), Ut = L(i.legendFontSize), Ee = L(i.legendColor ?? "#6b6b6b"), Kt = L(i.maxTooltipItems), Xt = L(i.stackBarOverlap ?? !1), Yt = L(i.rowHeight ?? null), kt = L(i.colWidths ?? null), We = L(!1), Tt = L(""), { breakpoints: qe, getBreakpointsBoundary: nt } = Nt(), Lt = L(), Ce = b(
4376
+ () => m.customScreenWidth === void 0 ? window.innerWidth : m.customScreenWidth
4377
+ ), an = b(
4378
+ () => (Ce == null ? void 0 : Ce.value) > nt("xs")[1] && (Ce == null ? void 0 : Ce.value) <= nt("sm")[1]
4379
+ ), Dt = b(
4380
+ () => (Ce == null ? void 0 : Ce.value) > nt("sm")[1] && (Ce == null ? void 0 : Ce.value) <= nt("md")[1]
4381
+ ), rn = b(() => (Ce == null ? void 0 : Ce.value) > nt("md")[1]), ln = b(() => {
4382
+ const _ = o.value.size.width;
4383
+ return rn.value || Dt.value ? al(_) : an.value ? rl(_) : ll(_);
4384
+ }), ot = b(
4385
+ () => Jo.find((_) => _.type === o.value.widget.type)
4386
+ ), Ge = gn(() => {
4387
+ var _;
4388
+ Lt.value = De((_ = A.value) == null ? void 0 : _.$el.offsetWidth), F.value = Bt();
4389
+ }), sn = b(() => {
4390
+ if (Zo(D.value.type, Ne.value))
4391
+ switch (o.value.widget.type) {
4392
+ case ee.BarChart:
4393
+ return Br;
4394
+ case ee.StackBarChart:
4395
+ return Zr;
4396
+ case ee.ClusteredStackBarChart:
4397
+ return el;
4398
+ case ee.LineChart:
4399
+ return il;
4400
+ case ee.StackLineChart:
4401
+ return ol;
4402
+ case ee.Circular:
4403
+ return Fr;
4404
+ case ee.Scorecard:
4405
+ return Wr;
4406
+ case ee.Spacer:
4407
+ return Kr;
4408
+ case ee.Table:
4409
+ return jr;
4410
+ default:
4411
+ return Nn;
4412
+ }
4413
+ else
4414
+ return Nn;
4415
+ }), Ne = L(null), { selectedLocationIds: l, dateRange: h, compareDateRange: f, timeRange: g } = At(nn()), { globalFilters: R, isAllGlobalFiltersLoaded: U } = At(Eo()), { businessDataVersion: E } = At(nn()), J = L(!0), D = b(() => {
4416
+ const _ = JSON.parse(JSON.stringify(o.value.widget));
4417
+ return {
4418
+ ..._,
4419
+ config: {
4420
+ ..._.config,
4421
+ rollup: p.value,
4422
+ drillDimension: k.value,
4423
+ showGrandTotal: !1
4424
+ }
4425
+ };
4426
+ }), le = b(() => {
4427
+ var Pe;
4428
+ const _ = ((Pe = D.value.config.metrics) == null ? void 0 : Pe.length) ?? 0;
4429
+ if (!D.value.config.isBlend)
4430
+ return _;
4431
+ const ue = (D.value.config.joinDatasources ?? []).reduce(
4432
+ (rt, cn) => {
4433
+ var mt;
4434
+ return rt + (((mt = cn.metrics) == null ? void 0 : mt.length) ?? 0);
4435
+ },
4436
+ 0
4437
+ );
4438
+ return _ + ue;
4439
+ });
4440
+ function he() {
4441
+ return {
4442
+ data: Ne.value,
4443
+ showTitle: I.value,
4444
+ titleFontSize: H.value,
4445
+ titleBold: x.value,
4446
+ titleItalic: B.value,
4447
+ titleUnderline: N.value,
4448
+ chartColors: V.value,
4449
+ chartColorLayers: K.value,
4450
+ chartBreakdownColors: Z.value,
4451
+ chartUseSecondaryMetricShades: X.value,
4452
+ chartColorBinding: O.value,
4453
+ metricCount: le.value,
4454
+ lineStyles: T.value,
4455
+ lineStyleBinding: u.value,
4456
+ showLabel: y.value,
4457
+ labelAnchor: W.value,
4458
+ labelAlign: P.value,
4459
+ labelRotation: $.value,
4460
+ labelOffset: S.value,
4461
+ labelFontSize: G.value,
4462
+ showX: ne.value,
4463
+ xPosition: oe.value,
4464
+ showXGrid: ge.value,
4465
+ showXTick: ae.value,
4466
+ xTickFontSize: pe.value,
4467
+ showXTitle: be.value,
4468
+ xTitle: Ae.value,
4469
+ xTitleFontSize: Ue.value,
4470
+ showY: et.value,
4471
+ yPosition: _e.value,
4472
+ showYGrid: St.value,
4473
+ showYTick: Ke.value,
4474
+ yTitle: ct.value,
4475
+ showYTitle: ut.value,
4476
+ yTitleFontSize: dt.value,
4477
+ yTickFontSize: tt.value,
4478
+ isTransposed: D.value.config.isTransposed,
4479
+ showLegend: ft.value,
4480
+ legendPosition: Xe.value,
4481
+ usePointStyle: Ye.value,
4482
+ legendFontSize: Ut.value,
4483
+ legendColor: Ee.value,
4484
+ maxTooltipItems: Kt.value,
4485
+ stackBarOverlap: Xt.value
4486
+ };
4487
+ }
4488
+ function ve() {
4489
+ return {
4490
+ data: Ne.value,
4491
+ filterText: Tt.value,
4492
+ rollupPosition: D.value.config.rollupPosition,
4493
+ grandTotalLabel: D.value.config.grandTotalLabel,
4494
+ rowHeight: Yt.value,
4495
+ colWidths: kt.value
4496
+ };
4497
+ }
4498
+ const te = b(() => {
4499
+ switch (D.value.type) {
4500
+ case ee.Table:
4501
+ return ve();
4502
+ case ee.BarChart:
4503
+ case ee.LineChart:
4504
+ case ee.StackBarChart:
4505
+ case ee.ClusteredStackBarChart:
4506
+ case ee.StackLineChart:
4507
+ case ee.Circular:
4508
+ return he();
4509
+ default:
4510
+ return { data: Ne.value };
4511
+ }
4512
+ }), ce = b(() => {
4513
+ const { config: _ } = o.value.widget;
4514
+ if (_.rollup != null) {
4515
+ const ue = [..._.dimensions].filter((Pe) => !Pe.hide);
4516
+ return ue.sort(
4517
+ (Pe, rt) => (_.rowIds || []).indexOf(fn(Pe)) - (_.rowIds || []).indexOf(fn(rt))
4518
+ ), [
4519
+ { label: lt(r, c, "None", "other"), value: "none" },
4520
+ { label: lt(r, c, "Grand Total", "other"), value: 0 },
4521
+ ...[...ue].slice(0, ue.length - 1).map((Pe, rt) => ({
4522
+ label: lt(r, c, Pe.label, "other"),
4523
+ value: rt + 1
4524
+ }))
4525
+ ];
4526
+ }
4527
+ return [];
4528
+ }), fe = b(() => {
4529
+ const { config: _ } = D.value;
4530
+ return _.isDrillable ? _.dimensions.map((ue) => ({
4531
+ label: lt(r, c, ue.label, "other"),
4532
+ value: fn(ue)
4533
+ })) : [];
4534
+ }), Le = b(() => {
4535
+ const _ = o.value.id;
4536
+ return (R.value || []).filter(
4537
+ (ue) => Array.isArray(ue.tileIds) && ue.tileIds.includes(_)
4538
+ );
4539
+ });
4540
+ Se(
4541
+ () => o.value.widget.config,
4542
+ (_) => {
4543
+ p.value = _.rollup, I.value = _.showTitle ?? !0, H.value = _.titleFontSize ?? 14, x.value = _.titleBold ?? !1, B.value = _.titleItalic ?? !1, N.value = _.titleUnderline ?? !1, V.value = Array.isArray(_.chartColors) ? [..._.chartColors] : void 0, K.value = Array.isArray(_.chartColorLayers) ? [..._.chartColorLayers] : void 0, Z.value = Array.isArray(_.chartBreakdownColors) ? [..._.chartBreakdownColors] : void 0, X.value = _.chartUseSecondaryMetricShades ?? !0, O.value = _.chartColorBinding, T.value = Array.isArray(_.lineStyles) ? [..._.lineStyles] : void 0, u.value = _.lineStyleBinding, y.value = _.showLabel ?? !1, P.value = _.labelAlign ?? Cn.center, W.value = _.labelAnchor ?? bn.center, $.value = _.labelRotation ?? 0, S.value = _.labelOffset ?? 0, G.value = _.labelFontSize ?? 12, ne.value = _.showX ?? !0, oe.value = _.xPosition ?? xn.bottom, ge.value = _.showXGrid ?? !1, ae.value = _.showXTick ?? !0, pe.value = _.xTickFontSize ?? 12, be.value = _.showXTitle ?? !1, Ae.value = _.xTitle ?? "", Ue.value = _.xTitleFontSize ?? 12, et.value = _.showY ?? !0, _e.value = _.yPosition ?? wn.left, St.value = _.showYGrid ?? !1, Ke.value = _.showYTick ?? !0, tt.value = _.yTickFontSize ?? 12, ut.value = _.showYTitle ?? !1, ct.value = _.yTitle ?? "", dt.value = _.yTitleFontSize ?? 12, ft.value = _.showLegend ?? void 0, Xe.value = _.legendPosition ?? _n.top, Ye.value = _.usePointStyle ?? !0, Ut.value = _.legendFontSize, Ee.value = _.legendColor ?? "#6b6b6b", Kt.value = _.maxTooltipItems, Xt.value = _.stackBarOverlap ?? !1, Yt.value = _.rowHeight ?? null, kt.value = _.colWidths ?? null, F.value = Bt();
4544
+ },
4545
+ { deep: !0, immediate: !0 }
4546
+ ), Se(
4547
+ [C, Ne],
4548
+ () => {
4549
+ a(
4550
+ "update:table-response",
4551
+ C.value ? Ne.value : null
4552
+ );
4553
+ },
4554
+ { immediate: !0 }
4555
+ ), Se([() => p.value], () => {
4556
+ p.value !== null && (o.value.widget.config.rollup = p.value);
4557
+ }), Se(
4558
+ [
4559
+ () => D.value,
4560
+ () => h.value,
4561
+ () => g.value,
4562
+ () => f.value,
4563
+ () => l.value,
4564
+ () => Le.value,
4565
+ () => E.value,
4566
+ () => U.value
4567
+ ],
4568
+ () => {
4569
+ m.isEditingStyle || je();
4570
+ },
4571
+ { deep: !0, flush: "post" }
4572
+ ), Se(
4573
+ [() => o.value.size],
4574
+ () => {
4575
+ Ge();
4576
+ },
4577
+ { deep: !0 }
4578
+ ), Vt(() => {
4579
+ Ge(), qe.value.sm || qe.value.md || qe.value.xs ? (console.log("Ignoring resize event due to keyboard"), addEventListener("change", Ge)) : addEventListener("resize", Ge), je();
4580
+ }), ao(() => {
4581
+ qe.value.sm || qe.value.md || qe.value.xs ? (console.log("Ignoring resize event due to keyboard"), removeEventListener("change", Ge)) : removeEventListener("resize", Ge);
4582
+ });
4583
+ const $e = Ln();
4584
+ let Fe;
4585
+ async function je() {
4586
+ if (!m.isEditingStyle && !(R.value.length > 0 && !U.value)) {
4587
+ if (D.value.config.schemaNames.length <= 0 && !(D.value.config.dimensions.length <= 0 || D.value.config.metrics.length <= 0)) {
4588
+ $e.open({
4589
+ message: "schema must not be empty and dimension or metrics must have at least 1 column",
4590
+ type: "info"
4591
+ }), n.value = !1;
4592
+ return;
4593
+ }
4594
+ try {
4595
+ n.value = !0, Fe && Fe.abort(), Fe = new AbortController();
4596
+ const _ = Fe.signal, ue = E.value, Pe = await gn(
4597
+ qo,
4598
+ 500
4599
+ )({
4600
+ widget: D.value,
4601
+ signal: _,
4602
+ tileId: o.value.id
4603
+ });
4604
+ E.value === ue && (Ne.value = Pe, F.value = Bt(), setTimeout(() => v(), 100)), n.value = !1;
4605
+ } catch (_) {
4606
+ _.code !== "ERR_CANCELED" && (Ne.value = null, $e.open({ message: `Invalid chart ${D.value.type}`, type: "error" }), console.log(_), n.value = !1);
4607
+ }
4608
+ }
4609
+ }
4610
+ function De(_) {
4611
+ switch (o.value.widget.type) {
4612
+ case "SPACER":
4613
+ return;
4614
+ case "SCORECARD":
4615
+ return;
4616
+ case "TABLE":
4617
+ return `${o.value.size.height * 100 + (Q.value ? 72 : 0) + 96.5}px`;
4618
+ }
4619
+ return `${Math.max(_ / o.value.size.width, 90) * o.value.size.height}px`;
4620
+ }
4621
+ function at() {
4622
+ const _ = M.value - 1;
4623
+ _ >= 0 && (k.value = fe.value[_].value);
4624
+ }
4625
+ function un() {
4626
+ const _ = M.value + 1;
4627
+ _ >= 0 && _ < fe.value.length && (k.value = fe.value[_].value);
4628
+ }
4629
+ const Et = L(pt.EXCEL), Pt = L(), Do = Object.values(pt).map((_) => ({
4630
+ label: Go(_),
4631
+ value: _,
4632
+ onClick: async () => {
4633
+ _ === pt.EXCEL || _ === pt.PDFFULLSIZE || _ === pt.PDFRECEIPT ? await ro({
4634
+ reportType: _,
4635
+ index: m.index,
4636
+ isCombinedLocationLayout: J.value,
4637
+ timeRange: g.value,
4638
+ dateRange: h.value,
4639
+ locationIds: l.value
4640
+ }) : _ === pt.PDF && (Et.value = _, Pt.value = m.index, We.value = !0);
4641
+ }
4642
+ })), Po = D.value.type === ee.Spacer ? "flat" : "outlined", Io = D.value.type === ee.Spacer ? "p-0" : "p-16";
4643
+ return (_, ue) => {
4644
+ const Pe = ie("FmTooltip"), rt = ie("FmSearch"), cn = ie("FmCheckbox"), mt = ie("FmButton"), Mo = ie("FmSelect"), Bo = ie("FmMenuItem"), Ao = ie("FmMenu"), Fo = ie("FmForm"), Ro = ie("FmCircularProgress"), Vo = ie("FmCard");
4645
+ return Y(), de(Vo, {
4646
+ ref_key: "tileCard",
4647
+ ref: A,
4648
+ class: we(`${ln.value} ${s(Io)}`),
4649
+ variant: s(Po)
4650
+ }, {
4651
+ default: xe(() => [
4652
+ se(dl, {
4653
+ modelValue: We.value,
4654
+ "onUpdate:modelValue": ue[0] || (ue[0] = (ht) => We.value = ht),
4655
+ "report-type": Et.value,
4656
+ index: Pt.value
4657
+ }, null, 8, ["modelValue", "report-type", "index"]),
4658
+ (s(R).length > 0 ? s(U) && !n.value : !n.value) ? (Y(), re("div", {
4659
+ key: 0,
4660
+ style: Ie({ height: Lt.value })
4661
+ }, [
4662
+ (Y(), de(oo(sn.value), {
4663
+ key: F.value,
4664
+ modelValue: te.value,
4665
+ "onUpdate:modelValue": ue[4] || (ue[4] = (ht) => te.value = ht),
4666
+ "tile-index": m.index
4667
+ }, {
4668
+ menu: xe(() => [
4669
+ se(Fo, { class: "flex items-center gap-2" }, {
4670
+ default: xe(() => {
4671
+ var ht, Fn, Rn, Vn;
4672
+ return [
4673
+ se(Pe, {
4674
+ variant: "plain",
4675
+ placement: "right",
4676
+ content: D.value.description,
4677
+ "hide-arrow": !0,
4678
+ disabled: !D.value.description,
4679
+ "z-index": 99
4680
+ }, {
4681
+ default: xe(() => [
4682
+ I.value !== !1 ? (Y(), re("p", {
4683
+ key: 0,
4684
+ style: Ie({
4685
+ fontSize: H.value + "px",
4686
+ fontWeight: x.value ? "bold" : "normal",
4687
+ fontStyle: B.value ? "italic" : "normal",
4688
+ paddingRight: B.value ? "4px" : "0px",
4689
+ textDecoration: N.value ? "underline" : "none"
4690
+ }),
4691
+ class: we(["text-fm-color-typo-secondary line-clamp-1", [
4692
+ H.value <= 18 ? "fm-typo-en-body-md-400" : "",
4693
+ D.value.description ? "border-b-2 border-dashed border-gray-300" : ""
4694
+ ]])
4695
+ }, Te(s(lt)(s(r), s(c), D.value.title, "other")), 7)) : me("", !0)
4696
+ ]),
4697
+ _: 1
4698
+ }, 8, ["content", "disabled"]),
4699
+ (ht = ot.value) != null && ht.showSearchBar ? (Y(), de(rt, {
4700
+ key: 0,
4701
+ modelValue: Tt.value,
4702
+ "onUpdate:modelValue": ue[1] || (ue[1] = (Oe) => Tt.value = Oe),
4703
+ class: "grow"
4704
+ }, null, 8, ["modelValue"])) : (Y(), re("div", ml)),
4705
+ Uo(se(cn, {
4706
+ modelValue: y.value,
4707
+ "onUpdate:modelValue": ue[2] || (ue[2] = (Oe) => y.value = Oe),
4708
+ label: "Label",
4709
+ value: !1
4710
+ }, null, 8, ["modelValue"]), [
4711
+ [Ko, (Fn = ot.value) == null ? void 0 : Fn.showLabel]
4712
+ ]),
4713
+ (Rn = ot.value) != null && Rn.showDrillDimension && fe.value.length > 0 ? (Y(), re("div", hl, [
4714
+ se(mt, {
4715
+ icon: "arrow_upward",
4716
+ variant: "tertiary",
4717
+ disabled: !z.value,
4718
+ onClick: at
4719
+ }, null, 8, ["disabled"]),
4720
+ se(mt, {
4721
+ icon: "arrow_downward",
4722
+ variant: "tertiary",
4723
+ disabled: !q.value,
4724
+ onClick: un
4725
+ }, null, 8, ["disabled"])
4726
+ ])) : me("", !0),
4727
+ (Vn = ot.value) != null && Vn.showRollup && ce.value.length > 0 ? (Y(), de(Mo, {
4728
+ key: `rollup-${s(d)}`,
4729
+ modelValue: p.value,
4730
+ "onUpdate:modelValue": ue[3] || (ue[3] = (Oe) => p.value = Oe),
4731
+ class: "w-[150px]",
4732
+ items: ce.value
4733
+ }, null, 8, ["modelValue", "items"])) : me("", !0),
4734
+ m.hideExport ? me("", !0) : (Y(), de(Ao, {
4735
+ key: 4,
4736
+ shift: !0
4737
+ }, {
4738
+ "menu-button": xe(() => [
4739
+ se(mt, {
4740
+ icon: "more_vert",
4741
+ variant: "tertiary"
4742
+ })
4743
+ ]),
4744
+ default: xe(() => [
4745
+ (Y(!0), re(Ve, null, Ft(s(Do), (Oe) => (Y(), de(Bo, {
4746
+ key: Oe.value,
4747
+ label: Oe.label,
4748
+ onClick: Oe.onClick
4749
+ }, null, 8, ["label", "onClick"]))), 128))
4750
+ ]),
4751
+ _: 1
4752
+ }))
4753
+ ];
4754
+ }),
4755
+ _: 1
4756
+ })
4757
+ ]),
4758
+ _: 1
4759
+ }, 8, ["modelValue", "tile-index"]))
4760
+ ], 4)) : (Y(), de(Ro, { key: 1 }))
4761
+ ]),
4762
+ _: 1
4763
+ }, 8, ["class", "variant"]);
4764
+ };
4765
+ }
4766
+ });
4767
+ export {
4768
+ Cn as L,
4769
+ Je as R,
4770
+ ye as S,
4771
+ Ll as _,
4772
+ bn as a,
4773
+ uo as b,
4774
+ Tl as c,
4775
+ yt as d,
4776
+ fn as g
4777
+ };