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