@burdenoff/fe-libs 2026.1114.11 → 2026.1114.13

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.
@@ -7,152 +7,198 @@ import { VoiceMiniController as te } from "./VoiceMiniController.js";
7
7
  import { useLiveAvatarHandsFreeGuard as i, useLiveAvatarTab as ne, useLiveAvatarVoiceView as re } from "../assistantLiveAvatarSeam.js";
8
8
  import { useAvatarCopy as a } from "../../avatar/useAvatarCopy.js";
9
9
  import { VoiceTranscriptDrawer as ie } from "./VoiceTranscriptDrawer.js";
10
- import { HandsFreePrivacyNotice as ae } from "./HandsFreePrivacyNotice.js";
11
- import { escapeBelongsToLayerAbove as o, voiceSessionEscapeAction as oe } from "./voiceSessionEscape.js";
12
- import { ASSISTANT_PANEL_ATTR as se, ASSISTANT_VOICE_SESSION_ATTR as ce } from "../panelOverlays.js";
13
- import { focusWasDropped as le, useReturnFocus as ue } from "../../../hooks/useReturnFocus.js";
14
- import { micIsInterrupt as s, showsAssistantCaption as de, voiceStageState as fe } from "../../voice/voiceStageState.js";
15
- import { VOICE_THINKING_LABEL as pe, composeVoiceStatus as me, voiceStatusSuffix as he } from "../../voice/voiceStatus.js";
16
- import { useAssistantTr as ge } from "../../i18n.js";
17
- import { spokenSoFar as _e } from "../../voice/voiceSession.js";
18
- import { useCallback as ve, useEffect as c, useMemo as ye, useRef as l, useState as u } from "react";
19
- import { Maximize2 as be, Mic as xe, MicOff as Se, Minimize2 as Ce, ScrollText as we, ShieldAlert as Te, Square as Ee, X as d } from "lucide-react";
20
- import { Fragment as De, jsx as f, jsxs as p } from "react/jsx-runtime";
10
+ import { AssistantPageVoiceBar as ae } from "./AssistantPageVoiceBar.js";
11
+ import { useLiveLevel as o } from "./useLiveLevel.js";
12
+ import { HandsFreePrivacyNotice as oe } from "./HandsFreePrivacyNotice.js";
13
+ import { escapeBelongsToLayerAbove as se, voiceSessionEscapeAction as ce } from "./voiceSessionEscape.js";
14
+ import { ASSISTANT_PANEL_ATTR as le, ASSISTANT_VOICE_SESSION_ATTR as ue } from "../panelOverlays.js";
15
+ import { focusWasDropped as de, useReturnFocus as fe } from "../../../hooks/useReturnFocus.js";
16
+ import { micIsInterrupt as s, showsAssistantCaption as pe, voiceStageState as me } from "../../voice/voiceStageState.js";
17
+ import { VOICE_THINKING_LABEL as he, composeVoiceStatus as ge, voiceStatusSuffix as _e } from "../../voice/voiceStatus.js";
18
+ import { useAssistantTr as ve } from "../../i18n.js";
19
+ import { spokenSoFar as ye } from "../../voice/voiceSession.js";
20
+ import { useCallback as be, useEffect as c, useMemo as xe, useRef as l, useState as u } from "react";
21
+ import { Maximize2 as Se, Mic as Ce, MicOff as we, Minimize2 as Te, ScrollText as Ee, ShieldAlert as De, Square as Oe, X as d } from "lucide-react";
22
+ import { Fragment as ke, jsx as f, jsxs as p } from "react/jsx-runtime";
23
+ import { createPortal as Ae } from "react-dom";
21
24
  // src/shared/assistant/ui/voice/AssistantVoiceSession.tsx
22
- var m = ({ session: m, turns: ke = [], onSaveTranscript: je, onContinueInChat: Me, notice: g = null, privacyNotice: _ = null, spoken: Ne, onInterrupt: Pe, onToggleMute: v, attachments: Fe = [], onAttachFiles: y, onRemoveAttachment: Ie, onRetryAttachment: Le, canAttachMore: Re = !0, preparingAttachments: ze = 0, attachmentsLocked: b = !1, attachmentNotice: x = null, spokenChunks: Be = null, onEnd: S, capturing: Ve = !0, interrupting: He = !1, awaitingEndpoint: Ue = !1, holding: C = !1, correcting: We = !1, onLetMeFinish: Ge, onImDone: Ke, proposalChip: w = null, proposalTray: T = null, renderAfterTurn: qe, onViewChange: Je, view: E, startedCue: D }) => {
23
- let O = ge(), { muted: k, error: A } = m, j = l(null), M = l(null), [Ye, N] = u("mini"), P = E !== void 0, F = E === "compact", [I, Xe] = u(E);
24
- I !== E && (Xe(E), E === void 0 && I !== void 0 && N(I === "compact" ? "panel" : I));
25
- let Ze = E === void 0 ? Ye : E === "compact" ? "panel" : E, L = ne().open, [Qe, $e] = u(L);
26
- Qe !== L && ($e(L), L && Ye !== "mini" && N("mini"));
27
- let R = re(Ze, m.phase === "ended"), et = i();
25
+ var m = ({ session: m, turns: Me = [], onSaveTranscript: Pe, onContinueInChat: Fe, notice: g = null, privacyNotice: _ = null, spoken: Ie, onInterrupt: v, onToggleMute: y, attachments: Le = [], onAttachFiles: b, onRemoveAttachment: Re, onRetryAttachment: ze, canAttachMore: Be = !0, preparingAttachments: Ve = 0, attachmentsLocked: x = !1, attachmentNotice: S = null, spokenChunks: He = null, onEnd: C, capturing: Ue = !0, interrupting: We = !1, awaitingEndpoint: Ge = !1, holding: w = !1, correcting: Ke = !1, onLetMeFinish: qe, onImDone: Je, proposalChip: T = null, proposalTray: E = null, renderAfterTurn: Ye, onViewChange: Xe, view: D, pageSlot: Ze = null, startedCue: O }) => {
26
+ let k = ve(), { muted: A, error: j } = m, M = l(null), N = l(null), [Qe, P] = u("mini"), F = D !== void 0, I = D === "compact", L = D === "page", [R, $e] = u(D);
27
+ R !== D && ($e(D), D === void 0 && R !== void 0 && P(R === "compact" ? "panel" : R === "page" ? "mini" : R));
28
+ let et = D === void 0 ? Qe : D === "compact" ? "panel" : D === "page" ? "mini" : D, z = ne().open, [tt, nt] = u(z);
29
+ tt !== z && (nt(z), z && Qe !== "mini" && P("mini"));
30
+ let B = re(et, m.phase === "ended"), rt = i();
28
31
  c(() => {
29
- Je?.(R);
30
- }, [Je, R]);
31
- let tt = a(), z = R === "full", B = R === "mini", V = R === "mini" ? "panel" : R === "panel" ? "full" : "mini", [H, U] = u(!1), nt = ye(() => ({ run: () => H ? { status: "already" } : (U(!0), { status: "done" }) }), [H]);
32
- e("assistant.transcript", nt);
33
- let W = T !== null && !B, G = l(!1), K = l(v);
34
- K.current = v;
35
- let q = ve(() => {
36
- m.phase !== "listening" && m.phase !== "thinking" || k || G.current || _e(m) || (G.current = !0, K.current());
37
- }, [k, m]), J = ve(() => {
38
- G.current && (G.current = !1, K.current());
39
- }, []), rt = q;
32
+ Xe?.(B);
33
+ }, [Xe, B]);
34
+ let it = a(), V = B === "full", H = B === "mini", U = B === "mini" ? "panel" : B === "panel" ? "full" : "mini", [W, G] = u(!1), at = xe(() => ({ run: () => W ? { status: "already" } : (G(!0), { status: "done" }) }), [W]);
35
+ e("assistant.transcript", at);
36
+ let K = E !== null && !H, q = l(!1), ot = l(y);
37
+ ot.current = y;
38
+ let st = be(() => {
39
+ m.phase !== "listening" && m.phase !== "thinking" || A || q.current || ye(m) || (q.current = !0, ot.current());
40
+ }, [A, m]), ct = be(() => {
41
+ q.current && (q.current = !1, ot.current());
42
+ }, []), lt = st;
40
43
  c(() => {
41
44
  let e = () => {
42
- document.visibilityState === "hidden" ? q() : J();
45
+ document.visibilityState === "hidden" ? st() : ct();
43
46
  };
44
47
  return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
45
- }, [q, J]), c(() => {
46
- let e = J;
48
+ }, [st, ct]), c(() => {
49
+ let e = ct;
47
50
  return window.addEventListener("focus", e), () => {
48
- window.removeEventListener("focus", e), G.current = !1;
51
+ window.removeEventListener("focus", e), q.current = !1;
49
52
  };
50
53
  }, []), c(() => {
51
- document.activeElement?.closest("[data-hands-free-notice]") || j.current?.focus();
52
- }, []), ue(M, { fallbackSelector: `[${se}]` });
53
- let it = l(P);
54
+ document.activeElement?.closest("[data-hands-free-notice]") || M.current?.focus();
55
+ }, []), fe(N, { fallbackSelector: `[${le}]` });
56
+ let ut = l(F);
54
57
  c(() => {
55
- let e = it.current;
56
- it.current = P, e && !P && le(document) && (M.current?.querySelector("[data-testid=\"assistant-voice-transcript-close\"]") ?? j.current)?.focus({ preventScroll: !0 });
57
- }, [P]), c(() => {
58
+ let e = ut.current;
59
+ ut.current = F, e && !F && de(document) && (N.current?.querySelector("[data-testid=\"assistant-voice-transcript-close\"]") ?? M.current)?.focus({ preventScroll: !0 });
60
+ }, [F]), c(() => {
58
61
  let e = (e) => {
59
62
  if (e.key === "Escape") {
60
- let t = oe({
63
+ let t = ce({
61
64
  defaultPrevented: e.defaultPrevented,
62
- layerAbove: o({
65
+ layerAbove: se({
63
66
  target: e.target,
64
- session: M.current,
67
+ session: N.current,
65
68
  doc: document
66
69
  }),
67
- transcriptOpen: H
70
+ transcriptOpen: W
68
71
  });
69
72
  if (t === "ignore") return;
70
- e.preventDefault(), t === "close-transcript" ? U(!1) : _ ? _.decline() : W ? T?.onClose() : S();
73
+ e.preventDefault(), t === "close-transcript" ? G(!1) : _ ? _.decline() : K ? E?.onClose() : C();
71
74
  return;
72
75
  }
73
- if (e.key !== "Tab" || !z) return;
74
- let t = (H ? M.current?.querySelector("[data-testid=\"assistant-voice-transcript\"]") : M.current)?.querySelectorAll("button:not([disabled])");
76
+ if (e.key !== "Tab" || !V) return;
77
+ let t = (W ? N.current?.querySelector("[data-testid=\"assistant-voice-transcript\"]") : N.current)?.querySelectorAll("button:not([disabled])");
75
78
  if (!t || t.length === 0) return;
76
79
  let n = t[0], r = t[t.length - 1];
77
80
  n && r && (e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus()));
78
81
  };
79
82
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
80
83
  }, [
81
- S,
82
- z,
83
- H,
84
+ C,
85
+ V,
84
86
  W,
85
- T,
87
+ K,
88
+ E,
86
89
  _
87
90
  ]);
88
- let Y = g !== null && A === null, X = et && g === null && A === null, at = _e(m), Z = Ge && Ke && m.phase === "listening" && !k && A === null ? {
89
- letMeFinish: Ge,
90
- imDone: Ke
91
- } : null, ot = Z !== null;
91
+ let J = g !== null && j === null, Y = rt && g === null && j === null, X = ye(m), Z = qe && Je && m.phase === "listening" && !A && j === null ? {
92
+ letMeFinish: qe,
93
+ imDone: Je
94
+ } : null, dt = Z !== null;
92
95
  c(() => {
93
- if (ot) return;
96
+ if (dt) return;
94
97
  let e = document.activeElement;
95
- e && e !== document.body || j.current?.focus();
96
- }, [ot]);
97
- let Q = fe({
98
+ e && e !== document.body || M.current?.focus();
99
+ }, [dt]);
100
+ let Q = me({
98
101
  snapshot: m,
99
- capturing: Ve,
100
- interrupting: He,
101
- awaitingEndpoint: Ue
102
- }), st = (() => {
102
+ capturing: Ue,
103
+ interrupting: We,
104
+ awaitingEndpoint: Ge
105
+ }), ft = (() => {
103
106
  switch (Q) {
104
- case "connecting": return O("voiceSession.connecting", "Starting the microphone…");
105
- case "endpoint-grace": return O("voiceSession.endpointGrace", "Still listening — take your time");
106
- case "interrupting": return O("voiceSession.interrupting", "Stopped — go ahead");
107
- case "thinking": return O(pe.key, pe.fallback);
108
- case "speaking": return O("voiceSession.speaking", "Speaking — tap to stop");
107
+ case "connecting": return k("voiceSession.connecting", "Starting the microphone…");
108
+ case "endpoint-grace": return k("voiceSession.endpointGrace", "Still listening — take your time");
109
+ case "interrupting": return k("voiceSession.interrupting", "Stopped — go ahead");
110
+ case "thinking": return k(he.key, he.fallback);
111
+ case "speaking": return k("voiceSession.speaking", "Speaking — tap to stop");
109
112
  case "mic-error":
110
113
  case "ended": return "";
111
- case "listening": return k ? O("voiceSession.muted", "Microphone off") : O("voiceSession.listening", "Listening…");
114
+ case "listening": return A ? k("voiceSession.muted", "Microphone off") : k("voiceSession.listening", "Listening…");
112
115
  default: return Q;
113
116
  }
114
- })(), ct = !k && (Q === "listening" || Q === "endpoint-grace"), lt = ct && C ? O("voiceSession.holding", "Take your time — tap “I’m done” when you finish") : ct && We ? O("voiceSession.correcting", "Stopped that answer — listening to your correction") : st, $ = he({
115
- tr: O,
117
+ })(), pt = !A && (Q === "listening" || Q === "endpoint-grace"), mt = pt && w ? k("voiceSession.holding", "Take your time — tap “I’m done” when you finish") : pt && Ke ? k("voiceSession.correcting", "Stopped that answer — listening to your correction") : ft, $ = _e({
118
+ tr: k,
116
119
  stage: Q,
117
- muted: k,
118
- label: lt
119
- }), ut = me(lt, $), dt = Q === "thinking";
120
+ muted: A,
121
+ label: mt
122
+ }), ht = ge(mt, $), gt = Q === "thinking", _t = !A && (Q === "listening" || Q === "endpoint-grace"), vt = o({
123
+ active: L && (_t || Q === "speaking"),
124
+ mic: L && _t,
125
+ pulseKey: X,
126
+ speaking: Q === "speaking"
127
+ });
128
+ if (L) {
129
+ let e = s(Q), t = e ? v : y;
130
+ return Ze ? Ae(/* @__PURE__ */ f(ae, {
131
+ rootRef: N,
132
+ endRef: M,
133
+ stage: Q,
134
+ muted: A,
135
+ status: ht,
136
+ statusSuffix: $,
137
+ rotateStatus: gt,
138
+ heard: _t ? X : "",
139
+ level: vt,
140
+ notice: J ? h(g, k) : null,
141
+ announcedNotice: J && je(g) ? h(g, k) : null,
142
+ attachmentNotice: S,
143
+ startedCue: O,
144
+ errorText: j === null ? null : Ne(j, k),
145
+ attachments: Le,
146
+ preparingAttachments: Ve,
147
+ attachmentsLocked: x,
148
+ canAttachMore: Be,
149
+ onAttachFiles: b,
150
+ onPickerOpen: lt,
151
+ onRemoveAttachment: Re,
152
+ onRetryAttachment: ze,
153
+ hold: Z ? {
154
+ holding: w,
155
+ onPress: w ? Z.imDone : Z.letMeFinish
156
+ } : null,
157
+ primary: {
158
+ interrupt: e,
159
+ onPress: t,
160
+ disabled: m.phase === "idle" || m.phase === "ended" || j !== null || Q === "connecting" || !t
161
+ },
162
+ onEnd: C,
163
+ privacyNotice: _
164
+ }), Ze) : null;
165
+ }
120
166
  return /* @__PURE__ */ p("div", {
121
- ref: M,
122
- className: `flex flex-col ${F ? "items-stretch" : "items-center"} justify-between ${F ? "bg-bg-elevated" : "bg-bg-sunken"} ${F ? "absolute inset-0 z-20 px-3 pb-3 pt-2" : R === "full" ? "fixed inset-x-0 bottom-0 top-14 z-[60] px-6 py-8" : R === "panel" ? "absolute inset-0 z-20 px-4 py-6" : "absolute inset-x-0 bottom-0 z-20 min-h-[11.25rem] border-t border-border-subtle px-3 py-3 shadow-lg"}`,
167
+ ref: N,
168
+ className: `flex flex-col ${I ? "items-stretch" : "items-center"} justify-between ${I ? "bg-bg-elevated" : "bg-bg-sunken"} ${I ? "absolute inset-0 z-20 px-3 pb-3 pt-2" : B === "full" ? "fixed inset-x-0 bottom-0 top-14 z-[60] px-6 py-8" : B === "panel" ? "absolute inset-0 z-20 px-4 py-6" : "absolute inset-x-0 bottom-0 z-20 min-h-[11.25rem] border-t border-border-subtle px-3 py-3 shadow-lg"}`,
123
169
  role: "dialog",
124
- "aria-modal": z || void 0,
125
- "aria-label": O("voiceSession.title", "Voice conversation"),
170
+ "aria-modal": V || void 0,
171
+ "aria-label": k("voiceSession.title", "Voice conversation"),
126
172
  "data-testid": "assistant-voice-session",
127
- [ce]: "",
173
+ [ue]: "",
128
174
  children: [
129
- F ? null : /* @__PURE__ */ p("button", {
130
- ref: j,
175
+ I ? null : /* @__PURE__ */ p("button", {
176
+ ref: M,
131
177
  type: "button",
132
- onClick: S,
133
- className: `absolute ${z ? "end-6 top-6 h-14 gap-2 px-5 text-base" : B ? "end-12 top-2 h-8 gap-1.5 px-2.5 text-xs" : "end-3 top-3 h-11 gap-2 px-4 text-sm"} flex items-center justify-center rounded-full border border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
134
- title: O("voiceSession.end", "End the voice conversation"),
178
+ onClick: C,
179
+ className: `absolute ${V ? "end-6 top-6 h-14 gap-2 px-5 text-base" : H ? "end-12 top-2 h-8 gap-1.5 px-2.5 text-xs" : "end-3 top-3 h-11 gap-2 px-4 text-sm"} flex items-center justify-center rounded-full border border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
180
+ title: k("voiceSession.end", "End the voice conversation"),
135
181
  "data-testid": "assistant-voice-end",
136
182
  children: [/* @__PURE__ */ f(d, {
137
- className: z ? "size-6" : B ? "size-4" : "size-5",
183
+ className: V ? "size-6" : H ? "size-4" : "size-5",
138
184
  "aria-hidden": "true"
139
185
  }), /* @__PURE__ */ f("span", {
140
- className: `truncate whitespace-nowrap font-medium ${B ? "max-w-[3.5rem] text-xs" : "max-w-[7rem]"}`,
141
- children: O("voiceSession.endShort", "End")
186
+ className: `truncate whitespace-nowrap font-medium ${H ? "max-w-[3.5rem] text-xs" : "max-w-[7rem]"}`,
187
+ children: k("voiceSession.endShort", "End")
142
188
  })]
143
189
  }),
144
190
  /* @__PURE__ */ p("div", {
145
- className: `flex flex-col items-center ${F ? "min-h-[1.5rem]" : B ? `px-3 ${Y || X || x ? "pt-9 pb-2" : ""}` : `min-h-[1.5rem] ${Y || X || x ? z ? "pt-14" : "pt-10" : ""}`}`,
191
+ className: `flex flex-col items-center ${I ? "min-h-[1.5rem]" : H ? `px-3 ${J || Y || S ? "pt-9 pb-2" : ""}` : `min-h-[1.5rem] ${J || Y || S ? V ? "pt-14" : "pt-10" : ""}`}`,
146
192
  children: [
147
- Y ? /* @__PURE__ */ f("p", {
193
+ J ? /* @__PURE__ */ f("p", {
148
194
  className: "max-w-xs text-center text-xs text-status-warning",
149
195
  "data-testid": "assistant-voice-notice",
150
- children: h(g, O)
196
+ children: h(g, k)
151
197
  }) : null,
152
- X ? /* @__PURE__ */ f("p", {
198
+ Y ? /* @__PURE__ */ f("p", {
153
199
  className: "max-w-xs text-center text-xs text-text-secondary",
154
200
  "data-testid": "assistant-voice-avatar-hands-free",
155
- children: tt.handsFreeOff
201
+ children: it.handsFreeOff
156
202
  }) : null,
157
203
  /* @__PURE__ */ f("span", {
158
204
  className: "sr-only start-0 top-0",
@@ -160,225 +206,225 @@ var m = ({ session: m, turns: ke = [], onSaveTranscript: je, onContinueInChat: M
160
206
  "aria-live": "polite",
161
207
  "aria-atomic": "true",
162
208
  "data-testid": "assistant-voice-notice-announced",
163
- children: Y && Oe(g) ? h(g, O) : X ? tt.handsFreeOff : null
209
+ children: J && je(g) ? h(g, k) : Y ? it.handsFreeOff : null
164
210
  }),
165
- x ? /* @__PURE__ */ f("p", {
211
+ S ? /* @__PURE__ */ f("p", {
166
212
  className: "max-w-xs text-center text-xs text-status-warning",
167
213
  role: "status",
168
214
  "aria-live": "polite",
169
215
  "data-testid": "assistant-voice-attachment-notice",
170
- children: x
216
+ children: S
171
217
  }) : null,
172
- D === void 0 ? null : /* @__PURE__ */ p(De, { children: [D ? /* @__PURE__ */ f("p", {
218
+ O === void 0 ? null : /* @__PURE__ */ p(ke, { children: [O ? /* @__PURE__ */ f("p", {
173
219
  className: "max-w-xs text-center text-xs text-text-secondary",
174
220
  "data-testid": "assistant-voice-started-cue",
175
- children: D
221
+ children: O
176
222
  }) : null, /* @__PURE__ */ f("span", {
177
223
  className: "sr-only start-0 top-0",
178
224
  role: "status",
179
225
  "aria-live": "polite",
180
226
  "aria-atomic": "true",
181
227
  "data-testid": "assistant-voice-started-cue-announced",
182
- children: D
228
+ children: O
183
229
  })] })
184
230
  ]
185
231
  }),
186
232
  (() => {
187
233
  let e = /* @__PURE__ */ f(r, {
188
234
  session: m,
189
- compact: B,
235
+ compact: H,
190
236
  connecting: Q === "connecting",
191
- onPress: s(Q) ? Pe : v,
192
- label: s(Q) ? O("voiceSession.interrupt", "Stop the assistant and speak") : k ? O("voiceSession.unmute", "Turn the microphone on") : O("voiceSession.mute", "Turn the microphone off")
237
+ onPress: s(Q) ? v : y,
238
+ label: s(Q) ? k("voiceSession.interrupt", "Stop the assistant and speak") : A ? k("voiceSession.unmute", "Turn the microphone on") : k("voiceSession.mute", "Turn the microphone off")
193
239
  }), t = Z ? /* @__PURE__ */ f("button", {
194
240
  type: "button",
195
- onClick: C ? Z.imDone : Z.letMeFinish,
196
- className: `flex items-center justify-center rounded-full border font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${B ? "h-7 px-3 text-xs" : z ? "h-11 px-6 text-base" : "h-9 px-4 text-sm"} ${C ? "border-transparent bg-action-primary-bg text-action-primary-text hover:opacity-90" : "border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken"}`,
197
- title: C ? O("voiceSession.imDoneHint", "Send what you said now") : O("voiceSession.letMeFinishHint", "Pause sending until you tap “I’m done”"),
241
+ onClick: w ? Z.imDone : Z.letMeFinish,
242
+ className: `flex items-center justify-center rounded-full border font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${H ? "h-7 px-3 text-xs" : V ? "h-11 px-6 text-base" : "h-9 px-4 text-sm"} ${w ? "border-transparent bg-action-primary-bg text-action-primary-text hover:opacity-90" : "border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken"}`,
243
+ title: w ? k("voiceSession.imDoneHint", "Send what you said now") : k("voiceSession.letMeFinishHint", "Pause sending until you tap “I’m done”"),
198
244
  "data-testid": "assistant-voice-hold",
199
- "data-holding": C ? "true" : "false",
200
- children: C ? O("voiceSession.imDone", "I’m done") : O("voiceSession.letMeFinish", "Let me finish")
201
- }) : null, n = s(Q), i = n ? Pe : v, ne = m.phase === "idle" || m.phase === "ended" || A !== null || Q === "connecting" || !i, re = F ? /* @__PURE__ */ p("button", {
245
+ "data-holding": w ? "true" : "false",
246
+ children: w ? k("voiceSession.imDone", "I’m done") : k("voiceSession.letMeFinish", "Let me finish")
247
+ }) : null, n = s(Q), i = n ? v : y, ne = m.phase === "idle" || m.phase === "ended" || j !== null || Q === "connecting" || !i, re = I ? /* @__PURE__ */ p("button", {
202
248
  type: "button",
203
249
  onClick: i,
204
250
  disabled: ne,
205
251
  className: "flex h-11 items-center justify-center gap-2 rounded-full border border-border-default bg-bg-elevated px-6 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:cursor-default disabled:text-text-muted disabled:hover:bg-bg-elevated",
206
252
  "data-testid": "assistant-voice-primary",
207
253
  "data-state": Q,
208
- "data-muted": k || void 0,
209
- children: [n ? /* @__PURE__ */ f(Ee, {
254
+ "data-muted": A || void 0,
255
+ children: [n ? /* @__PURE__ */ f(Oe, {
210
256
  className: "size-4 fill-current",
211
257
  "aria-hidden": "true"
212
- }) : f(k ? Se : xe, {
258
+ }) : f(A ? we : Ce, {
213
259
  className: "size-4",
214
260
  "aria-hidden": "true"
215
- }), n ? O("window.stopSpeaking", "Stop speaking") : k ? O("window.unmute", "Unmute") : O("window.mute", "Mute")]
261
+ }), n ? k("window.stopSpeaking", "Stop speaking") : A ? k("window.unmute", "Unmute") : k("window.mute", "Mute")]
216
262
  }) : null, a = t ? /* @__PURE__ */ p("div", {
217
263
  className: "flex flex-col items-center gap-2",
218
264
  children: [e, t]
219
- }) : e, ie = F ? /* @__PURE__ */ p("div", {
265
+ }) : e, ie = I ? /* @__PURE__ */ p("div", {
220
266
  className: "flex flex-col items-center gap-2",
221
267
  children: [t, re]
222
- }) : void 0, ae = de(Q) ? Ne : at || null, o = A === null ? null : Ae(A, O);
223
- return B ? /* @__PURE__ */ f(te, {
224
- spokenChunks: Be,
268
+ }) : void 0, ae = pe(Q) ? Ie : X || null, o = j === null ? null : Ne(j, k);
269
+ return H ? /* @__PURE__ */ f(te, {
270
+ spokenChunks: He,
225
271
  state: Q,
226
272
  caption: ae,
227
- statusText: ut,
273
+ statusText: ht,
228
274
  statusSuffix: $,
229
- rotateStatus: dt,
275
+ rotateStatus: gt,
230
276
  errorText: o,
231
277
  control: a
232
278
  }) : /* @__PURE__ */ f(ee, {
233
279
  state: Q,
234
- userCaption: at || null,
235
- spokenChunks: Be,
236
- assistantCaption: Ne,
237
- expanded: z,
238
- statusText: ut,
280
+ userCaption: X || null,
281
+ spokenChunks: He,
282
+ assistantCaption: Ie,
283
+ expanded: V,
284
+ statusText: ht,
239
285
  statusSuffix: $,
240
- rotateStatus: dt,
286
+ rotateStatus: gt,
241
287
  errorText: o,
242
288
  control: a,
243
- compact: F || void 0,
289
+ compact: I || void 0,
244
290
  compactControl: ie
245
291
  });
246
292
  })(),
247
- w && !W && !F ? /* @__PURE__ */ f("div", {
248
- className: B ? "absolute start-20 end-36 top-2 flex justify-center" : `flex w-full justify-center ${z ? "max-w-[calc(100%-12rem)]" : "max-w-[calc(100%-8rem)]"}`,
293
+ T && !K && !I ? /* @__PURE__ */ f("div", {
294
+ className: H ? "absolute start-20 end-36 top-2 flex justify-center" : `flex w-full justify-center ${V ? "max-w-[calc(100%-12rem)]" : "max-w-[calc(100%-8rem)]"}`,
249
295
  children: /* @__PURE__ */ f("button", {
250
296
  type: "button",
251
297
  onClick: () => {
252
- N("panel"), w.onOpen();
298
+ P("panel"), T.onOpen();
253
299
  },
254
- className: `max-w-full truncate rounded-full border border-border-default bg-bg-elevated font-medium text-text-primary transition-colors hover:bg-bg-raised focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${B ? "h-8 px-3 text-xs" : "h-10 px-4 text-sm"}`,
300
+ className: `max-w-full truncate rounded-full border border-border-default bg-bg-elevated font-medium text-text-primary transition-colors hover:bg-bg-raised focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${H ? "h-8 px-3 text-xs" : "h-10 px-4 text-sm"}`,
255
301
  "data-testid": "assistant-voice-proposal-chip",
256
- children: w.label
302
+ children: T.label
257
303
  })
258
304
  }) : null,
259
- w && F ? /* @__PURE__ */ p("div", {
305
+ T && I ? /* @__PURE__ */ p("div", {
260
306
  className: "flex min-h-11 w-full items-center gap-2 rounded-xl border border-status-warning bg-status-warning/10 px-3 py-1",
261
307
  "data-testid": "assistant-voice-proposal-chip-row",
262
308
  children: [
263
- /* @__PURE__ */ f(Te, {
309
+ /* @__PURE__ */ f(De, {
264
310
  className: "size-4 shrink-0 text-status-warning",
265
311
  "aria-hidden": "true"
266
312
  }),
267
- w.status ? /* @__PURE__ */ f("p", {
313
+ T.status ? /* @__PURE__ */ f("p", {
268
314
  role: "status",
269
315
  "aria-live": "polite",
270
316
  className: "min-w-0 flex-1 text-sm text-text-primary",
271
317
  "data-testid": "assistant-voice-proposal-status",
272
- children: w.status
318
+ children: T.status
273
319
  }) : /* @__PURE__ */ f("span", { className: "flex-1" }),
274
320
  /* @__PURE__ */ f("button", {
275
321
  type: "button",
276
- onClick: w.onOpen,
322
+ onClick: T.onOpen,
277
323
  className: "min-h-9 shrink-0 rounded-button px-3 text-sm font-medium text-action-primary-bg transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
278
324
  "data-testid": "assistant-voice-proposal-chip",
279
- children: w.label
325
+ children: T.label
280
326
  })
281
327
  ]
282
328
  }) : null,
283
- T && W ? /* @__PURE__ */ p("div", {
284
- className: `absolute z-10 flex flex-col gap-2 overflow-y-auto rounded-lg border border-border-subtle bg-bg-elevated shadow-lg ${z ? "inset-x-6 bottom-24 top-24 mx-auto max-w-xl p-4" : "inset-x-3 bottom-16 top-16 p-3"}`,
329
+ E && K ? /* @__PURE__ */ p("div", {
330
+ className: `absolute z-10 flex flex-col gap-2 overflow-y-auto rounded-lg border border-border-subtle bg-bg-elevated shadow-lg ${V ? "inset-x-6 bottom-24 top-24 mx-auto max-w-xl p-4" : "inset-x-3 bottom-16 top-16 p-3"}`,
285
331
  "data-testid": "assistant-voice-proposal-tray",
286
332
  children: [/* @__PURE__ */ f("div", {
287
333
  className: "flex justify-end",
288
334
  children: /* @__PURE__ */ f("button", {
289
335
  type: "button",
290
- onClick: T.onClose,
336
+ onClick: E.onClose,
291
337
  className: "flex size-8 items-center justify-center rounded-full text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
292
- "aria-label": T.closeLabel,
338
+ "aria-label": E.closeLabel,
293
339
  "data-testid": "assistant-voice-proposal-tray-close",
294
340
  children: /* @__PURE__ */ f(d, {
295
341
  className: "size-4",
296
342
  "aria-hidden": "true"
297
343
  })
298
344
  })
299
- }), T.content]
345
+ }), E.content]
300
346
  }) : null,
301
- _ ? /* @__PURE__ */ f(ae, {
302
- view: R,
347
+ _ ? /* @__PURE__ */ f(oe, {
348
+ view: B,
303
349
  onContinue: _.accept,
304
350
  onNotNow: _.decline
305
351
  }) : null,
306
- H ? /* @__PURE__ */ f(ie, {
307
- turns: ke,
308
- onClose: () => U(!1),
309
- onSave: je,
310
- onContinueInChat: Me,
311
- renderAfterTurn: qe
352
+ W ? /* @__PURE__ */ f(ie, {
353
+ turns: Me,
354
+ onClose: () => G(!1),
355
+ onSave: Pe,
356
+ onContinueInChat: Fe,
357
+ renderAfterTurn: Ye
312
358
  }) : null,
313
- y && !F ? /* @__PURE__ */ f("div", {
314
- className: `absolute ${z ? "start-6 top-6" : B ? "start-11 top-2" : "start-3 top-3"}`,
359
+ b && !I ? /* @__PURE__ */ f("div", {
360
+ className: `absolute ${V ? "start-6 top-6" : H ? "start-11 top-2" : "start-3 top-3"}`,
315
361
  children: /* @__PURE__ */ f(t, {
316
362
  onFiles: (e) => {
317
- y(e), P || N((e) => e === "mini" ? "panel" : e);
363
+ b(e), F || P((e) => e === "mini" ? "panel" : e);
318
364
  },
319
- onPickerOpen: rt,
365
+ onPickerOpen: lt,
320
366
  direction: "down",
321
- canAddMore: Re,
322
- disabled: b
367
+ canAddMore: Be,
368
+ disabled: x
323
369
  })
324
370
  }) : null,
325
- (Fe.length > 0 || ze > 0) && !B ? /* @__PURE__ */ f("div", {
326
- className: F ? "w-full" : `absolute ${z ? "bottom-24 start-24 end-24" : "bottom-16 start-16 end-16"}`,
371
+ (Le.length > 0 || Ve > 0) && !H ? /* @__PURE__ */ f("div", {
372
+ className: I ? "w-full" : `absolute ${V ? "bottom-24 start-24 end-24" : "bottom-16 start-16 end-16"}`,
327
373
  "data-testid": "assistant-voice-attachments",
328
374
  children: /* @__PURE__ */ f(n, {
329
- attachments: Fe,
330
- onRemove: Ie ?? (() => void 0),
331
- onRetry: Le ?? (() => void 0),
332
- preparingCount: ze,
333
- disabled: b
375
+ attachments: Le,
376
+ onRemove: Re ?? (() => void 0),
377
+ onRetry: ze ?? (() => void 0),
378
+ preparingCount: Ve,
379
+ disabled: x
334
380
  })
335
381
  }) : null,
336
- F ? null : /* @__PURE__ */ f("button", {
382
+ I ? null : /* @__PURE__ */ f("button", {
337
383
  type: "button",
338
- onClick: () => U((e) => !e),
339
- className: `absolute ${z ? "bottom-6 end-6 size-14" : B ? "end-2 top-2 size-8" : "bottom-3 end-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
340
- "aria-pressed": H,
341
- "aria-label": O("voiceSession.transcriptTitle", "Voice transcript"),
384
+ onClick: () => G((e) => !e),
385
+ className: `absolute ${V ? "bottom-6 end-6 size-14" : H ? "end-2 top-2 size-8" : "bottom-3 end-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
386
+ "aria-pressed": W,
387
+ "aria-label": k("voiceSession.transcriptTitle", "Voice transcript"),
342
388
  "data-testid": "assistant-voice-transcript-toggle",
343
- children: /* @__PURE__ */ f(we, { className: z ? "size-6" : B ? "size-4" : "size-5" })
389
+ children: /* @__PURE__ */ f(Ee, { className: V ? "size-6" : H ? "size-4" : "size-5" })
344
390
  }),
345
- P ? null : /* @__PURE__ */ f("button", {
391
+ F ? null : /* @__PURE__ */ f("button", {
346
392
  type: "button",
347
- onClick: () => N(V),
348
- className: `absolute ${z ? "bottom-6 start-6 size-14" : B ? "start-2 top-2 size-8" : "bottom-3 start-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
349
- "aria-label": V === "panel" ? O("voiceSession.expandPanel", "Show the conversation in the panel") : V === "full" ? O("voiceSession.expand", "Expand the conversation to full screen") : O("voiceSession.collapse", "Shrink to the compact controller"),
393
+ onClick: () => P(U),
394
+ className: `absolute ${V ? "bottom-6 start-6 size-14" : H ? "start-2 top-2 size-8" : "bottom-3 start-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
395
+ "aria-label": U === "panel" ? k("voiceSession.expandPanel", "Show the conversation in the panel") : U === "full" ? k("voiceSession.expand", "Expand the conversation to full screen") : k("voiceSession.collapse", "Shrink to the compact controller"),
350
396
  "data-testid": "assistant-voice-expand",
351
- children: z ? /* @__PURE__ */ f(Ce, { className: "size-5" }) : /* @__PURE__ */ f(be, { className: B ? "size-4" : "size-5" })
397
+ children: V ? /* @__PURE__ */ f(Te, { className: "size-5" }) : /* @__PURE__ */ f(Se, { className: H ? "size-4" : "size-5" })
352
398
  }),
353
- F ? /* @__PURE__ */ p("div", {
399
+ I ? /* @__PURE__ */ p("div", {
354
400
  className: "flex w-full items-center gap-2 pt-2",
355
401
  "data-testid": "assistant-voice-controls",
356
402
  children: [
357
- y ? /* @__PURE__ */ f(t, {
358
- onFiles: (e) => y(e),
359
- onPickerOpen: rt,
403
+ b ? /* @__PURE__ */ f(t, {
404
+ onFiles: (e) => b(e),
405
+ onPickerOpen: lt,
360
406
  direction: "up",
361
- canAddMore: Re,
362
- disabled: b
407
+ canAddMore: Be,
408
+ disabled: x
363
409
  }) : null,
364
410
  /* @__PURE__ */ p("button", {
365
411
  type: "button",
366
- onClick: () => U((e) => !e),
412
+ onClick: () => G((e) => !e),
367
413
  className: "flex h-10 min-w-0 flex-1 items-center justify-center gap-2 rounded-full border border-border-default bg-bg-elevated px-3 text-sm text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
368
- "aria-expanded": H,
414
+ "aria-expanded": W,
369
415
  "data-testid": "assistant-voice-transcript-toggle",
370
- children: [/* @__PURE__ */ f(we, {
416
+ children: [/* @__PURE__ */ f(Ee, {
371
417
  className: "size-4 shrink-0",
372
418
  "aria-hidden": "true"
373
419
  }), /* @__PURE__ */ f("span", {
374
420
  className: "truncate",
375
- children: H ? O("window.hideTranscript", "Hide transcript") : O("window.showTranscript", "Show transcript")
421
+ children: W ? k("window.hideTranscript", "Hide transcript") : k("window.showTranscript", "Show transcript")
376
422
  })]
377
423
  }),
378
424
  /* @__PURE__ */ p("button", {
379
- ref: j,
425
+ ref: M,
380
426
  type: "button",
381
- onClick: S,
427
+ onClick: C,
382
428
  className: "flex h-10 min-w-0 flex-1 items-center justify-center gap-2 rounded-full border border-status-error-border bg-status-error-bg-subtle px-3 text-sm font-medium text-status-error-text transition-colors hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
383
429
  "data-testid": "assistant-voice-end",
384
430
  children: [/* @__PURE__ */ f(d, {
@@ -386,7 +432,7 @@ var m = ({ session: m, turns: ke = [], onSaveTranscript: je, onContinueInChat: M
386
432
  "aria-hidden": "true"
387
433
  }), /* @__PURE__ */ f("span", {
388
434
  className: "truncate",
389
- children: O("window.endVoice", "End voice")
435
+ children: k("window.endVoice", "End voice")
390
436
  })]
391
437
  })
392
438
  ]
@@ -395,12 +441,12 @@ var m = ({ session: m, turns: ke = [], onSaveTranscript: je, onContinueInChat: M
395
441
  });
396
442
  };
397
443
  function h(e, t) {
398
- return typeof e == "string" ? ke(e, t) : e.text;
444
+ return typeof e == "string" ? Me(e, t) : e.text;
399
445
  }
400
- function Oe(e) {
446
+ function je(e) {
401
447
  return e !== null && (typeof e != "string" || e === "reply-not-heard");
402
448
  }
403
- function ke(e, t) {
449
+ function Me(e, t) {
404
450
  switch (e) {
405
451
  case "network": return t("voiceSession.noticeNetwork", "Speech recognition lost its connection. Check your network — it will retry.");
406
452
  case "not-capturing": return t("voiceSession.noticeNotCapturing", "The microphone did not start. Check that this site is allowed to use it, then try again.");
@@ -412,7 +458,7 @@ function ke(e, t) {
412
458
  default: return e;
413
459
  }
414
460
  }
415
- function Ae(e, t) {
461
+ function Ne(e, t) {
416
462
  switch (e) {
417
463
  case "mic-denied": return t("voiceSession.micDenied", "Microphone access is blocked. Allow it in your browser settings to talk.");
418
464
  case "no-speech-support": return t("voiceSession.noSpeechSupport", "This browser cannot listen. Try a different browser, or type instead.");