@mx-cartographer/experiences 8.0.0-alpha.bb3 → 8.0.0-alpha.sms1

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