@levo-so/studio 0.3.8 → 0.3.10
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/{BillingStep-vBBLXLzk.js → BillingStep-CvRmZGdq.js} +1 -1
- package/{Button-BZDul09m.js → Button-Dza3e6Mv.js} +1 -1
- package/{EntryCard-DLPs2PaP.js → EntryCard-BpcaCqXU.js} +1 -1
- package/{KBChatWidget-B-SNBtoX.js → KBChatWidget-ChIYlltB.js} +389 -382
- package/{LoginCard-EtzpuqYB.js → LoginCard-B_anBE4b.js} +1 -1
- package/{PendingApprovalCard-CCbhY8p3.js → PendingApprovalCard-DbYp0nSk.js} +1 -1
- package/{PopupBody-DZVwDLkg-PiECxgmc.js → PopupBody-BI-MJqmd-BrzdFaaE.js} +47 -44
- package/{PopupRenderer-BjW1jg70-C1UDgSfJ.js → PopupRenderer-D66Gx63H-GHfJebm6.js} +140 -139
- package/{ProfileCard-DzEBPrax.js → ProfileCard-DmAnVf5R.js} +1 -1
- package/{bookingCard-kEYdGZJ-.js → bookingCard-CLhIpOpR.js} +2 -2
- package/collection.js +1 -1
- package/{dist-2bXx8eVI.js → dist-D5mTOitS.js} +74 -57
- package/index.d.ts +14 -0
- package/index.js +2557 -2244
- package/{kbChat-zJcrfsqJ.js → kbChat-BLHDnA-T.js} +15 -15
- package/package.json +41 -41
- package/pillChrome-wmdnlFIE.js +50 -0
- package/studio.css +1 -1
- package/{usePopupRedirect-BThP_YPW-jXtfhYu6.js → usePopupRedirect-CAAdcpaW-DdME0F7f.js} +14 -12
- package/pillChrome-CYoMtUAv.js +0 -30
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { _ as e, a as t,
|
|
3
|
-
import { Children as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { ArrowUp as
|
|
6
|
-
import { ActionBarPrimitive as
|
|
2
|
+
import { _ as e, a as t, b as n, c as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, r as f, s as p, t as m, u as h, v as g, x as _, y as v } from "./pillChrome-wmdnlFIE.js";
|
|
3
|
+
import { Children as y, createContext as b, isValidElement as x, useCallback as S, useContext as C, useEffect as w, useLayoutEffect as T, useRef as E, useState as D } from "react";
|
|
4
|
+
import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
5
|
+
import { ArrowUp as j, Check as M, ChevronDown as N, Copy as P, MessageSquarePlus as F, Mic as ee, RefreshCw as I, Sparkles as te, Square as L, X as R } from "lucide-react";
|
|
6
|
+
import { ActionBarPrimitive as z, AssistantRuntimeProvider as ne, ComposerPrimitive as B, MessagePrimitive as V, ThreadPrimitive as H, WebSpeechDictationAdapter as re, useAui as U, useAuiState as W } from "@assistant-ui/react";
|
|
7
7
|
import { AssistantChatTransport as ie, useChatRuntime as ae } from "@assistant-ui/react-ai-sdk";
|
|
8
8
|
import { MarkdownTextPrimitive as oe } from "@assistant-ui/react-markdown";
|
|
9
9
|
import se from "remark-gfm";
|
|
10
10
|
//#region ../../libraries/ai-chat/src/FollowUpChips.tsx
|
|
11
|
-
var
|
|
11
|
+
var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipClassName: i }) => {
|
|
12
12
|
if (e.length === 0) return null;
|
|
13
13
|
let a = [
|
|
14
14
|
"rounded-full border border-zinc-200 bg-white text-zinc-700",
|
|
15
15
|
"transition-all duration-150 hover:border-zinc-300 hover:bg-zinc-50 hover:text-zinc-900 active:scale-95",
|
|
16
16
|
n === "compact" ? "px-2.5 py-1 text-[11px] leading-none" : "px-3.5 py-1.5 text-xs"
|
|
17
17
|
].join(" ");
|
|
18
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ k("div", {
|
|
19
19
|
className: ["flex flex-wrap gap-1.5", r].filter(Boolean).join(" "),
|
|
20
|
-
children: e.map((e, n) => /* @__PURE__ */
|
|
20
|
+
children: e.map((e, n) => /* @__PURE__ */ k("button", {
|
|
21
21
|
type: "button",
|
|
22
22
|
onClick: () => t(e),
|
|
23
23
|
className: ["ai-chat-chip", i ?? a].join(" "),
|
|
@@ -37,10 +37,10 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
37
37
|
}
|
|
38
38
|
})
|
|
39
39
|
}), le = (e) => {
|
|
40
|
-
let t =
|
|
40
|
+
let t = E(null), n = E(null);
|
|
41
41
|
return n.current !== (e ?? null) && (n.current = e ?? null, t.current = null), {
|
|
42
42
|
conversationIdRef: t,
|
|
43
|
-
handleFinish:
|
|
43
|
+
handleFinish: S(({ message: e }) => {
|
|
44
44
|
let n = e.metadata;
|
|
45
45
|
if (!n || typeof n != "object") return;
|
|
46
46
|
let r = n.conversation_id;
|
|
@@ -48,33 +48,33 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
48
48
|
let i = r.trim();
|
|
49
49
|
i.length !== 0 && t.current !== i && (t.current = i);
|
|
50
50
|
}, []),
|
|
51
|
-
reset:
|
|
51
|
+
reset: S(() => {
|
|
52
52
|
t.current = null;
|
|
53
53
|
}, [])
|
|
54
54
|
};
|
|
55
55
|
}, ue = (e = []) => {
|
|
56
|
-
let [t, n] =
|
|
56
|
+
let [t, n] = D(e);
|
|
57
57
|
return {
|
|
58
58
|
followUps: t,
|
|
59
59
|
setFollowUps: n,
|
|
60
|
-
clearOnSend:
|
|
61
|
-
handleData:
|
|
60
|
+
clearOnSend: S(() => n([]), []),
|
|
61
|
+
handleData: S((e) => {
|
|
62
62
|
if (e.type !== "data-follow_ups") return !1;
|
|
63
63
|
let t = e.data?.suggestions;
|
|
64
64
|
return Array.isArray(t) ? (n(t.filter((e) => typeof e == "string")), !0) : !1;
|
|
65
65
|
}, [])
|
|
66
66
|
};
|
|
67
|
-
}, de = (e) => e instanceof Error && e.message.includes("intelligence.site_agent.NO_ACTIVE_AGENT"),
|
|
67
|
+
}, de = (e) => e instanceof Error && e.message.includes("intelligence.site_agent.NO_ACTIVE_AGENT"), K = b({ agentUnavailable: !1 }), fe = () => C(K), pe = (...e) => e.filter(Boolean).join(" "), me = "inline-flex items-center justify-center gap-1.5 transition-all duration-200", he = "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", ge = ({ onClick: e, isRunning: t = !1, iconOnly: n = !1, icon: r = /* @__PURE__ */ k(N, { className: "h-3 w-3" }), className: i = he }) => /* @__PURE__ */ A("button", {
|
|
68
68
|
type: "button",
|
|
69
69
|
"aria-label": "Scroll to bottom",
|
|
70
70
|
onClick: e,
|
|
71
|
-
className: pe(me,
|
|
72
|
-
children: [
|
|
71
|
+
className: pe(me, i),
|
|
72
|
+
children: [r, !n && (t ? "New messages" : "Scroll to bottom")]
|
|
73
73
|
}), _e = ({ endpoint: e, headers: t, fallback: n, enabled: r = !0 }) => {
|
|
74
|
-
let [i, a] =
|
|
74
|
+
let [i, a] = D(null), o = t ? JSON.stringify(t) : "", s = E(t);
|
|
75
75
|
s.current = t;
|
|
76
|
-
let c =
|
|
77
|
-
return c.current = n,
|
|
76
|
+
let c = E(n);
|
|
77
|
+
return c.current = n, w(() => {
|
|
78
78
|
if (!r || !e) {
|
|
79
79
|
a([...c.current]);
|
|
80
80
|
return;
|
|
@@ -104,10 +104,10 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
104
104
|
o
|
|
105
105
|
]), i;
|
|
106
106
|
}, ve = 36, ye = 80, be = ({ viewportRef: e, isRunning: t, onRunStart: n, anchorOnRunStart: r = !0, atBottomThreshold: i }) => {
|
|
107
|
-
let a =
|
|
107
|
+
let a = E(!1), [o, s] = D(!0), c = E(n);
|
|
108
108
|
c.current = n;
|
|
109
|
-
let l =
|
|
110
|
-
return l.current = i,
|
|
109
|
+
let l = E(i);
|
|
110
|
+
return l.current = i, w(() => {
|
|
111
111
|
let n = a.current;
|
|
112
112
|
if (a.current = t, !t || n || (c.current?.(), !r)) return;
|
|
113
113
|
let i = null, o = null;
|
|
@@ -128,7 +128,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
128
128
|
t,
|
|
129
129
|
e,
|
|
130
130
|
r
|
|
131
|
-
]),
|
|
131
|
+
]), w(() => {
|
|
132
132
|
let t = e.current;
|
|
133
133
|
if (!t) return;
|
|
134
134
|
let n = () => {
|
|
@@ -151,7 +151,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
|
-
},
|
|
154
|
+
}, q = (...e) => e.filter(Boolean).join(" "), J = ({ onStop: e }) => /* @__PURE__ */ k("button", {
|
|
155
155
|
type: "button",
|
|
156
156
|
onClick: e,
|
|
157
157
|
"aria-label": "Stop generating",
|
|
@@ -160,36 +160,36 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
160
160
|
backgroundColor: "var(--color-brand, #0a0a0a)",
|
|
161
161
|
color: "var(--color-brand-foreground, #fff)"
|
|
162
162
|
},
|
|
163
|
-
children: /* @__PURE__ */
|
|
164
|
-
}),
|
|
163
|
+
children: /* @__PURE__ */ k(L, { className: "h-3.5 w-3.5 fill-current" })
|
|
164
|
+
}), xe = () => /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(B.If, {
|
|
165
165
|
dictation: !1,
|
|
166
|
-
children: /* @__PURE__ */
|
|
166
|
+
children: /* @__PURE__ */ k(B.Dictate, {
|
|
167
167
|
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",
|
|
168
|
-
children: /* @__PURE__ */
|
|
168
|
+
children: /* @__PURE__ */ k(ee, { className: "h-4 w-4" })
|
|
169
169
|
})
|
|
170
|
-
}), /* @__PURE__ */
|
|
170
|
+
}), /* @__PURE__ */ k(B.If, {
|
|
171
171
|
dictation: !0,
|
|
172
|
-
children: /* @__PURE__ */
|
|
172
|
+
children: /* @__PURE__ */ k(B.StopDictation, {
|
|
173
173
|
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",
|
|
174
|
-
children: /* @__PURE__ */
|
|
174
|
+
children: /* @__PURE__ */ k(L, { className: "h-3 w-3 fill-current" })
|
|
175
175
|
})
|
|
176
|
-
})] }),
|
|
176
|
+
})] }), Se = () => /* @__PURE__ */ k(B.Send, {
|
|
177
177
|
"aria-label": "Send message",
|
|
178
178
|
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",
|
|
179
179
|
style: {
|
|
180
180
|
backgroundColor: "var(--color-brand, #0a0a0a)",
|
|
181
181
|
color: "var(--color-brand-foreground, #fff)"
|
|
182
182
|
},
|
|
183
|
-
children: /* @__PURE__ */
|
|
184
|
-
}),
|
|
185
|
-
let
|
|
186
|
-
e.nativeEvent.isComposing ||
|
|
183
|
+
children: /* @__PURE__ */ k(j, { className: "h-5 w-5 stroke-[2.5px]" })
|
|
184
|
+
}), Ce = ({ variant: t, isRunning: n, onStop: r }) => {
|
|
185
|
+
let i = (e) => {
|
|
186
|
+
e.nativeEvent.isComposing || n && e.key === "Enter" && !e.shiftKey && e.preventDefault();
|
|
187
187
|
};
|
|
188
|
-
return
|
|
188
|
+
return t === "expanded" ? /* @__PURE__ */ A("div", {
|
|
189
189
|
className: "rounded-lg border border-zinc-200 bg-white shadow-sm transition-colors focus-within:border-[var(--color-brand,#a1a1aa)]",
|
|
190
|
-
children: [/* @__PURE__ */
|
|
190
|
+
children: [/* @__PURE__ */ k(B.Input, {
|
|
191
191
|
"data-ai-chat-composer": "",
|
|
192
|
-
className:
|
|
192
|
+
className: q("ai-chat-textarea w-full resize-none overflow-y-auto bg-transparent px-6 pt-4 text-base text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", "max-h-[160px]"),
|
|
193
193
|
placeholder: "Ask anything about this site…",
|
|
194
194
|
rows: 1,
|
|
195
195
|
submitMode: "enter",
|
|
@@ -197,18 +197,18 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
197
197
|
autoCorrect: "off",
|
|
198
198
|
autoCapitalize: "none",
|
|
199
199
|
inputMode: "text",
|
|
200
|
-
onInput: (
|
|
201
|
-
onKeyDown:
|
|
202
|
-
}), /* @__PURE__ */
|
|
200
|
+
onInput: (t) => e(t.currentTarget),
|
|
201
|
+
onKeyDown: i
|
|
202
|
+
}), /* @__PURE__ */ A("div", {
|
|
203
203
|
className: "flex items-center justify-between px-3 pt-1 pb-2",
|
|
204
|
-
children: [/* @__PURE__ */
|
|
204
|
+
children: [/* @__PURE__ */ k(xe, {}), n ? /* @__PURE__ */ k(J, { onStop: r }) : /* @__PURE__ */ k(Se, {})]
|
|
205
205
|
})]
|
|
206
|
-
}) : /* @__PURE__ */
|
|
206
|
+
}) : /* @__PURE__ */ A("div", {
|
|
207
207
|
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)]",
|
|
208
208
|
children: [
|
|
209
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ k(B.Input, {
|
|
210
210
|
"data-ai-chat-composer": "",
|
|
211
|
-
className:
|
|
211
|
+
className: q("ai-chat-textarea min-w-0 flex-1 resize-none overflow-y-auto bg-transparent px-2 py-1.5 text-base text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", "max-h-[120px]"),
|
|
212
212
|
placeholder: "Ask a follow-up…",
|
|
213
213
|
rows: 1,
|
|
214
214
|
submitMode: "enter",
|
|
@@ -216,36 +216,40 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
216
216
|
autoCorrect: "off",
|
|
217
217
|
autoCapitalize: "none",
|
|
218
218
|
inputMode: "text",
|
|
219
|
-
onInput: (
|
|
220
|
-
onKeyDown:
|
|
219
|
+
onInput: (t) => e(t.currentTarget),
|
|
220
|
+
onKeyDown: i
|
|
221
221
|
}),
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
|
|
222
|
+
/* @__PURE__ */ k(xe, {}),
|
|
223
|
+
n ? /* @__PURE__ */ k(J, { onStop: r }) : /* @__PURE__ */ k(Se, {})
|
|
224
224
|
]
|
|
225
225
|
});
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
className:
|
|
230
|
-
children: /* @__PURE__ */
|
|
226
|
+
}, we = "rounded-2xl border border-zinc-200 bg-zinc-100 px-3.5 py-2.5", Te = "ai-chat-textarea w-full resize-none bg-transparent text-base text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", Ee = "rounded-md px-2 py-1 text-xs text-zinc-500 transition-colors hover:bg-zinc-100", De = "rounded-md px-2 py-1 text-xs transition-opacity hover:opacity-80", Oe = ({ autoGrowMax: t, boxClassName: n = we, inputClassName: r = Te, cancelClassName: i = Ee, sendClassName: o = De, sendStyle: s }) => {
|
|
227
|
+
let c = W((e) => e.thread.isRunning);
|
|
228
|
+
return /* @__PURE__ */ k(V.Root, {
|
|
229
|
+
className: "mb-4 pr-2 pl-0",
|
|
230
|
+
children: /* @__PURE__ */ A(B.Root, { children: [/* @__PURE__ */ k("div", {
|
|
231
231
|
className: n,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
className:
|
|
239
|
-
children:
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
232
|
+
children: /* @__PURE__ */ k(B.Input, {
|
|
233
|
+
className: r,
|
|
234
|
+
rows: 1,
|
|
235
|
+
onInput: (n) => e(n.currentTarget, t)
|
|
236
|
+
})
|
|
237
|
+
}), /* @__PURE__ */ A("div", {
|
|
238
|
+
className: "mt-2 flex justify-end gap-1.5",
|
|
239
|
+
children: [/* @__PURE__ */ k(B.Cancel, {
|
|
240
|
+
className: i,
|
|
241
|
+
children: "Cancel"
|
|
242
|
+
}), /* @__PURE__ */ k(B.Send, {
|
|
243
|
+
disabled: c,
|
|
244
|
+
className: `${o} ${a}`,
|
|
245
|
+
style: s,
|
|
246
|
+
children: "Save"
|
|
247
|
+
})]
|
|
248
|
+
})] })
|
|
249
|
+
});
|
|
250
|
+
}, ke = ({ 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" }) => {
|
|
251
|
+
let [a, o] = D("idle"), s = W((e) => e.message);
|
|
252
|
+
w(() => {
|
|
249
253
|
if (a === "idle") return;
|
|
250
254
|
let e = setTimeout(() => o("idle"), 1500);
|
|
251
255
|
return () => clearTimeout(e);
|
|
@@ -257,59 +261,59 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
257
261
|
} catch {
|
|
258
262
|
o("error");
|
|
259
263
|
}
|
|
260
|
-
}, l = a === "copied" ? t ?? e : a === "error" ? n ?? e : e, u = a === "copied" ? "Copied" : a === "error" ? "Copy failed" : "Copy message", d = a === "copied" ?
|
|
261
|
-
return /* @__PURE__ */
|
|
264
|
+
}, l = a === "copied" ? t ?? e : a === "error" ? n ?? e : e, u = a === "copied" ? "Copied" : a === "error" ? "Copy failed" : "Copy message", d = a === "copied" ? M : a === "error" ? R : P;
|
|
265
|
+
return /* @__PURE__ */ k("button", {
|
|
262
266
|
type: "button",
|
|
263
267
|
"aria-label": u,
|
|
264
268
|
onClick: c,
|
|
265
269
|
className: [r, l].filter(Boolean).join(" "),
|
|
266
|
-
children: /* @__PURE__ */
|
|
270
|
+
children: /* @__PURE__ */ k(d, { className: i })
|
|
267
271
|
});
|
|
268
|
-
},
|
|
269
|
-
let [t, n] =
|
|
270
|
-
return
|
|
271
|
-
if (
|
|
272
|
+
}, Ae = ({ children: e }) => {
|
|
273
|
+
let [t, n] = D(!1), r = "plaintext", i = "";
|
|
274
|
+
return y.forEach(e, (e) => {
|
|
275
|
+
if (x(e)) {
|
|
272
276
|
let t = e.props, n = /language-(\w+)/.exec(t.className ?? "");
|
|
273
277
|
n && (r = n[1] ?? r), typeof t.children == "string" && (i = t.children.trim());
|
|
274
278
|
}
|
|
275
|
-
}), /* @__PURE__ */
|
|
279
|
+
}), /* @__PURE__ */ A("div", {
|
|
276
280
|
className: "ai-chat-code not-prose my-4 overflow-hidden rounded-xl border",
|
|
277
|
-
children: [/* @__PURE__ */
|
|
281
|
+
children: [/* @__PURE__ */ A("div", {
|
|
278
282
|
className: "ai-chat-code__header flex items-center justify-between px-4 py-2",
|
|
279
|
-
children: [/* @__PURE__ */
|
|
283
|
+
children: [/* @__PURE__ */ k("span", {
|
|
280
284
|
className: "ai-chat-code__label font-mono text-[10px] uppercase tracking-widest",
|
|
281
285
|
children: r
|
|
282
|
-
}), /* @__PURE__ */
|
|
286
|
+
}), /* @__PURE__ */ k("button", {
|
|
283
287
|
type: "button",
|
|
284
288
|
onClick: () => navigator.clipboard.writeText(i).then(() => {
|
|
285
289
|
n(!0), setTimeout(() => n(!1), 2e3);
|
|
286
290
|
}).catch(() => {}),
|
|
287
291
|
className: "ai-chat-code__copy flex items-center gap-1.5 rounded px-2 py-0.5 text-[10px] transition-colors",
|
|
288
|
-
children: t ? /* @__PURE__ */
|
|
292
|
+
children: t ? /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(M, { className: "h-3 w-3 text-emerald-500" }), /* @__PURE__ */ k("span", { children: "Copied!" })] }) : /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(P, { className: "h-3 w-3" }), /* @__PURE__ */ k("span", { children: "Copy" })] })
|
|
289
293
|
})]
|
|
290
|
-
}), /* @__PURE__ */
|
|
294
|
+
}), /* @__PURE__ */ k("pre", {
|
|
291
295
|
className: "ai-chat-code__pre overflow-x-auto px-4 py-4 font-mono text-sm leading-relaxed",
|
|
292
296
|
children: e
|
|
293
297
|
})]
|
|
294
298
|
});
|
|
295
|
-
},
|
|
299
|
+
}, je = (e) => /* @__PURE__ */ k("a", {
|
|
296
300
|
...e,
|
|
297
301
|
target: "_blank",
|
|
298
302
|
rel: "noopener noreferrer"
|
|
299
|
-
}),
|
|
303
|
+
}), Me = ({ className: e, ...t }) => /* @__PURE__ */ k("div", {
|
|
300
304
|
className: "w-full max-w-full overflow-x-auto",
|
|
301
|
-
children: /* @__PURE__ */
|
|
305
|
+
children: /* @__PURE__ */ k("table", {
|
|
302
306
|
...t,
|
|
303
307
|
className: ["w-max min-w-full [&_td]:max-w-[20rem] [&_th]:max-w-[20rem]", e].filter(Boolean).join(" ")
|
|
304
308
|
})
|
|
305
|
-
}),
|
|
309
|
+
}), Ne = () => /* @__PURE__ */ k(oe, {
|
|
306
310
|
remarkPlugins: [se],
|
|
307
311
|
components: {
|
|
308
|
-
pre:
|
|
309
|
-
a:
|
|
310
|
-
table:
|
|
312
|
+
pre: Ae,
|
|
313
|
+
a: je,
|
|
314
|
+
table: Me
|
|
311
315
|
}
|
|
312
|
-
}),
|
|
316
|
+
}), Pe = [
|
|
313
317
|
"Thinking",
|
|
314
318
|
"Pondering",
|
|
315
319
|
"Drafting",
|
|
@@ -323,12 +327,12 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
323
327
|
"Untangling",
|
|
324
328
|
"Threading the needle",
|
|
325
329
|
"Lining up ideas"
|
|
326
|
-
],
|
|
330
|
+
], Fe = (e) => {
|
|
327
331
|
let t = Math.floor(e / 60), n = e % 60;
|
|
328
332
|
return t > 0 ? `${t}m ${n.toString().padStart(2, "0")}s` : `${n}s`;
|
|
329
|
-
},
|
|
330
|
-
let [a, o] =
|
|
331
|
-
|
|
333
|
+
}, Ie = ({ phrases: e = Pe, 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" }) => {
|
|
334
|
+
let [a, o] = D(() => e.length > 0 ? Math.floor(Math.random() * e.length) : 0), [s, c] = D(0);
|
|
335
|
+
w(() => {
|
|
332
336
|
let t = e.length > 0 ? setInterval(() => {
|
|
333
337
|
o((t) => (t + 1) % e.length);
|
|
334
338
|
}, 2800) : null, n = setInterval(() => {
|
|
@@ -339,187 +343,190 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
339
343
|
};
|
|
340
344
|
}, [e.length]);
|
|
341
345
|
let l = e[a] ?? "Thinking", u = s >= 3, d = s >= 30;
|
|
342
|
-
return /* @__PURE__ */
|
|
343
|
-
className: "flex items-center gap-3 py-1",
|
|
344
|
-
children: [
|
|
345
|
-
|
|
346
|
+
return /* @__PURE__ */ A("div", {
|
|
347
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-0.5 py-1",
|
|
348
|
+
children: [/* @__PURE__ */ A("div", {
|
|
349
|
+
className: "flex min-w-0 items-center gap-3",
|
|
350
|
+
children: [/* @__PURE__ */ A("div", {
|
|
346
351
|
className: "ai-dust",
|
|
347
352
|
children: [
|
|
348
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ k("span", { style: {
|
|
349
354
|
left: "4px",
|
|
350
355
|
"--delay": ".3s"
|
|
351
356
|
} }),
|
|
352
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ k("span", { style: {
|
|
353
358
|
left: "12px",
|
|
354
359
|
"--delay": "0s"
|
|
355
360
|
} }),
|
|
356
|
-
/* @__PURE__ */
|
|
361
|
+
/* @__PURE__ */ k("span", { style: {
|
|
357
362
|
left: "20px",
|
|
358
363
|
"--delay": ".6s"
|
|
359
364
|
} })
|
|
360
365
|
]
|
|
361
|
-
}),
|
|
362
|
-
|
|
363
|
-
className: `${t} font-semibold text-sm transition-opacity duration-500`,
|
|
366
|
+
}), /* @__PURE__ */ A("span", {
|
|
367
|
+
className: `${t} min-w-0 truncate font-semibold text-sm transition-opacity duration-500`,
|
|
364
368
|
children: [l, "…"]
|
|
365
|
-
})
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
]
|
|
369
|
+
})]
|
|
370
|
+
}), u && /* @__PURE__ */ A("span", {
|
|
371
|
+
className: `${n} min-w-0 truncate`,
|
|
372
|
+
children: [Fe(s), d && /* @__PURE__ */ k("span", {
|
|
373
|
+
className: r,
|
|
374
|
+
children: i
|
|
375
|
+
})]
|
|
376
|
+
})]
|
|
374
377
|
});
|
|
375
|
-
},
|
|
376
|
-
let
|
|
377
|
-
className:
|
|
378
|
-
children: /* @__PURE__ */
|
|
379
|
-
Text:
|
|
378
|
+
}, Le = () => null, Re = "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", ze = "group pr-4 pb-6", Be = "mt-2 flex items-center gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100", Ve = "text-xs text-zinc-500/60", He = "rounded p-1.5 text-zinc-500 transition-colors hover:text-zinc-900", Ue = ({ tools: e = Le, Parts: t, thinkingIndicator: r = /* @__PURE__ */ k(Ie, {}), rootClassName: i = ze, contentClassName: a = Re, metaClassName: o = Be, wrapContent: s, metaSlot: c, copyIdleClassName: l, copyCopiedClassName: u, reloadClassName: d = He, timeClassName: f = Ve, timeFormatOptions: p, readOnly: m = !1, belowContent: h, footerSlot: g }) => {
|
|
379
|
+
let y = W((e) => e.message), b = _(y), x = t ?? V.Content, S = y.status?.type === "running", C = /* @__PURE__ */ k("div", {
|
|
380
|
+
className: a,
|
|
381
|
+
children: /* @__PURE__ */ k(x, { components: {
|
|
382
|
+
Text: Ne,
|
|
380
383
|
tools: { Fallback: e }
|
|
381
384
|
} })
|
|
382
385
|
});
|
|
383
|
-
return /* @__PURE__ */
|
|
384
|
-
className:
|
|
385
|
-
children: /* @__PURE__ */
|
|
386
|
+
return /* @__PURE__ */ k(V.Root, {
|
|
387
|
+
className: i,
|
|
388
|
+
children: /* @__PURE__ */ A("div", {
|
|
386
389
|
className: "flex min-w-0 flex-col",
|
|
387
390
|
children: [
|
|
388
|
-
|
|
389
|
-
|
|
391
|
+
s ? s(C) : C,
|
|
392
|
+
S && /* @__PURE__ */ k("div", {
|
|
390
393
|
className: "mt-1",
|
|
391
|
-
children:
|
|
394
|
+
children: r
|
|
392
395
|
}),
|
|
393
|
-
!
|
|
396
|
+
!S && h && /* @__PURE__ */ k("div", {
|
|
394
397
|
className: "mt-2",
|
|
395
|
-
children:
|
|
398
|
+
children: h
|
|
396
399
|
}),
|
|
397
|
-
!
|
|
398
|
-
className:
|
|
400
|
+
!S && /* @__PURE__ */ A("div", {
|
|
401
|
+
className: o,
|
|
399
402
|
children: [
|
|
400
|
-
/* @__PURE__ */
|
|
401
|
-
className:
|
|
402
|
-
|
|
403
|
+
/* @__PURE__ */ k("span", {
|
|
404
|
+
className: f,
|
|
405
|
+
title: v(b) || void 0,
|
|
406
|
+
children: n(b, p)
|
|
403
407
|
}),
|
|
404
|
-
|
|
405
|
-
/* @__PURE__ */
|
|
408
|
+
c,
|
|
409
|
+
/* @__PURE__ */ A(z.Root, {
|
|
406
410
|
className: "flex items-center gap-0.5",
|
|
407
|
-
children: [/* @__PURE__ */
|
|
408
|
-
idleClassName:
|
|
409
|
-
copiedClassName:
|
|
410
|
-
}), !
|
|
411
|
-
className:
|
|
412
|
-
children: /* @__PURE__ */
|
|
411
|
+
children: [/* @__PURE__ */ k(ke, {
|
|
412
|
+
idleClassName: l,
|
|
413
|
+
copiedClassName: u
|
|
414
|
+
}), !m && /* @__PURE__ */ k(z.Reload, {
|
|
415
|
+
className: `${d} disabled:cursor-not-allowed disabled:opacity-40`,
|
|
416
|
+
children: /* @__PURE__ */ k(I, { className: "h-3 w-3" })
|
|
413
417
|
})]
|
|
414
418
|
})
|
|
415
419
|
]
|
|
416
|
-
})
|
|
420
|
+
}),
|
|
421
|
+
!S && g
|
|
417
422
|
]
|
|
418
423
|
})
|
|
419
424
|
});
|
|
420
|
-
},
|
|
421
|
-
let
|
|
422
|
-
return /* @__PURE__ */
|
|
425
|
+
}, We = "group flex flex-col items-end pb-4 pl-12", Ge = "rounded-2xl border border-zinc-200 bg-zinc-100 px-3.5 py-2.5 text-sm text-zinc-900 leading-relaxed", Ke = "mt-1 flex items-center gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100", qe = "text-xs text-zinc-500/60", Je = "rounded px-2 py-1 font-medium text-xs text-zinc-500 transition-colors hover:text-zinc-900", Ye = ({ attachmentsSlot: e, rootClassName: t = We, bubbleClassName: r = Ge, contentSlot: i, metaClassName: a = Ke, timeClassName: o = qe, editClassName: s = Je, copyIdleClassName: c, copyCopiedClassName: l, timeFormatOptions: u, readOnly: d = !1 }) => {
|
|
426
|
+
let f = W((e) => e.message), p = W((e) => e.thread.isRunning), m = _(f);
|
|
427
|
+
return /* @__PURE__ */ A(V.Root, {
|
|
423
428
|
className: t,
|
|
424
429
|
"data-user-message": "true",
|
|
425
430
|
children: [
|
|
426
431
|
e,
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
-
className:
|
|
429
|
-
children:
|
|
432
|
+
/* @__PURE__ */ k("div", {
|
|
433
|
+
className: r,
|
|
434
|
+
children: i ?? /* @__PURE__ */ k(V.Content, {})
|
|
430
435
|
}),
|
|
431
|
-
/* @__PURE__ */
|
|
432
|
-
className:
|
|
433
|
-
children: [/* @__PURE__ */
|
|
434
|
-
className:
|
|
435
|
-
|
|
436
|
-
|
|
436
|
+
/* @__PURE__ */ A("div", {
|
|
437
|
+
className: a,
|
|
438
|
+
children: [/* @__PURE__ */ k("span", {
|
|
439
|
+
className: o,
|
|
440
|
+
title: v(m) || void 0,
|
|
441
|
+
children: n(m, u)
|
|
442
|
+
}), /* @__PURE__ */ A(z.Root, {
|
|
437
443
|
className: "flex items-center gap-0.5",
|
|
438
|
-
children: [/* @__PURE__ */
|
|
439
|
-
idleClassName:
|
|
440
|
-
copiedClassName:
|
|
441
|
-
}), !
|
|
442
|
-
|
|
444
|
+
children: [/* @__PURE__ */ k(ke, {
|
|
445
|
+
idleClassName: c,
|
|
446
|
+
copiedClassName: l
|
|
447
|
+
}), !d && /* @__PURE__ */ k(z.Edit, {
|
|
448
|
+
disabled: p,
|
|
449
|
+
className: `${s} disabled:cursor-not-allowed disabled:opacity-40`,
|
|
443
450
|
children: "Edit"
|
|
444
451
|
})]
|
|
445
452
|
})]
|
|
446
453
|
})
|
|
447
454
|
]
|
|
448
455
|
});
|
|
449
|
-
},
|
|
456
|
+
}, Xe = () => /* @__PURE__ */ k(Oe, { sendStyle: {
|
|
450
457
|
backgroundColor: "var(--color-brand, #0a0a0a)",
|
|
451
458
|
color: "var(--color-brand-foreground, #fff)"
|
|
452
|
-
} }),
|
|
459
|
+
} }), Ze = [
|
|
453
460
|
"What do you offer?",
|
|
454
461
|
"How much does it cost?",
|
|
455
462
|
"Why should I choose you?",
|
|
456
463
|
"How do I get in touch?"
|
|
457
|
-
],
|
|
464
|
+
], Qe = [
|
|
458
465
|
"w-3/4",
|
|
459
466
|
"w-4/5",
|
|
460
467
|
"w-2/3",
|
|
461
468
|
"w-3/5"
|
|
462
|
-
],
|
|
463
|
-
let
|
|
464
|
-
viewportRef:
|
|
465
|
-
isRunning:
|
|
466
|
-
}),
|
|
467
|
-
endpoint:
|
|
468
|
-
headers:
|
|
469
|
-
...
|
|
470
|
-
"Levo-Workspace":
|
|
469
|
+
], $e = ({ workspaceId: e, siteName: t, siteLogo: n, apiBaseUrl: r, authHeaders: i, agentId: a, followUps: o, hideComposer: s = !1 }) => {
|
|
470
|
+
let c = U(), l = W((e) => e.thread.isRunning), { agentUnavailable: u } = fe(), d = E(null), { isAtBottom: f, scrollToBottom: p } = be({
|
|
471
|
+
viewportRef: d,
|
|
472
|
+
isRunning: l
|
|
473
|
+
}), m = _e({
|
|
474
|
+
endpoint: e ? `${r}/suggestions${a ? `?agent_id=${encodeURIComponent(a)}` : ""}` : void 0,
|
|
475
|
+
headers: e ? {
|
|
476
|
+
...i,
|
|
477
|
+
"Levo-Workspace": e
|
|
471
478
|
} : void 0,
|
|
472
|
-
fallback:
|
|
473
|
-
}),
|
|
474
|
-
|
|
475
|
-
}, [
|
|
476
|
-
return
|
|
477
|
-
v.current =
|
|
478
|
-
}, [
|
|
479
|
+
fallback: Ze
|
|
480
|
+
}), h = S((e) => {
|
|
481
|
+
g(c.thread.composer(), e);
|
|
482
|
+
}, [c]), _ = S(() => c.thread.cancelRun(), [c]), v = E(l);
|
|
483
|
+
return w(() => {
|
|
484
|
+
v.current = l;
|
|
485
|
+
}, [l]), w(() => {
|
|
479
486
|
let e = (e) => {
|
|
480
|
-
e.key !== "Escape" || e.isComposing || !v.current || (e.preventDefault(), e.stopImmediatePropagation(),
|
|
487
|
+
e.key !== "Escape" || e.isComposing || !v.current || (e.preventDefault(), e.stopImmediatePropagation(), c.thread.cancelRun());
|
|
481
488
|
};
|
|
482
489
|
return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
|
|
483
|
-
}, [
|
|
490
|
+
}, [c]), /* @__PURE__ */ A(H.Root, {
|
|
484
491
|
className: "relative flex flex-1 flex-col overflow-hidden",
|
|
485
492
|
children: [
|
|
486
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ k(H.If, {
|
|
487
494
|
empty: !0,
|
|
488
|
-
children: /* @__PURE__ */
|
|
495
|
+
children: /* @__PURE__ */ k("div", {
|
|
489
496
|
className: "pointer-events-none absolute inset-0 z-0 overflow-hidden",
|
|
490
|
-
children: /* @__PURE__ */
|
|
497
|
+
children: /* @__PURE__ */ k("div", {
|
|
491
498
|
className: "absolute inset-0",
|
|
492
499
|
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(", ") }
|
|
493
500
|
})
|
|
494
501
|
})
|
|
495
502
|
}),
|
|
496
|
-
|
|
503
|
+
u && /* @__PURE__ */ k("div", {
|
|
497
504
|
role: "alert",
|
|
498
505
|
className: "relative z-20 shrink-0 border-amber-200 border-b bg-amber-50 px-4 py-2.5 text-amber-800 text-xs",
|
|
499
506
|
children: "This conversation is no longer available. Please refresh the page to start a new chat."
|
|
500
507
|
}),
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
ref:
|
|
508
|
+
/* @__PURE__ */ A(H.Viewport, {
|
|
509
|
+
ref: d,
|
|
503
510
|
turnAnchor: "top",
|
|
504
511
|
className: "relative z-10 flex-1 overflow-y-auto",
|
|
505
512
|
autoScroll: !1,
|
|
506
513
|
scrollToBottomOnRunStart: !1,
|
|
507
514
|
scrollToBottomOnInitialize: !1,
|
|
508
515
|
scrollToBottomOnThreadSwitch: !1,
|
|
509
|
-
children: [/* @__PURE__ */
|
|
516
|
+
children: [/* @__PURE__ */ k(H.Empty, { children: /* @__PURE__ */ A("div", {
|
|
510
517
|
className: "flex min-h-full flex-col items-center justify-center px-6 py-6",
|
|
511
|
-
children: [/* @__PURE__ */
|
|
518
|
+
children: [/* @__PURE__ */ A("div", {
|
|
512
519
|
className: "mb-5 flex flex-col items-center gap-2 text-center",
|
|
513
520
|
children: [
|
|
514
|
-
|
|
515
|
-
src:
|
|
516
|
-
alt:
|
|
521
|
+
n ? /* @__PURE__ */ k("img", {
|
|
522
|
+
src: n,
|
|
523
|
+
alt: t ?? "Site logo",
|
|
517
524
|
className: "mb-1 h-12 w-auto max-w-[180px] object-contain"
|
|
518
|
-
}) : /* @__PURE__ */
|
|
525
|
+
}) : /* @__PURE__ */ k("span", {
|
|
519
526
|
className: "font-semibold text-lg text-zinc-900 tracking-tight",
|
|
520
|
-
children:
|
|
527
|
+
children: t ?? "This site"
|
|
521
528
|
}),
|
|
522
|
-
/* @__PURE__ */
|
|
529
|
+
/* @__PURE__ */ k("p", {
|
|
523
530
|
className: "mt-1 text-2xl text-zinc-900 tracking-tight",
|
|
524
531
|
style: {
|
|
525
532
|
fontFamily: "var(--font-heading, inherit)",
|
|
@@ -527,89 +534,89 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
527
534
|
},
|
|
528
535
|
children: "Ask anything"
|
|
529
536
|
}),
|
|
530
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ k("p", {
|
|
531
538
|
className: "text-sm text-zinc-500",
|
|
532
539
|
style: { fontFamily: "var(--font-heading, inherit)" },
|
|
533
540
|
children: "Get instant answers about products, pricing, and how to get started."
|
|
534
541
|
})
|
|
535
542
|
]
|
|
536
|
-
}), /* @__PURE__ */
|
|
543
|
+
}), /* @__PURE__ */ k("div", {
|
|
537
544
|
className: "flex w-full max-w-md flex-col gap-2",
|
|
538
|
-
children:
|
|
545
|
+
children: m === null ? Qe.map((e, t) => /* @__PURE__ */ k("div", {
|
|
539
546
|
className: "flex h-[42px] items-center rounded-xl border border-zinc-200 bg-white px-4",
|
|
540
|
-
children: /* @__PURE__ */
|
|
541
|
-
}, `skeleton-${t}`)) :
|
|
547
|
+
children: /* @__PURE__ */ k("span", { className: `block h-3 animate-pulse rounded bg-zinc-200 ${e}` })
|
|
548
|
+
}, `skeleton-${t}`)) : m.map((e, t) => /* @__PURE__ */ k("button", {
|
|
542
549
|
type: "button",
|
|
543
|
-
onClick: () =>
|
|
550
|
+
onClick: () => h(e),
|
|
544
551
|
className: "ai-chat-suggestion rounded-xl border border-zinc-200 bg-white px-4 py-2.5 text-left text-sm text-zinc-700 transition-[border-color,background-color,transform] duration-150 hover:border-zinc-300 hover:bg-zinc-50 active:scale-[0.98]",
|
|
545
552
|
style: { animationDelay: `${t * 40}ms` },
|
|
546
553
|
children: e
|
|
547
554
|
}, e))
|
|
548
555
|
})]
|
|
549
|
-
}) }), /* @__PURE__ */
|
|
556
|
+
}) }), /* @__PURE__ */ k(H.If, {
|
|
550
557
|
empty: !1,
|
|
551
|
-
children: /* @__PURE__ */
|
|
558
|
+
children: /* @__PURE__ */ k("div", {
|
|
552
559
|
className: "ai-chat-kb-messages mx-auto max-w-3xl px-6 py-6 pt-8",
|
|
553
|
-
children: /* @__PURE__ */
|
|
554
|
-
UserMessage:
|
|
555
|
-
AssistantMessage:
|
|
556
|
-
EditComposer:
|
|
560
|
+
children: /* @__PURE__ */ k(H.Messages, { components: {
|
|
561
|
+
UserMessage: Ye,
|
|
562
|
+
AssistantMessage: Ue,
|
|
563
|
+
EditComposer: Xe
|
|
557
564
|
} })
|
|
558
565
|
})
|
|
559
566
|
})]
|
|
560
567
|
}),
|
|
561
|
-
!
|
|
568
|
+
!s && /* @__PURE__ */ k("div", {
|
|
562
569
|
className: "relative z-10 shrink-0 border-zinc-200 border-t bg-white/95 backdrop-blur-sm",
|
|
563
|
-
children: /* @__PURE__ */
|
|
570
|
+
children: /* @__PURE__ */ A("div", {
|
|
564
571
|
className: "relative mx-auto max-w-3xl px-4 pt-3 pb-3",
|
|
565
572
|
children: [
|
|
566
|
-
!
|
|
573
|
+
!f && /* @__PURE__ */ k("div", {
|
|
567
574
|
className: "pointer-events-none absolute inset-x-0 -top-9 z-20 flex justify-center",
|
|
568
|
-
children: /* @__PURE__ */
|
|
569
|
-
onClick:
|
|
570
|
-
isRunning:
|
|
575
|
+
children: /* @__PURE__ */ k(ge, {
|
|
576
|
+
onClick: p,
|
|
577
|
+
isRunning: l,
|
|
571
578
|
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"
|
|
572
579
|
})
|
|
573
580
|
}),
|
|
574
|
-
|
|
581
|
+
o.length > 0 && !l && /* @__PURE__ */ k("div", {
|
|
575
582
|
className: "mb-2",
|
|
576
|
-
children: /* @__PURE__ */
|
|
577
|
-
chips:
|
|
578
|
-
onSelect:
|
|
583
|
+
children: /* @__PURE__ */ k(G, {
|
|
584
|
+
chips: o,
|
|
585
|
+
onSelect: h,
|
|
579
586
|
size: "compact"
|
|
580
587
|
})
|
|
581
588
|
}),
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
-
/* @__PURE__ */
|
|
589
|
+
/* @__PURE__ */ A(B.Root, { children: [
|
|
590
|
+
/* @__PURE__ */ k(H.If, {
|
|
584
591
|
empty: !0,
|
|
585
|
-
children: /* @__PURE__ */
|
|
592
|
+
children: /* @__PURE__ */ k(Ce, {
|
|
586
593
|
variant: "expanded",
|
|
587
|
-
isRunning:
|
|
594
|
+
isRunning: l,
|
|
588
595
|
onStop: _
|
|
589
596
|
})
|
|
590
597
|
}),
|
|
591
|
-
/* @__PURE__ */
|
|
598
|
+
/* @__PURE__ */ k(H.If, {
|
|
592
599
|
empty: !1,
|
|
593
|
-
children: /* @__PURE__ */
|
|
600
|
+
children: /* @__PURE__ */ k(Ce, {
|
|
594
601
|
variant: "compact",
|
|
595
|
-
isRunning:
|
|
602
|
+
isRunning: l,
|
|
596
603
|
onStop: _
|
|
597
604
|
})
|
|
598
605
|
}),
|
|
599
|
-
/* @__PURE__ */
|
|
606
|
+
/* @__PURE__ */ k(B.If, {
|
|
600
607
|
dictation: !0,
|
|
601
|
-
children: /* @__PURE__ */
|
|
608
|
+
children: /* @__PURE__ */ A("div", {
|
|
602
609
|
className: "mt-2 flex items-center justify-center gap-2",
|
|
603
|
-
children: [/* @__PURE__ */
|
|
610
|
+
children: [/* @__PURE__ */ k("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-red-500" }), /* @__PURE__ */ k("span", {
|
|
604
611
|
className: "font-medium text-red-500 text-xs tracking-wide",
|
|
605
612
|
children: "Listening… speak now"
|
|
606
613
|
})]
|
|
607
614
|
})
|
|
608
615
|
})
|
|
609
616
|
] }),
|
|
610
|
-
/* @__PURE__ */
|
|
617
|
+
/* @__PURE__ */ k(H.If, {
|
|
611
618
|
empty: !1,
|
|
612
|
-
children: /* @__PURE__ */
|
|
619
|
+
children: /* @__PURE__ */ k("p", {
|
|
613
620
|
className: "mt-2 text-center text-[10px] text-zinc-500/70",
|
|
614
621
|
children: "Answers can be inaccurate. Verify before relying on them."
|
|
615
622
|
})
|
|
@@ -619,31 +626,31 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
619
626
|
})
|
|
620
627
|
]
|
|
621
628
|
});
|
|
622
|
-
},
|
|
629
|
+
}, Y = 4096, et = 400, tt = 300, nt = 2e3, rt = (e) => document.querySelector(e)?.content?.trim() || void 0, it = (e) => {
|
|
623
630
|
for (let t of e) {
|
|
624
|
-
let e =
|
|
631
|
+
let e = rt(t);
|
|
625
632
|
if (e) return e;
|
|
626
633
|
}
|
|
627
|
-
},
|
|
634
|
+
}, at = (e, t) => e.length > t ? `${e.slice(0, t - 1).trimEnd()}…` : e, X = (e) => JSON.stringify(e).length, ot = () => {
|
|
628
635
|
if (typeof window > "u" || typeof document > "u") return;
|
|
629
636
|
let e = {}, t = window.location?.href;
|
|
630
637
|
t && (e.url = t);
|
|
631
|
-
let n = document.title?.trim() ||
|
|
632
|
-
n && (e.page_title =
|
|
633
|
-
let r =
|
|
638
|
+
let n = document.title?.trim() || it(["meta[property=\"og:title\"]", "meta[name=\"twitter:title\"]"]);
|
|
639
|
+
n && (e.page_title = at(n, tt));
|
|
640
|
+
let r = it([
|
|
634
641
|
"meta[name=\"description\"]",
|
|
635
642
|
"meta[property=\"og:description\"]",
|
|
636
643
|
"meta[name=\"twitter:description\"]"
|
|
637
644
|
]);
|
|
638
|
-
r && (e.description =
|
|
645
|
+
r && (e.description = at(r, et));
|
|
639
646
|
let i = document.referrer?.trim();
|
|
640
|
-
if (i && (e.referrer = i), Object.keys(e).length !== 0) return e.description &&
|
|
641
|
-
},
|
|
642
|
-
let s =
|
|
647
|
+
if (i && (e.referrer = i), Object.keys(e).length !== 0) return e.description && X(e) > Y && delete e.description, e.referrer && X(e) > Y && delete e.referrer, e.url && X(e) > Y && (e.url = e.url.slice(0, nt)), e;
|
|
648
|
+
}, st = ({ workspaceId: e, siteName: t, siteLogo: n, agentId: r, apiBaseUrl: i, authHeaders: a, children: o }) => {
|
|
649
|
+
let s = E(e);
|
|
643
650
|
s.current = e;
|
|
644
|
-
let c =
|
|
651
|
+
let c = E(r);
|
|
645
652
|
c.current = r;
|
|
646
|
-
let { followUps: l, clearOnSend: u, handleData: d } = ue(), [f, p] =
|
|
653
|
+
let { followUps: l, clearOnSend: u, handleData: d } = ue(), [f, p] = D(!1), { conversationIdRef: m, handleFinish: h, reset: g } = le(e), _ = ae({
|
|
647
654
|
joinStrategy: "none",
|
|
648
655
|
transport: ce({
|
|
649
656
|
api: `${i}/stream`,
|
|
@@ -662,7 +669,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
662
669
|
workspace_id: s.current
|
|
663
670
|
};
|
|
664
671
|
m.current && (t.conversation_id = m.current), c.current && (t.agent_id = c.current);
|
|
665
|
-
let n =
|
|
672
|
+
let n = ot();
|
|
666
673
|
return n && (t.context = n), t;
|
|
667
674
|
}
|
|
668
675
|
}),
|
|
@@ -672,7 +679,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
672
679
|
onError: (e) => {
|
|
673
680
|
de(e) ? p(!0) : console.warn("[levo-kb-chat] stream error:", e);
|
|
674
681
|
}
|
|
675
|
-
}), v =
|
|
682
|
+
}), v = S(() => {
|
|
676
683
|
_.threads.switchToNewThread().catch((e) => {
|
|
677
684
|
console.warn("[levo-kb-chat] switchToNewThread failed:", e);
|
|
678
685
|
}), g(), u(), p(!1);
|
|
@@ -681,14 +688,14 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
681
688
|
g,
|
|
682
689
|
u
|
|
683
690
|
]);
|
|
684
|
-
return /* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ k(ne, {
|
|
685
692
|
runtime: _,
|
|
686
|
-
children: /* @__PURE__ */
|
|
693
|
+
children: /* @__PURE__ */ k(K.Provider, {
|
|
687
694
|
value: { agentUnavailable: f },
|
|
688
695
|
children: o ? o({
|
|
689
696
|
followUps: l,
|
|
690
697
|
onResetChat: v
|
|
691
|
-
}) : /* @__PURE__ */
|
|
698
|
+
}) : /* @__PURE__ */ k($e, {
|
|
692
699
|
workspaceId: e,
|
|
693
700
|
siteName: t,
|
|
694
701
|
siteLogo: n,
|
|
@@ -699,8 +706,8 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
699
706
|
})
|
|
700
707
|
})
|
|
701
708
|
});
|
|
702
|
-
},
|
|
703
|
-
|
|
709
|
+
}, ct = (e, t, n) => {
|
|
710
|
+
w(() => {
|
|
704
711
|
if (!e) return;
|
|
705
712
|
let r = (e) => {
|
|
706
713
|
if (e.key !== "Escape" || e.isComposing) return;
|
|
@@ -717,16 +724,16 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
717
724
|
t,
|
|
718
725
|
n
|
|
719
726
|
]);
|
|
720
|
-
},
|
|
721
|
-
let [e, t] =
|
|
722
|
-
return
|
|
723
|
-
let e = window.matchMedia(
|
|
727
|
+
}, Z = "(max-width: 639px)", lt = () => {
|
|
728
|
+
let [e, t] = D(() => typeof window < "u" && window.matchMedia(Z).matches);
|
|
729
|
+
return w(() => {
|
|
730
|
+
let e = window.matchMedia(Z), n = () => t(e.matches);
|
|
724
731
|
return n(), e.addEventListener("change", n), () => e.removeEventListener("change", n);
|
|
725
732
|
}, []), e;
|
|
726
|
-
},
|
|
727
|
-
|
|
733
|
+
}, ut = (e, t) => {
|
|
734
|
+
w(() => {
|
|
728
735
|
let n = t.current, r = window.visualViewport;
|
|
729
|
-
if (!e || !n || !r || !window.matchMedia(
|
|
736
|
+
if (!e || !n || !r || !window.matchMedia(Z).matches) return;
|
|
730
737
|
let i = () => {
|
|
731
738
|
n.style.setProperty("--ai-vv-top", `${r.offsetTop}px`), n.style.setProperty("--ai-vv-height", `${r.height}px`);
|
|
732
739
|
};
|
|
@@ -734,8 +741,8 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
734
741
|
r.removeEventListener("resize", i), r.removeEventListener("scroll", i), n.style.removeProperty("--ai-vv-top"), n.style.removeProperty("--ai-vv-height");
|
|
735
742
|
};
|
|
736
743
|
}, [e, t]);
|
|
737
|
-
},
|
|
738
|
-
|
|
744
|
+
}, dt = (e, t, n) => {
|
|
745
|
+
w(() => {
|
|
739
746
|
if (!e) return;
|
|
740
747
|
let r = (e) => {
|
|
741
748
|
let r = e.composedPath();
|
|
@@ -747,57 +754,57 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
747
754
|
t,
|
|
748
755
|
n
|
|
749
756
|
]);
|
|
750
|
-
}, Q = (...e) => e.filter(Boolean).join(" "),
|
|
751
|
-
let _ =
|
|
752
|
-
|
|
757
|
+
}, Q = (...e) => e.filter(Boolean).join(" "), ft = ({ open: e, onToggle: n, askLabel: a, panelId: o, initialDraft: g }) => {
|
|
758
|
+
let _ = U(), v = lt(), y = W((e) => e.thread.isRunning), b = W((e) => e.thread.messages.length > 0), x = W((e) => e.composer.text), S = x.trim().length > 0, [C, M] = D(!1);
|
|
759
|
+
w(() => {
|
|
753
760
|
g && _.thread.composer().setText(g);
|
|
754
761
|
}, []);
|
|
755
|
-
let
|
|
756
|
-
|
|
757
|
-
let e =
|
|
762
|
+
let N = E(null), P = E(null), F = E(!1);
|
|
763
|
+
T(() => {
|
|
764
|
+
let e = N.current;
|
|
758
765
|
!e || document.activeElement === e || (F.current = !0, e.focus({ preventScroll: !0 }));
|
|
759
|
-
}, []),
|
|
760
|
-
let t =
|
|
766
|
+
}, []), T(() => {
|
|
767
|
+
let t = N.current, n = P.current;
|
|
761
768
|
if (!(!t || !n)) {
|
|
762
769
|
if (!e) {
|
|
763
|
-
t.style.height = "",
|
|
770
|
+
t.style.height = "", M(!1);
|
|
764
771
|
return;
|
|
765
772
|
}
|
|
766
|
-
|
|
773
|
+
M(l(n, t));
|
|
767
774
|
}
|
|
768
|
-
}, [
|
|
769
|
-
let I =
|
|
770
|
-
|
|
775
|
+
}, [x, e]);
|
|
776
|
+
let I = E(e);
|
|
777
|
+
w(() => {
|
|
771
778
|
let t = I.current;
|
|
772
779
|
I.current = e;
|
|
773
|
-
let n =
|
|
780
|
+
let n = N.current;
|
|
774
781
|
e || !t || !n || document.activeElement === n && n.blur();
|
|
775
782
|
}, [e]);
|
|
776
|
-
let R =
|
|
777
|
-
|
|
783
|
+
let R = E(y);
|
|
784
|
+
w(() => {
|
|
778
785
|
let e = !R.current && y;
|
|
779
|
-
R.current = y, v && e &&
|
|
786
|
+
R.current = y, v && e && N.current?.blur();
|
|
780
787
|
}, [y, v]);
|
|
781
788
|
let z = b ? "Continue conversation" : a;
|
|
782
|
-
return /* @__PURE__ */
|
|
783
|
-
className: Q(
|
|
784
|
-
children: /* @__PURE__ */
|
|
789
|
+
return /* @__PURE__ */ k("div", {
|
|
790
|
+
className: Q(u, e ? p : r),
|
|
791
|
+
children: /* @__PURE__ */ A("div", {
|
|
785
792
|
ref: P,
|
|
786
|
-
className: Q(
|
|
793
|
+
className: Q(h, C && "ai-chat-pill-surface--stacked"),
|
|
787
794
|
children: [
|
|
788
|
-
/* @__PURE__ */
|
|
795
|
+
/* @__PURE__ */ k("button", {
|
|
789
796
|
type: "button",
|
|
790
|
-
onClick:
|
|
797
|
+
onClick: n,
|
|
791
798
|
"aria-label": e ? "Collapse AI chat" : "Expand AI chat",
|
|
792
799
|
"aria-expanded": e,
|
|
793
|
-
"aria-controls":
|
|
794
|
-
className:
|
|
795
|
-
children: /* @__PURE__ */
|
|
800
|
+
"aria-controls": o,
|
|
801
|
+
className: c,
|
|
802
|
+
children: /* @__PURE__ */ k(te, { className: "h-5 w-5" })
|
|
796
803
|
}),
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
-
className:
|
|
799
|
-
children: [/* @__PURE__ */
|
|
800
|
-
ref:
|
|
804
|
+
/* @__PURE__ */ A("div", {
|
|
805
|
+
className: f,
|
|
806
|
+
children: [/* @__PURE__ */ k(B.Input, {
|
|
807
|
+
ref: N,
|
|
801
808
|
"data-ai-chat-composer": "",
|
|
802
809
|
placeholder: e ? "Ask anything…" : "",
|
|
803
810
|
onFocus: () => {
|
|
@@ -805,10 +812,10 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
805
812
|
F.current = !1;
|
|
806
813
|
return;
|
|
807
814
|
}
|
|
808
|
-
e ||
|
|
815
|
+
e || n();
|
|
809
816
|
},
|
|
810
817
|
onKeyDown: (e) => {
|
|
811
|
-
e.nativeEvent.isComposing || e.key !== "Enter" || e.shiftKey || (e.preventDefault(), !y &&
|
|
818
|
+
e.nativeEvent.isComposing || e.key !== "Enter" || e.shiftKey || (e.preventDefault(), !y && S && _.thread.composer().send());
|
|
812
819
|
},
|
|
813
820
|
rows: 1,
|
|
814
821
|
submitMode: "enter",
|
|
@@ -819,74 +826,74 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
819
826
|
autoCorrect: "off",
|
|
820
827
|
autoCapitalize: "none",
|
|
821
828
|
inputMode: "text",
|
|
822
|
-
className: Q(
|
|
823
|
-
}), /* @__PURE__ */
|
|
824
|
-
className: Q(
|
|
829
|
+
className: Q(i, "transition-opacity duration-200", !e && "opacity-0")
|
|
830
|
+
}), /* @__PURE__ */ k("span", {
|
|
831
|
+
className: Q(s, "transition-opacity duration-150", e && "opacity-0"),
|
|
825
832
|
"aria-hidden": !0,
|
|
826
833
|
children: z
|
|
827
834
|
})]
|
|
828
835
|
}),
|
|
829
|
-
/* @__PURE__ */
|
|
830
|
-
className:
|
|
831
|
-
children: [e && /* @__PURE__ */
|
|
836
|
+
/* @__PURE__ */ A("div", {
|
|
837
|
+
className: m,
|
|
838
|
+
children: [e && /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(B.If, {
|
|
832
839
|
dictation: !1,
|
|
833
|
-
children: /* @__PURE__ */
|
|
840
|
+
children: /* @__PURE__ */ k(B.Dictate, {
|
|
834
841
|
"aria-label": "Start dictation",
|
|
835
842
|
className: "ai-chat-icon-btn flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full transition-colors active:scale-95",
|
|
836
|
-
children: /* @__PURE__ */
|
|
843
|
+
children: /* @__PURE__ */ k(ee, { className: "h-5 w-5" })
|
|
837
844
|
})
|
|
838
|
-
}), /* @__PURE__ */
|
|
845
|
+
}), /* @__PURE__ */ k(B.If, {
|
|
839
846
|
dictation: !0,
|
|
840
|
-
children: /* @__PURE__ */
|
|
847
|
+
children: /* @__PURE__ */ k(B.StopDictation, {
|
|
841
848
|
"aria-label": "Stop dictation",
|
|
842
849
|
className: "flex h-11 w-11 flex-shrink-0 animate-pulse items-center justify-center rounded-full bg-red-500/15 text-red-500 transition-colors hover:bg-red-500/25",
|
|
843
|
-
children: /* @__PURE__ */
|
|
850
|
+
children: /* @__PURE__ */ k(L, { className: "h-4 w-4 fill-current" })
|
|
844
851
|
})
|
|
845
|
-
})] }), e ? y ? /* @__PURE__ */
|
|
852
|
+
})] }), e ? y ? /* @__PURE__ */ k("button", {
|
|
846
853
|
type: "button",
|
|
847
854
|
onClick: () => _.thread.cancelRun(),
|
|
848
855
|
"aria-label": "Stop generating",
|
|
849
856
|
className: t,
|
|
850
|
-
style:
|
|
851
|
-
children: /* @__PURE__ */
|
|
852
|
-
}) : /* @__PURE__ */
|
|
857
|
+
style: d,
|
|
858
|
+
children: /* @__PURE__ */ k(L, { className: "h-4 w-4 fill-current" })
|
|
859
|
+
}) : /* @__PURE__ */ k(B.Send, {
|
|
853
860
|
"aria-label": "Send message",
|
|
854
861
|
className: Q(t, "disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none disabled:hover:scale-100"),
|
|
855
|
-
style:
|
|
856
|
-
children: /* @__PURE__ */
|
|
857
|
-
}) : /* @__PURE__ */
|
|
862
|
+
style: d,
|
|
863
|
+
children: /* @__PURE__ */ k(j, { className: "h-5 w-5 stroke-[2.5px]" })
|
|
864
|
+
}) : /* @__PURE__ */ k("button", {
|
|
858
865
|
type: "button",
|
|
859
|
-
onClick:
|
|
866
|
+
onClick: n,
|
|
860
867
|
"aria-label": "Open AI chat",
|
|
861
868
|
className: t,
|
|
862
|
-
style:
|
|
863
|
-
children: /* @__PURE__ */
|
|
869
|
+
style: d,
|
|
870
|
+
children: /* @__PURE__ */ k(j, { className: "h-5 w-5 stroke-[2.5px]" })
|
|
864
871
|
})]
|
|
865
872
|
})
|
|
866
873
|
]
|
|
867
874
|
})
|
|
868
875
|
});
|
|
869
|
-
},
|
|
870
|
-
let [f, p] =
|
|
871
|
-
|
|
876
|
+
}, pt = "linear-gradient(to right, color-mix(in oklch, var(--ai-chat-thinking-1, oklch(0.65 0.15 253.81)) 40%, transparent), color-mix(in oklch, var(--ai-chat-thinking-2, oklch(0.65 0.15 17.5826)) 40%, transparent))", $ = (...e) => e.filter(Boolean).join(" "), mt = ({ workspaceId: e, siteName: t, siteLogo: n, siteIcon: r, siteSlug: i, agentId: a, apiBaseUrl: s, authHeaders: c, initialOpen: l, initialDraft: u, showBranding: d = !0 }) => {
|
|
877
|
+
let [f, p] = D(!1);
|
|
878
|
+
w(() => {
|
|
872
879
|
if (!l) return;
|
|
873
880
|
let e = requestAnimationFrame(() => p(!0));
|
|
874
881
|
return () => cancelAnimationFrame(e);
|
|
875
882
|
}, [l]);
|
|
876
|
-
let m = `kb-chat-panel-${e ?? "default"}`, h =
|
|
877
|
-
|
|
878
|
-
let v =
|
|
879
|
-
return /* @__PURE__ */
|
|
883
|
+
let m = `kb-chat-panel-${e ?? "default"}`, h = E(null), g = E(null), _ = S(() => p(!1), []);
|
|
884
|
+
ct(f, g, _), dt(f, h, _), ut(f, h);
|
|
885
|
+
let v = o(t);
|
|
886
|
+
return /* @__PURE__ */ k("div", {
|
|
880
887
|
ref: h,
|
|
881
888
|
className: $("ai-chat-launcher pointer-events-none fixed bottom-5 left-1/2 z-[60] flex -translate-x-1/2 flex-col", "ai-chat-kb-wrap", f ? "w-[min(34rem,calc(100vw-1.5rem))]" : "ai-chat-kb-wrap-closed w-[19.5rem]"),
|
|
882
|
-
children: /* @__PURE__ */
|
|
889
|
+
children: /* @__PURE__ */ k(st, {
|
|
883
890
|
workspaceId: e,
|
|
884
891
|
siteName: t,
|
|
885
892
|
siteLogo: n,
|
|
886
|
-
agentId:
|
|
893
|
+
agentId: a,
|
|
887
894
|
apiBaseUrl: s,
|
|
888
895
|
authHeaders: c,
|
|
889
|
-
children: ({ followUps:
|
|
896
|
+
children: ({ followUps: o, onResetChat: l }) => /* @__PURE__ */ k(gt, {
|
|
890
897
|
open: f,
|
|
891
898
|
onToggle: () => p((e) => !e),
|
|
892
899
|
threadStateRef: g,
|
|
@@ -898,119 +905,119 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
898
905
|
siteSlug: i,
|
|
899
906
|
initialDraft: u,
|
|
900
907
|
showBranding: d,
|
|
901
|
-
followUps:
|
|
902
|
-
thread: /* @__PURE__ */
|
|
908
|
+
followUps: o,
|
|
909
|
+
thread: /* @__PURE__ */ k($e, {
|
|
903
910
|
workspaceId: e,
|
|
904
911
|
siteName: t,
|
|
905
912
|
siteLogo: n,
|
|
906
|
-
agentId:
|
|
913
|
+
agentId: a,
|
|
907
914
|
apiBaseUrl: s,
|
|
908
915
|
authHeaders: c,
|
|
909
|
-
followUps:
|
|
916
|
+
followUps: o,
|
|
910
917
|
hideComposer: !0
|
|
911
918
|
})
|
|
912
919
|
})
|
|
913
920
|
})
|
|
914
921
|
});
|
|
915
|
-
},
|
|
922
|
+
}, ht = [
|
|
916
923
|
"rounded-full border border-zinc-200 bg-white text-zinc-700",
|
|
917
924
|
"px-3 py-1 text-[13px] leading-snug",
|
|
918
925
|
"transition-[border-color,background-color,color,transform] duration-150 hover:border-zinc-300 hover:bg-zinc-50 hover:text-zinc-900 active:scale-95"
|
|
919
|
-
].join(" "),
|
|
920
|
-
let
|
|
921
|
-
|
|
922
|
-
isRunning:
|
|
923
|
-
cancelRun: () =>
|
|
926
|
+
].join(" "), gt = ({ open: e, onToggle: t, threadStateRef: n, onResetChat: r, askLabel: i, panelId: a, siteName: o, siteIcon: s, siteSlug: c, initialDraft: l, showBranding: u, followUps: d, thread: f }) => {
|
|
927
|
+
let p = U(), m = W((e) => e.thread.isRunning), h = W((e) => e.thread.messages.length > 0), _ = lt() ? d.slice(0, 2) : d;
|
|
928
|
+
w(() => (n.current = {
|
|
929
|
+
isRunning: m,
|
|
930
|
+
cancelRun: () => p.thread.cancelRun()
|
|
924
931
|
}, () => {
|
|
925
|
-
|
|
932
|
+
n.current = null;
|
|
926
933
|
}), [
|
|
927
|
-
h,
|
|
928
934
|
m,
|
|
929
|
-
|
|
935
|
+
p,
|
|
936
|
+
n
|
|
930
937
|
]);
|
|
931
|
-
let v =
|
|
932
|
-
|
|
933
|
-
}, [
|
|
934
|
-
return /* @__PURE__ */
|
|
935
|
-
/* @__PURE__ */
|
|
938
|
+
let v = S((e) => {
|
|
939
|
+
g(p.thread.composer(), e);
|
|
940
|
+
}, [p]), y = o ?? "Ask AI", b = `https://levo.so/?utm_source=${encodeURIComponent(c || "website")}&utm_term=Powered%20By%20levo.so&utm_campaign=site_agent&utm_medium=organic_site_agent`;
|
|
941
|
+
return /* @__PURE__ */ A(O, { children: [
|
|
942
|
+
/* @__PURE__ */ k("div", {
|
|
936
943
|
"aria-hidden": !0,
|
|
937
|
-
className: $("absolute inset-0",
|
|
944
|
+
className: $("absolute inset-0", e ? "pointer-events-auto" : "pointer-events-none"),
|
|
938
945
|
style: { filter: "drop-shadow(0 16px 32px rgba(0,0,0,0.16)) drop-shadow(0 2px 8px rgba(0,0,0,0.08))" },
|
|
939
|
-
children: /* @__PURE__ */
|
|
940
|
-
className: $("ai-chat-kb-surface h-full w-full p-[2px]", !
|
|
941
|
-
style: { background:
|
|
942
|
-
children: /* @__PURE__ */
|
|
946
|
+
children: /* @__PURE__ */ k("div", {
|
|
947
|
+
className: $("ai-chat-kb-surface h-full w-full p-[2px]", !e && "ai-chat-kb-surface-closed"),
|
|
948
|
+
style: { background: pt },
|
|
949
|
+
children: /* @__PURE__ */ k("div", { className: "h-full w-full rounded-t-[26px] rounded-b-[40px] bg-white" })
|
|
943
950
|
})
|
|
944
951
|
}),
|
|
945
|
-
/* @__PURE__ */
|
|
946
|
-
id:
|
|
952
|
+
/* @__PURE__ */ A("section", {
|
|
953
|
+
id: a,
|
|
947
954
|
"aria-label": "AI chat",
|
|
948
|
-
inert: !
|
|
949
|
-
className: $("relative z-10 flex min-h-0 flex-col", "ai-chat-kb-content",
|
|
955
|
+
inert: !e,
|
|
956
|
+
className: $("relative z-10 flex min-h-0 flex-col", "ai-chat-kb-content", e ? "pointer-events-auto" : "ai-chat-kb-content-closed pointer-events-none"),
|
|
950
957
|
children: [
|
|
951
|
-
/* @__PURE__ */
|
|
958
|
+
/* @__PURE__ */ A("header", {
|
|
952
959
|
className: "flex h-14 w-full shrink-0 items-center justify-between gap-2 px-4",
|
|
953
|
-
children: [/* @__PURE__ */
|
|
960
|
+
children: [/* @__PURE__ */ A("div", {
|
|
954
961
|
className: "flex min-w-0 items-center gap-2",
|
|
955
|
-
children: [
|
|
956
|
-
src:
|
|
962
|
+
children: [s ? /* @__PURE__ */ k("img", {
|
|
963
|
+
src: s,
|
|
957
964
|
alt: "",
|
|
958
965
|
className: "h-6 w-6 shrink-0 rounded-sm object-contain"
|
|
959
|
-
}) : null, /* @__PURE__ */
|
|
966
|
+
}) : null, /* @__PURE__ */ k("span", {
|
|
960
967
|
className: "truncate font-semibold text-sm text-zinc-900",
|
|
961
|
-
children:
|
|
968
|
+
children: y
|
|
962
969
|
})]
|
|
963
|
-
}), /* @__PURE__ */
|
|
970
|
+
}), /* @__PURE__ */ A("div", {
|
|
964
971
|
className: "flex flex-shrink-0 items-center gap-1",
|
|
965
|
-
children: [
|
|
972
|
+
children: [h && /* @__PURE__ */ k("button", {
|
|
966
973
|
type: "button",
|
|
967
|
-
onClick:
|
|
974
|
+
onClick: r,
|
|
968
975
|
"aria-label": "Start new chat",
|
|
969
976
|
title: "Start new chat",
|
|
970
977
|
className: "ai-chat-icon-btn flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full transition-[background-color,color,transform] duration-150 active:scale-95",
|
|
971
|
-
children: /* @__PURE__ */
|
|
972
|
-
}), /* @__PURE__ */
|
|
978
|
+
children: /* @__PURE__ */ k(F, { className: "h-4 w-4" })
|
|
979
|
+
}), /* @__PURE__ */ k("button", {
|
|
973
980
|
type: "button",
|
|
974
|
-
onClick:
|
|
981
|
+
onClick: t,
|
|
975
982
|
"aria-label": "Close AI chat",
|
|
976
983
|
className: "ai-chat-icon-btn flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full transition-[background-color,color,transform] duration-150 active:scale-95",
|
|
977
|
-
children: /* @__PURE__ */
|
|
984
|
+
children: /* @__PURE__ */ k(R, { className: "h-4 w-4" })
|
|
978
985
|
})]
|
|
979
986
|
})]
|
|
980
987
|
}),
|
|
981
|
-
/* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */
|
|
988
|
+
/* @__PURE__ */ k("div", { className: "mx-4 h-px shrink-0 bg-zinc-100" }),
|
|
989
|
+
/* @__PURE__ */ k("div", {
|
|
983
990
|
className: "ai-chat-kb-thread flex max-h-[min(60vh,32rem)] min-h-0 flex-col overflow-hidden",
|
|
984
|
-
children:
|
|
991
|
+
children: f
|
|
985
992
|
}),
|
|
986
|
-
_.length > 0 && !
|
|
993
|
+
_.length > 0 && !m && /* @__PURE__ */ k("div", {
|
|
987
994
|
className: "shrink-0 px-4 pt-1 pb-2",
|
|
988
|
-
children: /* @__PURE__ */
|
|
995
|
+
children: /* @__PURE__ */ k(G, {
|
|
989
996
|
chips: _,
|
|
990
997
|
onSelect: v,
|
|
991
|
-
chipClassName:
|
|
998
|
+
chipClassName: ht
|
|
992
999
|
})
|
|
993
1000
|
})
|
|
994
1001
|
]
|
|
995
1002
|
}),
|
|
996
|
-
/* @__PURE__ */
|
|
1003
|
+
/* @__PURE__ */ k("div", {
|
|
997
1004
|
className: "ai-chat-kb-pillbox pointer-events-auto relative z-20 mx-3 mt-1",
|
|
998
|
-
children: /* @__PURE__ */
|
|
999
|
-
open:
|
|
1000
|
-
onToggle:
|
|
1001
|
-
askLabel:
|
|
1002
|
-
panelId:
|
|
1003
|
-
initialDraft:
|
|
1005
|
+
children: /* @__PURE__ */ k(ft, {
|
|
1006
|
+
open: e,
|
|
1007
|
+
onToggle: t,
|
|
1008
|
+
askLabel: i,
|
|
1009
|
+
panelId: a,
|
|
1010
|
+
initialDraft: l
|
|
1004
1011
|
})
|
|
1005
1012
|
}),
|
|
1006
|
-
|
|
1007
|
-
className: $("pointer-events-none relative z-20 grid shrink-0 transition-[grid-template-rows] duration-[450ms] ease-[cubic-bezier(0.32,0.72,0,1)]",
|
|
1008
|
-
children: /* @__PURE__ */
|
|
1013
|
+
u && /* @__PURE__ */ k("div", {
|
|
1014
|
+
className: $("pointer-events-none relative z-20 grid shrink-0 transition-[grid-template-rows] duration-[450ms] ease-[cubic-bezier(0.32,0.72,0,1)]", e ? "grid-rows-[1fr]" : "grid-rows-[0fr]"),
|
|
1015
|
+
children: /* @__PURE__ */ k("div", {
|
|
1009
1016
|
className: "overflow-hidden",
|
|
1010
|
-
children: /* @__PURE__ */
|
|
1017
|
+
children: /* @__PURE__ */ A("p", {
|
|
1011
1018
|
className: "pt-2 text-center text-[11px] text-zinc-400",
|
|
1012
|
-
children: ["Powered by ", /* @__PURE__ */
|
|
1013
|
-
href:
|
|
1019
|
+
children: ["Powered by ", /* @__PURE__ */ k("a", {
|
|
1020
|
+
href: b,
|
|
1014
1021
|
target: "_blank",
|
|
1015
1022
|
rel: "noopener noreferrer",
|
|
1016
1023
|
className: "pointer-events-auto font-medium text-zinc-500 underline-offset-2 transition-colors hover:text-zinc-700 hover:underline",
|
|
@@ -1019,8 +1026,8 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
|
|
|
1019
1026
|
})
|
|
1020
1027
|
})
|
|
1021
1028
|
}),
|
|
1022
|
-
/* @__PURE__ */
|
|
1029
|
+
/* @__PURE__ */ k("div", { className: "h-3" })
|
|
1023
1030
|
] });
|
|
1024
1031
|
};
|
|
1025
1032
|
//#endregion
|
|
1026
|
-
export {
|
|
1033
|
+
export { mt as KBChatWidget };
|