@mx-cartographer/experiences 7.0.51 → 7.0.52-alpha.mega2

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