@mx-cartographer/experiences 8.0.0-alpha.sms2 → 9.0.0-alpha.mega1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +217 -0
  2. package/dist/{Account-Cp30A3ad.mjs → Account-BIKn4XEZ.mjs} +1 -1
  3. package/dist/Account-CMjOp7S2.mjs +118 -0
  4. package/dist/AccountApi-DgZ8ILj1.mjs +19 -0
  5. package/dist/AccountDetailsHeader-BOV91g1o.mjs +95 -0
  6. package/dist/AccountDisplayName-CO7z3v99.mjs +11 -0
  7. package/dist/{AccountFields-CW6cIthP.mjs → AccountFields-BRRH37K1.mjs} +10 -11
  8. package/dist/{AccountListItem-DxmAs98Z.mjs → AccountListItem-Ds5C0mOT.mjs} +4 -4
  9. package/dist/{AccountStore-hIs-yA6W.mjs → AccountStore-BFKvXJSD.mjs} +79 -69
  10. package/dist/{Accounts-DUHkUyK4.mjs → Accounts-CuE8aSZN.mjs} +1 -1
  11. package/dist/{BudgetUtil-CIDAPPPT.mjs → BudgetUtil-CDSOZXem.mjs} +4 -4
  12. package/dist/CategorySelectorDrawer-C4aZYP4N.mjs +418 -0
  13. package/dist/CategoryStore-DEqAnHbi.mjs +186 -0
  14. package/dist/{CategoryUtil-DfVKKkRf.mjs → CategoryUtil-CFHBvaV4.mjs} +1 -1
  15. package/dist/{ConnectionsDrawer-CSo6AFkG.mjs → ConnectionsDrawer-BExzgE16.mjs} +5 -5
  16. package/dist/{CurrencyInput-BrGvhgVK.mjs → CurrencyInput-DDQ4DBrE.mjs} +1 -1
  17. package/dist/{CurrencyText-Dr0EZ7bp.mjs → CurrencyText-C-85TnUF.mjs} +3 -3
  18. package/dist/{DateUtil-CDPZw_-m.mjs → DateUtil-CVsMhbZU.mjs} +3 -3
  19. package/dist/{DebtsStore-hi1cqrRk.mjs → DebtsStore-Dv_T7Dts.mjs} +12 -12
  20. package/dist/{Dialog-CDV0kKxj.mjs → Dialog-CWymUiuO.mjs} +32 -35
  21. package/dist/Drawer-Bet2ZPJo.mjs +176 -0
  22. package/dist/{ExportCsvAction-CQ1grpwo.mjs → ExportCsvAction-oG_Mn66T.mjs} +3 -3
  23. package/dist/{FinstrongStore-dKZOZ2hM.mjs → FinstrongStore-BjFkMTIL.mjs} +6 -6
  24. package/dist/GlobalAccountFilter-BpWlPAl5.mjs +316 -0
  25. package/dist/{GoalStore-CFeAJloA.mjs → GoalStore-Dbjgft2i.mjs} +155 -137
  26. package/dist/{Help-i4OasOO-.mjs → Help-BW_ar-4B.mjs} +2 -2
  27. package/dist/LineChart-DHj-Bufi.mjs +580 -0
  28. package/dist/{ListItemAction-BNCWQAN_.mjs → ListItemAction-Cbr3417C.mjs} +10 -10
  29. package/dist/{ManageIncome-D_qVX5dN.mjs → ManageIncome-DIIyqDTp.mjs} +85 -85
  30. package/dist/{MicroWidgetContainer-BGpNl5ZS.mjs → MicroWidgetContainer-DSyYwRCU.mjs} +2 -2
  31. package/dist/{MiniWidgetContainer-D7MkHG15.mjs → MiniWidgetContainer-DKn7ndO6.mjs} +1 -1
  32. package/dist/NetWorthStore-B6ziBtaH.mjs +168 -0
  33. package/dist/NotificationSettings-e789PcRb.mjs +676 -0
  34. package/dist/{OriginalBalanceAction-62e0mU_3.mjs → OriginalBalanceAction-DFoG79Ba.mjs} +3 -3
  35. package/dist/{RecurringSettings-RfZ8Wuhh.mjs → RecurringSettings-BpCUcE8w.mjs} +4 -4
  36. package/dist/{RecurringTransactionsStore-D3EOKZ2B.mjs → RecurringTransactionsStore-D_--5PWH.mjs} +1 -1
  37. package/dist/{RecurringTransactions-Bhx56aA3.mjs → RepeatingTransaction-C2txVA9O.mjs} +3 -3
  38. package/dist/{SettingsStore-BASMQSIp.mjs → SettingsStore-CInvh-rQ.mjs} +1 -1
  39. package/dist/SpendingData-B7NuTQ9s.mjs +53 -0
  40. package/dist/SpendingLegend-BxefXiQd.mjs +193 -0
  41. package/dist/TransactionDetails-CPwv9xtZ.mjs +1374 -0
  42. package/dist/{TransactionStore-DgLrYW4C.mjs → TransactionStore-D2aMUClq.mjs} +128 -111
  43. package/dist/TrendsStore-BdsYfCc7.mjs +183 -0
  44. package/dist/{User-DqNX2GAK.mjs → User-CulNdZUr.mjs} +21 -20
  45. package/dist/ViewMoreMicroCard-CDWR16_h.mjs +1147 -0
  46. package/dist/WidgetContainer-mzejMmz2.mjs +555 -0
  47. package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsChart.d.ts +1 -0
  48. package/dist/accounts/index.es.js +933 -232
  49. package/dist/accounts/stores/AccountStore.d.ts +6 -2
  50. package/dist/accounts/utils/AccountDetails.d.ts +5 -0
  51. package/dist/analytics/index.es.js +2 -2
  52. package/dist/budgets/components/AddBudgets.d.ts +2 -1
  53. package/dist/budgets/index.es.js +561 -522
  54. package/dist/cashflow/index.es.js +397 -396
  55. package/dist/categories/components/CustomCategories/AddSubcategory.d.ts +1 -0
  56. package/dist/categories/components/CustomCategories/DeleteSubcategory.d.ts +1 -0
  57. package/dist/categories/components/CustomCategories/RenameSubcategory.d.ts +1 -0
  58. package/dist/categories/components/SubcategoryRow.d.ts +1 -0
  59. package/dist/categories/index.es.js +2 -2
  60. package/dist/categories/stores/CategoryStore.d.ts +5 -3
  61. package/dist/common/components/GlobalAccountFilter.d.ts +11 -0
  62. package/dist/common/components/WidgetContainer.d.ts +7 -6
  63. package/dist/common/components/charts/linechart/CustomTooltip.d.ts +6 -1
  64. package/dist/common/components/charts/stackedlinechart/CustomPointTooltip.d.ts +5 -2
  65. package/dist/common/components/globalaccountfilter/GlobalAccountFilterList.d.ts +7 -0
  66. package/dist/common/components/index.d.ts +2 -2
  67. package/dist/common/hooks/index.d.ts +1 -0
  68. package/dist/common/hooks/useWidgetLoadTimer.d.ts +6 -0
  69. package/dist/common/index.es.js +325 -306
  70. package/dist/common/stores/GlobalUiStore.d.ts +7 -4
  71. package/dist/common/types/localization/AccountsCopy.d.ts +6 -0
  72. package/dist/common/types/localization/CategoryCopy.d.ts +3 -0
  73. package/dist/common/types/localization/CommonCopy.d.ts +3 -0
  74. package/dist/common/types/localization/GoalsCopy.d.ts +3 -1
  75. package/dist/common/types/localization/MicroInsightsCopy.d.ts +1 -0
  76. package/dist/common/types/localization/TransactionsCopy.d.ts +4 -0
  77. package/dist/common/types/localization/TrendsCopy.d.ts +4 -0
  78. package/dist/dashboard/index.es.js +95 -125
  79. package/dist/debts/index.es.js +466 -460
  80. package/dist/{exportTransactionsToCSV-BFpuIAXW.mjs → exportTransactionsToCSV-BU1jTY0Q.mjs} +4 -4
  81. package/dist/finstrong/components/shared/CustomDoubleBarPlot.d.ts +4 -5
  82. package/dist/finstrong/index.es.js +1660 -1553
  83. package/dist/goals/index.es.js +716 -677
  84. package/dist/goals/stores/GoalStore.d.ts +2 -0
  85. package/dist/help/index.es.js +14 -10
  86. package/dist/{hooks-C41HAxM5.mjs → hooks-fY_n74f7.mjs} +16 -16
  87. package/dist/investments/index.es.js +464 -457
  88. package/dist/merchants/index.es.js +1 -1
  89. package/dist/microinsights/MicroCardTemplate.d.ts +23 -0
  90. package/dist/microinsights/beaticons/BeatMaterialIcon.d.ts +8 -0
  91. package/dist/microinsights/beaticons/MonthlySpendComparisonIcon.d.ts +1 -2
  92. package/dist/microinsights/beaticons/index.d.ts +1 -0
  93. package/dist/microinsights/cards/InsightCard.d.ts +0 -2
  94. package/dist/microinsights/cards/ViewMoreMicroCard.d.ts +2 -5
  95. package/dist/microinsights/index.d.ts +2 -2
  96. package/dist/microinsights/index.es.js +824 -14
  97. package/dist/networth/components/NetWorthChart.d.ts +3 -2
  98. package/dist/networth/components/NetWorthList.d.ts +3 -3
  99. package/dist/networth/index.es.js +433 -438
  100. package/dist/networth/stores/NetWorthStore.d.ts +20 -9
  101. package/dist/networth/utils/NetWorthUtils.d.ts +2 -2
  102. package/dist/notifications/index.es.js +5 -5
  103. package/dist/recurringtransactions/index.es.js +331 -325
  104. package/dist/settings/index.es.js +293 -285
  105. package/dist/spending/components/SpendingChart.d.ts +1 -1
  106. package/dist/spending/components/SpendingList.d.ts +1 -1
  107. package/dist/spending/components/SpendingTabLabel.d.ts +1 -0
  108. package/dist/spending/index.es.js +250 -235
  109. package/dist/transactions/index.es.js +288 -281
  110. package/dist/transactions/stores/TransactionStore.d.ts +5 -0
  111. package/dist/trends/components/TrendsTable.d.ts +0 -2
  112. package/dist/trends/index.es.js +876 -802
  113. package/dist/trends/utils/TrendsData.d.ts +1 -0
  114. package/dist/trends/utils/TrendsTable.d.ts +12 -0
  115. package/dist/{useAccountDisplayName-usSZCQ7I.mjs → useAccountDisplayName-DbkgGLdg.mjs} +2 -2
  116. package/dist/useAriaLive-B3_pRUio.mjs +35 -0
  117. package/dist/{useInsightsEnabled-CNjP5cfR.mjs → useInsightsEnabled-dhmXeSyF.mjs} +1 -1
  118. package/dist/useWidgetLoadTimer-CrUzxN-P.mjs +19 -0
  119. package/package.json +26 -21
  120. package/dist/AccountDetailsContent-C1HumFnW.mjs +0 -683
  121. package/dist/AccountDetailsHeader-NMx79DGs.mjs +0 -87
  122. package/dist/CategorySelectorDrawer-DqDAA_5I.mjs +0 -399
  123. package/dist/CategoryStore-MUwRWH9e.mjs +0 -176
  124. package/dist/ConnectDrawer-Dn1MlqLz.mjs +0 -545
  125. package/dist/Drawer-Dqe5EqvA.mjs +0 -163
  126. package/dist/LineChart-bc1D9xBE.mjs +0 -581
  127. package/dist/NetWorthStore-8FFC1Bs0.mjs +0 -150
  128. package/dist/NotificationSettings-BsWiYD94.mjs +0 -672
  129. package/dist/SpendingData-DPQ96k3x.mjs +0 -55
  130. package/dist/SpendingLegend-CZzDb-7d.mjs +0 -193
  131. package/dist/TransactionDetails-Duv1X9ec.mjs +0 -1379
  132. package/dist/TrendsStore-_mRaFUdf.mjs +0 -182
  133. package/dist/ViewMoreMicroCard-CH9E-jOx.mjs +0 -1930
  134. package/dist/WidgetContainer-B1Jzb4XA.mjs +0 -565
  135. package/dist/common/components/accountfilter/AccountFilter.d.ts +0 -20
  136. package/dist/common/components/accountfilter/AccountFilterOptions.d.ts +0 -31
  137. package/dist/common/components/accountfilter/index.d.ts +0 -1
  138. package/dist/microinsights/cards/BaseCard.d.ts +0 -13
  139. package/dist/{ToggleListItem-ciFTiqRS.mjs → Notification-Bs1fdbzI.mjs} +1 -1
@@ -7,10 +7,10 @@ import R from "@mui/material/Tabs";
7
7
  import d from "@mui/material/Divider";
8
8
  import b from "@mui/material/List";
9
9
  import T from "@mui/material/Stack";
10
- import { R as C, A as S, a as E, M as v } from "./ManageIncome-D_qVX5dN.mjs";
11
- import { u as _, j as A, g as f } from "./hooks-C41HAxM5.mjs";
12
- import { R as y, F as N } from "./RecurringTransactions-Bhx56aA3.mjs";
13
- import { A as m } from "./WidgetContainer-B1Jzb4XA.mjs";
10
+ import { R as C, A as S, a as E, M as v } from "./ManageIncome-DIIyqDTp.mjs";
11
+ import { u as _, j as A, g as f } from "./hooks-fY_n74f7.mjs";
12
+ import { R as y, F as N } from "./RepeatingTransaction-C2txVA9O.mjs";
13
+ import { A as m } from "./WidgetContainer-mzejMmz2.mjs";
14
14
  const I = h(() => {
15
15
  const { recurring: g } = _(), { detailedRepeatingTransactions: n } = A(), { onEvent: a } = f(), l = (r) => {
16
16
  a(m.RECURRING_TRANSACTIONS_CLICK_EXPENSE, {
@@ -8,7 +8,7 @@ import { startOfMonth as y } from "date-fns/startOfMonth";
8
8
  import { startOfToday as i } from "date-fns/startOfToday";
9
9
  import { subDays as I } from "date-fns/subDays";
10
10
  import { F as x, A as o } from "./Fetch-DecPFeGU.mjs";
11
- import { a as u, b as A, c as r, d } from "./RecurringTransactions-Bhx56aA3.mjs";
11
+ import { a as u, b as A, c as r, d } from "./RepeatingTransaction-C2txVA9O.mjs";
12
12
  var E = /* @__PURE__ */ ((a) => (a.Small = "small", a.Medium = "medium", a.Large = "large", a))(E || {});
13
13
  const G = 44;
14
14
  class h {
@@ -29,11 +29,10 @@ import { subQuarters as N } from "date-fns/subQuarters";
29
29
  import { subYears as T } from "date-fns/subYears";
30
30
  import { lastDayOfMonth as q } from "date-fns/lastDayOfMonth";
31
31
  import { setDayOfYear as F } from "date-fns/setDayOfYear";
32
- import { g as R, a as ee, b as te, c as re, d as oe, e as ae, f as ne } from "./DateUtil-CDPZw_-m.mjs";
32
+ import { g as R, a as ee, b as te, c as re, d as oe, e as ae, f as ne } from "./DateUtil-CVsMhbZU.mjs";
33
33
  import { b as W } from "./NumberFormatting-DjTD0t3W.mjs";
34
- import { f as v, a as k } from "./Dialog-CDV0kKxj.mjs";
34
+ import { f as v, D as k } from "./Dialog-CWymUiuO.mjs";
35
35
  import { b as l } from "./Localization-2MODESHW.mjs";
36
- var s = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.EveryWeek = 1] = "EveryWeek", e[e.EveryOtherWeek = 2] = "EveryOtherWeek", e[e.EveryMonth = 3] = "EveryMonth", e[e.EveryOtherMonth = 4] = "EveryOtherMonth", e[e.EveryQuarter = 5] = "EveryQuarter", e[e.EveryOtherQuarter = 6] = "EveryOtherQuarter", e[e.EveryYear = 7] = "EveryYear", e[e.TwiceAMonth = 8] = "TwiceAMonth", e))(s || {}), p = /* @__PURE__ */ ((e) => (e[e.Paid = 0] = "Paid", e[e.Missed = 1] = "Missed", e[e.Upcoming = 2] = "Upcoming", e))(p || {}), O = /* @__PURE__ */ ((e) => (e[e.Expense = 0] = "Expense", e[e.Income = 1] = "Income", e))(O || {}), Y = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Subscription = 1] = "Subscription", e[e.Bill = 2] = "Bill", e[e.Income = 3] = "Income", e[e.Transfer = 4] = "Transfer", e))(Y || {});
37
36
  const qe = ({ iconName: e, label: a, onClick: t, value: n }) => {
38
37
  const o = /* @__PURE__ */ M(B, { children: [
39
38
  /* @__PURE__ */ d(L, { children: /* @__PURE__ */ d(P, { sx: { bgcolor: "border.light" }, variant: "rounded", children: /* @__PURE__ */ d(I, { name: e, sx: { color: "text.primary" }, weight: S.Dark }) }) }),
@@ -277,6 +276,7 @@ const qe = ({ iconName: e, label: a, onClick: t, value: n }) => {
277
276
  }
278
277
  return t;
279
278
  };
279
+ var s = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.EveryWeek = 1] = "EveryWeek", e[e.EveryOtherWeek = 2] = "EveryOtherWeek", e[e.EveryMonth = 3] = "EveryMonth", e[e.EveryOtherMonth = 4] = "EveryOtherMonth", e[e.EveryQuarter = 5] = "EveryQuarter", e[e.EveryOtherQuarter = 6] = "EveryOtherQuarter", e[e.EveryYear = 7] = "EveryYear", e[e.TwiceAMonth = 8] = "TwiceAMonth", e))(s || {}), p = /* @__PURE__ */ ((e) => (e[e.Paid = 0] = "Paid", e[e.Missed = 1] = "Missed", e[e.Upcoming = 2] = "Upcoming", e))(p || {}), O = /* @__PURE__ */ ((e) => (e[e.Expense = 0] = "Expense", e[e.Income = 1] = "Income", e))(O || {}), Y = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Subscription = 1] = "Subscription", e[e.Bill = 2] = "Bill", e[e.Income = 3] = "Income", e[e.Transfer = 4] = "Transfer", e))(Y || {});
280
280
  export {
281
281
  qe as D,
282
282
  s as F,
@@ -1,6 +1,6 @@
1
1
  import { makeAutoObservable as N, runInAction as l } from "mobx";
2
2
  import { F as D, A as r } from "./Fetch-DecPFeGU.mjs";
3
- import { I as i, A as n, B as f } from "./ToggleListItem-ciFTiqRS.mjs";
3
+ import { I as i, A as n, B as f } from "./Notification-Bs1fdbzI.mjs";
4
4
  import { T as m } from "./TransactionApi-CjBoLleL.mjs";
5
5
  class y {
6
6
  fetchInstance;
@@ -0,0 +1,53 @@
1
+ import { addMonths as u } from "date-fns/addMonths";
2
+ import { isBefore as d } from "date-fns/isBefore";
3
+ import { startOfMonth as _ } from "date-fns/startOfMonth";
4
+ import { subMonths as y } from "date-fns/subMonths";
5
+ import { endOfMonth as M } from "date-fns/endOfMonth";
6
+ import { b as a, P as l } from "./Category-Ccoew_sA.mjs";
7
+ import { f as m, D as T } from "./Dialog-CWymUiuO.mjs";
8
+ const i = (e) => (e.top_level_category_guid === a.INCOME || e.category_guid === a.INCOME) && !h(e), C = (e) => !i(e) && !f(e), p = (e) => l.includes(e.top_level_category_guid) || l.includes(e.category_guid), f = (e) => e.top_level_category_guid === a.TRANSFER || e.category_guid === a.TRANSFER, h = (e) => e.top_level_category_guid === a.INVESTMENTS || e.category_guid === a.INVESTMENTS, N = (e) => !i(e) && !p(e) && !f(e) && !h(e), w = (e) => e.filter((r) => r.category_guid === r.top_level_category_guid), F = (e, r) => {
9
+ if (r === 0) return 0;
10
+ const o = (e - r) / r;
11
+ return isNaN(o) ? 0 : o;
12
+ }, g = (e, r) => {
13
+ const o = [];
14
+ let t = _(r?.start ?? y(/* @__PURE__ */ new Date(), 5));
15
+ const s = r?.end ?? /* @__PURE__ */ new Date();
16
+ for (; d(t, s); )
17
+ o.push({
18
+ x: m(t, T.MONTH_SHORT),
19
+ y: e.filter((n) => n.year === t.getFullYear() && n.month === t.getMonth() + 1).reduce((n, c) => n + c.total, 0)
20
+ }), t = u(t, 1);
21
+ return o;
22
+ }, b = (e, r) => {
23
+ const o = e.filter(i);
24
+ return g(o, r).map((t) => ({ ...t, y: Math.abs(t.y) }));
25
+ }, A = (e, r) => {
26
+ const o = e.filter(p);
27
+ return g(o, r).map((t) => ({ ...t, y: Math.abs(t.y) }));
28
+ }, x = (e, r) => {
29
+ const o = e.filter(N);
30
+ return g(o, r);
31
+ }, H = (e) => {
32
+ const r = [], o = e.filter(
33
+ (n) => n.top_level_category_guid !== a.INCOME && n.top_level_category_guid !== a.TRANSFER && n.total > 0
34
+ );
35
+ let t = _(y(/* @__PURE__ */ new Date(), 5));
36
+ const s = M(/* @__PURE__ */ new Date());
37
+ for (; d(t, s); )
38
+ r.push({
39
+ x: m(t, T.MONTH_SHORT),
40
+ y: o.filter((n) => n.year === t.getFullYear() && n.month === t.getMonth() + 1).reduce((n, c) => n + c.total, 0)
41
+ }), t = u(t, 1);
42
+ return r;
43
+ };
44
+ export {
45
+ A as a,
46
+ x as b,
47
+ w as c,
48
+ C as d,
49
+ H as e,
50
+ F as f,
51
+ b as g,
52
+ i
53
+ };
@@ -0,0 +1,193 @@
1
+ import { b as T } from "./CategoryUtil-CFHBvaV4.mjs";
2
+ import { b as p } from "./Category-Ccoew_sA.mjs";
3
+ import { jsxs as f, Fragment as w, jsx as m } from "react/jsx-runtime";
4
+ import _ from "react";
5
+ import { observer as N } from "mobx-react-lite";
6
+ import k from "@mui/material/Button";
7
+ import h from "@mui/material/Stack";
8
+ import { useTheme as M } from "@mui/material/styles";
9
+ import { CategoryIcon as A, CategoryIconVariants as G, Text as y, P as O } from "@mxenabled/mxui";
10
+ import { D as $ } from "./Donut-Dmy3JTWd.mjs";
11
+ import { u as j } from "./useAriaLive-B3_pRUio.mjs";
12
+ import { u as R } from "./hooks-fY_n74f7.mjs";
13
+ import { u as v } from "./useScreenSize-B6JyS_Lj.mjs";
14
+ import { f as x } from "./NumberFormatting-DjTD0t3W.mjs";
15
+ import B from "@mui/material/Box";
16
+ const D = 5, H = (i, l, g, c) => c.reduce((t, n) => {
17
+ const a = i.find((s) => s.guid === n.category_guid);
18
+ if (!a) return t;
19
+ const o = a.parent_guid ?? a.guid, r = i.find((s) => s.guid === o);
20
+ if (!r) return t;
21
+ const d = {
22
+ guid: a.guid,
23
+ name: a.guid === o ? `${l.parent_category_totals_label_general} ${a.name}` : a.name,
24
+ color: T(r.guid, g),
25
+ amount: n.total
26
+ }, e = t.find((s) => s.guid === o);
27
+ return e ? (e.amount += n.total, e.categoryTotals?.push(d)) : t.push({
28
+ guid: o,
29
+ name: r.name,
30
+ color: T(r.guid, g),
31
+ categoryTotals: [d],
32
+ amount: n.total
33
+ }), t;
34
+ }, []), no = (i, l, g, c) => {
35
+ const t = H(i, l, g, c), n = t.filter(
36
+ (e) => e.guid !== p.INCOME && e.guid !== p.INVESTMENTS && e.guid !== p.TRANSFER && e.amount > 0
37
+ ).sort((e, s) => s.amount - e.amount), a = n.reduce(
38
+ (e, s) => e + s.amount,
39
+ 0
40
+ ), o = n.length > D ? D : n.length, r = n.slice(0, o), d = r.map((e) => ({
41
+ id: e.guid,
42
+ color: T(e.guid, g),
43
+ label: e.name,
44
+ value: e.amount / a * 100
45
+ }));
46
+ if (n.length > 5) {
47
+ const e = n.slice(D, t.length), s = e.reduce(
48
+ (C, u) => C + u.amount,
49
+ 0
50
+ );
51
+ r.push({
52
+ guid: "other",
53
+ color: g.palette.categories.others || "",
54
+ name: l.saving_goal_other,
55
+ categoryTotals: e,
56
+ amount: s
57
+ }), d.push({
58
+ id: "other",
59
+ color: g.palette.categories.others || "",
60
+ label: l.saving_goal_other,
61
+ value: s / a * 100
62
+ });
63
+ }
64
+ return {
65
+ categoryData: r,
66
+ donutData: d,
67
+ totalAmount: a
68
+ };
69
+ }, eo = (i, l, g) => {
70
+ const c = i.filter(
71
+ (o) => o.guid === p.INCOME || o.parent_guid === p.INCOME
72
+ ), t = l.filter((o) => c.some((r) => r.guid === o.category_guid)).sort((o, r) => o.total - r.total).map((o, r) => ({
73
+ guid: o.category_guid,
74
+ name: i.find((d) => d.guid === o.category_guid)?.name,
75
+ color: g[r],
76
+ categoryTotals: [],
77
+ amount: Math.abs(o.total)
78
+ })), n = t.reduce(
79
+ (o, r) => o + r.amount,
80
+ 0
81
+ ), a = t.map((o) => ({
82
+ id: o.guid,
83
+ color: o.color,
84
+ label: o.name,
85
+ value: o.amount / n * 100
86
+ }));
87
+ return {
88
+ categoryData: t,
89
+ donutData: a,
90
+ totalAmount: n
91
+ };
92
+ }, V = ({
93
+ data: i,
94
+ isIncome: l = !1,
95
+ onSelected: g,
96
+ onViewTransactions: c,
97
+ selectedId: t,
98
+ size: n = 150,
99
+ totalLabel: a,
100
+ variant: o = "mini"
101
+ }) => {
102
+ const { spending: r } = R(), d = M(), { isTablet: e } = v(), { announce: s, ariaLive: C } = j(), u = _.useMemo(
103
+ () => t ? i.categoryData.find((b) => b.guid === t) : void 0,
104
+ [t]
105
+ );
106
+ _.useEffect(() => {
107
+ if (u) {
108
+ const b = x(u.amount, o === "mini" ? "0,0" : "0,0.00");
109
+ s(`${u.name}: ${b}`);
110
+ }
111
+ }, [u, s, o]);
112
+ const S = i.donutData.length > 0 ? i.donutData : [{ id: "0", color: d.palette.divider, value: 100 }], E = () => {
113
+ c?.(t);
114
+ }, I = e ? 32 : 48;
115
+ return /* @__PURE__ */ f(w, { children: [
116
+ C,
117
+ /* @__PURE__ */ m($, { data: S, onClick: g, selectedId: t, size: n, children: /* @__PURE__ */ m(h, { alignItems: "center", height: "100%", justifyContent: "center", width: "100%", children: /* @__PURE__ */ f(h, { alignItems: "center", justifyContent: "center", minHeight: n, minWidth: n, children: [
118
+ u && /* @__PURE__ */ f(
119
+ h,
120
+ {
121
+ alignItems: "center",
122
+ gap: o === "mini" ? 0 : 8,
123
+ mb: o === "mini" ? 0 : 8,
124
+ mt: o === "mini" ? 0 : -16,
125
+ sx: o === "mini" ? { gap: 0, mb: 0 } : { gap: { xs: 4, xl: 8 }, mb: { xs: 4, xl: 8 } },
126
+ children: [
127
+ /* @__PURE__ */ m(
128
+ A,
129
+ {
130
+ categoryGuid: l ? p.INCOME : u.guid,
131
+ size: o === "mini" ? 24 : I,
132
+ variant: G.Transparent
133
+ }
134
+ ),
135
+ /* @__PURE__ */ m(
136
+ y,
137
+ {
138
+ color: "secondary",
139
+ noWrap: !0,
140
+ variant: o === "mini" ? "Tiny" : "Body",
141
+ children: u ? u.name : a
142
+ }
143
+ )
144
+ ]
145
+ }
146
+ ),
147
+ !u && o === "full" && /* @__PURE__ */ m(y, { bold: !0, color: "secondary", sx: { mb: { xs: 4, xl: 8 } }, children: a }),
148
+ /* @__PURE__ */ m(O, { variant: o === "mini" ? "H2" : "H1", children: u ? x(u.amount, o === "mini" ? "0,0" : "0,0.00") : x(i.totalAmount, o === "mini" ? "0,0" : "0,0.00") }),
149
+ !u && o === "mini" && /* @__PURE__ */ m(y, { color: "secondary", noWrap: !0, variant: "Tiny", children: a }),
150
+ o === "full" && /* @__PURE__ */ m(
151
+ k,
152
+ {
153
+ "aria-label": `View ${u?.name || ""} Transactions`,
154
+ disabled: i.categoryData.length === 0,
155
+ onClick: E,
156
+ sx: { mt: { xl: 4, xs: 0 }, zIndex: 1 },
157
+ variant: "text",
158
+ children: r.view_transactions
159
+ }
160
+ )
161
+ ] }) }) })
162
+ ] });
163
+ }, ro = N(V), ao = ({ data: i, onSelected: l, selectedId: g }) => {
164
+ const c = (t, n) => {
165
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), l(n));
166
+ };
167
+ return /* @__PURE__ */ m(h, { gap: 8, height: "100%", justifyContent: "center", my: "auto", children: i.categoryData.map((t) => /* @__PURE__ */ f(
168
+ h,
169
+ {
170
+ alignItems: "center",
171
+ "aria-label": t.name,
172
+ "aria-pressed": t.guid === g,
173
+ direction: "row",
174
+ gap: 8,
175
+ onClick: () => l(t.guid),
176
+ onKeyDown: (n) => c(n, t.guid),
177
+ role: "button",
178
+ sx: { cursor: "pointer" },
179
+ tabIndex: 0,
180
+ children: [
181
+ /* @__PURE__ */ m(B, { borderRadius: 4, height: 8, sx: { backgroundColor: t.color }, width: 8 }),
182
+ /* @__PURE__ */ m(y, { bold: t.guid === g, variant: "XSmall", children: t.name })
183
+ ]
184
+ },
185
+ t.guid
186
+ )) });
187
+ };
188
+ export {
189
+ ro as S,
190
+ eo as a,
191
+ ao as b,
192
+ no as g
193
+ };