@burdenoff/fe-libs 2026.1013.7 → 2026.1013.9
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.
- package/dist/shared/assistant/avatar/useAvatarCopy.d.ts +51 -0
- package/dist/shared/assistant/avatar/useAvatarCopy.js +52 -0
- package/dist/shared/assistant/i18nManifest.d.ts +38 -0
- package/dist/shared/assistant/i18nManifest.js +38 -0
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/ui/AIAssistantPanel.js +16 -16
- package/dist/shared/assistant/ui/assistantLiveAvatarSeam.d.ts +117 -0
- package/dist/shared/assistant/ui/assistantLiveAvatarSeam.js +97 -9
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +135 -134
- package/dist/shared/assistant/ui/voice/VoiceMiniController.js +54 -49
- package/dist/shared/assistant/ui/voice/VoiceStage.js +39 -35
- package/dist/shared-assistant.js +188 -187
- package/package.json +1 -1
|
@@ -8,265 +8,266 @@ import { AssistantAttachmentButton as re } from "../composer/AssistantAttachment
|
|
|
8
8
|
import { AssistantAttachmentChips as ie } from "../composer/AssistantAttachmentChips.js";
|
|
9
9
|
import { ASSISTANT_PANEL_ATTR as ae, ASSISTANT_VOICE_SESSION_ATTR as oe } from "../panelOverlays.js";
|
|
10
10
|
import { AssistantVoiceOrb as se } from "./AssistantVoiceOrb.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
11
|
+
import { useLiveAvatarVoiceView as ce } from "../assistantLiveAvatarSeam.js";
|
|
12
|
+
import { VoiceMiniController as le } from "./VoiceMiniController.js";
|
|
13
|
+
import { VoiceStage as ue } from "./VoiceStage.js";
|
|
14
|
+
import { VoiceTranscriptDrawer as de } from "./VoiceTranscriptDrawer.js";
|
|
15
|
+
import { escapeBelongsToLayerAbove as fe, voiceSessionEscapeAction as pe } from "./voiceSessionEscape.js";
|
|
16
|
+
import { HandsFreePrivacyNotice as me } from "./HandsFreePrivacyNotice.js";
|
|
17
|
+
import { useCallback as s, useEffect as c, useMemo as he, useRef as l, useState as u } from "react";
|
|
18
|
+
import { Maximize2 as ge, Minimize2 as _e, ScrollText as ve, X as d } from "lucide-react";
|
|
18
19
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
19
20
|
//#region src/shared/assistant/ui/voice/AssistantVoiceSession.tsx
|
|
20
|
-
var m = ({ session: m, turns:
|
|
21
|
-
let
|
|
22
|
-
t("assistant.transcript",
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
let
|
|
26
|
-
m.phase !== "listening" && m.phase !== "thinking" ||
|
|
27
|
-
}, [
|
|
28
|
-
|
|
29
|
-
}, []),
|
|
21
|
+
var m = ({ session: m, turns: xe = [], onSaveTranscript: Se, onContinueInChat: Ce, notice: h = null, privacyNotice: g = null, spoken: _, onInterrupt: we, onToggleMute: v, attachments: y = [], onAttachFiles: b, onRemoveAttachment: Te, onRetryAttachment: Ee, canAttachMore: De = !0, preparingAttachments: x = 0, attachmentsLocked: S = !1, attachmentNotice: C = null, spokenChunks: w = null, onEnd: T, capturing: Oe = !0, interrupting: ke = !1, awaitingEndpoint: Ae = !1, holding: E = !1, correcting: je = !1, onLetMeFinish: D, onImDone: O, proposalChip: k = null, proposalTray: A = null, renderAfterTurn: Me }) => {
|
|
22
|
+
let j = n(), { muted: M, error: N } = m, P = l(null), F = l(null), [Ne, I] = u("mini"), L = ce(Ne, m.phase === "ended"), R = L === "full", z = L === "mini", B = L === "mini" ? "panel" : L === "panel" ? "full" : "mini", [V, H] = u(!1);
|
|
23
|
+
t("assistant.transcript", he(() => ({ run: () => V ? { status: "already" } : (H(!0), { status: "done" }) }), [V]));
|
|
24
|
+
let U = A !== null && !z, W = l(!1), G = l(v);
|
|
25
|
+
G.current = v;
|
|
26
|
+
let K = s(() => {
|
|
27
|
+
m.phase !== "listening" && m.phase !== "thinking" || M || W.current || o(m) || (W.current = !0, G.current());
|
|
28
|
+
}, [M, m]), q = s(() => {
|
|
29
|
+
W.current && (W.current = !1, G.current());
|
|
30
|
+
}, []), Pe = K;
|
|
30
31
|
c(() => {
|
|
31
32
|
let e = () => {
|
|
32
|
-
document.visibilityState === "hidden" ?
|
|
33
|
+
document.visibilityState === "hidden" ? K() : q();
|
|
33
34
|
};
|
|
34
35
|
return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
|
|
35
|
-
}, [
|
|
36
|
-
let e =
|
|
36
|
+
}, [K, q]), c(() => {
|
|
37
|
+
let e = q;
|
|
37
38
|
return window.addEventListener("focus", e), () => {
|
|
38
|
-
window.removeEventListener("focus", e),
|
|
39
|
+
window.removeEventListener("focus", e), W.current = !1;
|
|
39
40
|
};
|
|
40
41
|
}, []), c(() => {
|
|
41
|
-
document.activeElement?.closest("[data-hands-free-notice]") ||
|
|
42
|
-
}, []), e(
|
|
42
|
+
document.activeElement?.closest("[data-hands-free-notice]") || P.current?.focus();
|
|
43
|
+
}, []), e(F, { fallbackSelector: `[${ae}]` }), c(() => {
|
|
43
44
|
let e = (e) => {
|
|
44
45
|
if (e.key === "Escape") {
|
|
45
|
-
let t =
|
|
46
|
+
let t = pe({
|
|
46
47
|
defaultPrevented: e.defaultPrevented,
|
|
47
|
-
layerAbove:
|
|
48
|
+
layerAbove: fe({
|
|
48
49
|
target: e.target,
|
|
49
|
-
session:
|
|
50
|
+
session: F.current,
|
|
50
51
|
doc: document
|
|
51
52
|
}),
|
|
52
|
-
transcriptOpen:
|
|
53
|
+
transcriptOpen: V
|
|
53
54
|
});
|
|
54
55
|
if (t === "ignore") return;
|
|
55
|
-
e.preventDefault(), t === "close-transcript" ?
|
|
56
|
+
e.preventDefault(), t === "close-transcript" ? H(!1) : g ? g.decline() : U ? A?.onClose() : T();
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
|
-
if (e.key !== "Tab" || !
|
|
59
|
-
let t = (
|
|
59
|
+
if (e.key !== "Tab" || !R) return;
|
|
60
|
+
let t = (V ? F.current?.querySelector("[data-testid=\"assistant-voice-transcript\"]") : F.current)?.querySelectorAll("button:not([disabled])");
|
|
60
61
|
if (!t || t.length === 0) return;
|
|
61
62
|
let n = t[0], r = t[t.length - 1];
|
|
62
63
|
!n || !r || (e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus()));
|
|
63
64
|
};
|
|
64
65
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
65
66
|
}, [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
T,
|
|
68
|
+
R,
|
|
69
|
+
V,
|
|
70
|
+
U,
|
|
71
|
+
A,
|
|
72
|
+
g
|
|
72
73
|
]);
|
|
73
|
-
let
|
|
74
|
-
letMeFinish:
|
|
75
|
-
imDone:
|
|
76
|
-
} : null,
|
|
74
|
+
let J = h !== null && N === null, Y = o(m), X = D && O && m.phase === "listening" && !M && N === null ? {
|
|
75
|
+
letMeFinish: D,
|
|
76
|
+
imDone: O
|
|
77
|
+
} : null, Fe = X !== null;
|
|
77
78
|
c(() => {
|
|
78
|
-
if (
|
|
79
|
+
if (Fe) return;
|
|
79
80
|
let e = document.activeElement;
|
|
80
|
-
(!e || e === document.body) &&
|
|
81
|
-
}, [
|
|
81
|
+
(!e || e === document.body) && P.current?.focus();
|
|
82
|
+
}, [Fe]);
|
|
82
83
|
let Z = i({
|
|
83
84
|
snapshot: m,
|
|
84
85
|
capturing: Oe,
|
|
85
86
|
interrupting: ke,
|
|
86
87
|
awaitingEndpoint: Ae
|
|
87
|
-
}),
|
|
88
|
+
}), Ie = (() => {
|
|
88
89
|
switch (Z) {
|
|
89
|
-
case "connecting": return
|
|
90
|
-
case "endpoint-grace": return
|
|
91
|
-
case "interrupting": return
|
|
92
|
-
case "thinking": return
|
|
93
|
-
case "speaking": return
|
|
90
|
+
case "connecting": return j("voiceSession.connecting", "Starting the microphone…");
|
|
91
|
+
case "endpoint-grace": return j("voiceSession.endpointGrace", "Still listening — take your time");
|
|
92
|
+
case "interrupting": return j("voiceSession.interrupting", "Stopped — go ahead");
|
|
93
|
+
case "thinking": return j(a.key, a.fallback);
|
|
94
|
+
case "speaking": return j("voiceSession.speaking", "Speaking — tap to stop");
|
|
94
95
|
case "mic-error":
|
|
95
96
|
case "ended": return "";
|
|
96
|
-
case "listening": return
|
|
97
|
+
case "listening": return M ? j("voiceSession.muted", "Microphone off") : j("voiceSession.listening", "Listening…");
|
|
97
98
|
default: return Z;
|
|
98
99
|
}
|
|
99
|
-
})(),
|
|
100
|
-
tr:
|
|
100
|
+
})(), Le = !M && (Z === "listening" || Z === "endpoint-grace"), Re = Le && E ? j("voiceSession.holding", "Take your time — tap “I’m done” when you finish") : Le && je ? j("voiceSession.correcting", "Stopped that answer — listening to your correction") : Ie, Q = ne({
|
|
101
|
+
tr: j,
|
|
101
102
|
stage: Z,
|
|
102
|
-
muted:
|
|
103
|
-
label:
|
|
104
|
-
}),
|
|
103
|
+
muted: M,
|
|
104
|
+
label: Re
|
|
105
|
+
}), ze = te(Re, Q), $ = Z === "thinking";
|
|
105
106
|
return /* @__PURE__ */ p("div", {
|
|
106
|
-
ref:
|
|
107
|
-
className: `flex flex-col items-center justify-between bg-bg-sunken ${
|
|
107
|
+
ref: F,
|
|
108
|
+
className: `flex flex-col items-center justify-between bg-bg-sunken ${L === "full" ? "fixed inset-x-0 bottom-0 top-14 z-[60] px-6 py-8" : L === "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"}`,
|
|
108
109
|
role: "dialog",
|
|
109
|
-
"aria-modal":
|
|
110
|
-
"aria-label":
|
|
110
|
+
"aria-modal": R || void 0,
|
|
111
|
+
"aria-label": j("voiceSession.title", "Voice conversation"),
|
|
111
112
|
"data-testid": "assistant-voice-session",
|
|
112
113
|
[oe]: "",
|
|
113
114
|
children: [
|
|
114
115
|
/* @__PURE__ */ p("button", {
|
|
115
|
-
ref:
|
|
116
|
+
ref: P,
|
|
116
117
|
type: "button",
|
|
117
|
-
onClick:
|
|
118
|
-
className: `absolute ${
|
|
119
|
-
title:
|
|
118
|
+
onClick: T,
|
|
119
|
+
className: `absolute ${R ? "right-6 top-6 h-14 gap-2 px-5 text-base" : z ? "right-12 top-2 h-8 gap-1.5 px-2.5 text-xs" : "right-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`,
|
|
120
|
+
title: j("voiceSession.end", "End the voice conversation"),
|
|
120
121
|
"data-testid": "assistant-voice-end",
|
|
121
122
|
children: [/* @__PURE__ */ f(d, {
|
|
122
|
-
className:
|
|
123
|
+
className: R ? "size-6" : z ? "size-4" : "size-5",
|
|
123
124
|
"aria-hidden": "true"
|
|
124
125
|
}), /* @__PURE__ */ f("span", {
|
|
125
|
-
className: `truncate whitespace-nowrap font-medium ${
|
|
126
|
-
children:
|
|
126
|
+
className: `truncate whitespace-nowrap font-medium ${z ? "max-w-[3.5rem] text-xs" : "max-w-[7rem]"}`,
|
|
127
|
+
children: j("voiceSession.endShort", "End")
|
|
127
128
|
})]
|
|
128
129
|
}),
|
|
129
130
|
/* @__PURE__ */ p("div", {
|
|
130
|
-
className: `flex flex-col items-center ${
|
|
131
|
-
children: [
|
|
131
|
+
className: `flex flex-col items-center ${z ? `px-3 ${J || C ? "pt-9 pb-2" : ""}` : `min-h-[1.5rem] ${J || C ? R ? "pt-14" : "pt-10" : ""}`}`,
|
|
132
|
+
children: [J ? /* @__PURE__ */ f("p", {
|
|
132
133
|
className: "max-w-xs text-center text-xs text-status-warning",
|
|
133
134
|
"data-testid": "assistant-voice-notice",
|
|
134
|
-
children:
|
|
135
|
-
}) : null,
|
|
135
|
+
children: ye(h, j)
|
|
136
|
+
}) : null, C ? /* @__PURE__ */ f("p", {
|
|
136
137
|
className: "max-w-xs text-center text-xs text-status-warning",
|
|
137
138
|
role: "status",
|
|
138
139
|
"aria-live": "polite",
|
|
139
140
|
"data-testid": "assistant-voice-attachment-notice",
|
|
140
|
-
children:
|
|
141
|
+
children: C
|
|
141
142
|
}) : null]
|
|
142
143
|
}),
|
|
143
144
|
(() => {
|
|
144
145
|
let e = /* @__PURE__ */ f(se, {
|
|
145
146
|
session: m,
|
|
146
|
-
compact:
|
|
147
|
+
compact: z,
|
|
147
148
|
connecting: Z === "connecting",
|
|
148
|
-
onPress: r(Z) ? we :
|
|
149
|
-
label: r(Z) ?
|
|
150
|
-
}), t =
|
|
149
|
+
onPress: r(Z) ? we : v,
|
|
150
|
+
label: r(Z) ? j("voiceSession.interrupt", "Stop the assistant and speak") : M ? j("voiceSession.unmute", "Turn the microphone on") : j("voiceSession.mute", "Turn the microphone off")
|
|
151
|
+
}), t = X ? /* @__PURE__ */ f("button", {
|
|
151
152
|
type: "button",
|
|
152
|
-
onClick:
|
|
153
|
-
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 ${
|
|
154
|
-
title:
|
|
153
|
+
onClick: E ? X.imDone : X.letMeFinish,
|
|
154
|
+
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 ${z ? "h-7 px-3 text-xs" : R ? "h-11 px-6 text-base" : "h-9 px-4 text-sm"} ${E ? "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"}`,
|
|
155
|
+
title: E ? j("voiceSession.imDoneHint", "Send what you said now") : j("voiceSession.letMeFinishHint", "Pause sending until you tap “I’m done”"),
|
|
155
156
|
"data-testid": "assistant-voice-hold",
|
|
156
|
-
"data-holding":
|
|
157
|
-
children:
|
|
157
|
+
"data-holding": E ? "true" : "false",
|
|
158
|
+
children: E ? j("voiceSession.imDone", "I’m done") : j("voiceSession.letMeFinish", "Let me finish")
|
|
158
159
|
}) : null, n = t ? /* @__PURE__ */ p("div", {
|
|
159
160
|
className: "flex flex-col items-center gap-2",
|
|
160
161
|
children: [e, t]
|
|
161
|
-
}) : e, i = ee(Z) ?
|
|
162
|
-
return
|
|
163
|
-
spokenChunks:
|
|
162
|
+
}) : e, i = ee(Z) ? _ : Y || null, a = N === null ? null : be(N, j);
|
|
163
|
+
return z ? /* @__PURE__ */ f(le, {
|
|
164
|
+
spokenChunks: w,
|
|
164
165
|
state: Z,
|
|
165
166
|
caption: i,
|
|
166
|
-
statusText:
|
|
167
|
-
statusSuffix:
|
|
168
|
-
rotateStatus:
|
|
167
|
+
statusText: ze,
|
|
168
|
+
statusSuffix: Q,
|
|
169
|
+
rotateStatus: $,
|
|
169
170
|
errorText: a,
|
|
170
171
|
control: n
|
|
171
|
-
}) : /* @__PURE__ */ f(
|
|
172
|
+
}) : /* @__PURE__ */ f(ue, {
|
|
172
173
|
state: Z,
|
|
173
|
-
userCaption:
|
|
174
|
-
spokenChunks:
|
|
175
|
-
assistantCaption:
|
|
176
|
-
expanded:
|
|
177
|
-
statusText:
|
|
178
|
-
statusSuffix:
|
|
179
|
-
rotateStatus:
|
|
174
|
+
userCaption: Y || null,
|
|
175
|
+
spokenChunks: w,
|
|
176
|
+
assistantCaption: _,
|
|
177
|
+
expanded: R,
|
|
178
|
+
statusText: ze,
|
|
179
|
+
statusSuffix: Q,
|
|
180
|
+
rotateStatus: $,
|
|
180
181
|
errorText: a,
|
|
181
182
|
control: n
|
|
182
183
|
});
|
|
183
184
|
})(),
|
|
184
|
-
|
|
185
|
-
className:
|
|
185
|
+
k && !U ? /* @__PURE__ */ f("div", {
|
|
186
|
+
className: z ? "absolute left-20 right-36 top-2 flex justify-center" : `flex w-full justify-center ${R ? "max-w-[calc(100%-12rem)]" : "max-w-[calc(100%-8rem)]"}`,
|
|
186
187
|
children: /* @__PURE__ */ f("button", {
|
|
187
188
|
type: "button",
|
|
188
189
|
onClick: () => {
|
|
189
|
-
I("panel"),
|
|
190
|
+
I("panel"), k.onOpen();
|
|
190
191
|
},
|
|
191
|
-
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 ${
|
|
192
|
+
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 ${z ? "h-8 px-3 text-xs" : "h-10 px-4 text-sm"}`,
|
|
192
193
|
"data-testid": "assistant-voice-proposal-chip",
|
|
193
|
-
children:
|
|
194
|
+
children: k.label
|
|
194
195
|
})
|
|
195
196
|
}) : null,
|
|
196
|
-
|
|
197
|
-
className: `absolute z-10 flex flex-col gap-2 overflow-y-auto rounded-lg border border-border-subtle bg-bg-elevated shadow-lg ${
|
|
197
|
+
A && U ? /* @__PURE__ */ p("div", {
|
|
198
|
+
className: `absolute z-10 flex flex-col gap-2 overflow-y-auto rounded-lg border border-border-subtle bg-bg-elevated shadow-lg ${R ? "inset-x-6 bottom-24 top-24 mx-auto max-w-xl p-4" : "inset-x-3 bottom-16 top-16 p-3"}`,
|
|
198
199
|
"data-testid": "assistant-voice-proposal-tray",
|
|
199
200
|
children: [/* @__PURE__ */ f("div", {
|
|
200
201
|
className: "flex justify-end",
|
|
201
202
|
children: /* @__PURE__ */ f("button", {
|
|
202
203
|
type: "button",
|
|
203
|
-
onClick:
|
|
204
|
+
onClick: A.onClose,
|
|
204
205
|
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",
|
|
205
|
-
"aria-label":
|
|
206
|
+
"aria-label": A.closeLabel,
|
|
206
207
|
"data-testid": "assistant-voice-proposal-tray-close",
|
|
207
208
|
children: /* @__PURE__ */ f(d, {
|
|
208
209
|
className: "size-4",
|
|
209
210
|
"aria-hidden": "true"
|
|
210
211
|
})
|
|
211
212
|
})
|
|
212
|
-
}),
|
|
213
|
+
}), A.content]
|
|
213
214
|
}) : null,
|
|
214
|
-
|
|
215
|
-
view:
|
|
216
|
-
onContinue:
|
|
217
|
-
onNotNow:
|
|
215
|
+
g ? /* @__PURE__ */ f(me, {
|
|
216
|
+
view: L,
|
|
217
|
+
onContinue: g.accept,
|
|
218
|
+
onNotNow: g.decline
|
|
218
219
|
}) : null,
|
|
219
|
-
|
|
220
|
-
turns:
|
|
221
|
-
onClose: () =>
|
|
222
|
-
onSave:
|
|
223
|
-
onContinueInChat:
|
|
220
|
+
V ? /* @__PURE__ */ f(de, {
|
|
221
|
+
turns: xe,
|
|
222
|
+
onClose: () => H(!1),
|
|
223
|
+
onSave: Se,
|
|
224
|
+
onContinueInChat: Ce,
|
|
224
225
|
renderAfterTurn: Me
|
|
225
226
|
}) : null,
|
|
226
|
-
|
|
227
|
-
className: `absolute ${
|
|
227
|
+
b ? /* @__PURE__ */ f("div", {
|
|
228
|
+
className: `absolute ${R ? "left-6 top-6" : z ? "left-11 top-2" : "left-3 top-3"}`,
|
|
228
229
|
children: /* @__PURE__ */ f(re, {
|
|
229
230
|
onFiles: (e) => {
|
|
230
|
-
|
|
231
|
+
b(e), I((e) => e === "mini" ? "panel" : e);
|
|
231
232
|
},
|
|
232
|
-
onPickerOpen:
|
|
233
|
+
onPickerOpen: Pe,
|
|
233
234
|
direction: "down",
|
|
234
235
|
canAddMore: De,
|
|
235
|
-
disabled:
|
|
236
|
+
disabled: S
|
|
236
237
|
})
|
|
237
238
|
}) : null,
|
|
238
|
-
(
|
|
239
|
-
className: `absolute ${
|
|
239
|
+
(y.length > 0 || x > 0) && !z ? /* @__PURE__ */ f("div", {
|
|
240
|
+
className: `absolute ${R ? "bottom-24 left-24 right-24" : "bottom-16 left-16 right-16"}`,
|
|
240
241
|
"data-testid": "assistant-voice-attachments",
|
|
241
242
|
children: /* @__PURE__ */ f(ie, {
|
|
242
|
-
attachments:
|
|
243
|
+
attachments: y,
|
|
243
244
|
onRemove: Te ?? (() => void 0),
|
|
244
245
|
onRetry: Ee ?? (() => void 0),
|
|
245
|
-
preparingCount:
|
|
246
|
-
disabled:
|
|
246
|
+
preparingCount: x,
|
|
247
|
+
disabled: S
|
|
247
248
|
})
|
|
248
249
|
}) : null,
|
|
249
250
|
/* @__PURE__ */ f("button", {
|
|
250
251
|
type: "button",
|
|
251
|
-
onClick: () =>
|
|
252
|
-
className: `absolute ${
|
|
253
|
-
"aria-pressed":
|
|
254
|
-
"aria-label":
|
|
252
|
+
onClick: () => H((e) => !e),
|
|
253
|
+
className: `absolute ${R ? "bottom-6 right-6 size-14" : z ? "right-2 top-2 size-8" : "bottom-3 right-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`,
|
|
254
|
+
"aria-pressed": V,
|
|
255
|
+
"aria-label": j("voiceSession.transcriptTitle", "Voice transcript"),
|
|
255
256
|
"data-testid": "assistant-voice-transcript-toggle",
|
|
256
|
-
children: /* @__PURE__ */ f(
|
|
257
|
+
children: /* @__PURE__ */ f(ve, { className: R ? "size-6" : z ? "size-4" : "size-5" })
|
|
257
258
|
}),
|
|
258
259
|
/* @__PURE__ */ f("button", {
|
|
259
260
|
type: "button",
|
|
260
|
-
onClick: () => I(
|
|
261
|
-
className: `absolute ${
|
|
262
|
-
"aria-label":
|
|
261
|
+
onClick: () => I(B),
|
|
262
|
+
className: `absolute ${R ? "bottom-6 left-6 size-14" : z ? "left-2 top-2 size-8" : "bottom-3 left-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`,
|
|
263
|
+
"aria-label": B === "panel" ? j("voiceSession.expandPanel", "Show the conversation in the panel") : B === "full" ? j("voiceSession.expand", "Expand the conversation to full screen") : j("voiceSession.collapse", "Shrink to the compact controller"),
|
|
263
264
|
"data-testid": "assistant-voice-expand",
|
|
264
|
-
children:
|
|
265
|
+
children: R ? /* @__PURE__ */ f(_e, { className: "size-5" }) : /* @__PURE__ */ f(ge, { className: z ? "size-4" : "size-5" })
|
|
265
266
|
})
|
|
266
267
|
]
|
|
267
268
|
});
|
|
268
269
|
};
|
|
269
|
-
function
|
|
270
|
+
function ye(e, t) {
|
|
270
271
|
switch (e) {
|
|
271
272
|
case "network": return t("voiceSession.noticeNetwork", "Speech recognition lost its connection. Check your network — it will retry.");
|
|
272
273
|
case "not-capturing": return t("voiceSession.noticeNotCapturing", "The microphone did not start. Check that this site is allowed to use it, then try again.");
|
|
@@ -277,7 +278,7 @@ function ve(e, t) {
|
|
|
277
278
|
default: return e;
|
|
278
279
|
}
|
|
279
280
|
}
|
|
280
|
-
function
|
|
281
|
+
function be(e, t) {
|
|
281
282
|
switch (e) {
|
|
282
283
|
case "mic-denied": return t("voiceSession.micDenied", "Microphone access is blocked. Allow it in your browser settings to talk.");
|
|
283
284
|
case "no-speech-support": return t("voiceSession.noSpeechSupport", "This browser cannot listen. Try a different browser, or type instead.");
|
|
@@ -3,59 +3,64 @@ import { showPreviousChunk as r } from "../../voice/miniCaptionBudget.js";
|
|
|
3
3
|
import { isAwaitingFirstChunk as i } from "../../voice/speechPlayback.js";
|
|
4
4
|
import { VoiceWaveform as a } from "./VoiceWaveform.js";
|
|
5
5
|
import { VoiceStatusText as o } from "./VoiceStatusText.js";
|
|
6
|
-
import {
|
|
6
|
+
import { LiveAvatarMiniIndicator as s, useLiveAvatarMiniIndicatorShown as c } from "../assistantLiveAvatarSeam.js";
|
|
7
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
8
|
//#region src/shared/assistant/ui/voice/VoiceMiniController.tsx
|
|
8
|
-
var
|
|
9
|
-
let
|
|
10
|
-
return /* @__PURE__ */
|
|
9
|
+
var f = " self-stretch justify-end pb-8.5 [container-type:size] [@container_(min-height:4.0312rem)_and_(max-height:5.2343rem)]:[&>p[role=status]]:line-clamp-2 [@container_(max-height:4.0312rem)]:[&>p[role=status]]:line-clamp-1 [@container_(max-height:4.0312rem)]:[&>p[role=status]]:min-h-5 [@container_(max-height:5.2343rem)]:[&>p[role=status]>span:not(:last-child)]:sr-only", p = ({ state: p, caption: m, spokenChunks: h = null, statusText: g, statusSuffix: _, rotateStatus: v, control: y, errorText: b = null }) => {
|
|
10
|
+
let x = e(p), S = x && h && h.index >= 0 ? h : null, C = x && i(h);
|
|
11
|
+
return /* @__PURE__ */ d("div", {
|
|
11
12
|
className: "flex min-h-0 w-full flex-1 items-center gap-3 px-4",
|
|
12
13
|
"data-testid": "assistant-voice-mini",
|
|
13
|
-
"data-state":
|
|
14
|
-
children: [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
"data-state": p,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ d("div", {
|
|
17
|
+
className: `flex min-w-0 flex-1 flex-col gap-1.5${c() ? f : ""}`,
|
|
18
|
+
children: [/* @__PURE__ */ d("div", {
|
|
19
|
+
className: "flex items-center gap-2",
|
|
20
|
+
children: [/* @__PURE__ */ u(a, {
|
|
21
|
+
active: t(p),
|
|
22
|
+
settled: n(p),
|
|
23
|
+
tone: p === "speaking" ? "speaking" : "listening"
|
|
24
|
+
}), /* @__PURE__ */ u(o, {
|
|
25
|
+
className: "truncate text-xs text-text-muted",
|
|
26
|
+
status: g,
|
|
27
|
+
suffix: _,
|
|
28
|
+
rotating: v
|
|
29
|
+
})]
|
|
30
|
+
}), p === "mic-error" ? /* @__PURE__ */ u("p", {
|
|
31
|
+
className: "line-clamp-2 text-xs text-status-warning",
|
|
32
|
+
role: "alert",
|
|
33
|
+
"data-testid": "assistant-voice-mini-error",
|
|
34
|
+
children: b
|
|
35
|
+
}) : m ? /* @__PURE__ */ u("p", {
|
|
36
|
+
className: [
|
|
37
|
+
"line-clamp-3 break-words text-left text-sm leading-snug",
|
|
38
|
+
C ? "min-h-9" : "",
|
|
39
|
+
x ? "font-semibold text-text-primary" : "font-semibold text-text-secondary"
|
|
40
|
+
].join(" "),
|
|
41
|
+
role: "status",
|
|
42
|
+
"aria-live": "polite",
|
|
43
|
+
"data-testid": "assistant-voice-caption",
|
|
44
|
+
children: S ? /* @__PURE__ */ d(l, { children: [r(S) ? /* @__PURE__ */ d("span", {
|
|
45
|
+
className: "text-text-muted transition-colors duration-300",
|
|
46
|
+
children: [S.chunks[S.index - 1], " "]
|
|
47
|
+
}) : null, /* @__PURE__ */ u("span", {
|
|
48
|
+
className: "text-text-primary",
|
|
49
|
+
"data-testid": "assistant-voice-caption-current",
|
|
50
|
+
children: S.chunks[S.index]
|
|
51
|
+
})] }) : C ? null : m
|
|
52
|
+
}) : /* @__PURE__ */ u("div", {
|
|
53
|
+
className: "h-9",
|
|
54
|
+
"aria-hidden": "true"
|
|
27
55
|
})]
|
|
28
|
-
}),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"line-clamp-3 break-words text-left text-sm leading-snug",
|
|
36
|
-
b ? "min-h-9" : "",
|
|
37
|
-
v ? "font-semibold text-text-primary" : "font-semibold text-text-secondary"
|
|
38
|
-
].join(" "),
|
|
39
|
-
role: "status",
|
|
40
|
-
"aria-live": "polite",
|
|
41
|
-
"data-testid": "assistant-voice-caption",
|
|
42
|
-
children: y ? /* @__PURE__ */ l(s, { children: [r(y) ? /* @__PURE__ */ l("span", {
|
|
43
|
-
className: "text-text-muted transition-colors duration-300",
|
|
44
|
-
children: [y.chunks[y.index - 1], " "]
|
|
45
|
-
}) : null, /* @__PURE__ */ c("span", {
|
|
46
|
-
className: "text-text-primary",
|
|
47
|
-
"data-testid": "assistant-voice-caption-current",
|
|
48
|
-
children: y.chunks[y.index]
|
|
49
|
-
})] }) : b ? null : d
|
|
50
|
-
}) : /* @__PURE__ */ c("div", {
|
|
51
|
-
className: "h-9",
|
|
52
|
-
"aria-hidden": "true"
|
|
53
|
-
})]
|
|
54
|
-
}), /* @__PURE__ */ c("div", {
|
|
55
|
-
className: "shrink-0",
|
|
56
|
-
children: g
|
|
57
|
-
})]
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ u("div", {
|
|
58
|
+
className: "shrink-0",
|
|
59
|
+
children: y
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ u(s, {})
|
|
62
|
+
]
|
|
58
63
|
});
|
|
59
64
|
};
|
|
60
65
|
//#endregion
|
|
61
|
-
export {
|
|
66
|
+
export { p as VoiceMiniController };
|