@feedmepos/mf-report 5.27.13 → 5.27.14

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