@burdenoff/microfe-billing 2026.611.1 → 2026.612.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.
@@ -4,26 +4,26 @@ import { QuotaStatus as n } from "../../../shared/types/graphql.js";
4
4
  import { formatDateTime as r, formatNumber as i, formatRelativeTime as a } from "../../../shared/utils/format.js";
5
5
  import { useBillingPermissions as o } from "../../../hooks/useBillingPermissions.js";
6
6
  import { useBillingAccountsForUsage as s, useEnhancedUsagePage as c, useQuotaUsageDetails as l, useWorkspaceQuotaHistory as u, useWorkspaceQuotaOverview as d } from "../hooks/useUsage.js";
7
- import { useCallback as ee, useDeferredValue as f, useMemo as p, useState as m } from "react";
8
- import { AlertCircle as h, AlertTriangle as g, CheckCircle as _, ChevronDown as v, ChevronLeft as y, ChevronRight as b, Clock as x, Info as S, Layers as C, Package as w, RefreshCw as T, Search as te, X as E, XCircle as D } from "lucide-react";
9
- import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
10
- import { useI18n as ne } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
7
+ import { useCallback as f, useDeferredValue as p, useMemo as m, useState as h } from "react";
8
+ import { AlertCircle as g, AlertTriangle as _, CheckCircle as v, ChevronDown as y, ChevronLeft as b, ChevronRight as x, Clock as S, Info as C, Layers as w, Package as T, RefreshCw as E, Search as ee, X as D, XCircle as O } from "lucide-react";
9
+ import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
10
+ import { useI18n as te } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
11
11
  //#region src/billing/modules/usage/pages/UsagePage.tsx
12
- function j(e, t) {
12
+ function M(e, t) {
13
13
  if (t?.displayName && typeof t.displayName == "string") return t.displayName;
14
14
  if (t?.label && typeof t.label == "string") return t.label;
15
15
  let n = e.split(".");
16
16
  return (n.length > 1 ? n.slice(1) : n).map((e) => e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase())).join(" ");
17
17
  }
18
- var re = ({ status: e, className: n = "size-4" }) => {
18
+ var ne = ({ status: e, className: n = "size-4" }) => {
19
19
  switch (e) {
20
- case "EXHAUSTED": return /* @__PURE__ */ k(D, { className: `${n} ${t.error.icon}` });
21
- case "CRITICAL": return /* @__PURE__ */ k(g, { className: `${n} ${t.error.icon}` });
22
- case "WARNING": return /* @__PURE__ */ k(h, { className: `${n} ${t.warning.icon}` });
23
- case "HEALTHY": return /* @__PURE__ */ k(_, { className: `${n} ${t.success.icon}` });
24
- default: return /* @__PURE__ */ k(S, { className: `${n} ${t.neutral.icon}` });
20
+ case "EXHAUSTED": return /* @__PURE__ */ A(O, { className: `${n} ${t.error.icon}` });
21
+ case "CRITICAL": return /* @__PURE__ */ A(_, { className: `${n} ${t.error.icon}` });
22
+ case "WARNING": return /* @__PURE__ */ A(g, { className: `${n} ${t.warning.icon}` });
23
+ case "HEALTHY": return /* @__PURE__ */ A(v, { className: `${n} ${t.success.icon}` });
24
+ default: return /* @__PURE__ */ A(C, { className: `${n} ${t.neutral.icon}` });
25
25
  }
26
- }, M = ({ status: e }) => /* @__PURE__ */ k("span", {
26
+ }, N = ({ status: e }) => /* @__PURE__ */ A("span", {
27
27
  className: `px-2 py-0.5 text-xs font-medium rounded ${{
28
28
  EXHAUSTED: `${t.error.bg} ${t.error.text}`,
29
29
  CRITICAL: `${t.error.bg} ${t.error.text}`,
@@ -32,11 +32,11 @@ var re = ({ status: e, className: n = "size-4" }) => {
32
32
  INACTIVE: `${t.neutral.bg} ${t.neutral.text}`
33
33
  }[e]}`,
34
34
  children: e
35
- }), N = ({ percentage: e, status: n }) => {
35
+ }), P = ({ percentage: e, status: n }) => {
36
36
  let r = Math.min(100, Math.max(0, e));
37
- return /* @__PURE__ */ k("div", {
37
+ return /* @__PURE__ */ A("div", {
38
38
  className: "w-full bg-muted rounded-full h-2.5 overflow-hidden",
39
- children: /* @__PURE__ */ k("div", {
39
+ children: /* @__PURE__ */ A("div", {
40
40
  className: `h-full rounded-full transition-all duration-300 ${{
41
41
  EXHAUSTED: t.error.dot,
42
42
  CRITICAL: t.error.dot,
@@ -47,7 +47,7 @@ var re = ({ status: e, className: n = "size-4" }) => {
47
47
  style: { width: `${r}%` }
48
48
  })
49
49
  });
50
- }, P = ({ label: e, value: n, icon: r, color: i, isActive: a, onClick: o }) => {
50
+ }, F = ({ label: e, value: n, icon: r, color: i, isActive: a, onClick: o }) => {
51
51
  let s = {
52
52
  blue: t.info,
53
53
  emerald: t.success,
@@ -73,60 +73,60 @@ var re = ({ status: e, className: n = "size-4" }) => {
73
73
  red: t.error.icon,
74
74
  gray: t.neutral.icon
75
75
  };
76
- return /* @__PURE__ */ A("button", {
76
+ return /* @__PURE__ */ j("button", {
77
77
  type: "button",
78
78
  onClick: o,
79
79
  className: `border rounded-lg p-4 w-full text-left transition-all ${c[i]} ${o ? "cursor-pointer hover:shadow-md" : ""} ${a ? l[i] : ""}`,
80
- children: [/* @__PURE__ */ A("div", {
80
+ children: [/* @__PURE__ */ j("div", {
81
81
  className: "flex items-center gap-2 mb-2",
82
- children: [/* @__PURE__ */ k("span", {
82
+ children: [/* @__PURE__ */ A("span", {
83
83
  className: u[i],
84
84
  children: r
85
- }), /* @__PURE__ */ k("span", {
85
+ }), /* @__PURE__ */ A("span", {
86
86
  className: "text-sm text-muted-foreground",
87
87
  children: e
88
88
  })]
89
- }), /* @__PURE__ */ k("p", {
89
+ }), /* @__PURE__ */ A("p", {
90
90
  className: "text-2xl font-bold text-foreground",
91
91
  children: n
92
92
  })]
93
93
  });
94
- }, F = ({ quota: e, planLabel: t, onClick: n }) => {
94
+ }, I = ({ quota: e, planLabel: t, onClick: n }) => {
95
95
  let r = e.totalLimit != null && e.totalLimit > 0 && !e.noLimit;
96
- return /* @__PURE__ */ A("tr", {
96
+ return /* @__PURE__ */ j("tr", {
97
97
  onClick: n,
98
98
  className: "cursor-pointer hover:bg-muted/40 transition-colors border-b border-border last:border-b-0",
99
99
  children: [
100
- /* @__PURE__ */ A("td", {
100
+ /* @__PURE__ */ j("td", {
101
101
  className: "px-4 py-3",
102
102
  children: [
103
- /* @__PURE__ */ k("span", {
103
+ /* @__PURE__ */ A("span", {
104
104
  className: "text-sm font-medium text-primary hover:underline capitalize",
105
105
  children: e.displayName || e.name.replace(/_/g, " ")
106
106
  }),
107
- /* @__PURE__ */ k("span", {
107
+ /* @__PURE__ */ A("span", {
108
108
  className: "block text-xs font-mono text-muted-foreground mt-0.5",
109
109
  children: e.name
110
110
  }),
111
- e.description && /* @__PURE__ */ k("span", {
111
+ e.description && /* @__PURE__ */ A("span", {
112
112
  className: "block text-xs text-muted-foreground mt-0.5 max-w-[220px] truncate",
113
113
  children: e.description
114
114
  }),
115
- e.quotaCount > 1 && /* @__PURE__ */ A("span", {
115
+ e.quotaCount > 1 && /* @__PURE__ */ j("span", {
116
116
  className: "block text-xs text-muted-foreground mt-0.5",
117
117
  children: [e.quotaCount, " assignments"]
118
118
  })
119
119
  ]
120
120
  }),
121
- t !== void 0 && /* @__PURE__ */ k("td", {
121
+ t !== void 0 && /* @__PURE__ */ A("td", {
122
122
  className: "px-4 py-3 text-sm text-muted-foreground whitespace-nowrap",
123
123
  children: t
124
124
  }),
125
- /* @__PURE__ */ k("td", {
125
+ /* @__PURE__ */ A("td", {
126
126
  className: "px-4 py-3",
127
- children: /* @__PURE__ */ A("div", {
127
+ children: /* @__PURE__ */ j("div", {
128
128
  className: "space-y-1.5",
129
- children: [/* @__PURE__ */ A("span", {
129
+ children: [/* @__PURE__ */ j("span", {
130
130
  className: "text-sm text-foreground tabular-nums",
131
131
  children: [
132
132
  i(e.totalUsed),
@@ -134,58 +134,58 @@ var re = ({ status: e, className: n = "size-4" }) => {
134
134
  r ? i(e.totalLimit) : "∞",
135
135
  e.unit ? ` ${e.unit}` : ""
136
136
  ]
137
- }), /* @__PURE__ */ k(N, {
137
+ }), /* @__PURE__ */ A(P, {
138
138
  percentage: r ? e.usagePercentage : 0,
139
139
  status: e.status
140
140
  })]
141
141
  })
142
142
  }),
143
- /* @__PURE__ */ k("td", {
143
+ /* @__PURE__ */ A("td", {
144
144
  className: "px-4 py-3 text-sm text-muted-foreground tabular-nums whitespace-nowrap",
145
145
  children: r ? i(e.totalLimit) : "∞"
146
146
  }),
147
- /* @__PURE__ */ k("td", {
147
+ /* @__PURE__ */ A("td", {
148
148
  className: "px-4 py-3",
149
- children: /* @__PURE__ */ k(M, { status: e.status })
149
+ children: /* @__PURE__ */ A(N, { status: e.status })
150
150
  })
151
151
  ]
152
152
  });
153
- }, ie = ({ quotas: e, planLabel: t, showPlanColumn: n = !0, onQuotaClick: r }) => /* @__PURE__ */ k("div", {
153
+ }, re = ({ quotas: e, planLabel: t, showPlanColumn: n = !0, onQuotaClick: r }) => /* @__PURE__ */ A("div", {
154
154
  className: "overflow-x-auto rounded-lg border border-border bg-card",
155
- children: /* @__PURE__ */ A("table", {
155
+ children: /* @__PURE__ */ j("table", {
156
156
  className: "w-full text-left",
157
- children: [/* @__PURE__ */ k("thead", { children: /* @__PURE__ */ A("tr", {
157
+ children: [/* @__PURE__ */ A("thead", { children: /* @__PURE__ */ j("tr", {
158
158
  className: "border-b border-border bg-muted/30",
159
159
  children: [
160
- /* @__PURE__ */ k("th", {
160
+ /* @__PURE__ */ A("th", {
161
161
  className: "px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",
162
162
  children: "Quotas"
163
163
  }),
164
- n && /* @__PURE__ */ k("th", {
164
+ n && /* @__PURE__ */ A("th", {
165
165
  className: "px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",
166
166
  children: "Plan"
167
167
  }),
168
- /* @__PURE__ */ k("th", {
168
+ /* @__PURE__ */ A("th", {
169
169
  className: "px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",
170
170
  children: "Current Usage"
171
171
  }),
172
- /* @__PURE__ */ k("th", {
172
+ /* @__PURE__ */ A("th", {
173
173
  className: "px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",
174
174
  children: "Limit"
175
175
  }),
176
- /* @__PURE__ */ k("th", {
176
+ /* @__PURE__ */ A("th", {
177
177
  className: "px-4 py-2.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",
178
178
  children: "Status"
179
179
  })
180
180
  ]
181
- }) }), /* @__PURE__ */ k("tbody", { children: e.map((e) => /* @__PURE__ */ k(F, {
181
+ }) }), /* @__PURE__ */ A("tbody", { children: e.map((e) => /* @__PURE__ */ A(I, {
182
182
  quota: e,
183
183
  planLabel: n ? t : void 0,
184
184
  onClick: () => r(e)
185
185
  }, e.name)) })]
186
186
  })
187
- }), I = ({ subscription: e, onQuotaClick: n, defaultExpanded: r = !0 }) => {
188
- let [i, a] = m(r), o = {
187
+ }), ie = ({ subscription: e, onQuotaClick: n, defaultExpanded: r = !0 }) => {
188
+ let [i, a] = h(r), o = {
189
189
  active: `${t.success.bg} ${t.success.text}`,
190
190
  trialing: `${t.info.bg} ${t.info.text}`,
191
191
  past_due: `${t.warning.bg} ${t.warning.text}`,
@@ -193,27 +193,27 @@ var re = ({ status: e, className: n = "size-4" }) => {
193
193
  expired: `${t.neutral.bg} ${t.neutral.text}`,
194
194
  upgraded: `${t.primary.bg} ${t.primary.text}`
195
195
  };
196
- return /* @__PURE__ */ A("div", {
196
+ return /* @__PURE__ */ j("div", {
197
197
  className: "border border-border rounded-lg bg-card overflow-hidden",
198
198
  children: [
199
- /* @__PURE__ */ A("button", {
199
+ /* @__PURE__ */ j("button", {
200
200
  type: "button",
201
201
  onClick: () => a(!i),
202
202
  className: "w-full flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",
203
- children: [/* @__PURE__ */ A("div", {
203
+ children: [/* @__PURE__ */ j("div", {
204
204
  className: "flex items-center gap-3",
205
- children: [/* @__PURE__ */ k(w, { className: "size-5 text-primary" }), /* @__PURE__ */ A("div", {
205
+ children: [/* @__PURE__ */ A(T, { className: "size-5 text-primary" }), /* @__PURE__ */ j("div", {
206
206
  className: "text-left",
207
- children: [/* @__PURE__ */ A("div", {
207
+ children: [/* @__PURE__ */ j("div", {
208
208
  className: "flex items-center gap-2",
209
- children: [/* @__PURE__ */ k("span", {
209
+ children: [/* @__PURE__ */ A("span", {
210
210
  className: "font-medium text-foreground",
211
211
  children: "Subscription"
212
- }), /* @__PURE__ */ k("span", {
212
+ }), /* @__PURE__ */ A("span", {
213
213
  className: `px-2 py-0.5 text-xs font-medium rounded capitalize ${o[e.status.toLowerCase()] || o.active}`,
214
214
  children: e.status
215
215
  })]
216
- }), /* @__PURE__ */ A("p", {
216
+ }), /* @__PURE__ */ j("p", {
217
217
  className: "text-xs text-muted-foreground",
218
218
  children: [
219
219
  e.aggregatedQuotas.length,
@@ -222,20 +222,20 @@ var re = ({ status: e, className: n = "size-4" }) => {
222
222
  ]
223
223
  })]
224
224
  })]
225
- }), k(i ? v : b, { className: "size-5 text-muted-foreground" })]
225
+ }), A(i ? y : x, { className: "size-5 text-muted-foreground" })]
226
226
  }),
227
- i && e.aggregatedQuotas.length > 0 && /* @__PURE__ */ k("div", {
227
+ i && e.aggregatedQuotas.length > 0 && /* @__PURE__ */ A("div", {
228
228
  className: "border-t border-border",
229
- children: /* @__PURE__ */ k(ie, {
229
+ children: /* @__PURE__ */ A(re, {
230
230
  quotas: e.aggregatedQuotas,
231
231
  planLabel: e.planName || e.productId || void 0,
232
232
  showPlanColumn: !!(e.planName || e.productId),
233
233
  onQuotaClick: n
234
234
  })
235
235
  }),
236
- i && e.aggregatedQuotas.length === 0 && /* @__PURE__ */ k("div", {
236
+ i && e.aggregatedQuotas.length === 0 && /* @__PURE__ */ A("div", {
237
237
  className: "border-t border-border p-6 text-center",
238
- children: /* @__PURE__ */ k("p", {
238
+ children: /* @__PURE__ */ A("p", {
239
239
  className: "text-sm text-muted-foreground",
240
240
  children: "No quotas assigned to this subscription"
241
241
  })
@@ -243,44 +243,44 @@ var re = ({ status: e, className: n = "size-4" }) => {
243
243
  ]
244
244
  });
245
245
  }, ae = ({ quota: n, onClose: o }) => {
246
- let [s, c] = m([null]), d = s[s.length - 1] ?? null, ee = s.length, { workspaceId: f } = e(), p = n.quotaAssignments[0]?.id, { usages: h, hasNextPage: g, nextCursor: _, isLoading: v } = l(p, 10, d, f), { snapshots: x, isLoading: S } = u(f, n.name, 24), C = () => {
247
- _ && c((e) => [...e, _]);
248
- }, w = () => {
246
+ let [s, c] = h([null]), d = s[s.length - 1] ?? null, f = s.length, { workspaceId: p } = e(), m = n.quotaAssignments[0]?.id, { usages: g, hasNextPage: _, nextCursor: v, isLoading: y } = l(m, 10, d, p), { snapshots: S, isLoading: C } = u(p, n.name, 24), w = () => {
247
+ v && c((e) => [...e, v]);
248
+ }, T = () => {
249
249
  s.length > 1 && c((e) => e.slice(0, -1));
250
250
  };
251
- return /* @__PURE__ */ A("div", {
251
+ return /* @__PURE__ */ j("div", {
252
252
  className: "fixed inset-0 z-50 flex items-center justify-center",
253
- children: [/* @__PURE__ */ k("div", {
253
+ children: [/* @__PURE__ */ A("div", {
254
254
  className: "absolute inset-0 bg-overlay-scrim",
255
255
  onClick: o
256
- }), /* @__PURE__ */ A("div", {
256
+ }), /* @__PURE__ */ j("div", {
257
257
  className: "relative bg-background border border-border rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[90vh] overflow-auto",
258
258
  role: "dialog",
259
259
  "aria-modal": "true",
260
260
  "aria-labelledby": "quota-detail-title",
261
261
  children: [
262
- /* @__PURE__ */ A("div", {
262
+ /* @__PURE__ */ j("div", {
263
263
  className: "sticky top-0 bg-background border-b border-border p-4 flex items-center justify-between",
264
- children: [/* @__PURE__ */ A("div", {
264
+ children: [/* @__PURE__ */ j("div", {
265
265
  className: "flex items-center gap-3",
266
- children: [/* @__PURE__ */ k(re, {
266
+ children: [/* @__PURE__ */ A(ne, {
267
267
  status: n.status,
268
268
  className: "size-5"
269
- }), /* @__PURE__ */ A("div", { children: [
270
- /* @__PURE__ */ k("h2", {
269
+ }), /* @__PURE__ */ j("div", { children: [
270
+ /* @__PURE__ */ A("h2", {
271
271
  id: "quota-detail-title",
272
272
  className: "text-lg font-semibold capitalize",
273
273
  children: n.displayName || n.name.replace(/_/g, " ")
274
274
  }),
275
- /* @__PURE__ */ k("p", {
275
+ /* @__PURE__ */ A("p", {
276
276
  className: "text-xs font-mono text-muted-foreground",
277
277
  children: n.name
278
278
  }),
279
- n.description && /* @__PURE__ */ k("p", {
279
+ n.description && /* @__PURE__ */ A("p", {
280
280
  className: "text-sm text-muted-foreground mt-0.5",
281
281
  children: n.description
282
282
  }),
283
- /* @__PURE__ */ A("p", {
283
+ /* @__PURE__ */ j("p", {
284
284
  className: "text-sm text-muted-foreground mt-0.5",
285
285
  children: [
286
286
  n.quotaCount,
@@ -289,33 +289,33 @@ var re = ({ status: e, className: n = "size-4" }) => {
289
289
  ]
290
290
  })
291
291
  ] })]
292
- }), /* @__PURE__ */ k("button", {
292
+ }), /* @__PURE__ */ A("button", {
293
293
  type: "button",
294
294
  onClick: o,
295
295
  className: "p-1 rounded-md hover:bg-muted/50 transition-colors",
296
296
  "aria-label": "Close quota details",
297
- children: /* @__PURE__ */ k(E, { className: "size-5" })
297
+ children: /* @__PURE__ */ A(D, { className: "size-5" })
298
298
  })]
299
299
  }),
300
- /* @__PURE__ */ A("div", {
300
+ /* @__PURE__ */ j("div", {
301
301
  className: "p-4 border-b border-border",
302
- children: [/* @__PURE__ */ A("div", {
302
+ children: [/* @__PURE__ */ j("div", {
303
303
  className: "mb-4",
304
304
  children: [
305
- /* @__PURE__ */ A("div", {
305
+ /* @__PURE__ */ j("div", {
306
306
  className: "flex items-center justify-between mb-2",
307
- children: [/* @__PURE__ */ k("span", {
307
+ children: [/* @__PURE__ */ A("span", {
308
308
  className: "text-sm text-muted-foreground",
309
309
  children: "Usage"
310
- }), /* @__PURE__ */ k(M, { status: n.status })]
310
+ }), /* @__PURE__ */ A(N, { status: n.status })]
311
311
  }),
312
- /* @__PURE__ */ k(N, {
312
+ /* @__PURE__ */ A(P, {
313
313
  percentage: n.usagePercentage,
314
314
  status: n.status
315
315
  }),
316
- /* @__PURE__ */ A("div", {
316
+ /* @__PURE__ */ j("div", {
317
317
  className: "flex items-center justify-between mt-2 text-sm",
318
- children: [/* @__PURE__ */ A("span", {
318
+ children: [/* @__PURE__ */ j("span", {
319
319
  className: "font-medium",
320
320
  children: [
321
321
  i(n.totalUsed),
@@ -324,44 +324,44 @@ var re = ({ status: e, className: n = "size-4" }) => {
324
324
  n.totalLimit != null && n.totalLimit > 0 ? i(n.totalLimit) : "∞",
325
325
  n.unit && ` ${n.unit}`
326
326
  ]
327
- }), /* @__PURE__ */ k("span", {
327
+ }), /* @__PURE__ */ A("span", {
328
328
  className: "text-muted-foreground",
329
329
  children: n.totalLimit != null && n.totalLimit > 0 ? `${Math.round(n.usagePercentage)}% used` : "Unlimited"
330
330
  })]
331
331
  })
332
332
  ]
333
- }), n.quotaCount > 1 && /* @__PURE__ */ A("div", {
333
+ }), n.quotaCount > 1 && /* @__PURE__ */ j("div", {
334
334
  className: "mt-4",
335
- children: [/* @__PURE__ */ k("h3", {
335
+ children: [/* @__PURE__ */ A("h3", {
336
336
  className: "text-sm font-medium text-foreground mb-3",
337
337
  children: "Quota Breakdown"
338
- }), /* @__PURE__ */ k("div", {
338
+ }), /* @__PURE__ */ A("div", {
339
339
  className: "border border-border rounded-lg overflow-hidden divide-y divide-border",
340
340
  children: [...n.quotaAssignments].sort((e, t) => (e.endtime ? new Date(e.endtime).getTime() : Infinity) - (t.endtime ? new Date(t.endtime).getTime() : Infinity)).map((e) => {
341
341
  let n = e.endtime ? new Date(e.endtime) : null, r = /* @__PURE__ */ new Date(), a = n && n < r, o = n ? Math.ceil((n.getTime() - r.getTime()) / (1440 * 60 * 1e3)) : null, s = o !== null && o > 0 && o <= 7;
342
- return /* @__PURE__ */ A("div", {
342
+ return /* @__PURE__ */ j("div", {
343
343
  className: `flex items-center justify-between px-3 py-2.5 ${a ? "bg-muted/30" : s ? t.warning.bg : "bg-background"}`,
344
- children: [/* @__PURE__ */ A("div", {
344
+ children: [/* @__PURE__ */ j("div", {
345
345
  className: "flex items-center gap-2",
346
- children: [s && !a && /* @__PURE__ */ k("span", { className: `size-2 rounded-full ${t.warning.dot} animate-pulse` }), /* @__PURE__ */ A("div", {
346
+ children: [s && !a && /* @__PURE__ */ A("span", { className: `size-2 rounded-full ${t.warning.dot} animate-pulse` }), /* @__PURE__ */ j("div", {
347
347
  className: "flex flex-col",
348
- children: [/* @__PURE__ */ k("span", {
348
+ children: [/* @__PURE__ */ A("span", {
349
349
  className: `text-sm ${a ? "text-muted-foreground" : "text-foreground"}`,
350
350
  children: n ? n.toLocaleDateString("en-US", {
351
351
  month: "short",
352
352
  day: "numeric",
353
353
  year: "numeric"
354
354
  }) : "No expiry"
355
- }), /* @__PURE__ */ k("span", {
355
+ }), /* @__PURE__ */ A("span", {
356
356
  className: `text-xs ${a ? "text-destructive" : s ? t.warning.text : "text-muted-foreground"}`,
357
357
  children: a ? "Expired" : o === null ? "Never expires" : o === 0 ? "Expires today" : o === 1 ? "Expires tomorrow" : `${o} days left`
358
358
  })]
359
359
  })]
360
- }), /* @__PURE__ */ k("div", {
360
+ }), /* @__PURE__ */ A("div", {
361
361
  className: "text-right",
362
- children: /* @__PURE__ */ A("span", {
362
+ children: /* @__PURE__ */ j("span", {
363
363
  className: `text-sm font-semibold ${a ? "text-muted-foreground" : "text-foreground"}`,
364
- children: [i(e.used), /* @__PURE__ */ A("span", {
364
+ children: [i(e.used), /* @__PURE__ */ j("span", {
365
365
  className: "text-muted-foreground font-normal",
366
366
  children: [
367
367
  " / ",
@@ -376,34 +376,34 @@ var re = ({ status: e, className: n = "size-4" }) => {
376
376
  })]
377
377
  })]
378
378
  }),
379
- (S || x.length > 0) && /* @__PURE__ */ A("div", {
379
+ (C || S.length > 0) && /* @__PURE__ */ j("div", {
380
380
  className: "p-4 border-t border-border",
381
- children: [/* @__PURE__ */ k("h3", {
381
+ children: [/* @__PURE__ */ A("h3", {
382
382
  className: "text-sm font-medium text-foreground mb-3",
383
383
  children: "Live Value History"
384
- }), S ? /* @__PURE__ */ k("div", {
384
+ }), C ? /* @__PURE__ */ A("div", {
385
385
  className: "space-y-1.5",
386
386
  children: [
387
387
  1,
388
388
  2,
389
389
  3
390
- ].map((e) => /* @__PURE__ */ k("div", { className: "h-8 bg-muted animate-pulse rounded" }, e))
391
- }) : /* @__PURE__ */ k("div", {
390
+ ].map((e) => /* @__PURE__ */ A("div", { className: "h-8 bg-muted animate-pulse rounded" }, e))
391
+ }) : /* @__PURE__ */ A("div", {
392
392
  className: "space-y-1.5",
393
- children: x.map((e) => /* @__PURE__ */ A("div", {
393
+ children: S.map((e) => /* @__PURE__ */ j("div", {
394
394
  className: "flex items-center justify-between px-3 py-2 bg-muted/30 rounded-md",
395
- children: [/* @__PURE__ */ k("span", {
395
+ children: [/* @__PURE__ */ A("span", {
396
396
  className: "text-xs text-muted-foreground",
397
397
  children: r(e.snapshotAt)
398
- }), /* @__PURE__ */ A("span", {
398
+ }), /* @__PURE__ */ j("span", {
399
399
  className: "text-sm font-medium text-foreground tabular-nums",
400
400
  children: [
401
401
  i(e.value),
402
- n.unit && /* @__PURE__ */ k("span", {
402
+ n.unit && /* @__PURE__ */ A("span", {
403
403
  className: "text-xs text-muted-foreground ml-1",
404
404
  children: n.unit
405
405
  }),
406
- !e.noLimit && e.limit != null && /* @__PURE__ */ A("span", {
406
+ !e.noLimit && e.limit != null && /* @__PURE__ */ j("span", {
407
407
  className: "text-xs text-muted-foreground ml-1",
408
408
  children: ["/ ", i(e.limit)]
409
409
  })
@@ -412,36 +412,36 @@ var re = ({ status: e, className: n = "size-4" }) => {
412
412
  }, e.id))
413
413
  })]
414
414
  }),
415
- /* @__PURE__ */ A("div", {
415
+ /* @__PURE__ */ j("div", {
416
416
  className: "p-4",
417
417
  children: [
418
- /* @__PURE__ */ k("h3", {
418
+ /* @__PURE__ */ A("h3", {
419
419
  className: "text-sm font-medium text-foreground mb-3",
420
420
  children: "Recent Usage"
421
421
  }),
422
- n.isCollectorBased ? /* @__PURE__ */ k("p", {
422
+ n.isCollectorBased ? /* @__PURE__ */ A("p", {
423
423
  className: "text-sm text-muted-foreground text-center py-6",
424
424
  children: "Usage is tracked via system metrics, individual event records are not available for this quota."
425
- }) : v ? /* @__PURE__ */ k("div", {
425
+ }) : y ? /* @__PURE__ */ A("div", {
426
426
  className: "space-y-2",
427
427
  children: [
428
428
  1,
429
429
  2,
430
430
  3
431
- ].map((e) => /* @__PURE__ */ k("div", { className: "h-12 bg-muted animate-pulse rounded" }, e))
432
- }) : h.length === 0 ? /* @__PURE__ */ k("p", {
431
+ ].map((e) => /* @__PURE__ */ A("div", { className: "h-12 bg-muted animate-pulse rounded" }, e))
432
+ }) : g.length === 0 ? /* @__PURE__ */ A("p", {
433
433
  className: "text-sm text-muted-foreground text-center py-6",
434
434
  children: "No usage records found"
435
- }) : /* @__PURE__ */ k("div", {
435
+ }) : /* @__PURE__ */ A("div", {
436
436
  className: "space-y-2",
437
- children: h.map((e) => /* @__PURE__ */ A("div", {
437
+ children: g.map((e) => /* @__PURE__ */ j("div", {
438
438
  className: "flex items-center justify-between p-3 border border-border rounded-lg",
439
- children: [/* @__PURE__ */ A("div", {
439
+ children: [/* @__PURE__ */ j("div", {
440
440
  className: "flex-1 min-w-0",
441
- children: [/* @__PURE__ */ k("p", {
441
+ children: [/* @__PURE__ */ A("p", {
442
442
  className: "text-sm font-medium text-foreground",
443
443
  children: e.description || "Usage recorded"
444
- }), /* @__PURE__ */ A("p", {
444
+ }), /* @__PURE__ */ j("p", {
445
445
  className: "text-xs text-muted-foreground",
446
446
  children: [
447
447
  a(e.timestamp),
@@ -449,42 +449,42 @@ var re = ({ status: e, className: n = "size-4" }) => {
449
449
  r(e.timestamp)
450
450
  ]
451
451
  })]
452
- }), /* @__PURE__ */ k("span", {
452
+ }), /* @__PURE__ */ A("span", {
453
453
  className: "text-sm font-medium text-foreground ml-4",
454
454
  children: i(e.amount)
455
455
  })]
456
456
  }, e.id))
457
457
  }),
458
- !n.isCollectorBased && (s.length > 1 || g) && /* @__PURE__ */ A("div", {
458
+ !n.isCollectorBased && (s.length > 1 || _) && /* @__PURE__ */ j("div", {
459
459
  className: "flex items-center justify-center gap-2 mt-4",
460
460
  children: [
461
- /* @__PURE__ */ k("button", {
461
+ /* @__PURE__ */ A("button", {
462
462
  type: "button",
463
- onClick: w,
463
+ onClick: T,
464
464
  disabled: s.length === 1,
465
465
  className: "px-3 py-1.5 text-sm border border-border rounded-md disabled:opacity-50",
466
466
  "aria-label": "Previous usage page",
467
- children: /* @__PURE__ */ k(y, { className: "size-4" })
467
+ children: /* @__PURE__ */ A(b, { className: "size-4" })
468
468
  }),
469
- /* @__PURE__ */ A("span", {
469
+ /* @__PURE__ */ j("span", {
470
470
  className: "text-sm text-muted-foreground",
471
- children: ["Page ", ee]
471
+ children: ["Page ", f]
472
472
  }),
473
- /* @__PURE__ */ k("button", {
473
+ /* @__PURE__ */ A("button", {
474
474
  type: "button",
475
- onClick: C,
476
- disabled: !g,
475
+ onClick: w,
476
+ disabled: !_,
477
477
  className: "px-3 py-1.5 text-sm border border-border rounded-md disabled:opacity-50",
478
478
  "aria-label": "Next usage page",
479
- children: /* @__PURE__ */ k(b, { className: "size-4" })
479
+ children: /* @__PURE__ */ A(x, { className: "size-4" })
480
480
  })
481
481
  ]
482
482
  })
483
483
  ]
484
484
  }),
485
- /* @__PURE__ */ k("div", {
485
+ /* @__PURE__ */ A("div", {
486
486
  className: "sticky bottom-0 bg-background border-t border-border p-4",
487
- children: /* @__PURE__ */ k("button", {
487
+ children: /* @__PURE__ */ A("button", {
488
488
  type: "button",
489
489
  onClick: o,
490
490
  className: "w-full py-2 px-4 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",
@@ -499,676 +499,737 @@ function L(e, t) {
499
499
  return t ? n.HEALTHY : e >= 100 ? n.EXHAUSTED : e >= 90 ? n.CRITICAL : e >= 75 ? n.WARNING : n.HEALTHY;
500
500
  }
501
501
  var oe = ({ workspaceId: e }) => {
502
- let { overview: n, isLoading: r, error: a, refetch: o } = d(e);
503
- if (r && n.length === 0) return /* @__PURE__ */ k("div", {
502
+ let { overview: r, isLoading: a, error: o, refetch: s } = d(e), [c, l] = h(/* @__PURE__ */ new Set()), u = m(() => {
503
+ let e = /* @__PURE__ */ new Map();
504
+ for (let t of r) {
505
+ let n = e.get(t.assignment.quotaName) ?? [];
506
+ n.push(t), e.set(t.assignment.quotaName, n);
507
+ }
508
+ return Array.from(e.entries()).map(([e, t]) => {
509
+ let n = t.every((e) => e.assignment.noLimit), r = n ? null : t.reduce((e, t) => e + (t.assignment.limit ?? 0), 0), i = t.reduce((e, t) => e + t.effectiveUsed, 0), a = r == null ? null : r - i, o = r ? i / r * 100 : 0;
510
+ return {
511
+ quotaName: e,
512
+ items: t,
513
+ noLimit: n,
514
+ totalLimit: r,
515
+ totalUsed: i,
516
+ totalRemaining: a,
517
+ usagePercentage: o,
518
+ status: L(o, n),
519
+ hasLive: t.some((e) => e.liveStatus !== null),
520
+ hasMultiple: t.length > 1
521
+ };
522
+ });
523
+ }, [r]), p = f((e) => {
524
+ l((t) => {
525
+ let n = new Set(t);
526
+ return n.has(e) ? n.delete(e) : n.add(e), n;
527
+ });
528
+ }, []);
529
+ if (a && r.length === 0) return /* @__PURE__ */ A("div", {
504
530
  className: "space-y-3",
505
531
  children: [
506
532
  1,
507
533
  2,
508
534
  3
509
- ].map((e) => /* @__PURE__ */ k("div", { className: "h-16 bg-muted animate-pulse rounded-lg" }, e))
535
+ ].map((e) => /* @__PURE__ */ A("div", { className: "h-16 bg-muted animate-pulse rounded-lg" }, e))
510
536
  });
511
- if (a) return /* @__PURE__ */ A("div", {
537
+ if (o) return /* @__PURE__ */ j("div", {
512
538
  className: "text-center py-8 space-y-2",
513
539
  children: [
514
- /* @__PURE__ */ k(g, { className: "size-8 text-destructive mx-auto" }),
515
- /* @__PURE__ */ k("p", {
540
+ /* @__PURE__ */ A(_, { className: "size-8 text-destructive mx-auto" }),
541
+ /* @__PURE__ */ A("p", {
516
542
  className: "text-sm text-muted-foreground",
517
- children: a.message
543
+ children: o.message
518
544
  }),
519
- /* @__PURE__ */ k("button", {
545
+ /* @__PURE__ */ A("button", {
520
546
  type: "button",
521
- onClick: () => o(),
547
+ onClick: () => s(),
522
548
  className: "px-3 py-1.5 text-sm border border-border rounded-md hover:bg-muted/50 transition-colors",
523
549
  children: "Retry"
524
550
  })
525
551
  ]
526
552
  });
527
- if (n.length === 0) return /* @__PURE__ */ A("div", {
553
+ if (r.length === 0) return /* @__PURE__ */ j("div", {
528
554
  className: "text-center py-12 space-y-2",
529
555
  children: [
530
- /* @__PURE__ */ k(C, { className: "size-10 text-muted-foreground mx-auto opacity-40" }),
531
- /* @__PURE__ */ k("h3", {
556
+ /* @__PURE__ */ A(w, { className: "size-10 text-muted-foreground mx-auto opacity-40" }),
557
+ /* @__PURE__ */ A("h3", {
532
558
  className: "text-base font-medium text-foreground",
533
559
  children: "No workspace quotas assigned"
534
560
  }),
535
- /* @__PURE__ */ k("p", {
561
+ /* @__PURE__ */ A("p", {
536
562
  className: "text-sm text-muted-foreground max-w-sm mx-auto",
537
563
  children: "Quotas are assigned to this workspace after a successful purchase. If you have an active subscription, contact support."
538
564
  })
539
565
  ]
540
566
  });
541
- let s = n.filter((e) => L(e.usagePercentage, e.assignment.noLimit) === "HEALTHY").length, c = n.filter((e) => L(e.usagePercentage, e.assignment.noLimit) === "WARNING").length, l = n.filter((e) => {
542
- let t = L(e.usagePercentage, e.assignment.noLimit);
543
- return t === "CRITICAL" || t === "EXHAUSTED";
544
- }).length;
545
- return /* @__PURE__ */ A("div", {
567
+ let y = u.filter((e) => e.status === n.HEALTHY).length, b = u.filter((e) => e.status === n.WARNING).length, S = u.filter((e) => e.status === n.CRITICAL || e.status === n.EXHAUSTED).length;
568
+ return /* @__PURE__ */ j("div", {
546
569
  className: "space-y-4",
547
570
  children: [
548
- /* @__PURE__ */ A("div", {
571
+ /* @__PURE__ */ j("div", {
549
572
  className: "grid grid-cols-3 gap-3",
550
573
  children: [
551
- /* @__PURE__ */ A("div", {
574
+ /* @__PURE__ */ j("div", {
552
575
  className: `border rounded-lg p-3 ${t.success.bg} ${t.success.border}`,
553
- children: [/* @__PURE__ */ A("div", {
576
+ children: [/* @__PURE__ */ j("div", {
554
577
  className: "flex items-center gap-1.5 mb-1",
555
- children: [/* @__PURE__ */ k(_, { className: `size-4 ${t.success.icon}` }), /* @__PURE__ */ k("span", {
578
+ children: [/* @__PURE__ */ A(v, { className: `size-4 ${t.success.icon}` }), /* @__PURE__ */ A("span", {
556
579
  className: "text-xs text-muted-foreground",
557
580
  children: "Healthy"
558
581
  })]
559
- }), /* @__PURE__ */ k("p", {
582
+ }), /* @__PURE__ */ A("p", {
560
583
  className: "text-xl font-bold text-foreground",
561
- children: s
584
+ children: y
562
585
  })]
563
586
  }),
564
- /* @__PURE__ */ A("div", {
587
+ /* @__PURE__ */ j("div", {
565
588
  className: `border rounded-lg p-3 ${t.warning.bg} ${t.warning.border}`,
566
- children: [/* @__PURE__ */ A("div", {
589
+ children: [/* @__PURE__ */ j("div", {
567
590
  className: "flex items-center gap-1.5 mb-1",
568
- children: [/* @__PURE__ */ k(h, { className: `size-4 ${t.warning.icon}` }), /* @__PURE__ */ k("span", {
591
+ children: [/* @__PURE__ */ A(g, { className: `size-4 ${t.warning.icon}` }), /* @__PURE__ */ A("span", {
569
592
  className: "text-xs text-muted-foreground",
570
593
  children: "Warning"
571
594
  })]
572
- }), /* @__PURE__ */ k("p", {
595
+ }), /* @__PURE__ */ A("p", {
573
596
  className: "text-xl font-bold text-foreground",
574
- children: c
597
+ children: b
575
598
  })]
576
599
  }),
577
- /* @__PURE__ */ A("div", {
600
+ /* @__PURE__ */ j("div", {
578
601
  className: `border rounded-lg p-3 ${t.error.bg} ${t.error.border}`,
579
- children: [/* @__PURE__ */ A("div", {
602
+ children: [/* @__PURE__ */ j("div", {
580
603
  className: "flex items-center gap-1.5 mb-1",
581
- children: [/* @__PURE__ */ k(D, { className: `size-4 ${t.error.icon}` }), /* @__PURE__ */ k("span", {
604
+ children: [/* @__PURE__ */ A(O, { className: `size-4 ${t.error.icon}` }), /* @__PURE__ */ A("span", {
582
605
  className: "text-xs text-muted-foreground",
583
606
  children: "Critical / Exhausted"
584
607
  })]
585
- }), /* @__PURE__ */ k("p", {
608
+ }), /* @__PURE__ */ A("p", {
586
609
  className: "text-xl font-bold text-foreground",
587
- children: l
610
+ children: S
588
611
  })]
589
612
  })
590
613
  ]
591
614
  }),
592
- /* @__PURE__ */ k("div", {
615
+ /* @__PURE__ */ A("div", {
593
616
  className: "border border-border rounded-lg overflow-hidden",
594
- children: /* @__PURE__ */ A("table", {
617
+ children: /* @__PURE__ */ j("table", {
595
618
  className: "w-full text-sm",
596
- children: [/* @__PURE__ */ k("thead", { children: /* @__PURE__ */ A("tr", {
619
+ children: [/* @__PURE__ */ A("thead", { children: /* @__PURE__ */ j("tr", {
597
620
  className: "border-b border-border bg-muted/30",
598
621
  children: [
599
- /* @__PURE__ */ k("th", {
622
+ /* @__PURE__ */ A("th", {
600
623
  className: "text-left px-4 py-3 font-medium text-muted-foreground",
601
624
  children: "Quota"
602
625
  }),
603
- /* @__PURE__ */ k("th", {
626
+ /* @__PURE__ */ A("th", {
604
627
  className: "text-left px-4 py-3 font-medium text-muted-foreground hidden sm:table-cell",
605
- children: "Product"
628
+ children: "Sources"
606
629
  }),
607
- /* @__PURE__ */ k("th", {
608
- className: "text-left px-4 py-3 font-medium text-muted-foreground hidden md:table-cell",
609
- children: "Mode"
610
- }),
611
- /* @__PURE__ */ k("th", {
630
+ /* @__PURE__ */ A("th", {
612
631
  className: "text-left px-4 py-3 font-medium text-muted-foreground",
613
632
  children: "Usage"
614
633
  }),
615
- /* @__PURE__ */ k("th", {
634
+ /* @__PURE__ */ A("th", {
616
635
  className: "text-left px-4 py-3 font-medium text-muted-foreground hidden sm:table-cell",
617
- children: "Limit"
636
+ children: "Remaining"
618
637
  }),
619
- /* @__PURE__ */ k("th", {
638
+ /* @__PURE__ */ A("th", {
620
639
  className: "text-left px-4 py-3 font-medium text-muted-foreground",
621
640
  children: "Status"
622
641
  })
623
642
  ]
624
- }) }), /* @__PURE__ */ k("tbody", {
643
+ }) }), /* @__PURE__ */ A("tbody", {
625
644
  className: "divide-y divide-border",
626
- children: n.map((e) => {
627
- let { assignment: t, liveStatus: n, effectiveUsed: r, remaining: a, usagePercentage: o } = e, s = L(o, t.noLimit), c = n !== null;
628
- return /* @__PURE__ */ A("tr", {
629
- className: "hover:bg-muted/20 transition-colors",
645
+ children: u.map((e) => {
646
+ let t = c.has(e.quotaName);
647
+ return /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ j("tr", {
648
+ className: `transition-colors ${e.hasMultiple ? "cursor-pointer hover:bg-muted/30" : "hover:bg-muted/20"}`,
649
+ onClick: e.hasMultiple ? () => p(e.quotaName) : void 0,
630
650
  children: [
631
651
  /* @__PURE__ */ A("td", {
632
652
  className: "px-4 py-3",
633
- children: [
634
- /* @__PURE__ */ k("div", {
635
- className: "font-medium text-foreground",
636
- children: j(t.quotaName)
637
- }),
638
- /* @__PURE__ */ k("div", {
639
- className: "text-xs font-mono text-muted-foreground mt-0.5",
640
- children: t.quotaName
641
- }),
642
- c && /* @__PURE__ */ A("div", {
643
- className: "text-xs text-muted-foreground mt-0.5",
644
- children: ["Live · ", new Date(n.scrapedAt).toLocaleTimeString()]
645
- })
646
- ]
647
- }),
648
- /* @__PURE__ */ k("td", {
649
- className: "px-4 py-3 hidden sm:table-cell",
650
- children: /* @__PURE__ */ k("span", {
651
- className: "text-xs text-muted-foreground bg-muted px-1.5 py-0.5 rounded",
652
- children: t.productId
653
+ children: /* @__PURE__ */ j("div", {
654
+ className: "flex items-center gap-2",
655
+ children: [e.hasMultiple && /* @__PURE__ */ A(x, { className: `size-4 text-muted-foreground shrink-0 transition-transform duration-150 ${t ? "rotate-90" : ""}` }), /* @__PURE__ */ j("div", { children: [
656
+ /* @__PURE__ */ A("div", {
657
+ className: "font-medium text-foreground",
658
+ children: M(e.quotaName)
659
+ }),
660
+ /* @__PURE__ */ A("div", {
661
+ className: "text-xs font-mono text-muted-foreground mt-0.5",
662
+ children: e.quotaName
663
+ }),
664
+ e.hasLive && /* @__PURE__ */ A("div", {
665
+ className: "text-xs text-muted-foreground mt-0.5",
666
+ children: "Live · updated ~60s"
667
+ })
668
+ ] })]
653
669
  })
654
670
  }),
655
- /* @__PURE__ */ k("td", {
656
- className: "px-4 py-3 hidden md:table-cell",
657
- children: /* @__PURE__ */ k("span", {
658
- className: "text-xs text-muted-foreground capitalize",
659
- children: t.quotaMode
671
+ /* @__PURE__ */ A("td", {
672
+ className: "px-4 py-3 hidden sm:table-cell",
673
+ children: e.hasMultiple ? /* @__PURE__ */ j("span", {
674
+ className: "text-xs bg-accent text-accent-foreground px-1.5 py-0.5 rounded font-medium",
675
+ children: [e.items.length, " subscriptions"]
676
+ }) : /* @__PURE__ */ j("div", {
677
+ className: "flex items-center gap-1.5",
678
+ children: [/* @__PURE__ */ A("span", {
679
+ className: "text-xs text-muted-foreground bg-muted px-1.5 py-0.5 rounded",
680
+ children: e.items[0]?.assignment.productId
681
+ }), /* @__PURE__ */ A("span", {
682
+ className: "text-xs text-muted-foreground capitalize",
683
+ children: e.items[0]?.assignment.quotaMode
684
+ })]
660
685
  })
661
686
  }),
662
- /* @__PURE__ */ k("td", {
687
+ /* @__PURE__ */ A("td", {
663
688
  className: "px-4 py-3",
664
- children: /* @__PURE__ */ A("div", {
689
+ children: /* @__PURE__ */ j("div", {
665
690
  className: "space-y-1.5",
666
- children: [/* @__PURE__ */ A("div", {
691
+ children: [/* @__PURE__ */ j("div", {
667
692
  className: "text-foreground",
668
- children: [i(r), !t.noLimit && t.limit != null && /* @__PURE__ */ A("span", {
693
+ children: [i(e.totalUsed), !e.noLimit && e.totalLimit != null && /* @__PURE__ */ j("span", {
669
694
  className: "text-muted-foreground",
670
695
  children: [
671
696
  " ",
672
697
  "/ ",
673
- i(t.limit)
698
+ i(e.totalLimit)
674
699
  ]
675
700
  })]
676
- }), !t.noLimit && /* @__PURE__ */ k(N, {
677
- percentage: o,
678
- status: s
701
+ }), !e.noLimit && /* @__PURE__ */ A(P, {
702
+ percentage: e.usagePercentage,
703
+ status: e.status
679
704
  })]
680
705
  })
681
706
  }),
682
- /* @__PURE__ */ k("td", {
707
+ /* @__PURE__ */ A("td", {
683
708
  className: "px-4 py-3 hidden sm:table-cell text-foreground",
684
- children: t.noLimit ? /* @__PURE__ */ k("span", {
709
+ children: e.noLimit ? /* @__PURE__ */ A("span", {
685
710
  className: "text-muted-foreground",
686
711
  children: "Unlimited"
687
- }) : i(a ?? 0)
712
+ }) : i(e.totalRemaining ?? 0)
688
713
  }),
689
- /* @__PURE__ */ k("td", {
714
+ /* @__PURE__ */ A("td", {
690
715
  className: "px-4 py-3",
691
- children: /* @__PURE__ */ k(M, { status: s })
716
+ children: /* @__PURE__ */ A(N, { status: e.status })
692
717
  })
693
718
  ]
694
- }, t.id);
719
+ }, e.quotaName), t && e.items.map((e) => {
720
+ let t = L(e.usagePercentage, e.assignment.noLimit);
721
+ return /* @__PURE__ */ j("tr", {
722
+ className: "bg-muted/10 border-t border-dashed border-border/40",
723
+ children: [
724
+ /* @__PURE__ */ A("td", {
725
+ className: "pl-12 pr-4 py-2.5",
726
+ children: /* @__PURE__ */ j("div", {
727
+ className: "text-xs text-muted-foreground space-y-0.5",
728
+ children: [/* @__PURE__ */ A("div", {
729
+ className: "font-mono truncate max-w-[200px]",
730
+ title: e.assignment.subscriptionId ?? void 0,
731
+ children: e.assignment.subscriptionId ?? "—"
732
+ }), /* @__PURE__ */ j("div", {
733
+ className: "flex items-center gap-1.5 flex-wrap",
734
+ children: [/* @__PURE__ */ A("span", {
735
+ className: "bg-muted px-1.5 py-0.5 rounded",
736
+ children: e.assignment.productId
737
+ }), /* @__PURE__ */ A("span", {
738
+ className: "capitalize",
739
+ children: e.assignment.quotaMode
740
+ })]
741
+ })]
742
+ })
743
+ }),
744
+ /* @__PURE__ */ A("td", { className: "px-4 py-2.5 hidden sm:table-cell" }),
745
+ /* @__PURE__ */ j("td", {
746
+ className: "px-4 py-2.5 text-xs text-muted-foreground",
747
+ children: [i(e.effectiveUsed), !e.assignment.noLimit && e.assignment.limit != null && /* @__PURE__ */ j(k, { children: [" / ", i(e.assignment.limit)] })]
748
+ }),
749
+ /* @__PURE__ */ A("td", {
750
+ className: "px-4 py-2.5 hidden sm:table-cell text-xs text-muted-foreground",
751
+ children: e.assignment.noLimit ? "Unlimited" : i(e.remaining ?? 0)
752
+ }),
753
+ /* @__PURE__ */ A("td", {
754
+ className: "px-4 py-2.5",
755
+ children: /* @__PURE__ */ A(N, { status: t })
756
+ })
757
+ ]
758
+ }, e.assignment.id);
759
+ })] });
695
760
  })
696
761
  })]
697
762
  })
698
763
  }),
699
- /* @__PURE__ */ A("p", {
764
+ /* @__PURE__ */ j("p", {
700
765
  className: "text-xs text-muted-foreground",
701
- children: [
702
- "Workspace quotas are sourced from the activity service.",
703
- " ",
704
- n.some((e) => e.liveStatus) && "Live values are updated every ~60 seconds."
705
- ]
766
+ children: ["Workspace quotas are sourced from the activity service. Usage is tracked cumulatively across all active sources for each quota.", r.some((e) => e.liveStatus) && " Live values are updated every ~60 seconds."]
706
767
  })
707
768
  ]
708
769
  });
709
- }, se = () => {
710
- let { t: n } = ne(), r = (e, t) => {
770
+ }, R = () => {
771
+ let { t: n } = te(), r = (e, t) => {
711
772
  let r = n(e);
712
773
  return r === e ? t : r;
713
- }, i = o(), [a, l] = m(() => {
774
+ }, i = o(), [a, l] = h(() => {
714
775
  if (!(typeof window > "u")) return new URLSearchParams(window.location.search).get("billingAccountId") || void 0;
715
- }), [u, d] = m(null), [y, b] = m(""), [S, j] = m("all"), [M, N] = m("active"), F = f(y), { billingAccounts: L, isLoading: se } = s(), ce = (L.find((e) => e.isDefault) ?? L[0])?.id, R = a ?? ce, { workspaceId: z, navigate: le } = e(), [B, ue] = m("workspace"), { dashboard: V, pooledQuotas: H, activeSubscriptions: U, pastSubscriptions: W, isLoading: de, isPastSubscriptionsLoading: G, error: fe, refetch: pe, loadMorePastSubscriptions: me, hasMorePastSubscriptions: he, isLoadingMorePast: ge, pastSubscriptionsCount: K } = c({
716
- billingAccountId: R,
717
- workspaceId: z,
718
- searchQuery: F || void 0,
719
- viewMode: M
720
- }), q = ee((e) => S === "all" ? !0 : S === "healthy" ? e.status === "HEALTHY" : S === "warning" ? e.status === "WARNING" : S === "critical" ? e.status === "CRITICAL" || e.status === "EXHAUSTED" : !0, [S]), J = p(() => H.filter(q), [H, q]), Y = p(() => S === "all" ? U : U.map((e) => ({
776
+ }), [u, d] = h(null), [b, x] = h(""), [C, M] = h("all"), [N, P] = h("active"), I = p(b), { billingAccounts: L, isLoading: R } = s(), se = (L.find((e) => e.isDefault) ?? L[0])?.id, z = a ?? se, { workspaceId: B, navigate: ce } = e(), [V, le] = h("workspace"), { dashboard: H, pooledQuotas: U, activeSubscriptions: W, pastSubscriptions: G, isLoading: ue, isPastSubscriptionsLoading: K, error: de, refetch: fe, loadMorePastSubscriptions: pe, hasMorePastSubscriptions: me, isLoadingMorePast: he, pastSubscriptionsCount: ge } = c({
777
+ billingAccountId: z,
778
+ workspaceId: B,
779
+ searchQuery: I || void 0,
780
+ viewMode: N
781
+ }), q = f((e) => C === "all" ? !0 : C === "healthy" ? e.status === "HEALTHY" : C === "warning" ? e.status === "WARNING" : C === "critical" ? e.status === "CRITICAL" || e.status === "EXHAUSTED" : !0, [C]), J = m(() => U.filter(q), [U, q]), Y = m(() => C === "all" ? W : W.map((e) => ({
721
782
  ...e,
722
783
  aggregatedQuotas: e.aggregatedQuotas.filter(q)
723
784
  })).filter((e) => e.aggregatedQuotas.length > 0), [
724
- U,
725
- S,
785
+ W,
786
+ C,
726
787
  q
727
- ]), X = p(() => S === "all" ? W : W.map((e) => ({
788
+ ]), X = m(() => C === "all" ? G : G.map((e) => ({
728
789
  ...e,
729
790
  aggregatedQuotas: e.aggregatedQuotas.filter(q)
730
791
  })).filter((e) => e.aggregatedQuotas.length > 0), [
731
- W,
732
- S,
792
+ G,
793
+ C,
733
794
  q
734
- ]), Z = p(() => M === "active" ? {
795
+ ]), Z = m(() => N === "active" ? {
735
796
  active: Y,
736
797
  past: []
737
- } : M === "past" ? {
798
+ } : N === "past" ? {
738
799
  active: [],
739
800
  past: X
740
801
  } : {
741
802
  active: Y,
742
803
  past: X
743
804
  }, [
744
- M,
805
+ N,
745
806
  Y,
746
807
  X
747
- ]), Q = y !== "" || S !== "all", _e = F !== y, ve = () => {
748
- b(""), j("all");
808
+ ]), Q = b !== "" || C !== "all", _e = I !== b, ve = () => {
809
+ x(""), M("all");
749
810
  }, $ = (e) => {
750
- j((t) => t === e ? "all" : e);
811
+ M((t) => t === e ? "all" : e);
751
812
  };
752
- if (!i.canViewUsage) return /* @__PURE__ */ k("div", {
813
+ if (!i.canViewUsage) return /* @__PURE__ */ A("div", {
753
814
  className: "flex items-center justify-center h-full min-h-[400px]",
754
- children: /* @__PURE__ */ A("div", {
815
+ children: /* @__PURE__ */ j("div", {
755
816
  className: "text-center space-y-2",
756
817
  children: [
757
- /* @__PURE__ */ k("div", {
818
+ /* @__PURE__ */ A("div", {
758
819
  className: "size-12 mx-auto rounded-full bg-muted flex items-center justify-center",
759
- children: /* @__PURE__ */ k(g, { className: "size-6 text-muted-foreground" })
820
+ children: /* @__PURE__ */ A(_, { className: "size-6 text-muted-foreground" })
760
821
  }),
761
- /* @__PURE__ */ k("h2", {
822
+ /* @__PURE__ */ A("h2", {
762
823
  className: "text-lg font-semibold text-foreground",
763
824
  children: "Access Denied"
764
825
  }),
765
- /* @__PURE__ */ k("p", {
826
+ /* @__PURE__ */ A("p", {
766
827
  className: "text-sm text-muted-foreground max-w-sm",
767
828
  children: "You don't have permission to view usage data."
768
829
  })
769
830
  ]
770
831
  })
771
832
  });
772
- if ((se || de) && !V) return /* @__PURE__ */ A("div", {
833
+ if ((R || ue) && !H) return /* @__PURE__ */ j("div", {
773
834
  className: "space-y-6 p-6",
774
835
  children: [
775
- /* @__PURE__ */ k("div", { className: "h-8 w-48 bg-muted animate-pulse rounded" }),
776
- /* @__PURE__ */ k("div", {
836
+ /* @__PURE__ */ A("div", { className: "h-8 w-48 bg-muted animate-pulse rounded" }),
837
+ /* @__PURE__ */ A("div", {
777
838
  className: "grid grid-cols-2 sm:grid-cols-4 gap-4",
778
839
  children: [
779
840
  1,
780
841
  2,
781
842
  3,
782
843
  4
783
- ].map((e) => /* @__PURE__ */ k("div", { className: "h-24 bg-muted animate-pulse rounded-lg" }, e))
844
+ ].map((e) => /* @__PURE__ */ A("div", { className: "h-24 bg-muted animate-pulse rounded-lg" }, e))
784
845
  }),
785
- /* @__PURE__ */ k("div", { className: "h-64 bg-muted animate-pulse rounded-lg" })
846
+ /* @__PURE__ */ A("div", { className: "h-64 bg-muted animate-pulse rounded-lg" })
786
847
  ]
787
848
  });
788
- if (fe) return /* @__PURE__ */ k("div", {
849
+ if (de) return /* @__PURE__ */ A("div", {
789
850
  className: "flex items-center justify-center h-full min-h-[400px]",
790
- children: /* @__PURE__ */ A("div", {
851
+ children: /* @__PURE__ */ j("div", {
791
852
  className: "text-center space-y-4",
792
853
  children: [
793
- /* @__PURE__ */ k("div", {
854
+ /* @__PURE__ */ A("div", {
794
855
  className: "size-12 mx-auto rounded-full bg-destructive/10 flex items-center justify-center",
795
- children: /* @__PURE__ */ k(g, { className: "size-6 text-destructive" })
856
+ children: /* @__PURE__ */ A(_, { className: "size-6 text-destructive" })
796
857
  }),
797
- /* @__PURE__ */ k("h2", {
858
+ /* @__PURE__ */ A("h2", {
798
859
  className: "text-lg font-semibold text-foreground",
799
860
  children: "Failed to load usage data"
800
861
  }),
801
- /* @__PURE__ */ k("p", {
862
+ /* @__PURE__ */ A("p", {
802
863
  className: "text-sm text-muted-foreground",
803
- children: fe.message
864
+ children: de.message
804
865
  }),
805
- /* @__PURE__ */ k("button", {
866
+ /* @__PURE__ */ A("button", {
806
867
  type: "button",
807
- onClick: () => pe(),
868
+ onClick: () => fe(),
808
869
  className: "px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",
809
870
  children: "Try Again"
810
871
  })
811
872
  ]
812
873
  })
813
874
  });
814
- let ye = L.find((e) => e.id === R);
815
- return /* @__PURE__ */ A("div", {
875
+ let ye = L.find((e) => e.id === z);
876
+ return /* @__PURE__ */ j("div", {
816
877
  className: "space-y-6 p-6",
817
878
  children: [
818
- /* @__PURE__ */ A("div", {
879
+ /* @__PURE__ */ j("div", {
819
880
  className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
820
- children: [/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("h1", {
881
+ children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("h1", {
821
882
  className: "text-2xl font-bold text-foreground",
822
883
  children: r("billing.usage.title", "Usage")
823
- }), /* @__PURE__ */ k("p", {
884
+ }), /* @__PURE__ */ A("p", {
824
885
  className: "text-sm text-muted-foreground mt-1",
825
886
  children: "Monitor your resource consumption and quota usage"
826
- })] }), /* @__PURE__ */ A("div", {
887
+ })] }), /* @__PURE__ */ j("div", {
827
888
  className: "flex items-center gap-3",
828
889
  children: [
829
- /* @__PURE__ */ A("div", {
890
+ /* @__PURE__ */ j("div", {
830
891
  className: "flex items-center bg-muted/50 rounded-lg p-1 border border-border",
831
- children: [/* @__PURE__ */ A("button", {
892
+ children: [/* @__PURE__ */ j("button", {
832
893
  type: "button",
833
- onClick: () => ue("workspace"),
834
- className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${B === "workspace" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"}`,
835
- children: [/* @__PURE__ */ k(C, { className: "size-3.5" }), "Workspace"]
836
- }), /* @__PURE__ */ A("button", {
894
+ onClick: () => le("workspace"),
895
+ className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${V === "workspace" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"}`,
896
+ children: [/* @__PURE__ */ A(w, { className: "size-3.5" }), "Workspace"]
897
+ }), /* @__PURE__ */ j("button", {
837
898
  type: "button",
838
- onClick: () => ue("global"),
839
- className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${B === "global" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"}`,
840
- children: [/* @__PURE__ */ k(w, { className: "size-3.5" }), "Global"]
899
+ onClick: () => le("global"),
900
+ className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${V === "global" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"}`,
901
+ children: [/* @__PURE__ */ A(T, { className: "size-3.5" }), "Global"]
841
902
  })]
842
903
  }),
843
- B === "global" && L.length > 1 && /* @__PURE__ */ k("select", {
844
- value: R || "",
904
+ V === "global" && L.length > 1 && /* @__PURE__ */ A("select", {
905
+ value: z || "",
845
906
  onChange: (e) => l(e.target.value),
846
907
  className: "px-3 py-2 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary w-full sm:min-w-[200px]",
847
- children: L.map((e) => /* @__PURE__ */ k("option", {
908
+ children: L.map((e) => /* @__PURE__ */ A("option", {
848
909
  value: e.id,
849
910
  children: e.name
850
911
  }, e.id))
851
912
  }),
852
- /* @__PURE__ */ k("button", {
913
+ /* @__PURE__ */ A("button", {
853
914
  type: "button",
854
- onClick: () => B === "workspace" ? void 0 : pe(),
915
+ onClick: () => V === "workspace" ? void 0 : fe(),
855
916
  className: "p-2 border border-border rounded-md hover:bg-muted/50 transition-colors",
856
917
  title: "Refresh",
857
- children: /* @__PURE__ */ k(T, { className: "size-4" })
918
+ children: /* @__PURE__ */ A(E, { className: "size-4" })
858
919
  })
859
920
  ]
860
921
  })]
861
922
  }),
862
- B === "workspace" && z && /* @__PURE__ */ k(oe, { workspaceId: z }),
863
- B === "workspace" && !z && /* @__PURE__ */ k("div", {
923
+ V === "workspace" && B && /* @__PURE__ */ A(oe, { workspaceId: B }),
924
+ V === "workspace" && !B && /* @__PURE__ */ A("div", {
864
925
  className: "text-center py-12 text-muted-foreground text-sm",
865
926
  children: "No workspace context available."
866
927
  }),
867
- B === "global" && /* @__PURE__ */ A(O, { children: [
868
- /* @__PURE__ */ A("div", {
928
+ V === "global" && /* @__PURE__ */ j(k, { children: [
929
+ /* @__PURE__ */ j("div", {
869
930
  className: "flex flex-col gap-3 sm:flex-row sm:items-center",
870
931
  children: [
871
- /* @__PURE__ */ A("div", {
932
+ /* @__PURE__ */ j("div", {
872
933
  className: "relative flex-1 max-w-md",
873
934
  children: [
874
- /* @__PURE__ */ k(te, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
875
- /* @__PURE__ */ k("input", {
935
+ /* @__PURE__ */ A(ee, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
936
+ /* @__PURE__ */ A("input", {
876
937
  type: "text",
877
- value: y,
878
- onChange: (e) => b(e.target.value),
879
- placeholder: `Search ${M === "past" ? "past" : M === "all" ? "all" : "active"} quotas...`,
938
+ value: b,
939
+ onChange: (e) => x(e.target.value),
940
+ placeholder: `Search ${N === "past" ? "past" : N === "all" ? "all" : "active"} quotas...`,
880
941
  className: "w-full pl-9 pr-3 py-2 text-sm border border-border rounded-md bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary"
881
942
  }),
882
- (y || _e) && /* @__PURE__ */ k("button", {
943
+ (b || _e) && /* @__PURE__ */ A("button", {
883
944
  type: "button",
884
- onClick: () => b(""),
945
+ onClick: () => x(""),
885
946
  className: "absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted/50",
886
- children: _e ? /* @__PURE__ */ k(T, { className: "size-3 text-muted-foreground animate-spin" }) : /* @__PURE__ */ k(E, { className: "size-3 text-muted-foreground" })
947
+ children: _e ? /* @__PURE__ */ A(E, { className: "size-3 text-muted-foreground animate-spin" }) : /* @__PURE__ */ A(D, { className: "size-3 text-muted-foreground" })
887
948
  })
888
949
  ]
889
950
  }),
890
- /* @__PURE__ */ A("div", {
951
+ /* @__PURE__ */ j("div", {
891
952
  className: "flex items-center bg-muted/50 rounded-lg p-1 border border-border",
892
- children: [/* @__PURE__ */ A("button", {
953
+ children: [/* @__PURE__ */ j("button", {
893
954
  type: "button",
894
- onClick: () => N("active"),
895
- className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${M === "active" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"}`,
896
- children: [/* @__PURE__ */ k(w, { className: "size-3.5" }), "Active"]
897
- }), /* @__PURE__ */ A("button", {
955
+ onClick: () => P("active"),
956
+ className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${N === "active" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"}`,
957
+ children: [/* @__PURE__ */ A(T, { className: "size-3.5" }), "Active"]
958
+ }), /* @__PURE__ */ j("button", {
898
959
  type: "button",
899
- onClick: () => N("past"),
900
- disabled: G && M !== "past",
901
- className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${M === "past" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"} ${G && M !== "past" ? "opacity-70" : ""}`,
902
- children: [G && M === "past" ? /* @__PURE__ */ k(T, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ k(x, { className: "size-3.5" }), "Past"]
960
+ onClick: () => P("past"),
961
+ disabled: K && N !== "past",
962
+ className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${N === "past" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"} ${K && N !== "past" ? "opacity-70" : ""}`,
963
+ children: [K && N === "past" ? /* @__PURE__ */ A(E, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ A(S, { className: "size-3.5" }), "Past"]
903
964
  })]
904
965
  }),
905
- Q && /* @__PURE__ */ A("button", {
966
+ Q && /* @__PURE__ */ j("button", {
906
967
  type: "button",
907
968
  onClick: ve,
908
969
  className: "flex items-center gap-1.5 px-3 py-1.5 text-sm text-muted-foreground hover:text-foreground border border-border rounded-md hover:bg-muted/50 transition-colors",
909
- children: [/* @__PURE__ */ k(E, { className: "size-3" }), "Clear filters"]
970
+ children: [/* @__PURE__ */ A(D, { className: "size-3" }), "Clear filters"]
910
971
  })
911
972
  ]
912
973
  }),
913
- ye && /* @__PURE__ */ A("div", {
974
+ ye && /* @__PURE__ */ j("div", {
914
975
  className: "text-sm text-muted-foreground",
915
976
  children: [
916
977
  "Viewing usage for",
917
978
  " ",
918
- /* @__PURE__ */ k("span", {
979
+ /* @__PURE__ */ A("span", {
919
980
  className: "font-medium text-foreground",
920
981
  children: ye.name
921
982
  })
922
983
  ]
923
984
  }),
924
- V && /* @__PURE__ */ A("div", {
985
+ H && /* @__PURE__ */ j("div", {
925
986
  className: "grid grid-cols-2 sm:grid-cols-4 gap-4",
926
987
  children: [
927
- /* @__PURE__ */ k(P, {
988
+ /* @__PURE__ */ A(F, {
928
989
  label: "Total Quotas",
929
- value: V.totalQuotas,
930
- icon: /* @__PURE__ */ k(C, { className: "size-5" }),
990
+ value: H.totalQuotas,
991
+ icon: /* @__PURE__ */ A(w, { className: "size-5" }),
931
992
  color: "blue",
932
- isActive: S === "all",
933
- onClick: () => j("all")
993
+ isActive: C === "all",
994
+ onClick: () => M("all")
934
995
  }),
935
- /* @__PURE__ */ k(P, {
996
+ /* @__PURE__ */ A(F, {
936
997
  label: "Healthy",
937
- value: V.healthyQuotas,
938
- icon: /* @__PURE__ */ k(_, { className: "size-5" }),
998
+ value: H.healthyQuotas,
999
+ icon: /* @__PURE__ */ A(v, { className: "size-5" }),
939
1000
  color: "emerald",
940
- isActive: S === "healthy",
1001
+ isActive: C === "healthy",
941
1002
  onClick: () => $("healthy")
942
1003
  }),
943
- /* @__PURE__ */ k(P, {
1004
+ /* @__PURE__ */ A(F, {
944
1005
  label: "Warning",
945
- value: V.warningQuotas,
946
- icon: /* @__PURE__ */ k(h, { className: "size-5" }),
1006
+ value: H.warningQuotas,
1007
+ icon: /* @__PURE__ */ A(g, { className: "size-5" }),
947
1008
  color: "amber",
948
- isActive: S === "warning",
1009
+ isActive: C === "warning",
949
1010
  onClick: () => $("warning")
950
1011
  }),
951
- /* @__PURE__ */ k(P, {
1012
+ /* @__PURE__ */ A(F, {
952
1013
  label: "Critical / Exhausted",
953
- value: V.criticalQuotas + V.exhaustedQuotas,
954
- icon: /* @__PURE__ */ k(g, { className: "size-5" }),
1014
+ value: H.criticalQuotas + H.exhaustedQuotas,
1015
+ icon: /* @__PURE__ */ A(_, { className: "size-5" }),
955
1016
  color: "red",
956
- isActive: S === "critical",
1017
+ isActive: C === "critical",
957
1018
  onClick: () => $("critical")
958
1019
  })
959
1020
  ]
960
1021
  }),
961
- V && (V.warningQuotas > 0 || V.criticalQuotas > 0 || V.exhaustedQuotas > 0) && /* @__PURE__ */ A("div", {
962
- className: `flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between p-4 rounded-lg border ${V.criticalQuotas > 0 || V.exhaustedQuotas > 0 ? `${t.error.bg} ${t.error.border}` : `${t.warning.bg} ${t.warning.border}`}`,
963
- children: [/* @__PURE__ */ A("div", {
1022
+ H && (H.warningQuotas > 0 || H.criticalQuotas > 0 || H.exhaustedQuotas > 0) && /* @__PURE__ */ j("div", {
1023
+ className: `flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between p-4 rounded-lg border ${H.criticalQuotas > 0 || H.exhaustedQuotas > 0 ? `${t.error.bg} ${t.error.border}` : `${t.warning.bg} ${t.warning.border}`}`,
1024
+ children: [/* @__PURE__ */ j("div", {
964
1025
  className: "flex items-center gap-3",
965
- children: [V.criticalQuotas > 0 || V.exhaustedQuotas > 0 ? /* @__PURE__ */ k(D, { className: `size-5 shrink-0 ${t.error.icon}` }) : /* @__PURE__ */ k(h, { className: `size-5 shrink-0 ${t.warning.icon}` }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("p", {
966
- className: `text-sm font-medium ${V.criticalQuotas > 0 || V.exhaustedQuotas > 0 ? t.error.text : t.warning.text}`,
967
- children: V.criticalQuotas > 0 || V.exhaustedQuotas > 0 ? `${V.criticalQuotas + V.exhaustedQuotas} quota${V.criticalQuotas + V.exhaustedQuotas === 1 ? "" : "s"} exhausted or critical` : `${V.warningQuotas} quota${V.warningQuotas === 1 ? "" : "s"} approaching the limit`
968
- }), /* @__PURE__ */ k("p", {
1026
+ children: [H.criticalQuotas > 0 || H.exhaustedQuotas > 0 ? /* @__PURE__ */ A(O, { className: `size-5 shrink-0 ${t.error.icon}` }) : /* @__PURE__ */ A(g, { className: `size-5 shrink-0 ${t.warning.icon}` }), /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("p", {
1027
+ className: `text-sm font-medium ${H.criticalQuotas > 0 || H.exhaustedQuotas > 0 ? t.error.text : t.warning.text}`,
1028
+ children: H.criticalQuotas > 0 || H.exhaustedQuotas > 0 ? `${H.criticalQuotas + H.exhaustedQuotas} quota${H.criticalQuotas + H.exhaustedQuotas === 1 ? "" : "s"} exhausted or critical` : `${H.warningQuotas} quota${H.warningQuotas === 1 ? "" : "s"} approaching the limit`
1029
+ }), /* @__PURE__ */ A("p", {
969
1030
  className: "text-xs text-muted-foreground mt-0.5",
970
1031
  children: "Contact support to request a quota increase for your plan."
971
1032
  })] })]
972
- }), /* @__PURE__ */ k("button", {
1033
+ }), /* @__PURE__ */ A("button", {
973
1034
  type: "button",
974
- onClick: () => le("/support/tickets"),
975
- className: `shrink-0 px-4 py-2 text-sm font-medium rounded-md border transition-colors ${V.criticalQuotas > 0 || V.exhaustedQuotas > 0 ? "bg-destructive text-destructive-foreground border-destructive hover:bg-destructive/90" : "border-status-warning-border text-status-warning-text hover:bg-status-warning-bg-subtle"}`,
1035
+ onClick: () => ce("/support/tickets"),
1036
+ className: `shrink-0 px-4 py-2 text-sm font-medium rounded-md border transition-colors ${H.criticalQuotas > 0 || H.exhaustedQuotas > 0 ? "bg-destructive text-destructive-foreground border-destructive hover:bg-destructive/90" : "border-status-warning-border text-status-warning-text hover:bg-status-warning-bg-subtle"}`,
976
1037
  children: "Request more quota"
977
1038
  })]
978
1039
  }),
979
- (Q || M !== "active") && /* @__PURE__ */ A("div", {
1040
+ (Q || N !== "active") && /* @__PURE__ */ j("div", {
980
1041
  className: "flex items-center gap-2 text-sm text-muted-foreground flex-wrap",
981
1042
  children: [
982
- /* @__PURE__ */ A("span", { children: [
1043
+ /* @__PURE__ */ j("span", { children: [
983
1044
  "Showing",
984
1045
  " ",
985
- Z.active.reduce((e, t) => e + t.aggregatedQuotas.length, 0) + Z.past.reduce((e, t) => e + t.aggregatedQuotas.length, 0) + (M === "past" ? 0 : J.length),
1046
+ Z.active.reduce((e, t) => e + t.aggregatedQuotas.length, 0) + Z.past.reduce((e, t) => e + t.aggregatedQuotas.length, 0) + (N === "past" ? 0 : J.length),
986
1047
  " ",
987
1048
  "quotas"
988
1049
  ] }),
989
- /* @__PURE__ */ A("span", {
1050
+ /* @__PURE__ */ j("span", {
990
1051
  className: "px-2 py-0.5 bg-primary/10 text-primary rounded text-xs capitalize",
991
1052
  children: [
992
- M === "active" ? "Active" : M === "past" ? "Past" : "All",
1053
+ N === "active" ? "Active" : N === "past" ? "Past" : "All",
993
1054
  " ",
994
1055
  "subscriptions"
995
1056
  ]
996
1057
  }),
997
- S !== "all" && /* @__PURE__ */ k("span", {
1058
+ C !== "all" && /* @__PURE__ */ A("span", {
998
1059
  className: "px-2 py-0.5 bg-muted rounded text-xs capitalize",
999
- children: S === "critical" ? "Critical / Exhausted" : S
1060
+ children: C === "critical" ? "Critical / Exhausted" : C
1000
1061
  }),
1001
- y && /* @__PURE__ */ A("span", {
1062
+ b && /* @__PURE__ */ j("span", {
1002
1063
  className: "px-2 py-0.5 bg-muted rounded text-xs",
1003
1064
  children: [
1004
1065
  "“",
1005
- y,
1066
+ b,
1006
1067
  "”"
1007
1068
  ]
1008
1069
  })
1009
1070
  ]
1010
1071
  }),
1011
- Z.active.length > 0 && /* @__PURE__ */ A("section", { children: [/* @__PURE__ */ A("h2", {
1072
+ Z.active.length > 0 && /* @__PURE__ */ j("section", { children: [/* @__PURE__ */ j("h2", {
1012
1073
  className: "text-lg font-semibold text-foreground mb-4 flex items-center gap-2",
1013
- children: [/* @__PURE__ */ k(w, { className: "size-5 text-primary" }), M === "all" ? "Active Subscription Quotas" : "Subscription Quotas"]
1014
- }), /* @__PURE__ */ k("div", {
1074
+ children: [/* @__PURE__ */ A(T, { className: "size-5 text-primary" }), N === "all" ? "Active Subscription Quotas" : "Subscription Quotas"]
1075
+ }), /* @__PURE__ */ A("div", {
1015
1076
  className: "space-y-4",
1016
- children: Z.active.map((e) => /* @__PURE__ */ k(I, {
1077
+ children: Z.active.map((e) => /* @__PURE__ */ A(ie, {
1017
1078
  subscription: e,
1018
1079
  onQuotaClick: d,
1019
1080
  defaultExpanded: !0
1020
1081
  }, e.id))
1021
1082
  })] }),
1022
- Z.past.length > 0 && /* @__PURE__ */ A("section", { children: [/* @__PURE__ */ A("h2", {
1083
+ Z.past.length > 0 && /* @__PURE__ */ j("section", { children: [/* @__PURE__ */ j("h2", {
1023
1084
  className: "text-lg font-semibold text-foreground mb-4 flex items-center gap-2",
1024
1085
  children: [
1025
- /* @__PURE__ */ k(x, { className: "size-5 text-muted-foreground" }),
1086
+ /* @__PURE__ */ A(S, { className: "size-5 text-muted-foreground" }),
1026
1087
  "Past Subscription Quotas",
1027
- /* @__PURE__ */ k("span", {
1088
+ /* @__PURE__ */ A("span", {
1028
1089
  className: "text-xs font-normal text-muted-foreground",
1029
1090
  children: "(Canceled / Expired / Upgraded)"
1030
1091
  }),
1031
- K > 0 && /* @__PURE__ */ A("span", {
1092
+ ge > 0 && /* @__PURE__ */ j("span", {
1032
1093
  className: "text-xs font-normal px-2 py-0.5 bg-muted rounded-full",
1033
1094
  children: [
1034
1095
  Z.past.length,
1035
- he ? "+" : "",
1096
+ me ? "+" : "",
1036
1097
  " of ",
1037
- K
1098
+ ge
1038
1099
  ]
1039
1100
  })
1040
1101
  ]
1041
- }), /* @__PURE__ */ A("div", {
1102
+ }), /* @__PURE__ */ j("div", {
1042
1103
  className: "space-y-4",
1043
- children: [Z.past.map((e) => /* @__PURE__ */ k(I, {
1104
+ children: [Z.past.map((e) => /* @__PURE__ */ A(ie, {
1044
1105
  subscription: e,
1045
1106
  onQuotaClick: d,
1046
- defaultExpanded: M === "past"
1047
- }, e.id)), he && /* @__PURE__ */ k("div", {
1107
+ defaultExpanded: N === "past"
1108
+ }, e.id)), me && /* @__PURE__ */ A("div", {
1048
1109
  className: "flex justify-center pt-2",
1049
- children: /* @__PURE__ */ k("button", {
1110
+ children: /* @__PURE__ */ A("button", {
1050
1111
  type: "button",
1051
- onClick: me,
1052
- disabled: ge,
1112
+ onClick: pe,
1113
+ disabled: he,
1053
1114
  className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground border border-border rounded-md hover:bg-muted/50 transition-colors disabled:opacity-50",
1054
- children: ge ? /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(T, { className: "size-4 animate-spin" }), "Loading…"] }) : /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(v, { className: "size-4" }), "Load more past subscriptions"] })
1115
+ children: he ? /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(E, { className: "size-4 animate-spin" }), "Loading…"] }) : /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(y, { className: "size-4" }), "Load more past subscriptions"] })
1055
1116
  })
1056
1117
  })]
1057
1118
  })] }),
1058
- M !== "past" && J.length > 0 && /* @__PURE__ */ A("section", { children: [/* @__PURE__ */ A("h2", {
1119
+ N !== "past" && J.length > 0 && /* @__PURE__ */ j("section", { children: [/* @__PURE__ */ j("h2", {
1059
1120
  className: "text-lg font-semibold text-foreground mb-4 flex items-center gap-2",
1060
1121
  children: [
1061
- /* @__PURE__ */ k(C, { className: `size-5 ${t.info.icon}` }),
1122
+ /* @__PURE__ */ A(w, { className: `size-5 ${t.info.icon}` }),
1062
1123
  "Pooled Quotas",
1063
- /* @__PURE__ */ k("span", {
1124
+ /* @__PURE__ */ A("span", {
1064
1125
  className: "text-xs font-normal text-muted-foreground",
1065
1126
  children: "(Shared across all products)"
1066
1127
  })
1067
1128
  ]
1068
- }), /* @__PURE__ */ k(ie, {
1129
+ }), /* @__PURE__ */ A(re, {
1069
1130
  quotas: J,
1070
1131
  showPlanColumn: !1,
1071
1132
  onQuotaClick: d
1072
1133
  })] }),
1073
- M === "active" && U.length === 0 && H.length === 0 && !Q && /* @__PURE__ */ A("div", {
1134
+ N === "active" && W.length === 0 && U.length === 0 && !Q && /* @__PURE__ */ j("div", {
1074
1135
  className: "flex flex-col items-center justify-center py-12 border border-dashed border-border rounded-lg",
1075
1136
  children: [
1076
- /* @__PURE__ */ k("div", {
1137
+ /* @__PURE__ */ A("div", {
1077
1138
  className: "size-12 rounded-full bg-muted flex items-center justify-center mb-4",
1078
- children: /* @__PURE__ */ k(C, { className: "size-6 text-muted-foreground" })
1139
+ children: /* @__PURE__ */ A(w, { className: "size-6 text-muted-foreground" })
1079
1140
  }),
1080
- /* @__PURE__ */ k("h3", {
1141
+ /* @__PURE__ */ A("h3", {
1081
1142
  className: "text-lg font-medium text-foreground",
1082
1143
  children: "No active quotas found"
1083
1144
  }),
1084
- /* @__PURE__ */ k("p", {
1145
+ /* @__PURE__ */ A("p", {
1085
1146
  className: "text-sm text-muted-foreground mt-1 text-center max-w-sm",
1086
1147
  children: "Quotas will appear here once you have active subscriptions or pooled allocations."
1087
1148
  })
1088
1149
  ]
1089
1150
  }),
1090
- M === "past" && W.length === 0 && !Q && !G && /* @__PURE__ */ A("div", {
1151
+ N === "past" && G.length === 0 && !Q && !K && /* @__PURE__ */ j("div", {
1091
1152
  className: "flex flex-col items-center justify-center py-12 border border-dashed border-border rounded-lg",
1092
1153
  children: [
1093
- /* @__PURE__ */ k("div", {
1154
+ /* @__PURE__ */ A("div", {
1094
1155
  className: "size-12 rounded-full bg-muted flex items-center justify-center mb-4",
1095
- children: /* @__PURE__ */ k(x, { className: "size-6 text-muted-foreground" })
1156
+ children: /* @__PURE__ */ A(S, { className: "size-6 text-muted-foreground" })
1096
1157
  }),
1097
- /* @__PURE__ */ k("h3", {
1158
+ /* @__PURE__ */ A("h3", {
1098
1159
  className: "text-lg font-medium text-foreground",
1099
1160
  children: "No past subscriptions"
1100
1161
  }),
1101
- /* @__PURE__ */ k("p", {
1162
+ /* @__PURE__ */ A("p", {
1102
1163
  className: "text-sm text-muted-foreground mt-1 text-center max-w-sm",
1103
1164
  children: "You don't have any canceled, expired, or upgraded subscriptions yet."
1104
1165
  }),
1105
- /* @__PURE__ */ k("button", {
1166
+ /* @__PURE__ */ A("button", {
1106
1167
  type: "button",
1107
- onClick: () => N("active"),
1168
+ onClick: () => P("active"),
1108
1169
  className: "mt-4 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",
1109
1170
  children: "View active subscriptions"
1110
1171
  })
1111
1172
  ]
1112
1173
  }),
1113
- M === "past" && G && /* @__PURE__ */ k("div", {
1174
+ N === "past" && K && /* @__PURE__ */ A("div", {
1114
1175
  className: "space-y-4",
1115
1176
  children: [
1116
1177
  1,
1117
1178
  2,
1118
1179
  3
1119
- ].map((e) => /* @__PURE__ */ k("div", { className: "h-24 bg-muted animate-pulse rounded-lg" }, e))
1180
+ ].map((e) => /* @__PURE__ */ A("div", { className: "h-24 bg-muted animate-pulse rounded-lg" }, e))
1120
1181
  }),
1121
- Q && Z.active.length === 0 && Z.past.length === 0 && (M === "past" || J.length === 0) && /* @__PURE__ */ A("div", {
1182
+ Q && Z.active.length === 0 && Z.past.length === 0 && (N === "past" || J.length === 0) && /* @__PURE__ */ j("div", {
1122
1183
  className: "flex flex-col items-center justify-center py-12 border border-dashed border-border rounded-lg",
1123
1184
  children: [
1124
- /* @__PURE__ */ k("div", {
1185
+ /* @__PURE__ */ A("div", {
1125
1186
  className: "size-12 rounded-full bg-muted flex items-center justify-center mb-4",
1126
- children: S !== "all" && !y ? /* @__PURE__ */ k(re, {
1127
- status: S === "healthy" ? "HEALTHY" : S === "warning" ? "WARNING" : "CRITICAL",
1187
+ children: C !== "all" && !b ? /* @__PURE__ */ A(ne, {
1188
+ status: C === "healthy" ? "HEALTHY" : C === "warning" ? "WARNING" : "CRITICAL",
1128
1189
  className: "size-6"
1129
- }) : /* @__PURE__ */ k(te, { className: "size-6 text-muted-foreground" })
1190
+ }) : /* @__PURE__ */ A(ee, { className: "size-6 text-muted-foreground" })
1130
1191
  }),
1131
- /* @__PURE__ */ k("h3", {
1192
+ /* @__PURE__ */ A("h3", {
1132
1193
  className: "text-lg font-medium text-foreground",
1133
- children: S !== "all" && !y ? `No ${S === "critical" ? "critical or exhausted" : S} quotas` : "No matching quotas"
1194
+ children: C !== "all" && !b ? `No ${C === "critical" ? "critical or exhausted" : C} quotas` : "No matching quotas"
1134
1195
  }),
1135
- /* @__PURE__ */ k("p", {
1196
+ /* @__PURE__ */ A("p", {
1136
1197
  className: "text-sm text-muted-foreground mt-1 text-center max-w-sm",
1137
- children: S !== "all" && !y ? /* @__PURE__ */ A(O, { children: ["All your quotas are in a different status.", V && /* @__PURE__ */ A("span", {
1198
+ children: C !== "all" && !b ? /* @__PURE__ */ j(k, { children: ["All your quotas are in a different status.", H && /* @__PURE__ */ j("span", {
1138
1199
  className: "block mt-1",
1139
1200
  children: [
1140
1201
  "You have ",
1141
- V.healthyQuotas,
1202
+ H.healthyQuotas,
1142
1203
  " healthy, ",
1143
- V.warningQuotas,
1204
+ H.warningQuotas,
1144
1205
  " ",
1145
1206
  "warning, and ",
1146
- V.criticalQuotas + V.exhaustedQuotas,
1207
+ H.criticalQuotas + H.exhaustedQuotas,
1147
1208
  " ",
1148
1209
  "critical quotas."
1149
1210
  ]
1150
- })] }) : /* @__PURE__ */ A(O, { children: [
1211
+ })] }) : /* @__PURE__ */ j(k, { children: [
1151
1212
  "No quotas match your current search or filter criteria in",
1152
1213
  " ",
1153
- M === "past" ? "past" : M === "all" ? "any" : "active",
1214
+ N === "past" ? "past" : N === "all" ? "any" : "active",
1154
1215
  " ",
1155
1216
  "subscriptions.",
1156
- M === "active" && !S.includes("all") && /* @__PURE__ */ k("span", {
1217
+ N === "active" && !C.includes("all") && /* @__PURE__ */ A("span", {
1157
1218
  className: "block mt-1",
1158
1219
  children: "Try switching to “Past” or “All” to search across more subscriptions."
1159
1220
  })
1160
1221
  ] })
1161
1222
  }),
1162
- /* @__PURE__ */ A("div", {
1223
+ /* @__PURE__ */ j("div", {
1163
1224
  className: "flex gap-2 mt-4",
1164
- children: [/* @__PURE__ */ k("button", {
1225
+ children: [/* @__PURE__ */ A("button", {
1165
1226
  type: "button",
1166
1227
  onClick: ve,
1167
1228
  className: "px-4 py-2 text-sm font-medium border border-border rounded-md hover:bg-muted/50 transition-colors",
1168
- children: S === "all" ? "Clear filters" : "Show all quotas"
1169
- }), M === "active" && y && /* @__PURE__ */ k("button", {
1229
+ children: C === "all" ? "Clear filters" : "Show all quotas"
1230
+ }), N === "active" && b && /* @__PURE__ */ A("button", {
1170
1231
  type: "button",
1171
- onClick: () => N("all"),
1232
+ onClick: () => P("all"),
1172
1233
  className: "px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",
1173
1234
  children: "Search all"
1174
1235
  })]
@@ -1176,7 +1237,7 @@ var oe = ({ workspaceId: e }) => {
1176
1237
  ]
1177
1238
  })
1178
1239
  ] }),
1179
- u && /* @__PURE__ */ k(ae, {
1240
+ u && /* @__PURE__ */ A(ae, {
1180
1241
  quota: u,
1181
1242
  onClose: () => d(null)
1182
1243
  })
@@ -1184,6 +1245,6 @@ var oe = ({ workspaceId: e }) => {
1184
1245
  });
1185
1246
  };
1186
1247
  //#endregion
1187
- export { se as UsagePage };
1248
+ export { R as UsagePage };
1188
1249
 
1189
1250
  //# sourceMappingURL=UsagePage.js.map