@mx-cartographer/experiences 7.4.8 → 7.4.9

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,126 +1,126 @@
1
- import { jsxs as m, jsx as e, Fragment as ze } from "react/jsx-runtime";
1
+ import { jsxs as g, jsx as e, Fragment as He } from "react/jsx-runtime";
2
2
  import l from "react";
3
3
  import { observer as I } from "mobx-react-lite";
4
4
  import { endOfMonth as pe } from "date-fns/endOfMonth";
5
- import { startOfMonth as Q } from "date-fns/startOfMonth";
5
+ import { startOfMonth as ee } from "date-fns/startOfMonth";
6
6
  import W from "@mui/material/Box";
7
7
  import S from "@mui/material/Stack";
8
- import te from "@mui/material/styles/useTheme";
9
- import { Text as b, CategoryIcon as K, Icon as N, H1 as Ue, H3 as Ae } from "@mxenabled/mxui";
8
+ import ne from "@mui/material/styles/useTheme";
9
+ import { Text as b, CategoryIcon as K, Icon as P, H1 as We, H3 as ve } from "@mxenabled/mxui";
10
10
  import X from "@mui/material/List";
11
- import { u as w, i as D, j as ne, m as z, q as oe, g as V, b as ae, h as re, a as Fe, d as Te, n as He } from "../hooks-C41HAxM5.mjs";
11
+ import { u as w, i as D, j as oe, m as U, q as ae, g as V, b as re, h as se, a as Ke, d as Te, n as Xe } from "../hooks-C41HAxM5.mjs";
12
12
  import { f as T } from "../NumberFormatting-DjTD0t3W.mjs";
13
13
  import we from "@mui/material/Button";
14
- import se from "@mui/material/Divider";
14
+ import ie from "@mui/material/Divider";
15
15
  import Y from "@mui/material/ListItem";
16
- import ie from "@mui/material/ListItemAvatar";
16
+ import ce from "@mui/material/ListItemAvatar";
17
17
  import Z from "@mui/material/ListItemButton";
18
18
  import q from "@mui/material/ListItemText";
19
- import { b as R } from "../Localization-2MODESHW.mjs";
20
- import { D as k } from "../Drawer-BEtCk82g.mjs";
21
- import We from "@mui/material/ListItemSecondaryAction";
22
- import { C as Ke } from "../CurrencyInput-BFKcs-_K.mjs";
23
- import { D as G } from "../Dialog-BPTr3qHE.mjs";
24
- import { C as Xe } from "../ConnectionsDrawer-Bz4uwdFE.mjs";
25
- import * as O from "d3";
26
- import Ve from "@mui/material/Tooltip";
27
- import { useTheme as Ye } from "@mui/material/styles";
28
- import { u as ce } from "../useScreenSize-B6JyS_Lj.mjs";
29
- import { L as j } from "../Loader-DUaFpDGv.mjs";
19
+ import { b as L } from "../Localization-2MODESHW.mjs";
20
+ import { D as N } from "../Drawer-BEtCk82g.mjs";
21
+ import Ve from "@mui/material/ListItemSecondaryAction";
22
+ import { C as Ye } from "../CurrencyInput-BFKcs-_K.mjs";
23
+ import { D as j } from "../Dialog-BPTr3qHE.mjs";
24
+ import { C as Ze } from "../ConnectionsDrawer-Bz4uwdFE.mjs";
25
+ import * as E from "d3";
26
+ import qe from "@mui/material/Tooltip";
27
+ import { useTheme as Je } from "@mui/material/styles";
28
+ import { u as le } from "../useScreenSize-B6JyS_Lj.mjs";
29
+ import { L as z } from "../Loader-DUaFpDGv.mjs";
30
30
  import { E as me } from "../EmptyState-DoxNUae-.mjs";
31
- import { A as L, W as Ze } from "../WidgetContainer-6dsjtOVg.mjs";
32
- import { u as qe } from "../BudgetUtil-Df2nII9u.mjs";
33
- import { M as Je } from "../MiniWidgetContainer-CmXpTylX.mjs";
34
- import { isAfter as Qe } from "date-fns/isAfter";
35
- import { startOfToday as J } from "date-fns/startOfToday";
36
- import et from "@mui/material/Alert";
37
- import tt from "@mui/material/Snackbar";
31
+ import { A as $, W as Qe } from "../WidgetContainer-6dsjtOVg.mjs";
32
+ import { u as et } from "../BudgetUtil-Df2nII9u.mjs";
33
+ import { M as tt } from "../MiniWidgetContainer-CmXpTylX.mjs";
34
+ import { isAfter as nt } from "date-fns/isAfter";
35
+ import { startOfToday as Q } from "date-fns/startOfToday";
36
+ import De from "@mui/material/Alert";
37
+ import Ie from "@mui/material/Snackbar";
38
38
  import Ce from "@mui/material/Tab";
39
- import nt from "@mui/material/Tabs";
40
- import { e as ot } from "../exportTransactionsToCSV-Cz2t0lmA.mjs";
41
- import { T as De, a as at } from "../TransactionDetails-COH0OKNG.mjs";
39
+ import ot from "@mui/material/Tabs";
40
+ import { e as at } from "../exportTransactionsToCSV-Cz2t0lmA.mjs";
41
+ import { T as Ee, a as rt } from "../TransactionDetails-COH0OKNG.mjs";
42
42
  import fe from "@mui/material/Card";
43
43
  import be from "@mui/material/CardContent";
44
44
  import { S as he } from "../StatusBar-BK_uYHAB.mjs";
45
- import { S as Ie } from "../SingleSegmentDonut-BgbLgwHi.mjs";
46
- import { u as rt, b as st } from "../CategorySelectorDrawer-DqJK_rrL.mjs";
47
- import Ee from "@mui/material/CardHeader";
48
- import { subDays as it } from "date-fns/subDays";
49
- import ct from "@mui/material/IconButton";
50
- import { M as lt } from "../ManageIncome-A69EUO5u.mjs";
51
- const dt = I(() => {
52
- const { budgets: t } = w(), { totalBudgeted: o } = D(), { incomeTotal: i } = ne(), s = i - o;
53
- return /* @__PURE__ */ m(S, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
54
- /* @__PURE__ */ m(S, { alignItems: "center", children: [
45
+ import { S as Oe } from "../SingleSegmentDonut-BgbLgwHi.mjs";
46
+ import { u as st, b as it } from "../CategorySelectorDrawer-DqJK_rrL.mjs";
47
+ import Me from "@mui/material/CardHeader";
48
+ import { subDays as ct } from "date-fns/subDays";
49
+ import lt from "@mui/material/IconButton";
50
+ import { M as dt } from "../ManageIncome-A69EUO5u.mjs";
51
+ const ut = I(() => {
52
+ const { budgets: t } = w(), { totalBudgeted: o } = D(), { incomeTotal: i } = oe(), s = i - o;
53
+ return /* @__PURE__ */ g(S, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
54
+ /* @__PURE__ */ g(S, { alignItems: "center", children: [
55
55
  /* @__PURE__ */ e(b, { bold: !0, variant: "Body", children: T(i, "0,0") }),
56
56
  /* @__PURE__ */ e(b, { color: "secondary", variant: "Small", children: t.projected_income })
57
57
  ] }),
58
58
  /* @__PURE__ */ e(b, { bold: !0, justifyContent: "center", variant: "Body", children: "-" }),
59
- /* @__PURE__ */ m(S, { alignItems: "center", children: [
59
+ /* @__PURE__ */ g(S, { alignItems: "center", children: [
60
60
  /* @__PURE__ */ e(b, { bold: !0, variant: "Body", children: T(o, "0,0") }),
61
61
  /* @__PURE__ */ e(b, { color: "secondary", variant: "Small", children: t.budgeted })
62
62
  ] }),
63
63
  /* @__PURE__ */ e(b, { bold: !0, justifyContent: "center", variant: "Body", children: "=" }),
64
- /* @__PURE__ */ m(S, { alignItems: "center", children: [
64
+ /* @__PURE__ */ g(S, { alignItems: "center", children: [
65
65
  /* @__PURE__ */ e(b, { bold: !0, variant: "Body", children: T(s, "0,0") }),
66
66
  /* @__PURE__ */ e(b, { color: "secondary", variant: "Small", children: t.remaining })
67
67
  ] })
68
68
  ] });
69
- }), ut = I(
69
+ }), mt = I(
70
70
  ({ category: t }) => {
71
71
  const { budgets: o } = w(), { budgets: i } = D(), s = l.useMemo(() => {
72
- const a = i.find((c) => c.category_guid === t.guid), n = T(t.totalAverageAmount, "0,0"), r = a ? R(o.recalculate_previous_budget, T(a.amount, "0,0")) : o.recalculate_new_budget;
73
- return `${n} - ${r}`;
72
+ const r = i.find((c) => c.category_guid === t.guid), a = T(t.totalAverageAmount, "0,0"), n = r ? L(o.recalculate_previous_budget, T(r.amount, "0,0")) : o.recalculate_new_budget;
73
+ return `${a} - ${n}`;
74
74
  }, [o, i]);
75
- return /* @__PURE__ */ m(l.Fragment, { children: [
76
- /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ m(Z, { children: [
77
- /* @__PURE__ */ e(ie, { children: /* @__PURE__ */ e(K, { categoryGuid: t.guid, variant: "filled" }) }),
75
+ return /* @__PURE__ */ g(l.Fragment, { children: [
76
+ /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ g(Z, { children: [
77
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ e(K, { categoryGuid: t.guid, variant: "filled" }) }),
78
78
  /* @__PURE__ */ e(q, { primary: t.name, secondary: s })
79
79
  ] }) }),
80
- /* @__PURE__ */ e(se, {})
80
+ /* @__PURE__ */ e(ie, {})
81
81
  ] }, t.guid);
82
82
  }
83
- ), mt = ({ onRecalculateBudgets: t }) => {
84
- const { budgets: o, common: i } = w(), { spendCategories: s } = z(), { recalculateBudgets: a, setAlert: n } = D(), [r, c] = l.useState(!1), g = s.filter((u) => u.totalAverageAmount > 0), d = async () => {
85
- await a(g), c(!1), n(o.alert_recalculated_budgets), t?.();
83
+ ), gt = ({ onRecalculateBudgets: t }) => {
84
+ const { budgets: o, common: i } = w(), { spendCategories: s } = U(), { recalculateBudgets: r, setAlert: a } = D(), [n, c] = l.useState(!1), m = s.filter((u) => u.totalAverageAmount > 0), d = async () => {
85
+ await r(m), c(!1), a(o.alert_recalculated_budgets), t?.();
86
86
  };
87
- return /* @__PURE__ */ m(l.Fragment, { children: [
87
+ return /* @__PURE__ */ g(l.Fragment, { children: [
88
88
  /* @__PURE__ */ e(we, { onClick: () => c(!0), sx: { mt: 24, mx: 24 }, variant: "text", children: o.recalculate_button }),
89
89
  /* @__PURE__ */ e(b, { sx: { mx: 24, my: 16, textAlign: "center", whiteSpace: "wrap" }, variant: "Paragraph", children: o.recalculate_help }),
90
90
  /* @__PURE__ */ e(
91
- k,
91
+ N,
92
92
  {
93
93
  ariaLabelClose: i.close_aria,
94
- isOpen: r,
94
+ isOpen: n,
95
95
  onClose: () => c(!1),
96
96
  onPrimaryAction: d,
97
97
  title: o.recalculate_title,
98
- children: /* @__PURE__ */ m(S, { children: [
99
- /* @__PURE__ */ m(S, { mx: 24, my: 16, children: [
98
+ children: /* @__PURE__ */ g(S, { children: [
99
+ /* @__PURE__ */ g(S, { mx: 24, my: 16, children: [
100
100
  /* @__PURE__ */ e(b, { bold: !0, variant: "Body", children: o.recalculate_description_top }),
101
101
  /* @__PURE__ */ e(b, { variant: "ParagraphSmall", children: o.recalculate_description_bottom })
102
102
  ] }),
103
- /* @__PURE__ */ e(W, { bgcolor: "background.paper", children: /* @__PURE__ */ e(X, { children: g.map((u) => /* @__PURE__ */ e(ut, { category: u }, u.guid)) }) })
103
+ /* @__PURE__ */ e(W, { bgcolor: "background.paper", children: /* @__PURE__ */ e(X, { children: m.map((u) => /* @__PURE__ */ e(mt, { category: u }, u.guid)) }) })
104
104
  ] })
105
105
  }
106
106
  )
107
107
  ] });
108
- }, le = ({
108
+ }, de = ({
109
109
  amount: t,
110
110
  categoryName: o,
111
111
  onAmountChanged: i
112
112
  }) => {
113
- const { budgets: s } = w(), { totalBudgeted: a } = D(), { incomeTotal: n } = ne(), r = n - a;
114
- return /* @__PURE__ */ m(S, { gap: 16, children: [
115
- /* @__PURE__ */ m(S, { children: [
116
- /* @__PURE__ */ e(b, { children: R(
113
+ const { budgets: s } = w(), { totalBudgeted: r } = D(), { incomeTotal: a } = oe(), n = a - r;
114
+ return /* @__PURE__ */ g(S, { gap: 16, children: [
115
+ /* @__PURE__ */ g(S, { children: [
116
+ /* @__PURE__ */ e(b, { children: L(
117
117
  s.add_description_top,
118
- T(r, "0,0")
118
+ T(n, "0,0")
119
119
  ) }),
120
- /* @__PURE__ */ e(b, { children: R(s.add_description_bottom, o) })
120
+ /* @__PURE__ */ e(b, { children: L(s.add_description_bottom, o) })
121
121
  ] }),
122
122
  /* @__PURE__ */ e(
123
- Ke,
123
+ Ye,
124
124
  {
125
125
  amount: t,
126
126
  autoFocus: !0,
@@ -131,13 +131,13 @@ const dt = I(() => {
131
131
  }
132
132
  )
133
133
  ] });
134
- }, gt = I(({ category: t, onAddBudget: o }) => {
135
- const { budgets: i, common: s } = w(), [a, n] = l.useState(!1), [r, c] = l.useState(
134
+ }, pt = I(({ category: t, onAddBudget: o }) => {
135
+ const { budgets: i, common: s } = w(), [r, a] = l.useState(!1), [n, c] = l.useState(
136
136
  `${t.totalAmount === 0 ? "" : t.totalAmount}`
137
137
  );
138
- return /* @__PURE__ */ m(l.Fragment, { children: [
139
- /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ m(Z, { onClick: () => n(!0), children: [
140
- /* @__PURE__ */ e(ie, { children: /* @__PURE__ */ e(K, { categoryGuid: t.guid }) }),
138
+ return /* @__PURE__ */ g(l.Fragment, { children: [
139
+ /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ g(Z, { onClick: () => a(!0), children: [
140
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ e(K, { categoryGuid: t.guid }) }),
141
141
  /* @__PURE__ */ e(
142
142
  q,
143
143
  {
@@ -145,122 +145,122 @@ const dt = I(() => {
145
145
  secondary: T(t.totalAmount, "0,0")
146
146
  }
147
147
  ),
148
- /* @__PURE__ */ e(We, { children: /* @__PURE__ */ e(N, { name: "add", size: 20 }) })
148
+ /* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(P, { name: "add", size: 20 }) })
149
149
  ] }) }, t.guid),
150
150
  /* @__PURE__ */ e(
151
- G,
151
+ j,
152
152
  {
153
153
  copy: { close_aria: s.close_aria, title: i.add_title },
154
- disablePrimaryButton: Number(r) <= 0,
155
- isOpen: a,
156
- onClose: () => n(!1),
157
- onPrimaryAction: () => o(t, Number(r)),
154
+ disablePrimaryButton: Number(n) <= 0,
155
+ isOpen: r,
156
+ onClose: () => a(!1),
157
+ onPrimaryAction: () => o(t, Number(n)),
158
158
  primaryText: i.add_save_button,
159
- children: /* @__PURE__ */ e(le, { amount: r, categoryName: t.name, onAmountChanged: c })
159
+ children: /* @__PURE__ */ e(de, { amount: n, categoryName: t.name, onAmountChanged: c })
160
160
  }
161
161
  )
162
162
  ] });
163
- }), Oe = I(({ onRecalculateBudgets: t }) => {
164
- const { budgets: o } = w(), { addBudget: i, setAlert: s, unbudgetedCategories: a } = D(), n = async (r, c) => {
165
- await i(r, c), s(R(o.alert_budget_created, r.name));
163
+ }), Re = I(({ onAddBudget: t, onRecalculateBudgets: o }) => {
164
+ const { budgets: i } = w(), { addBudget: s, setAlert: r, unbudgetedCategories: a } = D(), n = async (c, m) => {
165
+ await s(c, m), t?.(), r(L(i.alert_budget_created, c.name));
166
166
  };
167
- return /* @__PURE__ */ m(S, { children: [
168
- /* @__PURE__ */ e(dt, {}),
169
- /* @__PURE__ */ e(W, { bgcolor: "background.paper", children: /* @__PURE__ */ e(X, { children: a.map((r) => /* @__PURE__ */ e(
170
- gt,
167
+ return /* @__PURE__ */ g(S, { children: [
168
+ /* @__PURE__ */ e(ut, {}),
169
+ /* @__PURE__ */ e(W, { bgcolor: "background.paper", children: /* @__PURE__ */ e(X, { children: a.map((c) => /* @__PURE__ */ e(
170
+ pt,
171
171
  {
172
- category: r,
172
+ category: c,
173
173
  onAddBudget: n
174
174
  },
175
- r.guid
175
+ c.guid
176
176
  )) }) }),
177
- /* @__PURE__ */ e(mt, { onRecalculateBudgets: t })
177
+ /* @__PURE__ */ e(gt, { onRecalculateBudgets: o })
178
178
  ] });
179
- }), Be = 5, Me = 100, ee = 25, pt = (t) => {
180
- const o = (a) => {
181
- a.active || t.alphaTarget(0.3).restart(), a.subject.fx = a.subject.x, a.subject.fy = a.subject.y;
182
- }, i = (a) => {
183
- a.subject.fx = a.x, a.subject.fy = a.y;
184
- }, s = (a) => {
185
- a.active || t.alphaTarget(0), a.subject.fx = null, a.subject.fy = null;
179
+ }), Be = 5, Le = 100, te = 25, ht = (t) => {
180
+ const o = (r) => {
181
+ r.active || t.alphaTarget(0.3).restart(), r.subject.fx = r.subject.x, r.subject.fy = r.subject.y;
182
+ }, i = (r) => {
183
+ r.subject.fx = r.x, r.subject.fy = r.y;
184
+ }, s = (r) => {
185
+ r.active || t.alphaTarget(0), r.subject.fx = null, r.subject.fy = null;
186
186
  };
187
- return O.drag().on("start", o).on("drag", i).on("end", s);
188
- }, ht = (t) => {
187
+ return E.drag().on("start", o).on("drag", i).on("end", s);
188
+ }, ft = (t) => {
189
189
  let o = t.transaction_total / t.amount;
190
190
  o < 0 ? o = 0 : o > 1 && (o = 1);
191
- const i = o * 2 * Math.PI, s = O.interpolate(0, i), a = O.arc().cornerRadius(5).innerRadius(t.radius - Be * 2).outerRadius(t.radius - Be).startAngle(0).endAngle(0);
192
- return (n) => (a.endAngle(s(n)), a(t) || "");
193
- }, ft = (t) => {
194
- O.selectAll(".bubble").call(pt(t));
195
- }, Se = (t, o, i) => Math.min(Math.max(t, o), i), bt = (t, o, i) => {
191
+ const i = o * 2 * Math.PI, s = E.interpolate(0, i), r = E.arc().cornerRadius(5).innerRadius(t.radius - Be * 2).outerRadius(t.radius - Be).startAngle(0).endAngle(0);
192
+ return (a) => (r.endAngle(s(a)), r(t) || "");
193
+ }, bt = (t) => {
194
+ E.selectAll(".bubble").call(ht(t));
195
+ }, Se = (t, o, i) => Math.min(Math.max(t, o), i), yt = (t, o, i) => {
196
196
  t.alpha(1).restart().force(
197
197
  "x",
198
- O.forceX().x(i / 2).strength(0.01)
198
+ E.forceX().x(i / 2).strength(0.01)
199
199
  ).force(
200
200
  "y",
201
- O.forceY().y(o / 2).strength(0.02)
201
+ E.forceY().y(o / 2).strength(0.02)
202
202
  ).on("tick", () => {
203
203
  const s = t.nodes();
204
- s.forEach((a) => {
205
- const n = a.radius ?? ee;
206
- a.x = Se(a.x ?? 0, n, i - n), a.y = Se(a.y ?? 0, n, o - n);
207
- }), O.selectAll(".bubble").data(s).attr("transform", (a) => `translate(${a.x},${a.y})`);
204
+ s.forEach((r) => {
205
+ const a = r.radius ?? te;
206
+ r.x = Se(r.x ?? 0, a, i - a), r.y = Se(r.y ?? 0, a, o - a);
207
+ }), E.selectAll(".bubble").data(s).attr("transform", (r) => `translate(${r.x},${r.y})`);
208
208
  });
209
- }, Re = (t, o) => O.scaleLinear().domain([t, o]).range([ee, Me]), yt = (t) => {
210
- const o = t.reduce((n, r) => {
211
- const c = Math.max(r.transaction_total, r.amount);
212
- return c > n ? c : n;
213
- }, 0), i = t.reduce((n, r) => {
214
- const c = Math.max(r.transaction_total, r.amount);
215
- return c < n ? c : n;
216
- }, o), s = Re(i, o), a = t.map((n) => {
217
- const r = s(Math.max(n.transaction_total, n.amount)) || 25;
209
+ }, ke = (t, o) => E.scaleLinear().domain([t, o]).range([te, Le]), _t = (t) => {
210
+ const o = t.reduce((a, n) => {
211
+ const c = Math.max(n.transaction_total, n.amount);
212
+ return c > a ? c : a;
213
+ }, 0), i = t.reduce((a, n) => {
214
+ const c = Math.max(n.transaction_total, n.amount);
215
+ return c < a ? c : a;
216
+ }, o), s = ke(i, o), r = t.map((a) => {
217
+ const n = s(Math.max(a.transaction_total, a.amount)) || 25;
218
218
  return {
219
- ...n,
220
- radius: r
219
+ ...a,
220
+ radius: n
221
221
  };
222
222
  });
223
- return O.forceSimulation(a).velocityDecay(0.05).force("collide", O.forceCollide((n) => n.radius + 2).strength(0.7));
224
- }, _t = (t, o, i) => {
225
- const a = Math.PI * ee ** 2 * t, n = i < 400 || o < 300, r = n ? 40 : 20, c = Math.max(100, i - r), g = Math.max(100, o - r), d = c * g;
226
- let u = ee;
227
- if (a < d) {
228
- const h = Math.sqrt(d / (t * Math.PI)), f = Math.min(c, g) / 4;
229
- u = Math.min(Me, h, f);
223
+ return E.forceSimulation(r).velocityDecay(0.05).force("collide", E.forceCollide((a) => a.radius + 2).strength(0.7));
224
+ }, Ct = (t, o, i) => {
225
+ const r = Math.PI * te ** 2 * t, a = i < 400 || o < 300, n = a ? 40 : 20, c = Math.max(100, i - n), m = Math.max(100, o - n), d = c * m;
226
+ let u = te;
227
+ if (r < d) {
228
+ const h = Math.sqrt(d / (t * Math.PI)), f = Math.min(c, m) / 4;
229
+ u = Math.min(Le, h, f);
230
230
  }
231
- return n && t <= 3 && (u = Math.min(u, 45)), { minRadius: Math.max(20, u * 0.6), maxRadius: u };
232
- }, Ct = (t, o, i, s, a) => {
233
- const { maxRadius: n, minRadius: r } = _t(t, o, a);
234
- return O.scaleLinear().domain([s, i]).range([r, n]);
235
- }, Bt = (t, o, i = !1, s, a) => {
236
- const n = o.map((d) => Math.max(d.transaction_total, d.amount)), r = Math.min(...n), c = Math.max(...n), g = i ? Ct(t.length, s, c, r, a) : Re(r, c);
231
+ return a && t <= 3 && (u = Math.min(u, 45)), { minRadius: Math.max(20, u * 0.6), maxRadius: u };
232
+ }, Bt = (t, o, i, s, r) => {
233
+ const { maxRadius: a, minRadius: n } = Ct(t, o, r);
234
+ return E.scaleLinear().domain([s, i]).range([n, a]);
235
+ }, St = (t, o, i = !1, s, r) => {
236
+ const a = o.map((d) => Math.max(d.transaction_total, d.amount)), n = Math.min(...a), c = Math.max(...a), m = i ? Bt(t.length, s, c, n, r) : ke(n, c);
237
237
  return t.map((d) => ({
238
238
  ...d,
239
- radius: g(Math.max(d.transaction_total, d.amount))
239
+ radius: m(Math.max(d.transaction_total, d.amount))
240
240
  }));
241
- }, xe = 5, St = 2e3, xt = ({ bubble: t }) => {
242
- const o = te(), {
241
+ }, xe = 5, xt = 2e3, At = ({ bubble: t }) => {
242
+ const o = ne(), {
243
243
  amount: i,
244
244
  guid: s,
245
- budgetColors: { mercury: a },
246
- radius: n,
247
- transaction_total: r
245
+ budgetColors: { mercury: r },
246
+ radius: a,
247
+ transaction_total: n
248
248
  } = t, c = `mercury-${s}`;
249
249
  l.useEffect(() => {
250
- O.select(`.${c}`).selectAll(".status").remove(), O.select(`.${c}`).append("path").transition().duration(St).delay(0).attr("class", "status").attr("style", `fill: ${a}; fill-opacity: 1;`).attrTween("d", () => ht(t));
251
- }, [i, n, r]);
252
- const g = O.arc().innerRadius((d) => d - 2 * xe).outerRadius((d) => d - xe).startAngle(0).endAngle(2 * Math.PI);
250
+ E.select(`.${c}`).selectAll(".status").remove(), E.select(`.${c}`).append("path").transition().duration(xt).delay(0).attr("class", "status").attr("style", `fill: ${r}; fill-opacity: 1;`).attrTween("d", () => ft(t));
251
+ }, [i, a, n]);
252
+ const m = E.arc().innerRadius((d) => d - 2 * xe).outerRadius((d) => d - xe).startAngle(0).endAngle(2 * Math.PI);
253
253
  return /* @__PURE__ */ e("g", { className: c, children: /* @__PURE__ */ e(
254
254
  "path",
255
255
  {
256
- d: g(n) || "",
256
+ d: m(a) || "",
257
257
  style: { fill: o.palette.common.white, fillOpacity: 0.35 }
258
258
  }
259
259
  ) });
260
- }, vt = l.memo(xt), P = 75, ge = 50;
261
- function At({ bubble: t, isDraggable: o, onClick: i = () => {
260
+ }, vt = l.memo(At), G = 75, ge = 50;
261
+ function Tt({ bubble: t, isDraggable: o, onClick: i = () => {
262
262
  } }) {
263
- const [s, a] = l.useState(!1), n = Ye(), { availableWidth: r } = oe(), c = l.useMemo(() => {
263
+ const [s, r] = l.useState(!1), a = Je(), { availableWidth: n } = ae(), c = l.useMemo(() => {
264
264
  if (t)
265
265
  return {
266
266
  amount: t.amount,
@@ -272,50 +272,50 @@ function At({ bubble: t, isDraggable: o, onClick: i = () => {
272
272
  }, [t.amount, t.budgetColors, t.guid, t.radius, t.transaction_total]);
273
273
  if (!t) return;
274
274
  const {
275
- budgetColors: { background: g, text: d },
276
- category: { icon: u, name: B },
275
+ budgetColors: { background: m, text: d },
276
+ category: { icon: u, name: C },
277
277
  guid: h,
278
278
  description: f,
279
279
  radius: p,
280
- x: C,
281
- y
282
- } = t, _ = r < 400 ? -8 : -12;
283
- let v = _, A = _;
284
- p > P ? (v = -14, A = -45) : p > ge && (A = -32);
280
+ x: y,
281
+ y: _
282
+ } = t, B = n < 400 ? -8 : -12;
283
+ let A = B, v = B;
284
+ p > G ? (A = -14, v = -45) : p > ge && (v = -32);
285
285
  let x = 32;
286
- p <= P && (x = r < 400 ? 16 : 24);
287
- const E = `${t.category.name}: ${f}`, M = {
286
+ p <= G && (x = n < 400 ? 16 : 24);
287
+ const O = `${t.category.name}: ${f}`, M = {
288
288
  modifiers: [
289
289
  {
290
290
  name: "offset",
291
291
  options: { offset: [0, 15] }
292
292
  }
293
293
  ]
294
- }, $ = (F) => {
294
+ }, R = (F) => {
295
295
  (F.key === "Enter" || F.key === " ") && (F.preventDefault(), i(t));
296
- }, U = () => {
297
- a(!0);
298
- }, de = () => {
299
- a(!1);
296
+ }, k = () => {
297
+ r(!0);
298
+ }, ue = () => {
299
+ r(!1);
300
300
  };
301
- return /* @__PURE__ */ m(
301
+ return /* @__PURE__ */ g(
302
302
  "g",
303
303
  {
304
- "aria-label": `${B} - ${f}`,
304
+ "aria-label": `${C} - ${f}`,
305
305
  className: "bubble",
306
306
  id: `bubble-${h}`,
307
- onBlur: de,
307
+ onBlur: ue,
308
308
  onClick: () => i(t),
309
- onFocus: U,
310
- onKeyDown: $,
311
- onMouseEnter: () => a(!0),
312
- onMouseLeave: () => a(!1),
309
+ onFocus: k,
310
+ onKeyDown: R,
311
+ onMouseEnter: () => r(!0),
312
+ onMouseLeave: () => r(!1),
313
313
  role: "button",
314
314
  style: { cursor: o ? "pointer" : "default" },
315
315
  tabIndex: 0,
316
316
  textAnchor: "middle",
317
- x: C,
318
- y,
317
+ x: y,
318
+ y: _,
319
319
  children: [
320
320
  /* @__PURE__ */ e("style", { children: `
321
321
  .bubble:focus,
@@ -324,14 +324,14 @@ function At({ bubble: t, isDraggable: o, onClick: i = () => {
324
324
  }
325
325
  .bubble:focus circle,
326
326
  .bubble:focus-visible circle {
327
- stroke: ${n.palette.primary.main};
327
+ stroke: ${a.palette.primary.main};
328
328
  stroke-width: 3;
329
329
  stroke-opacity: 0.8;
330
330
  }
331
331
  ` }),
332
- /* @__PURE__ */ e(Ve, { open: s, slotProps: { popper: M }, title: E, children: /* @__PURE__ */ e("circle", { fill: g, id: `circle-${h}`, r: p }) }),
333
- /* @__PURE__ */ e("svg", { x: v, y: A, children: /* @__PURE__ */ e(N, { name: u, size: x, sx: { fill: d } }) }),
334
- p > P && /* @__PURE__ */ e(
332
+ /* @__PURE__ */ e(qe, { open: s, slotProps: { popper: M }, title: O, children: /* @__PURE__ */ e("circle", { fill: m, id: `circle-${h}`, r: p }) }),
333
+ /* @__PURE__ */ e("svg", { x: A, y: v, children: /* @__PURE__ */ e(P, { name: u, size: x, sx: { fill: d } }) }),
334
+ p > G && /* @__PURE__ */ e(
335
335
  b,
336
336
  {
337
337
  bold: !0,
@@ -340,7 +340,7 @@ function At({ bubble: t, isDraggable: o, onClick: i = () => {
340
340
  sx: { fill: d },
341
341
  variant: "Small",
342
342
  y: 4,
343
- children: B
343
+ children: C
344
344
  }
345
345
  ),
346
346
  p > ge && /* @__PURE__ */ e(
@@ -351,11 +351,11 @@ function At({ bubble: t, isDraggable: o, onClick: i = () => {
351
351
  id: `budget-description-${h}-1`,
352
352
  sx: { fill: d },
353
353
  variant: "Body",
354
- y: p <= P ? 12 : 24,
355
- children: p <= P ? f.split(" ")[0] : f
354
+ y: p <= G ? 12 : 24,
355
+ children: p <= G ? f.split(" ")[0] : f
356
356
  }
357
357
  ),
358
- p <= P && p > ge && /* @__PURE__ */ e(
358
+ p <= G && p > ge && /* @__PURE__ */ e(
359
359
  b,
360
360
  {
361
361
  component: "text",
@@ -372,165 +372,165 @@ function At({ bubble: t, isDraggable: o, onClick: i = () => {
372
372
  h
373
373
  );
374
374
  }
375
- const Tt = ({
375
+ const wt = ({
376
376
  height: t,
377
377
  width: o,
378
378
  isDraggable: i = !1,
379
379
  onClick: s = () => {
380
380
  }
381
381
  }) => {
382
- const [a, n] = l.useState([]), r = l.useRef(null), c = l.useRef(!1), { detailedBudgets: g } = D(), d = l.useCallback(() => {
383
- const u = r.current, B = yt(g), h = B.nodes();
382
+ const [r, a] = l.useState([]), n = l.useRef(null), c = l.useRef(!1), { detailedBudgets: m } = D(), d = l.useCallback(() => {
383
+ const u = n.current, C = _t(m), h = C.nodes();
384
384
  if (u) {
385
- const f = u.nodes(), p = new Map(f.map((C) => [C.guid, C]));
386
- h.forEach((C) => {
387
- const y = p.get(C.guid);
388
- y && Object.assign(C, {
389
- vx: y.vx,
390
- vy: y.vy,
391
- x: y.x,
392
- y: y.y
385
+ const f = u.nodes(), p = new Map(f.map((y) => [y.guid, y]));
386
+ h.forEach((y) => {
387
+ const _ = p.get(y.guid);
388
+ _ && Object.assign(y, {
389
+ vx: _.vx,
390
+ vy: _.vy,
391
+ x: _.x,
392
+ y: _.y
393
393
  });
394
394
  });
395
395
  }
396
- r.current = B, c.current = !1, n(h);
397
- }, [g]);
396
+ n.current = C, c.current = !1, a(h);
397
+ }, [m]);
398
398
  return l.useEffect(() => {
399
399
  d();
400
400
  }, [d]), l.useEffect(() => () => {
401
- r.current && (r.current.stop(), r.current = null);
401
+ n.current && (n.current.stop(), n.current = null);
402
402
  }, []), l.useEffect(() => {
403
- const u = r.current;
403
+ const u = n.current;
404
404
  if (!u) return;
405
- const B = u.nodes(), h = o > 0 && o < 450 || t > 0 && t < 300, f = Bt(B, g, h, t, o);
406
- u.nodes(f), bt(u, t, o), i && setTimeout(() => {
407
- ft(u);
408
- }, 0), n([...f]);
409
- }, [t, o, i, g]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(o), children: a.map((u) => /* @__PURE__ */ e(At, { bubble: u, isDraggable: i, onClick: s }, u.guid)) });
410
- }, wt = I(Tt), Dt = ({
405
+ const C = u.nodes(), h = o > 0 && o < 450 || t > 0 && t < 300, f = St(C, m, h, t, o);
406
+ u.nodes(f), yt(u, t, o), i && setTimeout(() => {
407
+ bt(u);
408
+ }, 0), a([...f]);
409
+ }, [t, o, i, m]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(o), children: r.map((u) => /* @__PURE__ */ e(Tt, { bubble: u, isDraggable: i, onClick: s }, u.guid)) });
410
+ }, Dt = I(wt), It = ({
411
411
  isMiniWidget: t = !1,
412
412
  onConnectAccountsClick: o,
413
413
  createBudgetOnClick: i
414
414
  }) => {
415
- const { recalculateBudgets: s } = D(), { spendCategories: a } = z(), { budgets: n } = w(), { availableWidth: r } = oe(), { isMobile: c } = ce(r), g = t && c, [d, u] = l.useState(!1), [B, h] = l.useState(!1), [f, p] = l.useState(!1), C = l.useMemo(() => [...a.filter((_) => _.totalAverageAmount > 0)], [a]), y = async () => {
415
+ const { recalculateBudgets: s } = D(), { spendCategories: r } = U(), { budgets: a } = w(), { availableWidth: n } = ae(), { isMobile: c } = le(n), m = t && c, [d, u] = l.useState(!1), [C, h] = l.useState(!1), [f, p] = l.useState(!1), y = l.useMemo(() => [...r.filter((B) => B.totalAverageAmount > 0)], [r]), _ = async () => {
416
416
  p(!0);
417
- const { data: _, isSuccess: v } = await s(C);
418
- p(!1), v ? (_.length === 0 && h(!0), u(!1)) : u(!0);
417
+ const { data: B, isSuccess: A } = await s(y);
418
+ p(!1), A ? (B.length === 0 && h(!0), u(!1)) : u(!0);
419
419
  };
420
- return f ? /* @__PURE__ */ e(j, {}) : d ? /* @__PURE__ */ e(
420
+ return f ? /* @__PURE__ */ e(z, {}) : d ? /* @__PURE__ */ e(
421
421
  me,
422
422
  {
423
- header: n.autogenerate_budgets_error_header,
423
+ header: a.autogenerate_budgets_error_header,
424
424
  icon: "error",
425
425
  iconColor: "#4D4D4D",
426
- onClick: (_) => {
427
- _ === "primary" ? y() : i();
426
+ onClick: (B) => {
427
+ B === "primary" ? _() : i();
428
428
  },
429
- primaryButton: n.autogenerate_budgets_error_primary_button,
430
- secondaryButton: n.zero_state_generate_budgets_secondary_button,
431
- subText: n.autogenerate_budgets_error_subheader,
429
+ primaryButton: a.autogenerate_budgets_error_primary_button,
430
+ secondaryButton: a.zero_state_generate_budgets_secondary_button,
431
+ subText: a.autogenerate_budgets_error_subheader,
432
432
  sx: {
433
433
  width: { sm: 468 },
434
434
  ".buttons-footer": {
435
435
  width: 208,
436
- ...g && { mt: 16, button: { height: "max-content" } }
436
+ ...m && { mt: 16, button: { height: "max-content" } }
437
437
  },
438
- ...g && { justifyContent: "center", mt: 0, svg: { height: 32, width: 32 } }
438
+ ...m && { justifyContent: "center", mt: 0, svg: { height: 32, width: 32 } }
439
439
  }
440
440
  }
441
- ) : /* @__PURE__ */ e(ze, { children: B ? /* @__PURE__ */ e(
441
+ ) : /* @__PURE__ */ e(He, { children: C ? /* @__PURE__ */ e(
442
442
  me,
443
443
  {
444
- header: n.zero_state_generate_budgets_header,
444
+ header: a.zero_state_generate_budgets_header,
445
445
  icon: "error",
446
446
  iconColor: "#4D4D4D",
447
- onClick: (_) => {
448
- _ === "primary" ? o() : i();
447
+ onClick: (B) => {
448
+ B === "primary" ? o() : i();
449
449
  },
450
- primaryButton: n.zero_state_generate_budgets_primary_button,
451
- secondaryButton: n.zero_state_generate_budgets_secondary_button,
452
- subText: n.zero_state_generate_budgets_subheader,
450
+ primaryButton: a.zero_state_generate_budgets_primary_button,
451
+ secondaryButton: a.zero_state_generate_budgets_secondary_button,
452
+ subText: a.zero_state_generate_budgets_subheader,
453
453
  sx: {
454
454
  width: t ? "100%" : { sm: 500 },
455
455
  height: t ? "100%" : { sm: 468 },
456
- mt: g ? 0 : 50,
456
+ mt: m ? 0 : 50,
457
457
  ".buttons-footer": {
458
458
  width: 208,
459
459
  height: 100,
460
- ...g && { mt: 16, button: { height: "max-content" } }
460
+ ...m && { mt: 16, button: { height: "max-content" } }
461
461
  },
462
462
  padding: t ? 5 : 0,
463
- ...g && { justifyContent: "center", svg: { height: 32, width: 32 } }
463
+ ...m && { justifyContent: "center", svg: { height: 32, width: 32 } }
464
464
  }
465
465
  }
466
466
  ) : /* @__PURE__ */ e(
467
467
  me,
468
468
  {
469
- header: n.create_budgets_title,
469
+ header: a.create_budgets_title,
470
470
  icon: "bubble_chart",
471
471
  iconColor: "#1A1A1A",
472
- onClick: (_) => {
473
- _ === "primary" ? y() : i();
472
+ onClick: (B) => {
473
+ B === "primary" ? _() : i();
474
474
  },
475
- primaryButton: n.empty_state_primary_button,
476
- secondaryButton: t ? void 0 : n.empty_state_secondary_button,
477
- subText: n.empty_state_subheader,
475
+ primaryButton: a.empty_state_primary_button,
476
+ secondaryButton: t ? void 0 : a.empty_state_secondary_button,
477
+ subText: a.empty_state_subheader,
478
478
  sx: {
479
479
  width: t ? "100%" : { sm: 432 },
480
480
  height: t ? "100%" : { sm: 468 },
481
- mt: g ? 0 : 50,
481
+ mt: m ? 0 : 50,
482
482
  ".buttons-footer": {
483
483
  width: 208,
484
484
  height: 100,
485
- ...g && { mt: 24, button: { height: "max-content" } }
485
+ ...m && { mt: 24, button: { height: "max-content" } }
486
486
  },
487
487
  padding: t ? 4 : 0,
488
- ...g && { justifyContent: "center", svg: { height: 32, width: 32 } }
488
+ ...m && { justifyContent: "center", svg: { height: 32, width: 32 } }
489
489
  }
490
490
  }
491
491
  ) });
492
- }, Le = I(
492
+ }, $e = I(
493
493
  ({
494
494
  createBudgetOnClick: t = () => {
495
495
  },
496
496
  height: o,
497
497
  isDraggable: i = !1,
498
498
  isMiniWidget: s = !1,
499
- shouldShowZeroState: a,
500
- unavailableWidth: n = 24
499
+ shouldShowZeroState: r,
500
+ unavailableWidth: a = 24
501
501
  }) => {
502
- const { onEvent: r } = V(), { setSelectedBudget: c } = D(), { isLoadingCategoryTotals: g } = z(), { isInitialized: d } = ae(), { accounts: u } = w(), { availableWidth: B } = oe(), { isMobile: h } = ce(), [f, p] = l.useState(!1), C = l.useMemo(() => B - n, [B]), y = (v) => {
503
- c(v), r(L.BUDGETS_CLICK_BUDGET_CATEGORY, {
504
- budget_category: v.category.name,
502
+ const { onEvent: n } = V(), { setSelectedBudget: c } = D(), { isLoadingCategoryTotals: m } = U(), { isInitialized: d } = re(), { accounts: u } = w(), { availableWidth: C } = ae(), { isMobile: h } = le(), [f, p] = l.useState(!1), y = l.useMemo(() => C - a, [C]), _ = (A) => {
503
+ c(A), n($.BUDGETS_CLICK_BUDGET_CATEGORY, {
504
+ budget_category: A.category.name,
505
505
  click_type: "bubble"
506
506
  });
507
- }, _ = () => {
508
- p(!0), r(L.ACCOUNTS_CLICK_CONNECT);
507
+ }, B = () => {
508
+ p(!0), n($.ACCOUNTS_CLICK_CONNECT);
509
509
  };
510
- return g ? /* @__PURE__ */ e(S, { alignItems: "center", height: o, justifyContent: "center", width: Math.abs(C), children: /* @__PURE__ */ e(j, {}) }) : /* @__PURE__ */ m(
510
+ return m ? /* @__PURE__ */ e(S, { alignItems: "center", height: o, justifyContent: "center", width: Math.abs(y), children: /* @__PURE__ */ e(z, {}) }) : /* @__PURE__ */ g(
511
511
  W,
512
512
  {
513
- ml: a || h ? 0 : 24,
513
+ ml: r || h ? 0 : 24,
514
514
  sx: { alignSelf: "center", ...s && { height: "100%" } },
515
515
  children: [
516
- a || !d ? /* @__PURE__ */ e(
517
- Dt,
516
+ r || !d ? /* @__PURE__ */ e(
517
+ It,
518
518
  {
519
519
  createBudgetOnClick: t,
520
520
  isMiniWidget: s,
521
- onConnectAccountsClick: _
521
+ onConnectAccountsClick: B
522
522
  }
523
523
  ) : /* @__PURE__ */ e(
524
- wt,
524
+ Dt,
525
525
  {
526
526
  height: o,
527
527
  isDraggable: i,
528
- onClick: y,
529
- width: C
528
+ onClick: _,
529
+ width: y
530
530
  }
531
531
  ),
532
532
  /* @__PURE__ */ e(
533
- Xe,
533
+ Ze,
534
534
  {
535
535
  onClose: () => p(!1),
536
536
  showConnectionsWidget: f,
@@ -541,49 +541,51 @@ const Tt = ({
541
541
  }
542
542
  );
543
543
  }
544
- ), It = ({
544
+ ), Et = ({
545
545
  budgetsCopy: t,
546
546
  difference: o,
547
547
  handleAddClick: i,
548
548
  shouldShowZeroState: s
549
549
  }) => {
550
- const { availableHeight: a = 0 } = oe(), n = l.useRef(null);
550
+ const { availableHeight: r = 0 } = ae(), a = l.useRef(null);
551
551
  l.useEffect(() => {
552
- a > 0 && n.current === null && (n.current = a);
553
- }, [a]);
554
- const r = l.useMemo(() => {
555
- const c = n.current ?? a;
552
+ r > 0 && a.current === null && (a.current = r);
553
+ }, [r]);
554
+ const n = l.useMemo(() => {
555
+ const c = a.current ?? r;
556
556
  return c > 0 ? Math.round(Math.max(120, Math.min(450, c * 0.8))) - 40 : 450;
557
- }, [a]);
558
- return /* @__PURE__ */ m(S, { sx: { height: "100%", justifyContent: "space-between" }, children: [
557
+ }, [r]);
558
+ return /* @__PURE__ */ g(S, { sx: { height: "100%", justifyContent: "space-between" }, children: [
559
559
  /* @__PURE__ */ e(
560
- Le,
560
+ $e,
561
561
  {
562
562
  createBudgetOnClick: i,
563
- height: r,
563
+ height: n,
564
564
  isMiniWidget: !0,
565
565
  shouldShowZeroState: s
566
566
  }
567
567
  ),
568
- !s && /* @__PURE__ */ m(W, { ml: 16, children: [
568
+ !s && /* @__PURE__ */ g(W, { ml: 16, children: [
569
569
  /* @__PURE__ */ e(b, { bold: !0, color: o < 0 ? "error.main" : "success.main", children: T(Math.abs(o), "0,0") }),
570
570
  /* @__PURE__ */ e(b, { children: o < 0 ? t.overspent_in_budgets : t.left_in_budgets })
571
571
  ] })
572
572
  ] });
573
- }, Et = (t) => {
574
- const o = te(), { onEvent: i } = V(), { detailedBudgets: s, isDataLoaded: a, loadBudgetData: n, setTheme: r } = D(), { budgets: c, common: g } = w(), { isCopyLoaded: d, isInitialized: u, selectedAccounts: B } = ae(), { reloadCategoryTotals: h } = z(), f = qe(), p = s.length === 0, [C, y] = l.useState(!1), _ = () => {
575
- y(!0), i(L.BUDGETS_CLICK_ADD);
576
- }, v = () => y(!1);
573
+ }, Ot = (t) => {
574
+ const o = ne(), { onEvent: i } = V(), { detailedBudgets: s, isDataLoaded: r, loadBudgetData: a, setTheme: n } = D(), { budgets: c, common: m } = w(), { isCopyLoaded: d, isInitialized: u, selectedAccounts: C } = re(), { reloadCategoryTotals: h } = U(), f = et(), p = s.length === 0, [y, _] = l.useState(!1), B = () => {
575
+ _(!0), i($.BUDGETS_CLICK_ADD);
576
+ }, A = () => {
577
+ _(!1);
578
+ }, v = () => _(!1);
577
579
  return l.useEffect(() => {
578
- r(o);
580
+ n(o);
579
581
  }, [o]), l.useEffect(() => {
580
- u && !a && h(B, Q(/* @__PURE__ */ new Date()), pe(/* @__PURE__ */ new Date())).then(
582
+ u && !r && h(C, ee(/* @__PURE__ */ new Date()), pe(/* @__PURE__ */ new Date())).then(
581
583
  () => {
582
- n().finally();
584
+ a().finally();
583
585
  }
584
586
  );
585
- }, [u, B]), d ? /* @__PURE__ */ m(
586
- Je,
587
+ }, [u, C]), d ? /* @__PURE__ */ g(
588
+ tt,
587
589
  {
588
590
  contentStyles: { height: "calc(100% - 66px)", ":last-child": { pb: 0 } },
589
591
  primaryCtaLabel: p ? c.get_started_cta : c.details_cta,
@@ -591,121 +593,127 @@ const Tt = ({
591
593
  title: c.budgets_title,
592
594
  ...t,
593
595
  children: [
594
- a ? /* @__PURE__ */ e(
595
- It,
596
+ r ? /* @__PURE__ */ e(
597
+ Et,
596
598
  {
597
599
  budgetsCopy: c,
598
600
  difference: f,
599
- handleAddClick: _,
601
+ handleAddClick: B,
600
602
  shouldShowZeroState: p
601
603
  }
602
- ) : /* @__PURE__ */ e(j, {}),
604
+ ) : /* @__PURE__ */ e(z, {}),
603
605
  /* @__PURE__ */ e(
604
- k,
606
+ N,
605
607
  {
606
- ariaLabelClose: g.close_aria,
607
- isOpen: C,
608
- onClose: () => y(!1),
608
+ ariaLabelClose: m.close_aria,
609
+ isOpen: y,
610
+ onClose: () => _(!1),
609
611
  title: c.add_new_title,
610
- children: /* @__PURE__ */ e(Oe, { onRecalculateBudgets: v })
612
+ children: /* @__PURE__ */ e(
613
+ Re,
614
+ {
615
+ onAddBudget: A,
616
+ onRecalculateBudgets: v
617
+ }
618
+ )
611
619
  }
612
620
  )
613
621
  ]
614
622
  }
615
- ) : /* @__PURE__ */ e(j, {});
616
- }, $n = I(Et), ke = ({ budget: t }) => {
623
+ ) : /* @__PURE__ */ e(z, {});
624
+ }, Nn = I(Ot), Ne = ({ budget: t }) => {
617
625
  const {
618
626
  amount: o,
619
627
  budgetColors: { background: i },
620
628
  category: { name: s },
621
- category_guid: a,
622
- percentage: n,
623
- transaction_total: r
629
+ category_guid: r,
630
+ percentage: a,
631
+ transaction_total: n
624
632
  } = t, c = [
625
633
  {
626
634
  color: i,
627
- percentage: `${n}%`
635
+ percentage: `${a}%`
628
636
  }
629
637
  ];
630
- return /* @__PURE__ */ e(fe, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(be, { children: /* @__PURE__ */ m(S, { alignItems: "center", gap: 16, children: [
631
- /* @__PURE__ */ e(K, { categoryGuid: a, size: 56 }),
632
- /* @__PURE__ */ e(Ue, { children: `${T(r, "0,0")} / ${T(o, "0,0")}` }),
638
+ return /* @__PURE__ */ e(fe, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(be, { children: /* @__PURE__ */ g(S, { alignItems: "center", gap: 16, children: [
639
+ /* @__PURE__ */ e(K, { categoryGuid: r, size: 56 }),
640
+ /* @__PURE__ */ e(We, { children: `${T(n, "0,0")} / ${T(o, "0,0")}` }),
633
641
  /* @__PURE__ */ e(b, { bold: !0, variant: "XSmall", children: s }),
634
642
  /* @__PURE__ */ e(he, { data: c, height: 10 })
635
643
  ] }) }) });
636
- }, Ot = I(() => {
644
+ }, Mt = I(() => {
637
645
  const { budgets: t } = w();
638
- return /* @__PURE__ */ m(S, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
639
- /* @__PURE__ */ e(N, { color: "secondary", name: "bubble_chart", sx: { fontSize: 32 } }),
646
+ return /* @__PURE__ */ g(S, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
647
+ /* @__PURE__ */ e(P, { color: "secondary", name: "bubble_chart", sx: { fontSize: 32 } }),
640
648
  /* @__PURE__ */ e(b, { bold: !0, color: "secondary", variant: "Small", children: t.zero_state_no_sub_budgets }),
641
649
  /* @__PURE__ */ e(b, { color: "text.secondary", variant: "XSmall", children: t.zero_state_no_sub_budgets_description })
642
650
  ] });
643
- }), Mt = I(({ budget: t }) => {
651
+ }), Rt = I(({ budget: t }) => {
644
652
  const {
645
653
  amount: o,
646
654
  budgetColors: { background: i },
647
655
  category: s,
648
- percentage: a,
649
- transaction_total: n
650
- } = t, { setSelectedSubBudget: r } = D();
651
- return /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ m(Z, { onClick: () => r(t), children: [
652
- /* @__PURE__ */ e(ie, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Ie, { color: i, percent: a, size: 40, children: /* @__PURE__ */ e(K, { categoryGuid: s.parent_guid, variant: "basic" }) }) }),
656
+ percentage: r,
657
+ transaction_total: a
658
+ } = t, { setSelectedSubBudget: n } = D();
659
+ return /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ g(Z, { onClick: () => n(t), children: [
660
+ /* @__PURE__ */ e(ce, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Oe, { color: i, percent: r, size: 40, children: /* @__PURE__ */ e(K, { categoryGuid: s.parent_guid, variant: "basic" }) }) }),
653
661
  /* @__PURE__ */ e(
654
662
  q,
655
663
  {
656
664
  primary: /* @__PURE__ */ e(S, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(b, { bold: !0, variant: "Body", children: t.category.name }) }),
657
665
  secondary: /* @__PURE__ */ e(S, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(b, { fontWeight: 400, variant: "Body", children: `
658
- ${T(n, "0,0")} /
666
+ ${T(a, "0,0")} /
659
667
  ${T(o, "0,0")}
660
668
  ` }) })
661
669
  }
662
670
  )
663
671
  ] }) });
664
- }), Rt = I(({ category: t, parentBudget: o }) => {
665
- const { budgets: i, common: s } = w(), { setExpandedGuid: a, setOnSelect: n } = rt(), { addBudget: r } = D(), [c, g] = l.useState(!1), [d, u] = l.useState(!1), [B, h] = l.useState(""), [f, p] = l.useState(void 0);
672
+ }), Lt = I(({ category: t, parentBudget: o }) => {
673
+ const { budgets: i, common: s } = w(), { setExpandedGuid: r, setOnSelect: a } = st(), { addBudget: n } = D(), [c, m] = l.useState(!1), [d, u] = l.useState(!1), [C, h] = l.useState(""), [f, p] = l.useState(void 0);
666
674
  l.useEffect(() => {
667
- n((_) => {
668
- const v = t.subCategories.find((A) => A.guid === _);
669
- v && (p(v), h(`${v.currentAmount === 0 ? "" : v.currentAmount}`), u(!0));
675
+ a((B) => {
676
+ const A = t.subCategories.find((v) => v.guid === B);
677
+ A && (p(A), h(`${A.currentAmount === 0 ? "" : A.currentAmount}`), u(!0));
670
678
  });
671
679
  }, []);
672
- const C = () => {
673
- a(t.guid), g(!0);
674
- }, y = async () => {
675
- f && Number(B) > 0 && (await r(f, Number(B), o.guid), u(!1), g(!1), p(void 0));
680
+ const y = () => {
681
+ r(t.guid), m(!0);
682
+ }, _ = async () => {
683
+ f && Number(C) > 0 && (await n(f, Number(C), o.guid), u(!1), m(!1), p(void 0));
676
684
  };
677
- return /* @__PURE__ */ m(W, { children: [
678
- /* @__PURE__ */ e(Y, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(Z, { onClick: C, children: /* @__PURE__ */ e(q, { children: /* @__PURE__ */ m(S, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
679
- /* @__PURE__ */ m(S, { alignItems: "center", direction: "row", gap: 8, children: [
680
- /* @__PURE__ */ e(N, { fill: !0, name: "add_box", size: 24, sx: { color: "primary.light" } }),
685
+ return /* @__PURE__ */ g(W, { children: [
686
+ /* @__PURE__ */ e(Y, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(Z, { onClick: y, children: /* @__PURE__ */ e(q, { children: /* @__PURE__ */ g(S, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
687
+ /* @__PURE__ */ g(S, { alignItems: "center", direction: "row", gap: 8, children: [
688
+ /* @__PURE__ */ e(P, { fill: !0, name: "add_box", size: 24, sx: { color: "primary.light" } }),
681
689
  /* @__PURE__ */ e(b, { bold: !0, sx: { color: "primary.light" }, variant: "Body", children: i.add_sub_budget_button })
682
690
  ] }),
683
- /* @__PURE__ */ e(N, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
691
+ /* @__PURE__ */ e(P, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
684
692
  ] }) }) }) }),
685
- /* @__PURE__ */ e(se, {}),
693
+ /* @__PURE__ */ e(ie, {}),
686
694
  /* @__PURE__ */ e(
687
- k,
695
+ N,
688
696
  {
689
697
  ariaLabelClose: s.close_aria,
690
698
  isOpen: c,
691
- onClose: () => g(!1),
699
+ onClose: () => m(!1),
692
700
  title: i.add_sub_budget_title,
693
- children: /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(st, { category: t, subCategories: t.subCategories }) })
701
+ children: /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(it, { category: t, subCategories: t.subCategories }) })
694
702
  }
695
703
  ),
696
704
  /* @__PURE__ */ e(
697
- G,
705
+ j,
698
706
  {
699
707
  copy: { close_aria: s.close_aria, title: i.add_title },
700
- disablePrimaryButton: Number(B) <= 0,
708
+ disablePrimaryButton: Number(C) <= 0,
701
709
  isOpen: d,
702
710
  onClose: () => u(!1),
703
- onPrimaryAction: y,
711
+ onPrimaryAction: _,
704
712
  primaryText: i.add_save_button,
705
713
  children: /* @__PURE__ */ e(
706
- le,
714
+ de,
707
715
  {
708
- amount: B,
716
+ amount: C,
709
717
  categoryName: f?.name || "",
710
718
  onAmountChanged: h
711
719
  }
@@ -713,107 +721,107 @@ const Tt = ({
713
721
  }
714
722
  )
715
723
  ] });
716
- }), Lt = I(({ budget: t }) => {
717
- const { category: o, subBudgets: i } = t, { budgets: s, common: a } = w(), { deleteBudget: n, selectedSubBudget: r, setSelectedSubBudget: c, updateBudget: g } = D(), { filter: d, setFilter: u } = re(), [B, h] = l.useState(!1), [f, p] = l.useState(!1), [C, y] = l.useState("");
724
+ }), kt = I(({ budget: t }) => {
725
+ const { category: o, subBudgets: i } = t, { budgets: s, common: r } = w(), { deleteBudget: a, selectedSubBudget: n, setSelectedSubBudget: c, updateBudget: m } = D(), { filter: d, setFilter: u } = se(), [C, h] = l.useState(!1), [f, p] = l.useState(!1), [y, _] = l.useState("");
718
726
  l.useEffect(() => {
719
- r && (y(`${r.amount}`), u({
727
+ n && (_(`${n.amount}`), u({
720
728
  ...d,
721
- custom: (x) => x.category_guid === r.category_guid
729
+ custom: (x) => x.category_guid === n.category_guid
722
730
  }));
723
- }, [r]);
724
- const _ = async () => {
725
- r && await g({
726
- ...r,
727
- amount: Number(C)
731
+ }, [n]);
732
+ const B = async () => {
733
+ n && await m({
734
+ ...n,
735
+ amount: Number(y)
728
736
  });
729
- }, v = async () => {
730
- r && await n(r.guid), p(!1), A();
731
- }, A = () => {
737
+ }, A = async () => {
738
+ n && await a(n.guid), p(!1), v();
739
+ }, v = () => {
732
740
  u({
733
741
  ...d,
734
742
  custom: (x) => x.category_guid === t.category_guid || x.top_level_category_guid === t.category_guid
735
743
  }), c(void 0);
736
744
  };
737
- return /* @__PURE__ */ m(l.Fragment, { children: [
738
- /* @__PURE__ */ m(X, { sx: { bgcolor: "background.paper" }, children: [
739
- i.length === 0 ? /* @__PURE__ */ e(Ot, {}) : i.map((x) => /* @__PURE__ */ m(l.Fragment, { children: [
740
- /* @__PURE__ */ e(Mt, { budget: x }),
741
- /* @__PURE__ */ e(se, {})
745
+ return /* @__PURE__ */ g(l.Fragment, { children: [
746
+ /* @__PURE__ */ g(X, { sx: { bgcolor: "background.paper" }, children: [
747
+ i.length === 0 ? /* @__PURE__ */ e(Mt, {}) : i.map((x) => /* @__PURE__ */ g(l.Fragment, { children: [
748
+ /* @__PURE__ */ e(Rt, { budget: x }),
749
+ /* @__PURE__ */ e(ie, {})
742
750
  ] }, x.guid)),
743
- /* @__PURE__ */ e(Rt, { category: o, parentBudget: t })
751
+ /* @__PURE__ */ e(Lt, { category: o, parentBudget: t })
744
752
  ] }),
745
753
  /* @__PURE__ */ e(
746
- k,
754
+ N,
747
755
  {
748
- ariaLabelClose: a.close_aria,
749
- isOpen: !!r,
750
- onClose: A,
756
+ ariaLabelClose: r.close_aria,
757
+ isOpen: !!n,
758
+ onClose: v,
751
759
  onPrimaryAction: () => h(!0),
752
760
  onSecondaryAction: () => p(!0),
753
761
  primaryText: s.details_edit_button,
754
762
  secondaryText: s.details_delete_button,
755
763
  title: s.details_title,
756
- children: r && /* @__PURE__ */ m(S, { gap: 24, children: [
757
- /* @__PURE__ */ e(ke, { budget: r }),
758
- /* @__PURE__ */ e(De, { height: "100%" })
764
+ children: n && /* @__PURE__ */ g(S, { gap: 24, children: [
765
+ /* @__PURE__ */ e(Ne, { budget: n }),
766
+ /* @__PURE__ */ e(Ee, { height: "100%" })
759
767
  ] })
760
768
  }
761
769
  ),
762
- r && /* @__PURE__ */ m(l.Fragment, { children: [
770
+ n && /* @__PURE__ */ g(l.Fragment, { children: [
763
771
  /* @__PURE__ */ e(
764
- G,
772
+ j,
765
773
  {
766
- copy: { close_aria: a.close_aria, title: s.details_edit_title },
767
- disablePrimaryButton: Number(C) <= 0,
768
- isOpen: B,
774
+ copy: { close_aria: r.close_aria, title: s.details_edit_title },
775
+ disablePrimaryButton: Number(y) <= 0,
776
+ isOpen: C,
769
777
  onClose: () => h(!1),
770
- onPrimaryAction: _,
778
+ onPrimaryAction: B,
771
779
  primaryText: s.edit_save_button,
772
780
  children: /* @__PURE__ */ e(
773
- le,
781
+ de,
774
782
  {
775
- amount: C,
776
- categoryName: r.category.name,
777
- onAmountChanged: y
783
+ amount: y,
784
+ categoryName: n.category.name,
785
+ onAmountChanged: _
778
786
  }
779
787
  )
780
788
  }
781
789
  ),
782
790
  /* @__PURE__ */ e(
783
- G,
791
+ j,
784
792
  {
785
- copy: { close_aria: a.close_aria, title: s.delete_title },
793
+ copy: { close_aria: r.close_aria, title: s.delete_title },
786
794
  isOpen: f,
787
795
  onClose: () => p(!1),
788
- onPrimaryAction: v,
796
+ onPrimaryAction: A,
789
797
  primaryColor: "error",
790
798
  primaryText: "Delete",
791
799
  secondaryColor: "secondary",
792
- children: /* @__PURE__ */ e(b, { variant: "Paragraph", children: R(s.delete_description, r.category.name) })
800
+ children: /* @__PURE__ */ e(b, { variant: "Paragraph", children: L(s.delete_description, n.category.name) })
793
801
  }
794
802
  )
795
803
  ] })
796
804
  ] });
797
- }), kt = I(({ budget: t }) => {
798
- const { is_mobile_webview: o } = Fe(), { setAlert: i } = D(), { budgets: s, common: a, transactions: n } = w(), { isDesktop: r, isSmallTablet: c, isTablet: g } = ce(), {
805
+ }), $t = I(({ budget: t }) => {
806
+ const { is_mobile_webview: o } = Ke(), { setAlert: i } = D(), { budgets: s, common: r, transactions: a } = w(), { isDesktop: n, isSmallTablet: c, isTablet: m } = le(), {
799
807
  sortedTransactions: d,
800
808
  sortedTransactionsWithSplits: u,
801
- tags: B
802
- } = re(), [h, f] = l.useState(0), [p, C] = l.useState(""), y = l.useMemo(
809
+ tags: C
810
+ } = se(), [h, f] = l.useState(0), [p, y] = l.useState(""), _ = l.useMemo(
803
811
  () => d.find((x) => x.guid === p),
804
812
  [p, d]
805
- ), _ = (x, E) => {
806
- f(E);
807
- }, v = () => {
808
- ot(u, B), i(s.alert_csv_downloaded);
809
- }, A = d.length > 0 && !o && (r || g && !c);
810
- return /* @__PURE__ */ m(S, { gap: 24, children: [
811
- /* @__PURE__ */ e(ke, { budget: t }),
812
- /* @__PURE__ */ m(S, { children: [
813
- /* @__PURE__ */ m(
814
- nt,
813
+ ), B = (x, O) => {
814
+ f(O);
815
+ }, A = () => {
816
+ at(u, C), i(s.alert_csv_downloaded);
817
+ }, v = d.length > 0 && !o && (n || m && !c);
818
+ return /* @__PURE__ */ g(S, { gap: 24, children: [
819
+ /* @__PURE__ */ e(Ne, { budget: t }),
820
+ /* @__PURE__ */ g(S, { children: [
821
+ /* @__PURE__ */ g(
822
+ ot,
815
823
  {
816
- onChange: _,
824
+ onChange: B,
817
825
  sx: { width: "100%" },
818
826
  textColor: "primary",
819
827
  value: h,
@@ -824,287 +832,305 @@ const Tt = ({
824
832
  ]
825
833
  }
826
834
  ),
827
- h === 0 && /* @__PURE__ */ m(S, { children: [
828
- A && /* @__PURE__ */ e(S, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
835
+ h === 0 && /* @__PURE__ */ g(S, { children: [
836
+ v && /* @__PURE__ */ e(S, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
829
837
  we,
830
838
  {
831
- onClick: v,
832
- startIcon: /* @__PURE__ */ e(N, { name: "ios_share" }),
839
+ onClick: A,
840
+ startIcon: /* @__PURE__ */ e(P, { name: "ios_share" }),
833
841
  variant: "text",
834
- children: n.export_csv_btn
842
+ children: a.export_csv_btn
835
843
  }
836
844
  ) }),
837
- /* @__PURE__ */ e(De, { height: "100%", onClick: C })
845
+ /* @__PURE__ */ e(Ee, { height: "100%", onClick: y })
838
846
  ] }),
839
- h === 1 && /* @__PURE__ */ e(Lt, { budget: t }),
847
+ h === 1 && /* @__PURE__ */ e(kt, { budget: t }),
840
848
  /* @__PURE__ */ e(
841
- k,
849
+ N,
842
850
  {
843
- ariaLabelClose: a.close_aria,
844
- isOpen: !!y,
845
- onClose: () => C(""),
851
+ ariaLabelClose: r.close_aria,
852
+ isOpen: !!_,
853
+ onClose: () => y(""),
846
854
  title: s.details_transaction_drawer,
847
- children: y && /* @__PURE__ */ e(at, { transaction: y })
855
+ children: _ && /* @__PURE__ */ e(rt, { transaction: _ })
848
856
  }
849
857
  )
850
858
  ] })
851
859
  ] });
852
- }), $t = I(() => {
853
- const { selectedAccountGuids: t } = ae(), { budgets: o, common: i } = w(), {
854
- dateRange: s,
860
+ }), Nt = I(() => {
861
+ const { selectedAccountGuids: t } = re(), { budgets: o, common: i } = w(), {
862
+ alert: s,
863
+ dateRange: r,
855
864
  deleteBudget: a,
856
865
  selectedBudget: n,
857
- selectedSubBudget: r,
858
- setAlert: c,
859
- setSelectedBudget: g,
860
- updateBudget: d
861
- } = D(), { setFilter: u } = re(), [B, h] = l.useState(!1), [f, p] = l.useState(!1), [C, y] = l.useState(!1), [_, v] = l.useState("");
866
+ selectedSubBudget: c,
867
+ setAlert: m,
868
+ setSelectedBudget: d,
869
+ updateBudget: u
870
+ } = D(), { setFilter: C } = se(), [h, f] = l.useState(!1), [p, y] = l.useState(!1), [_, B] = l.useState(!1), [A, v] = l.useState("");
862
871
  l.useEffect(() => {
863
- n && !r && (v(`${n.amount}`), h(!0), u({
872
+ n && !c && (v(`${n.amount}`), f(!0), C({
864
873
  accounts: t,
865
- dateRange: s,
866
- custom: (M) => M.category_guid === n.category_guid || M.top_level_category_guid === n.category_guid,
874
+ dateRange: r,
875
+ custom: (k) => k.category_guid === n.category_guid || k.top_level_category_guid === n.category_guid,
867
876
  showSplits: !0
868
877
  }));
869
878
  }, [n]);
870
- const A = async () => {
871
- n && (await d({
879
+ const x = async () => {
880
+ n && (await u({
872
881
  ...n,
873
- amount: Number(_),
874
- percentage: n.category.totalAmount / Number(_) * 100
875
- }), c(R(o.alert_budget_updated, n.category.name)));
876
- }, x = async () => {
877
- n && (await a(n.guid), c(R(o.alert_budget_deleted, n.category.name))), y(!1), E();
878
- }, E = () => {
879
- h(!1), setTimeout(() => {
880
- g(void 0);
882
+ amount: Number(A),
883
+ percentage: n.category.totalAmount / Number(A) * 100
884
+ }), m(L(o.alert_budget_updated, n.category.name)));
885
+ }, O = async () => {
886
+ n && (await a(n.guid), m(L(o.alert_budget_deleted, n.category.name))), M();
887
+ }, M = () => {
888
+ f(!1), setTimeout(() => {
889
+ d(void 0);
881
890
  }, 250);
891
+ }, R = () => {
892
+ m(""), y(!1);
882
893
  };
883
894
  if (n)
884
- return /* @__PURE__ */ m(l.Fragment, { children: [
895
+ return /* @__PURE__ */ g(l.Fragment, { children: [
885
896
  /* @__PURE__ */ e(
886
- k,
897
+ N,
887
898
  {
888
899
  ariaLabelClose: i.close_aria,
889
- isOpen: B,
890
- onClose: E,
891
- onPrimaryAction: () => p(!0),
892
- onSecondaryAction: () => y(!0),
900
+ isOpen: h,
901
+ onClose: M,
902
+ onPrimaryAction: () => y(!0),
903
+ onSecondaryAction: () => B(!0),
893
904
  primaryText: o.details_edit_button,
894
905
  secondaryColor: "error",
895
906
  secondaryText: o.details_delete_button,
896
907
  title: o.details_title,
897
- children: /* @__PURE__ */ e(kt, { budget: n })
908
+ children: /* @__PURE__ */ e($t, { budget: n })
898
909
  }
899
910
  ),
900
- /* @__PURE__ */ e(
901
- G,
911
+ /* @__PURE__ */ g(
912
+ j,
902
913
  {
903
914
  copy: { close_aria: i.close_aria, title: o.details_edit_title },
904
- disablePrimaryButton: Number(_) <= 0,
905
- isOpen: f,
906
- onClose: () => p(!1),
907
- onPrimaryAction: A,
915
+ disablePrimaryButton: Number(A) <= 0,
916
+ isOpen: p,
917
+ onClose: () => {
918
+ },
919
+ onPrimaryAction: x,
908
920
  primaryText: o.edit_save_button,
909
- children: /* @__PURE__ */ e(
910
- le,
911
- {
912
- amount: _,
913
- categoryName: n.category.name,
914
- onAmountChanged: v
915
- }
916
- )
921
+ children: [
922
+ /* @__PURE__ */ e(
923
+ de,
924
+ {
925
+ amount: A,
926
+ categoryName: n.category.name,
927
+ onAmountChanged: v
928
+ }
929
+ ),
930
+ /* @__PURE__ */ e(
931
+ Ie,
932
+ {
933
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
934
+ autoHideDuration: 3500,
935
+ onClose: R,
936
+ open: !!s,
937
+ children: /* @__PURE__ */ e(De, { closeText: "", onClose: R, severity: "success", variant: "filled", children: s })
938
+ }
939
+ )
940
+ ]
917
941
  }
918
942
  ),
919
943
  /* @__PURE__ */ e(
920
- G,
944
+ j,
921
945
  {
922
946
  copy: { close_aria: i.close_aria, title: o.delete_title },
923
- isOpen: C,
924
- onClose: () => y(!1),
925
- onPrimaryAction: x,
947
+ isOpen: _,
948
+ onClose: () => B(!1),
949
+ onPrimaryAction: O,
926
950
  primaryColor: "error",
927
951
  primaryText: o.details_delete_button,
928
952
  secondaryColor: "secondary",
929
- children: /* @__PURE__ */ e(b, { variant: "Paragraph", children: R(o.delete_description, n.category.name) })
953
+ children: /* @__PURE__ */ e(b, { variant: "Paragraph", children: L(o.delete_description, n.category.name) })
930
954
  }
931
955
  )
932
956
  ] });
933
- }), Nt = ({ budget: t, onClick: o }) => {
957
+ }), Pt = ({ budget: t, onClick: o }) => {
934
958
  const {
935
959
  amount: i,
936
- budgetColors: { background: s, description: a },
937
- category_guid: n,
938
- description: r,
960
+ budgetColors: { background: s, description: r },
961
+ category_guid: a,
962
+ description: n,
939
963
  percentage: c,
940
- subBudgets: g,
964
+ subBudgets: m,
941
965
  transaction_total: d
942
966
  } = t;
943
- return /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ m(Z, { onClick: () => o?.(t), children: [
944
- /* @__PURE__ */ e(ie, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Ie, { color: s, percent: c, size: 40, children: /* @__PURE__ */ e(K, { categoryGuid: n, variant: "basic" }) }) }),
967
+ return /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ g(Z, { onClick: () => o?.(t), children: [
968
+ /* @__PURE__ */ e(ce, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Oe, { color: s, percent: c, size: 40, children: /* @__PURE__ */ e(K, { categoryGuid: a, variant: "basic" }) }) }),
945
969
  /* @__PURE__ */ e(
946
970
  q,
947
971
  {
948
- primary: /* @__PURE__ */ m(S, { component: "span", direction: "row", justifyContent: "space-between", children: [
972
+ primary: /* @__PURE__ */ g(S, { component: "span", direction: "row", justifyContent: "space-between", children: [
949
973
  /* @__PURE__ */ e(b, { bold: !0, variant: "Body", children: t.category.name }),
950
974
  /* @__PURE__ */ e(b, { fontWeight: 400, variant: "Body", children: `
951
975
  ${T(d, "0,0")} /
952
976
  ${T(i, "0,0")}
953
977
  ` })
954
978
  ] }),
955
- secondary: /* @__PURE__ */ m(S, { component: "span", direction: "row", justifyContent: "space-between", children: [
956
- /* @__PURE__ */ e(b, { variant: "XSmall", children: `${g.length} Sub-budgets` }),
957
- /* @__PURE__ */ e(b, { bold: c > 100, color: a, variant: "XSmall", children: r })
979
+ secondary: /* @__PURE__ */ g(S, { component: "span", direction: "row", justifyContent: "space-between", children: [
980
+ /* @__PURE__ */ e(b, { variant: "XSmall", children: `${m.length} Sub-budgets` }),
981
+ /* @__PURE__ */ e(b, { bold: c > 100, color: r, variant: "XSmall", children: n })
958
982
  ] })
959
983
  }
960
984
  )
961
985
  ] }) });
962
- }, Pt = I(() => {
963
- const { onEvent: t } = V(), { budgets: o } = w(), { detailedBudgets: i, setSelectedBudget: s } = D(), a = (n) => {
964
- s(n), t(L.BUDGETS_CLICK_BUDGET_CATEGORY, {
965
- budget_category: n.category.name,
986
+ }, Gt = I(() => {
987
+ const { onEvent: t } = V(), { budgets: o } = w(), { detailedBudgets: i, setSelectedBudget: s } = D(), r = (a) => {
988
+ s(a), t($.BUDGETS_CLICK_BUDGET_CATEGORY, {
989
+ budget_category: a.category.name,
966
990
  click_type: "list"
967
991
  });
968
992
  };
969
- return /* @__PURE__ */ m(fe, { elevation: 2, children: [
970
- /* @__PURE__ */ e(Ee, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Ae, { children: o.budget_categories_title }) }),
971
- /* @__PURE__ */ e(be, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(X, { children: i.map((n) => /* @__PURE__ */ m(l.Fragment, { children: [
972
- /* @__PURE__ */ e(Nt, { budget: n, onClick: a }),
973
- /* @__PURE__ */ e(se, {})
974
- ] }, n.guid)) }) })
993
+ return /* @__PURE__ */ g(fe, { elevation: 2, children: [
994
+ /* @__PURE__ */ e(Me, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(ve, { children: o.budget_categories_title }) }),
995
+ /* @__PURE__ */ e(be, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(X, { children: i.map((a) => /* @__PURE__ */ g(l.Fragment, { children: [
996
+ /* @__PURE__ */ e(Pt, { budget: a, onClick: r }),
997
+ /* @__PURE__ */ e(ie, {})
998
+ ] }, a.guid)) }) })
975
999
  ] });
976
- }), Gt = I(() => {
977
- const t = te(), { onEvent: o } = V(), { visibleAccounts: i } = Te(), { budgets: s, common: a, recurring: n } = w(), { incomeCategories: r, spendCategories: c } = z(), { detailedBudgets: g, totalBudgeted: d } = D(), { incomeTotal: u } = ne(), { setFilter: B } = re(), [h, f] = l.useState(!1), [p, C] = l.useMemo(() => {
978
- const A = c.reduce(($, U) => $ + U.totalAmount, 0);
979
- let x = A / d;
1000
+ }), jt = I(() => {
1001
+ const t = ne(), { onEvent: o } = V(), { visibleAccounts: i } = Te(), { budgets: s, common: r, recurring: a } = w(), { incomeCategories: n, spendCategories: c } = U(), { detailedBudgets: m, totalBudgeted: d } = D(), { incomeTotal: u } = oe(), { setFilter: C } = se(), [h, f] = l.useState(!1), [p, y] = l.useMemo(() => {
1002
+ const v = c.reduce((R, k) => R + k.totalAmount, 0);
1003
+ let x = v / d;
980
1004
  x > 1 && (x = 1);
981
- let E = t.palette.success.main;
982
- x > 0.8 && x < 1 ? E = t.palette.warning.main : x >= 1 && (E = t.palette.error.main);
1005
+ let O = t.palette.success.main;
1006
+ x > 0.8 && x < 1 ? O = t.palette.warning.main : x >= 1 && (O = t.palette.error.main);
983
1007
  const M = [
984
1008
  {
985
- color: E,
1009
+ color: O,
986
1010
  percentage: `${x}`
987
1011
  }
988
1012
  ];
989
- return [A, M];
990
- }, [g, c]), [y, _] = l.useMemo(() => {
991
- const A = Math.abs(
992
- r.reduce((M, $) => M + $.totalAmount, 0)
1013
+ return [v, M];
1014
+ }, [m, c]), [_, B] = l.useMemo(() => {
1015
+ const v = Math.abs(
1016
+ n.reduce((M, R) => M + R.totalAmount, 0)
993
1017
  );
994
- let x = A / u;
1018
+ let x = v / u;
995
1019
  x > 1 && (x = 1);
996
- const E = [
1020
+ const O = [
997
1021
  {
998
1022
  color: t.palette.secondary.main,
999
1023
  percentage: `${x}`
1000
1024
  }
1001
1025
  ];
1002
- return [A, E];
1003
- }, [r, u]), v = () => {
1004
- B({
1005
- accounts: i.map((A) => A.guid),
1026
+ return [v, O];
1027
+ }, [n, u]), A = () => {
1028
+ C({
1029
+ accounts: i.map((v) => v.guid),
1006
1030
  dateRange: {
1007
- start: it(/* @__PURE__ */ new Date(), 90),
1031
+ start: ct(/* @__PURE__ */ new Date(), 90),
1008
1032
  end: /* @__PURE__ */ new Date()
1009
1033
  }
1010
- }), f(!0), o(L.BUDGETS_CLICK_EDIT_INCOME);
1034
+ }), f(!0), o($.BUDGETS_CLICK_EDIT_INCOME);
1011
1035
  };
1012
- return /* @__PURE__ */ m(fe, { elevation: 2, sx: { overflow: "visible" }, children: [
1013
- /* @__PURE__ */ e(Ee, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Ae, { children: s.overview_title }) }),
1014
- /* @__PURE__ */ e(be, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ m(S, { gap: 24, children: [
1015
- /* @__PURE__ */ m(S, { gap: 8, children: [
1036
+ return /* @__PURE__ */ g(fe, { elevation: 2, sx: { overflow: "visible" }, children: [
1037
+ /* @__PURE__ */ e(Me, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(ve, { children: s.overview_title }) }),
1038
+ /* @__PURE__ */ e(be, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ g(S, { gap: 24, children: [
1039
+ /* @__PURE__ */ g(S, { gap: 8, children: [
1016
1040
  /* @__PURE__ */ e(b, { bold: !0, sx: { mb: 8 }, variant: "Body", children: s.spending_title }),
1017
- /* @__PURE__ */ e(he, { data: C, height: 16 }),
1018
- /* @__PURE__ */ e(b, { variant: "Small", children: R(
1041
+ /* @__PURE__ */ e(he, { data: y, height: 16 }),
1042
+ /* @__PURE__ */ e(b, { variant: "Small", children: L(
1019
1043
  s.spending_description,
1020
1044
  T(p, "0,0"),
1021
1045
  T(d, "0,0")
1022
1046
  ) })
1023
1047
  ] }),
1024
- /* @__PURE__ */ m(S, { gap: 8, children: [
1025
- /* @__PURE__ */ m(S, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
1048
+ /* @__PURE__ */ g(S, { gap: 8, children: [
1049
+ /* @__PURE__ */ g(S, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
1026
1050
  /* @__PURE__ */ e(b, { bold: !0, variant: "Body", children: s.income_title }),
1027
1051
  /* @__PURE__ */ e(
1028
- ct,
1052
+ lt,
1029
1053
  {
1030
- "aria-label": n.manage_income,
1031
- onClick: v,
1054
+ "aria-label": a.manage_income,
1055
+ onClick: A,
1032
1056
  sx: { p: 0 },
1033
- children: /* @__PURE__ */ e(N, { color: "primary", name: "edit" })
1057
+ children: /* @__PURE__ */ e(P, { color: "primary", name: "edit" })
1034
1058
  }
1035
1059
  )
1036
1060
  ] }),
1037
- /* @__PURE__ */ e(he, { data: _, height: 16 }),
1038
- /* @__PURE__ */ e(b, { variant: "Small", children: R(
1061
+ /* @__PURE__ */ e(he, { data: B, height: 16 }),
1062
+ /* @__PURE__ */ e(b, { variant: "Small", children: L(
1039
1063
  s.income_description,
1040
- T(y, "0,0"),
1064
+ T(_, "0,0"),
1041
1065
  T(u, "0,0")
1042
1066
  ) })
1043
1067
  ] })
1044
1068
  ] }) }),
1045
1069
  /* @__PURE__ */ e(
1046
- k,
1070
+ N,
1047
1071
  {
1048
- ariaLabelClose: a.close_aria,
1072
+ ariaLabelClose: r.close_aria,
1049
1073
  isOpen: h,
1050
1074
  onClose: () => f(!1),
1051
- title: n.manage_income,
1052
- children: /* @__PURE__ */ e(lt, { forOverview: !0 })
1075
+ title: a.manage_income,
1076
+ children: /* @__PURE__ */ e(dt, { forOverview: !0 })
1053
1077
  }
1054
1078
  )
1055
1079
  ] });
1056
- }), ve = 480, Nn = I(({ onBackClick: t, sx: o }) => {
1057
- const i = te(), { onEvent: s } = V(), { onLoad: a } = He(), { visibleAccounts: n } = Te(), { budgets: r, common: c } = w(), { isCopyLoaded: g, isInitialized: d, selectedAccounts: u, setDisplayedDate: B, setSelectedAccounts: h } = ae(), {
1080
+ }), Ae = 480, Pn = I(({ onBackClick: t, sx: o }) => {
1081
+ const i = ne(), { onEvent: s } = V(), { onLoad: r } = Xe(), { visibleAccounts: a } = Te(), { budgets: n, common: c } = w(), { isCopyLoaded: m, isInitialized: d, selectedAccounts: u, setDisplayedDate: C, setSelectedAccounts: h } = re(), {
1058
1082
  alert: f,
1059
1083
  dateRange: p,
1060
- isDataLoaded: C,
1061
- loadBudgetData: y,
1062
- setDateRange: _,
1063
- setAlert: v,
1064
- setTheme: A,
1084
+ isDataLoaded: y,
1085
+ loadBudgetData: _,
1086
+ setDateRange: B,
1087
+ setAlert: A,
1088
+ setTheme: v,
1065
1089
  detailedBudgets: x
1066
- } = D(), { loadRepeatingTransactions: E, setDateRange: M } = ne(), { reloadCategoryTotals: $ } = z(), { isSmallTablet: U, isMobile: de, isSmallMobile: F } = ce(), H = U || de || F, [$e, ue] = l.useState(!1);
1067
- l.useEffect(() => (A(i), h(n), _({ start: Q(J()), end: pe(J()) }), s(L.BUDGETS_VIEW), () => {
1068
- _({ start: Q(J()), end: pe(J()) });
1090
+ } = D(), { loadRepeatingTransactions: O, setDateRange: M } = oe(), { reloadCategoryTotals: R } = U(), { isSmallTablet: k, isMobile: ue, isSmallMobile: F } = le(), H = k || ue || F, [Pe, J] = l.useState(!1);
1091
+ l.useEffect(() => (v(i), h(a), B({ start: ee(Q()), end: pe(Q()) }), s($.BUDGETS_VIEW), () => {
1092
+ B({ start: ee(Q()), end: pe(Q()) });
1069
1093
  }), []), l.useEffect(() => {
1070
- h(n);
1071
- }, [n]), l.useEffect(() => {
1072
- d && (B(p.start, p.end), $(u, p.start, p.end).finally(), M(p), C || (E().finally(), y().finally(() => {
1073
- a?.("BubbleBudgetsWidget");
1094
+ h(a);
1095
+ }, [a]), l.useEffect(() => {
1096
+ d && (C(p.start, p.end), R(u, p.start, p.end).finally(), M(p), y || (O().finally(), _().finally(() => {
1097
+ r?.("BubbleBudgetsWidget");
1074
1098
  })));
1075
1099
  }, [d, u, p]);
1076
- const Ne = (_e) => {
1077
- _({ start: _e[0] || /* @__PURE__ */ new Date(), end: _e[1] || /* @__PURE__ */ new Date() });
1078
- }, Pe = () => {
1079
- s(L.BUDGETS_CLICK_FILTER);
1100
+ const Ge = (_e) => {
1101
+ B({ start: _e[0] || /* @__PURE__ */ new Date(), end: _e[1] || /* @__PURE__ */ new Date() });
1102
+ }, je = () => {
1103
+ s($.BUDGETS_CLICK_FILTER);
1080
1104
  }, ye = () => {
1081
- ue(!0), s(L.BUDGETS_CLICK_ADD);
1082
- }, Ge = () => {
1083
- ue(!1);
1084
- }, je = Qe(p.end, Q(/* @__PURE__ */ new Date()));
1085
- return !g || !d || !C ? /* @__PURE__ */ e(j, {}) : /* @__PURE__ */ m(
1086
- Ze,
1105
+ J(!0), s($.BUDGETS_CLICK_ADD);
1106
+ }, ze = () => {
1107
+ J(!1);
1108
+ }, Ue = () => {
1109
+ J(!1);
1110
+ }, Fe = nt(p.end, ee(/* @__PURE__ */ new Date()));
1111
+ return !m || !d || !y ? /* @__PURE__ */ e(z, {}) : /* @__PURE__ */ g(
1112
+ Qe,
1087
1113
  {
1088
- accountOptions: n,
1114
+ accountOptions: a,
1089
1115
  actions: [
1090
1116
  {
1091
1117
  iconName: "add",
1092
- label: r.add_title,
1118
+ label: n.add_title,
1093
1119
  onClick: ye
1094
1120
  }
1095
1121
  ],
1096
1122
  calendarActions: {
1097
- onRangeChanged: Ne,
1098
- shouldDisableNext: je,
1123
+ onRangeChanged: Ge,
1124
+ shouldDisableNext: Fe,
1099
1125
  shouldDisablePicker: !0
1100
1126
  },
1101
- onAccountsFilterClick: Pe,
1127
+ onAccountsFilterClick: je,
1102
1128
  onBackClick: t,
1103
1129
  sx: o,
1104
- title: r.budgets_title,
1130
+ title: n.budgets_title,
1105
1131
  children: [
1106
- (!d || !C) && /* @__PURE__ */ e(j, {}),
1107
- d && C && /* @__PURE__ */ m(
1132
+ (!d || !y) && /* @__PURE__ */ e(z, {}),
1133
+ d && y && /* @__PURE__ */ g(
1108
1134
  S,
1109
1135
  {
1110
1136
  direction: H ? "column" : "row",
@@ -1113,56 +1139,63 @@ const Tt = ({
1113
1139
  width: "100%",
1114
1140
  children: [
1115
1141
  /* @__PURE__ */ e(S, { height: H ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
1116
- Le,
1142
+ $e,
1117
1143
  {
1118
1144
  createBudgetOnClick: ye,
1119
1145
  height: H ? 450 : 800,
1120
1146
  isDraggable: !0,
1121
1147
  shouldShowZeroState: x.length === 0,
1122
- unavailableWidth: H ? 0 : ve
1148
+ unavailableWidth: H ? 0 : Ae
1123
1149
  }
1124
1150
  ) }),
1125
- x.length !== 0 && /* @__PURE__ */ m(
1151
+ x.length !== 0 && /* @__PURE__ */ g(
1126
1152
  S,
1127
1153
  {
1128
1154
  gap: 24,
1129
1155
  height: "100%",
1130
1156
  sx: { mr: 24, mt: 48 },
1131
- width: H ? "100%" : ve,
1157
+ width: H ? "100%" : Ae,
1132
1158
  children: [
1133
- /* @__PURE__ */ e(Gt, {}),
1134
- /* @__PURE__ */ e(Pt, {})
1159
+ /* @__PURE__ */ e(jt, {}),
1160
+ /* @__PURE__ */ e(Gt, {})
1135
1161
  ]
1136
1162
  }
1137
1163
  )
1138
1164
  ]
1139
1165
  }
1140
1166
  ),
1141
- /* @__PURE__ */ e($t, {}),
1167
+ /* @__PURE__ */ e(Nt, {}),
1142
1168
  /* @__PURE__ */ e(
1143
- k,
1169
+ N,
1144
1170
  {
1145
1171
  ariaLabelClose: c.close_aria,
1146
- isOpen: $e,
1147
- onClose: () => ue(!1),
1148
- title: r.add_new_title,
1149
- children: /* @__PURE__ */ e(Oe, { onRecalculateBudgets: Ge })
1172
+ isOpen: Pe,
1173
+ onClose: () => J(!1),
1174
+ title: n.add_new_title,
1175
+ children: /* @__PURE__ */ e(
1176
+ Re,
1177
+ {
1178
+ onAddBudget: ze,
1179
+ onRecalculateBudgets: Ue
1180
+ }
1181
+ )
1150
1182
  }
1151
1183
  ),
1152
1184
  /* @__PURE__ */ e(
1153
- tt,
1185
+ Ie,
1154
1186
  {
1155
1187
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
1156
1188
  autoHideDuration: 3500,
1157
1189
  onClose: () => {
1158
- v("");
1190
+ A("");
1159
1191
  },
1160
1192
  open: !!f,
1161
1193
  children: /* @__PURE__ */ e(
1162
- et,
1194
+ De,
1163
1195
  {
1196
+ closeText: "",
1164
1197
  onClose: () => {
1165
- v("");
1198
+ A("");
1166
1199
  },
1167
1200
  severity: "success",
1168
1201
  variant: "filled",
@@ -1176,6 +1209,6 @@ const Tt = ({
1176
1209
  );
1177
1210
  });
1178
1211
  export {
1179
- $n as BubbleBudgetsMiniWidget,
1180
- Nn as BubbleBudgetsWidget
1212
+ Nn as BubbleBudgetsMiniWidget,
1213
+ Pn as BubbleBudgetsWidget
1181
1214
  };