@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
@@ -0,0 +1,505 @@
1
+ import _, { useState as q, useEffect as J, useRef as vt } from "react";
2
+ import { k as St, u as xt, j as K } from "./hooks-DUeXom8C.mjs";
3
+ import { jsxs as S, jsx as i } from "react/jsx-runtime";
4
+ import A from "@mui/material/Box";
5
+ import O from "@mui/material/Stack";
6
+ import { useTheme as Q } from "@mui/material/styles";
7
+ import { LineChart as _t } from "@mui/x-charts";
8
+ import { u as U } from "./useScreenSize-B6JyS_Lj.mjs";
9
+ import { u as Mt } from "./useDimensions-27p2evRx.mjs";
10
+ import { observer as Tt } from "mobx-react-lite";
11
+ import At from "@mui/material/Card";
12
+ import Dt from "@mui/material/CardContent";
13
+ import P from "@mui/material/Divider";
14
+ import X from "@mui/material/Grid";
15
+ import { CategoryIcon as Lt, Text as D } from "@mxenabled/mxui";
16
+ import { b as Rt } from "./Localization-2MODESHW.mjs";
17
+ import { C as B } from "./CurrencyText-YUhH2caW.mjs";
18
+ import { useTheme as Ht, Card as Et, CardContent as kt, Box as Gt } from "@mui/material";
19
+ import { f as L, D as R } from "./Dialog-CWW597AF.mjs";
20
+ import wt from "@mui/material/Button";
21
+ import { C as T, b as It, c as Nt } from "./Category-CevNQ03n.mjs";
22
+ import { f as z } from "./NumberFormatting-CtWHhyBX.mjs";
23
+ import { makeAutoObservable as Bt } from "mobx";
24
+ import { addSeconds as Ot } from "date-fns/addSeconds";
25
+ import { differenceInCalendarMonths as $t } from "date-fns/differenceInCalendarMonths";
26
+ import { endOfMonth as V } from "date-fns/endOfMonth";
27
+ import { subMonths as jt } from "date-fns/subMonths";
28
+ const Te = () => {
29
+ const { isInitialized: o, appDataStore: e } = St(), [r, a] = q(!1);
30
+ return J(() => {
31
+ o && e.clientInsightProfile?.is_enabled && a(!0);
32
+ }, [o, e.clientInsightProfile]), r;
33
+ }, Z = ({ categoryGuid: o, topLevelCategoryGuid: e }) => {
34
+ const { categories: r } = xt(), { getCategoryName: a } = K(), n = a(o);
35
+ return /* @__PURE__ */ S(O, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
36
+ /* @__PURE__ */ i(
37
+ A,
38
+ {
39
+ "aria-label": Rt(r.category_icon_label_aria, n),
40
+ mb: 4,
41
+ role: "img",
42
+ children: /* @__PURE__ */ i(Lt, { categoryGuid: e })
43
+ }
44
+ ),
45
+ /* @__PURE__ */ i(D, { variant: "Body", children: n })
46
+ ] });
47
+ }, Wt = ({
48
+ categoryGuids: { guid: o, topLevelGuid: e },
49
+ hoveredAreaData: r,
50
+ cursorPosition: a,
51
+ chartContainerRef: n
52
+ }) => {
53
+ const l = Q(), c = vt(null), [h, m] = q({ x: a.x, y: a.y });
54
+ if (J(() => {
55
+ (() => {
56
+ const u = c.current, f = n.current;
57
+ if (!u || !f) return;
58
+ const y = u.getBoundingClientRect(), b = f.getBoundingClientRect();
59
+ let p = a.x, v = a.y;
60
+ p + y.width * 2 > b.right ? p = a.x - y.width : p - y.width < b.left && (p = a.x), v + y.height * 2 > b.bottom && (v = a.y - y.height), m({ x: p, y: v });
61
+ })();
62
+ }, [a, n]), !r) return null;
63
+ const C = r.reduce((d, u) => d + u.y, 0);
64
+ return /* @__PURE__ */ i(
65
+ At,
66
+ {
67
+ ref: c,
68
+ sx: {
69
+ position: "absolute",
70
+ top: h.y,
71
+ left: h.x,
72
+ width: 250,
73
+ pointerEvents: "none"
74
+ },
75
+ children: /* @__PURE__ */ S(Dt, { children: [
76
+ /* @__PURE__ */ S(A, { alignItems: "center", display: "flex", flexDirection: "column", children: [
77
+ /* @__PURE__ */ i(Z, { categoryGuid: o, topLevelCategoryGuid: e }),
78
+ /* @__PURE__ */ i(D, { variant: "Small", children: `${r.length}-month total` }),
79
+ /* @__PURE__ */ i(B, { amount: C, bold: !0, formatString: "0,0", variant: "body2" })
80
+ ] }),
81
+ /* @__PURE__ */ i(P, { sx: { my: 16, width: "100%" } }),
82
+ /* @__PURE__ */ i(X, { container: !0, children: r.map((d, u) => /* @__PURE__ */ S(_.Fragment, { children: [
83
+ u > 0 && u % 3 === 0 && /* @__PURE__ */ i(P, { sx: { my: 16, width: "100%" } }),
84
+ /* @__PURE__ */ i(X, { item: !0, xs: 4, children: /* @__PURE__ */ S(A, { alignItems: "center", display: "flex", flexDirection: "column", children: [
85
+ /* @__PURE__ */ i(D, { color: l.palette.text.secondary, variant: "XSmall", children: d.x }),
86
+ /* @__PURE__ */ i(
87
+ B,
88
+ {
89
+ amount: d.y,
90
+ bold: !0,
91
+ formatString: "0,0",
92
+ variant: "Body"
93
+ }
94
+ )
95
+ ] }) })
96
+ ] }, u)) })
97
+ ] })
98
+ }
99
+ );
100
+ }, Ft = Tt(Wt), Yt = ({
101
+ categoryGuids: { guid: o, topLevelGuid: e },
102
+ itemData: { dataIndex: r },
103
+ series: a,
104
+ xData: n
105
+ }) => {
106
+ const l = Ht(), c = a.data[r], h = n[r];
107
+ return c === void 0 || !h ? null : /* @__PURE__ */ i(Et, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ i(kt, { children: /* @__PURE__ */ S(Gt, { alignItems: "center", display: "flex", flexDirection: "column", children: [
108
+ /* @__PURE__ */ i(Z, { categoryGuid: o, topLevelCategoryGuid: e }),
109
+ /* @__PURE__ */ i(D, { color: l.palette.text.secondary, variant: "Small", children: L(h, R.MONTH_SHORT_YEAR) }),
110
+ /* @__PURE__ */ i(B, { amount: String(c), bold: !0, formatString: "0,0", variant: "Body" })
111
+ ] }) }) });
112
+ }, Pt = ({
113
+ sx: o,
114
+ categoryGuids: e,
115
+ hoveredLegend: r,
116
+ legendRef: a,
117
+ onHoverLegend: n,
118
+ onClickLegend: l
119
+ }) => {
120
+ const { isMobile: c } = U(), { getCategoryName: h } = K();
121
+ return /* @__PURE__ */ i(
122
+ O,
123
+ {
124
+ direction: "row",
125
+ flexWrap: "wrap",
126
+ gap: c ? 2 : 6,
127
+ justifyContent: "start",
128
+ ref: a,
129
+ sx: o,
130
+ children: e.map(({ guid: m, top_level_guid: C }) => {
131
+ const d = r === m, u = T[m], f = T[C], y = u ?? f ?? T.default, b = y + "33";
132
+ return /* @__PURE__ */ S(
133
+ wt,
134
+ {
135
+ onClick: () => l(m),
136
+ onMouseEnter: () => n(m),
137
+ onMouseLeave: () => n(null),
138
+ sx: {
139
+ color: "text.primary",
140
+ fontWeight: "normal",
141
+ display: "flex",
142
+ justifyContent: "center",
143
+ alignItems: "center",
144
+ paddingX: 8,
145
+ paddingY: 4,
146
+ borderRadius: 1,
147
+ opacity: d ? 1 : 0.7
148
+ },
149
+ children: [
150
+ /* @__PURE__ */ i(
151
+ A,
152
+ {
153
+ sx: {
154
+ width: 16,
155
+ height: 16,
156
+ marginRight: c ? 5 : 10,
157
+ borderRadius: "2px",
158
+ backgroundColor: r ? d ? y : b : y
159
+ }
160
+ }
161
+ ),
162
+ /* @__PURE__ */ i(D, { variant: "Body", children: h(m) })
163
+ ]
164
+ },
165
+ m
166
+ );
167
+ })
168
+ }
169
+ );
170
+ }, Ae = ({
171
+ onHoverArea: o,
172
+ onHoverPoint: e,
173
+ onHoverLegend: r,
174
+ onClickLegend: a,
175
+ stackedDatasets: n,
176
+ unstackedDatasets: l = [],
177
+ availableHeight: c = 0,
178
+ minimumHeight: h = 350
179
+ }) => {
180
+ const m = Q(), { isMobile: C } = U(), [d, { height: u }] = Mt(), f = _.useRef(null), [y, b] = _.useState(0);
181
+ _.useEffect(() => {
182
+ const t = Math.max(c - u, h);
183
+ b(t);
184
+ }, [c, u]);
185
+ const [p, v] = _.useState(null), [tt, H] = _.useState({
186
+ hoveredSeriesId: null,
187
+ hoveredAreaData: null,
188
+ isAreaHovered: !1,
189
+ cursorPos: { x: 0, y: 0 }
190
+ }), { hoveredSeriesId: M, hoveredAreaData: $, isAreaHovered: et, cursorPos: E } = tt, j = et && M && $, W = !j, w = [...n, ...l], ot = w[0]?.dataset.length ?? 0, I = w.flatMap((t) => t.dataset.map((s) => s.x)), rt = w.flatMap((t) => t.dataset.map((s) => s.y)), at = n[0]?.dataset?.map(
191
+ (t, s) => n.reduce((g, x) => g + x.dataset[s]?.y || 0, 0)
192
+ ) ?? [0], nt = Math.max(...at), st = Math.max(
193
+ ...l.flatMap((t) => t.dataset.map((s) => s.y))
194
+ ), it = Math.floor(Math.min(...rt) / 100) * 100, lt = Math.ceil(Math.max(nt, st) / 100) * 100, k = n.map((t, s) => ({
195
+ id: `stacked-${s}`,
196
+ guid: t.category_guid,
197
+ top_level_guid: t.top_level_category_guid,
198
+ area: !0,
199
+ color: n[s].category_color ?? m.palette.primary.main,
200
+ data: t.dataset.map((g) => g.y),
201
+ label: n[s].category_name,
202
+ stack: "total",
203
+ type: "line",
204
+ highlightScope: { highlight: "item" },
205
+ valueFormatter: (g) => z(g, "0,0")
206
+ })), F = l.map((t, s) => ({
207
+ id: `unstacked-${s}`,
208
+ guid: t.category_guid,
209
+ top_level_guid: t.top_level_category_guid,
210
+ area: !1,
211
+ color: t.category_color,
212
+ data: t.dataset.map((g) => g.y),
213
+ label: t.category_name,
214
+ type: "line",
215
+ valueFormatter: (g) => z(g, "0,0")
216
+ })), Y = [...k, ...F], ct = [
217
+ ...k.map(({ guid: t, top_level_guid: s }) => ({
218
+ guid: t,
219
+ top_level_guid: s
220
+ })),
221
+ ...F.map(({ guid: t, top_level_guid: s }) => ({
222
+ guid: t,
223
+ top_level_guid: s
224
+ }))
225
+ ], G = (t) => {
226
+ const g = t.startsWith("stacked-") ? n[parseInt(t.split("-")[1])] : l[parseInt(t.split("-")[1])];
227
+ return {
228
+ guid: g?.category_guid,
229
+ topLevelGuid: g?.top_level_category_guid
230
+ };
231
+ }, dt = (t) => {
232
+ v(t), r?.(t ?? "");
233
+ }, ut = (t) => {
234
+ a?.(t ?? "");
235
+ }, gt = () => {
236
+ const t = G(String(M)).guid;
237
+ t && a?.(t);
238
+ }, mt = (t) => {
239
+ const s = String(t?.seriesId), g = G(s).guid, x = Y.find((N) => N.id === s), yt = x && t?.dataIndex !== void 0, ft = x && t?.dataIndex === void 0;
240
+ if (yt)
241
+ H({
242
+ hoveredSeriesId: s,
243
+ hoveredAreaData: null,
244
+ isAreaHovered: !1,
245
+ cursorPos: E
246
+ }), e?.(g);
247
+ else if (ft) {
248
+ const N = x?.data.map((Ct, bt) => ({
249
+ x: I[bt],
250
+ y: Ct
251
+ })) ?? [];
252
+ H({
253
+ hoveredSeriesId: s,
254
+ hoveredAreaData: N,
255
+ isAreaHovered: !0,
256
+ cursorPos: E
257
+ }), o?.(g);
258
+ } else
259
+ H({
260
+ hoveredSeriesId: null,
261
+ hoveredAreaData: null,
262
+ isAreaHovered: !1,
263
+ cursorPos: E
264
+ });
265
+ }, ht = (t) => {
266
+ const s = t.currentTarget.getBoundingClientRect();
267
+ H((g) => ({
268
+ ...g,
269
+ cursorPos: {
270
+ x: t.clientX - s.left,
271
+ y: t.clientY - s.top
272
+ }
273
+ }));
274
+ }, pt = {
275
+ p: 4,
276
+ "& .MuiBarLabel-root": {
277
+ fontSize: 10,
278
+ fontWeight: 600
279
+ },
280
+ "& .MuiAreaElement-root": {
281
+ opacity: 0.4,
282
+ transition: "opacity 0.3s ease"
283
+ },
284
+ "& .MuiAreaElement-root:hover": {
285
+ opacity: 1
286
+ },
287
+ '& [class*="MuiLineElement-series-unstacked-"]': {
288
+ strokeWidth: 3
289
+ },
290
+ ...p && k.reduce((t, s, g) => {
291
+ const x = `.MuiAreaElement-series-stacked-${g}`;
292
+ return t[x] = {
293
+ opacity: k[g].guid === p ? 0.9 : 0.2
294
+ }, t;
295
+ }, {})
296
+ };
297
+ return /* @__PURE__ */ i(
298
+ A,
299
+ {
300
+ onMouseMove: ht,
301
+ ref: f,
302
+ sx: {
303
+ position: "relative",
304
+ touchAction: "pan-y",
305
+ "& svg": {
306
+ touchAction: "pan-y",
307
+ userSelect: "none"
308
+ },
309
+ "& .recharts-wrapper": {
310
+ touchAction: "pan-y"
311
+ }
312
+ },
313
+ children: /* @__PURE__ */ S(
314
+ O,
315
+ {
316
+ direction: { xs: "column", md: "column" },
317
+ spacing: { xs: 0, md: 4 },
318
+ sx: { width: "100%", position: "relative" },
319
+ children: [
320
+ /* @__PURE__ */ i(
321
+ _t,
322
+ {
323
+ height: y,
324
+ margin: { bottom: 50 },
325
+ onAreaClick: gt,
326
+ onHighlightChange: mt,
327
+ series: Y,
328
+ skipAnimation: !0,
329
+ slotProps: {
330
+ legend: {
331
+ hidden: !0
332
+ }
333
+ },
334
+ slots: {
335
+ itemContent: (t) => W && M ? /* @__PURE__ */ i(
336
+ Yt,
337
+ {
338
+ categoryGuids: G(M),
339
+ xData: I,
340
+ ...t
341
+ }
342
+ ) : null
343
+ },
344
+ sx: pt,
345
+ tooltip: {
346
+ trigger: W ? "item" : "none"
347
+ },
348
+ xAxis: [
349
+ {
350
+ data: I,
351
+ scaleType: "time",
352
+ valueFormatter: (t) => L(t, R.MONTH_SHORT_YEAR),
353
+ tickNumber: ot
354
+ // How many ticks to show on the x-axis
355
+ }
356
+ ],
357
+ yAxis: [
358
+ {
359
+ min: it,
360
+ max: lt || 100
361
+ }
362
+ ]
363
+ }
364
+ ),
365
+ /* @__PURE__ */ i(
366
+ Pt,
367
+ {
368
+ categoryGuids: ct,
369
+ hoveredLegend: p,
370
+ legendRef: d,
371
+ onClickLegend: ut,
372
+ onHoverLegend: dt,
373
+ sx: { px: C ? 0 : 24 }
374
+ }
375
+ ),
376
+ j && /* @__PURE__ */ i(
377
+ Ft,
378
+ {
379
+ categoryGuids: G(M),
380
+ chartContainerRef: f,
381
+ cursorPosition: E,
382
+ hoveredAreaData: $.map((t) => ({
383
+ ...t,
384
+ x: L(t.x, R.MONTH_SHORT_YEAR)
385
+ }))
386
+ }
387
+ )
388
+ ]
389
+ }
390
+ )
391
+ }
392
+ );
393
+ }, Xt = (o) => T[o] ?? T.default, zt = (o) => Nt[o];
394
+ function Vt(o, e) {
395
+ const r = [], a = new Date(o);
396
+ for (; a <= e; ) {
397
+ const n = a.getFullYear(), l = String(a.getMonth() + 1).padStart(2, "0");
398
+ r.push(+`${n}${l}`), a.setMonth(a.getMonth() + 1);
399
+ }
400
+ return r;
401
+ }
402
+ const qt = (o) => o.reduce((r, a) => {
403
+ const n = {
404
+ top_level_category_guid: a.top_level_category_guid,
405
+ category_guid: a.category_guid,
406
+ amount: a.total,
407
+ year_month: a.year_month
408
+ }, { top_level_category_guid: l, category_guid: c } = n;
409
+ return r[c] || (r[c] = []), r[c].push(n), l !== c && (r[l] || (r[l] = []), r[l].push(n)), r;
410
+ }, {}), De = (o, e, r) => {
411
+ const a = qt(o), n = Vt(e, r);
412
+ return Object.entries(a).map(([c, h]) => {
413
+ const m = h[0].top_level_category_guid, C = n.map((d) => {
414
+ const u = h.filter((p) => p.year_month === d).reduce((p, v) => p + Math.abs(v.amount), 0), f = Number(String(d).slice(0, 4)), y = Number(String(d).slice(4));
415
+ return { x: new Date(f, y - 1), y: u };
416
+ }).sort((d, u) => d.x.getTime() - u.x.getTime());
417
+ return {
418
+ top_level_category_guid: m,
419
+ category_guid: c,
420
+ category_name: zt(c),
421
+ category_color: Xt(m),
422
+ dataset: C
423
+ };
424
+ });
425
+ }, Le = (o, e) => {
426
+ const r = typeof o == "string" ? parseFloat(o.replace(/[^0-9.-]+/g, "")) : o, a = typeof e == "string" ? parseFloat(e.replace(/[^0-9.-]+/g, "")) : e;
427
+ return (r || 0) - (a || 0);
428
+ }, Jt = (o, e) => {
429
+ const r = o.subCategories.filter((l) => l.currentAmount !== 0), a = o.totalMonthlyAmounts.slice(-e), n = (l) => l.substring(0, 3) + " " + l.slice(-4);
430
+ return a.map((l) => {
431
+ const c = n(l.label), h = r.map((d) => {
432
+ const u = d.monthlyAmounts.slice(-e).find((f) => n(f.label) === c);
433
+ return {
434
+ label: d.name,
435
+ amount: Math.abs(u?.amount || 0),
436
+ header: c
437
+ };
438
+ }), m = o.monthlyAmounts.slice(-e).find((d) => n(d.label) === c);
439
+ return [{
440
+ label: o.name,
441
+ amount: Math.abs(m?.amount || 0),
442
+ header: c
443
+ }, ...h].sort((d, u) => u.amount - d.amount);
444
+ });
445
+ }, Kt = (o, e) => {
446
+ const r = o ? o.totalMonthlyAmounts.slice(-e).map((n) => ({
447
+ x: n.label.substring(0, 3),
448
+ y: Math.abs(n.amount)
449
+ })) : [], a = o ? Jt(o, e) : [];
450
+ return { monthlyAmounts: r, tooltipLabels: a };
451
+ }, Qt = (o) => o.slice().filter(
452
+ (e) => e.totalAmount !== 0 && e.isTransfer === !1 && e.guid !== It.INVESTMENTS
453
+ ).sort((e, r) => Math.abs(r.totalAmount) - Math.abs(e.totalAmount));
454
+ class Re {
455
+ globalStore;
456
+ selectedCategoryData = null;
457
+ selectedDateRange;
458
+ visibleListLength = 5;
459
+ constructor(e) {
460
+ this.globalStore = e, this.selectedDateRange = {
461
+ start: Ot(V(jt(/* @__PURE__ */ new Date(), 6)), 1),
462
+ end: V(/* @__PURE__ */ new Date())
463
+ }, Bt(this);
464
+ }
465
+ setSelectedCategoryData = (e) => {
466
+ this.selectedCategoryData = e;
467
+ };
468
+ setSelectedDateRange = (e) => {
469
+ this.selectedDateRange = e;
470
+ };
471
+ setVisibleListLength = (e) => {
472
+ this.visibleListLength = e;
473
+ };
474
+ get sortedDetailedCategoriesWithTransactions() {
475
+ return Qt(
476
+ this.globalStore.categoryStore.detailedCategoriesWithTransactions
477
+ );
478
+ }
479
+ get selectedDateRangeMonthCount() {
480
+ return $t(this.selectedDateRange.end, this.selectedDateRange.start) + 1;
481
+ }
482
+ get selectedDateRangeMonthRange() {
483
+ const e = L(this.selectedDateRange.start, R.MONTH_LONG), r = L(this.selectedDateRange.end, R.MONTH_LONG);
484
+ return `${e} - ${r}`;
485
+ }
486
+ get visibleCategories() {
487
+ return this.sortedDetailedCategoriesWithTransactions.slice(0, this.visibleListLength);
488
+ }
489
+ get collapsedCategories() {
490
+ return this.sortedDetailedCategoriesWithTransactions.slice(this.visibleListLength);
491
+ }
492
+ get categoryDetailsChartData() {
493
+ return Kt(
494
+ this.selectedCategoryData,
495
+ this.selectedDateRangeMonthCount
496
+ );
497
+ }
498
+ }
499
+ export {
500
+ Ae as S,
501
+ Re as T,
502
+ Le as a,
503
+ De as g,
504
+ Te as u
505
+ };
@@ -0,0 +1,6 @@
1
+ const e = {
2
+ featureVersion: "spendVsIncomeTrends"
3
+ };
4
+ export {
5
+ e as T
6
+ };
@@ -22,7 +22,7 @@ import { isWithinInterval as Q } from "date-fns/isWithinInterval";
22
22
  import nn from "@mui/material/styles/useTheme";
23
23
  import k from "@mui/material/ListItem";
24
24
  import an from "@mui/material/ListItemButton";
25
- import { e as tn } from "./hooks-DkUqN6JE.mjs";
25
+ import { g as tn } from "./hooks-DUeXom8C.mjs";
26
26
  const on = ({ copy: n, date: a, onNextClick: o, onPreviousClick: r }) => {
27
27
  const c = v(), l = en(c);
28
28
  return /* @__PURE__ */ h("div", { className: `mx-cmn-calendar-header ${l}`, children: [
@@ -12,7 +12,7 @@ import Y from "@mui/material/Stack";
12
12
  import { Icon as s, Text as z, DateRangePicker as q, H1 as se, H3 as le } from "@mxenabled/mxui";
13
13
  import { u as Ce } from "./useDimensions-27p2evRx.mjs";
14
14
  import { L as de } from "./Loader-DUaFpDGv.mjs";
15
- import { e as Te, a as Ie, u as Ee, W as Re } from "./hooks-DkUqN6JE.mjs";
15
+ import { g as Te, a as Ie, u as Ee, W as Re } from "./hooks-DUeXom8C.mjs";
16
16
  import { u as ae } from "./useScreenSize-B6JyS_Lj.mjs";
17
17
  import { addMonths as J } from "date-fns/addMonths";
18
18
  import { addDays as ge } from "date-fns/addDays";
@@ -35,7 +35,7 @@ import Oe from "@mui/material/ToggleButtonGroup";
35
35
  import fe from "@mui/material/styles/useTheme";
36
36
  import { f as K, D as G, a as be } from "./Dialog-CWW597AF.mjs";
37
37
  import { D as we } from "./Drawer-kEE73B87.mjs";
38
- import { i as Ke, j as Ge } from "./ConnectDrawer-phFH6OHt.mjs";
38
+ import { i as Ke, j as Ge } from "./ConnectDrawer-C2minBK_.mjs";
39
39
  const Me = {
40
40
  ACCOUNTS_CLICK_ACCOUNT: "accounts_widget_click_account",
41
41
  ACCOUNTS_CLICK_CONNECT: "accounts_widget_click_connect_accounts",
@@ -7,24 +7,24 @@ import E from "@mui/material/List";
7
7
  import T from "@mui/material/ListSubheader";
8
8
  import x from "@mui/system/Stack";
9
9
  import { Text as v } from "@mxenabled/mxui";
10
- import { A as G } from "../AccountDetailsContent-UxSEMBo_.mjs";
11
- import { u as O1 } from "../AccountDetailsContent-UxSEMBo_.mjs";
12
- import { u as K, A as z } from "../AccountDetailsHeader-Eb3WvBGm.mjs";
13
- import { A as W } from "../AccountListItem-B-ZjJ4Gp.mjs";
14
- import { u as g, a as y, c as O, e as N, m as P } from "../hooks-DkUqN6JE.mjs";
10
+ import { A as G } from "../AccountDetailsContent-bQKVSCZF.mjs";
11
+ import { u as O1 } from "../AccountDetailsContent-bQKVSCZF.mjs";
12
+ import { u as K, A as z } from "../AccountDetailsHeader-BGQAu0Xm.mjs";
13
+ import { A as W } from "../AccountListItem-wgvQjLxW.mjs";
14
+ import { u as g, a as y, c as O, g as N, l as P } from "../hooks-DUeXom8C.mjs";
15
15
  import { f as I } from "../NumberFormatting-CtWHhyBX.mjs";
16
16
  import { D as Y } from "../Drawer-kEE73B87.mjs";
17
- import { A, W as q } from "../WidgetContainer-CdBs9WOZ.mjs";
18
- import { C as J } from "../ConnectionsDrawer-ihxkAi1P.mjs";
17
+ import { A, W as q } from "../WidgetContainer-DK8aZO5l.mjs";
18
+ import { C as J } from "../ConnectionsDrawer-Cd4dZuWL.mjs";
19
19
  import { u as Q } from "../useScreenSize-B6JyS_Lj.mjs";
20
20
  import { L as R } from "../Loader-DUaFpDGv.mjs";
21
- import { j as D } from "../ConnectDrawer-phFH6OHt.mjs";
22
- import { F as I1, M as N1 } from "../ConnectDrawer-phFH6OHt.mjs";
21
+ import { j as D } from "../ConnectDrawer-C2minBK_.mjs";
22
+ import { F as I1, M as N1 } from "../ConnectDrawer-C2minBK_.mjs";
23
23
  import X from "@mui/material/ListItem";
24
- import { M as U } from "../MiniWidgetContainer-CTyjmE1h.mjs";
24
+ import { M as U } from "../MiniWidgetContainer-BlsgwNew.mjs";
25
25
  import e1 from "@mui/material/Stack";
26
- import { g as U1, a as j1 } from "../AccountFields-CIz-r3gP.mjs";
27
- import { A as G1, a as K1 } from "../AccountStore-BaMynkQT.mjs";
26
+ import { g as U1, a as j1 } from "../AccountFields-CC7kzfPK.mjs";
27
+ import { A as G1, a as K1 } from "../AccountStore-DpglOysH.mjs";
28
28
  const t1 = () => {
29
29
  const [c, L] = d.useState(""), { accounts: o } = g(), { selectedAccounts: l } = y(), { setSelectedAccount: u, setSelectedMember: r } = K(), { members: s } = O(), { onEvent: p } = N(), a = [...new Set(l.map((t) => t.account_type))], H = l.find((t) => c === t.guid), h = d.useMemo(
30
30
  () => l.filter((t) => t.is_hidden),
@@ -8,12 +8,12 @@ import a from "@mui/material/Stack";
8
8
  import _ from "@mui/material/styles/useTheme";
9
9
  import { Text as u, TextField as L } from "@mxenabled/mxui";
10
10
  import { L as W } from "../Loader-DUaFpDGv.mjs";
11
- import { M as j } from "../MiniWidgetContainer-CTyjmE1h.mjs";
12
- import { i as f, u as b, e as q, a as E } from "../hooks-DkUqN6JE.mjs";
11
+ import { M as j } from "../MiniWidgetContainer-BlsgwNew.mjs";
12
+ import { h as f, u as g, g as q, a as E } from "../hooks-DUeXom8C.mjs";
13
13
  import Q from "@mui/material/ToggleButton";
14
14
  import G from "@mui/material/ToggleButtonGroup";
15
15
  const O = () => {
16
- const { question: s, response: o, setResponse: i } = f(), { analytics: r } = b(), t = _(), p = s, m = (h, n) => {
16
+ const { question: s, response: o, setResponse: i } = f(), { analytics: r } = g(), t = _(), p = s, m = (h, n) => {
17
17
  i(n);
18
18
  };
19
19
  return /* @__PURE__ */ l(d.Fragment, { children: [
@@ -68,7 +68,7 @@ const O = () => {
68
68
  )
69
69
  ] });
70
70
  }, X = y(O), z = () => {
71
- const { response: s, setResponse: o } = f(), { analytics: i } = b();
71
+ const { response: s, setResponse: o } = f(), { analytics: i } = g();
72
72
  return /* @__PURE__ */ e(
73
73
  L,
74
74
  {
@@ -92,9 +92,9 @@ const O = () => {
92
92
  questionCount: h,
93
93
  response: n,
94
94
  responsePayload: k,
95
- resetStore: g,
95
+ resetStore: b,
96
96
  survey: w
97
- } = f(), { analytics: c, common: M } = b(), { isCopyLoaded: T, isInitialized: v } = E(), [x, C] = d.useState(!1);
97
+ } = f(), { analytics: c, common: M } = g(), { isCopyLoaded: T, isInitialized: v } = E(), [x, C] = d.useState(!1);
98
98
  d.useEffect(() => {
99
99
  v && m();
100
100
  }, [v]), d.useEffect(() => {
@@ -105,11 +105,11 @@ const O = () => {
105
105
  const $ = () => {
106
106
  s("survey dismissed", {
107
107
  $survey_id: i
108
- }), g(), C(!1);
108
+ }), b(), C(!1);
109
109
  }, F = () => {
110
110
  p();
111
111
  }, R = () => {
112
- s("survey sent", k), g(), C(!0);
112
+ s("survey sent", k), b(), C(!0);
113
113
  };
114
114
  return T ? !r && !x ? null : /* @__PURE__ */ l(
115
115
  j,
@@ -7,15 +7,15 @@ import W from "@mui/material/Box";
7
7
  import _ from "@mui/material/Stack";
8
8
  import Q from "@mui/material/styles/useTheme";
9
9
  import { Icon as $, Text as g, CategoryIcon as H, H1 as Ge, H3 as Be } from "@mxenabled/mxui";
10
- import { u as Pe } from "../BudgetUtil-CeSLAcsl.mjs";
11
- import { C as Ne } from "../ConnectionsDrawer-ihxkAi1P.mjs";
10
+ import { u as Pe } from "../BudgetUtil-gzgNEDE7.mjs";
11
+ import { C as Ne } from "../ConnectionsDrawer-Cd4dZuWL.mjs";
12
12
  import * as E from "d3";
13
13
  import je from "@mui/material/Tooltip";
14
- import { g as w, k as j, u as D, e as X, a as ee, p as ze, h as te, f as ne, m as Ue, c as Se } from "../hooks-DkUqN6JE.mjs";
14
+ import { e as w, j, u as D, g as X, a as ee, p as ze, f as te, n as ne, l as Ue, c as Se } from "../hooks-DUeXom8C.mjs";
15
15
  import { L as P } from "../Loader-DUaFpDGv.mjs";
16
16
  import { E as ce } from "../EmptyState-C0lr9E5T.mjs";
17
17
  import { u as me } from "../useScreenSize-B6JyS_Lj.mjs";
18
- import { A as k, W as Fe } from "../WidgetContainer-CdBs9WOZ.mjs";
18
+ import { A as k, W as Fe } from "../WidgetContainer-DK8aZO5l.mjs";
19
19
  import K from "@mui/material/List";
20
20
  import { f as T } from "../NumberFormatting-CtWHhyBX.mjs";
21
21
  import Ae from "@mui/material/Button";
@@ -27,26 +27,26 @@ import Z from "@mui/material/ListItemText";
27
27
  import { b as L } from "../Localization-2MODESHW.mjs";
28
28
  import { D as M } from "../Drawer-kEE73B87.mjs";
29
29
  import We from "@mui/material/ListItemSecondaryAction";
30
- import { C as He } from "../CurrencyInput-bEx2Mbd0.mjs";
30
+ import { C as He } from "../CurrencyInput-Dz4r9Rfe.mjs";
31
31
  import { a as N } from "../Dialog-CWW597AF.mjs";
32
- import { M as Xe } from "../MiniWidgetContainer-CTyjmE1h.mjs";
32
+ import { M as Xe } from "../MiniWidgetContainer-BlsgwNew.mjs";
33
33
  import { isAfter as Ke } from "date-fns/isAfter";
34
34
  import { startOfToday as q } from "date-fns/startOfToday";
35
35
  import Ve from "@mui/material/Alert";
36
36
  import Ye from "@mui/material/Snackbar";
37
37
  import be from "@mui/material/Tab";
38
38
  import Ze from "@mui/material/Tabs";
39
- import { e as qe } from "../exportTransactionsToCSV-BDlt8u0n.mjs";
40
- import { T as xe, a as Je } from "../TransactionDetails-C-z3HGTT.mjs";
39
+ import { e as qe } from "../exportTransactionsToCSV-Cf5VRYVr.mjs";
40
+ import { T as xe, a as Je } from "../TransactionDetails-BXl0m15s.mjs";
41
41
  import ge from "@mui/material/Card";
42
42
  import pe from "@mui/material/CardContent";
43
43
  import { S as ue } from "../StatusBar-BK_uYHAB.mjs";
44
44
  import { S as ve } from "../SingleSegmentDonut-BgbLgwHi.mjs";
45
- import { u as Qe, b as et } from "../CategorySelectorDrawer-BJ9jlCyt.mjs";
45
+ import { u as Qe, b as et } from "../CategorySelectorDrawer-LpZcwQPa.mjs";
46
46
  import Te from "@mui/material/CardHeader";
47
47
  import { subDays as tt } from "date-fns/subDays";
48
48
  import nt from "@mui/material/IconButton";
49
- import { M as ot } from "../ManageIncome-DbsiKUoO.mjs";
49
+ import { M as ot } from "../ManageIncome-BokhnWOn.mjs";
50
50
  const ye = 5, at = 100, rt = 25, st = (t) => {
51
51
  const o = (a) => {
52
52
  a.active || t.alphaTarget(0.3).restart(), a.subject.fx = a.subject.x, a.subject.fy = a.subject.y;