@mx-cartographer/experiences 7.0.52-alpha.mega6 → 7.0.52-alpha.sms1

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