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

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