@mx-cartographer/experiences 7.2.15-alpha.sms3 → 7.2.16-alpha.mm0

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.
@@ -1,142 +1,142 @@
1
- import { jsxs as h, jsx as t, Fragment as mt } from "react/jsx-runtime";
1
+ import { jsxs as h, jsx as t, Fragment as ht } from "react/jsx-runtime";
2
2
  import p from "react";
3
- import { observer as v } from "mobx-react-lite";
4
- import { startOfMonth as nt } from "date-fns/startOfMonth";
5
- import { endOfMonth as ot } from "date-fns/endOfMonth";
6
- import x from "@mui/material/Box";
3
+ import { observer as I } from "mobx-react-lite";
4
+ import { startOfMonth as ot } from "date-fns/startOfMonth";
5
+ import { endOfMonth as at } from "date-fns/endOfMonth";
6
+ import w from "@mui/material/Box";
7
7
  import C from "@mui/material/Stack";
8
- import N from "@mui/material/Tab";
9
- import at from "@mui/material/Tabs";
10
- import ht from "@mui/material/styles/useTheme";
8
+ import L from "@mui/material/Tab";
9
+ import it from "@mui/material/Tabs";
10
+ import ft from "@mui/material/styles/useTheme";
11
11
  import { b as V } from "../CategoryUtil-BR3H5i6n.mjs";
12
- import { b as S } from "../Category-CevNQ03n.mjs";
13
- import { Text as y, CategoryIcon as ft, CategoryIconVariants as yt } from "@mxenabled/mxui";
14
- import { f as w } from "../NumberFormatting-Buh7u8Oi.mjs";
15
- import { u as bt } from "../useAriaLive-B3_pRUio.mjs";
16
- import Ct from "@mui/material/Button";
17
- import { useTheme as it } from "@mui/material";
18
- import { u as I, b as R, m as z, d as rt, a as st, h as _t, g as St } from "../hooks-D6XlXHf4.mjs";
19
- import { u as lt } from "../useScreenSize-B6JyS_Lj.mjs";
20
- import { D as Tt } from "../Donut-oaQFlbit.mjs";
12
+ import { b as _ } from "../Category-CevNQ03n.mjs";
13
+ import { Text as y, CategoryIcon as yt, CategoryIconVariants as bt } from "@mxenabled/mxui";
14
+ import { f as v } from "../NumberFormatting-Buh7u8Oi.mjs";
15
+ import { u as Ct } from "../useAriaLive-B3_pRUio.mjs";
16
+ import _t from "@mui/material/Button";
17
+ import { useTheme as rt } from "@mui/material";
18
+ import { u as E, b as O, m as z, d as st, n as St, a as lt, h as Tt, g as Mt } from "../hooks-D6XlXHf4.mjs";
19
+ import { u as ct } from "../useScreenSize-B6JyS_Lj.mjs";
20
+ import { D as Dt } from "../Donut-oaQFlbit.mjs";
21
21
  import { L as F } from "../Loader-DUaFpDGv.mjs";
22
- import { M as Mt } from "../MiniWidgetContainer-D0gfmbaF.mjs";
23
- import { startOfToday as U } from "date-fns/startOfToday";
24
- import { T as Dt, a as xt } from "../TransactionDetails-BqCr2FTh.mjs";
25
- import wt from "@mui/material/Collapse";
22
+ import { M as xt } from "../MiniWidgetContainer-D0gfmbaF.mjs";
23
+ import { startOfToday as q } from "date-fns/startOfToday";
24
+ import { T as wt, a as vt } from "../TransactionDetails-CDtya0KS.mjs";
25
+ import It from "@mui/material/Collapse";
26
26
  import B from "@mui/material/Divider";
27
- import q from "@mui/material/List";
28
- import J from "@mui/material/ListItem";
29
- import vt from "@mui/material/ListItemButton";
30
- import { D as Q } from "../Drawer-kEE73B87.mjs";
31
- import { A as Z, W as It } from "../WidgetContainer-EbrN1oIo.mjs";
32
- const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
33
- if (a.total > 0) {
34
- const i = n.find((s) => s.guid === a.category_guid);
35
- if (!i) return l;
36
- const o = i.parent_guid ?? i.guid, e = n.find((s) => s.guid === o);
27
+ import J from "@mui/material/List";
28
+ import Q from "@mui/material/ListItem";
29
+ import Et from "@mui/material/ListItemButton";
30
+ import { D as Z } from "../Drawer-kEE73B87.mjs";
31
+ import { A as tt, W as At } from "../WidgetContainer-EbrN1oIo.mjs";
32
+ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
33
+ if (n.total > 0) {
34
+ const a = o.find((s) => s.guid === n.category_guid);
35
+ if (!a) return l;
36
+ const i = a.parent_guid ?? a.guid, e = o.find((s) => s.guid === i);
37
37
  if (!e) return l;
38
- const d = {
39
- guid: i.guid,
40
- name: i.guid === o ? `General ${i.name}` : i.name,
41
- color: V(e.guid, c),
42
- amount: a.total
43
- }, u = l.find((s) => s.guid === o);
44
- u ? (u.amount += a.total, u.categoryTotals?.push(d)) : l.push({
45
- guid: o,
38
+ const c = {
39
+ guid: a.guid,
40
+ name: a.guid === i ? `General ${a.name}` : a.name,
41
+ color: V(e.guid, d),
42
+ amount: n.total
43
+ }, u = l.find((s) => s.guid === i);
44
+ u ? (u.amount += n.total, u.categoryTotals?.push(c)) : l.push({
45
+ guid: i,
46
46
  name: e.name,
47
- color: V(e.guid, c),
48
- categoryTotals: [d],
49
- amount: a.total
47
+ color: V(e.guid, d),
48
+ categoryTotals: [c],
49
+ amount: n.total
50
50
  });
51
51
  }
52
52
  return l;
53
- }, []), ct = (n, c, r, l) => {
54
- const a = Et(n, r, l), i = a.filter(
55
- (s) => s.guid !== S.INCOME && s.guid !== S.INVESTMENTS && s.guid !== S.TRANSFER
56
- ).sort((s, m) => m.amount - s.amount), o = i.reduce(
53
+ }, []), dt = (o, d, r, l) => {
54
+ const n = Lt(o, r, l), a = n.filter(
55
+ (s) => s.guid !== _.INCOME && s.guid !== _.INVESTMENTS && s.guid !== _.TRANSFER
56
+ ).sort((s, m) => m.amount - s.amount), i = a.reduce(
57
57
  (s, m) => s + m.amount,
58
58
  0
59
- ), e = i.length > j ? j : i.length, d = i.slice(0, e), u = d.map((s) => ({
59
+ ), e = a.length > j ? j : a.length, c = a.slice(0, e), u = c.map((s) => ({
60
60
  id: s.guid,
61
61
  color: V(s.guid, r),
62
62
  label: s.name,
63
- value: s.amount / o * 100
63
+ value: s.amount / i * 100
64
64
  }));
65
- if (i.length > 5) {
66
- const s = i.slice(j, a.length), m = s.reduce(
67
- (T, g) => T + g.amount,
65
+ if (a.length > 5) {
66
+ const s = a.slice(j, n.length), m = s.reduce(
67
+ (S, g) => S + g.amount,
68
68
  0
69
69
  );
70
- d.push({
70
+ c.push({
71
71
  guid: "other",
72
72
  color: r.palette.categories.others || "",
73
- name: c.saving_goal_other,
73
+ name: d.saving_goal_other,
74
74
  categoryTotals: s,
75
75
  amount: m
76
76
  }), u.push({
77
77
  id: "other",
78
78
  color: r.palette.categories.others || "",
79
- label: c.saving_goal_other,
80
- value: m / o * 100
79
+ label: d.saving_goal_other,
80
+ value: m / i * 100
81
81
  });
82
82
  }
83
83
  return {
84
- categoryData: d,
84
+ categoryData: c,
85
85
  donutData: u,
86
- totalAmount: o
86
+ totalAmount: i
87
87
  };
88
- }, dt = (n, c, r) => {
89
- const l = n.filter(
90
- (e) => e.guid === S.INCOME || e.parent_guid === S.INCOME
91
- ), a = c.filter((e) => l.some((d) => d.guid === e.category_guid)).sort((e, d) => e.total - d.total).map((e, d) => ({
88
+ }, gt = (o, d, r) => {
89
+ const l = o.filter(
90
+ (e) => e.guid === _.INCOME || e.parent_guid === _.INCOME
91
+ ), n = d.filter((e) => l.some((c) => c.guid === e.category_guid)).sort((e, c) => e.total - c.total).map((e, c) => ({
92
92
  guid: e.category_guid,
93
- name: n.find((u) => u.guid === e.category_guid)?.name,
94
- color: r[d],
93
+ name: o.find((u) => u.guid === e.category_guid)?.name,
94
+ color: r[c],
95
95
  categoryTotals: [],
96
96
  amount: Math.abs(e.total)
97
- })), i = a.reduce(
98
- (e, d) => e + d.amount,
97
+ })), a = n.reduce(
98
+ (e, c) => e + c.amount,
99
99
  0
100
- ), o = a.map((e) => ({
100
+ ), i = n.map((e) => ({
101
101
  id: e.guid,
102
102
  color: e.color,
103
103
  label: e.name,
104
- value: e.amount / i * 100
104
+ value: e.amount / a * 100
105
105
  }));
106
106
  return {
107
- categoryData: a,
108
- donutData: o,
109
- totalAmount: i
107
+ categoryData: n,
108
+ donutData: i,
109
+ totalAmount: a
110
110
  };
111
- }, W = ({ amount: n, label: c }) => /* @__PURE__ */ h(C, { direction: "column", children: [
112
- /* @__PURE__ */ t(y, { bold: !0, sx: { textTransform: "none" }, variant: "Body", children: c }),
113
- /* @__PURE__ */ t(y, { variant: "XSmall", children: w(n, "0,0") })
114
- ] }), At = ({
115
- data: n,
116
- isIncome: c = !1,
111
+ }, N = ({ amount: o, label: d }) => /* @__PURE__ */ h(C, { direction: "column", children: [
112
+ /* @__PURE__ */ t(y, { bold: !0, sx: { textTransform: "none" }, variant: "Body", children: d }),
113
+ /* @__PURE__ */ t(y, { variant: "XSmall", children: v(o, "0,0") })
114
+ ] }), Nt = ({
115
+ data: o,
116
+ isIncome: d = !1,
117
117
  onSelected: r,
118
118
  onViewTransactions: l,
119
- selectedId: a,
120
- size: i = 150,
121
- totalLabel: o,
119
+ selectedId: n,
120
+ size: a = 150,
121
+ totalLabel: i,
122
122
  variant: e = "mini"
123
123
  }) => {
124
- const { spending: d } = I(), u = it(), { isTablet: s } = lt(), { announce: m, ariaLive: T } = bt(), g = p.useMemo(
125
- () => a ? n.categoryData.find((D) => D.guid === a) : void 0,
126
- [a]
124
+ const { spending: c } = E(), u = rt(), { isTablet: s } = ct(), { announce: m, ariaLive: S } = Ct(), g = p.useMemo(
125
+ () => n ? o.categoryData.find((b) => b.guid === n) : void 0,
126
+ [n]
127
127
  );
128
128
  p.useEffect(() => {
129
129
  if (g) {
130
- const D = w(g.amount, "0,0");
131
- m(`${g.name}: ${D}`);
130
+ const b = v(g.amount, "0,0");
131
+ m(`${g.name}: ${b}`);
132
132
  }
133
133
  }, [g, m]);
134
- const b = p.useMemo(() => n.donutData.length > 0 ? n.donutData : [{ id: "0", color: u.palette.divider, value: 100 }], [n, u]), E = () => {
135
- l?.(a);
136
- }, _ = s ? 32 : 48;
137
- return /* @__PURE__ */ h(mt, { children: [
138
- T,
139
- /* @__PURE__ */ t(Tt, { data: b, onClick: r, selectedId: a, size: i, children: /* @__PURE__ */ t(C, { alignItems: "center", height: "100%", justifyContent: "center", width: "100%", children: /* @__PURE__ */ h(C, { alignItems: "center", justifyContent: "center", minHeight: i, minWidth: i, children: [
134
+ const T = p.useMemo(() => o.donutData.length > 0 ? o.donutData : [{ id: "0", color: u.palette.divider, value: 100 }], [o, u]), x = () => {
135
+ l?.(n);
136
+ }, D = s ? 32 : 48;
137
+ return /* @__PURE__ */ h(ht, { children: [
138
+ S,
139
+ /* @__PURE__ */ t(Dt, { data: T, onClick: r, selectedId: n, size: a, children: /* @__PURE__ */ t(C, { alignItems: "center", height: "100%", justifyContent: "center", width: "100%", children: /* @__PURE__ */ h(C, { alignItems: "center", justifyContent: "center", minHeight: a, minWidth: a, children: [
140
140
  g && /* @__PURE__ */ h(
141
141
  C,
142
142
  {
@@ -147,11 +147,11 @@ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
147
147
  sx: e === "mini" ? { gap: 0, mb: 0 } : { gap: { xs: 4, xl: 8 }, mb: { xs: 4, xl: 8 } },
148
148
  children: [
149
149
  /* @__PURE__ */ t(
150
- ft,
150
+ yt,
151
151
  {
152
- categoryGuid: c ? S.INCOME : g.guid,
153
- size: e === "mini" ? 24 : _,
154
- variant: yt.Transparent
152
+ categoryGuid: d ? _.INCOME : g.guid,
153
+ size: e === "mini" ? 24 : D,
154
+ variant: bt.Transparent
155
155
  }
156
156
  ),
157
157
  /* @__PURE__ */ t(
@@ -160,103 +160,103 @@ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
160
160
  color: "secondary",
161
161
  noWrap: !0,
162
162
  variant: e === "mini" ? "Tiny" : "Body",
163
- children: g ? g.name : o
163
+ children: g ? g.name : i
164
164
  }
165
165
  )
166
166
  ]
167
167
  }
168
168
  ),
169
- !g && e === "full" && /* @__PURE__ */ t(y, { bold: !0, color: "secondary", sx: { mb: { xs: 4, xl: 8 } }, children: o }),
170
- /* @__PURE__ */ t(y, { variant: e === "mini" ? "H2" : "H1", children: g ? w(g.amount, "0,0") : w(n.totalAmount, "0,0") }),
171
- !g && e === "mini" && /* @__PURE__ */ t(y, { color: "secondary", noWrap: !0, variant: "Tiny", children: o }),
169
+ !g && e === "full" && /* @__PURE__ */ t(y, { bold: !0, color: "secondary", sx: { mb: { xs: 4, xl: 8 } }, children: i }),
170
+ /* @__PURE__ */ t(y, { variant: e === "mini" ? "H2" : "H1", children: g ? v(g.amount, "0,0") : v(o.totalAmount, "0,0") }),
171
+ !g && e === "mini" && /* @__PURE__ */ t(y, { color: "secondary", noWrap: !0, variant: "Tiny", children: i }),
172
172
  e === "full" && /* @__PURE__ */ t(
173
- Ct,
173
+ _t,
174
174
  {
175
175
  "aria-label": `View ${g?.name || ""} Transactions`,
176
- disabled: n.categoryData.length === 0,
177
- onClick: E,
176
+ disabled: o.categoryData.length === 0,
177
+ onClick: x,
178
178
  sx: { mt: { xl: 4, xs: 0 }, zIndex: 1 },
179
179
  variant: "text",
180
- children: d.view_transactions
180
+ children: c.view_transactions
181
181
  }
182
182
  )
183
183
  ] }) }) })
184
184
  ] });
185
- }, O = v(At), tt = ({ data: n, onSelected: c, selectedId: r }) => {
186
- const l = (a, i) => {
187
- (a.key === "Enter" || a.key === " ") && (a.preventDefault(), c(i));
185
+ }, W = I(Nt), et = ({ data: o, onSelected: d, selectedId: r }) => {
186
+ const l = (n, a) => {
187
+ (n.key === "Enter" || n.key === " ") && (n.preventDefault(), d(a));
188
188
  };
189
- return /* @__PURE__ */ t(C, { gap: 8, height: "100%", justifyContent: "center", my: "auto", children: n.categoryData.map((a) => /* @__PURE__ */ h(
189
+ return /* @__PURE__ */ t(C, { gap: 8, height: "100%", justifyContent: "center", my: "auto", children: o.categoryData.map((n) => /* @__PURE__ */ h(
190
190
  C,
191
191
  {
192
192
  alignItems: "center",
193
- "aria-label": a.name,
194
- "aria-pressed": a.guid === r,
193
+ "aria-label": n.name,
194
+ "aria-pressed": n.guid === r,
195
195
  direction: "row",
196
196
  gap: 8,
197
- onClick: () => c(a.guid),
198
- onKeyDown: (i) => l(i, a.guid),
197
+ onClick: () => d(n.guid),
198
+ onKeyDown: (a) => l(a, n.guid),
199
199
  role: "button",
200
200
  sx: { cursor: "pointer" },
201
201
  tabIndex: 0,
202
202
  children: [
203
- /* @__PURE__ */ t(x, { borderRadius: 4, height: 8, sx: { backgroundColor: a.color }, width: 8 }),
204
- /* @__PURE__ */ t(y, { bold: a.guid === r, variant: "XSmall", children: a.name })
203
+ /* @__PURE__ */ t(w, { borderRadius: 4, height: 8, sx: { backgroundColor: n.color }, width: 8 }),
204
+ /* @__PURE__ */ t(y, { bold: n.guid === r, variant: "XSmall", children: n.name })
205
205
  ]
206
206
  },
207
- a.guid
207
+ n.guid
208
208
  )) });
209
- }, Lt = () => {
210
- const n = ht(), { goals: c, spending: r } = I(), { selectedAccounts: l } = R(), {
211
- categories: a,
212
- dateRangeCategoryTotals: i,
213
- dataRangeTotalsLoaded: o,
209
+ }, Wt = () => {
210
+ const o = ft(), { goals: d, spending: r } = E(), { selectedAccounts: l } = O(), {
211
+ categories: n,
212
+ dateRangeCategoryTotals: a,
213
+ dataRangeTotalsLoaded: i,
214
214
  loadDateRangeCategoryTotals: e
215
- } = z(), d = p.useMemo(
215
+ } = z(), c = p.useMemo(
216
216
  () => [
217
- n.palette.chartMono.chartMono5,
218
- n.palette.chartMono.chartMono4,
219
- n.palette.chartMono.chartMono3,
220
- n.palette.chartMono.chartMono2,
221
- n.palette.chartMono.chartMono1,
222
- n.palette.chartMono.chartMono6
217
+ o.palette.chartMono.chartMono5,
218
+ o.palette.chartMono.chartMono4,
219
+ o.palette.chartMono.chartMono3,
220
+ o.palette.chartMono.chartMono2,
221
+ o.palette.chartMono.chartMono1,
222
+ o.palette.chartMono.chartMono6
223
223
  ],
224
- [n]
224
+ [o]
225
225
  );
226
226
  p.useEffect(() => {
227
227
  e(
228
228
  l,
229
- nt(/* @__PURE__ */ new Date()),
230
- ot(/* @__PURE__ */ new Date())
229
+ ot(/* @__PURE__ */ new Date()),
230
+ at(/* @__PURE__ */ new Date())
231
231
  ).finally();
232
232
  }, [l]);
233
- const [u, s] = p.useState(""), [m, T] = p.useState(0), g = p.useMemo(
234
- () => ct(a, c, n, i),
235
- [a, i]
236
- ), b = p.useMemo(
237
- () => dt(a, i, d),
238
- [a, i, d]
239
- ), E = (D, L) => {
240
- T(L), s("");
241
- }, _ = (D) => {
242
- s(u === D ? "" : D);
233
+ const [u, s] = p.useState(""), [m, S] = p.useState(0), g = p.useMemo(
234
+ () => dt(n, d, o, a),
235
+ [n, a]
236
+ ), T = p.useMemo(
237
+ () => gt(n, a, c),
238
+ [n, a, c]
239
+ ), x = (b, R) => {
240
+ S(R), s("");
241
+ }, D = (b) => {
242
+ s(u === b ? "" : b);
243
243
  };
244
- return o ? /* @__PURE__ */ h(x, { width: "100%", children: [
244
+ return i ? /* @__PURE__ */ h(w, { width: "100%", children: [
245
245
  /* @__PURE__ */ h(
246
- at,
246
+ it,
247
247
  {
248
248
  "aria-label": r.mini_title,
249
- onChange: E,
249
+ onChange: x,
250
250
  value: m,
251
251
  variant: "fullWidth",
252
252
  children: [
253
253
  /* @__PURE__ */ t(
254
- N,
254
+ L,
255
255
  {
256
256
  "aria-controls": "spending-tabpanel",
257
257
  id: "spending-tab",
258
258
  label: /* @__PURE__ */ t(
259
- W,
259
+ N,
260
260
  {
261
261
  amount: g.totalAmount,
262
262
  label: r.spend_tab_title
@@ -266,14 +266,14 @@ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
266
266
  }
267
267
  ),
268
268
  /* @__PURE__ */ t(
269
- N,
269
+ L,
270
270
  {
271
271
  "aria-controls": "income-tabpanel",
272
272
  id: "income-tab",
273
273
  label: /* @__PURE__ */ t(
274
- W,
274
+ N,
275
275
  {
276
- amount: b.totalAmount,
276
+ amount: T.totalAmount,
277
277
  label: r.income_tab_title
278
278
  }
279
279
  ),
@@ -284,7 +284,7 @@ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
284
284
  }
285
285
  ),
286
286
  /* @__PURE__ */ t(
287
- x,
287
+ w,
288
288
  {
289
289
  "aria-labelledby": "spending-tab",
290
290
  hidden: m !== 0,
@@ -292,20 +292,20 @@ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
292
292
  role: "tabpanel",
293
293
  children: /* @__PURE__ */ h(C, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
294
294
  /* @__PURE__ */ t(
295
- O,
295
+ W,
296
296
  {
297
297
  data: g,
298
- onSelected: _,
298
+ onSelected: D,
299
299
  selectedId: u,
300
300
  totalLabel: r.total_spending
301
301
  }
302
302
  ),
303
- /* @__PURE__ */ t(tt, { data: g, onSelected: _, selectedId: u })
303
+ /* @__PURE__ */ t(et, { data: g, onSelected: D, selectedId: u })
304
304
  ] })
305
305
  }
306
306
  ),
307
307
  /* @__PURE__ */ t(
308
- x,
308
+ w,
309
309
  {
310
310
  "aria-labelledby": "income-tab",
311
311
  hidden: m !== 1,
@@ -313,48 +313,48 @@ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
313
313
  role: "tabpanel",
314
314
  children: /* @__PURE__ */ h(C, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
315
315
  /* @__PURE__ */ t(
316
- O,
316
+ W,
317
317
  {
318
- data: b,
318
+ data: T,
319
319
  isIncome: !0,
320
- onSelected: _,
320
+ onSelected: D,
321
321
  selectedId: u,
322
322
  totalLabel: r.total_income
323
323
  }
324
324
  ),
325
- /* @__PURE__ */ t(tt, { data: b, onSelected: _, selectedId: u })
325
+ /* @__PURE__ */ t(et, { data: T, onSelected: D, selectedId: u })
326
326
  ] })
327
327
  }
328
328
  )
329
329
  ] }) : /* @__PURE__ */ t(F, { height: 250 });
330
- }, Nt = v(Lt), Wt = ({ onPrimaryCtaClick: n, sx: c = {} }) => {
331
- const { visibleAccounts: r } = rt(), { spending: l } = I(), { isCopyLoaded: a, isInitialized: i, setSelectedAccounts: o } = R();
330
+ }, Ot = I(Wt), Rt = ({ onPrimaryCtaClick: o, sx: d = {} }) => {
331
+ const { visibleAccounts: r } = st(), { spending: l } = E(), { isCopyLoaded: n, isInitialized: a, setSelectedAccounts: i } = O();
332
332
  return p.useEffect(() => {
333
- o(r);
334
- }, [r]), !a || !i ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
335
- Mt,
333
+ i(r);
334
+ }, [r]), !n || !a ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
335
+ xt,
336
336
  {
337
337
  className: "mx-exp-spending-miniwidget",
338
- onPrimaryCtaClick: n,
338
+ onPrimaryCtaClick: o,
339
339
  primaryCtaLabel: l.primary_cta,
340
- sx: c,
340
+ sx: d,
341
341
  title: l.mini_title,
342
- children: /* @__PURE__ */ t(Nt, {})
342
+ children: /* @__PURE__ */ t(Ot, {})
343
343
  }
344
344
  );
345
- }, be = v(Wt), Ot = ({
346
- data: n,
347
- onSelected: c,
345
+ }, _e = I(Rt), kt = ({
346
+ data: o,
347
+ onSelected: d,
348
348
  selectedId: r = "",
349
349
  title: l
350
350
  }) => {
351
- const { spending: a } = I(), i = n.categoryData.find((o) => o.guid === r);
351
+ const { spending: n } = E(), a = o.categoryData.find((i) => i.guid === r);
352
352
  return /* @__PURE__ */ h(C, { direction: "column", justifyContent: "center", maxWidth: 400, minWidth: 275, width: "100%", children: [
353
- /* @__PURE__ */ t(y, { bold: !0, sx: { py: 12 }, children: `${l} ${a.by_category}` }),
353
+ /* @__PURE__ */ t(y, { bold: !0, sx: { py: 12 }, children: `${l} ${n.by_category}` }),
354
354
  /* @__PURE__ */ t(B, { "aria-hidden": "true" }),
355
- /* @__PURE__ */ t(q, { children: n.categoryData.map((o) => /* @__PURE__ */ h(p.Fragment, { children: [
355
+ /* @__PURE__ */ t(J, { children: o.categoryData.map((i) => /* @__PURE__ */ h(p.Fragment, { children: [
356
356
  /* @__PURE__ */ t(
357
- J,
357
+ Q,
358
358
  {
359
359
  disableGutters: !0,
360
360
  disablePadding: !0,
@@ -362,19 +362,19 @@ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
362
362
  minHeight: 44
363
363
  },
364
364
  children: /* @__PURE__ */ h(
365
- vt,
365
+ Et,
366
366
  {
367
- "aria-expanded": i?.guid === o.guid,
368
- onClick: () => c(o.guid),
367
+ "aria-expanded": a?.guid === i.guid,
368
+ onClick: () => d(i.guid),
369
369
  sx: { minHeight: 44, px: 8, py: 0 },
370
370
  children: [
371
371
  /* @__PURE__ */ t(
372
- x,
372
+ w,
373
373
  {
374
374
  borderRadius: 4,
375
375
  flexShrink: 0,
376
376
  height: 8,
377
- sx: { backgroundColor: o.color, mr: 8 },
377
+ sx: { backgroundColor: i.color, mr: 8 },
378
378
  width: 8
379
379
  }
380
380
  ),
@@ -386,8 +386,8 @@ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
386
386
  justifyContent: "space-between",
387
387
  width: "100%",
388
388
  children: [
389
- /* @__PURE__ */ t(y, { bold: r === o.guid, children: o.name }),
390
- /* @__PURE__ */ t(y, { bold: r === o.guid, variant: "Body", children: w(o.amount, "0,0") })
389
+ /* @__PURE__ */ t(y, { bold: r === i.guid, children: i.name }),
390
+ /* @__PURE__ */ t(y, { bold: r === i.guid, variant: "Body", children: v(i.amount, "0,0") })
391
391
  ]
392
392
  }
393
393
  )
@@ -397,9 +397,9 @@ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
397
397
  }
398
398
  ),
399
399
  /* @__PURE__ */ t(B, {}),
400
- o.categoryTotals && o.categoryTotals.length > 0 && /* @__PURE__ */ t(wt, { in: i?.guid === o.guid, unmountOnExit: !0, children: /* @__PURE__ */ h(q, { children: [
401
- i?.categoryTotals?.map((e) => /* @__PURE__ */ t(
402
- J,
400
+ i.categoryTotals && i.categoryTotals.length > 0 && /* @__PURE__ */ t(It, { in: a?.guid === i.guid, unmountOnExit: !0, children: /* @__PURE__ */ h(J, { children: [
401
+ a?.categoryTotals?.map((e) => /* @__PURE__ */ t(
402
+ Q,
403
403
  {
404
404
  sx: {
405
405
  pl: 24,
@@ -411,36 +411,36 @@ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
411
411
  e.name,
412
412
  " "
413
413
  ] }),
414
- /* @__PURE__ */ t(y, { children: w(e.amount, "0,0") })
414
+ /* @__PURE__ */ t(y, { children: v(e.amount, "0,0") })
415
415
  ] })
416
416
  },
417
417
  e.guid
418
418
  )),
419
419
  /* @__PURE__ */ t(B, {})
420
420
  ] }) })
421
- ] }, o.guid)) }),
422
- /* @__PURE__ */ t(y, { bold: !0, sx: { mt: 12, pr: 8, textAlign: "right" }, children: `${a.total}: ${w(n.totalAmount, "0,0")}` })
421
+ ] }, i.guid)) }),
422
+ /* @__PURE__ */ t(y, { bold: !0, sx: { mt: 12, pr: 8, textAlign: "right" }, children: `${n.total}: ${v(o.totalAmount, "0,0")}` })
423
423
  ] });
424
- }, Rt = v(Ot), kt = ({
425
- data: n,
426
- onSelected: c,
424
+ }, $t = I(kt), Gt = ({
425
+ data: o,
426
+ onSelected: d,
427
427
  onViewTransactions: r,
428
428
  selectedId: l,
429
- title: a
429
+ title: n
430
430
  }) => {
431
- const { isDesktop: i, isMobile: o } = lt(), { isLoadingCategoryTotals: e } = z(), { spending: d } = I();
431
+ const { isDesktop: a, isMobile: i } = ct(), { isLoadingCategoryTotals: e } = z(), { spending: c } = E();
432
432
  return /* @__PURE__ */ h(
433
433
  C,
434
434
  {
435
- alignItems: o ? "center" : "flex-start",
436
- direction: o ? "column" : "row",
435
+ alignItems: i ? "center" : "flex-start",
436
+ direction: i ? "column" : "row",
437
437
  gap: { xs: 16, md: 64, xl: 100 },
438
438
  justifyContent: "center",
439
439
  pt: 50,
440
440
  px: 8,
441
441
  children: [
442
442
  e && /* @__PURE__ */ t(
443
- O,
443
+ W,
444
444
  {
445
445
  data: {
446
446
  categoryData: [],
@@ -450,173 +450,175 @@ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
450
450
  onSelected: () => {
451
451
  },
452
452
  selectedId: "",
453
- size: i ? 400 : 300,
453
+ size: a ? 400 : 300,
454
454
  totalLabel: "Loading ...",
455
455
  variant: "full"
456
456
  }
457
457
  ),
458
458
  !e && /* @__PURE__ */ t(
459
- O,
459
+ W,
460
460
  {
461
- data: n,
462
- onSelected: c,
461
+ data: o,
462
+ onSelected: d,
463
463
  onViewTransactions: r,
464
464
  selectedId: l,
465
- size: i ? 400 : 300,
466
- totalLabel: d.total_amount,
465
+ size: a ? 400 : 300,
466
+ totalLabel: c.total_amount,
467
467
  variant: "full"
468
468
  }
469
469
  ),
470
- /* @__PURE__ */ t(Rt, { data: n, onSelected: c, selectedId: l, title: a })
470
+ /* @__PURE__ */ t($t, { data: o, onSelected: d, selectedId: l, title: n })
471
471
  ]
472
472
  }
473
473
  );
474
- }, et = v(kt), $t = (n) => [
475
- n.palette.chartMono.chartMono5,
476
- n.palette.chartMono.chartMono4,
477
- n.palette.chartMono.chartMono3,
478
- n.palette.chartMono.chartMono2,
479
- n.palette.chartMono.chartMono1,
480
- n.palette.chartMono.chartMono6
481
- ], Gt = () => {
482
- const n = it(), { clientConfig: c } = st(), { categories: r, dateRangeCategoryTotals: l, loadDateRangeCategoryTotals: a } = z(), { goals: i, spending: o } = I(), { displayedDateRange: e, selectedAccounts: d, selectedAccountGuids: u } = R(), { setFilter: s, sortedTransactions: m } = _t(), T = c?.master?.deep_link_params?.account_guids, g = c?.master?.deep_link_params?.view, [b, E] = p.useState(""), [_, D] = p.useState(g === "income" ? 1 : 0), [L, H] = p.useState(""), [gt, P] = p.useState(!1);
474
+ }, nt = I(Gt), Bt = (o) => [
475
+ o.palette.chartMono.chartMono5,
476
+ o.palette.chartMono.chartMono4,
477
+ o.palette.chartMono.chartMono3,
478
+ o.palette.chartMono.chartMono2,
479
+ o.palette.chartMono.chartMono1,
480
+ o.palette.chartMono.chartMono6
481
+ ], jt = () => {
482
+ const o = rt(), { onLoad: d } = St(), { clientConfig: r } = lt(), { categories: l, dateRangeCategoryTotals: n, loadDateRangeCategoryTotals: a } = z(), { goals: i, spending: e } = E(), { displayedDateRange: c, selectedAccounts: u, selectedAccountGuids: s } = O(), { setFilter: m, sortedTransactions: S } = Tt(), g = r?.master?.deep_link_params?.account_guids, T = r?.master?.deep_link_params?.view, [x, D] = p.useState(""), [b, R] = p.useState(T === "income" ? 1 : 0), [H, P] = p.useState(""), [ut, K] = p.useState(!1);
483
483
  p.useEffect(() => {
484
484
  a(
485
- d,
486
- e.start,
487
- e.end
488
- ).finally();
489
- }, [d, e]);
485
+ u,
486
+ c.start,
487
+ c.end
488
+ ).finally(() => {
489
+ d?.("SpendingWidget");
490
+ });
491
+ }, [u, c]);
490
492
  const k = p.useMemo(
491
- () => ct(r, i, n, l),
492
- [r, l]
493
- ), K = p.useMemo(
494
- () => dt(r, l, $t(n)),
495
- [r, l]
493
+ () => dt(l, i, o, n),
494
+ [l, n]
495
+ ), X = p.useMemo(
496
+ () => gt(l, n, Bt(o)),
497
+ [l, n]
496
498
  ), $ = p.useMemo(
497
- () => m.find((f) => f.guid === L),
498
- [L, m]
499
- ), ut = (f, A) => {
500
- D(A), E("");
501
- }, X = (f) => {
502
- E(b === f || f === "0" ? "" : f);
499
+ () => S.find((f) => f.guid === H),
500
+ [H, S]
501
+ ), pt = (f, A) => {
502
+ R(A), D("");
503
503
  }, Y = (f) => {
504
+ D(x === f || f === "0" ? "" : f);
505
+ }, U = (f) => {
504
506
  const A = {
505
- accounts: T || u,
506
- dateRange: e
507
+ accounts: g || s,
508
+ dateRange: c
507
509
  };
508
- if (_ === 0)
510
+ if (b === 0)
509
511
  if (f === "other") {
510
512
  const M = k.categoryData.find((G) => G.guid === "other");
511
- s({
513
+ m({
512
514
  ...A,
513
- custom: (G) => !!M?.categoryTotals?.find((pt) => pt.guid === G.top_level_category_guid)
515
+ custom: (G) => !!M?.categoryTotals?.find((mt) => mt.guid === G.top_level_category_guid)
514
516
  });
515
517
  } else
516
- s({
518
+ m({
517
519
  ...A,
518
- custom: (M) => f ? M.top_level_category_guid === f : M.top_level_category_guid !== S.INCOME && M.top_level_category_guid !== S.INVESTMENTS && M.top_level_category_guid !== S.TRANSFER,
520
+ custom: (M) => f ? M.top_level_category_guid === f : M.top_level_category_guid !== _.INCOME && M.top_level_category_guid !== _.INVESTMENTS && M.top_level_category_guid !== _.TRANSFER,
519
521
  showSplits: !!f
520
522
  });
521
523
  else
522
- s({
524
+ m({
523
525
  ...A,
524
- custom: (M) => f ? M.category_guid === f : M.category_guid === S.INCOME || M.top_level_category_guid === S.INCOME
526
+ custom: (M) => f ? M.category_guid === f : M.category_guid === _.INCOME || M.top_level_category_guid === _.INCOME
525
527
  });
526
- P(!0);
528
+ K(!0);
527
529
  };
528
- return /* @__PURE__ */ h(x, { children: [
529
- /* @__PURE__ */ h(at, { onChange: ut, value: _, variant: "fullWidth", children: [
530
+ return /* @__PURE__ */ h(w, { children: [
531
+ /* @__PURE__ */ h(it, { onChange: pt, value: b, variant: "fullWidth", children: [
530
532
  /* @__PURE__ */ t(
531
- N,
533
+ L,
532
534
  {
533
535
  label: /* @__PURE__ */ t(
534
- W,
536
+ N,
535
537
  {
536
538
  amount: k.totalAmount,
537
- label: o.spend_tab_title
539
+ label: e.spend_tab_title
538
540
  }
539
541
  )
540
542
  }
541
543
  ),
542
544
  /* @__PURE__ */ t(
543
- N,
545
+ L,
544
546
  {
545
547
  label: /* @__PURE__ */ t(
546
- W,
548
+ N,
547
549
  {
548
- amount: K.totalAmount,
549
- label: o.income_tab_title
550
+ amount: X.totalAmount,
551
+ label: e.income_tab_title
550
552
  }
551
553
  )
552
554
  }
553
555
  )
554
556
  ] }),
555
- _ === 0 && /* @__PURE__ */ t(
556
- et,
557
+ b === 0 && /* @__PURE__ */ t(
558
+ nt,
557
559
  {
558
560
  data: k,
559
- onSelected: X,
560
- onViewTransactions: Y,
561
- selectedId: b,
562
- title: o.spend_tab_title
561
+ onSelected: Y,
562
+ onViewTransactions: U,
563
+ selectedId: x,
564
+ title: e.spend_tab_title
563
565
  }
564
566
  ),
565
- _ === 1 && /* @__PURE__ */ t(
566
- et,
567
+ b === 1 && /* @__PURE__ */ t(
568
+ nt,
567
569
  {
568
- data: K,
569
- onSelected: X,
570
- onViewTransactions: Y,
571
- selectedId: b,
572
- title: o.income_tab_title
570
+ data: X,
571
+ onSelected: Y,
572
+ onViewTransactions: U,
573
+ selectedId: x,
574
+ title: e.income_tab_title
573
575
  }
574
576
  ),
575
577
  /* @__PURE__ */ t(
576
- Q,
578
+ Z,
577
579
  {
578
- ariaLabelClose: o.close_drawer_aria,
579
- isOpen: gt,
580
- onClose: () => P(!1),
581
- title: o.transactions_drawer_title,
582
- children: /* @__PURE__ */ t(Dt, { onClick: H })
580
+ ariaLabelClose: e.close_drawer_aria,
581
+ isOpen: ut,
582
+ onClose: () => K(!1),
583
+ title: e.transactions_drawer_title,
584
+ children: /* @__PURE__ */ t(wt, { onClick: P })
583
585
  }
584
586
  ),
585
587
  /* @__PURE__ */ t(
586
- Q,
588
+ Z,
587
589
  {
588
- ariaLabelClose: o.close_drawer_aria,
590
+ ariaLabelClose: e.close_drawer_aria,
589
591
  isOpen: !!$,
590
- onClose: () => H(""),
591
- title: o.transaction_details_drawer_title,
592
- children: $ && /* @__PURE__ */ t(xt, { transaction: $ })
592
+ onClose: () => P(""),
593
+ title: e.transaction_details_drawer_title,
594
+ children: $ && /* @__PURE__ */ t(vt, { transaction: $ })
593
595
  }
594
596
  )
595
597
  ] });
596
- }, Bt = v(Gt), jt = ({ onBackClick: n, sx: c = {} }) => {
597
- const { visibleAccounts: r } = rt(), { spending: l } = I(), { isCopyLoaded: a, isInitialized: i, setDisplayedDate: o, setSelectedAccounts: e } = R(), { onEvent: d } = St(), { clientConfig: u } = st(), s = u?.master?.deep_link_params?.date_range, [m, T] = p.useState(!1);
598
+ }, Vt = I(jt), zt = ({ onBackClick: o, sx: d = {} }) => {
599
+ const { visibleAccounts: r } = st(), { spending: l } = E(), { isCopyLoaded: n, isInitialized: a, setDisplayedDate: i, setSelectedAccounts: e } = O(), { onEvent: c } = Mt(), { clientConfig: u } = lt(), s = u?.master?.deep_link_params?.date_range, [m, S] = p.useState(!1);
598
600
  p.useEffect(() => {
599
601
  e(r);
600
602
  }, [r]), p.useEffect(() => {
601
- s && Array.isArray(s) && s.length === 2 ? o(s[0], s[1]) : o(nt(U()), ot(U())), T(!0), d(Z.SPENDING_VIEW);
603
+ s && Array.isArray(s) && s.length === 2 ? i(s[0], s[1]) : i(ot(q()), at(q())), S(!0), c(tt.SPENDING_VIEW);
602
604
  }, []);
603
- const g = (b) => {
604
- o(b[0], b[1]);
605
+ const g = (T) => {
606
+ i(T[0], T[1]);
605
607
  };
606
- return !a || !i || !m ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
607
- It,
608
+ return !n || !a || !m ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
609
+ At,
608
610
  {
609
611
  accountOptions: r,
610
612
  calendarActions: { onRangeChanged: g },
611
- onAccountsFilterClick: () => d(Z.SPENDING_CLICK_FILTER),
612
- onBackClick: n,
613
- sx: c,
613
+ onAccountsFilterClick: () => c(tt.SPENDING_CLICK_FILTER),
614
+ onBackClick: o,
615
+ sx: d,
614
616
  title: l.title,
615
- children: /* @__PURE__ */ t(x, { height: "calc(100dvh - 150px)", overflow: "scroll", width: "100%", children: /* @__PURE__ */ t(Bt, {}) })
617
+ children: /* @__PURE__ */ t(w, { height: "calc(100dvh - 150px)", overflow: "scroll", width: "100%", children: /* @__PURE__ */ t(Vt, {}) })
616
618
  }
617
619
  );
618
- }, Ce = v(jt);
620
+ }, Se = I(zt);
619
621
  export {
620
- be as SpendingMiniWidget,
621
- Ce as SpendingWidget
622
+ _e as SpendingMiniWidget,
623
+ Se as SpendingWidget
622
624
  };