@mx-cartographer/experiences 7.4.15 → 7.5.0-alpha.bb1

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.
@@ -1,159 +1,162 @@
1
- import { jsxs as f, jsx as e, Fragment as rt } from "react/jsx-runtime";
2
- import u, { useRef as at, useState as it, useEffect as ct } from "react";
3
- import { observer as R } from "mobx-react-lite";
4
- import { CategoryIcon as Se, Text as $, Icon as fe, P as he, H3 as Fe, ChevronRightIcon as lt } from "@mxenabled/mxui";
1
+ import { jsxs as f, jsx as e, Fragment as ct } from "react/jsx-runtime";
2
+ import u, { useRef as lt, useState as dt, useEffect as ut } from "react";
3
+ import { observer as A } from "mobx-react-lite";
4
+ import { CategoryIcon as xe, Text as P, Icon as be, P as he, H3 as Ye, ChevronRightIcon as ht } from "@mxenabled/mxui";
5
5
  import H from "@mui/material/Box";
6
- import b from "@mui/material/Stack";
7
- import _e from "@mui/material/Button";
8
- import { addSeconds as $e } from "date-fns/addSeconds";
9
- import { differenceInCalendarMonths as Re } from "date-fns/differenceInCalendarMonths";
10
- import { useTheme as be } from "@mui/material/styles";
11
- import { LineChart as dt } from "@mui/x-charts";
6
+ import S from "@mui/material/Stack";
7
+ import Te from "@mui/material/Button";
8
+ import { addSeconds as je } from "date-fns/addSeconds";
9
+ import { differenceInCalendarMonths as He } from "date-fns/differenceInCalendarMonths";
10
+ import { useTheme as me } from "@mui/material/styles";
11
+ import { LineChart as gt } from "@mui/x-charts";
12
12
  import { u as ee } from "../useScreenSize-B6JyS_Lj.mjs";
13
- import { u as ut } from "../useDimensions-27p2evRx.mjs";
14
- import ht from "@mui/material/Card";
15
- import gt from "@mui/material/CardContent";
16
- import ke from "@mui/material/Divider";
17
- import Oe from "@mui/material/Grid";
18
- import { u as N, m as U, g as V, b as me, h as xe, d as ve, v as pe, p as ze, f as Ne, a as mt } from "../hooks-ZMp65DFz.mjs";
19
- import { b as Ke } from "../Localization-2MODESHW.mjs";
20
- import { C as Te } from "../CurrencyText-Dr0EZ7bp.mjs";
21
- import { useTheme as pt, Card as Ct, CardContent as yt, Box as ft, Stack as _t } from "@mui/material";
22
- import { f as J, a as F } from "../Dialog-BPTr3qHE.mjs";
23
- import { C as Ae, c as Tt } from "../Category-CevNQ03n.mjs";
24
- import { f as se, a as St } from "../NumberFormatting-DjTD0t3W.mjs";
25
- import { a as bt, g as xt, L as je } from "../TrendsStore-BW9FGQeE.mjs";
26
- import { T as Gn } from "../TrendsStore-BW9FGQeE.mjs";
27
- import { i as vt, c as wt, d as Dt, e as It, f as Et, h as Lt, b as Ye, g as Ue, j as Ge } from "../SpendingData-BuJ03S9d.mjs";
28
- import Mt from "@mui/material/ToggleButton";
29
- import At from "@mui/material/ToggleButtonGroup";
30
- import { DataGridPro as Rt } from "@mui/x-data-grid-pro";
31
- import { H as Be } from "../HeaderCell-DjuifqHJ.mjs";
32
- import { T as G, b as kt } from "../ViewMoreMicroCard-DwR0v_ll.mjs";
33
- import { A as v, W as Xe } from "../WidgetContainer-CoFDmQRE.mjs";
34
- import { a as Ze, T as Qe } from "../TransactionDetails-m5PddMQn.mjs";
35
- import { D as He } from "../Drawer-By9V-B5L.mjs";
36
- import { u as we } from "../useWidgetLoadTimer-hIOioiKx.mjs";
13
+ import { u as mt } from "../useDimensions-27p2evRx.mjs";
14
+ import pt from "@mui/material/Card";
15
+ import Ct from "@mui/material/CardContent";
16
+ import Ne from "@mui/material/Divider";
17
+ import Be from "@mui/material/Grid";
18
+ import { u as k, m as $, g as V, b as pe, h as ve, d as we, v as Ce, p as Ue, f as Oe, a as yt } from "../hooks-ZMp65DFz.mjs";
19
+ import { b as ft } from "../Localization-2MODESHW.mjs";
20
+ import { C as Se } from "../CurrencyText-Dr0EZ7bp.mjs";
21
+ import { useTheme as _t, Card as bt, CardContent as Tt, Box as St, Stack as xt } from "@mui/material";
22
+ import { f as J, a as B } from "../Dialog-BPTr3qHE.mjs";
23
+ import { C as ke, b as Ve, c as vt } from "../Category-CevNQ03n.mjs";
24
+ import { f as se, a as wt } from "../NumberFormatting-DjTD0t3W.mjs";
25
+ import { c as It, a as Fe, g as Lt, L as Xe } from "../TrendsStore-yO7qYv97.mjs";
26
+ import { T as Kn } from "../TrendsStore-yO7qYv97.mjs";
27
+ import { c as Et, i as Dt, d as Mt, e as At, b as Ze, g as qe, f as Pe } from "../SpendingData-DQ1b9uqq.mjs";
28
+ import kt from "@mui/material/ToggleButton";
29
+ import Rt from "@mui/material/ToggleButtonGroup";
30
+ import { parseISO as _e } from "date-fns/parseISO";
31
+ import { isAfter as Ht } from "date-fns/isAfter";
32
+ import { isBefore as Nt } from "date-fns/isBefore";
33
+ import { isEqual as Wt, subMonths as Ot } from "date-fns";
34
+ import { DataGridPro as Gt } from "@mui/x-data-grid-pro";
35
+ import { H as Re } from "../HeaderCell-DjuifqHJ.mjs";
36
+ import { T as G, b as Bt } from "../ViewMoreMicroCard-DwR0v_ll.mjs";
37
+ import { A as I, W as Qe } from "../WidgetContainer-CoFDmQRE.mjs";
38
+ import { a as Je, T as et } from "../TransactionDetails-m5PddMQn.mjs";
39
+ import { D as We } from "../Drawer-By9V-B5L.mjs";
40
+ import { u as Ie } from "../useWidgetLoadTimer-hIOioiKx.mjs";
37
41
  import { L as ge } from "../Loader-DUaFpDGv.mjs";
38
- import { L as We } from "../LineChart-BQRxZF3p.mjs";
39
- import { M as Ht } from "../MiniWidgetContainer-Bg02sF1Y.mjs";
40
- import { subMonths as Nt } from "date-fns";
41
- import { TrendingUp as Wt, TrendingDown as Ot, MultilineChart as Gt, ExpandLess as Bt, ExpandMore as Vt } from "@mxenabled/mx-icons";
42
- import { M as Pt } from "../MicroWidgetContainer-r6mtxRer.mjs";
43
- import Ft from "@mui/material/Collapse";
44
- import $t from "@mui/material/List";
45
- import zt from "@mui/material/ListItem";
46
- import Kt from "@mui/material/ListItemButton";
47
- import jt from "@mui/material/ListItemIcon";
48
- import Yt from "@mui/material/ListItemText";
49
- import qe from "@mui/material/styles/useTheme";
50
- import Ut from "@mui/material/Paper";
51
- import { b as Xt } from "../CategoryUtil-DUM8NuGO.mjs";
52
- import { E as Zt } from "../ExportCsvAction-Cglo8Mca.mjs";
53
- import { u as Qt } from "../useInsightsEnabled-B7dxpDrX.mjs";
54
- import { E as qt } from "../EmptyState-DoxNUae-.mjs";
55
- import { l as Jt } from "../ConnectDrawer-BkvlItWx.mjs";
56
- const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
57
- const { categories: t } = N(), { getCategoryName: n } = U(), s = n(o);
58
- return /* @__PURE__ */ f(b, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
42
+ import { L as Ge } from "../LineChart-BQRxZF3p.mjs";
43
+ import { M as Vt } from "../MiniWidgetContainer-Bg02sF1Y.mjs";
44
+ import { TrendingUp as Ft, TrendingDown as Pt, MultilineChart as $t, ExpandLess as zt, ExpandMore as Kt } from "@mxenabled/mx-icons";
45
+ import { M as Yt } from "../MicroWidgetContainer-r6mtxRer.mjs";
46
+ import jt from "@mui/material/Collapse";
47
+ import Ut from "@mui/material/List";
48
+ import Xt from "@mui/material/ListItem";
49
+ import Zt from "@mui/material/ListItemButton";
50
+ import qt from "@mui/material/ListItemIcon";
51
+ import Qt from "@mui/material/ListItemText";
52
+ import tt from "@mui/material/styles/useTheme";
53
+ import Jt from "@mui/material/Paper";
54
+ import { b as eo } from "../CategoryUtil-DUM8NuGO.mjs";
55
+ import { E as to } from "../ExportCsvAction-Cglo8Mca.mjs";
56
+ import { u as oo } from "../useInsightsEnabled-B7dxpDrX.mjs";
57
+ import { E as no } from "../EmptyState-DoxNUae-.mjs";
58
+ import { l as so } from "../ConnectDrawer-BkvlItWx.mjs";
59
+ const ot = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
60
+ const { categories: n } = k(), { getCategoryName: o } = $(), s = o(t);
61
+ return /* @__PURE__ */ f(S, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
59
62
  /* @__PURE__ */ e(
60
63
  H,
61
64
  {
62
- "aria-label": Ke(t.category_icon_label_aria, s),
65
+ "aria-label": ft(n.category_icon_label_aria, s),
63
66
  mb: 4,
64
67
  role: "img",
65
- children: /* @__PURE__ */ e(Se, { categoryGuid: r })
68
+ children: /* @__PURE__ */ e(xe, { categoryGuid: r })
66
69
  }
67
70
  ),
68
- /* @__PURE__ */ e($, { variant: "Body", children: s })
71
+ /* @__PURE__ */ e(P, { variant: "Body", children: s })
69
72
  ] });
70
- }, eo = ({
71
- categoryGuids: { guid: o, topLevelGuid: r },
72
- hoveredAreaData: t,
73
- cursorPosition: n,
73
+ }, ro = ({
74
+ categoryGuids: { guid: t, topLevelGuid: r },
75
+ hoveredAreaData: n,
76
+ cursorPosition: o,
74
77
  chartContainerRef: s
75
78
  }) => {
76
- const h = be(), g = at(null), [d, c] = it({ x: n.x, y: n.y });
77
- if (ct(() => {
79
+ const h = me(), g = lt(null), [l, c] = dt({ x: o.x, y: o.y });
80
+ if (ut(() => {
78
81
  (() => {
79
- const l = g.current, T = s.current;
80
- if (!l || !T) return;
81
- const a = l.getBoundingClientRect(), p = T.getBoundingClientRect();
82
- let _ = n.x, y = n.y;
83
- _ + a.width * 2 > p.right ? _ = n.x - a.width : _ - a.width < p.left && (_ = n.x), y + a.height * 2 > p.bottom && (y = n.y - a.height), c({ x: _, y });
82
+ const d = g.current, b = s.current;
83
+ if (!d || !b) return;
84
+ const i = d.getBoundingClientRect(), C = b.getBoundingClientRect();
85
+ let p = o.x, _ = o.y;
86
+ p + i.width * 2 > C.right ? p = o.x - i.width : p - i.width < C.left && (p = o.x), _ + i.height * 2 > C.bottom && (_ = o.y - i.height), c({ x: p, y: _ });
84
87
  })();
85
- }, [n, s]), !t) return null;
86
- const m = t.reduce((C, l) => C + l.y, 0);
88
+ }, [o, s]), !n) return null;
89
+ const m = n.reduce((y, d) => y + d.y, 0);
87
90
  return /* @__PURE__ */ e(
88
- ht,
91
+ pt,
89
92
  {
90
93
  ref: g,
91
94
  sx: {
92
95
  position: "absolute",
93
- top: d.y,
94
- left: d.x,
96
+ top: l.y,
97
+ left: l.x,
95
98
  width: 250,
96
99
  pointerEvents: "none"
97
100
  },
98
- children: /* @__PURE__ */ f(gt, { children: [
101
+ children: /* @__PURE__ */ f(Ct, { children: [
99
102
  /* @__PURE__ */ f(H, { alignItems: "center", display: "flex", flexDirection: "column", children: [
100
- /* @__PURE__ */ e(Je, { categoryGuid: o, topLevelCategoryGuid: r }),
101
- /* @__PURE__ */ e($, { variant: "Small", children: `${t.length}-month total` }),
102
- /* @__PURE__ */ e(Te, { amount: m, bold: !0, formatString: "0,0", variant: "body2" })
103
+ /* @__PURE__ */ e(ot, { categoryGuid: t, topLevelCategoryGuid: r }),
104
+ /* @__PURE__ */ e(P, { variant: "Small", children: `${n.length}-month total` }),
105
+ /* @__PURE__ */ e(Se, { amount: m, bold: !0, formatString: "0,0", variant: "body2" })
103
106
  ] }),
104
- /* @__PURE__ */ e(ke, { sx: { my: 16, width: "100%" } }),
105
- /* @__PURE__ */ e(Oe, { container: !0, children: t.map((C, l) => /* @__PURE__ */ f(u.Fragment, { children: [
106
- l > 0 && l % 3 === 0 && /* @__PURE__ */ e(ke, { sx: { my: 16, width: "100%" } }),
107
- /* @__PURE__ */ e(Oe, { item: !0, xs: 4, children: /* @__PURE__ */ f(H, { alignItems: "center", display: "flex", flexDirection: "column", children: [
108
- /* @__PURE__ */ e($, { color: h.palette.text.secondary, variant: "XSmall", children: C.x }),
107
+ /* @__PURE__ */ e(Ne, { sx: { my: 16, width: "100%" } }),
108
+ /* @__PURE__ */ e(Be, { container: !0, children: n.map((y, d) => /* @__PURE__ */ f(u.Fragment, { children: [
109
+ d > 0 && d % 3 === 0 && /* @__PURE__ */ e(Ne, { sx: { my: 16, width: "100%" } }),
110
+ /* @__PURE__ */ e(Be, { item: !0, xs: 4, children: /* @__PURE__ */ f(H, { alignItems: "center", display: "flex", flexDirection: "column", children: [
111
+ /* @__PURE__ */ e(P, { color: h.palette.text.secondary, variant: "XSmall", children: y.x }),
109
112
  /* @__PURE__ */ e(
110
- Te,
113
+ Se,
111
114
  {
112
- amount: C.y,
115
+ amount: y.y,
113
116
  bold: !0,
114
117
  formatString: "0,0",
115
118
  variant: "Body"
116
119
  }
117
120
  )
118
121
  ] }) })
119
- ] }, l)) })
122
+ ] }, d)) })
120
123
  ] })
121
124
  }
122
125
  );
123
- }, to = R(eo), oo = ({
124
- categoryGuids: { guid: o, topLevelGuid: r },
125
- itemData: { dataIndex: t },
126
- series: n,
126
+ }, ao = A(ro), io = ({
127
+ categoryGuids: { guid: t, topLevelGuid: r },
128
+ itemData: { dataIndex: n },
129
+ series: o,
127
130
  xData: s
128
131
  }) => {
129
- const h = pt(), g = n.data[t], d = s[t];
130
- return g === void 0 || !d ? null : /* @__PURE__ */ e(Ct, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ e(yt, { children: /* @__PURE__ */ f(ft, { alignItems: "center", display: "flex", flexDirection: "column", children: [
131
- /* @__PURE__ */ e(Je, { categoryGuid: o, topLevelCategoryGuid: r }),
132
- /* @__PURE__ */ e($, { color: h.palette.text.secondary, variant: "Small", children: J(d, F.MONTH_SHORT_YEAR) }),
133
- /* @__PURE__ */ e(Te, { amount: String(g), bold: !0, formatString: "0,0", variant: "Body" })
132
+ const h = _t(), g = o.data[n], l = s[n];
133
+ return g === void 0 || !l ? null : /* @__PURE__ */ e(bt, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ e(Tt, { children: /* @__PURE__ */ f(St, { alignItems: "center", display: "flex", flexDirection: "column", children: [
134
+ /* @__PURE__ */ e(ot, { categoryGuid: t, topLevelCategoryGuid: r }),
135
+ /* @__PURE__ */ e(P, { color: h.palette.text.secondary, variant: "Small", children: J(l, B.MONTH_SHORT_YEAR) }),
136
+ /* @__PURE__ */ e(Se, { amount: String(g), bold: !0, formatString: "0,0", variant: "Body" })
134
137
  ] }) }) });
135
- }, no = ({
136
- sx: o,
138
+ }, co = ({
139
+ sx: t,
137
140
  categoryGuids: r,
138
- hoveredLegend: t,
139
- legendRef: n,
141
+ hoveredLegend: n,
142
+ legendRef: o,
140
143
  onHoverLegend: s,
141
144
  onClickLegend: h
142
145
  }) => {
143
- const { isMobile: g } = ee(), { getCategoryName: d } = U();
146
+ const { isMobile: g } = ee(), { getCategoryName: l } = $();
144
147
  return /* @__PURE__ */ e(
145
- b,
148
+ S,
146
149
  {
147
150
  direction: "row",
148
151
  flexWrap: "wrap",
149
152
  gap: g ? 2 : 6,
150
153
  justifyContent: "start",
151
- ref: n,
152
- sx: o,
154
+ ref: o,
155
+ sx: t,
153
156
  children: r.map(({ guid: c, top_level_guid: m }) => {
154
- const C = t === c, l = Ae[c], T = Ae[m], a = l ?? T ?? Ae.default, p = a + "33";
157
+ const y = n === c, d = ke[c], b = ke[m], i = d ?? b ?? ke.default, C = i + "33";
155
158
  return /* @__PURE__ */ f(
156
- _e,
159
+ Te,
157
160
  {
158
161
  onClick: () => h(c),
159
162
  onMouseEnter: () => s(c),
@@ -167,7 +170,7 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
167
170
  paddingX: 8,
168
171
  paddingY: 4,
169
172
  borderRadius: 1,
170
- opacity: C ? 1 : 0.7
173
+ opacity: y ? 1 : 0.7
171
174
  },
172
175
  children: [
173
176
  /* @__PURE__ */ e(
@@ -178,11 +181,11 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
178
181
  height: 16,
179
182
  marginRight: g ? 5 : 10,
180
183
  borderRadius: "2px",
181
- backgroundColor: t ? C ? a : p : a
184
+ backgroundColor: n ? y ? i : C : i
182
185
  }
183
186
  }
184
187
  ),
185
- /* @__PURE__ */ e($, { variant: "Body", children: d(c) })
188
+ /* @__PURE__ */ e(P, { variant: "Body", children: l(c) })
186
189
  ]
187
190
  },
188
191
  c
@@ -190,111 +193,111 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
190
193
  })
191
194
  }
192
195
  );
193
- }, so = ({
194
- onHoverArea: o,
196
+ }, lo = ({
197
+ onHoverArea: t,
195
198
  onHoverPoint: r,
196
- onHoverLegend: t,
197
- onClickLegend: n,
199
+ onHoverLegend: n,
200
+ onClickLegend: o,
198
201
  stackedDatasets: s,
199
202
  unstackedDatasets: h = [],
200
203
  availableHeight: g = 0,
201
- minimumHeight: d = 350
204
+ minimumHeight: l = 350
202
205
  }) => {
203
- const c = be(), { isMobile: m } = ee(), [C, { height: l }] = ut(), T = u.useRef(null), [a, p] = u.useState(0);
206
+ const c = me(), { isMobile: m } = ee(), [y, { height: d }] = mt(), b = u.useRef(null), [i, C] = u.useState(0);
204
207
  u.useEffect(() => {
205
- const i = Math.max(g - l, d);
206
- p(i);
207
- }, [g, l]);
208
- const [_, y] = u.useState(null), [E, x] = u.useState({
208
+ const a = Math.max(g - d, l);
209
+ C(a);
210
+ }, [g, d]);
211
+ const [p, _] = u.useState(null), [L, v] = u.useState({
209
212
  hoveredSeriesId: null,
210
213
  hoveredAreaData: null,
211
214
  isAreaHovered: !1,
212
215
  cursorPos: { x: 0, y: 0 }
213
- }), { hoveredSeriesId: I, hoveredAreaData: W, isAreaHovered: L, cursorPos: O } = E, A = L && I && W, M = !A, P = [...s, ...h], z = P[0]?.dataset.length ?? 0, X = P.flatMap((i) => i.dataset.map((S) => S.x)), Ce = P.flatMap((i) => i.dataset.map((S) => S.y)), te = s[0]?.dataset?.map(
214
- (i, S) => s.reduce((D, Y) => D + Y.dataset[S]?.y || 0, 0)
216
+ }), { hoveredSeriesId: D, hoveredAreaData: N, isAreaHovered: x, cursorPos: M } = L, z = x && D && N, W = !z, F = [...s, ...h], K = F[0]?.dataset.length ?? 0, X = F.flatMap((a) => a.dataset.map((T) => T.x)), ye = F.flatMap((a) => a.dataset.map((T) => T.y)), te = s[0]?.dataset?.map(
217
+ (a, T) => s.reduce((E, U) => E + U.dataset[T]?.y || 0, 0)
215
218
  ) ?? [0], re = Math.max(...te), Z = Math.max(
216
- ...h.flatMap((i) => i.dataset.map((S) => S.y))
217
- ), ce = Math.floor(Math.min(...Ce) / 100) * 100, oe = Math.ceil(Math.max(re, Z) / 100) * 100, K = s.map((i, S) => ({
218
- id: `stacked-${S}`,
219
- guid: i.category_guid,
220
- top_level_guid: i.top_level_category_guid,
219
+ ...h.flatMap((a) => a.dataset.map((T) => T.y))
220
+ ), ce = Math.floor(Math.min(...ye) / 100) * 100, oe = Math.ceil(Math.max(re, Z) / 100) * 100, Y = s.map((a, T) => ({
221
+ id: `stacked-${T}`,
222
+ guid: a.category_guid,
223
+ top_level_guid: a.top_level_category_guid,
221
224
  area: !0,
222
- color: s[S].category_color ?? c.palette.primary.main,
223
- data: i.dataset.map((D) => D.y),
224
- label: s[S].category_name,
225
+ color: s[T].category_color ?? c.palette.primary.main,
226
+ data: a.dataset.map((E) => E.y),
227
+ label: s[T].category_name,
225
228
  stack: "total",
226
229
  type: "line",
227
230
  highlightScope: { highlight: "item" },
228
- valueFormatter: (D) => se(D, "0,0")
229
- })), ae = h.map((i, S) => ({
230
- id: `unstacked-${S}`,
231
- guid: i.category_guid,
232
- top_level_guid: i.top_level_category_guid,
231
+ valueFormatter: (E) => se(E, "0,0")
232
+ })), ae = h.map((a, T) => ({
233
+ id: `unstacked-${T}`,
234
+ guid: a.category_guid,
235
+ top_level_guid: a.top_level_category_guid,
233
236
  area: !1,
234
- color: i.category_color,
235
- data: i.dataset.map((D) => D.y),
236
- label: i.category_name,
237
+ color: a.category_color,
238
+ data: a.dataset.map((E) => E.y),
239
+ label: a.category_name,
237
240
  type: "line",
238
- valueFormatter: (D) => se(D, "0,0")
239
- })), ne = [...K, ...ae], ie = [
240
- ...K.map(({ guid: i, top_level_guid: S }) => ({
241
- guid: i,
242
- top_level_guid: S
241
+ valueFormatter: (E) => se(E, "0,0")
242
+ })), ne = [...Y, ...ae], ie = [
243
+ ...Y.map(({ guid: a, top_level_guid: T }) => ({
244
+ guid: a,
245
+ top_level_guid: T
243
246
  })),
244
- ...ae.map(({ guid: i, top_level_guid: S }) => ({
245
- guid: i,
246
- top_level_guid: S
247
+ ...ae.map(({ guid: a, top_level_guid: T }) => ({
248
+ guid: a,
249
+ top_level_guid: T
247
250
  }))
248
- ], Q = (i) => {
249
- const D = i.startsWith("stacked-") ? s[parseInt(i.split("-")[1])] : h[parseInt(i.split("-")[1])];
251
+ ], q = (a) => {
252
+ const E = a.startsWith("stacked-") ? s[parseInt(a.split("-")[1])] : h[parseInt(a.split("-")[1])];
250
253
  return {
251
- guid: D?.category_guid,
252
- topLevelGuid: D?.top_level_category_guid
254
+ guid: E?.category_guid,
255
+ topLevelGuid: E?.top_level_category_guid
253
256
  };
254
- }, w = (i) => {
255
- y(i), t?.(i ?? "");
256
- }, B = (i) => {
257
- n?.(i ?? "");
257
+ }, w = (a) => {
258
+ _(a), n?.(a ?? "");
259
+ }, O = (a) => {
260
+ o?.(a ?? "");
258
261
  }, j = () => {
259
- const i = Q(String(I)).guid;
260
- i && n?.(i);
261
- }, le = (i) => {
262
- const S = String(i?.seriesId), D = Q(S).guid, Y = ne.find((de) => de.id === S), Ie = Y && i?.dataIndex !== void 0, Ee = Y && i?.dataIndex === void 0;
263
- if (Ie)
264
- x({
265
- hoveredSeriesId: S,
262
+ const a = q(String(D)).guid;
263
+ a && o?.(a);
264
+ }, le = (a) => {
265
+ const T = String(a?.seriesId), E = q(T).guid, U = ne.find((de) => de.id === T), Ee = U && a?.dataIndex !== void 0, De = U && a?.dataIndex === void 0;
266
+ if (Ee)
267
+ v({
268
+ hoveredSeriesId: T,
266
269
  hoveredAreaData: null,
267
270
  isAreaHovered: !1,
268
- cursorPos: O
269
- }), r?.(D);
270
- else if (Ee) {
271
- const de = Y?.data.map((Le, Me) => ({
272
- x: X[Me],
273
- y: Le
271
+ cursorPos: M
272
+ }), r?.(E);
273
+ else if (De) {
274
+ const de = U?.data.map((Me, Ae) => ({
275
+ x: X[Ae],
276
+ y: Me
274
277
  })) ?? [];
275
- x({
276
- hoveredSeriesId: S,
278
+ v({
279
+ hoveredSeriesId: T,
277
280
  hoveredAreaData: de,
278
281
  isAreaHovered: !0,
279
- cursorPos: O
280
- }), o?.(D);
282
+ cursorPos: M
283
+ }), t?.(E);
281
284
  } else
282
- x({
285
+ v({
283
286
  hoveredSeriesId: null,
284
287
  hoveredAreaData: null,
285
288
  isAreaHovered: !1,
286
- cursorPos: O
289
+ cursorPos: M
287
290
  });
288
- }, ye = (i) => {
289
- const S = i.currentTarget.getBoundingClientRect();
290
- x((D) => ({
291
- ...D,
291
+ }, fe = (a) => {
292
+ const T = a.currentTarget.getBoundingClientRect();
293
+ v((E) => ({
294
+ ...E,
292
295
  cursorPos: {
293
- x: i.clientX - S.left,
294
- y: i.clientY - S.top
296
+ x: a.clientX - T.left,
297
+ y: a.clientY - T.top
295
298
  }
296
299
  }));
297
- }, De = {
300
+ }, Le = {
298
301
  p: 4,
299
302
  "& .MuiBarLabel-root": {
300
303
  fontSize: 10,
@@ -310,18 +313,18 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
310
313
  '& [class*="MuiLineElement-series-unstacked-"]': {
311
314
  strokeWidth: 3
312
315
  },
313
- ..._ && K.reduce((i, S, D) => {
314
- const Y = `.MuiAreaElement-series-stacked-${D}`;
315
- return i[Y] = {
316
- opacity: K[D].guid === _ ? 0.9 : 0.2
317
- }, i;
316
+ ...p && Y.reduce((a, T, E) => {
317
+ const U = `.MuiAreaElement-series-stacked-${E}`;
318
+ return a[U] = {
319
+ opacity: Y[E].guid === p ? 0.9 : 0.2
320
+ }, a;
318
321
  }, {})
319
322
  };
320
323
  return /* @__PURE__ */ e(
321
324
  H,
322
325
  {
323
- onMouseMove: ye,
324
- ref: T,
326
+ onMouseMove: fe,
327
+ ref: b,
325
328
  sx: {
326
329
  position: "relative",
327
330
  touchAction: "pan-y",
@@ -334,16 +337,16 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
334
337
  }
335
338
  },
336
339
  children: /* @__PURE__ */ f(
337
- b,
340
+ S,
338
341
  {
339
342
  direction: { xs: "column", md: "column" },
340
343
  spacing: { xs: 0, md: 4 },
341
344
  sx: { width: "100%", position: "relative" },
342
345
  children: [
343
346
  /* @__PURE__ */ e(
344
- dt,
347
+ gt,
345
348
  {
346
- height: a,
349
+ height: i,
347
350
  margin: { bottom: 50 },
348
351
  onAreaClick: j,
349
352
  onHighlightChange: le,
@@ -355,25 +358,25 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
355
358
  }
356
359
  },
357
360
  slots: {
358
- itemContent: (i) => M && I ? /* @__PURE__ */ e(
359
- oo,
361
+ itemContent: (a) => W && D ? /* @__PURE__ */ e(
362
+ io,
360
363
  {
361
- categoryGuids: Q(I),
364
+ categoryGuids: q(D),
362
365
  xData: X,
363
- ...i
366
+ ...a
364
367
  }
365
368
  ) : null
366
369
  },
367
- sx: De,
370
+ sx: Le,
368
371
  tooltip: {
369
- trigger: M ? "item" : "none"
372
+ trigger: W ? "item" : "none"
370
373
  },
371
374
  xAxis: [
372
375
  {
373
376
  data: X,
374
377
  scaleType: "time",
375
- valueFormatter: (i) => J(i, F.MONTH_SHORT_YEAR),
376
- tickNumber: z
378
+ valueFormatter: (a) => J(a, B.MONTH_SHORT_YEAR),
379
+ tickNumber: K
377
380
  // How many ticks to show on the x-axis
378
381
  }
379
382
  ],
@@ -386,25 +389,25 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
386
389
  }
387
390
  ),
388
391
  /* @__PURE__ */ e(
389
- no,
392
+ co,
390
393
  {
391
394
  categoryGuids: ie,
392
- hoveredLegend: _,
393
- legendRef: C,
394
- onClickLegend: B,
395
+ hoveredLegend: p,
396
+ legendRef: y,
397
+ onClickLegend: O,
395
398
  onHoverLegend: w,
396
399
  sx: { px: m ? 0 : 24 }
397
400
  }
398
401
  ),
399
- A && /* @__PURE__ */ e(
400
- to,
402
+ z && /* @__PURE__ */ e(
403
+ ao,
401
404
  {
402
- categoryGuids: Q(I),
403
- chartContainerRef: T,
404
- cursorPosition: O,
405
- hoveredAreaData: W.map((i) => ({
406
- ...i,
407
- x: J(i.x, F.MONTH_SHORT_YEAR)
405
+ categoryGuids: q(D),
406
+ chartContainerRef: b,
407
+ cursorPosition: M,
408
+ hoveredAreaData: N.map((a) => ({
409
+ ...a,
410
+ x: J(a.x, B.MONTH_SHORT_YEAR)
408
411
  }))
409
412
  }
410
413
  )
@@ -413,29 +416,32 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
413
416
  )
414
417
  }
415
418
  );
416
- }, et = ({ selectedTab: o, onTabChange: r }) => /* @__PURE__ */ e(
417
- At,
419
+ }, nt = ({ selectedTab: t, onTabChange: r }) => /* @__PURE__ */ e(
420
+ Rt,
418
421
  {
419
422
  exclusive: !0,
420
423
  onChange: r,
421
424
  orientation: "horizontal",
422
- value: o,
423
- children: ["Chart", "Table"].map((t) => /* @__PURE__ */ e(Mt, { color: "primary", sx: { width: 56 }, value: t, children: t === "Chart" ? /* @__PURE__ */ e(fe, { name: "table_chart_view" }) : /* @__PURE__ */ e(fe, { name: "format_list_bulleted" }) }, t))
425
+ value: t,
426
+ children: ["Chart", "Table"].map((n) => /* @__PURE__ */ e(kt, { color: "primary", sx: { width: 56 }, value: n, children: n === "Chart" ? /* @__PURE__ */ e(be, { name: "table_chart_view" }) : /* @__PURE__ */ e(be, { name: "format_list_bulleted" }) }, n))
424
427
  }
425
- ), tt = ({ selectedDateRange: o, selectedCategoryGuid: r }) => {
426
- const { trends: t } = N(), { isMobile: n, isDesktop: s } = ee(), { getCategoryName: h } = U(), g = u.useMemo(() => {
427
- const d = J(
428
- o.start,
429
- n ? F.MONTH_SHORT_YEAR : F.MONTH_YEAR
428
+ ), st = ({ selectedDateRange: t, selectedCategoryGuid: r }) => {
429
+ const { trends: n } = k(), { isMobile: o, isDesktop: s } = ee(), { getCategoryName: h } = $(), g = u.useMemo(() => {
430
+ const l = t.start.getFullYear() === t.end.getFullYear() ? J(
431
+ t.start,
432
+ o ? B.MONTH_SHORT : B.MONTH_LONG
433
+ ) : J(
434
+ t.start,
435
+ o ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
430
436
  ), c = J(
431
- o.end,
432
- n ? F.MONTH_SHORT_YEAR : F.MONTH_YEAR
437
+ t.end,
438
+ o ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
433
439
  );
434
- return `${d} - ${c}`;
435
- }, [o, n]);
440
+ return `${l} - ${c}`;
441
+ }, [t, o]);
436
442
  return /* @__PURE__ */ f(H, { sx: { mr: 10, minWidth: "60%" }, children: [
437
443
  /* @__PURE__ */ e(
438
- $,
444
+ P,
439
445
  {
440
446
  display: "block",
441
447
  fontWeight: 700,
@@ -445,274 +451,309 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
445
451
  textOverflow: "unset"
446
452
  },
447
453
  variant: s ? "H3" : "Body",
448
- children: h(r) || t.sub_title
454
+ children: h(r) || n.sub_title
449
455
  }
450
456
  ),
451
- /* @__PURE__ */ e($, { variant: s ? "Body" : "Small", children: g })
457
+ /* @__PURE__ */ e(P, { variant: s ? "subtitle1" : "body2", children: g })
452
458
  ] });
453
- }, ro = (o) => {
454
- const r = o.row[o.field];
455
- return /* @__PURE__ */ e(b, { alignItems: "flex-end", tabIndex: o.tabIndex, children: /* @__PURE__ */ e(Te, { amount: r, variant: "Small" }) });
456
- }, ao = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
457
- const { getCategoryName: t } = U(), { categories: n } = N(), s = n.default_categories[o]?.replace(/&amp;/g, "&") ?? t(o);
458
- return /* @__PURE__ */ f(b, { alignItems: "center", direction: "row", justifyContent: "center", children: [
459
- /* @__PURE__ */ e(
460
- H,
461
- {
462
- "aria-label": Ke(n.category_icon_label_aria, s),
463
- role: "img",
464
- children: /* @__PURE__ */ e(Se, { categoryGuid: r })
465
- }
466
- ),
467
- /* @__PURE__ */ e($, { sx: { ml: 12, pb: 6 }, variant: "Small", children: s })
459
+ }, $e = (t) => {
460
+ const r = t.row.category_guid, n = t.row.top_level_category_guid, o = r === Ve.INCOME || n === Ve.INCOME, s = t.row[t.field];
461
+ return /* @__PURE__ */ e(S, { alignItems: "flex-end", direction: "row", tabIndex: t.tabIndex, children: /* @__PURE__ */ e(
462
+ Se,
463
+ {
464
+ amount: s,
465
+ isIncome: o,
466
+ sx: { fontWeight: o ? 600 : 500 },
467
+ symbol: o ? "+" : void 0,
468
+ variant: "body2"
469
+ }
470
+ ) });
471
+ }, uo = ({ categoryGuid: t, topLevelCategoryGuid: r }) => {
472
+ const { getCategoryName: n } = $(), { categories: o } = k(), s = o.default_categories[t]?.replace(/&amp;/g, "&") ?? n(t);
473
+ return /* @__PURE__ */ f(S, { alignItems: "center", direction: "row", justifyContent: "center", children: [
474
+ /* @__PURE__ */ e(H, { "aria-hidden": !0, children: /* @__PURE__ */ e(xe, { categoryGuid: r, variant: "twotone" }) }),
475
+ /* @__PURE__ */ e(P, { sx: { ml: 12, pb: 6 }, variant: "body2", children: s })
468
476
  ] });
469
- }, io = (o) => /* @__PURE__ */ e(b, { alignItems: "center", direction: "row", height: "100%", width: "100%", children: /* @__PURE__ */ e(
470
- ao,
477
+ }, ho = (t) => /* @__PURE__ */ e(S, { alignItems: "center", direction: "row", height: "100%", width: "100%", children: /* @__PURE__ */ e(
478
+ uo,
471
479
  {
472
- categoryGuid: o.row.category,
473
- topLevelCategoryGuid: o.row.top_level_category_guid
480
+ categoryGuid: t.row.category,
481
+ topLevelCategoryGuid: t.row.top_level_category_guid
474
482
  }
475
- ) }), co = (o, r) => {
476
- const t = [], n = new Date(o);
477
- for (; n <= r; ) {
478
- const s = J(n, F.MONTH);
479
- t.push(s), n.setMonth(n.getMonth() + 1);
483
+ ) }), go = (t, r) => {
484
+ const n = [], o = new Date(t);
485
+ for (; o <= r; ) {
486
+ const s = J(o, B.MONTH_LONG);
487
+ n.push(s), o.setMonth(o.getMonth() + 1);
480
488
  }
481
- return t;
482
- }, ot = ({
483
- monthlyCategoryTotals: o,
484
- selectedDateRange: r,
485
- selectedCategory: t,
489
+ return n;
490
+ }, rt = ({
491
+ selectedDateRange: t,
492
+ selectedCategory: r,
486
493
  onClickRow: n,
487
- height: s = "100dvh",
488
- sx: h = {}
494
+ height: o = "100%",
495
+ sx: s = {}
489
496
  }) => {
490
- const { onEvent: g } = V(), d = J(/* @__PURE__ */ new Date(), F.MONTH_SHORT), [c, m] = u.useState([
491
- { field: d, sort: "desc" }
492
- ]), C = u.useMemo(() => co(r.start, r.end), [r]), l = [
497
+ const h = me(), { onEvent: g } = V(), { transactions: l, spending: c } = k(), { trendsCategories: m } = $(), y = u.useMemo(() => go(t.start, t.end), [t]), d = h.palette.mode === "light", b = [
493
498
  {
494
499
  field: "category",
495
500
  flex: 1,
496
- headerName: "Category",
501
+ headerClassName: "trends-table-header",
502
+ headerName: l.category_title,
497
503
  minWidth: 175,
498
- renderHeader: Be,
499
- renderCell: io,
504
+ renderHeader: Re,
505
+ renderCell: ho,
500
506
  sortable: !0,
507
+ sortComparator: It,
501
508
  type: "string"
502
509
  },
503
- ...C.map(
504
- (a) => ({
505
- field: a,
510
+ ...y.map(
511
+ (p) => ({
512
+ field: p,
506
513
  flex: 1,
507
- headerName: a,
514
+ headerClassName: "trends-table-header",
515
+ headerName: p,
508
516
  minWidth: 100,
509
- renderHeader: Be,
510
- renderCell: ro,
517
+ renderHeader: Re,
518
+ renderCell: $e,
511
519
  align: "right",
512
520
  headerAlign: "right",
513
521
  sortable: !0,
514
522
  hideSortIcons: !1,
515
523
  type: "number",
516
- sortComparator: bt
524
+ sortComparator: Fe
517
525
  })
518
- )
519
- ], T = u.useMemo(() => {
520
- const a = o.filter(
521
- (y) => !vt(y) && !wt(y)
522
- ), _ = (t ? a.filter(
523
- (y) => y.category_guid === t || y.top_level_category_guid === t
524
- ) : a).reduce(
525
- (y, E) => {
526
- const { category_guid: x, top_level_category_guid: I, month: W, total: L, year: O } = E, A = t ? x : I;
527
- y[A] || (y[A] = {
528
- id: A,
529
- category: A,
530
- category_guid: x,
531
- top_level_category_guid: I
532
- });
533
- const M = J(new Date(O, W - 1), F.MONTH_SHORT);
534
- return y[A][M] || (y[A][M] = 0), y[A][M] = y[A][M] + Math.abs(L), y;
535
- },
536
- {}
537
- );
538
- return Object.values(_);
539
- }, [o, t]);
540
- return /* @__PURE__ */ e(H, { sx: { height: s, width: "100%", overflowX: "auto", boxShadow: "none", ...h }, children: /* @__PURE__ */ e(
541
- Rt,
526
+ ),
527
+ {
528
+ field: "total",
529
+ flex: 1,
530
+ headerClassName: "trends-table-header",
531
+ headerName: `${c.total[0].toUpperCase()}${c.total.slice(1)}`,
532
+ minWidth: 100,
533
+ renderHeader: Re,
534
+ renderCell: $e,
535
+ align: "right",
536
+ headerAlign: "right",
537
+ sortable: !0,
538
+ hideSortIcons: !1,
539
+ type: "number",
540
+ sortComparator: Fe
541
+ }
542
+ ], i = u.useMemo(() => {
543
+ if (r)
544
+ return m.find((p) => p.guid === r);
545
+ }, [r, m]), C = u.useMemo(() => {
546
+ let p = m;
547
+ return i && (p = i.subCategories.filter(
548
+ (_) => _.monthlyAmounts.some((L) => L.amount > 0)
549
+ )), p.map((_) => {
550
+ let L = _.totalMonthlyAmounts;
551
+ i && (L = _.monthlyAmounts);
552
+ const v = L.filter(
553
+ (x) => (Ht(_e(x.isoDate), t.start) || Wt(_e(x.isoDate), t.start)) && Nt(_e(x.isoDate), t.end)
554
+ ), D = v.reduce(
555
+ (x, M) => {
556
+ const z = J(_e(M.isoDate), B.MONTH_LONG);
557
+ return x[z] = M.amount, x;
558
+ },
559
+ {}
560
+ ), N = v.reduce(
561
+ (x, M) => x + M.amount,
562
+ 0
563
+ );
564
+ return {
565
+ id: _.guid,
566
+ category: _.guid,
567
+ top_level_category_guid: _.parent_guid || _.guid,
568
+ total: N,
569
+ ...D
570
+ };
571
+ });
572
+ }, [m]);
573
+ return /* @__PURE__ */ e(H, { sx: { height: o, width: "100%", overflowX: "auto", boxShadow: "none", ...s }, children: /* @__PURE__ */ e(
574
+ Gt,
542
575
  {
543
- columns: l,
576
+ columns: b,
544
577
  disableColumnFilter: !0,
545
578
  disableColumnMenu: !0,
546
579
  hideFooter: !0,
547
- initialState: { sorting: { sortModel: c } },
548
- onRowClick: (a) => {
549
- n?.(a.row.category), g(v.TRENDS_CLICK_LIST_ITEM, {
580
+ initialState: { sorting: { sortModel: [{ field: "category", sort: "asc" }] } },
581
+ onRowClick: (p) => {
582
+ i || n?.(p.row.category), g(I.TRENDS_CLICK_LIST_ITEM, {
550
583
  ...G,
551
- listItem: Tt[a.row.category]
584
+ listItem: vt[p.row.category]
552
585
  });
553
586
  },
554
- onSortModelChange: (a) => {
555
- m(a), g(v.TRENDS_CLICK_TABLE_SORT, G);
556
- },
557
- rows: T,
587
+ rowHeight: 64,
588
+ rows: C,
558
589
  slotProps: { baseIconButton: { color: "secondary", sx: { ml: 8 } } },
559
- sortModel: c,
560
- sortingOrder: ["asc", "desc"]
590
+ sortingOrder: ["asc", "desc"],
591
+ sx: {
592
+ borderColor: "divider",
593
+ borderWidth: 1,
594
+ borderStyle: "solid",
595
+ borderRadius: 2,
596
+ "& .MuiDataGrid-columnHeaders": {
597
+ borderBottom: "none"
598
+ },
599
+ "& .trends-table-header": {
600
+ bgcolor: d ? "neutral.50" : "background.paper"
601
+ }
602
+ }
561
603
  }
562
604
  ) });
563
- }, lo = {
605
+ }, mo = {
564
606
  title: "Transaction List"
565
- }, uo = ({
566
- categoryGuid: o,
607
+ }, po = ({
608
+ categoryGuid: t,
567
609
  dateRange: r,
568
- isOpen: t,
569
- onClose: n
610
+ isOpen: n,
611
+ onClose: o
570
612
  }) => {
571
- const { onEvent: s } = V(), { selectedAccountGuids: h } = me(), { common: g } = N(), { setFilter: d, sortedTransactions: c } = xe(), [m, C] = u.useState(""), l = u.useMemo(
572
- () => c.find((a) => a.guid === m),
613
+ const { onEvent: s } = V(), { selectedAccountGuids: h } = pe(), { common: g } = k(), { setFilter: l, sortedTransactions: c } = ve(), [m, y] = u.useState(""), d = u.useMemo(
614
+ () => c.find((i) => i.guid === m),
573
615
  [m, c]
574
616
  );
575
617
  u.useEffect(() => {
576
- d({
618
+ l({
577
619
  accounts: h,
578
620
  dateRange: r,
579
- custom: (a) => o === "" || o === a.category_guid || o === a.top_level_category_guid,
580
- showSplits: !!o
621
+ custom: (i) => t === "" || t === i.category_guid || t === i.top_level_category_guid,
622
+ showSplits: !!t
581
623
  });
582
- }, [h, o, r]), u.useEffect(() => s(v.TRENDS_VIEW_TRANSACTIONS), []);
583
- const T = () => {
584
- C(""), n();
624
+ }, [h, t, r]), u.useEffect(() => s(I.TRENDS_VIEW_TRANSACTIONS), []);
625
+ const b = () => {
626
+ y(""), o();
585
627
  };
586
628
  return /* @__PURE__ */ f(
587
- He,
629
+ We,
588
630
  {
589
631
  ariaLabelClose: g.close_aria,
590
- isOpen: t,
591
- onClose: T,
592
- title: lo.title,
632
+ isOpen: n,
633
+ onClose: b,
634
+ title: mo.title,
593
635
  children: [
594
- l && /* @__PURE__ */ e(Ze, { transaction: l }),
595
- !l && /* @__PURE__ */ e(Qe, { onClick: C })
636
+ d && /* @__PURE__ */ e(Je, { transaction: d }),
637
+ !d && /* @__PURE__ */ e(et, { onClick: y })
596
638
  ]
597
639
  }
598
640
  );
599
- }, ho = R(uo), go = ({ onBackClick: o, sx: r }) => {
600
- const { onEvent: t } = V(), { isDesktop: n, isTablet: s, isMobile: h } = ee(), { visibleAccounts: g } = ve(), { loadMonthlyCategoryTotals: d, monthlyCategoryTotals: c, getCategoryName: m } = U(), { sortedTransactions: C } = xe(), { selectedDateRange: l, setSelectedDateRange: T } = pe(), { isCopyLoaded: a, isInitialized: p, selectedAccounts: _, setSelectedAccounts: y } = me(), { trends: E } = N(), [x, I] = u.useState(!1), [W, L] = u.useState(!1), [O, A] = u.useState("Chart"), [M, P] = u.useState(""), [z, X] = u.useState(window.innerHeight), te = z - (h ? 315 : 345);
601
- we({
641
+ }, Co = A(po), yo = ({ onBackClick: t, sx: r }) => {
642
+ const { onEvent: n } = V(), { isDesktop: o, isTablet: s, isMobile: h } = ee(), { visibleAccounts: g } = we(), { loadMonthlyCategoryTotals: l, monthlyCategoryTotals: c, getCategoryName: m } = $(), { sortedTransactions: y } = ve(), { selectedDateRange: d, setSelectedDateRange: b } = Ce(), { isCopyLoaded: i, isInitialized: C, selectedAccounts: p, setSelectedAccounts: _ } = pe(), { trends: L } = k(), [v, D] = u.useState(!1), [N, x] = u.useState(!1), [M, z] = u.useState("Chart"), [W, F] = u.useState(""), [K, X] = u.useState(window.innerHeight), te = K - (h ? 315 : 345);
643
+ Ie({
602
644
  widgetName: "TrendsFullWidget",
603
- isLoaded: x
645
+ isLoaded: v
604
646
  }), u.useEffect(() => {
605
647
  const w = () => X(window.innerHeight);
606
648
  return window.addEventListener("resize", w), () => window.removeEventListener("resize", w);
607
649
  }, []), u.useEffect(() => {
608
- y(g);
650
+ _(g);
609
651
  }, [g]), u.useEffect(() => {
610
- p && d(
611
- _,
612
- l.start,
613
- l.end
652
+ C && l(
653
+ p,
654
+ d.start,
655
+ d.end
614
656
  ).finally(() => {
615
- I(!0);
657
+ D(!0);
616
658
  });
617
- }, [p, _, l]);
659
+ }, [C, p, d]);
618
660
  const re = u.useMemo(() => {
619
- if (!x) return { stackedDatasets: [], unstackedDatasets: [] };
620
- const w = xt(
661
+ if (!v) return { stackedDatasets: [], unstackedDatasets: [] };
662
+ const w = Lt(
621
663
  c,
622
- l.start,
623
- l.end
624
- ), B = M.length ? w.filter(
625
- (j) => j.top_level_category_guid === M || j.category_guid === M
626
- ) : Dt(w);
664
+ d.start,
665
+ d.end
666
+ ), O = W.length ? w.filter(
667
+ (j) => j.top_level_category_guid === W || j.category_guid === W
668
+ ) : Et(w);
627
669
  return {
628
- stackedDatasets: B.filter(It),
629
- unstackedDatasets: B.filter(Et)
670
+ stackedDatasets: O.filter(Dt),
671
+ unstackedDatasets: O.filter(Mt)
630
672
  };
631
- }, [c, M, l]), Z = (w, B) => {
632
- A(B ?? O), t(v.TRENDS_CLICK_TOGGLE_VIEW);
673
+ }, [c, W, d]), Z = (w, O) => {
674
+ z(O ?? M), n(I.TRENDS_CLICK_TOGGLE_VIEW);
633
675
  }, ce = (w) => {
634
- const B = $e(w?.[0], 1), j = w?.[1], le = Re(j, B);
635
- T({ start: B, end: j }), t(v.TRENDS_CLICK_TIME_WINDOW, {
676
+ const O = je(w?.[0], 1), j = w?.[1], le = He(j, O);
677
+ b({ start: O, end: j }), n(I.TRENDS_CLICK_TIME_WINDOW, {
636
678
  time_period: le + "M"
637
679
  });
638
680
  }, oe = () => {
639
- t(v.TRENDS_CLICK_FILTER);
640
- }, K = (w) => {
641
- P(w);
681
+ n(I.TRENDS_CLICK_FILTER);
682
+ }, Y = (w) => {
683
+ F(w);
642
684
  }, ae = (w) => {
643
- P(w), t(v.TRENDS_CLICK_LEGEND, { category: m(w) });
685
+ F(w), n(I.TRENDS_CLICK_LEGEND, { category: m(w) });
644
686
  }, ne = (w) => {
645
- t(v.TRENDS_HOVER_LEGEND, { category: m(w) });
687
+ n(I.TRENDS_HOVER_LEGEND, { category: m(w) });
646
688
  }, ie = (w) => {
647
- t(v.TRENDS_HOVER_AREA, { category: w });
648
- }, Q = (w) => {
649
- t(v.TRENDS_HOVER_POINT, { category: w });
689
+ n(I.TRENDS_HOVER_AREA, { category: w });
690
+ }, q = (w) => {
691
+ n(I.TRENDS_HOVER_POINT, { category: w });
650
692
  };
651
- return !a || !p || !x ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ f(
652
- Xe,
693
+ return !i || !C || !v ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ f(
694
+ Qe,
653
695
  {
654
696
  accountOptions: g,
655
697
  calendarActions: { onRangeChanged: ce },
656
- dateRange: l,
698
+ dateRange: d,
657
699
  dateRangeVariant: "timeframebuttons",
658
700
  onAccountsFilterClick: oe,
659
- onBackClick: o,
701
+ onBackClick: t,
660
702
  sx: r,
661
- title: E.title,
703
+ title: L.title,
662
704
  children: [
663
705
  /* @__PURE__ */ f(
664
- b,
706
+ S,
665
707
  {
666
708
  sx: {
667
709
  // eslint-disable-next-line no-nested-ternary
668
- px: n ? 48 : s ? 24 : 12
710
+ px: o ? 48 : s ? 24 : 12
669
711
  },
670
712
  children: [
671
713
  /* @__PURE__ */ f(
672
- b,
714
+ S,
673
715
  {
674
716
  flexDirection: "row",
675
717
  justifyContent: "space-between",
676
718
  sx: { pb: h ? 12 : 24, pt: h ? 24 : 48 },
677
719
  children: [
678
720
  /* @__PURE__ */ e(
679
- tt,
721
+ st,
680
722
  {
681
- selectedCategoryGuid: M,
682
- selectedDateRange: l
723
+ selectedCategoryGuid: W,
724
+ selectedDateRange: d
683
725
  }
684
726
  ),
685
- /* @__PURE__ */ e(et, { onTabChange: Z, selectedTab: O })
727
+ /* @__PURE__ */ e(nt, { onTabChange: Z, selectedTab: M })
686
728
  ]
687
729
  }
688
730
  ),
689
- /* @__PURE__ */ f(b, { alignItems: "center", flexDirection: "row", width: "100%", children: [
690
- /* @__PURE__ */ e(H, { flexGrow: 1, children: M && /* @__PURE__ */ f(_e, { onClick: () => P(""), sx: { p: 0, pr: 5 }, children: [
691
- /* @__PURE__ */ e(fe, { name: "arrow_back" }),
692
- E.all_categories
731
+ /* @__PURE__ */ f(S, { alignItems: "center", flexDirection: "row", width: "100%", children: [
732
+ /* @__PURE__ */ e(H, { flexGrow: 1, children: W && /* @__PURE__ */ f(Te, { onClick: () => F(""), sx: { p: 0, pr: 5 }, children: [
733
+ /* @__PURE__ */ e(be, { name: "arrow_back" }),
734
+ L.all_categories
693
735
  ] }) }),
694
- /* @__PURE__ */ e(_e, { onClick: () => L(!0), sx: { px: 5 }, children: `${E.view_transactions} (${C.length})` })
736
+ /* @__PURE__ */ e(Te, { onClick: () => x(!0), sx: { px: 5 }, children: `${L.view_transactions} (${y.length})` })
695
737
  ] }),
696
738
  /* @__PURE__ */ f(H, { children: [
697
- O === "Chart" && /* @__PURE__ */ e(
698
- so,
739
+ M === "Chart" && /* @__PURE__ */ e(
740
+ lo,
699
741
  {
700
742
  availableHeight: te,
701
743
  onClickLegend: ae,
702
744
  onHoverArea: ie,
703
745
  onHoverLegend: ne,
704
- onHoverPoint: Q,
746
+ onHoverPoint: q,
705
747
  stackedDatasets: re.stackedDatasets,
706
748
  unstackedDatasets: re.unstackedDatasets
707
749
  }
708
750
  ),
709
- O === "Table" && /* @__PURE__ */ e(
710
- ot,
751
+ M === "Table" && /* @__PURE__ */ e(
752
+ rt,
711
753
  {
712
- monthlyCategoryTotals: c,
713
- onClickRow: K,
714
- selectedCategory: M,
715
- selectedDateRange: l
754
+ onClickRow: Y,
755
+ selectedCategory: W,
756
+ selectedDateRange: d
716
757
  }
717
758
  )
718
759
  ] })
@@ -720,26 +761,26 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
720
761
  }
721
762
  ),
722
763
  /* @__PURE__ */ e(
723
- ho,
764
+ Co,
724
765
  {
725
- categoryGuid: M,
726
- dateRange: l,
727
- isOpen: W,
728
- onClose: () => L(!1)
766
+ categoryGuid: W,
767
+ dateRange: d,
768
+ isOpen: N,
769
+ onClose: () => x(!1)
729
770
  }
730
771
  )
731
772
  ]
732
773
  }
733
774
  );
734
- }, Rn = R(go), mo = () => {
735
- const { monthlyCategoryTotals: o } = U(), { trends: r } = N(), t = be(), { availableHeight: n = 300 } = ze(), s = Lt(o);
775
+ }, Bn = A(yo), fo = () => {
776
+ const { monthlyCategoryTotals: t } = $(), { trends: r } = k(), n = me(), { availableHeight: o = 300 } = Ue(), s = At(t);
736
777
  return /* @__PURE__ */ e(
737
- We,
778
+ Ge,
738
779
  {
739
780
  baseline: "min",
740
- colors: [t.palette.primary.main],
781
+ colors: [n.palette.primary.main],
741
782
  datasets: [s],
742
- height: n,
783
+ height: o,
743
784
  labels: [r.spending_label],
744
785
  showArea: !0,
745
786
  showAverage: !0,
@@ -749,41 +790,41 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
749
790
  valueFormatterString: "0,0"
750
791
  }
751
792
  );
752
- }, po = R(mo), Co = ({ onPrimaryCtaClick: o, sx: r }) => {
753
- const { visibleAccounts: t } = ve(), { loadMonthlyCategoryTotals: n, monthlyTotalsLoaded: s } = U(), { isInitialized: h } = Ne(), { trends: g } = N(), { isCopyLoaded: d, selectedAccounts: c, setSelectedAccounts: m } = me();
754
- return we({
793
+ }, _o = A(fo), bo = ({ onPrimaryCtaClick: t, sx: r }) => {
794
+ const { visibleAccounts: n } = we(), { loadMonthlyCategoryTotals: o, monthlyTotalsLoaded: s } = $(), { isInitialized: h } = Oe(), { trends: g } = k(), { isCopyLoaded: l, selectedAccounts: c, setSelectedAccounts: m } = pe();
795
+ return Ie({
755
796
  widgetName: "TrendsMiniWidget",
756
797
  isLoaded: s
757
798
  }), u.useEffect(() => {
758
- m(t);
759
- }, [t]), u.useEffect(() => {
760
- h && n(c).finally();
761
- }, [h, c]), !d || !h ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ e(
762
- Ht,
799
+ m(n);
800
+ }, [n]), u.useEffect(() => {
801
+ h && o(c).finally();
802
+ }, [h, c]), !l || !h ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ e(
803
+ Vt,
763
804
  {
764
805
  contentStyles: { height: "calc(100% - 72px)", ":last-child": { pb: 0 } },
765
- onPrimaryCtaClick: o,
806
+ onPrimaryCtaClick: t,
766
807
  primaryCtaLabel: g.primary_cta,
767
808
  subTitle: g.sub_title,
768
809
  sx: { height: "100%", ...r },
769
810
  title: g.mini_title,
770
- children: s ? /* @__PURE__ */ e(po, {}) : /* @__PURE__ */ e(ge, {})
811
+ children: s ? /* @__PURE__ */ e(_o, {}) : /* @__PURE__ */ e(ge, {})
771
812
  }
772
813
  );
773
- }, kn = R(Co), yo = 70, Ve = ({
774
- title: o,
814
+ }, Vn = A(bo), To = 70, ze = ({
815
+ title: t,
775
816
  totalAmount: r,
776
- transactionType: t,
777
- percentage: n,
817
+ transactionType: n,
818
+ percentage: o,
778
819
  secondaryLabel: s,
779
820
  shouldDisplayPercentage: h
780
821
  }) => {
781
- const { availableWidth: g } = ze(), d = u.useRef(null), c = u.useRef(null), m = St(Number(Math.abs(n)), {
822
+ const { availableWidth: g } = Ue(), l = u.useRef(null), c = u.useRef(null), m = wt(Number(Math.abs(o)), {
782
823
  style: "percent",
783
824
  minimumIntegerDigits: 1
784
- }), C = g === 288 && se(r, "0,0.00").length > 10 ? se(r, "0,0") : se(r, "0,0.00"), l = t === "spending" ? n > 0 : n >= 0, T = t === "spending" ? "error.main" : "success.main", a = t === "spending" ? "success.main" : "text.secondary", p = d?.current, _ = c?.current, y = p && _ ? p.scrollWidth > _.clientWidth - yo : !1;
825
+ }), y = g === 288 && se(r, "0,0.00").length > 10 ? se(r, "0,0") : se(r, "0,0.00"), d = n === "spending" ? o > 0 : o >= 0, b = n === "spending" ? "error.main" : "success.main", i = n === "spending" ? "success.main" : "text.secondary", C = l?.current, p = c?.current, _ = C && p ? C.scrollWidth > p.clientWidth - To : !1;
785
826
  return /* @__PURE__ */ f(
786
- b,
827
+ S,
787
828
  {
788
829
  sx: {
789
830
  border: 1,
@@ -796,7 +837,7 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
796
837
  },
797
838
  children: [
798
839
  /* @__PURE__ */ f(
799
- b,
840
+ S,
800
841
  {
801
842
  sx: {
802
843
  alignItems: "center",
@@ -804,14 +845,14 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
804
845
  justifyContent: "space-between"
805
846
  },
806
847
  children: [
807
- /* @__PURE__ */ e(he, { color: "text.secondary", variant: "caption", children: o }),
808
- h && /* @__PURE__ */ f(b, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
809
- l ? /* @__PURE__ */ e(Wt, { size: 20, sx: { color: T } }) : /* @__PURE__ */ e(Ot, { size: 20, sx: { color: a } }),
848
+ /* @__PURE__ */ e(he, { color: "text.secondary", variant: "caption", children: t }),
849
+ h && /* @__PURE__ */ f(S, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
850
+ d ? /* @__PURE__ */ e(Ft, { size: 20, sx: { color: b } }) : /* @__PURE__ */ e(Pt, { size: 20, sx: { color: i } }),
810
851
  /* @__PURE__ */ e(
811
852
  he,
812
853
  {
813
854
  sx: {
814
- color: l ? T : a,
855
+ color: d ? b : i,
815
856
  fontWeight: 600
816
857
  },
817
858
  variant: "body2",
@@ -823,7 +864,7 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
823
864
  }
824
865
  ),
825
866
  /* @__PURE__ */ f(
826
- b,
867
+ S,
827
868
  {
828
869
  ref: c,
829
870
  sx: {
@@ -835,15 +876,15 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
835
876
  /* @__PURE__ */ e(
836
877
  H,
837
878
  {
838
- ref: d,
879
+ ref: l,
839
880
  sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
840
- children: /* @__PURE__ */ e(Fe, { children: C })
881
+ children: /* @__PURE__ */ e(Ye, { children: y })
841
882
  }
842
883
  ),
843
- h && g >= 450 && !y && /* @__PURE__ */ e(
884
+ h && g >= 450 && !_ && /* @__PURE__ */ e(
844
885
  he,
845
886
  {
846
- color: l ? T : a,
887
+ color: d ? b : i,
847
888
  variant: "caption",
848
889
  children: s
849
890
  }
@@ -854,53 +895,53 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
854
895
  ]
855
896
  }
856
897
  );
857
- }, fo = R(() => {
858
- const { trends: o } = N();
859
- return /* @__PURE__ */ f(b, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
860
- /* @__PURE__ */ e(Gt, { size: 32 }),
861
- /* @__PURE__ */ f(b, { children: [
862
- /* @__PURE__ */ e(he, { fontWeight: 600, variant: "body1", children: o.zero_state_content_header }),
863
- /* @__PURE__ */ e(he, { color: "text.secondary", variant: "subtitle2", children: o.zero_state_content_description })
898
+ }, So = A(() => {
899
+ const { trends: t } = k();
900
+ return /* @__PURE__ */ f(S, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
901
+ /* @__PURE__ */ e($t, { size: 32 }),
902
+ /* @__PURE__ */ f(S, { children: [
903
+ /* @__PURE__ */ e(he, { fontWeight: 600, variant: "body1", children: t.zero_state_content_header }),
904
+ /* @__PURE__ */ e(he, { color: "text.secondary", variant: "subtitle2", children: t.zero_state_content_description })
864
905
  ] })
865
906
  ] });
866
- }), Hn = R(({ onCtaClick: o }) => {
867
- const { visibleAccounts: r } = ve(), { onEvent: t } = V(), { monthlyCategoryTotals: n, loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: h } = U(), g = {
868
- start: Nt(/* @__PURE__ */ new Date(), 1),
907
+ }), Fn = A(({ onCtaClick: t }) => {
908
+ const { visibleAccounts: r } = we(), { onEvent: n } = V(), { monthlyCategoryTotals: o, loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: h } = $(), g = {
909
+ start: Ot(/* @__PURE__ */ new Date(), 1),
869
910
  end: /* @__PURE__ */ new Date()
870
- }, { trends: d } = N(), { selectedAccounts: c, setSelectedAccounts: m, isInitialized: C } = me();
871
- we({
911
+ }, { trends: l } = k(), { selectedAccounts: c, setSelectedAccounts: m, isInitialized: y } = pe();
912
+ Ie({
872
913
  widgetName: "TrendsMicroWidget",
873
914
  isLoaded: h
874
915
  }), u.useEffect(() => {
875
916
  m(r);
876
917
  }, [r]), u.useEffect(() => {
877
- C && s(c, g.start).then(() => {
878
- t(v.TRENDS_LOAD_WIDGET, {
918
+ y && s(c, g.start).then(() => {
919
+ n(I.TRENDS_LOAD_WIDGET, {
879
920
  state: r?.length ? "default" : "zeroState"
880
921
  });
881
922
  });
882
- }, [C, c]);
883
- const { spendingData: l, incomeData: T } = u.useMemo(
923
+ }, [y, c]);
924
+ const { spendingData: d, incomeData: b } = u.useMemo(
884
925
  () => ({
885
- spendingData: Ye(n, g),
886
- incomeData: Ue(n, g)
926
+ spendingData: Ze(o, g),
927
+ incomeData: qe(o, g)
887
928
  }),
888
- [n, g]
889
- ), [a, p] = l, [_, y] = T, E = Ge(p.y, a.y), x = Ge(y.y, _.y), I = C && !r?.length, W = () => {
890
- t(
891
- I ? v.TRENDS_CLICK_GET_STARTED : v.TRENDS_CLICK_VIEW_MORE
892
- ), o();
929
+ [o, g]
930
+ ), [i, C] = d, [p, _] = b, L = Pe(C.y, i.y), v = Pe(_.y, p.y), D = y && !r?.length, N = () => {
931
+ n(
932
+ D ? I.TRENDS_CLICK_GET_STARTED : I.TRENDS_CLICK_VIEW_MORE
933
+ ), t();
893
934
  };
894
- return !h || !C ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ e(
895
- Pt,
935
+ return !h || !y ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ e(
936
+ Yt,
896
937
  {
897
938
  className: "mx-trends-microwidget",
898
- ctaLabel: d.micro_primary_cta_label,
899
- onCTAClick: W,
900
- subHeader: I ? void 0 : d.micro_subheader,
901
- title: d.title,
902
- children: I ? /* @__PURE__ */ e(fo, {}) : /* @__PURE__ */ f(
903
- b,
939
+ ctaLabel: l.micro_primary_cta_label,
940
+ onCTAClick: N,
941
+ subHeader: D ? void 0 : l.micro_subheader,
942
+ title: l.title,
943
+ children: D ? /* @__PURE__ */ e(So, {}) : /* @__PURE__ */ f(
944
+ S,
904
945
  {
905
946
  sx: {
906
947
  alignItems: "stretch",
@@ -909,24 +950,24 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
909
950
  },
910
951
  children: [
911
952
  /* @__PURE__ */ e(
912
- Ve,
953
+ ze,
913
954
  {
914
- percentage: E,
915
- secondaryLabel: d.micro_secondary_label,
916
- shouldDisplayPercentage: p.y !== 0 && a.y !== 0,
917
- title: d.spending_label,
918
- totalAmount: p.y,
955
+ percentage: L,
956
+ secondaryLabel: l.micro_secondary_label,
957
+ shouldDisplayPercentage: C.y !== 0 && i.y !== 0,
958
+ title: l.spending_label,
959
+ totalAmount: C.y,
919
960
  transactionType: "spending"
920
961
  }
921
962
  ),
922
963
  /* @__PURE__ */ e(
923
- Ve,
964
+ ze,
924
965
  {
925
- percentage: x,
926
- secondaryLabel: d.micro_secondary_label,
927
- shouldDisplayPercentage: y.y !== 0 && _.y !== 0,
928
- title: d.income_label,
929
- totalAmount: y.y,
966
+ percentage: v,
967
+ secondaryLabel: l.micro_secondary_label,
968
+ shouldDisplayPercentage: _.y !== 0 && p.y !== 0,
969
+ title: l.income_label,
970
+ totalAmount: _.y,
930
971
  transactionType: "income"
931
972
  }
932
973
  )
@@ -935,21 +976,21 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
935
976
  )
936
977
  }
937
978
  );
938
- }), _o = R(
939
- ({ isExpanded: o, onClick: r }) => {
940
- const t = qe();
941
- return /* @__PURE__ */ e(zt, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(Kt, { onClick: r, sx: { justifyContent: "center" }, children: /* @__PURE__ */ f(
942
- b,
979
+ }), xo = A(
980
+ ({ isExpanded: t, onClick: r }) => {
981
+ const n = tt();
982
+ return /* @__PURE__ */ e(Xt, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(Zt, { onClick: r, sx: { justifyContent: "center" }, children: /* @__PURE__ */ f(
983
+ S,
943
984
  {
944
- sx: { color: t.palette.primary.main, flexDirection: "row", alignItems: "center" },
985
+ sx: { color: n.palette.primary.main, flexDirection: "row", alignItems: "center" },
945
986
  children: [
946
- /* @__PURE__ */ e(Yt, { children: /* @__PURE__ */ e($, { bold: !0, variant: "body2", children: o ? "View less" : "View more" }) }),
947
- /* @__PURE__ */ e(jt, { sx: { color: t.palette.primary.main }, children: o ? /* @__PURE__ */ e(Bt, {}) : /* @__PURE__ */ e(
948
- Vt,
987
+ /* @__PURE__ */ e(Qt, { children: /* @__PURE__ */ e(P, { bold: !0, variant: "body2", children: t ? "View less" : "View more" }) }),
988
+ /* @__PURE__ */ e(qt, { sx: { color: n.palette.primary.main }, children: t ? /* @__PURE__ */ e(zt, {}) : /* @__PURE__ */ e(
989
+ Kt,
949
990
  {
950
991
  sx: {
951
992
  transition: "transform 0.3s ease-in-out",
952
- transform: o ? "rotate(180deg)" : "rotate(0deg)"
993
+ transform: t ? "rotate(180deg)" : "rotate(0deg)"
953
994
  }
954
995
  }
955
996
  ) })
@@ -957,97 +998,97 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
957
998
  }
958
999
  ) }) });
959
1000
  }
960
- ), Pe = R(
1001
+ ), Ke = A(
961
1002
  ({
962
- totalAmount: o,
1003
+ totalAmount: t,
963
1004
  guid: r,
964
- name: t,
965
- transactions: n,
1005
+ name: n,
1006
+ transactions: o,
966
1007
  onClick: s,
967
1008
  isLastItem: h = !1,
968
1009
  showDivider: g = !0
969
1010
  }) => {
970
- const { trends: d } = N(), { onEvent: c } = V(), m = `${n.length} ${n.length === 1 ? d.transaction : d.transactions}`, C = () => {
971
- s?.(), c(v.TRENDS_CLICK_LIST_ITEM, {
1011
+ const { trends: l } = k(), { onEvent: c } = V(), m = `${o.length} ${o.length === 1 ? l.transaction : l.transactions}`, y = () => {
1012
+ s?.(), c(I.TRENDS_CLICK_LIST_ITEM, {
972
1013
  ...G,
973
- listItem: t
1014
+ listItem: n
974
1015
  });
975
1016
  };
976
1017
  return /* @__PURE__ */ f(u.Fragment, { children: [
977
1018
  /* @__PURE__ */ e(
978
- je,
1019
+ Xe,
979
1020
  {
980
- leftIcon: r ? /* @__PURE__ */ e(Se, { categoryGuid: r }) : void 0,
981
- onClick: C,
982
- rightContent: se(Math.abs(o), "0,0.00"),
983
- rightIcon: s ? /* @__PURE__ */ e(lt, {}) : void 0,
1021
+ leftIcon: r ? /* @__PURE__ */ e(xe, { categoryGuid: r }) : void 0,
1022
+ onClick: y,
1023
+ rightContent: se(Math.abs(t), "0,0.00"),
1024
+ rightIcon: s ? /* @__PURE__ */ e(ht, {}) : void 0,
984
1025
  subtitle: m,
985
- title: t
1026
+ title: n
986
1027
  }
987
1028
  ),
988
- g && /* @__PURE__ */ e(ke, { sx: { ml: h ? 24 : 68 } })
1029
+ g && /* @__PURE__ */ e(Ne, { sx: { ml: h ? 24 : 68 } })
989
1030
  ] }, r);
990
1031
  }
991
- ), To = R(
992
- ({ availableHeight: o = 0, onCategoryClick: r }) => {
993
- const { collapsedCategories: t, visibleCategories: n, setVisibleListLength: s } = pe(), { isLargeDesktop: h, isDesktop: g } = ee(), { trends: d } = N(), { onEvent: c } = V(), [m, C] = u.useState(!1), l = g || h;
1032
+ ), vo = A(
1033
+ ({ availableHeight: t = 0, onCategoryClick: r }) => {
1034
+ const { collapsedCategories: n, visibleCategories: o, setVisibleListLength: s } = Ce(), { isLargeDesktop: h, isDesktop: g } = ee(), { trends: l } = k(), { onEvent: c } = V(), [m, y] = u.useState(!1), d = g || h;
994
1035
  u.useEffect(() => {
995
- const p = Math.floor(o / 64) - 1, _ = n.length + t.length;
996
- p !== n.length && (s(l ? Math.max(p, 5) : 5), C(p >= _));
997
- }, [o]);
998
- const T = () => {
999
- C(!m), c(v.TRENDS_CLICK_VIEW_MORE, {
1036
+ const C = Math.floor(t / 64) - 1, p = o.length + n.length;
1037
+ C !== o.length && (s(d ? Math.max(C, 5) : 5), y(C >= p));
1038
+ }, [t]);
1039
+ const b = () => {
1040
+ y(!m), c(I.TRENDS_CLICK_VIEW_MORE, {
1000
1041
  ...G
1001
1042
  });
1002
- }, a = n.length + (m ? t.length : 0);
1003
- return /* @__PURE__ */ e(b, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ f($t, { children: [
1004
- /* @__PURE__ */ e(b, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(Fe, { children: d.categories }) }),
1005
- n.map((p, _) => /* @__PURE__ */ e(
1006
- Pe,
1043
+ }, i = o.length + (m ? n.length : 0);
1044
+ return /* @__PURE__ */ e(S, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ f(Ut, { children: [
1045
+ /* @__PURE__ */ e(S, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(Ye, { children: l.categories }) }),
1046
+ o.map((C, p) => /* @__PURE__ */ e(
1047
+ Ke,
1007
1048
  {
1008
- ...p,
1009
- isLastItem: _ === a - 1,
1010
- onClick: p.transactions.length > 0 ? () => r(p) : void 0,
1049
+ ...C,
1050
+ isLastItem: p === i - 1,
1051
+ onClick: C.transactions.length > 0 ? () => r(C) : void 0,
1011
1052
  showDivider: !0
1012
1053
  },
1013
- p.guid
1054
+ C.guid
1014
1055
  )),
1015
1056
  /* @__PURE__ */ e(
1016
- Ft,
1057
+ jt,
1017
1058
  {
1018
1059
  in: m,
1019
1060
  sx: { "&.MuiCollapse-root .MuiListItemButton-root": { paddingLeft: 24 } },
1020
- children: t.map((p, _) => {
1021
- const y = n.length + _;
1061
+ children: n.map((C, p) => {
1062
+ const _ = o.length + p;
1022
1063
  return /* @__PURE__ */ e(
1023
- Pe,
1064
+ Ke,
1024
1065
  {
1025
- ...p,
1026
- isLastItem: y === a - 1,
1027
- onClick: p.transactions.length > 0 ? () => r(p) : void 0,
1066
+ ...C,
1067
+ isLastItem: _ === i - 1,
1068
+ onClick: C.transactions.length > 0 ? () => r(C) : void 0,
1028
1069
  showDivider: !0
1029
1070
  },
1030
- p.guid
1071
+ C.guid
1031
1072
  );
1032
1073
  })
1033
1074
  }
1034
1075
  ),
1035
- t.length > 0 && /* @__PURE__ */ e(_o, { isExpanded: m, onClick: T })
1076
+ n.length > 0 && /* @__PURE__ */ e(xo, { isExpanded: m, onClick: b })
1036
1077
  ] }) });
1037
1078
  }
1038
- ), So = ({ beats: o, onInsightCardClick: r }) => {
1039
- const { onEvent: t } = V(), { isMobile: n, isDesktop: s, isLargeDesktop: h } = ee(), { beatStore: g, endpoint: d, sessionToken: c } = Ne(), m = s || h, C = m || n ? 1 : 2, l = () => null, T = (x) => {
1040
- r?.(x), t(v.TRENDS_CLICK_INSIGHT, G);
1041
- }, a = m ? 200 : 170, p = m ? 170 : 124, _ = m ? 56 : 0, y = o.length > 0 ? a + _ : p, E = m && o.length > 0 ? a : void 0;
1042
- return /* @__PURE__ */ e(_t, { sx: { height: y }, children: /* @__PURE__ */ e(
1043
- kt,
1079
+ ), wo = ({ beats: t, onInsightCardClick: r }) => {
1080
+ const { onEvent: n } = V(), { isMobile: o, isDesktop: s, isLargeDesktop: h } = ee(), { beatStore: g, endpoint: l, sessionToken: c } = Oe(), m = s || h, y = m || o ? 1 : 2, d = () => null, b = (v) => {
1081
+ r?.(v), n(I.TRENDS_CLICK_INSIGHT, G);
1082
+ }, i = m ? 200 : 170, C = m ? 170 : 124, p = m ? 56 : 0, _ = t.length > 0 ? i + p : C, L = m && t.length > 0 ? i : void 0;
1083
+ return /* @__PURE__ */ e(xt, { sx: { height: _ }, children: /* @__PURE__ */ e(
1084
+ Bt,
1044
1085
  {
1045
1086
  areBeatsLoading: g.isLoading,
1046
- beats: o,
1047
- endpoint: d,
1048
- heightOverrides: E,
1049
- logOutUser: l,
1050
- onCardClick: T,
1087
+ beats: t,
1088
+ endpoint: l,
1089
+ heightOverrides: L,
1090
+ logOutUser: d,
1091
+ onCardClick: b,
1051
1092
  showBorder: !0,
1052
1093
  showCTAColocatedWithText: !1,
1053
1094
  showCarouselControls: !0,
@@ -1057,28 +1098,28 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
1057
1098
  token: c,
1058
1099
  userHasFullInsightFeedBeats: !1,
1059
1100
  variant: "outlined",
1060
- visibleCardsCount: C
1101
+ visibleCardsCount: y
1061
1102
  }
1062
1103
  ) });
1063
- }, bo = R(So), xo = R(({ chartLabel: o, chartColor: r }) => {
1064
- const { onEvent: t } = V(), {
1065
- categoryDetailsChartData: { monthlyAmounts: n, tooltipLabels: s }
1066
- } = pe();
1067
- return /* @__PURE__ */ e(b, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
1068
- We,
1104
+ }, Io = A(wo), Lo = A(({ chartLabel: t, chartColor: r }) => {
1105
+ const { onEvent: n } = V(), {
1106
+ categoryDetailsChartData: { monthlyAmounts: o, tooltipLabels: s }
1107
+ } = Ce();
1108
+ return /* @__PURE__ */ e(S, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
1109
+ Ge,
1069
1110
  {
1070
1111
  baseline: "min",
1071
1112
  colors: [r],
1072
1113
  curveType: "bump",
1073
1114
  customTooltipLabels: s,
1074
- datasets: [n],
1115
+ datasets: [o],
1075
1116
  height: 265,
1076
- labels: [o],
1117
+ labels: [t],
1077
1118
  markStyles: () => ({
1078
1119
  stroke: r
1079
1120
  }),
1080
1121
  onItemClick: () => {
1081
- t(v.TRENDS_CLICK_CHART, G);
1122
+ n(I.TRENDS_CLICK_CHART, G);
1082
1123
  },
1083
1124
  showArea: !0,
1084
1125
  showAverage: !0,
@@ -1093,100 +1134,100 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
1093
1134
  valueFormatterString: "0,0"
1094
1135
  }
1095
1136
  ) });
1096
- }), vo = R(({ onClose: o }) => {
1097
- const r = qe(), { onEvent: t } = V(), { common: n, trends: s } = N(), { selectedCategoryData: h, selectedDateRangeMonthRange: g } = pe(), { sortedTransactions: d } = xe(), [c, m] = u.useState(null);
1137
+ }), Eo = A(({ onClose: t }) => {
1138
+ const r = tt(), { onEvent: n } = V(), { common: o, trends: s } = k(), { selectedCategoryData: h, selectedDateRangeMonthRange: g } = Ce(), { sortedTransactions: l } = ve(), [c, m] = u.useState(null);
1098
1139
  if (!h)
1099
1140
  return null;
1100
- const { guid: C, name: l, is_income: T, totalAmount: a } = h, p = T ? s.category_income : s.category_spending, _ = Xt(C, r), y = T ? s.income_label : s.spending_label, E = ` ${h.transactions.length === 1 ? s.transaction : s.transactions} (${h.transactions.length})`, x = u.useMemo(
1101
- () => d.find((L) => L.guid === c),
1102
- [c, d]
1103
- ), I = (L) => L.category_guid === C || L.top_level_category_guid === C, W = () => {
1104
- o?.(), t(v.TRENDS_CLICK_BACK, G);
1141
+ const { guid: y, name: d, is_income: b, totalAmount: i } = h, C = b ? s.category_income : s.category_spending, p = eo(y, r), _ = b ? s.income_label : s.spending_label, L = ` ${h.transactions.length === 1 ? s.transaction : s.transactions} (${h.transactions.length})`, v = u.useMemo(
1142
+ () => l.find((x) => x.guid === c),
1143
+ [c, l]
1144
+ ), D = (x) => x.category_guid === y || x.top_level_category_guid === y, N = () => {
1145
+ t?.(), n(I.TRENDS_CLICK_BACK, G);
1105
1146
  };
1106
1147
  return /* @__PURE__ */ f(
1107
- He,
1148
+ We,
1108
1149
  {
1109
1150
  ariaLabelClose: s.close_category_details,
1110
1151
  isOpen: !0,
1111
- onClose: W,
1152
+ onClose: N,
1112
1153
  shouldShowHeaderShadow: !0,
1113
- title: p,
1154
+ title: C,
1114
1155
  children: [
1115
- /* @__PURE__ */ f(b, { sx: { alignItems: "center", height: "100%" }, children: [
1116
- /* @__PURE__ */ f(Ut, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
1156
+ /* @__PURE__ */ f(S, { sx: { alignItems: "center", height: "100%" }, children: [
1157
+ /* @__PURE__ */ f(Jt, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
1117
1158
  /* @__PURE__ */ e(
1118
- je,
1159
+ Xe,
1119
1160
  {
1120
- leftIcon: /* @__PURE__ */ e(Se, { categoryGuid: C }),
1121
- rightContent: se(Math.abs(a), "0,0.00"),
1161
+ leftIcon: /* @__PURE__ */ e(xe, { categoryGuid: y }),
1162
+ rightContent: se(Math.abs(i), "0,0.00"),
1122
1163
  subtitle: g,
1123
- title: l
1164
+ title: d
1124
1165
  }
1125
1166
  ),
1126
- /* @__PURE__ */ e(xo, { chartColor: _, chartLabel: y }),
1127
- /* @__PURE__ */ f(b, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
1128
- /* @__PURE__ */ e($, { bold: !0, variant: "body1", children: E }),
1129
- /* @__PURE__ */ e(Zt, { filter: I })
1167
+ /* @__PURE__ */ e(Lo, { chartColor: p, chartLabel: _ }),
1168
+ /* @__PURE__ */ f(S, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
1169
+ /* @__PURE__ */ e(P, { bold: !0, variant: "body1", children: L }),
1170
+ /* @__PURE__ */ e(to, { filter: D })
1130
1171
  ] })
1131
1172
  ] }),
1132
1173
  /* @__PURE__ */ e(
1133
- Qe,
1174
+ et,
1134
1175
  {
1135
1176
  bgcolor: "transparent",
1136
- filter: I,
1177
+ filter: D,
1137
1178
  height: "calc(100vh - 475px)",
1138
1179
  onClick: m
1139
1180
  }
1140
1181
  )
1141
1182
  ] }),
1142
1183
  /* @__PURE__ */ e(
1143
- He,
1184
+ We,
1144
1185
  {
1145
- ariaLabelClose: n.close_aria,
1146
- isOpen: !!x,
1186
+ ariaLabelClose: o.close_aria,
1187
+ isOpen: !!v,
1147
1188
  onClose: () => m(""),
1148
1189
  title: s.transaction,
1149
- children: x && /* @__PURE__ */ e(Ze, { transaction: x })
1190
+ children: v && /* @__PURE__ */ e(Je, { transaction: v })
1150
1191
  }
1151
1192
  )
1152
1193
  ]
1153
1194
  }
1154
1195
  );
1155
- }), wo = (o, r) => {
1156
- const t = Ue(o, r), n = Ye(o, r);
1157
- return [t, n].filter((s) => s.length > 0);
1158
- }, Do = (o, r) => {
1159
- const [t, n] = o, s = t, h = n ?? t, g = [];
1196
+ }), Do = (t, r) => {
1197
+ const n = qe(t, r), o = Ze(t, r);
1198
+ return [n, o].filter((s) => s.length > 0);
1199
+ }, Mo = (t, r) => {
1200
+ const [n, o] = t, s = n, h = o ?? n, g = [];
1160
1201
  if (s) {
1161
- const d = s.reduce((c, m) => c + m.y, 0);
1162
- g.push({ label: r.income_label, amount: d });
1202
+ const l = s.reduce((c, m) => c + m.y, 0);
1203
+ g.push({ label: r.income_label, amount: l });
1163
1204
  }
1164
1205
  if (h) {
1165
- const d = h.reduce((c, m) => c + m.y, 0);
1166
- g.push({ label: r.spending_label, amount: d });
1206
+ const l = h.reduce((c, m) => c + m.y, 0);
1207
+ g.push({ label: r.spending_label, amount: l });
1167
1208
  }
1168
1209
  return g;
1169
- }, Io = ({
1170
- availableHeight: o = 0,
1210
+ }, Ao = ({
1211
+ availableHeight: t = 0,
1171
1212
  minHeight: r = 500,
1172
- selectedDateRange: t,
1173
- totals: n
1213
+ selectedDateRange: n,
1214
+ totals: o
1174
1215
  }) => {
1175
- const s = be(), { onEvent: h } = V(), { trends: g } = N(), { isSmallMobile: d, isMobile: c, isSmallTablet: m, isTablet: C } = ee(), l = [s.palette.chart?.chart1, s.palette.chart?.chart2], T = wo(n, t), a = Do(T, g), [p, _] = u.useState(0), y = 458, E = 195, x = 56, I = c || d ? E : m || C ? y : p;
1216
+ const s = me(), { onEvent: h } = V(), { trends: g } = k(), { isSmallMobile: l, isMobile: c, isSmallTablet: m, isTablet: y } = ee(), d = [s.palette.chart?.chart1, s.palette.chart?.chart2], b = Do(o, n), i = Mo(b, g), [C, p] = u.useState(0), _ = 458, L = 195, v = 56, D = c || l ? L : m || y ? _ : C;
1176
1217
  return u.useEffect(() => {
1177
- const L = Math.max(o - x, r);
1178
- _(L);
1179
- }, [o]), /* @__PURE__ */ e(
1180
- We,
1218
+ const x = Math.max(t - v, r);
1219
+ p(x);
1220
+ }, [t]), /* @__PURE__ */ e(
1221
+ Ge,
1181
1222
  {
1182
1223
  baseline: "min",
1183
- colors: l,
1224
+ colors: d,
1184
1225
  curveType: "bump",
1185
- datasets: T,
1186
- height: I,
1187
- labels: a,
1226
+ datasets: b,
1227
+ height: D,
1228
+ labels: i,
1188
1229
  onItemClick: () => {
1189
- h(v.TRENDS_CLICK_CHART, G);
1230
+ h(I.TRENDS_CLICK_CHART, G);
1190
1231
  },
1191
1232
  showArea: !0,
1192
1233
  showAxisHighlight: !0,
@@ -1199,7 +1240,7 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
1199
1240
  valueFormatterString: "0.0a"
1200
1241
  }
1201
1242
  );
1202
- }, Eo = R(Io), Lo = [
1243
+ }, ko = A(Ao), Ro = [
1203
1244
  "BillAmountNotStandard",
1204
1245
  "CategorySpendingV2",
1205
1246
  "CostOfLivingToIncome",
@@ -1233,195 +1274,195 @@ const Je = ({ categoryGuid: o, topLevelCategoryGuid: r }) => {
1233
1274
  "WeeklyNewMerchantsV2",
1234
1275
  "WeeklyNoSpendDays",
1235
1276
  "WeeklySmallPurchasesSummary"
1236
- ], Mo = ({ onBackClick: o, onInsightCardClick: r, sx: t }) => {
1237
- const { onEvent: n } = V(), { config: s } = mt(), { isLargeDesktop: h, isDesktop: g, isMobile: d } = ee(), { visibleAccounts: c } = ve(), { loadDateRangeCategoryTotals: m, loadMonthlyCategoryTotals: C, monthlyCategoryTotals: l } = U(), { setFilter: T } = xe(), { selectedDateRange: a, setSelectedCategoryData: p, setSelectedDateRange: _ } = pe(), {
1238
- isCopyLoaded: y,
1239
- isInitialized: E,
1240
- selectedAccounts: x,
1241
- selectedAccountGuids: I,
1242
- setSelectedAccounts: W
1243
- } = me(), { trends: L, connect: O } = N(), { beatStore: A } = Ne(), P = Qt() && s.show_insights_widget_in_master, z = g || h, [X, Ce] = u.useState(!1), [te, re] = u.useState(!1), [Z, ce] = u.useState("Chart"), [oe, K] = u.useState(""), [ae, ne] = u.useState(!1), [ie, Q] = u.useState(window.innerHeight), w = z ? 56 : 0, B = ie - 208, j = ie - (P ? 550 + w : 266), [le, ye] = u.useState(!1), De = s.show_connections_widget_in_master ? "buttons" : "no-buttons", i = u.useMemo(
1244
- () => c && c.length === 0 || l.length === 0,
1245
- [c, l]
1277
+ ], Ho = ({ onBackClick: t, onInsightCardClick: r, sx: n }) => {
1278
+ const { onEvent: o } = V(), { config: s } = yt(), { isLargeDesktop: h, isDesktop: g, isMobile: l } = ee(), { visibleAccounts: c } = we(), { loadDateRangeCategoryTotals: m, loadMonthlyCategoryTotals: y, monthlyCategoryTotals: d } = $(), { setFilter: b } = ve(), { selectedDateRange: i, setSelectedCategoryData: C, setSelectedDateRange: p } = Ce(), {
1279
+ isCopyLoaded: _,
1280
+ isInitialized: L,
1281
+ selectedAccounts: v,
1282
+ selectedAccountGuids: D,
1283
+ setSelectedAccounts: N
1284
+ } = pe(), { trends: x, connect: M } = k(), { beatStore: z } = Oe(), F = oo() && s.show_insights_widget_in_master, K = g || h, [X, ye] = u.useState(!1), [te, re] = u.useState(!1), [Z, ce] = u.useState("Chart"), [oe, Y] = u.useState(""), [ae, ne] = u.useState(!1), [ie, q] = u.useState(window.innerHeight), w = K ? 56 : 0, O = ie - 208, j = ie - (F ? 550 + w : 266), [le, fe] = u.useState(!1), Le = s.show_connections_widget_in_master ? "buttons" : "no-buttons", a = u.useMemo(
1285
+ () => c && c.length === 0 || d.length === 0,
1286
+ [c, d]
1246
1287
  );
1247
- we({
1288
+ Ie({
1248
1289
  widgetName: "TrendsWidget",
1249
1290
  isLoaded: X
1250
1291
  }), u.useEffect(() => {
1251
- E && A.loadBeats().finally(() => re(!0));
1252
- }, [E]);
1253
- const S = u.useMemo(() => te ? A.getFilteredBeats({ templates: Lo }) : [], [te]);
1292
+ L && z.loadBeats().finally(() => re(!0));
1293
+ }, [L]);
1294
+ const T = u.useMemo(() => te ? z.getFilteredBeats({ templates: Ro }) : [], [te]);
1254
1295
  u.useEffect(() => {
1255
- const k = () => Q(window.innerHeight);
1256
- return window.addEventListener("resize", k), () => window.removeEventListener("resize", k);
1296
+ const R = () => q(window.innerHeight);
1297
+ return window.addEventListener("resize", R), () => window.removeEventListener("resize", R);
1257
1298
  }, []), u.useEffect(() => {
1258
- W(c);
1299
+ N(c);
1259
1300
  }, [c]), u.useEffect(() => {
1260
- E && m(x, a.start, a.end).then(() => {
1261
- C(
1262
- x,
1263
- a.start,
1264
- a.end
1265
- );
1266
- }).finally(() => {
1267
- Ce(!0), n(v.TRENDS_LOAD_WIDGET, {
1301
+ L && Promise.all([
1302
+ m(
1303
+ v,
1304
+ i.start,
1305
+ i.end
1306
+ ),
1307
+ y(v, i.start, i.end)
1308
+ ]).finally(() => {
1309
+ ye(!0), o(I.TRENDS_LOAD_WIDGET, {
1268
1310
  ...G,
1269
- time_period: `${Re(a.end, a.start)}M`
1311
+ time_period: `${He(i.end, i.start)}M`
1270
1312
  });
1271
1313
  });
1272
- }, [E, x, a]), u.useEffect(() => {
1273
- if (l.length !== 0) {
1274
- const k = {
1275
- accounts: I,
1276
- dateRange: { start: a.start, end: a.end }
1314
+ }, [L, v, i]), u.useEffect(() => {
1315
+ if (d.length !== 0) {
1316
+ const R = {
1317
+ accounts: D,
1318
+ dateRange: { start: i.start, end: i.end }
1277
1319
  };
1278
- T({
1279
- ...k,
1280
- custom: (q) => !!l.find(
1281
- (ue) => ue.top_level_category_guid === q.top_level_category_guid || ue.category_guid === q.category_guid
1320
+ b({
1321
+ ...R,
1322
+ custom: (Q) => !!d.find(
1323
+ (ue) => ue.top_level_category_guid === Q.top_level_category_guid || ue.category_guid === Q.category_guid
1282
1324
  )
1283
1325
  });
1284
1326
  }
1285
- }, [l]);
1286
- const D = (k) => {
1287
- p(k), ne(!0);
1288
- }, Y = () => {
1289
- p(null), ne(!1);
1290
- }, Ie = () => {
1291
- ye(!0), n(v.TRENDS_CLICK_CONNECT_ACCOUNTS);
1292
- }, Ee = (k, q) => {
1293
- ce(q ?? Z), n(v.TRENDS_CLICK_TOGGLE_VIEW, {
1327
+ }, [d]);
1328
+ const E = (R) => {
1329
+ C(R), ne(!0);
1330
+ }, U = () => {
1331
+ C(null), ne(!1);
1332
+ }, Ee = () => {
1333
+ fe(!0), o(I.TRENDS_CLICK_CONNECT_ACCOUNTS);
1334
+ }, De = (R, Q) => {
1335
+ ce(Q ?? Z), o(I.TRENDS_CLICK_TOGGLE_VIEW, {
1294
1336
  ...G,
1295
- toggleView: q
1337
+ toggleView: Q
1296
1338
  });
1297
- }, de = (k) => {
1298
- const q = $e(k?.[0], 1), ue = k?.[1], st = Re(ue, q);
1299
- _({ start: q, end: ue }), n(v.TRENDS_CLICK_TIME_WINDOW, {
1339
+ }, de = (R) => {
1340
+ const Q = je(R?.[0], 1), ue = R?.[1], it = He(ue, Q);
1341
+ p({ start: Q, end: ue }), o(I.TRENDS_CLICK_TIME_WINDOW, {
1300
1342
  ...G,
1301
- time_period: st + "M"
1343
+ time_period: it + "M"
1302
1344
  });
1303
- }, Le = (k) => {
1304
- n(v.TRENDS_CLICK_FILTER, {
1345
+ }, Me = (R) => {
1346
+ o(I.TRENDS_CLICK_FILTER, {
1305
1347
  ...G,
1306
- filterValue: k
1348
+ filterValue: R
1307
1349
  });
1308
- }, Me = (k) => {
1309
- K(k);
1310
- }, nt = () => {
1311
- K(""), n(v.TRENDS_CLICK_ALL_CATEGORIES, G);
1350
+ }, Ae = (R) => {
1351
+ Y(R);
1352
+ }, at = () => {
1353
+ Y(""), o(I.TRENDS_CLICK_ALL_CATEGORIES, G);
1312
1354
  };
1313
- return !y || !X ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ f(
1314
- Xe,
1355
+ return !_ || !X ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ f(
1356
+ Qe,
1315
1357
  {
1316
1358
  accountOptions: c,
1317
1359
  calendarActions: { onRangeChanged: de },
1318
- dateRange: a,
1319
- dateRangeVariant: d ? "timeframetabs" : "timeframebuttons",
1320
- onAccountsFilterClick: Le,
1321
- onBackClick: o,
1322
- sx: t,
1323
- title: L.title,
1360
+ dateRange: i,
1361
+ dateRangeVariant: l ? "timeframetabs" : "timeframebuttons",
1362
+ onAccountsFilterClick: Me,
1363
+ onBackClick: t,
1364
+ sx: n,
1365
+ title: x.title,
1324
1366
  children: [
1325
- i && /* @__PURE__ */ e(
1326
- qt,
1367
+ a && /* @__PURE__ */ e(
1368
+ no,
1327
1369
  {
1328
- header: L.zero_state_content_header,
1370
+ header: x.zero_state_content_header,
1329
1371
  icon: "",
1330
- onClick: Ie,
1331
- primaryButton: L.empty_state_primary,
1332
- subText: L.empty_state_sub_text,
1333
- sx: { height: B },
1334
- variant: De
1372
+ onClick: Ee,
1373
+ primaryButton: x.empty_state_primary,
1374
+ subText: x.empty_state_sub_text,
1375
+ sx: { height: O },
1376
+ variant: Le
1335
1377
  }
1336
1378
  ),
1337
- !i && /* @__PURE__ */ f(
1338
- b,
1379
+ !a && /* @__PURE__ */ f(
1380
+ S,
1339
1381
  {
1340
1382
  sx: {
1341
- px: d ? 0 : 48
1383
+ px: l ? 0 : 48
1342
1384
  },
1343
1385
  children: [
1344
1386
  /* @__PURE__ */ f(
1345
- b,
1387
+ S,
1346
1388
  {
1347
1389
  flexDirection: "row",
1348
1390
  justifyContent: "space-between",
1349
- sx: { pb: d ? 12 : 24, pt: d ? 24 : 48 },
1391
+ sx: { pb: l ? 12 : 24, pt: l ? 24 : 48 },
1350
1392
  children: [
1351
1393
  /* @__PURE__ */ e(
1352
- tt,
1394
+ st,
1353
1395
  {
1354
1396
  selectedCategoryGuid: oe,
1355
- selectedDateRange: a
1397
+ selectedDateRange: i
1356
1398
  }
1357
1399
  ),
1358
- /* @__PURE__ */ e(et, { onTabChange: Ee, selectedTab: Z })
1400
+ /* @__PURE__ */ e(nt, { onTabChange: De, selectedTab: Z })
1359
1401
  ]
1360
1402
  }
1361
1403
  ),
1362
- /* @__PURE__ */ e(b, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(H, { flexGrow: 1, children: oe && /* @__PURE__ */ f(_e, { onClick: nt, sx: { p: 0, pr: 5 }, children: [
1363
- /* @__PURE__ */ e(fe, { name: "arrow_back" }),
1364
- L.all_categories
1404
+ /* @__PURE__ */ e(S, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(H, { flexGrow: 1, children: oe && /* @__PURE__ */ f(Te, { onClick: at, sx: { p: 0, pr: 5 }, children: [
1405
+ /* @__PURE__ */ e(be, { name: "arrow_back" }),
1406
+ x.all_categories
1365
1407
  ] }) }) }),
1366
- /* @__PURE__ */ f(b, { flexDirection: z ? "row" : "column", gap: z ? 48 : 16, children: [
1367
- Z === "Chart" && /* @__PURE__ */ f(rt, { children: [
1368
- /* @__PURE__ */ e(H, { sx: { width: z ? "68%" : "100%" }, children: /* @__PURE__ */ e(
1369
- Eo,
1408
+ /* @__PURE__ */ f(S, { flexDirection: K ? "row" : "column", gap: K ? 48 : 16, children: [
1409
+ Z === "Chart" && /* @__PURE__ */ f(ct, { children: [
1410
+ /* @__PURE__ */ e(H, { sx: { width: K ? "68%" : "100%" }, children: /* @__PURE__ */ e(
1411
+ ko,
1370
1412
  {
1371
- availableHeight: B,
1413
+ availableHeight: O,
1372
1414
  minHeight: 450,
1373
- selectedDateRange: a,
1374
- totals: l
1415
+ selectedDateRange: i,
1416
+ totals: d
1375
1417
  }
1376
1418
  ) }),
1377
- /* @__PURE__ */ f(b, { gap: 16, sx: { width: z ? "32%" : "100%" }, children: [
1378
- P && te && S.length > 0 && /* @__PURE__ */ e(
1379
- bo,
1419
+ /* @__PURE__ */ f(S, { gap: 16, sx: { width: K ? "32%" : "100%" }, children: [
1420
+ F && te && T.length > 0 && /* @__PURE__ */ e(
1421
+ Io,
1380
1422
  {
1381
- beats: S,
1423
+ beats: T,
1382
1424
  onInsightCardClick: r
1383
1425
  }
1384
1426
  ),
1385
1427
  /* @__PURE__ */ e(
1386
- To,
1428
+ vo,
1387
1429
  {
1388
1430
  availableHeight: j,
1389
- onCategoryClick: D
1431
+ onCategoryClick: E
1390
1432
  }
1391
1433
  )
1392
1434
  ] })
1393
1435
  ] }),
1394
1436
  Z === "Table" && /* @__PURE__ */ e(H, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
1395
- ot,
1437
+ rt,
1396
1438
  {
1397
1439
  height: "unset",
1398
- monthlyCategoryTotals: l,
1399
- onClickRow: Me,
1440
+ onClickRow: Ae,
1400
1441
  selectedCategory: oe,
1401
- selectedDateRange: a
1442
+ selectedDateRange: i
1402
1443
  }
1403
1444
  ) })
1404
1445
  ] }),
1405
- ae && /* @__PURE__ */ e(vo, { onClose: Y })
1446
+ ae && /* @__PURE__ */ e(Eo, { onClose: U })
1406
1447
  ]
1407
1448
  }
1408
1449
  ),
1409
1450
  /* @__PURE__ */ e(
1410
- Jt,
1451
+ so,
1411
1452
  {
1412
- onClose: () => ye(!1),
1453
+ onClose: () => fe(!1),
1413
1454
  showConnectWidget: le,
1414
- title: O.mini_title
1455
+ title: M.mini_title
1415
1456
  }
1416
1457
  )
1417
1458
  ]
1418
1459
  }
1419
1460
  );
1420
- }, Nn = R(Mo);
1461
+ }, Pn = A(Ho);
1421
1462
  export {
1422
- Rn as TrendsFullWidget,
1423
- Hn as TrendsMicroWidget,
1424
- kn as TrendsMiniWidget,
1425
- Gn as TrendsStore,
1426
- Nn as TrendsWidget
1463
+ Bn as TrendsFullWidget,
1464
+ Fn as TrendsMicroWidget,
1465
+ Vn as TrendsMiniWidget,
1466
+ Kn as TrendsStore,
1467
+ Pn as TrendsWidget
1427
1468
  };