@levo-so/studio 0.1.112 → 0.1.113

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.
@@ -0,0 +1,944 @@
1
+ "use client";
2
+ import { a as e, i as t, r as n, t as r } from "./gradients-DfbdH7nO.js";
3
+ import { Children as i, createContext as a, isValidElement as o, useCallback as s, useContext as c, useEffect as l, useRef as u, useState as d } from "react";
4
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
5
+ import { ArrowUp as h, Check as g, ChevronDown as _, Copy as v, MessageSquarePlus as y, Mic as b, RefreshCw as x, Sparkles as S, Square as C, X as w } from "lucide-react";
6
+ import { ActionBarPrimitive as T, AssistantRuntimeProvider as E, ComposerPrimitive as D, MessagePrimitive as O, ThreadPrimitive as k, WebSpeechDictationAdapter as A, useAssistantRuntime as j, useMessage as M, useThread as N, useThreadComposer as P } from "@assistant-ui/react";
7
+ import { AssistantChatTransport as ee, useChatRuntime as te } from "@assistant-ui/react-ai-sdk";
8
+ import { MarkdownTextPrimitive as ne } from "@assistant-ui/react-markdown";
9
+ import re from "remark-gfm";
10
+ //#region ../../libraries/ai-chat/src/FollowUpChips.tsx
11
+ var F = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipClassName: i }) => {
12
+ if (e.length === 0) return null;
13
+ let a = [
14
+ "rounded-full border border-zinc-200 bg-white text-zinc-700",
15
+ "transition-all duration-150 hover:border-zinc-300 hover:bg-zinc-50 hover:text-zinc-900 active:scale-95",
16
+ n === "compact" ? "px-2.5 py-1 text-[11px] leading-none" : "px-3.5 py-1.5 text-xs"
17
+ ].join(" ");
18
+ return /* @__PURE__ */ p("div", {
19
+ className: ["flex flex-wrap gap-1.5", r].filter(Boolean).join(" "),
20
+ children: e.map((e, n) => /* @__PURE__ */ p("button", {
21
+ type: "button",
22
+ onClick: () => t(e),
23
+ className: ["ai-chat-chip", i ?? a].join(" "),
24
+ style: { animationDelay: `${n * 60}ms` },
25
+ children: e
26
+ }, `${n}-${e}`))
27
+ });
28
+ }, ie = ({ api: e, headers: t, credentials: n, getBody: r, getHeaders: i, onSendStart: a }) => new ee({
29
+ api: e,
30
+ headers: t,
31
+ credentials: n,
32
+ prepareSendMessagesRequest: async (e) => (a?.(), {
33
+ body: r(e),
34
+ headers: {
35
+ ...t,
36
+ ...i?.(e)
37
+ }
38
+ })
39
+ }), I = (t) => e("conv_id", t), ae = (e) => {
40
+ let t = I(e);
41
+ if (!t || typeof window > "u") return null;
42
+ try {
43
+ return window.sessionStorage.getItem(t)?.trim() || null;
44
+ } catch {
45
+ return null;
46
+ }
47
+ }, oe = (e, t) => {
48
+ let n = I(e);
49
+ if (!(!n || typeof window > "u")) try {
50
+ window.sessionStorage.setItem(n, t);
51
+ } catch {}
52
+ }, se = (e) => {
53
+ let t = I(e);
54
+ if (!(!t || typeof window > "u")) try {
55
+ window.sessionStorage.removeItem(t);
56
+ } catch {}
57
+ }, ce = (e) => {
58
+ let t = u(null), n = u(null), r = u(!1);
59
+ return (!r.current || n.current !== (e ?? null)) && (r.current = !0, n.current = e ?? null, t.current = ae(e)), {
60
+ conversationIdRef: t,
61
+ handleFinish: s(({ message: n }) => {
62
+ let r = n.metadata;
63
+ if (!r || typeof r != "object") return;
64
+ let i = r.conversation_id;
65
+ if (typeof i != "string") return;
66
+ let a = i.trim();
67
+ a.length !== 0 && t.current !== a && (t.current = a, oe(e, a));
68
+ }, [e]),
69
+ reset: s(() => {
70
+ t.current = null, se(e);
71
+ }, [e])
72
+ };
73
+ }, le = (e = []) => {
74
+ let [t, n] = d(e);
75
+ return {
76
+ followUps: t,
77
+ setFollowUps: n,
78
+ clearOnSend: s(() => n([]), []),
79
+ handleData: s((e) => {
80
+ if (e.type !== "data-follow_ups") return !1;
81
+ let t = e.data?.suggestions;
82
+ return Array.isArray(t) ? (n(t.filter((e) => typeof e == "string")), !0) : !1;
83
+ }, [])
84
+ };
85
+ }, ue = (e) => e instanceof Error && e.message.includes("intelligence.site_agent.NO_ACTIVE_AGENT"), L = a({ agentUnavailable: !1 }), de = () => c(L), fe = (...e) => e.filter(Boolean).join(" "), pe = "inline-flex items-center justify-center gap-1.5 transition-all duration-200", R = "rounded-full border border-zinc-200 bg-white/95 px-3 py-1.5 font-medium text-xs text-zinc-500 shadow-lg backdrop-blur-sm hover:text-zinc-900", z = ({ onClick: e, isRunning: t = !1, iconOnly: n = !1, className: r = R }) => /* @__PURE__ */ m("button", {
86
+ type: "button",
87
+ "aria-label": "Scroll to bottom",
88
+ onClick: e,
89
+ className: fe(pe, r),
90
+ children: [/* @__PURE__ */ p(_, { className: "h-3 w-3" }), !n && (t ? "New messages" : "Scroll to bottom")]
91
+ }), B = ({ endpoint: e, headers: t, fallback: n, enabled: r = !0 }) => {
92
+ let [i, a] = d(null), o = t ? JSON.stringify(t) : "", s = u(t);
93
+ s.current = t;
94
+ let c = u(n);
95
+ return c.current = n, l(() => {
96
+ if (!r || !e) {
97
+ a([...c.current]);
98
+ return;
99
+ }
100
+ let t = new AbortController();
101
+ return fetch(e, {
102
+ method: "GET",
103
+ headers: s.current,
104
+ credentials: "include",
105
+ signal: t.signal
106
+ }).then(async (e) => {
107
+ if (!e.ok) {
108
+ let t = await e.text().catch(() => "");
109
+ throw Error(`Suggestions request failed: ${e.status} ${t.slice(0, 200)}`);
110
+ }
111
+ let t = (await e.json())?.suggestions;
112
+ if (!Array.isArray(t) || !t.every((e) => typeof e == "string")) throw Error("Suggestions response shape invalid");
113
+ return t;
114
+ }).then((e) => {
115
+ t.signal.aborted || a(e.length > 0 ? e : [...c.current]);
116
+ }).catch((e) => {
117
+ t.signal.aborted || e instanceof Error && e.name === "AbortError" || a([...c.current]);
118
+ }), () => t.abort();
119
+ }, [
120
+ e,
121
+ r,
122
+ o
123
+ ]), i;
124
+ }, me = 36, he = 80, ge = ({ viewportRef: e, isRunning: t, onRunStart: n }) => {
125
+ let r = u(!1), [i, a] = d(!0), o = u(n);
126
+ return o.current = n, l(() => {
127
+ let n = r.current;
128
+ if (r.current = t, !t || n) return;
129
+ o.current?.();
130
+ let i = null, a = null;
131
+ return i = requestAnimationFrame(() => {
132
+ a = requestAnimationFrame(() => {
133
+ let t = e.current;
134
+ if (!t) return;
135
+ let n = Math.max(0, t.scrollHeight - t.clientHeight - me);
136
+ n > t.clientHeight * .3 && t.scrollTo({
137
+ top: n,
138
+ behavior: "smooth"
139
+ });
140
+ });
141
+ }), () => {
142
+ i !== null && cancelAnimationFrame(i), a !== null && cancelAnimationFrame(a);
143
+ };
144
+ }, [t, e]), l(() => {
145
+ let t = e.current;
146
+ if (!t) return;
147
+ let n = () => {
148
+ a(t.scrollHeight - t.scrollTop - t.clientHeight < he);
149
+ };
150
+ t.addEventListener("scroll", n, { passive: !0 });
151
+ let r = new ResizeObserver(n);
152
+ for (let e of t.children) r.observe(e);
153
+ return () => {
154
+ t.removeEventListener("scroll", n), r.disconnect();
155
+ };
156
+ }, [e]), {
157
+ isAtBottom: i,
158
+ scrollToBottom: () => {
159
+ let t = e.current;
160
+ t && t.scrollTo({
161
+ top: t.scrollHeight,
162
+ behavior: "smooth"
163
+ });
164
+ }
165
+ };
166
+ }, V = (...e) => e.filter(Boolean).join(" "), _e = ({ onStop: e }) => /* @__PURE__ */ p("button", {
167
+ type: "button",
168
+ onClick: e,
169
+ "aria-label": "Stop generating",
170
+ className: "flex h-9 w-9 items-center justify-center rounded-md shadow-md transition-all duration-150 hover:scale-110 active:scale-95",
171
+ style: {
172
+ backgroundColor: "var(--color-brand, #0a0a0a)",
173
+ color: "var(--color-brand-foreground, #fff)"
174
+ },
175
+ children: /* @__PURE__ */ p(C, { className: "h-3.5 w-3.5 fill-current" })
176
+ }), H = () => /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(D.If, {
177
+ dictation: !1,
178
+ children: /* @__PURE__ */ p(D.Dictate, {
179
+ className: "flex h-8 w-8 items-center justify-center rounded-md text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-900",
180
+ children: /* @__PURE__ */ p(b, { className: "h-4 w-4" })
181
+ })
182
+ }), /* @__PURE__ */ p(D.If, {
183
+ dictation: !0,
184
+ children: /* @__PURE__ */ p(D.StopDictation, {
185
+ className: "flex h-8 w-8 animate-pulse items-center justify-center rounded-md bg-red-500/15 text-red-500 transition-colors hover:bg-red-500/25",
186
+ children: /* @__PURE__ */ p(C, { className: "h-3 w-3 fill-current" })
187
+ })
188
+ })] }), U = () => /* @__PURE__ */ p(D.Send, {
189
+ "aria-label": "Send message",
190
+ className: "flex h-9 w-9 items-center justify-center rounded-md shadow-md transition-all duration-300 hover:scale-110 active:scale-95 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none disabled:hover:scale-100",
191
+ style: {
192
+ backgroundColor: "var(--color-brand, #0a0a0a)",
193
+ color: "var(--color-brand-foreground, #fff)"
194
+ },
195
+ children: /* @__PURE__ */ p(h, { className: "h-5 w-5 stroke-[2.5px]" })
196
+ }), W = ({ hasText: e, onStop: t, onStopAndSend: n }) => /* @__PURE__ */ m("div", {
197
+ className: "flex items-center gap-1.5",
198
+ children: [/* @__PURE__ */ p(_e, { onStop: t }), e && /* @__PURE__ */ p("button", {
199
+ type: "button",
200
+ onClick: n,
201
+ "aria-label": "Stop and send new message",
202
+ title: "Stop the current response and send",
203
+ className: "flex h-9 w-9 items-center justify-center rounded-md shadow-md transition-all duration-150 hover:scale-110 active:scale-95",
204
+ style: {
205
+ backgroundColor: "var(--color-brand, #0a0a0a)",
206
+ color: "var(--color-brand-foreground, #fff)"
207
+ },
208
+ children: /* @__PURE__ */ p(h, { className: "h-5 w-5 stroke-[2.5px]" })
209
+ })]
210
+ }), G = ({ variant: e, isRunning: t, onStop: r, onStopAndSend: i }) => {
211
+ let a = P((e) => e.text.trim().length > 0), o = (e) => {
212
+ e.nativeEvent.isComposing || t && e.key === "Enter" && !e.shiftKey && (e.preventDefault(), a && i());
213
+ };
214
+ return e === "expanded" ? /* @__PURE__ */ m("div", {
215
+ className: "rounded-lg border border-zinc-200 bg-white shadow-sm transition-colors focus-within:border-[var(--color-brand,#a1a1aa)]",
216
+ children: [/* @__PURE__ */ p(D.Input, {
217
+ className: V("ai-chat-textarea w-full resize-none overflow-y-auto bg-transparent px-6 pt-4 text-sm text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", "max-h-[160px]"),
218
+ placeholder: "Ask anything about this site…",
219
+ rows: 1,
220
+ submitMode: "enter",
221
+ onInput: (e) => n(e.currentTarget),
222
+ onKeyDown: o
223
+ }), /* @__PURE__ */ m("div", {
224
+ className: "flex items-center justify-between px-3 pt-1 pb-2",
225
+ children: [/* @__PURE__ */ p(H, {}), t ? /* @__PURE__ */ p(W, {
226
+ hasText: a,
227
+ onStop: r,
228
+ onStopAndSend: i
229
+ }) : /* @__PURE__ */ p(U, {})]
230
+ })]
231
+ }) : /* @__PURE__ */ m("div", {
232
+ className: "flex items-end gap-2 rounded-lg border border-zinc-200 bg-white p-2 shadow-sm transition-colors focus-within:border-[var(--color-brand,#a1a1aa)]",
233
+ children: [
234
+ /* @__PURE__ */ p(D.Input, {
235
+ className: V("ai-chat-textarea min-w-0 flex-1 resize-none overflow-y-auto bg-transparent px-2 py-1.5 text-sm text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", "max-h-[120px]"),
236
+ placeholder: "Ask a follow-up…",
237
+ rows: 1,
238
+ submitMode: "enter",
239
+ onInput: (e) => n(e.currentTarget),
240
+ onKeyDown: o
241
+ }),
242
+ /* @__PURE__ */ p(H, {}),
243
+ t ? /* @__PURE__ */ p(W, {
244
+ hasText: a,
245
+ onStop: r,
246
+ onStopAndSend: i
247
+ }) : /* @__PURE__ */ p(U, {})
248
+ ]
249
+ });
250
+ }, ve = "rounded-2xl border border-zinc-200 bg-zinc-100 px-3.5 py-2.5", ye = "ai-chat-textarea w-full resize-none bg-transparent text-sm text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", be = "rounded-lg px-3 py-1.5 text-xs text-zinc-500 transition-colors hover:bg-zinc-100", xe = "rounded-lg px-3 py-1.5 text-xs transition-opacity hover:opacity-80", Se = ({ autoGrowMax: e, boxClassName: t = ve, inputClassName: r = ye, cancelClassName: i = be, sendClassName: a = xe, sendStyle: o }) => /* @__PURE__ */ p(O.Root, {
251
+ className: "mb-4 pr-12 pl-0",
252
+ children: /* @__PURE__ */ m(D.Root, { children: [/* @__PURE__ */ p("div", {
253
+ className: t,
254
+ children: /* @__PURE__ */ p(D.Input, {
255
+ className: r,
256
+ rows: 1,
257
+ onInput: (t) => n(t.currentTarget, e)
258
+ })
259
+ }), /* @__PURE__ */ m("div", {
260
+ className: "mt-2 flex justify-end gap-2",
261
+ children: [/* @__PURE__ */ p(D.Cancel, {
262
+ className: i,
263
+ children: "Cancel"
264
+ }), /* @__PURE__ */ p(D.Send, {
265
+ className: a,
266
+ style: o,
267
+ children: "Save & Submit"
268
+ })]
269
+ })] })
270
+ }), K = ({ idleClassName: e = "text-zinc-500 hover:text-zinc-900", copiedClassName: t = "text-emerald-500", errorClassName: n = "text-rose-500", className: r = "rounded p-1.5 transition-colors", iconClassName: i = "h-3 w-3" }) => {
271
+ let [a, o] = d("idle"), s = M();
272
+ l(() => {
273
+ if (a === "idle") return;
274
+ let e = setTimeout(() => o("idle"), 1500);
275
+ return () => clearTimeout(e);
276
+ }, [a]);
277
+ let c = async () => {
278
+ let e = s.content.filter((e) => e.type === "text").map((e) => e.text).join("");
279
+ try {
280
+ await navigator.clipboard.writeText(e), o("copied");
281
+ } catch {
282
+ o("error");
283
+ }
284
+ }, u = a === "copied" ? t ?? e : a === "error" ? n ?? e : e, f = a === "copied" ? "Copied" : a === "error" ? "Copy failed" : "Copy message", m = a === "copied" ? g : a === "error" ? w : v;
285
+ return /* @__PURE__ */ p("button", {
286
+ type: "button",
287
+ "aria-label": f,
288
+ onClick: c,
289
+ className: [r, u].filter(Boolean).join(" "),
290
+ children: /* @__PURE__ */ p(m, { className: i })
291
+ });
292
+ }, Ce = ({ children: e }) => {
293
+ let [t, n] = d(!1), r = "plaintext", a = "";
294
+ return i.forEach(e, (e) => {
295
+ if (o(e)) {
296
+ let t = e.props, n = /language-(\w+)/.exec(t.className ?? "");
297
+ n && (r = n[1] ?? r), typeof t.children == "string" && (a = t.children.trim());
298
+ }
299
+ }), /* @__PURE__ */ m("div", {
300
+ className: "ai-chat-code not-prose my-4 overflow-hidden rounded-xl border",
301
+ children: [/* @__PURE__ */ m("div", {
302
+ className: "ai-chat-code__header flex items-center justify-between px-4 py-2",
303
+ children: [/* @__PURE__ */ p("span", {
304
+ className: "ai-chat-code__label font-mono text-[10px] uppercase tracking-widest",
305
+ children: r
306
+ }), /* @__PURE__ */ p("button", {
307
+ type: "button",
308
+ onClick: () => navigator.clipboard.writeText(a).then(() => {
309
+ n(!0), setTimeout(() => n(!1), 2e3);
310
+ }).catch(() => {}),
311
+ className: "ai-chat-code__copy flex items-center gap-1.5 rounded px-2 py-0.5 text-[10px] transition-colors",
312
+ children: t ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(g, { className: "h-3 w-3 text-emerald-500" }), /* @__PURE__ */ p("span", { children: "Copied!" })] }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(v, { className: "h-3 w-3" }), /* @__PURE__ */ p("span", { children: "Copy" })] })
313
+ })]
314
+ }), /* @__PURE__ */ p("pre", {
315
+ className: "ai-chat-code__pre overflow-x-auto px-4 py-4 font-mono text-sm leading-relaxed",
316
+ children: e
317
+ })]
318
+ });
319
+ }, we = (e) => /* @__PURE__ */ p("a", {
320
+ ...e,
321
+ target: "_blank",
322
+ rel: "noopener noreferrer"
323
+ }), Te = () => /* @__PURE__ */ p(ne, {
324
+ remarkPlugins: [re],
325
+ components: {
326
+ pre: Ce,
327
+ a: we
328
+ }
329
+ }), Ee = [
330
+ "Thinking",
331
+ "Pondering",
332
+ "Drafting",
333
+ "Reasoning",
334
+ "Composing",
335
+ "Cogitating",
336
+ "Synthesizing",
337
+ "Weighing words",
338
+ "Brewing",
339
+ "Sketching",
340
+ "Untangling",
341
+ "Threading the needle",
342
+ "Lining up ideas"
343
+ ], De = (e) => {
344
+ let t = Math.floor(e / 60), n = e % 60;
345
+ return t > 0 ? `${t}m ${n.toString().padStart(2, "0")}s` : `${n}s`;
346
+ }, Oe = ({ phrases: e = Ee, textClassName: t = "ai-thinking-text", timerClassName: n = "text-xs text-zinc-500/70 tabular-nums", longRunningClassName: r = "ml-1.5 text-zinc-500/45", longRunningHint: i = "· hang tight" }) => {
347
+ let [a, o] = d(() => e.length > 0 ? Math.floor(Math.random() * e.length) : 0), [s, c] = d(0);
348
+ l(() => {
349
+ let t = e.length > 0 ? setInterval(() => {
350
+ o((t) => (t + 1) % e.length);
351
+ }, 2800) : null, n = setInterval(() => {
352
+ c((e) => e + 1);
353
+ }, 1e3);
354
+ return () => {
355
+ t !== null && clearInterval(t), clearInterval(n);
356
+ };
357
+ }, [e.length]);
358
+ let u = e[a] ?? "Thinking", f = s >= 3, h = s >= 30;
359
+ return /* @__PURE__ */ m("div", {
360
+ className: "flex items-center gap-3 py-1",
361
+ children: [
362
+ /* @__PURE__ */ m("div", {
363
+ className: "ai-dust",
364
+ children: [
365
+ /* @__PURE__ */ p("span", { style: {
366
+ left: "4px",
367
+ "--delay": ".3s"
368
+ } }),
369
+ /* @__PURE__ */ p("span", { style: {
370
+ left: "12px",
371
+ "--delay": "0s"
372
+ } }),
373
+ /* @__PURE__ */ p("span", { style: {
374
+ left: "20px",
375
+ "--delay": ".6s"
376
+ } })
377
+ ]
378
+ }),
379
+ /* @__PURE__ */ m("span", {
380
+ className: `${t} font-semibold text-sm transition-opacity duration-500`,
381
+ children: [u, "…"]
382
+ }),
383
+ f && /* @__PURE__ */ m("span", {
384
+ className: n,
385
+ children: [De(s), h && /* @__PURE__ */ p("span", {
386
+ className: r,
387
+ children: i
388
+ })]
389
+ })
390
+ ]
391
+ });
392
+ }, ke = () => null, Ae = "max-w-none text-sm text-zinc-900 leading-relaxed [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&_a:hover]:text-sky-700 [&_a]:break-words [&_a]:font-medium [&_a]:text-sky-600 [&_a]:underline [&_a]:underline-offset-2 [&_li]:text-sm [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-2 [&_p]:text-sm [&_strong]:font-semibold [&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5", je = "text-xs text-zinc-500/60", Me = "rounded p-1.5 text-zinc-500 transition-colors hover:text-zinc-900", Ne = ({ tools: e = ke, Parts: n, thinkingIndicator: r = /* @__PURE__ */ p(Oe, {}), contentClassName: i = Ae, wrapContent: a, metaSlot: o, copyIdleClassName: s, copyCopiedClassName: c, reloadClassName: l = Me, timeClassName: u = je, timeFormatOptions: d, readOnly: f = !1, belowContent: h }) => {
393
+ let g = M(), _ = n ?? O.Content, v = g.status?.type === "running", y = /* @__PURE__ */ p("div", {
394
+ className: i,
395
+ children: /* @__PURE__ */ p(_, { components: {
396
+ Text: Te,
397
+ tools: { Fallback: e }
398
+ } })
399
+ });
400
+ return /* @__PURE__ */ p(O.Root, {
401
+ className: "group pr-4 pb-6",
402
+ children: /* @__PURE__ */ m("div", {
403
+ className: "flex min-w-0 flex-col",
404
+ children: [
405
+ a ? a(y) : y,
406
+ v && /* @__PURE__ */ p("div", {
407
+ className: "mt-1",
408
+ children: r
409
+ }),
410
+ !v && h && /* @__PURE__ */ p("div", {
411
+ className: "mt-2",
412
+ children: h
413
+ }),
414
+ !v && /* @__PURE__ */ m("div", {
415
+ className: "mt-2 flex items-center gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
416
+ children: [
417
+ /* @__PURE__ */ p("span", {
418
+ className: u,
419
+ children: t(g.createdAt, d)
420
+ }),
421
+ o,
422
+ /* @__PURE__ */ m(T.Root, {
423
+ className: "flex items-center gap-0.5",
424
+ children: [/* @__PURE__ */ p(K, {
425
+ idleClassName: s,
426
+ copiedClassName: c
427
+ }), !f && /* @__PURE__ */ p(T.Reload, {
428
+ className: l,
429
+ children: /* @__PURE__ */ p(x, { className: "h-3 w-3" })
430
+ })]
431
+ })
432
+ ]
433
+ })
434
+ ]
435
+ })
436
+ });
437
+ }, Pe = "rounded-2xl border border-zinc-200 bg-zinc-100 px-3.5 py-2.5 text-sm text-zinc-900 leading-relaxed", Fe = "text-xs text-zinc-500/60", Ie = "rounded px-2 py-1 font-medium text-xs text-zinc-500 transition-colors hover:text-zinc-900", Le = ({ attachmentsSlot: e, bubbleClassName: n = Pe, timeClassName: r = Fe, editClassName: i = Ie, copyIdleClassName: a, copyCopiedClassName: o, timeFormatOptions: s, readOnly: c = !1 }) => {
438
+ let l = M();
439
+ return /* @__PURE__ */ m(O.Root, {
440
+ className: "group flex flex-col items-end pb-4 pl-12",
441
+ "data-user-message": "true",
442
+ children: [
443
+ e,
444
+ /* @__PURE__ */ p("div", {
445
+ className: n,
446
+ children: /* @__PURE__ */ p(O.Content, {})
447
+ }),
448
+ /* @__PURE__ */ m("div", {
449
+ className: "mt-1 flex items-center gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
450
+ children: [/* @__PURE__ */ p("span", {
451
+ className: r,
452
+ children: t(l.createdAt, s)
453
+ }), /* @__PURE__ */ m(T.Root, {
454
+ className: "flex items-center gap-0.5",
455
+ children: [/* @__PURE__ */ p(K, {
456
+ idleClassName: a,
457
+ copiedClassName: o
458
+ }), !c && /* @__PURE__ */ p(T.Edit, {
459
+ className: i,
460
+ children: "Edit"
461
+ })]
462
+ })]
463
+ })
464
+ ]
465
+ });
466
+ }, Re = () => /* @__PURE__ */ p(Se, { sendStyle: {
467
+ backgroundColor: "var(--color-brand, #0a0a0a)",
468
+ color: "var(--color-brand-foreground, #fff)"
469
+ } }), ze = [
470
+ "What do you offer?",
471
+ "How much does it cost?",
472
+ "Why should I choose you?",
473
+ "How do I get in touch?"
474
+ ], Be = [
475
+ "w-3/4",
476
+ "w-4/5",
477
+ "w-2/3",
478
+ "w-3/5"
479
+ ], q = ({ workspaceId: e, siteName: t, siteLogo: n, apiBaseUrl: r, authHeaders: i, followUps: a, hideComposer: o = !1 }) => {
480
+ let c = j(), d = N((e) => e.isRunning), { agentUnavailable: f } = de(), h = u(null), { isAtBottom: g, scrollToBottom: _ } = ge({
481
+ viewportRef: h,
482
+ isRunning: d
483
+ }), v = B({
484
+ endpoint: e ? `${r}/suggestions` : void 0,
485
+ headers: e ? {
486
+ ...i,
487
+ "Levo-Workspace": e
488
+ } : void 0,
489
+ fallback: ze
490
+ }), y = s((e) => {
491
+ c.thread.composer.setText(e), c.thread.composer.send();
492
+ }, [c]), b = s(() => c.thread.cancelRun(), [c]), x = s(() => {
493
+ c.thread.cancelRun(), setTimeout(() => c.thread.composer.send(), 0);
494
+ }, [c]), S = u(d);
495
+ return l(() => {
496
+ S.current = d;
497
+ }, [d]), l(() => {
498
+ let e = (e) => {
499
+ e.key !== "Escape" || e.isComposing || !S.current || (e.preventDefault(), e.stopImmediatePropagation(), c.thread.cancelRun());
500
+ };
501
+ return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
502
+ }, [c]), /* @__PURE__ */ m(k.Root, {
503
+ className: "relative flex flex-1 flex-col overflow-hidden",
504
+ children: [
505
+ /* @__PURE__ */ p(k.If, {
506
+ empty: !0,
507
+ children: /* @__PURE__ */ p("div", {
508
+ className: "pointer-events-none absolute inset-0 z-0 overflow-hidden",
509
+ children: /* @__PURE__ */ p("div", {
510
+ className: "absolute inset-0",
511
+ style: { background: ["radial-gradient(at 12% 18%, color-mix(in oklch, var(--color-brand, #4691e8) 12%, transparent) 0px, transparent 55%)", "radial-gradient(at 88% 82%, color-mix(in oklch, var(--color-brand-secondary, #db646d) 8%, transparent) 0px, transparent 55%)"].join(", ") }
512
+ })
513
+ })
514
+ }),
515
+ f && /* @__PURE__ */ p("div", {
516
+ role: "alert",
517
+ className: "relative z-20 shrink-0 border-amber-200 border-b bg-amber-50 px-4 py-2.5 text-amber-800 text-xs",
518
+ children: "This conversation is no longer available. Please refresh the page to start a new chat."
519
+ }),
520
+ /* @__PURE__ */ m(k.Viewport, {
521
+ ref: h,
522
+ turnAnchor: "top",
523
+ className: "relative z-10 flex-1 overflow-y-auto",
524
+ autoScroll: !1,
525
+ scrollToBottomOnRunStart: !1,
526
+ scrollToBottomOnInitialize: !1,
527
+ scrollToBottomOnThreadSwitch: !1,
528
+ children: [/* @__PURE__ */ p(k.Empty, { children: /* @__PURE__ */ m("div", {
529
+ className: "flex min-h-full flex-col items-center justify-center px-6 py-6",
530
+ children: [/* @__PURE__ */ m("div", {
531
+ className: "mb-5 flex flex-col items-center gap-2 text-center",
532
+ children: [
533
+ n ? /* @__PURE__ */ p("img", {
534
+ src: n,
535
+ alt: t ?? "Site logo",
536
+ className: "mb-1 h-12 w-auto max-w-[180px] object-contain"
537
+ }) : /* @__PURE__ */ p("span", {
538
+ className: "font-semibold text-lg text-zinc-900 tracking-tight",
539
+ children: t ?? "This site"
540
+ }),
541
+ /* @__PURE__ */ p("p", {
542
+ className: "mt-1 text-2xl text-zinc-900 tracking-tight",
543
+ style: {
544
+ fontFamily: "var(--font-heading, inherit)",
545
+ fontWeight: 600
546
+ },
547
+ children: "Ask anything"
548
+ }),
549
+ /* @__PURE__ */ p("p", {
550
+ className: "text-sm text-zinc-500",
551
+ style: { fontFamily: "var(--font-heading, inherit)" },
552
+ children: "Get instant answers about products, pricing, and how to get started."
553
+ })
554
+ ]
555
+ }), /* @__PURE__ */ p("div", {
556
+ className: "flex w-full max-w-md flex-col gap-2",
557
+ children: v === null ? Be.map((e, t) => /* @__PURE__ */ p("div", {
558
+ className: "flex h-[42px] items-center rounded-lg border border-zinc-200 bg-white px-4",
559
+ children: /* @__PURE__ */ p("span", { className: `block h-3 animate-pulse rounded bg-zinc-200 ${e}` })
560
+ }, `skeleton-${t}`)) : v.map((e) => /* @__PURE__ */ p("button", {
561
+ type: "button",
562
+ onClick: () => y(e),
563
+ className: "rounded-lg border border-zinc-200 bg-white px-4 py-2.5 text-left text-sm text-zinc-700 transition-colors hover:border-zinc-300 hover:bg-zinc-50",
564
+ children: e
565
+ }, e))
566
+ })]
567
+ }) }), /* @__PURE__ */ p(k.If, {
568
+ empty: !1,
569
+ children: /* @__PURE__ */ p("div", {
570
+ className: "mx-auto max-w-3xl px-6 py-6 pt-8",
571
+ children: /* @__PURE__ */ p(k.Messages, { components: {
572
+ UserMessage: Le,
573
+ AssistantMessage: Ne,
574
+ EditComposer: Re
575
+ } })
576
+ })
577
+ })]
578
+ }),
579
+ !o && /* @__PURE__ */ p("div", {
580
+ className: "relative z-10 shrink-0 border-zinc-200 border-t bg-white/95 backdrop-blur-sm",
581
+ children: /* @__PURE__ */ m("div", {
582
+ className: "relative mx-auto max-w-3xl px-4 pt-3 pb-3",
583
+ children: [
584
+ !g && /* @__PURE__ */ p("div", {
585
+ className: "pointer-events-none absolute inset-x-0 -top-9 z-20 flex justify-center",
586
+ children: /* @__PURE__ */ p(z, {
587
+ onClick: _,
588
+ isRunning: d,
589
+ className: "pointer-events-auto rounded-full border border-zinc-200 bg-white/95 px-3 py-1.5 font-medium text-xs text-zinc-500 shadow-lg backdrop-blur-sm hover:text-zinc-900"
590
+ })
591
+ }),
592
+ a.length > 0 && !d && /* @__PURE__ */ p("div", {
593
+ className: "mb-2",
594
+ children: /* @__PURE__ */ p(F, {
595
+ chips: a,
596
+ onSelect: y,
597
+ size: "compact"
598
+ })
599
+ }),
600
+ /* @__PURE__ */ m(D.Root, { children: [
601
+ /* @__PURE__ */ p(k.If, {
602
+ empty: !0,
603
+ children: /* @__PURE__ */ p(G, {
604
+ variant: "expanded",
605
+ isRunning: d,
606
+ onStop: b,
607
+ onStopAndSend: x
608
+ })
609
+ }),
610
+ /* @__PURE__ */ p(k.If, {
611
+ empty: !1,
612
+ children: /* @__PURE__ */ p(G, {
613
+ variant: "compact",
614
+ isRunning: d,
615
+ onStop: b,
616
+ onStopAndSend: x
617
+ })
618
+ }),
619
+ /* @__PURE__ */ p(D.If, {
620
+ dictation: !0,
621
+ children: /* @__PURE__ */ m("div", {
622
+ className: "mt-2 flex items-center justify-center gap-2",
623
+ children: [/* @__PURE__ */ p("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-red-500" }), /* @__PURE__ */ p("span", {
624
+ className: "font-medium text-red-500 text-xs tracking-wide",
625
+ children: "Listening… speak now"
626
+ })]
627
+ })
628
+ })
629
+ ] }),
630
+ /* @__PURE__ */ p(k.If, {
631
+ empty: !1,
632
+ children: /* @__PURE__ */ p("p", {
633
+ className: "mt-2 text-center text-[10px] text-zinc-500/70",
634
+ children: "Answers can be inaccurate. Verify before relying on them."
635
+ })
636
+ })
637
+ ]
638
+ })
639
+ })
640
+ ]
641
+ });
642
+ }, J = 4096, Ve = 400, He = 300, Ue = 2e3, We = (e) => document.querySelector(e)?.content?.trim() || void 0, Y = (e) => {
643
+ for (let t of e) {
644
+ let e = We(t);
645
+ if (e) return e;
646
+ }
647
+ }, X = (e, t) => e.length > t ? `${e.slice(0, t - 1).trimEnd()}…` : e, Z = (e) => JSON.stringify(e).length, Ge = () => {
648
+ if (typeof window > "u" || typeof document > "u") return;
649
+ let e = {}, t = window.location?.href;
650
+ t && (e.url = t);
651
+ let n = document.title?.trim() || Y(["meta[property=\"og:title\"]", "meta[name=\"twitter:title\"]"]);
652
+ n && (e.page_title = X(n, He));
653
+ let r = Y([
654
+ "meta[name=\"description\"]",
655
+ "meta[property=\"og:description\"]",
656
+ "meta[name=\"twitter:description\"]"
657
+ ]);
658
+ r && (e.description = X(r, Ve));
659
+ let i = document.referrer?.trim();
660
+ if (i && (e.referrer = i), Object.keys(e).length !== 0) return e.description && Z(e) > J && delete e.description, e.referrer && Z(e) > J && delete e.referrer, e.url && Z(e) > J && (e.url = e.url.slice(0, Ue)), e;
661
+ }, Q = ({ workspaceId: e, siteName: t, siteLogo: n, agentId: r, apiBaseUrl: i, authHeaders: a, children: o }) => {
662
+ let c = u(e);
663
+ c.current = e;
664
+ let l = u(r);
665
+ l.current = r;
666
+ let { followUps: f, clearOnSend: m, handleData: h } = le(), [g, _] = d(!1), { conversationIdRef: v, handleFinish: y, reset: b } = ce(r ? `${e ?? ""}:${r}` : e), x = te({
667
+ transport: ie({
668
+ api: `${i}/stream`,
669
+ credentials: "include",
670
+ headers: a,
671
+ onSendStart: () => {
672
+ m(), _(!1);
673
+ },
674
+ getHeaders: () => {
675
+ let e = {};
676
+ return c.current && (e["Levo-Workspace"] = c.current), e;
677
+ },
678
+ getBody: (e) => {
679
+ let t = {
680
+ messages: e.messages,
681
+ workspace_id: c.current
682
+ };
683
+ v.current && (t.conversation_id = v.current), l.current && (t.agent_id = l.current);
684
+ let n = Ge();
685
+ return n && (t.context = n), t;
686
+ }
687
+ }),
688
+ adapters: { dictation: new A() },
689
+ onData: h,
690
+ onFinish: y,
691
+ onError: (e) => {
692
+ ue(e) ? _(!0) : console.warn("[levo-kb-chat] stream error:", e);
693
+ }
694
+ }), S = s(() => {
695
+ x.threads.switchToNewThread().catch((e) => {
696
+ console.warn("[levo-kb-chat] switchToNewThread failed:", e);
697
+ }), b(), m(), _(!1);
698
+ }, [
699
+ x,
700
+ b,
701
+ m
702
+ ]);
703
+ return /* @__PURE__ */ p(E, {
704
+ runtime: x,
705
+ children: /* @__PURE__ */ p(L.Provider, {
706
+ value: { agentUnavailable: g },
707
+ children: o ? o({
708
+ followUps: f,
709
+ onResetChat: S
710
+ }) : /* @__PURE__ */ p(q, {
711
+ workspaceId: e,
712
+ siteName: t,
713
+ siteLogo: n,
714
+ apiBaseUrl: i,
715
+ authHeaders: a,
716
+ followUps: f
717
+ })
718
+ })
719
+ });
720
+ }, $ = (...e) => e.filter(Boolean).join(" "), Ke = (e) => /* @__PURE__ */ p(Je, { ...e }), qe = (e) => {
721
+ let [t, n] = d(!1);
722
+ return l(() => {
723
+ if (!e) return;
724
+ let t = requestAnimationFrame(() => n(!0));
725
+ return () => cancelAnimationFrame(t);
726
+ }, [e]), [t, n];
727
+ }, Je = ({ workspaceId: e, siteName: t, siteLogo: n, siteIcon: i, agentId: a, apiBaseUrl: o, authHeaders: s, initialOpen: c, initialDraft: d }) => {
728
+ let [f, m] = qe(c), h = `kb-chat-panel-${e ?? "default"}`, g = u(null), _ = u(null);
729
+ l(() => {
730
+ if (!f) return;
731
+ let e = (e) => {
732
+ if (e.key !== "Escape" || e.isComposing) return;
733
+ let t = _.current;
734
+ if (t?.isRunning) {
735
+ t.cancelRun();
736
+ return;
737
+ }
738
+ m(!1);
739
+ }, t = (e) => {
740
+ let t = e.composedPath();
741
+ g.current && !t.includes(g.current) && m(!1);
742
+ };
743
+ return window.addEventListener("keydown", e, !0), document.addEventListener("mousedown", t), () => {
744
+ window.removeEventListener("keydown", e, !0), document.removeEventListener("mousedown", t);
745
+ };
746
+ }, [f, m]);
747
+ let v = t ? `Ask ${t}` : "Ask AI";
748
+ return /* @__PURE__ */ p("div", {
749
+ ref: g,
750
+ className: $("ai-chat-launcher fixed bottom-8 left-1/2 z-[60] -translate-x-1/2 transition-all duration-500 ease-out", f ? "w-[min(36rem,calc(100vw-2.5rem))]" : "w-64"),
751
+ children: /* @__PURE__ */ p("div", {
752
+ className: "relative rounded-xl p-[2px] shadow-2xl",
753
+ style: { background: r },
754
+ children: /* @__PURE__ */ p("div", {
755
+ className: $("flex flex-col overflow-hidden rounded-xl bg-white transition-all duration-500 ease-out", f ? "max-h-[80vh]" : "max-h-[46px]"),
756
+ children: /* @__PURE__ */ p(Q, {
757
+ workspaceId: e,
758
+ siteName: t,
759
+ siteLogo: n,
760
+ agentId: a,
761
+ apiBaseUrl: o,
762
+ authHeaders: s,
763
+ children: ({ followUps: r, onResetChat: a }) => /* @__PURE__ */ p(Xe, {
764
+ open: f,
765
+ onToggle: () => m((e) => !e),
766
+ threadStateRef: _,
767
+ onResetChat: a,
768
+ askLabel: v,
769
+ panelId: h,
770
+ siteName: t,
771
+ siteIcon: i,
772
+ initialDraft: d,
773
+ followUps: r,
774
+ thread: /* @__PURE__ */ p(q, {
775
+ workspaceId: e,
776
+ siteName: t,
777
+ siteLogo: n,
778
+ apiBaseUrl: o,
779
+ authHeaders: s,
780
+ followUps: r,
781
+ hideComposer: !0
782
+ })
783
+ })
784
+ })
785
+ })
786
+ })
787
+ });
788
+ }, Ye = [
789
+ "rounded-full border border-zinc-200 bg-white text-zinc-700",
790
+ "px-3 py-1 text-[13px] leading-snug",
791
+ "transition-all duration-150 hover:border-zinc-300 hover:bg-zinc-50 hover:text-zinc-900 active:scale-95"
792
+ ].join(" "), Xe = ({ open: e, onToggle: t, threadStateRef: r, onResetChat: i, askLabel: a, panelId: o, siteName: c, siteIcon: u, initialDraft: d, followUps: g, thread: _ }) => {
793
+ let v = j(), x = N((e) => e.isRunning);
794
+ l(() => (r.current = {
795
+ isRunning: x,
796
+ cancelRun: () => v.thread.cancelRun()
797
+ }, () => {
798
+ r.current = null;
799
+ }), [
800
+ x,
801
+ v,
802
+ r
803
+ ]);
804
+ let T = N((e) => e.messages.length > 0), E = P((e) => e.text.trim().length > 0), O = s(() => {
805
+ v.thread.cancelRun(), setTimeout(() => v.thread.composer.send(), 0);
806
+ }, [v]);
807
+ l(() => {
808
+ d && v.thread.composer.setText(d);
809
+ }, []);
810
+ let k = s((e) => {
811
+ v.thread.composer.setText(e), v.thread.composer.send();
812
+ }, [v]), A = c ?? "Ask AI";
813
+ return /* @__PURE__ */ m(f, { children: [
814
+ /* @__PURE__ */ m("header", {
815
+ className: $("flex w-full shrink-0 items-center justify-between gap-2 overflow-hidden border-zinc-100 border-b bg-white px-3 transition-all duration-500 ease-out", e ? "h-12 opacity-100" : "pointer-events-none h-0 opacity-0"),
816
+ children: [/* @__PURE__ */ m("div", {
817
+ className: "flex min-w-0 items-center gap-2",
818
+ children: [u ? /* @__PURE__ */ p("img", {
819
+ src: u,
820
+ alt: "",
821
+ className: "h-6 w-6 shrink-0 rounded-sm object-contain"
822
+ }) : null, /* @__PURE__ */ p("span", {
823
+ className: "truncate font-semibold text-sm text-zinc-900",
824
+ children: A
825
+ })]
826
+ }), /* @__PURE__ */ m("div", {
827
+ className: "flex flex-shrink-0 items-center gap-1",
828
+ children: [T && /* @__PURE__ */ p("button", {
829
+ type: "button",
830
+ onClick: i,
831
+ "aria-label": "Start new chat",
832
+ title: "Start new chat",
833
+ className: "ai-chat-icon-btn flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md transition-colors",
834
+ children: /* @__PURE__ */ p(y, { className: "h-4 w-4" })
835
+ }), /* @__PURE__ */ p("button", {
836
+ type: "button",
837
+ onClick: t,
838
+ "aria-label": "Close AI chat",
839
+ className: "ai-chat-icon-btn flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md transition-colors",
840
+ children: /* @__PURE__ */ p(w, { className: "h-4 w-4" })
841
+ })]
842
+ })]
843
+ }),
844
+ /* @__PURE__ */ p("section", {
845
+ id: o,
846
+ "aria-label": "AI chat",
847
+ className: $("flex max-h-[60vh] min-h-0 flex-col overflow-hidden transition-opacity duration-500 ease-out", e ? "opacity-100" : "pointer-events-none opacity-0"),
848
+ children: _
849
+ }),
850
+ e && g.length > 0 && !x && /* @__PURE__ */ p("div", {
851
+ className: "shrink-0 px-3 py-2",
852
+ children: /* @__PURE__ */ p(F, {
853
+ chips: g,
854
+ onSelect: k,
855
+ chipClassName: Ye
856
+ })
857
+ }),
858
+ /* @__PURE__ */ p(D.Root, { children: /* @__PURE__ */ p("div", {
859
+ className: $("w-full shrink-0", e ? "border-zinc-100 border-t p-2" : "h-[42px] px-2"),
860
+ children: /* @__PURE__ */ m("div", {
861
+ className: "flex h-full items-center gap-2",
862
+ children: [
863
+ /* @__PURE__ */ p("button", {
864
+ type: "button",
865
+ onClick: t,
866
+ "aria-label": e ? "Collapse AI chat" : "Expand AI chat",
867
+ "aria-expanded": e,
868
+ "aria-controls": o,
869
+ className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md text-blue-500 transition-colors hover:bg-zinc-50",
870
+ children: /* @__PURE__ */ p(S, { className: "h-3.5 w-3.5" })
871
+ }),
872
+ /* @__PURE__ */ m("div", {
873
+ className: "relative min-w-0 flex-1",
874
+ children: [/* @__PURE__ */ p(D.Input, {
875
+ placeholder: e ? "Ask anything…" : "",
876
+ onFocus: () => {
877
+ e || t();
878
+ },
879
+ onInput: (e) => n(e.currentTarget),
880
+ onKeyDown: (e) => {
881
+ e.nativeEvent.isComposing || x && e.key === "Enter" && !e.shiftKey && (e.preventDefault(), E && O());
882
+ },
883
+ rows: 1,
884
+ submitMode: "enter",
885
+ className: $("ai-chat-nozoom block w-full resize-none overflow-hidden bg-transparent text-sm text-zinc-900 leading-5 placeholder:text-zinc-500 focus:outline-none", "h-5 max-h-[80px]")
886
+ }), !e && /* @__PURE__ */ p("span", {
887
+ className: "pointer-events-none absolute inset-y-0 left-0 flex items-center truncate bg-clip-text font-semibold text-sm text-transparent",
888
+ style: { backgroundImage: "linear-gradient(to right, var(--ai-chat-thinking-1, oklch(0.65 0.15 253.81)), var(--ai-chat-thinking-2, oklch(0.65 0.15 17.5826)))" },
889
+ "aria-hidden": !0,
890
+ children: a
891
+ })]
892
+ }),
893
+ e && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(D.If, {
894
+ dictation: !1,
895
+ children: /* @__PURE__ */ p(D.Dictate, {
896
+ "aria-label": "Start dictation",
897
+ className: "ai-chat-icon-btn flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md transition-colors",
898
+ children: /* @__PURE__ */ p(b, { className: "h-4 w-4" })
899
+ })
900
+ }), /* @__PURE__ */ p(D.If, {
901
+ dictation: !0,
902
+ children: /* @__PURE__ */ p(D.StopDictation, {
903
+ "aria-label": "Stop dictation",
904
+ className: "flex h-8 w-8 flex-shrink-0 animate-pulse items-center justify-center rounded-md bg-red-500/15 text-red-500 transition-colors hover:bg-red-500/25",
905
+ children: /* @__PURE__ */ p(C, { className: "h-3 w-3 fill-current" })
906
+ })
907
+ })] }),
908
+ x ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("button", {
909
+ type: "button",
910
+ onClick: () => v.thread.cancelRun(),
911
+ "aria-label": "Stop generating",
912
+ className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-transform hover:scale-105 active:scale-95",
913
+ style: {
914
+ backgroundColor: "var(--color-brand, #0a0a0a)",
915
+ color: "var(--color-brand-foreground, #fff)"
916
+ },
917
+ children: /* @__PURE__ */ p(C, { className: "h-3 w-3 fill-current" })
918
+ }), E && /* @__PURE__ */ p("button", {
919
+ type: "button",
920
+ onClick: O,
921
+ "aria-label": "Stop and send new message",
922
+ title: "Stop the current response and send",
923
+ className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-transform hover:scale-105 active:scale-95",
924
+ style: {
925
+ backgroundColor: "var(--color-brand, #0a0a0a)",
926
+ color: "var(--color-brand-foreground, #fff)"
927
+ },
928
+ children: /* @__PURE__ */ p(h, { className: "h-3.5 w-3.5 stroke-[2.5px]" })
929
+ })] }) : /* @__PURE__ */ p(D.Send, {
930
+ "aria-label": "Send message",
931
+ className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-transform hover:scale-105 active:scale-95 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none disabled:hover:scale-100",
932
+ style: {
933
+ backgroundColor: "var(--color-brand, #0a0a0a)",
934
+ color: "var(--color-brand-foreground, #fff)"
935
+ },
936
+ children: /* @__PURE__ */ p(h, { className: "h-3.5 w-3.5 stroke-[2.5px]" })
937
+ })
938
+ ]
939
+ })
940
+ }) })
941
+ ] });
942
+ };
943
+ //#endregion
944
+ export { Ke as KBChatWidget };