@mx-cartographer/experiences 9.1.0-alpha.bb1 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +10 -10
  3. package/dist/Account-DR7Plrqy.mjs +119 -0
  4. package/dist/Account-DR7Plrqy.mjs.map +1 -0
  5. package/dist/AccountDetailsDrawer-CZPeLsCq.mjs +922 -0
  6. package/dist/AccountDetailsDrawer-CZPeLsCq.mjs.map +1 -0
  7. package/dist/AccountDetailsHeader-BvbCUQSS.mjs +231 -0
  8. package/dist/AccountDetailsHeader-BvbCUQSS.mjs.map +1 -0
  9. package/dist/AccountUtils-B8ZzWI-d.mjs +28 -0
  10. package/dist/AccountUtils-B8ZzWI-d.mjs.map +1 -0
  11. package/dist/Analytics-CkYXKvco.mjs +54 -0
  12. package/dist/Analytics-CkYXKvco.mjs.map +1 -0
  13. package/dist/Analytics-WeZYytR0.mjs +140 -0
  14. package/dist/Analytics-WeZYytR0.mjs.map +1 -0
  15. package/dist/ApiEndpoints-DXwIYNUV.mjs +50 -0
  16. package/dist/ApiEndpoints-DXwIYNUV.mjs.map +1 -0
  17. package/dist/BeatMaterialIcon-1KOfRZrA.mjs +27 -0
  18. package/dist/BeatMaterialIcon-1KOfRZrA.mjs.map +1 -0
  19. package/dist/BudgetUtil-Bg2AQJpQ.mjs +75 -0
  20. package/dist/BudgetUtil-Bg2AQJpQ.mjs.map +1 -0
  21. package/dist/Category-DEKZGLYe.mjs +302 -0
  22. package/dist/Category-DEKZGLYe.mjs.map +1 -0
  23. package/dist/CategorySelectorDrawer-NJsFsKP1.mjs +431 -0
  24. package/dist/CategorySelectorDrawer-NJsFsKP1.mjs.map +1 -0
  25. package/dist/Connect-BH0Pt6zc.mjs +43 -0
  26. package/dist/Connect-BH0Pt6zc.mjs.map +1 -0
  27. package/dist/ConnectCard-D7uxoH5Y.mjs +55 -0
  28. package/dist/ConnectCard-D7uxoH5Y.mjs.map +1 -0
  29. package/dist/ConnectDrawer-CW4LA3H3.mjs +58 -0
  30. package/dist/ConnectDrawer-CW4LA3H3.mjs.map +1 -0
  31. package/dist/ConnectionsDrawer-CZU9ku-k.mjs +54 -0
  32. package/dist/ConnectionsDrawer-CZU9ku-k.mjs.map +1 -0
  33. package/dist/CurrencyDialog-DumQCTPO.mjs +374 -0
  34. package/dist/CurrencyDialog-DumQCTPO.mjs.map +1 -0
  35. package/dist/CurrencyInput-DaGEQaLW.mjs +88 -0
  36. package/dist/CurrencyInput-DaGEQaLW.mjs.map +1 -0
  37. package/dist/CurrencyText-CCbE6MmF.mjs +21 -0
  38. package/dist/CurrencyText-CCbE6MmF.mjs.map +1 -0
  39. package/dist/DateFormats-HudZ3Bjs.mjs +65 -0
  40. package/dist/DateFormats-HudZ3Bjs.mjs.map +1 -0
  41. package/dist/DateUtil-CzBmbjmA.mjs +75 -0
  42. package/dist/DateUtil-CzBmbjmA.mjs.map +1 -0
  43. package/dist/DebtUtils-i4pI2Uoe.mjs +154 -0
  44. package/dist/DebtUtils-i4pI2Uoe.mjs.map +1 -0
  45. package/dist/Dialog-Bvd2n8hz.mjs +67 -0
  46. package/dist/Dialog-Bvd2n8hz.mjs.map +1 -0
  47. package/dist/Donut-SzzfZDHF.mjs +89 -0
  48. package/dist/Donut-SzzfZDHF.mjs.map +1 -0
  49. package/dist/Drawer-DsnW2o0v.mjs +175 -0
  50. package/dist/Drawer-DsnW2o0v.mjs.map +1 -0
  51. package/dist/EmbeddedCard-DH8vQ3qN.mjs +859 -0
  52. package/dist/EmbeddedCard-DH8vQ3qN.mjs.map +1 -0
  53. package/dist/EmptyState-CJUDc3kD.mjs +85 -0
  54. package/dist/EmptyState-CJUDc3kD.mjs.map +1 -0
  55. package/dist/Error-Dtw6yxkf.mjs +85 -0
  56. package/dist/Error-Dtw6yxkf.mjs.map +1 -0
  57. package/dist/ErrorBoundary-CsdOcnJ9.mjs +24 -0
  58. package/dist/ErrorBoundary-CsdOcnJ9.mjs.map +1 -0
  59. package/dist/ExportCsvAction-C9KWH3Az.mjs +25 -0
  60. package/dist/ExportCsvAction-C9KWH3Az.mjs.map +1 -0
  61. package/dist/GlobalAccountFilter-BhzR5Vb1.mjs +230 -0
  62. package/dist/GlobalAccountFilter-BhzR5Vb1.mjs.map +1 -0
  63. package/dist/GlobalCopyApi-wcnDUzMV.mjs +129 -0
  64. package/dist/GlobalCopyApi-wcnDUzMV.mjs.map +1 -0
  65. package/dist/GoalsUtil-C9EnLWvC.mjs +108 -0
  66. package/dist/GoalsUtil-C9EnLWvC.mjs.map +1 -0
  67. package/dist/HeaderCell-P8w6CmfO.mjs +7 -0
  68. package/dist/HeaderCell-P8w6CmfO.mjs.map +1 -0
  69. package/dist/Help-CkQTjORd.mjs +300 -0
  70. package/dist/Help-CkQTjORd.mjs.map +1 -0
  71. package/dist/Help-aERwhajy.mjs +3210 -0
  72. package/dist/Help-aERwhajy.mjs.map +1 -0
  73. package/dist/IconBacking-DgT8DCeh.mjs +40 -0
  74. package/dist/IconBacking-DgT8DCeh.mjs.map +1 -0
  75. package/dist/InformationTooltip-4su8bn1e.mjs +42 -0
  76. package/dist/InformationTooltip-4su8bn1e.mjs.map +1 -0
  77. package/dist/InvestmentUtil-BItV7uEs.mjs +135 -0
  78. package/dist/InvestmentUtil-BItV7uEs.mjs.map +1 -0
  79. package/dist/LineChart-CUfiH86G.mjs +613 -0
  80. package/dist/LineChart-CUfiH86G.mjs.map +1 -0
  81. package/dist/ListItemAction-BqUCLj_w.mjs +70 -0
  82. package/dist/ListItemAction-BqUCLj_w.mjs.map +1 -0
  83. package/dist/ListItemRow-kH1rn8Xu.mjs +68 -0
  84. package/dist/ListItemRow-kH1rn8Xu.mjs.map +1 -0
  85. package/dist/ListItemWrapper-DRse79Iu.mjs +44 -0
  86. package/dist/ListItemWrapper-DRse79Iu.mjs.map +1 -0
  87. package/dist/Loader-CxeBwuPG.mjs +22 -0
  88. package/dist/Loader-CxeBwuPG.mjs.map +1 -0
  89. package/dist/Localization-DnoVyBNK.mjs +39 -0
  90. package/dist/Localization-DnoVyBNK.mjs.map +1 -0
  91. package/dist/ManageIncome-Dcsnnz86.mjs +906 -0
  92. package/dist/ManageIncome-Dcsnnz86.mjs.map +1 -0
  93. package/dist/MicroWidgetContainer-B2NnKBgW.mjs +46 -0
  94. package/dist/MicroWidgetContainer-B2NnKBgW.mjs.map +1 -0
  95. package/dist/MiniWidgetContainer-Bmv_WeUd.mjs +67 -0
  96. package/dist/MiniWidgetContainer-Bmv_WeUd.mjs.map +1 -0
  97. package/dist/NetWorthUtils-DfSH3z70.mjs +96 -0
  98. package/dist/NetWorthUtils-DfSH3z70.mjs.map +1 -0
  99. package/dist/Notification-DTNYSd8P.mjs +8 -0
  100. package/dist/Notification-DTNYSd8P.mjs.map +1 -0
  101. package/dist/NotificationSettings-CW7okUrk.mjs +678 -0
  102. package/dist/NotificationSettings-CW7okUrk.mjs.map +1 -0
  103. package/dist/NotificationUtils-BRGFTePr.mjs +24 -0
  104. package/dist/NotificationUtils-BRGFTePr.mjs.map +1 -0
  105. package/dist/NumberFormatting--XMeeBfr.mjs +50 -0
  106. package/dist/NumberFormatting--XMeeBfr.mjs.map +1 -0
  107. package/dist/OriginalBalanceAction-YrvxBYAl.mjs +115 -0
  108. package/dist/OriginalBalanceAction-YrvxBYAl.mjs.map +1 -0
  109. package/dist/RecurringSettings-D8hBbXV_.mjs +89 -0
  110. package/dist/RecurringSettings-D8hBbXV_.mjs.map +1 -0
  111. package/dist/RecurringTransactionsUtil-CHWmqvW5.mjs +299 -0
  112. package/dist/RecurringTransactionsUtil-CHWmqvW5.mjs.map +1 -0
  113. package/dist/ResponsiveButton-CC9F_Ezk.mjs +46 -0
  114. package/dist/ResponsiveButton-CC9F_Ezk.mjs.map +1 -0
  115. package/dist/SearchBox-Cpgu_gdO.mjs +51 -0
  116. package/dist/SearchBox-Cpgu_gdO.mjs.map +1 -0
  117. package/dist/Select-CSpkK5cR.mjs +62 -0
  118. package/dist/Select-CSpkK5cR.mjs.map +1 -0
  119. package/dist/SelectionBox-B4xELRgp.mjs +49 -0
  120. package/dist/SelectionBox-B4xELRgp.mjs.map +1 -0
  121. package/dist/SingleSegmentDonut-7Uy6VEld.mjs +70 -0
  122. package/dist/SingleSegmentDonut-7Uy6VEld.mjs.map +1 -0
  123. package/dist/Sizes-DISGrlUg.mjs +7 -0
  124. package/dist/Sizes-DISGrlUg.mjs.map +1 -0
  125. package/dist/SkeletonLoader-BaNboJjD.mjs +39 -0
  126. package/dist/SkeletonLoader-BaNboJjD.mjs.map +1 -0
  127. package/dist/SpendingData-Fii_xATx.mjs +54 -0
  128. package/dist/SpendingData-Fii_xATx.mjs.map +1 -0
  129. package/dist/SpendingLegend-CxvNOg3c.mjs +204 -0
  130. package/dist/SpendingLegend-CxvNOg3c.mjs.map +1 -0
  131. package/dist/StatusBar-CPfSXe80.mjs +31 -0
  132. package/dist/StatusBar-CPfSXe80.mjs.map +1 -0
  133. package/dist/TabContentContainer-B0eYJP5p.mjs +49 -0
  134. package/dist/TabContentContainer-B0eYJP5p.mjs.map +1 -0
  135. package/dist/ToggleListItem-Dl1lXNwj.mjs +92 -0
  136. package/dist/ToggleListItem-Dl1lXNwj.mjs.map +1 -0
  137. package/dist/TransactionDetails-roZ5xLq8.mjs +1708 -0
  138. package/dist/TransactionDetails-roZ5xLq8.mjs.map +1 -0
  139. package/dist/TransactionUtils-BphBJBbU.mjs +235 -0
  140. package/dist/TransactionUtils-BphBJBbU.mjs.map +1 -0
  141. package/dist/TrendsUtil-D9z3kIj_.mjs +70 -0
  142. package/dist/TrendsUtil-D9z3kIj_.mjs.map +1 -0
  143. package/dist/UserStore-C1fdL3Iu.mjs +3054 -0
  144. package/dist/UserStore-C1fdL3Iu.mjs.map +1 -0
  145. package/dist/ViewMoreMicroCard-fnwE0hqd.mjs +1280 -0
  146. package/dist/ViewMoreMicroCard-fnwE0hqd.mjs.map +1 -0
  147. package/dist/WidgetContainer-DJnp6t6c.mjs +483 -0
  148. package/dist/WidgetContainer-DJnp6t6c.mjs.map +1 -0
  149. package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsDrawer.d.ts +6 -0
  150. package/dist/accounts/index.d.ts +1 -0
  151. package/dist/accounts/index.es.js +784 -12
  152. package/dist/accounts/index.es.js.map +1 -0
  153. package/dist/analytics/index.es.js +140 -155
  154. package/dist/analytics/index.es.js.map +1 -0
  155. package/dist/budgets/index.es.js +1267 -1317
  156. package/dist/budgets/index.es.js.map +1 -0
  157. package/dist/cashflow/index.es.js +943 -1047
  158. package/dist/cashflow/index.es.js.map +1 -0
  159. package/dist/categories/index.es.js +5 -4
  160. package/dist/categories/index.es.js.map +1 -0
  161. package/dist/common/components/DataRow.d.ts +1 -0
  162. package/dist/common/components/ListItemWrapper.d.ts +2 -1
  163. package/dist/common/constants/Analytics.d.ts +3 -0
  164. package/dist/common/index.es.js +310 -101
  165. package/dist/common/index.es.js.map +1 -0
  166. package/dist/core/index.es.js +105 -80
  167. package/dist/core/index.es.js.map +1 -0
  168. package/dist/core/stores/RecurringTransactionsStore.d.ts +29 -1
  169. package/dist/core/stores/TransactionStore.d.ts +1 -0
  170. package/dist/core/types/localization/RecurringCopy.d.ts +14 -1
  171. package/dist/core/types/localization/SpendingCopy.d.ts +1 -0
  172. package/dist/core/utils/DateUtil.d.ts +2 -0
  173. package/dist/core/utils/RecurringTransactionsUtil.d.ts +2 -1
  174. package/dist/dashboard/index.es.js +142 -185
  175. package/dist/dashboard/index.es.js.map +1 -0
  176. package/dist/debts/index.es.js +1273 -1384
  177. package/dist/debts/index.es.js.map +1 -0
  178. package/dist/finstrong/index.es.js +3473 -3367
  179. package/dist/finstrong/index.es.js.map +1 -0
  180. package/dist/goals/index.es.js +984 -1103
  181. package/dist/goals/index.es.js.map +1 -0
  182. package/dist/help/index.es.js +26 -3
  183. package/dist/help/index.es.js.map +1 -0
  184. package/dist/hooks-97sNJ_lf.mjs +78 -0
  185. package/dist/hooks-97sNJ_lf.mjs.map +1 -0
  186. package/dist/insights/components/insights/WeeklyNoSpendDays/BubbleWeek.d.ts +4 -1
  187. package/dist/insights/components/insights/WeeklyNoSpendDays/WeeklyNoSpendDays.d.ts +4 -2
  188. package/dist/insights/index.es.js +4871 -93
  189. package/dist/insights/index.es.js.map +1 -0
  190. package/dist/investments/index.es.js +1523 -1533
  191. package/dist/investments/index.es.js.map +1 -0
  192. package/dist/merchants/index.es.js +65 -75
  193. package/dist/merchants/index.es.js.map +1 -0
  194. package/dist/microinsights/index.es.js +826 -15
  195. package/dist/microinsights/index.es.js.map +1 -0
  196. package/dist/networth/index.es.js +504 -550
  197. package/dist/networth/index.es.js.map +1 -0
  198. package/dist/notifications/index.es.js +162 -169
  199. package/dist/notifications/index.es.js.map +1 -0
  200. package/dist/recurringtransactions/components/RecurringTransactionDetails.d.ts +3 -2
  201. package/dist/recurringtransactions/components/RecurringTransactionDetailsDrawer.d.ts +3 -0
  202. package/dist/recurringtransactions/components/RecurringTransactionList.d.ts +11 -0
  203. package/dist/recurringtransactions/components/UpcomingRecurrenceCard.d.ts +8 -0
  204. package/dist/recurringtransactions/components/actions/LinkTransactionDrawer.d.ts +10 -0
  205. package/dist/recurringtransactions/components/actions/MarkAsPaidDialog.d.ts +7 -0
  206. package/dist/recurringtransactions/components/actions/MarkAsUnpaidDialog.d.ts +7 -0
  207. package/dist/recurringtransactions/index.es.js +1012 -10
  208. package/dist/recurringtransactions/index.es.js.map +1 -0
  209. package/dist/settings/index.es.js +892 -13
  210. package/dist/settings/index.es.js.map +1 -0
  211. package/dist/spending/index.es.js +457 -400
  212. package/dist/spending/index.es.js.map +1 -0
  213. package/dist/transactions/components/shared/transactionlist/TransactionRow.d.ts +1 -0
  214. package/dist/transactions/index.es.js +604 -10
  215. package/dist/transactions/index.es.js.map +1 -0
  216. package/dist/trends/index.es.js +1408 -1268
  217. package/dist/trends/index.es.js.map +1 -0
  218. package/dist/useAccountDisplayName-BsiXA0qf.mjs +24 -0
  219. package/dist/useAccountDisplayName-BsiXA0qf.mjs.map +1 -0
  220. package/dist/useAriaLive-MkYebyUR.mjs +36 -0
  221. package/dist/useAriaLive-MkYebyUR.mjs.map +1 -0
  222. package/dist/useDimensions-CeDR9V8N.mjs +37 -0
  223. package/dist/useDimensions-CeDR9V8N.mjs.map +1 -0
  224. package/dist/useInsightsEnabled-D5Sdm0TJ.mjs +12 -0
  225. package/dist/useInsightsEnabled-D5Sdm0TJ.mjs.map +1 -0
  226. package/dist/useScreenSize-mWpmnh5w.mjs +37 -0
  227. package/dist/useScreenSize-mWpmnh5w.mjs.map +1 -0
  228. package/dist/useWidgetLoadTimer-B0tB-yzL.mjs +20 -0
  229. package/dist/useWidgetLoadTimer-B0tB-yzL.mjs.map +1 -0
  230. package/package.json +30 -30
  231. package/dist/Analytics-BKzTPees.mjs +0 -61
  232. package/dist/GlobalCopyApi-BeXzaDH9.mjs +0 -487
  233. package/dist/HeaderCell-EhCUSjvj.mjs +0 -10
  234. package/dist/Loader-BlVzRtUd.mjs +0 -73
  235. package/dist/MiniWidgetContainer-COwnjfy7.mjs +0 -110
  236. package/dist/OriginalBalanceAction-sbiqaxok.mjs +0 -110
  237. package/dist/SpendingLegend-D15ixlQ1.mjs +0 -222
  238. package/dist/accounts-DkyAiLpg.mjs +0 -15632
  239. package/dist/core-BexP5oiV.mjs +0 -4047
  240. package/dist/help-CctDYrAH.mjs +0 -2308
  241. package/dist/insights/components/insights/P2pCategorization/_tests_/P2pCategorizationMultipleTransaction.test.d.ts +0 -0
  242. package/dist/insights/components/insights/P2pCategorization/_tests_/P2pCategorizationSingleTransaction.test.d.ts +0 -0
  243. package/dist/microinsights-CRf3ChsJ.mjs +0 -1814
  244. package/dist/recurringtransactions-gbJ_NA8u.mjs +0 -1564
  245. package/dist/settings-ZMHe439l.mjs +0 -1526
@@ -1,296 +1,269 @@
1
- import { s as R } from "../GlobalCopyApi-BeXzaDH9.mjs";
2
- import { J as D, K as Ve, q as Ke, rt as Ee, s as Ye } from "../core-BexP5oiV.mjs";
3
- import { $t as Se, An as fe, Bn as Xe, Gn as Ze, Vn as qe, Xn as Le, c as Je, d as Qe, f as et, i as tt, lr as $, mr as le, p as nt, sr as P, ur as W, yr as ve } from "../accounts-DkyAiLpg.mjs";
4
- import { n as Ne } from "../Analytics-BKzTPees.mjs";
5
- import { E as X, a as E, d as Z, h as q, i as ke, k as de, n as $e, p as w, s as J, t as ue, w as me } from "../Loader-BlVzRtUd.mjs";
6
- import { t as at } from "../MiniWidgetContainer-COwnjfy7.mjs";
7
- import { o as ot } from "../recurringtransactions-gbJ_NA8u.mjs";
1
+ import { jsxs as m, jsx as e, Fragment as Ve } from "react/jsx-runtime";
8
2
  import l from "react";
9
3
  import { observer as I } from "mobx-react-lite";
10
- import x from "@mui/material/Stack";
11
- import { CategoryIcon as H, H3 as Ge, Icon as z, Text as v } from "@mxenabled/mxui";
12
4
  import { endOfMonth as Be } from "date-fns/endOfMonth";
5
+ import { isAfter as Ke } from "date-fns/isAfter";
13
6
  import { startOfMonth as ie } from "date-fns/startOfMonth";
14
7
  import { startOfToday as re } from "date-fns/startOfToday";
15
- import Pe from "@mui/material/Button";
16
- import { Fragment as rt, jsx as e, jsxs as m } from "react/jsx-runtime";
17
- import { alpha as st, useTheme as V } from "@mui/material/styles";
18
- import Q from "@mui/material/Box";
19
- import * as O from "d3";
20
- import { subDays as it } from "date-fns/subDays";
21
- import we from "@mui/material/Tab";
22
- import ct from "@mui/material/Tabs";
23
- import lt from "@mui/material/IconButton";
24
- import { isAfter as dt } from "date-fns/isAfter";
25
- import xe from "@mui/material/Card";
26
- import Ae from "@mui/material/CardContent";
27
- import je from "@mui/material/CardHeader";
28
- import ge from "@mui/material/Divider";
29
- import ut from "@mui/material/Tooltip";
30
- import ee from "@mui/material/List";
8
+ import Ae from "@mui/material/Alert";
9
+ import xe from "@mui/material/Snackbar";
10
+ import x from "@mui/material/Stack";
11
+ import { useTheme as H, alpha as Ye } from "@mui/material/styles";
12
+ import X from "@mui/material/Box";
13
+ import Z from "@mui/material/List";
14
+ import { b as R } from "../Localization-DnoVyBNK.mjs";
15
+ import { Text as C, CategoryIcon as V, Icon as z, H3 as Le } from "@mxenabled/mxui";
16
+ import { f as D } from "../NumberFormatting--XMeeBfr.mjs";
17
+ import { u as E, o as w, h as le, l as q, D as de, i as Ne, f as J, a as Q, g as ee, c as ke } from "../hooks-97sNJ_lf.mjs";
18
+ import $e from "@mui/material/Button";
19
+ import ue from "@mui/material/Divider";
31
20
  import te from "@mui/material/ListItem";
32
- import ne from "@mui/material/ListItemButton";
33
- import ae from "@mui/material/ListItemText";
34
- import pe from "@mui/material/ListItemAvatar";
35
- import Te from "@mui/material/Alert";
36
- import De from "@mui/material/Snackbar";
37
- import mt from "@mui/material/ListItemSecondaryAction";
38
- var gt = I(() => {
39
- const { budgets: t } = w(), { totalBudgeted: o } = E(), { incomeTotal: i } = me(), r = i - o;
40
- return /* @__PURE__ */ m(x, {
41
- direction: "row",
42
- justifyContent: "center",
43
- my: 16,
44
- spacing: 20,
45
- children: [
46
- /* @__PURE__ */ m(x, {
47
- alignItems: "center",
48
- children: [/* @__PURE__ */ e(v, {
49
- bold: !0,
50
- variant: "body1",
51
- children: D(i, "0,0")
52
- }), /* @__PURE__ */ e(v, {
53
- color: "secondary",
54
- variant: "body2",
55
- children: t.projected_income
56
- })]
57
- }),
58
- /* @__PURE__ */ e(v, {
59
- bold: !0,
60
- justifyContent: "center",
61
- variant: "body1",
62
- children: "-"
63
- }),
64
- /* @__PURE__ */ m(x, {
65
- alignItems: "center",
66
- children: [/* @__PURE__ */ e(v, {
67
- bold: !0,
68
- variant: "body1",
69
- children: D(o, "0,0")
70
- }), /* @__PURE__ */ e(v, {
71
- color: "secondary",
72
- variant: "body2",
73
- children: t.budgeted
74
- })]
75
- }),
76
- /* @__PURE__ */ e(v, {
77
- bold: !0,
78
- justifyContent: "center",
79
- variant: "body1",
80
- children: "="
81
- }),
82
- /* @__PURE__ */ m(x, {
83
- alignItems: "center",
84
- children: [/* @__PURE__ */ e(v, {
85
- bold: !0,
86
- variant: "body1",
87
- children: D(r, "0,0")
88
- }), /* @__PURE__ */ e(v, {
89
- color: "secondary",
90
- variant: "body2",
91
- children: t.remaining
92
- })]
93
- })
94
- ]
95
- });
96
- }), pt = I(({ category: t }) => {
97
- const { budgets: o } = w(), { budgets: i } = E(), r = l.useMemo(() => {
98
- const n = i.find((s) => s.category_guid === t.guid);
99
- return `${D(t.totalAverageAmount, "0,0")} - ${n ? R(o.recalculate_previous_budget, D(n.amount, "0,0")) : o.recalculate_new_budget}`;
100
- }, [o, i]);
101
- return /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(ne, { children: [/* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(H, {
102
- categoryGuid: t.guid,
103
- variant: "filled"
104
- }) }), /* @__PURE__ */ e(ae, {
105
- primary: t.name,
106
- secondary: r
107
- })] }) }), /* @__PURE__ */ e(ge, {})] }, t.guid);
108
- }), ht = ({ onRecalculateBudgets: t }) => {
109
- const { budgets: o, common: i } = w(), { spendCategories: r } = J(), { recalculateBudgets: n, setAlert: s } = E(), [a, c] = l.useState(!1), g = r.filter((u) => u.totalAverageAmount > 0), d = async () => {
110
- await n(g), c(!1), s(o.alert_recalculated_budgets), t?.();
21
+ import me from "@mui/material/ListItemAvatar";
22
+ import oe from "@mui/material/ListItemButton";
23
+ import ne from "@mui/material/ListItemText";
24
+ import { D as $ } from "../Drawer-DsnW2o0v.mjs";
25
+ import Xe from "@mui/material/ListItemSecondaryAction";
26
+ import { C as Ze } from "../CurrencyInput-DaGEQaLW.mjs";
27
+ import { D as W } from "../Dialog-Bvd2n8hz.mjs";
28
+ import { C as qe } from "../ConnectionsDrawer-CZU9ku-k.mjs";
29
+ import * as O from "d3";
30
+ import Je from "@mui/material/Tooltip";
31
+ import { u as ge } from "../useScreenSize-mWpmnh5w.mjs";
32
+ import { L as pe } from "../Loader-CxeBwuPG.mjs";
33
+ import { E as _e } from "../EmptyState-CJUDc3kD.mjs";
34
+ import { A as P } from "../Analytics-WeZYytR0.mjs";
35
+ import Ee from "@mui/material/Tab";
36
+ import Qe from "@mui/material/Tabs";
37
+ import { e as et, g as we } from "../TransactionUtils-BphBJBbU.mjs";
38
+ import { T as ve } from "../EmbeddedCard-DH8vQ3qN.mjs";
39
+ import { T as tt, c as ot } from "../TransactionDetails-roZ5xLq8.mjs";
40
+ import Te from "@mui/material/Card";
41
+ import De from "@mui/material/CardContent";
42
+ import { S as Se } from "../StatusBar-CPfSXe80.mjs";
43
+ import { S as Ge } from "../SingleSegmentDonut-7Uy6VEld.mjs";
44
+ import { u as nt, C as at } from "../CategorySelectorDrawer-NJsFsKP1.mjs";
45
+ import Pe from "@mui/material/CardHeader";
46
+ import { subDays as rt } from "date-fns/subDays";
47
+ import st from "@mui/material/IconButton";
48
+ import { M as it } from "../ManageIncome-Dcsnnz86.mjs";
49
+ import { u as je } from "../useWidgetLoadTimer-B0tB-yzL.mjs";
50
+ import { W as ct } from "../WidgetContainer-DJnp6t6c.mjs";
51
+ import { g as lt, a as dt } from "../BudgetUtil-Bg2AQJpQ.mjs";
52
+ import { M as ut } from "../MiniWidgetContainer-Bmv_WeUd.mjs";
53
+ import { b as mt } from "../CurrencyDialog-DumQCTPO.mjs";
54
+ const gt = I(() => {
55
+ const { budgets: t } = E(), { totalBudgeted: n } = w(), { incomeTotal: c } = le(), i = c - n;
56
+ return /* @__PURE__ */ m(x, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
57
+ /* @__PURE__ */ m(x, { alignItems: "center", children: [
58
+ /* @__PURE__ */ e(C, { bold: !0, variant: "body1", children: D(c, "0,0") }),
59
+ /* @__PURE__ */ e(C, { color: "secondary", variant: "body2", children: t.projected_income })
60
+ ] }),
61
+ /* @__PURE__ */ e(C, { bold: !0, justifyContent: "center", variant: "body1", children: "-" }),
62
+ /* @__PURE__ */ m(x, { alignItems: "center", children: [
63
+ /* @__PURE__ */ e(C, { bold: !0, variant: "body1", children: D(n, "0,0") }),
64
+ /* @__PURE__ */ e(C, { color: "secondary", variant: "body2", children: t.budgeted })
65
+ ] }),
66
+ /* @__PURE__ */ e(C, { bold: !0, justifyContent: "center", variant: "body1", children: "=" }),
67
+ /* @__PURE__ */ m(x, { alignItems: "center", children: [
68
+ /* @__PURE__ */ e(C, { bold: !0, variant: "body1", children: D(i, "0,0") }),
69
+ /* @__PURE__ */ e(C, { color: "secondary", variant: "body2", children: t.remaining })
70
+ ] })
71
+ ] });
72
+ }), pt = I(
73
+ ({ category: t }) => {
74
+ const { budgets: n } = E(), { budgets: c } = w(), i = l.useMemo(() => {
75
+ const a = c.find((r) => r.category_guid === t.guid), s = D(t.totalAverageAmount, "0,0"), o = a ? R(n.recalculate_previous_budget, D(a.amount, "0,0")) : n.recalculate_new_budget;
76
+ return `${s} - ${o}`;
77
+ }, [n, c]);
78
+ return /* @__PURE__ */ m(l.Fragment, { children: [
79
+ /* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(oe, { children: [
80
+ /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(V, { categoryGuid: t.guid, variant: "filled" }) }),
81
+ /* @__PURE__ */ e(ne, { primary: t.name, secondary: i })
82
+ ] }) }),
83
+ /* @__PURE__ */ e(ue, {})
84
+ ] }, t.guid);
85
+ }
86
+ ), ht = ({ onRecalculateBudgets: t }) => {
87
+ const { budgets: n, common: c } = E(), { spendCategories: i } = q(), { recalculateBudgets: a, setAlert: s } = w(), [o, r] = l.useState(!1), p = i.filter((u) => u.totalAverageAmount > 0), d = async () => {
88
+ await a(p), r(!1), s(n.alert_recalculated_budgets), t?.();
111
89
  };
112
90
  return /* @__PURE__ */ m(l.Fragment, { children: [
113
- /* @__PURE__ */ e(Pe, {
114
- onClick: () => c(!0),
115
- sx: {
116
- mt: 24,
117
- mx: 24
118
- },
119
- variant: "text",
120
- children: o.recalculate_button
121
- }),
122
- /* @__PURE__ */ e(v, {
123
- sx: {
124
- mx: 24,
125
- my: 16,
126
- textAlign: "center"
127
- },
128
- variant: "subtitle1",
129
- children: o.recalculate_help
130
- }),
131
- /* @__PURE__ */ e($, {
132
- ariaLabelClose: i.close_aria,
133
- isOpen: a,
134
- onClose: () => c(!1),
135
- onPrimaryAction: d,
136
- title: o.recalculate_title,
137
- children: /* @__PURE__ */ m(x, { children: [/* @__PURE__ */ m(x, {
138
- mx: 24,
139
- my: 16,
140
- children: [/* @__PURE__ */ e(v, {
141
- bold: !0,
142
- variant: "body1",
143
- children: o.recalculate_description_top
144
- }), /* @__PURE__ */ e(v, {
145
- variant: "subtitle2",
146
- children: o.recalculate_description_bottom
147
- })]
148
- }), /* @__PURE__ */ e(Q, {
149
- bgcolor: "background.paper",
150
- children: /* @__PURE__ */ e(ee, { children: g.map((u) => /* @__PURE__ */ e(pt, { category: u }, u.guid)) })
151
- })] })
152
- })
91
+ /* @__PURE__ */ e($e, { onClick: () => r(!0), sx: { mt: 24, mx: 24 }, variant: "text", children: n.recalculate_button }),
92
+ /* @__PURE__ */ e(C, { sx: { mx: 24, my: 16, textAlign: "center" }, variant: "subtitle1", children: n.recalculate_help }),
93
+ /* @__PURE__ */ e(
94
+ $,
95
+ {
96
+ ariaLabelClose: c.close_aria,
97
+ isOpen: o,
98
+ onClose: () => r(!1),
99
+ onPrimaryAction: d,
100
+ title: n.recalculate_title,
101
+ children: /* @__PURE__ */ m(x, { children: [
102
+ /* @__PURE__ */ m(x, { mx: 24, my: 16, children: [
103
+ /* @__PURE__ */ e(C, { bold: !0, variant: "body1", children: n.recalculate_description_top }),
104
+ /* @__PURE__ */ e(C, { variant: "subtitle2", children: n.recalculate_description_bottom })
105
+ ] }),
106
+ /* @__PURE__ */ e(X, { bgcolor: "background.paper", children: /* @__PURE__ */ e(Z, { children: p.map((u) => /* @__PURE__ */ e(pt, { category: u }, u.guid)) }) })
107
+ ] })
108
+ }
109
+ )
153
110
  ] });
154
- }, he = ({ amount: t, categoryName: o, onAmountChanged: i }) => {
155
- const { budgets: r } = w(), { totalBudgeted: n } = E(), { incomeTotal: s } = me(), a = s - n;
156
- return /* @__PURE__ */ m(x, {
157
- gap: 16,
158
- children: [/* @__PURE__ */ m(x, { children: [/* @__PURE__ */ e(v, { children: R(r.add_description_top, D(a, "0,0")) }), /* @__PURE__ */ e(v, { children: R(r.add_description_bottom, o) })] }), /* @__PURE__ */ e(Xe, {
159
- amount: t,
160
- autoFocus: !0,
161
- label: r.add_label,
162
- minAmount: 0,
163
- setAmount: i,
164
- sx: { ".MuiTypography-body1": { p: 0 } }
165
- })]
166
- });
167
- }, yt = I(({ category: t, onAddBudget: o }) => {
168
- const { budgets: i, common: r } = w(), [n, s] = l.useState(!1), [a, c] = l.useState(`${t.totalAmount === 0 ? "" : t.totalAmount}`);
169
- return /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(ne, {
170
- onClick: () => s(!0),
171
- children: [
172
- /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(H, { categoryGuid: t.guid }) }),
173
- /* @__PURE__ */ e(ae, {
174
- primary: t.name,
175
- secondary: D(t.totalAmount, "0,0")
176
- }),
177
- /* @__PURE__ */ e(mt, { children: /* @__PURE__ */ e(z, {
178
- name: "add",
179
- size: 20
180
- }) })
181
- ]
182
- }) }, t.guid), /* @__PURE__ */ e(W, {
183
- copy: {
184
- close_aria: r.close_aria,
185
- title: i.add_title
186
- },
187
- disablePrimaryButton: Number(a) <= 0,
188
- isOpen: n,
189
- onClose: () => s(!1),
190
- onPrimaryAction: () => o(t, Number(a)),
191
- primaryText: i.add_save_button,
192
- children: /* @__PURE__ */ e(he, {
193
- amount: a,
194
- categoryName: t.name,
195
- onAmountChanged: c
196
- })
197
- })] });
198
- }), ze = I(({ onAddBudget: t, onRecalculateBudgets: o }) => {
199
- const { budgets: i } = w(), { addBudget: r, setAlert: n, unbudgetedCategories: s } = E(), a = async (c, g) => {
200
- await r(c, g), t?.(), n(R(i.alert_budget_created, c.name));
111
+ }, he = ({
112
+ amount: t,
113
+ categoryName: n,
114
+ onAmountChanged: c
115
+ }) => {
116
+ const { budgets: i } = E(), { totalBudgeted: a } = w(), { incomeTotal: s } = le(), o = s - a;
117
+ return /* @__PURE__ */ m(x, { gap: 16, children: [
118
+ /* @__PURE__ */ m(x, { children: [
119
+ /* @__PURE__ */ e(C, { children: R(
120
+ i.add_description_top,
121
+ D(o, "0,0")
122
+ ) }),
123
+ /* @__PURE__ */ e(C, { children: R(i.add_description_bottom, n) })
124
+ ] }),
125
+ /* @__PURE__ */ e(
126
+ Ze,
127
+ {
128
+ amount: t,
129
+ autoFocus: !0,
130
+ label: i.add_label,
131
+ minAmount: 0,
132
+ setAmount: c,
133
+ sx: { ".MuiTypography-body1": { p: 0 } }
134
+ }
135
+ )
136
+ ] });
137
+ }, bt = I(({ category: t, onAddBudget: n }) => {
138
+ const { budgets: c, common: i } = E(), [a, s] = l.useState(!1), [o, r] = l.useState(
139
+ `${t.totalAmount === 0 ? "" : t.totalAmount}`
140
+ );
141
+ return /* @__PURE__ */ m(l.Fragment, { children: [
142
+ /* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(oe, { onClick: () => s(!0), children: [
143
+ /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(V, { categoryGuid: t.guid }) }),
144
+ /* @__PURE__ */ e(
145
+ ne,
146
+ {
147
+ primary: t.name,
148
+ secondary: D(t.totalAmount, "0,0")
149
+ }
150
+ ),
151
+ /* @__PURE__ */ e(Xe, { children: /* @__PURE__ */ e(z, { name: "add", size: 20 }) })
152
+ ] }) }, t.guid),
153
+ /* @__PURE__ */ e(
154
+ W,
155
+ {
156
+ copy: { close_aria: i.close_aria, title: c.add_title },
157
+ disablePrimaryButton: Number(o) <= 0,
158
+ isOpen: a,
159
+ onClose: () => s(!1),
160
+ onPrimaryAction: () => n(t, Number(o)),
161
+ primaryText: c.add_save_button,
162
+ children: /* @__PURE__ */ e(he, { amount: o, categoryName: t.name, onAmountChanged: r })
163
+ }
164
+ )
165
+ ] });
166
+ }), ze = I(({ onAddBudget: t, onRecalculateBudgets: n }) => {
167
+ const { budgets: c } = E(), { addBudget: i, setAlert: a, unbudgetedCategories: s } = w(), o = async (r, p) => {
168
+ await i(r, p), t?.(), a(R(c.alert_budget_created, r.name));
201
169
  };
202
170
  return /* @__PURE__ */ m(x, { children: [
203
171
  /* @__PURE__ */ e(gt, {}),
204
- /* @__PURE__ */ e(Q, {
205
- bgcolor: "background.paper",
206
- children: /* @__PURE__ */ e(ee, { children: s.map((c) => /* @__PURE__ */ e(yt, {
207
- category: c,
208
- onAddBudget: a
209
- }, c.guid)) })
210
- }),
211
- /* @__PURE__ */ e(ht, { onRecalculateBudgets: o })
172
+ /* @__PURE__ */ e(X, { bgcolor: "background.paper", children: /* @__PURE__ */ e(Z, { children: s.map((r) => /* @__PURE__ */ e(
173
+ bt,
174
+ {
175
+ category: r,
176
+ onAddBudget: o
177
+ },
178
+ r.guid
179
+ )) }) }),
180
+ /* @__PURE__ */ e(ht, { onRecalculateBudgets: n })
212
181
  ] });
213
- }), Ie = 5, Fe = 100, ce = 25, _t = (t) => {
214
- const o = (n) => {
215
- n.active || t.alphaTarget(0.3).restart(), n.subject.fx = n.subject.x, n.subject.fy = n.subject.y;
216
- }, i = (n) => {
217
- n.subject.fx = n.x, n.subject.fy = n.y;
218
- }, r = (n) => {
219
- n.active || t.alphaTarget(0), n.subject.fx = null, n.subject.fy = null;
182
+ }), Ie = 5, Fe = 100, ce = 25, ft = (t) => {
183
+ const n = (a) => {
184
+ a.active || t.alphaTarget(0.3).restart(), a.subject.fx = a.subject.x, a.subject.fy = a.subject.y;
185
+ }, c = (a) => {
186
+ a.subject.fx = a.x, a.subject.fy = a.y;
187
+ }, i = (a) => {
188
+ a.active || t.alphaTarget(0), a.subject.fx = null, a.subject.fy = null;
220
189
  };
221
- return O.drag().on("start", o).on("drag", i).on("end", r);
222
- }, bt = (t) => {
223
- let o = t.transaction_total / t.amount;
224
- o < 0 ? o = 0 : o > 1 && (o = 1);
225
- const i = o * 2 * Math.PI, r = O.interpolate(0, i), n = O.arc().cornerRadius(5).innerRadius(t.radius - Ie * 2).outerRadius(t.radius - Ie).startAngle(0).endAngle(0);
226
- return (s) => (n.endAngle(r(s)), n(t) || "");
227
- }, ft = (t) => {
228
- O.selectAll(".bubble").call(_t(t));
229
- }, Oe = (t, o, i) => Math.min(Math.max(t, o), i), Ct = (t, o, i) => {
230
- t.alpha(1).restart().force("x", O.forceX().x(i / 2).strength(0.01)).force("y", O.forceY().y(o / 2).strength(0.02)).on("tick", () => {
231
- const r = t.nodes();
232
- r.forEach((n) => {
233
- const s = n.radius ?? ce;
234
- n.x = Oe(n.x ?? 0, s, i - s), n.y = Oe(n.y ?? 0, s, o - s);
235
- }), O.selectAll(".bubble").data(r).attr("transform", (n) => `translate(${n.x},${n.y})`);
190
+ return O.drag().on("start", n).on("drag", c).on("end", i);
191
+ }, yt = (t) => {
192
+ let n = t.transaction_total / t.amount;
193
+ n < 0 ? n = 0 : n > 1 && (n = 1);
194
+ const c = n * 2 * Math.PI, i = O.interpolate(0, c), a = O.arc().cornerRadius(5).innerRadius(t.radius - Ie * 2).outerRadius(t.radius - Ie).startAngle(0).endAngle(0);
195
+ return (s) => (a.endAngle(i(s)), a(t) || "");
196
+ }, _t = (t) => {
197
+ O.selectAll(".bubble").call(ft(t));
198
+ }, Oe = (t, n, c) => Math.min(Math.max(t, n), c), Ct = (t, n, c) => {
199
+ t.alpha(1).restart().force(
200
+ "x",
201
+ O.forceX().x(c / 2).strength(0.01)
202
+ ).force(
203
+ "y",
204
+ O.forceY().y(n / 2).strength(0.02)
205
+ ).on("tick", () => {
206
+ const i = t.nodes();
207
+ i.forEach((a) => {
208
+ const s = a.radius ?? ce;
209
+ a.x = Oe(a.x ?? 0, s, c - s), a.y = Oe(a.y ?? 0, s, n - s);
210
+ }), O.selectAll(".bubble").data(i).attr("transform", (a) => `translate(${a.x},${a.y})`);
236
211
  });
237
- }, Ue = (t, o) => O.scaleLinear().domain([t, o]).range([ce, Fe]), vt = (t) => {
238
- const o = t.reduce((n, s) => {
239
- const a = Math.max(s.transaction_total, s.amount);
240
- return a > n ? a : n;
241
- }, 0), i = Ue(t.reduce((n, s) => {
242
- const a = Math.max(s.transaction_total, s.amount);
243
- return a < n ? a : n;
244
- }, o), o), r = t.map((n) => {
245
- const s = i(Math.max(n.transaction_total, n.amount)) || 25;
212
+ }, Ue = (t, n) => O.scaleLinear().domain([t, n]).range([ce, Fe]), Bt = (t) => {
213
+ const n = t.reduce((s, o) => {
214
+ const r = Math.max(o.transaction_total, o.amount);
215
+ return r > s ? r : s;
216
+ }, 0), c = t.reduce((s, o) => {
217
+ const r = Math.max(o.transaction_total, o.amount);
218
+ return r < s ? r : s;
219
+ }, n), i = Ue(c, n), a = t.map((s) => {
220
+ const o = i(Math.max(s.transaction_total, s.amount)) || 25;
246
221
  return {
247
- ...n,
248
- radius: s
222
+ ...s,
223
+ radius: o
249
224
  };
250
225
  });
251
- return O.forceSimulation(r).velocityDecay(0.05).force("collide", O.forceCollide((n) => n.radius + 2).strength(0.7));
252
- }, Bt = (t, o, i) => {
253
- const r = Math.PI * ce ** 2 * t, n = i < 400 || o < 300, s = n ? 40 : 20, a = Math.max(100, i - s), c = Math.max(100, o - s), g = a * c;
254
- let d = ce;
255
- if (r < g) {
256
- const u = Math.sqrt(g / (t * Math.PI)), C = Math.min(a, c) / 4;
257
- d = Math.min(Fe, u, C);
226
+ return O.forceSimulation(a).velocityDecay(0.05).force("collide", O.forceCollide((s) => s.radius + 2).strength(0.7));
227
+ }, St = (t, n, c) => {
228
+ const a = Math.PI * ce ** 2 * t, s = c < 400 || n < 300, o = s ? 40 : 20, r = Math.max(100, c - o), p = Math.max(100, n - o), d = r * p;
229
+ let u = ce;
230
+ if (a < d) {
231
+ const g = Math.sqrt(d / (t * Math.PI)), h = Math.min(r, p) / 4;
232
+ u = Math.min(Fe, g, h);
258
233
  }
259
- return n && t <= 3 && (d = Math.min(d, 45)), {
260
- minRadius: Math.max(20, d * 0.6),
261
- maxRadius: d
262
- };
263
- }, St = (t, o, i, r, n) => {
264
- const { maxRadius: s, minRadius: a } = Bt(t, o, n);
265
- return O.scaleLinear().domain([r, i]).range([a, s]);
266
- }, xt = (t, o, i = !1, r, n) => {
267
- const s = o.map((d) => Math.max(d.transaction_total, d.amount)), a = Math.min(...s), c = Math.max(...s), g = i ? St(t.length, r, c, a, n) : Ue(a, c);
234
+ return s && t <= 3 && (u = Math.min(u, 45)), { minRadius: Math.max(20, u * 0.6), maxRadius: u };
235
+ }, At = (t, n, c, i, a) => {
236
+ const { maxRadius: s, minRadius: o } = St(t, n, a);
237
+ return O.scaleLinear().domain([i, c]).range([o, s]);
238
+ }, xt = (t, n, c = !1, i, a) => {
239
+ const s = n.map((d) => Math.max(d.transaction_total, d.amount)), o = Math.min(...s), r = Math.max(...s), p = c ? At(t.length, i, r, o, a) : Ue(o, r);
268
240
  return t.map((d) => ({
269
241
  ...d,
270
- radius: g(Math.max(d.transaction_total, d.amount))
242
+ radius: p(Math.max(d.transaction_total, d.amount))
271
243
  }));
272
- }, Re = 5, At = 2e3, Tt = ({ bubble: t }) => {
273
- const o = V(), { amount: i, guid: r, budgetColors: { mercury: n }, radius: s, transaction_total: a } = t, c = `mercury-${r}`;
274
- return l.useEffect(() => {
275
- O.select(`.${c}`).selectAll(".status").remove(), O.select(`.${c}`).append("path").transition().duration(At).delay(0).attr("class", "status").attr("style", `fill: ${n}; fill-opacity: 1;`).attrTween("d", () => bt(t));
276
- }, [
277
- i,
278
- s,
279
- a
280
- ]), /* @__PURE__ */ e("g", {
281
- className: c,
282
- children: /* @__PURE__ */ e("path", {
283
- d: O.arc().innerRadius((g) => g - 2 * Re).outerRadius((g) => g - Re).startAngle(0).endAngle(2 * Math.PI)(s) || "",
284
- style: {
285
- fill: o.palette.common.white,
286
- fillOpacity: 0.35
287
- }
288
- })
289
- });
244
+ }, Me = 5, vt = 2e3, Tt = ({ bubble: t }) => {
245
+ const n = H(), {
246
+ amount: c,
247
+ guid: i,
248
+ budgetColors: { mercury: a },
249
+ radius: s,
250
+ transaction_total: o
251
+ } = t, r = `mercury-${i}`;
252
+ l.useEffect(() => {
253
+ O.select(`.${r}`).selectAll(".status").remove(), O.select(`.${r}`).append("path").transition().duration(vt).delay(0).attr("class", "status").attr("style", `fill: ${a}; fill-opacity: 1;`).attrTween("d", () => yt(t));
254
+ }, [c, s, o]);
255
+ const p = O.arc().innerRadius((d) => d - 2 * Me).outerRadius((d) => d - Me).startAngle(0).endAngle(2 * Math.PI);
256
+ return /* @__PURE__ */ e("g", { className: r, children: /* @__PURE__ */ e(
257
+ "path",
258
+ {
259
+ d: p(s) || "",
260
+ style: { fill: n.palette.common.white, fillOpacity: 0.35 }
261
+ }
262
+ ) });
290
263
  }, Dt = l.memo(Tt), U = 75, Ce = 50;
291
- function Et({ bubble: t, isDraggable: o, onClick: i = () => {
264
+ function Et({ bubble: t, isDraggable: n, onClick: c = () => {
292
265
  } }) {
293
- const [r, n] = l.useState(!1), s = V(), { availableWidth: a } = de(), c = l.useMemo(() => {
266
+ const [i, a] = l.useState(!1), s = H(), { availableWidth: o } = de(), r = l.useMemo(() => {
294
267
  if (t)
295
268
  return {
296
269
  amount: t.amount,
@@ -299,50 +272,55 @@ function Et({ bubble: t, isDraggable: o, onClick: i = () => {
299
272
  radius: t.radius,
300
273
  transaction_total: t.transaction_total
301
274
  };
302
- }, [
303
- t.amount,
304
- t.budgetColors,
305
- t.guid,
306
- t.radius,
307
- t.transaction_total
308
- ]);
275
+ }, [t.amount, t.budgetColors, t.guid, t.radius, t.transaction_total]);
309
276
  if (!t) return;
310
- const { budgetColors: { background: g, text: d }, category: { icon: u, name: C }, guid: p, description: b, radius: f, x: _, y: S } = t, A = a < 400 ? -8 : -12;
311
- let h = A, B = A;
312
- f > U ? (h = -14, B = -45) : f > Ce && (B = -32);
313
- let y = 32;
314
- f <= U && (y = a < 400 ? 16 : 24);
315
- const T = `${t.category.name}: ${b}`, M = { modifiers: [{
316
- name: "offset",
317
- options: { offset: [0, 15] }
318
- }] }, L = (G) => {
319
- (G.key === "Enter" || G.key === " ") && (G.preventDefault(), i(t));
277
+ const {
278
+ budgetColors: { background: p, text: d },
279
+ category: { icon: u, name: S },
280
+ guid: g,
281
+ description: h,
282
+ radius: _,
283
+ x: y,
284
+ y: A
285
+ } = t, v = o < 400 ? -8 : -12;
286
+ let b = v, B = v;
287
+ _ > U ? (b = -14, B = -45) : _ > Ce && (B = -32);
288
+ let f = 32;
289
+ _ <= U && (f = o < 400 ? 16 : 24);
290
+ const T = `${t.category.name}: ${h}`, L = {
291
+ modifiers: [
292
+ {
293
+ name: "offset",
294
+ options: { offset: [0, 15] }
295
+ }
296
+ ]
297
+ }, M = (G) => {
298
+ (G.key === "Enter" || G.key === " ") && (G.preventDefault(), c(t));
320
299
  }, N = () => {
321
- n(!0);
300
+ a(!0);
322
301
  }, k = () => {
323
- n(!1);
302
+ a(!1);
324
303
  };
325
- return /* @__PURE__ */ m("g", {
326
- "aria-label": `${C} - ${b}`,
327
- className: "bubble",
328
- id: `bubble-${p}`,
329
- onBlur: k,
330
- onClick: () => i(t),
331
- onFocus: N,
332
- onKeyDown: L,
333
- onMouseEnter: () => n(!0),
334
- onMouseLeave: () => n(!1),
335
- role: "button",
336
- style: {
337
- cursor: o ? "pointer" : "default",
338
- touchAction: "manipulation"
339
- },
340
- tabIndex: 0,
341
- textAnchor: "middle",
342
- x: _,
343
- y: S,
344
- children: [
345
- /* @__PURE__ */ e("style", { children: `
304
+ return /* @__PURE__ */ m(
305
+ "g",
306
+ {
307
+ "aria-label": `${S} - ${h}`,
308
+ className: "bubble",
309
+ id: `bubble-${g}`,
310
+ onBlur: k,
311
+ onClick: () => c(t),
312
+ onFocus: N,
313
+ onKeyDown: M,
314
+ onMouseEnter: () => a(!0),
315
+ onMouseLeave: () => a(!1),
316
+ role: "button",
317
+ style: { cursor: n ? "pointer" : "default", touchAction: "manipulation" },
318
+ tabIndex: 0,
319
+ textAnchor: "middle",
320
+ x: y,
321
+ y: A,
322
+ children: [
323
+ /* @__PURE__ */ e("style", { children: `
346
324
  .bubble:focus,
347
325
  .bubble:focus-visible {
348
326
  outline: none;
@@ -354,1099 +332,1071 @@ function Et({ bubble: t, isDraggable: o, onClick: i = () => {
354
332
  stroke-opacity: 0.8;
355
333
  }
356
334
  ` }),
357
- /* @__PURE__ */ e(ut, {
358
- open: r,
359
- slotProps: { popper: M },
360
- title: T,
361
- children: /* @__PURE__ */ e("circle", {
362
- fill: g,
363
- id: `circle-${p}`,
364
- r: f
365
- })
366
- }),
367
- /* @__PURE__ */ e("svg", {
368
- x: h,
369
- y: B,
370
- children: /* @__PURE__ */ e(z, {
371
- name: u,
372
- size: y,
373
- sx: { fill: d }
374
- })
375
- }),
376
- f > U && /* @__PURE__ */ e(v, {
377
- bold: !0,
378
- component: "text",
379
- id: `budget-category-${p}`,
380
- sx: { fill: d },
381
- variant: "body2",
382
- y: 4,
383
- children: C
384
- }),
385
- f > Ce && /* @__PURE__ */ e(v, {
386
- bold: !0,
387
- component: "text",
388
- id: `budget-description-${p}-1`,
389
- sx: { fill: d },
390
- variant: "body1",
391
- y: f <= U ? 12 : 24,
392
- children: f <= U ? b.split(" ")[0] : b
393
- }),
394
- f <= U && f > Ce && /* @__PURE__ */ e(v, {
395
- component: "text",
396
- id: `budget-description-${p}-2`,
397
- sx: { fill: d },
398
- variant: "caption",
399
- y: 28,
400
- children: b.split(" ")[1]
401
- }),
402
- /* @__PURE__ */ e(Dt, { bubble: c })
403
- ]
404
- }, p);
335
+ /* @__PURE__ */ e(Je, { open: i, slotProps: { popper: L }, title: T, children: /* @__PURE__ */ e("circle", { fill: p, id: `circle-${g}`, r: _ }) }),
336
+ /* @__PURE__ */ e("svg", { x: b, y: B, children: /* @__PURE__ */ e(z, { name: u, size: f, sx: { fill: d } }) }),
337
+ _ > U && /* @__PURE__ */ e(
338
+ C,
339
+ {
340
+ bold: !0,
341
+ component: "text",
342
+ id: `budget-category-${g}`,
343
+ sx: { fill: d },
344
+ variant: "body2",
345
+ y: 4,
346
+ children: S
347
+ }
348
+ ),
349
+ _ > Ce && /* @__PURE__ */ e(
350
+ C,
351
+ {
352
+ bold: !0,
353
+ component: "text",
354
+ id: `budget-description-${g}-1`,
355
+ sx: { fill: d },
356
+ variant: "body1",
357
+ y: _ <= U ? 12 : 24,
358
+ children: _ <= U ? h.split(" ")[0] : h
359
+ }
360
+ ),
361
+ _ <= U && _ > Ce && /* @__PURE__ */ e(
362
+ C,
363
+ {
364
+ component: "text",
365
+ id: `budget-description-${g}-2`,
366
+ sx: { fill: d },
367
+ variant: "caption",
368
+ y: 28,
369
+ children: h.split(" ")[1]
370
+ }
371
+ ),
372
+ /* @__PURE__ */ e(Dt, { bubble: r })
373
+ ]
374
+ },
375
+ g
376
+ );
405
377
  }
406
- var wt = ({ height: t, width: o, isDraggable: i = !1, onClick: r = () => {
407
- } }) => {
408
- const [n, s] = l.useState([]), a = l.useRef(null), c = l.useRef(!1), { detailedBudgets: g } = E(), d = l.useCallback(() => {
409
- const u = a.current, C = vt(g), p = C.nodes();
378
+ const wt = ({
379
+ height: t,
380
+ width: n,
381
+ isDraggable: c = !1,
382
+ onClick: i = () => {
383
+ }
384
+ }) => {
385
+ const [a, s] = l.useState([]), o = l.useRef(null), r = l.useRef(!1), { detailedBudgets: p } = w(), d = l.useCallback(() => {
386
+ const u = o.current, S = Bt(p), g = S.nodes();
410
387
  if (u) {
411
- const b = u.nodes(), f = new Map(b.map((_) => [_.guid, _]));
412
- p.forEach((_) => {
413
- const S = f.get(_.guid);
414
- S && Object.assign(_, {
415
- vx: S.vx,
416
- vy: S.vy,
417
- x: S.x,
418
- y: S.y
388
+ const h = u.nodes(), _ = new Map(h.map((y) => [y.guid, y]));
389
+ g.forEach((y) => {
390
+ const A = _.get(y.guid);
391
+ A && Object.assign(y, {
392
+ vx: A.vx,
393
+ vy: A.vy,
394
+ x: A.x,
395
+ y: A.y
419
396
  });
420
397
  });
421
398
  }
422
- a.current = C, c.current = !1, s(p);
423
- }, [g]);
399
+ o.current = S, r.current = !1, s(g);
400
+ }, [p]);
424
401
  return l.useEffect(() => {
425
402
  d();
426
403
  }, [d]), l.useEffect(() => () => {
427
- a.current && (a.current.stop(), a.current = null);
404
+ o.current && (o.current.stop(), o.current = null);
428
405
  }, []), l.useEffect(() => {
429
- const u = a.current;
406
+ const u = o.current;
430
407
  if (!u) return;
431
- const C = xt(u.nodes(), g, o > 0 && o < 450 || t > 0 && t < 300, t, o);
432
- u.nodes(C), Ct(u, t, o), i && setTimeout(() => {
433
- ft(u);
434
- }, 0), s([...C]);
435
- }, [
436
- t,
437
- o,
438
- i,
439
- g
440
- ]), /* @__PURE__ */ e("svg", {
441
- height: t,
442
- style: {
443
- overflow: "visible",
444
- touchAction: "manipulation"
445
- },
446
- width: Math.abs(o),
447
- children: n.map((u) => /* @__PURE__ */ e(Et, {
448
- bubble: u,
449
- isDraggable: i,
450
- onClick: r
451
- }, u.guid))
452
- });
453
- }, It = I(wt), Ot = ({ isMiniWidget: t = !1, onConnectAccountsClick: o, createBudgetOnClick: i }) => {
454
- const { config: r } = ke(), { recalculateBudgets: n } = E(), { spendCategories: s } = J(), { budgets: a } = w(), { availableWidth: c } = de(), { isMobile: g } = le(c), d = t && g, [u, C] = l.useState(!1), [p, b] = l.useState(!1), [f, _] = l.useState(!1), S = l.useMemo(() => [...s.filter((h) => h.totalAverageAmount > 0)], [s]), A = async () => {
455
- _(!0);
456
- const { data: h, isSuccess: B } = await n(S);
457
- _(!1), B ? (h.length === 0 && b(!0), C(!1)) : C(!0);
408
+ const S = u.nodes(), g = n > 0 && n < 450 || t > 0 && t < 300, h = xt(S, p, g, t, n);
409
+ u.nodes(h), Ct(u, t, n), c && setTimeout(() => {
410
+ _t(u);
411
+ }, 0), s([...h]);
412
+ }, [t, n, c, p]), /* @__PURE__ */ e(
413
+ "svg",
414
+ {
415
+ height: t,
416
+ style: { overflow: "visible", touchAction: "manipulation" },
417
+ width: Math.abs(n),
418
+ children: a.map((u) => /* @__PURE__ */ e(Et, { bubble: u, isDraggable: c, onClick: i }, u.guid))
419
+ }
420
+ );
421
+ }, It = I(wt), Ot = ({
422
+ isMiniWidget: t = !1,
423
+ onConnectAccountsClick: n,
424
+ createBudgetOnClick: c
425
+ }) => {
426
+ const { config: i } = Ne(), { recalculateBudgets: a } = w(), { spendCategories: s } = q(), { budgets: o } = E(), { availableWidth: r } = de(), { isMobile: p } = ge(r), d = t && p, [u, S] = l.useState(!1), [g, h] = l.useState(!1), [_, y] = l.useState(!1), A = l.useMemo(() => [...s.filter((b) => b.totalAverageAmount > 0)], [s]), v = async () => {
427
+ y(!0);
428
+ const { data: b, isSuccess: B } = await a(A);
429
+ y(!1), B ? (b.length === 0 && h(!0), S(!1)) : S(!0);
458
430
  };
459
- return f ? /* @__PURE__ */ e(ue, {}) : u ? /* @__PURE__ */ e(fe, {
460
- header: a.autogenerate_budgets_error_header,
461
- icon: "error",
462
- iconColor: "#4D4D4D",
463
- onClick: (h) => {
464
- h === "primary" ? A() : i();
465
- },
466
- primaryButton: a.autogenerate_budgets_error_primary_button,
467
- secondaryButton: a.zero_state_generate_budgets_secondary_button,
468
- subText: a.autogenerate_budgets_error_subheader,
469
- sx: {
470
- width: { sm: 468 },
471
- ".buttons-footer": {
472
- width: 208,
473
- ...d && {
474
- mt: 16,
475
- button: { height: "max-content" }
476
- }
431
+ return _ ? /* @__PURE__ */ e(pe, {}) : u ? /* @__PURE__ */ e(
432
+ _e,
433
+ {
434
+ header: o.autogenerate_budgets_error_header,
435
+ icon: "error",
436
+ iconColor: "#4D4D4D",
437
+ onClick: (b) => {
438
+ b === "primary" ? v() : c();
477
439
  },
478
- ...d && {
479
- justifyContent: "center",
480
- mt: 0,
481
- svg: {
482
- height: 32,
483
- width: 32
484
- }
440
+ primaryButton: o.autogenerate_budgets_error_primary_button,
441
+ secondaryButton: o.zero_state_generate_budgets_secondary_button,
442
+ subText: o.autogenerate_budgets_error_subheader,
443
+ sx: {
444
+ width: { sm: 468 },
445
+ ".buttons-footer": {
446
+ width: 208,
447
+ ...d && { mt: 16, button: { height: "max-content" } }
448
+ },
449
+ ...d && { justifyContent: "center", mt: 0, svg: { height: 32, width: 32 } }
485
450
  }
486
451
  }
487
- }) : /* @__PURE__ */ e(rt, { children: p ? /* @__PURE__ */ e(fe, {
488
- header: a.zero_state_generate_budgets_header,
489
- icon: "error",
490
- iconColor: "#4D4D4D",
491
- onClick: (h) => {
492
- h === "primary" ? o() : i();
493
- },
494
- primaryButton: r.show_connections_widget_in_master ? a.zero_state_generate_budgets_primary_button : void 0,
495
- secondaryButton: a.zero_state_generate_budgets_secondary_button,
496
- subText: a.zero_state_generate_budgets_subheader,
497
- sx: {
498
- width: t ? "100%" : { sm: 500 },
499
- height: t ? "100%" : { sm: 468 },
500
- mt: d ? 0 : 50,
501
- ".buttons-footer": {
502
- width: 208,
503
- height: 100,
504
- ...d && {
505
- mt: 16,
506
- button: { height: "max-content" }
507
- }
452
+ ) : /* @__PURE__ */ e(Ve, { children: g ? /* @__PURE__ */ e(
453
+ _e,
454
+ {
455
+ header: o.zero_state_generate_budgets_header,
456
+ icon: "error",
457
+ iconColor: "#4D4D4D",
458
+ onClick: (b) => {
459
+ b === "primary" ? n() : c();
508
460
  },
509
- padding: t ? 5 : 0,
510
- ...d && {
511
- justifyContent: "center",
512
- svg: {
513
- height: 32,
514
- width: 32
515
- }
461
+ primaryButton: i.show_connections_widget_in_master ? o.zero_state_generate_budgets_primary_button : void 0,
462
+ secondaryButton: o.zero_state_generate_budgets_secondary_button,
463
+ subText: o.zero_state_generate_budgets_subheader,
464
+ sx: {
465
+ width: t ? "100%" : { sm: 500 },
466
+ height: t ? "100%" : { sm: 468 },
467
+ mt: d ? 0 : 50,
468
+ ".buttons-footer": {
469
+ width: 208,
470
+ height: 100,
471
+ ...d && { mt: 16, button: { height: "max-content" } }
472
+ },
473
+ padding: t ? 5 : 0,
474
+ ...d && { justifyContent: "center", svg: { height: 32, width: 32 } }
516
475
  }
517
476
  }
518
- }) : /* @__PURE__ */ e(fe, {
519
- header: a.create_budgets_title,
520
- icon: "bubble_chart",
521
- iconColor: "#1A1A1A",
522
- onClick: (h) => {
523
- h === "primary" ? A() : i();
524
- },
525
- primaryButton: a.empty_state_primary_button,
526
- secondaryButton: t ? void 0 : a.empty_state_secondary_button,
527
- subText: a.empty_state_subheader,
528
- sx: {
529
- width: t ? "100%" : { sm: 432 },
530
- height: t ? "100%" : { sm: 468 },
531
- mt: d ? 0 : 50,
532
- ".buttons-footer": {
533
- width: 208,
534
- height: 100,
535
- ...d && {
536
- mt: 24,
537
- button: { height: "max-content" }
538
- }
477
+ ) : /* @__PURE__ */ e(
478
+ _e,
479
+ {
480
+ header: o.create_budgets_title,
481
+ icon: "bubble_chart",
482
+ iconColor: "#1A1A1A",
483
+ onClick: (b) => {
484
+ b === "primary" ? v() : c();
539
485
  },
540
- padding: t ? 4 : 0,
541
- ...d && {
542
- justifyContent: "center",
543
- svg: {
544
- height: 32,
545
- width: 32
546
- }
486
+ primaryButton: o.empty_state_primary_button,
487
+ secondaryButton: t ? void 0 : o.empty_state_secondary_button,
488
+ subText: o.empty_state_subheader,
489
+ sx: {
490
+ width: t ? "100%" : { sm: 432 },
491
+ height: t ? "100%" : { sm: 468 },
492
+ mt: d ? 0 : 50,
493
+ ".buttons-footer": {
494
+ width: 208,
495
+ height: 100,
496
+ ...d && { mt: 24, button: { height: "max-content" } }
497
+ },
498
+ padding: t ? 4 : 0,
499
+ ...d && { justifyContent: "center", svg: { height: 32, width: 32 } }
547
500
  }
548
501
  }
549
- }) });
550
- }, We = I(({ createBudgetOnClick: t = () => {
551
- }, height: o, isDraggable: i = !1, isMiniWidget: r = !1, shouldShowZeroState: n, unavailableWidth: s = 24 }) => {
552
- const { onEvent: a } = Z(), { setSelectedBudget: c } = E(), { isInitialized: g } = q(), { accounts: d } = w(), { availableWidth: u } = de(), { isMobile: C } = le(), [p, b] = l.useState(!1), f = l.useMemo(() => u - s, [u]), _ = (A) => {
553
- c(A), a(P.BUDGETS_CLICK_BUDGET_CATEGORY, {
554
- budget_category: A.category.name,
555
- click_type: "bubble"
556
- });
557
- }, S = () => {
558
- b(!0), a(P.ACCOUNTS_CLICK_CONNECT);
559
- };
560
- return /* @__PURE__ */ m(Q, {
561
- ml: n || C ? 0 : 24,
562
- sx: {
563
- alignSelf: "center",
564
- ...r && { height: "100%" }
565
- },
566
- children: [n || !g ? /* @__PURE__ */ e(Ot, {
567
- createBudgetOnClick: t,
568
- isMiniWidget: r,
569
- onConnectAccountsClick: S
570
- }) : /* @__PURE__ */ e(It, {
571
- height: o,
572
- isDraggable: i,
573
- onClick: _,
574
- width: f
575
- }), /* @__PURE__ */ e(tt, {
576
- onClose: () => b(!1),
577
- showConnectionsWidget: p,
578
- title: d.manage_connections
579
- })]
580
- });
581
- }), He = ({ budget: t }) => {
582
- const { amount: o, budgetColors: { background: i }, category: { name: r }, category_guid: n, percentage: s, transaction_total: a } = t, c = [{
583
- color: i,
584
- percentage: `${s}%`
585
- }];
586
- return /* @__PURE__ */ e(xe, {
587
- sx: {
588
- mt: 24,
589
- mx: 24
502
+ ) });
503
+ }, We = I(
504
+ ({
505
+ createBudgetOnClick: t = () => {
590
506
  },
591
- children: /* @__PURE__ */ e(Ae, { children: /* @__PURE__ */ m(x, {
592
- alignItems: "center",
593
- gap: 16,
594
- children: [
595
- /* @__PURE__ */ e(H, {
596
- categoryGuid: n,
597
- size: 56
598
- }),
599
- /* @__PURE__ */ e(v, {
600
- variant: "h1",
601
- children: `${D(a, "0,0")} / ${D(o, "0,0")}`
602
- }),
603
- /* @__PURE__ */ e(v, {
604
- bold: !0,
605
- variant: "caption",
606
- children: r
607
- }),
608
- /* @__PURE__ */ e(ve, {
609
- data: c,
610
- height: 10
611
- })
612
- ]
613
- }) })
614
- });
615
- }, Rt = I(() => {
616
- const { budgets: t } = w();
617
- return /* @__PURE__ */ m(x, {
618
- alignItems: "center",
619
- gap: 12,
620
- height: "auto",
621
- mb: 24,
622
- mt: 24,
623
- children: [
624
- /* @__PURE__ */ e(z, {
625
- color: "action",
626
- name: "bubble_chart",
627
- sx: { fontSize: 32 }
628
- }),
629
- /* @__PURE__ */ e(v, {
630
- bold: !0,
631
- color: "text.secondary",
632
- variant: "body2",
633
- children: t.zero_state_no_sub_budgets
634
- }),
635
- /* @__PURE__ */ e(v, {
636
- color: "text.secondary",
637
- variant: "caption",
638
- children: t.zero_state_no_sub_budgets_description
639
- })
640
- ]
641
- });
642
- }), Mt = I(({ budget: t }) => {
643
- const { amount: o, budgetColors: { background: i }, category: r, percentage: n, transaction_total: s } = t, { setSelectedSubBudget: a } = E();
644
- return /* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(ne, {
645
- onClick: () => a(t),
646
- children: [/* @__PURE__ */ e(pe, {
647
- sx: {
648
- mb: -8,
649
- mr: 16
650
- },
651
- children: /* @__PURE__ */ e(Le, {
652
- color: i,
653
- percent: n,
654
- size: 40,
655
- children: /* @__PURE__ */ e(H, {
656
- categoryGuid: r.parent_guid,
657
- variant: "basic"
658
- })
659
- })
660
- }), /* @__PURE__ */ e(ae, {
661
- primary: /* @__PURE__ */ e(x, {
662
- component: "span",
663
- direction: "row",
664
- justifyContent: "space-between",
665
- children: /* @__PURE__ */ e(v, {
666
- bold: !0,
667
- variant: "body1",
668
- children: t.category.name
669
- })
670
- }),
671
- secondary: /* @__PURE__ */ e(x, {
672
- component: "span",
673
- direction: "row",
674
- justifyContent: "space-between",
675
- children: /* @__PURE__ */ e(v, {
676
- fontWeight: 400,
677
- variant: "body1",
678
- children: `
507
+ height: n,
508
+ isDraggable: c = !1,
509
+ isMiniWidget: i = !1,
510
+ shouldShowZeroState: a,
511
+ unavailableWidth: s = 24
512
+ }) => {
513
+ const { onEvent: o } = J(), { setSelectedBudget: r } = w(), { isInitialized: p } = Q(), { accounts: d } = E(), { availableWidth: u } = de(), { isMobile: S } = ge(), [g, h] = l.useState(!1), _ = l.useMemo(() => u - s, [u]), y = (v) => {
514
+ r(v), o(P.BUDGETS_CLICK_BUDGET_CATEGORY, {
515
+ budget_category: v.category.name,
516
+ click_type: "bubble"
517
+ });
518
+ }, A = () => {
519
+ h(!0), o(P.ACCOUNTS_CLICK_CONNECT);
520
+ };
521
+ return /* @__PURE__ */ m(
522
+ X,
523
+ {
524
+ ml: a || S ? 0 : 24,
525
+ sx: { alignSelf: "center", ...i && { height: "100%" } },
526
+ children: [
527
+ a || !p ? /* @__PURE__ */ e(
528
+ Ot,
529
+ {
530
+ createBudgetOnClick: t,
531
+ isMiniWidget: i,
532
+ onConnectAccountsClick: A
533
+ }
534
+ ) : /* @__PURE__ */ e(
535
+ It,
536
+ {
537
+ height: n,
538
+ isDraggable: c,
539
+ onClick: y,
540
+ width: _
541
+ }
542
+ ),
543
+ /* @__PURE__ */ e(
544
+ qe,
545
+ {
546
+ onClose: () => h(!1),
547
+ showConnectionsWidget: g,
548
+ title: d.manage_connections
549
+ }
550
+ )
551
+ ]
552
+ }
553
+ );
554
+ }
555
+ ), He = ({ budget: t }) => {
556
+ const {
557
+ amount: n,
558
+ budgetColors: { background: c },
559
+ category: { name: i },
560
+ category_guid: a,
561
+ percentage: s,
562
+ transaction_total: o
563
+ } = t, r = [
564
+ {
565
+ color: c,
566
+ percentage: `${s}%`
567
+ }
568
+ ];
569
+ return /* @__PURE__ */ e(Te, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(De, { children: /* @__PURE__ */ m(x, { alignItems: "center", gap: 16, children: [
570
+ /* @__PURE__ */ e(V, { categoryGuid: a, size: 56 }),
571
+ /* @__PURE__ */ e(C, { variant: "h1", children: `${D(o, "0,0")} / ${D(n, "0,0")}` }),
572
+ /* @__PURE__ */ e(C, { bold: !0, variant: "caption", children: i }),
573
+ /* @__PURE__ */ e(Se, { data: r, height: 10 })
574
+ ] }) }) });
575
+ }, Mt = I(() => {
576
+ const { budgets: t } = E();
577
+ return /* @__PURE__ */ m(x, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
578
+ /* @__PURE__ */ e(z, { color: "action", name: "bubble_chart", sx: { fontSize: 32 } }),
579
+ /* @__PURE__ */ e(C, { bold: !0, color: "text.secondary", variant: "body2", children: t.zero_state_no_sub_budgets }),
580
+ /* @__PURE__ */ e(C, { color: "text.secondary", variant: "caption", children: t.zero_state_no_sub_budgets_description })
581
+ ] });
582
+ }), Rt = I(({ budget: t }) => {
583
+ const {
584
+ amount: n,
585
+ budgetColors: { background: c },
586
+ category: i,
587
+ percentage: a,
588
+ transaction_total: s
589
+ } = t, { setSelectedSubBudget: o } = w();
590
+ return /* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(oe, { onClick: () => o(t), children: [
591
+ /* @__PURE__ */ e(me, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Ge, { color: c, percent: a, size: 40, children: /* @__PURE__ */ e(V, { categoryGuid: i.parent_guid, variant: "basic" }) }) }),
592
+ /* @__PURE__ */ e(
593
+ ne,
594
+ {
595
+ primary: /* @__PURE__ */ e(x, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(C, { bold: !0, variant: "body1", children: t.category.name }) }),
596
+ secondary: /* @__PURE__ */ e(x, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(C, { fontWeight: 400, variant: "body1", children: `
679
597
  ${D(s, "0,0")} /
680
- ${D(o, "0,0")}
681
- `
682
- })
683
- })
684
- })]
685
- }) });
686
- }), Lt = I(({ category: t, parentBudget: o }) => {
687
- const { budgets: i, common: r } = w(), { setExpandedGuid: n, setOnSelect: s } = et(), { addBudget: a } = E(), [c, g] = l.useState(!1), [d, u] = l.useState(!1), [C, p] = l.useState(""), [b, f] = l.useState(void 0);
598
+ ${D(n, "0,0")}
599
+ ` }) })
600
+ }
601
+ )
602
+ ] }) });
603
+ }), Lt = I(({ category: t, parentBudget: n }) => {
604
+ const { budgets: c, common: i } = E(), { setExpandedGuid: a, setOnSelect: s } = nt(), { addBudget: o } = w(), [r, p] = l.useState(!1), [d, u] = l.useState(!1), [S, g] = l.useState(""), [h, _] = l.useState(void 0);
688
605
  l.useEffect(() => {
689
- s((A) => {
690
- const h = t.subCategories.find((B) => B.guid === A);
691
- h && (f(h), p(`${h.currentAmount === 0 ? "" : h.currentAmount}`), u(!0));
606
+ s((v) => {
607
+ const b = t.subCategories.find((B) => B.guid === v);
608
+ b && (_(b), g(`${b.currentAmount === 0 ? "" : b.currentAmount}`), u(!0));
692
609
  });
693
610
  }, []);
694
- const _ = () => {
695
- n(t.guid), g(!0);
696
- }, S = async () => {
697
- b && Number(C) > 0 && (await a(b, Number(C), o.guid), u(!1), g(!1), f(void 0));
611
+ const y = () => {
612
+ a(t.guid), p(!0);
613
+ }, A = async () => {
614
+ h && Number(S) > 0 && (await o(h, Number(S), n.guid), u(!1), p(!1), _(void 0));
698
615
  };
699
- return /* @__PURE__ */ m(Q, { children: [
700
- /* @__PURE__ */ e(te, {
701
- disableGutters: !0,
702
- disablePadding: !0,
703
- sx: { bgcolor: "background.paper" },
704
- children: /* @__PURE__ */ e(ne, {
705
- onClick: _,
706
- children: /* @__PURE__ */ e(ae, { children: /* @__PURE__ */ m(x, {
707
- alignItems: "center",
708
- direction: "row",
709
- justifyContent: "space-between",
710
- children: [/* @__PURE__ */ m(x, {
711
- alignItems: "center",
712
- direction: "row",
713
- gap: 8,
714
- children: [/* @__PURE__ */ e(z, {
715
- fill: !0,
716
- name: "add_box",
717
- size: 24,
718
- sx: { color: "primary.light" }
719
- }), /* @__PURE__ */ e(v, {
720
- bold: !0,
721
- sx: { color: "primary.light" },
722
- variant: "body1",
723
- children: i.add_sub_budget_button
724
- })]
725
- }), /* @__PURE__ */ e(z, {
726
- name: "chevron_right",
727
- size: 24,
728
- sx: { color: "primary.light" }
729
- })]
730
- }) })
731
- })
732
- }),
733
- /* @__PURE__ */ e(ge, {}),
734
- /* @__PURE__ */ e($, {
735
- ariaLabelClose: r.close_aria,
736
- isOpen: c,
737
- onClose: () => g(!1),
738
- title: i.add_sub_budget_title,
739
- children: /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e(Qe, {
740
- category: t,
741
- subCategories: t.subCategories
742
- }) })
743
- }),
744
- /* @__PURE__ */ e(W, {
745
- copy: {
746
- close_aria: r.close_aria,
747
- title: i.add_title
748
- },
749
- disablePrimaryButton: Number(C) <= 0,
750
- isOpen: d,
751
- onClose: () => u(!1),
752
- onPrimaryAction: S,
753
- primaryText: i.add_save_button,
754
- children: /* @__PURE__ */ e(he, {
755
- amount: C,
756
- categoryName: b?.name || "",
757
- onAmountChanged: p
758
- })
759
- })
616
+ return /* @__PURE__ */ m(X, { children: [
617
+ /* @__PURE__ */ e(te, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(oe, { onClick: y, children: /* @__PURE__ */ e(ne, { children: /* @__PURE__ */ m(x, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
618
+ /* @__PURE__ */ m(x, { alignItems: "center", direction: "row", gap: 8, children: [
619
+ /* @__PURE__ */ e(z, { fill: !0, name: "add_box", size: 24, sx: { color: "primary.light" } }),
620
+ /* @__PURE__ */ e(C, { bold: !0, sx: { color: "primary.light" }, variant: "body1", children: c.add_sub_budget_button })
621
+ ] }),
622
+ /* @__PURE__ */ e(z, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
623
+ ] }) }) }) }),
624
+ /* @__PURE__ */ e(ue, {}),
625
+ /* @__PURE__ */ e(
626
+ $,
627
+ {
628
+ ariaLabelClose: i.close_aria,
629
+ isOpen: r,
630
+ onClose: () => p(!1),
631
+ title: c.add_sub_budget_title,
632
+ children: /* @__PURE__ */ e(Z, { children: /* @__PURE__ */ e(at, { category: t, subCategories: t.subCategories }) })
633
+ }
634
+ ),
635
+ /* @__PURE__ */ e(
636
+ W,
637
+ {
638
+ copy: { close_aria: i.close_aria, title: c.add_title },
639
+ disablePrimaryButton: Number(S) <= 0,
640
+ isOpen: d,
641
+ onClose: () => u(!1),
642
+ onPrimaryAction: A,
643
+ primaryText: c.add_save_button,
644
+ children: /* @__PURE__ */ e(
645
+ he,
646
+ {
647
+ amount: S,
648
+ categoryName: h?.name || "",
649
+ onAmountChanged: g
650
+ }
651
+ )
652
+ }
653
+ )
760
654
  ] });
761
655
  }), Nt = I(({ budget: t }) => {
762
- const { category: o, subBudgets: i } = t, { budgets: r, common: n } = w(), { deleteBudget: s, selectedSubBudget: a, setSelectedSubBudget: c, updateBudget: g } = E(), { filter: d, setFilter: u } = X(), [C, p] = l.useState(!1), [b, f] = l.useState(!1), [_, S] = l.useState("");
656
+ const { category: n, subBudgets: c } = t, { budgets: i, common: a } = E(), { deleteBudget: s, selectedSubBudget: o, setSelectedSubBudget: r, updateBudget: p } = w(), { filter: d, setFilter: u } = ee(), [S, g] = l.useState(!1), [h, _] = l.useState(!1), [y, A] = l.useState("");
763
657
  l.useEffect(() => {
764
- a && (S(`${a.amount}`), u({
658
+ o && (A(`${o.amount}`), u({
765
659
  ...d,
766
- custom: (y) => y.category_guid === a.category_guid
660
+ custom: (f) => f.category_guid === o.category_guid
767
661
  }));
768
- }, [a]);
769
- const A = async () => {
770
- a && await g({
771
- ...a,
772
- amount: Number(_)
662
+ }, [o]);
663
+ const v = async () => {
664
+ o && await p({
665
+ ...o,
666
+ amount: Number(y)
773
667
  });
774
- }, h = async () => {
775
- a && await s(a.guid), f(!1), B();
668
+ }, b = async () => {
669
+ o && await s(o.guid), _(!1), B();
776
670
  }, B = () => {
777
671
  u({
778
672
  ...d,
779
- custom: (y) => y.category_guid === t.category_guid || y.top_level_category_guid === t.category_guid
780
- }), c(void 0);
673
+ custom: (f) => f.category_guid === t.category_guid || f.top_level_category_guid === t.category_guid
674
+ }), r(void 0);
781
675
  };
782
676
  return /* @__PURE__ */ m(l.Fragment, { children: [
783
- /* @__PURE__ */ m(ee, {
784
- sx: { bgcolor: "background.paper" },
785
- children: [i.length === 0 ? /* @__PURE__ */ e(Rt, {}) : i.map((y) => /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ e(Mt, { budget: y }), /* @__PURE__ */ e(ge, {})] }, y.guid)), /* @__PURE__ */ e(Lt, {
786
- category: o,
787
- parentBudget: t
788
- })]
789
- }),
790
- /* @__PURE__ */ e($, {
791
- ariaLabelClose: n.close_aria,
792
- isOpen: !!a,
793
- onClose: B,
794
- onPrimaryAction: () => p(!0),
795
- onSecondaryAction: () => f(!0),
796
- primaryText: r.details_edit_button,
797
- secondaryText: r.details_delete_button,
798
- title: r.details_title,
799
- children: a && /* @__PURE__ */ m(x, {
800
- gap: 24,
801
- children: [/* @__PURE__ */ e(He, { budget: a }), /* @__PURE__ */ e(Se, { height: "100%" })]
802
- })
803
- }),
804
- a && /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ e(W, {
805
- copy: {
806
- close_aria: n.close_aria,
807
- title: r.details_edit_title
808
- },
809
- disablePrimaryButton: Number(_) <= 0,
810
- isOpen: C,
811
- onClose: () => p(!1),
812
- onPrimaryAction: A,
813
- primaryText: r.edit_save_button,
814
- children: /* @__PURE__ */ e(he, {
815
- amount: _,
816
- categoryName: a.category.name,
817
- onAmountChanged: S
818
- })
819
- }), /* @__PURE__ */ e(W, {
820
- copy: {
821
- close_aria: n.close_aria,
822
- title: r.delete_title
823
- },
824
- isOpen: b,
825
- onClose: () => f(!1),
826
- onPrimaryAction: h,
827
- primaryColor: "error",
828
- primaryText: "Delete",
829
- secondaryColor: "secondary",
830
- children: /* @__PURE__ */ e(v, {
831
- variant: "subtitle1",
832
- children: R(r.delete_description, a.category.name)
833
- })
834
- })] })
677
+ /* @__PURE__ */ m(Z, { sx: { bgcolor: "background.paper" }, children: [
678
+ c.length === 0 ? /* @__PURE__ */ e(Mt, {}) : c.map((f) => /* @__PURE__ */ m(l.Fragment, { children: [
679
+ /* @__PURE__ */ e(Rt, { budget: f }),
680
+ /* @__PURE__ */ e(ue, {})
681
+ ] }, f.guid)),
682
+ /* @__PURE__ */ e(Lt, { category: n, parentBudget: t })
683
+ ] }),
684
+ /* @__PURE__ */ e(
685
+ $,
686
+ {
687
+ ariaLabelClose: a.close_aria,
688
+ isOpen: !!o,
689
+ onClose: B,
690
+ onPrimaryAction: () => g(!0),
691
+ onSecondaryAction: () => _(!0),
692
+ primaryText: i.details_edit_button,
693
+ secondaryText: i.details_delete_button,
694
+ title: i.details_title,
695
+ children: o && /* @__PURE__ */ m(x, { gap: 24, children: [
696
+ /* @__PURE__ */ e(He, { budget: o }),
697
+ /* @__PURE__ */ e(ve, { height: "100%" })
698
+ ] })
699
+ }
700
+ ),
701
+ o && /* @__PURE__ */ m(l.Fragment, { children: [
702
+ /* @__PURE__ */ e(
703
+ W,
704
+ {
705
+ copy: { close_aria: a.close_aria, title: i.details_edit_title },
706
+ disablePrimaryButton: Number(y) <= 0,
707
+ isOpen: S,
708
+ onClose: () => g(!1),
709
+ onPrimaryAction: v,
710
+ primaryText: i.edit_save_button,
711
+ children: /* @__PURE__ */ e(
712
+ he,
713
+ {
714
+ amount: y,
715
+ categoryName: o.category.name,
716
+ onAmountChanged: A
717
+ }
718
+ )
719
+ }
720
+ ),
721
+ /* @__PURE__ */ e(
722
+ W,
723
+ {
724
+ copy: { close_aria: a.close_aria, title: i.delete_title },
725
+ isOpen: h,
726
+ onClose: () => _(!1),
727
+ onPrimaryAction: b,
728
+ primaryColor: "error",
729
+ primaryText: "Delete",
730
+ secondaryColor: "secondary",
731
+ children: /* @__PURE__ */ e(C, { variant: "subtitle1", children: R(i.delete_description, o.category.name) })
732
+ }
733
+ )
734
+ ] })
835
735
  ] });
836
736
  }), kt = I(({ budget: t }) => {
837
- const { is_mobile_webview: o } = ke(), { setAlert: i } = E(), { budgets: r, common: n, transactions: s } = w(), { isDesktop: a, isSmallTablet: c, isTablet: g } = le(), { sortedTransactions: d, sortedTransactionsWithSplits: u, tags: C } = X(), [p, b] = l.useState(0), [f, _] = l.useState(""), S = l.useMemo(() => d.find((y) => y.guid === f), [f, d]), A = (y, T) => {
838
- b(T);
839
- }, h = () => {
840
- Ye(u, C), i(r.alert_csv_downloaded);
841
- }, B = d.length > 0 && !o && (a || g && !c);
842
- return /* @__PURE__ */ m(x, {
843
- gap: 24,
844
- children: [/* @__PURE__ */ e(He, { budget: t }), /* @__PURE__ */ m(x, { children: [
845
- /* @__PURE__ */ m(ct, {
846
- onChange: A,
847
- sx: { width: "100%" },
848
- textColor: "primary",
849
- value: p,
850
- variant: "fullWidth",
851
- children: [/* @__PURE__ */ e(we, { label: r.details_transactions_tab }), /* @__PURE__ */ e(we, { label: r.details_subbudgets_tab })]
852
- }),
853
- p === 0 && /* @__PURE__ */ m(x, { children: [B && /* @__PURE__ */ e(x, {
854
- direction: "row",
855
- justifyContent: "right",
856
- mb: -24,
857
- mr: 8,
858
- mt: 8,
859
- zIndex: 1,
860
- children: /* @__PURE__ */ e(Pe, {
861
- onClick: h,
862
- startIcon: /* @__PURE__ */ e(z, { name: "ios_share" }),
863
- variant: "text",
864
- children: s.export_csv_btn
865
- })
866
- }), /* @__PURE__ */ e(Se, {
867
- height: "100%",
868
- onClick: _
869
- })] }),
870
- p === 1 && /* @__PURE__ */ e(Nt, { budget: t }),
871
- /* @__PURE__ */ e($, {
872
- ariaLabelClose: n.close_aria,
873
- isOpen: !!S,
874
- onClose: () => _(""),
875
- title: r.details_transaction_drawer,
876
- children: S && /* @__PURE__ */ e(Je, { transaction: S })
877
- })
878
- ] })]
879
- });
737
+ const { is_mobile_webview: n } = Ne(), { setAlert: c } = w(), { budgets: i, common: a, transactions: s } = E(), { isDesktop: o, isSmallTablet: r, isTablet: p } = ge(), {
738
+ sortedTransactions: d,
739
+ sortedTransactionsWithSplits: u,
740
+ tags: S
741
+ } = ee(), [g, h] = l.useState(0), [_, y] = l.useState(""), A = l.useMemo(
742
+ () => d.find((f) => f.guid === _),
743
+ [_, d]
744
+ ), v = (f, T) => {
745
+ h(T);
746
+ }, b = () => {
747
+ et(u, S), c(i.alert_csv_downloaded);
748
+ }, B = d.length > 0 && !n && (o || p && !r);
749
+ return /* @__PURE__ */ m(x, { gap: 24, children: [
750
+ /* @__PURE__ */ e(He, { budget: t }),
751
+ /* @__PURE__ */ m(x, { children: [
752
+ /* @__PURE__ */ m(
753
+ Qe,
754
+ {
755
+ onChange: v,
756
+ sx: { width: "100%" },
757
+ textColor: "primary",
758
+ value: g,
759
+ variant: "fullWidth",
760
+ children: [
761
+ /* @__PURE__ */ e(Ee, { label: i.details_transactions_tab }),
762
+ /* @__PURE__ */ e(Ee, { label: i.details_subbudgets_tab })
763
+ ]
764
+ }
765
+ ),
766
+ g === 0 && /* @__PURE__ */ m(x, { children: [
767
+ B && /* @__PURE__ */ e(x, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
768
+ $e,
769
+ {
770
+ onClick: b,
771
+ startIcon: /* @__PURE__ */ e(z, { name: "ios_share" }),
772
+ variant: "text",
773
+ children: s.export_csv_btn
774
+ }
775
+ ) }),
776
+ /* @__PURE__ */ e(ve, { height: "100%", onClick: y })
777
+ ] }),
778
+ g === 1 && /* @__PURE__ */ e(Nt, { budget: t }),
779
+ /* @__PURE__ */ e(
780
+ $,
781
+ {
782
+ ariaLabelClose: a.close_aria,
783
+ isOpen: !!A,
784
+ onClose: () => y(""),
785
+ title: i.details_transaction_drawer,
786
+ children: A && /* @__PURE__ */ e(tt, { transaction: A })
787
+ }
788
+ )
789
+ ] })
790
+ ] });
880
791
  }), $t = I(() => {
881
- const { selectedAccountGuids: t } = q(), { budgets: o, common: i } = w(), { alert: r, dateRange: n, deleteBudget: s, selectedBudget: a, selectedSubBudget: c, setAlert: g, setSelectedBudget: d, updateBudget: u } = E(), { setFilter: C } = X(), [p, b] = l.useState(!1), [f, _] = l.useState(!1), [S, A] = l.useState(!1), [h, B] = l.useState("");
792
+ const { selectedAccountGuids: t } = Q(), { budgets: n, common: c } = E(), {
793
+ alert: i,
794
+ dateRange: a,
795
+ deleteBudget: s,
796
+ selectedBudget: o,
797
+ selectedSubBudget: r,
798
+ setAlert: p,
799
+ setSelectedBudget: d,
800
+ updateBudget: u
801
+ } = w(), { setFilter: S } = ee(), [g, h] = l.useState(!1), [_, y] = l.useState(!1), [A, v] = l.useState(!1), [b, B] = l.useState("");
882
802
  l.useEffect(() => {
883
- a && !c && (B(`${a.amount}`), b(!0), C({
803
+ o && !r && (B(`${o.amount}`), h(!0), S({
884
804
  accounts: t,
885
- dateRange: n,
886
- custom: (N) => N.category_guid === a.category_guid || N.top_level_category_guid === a.category_guid,
805
+ dateRange: a,
806
+ custom: (N) => N.category_guid === o.category_guid || N.top_level_category_guid === o.category_guid,
887
807
  showSplits: !0
888
808
  }));
889
- }, [a]);
890
- const y = async () => {
891
- a && (await u({
892
- ...a,
893
- amount: Number(h),
894
- percentage: a.category.totalAmount / Number(h) * 100
895
- }), _(!1), g(R(o.alert_budget_updated, a.category.name)));
809
+ }, [o]);
810
+ const f = async () => {
811
+ o && (await u({
812
+ ...o,
813
+ amount: Number(b),
814
+ percentage: o.category.totalAmount / Number(b) * 100
815
+ }), y(!1), p(R(n.alert_budget_updated, o.category.name)));
896
816
  }, T = async () => {
897
- a && (await s(a.guid), g(R(o.alert_budget_deleted, a.category.name))), M();
898
- }, M = () => {
899
- b(!1), setTimeout(() => {
817
+ o && (await s(o.guid), p(R(n.alert_budget_deleted, o.category.name))), L();
818
+ }, L = () => {
819
+ h(!1), setTimeout(() => {
900
820
  d(void 0);
901
821
  }, 250);
902
- }, L = () => {
903
- _(!1), B(`${a?.amount}`);
822
+ }, M = () => {
823
+ y(!1), B(`${o?.amount}`);
904
824
  };
905
- if (a)
825
+ if (o)
906
826
  return /* @__PURE__ */ m(l.Fragment, { children: [
907
- /* @__PURE__ */ m($, {
908
- ariaLabelClose: i.close_aria,
909
- isOpen: p,
910
- onClose: M,
911
- onPrimaryAction: () => _(!0),
912
- onSecondaryAction: () => A(!0),
913
- primaryText: o.details_edit_button,
914
- secondaryColor: "error",
915
- secondaryText: o.details_delete_button,
916
- title: o.details_title,
917
- children: [/* @__PURE__ */ e(kt, { budget: a }), /* @__PURE__ */ e(De, {
918
- anchorOrigin: {
919
- vertical: "bottom",
920
- horizontal: "right"
921
- },
922
- autoHideDuration: 3500,
923
- onClose: () => g(""),
924
- open: !!r,
925
- children: /* @__PURE__ */ e(Te, {
926
- closeText: "",
927
- onClose: () => g(""),
928
- severity: "success",
929
- variant: "filled",
930
- children: r
931
- })
932
- })]
933
- }),
934
- /* @__PURE__ */ e(W, {
935
- copy: {
936
- close_aria: i.close_aria,
937
- title: o.details_edit_title
938
- },
939
- disablePrimaryButton: Number(h) <= 0,
940
- isOpen: f,
941
- onClose: L,
942
- onPrimaryAction: y,
943
- onSecondaryAction: L,
944
- primaryText: o.edit_save_button,
945
- children: /* @__PURE__ */ e(he, {
946
- amount: h,
947
- categoryName: a.category.name,
948
- onAmountChanged: B
949
- })
950
- }),
951
- /* @__PURE__ */ e(W, {
952
- copy: {
953
- close_aria: i.close_aria,
954
- title: o.delete_title
955
- },
956
- isOpen: S,
957
- onClose: () => A(!1),
958
- onPrimaryAction: T,
959
- primaryColor: "error",
960
- primaryText: o.details_delete_button,
961
- secondaryColor: "secondary",
962
- children: /* @__PURE__ */ e(v, {
963
- variant: "subtitle1",
964
- children: R(o.delete_description, a.category.name)
965
- })
966
- })
827
+ /* @__PURE__ */ m(
828
+ $,
829
+ {
830
+ ariaLabelClose: c.close_aria,
831
+ isOpen: g,
832
+ onClose: L,
833
+ onPrimaryAction: () => y(!0),
834
+ onSecondaryAction: () => v(!0),
835
+ primaryText: n.details_edit_button,
836
+ secondaryColor: "error",
837
+ secondaryText: n.details_delete_button,
838
+ title: n.details_title,
839
+ children: [
840
+ /* @__PURE__ */ e(kt, { budget: o }),
841
+ /* @__PURE__ */ e(
842
+ xe,
843
+ {
844
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
845
+ autoHideDuration: 3500,
846
+ onClose: () => p(""),
847
+ open: !!i,
848
+ children: /* @__PURE__ */ e(Ae, { closeText: "", onClose: () => p(""), severity: "success", variant: "filled", children: i })
849
+ }
850
+ )
851
+ ]
852
+ }
853
+ ),
854
+ /* @__PURE__ */ e(
855
+ W,
856
+ {
857
+ copy: { close_aria: c.close_aria, title: n.details_edit_title },
858
+ disablePrimaryButton: Number(b) <= 0,
859
+ isOpen: _,
860
+ onClose: M,
861
+ onPrimaryAction: f,
862
+ onSecondaryAction: M,
863
+ primaryText: n.edit_save_button,
864
+ children: /* @__PURE__ */ e(
865
+ he,
866
+ {
867
+ amount: b,
868
+ categoryName: o.category.name,
869
+ onAmountChanged: B
870
+ }
871
+ )
872
+ }
873
+ ),
874
+ /* @__PURE__ */ e(
875
+ W,
876
+ {
877
+ copy: { close_aria: c.close_aria, title: n.delete_title },
878
+ isOpen: A,
879
+ onClose: () => v(!1),
880
+ onPrimaryAction: T,
881
+ primaryColor: "error",
882
+ primaryText: n.details_delete_button,
883
+ secondaryColor: "secondary",
884
+ children: /* @__PURE__ */ e(C, { variant: "subtitle1", children: R(n.delete_description, o.category.name) })
885
+ }
886
+ )
967
887
  ] });
968
- }), Gt = ({ budget: t, onClick: o }) => {
969
- const { amount: i, budgetColors: { background: r, description: n }, category_guid: s, description: a, percentage: c, subBudgets: g, transaction_total: d } = t, u = c > 100;
970
- return /* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(ne, {
971
- onClick: () => o?.(t),
972
- children: [/* @__PURE__ */ e(pe, {
973
- sx: {
974
- mb: -8,
975
- mr: 16
976
- },
977
- children: /* @__PURE__ */ e(Le, {
978
- color: r,
979
- percent: c,
980
- size: 40,
981
- children: /* @__PURE__ */ e(H, {
982
- categoryGuid: s,
983
- variant: "basic"
984
- })
985
- })
986
- }), /* @__PURE__ */ e(ae, {
987
- primary: /* @__PURE__ */ m(x, {
988
- component: "span",
989
- direction: "row",
990
- justifyContent: "space-between",
991
- children: [/* @__PURE__ */ e(v, {
992
- bold: !0,
993
- variant: "body1",
994
- children: t.category.name
995
- }), /* @__PURE__ */ e(v, {
996
- fontWeight: 400,
997
- variant: "body1",
998
- children: `
888
+ }), Gt = ({ budget: t, onClick: n }) => {
889
+ const {
890
+ amount: c,
891
+ budgetColors: { background: i, description: a },
892
+ category_guid: s,
893
+ description: o,
894
+ percentage: r,
895
+ subBudgets: p,
896
+ transaction_total: d
897
+ } = t, u = r > 100;
898
+ return /* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(oe, { onClick: () => n?.(t), children: [
899
+ /* @__PURE__ */ e(me, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Ge, { color: i, percent: r, size: 40, children: /* @__PURE__ */ e(V, { categoryGuid: s, variant: "basic" }) }) }),
900
+ /* @__PURE__ */ e(
901
+ ne,
902
+ {
903
+ primary: /* @__PURE__ */ m(x, { component: "span", direction: "row", justifyContent: "space-between", children: [
904
+ /* @__PURE__ */ e(C, { bold: !0, variant: "body1", children: t.category.name }),
905
+ /* @__PURE__ */ e(C, { fontWeight: 400, variant: "body1", children: `
999
906
  ${D(d, "0,0")} /
1000
- ${D(i, "0,0")}
1001
- `
1002
- })]
1003
- }),
1004
- secondary: /* @__PURE__ */ m(x, {
1005
- component: "span",
1006
- direction: "row",
1007
- justifyContent: "space-between",
1008
- children: [/* @__PURE__ */ e(v, {
1009
- variant: "caption",
1010
- children: `${g.length} Sub-budgets`
1011
- }), /* @__PURE__ */ e(v, {
1012
- bold: u,
1013
- sx: {
1014
- color: n,
1015
- ...u && { ".MuiListItemButton-root:hover &, .MuiListItemButton-root:active &": { color: "error.dark" } }
1016
- },
1017
- variant: "caption",
1018
- children: a
1019
- })]
1020
- })
1021
- })]
1022
- }) });
907
+ ${D(c, "0,0")}
908
+ ` })
909
+ ] }),
910
+ secondary: /* @__PURE__ */ m(x, { component: "span", direction: "row", justifyContent: "space-between", children: [
911
+ /* @__PURE__ */ e(C, { variant: "caption", children: `${p.length} Sub-budgets` }),
912
+ /* @__PURE__ */ e(
913
+ C,
914
+ {
915
+ bold: u,
916
+ sx: {
917
+ color: a,
918
+ ...u && {
919
+ ".MuiListItemButton-root:hover &, .MuiListItemButton-root:active &": {
920
+ color: "error.dark"
921
+ }
922
+ }
923
+ },
924
+ variant: "caption",
925
+ children: o
926
+ }
927
+ )
928
+ ] })
929
+ }
930
+ )
931
+ ] }) });
1023
932
  }, Pt = I(() => {
1024
- const { onEvent: t } = Z(), { budgets: o } = w(), { detailedBudgets: i, setSelectedBudget: r } = E(), n = (s) => {
1025
- r(s), t(P.BUDGETS_CLICK_BUDGET_CATEGORY, {
933
+ const { onEvent: t } = J(), { budgets: n } = E(), { detailedBudgets: c, setSelectedBudget: i } = w(), a = (s) => {
934
+ i(s), t(P.BUDGETS_CLICK_BUDGET_CATEGORY, {
1026
935
  budget_category: s.category.name,
1027
936
  click_type: "list"
1028
937
  });
1029
938
  };
1030
- return /* @__PURE__ */ m(xe, {
1031
- elevation: 2,
1032
- children: [/* @__PURE__ */ e(je, {
1033
- sx: {
1034
- pb: 8,
1035
- pl: 24
1036
- },
1037
- title: /* @__PURE__ */ e(Ge, { children: o.budget_categories_title })
1038
- }), /* @__PURE__ */ e(Ae, {
1039
- sx: {
1040
- p: 0,
1041
- ":last-child": { p: 0 }
1042
- },
1043
- children: /* @__PURE__ */ e(ee, { children: i.map((s) => /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ e(Gt, {
1044
- budget: s,
1045
- onClick: n
1046
- }), /* @__PURE__ */ e(ge, {})] }, s.guid)) })
1047
- })]
1048
- });
939
+ return /* @__PURE__ */ m(Te, { elevation: 2, children: [
940
+ /* @__PURE__ */ e(Pe, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Le, { children: n.budget_categories_title }) }),
941
+ /* @__PURE__ */ e(De, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(Z, { children: c.map((s) => /* @__PURE__ */ m(l.Fragment, { children: [
942
+ /* @__PURE__ */ e(Gt, { budget: s, onClick: a }),
943
+ /* @__PURE__ */ e(ue, {})
944
+ ] }, s.guid)) }) })
945
+ ] });
1049
946
  }), jt = I(() => {
1050
- const t = V(), { onEvent: o } = Z(), { visibleAccounts: i } = $e(), { budgets: r, common: n, recurring: s } = w(), { incomeCategories: a, spendCategories: c } = J(), { detailedBudgets: g, totalBudgeted: d } = E(), { incomeTotal: u } = me(), { setFilter: C } = X(), [p, b] = l.useState(!1), [f, _] = l.useMemo(() => {
1051
- const B = c.reduce((M, L) => M + L.totalAmount, 0);
1052
- let y = B / d;
1053
- y > 1 && (y = 1);
947
+ const t = H(), { onEvent: n } = J(), { visibleAccounts: c } = ke(), { budgets: i, common: a, recurring: s } = E(), { incomeCategories: o, spendCategories: r } = q(), { detailedBudgets: p, totalBudgeted: d } = w(), { incomeTotal: u } = le(), { setFilter: S } = ee(), [g, h] = l.useState(!1), [_, y] = l.useMemo(() => {
948
+ const B = r.reduce((M, N) => M + N.totalAmount, 0);
949
+ let f = B / d;
950
+ f > 1 && (f = 1);
1054
951
  let T = t.palette.success.main;
1055
- return y > 0.8 && y < 1 ? T = t.palette.warning.main : y >= 1 && (T = t.palette.error.main), [B, [{
1056
- color: T,
1057
- percentage: `${y}`
1058
- }]];
1059
- }, [g, c]), [S, A] = l.useMemo(() => {
1060
- const B = Math.abs(a.reduce((T, M) => T + M.totalAmount, 0));
1061
- let y = B / u;
1062
- return y > 1 && (y = 1), [B, [{
1063
- color: t.palette.secondary.main,
1064
- percentage: `${y}`
1065
- }]];
1066
- }, [a, u]), h = () => {
1067
- C({
1068
- accounts: i.map((B) => B.guid),
952
+ f > 0.8 && f < 1 ? T = t.palette.warning.main : f >= 1 && (T = t.palette.error.main);
953
+ const L = [
954
+ {
955
+ color: T,
956
+ percentage: `${f}`
957
+ }
958
+ ];
959
+ return [B, L];
960
+ }, [p, r]), [A, v] = l.useMemo(() => {
961
+ const B = Math.abs(
962
+ o.reduce((L, M) => L + M.totalAmount, 0)
963
+ );
964
+ let f = B / u;
965
+ f > 1 && (f = 1);
966
+ const T = [
967
+ {
968
+ color: t.palette.secondary.main,
969
+ percentage: `${f}`
970
+ }
971
+ ];
972
+ return [B, T];
973
+ }, [o, u]), b = () => {
974
+ S({
975
+ accounts: c.map((B) => B.guid),
1069
976
  dateRange: {
1070
- start: it(/* @__PURE__ */ new Date(), 90),
977
+ start: rt(/* @__PURE__ */ new Date(), 90),
1071
978
  end: /* @__PURE__ */ new Date()
1072
979
  }
1073
- }), b(!0), o(P.BUDGETS_CLICK_EDIT_INCOME);
980
+ }), h(!0), n(P.BUDGETS_CLICK_EDIT_INCOME);
1074
981
  };
1075
- return /* @__PURE__ */ m(xe, {
1076
- elevation: 2,
1077
- sx: { overflow: "visible" },
1078
- children: [
1079
- /* @__PURE__ */ e(je, {
1080
- sx: {
1081
- pb: 8,
1082
- pl: 24
1083
- },
1084
- title: /* @__PURE__ */ e(Ge, { children: r.overview_title })
1085
- }),
1086
- /* @__PURE__ */ e(Ae, {
1087
- sx: {
1088
- pt: 12,
1089
- px: 24
1090
- },
1091
- children: /* @__PURE__ */ m(x, {
1092
- gap: 24,
1093
- children: [/* @__PURE__ */ m(x, {
1094
- gap: 8,
1095
- children: [
1096
- /* @__PURE__ */ e(v, {
1097
- bold: !0,
1098
- sx: { mb: 8 },
1099
- variant: "body1",
1100
- children: r.spending_title
1101
- }),
1102
- /* @__PURE__ */ e(ve, {
1103
- data: _,
1104
- height: 16
1105
- }),
1106
- /* @__PURE__ */ e(v, {
1107
- variant: "body2",
1108
- children: R(r.spending_description, D(f, "0,0"), D(d, "0,0"))
1109
- })
1110
- ]
1111
- }), /* @__PURE__ */ m(x, {
1112
- gap: 8,
1113
- children: [
1114
- /* @__PURE__ */ m(x, {
1115
- alignItems: "center",
1116
- direction: "row",
1117
- gap: 4,
1118
- mb: -4,
1119
- children: [/* @__PURE__ */ e(v, {
1120
- bold: !0,
1121
- variant: "body1",
1122
- children: r.income_title
1123
- }), /* @__PURE__ */ e(lt, {
1124
- "aria-label": s.manage_income,
1125
- onClick: h,
1126
- sx: { p: 0 },
1127
- children: /* @__PURE__ */ e(z, {
1128
- color: "primary",
1129
- name: "edit"
1130
- })
1131
- })]
1132
- }),
1133
- /* @__PURE__ */ e(ve, {
1134
- data: A,
1135
- height: 16
1136
- }),
1137
- /* @__PURE__ */ e(v, {
1138
- variant: "body2",
1139
- children: R(r.income_description, D(S, "0,0"), D(u, "0,0"))
1140
- })
1141
- ]
1142
- })]
1143
- })
1144
- }),
1145
- /* @__PURE__ */ e($, {
1146
- ariaLabelClose: n.close_aria,
1147
- isOpen: p,
1148
- onClose: () => b(!1),
982
+ return /* @__PURE__ */ m(Te, { elevation: 2, sx: { overflow: "visible" }, children: [
983
+ /* @__PURE__ */ e(Pe, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Le, { children: i.overview_title }) }),
984
+ /* @__PURE__ */ e(De, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ m(x, { gap: 24, children: [
985
+ /* @__PURE__ */ m(x, { gap: 8, children: [
986
+ /* @__PURE__ */ e(C, { bold: !0, sx: { mb: 8 }, variant: "body1", children: i.spending_title }),
987
+ /* @__PURE__ */ e(Se, { data: y, height: 16 }),
988
+ /* @__PURE__ */ e(C, { variant: "body2", children: R(
989
+ i.spending_description,
990
+ D(_, "0,0"),
991
+ D(d, "0,0")
992
+ ) })
993
+ ] }),
994
+ /* @__PURE__ */ m(x, { gap: 8, children: [
995
+ /* @__PURE__ */ m(x, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
996
+ /* @__PURE__ */ e(C, { bold: !0, variant: "body1", children: i.income_title }),
997
+ /* @__PURE__ */ e(
998
+ st,
999
+ {
1000
+ "aria-label": s.manage_income,
1001
+ onClick: b,
1002
+ sx: { p: 0 },
1003
+ children: /* @__PURE__ */ e(z, { color: "primary", name: "edit" })
1004
+ }
1005
+ )
1006
+ ] }),
1007
+ /* @__PURE__ */ e(Se, { data: v, height: 16 }),
1008
+ /* @__PURE__ */ e(C, { variant: "body2", children: R(
1009
+ i.income_description,
1010
+ D(A, "0,0"),
1011
+ D(u, "0,0")
1012
+ ) })
1013
+ ] })
1014
+ ] }) }),
1015
+ /* @__PURE__ */ e(
1016
+ $,
1017
+ {
1018
+ ariaLabelClose: a.close_aria,
1019
+ isOpen: g,
1020
+ onClose: () => h(!1),
1149
1021
  title: s.manage_income,
1150
- children: /* @__PURE__ */ e(ot, { forOverview: !0 })
1151
- })
1152
- ]
1153
- });
1154
- }), Me = 480, Dn = I(({ onBackClick: t, onMenuClick: o, sx: i }) => {
1155
- const r = V(), { onEvent: n } = Z(), { visibleAccounts: s } = $e(), { budgets: a, common: c } = w(), { isInitialized: g, selectedAccounts: d, setDisplayedDate: u } = q(), { alert: C, dateRange: p, isDataLoaded: b, loadBudgetData: f, setDateRange: _, setAlert: S, setTheme: A, detailedBudgets: h } = E(), { setDateRange: B } = me(), { loadDateRangeCategoryTotals: y, loadMonthlyCategoryTotals: T } = J(), { isSmallTablet: M, isMobile: L, isSmallMobile: N } = le(), k = M || L || N, [G, F] = l.useState(!1);
1156
- Ne({
1157
- widgetName: "BubbleBudgetsWidget",
1158
- isLoaded: b
1159
- }), l.useEffect(() => {
1160
- A(r), b || f().finally(() => {
1161
- n(P.BUDGETS_VIEW);
1162
- });
1163
- }, []), l.useEffect(() => (_({
1164
- start: ie(re()),
1165
- end: Be(re())
1166
- }), () => {
1167
- _({
1168
- start: ie(re()),
1169
- end: Be(re())
1170
- });
1171
- }), [s]), l.useEffect(() => {
1172
- g && (u(p.start, p.end), y(d, p.start, p.end).finally(), T(d).finally(), B(p));
1173
- }, [
1174
- g,
1175
- d,
1176
- p
1177
- ]);
1178
- const ye = (Y) => {
1179
- _({
1180
- start: Y[0] || /* @__PURE__ */ new Date(),
1181
- end: Y[1] || /* @__PURE__ */ new Date()
1182
- });
1183
- }, _e = () => {
1184
- n(P.BUDGETS_CLICK_FILTER);
1185
- }, oe = () => {
1186
- F(!0), n(P.BUDGETS_CLICK_ADD);
1187
- }, be = () => {
1188
- F(!1);
1189
- }, j = () => {
1190
- F(!1);
1191
- }, K = dt(p.end, ie(/* @__PURE__ */ new Date()));
1192
- return !g || !b ? /* @__PURE__ */ e(ue, {}) : /* @__PURE__ */ m(Ze, {
1193
- actions: [{
1194
- iconName: "add",
1195
- label: a.add_title,
1196
- onClick: oe
1197
- }],
1198
- calendarActions: {
1199
- onRangeChanged: ye,
1200
- shouldDisableNext: K,
1201
- shouldDisablePicker: !0
1202
- },
1203
- hasDivider: !0,
1204
- onAccountsFilterClick: _e,
1205
- onBackClick: t,
1206
- onMenuClick: o,
1207
- sx: i,
1208
- title: a.budgets_title,
1209
- children: [
1210
- /* @__PURE__ */ m(x, {
1211
- direction: k ? "column" : "row",
1212
- height: "100%",
1213
- sx: { justifyContent: "center" },
1214
- width: "100%",
1215
- children: [/* @__PURE__ */ e(x, {
1216
- height: k ? 450 : "calc(100dvh - 150px)",
1217
- children: /* @__PURE__ */ e(We, {
1218
- createBudgetOnClick: oe,
1219
- height: k ? 450 : 800,
1220
- isDraggable: !0,
1221
- shouldShowZeroState: h.length === 0,
1222
- unavailableWidth: k ? 0 : Me
1223
- })
1224
- }), h.length !== 0 && /* @__PURE__ */ m(x, {
1225
- gap: 24,
1226
- height: "100%",
1227
- sx: {
1228
- mr: 24,
1229
- mt: 48
1230
- },
1231
- width: k ? "100%" : Me,
1232
- children: [/* @__PURE__ */ e(jt, {}), /* @__PURE__ */ e(Pt, {})]
1233
- })]
1234
- }),
1235
- /* @__PURE__ */ e($t, {}),
1236
- /* @__PURE__ */ e($, {
1237
- ariaLabelClose: c.close_aria,
1238
- isOpen: G,
1239
- onClose: () => F(!1),
1240
- title: a.add_new_title,
1241
- children: /* @__PURE__ */ e(ze, {
1242
- onAddBudget: be,
1243
- onRecalculateBudgets: j
1244
- })
1245
- }),
1246
- /* @__PURE__ */ e(De, {
1247
- anchorOrigin: {
1248
- vertical: "bottom",
1249
- horizontal: "right"
1250
- },
1251
- autoHideDuration: 3500,
1252
- onClose: () => {
1253
- S("");
1022
+ children: /* @__PURE__ */ e(it, { forOverview: !0 })
1023
+ }
1024
+ )
1025
+ ] });
1026
+ }), Re = 480, Uo = I(
1027
+ ({ onBackClick: t, onMenuClick: n, sx: c }) => {
1028
+ const i = H(), { onEvent: a } = J(), { visibleAccounts: s } = ke(), { budgets: o, common: r } = E(), { isInitialized: p, selectedAccounts: d, setDisplayedDate: u } = Q(), {
1029
+ alert: S,
1030
+ dateRange: g,
1031
+ isDataLoaded: h,
1032
+ loadBudgetData: _,
1033
+ setDateRange: y,
1034
+ setAlert: A,
1035
+ setTheme: v,
1036
+ detailedBudgets: b
1037
+ } = w(), { setDateRange: B } = le(), { loadDateRangeCategoryTotals: f, loadMonthlyCategoryTotals: T } = q(), { isSmallTablet: L, isMobile: M, isSmallMobile: N } = ge(), k = L || M || N, [G, F] = l.useState(!1);
1038
+ je({
1039
+ widgetName: "BubbleBudgetsWidget",
1040
+ isLoaded: h
1041
+ }), l.useEffect(() => {
1042
+ v(i), h || _().finally(() => {
1043
+ a(P.BUDGETS_VIEW);
1044
+ });
1045
+ }, []), l.useEffect(() => (y({ start: ie(re()), end: Be(re()) }), () => {
1046
+ y({ start: ie(re()), end: Be(re()) });
1047
+ }), [s]), l.useEffect(() => {
1048
+ p && (u(g.start, g.end), f(d, g.start, g.end).finally(), T(d).finally(), B(g));
1049
+ }, [p, d, g]);
1050
+ const be = (Y) => {
1051
+ y({ start: Y[0] || /* @__PURE__ */ new Date(), end: Y[1] || /* @__PURE__ */ new Date() });
1052
+ }, fe = () => {
1053
+ a(P.BUDGETS_CLICK_FILTER);
1054
+ }, ae = () => {
1055
+ F(!0), a(P.BUDGETS_CLICK_ADD);
1056
+ }, ye = () => {
1057
+ F(!1);
1058
+ }, j = () => {
1059
+ F(!1);
1060
+ }, K = Ke(g.end, ie(/* @__PURE__ */ new Date()));
1061
+ return !p || !h ? /* @__PURE__ */ e(pe, {}) : /* @__PURE__ */ m(
1062
+ ct,
1063
+ {
1064
+ actions: [
1065
+ {
1066
+ iconName: "add",
1067
+ label: o.add_title,
1068
+ onClick: ae
1069
+ }
1070
+ ],
1071
+ calendarActions: {
1072
+ onRangeChanged: be,
1073
+ shouldDisableNext: K,
1074
+ shouldDisablePicker: !0
1254
1075
  },
1255
- open: !!C,
1256
- children: /* @__PURE__ */ e(Te, {
1257
- closeText: "",
1258
- onClose: () => {
1259
- S("");
1260
- },
1261
- severity: "success",
1262
- variant: "filled",
1263
- children: C
1264
- })
1265
- })
1266
- ]
1267
- });
1268
- }), zt = ({ budgetsCopy: t, difference: o, handleAddClick: i, shouldShowZeroState: r }) => {
1269
- const { availableHeight: n = 0 } = de(), s = l.useRef(null);
1270
- return l.useEffect(() => {
1271
- n > 0 && s.current === null && (s.current = n);
1272
- }, [n]), /* @__PURE__ */ m(x, {
1273
- sx: {
1274
- height: "100%",
1275
- justifyContent: "space-between"
1276
- },
1277
- children: [/* @__PURE__ */ e(We, {
1278
- createBudgetOnClick: i,
1279
- height: l.useMemo(() => {
1280
- const a = s.current ?? n;
1281
- return a > 0 ? Math.round(Math.max(120, Math.min(450, a * 0.8))) - 40 : 450;
1282
- }, [n]),
1283
- isMiniWidget: !0,
1284
- shouldShowZeroState: r
1285
- }), !r && /* @__PURE__ */ m(Q, {
1286
- ml: 16,
1287
- children: [/* @__PURE__ */ e(v, {
1288
- bold: !0,
1289
- color: o < 0 ? "error.main" : "success.main",
1290
- children: D(Math.abs(o), "0,0")
1291
- }), /* @__PURE__ */ e(v, { children: o < 0 ? t.overspent_in_budgets : t.left_in_budgets })]
1292
- })]
1293
- });
1076
+ hasDivider: !0,
1077
+ onAccountsFilterClick: fe,
1078
+ onBackClick: t,
1079
+ onMenuClick: n,
1080
+ sx: c,
1081
+ title: o.budgets_title,
1082
+ children: [
1083
+ /* @__PURE__ */ m(
1084
+ x,
1085
+ {
1086
+ direction: k ? "column" : "row",
1087
+ height: "100%",
1088
+ sx: { justifyContent: "center" },
1089
+ width: "100%",
1090
+ children: [
1091
+ /* @__PURE__ */ e(x, { height: k ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
1092
+ We,
1093
+ {
1094
+ createBudgetOnClick: ae,
1095
+ height: k ? 450 : 800,
1096
+ isDraggable: !0,
1097
+ shouldShowZeroState: b.length === 0,
1098
+ unavailableWidth: k ? 0 : Re
1099
+ }
1100
+ ) }),
1101
+ b.length !== 0 && /* @__PURE__ */ m(
1102
+ x,
1103
+ {
1104
+ gap: 24,
1105
+ height: "100%",
1106
+ sx: { mr: 24, mt: 48 },
1107
+ width: k ? "100%" : Re,
1108
+ children: [
1109
+ /* @__PURE__ */ e(jt, {}),
1110
+ /* @__PURE__ */ e(Pt, {})
1111
+ ]
1112
+ }
1113
+ )
1114
+ ]
1115
+ }
1116
+ ),
1117
+ /* @__PURE__ */ e($t, {}),
1118
+ /* @__PURE__ */ e(
1119
+ $,
1120
+ {
1121
+ ariaLabelClose: r.close_aria,
1122
+ isOpen: G,
1123
+ onClose: () => F(!1),
1124
+ title: o.add_new_title,
1125
+ children: /* @__PURE__ */ e(
1126
+ ze,
1127
+ {
1128
+ onAddBudget: ye,
1129
+ onRecalculateBudgets: j
1130
+ }
1131
+ )
1132
+ }
1133
+ ),
1134
+ /* @__PURE__ */ e(
1135
+ xe,
1136
+ {
1137
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
1138
+ autoHideDuration: 3500,
1139
+ onClose: () => {
1140
+ A("");
1141
+ },
1142
+ open: !!S,
1143
+ children: /* @__PURE__ */ e(
1144
+ Ae,
1145
+ {
1146
+ closeText: "",
1147
+ onClose: () => {
1148
+ A("");
1149
+ },
1150
+ severity: "success",
1151
+ variant: "filled",
1152
+ children: S
1153
+ }
1154
+ )
1155
+ }
1156
+ )
1157
+ ]
1158
+ }
1159
+ );
1160
+ }
1161
+ ), zt = ({
1162
+ budgetsCopy: t,
1163
+ difference: n,
1164
+ handleAddClick: c,
1165
+ shouldShowZeroState: i
1166
+ }) => {
1167
+ const { availableHeight: a = 0 } = de(), s = l.useRef(null);
1168
+ l.useEffect(() => {
1169
+ a > 0 && s.current === null && (s.current = a);
1170
+ }, [a]);
1171
+ const o = l.useMemo(() => {
1172
+ const r = s.current ?? a;
1173
+ return r > 0 ? Math.round(Math.max(120, Math.min(450, r * 0.8))) - 40 : 450;
1174
+ }, [a]);
1175
+ return /* @__PURE__ */ m(x, { sx: { height: "100%", justifyContent: "space-between" }, children: [
1176
+ /* @__PURE__ */ e(
1177
+ We,
1178
+ {
1179
+ createBudgetOnClick: c,
1180
+ height: o,
1181
+ isMiniWidget: !0,
1182
+ shouldShowZeroState: i
1183
+ }
1184
+ ),
1185
+ !i && /* @__PURE__ */ m(X, { ml: 16, children: [
1186
+ /* @__PURE__ */ e(C, { bold: !0, color: n < 0 ? "error.main" : "success.main", children: D(Math.abs(n), "0,0") }),
1187
+ /* @__PURE__ */ e(C, { children: n < 0 ? t.overspent_in_budgets : t.left_in_budgets })
1188
+ ] })
1189
+ ] });
1294
1190
  }, Ft = (t) => {
1295
- const o = V(), { onEvent: i } = Z(), { detailedBudgets: r, isDataLoaded: n, loadBudgetData: s, setTheme: a } = E(), { budgets: c, common: g } = w(), { isInitialized: d, selectedAccounts: u } = q(), { loadDateRangeCategoryTotals: C, loadMonthlyCategoryTotals: p } = J(), b = Ve(r), [f, _] = l.useState(!1);
1191
+ const n = H(), { onEvent: c } = J(), { detailedBudgets: i, isDataLoaded: a, loadBudgetData: s, setTheme: o } = w(), { budgets: r, common: p } = E(), { isInitialized: d, selectedAccounts: u } = Q(), { loadDateRangeCategoryTotals: S, loadMonthlyCategoryTotals: g } = q(), h = lt(i), [_, y] = l.useState(!1);
1296
1192
  l.useEffect(() => {
1297
- n || s().finally();
1193
+ a || s().finally();
1298
1194
  }, []), l.useEffect(() => {
1299
- a(o);
1300
- }, [o]), l.useEffect(() => {
1301
- d && !n && (C(u, ie(/* @__PURE__ */ new Date()), Be(/* @__PURE__ */ new Date())).finally(), p(u).finally());
1302
- }, [
1303
- d,
1304
- u,
1305
- n
1306
- ]);
1307
- const S = () => {
1308
- _(!0), i(P.BUDGETS_CLICK_ADD);
1309
- }, A = () => {
1310
- _(!1);
1311
- }, h = () => _(!1);
1312
- if (Ne({
1195
+ o(n);
1196
+ }, [n]), l.useEffect(() => {
1197
+ d && !a && (S(
1198
+ u,
1199
+ ie(/* @__PURE__ */ new Date()),
1200
+ Be(/* @__PURE__ */ new Date())
1201
+ ).finally(), g(u).finally());
1202
+ }, [d, u, a]);
1203
+ const A = () => {
1204
+ y(!0), c(P.BUDGETS_CLICK_ADD);
1205
+ }, v = () => {
1206
+ y(!1);
1207
+ }, b = () => y(!1);
1208
+ if (je({
1313
1209
  widgetName: "BubbleBudgetsMiniWidget",
1314
- isLoaded: n
1315
- }), !d || !n) return /* @__PURE__ */ e(ue, {});
1316
- const B = r.length === 0;
1317
- return /* @__PURE__ */ m(at, {
1318
- contentStyles: {
1319
- height: "calc(100% - 66px)",
1320
- ":last-child": { pb: 0 }
1321
- },
1322
- primaryCtaLabel: B ? c.get_started_cta : c.details_cta,
1323
- primaryCtaLabelAria: c.details_cta_aria,
1324
- sx: { height: "100%" },
1325
- title: c.budgets_title,
1326
- ...t,
1327
- children: [/* @__PURE__ */ e(zt, {
1328
- budgetsCopy: c,
1329
- difference: b,
1330
- handleAddClick: S,
1331
- shouldShowZeroState: B
1332
- }), /* @__PURE__ */ e($, {
1333
- ariaLabelClose: g.close_aria,
1334
- isOpen: f,
1335
- onClose: () => _(!1),
1336
- title: c.add_new_title,
1337
- children: /* @__PURE__ */ e(ze, {
1338
- onAddBudget: A,
1339
- onRecalculateBudgets: h
1340
- })
1341
- })]
1342
- });
1343
- }, En = I(Ft), se = {
1210
+ isLoaded: a
1211
+ }), !d || !a) return /* @__PURE__ */ e(pe, {});
1212
+ const B = i.length === 0;
1213
+ return /* @__PURE__ */ m(
1214
+ ut,
1215
+ {
1216
+ contentStyles: { height: "calc(100% - 66px)", ":last-child": { pb: 0 } },
1217
+ primaryCtaLabel: B ? r.get_started_cta : r.details_cta,
1218
+ primaryCtaLabelAria: r.details_cta_aria,
1219
+ sx: { height: "100%" },
1220
+ title: r.budgets_title,
1221
+ ...t,
1222
+ children: [
1223
+ /* @__PURE__ */ e(
1224
+ zt,
1225
+ {
1226
+ budgetsCopy: r,
1227
+ difference: h,
1228
+ handleAddClick: A,
1229
+ shouldShowZeroState: B
1230
+ }
1231
+ ),
1232
+ /* @__PURE__ */ e(
1233
+ $,
1234
+ {
1235
+ ariaLabelClose: p.close_aria,
1236
+ isOpen: _,
1237
+ onClose: () => y(!1),
1238
+ title: r.add_new_title,
1239
+ children: /* @__PURE__ */ e(
1240
+ ze,
1241
+ {
1242
+ onAddBudget: v,
1243
+ onRecalculateBudgets: b
1244
+ }
1245
+ )
1246
+ }
1247
+ )
1248
+ ]
1249
+ }
1250
+ );
1251
+ }, Wo = I(Ft), se = {
1344
1252
  CANCEL_DELETE: "Cancel - Delete",
1345
1253
  END_SAVE: "End - Save",
1346
1254
  END_DELETE: "End - Delete",
1347
1255
  START_DELETE: "Start - Delete"
1348
- }, Ut = ({ onClose: t, onEvent: o, onViewHistory: i, transactionListProps: r }) => {
1349
- const { alert: n, dateRange: s, deleteBudget: a, selectedBudget: c, selectedSubBudget: g, setAlert: d, setSelectedBudget: u, updateBudget: C } = E(), { budgets: p, common: b } = w(), { isCopyLoaded: f, selectedAccountGuids: _ } = q(), S = V(), { setFilter: A } = X(), [h, B] = l.useState(""), [y, T] = l.useState(null), [M, L] = l.useState(!1), N = l.useRef(!1);
1256
+ }, Ut = ({
1257
+ onClose: t,
1258
+ onEvent: n,
1259
+ onViewHistory: c,
1260
+ transactionListProps: i
1261
+ }) => {
1262
+ const {
1263
+ alert: a,
1264
+ dateRange: s,
1265
+ deleteBudget: o,
1266
+ selectedBudget: r,
1267
+ selectedSubBudget: p,
1268
+ setAlert: d,
1269
+ setSelectedBudget: u,
1270
+ updateBudget: S
1271
+ } = w(), { budgets: g, common: h } = E(), { isCopyLoaded: _, selectedAccountGuids: y } = Q(), A = H(), { setFilter: v } = ee(), [b, B] = l.useState(""), [f, T] = l.useState(null), [L, M] = l.useState(!1), N = l.useRef(!1);
1350
1272
  if (l.useEffect(() => {
1351
- !c || g || (B(`${c.amount}`), A({
1352
- accounts: _,
1273
+ !r || p || (B(`${r.amount}`), v({
1274
+ accounts: y,
1353
1275
  dateRange: s,
1354
1276
  custom: ({ category_guid: j, top_level_category_guid: K }) => {
1355
- const { category_guid: Y } = c;
1277
+ const { category_guid: Y } = r;
1356
1278
  return j === Y || K === Y;
1357
1279
  }
1358
- }), L(!0));
1359
- }, [c]), !f) return /* @__PURE__ */ e(ue, {});
1360
- if (!c) return null;
1280
+ }), M(!0));
1281
+ }, [r]), !_) return /* @__PURE__ */ e(pe, {});
1282
+ if (!r) return null;
1361
1283
  const k = () => {
1362
- B(""), T(null), L(!1), setTimeout(() => {
1284
+ B(""), T(null), M(!1), setTimeout(() => {
1363
1285
  u(void 0), t?.();
1364
1286
  }, 250);
1365
1287
  }, G = () => {
1366
- y === "delete" && o?.(se.CANCEL_DELETE, h), B(c.amount ? `${c.amount}` : ""), T(null);
1288
+ f === "delete" && n?.(se.CANCEL_DELETE, b), B(r.amount ? `${r.amount}` : ""), T(null);
1367
1289
  }, F = async () => {
1368
- if (y === "edit") {
1290
+ if (f === "edit") {
1369
1291
  if (N.current) return;
1370
- N.current = !0, await C({
1371
- ...c,
1372
- amount: Number(h)
1373
- }), o?.(se.END_SAVE, h), d(R(p.alert_budget_updated, c.category.name)), T(null), N.current = !1;
1292
+ N.current = !0, await S({
1293
+ ...r,
1294
+ amount: Number(b)
1295
+ }), n?.(se.END_SAVE, b), d(
1296
+ R(g.alert_budget_updated, r.category.name)
1297
+ ), T(null), N.current = !1;
1374
1298
  }
1375
- y === "delete" && (await a(c.guid), o?.(se.END_DELETE, h), k());
1376
- }, { remainingAmount: ye, spentPercentage: _e, iconColor: oe } = Ke(c.transaction_total ?? 0, c.amount ?? 0), be = (j, K) => R(j, /* @__PURE__ */ e("b", { children: K }));
1377
- return /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ m($, {
1378
- ariaLabelClose: b.close_aria,
1379
- footerStyles: {
1380
- px: 24,
1381
- py: 16
1382
- },
1383
- isOpen: M,
1384
- onClose: k,
1385
- onPrimaryAction: () => T("edit"),
1386
- onSecondaryAction: () => {
1387
- o?.(se.START_DELETE, h), T("delete");
1388
- },
1389
- primaryText: p.details_edit_button,
1390
- secondaryColor: "error",
1391
- secondaryText: p.details_delete_button,
1392
- sx: { "& .list-wrapper": { pr: 24 } },
1393
- title: R(p.details_type_title, c.category.name),
1394
- children: [
1395
- /* @__PURE__ */ e(nt, {
1396
- amount: c.amount,
1397
- icon: /* @__PURE__ */ e(H, {
1398
- categoryGuid: c.category.guid,
1399
- size: 44,
1400
- sx: {
1401
- bgcolor: st(Ee(c.category.guid, S), 0.15),
1402
- border: `1px solid ${Ee(c.category.guid, S)}`,
1403
- color: "text.primary"
1299
+ f === "delete" && (await o(r.guid), n?.(se.END_DELETE, b), k());
1300
+ }, { remainingAmount: be, spentPercentage: fe, iconColor: ae } = dt(
1301
+ r.transaction_total ?? 0,
1302
+ r.amount ?? 0
1303
+ ), ye = (j, K) => R(j, /* @__PURE__ */ e("b", { children: K }));
1304
+ return /* @__PURE__ */ m(l.Fragment, { children: [
1305
+ /* @__PURE__ */ m(
1306
+ $,
1307
+ {
1308
+ ariaLabelClose: h.close_aria,
1309
+ footerStyles: {
1310
+ px: 24,
1311
+ py: 16
1312
+ },
1313
+ isOpen: L,
1314
+ onClose: k,
1315
+ onPrimaryAction: () => T(
1316
+ "edit"
1317
+ /* EDIT */
1318
+ ),
1319
+ onSecondaryAction: () => {
1320
+ n?.(se.START_DELETE, b), T(
1321
+ "delete"
1322
+ /* DELETE */
1323
+ );
1324
+ },
1325
+ primaryText: g.details_edit_button,
1326
+ secondaryColor: "error",
1327
+ secondaryText: g.details_delete_button,
1328
+ sx: {
1329
+ "& .list-wrapper": {
1330
+ pr: 24
1404
1331
  }
1405
- }),
1406
- iconColor: oe,
1407
- onViewHistory: i,
1408
- remainingAmount: ye,
1409
- spentPercentage: _e,
1410
- startDate: (s.start.getTime() ?? 0) / 1e3,
1411
- totalTransaction: c.transaction_total
1412
- }),
1413
- /* @__PURE__ */ e(Se, { ...r }),
1414
- n && /* @__PURE__ */ e(De, {
1415
- anchorOrigin: {
1416
- horizontal: "right",
1417
- vertical: "bottom"
1418
1332
  },
1419
- autoHideDuration: 3500,
1420
- onClose: () => d(""),
1421
- open: !!n,
1422
- children: /* @__PURE__ */ e(Te, {
1423
- closeText: "",
1424
- onClose: () => d(""),
1425
- severity: "success",
1426
- variant: "filled",
1427
- children: n
1428
- })
1429
- })
1430
- ]
1431
- }), y && /* @__PURE__ */ e(qe, {
1432
- closeAriaLabel: b.close_aria,
1433
- content: be(p[y === "edit" ? "edit_budget_content" : "delete_description"], c.category.name),
1434
- handleInputChange: (j) => B(j.toString()),
1435
- handleModalClose: G,
1436
- handlePrimaryAction: F,
1437
- handleSecondaryAction: G,
1438
- inputLabel: y === "edit" ? p.details_edit_title : "",
1439
- inputValue: h,
1440
- isOpen: !0,
1441
- primaryColor: y === "edit" ? "primary" : "error",
1442
- primaryText: p[y === "edit" ? "add_save_button" : "details_delete_button"],
1443
- secondaryColor: y === "edit" ? "primary" : "inherit",
1444
- secondaryText: b.cancel_button,
1445
- title: p[y === "edit" ? "details_edit_title" : "delete_title"]
1446
- })] });
1447
- }, wn = I(Ut);
1333
+ title: R(g.details_type_title, r.category.name),
1334
+ children: [
1335
+ /* @__PURE__ */ e(
1336
+ ot,
1337
+ {
1338
+ amount: r.amount,
1339
+ icon: /* @__PURE__ */ e(
1340
+ V,
1341
+ {
1342
+ categoryGuid: r.category.guid,
1343
+ size: 44,
1344
+ sx: {
1345
+ bgcolor: Ye(we(r.category.guid, A), 0.15),
1346
+ border: `1px solid ${we(r.category.guid, A)}`,
1347
+ color: "text.primary"
1348
+ }
1349
+ }
1350
+ ),
1351
+ iconColor: ae,
1352
+ onViewHistory: c,
1353
+ remainingAmount: be,
1354
+ spentPercentage: fe,
1355
+ startDate: (s.start.getTime() ?? 0) / 1e3,
1356
+ totalTransaction: r.transaction_total
1357
+ }
1358
+ ),
1359
+ /* @__PURE__ */ e(ve, { ...i }),
1360
+ a && /* @__PURE__ */ e(
1361
+ xe,
1362
+ {
1363
+ anchorOrigin: { horizontal: "right", vertical: "bottom" },
1364
+ autoHideDuration: 3500,
1365
+ onClose: () => d(""),
1366
+ open: !!a,
1367
+ children: /* @__PURE__ */ e(Ae, { closeText: "", onClose: () => d(""), severity: "success", variant: "filled", children: a })
1368
+ }
1369
+ )
1370
+ ]
1371
+ }
1372
+ ),
1373
+ f && /* @__PURE__ */ e(
1374
+ mt,
1375
+ {
1376
+ closeAriaLabel: h.close_aria,
1377
+ content: ye(
1378
+ g[f === "edit" ? "edit_budget_content" : "delete_description"],
1379
+ r.category.name
1380
+ ),
1381
+ handleInputChange: (j) => B(j.toString()),
1382
+ handleModalClose: G,
1383
+ handlePrimaryAction: F,
1384
+ handleSecondaryAction: G,
1385
+ inputLabel: f === "edit" ? g.details_edit_title : "",
1386
+ inputValue: b,
1387
+ isOpen: !0,
1388
+ primaryColor: f === "edit" ? "primary" : "error",
1389
+ primaryText: g[f === "edit" ? "add_save_button" : "details_delete_button"],
1390
+ secondaryColor: f === "edit" ? "primary" : "inherit",
1391
+ secondaryText: h.cancel_button,
1392
+ title: g[f === "edit" ? "details_edit_title" : "delete_title"]
1393
+ }
1394
+ )
1395
+ ] });
1396
+ }, Ho = I(Ut);
1448
1397
  export {
1449
- En as BubbleBudgetsMiniWidget,
1450
- Dn as BubbleBudgetsWidget,
1451
- wn as BudgetDetailsDrawerV2
1398
+ Wo as BubbleBudgetsMiniWidget,
1399
+ Uo as BubbleBudgetsWidget,
1400
+ Ho as BudgetDetailsDrawerV2
1452
1401
  };
1402
+ //# sourceMappingURL=index.es.js.map