@nivaro/react 0.3.83 → 0.3.84

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.
@@ -1,109 +1,110 @@
1
1
  import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
2
  import { useQuery as _ } from "@tanstack/react-query";
3
- import { UserCheck as q, Mail as D, Phone as F, Building2 as z, User as L, Clock as K, MessageCircle as W, ExternalLink as H, RefreshCw as J, LogOut as Z } from "lucide-react";
4
- import R, { useState as S, useRef as C, useEffect as $ } from "react";
3
+ import { UserCheck as q, Mail as D, Phone as F, Building2 as z, User as T, Clock as K, MessageCircle as W, ExternalLink as H, RefreshCw as J, LogOut as Z } from "lucide-react";
4
+ import M, { useState as j, useRef as C, useEffect as R } from "react";
5
5
  import { createPortal as V } from "react-dom";
6
- import { useOptionalNivaroClient as T, useNavigation as G, useItemEditAuth as X } from "../../context.js";
7
- import { get as B, post as Y } from "../../lib/commands.js";
8
- import { userCardQuery as M } from "../../lib/user-cards.js";
9
- import { cn as P } from "../../lib/utils.js";
10
- import { canOpenDm as A, openDmWith as I } from "../chat/chat-core.js";
6
+ import { useOptionalNivaroClient as O, useNavigation as G, useItemEditAuth as X } from "../../context.js";
7
+ import { get as $, post as Y } from "../../lib/commands.js";
8
+ import { userCardQuery as B } from "../../lib/user-cards.js";
9
+ import { cn as S } from "../../lib/utils.js";
10
+ import { canOpenDm as I, openDmWith as A } from "../chat/chat-core.js";
11
11
  import { HuddlePresenceLine as Q } from "../chat/huddle/HuddleLiveBadge.js";
12
12
  import { useHuddleLive as ee } from "../chat/huddle/huddle-live.js";
13
13
  import { MailSuppressedPill as te } from "../profile/MailSuppressedPill.js";
14
- import { useReloadTheirTabs as ae, useSignOutEverywhere as ne } from "../profile/session-actions.js";
15
- import { useCardPresence as re } from "../profile/usePersonPresence.js";
16
- import { UserAvatar as j } from "../UserAvatar.js";
17
- import { Popover as le, PopoverTrigger as ie, PopoverContent as se } from "../ui/popover.js";
18
- function E(e, n, s) {
19
- const i = C(n);
20
- i.current = n;
21
- const d = C(s);
22
- d.current = s, $(() => {
14
+ import { SignOutMessageInput as ae } from "../profile/SignOutMessageInput.js";
15
+ import { useReloadTheirTabs as ne, useSignOutEverywhere as re } from "../profile/session-actions.js";
16
+ import { useCardPresence as le } from "../profile/usePersonPresence.js";
17
+ import { UserAvatar as P } from "../UserAvatar.js";
18
+ import { Popover as se, PopoverTrigger as ie, PopoverContent as oe } from "../ui/popover.js";
19
+ function E(e, n, i) {
20
+ const s = C(n);
21
+ s.current = n;
22
+ const d = C(i);
23
+ d.current = i, R(() => {
23
24
  if (!e) return;
24
25
  const o = (r) => {
25
26
  const p = r.target;
26
- p && i.current(p) || d.current();
27
- }, c = () => d.current();
28
- return document.addEventListener("pointerdown", o, !0), window.addEventListener("blur", c), () => {
29
- document.removeEventListener("pointerdown", o, !0), window.removeEventListener("blur", c);
27
+ p && s.current(p) || d.current();
28
+ }, m = () => d.current();
29
+ return document.addEventListener("pointerdown", o, !0), window.addEventListener("blur", m), () => {
30
+ document.removeEventListener("pointerdown", o, !0), window.removeEventListener("blur", m);
30
31
  };
31
32
  }, [e]);
32
33
  }
33
- function oe(e) {
34
+ function de(e) {
34
35
  const n = String(e ?? "").trim();
35
- return !n || /^redacted\b/i.test(n) ? "" : n.split(/\s+/).map((s) => s[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
36
+ return !n || /^redacted\b/i.test(n) ? "" : n.split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
36
37
  }
37
- function de(e, n) {
38
- const s = String(e ?? "").trim();
39
- return s || [n == null ? void 0 : n.first_name, n == null ? void 0 : n.last_name].filter(Boolean).join(" ").trim();
38
+ function ce(e, n) {
39
+ const i = String(e ?? "").trim();
40
+ return i || [n == null ? void 0 : n.first_name, n == null ? void 0 : n.last_name].filter(Boolean).join(" ").trim();
40
41
  }
41
- function ce({
42
+ function me({
42
43
  user: e,
43
44
  avatarCls: n
44
45
  }) {
45
- const s = T(), { data: i } = _({
46
- ...M(s, e.id),
47
- enabled: !!s && !!e.id && !String(e.name ?? "").trim(),
46
+ const i = O(), { data: s } = _({
47
+ ...B(i, e.id),
48
+ enabled: !!i && !!e.id && !String(e.name ?? "").trim(),
48
49
  staleTime: 30 * 6e4,
49
50
  retry: !1
50
- }), d = de(e.name, i), o = oe(d), c = /^redacted\b/i.test(d);
51
+ }), d = ce(e.name, s), o = de(d), m = /^redacted\b/i.test(d);
51
52
  return /* @__PURE__ */ t(
52
53
  "span",
53
54
  {
54
55
  className: "inline-flex",
55
- "data-tip": c ? "Former user (account redacted)" : d || void 0,
56
+ "data-tip": m ? "Former user (account redacted)" : d || void 0,
56
57
  children: /* @__PURE__ */ t(
57
- j,
58
+ P,
58
59
  {
59
60
  userId: e.id,
60
61
  className: "h-6 w-6 border-2 border-white dark:border-slate-900",
61
- fallback: /* @__PURE__ */ t("span", { "data-copy-skip": !0, "aria-hidden": "true", className: n, children: o || /* @__PURE__ */ t(L, { className: "h-3 w-3", "aria-hidden": !0 }) })
62
+ fallback: /* @__PURE__ */ t("span", { "data-copy-skip": !0, "aria-hidden": "true", className: n, children: o || /* @__PURE__ */ t(T, { className: "h-3 w-3", "aria-hidden": !0 }) })
62
63
  }
63
64
  )
64
65
  }
65
66
  );
66
67
  }
67
- function me(e) {
68
+ function pe(e) {
68
69
  if (e.length === 0) return null;
69
- const n = e.find((s) => !s.inactive) ?? e[0];
70
+ const n = e.find((i) => !i.inactive) ?? e[0];
70
71
  return { name: n.name, more: e.length - 1, mark: n.inactive ?? null };
71
72
  }
72
- function pe({
73
+ function fe({
73
74
  users: e,
74
75
  showSingleName: n = !0,
75
- nameLabel: s = !1
76
+ nameLabel: i = !1
76
77
  }) {
77
- const i = C(null), d = C(null), o = C(null), [c, r] = S(null), [p, u] = S({ x: 0, y: 0 }), b = () => {
78
+ const s = C(null), d = C(null), o = C(null), [m, r] = j(null), [p, g] = j({ x: 0, y: 0 }), h = () => {
78
79
  o.current && clearTimeout(o.current), o.current = null;
79
- }, y = (a) => {
80
- var h;
81
- b();
82
- const x = (h = i.current) == null ? void 0 : h.getBoundingClientRect();
83
- x && u({ x: x.left, y: x.bottom + 6 }), r((f) => f === "pin" ? "pin" : a);
84
- }, m = () => {
85
- b(), o.current = setTimeout(() => r((a) => a === "pin" ? a : null), 160);
80
+ }, k = (a) => {
81
+ var b;
82
+ h();
83
+ const f = (b = s.current) == null ? void 0 : b.getBoundingClientRect();
84
+ f && g({ x: f.left, y: f.bottom + 6 }), r((x) => x === "pin" ? "pin" : a);
85
+ }, c = () => {
86
+ h(), o.current = setTimeout(() => r((a) => a === "pin" ? a : null), 160);
86
87
  };
87
- if (R.useLayoutEffect(() => {
88
- var g;
89
- if (!c) return;
88
+ if (M.useLayoutEffect(() => {
89
+ var u;
90
+ if (!m) return;
90
91
  const a = d.current;
91
92
  if (!a) return;
92
- const x = a.getBoundingClientRect();
93
- let { x: h, y: f } = p;
94
- if (x.right > window.innerWidth - 8 && (h = Math.max(8, window.innerWidth - x.width - 8)), x.bottom > window.innerHeight - 8) {
95
- const k = (g = i.current) == null ? void 0 : g.getBoundingClientRect();
96
- f = Math.max(8, ((k == null ? void 0 : k.top) ?? f) - x.height - 6);
93
+ const f = a.getBoundingClientRect();
94
+ let { x: b, y: x } = p;
95
+ if (f.right > window.innerWidth - 8 && (b = Math.max(8, window.innerWidth - f.width - 8)), f.bottom > window.innerHeight - 8) {
96
+ const y = (u = s.current) == null ? void 0 : u.getBoundingClientRect();
97
+ x = Math.max(8, ((y == null ? void 0 : y.top) ?? x) - f.height - 6);
97
98
  }
98
- (h !== p.x || f !== p.y) && u({ x: h, y: f });
99
- }, [c, p]), E(
100
- !!c,
99
+ (b !== p.x || x !== p.y) && g({ x: b, y: x });
100
+ }, [m, p]), E(
101
+ !!m,
101
102
  (a) => {
102
- var x, h, f;
103
+ var f, b, x;
103
104
  return (
104
105
  // Clicks inside the user-card popover (portaled by Radix) keep the
105
106
  // roster mounted — closing would unmount the card mid-click.
106
- !!((x = a.closest) != null && x.call(a, "[data-radix-popper-content-wrapper]")) || !!((h = d.current) != null && h.contains(a)) || !!((f = i.current) != null && f.contains(a))
107
+ !!((f = a.closest) != null && f.call(a, "[data-radix-popper-content-wrapper]")) || !!((b = d.current) != null && b.contains(a)) || !!((x = s.current) != null && x.contains(a))
107
108
  );
108
109
  },
109
110
  () => r(null)
@@ -113,21 +114,21 @@ function pe({
113
114
  return /* @__PURE__ */ l(
114
115
  "span",
115
116
  {
116
- ref: i,
117
- onMouseEnter: () => y("hover"),
118
- onMouseLeave: m,
117
+ ref: s,
118
+ onMouseEnter: () => k("hover"),
119
+ onMouseLeave: c,
119
120
  onClick: (a) => {
120
- a.stopPropagation(), y("pin");
121
+ a.stopPropagation(), k("pin");
121
122
  },
122
123
  className: "inline-flex cursor-pointer items-center",
123
124
  children: [
124
- /* @__PURE__ */ t("span", { className: "flex -space-x-2", children: w.map((a) => /* @__PURE__ */ t(ce, { user: a, avatarCls: N }, a.id)) }),
125
+ /* @__PURE__ */ t("span", { className: "flex -space-x-2", children: w.map((a) => /* @__PURE__ */ t(me, { user: a, avatarCls: N }, a.id)) }),
125
126
  v > 0 && /* @__PURE__ */ l("span", { className: "ml-1 rounded-full bg-slate-200 px-1.5 py-0.5 text-[10.5px] font-bold leading-none text-slate-600 dark:bg-slate-700 dark:text-slate-300", children: [
126
127
  "+",
127
128
  v
128
129
  ] }),
129
- s ? (() => {
130
- const a = me(e);
130
+ i ? (() => {
131
+ const a = pe(e);
131
132
  return a ? /* @__PURE__ */ l(
132
133
  "span",
133
134
  {
@@ -135,7 +136,7 @@ function pe({
135
136
  className: "ml-1.5 inline-flex max-w-[170px] items-baseline gap-1 text-[12px] font-medium text-slate-700 dark:text-slate-200",
136
137
  children: [
137
138
  /* @__PURE__ */ t("span", { className: "truncate", children: a.name }),
138
- a.mark && /* @__PURE__ */ t(O, { mark: a.mark }),
139
+ a.mark && /* @__PURE__ */ t(L, { mark: a.mark }),
139
140
  a.more > 0 && /* @__PURE__ */ l("span", { className: "shrink-0 text-slate-500 dark:text-slate-400", children: [
140
141
  "+",
141
142
  a.more
@@ -144,14 +145,14 @@ function pe({
144
145
  }
145
146
  ) : null;
146
147
  })() : n && e.length === 1 && /* @__PURE__ */ t("span", { className: "ml-1.5 max-w-[130px] truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: e[0].name }),
147
- c && V(
148
+ m && V(
148
149
  /* @__PURE__ */ l(
149
150
  "div",
150
151
  {
151
152
  ref: d,
152
- style: xe(i.current, p),
153
- onMouseEnter: b,
154
- onMouseLeave: m,
153
+ style: xe(s.current, p),
154
+ onMouseEnter: h,
155
+ onMouseLeave: c,
155
156
  onMouseDown: (a) => {
156
157
  a.stopPropagation(), r("pin");
157
158
  },
@@ -164,19 +165,19 @@ function pe({
164
165
  e.length === 1 ? "" : "s"
165
166
  ] }),
166
167
  e.map((a) => /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5 px-2 py-0.5", children: [
167
- /* @__PURE__ */ t(be, { userId: a.id, size: "compact" }),
168
- a.inactive && /* @__PURE__ */ t(O, { mark: a.inactive })
168
+ /* @__PURE__ */ t(ge, { userId: a.id, size: "compact" }),
169
+ a.inactive && /* @__PURE__ */ t(L, { mark: a.inactive })
169
170
  ] }, a.id))
170
171
  ]
171
172
  }
172
173
  ),
173
- U(i.current)
174
+ U(s.current)
174
175
  )
175
176
  ]
176
177
  }
177
178
  );
178
179
  }
179
- function O({ mark: e }) {
180
+ function L({ mark: e }) {
180
181
  return /* @__PURE__ */ t(
181
182
  "span",
182
183
  {
@@ -190,57 +191,57 @@ function U(e) {
190
191
  return (e == null ? void 0 : e.closest('[role="dialog"]')) ?? document.body;
191
192
  }
192
193
  function xe(e, n) {
193
- const s = U(e);
194
- if (s === document.body) return { position: "fixed", left: n.x, top: n.y, zIndex: 50 };
195
- const i = s.getBoundingClientRect();
196
- return { position: "absolute", left: n.x - i.left, top: n.y - i.top, zIndex: 120 };
194
+ const i = U(e);
195
+ if (i === document.body) return { position: "fixed", left: n.x, top: n.y, zIndex: 50 };
196
+ const s = i.getBoundingClientRect();
197
+ return { position: "absolute", left: n.x - s.left, top: n.y - s.top, zIndex: 120 };
197
198
  }
198
- function Be({
199
+ function Ee({
199
200
  collection: e,
200
201
  itemId: n
201
202
  }) {
202
- const s = T(), {
203
- data: i = [],
203
+ const i = O(), {
204
+ data: s = [],
204
205
  isLoading: d,
205
206
  isFetching: o
206
207
  } = _({
207
208
  queryKey: ["pipeline-owners-resolved", e, n],
208
- queryFn: () => s.request(Y(`/pipelines/instance/${e}/owners/batch`, { ids: [n] })).then((c) => {
209
+ queryFn: () => i.request(Y(`/pipelines/instance/${e}/owners/batch`, { ids: [n] })).then((m) => {
209
210
  var r;
210
- return ((r = c.data) == null ? void 0 : r[n]) ?? [];
211
+ return ((r = m.data) == null ? void 0 : r[n]) ?? [];
211
212
  }),
212
- enabled: !!s && !!e && !!n && n !== "new",
213
+ enabled: !!i && !!e && !!n && n !== "new",
213
214
  staleTime: 3e4,
214
215
  // Keep this RECORD's last answer while a move re-asks (the tile used to go
215
216
  // blank for ~2 s after Submit) — never another record's (b01-N15).
216
- placeholderData: (c, r) => (r == null ? void 0 : r.queryKey[1]) === e && String(r == null ? void 0 : r.queryKey[2]) === String(n) ? c : void 0
217
+ placeholderData: (m, r) => (r == null ? void 0 : r.queryKey[1]) === e && String(r == null ? void 0 : r.queryKey[2]) === String(n) ? m : void 0
217
218
  });
218
- return d || o && i.length === 0 ? /* @__PURE__ */ t("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" }) : /* @__PURE__ */ t(pe, { users: i, nameLabel: !0 });
219
+ return d || o && s.length === 0 ? /* @__PURE__ */ t("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" }) : /* @__PURE__ */ t(fe, { users: s, nameLabel: !0 });
219
220
  }
220
- function Me({
221
+ function Ue({
221
222
  collection: e,
222
223
  itemId: n,
223
- label: s
224
+ label: i
224
225
  }) {
225
- const i = T(), { data: d = [] } = _({
226
+ const s = O(), { data: d = [] } = _({
226
227
  queryKey: ["pipeline-instance-owners", e, n],
227
- queryFn: () => i.request(B(`/pipelines/instance/${e}/${n}/owners`)).then((r) => r.data ?? []),
228
- enabled: !!i && !!e && !!n && n !== "new",
228
+ queryFn: () => s.request($(`/pipelines/instance/${e}/${n}/owners`)).then((r) => r.data ?? []),
229
+ enabled: !!s && !!e && !!n && n !== "new",
229
230
  staleTime: 3e4
230
- }), o = (r) => [r.first_name, r.last_name].filter(Boolean).join(" ") || r.email, c = (r) => o(r).split(" ").map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
231
+ }), o = (r) => [r.first_name, r.last_name].filter(Boolean).join(" ") || r.email, m = (r) => o(r).split(" ").map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
231
232
  return /* @__PURE__ */ l("div", { children: [
232
- /* @__PURE__ */ t("p", { className: "text-[11px] font-medium text-slate-400 mb-1.5", children: s }),
233
+ /* @__PURE__ */ t("p", { className: "text-[11px] font-medium text-slate-400 mb-1.5", children: i }),
233
234
  d.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: d.map((r) => /* @__PURE__ */ l(
234
235
  "div",
235
236
  {
236
237
  className: "flex items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-0.5 pr-2.5",
237
238
  children: [
238
239
  /* @__PURE__ */ t(
239
- j,
240
+ P,
240
241
  {
241
242
  userId: r.id,
242
243
  className: "h-6 w-6",
243
- fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: c(r) })
244
+ fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: m(r) })
244
245
  }
245
246
  ),
246
247
  /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700", children: o(r) })
@@ -250,65 +251,65 @@ function Me({
250
251
  )) })
251
252
  ] });
252
253
  }
253
- function fe({
254
+ function he({
254
255
  user: e,
255
256
  userId: n,
256
- initials: s,
257
- navigate: i,
257
+ initials: i,
258
+ navigate: s,
258
259
  profileUrl: d,
259
260
  online: o,
260
- cardId: c,
261
+ cardId: m,
261
262
  onAction: r,
262
263
  open: p = !1
263
264
  }) {
264
- var h;
265
- const { isAdmin: u, userId: b } = X(), y = !!b && b.toUpperCase() === n.toUpperCase(), m = re(n, p), w = ee().roomOf(n), v = ((h = e == null ? void 0 : e.manager_name) == null ? void 0 : h.trim()) || null, N = (() => {
266
- const f = e == null ? void 0 : e.timezone;
267
- if (!f) return null;
265
+ var b;
266
+ const { isAdmin: g, userId: h } = X(), k = !!h && h.toUpperCase() === n.toUpperCase(), c = le(n, p), w = ee().roomOf(n), v = ((b = e == null ? void 0 : e.manager_name) == null ? void 0 : b.trim()) || null, N = (() => {
267
+ const x = e == null ? void 0 : e.timezone;
268
+ if (!x) return null;
268
269
  try {
269
- const g = Intl.DateTimeFormat().resolvedOptions().timeZone;
270
- return f === g ? null : new Intl.DateTimeFormat(void 0, {
270
+ const u = Intl.DateTimeFormat().resolvedOptions().timeZone;
271
+ return x === u ? null : new Intl.DateTimeFormat(void 0, {
271
272
  hour: "numeric",
272
273
  minute: "2-digit",
273
- timeZone: f
274
+ timeZone: x
274
275
  }).format(/* @__PURE__ */ new Date());
275
276
  } catch {
276
277
  return null;
277
278
  }
278
- })(), x = !!o || !!m.word ? m.word ? null : "Just now" : e != null && e.last_access ? (() => {
279
- const f = Date.now() - new Date(e.last_access).getTime(), g = Math.floor(f / 6e4);
280
- if (g < 2) return "Just now";
281
- if (g < 60) return `${g}m ago`;
282
- const k = Math.floor(g / 60);
283
- return k < 24 ? `${k}h ago` : `${Math.floor(k / 24)}d ago`;
279
+ })(), f = !!o || !!c.word ? c.word ? null : "Just now" : e != null && e.last_access ? (() => {
280
+ const x = Date.now() - new Date(e.last_access).getTime(), u = Math.floor(x / 6e4);
281
+ if (u < 2) return "Just now";
282
+ if (u < 60) return `${u}m ago`;
283
+ const y = Math.floor(u / 60);
284
+ return y < 24 ? `${y}h ago` : `${Math.floor(y / 24)}d ago`;
284
285
  })() : null;
285
286
  return /* @__PURE__ */ l(
286
- se,
287
+ oe,
287
288
  {
288
289
  align: "start",
289
290
  className: "w-72 p-0 overflow-hidden",
290
- "data-nvr-user-card": c ?? "",
291
+ "data-nvr-user-card": m ?? "",
291
292
  children: [
292
293
  /* @__PURE__ */ l("div", { className: "flex items-center gap-3 p-4 bg-gradient-to-br from-nvr-cyan/8 to-nvr-cyan/4 dark:from-nvr-cyan/10 dark:to-transparent border-b border-slate-100 dark:border-border", children: [
293
294
  /* @__PURE__ */ t(
294
- j,
295
+ P,
295
296
  {
296
297
  userId: n,
297
298
  className: "h-12 w-12 ring-2 ring-white shadow-sm dark:ring-card",
298
- fallback: /* @__PURE__ */ t("span", { className: "flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[15px] font-bold text-nvr-navy dark:text-nvr-cyan ring-2 ring-white dark:ring-card shadow-sm", children: s })
299
+ fallback: /* @__PURE__ */ t("span", { className: "flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[15px] font-bold text-nvr-navy dark:text-nvr-cyan ring-2 ring-white dark:ring-card shadow-sm", children: i })
299
300
  }
300
301
  ),
301
302
  /* @__PURE__ */ l("div", { className: "min-w-0 flex-1", children: [
302
303
  /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
303
- (o || m.word) && /* @__PURE__ */ t(
304
+ (o || c.word) && /* @__PURE__ */ t(
304
305
  "span",
305
306
  {
306
- "data-card-presence": m.word ?? "online",
307
- className: P(
307
+ "data-card-presence": c.word ?? "online",
308
+ className: S(
308
309
  "h-2 w-2 shrink-0 rounded-full ring-2 ring-white dark:ring-card",
309
- m.word === "away" ? "bg-white ring-amber-400 dark:bg-card" : m.word === "idle" ? "bg-amber-400" : "bg-emerald-400"
310
+ c.word === "away" ? "bg-white ring-amber-400 dark:bg-card" : c.word === "idle" ? "bg-amber-400" : "bg-emerald-400"
310
311
  ),
311
- title: m.word === "away" ? "Away" : m.word === "idle" ? "Idle" : "Online"
312
+ title: c.word === "away" ? "Away" : c.word === "idle" ? "Idle" : "Online"
312
313
  }
313
314
  ),
314
315
  /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100 truncate", children: e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : n }),
@@ -321,14 +322,14 @@ function fe({
321
322
  )
322
323
  ] }),
323
324
  ((e == null ? void 0 : e.title) || (e == null ? void 0 : e.department)) && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-500 dark:text-slate-400 truncate mt-0.5", children: [e.title, e.department].filter(Boolean).join(" · ") }),
324
- m.word && /* @__PURE__ */ l(
325
+ c.word && /* @__PURE__ */ l(
325
326
  "p",
326
327
  {
327
328
  className: "mt-0.5 truncate text-[11px] text-slate-500 dark:text-slate-400",
328
329
  "data-card-presence-line": !0,
329
330
  children: [
330
- m.word === "away" ? "Away" : m.word === "idle" ? `Idle${m.minutes ? ` · ${m.minutes}m` : ""}` : "Online now",
331
- m.page ? ` · on ${m.page}` : ""
331
+ c.word === "away" ? "Away" : c.word === "idle" ? `Idle${c.minutes ? ` · ${c.minutes}m` : ""}` : "Online now",
332
+ c.page ? ` · on ${c.page}` : ""
332
333
  ]
333
334
  }
334
335
  ),
@@ -346,7 +347,7 @@ function fe({
346
347
  {
347
348
  email: e == null ? void 0 : e.email,
348
349
  enabled: p,
349
- canClear: u,
350
+ canClear: g,
350
351
  className: "mt-1"
351
352
  }
352
353
  )
@@ -376,24 +377,24 @@ function fe({
376
377
  }
377
378
  )
378
379
  ] }),
379
- ((e == null ? void 0 : e.role_name) || v || x) && /* @__PURE__ */ l("div", { className: "px-4 py-3 space-y-1.5 border-b border-slate-100 dark:border-border", children: [
380
+ ((e == null ? void 0 : e.role_name) || v || f) && /* @__PURE__ */ l("div", { className: "px-4 py-3 space-y-1.5 border-b border-slate-100 dark:border-border", children: [
380
381
  (e == null ? void 0 : e.role_name) && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-500 dark:text-slate-400", children: [
381
382
  /* @__PURE__ */ t(z, { className: "h-3.5 w-3.5 shrink-0" }),
382
383
  /* @__PURE__ */ t("span", { children: e.role_name })
383
384
  ] }),
384
385
  v && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-500 dark:text-slate-400", children: [
385
- /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5 shrink-0" }),
386
+ /* @__PURE__ */ t(T, { className: "h-3.5 w-3.5 shrink-0" }),
386
387
  /* @__PURE__ */ l("span", { children: [
387
388
  "Reports to",
388
389
  " ",
389
390
  /* @__PURE__ */ t("span", { className: "font-medium text-slate-600 dark:text-slate-300", children: v })
390
391
  ] })
391
392
  ] }),
392
- x && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-400", children: [
393
+ f && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-400", children: [
393
394
  /* @__PURE__ */ t(K, { className: "h-3.5 w-3.5 shrink-0" }),
394
395
  /* @__PURE__ */ l("span", { children: [
395
396
  "Last seen ",
396
- x
397
+ f
397
398
  ] })
398
399
  ] })
399
400
  ] }),
@@ -403,21 +404,21 @@ function fe({
403
404
  {
404
405
  type: "button",
405
406
  onClick: () => {
406
- r == null || r(), i(d);
407
+ r == null || r(), s(d);
407
408
  },
408
409
  className: "flex flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-2 py-1.5 text-[11px] font-medium text-slate-600 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-accent transition-colors",
409
410
  children: [
410
- /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" }),
411
+ /* @__PURE__ */ t(T, { className: "h-3.5 w-3.5" }),
411
412
  " View profile"
412
413
  ]
413
414
  }
414
415
  ),
415
- A() && /* @__PURE__ */ l(
416
+ I() && /* @__PURE__ */ l(
416
417
  "button",
417
418
  {
418
419
  type: "button",
419
420
  onClick: () => {
420
- r == null || r(), I(
421
+ r == null || r(), A(
421
422
  n,
422
423
  e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : void 0
423
424
  );
@@ -444,8 +445,8 @@ function fe({
444
445
  }
445
446
  )
446
447
  ] }),
447
- u && !y && /* @__PURE__ */ t(
448
- he,
448
+ g && !k && /* @__PURE__ */ t(
449
+ be,
449
450
  {
450
451
  userId: n,
451
452
  name: e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : n,
@@ -456,97 +457,101 @@ function fe({
456
457
  }
457
458
  );
458
459
  }
459
- function he({
460
+ function be({
460
461
  userId: e,
461
462
  name: n,
462
- onDone: s
463
+ onDone: i
463
464
  }) {
464
- const [i, d] = S(!1);
465
- $(() => {
466
- if (!i) return;
467
- const p = setTimeout(() => d(!1), 4e3);
468
- return () => clearTimeout(p);
469
- }, [i]);
470
- const o = ae(e, { onDone: s }), c = ne(e, n, { onDone: s }), r = "flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] font-medium transition-colors disabled:opacity-50";
471
- return /* @__PURE__ */ l(
472
- "div",
473
- {
474
- className: "flex items-center gap-1 border-t border-slate-100 p-2 dark:border-border",
475
- "data-user-card-admin": !0,
476
- children: [
477
- /* @__PURE__ */ l(
478
- "button",
479
- {
480
- type: "button",
481
- disabled: o.isPending,
482
- onClick: () => o.mutate({}),
483
- "data-tip": "Every tab they have open shows a 15-second countdown, then reloads",
484
- className: P(
485
- r,
486
- "text-amber-800 hover:bg-amber-50 dark:text-amber-300 dark:hover:bg-amber-500/10"
487
- ),
488
- "data-user-card-reload": !0,
489
- children: [
490
- /* @__PURE__ */ t(J, { className: P("h-3.5 w-3.5", o.isPending && "animate-spin") }),
491
- o.isPending ? "Sending…" : "Reload tabs"
492
- ]
493
- }
494
- ),
495
- /* @__PURE__ */ l(
496
- "button",
497
- {
498
- type: "button",
499
- disabled: c.isPending,
500
- onClick: () => i ? c.mutate() : d(!0),
501
- "data-tip": i ? "Click again to sign them out of every session" : "Ends every session they have, on every app — they can sign in again",
502
- className: P(
503
- r,
504
- i ? "bg-red-600 text-white hover:bg-red-700" : "text-amber-800 hover:bg-amber-50 dark:text-amber-300 dark:hover:bg-amber-500/10"
505
- ),
506
- "data-user-card-sign-out": i ? "armed" : "",
507
- children: [
508
- /* @__PURE__ */ t(Z, { className: "h-3.5 w-3.5" }),
509
- c.isPending ? "Signing out…" : i ? "Confirm sign out" : "Sign out"
510
- ]
511
- }
512
- )
513
- ]
514
- }
515
- );
465
+ const [s, d] = j(!1), [o, m] = j("");
466
+ R(() => {
467
+ if (!s || o.trim()) return;
468
+ const k = setTimeout(() => d(!1), 1e4);
469
+ return () => clearTimeout(k);
470
+ }, [s, o]);
471
+ const r = ne(e, { onDone: i }), p = re(e, n, { onDone: i }), g = () => p.mutate({ message: o }), h = "flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] font-medium transition-colors disabled:opacity-50";
472
+ return /* @__PURE__ */ l("div", { className: "border-t border-slate-100 p-2 dark:border-border", "data-user-card-admin": !0, children: [
473
+ /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
474
+ /* @__PURE__ */ l(
475
+ "button",
476
+ {
477
+ type: "button",
478
+ disabled: r.isPending,
479
+ onClick: () => r.mutate({}),
480
+ "data-tip": "Every tab they have open shows a 15-second countdown, then reloads",
481
+ className: S(
482
+ h,
483
+ "text-amber-800 hover:bg-amber-50 dark:text-amber-300 dark:hover:bg-amber-500/10"
484
+ ),
485
+ "data-user-card-reload": !0,
486
+ children: [
487
+ /* @__PURE__ */ t(J, { className: S("h-3.5 w-3.5", r.isPending && "animate-spin") }),
488
+ r.isPending ? "Sending…" : "Reload tabs"
489
+ ]
490
+ }
491
+ ),
492
+ /* @__PURE__ */ l(
493
+ "button",
494
+ {
495
+ type: "button",
496
+ disabled: p.isPending,
497
+ onClick: () => s ? g() : d(!0),
498
+ "data-tip": s ? "Click again to sign them out of every session" : "Ends every session they have, on every app — they can sign in again",
499
+ className: S(
500
+ h,
501
+ s ? "bg-red-600 text-white hover:bg-red-700" : "text-amber-800 hover:bg-amber-50 dark:text-amber-300 dark:hover:bg-amber-500/10"
502
+ ),
503
+ "data-user-card-sign-out": s ? "armed" : "",
504
+ children: [
505
+ /* @__PURE__ */ t(Z, { className: "h-3.5 w-3.5" }),
506
+ p.isPending ? "Signing out…" : s ? "Confirm sign out" : "Sign out"
507
+ ]
508
+ }
509
+ )
510
+ ] }),
511
+ s && /* @__PURE__ */ t(
512
+ ae,
513
+ {
514
+ value: o,
515
+ onChange: m,
516
+ onSubmit: g,
517
+ className: "mt-2"
518
+ }
519
+ )
520
+ ] });
516
521
  }
517
- function be({
522
+ function ge({
518
523
  userId: e,
519
524
  size: n = "default",
520
- children: s
525
+ children: i
521
526
  }) {
522
- const i = T(), { navigate: d, userUrl: o } = G(), c = o ? o(e) : `/users/${e}`, [r, p] = S(!1), u = R.useId();
527
+ const s = O(), { navigate: d, userUrl: o } = G(), m = o ? o(e) : `/users/${e}`, [r, p] = j(!1), g = M.useId();
523
528
  E(
524
529
  r,
525
530
  (a) => {
526
- var x, h, f, g;
527
- return !!((x = a.closest) != null && x.call(a, `[data-nvr-user-card="${CSS.escape(u)}"]`)) || !!((h = a.closest) != null && h.call(a, `[data-nvr-user-chip="${CSS.escape(u)}"]`)) || // Anything else floating above the card (a tooltip, a nested menu).
528
- !!((f = a.closest) != null && f.call(a, "[data-radix-popper-content-wrapper]")) && !((g = a.closest) != null && g.call(a, "[data-nvr-user-card]"));
531
+ var f, b, x, u;
532
+ return !!((f = a.closest) != null && f.call(a, `[data-nvr-user-card="${CSS.escape(g)}"]`)) || !!((b = a.closest) != null && b.call(a, `[data-nvr-user-chip="${CSS.escape(g)}"]`)) || // Anything else floating above the card (a tooltip, a nested menu).
533
+ !!((x = a.closest) != null && x.call(a, "[data-radix-popper-content-wrapper]")) && !((u = a.closest) != null && u.call(a, "[data-nvr-user-card]"));
529
534
  },
530
535
  () => p(!1)
531
536
  );
532
- const { data: b, isLoading: y } = _({
533
- ...M(i, e),
534
- enabled: !!i && !!e,
537
+ const { data: h, isLoading: k } = _({
538
+ ...B(s, e),
539
+ enabled: !!s && !!e,
535
540
  staleTime: 12e4
536
- }), { data: m } = _({
541
+ }), { data: c } = _({
537
542
  queryKey: ["user-presence", e],
538
- queryFn: () => i.request(B(`/presence/users/${e}`)).then((a) => a),
539
- enabled: !!i && !!e && r,
543
+ queryFn: () => s.request($(`/presence/users/${e}`)).then((a) => a),
544
+ enabled: !!s && !!e && r,
540
545
  staleTime: 15e3,
541
546
  refetchInterval: r ? 2e4 : !1
542
- }), w = b ? [b.first_name, b.last_name].filter(Boolean).join(" ") || b.email : e, v = w.split(" ").map((a) => a[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), N = (m == null ? void 0 : m.online) ?? !1;
543
- return y && !s ? n === "compact" ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-0.5 pr-2.5", children: [
547
+ }), w = h ? [h.first_name, h.last_name].filter(Boolean).join(" ") || h.email : e, v = w.split(" ").map((a) => a[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), N = (c == null ? void 0 : c.online) ?? !1;
548
+ return k && !i ? n === "compact" ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-0.5 pr-2.5", children: [
544
549
  /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 rounded-full animate-pulse bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }),
545
550
  /* @__PURE__ */ t("span", { className: "animate-pulse h-2.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" })
546
- ] }) : /* @__PURE__ */ l(le, { open: r, onOpenChange: p, children: [
547
- /* @__PURE__ */ t(ie, { asChild: !0, "data-nvr-user-chip": u, children: s || (n === "compact" ? /* @__PURE__ */ l("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 dark:bg-slate-800 py-px pl-px pr-1.5 hover:bg-slate-200 dark:hover:bg-slate-700 transition-colors", children: [
551
+ ] }) : /* @__PURE__ */ l(se, { open: r, onOpenChange: p, children: [
552
+ /* @__PURE__ */ t(ie, { asChild: !0, "data-nvr-user-chip": g, children: i || (n === "compact" ? /* @__PURE__ */ l("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 dark:bg-slate-800 py-px pl-px pr-1.5 hover:bg-slate-200 dark:hover:bg-slate-700 transition-colors", children: [
548
553
  /* @__PURE__ */ t(
549
- j,
554
+ P,
550
555
  {
551
556
  userId: e,
552
557
  className: "h-4 w-4",
@@ -564,7 +569,7 @@ function be({
564
569
  /* @__PURE__ */ t("span", { className: "text-[11px] font-medium text-slate-600 dark:text-slate-300", children: w })
565
570
  ] }) : /* @__PURE__ */ l("div", { className: "inline-flex cursor-pointer items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-0.5 pr-2.5 hover:bg-slate-100 dark:border-border dark:bg-card dark:hover:bg-accent transition-colors", children: [
566
571
  /* @__PURE__ */ t(
567
- j,
572
+ P,
568
573
  {
569
574
  userId: e,
570
575
  className: "h-6 w-6",
@@ -582,15 +587,15 @@ function be({
582
587
  /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700 dark:text-slate-300", children: w })
583
588
  ] })) }),
584
589
  /* @__PURE__ */ t(
585
- fe,
590
+ he,
586
591
  {
587
- user: b,
592
+ user: h,
588
593
  userId: e,
589
594
  initials: v,
590
595
  navigate: d,
591
- profileUrl: c,
596
+ profileUrl: m,
592
597
  online: N,
593
- cardId: u,
598
+ cardId: g,
594
599
  onAction: () => p(!1),
595
600
  open: r
596
601
  }
@@ -598,12 +603,12 @@ function be({
598
603
  ] });
599
604
  }
600
605
  export {
601
- Me as OwnersInline,
602
- Be as OwnersInlineCompact,
603
- he as UserCardAdminRow,
604
- be as UserChip,
605
- pe as UserRosterCluster,
606
- oe as rosterInitials,
607
- me as rosterLabel,
608
- de as rosterName
606
+ Ue as OwnersInline,
607
+ Ee as OwnersInlineCompact,
608
+ be as UserCardAdminRow,
609
+ ge as UserChip,
610
+ fe as UserRosterCluster,
611
+ de as rosterInitials,
612
+ pe as rosterLabel,
613
+ ce as rosterName
609
614
  };