@feedmepos/mf-report 5.19.7-beta.0 → 5.19.8-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{App-h-tDKQlA.js → App-D2-wz8ZV.js} +4 -4
  2. package/dist/BaseDialog.vue_vue_type_script_setup_true_lang-Wsp8VGv0.js +19594 -0
  3. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-D1KEawaw.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-CioHmHN6.js} +2 -2
  4. package/dist/{Default.vue_vue_type_script_setup_true_lang-piRZPnBL.js → Default.vue_vue_type_script_setup_true_lang-635FjOPP.js} +2 -2
  5. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-DiBpQb7o.js +1673 -0
  6. package/dist/{InsightView-BfUgwaQG.js → InsightView-Cy75KuEh.js} +5 -5
  7. package/dist/{Integration-Ck5SytHF.js → Integration-D6N9nftt.js} +2 -2
  8. package/dist/{Integrations-CN2VLJyH.js → Integrations-ClCpYgsX.js} +3 -3
  9. package/dist/{Layout-Ctex8ogt.js → Layout-DPQzsxqk.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-Cu22qdoM.js → MenuTab.vue_vue_type_script_setup_true_lang-zwpO7Fxk.js} +6 -6
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-K2OuicKC.js → NavigationTab.vue_vue_type_script_setup_true_lang-DpmOHFlh.js} +6990 -6984
  12. package/dist/{NoData.vue_vue_type_script_setup_true_lang-CYlrI2O9.js → NoData.vue_vue_type_script_setup_true_lang-CAGjM94B.js} +1 -1
  13. package/dist/{OverviewView-B-UnBjtq.js → OverviewView-DlLFc9e_.js} +5 -5
  14. package/dist/{Report-BqacDpGo.js → Report-W8-KjFN8.js} +4 -4
  15. package/dist/{ReportEditor-Bq94ZeJe.js → ReportEditor-Dzj_gg3s.js} +6 -6
  16. package/dist/{ReportView-B4KxY9_Q.js → ReportView-CmErSwKu.js} +7 -7
  17. package/dist/{SelectComponent.vue_vue_type_script_setup_true_lang-BrTCEJlK.js → SelectComponent.vue_vue_type_script_setup_true_lang-wbYOXNgr.js} +1 -1
  18. package/dist/{Setting-BNhk0ns2.js → Setting-BXQIl_2E.js} +4 -4
  19. package/dist/{TileEditor-DE5XDX9P.js → TileEditor-BxxjJuUG.js} +7 -7
  20. package/dist/{TransitionFade-CvpWXkrp.js → TransitionFade-CfY9Tv9a.js} +92 -92
  21. package/dist/app.js +11 -11
  22. package/dist/assets/formatChartData.worker-Cr9zHMoq.js +106 -0
  23. package/dist/assets/processTableData.worker-COqO3hgX.js +106 -0
  24. package/dist/{helper-mE0Q3YSh.js → helper-BYQmOCI_.js} +1 -1
  25. package/dist/{vue-i18n-B27SDmEk.js → vue-i18n-B-WkKyGH.js} +176 -176
  26. package/package.json +2 -3
  27. package/dist/BaseDialog.vue_vue_type_script_setup_true_lang-ODTkggPg.js +0 -11208
  28. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-BsH90tAb.js +0 -1628
  29. package/dist/assets/formatChartData.worker-2gP9DT2G.js +0 -8
@@ -0,0 +1,1673 @@
1
+ import { computed as g, defineComponent as le, mergeModels as he, useModel as oe, ref as d, onMounted as be, nextTick as J, watch as G, resolveComponent as E, createElementBlock as U, openBlock as W, Fragment as ue, renderSlot as we, createVNode as P, normalizeStyle as de, unref as o, createElementVNode as M, toDisplayString as De, withCtx as Y, createBlock as j, createCommentVNode as ye, normalizeClass as Me, h as Pe, renderList as _t, toRaw as ea, markRaw as ta, createTextVNode as aa, onUnmounted as la, resolveDynamicComponent as oa, withDirectives as na, vShow as sa } from "vue";
2
+ import { W as T, d as Ve, e as ra, S as We, v as Ie, f as ia, g as je, h as Ft, q as ca, R as Fe, i as ua } from "./BaseDialog.vue_vue_type_script_setup_true_lang-Wsp8VGv0.js";
3
+ import { u as Ne, b as ot, a as nt } from "./vue-i18n-B-WkKyGH.js";
4
+ import { a as Ct } from "./helper-BYQmOCI_.js";
5
+ import { storeToRefs as Ee, defineStore as da } from "pinia";
6
+ import { useBreakpoints as Rt, useSnackbar as st, components as ha } from "@feedmepos/ui-library";
7
+ import { a as ma } from "./SelectComponent.vue_vue_type_script_setup_true_lang-wbYOXNgr.js";
8
+ import { r as Re } from "./i18n-Cif1I9J2.js";
9
+ import { _ as St } from "./NoData.vue_vue_type_script_setup_true_lang-CAGjM94B.js";
10
+ var Ze = /* @__PURE__ */ ((e) => (e.line = "LINE", e.bar = "BAR", e))(Ze || {}), ge = /* @__PURE__ */ ((e) => (e.top = "TOP", e.bottom = "BOTTOM", e))(ge || {}), Qe = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(Qe || {}), et = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(et || {}), tt = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(tt || {}), at = /* @__PURE__ */ ((e) => (e.right = "right", e.left = "left", e))(at || {}), lt = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e.right = "right", e.left = "left", e.chartArea = "chartArea", e))(lt || {});
11
+ T.Circular, T.Table, T.BarChart, T.LineChart, T.StackBarChart, T.StackLineChart, T.Scorecard, T.Spacer;
12
+ const pa = [
13
+ {
14
+ type: T.Circular,
15
+ showLabel: !1,
16
+ // TODO: temporarily removed show label as it has no function
17
+ showDrillDimension: !0,
18
+ showRollup: !1,
19
+ showSearchBar: !1
20
+ },
21
+ {
22
+ type: T.Table,
23
+ showLabel: !1,
24
+ showDrillDimension: !0,
25
+ showRollup: !0,
26
+ showSearchBar: !0
27
+ },
28
+ {
29
+ type: T.BarChart,
30
+ showLabel: !1,
31
+ // TODO: temporarily removed show label as it has no function
32
+ showDrillDimension: !0,
33
+ showRollup: !1,
34
+ showSearchBar: !1
35
+ },
36
+ {
37
+ type: T.LineChart,
38
+ showLabel: !1,
39
+ // TODO: temporarily removed show label as it has no function
40
+ showDrillDimension: !0,
41
+ showRollup: !0,
42
+ showSearchBar: !1
43
+ },
44
+ {
45
+ type: T.StackBarChart,
46
+ showLabel: !1,
47
+ // TODO: temporarily removed show label as it has no function
48
+ showDrillDimension: !0,
49
+ showRollup: !0,
50
+ showSearchBar: !1
51
+ },
52
+ {
53
+ type: T.StackLineChart,
54
+ showLabel: !1,
55
+ // TODO: temporarily removed show label as it has no function
56
+ showDrillDimension: !0,
57
+ showRollup: !0,
58
+ showSearchBar: !1
59
+ },
60
+ {
61
+ type: T.Scorecard,
62
+ showLabel: !1,
63
+ showDrillDimension: !1,
64
+ showRollup: !1,
65
+ showSearchBar: !1
66
+ },
67
+ {
68
+ type: T.Spacer,
69
+ showLabel: !1,
70
+ showDrillDimension: !1,
71
+ showRollup: !1,
72
+ showSearchBar: !1
73
+ }
74
+ ];
75
+ function Je(e) {
76
+ const n = [e.schemaName, e.name];
77
+ return "option" in e && e.option && n.push(e.option), "aggregation" in e && e.aggregation && n.push(e.aggregation), n.push(e.label.replace(/[^a-zA-Z0-9]/g, "")), n.join("_").toLowerCase();
78
+ }
79
+ function fa(e, n) {
80
+ switch (e) {
81
+ case T.BarChart:
82
+ case T.LineChart:
83
+ case T.StackBarChart:
84
+ case T.StackLineChart:
85
+ return Array.isArray(n == null ? void 0 : n.datasets) && Array.isArray(n == null ? void 0 : n.xAxis) && n.datasets.length > 0 && n.xAxis.length > 0;
86
+ case T.Table:
87
+ return Array.isArray(n == null ? void 0 : n.rows) && Array.isArray(n == null ? void 0 : n.columns) && n.rows.length > 0 && n.columns.length > 0;
88
+ case T.Circular:
89
+ return Array.isArray(n == null ? void 0 : n.datasets) && n.datasets.length > 0;
90
+ case T.Scorecard:
91
+ return !0;
92
+ case T.Spacer:
93
+ return !0;
94
+ }
95
+ }
96
+ const kt = [
97
+ "54, 162, 235",
98
+ //8CE6D7
99
+ "0, 123, 167",
100
+ //007BA7
101
+ "255, 93, 83",
102
+ //FF5D53
103
+ "115, 200, 230",
104
+ //73C8E6
105
+ "252, 162, 62",
106
+ //FCA23E
107
+ "240, 155, 190",
108
+ //F09BBE
109
+ "255, 210, 50",
110
+ //FFD232
111
+ "80, 190, 155",
112
+ //50BE9B
113
+ "131, 88, 212",
114
+ //8358D4
115
+ "155, 80, 70"
116
+ //9B5046
117
+ ];
118
+ function ae({
119
+ index: e,
120
+ isCompare: n,
121
+ opacity: p
122
+ }) {
123
+ let t = typeof p == "number" ? p : 1;
124
+ return n && (t = t * 0.6), `rgba(${kt[e % kt.length]}, ${t})`;
125
+ }
126
+ function zt(e, n, p) {
127
+ if (e === "" || n === "")
128
+ return null;
129
+ let t = (_) => _ == null ? void 0 : _.replace(/,/g, "");
130
+ p === "ID" && (t = (_) => _ == null ? void 0 : _.replace(/\./g, "").replace(/,/g, "."));
131
+ const w = Number(t(e)), F = Number(t(n));
132
+ if (isNaN(w) || isNaN(F))
133
+ return null;
134
+ let C = 0;
135
+ F === 0 ? w === 0 ? C = 0 : C = 1 : C = (w - F) / F;
136
+ const S = va(C);
137
+ return {
138
+ value: isNaN(C) ? "" : `${(C * 100).toFixed(0)}%`,
139
+ icon: S
140
+ };
141
+ }
142
+ function va(e) {
143
+ return e > 0 ? {
144
+ name: "moving",
145
+ color: "#1F7735",
146
+ tailwind: "fm-color-system-success-100"
147
+ } : e < 0 ? {
148
+ name: "trending_down",
149
+ color: "#99231D",
150
+ tailwind: "fm-color-system-error-100"
151
+ } : {
152
+ name: "equal",
153
+ color: "#C7C7CC",
154
+ tailwind: "fm-color-neutral-gray-100"
155
+ };
156
+ }
157
+ function He(e) {
158
+ function n(s, c, i) {
159
+ if (s.measureText(c).width <= i) return c;
160
+ const r = "…";
161
+ let x = 0, b = c.length;
162
+ for (; x < b; ) {
163
+ const f = Math.floor((x + b) / 2), m = c.slice(0, f) + r;
164
+ s.measureText(m).width <= i ? x = f + 1 : b = f;
165
+ }
166
+ return c.slice(0, x - 1) + r;
167
+ }
168
+ const p = g(() => ({
169
+ display: e.showLabel,
170
+ align: e.labelAlign,
171
+ anchor: e.labelAnchor,
172
+ rotation: e.labelRotation,
173
+ offset: e.labelOffset,
174
+ font: {
175
+ size: e.labelFontSize
176
+ },
177
+ color: (s) => {
178
+ const c = s.chart.data.datasets[s.datasetIndex];
179
+ return c.borderColor ? Array.isArray(c.borderColor) ? c.borderColor[s.dataIndex] : c.borderColor : c.backgroundColor ? Array.isArray(c.backgroundColor) ? c.backgroundColor[s.dataIndex] : c.backgroundColor : "#000";
180
+ },
181
+ formatter: (s) => s === 0 ? "" : s.toLocaleString("en-US")
182
+ })), t = g(() => ({
183
+ display: e.showX,
184
+ position: e.xPosition,
185
+ grid: {
186
+ display: e.showXGrid
187
+ },
188
+ ticks: {
189
+ display: e.showXTick,
190
+ callback: function(s) {
191
+ if ((e == null ? void 0 : e.isTransposed) === !0) return String(s);
192
+ let i = String(s);
193
+ const r = this;
194
+ r && typeof r.getLabelForValue == "function" && (i = r.getLabelForValue(s));
195
+ const x = r == null ? void 0 : r.chart, b = r == null ? void 0 : r.ctx, f = x.height * 0.25;
196
+ if (b && f > 0) {
197
+ b.save();
198
+ const L = b.measureText(i).width > f ? n(b, i, f) : i;
199
+ return b.restore(), L;
200
+ }
201
+ return i;
202
+ },
203
+ font: {
204
+ size: e.xTickFontSize
205
+ }
206
+ },
207
+ title: {
208
+ display: e.showXTitle,
209
+ text: e.xTitle,
210
+ font: {
211
+ size: e.xTitleFontSize
212
+ }
213
+ },
214
+ afterBuildTicks: (s) => {
215
+ const c = Array.isArray(s == null ? void 0 : s.ticks) ? s.ticks : [];
216
+ if (c.length === 0) return;
217
+ const i = s.getLabelForValue(c[0].value), r = !isNaN(Number(i));
218
+ s.options.ticks.minRotation = r || c.length < 10 ? 0 : 90;
219
+ },
220
+ afterFit: (s) => {
221
+ if (!(e != null && e.isTransposed)) {
222
+ const c = s.chart.height * 0.4;
223
+ s.height > c && (s.height = c);
224
+ }
225
+ }
226
+ })), w = g(() => ({
227
+ display: e.showY,
228
+ position: e.yPosition,
229
+ grid: {
230
+ display: e.showYGrid
231
+ },
232
+ ticks: {
233
+ display: e.showYTick,
234
+ font: {
235
+ size: e.yTickFontSize
236
+ },
237
+ callback: function(s) {
238
+ if (!((e == null ? void 0 : e.isTransposed) === !0)) return String(s);
239
+ let i = String(s);
240
+ const r = this;
241
+ r && typeof r.getLabelForValue == "function" && (i = r.getLabelForValue(s));
242
+ const x = r == null ? void 0 : r.chart, b = r == null ? void 0 : r.ctx, f = x.width * 0.4;
243
+ if (b && f > 0) {
244
+ b.save();
245
+ const L = b.measureText(i).width > f ? n(b, i, f) : i;
246
+ return b.restore(), L;
247
+ }
248
+ return i;
249
+ }
250
+ },
251
+ title: {
252
+ display: e.showYTitle,
253
+ text: e.yTitle,
254
+ font: {
255
+ size: e.yTitleFontSize
256
+ }
257
+ }
258
+ })), F = g(() => ({
259
+ display: e.showLegend,
260
+ position: e.legendPosition,
261
+ usePointStyle: e.usePointStyle,
262
+ maxHeight: e.legendMaxHeight,
263
+ maxWidth: e.legendMaxWidth,
264
+ labels: {
265
+ usePointStyle: e.usePointStyle ?? !0,
266
+ generateLabels: (s) => {
267
+ var i;
268
+ const c = ((i = s == null ? void 0 : s.data) == null ? void 0 : i.datasets) || [];
269
+ if (c.length === 0) return [];
270
+ if (c.length === 1 && Array.isArray(c[0].backgroundColor) && c[0].backgroundColor.length > 1 && Array.isArray(c[0].data)) {
271
+ const r = c[0];
272
+ return s.data.labels.map((b, f) => {
273
+ const m = r.backgroundColor[f];
274
+ return {
275
+ text: b,
276
+ fontColor: "#6b6b6b",
277
+ fillStyle: m,
278
+ strokeStyle: m,
279
+ datasetIndex: 0,
280
+ index: f,
281
+ hidden: s.getDataVisibility ? !s.getDataVisibility(f) : !1
282
+ };
283
+ });
284
+ }
285
+ return s.data.datasets.map((r, x) => {
286
+ const b = r.borderColor || r.backgroundColor;
287
+ return {
288
+ text: r.label,
289
+ fontColor: "#6b6b6b",
290
+ fillStyle: b,
291
+ strokeStyle: b,
292
+ datasetIndex: x,
293
+ hidden: !s.isDatasetVisible(x)
294
+ };
295
+ });
296
+ }
297
+ }
298
+ })), C = g(() => e.isTransposed), S = g(() => e.chartWidth), _ = g(() => e.chartHeight);
299
+ return { datalabels: p, xCfg: t, yCfg: w, isTransposed: C, legend: F, chartWidth: S, chartHeight: _ };
300
+ }
301
+ const ga = /* @__PURE__ */ le({
302
+ __name: "WidgetBarchart",
303
+ props: /* @__PURE__ */ he({
304
+ tileIndex: {}
305
+ }, {
306
+ modelValue: { required: !0 },
307
+ modelModifiers: {}
308
+ }),
309
+ emits: ["update:modelValue"],
310
+ setup(e) {
311
+ const n = e, p = oe(e, "modelValue"), t = d(null), w = g(() => {
312
+ var m;
313
+ return ((m = p.value.data) == null ? void 0 : m.xAxis) ?? [];
314
+ }), F = g(() => {
315
+ var m;
316
+ return ((m = p.value.data) == null ? void 0 : m.datasets) ?? [];
317
+ }), { datalabels: C, xCfg: S, yCfg: _, isTransposed: s, legend: c, chartWidth: i, chartHeight: r } = He(
318
+ p.value
319
+ ), x = g(() => F.value.length > 0 ? [
320
+ ...F.value.map((m, L) => ({
321
+ label: m.name,
322
+ data: m.values,
323
+ dash: !!m.isCompare,
324
+ backgroundColor: ae({ index: L, isCompare: m.isCompare })
325
+ }))
326
+ ] : []), b = Ve();
327
+ function f() {
328
+ return b.extractChartSize(t.value, n.tileIndex) || { width: 0, height: 0 };
329
+ }
330
+ return be(() => {
331
+ J(() => {
332
+ f();
333
+ });
334
+ }), G([x], () => {
335
+ J(() => f());
336
+ }), (m, L) => {
337
+ const h = E("FmBarChart");
338
+ return W(), U(ue, null, [
339
+ we(m.$slots, "menu"),
340
+ P(h, {
341
+ ref_key: "chartRef",
342
+ ref: t,
343
+ class: "bar-chart",
344
+ datasets: x.value,
345
+ "x-axis": { categories: w.value },
346
+ "x-cfg": o(S),
347
+ "y-cfg": o(_),
348
+ transpose: o(s),
349
+ legend: {
350
+ display: o(c).display ?? !1,
351
+ position: o(c).position,
352
+ maxHeight: o(c).maxHeight,
353
+ maxWidth: o(c).maxWidth,
354
+ labels: o(c).labels
355
+ },
356
+ datalabels: o(C),
357
+ "maintain-aspect-ratio": !1,
358
+ style: de({
359
+ "--chart-width": o(i) !== void 0 ? o(i) + "px" : "100%",
360
+ "--chart-height": o(r) !== void 0 ? o(r) + "px" : "calc(100% - 36px)"
361
+ })
362
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
363
+ ], 64);
364
+ };
365
+ }
366
+ }), ya = /* @__PURE__ */ le({
367
+ __name: "WidgetCircular",
368
+ props: /* @__PURE__ */ he({
369
+ tileIndex: {}
370
+ }, {
371
+ modelValue: { required: !0 },
372
+ modelModifiers: {}
373
+ }),
374
+ emits: ["update:modelValue"],
375
+ setup(e) {
376
+ const n = e, p = oe(e, "modelValue"), { breakpoints: t } = Rt(), w = d(null), { datalabels: F, legend: C, chartWidth: S, chartHeight: _ } = He(p.value), s = g(() => {
377
+ let x = [];
378
+ return p.value.data.datasets && p.value.data.metrics && p.value.data.datasets.length > 0 && p.value.data.metrics.length > 0 && (x = [
379
+ {
380
+ label: p.value.data.metrics[0],
381
+ data: p.value.data.datasets.map((b) => b.value),
382
+ backgroundColor: p.value.data.datasets.map((b, f) => ae({ index: f }))
383
+ }
384
+ ]), x;
385
+ }), c = Ve();
386
+ function i() {
387
+ return c.extractChartSize(w.value, n.tileIndex) || { width: 0, height: 0 };
388
+ }
389
+ be(() => {
390
+ J(() => {
391
+ i();
392
+ });
393
+ }), G([s], () => {
394
+ J(() => i());
395
+ });
396
+ const r = g(() => t.value.lg ? 12 : 8);
397
+ return (x, b) => {
398
+ const f = E("FmPieChart");
399
+ return W(), U(ue, null, [
400
+ we(x.$slots, "menu"),
401
+ P(f, {
402
+ ref_key: "chartRef",
403
+ ref: w,
404
+ class: "circular",
405
+ percentage: "70%",
406
+ datasets: s.value,
407
+ metrics: p.value.data.datasets.map((m) => m.name),
408
+ variant: "doughnut",
409
+ legend: {
410
+ display: o(C).display ?? !0,
411
+ position: o(C).position ?? "top",
412
+ maxHeight: o(C).maxHeight,
413
+ maxWidth: o(C).maxWidth,
414
+ labels: {
415
+ ...o(C).labels,
416
+ font: {
417
+ size: r.value
418
+ }
419
+ }
420
+ },
421
+ datalabels: o(F),
422
+ "maintain-aspect-ratio": !1,
423
+ style: de({
424
+ "--chart-width": o(S) !== void 0 ? o(S) + "px" : "100%",
425
+ "--chart-height": o(_) !== void 0 ? o(_) + "px" : "calc(100% - 36px)"
426
+ })
427
+ }, null, 8, ["datasets", "metrics", "legend", "datalabels", "style"])
428
+ ], 64);
429
+ };
430
+ }
431
+ }), ba = { class: "flex flex-col gap-1" }, wa = { class: "fm-typo-en-title-sm-600" }, xa = { class: "flex gap-2" }, Ca = { key: 0 }, Sa = { key: 1 }, ka = /* @__PURE__ */ le({
432
+ __name: "WidgetScorecard",
433
+ props: {
434
+ modelValue: { required: !0 },
435
+ modelModifiers: {}
436
+ },
437
+ emits: ["update:modelValue"],
438
+ setup(e) {
439
+ const n = oe(e, "modelValue"), { t: p } = Ne(), { compareDateRange: t, defaultDateSetting: w } = Ee(ot()), { country: F } = nt(), C = g(() => {
440
+ var i;
441
+ return ((i = n.value.data) == null ? void 0 : i.value) || "";
442
+ }), S = g(() => {
443
+ const { data: i } = n.value;
444
+ return i != null && i.comparison ? zt(C.value, i.comparison, F) : null;
445
+ });
446
+ function _(i) {
447
+ switch (i) {
448
+ case Ze.bar:
449
+ return "bar";
450
+ case Ze.line:
451
+ return "line";
452
+ default:
453
+ return "line";
454
+ }
455
+ }
456
+ const s = g(() => {
457
+ var i;
458
+ return (i = n.value.data) == null ? void 0 : i.sparkline;
459
+ }), c = g(() => s.value.datasets.map((i) => ({
460
+ label: i.name,
461
+ data: i.values,
462
+ fill: !0,
463
+ color: "#36a2eb"
464
+ })));
465
+ return (i, r) => {
466
+ var L;
467
+ const x = E("FmIcon"), b = E("FmChip"), f = E("FmTooltip"), m = E("FmLineChart");
468
+ return W(), U("div", ba, [
469
+ we(i.$slots, "menu"),
470
+ M("p", wa, De(C.value), 1),
471
+ M("div", xa, [
472
+ P(f, {
473
+ content: `vs. ${(L = o(w).defaultCompareType) == null ? void 0 : L.split("_").join(" ")}`,
474
+ placement: "right",
475
+ "hide-arrow": "",
476
+ variant: "plain"
477
+ }, {
478
+ default: Y(() => [
479
+ S.value ? (W(), j(b, {
480
+ key: 0,
481
+ icon: S.value.icon.name,
482
+ class: Me(`bg-${S.value.icon.tailwind}`),
483
+ compact: ""
484
+ }, {
485
+ default: Y(() => [
486
+ P(x, {
487
+ name: S.value.icon.name,
488
+ color: S.value.icon.color
489
+ }, null, 8, ["name", "color"]),
490
+ M("p", {
491
+ class: "fm-typo-en-body-md-600",
492
+ style: de({ color: S.value.icon.color })
493
+ }, De(S.value.value), 5)
494
+ ]),
495
+ _: 1
496
+ }, 8, ["icon", "class"])) : ye("", !0),
497
+ o(t).endDate !== null && o(t).startDate !== null && S.value === null ? (W(), j(b, {
498
+ key: 1,
499
+ compact: ""
500
+ }, {
501
+ default: Y(() => [
502
+ P(x, {
503
+ name: "arrow_upward",
504
+ color: "#C7C7CC"
505
+ }),
506
+ r[0] || (r[0] = M("p", { class: "fm-typo-en-body-md-600 text-fm-color-typo-disabled" }, "N/A", -1))
507
+ ]),
508
+ _: 1
509
+ })) : ye("", !0)
510
+ ]),
511
+ _: 1
512
+ }, 8, ["content"])
513
+ ]),
514
+ s.value ? (W(), U("div", Ca, [
515
+ _(s.value.type) === "line" ? (W(), j(m, {
516
+ key: 0,
517
+ class: "sparkline",
518
+ datasets: c.value,
519
+ legend: {
520
+ display: !1
521
+ },
522
+ datalabels: { display: !1 },
523
+ "x-axis": { categories: s.value.dimensions },
524
+ "y-cfg": { display: !1 },
525
+ "x-cfg": { display: !1 },
526
+ "maintain-aspect-ratio": !1
527
+ }, null, 8, ["datasets", "x-axis"])) : ye("", !0)
528
+ ])) : (W(), U("div", Sa, r[1] || (r[1] = [
529
+ M("div", { class: "sparkline" }, [
530
+ M("div", { class: "flex flex-col gap-8" }, [
531
+ M("div"),
532
+ M("div")
533
+ ]),
534
+ M("div", { class: "grow" })
535
+ ], -1)
536
+ ])))
537
+ ]);
538
+ };
539
+ }
540
+ }), Ta = {};
541
+ function _a(e, n) {
542
+ const p = E("FmMenuDivider");
543
+ return W(), j(p);
544
+ }
545
+ const Fa = /* @__PURE__ */ ma(Ta, [["render", _a]]), Ra = "mf-reporttable-dimension", Tt = da(Ra, () => {
546
+ const e = d(0), n = d([]), p = d(!1), t = (h, l) => {
547
+ e.value = h, F(h, l);
548
+ }, w = (h, l, y, v) => {
549
+ n[h] = l, n.value = [...n.value], C(h, l, y, v);
550
+ }, F = (h, l) => {
551
+ const y = (l == null ? void 0 : l.querySelectorAll("thead tr")) ?? [], v = (l == null ? void 0 : l.querySelectorAll("tbody tr")) ?? [];
552
+ [...y, ...v].forEach((D) => {
553
+ const $ = D;
554
+ $ && ($.style.height = `${h}px`);
555
+ });
556
+ }, C = (h, l, y, v = !1) => {
557
+ const k = (y == null ? void 0 : y.querySelectorAll("th")) ?? [];
558
+ if (h === void 0) return;
559
+ const D = k[h], $ = v ? n[h] : l;
560
+ if (!D || $ === void 0) return;
561
+ const B = () => {
562
+ D.style.width = `${$}px`;
563
+ };
564
+ v ? requestAnimationFrame(B) : B();
565
+ }, S = () => {
566
+ const h = document.querySelectorAll("th"), l = document.querySelectorAll("td"), y = document.querySelector("table");
567
+ y == null || y.classList.add("table-fixed"), h.forEach((v) => v.classList.add("toggleEditResize")), l.forEach((v) => v.classList.add("toggleEditResize")), p.value = !0;
568
+ }, _ = () => {
569
+ const h = document.querySelectorAll("th"), l = document.querySelectorAll("td"), y = document.querySelectorAll(".col-resize-handle"), v = document.querySelectorAll(".row-resize-handle");
570
+ h.forEach((k) => k.classList.remove("toggleEditResize")), l.forEach((k) => k.classList.remove("toggleEditResize")), y.forEach((k) => k.remove()), v.forEach((k) => k.remove()), p.value = !1;
571
+ }, s = () => {
572
+ e.value = 0, n.value = [];
573
+ }, c = (h, l) => {
574
+ if (l) {
575
+ const y = document.querySelectorAll(`thead th:nth-child(${h + 1})`), v = document.querySelectorAll(`tbody td:nth-child(${h + 1})`);
576
+ [...y, ...v].forEach((k) => {
577
+ k.classList.add("highlight-hover-col");
578
+ });
579
+ } else
580
+ document.querySelectorAll(
581
+ `thead th:nth-child(${h + 1}), tbody td:nth-child(${h + 1})`
582
+ ).forEach((y) => y.classList.add("highlight-col"));
583
+ }, i = (h) => {
584
+ const l = document.querySelectorAll("thead tr"), y = document.querySelectorAll("tbody tr"), v = [...l, ...y];
585
+ for (const k of v)
586
+ h ? k.classList.add("highlight-hover-row") : k.classList.add("highlight-row");
587
+ }, r = (h) => {
588
+ const l = h ? ".highlight-hover-row" : ".highlight-row", y = document.querySelectorAll(l);
589
+ for (const v of y)
590
+ v.classList.remove(l.slice(1));
591
+ }, x = (h) => {
592
+ h ? document.querySelectorAll(".highlight-hover-col").forEach((l) => {
593
+ l.classList.remove("highlight-hover-col");
594
+ }) : document.querySelectorAll(".highlight-col").forEach((l) => l.classList.remove("highlight-col"));
595
+ }, b = (h, l) => {
596
+ const y = /* @__PURE__ */ new Map(), v = h.clientX, k = h.target.closest("table"), D = k == null ? void 0 : k.querySelectorAll("th")[l], $ = D == null ? void 0 : D.getBoundingClientRect().width, B = y.get(l) ? n[l.toString()] || 60 : (y.set(l, !0), $ || n[l.toString()] || 60), N = D == null ? void 0 : D.querySelector("p");
597
+ if (!N) return;
598
+ const ne = N.textContent || "", K = window.getComputedStyle(N), Z = `${K.fontWeight} ${K.fontSize} ${K.fontFamily}`, u = document.createElement("canvas").getContext("2d");
599
+ if (!u) return;
600
+ u.font = Z;
601
+ const R = u.measureText(ne), V = window.getComputedStyle(D), A = parseFloat(V.paddingLeft || "0"), H = parseFloat(V.paddingRight || "0"), z = R.width + A + H;
602
+ c(l, !1);
603
+ const O = (re) => {
604
+ const Q = re.clientX - v, ee = Math.max(z, B + Q);
605
+ if (k) {
606
+ w(l, ee, k, !0);
607
+ let ie = 0;
608
+ k.querySelectorAll("th").forEach((me, pe) => {
609
+ ie += pe === l ? ee : n[pe] || me.getBoundingClientRect().width;
610
+ }), k.classList.remove("w-full"), k.style.width = `${ie}px`;
611
+ const ce = k == null ? void 0 : k.parentElement;
612
+ if (ce) {
613
+ const me = ce.scrollWidth, pe = ce.scrollLeft;
614
+ ce.offsetWidth + pe >= me - 100 && (ce.scrollLeft = me);
615
+ }
616
+ }
617
+ }, se = () => {
618
+ const re = (k == null ? void 0 : k.querySelectorAll("th")) ?? [], Q = [...n.value];
619
+ re.forEach((ee, ie) => {
620
+ const Ce = ee.getBoundingClientRect().width;
621
+ n[ie] = Ce, Q[ie] = Ce;
622
+ }), n.value = Q, x(!1), document.removeEventListener("mousemove", O), document.removeEventListener("mouseup", se);
623
+ };
624
+ document.addEventListener("mousemove", O), document.addEventListener("mouseup", se);
625
+ }, f = (h) => {
626
+ const l = h.clientY, y = h.target.closest("table"), v = e.value || 48;
627
+ i(!1);
628
+ const k = ($) => {
629
+ const B = Math.max(30, v + ($.clientY - l));
630
+ y && t(B, y);
631
+ }, D = () => {
632
+ r(!1), document.removeEventListener("mousemove", k), document.removeEventListener("mouseup", D);
633
+ };
634
+ document.addEventListener("mousemove", k), document.addEventListener("mouseup", D);
635
+ };
636
+ return {
637
+ rowHeight: e,
638
+ colWidths: n,
639
+ isEditing: p,
640
+ updateRowHeight: t,
641
+ updateColWidth: w,
642
+ setRowHeights: F,
643
+ setColWidths: C,
644
+ enableEditMode: S,
645
+ disableEditMode: _,
646
+ resetStore: s,
647
+ highlightCol: c,
648
+ highlightRows: i,
649
+ removeRowHighlight: r,
650
+ removeColHighlight: x,
651
+ resizeCol: b,
652
+ resizeRow: f,
653
+ enableCellResizing: () => {
654
+ const h = document.querySelector("thead"), l = document.querySelectorAll("thead tr"), y = document.querySelectorAll("tbody tr"), v = [...l, ...y];
655
+ h && h.classList.remove("sticky");
656
+ const k = (D, $) => {
657
+ const B = document.createElement("div");
658
+ return B.className = `${D}-resize-handle`, D === "col" ? (B.addEventListener("mouseenter", () => c($, !0)), B.addEventListener("mouseleave", () => x(!0)), B.addEventListener("mousedown", (N) => {
659
+ N.stopPropagation(), b(N, $);
660
+ })) : (B.addEventListener("mouseenter", () => i(!0)), B.addEventListener("mouseleave", () => r(!0)), B.addEventListener("mousedown", (N) => {
661
+ N.stopPropagation(), f(N);
662
+ })), B;
663
+ };
664
+ v.forEach((D) => {
665
+ const $ = D.closest("thead") !== null;
666
+ D.querySelectorAll($ ? "th" : "td").forEach((N, ne) => {
667
+ const K = k("col", ne), Z = k("row", ne);
668
+ N.appendChild(K), N.appendChild(Z);
669
+ });
670
+ }), S();
671
+ },
672
+ cancelResizingChanges: () => {
673
+ _();
674
+ }
675
+ };
676
+ });
677
+ function Ke(e) {
678
+ if (e == null || e === "")
679
+ return "";
680
+ const n = String(e), p = Number(n);
681
+ if (isNaN(p)) return n;
682
+ const [t, w] = n.split("."), F = new Intl.NumberFormat("en-US").format(Number(t));
683
+ return w !== void 0 ? `${F}.${w}` : F;
684
+ }
685
+ const za = "/assets/processTableData.worker-COqO3hgX.js", La = { class: "my-4" }, Aa = {
686
+ class: "border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm",
687
+ style: { backgroundColor: "#f9f9f9" }
688
+ }, Wa = { class: "font-bold" }, Da = { class: "text-fm-color-neutral-gray-300" }, Ea = /* @__PURE__ */ le({
689
+ __name: "WidgetTable",
690
+ props: /* @__PURE__ */ he({
691
+ tileIndex: {}
692
+ }, {
693
+ modelValue: { required: !0 },
694
+ modelModifiers: {}
695
+ }),
696
+ emits: ["update:modelValue"],
697
+ setup(e) {
698
+ const { t: n, te: p } = Ne(), t = oe(e, "modelValue"), { country: w } = nt(), { clearTileSorts: F, setTileSorts: C } = ra(), S = st(), _ = e, s = d([]), { isEditing: c, colWidths: i, rowHeight: r } = Ee(Tt()), { setColWidths: x, setRowHeights: b, enableCellResizing: f } = Tt(), m = d(null), L = g(() => {
699
+ var u;
700
+ return ((u = t.value.data) == null ? void 0 : u.columns) || [{ label: "", key: "" }];
701
+ }), h = g(() => {
702
+ var u;
703
+ return ((u = t.value.data) == null ? void 0 : u.rows) || [];
704
+ }), l = g(() => t.value.filterText), y = g(() => {
705
+ var u, R;
706
+ if (!(l.value && l.value.trim().length > 0 || !((u = h.value[0]) != null && u.isRollup) && !((R = h.value[h.value.length - 1]) != null && R.isRollup))) {
707
+ if (t.value.rollupPosition === ge.top || t.value.rollupPosition === void 0)
708
+ return ge.top;
709
+ if (t.value.rollupPosition === ge.bottom)
710
+ return ge.bottom;
711
+ }
712
+ }), v = g(() => {
713
+ const A = y.value !== void 0 ? 1 : 0, H = (m.value ? m.value.$el.offsetHeight : 0) - 48;
714
+ return Math.floor((H - 34.5 - 32) / 48) - A;
715
+ }), k = g(() => {
716
+ var R, V;
717
+ let u = [];
718
+ switch (y.value) {
719
+ case ge.top:
720
+ u = [...((R = h.value[0]) == null ? void 0 : R.cells) || []].map((A, H) => {
721
+ var z;
722
+ return {
723
+ main: A,
724
+ comparison: (z = h.value[0]) == null ? void 0 : z.comparisonCells[H],
725
+ rowType: L.value[H].type
726
+ };
727
+ });
728
+ break;
729
+ case ge.bottom:
730
+ u = [...((V = h.value[h.value.length - 1]) == null ? void 0 : V.cells) || []].map((A, H) => {
731
+ var z;
732
+ return {
733
+ main: A,
734
+ comparison: (z = h.value[0]) == null ? void 0 : z.comparisonCells[H],
735
+ rowType: L.value[H].type
736
+ };
737
+ });
738
+ break;
739
+ }
740
+ return u.length > 0 && u[0].main === "" && (u[0].main = "Grand total"), u;
741
+ });
742
+ function D(u) {
743
+ let R = (u == null ? void 0 : u.main) || "";
744
+ return R.includes("#") && !R.startsWith("#") && (R = R.split("#")[0]), !u || u.main === "" || u.comparison === "" ? {
745
+ main: R
746
+ } : {
747
+ main: R,
748
+ comparison: u == null ? void 0 : u.comparison,
749
+ difference: zt(u.main, u.comparison, w)
750
+ };
751
+ }
752
+ be(() => {
753
+ F();
754
+ });
755
+ const $ = d([]);
756
+ let B = 0, N;
757
+ function ne() {
758
+ var H;
759
+ if (!((H = t.value) != null && H.data)) {
760
+ $.value = [];
761
+ return;
762
+ }
763
+ const u = ++B, R = (t.value.data.rows || []).map((z) => ({
764
+ isRollup: z.isRollup,
765
+ cells: Array.isArray(z.cells) ? [...z.cells] : [],
766
+ comparisonCells: Array.isArray(z.comparisonCells) ? [...z.comparisonCells] : []
767
+ })), V = (t.value.data.columns || []).map((z) => ({
768
+ key: z.key,
769
+ type: z.type,
770
+ label: z.label
771
+ })), A = {
772
+ rows: R,
773
+ columns: V,
774
+ filter: l.value ?? "",
775
+ globalSorts: ea(s.value).map((z) => ({
776
+ key: z.key,
777
+ type: z.type
778
+ })),
779
+ grandTotalPosition: y.value,
780
+ pageSize: v.value
781
+ };
782
+ ia(za, A).then((z) => {
783
+ u === B && (z != null && z.error ? (S.open({ message: "Failed to process table data. Please retry.", type: "error" }), console.log(z.error), $.value = []) : $.value = ta(z.data || []));
784
+ });
785
+ }
786
+ G(
787
+ () => s.value,
788
+ (u) => {
789
+ _.tileIndex === void 0 || _.tileIndex === null || C(_.tileIndex, u);
790
+ },
791
+ { immediate: !0, deep: !0 }
792
+ ), G(
793
+ [
794
+ () => {
795
+ var u;
796
+ return (u = t.value.data) == null ? void 0 : u.rows;
797
+ },
798
+ () => {
799
+ var u;
800
+ return (u = t.value.data) == null ? void 0 : u.columns;
801
+ },
802
+ () => s.value,
803
+ () => y.value,
804
+ () => v.value
805
+ ],
806
+ () => {
807
+ clearTimeout(N), N = setTimeout(ne, 200);
808
+ },
809
+ { immediate: !0, deep: !0 }
810
+ );
811
+ function K(u) {
812
+ const R = s.value.find((V) => V.key === u);
813
+ if (!R) {
814
+ s.value.push({ key: u, type: We.Asc });
815
+ return;
816
+ }
817
+ R.type === We.Asc ? R.type = We.Desc : R.type === We.Desc && (s.value = s.value.filter((V) => V.key !== u));
818
+ }
819
+ const Z = g(
820
+ () => {
821
+ var u;
822
+ return (((u = t.value.colWidths) == null ? void 0 : u.length) ?? 0) > 0 || i.value.length > 0;
823
+ }
824
+ ), xe = g(() => {
825
+ var u;
826
+ return (u = t.value.data) != null && u.columns ? t.value.data.columns.map((R) => {
827
+ const V = Re(n, p, R.label, "other"), A = s.value.find((O) => O.key === R.key), H = !!A, z = H ? A.type === We.Asc ? "arrow_upward" : "arrow_downward" : "unfold_more";
828
+ return {
829
+ accessorKey: R.key,
830
+ header: () => {
831
+ const O = E("FmIcon");
832
+ return Pe(
833
+ "button",
834
+ {
835
+ type: "button",
836
+ class: `w-full flex items-center gap-1 group/select-header select-none ${R.type === "NUMERIC" ? "justify-end" : "justify-start"} ${H ? "text-fm-color-typo-primary" : "text-fm-color-neutral-gray-400"}`,
837
+ onClick: () => K(R.key)
838
+ },
839
+ [
840
+ Pe(
841
+ "span",
842
+ { class: `${R.type === "NUMERIC" ? "text-right" : ""} whitespace-nowrap` },
843
+ V
844
+ ),
845
+ Pe(O, {
846
+ name: z,
847
+ color: H ? "primary" : "neutral-gray-400",
848
+ size: "sm",
849
+ class: "transition-transform",
850
+ style: z === "arrow_upward" ? "transform: translateY(-1px);" : ""
851
+ })
852
+ ]
853
+ );
854
+ },
855
+ cell: (O) => {
856
+ var Q, ee;
857
+ const se = D(O.getValue()), re = (ee = (Q = O == null ? void 0 : O.row) == null ? void 0 : Q.original) == null ? void 0 : ee.isRollup;
858
+ return Pe(
859
+ "div",
860
+ {
861
+ class: [
862
+ re ? "fm-typo-en-body-md-600 text-fm-color-typo-secondary" : "fm-typo-en-body-md-400",
863
+ R.type === "NUMERIC" ? "text-right" : "",
864
+ Z.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
865
+ ].join(" ")
866
+ },
867
+ [R.type === "NUMERIC" ? Ke(se.main) : se.main]
868
+ );
869
+ },
870
+ enableSorting: !1
871
+ };
872
+ }) : [];
873
+ });
874
+ return G(
875
+ () => i.value.length > 0,
876
+ async (u) => {
877
+ u && c.value && (await J(), f());
878
+ }
879
+ ), G(
880
+ [() => xe.value],
881
+ async () => {
882
+ var H;
883
+ await J();
884
+ const u = (H = m.value) == null ? void 0 : H.$el;
885
+ if (!u) return;
886
+ const R = u.querySelector("table");
887
+ if (!R) return;
888
+ R.classList.add(Z.value ? "table-fixed" : "table-auto");
889
+ let V, A;
890
+ c.value ? (f(), V = i.value, A = r.value) : (A = t.value.rowHeight, V = t.value.colWidths), typeof A == "number" && b(A, u), V == null || V.forEach((z, O) => {
891
+ x(O, z, u);
892
+ });
893
+ },
894
+ { immediate: !0 }
895
+ ), (u, R) => {
896
+ const V = E("FmTable");
897
+ return W(), U(ue, null, [
898
+ M("div", La, [
899
+ we(u.$slots, "menu")
900
+ ]),
901
+ P(V, {
902
+ ref_key: "table",
903
+ ref: m,
904
+ "column-defs": xe.value,
905
+ "row-data": $.value,
906
+ "search-value": l.value,
907
+ "page-size": v.value,
908
+ "shrink-at": !1,
909
+ "force-mobile-footer": !0,
910
+ class: "scrollbar-hide-table"
911
+ }, {
912
+ "pin-top": Y(() => [
913
+ M("tbody", null, [
914
+ M("tr", Aa, [
915
+ (W(!0), U(ue, null, _t(k.value, (A, H) => (W(), U("td", {
916
+ key: `${o(Ie)()}_${H}`,
917
+ class: "h-[48px] text-fm-color-typo-primary px-16"
918
+ }, [
919
+ M("span", {
920
+ class: Me([
921
+ "items-center text-fm-color-typo-secondary gap-2",
922
+ A.rowType === "NUMERIC" ? "text-right" : "",
923
+ Z.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
924
+ ])
925
+ }, [
926
+ M("p", Wa, De(A.rowType === "NUMERIC" ? o(Ke)(A.main) : A.main), 1),
927
+ M("p", Da, De(A.comparison ? A.rowType === "NUMERIC" ? `(${o(Ke)(A.comparison)})` : `(${A.comparison})` : ""), 1)
928
+ ], 2)
929
+ ]))), 128))
930
+ ])
931
+ ])
932
+ ]),
933
+ _: 1
934
+ }, 8, ["column-defs", "row-data", "search-value", "page-size"])
935
+ ], 64);
936
+ };
937
+ }
938
+ }), Va = /* @__PURE__ */ le({
939
+ __name: "WidgetStackBarChart",
940
+ props: /* @__PURE__ */ he({
941
+ tileIndex: {}
942
+ }, {
943
+ modelValue: { required: !0 },
944
+ modelModifiers: {}
945
+ }),
946
+ emits: ["update:modelValue"],
947
+ setup(e) {
948
+ const n = e, p = oe(e, "modelValue"), t = d(null), w = g(() => {
949
+ var L;
950
+ return ((L = p.value.data) == null ? void 0 : L.xAxis) || [];
951
+ }), F = g(() => {
952
+ var m;
953
+ return ((m = p.value.data) == null ? void 0 : m.datasets) ?? [];
954
+ }), { datalabels: C, xCfg: S, yCfg: _, isTransposed: s, legend: c, chartWidth: i, chartHeight: r } = He(
955
+ p.value
956
+ ), x = g(() => F.value.length > 0 ? [
957
+ ...F.value.map((m, L) => {
958
+ let h = m.values;
959
+ return {
960
+ label: m.name,
961
+ data: h,
962
+ dash: !!m.isCompare,
963
+ backgroundColor: ae({ index: L, isCompare: m.isCompare })
964
+ };
965
+ })
966
+ ] : []), b = Ve();
967
+ function f() {
968
+ return b.extractChartSize(t.value, n.tileIndex) || { width: 0, height: 0 };
969
+ }
970
+ return be(() => {
971
+ J(() => {
972
+ f();
973
+ });
974
+ }), G([x], () => {
975
+ J(() => f());
976
+ }), (m, L) => {
977
+ const h = E("FmBarChart");
978
+ return W(), U(ue, null, [
979
+ we(m.$slots, "menu"),
980
+ P(h, {
981
+ ref_key: "chartRef",
982
+ ref: t,
983
+ class: "bar-chart",
984
+ datasets: x.value,
985
+ "x-axis": { categories: w.value },
986
+ "x-cfg": o(S),
987
+ "y-cfg": o(_),
988
+ transpose: o(s),
989
+ stacked: !0,
990
+ legend: {
991
+ display: o(c).display ?? !1,
992
+ position: o(c).position,
993
+ maxHeight: o(c).maxHeight,
994
+ maxWidth: o(c).maxWidth,
995
+ labels: o(c).labels
996
+ },
997
+ datalabels: o(C),
998
+ "maintain-aspect-ratio": !1,
999
+ style: de({
1000
+ "--chart-width": o(i) !== void 0 ? o(i) + "px" : "100%",
1001
+ "--chart-height": o(r) !== void 0 ? o(r) + "px" : "calc(100% - 36px)"
1002
+ })
1003
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
1004
+ ], 64);
1005
+ };
1006
+ }
1007
+ }), Ha = /* @__PURE__ */ le({
1008
+ __name: "WidgetStackLineChart",
1009
+ props: /* @__PURE__ */ he({
1010
+ tileIndex: {}
1011
+ }, {
1012
+ modelValue: { required: !0 },
1013
+ modelModifiers: {}
1014
+ }),
1015
+ emits: ["update:modelValue"],
1016
+ setup(e) {
1017
+ var h;
1018
+ const n = e, p = oe(e, "modelValue"), t = ((h = p.value.data) == null ? void 0 : h.xAxis) ?? [], w = g(
1019
+ () => t.length === 1 && S.value.length > 0 && S.value.every((l) => l.values.length === 1)
1020
+ ), F = g(() => w.value ? ["", t[0], ""] : t), C = d(null), S = g(() => {
1021
+ var l;
1022
+ return ((l = p.value.data) == null ? void 0 : l.datasets) ?? [];
1023
+ }), { datalabels: _, xCfg: s, yCfg: c, isTransposed: i, legend: r, chartWidth: x, chartHeight: b } = He(
1024
+ p.value
1025
+ ), f = g(() => S.value.length > 0 ? [
1026
+ ...S.value.map((l, y) => {
1027
+ let v = l.values;
1028
+ return w.value && (v = [NaN, v[0], NaN]), {
1029
+ label: l.name,
1030
+ data: v,
1031
+ dash: l.isCompare,
1032
+ fill: !1,
1033
+ color: ae({ index: y, isCompare: l.isCompare }),
1034
+ pointRadius: w.value ? 4 : void 0,
1035
+ pointHoverRadius: w.value ? 6 : void 0,
1036
+ pointBackgroundColor: w.value ? ae({ index: y, isCompare: l.isCompare }) : void 0,
1037
+ pointBorderColor: w.value ? ae({ index: y, isCompare: l.isCompare }) : void 0,
1038
+ pointBorderWidth: w.value ? 2 : void 0
1039
+ };
1040
+ })
1041
+ ] : []), m = Ve();
1042
+ function L() {
1043
+ return m.extractChartSize(C.value, n.tileIndex) || { width: 0, height: 0 };
1044
+ }
1045
+ return be(() => {
1046
+ J(() => {
1047
+ L();
1048
+ });
1049
+ }), G([f], () => {
1050
+ J(() => L());
1051
+ }), (l, y) => {
1052
+ const v = E("FmLineChart");
1053
+ return W(), U(ue, null, [
1054
+ we(l.$slots, "menu"),
1055
+ P(v, {
1056
+ ref_key: "chartRef",
1057
+ ref: C,
1058
+ class: "line-chart",
1059
+ datasets: f.value,
1060
+ "x-axis": { categories: F.value },
1061
+ "x-cfg": o(s),
1062
+ "y-cfg": o(c),
1063
+ transpose: o(i),
1064
+ legend: {
1065
+ display: o(r).display ?? !1,
1066
+ position: o(r).position,
1067
+ maxHeight: o(r).maxHeight,
1068
+ maxWidth: o(r).maxWidth,
1069
+ labels: o(r).labels
1070
+ },
1071
+ stacked: !0,
1072
+ datalabels: o(_),
1073
+ "maintain-aspect-ratio": !1,
1074
+ style: de({
1075
+ "--chart-width": o(x) !== void 0 ? o(x) + "px" : "100%",
1076
+ "--chart-height": o(b) !== void 0 ? o(b) + "px" : "calc(100% - 36px)"
1077
+ })
1078
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
1079
+ ], 64);
1080
+ };
1081
+ }
1082
+ }), ze = [
1083
+ "col-span-1",
1084
+ "col-span-2",
1085
+ "col-span-3",
1086
+ "col-span-4",
1087
+ "col-span-5",
1088
+ "col-span-6",
1089
+ "col-span-7",
1090
+ "col-span-8",
1091
+ "col-span-9",
1092
+ "col-span-10",
1093
+ "col-span-11",
1094
+ "col-span-12"
1095
+ ];
1096
+ function $a(e) {
1097
+ return e < 12 ? ze[e - 1] : ze[11];
1098
+ }
1099
+ function Ba(e) {
1100
+ return e < 12 ? ze[Math.min(11, e * 2 - 1)] : ze[11];
1101
+ }
1102
+ function Pa(e) {
1103
+ return e < 12 ? ze[Math.min(11, e * 3 - 1)] : ze[11];
1104
+ }
1105
+ const Ia = /* @__PURE__ */ le({
1106
+ __name: "WidgetLinechart",
1107
+ props: /* @__PURE__ */ he({
1108
+ tileIndex: {}
1109
+ }, {
1110
+ modelValue: { required: !0 },
1111
+ modelModifiers: {}
1112
+ }),
1113
+ emits: ["update:modelValue"],
1114
+ setup(e) {
1115
+ var h;
1116
+ const n = e, p = oe(e, "modelValue"), t = ((h = p.value.data) == null ? void 0 : h.xAxis) ?? [], w = g(
1117
+ () => t.length === 1 && S.value.length > 0 && S.value.every((l) => l.values.length === 1)
1118
+ ), F = g(() => w.value ? ["", t[0], ""] : t), C = d(null), S = g(() => {
1119
+ var l;
1120
+ return ((l = p.value.data) == null ? void 0 : l.datasets) ?? [];
1121
+ }), { datalabels: _, xCfg: s, yCfg: c, isTransposed: i, legend: r, chartWidth: x, chartHeight: b } = He(
1122
+ p.value
1123
+ ), f = g(() => S.value.length > 0 ? [
1124
+ ...S.value.map((l, y) => {
1125
+ let v = l.values;
1126
+ return w.value && (v = [NaN, v[0], NaN]), {
1127
+ label: l.name,
1128
+ data: v,
1129
+ dash: !!l.isCompare,
1130
+ fill: !1,
1131
+ color: ae({ index: y, isCompare: l.isCompare }),
1132
+ pointRadius: w.value ? 4 : void 0,
1133
+ pointHoverRadius: w.value ? 6 : void 0,
1134
+ pointBackgroundColor: w.value ? ae({ index: y, isCompare: l.isCompare }) : void 0,
1135
+ pointBorderColor: w.value ? ae({ index: y, isCompare: l.isCompare }) : void 0,
1136
+ pointBorderWidth: w.value ? 2 : void 0
1137
+ };
1138
+ })
1139
+ ] : []), m = Ve();
1140
+ function L() {
1141
+ return m.extractChartSize(C.value, n.tileIndex) || { width: 0, height: 0 };
1142
+ }
1143
+ return be(() => {
1144
+ J(() => {
1145
+ L();
1146
+ });
1147
+ }), G([f], () => {
1148
+ J(() => L());
1149
+ }), (l, y) => {
1150
+ const v = E("FmLineChart");
1151
+ return W(), U(ue, null, [
1152
+ we(l.$slots, "menu"),
1153
+ P(v, {
1154
+ ref_key: "chartRef",
1155
+ ref: C,
1156
+ class: "line-chart",
1157
+ datasets: f.value,
1158
+ "x-axis": { categories: F.value },
1159
+ "x-cfg": o(s),
1160
+ "y-cfg": o(c),
1161
+ transpose: o(i),
1162
+ legend: {
1163
+ display: o(r).display ?? !1,
1164
+ position: o(r).position,
1165
+ maxHeight: o(r).maxHeight,
1166
+ maxWidth: o(r).maxWidth,
1167
+ labels: o(r).labels
1168
+ },
1169
+ datalabels: o(_),
1170
+ "maintain-aspect-ratio": !1,
1171
+ style: de({
1172
+ "--chart-width": o(x) !== void 0 ? o(x) + "px" : "100%",
1173
+ "--chart-height": o(b) !== void 0 ? o(b) + "px" : "calc(100% - 36px)"
1174
+ })
1175
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
1176
+ ], 64);
1177
+ };
1178
+ }
1179
+ }), Ma = { class: "flex flex-col gap-16" }, Na = { class: "flex flex-row" }, qa = /* @__PURE__ */ le({
1180
+ __name: "PdfOrientationDialog",
1181
+ props: /* @__PURE__ */ he({
1182
+ reportType: {},
1183
+ index: {}
1184
+ }, {
1185
+ modelValue: { type: Boolean, required: !0 },
1186
+ modelModifiers: {}
1187
+ }),
1188
+ emits: ["update:modelValue"],
1189
+ setup(e) {
1190
+ const { t: n } = Ne(), { FmForm: p } = ha, t = e, w = d(), F = oe(e, "modelValue"), C = d(!0), S = d(!1), _ = st(), { selectedLocationIds: s, dateRange: c, timeRange: i } = Ee(ot()), r = d(je.PORTRAIT);
1191
+ function x() {
1192
+ var f;
1193
+ (f = w.value) == null || f.validateInputs();
1194
+ }
1195
+ async function b() {
1196
+ S.value = !0;
1197
+ try {
1198
+ t.index != null && await Ft({
1199
+ reportType: t.reportType,
1200
+ index: t.index,
1201
+ orientationTypes: [r.value],
1202
+ isCombinedLocationLayout: C.value,
1203
+ timeRange: i.value,
1204
+ dateRange: c.value,
1205
+ locationIds: s.value
1206
+ });
1207
+ } catch (f) {
1208
+ _.open({ message: f.message, type: "error" });
1209
+ } finally {
1210
+ S.value = !1;
1211
+ }
1212
+ }
1213
+ return (f, m) => {
1214
+ const L = E("FmRadio"), h = E("FmRadioGroup"), l = E("FmButton"), y = E("FmDialog");
1215
+ return W(), j(y, {
1216
+ modelValue: F.value,
1217
+ "onUpdate:modelValue": m[2] || (m[2] = (v) => F.value = v),
1218
+ overlay: !0,
1219
+ "z-index": 10
1220
+ }, {
1221
+ "dialog-header": Y(() => m[3] || (m[3] = [
1222
+ aa("Select Orientation")
1223
+ ])),
1224
+ default: Y(() => [
1225
+ P(o(p), {
1226
+ ref_key: "form",
1227
+ ref: w,
1228
+ onValidationSuccess: b
1229
+ }, {
1230
+ default: Y(() => [
1231
+ M("div", Ma, [
1232
+ P(h, {
1233
+ modelValue: r.value,
1234
+ "onUpdate:modelValue": m[0] || (m[0] = (v) => r.value = v)
1235
+ }, {
1236
+ default: Y(() => [
1237
+ P(L, {
1238
+ value: o(je).PORTRAIT,
1239
+ label: o(n)("report.common.portrait")
1240
+ }, null, 8, ["value", "label"]),
1241
+ P(L, {
1242
+ value: o(je).LANDSCAPE,
1243
+ label: o(n)("report.common.landscape")
1244
+ }, null, 8, ["value", "label"])
1245
+ ]),
1246
+ _: 1
1247
+ }, 8, ["modelValue"])
1248
+ ]),
1249
+ M("div", Na, [
1250
+ m[4] || (m[4] = M("div", { class: "grow" }, null, -1)),
1251
+ P(l, {
1252
+ label: o(n)("report.common.cancel"),
1253
+ variant: "tertiary",
1254
+ onClick: m[1] || (m[1] = (v) => F.value = !1)
1255
+ }, null, 8, ["label"]),
1256
+ M("div", null, [
1257
+ P(l, {
1258
+ label: o(n)("report.common.download"),
1259
+ loading: S.value,
1260
+ onClick: x
1261
+ }, null, 8, ["label", "loading"])
1262
+ ])
1263
+ ])
1264
+ ]),
1265
+ _: 1
1266
+ }, 512)
1267
+ ]),
1268
+ _: 1
1269
+ }, 8, ["modelValue"]);
1270
+ };
1271
+ }
1272
+ }), Oa = {
1273
+ key: 1,
1274
+ class: "grow"
1275
+ }, Ua = {
1276
+ key: 2,
1277
+ class: "flex"
1278
+ }, tl = /* @__PURE__ */ le({
1279
+ __name: "DynamicWidget",
1280
+ props: /* @__PURE__ */ he({
1281
+ index: {
1282
+ type: Number,
1283
+ default: 0
1284
+ },
1285
+ hideExport: {
1286
+ type: Boolean,
1287
+ default: !1
1288
+ },
1289
+ customScreenWidth: {
1290
+ type: Number,
1291
+ required: !1,
1292
+ default: void 0
1293
+ }
1294
+ }, {
1295
+ modelValue: { required: !0, default: () => {
1296
+ } },
1297
+ modelModifiers: {}
1298
+ }),
1299
+ emits: ["update:modelValue"],
1300
+ setup(e) {
1301
+ const n = d(!0), p = oe(e, "modelValue"), t = p.value.widget.config, { t: w, te: F } = Ne(), C = e, S = d(null), _ = d(t.rollup), s = d(Ie()), c = d(t.drillDimension), i = g(() => {
1302
+ if (fe.value.length > 0) {
1303
+ const a = fe.value.findIndex(
1304
+ (I) => I.value === c.value
1305
+ );
1306
+ return a >= 0 ? a : 0;
1307
+ } else
1308
+ return -1;
1309
+ }), r = g(() => i.value !== 0), x = g(
1310
+ () => i.value != fe.value.length - 1
1311
+ ), b = d(t.showTitle ?? !0), f = d(t.titleFontSize ?? 14), m = d(t.titleBold ?? !1), L = d(t.titleItalic ?? !1), h = d(t.titleUnderline ?? !1), l = d(t.chartWidth ?? void 0), y = d(t.chartHeight ?? void 0), v = d(t.showLabel ?? !1), k = d(t.labelAlign ?? et.center), D = d(t.labelAnchor ?? Qe.center), $ = d(t.labelRotation ?? 0), B = d(t.labelOffset ?? 0), N = d(t.labelFontSize ?? 12), ne = g(() => t.showSearchBar), K = d(t.showX ?? !0), Z = d(t.xPosition ?? tt.bottom), xe = d(t.showXGrid ?? !1), u = d(t.showXTick ?? !0), R = d(t.xTickFontSize ?? 12), V = d(t.showXTitle ?? !1), A = d(t.xTitle ?? ""), H = d(t.xTitleFontSize ?? 12), z = d(t.showY ?? !0), O = d(t.yPosition ?? at.left), se = d(t.showYGrid ?? !1), re = d(t.showYTick ?? !0), Q = d(t.yTickFontSize ?? 12), ee = d(t.showYTitle ?? !1), ie = d(t.yTitle ?? ""), Ce = d(t.yTitleFontSize ?? 12), ce = d(t.showLegend ?? void 0), me = d(t.legendPosition ?? lt.top), pe = d(t.usePointStyle ?? !0), qe = d(t.legendMaxHeight), rt = d(t.legendMaxWidth), it = d(t.rowHeight ?? 0), ct = d(t.colWidths ?? []), Oe = d(!1), Ue = d(""), { breakpoints: Se, getBreakpointsBoundary: Le } = Rt(), ut = d(), X = g(
1312
+ () => C.customScreenWidth === void 0 ? window.innerWidth : C.customScreenWidth
1313
+ ), Lt = g(
1314
+ () => (X == null ? void 0 : X.value) > Le("xs")[1] && (X == null ? void 0 : X.value) <= Le("sm")[1]
1315
+ ), At = g(
1316
+ () => (X == null ? void 0 : X.value) > Le("sm")[1] && (X == null ? void 0 : X.value) <= Le("md")[1]
1317
+ ), Wt = g(() => (X == null ? void 0 : X.value) > Le("md")[1]), Dt = g(() => {
1318
+ const a = p.value.size.width;
1319
+ return Wt.value || At.value ? $a(a) : Lt.value ? Ba(a) : Pa(a);
1320
+ }), $e = g(
1321
+ () => pa.find((a) => a.type === p.value.widget.type)
1322
+ ), ke = Ct(() => {
1323
+ var a;
1324
+ ut.value = Mt((a = S.value) == null ? void 0 : a.$el.offsetWidth), s.value = Ie();
1325
+ }), Et = g(() => {
1326
+ if (fa(q.value.type, Te.value))
1327
+ switch (p.value.widget.type) {
1328
+ case T.BarChart:
1329
+ return ga;
1330
+ case T.StackBarChart:
1331
+ return Va;
1332
+ case T.LineChart:
1333
+ return Ia;
1334
+ case T.StackLineChart:
1335
+ return Ha;
1336
+ case T.Circular:
1337
+ return ya;
1338
+ case T.Scorecard:
1339
+ return ka;
1340
+ case T.Spacer:
1341
+ return Fa;
1342
+ case T.Table:
1343
+ return Ea;
1344
+ default:
1345
+ return St;
1346
+ }
1347
+ else
1348
+ return St;
1349
+ }), Te = d(null), {
1350
+ selectedLocationIds: Xe,
1351
+ dateRange: dt,
1352
+ compareDateRange: Vt,
1353
+ timeRange: ht,
1354
+ globalFilters: Ht,
1355
+ isGlobalFiltersLoading: Ye
1356
+ } = Ee(ot()), { businessId: $t } = Ee(nt()), Bt = d(!0), q = g(() => {
1357
+ const a = JSON.parse(JSON.stringify(p.value.widget));
1358
+ return {
1359
+ ...a,
1360
+ config: {
1361
+ ...a.config,
1362
+ rollup: _.value,
1363
+ drillDimension: c.value,
1364
+ showGrandTotal: !1
1365
+ }
1366
+ };
1367
+ });
1368
+ function Pt() {
1369
+ return {
1370
+ data: Te.value,
1371
+ showTitle: b.value,
1372
+ titleFontSize: f.value,
1373
+ titleBold: m.value,
1374
+ titleItalic: L.value,
1375
+ titleUnderline: h.value,
1376
+ chartHeight: y.value,
1377
+ chartWidth: l.value,
1378
+ showLabel: v.value,
1379
+ labelAnchor: D.value,
1380
+ labelAlign: k.value,
1381
+ labelRotation: $.value,
1382
+ labelOffset: B.value,
1383
+ labelFontSize: N.value,
1384
+ showX: K.value,
1385
+ xPosition: Z.value,
1386
+ showXGrid: xe.value,
1387
+ showXTick: u.value,
1388
+ xTickFontSize: R.value,
1389
+ showXTitle: V.value,
1390
+ xTitle: A.value,
1391
+ xTitleFontSize: H.value,
1392
+ showY: z.value,
1393
+ yPosition: O.value,
1394
+ showYGrid: se.value,
1395
+ showYTick: re.value,
1396
+ yTitle: ie.value,
1397
+ showYTitle: ee.value,
1398
+ yTitleFontSize: Ce.value,
1399
+ yTickFontSize: Q.value,
1400
+ isTransposed: q.value.config.isTransposed,
1401
+ showLegend: ce.value,
1402
+ legendPosition: me.value,
1403
+ usePointStyle: pe.value,
1404
+ legendMaxHeight: qe.value,
1405
+ legendMaxWidth: rt.value
1406
+ };
1407
+ }
1408
+ function It() {
1409
+ return {
1410
+ data: Te.value,
1411
+ filterText: Ue.value,
1412
+ rollupPosition: q.value.config.rollupPosition,
1413
+ rowHeight: it.value,
1414
+ colWidths: ct.value
1415
+ };
1416
+ }
1417
+ const mt = g(() => {
1418
+ switch (q.value.type) {
1419
+ case T.Table:
1420
+ return It();
1421
+ case T.BarChart:
1422
+ case T.LineChart:
1423
+ case T.StackBarChart:
1424
+ case T.StackLineChart:
1425
+ case T.Circular:
1426
+ return Pt();
1427
+ default:
1428
+ return { data: Te.value };
1429
+ }
1430
+ }), pt = g(() => {
1431
+ const { config: a } = p.value.widget;
1432
+ if (a.rollup != null) {
1433
+ const I = [...a.dimensions].filter((ve) => !ve.hide);
1434
+ return I.sort(
1435
+ (ve, Ae) => (a.rowIds || []).indexOf(Je(ve)) - (a.rowIds || []).indexOf(Je(Ae))
1436
+ ), [
1437
+ { label: Re(w, F, "None", "other"), value: "none" },
1438
+ { label: Re(w, F, "Grand Total", "other"), value: 0 },
1439
+ ...[...I].slice(0, I.length - 1).map((ve, Ae) => ({
1440
+ label: Re(w, F, ve.label, "other"),
1441
+ value: Ae + 1
1442
+ }))
1443
+ ];
1444
+ }
1445
+ return [];
1446
+ }), fe = g(() => {
1447
+ const { config: a } = q.value;
1448
+ return a.isDrillable ? a.dimensions.map((I) => ({
1449
+ label: Re(w, F, I.label, "other"),
1450
+ value: Je(I)
1451
+ })) : [];
1452
+ });
1453
+ G(
1454
+ () => p.value.widget.config,
1455
+ (a) => {
1456
+ _.value = a.rollup, b.value = a.showTitle ?? !0, f.value = a.titleFontSize ?? 14, m.value = a.titleBold ?? !1, L.value = a.titleItalic ?? !1, h.value = a.titleUnderline ?? !1, y.value = a.chartHeight ?? void 0, l.value = a.chartWidth ?? void 0, v.value = a.showLabel ?? !1, k.value = a.labelAlign ?? et.center, D.value = a.labelAnchor ?? Qe.center, $.value = a.labelRotation ?? 0, B.value = a.labelOffset ?? 0, N.value = a.labelFontSize ?? 12, K.value = a.showX ?? !0, Z.value = a.xPosition ?? tt.bottom, xe.value = a.showXGrid ?? !1, u.value = a.showXTick ?? !0, R.value = a.xTickFontSize ?? 12, V.value = a.showXTitle ?? !1, A.value = a.xTitle ?? "", H.value = a.xTitleFontSize ?? 12, z.value = a.showY ?? !0, O.value = a.yPosition ?? at.left, se.value = a.showYGrid ?? !1, re.value = a.showYTick ?? !0, Q.value = a.yTickFontSize ?? 12, ee.value = a.showYTitle ?? !1, ie.value = a.yTitle ?? "", Ce.value = a.yTitleFontSize ?? 12, ce.value = a.showLegend ?? void 0, me.value = a.legendPosition ?? lt.top, pe.value = a.usePointStyle ?? !0, qe.value = a.legendMaxHeight, rt.value = a.legendMaxWidth, it.value = a.rowHeight ?? 0, ct.value = a.colWidths ?? [];
1457
+ },
1458
+ { deep: !0 }
1459
+ ), G([() => _.value], () => {
1460
+ _.value !== null && (p.value.widget.config.rollup = _.value);
1461
+ }), G(
1462
+ [
1463
+ () => q.value,
1464
+ () => dt.value,
1465
+ () => ht.value,
1466
+ () => Vt.value,
1467
+ () => Xe.value,
1468
+ () => $t.value,
1469
+ () => Ht.value,
1470
+ () => Ye.value
1471
+ ],
1472
+ () => {
1473
+ vt();
1474
+ },
1475
+ {
1476
+ deep: !0
1477
+ }
1478
+ ), G(
1479
+ [() => p.value.size],
1480
+ () => {
1481
+ ke();
1482
+ },
1483
+ { deep: !0 }
1484
+ ), be(() => {
1485
+ ke(), Se.value.sm || Se.value.md || Se.value.xs ? (console.log("Ignoring resize event due to keyboard"), addEventListener("change", ke)) : addEventListener("resize", ke), vt();
1486
+ }), la(() => {
1487
+ Se.value.sm || Se.value.md || Se.value.xs ? (console.log("Ignoring resize event due to keyboard"), removeEventListener("change", ke)) : removeEventListener("resize", ke);
1488
+ });
1489
+ const ft = st();
1490
+ let Be;
1491
+ async function vt() {
1492
+ if (Xe.value.length === 0 || Ye.value) {
1493
+ n.value = !1;
1494
+ return;
1495
+ }
1496
+ if (q.value.config.schemaNames.length <= 0 && !(q.value.config.dimensions.length <= 0 || q.value.config.metrics.length <= 0)) {
1497
+ ft.open({
1498
+ message: "schema must not be empty and dimension or metrics must have at least 1 column",
1499
+ type: "info"
1500
+ }), n.value = !1;
1501
+ return;
1502
+ }
1503
+ try {
1504
+ n.value = !0, Be && Be.abort(), Be = new AbortController();
1505
+ const a = Be.signal;
1506
+ Te.value = await Ct(ca, 500)(q.value, a, p.value.id), s.value = Ie(), n.value = !1;
1507
+ } catch (a) {
1508
+ a.code !== "ERR_CANCELED" && (Te.value = null, ft.open({ message: `Invalid chart ${q.value.type}`, type: "error" }), console.log(a), n.value = !1);
1509
+ }
1510
+ }
1511
+ function Mt(a) {
1512
+ switch (p.value.widget.type) {
1513
+ case "SPACER":
1514
+ return;
1515
+ case "SCORECARD":
1516
+ return;
1517
+ case "TABLE":
1518
+ return `${p.value.size.height * 100 + (ne.value ? 72 : 0) + 96.5}px`;
1519
+ }
1520
+ return `${Math.max(a / p.value.size.width, 90) * p.value.size.height}px`;
1521
+ }
1522
+ function Nt() {
1523
+ const a = i.value - 1;
1524
+ a >= 0 && (c.value = fe.value[a].value);
1525
+ }
1526
+ function qt() {
1527
+ const a = i.value + 1;
1528
+ a >= 0 && a < fe.value.length && (c.value = fe.value[a].value);
1529
+ }
1530
+ const gt = d(Fe.EXCEL), yt = d(), Ot = Object.values(Fe).map((a) => ({
1531
+ label: ua(a),
1532
+ value: a,
1533
+ onClick: async () => {
1534
+ a === Fe.EXCEL || a === Fe.PDFFULLSIZE || a === Fe.PDFRECEIPT ? await Ft({
1535
+ reportType: a,
1536
+ index: C.index,
1537
+ isCombinedLocationLayout: Bt.value,
1538
+ timeRange: ht.value,
1539
+ dateRange: dt.value,
1540
+ locationIds: Xe.value
1541
+ }) : a === Fe.PDF && (gt.value = a, yt.value = C.index, Oe.value = !0);
1542
+ }
1543
+ })), Ut = q.value.type === T.Spacer ? "flat" : "outlined", Xt = q.value.type === T.Spacer ? "p-0" : "p-16";
1544
+ return (a, I) => {
1545
+ const ve = E("FmTooltip"), Ae = E("FmSearch"), Yt = E("FmCheckbox"), Ge = E("FmButton"), Gt = E("FmSelect"), jt = E("FmMenuItem"), Jt = E("FmMenu"), Kt = E("FmForm"), Zt = E("FmCircularProgress"), Qt = E("FmCard");
1546
+ return W(), j(Qt, {
1547
+ ref_key: "tileCard",
1548
+ ref: S,
1549
+ class: Me(`${Dt.value} ${o(Xt)}`),
1550
+ variant: o(Ut)
1551
+ }, {
1552
+ default: Y(() => [
1553
+ P(qa, {
1554
+ modelValue: Oe.value,
1555
+ "onUpdate:modelValue": I[0] || (I[0] = (_e) => Oe.value = _e),
1556
+ "report-type": gt.value,
1557
+ index: yt.value
1558
+ }, null, 8, ["modelValue", "report-type", "index"]),
1559
+ !n.value && !o(Ye) ? (W(), U("div", {
1560
+ key: 0,
1561
+ style: de({ height: ut.value })
1562
+ }, [
1563
+ (W(), j(oa(Et.value), {
1564
+ key: s.value,
1565
+ modelValue: mt.value,
1566
+ "onUpdate:modelValue": I[4] || (I[4] = (_e) => mt.value = _e),
1567
+ "tile-index": C.index
1568
+ }, {
1569
+ menu: Y(() => [
1570
+ P(Kt, { class: "flex items-center gap-2" }, {
1571
+ default: Y(() => {
1572
+ var _e, bt, wt, xt;
1573
+ return [
1574
+ P(ve, {
1575
+ variant: "plain",
1576
+ placement: "right",
1577
+ content: q.value.description,
1578
+ "hide-arrow": !0,
1579
+ disabled: !q.value.description
1580
+ }, {
1581
+ default: Y(() => [
1582
+ b.value !== !1 ? (W(), U("p", {
1583
+ key: 0,
1584
+ style: de({
1585
+ fontSize: f.value + "px",
1586
+ fontWeight: m.value ? "bold" : "normal",
1587
+ fontStyle: L.value ? "italic" : "normal",
1588
+ textDecoration: h.value ? "underline" : "none"
1589
+ }),
1590
+ class: Me(["text-fm-color-typo-secondary line-clamp-1", [
1591
+ f.value <= 18 ? "fm-typo-en-body-md-400" : "",
1592
+ q.value.description ? "border-b-2 border-dashed border-gray-300" : ""
1593
+ ]])
1594
+ }, De(o(Re)(o(w), o(F), q.value.title, "other")), 7)) : ye("", !0)
1595
+ ]),
1596
+ _: 1
1597
+ }, 8, ["content", "disabled"]),
1598
+ (_e = $e.value) != null && _e.showSearchBar ? (W(), j(Ae, {
1599
+ key: 0,
1600
+ modelValue: Ue.value,
1601
+ "onUpdate:modelValue": I[1] || (I[1] = (te) => Ue.value = te),
1602
+ class: "grow"
1603
+ }, null, 8, ["modelValue"])) : (W(), U("div", Oa)),
1604
+ na(P(Yt, {
1605
+ modelValue: v.value,
1606
+ "onUpdate:modelValue": I[2] || (I[2] = (te) => v.value = te),
1607
+ label: "Label",
1608
+ value: !1
1609
+ }, null, 8, ["modelValue"]), [
1610
+ [sa, (bt = $e.value) == null ? void 0 : bt.showLabel]
1611
+ ]),
1612
+ (wt = $e.value) != null && wt.showDrillDimension && fe.value.length > 0 ? (W(), U("div", Ua, [
1613
+ P(Ge, {
1614
+ icon: "arrow_upward",
1615
+ variant: "tertiary",
1616
+ disabled: !r.value,
1617
+ onClick: Nt
1618
+ }, null, 8, ["disabled"]),
1619
+ P(Ge, {
1620
+ icon: "arrow_downward",
1621
+ variant: "tertiary",
1622
+ disabled: !x.value,
1623
+ onClick: qt
1624
+ }, null, 8, ["disabled"])
1625
+ ])) : ye("", !0),
1626
+ (xt = $e.value) != null && xt.showRollup && pt.value.length > 0 ? (W(), j(Gt, {
1627
+ key: 3,
1628
+ modelValue: _.value,
1629
+ "onUpdate:modelValue": I[3] || (I[3] = (te) => _.value = te),
1630
+ class: "w-[150px]",
1631
+ items: pt.value
1632
+ }, null, 8, ["modelValue", "items"])) : ye("", !0),
1633
+ C.hideExport ? ye("", !0) : (W(), j(Jt, {
1634
+ key: 4,
1635
+ shift: !0
1636
+ }, {
1637
+ "menu-button": Y(() => [
1638
+ P(Ge, {
1639
+ icon: "more_vert",
1640
+ variant: "tertiary"
1641
+ })
1642
+ ]),
1643
+ default: Y(() => [
1644
+ (W(!0), U(ue, null, _t(o(Ot), (te) => (W(), j(jt, {
1645
+ key: te.value,
1646
+ label: te.label,
1647
+ onClick: te.onClick
1648
+ }, null, 8, ["label", "onClick"]))), 128))
1649
+ ]),
1650
+ _: 1
1651
+ }))
1652
+ ];
1653
+ }),
1654
+ _: 1
1655
+ })
1656
+ ]),
1657
+ _: 1
1658
+ }, 8, ["modelValue", "tile-index"]))
1659
+ ], 4)) : (W(), j(Zt, { key: 1 }))
1660
+ ]),
1661
+ _: 1
1662
+ }, 8, ["class", "variant"]);
1663
+ };
1664
+ }
1665
+ });
1666
+ export {
1667
+ et as L,
1668
+ ge as R,
1669
+ tl as _,
1670
+ Qe as a,
1671
+ Je as g,
1672
+ Tt as u
1673
+ };