@burdenoff/fe-libs 2026.910.4 → 2026.910.6

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 (31) hide show
  1. package/dist/shared/assistant/index.d.ts +2 -0
  2. package/dist/shared/assistant/index.d.ts.map +1 -1
  3. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +11 -0
  4. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts.map +1 -1
  5. package/dist/shared/assistant/ui/AIAssistantPanel.js +50 -46
  6. package/dist/shared/assistant/ui/AssistantChatArea.js +358 -358
  7. package/dist/shared/assistant/ui/AssistantConversationList.js +16 -16
  8. package/dist/shared/assistant/ui/AssistantLanguageMenu.js +6 -6
  9. package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts +21 -7
  10. package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts.map +1 -1
  11. package/dist/shared/assistant/ui/AssistantMarkdownRenderer.js +47 -37
  12. package/dist/shared/assistant/ui/AssistantMessageItem.js +16 -16
  13. package/dist/shared/assistant/ui/AssistantReplyLanguageSelector.js +5 -5
  14. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +151 -151
  15. package/dist/shared/assistant/ui/composer/AssistantAttachmentButton.d.ts.map +1 -1
  16. package/dist/shared/assistant/ui/composer/AssistantAttachmentButton.js +50 -47
  17. package/dist/shared/assistant/ui/composer/AssistantComposer.js +6 -6
  18. package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.d.ts +7 -0
  19. package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.d.ts.map +1 -0
  20. package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.js +52 -0
  21. package/dist/shared/assistant/ui/composer/AssistantLanguageSelector.js +4 -4
  22. package/dist/shared/assistant/ui/composer/connectSource.d.ts +8 -0
  23. package/dist/shared/assistant/ui/composer/connectSource.d.ts.map +1 -0
  24. package/dist/shared/assistant/ui/composer/connectSource.js +12 -0
  25. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +48 -48
  26. package/dist/shared/assistant/ui/voice/VoiceConversationView.js +8 -8
  27. package/dist/shared/components/assistantWidget/MessageContent.d.ts +11 -3
  28. package/dist/shared/components/assistantWidget/MessageContent.d.ts.map +1 -1
  29. package/dist/shared/components/assistantWidget/MessageContent.js +26 -27
  30. package/dist/shared-assistant.js +95 -93
  31. package/package.json +2 -2
@@ -1,15 +1,15 @@
1
1
  import { useI18n as e } from "../../providers/shell/I18nProvider.js";
2
- import { isVoiceTurn as t } from "../voice/turnVisibility.js";
3
- import { getSpeechEngine as n } from "../speech/createSpeechEngine.js";
4
- import { VOICE_LIST_TIMEOUT_MS as r, languageDisplayName as i, selectVoiceForLocale as a, speechGate as o, speechLangForLocale as s, voiceAvailability as c, voicesForLocale as l } from "../voice/speechVoices.js";
5
- import { chunkForSpeech as ee, toSpeakableText as u } from "../voice/speakableText.js";
2
+ import { useAssistantTr as t } from "../i18n.js";
3
+ import { isVoiceTurn as n } from "../voice/turnVisibility.js";
4
+ import { getSpeechEngine as r } from "../speech/createSpeechEngine.js";
5
+ import { VOICE_LIST_TIMEOUT_MS as i, languageDisplayName as a, selectVoiceForLocale as o, speechGate as s, speechLangForLocale as c, voiceAvailability as ee, voicesForLocale as l } from "../voice/speechVoices.js";
6
+ import { chunkForSpeech as te, toSpeakableText as u } from "../voice/speakableText.js";
6
7
  import { voicePreviewText as d } from "../voice/voicePreview.js";
7
- import { findAssistantLanguage as f } from "../voice/languages.js";
8
- import { resolveLanguagePair as te } from "../voice/languagePair.js";
9
- import { useAssistantTr as ne } from "../i18n.js";
10
- import { speechLabelsFor as re } from "../voice/speechLabels.js";
11
- import { resolveSpeechLocale as ie } from "../voice/replyLanguage.js";
12
- import { IDLE_PLAYBACK as ae, isSpeakingMessage as oe, publishedChunks as se, speechPlaybackReducer as ce } from "../voice/speechPlayback.js";
8
+ import { findAssistantLanguage as ne } from "../voice/languages.js";
9
+ import { resolveLanguagePair as re } from "../voice/languagePair.js";
10
+ import { speechLabelsFor as ie } from "../voice/speechLabels.js";
11
+ import { resolveSpeechLocale as ae } from "../voice/replyLanguage.js";
12
+ import { IDLE_PLAYBACK as oe, isSpeakingMessage as f, publishedChunks as se, speechPlaybackReducer as ce } from "../voice/speechPlayback.js";
13
13
  import { useAssistantStore as p } from "../store.js";
14
14
  import { isTurnInFlight as le } from "../turnState.js";
15
15
  import { parseToolActivity as ue } from "./AssistantToolActivity.js";
@@ -51,33 +51,33 @@ var pe = {
51
51
  function S() {
52
52
  return g(x);
53
53
  }
54
- var C = ({ children: m, visible: g = !0, engine: S = n() }) => {
55
- let C = ne(), { locale: w } = e(), [T, E] = de(ce, ae), [D, O] = b(() => S.listVoices()), [k, he] = b(!1), [ge, A] = b(() => /* @__PURE__ */ new Map()), j = y(0), M = y(null);
54
+ var C = ({ children: m, visible: g = !0, engine: S = r() }) => {
55
+ let C = t(), { locale: w } = e(), [T, E] = de(ce, oe), [D, O] = b(() => S.listVoices()), [k, he] = b(!1), [A, j] = b(() => /* @__PURE__ */ new Map()), M = y(0), N = y(null);
56
56
  _(() => () => {
57
- M.current !== null && clearTimeout(M.current);
57
+ N.current !== null && clearTimeout(N.current);
58
58
  }, []);
59
- let [N, P] = b(null), F = y(null), I = y(() => {}), L = h(() => {
60
- F.current?.(), F.current = null;
61
- }, []), R = p((e) => e.autoSpeakEnabled), z = p((e) => e.setAutoSpeak), [B, _e] = b(!1), V = y(!1), H = h((e) => {
62
- V.current = e;
63
- }, []), ve = p((e) => e.activeConversationId), U = v(() => S.isSupported(), [S]);
59
+ let [P, F] = b(null), I = y(null), L = y(() => {}), R = h(() => {
60
+ I.current?.(), I.current = null;
61
+ }, []), z = p((e) => e.autoSpeakEnabled), B = p((e) => e.setAutoSpeak), [V, ge] = b(!1), H = y(!1), U = h((e) => {
62
+ H.current = e;
63
+ }, []), _e = p((e) => e.activeConversationId), W = v(() => S.isSupported(), [S]);
64
64
  _(() => {
65
- if (!U) return;
65
+ if (!W) return;
66
66
  let e = () => {
67
- O(S.listVoices()), A((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
67
+ O(S.listVoices()), j((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
68
68
  };
69
69
  return e(), S.subscribeVoices(e);
70
- }, [S, U]);
71
- let ye = p((e) => e.assistantLanguage), be = p((e) => e.replyLanguage), W = p((e) => e.preferredVoices), xe = p((e) => e.setPreferredVoice), G = v(() => te(ye, be, w).reply, [
70
+ }, [S, W]);
71
+ let ve = p((e) => e.assistantLanguage), ye = p((e) => e.replyLanguage), G = p((e) => e.preferredVoices), be = p((e) => e.setPreferredVoice), K = v(() => re(ve, ye, w).reply, [
72
+ ve,
72
73
  ye,
73
- be,
74
74
  w
75
- ]), K = G.code, q = h((e) => f(e)?.tag ?? s(e), []), Se = h((e) => f(e)?.rate ?? .9, []), J = v(() => c(U, D, G.tag, k), [
76
- U,
75
+ ]), q = K.code, J = h((e) => ne(e)?.tag ?? c(e), []), xe = h((e) => ne(e)?.rate ?? .9, []), Y = v(() => ee(W, D, K.tag, k), [
76
+ W,
77
77
  D,
78
- G,
78
+ K,
79
79
  k
80
- ]), Y = v(() => ({
80
+ ]), X = v(() => ({
81
81
  codeBlock: C("speech.codeBlock", "Code block"),
82
82
  image: C("speech.image", "image"),
83
83
  link: C("speech.link", "link"),
@@ -86,219 +86,219 @@ var C = ({ children: m, visible: g = !0, engine: S = n() }) => {
86
86
  nestedItem: C("speech.nestedItem", "Sub-item {{ordinal}}"),
87
87
  emailAt: C("speech.emailAt", "at"),
88
88
  emailDot: C("speech.emailDot", "dot")
89
- }), [C]), X = h(() => {
90
- L(), S.cancel(), E({ type: "stop" });
91
- }, [L, S]), Ce = h((e) => {
89
+ }), [C]), Z = h(() => {
90
+ R(), S.cancel(), E({ type: "stop" });
91
+ }, [R, S]), Se = h((e) => {
92
92
  let t = S.listVoices().find((t) => t.name === e) ?? null;
93
- t && (X(), S.speak([d(K)], {
93
+ t && (Z(), S.speak([d(q)], {
94
94
  voice: t,
95
- lang: q(K)
95
+ lang: J(q)
96
96
  }));
97
97
  }, [
98
98
  S,
99
- K,
100
- X,
101
- q
102
- ]), we = h((e) => ge.get(e) ?? null, [ge]), Te = h((e, t, n) => {
103
- L();
104
- let i = !1, a = () => {}, o = (r) => {
105
- if (!i) {
106
- if (i = !0, F.current = null, clearTimeout(s), a(), r.length === 0) {
99
+ q,
100
+ Z,
101
+ J
102
+ ]), Ce = h((e) => A.get(e) ?? null, [A]), we = h((e, t, n) => {
103
+ R();
104
+ let r = !1, a = () => {}, o = (i) => {
105
+ if (!r) {
106
+ if (r = !0, I.current = null, clearTimeout(s), a(), i.length === 0) {
107
107
  he(!0);
108
108
  return;
109
109
  }
110
- O(r), I.current(e, t, r, n);
110
+ O(i), L.current(e, t, i, n);
111
111
  }
112
- }, s = setTimeout(() => o(S.listVoices()), r);
113
- a = S.subscribeVoices(() => o(S.listVoices())), F.current = () => {
114
- i || (i = !0, clearTimeout(s), a(), F.current = null);
112
+ }, s = setTimeout(() => o(S.listVoices()), i);
113
+ a = S.subscribeVoices(() => o(S.listVoices())), I.current = () => {
114
+ r || (r = !0, clearTimeout(s), a(), I.current = null);
115
115
  };
116
- }, [L, S]), Z = h((e, t, n, r) => {
117
- let s = n;
118
- if (s.length === 0) {
116
+ }, [R, S]), Q = h((e, t, n, r) => {
117
+ let i = n;
118
+ if (i.length === 0) {
119
119
  let e = S.listVoices();
120
- e.length > 0 && (s = e, O(e));
120
+ e.length > 0 && (i = e, O(e));
121
121
  }
122
- let l = q(r), u = o(c(!0, s, r, k));
123
- if (u === "block") {
124
- let t = C("speech.noVoiceForReply", "This reply is in {{language}}, and no {{language}} voice is installed on this device.", { language: i(l, w) });
125
- A((n) => new Map(n).set(e, t));
122
+ let c = J(r), l = s(ee(!0, i, r, k));
123
+ if (l === "block") {
124
+ let t = C("speech.noVoiceForReply", "This reply is in {{language}}, and no {{language}} voice is installed on this device.", { language: a(c, w) });
125
+ j((n) => new Map(n).set(e, t));
126
126
  return;
127
127
  }
128
- if (u === "wait-for-voices") {
129
- Te(e, t, r);
128
+ if (l === "wait-for-voices") {
129
+ we(e, t, r);
130
130
  return;
131
131
  }
132
- A((t) => {
132
+ j((t) => {
133
133
  if (!t.has(e)) return t;
134
134
  let n = new Map(t);
135
135
  return n.delete(e), n;
136
136
  });
137
- let d = j.current + 1;
138
- j.current = d, E({
137
+ let u = M.current + 1;
138
+ M.current = u, E({
139
139
  type: "start",
140
140
  messageId: e,
141
- requestId: d
141
+ requestId: u
142
142
  });
143
- let f = ee(t);
144
- P({
145
- requestId: d,
146
- chunks: f,
143
+ let d = te(t);
144
+ F({
145
+ requestId: u,
146
+ chunks: d,
147
147
  index: -1
148
- }), M.current !== null && clearTimeout(M.current), M.current = setTimeout(() => {
149
- P((e) => e?.requestId === d && e.index < 0 ? null : e);
150
- }, me), S.speak(f, {
151
- voice: a(s, l, W[r]),
152
- lang: l,
153
- rate: Se(r)
148
+ }), N.current !== null && clearTimeout(N.current), N.current = setTimeout(() => {
149
+ F((e) => e?.requestId === u && e.index < 0 ? null : e);
150
+ }, me), S.speak(d, {
151
+ voice: o(i, c, G[r]),
152
+ lang: c,
153
+ rate: xe(r)
154
154
  }, {
155
155
  onChunkStart: (e) => {
156
- j.current === d && M.current !== null && (clearTimeout(M.current), M.current = null), P((t) => t?.requestId === d ? {
156
+ M.current === u && N.current !== null && (clearTimeout(N.current), N.current = null), F((t) => t?.requestId === u ? {
157
157
  ...t,
158
158
  index: e
159
- } : j.current === d ? {
160
- requestId: d,
161
- chunks: f,
159
+ } : M.current === u ? {
160
+ requestId: u,
161
+ chunks: d,
162
162
  index: e
163
163
  } : t);
164
164
  },
165
165
  onEnd: () => E({
166
166
  type: "finished",
167
- requestId: d
167
+ requestId: u
168
168
  }),
169
169
  onError: () => E({
170
170
  type: "failed",
171
- requestId: d
171
+ requestId: u
172
172
  })
173
173
  });
174
174
  }, [
175
175
  S,
176
176
  w,
177
- W,
178
- Se,
179
- q,
177
+ G,
178
+ xe,
179
+ J,
180
180
  C,
181
181
  k,
182
- Te
182
+ we
183
183
  ]);
184
184
  _(() => {
185
- I.current = Z;
186
- }, [Z]);
187
- let Q = h((e, t, n) => {
188
- if (!U) return;
189
- let r = ie(u(t, { labels: pe }), n ?? K), i = u(t, { labels: re(r, Y) });
190
- i && Z(e, i, D, r);
185
+ L.current = Q;
186
+ }, [Q]);
187
+ let $ = h((e, t, n) => {
188
+ if (!W) return;
189
+ let r = ae(u(t, { labels: pe }), n ?? q), i = u(t, { labels: ie(r, X) });
190
+ i && Q(e, i, D, r);
191
191
  }, [
192
- U,
193
- Y,
194
- K,
195
- Z,
192
+ W,
193
+ X,
194
+ q,
195
+ Q,
196
196
  D
197
- ]), Ee = h((e, t, n) => {
198
- if (oe(T, e)) {
199
- X();
197
+ ]), Te = h((e, t, n) => {
198
+ if (f(T, e)) {
199
+ Z();
200
200
  return;
201
201
  }
202
- Q(e, t, n);
202
+ $(e, t, n);
203
203
  }, [
204
204
  T,
205
- Q,
206
- X
205
+ $,
206
+ Z
207
207
  ]);
208
208
  _(() => {
209
- g || X();
210
- }, [g, X]), _(() => {
211
- X(), A(/* @__PURE__ */ new Map());
212
- }, [ve, X]), _(() => {
213
- A((e) => e.size === 0 ? e : /* @__PURE__ */ new Map()), X();
214
- }, [K, X]), _(() => () => {
215
- F.current?.(), F.current = null, S.cancel();
209
+ g || Z();
210
+ }, [g, Z]), _(() => {
211
+ Z(), j(/* @__PURE__ */ new Map());
212
+ }, [_e, Z]), _(() => {
213
+ j((e) => e.size === 0 ? e : /* @__PURE__ */ new Map()), Z();
214
+ }, [q, Z]), _(() => () => {
215
+ I.current?.(), I.current = null, S.cancel();
216
216
  }, [S]), _(() => {
217
217
  if (typeof window > "u") return;
218
218
  let e = () => S.cancel();
219
219
  return window.addEventListener("pagehide", e), () => window.removeEventListener("pagehide", e);
220
220
  }, [S]), _(() => {
221
- if (typeof document > "u" || !U) return;
221
+ if (typeof document > "u" || !W) return;
222
222
  let e = () => {
223
223
  if (document.visibilityState !== "visible") return;
224
224
  let e = S.listVoices();
225
- e.length > 0 && L(), O(e), he(!1), A((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
225
+ e.length > 0 && R(), O(e), he(!1), j((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
226
226
  };
227
227
  return document.addEventListener("visibilitychange", e), window.addEventListener("focus", e), () => {
228
228
  document.removeEventListener("visibilitychange", e), window.removeEventListener("focus", e);
229
229
  };
230
230
  }, [
231
- L,
231
+ R,
232
232
  S,
233
- U
233
+ W
234
234
  ]);
235
- let De = y(Q);
235
+ let Ee = y($);
236
236
  _(() => {
237
- De.current = Q;
238
- }, [Q]), _(() => {
239
- if (!(!R && !B || !g || !U)) return p.subscribe((e, n) => {
237
+ Ee.current = $;
238
+ }, [$]), _(() => {
239
+ if (!(!z && !V || !g || !W)) return p.subscribe((e, t) => {
240
240
  let r = e.activeConversationId;
241
- if (!r || r !== n.activeConversationId) return;
242
- let i = e.processingByConversationId[r], a = n.processingByConversationId[r];
241
+ if (!r || r !== t.activeConversationId) return;
242
+ let i = e.processingByConversationId[r], a = t.processingByConversationId[r];
243
243
  if (i?.status !== "complete" || !le(a?.status)) return;
244
244
  let o = i.messageId ?? a?.messageId ?? null;
245
245
  if (!o) return;
246
246
  let s = e.conversations.find((e) => e.id === r)?.messages.find((e) => e.id === o);
247
- if (!s || s.role !== "assistant" || t(s) !== B || V.current) return;
247
+ if (!s || s.role !== "assistant" || n(s) !== V || H.current) return;
248
248
  let { text: c } = ue(s.content);
249
- c.trim() && De.current(o, c, s.metadata?.lang);
249
+ c.trim() && Ee.current(o, c, s.metadata?.lang);
250
250
  });
251
251
  }, [
252
- R,
253
- B,
254
- U,
252
+ z,
253
+ V,
254
+ W,
255
255
  g
256
256
  ]);
257
- let Oe = v(() => l(D, G.tag), [D, G]), $ = v(() => a(D, G.tag, W[K]), [
257
+ let De = v(() => l(D, K.tag), [D, K]), Oe = v(() => o(D, K.tag, G[q]), [
258
258
  D,
259
+ K,
259
260
  G,
260
- W,
261
- K
261
+ q
262
262
  ]), ke = v(() => ({
263
- isSupported: U,
264
- availability: J,
265
- isBlocked: J === "no-voices",
266
- disabledReason: J === "no-voices" ? C("speech.noVoicesOnDevice", "This device has no speech voices installed. Add one in your device speech or accessibility settings.") : null,
267
- blockedFor: we,
268
- voiceChoices: Oe,
269
- spokenChunks: se(T, N),
270
- activeVoiceName: $?.name ?? null,
271
- preferredVoiceName: W[K] ?? null,
272
- setVoice: (e) => xe(K, e),
263
+ isSupported: W,
264
+ availability: Y,
265
+ isBlocked: Y === "no-voices",
266
+ disabledReason: Y === "no-voices" ? C("speech.noVoicesOnDevice", "This device has no speech voices installed. Add one in your device speech or accessibility settings.") : null,
267
+ blockedFor: Ce,
268
+ voiceChoices: De,
269
+ spokenChunks: se(T, P),
270
+ activeVoiceName: Oe?.name ?? null,
271
+ preferredVoiceName: G[q] ?? null,
272
+ setVoice: (e) => be(q, e),
273
273
  speakingMessageId: T.status === "speaking" ? T.messageId : null,
274
- isSpeaking: (e) => oe(T, e),
275
- toggle: Ee,
276
- stop: X,
277
- autoSpeakEnabled: R,
278
- setAutoSpeak: z,
279
- sessionSpeaking: B,
280
- setSessionSpeaking: _e,
281
- setSessionMicOpen: H,
282
- previewVoice: Ce
274
+ isSpeaking: (e) => f(T, e),
275
+ toggle: Te,
276
+ stop: Z,
277
+ autoSpeakEnabled: z,
278
+ setAutoSpeak: B,
279
+ sessionSpeaking: V,
280
+ setSessionSpeaking: ge,
281
+ setSessionMicOpen: U,
282
+ previewVoice: Se
283
283
  }), [
284
- U,
285
- J,
286
- we,
287
- Oe,
288
- $,
289
284
  W,
290
- xe,
291
- K,
285
+ Y,
286
+ Ce,
287
+ De,
288
+ Oe,
289
+ G,
290
+ be,
291
+ q,
292
292
  T,
293
- Ee,
294
- X,
295
- R,
293
+ Te,
294
+ Z,
296
295
  z,
297
296
  B,
298
- H,
299
- Ce,
297
+ V,
298
+ U,
299
+ Se,
300
300
  C,
301
- N
301
+ P
302
302
  ]);
303
303
  return /* @__PURE__ */ fe(x.Provider, {
304
304
  value: ke,
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantAttachmentButton.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/AssistantAttachmentButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAWf,UAAU,KAAK;IACb,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC1B,wEAAwE;IACxE,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AASD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,KAAK,CA4I/C,CAAC"}
1
+ {"version":3,"file":"AssistantAttachmentButton.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/AssistantAttachmentButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAaf,UAAU,KAAK;IACb,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC1B,wEAAwE;IACxE,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AASD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,KAAK,CA4J/C,CAAC"}
@@ -1,86 +1,89 @@
1
1
  import { useAssistantTr as e } from "../../i18n.js";
2
2
  import "../../attachments.js";
3
3
  import { availableAttachmentSources as t, deviceHasCamera as n } from "../../attachmentSources.js";
4
- import { useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
5
- import { Camera as c, FileText as l, FolderOpen as u, ImageIcon as d, Plus as f } from "lucide-react";
6
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
4
+ import { useAssistantConnectSource as r } from "./connectSource.js";
5
+ import { AssistantConnectSourceItem as i } from "./AssistantConnectSourceItem.js";
6
+ import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
7
+ import { Camera as u, FileText as d, FolderOpen as f, ImageIcon as p, Plus as m } from "lucide-react";
8
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
7
9
  //#region src/shared/assistant/ui/composer/AssistantAttachmentButton.tsx
8
- var h = {
9
- camera: c,
10
- gallery: d,
11
- documents: l,
12
- files: u
13
- }, g = ({ onFiles: c, onPickerOpen: l, direction: u = "up", canAddMore: d, disabled: g = !1 }) => {
14
- let _ = e(), v = o(null), y = o(null), b = o(null), [x, S] = s(!1), C = o(l);
15
- C.current = l;
16
- let w = a(() => t(n()), []), T = d ? _("composer.attach", "Attach files or photos") : _("composer.attachFull", "Attachment limit reached ({{max}})", { max: 5 });
17
- i(() => {
18
- if (!x) return;
10
+ var _ = {
11
+ camera: u,
12
+ gallery: p,
13
+ documents: d,
14
+ files: f
15
+ }, v = ({ onFiles: u, onPickerOpen: d, direction: f = "up", canAddMore: p, disabled: v = !1 }) => {
16
+ let y = e(), b = c(null), x = c(null), S = c(null), [C, w] = l(!1), T = c(d);
17
+ T.current = d;
18
+ let E = s(() => t(n()), []), D = r(), O = p || !!D, k = p ? y("composer.attach", "Attach files or photos") : y("composer.attachFull", "Attachment limit reached ({{max}})", { max: 5 });
19
+ o(() => {
20
+ if (!C) return;
19
21
  let e = (e) => {
20
- e.key === "Escape" && (S(!1), b.current?.focus());
22
+ e.key === "Escape" && (w(!1), S.current?.focus());
21
23
  }, t = (e) => {
22
24
  let t = e.target;
23
- y.current?.contains(t) || b.current?.contains(t) || S(!1);
25
+ x.current?.contains(t) || S.current?.contains(t) || w(!1);
24
26
  };
25
27
  return window.addEventListener("keydown", e), window.addEventListener("mousedown", t), () => {
26
28
  window.removeEventListener("keydown", e), window.removeEventListener("mousedown", t);
27
29
  };
28
- }, [x]);
29
- let E = r((e) => {
30
- c(e.target.files), e.target.value = "";
31
- }, [c]), D = r((e) => {
32
- let t = v.current;
33
- t && (t.accept = e.accept, t.multiple = e.multiple, e.capture ? t.setAttribute("capture", e.capture) : t.removeAttribute("capture"), S(!1), C.current?.(), t.click());
30
+ }, [C]);
31
+ let A = a((e) => {
32
+ u(e.target.files), e.target.value = "";
33
+ }, [u]), j = a((e) => {
34
+ let t = b.current;
35
+ t && (t.accept = e.accept, t.multiple = e.multiple, e.capture ? t.setAttribute("capture", e.capture) : t.removeAttribute("capture"), w(!1), T.current?.(), t.click());
34
36
  }, []);
35
- return /* @__PURE__ */ m("div", {
37
+ return /* @__PURE__ */ g("div", {
36
38
  className: "relative flex-shrink-0",
37
39
  children: [
38
- /* @__PURE__ */ p("input", {
39
- ref: v,
40
+ /* @__PURE__ */ h("input", {
41
+ ref: b,
40
42
  type: "file",
41
43
  multiple: !0,
42
44
  className: "hidden",
43
- onChange: E,
45
+ onChange: A,
44
46
  tabIndex: -1,
45
47
  "aria-hidden": "true",
46
48
  "data-testid": "assistant-attach-input"
47
49
  }),
48
- /* @__PURE__ */ p("button", {
49
- ref: b,
50
+ /* @__PURE__ */ h("button", {
51
+ ref: S,
50
52
  type: "button",
51
- onClick: () => S((e) => !e),
52
- disabled: g || !d,
53
- title: T,
54
- "aria-label": T,
53
+ onClick: () => w((e) => !e),
54
+ disabled: v || !O,
55
+ title: k,
56
+ "aria-label": k,
55
57
  "aria-haspopup": "menu",
56
- "aria-expanded": x,
58
+ "aria-expanded": C,
57
59
  className: "flex size-9 items-center justify-center rounded-full border border-border-subtle bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-bg-elevated",
58
60
  "data-testid": "assistant-attach",
59
- children: /* @__PURE__ */ p(f, { className: "size-4" })
61
+ children: /* @__PURE__ */ h(m, { className: "size-4" })
60
62
  }),
61
- x ? /* @__PURE__ */ p("div", {
62
- ref: y,
63
+ C ? /* @__PURE__ */ g("div", {
64
+ ref: x,
63
65
  role: "menu",
64
- "aria-label": _("composer.attachSource", "Attach from"),
65
- className: `absolute ${u === "up" ? "bottom-full mb-2" : "top-full mt-2"} left-0 z-30 min-w-44 overflow-hidden rounded-xl border border-border-default bg-bg-elevated py-1 shadow-lg`,
66
+ "aria-label": y("composer.attachSource", "Attach from"),
67
+ className: `absolute ${f === "up" ? "bottom-full mb-2" : "top-full mt-2"} left-0 z-30 min-w-44 overflow-hidden rounded-xl border border-border-default bg-bg-elevated py-1 shadow-lg`,
66
68
  "data-testid": "assistant-attach-menu",
67
- children: w.map((e) => {
68
- let t = h[e.id];
69
- return /* @__PURE__ */ m("button", {
69
+ children: [E.map((e) => {
70
+ let t = _[e.id];
71
+ return /* @__PURE__ */ g("button", {
70
72
  type: "button",
71
73
  role: "menuitem",
72
- onClick: () => D(e),
73
- className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken",
74
+ disabled: !p,
75
+ onClick: () => j(e),
76
+ className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-transparent",
74
77
  "data-testid": `assistant-attach-source-${e.id}`,
75
- children: [/* @__PURE__ */ p(t, {
78
+ children: [/* @__PURE__ */ h(t, {
76
79
  className: "size-4 flex-shrink-0 text-text-secondary",
77
80
  "aria-hidden": "true"
78
- }), _(e.labelKey, e.labelFallback)]
81
+ }), y(e.labelKey, e.labelFallback)]
79
82
  }, e.id);
80
- })
83
+ }), /* @__PURE__ */ h(i, { onActivate: () => w(!1) })]
81
84
  }) : null
82
85
  ]
83
86
  });
84
87
  };
85
88
  //#endregion
86
- export { g as AssistantAttachmentButton };
89
+ export { v as AssistantAttachmentButton };
@@ -1,8 +1,8 @@
1
1
  import { useI18n as e } from "../../../providers/shell/I18nProvider.js";
2
2
  import { useVoiceInput as t } from "../../voice/useVoiceInput.js";
3
- import { languageDisplayName as ee } from "../../voice/speechVoices.js";
4
- import { resolveAssistantLanguage as n } from "../../voice/languages.js";
5
- import { useAssistantTr as r } from "../../i18n.js";
3
+ import { useAssistantTr as ee } from "../../i18n.js";
4
+ import { languageDisplayName as n } from "../../voice/speechVoices.js";
5
+ import { resolveAssistantLanguage as r } from "../../voice/languages.js";
6
6
  import { getSendableAttachments as i } from "../../attachments.js";
7
7
  import { useAssistantStore as a } from "../../store.js";
8
8
  import { AssistantAttachmentButton as o } from "./AssistantAttachmentButton.js";
@@ -16,11 +16,11 @@ import { ArrowUp as p, Loader2 as m } from "lucide-react";
16
16
  import { jsx as h, jsxs as g } from "react/jsx-runtime";
17
17
  //#region src/shared/assistant/ui/composer/AssistantComposer.tsx
18
18
  var _ = 200, v = ({ writeAccessDenied: v = !1, onSend: y, disabled: b = !1, placeholder: x, mode: S, availableModes: C, onModeChange: ae, onStartVoiceSession: w }) => {
19
- let T = r(), { locale: E } = e(), D = d(null), [O, k] = f(""), [A, j] = f(!1), M = d(0), { attachments: N, isBusy: P, preparingCount: F, sendBlocker: I, rejection: L, addFiles: R, remove: z, retry: B, clear: V, clearRejection: H, canAddMore: U } = re(), oe = l((e) => {
19
+ let T = ee(), { locale: E } = e(), D = d(null), [O, k] = f(""), [A, j] = f(!1), M = d(0), { attachments: N, isBusy: P, preparingCount: F, sendBlocker: I, rejection: L, addFiles: R, remove: z, retry: B, clear: V, clearRejection: H, canAddMore: U } = re(), oe = l((e) => {
20
20
  k((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
21
21
  }, []), W = a((e) => e.assistantLanguage), G = t({
22
22
  onFinalize: oe,
23
- language: u(() => n(W, E), [W, E]).tag
23
+ language: u(() => r(W, E), [W, E]).tag
24
24
  }), K = x ?? T("composer.placeholder", "Ask me anything…"), q = O.trim(), J = i(N), Y = N.filter((e) => e.status === "error"), X = (q.length > 0 || J.length > 0) && !b && I === null;
25
25
  ie(() => {
26
26
  let e = D.current;
@@ -61,7 +61,7 @@ var _ = 200, v = ({ writeAccessDenied: v = !1, onSend: y, disabled: b = !1, plac
61
61
  case "not-allowed": return T("voice.denied", "Microphone access is blocked. Allow it in your browser settings to dictate.");
62
62
  case "audio-capture": return T("voice.noMic", "No microphone was found.");
63
63
  case "network": return T("voice.network", "Speech recognition is offline right now.");
64
- case "language-not-supported": return T("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: ee(G.language, E) });
64
+ case "language-not-supported": return T("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: n(G.language, E) });
65
65
  case "unknown": return T("voice.failed", "Dictation stopped unexpectedly.");
66
66
  default: return null;
67
67
  }
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ export interface AssistantConnectSourceItemProps {
3
+ /** Close the surrounding menu. Fired only when this item actually acts. */
4
+ onActivate?: () => void;
5
+ }
6
+ export declare const AssistantConnectSourceItem: FC<AssistantConnectSourceItemProps>;
7
+ //# sourceMappingURL=AssistantConnectSourceItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssistantConnectSourceItem.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/AssistantConnectSourceItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAe,KAAK,EAAE,EAAmB,MAAM,OAAO,CAAC;AAuC9D,MAAM,WAAW,+BAA+B;IAC9C,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,0BAA0B,EAAE,EAAE,CAAC,+BAA+B,CAwD1E,CAAC"}