@mx-cartographer/experiences 3.13.4-alpha.mm2 → 3.13.4

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.
package/dist/index.es.js CHANGED
@@ -31,9 +31,9 @@ import { eachDayOfInterval as io } from "date-fns/eachDayOfInterval";
31
31
  import { eachWeekOfInterval as oo } from "date-fns/eachWeekOfInterval";
32
32
  import { endOfMonth as DA } from "date-fns/endOfMonth";
33
33
  import { format as kA } from "date-fns/format";
34
- import { isBefore as mA } from "date-fns/isBefore";
34
+ import { isBefore as pA } from "date-fns/isBefore";
35
35
  import { isSameMonth as so } from "date-fns/isSameMonth";
36
- import { startOfMonth as pA } from "date-fns/startOfMonth";
36
+ import { startOfMonth as vA } from "date-fns/startOfMonth";
37
37
  import { startOfToday as J } from "date-fns/startOfToday";
38
38
  import { subMonths as ie } from "date-fns/subMonths";
39
39
  import he from "@mui/material/Paper";
@@ -1681,7 +1681,7 @@ const ec = ({
1681
1681
  h(e), m(n), e && u(e);
1682
1682
  }, [e, n]);
1683
1683
  const f = C.useMemo(() => {
1684
- const L = oo({ start: pA(c), end: DA(c) }), P = [];
1684
+ const L = oo({ start: vA(c), end: DA(c) }), P = [];
1685
1685
  for (let x = 0; x < L.length; x++) {
1686
1686
  const O = L[x], N = io({ start: O, end: me(O, 6) }), q = [];
1687
1687
  for (let B = 0; B < N.length; B++)
@@ -1695,7 +1695,7 @@ const ec = ({
1695
1695
  h(L), r?.(L);
1696
1696
  return;
1697
1697
  }
1698
- !l || g ? (h(L), m(void 0)) : mA(L, l) ? (m(l), h(L), a?.(L, l)) : (m(L), a?.(l, L));
1698
+ !l || g ? (h(L), m(void 0)) : pA(L, l) ? (m(l), h(L), a?.(L, l)) : (m(L), a?.(l, L));
1699
1699
  }
1700
1700
  }, p = () => {
1701
1701
  const L = J();
@@ -1939,9 +1939,6 @@ const ec = ({
1939
1939
  "& .MuiBarLabel-root": {
1940
1940
  fontSize: 10,
1941
1941
  fontWeight: 600
1942
- },
1943
- "& .MuiMarkElement-root": {
1944
- stroke: e ?? f.palette.primary.main
1945
1942
  }
1946
1943
  },
1947
1944
  width: m,
@@ -1977,10 +1974,10 @@ const ec = ({
1977
1974
  oc,
1978
1975
  {
1979
1976
  handlers: i,
1980
- style: o?.(N.dataIndex) ?? {},
1981
- ...N,
1982
1977
  showLabel: l,
1983
- yData: p
1978
+ style: o?.(N.dataIndex) ?? {},
1979
+ yData: p,
1980
+ ...N
1984
1981
  }
1985
1982
  )
1986
1983
  } : void 0
@@ -2213,16 +2210,14 @@ const ec = ({
2213
2210
  height: o,
2214
2211
  width: s
2215
2212
  }) => {
2216
- const c = qA(), { isMobile: u } = KA(), l = C.useRef(null);
2217
- console.log("stackedDatasets", a), console.log("unstackedDatasets", i);
2218
- const [h, g] = C.useState(null), [m, f] = C.useState({
2213
+ const c = qA(), { isMobile: u } = KA(), l = C.useRef(null), [h, g] = C.useState(null), [m, f] = C.useState({
2219
2214
  hoveredSeriesId: null,
2220
2215
  hoveredAreaData: null,
2221
2216
  isAreaHovered: !1,
2222
2217
  cursorPos: { x: 0, y: 0 }
2223
- }), { hoveredSeriesId: y, hoveredAreaData: p, isAreaHovered: S, cursorPos: I } = m, L = S && y && p, P = !L, x = [...a, ...i], O = x[0].dataset.length, N = x.flatMap((R) => R.dataset.map((AA) => AA.x)), q = x.flatMap((R) => R.dataset.map((AA) => AA.y)), B = a[0]?.dataset.map(
2224
- (R, AA) => a.reduce((EA, ZA) => EA + (ZA.dataset[AA]?.y ?? 0), 0)
2225
- ) ?? [0], k = Math.max(...B), X = Math.max(
2218
+ }), { hoveredSeriesId: y, hoveredAreaData: p, isAreaHovered: S, cursorPos: I } = m, L = S && y && p, P = !L, x = [...a, ...i], O = x[0].dataset.length, N = x.flatMap((R) => R.dataset.map((AA) => AA.x)), q = x.flatMap((R) => R.dataset.map((AA) => AA.y)), B = a[0].dataset.map(
2219
+ (R, AA) => a.reduce((mA, ZA) => mA + ZA.dataset[AA]?.y || 0, 0)
2220
+ ), k = Math.max(...B), X = Math.max(
2226
2221
  ...i.flatMap((R) => R.dataset.map((AA) => AA.y))
2227
2222
  ), F = Math.floor(Math.min(...q) / 100) * 100, aA = Math.ceil(Math.max(k, X) / 100) * 100, iA = a.map((R, AA) => ({
2228
2223
  id: `stacked-${AA}`,
@@ -2230,36 +2225,36 @@ const ec = ({
2230
2225
  top_level_guid: R.top_level_category_guid,
2231
2226
  area: !0,
2232
2227
  color: a[AA].category_color ?? c.palette.primary.main,
2233
- data: R.dataset.map((EA) => EA.y),
2228
+ data: R.dataset.map((mA) => mA.y),
2234
2229
  label: a[AA].category_name,
2235
2230
  stack: "total",
2236
2231
  type: "line",
2237
2232
  highlightScope: { highlight: "item" },
2238
- valueFormatter: (EA) => Q(EA, "0,0")
2239
- })), vA = i.map((R, AA) => ({
2233
+ valueFormatter: (mA) => Q(mA, "0,0")
2234
+ })), EA = i.map((R, AA) => ({
2240
2235
  id: `unstacked-${AA}`,
2241
2236
  guid: R.category_guid,
2242
2237
  top_level_guid: R.top_level_category_guid,
2243
2238
  area: !1,
2244
2239
  color: R.category_color,
2245
- data: R.dataset.map((EA) => EA.y),
2240
+ data: R.dataset.map((mA) => mA.y),
2246
2241
  label: R.category_name,
2247
2242
  type: "line",
2248
- valueFormatter: (EA) => Q(EA, "0,0")
2249
- })), uA = [...iA, ...vA], wA = [
2243
+ valueFormatter: (mA) => Q(mA, "0,0")
2244
+ })), uA = [...iA, ...EA], wA = [
2250
2245
  ...iA.map(({ guid: R, top_level_guid: AA }) => ({
2251
2246
  guid: R,
2252
2247
  top_level_guid: AA
2253
2248
  })),
2254
- ...vA.map(({ guid: R, top_level_guid: AA }) => ({
2249
+ ...EA.map(({ guid: R, top_level_guid: AA }) => ({
2255
2250
  guid: R,
2256
2251
  top_level_guid: AA
2257
2252
  }))
2258
2253
  ], le = (R) => {
2259
- const EA = R.startsWith("stacked-") ? a[parseInt(R.split("-")[1])] : i[parseInt(R.split("-")[1])];
2254
+ const mA = R.startsWith("stacked-") ? a[parseInt(R.split("-")[1])] : i[parseInt(R.split("-")[1])];
2260
2255
  return {
2261
- guid: EA.category_guid,
2262
- topLevelGuid: EA.top_level_category_guid
2256
+ guid: mA.category_guid,
2257
+ topLevelGuid: mA.top_level_category_guid
2263
2258
  };
2264
2259
  }, de = (R) => {
2265
2260
  g(R), n?.(R ?? "");
@@ -2271,8 +2266,8 @@ const ec = ({
2271
2266
  {
2272
2267
  onMouseMove: (R) => {
2273
2268
  const AA = R.currentTarget.getBoundingClientRect();
2274
- f((EA) => ({
2275
- ...EA,
2269
+ f((mA) => ({
2270
+ ...mA,
2276
2271
  cursorPos: {
2277
2272
  x: R.clientX - AA.left,
2278
2273
  y: R.clientY - AA.top
@@ -2294,8 +2289,8 @@ const ec = ({
2294
2289
  height: o || 400,
2295
2290
  margin: { bottom: 50 },
2296
2291
  onHighlightChange: (R) => {
2297
- const AA = R?.seriesId && uA.find((ae) => ae.id === R.seriesId), EA = AA && R?.dataIndex !== void 0, ZA = AA && R?.dataIndex === void 0;
2298
- if (EA)
2292
+ const AA = R?.seriesId && uA.find((ae) => ae.id === R.seriesId), mA = AA && R?.dataIndex !== void 0, ZA = AA && R?.dataIndex === void 0;
2293
+ if (mA)
2299
2294
  f({
2300
2295
  hoveredSeriesId: String(R.seriesId),
2301
2296
  hoveredAreaData: null,
@@ -2353,10 +2348,10 @@ const ec = ({
2353
2348
  '& [class*="MuiLineElement-series-unstacked-"]': {
2354
2349
  strokeWidth: 3
2355
2350
  },
2356
- ...h && iA.reduce((R, AA, EA) => {
2357
- const ZA = `.MuiAreaElement-series-stacked-${EA}`;
2351
+ ...h && iA.reduce((R, AA, mA) => {
2352
+ const ZA = `.MuiAreaElement-series-stacked-${mA}`;
2358
2353
  return R[ZA] = {
2359
- opacity: iA[EA].guid === h ? 0.9 : 0.2
2354
+ opacity: iA[mA].guid === h ? 0.9 : 0.2
2360
2355
  }, R;
2361
2356
  }, {})
2362
2357
  },
@@ -2564,7 +2559,7 @@ const ec = ({
2564
2559
  calendarActions: A,
2565
2560
  color: e = "primary",
2566
2561
  copy: n,
2567
- range: r = [pA(J()), DA(Me())],
2562
+ range: r = [vA(J()), DA(Me())],
2568
2563
  shouldShrinkToIcon: a = !0,
2569
2564
  toolTipContent: i = "",
2570
2565
  variant: o = "outlined"
@@ -2584,14 +2579,14 @@ const ec = ({
2584
2579
  const F = DA(Me());
2585
2580
  return [DA(ie(F, x)), F];
2586
2581
  }, B = (F) => {
2587
- const aA = [...h], iA = h[0], vA = h[1], uA = F === "previous";
2582
+ const aA = [...h], iA = h[0], EA = h[1], uA = F === "previous";
2588
2583
  if (m === n.dateRangePickerCopy.dateRangeThisMonth)
2589
- aA[0] = uA ? ie(iA, 1) : $A(iA, 1), aA[1] = DA(uA ? ie(vA, 1) : $A(vA, 1));
2584
+ aA[0] = uA ? ie(iA, 1) : $A(iA, 1), aA[1] = DA(uA ? ie(EA, 1) : $A(EA, 1));
2590
2585
  else if (m === n.dateRangePickerCopy.dateRangeYTD || m === n.dateRangePickerCopy.dateRangeLastYear)
2591
2586
  aA[0] = uA ? Er(vr(iA), 1) : Ct(vr(iA), 1), aA[1] = uA ? Er(pr(iA), 1) : Ct(pr(iA), 1);
2592
2587
  else {
2593
- const wA = xo(vA, iA);
2594
- aA[0] = F === "previous" ? pe(iA, wA) : me(iA, wA), aA[1] = F === "previous" ? pe(vA, wA) : me(vA, wA);
2588
+ const wA = xo(EA, iA);
2589
+ aA[0] = F === "previous" ? pe(iA, wA) : me(iA, wA), aA[1] = F === "previous" ? pe(EA, wA) : me(EA, wA);
2595
2590
  }
2596
2591
  g(aA), A.onRangeChanged(aA);
2597
2592
  }, k = () => {
@@ -3599,7 +3594,7 @@ class Nc {
3599
3594
  api = new zr("/", "");
3600
3595
  categoryApi = new Bt("/", "");
3601
3596
  globalStore;
3602
- dateRange = { start: pA(J()), end: DA(J()) };
3597
+ dateRange = { start: vA(J()), end: DA(J()) };
3603
3598
  budgets = [];
3604
3599
  categoryTotals = [];
3605
3600
  theme = {};
@@ -4285,7 +4280,7 @@ const _c = [
4285
4280
  }, Xc = (A, e, n) => {
4286
4281
  const {
4287
4282
  accounts: r = [],
4288
- dateRange: a = { start: pA(J()), end: Me() },
4283
+ dateRange: a = { start: vA(J()), end: Me() },
4289
4284
  custom: i = () => !0,
4290
4285
  searchTerm: o = ""
4291
4286
  } = A;
@@ -4338,7 +4333,7 @@ const ei = {
4338
4333
  tags: []
4339
4334
  };
4340
4335
  let Yc = class {
4341
- beginDate = pA(/* @__PURE__ */ new Date());
4336
+ beginDate = vA(/* @__PURE__ */ new Date());
4342
4337
  endDate = DA(/* @__PURE__ */ new Date());
4343
4338
  expandedSplits = [];
4344
4339
  isInitialized = !1;
@@ -4396,7 +4391,7 @@ class Vc {
4396
4391
  }
4397
4392
  initialize = async (e, n) => {
4398
4393
  this.api = new Br(e, n), this.beatApi = new Ze(e, n), Promise.all([
4399
- this.loadAssociatedBeats(pA(/* @__PURE__ */ new Date())),
4394
+ this.loadAssociatedBeats(vA(/* @__PURE__ */ new Date())),
4400
4395
  this.loadTags(),
4401
4396
  this.loadTaggings(),
4402
4397
  this.loadTransactionRules(),
@@ -4502,7 +4497,7 @@ class Vc {
4502
4497
  }
4503
4498
  };
4504
4499
  setFilter = (e) => {
4505
- this.filter = e, e.dateRange && mA(e.dateRange.start, this.cachedStartDate) && this.loadTransactions(e.dateRange.start, Me()).then(() => {
4500
+ this.filter = e, e.dateRange && pA(e.dateRange.start, this.cachedStartDate) && this.loadTransactions(e.dateRange.start, Me()).then(() => {
4506
4501
  e.dateRange && (this.cachedStartDate = e.dateRange.start);
4507
4502
  });
4508
4503
  };
@@ -4634,7 +4629,7 @@ const JA = () => {
4634
4629
  }, Ar = (A) => {
4635
4630
  const e = mt(A);
4636
4631
  let n = wn(A, e);
4637
- for (; mA(n, J()); )
4632
+ for (; pA(n, J()); )
4638
4633
  n = Ve(n, 1);
4639
4634
  return n;
4640
4635
  }, el = (A) => {
@@ -4642,7 +4637,7 @@ const JA = () => {
4642
4637
  return Ve(e, 1);
4643
4638
  }, kr = (A) => {
4644
4639
  let e = Ln(J(), A.getDate());
4645
- for (; mA(e, J()); )
4640
+ for (; pA(e, J()); )
4646
4641
  e = $A(e, 1);
4647
4642
  return e;
4648
4643
  }, tl = (A) => {
@@ -4650,7 +4645,7 @@ const JA = () => {
4650
4645
  return $A(e, 1);
4651
4646
  }, ti = (A) => {
4652
4647
  let e = _e(A, 1);
4653
- for (; mA(e, J()); )
4648
+ for (; pA(e, J()); )
4654
4649
  e = _e(e, 1);
4655
4650
  return e;
4656
4651
  }, nl = (A) => {
@@ -5275,7 +5270,7 @@ const fl = ({
5275
5270
  }, jr = (A) => {
5276
5271
  const e = [], n = J();
5277
5272
  for (let r = 0; r < Qr; r++) {
5278
- const a = pA(ie(n, Qr - r)), o = A.filter(
5273
+ const a = vA(ie(n, Qr - r)), o = A.filter(
5279
5274
  (s) => s.year_month === Number(kA(a, "yyyyMM"))
5280
5275
  ).reduce((s, c) => s + c.total, 0);
5281
5276
  e.push({
@@ -5376,7 +5371,7 @@ class Bl {
5376
5371
  }
5377
5372
  };
5378
5373
  loadMonthlyCategoryTotals = async (e = this.globalStore.accountStore.accounts, n, r) => {
5379
- const a = fA(pA(n ?? ie(/* @__PURE__ */ new Date(), 11))), i = fA(DA(r ?? /* @__PURE__ */ new Date()));
5374
+ const a = fA(vA(n ?? ie(/* @__PURE__ */ new Date(), 11))), i = fA(DA(r ?? /* @__PURE__ */ new Date()));
5380
5375
  try {
5381
5376
  const o = await this.api.getMonthlyCategoryTotals(a, i, e);
5382
5377
  U(() => {
@@ -6654,15 +6649,15 @@ const ri = ({ transaction: A }) => {
6654
6649
  selectedAccounts: X,
6655
6650
  setDisplayedDate: F,
6656
6651
  setSelectedAccounts: aA
6657
- } = yA(), [iA, vA] = C.useState(""), [uA, wA] = C.useState(""), [le, de] = C.useState(!1), [ze, R] = C.useState(!1), [AA, EA] = C.useState(!1);
6652
+ } = yA(), [iA, EA] = C.useState(""), [uA, wA] = C.useState(""), [le, de] = C.useState(!1), [ze, R] = C.useState(!1), [AA, mA] = C.useState(!1);
6658
6653
  C.useEffect(() => {
6659
6654
  aA(a);
6660
6655
  }, [a]), C.useEffect(() => {
6661
- const IA = pA(J()), hr = DA(J());
6656
+ const IA = vA(J()), hr = DA(J());
6662
6657
  F(IA, hr), p({
6663
6658
  dateRange: { start: IA, end: hr },
6664
6659
  accounts: X.map((Ui) => Ui.guid)
6665
- }), EA(!0), N(j.TRANSACTIONS_VIEW);
6660
+ }), mA(!0), N(j.TRANSACTIONS_VIEW);
6666
6661
  }, []), C.useEffect(() => {
6667
6662
  AA && (p({
6668
6663
  ...f,
@@ -6689,12 +6684,12 @@ const ri = ({ transaction: A }) => {
6689
6684
  ...ei,
6690
6685
  date: fA(J()),
6691
6686
  user_guid: O?.user_guid || ""
6692
- }), vA(
6687
+ }), EA(
6693
6688
  "addTransaction"
6694
6689
  /* AddTransaction */
6695
6690
  ), N(j.TRANSACTIONS_CLICK_ADD)) : (de(!0), N(j.TRANSACTIONS_ADD_MANUAL_ACCOUNT_MODAL));
6696
6691
  }, Qi = async () => {
6697
- Tt && await m(s), vA("");
6692
+ Tt && await m(s), EA("");
6698
6693
  }, Fi = () => {
6699
6694
  de(!1), R(!0);
6700
6695
  }, ji = () => {
@@ -6744,13 +6739,13 @@ const ri = ({ transaction: A }) => {
6744
6739
  {
6745
6740
  height: `calc(${e} - ${Ur}px)`,
6746
6741
  onCategoryClick: (IA) => {
6747
- wA(IA), vA(
6742
+ wA(IA), EA(
6748
6743
  "category"
6749
6744
  /* Category */
6750
6745
  );
6751
6746
  },
6752
6747
  onRowClick: (IA) => {
6753
- wA(IA), vA(
6748
+ wA(IA), EA(
6754
6749
  "transaction"
6755
6750
  /* Transaction */
6756
6751
  ), N(j.TRANSACTIONS_CLICK_DETAILS, { transaction_guid: IA });
@@ -6771,7 +6766,7 @@ const ri = ({ transaction: A }) => {
6771
6766
  {
6772
6767
  height: `calc(${e} - ${Ur}px)`,
6773
6768
  onClick: (IA) => {
6774
- wA(IA), vA(
6769
+ wA(IA), EA(
6775
6770
  "transaction"
6776
6771
  /* Transaction */
6777
6772
  );
@@ -6787,7 +6782,7 @@ const ri = ({ transaction: A }) => {
6787
6782
  ariaLabelClose: P.close_aria,
6788
6783
  isOpen: iA === "transaction",
6789
6784
  onClose: () => {
6790
- ae && !ae.has_been_viewed && L({ ...ae, has_been_viewed: !0 }), vA("");
6785
+ ae && !ae.has_been_viewed && L({ ...ae, has_been_viewed: !0 }), EA("");
6791
6786
  },
6792
6787
  title: x.details_title,
6793
6788
  children: ae && /* @__PURE__ */ t(Lt, { transaction: ae })
@@ -6797,7 +6792,7 @@ const ri = ({ transaction: A }) => {
6797
6792
  wd,
6798
6793
  {
6799
6794
  onClose: () => {
6800
- vA(""), wA("");
6795
+ EA(""), wA("");
6801
6796
  },
6802
6797
  transaction: ae
6803
6798
  }
@@ -6808,7 +6803,7 @@ const ri = ({ transaction: A }) => {
6808
6803
  ariaLabelClose: P.close_aria,
6809
6804
  isOpen: iA === "addTransaction",
6810
6805
  isPrimaryDisabled: !Tt,
6811
- onClose: () => vA(""),
6806
+ onClose: () => EA(""),
6812
6807
  onPrimaryAction: Qi,
6813
6808
  title: x.add_transaction_title,
6814
6809
  children: /* @__PURE__ */ t(Ed, {})
@@ -7543,7 +7538,7 @@ const ri = ({ transaction: A }) => {
7543
7538
  };
7544
7539
  }), s = r.filter(
7545
7540
  (l) => Je(TA(l.expected_date), {
7546
- start: pA(J()),
7541
+ start: vA(J()),
7547
7542
  end: me(J(), 30)
7548
7543
  })
7549
7544
  ).filter((l) => {
@@ -7593,19 +7588,19 @@ const ri = ({ transaction: A }) => {
7593
7588
  recurrenceDay: e.recurrence_day,
7594
7589
  scheduledPaymentGuid: e.guid,
7595
7590
  transactionGuid: ""
7596
- }, c = e.recurrence_day, u = J(), l = pA(J()), h = me(J(), 30);
7591
+ }, c = e.recurrence_day, u = J(), l = vA(J()), h = me(J(), 30);
7597
7592
  let g = l;
7598
7593
  switch (e.recurrence_type) {
7599
7594
  case K.EveryWeek:
7600
- for (g = wn(g, c); mA(g, h); )
7595
+ for (g = wn(g, c); pA(g, h); )
7601
7596
  r.push({
7602
7597
  ...s,
7603
7598
  expectedDate: g
7604
7599
  }), g = wn(g, c);
7605
7600
  break;
7606
7601
  case K.EveryOtherWeek:
7607
- if (mA(o, l))
7608
- for (g = Ve(o, 2); mA(g, h); )
7602
+ if (pA(o, l))
7603
+ for (g = Ve(o, 2); pA(g, h); )
7609
7604
  ft(g, l) && r.push({
7610
7605
  ...s,
7611
7606
  expectedDate: g
@@ -7619,7 +7614,7 @@ const ri = ({ transaction: A }) => {
7619
7614
  ...s,
7620
7615
  expectedDate: g
7621
7616
  }), g = yr(g, 2);
7622
- for (g = Ve(o, 2); mA(g, h); )
7617
+ for (g = Ve(o, 2); pA(g, h); )
7623
7618
  r.push({
7624
7619
  ...s,
7625
7620
  expectedDate: g
@@ -7636,37 +7631,37 @@ const ri = ({ transaction: A }) => {
7636
7631
  });
7637
7632
  break;
7638
7633
  case K.EveryOtherMonth:
7639
- mA(o, l) ? mA($A(o, 2), h) && r.push({
7634
+ pA(o, l) ? pA($A(o, 2), h) && r.push({
7640
7635
  ...s,
7641
7636
  expectedDate: $A(o, 2)
7642
- }) : mA(o, h) && r.push({
7637
+ }) : pA(o, h) && r.push({
7643
7638
  ...s,
7644
7639
  expectedDate: o
7645
7640
  });
7646
7641
  break;
7647
7642
  case K.EveryQuarter:
7648
- mA(o, l) ? mA(_e(o, 1), h) && r.push({
7643
+ pA(o, l) ? pA(_e(o, 1), h) && r.push({
7649
7644
  ...s,
7650
7645
  expectedDate: _e(o, 1)
7651
- }) : mA(o, h) && r.push({
7646
+ }) : pA(o, h) && r.push({
7652
7647
  ...s,
7653
7648
  expectedDate: o
7654
7649
  });
7655
7650
  break;
7656
7651
  case K.EveryOtherQuarter:
7657
- mA(o, l) ? mA(_e(o, 2), h) && r.push({
7652
+ pA(o, l) ? pA(_e(o, 2), h) && r.push({
7658
7653
  ...s,
7659
7654
  expectedDate: _e(o, 2)
7660
- }) : mA(o, h) && r.push({
7655
+ }) : pA(o, h) && r.push({
7661
7656
  ...s,
7662
7657
  expectedDate: o
7663
7658
  });
7664
7659
  break;
7665
7660
  case K.EveryYear:
7666
- mA(o, l) ? mA(Ct(o, 1), h) && r.push({
7661
+ pA(o, l) ? pA(Ct(o, 1), h) && r.push({
7667
7662
  ...s,
7668
7663
  expectedDate: Ct(o, 1)
7669
- }) : mA(o, h) && r.push({
7664
+ }) : pA(o, h) && r.push({
7670
7665
  ...s,
7671
7666
  expectedDate: o
7672
7667
  });
@@ -7676,7 +7671,7 @@ const ri = ({ transaction: A }) => {
7676
7671
  const f = n.find(
7677
7672
  (y) => y.scheduled_payment_guid === m.scheduledPaymentGuid && y.date > fA(pe(m.expectedDate, 3)) && y.date < fA(me(m.expectedDate, 3))
7678
7673
  );
7679
- f ? (m.transactionGuid = f.guid, m.occurredOnDate = TA(f.date), m.activityStatus = SA.Paid) : mA(m.expectedDate, pe(u, 3)) && (m.activityStatus = SA.Missed);
7674
+ f ? (m.transactionGuid = f.guid, m.occurredOnDate = TA(f.date), m.activityStatus = SA.Paid) : pA(m.expectedDate, pe(u, 3)) && (m.activityStatus = SA.Missed);
7680
7675
  }), r;
7681
7676
  }, Xd = (A, e, n, r, a) => r.map((i) => {
7682
7677
  const o = e.find((h) => h.cashflow_sequence_guid === i.guid), s = n.find((h) => h.cashflow_sequence_guid === i.guid), c = a.find((h) => h.guid === o?.transaction_guid), u = A.find((h) => h.guid === c?.account_guid);
@@ -7740,16 +7735,16 @@ const ri = ({ transaction: A }) => {
7740
7735
  A === 1 && /* @__PURE__ */ t(mi, {})
7741
7736
  ] });
7742
7737
  }, pi = b(Fd), it = (A, e) => A + e.amount, Cn = (A) => A.activityType === LA.Income && Je(A.expectedDate, {
7743
- start: pA(J()),
7738
+ start: vA(J()),
7744
7739
  end: DA(J())
7745
7740
  }), xt = (A) => A.activityType === LA.Expense && Je(A.expectedDate, {
7746
- start: pA(J()),
7741
+ start: vA(J()),
7747
7742
  end: DA(J())
7748
7743
  }), fn = (A) => A.occurredOnDate && Je(A.occurredOnDate, {
7749
- start: pA(/* @__PURE__ */ new Date()),
7744
+ start: vA(/* @__PURE__ */ new Date()),
7750
7745
  end: me(J(), 30)
7751
7746
  }) || Je(A.expectedDate, {
7752
- start: pA(/* @__PURE__ */ new Date()),
7747
+ start: vA(/* @__PURE__ */ new Date()),
7753
7748
  end: me(J(), 30)
7754
7749
  }), jd = ({ day: A, outsideCurrentMonth: e, ...n }) => {
7755
7750
  const { recurring: r } = D(), { selectedAccountGuids: a } = yA(), { activities: i, setSelectedDay: o } = HA(), c = C.useMemo(
@@ -7835,7 +7830,7 @@ const ri = ({ transaction: A }) => {
7835
7830
  Bn,
7836
7831
  {
7837
7832
  maxDate: DA($A(/* @__PURE__ */ new Date(), 1)),
7838
- minDate: pA(/* @__PURE__ */ new Date()),
7833
+ minDate: vA(/* @__PURE__ */ new Date()),
7839
7834
  onMonthChange: i,
7840
7835
  showDaysOutsideCurrentMonth: !0,
7841
7836
  slots: {
@@ -8279,7 +8274,7 @@ class iu {
8279
8274
  loadExpectedEvents = async () => {
8280
8275
  try {
8281
8276
  const e = await this.cashflowApi.getProjectedCashflowEvents(
8282
- pA(J()),
8277
+ vA(J()),
8283
8278
  me(J(), 30)
8284
8279
  );
8285
8280
  U(() => {
@@ -8591,7 +8586,7 @@ const fu = ({ activity: A }) => /* @__PURE__ */ d(rA, { children: [
8591
8586
  ),
8592
8587
  /* @__PURE__ */ t(G, {})
8593
8588
  ] });
8594
- }, Zr = b(mu), $r = (A, e) => (n) => n.accountGuid === A.guid && (kn(n.expectedDate) || ft(n.expectedDate, e.start)) && mA(n.expectedDate, e.end), pu = () => {
8589
+ }, Zr = b(mu), $r = (A, e) => (n) => n.accountGuid === A.guid && (kn(n.expectedDate) || ft(n.expectedDate, e.start)) && pA(n.expectedDate, e.end), pu = () => {
8595
8590
  const { cashflow: A } = D(), { upcomingExpenses: e, upcomingIncome: n } = HA(), { dateRange: r, selectedCashAccounts: a } = tt();
8596
8591
  return /* @__PURE__ */ d(w, { children: [
8597
8592
  /* @__PURE__ */ d(w, { flexDirection: "row", justifyContent: "space-between", children: [
@@ -8930,7 +8925,7 @@ const fu = ({ activity: A }) => /* @__PURE__ */ d(rA, { children: [
8930
8925
  e && /* @__PURE__ */ t(NA, { amount: A, component: "h2", symbol: a, variant: "Small" })
8931
8926
  ]
8932
8927
  }
8933
- ), Aa = (A, e) => (n) => n.accountGuid && A.includes(n.accountGuid) && (kn(n.expectedDate) || ft(n.expectedDate, e.start)) && mA(n.expectedDate, e.end), Su = () => {
8928
+ ), Aa = (A, e) => (n) => n.accountGuid && A.includes(n.accountGuid) && (kn(n.expectedDate) || ft(n.expectedDate, e.start)) && pA(n.expectedDate, e.end), Su = () => {
8934
8929
  const [A, e] = C.useState(!1), { availableWidth: n } = wt(), { cashflow: r } = D(), { upcomingExpenses: a, upcomingIncome: i } = HA(), { selectedAccountGuids: o } = yA(), { dateRange: s, selectedCashAccounts: c } = tt(), { userProfile: u } = en(), l = C.useMemo(
8935
8930
  () => a.filter(Aa(o, s)),
8936
8931
  [s, o, a]
@@ -9137,7 +9132,7 @@ const fu = ({ activity: A }) => /* @__PURE__ */ d(rA, { children: [
9137
9132
  ), F = !!n.length, aA = async () => {
9138
9133
  O(2), c(
9139
9134
  // Beginning of the month, 90 days before today
9140
- pA(pe(J(), 90)),
9135
+ vA(pe(J(), 90)),
9141
9136
  J()
9142
9137
  ), l({ ...u, custom: vt }), O(3);
9143
9138
  }, iA = async () => {
@@ -9156,7 +9151,7 @@ const fu = ({ activity: A }) => /* @__PURE__ */ d(rA, { children: [
9156
9151
  }
9157
9152
  i();
9158
9153
  }
9159
- }, vA = !X && m || !X && N.length < 1;
9154
+ }, EA = !X && m || !X && N.length < 1;
9160
9155
  return /* @__PURE__ */ d(
9161
9156
  T,
9162
9157
  {
@@ -9218,7 +9213,7 @@ const fu = ({ activity: A }) => /* @__PURE__ */ d(rA, { children: [
9218
9213
  )
9219
9214
  ] })
9220
9215
  ] }),
9221
- vA && /* @__PURE__ */ t(
9216
+ EA && /* @__PURE__ */ t(
9222
9217
  hi,
9223
9218
  {
9224
9219
  bgcolor: "background.paper",
@@ -9401,7 +9396,7 @@ let zu = class {
9401
9396
  // if there is no income activity
9402
9397
  get expensesTilNextIncome() {
9403
9398
  return this.upcomingExpenses.filter(
9404
- (e) => mA(e.expectedDate, this.nextIncome?.expectedDate || DA(/* @__PURE__ */ new Date()))
9399
+ (e) => pA(e.expectedDate, this.nextIncome?.expectedDate || DA(/* @__PURE__ */ new Date()))
9405
9400
  );
9406
9401
  }
9407
9402
  setNextIncome = (e) => {
@@ -9446,7 +9441,7 @@ class qu {
9446
9441
  selectedAccountGuids = this.selectedAccounts.map((e) => e.guid);
9447
9442
  displayedDate = /* @__PURE__ */ new Date();
9448
9443
  displayedDateRange = {
9449
- start: pA(this.displayedDate),
9444
+ start: vA(this.displayedDate),
9450
9445
  end: DA(this.displayedDate)
9451
9446
  };
9452
9447
  constructor(e) {
@@ -9576,7 +9571,7 @@ const yi = 13, Qu = (A, e) => A.filter((n) => {
9576
9571
  }), Fu = (A, e) => [...A, ...e], ju = (A) => {
9577
9572
  if (A && A.length > 0)
9578
9573
  return A[A.length - 1];
9579
- }, Uu = (A, e) => A.year_month - e.year_month, Wu = () => Array.from({ length: yi }, (A, e) => Math.floor(pA(ie(/* @__PURE__ */ new Date(), e)).getTime() / 1e3)).sort(), Yu = (A, e, n) => !A.length || !e.length ? [] : Wu().reduceRight((a, i) => {
9574
+ }, Uu = (A, e) => A.year_month - e.year_month, Wu = () => Array.from({ length: yi }, (A, e) => Math.floor(vA(ie(/* @__PURE__ */ new Date(), e)).getTime() / 1e3)).sort(), Yu = (A, e, n) => !A.length || !e.length ? [] : Wu().reduceRight((a, i) => {
9580
9575
  const o = e.filter(
9581
9576
  ({ year_month: l }) => l === parseInt(kA(TA(i), "yyyyMM"))
9582
9577
  ), s = A.map((l) => {
@@ -10687,9 +10682,9 @@ const mn = ({
10687
10682
  ] });
10688
10683
  }, N1 = b(P1), ln = (A) => A.top_level_category_guid === v.INCOME || A.category_guid === v.INCOME, M1 = (A) => !ln(A) && !Si(A), Li = (A) => Lr.includes(A.top_level_category_guid) || Lr.includes(A.category_guid), Si = (A) => A.top_level_category_guid === v.TRANSFER || A.category_guid === v.TRANSFER, R1 = (A) => !ln(A) && !Li(A) && !Si(A), H1 = (A) => A.filter((e) => e.category_guid === e.top_level_category_guid), sr = (A, e) => {
10689
10684
  const n = [];
10690
- let r = pA(ie(/* @__PURE__ */ new Date(), 5));
10685
+ let r = vA(ie(/* @__PURE__ */ new Date(), 5));
10691
10686
  const a = /* @__PURE__ */ new Date();
10692
- for (; mA(r, a); )
10687
+ for (; pA(r, a); )
10693
10688
  n.push({
10694
10689
  x: $(r, Y.MONTH_SHORT),
10695
10690
  y: A.filter((i) => i.year === r.getFullYear() && i.month === r.getMonth() + 1).reduce((i, o) => i + o.total, 0)
@@ -12044,7 +12039,7 @@ const aa = 5, ih = 100, ia = 25, oh = (A) => {
12044
12039
  O(B), I({
12045
12040
  accounts: s,
12046
12041
  dateRange: {
12047
- start: pA(/* @__PURE__ */ new Date()),
12042
+ start: vA(/* @__PURE__ */ new Date()),
12048
12043
  end: Me()
12049
12044
  },
12050
12045
  custom: (k) => k.category_guid === B.category_guid || k.top_level_category_guid === B.category_guid
@@ -14849,22 +14844,22 @@ const St = C.createContext(null), ag = ({
14849
14844
  onTouchStart: k,
14850
14845
  ref: g,
14851
14846
  children: [
14852
- A.map((iA, vA) => /* @__PURE__ */ t(
14847
+ A.map((iA, EA) => /* @__PURE__ */ t(
14853
14848
  fg,
14854
14849
  {
14855
14850
  ariaLabel: _(
14856
14851
  L.card_position_in_carousel_aria,
14857
- vA + 1,
14852
+ EA + 1,
14858
14853
  A.length + 1
14859
14854
  ),
14860
14855
  beat: iA,
14861
- index: vA,
14862
- isActiveCard: vA === F,
14856
+ index: EA,
14857
+ isActiveCard: EA === F,
14863
14858
  onCardClick: a,
14864
14859
  posthog: i,
14865
14860
  ...X
14866
14861
  },
14867
- `${iA.guid} ${vA}`
14862
+ `${iA.guid} ${EA}`
14868
14863
  )),
14869
14864
  /* @__PURE__ */ t(
14870
14865
  Og,
@@ -15524,7 +15519,7 @@ const St = C.createContext(null), ag = ({
15524
15519
  C.useEffect(() => {
15525
15520
  o(
15526
15521
  n,
15527
- pA(/* @__PURE__ */ new Date()),
15522
+ vA(/* @__PURE__ */ new Date()),
15528
15523
  DA(/* @__PURE__ */ new Date())
15529
15524
  ).finally();
15530
15525
  }, [n]);
@@ -15867,7 +15862,7 @@ const St = C.createContext(null), ag = ({
15867
15862
  C.useEffect(() => {
15868
15863
  o(n);
15869
15864
  }, [n]), C.useEffect(() => {
15870
- i(pA(J()), DA(J())), u(!0), s(j.SPENDING_VIEW);
15865
+ i(vA(J()), DA(J())), u(!0), s(j.SPENDING_VIEW);
15871
15866
  }, []);
15872
15867
  const l = (h) => {
15873
15868
  i(h[0], h[1]);
@@ -15885,7 +15880,7 @@ const St = C.createContext(null), ag = ({
15885
15880
  }
15886
15881
  );
15887
15882
  }, M7 = b(Qg), Fg = (A) => xe[A] ?? xe.default, jg = (A) => Ke[A], Ug = (A) => A.reduce((e, n) => {
15888
- const r = pA(new Date(n.year, n.month - 1)), a = {
15883
+ const r = vA(new Date(n.year, n.month - 1)), a = {
15889
15884
  top_level_category_guid: n.top_level_category_guid,
15890
15885
  category_guid: n.category_guid,
15891
15886
  amount: n.total,
@@ -16025,7 +16020,7 @@ const St = C.createContext(null), ag = ({
16025
16020
  ) });
16026
16021
  }, A3 = ({ onBackClick: A, sx: e }) => {
16027
16022
  const n = qA(), { onEvent: r } = Z(), { isDesktop: a, isTablet: i, isMobile: o } = KA(), { accounts: s } = PA(), { loadMonthlyCategoryTotals: c, monthlyCategoryTotals: u } = MA(), { isInitialized: l, selectedAccounts: h, setSelectedAccounts: g } = yA(), { trends: m } = D(), f = n.palette.mode === "dark", [y, p] = C.useState(!1), [S, I] = C.useState("Chart"), [L, P] = C.useState(""), [x, O] = C.useState({
16028
- start: pA(ie(/* @__PURE__ */ new Date(), 5)),
16023
+ start: vA(ie(/* @__PURE__ */ new Date(), 5)),
16029
16024
  end: DA(/* @__PURE__ */ new Date())
16030
16025
  }), [N, q] = C.useState(6);
16031
16026
  C.useEffect(() => {
@@ -16045,10 +16040,10 @@ const St = C.createContext(null), ag = ({
16045
16040
  ), k = C.useMemo(() => {
16046
16041
  const R = L.length ? B.filter(
16047
16042
  (ZA) => ZA.top_level_category_guid === L || ZA.category_guid === L
16048
- ) : H1(B), AA = R.filter(M1), EA = R.filter(ln);
16043
+ ) : H1(B), AA = R.filter(M1), mA = R.filter(ln);
16049
16044
  return {
16050
16045
  stackedDatasets: AA,
16051
- unstackedDatasets: EA
16046
+ unstackedDatasets: mA
16052
16047
  };
16053
16048
  }, [B, L]), X = C.useMemo(() => {
16054
16049
  const R = Ea(
@@ -16074,11 +16069,11 @@ const St = C.createContext(null), ag = ({
16074
16069
  }, [x, o]), aA = (R, AA) => {
16075
16070
  I(AA ?? S), r(j.TRENDS_CLICK_TOGGLE);
16076
16071
  }, iA = (R) => {
16077
- const AA = R?.[0], EA = R?.[1], ZA = vs(EA, AA);
16078
- O({ start: AA, end: EA }), r(j.TRENDS_CLICK_DATE, {
16072
+ const AA = R?.[0], mA = R?.[1], ZA = vs(mA, AA);
16073
+ c(h, AA, mA), O({ start: AA, end: mA }), r(j.TRENDS_CLICK_DATE, {
16079
16074
  time_period: ZA + "M"
16080
16075
  }), q(ZA);
16081
- }, vA = () => {
16076
+ }, EA = () => {
16082
16077
  r(j.TRENDS_CLICK_FILTER);
16083
16078
  }, uA = (R) => {
16084
16079
  P(R);
@@ -16098,7 +16093,7 @@ const St = C.createContext(null), ag = ({
16098
16093
  calendarActions: { onRangeChanged: iA },
16099
16094
  dateRange: x,
16100
16095
  dateRangeVariant: "timeframebuttons",
16101
- onAccountsFilterClick: vA,
16096
+ onAccountsFilterClick: EA,
16102
16097
  onBackClick: A,
16103
16098
  sx: e,
16104
16099
  title: m.title,
@@ -16210,9 +16205,9 @@ const St = C.createContext(null), ag = ({
16210
16205
  const e = [], n = A.filter(
16211
16206
  (i) => i.top_level_category_guid !== v.INCOME && i.top_level_category_guid !== v.TRANSFER && i.total > 0
16212
16207
  );
16213
- let r = pA(ie(/* @__PURE__ */ new Date(), 5));
16208
+ let r = vA(ie(/* @__PURE__ */ new Date(), 5));
16214
16209
  const a = DA(/* @__PURE__ */ new Date());
16215
- for (; mA(r, a); )
16210
+ for (; pA(r, a); )
16216
16211
  e.push({
16217
16212
  x: $(r, Y.MONTH_SHORT),
16218
16213
  y: n.filter((i) => i.year === r.getFullYear() && i.month === r.getMonth() + 1).reduce((i, o) => i + o.total, 0)
@@ -16223,6 +16218,7 @@ const St = C.createContext(null), ag = ({
16223
16218
  return /* @__PURE__ */ t(
16224
16219
  Un,
16225
16220
  {
16221
+ baseline: "min",
16226
16222
  colors: [A.palette.primary.main],
16227
16223
  datasets: [r],
16228
16224
  height: 300,