@levo-so/site-runtime 0.3.16 → 0.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { S as e, _ as t, a as n, b as r, c as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, r as p, s as m, t as h, u as g, v as _, x as v, y } from "./pillChrome-CEpWGNZB.js";
3
- import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
4
- import { Children as C, createContext as w, isValidElement as T, useCallback as E, useContext as D, useEffect as O, useLayoutEffect as ee, useRef as k, useState as A } from "react";
3
+ import { Children as b, createContext as x, isValidElement as S, useCallback as C, useContext as w, useEffect as T, useLayoutEffect as ee, useRef as E, useState as D } from "react";
4
+ import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
5
5
  import { ArrowUp as j, Check as M, ChevronDown as N, Copy as P, MessageSquarePlus as F, Mic as I, RefreshCw as L, Sparkles as te, Square as R, X as z } from "lucide-react";
6
6
  import { ActionBarPrimitive as B, AssistantRuntimeProvider as ne, ComposerPrimitive as V, MessagePrimitive as H, ThreadPrimitive as U, WebSpeechDictationAdapter as re, useAui as W, useAuiState as G } from "@assistant-ui/react";
7
7
  import { AssistantChatTransport as ie, useChatRuntime as ae } from "@assistant-ui/react-ai-sdk";
@@ -15,9 +15,9 @@ var K = ({ 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__ */ x("div", {
18
+ return /* @__PURE__ */ k("div", {
19
19
  className: ["flex flex-wrap gap-1.5", r].filter(Boolean).join(" "),
20
- children: e.map((e, n) => /* @__PURE__ */ x("button", {
20
+ children: e.map((e, n) => /* @__PURE__ */ k("button", {
21
21
  type: "button",
22
22
  onClick: () => t(e),
23
23
  className: ["ai-chat-chip", i ?? a].join(" "),
@@ -37,10 +37,10 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
37
37
  }
38
38
  })
39
39
  }), le = (e) => {
40
- let t = k(null), n = k(null);
40
+ let t = E(null), n = E(null);
41
41
  return n.current !== (e ?? null) && (n.current = e ?? null, t.current = null), {
42
42
  conversationIdRef: t,
43
- handleFinish: E(({ message: e }) => {
43
+ handleFinish: C(({ message: e }) => {
44
44
  let n = e.metadata;
45
45
  if (!n || typeof n != "object") return;
46
46
  let r = n.conversation_id;
@@ -48,33 +48,33 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
48
48
  let i = r.trim();
49
49
  i.length !== 0 && t.current !== i && (t.current = i);
50
50
  }, []),
51
- reset: E(() => {
51
+ reset: C(() => {
52
52
  t.current = null;
53
53
  }, [])
54
54
  };
55
55
  }, ue = (e = []) => {
56
- let [t, n] = A(e);
56
+ let [t, n] = D(e);
57
57
  return {
58
58
  followUps: t,
59
59
  setFollowUps: n,
60
- clearOnSend: E(() => n([]), []),
61
- handleData: E((e) => {
60
+ clearOnSend: C(() => n([]), []),
61
+ handleData: C((e) => {
62
62
  if (e.type !== "data-follow_ups") return !1;
63
63
  let t = e.data?.suggestions;
64
64
  return Array.isArray(t) ? (n(t.filter((e) => typeof e == "string")), !0) : !1;
65
65
  }, [])
66
66
  };
67
- }, de = (e) => e instanceof Error && e.message.includes("intelligence.site_agent.NO_ACTIVE_AGENT"), q = w({ agentUnavailable: !1 }), fe = () => D(q), pe = (...e) => e.filter(Boolean).join(" "), me = "inline-flex items-center justify-center gap-1.5 transition-all duration-200", he = "rounded-full border border-zinc-200 bg-white/95 px-3 py-1.5 font-medium text-xs text-zinc-500 shadow-lg backdrop-blur-sm hover:text-zinc-900", ge = ({ onClick: e, isRunning: t = !1, iconOnly: n = !1, icon: r = /* @__PURE__ */ x(N, { className: "h-3 w-3" }), className: i = he }) => /* @__PURE__ */ S("button", {
67
+ }, de = (e) => e instanceof Error && e.message.includes("intelligence.site_agent.NO_ACTIVE_AGENT"), q = x({ agentUnavailable: !1 }), fe = () => w(q), pe = (...e) => e.filter(Boolean).join(" "), me = "inline-flex items-center justify-center gap-1.5 transition-all duration-200", he = "rounded-full border border-zinc-200 bg-white/95 px-3 py-1.5 font-medium text-xs text-zinc-500 shadow-lg backdrop-blur-sm hover:text-zinc-900", ge = ({ onClick: e, isRunning: t = !1, iconOnly: n = !1, icon: r = /* @__PURE__ */ k(N, { className: "h-3 w-3" }), className: i = he }) => /* @__PURE__ */ A("button", {
68
68
  type: "button",
69
69
  "aria-label": "Scroll to bottom",
70
70
  onClick: e,
71
71
  className: pe(me, i),
72
72
  children: [r, !n && (t ? "New messages" : "Scroll to bottom")]
73
73
  }), _e = ({ endpoint: e, headers: t, fallback: n, enabled: r = !0 }) => {
74
- let [i, a] = A(null), o = t ? JSON.stringify(t) : "", s = k(t);
74
+ let [i, a] = D(null), o = t ? JSON.stringify(t) : "", s = E(t);
75
75
  s.current = t;
76
- let c = k(n);
77
- return c.current = n, O(() => {
76
+ let c = E(n);
77
+ return c.current = n, T(() => {
78
78
  if (!r || !e) {
79
79
  a([...c.current]);
80
80
  return;
@@ -104,10 +104,10 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
104
104
  o
105
105
  ]), i;
106
106
  }, ve = 36, ye = 80, be = ({ viewportRef: e, isRunning: t, onRunStart: n, anchorOnRunStart: r = !0, atBottomThreshold: i }) => {
107
- let a = k(!1), [o, s] = A(!0), c = k(n);
107
+ let a = E(!1), [o, s] = D(!0), c = E(n);
108
108
  c.current = n;
109
- let l = k(i);
110
- return l.current = i, O(() => {
109
+ let l = E(i);
110
+ return l.current = i, T(() => {
111
111
  let n = a.current;
112
112
  if (a.current = t, !t || n || (c.current?.(), !r)) return;
113
113
  let i = null, o = null;
@@ -128,7 +128,7 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
128
128
  t,
129
129
  e,
130
130
  r
131
- ]), O(() => {
131
+ ]), T(() => {
132
132
  let t = e.current;
133
133
  if (!t) return;
134
134
  let n = () => {
@@ -151,7 +151,7 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
151
151
  });
152
152
  }
153
153
  };
154
- }, xe = (...e) => e.filter(Boolean).join(" "), Se = ({ onStop: e }) => /* @__PURE__ */ x("button", {
154
+ }, xe = (...e) => e.filter(Boolean).join(" "), Se = ({ onStop: e }) => /* @__PURE__ */ k("button", {
155
155
  type: "button",
156
156
  onClick: e,
157
157
  "aria-label": "Stop generating",
@@ -160,34 +160,34 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
160
160
  backgroundColor: "var(--color-brand, #0a0a0a)",
161
161
  color: "var(--color-brand-foreground, #fff)"
162
162
  },
163
- children: /* @__PURE__ */ x(R, { className: "h-3.5 w-3.5 fill-current" })
164
- }), Ce = () => /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(V.If, {
163
+ children: /* @__PURE__ */ k(R, { className: "h-3.5 w-3.5 fill-current" })
164
+ }), Ce = () => /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(V.If, {
165
165
  dictation: !1,
166
- children: /* @__PURE__ */ x(V.Dictate, {
166
+ children: /* @__PURE__ */ k(V.Dictate, {
167
167
  className: "flex h-8 w-8 items-center justify-center rounded-md text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-900",
168
- children: /* @__PURE__ */ x(I, { className: "h-4 w-4" })
168
+ children: /* @__PURE__ */ k(I, { className: "h-4 w-4" })
169
169
  })
170
- }), /* @__PURE__ */ x(V.If, {
170
+ }), /* @__PURE__ */ k(V.If, {
171
171
  dictation: !0,
172
- children: /* @__PURE__ */ x(V.StopDictation, {
172
+ children: /* @__PURE__ */ k(V.StopDictation, {
173
173
  className: "flex h-8 w-8 animate-pulse items-center justify-center rounded-md bg-red-500/15 text-red-500 transition-colors hover:bg-red-500/25",
174
- children: /* @__PURE__ */ x(R, { className: "h-3 w-3 fill-current" })
174
+ children: /* @__PURE__ */ k(R, { className: "h-3 w-3 fill-current" })
175
175
  })
176
- })] }), we = () => /* @__PURE__ */ x(V.Send, {
176
+ })] }), we = () => /* @__PURE__ */ k(V.Send, {
177
177
  "aria-label": "Send message",
178
178
  className: "flex h-9 w-9 items-center justify-center rounded-md shadow-md transition-all duration-300 hover:scale-110 active:scale-95 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none disabled:hover:scale-100",
179
179
  style: {
180
180
  backgroundColor: "var(--color-brand, #0a0a0a)",
181
181
  color: "var(--color-brand-foreground, #fff)"
182
182
  },
183
- children: /* @__PURE__ */ x(j, { className: "h-5 w-5 stroke-[2.5px]" })
183
+ children: /* @__PURE__ */ k(j, { className: "h-5 w-5 stroke-[2.5px]" })
184
184
  }), Te = ({ variant: e, isRunning: t, onStop: n }) => {
185
185
  let r = (e) => {
186
186
  e.nativeEvent.isComposing || t && e.key === "Enter" && !e.shiftKey && e.preventDefault();
187
187
  };
188
- return e === "expanded" ? /* @__PURE__ */ S("div", {
188
+ return e === "expanded" ? /* @__PURE__ */ A("div", {
189
189
  className: "rounded-lg border border-zinc-200 bg-white shadow-sm transition-colors focus-within:border-[var(--color-brand,#a1a1aa)]",
190
- children: [/* @__PURE__ */ x(V.Input, {
190
+ children: [/* @__PURE__ */ k(V.Input, {
191
191
  "data-ai-chat-composer": "",
192
192
  className: xe("ai-chat-textarea w-full resize-none overflow-y-auto bg-transparent px-6 pt-4 text-base text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", "max-h-[160px]"),
193
193
  placeholder: "Ask anything about this site…",
@@ -199,14 +199,14 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
199
199
  inputMode: "text",
200
200
  onInput: (e) => _(e.currentTarget),
201
201
  onKeyDown: r
202
- }), /* @__PURE__ */ S("div", {
202
+ }), /* @__PURE__ */ A("div", {
203
203
  className: "flex items-center justify-between px-3 pt-1 pb-2",
204
- children: [/* @__PURE__ */ x(Ce, {}), t ? /* @__PURE__ */ x(Se, { onStop: n }) : /* @__PURE__ */ x(we, {})]
204
+ children: [/* @__PURE__ */ k(Ce, {}), t ? /* @__PURE__ */ k(Se, { onStop: n }) : /* @__PURE__ */ k(we, {})]
205
205
  })]
206
- }) : /* @__PURE__ */ S("div", {
206
+ }) : /* @__PURE__ */ A("div", {
207
207
  className: "flex items-end gap-2 rounded-lg border border-zinc-200 bg-white p-2 shadow-sm transition-colors focus-within:border-[var(--color-brand,#a1a1aa)]",
208
208
  children: [
209
- /* @__PURE__ */ x(V.Input, {
209
+ /* @__PURE__ */ k(V.Input, {
210
210
  "data-ai-chat-composer": "",
211
211
  className: xe("ai-chat-textarea min-w-0 flex-1 resize-none overflow-y-auto bg-transparent px-2 py-1.5 text-base text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", "max-h-[120px]"),
212
212
  placeholder: "Ask a follow-up…",
@@ -219,27 +219,27 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
219
219
  onInput: (e) => _(e.currentTarget),
220
220
  onKeyDown: r
221
221
  }),
222
- /* @__PURE__ */ x(Ce, {}),
223
- t ? /* @__PURE__ */ x(Se, { onStop: n }) : /* @__PURE__ */ x(we, {})
222
+ /* @__PURE__ */ k(Ce, {}),
223
+ t ? /* @__PURE__ */ k(Se, { onStop: n }) : /* @__PURE__ */ k(we, {})
224
224
  ]
225
225
  });
226
226
  }, 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-md px-2 py-1 text-xs text-zinc-500 transition-colors hover:bg-zinc-100", ke = "rounded-md px-2 py-1 text-xs transition-opacity hover:opacity-80", Ae = ({ autoGrowMax: e, boxClassName: n = Ee, inputClassName: r = De, cancelClassName: i = Oe, sendClassName: a = ke, sendStyle: o }) => {
227
227
  let s = G((e) => e.thread.isRunning);
228
- return /* @__PURE__ */ x(H.Root, {
228
+ return /* @__PURE__ */ k(H.Root, {
229
229
  className: "mb-4 pr-2 pl-0",
230
- children: /* @__PURE__ */ S(V.Root, { children: [/* @__PURE__ */ x("div", {
230
+ children: /* @__PURE__ */ A(V.Root, { children: [/* @__PURE__ */ k("div", {
231
231
  className: n,
232
- children: /* @__PURE__ */ x(V.Input, {
232
+ children: /* @__PURE__ */ k(V.Input, {
233
233
  className: r,
234
234
  rows: 1,
235
235
  onInput: (t) => _(t.currentTarget, e)
236
236
  })
237
- }), /* @__PURE__ */ S("div", {
237
+ }), /* @__PURE__ */ A("div", {
238
238
  className: "mt-2 flex justify-end gap-1.5",
239
- children: [/* @__PURE__ */ x(V.Cancel, {
239
+ children: [/* @__PURE__ */ k(V.Cancel, {
240
240
  className: i,
241
241
  children: "Cancel"
242
- }), /* @__PURE__ */ x(V.Send, {
242
+ }), /* @__PURE__ */ k(V.Send, {
243
243
  disabled: s,
244
244
  className: `${a} ${t}`,
245
245
  style: o,
@@ -248,14 +248,14 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
248
248
  })] })
249
249
  });
250
250
  }, je = 1500, Me = () => {
251
- let [e, t] = A("idle");
252
- return O(() => {
251
+ let [e, t] = D("idle");
252
+ return T(() => {
253
253
  if (e === "idle") return;
254
254
  let n = setTimeout(() => t("idle"), je);
255
255
  return () => clearTimeout(n);
256
256
  }, [e]), {
257
257
  state: e,
258
- run: E(async (e) => {
258
+ run: C(async (e) => {
259
259
  try {
260
260
  await e(), t("copied");
261
261
  } catch {
@@ -280,12 +280,12 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
280
280
  }
281
281
  }, Pe = ({ onCopy: e, idleLabel: t, className: n }) => {
282
282
  let { state: r, run: i } = Me(), { Icon: a, label: o, tone: s } = Ne[r], c = r === "idle" ? t : o;
283
- return /* @__PURE__ */ S("button", {
283
+ return /* @__PURE__ */ A("button", {
284
284
  type: "button",
285
285
  "aria-label": c,
286
286
  onClick: () => i(e),
287
287
  className: `${n} flex items-center gap-1.5 rounded px-2 py-0.5 text-[10px] transition-colors`,
288
- children: [/* @__PURE__ */ x(a, { className: ["h-3 w-3", s].filter(Boolean).join(" ") }), /* @__PURE__ */ x("span", { children: c })]
288
+ children: [/* @__PURE__ */ k(a, { className: ["h-3 w-3", s].filter(Boolean).join(" ") }), /* @__PURE__ */ k("span", { children: c })]
289
289
  });
290
290
  }, Fe = ({ 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" }) => {
291
291
  let { state: a, run: o } = Me(), s = G((e) => e.message), c = () => {
@@ -296,12 +296,12 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
296
296
  copied: t,
297
297
  error: n
298
298
  }[a];
299
- return /* @__PURE__ */ x("button", {
299
+ return /* @__PURE__ */ k("button", {
300
300
  type: "button",
301
301
  "aria-label": a === "idle" ? "Copy message" : u,
302
302
  onClick: c,
303
303
  className: `${r} ${d}`,
304
- children: /* @__PURE__ */ x(l, { className: i })
304
+ children: /* @__PURE__ */ k(l, { className: i })
305
305
  });
306
306
  }, Ie = /^[=@]|^[+-](?![\d.,\s])/, Le = (e) => Ie.test(e) ? `'${e}` : e, Re = (e) => Le((e.innerText || e.textContent || "").replace(/\s+/g, " ").trim()), ze = (e) => Array.from(e.rows).map((e) => Array.from(e.cells).map(Re).join(" ")).join("\n"), Be = new Set([
307
307
  "colspan",
@@ -329,53 +329,53 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
329
329
  }
330
330
  }, Ue = ({ children: e }) => {
331
331
  let t = "plaintext", n = "";
332
- return C.forEach(e, (e) => {
333
- if (T(e)) {
332
+ return b.forEach(e, (e) => {
333
+ if (S(e)) {
334
334
  let r = e.props, i = /language-(\w+)/.exec(r.className ?? "");
335
335
  i && (t = i[1] ?? t), typeof r.children == "string" && (n = r.children.trim());
336
336
  }
337
- }), /* @__PURE__ */ S("div", {
337
+ }), /* @__PURE__ */ A("div", {
338
338
  className: "ai-chat-code not-prose my-4 overflow-hidden rounded-xl border",
339
- children: [/* @__PURE__ */ S("div", {
339
+ children: [/* @__PURE__ */ A("div", {
340
340
  className: "ai-chat-code__header flex items-center justify-between px-4 py-2",
341
- children: [/* @__PURE__ */ x("span", {
341
+ children: [/* @__PURE__ */ k("span", {
342
342
  className: "ai-chat-code__label font-mono text-[10px] uppercase tracking-widest",
343
343
  children: t
344
- }), /* @__PURE__ */ x(Pe, {
344
+ }), /* @__PURE__ */ k(Pe, {
345
345
  idleLabel: "Copy",
346
346
  onCopy: () => navigator.clipboard.writeText(n),
347
347
  className: "ai-chat-code__copy"
348
348
  })]
349
- }), /* @__PURE__ */ x("pre", {
349
+ }), /* @__PURE__ */ k("pre", {
350
350
  className: "ai-chat-code__pre overflow-x-auto px-4 py-4 font-mono text-sm leading-relaxed",
351
351
  children: e
352
352
  })]
353
353
  });
354
- }, We = (e) => /* @__PURE__ */ x("a", {
354
+ }, We = (e) => /* @__PURE__ */ k("a", {
355
355
  ...e,
356
356
  target: "_blank",
357
357
  rel: "noopener noreferrer"
358
358
  }), Ge = ({ className: e, ...t }) => {
359
- let n = k(null);
360
- return /* @__PURE__ */ S("div", {
359
+ let n = E(null);
360
+ return /* @__PURE__ */ A("div", {
361
361
  className: "w-full",
362
- children: [/* @__PURE__ */ x("div", {
362
+ children: [/* @__PURE__ */ k("div", {
363
363
  className: "not-prose mb-1 flex justify-end",
364
- children: /* @__PURE__ */ x(Pe, {
364
+ children: /* @__PURE__ */ k(Pe, {
365
365
  idleLabel: "Copy table",
366
366
  onCopy: () => He(n.current),
367
367
  className: "ai-chat-table__copy"
368
368
  })
369
- }), /* @__PURE__ */ x("div", {
369
+ }), /* @__PURE__ */ k("div", {
370
370
  className: "w-full max-w-full overflow-x-auto",
371
- children: /* @__PURE__ */ x("table", {
371
+ children: /* @__PURE__ */ k("table", {
372
372
  ...t,
373
373
  ref: n,
374
374
  className: ["w-max min-w-full [&_td]:max-w-[20rem] [&_th]:max-w-[20rem]", e].filter(Boolean).join(" ")
375
375
  })
376
376
  })]
377
377
  });
378
- }, Ke = () => /* @__PURE__ */ x(oe, {
378
+ }, Ke = () => /* @__PURE__ */ k(oe, {
379
379
  remarkPlugins: [se],
380
380
  components: {
381
381
  pre: Ue,
@@ -400,8 +400,8 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
400
400
  let t = Math.floor(e / 60), n = e % 60;
401
401
  return t > 0 ? `${t}m ${n.toString().padStart(2, "0")}s` : `${n}s`;
402
402
  }, Ye = ({ phrases: e = qe, 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" }) => {
403
- let [a, o] = A(() => e.length > 0 ? Math.floor(Math.random() * e.length) : 0), [s, c] = A(0);
404
- O(() => {
403
+ let [a, o] = D(() => e.length > 0 ? Math.floor(Math.random() * e.length) : 0), [s, c] = D(0);
404
+ T(() => {
405
405
  let t = e.length > 0 ? setInterval(() => {
406
406
  o((t) => (t + 1) % e.length);
407
407
  }, 2800) : null, n = setInterval(() => {
@@ -412,111 +412,111 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
412
412
  };
413
413
  }, [e.length]);
414
414
  let l = e[a] ?? "Thinking", u = s >= 3, d = s >= 30;
415
- return /* @__PURE__ */ S("div", {
415
+ return /* @__PURE__ */ A("div", {
416
416
  className: "flex flex-wrap items-center gap-x-3 gap-y-0.5 py-1",
417
- children: [/* @__PURE__ */ S("div", {
417
+ children: [/* @__PURE__ */ A("div", {
418
418
  className: "flex min-w-0 items-center gap-3",
419
- children: [/* @__PURE__ */ S("div", {
419
+ children: [/* @__PURE__ */ A("div", {
420
420
  className: "ai-dust",
421
421
  children: [
422
- /* @__PURE__ */ x("span", { style: {
422
+ /* @__PURE__ */ k("span", { style: {
423
423
  left: "4px",
424
424
  "--delay": ".3s"
425
425
  } }),
426
- /* @__PURE__ */ x("span", { style: {
426
+ /* @__PURE__ */ k("span", { style: {
427
427
  left: "12px",
428
428
  "--delay": "0s"
429
429
  } }),
430
- /* @__PURE__ */ x("span", { style: {
430
+ /* @__PURE__ */ k("span", { style: {
431
431
  left: "20px",
432
432
  "--delay": ".6s"
433
433
  } })
434
434
  ]
435
- }), /* @__PURE__ */ S("span", {
435
+ }), /* @__PURE__ */ A("span", {
436
436
  className: `${t} min-w-0 truncate font-semibold text-sm transition-opacity duration-500`,
437
437
  children: [l, "…"]
438
438
  })]
439
- }), u && /* @__PURE__ */ S("span", {
439
+ }), u && /* @__PURE__ */ A("span", {
440
440
  className: `${n} min-w-0 truncate`,
441
- children: [Je(s), d && /* @__PURE__ */ x("span", {
441
+ children: [Je(s), d && /* @__PURE__ */ k("span", {
442
442
  className: r,
443
443
  children: i
444
444
  })]
445
445
  })]
446
446
  });
447
- }, Xe = () => null, Ze = "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", Qe = "group pr-4 pb-6", $e = "mt-2 flex items-center gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100", et = "text-xs text-zinc-500/60", tt = "rounded p-1.5 text-zinc-500 transition-colors hover:text-zinc-900", nt = ({ tools: t = Xe, Parts: n, thinkingIndicator: i = /* @__PURE__ */ x(Ye, {}), rootClassName: a = Qe, contentClassName: o = Ze, metaClassName: s = $e, wrapContent: c, metaSlot: l, copyIdleClassName: u, copyCopiedClassName: d, reloadClassName: f = tt, reloadDisabledReason: p, timeClassName: m = et, timeFormatOptions: h, readOnly: g = !1, belowContent: _, footerSlot: y }) => {
448
- let b = G((e) => e.message), C = e(b), w = n ?? H.Content, T = b.status?.type === "running", E = /* @__PURE__ */ x("div", {
447
+ }, Xe = () => null, Ze = "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", Qe = "group pr-4 pb-6", $e = "mt-2 flex items-center gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100", et = "text-xs text-zinc-500/60", tt = "rounded p-1.5 text-zinc-500 transition-colors hover:text-zinc-900", nt = ({ tools: t = Xe, Parts: n, thinkingIndicator: i = /* @__PURE__ */ k(Ye, {}), rootClassName: a = Qe, contentClassName: o = Ze, metaClassName: s = $e, wrapContent: c, metaSlot: l, copyIdleClassName: u, copyCopiedClassName: d, reloadClassName: f = tt, reloadDisabledReason: p, timeClassName: m = et, timeFormatOptions: h, readOnly: g = !1, belowContent: _, footerSlot: y }) => {
448
+ let b = G((e) => e.message), x = e(b), S = n ?? H.Content, C = b.status?.type === "running", w = /* @__PURE__ */ k("div", {
449
449
  className: o,
450
- children: /* @__PURE__ */ x(w, { components: {
450
+ children: /* @__PURE__ */ k(S, { components: {
451
451
  Text: Ke,
452
452
  tools: { Fallback: t }
453
453
  } })
454
454
  });
455
- return /* @__PURE__ */ x(H.Root, {
455
+ return /* @__PURE__ */ k(H.Root, {
456
456
  className: a,
457
457
  "data-assistant-message": "true",
458
- children: /* @__PURE__ */ S("div", {
458
+ children: /* @__PURE__ */ A("div", {
459
459
  className: "flex min-w-0 flex-col",
460
460
  children: [
461
- c ? c(E) : E,
462
- T && /* @__PURE__ */ x("div", {
461
+ c ? c(w) : w,
462
+ C && /* @__PURE__ */ k("div", {
463
463
  className: "mt-1",
464
464
  children: i
465
465
  }),
466
- !T && _ && /* @__PURE__ */ x("div", {
466
+ !C && _ && /* @__PURE__ */ k("div", {
467
467
  className: "mt-2",
468
468
  children: _
469
469
  }),
470
- !T && /* @__PURE__ */ S("div", {
470
+ !C && /* @__PURE__ */ A("div", {
471
471
  className: s,
472
472
  children: [
473
- /* @__PURE__ */ x("span", {
473
+ /* @__PURE__ */ k("span", {
474
474
  className: m,
475
- title: r(C) || void 0,
476
- children: v(C, h)
475
+ title: r(x) || void 0,
476
+ children: v(x, h)
477
477
  }),
478
478
  l,
479
- /* @__PURE__ */ S(B.Root, {
479
+ /* @__PURE__ */ A(B.Root, {
480
480
  className: "flex items-center gap-0.5",
481
- children: [/* @__PURE__ */ x(Fe, {
481
+ children: [/* @__PURE__ */ k(Fe, {
482
482
  idleClassName: u,
483
483
  copiedClassName: d
484
- }), !g && /* @__PURE__ */ x(B.Reload, {
484
+ }), !g && /* @__PURE__ */ k(B.Reload, {
485
485
  disabled: p ? !0 : void 0,
486
486
  title: p,
487
487
  className: `${f} disabled:cursor-not-allowed disabled:opacity-40`,
488
- children: /* @__PURE__ */ x(L, { className: "h-3 w-3" })
488
+ children: /* @__PURE__ */ k(L, { className: "h-3 w-3" })
489
489
  })]
490
490
  })
491
491
  ]
492
492
  }),
493
- !T && y
493
+ !C && y
494
494
  ]
495
495
  })
496
496
  });
497
497
  }, rt = "group flex flex-col items-end pb-4 pl-12", it = "rounded-2xl border border-zinc-200 bg-zinc-100 px-3.5 py-2.5 text-sm text-zinc-900 leading-relaxed", at = "mt-1 flex items-center gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100", ot = "text-xs text-zinc-500/60", st = "rounded px-2 py-1 font-medium text-xs text-zinc-500 transition-colors hover:text-zinc-900", ct = ({ attachmentsSlot: t, rootClassName: n = rt, bubbleClassName: i = it, contentSlot: a, metaClassName: o = at, timeClassName: s = ot, editClassName: c = st, copyIdleClassName: l, copyCopiedClassName: u, timeFormatOptions: d, readOnly: f = !1, editDisabledReason: p }) => {
498
498
  let m = G((e) => e.message), h = G((e) => e.thread.isRunning), g = e(m);
499
- return /* @__PURE__ */ S(H.Root, {
499
+ return /* @__PURE__ */ A(H.Root, {
500
500
  className: n,
501
501
  "data-user-message": "true",
502
502
  children: [
503
503
  t,
504
- /* @__PURE__ */ x("div", {
504
+ /* @__PURE__ */ k("div", {
505
505
  className: i,
506
- children: a ?? /* @__PURE__ */ x(H.Content, {})
506
+ children: a ?? /* @__PURE__ */ k(H.Content, {})
507
507
  }),
508
- /* @__PURE__ */ S("div", {
508
+ /* @__PURE__ */ A("div", {
509
509
  className: o,
510
- children: [/* @__PURE__ */ x("span", {
510
+ children: [/* @__PURE__ */ k("span", {
511
511
  className: s,
512
512
  title: r(g) || void 0,
513
513
  children: v(g, d)
514
- }), /* @__PURE__ */ S(B.Root, {
514
+ }), /* @__PURE__ */ A(B.Root, {
515
515
  className: "flex items-center gap-0.5",
516
- children: [/* @__PURE__ */ x(Fe, {
516
+ children: [/* @__PURE__ */ k(Fe, {
517
517
  idleClassName: l,
518
518
  copiedClassName: u
519
- }), !f && /* @__PURE__ */ x(B.Edit, {
519
+ }), !f && /* @__PURE__ */ k(B.Edit, {
520
520
  disabled: h || !!p,
521
521
  title: p,
522
522
  className: `${c} disabled:cursor-not-allowed disabled:opacity-40`,
@@ -526,7 +526,7 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
526
526
  })
527
527
  ]
528
528
  });
529
- }, lt = () => /* @__PURE__ */ x(Ae, { sendStyle: {
529
+ }, lt = () => /* @__PURE__ */ k(Ae, { sendStyle: {
530
530
  backgroundColor: "var(--color-brand, #0a0a0a)",
531
531
  color: "var(--color-brand-foreground, #fff)"
532
532
  } }), ut = [
@@ -540,7 +540,7 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
540
540
  "w-2/3",
541
541
  "w-3/5"
542
542
  ], ft = ({ workspaceId: e, siteName: t, siteLogo: n, apiBaseUrl: r, authHeaders: i, agentId: a, followUps: s, hideComposer: c = !1 }) => {
543
- let l = W(), u = G((e) => e.thread.isRunning), { agentUnavailable: d } = fe(), f = k(null), { isAtBottom: p, scrollToBottom: m } = be({
543
+ let l = W(), u = G((e) => e.thread.isRunning), { agentUnavailable: d } = fe(), f = E(null), { isAtBottom: p, scrollToBottom: m } = be({
544
544
  viewportRef: f,
545
545
  isRunning: u
546
546
  }), h = _e({
@@ -550,35 +550,35 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
550
550
  "Levo-Workspace": e
551
551
  } : void 0,
552
552
  fallback: ut
553
- }), g = E((e) => {
553
+ }), g = C((e) => {
554
554
  y(l.thread.composer(), e);
555
- }, [l]), _ = E(() => l.thread.cancelRun(), [l]), v = k(u);
556
- return O(() => {
555
+ }, [l]), _ = C(() => l.thread.cancelRun(), [l]), v = E(u);
556
+ return T(() => {
557
557
  v.current = u;
558
- }, [u]), O(() => {
558
+ }, [u]), T(() => {
559
559
  let e = (e) => {
560
560
  e.key !== "Escape" || e.isComposing || !v.current || (e.preventDefault(), e.stopImmediatePropagation(), l.thread.cancelRun());
561
561
  };
562
562
  return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
563
- }, [l]), /* @__PURE__ */ S(U.Root, {
563
+ }, [l]), /* @__PURE__ */ A(U.Root, {
564
564
  className: "relative flex flex-1 flex-col overflow-hidden",
565
565
  children: [
566
- /* @__PURE__ */ x(U.If, {
566
+ /* @__PURE__ */ k(U.If, {
567
567
  empty: !0,
568
- children: /* @__PURE__ */ x("div", {
568
+ children: /* @__PURE__ */ k("div", {
569
569
  className: "pointer-events-none absolute inset-0 z-0 overflow-hidden",
570
- children: /* @__PURE__ */ x("div", {
570
+ children: /* @__PURE__ */ k("div", {
571
571
  className: "absolute inset-0",
572
572
  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(", ") }
573
573
  })
574
574
  })
575
575
  }),
576
- d && /* @__PURE__ */ x("div", {
576
+ d && /* @__PURE__ */ k("div", {
577
577
  role: "alert",
578
578
  className: "relative z-20 shrink-0 border-amber-200 border-b bg-amber-50 px-4 py-2.5 text-amber-800 text-xs",
579
579
  children: "This conversation is no longer available. Please refresh the page to start a new chat."
580
580
  }),
581
- /* @__PURE__ */ S(U.Viewport, {
581
+ /* @__PURE__ */ A(U.Viewport, {
582
582
  ref: f,
583
583
  turnAnchor: "top",
584
584
  className: "relative z-10 flex-1 overflow-y-auto",
@@ -586,20 +586,20 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
586
586
  scrollToBottomOnRunStart: !1,
587
587
  scrollToBottomOnInitialize: !1,
588
588
  scrollToBottomOnThreadSwitch: !1,
589
- children: [/* @__PURE__ */ x(U.Empty, { children: /* @__PURE__ */ S("div", {
589
+ children: [/* @__PURE__ */ k(U.Empty, { children: /* @__PURE__ */ A("div", {
590
590
  className: "flex min-h-full flex-col items-center justify-center px-6 py-6",
591
- children: [/* @__PURE__ */ S("div", {
591
+ children: [/* @__PURE__ */ A("div", {
592
592
  className: "mb-5 flex flex-col items-center gap-2 text-center",
593
593
  children: [
594
- n ? /* @__PURE__ */ x("img", {
594
+ n ? /* @__PURE__ */ k("img", {
595
595
  src: n,
596
596
  alt: t ?? "Site logo",
597
597
  className: "mb-1 h-12 w-auto max-w-[180px] object-contain"
598
- }) : /* @__PURE__ */ x("span", {
598
+ }) : /* @__PURE__ */ k("span", {
599
599
  className: "font-semibold text-lg text-zinc-900 tracking-tight",
600
600
  children: t ?? "This site"
601
601
  }),
602
- /* @__PURE__ */ x("p", {
602
+ /* @__PURE__ */ k("p", {
603
603
  className: "mt-1 text-2xl text-zinc-900 tracking-tight",
604
604
  style: {
605
605
  fontFamily: "var(--font-heading, inherit)",
@@ -607,18 +607,18 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
607
607
  },
608
608
  children: "Ask anything"
609
609
  }),
610
- /* @__PURE__ */ x("p", {
610
+ /* @__PURE__ */ k("p", {
611
611
  className: "text-sm text-zinc-500",
612
612
  style: { fontFamily: "var(--font-heading, inherit)" },
613
613
  children: "Get instant answers about products, pricing, and how to get started."
614
614
  })
615
615
  ]
616
- }), /* @__PURE__ */ x("div", {
616
+ }), /* @__PURE__ */ k("div", {
617
617
  className: "flex w-full max-w-md flex-col gap-2",
618
- children: h === null ? dt.map((e, t) => /* @__PURE__ */ x("div", {
618
+ children: h === null ? dt.map((e, t) => /* @__PURE__ */ k("div", {
619
619
  className: "flex h-[42px] items-center rounded-xl border border-zinc-200 bg-white px-4",
620
- children: /* @__PURE__ */ x("span", { className: `block h-3 animate-pulse rounded bg-zinc-200 ${e}` })
621
- }, `skeleton-${t}`)) : h.map((e, t) => /* @__PURE__ */ x("button", {
620
+ children: /* @__PURE__ */ k("span", { className: `block h-3 animate-pulse rounded bg-zinc-200 ${e}` })
621
+ }, `skeleton-${t}`)) : h.map((e, t) => /* @__PURE__ */ k("button", {
622
622
  type: "button",
623
623
  onClick: () => g(e),
624
624
  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]",
@@ -626,11 +626,11 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
626
626
  children: e
627
627
  }, e))
628
628
  })]
629
- }) }), /* @__PURE__ */ x(U.If, {
629
+ }) }), /* @__PURE__ */ k(U.If, {
630
630
  empty: !1,
631
- children: /* @__PURE__ */ x("div", {
631
+ children: /* @__PURE__ */ k("div", {
632
632
  className: "ai-chat-kb-messages mx-auto max-w-3xl px-6 py-6 pt-8",
633
- children: /* @__PURE__ */ x(U.Messages, { components: {
633
+ children: /* @__PURE__ */ k(U.Messages, { components: {
634
634
  UserMessage: ct,
635
635
  AssistantMessage: nt,
636
636
  EditComposer: lt
@@ -638,58 +638,58 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
638
638
  })
639
639
  })]
640
640
  }),
641
- !c && /* @__PURE__ */ x("div", {
641
+ !c && /* @__PURE__ */ k("div", {
642
642
  className: "relative z-10 shrink-0 border-zinc-200 border-t bg-white/95 backdrop-blur-sm",
643
- children: /* @__PURE__ */ S("div", {
643
+ children: /* @__PURE__ */ A("div", {
644
644
  className: "relative mx-auto max-w-3xl px-4 pt-3 pb-3",
645
645
  children: [
646
- !p && /* @__PURE__ */ x("div", {
646
+ !p && /* @__PURE__ */ k("div", {
647
647
  className: "pointer-events-none absolute inset-x-0 -top-9 z-20 flex justify-center",
648
- children: /* @__PURE__ */ x(ge, {
648
+ children: /* @__PURE__ */ k(ge, {
649
649
  onClick: m,
650
650
  isRunning: u,
651
651
  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"
652
652
  })
653
653
  }),
654
- s.length > 0 && !u && /* @__PURE__ */ x("div", {
654
+ s.length > 0 && !u && /* @__PURE__ */ k("div", {
655
655
  className: "mb-2",
656
- children: /* @__PURE__ */ x(K, {
656
+ children: /* @__PURE__ */ k(K, {
657
657
  chips: s,
658
658
  onSelect: g,
659
659
  size: "compact"
660
660
  })
661
661
  }),
662
- /* @__PURE__ */ S(V.Root, { children: [
663
- /* @__PURE__ */ x(U.If, {
662
+ /* @__PURE__ */ A(V.Root, { children: [
663
+ /* @__PURE__ */ k(U.If, {
664
664
  empty: !0,
665
- children: /* @__PURE__ */ x(Te, {
665
+ children: /* @__PURE__ */ k(Te, {
666
666
  variant: "expanded",
667
667
  isRunning: u,
668
668
  onStop: _
669
669
  })
670
670
  }),
671
- /* @__PURE__ */ x(U.If, {
671
+ /* @__PURE__ */ k(U.If, {
672
672
  empty: !1,
673
- children: /* @__PURE__ */ x(Te, {
673
+ children: /* @__PURE__ */ k(Te, {
674
674
  variant: "compact",
675
675
  isRunning: u,
676
676
  onStop: _
677
677
  })
678
678
  }),
679
- /* @__PURE__ */ x(V.If, {
679
+ /* @__PURE__ */ k(V.If, {
680
680
  dictation: !0,
681
- children: /* @__PURE__ */ S("div", {
681
+ children: /* @__PURE__ */ A("div", {
682
682
  className: "mt-2 flex items-center justify-center gap-2",
683
- children: [/* @__PURE__ */ x("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-red-500" }), /* @__PURE__ */ x("span", {
683
+ children: [/* @__PURE__ */ k("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-red-500" }), /* @__PURE__ */ k("span", {
684
684
  className: "font-medium text-red-500 text-xs tracking-wide",
685
685
  children: "Listening… speak now"
686
686
  })]
687
687
  })
688
688
  })
689
689
  ] }),
690
- /* @__PURE__ */ x(U.If, {
690
+ /* @__PURE__ */ k(U.If, {
691
691
  empty: !1,
692
- children: /* @__PURE__ */ x("p", {
692
+ children: /* @__PURE__ */ k("p", {
693
693
  className: "mt-2 text-center text-[10px] text-zinc-500/70",
694
694
  children: "Answers can be inaccurate. Verify before relying on them."
695
695
  })
@@ -719,11 +719,11 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
719
719
  let i = document.referrer?.trim();
720
720
  if (i && (e.referrer = i), Object.keys(e).length !== 0) return e.description && Y(e) > J && delete e.description, e.referrer && Y(e) > J && delete e.referrer, e.url && Y(e) > J && (e.url = e.url.slice(0, ht)), e;
721
721
  }, bt = ({ workspaceId: e, siteName: t, siteLogo: n, agentId: r, apiBaseUrl: i, authHeaders: a, children: s }) => {
722
- let c = k(e);
722
+ let c = E(e);
723
723
  c.current = e;
724
- let l = k(r);
724
+ let l = E(r);
725
725
  l.current = r;
726
- let { followUps: u, clearOnSend: d, handleData: f } = ue(), [p, m] = A(!1), { conversationIdRef: h, handleFinish: g, reset: _ } = le(e), v = ae({
726
+ let { followUps: u, clearOnSend: d, handleData: f } = ue(), [p, m] = D(!1), { conversationIdRef: h, handleFinish: g, reset: _ } = le(e), v = ae({
727
727
  joinStrategy: "none",
728
728
  transport: ce({
729
729
  api: `${i}/stream`,
@@ -751,7 +751,7 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
751
751
  onError: (e) => {
752
752
  de(e) ? m(!0) : console.warn("[levo-kb-chat] stream error:", e);
753
753
  }
754
- }), y = E(() => {
754
+ }), y = C(() => {
755
755
  v.threads.switchToNewThread().catch((e) => {
756
756
  console.warn("[levo-kb-chat] switchToNewThread failed:", e);
757
757
  }), _(), d(), m(!1);
@@ -760,14 +760,14 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
760
760
  _,
761
761
  d
762
762
  ]);
763
- return /* @__PURE__ */ x(ne, {
763
+ return /* @__PURE__ */ k(ne, {
764
764
  runtime: v,
765
- children: /* @__PURE__ */ x(q.Provider, {
765
+ children: /* @__PURE__ */ k(q.Provider, {
766
766
  value: { agentUnavailable: p },
767
767
  children: s ? s({
768
768
  followUps: u,
769
769
  onResetChat: y
770
- }) : /* @__PURE__ */ x(ft, {
770
+ }) : /* @__PURE__ */ k(ft, {
771
771
  workspaceId: e,
772
772
  siteName: t,
773
773
  siteLogo: n,
@@ -779,7 +779,7 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
779
779
  })
780
780
  });
781
781
  }, xt = (e, t, n) => {
782
- O(() => {
782
+ T(() => {
783
783
  if (!e) return;
784
784
  let r = (e) => {
785
785
  if (e.key !== "Escape" || e.isComposing) return;
@@ -797,13 +797,13 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
797
797
  n
798
798
  ]);
799
799
  }, X = "(max-width: 639px)", Z = () => {
800
- let [e, t] = A(() => typeof window < "u" && window.matchMedia(X).matches);
801
- return O(() => {
800
+ let [e, t] = D(() => typeof window < "u" && window.matchMedia(X).matches);
801
+ return T(() => {
802
802
  let e = window.matchMedia(X), n = () => t(e.matches);
803
803
  return n(), e.addEventListener("change", n), () => e.removeEventListener("change", n);
804
804
  }, []), e;
805
805
  }, St = (e, t) => {
806
- O(() => {
806
+ T(() => {
807
807
  let n = t.current, r = window.visualViewport;
808
808
  if (!e || !n || !r || !window.matchMedia(X).matches) return;
809
809
  let i = () => {
@@ -814,7 +814,7 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
814
814
  };
815
815
  }, [e, t]);
816
816
  }, Ct = (e, t, n) => {
817
- O(() => {
817
+ T(() => {
818
818
  if (!e) return;
819
819
  let r = (e) => {
820
820
  let r = e.composedPath();
@@ -827,11 +827,11 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
827
827
  n
828
828
  ]);
829
829
  }, Q = (...e) => e.filter(Boolean).join(" "), wt = ({ open: e, onToggle: t, askLabel: r, panelId: o, initialDraft: s }) => {
830
- let _ = W(), v = Z(), y = G((e) => e.thread.isRunning), C = G((e) => e.thread.messages.length > 0), w = G((e) => e.composer.text), T = w.trim().length > 0, [E, D] = A(!1);
831
- O(() => {
830
+ let _ = W(), v = Z(), y = G((e) => e.thread.isRunning), b = G((e) => e.thread.messages.length > 0), x = G((e) => e.composer.text), S = x.trim().length > 0, [C, w] = D(!1);
831
+ T(() => {
832
832
  s && _.thread.composer().setText(s);
833
833
  }, []);
834
- let M = k(null), N = k(null), P = k(!1);
834
+ let M = E(null), N = E(null), P = E(!1);
835
835
  ee(() => {
836
836
  let e = M.current;
837
837
  !e || document.activeElement === e || (P.current = !0, e.focus({ preventScroll: !0 }));
@@ -839,43 +839,43 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
839
839
  let t = M.current, n = N.current;
840
840
  if (!(!t || !n)) {
841
841
  if (!e) {
842
- t.style.height = "", D(!1);
842
+ t.style.height = "", w(!1);
843
843
  return;
844
844
  }
845
- D(u(n, t));
845
+ w(u(n, t));
846
846
  }
847
- }, [w, e]);
848
- let F = k(e);
849
- O(() => {
847
+ }, [x, e]);
848
+ let F = E(e);
849
+ T(() => {
850
850
  let t = F.current;
851
851
  F.current = e;
852
852
  let n = M.current;
853
853
  e || !t || !n || document.activeElement === n && n.blur();
854
854
  }, [e]);
855
- let L = k(y);
856
- O(() => {
855
+ let L = E(y);
856
+ T(() => {
857
857
  let e = !L.current && y;
858
858
  L.current = y, v && e && M.current?.blur();
859
859
  }, [y, v]);
860
- let z = C ? "Continue conversation" : r;
861
- return /* @__PURE__ */ x("div", {
860
+ let z = b ? "Continue conversation" : r;
861
+ return /* @__PURE__ */ k("div", {
862
862
  className: Q(d, e ? m : i),
863
- children: /* @__PURE__ */ S("div", {
863
+ children: /* @__PURE__ */ A("div", {
864
864
  ref: N,
865
- className: Q(g, E && "ai-chat-pill-surface--stacked"),
865
+ className: Q(g, C && "ai-chat-pill-surface--stacked"),
866
866
  children: [
867
- /* @__PURE__ */ x("button", {
867
+ /* @__PURE__ */ k("button", {
868
868
  type: "button",
869
869
  onClick: t,
870
870
  "aria-label": e ? "Collapse AI chat" : "Expand AI chat",
871
871
  "aria-expanded": e,
872
872
  "aria-controls": o,
873
873
  className: l,
874
- children: /* @__PURE__ */ x(te, { className: "h-5 w-5" })
874
+ children: /* @__PURE__ */ k(te, { className: "h-5 w-5" })
875
875
  }),
876
- /* @__PURE__ */ S("div", {
876
+ /* @__PURE__ */ A("div", {
877
877
  className: p,
878
- children: [/* @__PURE__ */ x(V.Input, {
878
+ children: [/* @__PURE__ */ k(V.Input, {
879
879
  ref: M,
880
880
  "data-ai-chat-composer": "",
881
881
  placeholder: e ? "Ask anything…" : "",
@@ -887,7 +887,7 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
887
887
  e || t();
888
888
  },
889
889
  onKeyDown: (e) => {
890
- e.nativeEvent.isComposing || e.key !== "Enter" || e.shiftKey || (e.preventDefault(), !y && T && _.thread.composer().send());
890
+ e.nativeEvent.isComposing || e.key !== "Enter" || e.shiftKey || (e.preventDefault(), !y && S && _.thread.composer().send());
891
891
  },
892
892
  rows: 1,
893
893
  submitMode: "enter",
@@ -899,73 +899,73 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
899
899
  autoCapitalize: "none",
900
900
  inputMode: "text",
901
901
  className: Q(a, "transition-opacity duration-200", !e && "opacity-0")
902
- }), /* @__PURE__ */ x("span", {
902
+ }), /* @__PURE__ */ k("span", {
903
903
  className: Q(c, "transition-opacity duration-150", e && "opacity-0"),
904
904
  "aria-hidden": !0,
905
905
  children: z
906
906
  })]
907
907
  }),
908
- /* @__PURE__ */ S("div", {
908
+ /* @__PURE__ */ A("div", {
909
909
  className: h,
910
- children: [e && /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(V.If, {
910
+ children: [e && /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(V.If, {
911
911
  dictation: !1,
912
- children: /* @__PURE__ */ x(V.Dictate, {
912
+ children: /* @__PURE__ */ k(V.Dictate, {
913
913
  "aria-label": "Start dictation",
914
914
  className: "ai-chat-icon-btn flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full transition-colors active:scale-95",
915
- children: /* @__PURE__ */ x(I, { className: "h-5 w-5" })
915
+ children: /* @__PURE__ */ k(I, { className: "h-5 w-5" })
916
916
  })
917
- }), /* @__PURE__ */ x(V.If, {
917
+ }), /* @__PURE__ */ k(V.If, {
918
918
  dictation: !0,
919
- children: /* @__PURE__ */ x(V.StopDictation, {
919
+ children: /* @__PURE__ */ k(V.StopDictation, {
920
920
  "aria-label": "Stop dictation",
921
921
  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",
922
- children: /* @__PURE__ */ x(R, { className: "h-4 w-4 fill-current" })
922
+ children: /* @__PURE__ */ k(R, { className: "h-4 w-4 fill-current" })
923
923
  })
924
- })] }), e ? y ? /* @__PURE__ */ x("button", {
924
+ })] }), e ? y ? /* @__PURE__ */ k("button", {
925
925
  type: "button",
926
926
  onClick: () => _.thread.cancelRun(),
927
927
  "aria-label": "Stop generating",
928
928
  className: n,
929
929
  style: f,
930
- children: /* @__PURE__ */ x(R, { className: "h-4 w-4 fill-current" })
931
- }) : /* @__PURE__ */ x(V.Send, {
930
+ children: /* @__PURE__ */ k(R, { className: "h-4 w-4 fill-current" })
931
+ }) : /* @__PURE__ */ k(V.Send, {
932
932
  "aria-label": "Send message",
933
933
  className: Q(n, "disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none disabled:hover:scale-100"),
934
934
  style: f,
935
- children: /* @__PURE__ */ x(j, { className: "h-5 w-5 stroke-[2.5px]" })
936
- }) : /* @__PURE__ */ x("button", {
935
+ children: /* @__PURE__ */ k(j, { className: "h-5 w-5 stroke-[2.5px]" })
936
+ }) : /* @__PURE__ */ k("button", {
937
937
  type: "button",
938
938
  onClick: t,
939
939
  "aria-label": "Open AI chat",
940
940
  className: n,
941
941
  style: f,
942
- children: /* @__PURE__ */ x(j, { className: "h-5 w-5 stroke-[2.5px]" })
942
+ children: /* @__PURE__ */ k(j, { className: "h-5 w-5 stroke-[2.5px]" })
943
943
  })]
944
944
  })
945
945
  ]
946
946
  })
947
947
  });
948
948
  }, Tt = "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(" "), Et = ({ workspaceId: e, siteName: t, siteLogo: n, siteIcon: r, siteSlug: i, agentId: a, apiBaseUrl: o, authHeaders: c, initialOpen: l, initialDraft: u, showBranding: d = !0 }) => {
949
- let [f, p] = A(!1);
950
- O(() => {
949
+ let [f, p] = D(!1);
950
+ T(() => {
951
951
  if (!l) return;
952
952
  let e = requestAnimationFrame(() => p(!0));
953
953
  return () => cancelAnimationFrame(e);
954
954
  }, [l]);
955
- let m = `kb-chat-panel-${e ?? "default"}`, h = k(null), g = k(null), _ = E(() => p(!1), []);
955
+ let m = `kb-chat-panel-${e ?? "default"}`, h = E(null), g = E(null), _ = C(() => p(!1), []);
956
956
  xt(f, g, _), Ct(f, h, _), St(f, h);
957
957
  let v = s(t);
958
- return /* @__PURE__ */ x("div", {
958
+ return /* @__PURE__ */ k("div", {
959
959
  ref: h,
960
960
  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]"),
961
- children: /* @__PURE__ */ x(bt, {
961
+ children: /* @__PURE__ */ k(bt, {
962
962
  workspaceId: e,
963
963
  siteName: t,
964
964
  siteLogo: n,
965
965
  agentId: a,
966
966
  apiBaseUrl: o,
967
967
  authHeaders: c,
968
- children: ({ followUps: s, onResetChat: l }) => /* @__PURE__ */ x(Ot, {
968
+ children: ({ followUps: s, onResetChat: l }) => /* @__PURE__ */ k(Ot, {
969
969
  open: f,
970
970
  onToggle: () => p((e) => !e),
971
971
  threadStateRef: g,
@@ -978,7 +978,7 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
978
978
  initialDraft: u,
979
979
  showBranding: d,
980
980
  followUps: s,
981
- thread: /* @__PURE__ */ x(ft, {
981
+ thread: /* @__PURE__ */ k(ft, {
982
982
  workspaceId: e,
983
983
  siteName: t,
984
984
  siteLogo: n,
@@ -997,7 +997,7 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
997
997
  "transition-[border-color,background-color,color,transform] duration-150 hover:border-zinc-300 hover:bg-zinc-50 hover:text-zinc-900 active:scale-95"
998
998
  ].join(" "), Ot = ({ 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 }) => {
999
999
  let p = W(), m = G((e) => e.thread.isRunning), h = G((e) => e.thread.messages.length > 0), g = Z() ? d.slice(0, 2) : d;
1000
- O(() => (n.current = {
1000
+ T(() => (n.current = {
1001
1001
  isRunning: m,
1002
1002
  cancelRun: () => p.thread.cancelRun()
1003
1003
  }, () => {
@@ -1007,64 +1007,64 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
1007
1007
  p,
1008
1008
  n
1009
1009
  ]);
1010
- let _ = E((e) => {
1010
+ let _ = C((e) => {
1011
1011
  y(p.thread.composer(), e);
1012
- }, [p]), v = o ?? "Ask AI", C = `https://levo.so/?utm_source=${encodeURIComponent(c || "website")}&utm_term=Powered%20By%20levo.so&utm_campaign=site_agent&utm_medium=organic_site_agent`;
1013
- return /* @__PURE__ */ S(b, { children: [
1014
- /* @__PURE__ */ x("div", {
1012
+ }, [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`;
1013
+ return /* @__PURE__ */ A(O, { children: [
1014
+ /* @__PURE__ */ k("div", {
1015
1015
  "aria-hidden": !0,
1016
1016
  className: $("absolute inset-0", e ? "pointer-events-auto" : "pointer-events-none"),
1017
1017
  style: { filter: "drop-shadow(0 16px 32px rgba(0,0,0,0.16)) drop-shadow(0 2px 8px rgba(0,0,0,0.08))" },
1018
- children: /* @__PURE__ */ x("div", {
1018
+ children: /* @__PURE__ */ k("div", {
1019
1019
  className: $("ai-chat-kb-surface h-full w-full p-[2px]", !e && "ai-chat-kb-surface-closed"),
1020
1020
  style: { background: Tt },
1021
- children: /* @__PURE__ */ x("div", { className: "h-full w-full rounded-t-[26px] rounded-b-[40px] bg-white" })
1021
+ children: /* @__PURE__ */ k("div", { className: "h-full w-full rounded-t-[26px] rounded-b-[40px] bg-white" })
1022
1022
  })
1023
1023
  }),
1024
- /* @__PURE__ */ S("section", {
1024
+ /* @__PURE__ */ A("section", {
1025
1025
  id: a,
1026
1026
  "aria-label": "AI chat",
1027
1027
  inert: !e,
1028
1028
  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"),
1029
1029
  children: [
1030
- /* @__PURE__ */ S("header", {
1030
+ /* @__PURE__ */ A("header", {
1031
1031
  className: "flex h-14 w-full shrink-0 items-center justify-between gap-2 px-4",
1032
- children: [/* @__PURE__ */ S("div", {
1032
+ children: [/* @__PURE__ */ A("div", {
1033
1033
  className: "flex min-w-0 items-center gap-2",
1034
- children: [s ? /* @__PURE__ */ x("img", {
1034
+ children: [s ? /* @__PURE__ */ k("img", {
1035
1035
  src: s,
1036
1036
  alt: "",
1037
1037
  className: "h-6 w-6 shrink-0 rounded-sm object-contain"
1038
- }) : null, /* @__PURE__ */ x("span", {
1038
+ }) : null, /* @__PURE__ */ k("span", {
1039
1039
  className: "truncate font-semibold text-sm text-zinc-900",
1040
1040
  children: v
1041
1041
  })]
1042
- }), /* @__PURE__ */ S("div", {
1042
+ }), /* @__PURE__ */ A("div", {
1043
1043
  className: "flex flex-shrink-0 items-center gap-1",
1044
- children: [h && /* @__PURE__ */ x("button", {
1044
+ children: [h && /* @__PURE__ */ k("button", {
1045
1045
  type: "button",
1046
1046
  onClick: r,
1047
1047
  "aria-label": "Start new chat",
1048
1048
  title: "Start new chat",
1049
1049
  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",
1050
- children: /* @__PURE__ */ x(F, { className: "h-4 w-4" })
1051
- }), /* @__PURE__ */ x("button", {
1050
+ children: /* @__PURE__ */ k(F, { className: "h-4 w-4" })
1051
+ }), /* @__PURE__ */ k("button", {
1052
1052
  type: "button",
1053
1053
  onClick: t,
1054
1054
  "aria-label": "Close AI chat",
1055
1055
  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",
1056
- children: /* @__PURE__ */ x(z, { className: "h-4 w-4" })
1056
+ children: /* @__PURE__ */ k(z, { className: "h-4 w-4" })
1057
1057
  })]
1058
1058
  })]
1059
1059
  }),
1060
- /* @__PURE__ */ x("div", { className: "mx-4 h-px shrink-0 bg-zinc-100" }),
1061
- /* @__PURE__ */ x("div", {
1060
+ /* @__PURE__ */ k("div", { className: "mx-4 h-px shrink-0 bg-zinc-100" }),
1061
+ /* @__PURE__ */ k("div", {
1062
1062
  className: "ai-chat-kb-thread flex max-h-[min(60vh,32rem)] min-h-0 flex-col overflow-hidden",
1063
1063
  children: f
1064
1064
  }),
1065
- g.length > 0 && !m && /* @__PURE__ */ x("div", {
1065
+ g.length > 0 && !m && /* @__PURE__ */ k("div", {
1066
1066
  className: "shrink-0 px-4 pt-1 pb-2",
1067
- children: /* @__PURE__ */ x(K, {
1067
+ children: /* @__PURE__ */ k(K, {
1068
1068
  chips: g,
1069
1069
  onSelect: _,
1070
1070
  chipClassName: Dt
@@ -1072,9 +1072,9 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
1072
1072
  })
1073
1073
  ]
1074
1074
  }),
1075
- /* @__PURE__ */ x("div", {
1075
+ /* @__PURE__ */ k("div", {
1076
1076
  className: "ai-chat-kb-pillbox pointer-events-auto relative z-20 mx-3 mt-1",
1077
- children: /* @__PURE__ */ x(wt, {
1077
+ children: /* @__PURE__ */ k(wt, {
1078
1078
  open: e,
1079
1079
  onToggle: t,
1080
1080
  askLabel: i,
@@ -1082,14 +1082,14 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
1082
1082
  initialDraft: l
1083
1083
  })
1084
1084
  }),
1085
- u && /* @__PURE__ */ x("div", {
1085
+ u && /* @__PURE__ */ k("div", {
1086
1086
  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]"),
1087
- children: /* @__PURE__ */ x("div", {
1087
+ children: /* @__PURE__ */ k("div", {
1088
1088
  className: "overflow-hidden",
1089
- children: /* @__PURE__ */ S("p", {
1089
+ children: /* @__PURE__ */ A("p", {
1090
1090
  className: "pt-2 text-center text-[11px] text-zinc-400",
1091
- children: ["Powered by ", /* @__PURE__ */ x("a", {
1092
- href: C,
1091
+ children: ["Powered by ", /* @__PURE__ */ k("a", {
1092
+ href: b,
1093
1093
  target: "_blank",
1094
1094
  rel: "noopener noreferrer",
1095
1095
  className: "pointer-events-auto font-medium text-zinc-500 underline-offset-2 transition-colors hover:text-zinc-700 hover:underline",
@@ -1098,7 +1098,7 @@ var K = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
1098
1098
  })
1099
1099
  })
1100
1100
  }),
1101
- /* @__PURE__ */ x("div", { className: "h-3" })
1101
+ /* @__PURE__ */ k("div", { className: "h-3" })
1102
1102
  ] });
1103
1103
  };
1104
1104
  //#endregion