@burdenoff/fe-libs 2026.1115.9 → 2026.1115.11

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 (51) hide show
  1. package/dist/chrome/globalSearch/ResultsList.js +39 -33
  2. package/dist/chrome/index.d.ts +1 -0
  3. package/dist/chrome/shell/ShellSidebar.js +287 -281
  4. package/dist/chrome/shell/shellSidebarWidth.d.ts +16 -0
  5. package/dist/chrome/shell/shellSidebarWidth.js +26 -0
  6. package/dist/chrome/shellLabelManifest.d.ts +8 -0
  7. package/dist/chrome.js +65 -63
  8. package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.d.ts +8 -1
  9. package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.js +126 -123
  10. package/dist/shared/assistant/avatar/live/liveAvatarController.d.ts +7 -0
  11. package/dist/shared/assistant/avatar/live/liveAvatarController.js +3 -2
  12. package/dist/shared/assistant/ui/assistantLiveAvatarSeam.d.ts +26 -0
  13. package/dist/shared/assistant/ui/assistantLiveAvatarSeam.js +87 -79
  14. package/dist/shared/assistant/ui/composer/AssistantHandsFreeInterruptToggle.d.ts +4 -0
  15. package/dist/shared/assistant/ui/composer/AssistantHandsFreeInterruptToggle.js +22 -22
  16. package/dist/shared/assistant/ui/useVoiceSession.js +223 -223
  17. package/dist/shared/assistant/voice/handsfree/handsFreeController.js +79 -79
  18. package/dist/shared/assistant/voice/handsfree/handsFreeSetting.d.ts +6 -1
  19. package/dist/shared/assistant/voice/handsfree/handsFreeSetting.js +2 -2
  20. package/dist/shared/assistant/voice/handsfree/playbackReference.d.ts +45 -3
  21. package/dist/shared/assistant/voice/handsfree/playbackReference.js +62 -15
  22. package/dist/shared/constants/shellCssVars.d.ts +9 -0
  23. package/dist/shared/constants/shellCssVars.js +3 -0
  24. package/dist/shared/events/sinks/RybbitSink.d.ts +13 -1
  25. package/dist/shared/events/sinks/RybbitSink.js +129 -121
  26. package/dist/shared/events/sinks/index.d.ts +1 -1
  27. package/dist/shared/pages/SearchPage.d.ts +17 -1
  28. package/dist/shared/pages/SearchPage.js +284 -243
  29. package/dist/shared/pages/searchPage/PageResultsGroup.d.ts +16 -0
  30. package/dist/shared/pages/searchPage/PageResultsGroup.js +29 -0
  31. package/dist/shared/pages/searchPage/ResultsList.d.ts +6 -1
  32. package/dist/shared/pages/searchPage/ResultsList.js +9 -53
  33. package/dist/shared/pages/searchPage/SearchResultCard.d.ts +14 -0
  34. package/dist/shared/pages/searchPage/SearchResultCard.js +57 -0
  35. package/dist/shared/providers/AppShellProvider.d.ts +8 -0
  36. package/dist/shared/providers/AppShellProvider.js +91 -89
  37. package/dist/shared/providers/shell/PersonaSurfaceProvider.d.ts +27 -1
  38. package/dist/shared/providers/shell/PersonaSurfaceProvider.js +214 -179
  39. package/dist/shared/providers/shell/index.d.ts +2 -0
  40. package/dist/shared/providers/shell/navIdMigration.d.ts +29 -0
  41. package/dist/shared/providers/shell/navIdMigration.js +57 -0
  42. package/dist/shared/providers/shell/personaSurfaceRemote.d.ts +7 -0
  43. package/dist/shared/providers/shell/personaSurfaceRemote.js +1 -1
  44. package/dist/shared/types/index.d.ts +11 -0
  45. package/dist/shared-assistant.js +370 -370
  46. package/dist/shared-providers-shell.js +13 -12
  47. package/dist/ui/access-needed-chip.d.ts +16 -0
  48. package/dist/ui/access-needed-chip.js +17 -0
  49. package/dist/ui/index.d.ts +1 -0
  50. package/dist/ui.js +50 -49
  51. package/package.json +1 -1
@@ -6,44 +6,44 @@ import { silencePlaybackReference as te } from "../voice/handsfree/playbackRefer
6
6
  import { primeHostedPlayback as ne } from "../speech/hostedTtsSpeechEngine.js";
7
7
  import { turnClockMs as i } from "../turnTimeline.js";
8
8
  import { useAssistantSpeech as re } from "./AssistantSpeechProvider.js";
9
- import { useLiveAvatarOn as ie } from "./assistantLiveAvatarSeam.js";
10
- import { captionChunks as ae } from "../voice/speechPlayback.js";
9
+ import { useLiveAvatarEchoReference as ie, useLiveAvatarOn as ae } from "./assistantLiveAvatarSeam.js";
10
+ import { captionChunks as oe } from "../voice/speechPlayback.js";
11
11
  import { speechFeed as a } from "../speech/speechFeed.js";
12
- import { planSubmitTimer as oe, resolveVoiceGraceMs as se } from "../voice/handsFree.js";
13
- import { isTurnSuperseded as ce } from "../voice/supersededTurns.js";
14
- import { INITIAL_SESSION as le, INTERRUPT_MAX_MS as ue, NOTHING_HEARD as de, advanceHeardClock as fe, isCapturing as pe, isSubmittable as me, planListeningHold as he, planReplyConsumption as ge, planVoiceAnnouncement as _e, shouldRecognise as ve, spokenSoFar as o, voiceSessionReducer as ye } from "../voice/voiceSession.js";
15
- import { useCallback as s, useEffect as c, useLayoutEffect as be, useMemo as xe, useReducer as Se, useRef as l, useState as u } from "react";
12
+ import { planSubmitTimer as se, resolveVoiceGraceMs as ce } from "../voice/handsFree.js";
13
+ import { isTurnSuperseded as o } from "../voice/supersededTurns.js";
14
+ import { INITIAL_SESSION as le, INTERRUPT_MAX_MS as ue, NOTHING_HEARD as de, advanceHeardClock as fe, isCapturing as pe, isSubmittable as me, planListeningHold as he, planReplyConsumption as ge, planVoiceAnnouncement as _e, shouldRecognise as ve, spokenSoFar as s, voiceSessionReducer as ye } from "../voice/voiceSession.js";
15
+ import { useCallback as c, useEffect as l, useLayoutEffect as be, useMemo as xe, useReducer as Se, useRef as u, useState as d } from "react";
16
16
  // src/shared/assistant/ui/useVoiceSession.ts
17
17
  var Ce = 4e3, we = 2500, Te = 5e3, Ee = 12e3;
18
- function De({ onSubmit: De, latestReply: d, language: f, graceMs: Oe, onSupersede: ke, handsFreeInterrupt: Ae, handsFreeStreamNoticeAccepted: je, onAcceptHandsFreeStreamNotice: Me, onBargeIn: Ne }) {
19
- let p = se(Oe), m = l(null), Pe = s((e, t) => ye(e, t, m.current), []), [h, g] = Se(Pe, le), _ = re(), { setSessionSpeaking: v, setSessionMicOpen: y, speakingMessageId: b, stop: x } = _, Fe = l(_.toggle), Ie = _.toggle;
18
+ function De({ onSubmit: De, latestReply: f, language: p, graceMs: Oe, onSupersede: ke, handsFreeInterrupt: Ae, handsFreeStreamNoticeAccepted: je, onAcceptHandsFreeStreamNotice: Me, onBargeIn: Ne }) {
19
+ let m = ce(Oe), h = u(null), Pe = c((e, t) => ye(e, t, h.current), []), [g, _] = Se(Pe, le), v = re(), { setSessionSpeaking: y, setSessionMicOpen: b, speakingMessageId: x, stop: S } = v, Fe = u(v.toggle), Ie = v.toggle;
20
20
  be(() => {
21
21
  Fe.current = Ie;
22
22
  }, [Ie]);
23
- let S = l(null), C = l({}), w = l(de), T = l(void 0), E = l(void 0), D = l(0), O = l(void 0), k = l(/* @__PURE__ */ new Map()), Le = l(void 0);
24
- c(() => {
25
- let e = h.correctionTimingDecision;
26
- if (e && e !== Le.current) {
27
- Le.current = e;
28
- for (let [t, n] of k.current) e.accepted && t >= e.candidateId && (T.current = n.lastSpeechFrame ?? T.current, E.current = n.recognizerSpeechEnded ?? E.current), (e.accepted || t <= e.candidateId) && k.current.delete(t);
23
+ let C = u(null), w = u({}), T = u(de), E = u(void 0), D = u(void 0), Le = u(0), O = u(void 0), k = u(/* @__PURE__ */ new Map()), Re = u(void 0);
24
+ l(() => {
25
+ let e = g.correctionTimingDecision;
26
+ if (e && e !== Re.current) {
27
+ Re.current = e;
28
+ for (let [t, n] of k.current) e.accepted && t >= e.candidateId && (E.current = n.lastSpeechFrame ?? E.current, D.current = n.recognizerSpeechEnded ?? D.current), (e.accepted || t <= e.candidateId) && k.current.delete(t);
29
29
  O.current !== void 0 && O.current <= e.candidateId && (O.current = void 0);
30
30
  }
31
- (h.phase !== "thinking" || h.muted) && (k.current.clear(), O.current = void 0), (h.phase === "idle" || h.phase === "ended") && (T.current = void 0, E.current = void 0);
31
+ (g.phase !== "thinking" || g.muted) && (k.current.clear(), O.current = void 0), (g.phase === "idle" || g.phase === "ended") && (E.current = void 0, D.current = void 0);
32
32
  }, [
33
- h.phase,
34
- h.muted,
35
- h.correctionTimingDecision
33
+ g.phase,
34
+ g.muted,
35
+ g.correctionTimingDecision
36
36
  ]);
37
- let A = l(null), Re = l(!1), [ze, j] = u(null), M = l(null), [Be, N] = u(null), [P, F] = u(!1), [Ve, I] = u(!1), [L, R] = u(!1), z = l(h);
38
- z.current = h;
39
- let B = l([]), V = l(null), H = l(!1), U = s(() => {
37
+ let A = u(null), ze = u(!1), [Be, j] = d(null), M = u(null), [Ve, N] = d(null), [P, F] = d(!1), [He, I] = d(!1), [L, R] = d(!1), z = u(g);
38
+ z.current = g;
39
+ let B = u([]), V = u(null), H = u(!1), U = c(() => {
40
40
  B.current = [], V.current = null, H.current = !1;
41
- }, []), W = s(() => {
41
+ }, []), W = c(() => {
42
42
  for (;;) {
43
43
  let e = B.current.shift();
44
44
  if (!e) return !1;
45
45
  if (!e.stillWanted || e.stillWanted()) {
46
- V.current = e, m.current = m.current ? `${m.current} ${e.text}` : e.text;
46
+ V.current = e, h.current = h.current ? `${h.current} ${e.text}` : e.text;
47
47
  try {
48
48
  Fe.current(e.id, e.text, e.lang);
49
49
  } catch {
@@ -53,178 +53,178 @@ function De({ onSubmit: De, latestReply: d, language: f, graceMs: Oe, onSupersed
53
53
  return !0;
54
54
  }
55
55
  }
56
- }, []), G = l(!1), He = s((e) => {
56
+ }, []), G = u(!1), Ue = c((e) => {
57
57
  let t = he({
58
58
  requested: e,
59
59
  held: G.current,
60
60
  muted: z.current.muted
61
61
  });
62
- G.current = t.held, t.mute !== null && g({
62
+ G.current = t.held, t.mute !== null && _({
63
63
  type: "mute",
64
64
  muted: t.mute
65
65
  });
66
- }, []), K = s((e) => {
66
+ }, []), K = c((e) => {
67
67
  let t = _e(z.current);
68
- t !== "drop" && (V.current?.id === e.id || B.current.some((t) => t.id === e.id) || (B.current.push(e), t === "start" && !H.current && (H.current = !0, g({ type: "announce" }))));
69
- }, []), Ue = s((e) => {
70
- z.current.phase === "thinking" ? (B.current.push(e), H.current = !0, g({ type: "answered-locally" })) : K(e);
71
- }, [K]), We = l(d);
72
- We.current = d, c(() => {
73
- if (h.phase === "speaking") {
68
+ t !== "drop" && (V.current?.id === e.id || B.current.some((t) => t.id === e.id) || (B.current.push(e), t === "start" && !H.current && (H.current = !0, _({ type: "announce" }))));
69
+ }, []), We = c((e) => {
70
+ z.current.phase === "thinking" ? (B.current.push(e), H.current = !0, _({ type: "answered-locally" })) : K(e);
71
+ }, [K]), Ge = u(f);
72
+ Ge.current = f, l(() => {
73
+ if (g.phase === "speaking") {
74
74
  let e = M.current;
75
- m.current = e && A.current === e.id && d?.id !== e.id ? e.text : d?.text ?? null;
75
+ h.current = e && A.current === e.id && f?.id !== e.id ? e.text : f?.text ?? null;
76
76
  return;
77
77
  }
78
- if (m.current === null) return;
78
+ if (h.current === null) return;
79
79
  let e = setTimeout(() => {
80
- m.current = null;
80
+ h.current = null;
81
81
  }, we);
82
82
  return () => clearTimeout(e);
83
- }, [h.phase, d]);
84
- let Ge = l(f);
85
- Ge.current = f;
86
- let Ke = s((e, t) => {
83
+ }, [g.phase, f]);
84
+ let Ke = u(p);
85
+ Ke.current = p;
86
+ let qe = c((e, t) => {
87
87
  let n = z.current;
88
88
  if (!n.muted) {
89
89
  if (n.phase === "thinking") {
90
90
  e === "lastSpeechFrame" && (O.current = void 0);
91
- let n = O.current ?? D.current, r = k.current.get(n) ?? {};
91
+ let n = O.current ?? Le.current, r = k.current.get(n) ?? {};
92
92
  r[e] = t, k.current.set(n, r);
93
- } else n.phase === "listening" && (e === "lastSpeechFrame" ? T.current = t : E.current = t);
93
+ } else n.phase === "listening" && (e === "lastSpeechFrame" ? E.current = t : D.current = t);
94
94
  }
95
- }, []), q = s((e) => {
95
+ }, []), q = c((e) => {
96
96
  let t = z.current;
97
97
  if (t.phase !== "thinking" || t.muted) return;
98
- let n = D.current;
99
- return e && (O.current = n, D.current += 1), n;
100
- }, []), J = s((e, t) => {
101
- g({
98
+ let n = Le.current;
99
+ return e && (O.current = n, Le.current += 1), n;
100
+ }, []), J = c((e, t) => {
101
+ _({
102
102
  type: "speech",
103
103
  transcript: e,
104
104
  final: t,
105
105
  at: Date.now(),
106
- language: Ge.current,
106
+ language: Ke.current,
107
107
  timingCandidateId: q(t)
108
108
  });
109
- }, [q]), qe = s((e, t, n) => {
110
- g({
109
+ }, [q]), Je = c((e, t, n) => {
110
+ _({
111
111
  type: "speech",
112
112
  transcript: e,
113
113
  final: t,
114
114
  at: Date.now(),
115
- language: n ?? Ge.current,
115
+ language: n ?? Ke.current,
116
116
  gated: !0,
117
117
  timingCandidateId: q(t)
118
118
  });
119
- }, [q]), Je = l(0), Ye = s(() => {
120
- U(), x(), Je.current = Date.now(), F(!0), g({ type: "interrupt" });
121
- }, [x, U]), Xe = s((e) => J(e, !0), [J]), Ze = e((e) => e.micDeviceId), Y = t({
122
- onFinalize: Xe,
123
- language: f,
124
- deviceId: Ze,
119
+ }, [q]), Ye = u(0), Xe = c(() => {
120
+ U(), S(), Ye.current = Date.now(), F(!0), _({ type: "interrupt" });
121
+ }, [S, U]), Ze = c((e) => J(e, !0), [J]), Qe = e((e) => e.micDeviceId), Y = t({
122
+ onFinalize: Ze,
123
+ language: p,
124
+ deviceId: Qe,
125
125
  onSpeechEnd: (e) => {
126
- Ke("recognizerSpeechEnded", e);
126
+ qe("recognizerSpeechEnded", e);
127
127
  }
128
- }), Qe = Y.stop, $e = l(Ne);
129
- $e.current = Ne;
130
- let et = s(() => {
131
- U(), te(), x(), Je.current = Date.now(), F(!0), g({ type: "interrupt" }), $e.current?.();
132
- }, [x, U]), tt = ie(), X = n({
133
- enabled: ee(Ae, r(), tt),
134
- phase: h.phase,
135
- muted: h.muted,
136
- language: f,
128
+ }), $e = Y.stop, et = u(Ne);
129
+ et.current = Ne;
130
+ let tt = c(() => {
131
+ U(), te(), S(), Ye.current = Date.now(), F(!0), _({ type: "interrupt" }), et.current?.();
132
+ }, [S, U]), nt = ae(), rt = ie(), X = n({
133
+ enabled: ee(Ae, r(), nt, rt),
134
+ phase: g.phase,
135
+ muted: g.muted,
136
+ language: p,
137
137
  streamNoticeAccepted: je ?? null,
138
138
  onAcceptStreamNotice: Me,
139
- onBargeIn: et,
140
- onTranscript: qe,
139
+ onBargeIn: tt,
140
+ onTranscript: Je,
141
141
  onSpeechFrame: (e) => {
142
- Ke("lastSpeechFrame", e);
142
+ qe("lastSpeechFrame", e);
143
143
  }
144
- }), nt = X.mode === "notice", Z = Y.isListening || X.suppressWebSpeech && X.mode === "active";
145
- c(() => {
144
+ }), it = X.mode === "notice", Z = Y.isListening || X.suppressWebSpeech && X.mode === "active";
145
+ l(() => {
146
146
  Y.interim && J(Y.interim, !1);
147
- }, [Y.interim, J]), c(() => {
148
- S.current && clearTimeout(S.current), I(!1), w.current = fe(w.current, h, i());
149
- let e = oe({
150
- phase: h.phase,
151
- muted: h.muted,
152
- spoken: o(h),
147
+ }, [Y.interim, J]), l(() => {
148
+ C.current && clearTimeout(C.current), I(!1), T.current = fe(T.current, g, i());
149
+ let e = se({
150
+ phase: g.phase,
151
+ muted: g.muted,
152
+ spoken: s(g),
153
153
  holding: L,
154
- graceMs: p
154
+ graceMs: m
155
155
  });
156
156
  if (!e.arm) return;
157
157
  let t = setTimeout(() => I(!0), Math.min(800, e.delayMs)), n = i();
158
- return S.current = setTimeout(() => {
159
- C.current = {
160
- speechEnded: w.current.at ?? n,
161
- lastSpeechFrame: T.current,
162
- recognizerSpeechEnded: E.current,
163
- selectedGraceMs: p,
158
+ return C.current = setTimeout(() => {
159
+ w.current = {
160
+ speechEnded: T.current.at ?? n,
161
+ lastSpeechFrame: E.current,
162
+ recognizerSpeechEnded: D.current,
163
+ selectedGraceMs: m,
164
164
  graceStarted: n,
165
165
  graceEnded: i()
166
- }, g({
166
+ }, _({
167
167
  type: "silence",
168
168
  at: Date.now()
169
169
  });
170
170
  }, e.delayMs), () => {
171
- clearTimeout(t), S.current && clearTimeout(S.current);
171
+ clearTimeout(t), C.current && clearTimeout(C.current);
172
172
  };
173
173
  }, [
174
- h,
174
+ g,
175
175
  L,
176
- p
177
- ]), c(() => {
178
- (h.phase !== "listening" || h.muted) && R(!1);
179
- }, [h.phase, h.muted]), c(() => {
176
+ m
177
+ ]), l(() => {
178
+ (g.phase !== "listening" || g.muted) && R(!1);
179
+ }, [g.phase, g.muted]), l(() => {
180
180
  if (!P) return;
181
- let e = Date.now() - Je.current, t = Z ? Math.max(0, 500 - e) : Math.max(0, ue - e), n = setTimeout(() => F(!1), t);
181
+ let e = Date.now() - Ye.current, t = Z ? Math.max(0, 500 - e) : Math.max(0, ue - e), n = setTimeout(() => F(!1), t);
182
182
  return () => clearTimeout(n);
183
183
  }, [P, Z]);
184
- let rt = l("");
185
- h.phase === "listening" && (rt.current = o(h)), c(() => {
186
- if (h.phase !== "thinking") return;
187
- y(!1), U(), N((e) => typeof e == "object" && e ? null : e);
188
- let e = rt.current.trim();
189
- e && De(e, $.current ?? `vs-orphan-${Date.now().toString(36)}`, C.current, { correction: z.current.correcting }), C.current = {}, w.current = de, T.current = void 0, E.current = void 0;
190
- }, [h.phase]), c(() => {
191
- let e = ge(d?.id, h.phase, A.current, ce(d?.id));
192
- e.claim && (A.current = d?.id ?? null, e.advance && d && (d.refused ? (U(), N({
184
+ let at = u("");
185
+ g.phase === "listening" && (at.current = s(g)), l(() => {
186
+ if (g.phase !== "thinking") return;
187
+ b(!1), U(), N((e) => typeof e == "object" && e ? null : e);
188
+ let e = at.current.trim();
189
+ e && De(e, $.current ?? `vs-orphan-${Date.now().toString(36)}`, w.current, { correction: z.current.correcting }), w.current = {}, T.current = de, E.current = void 0, D.current = void 0;
190
+ }, [g.phase]), l(() => {
191
+ let e = ge(f?.id, g.phase, A.current, o(f?.id));
192
+ e.claim && (A.current = f?.id ?? null, e.advance && f && (f.refused ? (U(), N({
193
193
  kind: "turn-refused",
194
- text: d.text
195
- }), g({ type: "turn-refused" })) : g({
194
+ text: f.text
195
+ }), _({ type: "turn-refused" })) : _({
196
196
  type: "reply",
197
- text: d.text
197
+ text: f.text
198
198
  })));
199
199
  }, [
200
- d,
201
- h.phase,
200
+ f,
201
+ g.phase,
202
202
  U
203
- ]), c(() => {
204
- if (b === null || h.phase !== "thinking" || A.current === b) return;
205
- if (ce(b)) {
206
- x();
203
+ ]), l(() => {
204
+ if (x === null || g.phase !== "thinking" || A.current === x) return;
205
+ if (o(x)) {
206
+ S();
207
207
  return;
208
208
  }
209
- let e = a.peek(b);
210
- e && e.final && e.channel === "voice" && e.voiceSessionId !== void 0 && e.voiceSessionId === $.current && (A.current = b, M.current = {
211
- id: b,
209
+ let e = a.peek(x);
210
+ e && e.final && e.channel === "voice" && e.voiceSessionId !== void 0 && e.voiceSessionId === $.current && (A.current = x, M.current = {
211
+ id: x,
212
212
  text: e.text
213
- }, g({
213
+ }, _({
214
214
  type: "reply-audio-started",
215
- replyId: b
215
+ replyId: x
216
216
  }));
217
217
  }, [
218
- b,
219
- h.phase,
220
- x
221
- ]), c(() => a.subscribe((e) => {
218
+ x,
219
+ g.phase,
220
+ S
221
+ ]), l(() => a.subscribe((e) => {
222
222
  if (e.type !== "audio") return;
223
223
  let t = z.current.phase;
224
224
  if (t !== "thinking" && t !== "speaking") return;
225
225
  if (e.state === "retrying") {
226
226
  if (A.current !== e.messageId || M.current?.id !== e.messageId) return;
227
- A.current = null, M.current = null, j(e.messageId), g({ type: "reply-audio-paused" });
227
+ A.current = null, M.current = null, j(e.messageId), _({ type: "reply-audio-paused" });
228
228
  return;
229
229
  }
230
230
  if (e.state === "ended") {
@@ -236,105 +236,105 @@ function De({ onSubmit: De, latestReply: d, language: f, graceMs: Oe, onSupersed
236
236
  }), j(null);
237
237
  let r = M.current;
238
238
  t === "thinking" && queueMicrotask(() => {
239
- M.current === r && z.current.phase === "thinking" && g({ type: "reply-audio-ended" });
239
+ M.current === r && z.current.phase === "thinking" && _({ type: "reply-audio-ended" });
240
240
  });
241
241
  return;
242
242
  }
243
- if (ce(e.messageId)) return;
243
+ if (o(e.messageId)) return;
244
244
  let n = a.peek(e.messageId);
245
245
  if (n && n.channel === "voice" && n.voiceSessionId === $.current) {
246
246
  if (e.state === "queued") j(e.messageId), A.current = e.messageId, M.current = {
247
247
  id: e.messageId,
248
248
  text: n.text
249
- }, Qe();
249
+ }, $e();
250
250
  else if (A.current !== e.messageId) return;
251
251
  else e.state === "started" ? (A.current = e.messageId, M.current = {
252
252
  id: e.messageId,
253
253
  text: n.text
254
- }, g({
254
+ }, _({
255
255
  type: "reply-audio-started",
256
256
  replyId: e.messageId,
257
257
  partial: !n.final
258
- })) : e.state === "paused" && A.current === e.messageId && g({ type: "reply-audio-paused" });
258
+ })) : e.state === "paused" && A.current === e.messageId && _({ type: "reply-audio-paused" });
259
259
  }
260
- }), [Qe]), c(() => {
261
- h.phase !== "thinking" && h.phase !== "speaking" && j(null);
262
- }, [h.phase]), c(() => {
263
- let e = b !== null;
264
- Re.current && !e && (V.current = null, z.current.phase === "speaking" && W() || g({ type: "speech-ended" })), Re.current = e;
265
- }, [b, W]), c(() => {
266
- h.phase !== "listening" && N((e) => e === "nothing-heard" ? null : e);
267
- }, [h.phase]), c(() => {
268
- if (h.phase !== "speaking" || b !== null) return;
260
+ }), [$e]), l(() => {
261
+ g.phase !== "thinking" && g.phase !== "speaking" && j(null);
262
+ }, [g.phase]), l(() => {
263
+ let e = x !== null;
264
+ ze.current && !e && (V.current = null, z.current.phase === "speaking" && W() || _({ type: "speech-ended" })), ze.current = e;
265
+ }, [x, W]), l(() => {
266
+ g.phase !== "listening" && N((e) => e === "nothing-heard" ? null : e);
267
+ }, [g.phase]), l(() => {
268
+ if (g.phase !== "speaking" || x !== null) return;
269
269
  let e = setTimeout(() => {
270
- Re.current || (U(), g({ type: "speech-ended" }));
270
+ ze.current || (U(), _({ type: "speech-ended" }));
271
271
  }, Ce);
272
272
  return () => clearTimeout(e);
273
273
  }, [
274
- h.phase,
275
- b,
274
+ g.phase,
275
+ x,
276
276
  U
277
277
  ]);
278
- let Q = _.outputNotCleared;
279
- c(() => {
278
+ let Q = v.outputNotCleared;
279
+ l(() => {
280
280
  if (Q === null || A.current !== Q.messageId) return;
281
281
  let { phase: e } = z.current;
282
282
  e !== "idle" && e !== "ended" && e !== "thinking" && N("reply-not-heard");
283
- }, [Q]), c(() => {
284
- h.phase !== "listening" && h.phase !== "thinking" && N((e) => e === "reply-not-heard" ? null : e);
285
- }, [h.phase]);
286
- let it = l(ke);
287
- it.current = ke;
288
- let at = l(0);
289
- c(() => {
290
- let e = h.superseded;
291
- e !== at.current && (at.current = e, e !== 0 && (U(), x(), it.current?.()));
283
+ }, [Q]), l(() => {
284
+ g.phase !== "listening" && g.phase !== "thinking" && N((e) => e === "reply-not-heard" ? null : e);
285
+ }, [g.phase]);
286
+ let ot = u(ke);
287
+ ot.current = ke;
288
+ let st = u(0);
289
+ l(() => {
290
+ let e = g.superseded;
291
+ e !== st.current && (st.current = e, e !== 0 && (U(), S(), ot.current?.()));
292
292
  }, [
293
- h.superseded,
293
+ g.superseded,
294
294
  U,
295
- x
296
- ]), c(() => {
297
- let e = pe(h);
298
- y(e), ve(h) && ze === null && !X.suppressWebSpeech ? Y.isActive || Y.start("auto") : Y.isActive && Y.stop();
295
+ S
296
+ ]), l(() => {
297
+ let e = pe(g);
298
+ b(e), ve(g) && Be === null && !X.suppressWebSpeech ? Y.isActive || Y.start("auto") : Y.isActive && Y.stop();
299
299
  }, [
300
- h,
300
+ g,
301
301
  Y,
302
- y,
302
+ b,
303
303
  X.suppressWebSpeech,
304
- ze
305
- ]), c(() => {
306
- h.phase === "speaking" && H.current && (H.current = !1, W() || g({ type: "speech-ended" }));
307
- }, [h.phase, W]), c(() => {
308
- Y.error === "not-allowed" || Y.error === "audio-capture" ? g({
304
+ Be
305
+ ]), l(() => {
306
+ g.phase === "speaking" && H.current && (H.current = !1, W() || _({ type: "speech-ended" }));
307
+ }, [g.phase, W]), l(() => {
308
+ Y.error === "not-allowed" || Y.error === "audio-capture" ? _({
309
309
  type: "fail",
310
310
  error: "mic-denied"
311
- }) : Y.error === "language-not-supported" ? g({
311
+ }) : Y.error === "language-not-supported" ? _({
312
312
  type: "fail",
313
313
  error: "no-speech-support"
314
314
  }) : Y.error === "network" ? N("network") : Y.error === "unknown" && N("recognition-failed");
315
- }, [Y.error]), c(() => {
315
+ }, [Y.error]), l(() => {
316
316
  Y.error === null && Z && N((e) => e === "network" || e === "recognition-failed" ? null : e);
317
- }, [Y.error, Z]), c(() => {
318
- if (Z && N((e) => e === "not-capturing" ? null : e), !pe(h) || Z || nt) return;
317
+ }, [Y.error, Z]), l(() => {
318
+ if (Z && N((e) => e === "not-capturing" ? null : e), !pe(g) || Z || it) return;
319
319
  let e = setTimeout(() => N("not-capturing"), Te);
320
320
  return () => clearTimeout(e);
321
321
  }, [
322
- h,
322
+ g,
323
323
  Z,
324
- nt
325
- ]), c(() => {
326
- if (h.phase !== "listening" || h.muted || !Z || o(h) !== "") return;
324
+ it
325
+ ]), l(() => {
326
+ if (g.phase !== "listening" || g.muted || !Z || s(g) !== "") return;
327
327
  let e = setTimeout(() => N("nothing-heard"), Ee);
328
328
  return () => clearTimeout(e);
329
- }, [h, Z]), c(() => {
330
- o(h) !== "" && N(null);
331
- }, [h]);
332
- let $ = l(null), ot = s(() => {
333
- if (F(!1), I(!1), R(!1), U(), G.current = !1, !Y.isSupported) g({
329
+ }, [g, Z]), l(() => {
330
+ s(g) !== "" && N(null);
331
+ }, [g]);
332
+ let $ = u(null), ct = c(() => {
333
+ if (F(!1), I(!1), R(!1), U(), G.current = !1, !Y.isSupported) _({
334
334
  type: "fail",
335
335
  error: "no-speech-support"
336
336
  });
337
- else if (_.isBlocked) g({
337
+ else if (v.isBlocked) _({
338
338
  type: "fail",
339
339
  error: "no-voice-support"
340
340
  });
@@ -346,58 +346,58 @@ function De({ onSubmit: De, latestReply: d, language: f, graceMs: Oe, onSupersed
346
346
  t.volume = 0, e.speak(t);
347
347
  }
348
348
  } catch {}
349
- ne(), v(!0), N(null), A.current = We.current?.id ?? null, M.current = null, $.current = `vs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`, g({ type: "start" });
349
+ ne(), y(!0), N(null), A.current = Ge.current?.id ?? null, M.current = null, $.current = `vs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`, _({ type: "start" });
350
350
  }
351
351
  }, [
352
352
  Y.isSupported,
353
- _.isBlocked,
354
- v,
353
+ v.isBlocked,
354
+ y,
355
355
  U
356
- ]), st = s(() => {
357
- F(!1), I(!1), R(!1), U(), G.current = !1, $.current = null, g({ type: "end" }), x(), v(!1);
356
+ ]), lt = c(() => {
357
+ F(!1), I(!1), R(!1), U(), G.current = !1, $.current = null, _({ type: "end" }), S(), y(!1);
358
358
  }, [
359
- x,
360
- v,
359
+ S,
360
+ y,
361
361
  U
362
- ]), ct = s((e) => $.current === e, []), lt = s(() => {
362
+ ]), ut = c((e) => $.current === e, []), dt = c(() => {
363
363
  let e = z.current;
364
364
  e.phase !== "listening" || e.muted || R(!0);
365
- }, []), ut = s(() => {
365
+ }, []), ft = c(() => {
366
366
  R(!1);
367
367
  let e = z.current;
368
- if (e.phase !== "listening" || e.muted || !me(o(e))) return;
368
+ if (e.phase !== "listening" || e.muted || !me(s(e))) return;
369
369
  let t = i();
370
- C.current = {
371
- speechEnded: w.current.at ?? t,
372
- lastSpeechFrame: T.current,
373
- recognizerSpeechEnded: E.current,
374
- selectedGraceMs: p,
370
+ w.current = {
371
+ speechEnded: T.current.at ?? t,
372
+ lastSpeechFrame: E.current,
373
+ recognizerSpeechEnded: D.current,
374
+ selectedGraceMs: m,
375
375
  graceStarted: t,
376
376
  graceEnded: t
377
- }, g({
377
+ }, _({
378
378
  type: "silence",
379
379
  at: Date.now()
380
380
  });
381
- }, [p]), dt = s(() => {
382
- g({
381
+ }, [m]), pt = c(() => {
382
+ _({
383
383
  type: "mute",
384
384
  muted: !z.current.muted
385
385
  });
386
386
  }, []);
387
- c(() => () => {
388
- v(!1), y(!1);
389
- }, [v, y]);
390
- let ft = ae(_.spokenChunks, h.phase, b);
387
+ l(() => () => {
388
+ y(!1), b(!1);
389
+ }, [y, b]);
390
+ let mt = oe(v.spokenChunks, g.phase, x);
391
391
  return xe(() => ({
392
- session: h,
393
- notice: Be ?? (X.fallbackReason !== null && X.fallbackReason !== "notice-declined" ? "hands-free-fallback" : X.nothingHeard ? "hands-free-nothing-heard" : null),
394
- spokenChunks: ft,
392
+ session: g,
393
+ notice: Ve ?? (X.fallbackReason !== null && X.fallbackReason !== "notice-declined" ? "hands-free-fallback" : X.nothingHeard ? "hands-free-nothing-heard" : null),
394
+ spokenChunks: mt,
395
395
  capturing: Z,
396
- active: h.phase !== "idle" && (h.phase !== "ended" || h.error !== null),
396
+ active: g.phase !== "idle" && (g.phase !== "ended" || g.error !== null),
397
397
  interrupting: P,
398
- awaitingEndpoint: Ve,
398
+ awaitingEndpoint: He,
399
399
  holding: L,
400
- correcting: h.correcting,
400
+ correcting: g.correcting,
401
401
  handsFree: {
402
402
  mode: X.mode,
403
403
  nothingHeard: X.nothingHeard,
@@ -405,22 +405,22 @@ function De({ onSubmit: De, latestReply: d, language: f, graceMs: Oe, onSupersed
405
405
  fallbackReason: X.fallbackReason,
406
406
  privacyNotice: X.privacyNotice
407
407
  },
408
- available: Y.isSupported && !_.isBlocked,
409
- start: ot,
410
- end: st,
411
- isCurrentSession: ct,
412
- toggleMute: dt,
413
- interrupt: Ye,
414
- letMeFinish: lt,
415
- imDone: ut,
408
+ available: Y.isSupported && !v.isBlocked,
409
+ start: ct,
410
+ end: lt,
411
+ isCurrentSession: ut,
412
+ toggleMute: pt,
413
+ interrupt: Xe,
414
+ letMeFinish: dt,
415
+ imDone: ft,
416
416
  announce: K,
417
- holdListening: He,
418
- answerLocally: Ue
417
+ holdListening: Ue,
418
+ answerLocally: We
419
419
  }), [
420
- h,
421
- Be,
422
- P,
420
+ g,
423
421
  Ve,
422
+ P,
423
+ He,
424
424
  L,
425
425
  Z,
426
426
  X.mode,
@@ -429,18 +429,18 @@ function De({ onSubmit: De, latestReply: d, language: f, graceMs: Oe, onSupersed
429
429
  X.fallbackReason,
430
430
  X.privacyNotice,
431
431
  Y.isSupported,
432
- _.isBlocked,
433
- ft,
434
- ot,
435
- st,
432
+ v.isBlocked,
433
+ mt,
436
434
  ct,
437
- dt,
438
- Ye,
439
435
  lt,
440
436
  ut,
437
+ pt,
438
+ Xe,
439
+ dt,
440
+ ft,
441
441
  K,
442
- He,
443
- Ue
442
+ Ue,
443
+ We
444
444
  ]);
445
445
  }
446
446
  export { De as useVoiceSession };