@burdenoff/microfe-theglobalfuel 2026.705.3 → 2026.705.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.
Files changed (66) hide show
  1. package/dist/theglobalfuel/TheGlobalFuelRoot.js +54 -46
  2. package/dist/theglobalfuel/TheGlobalFuelRoot.js.map +1 -1
  3. package/dist/theglobalfuel/TheGlobalFuelRoutes.js +10 -6
  4. package/dist/theglobalfuel/TheGlobalFuelRoutes.js.map +1 -1
  5. package/dist/theglobalfuel/components/DataTable.js +126 -58
  6. package/dist/theglobalfuel/components/DataTable.js.map +1 -1
  7. package/dist/theglobalfuel/components/EmptyState.js +4 -4
  8. package/dist/theglobalfuel/components/EmptyState.js.map +1 -1
  9. package/dist/theglobalfuel/components/MetricsCard.js +2 -2
  10. package/dist/theglobalfuel/components/MetricsCard.js.map +1 -1
  11. package/dist/theglobalfuel/components/WorldMap.js +115 -0
  12. package/dist/theglobalfuel/components/WorldMap.js.map +1 -0
  13. package/dist/theglobalfuel/components/index.js +9 -0
  14. package/dist/theglobalfuel/components/viz/AllocationBar.js +68 -0
  15. package/dist/theglobalfuel/components/viz/AllocationBar.js.map +1 -0
  16. package/dist/theglobalfuel/components/viz/AreaChart.js +102 -0
  17. package/dist/theglobalfuel/components/viz/AreaChart.js.map +1 -0
  18. package/dist/theglobalfuel/components/viz/AvatarStack.js +2 -0
  19. package/dist/theglobalfuel/components/viz/BarChart.js +4 -0
  20. package/dist/theglobalfuel/components/viz/CertificateCard.js +4 -0
  21. package/dist/theglobalfuel/components/viz/DonutChart.js +109 -0
  22. package/dist/theglobalfuel/components/viz/DonutChart.js.map +1 -0
  23. package/dist/theglobalfuel/components/viz/HBarFunnel.js +3 -0
  24. package/dist/theglobalfuel/components/viz/Heatmap.js +3 -0
  25. package/dist/theglobalfuel/components/viz/KanbanBoard.js +2 -0
  26. package/dist/theglobalfuel/components/viz/LineChart.js +4 -0
  27. package/dist/theglobalfuel/components/viz/OrgTree.js +2 -0
  28. package/dist/theglobalfuel/components/viz/PathSteps.js +68 -0
  29. package/dist/theglobalfuel/components/viz/PathSteps.js.map +1 -0
  30. package/dist/theglobalfuel/components/viz/ProgressRing.js +6 -0
  31. package/dist/theglobalfuel/components/viz/ProgressRing.js.map +1 -0
  32. package/dist/theglobalfuel/components/viz/RatingStars.js +3 -0
  33. package/dist/theglobalfuel/components/viz/SegmentedTabs.js +3 -0
  34. package/dist/theglobalfuel/components/viz/SkillBar.js +3 -0
  35. package/dist/theglobalfuel/components/viz/Sparkline.js +74 -0
  36. package/dist/theglobalfuel/components/viz/Sparkline.js.map +1 -0
  37. package/dist/theglobalfuel/components/viz/StatCard.js +3 -0
  38. package/dist/theglobalfuel/components/viz/StepProgress.js +64 -0
  39. package/dist/theglobalfuel/components/viz/StepProgress.js.map +1 -0
  40. package/dist/theglobalfuel/components/viz/Timeline.js +66 -0
  41. package/dist/theglobalfuel/components/viz/Timeline.js.map +1 -0
  42. package/dist/theglobalfuel/components/viz/index.js +23 -0
  43. package/dist/theglobalfuel/components/viz/lib/Avatar.js +1 -0
  44. package/dist/theglobalfuel/components/viz/lib/CartesianFrame.js +119 -0
  45. package/dist/theglobalfuel/components/viz/lib/CartesianFrame.js.map +1 -0
  46. package/dist/theglobalfuel/components/viz/lib/ResponsiveSvg.js +35 -0
  47. package/dist/theglobalfuel/components/viz/lib/ResponsiveSvg.js.map +1 -0
  48. package/dist/theglobalfuel/components/viz/lib/format.js +17 -0
  49. package/dist/theglobalfuel/components/viz/lib/format.js.map +1 -0
  50. package/dist/theglobalfuel/components/viz/lib/geometry.js +61 -0
  51. package/dist/theglobalfuel/components/viz/lib/geometry.js.map +1 -0
  52. package/dist/theglobalfuel/components/viz/lib/hooks.js +39 -0
  53. package/dist/theglobalfuel/components/viz/lib/hooks.js.map +1 -0
  54. package/dist/theglobalfuel/components/viz/lib/palette.js +27 -0
  55. package/dist/theglobalfuel/components/viz/lib/palette.js.map +1 -0
  56. package/dist/theglobalfuel/pages/assets/AssetDetailPage.js +431 -316
  57. package/dist/theglobalfuel/pages/assets/AssetDetailPage.js.map +1 -1
  58. package/dist/theglobalfuel/pages/dashboard/DashboardPage.js +525 -227
  59. package/dist/theglobalfuel/pages/dashboard/DashboardPage.js.map +1 -1
  60. package/dist/theglobalfuel/pages/emissions/EmissionsPage.js +255 -206
  61. package/dist/theglobalfuel/pages/emissions/EmissionsPage.js.map +1 -1
  62. package/dist/theglobalfuel/pages/provenance/ProvenancePage.js +465 -0
  63. package/dist/theglobalfuel/pages/provenance/ProvenancePage.js.map +1 -0
  64. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js +356 -227
  65. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js.map +1 -1
  66. package/package.json +1 -1
@@ -1,27 +1,33 @@
1
1
  import { useTheGlobalFuel as e } from "../../context/TheGlobalFuelContext.js";
2
- import { PageLayout as t } from "../../components/PageLayout.js";
3
- import { MetricsCard as n } from "../../components/MetricsCard.js";
4
- import { formatDate as r, formatEnumLabel as i, formatNumber as a, formatPercent as o, formatRelativeTime as s, formatTonnesCo2e as c, formatVolume as l, isExpired as u } from "../../utils/formatters.js";
5
- import { StatusBadge as d } from "../../components/StatusBadge.js";
6
- import { MiniBar as f } from "../../components/MiniBar.js";
7
- import { DataTable as p } from "../../components/DataTable.js";
8
- import { ErrorView as m, LoadingView as h, Section as g } from "../../components/StateViews.js";
9
- import { EmptyState as _ } from "../../components/EmptyState.js";
2
+ import { cn as t } from "../../utils/cn.js";
3
+ import { PageLayout as n } from "../../components/PageLayout.js";
4
+ import { MetricsCard as r } from "../../components/MetricsCard.js";
5
+ import { formatDate as i, formatEnumLabel as a, formatNumber as o, formatPercent as s, formatRelativeTime as c, formatTonnesCo2e as l, formatVolume as u, isExpired as d } from "../../utils/formatters.js";
6
+ import { StatusBadge as f } from "../../components/StatusBadge.js";
7
+ import { MiniBar as p } from "../../components/MiniBar.js";
8
+ import { DataTable as m } from "../../components/DataTable.js";
9
+ import { ErrorView as h, LoadingView as g, Section as _ } from "../../components/StateViews.js";
10
+ import { EmptyState as v } from "../../components/EmptyState.js";
11
+ import { chartPalette as ee } from "../../components/viz/lib/palette.js";
12
+ import { Sparkline as y } from "../../components/viz/Sparkline.js";
13
+ import { AreaChart as te } from "../../components/viz/AreaChart.js";
14
+ import { DonutChart as ne } from "../../components/viz/DonutChart.js";
15
+ import "../../components/viz/index.js";
10
16
  import "../../context/index.js";
11
- import { useTheAssets as ee, useTheComplianceCerts as te, useTheContracts as ne, useTheEmissionRecords as re, useTheInventoryLots as ie, useTheProductionRecords as ae, useTheShipments as oe } from "../../hooks/useTheGlobalFuelApi.js";
17
+ import { useTheAssets as re, useTheComplianceCerts as ie, useTheContracts as ae, useTheEmissionRecords as oe, useTheInventoryLots as se, useTheProductionRecords as ce, useTheShipments as le } from "../../hooks/useTheGlobalFuelApi.js";
12
18
  import "../../hooks/index.js";
13
- import { useMemo as v } from "react";
14
- import { ArrowRight as y, Boxes as b, ClipboardList as se, Factory as ce, Fuel as le, Gauge as ue, GitBranch as de, Layers as fe, ScrollText as x, ShieldCheck as pe, Ship as me } from "lucide-react";
15
- import { jsx as S, jsxs as C } from "react/jsx-runtime";
16
- import { GlassCard as w, Spinner as T } from "@burdenoff/fe-libs/ui";
19
+ import { useMemo as b } from "react";
20
+ import { Activity as ue, ArrowRight as x, ArrowUpRight as S, Boxes as de, ClipboardList as fe, Factory as pe, Fuel as me, Gauge as he, GitBranch as ge, Layers as C, ScrollText as w, ShieldCheck as _e, Ship as ve } from "lucide-react";
21
+ import { jsx as T, jsxs as E } from "react/jsx-runtime";
22
+ import { GlassCard as D, Spinner as O } from "@burdenoff/fe-libs/ui";
17
23
  //#region src/theglobalfuel/pages/dashboard/DashboardPage.tsx
18
- var E = 1440 * 60 * 1e3, D = 30, O = (e) => {
24
+ var k = 1440 * 60 * 1e3, A = 30, j = (e) => {
19
25
  if (!e) return !1;
20
26
  let t = new Date(e).getTime();
21
27
  if (Number.isNaN(t)) return !1;
22
28
  let n = t - Date.now();
23
- return n >= 0 && n <= D * E;
24
- }, he = {
29
+ return n >= 0 && n <= A * k;
30
+ }, ye = {
25
31
  EXPLORATION: "bg-[var(--color-accent-indigo)]",
26
32
  APPRAISAL: "bg-[var(--color-accent-blue)]",
27
33
  DEVELOPMENT: "bg-[var(--color-accent-teal)]",
@@ -29,16 +35,45 @@ var E = 1440 * 60 * 1e3, D = 30, O = (e) => {
29
35
  SUSPENDED: "bg-status-warning-text",
30
36
  DECOMMISSIONING: "bg-status-error-text",
31
37
  RETIRED: "bg-[var(--color-text-tertiary)]"
32
- }, ge = {
33
- SCOPE_1: "bg-status-error-text",
34
- SCOPE_2: "bg-status-warning-text",
35
- SCOPE_3: "bg-[var(--color-accent-blue)]"
36
- }, _e = [
38
+ }, be = {
39
+ SCOPE_1: "var(--color-status-error-text)",
40
+ SCOPE_2: "var(--color-status-warning-text)",
41
+ SCOPE_3: "var(--color-accent-blue)"
42
+ }, xe = [
37
43
  "SCOPE_1",
38
44
  "SCOPE_2",
39
45
  "SCOPE_3"
40
- ];
41
- function k(e, t) {
46
+ ], M = (e) => `${e.getUTCFullYear()}-${String(e.getUTCMonth() + 1).padStart(2, "0")}`, N = new Intl.DateTimeFormat(void 0, {
47
+ month: "short",
48
+ year: "2-digit",
49
+ timeZone: "UTC"
50
+ }), P = (e, t) => N.format(new Date(Date.UTC(e, t - 1, 1)));
51
+ function Se(e, t, n) {
52
+ let r = /* @__PURE__ */ new Map();
53
+ for (let i of e) {
54
+ let e = t(i);
55
+ if (!e) continue;
56
+ let a = new Date(e);
57
+ if (Number.isNaN(a.getTime())) continue;
58
+ let o = M(a);
59
+ r.set(o, (r.get(o) ?? 0) + n(i));
60
+ }
61
+ return r;
62
+ }
63
+ function F(e, t = 18) {
64
+ let n = [...e.keys()].sort();
65
+ if (n.length === 0) return [];
66
+ let r = (e) => {
67
+ let [t, n] = e.split("-");
68
+ return [Number(t), Number(n)];
69
+ }, [i, a] = r(n[n.length - 1]), [o, s] = r(n[0]), c = [], l = 0;
70
+ for (; (o < i || o === i && s <= a) && l < 240;) c.push({
71
+ label: P(o, s),
72
+ value: e.get(`${o}-${String(s).padStart(2, "0")}`) ?? 0
73
+ }), s += 1, s > 12 && (s = 1, o += 1), l += 1;
74
+ return c.length > t ? c.slice(c.length - t) : c;
75
+ }
76
+ function I(e, t) {
42
77
  let n = /* @__PURE__ */ new Map();
43
78
  for (let r of e) {
44
79
  let e = t(r);
@@ -51,136 +86,331 @@ function k(e, t) {
51
86
  pct: r ? t / r * 100 : 0
52
87
  }));
53
88
  }
54
- function A({ title: e, description: t, icon: n, linkLabel: r, onLink: i, isLoading: a, isError: s, onRetry: c, emptyLabel: l, bars: u, footer: d }) {
55
- return /* @__PURE__ */ C(w, {
89
+ function Ce({ title: e, description: n, icon: r, linkLabel: i, onLink: a, isLoading: o, isError: c, onRetry: l, emptyLabel: u, bars: d, footer: f, className: m }) {
90
+ return /* @__PURE__ */ E(D, {
56
91
  treatment: "glass",
57
- className: "flex flex-col p-5",
58
- children: [/* @__PURE__ */ C("div", {
92
+ className: t("flex flex-col p-5", m),
93
+ children: [/* @__PURE__ */ E("div", {
59
94
  className: "mb-4 flex items-start justify-between gap-3",
60
- children: [/* @__PURE__ */ C("div", {
95
+ children: [/* @__PURE__ */ E("div", {
61
96
  className: "flex min-w-0 items-start gap-2.5",
62
- children: [/* @__PURE__ */ S("span", {
97
+ children: [/* @__PURE__ */ T("span", {
63
98
  className: "mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-accent",
64
- children: n
65
- }), /* @__PURE__ */ C("div", {
99
+ children: r
100
+ }), /* @__PURE__ */ E("div", {
66
101
  className: "min-w-0",
67
- children: [/* @__PURE__ */ S("h2", {
102
+ children: [/* @__PURE__ */ T("h2", {
68
103
  className: "text-base font-semibold text-text-primary",
69
104
  children: e
70
- }), /* @__PURE__ */ S("p", {
105
+ }), /* @__PURE__ */ T("p", {
71
106
  className: "mt-0.5 text-xs text-text-tertiary",
72
- children: t
107
+ children: n
73
108
  })]
74
109
  })]
75
- }), /* @__PURE__ */ C("button", {
110
+ }), /* @__PURE__ */ E("button", {
76
111
  type: "button",
77
- onClick: i,
112
+ onClick: a,
78
113
  className: "inline-flex shrink-0 items-center gap-1 text-sm font-medium text-accent hover:underline",
79
114
  children: [
80
- r,
115
+ i,
81
116
  " ",
82
- /* @__PURE__ */ S(y, { className: "h-4 w-4" })
117
+ /* @__PURE__ */ T(x, { className: "h-4 w-4" })
83
118
  ]
84
119
  })]
85
- }), a ? /* @__PURE__ */ C("div", {
120
+ }), o ? /* @__PURE__ */ E("div", {
86
121
  className: "flex items-center gap-2 py-8 text-sm text-text-secondary",
87
- children: [/* @__PURE__ */ S(T, { size: "sm" }), " Loading…"]
88
- }) : s ? /* @__PURE__ */ C("div", {
122
+ children: [/* @__PURE__ */ T(O, { size: "sm" }), " Loading…"]
123
+ }) : c ? /* @__PURE__ */ E("div", {
89
124
  className: "flex flex-col items-start gap-2 py-6",
90
- children: [/* @__PURE__ */ C("p", {
125
+ children: [/* @__PURE__ */ E("p", {
91
126
  className: "text-sm text-status-error-text",
92
127
  children: [
93
128
  "Couldn't load ",
94
129
  e.toLowerCase(),
95
130
  "."
96
131
  ]
97
- }), /* @__PURE__ */ S("button", {
132
+ }), /* @__PURE__ */ T("button", {
98
133
  type: "button",
99
- onClick: c,
134
+ onClick: l,
100
135
  className: "rounded-lg border border-border-seam px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken",
101
136
  children: "Retry"
102
137
  })]
103
- }) : u.length === 0 ? /* @__PURE__ */ S("div", {
138
+ }) : d.length === 0 ? /* @__PURE__ */ T("div", {
104
139
  className: "flex flex-1 flex-col items-center justify-center rounded-xl border border-dashed border-border-seam py-8 text-center",
105
- children: /* @__PURE__ */ S("p", {
140
+ children: /* @__PURE__ */ T("p", {
106
141
  className: "text-sm text-text-secondary",
107
- children: l
142
+ children: u
108
143
  })
109
- }) : /* @__PURE__ */ C("div", {
144
+ }) : /* @__PURE__ */ E("div", {
110
145
  className: "flex flex-1 flex-col justify-between gap-4",
111
- children: [/* @__PURE__ */ S("div", {
146
+ children: [/* @__PURE__ */ T("div", {
112
147
  className: "space-y-3",
113
- children: u.map((e) => /* @__PURE__ */ C("div", {
148
+ children: d.map((e) => /* @__PURE__ */ E("div", {
114
149
  className: "flex items-center gap-3",
115
150
  children: [
116
- /* @__PURE__ */ S("div", {
151
+ /* @__PURE__ */ T("div", {
117
152
  className: "w-24 shrink-0 truncate text-sm text-text-secondary sm:w-28",
118
153
  children: e.label
119
154
  }),
120
- /* @__PURE__ */ S(f, {
155
+ /* @__PURE__ */ T(p, {
121
156
  value: e.pct,
122
157
  barClassName: e.barClassName,
123
158
  className: "flex-1",
124
159
  height: 8
125
160
  }),
126
- /* @__PURE__ */ S("span", {
161
+ /* @__PURE__ */ T("span", {
127
162
  className: "w-16 shrink-0 whitespace-nowrap text-right text-sm font-medium tabular-nums text-text-primary",
128
163
  children: e.value
129
164
  }),
130
- /* @__PURE__ */ S("span", {
165
+ /* @__PURE__ */ T("span", {
131
166
  className: "hidden w-11 shrink-0 text-right text-xs tabular-nums text-text-tertiary sm:inline",
132
- children: o(e.pct)
167
+ children: s(e.pct)
133
168
  })
134
169
  ]
135
170
  }, e.key))
136
- }), d && /* @__PURE__ */ S("p", {
171
+ }), f && /* @__PURE__ */ T("p", {
137
172
  className: "border-t border-border-seam/70 pt-3 text-xs text-text-tertiary",
138
- children: d
173
+ children: f
139
174
  })]
140
175
  })]
141
176
  });
142
177
  }
143
- function j() {
144
- let { navigateTo: o, currentUser: w } = e(), T = ee({ pagination: { limit: 50 } }), E = ne({ pagination: { limit: 50 } }), D = oe(void 0, "IN_TRANSIT"), j = re({ pagination: { limit: 50 } }), M = ie({ pagination: { limit: 50 } }), N = te(), P = ae({ pagination: { limit: 12 } }), F = v(() => T.data?.items ?? [], [T.data]), I = v(() => E.data?.items ?? [], [E.data]), L = v(() => D.data?.items ?? [], [D.data]), R = v(() => j.data?.items ?? [], [j.data]), z = v(() => M.data?.items ?? [], [M.data]), B = v(() => N.data?.items ?? [], [N.data]), V = v(() => P.data?.items ?? [], [P.data]), H = F.filter((e) => e.status === "PRODUCING").length, U = I.filter((e) => e.status === "ACTIVE").length, W = R.reduce((e, t) => e + (t.co2eTonnes ?? 0), 0), G = R.filter((e) => e.verified).length, K = z.filter((e) => e.status === "AVAILABLE").length, ve = B.filter((e) => e.status === "PENDING").length, ye = B.filter((e) => e.expiresAt != null && (u(e.expiresAt) || O(e.expiresAt))).length, q = B.filter((e) => e.status === "PENDING" || e.expiresAt != null && (u(e.expiresAt) || O(e.expiresAt))).length, J = (e, t) => t ? `${e.length}+` : a(e.length), Y = v(() => k(F, (e) => e.commodity).map((e) => ({
145
- key: e.key,
146
- label: /* @__PURE__ */ S("span", {
147
- className: "truncate",
148
- children: i(e.key)
149
- }),
150
- value: a(e.count),
151
- pct: e.pct,
152
- barClassName: "bg-[var(--color-accent-blue)]"
153
- })), [F]), be = v(() => k(F, (e) => e.status).map((e) => ({
154
- key: e.key,
155
- label: /* @__PURE__ */ S(d, { status: e.key }),
156
- value: a(e.count),
157
- pct: e.pct,
158
- barClassName: he[e.key] ?? "bg-action-primary-bg"
159
- })), [F]), xe = v(() => {
160
- if (R.length === 0) return [];
178
+ function L({ title: e, caption: n, icon: r, link: i, isLoading: a, isError: o, onRetry: s, isEmpty: c, emptyLabel: l, footer: u, className: d, children: f }) {
179
+ return /* @__PURE__ */ E(D, {
180
+ treatment: "glass",
181
+ className: t("flex flex-col p-5", d),
182
+ children: [/* @__PURE__ */ E("div", {
183
+ className: "mb-4 flex items-start justify-between gap-3",
184
+ children: [/* @__PURE__ */ E("div", {
185
+ className: "flex min-w-0 items-start gap-2.5",
186
+ children: [/* @__PURE__ */ T("span", {
187
+ className: "mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-accent",
188
+ children: r
189
+ }), /* @__PURE__ */ E("div", {
190
+ className: "min-w-0",
191
+ children: [/* @__PURE__ */ T("h2", {
192
+ className: "text-base font-semibold text-text-primary",
193
+ children: e
194
+ }), /* @__PURE__ */ T("p", {
195
+ className: "mt-0.5 text-xs text-text-tertiary",
196
+ children: n
197
+ })]
198
+ })]
199
+ }), i ? /* @__PURE__ */ E("button", {
200
+ type: "button",
201
+ onClick: i.onClick,
202
+ className: "inline-flex shrink-0 items-center gap-1 text-sm font-medium text-accent hover:underline",
203
+ children: [
204
+ i.label,
205
+ " ",
206
+ /* @__PURE__ */ T(x, { className: "h-4 w-4" })
207
+ ]
208
+ }) : null]
209
+ }), a ? /* @__PURE__ */ E("div", {
210
+ className: "flex flex-1 items-center gap-2 py-8 text-sm text-text-secondary",
211
+ children: [/* @__PURE__ */ T(O, { size: "sm" }), " Loading…"]
212
+ }) : o ? /* @__PURE__ */ E("div", {
213
+ className: "flex flex-1 flex-col items-start gap-2 py-6",
214
+ children: [/* @__PURE__ */ E("p", {
215
+ className: "text-sm text-status-error-text",
216
+ children: [
217
+ "Couldn't load ",
218
+ e.toLowerCase(),
219
+ "."
220
+ ]
221
+ }), /* @__PURE__ */ T("button", {
222
+ type: "button",
223
+ onClick: s,
224
+ className: "rounded-lg border border-border-seam px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken",
225
+ children: "Retry"
226
+ })]
227
+ }) : c ? /* @__PURE__ */ T("div", {
228
+ className: "flex flex-1 flex-col items-center justify-center rounded-xl border border-dashed border-border-seam py-10 text-center",
229
+ children: /* @__PURE__ */ T("p", {
230
+ className: "text-sm text-text-secondary",
231
+ children: l
232
+ })
233
+ }) : /* @__PURE__ */ E("div", {
234
+ className: "flex flex-1 flex-col justify-between gap-4",
235
+ children: [/* @__PURE__ */ T("div", {
236
+ className: "flex-1",
237
+ children: f
238
+ }), u ? /* @__PURE__ */ T("p", {
239
+ className: "border-t border-border-seam/70 pt-3 text-xs text-text-tertiary",
240
+ children: u
241
+ }) : null]
242
+ })]
243
+ });
244
+ }
245
+ function we({ card: e, onOpen: t }) {
246
+ return /* @__PURE__ */ T(D, {
247
+ treatment: "metric",
248
+ className: "p-0",
249
+ children: /* @__PURE__ */ E("button", {
250
+ type: "button",
251
+ onClick: t,
252
+ "aria-label": `Open ${e.name} assets`,
253
+ className: "flex w-full flex-col gap-4 rounded-[var(--radius-card)] p-5 text-left outline-none transition-transform duration-200 hover:-translate-y-0.5 focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
254
+ children: [
255
+ /* @__PURE__ */ E("div", {
256
+ className: "flex items-start justify-between gap-2",
257
+ children: [/* @__PURE__ */ E("div", {
258
+ className: "flex min-w-0 items-center gap-2.5",
259
+ children: [/* @__PURE__ */ T("span", {
260
+ "aria-hidden": "true",
261
+ className: "size-2.5 shrink-0 rounded-full",
262
+ style: { backgroundColor: e.color }
263
+ }), /* @__PURE__ */ E("div", {
264
+ className: "min-w-0",
265
+ children: [/* @__PURE__ */ T("p", {
266
+ className: "truncate text-sm font-semibold text-text-primary",
267
+ children: e.name
268
+ }), /* @__PURE__ */ E("p", {
269
+ className: "text-xs text-text-tertiary",
270
+ children: [
271
+ e.assetCount,
272
+ " ",
273
+ e.assetCount === 1 ? "asset" : "assets"
274
+ ]
275
+ })]
276
+ })]
277
+ }), /* @__PURE__ */ T(S, { className: "h-4 w-4 shrink-0 text-text-tertiary" })]
278
+ }),
279
+ /* @__PURE__ */ E("div", {
280
+ className: "grid grid-cols-2 gap-3",
281
+ children: [/* @__PURE__ */ E("div", {
282
+ className: "min-w-0",
283
+ children: [/* @__PURE__ */ T("p", {
284
+ className: "text-[11px] uppercase tracking-wide text-text-tertiary",
285
+ children: "Capacity/day"
286
+ }), /* @__PURE__ */ T("p", {
287
+ className: "mt-0.5 truncate text-sm font-semibold tabular-nums text-text-primary",
288
+ children: e.capacity > 0 ? u(e.capacity, e.unit) : "—"
289
+ })]
290
+ }), /* @__PURE__ */ E("div", {
291
+ className: "min-w-0",
292
+ children: [/* @__PURE__ */ T("p", {
293
+ className: "text-[11px] uppercase tracking-wide text-text-tertiary",
294
+ children: "Producing"
295
+ }), /* @__PURE__ */ E("p", {
296
+ className: "mt-0.5 text-sm font-semibold tabular-nums text-text-primary",
297
+ children: [
298
+ e.producing,
299
+ " ",
300
+ /* @__PURE__ */ E("span", {
301
+ className: "text-xs font-normal text-text-tertiary",
302
+ children: ["of ", e.assetCount]
303
+ })
304
+ ]
305
+ })]
306
+ })]
307
+ }),
308
+ e.spark.length >= 2 ? /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T(y, {
309
+ data: e.spark,
310
+ variant: "area",
311
+ height: 40,
312
+ label: `${e.name} monthly production`
313
+ }), /* @__PURE__ */ T("p", {
314
+ className: "mt-1 text-[11px] text-text-tertiary",
315
+ children: "Monthly output"
316
+ })] }) : /* @__PURE__ */ T("p", {
317
+ className: "text-xs text-text-tertiary",
318
+ children: "No production logged yet."
319
+ })
320
+ ]
321
+ })
322
+ });
323
+ }
324
+ function R() {
325
+ let { navigateTo: t, currentUser: s } = e(), y = re({ pagination: { limit: 200 } }), S = ae({ pagination: { limit: 50 } }), D = le(void 0, "IN_TRANSIT"), O = oe({ pagination: { limit: 200 } }), k = se({ pagination: { limit: 50 } }), A = ie(), N = ce({ pagination: { limit: 200 } }), P = b(() => y.data?.items ?? [], [y.data]), R = b(() => S.data?.items ?? [], [S.data]), z = b(() => D.data?.items ?? [], [D.data]), B = b(() => O.data?.items ?? [], [O.data]), V = b(() => k.data?.items ?? [], [k.data]), H = b(() => A.data?.items ?? [], [A.data]), U = b(() => N.data?.items ?? [], [N.data]), W = P.filter((e) => e.status === "PRODUCING").length, G = R.filter((e) => e.status === "ACTIVE").length, K = B.reduce((e, t) => e + (t.co2eTonnes ?? 0), 0), Te = B.filter((e) => e.verified).length, Ee = V.filter((e) => e.status === "AVAILABLE").length, De = U.reduce((e, t) => e + (t.volume ?? 0), 0), Oe = H.filter((e) => e.status === "PENDING").length, ke = H.filter((e) => e.expiresAt != null && (d(e.expiresAt) || j(e.expiresAt))).length, q = H.filter((e) => e.status === "PENDING" || e.expiresAt != null && (d(e.expiresAt) || j(e.expiresAt))).length, J = (e, t) => t ? `${e.length}+` : o(e.length), Y = b(() => F(Se(U, (e) => e.periodEnd, (e) => e.volume ?? 0)), [U]), X = b(() => I(P, (e) => e.commodity), [P]), Z = b(() => {
326
+ let e = ee(X.length), t = /* @__PURE__ */ new Map();
327
+ return X.forEach((n, r) => t.set(n.key, e[r])), t;
328
+ }, [X]), Q = b(() => X.map((e) => ({
329
+ label: a(e.key),
330
+ value: e.count,
331
+ color: Z.get(e.key)
332
+ })), [X, Z]), Ae = b(() => {
333
+ if (B.length === 0) return [];
161
334
  let e = {
162
335
  SCOPE_1: 0,
163
336
  SCOPE_2: 0,
164
337
  SCOPE_3: 0
165
338
  };
166
- for (let t of R) e[t.scope] = (e[t.scope] ?? 0) + (t.co2eTonnes ?? 0);
167
- let t = e.SCOPE_1 + e.SCOPE_2 + e.SCOPE_3;
168
- return _e.map((n) => ({
169
- key: n,
170
- label: /* @__PURE__ */ S(d, { status: n }),
171
- value: `${a(e[n], { maximumFractionDigits: e[n] >= 100 ? 0 : 1 })} t`,
172
- pct: t > 0 ? e[n] / t * 100 : 0,
173
- barClassName: ge[n]
339
+ for (let t of B) e[t.scope] += t.co2eTonnes ?? 0;
340
+ return xe.filter((t) => e[t] > 0).map((t) => ({
341
+ label: a(t),
342
+ value: e[t],
343
+ color: be[t]
174
344
  }));
175
- }, [R]), X = v(() => {
345
+ }, [B]), je = b(() => I(P, (e) => e.status).map((e) => ({
346
+ key: e.key,
347
+ label: /* @__PURE__ */ T(f, { status: e.key }),
348
+ value: o(e.count),
349
+ pct: e.pct,
350
+ barClassName: ye[e.key] ?? "bg-action-primary-bg"
351
+ })), [P]), Me = b(() => {
352
+ let e = /* @__PURE__ */ new Map();
353
+ for (let t of P) e.set(t.id, t.commodity);
354
+ return e;
355
+ }, [P]), Ne = b(() => {
356
+ if (X.length === 0) return [];
357
+ let e = /* @__PURE__ */ new Map();
358
+ for (let t of P) {
359
+ let n = e.get(t.commodity) ?? {
360
+ count: 0,
361
+ producing: 0,
362
+ capacity: 0,
363
+ units: /* @__PURE__ */ new Map()
364
+ };
365
+ n.count += 1, t.status === "PRODUCING" && (n.producing += 1), n.capacity += t.capacityPerDay ?? 0, t.capacityUnit && n.units.set(t.capacityUnit, (n.units.get(t.capacityUnit) ?? 0) + 1), e.set(t.commodity, n);
366
+ }
367
+ let t = /* @__PURE__ */ new Map();
368
+ for (let e of U) {
369
+ let n = Me.get(e.assetId);
370
+ if (!n) continue;
371
+ let r = new Date(e.periodEnd);
372
+ if (Number.isNaN(r.getTime())) continue;
373
+ let i = M(r), a = t.get(n);
374
+ a || (a = /* @__PURE__ */ new Map(), t.set(n, a)), a.set(i, (a.get(i) ?? 0) + (e.volume ?? 0));
375
+ }
376
+ let n = (e) => {
377
+ let t = "", n = -1;
378
+ for (let [r, i] of e) i > n && (t = r, n = i);
379
+ return t;
380
+ };
381
+ return X.map((r) => {
382
+ let i = e.get(r.key) ?? {
383
+ count: 0,
384
+ producing: 0,
385
+ capacity: 0,
386
+ units: /* @__PURE__ */ new Map()
387
+ }, o = t.get(r.key), s = o ? F(o, 12).map((e) => e.value) : [];
388
+ return {
389
+ key: r.key,
390
+ name: a(r.key),
391
+ color: Z.get(r.key) ?? "var(--color-accent-primary)",
392
+ assetCount: i.count,
393
+ producing: i.producing,
394
+ capacity: i.capacity,
395
+ unit: n(i.units),
396
+ spark: s
397
+ };
398
+ });
399
+ }, [
400
+ P,
401
+ U,
402
+ Me,
403
+ X,
404
+ Z
405
+ ]), Pe = b(() => {
176
406
  let e = /* @__PURE__ */ new Map();
177
- for (let t of F) e.set(t.id, t.name);
407
+ for (let t of P) e.set(t.id, t.name);
178
408
  return e;
179
- }, [F]), Z = v(() => [...I].sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime()).slice(0, 6), [I]), Q = v(() => [...V].sort((e, t) => new Date(t.periodEnd).getTime() - new Date(e.periodEnd).getTime()).slice(0, 6), [V]), Se = [
409
+ }, [P]), Fe = b(() => [...R].sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime()).slice(0, 6), [R]), Ie = b(() => [...U].sort((e, t) => new Date(t.periodEnd).getTime() - new Date(e.periodEnd).getTime()).slice(0, 6), [U]), Le = [
180
410
  {
181
411
  key: "reference",
182
412
  header: "Reference",
183
- render: (e) => /* @__PURE__ */ S("span", {
413
+ render: (e) => /* @__PURE__ */ T("span", {
184
414
  className: "font-medium text-text-primary",
185
415
  children: e.reference
186
416
  })
@@ -189,7 +419,7 @@ function j() {
189
419
  key: "counterparty",
190
420
  header: "Counterparty",
191
421
  hideOnMobile: !0,
192
- render: (e) => /* @__PURE__ */ S("span", {
422
+ render: (e) => /* @__PURE__ */ T("span", {
193
423
  className: "text-text-secondary",
194
424
  children: e.counterparty
195
425
  })
@@ -198,60 +428,60 @@ function j() {
198
428
  key: "commodity",
199
429
  header: "Commodity",
200
430
  hideOnMobile: !0,
201
- render: (e) => /* @__PURE__ */ S("span", {
431
+ render: (e) => /* @__PURE__ */ T("span", {
202
432
  className: "text-text-secondary",
203
- children: i(e.commodity)
433
+ children: a(e.commodity)
204
434
  })
205
435
  },
206
436
  {
207
437
  key: "side",
208
438
  header: "Side",
209
- render: (e) => /* @__PURE__ */ S(d, { status: e.side })
439
+ render: (e) => /* @__PURE__ */ T(f, { status: e.side })
210
440
  },
211
441
  {
212
442
  key: "volume",
213
443
  header: "Volume",
214
444
  align: "right",
215
445
  hideOnMobile: !0,
216
- render: (e) => /* @__PURE__ */ S("span", {
446
+ render: (e) => /* @__PURE__ */ T("span", {
217
447
  className: "tabular-nums text-text-secondary",
218
- children: l(e.contractedVolume, e.unit)
448
+ children: u(e.contractedVolume, e.unit)
219
449
  })
220
450
  },
221
451
  {
222
452
  key: "status",
223
453
  header: "Status",
224
- render: (e) => /* @__PURE__ */ S(d, { status: e.status })
454
+ render: (e) => /* @__PURE__ */ T(f, { status: e.status })
225
455
  },
226
456
  {
227
457
  key: "created",
228
458
  header: "Created",
229
459
  align: "right",
230
460
  hideOnMobile: !0,
231
- render: (e) => /* @__PURE__ */ S("span", {
461
+ render: (e) => /* @__PURE__ */ T("span", {
232
462
  className: "text-text-tertiary",
233
- children: s(e.createdAt)
463
+ children: c(e.createdAt)
234
464
  })
235
465
  }
236
- ], Ce = [
466
+ ], Re = [
237
467
  {
238
468
  key: "asset",
239
469
  header: "Asset",
240
- render: (e) => /* @__PURE__ */ S("span", {
470
+ render: (e) => /* @__PURE__ */ T("span", {
241
471
  className: "font-medium text-text-primary",
242
- children: X.get(e.assetId) ?? "Unknown asset"
472
+ children: Pe.get(e.assetId) ?? "Unknown asset"
243
473
  })
244
474
  },
245
475
  {
246
476
  key: "period",
247
477
  header: "Period",
248
478
  hideOnMobile: !0,
249
- render: (e) => /* @__PURE__ */ C("span", {
479
+ render: (e) => /* @__PURE__ */ E("span", {
250
480
  className: "text-text-secondary",
251
481
  children: [
252
- r(e.periodStart),
482
+ i(e.periodStart),
253
483
  " – ",
254
- r(e.periodEnd)
484
+ i(e.periodEnd)
255
485
  ]
256
486
  })
257
487
  },
@@ -259,9 +489,9 @@ function j() {
259
489
  key: "volume",
260
490
  header: "Volume",
261
491
  align: "right",
262
- render: (e) => /* @__PURE__ */ S("span", {
492
+ render: (e) => /* @__PURE__ */ T("span", {
263
493
  className: "tabular-nums font-medium text-text-primary",
264
- children: l(e.volume, e.unit)
494
+ children: u(e.volume, e.unit)
265
495
  })
266
496
  },
267
497
  {
@@ -269,9 +499,9 @@ function j() {
269
499
  header: "Downtime",
270
500
  align: "right",
271
501
  hideOnMobile: !0,
272
- render: (e) => /* @__PURE__ */ C("span", {
502
+ render: (e) => /* @__PURE__ */ E("span", {
273
503
  className: "tabular-nums text-text-secondary",
274
- children: [a(e.downtimeHours), " h"]
504
+ children: [o(e.downtimeHours), " h"]
275
505
  })
276
506
  },
277
507
  {
@@ -279,91 +509,91 @@ function j() {
279
509
  header: "Logged",
280
510
  align: "right",
281
511
  hideOnMobile: !0,
282
- render: (e) => /* @__PURE__ */ S("span", {
512
+ render: (e) => /* @__PURE__ */ T("span", {
283
513
  className: "text-text-tertiary",
284
- children: s(e.createdAt)
514
+ children: c(e.createdAt)
285
515
  })
286
516
  }
287
- ], $ = `Welcome back, ${w?.firstName || w?.name || "there"} — your energy, mineral & commodity resource control room.`;
288
- return T.isLoading && E.isLoading && j.isLoading && M.isLoading && N.isLoading ? /* @__PURE__ */ S(t, {
517
+ ], $ = `Welcome back, ${s?.firstName || s?.name || "there"} — your energy, mineral & commodity resource control room.`;
518
+ return y.isLoading && S.isLoading && O.isLoading && k.isLoading && A.isLoading ? /* @__PURE__ */ T(n, {
289
519
  title: "TheGlobalFuel",
290
520
  titleGradient: !0,
291
521
  aurora: !0,
292
522
  description: $,
293
- children: /* @__PURE__ */ S(h, { label: "Loading your resource portfolio…" })
294
- }) : /* @__PURE__ */ C(t, {
523
+ children: /* @__PURE__ */ T(g, { label: "Loading your resource portfolio…" })
524
+ }) : /* @__PURE__ */ E(n, {
295
525
  title: "TheGlobalFuel",
296
526
  titleGradient: !0,
297
527
  aurora: !0,
298
528
  description: $,
299
529
  children: [
300
- /* @__PURE__ */ C("div", {
530
+ /* @__PURE__ */ E("div", {
301
531
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6",
302
532
  children: [
303
- /* @__PURE__ */ S(n, {
304
- icon: /* @__PURE__ */ S(fe, { className: "h-5 w-5" }),
305
- value: J(F, T.data?.pageInfo?.hasMore),
533
+ /* @__PURE__ */ T(r, {
534
+ icon: /* @__PURE__ */ T(C, { className: "h-5 w-5" }),
535
+ value: J(P, y.data?.pageInfo?.hasMore),
306
536
  label: "Resource assets",
307
537
  featured: !0,
308
- footer: /* @__PURE__ */ C("div", {
538
+ footer: /* @__PURE__ */ E("div", {
309
539
  className: "space-y-2",
310
- children: [/* @__PURE__ */ S(f, {
311
- value: F.length ? H / F.length * 100 : 0,
540
+ children: [/* @__PURE__ */ T(p, {
541
+ value: P.length ? W / P.length * 100 : 0,
312
542
  height: 4,
313
543
  barClassName: "bg-status-success-text"
314
- }), /* @__PURE__ */ C("p", {
544
+ }), /* @__PURE__ */ E("p", {
315
545
  className: "text-xs text-text-tertiary",
316
- children: [/* @__PURE__ */ S("span", {
546
+ children: [/* @__PURE__ */ T("span", {
317
547
  className: "tabular-nums text-text-secondary",
318
- children: H
548
+ children: W
319
549
  }), " producing"]
320
550
  })]
321
551
  })
322
552
  }),
323
- /* @__PURE__ */ S(n, {
324
- icon: /* @__PURE__ */ S(x, { className: "h-5 w-5" }),
325
- value: J(I, E.data?.pageInfo?.hasMore),
553
+ /* @__PURE__ */ T(r, {
554
+ icon: /* @__PURE__ */ T(w, { className: "h-5 w-5" }),
555
+ value: J(R, S.data?.pageInfo?.hasMore),
326
556
  label: "Offtake contracts",
327
- footer: /* @__PURE__ */ C("div", {
557
+ footer: /* @__PURE__ */ E("div", {
328
558
  className: "space-y-2",
329
- children: [/* @__PURE__ */ S(f, {
330
- value: I.length ? U / I.length * 100 : 0,
559
+ children: [/* @__PURE__ */ T(p, {
560
+ value: R.length ? G / R.length * 100 : 0,
331
561
  height: 4,
332
562
  barClassName: "bg-action-primary-bg"
333
- }), /* @__PURE__ */ C("p", {
563
+ }), /* @__PURE__ */ E("p", {
334
564
  className: "text-xs text-text-tertiary",
335
- children: [/* @__PURE__ */ S("span", {
565
+ children: [/* @__PURE__ */ T("span", {
336
566
  className: "tabular-nums text-text-secondary",
337
- children: U
567
+ children: G
338
568
  }), " active"]
339
569
  })]
340
570
  })
341
571
  }),
342
- /* @__PURE__ */ S(n, {
343
- icon: /* @__PURE__ */ S(me, { className: "h-5 w-5" }),
344
- value: D.isError ? "—" : a(L.length),
572
+ /* @__PURE__ */ T(r, {
573
+ icon: /* @__PURE__ */ T(ve, { className: "h-5 w-5" }),
574
+ value: D.isError ? "—" : o(z.length),
345
575
  label: "Shipments in transit",
346
- footer: /* @__PURE__ */ S("p", {
576
+ footer: /* @__PURE__ */ T("p", {
347
577
  className: "text-xs text-text-tertiary",
348
- children: L.length > 0 ? "In motion across carriers" : "No active movements"
578
+ children: z.length > 0 ? "In motion across carriers" : "No active movements"
349
579
  })
350
580
  }),
351
- /* @__PURE__ */ S(n, {
352
- icon: /* @__PURE__ */ S(ce, { className: "h-5 w-5" }),
353
- value: j.isError ? "—" : c(W),
581
+ /* @__PURE__ */ T(r, {
582
+ icon: /* @__PURE__ */ T(pe, { className: "h-5 w-5" }),
583
+ value: O.isError ? "—" : l(K),
354
584
  label: "Emissions logged",
355
- footer: /* @__PURE__ */ C("div", {
585
+ footer: /* @__PURE__ */ E("div", {
356
586
  className: "space-y-2",
357
- children: [/* @__PURE__ */ S(f, {
358
- value: R.length ? G / R.length * 100 : 0,
587
+ children: [/* @__PURE__ */ T(p, {
588
+ value: B.length ? Te / B.length * 100 : 0,
359
589
  height: 4,
360
590
  barClassName: "bg-status-success-text"
361
- }), /* @__PURE__ */ C("p", {
591
+ }), /* @__PURE__ */ E("p", {
362
592
  className: "text-xs text-text-tertiary",
363
593
  children: [
364
- /* @__PURE__ */ S("span", {
594
+ /* @__PURE__ */ T("span", {
365
595
  className: "tabular-nums text-text-secondary",
366
- children: G
596
+ children: Te
367
597
  }),
368
598
  " ",
369
599
  "verified"
@@ -371,22 +601,22 @@ function j() {
371
601
  })]
372
602
  })
373
603
  }),
374
- /* @__PURE__ */ S(n, {
375
- icon: /* @__PURE__ */ S(b, { className: "h-5 w-5" }),
376
- value: M.isError ? "—" : a(K),
604
+ /* @__PURE__ */ T(r, {
605
+ icon: /* @__PURE__ */ T(de, { className: "h-5 w-5" }),
606
+ value: k.isError ? "—" : o(Ee),
377
607
  label: "Inventory available",
378
- footer: /* @__PURE__ */ C("div", {
608
+ footer: /* @__PURE__ */ E("div", {
379
609
  className: "space-y-2",
380
- children: [/* @__PURE__ */ S(f, {
381
- value: z.length ? K / z.length * 100 : 0,
610
+ children: [/* @__PURE__ */ T(p, {
611
+ value: V.length ? Ee / V.length * 100 : 0,
382
612
  height: 4,
383
613
  barClassName: "bg-action-primary-bg"
384
- }), /* @__PURE__ */ C("p", {
614
+ }), /* @__PURE__ */ E("p", {
385
615
  className: "text-xs text-text-tertiary",
386
616
  children: [
387
- /* @__PURE__ */ S("span", {
617
+ /* @__PURE__ */ T("span", {
388
618
  className: "tabular-nums text-text-secondary",
389
- children: J(z, M.data?.pageInfo?.hasMore)
619
+ children: J(V, k.data?.pageInfo?.hasMore)
390
620
  }),
391
621
  " ",
392
622
  "lots total"
@@ -394,116 +624,184 @@ function j() {
394
624
  })]
395
625
  })
396
626
  }),
397
- /* @__PURE__ */ S(n, {
398
- icon: /* @__PURE__ */ S(pe, { className: "h-5 w-5" }),
399
- value: N.isError ? "—" : a(q),
627
+ /* @__PURE__ */ T(r, {
628
+ icon: /* @__PURE__ */ T(_e, { className: "h-5 w-5" }),
629
+ value: A.isError ? "—" : o(q),
400
630
  label: "Certs need attention",
401
- accent: q > 0 ? "warning" : B.length > 0 ? "success" : void 0,
402
- footer: /* @__PURE__ */ S("p", {
631
+ accent: q > 0 ? "warning" : H.length > 0 ? "success" : void 0,
632
+ footer: /* @__PURE__ */ T("p", {
403
633
  className: q > 0 ? "text-xs font-medium text-status-warning-text" : "text-xs text-text-tertiary",
404
- children: B.length === 0 ? "No certifications tracked yet" : q > 0 ? `${ve} pending · ${ye} expiring` : "All certifications current"
634
+ children: H.length === 0 ? "No certifications tracked yet" : q > 0 ? `${Oe} pending · ${ke} expiring` : "All certifications current"
405
635
  })
406
636
  })
407
637
  ]
408
638
  }),
409
- /* @__PURE__ */ C("div", {
639
+ /* @__PURE__ */ E("div", {
410
640
  className: "mt-6 grid grid-cols-1 gap-6 lg:grid-cols-3",
411
- children: [
412
- /* @__PURE__ */ S(A, {
413
- title: "Assets by commodity",
414
- description: "Portfolio mix across energy, mineral & metal streams.",
415
- icon: /* @__PURE__ */ S(le, { className: "h-4 w-4" }),
416
- linkLabel: "Assets",
417
- onLink: () => o("assets"),
418
- isLoading: T.isLoading,
419
- isError: T.isError,
420
- onRetry: () => T.refetch(),
421
- emptyLabel: "No assets registered yet.",
422
- bars: Y,
423
- footer: F.length > 0 ? `${J(F, T.data?.pageInfo?.hasMore)} assets across ${Y.length} ${Y.length === 1 ? "commodity" : "commodities"}` : void 0
424
- }),
425
- /* @__PURE__ */ S(A, {
426
- title: "Assets by lifecycle",
427
- description: "Where the portfolio sits from exploration to retirement.",
428
- icon: /* @__PURE__ */ S(de, { className: "h-4 w-4" }),
429
- linkLabel: "Assets",
430
- onLink: () => o("assets"),
431
- isLoading: T.isLoading,
432
- isError: T.isError,
433
- onRetry: () => T.refetch(),
434
- emptyLabel: "No assets to profile yet.",
435
- bars: be,
436
- footer: F.length > 0 ? `${H} of ${J(F, T.data?.pageInfo?.hasMore)} currently producing` : void 0
437
- }),
438
- /* @__PURE__ */ S(A, {
439
- title: "Emissions by scope",
440
- description: "GHG Protocol Scope 1 / 2 / 3 (tonnes CO₂e logged).",
441
- icon: /* @__PURE__ */ S(ue, { className: "h-4 w-4" }),
442
- linkLabel: "Emissions",
443
- onLink: () => o("emissions"),
444
- isLoading: j.isLoading,
445
- isError: j.isError,
446
- onRetry: () => j.refetch(),
447
- emptyLabel: "No emission records logged yet.",
448
- bars: xe,
449
- footer: R.length > 0 ? `${c(W)} across ${J(R, j.data?.pageInfo?.hasMore)} records` : void 0
641
+ children: [/* @__PURE__ */ T(L, {
642
+ className: "lg:col-span-2",
643
+ title: "Production trend",
644
+ caption: "Metered output aggregated by month across your producing assets.",
645
+ icon: /* @__PURE__ */ T(ue, { className: "h-4 w-4" }),
646
+ link: {
647
+ label: "Production",
648
+ onClick: () => t("production")
649
+ },
650
+ isLoading: N.isLoading,
651
+ isError: N.isError,
652
+ onRetry: () => N.refetch(),
653
+ isEmpty: Y.length === 0,
654
+ emptyLabel: "No production logged yet — record output to build the trend.",
655
+ footer: Y.length > 0 ? `${o(De, { maximumFractionDigits: 0 })} total volume across ${J(U, N.data?.pageInfo?.hasMore)} records` : void 0,
656
+ children: /* @__PURE__ */ T(te, {
657
+ series: Y,
658
+ height: 220,
659
+ title: "Monthly production volume"
450
660
  })
451
- ]
661
+ }), /* @__PURE__ */ T(L, {
662
+ title: "Commodity mix",
663
+ caption: "Share of assets across your commodity streams.",
664
+ icon: /* @__PURE__ */ T(me, { className: "h-4 w-4" }),
665
+ link: {
666
+ label: "Assets",
667
+ onClick: () => t("assets")
668
+ },
669
+ isLoading: y.isLoading,
670
+ isError: y.isError,
671
+ onRetry: () => y.refetch(),
672
+ isEmpty: Q.length === 0,
673
+ emptyLabel: "No assets registered yet.",
674
+ footer: Q.length > 0 ? `${J(P, y.data?.pageInfo?.hasMore)} assets · ${Q.length} ${Q.length === 1 ? "commodity" : "commodities"}` : void 0,
675
+ children: /* @__PURE__ */ T("div", {
676
+ className: "flex items-center justify-center py-2",
677
+ children: /* @__PURE__ */ T(ne, {
678
+ segments: Q,
679
+ size: 168,
680
+ centerLabel: o(P.length),
681
+ centerCaption: "assets",
682
+ valueFormatter: (e) => o(e),
683
+ title: "Assets by commodity"
684
+ })
685
+ })
686
+ })]
687
+ }),
688
+ /* @__PURE__ */ T(_, {
689
+ title: "Commodity portfolio",
690
+ description: "One model, every commodity — assets, capacity and output across your book.",
691
+ children: y.isLoading ? /* @__PURE__ */ T(g, { label: "Loading commodities…" }) : y.isError ? /* @__PURE__ */ T(h, {
692
+ message: "Couldn't load your commodity portfolio.",
693
+ onRetry: () => y.refetch()
694
+ }) : Ne.length === 0 ? /* @__PURE__ */ T(v, {
695
+ illustration: "empty-data",
696
+ icon: /* @__PURE__ */ T(C, { className: "h-10 w-10" }),
697
+ title: "No commodities yet",
698
+ description: "Register your first resource asset to build out your commodity portfolio."
699
+ }) : /* @__PURE__ */ T("div", {
700
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4",
701
+ children: Ne.map((e) => /* @__PURE__ */ T(we, {
702
+ card: e,
703
+ onOpen: () => t("assets")
704
+ }, e.key))
705
+ })
706
+ }),
707
+ /* @__PURE__ */ E("div", {
708
+ className: "mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2",
709
+ children: [/* @__PURE__ */ T(Ce, {
710
+ title: "Assets by lifecycle",
711
+ description: "Where the portfolio sits from exploration to retirement.",
712
+ icon: /* @__PURE__ */ T(ge, { className: "h-4 w-4" }),
713
+ linkLabel: "Assets",
714
+ onLink: () => t("assets"),
715
+ isLoading: y.isLoading,
716
+ isError: y.isError,
717
+ onRetry: () => y.refetch(),
718
+ emptyLabel: "No assets to profile yet.",
719
+ bars: je,
720
+ footer: P.length > 0 ? `${W} of ${J(P, y.data?.pageInfo?.hasMore)} currently producing` : void 0
721
+ }), /* @__PURE__ */ T(L, {
722
+ title: "Emissions by scope",
723
+ caption: "GHG Protocol Scope 1 / 2 / 3 — tonnes CO₂e logged.",
724
+ icon: /* @__PURE__ */ T(he, { className: "h-4 w-4" }),
725
+ link: {
726
+ label: "Emissions",
727
+ onClick: () => t("emissions")
728
+ },
729
+ isLoading: O.isLoading,
730
+ isError: O.isError,
731
+ onRetry: () => O.refetch(),
732
+ isEmpty: Ae.length === 0,
733
+ emptyLabel: "No emission records logged yet.",
734
+ footer: B.length > 0 ? `${l(K)} across ${J(B, O.data?.pageInfo?.hasMore)} records` : void 0,
735
+ children: /* @__PURE__ */ T("div", {
736
+ className: "flex items-center justify-center py-2",
737
+ children: /* @__PURE__ */ T(ne, {
738
+ segments: Ae,
739
+ size: 168,
740
+ centerLabel: o(K, {
741
+ notation: "compact",
742
+ maximumFractionDigits: 1
743
+ }),
744
+ centerCaption: "t CO₂e",
745
+ valueFormatter: (e) => `${o(e, { maximumFractionDigits: e >= 100 ? 0 : 1 })} t`,
746
+ title: "Emissions by scope"
747
+ })
748
+ })
749
+ })]
452
750
  }),
453
- /* @__PURE__ */ S(g, {
751
+ /* @__PURE__ */ T(_, {
454
752
  title: "Recent offtake contracts",
455
753
  description: "Latest buy/sell agreements across your commodity book.",
456
- action: /* @__PURE__ */ C("button", {
754
+ action: /* @__PURE__ */ E("button", {
457
755
  type: "button",
458
- onClick: () => o("contracts"),
756
+ onClick: () => t("contracts"),
459
757
  className: "inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline",
460
- children: ["All contracts ", /* @__PURE__ */ S(y, { className: "h-4 w-4" })]
758
+ children: ["All contracts ", /* @__PURE__ */ T(x, { className: "h-4 w-4" })]
461
759
  }),
462
- children: E.isLoading ? /* @__PURE__ */ S(h, { label: "Loading contracts…" }) : E.isError ? /* @__PURE__ */ S(m, {
760
+ children: S.isLoading ? /* @__PURE__ */ T(g, { label: "Loading contracts…" }) : S.isError ? /* @__PURE__ */ T(h, {
463
761
  message: "Couldn't load contracts.",
464
- onRetry: () => E.refetch()
465
- }) : Z.length === 0 ? /* @__PURE__ */ S(_, {
762
+ onRetry: () => S.refetch()
763
+ }) : Fe.length === 0 ? /* @__PURE__ */ T(v, {
466
764
  illustration: "empty-data",
467
- icon: /* @__PURE__ */ S(x, { className: "h-10 w-10" }),
765
+ icon: /* @__PURE__ */ T(w, { className: "h-10 w-10" }),
468
766
  title: "No contracts yet",
469
767
  description: "Draft your first offtake contract to start tracking commodity trade."
470
- }) : /* @__PURE__ */ S(p, {
471
- columns: Se,
472
- rows: Z,
768
+ }) : /* @__PURE__ */ T(m, {
769
+ columns: Le,
770
+ rows: Fe,
473
771
  rowKey: (e) => e.id,
474
- onRowClick: (e) => o(`contracts/${e.id}`),
772
+ onRowClick: (e) => t(`contracts/${e.id}`),
475
773
  rowLabel: (e) => `Open contract ${e.reference}`
476
774
  })
477
775
  }),
478
- /* @__PURE__ */ S(g, {
776
+ /* @__PURE__ */ T(_, {
479
777
  title: "Recent production",
480
778
  description: "Latest metered output captured against your producing assets.",
481
- action: /* @__PURE__ */ C("button", {
779
+ action: /* @__PURE__ */ E("button", {
482
780
  type: "button",
483
- onClick: () => o("production"),
781
+ onClick: () => t("production"),
484
782
  className: "inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline",
485
- children: ["All production ", /* @__PURE__ */ S(y, { className: "h-4 w-4" })]
783
+ children: ["All production ", /* @__PURE__ */ T(x, { className: "h-4 w-4" })]
486
784
  }),
487
- children: P.isLoading ? /* @__PURE__ */ S(h, { label: "Loading production…" }) : P.isError ? /* @__PURE__ */ S(m, {
785
+ children: N.isLoading ? /* @__PURE__ */ T(g, { label: "Loading production…" }) : N.isError ? /* @__PURE__ */ T(h, {
488
786
  message: "Couldn't load production records.",
489
- onRetry: () => P.refetch()
490
- }) : Q.length === 0 ? /* @__PURE__ */ S(_, {
787
+ onRetry: () => N.refetch()
788
+ }) : Ie.length === 0 ? /* @__PURE__ */ T(v, {
491
789
  illustration: "empty-data",
492
- icon: /* @__PURE__ */ S(se, { className: "h-10 w-10" }),
790
+ icon: /* @__PURE__ */ T(fe, { className: "h-10 w-10" }),
493
791
  title: "No production logged yet",
494
792
  description: "Record production against an asset to build its output history."
495
- }) : /* @__PURE__ */ S(p, {
496
- columns: Ce,
497
- rows: Q,
793
+ }) : /* @__PURE__ */ T(m, {
794
+ columns: Re,
795
+ rows: Ie,
498
796
  rowKey: (e) => e.id,
499
- onRowClick: (e) => o(`assets/${e.assetId}`),
500
- rowLabel: (e) => `Open ${X.get(e.assetId) ?? "asset"}`
797
+ onRowClick: (e) => t(`assets/${e.assetId}`),
798
+ rowLabel: (e) => `Open ${Pe.get(e.assetId) ?? "asset"}`
501
799
  })
502
800
  })
503
801
  ]
504
802
  });
505
803
  }
506
804
  //#endregion
507
- export { j as DashboardPage };
805
+ export { R as DashboardPage };
508
806
 
509
807
  //# sourceMappingURL=DashboardPage.js.map