@feedmepos/mf-report 5.33.3 → 5.34.1-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 (46) hide show
  1. package/dist/{App-BgRqim5d.js → App-BdSGNJ3L.js} +114 -113
  2. package/dist/{DateRangeSelect-XyU5XG5c.js → DateRangeSelect-Cre6UJLD.js} +67 -67
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-CC7fE3F8.js → Default.vue_vue_type_script_setup_true_lang-CvM5oewZ.js} +3 -3
  4. package/dist/DigestListView-BuB4JOlT.js +876 -0
  5. package/dist/{DigestReaderView-DSNoAESE.js → DigestReaderView-DdpTY1Ax.js} +63 -63
  6. package/dist/{DynamicWidget.vue_vue_type_script_setup_true_lang-CsDiXGUk.js → DynamicWidget.vue_vue_type_script_setup_true_lang-4qBcakJs.js} +733 -733
  7. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-D7Rsh-uY.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-BL3kxHFR.js} +526 -526
  8. package/dist/{InsightView-CF8mQJha.js → InsightView-CZOStmyJ.js} +88 -88
  9. package/dist/{Integration-QMdYwTwW.js → Integration-BC-DWRpD.js} +1983 -1967
  10. package/dist/{Integrations-Dbx1ScOv.js → Integrations-ibKrdipe.js} +10 -10
  11. package/dist/{Layout-CgiplBHM.js → Layout-D0W7xdty.js} +3 -3
  12. package/dist/{LocationSelect.vue_vue_type_script_setup_true_lang-zW8JA7j3.js → LocationSelect.vue_vue_type_script_setup_true_lang-CJCSJkT_.js} +306 -306
  13. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-B0q9V1x8.js → MenuTab.vue_vue_type_script_setup_true_lang-DnPC8AcN.js} +6 -6
  14. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-BVWZ8vTw.js → NavigationTab.vue_vue_type_script_setup_true_lang-CKaMBQka.js} +12784 -11760
  15. package/dist/{OverviewView-BbZ8WkLb.js → OverviewView-AOwgvPBq.js} +7 -7
  16. package/dist/{Report-BYi0pPZs.js → Report-Bs5sy1OF.js} +12 -12
  17. package/dist/{ReportCanvasView-CfFtVomc.js → ReportCanvasView-CYai96pI.js} +426 -426
  18. package/dist/{ReportEditor-BLEkGUVR.js → ReportEditor-BbsLe4B7.js} +32 -32
  19. package/dist/{ReportView-TG78Krm2.js → ReportView-B5Fqspyn.js} +13 -13
  20. package/dist/{ReportViewRoute-BUADf4Cr.js → ReportViewRoute-D2wI79x9.js} +5 -5
  21. package/dist/SelectComponent.vue_vue_type_script_setup_true_lang-Cxx-TQz9.js +137 -0
  22. package/dist/{Setting-Curkhv9_.js → Setting-DdYXi5qR.js} +6 -6
  23. package/dist/{Template-BN_ds698.js → Template-YEa1E6oz.js} +80 -80
  24. package/dist/{TileEditor-Cfb0uXGr.js → TileEditor-CnmEhIab.js} +1566 -1566
  25. package/dist/{TilePageStack.vue_vue_type_script_setup_true_lang-1FKwWbpC.js → TilePageStack.vue_vue_type_script_setup_true_lang-CqWXV57r.js} +82 -82
  26. package/dist/{TransitionFade-D0_ZoB-O.js → TransitionFade-BmItOXFf.js} +170 -170
  27. package/dist/{XeroRedirect-CuTrP62C.js → XeroRedirect-D4sHbZe7.js} +3 -3
  28. package/dist/_plugin-vue_export-helper-Bx7s49ra.js +2828 -0
  29. package/dist/{app-LKjvcmXa.js → app-BmNusIzI.js} +5688 -13890
  30. package/dist/app.js +1 -1
  31. package/dist/assets/{formatChartData.worker-DvK7K5ca.js → formatChartData.worker-Cpgnh20a.js} +62 -62
  32. package/dist/assets/{processTableData.worker-C3l4iUXL.js → processTableData.worker-B7I6PElJ.js} +64 -64
  33. package/dist/{chart-BywXiz4O.js → chart-DU0N9V2o.js} +7 -4
  34. package/dist/currency-DAk-bsf8.js +12 -0
  35. package/dist/index-6T_rmIM_.js +24722 -0
  36. package/dist/{report-Ci2ElGpp.js → report-NKl3Yb5J.js} +23 -23
  37. package/dist/style.css +1 -1
  38. package/dist/{useDigestFont-BxXC7U3d.js → useDigestFont-Bxq6g3WO.js} +80 -80
  39. package/dist/{useReportCanvasPanel-BjmRiMSh.js → useReportCanvasPanel-BN-Gq7Uj.js} +975 -976
  40. package/dist/{useRestaurantPermission-DX52YBfA.js → useRestaurantPermission-D8b3oI0-.js} +2 -2
  41. package/package.json +11 -11
  42. package/dist/DigestListView-Bqp4LA1w.js +0 -876
  43. package/dist/SelectComponent.vue_vue_type_script_setup_true_lang-DW7Dk7iQ.js +0 -137
  44. package/dist/_plugin-vue_export-helper-C6QDExPN.js +0 -2718
  45. package/dist/currency-DFN_8rRJ.js +0 -12
  46. package/dist/index-xdTpLFHc.js +0 -25511
@@ -0,0 +1,876 @@
1
+ import { defineComponent as _t, ref as z, watch as Ft, onBeforeUnmount as Jt, computed as E, useId as Qt, openBlock as g, createElementBlock as x, normalizeClass as X, createElementVNode as D, createTextVNode as te, toDisplayString as O, unref as T, renderSlot as ee, Fragment as C, renderList as N, createCommentVNode as I, resolveComponent as ft, createBlock as dt, withCtx as mt, createVNode as U, createSlots as se, onMounted as ae, onUnmounted as ne } from "vue";
2
+ import { storeToRefs as oe } from "pinia";
3
+ import { useI18n as St } from "@feedmepos/mf-common";
4
+ import { useBreakpoints as Yt } from "@feedmepos/ui-library";
5
+ import { _ as re } from "./Default.vue_vue_type_script_setup_true_lang-CvM5oewZ.js";
6
+ import { _ as jt } from "./SelectComponent.vue_vue_type_script_setup_true_lang-Cxx-TQz9.js";
7
+ import { useRoute as le } from "vue-router";
8
+ import { c as ie, d as Kt, u as ce, a as ue, n as de, _ as he, D as fe } from "./useDigestFont-Bxq6g3WO.js";
9
+ import { l as me } from "./report-canvas-libs-CNx4fuqd.js";
10
+ import { _ as bt } from "./_plugin-vue_export-helper-Bx7s49ra.js";
11
+ import { j as pe, f as ge, A as ve, k as Ct, l as ye, m as xe } from "./app-BmNusIzI.js";
12
+ const W = () => ({ rects: [], circles: [], paths: [] }), Q = (e) => e.x1 - e.x0, tt = (e) => e.y1 - e.y0, S = (e) => e.toFixed(1), kt = [0.14, 0.32, 0.54, 0.78, 1], wt = (e) => kt[Math.min(kt.length - 1, Math.floor(Math.max(0, Math.min(1, e)) * kt.length))];
13
+ function Zt(e) {
14
+ const t = Math.min(0, ...e), n = Math.max(0, ...e);
15
+ if (t >= 0) return (r) => ({ tone: "accent", opacity: wt(n ? r / n : 0) });
16
+ const o = Math.max(-t, n);
17
+ return (r) => r < 0 ? { tone: "below", opacity: wt(-r / o) } : { tone: "accent", opacity: wt(r / o) };
18
+ }
19
+ function Me(e, t) {
20
+ var d;
21
+ const n = e.cells ?? [], o = n.length, r = ((d = n[0]) == null ? void 0 : d.length) ?? 0, u = W();
22
+ if (!o || !r) return u;
23
+ const i = 1.5, m = (Q(t) - i * (r - 1)) / r, p = (tt(t) - i * (o - 1)) / o, c = Zt(n.flat().filter((M) => M !== null));
24
+ return n.forEach(
25
+ (M, h) => M.forEach((f, B) => {
26
+ const v = { x: t.x0 + B * (m + i), y: t.y0 + h * (p + i), width: Math.max(m, 0.5), height: Math.max(p, 0.5) };
27
+ u.rects.push(f === null ? { ...v, tone: "ground", opacity: 1 } : { ...v, ...c(f) });
28
+ })
29
+ ), u;
30
+ }
31
+ function $t(e, t, n, o, r, u) {
32
+ if (u - r >= Math.PI * 2 - 1e-6) return `${$t(e, t, n, o, r, r + Math.PI)} ${$t(e, t, n, o, r + Math.PI, u)}`;
33
+ const i = (p, c) => `${S(e + p * Math.sin(c))},${S(t - p * Math.cos(c))}`, m = u - r > Math.PI ? 1 : 0;
34
+ return `M${i(n, r)} A${S(n)},${S(n)} 0 ${m} 1 ${i(n, u)} L${i(o, u)} A${S(o)},${S(o)} 0 ${m} 0 ${i(o, r)} Z`;
35
+ }
36
+ const Ot = [1, 0.72, 0.5, 0.34, 0.22, 0.14];
37
+ function ke(e, t) {
38
+ var c;
39
+ const n = (((c = e.series[0]) == null ? void 0 : c.values) ?? []).map((d) => Math.max(d ?? 0, 0)), o = n.reduce((d, M) => d + M, 0), r = W();
40
+ if (!o) return r;
41
+ const u = Math.min(Q(t), tt(t)) / 2, i = (t.x0 + t.x1) / 2, m = (t.y0 + t.y1) / 2;
42
+ let p = 0;
43
+ return n.forEach((d, M) => {
44
+ const h = d / o * Math.PI * 2;
45
+ h > 0 && r.paths.push({ d: $t(i, m, u, u * 0.58, p, p + h), tone: "accent", opacity: Ot[Math.min(M, Ot.length - 1)] }), p += h;
46
+ }), r;
47
+ }
48
+ function we(e, t) {
49
+ var p;
50
+ const n = (((p = e.series[0]) == null ? void 0 : p.values) ?? []).map((c) => Math.max(c ?? 0, 0)), o = Math.max(...n, 0), r = W();
51
+ if (!o) return r;
52
+ const u = 2, i = (tt(t) - u * (n.length - 1)) / n.length, m = (t.x0 + t.x1) / 2;
53
+ return n.forEach((c, d) => {
54
+ const M = Math.max(c / o * Q(t), 1.5);
55
+ r.rects.push({ x: m - M / 2, y: t.y0 + d * (i + u), width: M, height: i, tone: "accent", opacity: 1 - d / Math.max(n.length - 1, 1) * 0.45 });
56
+ }), r;
57
+ }
58
+ function $e(e, t) {
59
+ const n = e.x.length, o = W(), r = Math.max(0, ...e.series.flatMap((d) => d.values.map((M) => M ?? 0)));
60
+ if (n < 3 || !r) return o;
61
+ const u = Math.min(Q(t), tt(t)) / 2, i = (t.x0 + t.x1) / 2, m = (t.y0 + t.y1) / 2, p = (d, M) => {
62
+ const h = d / n * Math.PI * 2;
63
+ return `${S(i + u * M * Math.sin(h))},${S(m - u * M * Math.cos(h))}`;
64
+ }, c = (d) => `M${d.map((M, h) => p(h, M)).join(" L")} Z`;
65
+ o.paths.push({ d: c(Array(n).fill(1)), tone: "ground", opacity: 1 });
66
+ for (let d = 0; d < n; d++) o.paths.push({ d: `M${S(i)},${S(m)} L${p(d, 1)}`, tone: "soft", opacity: 0.6, line: "solid" });
67
+ return e.series.forEach((d, M) => {
68
+ const h = c(d.values.map((f) => Math.max(f ?? 0, 0) / r));
69
+ M === 0 && o.paths.push({ d: h, tone: "accent", opacity: 0.28 }), o.paths.push({ d: h, tone: M === 0 ? "accent" : "soft", opacity: 1, line: M === 0 ? "solid" : "dashed" });
70
+ }), o;
71
+ }
72
+ function Rt(e, t, n) {
73
+ const o = Math.min(...e), r = Math.max(...e), u = (r - o) * 0.08;
74
+ return r === o ? () => (t + n) / 2 : (i) => t + (i - (o - u)) / (r - o + u * 2) * (n - t);
75
+ }
76
+ function _e(e, t) {
77
+ const n = e.dots ?? [], o = W();
78
+ if (!n.length) return o;
79
+ const r = n.map((c) => c.x), u = n.map((c) => c.y), i = Rt(r, t.x0, t.x1), m = Rt(u, t.y1, t.y0);
80
+ Math.min(...r) < 0 && Math.max(...r) > 0 && o.paths.push({ d: `M${S(i(0))},${S(t.y0)} L${S(i(0))},${S(t.y1)}`, tone: "soft", opacity: 1, line: "solid" }), Math.min(...u) < 0 && Math.max(...u) > 0 && o.paths.push({ d: `M${S(t.x0)},${S(m(0))} L${S(t.x1)},${S(m(0))}`, tone: "soft", opacity: 1, line: "solid" });
81
+ const p = Math.max(0, ...n.map((c) => c.size ?? 0));
82
+ return n.forEach((c) => {
83
+ const d = p && c.size !== void 0 ? 2 + 5 * Math.sqrt(Math.max(c.size, 0) / p) : 3;
84
+ o.circles.push({ cx: i(c.x), cy: m(c.y), r: d, tone: "accent", opacity: 0.75 });
85
+ }), o;
86
+ }
87
+ function Se(e, t) {
88
+ const n = e.links ?? [], o = W();
89
+ if (!n.length) return o;
90
+ const r = [...new Set(n.flatMap((v) => [v.from, v.to]))], u = new Map(r.map((v) => [v, 0]));
91
+ for (let v = 0; v < r.length; v++) n.forEach((k) => u.set(k.to, Math.max(u.get(k.to), u.get(k.from) + 1)));
92
+ const i = (v) => n.filter((k) => k.to === v).reduce((k, b) => k + b.value, 0), m = (v) => n.filter((k) => k.from === v).reduce((k, b) => k + b.value, 0), p = new Map(r.map((v) => [v, Math.max(i(v), m(v))])), c = Math.max(...u.values()) + 1, d = (v) => r.filter((k) => u.get(k) === v), M = 3, h = Math.min(...Array.from({ length: c }, (v, k) => {
93
+ const b = d(k);
94
+ return (tt(t) - M * (b.length - 1)) / b.reduce((j, R) => j + p.get(R), 0);
95
+ })), f = 6, B = /* @__PURE__ */ new Map();
96
+ for (let v = 0; v < c; v++) {
97
+ let k = t.y0;
98
+ d(v).forEach((b) => {
99
+ const j = c > 1 ? t.x0 + v / (c - 1) * (Q(t) - f) : (t.x0 + t.x1 - f) / 2;
100
+ B.set(b, { x: j, y: k, out: k, in: k }), o.rects.push({ x: j, y: k, width: f, height: Math.max(p.get(b) * h, 1), tone: "accent", opacity: 1 }), k += p.get(b) * h + M;
101
+ });
102
+ }
103
+ return n.forEach((v) => {
104
+ const k = B.get(v.from), b = B.get(v.to), j = v.value * h, R = k.x + f, _ = b.x, Y = (R + _) / 2;
105
+ o.paths.push({
106
+ d: `M${S(R)},${S(k.out)} C${S(Y)},${S(k.out)} ${S(Y)},${S(b.in)} ${S(_)},${S(b.in)} L${S(_)},${S(b.in + j)} C${S(Y)},${S(b.in + j)} ${S(Y)},${S(k.out + j)} ${S(R)},${S(k.out + j)} Z`,
107
+ tone: "soft",
108
+ opacity: 0.85
109
+ }), k.out += j, b.in += j;
110
+ }), o;
111
+ }
112
+ function be(e) {
113
+ const { scale: t, translate: n } = e.topology.transform, o = e.topology.arcs.map((i) => {
114
+ let m = 0, p = 0;
115
+ return i.map(([c, d]) => (m += c, p += d, [m * t[0] + n[0], p * t[1] + n[1]]));
116
+ }), r = (i) => i.flatMap((m, p) => {
117
+ const c = m < 0 ? [...o[~m]].reverse() : o[m];
118
+ return p ? c.slice(1) : c;
119
+ }), u = e.topology.objects.regions.geometries.map((i) => {
120
+ const p = (i.type === "Polygon" ? [i.arcs] : i.type === "MultiPolygon" ? i.arcs : []).flatMap((f) => f.map(r)), c = p.flat(), d = c.map((f) => f[0]), M = c.map((f) => f[1]), h = i.properties ?? {};
121
+ return {
122
+ names: [h.name ?? "", ...String(h.aliases ?? "").split("|")].filter(Boolean),
123
+ rings: p,
124
+ box: [Math.min(...d), Math.min(...M), Math.max(...d), Math.max(...M)]
125
+ };
126
+ });
127
+ return { id: e.id, country: e.country, level: e.level, bbox: e.bbox, features: u };
128
+ }
129
+ function Ee(e) {
130
+ const t = /FM\.geoOutlines = (\{[\s\S]*\})\s*\}\)\(\)\s*$/.exec(e);
131
+ return t ? JSON.parse(t[1]).layers.map(be) : [];
132
+ }
133
+ let Tt;
134
+ function Le() {
135
+ return Tt ?? (Tt = me(["geo-outlines@1"]).then((e) => Ee(e["geo-outlines@1"] ?? ""))), Tt;
136
+ }
137
+ function J(e) {
138
+ return String(e || "").toLowerCase().replace(/\b(w\.?\s?p\.?|wilayah persekutuan|federal territory( of)?|changwat|province( of)?|state( of)?|negeri)\b/g, " ").replace(/[^\p{L}\p{N}]+/gu, "");
139
+ }
140
+ const qt = (e, t, n) => t >= e[0] && t <= e[2] && n >= e[1] && n <= e[3];
141
+ function Be(e, t) {
142
+ let n;
143
+ return e.forEach((o) => {
144
+ const r = /* @__PURE__ */ new Map();
145
+ o.features.forEach((i) => i.names.forEach((m) => J(m) && !r.has(J(m)) && r.set(J(m), i)));
146
+ const u = t.filter((i) => r.has(J(i))).length;
147
+ u && (!n || u > n.matched) && (n = { layer: o, byKey: r, matched: u });
148
+ }), n;
149
+ }
150
+ function Ve(e, t) {
151
+ var M;
152
+ const n = (h) => t.filter((f) => qt(h.bbox, f.lon, f.lat)).length, o = (h) => (h.bbox[2] - h.bbox[0]) * (h.bbox[3] - h.bbox[1]), r = (M = e.filter((h) => n(h) > 0).sort((h, f) => n(f) - n(h) || o(h) - o(f))[0]) == null ? void 0 : M.country;
153
+ if (!r) return;
154
+ const u = e.filter((h) => h.country === r), i = t.map((h) => h.lat), m = t.map((h) => h.lon), p = Math.max(Math.max(...i) - Math.min(...i), Math.max(...m) - Math.min(...m)), c = u.find((h) => h.level === "districts" && t.every((f) => qt(h.bbox, f.lon, f.lat))), d = u.find((h) => h.level === "states");
155
+ return p <= 1.5 && c || d || c || u[0];
156
+ }
157
+ function At(e, t) {
158
+ const n = (d) => Math.log(Math.tan(Math.PI / 4 + Math.max(-85, Math.min(85, d)) * Math.PI / 360)), o = e[0] * Math.PI / 180, r = e[2] * Math.PI / 180, u = n(e[1]), i = n(e[3]), m = Math.min(Q(t) / (r - o || 1e-9), tt(t) / (i - u || 1e-9)), p = t.x0 + (Q(t) - (r - o) * m) / 2, c = t.y0 + (tt(t) - (i - u) * m) / 2;
159
+ return (d, M) => [p + (d * Math.PI / 180 - o) * m, c + (i - n(M)) * m];
160
+ }
161
+ function Nt(e, t, n) {
162
+ const o = Math.max(t * Math.max(e[2] - e[0], e[3] - e[1]), n);
163
+ return [e[0] - o, e[1] - o, e[2] + o, e[3] + o];
164
+ }
165
+ const zt = (e, t) => e[0] <= t[2] && e[2] >= t[0] && e[1] <= t[3] && e[3] >= t[1];
166
+ function De(e, t, n) {
167
+ var h;
168
+ const o = W(), r = (f, B) => f.rings.map((v) => `M${v.map(([k, b]) => B(k, b).map(S).join(",")).join(" L")} Z`).join(" ");
169
+ if ((h = e.regions) != null && h.length) {
170
+ const f = Be(n, e.regions.map((_) => _.name));
171
+ if (!f) return o;
172
+ const B = e.regions.filter((_) => f.byKey.has(J(_.name))), v = B.map((_) => f.byKey.get(J(_.name)).box), k = Nt([Math.min(...v.map((_) => _[0])), Math.min(...v.map((_) => _[1])), Math.max(...v.map((_) => _[2])), Math.max(...v.map((_) => _[3]))], 0.08, 0.02), b = At(k, t), j = Zt(B.map((_) => _.value)), R = new Map(B.map((_) => [f.byKey.get(J(_.name)), _.value]));
173
+ return f.layer.features.filter((_) => zt(_.box, k)).forEach((_) => o.paths.push({ d: r(_, b), ...R.has(_) ? j(R.get(_)) : { tone: "land", opacity: 1 } })), o;
174
+ }
175
+ const u = e.places ?? [], i = u.length ? Ve(n, u) : void 0;
176
+ if (!i) return o;
177
+ const m = u.map((f) => f.lat), p = u.map((f) => f.lon), c = Nt([Math.min(...p), Math.min(...m), Math.max(...p), Math.max(...m)], 0.15, 0.05), d = At(c, t);
178
+ i.features.filter((f) => zt(f.box, c)).forEach((f) => o.paths.push({ d: r(f, d), tone: "land", opacity: 1 }));
179
+ const M = Math.max(0, ...u.map((f) => Math.abs(f.value ?? 0)));
180
+ return u.forEach((f) => {
181
+ const [B, v] = d(f.lon, f.lat), k = M && f.value !== void 0 ? 2.5 + 5.5 * Math.sqrt(Math.abs(f.value) / M) : 3.5;
182
+ o.circles.push({ cx: B, cy: v, r: k, tone: (f.value ?? 0) < 0 ? "below" : "accent", opacity: 0.85 });
183
+ }), o;
184
+ }
185
+ function Pe(e, t, n = []) {
186
+ return e.kind === "heatmap" ? Me(e, t) : e.kind === "donut" ? ke(e, t) : e.kind === "funnel" ? we(e, t) : e.kind === "radar" ? $e(e, t) : e.kind === "scatter" ? _e(e, t) : e.kind === "flow" ? Se(e, t) : e.kind === "map" ? De(e, t, n) : W();
187
+ }
188
+ const Ie = { class: "flex items-center justify-between gap-8" }, Fe = { class: "digest-kind" }, je = ["viewBox", "height", "aria-label"], Ce = ["x2", "y1", "y2"], Oe = ["d"], Re = ["d"], Te = ["d"], qe = ["x", "y", "width", "height"], Ae = ["x", "y"], Ne = ["x", "y", "width", "height"], ze = ["width", "height"], He = ["clip-path", "data-kind"], Xe = ["d", "opacity"], Ye = ["x", "y", "width", "height", "opacity"], Ke = ["cx", "cy", "r", "opacity"], Ze = ["x1", "x2", "y1", "y2"], We = ["cx", "cy"], Ge = ["x", "y", "text-anchor"], Ue = ["x"], Je = ["x", "y"], Qe = {
189
+ key: 1,
190
+ class: "flex items-start gap-8",
191
+ "data-testid": "digest-cover-quote"
192
+ }, ts = { class: "digest-quote" }, es = ["title"], ut = 28, Z = 12, ss = 12, as = /* @__PURE__ */ _t({
193
+ __name: "DigestCover",
194
+ props: {
195
+ cover: {},
196
+ quote: {},
197
+ dark: { type: Boolean },
198
+ hero: { type: Boolean }
199
+ },
200
+ setup(e) {
201
+ const t = e, { t: n, locale: o } = St(), r = z(), u = z(0);
202
+ let i;
203
+ Ft(r, (a) => {
204
+ i == null || i.disconnect(), !(!a || typeof ResizeObserver > "u") && (i = new ResizeObserver(([l]) => {
205
+ const { width: s, height: $ } = l.contentRect;
206
+ s && (u.value = $ / s);
207
+ }), i.observe(a));
208
+ }), Jt(() => i == null ? void 0 : i.disconnect());
209
+ const m = E(() => t.hero ? 520 : 340), p = E(() => {
210
+ var a;
211
+ return ["line", "bar", "waterfall"].includes(((a = t.cover) == null ? void 0 : a.kind) ?? "");
212
+ }), c = E(
213
+ () => t.hero && p.value ? 26 + (ct.value.some((a) => a.lines.length > 1) ? 12 : 0) : 6
214
+ ), d = E(
215
+ () => u.value ? Math.max(ut + c.value + 40, Math.round(m.value * u.value)) : t.hero ? 168 : 110
216
+ ), M = E(() => {
217
+ const a = t.cover;
218
+ return a ? [a.title, a.takeaway].filter(Boolean).join(" · ") : n("reportV5.digest.card.leadStory");
219
+ }), h = E(
220
+ () => {
221
+ var a, l;
222
+ return [(a = t.cover) == null ? void 0 : a.title, ...(((l = t.cover) == null ? void 0 : l.marks) ?? []).map((s) => s.label)].filter(Boolean).join(" · ");
223
+ }
224
+ ), f = E(
225
+ () => {
226
+ var a;
227
+ return (((a = t.cover) == null ? void 0 : a.series) ?? []).flatMap((l) => l.values).filter((l) => l !== null);
228
+ }
229
+ ), B = E(() => {
230
+ var $;
231
+ const a = t.cover;
232
+ if ((a == null ? void 0 : a.kind) !== "waterfall") return [];
233
+ const l = (($ = a.series[0]) == null ? void 0 : $.values) ?? [];
234
+ let s = 0;
235
+ return l.map((y, V) => {
236
+ const L = y ?? 0, P = V === 0 || V === l.length - 1, F = P ? 0 : s;
237
+ return s = P ? L : s + L, { from: F, to: s, change: L, total: P };
238
+ });
239
+ }), v = E(
240
+ () => B.value.flatMap((a) => a.total ? [a.to] : [a.from, a.to])
241
+ ), k = E(() => {
242
+ const a = v.value;
243
+ if (!a.length) return 0;
244
+ const l = Math.min(...a), s = Math.max(...a);
245
+ return !(l > 0) || l === s || (s - l) * 4 >= s ? 0 : l - (s - l);
246
+ }), b = E(() => {
247
+ var P, F;
248
+ const a = d.value - ut - c.value, l = (q, st) => (at) => ut + a - (at - q) / (st - q || 1) * a;
249
+ if (((P = t.cover) == null ? void 0 : P.kind) === "waterfall") {
250
+ const q = v.value;
251
+ return q.length ? l(Math.min(k.value, ...q), Math.max(...q)) : l(0, 1);
252
+ }
253
+ const s = f.value;
254
+ if (!s.length) return (q) => d.value - c.value;
255
+ const $ = ((F = t.cover) == null ? void 0 : F.kind) === "bar", y = $ ? Math.min(0, ...s) : Math.min(...s), V = Math.max(...s), L = V - y || Math.abs(V) || 1;
256
+ return $ ? l(y, V) : l(y - L * 0.15, V + L * 0.05);
257
+ }), j = E(() => {
258
+ var a;
259
+ return ((a = t.cover) == null ? void 0 : a.x.length) ?? 0;
260
+ }), R = E(() => j.value > 1 ? (m.value - Z * 2) / (j.value - 1) : 0), _ = (a) => j.value > 1 ? Z + a * R.value : m.value / 2;
261
+ function Y(a) {
262
+ let l = "M";
263
+ return a.map((s, $) => {
264
+ if (s === null)
265
+ return l = "M", "";
266
+ const y = `${l}${_($).toFixed(1)},${b.value(s).toFixed(1)}`;
267
+ return l = "L", y;
268
+ }).join(" ");
269
+ }
270
+ const ot = E(
271
+ () => {
272
+ var a;
273
+ return ((a = t.cover) == null ? void 0 : a.kind) === "line" ? t.cover.series.map((l) => Y(l.values)) : [];
274
+ }
275
+ ), rt = E(() => {
276
+ var s, $;
277
+ const a = ((s = t.cover) == null ? void 0 : s.kind) === "line" ? ($ = t.cover.series[0]) == null ? void 0 : $.values : void 0;
278
+ if (!a || a.some((y) => y === null) || a.length < 2) return "";
279
+ const l = (d.value - c.value).toFixed(1);
280
+ return `${Y(a)} L${_(a.length - 1).toFixed(1)},${l} L${_(0).toFixed(1)},${l} Z`;
281
+ }), A = E(() => (m.value - Z * 2) / Math.max(j.value, 1)), lt = E(() => {
282
+ var a;
283
+ return Math.min(((a = t.cover) == null ? void 0 : a.series.length) ?? 0, 2);
284
+ }), et = E(() => A.value * 0.72 / Math.max(lt.value, 1)), pt = (a, l) => Z + a * A.value + A.value * 0.14 + l * et.value, w = E(() => {
285
+ const a = t.cover;
286
+ if ((a == null ? void 0 : a.kind) !== "bar") return [];
287
+ const l = b.value(0), s = a.marks ?? [];
288
+ return a.series.slice(0, lt.value).flatMap(
289
+ ($, y) => $.values.map((V, L) => {
290
+ const P = V === null ? l : b.value(V), F = s.some((q) => q.at === L && q.series === y);
291
+ return {
292
+ key: `${y}-${L}`,
293
+ x: pt(L, y),
294
+ y: Math.min(P, l),
295
+ width: Math.max(et.value - 1.5, 1.5),
296
+ height: Math.max(Math.abs(l - P), V === null ? 0 : 1.5),
297
+ faint: y > 0,
298
+ marked: F,
299
+ // a noted bar stands out against the bars it is compared with
300
+ muted: s.length > 0 && !F && y === 0
301
+ };
302
+ })
303
+ );
304
+ });
305
+ function K(a, l) {
306
+ var L;
307
+ const s = (L = t.cover) == null ? void 0 : L.format, $ = Math.abs(s === "ratio" ? a * 100 : a), y = new Intl.NumberFormat(o.value, {
308
+ maximumFractionDigits: $ >= 100 ? 0 : 1
309
+ }).format($), V = s === "ratio" || s === "percent" ? "%" : "";
310
+ return `${l ? "" : a < 0 ? "−" : "+"}${y}${V}`;
311
+ }
312
+ const it = E(() => {
313
+ const a = k.value, l = A.value * 0.6, s = B.value.map((y, V) => {
314
+ const L = b.value(y.total ? a : y.from), P = b.value(y.to), F = Z + V * A.value + (A.value - l) / 2;
315
+ return {
316
+ key: V,
317
+ x: F,
318
+ y: Math.min(L, P),
319
+ width: l,
320
+ height: Math.max(Math.abs(L - P), 1.5),
321
+ total: y.total,
322
+ figure: K(y.change, y.total),
323
+ figureX: F + l / 2
324
+ };
325
+ }), $ = t.hero && s.every((y) => y.figure.length * 6.5 <= A.value);
326
+ return s.map((y) => ({ ...y, figure: $ ? y.figure : "" }));
327
+ }), gt = (a) => a.length * (t.hero ? 7.5 : 7), vt = E(() => {
328
+ const a = t.cover;
329
+ if ((a == null ? void 0 : a.kind) !== "line" && (a == null ? void 0 : a.kind) !== "bar") return [];
330
+ const l = a.kind === "line", s = [], $ = (a.marks ?? []).flatMap((y, V) => {
331
+ var It;
332
+ const L = (It = a.series[y.series]) == null ? void 0 : It.values[y.at];
333
+ if (L == null || !l && y.series >= lt.value) return [];
334
+ const P = l ? _(y.at) : pt(y.at, y.series) + et.value / 2, F = b.value(L), q = P > m.value * 0.8 ? "end" : P < m.value * 0.2 ? "start" : "middle", st = gt(y.label), at = q === "end" ? P - st : q === "start" ? P : P - st / 2, yt = !l && L < 0, nt = l ? Math.max(F - 12, 16) : yt ? F + 14 : F - 6, Bt = yt ? 14 : -14, Gt = (xt) => xt >= 12 && xt <= d.value - c.value && !s.some((Mt) => at < Mt.x1 && at + st > Mt.x0 && Math.abs(xt - Mt.y) < 14), Vt = [nt, nt + Bt, nt + Bt * 2], Dt = b.value(0) + (yt ? -6 : 14), H = (l ? t.hero ? [...Vt, F + 22, F + 36] : [nt] : [...t.hero ? Vt : [nt], Dt]).find(Gt);
335
+ H !== void 0 && s.push({ x0: at, x1: at + st, y: H });
336
+ const Pt = l ? 6 : 2, Ut = H === void 0 || H === nt || !l && H === Dt ? void 0 : H < F ? [F - Pt, H + 3] : [F + Pt, H - 11];
337
+ return [
338
+ {
339
+ key: V,
340
+ x: P,
341
+ y: F,
342
+ anchor: q,
343
+ dot: l,
344
+ labelY: H ?? 0,
345
+ label: H === void 0 ? "" : y.label,
346
+ leader: Ut
347
+ }
348
+ ];
349
+ });
350
+ return t.hero || $.every((y) => y.label) ? $ : $.map((y) => ({ ...y, label: "", leader: void 0 }));
351
+ });
352
+ function G(a, l, s) {
353
+ const $ = (V) => V.length * 6.5 <= l;
354
+ if ($(a)) return [a];
355
+ if (!s) return;
356
+ const y = a.split(" ");
357
+ for (let V = y.length - 1; V > 0; V--) {
358
+ const L = [y.slice(0, V).join(" "), y.slice(V).join(" ")];
359
+ if (L.every($)) return L;
360
+ }
361
+ }
362
+ const ct = E(() => {
363
+ const a = t.cover;
364
+ if (!t.hero || !a || !p.value) return [];
365
+ const l = a.kind !== "line", s = Math.ceil(a.x.length / ss), $ = a.x.length - 1, y = (l ? A.value : R.value) * s, V = a.x.map((L, P) => ({
366
+ x: l ? Z + P * A.value + A.value / 2 : _(P),
367
+ lines: G(ie(a, P, o.value), y, l),
368
+ marked: (a.marks ?? []).some((F) => F.at === P)
369
+ })).filter((L, P) => ($ - P) % s === 0);
370
+ return V.every((L) => L.lines) ? V.map((L) => ({ ...L, lines: L.lines })) : [];
371
+ }), Et = z([]);
372
+ Ft(
373
+ () => {
374
+ var a;
375
+ return (a = t.cover) == null ? void 0 : a.kind;
376
+ },
377
+ (a) => {
378
+ a === "map" && Le().then((l) => Et.value = l);
379
+ },
380
+ { immediate: !0 }
381
+ );
382
+ const ht = E(
383
+ () => t.cover && !p.value ? Pe(t.cover, { x0: Z, y0: 6, x1: m.value - Z, y1: d.value - c.value }, Et.value) : void 0
384
+ ), Lt = `digest-cover-${Qt()}`, Wt = E(() => {
385
+ if (!t.hero || !p.value) return [];
386
+ const a = d.value - c.value;
387
+ return [a, (a + ut) / 2, ut];
388
+ });
389
+ return (a, l) => (g(), x("div", {
390
+ class: X(["digest-vis", { dark: e.dark, hero: e.hero }])
391
+ }, [
392
+ D("div", Ie, [
393
+ D("span", Fe, [
394
+ l[0] || (l[0] = D("svg", {
395
+ width: "13",
396
+ height: "13",
397
+ viewBox: "0 0 24 24",
398
+ fill: "none",
399
+ stroke: "currentColor",
400
+ "stroke-width": "2.4",
401
+ "stroke-linecap": "round",
402
+ "stroke-linejoin": "round",
403
+ "aria-hidden": "true"
404
+ }, [
405
+ D("path", { d: "M4 17l5-5 4 4 7-7" }),
406
+ D("path", { d: "M15 9h5v5" })
407
+ ], -1)),
408
+ te(" " + O(T(n)("reportV5.digest.card.weekly")), 1)
409
+ ]),
410
+ ee(a.$slots, "badge", {}, void 0, !0)
411
+ ]),
412
+ e.cover ? (g(), x("svg", {
413
+ key: 0,
414
+ ref_key: "chart",
415
+ ref: r,
416
+ "data-testid": "digest-cover",
417
+ class: "digest-chart",
418
+ viewBox: `0 0 ${m.value} ${d.value}`,
419
+ width: "100%",
420
+ height: e.hero ? 200 : 110,
421
+ role: "img",
422
+ "aria-label": h.value
423
+ }, [
424
+ (g(!0), x(C, null, N(Wt.value, (s) => (g(), x("line", {
425
+ key: `grid-${s}`,
426
+ x1: "0",
427
+ x2: m.value,
428
+ y1: s,
429
+ y2: s,
430
+ class: "grid"
431
+ }, null, 8, Ce))), 128)),
432
+ e.cover.kind === "line" ? (g(), x(C, { key: 0 }, [
433
+ rt.value ? (g(), x("path", {
434
+ key: 0,
435
+ d: rt.value,
436
+ class: "area"
437
+ }, null, 8, Oe)) : I("", !0),
438
+ (g(!0), x(C, null, N(ot.value.slice(1), (s, $) => (g(), x("path", {
439
+ key: `base-${$}`,
440
+ d: s,
441
+ class: "baseline"
442
+ }, null, 8, Re))), 128)),
443
+ ot.value[0] ? (g(), x("path", {
444
+ key: 1,
445
+ d: ot.value[0],
446
+ class: "line"
447
+ }, null, 8, Te)) : I("", !0)
448
+ ], 64)) : e.cover.kind === "waterfall" ? (g(!0), x(C, { key: 1 }, N(it.value, (s) => (g(), x(C, {
449
+ key: s.key
450
+ }, [
451
+ D("rect", {
452
+ x: s.x,
453
+ y: s.y,
454
+ width: s.width,
455
+ height: s.height,
456
+ rx: "2",
457
+ class: X(["bar", s.total ? "total" : "step"])
458
+ }, null, 10, qe),
459
+ s.figure ? (g(), x("text", {
460
+ key: 0,
461
+ "data-testid": "digest-cover-figure",
462
+ x: s.figureX,
463
+ y: s.y - 5,
464
+ "text-anchor": "middle",
465
+ class: "figure"
466
+ }, O(s.figure), 9, Ae)) : I("", !0)
467
+ ], 64))), 128)) : e.cover.kind === "bar" ? (g(!0), x(C, { key: 2 }, N(w.value, (s) => (g(), x("rect", {
468
+ key: s.key,
469
+ x: s.x,
470
+ y: s.y,
471
+ width: s.width,
472
+ height: s.height,
473
+ rx: "2",
474
+ class: X(["bar", { faint: s.faint, marked: s.marked, muted: s.muted }])
475
+ }, null, 10, Ne))), 128)) : ht.value ? (g(), x(C, { key: 3 }, [
476
+ D("clipPath", { id: Lt }, [
477
+ D("rect", {
478
+ x: "0",
479
+ y: "0",
480
+ width: m.value,
481
+ height: d.value
482
+ }, null, 8, ze)
483
+ ]),
484
+ D("g", {
485
+ "clip-path": `url(#${Lt})`,
486
+ "data-testid": "digest-cover-shapes",
487
+ "data-kind": e.cover.kind
488
+ }, [
489
+ (g(!0), x(C, null, N(ht.value.paths, (s, $) => (g(), x("path", {
490
+ key: `path-${$}`,
491
+ d: s.d,
492
+ opacity: s.opacity,
493
+ class: X(["shape", s.tone, s.line ? `stroke ${s.line}` : "fill"])
494
+ }, null, 10, Xe))), 128)),
495
+ (g(!0), x(C, null, N(ht.value.rects, (s, $) => (g(), x("rect", {
496
+ key: `rect-${$}`,
497
+ x: s.x,
498
+ y: s.y,
499
+ width: s.width,
500
+ height: s.height,
501
+ opacity: s.opacity,
502
+ rx: "1.5",
503
+ class: X(["shape", "fill", s.tone])
504
+ }, null, 10, Ye))), 128)),
505
+ (g(!0), x(C, null, N(ht.value.circles, (s, $) => (g(), x("circle", {
506
+ key: `circle-${$}`,
507
+ cx: s.cx,
508
+ cy: s.cy,
509
+ r: s.r,
510
+ opacity: s.opacity,
511
+ class: X(["shape", "fill", "dot-mark", s.tone])
512
+ }, null, 10, Ke))), 128))
513
+ ], 8, He)
514
+ ], 64)) : I("", !0),
515
+ (g(!0), x(C, null, N(vt.value, (s) => (g(), x(C, {
516
+ key: s.key
517
+ }, [
518
+ s.leader ? (g(), x("line", {
519
+ key: 0,
520
+ x1: s.x,
521
+ x2: s.x,
522
+ y1: s.leader[0],
523
+ y2: s.leader[1],
524
+ class: "leader"
525
+ }, null, 8, Ze)) : I("", !0),
526
+ s.dot ? (g(), x("circle", {
527
+ key: 1,
528
+ cx: s.x,
529
+ cy: s.y,
530
+ r: "5",
531
+ class: "dot"
532
+ }, null, 8, We)) : I("", !0),
533
+ s.label ? (g(), x("text", {
534
+ key: 2,
535
+ "data-testid": "digest-cover-mark",
536
+ x: s.x,
537
+ y: s.labelY,
538
+ "text-anchor": s.anchor,
539
+ class: "mark"
540
+ }, O(s.label), 9, Ge)) : I("", !0)
541
+ ], 64))), 128)),
542
+ (g(!0), x(C, null, N(ct.value, (s) => (g(), x("text", {
543
+ key: s.x,
544
+ x: s.x,
545
+ "text-anchor": "middle",
546
+ class: X(["tick", { marked: s.marked }])
547
+ }, [
548
+ (g(!0), x(C, null, N(s.lines, ($, y) => (g(), x("tspan", {
549
+ key: y,
550
+ x: s.x,
551
+ y: d.value - 6 - (s.lines.length - 1 - y) * 12
552
+ }, O($), 9, Je))), 128))
553
+ ], 10, Ue))), 128))
554
+ ], 8, je)) : I("", !0),
555
+ !e.cover && e.quote ? (g(), x("div", Qe, [
556
+ l[1] || (l[1] = D("span", {
557
+ class: "digest-quote-mark",
558
+ "aria-hidden": "true"
559
+ }, "“", -1)),
560
+ D("p", ts, O(e.quote), 1)
561
+ ])) : I("", !0),
562
+ D("p", {
563
+ class: "digest-take",
564
+ title: M.value
565
+ }, O(M.value), 9, es)
566
+ ], 2));
567
+ }
568
+ }), ns = /* @__PURE__ */ bt(as, [["__scopeId", "data-v-7453d8bb"]]), os = {
569
+ class: "digest-new",
570
+ "data-testid": "digest-unread"
571
+ }, rs = { class: "digest-card-body" }, ls = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, is = {
572
+ class: "digest-headline",
573
+ "data-testid": "digest-card-headline"
574
+ }, cs = {
575
+ key: 0,
576
+ class: "digest-lead"
577
+ }, us = {
578
+ key: 1,
579
+ class: "flex flex-col gap-8"
580
+ }, ds = { class: "digest-story-number" }, hs = { class: "digest-card-foot" }, fs = {
581
+ key: 0,
582
+ class: "digest-read"
583
+ }, ms = {
584
+ key: 1,
585
+ class: "digest-go",
586
+ "aria-hidden": "true"
587
+ }, ps = 3, gs = /* @__PURE__ */ _t({
588
+ __name: "DigestListCard",
589
+ props: {
590
+ card: {},
591
+ hero: { type: Boolean }
592
+ },
593
+ setup(e) {
594
+ const t = e, { t: n, locale: o } = St(), { breakpoints: r } = Yt(), u = le(), i = E(() => t.hero && (r.value.lg || r.value.md)), m = E(
595
+ () => Kt(t.card.weekStart, t.card.weekEnd, o.value)
596
+ ), p = E(
597
+ () => [
598
+ t.card.stories.length ? n(
599
+ "reportV5.digest.card.stories",
600
+ { count: t.card.stories.length },
601
+ t.card.stories.length
602
+ ) : "",
603
+ t.card.charts ? n("reportV5.digest.card.charts", { count: t.card.charts }, t.card.charts) : ""
604
+ ].filter(Boolean).join(" · ")
605
+ ), c = E(() => t.card.stories[0] ?? t.card.headline), d = E(() => ({
606
+ name: "digestReader",
607
+ params: { weekStart: t.card.weekStart },
608
+ query: u.query
609
+ }));
610
+ return (M, h) => {
611
+ const f = ft("RouterLink");
612
+ return g(), dt(f, {
613
+ to: d.value,
614
+ class: X(["digest-card", { hero: e.hero }]),
615
+ "data-testid": e.hero ? "digest-hero" : "digest-list-card",
616
+ "data-week": e.card.weekStart
617
+ }, {
618
+ default: mt(() => [
619
+ U(ns, {
620
+ class: "digest-card-vis",
621
+ cover: e.card.cover,
622
+ quote: c.value,
623
+ dark: e.hero || !e.card.read,
624
+ hero: i.value
625
+ }, se({ _: 2 }, [
626
+ e.card.read ? void 0 : {
627
+ name: "badge",
628
+ fn: mt(() => [
629
+ D("span", os, O(T(n)("reportV5.digest.card.new")), 1)
630
+ ]),
631
+ key: "0"
632
+ }
633
+ ]), 1032, ["cover", "quote", "dark", "hero"]),
634
+ D("div", rs, [
635
+ D("span", ls, O(m.value), 1),
636
+ D("p", is, O(e.card.headline), 1),
637
+ e.hero ? (g(), x(C, { key: 0 }, [
638
+ e.card.lead ? (g(), x("p", cs, O(e.card.lead), 1)) : I("", !0),
639
+ e.card.stories.length ? (g(), x("ol", us, [
640
+ (g(!0), x(C, null, N(e.card.stories.slice(0, ps), (B, v) => (g(), x("li", {
641
+ key: v,
642
+ class: "digest-story"
643
+ }, [
644
+ D("span", ds, O(v + 1), 1),
645
+ D("span", null, O(B), 1)
646
+ ]))), 128))
647
+ ])) : I("", !0)
648
+ ], 64)) : I("", !0),
649
+ D("div", hs, [
650
+ e.hero ? (g(), x("span", fs, O(T(n)("reportV5.digest.card.read")), 1)) : I("", !0),
651
+ D("span", {
652
+ class: X(["fm-typo-en-body-md-400 text-fm-color-typo-secondary", { "ml-auto": e.hero }])
653
+ }, O(p.value), 3),
654
+ e.hero ? I("", !0) : (g(), x("span", ms, [...h[0] || (h[0] = [
655
+ D("svg", {
656
+ width: "16",
657
+ height: "16",
658
+ viewBox: "0 0 24 24",
659
+ fill: "none",
660
+ stroke: "currentColor",
661
+ "stroke-width": "2.2",
662
+ "stroke-linecap": "round",
663
+ "stroke-linejoin": "round"
664
+ }, [
665
+ D("path", { d: "M5 12h14" }),
666
+ D("path", { d: "M13 6l6 6-6 6" })
667
+ ], -1)
668
+ ])]))
669
+ ])
670
+ ])
671
+ ]),
672
+ _: 1
673
+ }, 8, ["to", "class", "data-testid", "data-week"]);
674
+ };
675
+ }
676
+ }), Ht = /* @__PURE__ */ bt(gs, [["__scopeId", "data-v-3933c9b3"]]), vs = {
677
+ key: 0,
678
+ class: "flex flex-wrap items-center justify-end gap-8"
679
+ }, ys = {
680
+ class: "min-h-0 flex-1 overflow-y-auto pb-32",
681
+ "data-testid": "digest-list"
682
+ }, xs = {
683
+ key: 0,
684
+ class: "fm-typo-en-body-sm-400 px-24 py-16 text-fm-color-typo-error",
685
+ "data-testid": "digest-error"
686
+ }, Ms = {
687
+ key: 1,
688
+ class: "flex justify-center py-[80px]",
689
+ "data-testid": "digest-loading"
690
+ }, ks = {
691
+ key: 0,
692
+ class: "mx-24 mt-24 flex flex-col gap-12",
693
+ "aria-labelledby": "digest-new-heading"
694
+ }, ws = {
695
+ id: "digest-new-heading",
696
+ class: "fm-typo-en-title-sm-600"
697
+ }, $s = {
698
+ key: 1,
699
+ class: "mx-24 mt-[40px] flex flex-col gap-12",
700
+ "aria-labelledby": "digest-earlier-heading"
701
+ }, _s = {
702
+ id: "digest-earlier-heading",
703
+ class: "fm-typo-en-title-sm-600"
704
+ }, Ss = { class: "digest-grid" }, bs = {
705
+ key: 2,
706
+ class: "mt-24 flex justify-center"
707
+ }, Xt = 5e3, Es = /* @__PURE__ */ _t({
708
+ __name: "DigestListView",
709
+ setup(e) {
710
+ const { t: n, locale: o } = St(), { breakpoints: r } = Yt(), { isFeedmeAdmin: u } = pe(), i = ge(), { subscription: m } = oe(i);
711
+ ce();
712
+ const p = z([]), c = z(), d = z(!0), M = z(!1), h = z(""), f = z(!1), B = z(), v = z("");
713
+ let k;
714
+ const b = (w) => w instanceof Error ? w.message : String(w), j = (w) => w instanceof ve && w.status === 403, R = E(() => p.value[0]), _ = E(() => p.value.slice(1)), Y = E(
715
+ () => {
716
+ var w;
717
+ return (w = m.value) != null && w.scheduled ? ue(de(/* @__PURE__ */ new Date()), o.value) : "";
718
+ }
719
+ ), ot = E(
720
+ () => {
721
+ var w, K;
722
+ return ((w = B.value) == null ? void 0 : w.status) === "requested" || ((K = B.value) == null ? void 0 : K.status) === "running";
723
+ }
724
+ ), rt = E(() => {
725
+ const w = B.value;
726
+ if (!w) return "";
727
+ const K = new Date(Date.parse(`${w.weekStart}T00:00:00Z`) + 6 * 864e5).toISOString().slice(0, 10), it = {
728
+ week: Kt(w.weekStart, K, o.value),
729
+ failure: (w.failure ?? "").split(`
730
+ `)[0].slice(0, 160)
731
+ };
732
+ return n(`reportV5.digest.build.${w.status}`, it);
733
+ });
734
+ async function A() {
735
+ d.value = !0, h.value = "";
736
+ try {
737
+ const w = await Ct();
738
+ p.value = w.digests, c.value = w.next;
739
+ } catch (w) {
740
+ j(w) ? f.value = !0 : h.value = b(w);
741
+ } finally {
742
+ d.value = !1;
743
+ }
744
+ }
745
+ async function lt() {
746
+ if (c.value) {
747
+ M.value = !0;
748
+ try {
749
+ const w = await Ct(c.value);
750
+ p.value = [...p.value, ...w.digests], c.value = w.next;
751
+ } catch (w) {
752
+ h.value = b(w);
753
+ } finally {
754
+ M.value = !1;
755
+ }
756
+ }
757
+ }
758
+ ae(async () => {
759
+ await Promise.all([
760
+ A(),
761
+ i.loadSubscription().catch((w) => {
762
+ j(w) && (f.value = !0);
763
+ })
764
+ ]);
765
+ });
766
+ async function et() {
767
+ const w = B.value;
768
+ if (w) {
769
+ try {
770
+ B.value = await xe(w.id);
771
+ } catch (K) {
772
+ v.value = b(K);
773
+ return;
774
+ }
775
+ if (ot.value) {
776
+ k = setTimeout(et, Xt);
777
+ return;
778
+ }
779
+ B.value.status === "saved" && await A();
780
+ }
781
+ }
782
+ async function pt() {
783
+ v.value = "";
784
+ try {
785
+ B.value = (await ye()).run, k = setTimeout(et, Xt);
786
+ } catch (w) {
787
+ v.value = b(w);
788
+ }
789
+ }
790
+ return ne(() => {
791
+ k && clearTimeout(k);
792
+ }), (w, K) => {
793
+ const it = ft("FmButton"), gt = ft("FmPageHead"), vt = ft("FmCircularProgress");
794
+ return g(), dt(re, null, {
795
+ default: mt(() => [
796
+ U(gt, {
797
+ title: T(n)("reportV5.digest.title"),
798
+ description: T(r).lg || T(r).md ? T(n)("reportV5.digest.subtitle") : "",
799
+ class: "shrink-0"
800
+ }, {
801
+ append: mt(() => {
802
+ var G, ct;
803
+ return [
804
+ f.value ? I("", !0) : (g(), x("div", vs, [
805
+ rt.value || v.value ? (g(), x("span", {
806
+ key: 0,
807
+ class: X([
808
+ "fm-typo-en-body-sm-400 max-w-[360px]",
809
+ v.value || ((G = B.value) == null ? void 0 : G.status) === "failed" || ((ct = B.value) == null ? void 0 : ct.status) === "rejected" ? "text-fm-color-typo-error" : "text-fm-color-typo-secondary"
810
+ ]),
811
+ "data-testid": "digest-build-status"
812
+ }, O(v.value || rt.value), 3)) : I("", !0),
813
+ (T(u), I("", !0)),
814
+ U(he)
815
+ ]))
816
+ ];
817
+ }),
818
+ _: 1
819
+ }, 8, ["title", "description"]),
820
+ D("div", ys, [
821
+ f.value ? (g(), dt(jt, {
822
+ key: 0,
823
+ "data-testid": "digest-refused",
824
+ title: T(n)("reportV5.digest.refusedTitle"),
825
+ "sub-title": T(n)("reportV5.digest.refusedBody")
826
+ }, null, 8, ["title", "sub-title"])) : (g(), x(C, { key: 1 }, [
827
+ U(fe, {
828
+ class: "mx-24",
829
+ "next-digest": Y.value
830
+ }, null, 8, ["next-digest"]),
831
+ h.value ? (g(), x("p", xs, O(h.value), 1)) : I("", !0),
832
+ d.value && !p.value.length ? (g(), x("div", Ms, [
833
+ U(vt, { size: "xl" })
834
+ ])) : I("", !0),
835
+ !d.value && !h.value && !p.value.length ? (g(), dt(jt, {
836
+ key: 2,
837
+ title: T(n)("reportV5.digest.emptyTitle"),
838
+ "sub-title": T(n)("reportV5.digest.emptyBody")
839
+ }, null, 8, ["title", "sub-title"])) : p.value.length ? (g(), x(C, { key: 3 }, [
840
+ R.value ? (g(), x("section", ks, [
841
+ D("h2", ws, O(T(n)(R.value.read ? "reportV5.digest.latest" : "reportV5.digest.newForYou")), 1),
842
+ U(Ht, {
843
+ card: R.value,
844
+ hero: ""
845
+ }, null, 8, ["card"])
846
+ ])) : I("", !0),
847
+ _.value.length ? (g(), x("section", $s, [
848
+ D("h2", _s, O(T(n)("reportV5.digest.earlier")), 1),
849
+ D("div", Ss, [
850
+ (g(!0), x(C, null, N(_.value, (G) => (g(), dt(Ht, {
851
+ key: G.weekStart,
852
+ card: G
853
+ }, null, 8, ["card"]))), 128))
854
+ ])
855
+ ])) : I("", !0),
856
+ c.value ? (g(), x("div", bs, [
857
+ U(it, {
858
+ "data-testid": "digest-show-more",
859
+ variant: "secondary",
860
+ label: T(n)("reportV5.digest.showMore"),
861
+ disabled: M.value,
862
+ onClick: lt
863
+ }, null, 8, ["label", "disabled"])
864
+ ])) : I("", !0)
865
+ ], 64)) : I("", !0)
866
+ ], 64))
867
+ ])
868
+ ]),
869
+ _: 1
870
+ });
871
+ };
872
+ }
873
+ }), qs = /* @__PURE__ */ bt(Es, [["__scopeId", "data-v-c6c1bc71"]]);
874
+ export {
875
+ qs as default
876
+ };