@object-ui/plugin-chatbot 7.0.0 → 7.1.0

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/dist/index.js CHANGED
@@ -1,45 +1,45 @@
1
1
  import * as e from "react";
2
2
  import { Children as t, Fragment as n, createContext as r, isValidElement as i, memo as a, useCallback as o, useContext as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
3
- import { Alert as f, AlertDescription as p, Avatar as m, AvatarFallback as h, AvatarImage as g, Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, Command as D, CommandEmpty as O, CommandGroup as k, CommandInput as A, CommandItem as j, CommandList as M, CommandSeparator as N, DropdownMenu as ee, DropdownMenuContent as te, DropdownMenuItem as P, DropdownMenuTrigger as F, Empty as ne, EmptyDescription as I, EmptyHeader as re, EmptyMedia as ie, EmptyTitle as ae, HoverCard as L, HoverCardContent as R, HoverCardTrigger as z, Input as oe, Label as B, ScrollArea as se, ScrollBar as ce, Select as le, SelectContent as ue, SelectItem as de, SelectTrigger as fe, SelectValue as pe, Separator as me, Sheet as he, SheetContent as ge, SheetDescription as _e, SheetHeader as V, SheetTitle as ve, Skeleton as H, Table as ye, TableBody as be, TableCell as U, TableHead as W, TableHeader as G, TableRow as K, Tabs as xe, TabsList as q, TabsTrigger as Se, Textarea as Ce, Tooltip as we, TooltipContent as Te, TooltipProvider as Ee, TooltipTrigger as De, cn as J } from "@object-ui/components";
4
- import { AlertCircle as Oe, ArrowDownIcon as ke, ArrowRight as Ae, BookIcon as je, Bot as Me, BrainIcon as Ne, Check as Pe, CheckCircle2 as Y, CheckCircleIcon as Fe, CheckIcon as Ie, ChevronDownIcon as Le, ChevronLeftIcon as Re, ChevronRightIcon as ze, CircleIcon as Be, ClipboardList as Ve, Clock as He, Clock3 as Ue, ClockIcon as We, Copy as Ge, CopyIcon as Ke, CornerDownLeft as qe, CornerDownLeftIcon as Je, Eye as Ye, GitCompareArrows as Xe, HelpCircle as Ze, ImageIcon as Qe, Inbox as $e, Loader2 as et, Loader2Icon as tt, Maximize2 as nt, MicIcon as rt, Minimize2 as it, PaperclipIcon as at, PlusIcon as ot, RefreshCw as st, Rocket as ct, Send as lt, ShieldCheck as ut, SquareIcon as dt, Table2 as ft, TriangleAlert as pt, WrenchIcon as mt, X as ht, XCircle as X, XCircleIcon as gt, XIcon as _t } from "lucide-react";
3
+ import { Alert as f, AlertDescription as p, Avatar as m, AvatarFallback as h, AvatarImage as g, Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, Command as D, CommandEmpty as O, CommandGroup as k, CommandInput as A, CommandItem as j, CommandList as M, CommandSeparator as N, DropdownMenu as ee, DropdownMenuContent as te, DropdownMenuItem as P, DropdownMenuTrigger as F, Empty as ne, EmptyDescription as re, EmptyHeader as I, EmptyMedia as ie, EmptyTitle as ae, HoverCard as L, HoverCardContent as oe, HoverCardTrigger as R, Input as z, Label as B, ScrollArea as se, ScrollBar as ce, Select as le, SelectContent as ue, SelectItem as de, SelectTrigger as fe, SelectValue as pe, Separator as me, Sheet as he, SheetContent as ge, SheetDescription as _e, SheetHeader as ve, SheetTitle as ye, Skeleton as V, Table as be, TableBody as H, TableCell as U, TableHead as W, TableHeader as xe, TableRow as G, Tabs as K, TabsList as Se, TabsTrigger as Ce, Textarea as q, Tooltip as we, TooltipContent as Te, TooltipProvider as Ee, TooltipTrigger as De, cn as J } from "@object-ui/components";
4
+ import { AlertCircle as Oe, ArrowDownIcon as ke, ArrowRight as Ae, BookIcon as je, Bot as Me, BrainIcon as Ne, Check as Pe, CheckCircle2 as Y, CheckCircleIcon as Fe, CheckIcon as Ie, ChevronDownIcon as Le, ChevronLeftIcon as Re, ChevronRightIcon as ze, CircleIcon as Be, ClipboardList as Ve, Clock as He, Clock3 as Ue, ClockIcon as We, Copy as Ge, CopyIcon as Ke, CornerDownLeft as qe, CornerDownLeftIcon as Je, Eye as Ye, GitCompareArrows as Xe, HelpCircle as Ze, ImageIcon as Qe, Inbox as $e, Loader2 as et, Loader2Icon as tt, Maximize2 as nt, MicIcon as rt, Minimize2 as it, PaperclipIcon as at, PlusIcon as ot, RefreshCw as st, Rocket as ct, Send as lt, ShieldCheck as ut, SquareIcon as dt, Table2 as ft, TriangleAlert as pt, WifiOff as mt, WrenchIcon as ht, X as gt, XCircle as X, XCircleIcon as _t, XIcon as vt } from "lucide-react";
5
5
  import { Fragment as Z, jsx as Q, jsxs as $ } from "react/jsx-runtime";
6
- import { useChat as vt } from "@ai-sdk/react";
7
- import { DefaultChatTransport as yt } from "ai";
8
- import * as bt from "react-dom";
9
- import { SchemaRenderer as xt, useObjectTranslation as St } from "@object-ui/react";
10
- import { StickToBottom as Ct, useStickToBottomContext as wt } from "use-stick-to-bottom";
11
- import { cva as Tt } from "class-variance-authority";
12
- import { Slot as Et } from "@radix-ui/react-slot";
13
- import { Streamdown as Dt } from "streamdown";
14
- import { nanoid as Ot } from "nanoid";
15
- import { codeToHtml as kt } from "shiki";
16
- import { useControllableState as At } from "@radix-ui/react-use-controllable-state";
17
- import { motion as jt } from "motion/react";
18
- import { ComponentRegistry as Mt } from "@object-ui/core";
6
+ import { useChat as yt } from "@ai-sdk/react";
7
+ import { DefaultChatTransport as bt } from "ai";
8
+ import * as xt from "react-dom";
9
+ import { SchemaRenderer as St, useObjectTranslation as Ct } from "@object-ui/react";
10
+ import { StickToBottom as wt, useStickToBottomContext as Tt } from "use-stick-to-bottom";
11
+ import { cva as Et } from "class-variance-authority";
12
+ import { Slot as Dt } from "@radix-ui/react-slot";
13
+ import { Streamdown as Ot } from "streamdown";
14
+ import { nanoid as kt } from "nanoid";
15
+ import { codeToHtml as At } from "shiki";
16
+ import { useControllableState as jt } from "@radix-ui/react-use-controllable-state";
17
+ import { motion as Mt } from "motion/react";
18
+ import { ComponentRegistry as Nt } from "@object-ui/core";
19
19
  //#region \0rolldown/runtime.js
20
- var Nt = Object.defineProperty, Pt = (e, t) => {
20
+ var Pt = Object.defineProperty, Ft = (e, t) => {
21
21
  let n = {};
22
- for (var r in e) Nt(n, r, {
22
+ for (var r in e) Pt(n, r, {
23
23
  get: e[r],
24
24
  enumerable: !0
25
25
  });
26
- return t || Nt(n, Symbol.toStringTag, { value: "Module" }), n;
26
+ return t || Pt(n, Symbol.toStringTag, { value: "Module" }), n;
27
27
  };
28
28
  //#endregion
29
29
  //#region src/utils.ts
30
- function Ft(e = "msg") {
30
+ function It(e = "msg") {
31
31
  return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
32
32
  }
33
33
  //#endregion
34
34
  //#region src/mapMessages.ts
35
- function It(e, t) {
35
+ function Lt(e, t) {
36
36
  return typeof e.content == "string" ? e.content : t.filter((e) => e.type === "text").map((e) => e.text ?? "").join("");
37
37
  }
38
- function Lt(e) {
38
+ function Rt(e) {
39
39
  let t = e.filter((e) => e.type === "reasoning" || e.type === "reasoning-delta").map((e) => e.text ?? "").join("\n").trim();
40
40
  return t.length > 0 ? t : void 0;
41
41
  }
42
- function Rt(e) {
42
+ function zt(e) {
43
43
  let t = (e) => {
44
44
  if (e && typeof e == "object") return e;
45
45
  if (typeof e != "string") return;
@@ -62,8 +62,8 @@ function Rt(e) {
62
62
  }
63
63
  return r;
64
64
  }
65
- function zt(e) {
66
- let t = Rt(e);
65
+ function Bt(e) {
66
+ let t = zt(e);
67
67
  if (!t) return;
68
68
  let n = t.pendingActionId;
69
69
  if (t.status === "pending_approval" && typeof n == "string" && n.length > 0) return {
@@ -71,11 +71,11 @@ function zt(e) {
71
71
  raw: t
72
72
  };
73
73
  }
74
- function Bt(e) {
74
+ function Vt(e) {
75
75
  return Array.isArray(e) ? e.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
76
76
  }
77
- function Vt(e) {
78
- let t = Rt(e);
77
+ function Ht(e) {
78
+ let t = zt(e);
79
79
  if (!t || t.status !== "blueprint_proposed") return;
80
80
  let n = t.blueprint, r = n && typeof n == "object" ? n : {}, i = (Array.isArray(r.objects) ? r.objects : []).flatMap((e) => {
81
81
  let t = e;
@@ -91,7 +91,7 @@ function Vt(e) {
91
91
  views: a(o.views, Array.isArray(r.views) ? r.views.length : 0),
92
92
  dashboards: a(o.dashboards, Array.isArray(r.dashboards) ? r.dashboards.length : 0),
93
93
  seedData: a(o.seedData, Array.isArray(r.seedData) ? r.seedData.length : 0)
94
- }, c = Bt(t.questions), l = t.questionChoices, u = Array.isArray(l) ? l.flatMap((e) => {
94
+ }, c = Vt(t.questions), l = t.questionChoices, u = Array.isArray(l) ? l.flatMap((e) => {
95
95
  let t = e;
96
96
  if (typeof t?.text != "string" || !t.text) return [];
97
97
  let n = Array.isArray(t.options) ? t.options.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
@@ -104,14 +104,14 @@ function Vt(e) {
104
104
  ...d ? { summary: d } : {},
105
105
  objects: i,
106
106
  counts: s,
107
- questions: c.length ? c : Bt(r.questions),
107
+ questions: c.length ? c : Vt(r.questions),
108
108
  ...u.length ? { questionChoices: u } : {},
109
- assumptions: Bt(r.assumptions),
109
+ assumptions: Vt(r.assumptions),
110
110
  ...typeof f == "string" && f ? { targetApp: f } : {}
111
111
  };
112
112
  }
113
- function Ht(e) {
114
- let t = Rt(e);
113
+ function Ut(e) {
114
+ let t = zt(e);
115
115
  if (!t || t.status !== "drafted") return;
116
116
  let n = [];
117
117
  if (Array.isArray(t.drafted)) {
@@ -151,23 +151,23 @@ function Ht(e) {
151
151
  ...s.length ? { issues: s } : {}
152
152
  };
153
153
  }
154
- function Ut(e) {
154
+ function Wt(e) {
155
155
  return e.replace(/[._-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (e) => e.toUpperCase());
156
156
  }
157
- function Wt(e) {
157
+ function Gt(e) {
158
158
  if (!e || !Array.isArray(e.items) || e.items.length === 0) return;
159
159
  let t = e.items.find((e) => e.type === "app");
160
160
  if (t) return {
161
161
  phase: "done",
162
- appLabel: Ut(t.name),
162
+ appLabel: Wt(t.name),
163
163
  items: e.items,
164
164
  done: e.items.length,
165
165
  total: e.items.length
166
166
  };
167
167
  }
168
- function Gt(e, t = {}) {
168
+ function Kt(e, t = {}) {
169
169
  return e.filter((e) => e.type === "dynamic-tool" ? !0 : typeof e.type == "string" && e.type.startsWith("tool-")).map((e) => {
170
- let n = e.type === "dynamic-tool" ? e.toolName ?? "tool" : typeof e.type == "string" ? e.type.replace(/^tool-/, "") : "tool", r = e.output ?? e.result, i = zt(r), a = Ht(r), o = Vt(r), s = e.state, c = (s === "input-available" || s === "input-streaming") && (r !== void 0 || !t.liveTail) ? "output-available" : s, l = i && c !== "output-error" ? "approval-requested" : c;
170
+ let n = e.type === "dynamic-tool" ? e.toolName ?? "tool" : typeof e.type == "string" ? e.type.replace(/^tool-/, "") : "tool", r = e.output ?? e.result, i = Bt(r), a = Ut(r), o = Ht(r), s = e.state, c = (s === "input-available" || s === "input-streaming") && (r !== void 0 || !t.liveTail) ? "output-available" : s, l = i && c !== "output-error" ? "approval-requested" : c;
171
171
  return {
172
172
  toolCallId: e.toolCallId ?? e.id ?? `${e.type ?? "tool"}-${Math.random().toString(36).slice(2, 8)}`,
173
173
  toolName: n,
@@ -181,7 +181,7 @@ function Gt(e, t = {}) {
181
181
  };
182
182
  });
183
183
  }
184
- function Kt(e) {
184
+ function qt(e) {
185
185
  let t = e.filter((e) => e.type === "source-url" || e.type === "source").map((e) => ({
186
186
  id: e.id,
187
187
  title: e.title,
@@ -189,7 +189,7 @@ function Kt(e) {
189
189
  })).filter((e) => !!e.url);
190
190
  return t.length > 0 ? t : void 0;
191
191
  }
192
- function qt(e) {
192
+ function Jt(e) {
193
193
  let t = e.filter((e) => e.type === "data-build-progress").pop()?.data;
194
194
  if (!t || typeof t != "object") return;
195
195
  let n = t, r = Array.isArray(n.items) ? n.items.filter((e) => typeof e?.type == "string" && typeof e?.name == "string").map((e) => ({
@@ -205,7 +205,7 @@ function qt(e) {
205
205
  ...typeof n.seq == "number" ? { seq: n.seq } : {}
206
206
  };
207
207
  }
208
- function Jt(e) {
208
+ function Yt(e) {
209
209
  let t = [];
210
210
  for (let n of e) {
211
211
  if (n.type !== "data-chart") continue;
@@ -225,28 +225,28 @@ function Jt(e) {
225
225
  }
226
226
  return t.length > 0 ? t : void 0;
227
227
  }
228
- function Yt(e, t = {}) {
229
- let n = Array.isArray(e.parts) ? e.parts : [], r = Gt(n, { liveTail: t.streaming }), i = Array.isArray(e.toolInvocations) ? e.toolInvocations : [], a = r.length > 0 ? r : i, o = qt(n) ?? a.map((e) => Wt(e.draftReview)).find((e) => !!e);
228
+ function Xt(e, t = {}) {
229
+ let n = Array.isArray(e.parts) ? e.parts : [], r = Kt(n, { liveTail: t.streaming }), i = Array.isArray(e.toolInvocations) ? e.toolInvocations : [], a = r.length > 0 ? r : i, o = Jt(n) ?? a.map((e) => Gt(e.draftReview)).find((e) => !!e);
230
230
  return {
231
231
  id: e.id ?? `msg-${Math.random().toString(36).slice(2, 8)}`,
232
232
  role: e.role ?? "assistant",
233
- content: It(e, n),
234
- reasoning: Lt(n),
233
+ content: Lt(e, n),
234
+ reasoning: Rt(n),
235
235
  toolInvocations: a,
236
- sources: Kt(n),
236
+ sources: qt(n),
237
237
  buildProgress: o,
238
- charts: Jt(n),
238
+ charts: Yt(n),
239
239
  streaming: t.streaming
240
240
  };
241
241
  }
242
- function Xt(e, t = {}) {
242
+ function Zt(e, t = {}) {
243
243
  if (!Array.isArray(e) || e.length === 0) return [];
244
244
  let n = e.length - 1;
245
- return e.map((e, r) => Yt(e, { streaming: !!t.isStreaming && r === n && e.role === "assistant" }));
245
+ return e.map((e, r) => Xt(e, { streaming: !!t.isStreaming && r === n && e.role === "assistant" }));
246
246
  }
247
247
  //#endregion
248
248
  //#region src/useObjectChat.ts
249
- function Zt(e) {
249
+ function Qt(e) {
250
250
  let t = [...e.messages].reverse().find((e) => e.role === "user");
251
251
  return { body: {
252
252
  ...e.body ?? {},
@@ -257,7 +257,7 @@ function Zt(e) {
257
257
  ...t ? { turnId: t.id } : {}
258
258
  } };
259
259
  }
260
- function Qt(e) {
260
+ function $t(e) {
261
261
  return (e ?? []).map((e, t) => ({
262
262
  id: e.id || `msg-${t}`,
263
263
  role: e.role || "user",
@@ -268,14 +268,14 @@ function Qt(e) {
268
268
  toolInvocations: e.toolInvocations
269
269
  }));
270
270
  }
271
- function $t(e = {}) {
271
+ function en(e = {}) {
272
272
  let { api: t, initialMessages: n, conversationId: r, systemPrompt: i, model: a, streamingEnabled: s = !0, headers: f, body: p, maxToolRoundtrips: m = 5, onError: h, showTimestamp: g, autoResponse: _, autoResponseText: v, autoResponseDelay: y = 1e3, onSend: b } = e, x = u(t ? "api" : "local").current === "api", S = l(() => (n ?? []).map((e, t) => {
273
273
  if (Array.isArray(e.parts) && e.parts.length > 0) return {
274
274
  id: e.id || `msg-${t}`,
275
275
  role: e.role || "user",
276
276
  parts: e.parts
277
277
  };
278
- let n = Qt([e])[0], r = [];
278
+ let n = $t([e])[0], r = [];
279
279
  n.content && r.push({
280
280
  type: "text",
281
281
  text: n.content
@@ -300,9 +300,9 @@ function $t(e = {}) {
300
300
  text: ""
301
301
  }]
302
302
  };
303
- }), []), C = vt({
303
+ }), []), C = yt({
304
304
  transport: l(() => {
305
- if (x) return new yt({
305
+ if (x) return new bt({
306
306
  api: t,
307
307
  headers: { ...f },
308
308
  body: {
@@ -312,7 +312,7 @@ function $t(e = {}) {
312
312
  ...i ? { systemPrompt: i } : {},
313
313
  ...s === void 0 ? {} : { stream: s }
314
314
  },
315
- prepareSendMessagesRequest: ({ id: e, body: t, messages: n, trigger: r, messageId: i }) => Zt({
315
+ prepareSendMessagesRequest: ({ id: e, body: t, messages: n, trigger: r, messageId: i }) => Qt({
316
316
  id: e,
317
317
  body: t,
318
318
  messages: n,
@@ -334,11 +334,11 @@ function $t(e = {}) {
334
334
  onError: x ? (e) => {
335
335
  h?.(e);
336
336
  } : void 0
337
- }), [w, T] = d(() => Qt(n)), [E, D] = d(!1), [O, k] = d(""), [A, j] = d(""), M = u(null);
337
+ }), [w, T] = d(() => $t(n)), [E, D] = d(!1), [O, k] = d(""), [A, j] = d(""), M = u(null);
338
338
  if (c(() => () => {
339
339
  M.current &&= (clearTimeout(M.current), null);
340
340
  }, []), x) {
341
- let { messages: e, status: t, error: n, sendMessage: r, regenerate: i, stop: a, setMessages: s } = C, c = t === "submitted" || t === "streaming", l = Xt(e, { isStreaming: c }).map((t, n) => ({
341
+ let { messages: e, status: t, error: n, sendMessage: r, regenerate: i, stop: a, setMessages: s } = C, c = t === "submitted" || t === "streaming", l = Zt(e, { isStreaming: c }).map((t, n) => ({
342
342
  ...t,
343
343
  metadata: e[n]?.metadata
344
344
  }));
@@ -350,7 +350,7 @@ function $t(e = {}) {
350
350
  let t = e.trim();
351
351
  if (!t) return;
352
352
  let n = [...l, {
353
- id: Ft("msg"),
353
+ id: It("msg"),
354
354
  role: "user",
355
355
  content: t
356
356
  }];
@@ -384,7 +384,7 @@ function $t(e = {}) {
384
384
  sendMessage: o((e) => {
385
385
  if (!e.trim()) return;
386
386
  let t = {
387
- id: Ft("msg"),
387
+ id: It("msg"),
388
388
  role: "user",
389
389
  content: e.trim(),
390
390
  timestamp: g ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
@@ -394,7 +394,7 @@ function $t(e = {}) {
394
394
  return b?.(e.trim(), r), r;
395
395
  }), k(""), _ && (D(!0), M.current = setTimeout(() => {
396
396
  let e = {
397
- id: Ft("msg"),
397
+ id: It("msg"),
398
398
  role: "assistant",
399
399
  content: v || "Thank you for your message!",
400
400
  timestamp: g ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
@@ -423,41 +423,41 @@ function $t(e = {}) {
423
423
  }
424
424
  //#endregion
425
425
  //#region src/agentAliases.ts
426
- var en = [["build", "metadata_assistant"], ["ask", "data_chat"]];
427
- function tn(e) {
428
- return en.find((t) => t.includes(e)) ?? [e];
429
- }
426
+ var tn = [["build", "metadata_assistant"], ["ask", "data_chat"]];
430
427
  function nn(e) {
431
- return tn(e)[0];
428
+ return tn.find((t) => t.includes(e)) ?? [e];
432
429
  }
433
- function rn(e, t) {
430
+ function rn(e) {
431
+ return nn(e)[0];
432
+ }
433
+ function an(e, t) {
434
434
  if (e) {
435
435
  if (t.includes(e)) return e;
436
- for (let n of tn(e)) if (t.includes(n)) return n;
436
+ for (let n of nn(e)) if (t.includes(n)) return n;
437
437
  }
438
438
  }
439
- function an(e) {
440
- return e != null && en.some((t) => t.includes(e));
441
- }
442
439
  function on(e) {
443
- return e != null && nn(e) === "build";
440
+ return e != null && tn.some((t) => t.includes(e));
444
441
  }
445
442
  function sn(e) {
446
- return e != null && nn(e) === "ask";
443
+ return e != null && rn(e) === "build";
444
+ }
445
+ function cn(e) {
446
+ return e != null && rn(e) === "ask";
447
447
  }
448
448
  //#endregion
449
449
  //#region src/useAgents.ts
450
- var cn = "ask";
451
- function ln(e, t) {
450
+ var ln = "ask";
451
+ function un(e, t) {
452
452
  if (e.length === 0) return;
453
453
  let n = e.map((e) => e.name);
454
454
  if (t) {
455
- let e = rn(t, n);
455
+ let e = an(t, n);
456
456
  if (e) return e;
457
457
  }
458
- return rn("ask", n) || e[0].name;
458
+ return an("ask", n) || e[0].name;
459
459
  }
460
- function un(e) {
460
+ function dn(e) {
461
461
  return e.filter((e) => typeof e?.name == "string" && e.name.length > 0).map((e) => ({
462
462
  name: e.name,
463
463
  label: e.label || e.name,
@@ -466,7 +466,7 @@ function un(e) {
466
466
  active: e.active !== !1
467
467
  }));
468
468
  }
469
- function dn(e = {}) {
469
+ function fn(e = {}) {
470
470
  let { apiBase: t, headers: n, enabled: r = !0, fallback: i = [] } = e, [a, s] = d(i), [l, f] = d(!1), [p, m] = d(void 0), [h, g] = d(0), _ = u(n);
471
471
  return _.current = n, c(() => {
472
472
  if (!r || !t) return;
@@ -486,7 +486,7 @@ function dn(e = {}) {
486
486
  return e.json();
487
487
  }).then((e) => {
488
488
  if (n) return;
489
- let t = un(Array.isArray(e) ? e : e?.agents ?? []);
489
+ let t = dn(Array.isArray(e) ? e : e?.agents ?? []);
490
490
  s(t.length > 0 ? t : i);
491
491
  }).catch((e) => {
492
492
  n || e.name === "AbortError" || (m(e), s(i));
@@ -508,8 +508,8 @@ function dn(e = {}) {
508
508
  }
509
509
  //#endregion
510
510
  //#region src/FloatingChatbotProvider.tsx
511
- var fn = e.createContext(null);
512
- function pn({ defaultOpen: t = !1, children: n }) {
511
+ var pn = e.createContext(null);
512
+ function mn({ defaultOpen: t = !1, children: n }) {
513
513
  let [r, i] = e.useState(t), [a, o] = e.useState(!1), s = e.useMemo(() => ({
514
514
  isOpen: r,
515
515
  isFullscreen: a,
@@ -520,21 +520,21 @@ function pn({ defaultOpen: t = !1, children: n }) {
520
520
  toggle: () => i((e) => !e),
521
521
  toggleFullscreen: () => o((e) => !e)
522
522
  }), [r, a]);
523
- return /* @__PURE__ */ Q(fn.Provider, {
523
+ return /* @__PURE__ */ Q(pn.Provider, {
524
524
  value: s,
525
525
  children: n
526
526
  });
527
527
  }
528
- function mn() {
529
- let t = e.useContext(fn);
528
+ function hn() {
529
+ let t = e.useContext(pn);
530
530
  if (!t) throw Error("useFloatingChatbot must be used within a <FloatingChatbotProvider>");
531
531
  return t;
532
532
  }
533
533
  //#endregion
534
534
  //#region src/FloatingChatbotTrigger.tsx
535
- function hn() {
535
+ function gn() {
536
536
  try {
537
- let { t: e } = St();
537
+ let { t: e } = Ct();
538
538
  return (t, n) => {
539
539
  let r = e(`common.${t}`);
540
540
  return !r || r === `common.${t}` ? n : r;
@@ -543,7 +543,7 @@ function hn() {
543
543
  return (e, t) => t;
544
544
  }
545
545
  }
546
- var gn = {
546
+ var _n = {
547
547
  32: "size-8",
548
548
  36: "size-9",
549
549
  40: "size-10",
@@ -556,26 +556,26 @@ var gn = {
556
556
  72: "size-[72px]",
557
557
  80: "size-20"
558
558
  };
559
- function _n(e, t) {
559
+ function vn(e, t) {
560
560
  return t.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t);
561
561
  }
562
- function vn(e) {
563
- return gn[e] ?? gn[_n(e, Object.keys(gn).map(Number))];
562
+ function yn(e) {
563
+ return _n[e] ?? _n[vn(e, Object.keys(_n).map(Number))];
564
564
  }
565
- function yn({ position: e = "bottom-right", size: t = 56, className: n }) {
566
- let { isOpen: r, toggle: i } = mn(), a = hn();
565
+ function bn({ position: e = "bottom-right", size: t = 56, className: n }) {
566
+ let { isOpen: r, toggle: i } = hn(), a = gn();
567
567
  return /* @__PURE__ */ Q(v, {
568
568
  onClick: i,
569
- className: J("fixed z-50 rounded-full shadow-lg transition-transform hover:scale-105", vn(t), r && "hidden", e === "bottom-right" ? "right-6 bottom-20 sm:bottom-6" : "left-6 bottom-20 sm:bottom-6", n),
569
+ className: J("fixed z-50 rounded-full shadow-lg transition-transform hover:scale-105", yn(t), r && "hidden", e === "bottom-right" ? "right-6 bottom-20 sm:bottom-6" : "left-6 bottom-20 sm:bottom-6", n),
570
570
  size: "icon",
571
571
  "aria-label": r ? a("closeChat", "Close chat") : a("openChat", "Open chat"),
572
572
  "data-testid": "floating-chatbot-trigger",
573
- children: Q(r ? ht : Me, { className: "h-6 w-6" })
573
+ children: Q(r ? gt : Me, { className: "h-6 w-6" })
574
574
  });
575
575
  }
576
576
  //#endregion
577
577
  //#region src/FloatingChatbotPanel.tsx
578
- var bn = {
578
+ var xn = {
579
579
  300: "sm:w-[300px]",
580
580
  320: "sm:w-[320px]",
581
581
  340: "sm:w-[340px]",
@@ -594,7 +594,7 @@ var bn = {
594
594
  640: "sm:w-[640px]",
595
595
  720: "sm:w-[720px]",
596
596
  800: "sm:w-[800px]"
597
- }, xn = {
597
+ }, Sn = {
598
598
  360: "h-[min(360px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[360px]",
599
599
  400: "h-[min(400px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[400px]",
600
600
  420: "h-[min(420px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[420px]",
@@ -608,19 +608,19 @@ var bn = {
608
608
  720: "h-[min(720px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[720px]",
609
609
  800: "h-[min(800px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[800px]"
610
610
  };
611
- function Sn(e, t) {
611
+ function Cn(e, t) {
612
612
  return t.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t);
613
613
  }
614
- function Cn(e) {
615
- return bn[e] ?? bn[Sn(e, Object.keys(bn).map(Number))];
616
- }
617
614
  function wn(e) {
618
- return xn[e] ?? xn[Sn(e, Object.keys(xn).map(Number))];
615
+ return xn[e] ?? xn[Cn(e, Object.keys(xn).map(Number))];
619
616
  }
620
- function Tn({ title: e = "Chat", position: t = "bottom-right", width: n = 400, height: r = 520, children: i, className: a, headerExtra: o, headerActions: s }) {
621
- let { isOpen: c, isFullscreen: l, close: u, toggleFullscreen: d } = mn();
617
+ function Tn(e) {
618
+ return Sn[e] ?? Sn[Cn(e, Object.keys(Sn).map(Number))];
619
+ }
620
+ function En({ title: e = "Chat", position: t = "bottom-right", width: n = 400, height: r = 520, children: i, className: a, headerExtra: o, headerActions: s }) {
621
+ let { isOpen: c, isFullscreen: l, close: u, toggleFullscreen: d } = hn();
622
622
  return c ? /* @__PURE__ */ $("div", {
623
- className: J("fixed z-50 flex flex-col overflow-hidden border bg-background shadow-xl transition-all", l ? "inset-0 h-svh w-screen rounded-none" : t === "bottom-right" ? J("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:left-auto sm:right-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", Cn(n), wn(r)) : J("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:right-auto sm:left-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", Cn(n), wn(r)), a),
623
+ className: J("fixed z-50 flex flex-col overflow-hidden border bg-background shadow-xl transition-all", l ? "inset-0 h-svh w-screen rounded-none" : t === "bottom-right" ? J("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:left-auto sm:right-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", wn(n), Tn(r)) : J("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:right-auto sm:left-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", wn(n), Tn(r)), a),
624
624
  role: "dialog",
625
625
  "aria-label": e,
626
626
  "data-testid": "floating-chatbot-panel",
@@ -656,7 +656,7 @@ function Tn({ title: e = "Chat", position: t = "bottom-right", width: n = 400, h
656
656
  onClick: u,
657
657
  "aria-label": "Close chat",
658
658
  "data-testid": "floating-chatbot-close",
659
- children: /* @__PURE__ */ Q(ht, { className: "h-4 w-4" })
659
+ children: /* @__PURE__ */ Q(gt, { className: "h-4 w-4" })
660
660
  })
661
661
  ]
662
662
  })
@@ -669,7 +669,7 @@ function Tn({ title: e = "Chat", position: t = "bottom-right", width: n = 400, h
669
669
  }
670
670
  //#endregion
671
671
  //#region src/tool-display.ts
672
- var En = {
672
+ var Dn = {
673
673
  ai: "AI",
674
674
  api: "API",
675
675
  crm: "CRM",
@@ -681,17 +681,17 @@ var En = {
681
681
  url: "URL",
682
682
  utc: "UTC"
683
683
  };
684
- function Dn(e) {
684
+ function On(e) {
685
685
  if (!e) return "";
686
686
  let t = String(e).trim();
687
687
  if (!t) return "";
688
688
  let n = t.replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(/\s+/).filter(Boolean);
689
689
  return n.length === 0 ? t : n.map((e, t) => {
690
690
  let n = e.toLowerCase();
691
- return En[n] ? En[n] : t === 0 ? n.charAt(0).toUpperCase() + n.slice(1) : n;
691
+ return Dn[n] ? Dn[n] : t === 0 ? n.charAt(0).toUpperCase() + n.slice(1) : n;
692
692
  }).join(" ");
693
693
  }
694
- function On(e) {
694
+ function kn(e) {
695
695
  if (e == null) return e;
696
696
  let t = e;
697
697
  for (let e = 0; e < 2; e++) {
@@ -709,7 +709,7 @@ function On(e) {
709
709
  }
710
710
  return t;
711
711
  }
712
- function kn(e) {
712
+ function An(e) {
713
713
  let t = (e instanceof Error ? e.message : String(e ?? "")).replace(/\s+/g, " ").trim();
714
714
  if (!t) return { summary: "Something went wrong. Please try again." };
715
715
  let n = t.replace(/^Failed after \d+ attempts?\.\s*Last error:\s*/i, ""), r = n.match(/^Invalid error response format:\s*(.+)$/i)?.[1]?.trim() ?? n, i = r.match(/^([^:]{8,80}):\s+(.+)$/)?.[1]?.trim() ?? r.match(/^([^.;!?]+[.;!?])\s/)?.[1]?.trim() ?? (r.length > 140 ? `${r.slice(0, 137).trimEnd()}…` : r);
@@ -718,12 +718,12 @@ function kn(e) {
718
718
  details: n.length > i.length ? n : void 0
719
719
  };
720
720
  }
721
- var An = new Set([
721
+ var jn = new Set([
722
722
  "ai_design_quota_exhausted",
723
723
  "ai_data_chat_trial_exhausted",
724
724
  "ai_allowance_exhausted"
725
725
  ]);
726
- function jn(e) {
726
+ function Mn(e) {
727
727
  let t = e instanceof Error ? e.message : String(e ?? "");
728
728
  if (!t) return null;
729
729
  let n = t.replace(/^Failed after \d+ attempts?\.\s*Last error:\s*/i, "").replace(/^Invalid error response format:\s*/i, "").trim(), r = n.indexOf("{"), i = n.lastIndexOf("}");
@@ -734,7 +734,7 @@ function jn(e) {
734
734
  } catch {
735
735
  return null;
736
736
  }
737
- return !a || typeof a.error != "string" || !An.has(a.error) ? null : {
737
+ return !a || typeof a.error != "string" || !jn.has(a.error) ? null : {
738
738
  code: a.error,
739
739
  message: typeof a.message == "string" ? a.message : "",
740
740
  messageEn: typeof a.messageEn == "string" ? a.messageEn : void 0,
@@ -744,16 +744,16 @@ function jn(e) {
744
744
  }
745
745
  //#endregion
746
746
  //#region src/elements/conversation.tsx
747
- var Mn = ({ className: e, ...t }) => /* @__PURE__ */ Q(Ct, {
747
+ var Nn = ({ className: e, ...t }) => /* @__PURE__ */ Q(wt, {
748
748
  className: J("relative flex-1 overflow-y-hidden", e),
749
749
  initial: "smooth",
750
750
  resize: "smooth",
751
751
  role: "log",
752
752
  ...t
753
- }), Nn = ({ className: e, ...t }) => /* @__PURE__ */ Q(Ct.Content, {
753
+ }), Pn = ({ className: e, ...t }) => /* @__PURE__ */ Q(wt.Content, {
754
754
  className: J("flex flex-col gap-8 p-4", e),
755
755
  ...t
756
- }), Pn = ({ className: e, title: t = "No messages yet", description: n = "Start a conversation to see messages here", icon: r, children: i, ...a }) => /* @__PURE__ */ Q("div", {
756
+ }), Fn = ({ className: e, title: t = "No messages yet", description: n = "Start a conversation to see messages here", icon: r, children: i, ...a }) => /* @__PURE__ */ Q("div", {
757
757
  className: J("flex size-full flex-col items-center justify-center gap-3 p-8 text-center", e),
758
758
  ...a,
759
759
  children: i ?? /* @__PURE__ */ $(Z, { children: [r && /* @__PURE__ */ Q("div", {
@@ -769,8 +769,8 @@ var Mn = ({ className: e, ...t }) => /* @__PURE__ */ Q(Ct, {
769
769
  children: n
770
770
  })]
771
771
  })] })
772
- }), Fn = ({ className: e, ...t }) => {
773
- let { isAtBottom: n, scrollToBottom: r } = wt(), i = o(() => {
772
+ }), In = ({ className: e, ...t }) => {
773
+ let { isAtBottom: n, scrollToBottom: r } = Tt(), i = o(() => {
774
774
  r();
775
775
  }, [r]);
776
776
  return !n && /* @__PURE__ */ Q(v, {
@@ -782,42 +782,42 @@ var Mn = ({ className: e, ...t }) => /* @__PURE__ */ Q(Ct, {
782
782
  ...t,
783
783
  children: /* @__PURE__ */ Q(ke, { className: "size-4" })
784
784
  });
785
- }, In = Tt("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
785
+ }, Ln = Et("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
786
786
  variants: { orientation: {
787
787
  horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
788
788
  vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
789
789
  } },
790
790
  defaultVariants: { orientation: "horizontal" }
791
791
  });
792
- function Ln({ className: e, orientation: t, ...n }) {
792
+ function Rn({ className: e, orientation: t, ...n }) {
793
793
  return /* @__PURE__ */ Q("div", {
794
794
  role: "group",
795
795
  "data-slot": "button-group",
796
796
  "data-orientation": t,
797
- className: J(In({ orientation: t }), e),
797
+ className: J(Ln({ orientation: t }), e),
798
798
  ...n
799
799
  });
800
800
  }
801
- function Rn({ className: e, asChild: t = !1, ...n }) {
802
- return /* @__PURE__ */ Q(t ? Et : "div", {
801
+ function zn({ className: e, asChild: t = !1, ...n }) {
802
+ return /* @__PURE__ */ Q(t ? Dt : "div", {
803
803
  className: J("flex items-center gap-2 rounded-md border bg-muted px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", e),
804
804
  ...n
805
805
  });
806
806
  }
807
807
  //#endregion
808
808
  //#region src/elements/message.tsx
809
- var zn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
809
+ var Bn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
810
810
  className: J("group flex w-full max-w-[95%] flex-col gap-2", t === "user" ? "is-user ml-auto justify-end" : "is-assistant", e),
811
811
  ...n
812
- }), Bn = ({ children: e, className: t, ...n }) => /* @__PURE__ */ Q("div", {
812
+ }), Vn = ({ children: e, className: t, ...n }) => /* @__PURE__ */ Q("div", {
813
813
  className: J("is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm", "group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground", "group-[.is-assistant]:text-foreground", t),
814
814
  ...n,
815
815
  children: e
816
- }), Vn = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
816
+ }), Hn = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
817
817
  className: J("flex items-center gap-1", e),
818
818
  ...n,
819
819
  children: t
820
- }), Hn = ({ tooltip: e, children: t, label: n, variant: r = "ghost", size: i = "icon", ...a }) => {
820
+ }), Un = ({ tooltip: e, children: t, label: n, variant: r = "ghost", size: i = "icon", ...a }) => {
821
821
  let o = /* @__PURE__ */ $(v, {
822
822
  size: i,
823
823
  type: "button",
@@ -832,11 +832,11 @@ var zn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
832
832
  asChild: !0,
833
833
  children: o
834
834
  }), /* @__PURE__ */ Q(Te, { children: /* @__PURE__ */ Q("p", { children: e }) })] }) }) : o;
835
- }, Un = r(null), Wn = () => {
836
- let e = s(Un);
835
+ }, Wn = r(null), Gn = () => {
836
+ let e = s(Wn);
837
837
  if (!e) throw Error("MessageBranch components must be used within MessageBranch");
838
838
  return e;
839
- }, Gn = ({ defaultBranch: e = 0, onBranchChange: t, className: n, ...r }) => {
839
+ }, Kn = ({ defaultBranch: e = 0, onBranchChange: t, className: n, ...r }) => {
840
840
  let [i, a] = d(e), [o, s] = d([]), c = (e) => {
841
841
  a(e), t?.(e);
842
842
  }, l = {
@@ -851,15 +851,15 @@ var zn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
851
851
  branches: o,
852
852
  setBranches: s
853
853
  };
854
- return /* @__PURE__ */ Q(Un.Provider, {
854
+ return /* @__PURE__ */ Q(Wn.Provider, {
855
855
  value: l,
856
856
  children: /* @__PURE__ */ Q("div", {
857
857
  className: J("grid w-full gap-2 [&>div]:pb-0", n),
858
858
  ...r
859
859
  })
860
860
  });
861
- }, Kn = ({ children: e, ...t }) => {
862
- let { currentBranch: n, setBranches: r, branches: i } = Wn(), a = Array.isArray(e) ? e : [e];
861
+ }, qn = ({ children: e, ...t }) => {
862
+ let { currentBranch: n, setBranches: r, branches: i } = Gn(), a = Array.isArray(e) ? e : [e];
863
863
  return c(() => {
864
864
  i.length !== a.length && r(a);
865
865
  }, [
@@ -871,15 +871,15 @@ var zn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
871
871
  ...t,
872
872
  children: e
873
873
  }, e.key));
874
- }, qn = ({ className: e, from: t, ...n }) => {
875
- let { totalBranches: r } = Wn();
876
- return r <= 1 ? null : /* @__PURE__ */ Q(Ln, {
874
+ }, Jn = ({ className: e, from: t, ...n }) => {
875
+ let { totalBranches: r } = Gn();
876
+ return r <= 1 ? null : /* @__PURE__ */ Q(Rn, {
877
877
  className: "[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
878
878
  orientation: "horizontal",
879
879
  ...n
880
880
  });
881
- }, Jn = ({ children: e, ...t }) => {
882
- let { goToPrevious: n, totalBranches: r } = Wn();
881
+ }, Yn = ({ children: e, ...t }) => {
882
+ let { goToPrevious: n, totalBranches: r } = Gn();
883
883
  return /* @__PURE__ */ Q(v, {
884
884
  "aria-label": "Previous branch",
885
885
  disabled: r <= 1,
@@ -890,8 +890,8 @@ var zn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
890
890
  ...t,
891
891
  children: e ?? /* @__PURE__ */ Q(Re, { size: 14 })
892
892
  });
893
- }, Yn = ({ children: e, className: t, ...n }) => {
894
- let { goToNext: r, totalBranches: i } = Wn();
893
+ }, Xn = ({ children: e, className: t, ...n }) => {
894
+ let { goToNext: r, totalBranches: i } = Gn();
895
895
  return /* @__PURE__ */ Q(v, {
896
896
  "aria-label": "Next branch",
897
897
  disabled: i <= 1,
@@ -902,9 +902,9 @@ var zn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
902
902
  ...n,
903
903
  children: e ?? /* @__PURE__ */ Q(ze, { size: 14 })
904
904
  });
905
- }, Xn = ({ className: e, ...t }) => {
906
- let { currentBranch: n, totalBranches: r } = Wn();
907
- return /* @__PURE__ */ $(Rn, {
905
+ }, Zn = ({ className: e, ...t }) => {
906
+ let { currentBranch: n, totalBranches: r } = Gn();
907
+ return /* @__PURE__ */ $(zn, {
908
908
  className: J("border-none bg-transparent text-muted-foreground shadow-none", e),
909
909
  ...t,
910
910
  children: [
@@ -913,12 +913,12 @@ var zn = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
913
913
  r
914
914
  ]
915
915
  });
916
- }, Zn = a(({ className: e, ...t }) => /* @__PURE__ */ Q(Dt, {
916
+ }, Qn = a(({ className: e, ...t }) => /* @__PURE__ */ Q(Ot, {
917
917
  className: J("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", e),
918
918
  ...t
919
919
  }), (e, t) => e.children === t.children);
920
- Zn.displayName = "MessageResponse";
921
- function Qn({ data: e, className: t, onRemove: n, ...r }) {
920
+ Qn.displayName = "MessageResponse";
921
+ function $n({ data: e, className: t, onRemove: n, ...r }) {
922
922
  let i = e.filename || "", a = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") == "image", o = i || (a ? "Image" : "Attachment");
923
923
  return /* @__PURE__ */ Q("div", {
924
924
  className: J("group relative size-24 overflow-hidden rounded-lg", t),
@@ -937,7 +937,7 @@ function Qn({ data: e, className: t, onRemove: n, ...r }) {
937
937
  },
938
938
  type: "button",
939
939
  variant: "ghost",
940
- children: [/* @__PURE__ */ Q(_t, {}), /* @__PURE__ */ Q("span", {
940
+ children: [/* @__PURE__ */ Q(vt, {}), /* @__PURE__ */ Q("span", {
941
941
  className: "sr-only",
942
942
  children: "Remove"
943
943
  })]
@@ -955,28 +955,28 @@ function Qn({ data: e, className: t, onRemove: n, ...r }) {
955
955
  },
956
956
  type: "button",
957
957
  variant: "ghost",
958
- children: [/* @__PURE__ */ Q(_t, {}), /* @__PURE__ */ Q("span", {
958
+ children: [/* @__PURE__ */ Q(vt, {}), /* @__PURE__ */ Q("span", {
959
959
  className: "sr-only",
960
960
  children: "Remove"
961
961
  })]
962
962
  })] })
963
963
  });
964
964
  }
965
- function $n({ children: e, className: t, ...n }) {
965
+ function er({ children: e, className: t, ...n }) {
966
966
  return e ? /* @__PURE__ */ Q("div", {
967
967
  className: J("ml-auto flex w-fit flex-wrap items-start gap-2", t),
968
968
  ...n,
969
969
  children: e
970
970
  }) : null;
971
971
  }
972
- var er = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
972
+ var tr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
973
973
  className: J("mt-4 flex w-full items-center justify-between gap-4", e),
974
974
  ...n,
975
975
  children: t
976
976
  });
977
977
  //#endregion
978
978
  //#region src/elements/ui/input-group.tsx
979
- function tr({ className: e, ...t }) {
979
+ function nr({ className: e, ...t }) {
980
980
  return /* @__PURE__ */ Q("div", {
981
981
  "data-slot": "input-group",
982
982
  role: "group",
@@ -984,7 +984,7 @@ function tr({ className: e, ...t }) {
984
984
  ...t
985
985
  });
986
986
  }
987
- var nr = Tt("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
987
+ var rr = Et("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
988
988
  variants: { align: {
989
989
  "inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
990
990
  "inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
@@ -993,19 +993,19 @@ var nr = Tt("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 te
993
993
  } },
994
994
  defaultVariants: { align: "inline-start" }
995
995
  });
996
- function rr({ className: e, align: t = "inline-start", ...n }) {
996
+ function ir({ className: e, align: t = "inline-start", ...n }) {
997
997
  return /* @__PURE__ */ Q("div", {
998
998
  role: "group",
999
999
  "data-slot": "input-group-addon",
1000
1000
  "data-align": t,
1001
- className: J(nr({ align: t }), e),
1001
+ className: J(rr({ align: t }), e),
1002
1002
  onClick: (e) => {
1003
1003
  e.target.closest("button") || e.currentTarget.parentElement?.querySelector("input")?.focus();
1004
1004
  },
1005
1005
  ...n
1006
1006
  });
1007
1007
  }
1008
- var ir = Tt("flex items-center gap-2 text-sm shadow-none", {
1008
+ var ar = Et("flex items-center gap-2 text-sm shadow-none", {
1009
1009
  variants: { size: {
1010
1010
  xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
1011
1011
  sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
@@ -1014,17 +1014,17 @@ var ir = Tt("flex items-center gap-2 text-sm shadow-none", {
1014
1014
  } },
1015
1015
  defaultVariants: { size: "xs" }
1016
1016
  });
1017
- function ar({ className: e, type: t = "button", variant: n = "ghost", size: r = "xs", ...i }) {
1017
+ function or({ className: e, type: t = "button", variant: n = "ghost", size: r = "xs", ...i }) {
1018
1018
  return /* @__PURE__ */ Q(v, {
1019
1019
  type: t,
1020
1020
  "data-size": r,
1021
1021
  variant: n,
1022
- className: J(ir({ size: r }), e),
1022
+ className: J(ar({ size: r }), e),
1023
1023
  ...i
1024
1024
  });
1025
1025
  }
1026
- function or({ className: e, ...t }) {
1027
- return /* @__PURE__ */ Q(Ce, {
1026
+ function sr({ className: e, ...t }) {
1027
+ return /* @__PURE__ */ Q(q, {
1028
1028
  "data-slot": "input-group-control",
1029
1029
  className: J("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent", e),
1030
1030
  ...t
@@ -1032,20 +1032,20 @@ function or({ className: e, ...t }) {
1032
1032
  }
1033
1033
  //#endregion
1034
1034
  //#region src/elements/prompt-input.tsx
1035
- var sr = r(null), cr = r(null), lr = () => {
1036
- let e = s(sr);
1035
+ var cr = r(null), lr = r(null), ur = () => {
1036
+ let e = s(cr);
1037
1037
  if (!e) throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");
1038
1038
  return e;
1039
- }, ur = () => s(sr), dr = () => {
1040
- let e = s(cr);
1039
+ }, dr = () => s(cr), fr = () => {
1040
+ let e = s(lr);
1041
1041
  if (!e) throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");
1042
1042
  return e;
1043
- }, fr = () => s(cr);
1044
- function pr({ initialInput: e = "", children: t }) {
1043
+ }, pr = () => s(lr);
1044
+ function mr({ initialInput: e = "", children: t }) {
1045
1045
  let [n, r] = d(e), i = o(() => r(""), []), [a, s] = d([]), f = u(null), p = u(() => {}), m = o((e) => {
1046
1046
  let t = Array.from(e);
1047
1047
  t.length !== 0 && s((e) => e.concat(t.map((e) => ({
1048
- id: Ot(),
1048
+ id: kt(),
1049
1049
  type: "file",
1050
1050
  url: URL.createObjectURL(e),
1051
1051
  mediaType: e.type,
@@ -1096,22 +1096,22 @@ function pr({ initialInput: e = "", children: t }) {
1096
1096
  y,
1097
1097
  b
1098
1098
  ]);
1099
- return /* @__PURE__ */ Q(sr.Provider, {
1099
+ return /* @__PURE__ */ Q(cr.Provider, {
1100
1100
  value: x,
1101
- children: /* @__PURE__ */ Q(cr.Provider, {
1101
+ children: /* @__PURE__ */ Q(lr.Provider, {
1102
1102
  value: y,
1103
1103
  children: t
1104
1104
  })
1105
1105
  });
1106
1106
  }
1107
- var mr = r(null), hr = () => {
1108
- let e = fr(), t = s(mr), n = e ?? t;
1107
+ var hr = r(null), gr = () => {
1108
+ let e = pr(), t = s(hr), n = e ?? t;
1109
1109
  if (!n) throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");
1110
1110
  return n;
1111
1111
  };
1112
- function gr({ data: e, className: t, ...n }) {
1113
- let r = hr(), i = e.filename || "", a = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") == "image", o = i || (a ? "Image" : "Attachment");
1114
- return /* @__PURE__ */ $(Lr, { children: [/* @__PURE__ */ Q(z, {
1112
+ function _r({ data: e, className: t, ...n }) {
1113
+ let r = gr(), i = e.filename || "", a = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") == "image", o = i || (a ? "Image" : "Attachment");
1114
+ return /* @__PURE__ */ $(Rr, { children: [/* @__PURE__ */ Q(R, {
1115
1115
  asChild: !0,
1116
1116
  children: /* @__PURE__ */ $("div", {
1117
1117
  className: J("group relative flex h-8 cursor-pointer select-none items-center gap-1.5 rounded-md border border-border px-1.5 font-medium text-sm transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", t),
@@ -1138,7 +1138,7 @@ function gr({ data: e, className: t, ...n }) {
1138
1138
  },
1139
1139
  type: "button",
1140
1140
  variant: "ghost",
1141
- children: [/* @__PURE__ */ Q(_t, {}), /* @__PURE__ */ Q("span", {
1141
+ children: [/* @__PURE__ */ Q(vt, {}), /* @__PURE__ */ Q("span", {
1142
1142
  className: "sr-only",
1143
1143
  children: "Remove"
1144
1144
  })]
@@ -1148,7 +1148,7 @@ function gr({ data: e, className: t, ...n }) {
1148
1148
  children: o
1149
1149
  })]
1150
1150
  }, e.id)
1151
- }), /* @__PURE__ */ Q(zr, {
1151
+ }), /* @__PURE__ */ Q(Br, {
1152
1152
  className: "w-auto p-2",
1153
1153
  children: /* @__PURE__ */ $("div", {
1154
1154
  className: "w-auto space-y-3",
@@ -1177,16 +1177,16 @@ function gr({ data: e, className: t, ...n }) {
1177
1177
  })
1178
1178
  })] });
1179
1179
  }
1180
- function _r({ children: e, className: t, ...r }) {
1181
- let i = hr();
1180
+ function vr({ children: e, className: t, ...r }) {
1181
+ let i = gr();
1182
1182
  return i.files.length ? /* @__PURE__ */ Q("div", {
1183
1183
  className: J("flex flex-wrap items-center gap-2 p-3 w-full", t),
1184
1184
  ...r,
1185
1185
  children: i.files.map((t) => /* @__PURE__ */ Q(n, { children: e(t) }, t.id))
1186
1186
  }) : null;
1187
1187
  }
1188
- var vr = ({ label: e = "Add photos or files", ...t }) => {
1189
- let n = hr();
1188
+ var yr = ({ label: e = "Add photos or files", ...t }) => {
1189
+ let n = gr();
1190
1190
  return /* @__PURE__ */ $(P, {
1191
1191
  ...t,
1192
1192
  onSelect: (e) => {
@@ -1198,8 +1198,8 @@ var vr = ({ label: e = "Add photos or files", ...t }) => {
1198
1198
  e
1199
1199
  ]
1200
1200
  });
1201
- }, yr = ({ className: e, accept: t, multiple: n, fileInputLabel: r = "Upload files", globalDrop: i, syncHiddenInput: a, maxFiles: s, maxFileSize: f, onError: p, onSubmit: m, children: h, ...g }) => {
1202
- let _ = ur(), v = !!_, y = u(null), b = u(null), [x, S] = d([]), C = v ? _.attachments.files : x, w = u(C);
1201
+ }, br = ({ className: e, accept: t, multiple: n, fileInputLabel: r = "Upload files", globalDrop: i, syncHiddenInput: a, maxFiles: s, maxFileSize: f, onError: p, onSubmit: m, children: h, ...g }) => {
1202
+ let _ = dr(), v = !!_, y = u(null), b = u(null), [x, S] = d([]), C = v ? _.attachments.files : x, w = u(C);
1203
1203
  w.current = C;
1204
1204
  let T = o(() => {
1205
1205
  y.current?.click();
@@ -1234,7 +1234,7 @@ var vr = ({ label: e = "Add photos or files", ...t }) => {
1234
1234
  });
1235
1235
  let i = [];
1236
1236
  for (let e of n) i.push({
1237
- id: Ot(),
1237
+ id: kt(),
1238
1238
  type: "file",
1239
1239
  url: URL.createObjectURL(e),
1240
1240
  mediaType: e.type,
@@ -1347,20 +1347,20 @@ var vr = ({ label: e = "Add photos or files", ...t }) => {
1347
1347
  },
1348
1348
  ref: b,
1349
1349
  ...g,
1350
- children: /* @__PURE__ */ Q(tr, {
1350
+ children: /* @__PURE__ */ Q(nr, {
1351
1351
  className: "overflow-hidden",
1352
1352
  children: h
1353
1353
  })
1354
1354
  })] });
1355
- return v ? F : /* @__PURE__ */ Q(mr.Provider, {
1355
+ return v ? F : /* @__PURE__ */ Q(hr.Provider, {
1356
1356
  value: P,
1357
1357
  children: F
1358
1358
  });
1359
- }, br = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1359
+ }, xr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1360
1360
  className: J("contents", e),
1361
1361
  ...t
1362
- }), xr = ({ onChange: e, className: t, placeholder: n = "What would you like to know?", ...r }) => {
1363
- let i = ur(), a = hr(), [o, s] = d(!1), c = (e) => {
1362
+ }), Sr = ({ onChange: e, className: t, placeholder: n = "What would you like to know?", ...r }) => {
1363
+ let i = dr(), a = gr(), [o, s] = d(!1), c = (e) => {
1364
1364
  if (e.key === "Enter") {
1365
1365
  if (o || e.nativeEvent.isComposing || e.shiftKey) return;
1366
1366
  e.preventDefault();
@@ -1388,7 +1388,7 @@ var vr = ({ label: e = "Add photos or files", ...t }) => {
1388
1388
  i.textInput.setInput(t.currentTarget.value), e?.(t);
1389
1389
  }
1390
1390
  } : { onChange: e };
1391
- return /* @__PURE__ */ Q(or, {
1391
+ return /* @__PURE__ */ Q(sr, {
1392
1392
  className: J("field-sizing-content max-h-48 min-h-16", t),
1393
1393
  name: "message",
1394
1394
  onCompositionEnd: () => s(!1),
@@ -1399,43 +1399,43 @@ var vr = ({ label: e = "Add photos or files", ...t }) => {
1399
1399
  ...r,
1400
1400
  ...u
1401
1401
  });
1402
- }, Sr = ({ className: e, ...t }) => /* @__PURE__ */ Q(rr, {
1402
+ }, Cr = ({ className: e, ...t }) => /* @__PURE__ */ Q(ir, {
1403
1403
  align: "block-end",
1404
1404
  className: J("order-first flex-wrap gap-1", e),
1405
1405
  ...t
1406
- }), Cr = ({ className: e, ...t }) => /* @__PURE__ */ Q(rr, {
1406
+ }), wr = ({ className: e, ...t }) => /* @__PURE__ */ Q(ir, {
1407
1407
  align: "block-end",
1408
1408
  className: J("justify-between gap-1", e),
1409
1409
  ...t
1410
- }), wr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1410
+ }), Tr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1411
1411
  className: J("flex items-center gap-1", e),
1412
1412
  ...t
1413
- }), Tr = ({ variant: e = "ghost", className: n, size: r, ...i }) => {
1413
+ }), Er = ({ variant: e = "ghost", className: n, size: r, ...i }) => {
1414
1414
  let a = r ?? (t.count(i.children) > 1 ? "sm" : "icon-sm");
1415
- return /* @__PURE__ */ Q(ar, {
1415
+ return /* @__PURE__ */ Q(or, {
1416
1416
  className: J(n),
1417
1417
  size: a,
1418
1418
  type: "button",
1419
1419
  variant: e,
1420
1420
  ...i
1421
1421
  });
1422
- }, Er = (e) => /* @__PURE__ */ Q(ee, { ...e }), Dr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(F, {
1422
+ }, Dr = (e) => /* @__PURE__ */ Q(ee, { ...e }), Or = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(F, {
1423
1423
  asChild: !0,
1424
- children: /* @__PURE__ */ Q(Tr, {
1424
+ children: /* @__PURE__ */ Q(Er, {
1425
1425
  className: e,
1426
1426
  ...n,
1427
1427
  children: t ?? /* @__PURE__ */ Q(ot, { className: "size-4" })
1428
1428
  })
1429
- }), Or = ({ className: e, ...t }) => /* @__PURE__ */ Q(te, {
1429
+ }), kr = ({ className: e, ...t }) => /* @__PURE__ */ Q(te, {
1430
1430
  align: "start",
1431
1431
  className: J(e),
1432
1432
  ...t
1433
- }), kr = ({ className: e, ...t }) => /* @__PURE__ */ Q(P, {
1433
+ }), Ar = ({ className: e, ...t }) => /* @__PURE__ */ Q(P, {
1434
1434
  className: J(e),
1435
1435
  ...t
1436
- }), Ar = ({ className: e, variant: t = "default", size: n = "icon-sm", status: r, children: i, ...a }) => {
1436
+ }), jr = ({ className: e, variant: t = "default", size: n = "icon-sm", status: r, children: i, ...a }) => {
1437
1437
  let o = /* @__PURE__ */ Q(Je, { className: "size-4" });
1438
- return r === "submitted" ? o = /* @__PURE__ */ Q(tt, { className: "size-4 animate-spin" }) : r === "streaming" ? o = /* @__PURE__ */ Q(dt, { className: "size-4" }) : r === "error" && (o = /* @__PURE__ */ Q(_t, { className: "size-4" })), /* @__PURE__ */ Q(ar, {
1438
+ return r === "submitted" ? o = /* @__PURE__ */ Q(tt, { className: "size-4 animate-spin" }) : r === "streaming" ? o = /* @__PURE__ */ Q(dt, { className: "size-4" }) : r === "error" && (o = /* @__PURE__ */ Q(vt, { className: "size-4" })), /* @__PURE__ */ Q(or, {
1439
1439
  "aria-label": "Submit",
1440
1440
  className: J(e),
1441
1441
  size: n,
@@ -1444,7 +1444,7 @@ var vr = ({ label: e = "Add photos or files", ...t }) => {
1444
1444
  ...a,
1445
1445
  children: i ?? o
1446
1446
  });
1447
- }, jr = ({ className: e, textareaRef: t, onTranscriptionChange: n, ...r }) => {
1447
+ }, Mr = ({ className: e, textareaRef: t, onTranscriptionChange: n, ...r }) => {
1448
1448
  let [i, a] = d(!1), [s, l] = d(null), f = u(null);
1449
1449
  c(() => {
1450
1450
  if (typeof window < "u" && ("SpeechRecognition" in window || "webkitSpeechRecognition" in window)) {
@@ -1474,69 +1474,69 @@ var vr = ({ label: e = "Add photos or files", ...t }) => {
1474
1474
  let p = o(() => {
1475
1475
  s && (i ? s.stop() : s.start());
1476
1476
  }, [s, i]);
1477
- return /* @__PURE__ */ Q(Tr, {
1477
+ return /* @__PURE__ */ Q(Er, {
1478
1478
  className: J("relative transition-all duration-200", i && "animate-pulse bg-accent text-accent-foreground", e),
1479
1479
  disabled: !s,
1480
1480
  onClick: p,
1481
1481
  ...r,
1482
1482
  children: /* @__PURE__ */ Q(rt, { className: "size-4" })
1483
1483
  });
1484
- }, Mr = (e) => /* @__PURE__ */ Q(le, { ...e }), Nr = ({ className: e, ...t }) => /* @__PURE__ */ Q(fe, {
1484
+ }, Nr = (e) => /* @__PURE__ */ Q(le, { ...e }), Pr = ({ className: e, ...t }) => /* @__PURE__ */ Q(fe, {
1485
1485
  className: J("border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors", "hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground", e),
1486
1486
  ...t
1487
- }), Pr = ({ className: e, ...t }) => /* @__PURE__ */ Q(ue, {
1487
+ }), Fr = ({ className: e, ...t }) => /* @__PURE__ */ Q(ue, {
1488
1488
  className: J(e),
1489
1489
  ...t
1490
- }), Fr = ({ className: e, ...t }) => /* @__PURE__ */ Q(de, {
1490
+ }), Ir = ({ className: e, ...t }) => /* @__PURE__ */ Q(de, {
1491
1491
  className: J(e),
1492
1492
  ...t
1493
- }), Ir = ({ className: e, ...t }) => /* @__PURE__ */ Q(pe, {
1493
+ }), Lr = ({ className: e, ...t }) => /* @__PURE__ */ Q(pe, {
1494
1494
  className: J(e),
1495
1495
  ...t
1496
- }), Lr = ({ openDelay: e = 0, closeDelay: t = 0, ...n }) => /* @__PURE__ */ Q(L, {
1496
+ }), Rr = ({ openDelay: e = 0, closeDelay: t = 0, ...n }) => /* @__PURE__ */ Q(L, {
1497
1497
  closeDelay: t,
1498
1498
  openDelay: e,
1499
1499
  ...n
1500
- }), Rr = (e) => /* @__PURE__ */ Q(z, { ...e }), zr = ({ align: e = "start", ...t }) => /* @__PURE__ */ Q(R, {
1500
+ }), zr = (e) => /* @__PURE__ */ Q(R, { ...e }), Br = ({ align: e = "start", ...t }) => /* @__PURE__ */ Q(oe, {
1501
1501
  align: e,
1502
1502
  ...t
1503
- }), Br = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1503
+ }), Vr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1504
1504
  className: J(e),
1505
1505
  ...t
1506
- }), Vr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1506
+ }), Hr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1507
1507
  className: J(e),
1508
1508
  ...t
1509
- }), Hr = ({ className: e, ...t }) => /* @__PURE__ */ Q("h3", {
1509
+ }), Ur = ({ className: e, ...t }) => /* @__PURE__ */ Q("h3", {
1510
1510
  className: J("mb-2 px-3 font-medium text-muted-foreground text-xs", e),
1511
1511
  ...t
1512
- }), Ur = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1512
+ }), Wr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1513
1513
  className: J("space-y-1", e),
1514
1514
  ...t
1515
- }), Wr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1515
+ }), Gr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
1516
1516
  className: J("flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent", e),
1517
1517
  ...t
1518
- }), Gr = ({ className: e, ...t }) => /* @__PURE__ */ Q(D, {
1518
+ }), Kr = ({ className: e, ...t }) => /* @__PURE__ */ Q(D, {
1519
1519
  className: J(e),
1520
1520
  ...t
1521
- }), Kr = ({ className: e, ...t }) => /* @__PURE__ */ Q(A, {
1521
+ }), qr = ({ className: e, ...t }) => /* @__PURE__ */ Q(A, {
1522
1522
  className: J(e),
1523
1523
  ...t
1524
- }), qr = ({ className: e, ...t }) => /* @__PURE__ */ Q(M, {
1524
+ }), Jr = ({ className: e, ...t }) => /* @__PURE__ */ Q(M, {
1525
1525
  className: J(e),
1526
1526
  ...t
1527
- }), Jr = ({ className: e, ...t }) => /* @__PURE__ */ Q(O, {
1527
+ }), Yr = ({ className: e, ...t }) => /* @__PURE__ */ Q(O, {
1528
1528
  className: J(e),
1529
1529
  ...t
1530
- }), Yr = ({ className: e, ...t }) => /* @__PURE__ */ Q(k, {
1530
+ }), Xr = ({ className: e, ...t }) => /* @__PURE__ */ Q(k, {
1531
1531
  className: J(e),
1532
1532
  ...t
1533
- }), Xr = ({ className: e, ...t }) => /* @__PURE__ */ Q(j, {
1533
+ }), Zr = ({ className: e, ...t }) => /* @__PURE__ */ Q(j, {
1534
1534
  className: J(e),
1535
1535
  ...t
1536
- }), Zr = ({ className: e, ...t }) => /* @__PURE__ */ Q(N, {
1536
+ }), Qr = ({ className: e, ...t }) => /* @__PURE__ */ Q(N, {
1537
1537
  className: J(e),
1538
1538
  ...t
1539
- }), Qr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ $(se, {
1539
+ }), $r = ({ className: e, children: t, ...n }) => /* @__PURE__ */ $(se, {
1540
1540
  className: "w-full overflow-x-auto whitespace-nowrap",
1541
1541
  ...n,
1542
1542
  children: [/* @__PURE__ */ Q("div", {
@@ -1546,7 +1546,7 @@ var vr = ({ label: e = "Add photos or files", ...t }) => {
1546
1546
  className: "hidden",
1547
1547
  orientation: "horizontal"
1548
1548
  })]
1549
- }), $r = ({ suggestion: e, onClick: t, className: n, variant: r = "outline", size: i = "sm", children: a, ...o }) => /* @__PURE__ */ Q(v, {
1549
+ }), ei = ({ suggestion: e, onClick: t, className: n, variant: r = "outline", size: i = "sm", children: a, ...o }) => /* @__PURE__ */ Q(v, {
1550
1550
  className: J("cursor-pointer rounded-full px-4", n),
1551
1551
  onClick: () => {
1552
1552
  t?.(e);
@@ -1556,7 +1556,7 @@ var vr = ({ label: e = "Add photos or files", ...t }) => {
1556
1556
  variant: r,
1557
1557
  ...o,
1558
1558
  children: a || e
1559
- }), ei = r({ code: "" }), ti = {
1559
+ }), ti = r({ code: "" }), ni = {
1560
1560
  name: "line-numbers",
1561
1561
  line(e, t) {
1562
1562
  e.children.unshift({
@@ -1577,21 +1577,21 @@ var vr = ({ label: e = "Add photos or files", ...t }) => {
1577
1577
  });
1578
1578
  }
1579
1579
  };
1580
- async function ni(e, t, n = !1) {
1581
- let r = n ? [ti] : [];
1582
- return await Promise.all([kt(e, {
1580
+ async function ri(e, t, n = !1) {
1581
+ let r = n ? [ni] : [];
1582
+ return await Promise.all([At(e, {
1583
1583
  lang: t,
1584
1584
  theme: "one-light",
1585
1585
  transformers: r
1586
- }), kt(e, {
1586
+ }), At(e, {
1587
1587
  lang: t,
1588
1588
  theme: "one-dark-pro",
1589
1589
  transformers: r
1590
1590
  })]);
1591
1591
  }
1592
- var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, children: i, ...a }) => {
1592
+ var ii = ({ code: e, language: t, showLineNumbers: n = !1, className: r, children: i, ...a }) => {
1593
1593
  let [o, s] = d(""), [l, f] = d(""), p = u(!1);
1594
- return c(() => (ni(e, t, n).then(([e, t]) => {
1594
+ return c(() => (ri(e, t, n).then(([e, t]) => {
1595
1595
  p.current ||= (s(e), f(t), !0);
1596
1596
  }), () => {
1597
1597
  p.current = !1;
@@ -1599,7 +1599,7 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1599
1599
  e,
1600
1600
  t,
1601
1601
  n
1602
- ]), /* @__PURE__ */ Q(ei.Provider, {
1602
+ ]), /* @__PURE__ */ Q(ti.Provider, {
1603
1603
  value: { code: e },
1604
1604
  children: /* @__PURE__ */ Q("div", {
1605
1605
  className: J("group relative w-full overflow-hidden rounded-md border bg-background text-foreground", r),
@@ -1623,8 +1623,8 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1623
1623
  })
1624
1624
  })
1625
1625
  });
1626
- }, ii = ({ onCopy: e, onError: t, timeout: n = 2e3, children: r, className: i, ...a }) => {
1627
- let [o, c] = d(!1), { code: l } = s(ei), u = async () => {
1626
+ }, ai = ({ onCopy: e, onError: t, timeout: n = 2e3, children: r, className: i, ...a }) => {
1627
+ let [o, c] = d(!1), { code: l } = s(ti), u = async () => {
1628
1628
  if (typeof window > "u" || !navigator?.clipboard?.writeText) {
1629
1629
  t?.(/* @__PURE__ */ Error("Clipboard API not available"));
1630
1630
  return;
@@ -1643,10 +1643,10 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1643
1643
  ...a,
1644
1644
  children: r ?? /* @__PURE__ */ Q(f, { size: 14 })
1645
1645
  });
1646
- }, ai = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
1646
+ }, oi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
1647
1647
  className: J("not-prose mb-4 w-full rounded-md border", e),
1648
1648
  ...t
1649
- }), oi = (e) => /* @__PURE__ */ $(_, {
1649
+ }), si = (e) => /* @__PURE__ */ $(_, {
1650
1650
  className: "gap-1.5 rounded-full text-xs",
1651
1651
  variant: "secondary",
1652
1652
  children: [{
@@ -1655,8 +1655,8 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1655
1655
  "approval-requested": /* @__PURE__ */ Q(We, { className: "size-4 text-yellow-600" }),
1656
1656
  "approval-responded": /* @__PURE__ */ Q(Fe, { className: "size-4 text-blue-600" }),
1657
1657
  "output-available": /* @__PURE__ */ Q(Fe, { className: "size-4 text-green-600" }),
1658
- "output-error": /* @__PURE__ */ Q(gt, { className: "size-4 text-red-600" }),
1659
- "output-denied": /* @__PURE__ */ Q(gt, { className: "size-4 text-orange-600" })
1658
+ "output-error": /* @__PURE__ */ Q(_t, { className: "size-4 text-red-600" }),
1659
+ "output-denied": /* @__PURE__ */ Q(_t, { className: "size-4 text-orange-600" })
1660
1660
  }[e], {
1661
1661
  "input-streaming": "Pending",
1662
1662
  "input-available": "Running",
@@ -1666,24 +1666,24 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1666
1666
  "output-error": "Error",
1667
1667
  "output-denied": "Denied"
1668
1668
  }[e]]
1669
- }), si = ({ className: e, title: t, type: n, state: r, ...i }) => /* @__PURE__ */ $(E, {
1669
+ }), ci = ({ className: e, title: t, type: n, state: r, ...i }) => /* @__PURE__ */ $(E, {
1670
1670
  className: J("flex w-full items-center justify-between gap-4 p-3", e),
1671
1671
  ...i,
1672
1672
  children: [/* @__PURE__ */ $("div", {
1673
1673
  className: "flex items-center gap-2",
1674
1674
  children: [
1675
- /* @__PURE__ */ Q(mt, { className: "size-4 text-muted-foreground" }),
1675
+ /* @__PURE__ */ Q(ht, { className: "size-4 text-muted-foreground" }),
1676
1676
  /* @__PURE__ */ Q("span", {
1677
1677
  className: "font-medium text-sm",
1678
1678
  children: t ?? n.split("-").slice(1).join("-")
1679
1679
  }),
1680
- oi(r)
1680
+ si(r)
1681
1681
  ]
1682
1682
  }), /* @__PURE__ */ Q(Le, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })]
1683
- }), ci = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
1683
+ }), li = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
1684
1684
  className: J("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
1685
1685
  ...t
1686
- }), li = ({ className: e, input: t, ...n }) => /* @__PURE__ */ $("div", {
1686
+ }), ui = ({ className: e, input: t, ...n }) => /* @__PURE__ */ $("div", {
1687
1687
  className: J("space-y-2 overflow-hidden p-4", e),
1688
1688
  ...n,
1689
1689
  children: [/* @__PURE__ */ Q("h4", {
@@ -1691,18 +1691,18 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1691
1691
  children: "Parameters"
1692
1692
  }), /* @__PURE__ */ Q("div", {
1693
1693
  className: "rounded-md bg-muted/50",
1694
- children: /* @__PURE__ */ Q(ri, {
1694
+ children: /* @__PURE__ */ Q(ii, {
1695
1695
  code: JSON.stringify(t, null, 2),
1696
1696
  language: "json"
1697
1697
  })
1698
1698
  })]
1699
- }), ui = ({ className: e, output: t, errorText: n, ...r }) => {
1699
+ }), di = ({ className: e, output: t, errorText: n, ...r }) => {
1700
1700
  if (!(t || n)) return null;
1701
1701
  let a = /* @__PURE__ */ Q("div", { children: t });
1702
- return typeof t == "object" && !i(t) ? a = /* @__PURE__ */ Q(ri, {
1702
+ return typeof t == "object" && !i(t) ? a = /* @__PURE__ */ Q(ii, {
1703
1703
  code: JSON.stringify(t, null, 2),
1704
1704
  language: "json"
1705
- }) : typeof t == "string" && (a = /* @__PURE__ */ Q(ri, {
1705
+ }) : typeof t == "string" && (a = /* @__PURE__ */ Q(ii, {
1706
1706
  code: t,
1707
1707
  language: "json"
1708
1708
  })), /* @__PURE__ */ $("div", {
@@ -1716,8 +1716,8 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1716
1716
  children: [n && /* @__PURE__ */ Q("div", { children: n }), a]
1717
1717
  })]
1718
1718
  });
1719
- }, di = a(({ children: e, as: t = "p", className: n, duration: r = 2, spread: i = 2 }) => {
1720
- let a = jt.create(t), o = l(() => (e?.length ?? 0) * i, [e, i]);
1719
+ }, fi = a(({ children: e, as: t = "p", className: n, duration: r = 2, spread: i = 2 }) => {
1720
+ let a = Mt.create(t), o = l(() => (e?.length ?? 0) * i, [e, i]);
1721
1721
  return /* @__PURE__ */ Q(a, {
1722
1722
  animate: { backgroundPosition: "0% center" },
1723
1723
  className: J("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent", "[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]", n),
@@ -1733,21 +1733,21 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1733
1733
  },
1734
1734
  children: e
1735
1735
  });
1736
- }), fi = r(null), pi = () => {
1737
- let e = s(fi);
1736
+ }), pi = r(null), mi = () => {
1737
+ let e = s(pi);
1738
1738
  if (!e) throw Error("Reasoning components must be used within Reasoning");
1739
1739
  return e;
1740
- }, mi = 1e3, hi = 1e3, gi = a(({ className: e, isStreaming: t = !1, open: n, defaultOpen: r = !0, onOpenChange: i, duration: a, children: o, ...s }) => {
1741
- let [l, u] = At({
1740
+ }, hi = 1e3, gi = 1e3, _i = a(({ className: e, isStreaming: t = !1, open: n, defaultOpen: r = !0, onOpenChange: i, duration: a, children: o, ...s }) => {
1741
+ let [l, u] = jt({
1742
1742
  prop: n,
1743
1743
  defaultProp: r,
1744
1744
  onChange: i
1745
- }), [f, p] = At({
1745
+ }), [f, p] = jt({
1746
1746
  prop: a,
1747
1747
  defaultProp: void 0
1748
1748
  }), [m, h] = d(!1), [g, _] = d(null);
1749
1749
  return c(() => {
1750
- t ? g === null && _(Date.now()) : g !== null && (p(Math.ceil((Date.now() - g) / hi)), _(null));
1750
+ t ? g === null && _(Date.now()) : g !== null && (p(Math.ceil((Date.now() - g) / gi)), _(null));
1751
1751
  }, [
1752
1752
  t,
1753
1753
  g,
@@ -1756,7 +1756,7 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1756
1756
  if (r && !t && l && !m) {
1757
1757
  let e = setTimeout(() => {
1758
1758
  u(!1), h(!0);
1759
- }, mi);
1759
+ }, hi);
1760
1760
  return () => clearTimeout(e);
1761
1761
  }
1762
1762
  }, [
@@ -1765,7 +1765,7 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1765
1765
  r,
1766
1766
  u,
1767
1767
  m
1768
- ]), /* @__PURE__ */ Q(fi.Provider, {
1768
+ ]), /* @__PURE__ */ Q(pi.Provider, {
1769
1769
  value: {
1770
1770
  isStreaming: t,
1771
1771
  isOpen: l,
@@ -1782,15 +1782,15 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1782
1782
  children: o
1783
1783
  })
1784
1784
  });
1785
- }), _i = (e, t) => e || t === 0 ? /* @__PURE__ */ Q(di, {
1785
+ }), vi = (e, t) => e || t === 0 ? /* @__PURE__ */ Q(fi, {
1786
1786
  duration: 1,
1787
1787
  children: "Thinking..."
1788
1788
  }) : t === void 0 ? /* @__PURE__ */ Q("p", { children: "Thought for a few seconds" }) : /* @__PURE__ */ $("p", { children: [
1789
1789
  "Thought for ",
1790
1790
  t,
1791
1791
  " seconds"
1792
- ] }), vi = a(({ className: e, children: t, getThinkingMessage: n = _i, ...r }) => {
1793
- let { isStreaming: i, isOpen: a, duration: o } = pi();
1792
+ ] }), yi = a(({ className: e, children: t, getThinkingMessage: n = vi, ...r }) => {
1793
+ let { isStreaming: i, isOpen: a, duration: o } = mi();
1794
1794
  return /* @__PURE__ */ Q(E, {
1795
1795
  className: J("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground", e),
1796
1796
  ...r,
@@ -1800,18 +1800,18 @@ var ri = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
1800
1800
  /* @__PURE__ */ Q(Le, { className: J("size-4 transition-transform", a ? "rotate-180" : "rotate-0") })
1801
1801
  ] })
1802
1802
  });
1803
- }), yi = a(({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(T, {
1803
+ }), bi = a(({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(T, {
1804
1804
  className: J("mt-4 text-sm", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
1805
1805
  ...n,
1806
- children: /* @__PURE__ */ Q(Dt, { children: t })
1806
+ children: /* @__PURE__ */ Q(Ot, { children: t })
1807
1807
  }));
1808
- gi.displayName = "Reasoning", vi.displayName = "ReasoningTrigger", yi.displayName = "ReasoningContent";
1808
+ _i.displayName = "Reasoning", yi.displayName = "ReasoningTrigger", bi.displayName = "ReasoningContent";
1809
1809
  //#endregion
1810
1810
  //#region src/elements/sources.tsx
1811
- var bi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
1811
+ var xi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
1812
1812
  className: J("not-prose mb-4 text-primary text-xs", e),
1813
1813
  ...t
1814
- }), xi = ({ className: e, count: t, children: n, ...r }) => /* @__PURE__ */ Q(E, {
1814
+ }), Si = ({ className: e, count: t, children: n, ...r }) => /* @__PURE__ */ Q(E, {
1815
1815
  className: J("flex items-center gap-2", e),
1816
1816
  ...r,
1817
1817
  children: n ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ $("p", {
@@ -1822,10 +1822,10 @@ var bi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
1822
1822
  " sources"
1823
1823
  ]
1824
1824
  }), /* @__PURE__ */ Q(Le, { className: "h-4 w-4" })] })
1825
- }), Si = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
1825
+ }), Ci = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
1826
1826
  className: J("mt-3 flex w-fit flex-col gap-2", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
1827
1827
  ...t
1828
- }), Ci = ({ href: e, title: t, children: n, ...r }) => /* @__PURE__ */ Q("a", {
1828
+ }), wi = ({ href: e, title: t, children: n, ...r }) => /* @__PURE__ */ Q("a", {
1829
1829
  className: "flex items-center gap-2",
1830
1830
  href: e,
1831
1831
  rel: "noreferrer",
@@ -1838,7 +1838,7 @@ var bi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
1838
1838
  });
1839
1839
  //#endregion
1840
1840
  //#region src/ChatbotEnhanced.tsx
1841
- function wi(e) {
1841
+ function Ti(e) {
1842
1842
  let t = e ?? {}, n = t.data && typeof t.data == "object" ? t.data : t, r = n.seedApplied, i = n.probes;
1843
1843
  if (!r && !i) return;
1844
1844
  let a = {};
@@ -1852,10 +1852,10 @@ function wi(e) {
1852
1852
  message: String(e.message)
1853
1853
  }))), a;
1854
1854
  }
1855
- function Ti(e) {
1855
+ function Ei(e) {
1856
1856
  return e === "user" ? "user" : "assistant";
1857
1857
  }
1858
- function Ei(e) {
1858
+ function Di(e) {
1859
1859
  let t = e.trim();
1860
1860
  if (t.length < 2 || !(t.startsWith("{") || t.startsWith("[")) || !(t.endsWith("}") || t.endsWith("]"))) return !1;
1861
1861
  try {
@@ -1864,15 +1864,15 @@ function Ei(e) {
1864
1864
  return !1;
1865
1865
  }
1866
1866
  }
1867
- function Di(e) {
1867
+ function Oi(e) {
1868
1868
  let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available");
1869
1869
  return t === "output-error" || t === "output-denied" ? "failed" : t === "approval-requested" || t === "approval-responded" ? "awaiting" : t === "output-available" ? "completed" : "running";
1870
1870
  }
1871
- function Oi(e) {
1872
- let t = Di(e);
1871
+ function ki(e) {
1872
+ let t = Oi(e);
1873
1873
  return t === "awaiting" || t === "failed" || !!e.pendingActionId || !!e.draftReview?.items.length || !!e.proposedPlan;
1874
1874
  }
1875
- function ki(e) {
1875
+ function Ai(e) {
1876
1876
  switch (e) {
1877
1877
  case "failed": return 4;
1878
1878
  case "awaiting": return 3;
@@ -1880,17 +1880,17 @@ function ki(e) {
1880
1880
  case "completed": return 1;
1881
1881
  }
1882
1882
  }
1883
- function Ai(e) {
1883
+ function ji(e) {
1884
1884
  let t = /* @__PURE__ */ new Map();
1885
1885
  for (let n of e) {
1886
- let e = Di(n), r = `${n.toolName}:${e}`, i = t.get(r);
1886
+ let e = Oi(n), r = `${n.toolName}:${e}`, i = t.get(r);
1887
1887
  if (i) {
1888
1888
  i.count += 1, i.errorText = i.errorText ?? n.errorText;
1889
1889
  continue;
1890
1890
  }
1891
1891
  t.set(r, {
1892
1892
  key: r,
1893
- title: Dn(n.toolName) || n.toolName,
1893
+ title: On(n.toolName) || n.toolName,
1894
1894
  rawName: n.toolName,
1895
1895
  count: 1,
1896
1896
  state: e,
@@ -1898,11 +1898,11 @@ function Ai(e) {
1898
1898
  });
1899
1899
  }
1900
1900
  return Array.from(t.values()).sort((e, t) => {
1901
- let n = ki(t.state) - ki(e.state);
1901
+ let n = Ai(t.state) - Ai(e.state);
1902
1902
  return n === 0 ? e.title.localeCompare(t.title) : n;
1903
1903
  });
1904
1904
  }
1905
- function ji({ health: e }) {
1905
+ function Mi({ health: e }) {
1906
1906
  if (!e) return null;
1907
1907
  let t = e.issues ?? [], n = t.filter((e) => e.severity === "error"), r = t.filter((e) => e.severity !== "error"), i = e.checked, a = !!i && i.seeds + i.views + i.widgets > 0, o = [];
1908
1908
  if (typeof e.seededRows == "number" && e.seededRows > 0 && !e.seedError && o.push(`${e.seededRows} sample row${e.seededRows === 1 ? "" : "s"} live`), a && n.length === 0) {
@@ -1932,32 +1932,34 @@ function ji({ health: e }) {
1932
1932
  ]
1933
1933
  });
1934
1934
  }
1935
- var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, onClear: a, onStop: o, onReload: s, onUpgrade: c, disabled: l = !1, isLoading: u = !1, error: d, showTimestamp: f = !1, showAvatars: p = !1, userAvatarUrl: m, userAvatarFallback: h = "You", assistantAvatarUrl: g, assistantAvatarFallback: _ = "AI", hideClearBar: v = !1, maxHeight: y = "500px", enableMarkdown: b = !0, enableFileUpload: x = !1, acceptedFileTypes: S = "image/*,.pdf,.doc,.docx,.txt", maxFileSize: C = 10 * 1024 * 1024, suggestions: w, labels: T, models: E, selectedModelId: D, onModelChange: O, headerSlot: k, promptOverlaySlot: A, onInputChange: j, onToolApprove: M, toolApproveLabel: N = "Approve", toolDenyLabel: ee = "Deny", toolDenyReason: te = "User denied the operation", toolDecisions: P, onReviewDraft: F, toolReviewLabel: ne = (e) => `Review ${e} change${e === 1 ? "" : "s"}`, onPublishDrafts: I, onOpenBuiltApp: re, openBuiltAppLabel: ie = "Open app", onPreviewDraftApp: ae, previewDraftLabel: L = "Preview", onDraftArtifacts: R, onBuildMaterialized: z, publishDraftsLabel: oe = "Publish", publishedLabel: B = "Published", verifiedLabel: se = "Verified", nextStepsLabel: ce = "What's next", planTitleLabel: le = "Proposed plan", planQuestionsLabel: ue = "Confirm before building", planAssumptionsLabel: de = "Assumptions", planApproveHintLabel: fe = "Reply to approve or adjust this plan.", planApproveLabel: pe = "Build it", planAdjustLabel: me = "Adjust", planApproveMessage: he = "Looks good — build it as proposed.", planApproveDefaultsMessage: ge = "Build it with your best assumptions; use sensible defaults for the open questions.", planAnswerMessage: _e = (e, t) => `For "${e}", go with: ${t}.`, fetchPendingDraftCount: V, autoPublishDrafts: ve = !1, processVisibility: H = "summary", surface: ye = "card", ...be }, U) => {
1936
- let W = u ? "streaming" : "ready", G = ye === "plain", [K, xe] = e.useState(null), q = e.useMemo(() => ({
1937
- emptyTitle: T?.emptyTitle ?? "Start a conversation",
1938
- emptyDescription: T?.emptyDescription ?? "Ask anything — the assistant has access to your current app context.",
1939
- clear: T?.clear ?? "Clear",
1940
- sendHint: T?.sendHint ?? "to send",
1941
- agentActivity: T?.agentActivity ?? "Agent activity",
1942
- toolCompleted: T?.toolCompleted ?? "Completed",
1943
- toolRunning: T?.toolRunning ?? "Running",
1944
- toolAwaitingApproval: T?.toolAwaitingApproval ?? "Awaiting approval",
1945
- toolFailed: T?.toolFailed ?? "Failed",
1946
- toolDetailsHidden: T?.toolDetailsHidden ?? "Detailed tool inputs and outputs are hidden in this view.",
1947
- copy: T?.copy ?? "Copy",
1948
- copied: T?.copied ?? "Copied",
1949
- regenerate: T?.regenerate ?? "Regenerate",
1950
- model: T?.model ?? "Model",
1951
- submit: T?.submit ?? "Submit",
1952
- uploadFiles: T?.uploadFiles ?? "Upload files",
1953
- stopResponse: T?.stopResponse ?? "Stop response",
1954
- trace: T?.trace ?? "trace",
1955
- viewTrace: T?.viewTrace ?? "View trace",
1956
- connectionWaiting: T?.connectionWaiting ?? "Waiting for server…"
1957
- }), [T]), [Se, Ce] = e.useState(() => /* @__PURE__ */ new Set()), [we, Te] = e.useState(() => /* @__PURE__ */ new Map()), [Ee, De] = e.useState(() => /* @__PURE__ */ new Map()), ke = e.useRef(/* @__PURE__ */ new Set()), Ae = e.useCallback(async (e) => {
1935
+ var Ni = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, onClear: a, onStop: o, onReload: s, onUpgrade: c, disabled: l = !1, readOnly: u = !1, isLoading: d = !1, error: f, showTimestamp: p = !1, showAvatars: m = !1, userAvatarUrl: h, userAvatarFallback: g = "You", assistantAvatarUrl: _, assistantAvatarFallback: v = "AI", hideClearBar: y = !1, maxHeight: b = "500px", enableMarkdown: x = !0, enableFileUpload: S = !1, acceptedFileTypes: C = "image/*,.pdf,.doc,.docx,.txt", maxFileSize: w = 10 * 1024 * 1024, suggestions: T, labels: E, models: D, selectedModelId: O, onModelChange: k, headerSlot: A, promptOverlaySlot: j, onInputChange: M, onToolApprove: N, toolApproveLabel: ee = "Approve", toolDenyLabel: te = "Deny", toolDenyReason: P = "User denied the operation", toolDecisions: F, onReviewDraft: ne, toolReviewLabel: re = (e) => `Review ${e} change${e === 1 ? "" : "s"}`, onPublishDrafts: I, onOpenBuiltApp: ie, openBuiltAppLabel: ae = "Open app", onPreviewDraftApp: L, previewDraftLabel: oe = "Preview", onDraftArtifacts: R, onBuildMaterialized: z, publishDraftsLabel: B = "Publish", publishedLabel: se = "Published", verifiedLabel: ce = "Verified", nextStepsLabel: le = "What's next", planTitleLabel: ue = "Proposed plan", planQuestionsLabel: de = "Confirm before building", planAssumptionsLabel: fe = "Assumptions", planApproveHintLabel: pe = "Reply to approve or adjust this plan.", planApproveLabel: me = "Build it", planAdjustLabel: he = "Adjust", planBuiltLabel: ge = "Built", planApproveMessage: _e = "Looks good — build it as proposed.", planApproveDefaultsMessage: ve = "Build it with your best assumptions; use sensible defaults for the open questions.", planAnswerMessage: ye = (e, t) => `For "${e}", go with: ${t}.`, fetchPendingDraftCount: V, autoPublishDrafts: be = !1, processVisibility: H = "summary", surface: U = "card", ...W }, xe) => {
1936
+ let G = d ? "streaming" : "ready", K = U === "plain", [Se, Ce] = e.useState(null), q = e.useMemo(() => ({
1937
+ emptyTitle: E?.emptyTitle ?? "Start a conversation",
1938
+ emptyDescription: E?.emptyDescription ?? "Ask anything — the assistant has access to your current app context.",
1939
+ clear: E?.clear ?? "Clear",
1940
+ sendHint: E?.sendHint ?? "to send",
1941
+ agentActivity: E?.agentActivity ?? "Agent activity",
1942
+ toolCompleted: E?.toolCompleted ?? "Completed",
1943
+ toolRunning: E?.toolRunning ?? "Running",
1944
+ toolAwaitingApproval: E?.toolAwaitingApproval ?? "Awaiting approval",
1945
+ toolFailed: E?.toolFailed ?? "Failed",
1946
+ toolDetailsHidden: E?.toolDetailsHidden ?? "Detailed tool inputs and outputs are hidden in this view.",
1947
+ copy: E?.copy ?? "Copy",
1948
+ copied: E?.copied ?? "Copied",
1949
+ regenerate: E?.regenerate ?? "Regenerate",
1950
+ model: E?.model ?? "Model",
1951
+ submit: E?.submit ?? "Submit",
1952
+ uploadFiles: E?.uploadFiles ?? "Upload files",
1953
+ stopResponse: E?.stopResponse ?? "Stop response",
1954
+ trace: E?.trace ?? "trace",
1955
+ viewTrace: E?.viewTrace ?? "View trace",
1956
+ connectionWaiting: E?.connectionWaiting ?? "Waiting for server…",
1957
+ connectionStalledLabel: E?.connectionStalledLabel ?? "Still working…",
1958
+ connectionOfflineLabel: E?.connectionOfflineLabel ?? "Connection lost — reconnecting…"
1959
+ }), [E]), [we, Te] = e.useState(() => /* @__PURE__ */ new Set()), [Ee, De] = e.useState(() => /* @__PURE__ */ new Map()), [ke, Ae] = e.useState(() => /* @__PURE__ */ new Map()), je = e.useRef(/* @__PURE__ */ new Set()), Ne = e.useCallback(async (e) => {
1958
1960
  if (V) try {
1959
1961
  let t = await V(e);
1960
- De((n) => {
1962
+ Ae((n) => {
1961
1963
  if (n.get(e) === t) return n;
1962
1964
  let r = new Map(n);
1963
1965
  return r.set(e, t), r;
@@ -1965,43 +1967,43 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
1965
1967
  } catch {}
1966
1968
  }, [V]);
1967
1969
  e.useEffect(() => {
1968
- if (!V || u) return;
1970
+ if (!V || d) return;
1969
1971
  let e = /* @__PURE__ */ new Set();
1970
1972
  for (let t of n) for (let n of t.toolInvocations ?? []) {
1971
1973
  let t = n.draftReview?.packageId, r = n.toolCallId;
1972
- t && r && !ke.current.has(r) && (ke.current.add(r), e.add(t));
1974
+ t && r && !je.current.has(r) && (je.current.add(r), e.add(t));
1973
1975
  }
1974
- for (let t of e) Ae(t);
1976
+ for (let t of e) Ne(t);
1975
1977
  }, [
1976
1978
  n,
1977
- u,
1979
+ d,
1978
1980
  V,
1979
- Ae
1981
+ Ne
1980
1982
  ]);
1981
- let je = e.useCallback(async (e) => {
1983
+ let Fe = e.useCallback(async (e) => {
1982
1984
  if (!I) return;
1983
1985
  let t = [];
1984
1986
  for (let r of n) for (let n of r.toolInvocations ?? []) n.draftReview?.packageId === e && n.toolCallId && t.push(n.toolCallId);
1985
1987
  let r = await I(e), i = r && typeof r == "object" ? r : void 0;
1986
1988
  if ((i ? i.ok !== !1 : r !== !1) && t.length > 0) {
1987
- Ce((e) => {
1989
+ Te((e) => {
1988
1990
  let n = new Set(e);
1989
1991
  for (let e of t) n.add(e);
1990
1992
  return n;
1991
1993
  });
1992
1994
  let e = i?.health;
1993
- e && Te((n) => {
1995
+ e && De((n) => {
1994
1996
  let r = new Map(n);
1995
1997
  for (let n of t) r.set(n, e);
1996
1998
  return r;
1997
1999
  });
1998
2000
  }
1999
- Ae(e);
2001
+ Ne(e);
2000
2002
  }, [
2001
2003
  I,
2002
2004
  n,
2003
- Ae
2004
- ]), Ne = e.useRef(/* @__PURE__ */ new Set()), Fe = e.useRef(!1);
2005
+ Ne
2006
+ ]), Ie = e.useRef(/* @__PURE__ */ new Set()), Le = e.useRef(!1);
2005
2007
  e.useEffect(() => {
2006
2008
  let e = [];
2007
2009
  for (let t of n) for (let n of t.toolInvocations ?? []) {
@@ -2011,78 +2013,94 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2011
2013
  packageId: t.packageId
2012
2014
  });
2013
2015
  }
2014
- if (!Fe.current) {
2015
- Fe.current = !0;
2016
- for (let t of e) Ne.current.add(t.key);
2016
+ if (!Le.current) {
2017
+ Le.current = !0;
2018
+ for (let t of e) Ie.current.add(t.key);
2017
2019
  return;
2018
2020
  }
2019
- if (!ve || !I || u) return;
2020
- let t = e.filter((e) => !Ne.current.has(e.key));
2021
+ if (!be || !I || d) return;
2022
+ let t = e.filter((e) => !Ie.current.has(e.key));
2021
2023
  if (t.length !== 0) {
2022
- for (let e of t) Ne.current.add(e.key);
2023
- for (let e of [...new Set(t.map((e) => e.packageId))]) je(e);
2024
+ for (let e of t) Ie.current.add(e.key);
2025
+ for (let e of [...new Set(t.map((e) => e.packageId))]) Fe(e);
2024
2026
  }
2025
2027
  }, [
2026
2028
  n,
2027
- u,
2028
- ve,
2029
+ d,
2030
+ be,
2029
2031
  I,
2030
- je
2032
+ Fe
2031
2033
  ]);
2032
- let Ie = e.useRef(/* @__PURE__ */ new Set());
2034
+ let Re = e.useRef(/* @__PURE__ */ new Set());
2033
2035
  e.useEffect(() => {
2034
2036
  if (!R) return;
2035
- let e = /* @__PURE__ */ new Map();
2036
- for (let t of n) {
2037
- for (let n of t.buildProgress?.items ?? []) n?.type && n?.name && e.set(`${n.type}:${n.name}`, n);
2038
- for (let n of t.toolInvocations ?? []) for (let t of n.draftReview?.items ?? []) t?.type && t?.name && e.set(`${t.type}:${t.name}`, t);
2037
+ let e = /* @__PURE__ */ new Map(), t;
2038
+ for (let r of n) {
2039
+ for (let t of r.buildProgress?.items ?? []) t?.type && t?.name && e.set(`${t.type}:${t.name}`, t);
2040
+ for (let n of r.toolInvocations ?? []) {
2041
+ let r = n.draftReview;
2042
+ for (let t of r?.items ?? []) t?.type && t?.name && e.set(`${t.type}:${t.name}`, t);
2043
+ r?.packageId && r.items?.some((e) => e.type === "app") && (t = r.packageId);
2044
+ }
2039
2045
  }
2040
- let t = Ie.current, r = !1;
2041
- for (let n of e.keys()) t.has(n) || (t.add(n), r = !0);
2042
- r && R([...e.values()]);
2046
+ let r = Re.current, i = !1;
2047
+ for (let t of e.keys()) r.has(t) || (r.add(t), i = !0);
2048
+ i && R([...e.values()], t);
2043
2049
  }, [n, R]);
2044
- let Le = e.useRef(/* @__PURE__ */ new Set());
2050
+ let ze = e.useRef(/* @__PURE__ */ new Set());
2045
2051
  e.useEffect(() => {
2046
2052
  if (z) for (let e of n) for (let t of e.toolInvocations ?? []) {
2047
2053
  let e = t.draftReview;
2048
2054
  if (!e?.materialized || !t.toolCallId) continue;
2049
2055
  let n = e.items.find((e) => e.type === "app");
2050
- !n || Le.current.has(t.toolCallId) || (Le.current.add(t.toolCallId), z(n.name));
2056
+ !n || ze.current.has(t.toolCallId) || (ze.current.add(t.toolCallId), z(n.name));
2051
2057
  }
2052
2058
  }, [n, z]);
2053
- let Re = e.useCallback((e) => {
2059
+ let Be = e.useCallback((e) => {
2054
2060
  let t = !!e.text?.trim(), n = e.files?.map((e) => e.file).filter(Boolean), r = !!(n && n.length > 0);
2055
2061
  (t || r) && i?.(e.text?.trim() ?? "", n);
2056
- }, [i]), ze = e.useCallback((e) => {
2062
+ }, [i]), He = e.useCallback((e) => {
2057
2063
  i?.(e);
2058
- }, [i]), Be = e.useRef(null), He = e.useCallback((e) => {
2059
- i?.(e ? ge : he);
2064
+ }, [i]), Ue = e.useRef(null), We = e.useCallback((e) => {
2065
+ i?.(e ? ve : _e);
2060
2066
  }, [
2061
2067
  i,
2062
- he,
2063
- ge
2064
- ]), Ue = e.useCallback(() => {
2065
- let e = Be.current?.querySelector("textarea");
2068
+ _e,
2069
+ ve
2070
+ ]), Ke = e.useCallback(() => {
2071
+ let e = Ue.current?.querySelector("textarea");
2066
2072
  e && (e.focus(), e.scrollIntoView({ block: "nearest" }));
2067
- }, []), We = e.useCallback((e) => {
2068
- navigator.clipboard?.writeText(e.content), xe(e.id), window.setTimeout(() => xe((t) => t === e.id ? null : t), 1500);
2069
- }, []), Ke = (e) => {
2070
- let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available"), n = `tool-${e.toolName}`, r = P?.[e.toolCallId], a = t === "approval-requested" && !!M && !r, o = t === "approval-requested" && !!e.pendingActionId, s = Dn(e.toolName), c = On(e.result), l = H === "debug" && s && s.toLowerCase() !== e.toolName.toLowerCase(), u = H === "debug" || a, d = e.draftReview?.packageId, f = d === void 0 ? void 0 : Ee.get(d), p = f === void 0 ? Se.has(e.toolCallId) : f === 0, m = /* @__PURE__ */ $("span", {
2073
+ }, []), Je = e.useCallback((e) => {
2074
+ navigator.clipboard?.writeText(e.content), Ce(e.id), window.setTimeout(() => Ce((t) => t === e.id ? null : t), 1500);
2075
+ }, []), Qe = e.useMemo(() => {
2076
+ let e = /* @__PURE__ */ new Set(), t = [], r = -1, i = 0;
2077
+ for (let e of n) for (let n of e.toolInvocations ?? []) n.proposedPlan && n.toolCallId && t.push({
2078
+ id: n.toolCallId,
2079
+ order: i
2080
+ }), n.toolName === "apply_blueprint" && (r = i), i += 1;
2081
+ for (let n of t) n.order < r && e.add(n.id);
2082
+ return e;
2083
+ }, [n]), $e = (e) => {
2084
+ let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available"), n = `tool-${e.toolName}`, r = F?.[e.toolCallId], a = t === "approval-requested" && !!N && !r, o = t === "approval-requested" && !!e.pendingActionId, s = On(e.toolName), c = kn(e.result), l = H === "debug" && s && s.toLowerCase() !== e.toolName.toLowerCase(), u = H === "debug" || a, d = e.draftReview?.packageId, f = d === void 0 ? void 0 : ke.get(d), p = f === void 0 ? we.has(e.toolCallId) : f === 0, m = t === "input-streaming" || t === "input-available", h = /* @__PURE__ */ $("span", {
2071
2085
  className: "inline-flex items-center gap-2",
2072
- children: [/* @__PURE__ */ Q("span", { children: s || e.toolName }), l ? /* @__PURE__ */ Q("code", {
2073
- className: "rounded bg-muted px-1 py-px text-[10px] font-mono text-muted-foreground",
2074
- children: e.toolName
2075
- }) : null]
2086
+ children: [
2087
+ /* @__PURE__ */ Q("span", { children: s || e.toolName }),
2088
+ l ? /* @__PURE__ */ Q("code", {
2089
+ className: "rounded bg-muted px-1 py-px text-[10px] font-mono text-muted-foreground",
2090
+ children: e.toolName
2091
+ }) : null,
2092
+ m ? /* @__PURE__ */ Q(Hi, { offlineLabel: q.connectionOfflineLabel }) : null
2093
+ ]
2076
2094
  });
2077
- return /* @__PURE__ */ $(ai, {
2095
+ return /* @__PURE__ */ $(oi, {
2078
2096
  defaultOpen: t === "output-error" || t === "approval-requested" || !!(e.draftReview && e.draftReview.items.length > 0) || !!e.proposedPlan,
2079
- children: [/* @__PURE__ */ Q(si, {
2097
+ children: [/* @__PURE__ */ Q(ci, {
2080
2098
  type: n,
2081
2099
  state: t,
2082
- title: m
2083
- }), /* @__PURE__ */ $(ci, { children: [
2084
- u && e.args !== void 0 ? /* @__PURE__ */ Q(li, { input: e.args }) : null,
2085
- o ? null : u || t === "output-error" ? /* @__PURE__ */ Q(qi, {
2100
+ title: h
2101
+ }), /* @__PURE__ */ $(li, { children: [
2102
+ u && e.args !== void 0 ? /* @__PURE__ */ Q(ui, { input: e.args }) : null,
2103
+ o ? null : u || t === "output-error" ? /* @__PURE__ */ Q(Xi, {
2086
2104
  output: c,
2087
2105
  errorText: e.errorText
2088
2106
  }) : null,
@@ -2097,17 +2115,17 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2097
2115
  className: "flex gap-2 p-3 border-t bg-muted/30",
2098
2116
  children: [/* @__PURE__ */ Q("button", {
2099
2117
  type: "button",
2100
- onClick: () => M?.(e.toolCallId, !0),
2118
+ onClick: () => N?.(e.toolCallId, !0),
2101
2119
  className: "inline-flex h-7 items-center rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2102
- children: N
2120
+ children: ee
2103
2121
  }), /* @__PURE__ */ Q("button", {
2104
2122
  type: "button",
2105
- onClick: () => M?.(e.toolCallId, !1, te),
2123
+ onClick: () => N?.(e.toolCallId, !1, P),
2106
2124
  className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
2107
- children: ee
2125
+ children: te
2108
2126
  })]
2109
2127
  }) : null,
2110
- e.draftReview && e.draftReview.items.length > 0 && (F || I && e.draftReview.packageId) ? /* @__PURE__ */ $(Z, { children: [
2128
+ e.draftReview && e.draftReview.items.length > 0 && (ne || I && e.draftReview.packageId) ? /* @__PURE__ */ $(Z, { children: [
2111
2129
  /* @__PURE__ */ $("div", {
2112
2130
  className: "flex items-center gap-2 p-3 border-t bg-muted/30",
2113
2131
  children: [
@@ -2115,34 +2133,37 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2115
2133
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700",
2116
2134
  children: [
2117
2135
  /* @__PURE__ */ Q(Y, { className: "size-3.5" }),
2118
- B,
2136
+ se,
2119
2137
  e.draftReview.failedCount ? ` · ${e.draftReview.failedCount} need${e.draftReview.failedCount === 1 ? "s" : ""} attention` : ""
2120
2138
  ]
2121
2139
  }) : /* @__PURE__ */ $("button", {
2122
2140
  type: "button",
2123
- onClick: () => void je(e.draftReview.packageId),
2141
+ onClick: () => void Fe(e.draftReview.packageId),
2124
2142
  className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2125
2143
  "data-testid": "draft-publish",
2126
2144
  children: [
2127
2145
  /* @__PURE__ */ Q(ct, { className: "size-3.5" }),
2128
- oe,
2146
+ B,
2129
2147
  typeof f == "number" && f > 0 ? ` (${f})` : ""
2130
2148
  ]
2131
2149
  }) : null,
2132
- F ? /* @__PURE__ */ $("button", {
2150
+ ne ? /* @__PURE__ */ $("button", {
2133
2151
  type: "button",
2134
- onClick: () => F(e.draftReview.items),
2152
+ onClick: () => ne(e.draftReview.items),
2135
2153
  className: I && e.draftReview.packageId ? "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted" : "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2136
- children: [/* @__PURE__ */ Q(Xe, { className: "size-3.5" }), ne(e.draftReview.items.length)]
2154
+ children: [/* @__PURE__ */ Q(Xe, { className: "size-3.5" }), re(e.draftReview.items.length)]
2137
2155
  }) : null,
2138
- ae && !p ? (() => {
2156
+ L && !p ? (() => {
2139
2157
  let t = e.draftReview.items.find((e) => e.type === "app");
2140
2158
  return t ? /* @__PURE__ */ $("button", {
2141
2159
  type: "button",
2142
- onClick: () => ae(t.name, { materialized: e.draftReview.materialized === !0 }),
2160
+ onClick: () => L(t.name, {
2161
+ materialized: e.draftReview.materialized === !0,
2162
+ appSegment: e.draftReview.packageId
2163
+ }),
2143
2164
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted",
2144
2165
  "data-testid": "draft-preview-app",
2145
- children: [/* @__PURE__ */ Q(Ye, { className: "size-3.5" }), L]
2166
+ children: [/* @__PURE__ */ Q(Ye, { className: "size-3.5" }), oe]
2146
2167
  }) : null;
2147
2168
  })() : null,
2148
2169
  e.draftReview.verification ? e.draftReview.verification.errors > 0 ? /* @__PURE__ */ $("span", {
@@ -2152,7 +2173,7 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2152
2173
  }) : /* @__PURE__ */ $("span", {
2153
2174
  className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-2.5 text-xs font-medium text-emerald-700",
2154
2175
  "data-testid": "draft-verification-chip",
2155
- children: [/* @__PURE__ */ Q(ut, { className: "size-3.5" }), se]
2176
+ children: [/* @__PURE__ */ Q(ut, { className: "size-3.5" }), ce]
2156
2177
  }) : null,
2157
2178
  e.draftReview.summary ? /* @__PURE__ */ Q("span", {
2158
2179
  className: "truncate text-xs text-muted-foreground",
@@ -2171,13 +2192,13 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2171
2192
  children: [/* @__PURE__ */ Q(Oe, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Q("span", { children: e.message })]
2172
2193
  }, `w${t}`))]
2173
2194
  }) : null,
2174
- Se.has(e.toolCallId) ? /* @__PURE__ */ Q(ji, { health: we.get(e.toolCallId) }) : null,
2195
+ we.has(e.toolCallId) ? /* @__PURE__ */ Q(Mi, { health: Ee.get(e.toolCallId) }) : null,
2175
2196
  e.draftReview.nextSteps && e.draftReview.nextSteps.length > 0 ? /* @__PURE__ */ $("div", {
2176
2197
  className: "flex flex-col gap-1 border-t bg-muted/20 px-3 py-2",
2177
2198
  "data-testid": "draft-next-steps",
2178
2199
  children: [/* @__PURE__ */ Q("span", {
2179
2200
  className: "text-xs font-medium text-foreground/80",
2180
- children: ce
2201
+ children: le
2181
2202
  }), e.draftReview.nextSteps.map((e, t) => /* @__PURE__ */ $("div", {
2182
2203
  className: "flex items-start gap-1.5 text-xs text-muted-foreground",
2183
2204
  children: [/* @__PURE__ */ Q("span", {
@@ -2193,7 +2214,7 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2193
2214
  children: [
2194
2215
  /* @__PURE__ */ $("span", {
2195
2216
  className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
2196
- children: [/* @__PURE__ */ Q(Ve, { className: "size-3.5" }), le]
2217
+ children: [/* @__PURE__ */ Q(Ve, { className: "size-3.5" }), ue]
2197
2218
  }),
2198
2219
  e.proposedPlan.summary ? /* @__PURE__ */ Q("p", {
2199
2220
  className: "text-xs text-muted-foreground",
@@ -2225,7 +2246,7 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2225
2246
  className: "flex flex-col gap-0.5",
2226
2247
  children: [/* @__PURE__ */ Q("span", {
2227
2248
  className: "text-[11px] font-medium text-foreground/70",
2228
- children: de
2249
+ children: fe
2229
2250
  }), e.proposedPlan.assumptions.map((e, t) => /* @__PURE__ */ $("div", {
2230
2251
  className: "flex items-start gap-1.5 text-[11px] text-muted-foreground",
2231
2252
  children: [/* @__PURE__ */ Q("span", {
@@ -2239,7 +2260,7 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2239
2260
  "data-testid": "proposed-plan-questions",
2240
2261
  children: [/* @__PURE__ */ $("span", {
2241
2262
  className: "inline-flex items-center gap-1.5 text-[11px] font-medium text-amber-800 dark:text-amber-300",
2242
- children: [/* @__PURE__ */ Q(Ze, { className: "size-3.5" }), ue]
2263
+ children: [/* @__PURE__ */ Q(Ze, { className: "size-3.5" }), de]
2243
2264
  }), e.proposedPlan.questions.map((t, n) => {
2244
2265
  let r = e.proposedPlan.questionChoices?.find((e) => e.text === t);
2245
2266
  return /* @__PURE__ */ $("div", {
@@ -2255,7 +2276,7 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2255
2276
  "data-testid": "proposed-plan-choice",
2256
2277
  children: r.options.map((e, n) => /* @__PURE__ */ Q("button", {
2257
2278
  type: "button",
2258
- onClick: () => i(_e(t, e)),
2279
+ onClick: () => i(ye(t, e)),
2259
2280
  className: "inline-flex h-6 items-center rounded-full border border-amber-300 bg-background px-2 text-[11px] font-medium text-amber-900 hover:bg-amber-100 dark:border-amber-800 dark:text-amber-200 dark:hover:bg-amber-900/40",
2260
2281
  children: e
2261
2282
  }, n))
@@ -2263,25 +2284,33 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2263
2284
  }, n);
2264
2285
  })]
2265
2286
  }) : null,
2266
- i ? /* @__PURE__ */ $("div", {
2287
+ i ? Qe.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
2288
+ className: "flex flex-wrap items-center gap-1.5 pt-0.5",
2289
+ "data-testid": "proposed-plan-actions",
2290
+ children: /* @__PURE__ */ $("span", {
2291
+ className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300",
2292
+ "data-testid": "proposed-plan-built",
2293
+ children: [/* @__PURE__ */ Q(Y, { className: "size-3.5" }), ge]
2294
+ })
2295
+ }) : /* @__PURE__ */ $("div", {
2267
2296
  className: "flex flex-wrap items-center gap-1.5 pt-0.5",
2268
2297
  "data-testid": "proposed-plan-actions",
2269
2298
  children: [/* @__PURE__ */ $("button", {
2270
2299
  type: "button",
2271
- onClick: () => He(e.proposedPlan.questions.length > 0),
2300
+ onClick: () => We(e.proposedPlan.questions.length > 0),
2272
2301
  className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2273
2302
  "data-testid": "proposed-plan-approve",
2274
- children: [/* @__PURE__ */ Q(ct, { className: "size-3.5" }), pe]
2303
+ children: [/* @__PURE__ */ Q(ct, { className: "size-3.5" }), me]
2275
2304
  }), /* @__PURE__ */ Q("button", {
2276
2305
  type: "button",
2277
- onClick: Ue,
2306
+ onClick: Ke,
2278
2307
  className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
2279
2308
  "data-testid": "proposed-plan-adjust",
2280
- children: me
2309
+ children: he
2281
2310
  })]
2282
2311
  }) : /* @__PURE__ */ Q("span", {
2283
2312
  className: "text-[11px] italic text-muted-foreground/80",
2284
- children: fe
2313
+ children: pe
2285
2314
  })
2286
2315
  ]
2287
2316
  }) : null
@@ -2289,13 +2318,13 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2289
2318
  }, e.toolCallId);
2290
2319
  };
2291
2320
  return /* @__PURE__ */ $("div", {
2292
- ref: U,
2293
- className: J(G ? "flex min-h-0 flex-col overflow-hidden bg-background" : "flex min-h-0 flex-col overflow-hidden rounded-lg border bg-background", t),
2294
- style: { maxHeight: y },
2295
- ...be,
2321
+ ref: xe,
2322
+ className: J(K ? "flex min-h-0 flex-col overflow-hidden bg-background" : "flex min-h-0 flex-col overflow-hidden rounded-lg border bg-background", t),
2323
+ style: { maxHeight: b },
2324
+ ...W,
2296
2325
  children: [
2297
- a && !v && n.length > 0 && /* @__PURE__ */ Q("div", {
2298
- className: J("flex items-center justify-end px-4 py-2", G ? "bg-background" : "border-b bg-muted/30"),
2326
+ a && !y && n.length > 0 && /* @__PURE__ */ Q("div", {
2327
+ className: J("flex items-center justify-end px-4 py-2", K ? "bg-background" : "border-b bg-muted/30"),
2299
2328
  children: /* @__PURE__ */ Q("button", {
2300
2329
  type: "button",
2301
2330
  onClick: a,
@@ -2303,21 +2332,21 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2303
2332
  children: q.clear
2304
2333
  })
2305
2334
  }),
2306
- k ? /* @__PURE__ */ Q("div", {
2307
- className: J("shrink-0", !G && "border-b bg-background/50"),
2308
- children: k
2335
+ A ? /* @__PURE__ */ Q("div", {
2336
+ className: J("shrink-0", !K && "border-b bg-background/50"),
2337
+ children: A
2309
2338
  }) : null,
2310
- /* @__PURE__ */ $(Mn, {
2339
+ /* @__PURE__ */ $(Nn, {
2311
2340
  className: "flex-1 min-h-0",
2312
- children: [/* @__PURE__ */ $(Nn, {
2313
- className: J("space-y-4", G ? "mx-auto w-full max-w-2xl px-4 py-8 sm:px-0" : "px-4 py-3"),
2314
- children: [n.length === 0 ? /* @__PURE__ */ $(Pn, {
2341
+ children: [/* @__PURE__ */ $(Pn, {
2342
+ className: J("space-y-4", K ? "mx-auto w-full max-w-2xl px-4 py-8 sm:px-0" : "px-4 py-3"),
2343
+ children: [n.length === 0 ? /* @__PURE__ */ $(Fn, {
2315
2344
  className: "gap-3 px-0 py-8",
2316
2345
  children: [
2317
2346
  /* @__PURE__ */ Q("div", {
2318
2347
  className: "flex size-9 items-center justify-center rounded-md bg-muted/70 text-muted-foreground",
2319
- children: g ? /* @__PURE__ */ Q("img", {
2320
- src: g,
2348
+ children: _ ? /* @__PURE__ */ Q("img", {
2349
+ src: _,
2321
2350
  alt: "",
2322
2351
  className: "size-full rounded-md object-cover"
2323
2352
  }) : /* @__PURE__ */ Q(Me, { className: "size-4" })
@@ -2332,50 +2361,52 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2332
2361
  children: q.emptyDescription
2333
2362
  })]
2334
2363
  }),
2335
- w && w.length > 0 ? /* @__PURE__ */ Q(Qr, {
2364
+ T && T.length > 0 ? /* @__PURE__ */ Q($r, {
2336
2365
  className: "justify-center gap-2",
2337
- children: w.map((e) => /* @__PURE__ */ Q($r, {
2366
+ children: T.map((e) => /* @__PURE__ */ Q(ei, {
2338
2367
  className: "h-8 border-border/60 bg-background/80 px-3 text-xs font-medium text-foreground/90 shadow-none hover:bg-muted/60",
2339
2368
  suggestion: e,
2340
- onClick: ze
2369
+ onClick: He
2341
2370
  }, e))
2342
2371
  }) : null
2343
2372
  ]
2344
2373
  }) : n.map((e) => {
2345
- let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !!e.streaming && !e.content && n.length === 0 && !r && !a, c = !t && H === "summary" ? n.filter((e) => !Oi(e)) : [], l = !t && H === "debug" ? n : !t && H !== "debug" ? n.filter(Oi) : [];
2346
- return /* @__PURE__ */ Q(zn, {
2347
- from: Ti(e.role),
2374
+ let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !!e.streaming && !e.content && n.length === 0 && !r && !a, c = !t && H === "summary" ? n.filter((e) => !ki(e)) : [], l = !t && H === "debug" ? n : !t && H !== "debug" ? n.filter(ki) : [];
2375
+ return /* @__PURE__ */ Q(Bn, {
2376
+ from: Ei(e.role),
2348
2377
  children: /* @__PURE__ */ $("div", {
2349
- className: J("flex w-full gap-2.5", p ? t ? "flex-row-reverse items-start" : "flex-row items-start" : "flex-col"),
2350
- children: [p ? /* @__PURE__ */ Q(Ni, {
2378
+ className: J("flex w-full gap-2.5", m ? t ? "flex-row-reverse items-start" : "flex-row items-start" : "flex-col"),
2379
+ children: [m ? /* @__PURE__ */ Q(Pi, {
2351
2380
  isUser: t,
2352
- url: t ? m : g,
2353
- fallback: t ? h : _
2381
+ url: t ? h : _,
2382
+ fallback: t ? g : v
2354
2383
  }) : null, /* @__PURE__ */ $("div", {
2355
- className: J("flex min-w-0 flex-col gap-2", p && !t && "flex-1"),
2356
- children: [/* @__PURE__ */ $(Bn, { children: [
2357
- a ? /* @__PURE__ */ Q(Hi, {
2384
+ className: J("flex min-w-0 flex-col gap-2", m && !t && "flex-1"),
2385
+ children: [/* @__PURE__ */ $(Vn, { children: [
2386
+ a ? /* @__PURE__ */ Q(Gi, {
2358
2387
  progress: a,
2359
- onOpenBuiltApp: re,
2360
- openBuiltAppLabel: ie,
2361
- onPreviewDraftApp: ae,
2362
- previewDraftLabel: L,
2363
- waitingLabel: q.connectionWaiting
2388
+ onOpenBuiltApp: ie,
2389
+ openBuiltAppLabel: ae,
2390
+ onPreviewDraftApp: L,
2391
+ previewDraftLabel: oe,
2392
+ waitingLabel: q.connectionWaiting,
2393
+ stalledLabel: q.connectionStalledLabel,
2394
+ offlineLabel: q.connectionOfflineLabel
2364
2395
  }) : null,
2365
- !t && H === "debug" && r ? /* @__PURE__ */ $(gi, {
2396
+ !t && H === "debug" && r ? /* @__PURE__ */ $(_i, {
2366
2397
  isStreaming: !!e.streaming && !e.content,
2367
2398
  className: "mb-2",
2368
- children: [/* @__PURE__ */ Q(vi, {}), /* @__PURE__ */ Q(yi, { children: r })]
2399
+ children: [/* @__PURE__ */ Q(yi, {}), /* @__PURE__ */ Q(bi, { children: r })]
2369
2400
  }) : null,
2370
- !t && H === "summary" && c.length > 0 ? /* @__PURE__ */ Q(Ui, {
2371
- groups: Ai(c),
2401
+ !t && H === "summary" && c.length > 0 ? /* @__PURE__ */ Q(Ki, {
2402
+ groups: ji(c),
2372
2403
  labels: q
2373
2404
  }) : null,
2374
- !t && l.length > 0 ? l.map(Ke) : null,
2405
+ !t && l.length > 0 ? l.map($e) : null,
2375
2406
  t ? e.content ? /* @__PURE__ */ Q("div", {
2376
2407
  className: "whitespace-pre-wrap break-words",
2377
2408
  children: e.content
2378
- }) : null : o ? /* @__PURE__ */ Q(Fi, {}) : e.content ? /* @__PURE__ */ Q(Zn, { children: e.content }) : null,
2409
+ }) : null : o ? /* @__PURE__ */ Q(Ii, {}) : e.content ? /* @__PURE__ */ Q(Qn, { children: e.content }) : null,
2379
2410
  e.streaming && !o ? /* @__PURE__ */ Q("span", {
2380
2411
  "aria-hidden": !0,
2381
2412
  className: "ml-0.5 inline-block w-[2px] h-4 align-middle bg-current animate-pulse"
@@ -2390,7 +2421,7 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2390
2421
  children: [e.title ? /* @__PURE__ */ Q("div", {
2391
2422
  className: "mb-2 text-sm font-medium text-foreground",
2392
2423
  children: e.title
2393
- }) : null, /* @__PURE__ */ Q(xt, { schema: {
2424
+ }) : null, /* @__PURE__ */ Q(St, { schema: {
2394
2425
  type: "chart",
2395
2426
  chartType: e.chartType ?? "bar",
2396
2427
  data: e.data,
@@ -2399,24 +2430,24 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2399
2430
  } })]
2400
2431
  }, t))
2401
2432
  }) : null,
2402
- !t && i.length > 0 ? /* @__PURE__ */ $(bi, { children: [/* @__PURE__ */ Q(xi, { count: i.length }), /* @__PURE__ */ Q(Si, { children: i.map((e, t) => /* @__PURE__ */ Q(Ci, {
2433
+ !t && i.length > 0 ? /* @__PURE__ */ $(xi, { children: [/* @__PURE__ */ Q(Si, { count: i.length }), /* @__PURE__ */ Q(Ci, { children: i.map((e, t) => /* @__PURE__ */ Q(wi, {
2403
2434
  href: e.url,
2404
2435
  title: e.title ?? e.url
2405
2436
  }, e.id ?? e.url ?? t)) })] }) : null,
2406
- f && e.timestamp ? /* @__PURE__ */ Q("div", {
2437
+ p && e.timestamp ? /* @__PURE__ */ Q("div", {
2407
2438
  className: "text-[10px] opacity-70 mt-1",
2408
2439
  children: e.timestamp
2409
2440
  }) : null
2410
- ] }), !t && !o ? /* @__PURE__ */ $(Vn, {
2441
+ ] }), !t && !o ? /* @__PURE__ */ $(Hn, {
2411
2442
  className: "opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
2412
2443
  children: [
2413
- /* @__PURE__ */ Q(Hn, {
2414
- label: K === e.id ? q.copied : q.copy,
2415
- tooltip: K === e.id ? q.copied : q.copy,
2416
- onClick: () => We(e),
2417
- children: K === e.id ? /* @__PURE__ */ Q(Pe, { className: "size-3.5" }) : /* @__PURE__ */ Q(Ge, { className: "size-3.5" })
2444
+ /* @__PURE__ */ Q(Un, {
2445
+ label: Se === e.id ? q.copied : q.copy,
2446
+ tooltip: Se === e.id ? q.copied : q.copy,
2447
+ onClick: () => Je(e),
2448
+ children: Se === e.id ? /* @__PURE__ */ Q(Pe, { className: "size-3.5" }) : /* @__PURE__ */ Q(Ge, { className: "size-3.5" })
2418
2449
  }),
2419
- s ? /* @__PURE__ */ Q(Hn, {
2450
+ s ? /* @__PURE__ */ Q(Un, {
2420
2451
  label: q.regenerate,
2421
2452
  tooltip: q.regenerate,
2422
2453
  onClick: s,
@@ -2434,48 +2465,50 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2434
2465
  })]
2435
2466
  })
2436
2467
  }, e.id);
2437
- }), u && !n.some((e) => e.streaming) ? /* @__PURE__ */ Q(Pi, {
2438
- showAvatar: p,
2439
- assistantAvatarUrl: g,
2440
- assistantAvatarFallback: _,
2441
- waitingLabel: q.connectionWaiting
2468
+ }), d && !n.some((e) => e.streaming) ? /* @__PURE__ */ Q(Fi, {
2469
+ showAvatar: m,
2470
+ assistantAvatarUrl: _,
2471
+ assistantAvatarFallback: v,
2472
+ waitingLabel: q.connectionWaiting,
2473
+ stalledLabel: q.connectionStalledLabel,
2474
+ offlineLabel: q.connectionOfflineLabel
2442
2475
  }) : null]
2443
- }), /* @__PURE__ */ Q(Fn, {})]
2476
+ }), /* @__PURE__ */ Q(In, {})]
2444
2477
  }),
2445
- d ? /* @__PURE__ */ Q(Ki, {
2446
- error: d,
2478
+ f ? /* @__PURE__ */ Q(Yi, {
2479
+ error: f,
2447
2480
  onReload: s,
2448
2481
  onUpgrade: c
2449
2482
  }) : null,
2450
- /* @__PURE__ */ $("div", {
2451
- ref: Be,
2452
- className: J("relative", G && "mx-auto w-full max-w-2xl px-4 pb-4 sm:px-0"),
2453
- children: [A ? /* @__PURE__ */ Q("div", {
2483
+ u ? null : /* @__PURE__ */ $("div", {
2484
+ ref: Ue,
2485
+ className: J("relative", K && "mx-auto w-full max-w-2xl px-4 pb-4 sm:px-0"),
2486
+ children: [j ? /* @__PURE__ */ Q("div", {
2454
2487
  className: "absolute bottom-full left-0 right-0 z-10 px-3 pb-1",
2455
- children: A
2456
- }) : null, /* @__PURE__ */ $(yr, {
2457
- accept: S,
2488
+ children: j
2489
+ }) : null, /* @__PURE__ */ $(br, {
2490
+ accept: C,
2458
2491
  fileInputLabel: q.uploadFiles,
2459
- maxFileSize: C,
2460
- onSubmit: Re,
2492
+ maxFileSize: w,
2493
+ onSubmit: Be,
2461
2494
  onError: (e) => {
2462
2495
  console.warn("[plugin-chatbot] prompt-input error", e);
2463
2496
  },
2464
2497
  children: [
2465
- x ? /* @__PURE__ */ Q(br, { children: /* @__PURE__ */ Q(_r, { children: (e) => /* @__PURE__ */ Q(gr, { data: e }) }) }) : null,
2466
- /* @__PURE__ */ Q(xr, {
2498
+ S ? /* @__PURE__ */ Q(xr, { children: /* @__PURE__ */ Q(vr, { children: (e) => /* @__PURE__ */ Q(_r, { data: e }) }) }) : null,
2499
+ /* @__PURE__ */ Q(Sr, {
2467
2500
  placeholder: r,
2468
- disabled: l || W === "streaming",
2469
- onChange: j ? (e) => j(e.currentTarget.value) : void 0
2501
+ disabled: l || G === "streaming",
2502
+ onChange: M ? (e) => M(e.currentTarget.value) : void 0
2470
2503
  }),
2471
- /* @__PURE__ */ $(Cr, { children: [/* @__PURE__ */ $(wr, { children: [
2472
- x ? /* @__PURE__ */ $(Er, { children: [/* @__PURE__ */ Q(Dr, {}), /* @__PURE__ */ Q(Or, { children: /* @__PURE__ */ Q(vr, {}) })] }) : null,
2473
- E && E.length > 0 ? /* @__PURE__ */ Q("select", {
2504
+ /* @__PURE__ */ $(wr, { children: [/* @__PURE__ */ $(Tr, { children: [
2505
+ S ? /* @__PURE__ */ $(Dr, { children: [/* @__PURE__ */ Q(Or, {}), /* @__PURE__ */ Q(kr, { children: /* @__PURE__ */ Q(yr, {}) })] }) : null,
2506
+ D && D.length > 0 ? /* @__PURE__ */ Q("select", {
2474
2507
  "aria-label": q.model,
2475
- value: D ?? E[0].id,
2476
- onChange: (e) => O?.(e.target.value),
2508
+ value: O ?? D[0].id,
2509
+ onChange: (e) => k?.(e.target.value),
2477
2510
  className: "h-7 rounded-md border bg-background px-2 text-xs text-muted-foreground hover:text-foreground focus:outline-none focus:ring-1 focus:ring-ring",
2478
- children: E.map((e) => /* @__PURE__ */ $("option", {
2511
+ children: D.map((e) => /* @__PURE__ */ $("option", {
2479
2512
  value: e.id,
2480
2513
  children: [e.label ?? e.id, e.provider ? ` · ${e.provider}` : ""]
2481
2514
  }, e.id))
@@ -2495,12 +2528,12 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2495
2528
  })
2496
2529
  ]
2497
2530
  })
2498
- ] }), /* @__PURE__ */ Q(Ar, {
2499
- "aria-label": W === "streaming" ? q.stopResponse : q.submit,
2500
- status: W,
2531
+ ] }), /* @__PURE__ */ Q(jr, {
2532
+ "aria-label": G === "streaming" ? q.stopResponse : q.submit,
2533
+ status: G,
2501
2534
  disabled: l,
2502
- onClick: W === "streaming" ? o : void 0,
2503
- type: W === "streaming" ? "button" : "submit"
2535
+ onClick: G === "streaming" ? o : void 0,
2536
+ type: G === "streaming" ? "button" : "submit"
2504
2537
  })] })
2505
2538
  ]
2506
2539
  })]
@@ -2508,8 +2541,8 @@ var Mi = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
2508
2541
  ]
2509
2542
  });
2510
2543
  });
2511
- Mi.displayName = "ChatbotEnhanced";
2512
- function Ni({ isUser: e, url: t, fallback: n }) {
2544
+ Ni.displayName = "ChatbotEnhanced";
2545
+ function Pi({ isUser: e, url: t, fallback: n }) {
2513
2546
  return /* @__PURE__ */ Q("div", {
2514
2547
  className: J("mt-0.5 flex size-7 shrink-0 items-center justify-center overflow-hidden rounded-full text-[11px] font-medium", e ? "bg-secondary text-secondary-foreground" : "bg-primary/10 text-primary"),
2515
2548
  "aria-hidden": "true",
@@ -2520,32 +2553,34 @@ function Ni({ isUser: e, url: t, fallback: n }) {
2520
2553
  }) : e ? n?.trim()?.charAt(0)?.toUpperCase() || "U" : /* @__PURE__ */ Q(Me, { className: "size-4" })
2521
2554
  });
2522
2555
  }
2523
- function Pi({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n, waitingLabel: r }) {
2524
- return /* @__PURE__ */ Q(zn, {
2556
+ function Fi({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n, waitingLabel: r, stalledLabel: i, offlineLabel: a }) {
2557
+ return /* @__PURE__ */ Q(Bn, {
2525
2558
  from: "assistant",
2526
2559
  "aria-live": "polite",
2527
2560
  children: /* @__PURE__ */ $("div", {
2528
2561
  className: J("flex w-full gap-2.5", e ? "flex-row items-start" : "flex-col"),
2529
- children: [e ? /* @__PURE__ */ Q(Ni, {
2562
+ children: [e ? /* @__PURE__ */ Q(Pi, {
2530
2563
  isUser: !1,
2531
2564
  url: t,
2532
2565
  fallback: n
2533
- }) : null, /* @__PURE__ */ Q(Bn, {
2566
+ }) : null, /* @__PURE__ */ Q(Vn, {
2534
2567
  className: "rounded-lg border bg-muted/30 px-3 py-2 text-muted-foreground",
2535
2568
  children: /* @__PURE__ */ $("span", {
2536
2569
  className: "inline-flex items-center gap-2",
2537
- children: [/* @__PURE__ */ Q(Fi, {}), /* @__PURE__ */ Q(zi, {
2570
+ children: [/* @__PURE__ */ Q(Ii, {}), /* @__PURE__ */ Q(Vi, {
2538
2571
  active: !0,
2539
2572
  pending: !0,
2540
2573
  activityKey: 0,
2541
- waitingLabel: r
2574
+ waitingLabel: r,
2575
+ stalledLabel: i,
2576
+ offlineLabel: a
2542
2577
  })]
2543
2578
  })
2544
2579
  })]
2545
2580
  })
2546
2581
  });
2547
2582
  }
2548
- function Fi() {
2583
+ function Ii() {
2549
2584
  return /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("span", {
2550
2585
  className: "sr-only",
2551
2586
  children: "Assistant is responding"
@@ -2559,12 +2594,12 @@ function Fi() {
2559
2594
  ]
2560
2595
  })] });
2561
2596
  }
2562
- function Ii(e) {
2597
+ function Li(e) {
2563
2598
  let t = Math.floor(e / 60), n = e % 60;
2564
2599
  return `${t}:${String(n).padStart(2, "0")}`;
2565
2600
  }
2566
- var Li = 6;
2567
- function Ri(t, n) {
2601
+ var Ri = 6;
2602
+ function zi(t, n) {
2568
2603
  let r = e.useRef(0), i = e.useRef(0), [a, o] = e.useState({
2569
2604
  elapsed: 0,
2570
2605
  quiet: 0
@@ -2593,49 +2628,82 @@ function Ri(t, n) {
2593
2628
  }, [t]), {
2594
2629
  elapsedSeconds: a.elapsed,
2595
2630
  quietSeconds: a.quiet,
2596
- live: a.quiet < Li
2631
+ live: a.quiet < Ri
2597
2632
  };
2598
2633
  }
2599
- function zi({ active: e, activityKey: t, pending: n = !1, waitingLabel: r }) {
2600
- let { elapsedSeconds: i, quietSeconds: a, live: o } = Ri(e, t), s = o ? n ? "waiting" : "receiving" : "stalled";
2634
+ function Bi() {
2635
+ let [t, n] = e.useState(() => typeof navigator < "u" && navigator.onLine === !1);
2636
+ return e.useEffect(() => {
2637
+ if (typeof window > "u") return;
2638
+ let e = () => n(!1), t = () => n(!0);
2639
+ return window.addEventListener("online", e), window.addEventListener("offline", t), () => {
2640
+ window.removeEventListener("online", e), window.removeEventListener("offline", t);
2641
+ };
2642
+ }, []), t;
2643
+ }
2644
+ function Vi({ active: e, activityKey: t, pending: n = !1, waitingLabel: r, stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
2645
+ let { elapsedSeconds: o, quietSeconds: s, live: c } = zi(e, t), l = Bi() ? "offline" : c ? n ? "waiting" : "receiving" : "stalled", u = Li(o);
2601
2646
  return /* @__PURE__ */ $("span", {
2602
- className: J("inline-flex items-center gap-1.5 text-xs font-normal tabular-nums", s === "stalled" ? "text-amber-600" : "text-muted-foreground"),
2647
+ className: J("inline-flex items-center gap-1.5 text-xs tabular-nums", l === "offline" ? "text-red-600 font-medium" : l === "stalled" ? "text-amber-600 font-medium" : "font-normal text-muted-foreground"),
2603
2648
  "aria-live": "polite",
2604
- title: s === "receiving" ? `Receiving from server · ${Ii(i)} elapsed` : s === "waiting" ? `${r} · ${Ii(i)} elapsed` : `${r} (${a}s with no response)`,
2605
- children: [/* @__PURE__ */ Q("span", {
2606
- "aria-hidden": !0,
2607
- className: J("size-1.5 shrink-0 rounded-full", s === "receiving" ? "bg-emerald-500 animate-pulse" : s === "waiting" ? "bg-muted-foreground/50 animate-pulse" : "bg-amber-500")
2608
- }), s === "receiving" ? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q(Ue, {
2609
- className: "size-3 shrink-0",
2610
- "aria-hidden": !0
2611
- }), Ii(i)] }) : s === "waiting" ? /* @__PURE__ */ Q("span", { children: r }) : /* @__PURE__ */ $("span", { children: [
2612
- r,
2613
- " ",
2614
- a,
2615
- "s"
2616
- ] })]
2649
+ "data-liveness-tier": l,
2650
+ title: l === "offline" ? `${a} · ${u} elapsed` : l === "receiving" ? `Receiving from server · ${u} elapsed` : l === "stalled" ? `${i} (${s}s with no response) · ${u} elapsed` : `${r} · ${u} elapsed`,
2651
+ children: [
2652
+ l === "offline" ? /* @__PURE__ */ Q(mt, {
2653
+ className: "size-3 shrink-0",
2654
+ "aria-hidden": !0
2655
+ }) : /* @__PURE__ */ Q("span", {
2656
+ "aria-hidden": !0,
2657
+ className: J("size-1.5 shrink-0 rounded-full", l === "receiving" ? "bg-emerald-500 animate-pulse" : l === "stalled" ? "bg-amber-500" : "bg-muted-foreground/50 animate-pulse")
2658
+ }),
2659
+ /* @__PURE__ */ Q(Ue, {
2660
+ className: "size-3 shrink-0",
2661
+ "aria-hidden": !0
2662
+ }),
2663
+ /* @__PURE__ */ Q("span", { children: u }),
2664
+ l === "receiving" ? null : /* @__PURE__ */ $("span", { children: ["· ", l === "offline" ? a : l === "stalled" ? i : r] })
2665
+ ]
2617
2666
  });
2618
2667
  }
2619
- var Bi = [
2668
+ function Hi({ offlineLabel: t }) {
2669
+ let [n, r] = e.useState(0), i = Bi();
2670
+ return e.useEffect(() => {
2671
+ let e = Date.now(), t = setInterval(() => r(Math.floor((Date.now() - e) / 1e3)), 1e3);
2672
+ return () => clearInterval(t);
2673
+ }, []), /* @__PURE__ */ $("span", {
2674
+ className: J("inline-flex items-center gap-1 text-xs tabular-nums", i ? "text-red-600 font-medium" : "text-muted-foreground"),
2675
+ "aria-live": "polite",
2676
+ "data-tool-running-timer": !0,
2677
+ children: [
2678
+ Q(i ? mt : Ue, {
2679
+ className: "size-3 shrink-0",
2680
+ "aria-hidden": !0
2681
+ }),
2682
+ /* @__PURE__ */ Q("span", { children: Li(n) }),
2683
+ i ? /* @__PURE__ */ $("span", { children: ["· ", t] }) : null
2684
+ ]
2685
+ });
2686
+ }
2687
+ var Ui = [
2620
2688
  "object",
2621
2689
  "view",
2622
2690
  "dashboard",
2623
2691
  "app",
2624
2692
  "seed"
2625
- ], Vi = {
2693
+ ], Wi = {
2626
2694
  object: "Objects",
2627
2695
  view: "Views",
2628
2696
  dashboard: "Dashboards",
2629
2697
  app: "App",
2630
2698
  seed: "Sample data"
2631
2699
  };
2632
- function Hi({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app", onPreviewDraftApp: r, previewDraftLabel: i = "Preview", waitingLabel: a = "Waiting for server…" }) {
2633
- let { phase: o, appLabel: s, items: c, done: l, total: u, seq: d } = e, f = o === "done", p = d ?? `${o}:${l}:${c.length}`, m = c.find((e) => e.type === "app"), h = u > 0 ? Math.min(100, Math.round(l / u * 100)) : f ? 100 : 6, g = /* @__PURE__ */ new Map();
2634
- for (let e of c) {
2635
- let t = g.get(e.type) ?? [];
2636
- t.push(e.name.replace(/_sample$/, "")), g.set(e.type, t);
2700
+ function Gi({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app", onPreviewDraftApp: r, previewDraftLabel: i = "Preview", waitingLabel: a = "Waiting for server…", stalledLabel: o = "Still working…", offlineLabel: s = "Connection lost — reconnecting…" }) {
2701
+ let { phase: c, appLabel: l, items: u, done: d, total: f, seq: p } = e, m = c === "done", h = p ?? `${c}:${d}:${u.length}`, g = u.find((e) => e.type === "app"), _ = f > 0 ? Math.min(100, Math.round(d / f * 100)) : m ? 100 : 6, v = /* @__PURE__ */ new Map();
2702
+ for (let e of u) {
2703
+ let t = v.get(e.type) ?? [];
2704
+ t.push(e.name.replace(/_sample$/, "")), v.set(e.type, t);
2637
2705
  }
2638
- let _ = [...Bi.filter((e) => g.has(e)), ...[...g.keys()].filter((e) => !Bi.includes(e))];
2706
+ let y = [...Ui.filter((e) => v.has(e)), ...[...v.keys()].filter((e) => !Ui.includes(e))];
2639
2707
  return /* @__PURE__ */ $("div", {
2640
2708
  className: "rounded-lg border bg-muted/30 p-3 text-sm",
2641
2709
  "data-testid": "build-progress",
@@ -2643,18 +2711,20 @@ function Hi({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
2643
2711
  /* @__PURE__ */ $("div", {
2644
2712
  className: "mb-2 flex items-center gap-2 font-medium",
2645
2713
  children: [
2646
- f ? /* @__PURE__ */ Q(Y, { className: "size-4 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(et, { className: "size-4 shrink-0 animate-spin text-primary" }),
2647
- /* @__PURE__ */ Q("span", { children: f ? `Built ${s ?? "your app"}` : `Building ${s ?? "your app"}…` }),
2648
- !f && o === "data" ? /* @__PURE__ */ Q("span", {
2714
+ m ? /* @__PURE__ */ Q(Y, { className: "size-4 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(et, { className: "size-4 shrink-0 animate-spin text-primary" }),
2715
+ /* @__PURE__ */ Q("span", { children: m ? `Built ${l ?? "your app"}` : `Building ${l ?? "your app"}…` }),
2716
+ !m && c === "data" ? /* @__PURE__ */ Q("span", {
2649
2717
  className: "text-xs font-normal text-muted-foreground",
2650
2718
  children: "adding sample data"
2651
2719
  }) : null,
2652
- f ? null : /* @__PURE__ */ Q("span", {
2720
+ m ? null : /* @__PURE__ */ Q("span", {
2653
2721
  className: "ml-auto",
2654
- children: /* @__PURE__ */ Q(zi, {
2722
+ children: /* @__PURE__ */ Q(Vi, {
2655
2723
  active: !0,
2656
- activityKey: p,
2657
- waitingLabel: a
2724
+ activityKey: h,
2725
+ waitingLabel: a,
2726
+ stalledLabel: o,
2727
+ offlineLabel: s
2658
2728
  })
2659
2729
  })
2660
2730
  ]
@@ -2662,14 +2732,14 @@ function Hi({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
2662
2732
  /* @__PURE__ */ Q("div", {
2663
2733
  className: "mb-2 h-1.5 w-full overflow-hidden rounded-full bg-muted",
2664
2734
  children: /* @__PURE__ */ Q("div", {
2665
- className: J("h-full rounded-full transition-all duration-500", f ? "bg-emerald-500" : "bg-primary"),
2666
- style: { width: `${h}%` }
2735
+ className: J("h-full rounded-full transition-all duration-500", m ? "bg-emerald-500" : "bg-primary"),
2736
+ style: { width: `${_}%` }
2667
2737
  })
2668
2738
  }),
2669
2739
  /* @__PURE__ */ Q("ul", {
2670
2740
  className: "space-y-1",
2671
- children: _.map((e) => {
2672
- let t = g.get(e);
2741
+ children: y.map((e) => {
2742
+ let t = v.get(e);
2673
2743
  return /* @__PURE__ */ $("li", {
2674
2744
  className: "flex items-start gap-2",
2675
2745
  children: [/* @__PURE__ */ Q(Y, { className: "mt-0.5 size-3.5 shrink-0 text-emerald-600" }), /* @__PURE__ */ $("span", {
@@ -2677,7 +2747,7 @@ function Hi({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
2677
2747
  children: [
2678
2748
  /* @__PURE__ */ Q("span", {
2679
2749
  className: "font-medium text-foreground",
2680
- children: Vi[e] ?? e
2750
+ children: Wi[e] ?? e
2681
2751
  }),
2682
2752
  " ",
2683
2753
  t.slice(0, 6).join(", "),
@@ -2687,17 +2757,17 @@ function Hi({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
2687
2757
  }, e);
2688
2758
  })
2689
2759
  }),
2690
- f && m && (t || r) ? /* @__PURE__ */ $("div", {
2760
+ m && g && (t || r) ? /* @__PURE__ */ $("div", {
2691
2761
  className: "mt-3 flex items-center gap-2",
2692
2762
  children: [t ? /* @__PURE__ */ $("button", {
2693
2763
  type: "button",
2694
- onClick: () => t(m.name),
2764
+ onClick: () => t(g.name),
2695
2765
  className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
2696
2766
  "data-testid": "build-progress-open-app",
2697
2767
  children: [n, /* @__PURE__ */ Q(Ae, { className: "size-3.5" })]
2698
2768
  }) : null, r ? /* @__PURE__ */ $("button", {
2699
2769
  type: "button",
2700
- onClick: () => r(m.name),
2770
+ onClick: () => r(g.name),
2701
2771
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted",
2702
2772
  "data-testid": "build-progress-preview-app",
2703
2773
  children: [/* @__PURE__ */ Q(Ye, { className: "size-3.5" }), i]
@@ -2706,7 +2776,7 @@ function Hi({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
2706
2776
  ]
2707
2777
  });
2708
2778
  }
2709
- function Ui({ groups: e, labels: t }) {
2779
+ function Ki({ groups: e, labels: t }) {
2710
2780
  return e.length === 0 ? null : /* @__PURE__ */ Q("div", {
2711
2781
  className: "not-prose mb-2 border-l border-border/70 pl-3",
2712
2782
  children: /* @__PURE__ */ Q("div", {
@@ -2716,7 +2786,7 @@ function Ui({ groups: e, labels: t }) {
2716
2786
  children: [/* @__PURE__ */ $("div", {
2717
2787
  className: "flex min-w-0 items-center gap-2",
2718
2788
  children: [
2719
- /* @__PURE__ */ Q(Wi, { state: e.state }),
2789
+ /* @__PURE__ */ Q(qi, { state: e.state }),
2720
2790
  /* @__PURE__ */ Q("span", {
2721
2791
  className: "truncate font-medium text-foreground",
2722
2792
  children: e.title
@@ -2726,18 +2796,18 @@ function Ui({ groups: e, labels: t }) {
2726
2796
  children: ["x", e.count]
2727
2797
  }) : null
2728
2798
  ]
2729
- }), /* @__PURE__ */ Q("span", {
2799
+ }), e.state === "running" ? /* @__PURE__ */ Q(Hi, { offlineLabel: t.connectionOfflineLabel }) : /* @__PURE__ */ Q("span", {
2730
2800
  className: J("shrink-0 text-[10px] font-medium", e.state === "failed" ? "text-destructive" : e.state === "completed" ? "text-emerald-700 dark:text-emerald-400" : "text-muted-foreground"),
2731
- children: Gi(e.state, t)
2801
+ children: Ji(e.state, t)
2732
2802
  })]
2733
2803
  }, e.key))
2734
2804
  })
2735
2805
  });
2736
2806
  }
2737
- function Wi({ state: e }) {
2807
+ function qi({ state: e }) {
2738
2808
  return e === "failed" ? /* @__PURE__ */ Q(X, { className: "size-3.5 shrink-0 text-destructive" }) : e === "completed" ? /* @__PURE__ */ Q(Y, { className: "size-3.5 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(Ue, { className: "size-3.5 shrink-0 text-muted-foreground" });
2739
2809
  }
2740
- function Gi(e, t) {
2810
+ function Ji(e, t) {
2741
2811
  switch (e) {
2742
2812
  case "failed": return t.toolFailed;
2743
2813
  case "awaiting": return t.toolAwaitingApproval;
@@ -2745,8 +2815,8 @@ function Gi(e, t) {
2745
2815
  case "completed": return t.toolCompleted;
2746
2816
  }
2747
2817
  }
2748
- function Ki({ error: t, onReload: n, onUpgrade: r }) {
2749
- let i = e.useMemo(() => jn(t), [t]), { summary: a, details: o } = e.useMemo(() => kn(t), [t]), [s, c] = e.useState(!1);
2818
+ function Yi({ error: t, onReload: n, onUpgrade: r }) {
2819
+ let i = e.useMemo(() => Mn(t), [t]), { summary: a, details: o } = e.useMemo(() => An(t), [t]), [s, c] = e.useState(!1);
2750
2820
  if (i) {
2751
2821
  let e = typeof navigator < "u" && !!navigator.language?.toLowerCase().startsWith("zh"), t = (e ? i.message : i.messageEn ?? i.message) || (e ? "AI 额度已用完。" : "You have reached your AI quota."), n = i.topUp ? e ? "购买额度包" : "Buy a credit pack" : e ? "升级方案" : "Upgrade plan";
2752
2822
  return /* @__PURE__ */ Q("div", {
@@ -2817,27 +2887,27 @@ function Ki({ error: t, onReload: n, onUpgrade: r }) {
2817
2887
  })
2818
2888
  });
2819
2889
  }
2820
- function qi({ output: e, errorText: t }) {
2821
- return t ? /* @__PURE__ */ Q(ui, {
2890
+ function Xi({ output: e, errorText: t }) {
2891
+ return t ? /* @__PURE__ */ Q(di, {
2822
2892
  output: void 0,
2823
2893
  errorText: t
2824
- }) : e == null || e === "" ? null : typeof e == "string" && !Ei(e) ? /* @__PURE__ */ $("div", {
2894
+ }) : e == null || e === "" ? null : typeof e == "string" && !Di(e) ? /* @__PURE__ */ $("div", {
2825
2895
  className: "space-y-2 p-4",
2826
2896
  children: [/* @__PURE__ */ Q("h4", {
2827
2897
  className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
2828
2898
  children: "Result"
2829
2899
  }), /* @__PURE__ */ Q("div", {
2830
2900
  className: "overflow-x-auto rounded-md bg-muted/40 px-3 py-2 text-sm text-foreground",
2831
- children: /* @__PURE__ */ Q(Zn, { children: e })
2901
+ children: /* @__PURE__ */ Q(Qn, { children: e })
2832
2902
  })]
2833
- }) : /* @__PURE__ */ Q(ui, {
2903
+ }) : /* @__PURE__ */ Q(di, {
2834
2904
  output: e,
2835
2905
  errorText: void 0
2836
2906
  });
2837
2907
  }
2838
2908
  //#endregion
2839
2909
  //#region src/FloatingChatbot.tsx
2840
- function Ji({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
2910
+ function Zi({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
2841
2911
  let { position: a = "bottom-right", defaultOpen: o = !1, panelWidth: s = 400, panelHeight: c = 520, title: l = "Chat", triggerSize: u = 56 } = t ?? {}, [d, f] = e.useState(null);
2842
2912
  e.useEffect(() => {
2843
2913
  let e = document.getElementById("floating-chatbot-portal");
@@ -2845,29 +2915,29 @@ function Ji({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
2845
2915
  e && e.parentNode && !e.hasChildNodes() && e.parentNode.removeChild(e);
2846
2916
  };
2847
2917
  }, []);
2848
- let p = /* @__PURE__ */ $(pn, {
2918
+ let p = /* @__PURE__ */ $(mn, {
2849
2919
  defaultOpen: o,
2850
- children: [/* @__PURE__ */ Q(yn, {
2920
+ children: [/* @__PURE__ */ Q(bn, {
2851
2921
  position: a,
2852
2922
  size: u
2853
- }), /* @__PURE__ */ Q(Tn, {
2923
+ }), /* @__PURE__ */ Q(En, {
2854
2924
  title: l,
2855
2925
  position: a,
2856
2926
  width: s,
2857
2927
  height: c,
2858
2928
  headerExtra: n,
2859
2929
  headerActions: r,
2860
- children: /* @__PURE__ */ Q(Mi, {
2930
+ children: /* @__PURE__ */ Q(Ni, {
2861
2931
  ...i,
2862
2932
  maxHeight: "100%",
2863
2933
  className: "h-full border-0 rounded-none"
2864
2934
  })
2865
2935
  })]
2866
2936
  });
2867
- return d ? bt.createPortal(p, d) : p;
2937
+ return d ? xt.createPortal(p, d) : p;
2868
2938
  }
2869
- Mt.register("chatbot", ({ schema: e, className: t, ...n }) => {
2870
- let { messages: r, isLoading: i, sendMessage: a } = $t({
2939
+ Nt.register("chatbot", ({ schema: e, className: t, ...n }) => {
2940
+ let { messages: r, isLoading: i, sendMessage: a } = en({
2871
2941
  api: e.api,
2872
2942
  initialMessages: e.messages,
2873
2943
  conversationId: e.conversationId,
@@ -2884,7 +2954,7 @@ Mt.register("chatbot", ({ schema: e, className: t, ...n }) => {
2884
2954
  autoResponseDelay: e.autoResponseDelay,
2885
2955
  onSend: e.onSend
2886
2956
  });
2887
- return /* @__PURE__ */ Q(ha, {
2957
+ return /* @__PURE__ */ Q(va, {
2888
2958
  messages: r,
2889
2959
  placeholder: e.placeholder,
2890
2960
  onSendMessage: (e) => {
@@ -3032,8 +3102,8 @@ Mt.register("chatbot", ({ schema: e, className: t, ...n }) => {
3032
3102
  autoResponseDelay: 1e3,
3033
3103
  className: "w-full max-w-2xl"
3034
3104
  }
3035
- }), Mt.register("chatbot-enhanced", ({ schema: e, className: t, ...n }) => {
3036
- let { messages: r, isLoading: i, error: a, sendMessage: o, stop: s, reload: c, clear: l, isApiMode: u } = $t({
3105
+ }), Nt.register("chatbot-enhanced", ({ schema: e, className: t, ...n }) => {
3106
+ let { messages: r, isLoading: i, error: a, sendMessage: o, stop: s, reload: c, clear: l, isApiMode: u } = en({
3037
3107
  api: e.api,
3038
3108
  initialMessages: e.messages,
3039
3109
  conversationId: e.conversationId,
@@ -3050,7 +3120,7 @@ Mt.register("chatbot", ({ schema: e, className: t, ...n }) => {
3050
3120
  autoResponseDelay: e.autoResponseDelay,
3051
3121
  onSend: e.onSend
3052
3122
  });
3053
- return /* @__PURE__ */ Q(Mi, {
3123
+ return /* @__PURE__ */ Q(Ni, {
3054
3124
  messages: r,
3055
3125
  placeholder: e.placeholder,
3056
3126
  onSendMessage: (e, t) => {
@@ -3219,8 +3289,8 @@ Mt.register("chatbot", ({ schema: e, className: t, ...n }) => {
3219
3289
  autoResponseDelay: 1e3,
3220
3290
  className: "w-full max-w-2xl"
3221
3291
  }
3222
- }), Mt.register("chatbot-floating", ({ schema: e, className: t, ...n }) => {
3223
- let { messages: r, isLoading: i, error: a, sendMessage: o, stop: s, reload: c, clear: l, isApiMode: u } = $t({
3292
+ }), Nt.register("chatbot-floating", ({ schema: e, className: t, ...n }) => {
3293
+ let { messages: r, isLoading: i, error: a, sendMessage: o, stop: s, reload: c, clear: l, isApiMode: u } = en({
3224
3294
  api: e.api,
3225
3295
  initialMessages: e.messages,
3226
3296
  conversationId: e.conversationId,
@@ -3237,7 +3307,7 @@ Mt.register("chatbot", ({ schema: e, className: t, ...n }) => {
3237
3307
  autoResponseDelay: e.autoResponseDelay,
3238
3308
  onSend: e.onSend
3239
3309
  });
3240
- return /* @__PURE__ */ Q(Ji, {
3310
+ return /* @__PURE__ */ Q(Zi, {
3241
3311
  floatingConfig: e.floatingConfig,
3242
3312
  messages: r,
3243
3313
  placeholder: e.placeholder,
@@ -3409,7 +3479,7 @@ Mt.register("chatbot", ({ schema: e, className: t, ...n }) => {
3409
3479
  });
3410
3480
  //#endregion
3411
3481
  //#region src/elements/loader.tsx
3412
- var Yi = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
3482
+ var Qi = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
3413
3483
  height: e,
3414
3484
  strokeLinejoin: "round",
3415
3485
  style: { color: "currentcolor" },
@@ -3490,97 +3560,97 @@ var Yi = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
3490
3560
  })
3491
3561
  }) })
3492
3562
  ]
3493
- }), Xi = ({ className: e, size: t = 16, ...n }) => /* @__PURE__ */ Q("div", {
3563
+ }), $i = ({ className: e, size: t = 16, ...n }) => /* @__PURE__ */ Q("div", {
3494
3564
  className: J("inline-flex animate-spin items-center justify-center", e),
3495
3565
  ...n,
3496
- children: /* @__PURE__ */ Q(Yi, { size: t })
3497
- }), Zi = /* @__PURE__ */ Pt({
3498
- CodeBlock: () => ri,
3499
- CodeBlockCopyButton: () => ii,
3500
- Conversation: () => Mn,
3501
- ConversationContent: () => Nn,
3502
- ConversationEmptyState: () => Pn,
3503
- ConversationScrollButton: () => Fn,
3504
- Loader: () => Xi,
3505
- Message: () => zn,
3506
- MessageAction: () => Hn,
3507
- MessageActions: () => Vn,
3508
- MessageAttachment: () => Qn,
3509
- MessageAttachments: () => $n,
3510
- MessageBranch: () => Gn,
3511
- MessageBranchContent: () => Kn,
3512
- MessageBranchNext: () => Yn,
3513
- MessageBranchPage: () => Xn,
3514
- MessageBranchPrevious: () => Jn,
3515
- MessageBranchSelector: () => qn,
3516
- MessageContent: () => Bn,
3517
- MessageResponse: () => Zn,
3518
- MessageToolbar: () => er,
3519
- PromptInput: () => yr,
3520
- PromptInputActionAddAttachments: () => vr,
3521
- PromptInputActionMenu: () => Er,
3522
- PromptInputActionMenuContent: () => Or,
3523
- PromptInputActionMenuItem: () => kr,
3524
- PromptInputActionMenuTrigger: () => Dr,
3525
- PromptInputAttachment: () => gr,
3526
- PromptInputAttachments: () => _r,
3527
- PromptInputBody: () => br,
3528
- PromptInputButton: () => Tr,
3529
- PromptInputCommand: () => Gr,
3530
- PromptInputCommandEmpty: () => Jr,
3531
- PromptInputCommandGroup: () => Yr,
3532
- PromptInputCommandInput: () => Kr,
3533
- PromptInputCommandItem: () => Xr,
3534
- PromptInputCommandList: () => qr,
3535
- PromptInputCommandSeparator: () => Zr,
3536
- PromptInputFooter: () => Cr,
3537
- PromptInputHeader: () => Sr,
3538
- PromptInputHoverCard: () => Lr,
3539
- PromptInputHoverCardContent: () => zr,
3540
- PromptInputHoverCardTrigger: () => Rr,
3541
- PromptInputProvider: () => pr,
3542
- PromptInputSelect: () => Mr,
3543
- PromptInputSelectContent: () => Pr,
3544
- PromptInputSelectItem: () => Fr,
3545
- PromptInputSelectTrigger: () => Nr,
3546
- PromptInputSelectValue: () => Ir,
3547
- PromptInputSpeechButton: () => jr,
3548
- PromptInputSubmit: () => Ar,
3549
- PromptInputTab: () => Vr,
3550
- PromptInputTabBody: () => Ur,
3551
- PromptInputTabItem: () => Wr,
3552
- PromptInputTabLabel: () => Hr,
3553
- PromptInputTabsList: () => Br,
3554
- PromptInputTextarea: () => xr,
3555
- PromptInputTools: () => wr,
3556
- Reasoning: () => gi,
3557
- ReasoningContent: () => yi,
3558
- ReasoningTrigger: () => vi,
3559
- Shimmer: () => di,
3560
- Source: () => Ci,
3561
- Sources: () => bi,
3562
- SourcesContent: () => Si,
3563
- SourcesTrigger: () => xi,
3564
- Suggestion: () => $r,
3565
- Suggestions: () => Qr,
3566
- Tool: () => ai,
3567
- ToolContent: () => ci,
3568
- ToolHeader: () => si,
3569
- ToolInput: () => li,
3570
- ToolOutput: () => ui,
3571
- highlightCode: () => ni,
3572
- usePromptInputAttachments: () => hr,
3573
- usePromptInputController: () => lr,
3574
- useProviderAttachments: () => dr,
3575
- useReasoning: () => pi
3576
- }), Qi = "/api/v1/ai";
3577
- function $i(e, t, n) {
3566
+ children: /* @__PURE__ */ Q(Qi, { size: t })
3567
+ }), ea = /* @__PURE__ */ Ft({
3568
+ CodeBlock: () => ii,
3569
+ CodeBlockCopyButton: () => ai,
3570
+ Conversation: () => Nn,
3571
+ ConversationContent: () => Pn,
3572
+ ConversationEmptyState: () => Fn,
3573
+ ConversationScrollButton: () => In,
3574
+ Loader: () => $i,
3575
+ Message: () => Bn,
3576
+ MessageAction: () => Un,
3577
+ MessageActions: () => Hn,
3578
+ MessageAttachment: () => $n,
3579
+ MessageAttachments: () => er,
3580
+ MessageBranch: () => Kn,
3581
+ MessageBranchContent: () => qn,
3582
+ MessageBranchNext: () => Xn,
3583
+ MessageBranchPage: () => Zn,
3584
+ MessageBranchPrevious: () => Yn,
3585
+ MessageBranchSelector: () => Jn,
3586
+ MessageContent: () => Vn,
3587
+ MessageResponse: () => Qn,
3588
+ MessageToolbar: () => tr,
3589
+ PromptInput: () => br,
3590
+ PromptInputActionAddAttachments: () => yr,
3591
+ PromptInputActionMenu: () => Dr,
3592
+ PromptInputActionMenuContent: () => kr,
3593
+ PromptInputActionMenuItem: () => Ar,
3594
+ PromptInputActionMenuTrigger: () => Or,
3595
+ PromptInputAttachment: () => _r,
3596
+ PromptInputAttachments: () => vr,
3597
+ PromptInputBody: () => xr,
3598
+ PromptInputButton: () => Er,
3599
+ PromptInputCommand: () => Kr,
3600
+ PromptInputCommandEmpty: () => Yr,
3601
+ PromptInputCommandGroup: () => Xr,
3602
+ PromptInputCommandInput: () => qr,
3603
+ PromptInputCommandItem: () => Zr,
3604
+ PromptInputCommandList: () => Jr,
3605
+ PromptInputCommandSeparator: () => Qr,
3606
+ PromptInputFooter: () => wr,
3607
+ PromptInputHeader: () => Cr,
3608
+ PromptInputHoverCard: () => Rr,
3609
+ PromptInputHoverCardContent: () => Br,
3610
+ PromptInputHoverCardTrigger: () => zr,
3611
+ PromptInputProvider: () => mr,
3612
+ PromptInputSelect: () => Nr,
3613
+ PromptInputSelectContent: () => Fr,
3614
+ PromptInputSelectItem: () => Ir,
3615
+ PromptInputSelectTrigger: () => Pr,
3616
+ PromptInputSelectValue: () => Lr,
3617
+ PromptInputSpeechButton: () => Mr,
3618
+ PromptInputSubmit: () => jr,
3619
+ PromptInputTab: () => Hr,
3620
+ PromptInputTabBody: () => Wr,
3621
+ PromptInputTabItem: () => Gr,
3622
+ PromptInputTabLabel: () => Ur,
3623
+ PromptInputTabsList: () => Vr,
3624
+ PromptInputTextarea: () => Sr,
3625
+ PromptInputTools: () => Tr,
3626
+ Reasoning: () => _i,
3627
+ ReasoningContent: () => bi,
3628
+ ReasoningTrigger: () => yi,
3629
+ Shimmer: () => fi,
3630
+ Source: () => wi,
3631
+ Sources: () => xi,
3632
+ SourcesContent: () => Ci,
3633
+ SourcesTrigger: () => Si,
3634
+ Suggestion: () => ei,
3635
+ Suggestions: () => $r,
3636
+ Tool: () => oi,
3637
+ ToolContent: () => li,
3638
+ ToolHeader: () => ci,
3639
+ ToolInput: () => ui,
3640
+ ToolOutput: () => di,
3641
+ highlightCode: () => ri,
3642
+ usePromptInputAttachments: () => gr,
3643
+ usePromptInputController: () => ur,
3644
+ useProviderAttachments: () => fr,
3645
+ useReasoning: () => mi
3646
+ }), ta = "/api/v1/ai";
3647
+ function na(e, t, n) {
3578
3648
  let r = e.replace(/\/$/, ""), i = new URLSearchParams();
3579
3649
  if (n) for (let [e, t] of Object.entries(n)) t == null || t === "" || i.set(e, String(t));
3580
3650
  let a = i.toString();
3581
3651
  return `${r}${t}${a ? `?${a}` : ""}`;
3582
3652
  }
3583
- async function ea(e, t, n) {
3653
+ async function ra(e, t, n) {
3584
3654
  let r = await fetch(e, {
3585
3655
  credentials: "include",
3586
3656
  ...t,
@@ -3600,8 +3670,8 @@ async function ea(e, t, n) {
3600
3670
  }
3601
3671
  return i;
3602
3672
  }
3603
- function ta(t = {}) {
3604
- let { apiBase: n = Qi, status: r = "pending", conversationId: i, limit: a, headers: o, pollInterval: s = 5e3, enabled: c = !0 } = t, [l, u] = e.useState([]), [d, f] = e.useState(0), [p, m] = e.useState(!1), [h, g] = e.useState(void 0), _ = e.useRef({
3673
+ function ia(t = {}) {
3674
+ let { apiBase: n = ta, status: r = "pending", conversationId: i, limit: a, headers: o, pollInterval: s = 5e3, enabled: c = !0 } = t, [l, u] = e.useState([]), [d, f] = e.useState(0), [p, m] = e.useState(!1), [h, g] = e.useState(void 0), _ = e.useRef({
3605
3675
  apiBase: n,
3606
3676
  status: r,
3607
3677
  conversationId: i,
@@ -3619,7 +3689,7 @@ function ta(t = {}) {
3619
3689
  let { apiBase: e, status: t, conversationId: n, limit: r, headers: i } = _.current;
3620
3690
  m(!0), g(void 0);
3621
3691
  try {
3622
- let a = await ea($i(e, "/pending-actions", {
3692
+ let a = await ra(na(e, "/pending-actions", {
3623
3693
  status: t && t !== "all" ? t : void 0,
3624
3694
  conversationId: n,
3625
3695
  limit: r
@@ -3631,9 +3701,9 @@ function ta(t = {}) {
3631
3701
  m(!1);
3632
3702
  }
3633
3703
  }, []), y = e.useCallback(async (e) => {
3634
- let { apiBase: t, headers: n } = _.current, r = $i(t, `/pending-actions/${encodeURIComponent(e)}/approve`);
3704
+ let { apiBase: t, headers: n } = _.current, r = na(t, `/pending-actions/${encodeURIComponent(e)}/approve`);
3635
3705
  try {
3636
- return await ea(r, {
3706
+ return await ra(r, {
3637
3707
  method: "POST",
3638
3708
  body: "{}"
3639
3709
  }, n);
@@ -3641,9 +3711,9 @@ function ta(t = {}) {
3641
3711
  v();
3642
3712
  }
3643
3713
  }, [v]), b = e.useCallback(async (e, t) => {
3644
- let { apiBase: n, headers: r } = _.current, i = $i(n, `/pending-actions/${encodeURIComponent(e)}/reject`);
3714
+ let { apiBase: n, headers: r } = _.current, i = na(n, `/pending-actions/${encodeURIComponent(e)}/reject`);
3645
3715
  try {
3646
- return await ea(i, {
3716
+ return await ra(i, {
3647
3717
  method: "POST",
3648
3718
  body: JSON.stringify(t ? { reason: t } : {})
3649
3719
  }, r);
@@ -3677,7 +3747,7 @@ function ta(t = {}) {
3677
3747
  }
3678
3748
  //#endregion
3679
3749
  //#region src/AiPendingActionsInbox.tsx
3680
- var na = {
3750
+ var aa = {
3681
3751
  pending: {
3682
3752
  variant: "secondary",
3683
3753
  label: "Pending"
@@ -3699,8 +3769,8 @@ var na = {
3699
3769
  label: "Rejected"
3700
3770
  }
3701
3771
  };
3702
- function ra({ status: e }) {
3703
- let t = na[e] ?? {
3772
+ function oa({ status: e }) {
3773
+ let t = aa[e] ?? {
3704
3774
  variant: "outline",
3705
3775
  label: e
3706
3776
  };
@@ -3709,7 +3779,7 @@ function ra({ status: e }) {
3709
3779
  children: t.label
3710
3780
  });
3711
3781
  }
3712
- function ia(e) {
3782
+ function sa(e) {
3713
3783
  if (!e) return "—";
3714
3784
  let t = Date.parse(e);
3715
3785
  if (Number.isNaN(t)) return e;
@@ -3727,7 +3797,7 @@ function ia(e) {
3727
3797
  return e;
3728
3798
  }
3729
3799
  }
3730
- function aa(e) {
3800
+ function ca(e) {
3731
3801
  if (!e) return null;
3732
3802
  try {
3733
3803
  return JSON.parse(e);
@@ -3735,7 +3805,7 @@ function aa(e) {
3735
3805
  return e;
3736
3806
  }
3737
3807
  }
3738
- function oa({ value: e, max: t = 320 }) {
3808
+ function la({ value: e, max: t = 320 }) {
3739
3809
  let n = typeof e == "string" ? e : JSON.stringify(e, null, 2);
3740
3810
  return n == null || n === "" ? /* @__PURE__ */ Q("span", {
3741
3811
  className: "text-muted-foreground text-xs",
@@ -3746,21 +3816,21 @@ function oa({ value: e, max: t = 320 }) {
3746
3816
  children: n
3747
3817
  });
3748
3818
  }
3749
- function sa(e) {
3819
+ function ua(e) {
3750
3820
  switch (e) {
3751
3821
  case "pending": return "pending";
3752
3822
  case "all": return "all";
3753
3823
  case "decided": return "all";
3754
3824
  }
3755
3825
  }
3756
- function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i, variant: a = "card", title: o = "AI Approvals", description: s = "Actions an AI agent proposed that need a human review before execution.", className: c }) {
3757
- let [l, u] = e.useState("pending"), [d, m] = e.useState(null), [h, g] = e.useState(null), [_, w] = e.useState(""), [T, E] = e.useState(null), [D, O] = e.useState(null), [k, A] = e.useState(null), { items: j, isLoading: M, error: N, refresh: ee, approve: te, reject: P } = ta({
3826
+ function da({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i, variant: a = "card", title: o = "AI Approvals", description: s = "Actions an AI agent proposed that need a human review before execution.", className: c }) {
3827
+ let [l, u] = e.useState("pending"), [d, m] = e.useState(null), [h, g] = e.useState(null), [_, w] = e.useState(""), [T, E] = e.useState(null), [D, O] = e.useState(null), [k, A] = e.useState(null), { items: j, isLoading: M, error: N, refresh: ee, approve: te, reject: P } = ia({
3758
3828
  apiBase: t,
3759
3829
  headers: n,
3760
3830
  pollInterval: r,
3761
3831
  conversationId: i,
3762
- status: sa(l)
3763
- }), F = e.useMemo(() => l === "decided" ? j.filter((e) => e.status !== "pending") : j, [j, l]), L = e.useMemo(() => d ? j.find((e) => e.id === d) ?? null : null, [d, j]), R = e.useCallback(async (e) => {
3832
+ status: ua(l)
3833
+ }), F = e.useMemo(() => l === "decided" ? j.filter((e) => e.status !== "pending") : j, [j, l]), L = e.useMemo(() => d ? j.find((e) => e.id === d) ?? null : null, [d, j]), oe = e.useCallback(async (e) => {
3764
3834
  E(e), O(null);
3765
3835
  try {
3766
3836
  let t = await te(e), n = t.status === "executed";
@@ -3781,7 +3851,7 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
3781
3851
  } finally {
3782
3852
  E(null);
3783
3853
  }
3784
- }, [te]), z = e.useCallback(async (e, t) => {
3854
+ }, [te]), R = e.useCallback(async (e, t) => {
3785
3855
  E(e), O(null);
3786
3856
  try {
3787
3857
  await P(e, t.trim() || void 0), A({
@@ -3801,24 +3871,24 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
3801
3871
  } finally {
3802
3872
  E(null);
3803
3873
  }
3804
- }, [P]), oe = /* @__PURE__ */ $("div", {
3874
+ }, [P]), z = /* @__PURE__ */ $("div", {
3805
3875
  className: "space-y-3",
3806
3876
  children: [
3807
3877
  /* @__PURE__ */ $("div", {
3808
3878
  className: "flex items-center justify-between gap-2",
3809
- children: [/* @__PURE__ */ Q(xe, {
3879
+ children: [/* @__PURE__ */ Q(K, {
3810
3880
  value: l,
3811
3881
  onValueChange: (e) => u(e),
3812
- children: /* @__PURE__ */ $(q, { children: [
3813
- /* @__PURE__ */ Q(Se, {
3882
+ children: /* @__PURE__ */ $(Se, { children: [
3883
+ /* @__PURE__ */ Q(Ce, {
3814
3884
  value: "pending",
3815
3885
  children: "Pending"
3816
3886
  }),
3817
- /* @__PURE__ */ Q(Se, {
3887
+ /* @__PURE__ */ Q(Ce, {
3818
3888
  value: "decided",
3819
3889
  children: "Decided"
3820
3890
  }),
3821
- /* @__PURE__ */ Q(Se, {
3891
+ /* @__PURE__ */ Q(Ce, {
3822
3892
  value: "all",
3823
3893
  children: "All"
3824
3894
  })
@@ -3858,17 +3928,17 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
3858
3928
  M && F.length === 0 ? /* @__PURE__ */ $("div", {
3859
3929
  className: "space-y-2",
3860
3930
  children: [
3861
- /* @__PURE__ */ Q(H, { className: "h-10 w-full" }),
3862
- /* @__PURE__ */ Q(H, { className: "h-10 w-full" }),
3863
- /* @__PURE__ */ Q(H, { className: "h-10 w-full" })
3931
+ /* @__PURE__ */ Q(V, { className: "h-10 w-full" }),
3932
+ /* @__PURE__ */ Q(V, { className: "h-10 w-full" }),
3933
+ /* @__PURE__ */ Q(V, { className: "h-10 w-full" })
3864
3934
  ]
3865
- }) : F.length === 0 ? /* @__PURE__ */ Q(ne, { children: /* @__PURE__ */ $(re, { children: [
3935
+ }) : F.length === 0 ? /* @__PURE__ */ Q(ne, { children: /* @__PURE__ */ $(I, { children: [
3866
3936
  /* @__PURE__ */ Q(ie, { children: /* @__PURE__ */ Q($e, { className: "h-8 w-8 text-muted-foreground" }) }),
3867
3937
  /* @__PURE__ */ Q(ae, { children: "No actions waiting" }),
3868
- /* @__PURE__ */ Q(I, { children: "When the AI proposes a sensitive action it will appear here for review." })
3938
+ /* @__PURE__ */ Q(re, { children: "When the AI proposes a sensitive action it will appear here for review." })
3869
3939
  ] }) }) : /* @__PURE__ */ Q("div", {
3870
3940
  className: "rounded-md border",
3871
- children: /* @__PURE__ */ $(ye, { children: [/* @__PURE__ */ Q(G, { children: /* @__PURE__ */ $(K, { children: [
3941
+ children: /* @__PURE__ */ $(be, { children: [/* @__PURE__ */ Q(xe, { children: /* @__PURE__ */ $(G, { children: [
3872
3942
  /* @__PURE__ */ Q(W, {
3873
3943
  className: "w-[140px]",
3874
3944
  children: "Tool"
@@ -3893,9 +3963,9 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
3893
3963
  className: "w-[260px] text-right",
3894
3964
  children: "Decision"
3895
3965
  })
3896
- ] }) }), /* @__PURE__ */ Q(be, { children: F.map((e) => {
3966
+ ] }) }), /* @__PURE__ */ Q(H, { children: F.map((e) => {
3897
3967
  let t = e.status === "pending", n = T === e.id;
3898
- return /* @__PURE__ */ $(K, { children: [
3968
+ return /* @__PURE__ */ $(G, { children: [
3899
3969
  /* @__PURE__ */ Q(U, {
3900
3970
  className: "font-mono text-xs",
3901
3971
  children: e.tool_name
@@ -3908,7 +3978,7 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
3908
3978
  className: "text-sm",
3909
3979
  children: e.object_name
3910
3980
  }),
3911
- /* @__PURE__ */ Q(U, { children: /* @__PURE__ */ Q(ra, { status: e.status }) }),
3981
+ /* @__PURE__ */ Q(U, { children: /* @__PURE__ */ Q(oa, { status: e.status }) }),
3912
3982
  /* @__PURE__ */ Q(U, {
3913
3983
  className: "text-xs text-muted-foreground",
3914
3984
  children: /* @__PURE__ */ $("span", {
@@ -3916,7 +3986,7 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
3916
3986
  children: [
3917
3987
  /* @__PURE__ */ Q(He, { className: "h-3 w-3" }),
3918
3988
  " ",
3919
- ia(e.proposed_at)
3989
+ sa(e.proposed_at)
3920
3990
  ]
3921
3991
  })
3922
3992
  }),
@@ -3934,7 +4004,7 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
3934
4004
  size: "sm",
3935
4005
  variant: "default",
3936
4006
  disabled: n,
3937
- onClick: () => void R(e.id),
4007
+ onClick: () => void oe(e.id),
3938
4008
  "data-testid": `ai-inbox-approve-${e.id}`,
3939
4009
  children: [/* @__PURE__ */ Q(Y, { className: "h-3.5 w-3.5 mr-1" }), n ? "Working…" : "Approve"]
3940
4010
  }), /* @__PURE__ */ $(v, {
@@ -3967,10 +4037,10 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
3967
4037
  o
3968
4038
  ]
3969
4039
  }), s ? /* @__PURE__ */ Q(x, { children: s }) : null]
3970
- }), /* @__PURE__ */ Q(b, { children: oe })]
4040
+ }), /* @__PURE__ */ Q(b, { children: z })]
3971
4041
  }) : /* @__PURE__ */ Q("div", {
3972
4042
  className: c,
3973
- children: oe
4043
+ children: z
3974
4044
  }),
3975
4045
  /* @__PURE__ */ Q(he, {
3976
4046
  open: !!d,
@@ -3979,7 +4049,7 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
3979
4049
  },
3980
4050
  children: /* @__PURE__ */ $(ge, {
3981
4051
  className: "sm:max-w-[560px] overflow-y-auto",
3982
- children: [/* @__PURE__ */ $(V, { children: [/* @__PURE__ */ $(ve, {
4052
+ children: [/* @__PURE__ */ $(ve, { children: [/* @__PURE__ */ $(ye, {
3983
4053
  className: "flex items-center gap-2",
3984
4054
  children: [/* @__PURE__ */ Q(Me, { className: "h-4 w-4" }), L ? L.action_name : "Pending action"]
3985
4055
  }), /* @__PURE__ */ Q(_e, { children: L ? /* @__PURE__ */ $(Z, { children: [
@@ -4005,14 +4075,14 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4005
4075
  children: "Status"
4006
4076
  }), /* @__PURE__ */ Q("div", {
4007
4077
  className: "mt-1",
4008
- children: /* @__PURE__ */ Q(ra, { status: L.status })
4078
+ children: /* @__PURE__ */ Q(oa, { status: L.status })
4009
4079
  })] }),
4010
4080
  /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4011
4081
  className: "text-xs text-muted-foreground",
4012
4082
  children: "Proposed"
4013
4083
  }), /* @__PURE__ */ Q("div", {
4014
4084
  className: "mt-1 text-xs",
4015
- children: ia(L.proposed_at)
4085
+ children: sa(L.proposed_at)
4016
4086
  })] }),
4017
4087
  /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4018
4088
  className: "text-xs text-muted-foreground",
@@ -4046,21 +4116,21 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4046
4116
  children: "Tool input"
4047
4117
  }), /* @__PURE__ */ Q("div", {
4048
4118
  className: "mt-1.5",
4049
- children: /* @__PURE__ */ Q(oa, { value: aa(L.tool_input) })
4119
+ children: /* @__PURE__ */ Q(la, { value: ca(L.tool_input) })
4050
4120
  })] }),
4051
4121
  L.result ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4052
4122
  className: "text-xs",
4053
4123
  children: "Result"
4054
4124
  }), /* @__PURE__ */ Q("div", {
4055
4125
  className: "mt-1.5",
4056
- children: /* @__PURE__ */ Q(oa, { value: aa(L.result) })
4126
+ children: /* @__PURE__ */ Q(la, { value: ca(L.result) })
4057
4127
  })] }) : null,
4058
4128
  L.error ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4059
4129
  className: "text-xs text-destructive",
4060
4130
  children: "Error"
4061
4131
  }), /* @__PURE__ */ Q("div", {
4062
4132
  className: "mt-1.5",
4063
- children: /* @__PURE__ */ Q(oa, { value: L.error })
4133
+ children: /* @__PURE__ */ Q(la, { value: L.error })
4064
4134
  })] }) : null,
4065
4135
  L.rejection_reason ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
4066
4136
  className: "text-xs",
@@ -4073,7 +4143,7 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4073
4143
  className: "pt-2 flex gap-2",
4074
4144
  children: [/* @__PURE__ */ $(v, {
4075
4145
  size: "sm",
4076
- onClick: () => void R(L.id),
4146
+ onClick: () => void oe(L.id),
4077
4147
  disabled: T === L.id,
4078
4148
  children: [/* @__PURE__ */ Q(Y, { className: "h-3.5 w-3.5 mr-1" }), "Approve & Execute"]
4079
4149
  }), /* @__PURE__ */ $(v, {
@@ -4098,9 +4168,9 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4098
4168
  children: /* @__PURE__ */ $(ge, {
4099
4169
  side: "bottom",
4100
4170
  className: "max-h-[40vh]",
4101
- children: [/* @__PURE__ */ $(V, { children: [/* @__PURE__ */ Q(ve, { children: "Reject this action?" }), /* @__PURE__ */ Q(_e, { children: "The reason is shown back to the AI so it can adjust its next response." })] }), /* @__PURE__ */ $("div", {
4171
+ children: [/* @__PURE__ */ $(ve, { children: [/* @__PURE__ */ Q(ye, { children: "Reject this action?" }), /* @__PURE__ */ Q(_e, { children: "The reason is shown back to the AI so it can adjust its next response." })] }), /* @__PURE__ */ $("div", {
4102
4172
  className: "px-4 mt-3 space-y-3",
4103
- children: [/* @__PURE__ */ Q(Ce, {
4173
+ children: [/* @__PURE__ */ Q(q, {
4104
4174
  value: _,
4105
4175
  onChange: (e) => w(e.target.value),
4106
4176
  placeholder: "Optional reason (e.g. 'Wrong record id — please confirm with the user first.')",
@@ -4118,7 +4188,7 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4118
4188
  }), /* @__PURE__ */ $(v, {
4119
4189
  variant: "destructive",
4120
4190
  size: "sm",
4121
- onClick: () => h && void z(h, _),
4191
+ onClick: () => h && void R(h, _),
4122
4192
  disabled: !h || T === h,
4123
4193
  "data-testid": "ai-inbox-reject-confirm",
4124
4194
  children: [/* @__PURE__ */ Q(X, { className: "h-3.5 w-3.5 mr-1" }), "Reject"]
@@ -4131,14 +4201,14 @@ function ca({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
4131
4201
  }
4132
4202
  //#endregion
4133
4203
  //#region src/useHitlInChat.ts
4134
- function la(e) {
4204
+ function fa(e) {
4135
4205
  return !e || e.length === 0 ? "/api/v1/ai" : e.endsWith("/") ? e.slice(0, -1) : e;
4136
4206
  }
4137
- function ua(e, t) {
4207
+ function pa(e, t) {
4138
4208
  let n = { ...e ?? {} };
4139
4209
  return t && (n["Content-Type"] = "application/json"), n;
4140
4210
  }
4141
- async function da(e) {
4211
+ async function ma(e) {
4142
4212
  let t = await e.text();
4143
4213
  if (!t) return null;
4144
4214
  try {
@@ -4147,8 +4217,8 @@ async function da(e) {
4147
4217
  return { raw: t };
4148
4218
  }
4149
4219
  }
4150
- function fa(t) {
4151
- let { messages: n, apiBase: r, headers: i, onDecided: a, continueConversation: o } = t, s = la(r), c = e.useMemo(() => {
4220
+ function ha(t) {
4221
+ let { messages: n, apiBase: r, headers: i, onDecided: a, continueConversation: o } = t, s = fa(r), c = e.useMemo(() => {
4152
4222
  let e = /* @__PURE__ */ new Map();
4153
4223
  for (let t of n) {
4154
4224
  let n = t.toolInvocations ?? [];
@@ -4191,9 +4261,9 @@ function fa(t) {
4191
4261
  let r = `${s}/pending-actions/${encodeURIComponent(l)}/${t ? "approve" : "reject"}`, c = t ? "{}" : JSON.stringify({ reason: n ?? "" }), d = await fetch(r, {
4192
4262
  method: "POST",
4193
4263
  credentials: "include",
4194
- headers: ua(i, !0),
4264
+ headers: pa(i, !0),
4195
4265
  body: c
4196
- }), f = await da(d) ?? {};
4266
+ }), f = await ma(d) ?? {};
4197
4267
  if (!d.ok) {
4198
4268
  let t = typeof f.error == "string" ? f.error : `Approval failed: HTTP ${d.status}`;
4199
4269
  m(e, {
@@ -4220,7 +4290,7 @@ function fa(t) {
4220
4290
  state: "success",
4221
4291
  message: `Status: ${p}`
4222
4292
  }), h = !0), a?.(e, f), h && o) {
4223
- let r = pa({
4293
+ let r = ga({
4224
4294
  approved: t,
4225
4295
  status: p,
4226
4296
  toolName: u,
@@ -4255,24 +4325,24 @@ function fa(t) {
4255
4325
  isDeciding: f
4256
4326
  };
4257
4327
  }
4258
- function pa(e) {
4328
+ function ga(e) {
4259
4329
  let { approved: t, status: n, toolName: r, pendingActionId: i, outcome: a, reason: o } = e, s = `[HITL ${i}]`;
4260
4330
  if (t && n === "executed") {
4261
4331
  let e = a.result;
4262
- return `${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e == null ? "(no payload)" : typeof e == "string" ? e : ma(JSON.stringify(e), 800)}. Acknowledge the outcome concisely and continue the user's task.`;
4332
+ return `${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e == null ? "(no payload)" : typeof e == "string" ? e : _a(JSON.stringify(e), 800)}. Acknowledge the outcome concisely and continue the user's task.`;
4263
4333
  }
4264
4334
  if (!t && n === "rejected") return `${s} The operator rejected the \`${r}\` call.${o && o.trim().length > 0 ? ` Reason: ${o}.` : ""} Acknowledge the rejection and ask whether to try a different approach.`;
4265
4335
  if (n === "failed") {
4266
4336
  let e = a.error;
4267
- return `${s} The \`${r}\` call was approved but execution failed: ${typeof e == "string" ? e : ma(JSON.stringify(e ?? {}), 400)}. Apologize concisely and offer alternatives.`;
4337
+ return `${s} The \`${r}\` call was approved but execution failed: ${typeof e == "string" ? e : _a(JSON.stringify(e ?? {}), 400)}. Apologize concisely and offer alternatives.`;
4268
4338
  }
4269
4339
  }
4270
- function ma(e, t) {
4340
+ function _a(e, t) {
4271
4341
  return e.length <= t ? e : `${e.slice(0, t - 1)}…`;
4272
4342
  }
4273
4343
  //#endregion
4274
4344
  //#region src/index.tsx
4275
- var ha = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, disabled: a = !1, showTimestamp: o = !1, userAvatarUrl: s, userAvatarFallback: c = "You", assistantAvatarUrl: l, assistantAvatarFallback: u = "AI", maxHeight: d = "500px", ...f }, p) => {
4345
+ var va = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, disabled: a = !1, showTimestamp: o = !1, userAvatarUrl: s, userAvatarFallback: c = "You", assistantAvatarUrl: l, assistantAvatarFallback: u = "AI", maxHeight: d = "500px", ...f }, p) => {
4276
4346
  let [m, h] = e.useState(""), g = e.useRef(null), _ = e.useRef(null);
4277
4347
  e.useEffect(() => {
4278
4348
  if (g.current) {
@@ -4298,7 +4368,7 @@ var ha = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
4298
4368
  children: n.length === 0 ? /* @__PURE__ */ Q("div", {
4299
4369
  className: "flex items-center justify-center h-32 text-muted-foreground text-sm",
4300
4370
  children: "No messages yet. Start a conversation!"
4301
- }) : n.map((e) => /* @__PURE__ */ Q(ga, {
4371
+ }) : n.map((e) => /* @__PURE__ */ Q(ya, {
4302
4372
  message: e,
4303
4373
  showTimestamp: o,
4304
4374
  userAvatarUrl: s,
@@ -4311,7 +4381,7 @@ var ha = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
4311
4381
  className: "border-t p-4",
4312
4382
  children: /* @__PURE__ */ $("div", {
4313
4383
  className: "flex gap-2",
4314
- children: [/* @__PURE__ */ Q(oe, {
4384
+ children: [/* @__PURE__ */ Q(z, {
4315
4385
  ref: _,
4316
4386
  value: m,
4317
4387
  onChange: (e) => h(e.target.value),
@@ -4329,8 +4399,8 @@ var ha = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
4329
4399
  })]
4330
4400
  });
4331
4401
  });
4332
- ha.displayName = "Chatbot";
4333
- var ga = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback: r, assistantAvatarUrl: i, assistantAvatarFallback: a }) => {
4402
+ va.displayName = "Chatbot";
4403
+ var ya = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback: r, assistantAvatarUrl: i, assistantAvatarFallback: a }) => {
4334
4404
  let o = e.role === "user";
4335
4405
  if (e.role === "system") return /* @__PURE__ */ Q("div", {
4336
4406
  className: "flex justify-center",
@@ -4362,7 +4432,7 @@ var ga = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
4362
4432
  })]
4363
4433
  })]
4364
4434
  });
4365
- }, _a = e.forwardRef(({ className: e, avatarSrc: t, avatarFallback: n = "AI", ...r }, i) => /* @__PURE__ */ $("div", {
4435
+ }, ba = e.forwardRef(({ className: e, avatarSrc: t, avatarFallback: n = "AI", ...r }, i) => /* @__PURE__ */ $("div", {
4366
4436
  ref: i,
4367
4437
  className: J("flex gap-3", e),
4368
4438
  ...r,
@@ -4384,6 +4454,6 @@ var ga = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
4384
4454
  })
4385
4455
  })]
4386
4456
  }));
4387
- _a.displayName = "TypingIndicator";
4457
+ ba.displayName = "TypingIndicator";
4388
4458
  //#endregion
4389
- export { en as AGENT_ALIAS_GROUPS, Zi as AIElements, ca as AiPendingActionsInbox, ha as Chatbot, Mi as ChatbotEnhanced, Ji as FloatingChatbot, Tn as FloatingChatbotPanel, pn as FloatingChatbotProvider, yn as FloatingChatbotTrigger, cn as PLATFORM_DEFAULT_AGENT, _a as TypingIndicator, tn as agentAliasGroup, nn as agentRouteName, Wt as buildProgressFromDraftReview, Ht as detectDraftResult, Vt as detectProposedPlan, Dn as humanizeToolName, sn as isAskAgent, on as isBuildAgent, an as isBuiltinAgentName, wi as publishHealthFromResponse, rn as resolveAgentParam, ln as resolveDefaultAgentName, kn as summarizeChatError, Yt as uiMessageToChatMessage, Xt as uiMessagesToChatMessages, On as unwrapToolResult, dn as useAgents, mn as useFloatingChatbot, fa as useHitlInChat, $t as useObjectChat, ta as usePendingActions };
4459
+ export { tn as AGENT_ALIAS_GROUPS, ea as AIElements, da as AiPendingActionsInbox, va as Chatbot, Ni as ChatbotEnhanced, Zi as FloatingChatbot, En as FloatingChatbotPanel, mn as FloatingChatbotProvider, bn as FloatingChatbotTrigger, ln as PLATFORM_DEFAULT_AGENT, ba as TypingIndicator, nn as agentAliasGroup, rn as agentRouteName, Gt as buildProgressFromDraftReview, Ut as detectDraftResult, Ht as detectProposedPlan, On as humanizeToolName, cn as isAskAgent, sn as isBuildAgent, on as isBuiltinAgentName, Ti as publishHealthFromResponse, an as resolveAgentParam, un as resolveDefaultAgentName, An as summarizeChatError, Xt as uiMessageToChatMessage, Zt as uiMessagesToChatMessages, kn as unwrapToolResult, fn as useAgents, hn as useFloatingChatbot, ha as useHitlInChat, en as useObjectChat, ia as usePendingActions };