@nivaro/react 0.3.133 → 0.3.135

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.
@@ -0,0 +1,876 @@
1
+ import { jsx as e, jsxs as r, Fragment as S } from "react/jsx-runtime";
2
+ import { useInfiniteQuery as ce, useQuery as P } from "@tanstack/react-query";
3
+ import { X as me, Download as he, ExternalLink as M, Mail as ue, ListFilter as pe, ChevronRight as G, ArrowLeft as be } from "lucide-react";
4
+ import { useState as V, useMemo as xe } from "react";
5
+ import { useNivaroClient as A, useApiFetchConfig as fe, useNavigation as ge, useItemNavigation as Ne } from "../../context.js";
6
+ import { get as F } from "../../lib/commands.js";
7
+ import { cn as x } from "../../lib/utils.js";
8
+ import { ErrorDetails as Z } from "../ErrorNotice.js";
9
+ import { QueryErrorState as K } from "../QueryErrorState.js";
10
+ import { Sheet as we, SheetContent as ve, SheetTitle as j, SheetDescription as ee } from "../ui/sheet.js";
11
+ import { Skeleton as $ } from "../ui/skeleton.js";
12
+ import { FilterPicker as ke, OutcomeChip as E, ShareBar as ye } from "./ui.js";
13
+ import { readDrill as _e, drillQuery as $e, fmtRange as J, titleize as v, fmtInt as U, clearDrill as Ce, fmtWhen as k, mins as te, encodeCond as Se } from "./url.js";
14
+ const Le = { n: "notifications", m: "emails", x: "mutes" }, Te = {
15
+ acted: "Acted on it.",
16
+ read_no_action: "Read it, then did nothing on the record in that time.",
17
+ unread_no_action: "Neither read it nor did anything on the record in that time.",
18
+ window_open: "Not counted yet.",
19
+ not_record: "Not about a record they could act on, so it does not count either way."
20
+ }, Re = `<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data: cid:; style-src 'unsafe-inline'">`;
21
+ function qe(a) {
22
+ return `${Re}${a}`;
23
+ }
24
+ function W() {
25
+ const a = ge(), m = Ne();
26
+ return {
27
+ record: (o, s) => o && s && !/^(nivaro|directus)_/i.test(o) && !o.startsWith("__") ? m.urlFor({ collection: o, itemId: s }) : null,
28
+ person: (o) => o ? a.userUrl ? a.userUrl(o) : `/users/${o.toLowerCase()}` : null,
29
+ mailLog: (o) => a.consoleUrl ? a.consoleUrl(`/delivery?id=${o}`) : `/delivery?id=${o}`,
30
+ go: (o) => (s) => {
31
+ s.metaKey || s.ctrlKey || s.shiftKey || s.button !== 0 || (s.preventDefault(), a.navigate(o));
32
+ }
33
+ };
34
+ }
35
+ function _({
36
+ href: a,
37
+ children: m,
38
+ onClick: c
39
+ }) {
40
+ return a ? /* @__PURE__ */ e(
41
+ "a",
42
+ {
43
+ href: a,
44
+ onClick: c,
45
+ className: "inline-flex items-center gap-1 rounded-sm font-medium text-sky-700 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-nvr-cyan",
46
+ children: m
47
+ }
48
+ ) : /* @__PURE__ */ e(S, { children: m });
49
+ }
50
+ function Ze({
51
+ params: a,
52
+ setParams: m,
53
+ summary: c,
54
+ labels: o
55
+ }) {
56
+ const s = _e(a), n = !!s, d = () => m(Ce);
57
+ return /* @__PURE__ */ e(we, { open: n, onOpenChange: (u) => !u && d(), children: /* @__PURE__ */ r(
58
+ ve,
59
+ {
60
+ side: "right",
61
+ "data-da-drill": "",
62
+ "aria-describedby": void 0,
63
+ className: "flex w-[96vw] flex-col gap-0 p-0 sm:max-w-[860px]",
64
+ children: [
65
+ s && !c && /* @__PURE__ */ r("div", { className: "space-y-2 p-5", "aria-busy": "true", children: [
66
+ /* @__PURE__ */ e(j, { className: "sr-only", children: "Loading" }),
67
+ /* @__PURE__ */ e($, { className: "h-5 w-1/2" }),
68
+ /* @__PURE__ */ e($, { className: "h-40 w-full" })
69
+ ] }),
70
+ s && c && s.leaf && /* @__PURE__ */ e(Be, { drill: s, setParams: m, summary: c }),
71
+ s && c && !s.leaf && /* @__PURE__ */ e(
72
+ De,
73
+ {
74
+ drill: s,
75
+ params: a,
76
+ setParams: m,
77
+ summary: c,
78
+ labels: o
79
+ }
80
+ )
81
+ ]
82
+ }
83
+ ) });
84
+ }
85
+ function Ee() {
86
+ const a = A();
87
+ return P({
88
+ queryKey: ["delivery-analytics", "dimensions"],
89
+ queryFn: () => a.request(
90
+ F("/delivery-analytics/dimensions")
91
+ ).then((m) => m.data),
92
+ staleTime: Number.POSITIVE_INFINITY
93
+ });
94
+ }
95
+ function je([a, m], c, o) {
96
+ var d;
97
+ const s = ((d = c == null ? void 0 : c.find((u) => u.key === a)) == null ? void 0 : d.label) ?? v(a.replace(/^ch[._]/, "")), n = m.map((u) => o.get(`${a}=${u}`) ?? o.get(u) ?? v(u));
98
+ return `${s}: ${n.length > 2 ? `${n.slice(0, 2).join(", ")} +${n.length - 2}` : n.join(", ")}`;
99
+ }
100
+ function De({
101
+ drill: a,
102
+ params: m,
103
+ setParams: c,
104
+ summary: o,
105
+ labels: s
106
+ }) {
107
+ var Y, H, X;
108
+ const n = A(), d = fe(), t = (Y = Ee().data) == null ? void 0 : Y[a.source], y = { ...o.window, asof: o.asof, acted_hours: o.acted_hours }, f = $e(m, a, y), b = a.sort, R = f.toString(), p = ce({
109
+ queryKey: ["delivery-analytics", "rows", R, b],
110
+ initialPageParam: "0",
111
+ queryFn: ({ pageParam: l }) => {
112
+ const i = new URLSearchParams(f);
113
+ return i.set("cursor", String(l)), i.set("limit", "50"), b === "ttr" && i.set("sort", "ttr"), b === "time-asc" && i.set("dir", "asc"), n.request(F(`/delivery-analytics/rows?${i.toString()}`)).then((g) => g.data);
114
+ },
115
+ getNextPageParam: (l) => l.next_cursor ?? void 0,
116
+ staleTime: 6e4
117
+ }), I = P({
118
+ queryKey: ["delivery-analytics", "split", R, a.splitBy],
119
+ enabled: !!a.splitBy,
120
+ queryFn: () => {
121
+ const l = new URLSearchParams(f);
122
+ return l.set("by", String(a.splitBy)), n.request(F(`/delivery-analytics/split?${l.toString()}`)).then((i) => i.data);
123
+ },
124
+ staleTime: 6e4
125
+ }), [h, L] = V(!1), [z, Q] = V(!1), q = (X = (H = p.data) == null ? void 0 : H.pages[0]) == null ? void 0 : X.total, B = xe(() => {
126
+ var l;
127
+ return ((l = p.data) == null ? void 0 : l.pages.flatMap((i) => i.rows)) ?? [];
128
+ }, [p.data]), O = Le[a.source], oe = a.prev ? `previous period, ${J(o.window.prev_from, o.window.prev_to)}` : a.source === "x" ? "standing mutes" : J(o.window.from, o.window.to), se = (l) => c((i) => {
129
+ const g = i.getAll("dw").filter((C, T) => T !== l);
130
+ i.delete("dw");
131
+ for (const C of g) i.append("dw", C);
132
+ i.delete("dby");
133
+ }), le = (l, i) => c((g) => {
134
+ g.append("dw", Se(l)), g.delete("dby");
135
+ const C = g.get("dl");
136
+ g.set("dl", C ? `${C} · ${i}` : i);
137
+ }), ie = (l) => c(
138
+ (i) => {
139
+ l === "time" ? i.delete("ds") : i.set("ds", l);
140
+ },
141
+ { replace: !0 }
142
+ ), de = async () => {
143
+ L(!0), Q(!1);
144
+ try {
145
+ const l = new URLSearchParams(f);
146
+ l.set("format", "csv"), b === "ttr" && l.set("sort", "ttr"), b === "time-asc" && l.set("dir", "asc");
147
+ const i = await fetch(`${d.apiBase}/delivery-analytics/rows?${l}`, {
148
+ headers: d.authHeaders,
149
+ credentials: d.credentials
150
+ });
151
+ if (!i.ok) throw new Error(String(i.status));
152
+ const g = await i.blob(), C = URL.createObjectURL(g), T = document.createElement("a");
153
+ T.href = C, T.download = `delivery-${O}.csv`, document.body.appendChild(T), T.click(), T.remove(), setTimeout(() => URL.revokeObjectURL(C), 3e4);
154
+ } catch {
155
+ Q(!0);
156
+ } finally {
157
+ L(!1);
158
+ }
159
+ };
160
+ return /* @__PURE__ */ r(S, { children: [
161
+ /* @__PURE__ */ r("div", { className: "shrink-0 border-b border-slate-200 px-5 pb-3 pt-4 pr-12 dark:border-border", children: [
162
+ /* @__PURE__ */ e(j, { className: "truncate text-[16px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-foreground", children: a.label ?? `${v(O)}` }),
163
+ /* @__PURE__ */ r(ee, { className: "mt-0.5 text-[12px] text-slate-500 dark:text-muted-foreground", children: [
164
+ /* @__PURE__ */ e(
165
+ "span",
166
+ {
167
+ "data-da-drill-total": q ?? "",
168
+ className: "font-medium tabular-nums text-slate-800 dark:text-foreground",
169
+ children: q == null ? "…" : U(q)
170
+ }
171
+ ),
172
+ " ",
173
+ q === 1 ? O.replace(/s$/, "") : O,
174
+ " · ",
175
+ oe
176
+ ] }),
177
+ a.where.length > 0 && /* @__PURE__ */ e("ul", { className: "mt-2 flex flex-wrap gap-1.5", "aria-label": "Conditions", children: a.where.map((l, i) => (
178
+ // biome-ignore lint/suspicious/noArrayIndexKey: the same condition may repeat; position is its identity
179
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ r("span", { className: "inline-flex max-w-[320px] items-center gap-1 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-2 pr-1 text-[11.5px] text-slate-700 dark:border-border dark:bg-muted dark:text-foreground", children: [
180
+ /* @__PURE__ */ e("span", { className: "truncate", children: je(l, t, s) }),
181
+ /* @__PURE__ */ e(
182
+ "button",
183
+ {
184
+ type: "button",
185
+ "aria-label": "Remove this condition",
186
+ "data-tip": "Remove this condition",
187
+ onClick: () => se(i),
188
+ className: "rounded-full p-0.5 text-slate-400 hover:bg-slate-200 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:bg-border dark:hover:text-foreground",
189
+ children: /* @__PURE__ */ e(me, { className: "h-3 w-3" })
190
+ }
191
+ )
192
+ ] }) }, `${l[0]}:${i}`)
193
+ )) }),
194
+ /* @__PURE__ */ r("div", { className: "mt-3 flex flex-wrap items-center gap-2", children: [
195
+ t && /* @__PURE__ */ e(
196
+ ke,
197
+ {
198
+ label: "Break down by",
199
+ allLabel: "Nothing",
200
+ value: a.splitBy,
201
+ options: t.filter((l) => !a.where.some(([i]) => i === l.key)).map((l) => ({ value: l.key, label: l.label })),
202
+ onChange: (l) => c((i) => {
203
+ l ? i.set("dby", l) : i.delete("dby");
204
+ })
205
+ }
206
+ ),
207
+ /* @__PURE__ */ e("span", { className: "flex-1" }),
208
+ a.source !== "x" && // biome-ignore lint/a11y/useSemanticElements: a toolbar toggle group, not a form fieldset
209
+ /* @__PURE__ */ e(
210
+ "div",
211
+ {
212
+ className: "inline-flex rounded-md border border-slate-200 p-0.5 text-[12px] dark:border-border",
213
+ role: "group",
214
+ "aria-label": "Order",
215
+ children: [
216
+ ["time", "Newest"],
217
+ ["time-asc", "Oldest"],
218
+ ...a.source === "n" ? [["ttr", "Slowest read"]] : []
219
+ ].map(([l, i]) => /* @__PURE__ */ e(
220
+ "button",
221
+ {
222
+ type: "button",
223
+ "aria-pressed": b === l,
224
+ onClick: () => ie(l),
225
+ className: x(
226
+ "rounded px-2 py-0.5 font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
227
+ b === l ? "bg-[#0f172a] text-white dark:bg-nvr-cyan dark:text-[#172940]" : "text-slate-600 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted"
228
+ ),
229
+ children: i
230
+ },
231
+ l
232
+ ))
233
+ }
234
+ ),
235
+ /* @__PURE__ */ r(
236
+ "button",
237
+ {
238
+ type: "button",
239
+ onClick: () => void de(),
240
+ disabled: h || !q,
241
+ "data-tip": z ? "The file could not be made — try again" : "Download these rows as CSV",
242
+ className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-slate-200 px-2.5 text-[12px] font-medium text-slate-700 hover:bg-slate-50 disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:border-border dark:text-foreground dark:hover:bg-muted",
243
+ children: [
244
+ /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
245
+ h ? "Preparing…" : z ? "Try CSV again" : "CSV"
246
+ ]
247
+ }
248
+ )
249
+ ] })
250
+ ] }),
251
+ /* @__PURE__ */ r("div", { className: "min-h-0 flex-1 overflow-y-auto bg-white dark:bg-background", children: [
252
+ a.splitBy && /* @__PURE__ */ e(
253
+ Fe,
254
+ {
255
+ split: I,
256
+ onPick: (l, i) => {
257
+ const g = String(a.splitBy);
258
+ le([g, [l]], i);
259
+ }
260
+ }
261
+ ),
262
+ p.isLoading ? /* @__PURE__ */ e("div", { className: "space-y-2 p-5", "aria-busy": "true", children: Array.from({ length: 6 }, (l, i) => (
263
+ // biome-ignore lint/suspicious/noArrayIndexKey: skeleton rows
264
+ /* @__PURE__ */ e($, { className: "h-9 w-full" }, i)
265
+ )) }) : p.isError ? /* @__PURE__ */ e("div", { className: "p-5", children: /* @__PURE__ */ e(
266
+ K,
267
+ {
268
+ error: p.error,
269
+ what: "these rows",
270
+ onRetry: () => void p.refetch()
271
+ }
272
+ ) }) : B.length === 0 ? /* @__PURE__ */ e("p", { className: "px-5 py-10 text-center text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "Nothing here now. The rows may have changed since the figure was read — reload the page to recount." }) : /* @__PURE__ */ r("div", { className: "px-5 py-4", children: [
273
+ /* @__PURE__ */ e(
274
+ Ie,
275
+ {
276
+ source: a.source,
277
+ rows: B,
278
+ onOpen: (l) => c((i) => {
279
+ i.set("leaf", `${a.source}:${l}`);
280
+ })
281
+ }
282
+ ),
283
+ /* @__PURE__ */ r("div", { className: "mt-3 flex items-center justify-between text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
284
+ /* @__PURE__ */ r("span", { className: "tabular-nums", children: [
285
+ "Showing ",
286
+ U(B.length),
287
+ " of ",
288
+ U(q ?? B.length)
289
+ ] }),
290
+ p.hasNextPage && /* @__PURE__ */ e(
291
+ "button",
292
+ {
293
+ type: "button",
294
+ onClick: () => void p.fetchNextPage(),
295
+ disabled: p.isFetchingNextPage,
296
+ className: "rounded-md border border-slate-200 px-3 py-1 font-medium text-slate-700 hover:bg-slate-50 disabled:opacity-50 dark:border-border dark:text-foreground dark:hover:bg-muted",
297
+ children: p.isFetchingNextPage ? "Loading…" : "Load 50 more"
298
+ }
299
+ )
300
+ ] })
301
+ ] })
302
+ ] })
303
+ ] });
304
+ }
305
+ function Fe({
306
+ split: a,
307
+ onPick: m
308
+ }) {
309
+ if (a.isLoading)
310
+ return /* @__PURE__ */ r(
311
+ "div",
312
+ {
313
+ className: "space-y-1.5 border-b border-slate-100 px-5 py-4 dark:border-border",
314
+ "aria-busy": "true",
315
+ children: [
316
+ /* @__PURE__ */ e($, { className: "h-6 w-full" }),
317
+ /* @__PURE__ */ e($, { className: "h-6 w-5/6" }),
318
+ /* @__PURE__ */ e($, { className: "h-6 w-2/3" })
319
+ ]
320
+ }
321
+ );
322
+ if (a.isError || !a.data)
323
+ return /* @__PURE__ */ e("div", { className: "border-b border-slate-100 px-5 py-4 dark:border-border", children: /* @__PURE__ */ e(
324
+ K,
325
+ {
326
+ error: a.error,
327
+ what: "this breakdown",
328
+ onRetry: () => void a.refetch()
329
+ }
330
+ ) });
331
+ const c = a.data, o = Math.max(1, ...c.rows.map((s) => s.cell.n));
332
+ return /* @__PURE__ */ r(
333
+ "section",
334
+ {
335
+ "aria-label": `By ${c.label}`,
336
+ className: "border-b border-slate-100 bg-slate-50/60 px-5 py-3 dark:border-border dark:bg-muted/20",
337
+ children: [
338
+ /* @__PURE__ */ r("h4", { className: "mb-1.5 flex items-center gap-1.5 text-[12px] font-semibold text-slate-700 dark:text-foreground", children: [
339
+ /* @__PURE__ */ e(pe, { className: "h-3.5 w-3.5 text-slate-400", "aria-hidden": !0 }),
340
+ "By ",
341
+ c.label.toLowerCase(),
342
+ /* @__PURE__ */ e("span", { className: "font-normal text-slate-500 dark:text-muted-foreground", children: "— pick one to narrow the list" })
343
+ ] }),
344
+ /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: c.rows.map((s) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ r(
345
+ "button",
346
+ {
347
+ type: "button",
348
+ "data-da-split-row": s.cell.n,
349
+ onClick: () => m(s.key, s.label),
350
+ className: "grid w-full grid-cols-[minmax(0,1fr)_120px_64px] items-center gap-3 rounded px-1 py-1.5 text-left text-[12.5px] hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:bg-muted",
351
+ children: [
352
+ /* @__PURE__ */ e("span", { className: "truncate text-slate-800 dark:text-foreground", children: s.label }),
353
+ /* @__PURE__ */ e(ye, { value: s.cell.n, max: o }),
354
+ /* @__PURE__ */ e("span", { className: "text-right tabular-nums text-slate-700 dark:text-foreground", children: U(s.cell.n) })
355
+ ]
356
+ }
357
+ ) }, s.key)) }),
358
+ c.more && /* @__PURE__ */ e("p", { className: "mt-1 text-[11px] text-slate-500 dark:text-muted-foreground", children: "The 50 largest are shown." })
359
+ ]
360
+ }
361
+ );
362
+ }
363
+ const N = "whitespace-nowrap px-3 py-2 text-left text-[10.5px] font-medium uppercase tracking-wide text-slate-500 dark:text-muted-foreground", w = "px-3 py-2 align-top";
364
+ function Ie({
365
+ source: a,
366
+ rows: m,
367
+ onOpen: c
368
+ }) {
369
+ const o = W(), s = (n) => a === "x" ? {} : {
370
+ tabIndex: 0,
371
+ role: "link",
372
+ "aria-label": "Open this row",
373
+ onClick: () => c(n),
374
+ onKeyDown: (d) => {
375
+ (d.key === "Enter" || d.key === " ") && (d.preventDefault(), c(n));
376
+ },
377
+ className: "group cursor-pointer border-b border-slate-100 last:border-0 hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/50 dark:border-border/60 dark:hover:bg-muted/60"
378
+ };
379
+ return /* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-lg border border-slate-200 dark:border-border", children: /* @__PURE__ */ r("table", { className: "w-full text-[12.5px]", children: [
380
+ /* @__PURE__ */ e("thead", { className: "border-b border-slate-200 bg-slate-50 dark:border-border dark:bg-muted/40", children: a === "n" ? /* @__PURE__ */ r("tr", { children: [
381
+ /* @__PURE__ */ e("th", { className: N, children: "Sent" }),
382
+ /* @__PURE__ */ e("th", { className: x(N, "hidden sm:table-cell"), children: "To" }),
383
+ /* @__PURE__ */ e("th", { className: N, children: "Subject" }),
384
+ /* @__PURE__ */ e("th", { className: x(N, "hidden md:table-cell"), children: "Channels" }),
385
+ /* @__PURE__ */ e("th", { className: x(N, "text-right"), children: "Read" }),
386
+ /* @__PURE__ */ e("th", { className: "w-6" })
387
+ ] }) : a === "m" ? /* @__PURE__ */ r("tr", { children: [
388
+ /* @__PURE__ */ e("th", { className: N, children: "When" }),
389
+ /* @__PURE__ */ e("th", { className: x(N, "hidden sm:table-cell"), children: "To" }),
390
+ /* @__PURE__ */ e("th", { className: N, children: "Subject" }),
391
+ /* @__PURE__ */ e("th", { className: N, children: "Outcome" }),
392
+ /* @__PURE__ */ e("th", { className: "w-6" })
393
+ ] }) : /* @__PURE__ */ r("tr", { children: [
394
+ /* @__PURE__ */ e("th", { className: N, children: "Muted" }),
395
+ /* @__PURE__ */ e("th", { className: N, children: "Person" }),
396
+ /* @__PURE__ */ e("th", { className: N, children: "Record" })
397
+ ] }) }),
398
+ /* @__PURE__ */ r("tbody", { className: "text-slate-700 dark:text-foreground", children: [
399
+ a === "n" && m.map((n) => /* @__PURE__ */ r("tr", { "data-da-row": n.id, ...s(n.id), children: [
400
+ /* @__PURE__ */ e(
401
+ "td",
402
+ {
403
+ className: x(
404
+ w,
405
+ "whitespace-nowrap tabular-nums text-slate-500 dark:text-muted-foreground"
406
+ ),
407
+ children: k(n.timestamp)
408
+ }
409
+ ),
410
+ /* @__PURE__ */ e("td", { className: x(w, "hidden max-w-[150px] truncate sm:table-cell"), children: n.recipient_name ?? "–" }),
411
+ /* @__PURE__ */ r("td", { className: x(w, "min-w-[160px]"), children: [
412
+ /* @__PURE__ */ e("span", { className: "line-clamp-2 [overflow-wrap:anywhere]", children: n.subject ?? "(no subject)" }),
413
+ /* @__PURE__ */ r("span", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: [
414
+ /* @__PURE__ */ r("span", { className: "sm:hidden", children: [
415
+ "To ",
416
+ n.recipient_name ?? "nobody",
417
+ " · "
418
+ ] }),
419
+ n.sender_name ? `from ${n.sender_name} · ` : "",
420
+ n.reason_label
421
+ ] })
422
+ ] }),
423
+ /* @__PURE__ */ e("td", { className: x(w, "hidden md:table-cell"), children: /* @__PURE__ */ e("span", { className: "flex flex-wrap gap-1", children: n.channels.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "not recorded" }) : n.channels.map((d) => /* @__PURE__ */ e(E, { outcome: d.outcome, children: /* @__PURE__ */ r("span", { "data-tip": d.label, children: [
424
+ d.channel === "inapp" ? "in-app" : d.channel === "sms" ? "SMS" : d.channel,
425
+ " ",
426
+ d.status.replace(/_/g, " ")
427
+ ] }) }, d.channel)) }) }),
428
+ /* @__PURE__ */ e("td", { className: x(w, "whitespace-nowrap text-right tabular-nums"), children: n.status === "inbox" ? /* @__PURE__ */ e("span", { className: "text-amber-700 dark:text-[#d4936a]", children: "Unread" }) : n.ttr_min != null ? te(n.ttr_min) : /* @__PURE__ */ e("span", { className: "text-slate-500 dark:text-muted-foreground", children: "Read" }) }),
429
+ /* @__PURE__ */ e("td", { className: "w-6 pr-2 pt-2.5 align-top", children: /* @__PURE__ */ e(
430
+ G,
431
+ {
432
+ className: "h-3.5 w-3.5 text-slate-300 group-hover:text-slate-500 dark:text-muted-foreground/50",
433
+ "aria-hidden": !0
434
+ }
435
+ ) })
436
+ ] }, n.id)),
437
+ a === "m" && m.map((n) => /* @__PURE__ */ r("tr", { "data-da-row": n.id, ...s(n.id), children: [
438
+ /* @__PURE__ */ e(
439
+ "td",
440
+ {
441
+ className: x(
442
+ w,
443
+ "whitespace-nowrap tabular-nums text-slate-500 dark:text-muted-foreground"
444
+ ),
445
+ children: k(n.created_at)
446
+ }
447
+ ),
448
+ /* @__PURE__ */ e("td", { className: x(w, "hidden max-w-[180px] truncate sm:table-cell"), children: n.to ?? "–" }),
449
+ /* @__PURE__ */ r("td", { className: x(w, "min-w-[160px]"), children: [
450
+ /* @__PURE__ */ e("span", { className: "line-clamp-2 [overflow-wrap:anywhere]", children: n.subject ?? "(no subject)" }),
451
+ /* @__PURE__ */ r("span", { className: "block text-[11px] text-slate-500 dark:text-muted-foreground", children: [
452
+ /* @__PURE__ */ r("span", { className: "sm:hidden", children: [
453
+ "To ",
454
+ n.to ?? "nobody"
455
+ ] }),
456
+ n.template && /* @__PURE__ */ e("span", { className: "hidden sm:inline", children: n.template })
457
+ ] })
458
+ ] }),
459
+ /* @__PURE__ */ e("td", { className: w, children: /* @__PURE__ */ e(E, { outcome: n.outcome, children: n.reason_label }) }),
460
+ /* @__PURE__ */ e("td", { className: "w-6 pr-2 pt-2.5 align-top", children: /* @__PURE__ */ e(
461
+ G,
462
+ {
463
+ className: "h-3.5 w-3.5 text-slate-300 group-hover:text-slate-500 dark:text-muted-foreground/50",
464
+ "aria-hidden": !0
465
+ }
466
+ ) })
467
+ ] }, n.id)),
468
+ a === "x" && m.map((n) => /* @__PURE__ */ r(
469
+ "tr",
470
+ {
471
+ className: "border-b border-slate-100 last:border-0 dark:border-border/60",
472
+ children: [
473
+ /* @__PURE__ */ e(
474
+ "td",
475
+ {
476
+ className: x(
477
+ w,
478
+ "whitespace-nowrap tabular-nums text-slate-500 dark:text-muted-foreground"
479
+ ),
480
+ children: k(n.created_at)
481
+ }
482
+ ),
483
+ /* @__PURE__ */ e("td", { className: w, children: /* @__PURE__ */ e(
484
+ _,
485
+ {
486
+ href: o.person(n.user),
487
+ onClick: o.person(n.user) ? o.go(String(o.person(n.user))) : void 0,
488
+ children: n.user_name ?? "Unknown person"
489
+ }
490
+ ) }),
491
+ /* @__PURE__ */ e("td", { className: w, children: (() => {
492
+ const d = o.record(n.collection, n.item);
493
+ return /* @__PURE__ */ r(_, { href: d, onClick: d ? o.go(d) : void 0, children: [
494
+ v(n.collection ?? ""),
495
+ " #",
496
+ n.item
497
+ ] });
498
+ })() })
499
+ ]
500
+ },
501
+ n.id
502
+ ))
503
+ ] })
504
+ ] }) });
505
+ }
506
+ function ae({
507
+ title: a,
508
+ sub: m,
509
+ onBack: c,
510
+ backLabel: o
511
+ }) {
512
+ return /* @__PURE__ */ r("div", { className: "shrink-0 border-b border-slate-200 px-5 pb-3.5 pt-4 pr-12 dark:border-border", children: [
513
+ c && /* @__PURE__ */ r(
514
+ "button",
515
+ {
516
+ type: "button",
517
+ "data-da-back": "",
518
+ onClick: c,
519
+ className: "mb-1.5 inline-flex items-center gap-1 rounded px-1 py-0.5 text-[11.5px] font-medium text-sky-700 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-nvr-cyan",
520
+ children: [
521
+ /* @__PURE__ */ e(be, { className: "h-3 w-3", "aria-hidden": !0 }),
522
+ o
523
+ ]
524
+ }
525
+ ),
526
+ /* @__PURE__ */ e(j, { className: "line-clamp-2 text-[16px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-foreground", children: a }),
527
+ /* @__PURE__ */ e(ee, { className: "mt-0.5 text-[12px] text-slate-500 dark:text-muted-foreground", children: m })
528
+ ] });
529
+ }
530
+ function re({ items: a }) {
531
+ return /* @__PURE__ */ e("dl", { className: "grid grid-cols-[minmax(110px,max-content)_1fr] gap-x-6 gap-y-1.5 text-[12.5px]", children: a.map(({ k: m, v: c }) => /* @__PURE__ */ r("div", { className: "contents", children: [
532
+ /* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-muted-foreground", children: m }),
533
+ /* @__PURE__ */ e("dd", { className: "min-w-0 break-words text-slate-900 dark:text-foreground", children: c })
534
+ ] }, m)) });
535
+ }
536
+ function D({ title: a, children: m }) {
537
+ return /* @__PURE__ */ r("section", { children: [
538
+ /* @__PURE__ */ e("h4", { className: "mb-1.5 text-[12px] font-semibold text-slate-800 dark:text-foreground", children: a }),
539
+ m
540
+ ] });
541
+ }
542
+ function Be({
543
+ drill: a,
544
+ setParams: m,
545
+ summary: c
546
+ }) {
547
+ const o = a.leaf, s = a.where.length > 0 || a.label ? () => m((d) => d.delete("leaf")) : null, n = a.label ? `Back to ${a.label}` : "Back";
548
+ return o.source === "n" ? /* @__PURE__ */ e(
549
+ Oe,
550
+ {
551
+ id: o.id,
552
+ onBack: s,
553
+ backLabel: n,
554
+ summary: c,
555
+ setParams: m
556
+ }
557
+ ) : /* @__PURE__ */ e(Ue, { id: o.id, onBack: s, backLabel: n });
558
+ }
559
+ function ne() {
560
+ return /* @__PURE__ */ r("div", { className: "space-y-3 p-5", "aria-busy": "true", children: [
561
+ /* @__PURE__ */ e(j, { className: "sr-only", children: "Loading" }),
562
+ /* @__PURE__ */ e($, { className: "h-5 w-2/3" }),
563
+ /* @__PURE__ */ e($, { className: "h-24 w-full" }),
564
+ /* @__PURE__ */ e($, { className: "h-40 w-full" })
565
+ ] });
566
+ }
567
+ function Oe({
568
+ id: a,
569
+ onBack: m,
570
+ backLabel: c,
571
+ summary: o,
572
+ setParams: s
573
+ }) {
574
+ var p, I;
575
+ const n = A(), d = W(), u = P({
576
+ queryKey: ["delivery-analytics", "leaf", "n", a, o.acted_hours, o.asof],
577
+ queryFn: () => n.request(
578
+ // The figures' asof: the leaf's acted verdict is the one they counted.
579
+ F(`/delivery-analytics/notifications/${a}`, {
580
+ acted_hours: o.acted_hours,
581
+ asof: o.asof
582
+ })
583
+ ).then((h) => h.data),
584
+ staleTime: 6e4
585
+ });
586
+ if (u.isLoading) return /* @__PURE__ */ e(ne, {});
587
+ if (u.isError || !u.data)
588
+ return /* @__PURE__ */ r("div", { className: "p-5", children: [
589
+ /* @__PURE__ */ e(j, { className: "sr-only", children: "Notification" }),
590
+ /* @__PURE__ */ e(
591
+ K,
592
+ {
593
+ error: u.error,
594
+ what: "this notification",
595
+ onRetry: () => void u.refetch()
596
+ }
597
+ )
598
+ ] });
599
+ const t = u.data, y = d.record(t.collection, t.item), f = d.person((p = t.recipient) == null ? void 0 : p.id), b = d.person((I = t.sender) == null ? void 0 : I.id), R = t.read_at && t.timestamp ? (new Date(t.read_at).getTime() - new Date(t.timestamp).getTime()) / 6e4 : null;
600
+ return /* @__PURE__ */ r(S, { children: [
601
+ /* @__PURE__ */ e(
602
+ ae,
603
+ {
604
+ title: t.subject ?? "(no subject)",
605
+ sub: /* @__PURE__ */ r(S, { children: [
606
+ "Notification #",
607
+ t.id,
608
+ " · sent ",
609
+ k(t.timestamp)
610
+ ] }),
611
+ onBack: m,
612
+ backLabel: c
613
+ }
614
+ ),
615
+ /* @__PURE__ */ r("div", { className: "min-h-0 flex-1 space-y-5 overflow-y-auto bg-white p-5 dark:bg-background", children: [
616
+ /* @__PURE__ */ e(
617
+ re,
618
+ {
619
+ items: [
620
+ {
621
+ k: "To",
622
+ v: t.recipient ? /* @__PURE__ */ r(S, { children: [
623
+ /* @__PURE__ */ e(_, { href: f, onClick: f ? d.go(f) : void 0, children: t.recipient.name }),
624
+ /* @__PURE__ */ e("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
625
+ t.recipient.role,
626
+ t.recipient.status && t.recipient.status !== "active" ? t.recipient.status : null
627
+ ].filter(Boolean).map((h) => ` · ${h}`).join("") })
628
+ ] }) : "Nobody"
629
+ },
630
+ {
631
+ k: "From",
632
+ v: t.sender ? /* @__PURE__ */ e(_, { href: b, onClick: b ? d.go(b) : void 0, children: t.sender.name }) : "The system"
633
+ },
634
+ { k: "Category", v: v(t.category ?? "none") },
635
+ { k: "Lane", v: v(t.lane ?? "fyi") },
636
+ {
637
+ k: "Record",
638
+ v: y ? /* @__PURE__ */ r(_, { href: y, onClick: d.go(y), children: [
639
+ v(t.collection ?? ""),
640
+ " #",
641
+ t.item,
642
+ /* @__PURE__ */ e(M, { className: "h-3 w-3", "aria-hidden": !0 })
643
+ ] }) : t.collection ? `${v(t.collection)}${t.item ? ` #${t.item}` : ""}` : "None"
644
+ },
645
+ {
646
+ k: "Read",
647
+ v: t.status === "inbox" ? t.snoozed_until ? `Snoozed until ${k(t.snoozed_until)}` : "Not yet" : t.read_at ? `${k(t.read_at)} · ${te(R)} after it was sent` : `Yes (${t.status}) — no read time recorded`
648
+ }
649
+ ]
650
+ }
651
+ ),
652
+ /* @__PURE__ */ e(D, { title: "Why they got it", children: t.reason ? /* @__PURE__ */ r("div", { className: "rounded-lg border border-slate-200 px-3.5 py-3 text-[12.5px] dark:border-border", children: [
653
+ /* @__PURE__ */ r("p", { className: "font-medium text-slate-900 dark:text-foreground", children: [
654
+ t.reason.kind_label,
655
+ t.reason.critical && /* @__PURE__ */ e("span", { className: "ml-2", children: /* @__PURE__ */ e(E, { outcome: "failed", children: "Critical" }) })
656
+ ] }),
657
+ /* @__PURE__ */ e("p", { className: "mt-0.5 text-slate-600 dark:text-muted-foreground", children: t.reason.text }),
658
+ t.reason.rules.length > 0 && /* @__PURE__ */ e("ul", { className: "mt-2 space-y-0.5 text-[12px] text-slate-600 dark:text-muted-foreground", children: t.reason.rules.map((h, L) => (
659
+ // biome-ignore lint/suspicious/noArrayIndexKey: rules have no id
660
+ /* @__PURE__ */ r("li", { children: [
661
+ /* @__PURE__ */ r("span", { className: "text-slate-400", children: [
662
+ h.channel === "all" ? "All channels" : v(h.channel),
663
+ " ·",
664
+ " "
665
+ ] }),
666
+ h.text
667
+ ] }, L)
668
+ )) })
669
+ ] }) : /* @__PURE__ */ e("p", { className: "text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "Not recorded — this notification was sent before the reason was stored." }) }),
670
+ /* @__PURE__ */ r(D, { title: "Where it went", children: [
671
+ /* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-lg border border-slate-200 dark:border-border", children: /* @__PURE__ */ e("table", { className: "w-full text-[12.5px]", children: /* @__PURE__ */ e("tbody", { children: t.channels.map((h) => /* @__PURE__ */ r(
672
+ "tr",
673
+ {
674
+ className: "border-b border-slate-100 last:border-0 dark:border-border/60",
675
+ children: [
676
+ /* @__PURE__ */ e("td", { className: "w-[110px] px-3 py-2 align-top font-medium text-slate-800 dark:text-foreground", children: h.channel === "inapp" ? "In-app" : h.channel === "sms" ? "SMS" : v(h.channel) }),
677
+ /* @__PURE__ */ r("td", { className: "px-3 py-2 align-top", children: [
678
+ /* @__PURE__ */ e(E, { outcome: h.outcome, children: h.label }),
679
+ h.reason && h.reason.replace(/\.$/, "") !== h.label.replace(/\.$/, "") && !h.reason.startsWith(h.label) && /* @__PURE__ */ e("p", { className: "mt-1 text-[12px] text-slate-600 dark:text-muted-foreground", children: h.reason })
680
+ ] }),
681
+ /* @__PURE__ */ e("td", { className: "whitespace-nowrap px-3 py-2 text-right align-top text-[11.5px] tabular-nums text-slate-500 dark:text-muted-foreground", children: h.at ? k(h.at) : "" })
682
+ ]
683
+ },
684
+ h.channel
685
+ )) }) }) }),
686
+ t.mail && /* @__PURE__ */ r("div", { className: "mt-2 rounded-lg border border-slate-200 px-3.5 py-3 text-[12.5px] dark:border-border", children: [
687
+ /* @__PURE__ */ r("p", { className: "flex flex-wrap items-center gap-2", children: [
688
+ /* @__PURE__ */ e(ue, { className: "h-3.5 w-3.5 text-slate-400", "aria-hidden": !0 }),
689
+ /* @__PURE__ */ r("span", { className: "font-medium text-slate-900 dark:text-foreground", children: [
690
+ "Email log #",
691
+ t.mail.id
692
+ ] }),
693
+ /* @__PURE__ */ e(
694
+ E,
695
+ {
696
+ outcome: t.mail.status === "sent" ? "delivered" : t.mail.status ?? "other",
697
+ children: t.mail.reason_label
698
+ }
699
+ ),
700
+ /* @__PURE__ */ e("span", { className: "flex-1" }),
701
+ /* @__PURE__ */ e(
702
+ "button",
703
+ {
704
+ type: "button",
705
+ onClick: () => s((h) => {
706
+ var L;
707
+ return h.set("leaf", `m:${(L = t.mail) == null ? void 0 : L.id}`);
708
+ }),
709
+ className: "font-medium text-sky-700 hover:underline dark:text-nvr-cyan",
710
+ children: "Open this email"
711
+ }
712
+ ),
713
+ /* @__PURE__ */ r(
714
+ _,
715
+ {
716
+ href: d.mailLog(t.mail.id),
717
+ onClick: d.mailLog(t.mail.id) ? d.go(String(d.mailLog(t.mail.id))) : void 0,
718
+ children: [
719
+ "Mail log ",
720
+ /* @__PURE__ */ e(M, { className: "h-3 w-3", "aria-hidden": !0 })
721
+ ]
722
+ }
723
+ )
724
+ ] }),
725
+ t.mail.hint && /* @__PURE__ */ e("p", { className: "mt-1 text-slate-600 dark:text-muted-foreground", children: t.mail.hint }),
726
+ t.mail.error && /* @__PURE__ */ e(
727
+ Z,
728
+ {
729
+ className: "mt-1.5",
730
+ description: { title: t.mail.reason_label, technical: t.mail.error },
731
+ action: "Send a notification email"
732
+ }
733
+ )
734
+ ] })
735
+ ] }),
736
+ /* @__PURE__ */ e(D, { title: `Acted within ${t.acted.hours} hours`, children: /* @__PURE__ */ r("p", { className: "text-[12.5px] text-slate-700 dark:text-foreground", children: [
737
+ /* @__PURE__ */ e("span", { "data-da-acted": t.acted.verdict, className: "font-medium", children: Te[t.acted.verdict] ?? t.acted.verdict }),
738
+ t.acted.verdict === "window_open" && ` The window stays open until ${k(t.acted.window_ends)}.`,
739
+ t.acted.actions.length > 0 && /* @__PURE__ */ e("span", { className: "block text-slate-600 dark:text-muted-foreground", children: t.acted.actions.map(
740
+ (h) => `${h.kind === "transition" ? "Moved the record" : h.kind === "comment" ? "Commented" : "Completed a task"} ${k(h.at)}`
741
+ ).join(" · ") })
742
+ ] }) }),
743
+ /* @__PURE__ */ e(D, { title: "Message", children: t.message_hidden ? /* @__PURE__ */ e("p", { className: "text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "Not shown: this notification can quote a private conversation." }) : t.message ? /* @__PURE__ */ e("p", { className: "whitespace-pre-wrap rounded-lg bg-slate-50 px-3.5 py-3 text-[12.5px] text-slate-800 dark:bg-muted/40 dark:text-foreground", children: t.message }) : /* @__PURE__ */ e("p", { className: "text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "No message text." }) })
744
+ ] })
745
+ ] });
746
+ }
747
+ function Ue({
748
+ id: a,
749
+ onBack: m,
750
+ backLabel: c
751
+ }) {
752
+ const o = A(), s = W(), [n, d] = V(!1), u = P({
753
+ queryKey: ["delivery-analytics", "leaf", "m", a, n],
754
+ queryFn: () => o.request(
755
+ F(`/delivery-analytics/mail/${a}`, n ? { reveal: 1 } : void 0)
756
+ ).then((b) => b.data),
757
+ staleTime: Number.POSITIVE_INFINITY,
758
+ gcTime: 0,
759
+ refetchOnWindowFocus: !1,
760
+ refetchOnReconnect: !1,
761
+ retry: !1
762
+ });
763
+ if (u.isLoading) return /* @__PURE__ */ e(ne, {});
764
+ if (u.isError || !u.data)
765
+ return /* @__PURE__ */ r("div", { className: "p-5", children: [
766
+ /* @__PURE__ */ e(j, { className: "sr-only", children: "Email" }),
767
+ /* @__PURE__ */ e(K, { error: u.error, what: "this email", onRetry: () => void u.refetch() })
768
+ ] });
769
+ const t = u.data, y = s.record(t.collection, t.item), f = s.mailLog(t.id);
770
+ return /* @__PURE__ */ r(S, { children: [
771
+ /* @__PURE__ */ e(
772
+ ae,
773
+ {
774
+ title: t.subject ?? "(no subject)",
775
+ sub: /* @__PURE__ */ r(S, { children: [
776
+ "Email log #",
777
+ t.id,
778
+ " · ",
779
+ k(t.created_at)
780
+ ] }),
781
+ onBack: m,
782
+ backLabel: c
783
+ }
784
+ ),
785
+ /* @__PURE__ */ r("div", { className: "min-h-0 flex-1 space-y-5 overflow-y-auto bg-white p-5 dark:bg-background", children: [
786
+ /* @__PURE__ */ r("div", { className: "rounded-lg border border-slate-200 px-3.5 py-3 text-[12.5px] dark:border-border", children: [
787
+ /* @__PURE__ */ r("p", { className: "flex flex-wrap items-center gap-2", children: [
788
+ /* @__PURE__ */ e(E, { outcome: t.outcome, children: t.outcome_label }),
789
+ t.reason_label !== t.outcome_label && /* @__PURE__ */ e("span", { className: "font-medium text-slate-900 dark:text-foreground", children: t.reason_label })
790
+ ] }),
791
+ t.hint && /* @__PURE__ */ e("p", { className: "mt-1 text-slate-600 dark:text-muted-foreground", children: t.hint }),
792
+ t.error && /* @__PURE__ */ e(
793
+ Z,
794
+ {
795
+ className: "mt-1.5",
796
+ description: { title: t.reason_label, technical: t.error },
797
+ action: "Send an email"
798
+ }
799
+ )
800
+ ] }),
801
+ /* @__PURE__ */ e(
802
+ re,
803
+ {
804
+ items: [
805
+ {
806
+ k: "To",
807
+ v: /* @__PURE__ */ r(S, { children: [
808
+ t.to ?? "–",
809
+ t.recipients.length > 0 && /* @__PURE__ */ e("span", { className: "block text-[12px]", children: t.recipients.map((b, R) => {
810
+ const p = s.person(b.id);
811
+ return /* @__PURE__ */ r("span", { children: [
812
+ R > 0 && ", ",
813
+ /* @__PURE__ */ e(_, { href: p, onClick: p ? s.go(p) : void 0, children: b.name })
814
+ ] }, b.id);
815
+ }) })
816
+ ] })
817
+ },
818
+ { k: "Template", v: t.template ?? "None" },
819
+ {
820
+ k: "Record",
821
+ v: y ? /* @__PURE__ */ r(_, { href: y, onClick: s.go(y), children: [
822
+ v(t.collection ?? ""),
823
+ " #",
824
+ t.item,
825
+ /* @__PURE__ */ e(M, { className: "h-3 w-3", "aria-hidden": !0 })
826
+ ] }) : t.collection ? `${v(t.collection)}${t.item ? ` #${t.item}` : ""}` : "None"
827
+ },
828
+ ...t.resend_of ? [{ k: "Resend of", v: `Email log #${t.resend_of}` }] : [],
829
+ {
830
+ k: "Mail log",
831
+ v: /* @__PURE__ */ r(_, { href: f, onClick: f ? s.go(f) : void 0, children: [
832
+ "Open this row in the Mail log ",
833
+ /* @__PURE__ */ e(M, { className: "h-3 w-3", "aria-hidden": !0 })
834
+ ] })
835
+ }
836
+ ]
837
+ }
838
+ ),
839
+ /* @__PURE__ */ e(D, { title: "The email as sent", children: t.body_withheld ? /* @__PURE__ */ r(
840
+ "div",
841
+ {
842
+ "data-da-withheld": "",
843
+ className: "rounded-lg border border-slate-200 px-3.5 py-3 text-[12.5px] dark:border-border",
844
+ children: [
845
+ /* @__PURE__ */ e("p", { className: "text-slate-700 dark:text-foreground", children: "This email quotes a private chat, so its text is not shown here." }),
846
+ /* @__PURE__ */ e(
847
+ "button",
848
+ {
849
+ type: "button",
850
+ onClick: () => d(!0),
851
+ className: "mt-2 inline-flex h-7 items-center rounded-md border border-slate-200 px-2.5 text-[12px] font-medium text-slate-700 hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:border-border dark:text-foreground dark:hover:bg-muted",
852
+ children: "Show (logged compliance view)"
853
+ }
854
+ )
855
+ ]
856
+ }
857
+ ) : t.body ? /* @__PURE__ */ e(
858
+ "iframe",
859
+ {
860
+ title: "Rendered email",
861
+ sandbox: "",
862
+ srcDoc: qe(t.body),
863
+ className: "h-[520px] w-full rounded-md border border-slate-200 bg-white dark:border-border"
864
+ }
865
+ ) : /* @__PURE__ */ r("p", { className: "text-[12.5px] text-slate-500 dark:text-muted-foreground", children: [
866
+ "No stored body for this row",
867
+ t.status === "dropped" || t.status === "deferred" ? " — it was never sent." : "."
868
+ ] }) })
869
+ ] })
870
+ ] });
871
+ }
872
+ export {
873
+ Ze as DrillSheet,
874
+ Re as EMAIL_CSP,
875
+ qe as sandboxedEmail
876
+ };