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