@mx-cartographer/experiences 7.3.0-alpha.sms1 → 7.3.0

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