@mx-cartographer/experiences 9.2.6 → 9.2.8

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,69 +1,69 @@
1
- import { jsxs as C, jsx as e, Fragment as vt } from "react/jsx-runtime";
2
- import g, { useRef as wt, useState as Dt, useEffect as It } from "react";
3
- import { observer as A } from "mobx-react-lite";
4
- import { CategoryIcon as ve, Text as F, Icon as He, H3 as Ge, P as pe } from "@mxenabled/mxui";
5
- import H from "@mui/material/Box";
1
+ import { jsxs as C, jsx as e, Fragment as xt } from "react/jsx-runtime";
2
+ import p, { useRef as vt, useState as wt, useEffect as Dt } from "react";
3
+ import { observer as R } from "mobx-react-lite";
4
+ import { CategoryIcon as ve, Text as P, Icon as He, H3 as Oe, P as fe } from "@mxenabled/mxui";
5
+ import W from "@mui/material/Box";
6
6
  import S from "@mui/material/Stack";
7
7
  import Te from "@mui/material/Button";
8
8
  import { addSeconds as et } from "date-fns/addSeconds";
9
9
  import { differenceInCalendarMonths as Se } from "date-fns/differenceInCalendarMonths";
10
- import Lt from "numeral";
11
- import { useTheme as Z, styled as Et, alpha as Mt } from "@mui/material/styles";
12
- import { useItemTooltip as At, ChartsTooltipContainer as Rt } from "@mui/x-charts/ChartsTooltip";
13
- import { LineChart as kt } from "@mui/x-charts/LineChart";
14
- import { u as Q } from "../useScreenSize-mWpmnh5w.mjs";
15
- import { u as Ht } from "../useDimensions-CeDR9V8N.mjs";
10
+ import It from "numeral";
11
+ import { useTheme as K, styled as Lt, alpha as Et } from "@mui/material/styles";
12
+ import { useItemTooltip as Mt, ChartsTooltipContainer as At } from "@mui/x-charts/ChartsTooltip";
13
+ import { LineChart as Rt } from "@mui/x-charts/LineChart";
14
+ import { u as Y } from "../useScreenSize-mWpmnh5w.mjs";
15
+ import { u as kt } from "../useDimensions-CeDR9V8N.mjs";
16
16
  import tt from "@mui/material/Card";
17
17
  import ot from "@mui/material/CardContent";
18
18
  import Ne from "@mui/material/Divider";
19
19
  import Fe from "@mui/material/Grid";
20
20
  import { b as nt } from "../Localization-DnoVyBNK.mjs";
21
- import { u as R, l as q, f as $, a as fe, g as we, c as De, B as ye, D as st, e as Be, i as rt } from "../hooks-97sNJ_lf.mjs";
21
+ import { u as k, l as U, f as V, a as ye, g as we, c as De, B as Ce, D as st, e as Be, i as rt } from "../hooks-97sNJ_lf.mjs";
22
22
  import { C as xe } from "../CurrencyText-CCbE6MmF.mjs";
23
- import { a as Re, C as $e, b as Nt } from "../Category-DEKZGLYe.mjs";
24
- import { f as X, D as G } from "../DateFormats-HudZ3Bjs.mjs";
25
- import { f as re, a as Wt } from "../NumberFormatting--XMeeBfr.mjs";
26
- import { a as Ke, c as Ot, g as Gt } from "../TrendsUtil-D9z3kIj_.mjs";
27
- import { c as Bt, i as Pt, d as Vt, e as zt, g as at, b as it, f as Ye } from "../SpendingData-Fii_xATx.mjs";
28
- import Ft from "@mui/material/ToggleButton";
29
- import $t from "@mui/material/ToggleButtonGroup";
30
- import { parseISO as lt } from "date-fns/parseISO";
23
+ import { a as Re, C as $e, b as Ht } from "../Category-DEKZGLYe.mjs";
24
+ import { f as j, D as B } from "../DateFormats-HudZ3Bjs.mjs";
25
+ import { f as re, a as Nt } from "../NumberFormatting--XMeeBfr.mjs";
26
+ import { a as je, c as Wt, g as Gt } from "../TrendsUtil-D9z3kIj_.mjs";
27
+ import { c as Ot, i as Bt, d as Pt, e as Vt, g as at, b as it, f as Ke } from "../SpendingData-Fii_xATx.mjs";
28
+ import zt from "@mui/material/ToggleButton";
29
+ import Ft from "@mui/material/ToggleButtonGroup";
30
+ import { parseISO as ct } from "date-fns/parseISO";
31
31
  import { H as ke } from "../HeaderCell-P8w6CmfO.mjs";
32
- import { T as W, a as Kt } from "../ViewMoreMicroCard-B4oeGrbE.mjs";
33
- import { useGridApiContext as Yt, useGridRootProps as jt, DataGridPro as Ut } from "@mui/x-data-grid-pro";
34
- import Xt from "@mui/material/Badge";
35
- import Zt from "@mui/material/IconButton";
36
- import { A as w } from "../Analytics-D-jdcL72.mjs";
37
- import { T as ct } from "../EmbeddedCard-CQEnrozC.mjs";
32
+ import { T as O, a as $t } from "../ViewMoreMicroCard-B4oeGrbE.mjs";
33
+ import { useGridApiContext as jt, useGridRootProps as Kt, DataGridPro as Yt } from "@mui/x-data-grid-pro";
34
+ import Ut from "@mui/material/Badge";
35
+ import Xt from "@mui/material/IconButton";
36
+ import { A as D } from "../Analytics-D-jdcL72.mjs";
37
+ import { T as lt } from "../EmbeddedCard-CQEnrozC.mjs";
38
38
  import { T as dt } from "../TransactionDetails-CLc7oeHT.mjs";
39
39
  import { D as Pe } from "../Drawer-DsnW2o0v.mjs";
40
40
  import { u as Ie } from "../useWidgetLoadTimer-B0tB-yzL.mjs";
41
41
  import { L as Le } from "../Loader-CxeBwuPG.mjs";
42
- import { W as ut } from "../WidgetContainer-DvKtBdhn.mjs";
42
+ import { W as ut } from "../WidgetContainer-eosXfD5G.mjs";
43
43
  import { L as Ve } from "../LineChart-CUfiH86G.mjs";
44
- import { M as Qt } from "../MiniWidgetContainer-Bmv_WeUd.mjs";
45
- import { subMonths as qt } from "date-fns";
46
- import { TrendingUp as Jt, TrendingDown as eo, MultilineChart as to, ExpandLess as oo, ExpandMore as no, ChevronRight as so, ArrowBack as ro } from "@mxenabled/mx-icons";
47
- import { M as ao } from "../MicroWidgetContainer-B2NnKBgW.mjs";
48
- import io from "@mui/material/Collapse";
44
+ import { M as Zt } from "../MiniWidgetContainer-Bmv_WeUd.mjs";
45
+ import { subMonths as Qt } from "date-fns";
46
+ import { TrendingUp as qt, TrendingDown as Jt, MultilineChart as eo, ExpandLess as to, ExpandMore as oo, ChevronRight as no, ArrowBack as so } from "@mxenabled/mx-icons";
47
+ import { M as ro } from "../MicroWidgetContainer-B2NnKBgW.mjs";
48
+ import ao from "@mui/material/Collapse";
49
49
  import We from "@mui/material/List";
50
50
  import mt from "@mui/material/ListItem";
51
- import lo from "@mui/material/ListItemButton";
51
+ import io from "@mui/material/ListItemButton";
52
52
  import co from "@mui/material/ListItemIcon";
53
53
  import ht from "@mui/material/ListItemText";
54
- import { g as Oe } from "../TransactionUtils-BphBJBbU.mjs";
55
- import { L as uo } from "../ListItemRow-kH1rn8Xu.mjs";
56
- import { Stack as mo } from "@mui/material";
57
- import ho from "@mui/material/ListItemAvatar";
58
- import { E as go } from "../ExportCsvAction-B_8I-Le6.mjs";
59
- import { u as po } from "../useInsightsEnabled-D5Sdm0TJ.mjs";
60
- import { E as fo } from "../EmptyState-CJUDc3kD.mjs";
61
- import { C as yo } from "../ConnectDrawer-CW4LA3H3.mjs";
54
+ import { g as Ge } from "../TransactionUtils-BphBJBbU.mjs";
55
+ import { L as lo } from "../ListItemRow-kH1rn8Xu.mjs";
56
+ import { Stack as uo } from "@mui/material";
57
+ import mo from "@mui/material/ListItemAvatar";
58
+ import { E as ho } from "../ExportCsvAction-B_8I-Le6.mjs";
59
+ import { u as go } from "../useInsightsEnabled-D5Sdm0TJ.mjs";
60
+ import { E as po } from "../EmptyState-CJUDc3kD.mjs";
61
+ import { C as fo } from "../ConnectDrawer-CW4LA3H3.mjs";
62
62
  const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
63
- const { categories: s } = R(), { getCategoryName: o } = q(), r = o(t);
63
+ const { categories: s } = k(), { getCategoryName: o } = U(), r = o(t);
64
64
  return /* @__PURE__ */ C(S, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
65
65
  /* @__PURE__ */ e(
66
- H,
66
+ W,
67
67
  {
68
68
  "aria-label": nt(s.category_icon_label_aria, r),
69
69
  mb: 4,
@@ -71,22 +71,22 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
71
71
  children: /* @__PURE__ */ e(ve, { categoryGuid: n })
72
72
  }
73
73
  ),
74
- /* @__PURE__ */ e(F, { variant: "body1", children: r })
74
+ /* @__PURE__ */ e(P, { variant: "body1", children: r })
75
75
  ] });
76
- }, Co = ({
76
+ }, yo = ({
77
77
  categoryGuids: { guid: t, topLevelGuid: n },
78
78
  hoveredAreaData: s,
79
79
  cursorPosition: o,
80
80
  chartContainerRef: r
81
81
  }) => {
82
- const c = Z(), a = wt(null), [d, u] = Dt({ x: o.x, y: o.y });
83
- if (It(() => {
82
+ const l = K(), a = vt(null), [c, u] = wt({ x: o.x, y: o.y });
83
+ if (Dt(() => {
84
84
  (() => {
85
85
  const m = a.current, _ = r.current;
86
86
  if (!m || !_) return;
87
- const h = m.getBoundingClientRect(), p = _.getBoundingClientRect();
87
+ const g = m.getBoundingClientRect(), h = _.getBoundingClientRect();
88
88
  let y = o.x, T = o.y;
89
- y + h.width * 2 > p.right ? y = o.x - h.width : y - h.width < p.left && (y = o.x), T + h.height * 2 > p.bottom && (T = o.y - h.height), u({ x: y, y: T });
89
+ y + g.width * 2 > h.right ? y = o.x - g.width : y - g.width < h.left && (y = o.x), T + g.height * 2 > h.bottom && (T = o.y - g.height), u({ x: y, y: T });
90
90
  })();
91
91
  }, [o, r]), !s) return null;
92
92
  const i = s.reduce((f, m) => f + m.y, 0);
@@ -96,22 +96,22 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
96
96
  ref: a,
97
97
  sx: {
98
98
  position: "absolute",
99
- top: d.y,
100
- left: d.x,
99
+ top: c.y,
100
+ left: c.x,
101
101
  width: 250,
102
102
  pointerEvents: "none"
103
103
  },
104
104
  children: /* @__PURE__ */ C(ot, { children: [
105
- /* @__PURE__ */ C(H, { alignItems: "center", display: "flex", flexDirection: "column", children: [
105
+ /* @__PURE__ */ C(W, { alignItems: "center", display: "flex", flexDirection: "column", children: [
106
106
  /* @__PURE__ */ e(gt, { categoryGuid: t, topLevelCategoryGuid: n }),
107
- /* @__PURE__ */ e(F, { variant: "body2", children: `${s.length}-month total` }),
107
+ /* @__PURE__ */ e(P, { variant: "body2", children: `${s.length}-month total` }),
108
108
  /* @__PURE__ */ e(xe, { amount: i, bold: !0, formatString: "0,0", variant: "body2" })
109
109
  ] }),
110
110
  /* @__PURE__ */ e(Ne, { sx: { my: 16, width: "100%" } }),
111
- /* @__PURE__ */ e(Fe, { container: !0, children: s.map((f, m) => /* @__PURE__ */ C(g.Fragment, { children: [
111
+ /* @__PURE__ */ e(Fe, { container: !0, children: s.map((f, m) => /* @__PURE__ */ C(p.Fragment, { children: [
112
112
  m > 0 && m % 3 === 0 && /* @__PURE__ */ e(Ne, { sx: { my: 16, width: "100%" } }),
113
- /* @__PURE__ */ e(Fe, { size: 4, children: /* @__PURE__ */ C(H, { alignItems: "center", display: "flex", flexDirection: "column", children: [
114
- /* @__PURE__ */ e(F, { color: c.palette.text.secondary, variant: "caption", children: f.x }),
113
+ /* @__PURE__ */ e(Fe, { size: 4, children: /* @__PURE__ */ C(W, { alignItems: "center", display: "flex", flexDirection: "column", children: [
114
+ /* @__PURE__ */ e(P, { color: l.palette.text.secondary, variant: "caption", children: f.x }),
115
115
  /* @__PURE__ */ e(
116
116
  xe,
117
117
  {
@@ -126,15 +126,15 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
126
126
  ] })
127
127
  }
128
128
  );
129
- }, _o = A(Co), bo = ({
129
+ }, Co = R(yo), _o = ({
130
130
  sx: t,
131
131
  categoryGuids: n,
132
132
  hoveredLegend: s,
133
133
  legendRef: o,
134
134
  onHoverLegend: r,
135
- onClickLegend: c
135
+ onClickLegend: l
136
136
  }) => {
137
- const { isMobile: a } = Q(), { getCategoryName: d } = q();
137
+ const { isMobile: a } = Y(), { getCategoryName: c } = U();
138
138
  return /* @__PURE__ */ e(
139
139
  S,
140
140
  {
@@ -145,11 +145,11 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
145
145
  ref: o,
146
146
  sx: t,
147
147
  children: n.map(({ guid: u, top_level_guid: i }) => {
148
- const f = s === u, m = Re[u], _ = Re[i], h = m ?? _ ?? Re.default, p = h + "33";
148
+ const f = s === u, m = Re[u], _ = Re[i], g = m ?? _ ?? Re.default, h = g + "33";
149
149
  return /* @__PURE__ */ C(
150
150
  Te,
151
151
  {
152
- onClick: () => c(u),
152
+ onClick: () => l(u),
153
153
  onMouseEnter: () => r(u),
154
154
  onMouseLeave: () => r(null),
155
155
  sx: {
@@ -165,18 +165,18 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
165
165
  },
166
166
  children: [
167
167
  /* @__PURE__ */ e(
168
- H,
168
+ W,
169
169
  {
170
170
  sx: {
171
171
  width: 16,
172
172
  height: 16,
173
173
  marginRight: a ? 5 : 10,
174
174
  borderRadius: "2px",
175
- backgroundColor: s ? f ? h : p : h
175
+ backgroundColor: s ? f ? g : h : g
176
176
  }
177
177
  }
178
178
  ),
179
- /* @__PURE__ */ e(F, { variant: "body1", children: d(u) })
179
+ /* @__PURE__ */ e(P, { variant: "body1", children: c(u) })
180
180
  ]
181
181
  },
182
182
  u
@@ -184,128 +184,128 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
184
184
  })
185
185
  }
186
186
  );
187
- }, To = ({
187
+ }, bo = ({
188
188
  categoryGuids: { guid: t, topLevelGuid: n },
189
189
  series: s,
190
190
  xData: o
191
191
  }) => {
192
- const r = At(), c = Z();
192
+ const r = Mt(), l = K();
193
193
  if (!r?.identifier) return null;
194
- const { dataIndex: a, seriesId: d } = r.identifier;
195
- if (a == null || !d) return null;
196
- const i = s.find((m) => m.id === d)?.data?.[a], f = o?.[a];
197
- return i === void 0 || !f ? null : /* @__PURE__ */ e(tt, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ e(ot, { children: /* @__PURE__ */ C(H, { alignItems: "center", display: "flex", flexDirection: "column", children: [
194
+ const { dataIndex: a, seriesId: c } = r.identifier;
195
+ if (a == null || !c) return null;
196
+ const i = s.find((m) => m.id === c)?.data?.[a], f = o?.[a];
197
+ return i === void 0 || !f ? null : /* @__PURE__ */ e(tt, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ e(ot, { children: /* @__PURE__ */ C(W, { alignItems: "center", display: "flex", flexDirection: "column", children: [
198
198
  /* @__PURE__ */ e(gt, { categoryGuid: t, topLevelCategoryGuid: n }),
199
- /* @__PURE__ */ e(F, { color: c.palette.text.secondary, variant: "body2", children: X(f, G.MONTH_SHORT_YEAR) }),
199
+ /* @__PURE__ */ e(P, { color: l.palette.text.secondary, variant: "body2", children: j(f, B.MONTH_SHORT_YEAR) }),
200
200
  /* @__PURE__ */ e(xe, { amount: String(i), bold: !0, formatString: "0,0", variant: "body1" })
201
201
  ] }) }) });
202
- }, So = ({
202
+ }, To = ({
203
203
  onHoverArea: t,
204
204
  onHoverPoint: n,
205
205
  onHoverLegend: s,
206
206
  onClickLegend: o,
207
207
  stackedDatasets: r,
208
- unstackedDatasets: c = [],
208
+ unstackedDatasets: l = [],
209
209
  availableHeight: a = 0,
210
- minimumHeight: d = 350
210
+ minimumHeight: c = 350
211
211
  }) => {
212
- const u = Z(), { isMobile: i } = Q(), [f, { height: m }] = Ht(), _ = g.useRef(null), [h, p] = g.useState(0);
213
- g.useEffect(() => {
214
- const l = Math.max(a - m, d);
215
- p(l);
212
+ const u = K(), { isMobile: i } = Y(), [f, { height: m }] = kt(), _ = p.useRef(null), [g, h] = p.useState(0);
213
+ p.useEffect(() => {
214
+ const d = Math.max(a - m, c);
215
+ h(d);
216
216
  }, [a, m]);
217
- const [y, T] = g.useState(null), [N, x] = g.useState({
217
+ const [y, T] = p.useState(null), [x, H] = p.useState({
218
218
  hoveredSeriesId: null,
219
219
  hoveredAreaData: null,
220
220
  isAreaHovered: !1,
221
221
  cursorPos: { x: 0, y: 0 }
222
- }), { hoveredSeriesId: L, hoveredAreaData: M, isAreaHovered: E, cursorPos: v } = N, K = E && L && M, ae = !K, Y = [...r, ...c], J = Y[0]?.dataset.length ?? 0, P = Y.flatMap((l) => l.dataset.map((b) => b.x)), V = Y.flatMap((l) => l.dataset.map((b) => b.y)), O = r[0]?.dataset?.map(
223
- (l, b) => r.reduce((I, z) => I + z.dataset[b]?.y || 0, 0)
224
- ) ?? [0], ee = Math.max(...O), Ce = Math.max(
225
- ...c.flatMap((l) => l.dataset.map((b) => b.y))
226
- ), ie = Math.floor(Math.min(...V) / 100) * 100, te = Math.ceil(Math.max(ee, Ce) / 100) * 100, j = r.map((l, b) => ({
222
+ }), { hoveredSeriesId: L, hoveredAreaData: M, isAreaHovered: I, cursorPos: E } = x, X = I && L && M, Z = !X, te = [...r, ...l], oe = te[0]?.dataset.length ?? 0, A = te.flatMap((d) => d.dataset.map((b) => b.x)), de = te.flatMap((d) => d.dataset.map((b) => b.y)), G = r[0]?.dataset?.map(
223
+ (d, b) => r.reduce((w, $) => w + $.dataset[b]?.y || 0, 0)
224
+ ) ?? [0], ae = Math.max(...G), ie = Math.max(
225
+ ...l.flatMap((d) => d.dataset.map((b) => b.y))
226
+ ), z = Math.floor(Math.min(...de) / 100) * 100, ue = Math.ceil(Math.max(ae, ie) / 100) * 100, Q = r.map((d, b) => ({
227
227
  id: `stacked-${b}`,
228
- guid: l.category_guid,
229
- top_level_guid: l.top_level_category_guid,
228
+ guid: d.category_guid,
229
+ top_level_guid: d.top_level_category_guid,
230
230
  area: !0,
231
231
  color: r[b].category_color ?? u.palette.primary.main,
232
- data: l.dataset.map((I) => I.y),
232
+ data: d.dataset.map((w) => w.y),
233
233
  label: r[b].category_name,
234
234
  stack: "total",
235
235
  type: "line",
236
236
  highlightScope: { highlight: "item" },
237
- valueFormatter: (I) => re(I, "0,0")
238
- })), ne = c.map((l, b) => ({
237
+ valueFormatter: (w) => re(w, "0,0")
238
+ })), F = l.map((d, b) => ({
239
239
  id: `unstacked-${b}`,
240
- guid: l.category_guid,
241
- top_level_guid: l.top_level_category_guid,
240
+ guid: d.category_guid,
241
+ top_level_guid: d.top_level_category_guid,
242
242
  area: !1,
243
- color: l.category_color,
244
- data: l.dataset.map((I) => I.y),
245
- label: l.category_name,
243
+ color: d.category_color,
244
+ data: d.dataset.map((w) => w.y),
245
+ label: d.category_name,
246
246
  type: "line",
247
- valueFormatter: (I) => re(I, "0,0")
248
- })), U = [...j, ...ne], de = [
249
- ...j.map(({ guid: l, top_level_guid: b }) => ({
250
- guid: l,
247
+ valueFormatter: (w) => re(w, "0,0")
248
+ })), ne = [...Q, ...F], q = [
249
+ ...Q.map(({ guid: d, top_level_guid: b }) => ({
250
+ guid: d,
251
251
  top_level_guid: b
252
252
  })),
253
- ...ne.map(({ guid: l, top_level_guid: b }) => ({
254
- guid: l,
253
+ ...F.map(({ guid: d, top_level_guid: b }) => ({
254
+ guid: d,
255
255
  top_level_guid: b
256
256
  }))
257
- ], B = (l) => {
258
- const I = l.startsWith("stacked-") ? r[parseInt(l.split("-")[1])] : c[parseInt(l.split("-")[1])];
257
+ ], J = (d) => {
258
+ const w = d.startsWith("stacked-") ? r[parseInt(d.split("-")[1])] : l[parseInt(d.split("-")[1])];
259
259
  return {
260
- guid: I?.category_guid,
261
- topLevelGuid: I?.top_level_category_guid
260
+ guid: w?.category_guid,
261
+ topLevelGuid: w?.top_level_category_guid
262
262
  };
263
- }, ue = (l) => {
264
- T(l), s?.(l ?? "");
265
- }, se = (l) => {
266
- o?.(l ?? "");
263
+ }, se = (d) => {
264
+ T(d), s?.(d ?? "");
265
+ }, ce = (d) => {
266
+ o?.(d ?? "");
267
267
  }, le = () => {
268
- const l = B(String(L)).guid;
269
- l && o?.(l);
270
- }, ce = (l) => {
271
- const b = String(l?.seriesId), I = B(b).guid, z = U.find((he) => he.id === b), Ee = z && l?.dataIndex !== void 0, _e = z && l?.dataIndex === void 0;
272
- if (Ee)
273
- x({
268
+ const d = J(String(L)).guid;
269
+ d && o?.(d);
270
+ }, me = (d) => {
271
+ const b = String(d?.seriesId), w = J(b).guid, $ = ne.find((ge) => ge.id === b), _e = $ && d?.dataIndex !== void 0, Ee = $ && d?.dataIndex === void 0;
272
+ if (_e)
273
+ H({
274
274
  hoveredSeriesId: b,
275
275
  hoveredAreaData: null,
276
276
  isAreaHovered: !1,
277
- cursorPos: v
278
- }), n?.(I);
279
- else if (_e) {
280
- const he = z?.data.map((Me, Ae) => ({
281
- x: P[Ae],
277
+ cursorPos: E
278
+ }), n?.(w);
279
+ else if (Ee) {
280
+ const ge = $?.data.map((Me, Ae) => ({
281
+ x: A[Ae],
282
282
  y: Me
283
283
  })) ?? [];
284
- x({
284
+ H({
285
285
  hoveredSeriesId: b,
286
- hoveredAreaData: he,
286
+ hoveredAreaData: ge,
287
287
  isAreaHovered: !0,
288
- cursorPos: v
289
- }), t?.(I);
288
+ cursorPos: E
289
+ }), t?.(w);
290
290
  } else
291
- x({
291
+ H({
292
292
  hoveredSeriesId: null,
293
293
  hoveredAreaData: null,
294
294
  isAreaHovered: !1,
295
- cursorPos: v
295
+ cursorPos: E
296
296
  });
297
- }, me = (l) => {
298
- if (l.target instanceof Element && l.target.classList[0]?.includes("MuiMarkElement-root"))
297
+ }, he = (d) => {
298
+ if (d.target instanceof Element && d.target.classList[0]?.includes("MuiMarkElement-root"))
299
299
  return;
300
- const b = l.currentTarget.getBoundingClientRect();
301
- x((I) => ({
302
- ...I,
300
+ const b = d.currentTarget.getBoundingClientRect();
301
+ H((w) => ({
302
+ ...w,
303
303
  cursorPos: {
304
- x: l.clientX - b.left,
305
- y: l.clientY - b.top
304
+ x: d.clientX - b.left,
305
+ y: d.clientY - b.top
306
306
  }
307
307
  }));
308
- }, D = {
308
+ }, v = {
309
309
  p: 4,
310
310
  "& .MuiBarLabel-root": {
311
311
  fontSize: 10,
@@ -321,17 +321,17 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
321
321
  '& [class*="MuiLineElement-series-unstacked-"]': {
322
322
  strokeWidth: 3
323
323
  },
324
- ...y && j.reduce((l, b, I) => {
325
- const z = `.MuiAreaElement-series-stacked-${I}`;
326
- return l[z] = {
327
- opacity: j[I].guid === y ? 0.9 : 0.2
328
- }, l;
324
+ ...y && Q.reduce((d, b, w) => {
325
+ const $ = `.MuiAreaElement-series-stacked-${w}`;
326
+ return d[$] = {
327
+ opacity: Q[w].guid === y ? 0.9 : 0.2
328
+ }, d;
329
329
  }, {})
330
330
  };
331
331
  return /* @__PURE__ */ e(
332
- H,
332
+ W,
333
333
  {
334
- onMouseMove: me,
334
+ onMouseMove: he,
335
335
  ref: _,
336
336
  sx: {
337
337
  position: "relative",
@@ -352,68 +352,68 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
352
352
  sx: { width: "100%", position: "relative" },
353
353
  children: [
354
354
  /* @__PURE__ */ e(
355
- kt,
355
+ Rt,
356
356
  {
357
- height: h,
357
+ height: g,
358
358
  hideLegend: !0,
359
359
  margin: { bottom: 24, left: 12, right: 54, top: 48 },
360
360
  onAreaClick: le,
361
- onHighlightChange: ce,
362
- series: U,
361
+ onHighlightChange: me,
362
+ series: ne,
363
363
  skipAnimation: !0,
364
364
  slotProps: {
365
- tooltip: { trigger: ae ? "item" : "none" }
365
+ tooltip: { trigger: Z ? "item" : "none" }
366
366
  },
367
367
  slots: {
368
- tooltip: ae && L ? (l) => /* @__PURE__ */ e(Rt, { children: /* @__PURE__ */ e(
369
- To,
368
+ tooltip: Z && L ? (d) => /* @__PURE__ */ e(At, { children: /* @__PURE__ */ e(
369
+ bo,
370
370
  {
371
- ...l,
372
- categoryGuids: B(L),
373
- series: U,
374
- xData: P
371
+ ...d,
372
+ categoryGuids: J(L),
373
+ series: ne,
374
+ xData: A
375
375
  }
376
376
  ) }) : void 0
377
377
  },
378
- sx: D,
378
+ sx: v,
379
379
  xAxis: [
380
380
  {
381
- data: P,
381
+ data: A,
382
382
  scaleType: "time",
383
- valueFormatter: (l) => X(l, G.MONTH_SHORT_YEAR),
384
- tickNumber: J
383
+ valueFormatter: (d) => j(d, B.MONTH_SHORT_YEAR),
384
+ tickNumber: oe
385
385
  // How many ticks to show on the x-axis
386
386
  }
387
387
  ],
388
388
  yAxis: [
389
389
  {
390
- min: ie,
391
- max: te || 100,
392
- valueFormatter: (l) => Lt(l).format("0a")
390
+ min: z,
391
+ max: ue || 100,
392
+ valueFormatter: (d) => It(d).format("0a")
393
393
  }
394
394
  ]
395
395
  }
396
396
  ),
397
397
  /* @__PURE__ */ e(
398
- bo,
398
+ _o,
399
399
  {
400
- categoryGuids: de,
400
+ categoryGuids: q,
401
401
  hoveredLegend: y,
402
402
  legendRef: f,
403
- onClickLegend: se,
404
- onHoverLegend: ue,
403
+ onClickLegend: ce,
404
+ onHoverLegend: se,
405
405
  sx: { px: i ? 0 : 24 }
406
406
  }
407
407
  ),
408
- K && /* @__PURE__ */ e(
409
- _o,
408
+ X && /* @__PURE__ */ e(
409
+ Co,
410
410
  {
411
- categoryGuids: B(L),
411
+ categoryGuids: J(L),
412
412
  chartContainerRef: _,
413
- cursorPosition: v,
414
- hoveredAreaData: M.map((l) => ({
415
- ...l,
416
- x: X(l.x, G.MONTH_SHORT_YEAR)
413
+ cursorPosition: E,
414
+ hoveredAreaData: M.map((d) => ({
415
+ ...d,
416
+ x: j(d.x, B.MONTH_SHORT_YEAR)
417
417
  }))
418
418
  }
419
419
  )
@@ -423,9 +423,9 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
423
423
  }
424
424
  );
425
425
  }, pt = ({ selectedTab: t, onTabChange: n }) => {
426
- const { common: s } = R();
426
+ const { common: s } = k();
427
427
  return /* @__PURE__ */ e(
428
- $t,
428
+ Ft,
429
429
  {
430
430
  "aria-label": s.view_toggle,
431
431
  exclusive: !0,
@@ -433,7 +433,7 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
433
433
  orientation: "horizontal",
434
434
  value: t,
435
435
  children: ["Chart", "Table"].map((o) => /* @__PURE__ */ e(
436
- Ft,
436
+ zt,
437
437
  {
438
438
  "aria-label": o === "Chart" ? s.view_chart : s.view_table,
439
439
  "aria-pressed": t === o,
@@ -447,22 +447,22 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
447
447
  }
448
448
  );
449
449
  }, ft = ({ selectedDateRange: t, selectedCategoryGuid: n }) => {
450
- const { trends: s } = R(), { isMobile: o, isDesktop: r } = Q(), { getCategoryName: c } = q(), a = g.useMemo(() => {
451
- const i = t.start.getFullYear() === t.end.getFullYear() ? X(
450
+ const { trends: s } = k(), { isMobile: o, isDesktop: r } = Y(), { getCategoryName: l } = U(), a = p.useMemo(() => {
451
+ const i = t.start.getFullYear() === t.end.getFullYear() ? j(
452
452
  t.start,
453
- o ? G.MONTH_SHORT : G.MONTH_LONG
454
- ) : X(
453
+ o ? B.MONTH_SHORT : B.MONTH_LONG
454
+ ) : j(
455
455
  t.start,
456
- o ? G.MONTH_SHORT_YEAR : G.MONTH_YEAR
457
- ), f = X(
456
+ o ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
457
+ ), f = j(
458
458
  t.end,
459
- o ? G.MONTH_SHORT_YEAR : G.MONTH_YEAR
459
+ o ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
460
460
  );
461
461
  return `${i} - ${f}`;
462
- }, [t, o]), u = c(n) || (o ? s.sub_title : s.sub_title_by_category);
463
- return /* @__PURE__ */ C(H, { children: [
462
+ }, [t, o]), u = l(n) || (o ? s.sub_title : s.sub_title_by_category);
463
+ return /* @__PURE__ */ C(W, { children: [
464
464
  /* @__PURE__ */ e(
465
- Ge,
465
+ Oe,
466
466
  {
467
467
  sx: {
468
468
  fontSize: r ? null : 15,
@@ -472,40 +472,40 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
472
472
  children: u
473
473
  }
474
474
  ),
475
- /* @__PURE__ */ e(F, { variant: r ? "subtitle1" : "body2", children: a })
475
+ /* @__PURE__ */ e(P, { variant: r ? "subtitle1" : "body2", children: a })
476
476
  ] });
477
- }, xo = (t) => {
477
+ }, So = (t) => {
478
478
  const n = t.id === "total";
479
479
  return /* @__PURE__ */ C(S, { alignItems: "center", direction: "row", role: "rowheader", tabIndex: t.tabIndex, children: [
480
- !n && /* @__PURE__ */ e(H, { "aria-hidden": !0, children: /* @__PURE__ */ e(ve, { categoryGuid: t.row.top_level_category_guid, variant: "twotone" }) }),
481
- /* @__PURE__ */ e(F, { bold: n, sx: { ml: 12 }, variant: n ? "body1" : "body2", children: t.row.category })
480
+ !n && /* @__PURE__ */ e(W, { "aria-hidden": !0, children: /* @__PURE__ */ e(ve, { categoryGuid: t.row.top_level_category_guid, variant: "twotone" }) }),
481
+ /* @__PURE__ */ e(P, { bold: n, sx: { ml: 12 }, variant: n ? "body1" : "body2", children: t.row.category })
482
482
  ] });
483
- }, je = (t) => {
484
- const n = t.row.category_guid, s = t.row.top_level_category_guid, o = n === $e.INCOME || s === $e.INCOME, r = t.id === "total", c = t.field === "total", a = c ? t.row[t.field] : t.row.monthlyAmounts[t.field];
483
+ }, Ye = (t) => {
484
+ const n = t.row.category_guid, s = t.row.top_level_category_guid, o = n === $e.INCOME || s === $e.INCOME, r = t.id === "total", l = t.field === "total", a = l ? t.row[t.field] : t.row.monthlyAmounts[t.field];
485
485
  return /* @__PURE__ */ e(S, { alignItems: "flex-end", direction: "row", tabIndex: t.tabIndex, children: /* @__PURE__ */ e(
486
486
  xe,
487
487
  {
488
488
  amount: o ? Math.abs(a) : a,
489
489
  isIncome: o,
490
- sx: { fontWeight: o || c || r ? 600 : 500 },
490
+ sx: { fontWeight: o || l || r ? 600 : 500 },
491
491
  symbol: o ? "+" : void 0,
492
492
  variant: r ? "body1" : "body2"
493
493
  }
494
494
  ) });
495
495
  }, Ue = (t, n) => {
496
- const s = X(lt(n.isoDate), G.MONTH_LONG);
496
+ const s = j(ct(n.isoDate), B.MONTH_LONG);
497
497
  return t[s] = n.amount, t;
498
498
  }, Xe = (t) => (n, s) => {
499
- const o = X(lt(s.isoDate), G.MONTH_LONG);
499
+ const o = j(ct(s.isoDate), B.MONTH_LONG);
500
500
  return n + (t.includes(o) ? s.amount : 0);
501
- }, vo = (t, n) => {
501
+ }, xo = (t, n) => {
502
502
  const s = [], o = new Date(t);
503
503
  for (; o <= n; ) {
504
- const r = X(o, G.MONTH_LONG);
504
+ const r = j(o, B.MONTH_LONG);
505
505
  s.push(r), o.setMonth(o.getMonth() + 1);
506
506
  }
507
507
  return s;
508
- }, wo = (t, n) => {
508
+ }, vo = (t, n) => {
509
509
  const s = {
510
510
  field: "category",
511
511
  flex: 1,
@@ -513,25 +513,25 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
513
513
  headerName: n.category_title,
514
514
  minWidth: 210,
515
515
  renderHeader: ke,
516
- renderCell: xo,
516
+ renderCell: So,
517
517
  sortable: !0,
518
- sortComparator: Ot,
518
+ sortComparator: Wt,
519
519
  type: "string"
520
- }, o = t.map((c) => ({
521
- field: c,
520
+ }, o = t.map((l) => ({
521
+ field: l,
522
522
  flex: 1,
523
523
  headerClassName: "trends-table-header",
524
- headerName: c,
524
+ headerName: l,
525
525
  minWidth: 100,
526
526
  renderHeader: ke,
527
- renderCell: je,
527
+ renderCell: Ye,
528
528
  align: "center",
529
529
  headerAlign: "center",
530
530
  sortable: !0,
531
531
  hideSortIcons: !1,
532
532
  type: "number",
533
- sortComparator: Ke,
534
- valueGetter: (a, d) => d.monthlyAmounts?.[c] ?? 0
533
+ sortComparator: je,
534
+ valueGetter: (a, c) => c.monthlyAmounts?.[l] ?? 0
535
535
  })), r = {
536
536
  field: "total",
537
537
  flex: 1,
@@ -539,31 +539,31 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
539
539
  headerName: n.table_column_total,
540
540
  minWidth: 100,
541
541
  renderHeader: ke,
542
- renderCell: je,
542
+ renderCell: Ye,
543
543
  align: "center",
544
544
  headerAlign: "center",
545
545
  sortable: !0,
546
546
  hideSortIcons: !1,
547
547
  type: "number",
548
- sortComparator: Ke
548
+ sortComparator: je
549
549
  };
550
550
  return [s, ...o, r];
551
551
  }, Ze = (t, n, s, o, r) => {
552
- const c = t.filter((a) => a.is_income === s).map((a) => {
553
- let d = a.totalMonthlyAmounts;
554
- return r && (d = a.monthlyAmounts), {
552
+ const l = t.filter((a) => a.is_income === s).map((a) => {
553
+ let c = a.totalMonthlyAmounts;
554
+ return r && (c = a.monthlyAmounts), {
555
555
  id: a.guid,
556
556
  category: a.name,
557
557
  category_guid: a.guid,
558
558
  isParent: !1,
559
559
  top_level_category_guid: a.parent_guid || a.guid,
560
- total: d.reduce(Xe(o), 0),
561
- monthlyAmounts: d.reduce(Ue, {})
560
+ total: c.reduce(Xe(o), 0),
561
+ monthlyAmounts: c.reduce(Ue, {})
562
562
  };
563
563
  });
564
564
  if (r && r.is_income === s) {
565
565
  const a = r.monthlyAmounts.reduce(Xe(o), 0);
566
- a !== 0 && c.push({
566
+ a !== 0 && l.push({
567
567
  id: `sub-${r.guid}`,
568
568
  category: nt(n.category_general, r.name),
569
569
  category_guid: r.guid,
@@ -573,52 +573,52 @@ const gt = ({ categoryGuid: t, topLevelCategoryGuid: n }) => {
573
573
  monthlyAmounts: r.monthlyAmounts.reduce(Ue, {})
574
574
  });
575
575
  }
576
- return c;
577
- }, Do = Et("div")({
576
+ return l;
577
+ }, wo = Lt("div")({
578
578
  display: "flex",
579
579
  visibility: "hidden",
580
580
  width: 0
581
581
  });
582
- function Io({
582
+ function Do({
583
583
  direction: t,
584
584
  index: n,
585
585
  sortingOrder: s,
586
586
  disabled: o,
587
587
  className: r,
588
- field: c
588
+ field: l
589
589
  }) {
590
- const a = Yt(), d = jt();
590
+ const a = jt(), c = Kt();
591
591
  let u = null;
592
592
  const i = {};
593
- if (t === "asc" ? u = d.slots.columnSortedAscendingIcon : t === "desc" ? u = d.slots.columnSortedDescendingIcon : (u = d.slots.columnUnsortedIcon ?? null, i.sortingOrder = s), !u) return null;
594
- const m = a.current.getColumn(c)?.headerName ?? c;
593
+ if (t === "asc" ? u = c.slots.columnSortedAscendingIcon : t === "desc" ? u = c.slots.columnSortedDescendingIcon : (u = c.slots.columnUnsortedIcon ?? null, i.sortingOrder = s), !u) return null;
594
+ const m = a.current.getColumn(l)?.headerName ?? l;
595
595
  let _ = "";
596
596
  t === "asc" ? _ = ", sorted ascending" : t === "desc" && (_ = ", sorted descending");
597
- const h = ["Total", "Category"].includes(m) ? "" : " category totals", p = `Sort by ${m}${h}${_}`, y = /* @__PURE__ */ e(u, { className: "MuiDataGrid-sortIcon", fontSize: "small", ...i }), T = /* @__PURE__ */ e(
598
- Zt,
597
+ const g = ["Total", "Category"].includes(m) ? "" : " category totals", h = `Sort by ${m}${g}${_}`, y = /* @__PURE__ */ e(u, { className: "MuiDataGrid-sortIcon", fontSize: "small", ...i }), T = /* @__PURE__ */ e(
598
+ Xt,
599
599
  {
600
600
  disabled: o,
601
601
  size: "small",
602
602
  tabIndex: -1,
603
- ...d.slotProps?.baseIconButton,
604
- "aria-label": p,
603
+ ...c.slotProps?.baseIconButton,
604
+ "aria-label": h,
605
605
  className: `MuiDataGrid-sortButton${r ? ` ${r}` : ""}`,
606
- title: p,
606
+ title: h,
607
607
  children: y
608
608
  }
609
609
  );
610
- return /* @__PURE__ */ e(Do, { className: "MuiDataGrid-iconButtonContainer", children: n != null ? /* @__PURE__ */ e(Xt, { badgeContent: n, color: "default", overlap: "circular", children: T }) : T });
610
+ return /* @__PURE__ */ e(wo, { className: "MuiDataGrid-iconButtonContainer", children: n != null ? /* @__PURE__ */ e(Ut, { badgeContent: n, color: "default", overlap: "circular", children: T }) : T });
611
611
  }
612
- const Lo = g.memo(Io), Qe = ({
612
+ const Io = p.memo(Do), Qe = ({
613
613
  columns: t,
614
614
  onRowClick: n,
615
615
  parentCategory: s,
616
616
  rows: o,
617
617
  totalRow: r
618
618
  }) => {
619
- const c = Z(), { onEvent: a } = $(), d = c.palette.mode === "light";
619
+ const l = K(), { onEvent: a } = V(), c = l.palette.mode === "light";
620
620
  return /* @__PURE__ */ e(
621
- Ut,
621
+ Yt,
622
622
  {
623
623
  columns: t,
624
624
  disableColumnFilter: !0,
@@ -626,9 +626,9 @@ const Lo = g.memo(Io), Qe = ({
626
626
  hideFooter: !0,
627
627
  initialState: { sorting: { sortModel: [{ field: "category", sort: "asc" }] } },
628
628
  onRowClick: (u) => {
629
- s || n?.(u.row.category_guid), a(w.TRENDS_CLICK_LIST_ITEM, {
630
- ...W,
631
- listItem: Nt[u.row.category_guid]
629
+ s || n?.(u.row.category_guid), a(D.TRENDS_CLICK_LIST_ITEM, {
630
+ ...O,
631
+ listItem: Ht[u.row.category_guid]
632
632
  });
633
633
  },
634
634
  pinnedRows: {
@@ -637,7 +637,7 @@ const Lo = g.memo(Io), Qe = ({
637
637
  rowHeight: 64,
638
638
  rows: o,
639
639
  slotProps: { baseIconButton: { color: "secondary", sx: { ml: 8 } } },
640
- slots: { columnHeaderSortIcon: Lo },
640
+ slots: { columnHeaderSortIcon: Io },
641
641
  sortingOrder: ["asc", "desc"],
642
642
  sx: {
643
643
  borderColor: "divider",
@@ -645,11 +645,11 @@ const Lo = g.memo(Io), Qe = ({
645
645
  borderStyle: "solid",
646
646
  borderRadius: 2,
647
647
  "& .MuiDataGrid-columnHeaders": {
648
- bgcolor: d ? "neutral.50" : "neutral.800",
648
+ bgcolor: c ? "neutral.50" : "neutral.800",
649
649
  borderBottom: "none"
650
650
  },
651
651
  "& .trends-table-header": {
652
- bgcolor: d ? "neutral.50" : "neutral.800"
652
+ bgcolor: c ? "neutral.50" : "neutral.800"
653
653
  }
654
654
  }
655
655
  }
@@ -661,28 +661,28 @@ const Lo = g.memo(Io), Qe = ({
661
661
  height: o = "100%",
662
662
  sx: r = {}
663
663
  }) => {
664
- const { trends: c } = R(), { trendsCategories: a } = q(), d = g.useMemo(() => vo(t.start, t.end), [t]), u = g.useMemo(() => wo(d, c), [d, c]), i = g.useMemo(() => {
664
+ const { trends: l } = k(), { trendsCategories: a } = U(), c = p.useMemo(() => xo(t.start, t.end), [t]), u = p.useMemo(() => vo(c, l), [c, l]), i = p.useMemo(() => {
665
665
  if (n)
666
- return a.find((h) => h.guid === n);
667
- }, [n, a]), [f, m] = g.useMemo(() => {
668
- let h = a;
669
- return i && (h = i.subCategories.filter(
670
- (p) => p.monthlyAmounts.some((y) => y.amount !== 0)
666
+ return a.find((g) => g.guid === n);
667
+ }, [n, a]), [f, m] = p.useMemo(() => {
668
+ let g = a;
669
+ return i && (g = i.subCategories.filter(
670
+ (h) => h.monthlyAmounts.some((y) => y.amount !== 0)
671
671
  )), [
672
- Ze(h, c, !0, d, i),
673
- Ze(h, c, !1, d, i)
672
+ Ze(g, l, !0, c, i),
673
+ Ze(g, l, !1, c, i)
674
674
  ];
675
- }, [a, d, i, c]), _ = {
675
+ }, [a, c, i, l]), _ = {
676
676
  id: "total",
677
- category: c.table_column_total,
677
+ category: l.table_column_total,
678
678
  category_guid: "total",
679
679
  isParent: !1,
680
680
  top_level_category_guid: "total",
681
- total: m.reduce((h, p) => h + p.total, 0),
681
+ total: m.reduce((g, h) => g + h.total, 0),
682
682
  monthlyAmounts: m.reduce(
683
- (h, p) => (Object.entries(p.monthlyAmounts).forEach(([y, T]) => {
684
- h[y] = (h[y] || 0) + T;
685
- }), h),
683
+ (g, h) => (Object.entries(h.monthlyAmounts).forEach(([y, T]) => {
684
+ g[y] = (g[y] || 0) + T;
685
+ }), g),
686
686
  {}
687
687
  )
688
688
  };
@@ -714,26 +714,26 @@ const Lo = g.memo(Io), Qe = ({
714
714
  ]
715
715
  }
716
716
  );
717
- }, Eo = {
717
+ }, Lo = {
718
718
  title: "Transaction List"
719
- }, Mo = ({
719
+ }, Eo = ({
720
720
  categoryGuid: t,
721
721
  dateRange: n,
722
722
  isOpen: s,
723
723
  onClose: o
724
724
  }) => {
725
- const { onEvent: r } = $(), { selectedAccountGuids: c } = fe(), { common: a } = R(), { setFilter: d, sortedTransactions: u } = we(), [i, f] = g.useState(""), m = g.useMemo(
726
- () => u.find((h) => h.guid === i),
725
+ const { onEvent: r } = V(), { selectedAccountGuids: l } = ye(), { common: a } = k(), { setFilter: c, sortedTransactions: u } = we(), [i, f] = p.useState(""), m = p.useMemo(
726
+ () => u.find((g) => g.guid === i),
727
727
  [i, u]
728
728
  );
729
- g.useEffect(() => {
730
- d({
731
- accounts: c,
729
+ p.useEffect(() => {
730
+ c({
731
+ accounts: l,
732
732
  dateRange: n,
733
- custom: (h) => t === "" || t === h.category_guid || t === h.top_level_category_guid,
733
+ custom: (g) => t === "" || t === g.category_guid || t === g.top_level_category_guid,
734
734
  showSplits: !!t
735
735
  });
736
- }, [c, t, n]), g.useEffect(() => r(w.TRENDS_VIEW_TRANSACTIONS), []);
736
+ }, [l, t, n]), p.useEffect(() => r(D.TRENDS_VIEW_TRANSACTIONS), []);
737
737
  const _ = () => {
738
738
  f(""), o();
739
739
  };
@@ -743,97 +743,98 @@ const Lo = g.memo(Io), Qe = ({
743
743
  ariaLabelClose: a.close_aria,
744
744
  isOpen: s,
745
745
  onClose: _,
746
- title: Eo.title,
746
+ title: Lo.title,
747
747
  children: [
748
748
  m && /* @__PURE__ */ e(dt, { transaction: m }),
749
- !m && /* @__PURE__ */ e(ct, { onClick: f })
749
+ !m && /* @__PURE__ */ e(lt, { onClick: f })
750
750
  ]
751
751
  }
752
752
  );
753
- }, Ao = A(Mo), Ro = ({ onBackClick: t, onMenuClick: n, sx: s }) => {
754
- const { onEvent: o } = $(), { isDesktop: r, isTablet: c, isMobile: a } = Q(), { isAccountDataLoaded: d, loadAccountData: u } = De(), {
753
+ }, Mo = R(Eo), Ao = ({ onBackClick: t, onMenuClick: n, sx: s }) => {
754
+ const { onEvent: o } = V(), { isDesktop: r, isTablet: l, isMobile: a } = Y(), { isAccountDataLoaded: c, loadAccountData: u } = De(), {
755
755
  categoriesLoaded: i,
756
756
  loadCategories: f,
757
- loadDateRangeCategoryTotals: m,
758
- loadMonthlyCategoryTotals: _,
759
- monthlyCategoryTotals: h,
760
- getCategoryName: p
761
- } = q(), {
762
- isTransactionDataLoaded: y,
763
- loadTransactionData: T,
764
- sortedTransactions: N
765
- } = we(), { selectedDateRange: x, setSelectedDateRange: L } = ye(), { isInitialized: M, selectedAccounts: E } = fe(), { trends: v } = R(), [K, ae] = g.useState(!1), [Y, J] = g.useState(!1), [P, V] = g.useState("Chart"), [O, ee] = g.useState(""), [Ce, ie] = g.useState(window.innerHeight), j = Ce - (a ? 315 : 345);
757
+ monthlyCategoryTotals: m,
758
+ getCategoryName: _,
759
+ reloadCategoryTotals: g
760
+ } = U(), {
761
+ isTransactionDataLoaded: h,
762
+ loadTransactionData: y,
763
+ sortedTransactions: T
764
+ } = we(), { selectedDateRange: x, setSelectedDateRange: H } = Ce(), { isInitialized: L, selectedAccounts: M, selectedAccountGuids: I } = ye(), { trends: E } = k(), [X, Z] = p.useState(!1), [te, oe] = p.useState(!1), [A, de] = p.useState("Chart"), [G, ae] = p.useState(""), [ie, z] = p.useState(window.innerHeight), Q = ie - (a ? 315 : 345);
766
765
  Ie({
767
766
  widgetName: "TrendsFullWidget",
768
- isLoaded: K
769
- }), g.useEffect(() => {
770
- const D = () => ie(window.innerHeight);
771
- return window.addEventListener("resize", D), d || u().finally(), i || f().finally(), y || T().finally(), () => window.removeEventListener("resize", D);
772
- }, []), g.useEffect(() => {
773
- M && m(E, x.start, x.end).then(() => {
774
- _(
775
- E,
776
- x.start,
777
- x.end
778
- );
779
- }).finally(() => {
780
- ae(!0), o(w.TRENDS_LOAD_WIDGET, {
781
- ...W,
782
- time_period: `${Se(x.end, x.start)}M`
783
- });
784
- });
785
- }, [M, E, x]);
786
- const ne = g.useMemo(() => {
787
- if (!K) return { stackedDatasets: [], unstackedDatasets: [] };
788
- const D = Gt(
789
- h,
767
+ isLoaded: X
768
+ }), p.useEffect(() => {
769
+ const v = () => z(window.innerHeight);
770
+ return window.addEventListener("resize", v), c || u().finally(), i || f().finally(), h || y().finally(), () => window.removeEventListener("resize", v);
771
+ }, []), p.useEffect(() => {
772
+ L && c && g(M, x.start, x.end).finally(
773
+ () => {
774
+ Z(!0), o(D.TRENDS_LOAD_WIDGET, {
775
+ ...O,
776
+ time_period: `${Se(x.end, x.start)}M`
777
+ });
778
+ }
779
+ );
780
+ }, [
781
+ L,
782
+ c,
783
+ I.join(","),
784
+ x.start.getTime(),
785
+ x.end.getTime()
786
+ ]);
787
+ const F = p.useMemo(() => {
788
+ if (!X) return { stackedDatasets: [], unstackedDatasets: [] };
789
+ const v = Gt(
790
+ m,
790
791
  x.start,
791
792
  x.end
792
- ), l = O.length ? D.filter(
793
- (b) => b.top_level_category_guid === O || b.category_guid === O
794
- ) : Bt(D);
793
+ ), d = G.length ? v.filter(
794
+ (b) => b.top_level_category_guid === G || b.category_guid === G
795
+ ) : Ot(v);
795
796
  return {
796
- stackedDatasets: l.filter(Vt),
797
- unstackedDatasets: l.filter(Pt)
797
+ stackedDatasets: d.filter(Pt),
798
+ unstackedDatasets: d.filter(Bt)
798
799
  };
799
- }, [h, O, x]), U = (D, l) => {
800
- V(l ?? P), o(w.TRENDS_CLICK_TOGGLE_VIEW);
801
- }, de = (D) => {
802
- const l = et(D?.[0], 1), b = D?.[1], I = Se(b, l);
803
- L({ start: l, end: b }), o(w.TRENDS_CLICK_TIME_WINDOW, {
804
- time_period: I + "M"
800
+ }, [m, G, x]), ne = (v, d) => {
801
+ de(d ?? A), o(D.TRENDS_CLICK_TOGGLE_VIEW);
802
+ }, q = (v) => {
803
+ const d = et(v?.[0], 1), b = v?.[1], w = Se(b, d);
804
+ H({ start: d, end: b }), o(D.TRENDS_CLICK_TIME_WINDOW, {
805
+ time_period: w + "M"
805
806
  });
806
- }, B = () => {
807
- o(w.TRENDS_CLICK_FILTER);
808
- }, ue = (D) => {
809
- ee(D);
810
- }, se = (D) => {
811
- ee(D), o(w.TRENDS_CLICK_LEGEND, { category: p(D) });
812
- }, le = (D) => {
813
- o(w.TRENDS_HOVER_LEGEND, { category: p(D) });
814
- }, ce = (D) => {
815
- o(w.TRENDS_HOVER_AREA, { category: D });
816
- }, me = (D) => {
817
- o(w.TRENDS_HOVER_POINT, { category: D });
807
+ }, J = () => {
808
+ o(D.TRENDS_CLICK_FILTER);
809
+ }, se = (v) => {
810
+ ae(v);
811
+ }, ce = (v) => {
812
+ ae(v), o(D.TRENDS_CLICK_LEGEND, { category: _(v) });
813
+ }, le = (v) => {
814
+ o(D.TRENDS_HOVER_LEGEND, { category: _(v) });
815
+ }, me = (v) => {
816
+ o(D.TRENDS_HOVER_AREA, { category: v });
817
+ }, he = (v) => {
818
+ o(D.TRENDS_HOVER_POINT, { category: v });
818
819
  };
819
- return !M || !K ? /* @__PURE__ */ e(Le, {}) : /* @__PURE__ */ C(
820
+ return !L || !c || !X ? /* @__PURE__ */ e(Le, {}) : /* @__PURE__ */ C(
820
821
  ut,
821
822
  {
822
- calendarActions: { onRangeChanged: de },
823
+ calendarActions: { onRangeChanged: q },
823
824
  dateRange: x,
824
825
  dateRangeVariant: "timeframebuttons",
825
- onAccountsFilterClick: B,
826
+ onAccountsFilterClick: J,
826
827
  onBackClick: t,
827
828
  onMenuClick: n,
828
829
  sx: s,
829
- title: v.title,
830
+ title: E.title,
830
831
  children: [
831
832
  /* @__PURE__ */ C(
832
833
  S,
833
834
  {
834
835
  sx: {
835
836
  // eslint-disable-next-line no-nested-ternary
836
- px: r ? 48 : c ? 24 : 12
837
+ px: r ? 48 : l ? 24 : 12
837
838
  },
838
839
  children: [
839
840
  /* @__PURE__ */ C(
@@ -846,39 +847,39 @@ const Lo = g.memo(Io), Qe = ({
846
847
  /* @__PURE__ */ e(
847
848
  ft,
848
849
  {
849
- selectedCategoryGuid: O,
850
+ selectedCategoryGuid: G,
850
851
  selectedDateRange: x
851
852
  }
852
853
  ),
853
- /* @__PURE__ */ e(pt, { onTabChange: U, selectedTab: P })
854
+ /* @__PURE__ */ e(pt, { onTabChange: ne, selectedTab: A })
854
855
  ]
855
856
  }
856
857
  ),
857
858
  /* @__PURE__ */ C(S, { alignItems: "center", flexDirection: "row", width: "100%", children: [
858
- /* @__PURE__ */ e(H, { flexGrow: 1, children: O && /* @__PURE__ */ C(Te, { onClick: () => ee(""), sx: { p: 0, pr: 5 }, children: [
859
+ /* @__PURE__ */ e(W, { flexGrow: 1, children: G && /* @__PURE__ */ C(Te, { onClick: () => ae(""), sx: { p: 0, pr: 5 }, children: [
859
860
  /* @__PURE__ */ e(He, { name: "arrow_back" }),
860
- v.all_categories
861
+ E.all_categories
861
862
  ] }) }),
862
- /* @__PURE__ */ e(Te, { onClick: () => J(!0), sx: { px: 5 }, children: `${v.view_transactions} (${N.length})` })
863
+ /* @__PURE__ */ e(Te, { onClick: () => oe(!0), sx: { px: 5 }, children: `${E.view_transactions} (${T.length})` })
863
864
  ] }),
864
- /* @__PURE__ */ C(H, { children: [
865
- P === "Chart" && /* @__PURE__ */ e(
866
- So,
865
+ /* @__PURE__ */ C(W, { children: [
866
+ A === "Chart" && /* @__PURE__ */ e(
867
+ To,
867
868
  {
868
- availableHeight: j,
869
- onClickLegend: se,
870
- onHoverArea: ce,
869
+ availableHeight: Q,
870
+ onClickLegend: ce,
871
+ onHoverArea: me,
871
872
  onHoverLegend: le,
872
- onHoverPoint: me,
873
- stackedDatasets: ne.stackedDatasets,
874
- unstackedDatasets: ne.unstackedDatasets
873
+ onHoverPoint: he,
874
+ stackedDatasets: F.stackedDatasets,
875
+ unstackedDatasets: F.unstackedDatasets
875
876
  }
876
877
  ),
877
- P === "Table" && /* @__PURE__ */ e(
878
+ A === "Table" && /* @__PURE__ */ e(
878
879
  yt,
879
880
  {
880
- onClickRow: ue,
881
- selectedCategory: O,
881
+ onClickRow: se,
882
+ selectedCategory: G,
882
883
  selectedDateRange: x
883
884
  }
884
885
  )
@@ -887,19 +888,19 @@ const Lo = g.memo(Io), Qe = ({
887
888
  }
888
889
  ),
889
890
  /* @__PURE__ */ e(
890
- Ao,
891
+ Mo,
891
892
  {
892
- categoryGuid: O,
893
+ categoryGuid: G,
893
894
  dateRange: x,
894
- isOpen: Y,
895
- onClose: () => J(!1)
895
+ isOpen: te,
896
+ onClose: () => oe(!1)
896
897
  }
897
898
  )
898
899
  ]
899
900
  }
900
901
  );
901
- }, rs = A(Ro), ko = () => {
902
- const { monthlyCategoryTotals: t } = q(), { trends: n } = R(), s = Z(), { availableHeight: o = 300 } = st(), r = g.useMemo(() => zt(t), [t]);
902
+ }, ss = R(Ao), Ro = () => {
903
+ const { monthlyCategoryTotals: t } = U(), { trends: n } = k(), s = K(), { availableHeight: o = 300 } = st(), r = p.useMemo(() => Vt(t), [t]);
903
904
  return /* @__PURE__ */ e(
904
905
  Ve,
905
906
  {
@@ -916,39 +917,39 @@ const Lo = g.memo(Io), Qe = ({
916
917
  valueFormatterString: "0,0"
917
918
  }
918
919
  );
919
- }, Ho = A(ko), No = ({ onPrimaryCtaClick: t, sx: n }) => {
920
- const { isAccountDataLoaded: s, loadAccountData: o } = De(), { loadMonthlyCategoryTotals: r, monthlyTotalsLoaded: c } = q(), { isInitialized: a } = Be(), { trends: d } = R(), { selectedAccounts: u } = fe();
921
- return g.useEffect(() => {
920
+ }, ko = R(Ro), Ho = ({ onPrimaryCtaClick: t, sx: n }) => {
921
+ const { isAccountDataLoaded: s, loadAccountData: o } = De(), { loadMonthlyCategoryTotals: r, monthlyTotalsLoaded: l } = U(), { isInitialized: a } = Be(), { trends: c } = k(), { selectedAccounts: u } = ye();
922
+ return p.useEffect(() => {
922
923
  s || o().finally();
923
924
  }, []), Ie({
924
925
  widgetName: "TrendsMiniWidget",
925
- isLoaded: c
926
- }), g.useEffect(() => {
926
+ isLoaded: l
927
+ }), p.useEffect(() => {
927
928
  a && s && r(u).finally();
928
- }, [s, a, u]), !s || !a || !c ? /* @__PURE__ */ e(Le, {}) : /* @__PURE__ */ e(
929
- Qt,
929
+ }, [s, a, u]), !s || !a || !l ? /* @__PURE__ */ e(Le, {}) : /* @__PURE__ */ e(
930
+ Zt,
930
931
  {
931
932
  contentStyles: { height: "calc(100% - 72px)", minHeight: 300, ":last-child": { pb: 0 } },
932
933
  onPrimaryCtaClick: t,
933
- primaryCtaLabel: d.primary_cta,
934
- subTitle: d.sub_title,
934
+ primaryCtaLabel: c.primary_cta,
935
+ subTitle: c.sub_title,
935
936
  sx: { height: "100%", ...n },
936
- title: d.mini_title,
937
- children: /* @__PURE__ */ e(Ho, {})
937
+ title: c.mini_title,
938
+ children: /* @__PURE__ */ e(ko, {})
938
939
  }
939
940
  );
940
- }, as = A(No), Wo = 70, qe = ({
941
+ }, rs = R(Ho), No = 70, qe = ({
941
942
  title: t,
942
943
  totalAmount: n,
943
944
  transactionType: s,
944
945
  percentage: o,
945
946
  secondaryLabel: r,
946
- shouldDisplayPercentage: c
947
+ shouldDisplayPercentage: l
947
948
  }) => {
948
- const { availableWidth: a } = st(), d = g.useRef(null), u = g.useRef(null), i = Wt(Number(Math.abs(o)), {
949
+ const { availableWidth: a } = st(), c = p.useRef(null), u = p.useRef(null), i = Nt(Number(Math.abs(o)), {
949
950
  style: "percent",
950
951
  minimumIntegerDigits: 1
951
- }), f = a === 288 && re(n, "0,0.00").length > 10 ? re(n, "0,0") : re(n, "0,0.00"), m = s === "spending" ? o > 0 : o >= 0, _ = s === "spending" ? "error.main" : "success.main", h = s === "spending" ? "success.main" : "text.secondary", p = d?.current, y = u?.current, T = p && y ? p.scrollWidth > y.clientWidth - Wo : !1;
952
+ }), f = a === 288 && re(n, "0,0.00").length > 10 ? re(n, "0,0") : re(n, "0,0.00"), m = s === "spending" ? o > 0 : o >= 0, _ = s === "spending" ? "error.main" : "success.main", g = s === "spending" ? "success.main" : "text.secondary", h = c?.current, y = u?.current, T = h && y ? h.scrollWidth > y.clientWidth - No : !1;
952
953
  return /* @__PURE__ */ C(
953
954
  S,
954
955
  {
@@ -971,14 +972,14 @@ const Lo = g.memo(Io), Qe = ({
971
972
  justifyContent: "space-between"
972
973
  },
973
974
  children: [
974
- /* @__PURE__ */ e(pe, { color: "text.secondary", variant: "caption", children: t }),
975
- c && /* @__PURE__ */ C(S, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
976
- m ? /* @__PURE__ */ e(Jt, { size: 20, sx: { color: _ } }) : /* @__PURE__ */ e(eo, { size: 20, sx: { color: h } }),
975
+ /* @__PURE__ */ e(fe, { color: "text.secondary", variant: "caption", children: t }),
976
+ l && /* @__PURE__ */ C(S, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
977
+ m ? /* @__PURE__ */ e(qt, { size: 20, sx: { color: _ } }) : /* @__PURE__ */ e(Jt, { size: 20, sx: { color: g } }),
977
978
  /* @__PURE__ */ e(
978
- pe,
979
+ fe,
979
980
  {
980
981
  sx: {
981
- color: m ? _ : h,
982
+ color: m ? _ : g,
982
983
  fontWeight: 600
983
984
  },
984
985
  variant: "body2",
@@ -1000,17 +1001,17 @@ const Lo = g.memo(Io), Qe = ({
1000
1001
  },
1001
1002
  children: [
1002
1003
  /* @__PURE__ */ e(
1003
- H,
1004
+ W,
1004
1005
  {
1005
- ref: d,
1006
+ ref: c,
1006
1007
  sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
1007
- children: /* @__PURE__ */ e(Ge, { children: f })
1008
+ children: /* @__PURE__ */ e(Oe, { children: f })
1008
1009
  }
1009
1010
  ),
1010
- c && a >= 450 && !T && /* @__PURE__ */ e(
1011
- pe,
1011
+ l && a >= 450 && !T && /* @__PURE__ */ e(
1012
+ fe,
1012
1013
  {
1013
- color: m ? _ : h,
1014
+ color: m ? _ : g,
1014
1015
  variant: "caption",
1015
1016
  children: r
1016
1017
  }
@@ -1021,54 +1022,54 @@ const Lo = g.memo(Io), Qe = ({
1021
1022
  ]
1022
1023
  }
1023
1024
  );
1024
- }, Oo = A(() => {
1025
- const { trends: t } = R();
1025
+ }, Wo = R(() => {
1026
+ const { trends: t } = k();
1026
1027
  return /* @__PURE__ */ C(S, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
1027
- /* @__PURE__ */ e(to, { size: 32 }),
1028
+ /* @__PURE__ */ e(eo, { size: 32 }),
1028
1029
  /* @__PURE__ */ C(S, { children: [
1029
- /* @__PURE__ */ e(pe, { fontWeight: 600, variant: "body1", children: t.zero_state_content_header }),
1030
- /* @__PURE__ */ e(pe, { color: "text.secondary", variant: "subtitle2", children: t.zero_state_content_description })
1030
+ /* @__PURE__ */ e(fe, { fontWeight: 600, variant: "body1", children: t.zero_state_content_header }),
1031
+ /* @__PURE__ */ e(fe, { color: "text.secondary", variant: "subtitle2", children: t.zero_state_content_description })
1031
1032
  ] })
1032
1033
  ] });
1033
- }), is = A(({ onCtaClick: t }) => {
1034
+ }), as = R(({ onCtaClick: t }) => {
1034
1035
  const { isAccountDataLoaded: n, loadAccountData: s, visibleAccounts: o } = De();
1035
- g.useEffect(() => {
1036
+ p.useEffect(() => {
1036
1037
  n || s().finally();
1037
1038
  }, []);
1038
- const { onEvent: r } = $(), { monthlyCategoryTotals: c, loadMonthlyCategoryTotals: a, monthlyTotalsLoaded: d } = q(), u = {
1039
- start: qt(/* @__PURE__ */ new Date(), 1),
1039
+ const { onEvent: r } = V(), { monthlyCategoryTotals: l, loadMonthlyCategoryTotals: a, monthlyTotalsLoaded: c } = U(), u = {
1040
+ start: Qt(/* @__PURE__ */ new Date(), 1),
1040
1041
  end: /* @__PURE__ */ new Date()
1041
- }, { trends: i } = R(), { selectedAccounts: f, isInitialized: m } = fe();
1042
+ }, { trends: i } = k(), { selectedAccounts: f, isInitialized: m } = ye();
1042
1043
  Ie({
1043
1044
  widgetName: "TrendsMicroWidget",
1044
- isLoaded: d
1045
- }), g.useEffect(() => {
1045
+ isLoaded: c
1046
+ }), p.useEffect(() => {
1046
1047
  m && a(f, u.start).then(() => {
1047
- r(w.TRENDS_LOAD_WIDGET, {
1048
+ r(D.TRENDS_LOAD_WIDGET, {
1048
1049
  state: o?.length ? "default" : "zeroState"
1049
1050
  });
1050
1051
  });
1051
1052
  }, [m, f]);
1052
- const { spendingData: _, incomeData: h } = g.useMemo(
1053
+ const { spendingData: _, incomeData: g } = p.useMemo(
1053
1054
  () => ({
1054
- spendingData: it(c, u),
1055
- incomeData: at(c, u)
1055
+ spendingData: it(l, u),
1056
+ incomeData: at(l, u)
1056
1057
  }),
1057
- [c, u]
1058
- ), [p, y] = _, [T, N] = h, x = Ye(y.y, p.y), L = Ye(N.y, T.y), M = m && !o?.length, E = () => {
1058
+ [l, u]
1059
+ ), [h, y] = _, [T, x] = g, H = Ke(y.y, h.y), L = Ke(x.y, T.y), M = m && !o?.length, I = () => {
1059
1060
  r(
1060
- M ? w.TRENDS_CLICK_GET_STARTED : w.TRENDS_CLICK_VIEW_MORE
1061
+ M ? D.TRENDS_CLICK_GET_STARTED : D.TRENDS_CLICK_VIEW_MORE
1061
1062
  ), t();
1062
1063
  };
1063
- return !d || !m ? /* @__PURE__ */ e(Le, {}) : /* @__PURE__ */ e(
1064
- ao,
1064
+ return !c || !m ? /* @__PURE__ */ e(Le, {}) : /* @__PURE__ */ e(
1065
+ ro,
1065
1066
  {
1066
1067
  className: "mx-trends-microwidget",
1067
1068
  ctaLabel: i.micro_primary_cta_label,
1068
- onCTAClick: E,
1069
+ onCTAClick: I,
1069
1070
  subHeader: M ? void 0 : i.micro_subheader,
1070
1071
  title: i.title,
1071
- children: M ? /* @__PURE__ */ e(Oo, {}) : /* @__PURE__ */ C(
1072
+ children: M ? /* @__PURE__ */ e(Wo, {}) : /* @__PURE__ */ C(
1072
1073
  S,
1073
1074
  {
1074
1075
  sx: {
@@ -1080,9 +1081,9 @@ const Lo = g.memo(Io), Qe = ({
1080
1081
  /* @__PURE__ */ e(
1081
1082
  qe,
1082
1083
  {
1083
- percentage: x,
1084
+ percentage: H,
1084
1085
  secondaryLabel: i.micro_secondary_label,
1085
- shouldDisplayPercentage: y.y !== 0 && p.y !== 0,
1086
+ shouldDisplayPercentage: y.y !== 0 && h.y !== 0,
1086
1087
  title: i.spending_label,
1087
1088
  totalAmount: y.y,
1088
1089
  transactionType: "spending"
@@ -1093,9 +1094,9 @@ const Lo = g.memo(Io), Qe = ({
1093
1094
  {
1094
1095
  percentage: L,
1095
1096
  secondaryLabel: i.micro_secondary_label,
1096
- shouldDisplayPercentage: N.y !== 0 && T.y !== 0,
1097
+ shouldDisplayPercentage: x.y !== 0 && T.y !== 0,
1097
1098
  title: i.income_label,
1098
- totalAmount: N.y,
1099
+ totalAmount: x.y,
1099
1100
  transactionType: "income"
1100
1101
  }
1101
1102
  )
@@ -1104,17 +1105,17 @@ const Lo = g.memo(Io), Qe = ({
1104
1105
  )
1105
1106
  }
1106
1107
  );
1107
- }), Go = A(
1108
+ }), Go = R(
1108
1109
  ({ isExpanded: t, onClick: n }) => {
1109
- const s = Z();
1110
- return /* @__PURE__ */ e(mt, { children: /* @__PURE__ */ e(lo, { onClick: n, sx: { justifyContent: "center" }, children: /* @__PURE__ */ C(
1110
+ const s = K();
1111
+ return /* @__PURE__ */ e(mt, { children: /* @__PURE__ */ e(io, { onClick: n, sx: { justifyContent: "center" }, children: /* @__PURE__ */ C(
1111
1112
  S,
1112
1113
  {
1113
1114
  sx: { color: s.palette.primary.main, flexDirection: "row", alignItems: "center" },
1114
1115
  children: [
1115
- /* @__PURE__ */ e(ht, { children: /* @__PURE__ */ e(F, { bold: !0, variant: "body2", children: t ? "View less" : "View more" }) }),
1116
- /* @__PURE__ */ e(co, { sx: { color: s.palette.primary.main }, children: t ? /* @__PURE__ */ e(oo, {}) : /* @__PURE__ */ e(
1117
- no,
1116
+ /* @__PURE__ */ e(ht, { children: /* @__PURE__ */ e(P, { bold: !0, variant: "body2", children: t ? "View less" : "View more" }) }),
1117
+ /* @__PURE__ */ e(co, { sx: { color: s.palette.primary.main }, children: t ? /* @__PURE__ */ e(to, {}) : /* @__PURE__ */ e(
1118
+ oo,
1118
1119
  {
1119
1120
  sx: {
1120
1121
  transition: "transform 0.3s ease-in-out",
@@ -1126,89 +1127,89 @@ const Lo = g.memo(Io), Qe = ({
1126
1127
  }
1127
1128
  ) }) });
1128
1129
  }
1129
- ), Je = A(
1130
+ ), Je = R(
1130
1131
  ({
1131
1132
  totalAmount: t,
1132
1133
  guid: n,
1133
1134
  name: s,
1134
1135
  transactions: o,
1135
1136
  onClick: r,
1136
- isLastItem: c = !1,
1137
+ isLastItem: l = !1,
1137
1138
  showDivider: a = !0
1138
1139
  }) => {
1139
- const { trends: d } = R(), { onEvent: u } = $(), i = Z(), f = `${o.length} ${o.length === 1 ? d.transaction : d.transactions}`, m = () => {
1140
- r?.(), u(w.TRENDS_CLICK_LIST_ITEM, {
1141
- ...W,
1140
+ const { trends: c } = k(), { onEvent: u } = V(), i = K(), f = `${o.length} ${o.length === 1 ? c.transaction : c.transactions}`, m = () => {
1141
+ r?.(), u(D.TRENDS_CLICK_LIST_ITEM, {
1142
+ ...O,
1142
1143
  listItem: s
1143
1144
  });
1144
1145
  };
1145
- return /* @__PURE__ */ C(g.Fragment, { children: [
1146
+ return /* @__PURE__ */ C(p.Fragment, { children: [
1146
1147
  /* @__PURE__ */ e(
1147
- uo,
1148
+ lo,
1148
1149
  {
1149
1150
  leftIcon: n ? /* @__PURE__ */ e(
1150
1151
  ve,
1151
1152
  {
1152
1153
  categoryGuid: n,
1153
1154
  sx: {
1154
- bgcolor: Mt(Oe(n, i), 0.15),
1155
- border: `1px solid ${Oe(n, i)}`,
1155
+ bgcolor: Et(Ge(n, i), 0.15),
1156
+ border: `1px solid ${Ge(n, i)}`,
1156
1157
  color: "text.primary"
1157
1158
  }
1158
1159
  }
1159
1160
  ) : void 0,
1160
1161
  onClick: m,
1161
1162
  rightContent: re(Math.abs(t), "0,0.00"),
1162
- rightIcon: r ? /* @__PURE__ */ e(so, {}) : void 0,
1163
+ rightIcon: r ? /* @__PURE__ */ e(no, {}) : void 0,
1163
1164
  subtitle: f,
1164
1165
  title: s
1165
1166
  }
1166
1167
  ),
1167
- a && /* @__PURE__ */ e(Ne, { component: "li", sx: { ml: c ? 24 : 68 } })
1168
+ a && /* @__PURE__ */ e(Ne, { component: "li", sx: { ml: l ? 24 : 68 } })
1168
1169
  ] }, n);
1169
1170
  }
1170
- ), Bo = A(
1171
+ ), Oo = R(
1171
1172
  ({ availableHeight: t = 0, onCategoryClick: n }) => {
1172
- const { collapsedCategories: s, visibleCategories: o, setVisibleListLength: r } = ye(), { isLargeDesktop: c, isDesktop: a } = Q(), { trends: d } = R(), { onEvent: u } = $(), [i, f] = g.useState(!1), m = a || c;
1173
- g.useEffect(() => {
1174
- const p = Math.floor(t / 64) - 1, y = o.length + s.length;
1175
- p !== o.length && (r(m ? Math.max(p, 5) : 5), f(p >= y));
1173
+ const { collapsedCategories: s, visibleCategories: o, setVisibleListLength: r } = Ce(), { isLargeDesktop: l, isDesktop: a } = Y(), { trends: c } = k(), { onEvent: u } = V(), [i, f] = p.useState(!1), m = a || l;
1174
+ p.useEffect(() => {
1175
+ const h = Math.floor(t / 64) - 1, y = o.length + s.length;
1176
+ h !== o.length && (r(m ? Math.max(h, 5) : 5), f(h >= y));
1176
1177
  }, [t]);
1177
1178
  const _ = () => {
1178
- f(!i), u(w.TRENDS_CLICK_VIEW_MORE, {
1179
- ...W
1179
+ f(!i), u(D.TRENDS_CLICK_VIEW_MORE, {
1180
+ ...O
1180
1181
  });
1181
- }, h = o.length + (i ? s.length : 0);
1182
+ }, g = o.length + (i ? s.length : 0);
1182
1183
  return /* @__PURE__ */ C(S, { sx: { width: "100%" }, children: [
1183
- /* @__PURE__ */ e(S, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(Ge, { children: d.categories }) }),
1184
+ /* @__PURE__ */ e(S, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(Oe, { children: c.categories }) }),
1184
1185
  /* @__PURE__ */ C(We, { children: [
1185
- o.map((p, y) => /* @__PURE__ */ e(
1186
+ o.map((h, y) => /* @__PURE__ */ e(
1186
1187
  Je,
1187
1188
  {
1188
- ...p,
1189
- isLastItem: y === h - 1,
1190
- onClick: p.transactions.length > 0 ? () => n(p) : void 0,
1189
+ ...h,
1190
+ isLastItem: y === g - 1,
1191
+ onClick: h.transactions.length > 0 ? () => n(h) : void 0,
1191
1192
  showDivider: !0
1192
1193
  },
1193
- p.guid
1194
+ h.guid
1194
1195
  )),
1195
1196
  /* @__PURE__ */ e(
1196
- io,
1197
+ ao,
1197
1198
  {
1198
1199
  component: "li",
1199
1200
  in: i,
1200
1201
  sx: { "&.MuiCollapse-root .MuiListItemButton-root": { paddingLeft: 24 } },
1201
- children: /* @__PURE__ */ e(We, { children: s.map((p, y) => {
1202
+ children: /* @__PURE__ */ e(We, { children: s.map((h, y) => {
1202
1203
  const T = o.length + y;
1203
1204
  return /* @__PURE__ */ e(
1204
1205
  Je,
1205
1206
  {
1206
- ...p,
1207
- isLastItem: T === h - 1,
1208
- onClick: p.transactions.length > 0 ? () => n(p) : void 0,
1207
+ ...h,
1208
+ isLastItem: T === g - 1,
1209
+ onClick: h.transactions.length > 0 ? () => n(h) : void 0,
1209
1210
  showDivider: !0
1210
1211
  },
1211
- p.guid
1212
+ h.guid
1212
1213
  );
1213
1214
  }) })
1214
1215
  }
@@ -1217,17 +1218,17 @@ const Lo = g.memo(Io), Qe = ({
1217
1218
  ] })
1218
1219
  ] });
1219
1220
  }
1220
- ), Po = ({ beats: t, onInsightCardClick: n }) => {
1221
- const { onEvent: s } = $(), { isMobile: o, isDesktop: r, isLargeDesktop: c } = Q(), { beatStore: a, endpoint: d, sessionToken: u } = Be(), i = r || c, f = i || o ? 1 : 2, m = () => null, _ = (T) => {
1222
- n?.(T), s(w.TRENDS_CLICK_INSIGHT, W);
1223
- }, h = i ? 200 : 170, p = i ? 170 : 124, y = t.length > 0 ? h : p;
1224
- return /* @__PURE__ */ e(mo, { sx: { height: y }, children: /* @__PURE__ */ e(
1225
- Kt,
1221
+ ), Bo = ({ beats: t, onInsightCardClick: n }) => {
1222
+ const { onEvent: s } = V(), { isMobile: o, isDesktop: r, isLargeDesktop: l } = Y(), { beatStore: a, endpoint: c, sessionToken: u } = Be(), i = r || l, f = i || o ? 1 : 2, m = () => null, _ = (T) => {
1223
+ n?.(T), s(D.TRENDS_CLICK_INSIGHT, O);
1224
+ }, g = i ? 200 : 170, h = i ? 170 : 124, y = t.length > 0 ? g : h;
1225
+ return /* @__PURE__ */ e(uo, { sx: { height: y }, children: /* @__PURE__ */ e(
1226
+ $t,
1226
1227
  {
1227
1228
  areBeatsLoading: a.isLoading,
1228
1229
  beats: t,
1229
1230
  cardStyle: "border",
1230
- endpoint: d,
1231
+ endpoint: c,
1231
1232
  headerSx: { p: 0 },
1232
1233
  logOutUser: m,
1233
1234
  onCardClick: _,
@@ -1240,10 +1241,10 @@ const Lo = g.memo(Io), Qe = ({
1240
1241
  visibleCardsCount: f
1241
1242
  }
1242
1243
  ) });
1243
- }, Vo = A(Po), zo = A(({ chartLabel: t, chartColor: n }) => {
1244
- const { onEvent: s } = $(), {
1244
+ }, Po = R(Bo), Vo = R(({ chartLabel: t, chartColor: n }) => {
1245
+ const { onEvent: s } = V(), {
1245
1246
  categoryDetailsChartData: { monthlyAmounts: o, tooltipLabels: r }
1246
- } = ye();
1247
+ } = Ce();
1247
1248
  return /* @__PURE__ */ e(S, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
1248
1249
  Ve,
1249
1250
  {
@@ -1258,7 +1259,7 @@ const Lo = g.memo(Io), Qe = ({
1258
1259
  stroke: n
1259
1260
  }),
1260
1261
  onItemClick: () => {
1261
- s(w.TRENDS_CLICK_CHART, W);
1262
+ s(D.TRENDS_CLICK_CHART, O);
1262
1263
  },
1263
1264
  showArea: !0,
1264
1265
  showAverage: !0,
@@ -1273,22 +1274,22 @@ const Lo = g.memo(Io), Qe = ({
1273
1274
  valueFormatterString: "0,0"
1274
1275
  }
1275
1276
  ) });
1276
- }), Fo = A(() => {
1277
- const t = Z(), { is_mobile_webview: n } = rt(), { isDesktop: s, isSmallTablet: o, isTablet: r } = Q(), { common: c, trends: a } = R(), { selectedCategoryData: d, selectedDateRangeMonthRange: u } = ye(), { sortedTransactions: i } = we(), [f, m] = g.useState(null);
1278
- if (!d)
1277
+ }), zo = R(() => {
1278
+ const t = K(), { is_mobile_webview: n } = rt(), { isDesktop: s, isSmallTablet: o, isTablet: r } = Y(), { common: l, trends: a } = k(), { selectedCategoryData: c, selectedDateRangeMonthRange: u } = Ce(), { sortedTransactions: i } = we(), [f, m] = p.useState(null);
1279
+ if (!c)
1279
1280
  return null;
1280
- const { guid: _, name: h, is_income: p, totalAmount: y } = d, T = Oe(_, t), N = p ? a.income_label : a.spending_label, x = ` ${d.transactions.length === 1 ? a.transaction : a.transactions} (${d.transactions.length})`, L = g.useMemo(
1281
- () => i.find((v) => v.guid === f),
1281
+ const { guid: _, name: g, is_income: h, totalAmount: y } = c, T = Ge(_, t), x = h ? a.income_label : a.spending_label, H = ` ${c.transactions.length === 1 ? a.transaction : a.transactions} (${c.transactions.length})`, L = p.useMemo(
1282
+ () => i.find((E) => E.guid === f),
1282
1283
  [f, i]
1283
- ), M = i.length > 0 && !n && (s || r && !o), E = (v) => v.category_guid === _ || v.top_level_category_guid === _;
1284
+ ), M = i.length > 0 && !n && (s || r && !o), I = (E) => E.category_guid === _ || E.top_level_category_guid === _;
1284
1285
  return /* @__PURE__ */ C(S, { sx: { alignItems: "center", height: "100%" }, children: [
1285
1286
  /* @__PURE__ */ C(S, { sx: { borderRadius: 0, pb: 4, pt: 16, px: 12, width: "100%" }, children: [
1286
1287
  /* @__PURE__ */ e(We, { sx: { px: 12 }, children: /* @__PURE__ */ C(mt, { children: [
1287
- /* @__PURE__ */ e(ho, { children: /* @__PURE__ */ e(ve, { categoryGuid: _ }) }),
1288
+ /* @__PURE__ */ e(mo, { children: /* @__PURE__ */ e(ve, { categoryGuid: _ }) }),
1288
1289
  /* @__PURE__ */ e(
1289
1290
  ht,
1290
1291
  {
1291
- primary: h,
1292
+ primary: g,
1292
1293
  secondary: u,
1293
1294
  slotProps: {
1294
1295
  primary: { component: "div", variant: "h3", fontSize: 18, fontWeight: 700 },
@@ -1296,19 +1297,19 @@ const Lo = g.memo(Io), Qe = ({
1296
1297
  }
1297
1298
  }
1298
1299
  ),
1299
- /* @__PURE__ */ e(F, { component: "div", variant: "h3", children: re(Math.abs(y), "0,0.00") })
1300
+ /* @__PURE__ */ e(P, { component: "div", variant: "h3", children: re(Math.abs(y), "0,0.00") })
1300
1301
  ] }) }),
1301
- /* @__PURE__ */ e(zo, { chartColor: T, chartLabel: N }),
1302
+ /* @__PURE__ */ e(Vo, { chartColor: T, chartLabel: x }),
1302
1303
  /* @__PURE__ */ C(S, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 12 }, children: [
1303
- /* @__PURE__ */ e(F, { bold: !0, variant: "body1", children: x }),
1304
- M && /* @__PURE__ */ e(go, { filter: E })
1304
+ /* @__PURE__ */ e(P, { bold: !0, variant: "body1", children: H }),
1305
+ M && /* @__PURE__ */ e(ho, { filter: I })
1305
1306
  ] })
1306
1307
  ] }),
1307
1308
  /* @__PURE__ */ e(
1308
- ct,
1309
+ lt,
1309
1310
  {
1310
1311
  bgcolor: "transparent",
1311
- filter: E,
1312
+ filter: I,
1312
1313
  height: "calc(100vh - 475px)",
1313
1314
  onClick: m
1314
1315
  }
@@ -1316,7 +1317,7 @@ const Lo = g.memo(Io), Qe = ({
1316
1317
  /* @__PURE__ */ e(
1317
1318
  Pe,
1318
1319
  {
1319
- ariaLabelClose: c.close_aria,
1320
+ ariaLabelClose: l.close_aria,
1320
1321
  isOpen: !!L,
1321
1322
  onClose: () => m(""),
1322
1323
  title: a.transaction,
@@ -1324,30 +1325,30 @@ const Lo = g.memo(Io), Qe = ({
1324
1325
  }
1325
1326
  )
1326
1327
  ] });
1327
- }), $o = (t, n) => {
1328
+ }), Fo = (t, n) => {
1328
1329
  const s = at(t, n), o = it(t, n);
1329
1330
  return [s, o].filter((r) => r.length > 0);
1330
- }, Ko = (t, n) => {
1331
- const [s, o] = t, r = s, c = o ?? s, a = [];
1331
+ }, $o = (t, n) => {
1332
+ const [s, o] = t, r = s, l = o ?? s, a = [];
1332
1333
  if (r) {
1333
- const d = r.reduce((u, i) => u + i.y, 0);
1334
- a.push({ label: n.income_label, amount: d });
1334
+ const c = r.reduce((u, i) => u + i.y, 0);
1335
+ a.push({ label: n.income_label, amount: c });
1335
1336
  }
1336
- if (c) {
1337
- const d = c.reduce((u, i) => u + i.y, 0);
1338
- a.push({ label: n.spending_label, amount: d });
1337
+ if (l) {
1338
+ const c = l.reduce((u, i) => u + i.y, 0);
1339
+ a.push({ label: n.spending_label, amount: c });
1339
1340
  }
1340
1341
  return a;
1341
- }, Yo = ({
1342
+ }, jo = ({
1342
1343
  availableHeight: t = 0,
1343
1344
  minHeight: n = 500,
1344
1345
  selectedDateRange: s,
1345
1346
  totals: o
1346
1347
  }) => {
1347
- const r = Z(), { onEvent: c } = $(), { trends: a } = R(), { isSmallMobile: d, isMobile: u, isSmallTablet: i, isTablet: f } = Q(), m = [r.palette.chart?.chart1, r.palette.chart?.chart2], _ = $o(o, s), h = Ko(_, a), [p, y] = g.useState(0), T = 458, N = 195, x = 56, L = u || d ? N : i || f ? T : p;
1348
- return g.useEffect(() => {
1349
- const E = Math.max(t - x, n);
1350
- y(E);
1348
+ const r = K(), { onEvent: l } = V(), { trends: a } = k(), { isSmallMobile: c, isMobile: u, isSmallTablet: i, isTablet: f } = Y(), m = [r.palette.chart?.chart1, r.palette.chart?.chart2], _ = Fo(o, s), g = $o(_, a), [h, y] = p.useState(0), T = 458, x = 195, H = 56, L = u || c ? x : i || f ? T : h;
1349
+ return p.useEffect(() => {
1350
+ const I = Math.max(t - H, n);
1351
+ y(I);
1351
1352
  }, [t]), /* @__PURE__ */ e(
1352
1353
  Ve,
1353
1354
  {
@@ -1356,9 +1357,9 @@ const Lo = g.memo(Io), Qe = ({
1356
1357
  curveType: "bump",
1357
1358
  datasets: _,
1358
1359
  height: L,
1359
- labels: h,
1360
+ labels: g,
1360
1361
  onItemClick: () => {
1361
- c(w.TRENDS_CLICK_CHART, W);
1362
+ l(D.TRENDS_CLICK_CHART, O);
1362
1363
  },
1363
1364
  showArea: !0,
1364
1365
  showAxisHighlight: !0,
@@ -1371,7 +1372,7 @@ const Lo = g.memo(Io), Qe = ({
1371
1372
  valueFormatterString: "0.0a"
1372
1373
  }
1373
1374
  );
1374
- }, jo = A(Yo), Uo = [
1375
+ }, Ko = R(jo), Yo = [
1375
1376
  "BillAmountNotStandard",
1376
1377
  "CategorySpendingV2",
1377
1378
  "CostOfLivingToIncome",
@@ -1405,101 +1406,102 @@ const Lo = g.memo(Io), Qe = ({
1405
1406
  "WeeklyNewMerchantsV2",
1406
1407
  "WeeklyNoSpendDays",
1407
1408
  "WeeklySmallPurchasesSummary"
1408
- ], Xo = (t, n, s) => ({
1409
+ ], Uo = (t, n, s) => ({
1409
1410
  description: n ? t.empty_state_sub_text : t.empty_state_sub_text_no_aggregation,
1410
1411
  header: n ? t.zero_state_content_header : t.zero_state_content_header_no_aggregation,
1411
1412
  onClickHandler: n ? s : void 0,
1412
1413
  primaryButton: n ? t.empty_state_primary : void 0
1413
- }), Zo = ({
1414
+ }), Xo = ({
1414
1415
  onBackClick: t,
1415
1416
  onMenuClick: n,
1416
1417
  onInsightCardClick: s,
1417
1418
  sx: o
1418
1419
  }) => {
1419
- const { onEvent: r } = $(), { config: c } = rt(), { isDesktop: a, isLargeDesktop: d, isMobile: u } = Q(), { isAccountDataLoaded: i, loadAccountData: f, visibleAccounts: m } = De(), {
1420
+ const { onEvent: r } = V(), { config: l } = rt(), { isDesktop: a, isLargeDesktop: c, isMobile: u } = Y(), { isAccountDataLoaded: i, loadAccountData: f, visibleAccounts: m } = De(), {
1420
1421
  categoriesLoaded: _,
1421
- loadCategories: h,
1422
- loadDateRangeCategoryTotals: p,
1423
- loadMonthlyCategoryTotals: y,
1424
- monthlyCategoryTotals: T,
1425
- monthlyTotalsLoaded: N
1426
- } = q(), { isTransactionDataLoaded: x, loadTransactionData: L, setFilter: M } = we(), { selectedCategoryData: E, selectedDateRange: v, setSelectedCategoryData: K, setSelectedDateRange: ae } = ye(), { isInitialized: Y, selectedAccounts: J, selectedAccountGuids: P } = fe(), { trends: V, connect: O } = R(), { beatStore: ee } = Be(), ie = po() && c.show_insights_widget_in_master, te = a || d, [j, ne] = g.useState(!1), [U, de] = g.useState(!1), [B, ue] = g.useState("Chart"), [se, le] = g.useState(""), [ce, me] = g.useState(window.innerHeight), D = te ? 56 : 0, l = ce - 208, b = ce - (ie ? 550 + D : 266), [I, z] = g.useState(!1), Ee = c.show_connections_widget_in_master;
1422
+ loadCategories: g,
1423
+ monthlyCategoryTotals: h,
1424
+ monthlyTotalsLoaded: y,
1425
+ reloadCategoryTotals: T
1426
+ } = U(), { isTransactionDataLoaded: x, loadTransactionData: H, setFilter: L } = we(), { selectedCategoryData: M, selectedDateRange: I, setSelectedCategoryData: E, setSelectedDateRange: X } = Ce(), { isInitialized: Z, selectedAccounts: te, selectedAccountGuids: oe } = ye(), { trends: A, connect: de } = k(), { beatStore: G } = Be(), ie = go() && l.show_insights_widget_in_master, z = a || c, [ue, Q] = p.useState(!1), [F, ne] = p.useState(!1), [q, J] = p.useState("Chart"), [se, ce] = p.useState(""), [le, me] = p.useState(window.innerHeight), he = z ? 56 : 0, v = le - 208, d = le - (ie ? 550 + he : 266), [b, w] = p.useState(!1), $ = l.show_connections_widget_in_master;
1427
1427
  Ie({
1428
1428
  widgetName: "TrendsWidget",
1429
- isLoaded: j
1429
+ isLoaded: ue
1430
1430
  });
1431
- const _e = g.useMemo(() => U ? ee.getFilteredBeats({ templates: Uo }) : [], [U]);
1432
- g.useEffect(() => {
1433
- const k = () => me(window.innerHeight);
1434
- return window.addEventListener("resize", k), i || f().finally(), _ || h().finally(), x || L().finally(), () => window.removeEventListener("resize", k);
1435
- }, []), g.useEffect(() => {
1436
- Y && i && (ee.loadBeats().finally(() => de(!0)), p(J, v.start, v.end).then(() => {
1437
- y(
1438
- J,
1439
- v.start,
1440
- v.end
1441
- ).finally();
1442
- }).finally(() => {
1443
- ne(!0), r(w.TRENDS_LOAD_WIDGET, {
1444
- ...W,
1445
- time_period: `${Se(v.end, v.start)}M`
1446
- });
1447
- }));
1448
- }, [Y, i, J, v]), g.useEffect(() => {
1449
- if (T.length !== 0) {
1450
- const k = {
1451
- accounts: P,
1452
- dateRange: { start: v.start, end: v.end }
1431
+ const _e = p.useMemo(() => F ? G.getFilteredBeats({ templates: Yo }) : [], [F]);
1432
+ p.useEffect(() => {
1433
+ const N = () => me(window.innerHeight);
1434
+ return window.addEventListener("resize", N), i || f().finally(), _ || g().finally(), x || H().finally(), () => window.removeEventListener("resize", N);
1435
+ }, []), p.useEffect(() => {
1436
+ Z && i && (G.loadBeats().finally(() => ne(!0)), T(te, I.start, I.end).finally(
1437
+ () => {
1438
+ Q(!0), r(D.TRENDS_LOAD_WIDGET, {
1439
+ ...O,
1440
+ time_period: `${Se(I.end, I.start)}M`
1441
+ });
1442
+ }
1443
+ ));
1444
+ }, [
1445
+ Z,
1446
+ i,
1447
+ oe.join(","),
1448
+ I.start.getTime(),
1449
+ I.end.getTime()
1450
+ ]), p.useEffect(() => {
1451
+ if (h.length !== 0) {
1452
+ const N = {
1453
+ accounts: oe,
1454
+ dateRange: { start: I.start, end: I.end }
1453
1455
  };
1454
- M({
1455
- ...k,
1456
- custom: (oe) => !!T.find(
1457
- (ge) => ge.top_level_category_guid === oe.top_level_category_guid || ge.category_guid === oe.category_guid
1456
+ L({
1457
+ ...N,
1458
+ custom: (ee) => !!h.find(
1459
+ (pe) => pe.top_level_category_guid === ee.top_level_category_guid || pe.category_guid === ee.category_guid
1458
1460
  )
1459
1461
  });
1460
1462
  }
1461
- }, [T]);
1462
- const he = (k) => {
1463
- K(k);
1463
+ }, [h]);
1464
+ const Ee = (N) => {
1465
+ E(N);
1466
+ }, ge = () => {
1467
+ E(null), r(D.TRENDS_CLICK_BACK, O);
1464
1468
  }, Me = () => {
1465
- K(null), r(w.TRENDS_CLICK_BACK, W);
1466
- }, Ae = () => {
1467
- z(!0), r(w.TRENDS_CLICK_CONNECT_ACCOUNTS);
1468
- }, Ct = (k, oe) => {
1469
- ue(oe ?? B), r(w.TRENDS_CLICK_TOGGLE_VIEW, {
1470
- ...W,
1471
- toggleView: oe
1469
+ w(!0), r(D.TRENDS_CLICK_CONNECT_ACCOUNTS);
1470
+ }, Ae = (N, ee) => {
1471
+ J(ee ?? q), r(D.TRENDS_CLICK_TOGGLE_VIEW, {
1472
+ ...O,
1473
+ toggleView: ee
1472
1474
  });
1473
- }, _t = (k) => {
1474
- const oe = et(k?.[0], 1), ge = k?.[1], xt = Se(ge, oe);
1475
- ae({ start: oe, end: ge }), r(w.TRENDS_CLICK_TIME_WINDOW, {
1476
- ...W,
1477
- time_period: xt + "M"
1475
+ }, Ct = (N) => {
1476
+ const ee = et(N?.[0], 1), pe = N?.[1], St = Se(pe, ee);
1477
+ X({ start: ee, end: pe }), r(D.TRENDS_CLICK_TIME_WINDOW, {
1478
+ ...O,
1479
+ time_period: St + "M"
1478
1480
  });
1479
- }, bt = (k) => {
1480
- r(w.TRENDS_CLICK_FILTER, {
1481
- ...W,
1482
- filterValue: k
1481
+ }, _t = (N) => {
1482
+ r(D.TRENDS_CLICK_FILTER, {
1483
+ ...O,
1484
+ filterValue: N
1483
1485
  });
1484
- }, Tt = (k) => {
1485
- le(k);
1486
- }, St = () => {
1487
- le(""), r(w.TRENDS_CLICK_ALL_CATEGORIES, W);
1486
+ }, bt = (N) => {
1487
+ ce(N);
1488
+ }, Tt = () => {
1489
+ ce(""), r(D.TRENDS_CLICK_ALL_CATEGORIES, O);
1488
1490
  };
1489
- if (!Y || !i || !j || !N)
1491
+ if (!Z || !i || !ue || !y)
1490
1492
  return /* @__PURE__ */ e(Le, {});
1491
- const ze = m.length === 0 || T.length === 0, be = Xo(V, Ee, Ae);
1493
+ const ze = m.length === 0 || h.length === 0, be = Uo(A, $, Me);
1492
1494
  return /* @__PURE__ */ C(
1493
1495
  ut,
1494
1496
  {
1495
- calendarActions: { onRangeChanged: _t },
1496
- dateRange: v,
1497
+ calendarActions: { onRangeChanged: Ct },
1498
+ dateRange: I,
1497
1499
  dateRangeVariant: u ? "timeframetabs" : "timeframebuttons",
1498
- onAccountsFilterClick: bt,
1500
+ onAccountsFilterClick: _t,
1499
1501
  onBackClick: t,
1500
1502
  onMenuClick: n,
1501
1503
  sx: o,
1502
- title: V.title,
1504
+ title: A.title,
1503
1505
  children: [
1504
1506
  /* @__PURE__ */ C(
1505
1507
  S,
@@ -1519,96 +1521,96 @@ const Lo = g.memo(Io), Qe = ({
1519
1521
  ft,
1520
1522
  {
1521
1523
  selectedCategoryGuid: se,
1522
- selectedDateRange: v
1524
+ selectedDateRange: I
1523
1525
  }
1524
1526
  ),
1525
- /* @__PURE__ */ e(pt, { onTabChange: Ct, selectedTab: B })
1527
+ /* @__PURE__ */ e(pt, { onTabChange: Ae, selectedTab: q })
1526
1528
  ]
1527
1529
  }
1528
1530
  ),
1529
- /* @__PURE__ */ e(S, { alignItems: "center", flexDirection: "row", sx: { pb: 8 }, width: "100%", children: /* @__PURE__ */ e(H, { flexGrow: 1, children: se && /* @__PURE__ */ C(Te, { onClick: St, sx: { p: 0, pr: 5 }, children: [
1530
- /* @__PURE__ */ e(ro, {}),
1531
- V.all_categories
1531
+ /* @__PURE__ */ e(S, { alignItems: "center", flexDirection: "row", sx: { pb: 8 }, width: "100%", children: /* @__PURE__ */ e(W, { flexGrow: 1, children: se && /* @__PURE__ */ C(Te, { onClick: Tt, sx: { p: 0, pr: 5 }, children: [
1532
+ /* @__PURE__ */ e(so, {}),
1533
+ A.all_categories
1532
1534
  ] }) }) }),
1533
1535
  ze && /* @__PURE__ */ e(
1534
- fo,
1536
+ po,
1535
1537
  {
1536
1538
  header: be.header,
1537
1539
  icon: "multiline_chart",
1538
1540
  onClick: be.onClickHandler,
1539
1541
  primaryButton: be.primaryButton,
1540
1542
  subText: be.description,
1541
- sx: { height: l, maxWidth: 432 }
1543
+ sx: { height: v, maxWidth: 432 }
1542
1544
  }
1543
1545
  ),
1544
- !ze && /* @__PURE__ */ C(S, { flexDirection: te ? "row" : "column", gap: te ? 48 : 16, children: [
1545
- B === "Chart" && /* @__PURE__ */ C(vt, { children: [
1546
- /* @__PURE__ */ e(H, { sx: { width: te ? "68%" : "100%" }, children: /* @__PURE__ */ e(
1547
- jo,
1546
+ !ze && /* @__PURE__ */ C(S, { flexDirection: z ? "row" : "column", gap: z ? 48 : 16, children: [
1547
+ q === "Chart" && /* @__PURE__ */ C(xt, { children: [
1548
+ /* @__PURE__ */ e(W, { sx: { width: z ? "68%" : "100%" }, children: /* @__PURE__ */ e(
1549
+ Ko,
1548
1550
  {
1549
- availableHeight: l,
1551
+ availableHeight: v,
1550
1552
  minHeight: 450,
1551
- selectedDateRange: v,
1552
- totals: T
1553
+ selectedDateRange: I,
1554
+ totals: h
1553
1555
  }
1554
1556
  ) }),
1555
- /* @__PURE__ */ C(S, { gap: 16, sx: { width: te ? "32%" : "100%" }, children: [
1556
- ie && U && _e.length > 0 && /* @__PURE__ */ e(
1557
- Vo,
1557
+ /* @__PURE__ */ C(S, { gap: 16, sx: { width: z ? "32%" : "100%" }, children: [
1558
+ ie && F && _e.length > 0 && /* @__PURE__ */ e(
1559
+ Po,
1558
1560
  {
1559
1561
  beats: _e,
1560
1562
  onInsightCardClick: s
1561
1563
  }
1562
1564
  ),
1563
1565
  /* @__PURE__ */ e(
1564
- Bo,
1566
+ Oo,
1565
1567
  {
1566
- availableHeight: b,
1567
- onCategoryClick: he
1568
+ availableHeight: d,
1569
+ onCategoryClick: Ee
1568
1570
  }
1569
1571
  )
1570
1572
  ] })
1571
1573
  ] }),
1572
- B === "Table" && /* @__PURE__ */ e(H, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
1574
+ q === "Table" && /* @__PURE__ */ e(W, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
1573
1575
  yt,
1574
1576
  {
1575
1577
  height: "unset",
1576
- onClickRow: Tt,
1578
+ onClickRow: bt,
1577
1579
  selectedCategory: se,
1578
- selectedDateRange: v
1580
+ selectedDateRange: I
1579
1581
  }
1580
1582
  ) })
1581
1583
  ] }),
1582
1584
  /* @__PURE__ */ e(
1583
1585
  Pe,
1584
1586
  {
1585
- ariaLabelClose: V.close_category_details,
1586
- isOpen: !!E,
1587
- onClose: Me,
1587
+ ariaLabelClose: A.close_category_details,
1588
+ isOpen: !!M,
1589
+ onClose: ge,
1588
1590
  shouldShowHeaderShadow: !0,
1589
- title: E?.is_income ? V.category_income : V.category_spending,
1590
- children: E && /* @__PURE__ */ e(Fo, {})
1591
+ title: M?.is_income ? A.category_income : A.category_spending,
1592
+ children: M && /* @__PURE__ */ e(zo, {})
1591
1593
  }
1592
1594
  )
1593
1595
  ]
1594
1596
  }
1595
1597
  ),
1596
1598
  /* @__PURE__ */ e(
1597
- yo,
1599
+ fo,
1598
1600
  {
1599
- onClose: () => z(!1),
1600
- showConnectWidget: I,
1601
- title: O.mini_title
1601
+ onClose: () => w(!1),
1602
+ showConnectWidget: b,
1603
+ title: de.mini_title
1602
1604
  }
1603
1605
  )
1604
1606
  ]
1605
1607
  }
1606
1608
  );
1607
- }, ls = A(Zo);
1609
+ }, is = R(Xo);
1608
1610
  export {
1609
- rs as TrendsFullWidget,
1610
- is as TrendsMicroWidget,
1611
- as as TrendsMiniWidget,
1612
- ls as TrendsWidget
1611
+ ss as TrendsFullWidget,
1612
+ as as TrendsMicroWidget,
1613
+ rs as TrendsMiniWidget,
1614
+ is as TrendsWidget
1613
1615
  };
1614
1616
  //# sourceMappingURL=index.es.js.map