@mx-cartographer/experiences 7.0.0-alpha.mega1 → 7.0.1-alpha.al0

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 (78) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{Account-DY6nxO7y.mjs → Account-BFol-JYA.mjs} +1 -1
  3. package/dist/{AccountDetailsContent-DvPs81kL.mjs → AccountDetailsContent-Do3z1FnQ.mjs} +8 -8
  4. package/dist/{AccountDetailsHeader-W2U7ZVm_.mjs → AccountDetailsHeader-DnEyQMpX.mjs} +12 -12
  5. package/dist/{AccountFields-DAVcbZy5.mjs → AccountFields-CeHZrIQe.mjs} +2 -2
  6. package/dist/{AccountListItem-DFlbdcmT.mjs → AccountListItem-C7JzYpqf.mjs} +3 -3
  7. package/dist/{AccountStore-CU7qV3vg.mjs → AccountStore-Cu3GoLh-.mjs} +1 -1
  8. package/dist/{Accounts-BLlrQA5m.mjs → Accounts-BuYXUMhP.mjs} +1 -1
  9. package/dist/{BudgetUtil-Ci1TN0J5.mjs → BudgetUtil-spowPvBM.mjs} +2 -2
  10. package/dist/{Category-5S6uwuXz.mjs → Category-CevNQ03n.mjs} +4 -4
  11. package/dist/{CategorySelectorDrawer-rHyHHYuh.mjs → CategorySelectorDrawer-Dyzb3UDU.mjs} +1 -1
  12. package/dist/{CategoryStore-B5EW6I1d.mjs → CategoryStore-BOyzQjQp.mjs} +2 -2
  13. package/dist/{CategoryUtil-DRyruNgi.mjs → CategoryUtil-BR3H5i6n.mjs} +1 -1
  14. package/dist/{ConnectDrawer-D9cR5phc.mjs → ConnectDrawer-WfKHsHSF.mjs} +1 -1
  15. package/dist/{ConnectionsDrawer-BzGqljSp.mjs → ConnectionsDrawer-Czp-E0-m.mjs} +2 -2
  16. package/dist/{CurrencyInput-D74cemI2.mjs → CurrencyInput-CSZjO22Z.mjs} +1 -1
  17. package/dist/{DebtsStore-S0l9kr0r.mjs → DebtsStore-D9holN8L.mjs} +1 -1
  18. package/dist/ExportCsvAction-dpvaZxbS.mjs +24 -0
  19. package/dist/{GoalStore-DioeeL-s.mjs → GoalStore-Drf76ell.mjs} +4 -4
  20. package/dist/{Help-DpYRO8oA.mjs → Help-DRUwVDvo.mjs} +1 -1
  21. package/dist/{LineChart-CcyX38kK.mjs → LineChart-CYiUS-px.mjs} +88 -85
  22. package/dist/{ListItemAction-BabpYivr.mjs → ListItemAction-BzmbPuNp.mjs} +1 -1
  23. package/dist/{ManageIncome-ndMuhJMG.mjs → ManageIncome-B6kmMN_z.mjs} +178 -186
  24. package/dist/{MicroWidgetContainer-CsvHLYKX.mjs → MicroWidgetContainer-DmYiksbT.mjs} +1 -1
  25. package/dist/{MiniWidgetContainer-BoOp-A05.mjs → MiniWidgetContainer-DqKQNubH.mjs} +1 -1
  26. package/dist/{NetWorthStore-PD-RUe09.mjs → NetWorthStore-BK1_NbXW.mjs} +2 -2
  27. package/dist/{Notification-AMGWM1Al.mjs → Notification-ByMBpJ5u.mjs} +33 -22
  28. package/dist/{NotificationSettings-VhHuMAFU.mjs → NotificationSettings-BznqGVQ2.mjs} +35 -34
  29. package/dist/{OriginalBalanceAction-D39mx6uE.mjs → OriginalBalanceAction-CSu5brQE.mjs} +3 -3
  30. package/dist/RecurringSettings-Be1dzkMz.mjs +57 -0
  31. package/dist/ResponsiveButton-DZFp78fJ.mjs +45 -0
  32. package/dist/{SettingsStore-CE7jDVFL.mjs → SettingsStore-B4gi6oOw.mjs} +1 -1
  33. package/dist/{SpendingData-BkrxzHdr.mjs → SpendingData-D5vsfYKo.mjs} +5 -5
  34. package/dist/{Transaction-CA0FW2Ij.mjs → Transaction-CyqrHmAA.mjs} +1 -1
  35. package/dist/{TransactionDetails-WBHFmbxL.mjs → TransactionDetails-D4B9DSWo.mjs} +421 -417
  36. package/dist/{TransactionStore-CeLdmVnC.mjs → TransactionStore-DSyXtPek.mjs} +8 -8
  37. package/dist/TrendsStore-DR8etTL2.mjs +547 -0
  38. package/dist/{ViewMoreMicroCard-CAPFNz-J.mjs → ViewMoreMicroCard-BZI5VMNW.mjs} +476 -468
  39. package/dist/{WidgetContainer-DWCusxYI.mjs → WidgetContainer-BG-fdDOf.mjs} +110 -104
  40. package/dist/accounts/index.es.js +12 -12
  41. package/dist/analytics/index.es.js +8 -8
  42. package/dist/budgets/index.es.js +10 -10
  43. package/dist/cashflow/index.es.js +7 -7
  44. package/dist/categories/index.es.js +2 -2
  45. package/dist/common/components/WidgetContainer.d.ts +1 -1
  46. package/dist/common/components/charts/LineChart.d.ts +1 -0
  47. package/dist/common/components/index.d.ts +1 -0
  48. package/dist/common/components/listitems/ToggleButtonListItem.d.ts +2 -1
  49. package/dist/common/constants/Analytics.d.ts +16 -10
  50. package/dist/common/index.es.js +432 -469
  51. package/dist/dashboard/index.es.js +13 -13
  52. package/dist/debts/index.es.js +66 -66
  53. package/dist/{exportTransactionsToCSV-CmwsKl2D.mjs → exportTransactionsToCSV-BlVifaOG.mjs} +2 -2
  54. package/dist/finstrong/index.es.js +6 -6
  55. package/dist/goals/index.es.js +32 -32
  56. package/dist/help/index.es.js +3 -3
  57. package/dist/{hooks-30y_BLwc.mjs → hooks-02T565vf.mjs} +10 -10
  58. package/dist/investments/index.es.js +3 -3
  59. package/dist/merchants/index.es.js +1 -1
  60. package/dist/microinsights/components/carouselheader/CarouselHeader.d.ts +1 -0
  61. package/dist/microinsights/components/microBeatCarousel/MicroBeatCarousel.d.ts +1 -0
  62. package/dist/microinsights/index.es.js +1 -1
  63. package/dist/networth/index.es.js +7 -7
  64. package/dist/notifications/index.es.js +9 -9
  65. package/dist/recurringtransactions/index.es.js +8 -8
  66. package/dist/settings/index.es.js +25 -25
  67. package/dist/spending/index.es.js +13 -13
  68. package/dist/transactions/components/shared/TransactionList.d.ts +2 -0
  69. package/dist/transactions/components/transactionwidget/actions/ExportCsvAction.d.ts +5 -1
  70. package/dist/transactions/index.d.ts +1 -0
  71. package/dist/transactions/index.es.js +143 -141
  72. package/dist/trends/constants/TrendsWidget.d.ts +3 -0
  73. package/dist/trends/index.es.js +579 -642
  74. package/package.json +1 -1
  75. package/dist/RecurringSettings-D_HnMYZP.mjs +0 -57
  76. package/dist/TrendsStore-BHJUapXF.mjs +0 -487
  77. package/dist/index.d.ts +0 -0
  78. package/dist/trends/components/TransactionsList.d.ts +0 -7
@@ -11,12 +11,12 @@ import { fromUnixTime as u } from "date-fns/fromUnixTime";
11
11
  import { getUnixTime as h } from "date-fns/getUnixTime";
12
12
  import { isBefore as B } from "date-fns/isBefore";
13
13
  import { startOfMonth as R } from "date-fns/startOfMonth";
14
- import { startOfToday as G } from "date-fns/startOfToday";
14
+ import { startOfToday as b } from "date-fns/startOfToday";
15
15
  import { subDays as Y } from "date-fns/subDays";
16
- import { O as n, a as b, T as F } from "./Transaction-CA0FW2Ij.mjs";
16
+ import { O as n, a as G, T as F } from "./Transaction-CyqrHmAA.mjs";
17
17
  import { T as p } from "./TransactionApi-DbbcjI2L.mjs";
18
- import { c as W } from "./Category-5S6uwuXz.mjs";
19
- import { f as z } from "./exportTransactionsToCSV-CmwsKl2D.mjs";
18
+ import { b as W } from "./Category-CevNQ03n.mjs";
19
+ import { f as z } from "./exportTransactionsToCSV-BlVifaOG.mjs";
20
20
  import { format as k } from "date-fns/format";
21
21
  import { f as g, D as O, O as $ } from "./Dialog-CWW597AF.mjs";
22
22
  import { endOfMonth as X } from "date-fns/endOfMonth";
@@ -352,7 +352,7 @@ const j = ({
352
352
  accountIsHidden: s?.is_hidden,
353
353
  category: l?.name || "Uncategorized",
354
354
  isIncome: c.top_level_category_guid === W.INCOME,
355
- isPending: c.feed_status === b.PENDING,
355
+ isPending: c.feed_status === G.PENDING,
356
356
  number: s?.account_number || "",
357
357
  payee: c.description,
358
358
  tags: I
@@ -367,7 +367,7 @@ const j = ({
367
367
  }, tt = (S, t, a) => {
368
368
  const {
369
369
  accounts: e = [],
370
- dateRange: A = { start: R(G()), end: D() },
370
+ dateRange: A = { start: R(b()), end: D() },
371
371
  custom: _ = () => !0,
372
372
  searchTerm: i = "",
373
373
  showSplits: c = !1
@@ -397,7 +397,7 @@ const j = ({
397
397
  description: "",
398
398
  duplicate: !1,
399
399
  feed_description: "",
400
- feed_status: b.POSTED,
400
+ feed_status: G.POSTED,
401
401
  feed_transaction_date: 0,
402
402
  has_been_split: !1,
403
403
  has_been_viewed: !1,
@@ -465,7 +465,7 @@ class mt {
465
465
  api = new p("/", "");
466
466
  beatApi = new f("/", "");
467
467
  associatedBeats = [];
468
- cachedStartDate = Y(G(), 90);
468
+ cachedStartDate = Y(b(), 90);
469
469
  filter = {};
470
470
  isLoading = !0;
471
471
  rawTransactions = [];
@@ -0,0 +1,547 @@
1
+ import M, { useState as J, useEffect as K, useRef as ve } from "react";
2
+ import { m as Se, u as _e, l as Q } from "./hooks-02T565vf.mjs";
3
+ import { jsxs as f, jsx as s } from "react/jsx-runtime";
4
+ import A from "@mui/material/Box";
5
+ import T from "@mui/material/Stack";
6
+ import { useTheme as U } from "@mui/material/styles";
7
+ import { LineChart as Me } from "@mui/x-charts";
8
+ import { u as Z } from "./useScreenSize-B6JyS_Lj.mjs";
9
+ import { u as Te } from "./useDimensions-27p2evRx.mjs";
10
+ import { observer as De } from "mobx-react-lite";
11
+ import Le from "@mui/material/Card";
12
+ import Ae from "@mui/material/CardContent";
13
+ import P from "@mui/material/Divider";
14
+ import X from "@mui/material/Grid";
15
+ import { CategoryIcon as Re, Text as S } from "@mxenabled/mxui";
16
+ import { b as Ie } from "./Localization-2MODESHW.mjs";
17
+ import { C as O } from "./CurrencyText-YUhH2caW.mjs";
18
+ import { useTheme as we, Card as He, CardContent as Ee, Box as ke } from "@mui/material";
19
+ import { f as R, D as I } from "./Dialog-CWW597AF.mjs";
20
+ import Ge from "@mui/material/Button";
21
+ import { C as L, b as Ne, c as Be } from "./Category-CevNQ03n.mjs";
22
+ import { f as z } from "./NumberFormatting-CtWHhyBX.mjs";
23
+ import Oe from "@mui/material/ListItem";
24
+ import $e from "@mui/material/ListItemButton";
25
+ import V from "@mui/material/ListItemIcon";
26
+ import We from "@mui/material/ListItemText";
27
+ import { makeAutoObservable as je } from "mobx";
28
+ import { addSeconds as Fe } from "date-fns/addSeconds";
29
+ import { differenceInCalendarMonths as Ye } from "date-fns/differenceInCalendarMonths";
30
+ import { endOfMonth as q } from "date-fns/endOfMonth";
31
+ import { subMonths as Pe } from "date-fns/subMonths";
32
+ const Et = () => {
33
+ const { isInitialized: o, appDataStore: t } = Se(), [r, a] = J(!1);
34
+ return K(() => {
35
+ o && t.clientInsightProfile?.is_enabled && a(!0);
36
+ }, [o, t.clientInsightProfile]), r;
37
+ }, ee = ({ categoryGuid: o, topLevelCategoryGuid: t }) => {
38
+ const { categories: r } = _e(), { getCategoryName: a } = Q(), n = a(o);
39
+ return /* @__PURE__ */ f(T, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
40
+ /* @__PURE__ */ s(
41
+ A,
42
+ {
43
+ "aria-label": Ie(r.category_icon_label_aria, n),
44
+ mb: 4,
45
+ role: "img",
46
+ children: /* @__PURE__ */ s(Re, { categoryGuid: t })
47
+ }
48
+ ),
49
+ /* @__PURE__ */ s(S, { variant: "Body", children: n })
50
+ ] });
51
+ }, Xe = ({
52
+ categoryGuids: { guid: o, topLevelGuid: t },
53
+ hoveredAreaData: r,
54
+ cursorPosition: a,
55
+ chartContainerRef: n
56
+ }) => {
57
+ const i = U(), c = ve(null), [h, g] = J({ x: a.x, y: a.y });
58
+ if (K(() => {
59
+ (() => {
60
+ const u = c.current, x = n.current;
61
+ if (!u || !x) return;
62
+ const y = u.getBoundingClientRect(), C = x.getBoundingClientRect();
63
+ let p = a.x, v = a.y;
64
+ p + y.width * 2 > C.right ? p = a.x - y.width : p - y.width < C.left && (p = a.x), v + y.height * 2 > C.bottom && (v = a.y - y.height), g({ x: p, y: v });
65
+ })();
66
+ }, [a, n]), !r) return null;
67
+ const b = r.reduce((d, u) => d + u.y, 0);
68
+ return /* @__PURE__ */ s(
69
+ Le,
70
+ {
71
+ ref: c,
72
+ sx: {
73
+ position: "absolute",
74
+ top: h.y,
75
+ left: h.x,
76
+ width: 250,
77
+ pointerEvents: "none"
78
+ },
79
+ children: /* @__PURE__ */ f(Ae, { children: [
80
+ /* @__PURE__ */ f(A, { alignItems: "center", display: "flex", flexDirection: "column", children: [
81
+ /* @__PURE__ */ s(ee, { categoryGuid: o, topLevelCategoryGuid: t }),
82
+ /* @__PURE__ */ s(S, { variant: "Small", children: `${r.length}-month total` }),
83
+ /* @__PURE__ */ s(O, { amount: b, bold: !0, formatString: "0,0", variant: "body2" })
84
+ ] }),
85
+ /* @__PURE__ */ s(P, { sx: { my: 16, width: "100%" } }),
86
+ /* @__PURE__ */ s(X, { container: !0, children: r.map((d, u) => /* @__PURE__ */ f(M.Fragment, { children: [
87
+ u > 0 && u % 3 === 0 && /* @__PURE__ */ s(P, { sx: { my: 16, width: "100%" } }),
88
+ /* @__PURE__ */ s(X, { item: !0, xs: 4, children: /* @__PURE__ */ f(A, { alignItems: "center", display: "flex", flexDirection: "column", children: [
89
+ /* @__PURE__ */ s(S, { color: i.palette.text.secondary, variant: "XSmall", children: d.x }),
90
+ /* @__PURE__ */ s(
91
+ O,
92
+ {
93
+ amount: d.y,
94
+ bold: !0,
95
+ formatString: "0,0",
96
+ variant: "Body"
97
+ }
98
+ )
99
+ ] }) })
100
+ ] }, u)) })
101
+ ] })
102
+ }
103
+ );
104
+ }, ze = De(Xe), Ve = ({
105
+ categoryGuids: { guid: o, topLevelGuid: t },
106
+ itemData: { dataIndex: r },
107
+ series: a,
108
+ xData: n
109
+ }) => {
110
+ const i = we(), c = a.data[r], h = n[r];
111
+ return c === void 0 || !h ? null : /* @__PURE__ */ s(He, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ s(Ee, { children: /* @__PURE__ */ f(ke, { alignItems: "center", display: "flex", flexDirection: "column", children: [
112
+ /* @__PURE__ */ s(ee, { categoryGuid: o, topLevelCategoryGuid: t }),
113
+ /* @__PURE__ */ s(S, { color: i.palette.text.secondary, variant: "Small", children: R(h, I.MONTH_SHORT_YEAR) }),
114
+ /* @__PURE__ */ s(O, { amount: String(c), bold: !0, formatString: "0,0", variant: "Body" })
115
+ ] }) }) });
116
+ }, qe = ({
117
+ sx: o,
118
+ categoryGuids: t,
119
+ hoveredLegend: r,
120
+ legendRef: a,
121
+ onHoverLegend: n,
122
+ onClickLegend: i
123
+ }) => {
124
+ const { isMobile: c } = Z(), { getCategoryName: h } = Q();
125
+ return /* @__PURE__ */ s(
126
+ T,
127
+ {
128
+ direction: "row",
129
+ flexWrap: "wrap",
130
+ gap: c ? 2 : 6,
131
+ justifyContent: "start",
132
+ ref: a,
133
+ sx: o,
134
+ children: t.map(({ guid: g, top_level_guid: b }) => {
135
+ const d = r === g, u = L[g], x = L[b], y = u ?? x ?? L.default, C = y + "33";
136
+ return /* @__PURE__ */ f(
137
+ Ge,
138
+ {
139
+ onClick: () => i(g),
140
+ onMouseEnter: () => n(g),
141
+ onMouseLeave: () => n(null),
142
+ sx: {
143
+ color: "text.primary",
144
+ fontWeight: "normal",
145
+ display: "flex",
146
+ justifyContent: "center",
147
+ alignItems: "center",
148
+ paddingX: 8,
149
+ paddingY: 4,
150
+ borderRadius: 1,
151
+ opacity: d ? 1 : 0.7
152
+ },
153
+ children: [
154
+ /* @__PURE__ */ s(
155
+ A,
156
+ {
157
+ sx: {
158
+ width: 16,
159
+ height: 16,
160
+ marginRight: c ? 5 : 10,
161
+ borderRadius: "2px",
162
+ backgroundColor: r ? d ? y : C : y
163
+ }
164
+ }
165
+ ),
166
+ /* @__PURE__ */ s(S, { variant: "Body", children: h(g) })
167
+ ]
168
+ },
169
+ g
170
+ );
171
+ })
172
+ }
173
+ );
174
+ }, kt = ({
175
+ onHoverArea: o,
176
+ onHoverPoint: t,
177
+ onHoverLegend: r,
178
+ onClickLegend: a,
179
+ stackedDatasets: n,
180
+ unstackedDatasets: i = [],
181
+ availableHeight: c = 0,
182
+ minimumHeight: h = 350
183
+ }) => {
184
+ const g = U(), { isMobile: b } = Z(), [d, { height: u }] = Te(), x = M.useRef(null), [y, C] = M.useState(0);
185
+ M.useEffect(() => {
186
+ const e = Math.max(c - u, h);
187
+ C(e);
188
+ }, [c, u]);
189
+ const [p, v] = M.useState(null), [te, w] = M.useState({
190
+ hoveredSeriesId: null,
191
+ hoveredAreaData: null,
192
+ isAreaHovered: !1,
193
+ cursorPos: { x: 0, y: 0 }
194
+ }), { hoveredSeriesId: D, hoveredAreaData: $, isAreaHovered: oe, cursorPos: H } = te, W = oe && D && $, j = !W, G = [...n, ...i], re = G[0]?.dataset.length ?? 0, N = G.flatMap((e) => e.dataset.map((l) => l.x)), ae = G.flatMap((e) => e.dataset.map((l) => l.y)), ne = n[0]?.dataset?.map(
195
+ (e, l) => n.reduce((m, _) => m + _.dataset[l]?.y || 0, 0)
196
+ ) ?? [0], se = Math.max(...ne), ie = Math.max(
197
+ ...i.flatMap((e) => e.dataset.map((l) => l.y))
198
+ ), le = Math.floor(Math.min(...ae) / 100) * 100, ce = Math.ceil(Math.max(se, ie) / 100) * 100, E = n.map((e, l) => ({
199
+ id: `stacked-${l}`,
200
+ guid: e.category_guid,
201
+ top_level_guid: e.top_level_category_guid,
202
+ area: !0,
203
+ color: n[l].category_color ?? g.palette.primary.main,
204
+ data: e.dataset.map((m) => m.y),
205
+ label: n[l].category_name,
206
+ stack: "total",
207
+ type: "line",
208
+ highlightScope: { highlight: "item" },
209
+ valueFormatter: (m) => z(m, "0,0")
210
+ })), F = i.map((e, l) => ({
211
+ id: `unstacked-${l}`,
212
+ guid: e.category_guid,
213
+ top_level_guid: e.top_level_category_guid,
214
+ area: !1,
215
+ color: e.category_color,
216
+ data: e.dataset.map((m) => m.y),
217
+ label: e.category_name,
218
+ type: "line",
219
+ valueFormatter: (m) => z(m, "0,0")
220
+ })), Y = [...E, ...F], de = [
221
+ ...E.map(({ guid: e, top_level_guid: l }) => ({
222
+ guid: e,
223
+ top_level_guid: l
224
+ })),
225
+ ...F.map(({ guid: e, top_level_guid: l }) => ({
226
+ guid: e,
227
+ top_level_guid: l
228
+ }))
229
+ ], k = (e) => {
230
+ const m = e.startsWith("stacked-") ? n[parseInt(e.split("-")[1])] : i[parseInt(e.split("-")[1])];
231
+ return {
232
+ guid: m?.category_guid,
233
+ topLevelGuid: m?.top_level_category_guid
234
+ };
235
+ }, ue = (e) => {
236
+ v(e), r?.(e ?? "");
237
+ }, me = (e) => {
238
+ a?.(e ?? "");
239
+ }, ge = () => {
240
+ const e = k(String(D)).guid;
241
+ e && a?.(e);
242
+ }, he = (e) => {
243
+ const l = String(e?.seriesId), m = k(l).guid, _ = Y.find((B) => B.id === l), fe = _ && e?.dataIndex !== void 0, xe = _ && e?.dataIndex === void 0;
244
+ if (fe)
245
+ w({
246
+ hoveredSeriesId: l,
247
+ hoveredAreaData: null,
248
+ isAreaHovered: !1,
249
+ cursorPos: H
250
+ }), t?.(m);
251
+ else if (xe) {
252
+ const B = _?.data.map((be, Ce) => ({
253
+ x: N[Ce],
254
+ y: be
255
+ })) ?? [];
256
+ w({
257
+ hoveredSeriesId: l,
258
+ hoveredAreaData: B,
259
+ isAreaHovered: !0,
260
+ cursorPos: H
261
+ }), o?.(m);
262
+ } else
263
+ w({
264
+ hoveredSeriesId: null,
265
+ hoveredAreaData: null,
266
+ isAreaHovered: !1,
267
+ cursorPos: H
268
+ });
269
+ }, pe = (e) => {
270
+ const l = e.currentTarget.getBoundingClientRect();
271
+ w((m) => ({
272
+ ...m,
273
+ cursorPos: {
274
+ x: e.clientX - l.left,
275
+ y: e.clientY - l.top
276
+ }
277
+ }));
278
+ }, ye = {
279
+ p: 4,
280
+ "& .MuiBarLabel-root": {
281
+ fontSize: 10,
282
+ fontWeight: 600
283
+ },
284
+ "& .MuiAreaElement-root": {
285
+ opacity: 0.4,
286
+ transition: "opacity 0.3s ease"
287
+ },
288
+ "& .MuiAreaElement-root:hover": {
289
+ opacity: 1
290
+ },
291
+ '& [class*="MuiLineElement-series-unstacked-"]': {
292
+ strokeWidth: 3
293
+ },
294
+ ...p && E.reduce((e, l, m) => {
295
+ const _ = `.MuiAreaElement-series-stacked-${m}`;
296
+ return e[_] = {
297
+ opacity: E[m].guid === p ? 0.9 : 0.2
298
+ }, e;
299
+ }, {})
300
+ };
301
+ return /* @__PURE__ */ s(A, { onMouseMove: pe, ref: x, style: { position: "relative" }, children: /* @__PURE__ */ f(
302
+ T,
303
+ {
304
+ direction: { xs: "column", md: "column" },
305
+ spacing: { xs: 0, md: 4 },
306
+ sx: { width: "100%", position: "relative" },
307
+ children: [
308
+ /* @__PURE__ */ s(
309
+ Me,
310
+ {
311
+ height: y,
312
+ margin: { bottom: 50 },
313
+ onAreaClick: ge,
314
+ onHighlightChange: he,
315
+ series: Y,
316
+ skipAnimation: !0,
317
+ slotProps: {
318
+ legend: {
319
+ hidden: !0
320
+ }
321
+ },
322
+ slots: {
323
+ itemContent: (e) => j && D ? /* @__PURE__ */ s(
324
+ Ve,
325
+ {
326
+ categoryGuids: k(D),
327
+ xData: N,
328
+ ...e
329
+ }
330
+ ) : null
331
+ },
332
+ sx: ye,
333
+ tooltip: {
334
+ trigger: j ? "item" : "none"
335
+ },
336
+ xAxis: [
337
+ {
338
+ data: N,
339
+ scaleType: "time",
340
+ valueFormatter: (e) => R(e, I.MONTH_SHORT_YEAR),
341
+ tickNumber: re
342
+ // How many ticks to show on the x-axis
343
+ }
344
+ ],
345
+ yAxis: [
346
+ {
347
+ min: le,
348
+ max: ce || 100
349
+ }
350
+ ]
351
+ }
352
+ ),
353
+ /* @__PURE__ */ s(
354
+ qe,
355
+ {
356
+ categoryGuids: de,
357
+ hoveredLegend: p,
358
+ legendRef: d,
359
+ onClickLegend: me,
360
+ onHoverLegend: ue,
361
+ sx: { px: b ? 0 : 24 }
362
+ }
363
+ ),
364
+ W && /* @__PURE__ */ s(
365
+ ze,
366
+ {
367
+ categoryGuids: k(D),
368
+ chartContainerRef: x,
369
+ cursorPosition: H,
370
+ hoveredAreaData: $.map((e) => ({
371
+ ...e,
372
+ x: R(e.x, I.MONTH_SHORT_YEAR)
373
+ }))
374
+ }
375
+ )
376
+ ]
377
+ }
378
+ ) });
379
+ }, Gt = ({
380
+ onClick: o,
381
+ leftIcon: t,
382
+ rightIcon: r,
383
+ title: a,
384
+ subtitle: n,
385
+ rightContent: i,
386
+ titleBold: c = !0,
387
+ rightContentBold: h = !0
388
+ }) => {
389
+ const g = /* @__PURE__ */ f(M.Fragment, { children: [
390
+ t && /* @__PURE__ */ s(V, { sx: { ml: 0 }, children: t }),
391
+ /* @__PURE__ */ s(We, { children: /* @__PURE__ */ f(
392
+ T,
393
+ {
394
+ sx: {
395
+ alignItems: "center",
396
+ flexDirection: "row",
397
+ marginLeft: 12
398
+ },
399
+ children: [
400
+ /* @__PURE__ */ f(T, { sx: { flex: 1, minWidth: 0 }, children: [
401
+ /* @__PURE__ */ s(S, { bold: c, variant: "body1", children: a }),
402
+ n && /* @__PURE__ */ s(S, { variant: "caption", children: n })
403
+ ] }),
404
+ /* @__PURE__ */ f(T, { sx: { flexDirection: "row", alignItems: "center", gap: 1 }, children: [
405
+ i && /* @__PURE__ */ s(S, { bold: h, display: "flex", variant: "body1", children: i }),
406
+ r && /* @__PURE__ */ s(V, { children: r })
407
+ ] })
408
+ ]
409
+ }
410
+ ) })
411
+ ] });
412
+ return /* @__PURE__ */ s(Oe, { sx: { bgcolor: "background.paper" }, children: o ? /* @__PURE__ */ s(
413
+ $e,
414
+ {
415
+ onClick: o,
416
+ sx: {
417
+ py: 14
418
+ },
419
+ children: g
420
+ }
421
+ ) : /* @__PURE__ */ s(
422
+ T,
423
+ {
424
+ sx: {
425
+ py: 14,
426
+ px: 24,
427
+ width: "100%",
428
+ flexDirection: "row",
429
+ alignItems: "center"
430
+ },
431
+ children: g
432
+ }
433
+ ) });
434
+ }, Je = (o) => L[o] ?? L.default, Ke = (o) => Be[o];
435
+ function Qe(o, t) {
436
+ const r = [], a = new Date(o);
437
+ for (; a <= t; ) {
438
+ const n = a.getFullYear(), i = String(a.getMonth() + 1).padStart(2, "0");
439
+ r.push(+`${n}${i}`), a.setMonth(a.getMonth() + 1);
440
+ }
441
+ return r;
442
+ }
443
+ const Ue = (o) => o.reduce((r, a) => {
444
+ const n = {
445
+ top_level_category_guid: a.top_level_category_guid,
446
+ category_guid: a.category_guid,
447
+ amount: a.total,
448
+ year_month: a.year_month
449
+ }, { top_level_category_guid: i, category_guid: c } = n;
450
+ return r[c] || (r[c] = []), r[c].push(n), i !== c && (r[i] || (r[i] = []), r[i].push(n)), r;
451
+ }, {}), Nt = (o, t, r) => {
452
+ const a = Ue(o), n = Qe(t, r);
453
+ return Object.entries(a).map(([c, h]) => {
454
+ const g = h[0].top_level_category_guid, b = n.map((d) => {
455
+ const u = h.filter((p) => p.year_month === d).reduce((p, v) => p + Math.abs(v.amount), 0), x = Number(String(d).slice(0, 4)), y = Number(String(d).slice(4));
456
+ return { x: new Date(x, y - 1), y: u };
457
+ }).sort((d, u) => d.x.getTime() - u.x.getTime());
458
+ return {
459
+ top_level_category_guid: g,
460
+ category_guid: c,
461
+ category_name: Ke(c),
462
+ category_color: Je(g),
463
+ dataset: b
464
+ };
465
+ });
466
+ }, Bt = (o, t) => {
467
+ const r = typeof o == "string" ? parseFloat(o.replace(/[^0-9.-]+/g, "")) : o, a = typeof t == "string" ? parseFloat(t.replace(/[^0-9.-]+/g, "")) : t;
468
+ return (r || 0) - (a || 0);
469
+ }, Ze = (o, t) => {
470
+ const r = o.subCategories.filter((i) => i.currentAmount !== 0), a = o.totalMonthlyAmounts.slice(-t), n = (i) => i.substring(0, 3) + " " + i.slice(-4);
471
+ return a.map((i) => {
472
+ const c = n(i.label), h = r.map((d) => {
473
+ const u = d.monthlyAmounts.slice(-t).find((x) => n(x.label) === c);
474
+ return {
475
+ label: d.name,
476
+ amount: Math.abs(u?.amount || 0),
477
+ header: c
478
+ };
479
+ }), g = o.monthlyAmounts.slice(-t).find((d) => n(d.label) === c);
480
+ return [{
481
+ label: o.name,
482
+ amount: Math.abs(g?.amount || 0),
483
+ header: c
484
+ }, ...h].sort((d, u) => u.amount - d.amount);
485
+ });
486
+ }, et = (o, t) => {
487
+ const r = o ? o.totalMonthlyAmounts.slice(-t).map((n) => ({
488
+ x: n.label.substring(0, 3),
489
+ y: Math.abs(n.amount)
490
+ })) : [], a = o ? Ze(o, t) : [];
491
+ return { monthlyAmounts: r, tooltipLabels: a };
492
+ }, tt = (o) => o.slice().filter(
493
+ (t) => t.totalAmount !== 0 && t.isTransfer === !1 && t.guid !== Ne.INVESTMENTS
494
+ ).sort((t, r) => Math.abs(r.totalAmount) - Math.abs(t.totalAmount));
495
+ class Ot {
496
+ globalStore;
497
+ selectedCategoryData = null;
498
+ selectedDateRange;
499
+ visibleListLength = 5;
500
+ constructor(t) {
501
+ this.globalStore = t, this.selectedDateRange = {
502
+ start: Fe(q(Pe(/* @__PURE__ */ new Date(), 6)), 1),
503
+ end: q(/* @__PURE__ */ new Date())
504
+ }, je(this);
505
+ }
506
+ setSelectedCategoryData = (t) => {
507
+ this.selectedCategoryData = t;
508
+ };
509
+ setSelectedDateRange = (t) => {
510
+ this.selectedDateRange = t;
511
+ };
512
+ setVisibleListLength = (t) => {
513
+ this.visibleListLength = t;
514
+ };
515
+ get sortedDetailedCategoriesWithTransactions() {
516
+ return tt(
517
+ this.globalStore.categoryStore.detailedCategoriesWithTransactions
518
+ );
519
+ }
520
+ get selectedDateRangeMonthCount() {
521
+ return Ye(this.selectedDateRange.end, this.selectedDateRange.start) + 1;
522
+ }
523
+ get selectedDateRangeMonthRange() {
524
+ const t = R(this.selectedDateRange.start, I.MONTH_LONG), r = R(this.selectedDateRange.end, I.MONTH_LONG);
525
+ return `${t} - ${r}`;
526
+ }
527
+ get visibleCategories() {
528
+ return this.sortedDetailedCategoriesWithTransactions.slice(0, this.visibleListLength);
529
+ }
530
+ get collapsedCategories() {
531
+ return this.sortedDetailedCategoriesWithTransactions.slice(this.visibleListLength);
532
+ }
533
+ get categoryDetailsChartData() {
534
+ return et(
535
+ this.selectedCategoryData,
536
+ this.selectedDateRangeMonthCount
537
+ );
538
+ }
539
+ }
540
+ export {
541
+ Gt as L,
542
+ kt as S,
543
+ Ot as T,
544
+ Bt as a,
545
+ Nt as g,
546
+ Et as u
547
+ };