@mx-cartographer/experiences 7.0.52-alpha.mega4 → 7.0.52-alpha.mega5

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