@mx-cartographer/experiences 7.0.23-alpha.al1 → 7.0.23-alpha.al10

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 (58) hide show
  1. package/dist/{Account-BW3-oYEs.mjs → Account-CVVDlNDC.mjs} +1 -1
  2. package/dist/{AccountDetailsContent-UxSEMBo_.mjs → AccountDetailsContent-bQKVSCZF.mjs} +8 -8
  3. package/dist/{AccountDetailsHeader-Eb3WvBGm.mjs → AccountDetailsHeader-BGQAu0Xm.mjs} +8 -8
  4. package/dist/{AccountFields-CIz-r3gP.mjs → AccountFields-CC7kzfPK.mjs} +2 -2
  5. package/dist/{AccountListItem-B-ZjJ4Gp.mjs → AccountListItem-wgvQjLxW.mjs} +3 -3
  6. package/dist/{AccountStore-BaMynkQT.mjs → AccountStore-DpglOysH.mjs} +19 -19
  7. package/dist/{Accounts-CA-nqAjT.mjs → Accounts-ByViymVi.mjs} +1 -1
  8. package/dist/{BudgetUtil-CeSLAcsl.mjs → BudgetUtil-gzgNEDE7.mjs} +1 -1
  9. package/dist/{CategorySelectorDrawer-BJ9jlCyt.mjs → CategorySelectorDrawer-LpZcwQPa.mjs} +4 -4
  10. package/dist/{ConnectDrawer-phFH6OHt.mjs → ConnectDrawer-C2minBK_.mjs} +1 -1
  11. package/dist/{ConnectionsDrawer-ihxkAi1P.mjs → ConnectionsDrawer-Cd4dZuWL.mjs} +2 -2
  12. package/dist/{CurrencyInput-bEx2Mbd0.mjs → CurrencyInput-Dz4r9Rfe.mjs} +1 -1
  13. package/dist/{DebtsStore-VkyMADzd.mjs → DebtsStore-B51DTXVj.mjs} +1 -1
  14. package/dist/{GoalStore-eSOkI6uE.mjs → GoalStore-DqQ2FMx5.mjs} +2 -2
  15. package/dist/{Help-KAAMEubC.mjs → Help-DVPbIxMM.mjs} +1 -1
  16. package/dist/{LineChart-BWWmmJxV.mjs → LineChart-DLk-bww5.mjs} +1 -1
  17. package/dist/{ListItemAction-DNZZ5fSa.mjs → ListItemAction-DE6S0N5o.mjs} +1 -1
  18. package/dist/{ManageIncome-DbsiKUoO.mjs → ManageIncome-BokhnWOn.mjs} +4 -4
  19. package/dist/{MicroWidgetContainer-Dxz8uBN9.mjs → MicroWidgetContainer-5YscP1xa.mjs} +1 -1
  20. package/dist/{MiniWidgetContainer-CTyjmE1h.mjs → MiniWidgetContainer-BlsgwNew.mjs} +1 -1
  21. package/dist/{NetWorthStore-B6xF9eGH.mjs → NetWorthStore-C0hQSRzt.mjs} +2 -2
  22. package/dist/{NotificationSettings-BJFyyZYE.mjs → NotificationSettings-CWx6H-2z.mjs} +2 -2
  23. package/dist/{OriginalBalanceAction-DepsKiJz.mjs → OriginalBalanceAction-BKsSQVnI.mjs} +3 -3
  24. package/dist/{RecurringSettings-Dj29piAQ.mjs → RecurringSettings-CICRt51C.mjs} +3 -3
  25. package/dist/{TransactionDetails-C-z3HGTT.mjs → TransactionDetails-BXl0m15s.mjs} +37 -37
  26. package/dist/{TransactionStore-0tLtBEIC.mjs → TransactionStore-BElBVYfk.mjs} +248 -209
  27. package/dist/TrendsStore-DRuzsVVE.mjs +505 -0
  28. package/dist/TrendsWidget-CRi8EO04.mjs +6 -0
  29. package/dist/{User-Dq9Qj764.mjs → User-DtwqVm3K.mjs} +1 -1
  30. package/dist/{WidgetContainer-CdBs9WOZ.mjs → WidgetContainer-DK8aZO5l.mjs} +2 -2
  31. package/dist/accounts/index.es.js +12 -12
  32. package/dist/analytics/index.es.js +8 -8
  33. package/dist/budgets/index.es.js +10 -10
  34. package/dist/cashflow/index.es.js +7 -7
  35. package/dist/categories/index.es.js +1 -1
  36. package/dist/common/index.es.js +577 -518
  37. package/dist/dashboard/index.es.js +9 -9
  38. package/dist/debts/index.es.js +9 -9
  39. package/dist/{exportTransactionsToCSV-BDlt8u0n.mjs → exportTransactionsToCSV-Cf5VRYVr.mjs} +1 -1
  40. package/dist/finstrong/index.es.js +6 -6
  41. package/dist/goals/index.es.js +11 -11
  42. package/dist/help/index.es.js +3 -3
  43. package/dist/{hooks-DkUqN6JE.mjs → hooks-DUeXom8C.mjs} +13 -13
  44. package/dist/investments/index.es.js +3 -3
  45. package/dist/merchants/index.es.js +1 -1
  46. package/dist/microinsights/index.es.js +1969 -14
  47. package/dist/networth/index.es.js +7 -7
  48. package/dist/notifications/index.es.js +2 -2
  49. package/dist/recurringtransactions/index.es.js +8 -8
  50. package/dist/settings/index.es.js +24 -24
  51. package/dist/spending/index.es.js +21 -21
  52. package/dist/transactions/index.es.js +270 -259
  53. package/dist/trends/index.es.js +402 -778
  54. package/package.json +1 -1
  55. package/dist/ExportCsvAction-CbMfQ2Wa.mjs +0 -24
  56. package/dist/ResponsiveButton-DZFp78fJ.mjs +0 -45
  57. package/dist/TrendsStore-WrHxzdbQ.mjs +0 -565
  58. package/dist/ViewMoreMicroCard-DFAY0tA8.mjs +0 -1974
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "7.0.23-alpha.al1",
3
+ "version": "7.0.23-alpha.al10",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",
@@ -1,24 +0,0 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { observer as c } from "mobx-react-lite";
3
- import { Icon as i } from "@mxenabled/mxui";
4
- import { e as p } from "./exportTransactionsToCSV-BDlt8u0n.mjs";
5
- import { O as m } from "./User-Dq9Qj764.mjs";
6
- import { R as x } from "./ResponsiveButton-DZFp78fJ.mjs";
7
- import { e as _, f as C, u as l } from "./hooks-DkUqN6JE.mjs";
8
- const v = ({ filter: t }) => {
9
- const { onEvent: r } = _(), { tags: e, sortedTransactions: s } = C(), { transactions: n } = l(), a = () => {
10
- r(m.ON_TRANSACTION_EXPORT_CSV_CLICK), p(t ? s.filter(t) : s, e);
11
- };
12
- return /* @__PURE__ */ o("div", { className: "mx-txn-export-csv-action", children: /* @__PURE__ */ o(
13
- x,
14
- {
15
- icon: /* @__PURE__ */ o(i, { name: "open_in_new" }),
16
- label: n.export_csv_btn,
17
- onClick: a,
18
- tooltipText: n.export_csv_title
19
- }
20
- ) });
21
- }, b = c(v);
22
- export {
23
- b as E
24
- };
@@ -1,45 +0,0 @@
1
- import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
- import p from "react";
3
- import d from "@mui/material/Button";
4
- import a from "@mui/material/IconButton";
5
- import c from "@mui/material/Tooltip";
6
- import f from "@mui/material/styles/useTheme";
7
- const u = ({
8
- icon: e,
9
- label: i,
10
- onClick: o,
11
- placement: s = "bottom",
12
- tooltipText: n,
13
- variant: l = "text"
14
- }) => {
15
- const r = f();
16
- return /* @__PURE__ */ m(p.Fragment, { children: [
17
- /* @__PURE__ */ t(
18
- d,
19
- {
20
- onClick: o,
21
- startIcon: e,
22
- sx: {
23
- [r.breakpoints.down("lg")]: { display: "none" },
24
- [r.breakpoints.up("lg")]: { display: "inline-flex" }
25
- },
26
- title: n,
27
- variant: l,
28
- children: i
29
- }
30
- ),
31
- /* @__PURE__ */ t(
32
- c,
33
- {
34
- describeChild: !0,
35
- placement: s,
36
- sx: { display: { xs: "inline-flex", lg: "none" } },
37
- title: n,
38
- children: /* @__PURE__ */ t(a, { onClick: o, children: e })
39
- }
40
- )
41
- ] });
42
- }, y = u;
43
- export {
44
- y as R
45
- };
@@ -1,565 +0,0 @@
1
- import M, { useState as J, useEffect as K, useRef as vt } from "react";
2
- import { l as St, u as _t, k as Q } from "./hooks-DkUqN6JE.mjs";
3
- import { jsxs as f, jsx as s } from "react/jsx-runtime";
4
- import L from "@mui/material/Box";
5
- import T from "@mui/material/Stack";
6
- import { useTheme as U } from "@mui/material/styles";
7
- import { LineChart as Mt } from "@mui/x-charts";
8
- import { u as Z } from "./useScreenSize-B6JyS_Lj.mjs";
9
- import { u as Tt } from "./useDimensions-27p2evRx.mjs";
10
- import { observer as Dt } from "mobx-react-lite";
11
- import At from "@mui/material/Card";
12
- import Lt from "@mui/material/CardContent";
13
- import P from "@mui/material/Divider";
14
- import X from "@mui/material/Grid";
15
- import { CategoryIcon as Rt, Text as S } from "@mxenabled/mxui";
16
- import { b as It } from "./Localization-2MODESHW.mjs";
17
- import { C as O } from "./CurrencyText-YUhH2caW.mjs";
18
- import { useTheme as wt, Card as Ht, CardContent as Et, Box as kt } from "@mui/material";
19
- import { f as R, D as I } from "./Dialog-CWW597AF.mjs";
20
- import Gt from "@mui/material/Button";
21
- import { C as A, b as Nt, c as Bt } from "./Category-CevNQ03n.mjs";
22
- import { f as z } from "./NumberFormatting-CtWHhyBX.mjs";
23
- import Ot from "@mui/material/ListItem";
24
- import $t from "@mui/material/ListItemButton";
25
- import V from "@mui/material/ListItemIcon";
26
- import Wt from "@mui/material/ListItemText";
27
- import { makeAutoObservable as jt } from "mobx";
28
- import { addSeconds as Ft } from "date-fns/addSeconds";
29
- import { differenceInCalendarMonths as Yt } from "date-fns/differenceInCalendarMonths";
30
- import { endOfMonth as q } from "date-fns/endOfMonth";
31
- import { subMonths as Pt } from "date-fns/subMonths";
32
- const Ee = () => {
33
- const { isInitialized: o, appDataStore: e } = St(), [r, n] = J(!1);
34
- return K(() => {
35
- o && e.clientInsightProfile?.is_enabled && n(!0);
36
- }, [o, e.clientInsightProfile]), r;
37
- }, tt = ({ categoryGuid: o, topLevelCategoryGuid: e }) => {
38
- const { categories: r } = _t(), { getCategoryName: n } = Q(), a = n(o);
39
- return /* @__PURE__ */ f(T, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
40
- /* @__PURE__ */ s(
41
- L,
42
- {
43
- "aria-label": It(r.category_icon_label_aria, a),
44
- mb: 4,
45
- role: "img",
46
- children: /* @__PURE__ */ s(Rt, { categoryGuid: e })
47
- }
48
- ),
49
- /* @__PURE__ */ s(S, { variant: "Body", children: a })
50
- ] });
51
- }, Xt = ({
52
- categoryGuids: { guid: o, topLevelGuid: e },
53
- hoveredAreaData: r,
54
- cursorPosition: n,
55
- chartContainerRef: a
56
- }) => {
57
- const i = U(), c = vt(null), [h, g] = J({ x: n.x, y: n.y });
58
- if (K(() => {
59
- (() => {
60
- const u = c.current, x = a.current;
61
- if (!u || !x) return;
62
- const y = u.getBoundingClientRect(), C = x.getBoundingClientRect();
63
- let p = n.x, v = n.y;
64
- p + y.width * 2 > C.right ? p = n.x - y.width : p - y.width < C.left && (p = n.x), v + y.height * 2 > C.bottom && (v = n.y - y.height), g({ x: p, y: v });
65
- })();
66
- }, [n, a]), !r) return null;
67
- const b = r.reduce((d, u) => d + u.y, 0);
68
- return /* @__PURE__ */ s(
69
- At,
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(Lt, { children: [
80
- /* @__PURE__ */ f(L, { alignItems: "center", display: "flex", flexDirection: "column", children: [
81
- /* @__PURE__ */ s(tt, { categoryGuid: o, topLevelCategoryGuid: e }),
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(L, { 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
- }, zt = Dt(Xt), Vt = ({
105
- categoryGuids: { guid: o, topLevelGuid: e },
106
- itemData: { dataIndex: r },
107
- series: n,
108
- xData: a
109
- }) => {
110
- const i = wt(), c = n.data[r], h = a[r];
111
- return c === void 0 || !h ? null : /* @__PURE__ */ s(Ht, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ s(Et, { children: /* @__PURE__ */ f(kt, { alignItems: "center", display: "flex", flexDirection: "column", children: [
112
- /* @__PURE__ */ s(tt, { categoryGuid: o, topLevelCategoryGuid: e }),
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
- }, qt = ({
117
- sx: o,
118
- categoryGuids: e,
119
- hoveredLegend: r,
120
- legendRef: n,
121
- onHoverLegend: a,
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: n,
133
- sx: o,
134
- children: e.map(({ guid: g, top_level_guid: b }) => {
135
- const d = r === g, u = A[g], x = A[b], y = u ?? x ?? A.default, C = y + "33";
136
- return /* @__PURE__ */ f(
137
- Gt,
138
- {
139
- onClick: () => i(g),
140
- onMouseEnter: () => a(g),
141
- onMouseLeave: () => a(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
- L,
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
- }, ke = ({
175
- onHoverArea: o,
176
- onHoverPoint: e,
177
- onHoverLegend: r,
178
- onClickLegend: n,
179
- stackedDatasets: a,
180
- unstackedDatasets: i = [],
181
- availableHeight: c = 0,
182
- minimumHeight: h = 350
183
- }) => {
184
- const g = U(), { isMobile: b } = Z(), [d, { height: u }] = Tt(), x = M.useRef(null), [y, C] = M.useState(0);
185
- M.useEffect(() => {
186
- const t = Math.max(c - u, h);
187
- C(t);
188
- }, [c, u]);
189
- const [p, v] = M.useState(null), [et, w] = M.useState({
190
- hoveredSeriesId: null,
191
- hoveredAreaData: null,
192
- isAreaHovered: !1,
193
- cursorPos: { x: 0, y: 0 }
194
- }), { hoveredSeriesId: D, hoveredAreaData: $, isAreaHovered: ot, cursorPos: H } = et, W = ot && D && $, j = !W, G = [...a, ...i], rt = G[0]?.dataset.length ?? 0, N = G.flatMap((t) => t.dataset.map((l) => l.x)), nt = G.flatMap((t) => t.dataset.map((l) => l.y)), at = a[0]?.dataset?.map(
195
- (t, l) => a.reduce((m, _) => m + _.dataset[l]?.y || 0, 0)
196
- ) ?? [0], st = Math.max(...at), it = Math.max(
197
- ...i.flatMap((t) => t.dataset.map((l) => l.y))
198
- ), lt = Math.floor(Math.min(...nt) / 100) * 100, ct = Math.ceil(Math.max(st, it) / 100) * 100, E = a.map((t, l) => ({
199
- id: `stacked-${l}`,
200
- guid: t.category_guid,
201
- top_level_guid: t.top_level_category_guid,
202
- area: !0,
203
- color: a[l].category_color ?? g.palette.primary.main,
204
- data: t.dataset.map((m) => m.y),
205
- label: a[l].category_name,
206
- stack: "total",
207
- type: "line",
208
- highlightScope: { highlight: "item" },
209
- valueFormatter: (m) => z(m, "0,0")
210
- })), F = i.map((t, l) => ({
211
- id: `unstacked-${l}`,
212
- guid: t.category_guid,
213
- top_level_guid: t.top_level_category_guid,
214
- area: !1,
215
- color: t.category_color,
216
- data: t.dataset.map((m) => m.y),
217
- label: t.category_name,
218
- type: "line",
219
- valueFormatter: (m) => z(m, "0,0")
220
- })), Y = [...E, ...F], dt = [
221
- ...E.map(({ guid: t, top_level_guid: l }) => ({
222
- guid: t,
223
- top_level_guid: l
224
- })),
225
- ...F.map(({ guid: t, top_level_guid: l }) => ({
226
- guid: t,
227
- top_level_guid: l
228
- }))
229
- ], k = (t) => {
230
- const m = t.startsWith("stacked-") ? a[parseInt(t.split("-")[1])] : i[parseInt(t.split("-")[1])];
231
- return {
232
- guid: m?.category_guid,
233
- topLevelGuid: m?.top_level_category_guid
234
- };
235
- }, ut = (t) => {
236
- v(t), r?.(t ?? "");
237
- }, mt = (t) => {
238
- n?.(t ?? "");
239
- }, gt = () => {
240
- const t = k(String(D)).guid;
241
- t && n?.(t);
242
- }, ht = (t) => {
243
- const l = String(t?.seriesId), m = k(l).guid, _ = Y.find((B) => B.id === l), ft = _ && t?.dataIndex !== void 0, xt = _ && t?.dataIndex === void 0;
244
- if (ft)
245
- w({
246
- hoveredSeriesId: l,
247
- hoveredAreaData: null,
248
- isAreaHovered: !1,
249
- cursorPos: H
250
- }), e?.(m);
251
- else if (xt) {
252
- const B = _?.data.map((bt, Ct) => ({
253
- x: N[Ct],
254
- y: bt
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
- }, pt = (t) => {
270
- const l = t.currentTarget.getBoundingClientRect();
271
- w((m) => ({
272
- ...m,
273
- cursorPos: {
274
- x: t.clientX - l.left,
275
- y: t.clientY - l.top
276
- }
277
- }));
278
- }, yt = {
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((t, l, m) => {
295
- const _ = `.MuiAreaElement-series-stacked-${m}`;
296
- return t[_] = {
297
- opacity: E[m].guid === p ? 0.9 : 0.2
298
- }, t;
299
- }, {})
300
- };
301
- return /* @__PURE__ */ s(
302
- L,
303
- {
304
- onMouseMove: pt,
305
- ref: x,
306
- sx: {
307
- position: "relative",
308
- touchAction: "pan-y",
309
- "& svg": {
310
- touchAction: "pan-y",
311
- userSelect: "none"
312
- },
313
- "& .recharts-wrapper": {
314
- touchAction: "pan-y"
315
- }
316
- },
317
- children: /* @__PURE__ */ f(
318
- T,
319
- {
320
- direction: { xs: "column", md: "column" },
321
- spacing: { xs: 0, md: 4 },
322
- sx: { width: "100%", position: "relative" },
323
- children: [
324
- /* @__PURE__ */ s(
325
- Mt,
326
- {
327
- height: y,
328
- margin: { bottom: 50 },
329
- onAreaClick: gt,
330
- onHighlightChange: ht,
331
- series: Y,
332
- skipAnimation: !0,
333
- slotProps: {
334
- legend: {
335
- hidden: !0
336
- }
337
- },
338
- slots: {
339
- itemContent: (t) => j && D ? /* @__PURE__ */ s(
340
- Vt,
341
- {
342
- categoryGuids: k(D),
343
- xData: N,
344
- ...t
345
- }
346
- ) : null
347
- },
348
- sx: yt,
349
- tooltip: {
350
- trigger: j ? "item" : "none"
351
- },
352
- xAxis: [
353
- {
354
- data: N,
355
- scaleType: "time",
356
- valueFormatter: (t) => R(t, I.MONTH_SHORT_YEAR),
357
- tickNumber: rt
358
- // How many ticks to show on the x-axis
359
- }
360
- ],
361
- yAxis: [
362
- {
363
- min: lt,
364
- max: ct || 100
365
- }
366
- ]
367
- }
368
- ),
369
- /* @__PURE__ */ s(
370
- qt,
371
- {
372
- categoryGuids: dt,
373
- hoveredLegend: p,
374
- legendRef: d,
375
- onClickLegend: mt,
376
- onHoverLegend: ut,
377
- sx: { px: b ? 0 : 24 }
378
- }
379
- ),
380
- W && /* @__PURE__ */ s(
381
- zt,
382
- {
383
- categoryGuids: k(D),
384
- chartContainerRef: x,
385
- cursorPosition: H,
386
- hoveredAreaData: $.map((t) => ({
387
- ...t,
388
- x: R(t.x, I.MONTH_SHORT_YEAR)
389
- }))
390
- }
391
- )
392
- ]
393
- }
394
- )
395
- }
396
- );
397
- }, Ge = ({
398
- onClick: o,
399
- leftIcon: e,
400
- rightIcon: r,
401
- title: n,
402
- subtitle: a,
403
- rightContent: i,
404
- titleBold: c = !0,
405
- rightContentBold: h = !0
406
- }) => {
407
- const g = /* @__PURE__ */ f(M.Fragment, { children: [
408
- e && /* @__PURE__ */ s(V, { sx: { ml: 0 }, children: e }),
409
- /* @__PURE__ */ s(Wt, { children: /* @__PURE__ */ f(
410
- T,
411
- {
412
- sx: {
413
- alignItems: "center",
414
- flexDirection: "row",
415
- marginLeft: 12
416
- },
417
- children: [
418
- /* @__PURE__ */ f(T, { sx: { flex: 1, minWidth: 0 }, children: [
419
- /* @__PURE__ */ s(S, { bold: c, variant: "body1", children: n }),
420
- a && /* @__PURE__ */ s(S, { variant: "caption", children: a })
421
- ] }),
422
- /* @__PURE__ */ f(T, { sx: { flexDirection: "row", alignItems: "center", gap: 1 }, children: [
423
- i && /* @__PURE__ */ s(S, { bold: h, display: "flex", variant: "body1", children: i }),
424
- r && /* @__PURE__ */ s(V, { children: r })
425
- ] })
426
- ]
427
- }
428
- ) })
429
- ] });
430
- return /* @__PURE__ */ s(Ot, { sx: { bgcolor: "background.paper" }, children: o ? /* @__PURE__ */ s(
431
- $t,
432
- {
433
- onClick: o,
434
- sx: {
435
- py: 14
436
- },
437
- children: g
438
- }
439
- ) : /* @__PURE__ */ s(
440
- T,
441
- {
442
- sx: {
443
- py: 14,
444
- px: 24,
445
- width: "100%",
446
- flexDirection: "row",
447
- alignItems: "center"
448
- },
449
- children: g
450
- }
451
- ) });
452
- }, Jt = (o) => A[o] ?? A.default, Kt = (o) => Bt[o];
453
- function Qt(o, e) {
454
- const r = [], n = new Date(o);
455
- for (; n <= e; ) {
456
- const a = n.getFullYear(), i = String(n.getMonth() + 1).padStart(2, "0");
457
- r.push(+`${a}${i}`), n.setMonth(n.getMonth() + 1);
458
- }
459
- return r;
460
- }
461
- const Ut = (o) => o.reduce((r, n) => {
462
- const a = {
463
- top_level_category_guid: n.top_level_category_guid,
464
- category_guid: n.category_guid,
465
- amount: n.total,
466
- year_month: n.year_month
467
- }, { top_level_category_guid: i, category_guid: c } = a;
468
- return r[c] || (r[c] = []), r[c].push(a), i !== c && (r[i] || (r[i] = []), r[i].push(a)), r;
469
- }, {}), Ne = (o, e, r) => {
470
- const n = Ut(o), a = Qt(e, r);
471
- return Object.entries(n).map(([c, h]) => {
472
- const g = h[0].top_level_category_guid, b = a.map((d) => {
473
- 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));
474
- return { x: new Date(x, y - 1), y: u };
475
- }).sort((d, u) => d.x.getTime() - u.x.getTime());
476
- return {
477
- top_level_category_guid: g,
478
- category_guid: c,
479
- category_name: Kt(c),
480
- category_color: Jt(g),
481
- dataset: b
482
- };
483
- });
484
- }, Be = (o, e) => {
485
- const r = typeof o == "string" ? parseFloat(o.replace(/[^0-9.-]+/g, "")) : o, n = typeof e == "string" ? parseFloat(e.replace(/[^0-9.-]+/g, "")) : e;
486
- return (r || 0) - (n || 0);
487
- }, Zt = (o, e) => {
488
- const r = o.subCategories.filter((i) => i.currentAmount !== 0), n = o.totalMonthlyAmounts.slice(-e), a = (i) => i.substring(0, 3) + " " + i.slice(-4);
489
- return n.map((i) => {
490
- const c = a(i.label), h = r.map((d) => {
491
- const u = d.monthlyAmounts.slice(-e).find((x) => a(x.label) === c);
492
- return {
493
- label: d.name,
494
- amount: Math.abs(u?.amount || 0),
495
- header: c
496
- };
497
- }), g = o.monthlyAmounts.slice(-e).find((d) => a(d.label) === c);
498
- return [{
499
- label: o.name,
500
- amount: Math.abs(g?.amount || 0),
501
- header: c
502
- }, ...h].sort((d, u) => u.amount - d.amount);
503
- });
504
- }, te = (o, e) => {
505
- const r = o ? o.totalMonthlyAmounts.slice(-e).map((a) => ({
506
- x: a.label.substring(0, 3),
507
- y: Math.abs(a.amount)
508
- })) : [], n = o ? Zt(o, e) : [];
509
- return { monthlyAmounts: r, tooltipLabels: n };
510
- }, ee = (o) => o.slice().filter(
511
- (e) => e.totalAmount !== 0 && e.isTransfer === !1 && e.guid !== Nt.INVESTMENTS
512
- ).sort((e, r) => Math.abs(r.totalAmount) - Math.abs(e.totalAmount));
513
- class Oe {
514
- globalStore;
515
- selectedCategoryData = null;
516
- selectedDateRange;
517
- visibleListLength = 5;
518
- constructor(e) {
519
- this.globalStore = e, this.selectedDateRange = {
520
- start: Ft(q(Pt(/* @__PURE__ */ new Date(), 6)), 1),
521
- end: q(/* @__PURE__ */ new Date())
522
- }, jt(this);
523
- }
524
- setSelectedCategoryData = (e) => {
525
- this.selectedCategoryData = e;
526
- };
527
- setSelectedDateRange = (e) => {
528
- this.selectedDateRange = e;
529
- };
530
- setVisibleListLength = (e) => {
531
- this.visibleListLength = e;
532
- };
533
- get sortedDetailedCategoriesWithTransactions() {
534
- return ee(
535
- this.globalStore.categoryStore.detailedCategoriesWithTransactions
536
- );
537
- }
538
- get selectedDateRangeMonthCount() {
539
- return Yt(this.selectedDateRange.end, this.selectedDateRange.start) + 1;
540
- }
541
- get selectedDateRangeMonthRange() {
542
- const e = R(this.selectedDateRange.start, I.MONTH_LONG), r = R(this.selectedDateRange.end, I.MONTH_LONG);
543
- return `${e} - ${r}`;
544
- }
545
- get visibleCategories() {
546
- return this.sortedDetailedCategoriesWithTransactions.slice(0, this.visibleListLength);
547
- }
548
- get collapsedCategories() {
549
- return this.sortedDetailedCategoriesWithTransactions.slice(this.visibleListLength);
550
- }
551
- get categoryDetailsChartData() {
552
- return te(
553
- this.selectedCategoryData,
554
- this.selectedDateRangeMonthCount
555
- );
556
- }
557
- }
558
- export {
559
- Ge as L,
560
- ke as S,
561
- Oe as T,
562
- Be as a,
563
- Ne as g,
564
- Ee as u
565
- };