@burdenoff/microfe-brainyrich 2026.705.1 → 2026.706.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 (47) hide show
  1. package/dist/brainyrich/BrainyRichRoot.js +13 -13
  2. package/dist/brainyrich/components/ActorName.js +38 -0
  3. package/dist/brainyrich/components/ActorName.js.map +1 -0
  4. package/dist/brainyrich/components/ConfirmDialog.js +25 -0
  5. package/dist/brainyrich/components/ConfirmDialog.js.map +1 -0
  6. package/dist/brainyrich/components/LoadMore.js +24 -0
  7. package/dist/brainyrich/components/LoadMore.js.map +1 -0
  8. package/dist/brainyrich/components/index.js +5 -0
  9. package/dist/brainyrich/components/notify.js +38 -0
  10. package/dist/brainyrich/components/notify.js.map +1 -0
  11. package/dist/brainyrich/components/pickers.js +232 -0
  12. package/dist/brainyrich/components/pickers.js.map +1 -0
  13. package/dist/brainyrich/components/reuse/CommentThread.js +208 -0
  14. package/dist/brainyrich/components/reuse/CommentThread.js.map +1 -0
  15. package/dist/brainyrich/components/reuse/DocumentsPanel.js +237 -0
  16. package/dist/brainyrich/components/reuse/DocumentsPanel.js.map +1 -0
  17. package/dist/brainyrich/components/reuse/TagField.js +206 -0
  18. package/dist/brainyrich/components/reuse/TagField.js.map +1 -0
  19. package/dist/brainyrich/components/reuse/transport.js +24 -0
  20. package/dist/brainyrich/components/reuse/transport.js.map +1 -0
  21. package/dist/brainyrich/hooks/useBrainyRichApi.js +644 -372
  22. package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -1
  23. package/dist/brainyrich/pages/AccountsPage.js +346 -293
  24. package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
  25. package/dist/brainyrich/pages/AiAssistantPage.js +339 -320
  26. package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
  27. package/dist/brainyrich/pages/AnalyticsPage.js +178 -164
  28. package/dist/brainyrich/pages/AnalyticsPage.js.map +1 -1
  29. package/dist/brainyrich/pages/DashboardPage.js +195 -169
  30. package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
  31. package/dist/brainyrich/pages/FamilyPage.js +247 -198
  32. package/dist/brainyrich/pages/FamilyPage.js.map +1 -1
  33. package/dist/brainyrich/pages/GoalsPage.js +478 -442
  34. package/dist/brainyrich/pages/GoalsPage.js.map +1 -1
  35. package/dist/brainyrich/pages/InvestmentsPage.js.map +1 -1
  36. package/dist/brainyrich/pages/PortfoliosPage.js +438 -396
  37. package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
  38. package/dist/brainyrich/pages/ReportsPage.js +246 -213
  39. package/dist/brainyrich/pages/ReportsPage.js.map +1 -1
  40. package/dist/brainyrich/pages/RiskPage.js +321 -173
  41. package/dist/brainyrich/pages/RiskPage.js.map +1 -1
  42. package/dist/brainyrich/pages/TaxPage.js +258 -225
  43. package/dist/brainyrich/pages/TaxPage.js.map +1 -1
  44. package/dist/brainyrich/pages/_shared.js.map +1 -1
  45. package/dist/node_modules/sonner/dist/index.js +163 -0
  46. package/dist/node_modules/sonner/dist/index.js.map +1 -0
  47. package/package.json +3 -2
@@ -1,11 +1,17 @@
1
- import { useAccounts as e, useArchivePortfolio as t, useCreateHolding as n, useCreatePortfolio as r, useDeleteHolding as i, useHouseholds as a, useModelPortfolios as o, usePortfolio as s, usePortfolios as c, useUpdateHolding as l, useUpdatePortfolio as u } from "../hooks/useBrainyRichApi.js";
2
- import { AllocationBars as d, EmptyState as f, ErrorState as p, KpiGrid as m, LoadingState as h, SectionShell as g, formatMoney as _, formatPct as v, statusBadgeVariant as y } from "./_shared.js";
3
- import { useMemo as b, useState as x } from "react";
4
- import { ArrowDownRight as S, ArrowUpRight as C, Briefcase as w, MoreHorizontal as ee, Pencil as te, Plus as T, Trash2 as ne } from "lucide-react";
5
- import { Fragment as re, jsx as E, jsxs as D } from "react/jsx-runtime";
6
- import { Badge as O, Button as k, Card as A, CardContent as j, CardDescription as ie, CardHeader as M, CardTitle as N, Dialog as P, DialogContent as F, DialogDescription as I, DialogFooter as L, DialogHeader as R, DialogTitle as ae, DropdownMenu as z, DropdownMenuContent as oe, DropdownMenuItem as B, DropdownMenuLabel as se, DropdownMenuSeparator as ce, DropdownMenuTrigger as le, Input as V, Label as H, Select as U, SelectContent as W, SelectItem as G, SelectTrigger as K, SelectValue as q, Sheet as ue, SheetContent as de, SheetDescription as fe, SheetHeader as pe, SheetTitle as me, Table as he, TableBody as ge, TableCell as J, TableHead as Y, TableHeader as _e, TableRow as ve, Textarea as ye } from "@burdenoff/fe-libs/ui";
1
+ import { useArchivePortfolio as e, useCreateHolding as t, useCreatePortfolio as n, useDeleteHolding as r, useHouseholds as i, useModelPortfolios as a, usePagedPortfolios as o, usePortfolio as s, useUpdateHolding as c, useUpdatePortfolio as l } from "../hooks/useBrainyRichApi.js";
2
+ import { LoadMore as u } from "../components/LoadMore.js";
3
+ import { ConfirmDialog as d } from "../components/ConfirmDialog.js";
4
+ import { AccountPicker as f } from "../components/pickers.js";
5
+ import "../components/index.js";
6
+ import { AllocationBars as p, EmptyState as m, ErrorState as h, KpiGrid as g, LoadingState as _, SectionShell as v, formatMoney as y, formatPct as b, statusBadgeVariant as ee } from "./_shared.js";
7
+ import { TagField as te } from "../components/reuse/TagField.js";
8
+ import { CommentThread as ne } from "../components/reuse/CommentThread.js";
9
+ import { useMemo as x, useState as S } from "react";
10
+ import { ArrowDownRight as C, ArrowUpRight as w, Briefcase as T, MoreHorizontal as re, Pencil as ie, Plus as E, Trash2 as ae } from "lucide-react";
11
+ import { Fragment as oe, jsx as D, jsxs as O } from "react/jsx-runtime";
12
+ import { Badge as k, Button as A, Card as j, CardContent as M, CardDescription as N, CardHeader as P, CardTitle as F, Dialog as I, DialogContent as L, DialogDescription as R, DialogFooter as z, DialogHeader as B, DialogTitle as se, DropdownMenu as ce, DropdownMenuContent as le, DropdownMenuItem as V, DropdownMenuLabel as ue, DropdownMenuSeparator as de, DropdownMenuTrigger as fe, Input as H, Label as U, Select as W, SelectContent as G, SelectItem as K, SelectTrigger as q, SelectValue as J, Sheet as pe, SheetContent as me, SheetDescription as he, SheetHeader as ge, SheetTitle as _e, Table as ve, TableBody as ye, TableCell as Y, TableHead as X, TableHeader as be, TableRow as xe, Textarea as Se } from "@burdenoff/fe-libs/ui";
7
13
  //#region src/brainyrich/pages/PortfoliosPage.tsx
8
- var be = [
14
+ var Ce = [
9
15
  "EQUITY",
10
16
  "FIXED_INCOME",
11
17
  "CASH",
@@ -13,78 +19,78 @@ var be = [
13
19
  "COMMODITY",
14
20
  "CRYPTO",
15
21
  "ALTERNATIVE"
16
- ], xe = [
22
+ ], we = [
17
23
  "DRAFT",
18
24
  "ACTIVE",
19
25
  "ARCHIVED"
20
- ], X = "__none__", Z = (e) => e.toLowerCase().split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" "), Q = (e) => {
26
+ ], Z = "__none__", Q = (e) => e.toLowerCase().split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" "), $ = (e) => {
21
27
  if (e.trim() === "") return;
22
28
  let t = Number(e);
23
29
  return Number.isFinite(t) ? t : void 0;
24
30
  };
25
- function Se(e) {
31
+ function Te(e) {
26
32
  return !e || typeof e != "object" ? [] : Object.entries(e).map(([e, t]) => ({
27
33
  label: e,
28
34
  value: Number(t)
29
35
  })).filter((e) => Number.isFinite(e.value)).map((e) => ({
30
- label: Z(e.label),
36
+ label: Q(e.label),
31
37
  value: e.value,
32
38
  tone: "accent"
33
39
  }));
34
40
  }
35
- function Ce({ value: e, currency: t }) {
36
- let n = e > 0, r = e < 0, i = n ? "text-status-success-text" : r ? "text-status-error-text" : "text-text-secondary", a = n ? C : r ? S : null;
37
- return /* @__PURE__ */ D("span", {
41
+ function Ee({ value: e, currency: t }) {
42
+ let n = e > 0, r = e < 0, i = n ? "text-status-success-text" : r ? "text-status-error-text" : "text-text-secondary", a = n ? w : r ? C : null;
43
+ return /* @__PURE__ */ O("span", {
38
44
  className: `inline-flex items-center justify-end gap-1 font-medium ${i}`,
39
45
  children: [
40
- a ? /* @__PURE__ */ E(a, {
46
+ a ? /* @__PURE__ */ D(a, {
41
47
  className: "size-3.5",
42
48
  "aria-hidden": "true"
43
49
  }) : null,
44
50
  n ? "+" : "",
45
- _(e, t)
51
+ y(e, t)
46
52
  ]
47
53
  });
48
54
  }
49
- function $() {
55
+ function De() {
50
56
  return {
51
57
  name: "",
52
58
  baseCurrency: "USD",
53
59
  description: "",
54
60
  driftThresholdPct: "5",
55
61
  status: "DRAFT",
56
- modelPortfolioId: X,
57
- householdId: X
62
+ modelPortfolioId: Z,
63
+ householdId: Z
58
64
  };
59
65
  }
60
- function we({ open: e, onOpenChange: t, editing: n }) {
61
- let { data: i } = o(), { data: s } = a(), c = r(), l = u(), [d, f] = x($), [p, m] = x(null), h = n?.id ?? "new";
62
- e && p !== h && (m(h), f(n ? {
63
- name: n.name,
64
- baseCurrency: n.baseCurrency,
65
- description: n.description ?? "",
66
- driftThresholdPct: String(n.driftThresholdPct),
67
- status: n.status,
68
- modelPortfolioId: n.modelPortfolioId ?? X,
69
- householdId: n.householdId ?? X
70
- } : $())), !e && p !== null && m(null);
71
- let g = c.isPending || l.isPending, _ = d.name.trim().length > 0;
72
- return /* @__PURE__ */ E(P, {
66
+ function Oe({ open: e, onOpenChange: t, editing: r }) {
67
+ let { data: o } = a(), { data: s } = i(), c = n(), u = l(), [d, f] = S(De), [p, m] = S(null), h = r?.id ?? "new";
68
+ e && p !== h && (m(h), f(r ? {
69
+ name: r.name,
70
+ baseCurrency: r.baseCurrency,
71
+ description: r.description ?? "",
72
+ driftThresholdPct: String(r.driftThresholdPct),
73
+ status: r.status,
74
+ modelPortfolioId: r.modelPortfolioId ?? Z,
75
+ householdId: r.householdId ?? Z
76
+ } : De())), !e && p !== null && m(null);
77
+ let g = c.isPending || u.isPending, _ = d.name.trim().length > 0;
78
+ return /* @__PURE__ */ D(I, {
73
79
  open: e,
74
80
  onOpenChange: t,
75
- children: /* @__PURE__ */ D(F, {
81
+ children: /* @__PURE__ */ O(L, {
76
82
  className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
77
83
  children: [
78
- /* @__PURE__ */ D(R, { children: [/* @__PURE__ */ E(ae, { children: n ? "Edit portfolio" : "New portfolio" }), /* @__PURE__ */ E(I, { children: n ? "Update this portfolio’s strategy settings." : "Create an investment portfolio to organize and rebalance holdings." })] }),
79
- /* @__PURE__ */ D("div", {
84
+ /* @__PURE__ */ O(B, { children: [/* @__PURE__ */ D(se, { children: r ? "Edit portfolio" : "New portfolio" }), /* @__PURE__ */ D(R, { children: r ? "Update this portfolio’s strategy settings." : "Create an investment portfolio to organize and rebalance holdings." })] }),
85
+ /* @__PURE__ */ O("div", {
80
86
  className: "space-y-4 py-2",
81
87
  children: [
82
- /* @__PURE__ */ D("div", {
88
+ /* @__PURE__ */ O("div", {
83
89
  className: "space-y-1.5",
84
- children: [/* @__PURE__ */ E(H, {
90
+ children: [/* @__PURE__ */ D(U, {
85
91
  htmlFor: "pf-name",
86
92
  children: "Name"
87
- }), /* @__PURE__ */ E(V, {
93
+ }), /* @__PURE__ */ D(H, {
88
94
  id: "pf-name",
89
95
  value: d.name,
90
96
  onChange: (e) => f((t) => ({
@@ -95,14 +101,14 @@ function we({ open: e, onOpenChange: t, editing: n }) {
95
101
  "aria-invalid": !_
96
102
  })]
97
103
  }),
98
- /* @__PURE__ */ D("div", {
104
+ /* @__PURE__ */ O("div", {
99
105
  className: "grid grid-cols-2 gap-4",
100
- children: [/* @__PURE__ */ D("div", {
106
+ children: [/* @__PURE__ */ O("div", {
101
107
  className: "space-y-1.5",
102
- children: [/* @__PURE__ */ E(H, {
108
+ children: [/* @__PURE__ */ D(U, {
103
109
  htmlFor: "pf-currency",
104
110
  children: "Base currency"
105
- }), /* @__PURE__ */ E(V, {
111
+ }), /* @__PURE__ */ D(H, {
106
112
  id: "pf-currency",
107
113
  value: d.baseCurrency,
108
114
  onChange: (e) => f((t) => ({
@@ -112,12 +118,12 @@ function we({ open: e, onOpenChange: t, editing: n }) {
112
118
  placeholder: "USD",
113
119
  maxLength: 3
114
120
  })]
115
- }), /* @__PURE__ */ D("div", {
121
+ }), /* @__PURE__ */ O("div", {
116
122
  className: "space-y-1.5",
117
- children: [/* @__PURE__ */ E(H, {
123
+ children: [/* @__PURE__ */ D(U, {
118
124
  htmlFor: "pf-drift",
119
125
  children: "Drift threshold %"
120
- }), /* @__PURE__ */ E(V, {
126
+ }), /* @__PURE__ */ D(H, {
121
127
  id: "pf-drift",
122
128
  type: "number",
123
129
  min: 0,
@@ -130,78 +136,78 @@ function we({ open: e, onOpenChange: t, editing: n }) {
130
136
  })]
131
137
  })]
132
138
  }),
133
- n ? /* @__PURE__ */ D("div", {
139
+ r ? /* @__PURE__ */ O("div", {
134
140
  className: "space-y-1.5",
135
- children: [/* @__PURE__ */ E(H, {
141
+ children: [/* @__PURE__ */ D(U, {
136
142
  htmlFor: "pf-status",
137
143
  children: "Status"
138
- }), /* @__PURE__ */ D(U, {
144
+ }), /* @__PURE__ */ O(W, {
139
145
  value: d.status,
140
146
  onValueChange: (e) => f((t) => ({
141
147
  ...t,
142
148
  status: e
143
149
  })),
144
- children: [/* @__PURE__ */ E(K, {
150
+ children: [/* @__PURE__ */ D(q, {
145
151
  id: "pf-status",
146
- children: /* @__PURE__ */ E(q, {})
147
- }), /* @__PURE__ */ E(W, { children: xe.map((e) => /* @__PURE__ */ E(G, {
152
+ children: /* @__PURE__ */ D(J, {})
153
+ }), /* @__PURE__ */ D(G, { children: we.map((e) => /* @__PURE__ */ D(K, {
148
154
  value: e,
149
- children: Z(e)
155
+ children: Q(e)
150
156
  }, e)) })]
151
157
  })]
152
158
  }) : null,
153
- /* @__PURE__ */ D("div", {
159
+ /* @__PURE__ */ O("div", {
154
160
  className: "space-y-1.5",
155
- children: [/* @__PURE__ */ E(H, {
161
+ children: [/* @__PURE__ */ D(U, {
156
162
  htmlFor: "pf-model",
157
163
  children: "Model portfolio"
158
- }), /* @__PURE__ */ D(U, {
164
+ }), /* @__PURE__ */ O(W, {
159
165
  value: d.modelPortfolioId,
160
166
  onValueChange: (e) => f((t) => ({
161
167
  ...t,
162
168
  modelPortfolioId: e
163
169
  })),
164
- children: [/* @__PURE__ */ E(K, {
170
+ children: [/* @__PURE__ */ D(q, {
165
171
  id: "pf-model",
166
- children: /* @__PURE__ */ E(q, { placeholder: "None" })
167
- }), /* @__PURE__ */ D(W, { children: [/* @__PURE__ */ E(G, {
168
- value: X,
172
+ children: /* @__PURE__ */ D(J, { placeholder: "None" })
173
+ }), /* @__PURE__ */ O(G, { children: [/* @__PURE__ */ D(K, {
174
+ value: Z,
169
175
  children: "None"
170
- }), i.map((e) => /* @__PURE__ */ E(G, {
176
+ }), o.map((e) => /* @__PURE__ */ D(K, {
171
177
  value: e.id,
172
178
  children: e.name
173
179
  }, e.id))] })]
174
180
  })]
175
181
  }),
176
- n ? null : /* @__PURE__ */ D("div", {
182
+ r ? null : /* @__PURE__ */ O("div", {
177
183
  className: "space-y-1.5",
178
- children: [/* @__PURE__ */ E(H, {
184
+ children: [/* @__PURE__ */ D(U, {
179
185
  htmlFor: "pf-household",
180
186
  children: "Household"
181
- }), /* @__PURE__ */ D(U, {
187
+ }), /* @__PURE__ */ O(W, {
182
188
  value: d.householdId,
183
189
  onValueChange: (e) => f((t) => ({
184
190
  ...t,
185
191
  householdId: e
186
192
  })),
187
- children: [/* @__PURE__ */ E(K, {
193
+ children: [/* @__PURE__ */ D(q, {
188
194
  id: "pf-household",
189
- children: /* @__PURE__ */ E(q, { placeholder: "None" })
190
- }), /* @__PURE__ */ D(W, { children: [/* @__PURE__ */ E(G, {
191
- value: X,
195
+ children: /* @__PURE__ */ D(J, { placeholder: "None" })
196
+ }), /* @__PURE__ */ O(G, { children: [/* @__PURE__ */ D(K, {
197
+ value: Z,
192
198
  children: "None"
193
- }), s.map((e) => /* @__PURE__ */ E(G, {
199
+ }), s.map((e) => /* @__PURE__ */ D(K, {
194
200
  value: e.id,
195
201
  children: e.name
196
202
  }, e.id))] })]
197
203
  })]
198
204
  }),
199
- /* @__PURE__ */ D("div", {
205
+ /* @__PURE__ */ O("div", {
200
206
  className: "space-y-1.5",
201
- children: [/* @__PURE__ */ E(H, {
207
+ children: [/* @__PURE__ */ D(U, {
202
208
  htmlFor: "pf-desc",
203
209
  children: "Description"
204
- }), /* @__PURE__ */ E(ye, {
210
+ }), /* @__PURE__ */ D(Se, {
205
211
  id: "pf-desc",
206
212
  value: d.description,
207
213
  onChange: (e) => f((t) => ({
@@ -214,42 +220,42 @@ function we({ open: e, onOpenChange: t, editing: n }) {
214
220
  })
215
221
  ]
216
222
  }),
217
- /* @__PURE__ */ D(L, { children: [/* @__PURE__ */ E(k, {
223
+ /* @__PURE__ */ O(z, { children: [/* @__PURE__ */ D(A, {
218
224
  variant: "outline",
219
225
  onClick: () => t(!1),
220
226
  disabled: g,
221
227
  children: "Cancel"
222
- }), /* @__PURE__ */ E(k, {
228
+ }), /* @__PURE__ */ D(A, {
223
229
  onClick: () => {
224
230
  if (!_) return;
225
- let e = Q(d.driftThresholdPct), r = d.modelPortfolioId === X ? null : d.modelPortfolioId, i = d.householdId === X ? null : d.householdId;
226
- n ? l.mutate({
227
- id: n.id,
231
+ let e = $(d.driftThresholdPct), n = d.modelPortfolioId === Z ? null : d.modelPortfolioId, i = d.householdId === Z ? null : d.householdId;
232
+ r ? u.mutate({
233
+ id: r.id,
228
234
  input: {
229
235
  name: d.name.trim(),
230
236
  baseCurrency: d.baseCurrency.trim() || "USD",
231
237
  description: d.description.trim() || null,
232
238
  driftThresholdPct: e,
233
239
  status: d.status,
234
- modelPortfolioId: r
240
+ modelPortfolioId: n
235
241
  }
236
242
  }, { onSuccess: () => t(!1) }) : c.mutate({
237
243
  name: d.name.trim(),
238
244
  baseCurrency: d.baseCurrency.trim() || "USD",
239
245
  description: d.description.trim() || null,
240
246
  driftThresholdPct: e,
241
- modelPortfolioId: r,
247
+ modelPortfolioId: n,
242
248
  householdId: i
243
249
  }, { onSuccess: () => t(!1) });
244
250
  },
245
251
  disabled: !_ || g,
246
- children: g ? "Saving…" : n ? "Save changes" : "Create portfolio"
252
+ children: g ? "Saving…" : r ? "Save changes" : "Create portfolio"
247
253
  })] })
248
254
  ]
249
255
  })
250
256
  });
251
257
  }
252
- function Te() {
258
+ function ke() {
253
259
  return {
254
260
  accountId: "",
255
261
  symbol: "",
@@ -260,156 +266,137 @@ function Te() {
260
266
  costBasis: "0"
261
267
  };
262
268
  }
263
- function Ee({ open: t, onOpenChange: r, portfolioId: i, editing: a }) {
264
- let { data: o } = e(), s = n(), c = l(), [u, d] = x(Te), [f, p] = x(null), m = a?.id ?? "new";
265
- t && f !== m && (p(m), d(a ? {
266
- accountId: a.accountId,
267
- symbol: a.symbol,
268
- name: a.name ?? "",
269
- assetClass: a.assetClass,
270
- quantity: String(a.quantity),
271
- lastPrice: String(a.lastPrice),
272
- costBasis: String(a.costBasis)
273
- } : Te())), !t && f !== null && p(null);
274
- let h = s.isPending || c.isPending, g = u.symbol.trim().length > 0, _ = a ? !0 : u.accountId.trim().length > 0, v = g && _ && !h;
275
- return /* @__PURE__ */ E(P, {
276
- open: t,
277
- onOpenChange: r,
278
- children: /* @__PURE__ */ D(F, {
269
+ function Ae({ open: e, onOpenChange: n, portfolioId: r, editing: i }) {
270
+ let a = t(), o = c(), [s, l] = S(ke), [u, d] = S(null), p = i?.id ?? "new";
271
+ e && u !== p && (d(p), l(i ? {
272
+ accountId: i.accountId,
273
+ symbol: i.symbol,
274
+ name: i.name ?? "",
275
+ assetClass: i.assetClass,
276
+ quantity: String(i.quantity),
277
+ lastPrice: String(i.lastPrice),
278
+ costBasis: String(i.costBasis)
279
+ } : ke())), !e && u !== null && d(null);
280
+ let m = a.isPending || o.isPending, h = s.symbol.trim().length > 0, g = i ? !0 : s.accountId.trim().length > 0, _ = h && g && !m;
281
+ return /* @__PURE__ */ D(I, {
282
+ open: e,
283
+ onOpenChange: n,
284
+ children: /* @__PURE__ */ O(L, {
279
285
  className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
280
286
  children: [
281
- /* @__PURE__ */ D(R, { children: [/* @__PURE__ */ E(ae, { children: a ? "Edit holding" : "Add holding" }), /* @__PURE__ */ E(I, { children: a ? "Update the position details for this holding." : "Add a position to this portfolio from one of your accounts." })] }),
282
- /* @__PURE__ */ D("div", {
287
+ /* @__PURE__ */ O(B, { children: [/* @__PURE__ */ D(se, { children: i ? "Edit holding" : "Add holding" }), /* @__PURE__ */ D(R, { children: i ? "Update the position details for this holding." : "Add a position to this portfolio from one of your accounts." })] }),
288
+ /* @__PURE__ */ O("div", {
283
289
  className: "space-y-4 py-2",
284
290
  children: [
285
- a ? null : /* @__PURE__ */ D("div", {
286
- className: "space-y-1.5",
287
- children: [
288
- /* @__PURE__ */ E(H, {
289
- htmlFor: "h-account",
290
- children: "Account"
291
- }),
292
- /* @__PURE__ */ D(U, {
293
- value: u.accountId,
294
- onValueChange: (e) => d((t) => ({
295
- ...t,
296
- accountId: e
297
- })),
298
- children: [/* @__PURE__ */ E(K, {
299
- id: "h-account",
300
- "aria-invalid": !_,
301
- children: /* @__PURE__ */ E(q, { placeholder: "Select account" })
302
- }), /* @__PURE__ */ E(W, { children: o.map((e) => /* @__PURE__ */ E(G, {
303
- value: e.id,
304
- children: e.name
305
- }, e.id)) })]
306
- }),
307
- o.length === 0 ? /* @__PURE__ */ E("p", {
308
- className: "text-xs text-text-secondary",
309
- children: "No accounts yet — create an account first."
310
- }) : null
311
- ]
291
+ i ? null : /* @__PURE__ */ D(f, {
292
+ id: "h-account",
293
+ value: s.accountId,
294
+ onChange: (e) => l((t) => ({
295
+ ...t,
296
+ accountId: e
297
+ })),
298
+ placeholder: "Select account"
312
299
  }),
313
- /* @__PURE__ */ D("div", {
300
+ /* @__PURE__ */ O("div", {
314
301
  className: "grid grid-cols-2 gap-4",
315
- children: [/* @__PURE__ */ D("div", {
302
+ children: [/* @__PURE__ */ O("div", {
316
303
  className: "space-y-1.5",
317
- children: [/* @__PURE__ */ E(H, {
304
+ children: [/* @__PURE__ */ D(U, {
318
305
  htmlFor: "h-symbol",
319
306
  children: "Symbol"
320
- }), /* @__PURE__ */ E(V, {
307
+ }), /* @__PURE__ */ D(H, {
321
308
  id: "h-symbol",
322
- value: u.symbol,
323
- onChange: (e) => d((t) => ({
309
+ value: s.symbol,
310
+ onChange: (e) => l((t) => ({
324
311
  ...t,
325
312
  symbol: e.target.value
326
313
  })),
327
314
  placeholder: "AAPL",
328
- disabled: !!a,
329
- "aria-invalid": !g
315
+ disabled: !!i,
316
+ "aria-invalid": !h
330
317
  })]
331
- }), /* @__PURE__ */ D("div", {
318
+ }), /* @__PURE__ */ O("div", {
332
319
  className: "space-y-1.5",
333
- children: [/* @__PURE__ */ E(H, {
320
+ children: [/* @__PURE__ */ D(U, {
334
321
  htmlFor: "h-class",
335
322
  children: "Asset class"
336
- }), /* @__PURE__ */ D(U, {
337
- value: u.assetClass,
338
- onValueChange: (e) => d((t) => ({
323
+ }), /* @__PURE__ */ O(W, {
324
+ value: s.assetClass,
325
+ onValueChange: (e) => l((t) => ({
339
326
  ...t,
340
327
  assetClass: e
341
328
  })),
342
- children: [/* @__PURE__ */ E(K, {
329
+ children: [/* @__PURE__ */ D(q, {
343
330
  id: "h-class",
344
- children: /* @__PURE__ */ E(q, {})
345
- }), /* @__PURE__ */ E(W, { children: be.map((e) => /* @__PURE__ */ E(G, {
331
+ children: /* @__PURE__ */ D(J, {})
332
+ }), /* @__PURE__ */ D(G, { children: Ce.map((e) => /* @__PURE__ */ D(K, {
346
333
  value: e,
347
- children: Z(e)
334
+ children: Q(e)
348
335
  }, e)) })]
349
336
  })]
350
337
  })]
351
338
  }),
352
- /* @__PURE__ */ D("div", {
339
+ /* @__PURE__ */ O("div", {
353
340
  className: "space-y-1.5",
354
- children: [/* @__PURE__ */ E(H, {
341
+ children: [/* @__PURE__ */ D(U, {
355
342
  htmlFor: "h-name",
356
343
  children: "Name"
357
- }), /* @__PURE__ */ E(V, {
344
+ }), /* @__PURE__ */ D(H, {
358
345
  id: "h-name",
359
- value: u.name,
360
- onChange: (e) => d((t) => ({
346
+ value: s.name,
347
+ onChange: (e) => l((t) => ({
361
348
  ...t,
362
349
  name: e.target.value
363
350
  })),
364
351
  placeholder: "Apple Inc."
365
352
  })]
366
353
  }),
367
- /* @__PURE__ */ D("div", {
354
+ /* @__PURE__ */ O("div", {
368
355
  className: "grid grid-cols-3 gap-4",
369
356
  children: [
370
- /* @__PURE__ */ D("div", {
357
+ /* @__PURE__ */ O("div", {
371
358
  className: "space-y-1.5",
372
- children: [/* @__PURE__ */ E(H, {
359
+ children: [/* @__PURE__ */ D(U, {
373
360
  htmlFor: "h-qty",
374
361
  children: "Quantity"
375
- }), /* @__PURE__ */ E(V, {
362
+ }), /* @__PURE__ */ D(H, {
376
363
  id: "h-qty",
377
364
  type: "number",
378
365
  step: "any",
379
- value: u.quantity,
380
- onChange: (e) => d((t) => ({
366
+ value: s.quantity,
367
+ onChange: (e) => l((t) => ({
381
368
  ...t,
382
369
  quantity: e.target.value
383
370
  }))
384
371
  })]
385
372
  }),
386
- /* @__PURE__ */ D("div", {
373
+ /* @__PURE__ */ O("div", {
387
374
  className: "space-y-1.5",
388
- children: [/* @__PURE__ */ E(H, {
375
+ children: [/* @__PURE__ */ D(U, {
389
376
  htmlFor: "h-price",
390
377
  children: "Last price"
391
- }), /* @__PURE__ */ E(V, {
378
+ }), /* @__PURE__ */ D(H, {
392
379
  id: "h-price",
393
380
  type: "number",
394
381
  step: "any",
395
- value: u.lastPrice,
396
- onChange: (e) => d((t) => ({
382
+ value: s.lastPrice,
383
+ onChange: (e) => l((t) => ({
397
384
  ...t,
398
385
  lastPrice: e.target.value
399
386
  }))
400
387
  })]
401
388
  }),
402
- /* @__PURE__ */ D("div", {
389
+ /* @__PURE__ */ O("div", {
403
390
  className: "space-y-1.5",
404
- children: [/* @__PURE__ */ E(H, {
391
+ children: [/* @__PURE__ */ D(U, {
405
392
  htmlFor: "h-cost",
406
393
  children: "Cost basis"
407
- }), /* @__PURE__ */ E(V, {
394
+ }), /* @__PURE__ */ D(H, {
408
395
  id: "h-cost",
409
396
  type: "number",
410
397
  step: "any",
411
- value: u.costBasis,
412
- onChange: (e) => d((t) => ({
398
+ value: s.costBasis,
399
+ onChange: (e) => l((t) => ({
413
400
  ...t,
414
401
  costBasis: e.target.value
415
402
  }))
@@ -419,246 +406,245 @@ function Ee({ open: t, onOpenChange: r, portfolioId: i, editing: a }) {
419
406
  })
420
407
  ]
421
408
  }),
422
- /* @__PURE__ */ D(L, { children: [/* @__PURE__ */ E(k, {
409
+ /* @__PURE__ */ O(z, { children: [/* @__PURE__ */ D(A, {
423
410
  variant: "outline",
424
- onClick: () => r(!1),
425
- disabled: h,
411
+ onClick: () => n(!1),
412
+ disabled: m,
426
413
  children: "Cancel"
427
- }), /* @__PURE__ */ E(k, {
414
+ }), /* @__PURE__ */ D(A, {
428
415
  onClick: () => {
429
- !g || !_ || (a ? c.mutate({
430
- id: a.id,
416
+ !h || !g || (i ? o.mutate({
417
+ id: i.id,
431
418
  input: {
432
- name: u.name.trim() || null,
433
- assetClass: u.assetClass,
434
- quantity: Q(u.quantity),
435
- lastPrice: Q(u.lastPrice),
436
- costBasis: Q(u.costBasis)
419
+ name: s.name.trim() || null,
420
+ assetClass: s.assetClass,
421
+ quantity: $(s.quantity),
422
+ lastPrice: $(s.lastPrice),
423
+ costBasis: $(s.costBasis)
437
424
  }
438
- }, { onSuccess: () => r(!1) }) : s.mutate({
439
- accountId: u.accountId,
440
- portfolioId: i,
441
- symbol: u.symbol.trim().toUpperCase(),
442
- name: u.name.trim() || null,
443
- assetClass: u.assetClass,
444
- quantity: Q(u.quantity),
445
- lastPrice: Q(u.lastPrice),
446
- costBasis: Q(u.costBasis)
447
- }, { onSuccess: () => r(!1) }));
425
+ }, { onSuccess: () => n(!1) }) : a.mutate({
426
+ accountId: s.accountId,
427
+ portfolioId: r,
428
+ symbol: s.symbol.trim().toUpperCase(),
429
+ name: s.name.trim() || null,
430
+ assetClass: s.assetClass,
431
+ quantity: $(s.quantity),
432
+ lastPrice: $(s.lastPrice),
433
+ costBasis: $(s.costBasis)
434
+ }, { onSuccess: () => n(!1) }));
448
435
  },
449
- disabled: !v,
450
- children: h ? "Saving…" : a ? "Save changes" : "Add holding"
436
+ disabled: !_,
437
+ children: m ? "Saving…" : i ? "Save changes" : "Add holding"
451
438
  })] })
452
439
  ]
453
440
  })
454
441
  });
455
442
  }
456
- function De({ portfolioId: e, onOpenChange: t }) {
457
- let { data: n, isLoading: r, isError: a, refetch: o } = s(e ?? void 0), c = i(), [l, u] = x(!1), [m, g] = x(null), S = n?.holdings ?? [], C = n?.baseCurrency ?? "USD", P = S.reduce((e, t) => e + t.marketValue, 0), F = b(() => {
458
- if (S.length === 0 || P <= 0) return [];
443
+ function je({ portfolioId: e, onOpenChange: t }) {
444
+ let { data: n, isLoading: i, isError: a, refetch: o } = s(e ?? void 0), c = r(), [l, u] = S(!1), [f, g] = S(null), [v, C] = S(null), w = n?.holdings ?? [], I = n?.baseCurrency ?? "USD", L = w.reduce((e, t) => e + t.marketValue, 0), R = x(() => {
445
+ if (w.length === 0 || L <= 0) return [];
459
446
  let e = /* @__PURE__ */ new Map();
460
- return S.forEach((t) => e.set(t.assetClass, (e.get(t.assetClass) ?? 0) + t.marketValue)), Array.from(e.entries()).map(([e, t]) => ({
461
- label: Z(e),
462
- value: t / P * 100,
463
- caption: _(t, C),
447
+ return w.forEach((t) => e.set(t.assetClass, (e.get(t.assetClass) ?? 0) + t.marketValue)), Array.from(e.entries()).map(([e, t]) => ({
448
+ label: Q(e),
449
+ value: t / L * 100,
450
+ caption: y(t, I),
464
451
  tone: "default"
465
452
  })).sort((e, t) => t.value - e.value);
466
453
  }, [
467
- S,
468
- P,
469
- C
470
- ]), I = b(() => Se(n?.targetAllocation), [n?.targetAllocation]), L = () => {
454
+ w,
455
+ L,
456
+ I
457
+ ]), z = x(() => Te(n?.targetAllocation), [n?.targetAllocation]), B = () => {
471
458
  g(null), u(!0);
472
- }, R = (e) => {
459
+ }, se = (e) => {
473
460
  g(e), u(!0);
474
461
  };
475
- return /* @__PURE__ */ E(ue, {
462
+ return /* @__PURE__ */ D(pe, {
476
463
  open: e !== null,
477
464
  onOpenChange: t,
478
- children: /* @__PURE__ */ E(de, {
465
+ children: /* @__PURE__ */ D(me, {
479
466
  className: "flex w-full flex-col gap-0 overflow-y-auto p-0 sm:max-w-2xl",
480
- children: r ? /* @__PURE__ */ E("div", {
467
+ children: i ? /* @__PURE__ */ D("div", {
481
468
  className: "p-6",
482
- children: /* @__PURE__ */ E(h, { rows: 5 })
483
- }) : a ? /* @__PURE__ */ E("div", {
469
+ children: /* @__PURE__ */ D(_, { rows: 5 })
470
+ }) : a ? /* @__PURE__ */ D("div", {
484
471
  className: "p-6",
485
- children: /* @__PURE__ */ E(p, { onRetry: () => o() })
486
- }) : n ? /* @__PURE__ */ D(re, { children: [
487
- /* @__PURE__ */ D(pe, {
472
+ children: /* @__PURE__ */ D(h, { onRetry: () => o() })
473
+ }) : n ? /* @__PURE__ */ O(oe, { children: [
474
+ /* @__PURE__ */ O(ge, {
488
475
  className: "border-b border-border-subtle p-6",
489
- children: [/* @__PURE__ */ D("div", {
476
+ children: [/* @__PURE__ */ O("div", {
490
477
  className: "flex items-center gap-2",
491
- children: [/* @__PURE__ */ E(me, {
478
+ children: [/* @__PURE__ */ D(_e, {
492
479
  className: "text-xl",
493
480
  children: n.name
494
- }), /* @__PURE__ */ E(O, {
495
- variant: y(n.status),
496
- children: Z(n.status)
481
+ }), /* @__PURE__ */ D(k, {
482
+ variant: ee(n.status),
483
+ children: Q(n.status)
497
484
  })]
498
- }), /* @__PURE__ */ E(fe, { children: n.description?.trim() ? n.description : `${n.baseCurrency} · Drift threshold ${v(n.driftThresholdPct)}` })]
485
+ }), /* @__PURE__ */ D(he, { children: n.description?.trim() ? n.description : `${n.baseCurrency} · Drift threshold ${b(n.driftThresholdPct)}` })]
499
486
  }),
500
- /* @__PURE__ */ D("div", {
487
+ /* @__PURE__ */ O("div", {
501
488
  className: "space-y-6 p-6",
502
489
  children: [
503
- /* @__PURE__ */ D("div", {
490
+ /* @__PURE__ */ O("div", {
504
491
  className: "grid grid-cols-2 gap-4",
505
- children: [/* @__PURE__ */ E(A, { children: /* @__PURE__ */ D(j, {
492
+ children: [/* @__PURE__ */ D(j, { children: /* @__PURE__ */ O(M, {
506
493
  className: "space-y-1 p-4",
507
- children: [/* @__PURE__ */ E("p", {
494
+ children: [/* @__PURE__ */ D("p", {
508
495
  className: "text-xs text-text-secondary",
509
496
  children: "Market value"
510
- }), /* @__PURE__ */ E("p", {
497
+ }), /* @__PURE__ */ D("p", {
511
498
  className: "text-2xl font-semibold text-text-primary",
512
- children: _(P, C)
499
+ children: y(L, I)
513
500
  })]
514
- }) }), /* @__PURE__ */ E(A, { children: /* @__PURE__ */ D(j, {
501
+ }) }), /* @__PURE__ */ D(j, { children: /* @__PURE__ */ O(M, {
515
502
  className: "space-y-1 p-4",
516
- children: [/* @__PURE__ */ E("p", {
503
+ children: [/* @__PURE__ */ D("p", {
517
504
  className: "text-xs text-text-secondary",
518
505
  children: "Holdings"
519
- }), /* @__PURE__ */ E("p", {
506
+ }), /* @__PURE__ */ D("p", {
520
507
  className: "text-2xl font-semibold text-text-primary",
521
- children: S.length
508
+ children: w.length
522
509
  })]
523
510
  }) })]
524
511
  }),
525
- /* @__PURE__ */ D("div", {
512
+ /* @__PURE__ */ O("div", {
526
513
  className: "grid gap-4 md:grid-cols-2",
527
- children: [/* @__PURE__ */ D(A, { children: [/* @__PURE__ */ E(M, {
514
+ children: [/* @__PURE__ */ O(j, { children: [/* @__PURE__ */ D(P, {
528
515
  className: "pb-3",
529
- children: /* @__PURE__ */ E(N, {
516
+ children: /* @__PURE__ */ D(F, {
530
517
  className: "text-sm",
531
518
  children: "Target allocation"
532
519
  })
533
- }), /* @__PURE__ */ E(j, { children: I.length > 0 ? /* @__PURE__ */ E(d, { data: I }) : /* @__PURE__ */ E("p", {
520
+ }), /* @__PURE__ */ D(M, { children: z.length > 0 ? /* @__PURE__ */ D(p, { data: z }) : /* @__PURE__ */ D("p", {
534
521
  className: "text-sm text-text-secondary",
535
522
  children: "No target allocation set for this portfolio."
536
- }) })] }), /* @__PURE__ */ D(A, { children: [/* @__PURE__ */ E(M, {
523
+ }) })] }), /* @__PURE__ */ O(j, { children: [/* @__PURE__ */ D(P, {
537
524
  className: "pb-3",
538
- children: /* @__PURE__ */ E(N, {
525
+ children: /* @__PURE__ */ D(F, {
539
526
  className: "text-sm",
540
527
  children: "Actual allocation"
541
528
  })
542
- }), /* @__PURE__ */ E(j, { children: F.length > 0 ? /* @__PURE__ */ E(d, { data: F }) : /* @__PURE__ */ E("p", {
529
+ }), /* @__PURE__ */ D(M, { children: R.length > 0 ? /* @__PURE__ */ D(p, { data: R }) : /* @__PURE__ */ D("p", {
543
530
  className: "text-sm text-text-secondary",
544
531
  children: "Add holdings to see the live allocation."
545
532
  }) })] })]
546
533
  }),
547
- /* @__PURE__ */ D(A, { children: [/* @__PURE__ */ D(M, {
534
+ /* @__PURE__ */ O(j, { children: [/* @__PURE__ */ O(P, {
548
535
  className: "flex flex-row items-center justify-between",
549
- children: [/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E(N, {
536
+ children: [/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D(F, {
550
537
  className: "text-base",
551
538
  children: "Holdings"
552
- }), /* @__PURE__ */ E(ie, { children: "Positions held in this portfolio" })] }), /* @__PURE__ */ D(k, {
539
+ }), /* @__PURE__ */ D(N, { children: "Positions held in this portfolio" })] }), /* @__PURE__ */ O(A, {
553
540
  size: "sm",
554
- onClick: L,
555
- children: [/* @__PURE__ */ E(T, {
541
+ onClick: B,
542
+ children: [/* @__PURE__ */ D(E, {
556
543
  className: "size-4",
557
544
  "aria-hidden": "true"
558
545
  }), "Add holding"]
559
546
  })]
560
- }), /* @__PURE__ */ E(j, { children: S.length === 0 ? /* @__PURE__ */ E(f, {
561
- icon: /* @__PURE__ */ E(w, {
547
+ }), /* @__PURE__ */ D(M, { children: w.length === 0 ? /* @__PURE__ */ D(m, {
548
+ icon: /* @__PURE__ */ D(T, {
562
549
  className: "size-6",
563
550
  "aria-hidden": "true"
564
551
  }),
565
552
  title: "No holdings yet",
566
553
  description: "Add positions to start tracking this portfolio.",
567
- action: /* @__PURE__ */ D(k, {
554
+ action: /* @__PURE__ */ O(A, {
568
555
  size: "sm",
569
- onClick: L,
570
- children: [/* @__PURE__ */ E(T, {
556
+ onClick: B,
557
+ children: [/* @__PURE__ */ D(E, {
571
558
  className: "size-4",
572
559
  "aria-hidden": "true"
573
560
  }), "Add holding"]
574
561
  })
575
- }) : /* @__PURE__ */ E("div", {
562
+ }) : /* @__PURE__ */ D("div", {
576
563
  className: "overflow-x-auto",
577
- children: /* @__PURE__ */ D(he, { children: [/* @__PURE__ */ E(_e, { children: /* @__PURE__ */ D(ve, { children: [
578
- /* @__PURE__ */ E(Y, { children: "Symbol" }),
579
- /* @__PURE__ */ E(Y, { children: "Class" }),
580
- /* @__PURE__ */ E(Y, {
564
+ children: /* @__PURE__ */ O(ve, { children: [/* @__PURE__ */ D(be, { children: /* @__PURE__ */ O(xe, { children: [
565
+ /* @__PURE__ */ D(X, { children: "Symbol" }),
566
+ /* @__PURE__ */ D(X, { children: "Class" }),
567
+ /* @__PURE__ */ D(X, {
581
568
  className: "text-right",
582
569
  children: "Qty"
583
570
  }),
584
- /* @__PURE__ */ E(Y, {
571
+ /* @__PURE__ */ D(X, {
585
572
  className: "text-right",
586
573
  children: "Price"
587
574
  }),
588
- /* @__PURE__ */ E(Y, {
575
+ /* @__PURE__ */ D(X, {
589
576
  className: "text-right",
590
577
  children: "Market value"
591
578
  }),
592
- /* @__PURE__ */ E(Y, {
579
+ /* @__PURE__ */ D(X, {
593
580
  className: "text-right",
594
581
  children: "Gain"
595
582
  }),
596
- /* @__PURE__ */ E(Y, { className: "w-10" })
597
- ] }) }), /* @__PURE__ */ E(ge, { children: S.map((e) => {
583
+ /* @__PURE__ */ D(X, { className: "w-10" })
584
+ ] }) }), /* @__PURE__ */ D(ye, { children: w.map((e) => {
598
585
  let t = e.marketValue - e.costBasis;
599
- return /* @__PURE__ */ D(ve, { children: [
600
- /* @__PURE__ */ D(J, { children: [/* @__PURE__ */ E("div", {
586
+ return /* @__PURE__ */ O(xe, { children: [
587
+ /* @__PURE__ */ O(Y, { children: [/* @__PURE__ */ D("div", {
601
588
  className: "font-semibold text-text-primary",
602
589
  children: e.symbol
603
- }), e.name ? /* @__PURE__ */ E("div", {
590
+ }), e.name ? /* @__PURE__ */ D("div", {
604
591
  className: "text-xs text-text-secondary",
605
592
  children: e.name
606
593
  }) : null] }),
607
- /* @__PURE__ */ E(J, { children: /* @__PURE__ */ E(O, {
594
+ /* @__PURE__ */ D(Y, { children: /* @__PURE__ */ D(k, {
608
595
  variant: "outline",
609
- children: Z(e.assetClass)
596
+ children: Q(e.assetClass)
610
597
  }) }),
611
- /* @__PURE__ */ E(J, {
598
+ /* @__PURE__ */ D(Y, {
612
599
  className: "text-right tabular-nums",
613
600
  children: e.quantity
614
601
  }),
615
- /* @__PURE__ */ E(J, {
602
+ /* @__PURE__ */ D(Y, {
616
603
  className: "text-right tabular-nums",
617
- children: _(e.lastPrice, e.currency)
604
+ children: y(e.lastPrice, e.currency)
618
605
  }),
619
- /* @__PURE__ */ E(J, {
606
+ /* @__PURE__ */ D(Y, {
620
607
  className: "text-right font-medium tabular-nums",
621
- children: _(e.marketValue, e.currency)
608
+ children: y(e.marketValue, e.currency)
622
609
  }),
623
- /* @__PURE__ */ E(J, {
610
+ /* @__PURE__ */ D(Y, {
624
611
  className: "text-right tabular-nums",
625
- children: /* @__PURE__ */ E(Ce, {
612
+ children: /* @__PURE__ */ D(Ee, {
626
613
  value: t,
627
614
  currency: e.currency
628
615
  })
629
616
  }),
630
- /* @__PURE__ */ E(J, {
617
+ /* @__PURE__ */ D(Y, {
631
618
  className: "text-right",
632
- children: /* @__PURE__ */ D(z, { children: [/* @__PURE__ */ E(le, {
619
+ children: /* @__PURE__ */ O(ce, { children: [/* @__PURE__ */ D(fe, {
633
620
  asChild: !0,
634
- children: /* @__PURE__ */ E(k, {
621
+ children: /* @__PURE__ */ D(A, {
635
622
  variant: "ghost",
636
623
  size: "icon",
637
624
  className: "size-10",
638
625
  "aria-label": `Actions for ${e.symbol}`,
639
- children: /* @__PURE__ */ E(ee, {
626
+ children: /* @__PURE__ */ D(re, {
640
627
  className: "size-4",
641
628
  "aria-hidden": "true"
642
629
  })
643
630
  })
644
- }), /* @__PURE__ */ D(oe, {
631
+ }), /* @__PURE__ */ O(le, {
645
632
  align: "end",
646
633
  children: [
647
- /* @__PURE__ */ E(se, { children: e.symbol }),
648
- /* @__PURE__ */ E(ce, {}),
649
- /* @__PURE__ */ D(B, {
634
+ /* @__PURE__ */ D(ue, { children: e.symbol }),
635
+ /* @__PURE__ */ D(de, {}),
636
+ /* @__PURE__ */ O(V, {
650
637
  className: "gap-2",
651
- onClick: () => R(e),
652
- children: [/* @__PURE__ */ E(te, {
638
+ onClick: () => se(e),
639
+ children: [/* @__PURE__ */ D(ie, {
653
640
  className: "size-4",
654
641
  "aria-hidden": "true"
655
642
  }), "Edit"]
656
643
  }),
657
- /* @__PURE__ */ D(B, {
644
+ /* @__PURE__ */ O(V, {
658
645
  className: "gap-2 text-status-error-text focus:text-status-error-text",
659
- disabled: c.isPending,
660
- onClick: () => c.mutate(e.id),
661
- children: [/* @__PURE__ */ E(ne, {
646
+ onClick: () => C(e),
647
+ children: [/* @__PURE__ */ D(ae, {
662
648
  className: "size-4",
663
649
  "aria-hidden": "true"
664
650
  }), "Delete"]
@@ -668,19 +654,52 @@ function De({ portfolioId: e, onOpenChange: t }) {
668
654
  })
669
655
  ] }, e.id);
670
656
  }) })] })
671
- }) })] })
657
+ }) })] }),
658
+ /* @__PURE__ */ O(j, { children: [/* @__PURE__ */ O(P, {
659
+ className: "pb-3",
660
+ children: [/* @__PURE__ */ D(F, {
661
+ className: "text-sm",
662
+ children: "Tags"
663
+ }), /* @__PURE__ */ D(N, { children: "Organize and filter this portfolio." })]
664
+ }), /* @__PURE__ */ D(M, { children: /* @__PURE__ */ D(te, {
665
+ entityType: "brainyrich-portfolio",
666
+ entityId: n.id,
667
+ hideLabel: !0
668
+ }) })] }),
669
+ /* @__PURE__ */ D(j, { children: /* @__PURE__ */ D(M, {
670
+ className: "pt-6",
671
+ children: /* @__PURE__ */ D(ne, {
672
+ entityType: "brainyrich-portfolio",
673
+ entityId: n.id
674
+ })
675
+ }) })
672
676
  ]
673
677
  }),
674
- /* @__PURE__ */ E(Ee, {
678
+ /* @__PURE__ */ D(Ae, {
675
679
  open: l,
676
680
  onOpenChange: u,
677
681
  portfolioId: n.id,
678
- editing: m
682
+ editing: f
683
+ }),
684
+ /* @__PURE__ */ D(d, {
685
+ open: v !== null,
686
+ onOpenChange: (e) => {
687
+ e || C(null);
688
+ },
689
+ title: "Delete holding?",
690
+ description: v ? `Remove ${v.symbol} from this portfolio. This cannot be undone.` : void 0,
691
+ confirmLabel: "Delete",
692
+ pendingLabel: "Deleting…",
693
+ destructive: !0,
694
+ pending: c.isPending,
695
+ onConfirm: () => {
696
+ v && c.mutate(v.id, { onSuccess: () => C(null) });
697
+ }
679
698
  })
680
- ] }) : /* @__PURE__ */ E("div", {
699
+ ] }) : /* @__PURE__ */ D("div", {
681
700
  className: "p-6",
682
- children: /* @__PURE__ */ E(f, {
683
- icon: /* @__PURE__ */ E(w, {
701
+ children: /* @__PURE__ */ D(m, {
702
+ icon: /* @__PURE__ */ D(T, {
684
703
  className: "size-6",
685
704
  "aria-hidden": "true"
686
705
  }),
@@ -691,154 +710,177 @@ function De({ portfolioId: e, onOpenChange: t }) {
691
710
  })
692
711
  });
693
712
  }
694
- function Oe() {
695
- let { data: e, isLoading: n, isError: r, refetch: i } = c(), a = t(), [o, s] = x(!1), [l, u] = x(null), [d, _] = x(null), b = e.filter((e) => e.status === "ACTIVE").length, S = e.filter((e) => e.status === "DRAFT").length, C = e.length > 0 ? e.reduce((e, t) => e + t.driftThresholdPct, 0) / e.length : 0, P = () => {
696
- u(null), s(!0);
697
- }, F = (e) => {
698
- u(e), s(!0);
713
+ function Me() {
714
+ let { items: t, hasMore: n, loadMore: r, isLoading: i, isFetchingNextPage: a, isError: s, refetch: c } = o(), l = e(), [f, p] = S(!1), [y, te] = S(null), [ne, x] = S(null), [C, w] = S(null), I = t.filter((e) => e.status === "ACTIVE").length, L = t.filter((e) => e.status === "DRAFT").length, R = t.length > 0 ? t.reduce((e, t) => e + t.driftThresholdPct, 0) / t.length : 0, z = () => {
715
+ te(null), p(!0);
716
+ }, B = (e) => {
717
+ te(e), p(!0);
699
718
  };
700
- return /* @__PURE__ */ D(g, {
719
+ return /* @__PURE__ */ O(v, {
701
720
  title: "Portfolios",
702
721
  description: "Organize holdings into strategies and keep allocations on target.",
703
- badges: e.length > 0 ? [`${e.length} total`] : [],
704
- actions: /* @__PURE__ */ D(k, {
722
+ badges: t.length > 0 ? [`${t.length} total`] : [],
723
+ actions: /* @__PURE__ */ O(A, {
705
724
  size: "sm",
706
- onClick: P,
707
- children: [/* @__PURE__ */ E(T, {
725
+ onClick: z,
726
+ children: [/* @__PURE__ */ D(E, {
708
727
  className: "size-4",
709
728
  "aria-hidden": "true"
710
729
  }), "New portfolio"]
711
730
  }),
712
731
  children: [
713
- n ? /* @__PURE__ */ E(h, { rows: 4 }) : r ? /* @__PURE__ */ E(p, { onRetry: () => i() }) : e.length === 0 ? /* @__PURE__ */ E(f, {
714
- icon: /* @__PURE__ */ E(w, {
732
+ i ? /* @__PURE__ */ D(_, { rows: 4 }) : s ? /* @__PURE__ */ D(h, { onRetry: () => c() }) : t.length === 0 ? /* @__PURE__ */ D(m, {
733
+ icon: /* @__PURE__ */ D(T, {
715
734
  className: "size-6",
716
735
  "aria-hidden": "true"
717
736
  }),
718
737
  title: "No portfolios yet",
719
738
  description: "Create your first portfolio to start organizing holdings and tracking drift.",
720
- action: /* @__PURE__ */ D(k, {
739
+ action: /* @__PURE__ */ O(A, {
721
740
  size: "sm",
722
- onClick: P,
723
- children: [/* @__PURE__ */ E(T, {
741
+ onClick: z,
742
+ children: [/* @__PURE__ */ D(E, {
724
743
  className: "size-4",
725
744
  "aria-hidden": "true"
726
745
  }), "New portfolio"]
727
746
  })
728
- }) : /* @__PURE__ */ D(re, { children: [/* @__PURE__ */ E(m, { items: [
729
- {
730
- label: "Portfolios",
731
- value: String(e.length)
732
- },
733
- {
734
- label: "Active",
735
- value: String(b)
736
- },
737
- {
738
- label: "Drafts",
739
- value: String(S)
740
- },
741
- {
742
- label: "Avg drift threshold",
743
- value: v(C)
744
- }
745
- ] }), /* @__PURE__ */ E("div", {
746
- className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
747
- children: e.map((e) => /* @__PURE__ */ D(A, {
748
- className: "flex flex-col",
749
- children: [/* @__PURE__ */ D(M, {
750
- className: "pb-3",
751
- children: [/* @__PURE__ */ D("div", {
752
- className: "flex items-start justify-between gap-2",
753
- children: [/* @__PURE__ */ D(N, {
754
- className: "flex items-center gap-2 text-base",
755
- children: [/* @__PURE__ */ E(w, {
756
- className: "size-4 text-text-secondary",
757
- "aria-hidden": "true"
758
- }), e.name]
759
- }), /* @__PURE__ */ D(z, { children: [/* @__PURE__ */ E(le, {
760
- asChild: !0,
761
- children: /* @__PURE__ */ E(k, {
762
- variant: "ghost",
763
- size: "icon",
764
- className: "size-10",
765
- "aria-label": `Actions for ${e.name}`,
766
- children: /* @__PURE__ */ E(ee, {
767
- className: "size-4",
747
+ }) : /* @__PURE__ */ O(oe, { children: [
748
+ /* @__PURE__ */ D(g, { items: [
749
+ {
750
+ label: "Portfolios",
751
+ value: String(t.length)
752
+ },
753
+ {
754
+ label: "Active",
755
+ value: String(I)
756
+ },
757
+ {
758
+ label: "Drafts",
759
+ value: String(L)
760
+ },
761
+ {
762
+ label: "Avg drift threshold",
763
+ value: b(R)
764
+ }
765
+ ] }),
766
+ /* @__PURE__ */ D("div", {
767
+ className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
768
+ children: t.map((e) => /* @__PURE__ */ O(j, {
769
+ className: "flex flex-col",
770
+ children: [/* @__PURE__ */ O(P, {
771
+ className: "pb-3",
772
+ children: [/* @__PURE__ */ O("div", {
773
+ className: "flex items-start justify-between gap-2",
774
+ children: [/* @__PURE__ */ O(F, {
775
+ className: "flex items-center gap-2 text-base",
776
+ children: [/* @__PURE__ */ D(T, {
777
+ className: "size-4 text-text-secondary",
768
778
  "aria-hidden": "true"
769
- })
770
- })
771
- }), /* @__PURE__ */ D(oe, {
772
- align: "end",
773
- children: [
774
- /* @__PURE__ */ E(se, { children: e.name }),
775
- /* @__PURE__ */ E(ce, {}),
776
- /* @__PURE__ */ D(B, {
777
- className: "gap-2",
778
- onClick: () => F(e),
779
- children: [/* @__PURE__ */ E(te, {
779
+ }), e.name]
780
+ }), /* @__PURE__ */ O(ce, { children: [/* @__PURE__ */ D(fe, {
781
+ asChild: !0,
782
+ children: /* @__PURE__ */ D(A, {
783
+ variant: "ghost",
784
+ size: "icon",
785
+ className: "size-10",
786
+ "aria-label": `Actions for ${e.name}`,
787
+ children: /* @__PURE__ */ D(re, {
780
788
  className: "size-4",
781
789
  "aria-hidden": "true"
782
- }), "Edit"]
790
+ })
791
+ })
792
+ }), /* @__PURE__ */ O(le, {
793
+ align: "end",
794
+ children: [
795
+ /* @__PURE__ */ D(ue, { children: e.name }),
796
+ /* @__PURE__ */ D(de, {}),
797
+ /* @__PURE__ */ O(V, {
798
+ className: "gap-2",
799
+ onClick: () => B(e),
800
+ children: [/* @__PURE__ */ D(ie, {
801
+ className: "size-4",
802
+ "aria-hidden": "true"
803
+ }), "Edit"]
804
+ }),
805
+ /* @__PURE__ */ O(V, {
806
+ className: "gap-2 text-status-error-text focus:text-status-error-text",
807
+ disabled: e.status === "ARCHIVED",
808
+ onClick: () => w(e),
809
+ children: [/* @__PURE__ */ D(ae, {
810
+ className: "size-4",
811
+ "aria-hidden": "true"
812
+ }), "Archive"]
813
+ })
814
+ ]
815
+ })] })]
816
+ }), e.description?.trim() ? /* @__PURE__ */ D(N, {
817
+ className: "line-clamp-2",
818
+ children: e.description
819
+ }) : null]
820
+ }), /* @__PURE__ */ O(M, {
821
+ className: "flex flex-1 flex-col justify-between gap-4",
822
+ children: [/* @__PURE__ */ O("div", {
823
+ className: "flex flex-wrap items-center gap-2",
824
+ children: [
825
+ /* @__PURE__ */ D(k, {
826
+ variant: ee(e.status),
827
+ children: Q(e.status)
783
828
  }),
784
- /* @__PURE__ */ D(B, {
785
- className: "gap-2 text-status-error-text focus:text-status-error-text",
786
- disabled: a.isPending || e.status === "ARCHIVED",
787
- onClick: () => a.mutate(e.id),
788
- children: [/* @__PURE__ */ E(ne, {
789
- className: "size-4",
790
- "aria-hidden": "true"
791
- }), "Archive"]
829
+ /* @__PURE__ */ D(k, {
830
+ variant: "outline",
831
+ children: e.baseCurrency
832
+ }),
833
+ /* @__PURE__ */ O(k, {
834
+ variant: "secondary",
835
+ children: ["Drift ", b(e.driftThresholdPct)]
792
836
  })
793
837
  ]
794
- })] })]
795
- }), e.description?.trim() ? /* @__PURE__ */ E(ie, {
796
- className: "line-clamp-2",
797
- children: e.description
798
- }) : null]
799
- }), /* @__PURE__ */ D(j, {
800
- className: "flex flex-1 flex-col justify-between gap-4",
801
- children: [/* @__PURE__ */ D("div", {
802
- className: "flex flex-wrap items-center gap-2",
803
- children: [
804
- /* @__PURE__ */ E(O, {
805
- variant: y(e.status),
806
- children: Z(e.status)
807
- }),
808
- /* @__PURE__ */ E(O, {
809
- variant: "outline",
810
- children: e.baseCurrency
811
- }),
812
- /* @__PURE__ */ D(O, {
813
- variant: "secondary",
814
- children: ["Drift ", v(e.driftThresholdPct)]
815
- })
816
- ]
817
- }), /* @__PURE__ */ E(k, {
818
- variant: "outline",
819
- size: "sm",
820
- className: "w-full",
821
- onClick: () => _(e.id),
822
- children: "View holdings"
838
+ }), /* @__PURE__ */ D(A, {
839
+ variant: "outline",
840
+ size: "sm",
841
+ className: "w-full",
842
+ onClick: () => x(e.id),
843
+ children: "View holdings"
844
+ })]
823
845
  })]
824
- })]
825
- }, e.id))
826
- })] }),
827
- /* @__PURE__ */ E(we, {
828
- open: o,
829
- onOpenChange: s,
830
- editing: l
846
+ }, e.id))
847
+ }),
848
+ /* @__PURE__ */ D(u, {
849
+ hasMore: n,
850
+ onClick: r,
851
+ loading: a
852
+ })
853
+ ] }),
854
+ /* @__PURE__ */ D(Oe, {
855
+ open: f,
856
+ onOpenChange: p,
857
+ editing: y
858
+ }),
859
+ /* @__PURE__ */ D(je, {
860
+ portfolioId: ne,
861
+ onOpenChange: (e) => {
862
+ e || x(null);
863
+ }
831
864
  }),
832
- /* @__PURE__ */ E(De, {
833
- portfolioId: d,
865
+ /* @__PURE__ */ D(d, {
866
+ open: C !== null,
834
867
  onOpenChange: (e) => {
835
- e || _(null);
868
+ e || w(null);
869
+ },
870
+ title: "Archive portfolio?",
871
+ description: C ? `Archive “${C.name}”. It will move to archived status and stop appearing in active views.` : void 0,
872
+ confirmLabel: "Archive",
873
+ pendingLabel: "Archiving…",
874
+ destructive: !0,
875
+ pending: l.isPending,
876
+ onConfirm: () => {
877
+ C && l.mutate(C.id, { onSuccess: () => w(null) });
836
878
  }
837
879
  })
838
880
  ]
839
881
  });
840
882
  }
841
883
  //#endregion
842
- export { Oe as PortfoliosPage };
884
+ export { Me as PortfoliosPage };
843
885
 
844
886
  //# sourceMappingURL=PortfoliosPage.js.map