@nivaro/react 0.3.75 → 0.3.76

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,56 +1,56 @@
1
1
  import { jsxs as a, jsx as e, Fragment as ke } from "react/jsx-runtime";
2
- import { useQuery as Te, useQueryClient as Pt, useMutation as We } from "@tanstack/react-query";
3
- import { Search as zn, Plus as za, Hash as $t, Lock as Ga, ChevronLeft as ut, X as pt, PinOff as Qa, Pin as Mt, Headphones as Ka, PlayCircle as Ja, MessageCircle as Gn, Users as At, AtSign as Ya, AlarmClock as Za, Sparkles as Va, BellOff as Dn, PencilLine as Xa, Star as es, ArchiveRestore as ts, Archive as ns, Bell as as, LogOut as ss, Info as rs, MapPin as Un, Check as It, ArrowUpDown as ls, MessageSquareReply as os, Quote as is, ClipboardPlus as cs, NotebookPen as ds, Bookmark as us, Pencil as ms, Trash2 as ps, AlertTriangle as hs, Paperclip as fs, Bot as xs, CheckCheck as bs, Plane as gs, FilePlus2 as vs } from "lucide-react";
4
- import { useState as T, useEffect as ae, useMemo as ve, useRef as de, useContext as ys } from "react";
2
+ import { useQuery as Ue, useQueryClient as qt, useMutation as Fe } from "@tanstack/react-query";
3
+ import { Search as Jn, Plus as za, Hash as Ot, Lock as Ga, ChevronLeft as ft, X as bt, PinOff as Qa, Pin as Lt, Headphones as Ka, PlayCircle as Ja, MessageCircle as Yn, Users as Pt, AtSign as Ya, AlarmClock as Za, Sparkles as Va, BellOff as An, PencilLine as Xa, Star as es, ArchiveRestore as ts, Archive as ns, Bell as as, LogOut as ss, Info as rs, MapPin as Rn, Check as Bt, ArrowUpDown as ls, MessageSquareReply as os, Quote as is, ClipboardPlus as cs, NotebookPen as ds, Bookmark as us, Pencil as ms, Trash2 as ps, AlertTriangle as hs, Paperclip as fs, Bot as xs, CheckCheck as bs, Plane as gs, FilePlus2 as vs } from "lucide-react";
4
+ import { useState as T, useEffect as ae, useMemo as ve, useRef as ue, useContext as ys } from "react";
5
5
  import { toast as ge } from "sonner";
6
- import { useItemEditAuth as ht, useNavigation as ks, useNivaroClient as Ze } from "../../context.js";
7
- import { get as ye, post as Fe, patch as ws } from "../../lib/commands.js";
6
+ import { useItemEditAuth as gt, useNavigation as ks, useNivaroClient as tt } from "../../context.js";
7
+ import { get as ye, post as He, patch as ws } from "../../lib/commands.js";
8
8
  import { useLiveRecord as Ns, batchTouches as Cs, LIVE_ASPECTS as _s } from "../../lib/live.js";
9
9
  import { usePresenceOnlinePoll as Ss } from "../../lib/presence-live.js";
10
- import { presencePlaceHref as $n, stuckText as Mn, fullHref as An } from "../../lib/presence-state.js";
10
+ import { presencePlaceHref as On, stuckText as Ln, fullHref as Pn } from "../../lib/presence-state.js";
11
11
  import { invalidateRecordTasks as Ts } from "../../lib/record-tasks.js";
12
- import { userErrorMessage as Qn } from "../../lib/safe-error.js";
13
- import { userCardQuery as Ds } from "../../lib/user-cards.js";
14
- import { cn as g, toLocalDateString as Us, getDisplayTimezone as jt, formatRelative as Kn } from "../../lib/utils.js";
12
+ import { userErrorMessage as Zn } from "../../lib/safe-error.js";
13
+ import { userCardQuery as Us } from "../../lib/user-cards.js";
14
+ import { cn as g, toLocalDateString as Ds, getDisplayTimezone as Wt, formatRelative as Vn } from "../../lib/utils.js";
15
15
  import { CustomStatusEditor as $s } from "../CustomStatusEditor.js";
16
16
  import { DoNotDisturbRow as Ms } from "../DoNotDisturb.js";
17
17
  import { useFileDownload as As } from "../item-edit/file-download.js";
18
- import { UserChip as Et } from "../item-edit/UserChip.js";
18
+ import { UserChip as Ft } from "../item-edit/UserChip.js";
19
19
  import { StaleBuildChip as Rs } from "../StaleBuildChip.js";
20
20
  import { UserAvatar as Os } from "../UserAvatar.js";
21
- import { Popover as Ve, PopoverTrigger as Xe, PopoverContent as et } from "../ui/popover.js";
22
- import { SimpleSelect as qt } from "../ui/SimpleSelect.js";
21
+ import { Popover as nt, PopoverTrigger as at, PopoverContent as st } from "../ui/popover.js";
22
+ import { SimpleSelect as Ht } from "../ui/SimpleSelect.js";
23
23
  import { useBotStream as Ls, BotStreamBubble as Ps } from "./BotStream.js";
24
24
  import { MembershipHistory as Is, ArchiveSuggestionBanner as js } from "./ChannelArchive.js";
25
25
  import { ChannelExtrasEditor as Es, BulkInvitePanel as qs, ChannelAuditLog as Bs } from "./ChannelExtras.js";
26
- import { ChannelTile as Ye, ChannelLookPicker as Jn } from "./ChannelLook.js";
27
- import { MentionsView as Yn, ScheduledView as Zn, CatchUpView as Vn, useSearchFilterState as Ws, FilterToggle as Fs, ChatSettingsButton as Hs, SearchFilterBar as zs } from "./ChatViews.js";
26
+ import { ChannelTile as et, ChannelLookPicker as Xn } from "./ChannelLook.js";
27
+ import { MentionsView as ea, ScheduledView as ta, CatchUpView as na, useSearchFilterState as Ws, FilterToggle as Fs, ChatSettingsButton as Hs, SearchFilterBar as zs } from "./ChatViews.js";
28
28
  import { ChatComposer as Gs } from "./Composer.js";
29
- import { useMyPreferences as Bt, useSetMyPreferences as Xn, useChatRoles as ea, useChannelDirectory as Qs, useRoomMembership as Wt, useCreateChannel as Ks, useChatConfig as Le, useChannelMembers as ta, useChannelAdmin as na, useUserSearch as Ft, GENERAL_CHANNEL_ID as aa, useChatRooms as sa, useArchivedRooms as ra, sortOnlineUsers as Js, dmRoom as Rt, CHAT_DEFAULTS as dt, ChatConfigContext as la, useChatBotInfo as Ht, useChatSearch as Ys, dmPeer as Se, useChatMessages as Zs, useOpenRoomRegistration as Vs, useMarkRoomRead as Xs, useTypingIndicator as er, usePeerReadAt as tr, useEntityRoomLink as nr, useToggleReaction as ar, useRoomPins as sr, useTogglePin as rr, useEditMessage as lr, useDeleteMessage as or, useChatBotName as ir, useChatThread as cr, useRecordBrowserTimezone as dr, chatInitials as ur, chatAvatarColor as mr, useCreateGroupDm as pr, canOpenDm as hr, openDmWith as fr, usePagedMembers as xr, chatRoomTypesQuery as oa, REACTION_EMOJI as br } from "./chat-core.js";
29
+ import { useMyPreferences as zt, useSetMyPreferences as aa, useChatRoles as sa, useChannelDirectory as Qs, useRoomMembership as Gt, useCreateChannel as Ks, useChatConfig as Le, useChannelMembers as ra, useChannelAdmin as la, useUserSearch as Qt, GENERAL_CHANNEL_ID as oa, useChatRooms as ia, useArchivedRooms as ca, sortOnlineUsers as Js, dmRoom as It, CHAT_DEFAULTS as ht, ChatConfigContext as da, useChatBotInfo as Kt, useChatSearch as Ys, dmPeer as Te, useChatMessages as Zs, useOpenRoomRegistration as Vs, useMarkRoomRead as Xs, useTypingIndicator as er, usePeerReadAt as tr, useEntityRoomLink as nr, useToggleReaction as ar, useRoomPins as sr, useTogglePin as rr, useEditMessage as lr, useDeleteMessage as or, useChatBotName as ir, useChatThread as cr, useRecordBrowserTimezone as dr, chatInitials as ur, chatAvatarColor as mr, useCreateGroupDm as pr, canOpenDm as hr, openDmWith as fr, usePagedMembers as xr, chatRoomTypesQuery as ua, REACTION_EMOJI as br } from "./chat-core.js";
30
30
  import { useDraftRooms as gr } from "./chat-drafts.js";
31
31
  import { useCustomEmoji as vr, EmojiButton as yr, EmojiGlyph as kr } from "./chat-emoji.js";
32
- import { useRoomRecord as ia, useRecordFileTargets as wr } from "./chat-hooks.js";
32
+ import { useRoomRecord as ma, useRecordFileTargets as wr } from "./chat-hooks.js";
33
33
  import { offHoursNote as Nr } from "./chat-local-time.js";
34
34
  import { useMessageWindow as Cr } from "./chat-window.js";
35
- import { HuddleFollowHost as Rn } from "./huddle/HuddleCollab.js";
35
+ import { HuddleFollowHost as In } from "./huddle/HuddleCollab.js";
36
36
  import { HuddleControls as _r } from "./huddle/HuddleControls.js";
37
37
  import { HuddleLiveBadge as Sr } from "./huddle/HuddleLiveBadge.js";
38
38
  import { HuddleScheduleCard as Tr } from "./huddle/HuddleScheduleCard.js";
39
- import { HuddleScheduleForm as Dr } from "./huddle/HuddleScheduleForm.js";
40
- import { HuddleStage as Ur } from "./huddle/HuddleStage.js";
39
+ import { HuddleScheduleForm as Ur } from "./huddle/HuddleScheduleForm.js";
40
+ import { HuddleStage as Dr } from "./huddle/HuddleStage.js";
41
41
  import { useHuddleLive as $r } from "./huddle/huddle-live.js";
42
- import { stripHuddleRef as On, huddleRefOf as Ln } from "./huddle/huddle-schedule.js";
42
+ import { stripHuddleRef as jn, huddleRefOf as En } from "./huddle/huddle-schedule.js";
43
43
  import { useHuddle as Mr } from "./huddle/useHuddle.js";
44
44
  import { MemberSearchBox as Ar, MemberOnlineDot as Rr, MemberLoadMore as Or } from "./MemberPaging.js";
45
45
  import { useMessageActions as Lr, MessageActionsMenu as Pr, actionsForMessage as Ir } from "./MessageActions.js";
46
46
  import { FormattedMessage as jr, LinkPreviews as Er } from "./MessageFormat.js";
47
47
  import { PollCard as qr } from "./PollCard.js";
48
- import { RoomStatusMarks as Br, headerIconIdle as Pn, headerIconButton as In, RoomHeaderMenu as Wr } from "./RoomHeaderMenu.js";
48
+ import { RoomStatusMarks as Br, headerIconIdle as qn, headerIconButton as Bn, RoomHeaderMenu as Wr } from "./RoomHeaderMenu.js";
49
49
  import { MemberCountLine as Fr, ChannelIntro as Hr, WelcomeNote as zr, ThreadPane as Gr, RoomInfoDrawer as Qr } from "./RoomParts.js";
50
50
  import { clipInfo as Kr, ClipPlayer as Jr } from "./ScreenClip.js";
51
- import { useOutbox as ca } from "./chat-outbox.js";
52
- import { OutboxBubbles as da } from "./OutboxBubbles.js";
53
- const ua = {
51
+ import { useOutbox as pa } from "./chat-outbox.js";
52
+ import { OutboxBubbles as ha } from "./OutboxBubbles.js";
53
+ const fa = {
54
54
  bubbleMine: "bg-nvr-cyan text-white",
55
55
  bubbleOther: "bg-slate-100 text-slate-800 dark:bg-muted dark:text-slate-100",
56
56
  accentText: "text-nvr-navy dark:text-nvr-cyan",
@@ -60,124 +60,124 @@ const ua = {
60
60
  surface: "bg-white dark:bg-card",
61
61
  input: "border-slate-200 bg-slate-50 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-slate-100",
62
62
  divider: "border-slate-100 dark:border-border/60"
63
- }, zt = {};
64
- zt.current = ua;
65
- function vo({
63
+ }, Jt = {};
64
+ Jt.current = fa;
65
+ function yo({
66
66
  children: n,
67
- me: s,
67
+ me: r,
68
68
  onlineUsers: l = [],
69
- collections: r,
70
- globalRoom: o = dt.globalRoom,
71
- globalLabel: i = dt.globalLabel,
72
- entityPattern: p = dt.entityPattern,
73
- entityUrl: d = () => null,
69
+ collections: s,
70
+ globalRoom: o = ht.globalRoom,
71
+ globalLabel: i = ht.globalLabel,
72
+ entityPattern: m = ht.entityPattern,
73
+ entityUrl: c = () => null,
74
74
  roomLabel: x,
75
75
  recordUrl: f,
76
- sessionUrl: u,
76
+ sessionUrl: d,
77
77
  realtime: b,
78
78
  subscribeRooms: y,
79
- setTypingRoom: D,
80
- navigate: A,
79
+ setTypingRoom: U,
80
+ navigate: M,
81
81
  sound: C = !0,
82
82
  theme: S
83
83
  }) {
84
- const B = ve(
84
+ const W = ve(
85
85
  () => ({
86
- collections: { ...dt.collections, ...r },
86
+ collections: { ...ht.collections, ...s },
87
87
  globalRoom: o,
88
88
  globalLabel: i,
89
- entityPattern: p,
90
- entityUrl: d,
89
+ entityPattern: m,
90
+ entityUrl: c,
91
91
  roomLabel: x,
92
92
  recordUrl: f,
93
- sessionUrl: u,
93
+ sessionUrl: d,
94
94
  realtime: b,
95
95
  subscribeRooms: y,
96
- me: s,
96
+ me: r,
97
97
  onlineUsers: l,
98
- setTypingRoom: D,
99
- navigate: A,
98
+ setTypingRoom: U,
99
+ navigate: M,
100
100
  sound: C
101
101
  }),
102
102
  // eslint-disable-next-line react-hooks/exhaustive-deps
103
103
  [
104
- s == null ? void 0 : s.id,
104
+ r == null ? void 0 : r.id,
105
105
  l,
106
- r,
106
+ s,
107
107
  o,
108
108
  i,
109
- p,
109
+ m,
110
110
  b,
111
- D,
111
+ U,
112
112
  C
113
113
  ]
114
114
  );
115
- return zt.current = { ...ua, ...S }, /* @__PURE__ */ e(la.Provider, { value: B, children: n });
115
+ return Jt.current = { ...fa, ...S }, /* @__PURE__ */ e(da.Provider, { value: W, children: n });
116
116
  }
117
- function ue() {
118
- return zt.current;
117
+ function me() {
118
+ return Jt.current;
119
119
  }
120
- const jn = /* @__PURE__ */ new WeakMap();
121
- function Yr(n, s) {
122
- const l = String(s).toUpperCase();
123
- let r = jn.get(n);
124
- r || (r = { ids: /* @__PURE__ */ new Map(), timer: null }, jn.set(n, r));
125
- const o = r;
120
+ const Wn = /* @__PURE__ */ new WeakMap();
121
+ function Yr(n, r) {
122
+ const l = String(r).toUpperCase();
123
+ let s = Wn.get(n);
124
+ s || (s = { ids: /* @__PURE__ */ new Map(), timer: null }, Wn.set(n, s));
125
+ const o = s;
126
126
  return new Promise((i) => {
127
- const p = o.ids.get(l) ?? [];
128
- p.push(i), o.ids.set(l, p), !o.timer && (o.timer = setTimeout(async () => {
129
- const d = new Map(o.ids);
127
+ const m = o.ids.get(l) ?? [];
128
+ m.push(i), o.ids.set(l, m), !o.timer && (o.timer = setTimeout(async () => {
129
+ const c = new Map(o.ids);
130
130
  o.ids.clear(), o.timer = null;
131
- const x = [...d.keys()], f = /* @__PURE__ */ new Map();
132
- for (let u = 0; u < x.length; u += 100)
131
+ const x = [...c.keys()], f = /* @__PURE__ */ new Map();
132
+ for (let d = 0; d < x.length; d += 100)
133
133
  try {
134
134
  const b = await n.request(
135
- ye("/presence/people", { ids: x.slice(u, u + 100).join(",") })
135
+ ye("/presence/people", { ids: x.slice(d, d + 100).join(",") })
136
136
  );
137
137
  for (const y of b.data ?? []) f.set(String(y.user_id).toUpperCase(), y);
138
138
  } catch {
139
139
  }
140
- for (const [u, b] of d) for (const y of b) y(f.get(u) ?? null);
140
+ for (const [d, b] of c) for (const y of b) y(f.get(d) ?? null);
141
141
  }, 0));
142
142
  });
143
143
  }
144
- function Gt(n, s = !0) {
145
- const l = Ze(), { data: r } = Te({
144
+ function Yt(n, r = !0) {
145
+ const l = tt(), { data: s } = Ue({
146
146
  queryKey: ["nvr-person-info", n ? String(n).toUpperCase() : null],
147
147
  queryFn: () => Yr(l, n),
148
- enabled: !!n && s,
148
+ enabled: !!n && r,
149
149
  staleTime: 6e4
150
150
  });
151
- return r ?? null;
151
+ return s ?? null;
152
152
  }
153
- function ma(n) {
154
- return n != null && n.last_seen ? `last seen ${Kn(n.last_seen)}` : null;
153
+ function xa(n) {
154
+ return n != null && n.last_seen ? `last seen ${Vn(n.last_seen)}` : null;
155
155
  }
156
- function pa(n) {
157
- const s = ys(la), l = ba(), r = String(n).toUpperCase();
156
+ function ba(n) {
157
+ const r = ys(da), l = ka(), s = String(n).toUpperCase();
158
158
  if (l.loaded) {
159
- const i = l.byUser.get(r);
159
+ const i = l.byUser.get(s);
160
160
  if (!i) return { state: "offline", title: "Offline", page: null };
161
- const p = i.page ?? ga(i.current_path);
162
- return i.away ? { state: "away", title: "Away", page: null } : i.is_idle ? { state: "idle", title: Ot(i), page: p } : { state: "online", title: "Online", page: p };
161
+ const m = i.page ?? wa(i.current_path);
162
+ return i.away ? { state: "away", title: "Away", page: null } : i.is_idle ? { state: "idle", title: jt(i), page: m } : { state: "online", title: "Online", page: m };
163
163
  }
164
- const o = s == null ? void 0 : s.onlineUsers.find((i) => String(i.user_id).toUpperCase() === r);
165
- return o ? o.is_idle ? { state: "idle", title: Ot(o), page: null } : { state: "online", title: "Online", page: null } : { state: "offline", title: "Offline", page: null };
164
+ const o = r == null ? void 0 : r.onlineUsers.find((i) => String(i.user_id).toUpperCase() === s);
165
+ return o ? o.is_idle ? { state: "idle", title: jt(o), page: null } : { state: "online", title: "Online", page: null } : { state: "offline", title: "Offline", page: null };
166
166
  }
167
- function ha(n) {
167
+ function ga(n) {
168
168
  return n != null && n.out_of_office ? n.ooo_end ? `Out of office until ${new Date(n.ooo_end).toLocaleDateString(void 0, {
169
169
  weekday: "short",
170
170
  month: "short",
171
171
  day: "numeric",
172
- timeZone: jt() ?? void 0
172
+ timeZone: Wt() ?? void 0
173
173
  })}` : "Out of office" : null;
174
174
  }
175
- function Zr({ id: n, size: s }) {
176
- const { state: l, title: r, page: o } = pa(n), i = Gt(n), p = l === "offline" ? ma(i) : null, d = ha(i), x = s >= 30 ? 10 : 8, f = [
177
- p ? `Offline · ${p}` : r,
175
+ function Zr({ id: n, size: r }) {
176
+ const { state: l, title: s, page: o } = ba(n), i = Yt(n), m = l === "offline" ? xa(i) : null, c = ga(i), x = r >= 30 ? 10 : 8, f = [
177
+ m ? `Offline · ${m}` : s,
178
178
  o && l !== "offline" ? `On ${o}` : null,
179
- d,
180
- d && (i != null && i.delegate) ? `${i.delegate.name} is covering` : null
179
+ c,
180
+ c && (i != null && i.delegate) ? `${i.delegate.name} is covering` : null
181
181
  ].filter(Boolean).join(" · ");
182
182
  return /* @__PURE__ */ a(ke, { children: [
183
183
  /* @__PURE__ */ e(
@@ -193,7 +193,7 @@ function Zr({ id: n, size: s }) {
193
193
  "data-chat-presence": l
194
194
  }
195
195
  ),
196
- d && // Out of office is its own mark, top-right, so it reads beside any of
196
+ c && // Out of office is its own mark, top-right, so it reads beside any of
197
197
  // the four presence states rather than replacing one.
198
198
  /* @__PURE__ */ e(
199
199
  "span",
@@ -202,19 +202,19 @@ function Zr({ id: n, size: s }) {
202
202
  style: { width: x + 2, height: x + 2 },
203
203
  "data-chat-ooo": !0,
204
204
  title: f,
205
- "aria-label": d,
205
+ "aria-label": c,
206
206
  children: /* @__PURE__ */ e(gs, { style: { width: x - 3, height: x - 3 }, strokeWidth: 2.5 })
207
207
  }
208
208
  )
209
209
  ] });
210
210
  }
211
- function Q({
211
+ function K({
212
212
  id: n,
213
- name: s,
213
+ name: r,
214
214
  size: l = 32,
215
- presence: r = !0
215
+ presence: s = !0
216
216
  }) {
217
- const o = Ht(), i = /* @__PURE__ */ e(
217
+ const o = Kt(), i = /* @__PURE__ */ e(
218
218
  "span",
219
219
  {
220
220
  className: "flex shrink-0 items-center justify-center rounded-full font-semibold text-[#04263b]",
@@ -225,55 +225,55 @@ function Q({
225
225
  fontSize: l * 0.36
226
226
  },
227
227
  "aria-hidden": !0,
228
- children: ur(s)
228
+ children: ur(r)
229
229
  }
230
- ), p = /* @__PURE__ */ e(
230
+ ), m = /* @__PURE__ */ e(
231
231
  Os,
232
232
  {
233
233
  userId: n,
234
234
  fallback: i,
235
235
  style: { width: l, height: l },
236
- alt: s ?? ""
236
+ alt: r ?? ""
237
237
  }
238
- ), d = n === "__bot__" || !!o.bot_user_id && String(o.bot_user_id).toUpperCase() === String(n).toUpperCase();
239
- return !r || d ? p : /* @__PURE__ */ a("span", { className: "relative inline-flex shrink-0", style: { width: l, height: l }, children: [
240
- p,
238
+ ), c = n === "__bot__" || !!o.bot_user_id && String(o.bot_user_id).toUpperCase() === String(n).toUpperCase();
239
+ return !s || c ? m : /* @__PURE__ */ a("span", { className: "relative inline-flex shrink-0", style: { width: l, height: l }, children: [
240
+ m,
241
241
  /* @__PURE__ */ e(Zr, { id: n, size: l })
242
242
  ] });
243
243
  }
244
- function Vr({ peerId: n, name: s }) {
245
- const l = Ht(), r = n === "__bot__" || !!l.bot_user_id && String(l.bot_user_id).toUpperCase() === n.toUpperCase(), o = /* @__PURE__ */ e(Q, { id: n, name: s, size: 28 });
246
- return r ? /* @__PURE__ */ e("span", { className: "mr-1 inline-flex shrink-0", children: o }) : /* @__PURE__ */ e(Et, { userId: n, children: /* @__PURE__ */ e(
244
+ function Vr({ peerId: n, name: r }) {
245
+ const l = Kt(), s = n === "__bot__" || !!l.bot_user_id && String(l.bot_user_id).toUpperCase() === n.toUpperCase(), o = /* @__PURE__ */ e(K, { id: n, name: r, size: 28 });
246
+ return s ? /* @__PURE__ */ e("span", { className: "mr-1 inline-flex shrink-0", children: o }) : /* @__PURE__ */ e(Ft, { userId: n, children: /* @__PURE__ */ e(
247
247
  "button",
248
248
  {
249
249
  type: "button",
250
250
  className: "mr-1 shrink-0 rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
251
- "aria-label": `${s} — profile`,
251
+ "aria-label": `${r} — profile`,
252
252
  "data-chat-dm-header-avatar": !0,
253
253
  children: o
254
254
  }
255
255
  ) });
256
256
  }
257
- function En({ token: n, url: s, mine: l }) {
258
- const r = Le(), o = ue(), i = Ze(), { data: p } = Te(oa(i)), { data: d } = Te({
257
+ function Fn({ token: n, url: r, mine: l }) {
258
+ const s = Le(), o = me(), i = tt(), { data: m } = Ue(ua(i)), { data: c } = Ue({
259
259
  queryKey: ["nvr-chat-entity-card", n],
260
260
  queryFn: async () => {
261
- var u, b, y, D;
262
- for (const A of p ?? [])
261
+ var d, b, y, U;
262
+ for (const M of m ?? [])
263
263
  try {
264
- const S = (b = (u = (await i.request(
265
- ye(`/items/${A.collection}`, {
264
+ const S = (b = (d = (await i.request(
265
+ ye(`/items/${M.collection}`, {
266
266
  limit: 1,
267
267
  fields: "id",
268
- filter: JSON.stringify({ [A.match_field]: { _eq: n } })
268
+ filter: JSON.stringify({ [M.match_field]: { _eq: n } })
269
269
  })
270
- )).data) == null ? void 0 : u[0]) == null ? void 0 : b.id;
270
+ )).data) == null ? void 0 : d[0]) == null ? void 0 : b.id;
271
271
  if (S == null) continue;
272
- const $ = (D = (y = (await i.request(
273
- ye(`/pipelines/instance/${A.collection}/${S}`)
274
- )).data) == null ? void 0 : y.instance) == null ? void 0 : D.current_state_obj;
272
+ const $ = (U = (y = (await i.request(
273
+ ye(`/pipelines/instance/${M.collection}/${S}`)
274
+ )).data) == null ? void 0 : y.instance) == null ? void 0 : U.current_state_obj;
275
275
  return {
276
- collection: A.collection,
276
+ collection: M.collection,
277
277
  id: S,
278
278
  state: ($ == null ? void 0 : $.label) ?? null,
279
279
  color: ($ == null ? void 0 : $.color) ?? null
@@ -282,14 +282,14 @@ function En({ token: n, url: s, mine: l }) {
282
282
  }
283
283
  return null;
284
284
  },
285
- enabled: ((p == null ? void 0 : p.length) ?? 0) > 0,
285
+ enabled: ((m == null ? void 0 : m.length) ?? 0) > 0,
286
286
  staleTime: 10 * 6e4
287
- }), x = Pt();
287
+ }), x = qt();
288
288
  return Ns(
289
- d == null ? void 0 : d.collection,
290
- d == null ? void 0 : d.id,
291
- (u) => {
292
- Cs(u, _s.state) && x.invalidateQueries({ queryKey: ["nvr-chat-entity-card", n] });
289
+ c == null ? void 0 : c.collection,
290
+ c == null ? void 0 : c.id,
291
+ (d) => {
292
+ Cs(d, _s.state) && x.invalidateQueries({ queryKey: ["nvr-chat-entity-card", n] });
293
293
  },
294
294
  { includeOwn: !0, debounceMs: 400 }
295
295
  ), /* @__PURE__ */ a(
@@ -297,15 +297,15 @@ function En({ token: n, url: s, mine: l }) {
297
297
  {
298
298
  type: "button",
299
299
  onClick: () => {
300
- var u, b;
301
- if (d) {
302
- const D = (r.recordUrl ?? ((A, C) => `/collections/${A}/${C}`))(d.collection, d.id);
303
- if (D) {
304
- (u = r.navigate) == null || u.call(r, D);
300
+ var d, b;
301
+ if (c) {
302
+ const U = (s.recordUrl ?? ((M, C) => `/collections/${M}/${C}`))(c.collection, c.id);
303
+ if (U) {
304
+ (d = s.navigate) == null || d.call(s, U);
305
305
  return;
306
306
  }
307
307
  }
308
- s && ((b = r.navigate) == null || b.call(r, s));
308
+ r && ((b = s.navigate) == null || b.call(s, r));
309
309
  },
310
310
  className: g(
311
311
  "inline-flex max-w-full items-center gap-1 align-baseline font-medium underline-offset-2 hover:underline",
@@ -314,15 +314,15 @@ function En({ token: n, url: s, mine: l }) {
314
314
  "data-chat-entity": n,
315
315
  children: [
316
316
  n,
317
- (d == null ? void 0 : d.state) && /* @__PURE__ */ e(
317
+ (c == null ? void 0 : c.state) && /* @__PURE__ */ e(
318
318
  "span",
319
319
  {
320
320
  className: "inline-flex items-center rounded-full px-1.5 py-px text-[9px] font-semibold leading-tight",
321
321
  style: {
322
- backgroundColor: d.color ? `${d.color}26` : "rgba(100,116,139,.15)",
323
- color: l ? void 0 : d.color ?? void 0
322
+ backgroundColor: c.color ? `${c.color}26` : "rgba(100,116,139,.15)",
323
+ color: l ? void 0 : c.color ?? void 0
324
324
  },
325
- children: d.state
325
+ children: c.state
326
326
  }
327
327
  )
328
328
  ]
@@ -330,11 +330,11 @@ function En({ token: n, url: s, mine: l }) {
330
330
  );
331
331
  }
332
332
  function Xr(n) {
333
- const s = new Date(n), l = /* @__PURE__ */ new Date(), r = new Date(l);
334
- return r.setDate(l.getDate() - 1), s.toDateString() === l.toDateString() ? "Today" : s.toDateString() === r.toDateString() ? "Yesterday" : s.toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" });
333
+ const r = new Date(n), l = /* @__PURE__ */ new Date(), s = new Date(l);
334
+ return s.setDate(l.getDate() - 1), r.toDateString() === l.toDateString() ? "Today" : r.toDateString() === s.toDateString() ? "Yesterday" : r.toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" });
335
335
  }
336
336
  function el({ botName: n }) {
337
- const s = ue(), l = [
337
+ const r = me(), l = [
338
338
  {
339
339
  k: "@name",
340
340
  kind: "code",
@@ -375,59 +375,59 @@ function el({ botName: n }) {
375
375
  ];
376
376
  return /* @__PURE__ */ a("div", { "data-chat-tips": !0, children: [
377
377
  /* @__PURE__ */ e("p", { className: "border-b border-slate-100 px-4 py-2.5 text-[12.5px] font-semibold text-slate-800 dark:border-border/60 dark:text-slate-100", children: "Things this chat can do" }),
378
- /* @__PURE__ */ e("div", { className: "grid grid-cols-[122px_1fr] gap-x-3 gap-y-0 px-4 py-1.5", children: l.map((r) => /* @__PURE__ */ a(
378
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-[122px_1fr] gap-x-3 gap-y-0 px-4 py-1.5", children: l.map((s) => /* @__PURE__ */ a(
379
379
  "div",
380
380
  {
381
381
  className: "col-span-2 grid grid-cols-subgrid border-b border-slate-100/70 py-2 last:border-b-0 dark:border-border/40",
382
382
  children: [
383
- r.kind === "code" ? /* @__PURE__ */ e(
383
+ s.kind === "code" ? /* @__PURE__ */ e(
384
384
  "code",
385
385
  {
386
386
  className: g(
387
387
  "h-fit w-fit self-start whitespace-nowrap rounded px-1.5 py-0.5 text-[10.5px] font-semibold",
388
- s.accentSoft
388
+ r.accentSoft
389
389
  ),
390
- children: r.k
390
+ children: s.k
391
391
  }
392
- ) : /* @__PURE__ */ e("span", { className: "self-start pt-0.5 text-[11px] font-semibold leading-snug text-slate-700 dark:text-slate-200", children: r.k }),
393
- /* @__PURE__ */ e("span", { className: "text-[11.5px] leading-relaxed text-slate-600 dark:text-slate-300", children: r.v })
392
+ ) : /* @__PURE__ */ e("span", { className: "self-start pt-0.5 text-[11px] font-semibold leading-snug text-slate-700 dark:text-slate-200", children: s.k }),
393
+ /* @__PURE__ */ e("span", { className: "text-[11.5px] leading-relaxed text-slate-600 dark:text-slate-300", children: s.v })
394
394
  ]
395
395
  },
396
- r.k
396
+ s.k
397
397
  )) })
398
398
  ] });
399
399
  }
400
400
  function tl({ room: n }) {
401
- const s = Le(), l = ue(), r = Ze(), o = n.indexOf(":"), i = o > 0 ? n.slice(0, o) : null, p = o > 0 ? n.slice(o + 1) : null, d = !!i && !!p && n !== s.globalRoom && i !== "dm" && i !== "ch", x = Pt(), { data: f } = Te({
401
+ const r = Le(), l = me(), s = tt(), o = n.indexOf(":"), i = o > 0 ? n.slice(0, o) : null, m = o > 0 ? n.slice(o + 1) : null, c = !!i && !!m && n !== r.globalRoom && i !== "dm" && i !== "ch", x = qt(), { data: f } = Ue({
402
402
  queryKey: ["nvr-chat-room-card", n],
403
403
  queryFn: async () => {
404
- var J, G, F, R;
405
- const S = (await x.fetchQuery(oa(r))).find((K) => K.is_active && K.prefix === i);
404
+ var Y, G, H, R;
405
+ const S = (await x.fetchQuery(ua(s))).find((J) => J.is_active && J.prefix === i);
406
406
  if (!S) return null;
407
- const $ = (G = (J = (await r.request(
407
+ const $ = (G = (Y = (await s.request(
408
408
  ye(`/items/${S.collection}`, {
409
409
  limit: 1,
410
410
  fields: "id",
411
- filter: JSON.stringify({ [S.match_field]: { _eq: p } })
411
+ filter: JSON.stringify({ [S.match_field]: { _eq: m } })
412
412
  })
413
- )).data) == null ? void 0 : J[0]) == null ? void 0 : G.id;
413
+ )).data) == null ? void 0 : Y[0]) == null ? void 0 : G.id;
414
414
  if ($ == null) return null;
415
- const E = (R = (F = (await r.request(
415
+ const q = (R = (H = (await s.request(
416
416
  ye(`/pipelines/instance/${S.collection}/${$}`)
417
- )).data) == null ? void 0 : F.instance) == null ? void 0 : R.current_state_obj;
417
+ )).data) == null ? void 0 : H.instance) == null ? void 0 : R.current_state_obj;
418
418
  return {
419
419
  collection: S.collection,
420
420
  type_label: S.label ?? S.collection.replace(/_/g, " "),
421
421
  id: $,
422
- state: (E == null ? void 0 : E.label) ?? null,
423
- color: (E == null ? void 0 : E.color) ?? null
422
+ state: (q == null ? void 0 : q.label) ?? null,
423
+ color: (q == null ? void 0 : q.color) ?? null
424
424
  };
425
425
  },
426
- enabled: d,
426
+ enabled: c,
427
427
  staleTime: 6e4
428
- }), u = ia(n, d && !!f);
429
- if (!d || !f) return null;
430
- const y = (s.recordUrl ?? ((C, S) => `/collections/${C}/${S}`))(f.collection, f.id), D = (u == null ? void 0 : u.sla) ?? null, A = (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";
428
+ }), d = ma(n, c && !!f);
429
+ if (!c || !f) return null;
430
+ const y = (r.recordUrl ?? ((C, S) => `/collections/${C}/${S}`))(f.collection, f.id), U = (d == null ? void 0 : d.sla) ?? null, M = (U == null ? void 0 : U.status) === "breached" ? "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300" : (U == null ? void 0 : U.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";
431
431
  return /* @__PURE__ */ a(
432
432
  "div",
433
433
  {
@@ -435,7 +435,7 @@ function tl({ room: n }) {
435
435
  "data-chat-room-card": !0,
436
436
  children: [
437
437
  /* @__PURE__ */ e("span", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: f.type_label }),
438
- /* @__PURE__ */ e("span", { className: "truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: p }),
438
+ /* @__PURE__ */ e("span", { className: "truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: m }),
439
439
  f.state && /* @__PURE__ */ e(
440
440
  "span",
441
441
  {
@@ -447,26 +447,26 @@ function tl({ room: n }) {
447
447
  children: f.state
448
448
  }
449
449
  ),
450
- D && /* @__PURE__ */ e(
450
+ U && /* @__PURE__ */ e(
451
451
  "span",
452
452
  {
453
- className: g("rounded-full px-1.5 py-0.5 text-[10px] font-semibold", A),
454
- title: D.due_hours != null ? `${Math.round(D.elapsed_hours ?? 0)}h in this state of ${D.due_hours}h allowed` : void 0,
455
- "data-chat-room-sla": D.status,
456
- children: D.status === "breached" ? "Past SLA" : D.status === "warning" ? "SLA soon" : "On time"
453
+ className: g("rounded-full px-1.5 py-0.5 text-[10px] font-semibold", M),
454
+ title: U.due_hours != null ? `${Math.round(U.elapsed_hours ?? 0)}h in this state of ${U.due_hours}h allowed` : void 0,
455
+ "data-chat-room-sla": U.status,
456
+ children: U.status === "breached" ? "Past SLA" : U.status === "warning" ? "SLA soon" : "On time"
457
457
  }
458
458
  ),
459
- u && u.owners.length > 0 && /* @__PURE__ */ a(
459
+ d && d.owners.length > 0 && /* @__PURE__ */ a(
460
460
  "span",
461
461
  {
462
462
  className: "ml-auto flex -space-x-1.5",
463
- title: `Owners: ${u.owners.map((C) => C.name).join(", ")}`,
464
- "data-chat-room-owners": u.owners.length,
463
+ title: `Owners: ${d.owners.map((C) => C.name).join(", ")}`,
464
+ "data-chat-room-owners": d.owners.length,
465
465
  children: [
466
- u.owners.slice(0, 4).map((C) => /* @__PURE__ */ e(Q, { id: C.id, name: C.name, size: 18, presence: !1 }, C.id)),
467
- u.owners.length > 4 && /* @__PURE__ */ a("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: [
466
+ d.owners.slice(0, 4).map((C) => /* @__PURE__ */ e(K, { id: C.id, name: C.name, size: 18, presence: !1 }, C.id)),
467
+ d.owners.length > 4 && /* @__PURE__ */ a("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: [
468
468
  "+",
469
- u.owners.length - 4
469
+ d.owners.length - 4
470
470
  ] })
471
471
  ]
472
472
  }
@@ -477,11 +477,11 @@ function tl({ room: n }) {
477
477
  type: "button",
478
478
  onClick: () => {
479
479
  var C;
480
- return (C = s.navigate) == null ? void 0 : C.call(s, y);
480
+ return (C = r.navigate) == null ? void 0 : C.call(r, y);
481
481
  },
482
482
  className: g(
483
483
  "text-[11px] font-medium hover:underline",
484
- u != null && u.owners.length ? "ml-1.5" : "ml-auto",
484
+ d != null && d.owners.length ? "ml-1.5" : "ml-auto",
485
485
  l.accentText
486
486
  ),
487
487
  children: "Open"
@@ -491,48 +491,48 @@ function tl({ room: n }) {
491
491
  }
492
492
  );
493
493
  }
494
- function nl(n, s) {
494
+ function nl(n, r) {
495
495
  if (!n) return null;
496
- const l = jt() ?? Intl.DateTimeFormat().resolvedOptions().timeZone, r = /* @__PURE__ */ new Date();
496
+ const l = Wt() ?? Intl.DateTimeFormat().resolvedOptions().timeZone, s = /* @__PURE__ */ new Date();
497
497
  let o, i;
498
498
  try {
499
- const d = (x) => new Intl.DateTimeFormat("en-US", { timeZone: x, hour: "numeric", minute: "2-digit" }).format(
500
- r
499
+ const c = (x) => new Intl.DateTimeFormat("en-US", { timeZone: x, hour: "numeric", minute: "2-digit" }).format(
500
+ s
501
501
  );
502
- o = d(n), i = d(l);
502
+ o = c(n), i = c(l);
503
503
  } catch {
504
504
  return null;
505
505
  }
506
506
  if (o === i) return null;
507
- const p = s.split(/\s+/)[0] || s;
508
- return `${o} for ${p}`;
507
+ const m = r.split(/\s+/)[0] || r;
508
+ return `${o} for ${m}`;
509
509
  }
510
- function fa() {
511
- const [n, s] = T(0);
510
+ function va() {
511
+ const [n, r] = T(0);
512
512
  return ae(() => {
513
- const l = setInterval(() => s((r) => r + 1), 6e4);
513
+ const l = setInterval(() => r((s) => s + 1), 6e4);
514
514
  return () => clearInterval(l);
515
515
  }, []), n;
516
516
  }
517
- function al({ peerId: n, name: s }) {
518
- fa();
519
- const { state: l, title: r } = pa(n), o = Gt(n), i = l === "online" ? "Active now" : l === "offline" ? (() => {
520
- const f = ma(o);
517
+ function al({ peerId: n, name: r }) {
518
+ va();
519
+ const { state: l, title: s } = ba(n), o = Yt(n), i = l === "online" ? "Active now" : l === "offline" ? (() => {
520
+ const f = xa(o);
521
521
  return f ? f.charAt(0).toUpperCase() + f.slice(1) : "Offline";
522
- })() : r, p = nl((o == null ? void 0 : o.timezone) ?? null, s), d = ha(o), x = d ? (o == null ? void 0 : o.delegate) ?? null : null;
522
+ })() : s, m = nl((o == null ? void 0 : o.timezone) ?? null, r), c = ga(o), x = c ? (o == null ? void 0 : o.delegate) ?? null : null;
523
523
  return /* @__PURE__ */ a(
524
524
  "p",
525
525
  {
526
526
  className: "flex min-w-0 items-center gap-1.5 truncate text-[11px] text-slate-500 dark:text-slate-400",
527
527
  "data-chat-dm-peer-line": l,
528
528
  children: [
529
- d && /* @__PURE__ */ a(ke, { children: [
529
+ c && /* @__PURE__ */ a(ke, { children: [
530
530
  /* @__PURE__ */ e(
531
531
  "span",
532
532
  {
533
533
  className: "shrink-0 font-medium text-violet-700 dark:text-violet-300",
534
534
  "data-chat-dm-ooo": !0,
535
- children: d
535
+ children: c
536
536
  }
537
537
  ),
538
538
  x && hr() && /* @__PURE__ */ a(
@@ -552,85 +552,85 @@ function al({ peerId: n, name: s }) {
552
552
  /* @__PURE__ */ e("span", { "aria-hidden": !0, children: "·" })
553
553
  ] }),
554
554
  /* @__PURE__ */ e("span", { className: "truncate", children: i }),
555
- p && /* @__PURE__ */ a(ke, { children: [
555
+ m && /* @__PURE__ */ a(ke, { children: [
556
556
  /* @__PURE__ */ e("span", { "aria-hidden": !0, children: "·" }),
557
- /* @__PURE__ */ e("span", { className: "shrink-0", "data-chat-dm-local-time": !0, title: (o == null ? void 0 : o.timezone) ?? void 0, children: p })
557
+ /* @__PURE__ */ e("span", { className: "shrink-0", "data-chat-dm-local-time": !0, title: (o == null ? void 0 : o.timezone) ?? void 0, children: m })
558
558
  ] })
559
559
  ]
560
560
  }
561
561
  );
562
562
  }
563
- function qn({
563
+ function Hn({
564
564
  room: n,
565
- label: s,
565
+ label: r,
566
566
  onBack: l,
567
- onOpenSettings: r,
567
+ onOpenSettings: s,
568
568
  renderMessageBody: o,
569
569
  initialUnread: i,
570
- anchor: p = null,
571
- openThread: d = null
570
+ anchor: m = null,
571
+ openThread: c = null
572
572
  }) {
573
- var fn, xn, bn, gn, vn, yn, kn, wn, Nn, Cn;
574
- const x = Le(), f = ue(), u = Ze(), b = x.me, y = Mr(n), D = b ? Se(n, b.id) : null, A = !s.trim() || s.toLowerCase() === n.toLowerCase() || /^dm:/i.test(s), { data: C } = Te({
575
- ...Ds(u, D),
576
- enabled: !!D && A,
573
+ var vn, yn, kn, wn, Nn, Cn, _n, Sn, Tn, Un;
574
+ const x = Le(), f = me(), d = tt(), b = x.me, y = Mr(n), U = b ? Te(n, b.id) : null, M = !r.trim() || r.toLowerCase() === n.toLowerCase() || /^dm:/i.test(r), { data: C } = Ue({
575
+ ...Us(d, U),
576
+ enabled: !!U && M,
577
577
  staleTime: 12e4
578
- }), S = A && D ? [C == null ? void 0 : C.first_name, C == null ? void 0 : C.last_name].filter(Boolean).join(" ") || (C == null ? void 0 : C.email) || "Direct message" : s, [B, $] = T(p);
579
- ae(() => $(p), [p]);
580
- const { messages: v, loading: E, hasOlder: J, hasNewer: G, loadOlder: F, loadingOlder: R } = Zs(
578
+ }), S = M && U ? [C == null ? void 0 : C.first_name, C == null ? void 0 : C.last_name].filter(Boolean).join(" ") || (C == null ? void 0 : C.email) || "Direct message" : r, [W, $] = T(m);
579
+ ae(() => $(m), [m]);
580
+ const { messages: v, loading: q, hasOlder: Y, hasNewer: G, loadOlder: H, loadingOlder: R } = Zs(
581
581
  n,
582
- B
582
+ W
583
583
  );
584
584
  Vs(n);
585
- const K = ca(n), ee = Xs(), Y = er(n), te = tr(n.startsWith("dm:") ? n : null), oe = nr(n), se = ar(n), me = sr(n), c = rr(n), L = !n.startsWith("dm:") && !n.startsWith("ch:") && n !== x.globalRoom && n.includes(":"), m = ia(n, L), Z = wr(n, !!m), De = n.startsWith("ch:"), { data: he = [] } = Te({
585
+ const J = pa(n), V = Xs(), Z = er(n), X = tr(n.startsWith("dm:") ? n : null), oe = nr(n), se = ar(n), pe = sr(n), p = rr(n), E = !n.startsWith("dm:") && !n.startsWith("ch:") && n !== x.globalRoom && n.includes(":"), u = ma(n, E), P = wr(n, !!u), Ce = n.startsWith("ch:"), { data: we = [] } = Ue({
586
586
  queryKey: ["chat-read-marks", n],
587
- queryFn: () => u.request(
587
+ queryFn: () => d.request(
588
588
  ye(`/chat/rooms/${encodeURIComponent(n)}/read-marks`)
589
589
  ).then((t) => t.data ?? []).catch(() => []),
590
- enabled: De,
591
- refetchInterval: De ? 3e4 : !1,
590
+ enabled: Ce,
591
+ refetchInterval: Ce ? 3e4 : !1,
592
592
  staleTime: 15e3
593
- }), Pe = (t) => he.filter(
593
+ }), Pe = (t) => we.filter(
594
594
  (h) => h.user !== String(t.sender ?? "") && new Date(h.last_read_at).getTime() >= new Date(t.date_created).getTime()
595
- ), Ne = Pt(), { data: Ue = [] } = Te({
595
+ ), _e = qt(), { data: Ae = [] } = Ue({
596
596
  queryKey: ["chat-saved"],
597
- queryFn: () => u.request(ye("/chat/saved")).then((t) => t.data ?? []).catch(() => []),
597
+ queryFn: () => d.request(ye("/chat/saved")).then((t) => t.data ?? []).catch(() => []),
598
598
  staleTime: 6e4
599
- }), Ce = ve(() => new Set(Ue.map((t) => t.id)), [Ue]), k = We({
600
- mutationFn: (t) => u.request(Fe(`/chat/messages/${t}/save`, {})),
601
- onSuccess: () => void Ne.invalidateQueries({ queryKey: ["chat-saved"] })
602
- }), [M, P] = T(null), V = We({
603
- mutationFn: () => u.request(
604
- Fe("/chat/rooms/summary", { room: n })
599
+ }), ie = ve(() => new Set(Ae.map((t) => t.id)), [Ae]), ze = Fe({
600
+ mutationFn: (t) => d.request(He(`/chat/messages/${t}/save`, {})),
601
+ onSuccess: () => void _e.invalidateQueries({ queryKey: ["chat-saved"] })
602
+ }), [Ge, Qe] = T(null), Ie = Fe({
603
+ mutationFn: () => d.request(
604
+ He("/chat/rooms/summary", { room: n })
605
605
  ).then((t) => t.data),
606
- onSuccess: (t) => P((t == null ? void 0 : t.summary) ?? "Not enough new messages to summarize."),
607
- onError: () => P("Summary unavailable.")
608
- }), $e = We({
606
+ onSuccess: (t) => Qe((t == null ? void 0 : t.summary) ?? "Not enough new messages to summarize."),
607
+ onError: () => Qe("Summary unavailable.")
608
+ }), k = Fe({
609
609
  mutationFn: async (t) => {
610
- if (!m || !b) throw new Error("no record");
611
- await u.request(
612
- Fe("/tasks", {
613
- collection: m.collection,
614
- item: String(m.id),
610
+ if (!u || !b) throw new Error("no record");
611
+ await d.request(
612
+ He("/tasks", {
613
+ collection: u.collection,
614
+ item: String(u.id),
615
615
  title: t.message.replace(/<[^>]*>/g, "").slice(0, 200),
616
616
  assignee: b.id
617
617
  })
618
618
  );
619
619
  },
620
620
  onSuccess: () => {
621
- m && Ts(Ne, m.collection, m.id), ge.success("Task created from message — assigned to you");
621
+ u && Ts(_e, u.collection, u.id), ge.success("Task created from message — assigned to you");
622
622
  },
623
623
  onError: () => ge.error("Could not create a task")
624
- }), _ = We({
625
- mutationFn: (t) => u.request(Fe(`/chat/messages/${t.id}/to-notes`, {})),
626
- onSuccess: () => ge.success(`Copied to the Notes of ${(m == null ? void 0 : m.label) ?? "the record"}`),
624
+ }), A = Fe({
625
+ mutationFn: (t) => d.request(He(`/chat/messages/${t.id}/to-notes`, {})),
626
+ onSuccess: () => ge.success(`Copied to the Notes of ${(u == null ? void 0 : u.label) ?? "the record"}`),
627
627
  onError: (t) => {
628
628
  var h;
629
629
  return ge.error(((h = t == null ? void 0 : t.response) == null ? void 0 : h.error) ?? "Could not copy it");
630
630
  }
631
- }), I = We({
632
- mutationFn: (t) => u.request(
633
- Fe(`/chat/messages/${t.messageId}/attach-to-record`, {
631
+ }), I = Fe({
632
+ mutationFn: (t) => d.request(
633
+ He(`/chat/messages/${t.messageId}/attach-to-record`, {
634
634
  file_id: t.fileId,
635
635
  field: t.field
636
636
  })
@@ -638,7 +638,7 @@ function qn({
638
638
  onSuccess: (t, h) => {
639
639
  var N;
640
640
  return ge.success(
641
- `Attached to ${(m == null ? void 0 : m.label) ?? "the record"} — ${((N = Z.find((W) => W.field === h.field)) == null ? void 0 : N.label) ?? h.field}`
641
+ `Attached to ${(u == null ? void 0 : u.label) ?? "the record"} — ${((N = P.find((F) => F.field === h.field)) == null ? void 0 : N.label) ?? h.field}`
642
642
  );
643
643
  },
644
644
  onError: (t) => {
@@ -647,130 +647,130 @@ function qn({
647
647
  ((h = t == null ? void 0 : t.response) == null ? void 0 : h.error) ?? "Could not attach it"
648
648
  );
649
649
  }
650
- }), j = We({
651
- mutationFn: (t) => u.request(ws(`/chat/messages/${t}`, { no_preview: !0 })),
652
- onSuccess: () => void Ne.invalidateQueries({ queryKey: ["nvr-chat", n] })
653
- }), ie = lr(n), ne = or(n), { isAdmin: X } = ht(), { setMuted: H, setNotifyMode: re, setArchived: fe, setStarred: va, dismissWelcome: ya, leave: ka } = Wt(), { rooms: wa, loading: Na } = sa(), Qt = wa.find((t) => t.room === n) ?? null, { rooms: Ca } = ra(!Na && !Qt), w = Qt ?? Ca.find((t) => t.room === n) ?? null, _a = xa(w), Kt = w != null && w.muted ? "muted" : (w == null ? void 0 : w.notify_mode) === "mentions" ? "mentions" : "all", pe = ir(), [tt, Sa] = T(!1), [nt, Jt] = T(""), [Ta, ft] = T(null), [Yt, Zt] = T(""), [Da, xt] = T(null), Ua = Lr(n), [$a, Vt] = T(null), Ma = As(), [Xt, Ie] = T(null), en = cr(d ? n : null, d), tn = !!en.root && !en.root.deleted_at;
650
+ }), te = Fe({
651
+ mutationFn: (t) => d.request(ws(`/chat/messages/${t}`, { no_preview: !0 })),
652
+ onSuccess: () => void _e.invalidateQueries({ queryKey: ["nvr-chat", n] })
653
+ }), De = lr(n), _ = or(n), { isAdmin: L } = gt(), { setMuted: j, setNotifyMode: ce, setArchived: ee, setStarred: ne, dismissWelcome: Q, leave: re } = Gt(), { rooms: fe, loading: Na } = ia(), Zt = fe.find((t) => t.room === n) ?? null, { rooms: Ca } = ca(!Na && !Zt), w = Zt ?? Ca.find((t) => t.room === n) ?? null, _a = ya(w), Vt = w != null && w.muted ? "muted" : (w == null ? void 0 : w.notify_mode) === "mentions" ? "mentions" : "all", he = ir(), [rt, Sa] = T(!1), [lt, Xt] = T(""), [Ta, vt] = T(null), [en, tn] = T(""), [Ua, yt] = T(null), Da = Lr(n), [$a, nn] = T(null), Ma = As(), [an, je] = T(null), sn = cr(c ? n : null, c), rn = !!sn.root && !sn.root.deleted_at;
654
654
  ae(() => {
655
- d && tn && Ie(d);
656
- }, [d, tn]);
657
- const [Aa, nn] = T(null), [Ra, an] = T(null), [bt, He] = T(!1), [Oa, gt] = T(!1), [ce, ze] = T(null), [Ge, at] = T(
658
- p && "around" in p ? p.around : null
659
- ), [st, vt] = T(null), Qe = Ls(n, (b == null ? void 0 : b.id) ?? null), sn = de(null), yt = de(null), kt = de(Math.max(0, i ?? 0)), Me = de(!1), Re = de(null), rn = de(null), le = de(!p), Ke = de(0), Je = de(null), wt = de(0), rt = () => {
655
+ c && rn && je(c);
656
+ }, [c, rn]);
657
+ const [Aa, ln] = T(null), [Ra, on] = T(null), [kt, Ke] = T(!1), [Oa, wt] = T(!1), [de, Je] = T(null), [Ye, ot] = T(
658
+ m && "around" in m ? m.around : null
659
+ ), [it, Nt] = T(null), Ze = Ls(n, (b == null ? void 0 : b.id) ?? null), cn = ue(null), Ct = ue(null), _t = ue(Math.max(0, i ?? 0)), $e = ue(!1), Re = ue(null), dn = ue(null), le = ue(!m), Ve = ue(0), Xe = ue(null), St = ue(0), ct = () => {
660
660
  const t = Re.current;
661
661
  t && (t.scrollTop = t.scrollHeight);
662
- }, Nt = (t) => {
662
+ }, Tt = (t) => {
663
663
  var N;
664
664
  const h = (N = Re.current) == null ? void 0 : N.querySelector(`[data-chat-msg="${t}"]`);
665
- return h ? (h.scrollIntoView({ block: "center" }), le.current = !1, at(t), !0) : we.reveal(t) ? (le.current = !1, at(t), !0) : !1;
666
- }, ln = (t) => {
667
- He(!1), Nt(t) || (Me.current = !1, le.current = !1, at(t), $({ around: t }));
665
+ return h ? (h.scrollIntoView({ block: "center" }), le.current = !1, ot(t), !0) : Ne.reveal(t) ? (le.current = !1, ot(t), !0) : !1;
666
+ }, un = (t) => {
667
+ Ke(!1), Tt(t) || ($e.current = !1, le.current = !1, ot(t), $({ around: t }));
668
668
  };
669
669
  ae(() => {
670
- if (Ge == null) return;
671
- const t = setTimeout(() => at(null), 2400);
670
+ if (Ye == null) return;
671
+ const t = setTimeout(() => ot(null), 2400);
672
672
  return () => clearTimeout(t);
673
- }, [Ge]), ae(() => {
674
- Me.current = !1, Ke.current = 0, ze(null);
675
- }, [n, B]), ae(() => {
676
- var Oe, qe;
673
+ }, [Ye]), ae(() => {
674
+ $e.current = !1, Ve.current = 0, Je(null);
675
+ }, [n, W]), ae(() => {
676
+ var Oe, Be;
677
677
  const t = Re.current, h = ((Oe = v[0]) == null ? void 0 : Oe.id) ?? null;
678
- if (!Me.current && v.length > 0) {
679
- if (Me.current = !0, Ke.current = v.length, Je.current = h, Ge != null && Nt(Ge)) return;
680
- yt.current && !B ? (yt.current.scrollIntoView({ block: "center" }), le.current = !1) : B || (rt(), le.current = !0);
678
+ if (!$e.current && v.length > 0) {
679
+ if ($e.current = !0, Ve.current = v.length, Xe.current = h, Ye != null && Tt(Ye)) return;
680
+ Ct.current && !W ? (Ct.current.scrollIntoView({ block: "center" }), le.current = !1) : W || (ct(), le.current = !0);
681
681
  return;
682
682
  }
683
- if (h !== Je.current && Je.current != null && t) {
684
- Je.current = h, Ke.current = v.length;
683
+ if (h !== Xe.current && Xe.current != null && t) {
684
+ Xe.current = h, Ve.current = v.length;
685
685
  return;
686
686
  }
687
- Je.current = h;
688
- const N = v.length - Ke.current;
689
- if (Ke.current = v.length, N <= 0) return;
690
- const W = v[v.length - 1], z = !!(W != null && W.sender) && W.sender.toLowerCase() === ((qe = b == null ? void 0 : b.id) == null ? void 0 : qe.toLowerCase());
687
+ Xe.current = h;
688
+ const N = v.length - Ve.current;
689
+ if (Ve.current = v.length, N <= 0) return;
690
+ const F = v[v.length - 1], z = !!(F != null && F.sender) && F.sender.toLowerCase() === ((Be = b == null ? void 0 : b.id) == null ? void 0 : Be.toLowerCase());
691
691
  if (le.current || z)
692
- rt(), le.current = !0, ze(null);
692
+ ct(), le.current = !0, Je(null);
693
693
  else {
694
- const Ae = v[v.length - N];
695
- ze((be) => ({ count: ((be == null ? void 0 : be.count) ?? 0) + N, firstId: (be == null ? void 0 : be.firstId) ?? Ae.id }));
694
+ const Me = v[v.length - N];
695
+ Je((be) => ({ count: ((be == null ? void 0 : be.count) ?? 0) + N, firstId: (be == null ? void 0 : be.firstId) ?? Me.id }));
696
696
  }
697
697
  }, [v]), ae(() => {
698
- const t = rn.current;
698
+ const t = dn.current;
699
699
  if (!t || typeof ResizeObserver > "u") return;
700
700
  const h = new ResizeObserver(() => {
701
701
  var N;
702
- le.current && rt(), wt.current = ((N = Re.current) == null ? void 0 : N.scrollHeight) ?? 0;
702
+ le.current && ct(), St.current = ((N = Re.current) == null ? void 0 : N.scrollHeight) ?? 0;
703
703
  });
704
704
  return h.observe(t), () => h.disconnect();
705
705
  }, []), ae(() => {
706
- var N, W;
706
+ var N, F;
707
707
  const t = v[v.length - 1];
708
- if (!t || !Me.current || ((N = t.sender) == null ? void 0 : N.toLowerCase()) === ((W = b == null ? void 0 : b.id) == null ? void 0 : W.toLowerCase()))
708
+ if (!t || !$e.current || ((N = t.sender) == null ? void 0 : N.toLowerCase()) === ((F = b == null ? void 0 : b.id) == null ? void 0 : F.toLowerCase()))
709
709
  return;
710
710
  const h = Date.now() - new Date(t.date_created).getTime();
711
- h > 0 && h < 5 * 6e4 && Math.random() < 0.2 && u.request(Fe("/chat/health/delivery", { ms: h })).catch(() => {
711
+ h > 0 && h < 5 * 6e4 && Math.random() < 0.2 && d.request(He("/chat/health/delivery", { ms: h })).catch(() => {
712
712
  });
713
- }, [(fn = v[v.length - 1]) == null ? void 0 : fn.id]), ae(() => {
714
- if (!st || !pe) return;
713
+ }, [(vn = v[v.length - 1]) == null ? void 0 : vn.id]), ae(() => {
714
+ if (!it || !he) return;
715
715
  if (v.some(
716
- (N) => (N.sender_name ?? "").toLowerCase() === pe.toLowerCase() && new Date(N.date_created).getTime() >= st - 5e3
716
+ (N) => (N.sender_name ?? "").toLowerCase() === he.toLowerCase() && new Date(N.date_created).getTime() >= it - 5e3
717
717
  )) {
718
- vt(null);
718
+ Nt(null);
719
719
  return;
720
720
  }
721
- const h = setTimeout(() => vt(null), 9e4);
721
+ const h = setTimeout(() => Nt(null), 9e4);
722
722
  return () => clearTimeout(h);
723
- }, [st, pe, v]);
724
- const lt = ve(() => {
723
+ }, [it, he, v]);
724
+ const dt = ve(() => {
725
725
  const t = /* @__PURE__ */ new Set();
726
726
  for (const h of v) for (const N of h.attachments ?? []) t.add(N);
727
727
  return [...t];
728
- }, [v]), { data: Ct } = Te({
729
- queryKey: ["nvr-chat-attachments", lt.slice().sort().join("|")],
728
+ }, [v]), { data: Ut } = Ue({
729
+ queryKey: ["nvr-chat-attachments", dt.slice().sort().join("|")],
730
730
  queryFn: async () => {
731
- const t = await u.request(
731
+ const t = await d.request(
732
732
  ye("/files", {
733
- filter: JSON.stringify({ id: { _in: lt } }),
734
- limit: String(lt.length),
733
+ filter: JSON.stringify({ id: { _in: dt } }),
734
+ limit: String(dt.length),
735
735
  fields: "id,filename_download,title,type,filesize,tags"
736
736
  })
737
737
  );
738
738
  return new Map((t.data ?? []).map((h) => [h.id, h]));
739
739
  },
740
- enabled: lt.length > 0,
740
+ enabled: dt.length > 0,
741
741
  staleTime: 5 * 6e4
742
742
  });
743
743
  ae(() => {
744
- B || ee.mutate(n);
745
- }, [n, v.length, B]);
744
+ W || V.mutate(n);
745
+ }, [n, v.length, W]);
746
746
  const La = (t) => {
747
- if (le.current = !0, B && $(null), pe) {
748
- const h = pe.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
749
- new RegExp(`@\\[?${h}\\]?\\b`, "i").test(t) && vt(Date.now());
747
+ if (le.current = !0, W && $(null), he) {
748
+ const h = he.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
749
+ new RegExp(`@\\[?${h}\\]?\\b`, "i").test(t) && Nt(Date.now());
750
750
  }
751
- }, je = (xn = b == null ? void 0 : b.id) == null ? void 0 : xn.toLowerCase(), xe = tt && nt.trim().length > 0, _e = ve(
752
- () => xe ? v.filter((t) => t.message.toLowerCase().includes(nt.trim().toLowerCase())) : v,
753
- [v, xe, nt]
751
+ }, Ee = (yn = b == null ? void 0 : b.id) == null ? void 0 : yn.toLowerCase(), xe = rt && lt.trim().length > 0, Se = ve(
752
+ () => xe ? v.filter((t) => t.message.toLowerCase().includes(lt.trim().toLowerCase())) : v,
753
+ [v, xe, lt]
754
754
  ), Pa = ve(() => {
755
755
  var t;
756
756
  if (xe) return -1;
757
- for (let h = _e.length - 1; h >= 0; h--)
758
- if (((t = _e[h].sender) == null ? void 0 : t.toLowerCase()) === je) return h;
757
+ for (let h = Se.length - 1; h >= 0; h--)
758
+ if (((t = Se[h].sender) == null ? void 0 : t.toLowerCase()) === Ee) return h;
759
759
  return -1;
760
- }, [_e, je, xe]), on = te ? new Date(te).getTime() : 0, Ee = Bt().chat_density === "compact" ? "compact" : "comfortable", cn = de(null), Ia = ve(() => _e.map((t) => t.id), [_e]), we = Cr({
760
+ }, [Se, Ee, xe]), mn = X ? new Date(X).getTime() : 0, qe = zt().chat_density === "compact" ? "compact" : "comfortable", pn = ue(null), Ia = ve(() => Se.map((t) => t.id), [Se]), Ne = Cr({
761
761
  scrollerRef: Re,
762
- listRef: cn,
762
+ listRef: pn,
763
763
  ids: Ia,
764
- estimate: Ee === "compact" ? 40 : 72,
765
- resetKey: `${n}|${JSON.stringify(B)}|${xe ? "search" : ""}`,
764
+ estimate: qe === "compact" ? 40 : 72,
765
+ resetKey: `${n}|${JSON.stringify(W)}|${xe ? "search" : ""}`,
766
766
  pinnedRef: le
767
- }), q = (w == null ? void 0 : w.channel) ?? null, dn = !!q && !!b && String(q.created_by ?? "").toUpperCase() === b.id.toUpperCase(), un = q != null && q.announce && !dn && !X ? q.id === aa ? "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, mn = b ? Se(n, b.id) : null, ja = Gt(mn);
768
- fa();
769
- const Ea = mn ? Nr(ja, S, /* @__PURE__ */ new Date()) : null;
767
+ }), B = (w == null ? void 0 : w.channel) ?? null, hn = !!B && !!b && String(B.created_by ?? "").toUpperCase() === b.id.toUpperCase(), fn = B != null && B.announce && !hn && !L ? B.id === oa ? "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, xn = b ? Te(n, b.id) : null, ja = Yt(xn);
768
+ va();
769
+ const Ea = xn ? Nr(ja, S, /* @__PURE__ */ new Date()) : null;
770
770
  dr(), vr();
771
- const qa = !!(q != null && q.welcome_note) && !!(w != null && w.joined) && !(w != null && w.welcome_seen_at) && !q.is_direct, Ba = (t, h) => t.entity ? /* @__PURE__ */ e(En, { token: t.text, url: x.entityUrl(t.entity) }, h) : t.mention ? /* @__PURE__ */ e("span", { className: g("rounded px-0.5 font-semibold", f.accentSoft), children: t.text }, h) : /* @__PURE__ */ e("span", { children: t.text }, h), Wa = (t, h) => t.entity ? /* @__PURE__ */ e(En, { token: t.text, url: x.entityUrl(t.entity), mine: !0 }, h) : t.mention ? /* @__PURE__ */ e("span", { className: "rounded bg-black/15 px-0.5 font-semibold", children: t.text }, h) : /* @__PURE__ */ e("span", { children: t.text }, h), pn = (t, h = {}) => {
772
- var _n, Sn;
773
- const N = ((_n = t.sender) == null ? void 0 : _n.toLowerCase()) === je;
771
+ const qa = !!(B != null && B.welcome_note) && !!(w != null && w.joined) && !(w != null && w.welcome_seen_at) && !B.is_direct, Ba = (t, h) => t.entity ? /* @__PURE__ */ e(Fn, { token: t.text, url: x.entityUrl(t.entity) }, h) : t.mention ? /* @__PURE__ */ e("span", { className: g("rounded px-0.5 font-semibold", f.accentSoft), children: t.text }, h) : /* @__PURE__ */ e("span", { children: t.text }, h), Wa = (t, h) => t.entity ? /* @__PURE__ */ e(Fn, { token: t.text, url: x.entityUrl(t.entity), mine: !0 }, h) : t.mention ? /* @__PURE__ */ e("span", { className: "rounded bg-black/15 px-0.5 font-semibold", children: t.text }, h) : /* @__PURE__ */ e("span", { children: t.text }, h), bn = (t, h = {}) => {
772
+ var Dn, $n;
773
+ const N = ((Dn = t.sender) == null ? void 0 : Dn.toLowerCase()) === Ee;
774
774
  if (t.is_system)
775
775
  return /* @__PURE__ */ e(
776
776
  "div",
@@ -787,30 +787,30 @@ function qn({
787
787
  ] })
788
788
  }
789
789
  );
790
- const W = h.isLastMine && on > 0 && new Date(t.date_created).getTime() <= on, z = !!t.deleted_at, Oe = N && !z && Date.now() - new Date(t.date_created).getTime() < 15 * 6e4, qe = !z && (N || X), Ae = Ta === t.id, be = /* @__PURE__ */ new Map();
791
- for (const U of t.reactions ?? []) {
792
- const O = be.get(U.emoji) ?? { count: 0, mine: !1, names: [] };
793
- O.count++, ((Sn = U.user) == null ? void 0 : Sn.toLowerCase()) === je && (O.mine = !0), U.user_name && O.names.push(U.user_name), be.set(U.emoji, O);
790
+ const F = h.isLastMine && mn > 0 && new Date(t.date_created).getTime() <= mn, z = !!t.deleted_at, Oe = N && !z && Date.now() - new Date(t.date_created).getTime() < 15 * 6e4, Be = !z && (N || L), Me = Ta === t.id, be = /* @__PURE__ */ new Map();
791
+ for (const D of t.reactions ?? []) {
792
+ const O = be.get(D.emoji) ?? { count: 0, mine: !1, names: [] };
793
+ O.count++, (($n = D.user) == null ? void 0 : $n.toLowerCase()) === Ee && (O.mine = !0), D.user_name && O.names.push(D.user_name), be.set(D.emoji, O);
794
794
  }
795
- const Be = "rounded-full p-0.5 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200";
795
+ const We = "rounded-full p-0.5 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200";
796
796
  return /* @__PURE__ */ a(
797
797
  "div",
798
798
  {
799
799
  className: g(
800
800
  "group/msg flex gap-2 rounded-lg transition-colors",
801
801
  N && "flex-row-reverse",
802
- Ge === t.id && "bg-nvr-cyan/[0.12]"
802
+ Ye === t.id && "bg-nvr-cyan/[0.12]"
803
803
  ),
804
804
  "data-chat-msg": t.id,
805
805
  children: [
806
- !N && /* @__PURE__ */ e(Et, { userId: t.sender, children: /* @__PURE__ */ e(
806
+ !N && /* @__PURE__ */ e(Ft, { userId: t.sender, children: /* @__PURE__ */ e(
807
807
  "button",
808
808
  {
809
809
  type: "button",
810
810
  className: "h-fit shrink-0 rounded-full",
811
811
  "aria-label": `${t.sender_name ?? "Sender"} — profile`,
812
812
  "data-chat-avatar-card": !0,
813
- children: /* @__PURE__ */ e(Q, { id: t.sender, name: t.sender_name, size: Ee === "compact" ? 22 : 26 })
813
+ children: /* @__PURE__ */ e(K, { id: t.sender, name: t.sender_name, size: qe === "compact" ? 22 : 26 })
814
814
  }
815
815
  ) }),
816
816
  /* @__PURE__ */ a("div", { className: g("relative max-w-[78%]", N && "text-right"), children: [
@@ -829,7 +829,7 @@ function qn({
829
829
  }
830
830
  )
831
831
  ] }),
832
- !z && !Ae && /* @__PURE__ */ a(
832
+ !z && !Me && /* @__PURE__ */ a(
833
833
  "div",
834
834
  {
835
835
  className: g(
@@ -841,24 +841,24 @@ function qn({
841
841
  ),
842
842
  "data-chat-msg-actions": !0,
843
843
  children: [
844
- br.map((U) => /* @__PURE__ */ e(
844
+ br.map((D) => /* @__PURE__ */ e(
845
845
  "button",
846
846
  {
847
847
  type: "button",
848
- onClick: () => se.mutate({ messageId: t.id, emoji: U }),
848
+ onClick: () => se.mutate({ messageId: t.id, emoji: D }),
849
849
  className: "rounded-full px-0.5 text-[13px] leading-none transition-transform hover:scale-125",
850
- title: `React ${U}`,
851
- children: U
850
+ title: `React ${D}`,
851
+ children: D
852
852
  },
853
- U
853
+ D
854
854
  )),
855
855
  /* @__PURE__ */ e(
856
856
  yr,
857
857
  {
858
858
  label: "More reactions",
859
- className: Be,
860
- onPick: (U) => se.mutate({ messageId: t.id, emoji: U }),
861
- onOpenChange: (U) => Vt(U ? t.id : null)
859
+ className: We,
860
+ onPick: (D) => se.mutate({ messageId: t.id, emoji: D }),
861
+ onOpenChange: (D) => nn(D ? t.id : null)
862
862
  }
863
863
  ),
864
864
  !h.inThread && !t.parent_id && /* @__PURE__ */ e(
@@ -867,9 +867,9 @@ function qn({
867
867
  type: "button",
868
868
  title: "Reply in thread",
869
869
  onClick: () => {
870
- He(!1), Ie(t.id);
870
+ Ke(!1), je(t.id);
871
871
  },
872
- className: Be,
872
+ className: We,
873
873
  "data-chat-reply-thread": !0,
874
874
  children: /* @__PURE__ */ e(os, { className: "h-3 w-3" })
875
875
  }
@@ -879,20 +879,20 @@ function qn({
879
879
  {
880
880
  type: "button",
881
881
  title: "Quote",
882
- onClick: () => h.inThread ? an(t) : nn(t),
883
- className: Be,
882
+ onClick: () => h.inThread ? on(t) : ln(t),
883
+ className: We,
884
884
  "data-chat-quote": !0,
885
885
  children: /* @__PURE__ */ e(is, { className: "h-3 w-3" })
886
886
  }
887
887
  ),
888
- m && /* @__PURE__ */ a(ke, { children: [
888
+ u && /* @__PURE__ */ a(ke, { children: [
889
889
  /* @__PURE__ */ e(
890
890
  "button",
891
891
  {
892
892
  type: "button",
893
893
  title: "Make a task from this message",
894
- onClick: () => $e.mutate(t),
895
- className: Be,
894
+ onClick: () => k.mutate(t),
895
+ className: We,
896
896
  children: /* @__PURE__ */ e(cs, { className: "h-3 w-3" })
897
897
  }
898
898
  ),
@@ -900,9 +900,9 @@ function qn({
900
900
  "button",
901
901
  {
902
902
  type: "button",
903
- title: `Copy into the Notes of ${m.label}`,
904
- onClick: () => _.mutate(t),
905
- className: Be,
903
+ title: `Copy into the Notes of ${u.label}`,
904
+ onClick: () => A.mutate(t),
905
+ className: We,
906
906
  "data-chat-to-notes": !0,
907
907
  children: /* @__PURE__ */ e(ds, { className: "h-3 w-3" })
908
908
  }
@@ -912,24 +912,24 @@ function qn({
912
912
  "button",
913
913
  {
914
914
  type: "button",
915
- title: me.some((U) => U.id === t.id) ? "Unpin" : "Pin",
916
- onClick: () => c.mutate(t.id),
915
+ title: pe.some((D) => D.id === t.id) ? "Unpin" : "Pin",
916
+ onClick: () => p.mutate(t.id),
917
917
  className: g(
918
918
  "rounded-full p-0.5",
919
- me.some((U) => U.id === t.id) ? f.accentText : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200"
919
+ pe.some((D) => D.id === t.id) ? f.accentText : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200"
920
920
  ),
921
- children: /* @__PURE__ */ e(Mt, { className: "h-3 w-3" })
921
+ children: /* @__PURE__ */ e(Lt, { className: "h-3 w-3" })
922
922
  }
923
923
  ),
924
924
  /* @__PURE__ */ e(
925
925
  "button",
926
926
  {
927
927
  type: "button",
928
- title: Ce.has(t.id) ? "Remove from saved" : "Save for later (personal bookmark)",
929
- onClick: () => k.mutate(t.id),
928
+ title: ie.has(t.id) ? "Remove from saved" : "Save for later (personal bookmark)",
929
+ onClick: () => ze.mutate(t.id),
930
930
  className: g(
931
931
  "rounded-full p-0.5",
932
- Ce.has(t.id) ? f.accentText : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200"
932
+ ie.has(t.id) ? f.accentText : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200"
933
933
  ),
934
934
  children: /* @__PURE__ */ e(us, { className: "h-3 w-3" })
935
935
  }
@@ -940,19 +940,19 @@ function qn({
940
940
  type: "button",
941
941
  title: "Edit",
942
942
  onClick: () => {
943
- ft(t.id), Zt(t.message), xt(null);
943
+ vt(t.id), tn(t.message), yt(null);
944
944
  },
945
- className: Be,
945
+ className: We,
946
946
  children: /* @__PURE__ */ e(ms, { className: "h-3 w-3" })
947
947
  }
948
948
  ),
949
- qe && (Da === t.id ? /* @__PURE__ */ e(
949
+ Be && (Ua === t.id ? /* @__PURE__ */ e(
950
950
  "button",
951
951
  {
952
952
  type: "button",
953
953
  title: "Confirm delete",
954
954
  onClick: () => {
955
- ne.mutate(t.id), xt(null);
955
+ _.mutate(t.id), yt(null);
956
956
  },
957
957
  className: "rounded-full px-1 text-[10px] font-semibold text-red-500",
958
958
  children: "Sure?"
@@ -962,7 +962,7 @@ function qn({
962
962
  {
963
963
  type: "button",
964
964
  title: N ? "Delete" : "Delete (admin)",
965
- onClick: () => xt(t.id),
965
+ onClick: () => yt(t.id),
966
966
  className: "rounded-full p-0.5 text-slate-400 hover:text-red-500",
967
967
  children: /* @__PURE__ */ e(ps, { className: "h-3 w-3" })
968
968
  }
@@ -971,9 +971,9 @@ function qn({
971
971
  Pr,
972
972
  {
973
973
  messageId: t.id,
974
- actions: Ir(Ua, t, je),
974
+ actions: Ir(Da, t, Ee),
975
975
  navigate: x.navigate,
976
- onOpenChange: (U) => Vt(U ? t.id : null)
976
+ onOpenChange: (D) => nn(D ? t.id : null)
977
977
  }
978
978
  )
979
979
  ]
@@ -993,24 +993,24 @@ function qn({
993
993
  ]
994
994
  }
995
995
  ),
996
- z ? /* @__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" }) : Ae ? /* @__PURE__ */ a(
996
+ z ? /* @__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" }) : Me ? /* @__PURE__ */ a(
997
997
  "form",
998
998
  {
999
999
  className: "flex items-center gap-1",
1000
- onSubmit: (U) => {
1001
- U.preventDefault();
1002
- const O = Yt.trim();
1003
- O && O !== t.message && ie.mutate({ messageId: t.id, text: O }), ft(null);
1000
+ onSubmit: (D) => {
1001
+ D.preventDefault();
1002
+ const O = en.trim();
1003
+ O && O !== t.message && De.mutate({ messageId: t.id, text: O }), vt(null);
1004
1004
  },
1005
1005
  children: [
1006
1006
  /* @__PURE__ */ e(
1007
1007
  "input",
1008
1008
  {
1009
1009
  autoFocus: !0,
1010
- value: Yt,
1011
- onChange: (U) => Zt(U.target.value),
1012
- onKeyDown: (U) => {
1013
- U.key === "Escape" && ft(null);
1010
+ value: en,
1011
+ onChange: (D) => tn(D.target.value),
1012
+ onKeyDown: (D) => {
1013
+ D.key === "Escape" && vt(null);
1014
1014
  },
1015
1015
  className: g(
1016
1016
  "h-8 w-[240px] rounded-lg border px-2 text-[12px] outline-none",
@@ -1034,7 +1034,7 @@ function qn({
1034
1034
  {
1035
1035
  className: g(
1036
1036
  "inline-block max-w-full rounded-2xl text-left leading-snug",
1037
- Ee === "compact" ? "px-2.5 py-1 text-[12px]" : "px-3 py-1.5 text-[12.5px]",
1037
+ qe === "compact" ? "px-2.5 py-1 text-[12px]" : "px-3 py-1.5 text-[12.5px]",
1038
1038
  N ? g("rounded-br-md", f.bubbleMine) : g("rounded-bl-md", f.bubbleOther),
1039
1039
  t.urgent && "ring-2 ring-red-400/70"
1040
1040
  ),
@@ -1043,7 +1043,7 @@ function qn({
1043
1043
  "button",
1044
1044
  {
1045
1045
  type: "button",
1046
- onClick: () => ln(t.quote.id),
1046
+ onClick: () => un(t.quote.id),
1047
1047
  className: g(
1048
1048
  "mb-1 block w-full rounded-md border-l-2 px-2 py-1 text-left text-[11px]",
1049
1049
  N ? "border-white/60 bg-black/10" : "border-slate-400 bg-white/70 dark:border-slate-500 dark:bg-black/20"
@@ -1055,10 +1055,10 @@ function qn({
1055
1055
  ]
1056
1056
  }
1057
1057
  ),
1058
- t.message && On(t.message) && (o ? o(t, { mine: N }) : /* @__PURE__ */ e(
1058
+ t.message && jn(t.message) && (o ? o(t, { mine: N }) : /* @__PURE__ */ e(
1059
1059
  jr,
1060
1060
  {
1061
- text: On(t.message),
1061
+ text: jn(t.message),
1062
1062
  mine: N,
1063
1063
  renderToken: N ? Wa : Ba,
1064
1064
  entityPattern: x.entityPattern,
@@ -1066,62 +1066,62 @@ function qn({
1066
1066
  navigate: x.navigate
1067
1067
  }
1068
1068
  )),
1069
- Ln(t.message) != null && /* @__PURE__ */ e(
1069
+ En(t.message) != null && /* @__PURE__ */ e(
1070
1070
  Tr,
1071
1071
  {
1072
- id: Ln(t.message),
1072
+ id: En(t.message),
1073
1073
  mine: N,
1074
- renderAvatar: (U, O) => /* @__PURE__ */ e(Q, { id: U, name: O, size: 18, presence: !1 })
1074
+ renderAvatar: (D, O) => /* @__PURE__ */ e(K, { id: D, name: O, size: 18, presence: !1 })
1075
1075
  }
1076
1076
  ),
1077
1077
  t.poll && /* @__PURE__ */ e(qr, { poll: t.poll, room: t.room, mine: N }),
1078
- (t.attachments ?? []).length > 0 && /* @__PURE__ */ e("div", { className: g("flex flex-wrap gap-1.5", t.message && "mt-1.5"), children: (t.attachments ?? []).map((U) => {
1079
- const O = Ct == null ? void 0 : Ct.get(U), ot = (O == null ? void 0 : O.title) || (O == null ? void 0 : O.filename_download) || "Attachment", _t = u.fileUrl(U), Fa = ((O == null ? void 0 : O.type) ?? "").startsWith("image/"), it = Kr(O == null ? void 0 : O.tags, O == null ? void 0 : O.type), St = `${_t}?download=1`, Tt = (O == null ? void 0 : O.filename_download) || ot, Tn = Ma(St, Tt), ct = m && Z.length > 0 ? /* @__PURE__ */ e(
1078
+ (t.attachments ?? []).length > 0 && /* @__PURE__ */ e("div", { className: g("flex flex-wrap gap-1.5", t.message && "mt-1.5"), children: (t.attachments ?? []).map((D) => {
1079
+ const O = Ut == null ? void 0 : Ut.get(D), ut = (O == null ? void 0 : O.title) || (O == null ? void 0 : O.filename_download) || "Attachment", Dt = d.fileUrl(D), Fa = ((O == null ? void 0 : O.type) ?? "").startsWith("image/"), mt = Kr(O == null ? void 0 : O.tags, O == null ? void 0 : O.type), $t = `${Dt}?download=1`, Mt = (O == null ? void 0 : O.filename_download) || ut, Mn = Ma($t, Mt), pt = u && P.length > 0 ? /* @__PURE__ */ e(
1080
1080
  rl,
1081
1081
  {
1082
- targets: Z,
1083
- recordLabel: m.label,
1084
- onPick: (Ha) => I.mutate({ messageId: t.id, fileId: U, field: Ha })
1082
+ targets: P,
1083
+ recordLabel: u.label,
1084
+ onPick: (Ha) => I.mutate({ messageId: t.id, fileId: D, field: Ha })
1085
1085
  }
1086
1086
  ) : null;
1087
- return it ? /* @__PURE__ */ e(
1087
+ return mt ? /* @__PURE__ */ e(
1088
1088
  Jr,
1089
1089
  {
1090
- url: _t,
1091
- poster: it.poster ? u.fileUrl(it.poster) : null,
1092
- name: ot,
1093
- durationMs: it.durationMs,
1094
- action: ct
1090
+ url: Dt,
1091
+ poster: mt.poster ? d.fileUrl(mt.poster) : null,
1092
+ name: ut,
1093
+ durationMs: mt.durationMs,
1094
+ action: pt
1095
1095
  },
1096
- U
1096
+ D
1097
1097
  ) : Fa ? /* @__PURE__ */ a("span", { className: "relative inline-block", children: [
1098
1098
  /* @__PURE__ */ e(
1099
1099
  "a",
1100
1100
  {
1101
- href: St,
1102
- download: Tt,
1103
- onClick: Tn,
1101
+ href: $t,
1102
+ download: Mt,
1103
+ onClick: Mn,
1104
1104
  title: "Download",
1105
1105
  className: "block",
1106
1106
  children: /* @__PURE__ */ e(
1107
1107
  "img",
1108
1108
  {
1109
- src: _t,
1110
- alt: ot,
1109
+ src: Dt,
1110
+ alt: ut,
1111
1111
  className: "max-h-40 max-w-[220px] rounded-lg object-cover",
1112
1112
  loading: "lazy"
1113
1113
  }
1114
1114
  )
1115
1115
  }
1116
1116
  ),
1117
- ct && /* @__PURE__ */ e("span", { className: "absolute right-1 top-1", children: ct })
1118
- ] }, U) : /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1", children: [
1117
+ pt && /* @__PURE__ */ e("span", { className: "absolute right-1 top-1", children: pt })
1118
+ ] }, D) : /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1", children: [
1119
1119
  /* @__PURE__ */ a(
1120
1120
  "a",
1121
1121
  {
1122
- href: St,
1123
- download: Tt,
1124
- onClick: Tn,
1122
+ href: $t,
1123
+ download: Mt,
1124
+ onClick: Mn,
1125
1125
  title: "Download",
1126
1126
  className: g(
1127
1127
  "inline-flex max-w-[220px] items-center gap-1.5 rounded-lg border px-2 py-1 text-[11.5px]",
@@ -1129,22 +1129,22 @@ function qn({
1129
1129
  ),
1130
1130
  children: [
1131
1131
  /* @__PURE__ */ e(fs, { className: "h-3 w-3 shrink-0 opacity-60" }),
1132
- /* @__PURE__ */ e("span", { className: "truncate", children: ot })
1132
+ /* @__PURE__ */ e("span", { className: "truncate", children: ut })
1133
1133
  ]
1134
1134
  }
1135
1135
  ),
1136
- ct
1137
- ] }, U);
1136
+ pt
1137
+ ] }, D);
1138
1138
  }) })
1139
1139
  ]
1140
1140
  }
1141
1141
  ),
1142
- !z && !Ae && t.message && !t.no_preview && /* @__PURE__ */ e("div", { className: g(N && "flex justify-end"), children: /* @__PURE__ */ e(
1142
+ !z && !Me && t.message && !t.no_preview && /* @__PURE__ */ e("div", { className: g(N && "flex justify-end"), children: /* @__PURE__ */ e(
1143
1143
  Er,
1144
1144
  {
1145
1145
  text: t.message,
1146
1146
  navigate: x.navigate,
1147
- onDismiss: N ? () => j.mutate(t.id) : void 0
1147
+ onDismiss: N ? () => te.mutate(t.id) : void 0
1148
1148
  }
1149
1149
  ) }),
1150
1150
  be.size > 0 && /* @__PURE__ */ e(
@@ -1152,22 +1152,22 @@ function qn({
1152
1152
  {
1153
1153
  className: g("mt-0.5 flex flex-wrap gap-1", N && "justify-end"),
1154
1154
  "data-chat-reactions": !0,
1155
- children: [...be.entries()].map(([U, O]) => /* @__PURE__ */ a(
1155
+ children: [...be.entries()].map(([D, O]) => /* @__PURE__ */ a(
1156
1156
  "button",
1157
1157
  {
1158
1158
  type: "button",
1159
1159
  title: O.names.join(", "),
1160
- onClick: () => se.mutate({ messageId: t.id, emoji: U }),
1160
+ onClick: () => se.mutate({ messageId: t.id, emoji: D }),
1161
1161
  className: g(
1162
1162
  "inline-flex items-center gap-0.5 rounded-full border px-1.5 py-px text-[10.5px] leading-tight transition-colors",
1163
1163
  O.mine ? g("font-semibold", f.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"
1164
1164
  ),
1165
1165
  children: [
1166
- /* @__PURE__ */ e(kr, { value: U }),
1166
+ /* @__PURE__ */ e(kr, { value: D }),
1167
1167
  /* @__PURE__ */ e("span", { className: "tabular-nums", children: O.count })
1168
1168
  ]
1169
1169
  },
1170
- U
1170
+ D
1171
1171
  ))
1172
1172
  }
1173
1173
  ),
@@ -1175,7 +1175,7 @@ function qn({
1175
1175
  "button",
1176
1176
  {
1177
1177
  type: "button",
1178
- onClick: () => Ie(t.id),
1178
+ onClick: () => je(t.id),
1179
1179
  className: g(
1180
1180
  "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",
1181
1181
  f.accentText,
@@ -1183,13 +1183,13 @@ function qn({
1183
1183
  ),
1184
1184
  "data-chat-thread-summary": t.thread.count,
1185
1185
  children: [
1186
- /* @__PURE__ */ e("span", { className: "flex -space-x-1.5", children: t.thread.people.slice(0, 3).map((U) => /* @__PURE__ */ e(Q, { id: U.id, name: U.name, size: 16, presence: !1 }, U.id)) }),
1186
+ /* @__PURE__ */ e("span", { className: "flex -space-x-1.5", children: t.thread.people.slice(0, 3).map((D) => /* @__PURE__ */ e(K, { id: D.id, name: D.name, size: 16, presence: !1 }, D.id)) }),
1187
1187
  t.thread.count,
1188
1188
  " ",
1189
1189
  t.thread.count === 1 ? "reply" : "replies",
1190
1190
  t.thread.last_reply_at && /* @__PURE__ */ a("span", { className: "font-normal text-slate-500 dark:text-slate-400", children: [
1191
1191
  "· last ",
1192
- Kn(t.thread.last_reply_at)
1192
+ Vn(t.thread.last_reply_at)
1193
1193
  ] })
1194
1194
  ]
1195
1195
  }
@@ -1216,23 +1216,23 @@ function qn({
1216
1216
  hour: "numeric",
1217
1217
  minute: "2-digit"
1218
1218
  }),
1219
- N && De && !z && (() => {
1219
+ N && Ce && !z && (() => {
1220
1220
  var O;
1221
- const U = Pe(t);
1222
- return U.length === 0 ? null : /* @__PURE__ */ e(
1221
+ const D = Pe(t);
1222
+ return D.length === 0 ? null : /* @__PURE__ */ e(
1223
1223
  il,
1224
1224
  {
1225
- seen: U,
1225
+ seen: D,
1226
1226
  channelId: ((O = w == null ? void 0 : w.channel) == null ? void 0 : O.id) ?? null,
1227
1227
  senderId: String(t.sender ?? "")
1228
1228
  }
1229
1229
  );
1230
1230
  })(),
1231
- h.isLastMine && n.startsWith("dm:") && (W ? /* @__PURE__ */ a("span", { className: g("inline-flex items-center gap-0.5 font-medium", f.accentText), children: [
1231
+ h.isLastMine && n.startsWith("dm:") && (F ? /* @__PURE__ */ a("span", { className: g("inline-flex items-center gap-0.5 font-medium", f.accentText), children: [
1232
1232
  /* @__PURE__ */ e(bs, { className: "h-3 w-3", strokeWidth: 2.4 }),
1233
1233
  " Read"
1234
1234
  ] }) : /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-0.5", children: [
1235
- /* @__PURE__ */ e(It, { className: "h-3 w-3", strokeWidth: 2.2 }),
1235
+ /* @__PURE__ */ e(Bt, { className: "h-3 w-3", strokeWidth: 2.2 }),
1236
1236
  " Sent"
1237
1237
  ] }))
1238
1238
  ] })
@@ -1240,20 +1240,20 @@ function qn({
1240
1240
  ]
1241
1241
  }
1242
1242
  );
1243
- }, hn = (t) => /* @__PURE__ */ e(
1243
+ }, gn = (t) => /* @__PURE__ */ e(
1244
1244
  Gs,
1245
1245
  {
1246
- ref: t ? void 0 : sn,
1246
+ ref: t ? void 0 : cn,
1247
1247
  room: n,
1248
1248
  label: S,
1249
1249
  parentId: t,
1250
1250
  quote: t ? Ra : Aa,
1251
- onClearQuote: () => t ? an(null) : nn(null),
1251
+ onClearQuote: () => t ? on(null) : ln(null),
1252
1252
  onSent: La,
1253
- disabledReason: t ? null : un,
1253
+ disabledReason: t ? null : fn,
1254
1254
  quietNote: Ea,
1255
1255
  th: f,
1256
- renderAvatar: (h, N) => /* @__PURE__ */ e(Q, { id: h, name: N, size: 22, presence: h !== "__bot__" })
1256
+ renderAvatar: (h, N) => /* @__PURE__ */ e(K, { id: h, name: N, size: 22, presence: h !== "__bot__" })
1257
1257
  }
1258
1258
  );
1259
1259
  return /* @__PURE__ */ a(
@@ -1262,14 +1262,14 @@ function qn({
1262
1262
  className: "relative flex h-full min-h-0 flex-col",
1263
1263
  "data-chat-room": n,
1264
1264
  onDragOver: (t) => {
1265
- t.dataTransfer.types.includes("Files") && !un && (t.preventDefault(), gt(!0));
1265
+ t.dataTransfer.types.includes("Files") && !fn && (t.preventDefault(), wt(!0));
1266
1266
  },
1267
1267
  onDragLeave: (t) => {
1268
- t.currentTarget.contains(t.relatedTarget) || gt(!1);
1268
+ t.currentTarget.contains(t.relatedTarget) || wt(!1);
1269
1269
  },
1270
1270
  onDrop: (t) => {
1271
1271
  var h;
1272
- t.dataTransfer.files.length && (t.preventDefault(), gt(!1), (h = sn.current) == null || h.addFiles([...t.dataTransfer.files]));
1272
+ t.dataTransfer.files.length && (t.preventDefault(), wt(!1), (h = cn.current) == null || h.addFiles([...t.dataTransfer.files]));
1273
1273
  },
1274
1274
  children: [
1275
1275
  Oa && /* @__PURE__ */ e(
@@ -1288,16 +1288,16 @@ function qn({
1288
1288
  onClick: l,
1289
1289
  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",
1290
1290
  "aria-label": "Back to conversations",
1291
- children: /* @__PURE__ */ e(ut, { className: "h-4 w-4", strokeWidth: 2 })
1291
+ children: /* @__PURE__ */ e(ft, { className: "h-4 w-4", strokeWidth: 2 })
1292
1292
  }
1293
1293
  ),
1294
- ((w == null ? void 0 : w.kind) === "channel" && !((bn = w.channel) != null && bn.is_direct) || (w == null ? void 0 : w.kind) === "global" && (((gn = w.channel) == null ? void 0 : gn.icon) || ((vn = w.channel) == null ? void 0 : vn.color))) && /* @__PURE__ */ e(Ye, { icon: (yn = w == null ? void 0 : w.channel) == null ? void 0 : yn.icon, color: (kn = w == null ? void 0 : w.channel) == null ? void 0 : kn.color, size: 24 }),
1295
- b && Se(n, b.id) && /* @__PURE__ */ e(Vr, { peerId: Se(n, b.id), name: S }),
1294
+ ((w == null ? void 0 : w.kind) === "channel" && !((kn = w.channel) != null && kn.is_direct) || (w == null ? void 0 : w.kind) === "global" && (((wn = w.channel) == null ? void 0 : wn.icon) || ((Nn = w.channel) == null ? void 0 : Nn.color))) && /* @__PURE__ */ e(et, { icon: (Cn = w == null ? void 0 : w.channel) == null ? void 0 : Cn.icon, color: (_n = w == null ? void 0 : w.channel) == null ? void 0 : _n.color, size: 24 }),
1295
+ b && Te(n, b.id) && /* @__PURE__ */ e(Vr, { peerId: Te(n, b.id), name: S }),
1296
1296
  /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
1297
1297
  /* @__PURE__ */ a("p", { className: "flex items-center gap-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: [
1298
1298
  /* @__PURE__ */ e("span", { className: "truncate", children: S }),
1299
- w && /* @__PURE__ */ e(Br, { starred: !!w.starred, notify: Kt }),
1300
- (q == null ? void 0 : q.announce) && /* @__PURE__ */ e(
1299
+ w && /* @__PURE__ */ e(Br, { starred: !!w.starred, notify: Vt }),
1300
+ (B == null ? void 0 : B.announce) && /* @__PURE__ */ e(
1301
1301
  "span",
1302
1302
  {
1303
1303
  className: "shrink-0 rounded bg-slate-100 px-1.5 py-px text-[10.5px] font-medium text-slate-600 dark:bg-muted dark:text-slate-300",
@@ -1306,12 +1306,12 @@ function qn({
1306
1306
  }
1307
1307
  )
1308
1308
  ] }),
1309
- b && Se(n, b.id) ? /* @__PURE__ */ e(al, { peerId: Se(n, b.id), name: S }) : n.startsWith("ch:") ? /* @__PURE__ */ e(
1309
+ b && Te(n, b.id) ? /* @__PURE__ */ e(al, { peerId: Te(n, b.id), name: S }) : n.startsWith("ch:") ? /* @__PURE__ */ e(
1310
1310
  Fr,
1311
1311
  {
1312
1312
  room: n,
1313
- me: ((wn = x.me) == null ? void 0 : wn.id) ?? null,
1314
- renderAvatar: (t, h) => /* @__PURE__ */ e(Q, { id: t, name: h, size: 24 })
1313
+ me: ((Sn = x.me) == null ? void 0 : Sn.id) ?? null,
1314
+ renderAvatar: (t, h) => /* @__PURE__ */ e(K, { id: t, name: h, size: 24 })
1315
1315
  }
1316
1316
  ) : null
1317
1317
  ] }),
@@ -1321,7 +1321,7 @@ function qn({
1321
1321
  room: n,
1322
1322
  roomLabel: S,
1323
1323
  huddle: y,
1324
- renderAvatar: (t, h) => /* @__PURE__ */ e(Q, { id: t, name: h, size: 18, presence: !1 })
1324
+ renderAvatar: (t, h) => /* @__PURE__ */ e(K, { id: t, name: h, size: 18, presence: !1 })
1325
1325
  }
1326
1326
  ),
1327
1327
  /* @__PURE__ */ e(
@@ -1329,26 +1329,26 @@ function qn({
1329
1329
  {
1330
1330
  type: "button",
1331
1331
  onClick: () => {
1332
- Sa((t) => !t), Jt("");
1332
+ Sa((t) => !t), Xt("");
1333
1333
  },
1334
- className: g(In, tt ? f.accentSoft : Pn),
1334
+ className: g(Bn, rt ? f.accentSoft : qn),
1335
1335
  "aria-label": "Search in this conversation",
1336
- "aria-pressed": tt,
1336
+ "aria-pressed": rt,
1337
1337
  "data-tip": "Search this conversation",
1338
- children: /* @__PURE__ */ e(zn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1338
+ children: /* @__PURE__ */ e(Jn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1339
1339
  }
1340
1340
  ),
1341
- ((Nn = w == null ? void 0 : w.channel) == null ? void 0 : Nn.is_direct) && /* @__PURE__ */ e(cl, { channel: w.channel, onLeft: l }),
1341
+ ((Tn = w == null ? void 0 : w.channel) == null ? void 0 : Tn.is_direct) && /* @__PURE__ */ e(cl, { channel: w.channel, onLeft: l }),
1342
1342
  /* @__PURE__ */ e(
1343
1343
  "button",
1344
1344
  {
1345
1345
  type: "button",
1346
1346
  onClick: () => {
1347
- Ie(null), He((t) => !t);
1347
+ je(null), Ke((t) => !t);
1348
1348
  },
1349
- className: g(In, bt ? f.accentSoft : Pn),
1349
+ className: g(Bn, kt ? f.accentSoft : qn),
1350
1350
  "aria-label": "Room info — members, pinned, files and links",
1351
- "aria-pressed": bt,
1351
+ "aria-pressed": kt,
1352
1352
  "data-tip": "Room info — members, pinned, files and links",
1353
1353
  "data-chat-info-button": !0,
1354
1354
  children: /* @__PURE__ */ e(rs, { className: "h-3.5 w-3.5", strokeWidth: 2 })
@@ -1359,41 +1359,41 @@ function qn({
1359
1359
  {
1360
1360
  th: f,
1361
1361
  huddleSchedule: y.enabled ? (t) => /* @__PURE__ */ e(
1362
- Dr,
1362
+ Ur,
1363
1363
  {
1364
1364
  room: n,
1365
1365
  me: (b == null ? void 0 : b.id) ?? null,
1366
1366
  theme: { input: f.input },
1367
- renderAvatar: (h, N) => /* @__PURE__ */ e(Q, { id: h, name: N, size: 18, presence: !1 }),
1367
+ renderAvatar: (h, N) => /* @__PURE__ */ e(K, { id: h, name: N, size: 18, presence: !1 }),
1368
1368
  onDone: t
1369
1369
  }
1370
1370
  ) : void 0,
1371
1371
  starred: w ? !!w.starred : void 0,
1372
- onStar: w ? () => va.mutate({ room: n, starred: !w.starred }) : void 0,
1373
- notify: w ? Kt : void 0,
1372
+ onStar: w ? () => ne.mutate({ room: n, starred: !w.starred }) : void 0,
1373
+ notify: w ? Vt : void 0,
1374
1374
  onNotify: w ? (t) => {
1375
- t === "muted" ? H.mutate({ room: n, muted: !0 }) : (w.muted && H.mutate({ room: n, muted: !1 }), re.mutate({ room: n, mode: t }));
1375
+ t === "muted" ? j.mutate({ room: n, muted: !0 }) : (w.muted && j.mutate({ room: n, muted: !1 }), ce.mutate({ room: n, mode: t }));
1376
1376
  } : void 0,
1377
1377
  onJump: (t) => {
1378
- Me.current = !1, le.current = !1, $({ date: t });
1378
+ $e.current = !1, le.current = !1, $({ date: t });
1379
1379
  },
1380
1380
  onOpenRecord: oe ? () => {
1381
1381
  var t;
1382
1382
  return (t = x.navigate) == null ? void 0 : t.call(x, oe);
1383
1383
  } : void 0,
1384
- onTeamsCall: n.startsWith("dm:") || (Cn = w == null ? void 0 : w.channel) != null && Cn.is_direct ? async () => {
1384
+ onTeamsCall: n.startsWith("dm:") || (Un = w == null ? void 0 : w.channel) != null && Un.is_direct ? async () => {
1385
1385
  var t, h;
1386
1386
  try {
1387
1387
  let N = [];
1388
1388
  if (n.startsWith("dm:") && b) {
1389
- const W = Se(n, b.id);
1390
- if (W) {
1391
- const z = await u.request(
1392
- ye(`/users/${W}`)
1389
+ const F = Te(n, b.id);
1390
+ if (F) {
1391
+ const z = await d.request(
1392
+ ye(`/users/${F}`)
1393
1393
  );
1394
1394
  (t = z.data) != null && t.email && (N = [z.data.email]);
1395
1395
  }
1396
- } else (h = w == null ? void 0 : w.channel) != null && h.id && (N = (await u.request(
1396
+ } else (h = w == null ? void 0 : w.channel) != null && h.id && (N = (await d.request(
1397
1397
  ye(
1398
1398
  `/chat/channels/${w.channel.id}/members`
1399
1399
  )
@@ -1411,9 +1411,9 @@ function qn({
1411
1411
  ge.error("Could not resolve participants");
1412
1412
  }
1413
1413
  } : void 0,
1414
- onSettings: r,
1414
+ onSettings: s,
1415
1415
  archived: !!(w != null && w.archived),
1416
- onArchive: w && _a ? () => fe.mutate(
1416
+ onArchive: w && _a ? () => ee.mutate(
1417
1417
  { room: n, archived: !w.archived },
1418
1418
  {
1419
1419
  onSuccess: () => {
@@ -1426,78 +1426,78 @@ function qn({
1426
1426
  }
1427
1427
  }
1428
1428
  ) : void 0,
1429
- onLeave: (w == null ? void 0 : w.kind) === "entity" && w.joined ? () => ka.mutate(n, {
1429
+ onLeave: (w == null ? void 0 : w.kind) === "entity" && w.joined ? () => re.mutate(n, {
1430
1430
  onSuccess: () => {
1431
1431
  ge.success(`Left ${w.label}`, {
1432
1432
  description: "Open the record's chat again to rejoin."
1433
1433
  }), l();
1434
1434
  }
1435
1435
  }) : void 0,
1436
- tips: /* @__PURE__ */ e(el, { botName: pe })
1436
+ tips: /* @__PURE__ */ e(el, { botName: he })
1437
1437
  }
1438
1438
  )
1439
1439
  ] }),
1440
1440
  /* @__PURE__ */ e(
1441
- Ur,
1441
+ Dr,
1442
1442
  {
1443
1443
  room: n,
1444
1444
  me: b,
1445
1445
  huddle: y,
1446
- renderAvatar: (t, h) => /* @__PURE__ */ e(Q, { id: t, name: h, size: 18, presence: !1 })
1446
+ renderAvatar: (t, h) => /* @__PURE__ */ e(K, { id: t, name: h, size: 18, presence: !1 })
1447
1447
  }
1448
1448
  ),
1449
- tt && /* @__PURE__ */ e("div", { className: g("shrink-0 border-b px-3 py-1.5", f.divider), children: /* @__PURE__ */ e(
1449
+ rt && /* @__PURE__ */ e("div", { className: g("shrink-0 border-b px-3 py-1.5", f.divider), children: /* @__PURE__ */ e(
1450
1450
  "input",
1451
1451
  {
1452
1452
  autoFocus: !0,
1453
- value: nt,
1454
- onChange: (t) => Jt(t.target.value),
1453
+ value: lt,
1454
+ onChange: (t) => Xt(t.target.value),
1455
1455
  placeholder: "Search messages…",
1456
1456
  className: g("h-7 w-full rounded-md border px-2 text-[12px] outline-none", f.input),
1457
1457
  "aria-label": "Search messages"
1458
1458
  }
1459
1459
  ) }),
1460
1460
  /* @__PURE__ */ e(tl, { room: n }),
1461
- q && !q.is_direct && /* @__PURE__ */ e(
1461
+ B && !B.is_direct && /* @__PURE__ */ e(
1462
1462
  Hr,
1463
1463
  {
1464
- description: q.description,
1465
- links: q.links,
1464
+ description: B.description,
1465
+ links: B.links,
1466
1466
  th: f,
1467
1467
  navigate: x.navigate
1468
1468
  }
1469
1469
  ),
1470
- me.length > 0 && /* @__PURE__ */ e("div", { className: g("shrink-0 border-b px-3 py-1", f.divider), "data-chat-pins-strip": !0, children: /* @__PURE__ */ a(
1470
+ pe.length > 0 && /* @__PURE__ */ e("div", { className: g("shrink-0 border-b px-3 py-1", f.divider), "data-chat-pins-strip": !0, children: /* @__PURE__ */ a(
1471
1471
  "button",
1472
1472
  {
1473
1473
  type: "button",
1474
1474
  onClick: () => {
1475
- Ie(null), He(!0);
1475
+ je(null), Ke(!0);
1476
1476
  },
1477
1477
  className: "flex w-full items-center gap-1.5 text-[11px] font-medium text-slate-500 dark:text-slate-400",
1478
1478
  children: [
1479
- /* @__PURE__ */ e(Mt, { className: "h-3 w-3", strokeWidth: 2 }),
1480
- me.length,
1479
+ /* @__PURE__ */ e(Lt, { className: "h-3 w-3", strokeWidth: 2 }),
1480
+ pe.length,
1481
1481
  " pinned",
1482
- /* @__PURE__ */ e(ut, { className: "ml-auto h-3 w-3 -rotate-90" })
1482
+ /* @__PURE__ */ e(ft, { className: "ml-auto h-3 w-3 -rotate-90" })
1483
1483
  ]
1484
1484
  }
1485
1485
  ) }),
1486
- (q == null ? void 0 : q.archive_suggested_at) && q.id !== 0 && (dn || X) && /* @__PURE__ */ e(
1486
+ (B == null ? void 0 : B.archive_suggested_at) && B.id !== 0 && (hn || L) && /* @__PURE__ */ e(
1487
1487
  js,
1488
1488
  {
1489
- channelId: q.id,
1489
+ channelId: B.id,
1490
1490
  channelName: S,
1491
- suggestedAt: q.archive_suggested_at
1491
+ suggestedAt: B.archive_suggested_at
1492
1492
  }
1493
1493
  ),
1494
- qa && (q == null ? void 0 : q.welcome_note) && /* @__PURE__ */ e(
1494
+ qa && (B == null ? void 0 : B.welcome_note) && /* @__PURE__ */ e(
1495
1495
  zr,
1496
1496
  {
1497
- note: q.welcome_note,
1497
+ note: B.welcome_note,
1498
1498
  channelName: S,
1499
1499
  th: f,
1500
- onDismiss: () => ya.mutate(n)
1500
+ onDismiss: () => Q.mutate(n)
1501
1501
  }
1502
1502
  ),
1503
1503
  /* @__PURE__ */ e(
@@ -1506,47 +1506,47 @@ function qn({
1506
1506
  ref: Re,
1507
1507
  onScroll: (t) => {
1508
1508
  const h = t.currentTarget;
1509
- le.current = h.scrollHeight - h.scrollTop - h.clientHeight < 48, wt.current = h.scrollHeight, le.current && ce && ze(null), we.onScroll(), h.scrollTop < 200 && J && !R && !xe && Me.current && F();
1509
+ le.current = h.scrollHeight - h.scrollTop - h.clientHeight < 48, St.current = h.scrollHeight, le.current && de && Je(null), Ne.onScroll(), h.scrollTop < 200 && Y && !R && !xe && $e.current && H();
1510
1510
  },
1511
1511
  className: "relative min-h-0 flex-1 overflow-y-auto px-3 py-3 [overflow-anchor:none]",
1512
1512
  "data-chat-messages": !0,
1513
- children: /* @__PURE__ */ a("div", { ref: rn, className: Ee === "compact" ? "space-y-1" : "space-y-2.5", children: [
1514
- J && !xe && /* @__PURE__ */ e("div", { className: "flex justify-center", children: /* @__PURE__ */ e(
1513
+ children: /* @__PURE__ */ a("div", { ref: dn, className: qe === "compact" ? "space-y-1" : "space-y-2.5", children: [
1514
+ Y && !xe && /* @__PURE__ */ e("div", { className: "flex justify-center", children: /* @__PURE__ */ e(
1515
1515
  "button",
1516
1516
  {
1517
1517
  type: "button",
1518
1518
  disabled: R,
1519
1519
  onClick: () => {
1520
1520
  var t;
1521
- wt.current = ((t = Re.current) == null ? void 0 : t.scrollHeight) ?? 0, F();
1521
+ St.current = ((t = Re.current) == null ? void 0 : t.scrollHeight) ?? 0, H();
1522
1522
  },
1523
1523
  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",
1524
1524
  "data-chat-load-older": !0,
1525
1525
  children: R ? "Loading…" : "Load earlier messages"
1526
1526
  }
1527
1527
  ) }),
1528
- E ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-500", children: "Loading…" }) : _e.length === 0 && K.length === 0 ? /* @__PURE__ */ e("div", { className: "py-6 text-center text-[12px] text-slate-500", children: xe ? "No messages match." : B ? "Nothing was said around then." : /* @__PURE__ */ a(ke, { children: [
1528
+ q ? /* @__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: xe ? "No messages match." : W ? "Nothing was said around then." : /* @__PURE__ */ a(ke, { children: [
1529
1529
  /* @__PURE__ */ e("p", { children: "No messages yet — say hello." }),
1530
1530
  /* @__PURE__ */ a("p", { className: "mt-1 text-[11px]", children: [
1531
1531
  "Tip: @ mentions someone",
1532
- pe ? `, @${pe} asks the AI` : "",
1532
+ he ? `, @${he} asks the AI` : "",
1533
1533
  ", # inserts a record, and a record ID like AB26-12345 becomes a live link."
1534
1534
  ] })
1535
1535
  ] }) }) : /* @__PURE__ */ e(
1536
1536
  "div",
1537
1537
  {
1538
- ref: cn,
1539
- style: we.windowed ? { paddingTop: we.padTop, paddingBottom: we.padBottom } : void 0,
1540
- "data-chat-rows": we.windowed ? "windowed" : "all",
1541
- children: _e.slice(we.start, we.end).map((t, h) => {
1542
- var Ae;
1543
- const N = we.start + h, W = _e[N - 1], z = N === 0 || W && new Date(W.date_created).toDateString() !== new Date(t.date_created).toDateString(), Oe = !xe && !B && kt.current > 0 && N === Math.max(0, _e.length - kt.current), qe = Ee === "compact" && !z && !!W && W.sender === t.sender && !W.is_system && new Date(t.date_created).getTime() - new Date(W.date_created).getTime() < 5 * 6e4;
1538
+ ref: pn,
1539
+ style: Ne.windowed ? { paddingTop: Ne.padTop, paddingBottom: Ne.padBottom } : void 0,
1540
+ "data-chat-rows": Ne.windowed ? "windowed" : "all",
1541
+ children: Se.slice(Ne.start, Ne.end).map((t, h) => {
1542
+ var Me;
1543
+ const N = Ne.start + h, F = Se[N - 1], z = N === 0 || F && new Date(F.date_created).toDateString() !== new Date(t.date_created).toDateString(), Oe = !xe && !W && _t.current > 0 && N === Math.max(0, Se.length - _t.current), Be = qe === "compact" && !z && !!F && F.sender === t.sender && !F.is_system && new Date(t.date_created).getTime() - new Date(F.date_created).getTime() < 5 * 6e4;
1544
1544
  return /* @__PURE__ */ a(
1545
1545
  "div",
1546
1546
  {
1547
- ref: we.rowRef(t.id),
1547
+ ref: Ne.rowRef(t.id),
1548
1548
  "data-chat-row": t.id,
1549
- className: N > 0 ? Ee === "compact" ? "pt-1" : "pt-2.5" : void 0,
1549
+ className: N > 0 ? qe === "compact" ? "pt-1" : "pt-2.5" : void 0,
1550
1550
  children: [
1551
1551
  z && /* @__PURE__ */ a("div", { className: "my-2 flex items-center gap-2", children: [
1552
1552
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-slate-100 dark:bg-border" }),
@@ -1556,30 +1556,30 @@ function qn({
1556
1556
  Oe && /* @__PURE__ */ a(
1557
1557
  "div",
1558
1558
  {
1559
- ref: yt,
1559
+ ref: Ct,
1560
1560
  className: "my-2 flex items-center gap-2",
1561
1561
  "data-chat-unread-divider": !0,
1562
1562
  children: [
1563
1563
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-red-300 dark:bg-red-500/50" }),
1564
1564
  /* @__PURE__ */ e("span", { className: "text-[11px] font-semibold text-red-600 dark:text-red-400", children: "New messages" }),
1565
- kt.current > 20 && /* @__PURE__ */ e(
1565
+ _t.current > 20 && /* @__PURE__ */ e(
1566
1566
  "button",
1567
1567
  {
1568
1568
  type: "button",
1569
- disabled: V.isPending,
1570
- onClick: () => V.mutate(),
1569
+ disabled: Ie.isPending,
1570
+ onClick: () => Ie.mutate(),
1571
1571
  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",
1572
- children: V.isPending ? "Summarizing…" : "✨ What did I miss?"
1572
+ children: Ie.isPending ? "Summarizing…" : "✨ What did I miss?"
1573
1573
  }
1574
1574
  ),
1575
1575
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-red-300 dark:bg-red-500/50" })
1576
1576
  ]
1577
1577
  }
1578
1578
  ),
1579
- Oe && M && /* @__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: M }),
1580
- pn(t, {
1581
- isLastMine: ((Ae = t.sender) == null ? void 0 : Ae.toLowerCase()) === je && N === Pa,
1582
- showSender: !qe
1579
+ Oe && Ge && /* @__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: Ge }),
1580
+ bn(t, {
1581
+ isLastMine: ((Me = t.sender) == null ? void 0 : Me.toLowerCase()) === Ee && N === Pa,
1582
+ showSender: !Be
1583
1583
  })
1584
1584
  ]
1585
1585
  },
@@ -1588,41 +1588,41 @@ function qn({
1588
1588
  })
1589
1589
  }
1590
1590
  ),
1591
- !xe && !G && /* @__PURE__ */ e(da, { items: K, th: f }),
1592
- !xe && !G && Qe.live && pe && /* @__PURE__ */ e(
1591
+ !xe && !G && /* @__PURE__ */ e(ha, { items: J, th: f }),
1592
+ !xe && !G && Ze.live && he && /* @__PURE__ */ e(
1593
1593
  Ps,
1594
1594
  {
1595
- live: Qe.live,
1596
- botName: pe,
1595
+ live: Ze.live,
1596
+ botName: he,
1597
1597
  bubbleClass: f.bubbleOther,
1598
1598
  accentClass: f.accentText,
1599
- onStop: Qe.stop,
1600
- onDismiss: Qe.dismiss
1599
+ onStop: Ze.stop,
1600
+ onDismiss: Ze.dismiss
1601
1601
  }
1602
1602
  )
1603
1603
  ] })
1604
1604
  }
1605
1605
  ),
1606
- (ce || G) && /* @__PURE__ */ e("div", { className: "pointer-events-none relative z-10 -mt-9 flex h-9 shrink-0 items-center justify-center", children: /* @__PURE__ */ e(
1606
+ (de || G) && /* @__PURE__ */ e("div", { className: "pointer-events-none relative z-10 -mt-9 flex h-9 shrink-0 items-center justify-center", children: /* @__PURE__ */ e(
1607
1607
  "button",
1608
1608
  {
1609
1609
  type: "button",
1610
1610
  onClick: () => {
1611
1611
  if (G) {
1612
- Me.current = !1, le.current = !0, $(null);
1612
+ $e.current = !1, le.current = !0, $(null);
1613
1613
  return;
1614
1614
  }
1615
- ce && !Nt(ce.firstId) && rt(), ze(null);
1615
+ de && !Tt(de.firstId) && ct(), Je(null);
1616
1616
  },
1617
1617
  className: g(
1618
1618
  "pointer-events-auto rounded-full px-3 py-1 text-[11.5px] font-semibold shadow-md",
1619
1619
  f.pill
1620
1620
  ),
1621
- "data-chat-new-pill": (ce == null ? void 0 : ce.count) ?? 0,
1622
- children: G ? "Jump to the latest ↓" : `${ce == null ? void 0 : ce.count} new ${(ce == null ? void 0 : ce.count) === 1 ? "message" : "messages"} ↓`
1621
+ "data-chat-new-pill": (de == null ? void 0 : de.count) ?? 0,
1622
+ children: G ? "Jump to the latest ↓" : `${de == null ? void 0 : de.count} new ${(de == null ? void 0 : de.count) === 1 ? "message" : "messages"} ↓`
1623
1623
  }
1624
1624
  ) }),
1625
- /* @__PURE__ */ e("div", { className: "min-h-[18px] shrink-0 px-3.5", children: st && pe && !Qe.live ? /* @__PURE__ */ a(
1625
+ /* @__PURE__ */ e("div", { className: "min-h-[18px] shrink-0 px-3.5", children: it && he && !Ze.live ? /* @__PURE__ */ a(
1626
1626
  "p",
1627
1627
  {
1628
1628
  className: "flex items-center gap-1.5 text-[11px] italic text-slate-500",
@@ -1633,68 +1633,68 @@ function qn({
1633
1633
  /* @__PURE__ */ e("span", { className: "h-1 w-1 animate-bounce rounded-full bg-slate-400 [animation-delay:150ms]" }),
1634
1634
  /* @__PURE__ */ e("span", { className: "h-1 w-1 animate-bounce rounded-full bg-slate-400 [animation-delay:300ms]" })
1635
1635
  ] }),
1636
- pe,
1636
+ he,
1637
1637
  " is thinking…"
1638
1638
  ]
1639
1639
  }
1640
- ) : Y.typingText && /* @__PURE__ */ e("p", { className: "text-[11px] italic text-slate-500", children: Y.typingText }) }),
1641
- hn(null),
1642
- Xt != null && /* @__PURE__ */ e(
1640
+ ) : Z.typingText && /* @__PURE__ */ e("p", { className: "text-[11px] italic text-slate-500", children: Z.typingText }) }),
1641
+ gn(null),
1642
+ an != null && /* @__PURE__ */ e(
1643
1643
  Gr,
1644
1644
  {
1645
1645
  room: n,
1646
- rootId: Xt,
1646
+ rootId: an,
1647
1647
  th: f,
1648
- onClose: () => Ie(null),
1649
- renderRow: (t) => pn(t, { inThread: !0 }),
1650
- renderComposer: (t) => hn(t),
1648
+ onClose: () => je(null),
1649
+ renderRow: (t) => bn(t, { inThread: !0 }),
1650
+ renderComposer: (t) => gn(t),
1651
1651
  renderOutbox: (t) => /* @__PURE__ */ e(sl, { room: n, parentId: t, th: f })
1652
1652
  }
1653
1653
  ),
1654
- bt && /* @__PURE__ */ e(
1654
+ kt && /* @__PURE__ */ e(
1655
1655
  Qr,
1656
1656
  {
1657
1657
  room: n,
1658
1658
  label: S,
1659
1659
  th: f,
1660
- pins: me,
1661
- onClose: () => He(!1),
1662
- onOpenMessage: ln,
1663
- onUnpin: (t) => c.mutate(t),
1660
+ pins: pe,
1661
+ onClose: () => Ke(!1),
1662
+ onOpenMessage: un,
1663
+ onUnpin: (t) => p.mutate(t),
1664
1664
  navigate: x.navigate,
1665
- renderAvatar: (t, h) => /* @__PURE__ */ e(Q, { id: t, name: h, size: 22 })
1665
+ renderAvatar: (t, h) => /* @__PURE__ */ e(K, { id: t, name: h, size: 22 })
1666
1666
  }
1667
1667
  )
1668
1668
  ]
1669
1669
  }
1670
1670
  );
1671
1671
  }
1672
- function sl({ room: n, parentId: s, th: l }) {
1673
- const r = ca(n, s);
1674
- return /* @__PURE__ */ e(da, { items: r, th: l });
1672
+ function sl({ room: n, parentId: r, th: l }) {
1673
+ const s = pa(n, r);
1674
+ return /* @__PURE__ */ e(ha, { items: s, th: l });
1675
1675
  }
1676
1676
  function rl({
1677
1677
  targets: n,
1678
- recordLabel: s,
1678
+ recordLabel: r,
1679
1679
  onPick: l
1680
1680
  }) {
1681
- const [r, o] = T(!1);
1682
- return /* @__PURE__ */ a(Ve, { open: r, onOpenChange: o, children: [
1683
- /* @__PURE__ */ e(Xe, { asChild: !0, children: /* @__PURE__ */ e(
1681
+ const [s, o] = T(!1);
1682
+ return /* @__PURE__ */ a(nt, { open: s, onOpenChange: o, children: [
1683
+ /* @__PURE__ */ e(at, { asChild: !0, children: /* @__PURE__ */ e(
1684
1684
  "button",
1685
1685
  {
1686
1686
  type: "button",
1687
1687
  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",
1688
- title: `Attach to ${s}`,
1689
- "aria-label": `Attach to ${s}`,
1688
+ title: `Attach to ${r}`,
1689
+ "aria-label": `Attach to ${r}`,
1690
1690
  "data-chat-attach-to-record": !0,
1691
1691
  children: /* @__PURE__ */ e(vs, { className: "h-3 w-3" })
1692
1692
  }
1693
1693
  ) }),
1694
- /* @__PURE__ */ a(et, { align: "end", className: "w-[220px] p-1.5", children: [
1694
+ /* @__PURE__ */ a(st, { align: "end", className: "w-[220px] p-1.5", children: [
1695
1695
  /* @__PURE__ */ a("p", { className: "px-2 pb-1 pt-0.5 text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: [
1696
1696
  "Attach to ",
1697
- s
1697
+ r
1698
1698
  ] }),
1699
1699
  n.map((i) => /* @__PURE__ */ e(
1700
1700
  "button",
@@ -1711,7 +1711,7 @@ function rl({
1711
1711
  ] })
1712
1712
  ] });
1713
1713
  }
1714
- function Bn(n) {
1714
+ function zn(n) {
1715
1715
  return {
1716
1716
  id: n.id,
1717
1717
  visibility: n.visibility,
@@ -1723,37 +1723,37 @@ function Bn(n) {
1723
1723
  };
1724
1724
  }
1725
1725
  const ll = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1726
- function Ot(n) {
1727
- const s = typeof n.idle_minutes == "number" ? n.idle_minutes : n.last_active ? Math.floor((Date.now() - new Date(n.last_active).getTime()) / 6e4) : null;
1728
- return s == null || s < 1 ? "Idle" : s < 60 ? `Idle · ${s}m` : `Idle · ${Math.floor(s / 60)}h ${s % 60}m`;
1726
+ function jt(n) {
1727
+ const r = typeof n.idle_minutes == "number" ? n.idle_minutes : n.last_active ? Math.floor((Date.now() - new Date(n.last_active).getTime()) / 6e4) : null;
1728
+ return r == null || r < 1 ? "Idle" : r < 60 ? `Idle · ${r}m` : `Idle · ${Math.floor(r / 60)}h ${r % 60}m`;
1729
1729
  }
1730
- function Wn(n) {
1731
- const s = n == null ? void 0 : n.trim();
1732
- return !s || ll.test(s) ? null : s;
1730
+ function Gn(n) {
1731
+ const r = n == null ? void 0 : n.trim();
1732
+ return !r || ll.test(r) ? null : r;
1733
1733
  }
1734
1734
  function ol(n) {
1735
- const s = new Date(n), l = /* @__PURE__ */ new Date(), r = s.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
1736
- return s.toDateString() === l.toDateString() ? r : (l.getTime() - s.getTime()) / 864e5 < 6 ? `${s.toLocaleDateString("en-US", { weekday: "short" })} ${r}` : `${s.toLocaleDateString("en-US", { month: "short", day: "numeric" })}, ${r}`;
1735
+ const r = new Date(n), l = /* @__PURE__ */ new Date(), s = r.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
1736
+ return r.toDateString() === l.toDateString() ? s : (l.getTime() - r.getTime()) / 864e5 < 6 ? `${r.toLocaleDateString("en-US", { weekday: "short" })} ${s}` : `${r.toLocaleDateString("en-US", { month: "short", day: "numeric" })}, ${s}`;
1737
1737
  }
1738
1738
  function il({
1739
1739
  seen: n,
1740
- channelId: s,
1740
+ channelId: r,
1741
1741
  senderId: l
1742
1742
  }) {
1743
- const r = ue(), [o, i] = T(!1), { members: p } = ta(o ? s : null), d = new Set(n.map((u) => String(u.user).toUpperCase())), x = p.filter((u) => {
1744
- const b = String(u.user).toUpperCase();
1745
- return b !== l.toUpperCase() && !d.has(b);
1743
+ const s = me(), [o, i] = T(!1), { members: m } = ra(o ? r : null), c = new Set(n.map((d) => String(d.user).toUpperCase())), x = m.filter((d) => {
1744
+ const b = String(d.user).toUpperCase();
1745
+ return b !== l.toUpperCase() && !c.has(b);
1746
1746
  }), f = [...n].sort(
1747
- (u, b) => new Date(u.last_read_at).getTime() - new Date(b.last_read_at).getTime()
1747
+ (d, b) => new Date(d.last_read_at).getTime() - new Date(b.last_read_at).getTime()
1748
1748
  );
1749
- return /* @__PURE__ */ a(Ve, { open: o, onOpenChange: i, children: [
1750
- /* @__PURE__ */ e(Xe, { asChild: !0, children: /* @__PURE__ */ a(
1749
+ return /* @__PURE__ */ a(nt, { open: o, onOpenChange: i, children: [
1750
+ /* @__PURE__ */ e(at, { asChild: !0, children: /* @__PURE__ */ a(
1751
1751
  "button",
1752
1752
  {
1753
1753
  type: "button",
1754
1754
  className: g(
1755
1755
  "font-medium underline decoration-dotted underline-offset-2 hover:decoration-solid",
1756
- r.accentText
1756
+ s.accentText
1757
1757
  ),
1758
1758
  "aria-label": `Seen by ${n.length} — show who`,
1759
1759
  "data-chat-seen-by": n.length,
@@ -1764,11 +1764,11 @@ function il({
1764
1764
  }
1765
1765
  ) }),
1766
1766
  /* @__PURE__ */ a(
1767
- et,
1767
+ st,
1768
1768
  {
1769
1769
  align: "end",
1770
1770
  sideOffset: 4,
1771
- className: g("w-[240px] p-0", r.surface),
1771
+ className: g("w-[240px] p-0", s.surface),
1772
1772
  "data-chat-seen-by-panel": !0,
1773
1773
  children: [
1774
1774
  /* @__PURE__ */ a("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: [
@@ -1776,29 +1776,29 @@ function il({
1776
1776
  n.length
1777
1777
  ] }),
1778
1778
  /* @__PURE__ */ a("div", { className: "max-h-[260px] overflow-y-auto py-1", children: [
1779
- f.map((u) => /* @__PURE__ */ a("div", { className: "flex items-center gap-2 px-3 py-1.5", children: [
1780
- /* @__PURE__ */ e(Q, { id: u.user, name: u.name || null, size: 22 }),
1781
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: u.name || "Someone" }),
1779
+ f.map((d) => /* @__PURE__ */ a("div", { className: "flex items-center gap-2 px-3 py-1.5", children: [
1780
+ /* @__PURE__ */ e(K, { id: d.user, name: d.name || null, size: 22 }),
1781
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: d.name || "Someone" }),
1782
1782
  /* @__PURE__ */ e(
1783
1783
  "span",
1784
1784
  {
1785
1785
  className: "shrink-0 text-[10.5px] tabular-nums text-slate-400",
1786
- "data-tip": `Last read the conversation ${new Date(u.last_read_at).toLocaleString("en-US", { dateStyle: "medium", timeStyle: "short" })}`,
1787
- children: ol(u.last_read_at)
1786
+ "data-tip": `Last read the conversation ${new Date(d.last_read_at).toLocaleString("en-US", { dateStyle: "medium", timeStyle: "short" })}`,
1787
+ children: ol(d.last_read_at)
1788
1788
  }
1789
1789
  )
1790
- ] }, u.user)),
1790
+ ] }, d.user)),
1791
1791
  x.length > 0 && /* @__PURE__ */ a(ke, { children: [
1792
1792
  /* @__PURE__ */ a("p", { className: "px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
1793
1793
  "Not seen yet · ",
1794
1794
  x.length
1795
1795
  ] }),
1796
- x.map((u) => {
1797
- const b = [u.first_name, u.last_name].filter(Boolean).join(" ") || u.email || "Someone";
1796
+ x.map((d) => {
1797
+ const b = [d.first_name, d.last_name].filter(Boolean).join(" ") || d.email || "Someone";
1798
1798
  return /* @__PURE__ */ a("div", { className: "flex items-center gap-2 px-3 py-1.5 opacity-70", children: [
1799
- /* @__PURE__ */ e(Q, { id: u.user, name: b, size: 22 }),
1799
+ /* @__PURE__ */ e(K, { id: d.user, name: b, size: 22 }),
1800
1800
  /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-600 dark:text-slate-300", children: b })
1801
- ] }, u.user);
1801
+ ] }, d.user);
1802
1802
  })
1803
1803
  ] })
1804
1804
  ] }),
@@ -1808,16 +1808,16 @@ function il({
1808
1808
  )
1809
1809
  ] });
1810
1810
  }
1811
- function cl({ channel: n, onLeft: s }) {
1812
- var F;
1813
- const l = ue(), r = Le(), { isAdmin: o } = ht(), [i, p] = T(!1), [d, x] = T(""), f = mt(d, 250), u = xr(
1811
+ function cl({ channel: n, onLeft: r }) {
1812
+ var H;
1813
+ const l = me(), s = Le(), { isAdmin: o } = gt(), [i, m] = T(!1), [c, x] = T(""), f = xt(c, 250), d = xr(
1814
1814
  `channel-${n.id}`,
1815
1815
  `/chat/channels/${n.id}/members`,
1816
1816
  f,
1817
1817
  i
1818
- ), b = u.members, y = u.loading, { addMember: D, removeMember: A } = na(n.id), [C, S] = T(""), B = mt(C, 250), $ = ((F = r.me) == null ? void 0 : F.id.toUpperCase()) ?? "", v = o || !!$ && String(n.created_by ?? "").toUpperCase() === $, { users: E } = Ft(B, i && v && !!C.trim()), J = new Set(b.map((R) => R.id.toUpperCase())), G = b;
1819
- return /* @__PURE__ */ a(Ve, { open: i, onOpenChange: p, children: [
1820
- /* @__PURE__ */ e(Xe, { asChild: !0, children: /* @__PURE__ */ a(
1818
+ ), b = d.members, y = d.loading, { addMember: U, removeMember: M } = la(n.id), [C, S] = T(""), W = xt(C, 250), $ = ((H = s.me) == null ? void 0 : H.id.toUpperCase()) ?? "", v = o || !!$ && String(n.created_by ?? "").toUpperCase() === $, { users: q } = Qt(W, i && v && !!C.trim()), Y = new Set(b.map((R) => R.id.toUpperCase())), G = b;
1819
+ return /* @__PURE__ */ a(nt, { open: i, onOpenChange: m, children: [
1820
+ /* @__PURE__ */ e(at, { asChild: !0, children: /* @__PURE__ */ a(
1821
1821
  "button",
1822
1822
  {
1823
1823
  type: "button",
@@ -1829,13 +1829,13 @@ function cl({ channel: n, onLeft: s }) {
1829
1829
  ),
1830
1830
  "data-chat-group-members": !0,
1831
1831
  children: [
1832
- /* @__PURE__ */ e(At, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
1833
- u.total > 0 && u.total
1832
+ /* @__PURE__ */ e(Pt, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
1833
+ d.total > 0 && d.total
1834
1834
  ]
1835
1835
  }
1836
1836
  ) }),
1837
1837
  /* @__PURE__ */ a(
1838
- et,
1838
+ st,
1839
1839
  {
1840
1840
  align: "end",
1841
1841
  sideOffset: 6,
@@ -1845,39 +1845,39 @@ function cl({ channel: n, onLeft: s }) {
1845
1845
  /* @__PURE__ */ a("div", { className: g("border-b px-3 py-2", l.divider), children: [
1846
1846
  /* @__PURE__ */ a("p", { className: "text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
1847
1847
  "In this conversation ",
1848
- u.total > 0 && `· ${u.total.toLocaleString("en-US")}`
1848
+ d.total > 0 && `· ${d.total.toLocaleString("en-US")}`
1849
1849
  ] }),
1850
- (u.total > 10 || d) && /* @__PURE__ */ e(Ar, { value: d, onChange: x, className: "mt-1.5" })
1850
+ (d.total > 10 || c) && /* @__PURE__ */ e(Ar, { value: c, onChange: x, className: "mt-1.5" })
1851
1851
  ] }),
1852
1852
  /* @__PURE__ */ a("div", { className: "max-h-[280px] overflow-y-auto py-1", children: [
1853
1853
  y && /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "Loading…" }),
1854
- !y && G.length === 0 && d.trim() && /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No one matches." }),
1854
+ !y && G.length === 0 && c.trim() && /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No one matches." }),
1855
1855
  G.map((R) => {
1856
- const K = R.id.toUpperCase(), ee = R.name, Y = K === $, te = String(n.created_by ?? "").toUpperCase() === K;
1856
+ const J = R.id.toUpperCase(), V = R.name, Z = J === $, X = String(n.created_by ?? "").toUpperCase() === J;
1857
1857
  return /* @__PURE__ */ a(
1858
1858
  "div",
1859
1859
  {
1860
1860
  className: "group flex items-center gap-2 px-3 py-1.5",
1861
1861
  "data-chat-group-member": R.id,
1862
1862
  children: [
1863
- /* @__PURE__ */ e(Q, { id: R.id, name: ee, size: 26 }),
1863
+ /* @__PURE__ */ e(K, { id: R.id, name: V, size: 26 }),
1864
1864
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
1865
1865
  /* @__PURE__ */ a("span", { className: "block truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [
1866
- ee,
1867
- Y && /* @__PURE__ */ e("span", { className: "text-slate-400", children: " (you)" })
1866
+ V,
1867
+ Z && /* @__PURE__ */ e("span", { className: "text-slate-400", children: " (you)" })
1868
1868
  ] }),
1869
- te && /* @__PURE__ */ e("span", { className: "block text-[10.5px] text-slate-400", children: "Started the group" })
1869
+ X && /* @__PURE__ */ e("span", { className: "block text-[10.5px] text-slate-400", children: "Started the group" })
1870
1870
  ] }),
1871
1871
  /* @__PURE__ */ e(Rr, { online: R.online }),
1872
- v && !Y && /* @__PURE__ */ e(
1872
+ v && !Z && /* @__PURE__ */ e(
1873
1873
  "button",
1874
1874
  {
1875
1875
  type: "button",
1876
- title: `Remove ${ee}`,
1877
- "aria-label": `Remove ${ee}`,
1878
- onClick: () => A.mutate(R.id),
1876
+ title: `Remove ${V}`,
1877
+ "aria-label": `Remove ${V}`,
1878
+ onClick: () => M.mutate(R.id),
1879
1879
  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",
1880
- children: /* @__PURE__ */ e(pt, { className: "h-3 w-3" })
1880
+ children: /* @__PURE__ */ e(bt, { className: "h-3 w-3" })
1881
1881
  }
1882
1882
  )
1883
1883
  ]
@@ -1888,9 +1888,9 @@ function cl({ channel: n, onLeft: s }) {
1888
1888
  /* @__PURE__ */ e(
1889
1889
  Or,
1890
1890
  {
1891
- hasMore: u.hasMore,
1892
- loading: u.loadingMore,
1893
- onLoad: u.loadMore
1891
+ hasMore: d.hasMore,
1892
+ loading: d.loadingMore,
1893
+ onLoad: d.loadMore
1894
1894
  }
1895
1895
  )
1896
1896
  ] }),
@@ -1905,33 +1905,33 @@ function cl({ channel: n, onLeft: s }) {
1905
1905
  "data-chat-group-add": !0
1906
1906
  }
1907
1907
  ),
1908
- C.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-36 overflow-y-auto", children: E.filter((R) => !J.has(String(R.id).toUpperCase())).map((R) => {
1909
- const K = [R.first_name, R.last_name].filter(Boolean).join(" ") || R.email || R.id;
1908
+ C.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-36 overflow-y-auto", children: q.filter((R) => !Y.has(String(R.id).toUpperCase())).map((R) => {
1909
+ const J = [R.first_name, R.last_name].filter(Boolean).join(" ") || R.email || R.id;
1910
1910
  return /* @__PURE__ */ a(
1911
1911
  "button",
1912
1912
  {
1913
1913
  type: "button",
1914
1914
  onClick: () => {
1915
- D.mutate(R.id), S("");
1915
+ U.mutate(R.id), S("");
1916
1916
  },
1917
1917
  className: "flex w-full items-center gap-2 rounded px-1 py-1 text-left hover:bg-muted",
1918
1918
  children: [
1919
- /* @__PURE__ */ e(Q, { id: R.id, name: K, size: 22 }),
1920
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: K })
1919
+ /* @__PURE__ */ e(K, { id: R.id, name: J, size: 22 }),
1920
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: J })
1921
1921
  ]
1922
1922
  },
1923
1923
  R.id
1924
1924
  );
1925
1925
  }) })
1926
1926
  ] }),
1927
- $ && J.has($) && /* @__PURE__ */ e("div", { className: g("border-t px-3 py-1.5", l.divider), children: /* @__PURE__ */ e(
1927
+ $ && Y.has($) && /* @__PURE__ */ e("div", { className: g("border-t px-3 py-1.5", l.divider), children: /* @__PURE__ */ e(
1928
1928
  "button",
1929
1929
  {
1930
1930
  type: "button",
1931
1931
  onClick: () => {
1932
- A.mutate(r.me.id, {
1932
+ M.mutate(s.me.id, {
1933
1933
  onSuccess: () => {
1934
- p(!1), s();
1934
+ m(!1), r();
1935
1935
  }
1936
1936
  });
1937
1937
  },
@@ -1947,15 +1947,15 @@ function cl({ channel: n, onLeft: s }) {
1947
1947
  }
1948
1948
  function dl({
1949
1949
  channel: n,
1950
- label: s,
1950
+ label: r,
1951
1951
  onBack: l
1952
1952
  }) {
1953
- const r = ue(), o = Le(), { isAdmin: i } = ht(), p = ea(), { members: d, loading: x } = ta(n.id), { update: f, addMember: u, removeMember: b } = na(n.id), [y, D] = T(s), [A, C] = T(n.topic ?? ""), [S, B] = T(n.visibility), [$, v] = T(n.role ?? ""), [E, J] = T({
1953
+ const s = me(), o = Le(), { isAdmin: i } = gt(), m = sa(), { members: c, loading: x } = ra(n.id), { update: f, addMember: d, removeMember: b } = la(n.id), [y, U] = T(r), [M, C] = T(n.topic ?? ""), [S, W] = T(n.visibility), [$, v] = T(n.role ?? ""), [q, Y] = T({
1954
1954
  icon: n.icon ?? null,
1955
1955
  color: n.color ?? null
1956
- }), [G, F] = T(""), R = mt(G, 250), { users: K } = Ft(R, S === "private"), [ee, Y] = T(!1), te = n.id === aa, oe = i || !te && !!o.me && String(n.created_by ?? "") === String(o.me.id), se = new Set(d.map((c) => String(c.user).toUpperCase())), me = y !== s || A !== (n.topic ?? "") || S !== n.visibility || E.icon !== (n.icon ?? null) || E.color !== (n.color ?? null) || S === "role" && $ !== (n.role ?? "");
1956
+ }), [G, H] = T(""), R = xt(G, 250), { users: J } = Qt(R, S === "private"), [V, Z] = T(!1), X = n.id === oa, oe = i || !X && !!o.me && String(n.created_by ?? "") === String(o.me.id), se = new Set(c.map((p) => String(p.user).toUpperCase())), pe = y !== r || M !== (n.topic ?? "") || S !== n.visibility || q.icon !== (n.icon ?? null) || q.color !== (n.color ?? null) || S === "role" && $ !== (n.role ?? "");
1957
1957
  return /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col", "data-chat-settings": !0, children: [
1958
- /* @__PURE__ */ a("div", { className: g("flex shrink-0 items-center gap-2 border-b px-3 py-2.5", r.divider), children: [
1958
+ /* @__PURE__ */ a("div", { className: g("flex shrink-0 items-center gap-2 border-b px-3 py-2.5", s.divider), children: [
1959
1959
  /* @__PURE__ */ e(
1960
1960
  "button",
1961
1961
  {
@@ -1963,11 +1963,11 @@ function dl({
1963
1963
  onClick: l,
1964
1964
  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",
1965
1965
  "aria-label": "Back to conversation",
1966
- children: /* @__PURE__ */ e(ut, { className: "h-4 w-4" })
1966
+ children: /* @__PURE__ */ e(ft, { className: "h-4 w-4" })
1967
1967
  }
1968
1968
  ),
1969
1969
  /* @__PURE__ */ a("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: [
1970
- s,
1970
+ r,
1971
1971
  " · settings"
1972
1972
  ] })
1973
1973
  ] }),
@@ -1979,58 +1979,58 @@ function dl({
1979
1979
  "input",
1980
1980
  {
1981
1981
  value: y,
1982
- onChange: (c) => D(c.target.value),
1983
- className: g("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
1982
+ onChange: (p) => U(p.target.value),
1983
+ className: g("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", s.input)
1984
1984
  }
1985
1985
  )
1986
1986
  ] }),
1987
1987
  !n.is_direct && /* @__PURE__ */ a("div", { className: "flex items-start gap-3", children: [
1988
- /* @__PURE__ */ e(Ye, { icon: E.icon, color: E.color, size: 40 }),
1989
- /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ e(Jn, { icon: E.icon, color: E.color, onChange: J }) })
1988
+ /* @__PURE__ */ e(et, { icon: q.icon, color: q.color, size: 40 }),
1989
+ /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ e(Xn, { icon: q.icon, color: q.color, onChange: Y }) })
1990
1990
  ] }),
1991
1991
  /* @__PURE__ */ a("label", { className: "block", children: [
1992
1992
  /* @__PURE__ */ e("span", { className: "mb-1 block text-[11px] font-medium text-slate-500 dark:text-slate-400", children: "Topic" }),
1993
1993
  /* @__PURE__ */ e(
1994
1994
  "input",
1995
1995
  {
1996
- value: A,
1997
- onChange: (c) => C(c.target.value),
1996
+ value: M,
1997
+ onChange: (p) => C(p.target.value),
1998
1998
  placeholder: "What this channel is for",
1999
- className: g("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
1999
+ className: g("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", s.input)
2000
2000
  }
2001
2001
  )
2002
2002
  ] }),
2003
- !te && /* @__PURE__ */ a("div", { children: [
2003
+ !X && /* @__PURE__ */ a("div", { children: [
2004
2004
  /* @__PURE__ */ e("span", { className: "mb-1 block text-[11px] font-medium text-slate-500 dark:text-slate-400", children: "Who can see it" }),
2005
2005
  /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: [
2006
2006
  ["open", "Anyone"],
2007
2007
  ["role", "One role"],
2008
2008
  ["private", "Invite only"]
2009
- ].map(([c, L]) => /* @__PURE__ */ e(
2009
+ ].map(([p, E]) => /* @__PURE__ */ e(
2010
2010
  "button",
2011
2011
  {
2012
2012
  type: "button",
2013
- onClick: () => B(c),
2013
+ onClick: () => W(p),
2014
2014
  className: g(
2015
2015
  "rounded-md px-2 py-1 text-[11.5px] font-medium transition-colors",
2016
- S === c ? r.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
2016
+ S === p ? s.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
2017
2017
  ),
2018
- children: L
2018
+ children: E
2019
2019
  },
2020
- c
2020
+ p
2021
2021
  )) }),
2022
2022
  S === "role" && /* @__PURE__ */ e(
2023
- qt,
2023
+ Ht,
2024
2024
  {
2025
2025
  value: $,
2026
2026
  onChange: v,
2027
2027
  className: g(
2028
2028
  "mt-2 h-8 w-full rounded-md px-2 text-[12.5px] outline-none",
2029
- r.input
2029
+ s.input
2030
2030
  ),
2031
2031
  options: [
2032
2032
  { value: "", label: "Choose a role…" },
2033
- ...p.map((c) => ({ value: c.id, label: c.name }))
2033
+ ...m.map((p) => ({ value: p.id, label: p.name }))
2034
2034
  ]
2035
2035
  }
2036
2036
  )
@@ -2040,42 +2040,42 @@ function dl({
2040
2040
  "button",
2041
2041
  {
2042
2042
  type: "button",
2043
- disabled: !me || f.isPending || S === "role" && !$,
2043
+ disabled: !pe || f.isPending || S === "role" && !$,
2044
2044
  onClick: () => f.mutate(
2045
- te ? {
2046
- name: y.trim() || s,
2047
- topic: A.trim() || null,
2048
- icon: E.icon,
2049
- color: E.color
2045
+ X ? {
2046
+ name: y.trim() || r,
2047
+ topic: M.trim() || null,
2048
+ icon: q.icon,
2049
+ color: q.color
2050
2050
  } : {
2051
- name: y.trim() || s,
2052
- topic: A.trim() || null,
2051
+ name: y.trim() || r,
2052
+ topic: M.trim() || null,
2053
2053
  visibility: S,
2054
2054
  role: S === "role" ? $ : null,
2055
- icon: E.icon,
2056
- color: E.color
2055
+ icon: q.icon,
2056
+ color: q.color
2057
2057
  }
2058
2058
  ),
2059
2059
  className: g(
2060
2060
  "rounded-md px-2.5 py-1 text-[12px] font-medium disabled:opacity-40",
2061
- r.action
2061
+ s.action
2062
2062
  ),
2063
2063
  children: f.isPending ? "Saving…" : "Save"
2064
2064
  }
2065
2065
  ),
2066
- te ? /* @__PURE__ */ e("span", { className: "ml-auto text-[11px] text-slate-400", children: "Open to everyone · cannot be archived" }) : /* @__PURE__ */ e(
2066
+ X ? /* @__PURE__ */ e("span", { className: "ml-auto text-[11px] text-slate-400", children: "Open to everyone · cannot be archived" }) : /* @__PURE__ */ e(
2067
2067
  "button",
2068
2068
  {
2069
2069
  type: "button",
2070
- onClick: () => Y(!0),
2071
- disabled: ee,
2070
+ onClick: () => Z(!0),
2071
+ disabled: V,
2072
2072
  className: "ml-auto rounded-md px-2 py-1 text-[11.5px] font-medium text-red-500 hover:bg-red-50 disabled:opacity-40 dark:hover:bg-red-950/40",
2073
2073
  "data-chat-archive-everyone": !0,
2074
2074
  children: "Archive for everyone"
2075
2075
  }
2076
2076
  )
2077
2077
  ] }),
2078
- ee && !te && /* @__PURE__ */ a(
2078
+ V && !X && /* @__PURE__ */ a(
2079
2079
  "div",
2080
2080
  {
2081
2081
  className: "space-y-2 rounded-md border border-red-200 bg-red-50 p-2.5 text-[11.5px] leading-relaxed text-red-800 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",
@@ -2083,9 +2083,9 @@ function dl({
2083
2083
  children: [
2084
2084
  /* @__PURE__ */ a("p", { children: [
2085
2085
  "Archive ",
2086
- n.is_direct ? "this conversation" : `#${s}`,
2086
+ n.is_direct ? "this conversation" : `#${r}`,
2087
2087
  " for everyone? It closes for all ",
2088
- d.length ? `${d.length} ` : "",
2088
+ c.length ? `${c.length} ` : "",
2089
2089
  "members: it leaves their chat lists and nobody can read or post in it any more.",
2090
2090
  " ",
2091
2091
  n.is_direct ? /* @__PURE__ */ a(ke, { children: [
@@ -2115,7 +2115,7 @@ function dl({
2115
2115
  "button",
2116
2116
  {
2117
2117
  type: "button",
2118
- onClick: () => Y(!1),
2118
+ onClick: () => Z(!1),
2119
2119
  className: "h-7 rounded-md border border-slate-200 bg-white px-2.5 text-[12px] font-medium text-slate-700 hover:bg-muted dark:border-border dark:bg-card dark:text-slate-200",
2120
2120
  children: "Cancel"
2121
2121
  }
@@ -2124,104 +2124,104 @@ function dl({
2124
2124
  ]
2125
2125
  }
2126
2126
  ),
2127
- f.isError && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-500", children: Qn(f.error, "Could not save the changes") }),
2128
- !n.is_direct && /* @__PURE__ */ e(Es, { channel: n, th: r, isAdmin: i })
2127
+ f.isError && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-500", children: Zn(f.error, "Could not save the changes") }),
2128
+ !n.is_direct && /* @__PURE__ */ e(Es, { channel: n, th: s, isAdmin: i })
2129
2129
  ] }) : /* @__PURE__ */ a("p", { className: "text-[12px] leading-relaxed text-slate-500 dark:text-slate-400", children: [
2130
2130
  n.topic || "No topic set.",
2131
2131
  /* @__PURE__ */ e("br", {}),
2132
- te ? "Everyone in the portal can find and join General." : n.visibility === "private" ? "Invite only — you were added by the channel owner." : n.visibility === "role" ? "Everyone with a particular role can see this channel." : "Anyone in the portal can find and join this channel."
2132
+ X ? "Everyone in the portal can find and join General." : n.visibility === "private" ? "Invite only — you were added by the channel owner." : n.visibility === "role" ? "Everyone with a particular role can see this channel." : "Anyone in the portal can find and join this channel."
2133
2133
  ] }),
2134
2134
  /* @__PURE__ */ a("div", { children: [
2135
2135
  /* @__PURE__ */ a("p", { className: "mb-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
2136
2136
  "Members ",
2137
- d.length > 0 && `· ${d.length}`
2137
+ c.length > 0 && `· ${c.length}`
2138
2138
  ] }),
2139
2139
  x && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "Loading…" }),
2140
- d.map((c) => {
2141
- const L = [c.first_name, c.last_name].filter(Boolean).join(" ") || c.email || c.user;
2140
+ c.map((p) => {
2141
+ const E = [p.first_name, p.last_name].filter(Boolean).join(" ") || p.email || p.user;
2142
2142
  return /* @__PURE__ */ a("div", { className: "flex items-center gap-2 rounded-lg px-1 py-1", children: [
2143
- /* @__PURE__ */ e(Q, { id: c.user, name: L }),
2144
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: L }),
2143
+ /* @__PURE__ */ e(K, { id: p.user, name: E }),
2144
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: E }),
2145
2145
  oe && /* @__PURE__ */ e(
2146
2146
  "button",
2147
2147
  {
2148
2148
  type: "button",
2149
2149
  title: "Remove from channel",
2150
- onClick: () => b.mutate(c.user),
2150
+ onClick: () => b.mutate(p.user),
2151
2151
  className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-red-500 dark:hover:bg-muted",
2152
- children: /* @__PURE__ */ e(pt, { className: "h-3 w-3" })
2152
+ children: /* @__PURE__ */ e(bt, { className: "h-3 w-3" })
2153
2153
  }
2154
2154
  )
2155
- ] }, c.user);
2155
+ ] }, p.user);
2156
2156
  }),
2157
2157
  oe && S === "private" && /* @__PURE__ */ a("div", { className: "mt-2", children: [
2158
2158
  /* @__PURE__ */ e(
2159
2159
  "input",
2160
2160
  {
2161
2161
  value: G,
2162
- onChange: (c) => F(c.target.value),
2162
+ onChange: (p) => H(p.target.value),
2163
2163
  placeholder: "Add someone…",
2164
- className: g("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
2164
+ className: g("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", s.input)
2165
2165
  }
2166
2166
  ),
2167
- G.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-40 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: K.filter((c) => !se.has(String(c.id).toUpperCase())).map((c) => {
2168
- const L = [c.first_name, c.last_name].filter(Boolean).join(" ") || c.email || c.id;
2167
+ G.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-40 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: J.filter((p) => !se.has(String(p.id).toUpperCase())).map((p) => {
2168
+ const E = [p.first_name, p.last_name].filter(Boolean).join(" ") || p.email || p.id;
2169
2169
  return /* @__PURE__ */ a(
2170
2170
  "button",
2171
2171
  {
2172
2172
  type: "button",
2173
2173
  onClick: () => {
2174
- u.mutate(c.id), F("");
2174
+ d.mutate(p.id), H("");
2175
2175
  },
2176
2176
  className: "flex w-full items-center gap-2 px-2 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-muted/50",
2177
2177
  children: [
2178
- /* @__PURE__ */ e(Q, { id: c.id, name: L }),
2179
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: L })
2178
+ /* @__PURE__ */ e(K, { id: p.id, name: E }),
2179
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: E })
2180
2180
  ]
2181
2181
  },
2182
- c.id
2182
+ p.id
2183
2183
  );
2184
2184
  }) }),
2185
2185
  /* @__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." })
2186
2186
  ] }),
2187
- oe && !n.is_direct && /* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e(qs, { channelId: n.id, th: r }) })
2187
+ oe && !n.is_direct && /* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e(qs, { channelId: n.id, th: s }) })
2188
2188
  ] }),
2189
- oe && !n.is_direct && n.id !== 0 && /* @__PURE__ */ e(Is, { channelId: n.id, border: r.divider }),
2190
- !n.is_direct && /* @__PURE__ */ e(Bs, { channelId: n.id, th: r })
2189
+ oe && !n.is_direct && n.id !== 0 && /* @__PURE__ */ e(Is, { channelId: n.id, border: s.divider }),
2190
+ !n.is_direct && /* @__PURE__ */ e(Bs, { channelId: n.id, th: s })
2191
2191
  ] })
2192
2192
  ] });
2193
2193
  }
2194
- function mt(n, s) {
2195
- const [l, r] = T(n);
2194
+ function xt(n, r) {
2195
+ const [l, s] = T(n);
2196
2196
  return ae(() => {
2197
- const o = setTimeout(() => r(n), s);
2197
+ const o = setTimeout(() => s(n), r);
2198
2198
  return () => clearTimeout(o);
2199
- }, [n, s]), l;
2199
+ }, [n, r]), l;
2200
2200
  }
2201
- function xa(n) {
2202
- var s;
2203
- return n ? n.kind === "dm" || n.kind === "entity" || n.kind === "channel" && !!((s = n.channel) != null && s.is_direct) : !1;
2201
+ function ya(n) {
2202
+ var r;
2203
+ return n ? n.kind === "dm" || n.kind === "entity" || n.kind === "channel" && !!((r = n.channel) != null && r.is_direct) : !1;
2204
2204
  }
2205
- const Dt = [
2205
+ const At = [
2206
2206
  { value: "recent", label: "Recent activity" },
2207
2207
  { value: "unread", label: "Unread first" },
2208
2208
  { value: "alpha", label: "A–Z" }
2209
2209
  ];
2210
- function Fn(n) {
2211
- var s;
2212
- return (s = n.lastMessage) != null && s.date_created ? new Date(n.lastMessage.date_created).getTime() : 0;
2210
+ function Qn(n) {
2211
+ var r;
2212
+ return (r = n.lastMessage) != null && r.date_created ? new Date(n.lastMessage.date_created).getTime() : 0;
2213
2213
  }
2214
- function ul(n, s) {
2215
- const l = (i, p) => i.label.localeCompare(p.label), r = (i, p) => Fn(p) - Fn(i) || l(i, p), o = [...n];
2216
- return s === "alpha" ? o.sort(l) : s === "unread" ? o.sort((i, p) => +(p.unread > 0) - +(i.unread > 0) || r(i, p)) : o.sort(r);
2214
+ function ul(n, r) {
2215
+ const l = (i, m) => i.label.localeCompare(m.label), s = (i, m) => Qn(m) - Qn(i) || l(i, m), o = [...n];
2216
+ return r === "alpha" ? o.sort(l) : r === "unread" ? o.sort((i, m) => +(m.unread > 0) - +(i.unread > 0) || s(i, m)) : o.sort(s);
2217
2217
  }
2218
2218
  function ml({
2219
2219
  value: n,
2220
- onChange: s
2220
+ onChange: r
2221
2221
  }) {
2222
- const [l, r] = T(!1), o = Dt.find((i) => i.value === n) ?? Dt[0];
2223
- return /* @__PURE__ */ a(Ve, { open: l, onOpenChange: r, children: [
2224
- /* @__PURE__ */ e(Xe, { asChild: !0, children: /* @__PURE__ */ e(
2222
+ const [l, s] = T(!1), o = At.find((i) => i.value === n) ?? At[0];
2223
+ return /* @__PURE__ */ a(nt, { open: l, onOpenChange: s, children: [
2224
+ /* @__PURE__ */ e(at, { asChild: !0, children: /* @__PURE__ */ e(
2225
2225
  "button",
2226
2226
  {
2227
2227
  type: "button",
@@ -2232,20 +2232,20 @@ function ml({
2232
2232
  children: /* @__PURE__ */ e(ls, { className: "h-3.5 w-3.5", strokeWidth: 2 })
2233
2233
  }
2234
2234
  ) }),
2235
- /* @__PURE__ */ a(et, { align: "end", className: "w-44 p-1", children: [
2235
+ /* @__PURE__ */ a(st, { align: "end", className: "w-44 p-1", children: [
2236
2236
  /* @__PURE__ */ e("p", { className: "px-2 pb-1 pt-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: "Sort rooms" }),
2237
- Dt.map((i) => /* @__PURE__ */ a(
2237
+ At.map((i) => /* @__PURE__ */ a(
2238
2238
  "button",
2239
2239
  {
2240
2240
  type: "button",
2241
2241
  onClick: () => {
2242
- s(i.value), r(!1);
2242
+ r(i.value), s(!1);
2243
2243
  },
2244
2244
  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",
2245
2245
  "data-chat-sort-option": i.value,
2246
2246
  children: [
2247
2247
  i.label,
2248
- i.value === n && /* @__PURE__ */ e(It, { className: "h-3.5 w-3.5", strokeWidth: 2 })
2248
+ i.value === n && /* @__PURE__ */ e(Bt, { className: "h-3.5 w-3.5", strokeWidth: 2 })
2249
2249
  ]
2250
2250
  },
2251
2251
  i.value
@@ -2253,32 +2253,32 @@ function ml({
2253
2253
  ] })
2254
2254
  ] });
2255
2255
  }
2256
- function Hn({
2256
+ function Kn({
2257
2257
  rooms: n,
2258
- onOpen: s,
2258
+ onOpen: r,
2259
2259
  onNewGroup: l,
2260
- archivedView: r = !1,
2260
+ archivedView: s = !1,
2261
2261
  loading: o = !1,
2262
2262
  onView: i
2263
2263
  }) {
2264
- const p = ue(), d = Le(), { setMuted: x, leave: f, setArchived: u, setStarred: b } = Wt(), y = Ws(), D = ve(
2264
+ const m = me(), c = Le(), { setMuted: x, leave: f, setArchived: d, setStarred: b } = Gt(), y = Ws(), U = ve(
2265
2265
  () => new Map(
2266
- d.onlineUsers.map((c) => [
2267
- String(c.user_id).toUpperCase(),
2268
- c.is_idle ? "idle" : "online"
2266
+ c.onlineUsers.map((p) => [
2267
+ String(p.user_id).toUpperCase(),
2268
+ p.is_idle ? "idle" : "online"
2269
2269
  ])
2270
2270
  ),
2271
- [d.onlineUsers]
2272
- ), A = Ht(), C = $r(), [S, B] = T(""), $ = mt(S.trim(), 250), { hits: v, meaning: E, loading: J } = Ys($, y.filters), G = $.length >= 2 || y.active, F = ve(() => {
2273
- const c = /* @__PURE__ */ new Map();
2274
- for (const L of v) c.set(L.room, [...c.get(L.room) ?? [], L]);
2275
- return [...c.entries()].sort((L, m) => m[1].length - L[1].length);
2276
- }, [v]), R = n.filter((c) => c.unread > 0 && !c.muted).length, K = gr(), ee = ve(() => new Map(n.map((c) => [c.room, c])), [n]), Y = Bt(), te = Xn(), oe = Y.chat_sidebar_sort === "unread" || Y.chat_sidebar_sort === "alpha" ? Y.chat_sidebar_sort : "recent", se = ul(
2277
- $ ? n.filter((c) => c.label.toLowerCase().includes($.toLowerCase())) : n,
2271
+ [c.onlineUsers]
2272
+ ), M = Kt(), C = $r(), [S, W] = T(""), $ = xt(S.trim(), 250), { hits: v, meaning: q, loading: Y } = Ys($, y.filters), G = $.length >= 2 || y.active, H = ve(() => {
2273
+ const p = /* @__PURE__ */ new Map();
2274
+ for (const E of v) p.set(E.room, [...p.get(E.room) ?? [], E]);
2275
+ return [...p.entries()].sort((E, u) => u[1].length - E[1].length);
2276
+ }, [v]), R = n.filter((p) => p.unread > 0 && !p.muted).length, J = gr(), V = ve(() => new Map(n.map((p) => [p.room, p])), [n]), Z = zt(), X = aa(), oe = Z.chat_sidebar_sort === "unread" || Z.chat_sidebar_sort === "alpha" ? Z.chat_sidebar_sort : "recent", se = ul(
2277
+ $ ? n.filter((p) => p.label.toLowerCase().includes($.toLowerCase())) : n,
2278
2278
  oe
2279
- ), me = (c) => {
2280
- var L;
2281
- return c.kind === "channel" && ((L = c.channel) == null ? void 0 : L.is_direct);
2279
+ ), pe = (p) => {
2280
+ var E;
2281
+ return p.kind === "channel" && ((E = p.channel) == null ? void 0 : E.is_direct);
2282
2282
  };
2283
2283
  return /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", "data-chat-room-list": !0, children: [
2284
2284
  /* @__PURE__ */ a("div", { className: "mb-1.5 flex items-center gap-1.5 px-1", children: [
@@ -2286,25 +2286,25 @@ function Hn({
2286
2286
  "input",
2287
2287
  {
2288
2288
  value: S,
2289
- onChange: (c) => B(c.target.value),
2289
+ onChange: (p) => W(p.target.value),
2290
2290
  placeholder: "Search rooms & messages…",
2291
2291
  className: g(
2292
2292
  "h-7 min-w-0 flex-1 rounded-md border px-2 text-[12px] outline-none",
2293
- p.input
2293
+ m.input
2294
2294
  ),
2295
2295
  "aria-label": "Search rooms and messages",
2296
2296
  "data-chat-global-search": !0
2297
2297
  }
2298
2298
  ),
2299
- !r && /* @__PURE__ */ e(Fs, { open: y.open, active: y.active, onClick: () => y.setOpen(!y.open) }),
2299
+ !s && /* @__PURE__ */ e(Fs, { open: y.open, active: y.active, onClick: () => y.setOpen(!y.open) }),
2300
2300
  /* @__PURE__ */ e(
2301
2301
  ml,
2302
2302
  {
2303
2303
  value: oe,
2304
- onChange: (c) => te.mutate({ chat_sidebar_sort: c === "recent" ? null : c })
2304
+ onChange: (p) => X.mutate({ chat_sidebar_sort: p === "recent" ? null : p })
2305
2305
  }
2306
2306
  ),
2307
- !r && /* @__PURE__ */ e(Hs, {}),
2307
+ !s && /* @__PURE__ */ e(Hs, {}),
2308
2308
  l && /* @__PURE__ */ e(
2309
2309
  "button",
2310
2310
  {
@@ -2313,12 +2313,12 @@ function Hn({
2313
2313
  title: "New group conversation",
2314
2314
  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",
2315
2315
  "data-chat-new-group": !0,
2316
- children: /* @__PURE__ */ e(At, { className: "h-3.5 w-3.5", strokeWidth: 2 })
2316
+ children: /* @__PURE__ */ e(Pt, { className: "h-3.5 w-3.5", strokeWidth: 2 })
2317
2317
  }
2318
2318
  )
2319
2319
  ] }),
2320
- !r && y.open && /* @__PURE__ */ e(zs, { filters: y.filters, onChange: y.setFilters, rooms: n, th: p }),
2321
- !r && i && !G && /* @__PURE__ */ a("div", { className: "mb-1 flex flex-wrap gap-1 px-1", "data-chat-view-links": !0, children: [
2320
+ !s && y.open && /* @__PURE__ */ e(zs, { filters: y.filters, onChange: y.setFilters, rooms: n, th: m }),
2321
+ !s && i && !G && /* @__PURE__ */ a("div", { className: "mb-1 flex flex-wrap gap-1 px-1", "data-chat-view-links": !0, children: [
2322
2322
  /* @__PURE__ */ a(
2323
2323
  "button",
2324
2324
  {
@@ -2352,7 +2352,7 @@ function Hn({
2352
2352
  onClick: () => i("catchup"),
2353
2353
  className: g(
2354
2354
  "inline-flex h-6 items-center gap-1 rounded-full px-2 text-[11px] font-medium",
2355
- p.accentSoft
2355
+ m.accentSoft
2356
2356
  ),
2357
2357
  "data-chat-view": "catchup",
2358
2358
  children: [
@@ -2364,55 +2364,55 @@ function Hn({
2364
2364
  }
2365
2365
  )
2366
2366
  ] }),
2367
- G && !r && /* @__PURE__ */ a("div", { className: "mb-1.5", "data-chat-search-results": !0, children: [
2367
+ G && !s && /* @__PURE__ */ a("div", { className: "mb-1.5", "data-chat-search-results": !0, children: [
2368
2368
  /* @__PURE__ */ a("p", { className: "px-2.5 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
2369
2369
  "Messages",
2370
2370
  v.length ? ` · ${v.length}` : ""
2371
2371
  ] }),
2372
- J ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "Searching…" }) : v.length === 0 ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "No messages match." }) : F.map(([c, L]) => {
2373
- const m = ee.get(c);
2374
- return /* @__PURE__ */ a("div", { className: "mb-1", "data-chat-search-group": c, children: [
2372
+ Y ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "Searching…" }) : v.length === 0 ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "No messages match." }) : H.map(([p, E]) => {
2373
+ const u = V.get(p);
2374
+ return /* @__PURE__ */ a("div", { className: "mb-1", "data-chat-search-group": p, children: [
2375
2375
  /* @__PURE__ */ a("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: [
2376
- /* @__PURE__ */ e("span", { className: "truncate", children: (m == null ? void 0 : m.label) ?? c }),
2377
- /* @__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: L.length })
2376
+ /* @__PURE__ */ e("span", { className: "truncate", children: (u == null ? void 0 : u.label) ?? p }),
2377
+ /* @__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: E.length })
2378
2378
  ] }),
2379
- L.slice(0, 5).map((Z) => /* @__PURE__ */ a(
2379
+ E.slice(0, 5).map((P) => /* @__PURE__ */ a(
2380
2380
  "button",
2381
2381
  {
2382
2382
  type: "button",
2383
- disabled: !m,
2383
+ disabled: !u,
2384
2384
  onClick: () => {
2385
- m && s(m, { around: Z.parent_id ?? Z.id });
2385
+ u && r(u, { around: P.parent_id ?? P.id });
2386
2386
  },
2387
2387
  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",
2388
- "data-chat-search-hit": Z.id,
2388
+ "data-chat-search-hit": P.id,
2389
2389
  children: [
2390
2390
  /* @__PURE__ */ a("span", { className: "flex items-center gap-1.5 text-[10.5px] text-slate-400", children: [
2391
- /* @__PURE__ */ e("span", { className: "truncate", children: Z.sender_name ?? "Someone" }),
2392
- /* @__PURE__ */ e("span", { className: "ml-auto shrink-0", children: Us(Z.date_created) })
2391
+ /* @__PURE__ */ e("span", { className: "truncate", children: P.sender_name ?? "Someone" }),
2392
+ /* @__PURE__ */ e("span", { className: "ml-auto shrink-0", children: Ds(P.date_created) })
2393
2393
  ] }),
2394
- /* @__PURE__ */ e("span", { className: "line-clamp-2 text-[12px] text-slate-700 dark:text-slate-200", children: Z.message })
2394
+ /* @__PURE__ */ e("span", { className: "line-clamp-2 text-[12px] text-slate-700 dark:text-slate-200", children: P.message })
2395
2395
  ]
2396
2396
  },
2397
- Z.id
2397
+ P.id
2398
2398
  )),
2399
- L.length > 5 && m && /* @__PURE__ */ a(
2399
+ E.length > 5 && u && /* @__PURE__ */ a(
2400
2400
  "button",
2401
2401
  {
2402
2402
  type: "button",
2403
- onClick: () => y.setFilters({ ...y.filters, room: c }),
2404
- className: g("px-2.5 py-0.5 text-[11px] font-medium", p.accentText),
2403
+ onClick: () => y.setFilters({ ...y.filters, room: p }),
2404
+ className: g("px-2.5 py-0.5 text-[11px] font-medium", m.accentText),
2405
2405
  children: [
2406
2406
  "All ",
2407
- L.length,
2407
+ E.length,
2408
2408
  " in ",
2409
- m.label
2409
+ u.label
2410
2410
  ]
2411
2411
  }
2412
2412
  )
2413
- ] }, c);
2413
+ ] }, p);
2414
2414
  }),
2415
- !J && E === "words" && /* @__PURE__ */ e(
2415
+ !Y && q === "words" && /* @__PURE__ */ e(
2416
2416
  "p",
2417
2417
  {
2418
2418
  className: "px-2.5 pb-1 pt-1.5 text-[10.5px] leading-snug text-slate-400",
@@ -2421,15 +2421,15 @@ function Hn({
2421
2421
  }
2422
2422
  )
2423
2423
  ] }),
2424
- r && !o && n.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." }),
2425
- r && o && /* @__PURE__ */ e("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: "Loading…" }),
2426
- !r && A.bot_name && A.bot_user_id && d.me && /* @__PURE__ */ a(
2424
+ s && !o && n.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." }),
2425
+ s && o && /* @__PURE__ */ e("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: "Loading…" }),
2426
+ !s && M.bot_name && M.bot_user_id && c.me && /* @__PURE__ */ a(
2427
2427
  "button",
2428
2428
  {
2429
2429
  type: "button",
2430
- onClick: () => s({
2431
- room: Rt(d.me.id, A.bot_user_id),
2432
- label: `@${A.bot_name}`,
2430
+ onClick: () => r({
2431
+ room: It(c.me.id, M.bot_user_id),
2432
+ label: `@${M.bot_name}`,
2433
2433
  kind: "dm",
2434
2434
  lastMessage: null,
2435
2435
  unread: 0,
@@ -2446,7 +2446,7 @@ function Hn({
2446
2446
  {
2447
2447
  className: g(
2448
2448
  "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-[13px] font-bold",
2449
- p.accentSoft
2449
+ m.accentSoft
2450
2450
  ),
2451
2451
  children: "@"
2452
2452
  }
@@ -2454,7 +2454,7 @@ function Hn({
2454
2454
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
2455
2455
  /* @__PURE__ */ a("span", { className: "block truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: [
2456
2456
  "Ask @",
2457
- A.bot_name
2457
+ M.bot_name
2458
2458
  ] }),
2459
2459
  /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: "Your AI assistant — questions, summaries, reminders" })
2460
2460
  ] })
@@ -2462,53 +2462,53 @@ function Hn({
2462
2462
  }
2463
2463
  ),
2464
2464
  [
2465
- ["Starred", se.filter((c) => c.starred)],
2465
+ ["Starred", se.filter((p) => p.starred)],
2466
2466
  [
2467
2467
  "Channels",
2468
2468
  se.filter(
2469
- (c) => !c.starred && (c.kind === "global" || c.kind === "channel") && !me(c)
2469
+ (p) => !p.starred && (p.kind === "global" || p.kind === "channel") && !pe(p)
2470
2470
  )
2471
2471
  ],
2472
2472
  [
2473
2473
  "Direct messages",
2474
- se.filter((c) => !c.starred && (c.kind === "dm" || me(c)))
2474
+ se.filter((p) => !p.starred && (p.kind === "dm" || pe(p)))
2475
2475
  ],
2476
- ["Records", se.filter((c) => !c.starred && c.kind === "entity")]
2476
+ ["Records", se.filter((p) => !p.starred && p.kind === "entity")]
2477
2477
  ].map(
2478
- ([c, L]) => L.length === 0 ? null : /* @__PURE__ */ a("div", { className: "mb-1.5", children: [
2479
- /* @__PURE__ */ e("p", { className: "px-2.5 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: c }),
2480
- L.map((m) => {
2481
- var Z, De, he, Pe, Ne, Ue;
2478
+ ([p, E]) => E.length === 0 ? null : /* @__PURE__ */ a("div", { className: "mb-1.5", children: [
2479
+ /* @__PURE__ */ e("p", { className: "px-2.5 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: p }),
2480
+ E.map((u) => {
2481
+ var P, Ce, we, Pe, _e, Ae;
2482
2482
  return /* @__PURE__ */ a("div", { className: "group/room relative", children: [
2483
2483
  /* @__PURE__ */ a(
2484
2484
  "button",
2485
2485
  {
2486
2486
  type: "button",
2487
- onClick: () => s(m),
2487
+ onClick: () => r(u),
2488
2488
  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",
2489
2489
  children: [
2490
2490
  (() => {
2491
- const Ce = m.kind === "dm" && d.me ? Se(m.room, d.me.id) : null;
2492
- if (!Ce) return null;
2493
- const k = D.get(Ce.toUpperCase()) ?? "offline";
2494
- return /* @__PURE__ */ e("span", { className: "relative shrink-0", "data-chat-room-avatar": k, children: /* @__PURE__ */ e(Q, { id: Ce, name: m.label, size: 32 }) });
2491
+ const ie = u.kind === "dm" && c.me ? Te(u.room, c.me.id) : null;
2492
+ if (!ie) return null;
2493
+ const ze = U.get(ie.toUpperCase()) ?? "offline";
2494
+ return /* @__PURE__ */ e("span", { className: "relative shrink-0", "data-chat-room-avatar": ze, children: /* @__PURE__ */ e(K, { id: ie, name: u.label, size: 32 }) });
2495
2495
  })(),
2496
- m.kind === "channel" && !((Z = m.channel) != null && Z.is_direct) || m.kind === "global" && ((De = m.channel) != null && De.icon || (he = m.channel) != null && he.color) ? /* @__PURE__ */ e(Ye, { icon: (Pe = m.channel) == null ? void 0 : Pe.icon, color: (Ne = m.channel) == null ? void 0 : Ne.color, size: 32 }) : /* @__PURE__ */ e(
2496
+ u.kind === "channel" && !((P = u.channel) != null && P.is_direct) || u.kind === "global" && ((Ce = u.channel) != null && Ce.icon || (we = u.channel) != null && we.color) ? /* @__PURE__ */ e(et, { icon: (Pe = u.channel) == null ? void 0 : Pe.icon, color: (_e = u.channel) == null ? void 0 : _e.color, size: 32 }) : /* @__PURE__ */ e(
2497
2497
  "span",
2498
2498
  {
2499
2499
  className: g(
2500
2500
  "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",
2501
- m.kind === "dm" && d.me && Se(m.room, d.me.id) && "hidden"
2501
+ u.kind === "dm" && c.me && Te(u.room, c.me.id) && "hidden"
2502
2502
  ),
2503
- children: m.kind === "dm" ? /* @__PURE__ */ e(Gn, { className: "h-4 w-4", strokeWidth: 1.8 }) : (Ue = m.channel) != null && Ue.is_direct ? /* @__PURE__ */ e(At, { className: "h-4 w-4", strokeWidth: 1.8 }) : /* @__PURE__ */ e($t, { className: "h-4 w-4", strokeWidth: 1.8 })
2503
+ children: u.kind === "dm" ? /* @__PURE__ */ e(Yn, { className: "h-4 w-4", strokeWidth: 1.8 }) : (Ae = u.channel) != null && Ae.is_direct ? /* @__PURE__ */ e(Pt, { className: "h-4 w-4", strokeWidth: 1.8 }) : /* @__PURE__ */ e(Ot, { className: "h-4 w-4", strokeWidth: 1.8 })
2504
2504
  }
2505
2505
  ),
2506
2506
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
2507
2507
  /* @__PURE__ */ a("span", { className: "flex items-center gap-1.5", children: [
2508
- /* @__PURE__ */ e("span", { className: "truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: m.label }),
2509
- m.muted && /* @__PURE__ */ e(Dn, { className: "h-3 w-3 shrink-0 text-slate-300", strokeWidth: 2 }),
2510
- /* @__PURE__ */ e(Sr, { count: C.countFor(m.room), label: m.label }),
2511
- K.has(m.room) && /* @__PURE__ */ e(
2508
+ /* @__PURE__ */ e("span", { className: "truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: u.label }),
2509
+ u.muted && /* @__PURE__ */ e(An, { className: "h-3 w-3 shrink-0 text-slate-300", strokeWidth: 2 }),
2510
+ /* @__PURE__ */ e(Sr, { count: C.countFor(u.room), label: u.label }),
2511
+ J.has(u.room) && /* @__PURE__ */ e(
2512
2512
  Xa,
2513
2513
  {
2514
2514
  className: "h-3 w-3 shrink-0 text-slate-400",
@@ -2519,131 +2519,131 @@ function Hn({
2519
2519
  }
2520
2520
  )
2521
2521
  ] }),
2522
- m.lastMessage && /* @__PURE__ */ a("span", { className: "block truncate text-[11px] text-slate-400", children: [
2523
- m.lastMessage.sender_name ? `${m.lastMessage.sender_name}: ` : "",
2524
- m.lastMessage.message
2522
+ u.lastMessage && /* @__PURE__ */ a("span", { className: "block truncate text-[11px] text-slate-400", children: [
2523
+ u.lastMessage.sender_name ? `${u.lastMessage.sender_name}: ` : "",
2524
+ u.lastMessage.message
2525
2525
  ] })
2526
2526
  ] }),
2527
- (m.mentions ?? 0) > 0 && /* @__PURE__ */ e(
2527
+ (u.mentions ?? 0) > 0 && /* @__PURE__ */ e(
2528
2528
  "span",
2529
2529
  {
2530
2530
  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",
2531
- title: `${m.mentions} mention you`,
2532
- "data-chat-room-mentions": m.mentions,
2531
+ title: `${u.mentions} mention you`,
2532
+ "data-chat-room-mentions": u.mentions,
2533
2533
  children: "@"
2534
2534
  }
2535
2535
  ),
2536
- m.unread > 0 && /* @__PURE__ */ e(
2536
+ u.unread > 0 && /* @__PURE__ */ e(
2537
2537
  "span",
2538
2538
  {
2539
2539
  className: g(
2540
2540
  "flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-1.5 text-[10px] font-bold",
2541
2541
  // A muted room still counts, but quietly — it must not
2542
2542
  // read like something demanding attention.
2543
- m.muted ? "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500" : p.pill
2543
+ u.muted ? "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500" : m.pill
2544
2544
  ),
2545
- children: m.unread > 99 ? "99+" : m.unread
2545
+ children: u.unread > 99 ? "99+" : u.unread
2546
2546
  }
2547
2547
  )
2548
2548
  ]
2549
2549
  }
2550
2550
  ),
2551
2551
  /* @__PURE__ */ a("span", { className: "absolute right-1.5 top-1.5 hidden items-center gap-0.5 group-hover/room:flex", children: [
2552
- !r && /* @__PURE__ */ e(
2552
+ !s && /* @__PURE__ */ e(
2553
2553
  "button",
2554
2554
  {
2555
2555
  type: "button",
2556
- title: m.starred ? "Unstar" : "Star — keep it at the top",
2557
- "aria-label": m.starred ? `Unstar ${m.label}` : `Star ${m.label}`,
2558
- onClick: () => b.mutate({ room: m.room, starred: !m.starred }),
2556
+ title: u.starred ? "Unstar" : "Star — keep it at the top",
2557
+ "aria-label": u.starred ? `Unstar ${u.label}` : `Star ${u.label}`,
2558
+ onClick: () => b.mutate({ room: u.room, starred: !u.starred }),
2559
2559
  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",
2560
- "data-chat-row-star": m.starred ? "on" : "off",
2560
+ "data-chat-row-star": u.starred ? "on" : "off",
2561
2561
  children: /* @__PURE__ */ e(
2562
2562
  es,
2563
2563
  {
2564
- className: g("h-3 w-3", m.starred && "fill-amber-400 text-amber-500")
2564
+ className: g("h-3 w-3", u.starred && "fill-amber-400 text-amber-500")
2565
2565
  }
2566
2566
  )
2567
2567
  }
2568
2568
  ),
2569
- xa(m) && /* @__PURE__ */ e(
2569
+ ya(u) && /* @__PURE__ */ e(
2570
2570
  "button",
2571
2571
  {
2572
2572
  type: "button",
2573
- 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.",
2574
- "aria-label": r ? `Unarchive ${m.label}` : `Archive ${m.label} for me`,
2575
- onClick: () => u.mutate({ room: m.room, archived: !r }),
2573
+ 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.",
2574
+ "aria-label": s ? `Unarchive ${u.label}` : `Archive ${u.label} for me`,
2575
+ onClick: () => d.mutate({ room: u.room, archived: !s }),
2576
2576
  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",
2577
- "data-chat-row-archive": r ? "unarchive" : "archive",
2578
- children: r ? /* @__PURE__ */ e(ts, { className: "h-3 w-3" }) : /* @__PURE__ */ e(ns, { className: "h-3 w-3" })
2577
+ "data-chat-row-archive": s ? "unarchive" : "archive",
2578
+ children: s ? /* @__PURE__ */ e(ts, { className: "h-3 w-3" }) : /* @__PURE__ */ e(ns, { className: "h-3 w-3" })
2579
2579
  }
2580
2580
  ),
2581
2581
  /* @__PURE__ */ e(
2582
2582
  "button",
2583
2583
  {
2584
2584
  type: "button",
2585
- title: m.muted ? "Unmute" : "Mute",
2586
- onClick: () => x.mutate({ room: m.room, muted: !m.muted }),
2585
+ title: u.muted ? "Unmute" : "Mute",
2586
+ onClick: () => x.mutate({ room: u.room, muted: !u.muted }),
2587
2587
  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",
2588
- children: m.muted ? /* @__PURE__ */ e(as, { className: "h-3 w-3" }) : /* @__PURE__ */ e(Dn, { className: "h-3 w-3" })
2588
+ children: u.muted ? /* @__PURE__ */ e(as, { className: "h-3 w-3" }) : /* @__PURE__ */ e(An, { className: "h-3 w-3" })
2589
2589
  }
2590
2590
  ),
2591
- (m.kind === "channel" || m.kind === "global" || m.kind === "entity") && m.joined && /* @__PURE__ */ e(
2591
+ (u.kind === "channel" || u.kind === "global" || u.kind === "entity") && u.joined && /* @__PURE__ */ e(
2592
2592
  "button",
2593
2593
  {
2594
2594
  type: "button",
2595
- title: m.kind === "global" ? "Leave General" : m.kind === "entity" ? "Leave this record's chat — open it from the record again to rejoin" : "Leave channel",
2596
- "aria-label": `Leave ${m.label}`,
2595
+ title: u.kind === "global" ? "Leave General" : u.kind === "entity" ? "Leave this record's chat — open it from the record again to rejoin" : "Leave channel",
2596
+ "aria-label": `Leave ${u.label}`,
2597
2597
  "data-chat-row-leave": !0,
2598
- onClick: () => f.mutate(m.room),
2598
+ onClick: () => f.mutate(u.room),
2599
2599
  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",
2600
2600
  children: /* @__PURE__ */ e(ss, { className: "h-3 w-3" })
2601
2601
  }
2602
2602
  )
2603
2603
  ] })
2604
- ] }, m.room);
2604
+ ] }, u.room);
2605
2605
  })
2606
- ] }, c)
2606
+ ] }, p)
2607
2607
  )
2608
2608
  ] });
2609
2609
  }
2610
- function yo({
2610
+ function ko({
2611
2611
  view: n,
2612
- rooms: s,
2612
+ rooms: r,
2613
2613
  onBack: l,
2614
- onOpen: r
2614
+ onOpen: s
2615
2615
  }) {
2616
- const o = ue();
2617
- return n === "mentions" ? /* @__PURE__ */ e(Yn, { th: o, onBack: l, onOpen: r }) : n === "scheduled" ? /* @__PURE__ */ e(
2618
- Zn,
2616
+ const o = me();
2617
+ return n === "mentions" ? /* @__PURE__ */ e(ea, { th: o, onBack: l, onOpen: s }) : n === "scheduled" ? /* @__PURE__ */ e(
2618
+ ta,
2619
2619
  {
2620
2620
  th: o,
2621
2621
  onBack: l,
2622
2622
  roomLabel: (i) => {
2623
- var p;
2624
- return ((p = s.find((d) => d.room === i)) == null ? void 0 : p.label) ?? i;
2623
+ var m;
2624
+ return ((m = r.find((c) => c.room === i)) == null ? void 0 : m.label) ?? i;
2625
2625
  }
2626
2626
  }
2627
- ) : /* @__PURE__ */ e(Vn, { rooms: s, th: o, onBack: l, onOpen: r });
2627
+ ) : /* @__PURE__ */ e(na, { rooms: r, th: o, onBack: l, onOpen: s });
2628
2628
  }
2629
2629
  function pl({
2630
2630
  onOpen: n
2631
2631
  }) {
2632
- const s = ue(), [l, r] = T(""), [o, i] = T(!1), [p, d] = T(""), [x, f] = T("open"), [u, b] = T(""), [y, D] = T({
2632
+ const r = me(), [l, s] = T(""), [o, i] = T(!1), [m, c] = T(""), [x, f] = T("open"), [d, b] = T(""), [y, U] = T({
2633
2633
  icon: null,
2634
2634
  color: null
2635
- }), A = ea(), { channels: C, loading: S } = Qs(l), { join: B } = Wt(), $ = Ks();
2635
+ }), M = sa(), { channels: C, loading: S } = Qs(l), { join: W } = Gt(), $ = Ks();
2636
2636
  return /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col", "data-chat-directory": !0, children: [
2637
2637
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2 p-2", children: [
2638
2638
  /* @__PURE__ */ a("div", { className: "relative flex-1", children: [
2639
- /* @__PURE__ */ e(zn, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
2639
+ /* @__PURE__ */ e(Jn, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
2640
2640
  /* @__PURE__ */ e(
2641
2641
  "input",
2642
2642
  {
2643
2643
  value: l,
2644
- onChange: (v) => r(v.target.value),
2644
+ onChange: (v) => s(v.target.value),
2645
2645
  placeholder: "Search channels…",
2646
- className: g("h-8 w-full rounded-md pl-8 pr-2 text-[12.5px] outline-none", s.input)
2646
+ className: g("h-8 w-full rounded-md pl-8 pr-2 text-[12.5px] outline-none", r.input)
2647
2647
  }
2648
2648
  )
2649
2649
  ] }),
@@ -2654,7 +2654,7 @@ function pl({
2654
2654
  onClick: () => i((v) => !v),
2655
2655
  className: g(
2656
2656
  "flex h-8 shrink-0 items-center gap-1 rounded-md px-2.5 text-[12px] font-medium",
2657
- s.action
2657
+ r.action
2658
2658
  ),
2659
2659
  children: [
2660
2660
  /* @__PURE__ */ e(za, { className: "h-3.5 w-3.5" }),
@@ -2668,53 +2668,53 @@ function pl({
2668
2668
  {
2669
2669
  className: "flex flex-col gap-2 border-b border-slate-100 p-2 dark:border-border/60",
2670
2670
  onSubmit: (v) => {
2671
- v.preventDefault(), p.trim() && (x === "role" && !u || $.mutate(
2671
+ v.preventDefault(), m.trim() && (x === "role" && !d || $.mutate(
2672
2672
  {
2673
- name: p.trim(),
2673
+ name: m.trim(),
2674
2674
  visibility: x,
2675
- role: x === "role" ? u : null,
2675
+ role: x === "role" ? d : null,
2676
2676
  icon: y.icon,
2677
2677
  color: y.color
2678
2678
  },
2679
2679
  {
2680
2680
  onSuccess: () => {
2681
- d(""), D({ icon: null, color: null }), i(!1);
2681
+ c(""), U({ icon: null, color: null }), i(!1);
2682
2682
  }
2683
2683
  }
2684
2684
  ));
2685
2685
  },
2686
2686
  children: [
2687
2687
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
2688
- /* @__PURE__ */ e(Ye, { icon: y.icon, color: y.color, size: 32 }),
2688
+ /* @__PURE__ */ e(et, { icon: y.icon, color: y.color, size: 32 }),
2689
2689
  /* @__PURE__ */ e(
2690
2690
  "input",
2691
2691
  {
2692
- value: p,
2693
- onChange: (v) => d(v.target.value),
2692
+ value: m,
2693
+ onChange: (v) => c(v.target.value),
2694
2694
  placeholder: "Channel name",
2695
2695
  className: g(
2696
2696
  "h-8 min-w-0 flex-1 rounded-md px-2 text-[12.5px] outline-none",
2697
- s.input
2697
+ r.input
2698
2698
  )
2699
2699
  }
2700
2700
  )
2701
2701
  ] }),
2702
- /* @__PURE__ */ e(Jn, { icon: y.icon, color: y.color, onChange: D }),
2702
+ /* @__PURE__ */ e(Xn, { icon: y.icon, color: y.color, onChange: U }),
2703
2703
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
2704
2704
  [
2705
2705
  ["open", "Anyone"],
2706
2706
  ["role", "One role"],
2707
2707
  ["private", "Invite only"]
2708
- ].map(([v, E]) => /* @__PURE__ */ e(
2708
+ ].map(([v, q]) => /* @__PURE__ */ e(
2709
2709
  "button",
2710
2710
  {
2711
2711
  type: "button",
2712
2712
  onClick: () => f(v),
2713
2713
  className: g(
2714
2714
  "rounded-md px-2 py-1 text-[11.5px] font-medium transition-colors",
2715
- x === v ? s.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
2715
+ x === v ? r.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
2716
2716
  ),
2717
- children: E
2717
+ children: q
2718
2718
  },
2719
2719
  v
2720
2720
  )),
@@ -2722,32 +2722,32 @@ function pl({
2722
2722
  "button",
2723
2723
  {
2724
2724
  type: "submit",
2725
- disabled: !p.trim() || $.isPending || x === "role" && !u,
2726
- className: g("ml-auto rounded-md px-2.5 py-1 text-[12px] font-medium", s.action),
2725
+ disabled: !m.trim() || $.isPending || x === "role" && !d,
2726
+ className: g("ml-auto rounded-md px-2.5 py-1 text-[12px] font-medium", r.action),
2727
2727
  children: $.isPending ? "Creating…" : "Create"
2728
2728
  }
2729
2729
  )
2730
2730
  ] }),
2731
2731
  x === "role" && /* @__PURE__ */ e(
2732
- qt,
2732
+ Ht,
2733
2733
  {
2734
- value: u,
2734
+ value: d,
2735
2735
  onChange: b,
2736
- className: g("h-8 w-auto rounded-md px-2 text-[12.5px] outline-none", s.input),
2736
+ className: g("h-8 w-auto rounded-md px-2 text-[12.5px] outline-none", r.input),
2737
2737
  options: [
2738
2738
  { value: "", label: "Choose a role…" },
2739
- ...A.map((v) => ({ value: v.id, label: v.name }))
2739
+ ...M.map((v) => ({ value: v.id, label: v.name }))
2740
2740
  ]
2741
2741
  }
2742
2742
  ),
2743
- $.isError && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-500", children: Qn($.error, "Could not create it") })
2743
+ $.isError && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-500", children: Zn($.error, "Could not create it") })
2744
2744
  ]
2745
2745
  }
2746
2746
  ),
2747
2747
  /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [
2748
2748
  S && /* @__PURE__ */ e("p", { className: "px-2 py-6 text-center text-[12px] text-slate-400", children: "Loading…" }),
2749
2749
  !S && C.length === 0 && /* @__PURE__ */ a("div", { className: "px-3 py-8 text-center", children: [
2750
- /* @__PURE__ */ e($t, { className: "mx-auto h-5 w-5 text-slate-300" }),
2750
+ /* @__PURE__ */ e(Ot, { className: "mx-auto h-5 w-5 text-slate-300" }),
2751
2751
  /* @__PURE__ */ e("p", { className: "mt-2 text-[12.5px] font-medium text-slate-600 dark:text-slate-300", children: l ? `No channel matches “${l}”` : "No channels yet" }),
2752
2752
  /* @__PURE__ */ e("p", { className: "mt-1 text-[11.5px] leading-relaxed text-slate-400", children: "Channels and General are shared rooms you join to follow. Record conversations appear on their own once someone posts on a record." })
2753
2753
  ] }),
@@ -2757,12 +2757,12 @@ function pl({
2757
2757
  className: "flex items-center gap-2.5 rounded-lg px-2.5 py-2 hover:bg-slate-50 dark:hover:bg-muted/50",
2758
2758
  children: [
2759
2759
  /* @__PURE__ */ e(
2760
- Ye,
2760
+ et,
2761
2761
  {
2762
2762
  icon: v.icon,
2763
2763
  color: v.color,
2764
2764
  size: 32,
2765
- fallback: v.visibility === "private" ? Ga : $t
2765
+ fallback: v.visibility === "private" ? Ga : Ot
2766
2766
  }
2767
2767
  ),
2768
2768
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
@@ -2773,7 +2773,7 @@ function pl({
2773
2773
  "button",
2774
2774
  {
2775
2775
  type: "button",
2776
- onClick: () => n(v.room, v.name, Bn(v)),
2776
+ onClick: () => n(v.room, v.name, zn(v)),
2777
2777
  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",
2778
2778
  children: "Open"
2779
2779
  }
@@ -2781,10 +2781,10 @@ function pl({
2781
2781
  "button",
2782
2782
  {
2783
2783
  type: "button",
2784
- onClick: () => B.mutate(v.room, {
2785
- onSuccess: () => n(v.room, v.name, Bn(v))
2784
+ onClick: () => W.mutate(v.room, {
2785
+ onSuccess: () => n(v.room, v.name, zn(v))
2786
2786
  }),
2787
- className: g("shrink-0 rounded-md px-2 py-1 text-[11.5px] font-medium", s.action),
2787
+ className: g("shrink-0 rounded-md px-2 py-1 text-[11.5px] font-medium", r.action),
2788
2788
  children: "Join"
2789
2789
  }
2790
2790
  )
@@ -2800,15 +2800,15 @@ function hl() {
2800
2800
  return n.setHours(23, 59, 59, 999), n;
2801
2801
  }
2802
2802
  function fl() {
2803
- const n = Bt(), s = Xn(), [l, r] = T(!1), o = n.presence_override, i = !!o && o.mode === "away" && !(o.until && new Date(o.until).getTime() < Date.now()), p = (x) => {
2804
- s.mutate({
2803
+ const n = zt(), r = aa(), [l, s] = T(!1), o = n.presence_override, i = !!o && o.mode === "away" && !(o.until && new Date(o.until).getTime() < Date.now()), m = (x) => {
2804
+ r.mutate({
2805
2805
  presence_override: x === "off" ? null : { mode: "away", until: (x == null ? void 0 : x.toISOString()) ?? null }
2806
- }), r(!1);
2807
- }, d = i && (o != null && o.until) ? `until ${new Date(o.until).toLocaleString("en-US", {
2806
+ }), s(!1);
2807
+ }, c = i && (o != null && o.until) ? `until ${new Date(o.until).toLocaleString("en-US", {
2808
2808
  weekday: "short",
2809
2809
  hour: "numeric",
2810
2810
  minute: "2-digit",
2811
- timeZone: jt() ?? void 0
2811
+ timeZone: Wt() ?? void 0
2812
2812
  })}` : i ? "until you switch it off" : null;
2813
2813
  return /* @__PURE__ */ a(
2814
2814
  "div",
@@ -2826,18 +2826,18 @@ function fl() {
2826
2826
  "aria-hidden": !0
2827
2827
  }
2828
2828
  ),
2829
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: i ? `Appearing away ${d}` : "You appear online" }),
2829
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: i ? `Appearing away ${c}` : "You appear online" }),
2830
2830
  i ? /* @__PURE__ */ e(
2831
2831
  "button",
2832
2832
  {
2833
2833
  type: "button",
2834
- onClick: () => p("off"),
2834
+ onClick: () => m("off"),
2835
2835
  className: "shrink-0 rounded px-1.5 py-0.5 text-[11px] font-medium text-slate-600 hover:bg-muted dark:text-slate-300",
2836
2836
  "data-chat-appear-away-off": !0,
2837
2837
  children: "Back online"
2838
2838
  }
2839
- ) : /* @__PURE__ */ a(Ve, { open: l, onOpenChange: r, children: [
2840
- /* @__PURE__ */ e(Xe, { asChild: !0, children: /* @__PURE__ */ e(
2839
+ ) : /* @__PURE__ */ a(nt, { open: l, onOpenChange: s, children: [
2840
+ /* @__PURE__ */ e(at, { asChild: !0, children: /* @__PURE__ */ e(
2841
2841
  "button",
2842
2842
  {
2843
2843
  type: "button",
@@ -2846,7 +2846,7 @@ function fl() {
2846
2846
  children: "Appear away"
2847
2847
  }
2848
2848
  ) }),
2849
- /* @__PURE__ */ a(et, { align: "end", className: "w-48 p-1", children: [
2849
+ /* @__PURE__ */ a(st, { align: "end", className: "w-48 p-1", children: [
2850
2850
  /* @__PURE__ */ e("p", { className: "px-2 pb-1 pt-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: "Appear away for" }),
2851
2851
  [
2852
2852
  ["1 hour", () => new Date(Date.now() + 36e5)],
@@ -2857,7 +2857,7 @@ function fl() {
2857
2857
  "button",
2858
2858
  {
2859
2859
  type: "button",
2860
- onClick: () => p(f()),
2860
+ onClick: () => m(f()),
2861
2861
  className: "flex w-full rounded px-2 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-slate-200",
2862
2862
  "data-chat-appear-away-option": x,
2863
2863
  children: x
@@ -2870,25 +2870,66 @@ function fl() {
2870
2870
  }
2871
2871
  );
2872
2872
  }
2873
- function xl({ myStatus: n }) {
2874
- const s = ue();
2875
- return /* @__PURE__ */ e(
2876
- $s,
2877
- {
2878
- status: n ? { text: n.text, emoji: n.emoji } : null,
2879
- theme: { accentSoft: s.accentSoft, input: s.input, action: s.action },
2880
- className: "mb-1.5 px-1"
2881
- }
2882
- );
2873
+ function xl(n, r) {
2874
+ const l = (s) => {
2875
+ const o = r(s);
2876
+ return o != null && o.away ? 2 : o != null && o.is_idle ? 1 : 0;
2877
+ };
2878
+ return n.map((s, o) => ({ u: s, i: o, r: l(s) })).sort((s, o) => s.r - o.r || s.i - o.i).map((s) => s.u);
2883
2879
  }
2884
- function ba() {
2885
- var i, p, d;
2886
- const n = Ze(), s = Ss(15e3), { data: l, isFetched: r } = Te({
2880
+ function bl({
2881
+ myStatus: n,
2882
+ onlineFirst: r,
2883
+ onOnlineFirst: l
2884
+ }) {
2885
+ const s = me();
2886
+ return /* @__PURE__ */ a("div", { className: "mb-1.5 flex items-start justify-between gap-2 px-1", children: [
2887
+ /* @__PURE__ */ e(
2888
+ $s,
2889
+ {
2890
+ status: n ? { text: n.text, emoji: n.emoji } : null,
2891
+ theme: { accentSoft: s.accentSoft, input: s.input, action: s.action },
2892
+ className: "min-w-0"
2893
+ }
2894
+ ),
2895
+ r != null && l && /* @__PURE__ */ a(
2896
+ "button",
2897
+ {
2898
+ type: "button",
2899
+ role: "switch",
2900
+ "aria-checked": r,
2901
+ "data-chat-online-first": !0,
2902
+ "data-tip": "Active people first, then idle, then away. Off: alphabetical.",
2903
+ onClick: () => l(!r),
2904
+ className: "inline-flex shrink-0 items-center gap-1.5 rounded px-1 py-1 text-[11.5px] text-slate-500 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-slate-400 dark:hover:text-slate-200",
2905
+ children: [
2906
+ /* @__PURE__ */ e(
2907
+ "span",
2908
+ {
2909
+ "aria-hidden": !0,
2910
+ className: `relative inline-flex h-[14px] w-6 items-center rounded-full transition-colors ${r ? "bg-nvr-cyan" : "bg-slate-300 dark:bg-slate-600"}`,
2911
+ children: /* @__PURE__ */ e(
2912
+ "span",
2913
+ {
2914
+ className: `inline-block h-2.5 w-2.5 rounded-full bg-white shadow transition-transform ${r ? "translate-x-[12px]" : "translate-x-[2px]"}`
2915
+ }
2916
+ )
2917
+ }
2918
+ ),
2919
+ "Online first"
2920
+ ]
2921
+ }
2922
+ )
2923
+ ] });
2924
+ }
2925
+ function ka() {
2926
+ var i, m, c;
2927
+ const n = tt(), r = Ss(15e3), { data: l, isFetched: s } = Ue({
2887
2928
  queryKey: ["presence-online"],
2888
2929
  queryFn: () => n.request(ye("/presence/online")),
2889
2930
  // Matches the presence heartbeat cadence without a live socket — the page someone is on
2890
2931
  // should track them around the app. Live, presence:changed carries it and this is 60 s.
2891
- refetchInterval: s,
2932
+ refetchInterval: r,
2892
2933
  staleTime: 5e3
2893
2934
  });
2894
2935
  return {
@@ -2898,23 +2939,23 @@ function ba() {
2898
2939
  return x;
2899
2940
  }, [l]),
2900
2941
  fields: ((i = l == null ? void 0 : l.config) == null ? void 0 : i.fields) ?? ["role", "page"],
2901
- adminUrl: ((p = l == null ? void 0 : l.config) == null ? void 0 : p.admin_url) ?? null,
2902
- dimensions: ((d = l == null ? void 0 : l.config) == null ? void 0 : d.dimensions) ?? [],
2903
- loaded: r
2942
+ adminUrl: ((m = l == null ? void 0 : l.config) == null ? void 0 : m.admin_url) ?? null,
2943
+ dimensions: ((c = l == null ? void 0 : l.config) == null ? void 0 : c.dimensions) ?? [],
2944
+ loaded: s
2904
2945
  };
2905
2946
  }
2906
- function ga(n) {
2947
+ function wa(n) {
2907
2948
  if (!n) return null;
2908
- const s = n.split("/").filter(Boolean);
2909
- if (s.length === 0) return "Home";
2910
- const l = /* @__PURE__ */ new Set(["records", "collections", "p"]), r = s.filter((o) => !l.has(o));
2911
- return r.length === 0 ? "Home" : r.map((o, i) => i === 0 ? o.replace(/[-_]/g, " ").replace(/\b\w/g, (p) => p.toUpperCase()) : o).join(" › ");
2949
+ const r = n.split("/").filter(Boolean);
2950
+ if (r.length === 0) return "Home";
2951
+ const l = /* @__PURE__ */ new Set(["records", "collections", "p"]), s = r.filter((o) => !l.has(o));
2952
+ return s.length === 0 ? "Home" : s.map((o, i) => i === 0 ? o.replace(/[-_]/g, " ").replace(/\b\w/g, (m) => m.toUpperCase()) : o).join(" › ");
2912
2953
  }
2913
- function bl({
2954
+ function gl({
2914
2955
  onClose: n,
2915
- onCreated: s
2956
+ onCreated: r
2916
2957
  }) {
2917
- const l = ue(), [r, o] = T(""), [i, p] = T(""), [d, x] = T(/* @__PURE__ */ new Map()), { users: f } = Ft(r, !0), u = pr(), b = (y) => [y.first_name, y.last_name].filter(Boolean).join(" ") || (y.email ?? "Unknown");
2958
+ const l = me(), [s, o] = T(""), [i, m] = T(""), [c, x] = T(/* @__PURE__ */ new Map()), { users: f } = Qt(s, !0), d = pr(), b = (y) => [y.first_name, y.last_name].filter(Boolean).join(" ") || (y.email ?? "Unknown");
2918
2959
  return /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col p-3", "data-chat-group-dialog": !0, children: [
2919
2960
  /* @__PURE__ */ a("div", { className: "mb-2 flex items-center gap-2", children: [
2920
2961
  /* @__PURE__ */ e(
@@ -2924,12 +2965,12 @@ function bl({
2924
2965
  onClick: n,
2925
2966
  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",
2926
2967
  "aria-label": "Back",
2927
- children: /* @__PURE__ */ e(ut, { className: "h-4 w-4", strokeWidth: 2 })
2968
+ children: /* @__PURE__ */ e(ft, { className: "h-4 w-4", strokeWidth: 2 })
2928
2969
  }
2929
2970
  ),
2930
2971
  /* @__PURE__ */ e("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "New group conversation" })
2931
2972
  ] }),
2932
- d.size > 0 && /* @__PURE__ */ e("div", { className: "mb-2 flex flex-wrap gap-1", children: [...d.entries()].map(([y, D]) => /* @__PURE__ */ a(
2973
+ c.size > 0 && /* @__PURE__ */ e("div", { className: "mb-2 flex flex-wrap gap-1", children: [...c.entries()].map(([y, U]) => /* @__PURE__ */ a(
2933
2974
  "span",
2934
2975
  {
2935
2976
  className: g(
@@ -2937,17 +2978,17 @@ function bl({
2937
2978
  l.accentSoft
2938
2979
  ),
2939
2980
  children: [
2940
- D,
2981
+ U,
2941
2982
  /* @__PURE__ */ e(
2942
2983
  "button",
2943
2984
  {
2944
2985
  type: "button",
2945
- onClick: () => x((A) => {
2946
- const C = new Map(A);
2986
+ onClick: () => x((M) => {
2987
+ const C = new Map(M);
2947
2988
  return C.delete(y), C;
2948
2989
  }),
2949
- "aria-label": `Remove ${D}`,
2950
- children: /* @__PURE__ */ e(pt, { className: "h-3 w-3" })
2990
+ "aria-label": `Remove ${U}`,
2991
+ children: /* @__PURE__ */ e(bt, { className: "h-3 w-3" })
2951
2992
  }
2952
2993
  )
2953
2994
  ]
@@ -2957,7 +2998,7 @@ function bl({
2957
2998
  /* @__PURE__ */ e(
2958
2999
  "input",
2959
3000
  {
2960
- value: r,
3001
+ value: s,
2961
3002
  onChange: (y) => o(y.target.value),
2962
3003
  placeholder: "Find people…",
2963
3004
  className: g("mb-1.5 h-8 rounded-md border px-2.5 text-[12.5px] outline-none", l.input),
@@ -2966,23 +3007,23 @@ function bl({
2966
3007
  }
2967
3008
  ),
2968
3009
  /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto", children: f.map((y) => {
2969
- const D = d.has(y.id);
3010
+ const U = c.has(y.id);
2970
3011
  return /* @__PURE__ */ a(
2971
3012
  "button",
2972
3013
  {
2973
3014
  type: "button",
2974
- onClick: () => x((A) => {
2975
- const C = new Map(A);
2976
- return D ? C.delete(y.id) : C.set(y.id, b(y)), C;
3015
+ onClick: () => x((M) => {
3016
+ const C = new Map(M);
3017
+ return U ? C.delete(y.id) : C.set(y.id, b(y)), C;
2977
3018
  }),
2978
3019
  className: g(
2979
3020
  "flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-[12.5px] transition-colors",
2980
- D ? l.accentSoft : "hover:bg-slate-50 dark:hover:bg-muted/50"
3021
+ U ? l.accentSoft : "hover:bg-slate-50 dark:hover:bg-muted/50"
2981
3022
  ),
2982
3023
  children: [
2983
- /* @__PURE__ */ e(Q, { id: y.id, name: b(y), size: 22 }),
3024
+ /* @__PURE__ */ e(K, { id: y.id, name: b(y), size: 22 }),
2984
3025
  /* @__PURE__ */ e("span", { className: "truncate", children: b(y) }),
2985
- D && /* @__PURE__ */ e(It, { className: "ml-auto h-3.5 w-3.5 shrink-0" })
3026
+ U && /* @__PURE__ */ e(Bt, { className: "ml-auto h-3.5 w-3.5 shrink-0" })
2986
3027
  ]
2987
3028
  },
2988
3029
  y.id
@@ -2992,7 +3033,7 @@ function bl({
2992
3033
  "input",
2993
3034
  {
2994
3035
  value: i,
2995
- onChange: (y) => p(y.target.value),
3036
+ onChange: (y) => m(y.target.value),
2996
3037
  placeholder: "Group name (optional)",
2997
3038
  className: g(
2998
3039
  "mb-2 mt-1.5 h-8 rounded-md border px-2.5 text-[12.5px] outline-none",
@@ -3005,101 +3046,116 @@ function bl({
3005
3046
  "button",
3006
3047
  {
3007
3048
  type: "button",
3008
- disabled: d.size === 0 || u.isPending,
3009
- onClick: () => u.mutate(
3010
- { user_ids: [...d.keys()], name: i.trim() || void 0 },
3011
- { onSuccess: (y) => s(y.room, y.name) }
3049
+ disabled: c.size === 0 || d.isPending,
3050
+ onClick: () => d.mutate(
3051
+ { user_ids: [...c.keys()], name: i.trim() || void 0 },
3052
+ { onSuccess: (y) => r(y.room, y.name) }
3012
3053
  ),
3013
3054
  className: g(
3014
3055
  "flex h-9 items-center justify-center rounded-lg text-[12.5px] font-semibold transition-[filter] hover:brightness-110 disabled:opacity-40",
3015
3056
  l.action
3016
3057
  ),
3017
- children: u.isPending ? "Creating…" : `Start conversation${d.size ? ` (${d.size + 1})` : ""}`
3058
+ children: d.isPending ? "Creating…" : `Start conversation${c.size ? ` (${c.size + 1})` : ""}`
3018
3059
  }
3019
3060
  )
3020
3061
  ] });
3021
3062
  }
3022
- const Lt = "nvr-chat-pinned", Ut = 400;
3023
- function gl() {
3063
+ const Et = "nvr-chat-pinned", Rt = 400;
3064
+ function vl() {
3024
3065
  try {
3025
- return typeof window < "u" && window.localStorage.getItem(Lt) === "1";
3066
+ return typeof window < "u" && window.localStorage.getItem(Et) === "1";
3026
3067
  } catch {
3027
3068
  return !1;
3028
3069
  }
3029
3070
  }
3030
- function vl() {
3031
- const n = "(min-width: 1024px)", [s, l] = T(
3071
+ function yl() {
3072
+ const n = "(min-width: 1024px)", [r, l] = T(
3032
3073
  () => {
3033
- var r;
3034
- return typeof window < "u" && !!((r = window.matchMedia) != null && r.call(window, n).matches);
3074
+ var s;
3075
+ return typeof window < "u" && !!((s = window.matchMedia) != null && s.call(window, n).matches);
3035
3076
  }
3036
3077
  );
3037
3078
  return ae(() => {
3038
3079
  var i;
3039
- const r = (i = window.matchMedia) == null ? void 0 : i.call(window, n);
3040
- if (!r) return;
3041
- const o = () => l(r.matches);
3042
- return r.addEventListener("change", o), () => r.removeEventListener("change", o);
3043
- }, []), s;
3080
+ const s = (i = window.matchMedia) == null ? void 0 : i.call(window, n);
3081
+ if (!s) return;
3082
+ const o = () => l(s.matches);
3083
+ return s.addEventListener("change", o), () => s.removeEventListener("change", o);
3084
+ }, []), r;
3044
3085
  }
3045
- function ko({
3086
+ function wo({
3046
3087
  open: n,
3047
- onClose: s,
3088
+ onClose: r,
3048
3089
  renderMessageBody: l,
3049
- requestedDm: r,
3090
+ requestedDm: s,
3050
3091
  requestedRoom: o
3051
3092
  }) {
3052
- var Ce;
3053
- const i = Le(), p = ue(), d = i.me, [x, f] = T(gl), u = vl(), b = x && u, y = () => {
3093
+ var Ie;
3094
+ const i = Le(), m = me(), c = i.me, [x, f] = T(vl), d = yl(), b = x && d, y = () => {
3054
3095
  const k = !x;
3055
3096
  f(k);
3056
3097
  try {
3057
- k ? window.localStorage.setItem(Lt, "1") : window.localStorage.removeItem(Lt);
3098
+ k ? window.localStorage.setItem(Et, "1") : window.localStorage.removeItem(Et);
3058
3099
  } catch {
3059
3100
  }
3060
3101
  };
3061
3102
  ae(() => {
3062
3103
  if (!n || !b) return;
3063
- const k = document.body, M = k.style.paddingRight;
3064
- k.style.paddingRight = `${Ut}px`, k.dataset.nvrChatPinned = "1";
3065
- const P = document.createElement("style");
3066
- return P.dataset.nvrChatPinnedStyle = "", P.textContent = `body[data-nvr-chat-pinned] [data-sonner-toaster][data-x-position="right"],
3067
- body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${Ut}px; }`, document.head.appendChild(P), () => {
3068
- k.style.paddingRight = M, delete k.dataset.nvrChatPinned, P.remove();
3104
+ const k = document.body, A = k.style.paddingRight;
3105
+ k.style.paddingRight = `${Rt}px`, k.dataset.nvrChatPinned = "1";
3106
+ const I = document.createElement("style");
3107
+ return I.dataset.nvrChatPinnedStyle = "", I.textContent = `body[data-nvr-chat-pinned] [data-sonner-toaster][data-x-position="right"],
3108
+ body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${Rt}px; }`, document.head.appendChild(I), () => {
3109
+ k.style.paddingRight = A, delete k.dataset.nvrChatPinned, I.remove();
3069
3110
  };
3070
3111
  }, [n, b]);
3071
- const [D, A] = T("online"), [C, S] = T(null), [B, $] = T(null), v = (k, M, P) => {
3072
- const V = ee.find(($e) => $e.room === k);
3073
- F(!1), S({ room: k, label: (V == null ? void 0 : V.label) ?? M, channel: V == null ? void 0 : V.channel, anchor: P });
3074
- }, [E, J] = T(!1), [G, F] = T(!1), [R, K] = T(null), { rooms: ee, totalUnread: Y } = sa(), te = ra(D === "archived"), oe = (k, M, P) => {
3075
- var $e, _;
3076
- if (!M) return [{ key: "all", label: null, users: k }];
3077
- const V = /* @__PURE__ */ new Map();
3078
- for (const I of k) {
3079
- const j = P.get(String(I.user_id).toUpperCase()), ie = M === "__role__" ? [Wn((j == null ? void 0 : j.role_name) ?? I.role_name) || "No role"] : (_ = ($e = j == null ? void 0 : j.scopes_by_dimension) == null ? void 0 : $e[M]) != null && _.length ? j.scopes_by_dimension[M] : ["Unassigned"], ne = [...new Set(ie)].sort((X, H) => X.localeCompare(H)).join(", ");
3080
- V.set(ne, [...V.get(ne) ?? [], I]);
3112
+ const [U, M] = T("online"), [C, S] = T(null), [W, $] = T(null), v = (k, A, I) => {
3113
+ const te = V.find((De) => De.room === k);
3114
+ H(!1), S({ room: k, label: (te == null ? void 0 : te.label) ?? A, channel: te == null ? void 0 : te.channel, anchor: I });
3115
+ }, [q, Y] = T(!1), [G, H] = T(!1), [R, J] = T(null), { rooms: V, totalUnread: Z } = ia(), X = ca(U === "archived"), oe = (k, A, I) => {
3116
+ var De, _;
3117
+ if (!A) return [{ key: "all", label: null, users: k }];
3118
+ const te = /* @__PURE__ */ new Map();
3119
+ for (const L of k) {
3120
+ const j = I.get(String(L.user_id).toUpperCase()), ce = A === "__role__" ? [Gn((j == null ? void 0 : j.role_name) ?? L.role_name) || "No role"] : (_ = (De = j == null ? void 0 : j.scopes_by_dimension) == null ? void 0 : De[A]) != null && _.length ? j.scopes_by_dimension[A] : ["Unassigned"], ee = [...new Set(ce)].sort((ne, Q) => ne.localeCompare(Q)).join(", ");
3121
+ te.set(ee, [...te.get(ee) ?? [], L]);
3122
+ }
3123
+ return [...te.entries()].sort((L, j) => L[0] === "Unassigned" ? 1 : j[0] === "Unassigned" ? -1 : L[0].localeCompare(j[0])).map(([L, j]) => ({ key: L, label: L, users: j }));
3124
+ }, [se, pe] = T(() => typeof window > "u" ? "" : localStorage.getItem("nvr_chat_group_by") ?? ""), [p, E] = T(() => {
3125
+ try {
3126
+ return typeof window < "u" && localStorage.getItem("nvr_chat_online_first") === "1";
3127
+ } catch {
3128
+ return !1;
3129
+ }
3130
+ }), u = (k) => {
3131
+ E(k);
3132
+ try {
3133
+ localStorage.setItem("nvr_chat_online_first", k ? "1" : "0");
3134
+ } catch {
3081
3135
  }
3082
- return [...V.entries()].sort((I, j) => I[0] === "Unassigned" ? 1 : j[0] === "Unassigned" ? -1 : I[0].localeCompare(j[0])).map(([I, j]) => ({ key: I, label: I, users: j }));
3083
- }, [se, me] = T(() => typeof window > "u" ? "" : localStorage.getItem("nvr_chat_group_by") ?? ""), c = ba(), L = c.loaded ? Js(
3084
- i.onlineUsers.filter((k) => c.byUser.has(String(k.user_id).toUpperCase()))
3085
- ) : [], m = ve(
3086
- () => oe(L, se, c.byUser),
3136
+ }, P = ka(), Ce = P.loaded ? Js(
3137
+ i.onlineUsers.filter((k) => P.byUser.has(String(k.user_id).toUpperCase()))
3138
+ ) : [], we = p ? xl(
3139
+ Ce,
3140
+ (k) => P.byUser.get(String(k.user_id).toUpperCase())
3141
+ ) : Ce, Pe = ve(
3142
+ () => oe(we, se, P.byUser),
3087
3143
  // biome-ignore lint/correctness/useExhaustiveDependencies: builder is pure
3088
- [L, se, c.byUser]
3089
- ), { isAdmin: Z } = ht(), { navigate: De } = ks(), he = (k) => {
3090
- /^https?:\/\//i.test(k) ? window.open(k, "_blank", "noopener") : De(k);
3091
- }, Pe = (k) => {
3092
- d && (A("chat"), S({ room: Rt(d.id, k.user_id), label: k.display_name ?? "Direct message" }));
3093
- }, Ne = de(0);
3144
+ [we, se, P.byUser]
3145
+ ), { isAdmin: _e } = gt(), { navigate: Ae } = ks(), ie = (k) => {
3146
+ /^https?:\/\//i.test(k) ? window.open(k, "_blank", "noopener") : Ae(k);
3147
+ }, ze = (k) => {
3148
+ c && (M("chat"), S({ room: It(c.id, k.user_id), label: k.display_name ?? "Direct message" }));
3149
+ }, Ge = ue(0);
3094
3150
  ae(() => {
3095
- !r || !d || r.nonce === Ne.current || (Ne.current = r.nonce, A("chat"), F(!1), S({
3096
- room: Rt(d.id, r.userId),
3097
- label: r.name ?? "Direct message"
3151
+ !s || !c || s.nonce === Ge.current || (Ge.current = s.nonce, M("chat"), H(!1), S({
3152
+ room: It(c.id, s.userId),
3153
+ label: s.name ?? "Direct message"
3098
3154
  }));
3099
- }, [r, d]);
3100
- const Ue = de(0);
3155
+ }, [s, c]);
3156
+ const Qe = ue(0);
3101
3157
  return ae(() => {
3102
- !o || o.nonce === Ue.current || (Ue.current = o.nonce, A("chat"), F(!1), S({ room: o.room, label: o.label ?? o.room }));
3158
+ !o || o.nonce === Qe.current || (Qe.current = o.nonce, M("chat"), H(!1), S({ room: o.room, label: o.label ?? o.room }));
3103
3159
  }, [o]), n ? /* @__PURE__ */ a(
3104
3160
  "div",
3105
3161
  {
@@ -3107,47 +3163,47 @@ body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${Ut}px; }`, do
3107
3163
  // No backdrop: the rest of the page stays usable.
3108
3164
  "pointer-events-none fixed inset-y-0 right-0 z-40"
3109
3165
  ) : "fixed inset-0 z-40 bg-black/40 animate-in fade-in duration-150",
3110
- style: b ? { width: Ut } : void 0,
3111
- onClick: b ? void 0 : s,
3166
+ style: b ? { width: Rt } : void 0,
3167
+ onClick: b ? void 0 : r,
3112
3168
  "data-chat-panel": !0,
3113
3169
  "data-nvr-recording-hide": !0,
3114
3170
  "data-chat-pinned": b ? "1" : void 0,
3115
3171
  children: [
3116
- /* @__PURE__ */ e(Rn, {}),
3172
+ /* @__PURE__ */ e(In, {}),
3117
3173
  /* @__PURE__ */ a(
3118
3174
  "aside",
3119
3175
  {
3120
3176
  className: g(
3121
3177
  "pointer-events-auto absolute right-0 top-0 flex h-full w-full flex-col border-l",
3122
3178
  b ? "max-w-none" : "max-w-[400px] shadow-2xl animate-in slide-in-from-right duration-200",
3123
- p.surface,
3179
+ m.surface,
3124
3180
  "border-slate-200 dark:border-border"
3125
3181
  ),
3126
3182
  onClick: (k) => k.stopPropagation(),
3127
3183
  "aria-label": "Team",
3128
3184
  children: [
3129
- /* @__PURE__ */ a("div", { className: g("flex shrink-0 items-center gap-2 border-b px-3.5 py-2.5", p.divider), children: [
3185
+ /* @__PURE__ */ a("div", { className: g("flex shrink-0 items-center gap-2 border-b px-3.5 py-2.5", m.divider), children: [
3130
3186
  /* @__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((k) => /* @__PURE__ */ a(
3131
3187
  "button",
3132
3188
  {
3133
3189
  type: "button",
3134
- onClick: () => A(k),
3190
+ onClick: () => M(k),
3135
3191
  "data-tip": k === "archived" ? "Conversations you archived for yourself. Everyone else still sees them." : void 0,
3136
3192
  className: g(
3137
3193
  "flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors",
3138
- D === k ? p.accentSoft : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"
3194
+ U === k ? m.accentSoft : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"
3139
3195
  ),
3140
3196
  children: [
3141
- k === "online" ? `Online · ${L.length}` : k === "chat" ? "Chat" : k === "browse" ? "Browse" : "Archived",
3142
- k === "chat" && Y > 0 && /* @__PURE__ */ e(
3197
+ k === "online" ? `Online · ${we.length}` : k === "chat" ? "Chat" : k === "browse" ? "Browse" : "Archived",
3198
+ k === "chat" && Z > 0 && /* @__PURE__ */ e(
3143
3199
  "span",
3144
3200
  {
3145
3201
  className: g(
3146
3202
  "flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[9.5px] font-bold leading-none",
3147
- p.pill
3203
+ m.pill
3148
3204
  ),
3149
- title: `${Y} unread`,
3150
- children: Y > 99 ? "99+" : Y
3205
+ title: `${Z} unread`,
3206
+ children: Z > 99 ? "99+" : Z
3151
3207
  }
3152
3208
  )
3153
3209
  ]
@@ -3164,45 +3220,47 @@ body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${Ut}px; }`, do
3164
3220
  "aria-label": x ? "Unpin chat panel" : "Pin chat panel",
3165
3221
  className: g(
3166
3222
  "ml-auto hidden rounded-md p-1.5 transition-colors lg:flex",
3167
- x ? p.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
3223
+ x ? m.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
3168
3224
  ),
3169
3225
  "data-chat-pin": x ? "on" : "off",
3170
- children: x ? /* @__PURE__ */ e(Qa, { className: "h-4 w-4", strokeWidth: 2 }) : /* @__PURE__ */ e(Mt, { className: "h-4 w-4", strokeWidth: 2 })
3226
+ children: x ? /* @__PURE__ */ e(Qa, { className: "h-4 w-4", strokeWidth: 2 }) : /* @__PURE__ */ e(Lt, { className: "h-4 w-4", strokeWidth: 2 })
3171
3227
  }
3172
3228
  ),
3173
3229
  /* @__PURE__ */ e(
3174
3230
  "button",
3175
3231
  {
3176
3232
  type: "button",
3177
- onClick: s,
3233
+ onClick: r,
3178
3234
  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",
3179
3235
  "aria-label": "Close panel",
3180
- children: /* @__PURE__ */ e(pt, { className: "h-4 w-4", strokeWidth: 2 })
3236
+ children: /* @__PURE__ */ e(bt, { className: "h-4 w-4", strokeWidth: 2 })
3181
3237
  }
3182
3238
  )
3183
3239
  ] }),
3184
- D === "online" ? /* @__PURE__ */ a(
3240
+ U === "online" ? /* @__PURE__ */ a(
3185
3241
  "div",
3186
3242
  {
3187
3243
  className: "min-h-0 flex-1 overflow-y-auto px-2 pb-2 [&>:first-child]:mt-2",
3188
3244
  "data-chat-online": !0,
3189
3245
  children: [
3190
3246
  /* @__PURE__ */ e(
3191
- xl,
3247
+ bl,
3192
3248
  {
3193
- myStatus: d ? ((Ce = c.byUser.get(String(d.id).toUpperCase())) == null ? void 0 : Ce.custom_status) ?? null : null
3249
+ onlineFirst: p,
3250
+ onOnlineFirst: u,
3251
+ myStatus: c ? ((Ie = P.byUser.get(String(c.id).toUpperCase())) == null ? void 0 : Ie.custom_status) ?? null : null
3194
3252
  }
3195
3253
  ),
3196
3254
  /* @__PURE__ */ e(fl, {}),
3197
3255
  /* @__PURE__ */ e(Ms, {}),
3198
- L.length > 0 && /* @__PURE__ */ a("div", { className: "mb-1.5 flex items-center gap-1.5 px-1", children: [
3256
+ we.length > 0 && /* @__PURE__ */ a("div", { className: "mb-1.5 flex items-center gap-1.5 px-1", children: [
3199
3257
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "Group by" }),
3200
3258
  /* @__PURE__ */ e(
3201
- qt,
3259
+ Ht,
3202
3260
  {
3203
3261
  value: se,
3204
3262
  onChange: (k) => {
3205
- me(k);
3263
+ pe(k);
3206
3264
  try {
3207
3265
  localStorage.setItem("nvr_chat_group_by", k);
3208
3266
  } catch {
@@ -3213,57 +3271,57 @@ body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${Ut}px; }`, do
3213
3271
  options: [
3214
3272
  { value: "", label: "No grouping" },
3215
3273
  { value: "__role__", label: "Role" },
3216
- ...c.dimensions.map((k) => ({ value: k.name, label: k.label }))
3274
+ ...P.dimensions.map((k) => ({ value: k.name, label: k.label }))
3217
3275
  ]
3218
3276
  }
3219
3277
  )
3220
3278
  ] }),
3221
- L.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." }) : m.map((k) => /* @__PURE__ */ a("div", { "data-chat-online-group": k.key, children: [
3279
+ we.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." }) : Pe.map((k) => /* @__PURE__ */ a("div", { "data-chat-online-group": k.key, children: [
3222
3280
  k.label !== null && /* @__PURE__ */ a("div", { className: "sticky top-0 z-[1] flex items-center gap-1.5 bg-white px-2 py-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400 dark:bg-card", children: [
3223
3281
  k.label,
3224
3282
  /* @__PURE__ */ e("span", { className: "font-normal normal-case text-slate-300", children: k.users.length })
3225
3283
  ] }),
3226
- k.users.map((M) => {
3227
- const P = c.byUser.get(String(M.user_id).toUpperCase()), V = (P == null ? void 0 : P.is_idle) ?? M.is_idle, $e = P ?? M;
3284
+ k.users.map((A) => {
3285
+ const I = P.byUser.get(String(A.user_id).toUpperCase()), te = (I == null ? void 0 : I.is_idle) ?? A.is_idle, De = I ?? A;
3228
3286
  return /* @__PURE__ */ a(
3229
3287
  "div",
3230
3288
  {
3231
3289
  className: "flex w-full items-center rounded-lg pl-2.5 transition-colors hover:bg-slate-50 dark:hover:bg-muted/50",
3232
3290
  "data-chat-online-row": !0,
3233
3291
  children: [
3234
- /* @__PURE__ */ e(Et, { userId: M.user_id, children: /* @__PURE__ */ e(
3292
+ /* @__PURE__ */ e(Ft, { userId: A.user_id, children: /* @__PURE__ */ e(
3235
3293
  "button",
3236
3294
  {
3237
3295
  type: "button",
3238
3296
  className: "shrink-0 rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
3239
- "aria-label": `${M.display_name ?? "Unknown user"} — profile`,
3297
+ "aria-label": `${A.display_name ?? "Unknown user"} — profile`,
3240
3298
  "data-chat-online-avatar": !0,
3241
- children: /* @__PURE__ */ e(Q, { id: M.user_id, name: M.display_name })
3299
+ children: /* @__PURE__ */ e(K, { id: A.user_id, name: A.display_name })
3242
3300
  }
3243
3301
  ) }),
3244
3302
  /* @__PURE__ */ a(
3245
3303
  "button",
3246
3304
  {
3247
3305
  type: "button",
3248
- onClick: () => Pe(M),
3306
+ onClick: () => ze(A),
3249
3307
  title: "Send a direct message",
3250
3308
  className: "flex min-w-0 flex-1 items-center gap-3 py-2 pl-3 pr-2.5 text-left",
3251
3309
  children: [
3252
3310
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
3253
3311
  /* @__PURE__ */ a("span", { className: "block truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: [
3254
- M.display_name ?? "Unknown user",
3255
- V && /* @__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" : Ot($e) }),
3256
- !V && (P == null ? void 0 : P.stuck) && (() => {
3257
- const _ = P.stuck, I = c.fields.includes("page"), j = $n(
3258
- P.current_path,
3259
- P.app,
3260
- c.adminUrl,
3312
+ A.display_name ?? "Unknown user",
3313
+ te && /* @__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: I != null && I.away ? "Away" : jt(De) }),
3314
+ !te && (I == null ? void 0 : I.stuck) && (() => {
3315
+ const _ = I.stuck, L = P.fields.includes("page"), j = On(
3316
+ I.current_path,
3317
+ I.app,
3318
+ P.adminUrl,
3261
3319
  i.recordUrl,
3262
3320
  typeof window > "u" ? null : window.location.origin
3263
- ), ie = `${Mn(_)} — at the keyboard, on the same page, nothing saved for ten minutes${j ? `
3264
- ${An(j)}` : ""}`, ne = Mn(
3265
- I ? { ..._, label: null } : _
3266
- ), X = "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";
3321
+ ), ce = `${Ln(_)} — at the keyboard, on the same page, nothing saved for ten minutes${j ? `
3322
+ ${Pn(j)}` : ""}`, ee = Ln(
3323
+ L ? { ..._, label: null } : _
3324
+ ), ne = "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";
3267
3325
  return j ? (
3268
3326
  // biome-ignore lint/a11y/useSemanticElements: inside the row's DM button, where a nested <a> is invalid
3269
3327
  /* @__PURE__ */ e(
@@ -3271,34 +3329,34 @@ ${An(j)}` : ""}`, ne = Mn(
3271
3329
  {
3272
3330
  role: "link",
3273
3331
  tabIndex: 0,
3274
- className: g(X, "cursor-pointer hover:underline"),
3332
+ className: g(ne, "cursor-pointer hover:underline"),
3275
3333
  "data-chat-stuck": _.minutes,
3276
- "data-tip": ie,
3277
- "aria-label": `${ne}: open the page`,
3278
- onClick: (H) => {
3279
- H.stopPropagation(), he(j);
3334
+ "data-tip": ce,
3335
+ "aria-label": `${ee}: open the page`,
3336
+ onClick: (Q) => {
3337
+ Q.stopPropagation(), ie(j);
3280
3338
  },
3281
- onKeyDown: (H) => {
3282
- (H.key === "Enter" || H.key === " ") && (H.preventDefault(), H.stopPropagation(), he(j));
3339
+ onKeyDown: (Q) => {
3340
+ (Q.key === "Enter" || Q.key === " ") && (Q.preventDefault(), Q.stopPropagation(), ie(j));
3283
3341
  },
3284
- children: ne
3342
+ children: ee
3285
3343
  }
3286
3344
  )
3287
3345
  ) : /* @__PURE__ */ e(
3288
3346
  "span",
3289
3347
  {
3290
- className: X,
3348
+ className: ne,
3291
3349
  "data-chat-stuck": _.minutes,
3292
- "data-tip": ie,
3293
- children: ne
3350
+ "data-tip": ce,
3351
+ children: ee
3294
3352
  }
3295
3353
  );
3296
3354
  })(),
3297
3355
  (() => {
3298
- var I;
3299
- const _ = (I = c.byUser.get(
3300
- String(M.user_id).toUpperCase()
3301
- )) == null ? void 0 : I.masquerade;
3356
+ var L;
3357
+ const _ = (L = P.byUser.get(
3358
+ String(A.user_id).toUpperCase()
3359
+ )) == null ? void 0 : L.masquerade;
3302
3360
  return _ ? /* @__PURE__ */ a(
3303
3361
  "span",
3304
3362
  {
@@ -3312,11 +3370,11 @@ ${An(j)}` : ""}`, ne = Mn(
3312
3370
  }
3313
3371
  ) : null;
3314
3372
  })(),
3315
- Z && /* @__PURE__ */ e(Rs, { builds: P == null ? void 0 : P.stale_build })
3373
+ _e && /* @__PURE__ */ e(Rs, { builds: I == null ? void 0 : I.stale_build })
3316
3374
  ] }),
3317
3375
  (() => {
3318
- const _ = c.byUser.get(String(M.user_id).toUpperCase()), I = _ == null ? void 0 : _.custom_status;
3319
- return !I && !(_ != null && _.in_huddle) ? null : /* @__PURE__ */ a(
3376
+ const _ = P.byUser.get(String(A.user_id).toUpperCase()), L = _ == null ? void 0 : _.custom_status;
3377
+ return !L && !(_ != null && _.in_huddle) ? null : /* @__PURE__ */ a(
3320
3378
  "span",
3321
3379
  {
3322
3380
  className: "flex items-center gap-1 truncate text-[11px] text-slate-500 dark:text-slate-400",
@@ -3330,67 +3388,67 @@ ${An(j)}` : ""}`, ne = Mn(
3330
3388
  "data-tip": "In a huddle right now",
3331
3389
  children: [
3332
3390
  /* @__PURE__ */ e(Ka, { className: "h-3 w-3", strokeWidth: 2 }),
3333
- !I && "In a huddle"
3391
+ !L && "In a huddle"
3334
3392
  ]
3335
3393
  }
3336
3394
  ),
3337
- I && /* @__PURE__ */ a("span", { className: "truncate italic", children: [
3338
- I.emoji ? `${I.emoji} ` : "",
3339
- I.text
3395
+ L && /* @__PURE__ */ a("span", { className: "truncate italic", children: [
3396
+ L.emoji ? `${L.emoji} ` : "",
3397
+ L.text
3340
3398
  ] })
3341
3399
  ]
3342
3400
  }
3343
3401
  );
3344
3402
  })(),
3345
3403
  (() => {
3346
- const _ = c.byUser.get(String(M.user_id).toUpperCase()), I = [];
3347
- let j = null, ie = !1;
3348
- for (const H of c.fields)
3349
- if (H === "role") {
3350
- const re = Wn((_ == null ? void 0 : _.role_name) ?? M.role_name);
3351
- re && I.push(re);
3352
- } else if (H === "scopes") {
3404
+ const _ = P.byUser.get(String(A.user_id).toUpperCase()), L = [];
3405
+ let j = null, ce = !1;
3406
+ for (const Q of P.fields)
3407
+ if (Q === "role") {
3408
+ const re = Gn((_ == null ? void 0 : _.role_name) ?? A.role_name);
3409
+ re && L.push(re);
3410
+ } else if (Q === "scopes") {
3353
3411
  const re = ((_ == null ? void 0 : _.scopes) ?? []).join(", ");
3354
- re && I.push(re);
3355
- } else if (H === "page") {
3356
- const re = (_ == null ? void 0 : _.page) ?? M.page ?? ga((_ == null ? void 0 : _.current_path) ?? M.current_path), fe = (_ == null ? void 0 : _.app) ?? M.app;
3357
- j = (fe ? `${re ?? ""}${re ? " · " : ""}${fe}`.trim() : re) || null, ie = !j && !!_ && !_.away;
3412
+ re && L.push(re);
3413
+ } else if (Q === "page") {
3414
+ const re = (_ == null ? void 0 : _.page) ?? A.page ?? wa((_ == null ? void 0 : _.current_path) ?? A.current_path), fe = (_ == null ? void 0 : _.app) ?? A.app;
3415
+ j = (fe ? `${re ?? ""}${re ? " · " : ""}${fe}`.trim() : re) || null, ce = !j && !!_ && !_.away;
3358
3416
  }
3359
- const ne = I.join(" · "), X = ie ? /* @__PURE__ */ a(
3417
+ const ee = L.join(" · "), ne = ce ? /* @__PURE__ */ a(
3360
3418
  "span",
3361
3419
  {
3362
3420
  className: "flex items-start gap-1 text-[11px] italic text-slate-400 dark:text-slate-500",
3363
3421
  "data-chat-online-page": "background",
3364
3422
  "data-tip": "Their app is open in a tab that is not in front, so where they are is not known until they look at it.",
3365
3423
  children: [
3366
- /* @__PURE__ */ e(Un, { className: "mt-[2px] h-3 w-3 shrink-0 opacity-60" }),
3424
+ /* @__PURE__ */ e(Rn, { className: "mt-[2px] h-3 w-3 shrink-0 opacity-60" }),
3367
3425
  /* @__PURE__ */ e("span", { className: "min-w-0 truncate", children: "Tab in background" })
3368
3426
  ]
3369
3427
  }
3370
3428
  ) : null;
3371
- return !ne && !j && !X ? /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: "Online" }) : /* @__PURE__ */ a(ke, { children: [
3372
- ne && /* @__PURE__ */ e(
3429
+ return !ee && !j && !ne ? /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: "Online" }) : /* @__PURE__ */ a(ke, { children: [
3430
+ ee && /* @__PURE__ */ e(
3373
3431
  "span",
3374
3432
  {
3375
3433
  className: "block truncate text-[11px] text-slate-400",
3376
3434
  "data-chat-online-meta": !0,
3377
- title: ne,
3378
- children: ne
3435
+ title: ee,
3436
+ children: ee
3379
3437
  }
3380
3438
  ),
3381
- X,
3439
+ ne,
3382
3440
  j && (() => {
3383
- const H = $n(
3441
+ const Q = On(
3384
3442
  _ == null ? void 0 : _.current_path,
3385
3443
  _ == null ? void 0 : _.app,
3386
- c.adminUrl,
3444
+ P.adminUrl,
3387
3445
  i.recordUrl,
3388
3446
  typeof window > "u" ? null : window.location.origin
3389
3447
  ), re = /* @__PURE__ */ a(ke, { children: [
3390
- /* @__PURE__ */ e(Un, { className: "mt-[2px] h-3 w-3 shrink-0 text-slate-400" }),
3448
+ /* @__PURE__ */ e(Rn, { className: "mt-[2px] h-3 w-3 shrink-0 text-slate-400" }),
3391
3449
  /* @__PURE__ */ e("span", { className: "line-clamp-2 min-w-0 break-words", children: j })
3392
3450
  ] });
3393
- return H ? (
3451
+ return Q ? (
3394
3452
  // biome-ignore lint/a11y/useSemanticElements: inside the row's DM button, where a nested <a> is invalid
3395
3453
  /* @__PURE__ */ e(
3396
3454
  "span",
@@ -3399,14 +3457,14 @@ ${An(j)}` : ""}`, ne = Mn(
3399
3457
  tabIndex: 0,
3400
3458
  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",
3401
3459
  "data-chat-online-page": !0,
3402
- "data-chat-online-page-href": H,
3403
- "data-tip": An(H),
3460
+ "data-chat-online-page-href": Q,
3461
+ "data-tip": Pn(Q),
3404
3462
  "aria-label": `${j}: open the page`,
3405
3463
  onClick: (fe) => {
3406
- fe.stopPropagation(), he(H);
3464
+ fe.stopPropagation(), ie(Q);
3407
3465
  },
3408
3466
  onKeyDown: (fe) => {
3409
- (fe.key === "Enter" || fe.key === " ") && (fe.preventDefault(), fe.stopPropagation(), he(H));
3467
+ (fe.key === "Enter" || fe.key === " ") && (fe.preventDefault(), fe.stopPropagation(), ie(Q));
3410
3468
  },
3411
3469
  children: re
3412
3470
  }
@@ -3425,21 +3483,21 @@ ${An(j)}` : ""}`, ne = Mn(
3425
3483
  })()
3426
3484
  ] }),
3427
3485
  (() => {
3428
- var ne;
3429
- const _ = c.byUser.get(String(M.user_id).toUpperCase());
3430
- if (!Z || !(_ != null && _.recording_id)) return null;
3431
- const I = ((ne = c.adminUrl) == null ? void 0 : ne.replace(/\/$/, "")) ?? "", j = !!I && (typeof window > "u" || new URL(I, window.location.origin).origin !== window.location.origin), ie = i.sessionUrl ? i.sessionUrl(_.recording_id, String(M.user_id)) : j ? `${I}/session-replays?recording=${_.recording_id}` : null;
3432
- return ie ? /* @__PURE__ */ e(
3486
+ var ee;
3487
+ const _ = P.byUser.get(String(A.user_id).toUpperCase());
3488
+ if (!_e || !(_ != null && _.recording_id)) return null;
3489
+ const L = ((ee = P.adminUrl) == null ? void 0 : ee.replace(/\/$/, "")) ?? "", j = !!L && (typeof window > "u" || new URL(L, window.location.origin).origin !== window.location.origin), ce = i.sessionUrl ? i.sessionUrl(_.recording_id, String(A.user_id)) : j ? `${L}/session-replays?recording=${_.recording_id}` : null;
3490
+ return ce ? /* @__PURE__ */ e(
3433
3491
  "span",
3434
3492
  {
3435
3493
  role: "link",
3436
3494
  tabIndex: 0,
3437
3495
  title: "Watch this session",
3438
- onClick: (X) => {
3439
- X.stopPropagation(), he(ie);
3496
+ onClick: (ne) => {
3497
+ ne.stopPropagation(), ie(ce);
3440
3498
  },
3441
- onKeyDown: (X) => {
3442
- (X.key === "Enter" || X.key === " ") && (X.stopPropagation(), he(ie));
3499
+ onKeyDown: (ne) => {
3500
+ (ne.key === "Enter" || ne.key === " ") && (ne.stopPropagation(), ie(ce));
3443
3501
  },
3444
3502
  className: "shrink-0 rounded p-1 text-slate-300 transition-colors hover:bg-slate-100 hover:text-nvr-cyan dark:hover:bg-muted",
3445
3503
  children: /* @__PURE__ */ e(Ja, { className: "h-4 w-4", strokeWidth: 1.8 })
@@ -3447,7 +3505,7 @@ ${An(j)}` : ""}`, ne = Mn(
3447
3505
  ) : null;
3448
3506
  })(),
3449
3507
  /* @__PURE__ */ e(
3450
- Gn,
3508
+ Yn,
3451
3509
  {
3452
3510
  className: "h-4 w-4 shrink-0 text-slate-300",
3453
3511
  strokeWidth: 1.8
@@ -3458,47 +3516,47 @@ ${An(j)}` : ""}`, ne = Mn(
3458
3516
  )
3459
3517
  ]
3460
3518
  },
3461
- M.user_id
3519
+ A.user_id
3462
3520
  );
3463
3521
  })
3464
3522
  ] }, k.key))
3465
3523
  ]
3466
3524
  }
3467
- ) : D === "archived" ? R ? /* @__PURE__ */ e(
3468
- qn,
3525
+ ) : U === "archived" ? R ? /* @__PURE__ */ e(
3526
+ Hn,
3469
3527
  {
3470
3528
  room: R.room,
3471
3529
  label: R.label,
3472
- onBack: () => K(null),
3530
+ onBack: () => J(null),
3473
3531
  renderMessageBody: l
3474
3532
  },
3475
3533
  R.room
3476
3534
  ) : /* @__PURE__ */ e(
3477
- Hn,
3535
+ Kn,
3478
3536
  {
3479
- rooms: te.rooms,
3480
- loading: te.loading,
3537
+ rooms: X.rooms,
3538
+ loading: X.loading,
3481
3539
  archivedView: !0,
3482
- onOpen: (k) => K({ room: k.room, label: k.label })
3540
+ onOpen: (k) => J({ room: k.room, label: k.label })
3483
3541
  }
3484
- ) : D === "browse" ? (
3542
+ ) : U === "browse" ? (
3485
3543
  // The tab is checked BEFORE the open room: leaving it last meant
3486
3544
  // switching to Browse with a conversation open kept showing that
3487
3545
  // conversation (or its settings) under the Browse tab.
3488
3546
  /* @__PURE__ */ e(
3489
3547
  pl,
3490
3548
  {
3491
- onOpen: (k, M, P) => {
3492
- F(!1), S({ room: k, label: M, channel: P }), A("chat");
3549
+ onOpen: (k, A, I) => {
3550
+ H(!1), S({ room: k, label: A, channel: I }), M("chat");
3493
3551
  }
3494
3552
  }
3495
3553
  )
3496
- ) : E ? /* @__PURE__ */ e(
3497
- bl,
3554
+ ) : q ? /* @__PURE__ */ e(
3555
+ gl,
3498
3556
  {
3499
- onClose: () => J(!1),
3500
- onCreated: (k, M) => {
3501
- J(!1), S({ room: k, label: M });
3557
+ onClose: () => Y(!1),
3558
+ onCreated: (k, A) => {
3559
+ Y(!1), S({ room: k, label: A });
3502
3560
  }
3503
3561
  }
3504
3562
  ) : C && G && C.channel ? /* @__PURE__ */ e(
@@ -3506,52 +3564,52 @@ ${An(j)}` : ""}`, ne = Mn(
3506
3564
  {
3507
3565
  channel: C.channel,
3508
3566
  label: C.label,
3509
- onBack: () => F(!1)
3567
+ onBack: () => H(!1)
3510
3568
  }
3511
3569
  ) : C ? /* @__PURE__ */ e(
3512
- qn,
3570
+ Hn,
3513
3571
  {
3514
3572
  room: C.room,
3515
3573
  label: C.label,
3516
- onOpenSettings: C.channel && !C.channel.is_direct ? () => F(!0) : void 0,
3574
+ onOpenSettings: C.channel && !C.channel.is_direct ? () => H(!0) : void 0,
3517
3575
  onBack: () => S(null),
3518
3576
  renderMessageBody: l,
3519
3577
  initialUnread: C.unread,
3520
3578
  anchor: C.anchor ?? null
3521
3579
  },
3522
3580
  C.room
3523
- ) : B === "mentions" ? /* @__PURE__ */ e(Yn, { th: p, onBack: () => $(null), onOpen: v }) : B === "scheduled" ? /* @__PURE__ */ e(
3524
- Zn,
3581
+ ) : W === "mentions" ? /* @__PURE__ */ e(ea, { th: m, onBack: () => $(null), onOpen: v }) : W === "scheduled" ? /* @__PURE__ */ e(
3582
+ ta,
3525
3583
  {
3526
- th: p,
3584
+ th: m,
3527
3585
  onBack: () => $(null),
3528
3586
  roomLabel: (k) => {
3529
- var M;
3530
- return ((M = ee.find((P) => P.room === k)) == null ? void 0 : M.label) ?? k;
3587
+ var A;
3588
+ return ((A = V.find((I) => I.room === k)) == null ? void 0 : A.label) ?? k;
3531
3589
  }
3532
3590
  }
3533
- ) : B === "catchup" ? /* @__PURE__ */ e(
3534
- Vn,
3591
+ ) : W === "catchup" ? /* @__PURE__ */ e(
3592
+ na,
3535
3593
  {
3536
- rooms: ee,
3537
- th: p,
3594
+ rooms: V,
3595
+ th: m,
3538
3596
  onBack: () => $(null),
3539
3597
  onOpen: v
3540
3598
  }
3541
3599
  ) : /* @__PURE__ */ e(
3542
- Hn,
3600
+ Kn,
3543
3601
  {
3544
- rooms: ee,
3545
- onOpen: (k, M) => {
3546
- F(!1), S({
3602
+ rooms: V,
3603
+ onOpen: (k, A) => {
3604
+ H(!1), S({
3547
3605
  room: k.room,
3548
3606
  label: k.label,
3549
3607
  channel: k.channel,
3550
3608
  unread: k.unread,
3551
- anchor: M
3609
+ anchor: A
3552
3610
  });
3553
3611
  },
3554
- onNewGroup: () => J(!0),
3612
+ onNewGroup: () => Y(!0),
3555
3613
  onView: $
3556
3614
  }
3557
3615
  )
@@ -3560,16 +3618,17 @@ ${An(j)}` : ""}`, ne = Mn(
3560
3618
  )
3561
3619
  ]
3562
3620
  }
3563
- ) : /* @__PURE__ */ e(Rn, {});
3621
+ ) : /* @__PURE__ */ e(In, {});
3564
3622
  }
3565
3623
  export {
3566
3624
  fl as ChatAppearAwayRow,
3567
3625
  pl as ChatChannelBrowser,
3568
3626
  dl as ChatChannelSettings,
3569
- ko as ChatPanel,
3570
- vo as ChatProvider,
3571
- Hn as ChatRoomList,
3572
- qn as ChatRoomView,
3573
- yo as ChatSideView,
3574
- gl as isChatPanelPinned
3627
+ wo as ChatPanel,
3628
+ yo as ChatProvider,
3629
+ Kn as ChatRoomList,
3630
+ Hn as ChatRoomView,
3631
+ ko as ChatSideView,
3632
+ vl as isChatPanelPinned,
3633
+ xl as onlineFirstOrder
3575
3634
  };