@nivaro/react 0.2.49 → 0.2.51

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,33 +1,33 @@
1
- import { jsxs as n, jsx as e, Fragment as ke } from "react/jsx-runtime";
2
- import { useQuery as be, useQueryClient as Dt, useMutation as Me } from "@tanstack/react-query";
3
- import { Search as Sa, Plus as Un, Hash as wt, Lock as Dn, ChevronLeft as st, X as lt, PinOff as $n, Pin as Nt, MapPin as An, PlayCircle as Rn, MessageCircle as Ta, Users as Ct, AtSign as Mn, AlarmClock as On, Sparkles as Ln, BellOff as _t, Star as Ua, ArchiveRestore as Da, Archive as $a, Bell as Aa, LogOut as Ra, ExternalLink as Pn, Video as jn, Check as rt, Info as In, Settings as qn, ArrowUpDown as En, HelpCircle as Wn, MessageSquareReply as Bn, Quote as Fn, ClipboardPlus as zn, NotebookPen as Hn, Bookmark as Gn, Pencil as Qn, Trash2 as Kn, AlertTriangle as Jn, Paperclip as Yn, CheckCheck as Zn, Plane as Vn, FilePlus2 as Xn } from "lucide-react";
4
- import { useState as U, useEffect as V, useMemo as he, useRef as ne, useContext as es } from "react";
5
- import { toast as de } from "sonner";
6
- import { useItemEditAuth as ot, useNavigation as ts, useNivaroClient as Ge } from "../../context.js";
7
- import { get as ue, post as Oe, patch as as } from "../../lib/commands.js";
8
- import { useLiveRecord as ns, batchTouches as ss, LIVE_ASPECTS as rs } from "../../lib/live.js";
9
- import { stuckText as ls } from "../../lib/presence-state.js";
10
- import { invalidateRecordTasks as os } from "../../lib/record-tasks.js";
11
- import { userCardQuery as is } from "../../lib/user-cards.js";
12
- import { cn as m, getDisplayTimezone as $t, formatRelative as Ma } from "../../lib/utils.js";
13
- import { CustomStatusEditor as cs } from "../CustomStatusEditor.js";
14
- import { DoNotDisturbRow as ds } from "../DoNotDisturb.js";
15
- import { FilePreviewLightbox as us } from "../FilePreviewLightbox.js";
16
- import { UserChip as Oa } from "../item-edit/UserChip.js";
17
- import { UserAvatar as ms } from "../UserAvatar.js";
1
+ import { jsxs as n, jsx as e, Fragment as ve } from "react/jsx-runtime";
2
+ import { useQuery as ge, useQueryClient as Dt, useMutation as Me } from "@tanstack/react-query";
3
+ import { Search as Da, Plus as Rn, Hash as wt, Lock as An, ChevronLeft as rt, X as lt, PinOff as Mn, Pin as Nt, PlayCircle as On, MessageCircle as $a, Users as Ct, AtSign as Ln, AlarmClock as Pn, Sparkles as In, BellOff as _t, Star as Ra, ArchiveRestore as Aa, Archive as Ma, Bell as Oa, LogOut as La, ExternalLink as jn, Video as qn, Check as st, Info as En, Settings as Wn, MapPin as Bn, ArrowUpDown as Fn, HelpCircle as zn, MessageSquareReply as Hn, Quote as Gn, ClipboardPlus as Qn, NotebookPen as Kn, Bookmark as Jn, Pencil as Yn, Trash2 as Zn, AlertTriangle as Vn, Paperclip as Xn, CheckCheck as er, Plane as tr, FilePlus2 as ar } from "lucide-react";
4
+ import { useState as D, useEffect as ee, useMemo as xe, useRef as le, useContext as nr } from "react";
5
+ import { toast as me } from "sonner";
6
+ import { useItemEditAuth as ot, useNavigation as rr, useNivaroClient as Ge } from "../../context.js";
7
+ import { get as he, post as Oe, patch as sr } from "../../lib/commands.js";
8
+ import { useLiveRecord as lr, batchTouches as or, LIVE_ASPECTS as ir } from "../../lib/live.js";
9
+ import { presencePlaceHref as va, stuckText as ya, fullHref as ka } from "../../lib/presence-state.js";
10
+ import { invalidateRecordTasks as cr } from "../../lib/record-tasks.js";
11
+ import { userCardQuery as dr } from "../../lib/user-cards.js";
12
+ import { cn as u, getDisplayTimezone as $t, formatRelative as Pa } from "../../lib/utils.js";
13
+ import { CustomStatusEditor as ur } from "../CustomStatusEditor.js";
14
+ import { DoNotDisturbRow as mr } from "../DoNotDisturb.js";
15
+ import { FilePreviewLightbox as hr } from "../FilePreviewLightbox.js";
16
+ import { UserChip as Ia } from "../item-edit/UserChip.js";
17
+ import { UserAvatar as pr } from "../UserAvatar.js";
18
18
  import { Popover as Qe, PopoverTrigger as Ke, PopoverContent as Je } from "../ui/popover.js";
19
- import { SimpleSelect as At } from "../ui/SimpleSelect.js";
20
- import { useBotStream as hs, BotStreamBubble as ps } from "./BotStream.js";
21
- import { ChannelExtrasEditor as xs, BulkInvitePanel as bs, ChannelAuditLog as fs } from "./ChannelExtras.js";
22
- import { ChannelTile as He, ChannelLookPicker as La } from "./ChannelLook.js";
23
- import { MentionsView as Pa, ScheduledView as ja, CatchUpView as Ia, useSearchFilterState as gs, FilterToggle as vs, ChatSettingsButton as ys, SearchFilterBar as ks } from "./ChatViews.js";
24
- import { ChatComposer as ws } from "./Composer.js";
25
- import { useMyPreferences as Rt, useSetMyPreferences as qa, useChatRoles as Ea, useChannelDirectory as Ns, useRoomMembership as Mt, useCreateChannel as Cs, useChatConfig as Te, useChannelMembers as Ot, useChannelAdmin as Wa, useUserSearch as Lt, GENERAL_CHANNEL_ID as Ba, useChatRooms as Fa, useArchivedRooms as za, dmRoom as St, CHAT_DEFAULTS as nt, ChatConfigContext as Ha, useChatBotInfo as Pt, useChatSearch as _s, dmPeer as ye, useChatMessages as Ss, useOpenRoomRegistration as Ts, useOutbox as Ga, useMarkRoomRead as Us, useTypingIndicator as Ds, usePeerReadAt as $s, useEntityRoomLink as As, useToggleReaction as Rs, useRoomPins as Ms, useTogglePin as Os, useEditMessage as Ls, useDeleteMessage as Ps, useChatBotName as js, useChatThread as Is, chatInitials as qs, chatAvatarColor as Es, useCreateGroupDm as Ws, canOpenDm as Bs, openDmWith as Fs, chatRoomTypesQuery as Qa, REACTION_EMOJI as zs } from "./chat-core.js";
26
- import { useRoomRecord as Ka, useRecordFileTargets as Hs } from "./chat-hooks.js";
27
- import { FormattedMessage as Gs, LinkPreviews as Qs } from "./MessageFormat.js";
28
- import { PollCard as Ks } from "./PollCard.js";
29
- import { MemberCountLine as Js, JumpToDate as Ys, ChannelIntro as Zs, WelcomeNote as Vs, OutboxBubbles as Ja, ThreadPane as Xs, RoomInfoDrawer as er } from "./RoomParts.js";
30
- const Ya = {
19
+ import { SimpleSelect as Rt } from "../ui/SimpleSelect.js";
20
+ import { useBotStream as xr, BotStreamBubble as fr } from "./BotStream.js";
21
+ import { ChannelExtrasEditor as br, BulkInvitePanel as gr, ChannelAuditLog as vr } from "./ChannelExtras.js";
22
+ import { ChannelTile as He, ChannelLookPicker as ja } from "./ChannelLook.js";
23
+ import { MentionsView as qa, ScheduledView as Ea, CatchUpView as Wa, useSearchFilterState as yr, FilterToggle as kr, ChatSettingsButton as wr, SearchFilterBar as Nr } from "./ChatViews.js";
24
+ import { ChatComposer as Cr } from "./Composer.js";
25
+ import { useMyPreferences as At, useSetMyPreferences as Ba, useChatRoles as Fa, useChannelDirectory as _r, useRoomMembership as Mt, useCreateChannel as Sr, useChatConfig as Ue, useChannelMembers as Ot, useChannelAdmin as za, useUserSearch as Lt, GENERAL_CHANNEL_ID as Ha, useChatRooms as Ga, useArchivedRooms as Qa, dmRoom as St, CHAT_DEFAULTS as nt, ChatConfigContext as Ka, useChatBotInfo as Pt, useChatSearch as Tr, dmPeer as Ne, useChatMessages as Ur, useOpenRoomRegistration as Dr, useOutbox as Ja, useMarkRoomRead as $r, useTypingIndicator as Rr, usePeerReadAt as Ar, useEntityRoomLink as Mr, useToggleReaction as Or, useRoomPins as Lr, useTogglePin as Pr, useEditMessage as Ir, useDeleteMessage as jr, useChatBotName as qr, useChatThread as Er, chatInitials as Wr, chatAvatarColor as Br, useCreateGroupDm as Fr, canOpenDm as zr, openDmWith as Hr, chatRoomTypesQuery as Ya, REACTION_EMOJI as Gr } from "./chat-core.js";
26
+ import { useRoomRecord as Za, useRecordFileTargets as Qr } from "./chat-hooks.js";
27
+ import { FormattedMessage as Kr, LinkPreviews as Jr } from "./MessageFormat.js";
28
+ import { PollCard as Yr } from "./PollCard.js";
29
+ import { MemberCountLine as Zr, JumpToDate as Vr, ChannelIntro as Xr, WelcomeNote as es, OutboxBubbles as Va, ThreadPane as ts, RoomInfoDrawer as as } from "./RoomParts.js";
30
+ const Xa = {
31
31
  bubbleMine: "bg-nvr-cyan text-white",
32
32
  bubbleOther: "bg-slate-100 text-slate-800 dark:bg-muted dark:text-slate-100",
33
33
  accentText: "text-nvr-navy dark:text-nvr-cyan",
@@ -37,111 +37,111 @@ const Ya = {
37
37
  surface: "bg-white dark:bg-card",
38
38
  input: "border-slate-200 bg-slate-50 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-slate-100",
39
39
  divider: "border-slate-100 dark:border-border/60"
40
- }, jt = {};
41
- jt.current = Ya;
42
- function tl({
40
+ }, It = {};
41
+ It.current = Xa;
42
+ function nl({
43
43
  children: t,
44
- me: s,
44
+ me: r,
45
45
  onlineUsers: o = [],
46
- collections: r,
46
+ collections: s,
47
47
  globalRoom: l = nt.globalRoom,
48
48
  globalLabel: i = nt.globalLabel,
49
49
  entityPattern: c = nt.entityPattern,
50
50
  entityUrl: d = () => null,
51
51
  roomLabel: h,
52
52
  recordUrl: x,
53
- sessionUrl: u,
54
- realtime: f,
53
+ sessionUrl: m,
54
+ realtime: b,
55
55
  subscribeRooms: v,
56
- setTypingRoom: D,
56
+ setTypingRoom: $,
57
57
  navigate: S,
58
58
  sound: C = !0,
59
59
  theme: T
60
60
  }) {
61
- const E = he(
61
+ const F = xe(
62
62
  () => ({
63
- collections: { ...nt.collections, ...r },
63
+ collections: { ...nt.collections, ...s },
64
64
  globalRoom: l,
65
65
  globalLabel: i,
66
66
  entityPattern: c,
67
67
  entityUrl: d,
68
68
  roomLabel: h,
69
69
  recordUrl: x,
70
- sessionUrl: u,
71
- realtime: f,
70
+ sessionUrl: m,
71
+ realtime: b,
72
72
  subscribeRooms: v,
73
- me: s,
73
+ me: r,
74
74
  onlineUsers: o,
75
- setTypingRoom: D,
75
+ setTypingRoom: $,
76
76
  navigate: S,
77
77
  sound: C
78
78
  }),
79
79
  // eslint-disable-next-line react-hooks/exhaustive-deps
80
80
  [
81
- s == null ? void 0 : s.id,
81
+ r == null ? void 0 : r.id,
82
82
  o,
83
- r,
83
+ s,
84
84
  l,
85
85
  i,
86
86
  c,
87
- f,
88
- D,
87
+ b,
88
+ $,
89
89
  C
90
90
  ]
91
91
  );
92
- return jt.current = { ...Ya, ...T }, /* @__PURE__ */ e(Ha.Provider, { value: E, children: t });
92
+ return It.current = { ...Xa, ...T }, /* @__PURE__ */ e(Ka.Provider, { value: F, children: t });
93
93
  }
94
- function se() {
95
- return jt.current;
94
+ function oe() {
95
+ return It.current;
96
96
  }
97
- const va = /* @__PURE__ */ new WeakMap();
98
- function tr(t, s) {
99
- const o = String(s).toUpperCase();
100
- let r = va.get(t);
101
- r || (r = { ids: /* @__PURE__ */ new Map(), timer: null }, va.set(t, r));
102
- const l = r;
97
+ const wa = /* @__PURE__ */ new WeakMap();
98
+ function ns(t, r) {
99
+ const o = String(r).toUpperCase();
100
+ let s = wa.get(t);
101
+ s || (s = { ids: /* @__PURE__ */ new Map(), timer: null }, wa.set(t, s));
102
+ const l = s;
103
103
  return new Promise((i) => {
104
104
  const c = l.ids.get(o) ?? [];
105
105
  c.push(i), l.ids.set(o, c), !l.timer && (l.timer = setTimeout(async () => {
106
106
  const d = new Map(l.ids);
107
107
  l.ids.clear(), l.timer = null;
108
108
  const h = [...d.keys()], x = /* @__PURE__ */ new Map();
109
- for (let u = 0; u < h.length; u += 100)
109
+ for (let m = 0; m < h.length; m += 100)
110
110
  try {
111
- const f = await t.request(
112
- ue("/presence/people", { ids: h.slice(u, u + 100).join(",") })
111
+ const b = await t.request(
112
+ he("/presence/people", { ids: h.slice(m, m + 100).join(",") })
113
113
  );
114
- for (const v of f.data ?? []) x.set(String(v.user_id).toUpperCase(), v);
114
+ for (const v of b.data ?? []) x.set(String(v.user_id).toUpperCase(), v);
115
115
  } catch {
116
116
  }
117
- for (const [u, f] of d) for (const v of f) v(x.get(u) ?? null);
117
+ for (const [m, b] of d) for (const v of b) v(x.get(m) ?? null);
118
118
  }, 0));
119
119
  });
120
120
  }
121
- function Za(t, s = !0) {
122
- const o = Ge(), { data: r } = be({
121
+ function en(t, r = !0) {
122
+ const o = Ge(), { data: s } = ge({
123
123
  queryKey: ["nvr-person-info", t ? String(t).toUpperCase() : null],
124
- queryFn: () => tr(o, t),
125
- enabled: !!t && s,
124
+ queryFn: () => ns(o, t),
125
+ enabled: !!t && r,
126
126
  staleTime: 6e4
127
127
  });
128
- return r ?? null;
128
+ return s ?? null;
129
129
  }
130
- function Va(t) {
131
- return t != null && t.last_seen ? `last seen ${Ma(t.last_seen)}` : null;
130
+ function tn(t) {
131
+ return t != null && t.last_seen ? `last seen ${Pa(t.last_seen)}` : null;
132
132
  }
133
- function Xa(t) {
134
- const s = es(Ha), o = an(), r = String(t).toUpperCase();
133
+ function an(t) {
134
+ const r = nr(Ka), o = sn(), s = String(t).toUpperCase();
135
135
  if (o.loaded) {
136
- const i = o.byUser.get(r);
136
+ const i = o.byUser.get(s);
137
137
  if (!i) return { state: "offline", title: "Offline", page: null };
138
- const c = i.page ?? nn(i.current_path);
138
+ const c = i.page ?? ln(i.current_path);
139
139
  return i.away ? { state: "away", title: "Away", page: null } : i.is_idle ? { state: "idle", title: Tt(i), page: c } : { state: "online", title: "Online", page: c };
140
140
  }
141
- const l = s == null ? void 0 : s.onlineUsers.find((i) => String(i.user_id).toUpperCase() === r);
141
+ const l = r == null ? void 0 : r.onlineUsers.find((i) => String(i.user_id).toUpperCase() === s);
142
142
  return l ? l.is_idle ? { state: "idle", title: Tt(l), page: null } : { state: "online", title: "Online", page: null } : { state: "offline", title: "Offline", page: null };
143
143
  }
144
- function en(t) {
144
+ function nn(t) {
145
145
  return t != null && t.out_of_office ? t.ooo_end ? `Out of office until ${new Date(t.ooo_end).toLocaleDateString(void 0, {
146
146
  weekday: "short",
147
147
  month: "short",
@@ -149,18 +149,18 @@ function en(t) {
149
149
  timeZone: $t() ?? void 0
150
150
  })}` : "Out of office" : null;
151
151
  }
152
- function ar({ id: t, size: s }) {
153
- const { state: o, title: r, page: l } = Xa(t), i = Za(t), c = o === "offline" ? Va(i) : null, d = en(i), h = s >= 30 ? 10 : 8, x = [
154
- c ? `Offline · ${c}` : r,
152
+ function rs({ id: t, size: r }) {
153
+ const { state: o, title: s, page: l } = an(t), i = en(t), c = o === "offline" ? tn(i) : null, d = nn(i), h = r >= 30 ? 10 : 8, x = [
154
+ c ? `Offline · ${c}` : s,
155
155
  l && o !== "offline" ? `On ${l}` : null,
156
156
  d,
157
157
  d && (i != null && i.delegate) ? `${i.delegate.name} is covering` : null
158
158
  ].filter(Boolean).join(" · ");
159
- return /* @__PURE__ */ n(ke, { children: [
159
+ return /* @__PURE__ */ n(ve, { children: [
160
160
  /* @__PURE__ */ e(
161
161
  "span",
162
162
  {
163
- className: m(
163
+ className: u(
164
164
  "absolute -bottom-0.5 -right-0.5 rounded-full border-2 border-white dark:border-card",
165
165
  o === "online" ? "bg-emerald-400" : o === "idle" || o === "away" ? "border-amber-400 bg-white dark:border-amber-400 dark:bg-card" : "bg-slate-300 dark:bg-slate-600"
166
166
  ),
@@ -180,16 +180,16 @@ function ar({ id: t, size: s }) {
180
180
  "data-chat-ooo": !0,
181
181
  title: x,
182
182
  "aria-label": d,
183
- children: /* @__PURE__ */ e(Vn, { style: { width: h - 3, height: h - 3 }, strokeWidth: 2.5 })
183
+ children: /* @__PURE__ */ e(tr, { style: { width: h - 3, height: h - 3 }, strokeWidth: 2.5 })
184
184
  }
185
185
  )
186
186
  ] });
187
187
  }
188
- function X({
188
+ function te({
189
189
  id: t,
190
- name: s,
190
+ name: r,
191
191
  size: o = 32,
192
- presence: r = !0
192
+ presence: s = !0
193
193
  }) {
194
194
  const l = Pt(), i = /* @__PURE__ */ e(
195
195
  "span",
@@ -198,57 +198,57 @@ function X({
198
198
  style: {
199
199
  width: o,
200
200
  height: o,
201
- backgroundColor: Es(t),
201
+ backgroundColor: Br(t),
202
202
  fontSize: o * 0.36
203
203
  },
204
204
  "aria-hidden": !0,
205
- children: qs(s)
205
+ children: Wr(r)
206
206
  }
207
207
  ), c = /* @__PURE__ */ e(
208
- ms,
208
+ pr,
209
209
  {
210
210
  userId: t,
211
211
  fallback: i,
212
212
  style: { width: o, height: o },
213
- alt: s ?? ""
213
+ alt: r ?? ""
214
214
  }
215
215
  ), d = t === "__bot__" || !!l.bot_user_id && String(l.bot_user_id).toUpperCase() === String(t).toUpperCase();
216
- return !r || d ? c : /* @__PURE__ */ n("span", { className: "relative inline-flex shrink-0", style: { width: o, height: o }, children: [
216
+ return !s || d ? c : /* @__PURE__ */ n("span", { className: "relative inline-flex shrink-0", style: { width: o, height: o }, children: [
217
217
  c,
218
- /* @__PURE__ */ e(ar, { id: t, size: o })
218
+ /* @__PURE__ */ e(rs, { id: t, size: o })
219
219
  ] });
220
220
  }
221
- function nr({ peerId: t, name: s }) {
222
- const o = Pt(), r = t === "__bot__" || !!o.bot_user_id && String(o.bot_user_id).toUpperCase() === t.toUpperCase(), l = /* @__PURE__ */ e(X, { id: t, name: s, size: 28 });
223
- return r ? /* @__PURE__ */ e("span", { className: "mr-1 inline-flex shrink-0", children: l }) : /* @__PURE__ */ e(Oa, { userId: t, children: /* @__PURE__ */ e(
221
+ function ss({ peerId: t, name: r }) {
222
+ const o = Pt(), s = t === "__bot__" || !!o.bot_user_id && String(o.bot_user_id).toUpperCase() === t.toUpperCase(), l = /* @__PURE__ */ e(te, { id: t, name: r, size: 28 });
223
+ return s ? /* @__PURE__ */ e("span", { className: "mr-1 inline-flex shrink-0", children: l }) : /* @__PURE__ */ e(Ia, { userId: t, children: /* @__PURE__ */ e(
224
224
  "button",
225
225
  {
226
226
  type: "button",
227
227
  className: "mr-1 shrink-0 rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
228
- "aria-label": `${s} — profile`,
228
+ "aria-label": `${r} — profile`,
229
229
  "data-chat-dm-header-avatar": !0,
230
230
  children: l
231
231
  }
232
232
  ) });
233
233
  }
234
- function ya({ token: t, url: s, mine: o }) {
235
- const r = Te(), l = se(), i = Ge(), { data: c } = be(Qa(i)), { data: d } = be({
234
+ function Na({ token: t, url: r, mine: o }) {
235
+ const s = Ue(), l = oe(), i = Ge(), { data: c } = ge(Ya(i)), { data: d } = ge({
236
236
  queryKey: ["nvr-chat-entity-card", t],
237
237
  queryFn: async () => {
238
- var u, f, v, D;
238
+ var m, b, v, $;
239
239
  for (const S of c ?? [])
240
240
  try {
241
- const T = (f = (u = (await i.request(
242
- ue(`/items/${S.collection}`, {
241
+ const T = (b = (m = (await i.request(
242
+ he(`/items/${S.collection}`, {
243
243
  limit: 1,
244
244
  fields: "id",
245
245
  filter: JSON.stringify({ [S.match_field]: { _eq: t } })
246
246
  })
247
- )).data) == null ? void 0 : u[0]) == null ? void 0 : f.id;
247
+ )).data) == null ? void 0 : m[0]) == null ? void 0 : b.id;
248
248
  if (T == null) continue;
249
- const k = (D = (v = (await i.request(
250
- ue(`/pipelines/instance/${S.collection}/${T}`)
251
- )).data) == null ? void 0 : v.instance) == null ? void 0 : D.current_state_obj;
249
+ const k = ($ = (v = (await i.request(
250
+ he(`/pipelines/instance/${S.collection}/${T}`)
251
+ )).data) == null ? void 0 : v.instance) == null ? void 0 : $.current_state_obj;
252
252
  return {
253
253
  collection: S.collection,
254
254
  id: T,
@@ -262,11 +262,11 @@ function ya({ token: t, url: s, mine: o }) {
262
262
  enabled: ((c == null ? void 0 : c.length) ?? 0) > 0,
263
263
  staleTime: 10 * 6e4
264
264
  }), h = Dt();
265
- return ns(
265
+ return lr(
266
266
  d == null ? void 0 : d.collection,
267
267
  d == null ? void 0 : d.id,
268
- (u) => {
269
- ss(u, rs.state) && h.invalidateQueries({ queryKey: ["nvr-chat-entity-card", t] });
268
+ (m) => {
269
+ or(m, ir.state) && h.invalidateQueries({ queryKey: ["nvr-chat-entity-card", t] });
270
270
  },
271
271
  { includeOwn: !0, debounceMs: 400 }
272
272
  ), /* @__PURE__ */ n(
@@ -274,17 +274,17 @@ function ya({ token: t, url: s, mine: o }) {
274
274
  {
275
275
  type: "button",
276
276
  onClick: () => {
277
- var u, f;
277
+ var m, b;
278
278
  if (d) {
279
- const D = (r.recordUrl ?? ((S, C) => `/collections/${S}/${C}`))(d.collection, d.id);
280
- if (D) {
281
- (u = r.navigate) == null || u.call(r, D);
279
+ const $ = (s.recordUrl ?? ((S, C) => `/collections/${S}/${C}`))(d.collection, d.id);
280
+ if ($) {
281
+ (m = s.navigate) == null || m.call(s, $);
282
282
  return;
283
283
  }
284
284
  }
285
- s && ((f = r.navigate) == null || f.call(r, s));
285
+ r && ((b = s.navigate) == null || b.call(s, r));
286
286
  },
287
- className: m(
287
+ className: u(
288
288
  "inline-flex max-w-full items-center gap-1 align-baseline font-medium underline-offset-2 hover:underline",
289
289
  o ? "underline" : l.accentText
290
290
  ),
@@ -306,17 +306,17 @@ function ya({ token: t, url: s, mine: o }) {
306
306
  }
307
307
  );
308
308
  }
309
- function sr(t) {
310
- const s = new Date(t), o = /* @__PURE__ */ new Date(), r = new Date(o);
311
- return r.setDate(o.getDate() - 1), s.toDateString() === o.toDateString() ? "Today" : s.toDateString() === r.toDateString() ? "Yesterday" : s.toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" });
309
+ function ls(t) {
310
+ const r = new Date(t), o = /* @__PURE__ */ new Date(), s = new Date(o);
311
+ return s.setDate(o.getDate() - 1), r.toDateString() === o.toDateString() ? "Today" : r.toDateString() === s.toDateString() ? "Yesterday" : r.toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" });
312
312
  }
313
- function rr({ botName: t }) {
314
- const s = se(), [o, r] = U(!1), l = ne(null);
315
- V(() => {
313
+ function os({ botName: t }) {
314
+ const r = oe(), [o, s] = D(!1), l = le(null);
315
+ ee(() => {
316
316
  if (!o) return;
317
317
  const c = (d) => {
318
318
  var h;
319
- (h = l.current) != null && h.contains(d.target) || r(!1);
319
+ (h = l.current) != null && h.contains(d.target) || s(!1);
320
320
  };
321
321
  return window.addEventListener("mousedown", c), () => window.removeEventListener("mousedown", c);
322
322
  }, [o]);
@@ -364,23 +364,23 @@ function rr({ botName: t }) {
364
364
  "button",
365
365
  {
366
366
  type: "button",
367
- onClick: () => r((c) => !c),
368
- className: m(
367
+ onClick: () => s((c) => !c),
368
+ className: u(
369
369
  "rounded-md p-1 transition-colors",
370
- o ? s.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
370
+ o ? r.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
371
371
  ),
372
372
  "aria-label": "Chat tips",
373
373
  title: "Tips",
374
374
  "data-chat-tips": !0,
375
- children: /* @__PURE__ */ e(Wn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
375
+ children: /* @__PURE__ */ e(zn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
376
376
  }
377
377
  ),
378
378
  o && /* @__PURE__ */ n(
379
379
  "div",
380
380
  {
381
- className: m(
381
+ className: u(
382
382
  "absolute right-0 top-full z-30 mt-1 w-[420px] max-w-[92vw] rounded-xl border shadow-lg",
383
- s.surface,
383
+ r.surface,
384
384
  "border-slate-200 dark:border-border"
385
385
  ),
386
386
  children: [
@@ -393,9 +393,9 @@ function rr({ botName: t }) {
393
393
  c.kind === "code" ? /* @__PURE__ */ e(
394
394
  "code",
395
395
  {
396
- className: m(
396
+ className: u(
397
397
  "h-fit w-fit self-start whitespace-nowrap rounded px-1.5 py-0.5 text-[10.5px] font-semibold",
398
- s.accentSoft
398
+ r.accentSoft
399
399
  ),
400
400
  children: c.k
401
401
  }
@@ -410,41 +410,41 @@ function rr({ botName: t }) {
410
410
  )
411
411
  ] });
412
412
  }
413
- function lr({ room: t }) {
414
- const s = Te(), o = se(), r = Ge(), l = t.indexOf(":"), i = l > 0 ? t.slice(0, l) : null, c = l > 0 ? t.slice(l + 1) : null, d = !!i && !!c && t !== s.globalRoom && i !== "dm" && i !== "ch", h = Dt(), { data: x } = be({
413
+ function is({ room: t }) {
414
+ const r = Ue(), o = oe(), s = Ge(), l = t.indexOf(":"), i = l > 0 ? t.slice(0, l) : null, c = l > 0 ? t.slice(l + 1) : null, d = !!i && !!c && t !== r.globalRoom && i !== "dm" && i !== "ch", h = Dt(), { data: x } = ge({
415
415
  queryKey: ["nvr-chat-room-card", t],
416
416
  queryFn: async () => {
417
- var $, F, W, Q;
418
- const T = (await h.fetchQuery(Qa(r))).find((te) => te.is_active && te.prefix === i);
417
+ var R, H, z, J;
418
+ const T = (await h.fetchQuery(Ya(s))).find((re) => re.is_active && re.prefix === i);
419
419
  if (!T) return null;
420
- const k = (F = ($ = (await r.request(
421
- ue(`/items/${T.collection}`, {
420
+ const k = (H = (R = (await s.request(
421
+ he(`/items/${T.collection}`, {
422
422
  limit: 1,
423
423
  fields: "id",
424
424
  filter: JSON.stringify({ [T.match_field]: { _eq: c } })
425
425
  })
426
- )).data) == null ? void 0 : $[0]) == null ? void 0 : F.id;
426
+ )).data) == null ? void 0 : R[0]) == null ? void 0 : H.id;
427
427
  if (k == null) return null;
428
- const P = (Q = (W = (await r.request(
429
- ue(`/pipelines/instance/${T.collection}/${k}`)
430
- )).data) == null ? void 0 : W.instance) == null ? void 0 : Q.current_state_obj;
428
+ const I = (J = (z = (await s.request(
429
+ he(`/pipelines/instance/${T.collection}/${k}`)
430
+ )).data) == null ? void 0 : z.instance) == null ? void 0 : J.current_state_obj;
431
431
  return {
432
432
  collection: T.collection,
433
433
  type_label: T.label ?? T.collection.replace(/_/g, " "),
434
434
  id: k,
435
- state: (P == null ? void 0 : P.label) ?? null,
436
- color: (P == null ? void 0 : P.color) ?? null
435
+ state: (I == null ? void 0 : I.label) ?? null,
436
+ color: (I == null ? void 0 : I.color) ?? null
437
437
  };
438
438
  },
439
439
  enabled: d,
440
440
  staleTime: 6e4
441
- }), u = Ka(t, d && !!x);
441
+ }), m = Za(t, d && !!x);
442
442
  if (!d || !x) return null;
443
- const v = (s.recordUrl ?? ((C, T) => `/collections/${C}/${T}`))(x.collection, x.id), D = (u == null ? void 0 : u.sla) ?? null, S = (D == null ? void 0 : D.status) === "breached" ? "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300" : (D == null ? void 0 : D.status) === "warning" ? "bg-amber-50 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300" : "bg-emerald-50 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300";
443
+ const v = (r.recordUrl ?? ((C, T) => `/collections/${C}/${T}`))(x.collection, x.id), $ = (m == null ? void 0 : m.sla) ?? null, S = ($ == null ? void 0 : $.status) === "breached" ? "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300" : ($ == null ? void 0 : $.status) === "warning" ? "bg-amber-50 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300" : "bg-emerald-50 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300";
444
444
  return /* @__PURE__ */ n(
445
445
  "div",
446
446
  {
447
- className: m("flex shrink-0 items-center gap-2 border-b px-3 py-1.5", o.divider),
447
+ className: u("flex shrink-0 items-center gap-2 border-b px-3 py-1.5", o.divider),
448
448
  "data-chat-room-card": !0,
449
449
  children: [
450
450
  /* @__PURE__ */ e("span", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: x.type_label }),
@@ -460,26 +460,26 @@ function lr({ room: t }) {
460
460
  children: x.state
461
461
  }
462
462
  ),
463
- D && /* @__PURE__ */ e(
463
+ $ && /* @__PURE__ */ e(
464
464
  "span",
465
465
  {
466
- className: m("rounded-full px-1.5 py-0.5 text-[10px] font-semibold", S),
467
- title: D.due_hours != null ? `${Math.round(D.elapsed_hours ?? 0)}h in this state of ${D.due_hours}h allowed` : void 0,
468
- "data-chat-room-sla": D.status,
469
- children: D.status === "breached" ? "Past SLA" : D.status === "warning" ? "SLA soon" : "On time"
466
+ className: u("rounded-full px-1.5 py-0.5 text-[10px] font-semibold", S),
467
+ title: $.due_hours != null ? `${Math.round($.elapsed_hours ?? 0)}h in this state of ${$.due_hours}h allowed` : void 0,
468
+ "data-chat-room-sla": $.status,
469
+ children: $.status === "breached" ? "Past SLA" : $.status === "warning" ? "SLA soon" : "On time"
470
470
  }
471
471
  ),
472
- u && u.owners.length > 0 && /* @__PURE__ */ n(
472
+ m && m.owners.length > 0 && /* @__PURE__ */ n(
473
473
  "span",
474
474
  {
475
475
  className: "ml-auto flex -space-x-1.5",
476
- title: `Owners: ${u.owners.map((C) => C.name).join(", ")}`,
477
- "data-chat-room-owners": u.owners.length,
476
+ title: `Owners: ${m.owners.map((C) => C.name).join(", ")}`,
477
+ "data-chat-room-owners": m.owners.length,
478
478
  children: [
479
- u.owners.slice(0, 4).map((C) => /* @__PURE__ */ e(X, { id: C.id, name: C.name, size: 18, presence: !1 }, C.id)),
480
- u.owners.length > 4 && /* @__PURE__ */ n("span", { className: "flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-slate-200 px-1 text-[9px] font-semibold text-slate-600 dark:bg-muted dark:text-slate-300", children: [
479
+ m.owners.slice(0, 4).map((C) => /* @__PURE__ */ e(te, { id: C.id, name: C.name, size: 18, presence: !1 }, C.id)),
480
+ m.owners.length > 4 && /* @__PURE__ */ n("span", { className: "flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-slate-200 px-1 text-[9px] font-semibold text-slate-600 dark:bg-muted dark:text-slate-300", children: [
481
481
  "+",
482
- u.owners.length - 4
482
+ m.owners.length - 4
483
483
  ] })
484
484
  ]
485
485
  }
@@ -490,11 +490,11 @@ function lr({ room: t }) {
490
490
  type: "button",
491
491
  onClick: () => {
492
492
  var C;
493
- return (C = s.navigate) == null ? void 0 : C.call(s, v);
493
+ return (C = r.navigate) == null ? void 0 : C.call(r, v);
494
494
  },
495
- className: m(
495
+ className: u(
496
496
  "text-[11px] font-medium hover:underline",
497
- u != null && u.owners.length ? "ml-1.5" : "ml-auto",
497
+ m != null && m.owners.length ? "ml-1.5" : "ml-auto",
498
498
  o.accentText
499
499
  ),
500
500
  children: "Open"
@@ -504,42 +504,42 @@ function lr({ room: t }) {
504
504
  }
505
505
  );
506
506
  }
507
- function or(t, s) {
507
+ function cs(t, r) {
508
508
  if (!t) return null;
509
- const o = $t() ?? Intl.DateTimeFormat().resolvedOptions().timeZone, r = /* @__PURE__ */ new Date();
509
+ const o = $t() ?? Intl.DateTimeFormat().resolvedOptions().timeZone, s = /* @__PURE__ */ new Date();
510
510
  let l, i;
511
511
  try {
512
512
  const d = (h) => new Intl.DateTimeFormat("en-US", { timeZone: h, hour: "numeric", minute: "2-digit" }).format(
513
- r
513
+ s
514
514
  );
515
515
  l = d(t), i = d(o);
516
516
  } catch {
517
517
  return null;
518
518
  }
519
519
  if (l === i) return null;
520
- const c = s.split(/\s+/)[0] || s;
520
+ const c = r.split(/\s+/)[0] || r;
521
521
  return `${l} for ${c}`;
522
522
  }
523
- function ir() {
524
- const [t, s] = U(0);
525
- return V(() => {
526
- const o = setInterval(() => s((r) => r + 1), 6e4);
523
+ function ds() {
524
+ const [t, r] = D(0);
525
+ return ee(() => {
526
+ const o = setInterval(() => r((s) => s + 1), 6e4);
527
527
  return () => clearInterval(o);
528
528
  }, []), t;
529
529
  }
530
- function cr({ peerId: t, name: s }) {
531
- ir();
532
- const { state: o, title: r } = Xa(t), l = Za(t), i = o === "online" ? "Active now" : o === "offline" ? (() => {
533
- const x = Va(l);
530
+ function us({ peerId: t, name: r }) {
531
+ ds();
532
+ const { state: o, title: s } = an(t), l = en(t), i = o === "online" ? "Active now" : o === "offline" ? (() => {
533
+ const x = tn(l);
534
534
  return x ? x.charAt(0).toUpperCase() + x.slice(1) : "Offline";
535
- })() : r, c = or((l == null ? void 0 : l.timezone) ?? null, s), d = en(l), h = d ? (l == null ? void 0 : l.delegate) ?? null : null;
535
+ })() : s, c = cs((l == null ? void 0 : l.timezone) ?? null, r), d = nn(l), h = d ? (l == null ? void 0 : l.delegate) ?? null : null;
536
536
  return /* @__PURE__ */ n(
537
537
  "p",
538
538
  {
539
539
  className: "flex min-w-0 items-center gap-1.5 truncate text-[11px] text-slate-500 dark:text-slate-400",
540
540
  "data-chat-dm-peer-line": o,
541
541
  children: [
542
- d && /* @__PURE__ */ n(ke, { children: [
542
+ d && /* @__PURE__ */ n(ve, { children: [
543
543
  /* @__PURE__ */ e(
544
544
  "span",
545
545
  {
@@ -548,11 +548,11 @@ function cr({ peerId: t, name: s }) {
548
548
  children: d
549
549
  }
550
550
  ),
551
- h && Bs() && /* @__PURE__ */ n(
551
+ h && zr() && /* @__PURE__ */ n(
552
552
  "button",
553
553
  {
554
554
  type: "button",
555
- onClick: () => Fs(h.id, h.name),
555
+ onClick: () => Hr(h.id, h.name),
556
556
  className: "shrink-0 font-medium text-slate-700 underline decoration-dotted underline-offset-2 hover:text-slate-900 dark:text-slate-200 dark:hover:text-white",
557
557
  "data-chat-dm-delegate": h.id,
558
558
  children: [
@@ -565,7 +565,7 @@ function cr({ peerId: t, name: s }) {
565
565
  /* @__PURE__ */ e("span", { "aria-hidden": !0, children: "·" })
566
566
  ] }),
567
567
  /* @__PURE__ */ e("span", { className: "truncate", children: i }),
568
- c && /* @__PURE__ */ n(ke, { children: [
568
+ c && /* @__PURE__ */ n(ve, { children: [
569
569
  /* @__PURE__ */ e("span", { "aria-hidden": !0, children: "·" }),
570
570
  /* @__PURE__ */ e("span", { className: "shrink-0", "data-chat-dm-local-time": !0, title: (l == null ? void 0 : l.timezone) ?? void 0, children: c })
571
571
  ] })
@@ -573,76 +573,76 @@ function cr({ peerId: t, name: s }) {
573
573
  }
574
574
  );
575
575
  }
576
- function ka({
576
+ function Ca({
577
577
  room: t,
578
- label: s,
578
+ label: r,
579
579
  onBack: o,
580
- onOpenSettings: r,
580
+ onOpenSettings: s,
581
581
  renderMessageBody: l,
582
582
  initialUnread: i,
583
583
  anchor: c = null,
584
584
  openThread: d = null
585
585
  }) {
586
- var ra, la, oa, ia, ca, da, ua, ma, ha, pa;
587
- const h = Te(), x = se(), u = Ge(), f = h.me, v = f ? ye(t, f.id) : null, D = !s.trim() || s.toLowerCase() === t.toLowerCase() || /^dm:/i.test(s), { data: S } = be({
588
- ...is(u, v),
589
- enabled: !!v && D,
586
+ var sa, la, oa, ia, ca, da, ua, ma, ha, pa;
587
+ const h = Ue(), x = oe(), m = Ge(), b = h.me, v = b ? Ne(t, b.id) : null, $ = !r.trim() || r.toLowerCase() === t.toLowerCase() || /^dm:/i.test(r), { data: S } = ge({
588
+ ...dr(m, v),
589
+ enabled: !!v && $,
590
590
  staleTime: 12e4
591
- }), C = D && v ? [S == null ? void 0 : S.first_name, S == null ? void 0 : S.last_name].filter(Boolean).join(" ") || (S == null ? void 0 : S.email) || "Direct message" : s, [T, E] = U(c);
592
- V(() => E(c), [c]);
593
- const { messages: k, loading: A, hasOlder: P, hasNewer: $, loadOlder: F, loadingOlder: W } = Ss(
591
+ }), C = $ && v ? [S == null ? void 0 : S.first_name, S == null ? void 0 : S.last_name].filter(Boolean).join(" ") || (S == null ? void 0 : S.email) || "Direct message" : r, [T, F] = D(c);
592
+ ee(() => F(c), [c]);
593
+ const { messages: k, loading: A, hasOlder: I, hasNewer: R, loadOlder: H, loadingOlder: z } = Ur(
594
594
  t,
595
595
  T
596
596
  );
597
- Ts(t);
598
- const Q = Ga(t), te = Us(), Z = Ds(t), Y = $s(t.startsWith("dm:") ? t : null), me = As(t), _ = Rs(t), N = Ms(t), b = Os(t), I = !t.startsWith("dm:") && !t.startsWith("ch:") && t !== h.globalRoom && t.includes(":"), q = Ka(t, I), fe = Hs(t, !!q), ge = t.startsWith("ch:"), { data: Ue = [] } = be({
597
+ Dr(t);
598
+ const J = Ja(t), re = $r(), X = Rr(t), V = Ar(t.startsWith("dm:") ? t : null), pe = Mr(t), _ = Or(t), N = Lr(t), f = Pr(t), j = !t.startsWith("dm:") && !t.startsWith("ch:") && t !== h.globalRoom && t.includes(":"), W = Za(t, j), ye = Qr(t, !!W), ke = t.startsWith("ch:"), { data: De = [] } = ge({
599
599
  queryKey: ["chat-read-marks", t],
600
- queryFn: () => u.request(
601
- ue(`/chat/rooms/${encodeURIComponent(t)}/read-marks`)
600
+ queryFn: () => m.request(
601
+ he(`/chat/rooms/${encodeURIComponent(t)}/read-marks`)
602
602
  ).then((a) => a.data ?? []).catch(() => []),
603
- enabled: ge,
604
- refetchInterval: ge ? 3e4 : !1,
603
+ enabled: ke,
604
+ refetchInterval: ke ? 3e4 : !1,
605
605
  staleTime: 15e3
606
- }), we = (a) => Ue.filter(
606
+ }), de = (a) => De.filter(
607
607
  (p) => p.user !== String(a.sender ?? "") && new Date(p.last_read_at).getTime() >= new Date(a.date_created).getTime()
608
- ), pe = Dt(), { data: Ne = [] } = be({
608
+ ), fe = Dt(), { data: Ce = [] } = ge({
609
609
  queryKey: ["chat-saved"],
610
- queryFn: () => u.request(ue("/chat/saved")).then((a) => a.data ?? []).catch(() => []),
610
+ queryFn: () => m.request(he("/chat/saved")).then((a) => a.data ?? []).catch(() => []),
611
611
  staleTime: 6e4
612
- }), Le = he(() => new Set(Ne.map((a) => a.id)), [Ne]), Ye = Me({
613
- mutationFn: (a) => u.request(Oe(`/chat/messages/${a}/save`, {})),
614
- onSuccess: () => void pe.invalidateQueries({ queryKey: ["chat-saved"] })
615
- }), [y, R] = U(null), j = Me({
616
- mutationFn: () => u.request(
612
+ }), Le = xe(() => new Set(Ce.map((a) => a.id)), [Ce]), Ye = Me({
613
+ mutationFn: (a) => m.request(Oe(`/chat/messages/${a}/save`, {})),
614
+ onSuccess: () => void fe.invalidateQueries({ queryKey: ["chat-saved"] })
615
+ }), [y, M] = D(null), P = Me({
616
+ mutationFn: () => m.request(
617
617
  Oe("/chat/rooms/summary", { room: t })
618
618
  ).then((a) => a.data),
619
- onSuccess: (a) => R((a == null ? void 0 : a.summary) ?? "Not enough new messages to summarize."),
620
- onError: () => R("Summary unavailable.")
621
- }), ee = Me({
619
+ onSuccess: (a) => M((a == null ? void 0 : a.summary) ?? "Not enough new messages to summarize."),
620
+ onError: () => M("Summary unavailable.")
621
+ }), ae = Me({
622
622
  mutationFn: async (a) => {
623
- if (!q || !f) throw new Error("no record");
624
- await u.request(
623
+ if (!W || !b) throw new Error("no record");
624
+ await m.request(
625
625
  Oe("/tasks", {
626
- collection: q.collection,
627
- item: String(q.id),
626
+ collection: W.collection,
627
+ item: String(W.id),
628
628
  title: a.message.replace(/<[^>]*>/g, "").slice(0, 200),
629
- assignee: f.id
629
+ assignee: b.id
630
630
  })
631
631
  );
632
632
  },
633
633
  onSuccess: () => {
634
- q && os(pe, q.collection, q.id), de.success("Task created from message — assigned to you");
634
+ W && cr(fe, W.collection, W.id), me.success("Task created from message — assigned to you");
635
635
  },
636
- onError: () => de.error("Could not create a task")
637
- }), ve = Me({
638
- mutationFn: (a) => u.request(Oe(`/chat/messages/${a.id}/to-notes`, {})),
639
- onSuccess: () => de.success(`Copied to the Notes of ${(q == null ? void 0 : q.label) ?? "the record"}`),
636
+ onError: () => me.error("Could not create a task")
637
+ }), we = Me({
638
+ mutationFn: (a) => m.request(Oe(`/chat/messages/${a.id}/to-notes`, {})),
639
+ onSuccess: () => me.success(`Copied to the Notes of ${(W == null ? void 0 : W.label) ?? "the record"}`),
640
640
  onError: (a) => {
641
641
  var p;
642
- return de.error(((p = a == null ? void 0 : a.response) == null ? void 0 : p.error) ?? "Could not copy it");
642
+ return me.error(((p = a == null ? void 0 : a.response) == null ? void 0 : p.error) ?? "Could not copy it");
643
643
  }
644
- }), O = Me({
645
- mutationFn: (a) => u.request(
644
+ }), U = Me({
645
+ mutationFn: (a) => m.request(
646
646
  Oe(`/chat/messages/${a.messageId}/attach-to-record`, {
647
647
  file_id: a.fileId,
648
648
  field: a.field
@@ -650,47 +650,47 @@ function ka({
650
650
  ),
651
651
  onSuccess: (a, p) => {
652
652
  var w;
653
- return de.success(
654
- `Attached to ${(q == null ? void 0 : q.label) ?? "the record"} — ${((w = fe.find((J) => J.field === p.field)) == null ? void 0 : w.label) ?? p.field}`
653
+ return me.success(
654
+ `Attached to ${(W == null ? void 0 : W.label) ?? "the record"} — ${((w = ye.find((Z) => Z.field === p.field)) == null ? void 0 : w.label) ?? p.field}`
655
655
  );
656
656
  },
657
657
  onError: (a) => {
658
658
  var p;
659
- return de.error(
659
+ return me.error(
660
660
  ((p = a == null ? void 0 : a.response) == null ? void 0 : p.error) ?? "Could not attach it"
661
661
  );
662
662
  }
663
- }), B = Me({
664
- mutationFn: (a) => u.request(as(`/chat/messages/${a}`, { no_preview: !0 })),
665
- onSuccess: () => void pe.invalidateQueries({ queryKey: ["nvr-chat", t] })
666
- }), z = Ls(t), re = Ps(t), { isAdmin: le } = ot(), { setMuted: K, setNotifyMode: De, setArchived: sn, setStarred: rn, dismissWelcome: ln, leave: on } = Mt(), { rooms: cn, loading: dn } = Fa(), qt = cn.find((a) => a.room === t) ?? null, { rooms: un } = za(!dn && !qt), g = qt ?? un.find((a) => a.room === t) ?? null, mn = tn(g), oe = js(), [it, hn] = U(!1), [Ze, Et] = U(""), [pn, ct] = U(null), [Wt, Bt] = U(""), [xn, dt] = U(null), [Ft, zt] = U(null), [bn, Ht] = U(!1), [Gt, $e] = U(null), Qt = Is(d ? t : null, d), Kt = !!Qt.root && !Qt.root.deleted_at;
667
- V(() => {
663
+ }), E = Me({
664
+ mutationFn: (a) => m.request(sr(`/chat/messages/${a}`, { no_preview: !0 })),
665
+ onSuccess: () => void fe.invalidateQueries({ queryKey: ["nvr-chat", t] })
666
+ }), q = Ir(t), ne = jr(t), { isAdmin: G } = ot(), { setMuted: B, setNotifyMode: Y, setArchived: on, setStarred: cn, dismissWelcome: dn, leave: un } = Mt(), { rooms: mn, loading: hn } = Ga(), qt = mn.find((a) => a.room === t) ?? null, { rooms: pn } = Qa(!hn && !qt), g = qt ?? pn.find((a) => a.room === t) ?? null, xn = rn(g), ie = qr(), [it, fn] = D(!1), [Ze, Et] = D(""), [bn, ct] = D(null), [Wt, Bt] = D(""), [gn, dt] = D(null), [Ft, zt] = D(null), [vn, Ht] = D(!1), [Gt, $e] = D(null), Qt = Er(d ? t : null, d), Kt = !!Qt.root && !Qt.root.deleted_at;
667
+ ee(() => {
668
668
  d && Kt && $e(d);
669
669
  }, [d, Kt]);
670
- const [fn, Jt] = U(null), [gn, Yt] = U(null), [Zt, Pe] = U(!1), [vn, ut] = U(!1), [ae, je] = U(null), [Ie, mt] = U(
670
+ const [yn, Jt] = D(null), [kn, Yt] = D(null), [Zt, Pe] = D(!1), [wn, ut] = D(!1), [se, Ie] = D(null), [je, mt] = D(
671
671
  c && "around" in c ? c.around : null
672
- ), [Ve, ht] = U(null), qe = hs(t, (f == null ? void 0 : f.id) ?? null), Vt = ne(null), pt = ne(null), xt = ne(Math.max(0, i ?? 0)), Ce = ne(!1), Ae = ne(null), Xt = ne(null), ie = ne(!c), Ee = ne(0), We = ne(null), Xe = ne(0), et = () => {
673
- const a = Ae.current;
672
+ ), [Ve, ht] = D(null), qe = xr(t, (b == null ? void 0 : b.id) ?? null), Vt = le(null), pt = le(null), xt = le(Math.max(0, i ?? 0)), _e = le(!1), Re = le(null), Xt = le(null), ce = le(!c), Ee = le(0), We = le(null), Xe = le(0), et = () => {
673
+ const a = Re.current;
674
674
  a && (a.scrollTop = a.scrollHeight);
675
- }, bt = (a) => {
675
+ }, ft = (a) => {
676
676
  var w;
677
- const p = (w = Ae.current) == null ? void 0 : w.querySelector(`[data-chat-msg="${a}"]`);
678
- return p ? (p.scrollIntoView({ block: "center" }), ie.current = !1, mt(a), !0) : !1;
677
+ const p = (w = Re.current) == null ? void 0 : w.querySelector(`[data-chat-msg="${a}"]`);
678
+ return p ? (p.scrollIntoView({ block: "center" }), ce.current = !1, mt(a), !0) : !1;
679
679
  }, ea = (a) => {
680
- Pe(!1), bt(a) || (Ce.current = !1, ie.current = !1, mt(a), E({ around: a }));
680
+ Pe(!1), ft(a) || (_e.current = !1, ce.current = !1, mt(a), F({ around: a }));
681
681
  };
682
- V(() => {
683
- if (Ie == null) return;
682
+ ee(() => {
683
+ if (je == null) return;
684
684
  const a = setTimeout(() => mt(null), 2400);
685
685
  return () => clearTimeout(a);
686
- }, [Ie]), V(() => {
687
- Ce.current = !1, Ee.current = 0, je(null);
688
- }, [t, T]), V(() => {
689
- var Re, Se;
690
- const a = Ae.current, p = ((Re = k[0]) == null ? void 0 : Re.id) ?? null;
691
- if (!Ce.current && k.length > 0) {
692
- if (Ce.current = !0, Ee.current = k.length, We.current = p, Ie != null && bt(Ie)) return;
693
- pt.current && !T ? (pt.current.scrollIntoView({ block: "center" }), ie.current = !1) : T || (et(), ie.current = !0);
686
+ }, [je]), ee(() => {
687
+ _e.current = !1, Ee.current = 0, Ie(null);
688
+ }, [t, T]), ee(() => {
689
+ var Ae, Te;
690
+ const a = Re.current, p = ((Ae = k[0]) == null ? void 0 : Ae.id) ?? null;
691
+ if (!_e.current && k.length > 0) {
692
+ if (_e.current = !0, Ee.current = k.length, We.current = p, je != null && ft(je)) return;
693
+ pt.current && !T ? (pt.current.scrollIntoView({ block: "center" }), ce.current = !1) : T || (et(), ce.current = !0);
694
694
  return;
695
695
  }
696
696
  if (p !== We.current && We.current != null && a) {
@@ -700,49 +700,49 @@ function ka({
700
700
  We.current = p;
701
701
  const w = k.length - Ee.current;
702
702
  if (Ee.current = k.length, w <= 0) return;
703
- const J = k[k.length - 1], G = !!(J != null && J.sender) && J.sender.toLowerCase() === ((Se = f == null ? void 0 : f.id) == null ? void 0 : Se.toLowerCase());
704
- if (ie.current || G)
705
- et(), ie.current = !0, je(null);
703
+ const Z = k[k.length - 1], K = !!(Z != null && Z.sender) && Z.sender.toLowerCase() === ((Te = b == null ? void 0 : b.id) == null ? void 0 : Te.toLowerCase());
704
+ if (ce.current || K)
705
+ et(), ce.current = !0, Ie(null);
706
706
  else {
707
707
  const Fe = k[k.length - w];
708
- je((ce) => ({ count: ((ce == null ? void 0 : ce.count) ?? 0) + w, firstId: (ce == null ? void 0 : ce.firstId) ?? Fe.id }));
708
+ Ie((ue) => ({ count: ((ue == null ? void 0 : ue.count) ?? 0) + w, firstId: (ue == null ? void 0 : ue.firstId) ?? Fe.id }));
709
709
  }
710
- }, [k]), V(() => {
710
+ }, [k]), ee(() => {
711
711
  const a = Xt.current;
712
712
  if (!a || typeof ResizeObserver > "u") return;
713
713
  const p = new ResizeObserver(() => {
714
714
  var w;
715
- ie.current && et(), Xe.current = ((w = Ae.current) == null ? void 0 : w.scrollHeight) ?? 0;
715
+ ce.current && et(), Xe.current = ((w = Re.current) == null ? void 0 : w.scrollHeight) ?? 0;
716
716
  });
717
717
  return p.observe(a), () => p.disconnect();
718
- }, []), V(() => {
719
- var w, J;
718
+ }, []), ee(() => {
719
+ var w, Z;
720
720
  const a = k[k.length - 1];
721
- if (!a || !Ce.current || ((w = a.sender) == null ? void 0 : w.toLowerCase()) === ((J = f == null ? void 0 : f.id) == null ? void 0 : J.toLowerCase()))
721
+ if (!a || !_e.current || ((w = a.sender) == null ? void 0 : w.toLowerCase()) === ((Z = b == null ? void 0 : b.id) == null ? void 0 : Z.toLowerCase()))
722
722
  return;
723
723
  const p = Date.now() - new Date(a.date_created).getTime();
724
- p > 0 && p < 5 * 6e4 && Math.random() < 0.2 && u.request(Oe("/chat/health/delivery", { ms: p })).catch(() => {
724
+ p > 0 && p < 5 * 6e4 && Math.random() < 0.2 && m.request(Oe("/chat/health/delivery", { ms: p })).catch(() => {
725
725
  });
726
- }, [(ra = k[k.length - 1]) == null ? void 0 : ra.id]), V(() => {
727
- if (!Ve || !oe) return;
726
+ }, [(sa = k[k.length - 1]) == null ? void 0 : sa.id]), ee(() => {
727
+ if (!Ve || !ie) return;
728
728
  if (k.some(
729
- (w) => (w.sender_name ?? "").toLowerCase() === oe.toLowerCase() && new Date(w.date_created).getTime() >= Ve - 5e3
729
+ (w) => (w.sender_name ?? "").toLowerCase() === ie.toLowerCase() && new Date(w.date_created).getTime() >= Ve - 5e3
730
730
  )) {
731
731
  ht(null);
732
732
  return;
733
733
  }
734
734
  const p = setTimeout(() => ht(null), 9e4);
735
735
  return () => clearTimeout(p);
736
- }, [Ve, oe, k]);
737
- const tt = he(() => {
736
+ }, [Ve, ie, k]);
737
+ const tt = xe(() => {
738
738
  const a = /* @__PURE__ */ new Set();
739
739
  for (const p of k) for (const w of p.attachments ?? []) a.add(w);
740
740
  return [...a];
741
- }, [k]), { data: ft } = be({
741
+ }, [k]), { data: bt } = ge({
742
742
  queryKey: ["nvr-chat-attachments", tt.slice().sort().join("|")],
743
743
  queryFn: async () => {
744
- const a = await u.request(
745
- ue("/files", {
744
+ const a = await m.request(
745
+ he("/files", {
746
746
  filter: JSON.stringify({ id: { _in: tt } }),
747
747
  limit: String(tt.length),
748
748
  fields: "id,filename_download,title,type,filesize"
@@ -753,25 +753,25 @@ function ka({
753
753
  enabled: tt.length > 0,
754
754
  staleTime: 5 * 6e4
755
755
  });
756
- V(() => {
757
- T || te.mutate(t);
756
+ ee(() => {
757
+ T || re.mutate(t);
758
758
  }, [t, k.length, T]);
759
- const yn = (a) => {
760
- if (ie.current = !0, T && E(null), oe) {
761
- const p = oe.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
759
+ const Nn = (a) => {
760
+ if (ce.current = !0, T && F(null), ie) {
761
+ const p = ie.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
762
762
  new RegExp(`@\\[?${p}\\]?\\b`, "i").test(a) && ht(Date.now());
763
763
  }
764
- }, Be = (la = f == null ? void 0 : f.id) == null ? void 0 : la.toLowerCase(), xe = it && Ze.trim().length > 0, _e = he(
765
- () => xe ? k.filter((a) => a.message.toLowerCase().includes(Ze.trim().toLowerCase())) : k,
766
- [k, xe, Ze]
767
- ), kn = he(() => {
764
+ }, Be = (la = b == null ? void 0 : b.id) == null ? void 0 : la.toLowerCase(), be = it && Ze.trim().length > 0, Se = xe(
765
+ () => be ? k.filter((a) => a.message.toLowerCase().includes(Ze.trim().toLowerCase())) : k,
766
+ [k, be, Ze]
767
+ ), Cn = xe(() => {
768
768
  var a;
769
- if (xe) return -1;
770
- for (let p = _e.length - 1; p >= 0; p--)
771
- if (((a = _e[p].sender) == null ? void 0 : a.toLowerCase()) === Be) return p;
769
+ if (be) return -1;
770
+ for (let p = Se.length - 1; p >= 0; p--)
771
+ if (((a = Se[p].sender) == null ? void 0 : a.toLowerCase()) === Be) return p;
772
772
  return -1;
773
- }, [_e, Be, xe]), ta = Y ? new Date(Y).getTime() : 0, at = Rt().chat_density === "compact" ? "compact" : "comfortable", H = (g == null ? void 0 : g.channel) ?? null, wn = !!H && !!f && String(H.created_by ?? "").toUpperCase() === f.id.toUpperCase(), aa = H != null && H.announce && !wn && !le ? H.id === Ba ? "Only admins post here. Hover a message and reply in its thread." : "Only the channel owner and admins post here. Hover a message and reply in its thread." : null, Nn = !!(H != null && H.welcome_note) && !!(g != null && g.joined) && !(g != null && g.welcome_seen_at) && !H.is_direct, Cn = (a, p) => a.entity ? /* @__PURE__ */ e(ya, { token: a.text, url: h.entityUrl(a.entity) }, p) : a.mention ? /* @__PURE__ */ e("span", { className: m("rounded px-0.5 font-semibold", x.accentSoft), children: a.text }, p) : /* @__PURE__ */ e("span", { children: a.text }, p), _n = (a, p) => a.entity ? /* @__PURE__ */ e(ya, { token: a.text, url: h.entityUrl(a.entity), mine: !0 }, p) : a.mention ? /* @__PURE__ */ e("span", { className: "rounded bg-black/15 px-0.5 font-semibold", children: a.text }, p) : /* @__PURE__ */ e("span", { children: a.text }, p), na = (a, p = {}) => {
774
- var xa, ba;
773
+ }, [Se, Be, be]), ta = V ? new Date(V).getTime() : 0, at = At().chat_density === "compact" ? "compact" : "comfortable", Q = (g == null ? void 0 : g.channel) ?? null, _n = !!Q && !!b && String(Q.created_by ?? "").toUpperCase() === b.id.toUpperCase(), aa = Q != null && Q.announce && !_n && !G ? Q.id === Ha ? "Only admins post here. Hover a message and reply in its thread." : "Only the channel owner and admins post here. Hover a message and reply in its thread." : null, Sn = !!(Q != null && Q.welcome_note) && !!(g != null && g.joined) && !(g != null && g.welcome_seen_at) && !Q.is_direct, Tn = (a, p) => a.entity ? /* @__PURE__ */ e(Na, { token: a.text, url: h.entityUrl(a.entity) }, p) : a.mention ? /* @__PURE__ */ e("span", { className: u("rounded px-0.5 font-semibold", x.accentSoft), children: a.text }, p) : /* @__PURE__ */ e("span", { children: a.text }, p), Un = (a, p) => a.entity ? /* @__PURE__ */ e(Na, { token: a.text, url: h.entityUrl(a.entity), mine: !0 }, p) : a.mention ? /* @__PURE__ */ e("span", { className: "rounded bg-black/15 px-0.5 font-semibold", children: a.text }, p) : /* @__PURE__ */ e("span", { children: a.text }, p), na = (a, p = {}) => {
774
+ var xa, fa;
775
775
  const w = ((xa = a.sender) == null ? void 0 : xa.toLowerCase()) === Be;
776
776
  if (a.is_system)
777
777
  return /* @__PURE__ */ e(
@@ -789,33 +789,33 @@ function ka({
789
789
  ] })
790
790
  }
791
791
  );
792
- const J = p.isLastMine && ta > 0 && new Date(a.date_created).getTime() <= ta, G = !!a.deleted_at, Re = w && !G && Date.now() - new Date(a.date_created).getTime() < 15 * 6e4, Se = !G && (w || le), Fe = pn === a.id, ce = /* @__PURE__ */ new Map();
793
- for (const M of a.reactions ?? []) {
794
- const L = ce.get(M.emoji) ?? { count: 0, mine: !1, names: [] };
795
- L.count++, ((ba = M.user) == null ? void 0 : ba.toLowerCase()) === Be && (L.mine = !0), M.user_name && L.names.push(M.user_name), ce.set(M.emoji, L);
792
+ const Z = p.isLastMine && ta > 0 && new Date(a.date_created).getTime() <= ta, K = !!a.deleted_at, Ae = w && !K && Date.now() - new Date(a.date_created).getTime() < 15 * 6e4, Te = !K && (w || G), Fe = bn === a.id, ue = /* @__PURE__ */ new Map();
793
+ for (const O of a.reactions ?? []) {
794
+ const L = ue.get(O.emoji) ?? { count: 0, mine: !1, names: [] };
795
+ L.count++, ((fa = O.user) == null ? void 0 : fa.toLowerCase()) === Be && (L.mine = !0), O.user_name && L.names.push(O.user_name), ue.set(O.emoji, L);
796
796
  }
797
797
  const ze = "rounded-full p-0.5 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200";
798
798
  return /* @__PURE__ */ n(
799
799
  "div",
800
800
  {
801
- className: m(
801
+ className: u(
802
802
  "group/msg flex gap-2 rounded-lg transition-colors",
803
803
  w && "flex-row-reverse",
804
- Ie === a.id && "bg-nvr-cyan/[0.12]"
804
+ je === a.id && "bg-nvr-cyan/[0.12]"
805
805
  ),
806
806
  "data-chat-msg": a.id,
807
807
  children: [
808
- !w && /* @__PURE__ */ e(Oa, { userId: a.sender, children: /* @__PURE__ */ e(
808
+ !w && /* @__PURE__ */ e(Ia, { userId: a.sender, children: /* @__PURE__ */ e(
809
809
  "button",
810
810
  {
811
811
  type: "button",
812
812
  className: "h-fit shrink-0 rounded-full",
813
813
  "aria-label": `${a.sender_name ?? "Sender"} — profile`,
814
814
  "data-chat-avatar-card": !0,
815
- children: /* @__PURE__ */ e(X, { id: a.sender, name: a.sender_name, size: at === "compact" ? 22 : 26 })
815
+ children: /* @__PURE__ */ e(te, { id: a.sender, name: a.sender_name, size: at === "compact" ? 22 : 26 })
816
816
  }
817
817
  ) }),
818
- /* @__PURE__ */ n("div", { className: m("relative max-w-[78%]", w && "text-right"), children: [
818
+ /* @__PURE__ */ n("div", { className: u("relative max-w-[78%]", w && "text-right"), children: [
819
819
  !w && p.showSender !== !1 && /* @__PURE__ */ n("p", { className: "mb-0.5 text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: [
820
820
  a.sender_name ?? "Unknown",
821
821
  a.masquerade_admin_name && /* @__PURE__ */ n(
@@ -831,10 +831,10 @@ function ka({
831
831
  }
832
832
  )
833
833
  ] }),
834
- !G && !Fe && /* @__PURE__ */ n(
834
+ !K && !Fe && /* @__PURE__ */ n(
835
835
  "div",
836
836
  {
837
- className: m(
837
+ className: u(
838
838
  "absolute -top-3 z-10 hidden items-center gap-0.5 rounded-full border px-1 py-0.5 shadow-sm group-hover/msg:flex",
839
839
  x.surface,
840
840
  "border-slate-200 dark:border-border",
@@ -842,16 +842,16 @@ function ka({
842
842
  ),
843
843
  "data-chat-msg-actions": !0,
844
844
  children: [
845
- zs.map((M) => /* @__PURE__ */ e(
845
+ Gr.map((O) => /* @__PURE__ */ e(
846
846
  "button",
847
847
  {
848
848
  type: "button",
849
- onClick: () => _.mutate({ messageId: a.id, emoji: M }),
849
+ onClick: () => _.mutate({ messageId: a.id, emoji: O }),
850
850
  className: "rounded-full px-0.5 text-[13px] leading-none transition-transform hover:scale-125",
851
- title: `React ${M}`,
852
- children: M
851
+ title: `React ${O}`,
852
+ children: O
853
853
  },
854
- M
854
+ O
855
855
  )),
856
856
  !p.inThread && !a.parent_id && /* @__PURE__ */ e(
857
857
  "button",
@@ -863,7 +863,7 @@ function ka({
863
863
  },
864
864
  className: ze,
865
865
  "data-chat-reply-thread": !0,
866
- children: /* @__PURE__ */ e(Bn, { className: "h-3 w-3" })
866
+ children: /* @__PURE__ */ e(Hn, { className: "h-3 w-3" })
867
867
  }
868
868
  ),
869
869
  /* @__PURE__ */ e(
@@ -874,29 +874,29 @@ function ka({
874
874
  onClick: () => p.inThread ? Yt(a) : Jt(a),
875
875
  className: ze,
876
876
  "data-chat-quote": !0,
877
- children: /* @__PURE__ */ e(Fn, { className: "h-3 w-3" })
877
+ children: /* @__PURE__ */ e(Gn, { className: "h-3 w-3" })
878
878
  }
879
879
  ),
880
- q && /* @__PURE__ */ n(ke, { children: [
880
+ W && /* @__PURE__ */ n(ve, { children: [
881
881
  /* @__PURE__ */ e(
882
882
  "button",
883
883
  {
884
884
  type: "button",
885
885
  title: "Make a task from this message",
886
- onClick: () => ee.mutate(a),
886
+ onClick: () => ae.mutate(a),
887
887
  className: ze,
888
- children: /* @__PURE__ */ e(zn, { className: "h-3 w-3" })
888
+ children: /* @__PURE__ */ e(Qn, { className: "h-3 w-3" })
889
889
  }
890
890
  ),
891
891
  a.message && /* @__PURE__ */ e(
892
892
  "button",
893
893
  {
894
894
  type: "button",
895
- title: `Copy into the Notes of ${q.label}`,
896
- onClick: () => ve.mutate(a),
895
+ title: `Copy into the Notes of ${W.label}`,
896
+ onClick: () => we.mutate(a),
897
897
  className: ze,
898
898
  "data-chat-to-notes": !0,
899
- children: /* @__PURE__ */ e(Hn, { className: "h-3 w-3" })
899
+ children: /* @__PURE__ */ e(Kn, { className: "h-3 w-3" })
900
900
  }
901
901
  )
902
902
  ] }),
@@ -904,11 +904,11 @@ function ka({
904
904
  "button",
905
905
  {
906
906
  type: "button",
907
- title: N.some((M) => M.id === a.id) ? "Unpin" : "Pin",
908
- onClick: () => b.mutate(a.id),
909
- className: m(
907
+ title: N.some((O) => O.id === a.id) ? "Unpin" : "Pin",
908
+ onClick: () => f.mutate(a.id),
909
+ className: u(
910
910
  "rounded-full p-0.5",
911
- N.some((M) => M.id === a.id) ? x.accentText : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200"
911
+ N.some((O) => O.id === a.id) ? x.accentText : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200"
912
912
  ),
913
913
  children: /* @__PURE__ */ e(Nt, { className: "h-3 w-3" })
914
914
  }
@@ -919,14 +919,14 @@ function ka({
919
919
  type: "button",
920
920
  title: Le.has(a.id) ? "Remove from saved" : "Save for later (personal bookmark)",
921
921
  onClick: () => Ye.mutate(a.id),
922
- className: m(
922
+ className: u(
923
923
  "rounded-full p-0.5",
924
924
  Le.has(a.id) ? x.accentText : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200"
925
925
  ),
926
- children: /* @__PURE__ */ e(Gn, { className: "h-3 w-3" })
926
+ children: /* @__PURE__ */ e(Jn, { className: "h-3 w-3" })
927
927
  }
928
928
  ),
929
- Re && /* @__PURE__ */ e(
929
+ Ae && /* @__PURE__ */ e(
930
930
  "button",
931
931
  {
932
932
  type: "button",
@@ -935,16 +935,16 @@ function ka({
935
935
  ct(a.id), Bt(a.message), dt(null);
936
936
  },
937
937
  className: ze,
938
- children: /* @__PURE__ */ e(Qn, { className: "h-3 w-3" })
938
+ children: /* @__PURE__ */ e(Yn, { className: "h-3 w-3" })
939
939
  }
940
940
  ),
941
- Se && (xn === a.id ? /* @__PURE__ */ e(
941
+ Te && (gn === a.id ? /* @__PURE__ */ e(
942
942
  "button",
943
943
  {
944
944
  type: "button",
945
945
  title: "Confirm delete",
946
946
  onClick: () => {
947
- re.mutate(a.id), dt(null);
947
+ ne.mutate(a.id), dt(null);
948
948
  },
949
949
  className: "rounded-full px-1 text-[10px] font-semibold text-red-500",
950
950
  children: "Sure?"
@@ -956,34 +956,34 @@ function ka({
956
956
  title: w ? "Delete" : "Delete (admin)",
957
957
  onClick: () => dt(a.id),
958
958
  className: "rounded-full p-0.5 text-slate-400 hover:text-red-500",
959
- children: /* @__PURE__ */ e(Kn, { className: "h-3 w-3" })
959
+ children: /* @__PURE__ */ e(Zn, { className: "h-3 w-3" })
960
960
  }
961
961
  ))
962
962
  ]
963
963
  }
964
964
  ),
965
- a.urgent && !G && /* @__PURE__ */ n(
965
+ a.urgent && !K && /* @__PURE__ */ n(
966
966
  "p",
967
967
  {
968
- className: m(
968
+ className: u(
969
969
  "mb-0.5 flex items-center gap-1 text-[10.5px] font-semibold text-red-600 dark:text-red-400",
970
970
  w && "justify-end"
971
971
  ),
972
972
  "data-chat-urgent": !0,
973
973
  children: [
974
- /* @__PURE__ */ e(Jn, { className: "h-3 w-3" }),
974
+ /* @__PURE__ */ e(Vn, { className: "h-3 w-3" }),
975
975
  " Urgent"
976
976
  ]
977
977
  }
978
978
  ),
979
- G ? /* @__PURE__ */ e("div", { className: "inline-block rounded-2xl border border-dashed border-slate-200 px-3 py-1.5 text-left text-[11.5px] italic text-slate-500 dark:border-border", children: "Message removed" }) : Fe ? /* @__PURE__ */ n(
979
+ K ? /* @__PURE__ */ e("div", { className: "inline-block rounded-2xl border border-dashed border-slate-200 px-3 py-1.5 text-left text-[11.5px] italic text-slate-500 dark:border-border", children: "Message removed" }) : Fe ? /* @__PURE__ */ n(
980
980
  "form",
981
981
  {
982
982
  className: "flex items-center gap-1",
983
- onSubmit: (M) => {
984
- M.preventDefault();
983
+ onSubmit: (O) => {
984
+ O.preventDefault();
985
985
  const L = Wt.trim();
986
- L && L !== a.message && z.mutate({ messageId: a.id, text: L }), ct(null);
986
+ L && L !== a.message && q.mutate({ messageId: a.id, text: L }), ct(null);
987
987
  },
988
988
  children: [
989
989
  /* @__PURE__ */ e(
@@ -991,11 +991,11 @@ function ka({
991
991
  {
992
992
  autoFocus: !0,
993
993
  value: Wt,
994
- onChange: (M) => Bt(M.target.value),
995
- onKeyDown: (M) => {
996
- M.key === "Escape" && ct(null);
994
+ onChange: (O) => Bt(O.target.value),
995
+ onKeyDown: (O) => {
996
+ O.key === "Escape" && ct(null);
997
997
  },
998
- className: m(
998
+ className: u(
999
999
  "h-8 w-[240px] rounded-lg border px-2 text-[12px] outline-none",
1000
1000
  x.input
1001
1001
  ),
@@ -1006,7 +1006,7 @@ function ka({
1006
1006
  "button",
1007
1007
  {
1008
1008
  type: "submit",
1009
- className: m("rounded-md px-1.5 py-1 text-[11px] font-medium", x.accentText),
1009
+ className: u("rounded-md px-1.5 py-1 text-[11px] font-medium", x.accentText),
1010
1010
  children: "Save"
1011
1011
  }
1012
1012
  )
@@ -1015,10 +1015,10 @@ function ka({
1015
1015
  ) : /* @__PURE__ */ n(
1016
1016
  "div",
1017
1017
  {
1018
- className: m(
1018
+ className: u(
1019
1019
  "inline-block max-w-full rounded-2xl text-left leading-snug",
1020
1020
  at === "compact" ? "px-2.5 py-1 text-[12px]" : "px-3 py-1.5 text-[12.5px]",
1021
- w ? m("rounded-br-md", x.bubbleMine) : m("rounded-bl-md", x.bubbleOther),
1021
+ w ? u("rounded-br-md", x.bubbleMine) : u("rounded-bl-md", x.bubbleOther),
1022
1022
  a.urgent && "ring-2 ring-red-400/70"
1023
1023
  ),
1024
1024
  children: [
@@ -1027,7 +1027,7 @@ function ka({
1027
1027
  {
1028
1028
  type: "button",
1029
1029
  onClick: () => ea(a.quote.id),
1030
- className: m(
1030
+ className: u(
1031
1031
  "mb-1 block w-full rounded-md border-l-2 px-2 py-1 text-left text-[11px]",
1032
1032
  w ? "border-white/60 bg-black/10" : "border-slate-400 bg-white/70 dark:border-slate-500 dark:bg-black/20"
1033
1033
  ),
@@ -1039,33 +1039,33 @@ function ka({
1039
1039
  }
1040
1040
  ),
1041
1041
  a.message && (l ? l(a, { mine: w }) : /* @__PURE__ */ e(
1042
- Gs,
1042
+ Kr,
1043
1043
  {
1044
1044
  text: a.message,
1045
1045
  mine: w,
1046
- renderToken: w ? _n : Cn,
1046
+ renderToken: w ? Un : Tn,
1047
1047
  entityPattern: h.entityPattern,
1048
1048
  timeRefs: a.time_refs,
1049
1049
  navigate: h.navigate
1050
1050
  }
1051
1051
  )),
1052
- a.poll && /* @__PURE__ */ e(Ks, { poll: a.poll, room: a.room, mine: w }),
1053
- (a.attachments ?? []).length > 0 && /* @__PURE__ */ e("div", { className: m("flex flex-wrap gap-1.5", a.message && "mt-1.5"), children: (a.attachments ?? []).map((M) => {
1054
- const L = ft == null ? void 0 : ft.get(M), gt = (L == null ? void 0 : L.title) || (L == null ? void 0 : L.filename_download) || "Attachment", fa = u.fileUrl(M), Sn = ((L == null ? void 0 : L.type) ?? "").startsWith("image/"), ga = () => zt({
1055
- id: M,
1056
- url: fa,
1052
+ a.poll && /* @__PURE__ */ e(Yr, { poll: a.poll, room: a.room, mine: w }),
1053
+ (a.attachments ?? []).length > 0 && /* @__PURE__ */ e("div", { className: u("flex flex-wrap gap-1.5", a.message && "mt-1.5"), children: (a.attachments ?? []).map((O) => {
1054
+ const L = bt == null ? void 0 : bt.get(O), gt = (L == null ? void 0 : L.title) || (L == null ? void 0 : L.filename_download) || "Attachment", ba = m.fileUrl(O), Dn = ((L == null ? void 0 : L.type) ?? "").startsWith("image/"), ga = () => zt({
1055
+ id: O,
1056
+ url: ba,
1057
1057
  name: gt,
1058
1058
  type: (L == null ? void 0 : L.type) ?? null,
1059
1059
  size: (L == null ? void 0 : L.filesize) ?? null
1060
- }), vt = q && fe.length > 0 ? /* @__PURE__ */ e(
1061
- ur,
1060
+ }), vt = W && ye.length > 0 ? /* @__PURE__ */ e(
1061
+ hs,
1062
1062
  {
1063
- targets: fe,
1064
- recordLabel: q.label,
1065
- onPick: (Tn) => O.mutate({ messageId: a.id, fileId: M, field: Tn })
1063
+ targets: ye,
1064
+ recordLabel: W.label,
1065
+ onPick: ($n) => U.mutate({ messageId: a.id, fileId: O, field: $n })
1066
1066
  }
1067
1067
  ) : null;
1068
- return Sn ? /* @__PURE__ */ n("span", { className: "relative inline-block", children: [
1068
+ return Dn ? /* @__PURE__ */ n("span", { className: "relative inline-block", children: [
1069
1069
  /* @__PURE__ */ e(
1070
1070
  "button",
1071
1071
  {
@@ -1075,7 +1075,7 @@ function ka({
1075
1075
  children: /* @__PURE__ */ e(
1076
1076
  "img",
1077
1077
  {
1078
- src: fa,
1078
+ src: ba,
1079
1079
  alt: gt,
1080
1080
  className: "max-h-40 max-w-[220px] rounded-lg object-cover",
1081
1081
  loading: "lazy"
@@ -1084,57 +1084,57 @@ function ka({
1084
1084
  }
1085
1085
  ),
1086
1086
  vt && /* @__PURE__ */ e("span", { className: "absolute right-1 top-1", children: vt })
1087
- ] }, M) : /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-1", children: [
1087
+ ] }, O) : /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-1", children: [
1088
1088
  /* @__PURE__ */ n(
1089
1089
  "button",
1090
1090
  {
1091
1091
  type: "button",
1092
1092
  onClick: ga,
1093
- className: m(
1093
+ className: u(
1094
1094
  "inline-flex max-w-[220px] items-center gap-1.5 rounded-lg border px-2 py-1 text-[11.5px]",
1095
1095
  w ? "border-white/30 bg-white/10" : "border-slate-200 bg-white dark:border-border dark:bg-card"
1096
1096
  ),
1097
1097
  children: [
1098
- /* @__PURE__ */ e(Yn, { className: "h-3 w-3 shrink-0 opacity-60" }),
1098
+ /* @__PURE__ */ e(Xn, { className: "h-3 w-3 shrink-0 opacity-60" }),
1099
1099
  /* @__PURE__ */ e("span", { className: "truncate", children: gt })
1100
1100
  ]
1101
1101
  }
1102
1102
  ),
1103
1103
  vt
1104
- ] }, M);
1104
+ ] }, O);
1105
1105
  }) })
1106
1106
  ]
1107
1107
  }
1108
1108
  ),
1109
- !G && !Fe && a.message && !a.no_preview && /* @__PURE__ */ e("div", { className: m(w && "flex justify-end"), children: /* @__PURE__ */ e(
1110
- Qs,
1109
+ !K && !Fe && a.message && !a.no_preview && /* @__PURE__ */ e("div", { className: u(w && "flex justify-end"), children: /* @__PURE__ */ e(
1110
+ Jr,
1111
1111
  {
1112
1112
  text: a.message,
1113
1113
  navigate: h.navigate,
1114
- onDismiss: w ? () => B.mutate(a.id) : void 0
1114
+ onDismiss: w ? () => E.mutate(a.id) : void 0
1115
1115
  }
1116
1116
  ) }),
1117
- ce.size > 0 && /* @__PURE__ */ e(
1117
+ ue.size > 0 && /* @__PURE__ */ e(
1118
1118
  "div",
1119
1119
  {
1120
- className: m("mt-0.5 flex flex-wrap gap-1", w && "justify-end"),
1120
+ className: u("mt-0.5 flex flex-wrap gap-1", w && "justify-end"),
1121
1121
  "data-chat-reactions": !0,
1122
- children: [...ce.entries()].map(([M, L]) => /* @__PURE__ */ n(
1122
+ children: [...ue.entries()].map(([O, L]) => /* @__PURE__ */ n(
1123
1123
  "button",
1124
1124
  {
1125
1125
  type: "button",
1126
1126
  title: L.names.join(", "),
1127
- onClick: () => _.mutate({ messageId: a.id, emoji: M }),
1128
- className: m(
1127
+ onClick: () => _.mutate({ messageId: a.id, emoji: O }),
1128
+ className: u(
1129
1129
  "inline-flex items-center gap-0.5 rounded-full border px-1.5 py-px text-[10.5px] leading-tight transition-colors",
1130
- L.mine ? m("font-semibold", x.accentSoft, "border-transparent") : "border-slate-200 bg-white text-slate-600 hover:bg-slate-50 dark:border-border dark:bg-card dark:text-slate-300 dark:hover:bg-muted"
1130
+ L.mine ? u("font-semibold", x.accentSoft, "border-transparent") : "border-slate-200 bg-white text-slate-600 hover:bg-slate-50 dark:border-border dark:bg-card dark:text-slate-300 dark:hover:bg-muted"
1131
1131
  ),
1132
1132
  children: [
1133
- /* @__PURE__ */ e("span", { children: M }),
1133
+ /* @__PURE__ */ e("span", { children: O }),
1134
1134
  /* @__PURE__ */ e("span", { className: "tabular-nums", children: L.count })
1135
1135
  ]
1136
1136
  },
1137
- M
1137
+ O
1138
1138
  ))
1139
1139
  }
1140
1140
  ),
@@ -1143,48 +1143,48 @@ function ka({
1143
1143
  {
1144
1144
  type: "button",
1145
1145
  onClick: () => $e(a.id),
1146
- className: m(
1146
+ className: u(
1147
1147
  "mt-1 flex items-center gap-1.5 rounded-md px-1 py-0.5 text-[11px] font-medium hover:bg-slate-100 dark:hover:bg-muted",
1148
1148
  x.accentText,
1149
1149
  w && "ml-auto"
1150
1150
  ),
1151
1151
  "data-chat-thread-summary": a.thread.count,
1152
1152
  children: [
1153
- /* @__PURE__ */ e("span", { className: "flex -space-x-1.5", children: a.thread.people.slice(0, 3).map((M) => /* @__PURE__ */ e(X, { id: M.id, name: M.name, size: 16, presence: !1 }, M.id)) }),
1153
+ /* @__PURE__ */ e("span", { className: "flex -space-x-1.5", children: a.thread.people.slice(0, 3).map((O) => /* @__PURE__ */ e(te, { id: O.id, name: O.name, size: 16, presence: !1 }, O.id)) }),
1154
1154
  a.thread.count,
1155
1155
  " ",
1156
1156
  a.thread.count === 1 ? "reply" : "replies",
1157
1157
  a.thread.last_reply_at && /* @__PURE__ */ n("span", { className: "font-normal text-slate-500 dark:text-slate-400", children: [
1158
1158
  "· last ",
1159
- Ma(a.thread.last_reply_at)
1159
+ Pa(a.thread.last_reply_at)
1160
1160
  ] })
1161
1161
  ]
1162
1162
  }
1163
1163
  ),
1164
1164
  /* @__PURE__ */ n("p", { className: "mt-0.5 flex items-center justify-end gap-1 text-[10px] text-slate-500 dark:text-slate-400", children: [
1165
1165
  !w && /* @__PURE__ */ e("span", { className: "mr-auto" }),
1166
- a.edited_at && !G && /* @__PURE__ */ e("span", { className: "italic", children: "(edited)" }),
1166
+ a.edited_at && !K && /* @__PURE__ */ e("span", { className: "italic", children: "(edited)" }),
1167
1167
  new Date(a.date_created).toLocaleTimeString("en-US", {
1168
1168
  hour: "numeric",
1169
1169
  minute: "2-digit"
1170
1170
  }),
1171
- w && ge && !G && (() => {
1171
+ w && ke && !K && (() => {
1172
1172
  var L;
1173
- const M = we(a);
1174
- return M.length === 0 ? null : /* @__PURE__ */ e(
1175
- pr,
1173
+ const O = de(a);
1174
+ return O.length === 0 ? null : /* @__PURE__ */ e(
1175
+ fs,
1176
1176
  {
1177
- seen: M,
1177
+ seen: O,
1178
1178
  channelId: ((L = g == null ? void 0 : g.channel) == null ? void 0 : L.id) ?? null,
1179
1179
  senderId: String(a.sender ?? "")
1180
1180
  }
1181
1181
  );
1182
1182
  })(),
1183
- p.isLastMine && t.startsWith("dm:") && (J ? /* @__PURE__ */ n("span", { className: m("inline-flex items-center gap-0.5 font-medium", x.accentText), children: [
1184
- /* @__PURE__ */ e(Zn, { className: "h-3 w-3", strokeWidth: 2.4 }),
1183
+ p.isLastMine && t.startsWith("dm:") && (Z ? /* @__PURE__ */ n("span", { className: u("inline-flex items-center gap-0.5 font-medium", x.accentText), children: [
1184
+ /* @__PURE__ */ e(er, { className: "h-3 w-3", strokeWidth: 2.4 }),
1185
1185
  " Read"
1186
1186
  ] }) : /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-0.5", children: [
1187
- /* @__PURE__ */ e(rt, { className: "h-3 w-3", strokeWidth: 2.2 }),
1187
+ /* @__PURE__ */ e(st, { className: "h-3 w-3", strokeWidth: 2.2 }),
1188
1188
  " Sent"
1189
1189
  ] }))
1190
1190
  ] })
@@ -1192,19 +1192,19 @@ function ka({
1192
1192
  ]
1193
1193
  }
1194
1194
  );
1195
- }, sa = (a) => /* @__PURE__ */ e(
1196
- ws,
1195
+ }, ra = (a) => /* @__PURE__ */ e(
1196
+ Cr,
1197
1197
  {
1198
1198
  ref: a ? void 0 : Vt,
1199
1199
  room: t,
1200
1200
  label: C,
1201
1201
  parentId: a,
1202
- quote: a ? gn : fn,
1202
+ quote: a ? kn : yn,
1203
1203
  onClearQuote: () => a ? Yt(null) : Jt(null),
1204
- onSent: yn,
1204
+ onSent: Nn,
1205
1205
  disabledReason: a ? null : aa,
1206
1206
  th: x,
1207
- renderAvatar: (p, w) => /* @__PURE__ */ e(X, { id: p, name: w, size: 22, presence: p !== "__bot__" })
1207
+ renderAvatar: (p, w) => /* @__PURE__ */ e(te, { id: p, name: w, size: 22, presence: p !== "__bot__" })
1208
1208
  }
1209
1209
  );
1210
1210
  return /* @__PURE__ */ n(
@@ -1223,7 +1223,7 @@ function ka({
1223
1223
  a.dataTransfer.files.length && (a.preventDefault(), ut(!1), (p = Vt.current) == null || p.addFiles([...a.dataTransfer.files]));
1224
1224
  },
1225
1225
  children: [
1226
- vn && /* @__PURE__ */ e(
1226
+ wn && /* @__PURE__ */ e(
1227
1227
  "div",
1228
1228
  {
1229
1229
  className: "pointer-events-none absolute inset-2 z-30 flex items-center justify-center rounded-xl border-2 border-dashed border-nvr-cyan bg-white/85 text-[13px] font-semibold text-slate-700 dark:bg-card/90 dark:text-slate-100",
@@ -1231,7 +1231,7 @@ function ka({
1231
1231
  children: "Drop to attach to your message"
1232
1232
  }
1233
1233
  ),
1234
- /* @__PURE__ */ n("div", { className: m("flex shrink-0 items-center gap-1.5 border-b px-3 py-2", x.divider), children: [
1234
+ /* @__PURE__ */ n("div", { className: u("flex shrink-0 items-center gap-1.5 border-b px-3 py-2", x.divider), children: [
1235
1235
  /* @__PURE__ */ e(
1236
1236
  "button",
1237
1237
  {
@@ -1239,15 +1239,15 @@ function ka({
1239
1239
  onClick: o,
1240
1240
  className: "rounded-md p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100",
1241
1241
  "aria-label": "Back to conversations",
1242
- children: /* @__PURE__ */ e(st, { className: "h-4 w-4", strokeWidth: 2 })
1242
+ children: /* @__PURE__ */ e(rt, { className: "h-4 w-4", strokeWidth: 2 })
1243
1243
  }
1244
1244
  ),
1245
1245
  ((g == null ? void 0 : g.kind) === "channel" && !((oa = g.channel) != null && oa.is_direct) || (g == null ? void 0 : g.kind) === "global" && (((ia = g.channel) == null ? void 0 : ia.icon) || ((ca = g.channel) == null ? void 0 : ca.color))) && /* @__PURE__ */ e(He, { icon: (da = g == null ? void 0 : g.channel) == null ? void 0 : da.icon, color: (ua = g == null ? void 0 : g.channel) == null ? void 0 : ua.color, size: 24 }),
1246
- f && ye(t, f.id) && /* @__PURE__ */ e(nr, { peerId: ye(t, f.id), name: C }),
1246
+ b && Ne(t, b.id) && /* @__PURE__ */ e(ss, { peerId: Ne(t, b.id), name: C }),
1247
1247
  /* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
1248
1248
  /* @__PURE__ */ n("p", { className: "flex items-center gap-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: [
1249
1249
  /* @__PURE__ */ e("span", { className: "truncate", children: C }),
1250
- (H == null ? void 0 : H.announce) && /* @__PURE__ */ e(
1250
+ (Q == null ? void 0 : Q.announce) && /* @__PURE__ */ e(
1251
1251
  "span",
1252
1252
  {
1253
1253
  className: "shrink-0 rounded bg-slate-100 px-1 text-[9.5px] font-semibold uppercase tracking-wide text-slate-600 dark:bg-muted dark:text-slate-300",
@@ -1256,24 +1256,24 @@ function ka({
1256
1256
  }
1257
1257
  )
1258
1258
  ] }),
1259
- f && ye(t, f.id) ? /* @__PURE__ */ e(cr, { peerId: ye(t, f.id), name: C }) : t.startsWith("ch:") ? /* @__PURE__ */ e(
1260
- Js,
1259
+ b && Ne(t, b.id) ? /* @__PURE__ */ e(us, { peerId: Ne(t, b.id), name: C }) : t.startsWith("ch:") ? /* @__PURE__ */ e(
1260
+ Zr,
1261
1261
  {
1262
1262
  room: t,
1263
1263
  me: ((ma = h.me) == null ? void 0 : ma.id) ?? null,
1264
- renderAvatar: (a, p) => /* @__PURE__ */ e(X, { id: a, name: p, size: 24 })
1264
+ renderAvatar: (a, p) => /* @__PURE__ */ e(te, { id: a, name: p, size: 24 })
1265
1265
  }
1266
1266
  ) : null
1267
1267
  ] }),
1268
- me && /* @__PURE__ */ n(
1268
+ pe && /* @__PURE__ */ n(
1269
1269
  "button",
1270
1270
  {
1271
1271
  type: "button",
1272
1272
  onClick: () => {
1273
1273
  var a;
1274
- return (a = h.navigate) == null ? void 0 : a.call(h, me);
1274
+ return (a = h.navigate) == null ? void 0 : a.call(h, pe);
1275
1275
  },
1276
- className: m(
1276
+ className: u(
1277
1277
  "flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] font-medium transition-colors",
1278
1278
  x.accentText,
1279
1279
  "hover:bg-slate-100 dark:hover:bg-muted"
@@ -1281,7 +1281,7 @@ function ka({
1281
1281
  title: "Open the record this room belongs to",
1282
1282
  "data-chat-open-record": !0,
1283
1283
  children: [
1284
- /* @__PURE__ */ e(Pn, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
1284
+ /* @__PURE__ */ e(jn, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
1285
1285
  "Open record"
1286
1286
  ]
1287
1287
  }
@@ -1290,8 +1290,8 @@ function ka({
1290
1290
  "button",
1291
1291
  {
1292
1292
  type: "button",
1293
- onClick: () => rn.mutate({ room: t, starred: !g.starred }),
1294
- className: m(
1293
+ onClick: () => cn.mutate({ room: t, starred: !g.starred }),
1294
+ className: u(
1295
1295
  "rounded-md p-1 transition-colors",
1296
1296
  g.starred ? "text-amber-500" : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
1297
1297
  ),
@@ -1300,20 +1300,20 @@ function ka({
1300
1300
  title: g.starred ? "Starred — click to unstar" : "Star — keep it at the top of your list",
1301
1301
  "data-chat-star": g.starred ? "on" : "off",
1302
1302
  children: /* @__PURE__ */ e(
1303
- Ua,
1303
+ Ra,
1304
1304
  {
1305
- className: m("h-3.5 w-3.5", g.starred && "fill-current"),
1305
+ className: u("h-3.5 w-3.5", g.starred && "fill-current"),
1306
1306
  strokeWidth: 2
1307
1307
  }
1308
1308
  )
1309
1309
  }
1310
1310
  ),
1311
- /* @__PURE__ */ e(rr, { botName: oe }),
1311
+ /* @__PURE__ */ e(os, { botName: ie }),
1312
1312
  /* @__PURE__ */ e(
1313
- Ys,
1313
+ Vr,
1314
1314
  {
1315
1315
  onJump: (a) => {
1316
- Ce.current = !1, ie.current = !1, E({ date: a });
1316
+ _e.current = !1, ce.current = !1, F({ date: a });
1317
1317
  }
1318
1318
  }
1319
1319
  ),
@@ -1322,17 +1322,17 @@ function ka({
1322
1322
  {
1323
1323
  type: "button",
1324
1324
  onClick: () => {
1325
- hn((a) => !a), Et("");
1325
+ fn((a) => !a), Et("");
1326
1326
  },
1327
- className: m(
1327
+ className: u(
1328
1328
  "rounded-md p-1 transition-colors",
1329
1329
  it ? x.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
1330
1330
  ),
1331
1331
  "aria-label": "Search in this conversation",
1332
- children: /* @__PURE__ */ e(Sa, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1332
+ children: /* @__PURE__ */ e(Da, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1333
1333
  }
1334
1334
  ),
1335
- ((ha = g == null ? void 0 : g.channel) == null ? void 0 : ha.is_direct) && /* @__PURE__ */ e(xr, { channel: g.channel, onLeft: o }),
1335
+ ((ha = g == null ? void 0 : g.channel) == null ? void 0 : ha.is_direct) && /* @__PURE__ */ e(bs, { channel: g.channel, onLeft: o }),
1336
1336
  (t.startsWith("dm:") || ((pa = g == null ? void 0 : g.channel) == null ? void 0 : pa.is_direct)) && /* @__PURE__ */ e(
1337
1337
  "button",
1338
1338
  {
@@ -1342,21 +1342,21 @@ function ka({
1342
1342
  var a, p;
1343
1343
  try {
1344
1344
  let w = [];
1345
- if (t.startsWith("dm:") && f) {
1346
- const J = ye(t, f.id);
1347
- if (J) {
1348
- const G = await u.request(
1349
- ue(`/users/${J}`)
1345
+ if (t.startsWith("dm:") && b) {
1346
+ const Z = Ne(t, b.id);
1347
+ if (Z) {
1348
+ const K = await m.request(
1349
+ he(`/users/${Z}`)
1350
1350
  );
1351
- (a = G.data) != null && a.email && (w = [G.data.email]);
1351
+ (a = K.data) != null && a.email && (w = [K.data.email]);
1352
1352
  }
1353
- } else (p = g == null ? void 0 : g.channel) != null && p.id && (w = (await u.request(
1354
- ue(
1353
+ } else (p = g == null ? void 0 : g.channel) != null && p.id && (w = (await m.request(
1354
+ he(
1355
1355
  `/chat/channels/${g.channel.id}/members`
1356
1356
  )
1357
- )).data.filter((G) => G.email && G.user.toUpperCase() !== (f == null ? void 0 : f.id.toUpperCase())).map((G) => G.email));
1357
+ )).data.filter((K) => K.email && K.user.toUpperCase() !== (b == null ? void 0 : b.id.toUpperCase())).map((K) => K.email));
1358
1358
  if (w.length === 0) {
1359
- de.error("No callable participants found");
1359
+ me.error("No callable participants found");
1360
1360
  return;
1361
1361
  }
1362
1362
  window.open(
@@ -1365,13 +1365,13 @@ function ka({
1365
1365
  "noopener"
1366
1366
  );
1367
1367
  } catch {
1368
- de.error("Could not resolve participants");
1368
+ me.error("Could not resolve participants");
1369
1369
  }
1370
1370
  },
1371
1371
  className: "rounded-md p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100",
1372
1372
  "aria-label": "Start a Teams call",
1373
1373
  "data-chat-teams-call": !0,
1374
- children: /* @__PURE__ */ e(jn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1374
+ children: /* @__PURE__ */ e(qn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1375
1375
  }
1376
1376
  ),
1377
1377
  g && /* @__PURE__ */ n("div", { className: "relative flex items-center", children: [
@@ -1380,20 +1380,20 @@ function ka({
1380
1380
  {
1381
1381
  type: "button",
1382
1382
  onClick: () => Ht((a) => !a),
1383
- className: m(
1383
+ className: u(
1384
1384
  "rounded-md p-1 transition-colors",
1385
1385
  g.muted || g.notify_mode === "mentions" ? x.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
1386
1386
  ),
1387
1387
  "aria-label": "Notification settings for this room",
1388
1388
  title: g.muted ? "Muted" : g.notify_mode === "mentions" ? "Mentions only" : "All messages",
1389
1389
  "data-chat-notify": !0,
1390
- children: g.muted ? /* @__PURE__ */ e(_t, { className: "h-3.5 w-3.5", strokeWidth: 2 }) : /* @__PURE__ */ e(Aa, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1390
+ children: g.muted ? /* @__PURE__ */ e(_t, { className: "h-3.5 w-3.5", strokeWidth: 2 }) : /* @__PURE__ */ e(Oa, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1391
1391
  }
1392
1392
  ),
1393
- bn && /* @__PURE__ */ e(
1393
+ vn && /* @__PURE__ */ e(
1394
1394
  "div",
1395
1395
  {
1396
- className: m(
1396
+ className: u(
1397
1397
  "absolute right-0 top-full z-30 mt-1 w-[160px] overflow-hidden rounded-lg border py-1 shadow-lg",
1398
1398
  x.surface,
1399
1399
  "border-slate-200 dark:border-border"
@@ -1411,15 +1411,15 @@ function ka({
1411
1411
  {
1412
1412
  type: "button",
1413
1413
  onClick: () => {
1414
- Ht(!1), a === "muted" ? K.mutate({ room: t, muted: !0 }) : (g.muted && K.mutate({ room: t, muted: !1 }), De.mutate({ room: t, mode: a }));
1414
+ Ht(!1), a === "muted" ? B.mutate({ room: t, muted: !0 }) : (g.muted && B.mutate({ room: t, muted: !1 }), Y.mutate({ room: t, mode: a }));
1415
1415
  },
1416
- className: m(
1416
+ className: u(
1417
1417
  "flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px]",
1418
1418
  w ? x.accentSoft : "text-slate-600 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-muted"
1419
1419
  ),
1420
1420
  children: [
1421
1421
  p,
1422
- w && /* @__PURE__ */ e(rt, { className: "ml-auto h-3 w-3" })
1422
+ w && /* @__PURE__ */ e(st, { className: "ml-auto h-3 w-3" })
1423
1423
  ]
1424
1424
  },
1425
1425
  a
@@ -1431,9 +1431,9 @@ function ka({
1431
1431
  "button",
1432
1432
  {
1433
1433
  type: "button",
1434
- onClick: () => on.mutate(t, {
1434
+ onClick: () => un.mutate(t, {
1435
1435
  onSuccess: () => {
1436
- de.success(`Left ${g.label}`, {
1436
+ me.success(`Left ${g.label}`, {
1437
1437
  description: "Open the record's chat again to rejoin."
1438
1438
  }), o();
1439
1439
  }
@@ -1442,18 +1442,18 @@ function ka({
1442
1442
  "aria-label": "Leave this record's chat",
1443
1443
  className: "rounded-md p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100",
1444
1444
  "data-chat-leave-room": !0,
1445
- children: /* @__PURE__ */ e(Ra, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1445
+ children: /* @__PURE__ */ e(La, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1446
1446
  }
1447
1447
  ),
1448
- g && mn && /* @__PURE__ */ e(
1448
+ g && xn && /* @__PURE__ */ e(
1449
1449
  "button",
1450
1450
  {
1451
1451
  type: "button",
1452
- onClick: () => sn.mutate(
1452
+ onClick: () => on.mutate(
1453
1453
  { room: t, archived: !g.archived },
1454
1454
  {
1455
1455
  onSuccess: () => {
1456
- g.archived ? de.success("Moved back to your chats") : (de.success("Archived for you — others in the conversation still see it", {
1456
+ g.archived ? me.success("Moved back to your chats") : (me.success("Archived for you — others in the conversation still see it", {
1457
1457
  description: "Find it under the Archived tab."
1458
1458
  }), o());
1459
1459
  }
@@ -1463,7 +1463,7 @@ function ka({
1463
1463
  "aria-label": g.archived ? "Unarchive conversation" : "Archive conversation for me",
1464
1464
  className: "rounded-md p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100",
1465
1465
  "data-chat-archive": g.archived ? "unarchive" : "archive",
1466
- children: g.archived ? /* @__PURE__ */ e(Da, { className: "h-3.5 w-3.5", strokeWidth: 2 }) : /* @__PURE__ */ e($a, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1466
+ children: g.archived ? /* @__PURE__ */ e(Aa, { className: "h-3.5 w-3.5", strokeWidth: 2 }) : /* @__PURE__ */ e(Ma, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1467
1467
  }
1468
1468
  ),
1469
1469
  /* @__PURE__ */ e(
@@ -1473,49 +1473,49 @@ function ka({
1473
1473
  onClick: () => {
1474
1474
  $e(null), Pe((a) => !a);
1475
1475
  },
1476
- className: m(
1476
+ className: u(
1477
1477
  "rounded-md p-1 transition-colors",
1478
1478
  Zt ? x.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
1479
1479
  ),
1480
1480
  "aria-label": "Room info — members, pinned, files and links",
1481
1481
  title: "Room info — members, pinned, files and links",
1482
1482
  "data-chat-info-button": !0,
1483
- children: /* @__PURE__ */ e(In, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1483
+ children: /* @__PURE__ */ e(En, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1484
1484
  }
1485
1485
  ),
1486
- r && /* @__PURE__ */ e(
1486
+ s && /* @__PURE__ */ e(
1487
1487
  "button",
1488
1488
  {
1489
1489
  type: "button",
1490
- onClick: r,
1490
+ onClick: s,
1491
1491
  className: "rounded-md p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100",
1492
1492
  "aria-label": "Channel settings",
1493
- children: /* @__PURE__ */ e(qn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1493
+ children: /* @__PURE__ */ e(Wn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1494
1494
  }
1495
1495
  )
1496
1496
  ] }),
1497
- it && /* @__PURE__ */ e("div", { className: m("shrink-0 border-b px-3 py-1.5", x.divider), children: /* @__PURE__ */ e(
1497
+ it && /* @__PURE__ */ e("div", { className: u("shrink-0 border-b px-3 py-1.5", x.divider), children: /* @__PURE__ */ e(
1498
1498
  "input",
1499
1499
  {
1500
1500
  autoFocus: !0,
1501
1501
  value: Ze,
1502
1502
  onChange: (a) => Et(a.target.value),
1503
1503
  placeholder: "Search messages…",
1504
- className: m("h-7 w-full rounded-md border px-2 text-[12px] outline-none", x.input),
1504
+ className: u("h-7 w-full rounded-md border px-2 text-[12px] outline-none", x.input),
1505
1505
  "aria-label": "Search messages"
1506
1506
  }
1507
1507
  ) }),
1508
- /* @__PURE__ */ e(lr, { room: t }),
1509
- H && !H.is_direct && /* @__PURE__ */ e(
1510
- Zs,
1508
+ /* @__PURE__ */ e(is, { room: t }),
1509
+ Q && !Q.is_direct && /* @__PURE__ */ e(
1510
+ Xr,
1511
1511
  {
1512
- description: H.description,
1513
- links: H.links,
1512
+ description: Q.description,
1513
+ links: Q.links,
1514
1514
  th: x,
1515
1515
  navigate: h.navigate
1516
1516
  }
1517
1517
  ),
1518
- N.length > 0 && /* @__PURE__ */ e("div", { className: m("shrink-0 border-b px-3 py-1", x.divider), "data-chat-pins-strip": !0, children: /* @__PURE__ */ n(
1518
+ N.length > 0 && /* @__PURE__ */ e("div", { className: u("shrink-0 border-b px-3 py-1", x.divider), "data-chat-pins-strip": !0, children: /* @__PURE__ */ n(
1519
1519
  "button",
1520
1520
  {
1521
1521
  type: "button",
@@ -1527,61 +1527,61 @@ function ka({
1527
1527
  /* @__PURE__ */ e(Nt, { className: "h-3 w-3", strokeWidth: 2 }),
1528
1528
  N.length,
1529
1529
  " pinned",
1530
- /* @__PURE__ */ e(st, { className: "ml-auto h-3 w-3 -rotate-90" })
1530
+ /* @__PURE__ */ e(rt, { className: "ml-auto h-3 w-3 -rotate-90" })
1531
1531
  ]
1532
1532
  }
1533
1533
  ) }),
1534
- Nn && (H == null ? void 0 : H.welcome_note) && /* @__PURE__ */ e(
1535
- Vs,
1534
+ Sn && (Q == null ? void 0 : Q.welcome_note) && /* @__PURE__ */ e(
1535
+ es,
1536
1536
  {
1537
- note: H.welcome_note,
1537
+ note: Q.welcome_note,
1538
1538
  channelName: C,
1539
1539
  th: x,
1540
- onDismiss: () => ln.mutate(t)
1540
+ onDismiss: () => dn.mutate(t)
1541
1541
  }
1542
1542
  ),
1543
1543
  /* @__PURE__ */ e(
1544
1544
  "div",
1545
1545
  {
1546
- ref: Ae,
1546
+ ref: Re,
1547
1547
  onScroll: (a) => {
1548
1548
  const p = a.currentTarget;
1549
- ie.current = p.scrollHeight - p.scrollTop - p.clientHeight < 48, Xe.current = p.scrollHeight, ie.current && ae && je(null);
1549
+ ce.current = p.scrollHeight - p.scrollTop - p.clientHeight < 48, Xe.current = p.scrollHeight, ce.current && se && Ie(null);
1550
1550
  },
1551
1551
  className: "relative min-h-0 flex-1 overflow-y-auto px-3 py-3",
1552
1552
  "data-chat-messages": !0,
1553
1553
  children: /* @__PURE__ */ n("div", { ref: Xt, className: at === "compact" ? "space-y-1" : "space-y-2.5", children: [
1554
- P && !xe && /* @__PURE__ */ e("div", { className: "flex justify-center", children: /* @__PURE__ */ e(
1554
+ I && !be && /* @__PURE__ */ e("div", { className: "flex justify-center", children: /* @__PURE__ */ e(
1555
1555
  "button",
1556
1556
  {
1557
1557
  type: "button",
1558
- disabled: W,
1558
+ disabled: z,
1559
1559
  onClick: () => {
1560
1560
  var a;
1561
- Xe.current = ((a = Ae.current) == null ? void 0 : a.scrollHeight) ?? 0, F();
1561
+ Xe.current = ((a = Re.current) == null ? void 0 : a.scrollHeight) ?? 0, H();
1562
1562
  },
1563
1563
  className: "rounded-full border border-slate-200 px-2.5 py-0.5 text-[11px] font-medium text-slate-600 hover:bg-muted disabled:opacity-50 dark:border-border dark:text-slate-300",
1564
1564
  "data-chat-load-older": !0,
1565
- children: W ? "Loading…" : "Load earlier messages"
1565
+ children: z ? "Loading…" : "Load earlier messages"
1566
1566
  }
1567
1567
  ) }),
1568
- A ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-500", children: "Loading…" }) : _e.length === 0 && Q.length === 0 ? /* @__PURE__ */ e("div", { className: "py-6 text-center text-[12px] text-slate-500", children: xe ? "No messages match." : T ? "Nothing was said around then." : /* @__PURE__ */ n(ke, { children: [
1568
+ A ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-500", children: "Loading…" }) : Se.length === 0 && J.length === 0 ? /* @__PURE__ */ e("div", { className: "py-6 text-center text-[12px] text-slate-500", children: be ? "No messages match." : T ? "Nothing was said around then." : /* @__PURE__ */ n(ve, { children: [
1569
1569
  /* @__PURE__ */ e("p", { children: "No messages yet — say hello." }),
1570
1570
  /* @__PURE__ */ n("p", { className: "mt-1 text-[11px]", children: [
1571
1571
  "Tip: @ mentions someone",
1572
- oe ? `, @${oe} asks the AI` : "",
1572
+ ie ? `, @${ie} asks the AI` : "",
1573
1573
  ", # inserts a record, and a record ID like AB26-12345 becomes a live link."
1574
1574
  ] })
1575
- ] }) }) : _e.map((a, p) => {
1576
- var Se;
1577
- const w = _e[p - 1], J = p === 0 || w && new Date(w.date_created).toDateString() !== new Date(a.date_created).toDateString(), G = !xe && !T && xt.current > 0 && p === Math.max(0, _e.length - xt.current), Re = at === "compact" && !J && !!w && w.sender === a.sender && !w.is_system && new Date(a.date_created).getTime() - new Date(w.date_created).getTime() < 5 * 6e4;
1575
+ ] }) }) : Se.map((a, p) => {
1576
+ var Te;
1577
+ const w = Se[p - 1], Z = p === 0 || w && new Date(w.date_created).toDateString() !== new Date(a.date_created).toDateString(), K = !be && !T && xt.current > 0 && p === Math.max(0, Se.length - xt.current), Ae = at === "compact" && !Z && !!w && w.sender === a.sender && !w.is_system && new Date(a.date_created).getTime() - new Date(w.date_created).getTime() < 5 * 6e4;
1578
1578
  return /* @__PURE__ */ n("div", { children: [
1579
- J && /* @__PURE__ */ n("div", { className: "my-2 flex items-center gap-2", children: [
1579
+ Z && /* @__PURE__ */ n("div", { className: "my-2 flex items-center gap-2", children: [
1580
1580
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-slate-100 dark:bg-border" }),
1581
- /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-slate-500 dark:text-slate-400", children: sr(a.date_created) }),
1581
+ /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-slate-500 dark:text-slate-400", children: ls(a.date_created) }),
1582
1582
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-slate-100 dark:bg-border" })
1583
1583
  ] }),
1584
- G && /* @__PURE__ */ n(
1584
+ K && /* @__PURE__ */ n(
1585
1585
  "div",
1586
1586
  {
1587
1587
  ref: pt,
@@ -1594,29 +1594,29 @@ function ka({
1594
1594
  "button",
1595
1595
  {
1596
1596
  type: "button",
1597
- disabled: j.isPending,
1598
- onClick: () => j.mutate(),
1597
+ disabled: P.isPending,
1598
+ onClick: () => P.mutate(),
1599
1599
  className: "rounded-full border border-red-200 px-1.5 py-px text-[9.5px] font-medium text-red-500 hover:text-red-600 disabled:opacity-50 dark:border-red-500/40",
1600
- children: j.isPending ? "Summarizing…" : "✨ What did I miss?"
1600
+ children: P.isPending ? "Summarizing…" : "✨ What did I miss?"
1601
1601
  }
1602
1602
  ),
1603
1603
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-red-300 dark:bg-red-500/50" })
1604
1604
  ]
1605
1605
  }
1606
1606
  ),
1607
- G && y && /* @__PURE__ */ e("div", { className: "my-1 rounded-md border border-nvr-cyan/25 bg-nvr-cyan/5 px-2.5 py-1.5 text-[11.5px] leading-snug text-slate-600 dark:text-slate-300", children: y }),
1607
+ K && y && /* @__PURE__ */ e("div", { className: "my-1 rounded-md border border-nvr-cyan/25 bg-nvr-cyan/5 px-2.5 py-1.5 text-[11.5px] leading-snug text-slate-600 dark:text-slate-300", children: y }),
1608
1608
  na(a, {
1609
- isLastMine: ((Se = a.sender) == null ? void 0 : Se.toLowerCase()) === Be && p === kn,
1610
- showSender: !Re
1609
+ isLastMine: ((Te = a.sender) == null ? void 0 : Te.toLowerCase()) === Be && p === Cn,
1610
+ showSender: !Ae
1611
1611
  })
1612
1612
  ] }, a.id);
1613
1613
  }),
1614
- !xe && !$ && /* @__PURE__ */ e(Ja, { items: Q, th: x }),
1615
- !xe && !$ && qe.live && oe && /* @__PURE__ */ e(
1616
- ps,
1614
+ !be && !R && /* @__PURE__ */ e(Va, { items: J, th: x }),
1615
+ !be && !R && qe.live && ie && /* @__PURE__ */ e(
1616
+ fr,
1617
1617
  {
1618
1618
  live: qe.live,
1619
- botName: oe,
1619
+ botName: ie,
1620
1620
  bubbleClass: x.bubbleOther,
1621
1621
  accentClass: x.accentText,
1622
1622
  onStop: qe.stop,
@@ -1626,26 +1626,26 @@ function ka({
1626
1626
  ] })
1627
1627
  }
1628
1628
  ),
1629
- (ae || $) && /* @__PURE__ */ e("div", { className: "pointer-events-none relative z-10 -mt-9 flex h-9 shrink-0 items-center justify-center", children: /* @__PURE__ */ e(
1629
+ (se || R) && /* @__PURE__ */ e("div", { className: "pointer-events-none relative z-10 -mt-9 flex h-9 shrink-0 items-center justify-center", children: /* @__PURE__ */ e(
1630
1630
  "button",
1631
1631
  {
1632
1632
  type: "button",
1633
1633
  onClick: () => {
1634
- if ($) {
1635
- Ce.current = !1, ie.current = !0, E(null);
1634
+ if (R) {
1635
+ _e.current = !1, ce.current = !0, F(null);
1636
1636
  return;
1637
1637
  }
1638
- ae && !bt(ae.firstId) && et(), je(null);
1638
+ se && !ft(se.firstId) && et(), Ie(null);
1639
1639
  },
1640
- className: m(
1640
+ className: u(
1641
1641
  "pointer-events-auto rounded-full px-3 py-1 text-[11.5px] font-semibold shadow-md",
1642
1642
  x.pill
1643
1643
  ),
1644
- "data-chat-new-pill": (ae == null ? void 0 : ae.count) ?? 0,
1645
- children: $ ? "Jump to the latest ↓" : `${ae == null ? void 0 : ae.count} new ${(ae == null ? void 0 : ae.count) === 1 ? "message" : "messages"} ↓`
1644
+ "data-chat-new-pill": (se == null ? void 0 : se.count) ?? 0,
1645
+ children: R ? "Jump to the latest ↓" : `${se == null ? void 0 : se.count} new ${(se == null ? void 0 : se.count) === 1 ? "message" : "messages"} ↓`
1646
1646
  }
1647
1647
  ) }),
1648
- /* @__PURE__ */ e("div", { className: "min-h-[18px] shrink-0 px-3.5", children: Ve && oe && !qe.live ? /* @__PURE__ */ n(
1648
+ /* @__PURE__ */ e("div", { className: "min-h-[18px] shrink-0 px-3.5", children: Ve && ie && !qe.live ? /* @__PURE__ */ n(
1649
1649
  "p",
1650
1650
  {
1651
1651
  className: "flex items-center gap-1.5 text-[11px] italic text-slate-500",
@@ -1656,27 +1656,27 @@ function ka({
1656
1656
  /* @__PURE__ */ e("span", { className: "h-1 w-1 animate-bounce rounded-full bg-slate-400 [animation-delay:150ms]" }),
1657
1657
  /* @__PURE__ */ e("span", { className: "h-1 w-1 animate-bounce rounded-full bg-slate-400 [animation-delay:300ms]" })
1658
1658
  ] }),
1659
- oe,
1659
+ ie,
1660
1660
  " is thinking…"
1661
1661
  ]
1662
1662
  }
1663
- ) : Z.typingText && /* @__PURE__ */ e("p", { className: "text-[11px] italic text-slate-500", children: Z.typingText }) }),
1664
- Ft && /* @__PURE__ */ e(us, { file: Ft, onClose: () => zt(null) }),
1665
- sa(null),
1663
+ ) : X.typingText && /* @__PURE__ */ e("p", { className: "text-[11px] italic text-slate-500", children: X.typingText }) }),
1664
+ Ft && /* @__PURE__ */ e(hr, { file: Ft, onClose: () => zt(null) }),
1665
+ ra(null),
1666
1666
  Gt != null && /* @__PURE__ */ e(
1667
- Xs,
1667
+ ts,
1668
1668
  {
1669
1669
  room: t,
1670
1670
  rootId: Gt,
1671
1671
  th: x,
1672
1672
  onClose: () => $e(null),
1673
1673
  renderRow: (a) => na(a, { inThread: !0 }),
1674
- renderComposer: (a) => sa(a),
1675
- renderOutbox: (a) => /* @__PURE__ */ e(dr, { room: t, parentId: a, th: x })
1674
+ renderComposer: (a) => ra(a),
1675
+ renderOutbox: (a) => /* @__PURE__ */ e(ms, { room: t, parentId: a, th: x })
1676
1676
  }
1677
1677
  ),
1678
1678
  Zt && /* @__PURE__ */ e(
1679
- er,
1679
+ as,
1680
1680
  {
1681
1681
  room: t,
1682
1682
  label: C,
@@ -1684,41 +1684,41 @@ function ka({
1684
1684
  pins: N,
1685
1685
  onClose: () => Pe(!1),
1686
1686
  onOpenMessage: ea,
1687
- onUnpin: (a) => b.mutate(a),
1687
+ onUnpin: (a) => f.mutate(a),
1688
1688
  navigate: h.navigate,
1689
- renderAvatar: (a, p) => /* @__PURE__ */ e(X, { id: a, name: p, size: 22 })
1689
+ renderAvatar: (a, p) => /* @__PURE__ */ e(te, { id: a, name: p, size: 22 })
1690
1690
  }
1691
1691
  )
1692
1692
  ]
1693
1693
  }
1694
1694
  );
1695
1695
  }
1696
- function dr({ room: t, parentId: s, th: o }) {
1697
- const r = Ga(t, s);
1698
- return /* @__PURE__ */ e(Ja, { items: r, th: o });
1696
+ function ms({ room: t, parentId: r, th: o }) {
1697
+ const s = Ja(t, r);
1698
+ return /* @__PURE__ */ e(Va, { items: s, th: o });
1699
1699
  }
1700
- function ur({
1700
+ function hs({
1701
1701
  targets: t,
1702
- recordLabel: s,
1702
+ recordLabel: r,
1703
1703
  onPick: o
1704
1704
  }) {
1705
- const [r, l] = U(!1);
1706
- return /* @__PURE__ */ n(Qe, { open: r, onOpenChange: l, children: [
1705
+ const [s, l] = D(!1);
1706
+ return /* @__PURE__ */ n(Qe, { open: s, onOpenChange: l, children: [
1707
1707
  /* @__PURE__ */ e(Ke, { asChild: !0, children: /* @__PURE__ */ e(
1708
1708
  "button",
1709
1709
  {
1710
1710
  type: "button",
1711
1711
  className: "rounded-full border border-slate-200 bg-white p-0.5 text-slate-500 shadow-sm hover:text-slate-800 dark:border-border dark:bg-card dark:hover:text-slate-100",
1712
- title: `Attach to ${s}`,
1713
- "aria-label": `Attach to ${s}`,
1712
+ title: `Attach to ${r}`,
1713
+ "aria-label": `Attach to ${r}`,
1714
1714
  "data-chat-attach-to-record": !0,
1715
- children: /* @__PURE__ */ e(Xn, { className: "h-3 w-3" })
1715
+ children: /* @__PURE__ */ e(ar, { className: "h-3 w-3" })
1716
1716
  }
1717
1717
  ) }),
1718
1718
  /* @__PURE__ */ n(Je, { align: "end", className: "w-[220px] p-1.5", children: [
1719
1719
  /* @__PURE__ */ n("p", { className: "px-2 pb-1 pt-0.5 text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: [
1720
1720
  "Attach to ",
1721
- s
1721
+ r
1722
1722
  ] }),
1723
1723
  t.map((i) => /* @__PURE__ */ e(
1724
1724
  "button",
@@ -1735,7 +1735,7 @@ function ur({
1735
1735
  ] })
1736
1736
  ] });
1737
1737
  }
1738
- function wa(t) {
1738
+ function _a(t) {
1739
1739
  return {
1740
1740
  id: t.id,
1741
1741
  visibility: t.visibility,
@@ -1746,38 +1746,38 @@ function wa(t) {
1746
1746
  color: t.color ?? null
1747
1747
  };
1748
1748
  }
1749
- const mr = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1749
+ const ps = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1750
1750
  function Tt(t) {
1751
- const s = typeof t.idle_minutes == "number" ? t.idle_minutes : t.last_active ? Math.floor((Date.now() - new Date(t.last_active).getTime()) / 6e4) : null;
1752
- return s == null || s < 1 ? "Idle" : s < 60 ? `Idle · ${s}m` : `Idle · ${Math.floor(s / 60)}h ${s % 60}m`;
1751
+ const r = typeof t.idle_minutes == "number" ? t.idle_minutes : t.last_active ? Math.floor((Date.now() - new Date(t.last_active).getTime()) / 6e4) : null;
1752
+ return r == null || r < 1 ? "Idle" : r < 60 ? `Idle · ${r}m` : `Idle · ${Math.floor(r / 60)}h ${r % 60}m`;
1753
1753
  }
1754
- function Na(t) {
1755
- const s = t == null ? void 0 : t.trim();
1756
- return !s || mr.test(s) ? null : s;
1754
+ function Sa(t) {
1755
+ const r = t == null ? void 0 : t.trim();
1756
+ return !r || ps.test(r) ? null : r;
1757
1757
  }
1758
- function hr(t) {
1759
- const s = new Date(t), o = /* @__PURE__ */ new Date(), r = s.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
1760
- return s.toDateString() === o.toDateString() ? r : (o.getTime() - s.getTime()) / 864e5 < 6 ? `${s.toLocaleDateString("en-US", { weekday: "short" })} ${r}` : `${s.toLocaleDateString("en-US", { month: "short", day: "numeric" })}, ${r}`;
1758
+ function xs(t) {
1759
+ const r = new Date(t), o = /* @__PURE__ */ new Date(), s = r.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
1760
+ return r.toDateString() === o.toDateString() ? s : (o.getTime() - r.getTime()) / 864e5 < 6 ? `${r.toLocaleDateString("en-US", { weekday: "short" })} ${s}` : `${r.toLocaleDateString("en-US", { month: "short", day: "numeric" })}, ${s}`;
1761
1761
  }
1762
- function pr({
1762
+ function fs({
1763
1763
  seen: t,
1764
- channelId: s,
1764
+ channelId: r,
1765
1765
  senderId: o
1766
1766
  }) {
1767
- const r = se(), [l, i] = U(!1), { members: c } = Ot(l ? s : null), d = new Set(t.map((u) => String(u.user).toUpperCase())), h = c.filter((u) => {
1768
- const f = String(u.user).toUpperCase();
1769
- return f !== o.toUpperCase() && !d.has(f);
1767
+ const s = oe(), [l, i] = D(!1), { members: c } = Ot(l ? r : null), d = new Set(t.map((m) => String(m.user).toUpperCase())), h = c.filter((m) => {
1768
+ const b = String(m.user).toUpperCase();
1769
+ return b !== o.toUpperCase() && !d.has(b);
1770
1770
  }), x = [...t].sort(
1771
- (u, f) => new Date(u.last_read_at).getTime() - new Date(f.last_read_at).getTime()
1771
+ (m, b) => new Date(m.last_read_at).getTime() - new Date(b.last_read_at).getTime()
1772
1772
  );
1773
1773
  return /* @__PURE__ */ n(Qe, { open: l, onOpenChange: i, children: [
1774
1774
  /* @__PURE__ */ e(Ke, { asChild: !0, children: /* @__PURE__ */ n(
1775
1775
  "button",
1776
1776
  {
1777
1777
  type: "button",
1778
- className: m(
1778
+ className: u(
1779
1779
  "font-medium underline decoration-dotted underline-offset-2 hover:decoration-solid",
1780
- r.accentText
1780
+ s.accentText
1781
1781
  ),
1782
1782
  "aria-label": `Seen by ${t.length} — show who`,
1783
1783
  "data-chat-seen-by": t.length,
@@ -1792,7 +1792,7 @@ function pr({
1792
1792
  {
1793
1793
  align: "end",
1794
1794
  sideOffset: 4,
1795
- className: m("w-[240px] p-0", r.surface),
1795
+ className: u("w-[240px] p-0", s.surface),
1796
1796
  "data-chat-seen-by-panel": !0,
1797
1797
  children: [
1798
1798
  /* @__PURE__ */ n("p", { className: "border-b border-slate-100 px-3 py-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400 dark:border-border", children: [
@@ -1800,29 +1800,29 @@ function pr({
1800
1800
  t.length
1801
1801
  ] }),
1802
1802
  /* @__PURE__ */ n("div", { className: "max-h-[260px] overflow-y-auto py-1", children: [
1803
- x.map((u) => /* @__PURE__ */ n("div", { className: "flex items-center gap-2 px-3 py-1.5", children: [
1804
- /* @__PURE__ */ e(X, { id: u.user, name: u.name || null, size: 22 }),
1805
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: u.name || "Someone" }),
1803
+ x.map((m) => /* @__PURE__ */ n("div", { className: "flex items-center gap-2 px-3 py-1.5", children: [
1804
+ /* @__PURE__ */ e(te, { id: m.user, name: m.name || null, size: 22 }),
1805
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: m.name || "Someone" }),
1806
1806
  /* @__PURE__ */ e(
1807
1807
  "span",
1808
1808
  {
1809
1809
  className: "shrink-0 text-[10.5px] tabular-nums text-slate-400",
1810
- "data-tip": `Last read the conversation ${new Date(u.last_read_at).toLocaleString("en-US", { dateStyle: "medium", timeStyle: "short" })}`,
1811
- children: hr(u.last_read_at)
1810
+ "data-tip": `Last read the conversation ${new Date(m.last_read_at).toLocaleString("en-US", { dateStyle: "medium", timeStyle: "short" })}`,
1811
+ children: xs(m.last_read_at)
1812
1812
  }
1813
1813
  )
1814
- ] }, u.user)),
1815
- h.length > 0 && /* @__PURE__ */ n(ke, { children: [
1814
+ ] }, m.user)),
1815
+ h.length > 0 && /* @__PURE__ */ n(ve, { children: [
1816
1816
  /* @__PURE__ */ n("p", { className: "px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
1817
1817
  "Not seen yet · ",
1818
1818
  h.length
1819
1819
  ] }),
1820
- h.map((u) => {
1821
- const f = [u.first_name, u.last_name].filter(Boolean).join(" ") || u.email || "Someone";
1820
+ h.map((m) => {
1821
+ const b = [m.first_name, m.last_name].filter(Boolean).join(" ") || m.email || "Someone";
1822
1822
  return /* @__PURE__ */ n("div", { className: "flex items-center gap-2 px-3 py-1.5 opacity-70", children: [
1823
- /* @__PURE__ */ e(X, { id: u.user, name: f, size: 22 }),
1824
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-600 dark:text-slate-300", children: f })
1825
- ] }, u.user);
1823
+ /* @__PURE__ */ e(te, { id: m.user, name: b, size: 22 }),
1824
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-600 dark:text-slate-300", children: b })
1825
+ ] }, m.user);
1826
1826
  })
1827
1827
  ] })
1828
1828
  ] }),
@@ -1832,11 +1832,11 @@ function pr({
1832
1832
  )
1833
1833
  ] });
1834
1834
  }
1835
- function xr({ channel: t, onLeft: s }) {
1836
- var P;
1837
- const o = se(), r = Te(), { isAdmin: l } = ot(), [i, c] = U(!1), { members: d, loading: h } = Ot(t.id), { addMember: x, removeMember: u } = Wa(t.id), [f, v] = U(""), D = It(f, 250), S = ((P = r.me) == null ? void 0 : P.id.toUpperCase()) ?? "", C = l || !!S && String(t.created_by ?? "").toUpperCase() === S, { users: T } = Lt(D, i && C && !!f.trim()), E = new Set(d.map(($) => String($.user).toUpperCase())), k = ($) => [$.first_name, $.last_name].filter(Boolean).join(" ") || $.email || $.user, A = [...d].sort(($, F) => {
1838
- const W = String($.user).toUpperCase(), Q = String(F.user).toUpperCase();
1839
- return W === S ? -1 : Q === S ? 1 : k($).localeCompare(k(F));
1835
+ function bs({ channel: t, onLeft: r }) {
1836
+ var I;
1837
+ const o = oe(), s = Ue(), { isAdmin: l } = ot(), [i, c] = D(!1), { members: d, loading: h } = Ot(t.id), { addMember: x, removeMember: m } = za(t.id), [b, v] = D(""), $ = jt(b, 250), S = ((I = s.me) == null ? void 0 : I.id.toUpperCase()) ?? "", C = l || !!S && String(t.created_by ?? "").toUpperCase() === S, { users: T } = Lt($, i && C && !!b.trim()), F = new Set(d.map((R) => String(R.user).toUpperCase())), k = (R) => [R.first_name, R.last_name].filter(Boolean).join(" ") || R.email || R.user, A = [...d].sort((R, H) => {
1838
+ const z = String(R.user).toUpperCase(), J = String(H.user).toUpperCase();
1839
+ return z === S ? -1 : J === S ? 1 : k(R).localeCompare(k(H));
1840
1840
  });
1841
1841
  return /* @__PURE__ */ n(Qe, { open: i, onOpenChange: c, children: [
1842
1842
  /* @__PURE__ */ e(Ke, { asChild: !0, children: /* @__PURE__ */ n(
@@ -1845,7 +1845,7 @@ function xr({ channel: t, onLeft: s }) {
1845
1845
  type: "button",
1846
1846
  title: "People in this conversation",
1847
1847
  "aria-label": "People in this conversation",
1848
- className: m(
1848
+ className: u(
1849
1849
  "flex items-center gap-1 rounded-md px-1 py-1 text-[11px] font-medium tabular-nums transition-colors",
1850
1850
  i ? o.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
1851
1851
  ),
@@ -1861,86 +1861,86 @@ function xr({ channel: t, onLeft: s }) {
1861
1861
  {
1862
1862
  align: "end",
1863
1863
  sideOffset: 6,
1864
- className: m("w-[260px] p-0", o.surface),
1864
+ className: u("w-[260px] p-0", o.surface),
1865
1865
  "data-chat-group-members-panel": !0,
1866
1866
  children: [
1867
- /* @__PURE__ */ e("div", { className: m("border-b px-3 py-2", o.divider), children: /* @__PURE__ */ n("p", { className: "text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
1867
+ /* @__PURE__ */ e("div", { className: u("border-b px-3 py-2", o.divider), children: /* @__PURE__ */ n("p", { className: "text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
1868
1868
  "In this conversation ",
1869
1869
  d.length > 0 && `· ${d.length}`
1870
1870
  ] }) }),
1871
1871
  /* @__PURE__ */ n("div", { className: "max-h-[280px] overflow-y-auto py-1", children: [
1872
1872
  h && /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "Loading…" }),
1873
- A.map(($) => {
1874
- const F = String($.user).toUpperCase(), W = k($), Q = F === S, te = String(t.created_by ?? "").toUpperCase() === F;
1873
+ A.map((R) => {
1874
+ const H = String(R.user).toUpperCase(), z = k(R), J = H === S, re = String(t.created_by ?? "").toUpperCase() === H;
1875
1875
  return /* @__PURE__ */ n(
1876
1876
  "div",
1877
1877
  {
1878
1878
  className: "group flex items-center gap-2 px-3 py-1.5",
1879
- "data-chat-group-member": $.user,
1879
+ "data-chat-group-member": R.user,
1880
1880
  children: [
1881
- /* @__PURE__ */ e(X, { id: $.user, name: W, size: 26 }),
1881
+ /* @__PURE__ */ e(te, { id: R.user, name: z, size: 26 }),
1882
1882
  /* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: [
1883
1883
  /* @__PURE__ */ n("span", { className: "block truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [
1884
- W,
1885
- Q && /* @__PURE__ */ e("span", { className: "text-slate-400", children: " (you)" })
1884
+ z,
1885
+ J && /* @__PURE__ */ e("span", { className: "text-slate-400", children: " (you)" })
1886
1886
  ] }),
1887
- te && /* @__PURE__ */ e("span", { className: "block text-[10.5px] text-slate-400", children: "Started the group" })
1887
+ re && /* @__PURE__ */ e("span", { className: "block text-[10.5px] text-slate-400", children: "Started the group" })
1888
1888
  ] }),
1889
- C && !Q && /* @__PURE__ */ e(
1889
+ C && !J && /* @__PURE__ */ e(
1890
1890
  "button",
1891
1891
  {
1892
1892
  type: "button",
1893
- title: `Remove ${W}`,
1894
- "aria-label": `Remove ${W}`,
1895
- onClick: () => u.mutate($.user),
1893
+ title: `Remove ${z}`,
1894
+ "aria-label": `Remove ${z}`,
1895
+ onClick: () => m.mutate(R.user),
1896
1896
  className: "rounded p-1 text-slate-400 opacity-0 transition-opacity hover:bg-slate-100 hover:text-red-500 focus:opacity-100 group-hover:opacity-100 dark:hover:bg-muted",
1897
1897
  children: /* @__PURE__ */ e(lt, { className: "h-3 w-3" })
1898
1898
  }
1899
1899
  )
1900
1900
  ]
1901
1901
  },
1902
- $.user
1902
+ R.user
1903
1903
  );
1904
1904
  })
1905
1905
  ] }),
1906
- C && /* @__PURE__ */ n("div", { className: m("border-t px-3 py-2", o.divider), children: [
1906
+ C && /* @__PURE__ */ n("div", { className: u("border-t px-3 py-2", o.divider), children: [
1907
1907
  /* @__PURE__ */ e(
1908
1908
  "input",
1909
1909
  {
1910
- value: f,
1911
- onChange: ($) => v($.target.value),
1910
+ value: b,
1911
+ onChange: (R) => v(R.target.value),
1912
1912
  placeholder: "Add someone…",
1913
- className: m("h-7 w-full rounded-md px-2 text-[12px] outline-none", o.input),
1913
+ className: u("h-7 w-full rounded-md px-2 text-[12px] outline-none", o.input),
1914
1914
  "data-chat-group-add": !0
1915
1915
  }
1916
1916
  ),
1917
- f.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-36 overflow-y-auto", children: T.filter(($) => !E.has(String($.id).toUpperCase())).map(($) => {
1918
- const F = [$.first_name, $.last_name].filter(Boolean).join(" ") || $.email || $.id;
1917
+ b.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-36 overflow-y-auto", children: T.filter((R) => !F.has(String(R.id).toUpperCase())).map((R) => {
1918
+ const H = [R.first_name, R.last_name].filter(Boolean).join(" ") || R.email || R.id;
1919
1919
  return /* @__PURE__ */ n(
1920
1920
  "button",
1921
1921
  {
1922
1922
  type: "button",
1923
1923
  onClick: () => {
1924
- x.mutate($.id), v("");
1924
+ x.mutate(R.id), v("");
1925
1925
  },
1926
1926
  className: "flex w-full items-center gap-2 rounded px-1 py-1 text-left hover:bg-muted",
1927
1927
  children: [
1928
- /* @__PURE__ */ e(X, { id: $.id, name: F, size: 22 }),
1929
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: F })
1928
+ /* @__PURE__ */ e(te, { id: R.id, name: H, size: 22 }),
1929
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: H })
1930
1930
  ]
1931
1931
  },
1932
- $.id
1932
+ R.id
1933
1933
  );
1934
1934
  }) })
1935
1935
  ] }),
1936
- S && E.has(S) && /* @__PURE__ */ e("div", { className: m("border-t px-3 py-1.5", o.divider), children: /* @__PURE__ */ e(
1936
+ S && F.has(S) && /* @__PURE__ */ e("div", { className: u("border-t px-3 py-1.5", o.divider), children: /* @__PURE__ */ e(
1937
1937
  "button",
1938
1938
  {
1939
1939
  type: "button",
1940
1940
  onClick: () => {
1941
- u.mutate(r.me.id, {
1941
+ m.mutate(s.me.id, {
1942
1942
  onSuccess: () => {
1943
- c(!1), s();
1943
+ c(!1), r();
1944
1944
  }
1945
1945
  });
1946
1946
  },
@@ -1954,17 +1954,17 @@ function xr({ channel: t, onLeft: s }) {
1954
1954
  )
1955
1955
  ] });
1956
1956
  }
1957
- function br({
1957
+ function gs({
1958
1958
  channel: t,
1959
- label: s,
1959
+ label: r,
1960
1960
  onBack: o
1961
1961
  }) {
1962
- const r = se(), l = Te(), { isAdmin: i } = ot(), c = Ea(), { members: d, loading: h } = Ot(t.id), { update: x, addMember: u, removeMember: f } = Wa(t.id), [v, D] = U(s), [S, C] = U(t.topic ?? ""), [T, E] = U(t.visibility), [k, A] = U(t.role ?? ""), [P, $] = U({
1962
+ const s = oe(), l = Ue(), { isAdmin: i } = ot(), c = Fa(), { members: d, loading: h } = Ot(t.id), { update: x, addMember: m, removeMember: b } = za(t.id), [v, $] = D(r), [S, C] = D(t.topic ?? ""), [T, F] = D(t.visibility), [k, A] = D(t.role ?? ""), [I, R] = D({
1963
1963
  icon: t.icon ?? null,
1964
1964
  color: t.color ?? null
1965
- }), [F, W] = U(""), Q = It(F, 250), { users: te } = Lt(Q, T === "private"), Z = t.id === Ba, Y = i || !Z && !!l.me && String(t.created_by ?? "") === String(l.me.id), me = new Set(d.map((N) => String(N.user).toUpperCase())), _ = v !== s || S !== (t.topic ?? "") || T !== t.visibility || P.icon !== (t.icon ?? null) || P.color !== (t.color ?? null) || T === "role" && k !== (t.role ?? "");
1965
+ }), [H, z] = D(""), J = jt(H, 250), { users: re } = Lt(J, T === "private"), X = t.id === Ha, V = i || !X && !!l.me && String(t.created_by ?? "") === String(l.me.id), pe = new Set(d.map((N) => String(N.user).toUpperCase())), _ = v !== r || S !== (t.topic ?? "") || T !== t.visibility || I.icon !== (t.icon ?? null) || I.color !== (t.color ?? null) || T === "role" && k !== (t.role ?? "");
1966
1966
  return /* @__PURE__ */ n("div", { className: "flex min-h-0 flex-1 flex-col", "data-chat-settings": !0, children: [
1967
- /* @__PURE__ */ n("div", { className: m("flex shrink-0 items-center gap-2 border-b px-3 py-2.5", r.divider), children: [
1967
+ /* @__PURE__ */ n("div", { className: u("flex shrink-0 items-center gap-2 border-b px-3 py-2.5", s.divider), children: [
1968
1968
  /* @__PURE__ */ e(
1969
1969
  "button",
1970
1970
  {
@@ -1972,30 +1972,30 @@ function br({
1972
1972
  onClick: o,
1973
1973
  className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-white/10 dark:hover:text-slate-100",
1974
1974
  "aria-label": "Back to conversation",
1975
- children: /* @__PURE__ */ e(st, { className: "h-4 w-4" })
1975
+ children: /* @__PURE__ */ e(rt, { className: "h-4 w-4" })
1976
1976
  }
1977
1977
  ),
1978
1978
  /* @__PURE__ */ n("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: [
1979
- s,
1979
+ r,
1980
1980
  " · settings"
1981
1981
  ] })
1982
1982
  ] }),
1983
1983
  /* @__PURE__ */ n("div", { className: "min-h-0 flex-1 space-y-4 overflow-y-auto p-3", children: [
1984
- Y ? /* @__PURE__ */ n(ke, { children: [
1984
+ V ? /* @__PURE__ */ n(ve, { children: [
1985
1985
  /* @__PURE__ */ n("label", { className: "block", children: [
1986
1986
  /* @__PURE__ */ e("span", { className: "mb-1 block text-[11px] font-medium text-slate-400", children: "Name" }),
1987
1987
  /* @__PURE__ */ e(
1988
1988
  "input",
1989
1989
  {
1990
1990
  value: v,
1991
- onChange: (N) => D(N.target.value),
1992
- className: m("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
1991
+ onChange: (N) => $(N.target.value),
1992
+ className: u("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", s.input)
1993
1993
  }
1994
1994
  )
1995
1995
  ] }),
1996
1996
  !t.is_direct && /* @__PURE__ */ n("div", { className: "flex items-start gap-3", children: [
1997
- /* @__PURE__ */ e(He, { icon: P.icon, color: P.color, size: 40 }),
1998
- /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ e(La, { icon: P.icon, color: P.color, onChange: $ }) })
1997
+ /* @__PURE__ */ e(He, { icon: I.icon, color: I.color, size: 40 }),
1998
+ /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ e(ja, { icon: I.icon, color: I.color, onChange: R }) })
1999
1999
  ] }),
2000
2000
  /* @__PURE__ */ n("label", { className: "block", children: [
2001
2001
  /* @__PURE__ */ e("span", { className: "mb-1 block text-[11px] font-medium text-slate-400", children: "Topic" }),
@@ -2005,37 +2005,37 @@ function br({
2005
2005
  value: S,
2006
2006
  onChange: (N) => C(N.target.value),
2007
2007
  placeholder: "What this channel is for",
2008
- className: m("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
2008
+ className: u("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", s.input)
2009
2009
  }
2010
2010
  )
2011
2011
  ] }),
2012
- !Z && /* @__PURE__ */ n("div", { children: [
2012
+ !X && /* @__PURE__ */ n("div", { children: [
2013
2013
  /* @__PURE__ */ e("span", { className: "mb-1 block text-[11px] font-medium text-slate-400", children: "Who can see it" }),
2014
2014
  /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: [
2015
2015
  ["open", "Anyone"],
2016
2016
  ["role", "One role"],
2017
2017
  ["private", "Invite only"]
2018
- ].map(([N, b]) => /* @__PURE__ */ e(
2018
+ ].map(([N, f]) => /* @__PURE__ */ e(
2019
2019
  "button",
2020
2020
  {
2021
2021
  type: "button",
2022
- onClick: () => E(N),
2023
- className: m(
2022
+ onClick: () => F(N),
2023
+ className: u(
2024
2024
  "rounded-md px-2 py-1 text-[11.5px] font-medium transition-colors",
2025
- T === N ? r.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
2025
+ T === N ? s.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
2026
2026
  ),
2027
- children: b
2027
+ children: f
2028
2028
  },
2029
2029
  N
2030
2030
  )) }),
2031
2031
  T === "role" && /* @__PURE__ */ e(
2032
- At,
2032
+ Rt,
2033
2033
  {
2034
2034
  value: k,
2035
2035
  onChange: A,
2036
- className: m(
2036
+ className: u(
2037
2037
  "mt-2 h-8 w-full rounded-md px-2 text-[12.5px] outline-none",
2038
- r.input
2038
+ s.input
2039
2039
  ),
2040
2040
  options: [
2041
2041
  { value: "", label: "Choose a role…" },
@@ -2051,28 +2051,28 @@ function br({
2051
2051
  type: "button",
2052
2052
  disabled: !_ || x.isPending || T === "role" && !k,
2053
2053
  onClick: () => x.mutate(
2054
- Z ? {
2055
- name: v.trim() || s,
2054
+ X ? {
2055
+ name: v.trim() || r,
2056
2056
  topic: S.trim() || null,
2057
- icon: P.icon,
2058
- color: P.color
2057
+ icon: I.icon,
2058
+ color: I.color
2059
2059
  } : {
2060
- name: v.trim() || s,
2060
+ name: v.trim() || r,
2061
2061
  topic: S.trim() || null,
2062
2062
  visibility: T,
2063
2063
  role: T === "role" ? k : null,
2064
- icon: P.icon,
2065
- color: P.color
2064
+ icon: I.icon,
2065
+ color: I.color
2066
2066
  }
2067
2067
  ),
2068
- className: m(
2068
+ className: u(
2069
2069
  "rounded-md px-2.5 py-1 text-[12px] font-medium disabled:opacity-40",
2070
- r.action
2070
+ s.action
2071
2071
  ),
2072
2072
  children: x.isPending ? "Saving…" : "Save"
2073
2073
  }
2074
2074
  ),
2075
- Z ? /* @__PURE__ */ e("span", { className: "ml-auto text-[11px] text-slate-400", children: "Open to everyone · cannot be archived" }) : /* @__PURE__ */ e(
2075
+ X ? /* @__PURE__ */ e("span", { className: "ml-auto text-[11px] text-slate-400", children: "Open to everyone · cannot be archived" }) : /* @__PURE__ */ e(
2076
2076
  "button",
2077
2077
  {
2078
2078
  type: "button",
@@ -2083,11 +2083,11 @@ function br({
2083
2083
  )
2084
2084
  ] }),
2085
2085
  x.isError && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-500", children: x.error.message }),
2086
- !t.is_direct && /* @__PURE__ */ e(xs, { channel: t, th: r, isAdmin: i })
2086
+ !t.is_direct && /* @__PURE__ */ e(br, { channel: t, th: s, isAdmin: i })
2087
2087
  ] }) : /* @__PURE__ */ n("p", { className: "text-[12px] leading-relaxed text-slate-500 dark:text-slate-400", children: [
2088
2088
  t.topic || "No topic set.",
2089
2089
  /* @__PURE__ */ e("br", {}),
2090
- Z ? "Everyone in the portal can find and join General." : t.visibility === "private" ? "Invite only — you were added by the channel owner." : t.visibility === "role" ? "Everyone with a particular role can see this channel." : "Anyone in the portal can find and join this channel."
2090
+ X ? "Everyone in the portal can find and join General." : t.visibility === "private" ? "Invite only — you were added by the channel owner." : t.visibility === "role" ? "Everyone with a particular role can see this channel." : "Anyone in the portal can find and join this channel."
2091
2091
  ] }),
2092
2092
  /* @__PURE__ */ n("div", { children: [
2093
2093
  /* @__PURE__ */ n("p", { className: "mb-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
@@ -2096,45 +2096,45 @@ function br({
2096
2096
  ] }),
2097
2097
  h && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "Loading…" }),
2098
2098
  d.map((N) => {
2099
- const b = [N.first_name, N.last_name].filter(Boolean).join(" ") || N.email || N.user;
2099
+ const f = [N.first_name, N.last_name].filter(Boolean).join(" ") || N.email || N.user;
2100
2100
  return /* @__PURE__ */ n("div", { className: "flex items-center gap-2 rounded-lg px-1 py-1", children: [
2101
- /* @__PURE__ */ e(X, { id: N.user, name: b }),
2102
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: b }),
2103
- Y && /* @__PURE__ */ e(
2101
+ /* @__PURE__ */ e(te, { id: N.user, name: f }),
2102
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: f }),
2103
+ V && /* @__PURE__ */ e(
2104
2104
  "button",
2105
2105
  {
2106
2106
  type: "button",
2107
2107
  title: "Remove from channel",
2108
- onClick: () => f.mutate(N.user),
2108
+ onClick: () => b.mutate(N.user),
2109
2109
  className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-red-500 dark:hover:bg-muted",
2110
2110
  children: /* @__PURE__ */ e(lt, { className: "h-3 w-3" })
2111
2111
  }
2112
2112
  )
2113
2113
  ] }, N.user);
2114
2114
  }),
2115
- Y && T === "private" && /* @__PURE__ */ n("div", { className: "mt-2", children: [
2115
+ V && T === "private" && /* @__PURE__ */ n("div", { className: "mt-2", children: [
2116
2116
  /* @__PURE__ */ e(
2117
2117
  "input",
2118
2118
  {
2119
- value: F,
2120
- onChange: (N) => W(N.target.value),
2119
+ value: H,
2120
+ onChange: (N) => z(N.target.value),
2121
2121
  placeholder: "Add someone…",
2122
- className: m("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
2122
+ className: u("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", s.input)
2123
2123
  }
2124
2124
  ),
2125
- F.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-40 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: te.filter((N) => !me.has(String(N.id).toUpperCase())).map((N) => {
2126
- const b = [N.first_name, N.last_name].filter(Boolean).join(" ") || N.email || N.id;
2125
+ H.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-40 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: re.filter((N) => !pe.has(String(N.id).toUpperCase())).map((N) => {
2126
+ const f = [N.first_name, N.last_name].filter(Boolean).join(" ") || N.email || N.id;
2127
2127
  return /* @__PURE__ */ n(
2128
2128
  "button",
2129
2129
  {
2130
2130
  type: "button",
2131
2131
  onClick: () => {
2132
- u.mutate(N.id), W("");
2132
+ m.mutate(N.id), z("");
2133
2133
  },
2134
2134
  className: "flex w-full items-center gap-2 px-2 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-muted/50",
2135
2135
  children: [
2136
- /* @__PURE__ */ e(X, { id: N.id, name: b }),
2137
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: b })
2136
+ /* @__PURE__ */ e(te, { id: N.id, name: f }),
2137
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: f })
2138
2138
  ]
2139
2139
  },
2140
2140
  N.id
@@ -2142,42 +2142,42 @@ function br({
2142
2142
  }) }),
2143
2143
  /* @__PURE__ */ e("p", { className: "mt-1 text-[11px] leading-snug text-slate-400", children: "Only members can see an invite-only channel — it is not listed to anyone else." })
2144
2144
  ] }),
2145
- Y && !t.is_direct && /* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e(bs, { channelId: t.id, th: r }) })
2145
+ V && !t.is_direct && /* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e(gr, { channelId: t.id, th: s }) })
2146
2146
  ] }),
2147
- !t.is_direct && /* @__PURE__ */ e(fs, { channelId: t.id, th: r })
2147
+ !t.is_direct && /* @__PURE__ */ e(vr, { channelId: t.id, th: s })
2148
2148
  ] })
2149
2149
  ] });
2150
2150
  }
2151
- function It(t, s) {
2152
- const [o, r] = U(t);
2153
- return V(() => {
2154
- const l = setTimeout(() => r(t), s);
2151
+ function jt(t, r) {
2152
+ const [o, s] = D(t);
2153
+ return ee(() => {
2154
+ const l = setTimeout(() => s(t), r);
2155
2155
  return () => clearTimeout(l);
2156
- }, [t, s]), o;
2156
+ }, [t, r]), o;
2157
2157
  }
2158
- function tn(t) {
2159
- var s;
2160
- return t ? t.kind === "dm" || t.kind === "entity" || t.kind === "channel" && !!((s = t.channel) != null && s.is_direct) : !1;
2158
+ function rn(t) {
2159
+ var r;
2160
+ return t ? t.kind === "dm" || t.kind === "entity" || t.kind === "channel" && !!((r = t.channel) != null && r.is_direct) : !1;
2161
2161
  }
2162
2162
  const yt = [
2163
2163
  { value: "recent", label: "Recent activity" },
2164
2164
  { value: "unread", label: "Unread first" },
2165
2165
  { value: "alpha", label: "A–Z" }
2166
2166
  ];
2167
- function Ca(t) {
2168
- var s;
2169
- return (s = t.lastMessage) != null && s.date_created ? new Date(t.lastMessage.date_created).getTime() : 0;
2167
+ function Ta(t) {
2168
+ var r;
2169
+ return (r = t.lastMessage) != null && r.date_created ? new Date(t.lastMessage.date_created).getTime() : 0;
2170
2170
  }
2171
- function fr(t, s) {
2172
- const o = (i, c) => i.label.localeCompare(c.label), r = (i, c) => Ca(c) - Ca(i) || o(i, c), l = [...t];
2173
- return s === "alpha" ? l.sort(o) : s === "unread" ? l.sort((i, c) => +(c.unread > 0) - +(i.unread > 0) || r(i, c)) : l.sort(r);
2171
+ function vs(t, r) {
2172
+ const o = (i, c) => i.label.localeCompare(c.label), s = (i, c) => Ta(c) - Ta(i) || o(i, c), l = [...t];
2173
+ return r === "alpha" ? l.sort(o) : r === "unread" ? l.sort((i, c) => +(c.unread > 0) - +(i.unread > 0) || s(i, c)) : l.sort(s);
2174
2174
  }
2175
- function gr({
2175
+ function ys({
2176
2176
  value: t,
2177
- onChange: s
2177
+ onChange: r
2178
2178
  }) {
2179
- const [o, r] = U(!1), l = yt.find((i) => i.value === t) ?? yt[0];
2180
- return /* @__PURE__ */ n(Qe, { open: o, onOpenChange: r, children: [
2179
+ const [o, s] = D(!1), l = yt.find((i) => i.value === t) ?? yt[0];
2180
+ return /* @__PURE__ */ n(Qe, { open: o, onOpenChange: s, children: [
2181
2181
  /* @__PURE__ */ e(Ke, { asChild: !0, children: /* @__PURE__ */ e(
2182
2182
  "button",
2183
2183
  {
@@ -2186,7 +2186,7 @@ function gr({
2186
2186
  "aria-label": `Sort rooms: ${l.label}`,
2187
2187
  className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-slate-200 text-slate-500 hover:bg-slate-50 dark:border-border dark:text-slate-400 dark:hover:bg-muted",
2188
2188
  "data-chat-sort": t,
2189
- children: /* @__PURE__ */ e(En, { className: "h-3.5 w-3.5", strokeWidth: 2 })
2189
+ children: /* @__PURE__ */ e(Fn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
2190
2190
  }
2191
2191
  ) }),
2192
2192
  /* @__PURE__ */ n(Je, { align: "end", className: "w-44 p-1", children: [
@@ -2196,13 +2196,13 @@ function gr({
2196
2196
  {
2197
2197
  type: "button",
2198
2198
  onClick: () => {
2199
- s(i.value), r(!1);
2199
+ r(i.value), s(!1);
2200
2200
  },
2201
2201
  className: "flex w-full items-center justify-between rounded px-2 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-slate-200",
2202
2202
  "data-chat-sort-option": i.value,
2203
2203
  children: [
2204
2204
  i.label,
2205
- i.value === t && /* @__PURE__ */ e(rt, { className: "h-3.5 w-3.5", strokeWidth: 2 })
2205
+ i.value === t && /* @__PURE__ */ e(st, { className: "h-3.5 w-3.5", strokeWidth: 2 })
2206
2206
  ]
2207
2207
  },
2208
2208
  i.value
@@ -2210,15 +2210,15 @@ function gr({
2210
2210
  ] })
2211
2211
  ] });
2212
2212
  }
2213
- function _a({
2213
+ function Ua({
2214
2214
  rooms: t,
2215
- onOpen: s,
2215
+ onOpen: r,
2216
2216
  onNewGroup: o,
2217
- archivedView: r = !1,
2217
+ archivedView: s = !1,
2218
2218
  loading: l = !1,
2219
2219
  onView: i
2220
2220
  }) {
2221
- const c = se(), d = Te(), { setMuted: h, leave: x, setArchived: u, setStarred: f } = Mt(), v = gs(), D = he(
2221
+ const c = oe(), d = Ue(), { setMuted: h, leave: x, setArchived: m, setStarred: b } = Mt(), v = yr(), $ = xe(
2222
2222
  () => new Map(
2223
2223
  d.onlineUsers.map((_) => [
2224
2224
  String(_.user_id).toUpperCase(),
@@ -2226,14 +2226,14 @@ function _a({
2226
2226
  ])
2227
2227
  ),
2228
2228
  [d.onlineUsers]
2229
- ), S = Pt(), [C, T] = U(""), E = It(C.trim(), 250), { hits: k, loading: A } = _s(E, v.filters), P = E.length >= 2 || v.active, $ = he(() => {
2229
+ ), S = Pt(), [C, T] = D(""), F = jt(C.trim(), 250), { hits: k, loading: A } = Tr(F, v.filters), I = F.length >= 2 || v.active, R = xe(() => {
2230
2230
  const _ = /* @__PURE__ */ new Map();
2231
2231
  for (const N of k) _.set(N.room, [..._.get(N.room) ?? [], N]);
2232
- return [..._.entries()].sort((N, b) => b[1].length - N[1].length);
2233
- }, [k]), F = t.filter((_) => _.unread > 0 && !_.muted).length, W = he(() => new Map(t.map((_) => [_.room, _])), [t]), Q = Rt(), te = qa(), Z = Q.chat_sidebar_sort === "unread" || Q.chat_sidebar_sort === "alpha" ? Q.chat_sidebar_sort : "recent", Y = fr(
2234
- E ? t.filter((_) => _.label.toLowerCase().includes(E.toLowerCase())) : t,
2235
- Z
2236
- ), me = (_) => {
2232
+ return [..._.entries()].sort((N, f) => f[1].length - N[1].length);
2233
+ }, [k]), H = t.filter((_) => _.unread > 0 && !_.muted).length, z = xe(() => new Map(t.map((_) => [_.room, _])), [t]), J = At(), re = Ba(), X = J.chat_sidebar_sort === "unread" || J.chat_sidebar_sort === "alpha" ? J.chat_sidebar_sort : "recent", V = vs(
2234
+ F ? t.filter((_) => _.label.toLowerCase().includes(F.toLowerCase())) : t,
2235
+ X
2236
+ ), pe = (_) => {
2237
2237
  var N;
2238
2238
  return _.kind === "channel" && ((N = _.channel) == null ? void 0 : N.is_direct);
2239
2239
  };
@@ -2245,7 +2245,7 @@ function _a({
2245
2245
  value: C,
2246
2246
  onChange: (_) => T(_.target.value),
2247
2247
  placeholder: "Search rooms & messages…",
2248
- className: m(
2248
+ className: u(
2249
2249
  "h-7 min-w-0 flex-1 rounded-md border px-2 text-[12px] outline-none",
2250
2250
  c.input
2251
2251
  ),
@@ -2253,15 +2253,15 @@ function _a({
2253
2253
  "data-chat-global-search": !0
2254
2254
  }
2255
2255
  ),
2256
- !r && /* @__PURE__ */ e(vs, { open: v.open, active: v.active, onClick: () => v.setOpen(!v.open) }),
2256
+ !s && /* @__PURE__ */ e(kr, { open: v.open, active: v.active, onClick: () => v.setOpen(!v.open) }),
2257
2257
  /* @__PURE__ */ e(
2258
- gr,
2258
+ ys,
2259
2259
  {
2260
- value: Z,
2261
- onChange: (_) => te.mutate({ chat_sidebar_sort: _ === "recent" ? null : _ })
2260
+ value: X,
2261
+ onChange: (_) => re.mutate({ chat_sidebar_sort: _ === "recent" ? null : _ })
2262
2262
  }
2263
2263
  ),
2264
- !r && /* @__PURE__ */ e(ys, {}),
2264
+ !s && /* @__PURE__ */ e(wr, {}),
2265
2265
  o && /* @__PURE__ */ e(
2266
2266
  "button",
2267
2267
  {
@@ -2274,8 +2274,8 @@ function _a({
2274
2274
  }
2275
2275
  )
2276
2276
  ] }),
2277
- !r && v.open && /* @__PURE__ */ e(ks, { filters: v.filters, onChange: v.setFilters, rooms: t, th: c }),
2278
- !r && i && !P && /* @__PURE__ */ n("div", { className: "mb-1 flex flex-wrap gap-1 px-1", "data-chat-view-links": !0, children: [
2277
+ !s && v.open && /* @__PURE__ */ e(Nr, { filters: v.filters, onChange: v.setFilters, rooms: t, th: c }),
2278
+ !s && i && !I && /* @__PURE__ */ n("div", { className: "mb-1 flex flex-wrap gap-1 px-1", "data-chat-view-links": !0, children: [
2279
2279
  /* @__PURE__ */ n(
2280
2280
  "button",
2281
2281
  {
@@ -2284,7 +2284,7 @@ function _a({
2284
2284
  className: "inline-flex h-6 items-center gap-1 rounded-full border border-slate-200 px-2 text-[11px] text-slate-600 hover:bg-muted dark:border-border dark:text-slate-300",
2285
2285
  "data-chat-view": "mentions",
2286
2286
  children: [
2287
- /* @__PURE__ */ e(Mn, { className: "h-3 w-3" }),
2287
+ /* @__PURE__ */ e(Ln, { className: "h-3 w-3" }),
2288
2288
  " Mentions"
2289
2289
  ]
2290
2290
  }
@@ -2297,86 +2297,86 @@ function _a({
2297
2297
  className: "inline-flex h-6 items-center gap-1 rounded-full border border-slate-200 px-2 text-[11px] text-slate-600 hover:bg-muted dark:border-border dark:text-slate-300",
2298
2298
  "data-chat-view": "scheduled",
2299
2299
  children: [
2300
- /* @__PURE__ */ e(On, { className: "h-3 w-3" }),
2300
+ /* @__PURE__ */ e(Pn, { className: "h-3 w-3" }),
2301
2301
  " Scheduled"
2302
2302
  ]
2303
2303
  }
2304
2304
  ),
2305
- F > 1 && /* @__PURE__ */ n(
2305
+ H > 1 && /* @__PURE__ */ n(
2306
2306
  "button",
2307
2307
  {
2308
2308
  type: "button",
2309
2309
  onClick: () => i("catchup"),
2310
- className: m(
2310
+ className: u(
2311
2311
  "inline-flex h-6 items-center gap-1 rounded-full px-2 text-[11px] font-medium",
2312
2312
  c.accentSoft
2313
2313
  ),
2314
2314
  "data-chat-view": "catchup",
2315
2315
  children: [
2316
- /* @__PURE__ */ e(Ln, { className: "h-3 w-3" }),
2316
+ /* @__PURE__ */ e(In, { className: "h-3 w-3" }),
2317
2317
  " Catch up · ",
2318
- F,
2318
+ H,
2319
2319
  " rooms"
2320
2320
  ]
2321
2321
  }
2322
2322
  )
2323
2323
  ] }),
2324
- P && !r && /* @__PURE__ */ n("div", { className: "mb-1.5", "data-chat-search-results": !0, children: [
2324
+ I && !s && /* @__PURE__ */ n("div", { className: "mb-1.5", "data-chat-search-results": !0, children: [
2325
2325
  /* @__PURE__ */ n("p", { className: "px-2.5 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
2326
2326
  "Messages",
2327
2327
  k.length ? ` · ${k.length}` : ""
2328
2328
  ] }),
2329
- A ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "Searching…" }) : k.length === 0 ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "No messages match." }) : $.map(([_, N]) => {
2330
- const b = W.get(_);
2329
+ A ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "Searching…" }) : k.length === 0 ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "No messages match." }) : R.map(([_, N]) => {
2330
+ const f = z.get(_);
2331
2331
  return /* @__PURE__ */ n("div", { className: "mb-1", "data-chat-search-group": _, children: [
2332
2332
  /* @__PURE__ */ n("p", { className: "flex items-center gap-1.5 px-2.5 pb-0.5 pt-1 text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: [
2333
- /* @__PURE__ */ e("span", { className: "truncate", children: (b == null ? void 0 : b.label) ?? _ }),
2333
+ /* @__PURE__ */ e("span", { className: "truncate", children: (f == null ? void 0 : f.label) ?? _ }),
2334
2334
  /* @__PURE__ */ e("span", { className: "rounded-full bg-slate-100 px-1.5 text-[10px] font-medium tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: N.length })
2335
2335
  ] }),
2336
- N.slice(0, 5).map((I) => /* @__PURE__ */ n(
2336
+ N.slice(0, 5).map((j) => /* @__PURE__ */ n(
2337
2337
  "button",
2338
2338
  {
2339
2339
  type: "button",
2340
- disabled: !b,
2340
+ disabled: !f,
2341
2341
  onClick: () => {
2342
- b && s(b, { around: I.parent_id ?? I.id });
2342
+ f && r(f, { around: j.parent_id ?? j.id });
2343
2343
  },
2344
2344
  className: "flex w-full flex-col gap-0.5 rounded-lg px-2.5 py-1.5 text-left transition-colors hover:bg-slate-50 disabled:cursor-default dark:hover:bg-muted/50",
2345
- "data-chat-search-hit": I.id,
2345
+ "data-chat-search-hit": j.id,
2346
2346
  children: [
2347
2347
  /* @__PURE__ */ n("span", { className: "flex items-center gap-1.5 text-[10.5px] text-slate-400", children: [
2348
- /* @__PURE__ */ e("span", { className: "truncate", children: I.sender_name ?? "Someone" }),
2349
- /* @__PURE__ */ e("span", { className: "ml-auto shrink-0", children: new Date(I.date_created).toLocaleDateString() })
2348
+ /* @__PURE__ */ e("span", { className: "truncate", children: j.sender_name ?? "Someone" }),
2349
+ /* @__PURE__ */ e("span", { className: "ml-auto shrink-0", children: new Date(j.date_created).toLocaleDateString() })
2350
2350
  ] }),
2351
- /* @__PURE__ */ e("span", { className: "line-clamp-2 text-[12px] text-slate-700 dark:text-slate-200", children: I.message })
2351
+ /* @__PURE__ */ e("span", { className: "line-clamp-2 text-[12px] text-slate-700 dark:text-slate-200", children: j.message })
2352
2352
  ]
2353
2353
  },
2354
- I.id
2354
+ j.id
2355
2355
  )),
2356
- N.length > 5 && b && /* @__PURE__ */ n(
2356
+ N.length > 5 && f && /* @__PURE__ */ n(
2357
2357
  "button",
2358
2358
  {
2359
2359
  type: "button",
2360
2360
  onClick: () => v.setFilters({ ...v.filters, room: _ }),
2361
- className: m("px-2.5 py-0.5 text-[11px] font-medium", c.accentText),
2361
+ className: u("px-2.5 py-0.5 text-[11px] font-medium", c.accentText),
2362
2362
  children: [
2363
2363
  "All ",
2364
2364
  N.length,
2365
2365
  " in ",
2366
- b.label
2366
+ f.label
2367
2367
  ]
2368
2368
  }
2369
2369
  )
2370
2370
  ] }, _);
2371
2371
  })
2372
2372
  ] }),
2373
- r && !l && t.length === 0 && /* @__PURE__ */ e("p", { className: "px-3 py-6 text-center text-[12px] leading-relaxed text-slate-400", children: "Nothing archived. Archiving is just for you: the conversation leaves your chat list and stops alerting you, while everyone else in it carries on as before. Archive from a room's header or its row in your chat list; writing in it again brings it back." }),
2374
- r && l && /* @__PURE__ */ e("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: "Loading…" }),
2375
- !r && S.bot_name && S.bot_user_id && d.me && /* @__PURE__ */ n(
2373
+ s && !l && t.length === 0 && /* @__PURE__ */ e("p", { className: "px-3 py-6 text-center text-[12px] leading-relaxed text-slate-400", children: "Nothing archived. Archiving is just for you: the conversation leaves your chat list and stops alerting you, while everyone else in it carries on as before. Archive from a room's header or its row in your chat list; writing in it again brings it back." }),
2374
+ s && l && /* @__PURE__ */ e("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: "Loading…" }),
2375
+ !s && S.bot_name && S.bot_user_id && d.me && /* @__PURE__ */ n(
2376
2376
  "button",
2377
2377
  {
2378
2378
  type: "button",
2379
- onClick: () => s({
2379
+ onClick: () => r({
2380
2380
  room: St(d.me.id, S.bot_user_id),
2381
2381
  label: `@${S.bot_name}`,
2382
2382
  kind: "dm",
@@ -2393,7 +2393,7 @@ function _a({
2393
2393
  /* @__PURE__ */ e(
2394
2394
  "span",
2395
2395
  {
2396
- className: m(
2396
+ className: u(
2397
2397
  "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-[13px] font-bold",
2398
2398
  c.accentSoft
2399
2399
  ),
@@ -2411,177 +2411,177 @@ function _a({
2411
2411
  }
2412
2412
  ),
2413
2413
  [
2414
- ["Starred", Y.filter((_) => _.starred)],
2414
+ ["Starred", V.filter((_) => _.starred)],
2415
2415
  [
2416
2416
  "Channels",
2417
- Y.filter(
2418
- (_) => !_.starred && (_.kind === "global" || _.kind === "channel") && !me(_)
2417
+ V.filter(
2418
+ (_) => !_.starred && (_.kind === "global" || _.kind === "channel") && !pe(_)
2419
2419
  )
2420
2420
  ],
2421
2421
  [
2422
2422
  "Direct messages",
2423
- Y.filter((_) => !_.starred && (_.kind === "dm" || me(_)))
2423
+ V.filter((_) => !_.starred && (_.kind === "dm" || pe(_)))
2424
2424
  ],
2425
- ["Records", Y.filter((_) => !_.starred && _.kind === "entity")]
2425
+ ["Records", V.filter((_) => !_.starred && _.kind === "entity")]
2426
2426
  ].map(
2427
2427
  ([_, N]) => N.length === 0 ? null : /* @__PURE__ */ n("div", { className: "mb-1.5", children: [
2428
2428
  /* @__PURE__ */ e("p", { className: "px-2.5 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: _ }),
2429
- N.map((b) => {
2430
- var I, q, fe, ge, Ue, we;
2429
+ N.map((f) => {
2430
+ var j, W, ye, ke, De, de;
2431
2431
  return /* @__PURE__ */ n("div", { className: "group/room relative", children: [
2432
2432
  /* @__PURE__ */ n(
2433
2433
  "button",
2434
2434
  {
2435
2435
  type: "button",
2436
- onClick: () => s(b),
2436
+ onClick: () => r(f),
2437
2437
  className: "flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-slate-50 dark:hover:bg-muted/50",
2438
2438
  children: [
2439
2439
  (() => {
2440
- const pe = b.kind === "dm" && d.me ? ye(b.room, d.me.id) : null;
2441
- if (!pe) return null;
2442
- const Ne = D.get(pe.toUpperCase()) ?? "offline";
2443
- return /* @__PURE__ */ e("span", { className: "relative shrink-0", "data-chat-room-avatar": Ne, children: /* @__PURE__ */ e(X, { id: pe, name: b.label, size: 32 }) });
2440
+ const fe = f.kind === "dm" && d.me ? Ne(f.room, d.me.id) : null;
2441
+ if (!fe) return null;
2442
+ const Ce = $.get(fe.toUpperCase()) ?? "offline";
2443
+ return /* @__PURE__ */ e("span", { className: "relative shrink-0", "data-chat-room-avatar": Ce, children: /* @__PURE__ */ e(te, { id: fe, name: f.label, size: 32 }) });
2444
2444
  })(),
2445
- b.kind === "channel" && !((I = b.channel) != null && I.is_direct) || b.kind === "global" && ((q = b.channel) != null && q.icon || (fe = b.channel) != null && fe.color) ? /* @__PURE__ */ e(He, { icon: (ge = b.channel) == null ? void 0 : ge.icon, color: (Ue = b.channel) == null ? void 0 : Ue.color, size: 32 }) : /* @__PURE__ */ e(
2445
+ f.kind === "channel" && !((j = f.channel) != null && j.is_direct) || f.kind === "global" && ((W = f.channel) != null && W.icon || (ye = f.channel) != null && ye.color) ? /* @__PURE__ */ e(He, { icon: (ke = f.channel) == null ? void 0 : ke.icon, color: (De = f.channel) == null ? void 0 : De.color, size: 32 }) : /* @__PURE__ */ e(
2446
2446
  "span",
2447
2447
  {
2448
- className: m(
2448
+ className: u(
2449
2449
  "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-400",
2450
- b.kind === "dm" && d.me && ye(b.room, d.me.id) && "hidden"
2450
+ f.kind === "dm" && d.me && Ne(f.room, d.me.id) && "hidden"
2451
2451
  ),
2452
- children: b.kind === "dm" ? /* @__PURE__ */ e(Ta, { className: "h-4 w-4", strokeWidth: 1.8 }) : (we = b.channel) != null && we.is_direct ? /* @__PURE__ */ e(Ct, { className: "h-4 w-4", strokeWidth: 1.8 }) : /* @__PURE__ */ e(wt, { className: "h-4 w-4", strokeWidth: 1.8 })
2452
+ children: f.kind === "dm" ? /* @__PURE__ */ e($a, { className: "h-4 w-4", strokeWidth: 1.8 }) : (de = f.channel) != null && de.is_direct ? /* @__PURE__ */ e(Ct, { className: "h-4 w-4", strokeWidth: 1.8 }) : /* @__PURE__ */ e(wt, { className: "h-4 w-4", strokeWidth: 1.8 })
2453
2453
  }
2454
2454
  ),
2455
2455
  /* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: [
2456
2456
  /* @__PURE__ */ n("span", { className: "flex items-center gap-1.5", children: [
2457
- /* @__PURE__ */ e("span", { className: "truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: b.label }),
2458
- b.muted && /* @__PURE__ */ e(_t, { className: "h-3 w-3 shrink-0 text-slate-300", strokeWidth: 2 })
2457
+ /* @__PURE__ */ e("span", { className: "truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: f.label }),
2458
+ f.muted && /* @__PURE__ */ e(_t, { className: "h-3 w-3 shrink-0 text-slate-300", strokeWidth: 2 })
2459
2459
  ] }),
2460
- b.lastMessage && /* @__PURE__ */ n("span", { className: "block truncate text-[11px] text-slate-400", children: [
2461
- b.lastMessage.sender_name ? `${b.lastMessage.sender_name}: ` : "",
2462
- b.lastMessage.message
2460
+ f.lastMessage && /* @__PURE__ */ n("span", { className: "block truncate text-[11px] text-slate-400", children: [
2461
+ f.lastMessage.sender_name ? `${f.lastMessage.sender_name}: ` : "",
2462
+ f.lastMessage.message
2463
2463
  ] })
2464
2464
  ] }),
2465
- (b.mentions ?? 0) > 0 && /* @__PURE__ */ e(
2465
+ (f.mentions ?? 0) > 0 && /* @__PURE__ */ e(
2466
2466
  "span",
2467
2467
  {
2468
2468
  className: "flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-bold text-white",
2469
- title: `${b.mentions} mention you`,
2470
- "data-chat-room-mentions": b.mentions,
2469
+ title: `${f.mentions} mention you`,
2470
+ "data-chat-room-mentions": f.mentions,
2471
2471
  children: "@"
2472
2472
  }
2473
2473
  ),
2474
- b.unread > 0 && /* @__PURE__ */ e(
2474
+ f.unread > 0 && /* @__PURE__ */ e(
2475
2475
  "span",
2476
2476
  {
2477
- className: m(
2477
+ className: u(
2478
2478
  "flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-1.5 text-[10px] font-bold",
2479
2479
  // A muted room still counts, but quietly — it must not
2480
2480
  // read like something demanding attention.
2481
- b.muted ? "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500" : c.pill
2481
+ f.muted ? "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500" : c.pill
2482
2482
  ),
2483
- children: b.unread > 99 ? "99+" : b.unread
2483
+ children: f.unread > 99 ? "99+" : f.unread
2484
2484
  }
2485
2485
  )
2486
2486
  ]
2487
2487
  }
2488
2488
  ),
2489
2489
  /* @__PURE__ */ n("span", { className: "absolute right-1.5 top-1.5 hidden items-center gap-0.5 group-hover/room:flex", children: [
2490
- !r && /* @__PURE__ */ e(
2490
+ !s && /* @__PURE__ */ e(
2491
2491
  "button",
2492
2492
  {
2493
2493
  type: "button",
2494
- title: b.starred ? "Unstar" : "Star — keep it at the top",
2495
- "aria-label": b.starred ? `Unstar ${b.label}` : `Star ${b.label}`,
2496
- onClick: () => f.mutate({ room: b.room, starred: !b.starred }),
2494
+ title: f.starred ? "Unstar" : "Star — keep it at the top",
2495
+ "aria-label": f.starred ? `Unstar ${f.label}` : `Star ${f.label}`,
2496
+ onClick: () => b.mutate({ room: f.room, starred: !f.starred }),
2497
2497
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100",
2498
- "data-chat-row-star": b.starred ? "on" : "off",
2498
+ "data-chat-row-star": f.starred ? "on" : "off",
2499
2499
  children: /* @__PURE__ */ e(
2500
- Ua,
2500
+ Ra,
2501
2501
  {
2502
- className: m("h-3 w-3", b.starred && "fill-amber-400 text-amber-500")
2502
+ className: u("h-3 w-3", f.starred && "fill-amber-400 text-amber-500")
2503
2503
  }
2504
2504
  )
2505
2505
  }
2506
2506
  ),
2507
- tn(b) && /* @__PURE__ */ e(
2507
+ rn(f) && /* @__PURE__ */ e(
2508
2508
  "button",
2509
2509
  {
2510
2510
  type: "button",
2511
- title: r ? "Unarchive — back to your chats" : "Archive for me — hides it from my list and stops my alerts. Others in the conversation are not affected.",
2512
- "aria-label": r ? `Unarchive ${b.label}` : `Archive ${b.label} for me`,
2513
- onClick: () => u.mutate({ room: b.room, archived: !r }),
2511
+ title: s ? "Unarchive — back to your chats" : "Archive for me — hides it from my list and stops my alerts. Others in the conversation are not affected.",
2512
+ "aria-label": s ? `Unarchive ${f.label}` : `Archive ${f.label} for me`,
2513
+ onClick: () => m.mutate({ room: f.room, archived: !s }),
2514
2514
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100",
2515
- "data-chat-row-archive": r ? "unarchive" : "archive",
2516
- children: r ? /* @__PURE__ */ e(Da, { className: "h-3 w-3" }) : /* @__PURE__ */ e($a, { className: "h-3 w-3" })
2515
+ "data-chat-row-archive": s ? "unarchive" : "archive",
2516
+ children: s ? /* @__PURE__ */ e(Aa, { className: "h-3 w-3" }) : /* @__PURE__ */ e(Ma, { className: "h-3 w-3" })
2517
2517
  }
2518
2518
  ),
2519
2519
  /* @__PURE__ */ e(
2520
2520
  "button",
2521
2521
  {
2522
2522
  type: "button",
2523
- title: b.muted ? "Unmute" : "Mute",
2524
- onClick: () => h.mutate({ room: b.room, muted: !b.muted }),
2523
+ title: f.muted ? "Unmute" : "Mute",
2524
+ onClick: () => h.mutate({ room: f.room, muted: !f.muted }),
2525
2525
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100",
2526
- children: b.muted ? /* @__PURE__ */ e(Aa, { className: "h-3 w-3" }) : /* @__PURE__ */ e(_t, { className: "h-3 w-3" })
2526
+ children: f.muted ? /* @__PURE__ */ e(Oa, { className: "h-3 w-3" }) : /* @__PURE__ */ e(_t, { className: "h-3 w-3" })
2527
2527
  }
2528
2528
  ),
2529
- (b.kind === "channel" || b.kind === "global" || b.kind === "entity") && b.joined && /* @__PURE__ */ e(
2529
+ (f.kind === "channel" || f.kind === "global" || f.kind === "entity") && f.joined && /* @__PURE__ */ e(
2530
2530
  "button",
2531
2531
  {
2532
2532
  type: "button",
2533
- title: b.kind === "global" ? "Leave General" : b.kind === "entity" ? "Leave this record's chat — open it from the record again to rejoin" : "Leave channel",
2534
- "aria-label": `Leave ${b.label}`,
2533
+ title: f.kind === "global" ? "Leave General" : f.kind === "entity" ? "Leave this record's chat — open it from the record again to rejoin" : "Leave channel",
2534
+ "aria-label": `Leave ${f.label}`,
2535
2535
  "data-chat-row-leave": !0,
2536
- onClick: () => x.mutate(b.room),
2536
+ onClick: () => x.mutate(f.room),
2537
2537
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100",
2538
- children: /* @__PURE__ */ e(Ra, { className: "h-3 w-3" })
2538
+ children: /* @__PURE__ */ e(La, { className: "h-3 w-3" })
2539
2539
  }
2540
2540
  )
2541
2541
  ] })
2542
- ] }, b.room);
2542
+ ] }, f.room);
2543
2543
  })
2544
2544
  ] }, _)
2545
2545
  )
2546
2546
  ] });
2547
2547
  }
2548
- function al({
2548
+ function rl({
2549
2549
  view: t,
2550
- rooms: s,
2550
+ rooms: r,
2551
2551
  onBack: o,
2552
- onOpen: r
2552
+ onOpen: s
2553
2553
  }) {
2554
- const l = se();
2555
- return t === "mentions" ? /* @__PURE__ */ e(Pa, { th: l, onBack: o, onOpen: r }) : t === "scheduled" ? /* @__PURE__ */ e(
2556
- ja,
2554
+ const l = oe();
2555
+ return t === "mentions" ? /* @__PURE__ */ e(qa, { th: l, onBack: o, onOpen: s }) : t === "scheduled" ? /* @__PURE__ */ e(
2556
+ Ea,
2557
2557
  {
2558
2558
  th: l,
2559
2559
  onBack: o,
2560
2560
  roomLabel: (i) => {
2561
2561
  var c;
2562
- return ((c = s.find((d) => d.room === i)) == null ? void 0 : c.label) ?? i;
2562
+ return ((c = r.find((d) => d.room === i)) == null ? void 0 : c.label) ?? i;
2563
2563
  }
2564
2564
  }
2565
- ) : /* @__PURE__ */ e(Ia, { rooms: s, th: l, onBack: o, onOpen: r });
2565
+ ) : /* @__PURE__ */ e(Wa, { rooms: r, th: l, onBack: o, onOpen: s });
2566
2566
  }
2567
- function vr({
2567
+ function ks({
2568
2568
  onOpen: t
2569
2569
  }) {
2570
- const s = se(), [o, r] = U(""), [l, i] = U(!1), [c, d] = U(""), [h, x] = U("open"), [u, f] = U(""), [v, D] = U({
2570
+ const r = oe(), [o, s] = D(""), [l, i] = D(!1), [c, d] = D(""), [h, x] = D("open"), [m, b] = D(""), [v, $] = D({
2571
2571
  icon: null,
2572
2572
  color: null
2573
- }), S = Ea(), { channels: C, loading: T } = Ns(o), { join: E } = Mt(), k = Cs();
2573
+ }), S = Fa(), { channels: C, loading: T } = _r(o), { join: F } = Mt(), k = Sr();
2574
2574
  return /* @__PURE__ */ n("div", { className: "flex min-h-0 flex-1 flex-col", "data-chat-directory": !0, children: [
2575
2575
  /* @__PURE__ */ n("div", { className: "flex items-center gap-2 p-2", children: [
2576
2576
  /* @__PURE__ */ n("div", { className: "relative flex-1", children: [
2577
- /* @__PURE__ */ e(Sa, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
2577
+ /* @__PURE__ */ e(Da, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
2578
2578
  /* @__PURE__ */ e(
2579
2579
  "input",
2580
2580
  {
2581
2581
  value: o,
2582
- onChange: (A) => r(A.target.value),
2582
+ onChange: (A) => s(A.target.value),
2583
2583
  placeholder: "Search channels…",
2584
- className: m("h-8 w-full rounded-md pl-8 pr-2 text-[12.5px] outline-none", s.input)
2584
+ className: u("h-8 w-full rounded-md pl-8 pr-2 text-[12.5px] outline-none", r.input)
2585
2585
  }
2586
2586
  )
2587
2587
  ] }),
@@ -2590,12 +2590,12 @@ function vr({
2590
2590
  {
2591
2591
  type: "button",
2592
2592
  onClick: () => i((A) => !A),
2593
- className: m(
2593
+ className: u(
2594
2594
  "flex h-8 shrink-0 items-center gap-1 rounded-md px-2.5 text-[12px] font-medium",
2595
- s.action
2595
+ r.action
2596
2596
  ),
2597
2597
  children: [
2598
- /* @__PURE__ */ e(Un, { className: "h-3.5 w-3.5" }),
2598
+ /* @__PURE__ */ e(Rn, { className: "h-3.5 w-3.5" }),
2599
2599
  " New"
2600
2600
  ]
2601
2601
  }
@@ -2606,17 +2606,17 @@ function vr({
2606
2606
  {
2607
2607
  className: "flex flex-col gap-2 border-b border-slate-100 p-2 dark:border-border/60",
2608
2608
  onSubmit: (A) => {
2609
- A.preventDefault(), c.trim() && (h === "role" && !u || k.mutate(
2609
+ A.preventDefault(), c.trim() && (h === "role" && !m || k.mutate(
2610
2610
  {
2611
2611
  name: c.trim(),
2612
2612
  visibility: h,
2613
- role: h === "role" ? u : null,
2613
+ role: h === "role" ? m : null,
2614
2614
  icon: v.icon,
2615
2615
  color: v.color
2616
2616
  },
2617
2617
  {
2618
2618
  onSuccess: () => {
2619
- d(""), D({ icon: null, color: null }), i(!1);
2619
+ d(""), $({ icon: null, color: null }), i(!1);
2620
2620
  }
2621
2621
  }
2622
2622
  ));
@@ -2630,29 +2630,29 @@ function vr({
2630
2630
  value: c,
2631
2631
  onChange: (A) => d(A.target.value),
2632
2632
  placeholder: "Channel name",
2633
- className: m(
2633
+ className: u(
2634
2634
  "h-8 min-w-0 flex-1 rounded-md px-2 text-[12.5px] outline-none",
2635
- s.input
2635
+ r.input
2636
2636
  )
2637
2637
  }
2638
2638
  )
2639
2639
  ] }),
2640
- /* @__PURE__ */ e(La, { icon: v.icon, color: v.color, onChange: D }),
2640
+ /* @__PURE__ */ e(ja, { icon: v.icon, color: v.color, onChange: $ }),
2641
2641
  /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
2642
2642
  [
2643
2643
  ["open", "Anyone"],
2644
2644
  ["role", "One role"],
2645
2645
  ["private", "Invite only"]
2646
- ].map(([A, P]) => /* @__PURE__ */ e(
2646
+ ].map(([A, I]) => /* @__PURE__ */ e(
2647
2647
  "button",
2648
2648
  {
2649
2649
  type: "button",
2650
2650
  onClick: () => x(A),
2651
- className: m(
2651
+ className: u(
2652
2652
  "rounded-md px-2 py-1 text-[11.5px] font-medium transition-colors",
2653
- h === A ? s.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
2653
+ h === A ? r.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
2654
2654
  ),
2655
- children: P
2655
+ children: I
2656
2656
  },
2657
2657
  A
2658
2658
  )),
@@ -2660,18 +2660,18 @@ function vr({
2660
2660
  "button",
2661
2661
  {
2662
2662
  type: "submit",
2663
- disabled: !c.trim() || k.isPending || h === "role" && !u,
2664
- className: m("ml-auto rounded-md px-2.5 py-1 text-[12px] font-medium", s.action),
2663
+ disabled: !c.trim() || k.isPending || h === "role" && !m,
2664
+ className: u("ml-auto rounded-md px-2.5 py-1 text-[12px] font-medium", r.action),
2665
2665
  children: k.isPending ? "Creating…" : "Create"
2666
2666
  }
2667
2667
  )
2668
2668
  ] }),
2669
2669
  h === "role" && /* @__PURE__ */ e(
2670
- At,
2670
+ Rt,
2671
2671
  {
2672
- value: u,
2673
- onChange: f,
2674
- className: m("h-8 w-auto rounded-md px-2 text-[12.5px] outline-none", s.input),
2672
+ value: m,
2673
+ onChange: b,
2674
+ className: u("h-8 w-auto rounded-md px-2 text-[12.5px] outline-none", r.input),
2675
2675
  options: [
2676
2676
  { value: "", label: "Choose a role…" },
2677
2677
  ...S.map((A) => ({ value: A.id, label: A.name }))
@@ -2700,7 +2700,7 @@ function vr({
2700
2700
  icon: A.icon,
2701
2701
  color: A.color,
2702
2702
  size: 32,
2703
- fallback: A.visibility === "private" ? Dn : wt
2703
+ fallback: A.visibility === "private" ? An : wt
2704
2704
  }
2705
2705
  ),
2706
2706
  /* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: [
@@ -2711,7 +2711,7 @@ function vr({
2711
2711
  "button",
2712
2712
  {
2713
2713
  type: "button",
2714
- onClick: () => t(A.room, A.name, wa(A)),
2714
+ onClick: () => t(A.room, A.name, _a(A)),
2715
2715
  className: "shrink-0 rounded-md px-2 py-1 text-[11.5px] font-medium text-slate-500 hover:bg-slate-100 dark:hover:bg-muted",
2716
2716
  children: "Open"
2717
2717
  }
@@ -2719,10 +2719,10 @@ function vr({
2719
2719
  "button",
2720
2720
  {
2721
2721
  type: "button",
2722
- onClick: () => E.mutate(A.room, {
2723
- onSuccess: () => t(A.room, A.name, wa(A))
2722
+ onClick: () => F.mutate(A.room, {
2723
+ onSuccess: () => t(A.room, A.name, _a(A))
2724
2724
  }),
2725
- className: m("shrink-0 rounded-md px-2 py-1 text-[11.5px] font-medium", s.action),
2725
+ className: u("shrink-0 rounded-md px-2 py-1 text-[11.5px] font-medium", r.action),
2726
2726
  children: "Join"
2727
2727
  }
2728
2728
  )
@@ -2733,15 +2733,15 @@ function vr({
2733
2733
  ] })
2734
2734
  ] });
2735
2735
  }
2736
- function yr() {
2736
+ function ws() {
2737
2737
  const t = /* @__PURE__ */ new Date();
2738
2738
  return t.setHours(23, 59, 59, 999), t;
2739
2739
  }
2740
- function kr() {
2741
- const t = Rt(), s = qa(), [o, r] = U(!1), l = t.presence_override, i = !!l && l.mode === "away" && !(l.until && new Date(l.until).getTime() < Date.now()), c = (h) => {
2742
- s.mutate({
2740
+ function Ns() {
2741
+ const t = At(), r = Ba(), [o, s] = D(!1), l = t.presence_override, i = !!l && l.mode === "away" && !(l.until && new Date(l.until).getTime() < Date.now()), c = (h) => {
2742
+ r.mutate({
2743
2743
  presence_override: h === "off" ? null : { mode: "away", until: (h == null ? void 0 : h.toISOString()) ?? null }
2744
- }), r(!1);
2744
+ }), s(!1);
2745
2745
  }, d = i && (l != null && l.until) ? `until ${new Date(l.until).toLocaleString("en-US", {
2746
2746
  weekday: "short",
2747
2747
  hour: "numeric",
@@ -2757,7 +2757,7 @@ function kr() {
2757
2757
  /* @__PURE__ */ e(
2758
2758
  "span",
2759
2759
  {
2760
- className: m(
2760
+ className: u(
2761
2761
  "h-2.5 w-2.5 shrink-0 rounded-full border-2",
2762
2762
  i ? "border-amber-400 bg-white dark:bg-card" : "border-emerald-400 bg-emerald-400"
2763
2763
  ),
@@ -2774,7 +2774,7 @@ function kr() {
2774
2774
  "data-chat-appear-away-off": !0,
2775
2775
  children: "Back online"
2776
2776
  }
2777
- ) : /* @__PURE__ */ n(Qe, { open: o, onOpenChange: r, children: [
2777
+ ) : /* @__PURE__ */ n(Qe, { open: o, onOpenChange: s, children: [
2778
2778
  /* @__PURE__ */ e(Ke, { asChild: !0, children: /* @__PURE__ */ e(
2779
2779
  "button",
2780
2780
  {
@@ -2789,7 +2789,7 @@ function kr() {
2789
2789
  [
2790
2790
  ["1 hour", () => new Date(Date.now() + 36e5)],
2791
2791
  ["4 hours", () => new Date(Date.now() + 4 * 36e5)],
2792
- ["The rest of today", yr],
2792
+ ["The rest of today", ws],
2793
2793
  ["Until I switch it off", () => null]
2794
2794
  ].map(([h, x]) => /* @__PURE__ */ e(
2795
2795
  "button",
@@ -2808,51 +2808,51 @@ function kr() {
2808
2808
  }
2809
2809
  );
2810
2810
  }
2811
- function wr({ myStatus: t }) {
2812
- const s = se();
2811
+ function Cs({ myStatus: t }) {
2812
+ const r = oe();
2813
2813
  return /* @__PURE__ */ e(
2814
- cs,
2814
+ ur,
2815
2815
  {
2816
2816
  status: t ? { text: t.text, emoji: t.emoji } : null,
2817
- theme: { accentSoft: s.accentSoft, input: s.input, action: s.action },
2817
+ theme: { accentSoft: r.accentSoft, input: r.input, action: r.action },
2818
2818
  className: "mb-1.5 px-1"
2819
2819
  }
2820
2820
  );
2821
2821
  }
2822
- function an() {
2822
+ function sn() {
2823
2823
  var l, i, c;
2824
- const t = Ge(), { data: s, isFetched: o } = be({
2824
+ const t = Ge(), { data: r, isFetched: o } = ge({
2825
2825
  queryKey: ["presence-online"],
2826
- queryFn: () => t.request(ue("/presence/online")),
2826
+ queryFn: () => t.request(he("/presence/online")),
2827
2827
  // Matches the presence heartbeat cadence — the page someone is on should
2828
2828
  // track them around the app, not lag a minute behind.
2829
2829
  refetchInterval: 15e3,
2830
2830
  staleTime: 5e3
2831
2831
  });
2832
2832
  return {
2833
- byUser: he(() => {
2833
+ byUser: xe(() => {
2834
2834
  const d = /* @__PURE__ */ new Map();
2835
- for (const h of (s == null ? void 0 : s.data) ?? []) d.set(String(h.user_id).toUpperCase(), h);
2835
+ for (const h of (r == null ? void 0 : r.data) ?? []) d.set(String(h.user_id).toUpperCase(), h);
2836
2836
  return d;
2837
- }, [s]),
2838
- fields: ((l = s == null ? void 0 : s.config) == null ? void 0 : l.fields) ?? ["role", "page"],
2839
- adminUrl: ((i = s == null ? void 0 : s.config) == null ? void 0 : i.admin_url) ?? null,
2840
- dimensions: ((c = s == null ? void 0 : s.config) == null ? void 0 : c.dimensions) ?? [],
2837
+ }, [r]),
2838
+ fields: ((l = r == null ? void 0 : r.config) == null ? void 0 : l.fields) ?? ["role", "page"],
2839
+ adminUrl: ((i = r == null ? void 0 : r.config) == null ? void 0 : i.admin_url) ?? null,
2840
+ dimensions: ((c = r == null ? void 0 : r.config) == null ? void 0 : c.dimensions) ?? [],
2841
2841
  loaded: o
2842
2842
  };
2843
2843
  }
2844
- function nn(t) {
2844
+ function ln(t) {
2845
2845
  if (!t) return null;
2846
- const s = t.split("/").filter(Boolean);
2847
- if (s.length === 0) return "Home";
2848
- const o = /* @__PURE__ */ new Set(["records", "collections", "p"]), r = s.filter((l) => !o.has(l));
2849
- return r.length === 0 ? "Home" : r.map((l, i) => i === 0 ? l.replace(/[-_]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()) : l).join(" › ");
2846
+ const r = t.split("/").filter(Boolean);
2847
+ if (r.length === 0) return "Home";
2848
+ const o = /* @__PURE__ */ new Set(["records", "collections", "p"]), s = r.filter((l) => !o.has(l));
2849
+ return s.length === 0 ? "Home" : s.map((l, i) => i === 0 ? l.replace(/[-_]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()) : l).join(" › ");
2850
2850
  }
2851
- function Nr({
2851
+ function _s({
2852
2852
  onClose: t,
2853
- onCreated: s
2853
+ onCreated: r
2854
2854
  }) {
2855
- const o = se(), [r, l] = U(""), [i, c] = U(""), [d, h] = U(/* @__PURE__ */ new Map()), { users: x } = Lt(r, !0), u = Ws(), f = (v) => [v.first_name, v.last_name].filter(Boolean).join(" ") || (v.email ?? "Unknown");
2855
+ const o = oe(), [s, l] = D(""), [i, c] = D(""), [d, h] = D(/* @__PURE__ */ new Map()), { users: x } = Lt(s, !0), m = Fr(), b = (v) => [v.first_name, v.last_name].filter(Boolean).join(" ") || (v.email ?? "Unknown");
2856
2856
  return /* @__PURE__ */ n("div", { className: "flex min-h-0 flex-1 flex-col p-3", "data-chat-group-dialog": !0, children: [
2857
2857
  /* @__PURE__ */ n("div", { className: "mb-2 flex items-center gap-2", children: [
2858
2858
  /* @__PURE__ */ e(
@@ -2862,20 +2862,20 @@ function Nr({
2862
2862
  onClick: t,
2863
2863
  className: "rounded-md p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100",
2864
2864
  "aria-label": "Back",
2865
- children: /* @__PURE__ */ e(st, { className: "h-4 w-4", strokeWidth: 2 })
2865
+ children: /* @__PURE__ */ e(rt, { className: "h-4 w-4", strokeWidth: 2 })
2866
2866
  }
2867
2867
  ),
2868
2868
  /* @__PURE__ */ e("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "New group conversation" })
2869
2869
  ] }),
2870
- d.size > 0 && /* @__PURE__ */ e("div", { className: "mb-2 flex flex-wrap gap-1", children: [...d.entries()].map(([v, D]) => /* @__PURE__ */ n(
2870
+ d.size > 0 && /* @__PURE__ */ e("div", { className: "mb-2 flex flex-wrap gap-1", children: [...d.entries()].map(([v, $]) => /* @__PURE__ */ n(
2871
2871
  "span",
2872
2872
  {
2873
- className: m(
2873
+ className: u(
2874
2874
  "inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium",
2875
2875
  o.accentSoft
2876
2876
  ),
2877
2877
  children: [
2878
- D,
2878
+ $,
2879
2879
  /* @__PURE__ */ e(
2880
2880
  "button",
2881
2881
  {
@@ -2884,7 +2884,7 @@ function Nr({
2884
2884
  const C = new Map(S);
2885
2885
  return C.delete(v), C;
2886
2886
  }),
2887
- "aria-label": `Remove ${D}`,
2887
+ "aria-label": `Remove ${$}`,
2888
2888
  children: /* @__PURE__ */ e(lt, { className: "h-3 w-3" })
2889
2889
  }
2890
2890
  )
@@ -2895,32 +2895,32 @@ function Nr({
2895
2895
  /* @__PURE__ */ e(
2896
2896
  "input",
2897
2897
  {
2898
- value: r,
2898
+ value: s,
2899
2899
  onChange: (v) => l(v.target.value),
2900
2900
  placeholder: "Find people…",
2901
- className: m("mb-1.5 h-8 rounded-md border px-2.5 text-[12.5px] outline-none", o.input),
2901
+ className: u("mb-1.5 h-8 rounded-md border px-2.5 text-[12.5px] outline-none", o.input),
2902
2902
  "aria-label": "Find people",
2903
2903
  autoFocus: !0
2904
2904
  }
2905
2905
  ),
2906
2906
  /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto", children: x.map((v) => {
2907
- const D = d.has(v.id);
2907
+ const $ = d.has(v.id);
2908
2908
  return /* @__PURE__ */ n(
2909
2909
  "button",
2910
2910
  {
2911
2911
  type: "button",
2912
2912
  onClick: () => h((S) => {
2913
2913
  const C = new Map(S);
2914
- return D ? C.delete(v.id) : C.set(v.id, f(v)), C;
2914
+ return $ ? C.delete(v.id) : C.set(v.id, b(v)), C;
2915
2915
  }),
2916
- className: m(
2916
+ className: u(
2917
2917
  "flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-[12.5px] transition-colors",
2918
- D ? o.accentSoft : "hover:bg-slate-50 dark:hover:bg-muted/50"
2918
+ $ ? o.accentSoft : "hover:bg-slate-50 dark:hover:bg-muted/50"
2919
2919
  ),
2920
2920
  children: [
2921
- /* @__PURE__ */ e(X, { id: v.id, name: f(v), size: 22 }),
2922
- /* @__PURE__ */ e("span", { className: "truncate", children: f(v) }),
2923
- D && /* @__PURE__ */ e(rt, { className: "ml-auto h-3.5 w-3.5 shrink-0" })
2921
+ /* @__PURE__ */ e(te, { id: v.id, name: b(v), size: 22 }),
2922
+ /* @__PURE__ */ e("span", { className: "truncate", children: b(v) }),
2923
+ $ && /* @__PURE__ */ e(st, { className: "ml-auto h-3.5 w-3.5 shrink-0" })
2924
2924
  ]
2925
2925
  },
2926
2926
  v.id
@@ -2932,7 +2932,7 @@ function Nr({
2932
2932
  value: i,
2933
2933
  onChange: (v) => c(v.target.value),
2934
2934
  placeholder: "Group name (optional)",
2935
- className: m(
2935
+ className: u(
2936
2936
  "mb-2 mt-1.5 h-8 rounded-md border px-2.5 text-[12.5px] outline-none",
2937
2937
  o.input
2938
2938
  ),
@@ -2943,52 +2943,52 @@ function Nr({
2943
2943
  "button",
2944
2944
  {
2945
2945
  type: "button",
2946
- disabled: d.size === 0 || u.isPending,
2947
- onClick: () => u.mutate(
2946
+ disabled: d.size === 0 || m.isPending,
2947
+ onClick: () => m.mutate(
2948
2948
  { user_ids: [...d.keys()], name: i.trim() || void 0 },
2949
- { onSuccess: (v) => s(v.room, v.name) }
2949
+ { onSuccess: (v) => r(v.room, v.name) }
2950
2950
  ),
2951
- className: m(
2951
+ className: u(
2952
2952
  "flex h-9 items-center justify-center rounded-lg text-[12.5px] font-semibold transition-[filter] hover:brightness-110 disabled:opacity-40",
2953
2953
  o.action
2954
2954
  ),
2955
- children: u.isPending ? "Creating…" : `Start conversation${d.size ? ` (${d.size + 1})` : ""}`
2955
+ children: m.isPending ? "Creating…" : `Start conversation${d.size ? ` (${d.size + 1})` : ""}`
2956
2956
  }
2957
2957
  )
2958
2958
  ] });
2959
2959
  }
2960
2960
  const Ut = "nvr-chat-pinned", kt = 400;
2961
- function Cr() {
2961
+ function Ss() {
2962
2962
  try {
2963
2963
  return typeof window < "u" && window.localStorage.getItem(Ut) === "1";
2964
2964
  } catch {
2965
2965
  return !1;
2966
2966
  }
2967
2967
  }
2968
- function _r() {
2969
- const t = "(min-width: 1024px)", [s, o] = U(
2968
+ function Ts() {
2969
+ const t = "(min-width: 1024px)", [r, o] = D(
2970
2970
  () => {
2971
- var r;
2972
- return typeof window < "u" && !!((r = window.matchMedia) != null && r.call(window, t).matches);
2971
+ var s;
2972
+ return typeof window < "u" && !!((s = window.matchMedia) != null && s.call(window, t).matches);
2973
2973
  }
2974
2974
  );
2975
- return V(() => {
2975
+ return ee(() => {
2976
2976
  var i;
2977
- const r = (i = window.matchMedia) == null ? void 0 : i.call(window, t);
2978
- if (!r) return;
2979
- const l = () => o(r.matches);
2980
- return r.addEventListener("change", l), () => r.removeEventListener("change", l);
2981
- }, []), s;
2977
+ const s = (i = window.matchMedia) == null ? void 0 : i.call(window, t);
2978
+ if (!s) return;
2979
+ const l = () => o(s.matches);
2980
+ return s.addEventListener("change", l), () => s.removeEventListener("change", l);
2981
+ }, []), r;
2982
2982
  }
2983
- function nl({
2983
+ function sl({
2984
2984
  open: t,
2985
- onClose: s,
2985
+ onClose: r,
2986
2986
  renderMessageBody: o,
2987
- requestedDm: r,
2987
+ requestedDm: s,
2988
2988
  requestedRoom: l
2989
2989
  }) {
2990
2990
  var Ye;
2991
- const i = Te(), c = se(), d = i.me, [h, x] = U(Cr), u = _r(), f = h && u, v = () => {
2991
+ const i = Ue(), c = oe(), d = i.me, [h, x] = D(Ss), m = Ts(), b = h && m, v = () => {
2992
2992
  const y = !h;
2993
2993
  x(y);
2994
2994
  try {
@@ -2996,91 +2996,91 @@ function nl({
2996
2996
  } catch {
2997
2997
  }
2998
2998
  };
2999
- V(() => {
3000
- if (!t || !f) return;
3001
- const y = document.body, R = y.style.paddingRight;
2999
+ ee(() => {
3000
+ if (!t || !b) return;
3001
+ const y = document.body, M = y.style.paddingRight;
3002
3002
  y.style.paddingRight = `${kt}px`, y.dataset.nvrChatPinned = "1";
3003
- const j = document.createElement("style");
3004
- return j.dataset.nvrChatPinnedStyle = "", j.textContent = `body[data-nvr-chat-pinned] [data-sonner-toaster][data-x-position="right"],
3005
- body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${kt}px; }`, document.head.appendChild(j), () => {
3006
- y.style.paddingRight = R, delete y.dataset.nvrChatPinned, j.remove();
3003
+ const P = document.createElement("style");
3004
+ return P.dataset.nvrChatPinnedStyle = "", P.textContent = `body[data-nvr-chat-pinned] [data-sonner-toaster][data-x-position="right"],
3005
+ body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${kt}px; }`, document.head.appendChild(P), () => {
3006
+ y.style.paddingRight = M, delete y.dataset.nvrChatPinned, P.remove();
3007
3007
  };
3008
- }, [t, f]);
3009
- const [D, S] = U("online"), [C, T] = U(null), [E, k] = U(null), A = (y, R, j) => {
3010
- const ee = Z.find((ve) => ve.room === y);
3011
- W(!1), T({ room: y, label: (ee == null ? void 0 : ee.label) ?? R, channel: ee == null ? void 0 : ee.channel, anchor: j });
3012
- }, [P, $] = U(!1), [F, W] = U(!1), [Q, te] = U(null), { rooms: Z, totalUnread: Y } = Fa(), me = za(D === "archived"), _ = (y, R, j) => {
3013
- var ve, O;
3014
- if (!R) return [{ key: "all", label: null, users: y }];
3015
- const ee = /* @__PURE__ */ new Map();
3016
- for (const B of y) {
3017
- const z = j.get(String(B.user_id).toUpperCase()), re = R === "__role__" ? [Na((z == null ? void 0 : z.role_name) ?? B.role_name) || "No role"] : (O = (ve = z == null ? void 0 : z.scopes_by_dimension) == null ? void 0 : ve[R]) != null && O.length ? z.scopes_by_dimension[R] : ["Unassigned"], le = [...new Set(re)].sort((K, De) => K.localeCompare(De)).join(", ");
3018
- ee.set(le, [...ee.get(le) ?? [], B]);
3008
+ }, [t, b]);
3009
+ const [$, S] = D("online"), [C, T] = D(null), [F, k] = D(null), A = (y, M, P) => {
3010
+ const ae = X.find((we) => we.room === y);
3011
+ z(!1), T({ room: y, label: (ae == null ? void 0 : ae.label) ?? M, channel: ae == null ? void 0 : ae.channel, anchor: P });
3012
+ }, [I, R] = D(!1), [H, z] = D(!1), [J, re] = D(null), { rooms: X, totalUnread: V } = Ga(), pe = Qa($ === "archived"), _ = (y, M, P) => {
3013
+ var we, U;
3014
+ if (!M) return [{ key: "all", label: null, users: y }];
3015
+ const ae = /* @__PURE__ */ new Map();
3016
+ for (const E of y) {
3017
+ const q = P.get(String(E.user_id).toUpperCase()), ne = M === "__role__" ? [Sa((q == null ? void 0 : q.role_name) ?? E.role_name) || "No role"] : (U = (we = q == null ? void 0 : q.scopes_by_dimension) == null ? void 0 : we[M]) != null && U.length ? q.scopes_by_dimension[M] : ["Unassigned"], G = [...new Set(ne)].sort((B, Y) => B.localeCompare(Y)).join(", ");
3018
+ ae.set(G, [...ae.get(G) ?? [], E]);
3019
3019
  }
3020
- return [...ee.entries()].sort((B, z) => B[0] === "Unassigned" ? 1 : z[0] === "Unassigned" ? -1 : B[0].localeCompare(z[0])).map(([B, z]) => ({ key: B, label: B, users: z }));
3021
- }, [N, b] = U(() => typeof window > "u" ? "" : localStorage.getItem("nvr_chat_group_by") ?? ""), I = an(), q = I.loaded ? i.onlineUsers.filter((y) => I.byUser.has(String(y.user_id).toUpperCase())) : [], fe = he(
3022
- () => _(q, N, I.byUser),
3020
+ return [...ae.entries()].sort((E, q) => E[0] === "Unassigned" ? 1 : q[0] === "Unassigned" ? -1 : E[0].localeCompare(q[0])).map(([E, q]) => ({ key: E, label: E, users: q }));
3021
+ }, [N, f] = D(() => typeof window > "u" ? "" : localStorage.getItem("nvr_chat_group_by") ?? ""), j = sn(), W = j.loaded ? i.onlineUsers.filter((y) => j.byUser.has(String(y.user_id).toUpperCase())) : [], ye = xe(
3022
+ () => _(W, N, j.byUser),
3023
3023
  // biome-ignore lint/correctness/useExhaustiveDependencies: builder is pure
3024
- [q, N, I.byUser]
3025
- ), { isAdmin: ge } = ot(), { navigate: Ue } = ts(), we = (y) => {
3026
- /^https?:\/\//i.test(y) ? window.open(y, "_blank", "noopener") : Ue(y);
3027
- }, pe = (y) => {
3024
+ [W, N, j.byUser]
3025
+ ), { isAdmin: ke } = ot(), { navigate: De } = rr(), de = (y) => {
3026
+ /^https?:\/\//i.test(y) ? window.open(y, "_blank", "noopener") : De(y);
3027
+ }, fe = (y) => {
3028
3028
  d && (S("chat"), T({ room: St(d.id, y.user_id), label: y.display_name ?? "Direct message" }));
3029
- }, Ne = ne(0);
3030
- V(() => {
3031
- !r || !d || r.nonce === Ne.current || (Ne.current = r.nonce, S("chat"), W(!1), T({
3032
- room: St(d.id, r.userId),
3033
- label: r.name ?? "Direct message"
3029
+ }, Ce = le(0);
3030
+ ee(() => {
3031
+ !s || !d || s.nonce === Ce.current || (Ce.current = s.nonce, S("chat"), z(!1), T({
3032
+ room: St(d.id, s.userId),
3033
+ label: s.name ?? "Direct message"
3034
3034
  }));
3035
- }, [r, d]);
3036
- const Le = ne(0);
3037
- return V(() => {
3038
- !l || l.nonce === Le.current || (Le.current = l.nonce, S("chat"), W(!1), T({ room: l.room, label: l.label ?? l.room }));
3035
+ }, [s, d]);
3036
+ const Le = le(0);
3037
+ return ee(() => {
3038
+ !l || l.nonce === Le.current || (Le.current = l.nonce, S("chat"), z(!1), T({ room: l.room, label: l.label ?? l.room }));
3039
3039
  }, [l]), t ? /* @__PURE__ */ e(
3040
3040
  "div",
3041
3041
  {
3042
- className: f ? (
3042
+ className: b ? (
3043
3043
  // No backdrop: the rest of the page stays usable.
3044
3044
  "pointer-events-none fixed inset-y-0 right-0 z-40"
3045
3045
  ) : "fixed inset-0 z-40 bg-black/40 animate-in fade-in duration-150",
3046
- style: f ? { width: kt } : void 0,
3047
- onClick: f ? void 0 : s,
3046
+ style: b ? { width: kt } : void 0,
3047
+ onClick: b ? void 0 : r,
3048
3048
  "data-chat-panel": !0,
3049
3049
  "data-nvr-recording-hide": !0,
3050
- "data-chat-pinned": f ? "1" : void 0,
3050
+ "data-chat-pinned": b ? "1" : void 0,
3051
3051
  children: /* @__PURE__ */ n(
3052
3052
  "aside",
3053
3053
  {
3054
- className: m(
3054
+ className: u(
3055
3055
  "pointer-events-auto absolute right-0 top-0 flex h-full w-full flex-col border-l",
3056
- f ? "max-w-none" : "max-w-[400px] shadow-2xl animate-in slide-in-from-right duration-200",
3056
+ b ? "max-w-none" : "max-w-[400px] shadow-2xl animate-in slide-in-from-right duration-200",
3057
3057
  c.surface,
3058
3058
  "border-slate-200 dark:border-border"
3059
3059
  ),
3060
3060
  onClick: (y) => y.stopPropagation(),
3061
3061
  "aria-label": "Team",
3062
3062
  children: [
3063
- /* @__PURE__ */ n("div", { className: m("flex shrink-0 items-center gap-2 border-b px-3.5 py-2.5", c.divider), children: [
3063
+ /* @__PURE__ */ n("div", { className: u("flex shrink-0 items-center gap-2 border-b px-3.5 py-2.5", c.divider), children: [
3064
3064
  /* @__PURE__ */ e("div", { className: "flex gap-0.5 rounded-lg border border-slate-200 p-0.5 dark:border-border", children: ["online", "chat", "browse", "archived"].map((y) => /* @__PURE__ */ n(
3065
3065
  "button",
3066
3066
  {
3067
3067
  type: "button",
3068
3068
  onClick: () => S(y),
3069
- className: m(
3069
+ className: u(
3070
3070
  "flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors",
3071
- D === y ? c.accentSoft : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"
3071
+ $ === y ? c.accentSoft : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"
3072
3072
  ),
3073
3073
  children: [
3074
- y === "online" ? `Online · ${q.length}` : y === "chat" ? "Chat" : y === "browse" ? "Browse" : "Archived",
3075
- y === "chat" && Y > 0 && /* @__PURE__ */ e(
3074
+ y === "online" ? `Online · ${W.length}` : y === "chat" ? "Chat" : y === "browse" ? "Browse" : "Archived",
3075
+ y === "chat" && V > 0 && /* @__PURE__ */ e(
3076
3076
  "span",
3077
3077
  {
3078
- className: m(
3078
+ className: u(
3079
3079
  "flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[9.5px] font-bold leading-none",
3080
3080
  c.pill
3081
3081
  ),
3082
- title: `${Y} unread`,
3083
- children: Y > 99 ? "99+" : Y
3082
+ title: `${V} unread`,
3083
+ children: V > 99 ? "99+" : V
3084
3084
  }
3085
3085
  )
3086
3086
  ]
@@ -3095,42 +3095,42 @@ body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${kt}px; }`, do
3095
3095
  "aria-pressed": h,
3096
3096
  title: h ? "Unpin — go back to opening chat over the page" : "Pin — keep chat open beside the page while you work",
3097
3097
  "aria-label": h ? "Unpin chat panel" : "Pin chat panel",
3098
- className: m(
3098
+ className: u(
3099
3099
  "ml-auto hidden rounded-md p-1.5 transition-colors lg:flex",
3100
3100
  h ? c.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
3101
3101
  ),
3102
3102
  "data-chat-pin": h ? "on" : "off",
3103
- children: h ? /* @__PURE__ */ e($n, { className: "h-4 w-4", strokeWidth: 2 }) : /* @__PURE__ */ e(Nt, { className: "h-4 w-4", strokeWidth: 2 })
3103
+ children: h ? /* @__PURE__ */ e(Mn, { className: "h-4 w-4", strokeWidth: 2 }) : /* @__PURE__ */ e(Nt, { className: "h-4 w-4", strokeWidth: 2 })
3104
3104
  }
3105
3105
  ),
3106
3106
  /* @__PURE__ */ e(
3107
3107
  "button",
3108
3108
  {
3109
3109
  type: "button",
3110
- onClick: s,
3110
+ onClick: r,
3111
3111
  className: "rounded-md p-1.5 text-slate-400 hover:bg-slate-100 hover:text-slate-600 max-lg:ml-auto dark:hover:bg-white/10 dark:hover:text-slate-100",
3112
3112
  "aria-label": "Close panel",
3113
3113
  children: /* @__PURE__ */ e(lt, { className: "h-4 w-4", strokeWidth: 2 })
3114
3114
  }
3115
3115
  )
3116
3116
  ] }),
3117
- D === "online" ? /* @__PURE__ */ n("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", "data-chat-online": !0, children: [
3117
+ $ === "online" ? /* @__PURE__ */ n("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", "data-chat-online": !0, children: [
3118
3118
  /* @__PURE__ */ e(
3119
- wr,
3119
+ Cs,
3120
3120
  {
3121
- myStatus: d ? ((Ye = I.byUser.get(String(d.id).toUpperCase())) == null ? void 0 : Ye.custom_status) ?? null : null
3121
+ myStatus: d ? ((Ye = j.byUser.get(String(d.id).toUpperCase())) == null ? void 0 : Ye.custom_status) ?? null : null
3122
3122
  }
3123
3123
  ),
3124
- /* @__PURE__ */ e(kr, {}),
3125
- /* @__PURE__ */ e(ds, {}),
3126
- q.length > 0 && /* @__PURE__ */ n("div", { className: "mb-1.5 flex items-center gap-1.5 px-1", children: [
3124
+ /* @__PURE__ */ e(Ns, {}),
3125
+ /* @__PURE__ */ e(mr, {}),
3126
+ W.length > 0 && /* @__PURE__ */ n("div", { className: "mb-1.5 flex items-center gap-1.5 px-1", children: [
3127
3127
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "Group by" }),
3128
3128
  /* @__PURE__ */ e(
3129
- At,
3129
+ Rt,
3130
3130
  {
3131
3131
  value: N,
3132
3132
  onChange: (y) => {
3133
- b(y);
3133
+ f(y);
3134
3134
  try {
3135
3135
  localStorage.setItem("nvr_chat_group_by", y);
3136
3136
  } catch {
@@ -3141,53 +3141,83 @@ body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${kt}px; }`, do
3141
3141
  options: [
3142
3142
  { value: "", label: "No grouping" },
3143
3143
  { value: "__role__", label: "Role" },
3144
- ...I.dimensions.map((y) => ({ value: y.name, label: y.label }))
3144
+ ...j.dimensions.map((y) => ({ value: y.name, label: y.label }))
3145
3145
  ]
3146
3146
  }
3147
3147
  )
3148
3148
  ] }),
3149
- q.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-8 text-center text-[12px] text-slate-400", children: "No one else is online right now." }) : fe.map((y) => /* @__PURE__ */ n("div", { "data-chat-online-group": y.key, children: [
3149
+ W.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-8 text-center text-[12px] text-slate-400", children: "No one else is online right now." }) : ye.map((y) => /* @__PURE__ */ n("div", { "data-chat-online-group": y.key, children: [
3150
3150
  y.label !== null && /* @__PURE__ */ n("div", { className: "sticky top-0 z-[1] flex items-center gap-1.5 bg-white/95 px-2 py-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400 backdrop-blur dark:bg-card/95", children: [
3151
3151
  y.label,
3152
3152
  /* @__PURE__ */ e("span", { className: "font-normal normal-case text-slate-300", children: y.users.length })
3153
3153
  ] }),
3154
- y.users.map((R) => {
3155
- const j = I.byUser.get(String(R.user_id).toUpperCase()), ee = (j == null ? void 0 : j.is_idle) ?? R.is_idle, ve = j ?? R;
3154
+ y.users.map((M) => {
3155
+ const P = j.byUser.get(String(M.user_id).toUpperCase()), ae = (P == null ? void 0 : P.is_idle) ?? M.is_idle, we = P ?? M;
3156
3156
  return /* @__PURE__ */ n(
3157
3157
  "button",
3158
3158
  {
3159
3159
  type: "button",
3160
- onClick: () => pe(R),
3160
+ onClick: () => fe(M),
3161
3161
  title: "Send a direct message",
3162
3162
  className: "flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-slate-50 dark:hover:bg-muted/50",
3163
3163
  children: [
3164
- /* @__PURE__ */ e(X, { id: R.user_id, name: R.display_name }),
3164
+ /* @__PURE__ */ e(te, { id: M.user_id, name: M.display_name }),
3165
3165
  /* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: [
3166
3166
  /* @__PURE__ */ n("span", { className: "block truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: [
3167
- R.display_name ?? "Unknown user",
3168
- ee && /* @__PURE__ */ e("span", { className: "ml-1.5 rounded-full bg-amber-500/10 px-1.5 py-px text-[10px] font-medium text-amber-700 dark:text-amber-400", children: j != null && j.away ? "Away" : Tt(ve) }),
3169
- !ee && (j == null ? void 0 : j.stuck) && /* @__PURE__ */ e(
3170
- "span",
3171
- {
3172
- className: "ml-1.5 rounded-full bg-orange-500/10 px-1.5 py-px text-[10px] font-medium text-orange-700 dark:text-orange-400",
3173
- "data-chat-stuck": j.stuck.minutes,
3174
- title: "At the keyboard, on the same page, nothing saved for ten minutes",
3175
- children: ls(j.stuck)
3176
- }
3177
- ),
3167
+ M.display_name ?? "Unknown user",
3168
+ ae && /* @__PURE__ */ e("span", { className: "ml-1.5 rounded-full bg-amber-500/10 px-1.5 py-px text-[10px] font-medium text-amber-700 dark:text-amber-400", children: P != null && P.away ? "Away" : Tt(we) }),
3169
+ !ae && (P == null ? void 0 : P.stuck) && (() => {
3170
+ const U = P.stuck, E = j.fields.includes("page"), q = va(
3171
+ P.current_path,
3172
+ P.app,
3173
+ j.adminUrl,
3174
+ i.recordUrl,
3175
+ typeof window > "u" ? null : window.location.origin
3176
+ ), ne = `${ya(U)} — at the keyboard, on the same page, nothing saved for ten minutes${q ? `
3177
+ ${ka(q)}` : ""}`, G = ya(E ? { ...U, label: null } : U), B = "ml-1.5 rounded-full bg-orange-500/10 px-1.5 py-px text-[10px] font-medium text-orange-700 dark:text-orange-400";
3178
+ return q ? (
3179
+ // biome-ignore lint/a11y/useSemanticElements: inside the row's DM button, where a nested <a> is invalid
3180
+ /* @__PURE__ */ e(
3181
+ "span",
3182
+ {
3183
+ role: "link",
3184
+ tabIndex: 0,
3185
+ className: u(B, "cursor-pointer hover:underline"),
3186
+ "data-chat-stuck": U.minutes,
3187
+ "data-tip": ne,
3188
+ "aria-label": `${G}: open the page`,
3189
+ onClick: (Y) => {
3190
+ Y.stopPropagation(), de(q);
3191
+ },
3192
+ onKeyDown: (Y) => {
3193
+ (Y.key === "Enter" || Y.key === " ") && (Y.preventDefault(), Y.stopPropagation(), de(q));
3194
+ },
3195
+ children: G
3196
+ }
3197
+ )
3198
+ ) : /* @__PURE__ */ e(
3199
+ "span",
3200
+ {
3201
+ className: B,
3202
+ "data-chat-stuck": U.minutes,
3203
+ "data-tip": ne,
3204
+ children: G
3205
+ }
3206
+ );
3207
+ })(),
3178
3208
  (() => {
3179
- var B;
3180
- const O = (B = I.byUser.get(
3181
- String(R.user_id).toUpperCase()
3182
- )) == null ? void 0 : B.masquerade;
3183
- return O ? /* @__PURE__ */ n(
3209
+ var E;
3210
+ const U = (E = j.byUser.get(
3211
+ String(M.user_id).toUpperCase()
3212
+ )) == null ? void 0 : E.masquerade;
3213
+ return U ? /* @__PURE__ */ n(
3184
3214
  "span",
3185
3215
  {
3186
3216
  className: "ml-1.5 rounded-full bg-violet-500/10 px-1.5 py-px text-[10px] font-medium text-violet-700 dark:bg-violet-400/15 dark:text-violet-300",
3187
- title: `${O.admin_name} is signed in as this person right now`,
3188
- "data-chat-masquerade": O.admin_id ?? "",
3217
+ title: `${U.admin_name} is signed in as this person right now`,
3218
+ "data-chat-masquerade": U.admin_id ?? "",
3189
3219
  children: [
3190
- O.admin_name,
3220
+ U.admin_name,
3191
3221
  " masquerading"
3192
3222
  ]
3193
3223
  }
@@ -3195,86 +3225,116 @@ body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${kt}px; }`, do
3195
3225
  })()
3196
3226
  ] }),
3197
3227
  (() => {
3198
- var B;
3199
- const O = (B = I.byUser.get(
3200
- String(R.user_id).toUpperCase()
3201
- )) == null ? void 0 : B.custom_status;
3202
- return O ? /* @__PURE__ */ n(
3228
+ var E;
3229
+ const U = (E = j.byUser.get(
3230
+ String(M.user_id).toUpperCase()
3231
+ )) == null ? void 0 : E.custom_status;
3232
+ return U ? /* @__PURE__ */ n(
3203
3233
  "span",
3204
3234
  {
3205
3235
  className: "block truncate text-[11px] italic text-slate-500 dark:text-slate-400",
3206
3236
  "data-chat-status": !0,
3207
3237
  children: [
3208
- O.emoji ? `${O.emoji} ` : "",
3209
- O.text
3238
+ U.emoji ? `${U.emoji} ` : "",
3239
+ U.text
3210
3240
  ]
3211
3241
  }
3212
3242
  ) : null;
3213
3243
  })(),
3214
3244
  (() => {
3215
- const O = I.byUser.get(String(R.user_id).toUpperCase()), B = [];
3216
- let z = null;
3217
- for (const le of I.fields)
3218
- if (le === "role") {
3219
- const K = Na((O == null ? void 0 : O.role_name) ?? R.role_name);
3220
- K && B.push(K);
3221
- } else if (le === "scopes") {
3222
- const K = ((O == null ? void 0 : O.scopes) ?? []).join(", ");
3223
- K && B.push(K);
3224
- } else if (le === "page") {
3225
- const K = (O == null ? void 0 : O.page) ?? R.page ?? nn((O == null ? void 0 : O.current_path) ?? R.current_path), De = (O == null ? void 0 : O.app) ?? R.app;
3226
- z = (De ? `${K ?? ""}${K ? " · " : ""}${De}`.trim() : K) || null;
3245
+ const U = j.byUser.get(String(M.user_id).toUpperCase()), E = [];
3246
+ let q = null;
3247
+ for (const G of j.fields)
3248
+ if (G === "role") {
3249
+ const B = Sa((U == null ? void 0 : U.role_name) ?? M.role_name);
3250
+ B && E.push(B);
3251
+ } else if (G === "scopes") {
3252
+ const B = ((U == null ? void 0 : U.scopes) ?? []).join(", ");
3253
+ B && E.push(B);
3254
+ } else if (G === "page") {
3255
+ const B = (U == null ? void 0 : U.page) ?? M.page ?? ln((U == null ? void 0 : U.current_path) ?? M.current_path), Y = (U == null ? void 0 : U.app) ?? M.app;
3256
+ q = (Y ? `${B ?? ""}${B ? " · " : ""}${Y}`.trim() : B) || null;
3227
3257
  }
3228
- const re = B.join(" · ");
3229
- return !re && !z ? /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: "Online" }) : /* @__PURE__ */ n(ke, { children: [
3230
- re && /* @__PURE__ */ e(
3258
+ const ne = E.join(" · ");
3259
+ return !ne && !q ? /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: "Online" }) : /* @__PURE__ */ n(ve, { children: [
3260
+ ne && /* @__PURE__ */ e(
3231
3261
  "span",
3232
3262
  {
3233
3263
  className: "block truncate text-[11px] text-slate-400",
3234
3264
  "data-chat-online-meta": !0,
3235
- title: re,
3236
- children: re
3265
+ title: ne,
3266
+ children: ne
3237
3267
  }
3238
3268
  ),
3239
- z && /* @__PURE__ */ n(
3240
- "span",
3241
- {
3242
- className: "flex items-start gap-1 text-[11px] text-slate-500 dark:text-slate-300",
3243
- "data-chat-online-page": !0,
3244
- title: z,
3245
- children: [
3246
- /* @__PURE__ */ e(An, { className: "mt-[2px] h-3 w-3 shrink-0 text-slate-400" }),
3247
- /* @__PURE__ */ e("span", { className: "line-clamp-2 min-w-0 break-words", children: z })
3248
- ]
3249
- }
3250
- )
3269
+ q && (() => {
3270
+ const G = va(
3271
+ U == null ? void 0 : U.current_path,
3272
+ U == null ? void 0 : U.app,
3273
+ j.adminUrl,
3274
+ i.recordUrl,
3275
+ typeof window > "u" ? null : window.location.origin
3276
+ ), B = /* @__PURE__ */ n(ve, { children: [
3277
+ /* @__PURE__ */ e(Bn, { className: "mt-[2px] h-3 w-3 shrink-0 text-slate-400" }),
3278
+ /* @__PURE__ */ e("span", { className: "line-clamp-2 min-w-0 break-words", children: q })
3279
+ ] });
3280
+ return G ? (
3281
+ // biome-ignore lint/a11y/useSemanticElements: inside the row's DM button, where a nested <a> is invalid
3282
+ /* @__PURE__ */ e(
3283
+ "span",
3284
+ {
3285
+ role: "link",
3286
+ tabIndex: 0,
3287
+ className: "-mx-1 flex w-fit max-w-full cursor-pointer items-start gap-1 rounded px-1 text-[11px] text-slate-500 hover:bg-slate-100 hover:text-nvr-cyan hover:underline dark:text-slate-300 dark:hover:bg-muted",
3288
+ "data-chat-online-page": !0,
3289
+ "data-chat-online-page-href": G,
3290
+ "data-tip": ka(G),
3291
+ "aria-label": `${q}: open the page`,
3292
+ onClick: (Y) => {
3293
+ Y.stopPropagation(), de(G);
3294
+ },
3295
+ onKeyDown: (Y) => {
3296
+ (Y.key === "Enter" || Y.key === " ") && (Y.preventDefault(), Y.stopPropagation(), de(G));
3297
+ },
3298
+ children: B
3299
+ }
3300
+ )
3301
+ ) : /* @__PURE__ */ e(
3302
+ "span",
3303
+ {
3304
+ className: "flex items-start gap-1 text-[11px] text-slate-500 dark:text-slate-300",
3305
+ "data-chat-online-page": !0,
3306
+ "data-tip": (U == null ? void 0 : U.current_path) ?? q,
3307
+ children: B
3308
+ }
3309
+ );
3310
+ })()
3251
3311
  ] });
3252
3312
  })()
3253
3313
  ] }),
3254
3314
  (() => {
3255
- var le;
3256
- const O = I.byUser.get(String(R.user_id).toUpperCase());
3257
- if (!ge || !(O != null && O.recording_id)) return null;
3258
- const B = ((le = I.adminUrl) == null ? void 0 : le.replace(/\/$/, "")) ?? "", z = !!B && (typeof window > "u" || new URL(B, window.location.origin).origin !== window.location.origin), re = i.sessionUrl ? i.sessionUrl(O.recording_id, String(R.user_id)) : z ? `${B}/session-replays?recording=${O.recording_id}` : null;
3259
- return re ? /* @__PURE__ */ e(
3315
+ var G;
3316
+ const U = j.byUser.get(String(M.user_id).toUpperCase());
3317
+ if (!ke || !(U != null && U.recording_id)) return null;
3318
+ const E = ((G = j.adminUrl) == null ? void 0 : G.replace(/\/$/, "")) ?? "", q = !!E && (typeof window > "u" || new URL(E, window.location.origin).origin !== window.location.origin), ne = i.sessionUrl ? i.sessionUrl(U.recording_id, String(M.user_id)) : q ? `${E}/session-replays?recording=${U.recording_id}` : null;
3319
+ return ne ? /* @__PURE__ */ e(
3260
3320
  "span",
3261
3321
  {
3262
3322
  role: "link",
3263
3323
  tabIndex: 0,
3264
3324
  title: "Watch this session",
3265
- onClick: (K) => {
3266
- K.stopPropagation(), we(re);
3325
+ onClick: (B) => {
3326
+ B.stopPropagation(), de(ne);
3267
3327
  },
3268
- onKeyDown: (K) => {
3269
- (K.key === "Enter" || K.key === " ") && (K.stopPropagation(), we(re));
3328
+ onKeyDown: (B) => {
3329
+ (B.key === "Enter" || B.key === " ") && (B.stopPropagation(), de(ne));
3270
3330
  },
3271
3331
  className: "shrink-0 rounded p-1 text-slate-300 transition-colors hover:bg-slate-100 hover:text-nvr-cyan dark:hover:bg-muted",
3272
- children: /* @__PURE__ */ e(Rn, { className: "h-4 w-4", strokeWidth: 1.8 })
3332
+ children: /* @__PURE__ */ e(On, { className: "h-4 w-4", strokeWidth: 1.8 })
3273
3333
  }
3274
3334
  ) : null;
3275
3335
  })(),
3276
3336
  /* @__PURE__ */ e(
3277
- Ta,
3337
+ $a,
3278
3338
  {
3279
3339
  className: "h-4 w-4 shrink-0 text-slate-300",
3280
3340
  strokeWidth: 1.8
@@ -3282,96 +3342,96 @@ body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${kt}px; }`, do
3282
3342
  )
3283
3343
  ]
3284
3344
  },
3285
- R.user_id
3345
+ M.user_id
3286
3346
  );
3287
3347
  })
3288
3348
  ] }, y.key))
3289
- ] }) : D === "archived" ? Q ? /* @__PURE__ */ e(
3290
- ka,
3349
+ ] }) : $ === "archived" ? J ? /* @__PURE__ */ e(
3350
+ Ca,
3291
3351
  {
3292
- room: Q.room,
3293
- label: Q.label,
3294
- onBack: () => te(null),
3352
+ room: J.room,
3353
+ label: J.label,
3354
+ onBack: () => re(null),
3295
3355
  renderMessageBody: o
3296
3356
  }
3297
3357
  ) : /* @__PURE__ */ e(
3298
- _a,
3358
+ Ua,
3299
3359
  {
3300
- rooms: me.rooms,
3301
- loading: me.loading,
3360
+ rooms: pe.rooms,
3361
+ loading: pe.loading,
3302
3362
  archivedView: !0,
3303
- onOpen: (y) => te({ room: y.room, label: y.label })
3363
+ onOpen: (y) => re({ room: y.room, label: y.label })
3304
3364
  }
3305
- ) : D === "browse" ? (
3365
+ ) : $ === "browse" ? (
3306
3366
  // The tab is checked BEFORE the open room: leaving it last meant
3307
3367
  // switching to Browse with a conversation open kept showing that
3308
3368
  // conversation (or its settings) under the Browse tab.
3309
3369
  /* @__PURE__ */ e(
3310
- vr,
3370
+ ks,
3311
3371
  {
3312
- onOpen: (y, R, j) => {
3313
- W(!1), T({ room: y, label: R, channel: j }), S("chat");
3372
+ onOpen: (y, M, P) => {
3373
+ z(!1), T({ room: y, label: M, channel: P }), S("chat");
3314
3374
  }
3315
3375
  }
3316
3376
  )
3317
- ) : P ? /* @__PURE__ */ e(
3318
- Nr,
3377
+ ) : I ? /* @__PURE__ */ e(
3378
+ _s,
3319
3379
  {
3320
- onClose: () => $(!1),
3321
- onCreated: (y, R) => {
3322
- $(!1), T({ room: y, label: R });
3380
+ onClose: () => R(!1),
3381
+ onCreated: (y, M) => {
3382
+ R(!1), T({ room: y, label: M });
3323
3383
  }
3324
3384
  }
3325
- ) : C && F && C.channel ? /* @__PURE__ */ e(
3326
- br,
3385
+ ) : C && H && C.channel ? /* @__PURE__ */ e(
3386
+ gs,
3327
3387
  {
3328
3388
  channel: C.channel,
3329
3389
  label: C.label,
3330
- onBack: () => W(!1)
3390
+ onBack: () => z(!1)
3331
3391
  }
3332
3392
  ) : C ? /* @__PURE__ */ e(
3333
- ka,
3393
+ Ca,
3334
3394
  {
3335
3395
  room: C.room,
3336
3396
  label: C.label,
3337
- onOpenSettings: C.channel && !C.channel.is_direct ? () => W(!0) : void 0,
3397
+ onOpenSettings: C.channel && !C.channel.is_direct ? () => z(!0) : void 0,
3338
3398
  onBack: () => T(null),
3339
3399
  renderMessageBody: o,
3340
3400
  initialUnread: C.unread,
3341
3401
  anchor: C.anchor ?? null
3342
3402
  }
3343
- ) : E === "mentions" ? /* @__PURE__ */ e(Pa, { th: c, onBack: () => k(null), onOpen: A }) : E === "scheduled" ? /* @__PURE__ */ e(
3344
- ja,
3403
+ ) : F === "mentions" ? /* @__PURE__ */ e(qa, { th: c, onBack: () => k(null), onOpen: A }) : F === "scheduled" ? /* @__PURE__ */ e(
3404
+ Ea,
3345
3405
  {
3346
3406
  th: c,
3347
3407
  onBack: () => k(null),
3348
3408
  roomLabel: (y) => {
3349
- var R;
3350
- return ((R = Z.find((j) => j.room === y)) == null ? void 0 : R.label) ?? y;
3409
+ var M;
3410
+ return ((M = X.find((P) => P.room === y)) == null ? void 0 : M.label) ?? y;
3351
3411
  }
3352
3412
  }
3353
- ) : E === "catchup" ? /* @__PURE__ */ e(
3354
- Ia,
3413
+ ) : F === "catchup" ? /* @__PURE__ */ e(
3414
+ Wa,
3355
3415
  {
3356
- rooms: Z,
3416
+ rooms: X,
3357
3417
  th: c,
3358
3418
  onBack: () => k(null),
3359
3419
  onOpen: A
3360
3420
  }
3361
3421
  ) : /* @__PURE__ */ e(
3362
- _a,
3422
+ Ua,
3363
3423
  {
3364
- rooms: Z,
3365
- onOpen: (y, R) => {
3366
- W(!1), T({
3424
+ rooms: X,
3425
+ onOpen: (y, M) => {
3426
+ z(!1), T({
3367
3427
  room: y.room,
3368
3428
  label: y.label,
3369
3429
  channel: y.channel,
3370
3430
  unread: y.unread,
3371
- anchor: R
3431
+ anchor: M
3372
3432
  });
3373
3433
  },
3374
- onNewGroup: () => $(!0),
3434
+ onNewGroup: () => R(!0),
3375
3435
  onView: k
3376
3436
  }
3377
3437
  )
@@ -3382,13 +3442,13 @@ body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${kt}px; }`, do
3382
3442
  ) : null;
3383
3443
  }
3384
3444
  export {
3385
- kr as ChatAppearAwayRow,
3386
- vr as ChatChannelBrowser,
3387
- br as ChatChannelSettings,
3388
- nl as ChatPanel,
3389
- tl as ChatProvider,
3390
- _a as ChatRoomList,
3391
- ka as ChatRoomView,
3392
- al as ChatSideView,
3393
- Cr as isChatPanelPinned
3445
+ Ns as ChatAppearAwayRow,
3446
+ ks as ChatChannelBrowser,
3447
+ gs as ChatChannelSettings,
3448
+ sl as ChatPanel,
3449
+ nl as ChatProvider,
3450
+ Ua as ChatRoomList,
3451
+ Ca as ChatRoomView,
3452
+ rl as ChatSideView,
3453
+ Ss as isChatPanelPinned
3394
3454
  };