@burdenoff/microfe-brainyrich 2026.825.1 → 2026.828.1

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.
Files changed (38) hide show
  1. package/dist/brainyrich/components/reuse/DocumentsPanel.d.ts +4 -0
  2. package/dist/brainyrich/components/reuse/DocumentsPanel.d.ts.map +1 -1
  3. package/dist/brainyrich/components/reuse/DocumentsPanel.js +150 -99
  4. package/dist/brainyrich/components/reuse/DocumentsPanel.js.map +1 -1
  5. package/dist/brainyrich/hooks/useBrainyRichApi.d.ts +179 -1
  6. package/dist/brainyrich/hooks/useBrainyRichApi.d.ts.map +1 -1
  7. package/dist/brainyrich/hooks/useBrainyRichApi.js +101 -83
  8. package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -1
  9. package/dist/brainyrich/pages/AccountsPage.d.ts.map +1 -1
  10. package/dist/brainyrich/pages/AccountsPage.js +159 -148
  11. package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
  12. package/dist/brainyrich/pages/AdminFirmPage.d.ts.map +1 -1
  13. package/dist/brainyrich/pages/AdminFirmPage.js +115 -83
  14. package/dist/brainyrich/pages/AdminFirmPage.js.map +1 -1
  15. package/dist/brainyrich/pages/AiAssistantPage.d.ts.map +1 -1
  16. package/dist/brainyrich/pages/AiAssistantPage.js +251 -230
  17. package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
  18. package/dist/brainyrich/pages/FirmPage.d.ts.map +1 -1
  19. package/dist/brainyrich/pages/FirmPage.js +148 -116
  20. package/dist/brainyrich/pages/FirmPage.js.map +1 -1
  21. package/dist/brainyrich/pages/PortfoliosPage.d.ts +14 -0
  22. package/dist/brainyrich/pages/PortfoliosPage.d.ts.map +1 -1
  23. package/dist/brainyrich/pages/PortfoliosPage.js +530 -353
  24. package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
  25. package/dist/brainyrich/pages/RiskPage.d.ts.map +1 -1
  26. package/dist/brainyrich/pages/RiskPage.js +381 -396
  27. package/dist/brainyrich/pages/RiskPage.js.map +1 -1
  28. package/dist/brainyrich/pages/_shared.d.ts +21 -0
  29. package/dist/brainyrich/pages/_shared.d.ts.map +1 -1
  30. package/dist/brainyrich/pages/_shared.js +66 -31
  31. package/dist/brainyrich/pages/_shared.js.map +1 -1
  32. package/dist/generated/global-operations.d.ts +31 -1
  33. package/dist/generated/global-operations.d.ts.map +1 -1
  34. package/dist/generated/wspace-operations.d.ts +31 -1
  35. package/dist/generated/wspace-operations.d.ts.map +1 -1
  36. package/dist/test/setup.d.ts +1 -0
  37. package/dist/test/setup.d.ts.map +1 -0
  38. package/package.json +11 -2
@@ -10,10 +10,10 @@ import { hapticSuccess as le, showToast as ue } from "../utils/nativeControls.js
10
10
  import { useTrackBrainyRichPageView as de } from "../hooks/useBrainyRichAnalytics.js";
11
11
  import { DocumentsPanel as h } from "../components/reuse/DocumentsPanel.js";
12
12
  import { TagField as g } from "../components/reuse/TagField.js";
13
- import { useMemo as fe, useState as _ } from "react";
14
- import { Archive as pe, ArrowDownRight as v, ArrowUpRight as y, Building2 as me, CheckCircle2 as he, ChevronRight as ge, Landmark as b, Layers as _e, MoreHorizontal as ve, Pencil as ye, Plus as be, Receipt as x, Wallet as xe } from "lucide-react";
13
+ import { useEffect as fe, useMemo as pe, useState as _ } from "react";
14
+ import { Archive as me, ArrowDownRight as v, ArrowUpRight as y, Building2 as he, CheckCircle2 as ge, ChevronRight as _e, Landmark as b, Layers as ve, MoreHorizontal as ye, Pencil as be, Plus as xe, Receipt as x, Wallet as Se } from "lucide-react";
15
15
  import { jsx as S, jsxs as C } from "react/jsx-runtime";
16
- import { Badge as w, Button as T, Card as Se, CardContent as Ce, CardDescription as we, CardHeader as Te, CardTitle as Ee, Dialog as E, DialogClose as De, DialogContent as D, DialogDescription as O, DialogFooter as k, DialogHeader as A, DialogTitle as j, DropdownMenu as Oe, DropdownMenuContent as ke, DropdownMenuItem as Ae, DropdownMenuTrigger as je, Input as M, Label as N, Select as Me, SelectContent as Ne, SelectItem as Pe, SelectTrigger as Fe, SelectValue as Ie, Sheet as P, SheetContent as F, SheetDescription as I, SheetHeader as L, SheetTitle as Le, Table as Re, TableBody as ze, TableCell as R, TableHead as z, TableHeader as Be, TableRow as B, Tabs as V, TabsContent as H, TabsList as U, TabsTrigger as W, Textarea as Ve } from "@burdenoff/fe-libs/ui";
16
+ import { Badge as w, Button as T, Card as Ce, CardContent as we, CardDescription as Te, CardHeader as Ee, CardTitle as De, DropdownMenu as Oe, DropdownMenuContent as ke, DropdownMenuItem as Ae, DropdownMenuTrigger as je, Input as E, Label as D, ResponsiveDialog as O, ResponsiveDialogClose as Me, ResponsiveDialogContent as k, ResponsiveDialogDescription as A, ResponsiveDialogFooter as j, ResponsiveDialogHeader as M, ResponsiveDialogTitle as N, Select as Ne, SelectContent as Pe, SelectItem as Fe, SelectTrigger as Ie, SelectValue as Le, Sheet as P, SheetContent as F, SheetDescription as I, SheetHeader as L, SheetTitle as Re, Table as ze, TableBody as Be, TableCell as R, TableHead as z, TableHeader as Ve, TableRow as B, Tabs as V, TabsContent as H, TabsList as U, TabsTrigger as W, Textarea as He } from "@burdenoff/fe-libs/ui";
17
17
  //#region src/brainyrich/pages/AccountsPage.tsx
18
18
  var G = [
19
19
  "BANK",
@@ -24,7 +24,7 @@ var G = [
24
24
  "REAL_ESTATE",
25
25
  "ALTERNATIVE",
26
26
  "LIABILITY"
27
- ], He = [
27
+ ], Ue = [
28
28
  "BUY",
29
29
  "SELL",
30
30
  "DIVIDEND",
@@ -33,7 +33,7 @@ var G = [
33
33
  "WITHDRAWAL",
34
34
  "FEE",
35
35
  "TRANSFER"
36
- ], Ue = {
36
+ ], We = {
37
37
  BANK: "teal",
38
38
  BROKERAGE: "brand",
39
39
  RETIREMENT: "blue",
@@ -59,7 +59,7 @@ var J = {
59
59
  cashBalance: "",
60
60
  accountMask: "",
61
61
  householdId: null
62
- }, We = {
62
+ }, Ge = {
63
63
  type: "DEPOSIT",
64
64
  tradeDate: "",
65
65
  symbol: "",
@@ -71,7 +71,15 @@ var J = {
71
71
  };
72
72
  function Y() {
73
73
  de("brainyrich.accounts.viewed");
74
- let e = t().data, a = i(), [o, l] = _(void 0), [se, h] = _(!1), [g, v] = _(J), [y, x] = _(null), [P, F] = _(J), [I, L] = _(null), [Le, V] = _(!1), [H, U] = _(void 0), [W, G] = _(We), K = r(), Y = te(), qe = n(), X = ee(), Je = e.reduce((e, t) => e + (t.cashBalance ?? 0), 0), Ye = e.filter((e) => e.status === "ACTIVE").length, Xe = new Set(e.map((e) => e.institution).filter((e) => !!e)).size, Z = e[0]?.currency ?? "USD", Ze = fe(() => {
74
+ let e = t().data, a = i(), [o, l] = _(void 0), [se, h] = _(!1), [g, v] = _(J), [y, x] = _(null), [P, F] = _(J), [I, L] = _(null), [Re, V] = _(!1), [H, U] = _(void 0), [W, G] = _(void 0), [K, Y] = _(Ge), X = r(), Z = te(), Je = n(), Q = ee();
75
+ fe(() => {
76
+ if (!W) return;
77
+ let e = window.setTimeout(() => {
78
+ G(void 0), V(!0);
79
+ }, 320);
80
+ return () => window.clearTimeout(e);
81
+ }, [W]);
82
+ let Ye = e.reduce((e, t) => e + (t.cashBalance ?? 0), 0), Xe = e.filter((e) => e.status === "ACTIVE").length, Ze = new Set(e.map((e) => e.institution).filter((e) => !!e)).size, Qe = e[0]?.currency ?? "USD", $e = pe(() => {
75
83
  let t = /* @__PURE__ */ new Map();
76
84
  for (let n of e) {
77
85
  let e = n.cashBalance ?? 0;
@@ -80,14 +88,14 @@ function Y() {
80
88
  return [...t.entries()].map(([e, t]) => ({
81
89
  label: e.replace(/_/g, " "),
82
90
  value: t,
83
- tone: Ue[e]
91
+ tone: We[e]
84
92
  })).sort((e, t) => t.value - e.value);
85
93
  }, [e]);
86
- function Qe() {
94
+ function et() {
87
95
  v(J), h(!0);
88
96
  }
89
- function $e() {
90
- g.name.trim() && K.mutate({
97
+ function tt() {
98
+ g.name.trim() && X.mutate({
91
99
  name: g.name.trim(),
92
100
  type: g.type,
93
101
  institution: g.institution.trim() || null,
@@ -97,7 +105,7 @@ function Y() {
97
105
  householdId: g.householdId
98
106
  }, { onSuccess: () => h(!1) });
99
107
  }
100
- function et(e) {
108
+ function nt(e) {
101
109
  x(e), F({
102
110
  name: e.name,
103
111
  type: e.type,
@@ -108,8 +116,8 @@ function Y() {
108
116
  householdId: e.householdId
109
117
  });
110
118
  }
111
- function tt() {
112
- !y || !P.name.trim() || Y.mutate({
119
+ function rt() {
120
+ !y || !P.name.trim() || Z.mutate({
113
121
  id: y.id,
114
122
  input: {
115
123
  name: P.name.trim(),
@@ -122,35 +130,36 @@ function Y() {
122
130
  }
123
131
  }, { onSuccess: () => x(null) });
124
132
  }
125
- function nt() {
133
+ function it() {
126
134
  if (!I) return;
127
135
  let e = I.id;
128
- qe.mutate(e, { onSuccess: () => {
136
+ Je.mutate(e, { onSuccess: () => {
129
137
  le(), ue("Account archived"), L(null), o === e && l(void 0);
130
138
  } });
131
139
  }
132
- function rt(e) {
133
- G(We), U(e), l(void 0), V(!0);
140
+ function at(e) {
141
+ Y(Ge), U(e), l(void 0), G(e);
134
142
  }
135
- function it() {
143
+ function ot() {
144
+ G(void 0), V(!1);
136
145
  let e = H;
137
- V(!1), U(void 0), e && l(e);
146
+ U(void 0), e && l(e);
138
147
  }
139
- let Q = q(W.amount), $ = Q !== void 0 && Q > 0, at = !!(H && W.tradeDate) && $;
140
- function ot() {
141
- if (!H || !W.tradeDate || !$) return;
142
- let e = new Date(W.tradeDate);
143
- Number.isNaN(e.getTime()) || X.mutate({
148
+ let st = q(K.amount), $ = st !== void 0 && st > 0, ct = !!(H && K.tradeDate) && $;
149
+ function lt() {
150
+ if (!H || !K.tradeDate || !$) return;
151
+ let e = new Date(K.tradeDate);
152
+ Number.isNaN(e.getTime()) || Q.mutate({
144
153
  accountId: H,
145
- type: W.type,
154
+ type: K.type,
146
155
  tradeDate: e.toISOString(),
147
- symbol: W.symbol.trim() || null,
148
- quantity: q(W.quantity),
149
- price: q(W.price),
150
- amount: Q,
151
- fee: q(W.fee),
152
- notes: W.notes.trim() || null
153
- }, { onSuccess: it });
156
+ symbol: K.symbol.trim() || null,
157
+ quantity: q(K.quantity),
158
+ price: q(K.price),
159
+ amount: st,
160
+ fee: q(K.fee),
161
+ notes: K.notes.trim() || null
162
+ }, { onSuccess: ot });
154
163
  }
155
164
  return /* @__PURE__ */ S("div", {
156
165
  "data-tour": "brainyrich-page-accounts",
@@ -160,7 +169,7 @@ function Y() {
160
169
  description: "Linked bank, brokerage and retirement accounts with recent activity.",
161
170
  badges: [`${e.length} account${e.length === 1 ? "" : "s"}`],
162
171
  actionLabel: "New account",
163
- onAction: Qe,
172
+ onAction: et,
164
173
  children: [
165
174
  /* @__PURE__ */ C("div", {
166
175
  className: "grid gap-4 lg:grid-cols-3",
@@ -171,9 +180,9 @@ function Y() {
171
180
  index: 0,
172
181
  children: /* @__PURE__ */ S(c, {
173
182
  label: "Total cash",
174
- value: m(Je, Z),
183
+ value: m(Ye, Qe),
175
184
  glow: !0,
176
- icon: /* @__PURE__ */ S(xe, {
185
+ icon: /* @__PURE__ */ S(Se, {
177
186
  className: "size-4",
178
187
  "aria-hidden": "true"
179
188
  })
@@ -194,8 +203,8 @@ function Y() {
194
203
  index: 2,
195
204
  children: /* @__PURE__ */ S(c, {
196
205
  label: "Active",
197
- value: `${Ye}/${e.length}`,
198
- icon: /* @__PURE__ */ S(he, {
206
+ value: `${Xe}/${e.length}`,
207
+ icon: /* @__PURE__ */ S(ge, {
199
208
  className: "size-4",
200
209
  "aria-hidden": "true"
201
210
  })
@@ -205,8 +214,8 @@ function Y() {
205
214
  index: 3,
206
215
  children: /* @__PURE__ */ S(c, {
207
216
  label: "Institutions",
208
- value: String(Xe),
209
- icon: /* @__PURE__ */ S(me, {
217
+ value: String(Ze),
218
+ icon: /* @__PURE__ */ S(he, {
210
219
  className: "size-4",
211
220
  "aria-hidden": "true"
212
221
  })
@@ -220,22 +229,22 @@ function Y() {
220
229
  glow: !0,
221
230
  children: [/* @__PURE__ */ C("div", {
222
231
  className: "mb-2 flex items-center gap-2",
223
- children: [/* @__PURE__ */ S(_e, {
232
+ children: [/* @__PURE__ */ S(ve, {
224
233
  className: "size-4 text-text-secondary",
225
234
  "aria-hidden": "true"
226
235
  }), /* @__PURE__ */ S("h2", {
227
236
  className: "text-sm font-semibold text-text-primary",
228
237
  children: "Cash by account type"
229
238
  })]
230
- }), Ze.length === 0 ? /* @__PURE__ */ S("p", {
239
+ }), $e.length === 0 ? /* @__PURE__ */ S("p", {
231
240
  className: "py-8 text-center text-sm text-text-secondary",
232
241
  children: "No cash balances recorded yet."
233
242
  }) : /* @__PURE__ */ S(ie, {
234
- data: Ze,
235
- centerValue: oe(Je, Z),
243
+ data: $e,
244
+ centerValue: oe(Ye, Qe),
236
245
  centerLabel: "Total cash",
237
246
  height: 200,
238
- valueFormatter: (e) => m(e, Z)
247
+ valueFormatter: (e) => m(e, Qe)
239
248
  })]
240
249
  })
241
250
  })]
@@ -243,15 +252,15 @@ function Y() {
243
252
  /* @__PURE__ */ S(s, {
244
253
  index: 5,
245
254
  as: "section",
246
- children: /* @__PURE__ */ C(Se, {
255
+ children: /* @__PURE__ */ C(Ce, {
247
256
  className: "transition-shadow motion-safe:hover:shadow-[var(--shadow-pop-hover,var(--shadow-elevation-2))]",
248
- children: [/* @__PURE__ */ C(Te, { children: [/* @__PURE__ */ C(Ee, {
257
+ children: [/* @__PURE__ */ C(Ee, { children: [/* @__PURE__ */ C(De, {
249
258
  className: "flex items-center gap-2",
250
259
  children: [/* @__PURE__ */ S(b, {
251
260
  className: "h-5 w-5",
252
261
  "aria-hidden": "true"
253
262
  }), "Linked accounts"]
254
- }), /* @__PURE__ */ S(we, { children: "Select an account to view holdings and transactions." })] }), /* @__PURE__ */ S(Ce, { children: a.isLoading ? /* @__PURE__ */ S(f, {}) : a.isError ? /* @__PURE__ */ S(d, { onRetry: () => a.refetch() }) : a.items.length === 0 ? /* @__PURE__ */ S(u, {
263
+ }), /* @__PURE__ */ S(Te, { children: "Select an account to view holdings and transactions." })] }), /* @__PURE__ */ S(we, { children: a.isLoading ? /* @__PURE__ */ S(f, {}) : a.isError ? /* @__PURE__ */ S(d, { onRetry: () => a.refetch() }) : a.items.length === 0 ? /* @__PURE__ */ S(u, {
255
264
  icon: /* @__PURE__ */ S(b, {
256
265
  className: "size-6",
257
266
  "aria-hidden": "true"
@@ -260,15 +269,15 @@ function Y() {
260
269
  description: "Add your first bank, brokerage or retirement account to start tracking net worth.",
261
270
  action: /* @__PURE__ */ C(T, {
262
271
  size: "sm",
263
- onClick: Qe,
264
- children: [/* @__PURE__ */ S(be, {
272
+ onClick: et,
273
+ children: [/* @__PURE__ */ S(xe, {
265
274
  className: "size-4",
266
275
  "aria-hidden": "true"
267
276
  }), "New account"]
268
277
  })
269
278
  }) : /* @__PURE__ */ C("div", {
270
279
  className: "overflow-x-auto",
271
- children: [/* @__PURE__ */ C(Re, { children: [/* @__PURE__ */ S(Be, { children: /* @__PURE__ */ C(B, { children: [
280
+ children: [/* @__PURE__ */ C(ze, { children: [/* @__PURE__ */ S(Ve, { children: /* @__PURE__ */ C(B, { children: [
272
281
  /* @__PURE__ */ S(z, { children: "Account" }),
273
282
  /* @__PURE__ */ S(z, { children: "Type" }),
274
283
  /* @__PURE__ */ S(z, { children: "Institution" }),
@@ -281,7 +290,7 @@ function Y() {
281
290
  className: "w-12 text-right",
282
291
  children: "Actions"
283
292
  })
284
- ] }) }), /* @__PURE__ */ S(ze, { children: a.items.map((e) => /* @__PURE__ */ C(B, {
293
+ ] }) }), /* @__PURE__ */ S(Be, { children: a.items.map((e) => /* @__PURE__ */ C(B, {
285
294
  className: "group cursor-pointer transition-colors hover:bg-bg-elevated",
286
295
  onClick: () => l(e.id),
287
296
  children: [
@@ -295,7 +304,7 @@ function Y() {
295
304
  className: "min-w-0",
296
305
  children: [/* @__PURE__ */ C("p", {
297
306
  className: "flex items-center gap-1 truncate font-medium text-text-primary",
298
- children: [e.name, /* @__PURE__ */ S(ge, {
307
+ children: [e.name, /* @__PURE__ */ S(_e, {
299
308
  className: "size-3.5 shrink-0 text-text-secondary opacity-0 transition-opacity group-hover:opacity-100",
300
309
  "aria-hidden": "true"
301
310
  })]
@@ -330,7 +339,7 @@ function Y() {
330
339
  variant: "ghost",
331
340
  size: "sm",
332
341
  "aria-label": `Actions for ${e.name}`,
333
- children: /* @__PURE__ */ S(ve, {
342
+ children: /* @__PURE__ */ S(ye, {
334
343
  className: "size-4",
335
344
  "aria-hidden": "true"
336
345
  })
@@ -338,15 +347,15 @@ function Y() {
338
347
  }), /* @__PURE__ */ C(ke, {
339
348
  align: "end",
340
349
  children: [/* @__PURE__ */ C(Ae, {
341
- onClick: () => et(e),
342
- children: [/* @__PURE__ */ S(ye, {
350
+ onClick: () => nt(e),
351
+ children: [/* @__PURE__ */ S(be, {
343
352
  className: "size-4",
344
353
  "aria-hidden": "true"
345
354
  }), "Edit"]
346
355
  }), /* @__PURE__ */ C(Ae, {
347
356
  className: "text-status-error-text",
348
357
  onClick: () => L(e),
349
- children: [/* @__PURE__ */ S(pe, {
358
+ children: [/* @__PURE__ */ S(me, {
350
359
  className: "size-4",
351
360
  "aria-hidden": "true"
352
361
  }), "Archive"]
@@ -363,50 +372,50 @@ function Y() {
363
372
  }) })]
364
373
  })
365
374
  }),
366
- /* @__PURE__ */ S(E, {
375
+ /* @__PURE__ */ S(O, {
367
376
  open: se,
368
377
  onOpenChange: h,
369
- children: /* @__PURE__ */ C(D, {
378
+ children: /* @__PURE__ */ C(k, {
370
379
  className: "max-h-[90vh] overflow-y-auto",
371
380
  children: [
372
- /* @__PURE__ */ C(A, { children: [/* @__PURE__ */ S(j, { children: "New account" }), /* @__PURE__ */ S(O, { children: "Add a bank, brokerage or retirement account." })] }),
373
- /* @__PURE__ */ S(Ge, {
381
+ /* @__PURE__ */ C(M, { children: [/* @__PURE__ */ S(N, { children: "New account" }), /* @__PURE__ */ S(A, { children: "Add a bank, brokerage or retirement account." })] }),
382
+ /* @__PURE__ */ S(Ke, {
374
383
  form: g,
375
384
  onChange: v
376
385
  }),
377
- /* @__PURE__ */ C(k, { children: [/* @__PURE__ */ S(De, {
386
+ /* @__PURE__ */ C(j, { children: [/* @__PURE__ */ S(Me, {
378
387
  asChild: !0,
379
388
  children: /* @__PURE__ */ S(T, {
380
389
  variant: "outline",
381
390
  children: "Cancel"
382
391
  })
383
392
  }), /* @__PURE__ */ S(T, {
384
- onClick: $e,
385
- disabled: !g.name.trim() || K.isPending,
386
- children: K.isPending ? "Creating…" : "Create account"
393
+ onClick: tt,
394
+ disabled: !g.name.trim() || X.isPending,
395
+ children: X.isPending ? "Creating…" : "Create account"
387
396
  })] })
388
397
  ]
389
398
  })
390
399
  }),
391
- /* @__PURE__ */ S(E, {
400
+ /* @__PURE__ */ S(O, {
392
401
  open: !!y,
393
402
  onOpenChange: (e) => !e && x(null),
394
- children: /* @__PURE__ */ C(D, {
403
+ children: /* @__PURE__ */ C(k, {
395
404
  className: "max-h-[90vh] overflow-y-auto",
396
405
  children: [
397
- /* @__PURE__ */ C(A, { children: [/* @__PURE__ */ S(j, { children: "Edit account" }), /* @__PURE__ */ S(O, { children: "Update account details." })] }),
398
- /* @__PURE__ */ S(Ge, {
406
+ /* @__PURE__ */ C(M, { children: [/* @__PURE__ */ S(N, { children: "Edit account" }), /* @__PURE__ */ S(A, { children: "Update account details." })] }),
407
+ /* @__PURE__ */ S(Ke, {
399
408
  form: P,
400
409
  onChange: F
401
410
  }),
402
- /* @__PURE__ */ C(k, { children: [/* @__PURE__ */ S(T, {
411
+ /* @__PURE__ */ C(j, { children: [/* @__PURE__ */ S(T, {
403
412
  variant: "outline",
404
413
  onClick: () => x(null),
405
414
  children: "Cancel"
406
415
  }), /* @__PURE__ */ S(T, {
407
- onClick: tt,
408
- disabled: !P.name.trim() || Y.isPending,
409
- children: Y.isPending ? "Saving…" : "Save changes"
416
+ onClick: rt,
417
+ disabled: !P.name.trim() || Z.isPending,
418
+ children: Z.isPending ? "Saving…" : "Save changes"
410
419
  })] })
411
420
  ]
412
421
  })
@@ -419,21 +428,23 @@ function Y() {
419
428
  confirmLabel: "Archive account",
420
429
  pendingLabel: "Archiving…",
421
430
  destructive: !0,
422
- pending: qe.isPending,
423
- onConfirm: nt
431
+ pending: Je.isPending,
432
+ onConfirm: it
424
433
  }),
425
- /* @__PURE__ */ S(Ke, {
434
+ /* @__PURE__ */ S(qe, {
426
435
  accountId: o,
427
- onClose: () => l(void 0),
428
- onRecordTransaction: rt
436
+ onClose: () => {
437
+ l(void 0), G(void 0);
438
+ },
439
+ onRecordTransaction: at
429
440
  }),
430
- /* @__PURE__ */ S(E, {
431
- open: Le,
432
- onOpenChange: (e) => !e && it(),
433
- children: /* @__PURE__ */ C(D, {
441
+ /* @__PURE__ */ S(O, {
442
+ open: Re,
443
+ onOpenChange: (e) => !e && ot(),
444
+ children: /* @__PURE__ */ C(k, {
434
445
  className: "max-h-[90vh] overflow-y-auto",
435
446
  children: [
436
- /* @__PURE__ */ C(A, { children: [/* @__PURE__ */ S(j, { children: "Record transaction" }), /* @__PURE__ */ S(O, { children: "Log activity against the selected account." })] }),
447
+ /* @__PURE__ */ C(M, { children: [/* @__PURE__ */ S(N, { children: "Record transaction" }), /* @__PURE__ */ S(A, { children: "Log activity against the selected account." })] }),
437
448
  /* @__PURE__ */ C("div", {
438
449
  className: "grid gap-4",
439
450
  children: [
@@ -441,33 +452,33 @@ function Y() {
441
452
  className: "grid grid-cols-2 gap-4",
442
453
  children: [/* @__PURE__ */ C("div", {
443
454
  className: "space-y-2",
444
- children: [/* @__PURE__ */ S(N, {
455
+ children: [/* @__PURE__ */ S(D, {
445
456
  htmlFor: "tx-type",
446
457
  children: "Type"
447
- }), /* @__PURE__ */ C(Me, {
448
- value: W.type,
449
- onValueChange: (e) => G((t) => ({
458
+ }), /* @__PURE__ */ C(Ne, {
459
+ value: K.type,
460
+ onValueChange: (e) => Y((t) => ({
450
461
  ...t,
451
462
  type: e
452
463
  })),
453
- children: [/* @__PURE__ */ S(Fe, {
464
+ children: [/* @__PURE__ */ S(Ie, {
454
465
  id: "tx-type",
455
- children: /* @__PURE__ */ S(Ie, {})
456
- }), /* @__PURE__ */ S(Ne, { children: He.map((e) => /* @__PURE__ */ S(Pe, {
466
+ children: /* @__PURE__ */ S(Le, {})
467
+ }), /* @__PURE__ */ S(Pe, { children: Ue.map((e) => /* @__PURE__ */ S(Fe, {
457
468
  value: e,
458
469
  children: e.replace(/_/g, " ")
459
470
  }, e)) })]
460
471
  })]
461
472
  }), /* @__PURE__ */ C("div", {
462
473
  className: "space-y-2",
463
- children: [/* @__PURE__ */ S(N, {
474
+ children: [/* @__PURE__ */ S(D, {
464
475
  htmlFor: "tx-date",
465
476
  children: "Trade date"
466
- }), /* @__PURE__ */ S(M, {
477
+ }), /* @__PURE__ */ S(E, {
467
478
  id: "tx-date",
468
479
  type: "date",
469
- value: W.tradeDate,
470
- onChange: (e) => G((t) => ({
480
+ value: K.tradeDate,
481
+ onChange: (e) => Y((t) => ({
471
482
  ...t,
472
483
  tradeDate: e.target.value
473
484
  }))
@@ -478,13 +489,13 @@ function Y() {
478
489
  className: "grid grid-cols-2 gap-4",
479
490
  children: [/* @__PURE__ */ C("div", {
480
491
  className: "space-y-2",
481
- children: [/* @__PURE__ */ S(N, {
492
+ children: [/* @__PURE__ */ S(D, {
482
493
  htmlFor: "tx-symbol",
483
494
  children: "Symbol"
484
- }), /* @__PURE__ */ S(M, {
495
+ }), /* @__PURE__ */ S(E, {
485
496
  id: "tx-symbol",
486
- value: W.symbol,
487
- onChange: (e) => G((t) => ({
497
+ value: K.symbol,
498
+ onChange: (e) => Y((t) => ({
488
499
  ...t,
489
500
  symbol: e.target.value
490
501
  })),
@@ -493,27 +504,27 @@ function Y() {
493
504
  }), /* @__PURE__ */ C("div", {
494
505
  className: "space-y-2",
495
506
  children: [
496
- /* @__PURE__ */ S(N, {
507
+ /* @__PURE__ */ S(D, {
497
508
  htmlFor: "tx-amount",
498
509
  children: "Amount"
499
510
  }),
500
- /* @__PURE__ */ S(M, {
511
+ /* @__PURE__ */ S(E, {
501
512
  id: "tx-amount",
502
513
  type: "number",
503
514
  min: "0",
504
515
  step: "any",
505
- value: W.amount,
506
- onChange: (e) => G((t) => ({
516
+ value: K.amount,
517
+ onChange: (e) => Y((t) => ({
507
518
  ...t,
508
519
  amount: e.target.value
509
520
  })),
510
- "aria-invalid": W.amount.trim() !== "" && !$,
521
+ "aria-invalid": K.amount.trim() !== "" && !$,
511
522
  "aria-describedby": "tx-amount-hint"
512
523
  }),
513
524
  /* @__PURE__ */ S("p", {
514
525
  id: "tx-amount-hint",
515
526
  className: "text-xs text-text-secondary",
516
- children: W.amount.trim() !== "" && !$ ? "Enter an amount greater than 0." : "Positive amount; direction is set by the type."
527
+ children: K.amount.trim() !== "" && !$ ? "Enter an amount greater than 0." : "Positive amount; direction is set by the type."
517
528
  })
518
529
  ]
519
530
  })]
@@ -523,14 +534,14 @@ function Y() {
523
534
  children: [
524
535
  /* @__PURE__ */ C("div", {
525
536
  className: "space-y-2",
526
- children: [/* @__PURE__ */ S(N, {
537
+ children: [/* @__PURE__ */ S(D, {
527
538
  htmlFor: "tx-qty",
528
539
  children: "Quantity"
529
- }), /* @__PURE__ */ S(M, {
540
+ }), /* @__PURE__ */ S(E, {
530
541
  id: "tx-qty",
531
542
  type: "number",
532
- value: W.quantity,
533
- onChange: (e) => G((t) => ({
543
+ value: K.quantity,
544
+ onChange: (e) => Y((t) => ({
534
545
  ...t,
535
546
  quantity: e.target.value
536
547
  }))
@@ -538,14 +549,14 @@ function Y() {
538
549
  }),
539
550
  /* @__PURE__ */ C("div", {
540
551
  className: "space-y-2",
541
- children: [/* @__PURE__ */ S(N, {
552
+ children: [/* @__PURE__ */ S(D, {
542
553
  htmlFor: "tx-price",
543
554
  children: "Price"
544
- }), /* @__PURE__ */ S(M, {
555
+ }), /* @__PURE__ */ S(E, {
545
556
  id: "tx-price",
546
557
  type: "number",
547
- value: W.price,
548
- onChange: (e) => G((t) => ({
558
+ value: K.price,
559
+ onChange: (e) => Y((t) => ({
549
560
  ...t,
550
561
  price: e.target.value
551
562
  }))
@@ -553,14 +564,14 @@ function Y() {
553
564
  }),
554
565
  /* @__PURE__ */ C("div", {
555
566
  className: "space-y-2",
556
- children: [/* @__PURE__ */ S(N, {
567
+ children: [/* @__PURE__ */ S(D, {
557
568
  htmlFor: "tx-fee",
558
569
  children: "Fee"
559
- }), /* @__PURE__ */ S(M, {
570
+ }), /* @__PURE__ */ S(E, {
560
571
  id: "tx-fee",
561
572
  type: "number",
562
- value: W.fee,
563
- onChange: (e) => G((t) => ({
573
+ value: K.fee,
574
+ onChange: (e) => Y((t) => ({
564
575
  ...t,
565
576
  fee: e.target.value
566
577
  }))
@@ -570,13 +581,13 @@ function Y() {
570
581
  }),
571
582
  /* @__PURE__ */ C("div", {
572
583
  className: "space-y-2",
573
- children: [/* @__PURE__ */ S(N, {
584
+ children: [/* @__PURE__ */ S(D, {
574
585
  htmlFor: "tx-notes",
575
586
  children: "Notes"
576
- }), /* @__PURE__ */ S(Ve, {
587
+ }), /* @__PURE__ */ S(He, {
577
588
  id: "tx-notes",
578
- value: W.notes,
579
- onChange: (e) => G((t) => ({
589
+ value: K.notes,
590
+ onChange: (e) => Y((t) => ({
580
591
  ...t,
581
592
  notes: e.target.value
582
593
  })),
@@ -585,14 +596,14 @@ function Y() {
585
596
  })
586
597
  ]
587
598
  }),
588
- /* @__PURE__ */ C(k, { children: [/* @__PURE__ */ S(T, {
599
+ /* @__PURE__ */ C(j, { children: [/* @__PURE__ */ S(T, {
589
600
  variant: "outline",
590
- onClick: it,
601
+ onClick: ot,
591
602
  children: "Cancel"
592
603
  }), /* @__PURE__ */ S(T, {
593
- onClick: ot,
594
- disabled: !at || X.isPending,
595
- children: X.isPending ? "Saving…" : "Record transaction"
604
+ onClick: lt,
605
+ disabled: !ct || Q.isPending,
606
+ children: Q.isPending ? "Saving…" : "Record transaction"
596
607
  })] })
597
608
  ]
598
609
  })
@@ -601,16 +612,16 @@ function Y() {
601
612
  })
602
613
  });
603
614
  }
604
- function Ge({ form: e, onChange: t }) {
615
+ function Ke({ form: e, onChange: t }) {
605
616
  return /* @__PURE__ */ C("div", {
606
617
  className: "grid gap-4",
607
618
  children: [
608
619
  /* @__PURE__ */ C("div", {
609
620
  className: "space-y-2",
610
- children: [/* @__PURE__ */ S(N, {
621
+ children: [/* @__PURE__ */ S(D, {
611
622
  htmlFor: "acct-name",
612
623
  children: "Name"
613
- }), /* @__PURE__ */ S(M, {
624
+ }), /* @__PURE__ */ S(E, {
614
625
  id: "acct-name",
615
626
  value: e.name,
616
627
  onChange: (e) => t((t) => ({
@@ -624,29 +635,29 @@ function Ge({ form: e, onChange: t }) {
624
635
  className: "grid grid-cols-2 gap-4",
625
636
  children: [/* @__PURE__ */ C("div", {
626
637
  className: "space-y-2",
627
- children: [/* @__PURE__ */ S(N, {
638
+ children: [/* @__PURE__ */ S(D, {
628
639
  htmlFor: "acct-type",
629
640
  children: "Type"
630
- }), /* @__PURE__ */ C(Me, {
641
+ }), /* @__PURE__ */ C(Ne, {
631
642
  value: e.type,
632
643
  onValueChange: (e) => t((t) => ({
633
644
  ...t,
634
645
  type: e
635
646
  })),
636
- children: [/* @__PURE__ */ S(Fe, {
647
+ children: [/* @__PURE__ */ S(Ie, {
637
648
  id: "acct-type",
638
- children: /* @__PURE__ */ S(Ie, {})
639
- }), /* @__PURE__ */ S(Ne, { children: G.map((e) => /* @__PURE__ */ S(Pe, {
649
+ children: /* @__PURE__ */ S(Le, {})
650
+ }), /* @__PURE__ */ S(Pe, { children: G.map((e) => /* @__PURE__ */ S(Fe, {
640
651
  value: e,
641
652
  children: e.replace(/_/g, " ")
642
653
  }, e)) })]
643
654
  })]
644
655
  }), /* @__PURE__ */ C("div", {
645
656
  className: "space-y-2",
646
- children: [/* @__PURE__ */ S(N, {
657
+ children: [/* @__PURE__ */ S(D, {
647
658
  htmlFor: "acct-currency",
648
659
  children: "Currency"
649
- }), /* @__PURE__ */ S(M, {
660
+ }), /* @__PURE__ */ S(E, {
650
661
  id: "acct-currency",
651
662
  value: e.currency,
652
663
  onChange: (e) => t((t) => ({
@@ -659,10 +670,10 @@ function Ge({ form: e, onChange: t }) {
659
670
  }),
660
671
  /* @__PURE__ */ C("div", {
661
672
  className: "space-y-2",
662
- children: [/* @__PURE__ */ S(N, {
673
+ children: [/* @__PURE__ */ S(D, {
663
674
  htmlFor: "acct-institution",
664
675
  children: "Institution"
665
- }), /* @__PURE__ */ S(M, {
676
+ }), /* @__PURE__ */ S(E, {
666
677
  id: "acct-institution",
667
678
  value: e.institution,
668
679
  onChange: (e) => t((t) => ({
@@ -676,10 +687,10 @@ function Ge({ form: e, onChange: t }) {
676
687
  className: "grid grid-cols-2 gap-4",
677
688
  children: [/* @__PURE__ */ C("div", {
678
689
  className: "space-y-2",
679
- children: [/* @__PURE__ */ S(N, {
690
+ children: [/* @__PURE__ */ S(D, {
680
691
  htmlFor: "acct-balance",
681
692
  children: "Cash balance"
682
- }), /* @__PURE__ */ S(M, {
693
+ }), /* @__PURE__ */ S(E, {
683
694
  id: "acct-balance",
684
695
  type: "number",
685
696
  value: e.cashBalance,
@@ -690,10 +701,10 @@ function Ge({ form: e, onChange: t }) {
690
701
  })]
691
702
  }), /* @__PURE__ */ C("div", {
692
703
  className: "space-y-2",
693
- children: [/* @__PURE__ */ S(N, {
704
+ children: [/* @__PURE__ */ S(D, {
694
705
  htmlFor: "acct-mask",
695
706
  children: "Account mask"
696
- }), /* @__PURE__ */ S(M, {
707
+ }), /* @__PURE__ */ S(E, {
697
708
  id: "acct-mask",
698
709
  value: e.accountMask,
699
710
  onChange: (e) => t((t) => ({
@@ -714,8 +725,8 @@ function Ge({ form: e, onChange: t }) {
714
725
  ]
715
726
  });
716
727
  }
717
- function Ke({ accountId: t, onClose: n, onRecordTransaction: r }) {
718
- let { data: i, isLoading: ee, isError: te, refetch: re } = e(t), s = a(t ? { accountId: t } : {}), c = t ? s.items : [], l = fe(() => i ? i.holdings.filter((e) => Number.isFinite(e.marketValue) && e.marketValue > 0).map((e) => ({
728
+ function qe({ accountId: t, onClose: n, onRecordTransaction: r }) {
729
+ let { data: i, isLoading: ee, isError: te, refetch: re } = e(t), s = a(t ? { accountId: t } : {}, { enabled: !!t }), c = t ? s.items : [], l = pe(() => i ? i.holdings.filter((e) => Number.isFinite(e.marketValue) && e.marketValue > 0).map((e) => ({
719
730
  label: e.symbol,
720
731
  value: e.marketValue
721
732
  })).sort((e, t) => t.value - e.value) : [], [i]), p = l.reduce((e, t) => e + t.value, 0);
@@ -726,7 +737,7 @@ function Ke({ accountId: t, onClose: n, onRecordTransaction: r }) {
726
737
  className: "flex w-full flex-col overflow-y-auto p-0 sm:max-w-xl",
727
738
  children: [/* @__PURE__ */ C(L, {
728
739
  className: "border-b border-border-subtle px-6 pb-4 pt-6",
729
- children: [/* @__PURE__ */ S(Le, {
740
+ children: [/* @__PURE__ */ S(Re, {
730
741
  className: "text-lg",
731
742
  children: i?.name ?? "Account"
732
743
  }), /* @__PURE__ */ S(I, { children: i ? `${i.institution ?? "Manual account"} · ${i.type.replace(/_/g, " ")}` : "Loading account details…" })]
@@ -841,7 +852,7 @@ function Ke({ accountId: t, onClose: n, onRecordTransaction: r }) {
841
852
  value: "holdings",
842
853
  className: "mt-4",
843
854
  children: i.holdings.length === 0 ? /* @__PURE__ */ S(u, {
844
- icon: /* @__PURE__ */ S(_e, {
855
+ icon: /* @__PURE__ */ S(ve, {
845
856
  className: "size-6",
846
857
  "aria-hidden": "true"
847
858
  }),
@@ -849,7 +860,7 @@ function Ke({ accountId: t, onClose: n, onRecordTransaction: r }) {
849
860
  description: "This account has no positions recorded yet."
850
861
  }) : /* @__PURE__ */ S("div", {
851
862
  className: "overflow-x-auto rounded-lg border border-border-subtle",
852
- children: /* @__PURE__ */ C(Re, { children: [/* @__PURE__ */ S(Be, { children: /* @__PURE__ */ C(B, { children: [
863
+ children: /* @__PURE__ */ C(ze, { children: [/* @__PURE__ */ S(Ve, { children: /* @__PURE__ */ C(B, { children: [
853
864
  /* @__PURE__ */ S(z, { children: "Holding" }),
854
865
  /* @__PURE__ */ S(z, {
855
866
  className: "text-right",
@@ -863,7 +874,7 @@ function Ke({ accountId: t, onClose: n, onRecordTransaction: r }) {
863
874
  className: "text-right",
864
875
  children: "Market value"
865
876
  })
866
- ] }) }), /* @__PURE__ */ S(ze, { children: i.holdings.map((e) => /* @__PURE__ */ C(B, {
877
+ ] }) }), /* @__PURE__ */ S(Be, { children: i.holdings.map((e) => /* @__PURE__ */ C(B, {
867
878
  className: "transition-colors hover:bg-bg-elevated",
868
879
  children: [
869
880
  /* @__PURE__ */ C(R, { children: [/* @__PURE__ */ S("p", {
@@ -915,7 +926,7 @@ function Ke({ accountId: t, onClose: n, onRecordTransaction: r }) {
915
926
  action: /* @__PURE__ */ C(T, {
916
927
  size: "sm",
917
928
  onClick: () => r(i.id),
918
- children: [/* @__PURE__ */ S(be, {
929
+ children: [/* @__PURE__ */ S(xe, {
919
930
  className: "size-4",
920
931
  "aria-hidden": "true"
921
932
  }), "Record transaction"]