@nivaro/react 0.3.58 → 0.3.60

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 (43) hide show
  1. package/dist/components/fields/RelationField.js +110 -80
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useRelationOptions.js +1 -0
  4. package/dist/hooks/useSessionRecorder.js +1 -1
  5. package/dist/index.d.ts +32 -1
  6. package/dist/index.js +523 -520
  7. package/dist/shared/components/CollectionBrowserView.js +2083 -2052
  8. package/dist/shared/components/DataTable.js +497 -465
  9. package/dist/shared/components/ItemEditForm.js +4430 -4282
  10. package/dist/shared/components/PageRenderer.js +537 -508
  11. package/dist/shared/components/QueryTable.js +74 -74
  12. package/dist/shared/components/WidgetSlot.js +543 -520
  13. package/dist/shared/components/alerts/AlertManagerView.js +269 -275
  14. package/dist/shared/components/alerts/types.js +37 -14
  15. package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
  16. package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
  17. package/dist/shared/components/item-edit/InlineTableField.js +2461 -2421
  18. package/dist/shared/components/item-edit/M2MCombobox.js +141 -137
  19. package/dist/shared/components/item-edit/PlanGrid.js +876 -820
  20. package/dist/shared/components/item-edit/QuickCreateButton.js +323 -130
  21. package/dist/shared/components/item-edit/RelationCombobox.js +408 -375
  22. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +255 -156
  23. package/dist/shared/components/item-edit/SummaryPanel.js +356 -343
  24. package/dist/shared/components/item-edit/duplicate-rehearsal.js +47 -0
  25. package/dist/shared/components/item-edit/line-midair.js +82 -75
  26. package/dist/shared/components/item-edit/save-outcome.js +6 -4
  27. package/dist/shared/components/panels/ItemLockBanner.js +212 -209
  28. package/dist/shared/components/panels/PipelinePanel.js +775 -737
  29. package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
  30. package/dist/shared/components/panels/RevisionsPanel.js +313 -299
  31. package/dist/shared/components/pipeline/PipelineEditorView.js +26 -16
  32. package/dist/shared/components/queue/QueueQuickFilters.js +13 -13
  33. package/dist/shared/components/queue/QueueWorklist.js +978 -953
  34. package/dist/shared/components/queue/live-state-aspect.js +9 -5
  35. package/dist/shared/components/widgets/ReviewListWidget.js +152 -149
  36. package/dist/shared/lib/display-prefs.js +60 -52
  37. package/dist/shared/lib/draft-store.js +71 -48
  38. package/dist/shared/lib/expression.js +53 -53
  39. package/dist/shared/lib/list-page-memory.js +42 -20
  40. package/dist/shared/lib/money-input.js +45 -0
  41. package/dist/shared/lib/sanitize-html.js +10 -6
  42. package/dist/shared/lib/staged-row-labels.js +18 -0
  43. package/package.json +1 -1
@@ -1,44 +1,45 @@
1
- import { jsx as t, jsxs as l, Fragment as ut } from "react/jsx-runtime";
2
- import { listNotificationSubscriptions as ht, deleteNotificationSubscription as pt } from "@nivaro/sdk";
3
- import { useQueryClient as xt, useQuery as y, useMutation as me } from "@tanstack/react-query";
4
- import { LayoutGrid as $e, Bell as Re, BellRing as ue, Clock as bt, ChartColumn as gt, History as qe, FlaskConical as De, Activity as ft, Plus as he, Gauge as vt, Users as yt, Lock as kt, Pencil as pe, Trash2 as O, Siren as Fe } from "lucide-react";
5
- import { useState as k, useMemo as J } from "react";
6
- import { useNivaroClient as Nt } from "../../context.js";
7
- import { useMyScopes as wt, matchScopeDimension as _t, effectiveScopeSeedIds as At, translateScopeValues as St } from "../../lib/use-my-scopes.js";
1
+ import { jsx as t, jsxs as l, Fragment as mt } from "react/jsx-runtime";
2
+ import { listNotificationSubscriptions as ut, deleteNotificationSubscription as ht } from "@nivaro/sdk";
3
+ import { useQueryClient as pt, useQuery as y, useMutation as oe } from "@tanstack/react-query";
4
+ import { LayoutGrid as Te, Bell as $e, BellRing as ce, Clock as xt, ChartColumn as bt, History as Re, FlaskConical as qe, Activity as gt, Plus as me, Gauge as ft, Users as vt, Lock as yt, Pencil as ue, Trash2 as L, Siren as De } from "lucide-react";
5
+ import { useState as _, useMemo as z } from "react";
6
+ import { toast as Fe } from "sonner";
7
+ import { useNivaroClient as kt } from "../../context.js";
8
+ import { useMyScopes as Nt, matchScopeDimension as wt, effectiveScopeSeedIds as _t, translateScopeValues as At } from "../../lib/use-my-scopes.js";
8
9
  import { cn as i } from "../../lib/utils.js";
9
- import { ToggleSwitch as S, SelectInput as Le, AlertRuleDrawer as Ct, AnomalyRuleDrawer as Et, NotifSubEditDrawer as Tt } from "./drawers.js";
10
- import { OPERATOR_LABELS as ee, fmtMetric as _, fmtDateTime as P } from "./types.js";
11
- function $t(s, d) {
10
+ import { ToggleSwitch as S, SelectInput as Le, AlertRuleDrawer as Ct, AnomalyRuleDrawer as St, NotifSubEditDrawer as Et } from "./drawers.js";
11
+ import { categoryLabel as Tt, OPERATOR_LABELS as be, fmtMetric as A, fmtDateTime as O, reportConditionText as $t } from "./types.js";
12
+ function Rt(s, d) {
12
13
  const n = (d ?? []).find(
13
14
  (m) => {
14
- var E;
15
- return m && (m.field === s || ((E = m.options) == null ? void 0 : E.collection) === s) && m.label;
15
+ var T;
16
+ return m && (m.field === s || ((T = m.options) == null ? void 0 : T.collection) === s) && m.label;
16
17
  }
17
18
  );
18
19
  if (n != null && n.label) return n.label;
19
20
  const h = String(s ?? "").replace(/_/g, " ").trim();
20
21
  return h ? h.charAt(0).toUpperCase() + h.slice(1) : "Filter";
21
22
  }
22
- function Rt(s, d) {
23
- return s != null && s.length ? s.map((n) => `${$t(n.field, d)}: ${(n.labels ?? n.values).join(", ")}`).join(" · ") : "All data";
23
+ function qt(s, d) {
24
+ return s != null && s.length ? s.map((n) => `${Rt(n.field, d)}: ${(n.labels ?? n.values).join(", ")}`).join(" · ") : "All data";
24
25
  }
25
- const qt = {
26
+ const Dt = {
26
27
  budget: "bg-orange-50 text-orange-600 dark:bg-orange-500/10 dark:text-orange-400",
27
28
  workflows: "bg-sky-50 text-sky-600 dark:bg-sky-500/10 dark:text-sky-400",
28
29
  inventory: "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400",
29
30
  sla: "bg-pink-50 text-pink-600 dark:bg-pink-500/10 dark:text-pink-400",
30
31
  compliance: "bg-violet-50 text-violet-600 dark:bg-violet-500/10 dark:text-violet-400",
31
32
  spend: "bg-amber-50 text-amber-600 dark:bg-amber-500/10 dark:text-amber-400"
32
- }, Dt = (s) => i(
33
- "inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold capitalize",
34
- qt[s] ?? "bg-slate-100 text-slate-600 dark:bg-muted dark:text-slate-300"
33
+ }, Ft = (s) => i(
34
+ "inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold",
35
+ Dt[s] ?? "bg-slate-100 text-slate-600 dark:bg-muted dark:text-slate-300"
35
36
  );
36
- function M({ status: s }) {
37
+ function j({ status: s }) {
37
38
  return /* @__PURE__ */ t(
38
39
  "span",
39
40
  {
40
41
  className: i(
41
- "inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold capitalize",
42
+ "inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold",
42
43
  {
43
44
  active: "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400",
44
45
  resolved: "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400",
@@ -53,13 +54,13 @@ function M({ status: s }) {
53
54
  }
54
55
  );
55
56
  }
56
- function X(s) {
57
+ function Y(s) {
57
58
  return s.created_by ?? null;
58
59
  }
59
- function xe({ on: s }) {
60
+ function he({ on: s }) {
60
61
  return /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: s ? "On" : "Off" });
61
62
  }
62
- function F({ n: s, tone: d }) {
63
+ function D({ n: s, tone: d }) {
63
64
  return s ? /* @__PURE__ */ t(
64
65
  "span",
65
66
  {
@@ -76,8 +77,8 @@ function F({ n: s, tone: d }) {
76
77
  }
77
78
  ) : null;
78
79
  }
79
- const Ft = "px-3 py-2 text-left text-[10px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500", r = "px-3 py-2.5 align-middle text-[12px] text-slate-600 dark:text-slate-300", Lt = i(r, "font-mono tabular-nums text-slate-800 dark:text-slate-100"), w = "inline-flex h-7 w-7 items-center justify-center rounded-md border border-slate-200 text-slate-400 transition-colors hover:border-slate-300 hover:bg-slate-50 hover:text-slate-700 dark:border-border dark:hover:bg-muted/50 dark:hover:text-slate-200";
80
- function Z(s) {
80
+ const Lt = "px-3 py-2 text-left text-[10px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500", r = "px-3 py-2.5 align-middle text-[12px] text-slate-600 dark:text-slate-300", jt = i(r, "font-mono tabular-nums text-slate-800 dark:text-slate-100"), w = "inline-flex h-7 w-7 items-center justify-center rounded-md border border-slate-200 text-slate-400 transition-colors hover:border-slate-300 hover:bg-slate-50 hover:text-slate-700 dark:border-border dark:hover:bg-muted/50 dark:hover:text-slate-200";
81
+ function J(s) {
81
82
  const d = Date.now() - new Date(s).getTime();
82
83
  if (!Number.isFinite(d)) return null;
83
84
  const n = Math.floor(d / 6e4);
@@ -97,15 +98,15 @@ function je(s, d) {
97
98
  const m = Math.round(h / 60);
98
99
  return m < 48 ? `${m}h` : `${Math.round(m / 24)}d`;
99
100
  }
100
- function be({ value: s, className: d }) {
101
+ function pe({ value: s, className: d }) {
101
102
  if (!s) return /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" });
102
- const n = Z(s);
103
+ const n = J(s);
103
104
  return /* @__PURE__ */ l("span", { className: i("block leading-tight", d), children: [
104
- /* @__PURE__ */ t("span", { className: "block whitespace-nowrap text-[11.5px] text-slate-600 dark:text-slate-300", children: P(s) }),
105
+ /* @__PURE__ */ t("span", { className: "block whitespace-nowrap text-[11.5px] text-slate-600 dark:text-slate-300", children: O(s) }),
105
106
  n && /* @__PURE__ */ t("span", { className: "block text-[10.5px] text-slate-500 dark:text-slate-400", children: n })
106
107
  ] });
107
108
  }
108
- function jt({
109
+ function Ot({
109
110
  value: s,
110
111
  threshold: d,
111
112
  unit: n,
@@ -120,27 +121,27 @@ function jt({
120
121
  "text-[12.5px] font-semibold",
121
122
  m ? "text-red-600 dark:text-red-400" : "text-slate-800 dark:text-slate-100"
122
123
  ),
123
- children: _(s, n ?? void 0)
124
+ children: A(s, n ?? void 0)
124
125
  }
125
126
  ),
126
127
  /* @__PURE__ */ l("span", { className: "text-[10.5px] text-slate-400 dark:text-slate-500", children: [
127
- h ? `${ee[h] ?? h} ` : "/ ",
128
- _(d, n ?? void 0)
128
+ h ? `${be[h] ?? h} ` : "/ ",
129
+ A(d, n ?? void 0)
129
130
  ] })
130
131
  ] });
131
132
  }
132
- function Ot({
133
+ function Mt({
133
134
  operator: s,
134
135
  threshold: d,
135
136
  unit: n
136
137
  }) {
137
138
  return /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1 rounded-md border border-slate-200 bg-slate-50 px-1.5 py-0.5 font-mono text-[11.5px] tabular-nums text-slate-700 dark:border-border dark:bg-muted/40 dark:text-slate-200", children: [
138
- /* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children: ee[s] ?? s }),
139
- _(d, n ?? void 0)
139
+ /* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children: be[s] ?? s }),
140
+ A(d, n ?? void 0)
140
141
  ] });
141
142
  }
142
- function Mt({ text: s }) {
143
- const [d, n] = k(!1);
143
+ function Pt({ text: s }) {
144
+ const [d, n] = _(!1);
144
145
  if (!s) return /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" });
145
146
  const h = s.length > 120;
146
147
  return /* @__PURE__ */ l("span", { className: "block", children: [
@@ -165,7 +166,7 @@ function Mt({ text: s }) {
165
166
  )
166
167
  ] });
167
168
  }
168
- function ge({
169
+ function xe({
169
170
  title: s,
170
171
  hint: d,
171
172
  action: n,
@@ -194,90 +195,90 @@ function ge({
194
195
  )
195
196
  );
196
197
  }
197
- function C({
198
+ function E({
198
199
  headers: s,
199
200
  children: d,
200
201
  empty: n,
201
202
  emptyHint: h,
202
203
  emptyIcon: m,
203
- emptyAction: E,
204
- loading: A
204
+ emptyAction: T,
205
+ loading: C
205
206
  }) {
206
- const g = !A && (!d || Array.isArray(d) && d.length === 0);
207
+ const g = !C && (!d || Array.isArray(d) && d.length === 0);
207
208
  return /* @__PURE__ */ t("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */ l("table", { className: "w-full border-collapse", children: [
208
- /* @__PURE__ */ t("thead", { className: "border-b border-slate-200 bg-slate-50/80 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t("tr", { children: s.map((f, T) => {
209
- const L = typeof f == "string" ? f : f.label, p = typeof f == "string" ? void 0 : f.width, o = typeof f == "string" ? void 0 : f.align;
209
+ /* @__PURE__ */ t("thead", { className: "border-b border-slate-200 bg-slate-50/80 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t("tr", { children: s.map((f, p) => {
210
+ const o = typeof f == "string" ? f : f.label, k = typeof f == "string" ? void 0 : f.width, X = typeof f == "string" ? void 0 : f.align;
210
211
  return /* @__PURE__ */ t(
211
212
  "th",
212
213
  {
213
- className: i(Ft, o === "right" && "text-right"),
214
- style: p ? { width: p } : void 0,
215
- children: L
214
+ className: i(Lt, X === "right" && "text-right"),
215
+ style: k ? { width: k } : void 0,
216
+ children: o
216
217
  },
217
- `${L}-${T}`
218
+ `${o}-${p}`
218
219
  );
219
220
  }) }) }),
220
- /* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-100 dark:divide-border/50", children: A ? Array.from({ length: 5 }, (f, T) => /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "px-3 py-3", colSpan: s.length, children: /* @__PURE__ */ t(
221
+ /* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-100 dark:divide-border/50", children: C ? Array.from({ length: 5 }, (f, p) => /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "px-3 py-3", colSpan: s.length, children: /* @__PURE__ */ t(
221
222
  "span",
222
223
  {
223
224
  className: "block h-3 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]",
224
- style: { width: `${45 + T * 19 % 45}%` }
225
+ style: { width: `${45 + p * 19 % 45}%` }
225
226
  }
226
- ) }) }, T)) : g ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "px-3 py-14", colSpan: s.length, children: /* @__PURE__ */ l("div", { className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-center", children: [
227
+ ) }) }, p)) : g ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "px-3 py-14", colSpan: s.length, children: /* @__PURE__ */ l("div", { className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-center", children: [
227
228
  m && /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: m }),
228
229
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: n }),
229
230
  h && /* @__PURE__ */ t("p", { className: "text-[12px] leading-relaxed text-slate-400 dark:text-slate-500", children: h }),
230
- E && /* @__PURE__ */ t("div", { className: "mt-1", children: E })
231
+ T && /* @__PURE__ */ t("div", { className: "mt-1", children: T })
231
232
  ] }) }) }) : d })
232
233
  ] }) }) });
233
234
  }
234
- function Yt({
235
+ function Xt({
235
236
  defaultTab: s = "catalog",
236
237
  hiddenTabs: d = [],
237
238
  onOpenReport: n,
238
239
  className: h
239
240
  }) {
240
- const m = Nt(), E = xt(), { scopes: A } = wt(), [g, f] = k(s), [T, L] = k(null), p = (e) => {
241
- L(e), window.setTimeout(() => L(null), 2500);
242
- }, o = (e, a, u) => m.request({ _method: e, _path: a, _body: u }), { data: R } = y({
241
+ const m = kt(), T = pt(), { scopes: C } = Nt(), [g, f] = _(s), p = (e) => {
242
+ /^Failed\b/.test(e) ? Fe.error(e) : Fe.success(e);
243
+ }, o = (e, a, u) => m.request({ _method: e, _path: a, _body: u }), { data: k } = y({
243
244
  queryKey: ["nvr-ma-me"],
244
245
  queryFn: () => o("GET", "/auth/me").then((e) => e.data)
245
- }), Oe = String((R == null ? void 0 : R.id) ?? "").toLowerCase(), Me = !!(R != null && R.is_admin), b = (...e) => {
246
- for (const a of e) E.invalidateQueries({ queryKey: [a] });
247
- }, { data: q = [], isLoading: te } = y({
246
+ }), X = String((k == null ? void 0 : k.id) ?? "").toLowerCase(), Oe = !!(k != null && k.is_admin), b = (...e) => {
247
+ for (const a of e) T.invalidateQueries({ queryKey: [a] });
248
+ }, { data: R = [], isLoading: Z } = y({
248
249
  queryKey: ["nvr-ma-definitions"],
249
250
  queryFn: () => o("GET", "/metric-alerts/definitions").then((e) => e.data)
250
- }), { data: I = [], isLoading: Pe } = y({
251
+ }), { data: M = [], isLoading: Me } = y({
251
252
  queryKey: ["nvr-ma-rules"],
252
253
  queryFn: () => o("GET", "/metric-alerts/rules").then((e) => e.data)
253
- }), { data: G = [], isLoading: Ie } = y({
254
+ }), { data: P = [], isLoading: Pe } = y({
254
255
  queryKey: ["nvr-ma-subs"],
255
256
  queryFn: () => o("GET", "/metric-alerts/subscriptions").then(
256
257
  (e) => e.data
257
258
  )
258
- }), { data: H = [], isLoading: Ge } = y({
259
+ }), { data: I = [], isLoading: Ie } = y({
259
260
  queryKey: ["nvr-ma-log"],
260
261
  queryFn: () => o("GET", "/metric-alerts/log?limit=100").then(
261
262
  (e) => e.data
262
263
  )
263
- }), { data: fe = [], isLoading: He } = y({
264
+ }), { data: ge = [], isLoading: Ge } = y({
264
265
  queryKey: ["nvr-ma-notif-subs"],
265
- queryFn: () => m.request(ht()).then((e) => e.data)
266
- }), K = me({
266
+ queryFn: () => m.request(ut()).then((e) => e.data)
267
+ }), G = oe({
267
268
  // Raw PATCH — the route accepts label/filter_field/filter_value/filters/
268
269
  // digest_frequency/is_active; the typed SDK command covers a subset.
269
270
  mutationFn: ({ id: e, patch: a }) => o("PATCH", `/notification-subscriptions/${e}`, a),
270
271
  onSuccess: () => b("nvr-ma-notif-subs")
271
- }), Ke = me({
272
- mutationFn: (e) => m.request(pt(e)),
272
+ }), He = oe({
273
+ mutationFn: (e) => m.request(ht(e)),
273
274
  onSuccess: () => b("nvr-ma-notif-subs")
274
- }), ve = d.includes("widget_alerts"), { data: ae = [], isLoading: Be } = y({
275
+ }), fe = d.includes("widget_alerts"), { data: ee = [], isLoading: Ke } = y({
275
276
  queryKey: ["nvr-ma-report-alerts"],
276
- enabled: !ve,
277
+ enabled: !fe,
277
278
  queryFn: () => o("GET", "/metric-alerts/report-alerts").then((e) => e.data)
278
- }), ze = ae.some((e) => (e.filters ?? []).length > 0), { data: le } = y({
279
+ }), Be = ee.some((e) => (e.filters ?? []).length > 0), { data: te } = y({
279
280
  queryKey: ["nvr-ma-report-filter-bars"],
280
- enabled: !ve && ze,
281
+ enabled: !fe && Be,
281
282
  staleTime: 3e5,
282
283
  queryFn: () => o("GET", "/report-studio").then(
283
284
  (e) => new Map((e.data ?? []).map((a) => {
@@ -285,7 +286,7 @@ function Yt({
285
286
  return [String(a.id), ((u = a.global_filters) == null ? void 0 : u.filter_bar) ?? []];
286
287
  }))
287
288
  ).catch(() => /* @__PURE__ */ new Map())
288
- }), { data: ye = [], isLoading: We } = y({
289
+ }), { data: ve = [], isLoading: We } = y({
289
290
  queryKey: ["nvr-ma-report-alerts-log"],
290
291
  enabled: !d.includes("widget_alert_history"),
291
292
  queryFn: () => o("GET", "/metric-alerts/report-alerts-log").then(
@@ -296,83 +297,83 @@ function Yt({
296
297
  queryFn: () => o("GET", "/metric-alerts/anomaly-definitions").then(
297
298
  (e) => e.data
298
299
  )
299
- }), { data: ke = [], isLoading: Ve } = y({
300
+ }), { data: ye = [], isLoading: Ve } = y({
300
301
  queryKey: ["nvr-ma-anomaly-rules"],
301
302
  queryFn: () => o("GET", "/metric-alerts/anomaly-rules").then((e) => e.data)
302
- }), { data: B = [], isLoading: Qe } = y({
303
+ }), { data: H = [], isLoading: Qe } = y({
303
304
  queryKey: ["nvr-ma-anomaly-log"],
304
305
  queryFn: () => o("GET", "/metric-alerts/anomaly-log").then((e) => e.data)
305
- }), [Ye, z] = k(!1), [re, Ne] = k(null), [Je, we] = k(null), [Xe, W] = k(!1), [se, U] = k(null), [V, ne] = k(null), [_e, Q] = k(!1), Ae = J(
306
- () => Object.fromEntries(G.map((e) => [e.rule_id, e])),
307
- [G]
308
- ), Ze = J(() => {
306
+ }), [ze, K] = _(!1), [ae, ke] = _(null), [Ye, Ne] = _(null), [Je, B] = _(!1), [le, W] = _(null), [U, re] = _(null), [we, V] = _(!1), _e = z(
307
+ () => Object.fromEntries(P.map((e) => [e.rule_id, e])),
308
+ [P]
309
+ ), Xe = z(() => {
309
310
  const e = {};
310
- for (const a of H)
311
+ for (const a of I)
311
312
  a.status === "firing" && !a.resolved_at && (e[a.rule_id] = a);
312
313
  return e;
313
- }, [H]), Se = J(
314
- () => B.filter((e) => e.status !== "resolved").length,
315
- [B]
316
- ), et = async (e) => {
317
- const a = Ae[e.id];
314
+ }, [I]), Ae = z(
315
+ () => H.filter((e) => e.status !== "resolved").length,
316
+ [H]
317
+ ), Ze = async (e) => {
318
+ const a = _e[e.id];
318
319
  try {
319
320
  a ? (await o("DELETE", `/metric-alerts/subscriptions/${a.id}`), p("Unsubscribed from alert")) : (await o("POST", "/metric-alerts/subscriptions", { rule_id: e.id }), p("Subscribed to alert")), b("nvr-ma-subs");
320
321
  } catch {
321
322
  p("Failed to update subscription");
322
323
  }
323
- }, ie = async (e, a) => {
324
+ }, se = async (e, a) => {
324
325
  try {
325
326
  await o("PATCH", `/metric-alerts/subscriptions/${e}`, a), b("nvr-ma-subs");
326
327
  } catch {
327
328
  p("Failed to update subscription");
328
329
  }
329
- }, tt = async (e) => {
330
+ }, et = async (e) => {
330
331
  var a, u;
331
- Q(!0);
332
+ V(!0);
332
333
  try {
333
- if (re)
334
- await o("PATCH", `/metric-alerts/rules/${re.id}`, e), p("Alert rule updated");
334
+ if (ae)
335
+ await o("PATCH", `/metric-alerts/rules/${ae.id}`, e), p("Alert rule updated");
335
336
  else {
336
- const c = q.find((x) => x.id === e.definition_id), v = { ...e.filters ?? {} };
337
+ const c = R.find((x) => x.id === e.definition_id), v = { ...e.filters ?? {} };
337
338
  for (const x of (c == null ? void 0 : c.supported_filters) ?? []) {
338
339
  if ((a = v[x.key]) != null && a.length) continue;
339
- const N = _t(A, { key: x.key, collection: x.collection });
340
+ const N = wt(C, { key: x.key, collection: x.collection });
340
341
  if (!N) continue;
341
- const $ = (u = A == null ? void 0 : A.restricted) == null ? void 0 : u[N.name];
342
+ const $ = (u = C == null ? void 0 : C.restricted) == null ? void 0 : u[N.name];
342
343
  if (!($ != null && $.length)) continue;
343
- const j = At(A, N.name), Y = j.length ? j : $;
344
- v[x.key] = await St(
344
+ const F = _t(C, N.name), Q = F.length ? F : $;
345
+ v[x.key] = await At(
345
346
  m,
346
347
  N,
347
- Y,
348
+ Q,
348
349
  x.value_field
349
350
  );
350
351
  }
351
352
  await o("POST", "/metric-alerts/rules", { ...e, filters: v }), p("Alert rule created");
352
353
  }
353
- z(!1), b("nvr-ma-rules", "nvr-ma-subs");
354
+ K(!1), b("nvr-ma-rules", "nvr-ma-subs");
354
355
  } catch {
355
356
  p("Failed to save rule");
356
357
  } finally {
357
- Q(!1);
358
+ V(!1);
358
359
  }
359
- }, at = async (e) => {
360
+ }, tt = async (e) => {
360
361
  if (window.confirm(`Delete rule "${e.name}"? This removes the rule and all subscriptions.`))
361
362
  try {
362
363
  await o("DELETE", `/metric-alerts/rules/${e.id}`), p("Alert rule deleted"), b("nvr-ma-rules", "nvr-ma-subs", "nvr-ma-log");
363
364
  } catch {
364
365
  p("Failed to delete rule");
365
366
  }
366
- }, lt = async (e) => {
367
- Q(!0);
367
+ }, at = async (e) => {
368
+ V(!0);
368
369
  try {
369
- se ? (await o("PATCH", `/metric-alerts/anomaly-rules/${se.id}`, e), p("Anomaly rule updated")) : (await o("POST", "/metric-alerts/anomaly-rules", e), p("Anomaly rule created")), W(!1), U(null), b("nvr-ma-anomaly-rules");
370
+ le ? (await o("PATCH", `/metric-alerts/anomaly-rules/${le.id}`, e), p("Anomaly rule updated")) : (await o("POST", "/metric-alerts/anomaly-rules", e), p("Anomaly rule created")), B(!1), W(null), b("nvr-ma-anomaly-rules");
370
371
  } catch {
371
372
  p("Failed to save anomaly rule");
372
373
  } finally {
373
- Q(!1);
374
+ V(!1);
374
375
  }
375
- }, rt = async (e) => {
376
+ }, lt = async (e) => {
376
377
  if (window.confirm(`Delete anomaly rule "${e.name}"? Its log entries are also removed.`))
377
378
  try {
378
379
  await o("DELETE", `/metric-alerts/anomaly-rules/${e.id}`), p("Anomaly rule deleted"), b("nvr-ma-anomaly-rules", "nvr-ma-anomaly-log");
@@ -385,83 +386,82 @@ function Yt({
385
386
  } catch {
386
387
  p("Failed to update anomaly rule");
387
388
  }
388
- }, Ee = async (e, a) => {
389
+ }, Se = async (e, a) => {
389
390
  try {
390
391
  await o("PATCH", `/metric-alerts/anomaly-log/${e}`, { status: a }), b("nvr-ma-anomaly-log");
391
392
  } catch {
392
393
  p("Failed to update anomaly");
393
394
  }
394
- }, de = async (e, a) => {
395
+ }, ne = async (e, a) => {
395
396
  try {
396
397
  await o("PATCH", `/report-studio/${e.report}/alerts/${e.id}`, a), b("nvr-ma-report-alerts");
397
398
  } catch {
398
399
  p("Failed to update widget alert");
399
400
  }
400
- }, st = async (e) => {
401
+ }, rt = async (e) => {
401
402
  if (window.confirm(`Delete widget alert "${e.name}"?`))
402
403
  try {
403
404
  await o("DELETE", `/report-studio/${e.report}/alerts/${e.id}`), p("Widget alert deleted"), b("nvr-ma-report-alerts", "nvr-ma-report-alerts-log");
404
405
  } catch {
405
406
  p("Failed to delete widget alert");
406
407
  }
407
- }, nt = me({
408
+ }, st = oe({
408
409
  mutationFn: (e) => o("POST", `/report-studio/${e.report_id}/alerts/${e.alert}/resolve`),
409
410
  onSuccess: () => b("nvr-ma-report-alerts-log", "nvr-ma-report-alerts")
410
- }), it = J(() => {
411
+ }), nt = z(() => {
411
412
  const e = /* @__PURE__ */ new Map();
412
- for (const a of q)
413
+ for (const a of R)
413
414
  e.has(a.category) || e.set(a.category, []), e.get(a.category).push(a);
414
415
  return e;
415
- }, [q]), oe = H.filter((e) => e.status === "firing").length, dt = ye.filter((e) => e.status === "firing").length, ot = ke.filter((e) => e.status === "active").length, ct = B.filter((e) => e.status === "new").length, mt = [
416
- { key: "catalog", label: "Alert Catalog", icon: /* @__PURE__ */ t($e, { className: "h-3.5 w-3.5" }) },
417
- { key: "rules", label: "Alert Rules", icon: /* @__PURE__ */ t(Re, { className: "h-3.5 w-3.5" }) },
416
+ }, [R]), ie = I.filter((e) => e.status === "firing").length, it = ve.filter((e) => e.status === "firing").length, dt = ye.filter((e) => e.status === "active").length, ot = H.filter((e) => e.status === "new").length, ct = [
417
+ { key: "catalog", label: "Alert Catalog", icon: /* @__PURE__ */ t(Te, { className: "h-3.5 w-3.5" }) },
418
+ { key: "rules", label: "Alert Rules", icon: /* @__PURE__ */ t($e, { className: "h-3.5 w-3.5" }) },
418
419
  {
419
420
  key: "subscriptions",
420
421
  label: "My Subscriptions",
421
- icon: /* @__PURE__ */ t(ue, { className: "h-3.5 w-3.5" }),
422
- badge: /* @__PURE__ */ t(F, { n: G.length + fe.length, tone: "cyan" })
422
+ icon: /* @__PURE__ */ t(ce, { className: "h-3.5 w-3.5" }),
423
+ badge: /* @__PURE__ */ t(D, { n: P.length + ge.length, tone: "cyan" })
423
424
  },
424
425
  {
425
426
  key: "history",
426
427
  label: "Alert History",
427
- icon: /* @__PURE__ */ t(bt, { className: "h-3.5 w-3.5" }),
428
- badge: /* @__PURE__ */ t(F, { n: oe, tone: "red" })
428
+ icon: /* @__PURE__ */ t(xt, { className: "h-3.5 w-3.5" }),
429
+ badge: /* @__PURE__ */ t(D, { n: ie, tone: "red" })
429
430
  },
430
431
  {
431
432
  key: "widget_alerts",
432
433
  label: "Widget Alerts",
433
- icon: /* @__PURE__ */ t(gt, { className: "h-3.5 w-3.5" }),
434
- badge: /* @__PURE__ */ t(F, { n: ae.length, tone: "violet" })
434
+ icon: /* @__PURE__ */ t(bt, { className: "h-3.5 w-3.5" }),
435
+ badge: /* @__PURE__ */ t(D, { n: ee.length, tone: "violet" })
435
436
  },
436
437
  {
437
438
  key: "widget_alert_history",
438
439
  label: "Widget Alert History",
439
- icon: /* @__PURE__ */ t(qe, { className: "h-3.5 w-3.5" }),
440
- badge: /* @__PURE__ */ t(F, { n: dt, tone: "red" })
440
+ icon: /* @__PURE__ */ t(Re, { className: "h-3.5 w-3.5" }),
441
+ badge: /* @__PURE__ */ t(D, { n: it, tone: "red" })
441
442
  },
442
443
  {
443
444
  key: "anomaly_rules",
444
445
  label: "Anomaly Rules",
445
- icon: /* @__PURE__ */ t(De, { className: "h-3.5 w-3.5" }),
446
- badge: /* @__PURE__ */ t(F, { n: ot, tone: "teal" })
446
+ icon: /* @__PURE__ */ t(qe, { className: "h-3.5 w-3.5" }),
447
+ badge: /* @__PURE__ */ t(D, { n: dt, tone: "teal" })
447
448
  },
448
449
  {
449
450
  key: "anomaly_history",
450
451
  label: "Anomaly History",
451
- icon: /* @__PURE__ */ t(ft, { className: "h-3.5 w-3.5" }),
452
- badge: /* @__PURE__ */ t(F, { n: ct, tone: "red" })
452
+ icon: /* @__PURE__ */ t(gt, { className: "h-3.5 w-3.5" }),
453
+ badge: /* @__PURE__ */ t(D, { n: ot, tone: "red" })
453
454
  }
454
- ].filter((e) => !d.includes(e.key)), Te = (e) => {
455
- Ne(null), we(e ?? null), z(!0);
456
- }, D = (e) => Me || e != null && String(e).toLowerCase() === Oe, ce = "inline-flex h-7 items-center gap-1.5 rounded-md bg-nvr-cyan px-2.5 text-[12px] font-semibold text-white hover:opacity-90";
455
+ ].filter((e) => !d.includes(e.key)), Ee = (e) => {
456
+ ke(null), Ne(e ?? null), K(!0);
457
+ }, q = (e) => Oe || e != null && String(e).toLowerCase() === X, de = "inline-flex h-7 items-center gap-1.5 rounded-md bg-nvr-cyan px-2.5 text-[12px] font-semibold text-white hover:opacity-90";
457
458
  return /* @__PURE__ */ l("div", { className: i("flex flex-col gap-3", h), "data-alert-manager": "", children: [
458
- T && /* @__PURE__ */ t("div", { className: "fixed right-4 top-4 z-[60] rounded-md bg-[#0f172a] px-3 py-2 text-[12.5px] text-white shadow-lg dark:bg-slate-100 dark:text-slate-900", children: T }),
459
459
  /* @__PURE__ */ t(
460
460
  "div",
461
461
  {
462
462
  className: "flex flex-wrap gap-1 border-b border-slate-200 pb-px dark:border-border",
463
463
  "data-alert-tabs": "",
464
- children: mt.map((e) => /* @__PURE__ */ l(
464
+ children: ct.map((e) => /* @__PURE__ */ l(
465
465
  "button",
466
466
  {
467
467
  type: "button",
@@ -480,7 +480,7 @@ function Yt({
480
480
  ))
481
481
  }
482
482
  ),
483
- g === "catalog" && te && /* @__PURE__ */ t("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: Array.from({ length: 6 }, (e, a) => /* @__PURE__ */ l(
483
+ g === "catalog" && Z && /* @__PURE__ */ t("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: Array.from({ length: 6 }, (e, a) => /* @__PURE__ */ l(
484
484
  "div",
485
485
  {
486
486
  className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
@@ -492,12 +492,12 @@ function Yt({
492
492
  },
493
493
  a
494
494
  )) }),
495
- g === "catalog" && !te && q.length > 0 && // One continuous list, not a card grid: the old layout repeated an
495
+ g === "catalog" && !Z && R.length > 0 && // One continuous list, not a card grid: the old layout repeated an
496
496
  // identical box (and an identical saturated button) fourteen times,
497
497
  // and its per-category grids left orphan holes on odd counts. Rows
498
498
  // also make room for the fact that actually matters here — whether
499
499
  // this metric is already being watched.
500
- /* @__PURE__ */ t("section", { className: "max-w-[1180px] overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [...it.entries()].map(([e, a], u) => /* @__PURE__ */ l("div", { children: [
500
+ /* @__PURE__ */ t("section", { className: "max-w-[1180px] overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [...nt.entries()].map(([e, a], u) => /* @__PURE__ */ l("div", { children: [
501
501
  /* @__PURE__ */ l(
502
502
  "div",
503
503
  {
@@ -506,7 +506,7 @@ function Yt({
506
506
  u > 0 && "border-t border-slate-200 dark:border-border"
507
507
  ),
508
508
  children: [
509
- /* @__PURE__ */ t("span", { className: Dt(e), children: e }),
509
+ /* @__PURE__ */ t("span", { className: Ft(e), children: Tt(e) }),
510
510
  /* @__PURE__ */ l("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: [
511
511
  a.length,
512
512
  " metric",
@@ -516,7 +516,7 @@ function Yt({
516
516
  }
517
517
  ),
518
518
  /* @__PURE__ */ t("ul", { className: "divide-y divide-slate-100 dark:divide-border/50", children: a.map((c) => {
519
- const v = I.filter((x) => x.definition_id === c.id).length;
519
+ const v = M.filter((x) => x.definition_id === c.id).length;
520
520
  return /* @__PURE__ */ l(
521
521
  "li",
522
522
  {
@@ -526,7 +526,7 @@ function Yt({
526
526
  /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
527
527
  /* @__PURE__ */ t("p", { className: "truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: c.name }),
528
528
  v > 0 && /* @__PURE__ */ l("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full bg-nvr-cyan/10 px-1.5 py-px text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: [
529
- /* @__PURE__ */ t(ue, { className: "h-2.5 w-2.5" }),
529
+ /* @__PURE__ */ t(ce, { className: "h-2.5 w-2.5" }),
530
530
  v
531
531
  ] })
532
532
  ] }),
@@ -536,9 +536,9 @@ function Yt({
536
536
  /* @__PURE__ */ t("span", { className: "text-[10px] uppercase tracking-wide text-slate-400 dark:text-slate-500", children: c.unit }),
537
537
  /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "·" }),
538
538
  /* @__PURE__ */ l("span", { children: [
539
- ee[c.default_operator] ?? c.default_operator,
539
+ be[c.default_operator] ?? c.default_operator,
540
540
  " ",
541
- c.default_threshold != null ? _(c.default_threshold, c.unit) : "—"
541
+ c.default_threshold != null ? A(c.default_threshold, c.unit) : "—"
542
542
  ] })
543
543
  ] }),
544
544
  /* @__PURE__ */ l(
@@ -547,10 +547,10 @@ function Yt({
547
547
  type: "button",
548
548
  className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-slate-200 px-2.5 text-[12px] font-medium text-slate-600 transition-colors hover:border-nvr-cyan hover:bg-nvr-cyan/[0.08] hover:text-nvr-navy dark:border-border dark:text-slate-300 dark:hover:text-nvr-cyan",
549
549
  onClick: () => {
550
- Te(c.id), f("rules");
550
+ Ee(c.id), f("rules");
551
551
  },
552
552
  children: [
553
- /* @__PURE__ */ t(he, { className: "h-3 w-3" }),
553
+ /* @__PURE__ */ t(me, { className: "h-3 w-3" }),
554
554
  " Rule"
555
555
  ]
556
556
  }
@@ -561,22 +561,22 @@ function Yt({
561
561
  );
562
562
  }) })
563
563
  ] }, e)) }),
564
- g === "catalog" && !te && q.length === 0 && /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white py-16 dark:border-border dark:bg-card", children: /* @__PURE__ */ l("div", { className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-center", children: [
565
- /* @__PURE__ */ t(vt, { className: "h-5 w-5 text-slate-300 dark:text-slate-600" }),
564
+ g === "catalog" && !Z && R.length === 0 && /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white py-16 dark:border-border dark:bg-card", children: /* @__PURE__ */ l("div", { className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-center", children: [
565
+ /* @__PURE__ */ t(ft, { className: "h-5 w-5 text-slate-300 dark:text-slate-600" }),
566
566
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No metrics in the catalog yet" }),
567
567
  /* @__PURE__ */ t("p", { className: "text-[12px] leading-relaxed text-slate-400 dark:text-slate-500", children: "Metric definitions describe what can be measured — once an admin adds them, you can build alert rules on top." })
568
568
  ] }) }),
569
569
  g === "rules" && /* @__PURE__ */ t(
570
- ge,
570
+ xe,
571
571
  {
572
572
  title: "Alert rules",
573
- hint: `${I.length} rule${I.length === 1 ? "" : "s"} · shared and personal`,
574
- action: /* @__PURE__ */ l("button", { type: "button", className: ce, onClick: () => Te(), children: [
575
- /* @__PURE__ */ t(he, { className: "h-3 w-3" }),
573
+ hint: `${M.length} rule${M.length === 1 ? "" : "s"} · shared and personal`,
574
+ action: /* @__PURE__ */ l("button", { type: "button", className: de, onClick: () => Ee(), children: [
575
+ /* @__PURE__ */ t(me, { className: "h-3 w-3" }),
576
576
  " New rule"
577
577
  ] }),
578
578
  children: /* @__PURE__ */ t(
579
- C,
579
+ E,
580
580
  {
581
581
  headers: [
582
582
  "Rule",
@@ -588,15 +588,15 @@ function Yt({
588
588
  ],
589
589
  empty: "No alert rules yet",
590
590
  emptyHint: "Pick a metric from the catalog and set the threshold that should page you.",
591
- emptyIcon: /* @__PURE__ */ t(Fe, { className: "h-5 w-5" }),
592
- emptyAction: /* @__PURE__ */ l("button", { type: "button", className: ce, onClick: () => f("catalog"), children: [
593
- /* @__PURE__ */ t($e, { className: "h-3 w-3" }),
591
+ emptyIcon: /* @__PURE__ */ t(De, { className: "h-5 w-5" }),
592
+ emptyAction: /* @__PURE__ */ l("button", { type: "button", className: de, onClick: () => f("catalog"), children: [
593
+ /* @__PURE__ */ t(Te, { className: "h-3 w-3" }),
594
594
  " Browse catalog"
595
595
  ] }),
596
- loading: Pe,
597
- children: I.map((e) => {
598
- var $, j, Y;
599
- const a = !!Ae[e.id], u = D(e.created_by), c = Ze[e.id], v = e.status !== "active", x = e.last_checked_at, N = x ? Z(x) : null;
596
+ loading: Me,
597
+ children: M.map((e) => {
598
+ var $, F, Q;
599
+ const a = !!_e[e.id], u = q(e.created_by), c = Xe[e.id], v = e.status !== "active", x = e.last_checked_at, N = x ? J(x) : null;
600
600
  return /* @__PURE__ */ l(
601
601
  "tr",
602
602
  {
@@ -610,14 +610,14 @@ function Yt({
610
610
  e.definition && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: e.definition.name })
611
611
  ] }),
612
612
  /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
613
- Ot,
613
+ Mt,
614
614
  {
615
615
  operator: e.operator,
616
616
  threshold: e.threshold_value,
617
617
  unit: ($ = e.definition) == null ? void 0 : $.unit
618
618
  }
619
619
  ) }),
620
- /* @__PURE__ */ t("td", { className: r, children: v ? /* @__PURE__ */ t(M, { status: e.status }) : c ? /* @__PURE__ */ l("span", { className: "flex flex-col gap-0.5", children: [
620
+ /* @__PURE__ */ t("td", { className: r, children: v ? /* @__PURE__ */ t(j, { status: e.status }) : c ? /* @__PURE__ */ l("span", { className: "flex flex-col gap-0.5", children: [
621
621
  /* @__PURE__ */ l("span", { className: "inline-flex w-fit items-center gap-1.5 rounded-full bg-red-50 px-2 py-px text-[10.5px] font-semibold text-red-600 dark:bg-red-500/10 dark:text-red-400", children: [
622
622
  /* @__PURE__ */ t(
623
623
  "span",
@@ -629,8 +629,8 @@ function Yt({
629
629
  "Firing"
630
630
  ] }),
631
631
  /* @__PURE__ */ l("span", { className: "font-mono text-[10.5px] tabular-nums text-slate-500 dark:text-slate-400", children: [
632
- c.current_value != null ? `${_(c.current_value, (j = e.definition) == null ? void 0 : j.unit)} now` : _(c.metric_value, (Y = e.definition) == null ? void 0 : Y.unit),
633
- Z(c.fired_at) ? ` · fired ${Z(c.fired_at)}` : ""
632
+ c.current_value != null ? `${A(c.current_value, (F = e.definition) == null ? void 0 : F.unit)} now` : A(c.metric_value, (Q = e.definition) == null ? void 0 : Q.unit),
633
+ J(c.fired_at) ? ` · fired ${J(c.fired_at)}` : ""
634
634
  ] })
635
635
  ] }) : x ? /* @__PURE__ */ l(
636
636
  "span",
@@ -658,10 +658,10 @@ function Yt({
658
658
  ) }),
659
659
  /* @__PURE__ */ t("td", { className: i(r, "capitalize text-slate-500 dark:text-slate-400"), children: e.check_frequency }),
660
660
  /* @__PURE__ */ t("td", { className: r, children: e.is_shared ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1 text-[11.5px] text-slate-500 dark:text-slate-400", children: [
661
- /* @__PURE__ */ t(yt, { className: "h-3 w-3" }),
661
+ /* @__PURE__ */ t(vt, { className: "h-3 w-3" }),
662
662
  " Team"
663
663
  ] }) : /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1 text-[11.5px] text-slate-400 dark:text-slate-500", children: [
664
- /* @__PURE__ */ t(kt, { className: "h-3 w-3" }),
664
+ /* @__PURE__ */ t(yt, { className: "h-3 w-3" }),
665
665
  " Private"
666
666
  ] }) }),
667
667
  /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ l("div", { className: "flex items-center justify-end gap-1", children: [
@@ -671,15 +671,15 @@ function Yt({
671
671
  type: "button",
672
672
  title: a ? "Unsubscribe from this rule" : "Subscribe to this rule",
673
673
  "aria-pressed": a,
674
- onClick: () => et(e),
674
+ onClick: () => Ze(e),
675
675
  className: i(
676
676
  w,
677
677
  a && "border-nvr-cyan bg-nvr-cyan/10 text-nvr-navy hover:bg-nvr-cyan/15 dark:text-nvr-cyan"
678
678
  ),
679
- children: a ? /* @__PURE__ */ t(ue, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Re, { className: "h-3.5 w-3.5" })
679
+ children: a ? /* @__PURE__ */ t(ce, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t($e, { className: "h-3.5 w-3.5" })
680
680
  }
681
681
  ),
682
- u && /* @__PURE__ */ l(ut, { children: [
682
+ u && /* @__PURE__ */ l(mt, { children: [
683
683
  /* @__PURE__ */ t(
684
684
  "button",
685
685
  {
@@ -687,9 +687,9 @@ function Yt({
687
687
  title: "Edit rule",
688
688
  className: w,
689
689
  onClick: () => {
690
- Ne(e), we(null), z(!0);
690
+ ke(e), Ne(null), K(!0);
691
691
  },
692
- children: /* @__PURE__ */ t(pe, { className: "h-3.5 w-3.5" })
692
+ children: /* @__PURE__ */ t(ue, { className: "h-3.5 w-3.5" })
693
693
  }
694
694
  ),
695
695
  /* @__PURE__ */ t(
@@ -701,8 +701,8 @@ function Yt({
701
701
  w,
702
702
  "hover:border-red-300 hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-500/10 dark:hover:text-red-400"
703
703
  ),
704
- onClick: () => at(e),
705
- children: /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" })
704
+ onClick: () => tt(e),
705
+ children: /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" })
706
706
  }
707
707
  )
708
708
  ] })
@@ -719,7 +719,7 @@ function Yt({
719
719
  g === "subscriptions" && /* @__PURE__ */ l("div", { className: "space-y-2", children: [
720
720
  /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Manage how you receive alert notifications" }),
721
721
  /* @__PURE__ */ t(
722
- C,
722
+ E,
723
723
  {
724
724
  headers: [
725
725
  "Alert Rule",
@@ -731,8 +731,8 @@ function Yt({
731
731
  { label: "", width: 40 }
732
732
  ],
733
733
  empty: "No subscriptions yet — browse the Alert Catalog or Rules tab to subscribe",
734
- loading: Ie,
735
- children: G.map((e) => /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
734
+ loading: Pe,
735
+ children: P.map((e) => /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
736
736
  /* @__PURE__ */ l("td", { className: r, children: [
737
737
  /* @__PURE__ */ t("p", { className: "font-medium text-slate-800 dark:text-slate-100", children: e.rule_name ?? `Rule #${e.rule_id}` }),
738
738
  e.definition_name && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-400", children: e.definition_name })
@@ -741,21 +741,21 @@ function Yt({
741
741
  S,
742
742
  {
743
743
  checked: !!e.delivery_in_app,
744
- onChange: (a) => ie(e.id, { delivery_in_app: a })
744
+ onChange: (a) => se(e.id, { delivery_in_app: a })
745
745
  }
746
746
  ) }),
747
747
  /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
748
748
  S,
749
749
  {
750
750
  checked: !!e.delivery_email,
751
- onChange: (a) => ie(e.id, { delivery_email: a })
751
+ onChange: (a) => se(e.id, { delivery_email: a })
752
752
  }
753
753
  ) }),
754
754
  /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
755
755
  Le,
756
756
  {
757
757
  value: String(e.digest_frequency),
758
- onChange: (a) => ie(e.id, { digest_frequency: a }),
758
+ onChange: (a) => se(e.id, { digest_frequency: a }),
759
759
  options: [
760
760
  { label: "Immediate", value: "immediate" },
761
761
  { label: "Daily", value: "daily" },
@@ -764,8 +764,8 @@ function Yt({
764
764
  className: "h-7 w-[105px] text-[11.5px]"
765
765
  }
766
766
  ) }),
767
- /* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: P(e.last_notified) }),
768
- /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(M, { status: e.status }) }),
767
+ /* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: O(e.last_notified) }),
768
+ /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(j, { status: e.status }) }),
769
769
  /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
770
770
  "button",
771
771
  {
@@ -775,7 +775,7 @@ function Yt({
775
775
  onClick: async () => {
776
776
  window.confirm("Unsubscribe from this alert?") && (await o("DELETE", `/metric-alerts/subscriptions/${e.id}`), b("nvr-ma-subs"));
777
777
  },
778
- children: /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" })
778
+ children: /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" })
779
779
  }
780
780
  ) })
781
781
  ] }, e.id))
@@ -784,7 +784,7 @@ function Yt({
784
784
  /* @__PURE__ */ t("p", { className: "pt-3 text-[11px] font-semibold uppercase tracking-wider text-slate-400", children: "Record & workflow notifications" }),
785
785
  /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Subscriptions to record events and workflow state changes (created from records, queues, or notification settings)" }),
786
786
  /* @__PURE__ */ t(
787
- C,
787
+ E,
788
788
  {
789
789
  headers: [
790
790
  "Subscription",
@@ -794,8 +794,8 @@ function Yt({
794
794
  { label: "", width: 80 }
795
795
  ],
796
796
  empty: "No record notifications yet — subscribe from a record, queue, or workflow",
797
- loading: He,
798
- children: fe.map((e) => /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
797
+ loading: Ge,
798
+ children: ge.map((e) => /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
799
799
  /* @__PURE__ */ l("td", { className: r, children: [
800
800
  /* @__PURE__ */ t("p", { className: "font-medium text-slate-800 dark:text-slate-100", children: e.label || (e.collection ? e.collection.replace(/_/g, " ") : "Queue digest") }),
801
801
  /* @__PURE__ */ l("div", { className: "mt-0.5 flex flex-wrap items-center gap-1", children: [
@@ -828,7 +828,7 @@ function Yt({
828
828
  Le,
829
829
  {
830
830
  value: String(e.digest_frequency ?? "instant"),
831
- onChange: (a) => K.mutate({ id: e.id, patch: { digest_frequency: a } }),
831
+ onChange: (a) => G.mutate({ id: e.id, patch: { digest_frequency: a } }),
832
832
  options: [
833
833
  { label: "Instant", value: "instant" },
834
834
  { label: "Daily", value: "daily" },
@@ -841,7 +841,7 @@ function Yt({
841
841
  S,
842
842
  {
843
843
  checked: !!e.is_active,
844
- onChange: (a) => K.mutate({ id: e.id, patch: { is_active: a } })
844
+ onChange: (a) => G.mutate({ id: e.id, patch: { is_active: a } })
845
845
  }
846
846
  ) }),
847
847
  /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
@@ -851,8 +851,8 @@ function Yt({
851
851
  type: "button",
852
852
  title: "Edit",
853
853
  className: w,
854
- onClick: () => ne(e),
855
- children: /* @__PURE__ */ t(pe, { className: "h-3.5 w-3.5" })
854
+ onClick: () => re(e),
855
+ children: /* @__PURE__ */ t(ue, { className: "h-3.5 w-3.5" })
856
856
  }
857
857
  ),
858
858
  /* @__PURE__ */ t(
@@ -862,9 +862,9 @@ function Yt({
862
862
  title: "Remove subscription",
863
863
  className: i(w, "hover:border-red-300 hover:text-red-500"),
864
864
  onClick: () => {
865
- window.confirm("Remove this notification subscription?") && Ke.mutate(e.id);
865
+ window.confirm("Remove this notification subscription?") && He.mutate(e.id);
866
866
  },
867
- children: /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" })
867
+ children: /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" })
868
868
  }
869
869
  )
870
870
  ] }) })
@@ -873,12 +873,12 @@ function Yt({
873
873
  )
874
874
  ] }),
875
875
  g === "history" && /* @__PURE__ */ t(
876
- ge,
876
+ xe,
877
877
  {
878
878
  title: "Alert history",
879
- hint: oe > 0 ? `${oe} open · last 100 events` : "Last 100 events — none open",
879
+ hint: ie > 0 ? `${ie} open · last 100 events` : "Last 100 events — none open",
880
880
  children: /* @__PURE__ */ t(
881
- C,
881
+ E,
882
882
  {
883
883
  headers: [
884
884
  "Alert rule",
@@ -889,9 +889,9 @@ function Yt({
889
889
  ],
890
890
  empty: "No alerts have fired",
891
891
  emptyHint: "Events appear here the first time a rule crosses its threshold.",
892
- emptyIcon: /* @__PURE__ */ t(qe, { className: "h-5 w-5" }),
893
- loading: Ge,
894
- children: H.map((e) => {
892
+ emptyIcon: /* @__PURE__ */ t(Re, { className: "h-5 w-5" }),
893
+ loading: Ie,
894
+ children: I.map((e) => {
895
895
  const a = e.status === "firing" && !e.resolved_at, u = e.resolved_at ? je(e.fired_at, e.resolved_at) : je(e.fired_at, (/* @__PURE__ */ new Date()).toISOString());
896
896
  return /* @__PURE__ */ l(
897
897
  "tr",
@@ -919,7 +919,7 @@ function Yt({
919
919
  ] }) }),
920
920
  /* @__PURE__ */ l("td", { className: r, children: [
921
921
  /* @__PURE__ */ t(
922
- jt,
922
+ Ot,
923
923
  {
924
924
  value: e.metric_value,
925
925
  threshold: e.threshold_value,
@@ -933,15 +933,15 @@ function Yt({
933
933
  "data-alert-current": !0,
934
934
  className: "mt-0.5 block font-mono text-[10.5px] tabular-nums text-slate-500 dark:text-slate-400",
935
935
  children: [
936
- _(e.current_value, e.definition_unit ?? void 0),
936
+ A(e.current_value, e.definition_unit ?? void 0),
937
937
  " now, as you see it"
938
938
  ]
939
939
  }
940
940
  )
941
941
  ] }),
942
- /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(be, { value: e.fired_at }) }),
943
- /* @__PURE__ */ t("td", { className: r, children: e.resolved_at ? /* @__PURE__ */ t(be, { value: e.resolved_at }) : /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-red-50 px-2 py-px text-[10.5px] font-semibold text-red-600 dark:bg-red-500/10 dark:text-red-400", children: "Still open" }) }),
944
- /* @__PURE__ */ t("td", { className: i(Lt, "text-right"), children: /* @__PURE__ */ t("span", { className: i(a && "text-red-600 dark:text-red-400"), children: u ?? "—" }) })
942
+ /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(pe, { value: e.fired_at }) }),
943
+ /* @__PURE__ */ t("td", { className: r, children: e.resolved_at ? /* @__PURE__ */ t(pe, { value: e.resolved_at }) : /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-red-50 px-2 py-px text-[10.5px] font-semibold text-red-600 dark:bg-red-500/10 dark:text-red-400", children: "Still open" }) }),
944
+ /* @__PURE__ */ t("td", { className: i(jt, "text-right"), children: /* @__PURE__ */ t("span", { className: i(a && "text-red-600 dark:text-red-400"), children: u ?? "—" }) })
945
945
  ]
946
946
  },
947
947
  e.id
@@ -954,7 +954,7 @@ function Yt({
954
954
  g === "widget_alerts" && /* @__PURE__ */ l("div", { className: "space-y-2", children: [
955
955
  /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Alerts set up directly on report widgets" }),
956
956
  /* @__PURE__ */ t(
957
- C,
957
+ E,
958
958
  {
959
959
  headers: [
960
960
  "Alert",
@@ -967,8 +967,8 @@ function Yt({
967
967
  { label: "", width: 40 }
968
968
  ],
969
969
  empty: "No widget alerts yet — open any report widget and click the bell icon",
970
- loading: Be,
971
- children: ae.map((e) => /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
970
+ loading: Ke,
971
+ children: ee.map((e) => /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
972
972
  /* @__PURE__ */ l("td", { className: r, children: [
973
973
  /* @__PURE__ */ t("p", { className: "font-medium text-slate-800 dark:text-slate-100", children: e.name }),
974
974
  e.report_name && /* @__PURE__ */ t(
@@ -984,51 +984,45 @@ function Yt({
984
984
  }
985
985
  )
986
986
  ] }),
987
- /* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: Rt(e.filters, le == null ? void 0 : le.get(String(e.report))) }),
988
- /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: (e.conditions ?? []).map((a, u) => /* @__PURE__ */ l(
987
+ /* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: qt(e.filters, te == null ? void 0 : te.get(String(e.report))) }),
988
+ /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: (e.conditions ?? []).map((a, u) => /* @__PURE__ */ t(
989
989
  "span",
990
990
  {
991
991
  className: "inline-flex rounded bg-slate-100 px-1.5 py-px text-[11px] text-slate-600 dark:bg-muted dark:text-slate-300",
992
- children: [
993
- a.field,
994
- " ",
995
- ee[a.op] ?? a.op,
996
- " ",
997
- a.value
998
- ]
992
+ children: $t(a)
999
993
  },
1000
994
  `${a.field}-${u}`
1001
995
  )) }) }),
1002
- /* @__PURE__ */ t("td", { className: r, children: D(X(e)) ? /* @__PURE__ */ t(
996
+ /* @__PURE__ */ t("td", { className: r, children: q(Y(e)) ? /* @__PURE__ */ t(
1003
997
  S,
1004
998
  {
1005
999
  checked: !!e.delivery_inapp,
1006
- onChange: (a) => de(e, { delivery_inapp: a })
1000
+ onChange: (a) => ne(e, { delivery_inapp: a })
1007
1001
  }
1008
- ) : /* @__PURE__ */ t(xe, { on: !!e.delivery_inapp }) }),
1009
- /* @__PURE__ */ t("td", { className: r, children: D(X(e)) ? /* @__PURE__ */ t(
1002
+ ) : /* @__PURE__ */ t(he, { on: !!e.delivery_inapp }) }),
1003
+ /* @__PURE__ */ t("td", { className: r, children: q(Y(e)) ? /* @__PURE__ */ t(
1010
1004
  S,
1011
1005
  {
1012
1006
  checked: !!e.delivery_email,
1013
- onChange: (a) => de(e, { delivery_email: a })
1007
+ onChange: (a) => ne(e, { delivery_email: a })
1014
1008
  }
1015
- ) : /* @__PURE__ */ t(xe, { on: !!e.delivery_email }) }),
1016
- /* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: P(e.last_fired) }),
1017
- /* @__PURE__ */ t("td", { className: r, children: D(X(e)) ? /* @__PURE__ */ t(
1009
+ ) : /* @__PURE__ */ t(he, { on: !!e.delivery_email }) }),
1010
+ /* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: O(e.last_fired) }),
1011
+ /* @__PURE__ */ t("td", { className: r, children: q(Y(e)) ? /* @__PURE__ */ t(
1018
1012
  S,
1019
1013
  {
1020
1014
  checked: !!e.is_active,
1021
- onChange: (a) => de(e, { is_active: a })
1015
+ onChange: (a) => ne(e, { is_active: a })
1022
1016
  }
1023
- ) : /* @__PURE__ */ t(xe, { on: !!e.is_active }) }),
1024
- /* @__PURE__ */ t("td", { className: r, children: D(X(e)) && /* @__PURE__ */ t(
1017
+ ) : /* @__PURE__ */ t(he, { on: !!e.is_active }) }),
1018
+ /* @__PURE__ */ t("td", { className: r, children: q(Y(e)) && /* @__PURE__ */ t(
1025
1019
  "button",
1026
1020
  {
1027
1021
  type: "button",
1028
1022
  title: "Delete",
1029
1023
  className: i(w, "hover:border-red-300 hover:text-red-500"),
1030
- onClick: () => st(e),
1031
- children: /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" })
1024
+ onClick: () => rt(e),
1025
+ children: /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" })
1032
1026
  }
1033
1027
  ) })
1034
1028
  ] }, e.id))
@@ -1038,7 +1032,7 @@ function Yt({
1038
1032
  g === "widget_alert_history" && /* @__PURE__ */ l("div", { className: "space-y-2", children: [
1039
1033
  /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Last 200 widget alert events" }),
1040
1034
  /* @__PURE__ */ t(
1041
- C,
1035
+ E,
1042
1036
  {
1043
1037
  headers: [
1044
1038
  "Alert",
@@ -1050,7 +1044,7 @@ function Yt({
1050
1044
  ],
1051
1045
  empty: "No widget alert history yet",
1052
1046
  loading: We,
1053
- children: ye.map((e) => /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
1047
+ children: ve.map((e) => /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
1054
1048
  /* @__PURE__ */ l("td", { className: r, children: [
1055
1049
  /* @__PURE__ */ t("p", { className: "font-medium text-slate-800 dark:text-slate-100", children: e.alert_name }),
1056
1050
  e.report_name && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-400", children: e.report_name })
@@ -1067,15 +1061,15 @@ function Yt({
1067
1061
  },
1068
1062
  a
1069
1063
  )) }) }),
1070
- /* @__PURE__ */ t("td", { className: i(r, "text-[11.5px]"), children: P(e.fired_at) }),
1071
- /* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: P(e.resolved_at) }),
1072
- /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(M, { status: e.status }) }),
1064
+ /* @__PURE__ */ t("td", { className: i(r, "text-[11.5px]"), children: O(e.fired_at) }),
1065
+ /* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: O(e.resolved_at) }),
1066
+ /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(j, { status: e.status }) }),
1073
1067
  /* @__PURE__ */ t("td", { className: r, children: e.status === "firing" && /* @__PURE__ */ t(
1074
1068
  "button",
1075
1069
  {
1076
1070
  type: "button",
1077
1071
  className: "rounded border border-nvr-cyan px-2 py-0.5 text-[11.5px] font-medium text-nvr-navy hover:bg-nvr-cyan/10 dark:text-nvr-cyan",
1078
- onClick: () => nt.mutate(e),
1072
+ onClick: () => st.mutate(e),
1079
1073
  children: "Resolve"
1080
1074
  }
1081
1075
  ) })
@@ -1090,19 +1084,19 @@ function Yt({
1090
1084
  "button",
1091
1085
  {
1092
1086
  type: "button",
1093
- className: ce,
1087
+ className: de,
1094
1088
  onClick: () => {
1095
- U(null), W(!0);
1089
+ W(null), B(!0);
1096
1090
  },
1097
1091
  children: [
1098
- /* @__PURE__ */ t(he, { className: "h-3 w-3" }),
1092
+ /* @__PURE__ */ t(me, { className: "h-3 w-3" }),
1099
1093
  " New Rule"
1100
1094
  ]
1101
1095
  }
1102
1096
  )
1103
1097
  ] }),
1104
1098
  /* @__PURE__ */ t(
1105
- C,
1099
+ E,
1106
1100
  {
1107
1101
  headers: [
1108
1102
  "Rule",
@@ -1115,8 +1109,8 @@ function Yt({
1115
1109
  ],
1116
1110
  empty: "No anomaly rules yet — create one to start detecting unusual patterns",
1117
1111
  loading: Ve,
1118
- children: ke.map((e) => {
1119
- const a = D(e.created_by);
1112
+ children: ye.map((e) => {
1113
+ const a = q(e.created_by);
1120
1114
  return /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
1121
1115
  /* @__PURE__ */ l("td", { className: r, children: [
1122
1116
  /* @__PURE__ */ t("p", { className: "font-medium text-slate-800 dark:text-slate-100", children: e.name }),
@@ -1126,7 +1120,7 @@ function Yt({
1126
1120
  "span",
1127
1121
  {
1128
1122
  className: i(
1129
- "inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold capitalize",
1123
+ "inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold",
1130
1124
  e.sensitivity === "high" ? "bg-orange-50 text-orange-600 dark:bg-orange-500/10 dark:text-orange-400" : e.sensitivity === "low" ? "bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-400" : "bg-sky-50 text-sky-600 dark:bg-sky-500/10 dark:text-sky-400"
1131
1125
  ),
1132
1126
  children: e.sensitivity ?? "medium"
@@ -1149,7 +1143,7 @@ function Yt({
1149
1143
  onChange: (u) => Ce(e.id, { delivery_email: u })
1150
1144
  }
1151
1145
  ) }),
1152
- /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(M, { status: e.status }) }),
1146
+ /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(j, { status: e.status }) }),
1153
1147
  /* @__PURE__ */ t("td", { className: r, children: a && /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
1154
1148
  /* @__PURE__ */ t(
1155
1149
  "button",
@@ -1158,9 +1152,9 @@ function Yt({
1158
1152
  title: "Edit",
1159
1153
  className: w,
1160
1154
  onClick: () => {
1161
- U(e), W(!0);
1155
+ W(e), B(!0);
1162
1156
  },
1163
- children: /* @__PURE__ */ t(pe, { className: "h-3.5 w-3.5" })
1157
+ children: /* @__PURE__ */ t(ue, { className: "h-3.5 w-3.5" })
1164
1158
  }
1165
1159
  ),
1166
1160
  /* @__PURE__ */ t(
@@ -1169,8 +1163,8 @@ function Yt({
1169
1163
  type: "button",
1170
1164
  title: "Delete",
1171
1165
  className: i(w, "hover:border-red-300 hover:text-red-500"),
1172
- onClick: () => rt(e),
1173
- children: /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" })
1166
+ onClick: () => lt(e),
1167
+ children: /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" })
1174
1168
  }
1175
1169
  )
1176
1170
  ] }) })
@@ -1180,13 +1174,13 @@ function Yt({
1180
1174
  )
1181
1175
  ] }),
1182
1176
  g === "anomaly_history" && /* @__PURE__ */ t(
1183
- ge,
1177
+ xe,
1184
1178
  {
1185
1179
  wide: !0,
1186
1180
  title: "Detected anomalies",
1187
- hint: `Last 200 detections${Se ? ` · ${Se} needing review` : ""}`,
1181
+ hint: `Last 200 detections${Ae ? ` · ${Ae} needing review` : ""}`,
1188
1182
  children: /* @__PURE__ */ t(
1189
- C,
1183
+ E,
1190
1184
  {
1191
1185
  headers: [
1192
1186
  "Subject",
@@ -1197,9 +1191,9 @@ function Yt({
1197
1191
  ],
1198
1192
  empty: "No anomalies detected",
1199
1193
  emptyHint: "Detections appear here when a subject deviates from its own recent pattern.",
1200
- emptyIcon: /* @__PURE__ */ t(De, { className: "h-5 w-5" }),
1194
+ emptyIcon: /* @__PURE__ */ t(qe, { className: "h-5 w-5" }),
1201
1195
  loading: Qe,
1202
- children: B.map((e) => {
1196
+ children: H.map((e) => {
1203
1197
  const a = e.stats_snapshot ?? {}, u = Object.values(
1204
1198
  a.group ?? {}
1205
1199
  ).filter(Boolean), c = typeof a.multiplier == "number" ? a.multiplier : null, v = typeof a.value == "number" ? a.value : null, x = typeof a.mean == "number" ? a.mean : null, N = e.status !== "resolved";
@@ -1236,15 +1230,15 @@ function Yt({
1236
1230
  }
1237
1231
  ),
1238
1232
  v != null && x != null && /* @__PURE__ */ l("span", { className: "font-mono text-[10.5px] tabular-nums text-slate-400 dark:text-slate-500", children: [
1239
- _(v, "dollar"),
1233
+ A(v, "dollar"),
1240
1234
  " vs ",
1241
- _(x, "dollar")
1235
+ A(x, "dollar")
1242
1236
  ] })
1243
1237
  ] }) : /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) }),
1244
- /* @__PURE__ */ t("td", { className: i(r, "max-w-0"), children: /* @__PURE__ */ t(Mt, { text: e.ai_explanation }) }),
1238
+ /* @__PURE__ */ t("td", { className: i(r, "max-w-0"), children: /* @__PURE__ */ t(Pt, { text: e.ai_explanation }) }),
1245
1239
  /* @__PURE__ */ l("td", { className: r, children: [
1246
- /* @__PURE__ */ t(be, { value: e.detected_at }),
1247
- e.status !== "new" && /* @__PURE__ */ t("span", { className: "mt-1 block", children: /* @__PURE__ */ t(M, { status: e.status }) })
1240
+ /* @__PURE__ */ t(pe, { value: e.detected_at }),
1241
+ e.status !== "new" && /* @__PURE__ */ t("span", { className: "mt-1 block", children: /* @__PURE__ */ t(j, { status: e.status }) })
1248
1242
  ] }),
1249
1243
  /* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ l("div", { className: "flex items-center justify-end gap-1", children: [
1250
1244
  e.status === "new" && /* @__PURE__ */ t(
@@ -1252,7 +1246,7 @@ function Yt({
1252
1246
  {
1253
1247
  type: "button",
1254
1248
  className: "inline-flex h-7 items-center rounded-md border border-slate-200 px-2.5 text-[11.5px] font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-muted",
1255
- onClick: () => Ee(e.id, "acknowledged"),
1249
+ onClick: () => Se(e.id, "acknowledged"),
1256
1250
  children: "Acknowledge"
1257
1251
  }
1258
1252
  ),
@@ -1261,7 +1255,7 @@ function Yt({
1261
1255
  {
1262
1256
  type: "button",
1263
1257
  className: "inline-flex h-7 items-center rounded-md border border-nvr-cyan px-2.5 text-[11.5px] font-medium text-nvr-navy transition-colors hover:bg-nvr-cyan/10 dark:text-nvr-cyan",
1264
- onClick: () => Ee(e.id, "resolved"),
1258
+ onClick: () => Se(e.id, "resolved"),
1265
1259
  children: "Resolve"
1266
1260
  }
1267
1261
  )
@@ -1275,43 +1269,43 @@ function Yt({
1275
1269
  )
1276
1270
  }
1277
1271
  ),
1278
- /* @__PURE__ */ t("span", { className: "hidden", children: /* @__PURE__ */ t(Fe, { className: "h-4 w-4" }) }),
1272
+ /* @__PURE__ */ t("span", { className: "hidden", children: /* @__PURE__ */ t(De, { className: "h-4 w-4" }) }),
1279
1273
  /* @__PURE__ */ t(
1280
1274
  Ct,
1281
1275
  {
1282
- open: Ye,
1283
- definitions: q,
1284
- editRule: re,
1285
- preselectedDefinitionId: Je,
1286
- onClose: () => z(!1),
1287
- onSave: tt,
1288
- saving: _e
1276
+ open: ze,
1277
+ definitions: R,
1278
+ editRule: ae,
1279
+ preselectedDefinitionId: Ye,
1280
+ onClose: () => K(!1),
1281
+ onSave: et,
1282
+ saving: we
1289
1283
  }
1290
1284
  ),
1291
1285
  /* @__PURE__ */ t(
1292
- Et,
1286
+ St,
1293
1287
  {
1294
- open: Xe,
1288
+ open: Je,
1295
1289
  definitions: Ue,
1296
- editRule: se,
1290
+ editRule: le,
1297
1291
  onClose: () => {
1298
- W(!1), U(null);
1292
+ B(!1), W(null);
1299
1293
  },
1300
- onSave: lt,
1301
- saving: _e
1294
+ onSave: at,
1295
+ saving: we
1302
1296
  }
1303
1297
  ),
1304
1298
  /* @__PURE__ */ t(
1305
- Tt,
1299
+ Et,
1306
1300
  {
1307
- open: V != null,
1308
- sub: V,
1309
- onClose: () => ne(null),
1310
- saving: K.isPending,
1301
+ open: U != null,
1302
+ sub: U,
1303
+ onClose: () => re(null),
1304
+ saving: G.isPending,
1311
1305
  onSave: (e) => {
1312
- V && K.mutate(
1313
- { id: V.id, patch: e },
1314
- { onSuccess: () => ne(null) }
1306
+ U && G.mutate(
1307
+ { id: U.id, patch: e },
1308
+ { onSuccess: () => re(null) }
1315
1309
  );
1316
1310
  }
1317
1311
  }
@@ -1319,7 +1313,7 @@ function Yt({
1319
1313
  ] });
1320
1314
  }
1321
1315
  export {
1322
- Yt as AlertManagerView,
1323
- $t as alertFilterLabel,
1324
- Rt as alertScopeText
1316
+ Xt as AlertManagerView,
1317
+ Rt as alertFilterLabel,
1318
+ qt as alertScopeText
1325
1319
  };