@nivaro/react 0.2.56 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/components/slots/TasksSlot.js +31 -29
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +73 -1
  5. package/dist/index.js +515 -505
  6. package/dist/shared/components/ItemEditForm.js +666 -658
  7. package/dist/shared/components/MyWorkView.js +47 -37
  8. package/dist/shared/components/ProfileView.js +163 -144
  9. package/dist/shared/components/ai/AiPlanCard.js +427 -0
  10. package/dist/shared/components/ai/AiPlanChanges.js +117 -0
  11. package/dist/shared/components/ai/TaskDo.js +1022 -0
  12. package/dist/shared/components/chat/ChatAnalyticsView.js +19 -17
  13. package/dist/shared/components/chat/ChatPanel.js +1356 -1317
  14. package/dist/shared/components/chat/HuddleAnalyticsTab.js +198 -0
  15. package/dist/shared/components/chat/RoomHeaderMenu.js +78 -65
  16. package/dist/shared/components/chat/chat-core.js +273 -264
  17. package/dist/shared/components/chat/huddle/HuddleAudioUi.js +397 -0
  18. package/dist/shared/components/chat/huddle/HuddleCallBar.js +296 -0
  19. package/dist/shared/components/chat/huddle/HuddleCallLayer.js +180 -0
  20. package/dist/shared/components/chat/huddle/HuddleCamera.js +124 -0
  21. package/dist/shared/components/chat/huddle/HuddleCollab.js +320 -0
  22. package/dist/shared/components/chat/huddle/HuddleControls.js +82 -121
  23. package/dist/shared/components/chat/huddle/HuddleDraw.js +231 -0
  24. package/dist/shared/components/chat/huddle/HuddleLiveBadge.js +52 -0
  25. package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +143 -0
  26. package/dist/shared/components/chat/huddle/HuddleScheduleCard.js +190 -0
  27. package/dist/shared/components/chat/huddle/HuddleScheduleForm.js +188 -0
  28. package/dist/shared/components/chat/huddle/HuddleStage.js +184 -89
  29. package/dist/shared/components/chat/huddle/HuddleStageTools.js +197 -0
  30. package/dist/shared/components/chat/huddle/huddle-audio-logic.js +156 -0
  31. package/dist/shared/components/chat/huddle/huddle-audio.js +69 -0
  32. package/dist/shared/components/chat/huddle/huddle-calls.js +129 -0
  33. package/dist/shared/components/chat/huddle/huddle-camera.js +143 -0
  34. package/dist/shared/components/chat/huddle/huddle-collab-store.js +391 -0
  35. package/dist/shared/components/chat/huddle/huddle-device-prefs.js +55 -0
  36. package/dist/shared/components/chat/huddle/huddle-devices.js +99 -0
  37. package/dist/shared/components/chat/huddle/huddle-draw.js +226 -0
  38. package/dist/shared/components/chat/huddle/huddle-follow-bus.js +96 -0
  39. package/dist/shared/components/chat/huddle/huddle-hold.js +62 -0
  40. package/dist/shared/components/chat/huddle/huddle-link-quality.js +159 -0
  41. package/dist/shared/components/chat/huddle/huddle-live.js +82 -0
  42. package/dist/shared/components/chat/huddle/huddle-pip.js +343 -0
  43. package/dist/shared/components/chat/huddle/huddle-quality.js +22 -0
  44. package/dist/shared/components/chat/huddle/huddle-reactions.js +71 -0
  45. package/dist/shared/components/chat/huddle/huddle-ring-refused.js +34 -0
  46. package/dist/shared/components/chat/huddle/huddle-schedule.js +102 -0
  47. package/dist/shared/components/chat/huddle/huddle-sfu.js +176 -0
  48. package/dist/shared/components/chat/huddle/huddle-shortcuts.js +91 -0
  49. package/dist/shared/components/chat/huddle/huddle-speaking.js +100 -0
  50. package/dist/shared/components/chat/huddle/huddle-store.js +431 -157
  51. package/dist/shared/components/chat/huddle/useHuddle.js +46 -38
  52. package/dist/shared/components/chat/huddle/useHuddleAudio.js +35 -0
  53. package/dist/shared/components/item-edit/GroupSection.js +1 -0
  54. package/dist/shared/components/item-edit/RecordChatActions.js +68 -59
  55. package/dist/shared/components/item-edit/UserChip.js +145 -142
  56. package/dist/shared/components/panels/TaskPanel.js +51 -49
  57. package/dist/shared/components/support/TicketDetailSheet.js +57 -42
  58. package/dist/shared/lib/notification-sound.js +25 -16
  59. package/package.json +2 -1
@@ -0,0 +1,188 @@
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import { useQueryClient as H, useMutation as I } from "@tanstack/react-query";
3
+ import { X as L } from "lucide-react";
4
+ import { useState as d } from "react";
5
+ import { toast as W } from "sonner";
6
+ import { useNivaroClient as $ } from "../../../context.js";
7
+ import { post as j } from "../../../lib/commands.js";
8
+ import { cn as S } from "../../../lib/utils.js";
9
+ import { SimpleSelectXs as q } from "../../ui/SimpleSelect.js";
10
+ import { dmPeer as E } from "../chat-core.js";
11
+ import { HuddlePeopleList as U } from "./HuddlePeoplePicker.js";
12
+ import { toLocalInput as O, defaultStart as Q } from "./huddle-schedule.js";
13
+ const R = [
14
+ { value: "15", label: "15 min" },
15
+ { value: "30", label: "30 min" },
16
+ { value: "45", label: "45 min" },
17
+ { value: "60", label: "1 hour" },
18
+ { value: "90", label: "1½ hours" },
19
+ { value: "120", label: "2 hours" }
20
+ ], C = "h-8 w-full rounded-md border border-slate-200 bg-white px-2 text-[12.5px] text-slate-900 outline-none placeholder:text-slate-400 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-slate-100";
21
+ function te({
22
+ room: i,
23
+ me: b,
24
+ renderAvatar: v,
25
+ onDone: f,
26
+ theme: r
27
+ }) {
28
+ const D = $(), P = H(), o = b ? E(i, b) : null, [h, T] = d(""), [c, F] = d(() => O(Q())), [g, M] = d("30"), [u, k] = d(
29
+ () => o ? /* @__PURE__ */ new Map([[o.toUpperCase(), "them"]]) : /* @__PURE__ */ new Map()
30
+ ), [N, w] = d(null), p = I({
31
+ mutationFn: () => D.request(
32
+ j("/chat/huddle/schedules", {
33
+ room: i,
34
+ title: h,
35
+ starts_at: new Date(c).toISOString(),
36
+ duration_min: Number(g),
37
+ invitees: [...u.keys()]
38
+ })
39
+ ),
40
+ onSuccess: (e) => {
41
+ P.invalidateQueries({ queryKey: ["nvr-huddle-schedules", i] }), W.success(`Huddle scheduled — "${e.data.title}"`, {
42
+ description: e.data.invitees.length > 0 ? `${e.data.invitees.length} ${e.data.invitees.length === 1 ? "person was" : "people were"} invited. Everyone gets a reminder five minutes before.` : "The room has the card; invite people from it later."
43
+ }), f();
44
+ },
45
+ onError: (e) => {
46
+ var a;
47
+ return w(
48
+ ((a = e == null ? void 0 : e.response) == null ? void 0 : a.error) ?? (e == null ? void 0 : e.message) ?? "Could not schedule it"
49
+ );
50
+ }
51
+ }), x = Number.isNaN(new Date(c).getTime()), m = !x && new Date(c).getTime() < Date.now() + 6e4, y = h.trim().length > 0 && !x && !m && !p.isPending;
52
+ return /* @__PURE__ */ l(
53
+ "form",
54
+ {
55
+ className: "space-y-2.5 p-0.5",
56
+ onSubmit: (e) => {
57
+ e.preventDefault(), w(null), y && p.mutate();
58
+ },
59
+ "data-huddle-schedule-form": !0,
60
+ children: [
61
+ /* @__PURE__ */ l("div", { children: [
62
+ /* @__PURE__ */ t(
63
+ "label",
64
+ {
65
+ htmlFor: "huddle-sched-title",
66
+ className: "mb-1 block text-[11px] font-medium text-slate-500 dark:text-slate-400",
67
+ children: "Title"
68
+ }
69
+ ),
70
+ /* @__PURE__ */ t(
71
+ "input",
72
+ {
73
+ id: "huddle-sched-title",
74
+ value: h,
75
+ onChange: (e) => T(e.target.value),
76
+ maxLength: 200,
77
+ placeholder: "What is it about?",
78
+ className: S(C, r == null ? void 0 : r.input)
79
+ }
80
+ )
81
+ ] }),
82
+ /* @__PURE__ */ l("div", { className: "flex items-end gap-2", children: [
83
+ /* @__PURE__ */ l("div", { className: "min-w-0 flex-1", children: [
84
+ /* @__PURE__ */ t(
85
+ "label",
86
+ {
87
+ htmlFor: "huddle-sched-when",
88
+ className: "mb-1 block text-[11px] font-medium text-slate-500 dark:text-slate-400",
89
+ children: "Starts"
90
+ }
91
+ ),
92
+ /* @__PURE__ */ t(
93
+ "input",
94
+ {
95
+ id: "huddle-sched-when",
96
+ type: "datetime-local",
97
+ value: c,
98
+ onChange: (e) => F(e.target.value),
99
+ className: S(C, r == null ? void 0 : r.input, m && "border-red-400 dark:border-red-500"),
100
+ "aria-invalid": m || x
101
+ }
102
+ )
103
+ ] }),
104
+ /* @__PURE__ */ l("div", { className: "shrink-0", children: [
105
+ /* @__PURE__ */ t("span", { className: "mb-1 block text-[11px] font-medium text-slate-500 dark:text-slate-400", children: "For" }),
106
+ /* @__PURE__ */ t(
107
+ q,
108
+ {
109
+ value: g,
110
+ onChange: M,
111
+ options: R,
112
+ ariaLabel: "Duration",
113
+ className: "h-8 text-[12px]"
114
+ }
115
+ )
116
+ ] })
117
+ ] }),
118
+ m && /* @__PURE__ */ t("p", { className: "text-[11px] text-red-600 dark:text-red-300", children: "Pick a time at least a minute from now." }),
119
+ !o && /* @__PURE__ */ l("div", { children: [
120
+ /* @__PURE__ */ t("span", { className: "mb-1 block text-[11px] font-medium text-slate-500 dark:text-slate-400", children: "Invite" }),
121
+ u.size > 0 && /* @__PURE__ */ t("div", { className: "mb-1.5 flex flex-wrap gap-1", "data-huddle-sched-invitees": !0, children: [...u].map(([e, a]) => /* @__PURE__ */ l(
122
+ "span",
123
+ {
124
+ className: "inline-flex h-6 items-center gap-1 rounded-full bg-slate-100 pl-0.5 pr-1 text-[11px] text-slate-700 dark:bg-muted dark:text-slate-200",
125
+ children: [
126
+ /* @__PURE__ */ t("span", { style: { lineHeight: 0 }, children: v(e, a) }),
127
+ /* @__PURE__ */ t("span", { className: "max-w-[120px] truncate", children: a }),
128
+ /* @__PURE__ */ t(
129
+ "button",
130
+ {
131
+ type: "button",
132
+ onClick: () => k((s) => {
133
+ const n = new Map(s);
134
+ return n.delete(e), n;
135
+ }),
136
+ className: "grid h-4 w-4 place-items-center rounded-full text-slate-500 hover:bg-slate-200 hover:text-slate-800 dark:hover:bg-white/10 dark:hover:text-slate-100",
137
+ "aria-label": `Remove ${a}`,
138
+ children: /* @__PURE__ */ t(L, { className: "h-3 w-3", strokeWidth: 2 })
139
+ }
140
+ )
141
+ ]
142
+ },
143
+ e
144
+ )) }),
145
+ /* @__PURE__ */ t("div", { className: "rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */ t(
146
+ U,
147
+ {
148
+ room: i,
149
+ selected: new Set(u.keys()),
150
+ renderAvatar: v,
151
+ placeholder: "Add people who can see this room…",
152
+ onPick: (e) => k((a) => {
153
+ const s = new Map(a), n = e.id.toUpperCase();
154
+ return s.has(n) ? s.delete(n) : s.set(n, e.name), s;
155
+ })
156
+ }
157
+ ) })
158
+ ] }),
159
+ o && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: "The other person in this conversation is invited and will be called at the start." }),
160
+ N && /* @__PURE__ */ t("p", { className: "text-[11px] text-red-600 dark:text-red-300", role: "alert", children: N }),
161
+ /* @__PURE__ */ l("div", { className: "flex items-center justify-end gap-1.5 pt-0.5", children: [
162
+ /* @__PURE__ */ t(
163
+ "button",
164
+ {
165
+ type: "button",
166
+ onClick: f,
167
+ className: "h-7 rounded-md px-2 text-[12px] text-slate-600 hover:bg-muted dark:text-slate-300",
168
+ children: "Cancel"
169
+ }
170
+ ),
171
+ /* @__PURE__ */ t(
172
+ "button",
173
+ {
174
+ type: "submit",
175
+ disabled: !y,
176
+ className: "h-7 rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white hover:bg-[#00b8e0] disabled:opacity-40 disabled:hover:bg-nvr-cyan",
177
+ "data-huddle-sched-save": !0,
178
+ children: p.isPending ? "Scheduling…" : "Schedule"
179
+ }
180
+ )
181
+ ] })
182
+ ]
183
+ }
184
+ );
185
+ }
186
+ export {
187
+ te as HuddleScheduleForm
188
+ };
@@ -1,164 +1,259 @@
1
- import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
- import { X as f, Headphones as x, MicOff as b, ScreenShare as g, Maximize2 as k } from "lucide-react";
3
- import { useState as v, useEffect as h, useRef as N } from "react";
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import { CircleAlert as C, X as y, MicOff as O, ScreenShare as j, PhoneOutgoing as E, BellOff as R, Maximize2 as $ } from "lucide-react";
3
+ import { useMemo as W, useSyncExternalStore as w, useEffect as S, useRef as k } from "react";
4
4
  import { cn as p } from "../../../lib/utils.js";
5
- import { formatElapsed as y } from "./huddle-store.js";
6
- function u({
7
- stream: a,
8
- label: r,
9
- mirror: n
5
+ import { MutedTalkingHint as M, PoorConnectionBanner as P, SpeakingRing as G, QualityBars as I } from "./HuddleAudioUi.js";
6
+ import { HuddleCallBar as T } from "./HuddleCallBar.js";
7
+ import { HuddleVideoGrid as _ } from "./HuddleCamera.js";
8
+ import { HuddleNotesPanel as F } from "./HuddleCollab.js";
9
+ import { HuddleDrawOverlay as q } from "./HuddleDraw.js";
10
+ import { HuddleHands as A, HuddleCameraNotice as B, HuddleReactionLayer as V } from "./HuddleStageTools.js";
11
+ import { huddleCalls as f } from "./huddle-calls.js";
12
+ import { subscribeHeld as X, getHeldSnapshot as z } from "./huddle-hold.js";
13
+ import { useHuddlePip as D, HuddlePipOffer as Q } from "./huddle-pip.js";
14
+ import { useHuddleSpeaking as J, useHuddleQuality as L } from "./useHuddleAudio.js";
15
+ const Y = [];
16
+ function K({ p: t, onCancel: a }) {
17
+ const s = t.state === "ringing" ? `Ringing ${t.name ?? "someone"}…` : t.state === "accepted" ? `${t.name ?? "Someone"} is joining` : t.state === "declined" ? `${t.name ?? "Someone"} declined` : `No answer from ${t.name ?? "someone"}`;
18
+ return /* @__PURE__ */ c(
19
+ "span",
20
+ {
21
+ className: p(
22
+ "inline-flex h-6 items-center gap-1 rounded-full border border-dashed px-2 text-[11px]",
23
+ t.state === "ringing" ? "border-nvr-cyan/60 text-slate-700 dark:text-slate-200" : "border-slate-300 text-slate-500 dark:border-border dark:text-slate-400"
24
+ ),
25
+ "data-huddle-ringing": t.id,
26
+ "data-state": t.state,
27
+ children: [
28
+ t.state === "ringing" && /* @__PURE__ */ e(
29
+ E,
30
+ {
31
+ className: "h-3 w-3 text-nvr-cyan motion-safe:animate-pulse",
32
+ strokeWidth: 2
33
+ }
34
+ ),
35
+ s,
36
+ t.state === "ringing" && /* @__PURE__ */ e(
37
+ "button",
38
+ {
39
+ type: "button",
40
+ onClick: a,
41
+ className: "ml-0.5 grid h-4 w-4 place-items-center rounded-full text-slate-500 hover:bg-slate-200 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:hover:bg-white/10 dark:hover:text-slate-100",
42
+ "aria-label": "Stop ringing",
43
+ "data-tip": "Stop ringing",
44
+ children: /* @__PURE__ */ e(y, { className: "h-3 w-3", strokeWidth: 2 })
45
+ }
46
+ )
47
+ ]
48
+ }
49
+ );
50
+ }
51
+ function U() {
52
+ const t = w(X, z, () => 0);
53
+ return t ? /* @__PURE__ */ c(
54
+ "span",
55
+ {
56
+ className: "inline-flex h-6 items-center gap-1 rounded-full bg-slate-200/70 px-2 text-[11px] text-slate-600 dark:bg-white/10 dark:text-slate-300",
57
+ "data-tip": `${t} held until you leave — the inbox already has ${t === 1 ? "it" : "them"}`,
58
+ "data-huddle-held": t,
59
+ children: [
60
+ /* @__PURE__ */ e(R, { className: "h-3 w-3", strokeWidth: 2 }),
61
+ t,
62
+ " held"
63
+ ]
64
+ }
65
+ ) : null;
66
+ }
67
+ function v({
68
+ stream: t,
69
+ label: a,
70
+ mirror: s,
71
+ screen: o
10
72
  }) {
11
- const s = N(null);
12
- return h(() => {
13
- const e = s.current;
14
- if (e)
15
- return e.srcObject = a, e.play().catch(() => null), () => {
16
- e.srcObject = null;
73
+ const r = k(null), l = k(null);
74
+ return S(() => {
75
+ const n = r.current;
76
+ if (n)
77
+ return n.srcObject = t, n.play().catch(() => null), () => {
78
+ n.srcObject = null;
17
79
  };
18
- }, [a]), /* @__PURE__ */ d(
80
+ }, [t]), /* @__PURE__ */ c(
19
81
  "div",
20
82
  {
83
+ ref: l,
21
84
  className: p(
22
- "group relative overflow-hidden rounded-lg bg-[#0f172a]",
23
- n ? "max-h-[120px]" : "max-h-[280px]"
85
+ "group relative overflow-hidden rounded-lg bg-[#0f172a] [&:fullscreen]:flex [&:fullscreen]:max-h-none [&:fullscreen]:items-center [&:fullscreen]:rounded-none",
86
+ s ? "max-h-[120px]" : "max-h-[280px]"
24
87
  ),
25
- "data-huddle-screen": n ? "mine" : "peer",
88
+ "data-huddle-screen": s ? "mine" : "peer",
26
89
  children: [
27
- /* @__PURE__ */ t("video", { ref: s, muted: !0, playsInline: !0, className: "mx-auto block max-h-[inherit] w-auto" }),
28
- /* @__PURE__ */ t("span", { className: "absolute bottom-1.5 left-2 rounded bg-black/55 px-1.5 py-0.5 text-[10.5px] font-medium text-white", children: r }),
29
- !n && /* @__PURE__ */ t(
90
+ /* @__PURE__ */ e(
91
+ "video",
92
+ {
93
+ ref: r,
94
+ muted: !0,
95
+ playsInline: !0,
96
+ className: "mx-auto block max-h-[inherit] w-auto max-w-full [:fullscreen>&]:h-full [:fullscreen>&]:max-h-full"
97
+ }
98
+ ),
99
+ o && /* @__PURE__ */ e(q, { screen: o, videoRef: r, presenter: s }),
100
+ /* @__PURE__ */ e("span", { className: "absolute bottom-1.5 left-2 rounded bg-black/55 px-1.5 py-0.5 text-[10.5px] font-medium text-white", children: a }),
101
+ !s && /* @__PURE__ */ e(
30
102
  "button",
31
103
  {
32
104
  type: "button",
33
105
  onClick: () => {
34
- var e, o;
35
- return void ((o = (e = s.current) == null ? void 0 : e.requestFullscreen) == null ? void 0 : o.call(e));
106
+ var n, d;
107
+ return void ((d = (n = l.current ?? r.current) == null ? void 0 : n.requestFullscreen) == null ? void 0 : d.call(n));
36
108
  },
37
109
  className: "absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded bg-black/55 text-white opacity-0 transition-opacity focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan group-hover:opacity-100",
38
110
  "aria-label": "View the shared screen full size",
39
111
  "data-tip": "Full screen",
40
- children: /* @__PURE__ */ t(k, { className: "h-3.5 w-3.5", strokeWidth: 2 })
112
+ children: /* @__PURE__ */ e($, { className: "h-3.5 w-3.5", strokeWidth: 2 })
41
113
  }
42
114
  )
43
115
  ]
44
116
  }
45
117
  );
46
118
  }
47
- function w({ since: a }) {
48
- const [, r] = v(0);
49
- return h(() => {
50
- const n = setInterval(() => r((s) => s + 1), 1e3);
51
- return () => clearInterval(n);
52
- }, []), a ? /* @__PURE__ */ t("span", { className: "tabular-nums text-slate-500 dark:text-slate-400", "data-huddle-elapsed": !0, children: y(Date.now() - a) }) : null;
53
- }
54
- function m({
55
- id: a,
56
- name: r,
57
- muted: n,
58
- screen: s,
59
- connection: e,
60
- renderAvatar: o
119
+ function N({
120
+ id: t,
121
+ name: a,
122
+ muted: s,
123
+ screen: o,
124
+ connection: r,
125
+ speaking: l = !1,
126
+ quality: n,
127
+ renderAvatar: d
61
128
  }) {
62
- const l = e === "new" || e === "connecting";
63
- return /* @__PURE__ */ d(
129
+ const m = r === "new" || r === "connecting";
130
+ return /* @__PURE__ */ c(
64
131
  "span",
65
132
  {
66
133
  className: p(
67
134
  "inline-flex h-6 items-center gap-1 rounded-full bg-slate-100 pl-0.5 pr-2 text-[11px] text-slate-700 dark:bg-muted dark:text-slate-200",
68
- l && "opacity-60",
69
- e === "failed" && "text-red-600 dark:text-red-300"
135
+ m && "opacity-60",
136
+ r === "failed" && "text-red-600 dark:text-red-300"
70
137
  ),
71
- "data-tip": e === "failed" ? `${r ?? "Someone"} — connection failed` : l ? `${r ?? "Someone"} — connecting` : void 0,
72
- "data-huddle-person": a,
138
+ "data-tip": r === "failed" ? `${a ?? "Someone"} — connection failed` : m ? `${a ?? "Someone"} — connecting` : void 0,
139
+ "data-huddle-person": t,
73
140
  children: [
74
- /* @__PURE__ */ t("span", { style: { lineHeight: 0 }, children: o(a, r) }),
75
- /* @__PURE__ */ t("span", { className: "max-w-[120px] truncate", children: r ?? "Someone" }),
76
- n && /* @__PURE__ */ t(b, { className: "h-3 w-3 text-slate-400", strokeWidth: 2, "aria-label": "muted" }),
77
- s && /* @__PURE__ */ t(g, { className: "h-3 w-3 text-nvr-cyan", strokeWidth: 2, "aria-label": "sharing" })
141
+ /* @__PURE__ */ e(G, { speaking: l && !s, children: d(t, a) }),
142
+ /* @__PURE__ */ e("span", { className: "max-w-[120px] truncate", children: a ?? "Someone" }),
143
+ r === "connected" && n !== null && /* @__PURE__ */ e(I, { name: a ?? "Someone", quality: n }),
144
+ s && /* @__PURE__ */ e(O, { className: "h-3 w-3 text-slate-400", strokeWidth: 2, "aria-label": "muted" }),
145
+ o && /* @__PURE__ */ e(j, { className: "h-3 w-3 text-nvr-cyan", strokeWidth: 2, "aria-label": "sharing" })
78
146
  ]
79
147
  }
80
148
  );
81
149
  }
82
- function O({
83
- room: a,
84
- me: r,
85
- huddle: n,
86
- renderAvatar: s
150
+ function he({
151
+ room: t,
152
+ me: a,
153
+ huddle: s,
154
+ renderAvatar: o
87
155
  }) {
88
- const { state: e, inThis: o } = n;
89
- if (e.status === "error" && (e.room === a || !e.room))
90
- return /* @__PURE__ */ d(
156
+ const { state: r, inThis: l } = s, n = J(), d = L(), m = W(() => {
157
+ const i = new Map(n.order.map((h, g) => [h, g]));
158
+ return [...r.peers].sort(
159
+ (h, g) => (i.get(h.socket) ?? Number.MAX_SAFE_INTEGER) - (i.get(g.socket) ?? Number.MAX_SAFE_INTEGER)
160
+ );
161
+ }, [r.peers, n.order]), b = D(l, a), x = w(f.subscribe, f.getSnapshot).outgoing[t] ?? Y;
162
+ if (S(() => {
163
+ l || f.clearOutgoing(t);
164
+ }, [l, t]), r.status === "error" && (r.room === t || !r.room))
165
+ return /* @__PURE__ */ c(
91
166
  "div",
92
167
  {
93
168
  className: "flex items-center gap-2 border-b border-red-200 bg-red-50 px-3 py-1.5 text-[11.5px] text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200",
94
169
  role: "alert",
95
170
  "data-huddle-error": !0,
96
171
  children: [
97
- /* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: e.error }),
98
- /* @__PURE__ */ t(
172
+ /* @__PURE__ */ e(C, { className: "h-3.5 w-3.5 shrink-0", strokeWidth: 2, "aria-hidden": !0 }),
173
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1", children: r.error }),
174
+ /* @__PURE__ */ e(
99
175
  "button",
100
176
  {
101
177
  type: "button",
102
- onClick: n.clearError,
103
- className: "flex h-5 w-5 items-center justify-center rounded hover:bg-red-100 dark:hover:bg-red-500/20",
178
+ onClick: s.clearError,
179
+ className: "flex h-5 w-5 shrink-0 items-center justify-center rounded hover:bg-red-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:hover:bg-red-500/20",
104
180
  "aria-label": "Dismiss",
105
- children: /* @__PURE__ */ t(f, { className: "h-3 w-3", strokeWidth: 2 })
181
+ children: /* @__PURE__ */ e(y, { className: "h-3 w-3", strokeWidth: 2 })
106
182
  }
107
183
  )
108
184
  ]
109
185
  }
110
186
  );
111
- if (!o) return null;
112
- const l = e.peers.find((i) => i.video), c = e.status === "joining";
113
- return /* @__PURE__ */ d(
187
+ if (!l) return null;
188
+ const u = r.peers.find((i) => i.video), H = r.status === "joining";
189
+ return /* @__PURE__ */ c(
114
190
  "div",
115
191
  {
116
- className: "shrink-0 border-b border-slate-200 bg-slate-50 px-3 py-1.5 dark:border-border dark:bg-background motion-safe:animate-in motion-safe:fade-in motion-safe:duration-200",
192
+ className: "relative shrink-0 border-b border-slate-200 bg-slate-50 px-3 py-1.5 dark:border-border dark:bg-background motion-safe:animate-in motion-safe:fade-in motion-safe:duration-200",
117
193
  "data-huddle-stage": !0,
194
+ "data-huddle-mode": r.mode,
118
195
  children: [
119
- /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-1.5 text-[11px]", children: [
120
- /* @__PURE__ */ d("span", { className: "inline-flex items-center gap-1 font-medium text-slate-700 dark:text-slate-200", children: [
121
- /* @__PURE__ */ t(x, { className: "h-3.5 w-3.5 text-nvr-cyan", strokeWidth: 2 }),
122
- c ? "Connecting…" : "Huddle"
123
- ] }),
124
- !c && /* @__PURE__ */ t(w, { since: e.startedAt }),
125
- /* @__PURE__ */ t("span", { className: "mx-0.5 h-3 w-px bg-slate-200 dark:bg-border", "aria-hidden": !0 }),
126
- r && /* @__PURE__ */ t(
127
- m,
196
+ /* @__PURE__ */ e(T, { room: t, me: a, huddle: s, pip: b, renderAvatar: o }),
197
+ /* @__PURE__ */ c("div", { className: "mt-1.5 flex flex-wrap items-center gap-1 text-[11px]", "data-huddle-people": !0, children: [
198
+ a && /* @__PURE__ */ e(
199
+ N,
128
200
  {
129
- id: r.id,
130
- name: r.name,
131
- muted: e.muted,
132
- screen: e.sharing,
133
- renderAvatar: s
201
+ id: a.id,
202
+ name: a.name,
203
+ muted: r.muted,
204
+ screen: r.sharing,
205
+ speaking: n.selfSpeaking,
206
+ quality: null,
207
+ renderAvatar: o
134
208
  }
135
209
  ),
136
- e.peers.map((i) => /* @__PURE__ */ t(
137
- m,
210
+ n.mutedTalking && /* @__PURE__ */ e(M, {}),
211
+ m.map((i) => /* @__PURE__ */ e(
212
+ N,
138
213
  {
139
214
  id: i.user,
140
215
  name: i.name,
141
216
  muted: i.muted,
142
217
  screen: i.screen,
143
218
  connection: i.connection,
144
- renderAvatar: s
219
+ speaking: !!n.speaking[i.socket],
220
+ quality: d.peers[i.socket],
221
+ renderAvatar: o
145
222
  },
146
223
  i.socket
147
224
  )),
148
- !c && e.peers.length === 0 && /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: "Only you so far — people in the room see a Join button." })
225
+ x.map((i) => /* @__PURE__ */ e(K, { p: i, onCancel: () => f.cancel(t) }, i.id)),
226
+ !H && r.peers.length === 0 && x.length === 0 && /* @__PURE__ */ e("span", { className: "px-1 text-slate-500 dark:text-slate-400", children: "Only you so far — people in the room see a Join button." }),
227
+ /* @__PURE__ */ e(U, {})
149
228
  ] }),
150
- (l == null ? void 0 : l.video) && /* @__PURE__ */ t("div", { className: "mt-1.5", children: /* @__PURE__ */ t(
151
- u,
229
+ /* @__PURE__ */ e(F, { room: t }),
230
+ d.poor && /* @__PURE__ */ e(P, { sharing: r.sharing }),
231
+ /* @__PURE__ */ e(A, { roster: s.roster, self: r.self }),
232
+ /* @__PURE__ */ e(Q, { pip: b }),
233
+ /* @__PURE__ */ e(B, {}),
234
+ /* @__PURE__ */ e(_, { peers: r.peers, roster: s.roster, muted: r.muted }),
235
+ (u == null ? void 0 : u.video) && /* @__PURE__ */ e("div", { className: "mt-1.5", children: /* @__PURE__ */ e(
236
+ v,
237
+ {
238
+ stream: u.video,
239
+ label: `${u.name ?? "Someone"}'s screen`,
240
+ screen: u.socket
241
+ }
242
+ ) }),
243
+ r.sharing && r.localScreen && /* @__PURE__ */ e("div", { className: "mt-1.5", children: /* @__PURE__ */ e(
244
+ v,
152
245
  {
153
- stream: l.video,
154
- label: `${l.name ?? "Someone"}'s screen`
246
+ stream: r.localScreen,
247
+ label: "You are sharing your screen",
248
+ mirror: !0,
249
+ screen: r.self
155
250
  }
156
251
  ) }),
157
- e.sharing && e.localScreen && /* @__PURE__ */ t("div", { className: "mt-1.5", children: /* @__PURE__ */ t(u, { stream: e.localScreen, label: "You are sharing your screen", mirror: !0 }) })
252
+ /* @__PURE__ */ e(V, { roster: s.roster, me: a })
158
253
  ]
159
254
  }
160
255
  );
161
256
  }
162
257
  export {
163
- O as HuddleStage
258
+ he as HuddleStage
164
259
  };