@burdenoff/fe-libs 2026.1114.13 → 2026.1114.15
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/conversation.d.ts +16 -0
- package/dist/shared/assistant/i18nManifest.d.ts +30 -0
- package/dist/shared/assistant/i18nManifest.js +30 -0
- package/dist/shared/assistant/index.d.ts +6 -0
- package/dist/shared/assistant/store.d.ts +7 -0
- package/dist/shared/assistant/store.js +3 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +1269 -1188
- package/dist/shared/assistant/ui/AssistantMessageList.d.ts +14 -0
- package/dist/shared/assistant/ui/AssistantMessageList.js +55 -52
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +348 -362
- package/dist/shared/assistant/ui/composer/AssistantDictation.d.ts +42 -0
- package/dist/shared/assistant/ui/composer/AssistantDictation.js +127 -0
- package/dist/shared/assistant/ui/composer/AssistantMicMenu.d.ts +23 -0
- package/dist/shared/assistant/ui/composer/AssistantMicMenu.js +176 -0
- package/dist/shared/assistant/ui/composer/microphones.d.ts +13 -0
- package/dist/shared/assistant/ui/composer/microphones.js +15 -0
- package/dist/shared/assistant/ui/composer/useCompactDictation.d.ts +70 -0
- package/dist/shared/assistant/ui/composer/useCompactDictation.js +136 -0
- package/dist/shared/assistant/ui/useVoiceSession.js +166 -164
- package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.d.ts +20 -17
- package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.js +230 -123
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +2 -0
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +227 -229
- package/dist/shared/assistant/ui/voice/LiveWaveform.d.ts +4 -3
- package/dist/shared/assistant/ui/voice/LiveWaveform.js +1 -1
- package/dist/shared/assistant/ui/voice/VoiceTurnMarks.d.ts +15 -0
- package/dist/shared/assistant/ui/voice/VoiceTurnMarks.js +43 -0
- package/dist/shared/assistant/ui/voice/formatClock.d.ts +2 -0
- package/dist/shared/assistant/ui/voice/formatClock.js +3 -0
- package/dist/shared/assistant/ui/voice/useLiveLevel.d.ts +3 -1
- package/dist/shared/assistant/ui/voice/useLiveLevel.js +23 -19
- package/dist/shared/assistant/voice/liveLevel.d.ts +4 -3
- package/dist/shared/assistant/voice/liveLevel.js +18 -15
- package/dist/shared/assistant/voice/useVoiceInput.d.ts +27 -1
- package/dist/shared/assistant/voice/useVoiceInput.js +141 -71
- package/dist/shared-assistant.js +383 -377
- package/package.json +1 -1
|
@@ -3,28 +3,29 @@ import { EscapeLayer as t } from "../../../components/EscapeLayer.js";
|
|
|
3
3
|
import { useI18n as n } from "../../../providers/shell/I18nProvider.js";
|
|
4
4
|
import { useAssistantTr as r } from "../../i18n.js";
|
|
5
5
|
import { languageDisplayName as i } from "../../voice/speechVoices.js";
|
|
6
|
-
import { resolveAssistantLanguage as
|
|
7
|
-
import { useAssistantStore as
|
|
8
|
-
import { useVoiceInput as
|
|
9
|
-
import { useAssistantAttachments as
|
|
10
|
-
import { getSendableAttachments as
|
|
11
|
-
import { ATTACHMENT_COMMIT_CODES as
|
|
12
|
-
import { AssistantAttachmentButton as
|
|
13
|
-
import { AssistantAttachmentChips as
|
|
14
|
-
import { AssistantFocusChip as
|
|
15
|
-
import { useAskAboutStore as
|
|
16
|
-
import { AssistantVoiceButton as
|
|
17
|
-
import { AssistantVoiceSessionButton as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
6
|
+
import { resolveAssistantLanguage as a } from "../../voice/languages.js";
|
|
7
|
+
import { useAssistantStore as o } from "../../store.js";
|
|
8
|
+
import { useVoiceInput as s } from "../../voice/useVoiceInput.js";
|
|
9
|
+
import { useAssistantAttachments as ee } from "../../useAssistantAttachments.js";
|
|
10
|
+
import { getSendableAttachments as te } from "../../attachments.js";
|
|
11
|
+
import { ATTACHMENT_COMMIT_CODES as ne } from "../../attachmentCommit.js";
|
|
12
|
+
import { AssistantAttachmentButton as re } from "./AssistantAttachmentButton.js";
|
|
13
|
+
import { AssistantAttachmentChips as ie } from "./AssistantAttachmentChips.js";
|
|
14
|
+
import { AssistantFocusChip as ae } from "./AssistantFocusChip.js";
|
|
15
|
+
import { useAskAboutStore as oe } from "../../askAbout/askAboutStore.js";
|
|
16
|
+
import { AssistantVoiceButton as se, ListeningDot as ce } from "./AssistantVoiceButton.js";
|
|
17
|
+
import { AssistantVoiceSessionButton as le } from "../voice/AssistantVoiceSessionButton.js";
|
|
18
|
+
import { useCompactDictation as ue } from "./useCompactDictation.js";
|
|
19
|
+
import { DictationControls as de, DictationLiveText as fe, MicBlockedNotice as pe } from "./AssistantDictation.js";
|
|
20
|
+
import { AssistantMicMenu as me, useMicSummary as he } from "./AssistantMicMenu.js";
|
|
21
|
+
import { AssistantModeSelector as ge } from "./AssistantModeSelector.js";
|
|
22
|
+
import { AssistantModeMenu as _e } from "./AssistantModeMenu.js";
|
|
23
|
+
import { AssistantViewSwitchRow as ve } from "../compact/AssistantViewSwitchRow.js";
|
|
24
|
+
import { compactEnterSends as ye, isImeComposingEnter as be } from "./imeEnter.js";
|
|
25
|
+
import { PAGE_COLUMN as xe, useAssistantPageLayout as Se } from "../assistantPageLayout.js";
|
|
26
|
+
import { useCallback as c, useEffect as l, useId as u, useLayoutEffect as Ce, useMemo as we, useRef as d, useState as f } from "react";
|
|
27
|
+
import { ArrowUp as Te, Loader2 as p, Square as Ee } from "lucide-react";
|
|
28
|
+
import { Fragment as De, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
28
29
|
// src/shared/assistant/ui/composer/AssistantComposer.tsx
|
|
29
30
|
var Oe = 200;
|
|
30
31
|
function ke(e) {
|
|
@@ -32,115 +33,108 @@ function ke(e) {
|
|
|
32
33
|
let t = e.ownerDocument.activeElement;
|
|
33
34
|
return !t || t === e.ownerDocument.body ? !1 : e.contains(t) ? !0 : e.closest("[data-assistant-panel]")?.contains(t) ?? !1;
|
|
34
35
|
}
|
|
35
|
-
var Ae = ({ children: e }) => e(
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
}, [
|
|
39
|
-
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, [
|
|
44
|
-
|
|
45
|
-
text:
|
|
46
|
-
hasAttachments:
|
|
47
|
-
dictated:
|
|
36
|
+
var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend: g, disabled: je = !1, readOnly: Me = !1, placeholder: Ne, mode: Pe, availableModes: _, attachmentCharsPerFile: Fe, onModeChange: Ie, auto: Le, onStartVoiceSession: v, onDraftStart: Re, onDraftChange: ze, suspendDictation: Be = !1, onVoiceStateChange: Ve, presentation: He = "classic", turnInFlight: y = !1, onStop: Ue, turnId: We, modeDisabledReason: Ge = null, inputRef: b, aboveCard: Ke, viewSwitch: qe, modeReadOnly: Je = !1, voiceSessionActive: x = !1, concealed: Ye = !1 }) => {
|
|
37
|
+
let S = r(), C = Se(), { locale: w } = n(), T = je || Me, E = He === "compact", D = d(null), Xe = c((e) => {
|
|
38
|
+
D.current = e, typeof b == "function" ? b(e) : b && (b.current = e);
|
|
39
|
+
}, [b]), [O, k] = f(""), [A, Ze] = f(!1), [j, Qe] = f(!1), $e = d(!1), [M, N] = f(null), [et, P] = f(null), [F, I] = f(null), [tt, nt] = f(y);
|
|
40
|
+
tt === y ? F !== null && y && We != null && We !== F && I(null) : (nt(y), y ? (P(null), I(null)) : F !== null && (P(F), I(null)));
|
|
41
|
+
let rt = d(!1), it = d(null), at = d(!1), ot = d(!1), st = d(null), ct = d(!1), L = d(0), { attachments: R, isBusy: lt, preparingCount: ut, sendBlocker: dt, rejection: ft, addFiles: z, remove: pt, retry: mt, clear: ht, clearRejection: gt, canAddMore: _t, commit: vt, cancelCommit: yt } = ee({ perFileChars: Fe }), B = O.trim() !== "" || R.length > 0, bt = d(!1), V = d(!1);
|
|
42
|
+
l(() => {
|
|
43
|
+
B && !bt.current ? (bt.current = !0, Re?.()) : B || (bt.current = !1);
|
|
44
|
+
}, [B, Re]), l(() => {
|
|
45
|
+
B || (V.current = !1), ze?.({
|
|
46
|
+
text: O,
|
|
47
|
+
hasAttachments: R.length > 0,
|
|
48
|
+
dictated: V.current
|
|
48
49
|
});
|
|
49
50
|
}, [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
O,
|
|
52
|
+
R.length,
|
|
53
|
+
B,
|
|
53
54
|
ze
|
|
54
55
|
]);
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
}, []), xt =
|
|
58
|
-
onFinalize:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
let H = c((e) => {
|
|
57
|
+
V.current = !0, k((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
|
|
58
|
+
}, []), xt = o((e) => e.assistantLanguage), St = we(() => a(xt, w), [xt, w]), Ct = d(H), wt = d(() => void 0), Tt = o((e) => e.micDeviceId), U = s({
|
|
59
|
+
onFinalize: (e) => Ct.current(e),
|
|
60
|
+
onEnded: () => wt.current(),
|
|
61
|
+
language: St.tag,
|
|
62
|
+
deviceId: Tt
|
|
63
|
+
}), Et = c(() => {
|
|
64
|
+
V.current = !0;
|
|
65
|
+
}, []), W = ue({
|
|
66
|
+
enabled: E,
|
|
67
|
+
voice: U,
|
|
68
|
+
text: O,
|
|
69
|
+
setText: k,
|
|
70
|
+
textareaRef: D,
|
|
71
|
+
markDictated: Et,
|
|
72
|
+
deviceId: Tt
|
|
73
|
+
}), Dt = W.addFinal, Ot = he();
|
|
74
|
+
l(() => {
|
|
75
|
+
Ct.current = E ? Dt : H;
|
|
76
|
+
}, [
|
|
77
|
+
E,
|
|
78
|
+
Dt,
|
|
79
|
+
H
|
|
80
|
+
]);
|
|
81
|
+
let kt = W.recogniserEnded;
|
|
82
|
+
l(() => {
|
|
83
|
+
wt.current = E ? kt : () => void 0;
|
|
84
|
+
}, [E, kt]);
|
|
85
|
+
let G = U.isActive, At = U.interim, jt = U.stop, Mt = W.keepAndStop;
|
|
86
|
+
l(() => {
|
|
87
|
+
Be && G && (E ? Mt() : (At.trim() !== "" && H(At.trim()), jt()));
|
|
63
88
|
}, [
|
|
64
89
|
Be,
|
|
90
|
+
G,
|
|
91
|
+
At,
|
|
92
|
+
jt,
|
|
65
93
|
H,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
]), s(() => {
|
|
94
|
+
E,
|
|
95
|
+
Mt
|
|
96
|
+
]), l(() => {
|
|
70
97
|
Ve?.({
|
|
71
|
-
committing:
|
|
72
|
-
dictating:
|
|
98
|
+
committing: j,
|
|
99
|
+
dictating: G
|
|
73
100
|
});
|
|
74
101
|
}, [
|
|
75
102
|
Ve,
|
|
76
|
-
|
|
77
|
-
|
|
103
|
+
j,
|
|
104
|
+
G
|
|
78
105
|
]);
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
dictated: z.current
|
|
83
|
-
}, V.start();
|
|
84
|
-
}, [T, V]), W = o(() => {
|
|
85
|
-
w.current?.focus();
|
|
86
|
-
}, []), Et = o(() => {
|
|
87
|
-
let e = V.interim.trim();
|
|
88
|
-
e !== "" && B(e), V.stop(), U.current = null, W();
|
|
89
|
-
}, [
|
|
90
|
-
V,
|
|
91
|
-
B,
|
|
92
|
-
W
|
|
93
|
-
]), Dt = o(() => {
|
|
94
|
-
let e = U.current;
|
|
95
|
-
V.stop(), U.current = null, e && (E(e.text), z.current = e.dictated), W();
|
|
96
|
-
}, [V, W]);
|
|
97
|
-
s(() => {
|
|
98
|
-
H || (U.current = null);
|
|
99
|
-
}, [H]);
|
|
100
|
-
let [Ot, kt] = u(0), G = V.isListening, [At, jt] = u(G);
|
|
101
|
-
At !== G && (jt(G), kt(0)), s(() => {
|
|
102
|
-
if (!G) return;
|
|
103
|
-
let e = Date.now(), t = setInterval(() => {
|
|
104
|
-
kt(Math.floor((Date.now() - e) / 1e3));
|
|
105
|
-
}, 1e3);
|
|
106
|
-
return () => clearInterval(t);
|
|
107
|
-
}, [G]);
|
|
108
|
-
let Mt = pe({
|
|
109
|
-
active: C && G,
|
|
110
|
-
mic: !0,
|
|
111
|
-
pulseKey: V.interim
|
|
112
|
-
}), Nt = a((e) => e.pending), Pt = Nt ? b("askAbout.placeholder", "Ask about {{name}}…", { name: Nt.label }) : Ne ?? b("composer.placeholder", "Ask me anything…"), Ft = a((e) => e.focusRequested), It = (e) => {
|
|
113
|
-
E(e), requestAnimationFrame(() => {
|
|
114
|
-
let t = w.current;
|
|
106
|
+
let Nt = oe((e) => e.pending), Pt = Nt ? S("askAbout.placeholder", "Ask about {{name}}…", { name: Nt.label }) : Ne ?? S("composer.placeholder", "Ask me anything…"), Ft = oe((e) => e.focusRequested), It = (e) => {
|
|
107
|
+
k(e), requestAnimationFrame(() => {
|
|
108
|
+
let t = D.current;
|
|
115
109
|
t && (t.focus({ preventScroll: !0 }), t.setSelectionRange(e.length, e.length));
|
|
116
110
|
});
|
|
117
111
|
};
|
|
118
|
-
|
|
119
|
-
if (!Ft ||
|
|
120
|
-
let e =
|
|
121
|
-
e && (e.focus({ preventScroll: !0 }),
|
|
122
|
-
}, [Ft,
|
|
123
|
-
let K =
|
|
124
|
-
zt.current =
|
|
125
|
-
let Y =
|
|
126
|
-
|
|
112
|
+
l(() => {
|
|
113
|
+
if (!Ft || T) return;
|
|
114
|
+
let e = D.current;
|
|
115
|
+
e && (e.focus({ preventScroll: !0 }), oe.getState().actions.composerFocused());
|
|
116
|
+
}, [Ft, T]);
|
|
117
|
+
let K = O.trim(), q = te(R), Lt = R.filter((e) => e.status === "error"), J = (K.length > 0 || q.length > 0) && !T && !j && dt === null, Rt = q.some((e) => !(e.fileId && e.downloadUrl) && !e.inlineOnly), zt = d(T);
|
|
118
|
+
zt.current = T;
|
|
119
|
+
let Y = d(!0);
|
|
120
|
+
l(() => (Y.current = !0, () => {
|
|
127
121
|
Y.current = !1;
|
|
128
|
-
}), []),
|
|
129
|
-
let e =
|
|
122
|
+
}), []), Ce(() => {
|
|
123
|
+
let e = D.current;
|
|
130
124
|
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, Oe)}px`);
|
|
131
|
-
}, [
|
|
132
|
-
let X =
|
|
133
|
-
if (!J ||
|
|
134
|
-
|
|
135
|
-
let e =
|
|
136
|
-
|
|
137
|
-
let t =
|
|
125
|
+
}, [O]);
|
|
126
|
+
let X = c(async () => {
|
|
127
|
+
if (!J || $e.current) return;
|
|
128
|
+
U.isActive && U.stop();
|
|
129
|
+
let e = O.trim();
|
|
130
|
+
N(null);
|
|
131
|
+
let t = E && ke(st.current);
|
|
138
132
|
if (!Rt) {
|
|
139
|
-
|
|
133
|
+
ct.current = t, g(e, q), k(""), ht();
|
|
140
134
|
return;
|
|
141
135
|
}
|
|
142
|
-
let n =
|
|
143
|
-
|
|
136
|
+
let n = o.getState().activeConversationId;
|
|
137
|
+
$e.current = !0, Qe(!0);
|
|
144
138
|
try {
|
|
145
139
|
let r = await vt();
|
|
146
140
|
if (!Y.current) {
|
|
@@ -148,373 +142,365 @@ var Ae = ({ children: e }) => e(c()), m = ({ writeAccessDenied: c = !1, onSend:
|
|
|
148
142
|
return;
|
|
149
143
|
}
|
|
150
144
|
if (!r.ok) {
|
|
151
|
-
r.cancelled ||
|
|
145
|
+
r.cancelled || N({
|
|
152
146
|
kind: "failed",
|
|
153
147
|
failures: r.failures
|
|
154
148
|
});
|
|
155
149
|
return;
|
|
156
150
|
}
|
|
157
151
|
if (zt.current) {
|
|
158
|
-
await r.rollback(), Y.current &&
|
|
152
|
+
await r.rollback(), Y.current && N({
|
|
159
153
|
kind: "busy",
|
|
160
154
|
failures: []
|
|
161
155
|
});
|
|
162
156
|
return;
|
|
163
157
|
}
|
|
164
|
-
let i =
|
|
158
|
+
let i = o.getState();
|
|
165
159
|
if (i.activeConversationId !== n || n !== null && !i.conversations.some((e) => e.id === n)) {
|
|
166
|
-
await r.rollback(), Y.current &&
|
|
160
|
+
await r.rollback(), Y.current && N({
|
|
167
161
|
kind: "moved",
|
|
168
162
|
failures: []
|
|
169
163
|
});
|
|
170
164
|
return;
|
|
171
165
|
}
|
|
172
|
-
|
|
166
|
+
ct.current = t, g(e, te(r.attachments)), r.handedOver(), k(""), ht();
|
|
173
167
|
} finally {
|
|
174
|
-
|
|
168
|
+
$e.current = !1, Y.current && Qe(!1);
|
|
175
169
|
}
|
|
176
170
|
}, [
|
|
177
171
|
J,
|
|
178
172
|
Rt,
|
|
179
173
|
vt,
|
|
180
|
-
|
|
181
|
-
|
|
174
|
+
g,
|
|
175
|
+
O,
|
|
182
176
|
q,
|
|
183
177
|
ht,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
]), Bt =
|
|
187
|
-
yt(),
|
|
188
|
-
}, [yt]), Z =
|
|
189
|
-
zt.current ?
|
|
190
|
-
}, []), Vt =
|
|
191
|
-
if (
|
|
178
|
+
U,
|
|
179
|
+
E
|
|
180
|
+
]), Bt = c(() => {
|
|
181
|
+
yt(), D.current?.focus();
|
|
182
|
+
}, [yt]), Z = c(() => {
|
|
183
|
+
zt.current ? rt.current = !0 : D.current?.focus();
|
|
184
|
+
}, []), Vt = c(() => {
|
|
185
|
+
if (ot.current) return;
|
|
192
186
|
let e = Ue?.() ?? null;
|
|
193
|
-
e !== null && (
|
|
187
|
+
e !== null && (ot.current = !0, I(e)), Z();
|
|
194
188
|
}, [Ue, Z]);
|
|
195
|
-
|
|
196
|
-
!
|
|
197
|
-
}, [
|
|
198
|
-
let Ht =
|
|
189
|
+
l(() => {
|
|
190
|
+
!T && rt.current && (rt.current = !1, D.current?.focus());
|
|
191
|
+
}, [T]);
|
|
192
|
+
let Ht = c((e) => {
|
|
199
193
|
if (e !== null) {
|
|
200
|
-
|
|
194
|
+
it.current = e;
|
|
201
195
|
return;
|
|
202
196
|
}
|
|
203
|
-
let t =
|
|
204
|
-
|
|
205
|
-
}, []), Q =
|
|
206
|
-
|
|
207
|
-
!Q &&
|
|
208
|
-
}, [Q, Z]),
|
|
209
|
-
|
|
210
|
-
}, [
|
|
197
|
+
let t = it.current;
|
|
198
|
+
it.current = null, t !== null && t.ownerDocument.activeElement === t && (at.current = !0);
|
|
199
|
+
}, []), Q = E && y && Ue !== void 0;
|
|
200
|
+
Ce(() => {
|
|
201
|
+
!Q && at.current && (at.current = !1, Z());
|
|
202
|
+
}, [Q, Z]), l(() => {
|
|
203
|
+
F === null && (ot.current = !1);
|
|
204
|
+
}, [F]), Ce(() => {
|
|
211
205
|
if (!Q) return;
|
|
212
|
-
let e =
|
|
213
|
-
if (
|
|
214
|
-
let t =
|
|
206
|
+
let e = ct.current;
|
|
207
|
+
if (ct.current = !1, !e) return;
|
|
208
|
+
let t = it.current;
|
|
215
209
|
if (t === null) return;
|
|
216
210
|
let n = t.ownerDocument, r = n.activeElement;
|
|
217
|
-
(r === null || r === n.body || r ===
|
|
211
|
+
(r === null || r === n.body || r === D.current) && t.focus({ preventScroll: !0 });
|
|
218
212
|
}, [Q]);
|
|
219
|
-
let Ut =
|
|
220
|
-
|
|
213
|
+
let Ut = c((e) => {
|
|
214
|
+
k(e), P(null);
|
|
221
215
|
}, []);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}, [
|
|
216
|
+
l(() => {
|
|
217
|
+
N(null);
|
|
218
|
+
}, [R.length]);
|
|
225
219
|
let Wt = (t) => {
|
|
226
|
-
if (t.kind === "busy") return
|
|
227
|
-
if (t.kind === "moved") return
|
|
220
|
+
if (t.kind === "busy") return S("attachments.saveBusy", "The assistant started another reply, so nothing was sent. Your message and files are still here.");
|
|
221
|
+
if (t.kind === "moved") return S("attachments.saveMoved", "You switched conversations while the files were being saved, so nothing was sent. Your message and files are still here.");
|
|
228
222
|
let { failures: n } = t;
|
|
229
|
-
if (n.some((e) => e.code ===
|
|
230
|
-
if (n.some((e) => e.code ===
|
|
231
|
-
let r = n[0], i =
|
|
232
|
-
return `${n.length <= 1 ?
|
|
233
|
-
}, Gt =
|
|
223
|
+
if (n.some((e) => e.code === ne.editorAccessRequired)) return e(S, w);
|
|
224
|
+
if (n.some((e) => e.code === ne.quotaExceeded || e.code === ne.quotaNotProvisioned)) return `${S("attachments.quotaFull", "File storage is full or not set up for this workspace, so the attachments couldn't be saved. Nothing was sent.")} ${S("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
|
|
225
|
+
let r = n[0], i = R.find((e) => e.id === r?.id)?.filename ?? "";
|
|
226
|
+
return `${n.length <= 1 ? S("attachments.saveFailedOne", "{{name}} couldn't be saved, so nothing was sent.", { name: i }) : S("attachments.saveFailedMany", "{{count}} attachments couldn't be saved, so nothing was sent.", { count: n.length })} ${S("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
|
|
227
|
+
}, Gt = c((e) => {
|
|
234
228
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), X());
|
|
235
|
-
}, [X]), Kt =
|
|
236
|
-
e.key === "Escape" ?
|
|
237
|
-
}, [X]), qt =
|
|
229
|
+
}, [X]), Kt = c((e) => {
|
|
230
|
+
e.key === "Escape" ? be(e) && e.stopPropagation() : ye(e) && (e.preventDefault(), P(null), X());
|
|
231
|
+
}, [X]), qt = c((e) => {
|
|
238
232
|
let t = Array.from(e.clipboardData?.files ?? []);
|
|
239
|
-
t.length !== 0 && (e.preventDefault(),
|
|
240
|
-
}, [
|
|
241
|
-
Array.from(e.dataTransfer?.types ?? []).includes("Files") && (
|
|
242
|
-
}, []), Yt =
|
|
243
|
-
|
|
244
|
-
}, []), Xt =
|
|
233
|
+
t.length !== 0 && (e.preventDefault(), z(t));
|
|
234
|
+
}, [z]), Jt = c((e) => {
|
|
235
|
+
Array.from(e.dataTransfer?.types ?? []).includes("Files") && (L.current += 1, Ze(!0));
|
|
236
|
+
}, []), Yt = c(() => {
|
|
237
|
+
L.current = Math.max(0, L.current - 1), L.current === 0 && Ze(!1);
|
|
238
|
+
}, []), Xt = c((e) => {
|
|
245
239
|
Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
|
|
246
|
-
}, []), Zt =
|
|
247
|
-
e.preventDefault(),
|
|
248
|
-
}, [
|
|
240
|
+
}, []), Zt = c((e) => {
|
|
241
|
+
e.preventDefault(), L.current = 0, Ze(!1), z(e.dataTransfer?.files ?? null);
|
|
242
|
+
}, [z]), Qt = (e) => {
|
|
249
243
|
switch (e) {
|
|
250
|
-
case "too-many": return
|
|
251
|
-
case "too-large": return
|
|
252
|
-
case "empty": return
|
|
253
|
-
case "unreadable": return
|
|
254
|
-
case "unsupported-image": return
|
|
255
|
-
case "too-large-to-save": return
|
|
244
|
+
case "too-many": return S("attachments.tooMany", "You can attach up to {{max}} files per message.", { max: 5 });
|
|
245
|
+
case "too-large": return S("attachments.tooLarge", "That file is larger than 10 MB.");
|
|
246
|
+
case "empty": return S("attachments.empty", "That file is empty.");
|
|
247
|
+
case "unreadable": return S("attachments.unreadable", "That file could not be read.");
|
|
248
|
+
case "unsupported-image": return S("attachments.unsupportedImage", "This device can't read that image format, so it can't be resized to send. Save it as JPEG and try again.");
|
|
249
|
+
case "too-large-to-save": return S("attachments.tooLargeToSave", "That file is over 5 MB, so it can't be saved to Files, and no text could be read from it.");
|
|
256
250
|
}
|
|
257
251
|
}, $ = (() => {
|
|
258
|
-
switch (
|
|
259
|
-
case "not-allowed": return
|
|
260
|
-
case "audio-capture": return
|
|
261
|
-
case "network": return
|
|
262
|
-
case "language-not-supported": return
|
|
263
|
-
case "unknown": return
|
|
252
|
+
switch (U.error) {
|
|
253
|
+
case "not-allowed": return S("voice.denied", "Microphone access is blocked. Allow it in your browser settings to dictate.");
|
|
254
|
+
case "audio-capture": return S("voice.noMic", "No microphone was found.");
|
|
255
|
+
case "network": return S("voice.network", "Speech recognition is offline right now.");
|
|
256
|
+
case "language-not-supported": return S("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: i(U.language, w) });
|
|
257
|
+
case "unknown": return S("voice.failed", "Dictation stopped unexpectedly.");
|
|
264
258
|
default: return null;
|
|
265
259
|
}
|
|
266
|
-
})(), $t = (e, n, r = !1) =>
|
|
260
|
+
})(), $t = (e, n, r = !1) => j ? /* @__PURE__ */ m(t, {
|
|
267
261
|
onDismiss: Bt,
|
|
268
|
-
children: /* @__PURE__ */
|
|
262
|
+
children: /* @__PURE__ */ h("p", {
|
|
269
263
|
className: "flex items-center justify-center gap-2 text-text-muted",
|
|
270
264
|
"data-testid": "assistant-commit-status",
|
|
271
265
|
children: [
|
|
272
|
-
/* @__PURE__ */
|
|
266
|
+
/* @__PURE__ */ m(p, {
|
|
273
267
|
className: "size-3 motion-safe:animate-spin",
|
|
274
268
|
"aria-hidden": "true"
|
|
275
269
|
}),
|
|
276
|
-
/* @__PURE__ */
|
|
277
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ m("span", { children: S("attachments.saving", "Saving your attachments…") }),
|
|
271
|
+
/* @__PURE__ */ m("button", {
|
|
278
272
|
type: "button",
|
|
279
273
|
onClick: Bt,
|
|
280
274
|
className: "rounded text-text-primary underline underline-offset-2 hover:text-action-primary-bg focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
|
|
281
275
|
"data-testid": "assistant-commit-cancel",
|
|
282
|
-
children:
|
|
276
|
+
children: S("attachments.cancelSaving", "Cancel")
|
|
283
277
|
})
|
|
284
278
|
]
|
|
285
279
|
})
|
|
286
|
-
}) :
|
|
280
|
+
}) : M ? /* @__PURE__ */ m("p", {
|
|
287
281
|
className: "text-status-error-text",
|
|
288
282
|
role: "alert",
|
|
289
283
|
"data-testid": "assistant-commit-failed",
|
|
290
|
-
children: Wt(
|
|
291
|
-
}) : !r &&
|
|
284
|
+
children: Wt(M)
|
|
285
|
+
}) : !r && U.isStarting && !U.isListening ? /* @__PURE__ */ m("p", {
|
|
292
286
|
className: "text-text-muted",
|
|
293
287
|
"data-testid": "assistant-voice-starting",
|
|
294
|
-
children:
|
|
295
|
-
}) : !r &&
|
|
288
|
+
children: S("voice.starting", "Starting the microphone…")
|
|
289
|
+
}) : !r && U.isListening ? /* @__PURE__ */ h("p", {
|
|
296
290
|
className: "text-status-error-text",
|
|
297
291
|
"data-testid": "assistant-voice-status",
|
|
298
|
-
children: [/* @__PURE__ */
|
|
299
|
-
}) : $ ? /* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ m(ce, {}), U.interim || S("voice.listening", "Listening… speak now, tap the square to stop")]
|
|
293
|
+
}) : $ ? /* @__PURE__ */ m("p", {
|
|
300
294
|
className: "text-status-error-text",
|
|
301
295
|
"data-testid": "assistant-voice-error",
|
|
302
296
|
children: $
|
|
303
|
-
}) : ft ? /* @__PURE__ */
|
|
297
|
+
}) : ft ? /* @__PURE__ */ m("button", {
|
|
304
298
|
type: "button",
|
|
305
299
|
onClick: gt,
|
|
306
300
|
className: "text-status-error-text underline-offset-2 hover:underline",
|
|
307
301
|
"data-testid": "assistant-attachment-rejection",
|
|
308
302
|
children: Qt(ft)
|
|
309
|
-
}) : dt === "failed" ? /* @__PURE__ */
|
|
303
|
+
}) : dt === "failed" ? /* @__PURE__ */ m("p", {
|
|
310
304
|
className: "text-status-error-text",
|
|
311
305
|
"data-testid": "assistant-attachment-blocked",
|
|
312
|
-
children: Lt.length === 1 ?
|
|
313
|
-
}) : n ? /* @__PURE__ */
|
|
306
|
+
children: Lt.length === 1 ? S("attachments.blockedOne", "{{name}} didn't upload. Retry or remove it before sending.", { name: Lt[0].filename }) : S("attachments.blockedMany", "{{count}} attachments didn't upload. Retry or remove them before sending.", { count: Lt.length })
|
|
307
|
+
}) : n ? /* @__PURE__ */ m("p", {
|
|
314
308
|
className: "text-text-muted",
|
|
315
309
|
"data-testid": "assistant-stopping-status",
|
|
316
|
-
children:
|
|
317
|
-
}) : e ? /* @__PURE__ */
|
|
310
|
+
children: S("composer.stopping", "Stopping the reply…")
|
|
311
|
+
}) : e ? /* @__PURE__ */ m("p", {
|
|
318
312
|
className: "text-text-muted",
|
|
319
313
|
"data-testid": "assistant-stop-status",
|
|
320
|
-
children:
|
|
321
|
-
}) : /* @__PURE__ */
|
|
314
|
+
children: S("composer.stopped", "Reply stopped.")
|
|
315
|
+
}) : /* @__PURE__ */ m("p", {
|
|
322
316
|
className: "text-text-muted",
|
|
323
|
-
children:
|
|
317
|
+
children: S("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach")
|
|
324
318
|
});
|
|
325
|
-
if (
|
|
326
|
-
let e =
|
|
327
|
-
return /* @__PURE__ */
|
|
328
|
-
ref:
|
|
329
|
-
className: `${
|
|
319
|
+
if (E) {
|
|
320
|
+
let e = v !== void 0 && K.length === 0 && R.length === 0 && !U.isActive, n = S("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach"), r = U.isSupported && !x && W.phase !== "idle", i = U.error === "not-allowed" || U.error === "audio-capture", a = !!(j || M || $ || ft || dt === "failed" || et !== null || F !== null), o = W.nothingHeard && !a, s = "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-bg-elevated)]";
|
|
321
|
+
return /* @__PURE__ */ m(Ae, { children: (ee) => /* @__PURE__ */ h("div", {
|
|
322
|
+
ref: st,
|
|
323
|
+
className: `${C ? `flex-shrink-0 px-3 pt-1.5 ${xe}` : "flex-shrink-0 px-3 pt-1.5"}${Ye ? " hidden" : ""}`,
|
|
330
324
|
children: [
|
|
331
325
|
Ke,
|
|
332
|
-
qe ? /* @__PURE__ */
|
|
333
|
-
voiceLive:
|
|
326
|
+
qe ? /* @__PURE__ */ m(ve, {
|
|
327
|
+
voiceLive: x,
|
|
334
328
|
children: qe
|
|
335
329
|
}) : null,
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
className:
|
|
330
|
+
/* @__PURE__ */ h("div", {
|
|
331
|
+
className: a || o || u ? "mb-1.5 px-1 text-center text-xs" : "",
|
|
338
332
|
"aria-live": "polite",
|
|
339
333
|
"data-testid": "assistant-composer-status",
|
|
340
334
|
children: [
|
|
341
|
-
|
|
335
|
+
u ? /* @__PURE__ */ m("p", {
|
|
342
336
|
className: "text-status-warning",
|
|
343
337
|
"data-testid": "assistant-write-access-warning",
|
|
344
|
-
children:
|
|
338
|
+
children: S("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
|
|
345
339
|
}) : null,
|
|
346
|
-
|
|
347
|
-
|
|
340
|
+
i && $ && !j && !M ? /* @__PURE__ */ m(pe, {
|
|
341
|
+
message: $,
|
|
342
|
+
onTryAgain: () => {
|
|
343
|
+
U.clearError(), W.start();
|
|
344
|
+
}
|
|
345
|
+
}) : o ? /* @__PURE__ */ m("p", {
|
|
346
|
+
className: "text-text-secondary",
|
|
347
|
+
"data-testid": "assistant-dictation-nothing-heard",
|
|
348
|
+
children: S("dictation.nothingHeard", "Nothing was heard. Check the microphone and try again.")
|
|
349
|
+
}) : a ? $t(et !== null, F !== null, !0) : null,
|
|
350
|
+
r && U.isListening ? /* @__PURE__ */ m("span", {
|
|
348
351
|
className: "sr-only",
|
|
349
352
|
"data-testid": "assistant-dictation-announced",
|
|
350
|
-
children:
|
|
353
|
+
children: S("voiceSession.listening", "Listening…")
|
|
351
354
|
}) : null
|
|
352
355
|
]
|
|
353
356
|
}),
|
|
354
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ m("p", {
|
|
355
358
|
id: ee,
|
|
356
359
|
hidden: !0,
|
|
357
360
|
"data-testid": "assistant-composer-hint",
|
|
358
|
-
children:
|
|
361
|
+
children: n
|
|
359
362
|
}),
|
|
360
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ h("div", {
|
|
361
364
|
onDragEnter: Jt,
|
|
362
365
|
onDragLeave: Yt,
|
|
363
366
|
onDragOver: Xt,
|
|
364
367
|
onDrop: Zt,
|
|
365
|
-
className: `flex flex-col rounded-3xl border transition-colors focus-within:border-[var(--color-focus-ring)] focus-within:ring-1 focus-within:ring-[var(--color-focus-ring)] ${Je ? "bg-bg-surface" : "bg-bg-elevated"} ${
|
|
368
|
+
className: `flex flex-col rounded-3xl border transition-colors ${r && W.phase === "listening" ? "border-status-warning-bg ring-1 ring-status-warning-bg" : "focus-within:border-[var(--color-focus-ring)] focus-within:ring-1 focus-within:ring-[var(--color-focus-ring)]"} ${Je ? "bg-bg-surface" : "bg-bg-elevated"} ${r && W.phase !== "transcribing" ? "" : A ? "border-dashed border-[var(--color-focus-ring)]" : "border-[var(--color-text-muted)]"}`,
|
|
369
|
+
"data-dictating": r ? W.phase : void 0,
|
|
366
370
|
"data-testid": "assistant-composer",
|
|
367
371
|
"data-presentation": "compact",
|
|
368
372
|
children: [
|
|
369
|
-
/* @__PURE__ */
|
|
373
|
+
/* @__PURE__ */ m("div", {
|
|
370
374
|
className: "px-3 pt-3 empty:hidden",
|
|
371
|
-
children: /* @__PURE__ */
|
|
372
|
-
disabled:
|
|
375
|
+
children: /* @__PURE__ */ h(De, { children: [/* @__PURE__ */ m(ae, {
|
|
376
|
+
disabled: j,
|
|
373
377
|
showSuggestions: K.length === 0,
|
|
374
378
|
onSuggest: It
|
|
375
|
-
}), /* @__PURE__ */
|
|
376
|
-
attachments:
|
|
379
|
+
}), /* @__PURE__ */ m(ie, {
|
|
380
|
+
attachments: R,
|
|
377
381
|
onRemove: pt,
|
|
378
382
|
onRetry: mt,
|
|
379
|
-
disabled:
|
|
383
|
+
disabled: T || j,
|
|
380
384
|
preparingCount: ut
|
|
381
385
|
})] })
|
|
382
386
|
}),
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
ref:
|
|
385
|
-
value:
|
|
387
|
+
/* @__PURE__ */ m("textarea", {
|
|
388
|
+
ref: Xe,
|
|
389
|
+
value: O,
|
|
386
390
|
onChange: (e) => Ut(e.target.value),
|
|
387
391
|
onKeyDown: Kt,
|
|
388
392
|
onPaste: qt,
|
|
389
|
-
disabled:
|
|
390
|
-
readOnly:
|
|
391
|
-
"aria-busy":
|
|
392
|
-
placeholder:
|
|
393
|
+
disabled: T,
|
|
394
|
+
readOnly: j,
|
|
395
|
+
"aria-busy": j || void 0,
|
|
396
|
+
placeholder: A ? S("composer.dropHere", "Drop files to attach") : Pt,
|
|
393
397
|
rows: 1,
|
|
394
|
-
className:
|
|
398
|
+
className: `min-h-10 w-full resize-none bg-transparent px-4 pb-1 pt-3 text-base leading-6 text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50${r ? " hidden" : ""}`,
|
|
395
399
|
"aria-describedby": ee,
|
|
396
|
-
title:
|
|
397
|
-
"aria-label":
|
|
400
|
+
title: n,
|
|
401
|
+
"aria-label": S("chatInput.ariaLabel", "Message input"),
|
|
398
402
|
"data-testid": "assistant-input"
|
|
399
403
|
}),
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
404
|
+
r ? /* @__PURE__ */ m(fe, {
|
|
405
|
+
phase: W.phase,
|
|
406
|
+
before: W.before,
|
|
407
|
+
take: W.take,
|
|
408
|
+
interim: W.interim,
|
|
409
|
+
after: W.after
|
|
405
410
|
}) : null,
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
source: Mt,
|
|
425
|
-
tone: "listening",
|
|
426
|
-
className: "h-8 flex-1",
|
|
427
|
-
testId: "assistant-dictation-waveform"
|
|
428
|
-
}) : /* @__PURE__ */ f("p", {
|
|
429
|
-
className: "min-w-0 flex-1 truncate text-sm text-text-muted",
|
|
430
|
-
"data-testid": "assistant-voice-starting",
|
|
431
|
-
children: b("voice.starting", "Starting the microphone…")
|
|
432
|
-
}),
|
|
433
|
-
/* @__PURE__ */ f("span", {
|
|
434
|
-
className: "shrink-0 text-xs tabular-nums text-text-muted",
|
|
435
|
-
"aria-hidden": "true",
|
|
436
|
-
"data-testid": "assistant-dictation-time",
|
|
437
|
-
children: `${Math.floor(Ot / 60)}:${String(Ot % 60).padStart(2, "0")}`
|
|
438
|
-
}),
|
|
439
|
-
/* @__PURE__ */ f("button", {
|
|
440
|
-
type: "button",
|
|
441
|
-
onClick: Et,
|
|
442
|
-
className: `flex size-11 shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg-hover sm:size-10 ${i}`,
|
|
443
|
-
"aria-label": b("composer.dictationDone", "Finish dictation"),
|
|
444
|
-
title: b("composer.dictationDone", "Finish dictation"),
|
|
445
|
-
"aria-pressed": "true",
|
|
446
|
-
"data-testid": "assistant-voice",
|
|
447
|
-
"data-state": V.isListening ? "listening" : "starting",
|
|
448
|
-
children: /* @__PURE__ */ f(we, {
|
|
449
|
-
className: "size-5",
|
|
450
|
-
"aria-hidden": "true"
|
|
451
|
-
})
|
|
411
|
+
r ? W.phase === "transcribing" ? /* @__PURE__ */ m(de, {
|
|
412
|
+
phase: W.phase,
|
|
413
|
+
seconds: W.seconds,
|
|
414
|
+
level: W.level,
|
|
415
|
+
onCancel: W.cancel,
|
|
416
|
+
onFinish: W.finish,
|
|
417
|
+
focusRing: s
|
|
418
|
+
}) : /* @__PURE__ */ m(t, {
|
|
419
|
+
onDismiss: W.cancel,
|
|
420
|
+
children: /* @__PURE__ */ m("div", {
|
|
421
|
+
className: "contents",
|
|
422
|
+
children: /* @__PURE__ */ m(de, {
|
|
423
|
+
phase: W.phase,
|
|
424
|
+
seconds: W.seconds,
|
|
425
|
+
level: W.level,
|
|
426
|
+
onCancel: W.cancel,
|
|
427
|
+
onFinish: W.finish,
|
|
428
|
+
focusRing: s
|
|
452
429
|
})
|
|
453
|
-
|
|
454
|
-
}) : /* @__PURE__ */
|
|
430
|
+
})
|
|
431
|
+
}) : /* @__PURE__ */ h("div", {
|
|
455
432
|
className: "flex flex-nowrap items-center gap-1 px-1.5 pb-1.5 pt-1",
|
|
456
433
|
"data-testid": "assistant-composer-controls",
|
|
457
434
|
children: [
|
|
458
|
-
/* @__PURE__ */
|
|
459
|
-
onFiles:
|
|
435
|
+
/* @__PURE__ */ m(re, {
|
|
436
|
+
onFiles: z,
|
|
460
437
|
canAddMore: _t,
|
|
461
|
-
disabled:
|
|
438
|
+
disabled: T || j,
|
|
462
439
|
compact: !0,
|
|
463
440
|
capMenuHeight: !0
|
|
464
441
|
}),
|
|
465
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ m(_e, {
|
|
466
443
|
chip: !0,
|
|
467
444
|
readOnly: Je,
|
|
468
445
|
mode: Pe,
|
|
469
|
-
availableModes:
|
|
446
|
+
availableModes: _,
|
|
470
447
|
onModeChange: Ie,
|
|
471
448
|
auto: Le,
|
|
472
|
-
disabled:
|
|
473
|
-
disabledReason:
|
|
449
|
+
disabled: T || j,
|
|
450
|
+
disabledReason: F === null ? y ? "replying" : Ge ?? "busy" : "busy"
|
|
474
451
|
}),
|
|
475
|
-
/* @__PURE__ */
|
|
476
|
-
|
|
452
|
+
C ? /* @__PURE__ */ m("span", {
|
|
453
|
+
className: "ms-1 hidden min-w-0 truncate text-xs text-text-secondary sm:block",
|
|
454
|
+
"data-testid": "assistant-mic-summary",
|
|
455
|
+
children: i ? S("dictation.noMicrophone", "No microphone available") : Ot
|
|
456
|
+
}) : null,
|
|
457
|
+
/* @__PURE__ */ m("div", { className: "min-w-0 flex-1" }),
|
|
458
|
+
U.isSupported && !x ? C ? /* @__PURE__ */ m(me, {
|
|
459
|
+
onDictate: W.start,
|
|
460
|
+
blocked: i,
|
|
461
|
+
disabled: T || j
|
|
462
|
+
}) : /* @__PURE__ */ m(se, {
|
|
477
463
|
compact: !0,
|
|
478
|
-
isListening:
|
|
479
|
-
isStarting:
|
|
480
|
-
onToggle:
|
|
481
|
-
disabled:
|
|
482
|
-
}),
|
|
483
|
-
Q ? /* @__PURE__ */
|
|
464
|
+
isListening: U.isListening,
|
|
465
|
+
isStarting: U.isStarting,
|
|
466
|
+
onToggle: W.start,
|
|
467
|
+
disabled: T || j
|
|
468
|
+
}) : null,
|
|
469
|
+
Q ? /* @__PURE__ */ m("button", {
|
|
484
470
|
ref: Ht,
|
|
485
471
|
type: "button",
|
|
486
472
|
onClick: Vt,
|
|
487
|
-
className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg-hover ${
|
|
488
|
-
"aria-label":
|
|
489
|
-
title:
|
|
490
|
-
"aria-disabled":
|
|
491
|
-
"aria-busy":
|
|
473
|
+
className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg-hover ${s} ${F === null ? "" : "cursor-default opacity-60"}`,
|
|
474
|
+
"aria-label": F === null ? S("composer.stop", "Stop the reply") : S("composer.stopping", "Stopping the reply…"),
|
|
475
|
+
title: F === null ? S("composer.stop", "Stop the reply") : S("composer.stopping", "Stopping the reply…"),
|
|
476
|
+
"aria-disabled": F === null ? void 0 : "true",
|
|
477
|
+
"aria-busy": F === null ? void 0 : "true",
|
|
492
478
|
"data-testid": "assistant-stop",
|
|
493
|
-
children:
|
|
479
|
+
children: F === null ? /* @__PURE__ */ m(Ee, {
|
|
494
480
|
className: "size-4 fill-current",
|
|
495
481
|
"aria-hidden": "true"
|
|
496
|
-
}) : /* @__PURE__ */
|
|
482
|
+
}) : /* @__PURE__ */ m(p, {
|
|
497
483
|
className: "size-4 motion-safe:animate-spin",
|
|
498
484
|
"aria-hidden": "true"
|
|
499
485
|
})
|
|
500
|
-
}) : e ? /* @__PURE__ */
|
|
486
|
+
}) : e && !(C && i) ? /* @__PURE__ */ m(le, {
|
|
501
487
|
compact: !0,
|
|
502
|
-
invisible:
|
|
503
|
-
onStart:
|
|
504
|
-
disabled:
|
|
505
|
-
}) : /* @__PURE__ */
|
|
488
|
+
invisible: x,
|
|
489
|
+
onStart: v,
|
|
490
|
+
disabled: T || j
|
|
491
|
+
}) : /* @__PURE__ */ m("button", {
|
|
506
492
|
type: "button",
|
|
507
493
|
onClick: () => {
|
|
508
|
-
|
|
494
|
+
P(null), X();
|
|
509
495
|
},
|
|
510
496
|
disabled: !J,
|
|
511
|
-
className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full transition-colors ${
|
|
512
|
-
"aria-label":
|
|
497
|
+
className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full transition-colors ${s} ${J ? "bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg-hover" : "bg-[var(--color-bg-disabled)] text-[var(--color-text-disabled)]"}`,
|
|
498
|
+
"aria-label": S("chatInput.send", "Send message"),
|
|
513
499
|
"data-testid": "assistant-send",
|
|
514
|
-
children: je || lt ||
|
|
500
|
+
children: je || lt || j ? /* @__PURE__ */ m(p, {
|
|
515
501
|
className: "size-5 motion-safe:animate-spin",
|
|
516
502
|
"aria-hidden": "true"
|
|
517
|
-
}) : /* @__PURE__ */
|
|
503
|
+
}) : /* @__PURE__ */ m(Te, {
|
|
518
504
|
className: "size-5",
|
|
519
505
|
"aria-hidden": "true"
|
|
520
506
|
})
|
|
@@ -526,90 +512,90 @@ var Ae = ({ children: e }) => e(c()), m = ({ writeAccessDenied: c = !1, onSend:
|
|
|
526
512
|
]
|
|
527
513
|
}) });
|
|
528
514
|
}
|
|
529
|
-
return /* @__PURE__ */
|
|
515
|
+
return /* @__PURE__ */ h("div", {
|
|
530
516
|
className: "flex-shrink-0 px-3 pb-3 pt-1.5",
|
|
531
517
|
children: [
|
|
532
|
-
/* @__PURE__ */
|
|
518
|
+
/* @__PURE__ */ h("div", {
|
|
533
519
|
onDragEnter: Jt,
|
|
534
520
|
onDragLeave: Yt,
|
|
535
521
|
onDragOver: Xt,
|
|
536
522
|
onDrop: Zt,
|
|
537
|
-
className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${
|
|
523
|
+
className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${A ? "border-action-primary-bg border-dashed bg-action-primary-bg/5" : "border-border-default bg-bg-sunken"}`,
|
|
538
524
|
"data-testid": "assistant-composer",
|
|
539
525
|
children: [
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
disabled:
|
|
526
|
+
/* @__PURE__ */ h(De, { children: [/* @__PURE__ */ m(ae, {
|
|
527
|
+
disabled: j,
|
|
542
528
|
showSuggestions: K.length === 0,
|
|
543
529
|
onSuggest: It
|
|
544
|
-
}), /* @__PURE__ */
|
|
545
|
-
attachments:
|
|
530
|
+
}), /* @__PURE__ */ m(ie, {
|
|
531
|
+
attachments: R,
|
|
546
532
|
onRemove: pt,
|
|
547
533
|
onRetry: mt,
|
|
548
|
-
disabled:
|
|
534
|
+
disabled: T || j,
|
|
549
535
|
preparingCount: ut
|
|
550
536
|
})] }),
|
|
551
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ h("div", {
|
|
552
538
|
className: "flex items-end gap-2",
|
|
553
539
|
children: [
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
onFiles:
|
|
540
|
+
/* @__PURE__ */ m(re, {
|
|
541
|
+
onFiles: z,
|
|
556
542
|
canAddMore: _t,
|
|
557
|
-
disabled:
|
|
543
|
+
disabled: T || j,
|
|
558
544
|
showLabel: !0
|
|
559
545
|
}),
|
|
560
|
-
/* @__PURE__ */
|
|
561
|
-
ref:
|
|
562
|
-
value:
|
|
563
|
-
onChange: (e) =>
|
|
546
|
+
/* @__PURE__ */ m("textarea", {
|
|
547
|
+
ref: D,
|
|
548
|
+
value: O,
|
|
549
|
+
onChange: (e) => k(e.target.value),
|
|
564
550
|
onKeyDown: Gt,
|
|
565
551
|
onPaste: qt,
|
|
566
|
-
disabled:
|
|
567
|
-
readOnly:
|
|
568
|
-
"aria-busy":
|
|
569
|
-
placeholder:
|
|
552
|
+
disabled: T,
|
|
553
|
+
readOnly: j,
|
|
554
|
+
"aria-busy": j || void 0,
|
|
555
|
+
placeholder: A ? S("composer.dropHere", "Drop files to attach") : Pt,
|
|
570
556
|
rows: 1,
|
|
571
557
|
className: "min-h-[36px] flex-1 resize-none self-center bg-transparent px-1 py-2 text-[15px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50",
|
|
572
|
-
"aria-label":
|
|
558
|
+
"aria-label": S("chatInput.ariaLabel", "Message input"),
|
|
573
559
|
"data-testid": "assistant-input"
|
|
574
560
|
}),
|
|
575
|
-
|
|
576
|
-
isListening:
|
|
577
|
-
isStarting:
|
|
578
|
-
onToggle:
|
|
579
|
-
disabled:
|
|
561
|
+
U.isSupported && /* @__PURE__ */ m(se, {
|
|
562
|
+
isListening: U.isListening,
|
|
563
|
+
isStarting: U.isStarting,
|
|
564
|
+
onToggle: U.toggle,
|
|
565
|
+
disabled: T || j
|
|
580
566
|
}),
|
|
581
|
-
|
|
582
|
-
onStart:
|
|
583
|
-
disabled:
|
|
584
|
-
}) : /* @__PURE__ */
|
|
567
|
+
v && K.length === 0 && R.length === 0 && !U.isActive ? /* @__PURE__ */ m(le, {
|
|
568
|
+
onStart: v,
|
|
569
|
+
disabled: T || j
|
|
570
|
+
}) : /* @__PURE__ */ m("button", {
|
|
585
571
|
type: "button",
|
|
586
572
|
onClick: () => void X(),
|
|
587
573
|
disabled: !J,
|
|
588
574
|
className: `flex size-9 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${J ? "bg-action-primary-bg text-action-primary-text hover:scale-105 hover:bg-action-primary-bg-hover" : "bg-bg-elevated text-text-muted"}`,
|
|
589
|
-
"aria-label":
|
|
575
|
+
"aria-label": S("chatInput.send", "Send message"),
|
|
590
576
|
"data-testid": "assistant-send",
|
|
591
|
-
children: je || lt ||
|
|
577
|
+
children: je || lt || j ? /* @__PURE__ */ m(p, { className: "size-4 motion-safe:animate-spin" }) : /* @__PURE__ */ m(Te, { className: "size-4" })
|
|
592
578
|
})
|
|
593
579
|
]
|
|
594
580
|
}),
|
|
595
|
-
(
|
|
581
|
+
(_.length > 1 || _.some((e) => e.writeCapable)) && /* @__PURE__ */ m("div", {
|
|
596
582
|
className: "mt-2 px-0.5",
|
|
597
|
-
children: /* @__PURE__ */
|
|
583
|
+
children: /* @__PURE__ */ m(ge, {
|
|
598
584
|
mode: Pe,
|
|
599
|
-
availableModes:
|
|
585
|
+
availableModes: _,
|
|
600
586
|
onModeChange: Ie,
|
|
601
|
-
disabled:
|
|
587
|
+
disabled: T || j,
|
|
602
588
|
auto: Le
|
|
603
589
|
})
|
|
604
590
|
})
|
|
605
591
|
]
|
|
606
592
|
}),
|
|
607
|
-
|
|
593
|
+
u ? /* @__PURE__ */ m("p", {
|
|
608
594
|
className: "mt-1.5 px-1 text-center text-[11px] text-status-warning",
|
|
609
595
|
"data-testid": "assistant-write-access-warning",
|
|
610
|
-
children:
|
|
596
|
+
children: S("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
|
|
611
597
|
}) : null,
|
|
612
|
-
/* @__PURE__ */
|
|
598
|
+
/* @__PURE__ */ m("div", {
|
|
613
599
|
className: "mt-1.5 px-1 text-center text-[11px]",
|
|
614
600
|
"aria-live": "polite",
|
|
615
601
|
children: $t(!1, !1)
|
|
@@ -617,4 +603,4 @@ var Ae = ({ children: e }) => e(c()), m = ({ writeAccessDenied: c = !1, onSend:
|
|
|
617
603
|
]
|
|
618
604
|
});
|
|
619
605
|
};
|
|
620
|
-
export {
|
|
606
|
+
export { g as AssistantComposer };
|