@feedmepos/mf-report 5.22.1 → 5.22.2-beta.0

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