@burdenoff/fe-libs 2026.714.3 → 2026.714.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantWidget.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/AssistantWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAML,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AAiBf,OAAO,KAAK,EAA2B,kBAAkB,EAA0B,MAAM,SAAS,CAAC;AAEnG,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,SAAS,EAAE,kBAAkB,CAAC;IAC9B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,8EAA8E;AAC9E,eAAO,MAAM,6BAA6B,+BAA+B,CAAC;AA6C1E,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"AssistantWidget.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/AssistantWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAML,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AAiBf,OAAO,KAAK,EAA2B,kBAAkB,EAA0B,MAAM,SAAS,CAAC;AAEnG,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,SAAS,EAAE,kBAAkB,CAAC;IAC9B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,8EAA8E;AAC9E,eAAO,MAAM,6BAA6B,+BAA+B,CAAC;AA6C1E,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAolBpD,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cn as e } from "../../utils/cn.js";
|
|
2
2
|
import { useVoiceInput as t } from "./useVoiceInput.js";
|
|
3
3
|
import { MessageContent as n } from "./MessageContent.js";
|
|
4
|
-
import { useCallback as r, useEffect as i, useMemo as
|
|
5
|
-
import { History as
|
|
4
|
+
import { useCallback as r, useEffect as i, useMemo as ee, useRef as a, useState as o } from "react";
|
|
5
|
+
import { History as s, Loader2 as c, MessageCircle as l, Mic as te, PanelLeftClose as ne, PanelLeftOpen as re, Plus as ie, Send as ae, Sparkles as u, Trash2 as oe, X as d } from "lucide-react";
|
|
6
6
|
import { Fragment as se, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
7
7
|
//#region src/shared/components/assistantWidget/AssistantWidget.tsx
|
|
8
8
|
var m = "bf:toggle-assistant-widget", h = "bf:assistant-widget:isOpen", g = "bf:assistant-widget:railOpen";
|
|
@@ -19,7 +19,7 @@ function le(e) {
|
|
|
19
19
|
window.sessionStorage.setItem(g, e ? "1" : "0");
|
|
20
20
|
} catch {}
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function ue() {
|
|
23
23
|
if (typeof window > "u") return !1;
|
|
24
24
|
try {
|
|
25
25
|
return window.sessionStorage.getItem(h) === "1";
|
|
@@ -27,28 +27,28 @@ function _() {
|
|
|
27
27
|
return !1;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function _(e) {
|
|
31
31
|
if (!(typeof window > "u")) try {
|
|
32
32
|
window.sessionStorage.setItem(h, e ? "1" : "0");
|
|
33
33
|
} catch {}
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function v() {
|
|
36
36
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
37
37
|
}
|
|
38
|
-
var
|
|
39
|
-
let [
|
|
40
|
-
|
|
38
|
+
var y = ({ transport: h, title: g = "AI Assistant", subtitle: y = "Ask me to do things on this screen — I can run them for you.", placeholder: de = "Ask anything, or describe what to create…", launcherClassName: b, voiceLang: x = "en-US", layout: S = "floating", showSessionPanel: fe = !1, onNavigate: pe, topOffsetPx: C = 0 }) => {
|
|
39
|
+
let [w, T] = o(() => ue()), [E, D] = o([]), [O, k] = o(""), [A, j] = o(!1), [me, M] = o(!1), [N, P] = o([]), [F, I] = o(!1), [L, R] = o(!1), [z, he] = o(() => ce()), B = a(null), V = a(null), H = a(null), U = a(!1), W = S === "sidebar", G = fe && !!h.newSession, K = r(() => {
|
|
40
|
+
he((e) => {
|
|
41
41
|
let t = !e;
|
|
42
42
|
return le(t), t;
|
|
43
43
|
});
|
|
44
|
-
}, []), q = t(
|
|
45
|
-
|
|
44
|
+
}, []), q = t(x), J = r(() => {
|
|
45
|
+
_(!0), T(!0), h.prewarm?.("full");
|
|
46
46
|
}, [h]), Y = r(() => {
|
|
47
|
-
|
|
47
|
+
_(!1), T(!1), h.suspend?.();
|
|
48
48
|
}, [h]), X = r(() => {
|
|
49
|
-
|
|
49
|
+
T((e) => {
|
|
50
50
|
let t = !e;
|
|
51
|
-
return
|
|
51
|
+
return _(t), t ? h.prewarm?.("full") : h.suspend?.(), t;
|
|
52
52
|
});
|
|
53
53
|
}, [h]);
|
|
54
54
|
i(() => {
|
|
@@ -62,50 +62,50 @@ var b = ({ transport: h, title: g = "AI Assistant", subtitle: b = "Ask me to do
|
|
|
62
62
|
Y,
|
|
63
63
|
X
|
|
64
64
|
]), i(() => {
|
|
65
|
-
q.isListening && q.transcript &&
|
|
65
|
+
q.isListening && q.transcript && k(q.transcript);
|
|
66
66
|
}, [q.transcript, q.isListening]), i(() => {
|
|
67
|
-
if (!
|
|
67
|
+
if (!w || U.current) return;
|
|
68
68
|
let e = h.loadHistory;
|
|
69
69
|
if (!e) {
|
|
70
|
-
|
|
70
|
+
U.current = !0;
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
U.current = !0;
|
|
74
74
|
let t = !1;
|
|
75
|
-
return
|
|
75
|
+
return M(!0), (async () => {
|
|
76
76
|
try {
|
|
77
77
|
let n = await e();
|
|
78
|
-
!t && n.length > 0 &&
|
|
78
|
+
!t && n.length > 0 && D((e) => e.length === 0 ? n : e);
|
|
79
79
|
} catch {} finally {
|
|
80
|
-
t ||
|
|
80
|
+
t || M(!1);
|
|
81
81
|
}
|
|
82
82
|
})(), () => {
|
|
83
83
|
t = !0;
|
|
84
84
|
};
|
|
85
|
-
}, [
|
|
86
|
-
|
|
87
|
-
}, [
|
|
85
|
+
}, [w, h]), i(() => {
|
|
86
|
+
w && V.current && (V.current.scrollTop = V.current.scrollHeight);
|
|
87
|
+
}, [E, w]);
|
|
88
88
|
let Z = r((e, t) => {
|
|
89
|
-
|
|
89
|
+
D((n) => n.map((n) => n.id === e ? {
|
|
90
90
|
...n,
|
|
91
91
|
...t
|
|
92
92
|
} : n));
|
|
93
93
|
}, []), Q = r(async () => {
|
|
94
94
|
if (h.listSessions) {
|
|
95
|
-
|
|
95
|
+
R(!0);
|
|
96
96
|
try {
|
|
97
|
-
|
|
97
|
+
P(await h.listSessions());
|
|
98
98
|
} catch {
|
|
99
|
-
|
|
99
|
+
P([]);
|
|
100
100
|
} finally {
|
|
101
|
-
|
|
101
|
+
R(!1);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}, [h]), ge = r(async () => {
|
|
105
|
-
!h.newSession ||
|
|
106
|
-
}, [h,
|
|
107
|
-
if (!(!h.deleteSession ||
|
|
108
|
-
|
|
105
|
+
!h.newSession || A || (D([]), k(""), I(!1), await h.newSession());
|
|
106
|
+
}, [h, A]), _e = r(async (e, t) => {
|
|
107
|
+
if (!(!h.deleteSession || A)) {
|
|
108
|
+
P((t) => t.filter((t) => t.id !== e)), t && (D([]), k(""));
|
|
109
109
|
try {
|
|
110
110
|
await h.deleteSession(e);
|
|
111
111
|
} finally {
|
|
@@ -114,33 +114,33 @@ var b = ({ transport: h, title: g = "AI Assistant", subtitle: b = "Ask me to do
|
|
|
114
114
|
}
|
|
115
115
|
}, [
|
|
116
116
|
h,
|
|
117
|
-
|
|
117
|
+
A,
|
|
118
118
|
Q
|
|
119
119
|
]), ve = r(() => {
|
|
120
|
-
|
|
120
|
+
I((e) => (e || Q(), !e));
|
|
121
121
|
}, [Q]), ye = r(async (e) => {
|
|
122
|
-
if (!(!h.selectSession ||
|
|
123
|
-
|
|
122
|
+
if (!(!h.selectSession || A)) {
|
|
123
|
+
M(!0);
|
|
124
124
|
try {
|
|
125
|
-
|
|
125
|
+
D(await h.selectSession(e)), I(!1), Q();
|
|
126
126
|
} catch {} finally {
|
|
127
|
-
|
|
127
|
+
M(!1);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}, [
|
|
131
131
|
h,
|
|
132
|
-
|
|
132
|
+
A,
|
|
133
133
|
Q
|
|
134
134
|
]), $ = r(async () => {
|
|
135
|
-
let e =
|
|
136
|
-
if (!e ||
|
|
137
|
-
q.isListening && q.stop(), q.reset(),
|
|
135
|
+
let e = O.trim();
|
|
136
|
+
if (!e || A) return;
|
|
137
|
+
q.isListening && q.stop(), q.reset(), k(""), B.current && (B.current.style.height = "auto");
|
|
138
138
|
let t = {
|
|
139
|
-
id:
|
|
139
|
+
id: v(),
|
|
140
140
|
role: "user",
|
|
141
141
|
content: e
|
|
142
|
-
}, n =
|
|
143
|
-
|
|
142
|
+
}, n = v();
|
|
143
|
+
D((e) => [
|
|
144
144
|
...e,
|
|
145
145
|
t,
|
|
146
146
|
{
|
|
@@ -149,9 +149,9 @@ var b = ({ transport: h, title: g = "AI Assistant", subtitle: b = "Ask me to do
|
|
|
149
149
|
content: "",
|
|
150
150
|
pending: !0
|
|
151
151
|
}
|
|
152
|
-
]),
|
|
152
|
+
]), j(!0);
|
|
153
153
|
let r = new AbortController();
|
|
154
|
-
|
|
154
|
+
H.current = r;
|
|
155
155
|
try {
|
|
156
156
|
let { text: t } = await h.sendPrompt({
|
|
157
157
|
prompt: e,
|
|
@@ -169,57 +169,67 @@ var b = ({ transport: h, title: g = "AI Assistant", subtitle: b = "Ask me to do
|
|
|
169
169
|
error: !0
|
|
170
170
|
});
|
|
171
171
|
} finally {
|
|
172
|
-
|
|
172
|
+
j(!1), H.current = null, F && Q();
|
|
173
173
|
}
|
|
174
174
|
}, [
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
O,
|
|
176
|
+
A,
|
|
177
177
|
Z,
|
|
178
178
|
h,
|
|
179
179
|
q,
|
|
180
|
-
|
|
180
|
+
F,
|
|
181
181
|
Q
|
|
182
182
|
]), be = r((e) => {
|
|
183
183
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), $());
|
|
184
184
|
}, [$]), xe = r(() => {
|
|
185
|
-
let e =
|
|
185
|
+
let e = B.current;
|
|
186
186
|
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 120)}px`);
|
|
187
187
|
}, []), Se = r(() => {
|
|
188
188
|
q.isListening ? q.stop() : q.start();
|
|
189
189
|
}, [q]);
|
|
190
|
-
return /* @__PURE__ */ p(se, { children: [
|
|
190
|
+
return /* @__PURE__ */ p(se, { children: [ee(() => /* @__PURE__ */ f("button", {
|
|
191
191
|
type: "button",
|
|
192
192
|
onClick: X,
|
|
193
|
-
onMouseEnter: () => !
|
|
194
|
-
onFocus: () => !
|
|
195
|
-
"aria-label":
|
|
196
|
-
"aria-expanded":
|
|
193
|
+
onMouseEnter: () => !w && h.prewarm?.("probe"),
|
|
194
|
+
onFocus: () => !w && h.prewarm?.("probe"),
|
|
195
|
+
"aria-label": w ? "Close AI assistant" : "Open AI assistant",
|
|
196
|
+
"aria-expanded": w,
|
|
197
197
|
"data-testid": "assistant-widget-launcher",
|
|
198
|
-
className: e("fixed bottom-6 right-6 z-[100] inline-flex size-14 items-center justify-center rounded-full", "bg-action-primary-bg text-action-primary-text shadow-xl transition-transform duration-200", "hover:scale-105 hover:bg-action-primary-bg-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong cursor-pointer",
|
|
199
|
-
children: f(
|
|
198
|
+
className: e("fixed bottom-6 right-6 z-[100] inline-flex size-14 items-center justify-center rounded-full", "bg-action-primary-bg text-action-primary-text shadow-xl transition-transform duration-200", "hover:scale-105 hover:bg-action-primary-bg-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong cursor-pointer", b),
|
|
199
|
+
children: f(w ? d : u, { className: "size-6" })
|
|
200
200
|
}), [
|
|
201
|
-
|
|
201
|
+
w,
|
|
202
202
|
X,
|
|
203
|
-
|
|
203
|
+
b,
|
|
204
204
|
h
|
|
205
|
-
]),
|
|
205
|
+
]), w ? /* @__PURE__ */ p("div", {
|
|
206
206
|
role: "dialog",
|
|
207
207
|
"aria-label": g,
|
|
208
208
|
"data-testid": "assistant-widget-window",
|
|
209
|
-
"data-layout":
|
|
210
|
-
style:
|
|
211
|
-
top:
|
|
212
|
-
height: `calc(100vh - ${String(
|
|
209
|
+
"data-layout": S,
|
|
210
|
+
style: W ? {
|
|
211
|
+
top: C,
|
|
212
|
+
height: `calc(100vh - ${String(C)}px)`
|
|
213
213
|
} : void 0,
|
|
214
|
-
className: e("fixed z-[100] flex overflow-hidden border-border-default bg-bg-surface shadow-2xl",
|
|
215
|
-
children: [
|
|
214
|
+
className: e("fixed z-[100] flex overflow-hidden border-border-default bg-bg-surface shadow-2xl", W ? "bottom-0 right-0 w-full border-l sm:w-[480px] lg:w-[560px] animate-in slide-in-from-right duration-200" : "flex-col rounded-xl border bottom-24 right-6 h-[560px] max-h-[calc(100vh-7rem)] w-[calc(100vw-3rem)] sm:w-[400px] animate-in slide-in-from-bottom-2 fade-in duration-200"),
|
|
215
|
+
children: [W && G && z ? /* @__PURE__ */ p("aside", {
|
|
216
216
|
"data-testid": "assistant-session-panel",
|
|
217
217
|
className: "flex w-[168px] shrink-0 flex-col gap-1 border-r border-border-subtle bg-bg-sunken p-2",
|
|
218
218
|
children: [
|
|
219
|
+
/* @__PURE__ */ p("button", {
|
|
220
|
+
type: "button",
|
|
221
|
+
onClick: K,
|
|
222
|
+
"aria-label": "Hide chats",
|
|
223
|
+
"aria-expanded": !0,
|
|
224
|
+
title: "Hide chats",
|
|
225
|
+
"data-testid": "assistant-rail-toggle",
|
|
226
|
+
className: "mb-1 flex items-center gap-2 rounded-md px-2 py-2 text-xs font-medium text-text-secondary transition-colors hover:bg-bg-surface hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong cursor-pointer",
|
|
227
|
+
children: [/* @__PURE__ */ f(ne, { className: "size-4 shrink-0" }), "Hide chats"]
|
|
228
|
+
}),
|
|
219
229
|
/* @__PURE__ */ p("button", {
|
|
220
230
|
type: "button",
|
|
221
231
|
onClick: () => void ge(),
|
|
222
|
-
disabled:
|
|
232
|
+
disabled: A,
|
|
223
233
|
"data-testid": "assistant-new-chat",
|
|
224
234
|
className: "flex items-center gap-2 rounded-md px-2 py-2 text-xs font-medium text-text-primary transition-colors hover:bg-bg-surface disabled:opacity-50 cursor-pointer",
|
|
225
235
|
children: [/* @__PURE__ */ f(ie, { className: "size-4 shrink-0" }), "New chat"]
|
|
@@ -227,21 +237,21 @@ var b = ({ transport: h, title: g = "AI Assistant", subtitle: b = "Ask me to do
|
|
|
227
237
|
/* @__PURE__ */ p("button", {
|
|
228
238
|
type: "button",
|
|
229
239
|
onClick: ve,
|
|
230
|
-
"aria-expanded":
|
|
240
|
+
"aria-expanded": F,
|
|
231
241
|
"data-testid": "assistant-history-toggle",
|
|
232
242
|
className: "flex items-center gap-2 rounded-md px-2 py-2 text-xs font-medium text-text-primary transition-colors hover:bg-bg-surface cursor-pointer",
|
|
233
|
-
children: [/* @__PURE__ */ f(
|
|
243
|
+
children: [/* @__PURE__ */ f(s, { className: "size-4 shrink-0" }), "History"]
|
|
234
244
|
}),
|
|
235
|
-
|
|
245
|
+
F ? /* @__PURE__ */ f("div", {
|
|
236
246
|
"data-testid": "assistant-history-list",
|
|
237
247
|
className: "mt-1 flex-1 space-y-0.5 overflow-y-auto border-t border-border-subtle pt-2",
|
|
238
|
-
children:
|
|
248
|
+
children: L && N.length === 0 ? /* @__PURE__ */ p("p", {
|
|
239
249
|
className: "flex items-center gap-1.5 px-2 py-1 text-[11px] text-text-muted",
|
|
240
250
|
children: [/* @__PURE__ */ f(c, { className: "size-3 animate-spin" }), "Loading…"]
|
|
241
|
-
}) :
|
|
251
|
+
}) : N.length === 0 ? /* @__PURE__ */ f("p", {
|
|
242
252
|
className: "px-2 py-1 text-[11px] leading-relaxed text-text-muted",
|
|
243
253
|
children: "No past chats yet."
|
|
244
|
-
}) :
|
|
254
|
+
}) : N.map((t) => /* @__PURE__ */ p("div", {
|
|
245
255
|
"data-testid": "assistant-history-row",
|
|
246
256
|
className: e("group flex items-center gap-1 rounded pr-1 transition-colors", t.active ? "bg-bg-surface" : "hover:bg-bg-surface"),
|
|
247
257
|
children: [/* @__PURE__ */ f("button", {
|
|
@@ -254,7 +264,7 @@ var b = ({ transport: h, title: g = "AI Assistant", subtitle: b = "Ask me to do
|
|
|
254
264
|
}), h.deleteSession ? /* @__PURE__ */ f("button", {
|
|
255
265
|
type: "button",
|
|
256
266
|
onClick: () => void _e(t.id, !!t.active),
|
|
257
|
-
disabled:
|
|
267
|
+
disabled: A,
|
|
258
268
|
"aria-label": `Delete chat: ${t.title}`,
|
|
259
269
|
title: "Delete this chat",
|
|
260
270
|
"data-testid": "assistant-delete-chat",
|
|
@@ -271,15 +281,15 @@ var b = ({ transport: h, title: g = "AI Assistant", subtitle: b = "Ask me to do
|
|
|
271
281
|
className: "flex items-center justify-between gap-2 border-b border-border-subtle bg-bg-surface px-4 py-3",
|
|
272
282
|
children: [/* @__PURE__ */ p("div", {
|
|
273
283
|
className: "flex min-w-0 items-center gap-2",
|
|
274
|
-
children: [G &&
|
|
284
|
+
children: [W && G && !z ? /* @__PURE__ */ p("button", {
|
|
275
285
|
type: "button",
|
|
276
|
-
onClick:
|
|
277
|
-
"aria-label":
|
|
278
|
-
"aria-
|
|
279
|
-
title:
|
|
286
|
+
onClick: K,
|
|
287
|
+
"aria-label": "Show chats",
|
|
288
|
+
"aria-expanded": !1,
|
|
289
|
+
title: "Show chats",
|
|
280
290
|
"data-testid": "assistant-rail-toggle",
|
|
281
|
-
className: "inline-flex
|
|
282
|
-
children:
|
|
291
|
+
className: "inline-flex shrink-0 items-center gap-1.5 rounded-md border border-border-subtle px-2 py-1.5 text-xs font-medium 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 cursor-pointer",
|
|
292
|
+
children: [/* @__PURE__ */ f(re, { className: "size-4" }), "Chats"]
|
|
283
293
|
}) : /* @__PURE__ */ f("span", {
|
|
284
294
|
className: "inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-action-primary-bg/10 text-action-primary-bg",
|
|
285
295
|
children: /* @__PURE__ */ f(u, { className: "size-4" })
|
|
@@ -297,33 +307,33 @@ var b = ({ transport: h, title: g = "AI Assistant", subtitle: b = "Ask me to do
|
|
|
297
307
|
})]
|
|
298
308
|
}),
|
|
299
309
|
/* @__PURE__ */ f("div", {
|
|
300
|
-
ref:
|
|
310
|
+
ref: V,
|
|
301
311
|
className: "flex-1 space-y-3 overflow-y-auto px-4 py-4",
|
|
302
312
|
"data-testid": "assistant-widget-messages",
|
|
303
|
-
children:
|
|
313
|
+
children: E.length === 0 && me ? /* @__PURE__ */ p("div", {
|
|
304
314
|
"data-testid": "assistant-widget-restoring",
|
|
305
315
|
className: "flex h-full flex-col items-center justify-center gap-3 text-center",
|
|
306
316
|
children: [/* @__PURE__ */ f(c, { className: "size-5 animate-spin text-text-secondary" }), /* @__PURE__ */ f("p", {
|
|
307
317
|
className: "text-xs leading-relaxed text-text-secondary",
|
|
308
318
|
children: "Restoring your conversation…"
|
|
309
319
|
})]
|
|
310
|
-
}) :
|
|
320
|
+
}) : E.length === 0 ? /* @__PURE__ */ p("div", {
|
|
311
321
|
className: "flex h-full flex-col items-center justify-center gap-3 text-center",
|
|
312
322
|
children: [/* @__PURE__ */ f("span", {
|
|
313
323
|
className: "inline-flex size-12 items-center justify-center rounded-full bg-bg-sunken text-action-primary-bg",
|
|
314
324
|
children: /* @__PURE__ */ f(l, { className: "size-6" })
|
|
315
325
|
}), /* @__PURE__ */ f("p", {
|
|
316
326
|
className: "max-w-[16rem] text-xs leading-relaxed text-text-secondary",
|
|
317
|
-
children:
|
|
327
|
+
children: y
|
|
318
328
|
})]
|
|
319
|
-
}) :
|
|
329
|
+
}) : E.map((t) => /* @__PURE__ */ f("div", {
|
|
320
330
|
className: e("flex", t.role === "user" ? "justify-end" : "justify-start"),
|
|
321
331
|
children: /* @__PURE__ */ p("div", {
|
|
322
332
|
"data-testid": `assistant-widget-message-${t.role}`,
|
|
323
|
-
className: e("whitespace-pre-wrap break-words rounded-lg px-3 py-2 text-xs leading-relaxed",
|
|
333
|
+
className: e("whitespace-pre-wrap break-words rounded-lg px-3 py-2 text-xs leading-relaxed", W ? "max-w-[92%]" : "max-w-[85%]", t.role === "user" ? "bg-action-primary-bg text-action-primary-text" : t.error ? "bg-status-error-bg/10 text-status-error-bg" : "bg-bg-sunken text-text-primary"),
|
|
324
334
|
children: [t.content ? /* @__PURE__ */ f(n, {
|
|
325
335
|
content: t.content,
|
|
326
|
-
onNavigate:
|
|
336
|
+
onNavigate: pe
|
|
327
337
|
}) : null, t.pending ? /* @__PURE__ */ p("span", {
|
|
328
338
|
"data-testid": "assistant-widget-working",
|
|
329
339
|
className: e("inline-flex items-center gap-1 text-text-secondary", t.content ? "mt-1" : ""),
|
|
@@ -345,13 +355,13 @@ var b = ({ transport: h, title: g = "AI Assistant", subtitle: b = "Ask me to do
|
|
|
345
355
|
children: /* @__PURE__ */ f(te, { className: "size-4" })
|
|
346
356
|
}) : null,
|
|
347
357
|
/* @__PURE__ */ f("textarea", {
|
|
348
|
-
ref:
|
|
349
|
-
value:
|
|
350
|
-
onChange: (e) =>
|
|
358
|
+
ref: B,
|
|
359
|
+
value: O,
|
|
360
|
+
onChange: (e) => k(e.target.value),
|
|
351
361
|
onKeyDown: be,
|
|
352
362
|
onInput: xe,
|
|
353
363
|
rows: 1,
|
|
354
|
-
placeholder:
|
|
364
|
+
placeholder: de,
|
|
355
365
|
"aria-label": "Message the assistant",
|
|
356
366
|
"data-testid": "assistant-widget-input",
|
|
357
367
|
className: "flex-1 resize-none rounded-lg border border-border-default bg-bg-sunken px-3 py-2 text-xs leading-relaxed text-text-primary placeholder:text-text-muted focus:border-action-primary-bg focus:outline-none"
|
|
@@ -359,11 +369,11 @@ var b = ({ transport: h, title: g = "AI Assistant", subtitle: b = "Ask me to do
|
|
|
359
369
|
/* @__PURE__ */ f("button", {
|
|
360
370
|
type: "button",
|
|
361
371
|
onClick: () => void $(),
|
|
362
|
-
disabled:
|
|
372
|
+
disabled: A || O.trim().length === 0,
|
|
363
373
|
"aria-label": "Send message",
|
|
364
374
|
"data-testid": "assistant-widget-send",
|
|
365
375
|
className: "flex size-9 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:opacity-50 cursor-pointer",
|
|
366
|
-
children:
|
|
376
|
+
children: A ? /* @__PURE__ */ f(c, { className: "size-4 animate-spin" }) : /* @__PURE__ */ f(ae, { className: "size-4" })
|
|
367
377
|
})
|
|
368
378
|
]
|
|
369
379
|
})
|
|
@@ -372,4 +382,4 @@ var b = ({ transport: h, title: g = "AI Assistant", subtitle: b = "Ask me to do
|
|
|
372
382
|
}) : null] });
|
|
373
383
|
};
|
|
374
384
|
//#endregion
|
|
375
|
-
export { m as ASSISTANT_WIDGET_TOGGLE_EVENT,
|
|
385
|
+
export { m as ASSISTANT_WIDGET_TOGGLE_EVENT, y as AssistantWidget };
|