@mx-cartographer/experiences 6.26.33-alpha.mm0 → 7.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 (104) hide show
  1. package/CHANGELOG.md +2 -3
  2. package/dist/Account-DY6nxO7y.mjs +30 -0
  3. package/dist/AccountDetailsContent-DvPs81kL.mjs +677 -0
  4. package/dist/AccountDetailsHeader-W2U7ZVm_.mjs +119 -0
  5. package/dist/AccountFields-DAVcbZy5.mjs +135 -0
  6. package/dist/AccountListItem-DFlbdcmT.mjs +90 -0
  7. package/dist/AccountStore-CU7qV3vg.mjs +230 -0
  8. package/dist/Accounts-BLlrQA5m.mjs +9 -0
  9. package/dist/BeatApi-DLu87ijw.mjs +21 -0
  10. package/dist/BeatStore-By4aGoRM.mjs +81 -0
  11. package/dist/BudgetUtil-Ci1TN0J5.mjs +101 -0
  12. package/dist/CashflowStore-D9Dpuz7X.mjs +91 -0
  13. package/dist/Category-5S6uwuXz.mjs +301 -0
  14. package/dist/CategorySelectorDrawer-rHyHHYuh.mjs +397 -0
  15. package/dist/CategoryStore-B5EW6I1d.mjs +183 -0
  16. package/dist/CategoryUtil-DRyruNgi.mjs +78 -0
  17. package/dist/ConnectDrawer-D9cR5phc.mjs +508 -0
  18. package/dist/ConnectionsDrawer-BzGqljSp.mjs +52 -0
  19. package/dist/CurrencyInput-D74cemI2.mjs +83 -0
  20. package/dist/CurrencyText-YUhH2caW.mjs +20 -0
  21. package/dist/DateUtil-BcuH7ErC.mjs +48 -0
  22. package/dist/DebtsStore-S0l9kr0r.mjs +60 -0
  23. package/dist/Dialog-CWW597AF.mjs +123 -0
  24. package/dist/Donut-1UMNcG67.mjs +57 -0
  25. package/dist/Drawer-kEE73B87.mjs +113 -0
  26. package/dist/EmptyState-Dcb-o2tl.mjs +55 -0
  27. package/dist/Fetch-CkFKy79O.mjs +116 -0
  28. package/dist/FinstrongStore-mkALvztw.mjs +101 -0
  29. package/dist/GoalStore-DioeeL-s.mjs +263 -0
  30. package/dist/HeaderCell-DjuifqHJ.mjs +6 -0
  31. package/dist/Help-DhcC-C05.mjs +320 -0
  32. package/dist/Help-DpYRO8oA.mjs +3181 -0
  33. package/dist/IconBacking-B9oC6uL2.mjs +39 -0
  34. package/dist/InvestmentUtil-jOyOgzIB.mjs +134 -0
  35. package/dist/LineChart-CcyX38kK.mjs +499 -0
  36. package/dist/ListItemAction-BabpYivr.mjs +69 -0
  37. package/dist/Loader-Dp1P2gNw.mjs +14 -0
  38. package/dist/Localization-2MODESHW.mjs +30 -0
  39. package/dist/ManageIncome-ndMuhJMG.mjs +535 -0
  40. package/dist/MerchantStore-DVH-QOf0.mjs +37 -0
  41. package/dist/MicroWidgetContainer-CsvHLYKX.mjs +45 -0
  42. package/dist/MiniWidgetContainer-BoOp-A05.mjs +39 -0
  43. package/dist/NetWorthStore-PD-RUe09.mjs +150 -0
  44. package/dist/Notification-AMGWM1Al.mjs +78 -0
  45. package/dist/NotificationSettings-VhHuMAFU.mjs +667 -0
  46. package/dist/NotificationStore-DHtSGySy.mjs +67 -0
  47. package/dist/NumberFormatting-CtWHhyBX.mjs +40 -0
  48. package/dist/OriginalBalanceAction-D39mx6uE.mjs +115 -0
  49. package/dist/RecurringSettings-D_HnMYZP.mjs +57 -0
  50. package/dist/RecurringTransactionsStore-BKLD3OWo.mjs +263 -0
  51. package/dist/RepeatingTransaction-BPWfaB3f.mjs +282 -0
  52. package/dist/SearchBox-B2_zLv8-.mjs +42 -0
  53. package/dist/SettingsStore-CE7jDVFL.mjs +265 -0
  54. package/dist/SingleSegmentDonut-BgbLgwHi.mjs +69 -0
  55. package/dist/SpendingData-BkrxzHdr.mjs +55 -0
  56. package/dist/StatusBar-BK_uYHAB.mjs +30 -0
  57. package/dist/TabContentContainer-j01JYR_7.mjs +21 -0
  58. package/dist/Transaction-CA0FW2Ij.mjs +312 -0
  59. package/dist/TransactionApi-DbbcjI2L.mjs +86 -0
  60. package/dist/TransactionDetails-WBHFmbxL.mjs +1283 -0
  61. package/dist/TransactionStore-CeLdmVnC.mjs +669 -0
  62. package/dist/TrendsStore-BHJUapXF.mjs +487 -0
  63. package/dist/ViewMoreMicroCard-CAPFNz-J.mjs +1959 -0
  64. package/dist/WidgetContainer-DWCusxYI.mjs +556 -0
  65. package/dist/accounts/index.es.js +752 -0
  66. package/dist/analytics/index.es.js +171 -0
  67. package/dist/budgets/index.es.js +1075 -0
  68. package/dist/cashflow/index.es.js +1098 -0
  69. package/dist/categories/index.es.js +9 -0
  70. package/dist/common/components/WidgetContainer.d.ts +1 -1
  71. package/dist/common/components/charts/LineChart.d.ts +0 -1
  72. package/dist/common/constants/Analytics.d.ts +10 -20
  73. package/dist/common/context/hooks.d.ts +13 -13
  74. package/dist/common/index.es.js +1451 -0
  75. package/dist/dashboard/index.es.js +181 -0
  76. package/dist/debts/index.es.js +1460 -0
  77. package/dist/exportTransactionsToCSV-CmwsKl2D.mjs +47 -0
  78. package/dist/finstrong/index.es.js +1455 -0
  79. package/dist/goals/index.es.js +1209 -0
  80. package/dist/help/components/content/section/index.d.ts +15 -15
  81. package/dist/help/index.es.js +14 -0
  82. package/dist/hooks-30y_BLwc.mjs +71 -0
  83. package/dist/index.d.ts +0 -22
  84. package/dist/insights/index.d.ts +1 -0
  85. package/dist/insights/index.es.js +4 -0
  86. package/dist/investments/index.es.js +1638 -0
  87. package/dist/merchants/index.es.js +79 -0
  88. package/dist/microinsights/components/carouselheader/CarouselHeader.d.ts +0 -1
  89. package/dist/microinsights/components/microBeatCarousel/MicroBeatCarousel.d.ts +0 -1
  90. package/dist/microinsights/index.es.js +16 -0
  91. package/dist/networth/index.es.js +576 -0
  92. package/dist/notifications/index.es.js +192 -0
  93. package/dist/recurringtransactions/index.es.js +879 -0
  94. package/dist/settings/index.es.js +879 -0
  95. package/dist/spending/index.es.js +570 -0
  96. package/dist/transactions/index.es.js +587 -0
  97. package/dist/trends/index.es.js +1086 -0
  98. package/dist/useCombineEvents-DaDBSR_1.mjs +92 -0
  99. package/dist/useDimensions-27p2evRx.mjs +36 -0
  100. package/dist/useScreenSize-B6JyS_Lj.mjs +36 -0
  101. package/package.json +155 -3
  102. package/dist/index.es.js +0 -30564
  103. package/dist/index.es.js.map +0 -1
  104. package/dist/trends/constants/TrendsWidget.d.ts +0 -3
@@ -0,0 +1,487 @@
1
+ import _, { useState as q, useEffect as J, useRef as vt } from "react";
2
+ import { l as St, u as xt, k as K } from "./hooks-30y_BLwc.mjs";
3
+ import { jsxs as S, jsx as i } from "react/jsx-runtime";
4
+ import D 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 Dt from "@mui/material/Card";
12
+ import At 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 A } 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 It from "@mui/material/Button";
21
+ import { a as T, c as wt, C as Nt } from "./Category-5S6uwuXz.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
+ D,
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(A, { 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
+ Dt,
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(At, { children: [
76
+ /* @__PURE__ */ S(D, { alignItems: "center", display: "flex", flexDirection: "column", children: [
77
+ /* @__PURE__ */ i(Z, { categoryGuid: o, topLevelCategoryGuid: e }),
78
+ /* @__PURE__ */ i(A, { 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(D, { alignItems: "center", display: "flex", flexDirection: "column", children: [
85
+ /* @__PURE__ */ i(A, { 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(A, { 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
+ It,
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
+ D,
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(A, { variant: "Body", children: h(m) })
163
+ ]
164
+ },
165
+ m
166
+ );
167
+ })
168
+ }
169
+ );
170
+ }, De = ({
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, I = [...n, ...l], ot = I[0]?.dataset.length ?? 0, w = I.flatMap((t) => t.dataset.map((s) => s.x)), rt = I.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: w[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(D, { onMouseMove: ht, ref: f, style: { position: "relative" }, children: /* @__PURE__ */ S(
298
+ O,
299
+ {
300
+ direction: { xs: "column", md: "column" },
301
+ spacing: { xs: 0, md: 4 },
302
+ sx: { width: "100%", position: "relative" },
303
+ children: [
304
+ /* @__PURE__ */ i(
305
+ _t,
306
+ {
307
+ height: y,
308
+ margin: { bottom: 50 },
309
+ onAreaClick: gt,
310
+ onHighlightChange: mt,
311
+ series: Y,
312
+ skipAnimation: !0,
313
+ slotProps: {
314
+ legend: {
315
+ hidden: !0
316
+ }
317
+ },
318
+ slots: {
319
+ itemContent: (t) => W && M ? /* @__PURE__ */ i(
320
+ Yt,
321
+ {
322
+ categoryGuids: G(M),
323
+ xData: w,
324
+ ...t
325
+ }
326
+ ) : null
327
+ },
328
+ sx: pt,
329
+ tooltip: {
330
+ trigger: W ? "item" : "none"
331
+ },
332
+ xAxis: [
333
+ {
334
+ data: w,
335
+ scaleType: "time",
336
+ valueFormatter: (t) => L(t, R.MONTH_SHORT_YEAR),
337
+ tickNumber: ot
338
+ // How many ticks to show on the x-axis
339
+ }
340
+ ],
341
+ yAxis: [
342
+ {
343
+ min: it,
344
+ max: lt || 100
345
+ }
346
+ ]
347
+ }
348
+ ),
349
+ /* @__PURE__ */ i(
350
+ Pt,
351
+ {
352
+ categoryGuids: ct,
353
+ hoveredLegend: p,
354
+ legendRef: d,
355
+ onClickLegend: ut,
356
+ onHoverLegend: dt,
357
+ sx: { px: C ? 0 : 24 }
358
+ }
359
+ ),
360
+ j && /* @__PURE__ */ i(
361
+ Ft,
362
+ {
363
+ categoryGuids: G(M),
364
+ chartContainerRef: f,
365
+ cursorPosition: E,
366
+ hoveredAreaData: $.map((t) => ({
367
+ ...t,
368
+ x: L(t.x, R.MONTH_SHORT_YEAR)
369
+ }))
370
+ }
371
+ )
372
+ ]
373
+ }
374
+ ) });
375
+ }, Xt = (o) => T[o] ?? T.default, zt = (o) => Nt[o];
376
+ function Vt(o, e) {
377
+ const r = [], a = new Date(o);
378
+ for (; a <= e; ) {
379
+ const n = a.getFullYear(), l = String(a.getMonth() + 1).padStart(2, "0");
380
+ r.push(+`${n}${l}`), a.setMonth(a.getMonth() + 1);
381
+ }
382
+ return r;
383
+ }
384
+ const qt = (o) => o.reduce((r, a) => {
385
+ const n = {
386
+ top_level_category_guid: a.top_level_category_guid,
387
+ category_guid: a.category_guid,
388
+ amount: a.total,
389
+ year_month: a.year_month
390
+ }, { top_level_category_guid: l, category_guid: c } = n;
391
+ return r[c] || (r[c] = []), r[c].push(n), l !== c && (r[l] || (r[l] = []), r[l].push(n)), r;
392
+ }, {}), Ae = (o, e, r) => {
393
+ const a = qt(o), n = Vt(e, r);
394
+ return Object.entries(a).map(([c, h]) => {
395
+ const m = h[0].top_level_category_guid, C = n.map((d) => {
396
+ 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));
397
+ return { x: new Date(f, y - 1), y: u };
398
+ }).sort((d, u) => d.x.getTime() - u.x.getTime());
399
+ return {
400
+ top_level_category_guid: m,
401
+ category_guid: c,
402
+ category_name: zt(c),
403
+ category_color: Xt(m),
404
+ dataset: C
405
+ };
406
+ });
407
+ }, Le = (o, e) => {
408
+ const r = typeof o == "string" ? parseFloat(o.replace(/[^0-9.-]+/g, "")) : o, a = typeof e == "string" ? parseFloat(e.replace(/[^0-9.-]+/g, "")) : e;
409
+ return (r || 0) - (a || 0);
410
+ }, Jt = (o, e) => {
411
+ const r = o.subCategories.filter((l) => l.currentAmount !== 0), a = o.totalMonthlyAmounts.slice(-e), n = (l) => l.substring(0, 3) + " " + l.slice(-4);
412
+ return a.map((l) => {
413
+ const c = n(l.label), h = r.map((d) => {
414
+ const u = d.monthlyAmounts.slice(-e).find((f) => n(f.label) === c);
415
+ return {
416
+ label: d.name,
417
+ amount: Math.abs(u?.amount || 0),
418
+ header: c
419
+ };
420
+ }), m = o.monthlyAmounts.slice(-e).find((d) => n(d.label) === c);
421
+ return [{
422
+ label: o.name,
423
+ amount: Math.abs(m?.amount || 0),
424
+ header: c
425
+ }, ...h].sort((d, u) => u.amount - d.amount);
426
+ });
427
+ }, Kt = (o, e) => {
428
+ const r = o ? o.totalMonthlyAmounts.slice(-e).map((n) => ({
429
+ x: n.label.substring(0, 3),
430
+ y: Math.abs(n.amount)
431
+ })) : [], a = o ? Jt(o, e) : [];
432
+ return { monthlyAmounts: r, tooltipLabels: a };
433
+ }, Qt = (o) => o.slice().filter(
434
+ (e) => e.totalAmount !== 0 && e.isTransfer === !1 && e.guid !== wt.INVESTMENTS
435
+ ).sort((e, r) => Math.abs(r.totalAmount) - Math.abs(e.totalAmount));
436
+ class Re {
437
+ globalStore;
438
+ selectedCategoryData = null;
439
+ selectedDateRange;
440
+ visibleListLength = 5;
441
+ constructor(e) {
442
+ this.globalStore = e, this.selectedDateRange = {
443
+ start: Ot(V(jt(/* @__PURE__ */ new Date(), 6)), 1),
444
+ end: V(/* @__PURE__ */ new Date())
445
+ }, Bt(this);
446
+ }
447
+ setSelectedCategoryData = (e) => {
448
+ this.selectedCategoryData = e;
449
+ };
450
+ setSelectedDateRange = (e) => {
451
+ this.selectedDateRange = e;
452
+ };
453
+ setVisibleListLength = (e) => {
454
+ this.visibleListLength = e;
455
+ };
456
+ get sortedDetailedCategoriesWithTransactions() {
457
+ return Qt(
458
+ this.globalStore.categoryStore.detailedCategoriesWithTransactions
459
+ );
460
+ }
461
+ get selectedDateRangeMonthCount() {
462
+ return $t(this.selectedDateRange.end, this.selectedDateRange.start) + 1;
463
+ }
464
+ get selectedDateRangeMonthRange() {
465
+ const e = L(this.selectedDateRange.start, R.MONTH_LONG), r = L(this.selectedDateRange.end, R.MONTH_LONG);
466
+ return `${e} - ${r}`;
467
+ }
468
+ get visibleCategories() {
469
+ return this.sortedDetailedCategoriesWithTransactions.slice(0, this.visibleListLength);
470
+ }
471
+ get collapsedCategories() {
472
+ return this.sortedDetailedCategoriesWithTransactions.slice(this.visibleListLength);
473
+ }
474
+ get categoryDetailsChartData() {
475
+ return Kt(
476
+ this.selectedCategoryData,
477
+ this.selectedDateRangeMonthCount
478
+ );
479
+ }
480
+ }
481
+ export {
482
+ De as S,
483
+ Re as T,
484
+ Le as a,
485
+ Ae as g,
486
+ Te as u
487
+ };