@icanbwell/baileyai-chat-ui 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,27 @@
1
- import { t as e } from "./safeMarkdownUrl-xI42YYzd.js";
2
- import { createContext as t, memo as n, useCallback as r, useContext as i, useEffect as a, useLayoutEffect as o, useMemo as s, useRef as c, useState as l } from "react";
3
- import u from "react-markdown";
4
- import d from "remark-gfm";
5
- import * as f from "@radix-ui/react-tooltip";
6
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
1
+ import { n as e, t } from "./safeMarkdownUrl-Bqv6Q4u1.js";
2
+ import { createContext as n, memo as r, useCallback as i, useContext as a, useEffect as o, useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "react";
3
+ import d from "react-markdown";
4
+ import f from "remark-gfm";
5
+ import * as p from "@radix-ui/react-tooltip";
6
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
7
7
  //#region src/utils/pseudoToolCalls.ts
8
- var g = /<(search_tools|call_tool|function_calls|function_result)>([\s\S]*?)<\/\1>/g, _ = /<name>([\s\S]*?)<\/name>/, v = /<arguments>([\s\S]*?)<\/arguments>/, y = /<invoke\s+name="([^"]*)"\s*>([\s\S]*?)<\/invoke>/g, b = /<parameter\s+name="([^"]*)"\s*>([\s\S]*?)<\/parameter>/g;
9
- function x(e) {
10
- let t = _.exec(e)?.[1]?.trim() || "unknown_tool", n = v.exec(e)?.[1]?.trim();
8
+ var _ = "search_tools|call_tool|function_calls|function_result", v = RegExp(`<(${_})>([\\s\\S]*?)<\\/\\1>`, "g"), y = RegExp(`<(?:${_})>[\\s\\S]*$`), b = /<name>([\s\S]*?)<\/name>/, x = /<arguments>([\s\S]*?)<\/arguments>/, S = /<invoke\s+name="([^"]*)"\s*>([\s\S]*?)<\/invoke>/g, C = /<parameter\s+name="([^"]*)"\s*>([\s\S]*?)<\/parameter>/g;
9
+ function w(e) {
10
+ let t = b.exec(e)?.[1]?.trim() || "unknown_tool", n = x.exec(e)?.[1]?.trim();
11
11
  return n ? {
12
12
  name: t,
13
13
  args: n
14
14
  } : { name: t };
15
15
  }
16
- function S(e) {
16
+ function T(e) {
17
17
  let t = [];
18
- y.lastIndex = 0;
18
+ S.lastIndex = 0;
19
19
  let n;
20
- for (; (n = y.exec(e)) !== null;) {
20
+ for (; (n = S.exec(e)) !== null;) {
21
21
  let [, e, r] = n, i = {};
22
- b.lastIndex = 0;
22
+ C.lastIndex = 0;
23
23
  let a;
24
- for (; (a = b.exec(r)) !== null;) i[a[1]] = a[2].trim();
24
+ for (; (a = C.exec(r)) !== null;) i[a[1]] = a[2].trim();
25
25
  let o = e.trim() || "unknown_tool";
26
26
  t.push(Object.keys(i).length > 0 ? {
27
27
  name: o,
@@ -30,25 +30,25 @@ function S(e) {
30
30
  }
31
31
  return t;
32
32
  }
33
- function C(e) {
34
- let t = [], n = e.replace(g, (e, n, r) => (n === "call_tool" ? t.push(x(r)) : n === "search_tools" ? t.push({
33
+ function E(e, t = {}) {
34
+ let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(v, (e, t, n) => (t === "call_tool" ? r.push(w(n)) : t === "search_tools" ? r.push({
35
35
  name: "search_tools",
36
- args: r.trim()
37
- }) : n === "function_calls" ? t.push(...S(r)) : t.push({
36
+ args: n.trim()
37
+ }) : t === "function_calls" ? r.push(...T(n)) : r.push({
38
38
  name: "function_result",
39
- args: r.trim()
40
- }), ""));
41
- return t.length === 0 ? {
42
- cleanedText: n,
43
- matches: t
39
+ args: n.trim()
40
+ }), "")), a = n ? i.replace(y, "") : i;
41
+ return r.length === 0 && a === i ? {
42
+ cleanedText: i,
43
+ matches: r
44
44
  } : {
45
- cleanedText: n.replace(/\n{3,}/g, "\n\n"),
46
- matches: t
45
+ cleanedText: a.replace(/\n{3,}/g, "\n\n"),
46
+ matches: r
47
47
  };
48
48
  }
49
49
  //#endregion
50
50
  //#region src/logic/sse.ts
51
- function w(e) {
51
+ function D(e) {
52
52
  if (!e.startsWith("data: ")) return e;
53
53
  let t = "";
54
54
  for (let n of e.split("\n")) {
@@ -62,7 +62,7 @@ function w(e) {
62
62
  }
63
63
  return t || null;
64
64
  }
65
- function T(e) {
65
+ function O(e) {
66
66
  let t = e.replace(/\r\n/g, "\n").split("\n\n"), n = t.pop() ?? "", r = [], i = !1;
67
67
  for (let e of t) {
68
68
  let t = e.split("\n").filter((e) => e.length > 0), n = "message", a = [];
@@ -87,7 +87,7 @@ function T(e) {
87
87
  message: e
88
88
  });
89
89
  } else if (c?.type === "response.output_text.delta" && typeof c.delta == "string") {
90
- let e = w(c.delta);
90
+ let e = D(c.delta);
91
91
  e && r.push({
92
92
  type: "response.output_text.delta",
93
93
  delta: e
@@ -105,42 +105,42 @@ function T(e) {
105
105
  }
106
106
  //#endregion
107
107
  //#region src/logic/useBaileyChat.ts
108
- var E = 200, D = 15e4, O = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`, k = (e, t, n) => {
108
+ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`, ee = (e, t, n) => {
109
109
  if (e === 401 || e === 403) return "Bailey isn't reachable with your current login.";
110
110
  let r = `Bailey request failed (status ${e ?? "network error"}).`, i = (n || t || "").trim();
111
- return i ? `${r} ${i.length > E ? `${i.slice(0, E)}…` : i}` : r;
112
- }, A = ({ transport: e, model: t, instructions: n, tools: i = [], toolChoice: o, firstUserMessagePrefix: s, onAssistantMessageComplete: u, idleTimeoutMs: d = D }) => {
113
- let [f, p] = l([]), [m, h] = l([]), [g, _] = l(null), [v, y] = l("idle"), [b, x] = l(null), S = c(null), w = c(""), E = c(0), A = c([]);
114
- a(() => {
115
- A.current = f;
111
+ return i ? `${r} ${i.length > k ? `${i.slice(0, k)}…` : i}` : r;
112
+ }, M = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: a, firstUserMessagePrefix: s, onAssistantMessageComplete: c, idleTimeoutMs: d = A }) => {
113
+ let [f, p] = u([]), [m, h] = u([]), [g, _] = u(null), [v, y] = u("idle"), [b, x] = u(null), S = l(null), C = l(""), w = l(0), T = l([]);
114
+ o(() => {
115
+ T.current = f;
116
116
  }, [f]);
117
- let j = c([]), M = c(/* @__PURE__ */ new Map()), N = c(/* @__PURE__ */ new Map()), P = c(null), F = r(() => {
118
- P.current !== null && (clearTimeout(P.current), P.current = null);
119
- }, []), I = r((e) => {
120
- F(), P.current = setTimeout(() => {
117
+ let D = l([]), k = l(/* @__PURE__ */ new Map()), M = l(/* @__PURE__ */ new Map()), N = l(null), P = i(() => {
118
+ N.current !== null && (clearTimeout(N.current), N.current = null);
119
+ }, []), F = i((e) => {
120
+ P(), N.current = setTimeout(() => {
121
121
  e.abort(new DOMException("The assistant took too long to respond. Please try again.", "TimeoutError"));
122
122
  }, d);
123
- }, [F, d]);
124
- a(() => () => {
125
- S.current?.abort(), F();
126
- }, [F]);
127
- let L = r((e, t, n) => {
123
+ }, [P, d]);
124
+ o(() => () => {
125
+ S.current?.abort(), P();
126
+ }, [P]);
127
+ let I = i((e, t, n) => {
128
128
  let r = (e) => {
129
129
  n.push(e), h((t) => [...t, e]);
130
130
  };
131
131
  if (t.type === "response.output_text.delta") {
132
132
  if (!t.delta) return !1;
133
- let n = M.current.get(e) ?? {
133
+ let n = k.current.get(e) ?? {
134
134
  raw: "",
135
135
  emittedCount: 0
136
136
  };
137
137
  n.raw += t.delta;
138
- let { cleanedText: i, matches: a } = C(n.raw), o = i.trim(), s = a.slice(n.emittedCount);
139
- if (n.emittedCount = a.length, M.current.set(e, n), N.current.set(e, o), p((t) => t.map((t) => t.id === e ? {
138
+ let { cleanedText: i, matches: a } = E(n.raw), o = i.trim(), s = a.slice(n.emittedCount);
139
+ if (n.emittedCount = a.length, k.current.set(e, n), M.current.set(e, o), p((t) => t.map((t) => t.id === e ? {
140
140
  ...t,
141
141
  content: o
142
142
  } : t)), s.length > 0) {
143
- let e = Date.now(), t = E.current;
143
+ let e = Date.now(), t = w.current;
144
144
  s.forEach((n) => r({
145
145
  kind: "pseudo_tool_call",
146
146
  name: n.name,
@@ -154,7 +154,7 @@ var E = 200, D = 15e4, O = () => typeof crypto < "u" && typeof crypto.randomUUID
154
154
  if (t.type === "response.output_item.added" || t.type === "response.output_item.done") {
155
155
  let e = t.item;
156
156
  if (e.type === "function_call" || e.type === "mcp_call") {
157
- let n = Date.now(), i = E.current, a = e.name || "unknown_tool";
157
+ let n = Date.now(), i = w.current, a = e.name || "unknown_tool";
158
158
  return r(t.type === "response.output_item.added" ? {
159
159
  kind: "tool_start",
160
160
  name: a,
@@ -174,37 +174,50 @@ var E = 200, D = 15e4, O = () => typeof crypto < "u" && typeof crypto.randomUUID
174
174
  }
175
175
  return !1;
176
176
  }
177
- return t.type === "task.progress" ? (r({
177
+ if (t.type === "task.progress") return r({
178
178
  kind: "progress",
179
179
  status: t.status,
180
180
  message: t.message,
181
181
  at: Date.now(),
182
- turnSentAt: E.current
183
- }), !0) : t.type === "response.output_text.done" || t.type === "response.created" || t.type === "response.completed" ? !1 : t.type === "info" ? (r({
182
+ turnSentAt: w.current
183
+ }), !0;
184
+ if (t.type === "response.output_text.done" || t.type === "response.created") return !1;
185
+ if (t.type === "response.completed") {
186
+ let t = k.current.get(e);
187
+ if (t) {
188
+ let { cleanedText: n } = E(t.raw, { hideOpenBlock: !1 }), r = n.trim();
189
+ r !== M.current.get(e) && (M.current.set(e, r), p((t) => t.map((t) => t.id === e ? {
190
+ ...t,
191
+ content: r
192
+ } : t)));
193
+ }
194
+ return !1;
195
+ }
196
+ return t.type === "info" ? (r({
184
197
  kind: "info",
185
198
  message: t.message,
186
199
  at: Date.now(),
187
- turnSentAt: E.current
200
+ turnSentAt: w.current
188
201
  }), !0) : (r({
189
202
  kind: "raw",
190
203
  eventType: t.type,
191
204
  raw: JSON.stringify(t),
192
205
  at: Date.now(),
193
- turnSentAt: E.current
206
+ turnSentAt: w.current
194
207
  }), !0);
195
- }, []), R = r(async (r) => {
208
+ }, []), L = i(async (i) => {
196
209
  y("streaming"), x(null);
197
- let a = Date.now();
198
- E.current = a;
199
- let c = O(), l = {
200
- id: c,
210
+ let o = Date.now();
211
+ w.current = o;
212
+ let l = j(), u = {
213
+ id: l,
201
214
  role: "assistant",
202
215
  content: "",
203
216
  streaming: !0,
204
- createdAt: a
217
+ createdAt: o
205
218
  };
206
- p((e) => [...e, l]), j.current = [...r, l];
207
- let d = r.findIndex((e) => e.role === "user" && !e.hidden), f = r.map((e, t) => t === d && s ? {
219
+ p((e) => [...e, u]), D.current = [...i, u];
220
+ let d = i.findIndex((e) => e.role === "user" && !e.hidden), f = i.map((e, t) => t === d && s ? {
208
221
  role: e.role,
209
222
  content: `${s}${e.content}`,
210
223
  hidden: e.hidden,
@@ -219,10 +232,10 @@ var E = 200, D = 15e4, O = () => typeof crypto < "u" && typeof crypto.randomUUID
219
232
  model: t,
220
233
  systemPrompt: n,
221
234
  messages: f,
222
- tools: i,
223
- toolChoice: o,
235
+ tools: r,
236
+ toolChoice: a,
224
237
  stream: !0,
225
- sentAt: a,
238
+ sentAt: o,
226
239
  streamStats: {
227
240
  chunkCount: 0,
228
241
  firstChunkAt: null,
@@ -230,17 +243,17 @@ var E = 200, D = 15e4, O = () => typeof crypto < "u" && typeof crypto.randomUUID
230
243
  }
231
244
  });
232
245
  let m = new AbortController();
233
- S.current = m, I(m);
234
- let g = "", v = null, b = !1, C = !1, w = [], D = (e, t) => {
246
+ S.current = m, F(m);
247
+ let g = "", v = null, b = !1, C = !1, T = [], E = (e, t) => {
235
248
  y("error"), x(e);
236
249
  let n = {
237
250
  kind: "error",
238
251
  message: e,
239
252
  at: Date.now(),
240
- turnSentAt: a,
253
+ turnSentAt: o,
241
254
  ...t
242
255
  };
243
- w.push(n), h((e) => [...e, n]);
256
+ T.push(n), h((e) => [...e, n]);
244
257
  }, A = (e, t) => {
245
258
  e.forEach((e) => {
246
259
  if (e.type === "error") {
@@ -249,31 +262,31 @@ var E = 200, D = 15e4, O = () => typeof crypto < "u" && typeof crypto.randomUUID
249
262
  kind: "error",
250
263
  message: e.message,
251
264
  at: Date.now(),
252
- turnSentAt: a
265
+ turnSentAt: o
253
266
  };
254
- w.push(t), h((e) => [...e, t]);
267
+ T.push(t), h((e) => [...e, t]);
255
268
  return;
256
269
  }
257
- e.type === "response.output_text.delta" && e.delta && (C = !0), L(c, e, w) && (b = !0);
258
- }), t && p((e) => e.map((e) => e.id === c ? {
270
+ e.type === "response.output_text.delta" && e.delta && (C = !0), I(l, e, T) && (b = !0);
271
+ }), t && p((e) => e.map((e) => e.id === l ? {
259
272
  ...e,
260
273
  streaming: !1
261
274
  } : e));
262
275
  };
263
276
  try {
264
- let { status: r, text: s, errorMessage: l } = await e.streamChat({
277
+ let { status: i, text: s, errorMessage: u } = await e.streamChat({
265
278
  model: t,
266
279
  instructions: n,
267
280
  input: f,
268
- tools: i,
269
- toolChoice: o,
281
+ tools: r,
282
+ toolChoice: a,
270
283
  signal: m.signal,
271
284
  onChunk: (e) => {
272
- I(m), g += e;
273
- let { events: t, remainder: n, done: r } = T(g);
285
+ F(m), g += e;
286
+ let { events: t, remainder: n, done: r } = O(g);
274
287
  g = n, A(t, r);
275
288
  let i = Date.now();
276
- _((e) => e && e.sentAt === a ? {
289
+ _((e) => e && e.sentAt === o ? {
277
290
  ...e,
278
291
  streamStats: {
279
292
  chunkCount: e.streamStats.chunkCount + 1,
@@ -283,64 +296,64 @@ var E = 200, D = 15e4, O = () => typeof crypto < "u" && typeof crypto.randomUUID
283
296
  } : e);
284
297
  },
285
298
  onRequestId: (e) => {
286
- _((t) => t && t.sentAt === a ? {
299
+ _((t) => t && t.sentAt === o ? {
287
300
  ...t,
288
301
  requestId: e
289
302
  } : t);
290
303
  }
291
304
  });
292
305
  if (g.trim()) {
293
- let { events: e, done: t } = T(`${g}\n\n`);
306
+ let { events: e, done: t } = O(`${g}\n\n`);
294
307
  g = "", A(e, t);
295
308
  }
296
309
  if (v) {
297
310
  y("error"), x(v);
298
311
  return;
299
312
  }
300
- if (r === void 0 || r >= 400) {
301
- D(k(r, s, l), {
302
- httpStatus: r,
313
+ if (i === void 0 || i >= 400) {
314
+ E(ee(i, s, u), {
315
+ httpStatus: i,
303
316
  rawBody: s || void 0
304
317
  });
305
318
  return;
306
319
  }
307
320
  if (!b) {
308
- D("Bailey returned an empty response.");
321
+ E("Bailey returned an empty response.");
309
322
  return;
310
323
  }
311
324
  if (!C) {
312
- D("Bailey ran some tools but didn't return an answer. Try asking again.");
325
+ E("Bailey ran some tools but didn't return an answer. Try asking again.");
313
326
  return;
314
327
  }
315
328
  y("idle");
316
- let d = N.current.get(c) ?? "";
317
- _((e) => e && e.sentAt === a ? {
329
+ let d = M.current.get(l) ?? "";
330
+ _((e) => e && e.sentAt === o ? {
318
331
  ...e,
319
332
  response: { content: d }
320
- } : e), u && await u({
321
- id: c,
333
+ } : e), c && await c({
334
+ id: l,
322
335
  role: "assistant",
323
336
  content: d,
324
337
  streaming: !1
325
- }, w);
338
+ }, T);
326
339
  } catch (e) {
327
340
  let t = e;
328
341
  if (t?.name === "TimeoutError") {
329
- D(t.message, { source: "client-timeout" });
342
+ E(t.message, { source: "client-timeout" });
330
343
  return;
331
344
  }
332
345
  if (t?.name === "AbortError") {
333
346
  y("idle");
334
347
  return;
335
348
  }
336
- D(t?.message || "Bailey request failed.");
349
+ E(t?.message || "Bailey request failed.");
337
350
  } finally {
338
- F();
339
- let e = N.current.get(c) ?? "";
340
- M.current.delete(c), N.current.delete(c), p((e) => e.flatMap((e) => e.id === c ? e.content ? [{
351
+ P();
352
+ let e = M.current.get(l) ?? "";
353
+ k.current.delete(l), M.current.delete(l), p((e) => e.flatMap((e) => e.id === l ? e.content ? [{
341
354
  ...e,
342
355
  streaming: !1
343
- }] : [] : [e])), j.current = j.current.flatMap((t) => t.id === c ? e ? [{
356
+ }] : [] : [e])), D.current = D.current.flatMap((t) => t.id === l ? e ? [{
344
357
  ...t,
345
358
  content: e,
346
359
  streaming: !1
@@ -350,15 +363,15 @@ var E = 200, D = 15e4, O = () => typeof crypto < "u" && typeof crypto.randomUUID
350
363
  e,
351
364
  t,
352
365
  n,
353
- i,
354
- o,
366
+ r,
367
+ a,
355
368
  s,
356
- u,
357
- L,
369
+ c,
358
370
  I,
359
- F
360
- ]), z = r((e) => {
361
- A.current = e, p(e);
371
+ F,
372
+ P
373
+ ]), R = i((e) => {
374
+ T.current = e, p(e);
362
375
  }, []);
363
376
  return {
364
377
  messages: f,
@@ -366,75 +379,75 @@ var E = 200, D = 15e4, O = () => typeof crypto < "u" && typeof crypto.randomUUID
366
379
  lastRequest: g,
367
380
  status: v,
368
381
  error: b,
369
- send: r((e) => {
382
+ send: i((e) => {
370
383
  let t = e.trim();
371
384
  if (!t) return;
372
- w.current = t;
385
+ C.current = t;
373
386
  let n = {
374
- id: O(),
387
+ id: j(),
375
388
  role: "user",
376
389
  content: t,
377
390
  createdAt: Date.now()
378
- }, r = [...j.current, n];
379
- j.current = r, z([...A.current, n]), R(r);
380
- }, [R, z]),
381
- sendHidden: r((e, t) => {
391
+ }, r = [...D.current, n];
392
+ D.current = r, R([...T.current, n]), L(r);
393
+ }, [L, R]),
394
+ sendHidden: i((e, t) => {
382
395
  if (v === "streaming") return;
383
396
  let n = e.trim();
384
397
  if (!n) return;
385
- w.current = n;
398
+ C.current = n;
386
399
  let r = t?.trim(), i = {
387
- id: O(),
400
+ id: j(),
388
401
  role: "user",
389
402
  content: n,
390
403
  createdAt: Date.now(),
391
404
  hidden: !0,
392
405
  ...r ? { titleHint: r } : {}
393
- }, a = [...j.current, i];
394
- j.current = a, R(a);
395
- }, [R, v]),
396
- stop: r(() => {
406
+ }, a = [...D.current, i];
407
+ D.current = a, L(a);
408
+ }, [L, v]),
409
+ stop: i(() => {
397
410
  S.current?.abort();
398
411
  }, []),
399
- retryLast: r(() => {
400
- if (v === "streaming" || !w.current) return;
401
- let e = A.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
402
- z(n);
403
- let r = j.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
404
- j.current = a, R(a);
412
+ retryLast: i(() => {
413
+ if (v === "streaming" || !C.current) return;
414
+ let e = T.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
415
+ R(n);
416
+ let r = D.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
417
+ D.current = a, L(a);
405
418
  }, [
419
+ L,
406
420
  R,
407
- z,
408
421
  v
409
422
  ]),
410
- clearTrace: r(() => h([]), []),
411
- clearError: r(() => {
423
+ clearTrace: i(() => h([]), []),
424
+ clearError: i(() => {
412
425
  x(null), y((e) => e === "error" ? "idle" : e);
413
426
  }, []),
414
- newChat: r(() => {
415
- S.current?.abort(), z([]), j.current = [], h([]), _(null), y("idle"), x(null), w.current = "";
416
- }, [z]),
417
- loadMessages: r((e) => {
427
+ newChat: i(() => {
428
+ S.current?.abort(), R([]), D.current = [], h([]), _(null), y("idle"), x(null), C.current = "";
429
+ }, [R]),
430
+ loadMessages: i((e) => {
418
431
  S.current?.abort();
419
432
  let t = e.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
420
433
  ...e,
421
434
  streaming: !1
422
435
  }));
423
- z(t.filter((e) => !e.hidden)), j.current = t, h([]), _(null), y("idle"), x(null), w.current = "";
424
- }, [z])
436
+ R(t.filter((e) => !e.hidden)), D.current = t, h([]), _(null), y("idle"), x(null), C.current = "";
437
+ }, [R])
425
438
  };
426
439
  };
427
440
  //#endregion
428
441
  //#region src/utils/prompt.ts
429
- function j(...e) {
442
+ function N(...e) {
430
443
  return e.filter((e) => !!(e && e.trim())).join("\n\n");
431
444
  }
432
445
  //#endregion
433
446
  //#region src/utils/toolCalls.ts
434
- var M = "call_tool", N = "a tool";
435
- function P(e, t) {
447
+ var P = "call_tool", F = "a tool";
448
+ function I(e, t) {
436
449
  let n = {
437
- name: e === M ? N : e,
450
+ name: e === P ? F : e,
438
451
  args: null,
439
452
  viaCallTool: !1
440
453
  };
@@ -447,7 +460,7 @@ function P(e, t) {
447
460
  }
448
461
  if (typeof r != "object" || !r) return n;
449
462
  let i = r;
450
- if (e === M) {
463
+ if (e === P) {
451
464
  let e = typeof i.name == "string" ? i.name : void 0;
452
465
  if (!e) return n;
453
466
  let t = i.arguments;
@@ -465,32 +478,32 @@ function P(e, t) {
465
478
  }
466
479
  //#endregion
467
480
  //#region src/utils/table.ts
468
- var F = 5, I = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(I).join(""), L = (e) => {
481
+ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(R).join(""), z = (e) => {
469
482
  if (e.tagName === "a" && e.properties?.href) return e.properties.href;
470
483
  for (let t of e.children ?? []) {
471
- let e = L(t);
484
+ let e = z(t);
472
485
  if (e) return e;
473
486
  }
474
- }, R = (e, t) => (e.children ?? []).find((e) => e.tagName === t), z = (e) => {
475
- let t = I(e), n = L(e);
487
+ }, B = (e, t) => (e.children ?? []).find((e) => e.tagName === t), V = (e) => {
488
+ let t = R(e), n = z(e);
476
489
  return n ? {
477
490
  text: t,
478
491
  href: n
479
492
  } : { text: t };
480
- }, B = (e) => (e.children ?? []).filter((e) => e.type === "element").map(z), V = (e) => {
493
+ }, H = (e) => (e.children ?? []).filter((e) => e.type === "element").map(V), U = (e) => {
481
494
  if (e.tagName !== "table") return null;
482
- let t = R(e, "thead"), n = t && R(t, "tr");
495
+ let t = B(e, "thead"), n = t && B(t, "tr");
483
496
  return {
484
- headers: n ? B(n).map((e) => e.text) : [],
485
- rows: (R(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(B)
497
+ headers: n ? H(n).map((e) => e.text) : [],
498
+ rows: (B(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(H)
486
499
  };
487
- }, H = (e) => e.length > 5, ee = "When a chart would help answer a question (e.g. plotting a trend over time), include a fenced code block tagged `chartjs` containing a JSON object with this exact shape: {\"type\": \"bar\" | \"line\" | \"pie\" | \"doughnut\" | \"scatter\", \"title\"?: string, \"data\": {\"labels\": string[], \"datasets\": [{\"label\": string, \"data\": number[]}]}}. For \"scatter\" charts, omit \"labels\" and give each dataset \"data\" as an array of {\"x\": number, \"y\": number} points instead of a number array. \"pie\" and \"doughnut\" charts must have exactly one dataset. Do not include any other fields (no \"options\", no colors) — the app handles styling. Example:\n```chartjs\n{\"type\": \"line\", \"title\": \"BP readings\", \"data\": {\"labels\": [\"Jul 14\", \"Jul 21\", \"Jul 28\"], \"datasets\": [{\"label\": \"Systolic\", \"data\": [120, 118, 122]}]}}\n```", U = [
500
+ }, W = (e) => e.length > 5, G = "When a chart would help answer a question (e.g. plotting a trend over time), include a fenced code block tagged `chartjs` containing a JSON object with this exact shape: {\"type\": \"bar\" | \"line\" | \"pie\" | \"doughnut\" | \"scatter\", \"title\"?: string, \"data\": {\"labels\": string[], \"datasets\": [{\"label\": string, \"data\": number[]}]}}. For \"scatter\" charts, omit \"labels\" and give each dataset \"data\" as an array of {\"x\": number, \"y\": number} points instead of a number array. \"pie\" and \"doughnut\" charts must have exactly one dataset. Do not include any other fields (no \"options\", no colors) — the app handles styling. Example:\n```chartjs\n{\"type\": \"line\", \"title\": \"BP readings\", \"data\": {\"labels\": [\"Jul 14\", \"Jul 21\", \"Jul 28\"], \"datasets\": [{\"label\": \"Systolic\", \"data\": [120, 118, 122]}]}}\n```", K = [
488
501
  "bar",
489
502
  "line",
490
503
  "pie",
491
504
  "doughnut",
492
505
  "scatter"
493
- ], te = 8, W = 50, G = 8, K = 500, ne = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", re = (e) => {
506
+ ], q = 8, J = 50, te = 8, ne = 500, re = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", ie = (e) => {
494
507
  let t;
495
508
  try {
496
509
  t = JSON.parse(e);
@@ -499,17 +512,17 @@ var F = 5, I = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
499
512
  }
500
513
  if (typeof t != "object" || !t) return null;
501
514
  let n = t;
502
- if (typeof n.type != "string" || !U.includes(n.type)) return null;
515
+ if (typeof n.type != "string" || !K.includes(n.type)) return null;
503
516
  let r = n.type;
504
517
  if (n.title !== void 0 && typeof n.title != "string") return null;
505
518
  let i = n.title;
506
519
  if (typeof n.data != "object" || n.data === null) return null;
507
520
  let a = n.data;
508
- if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > te || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
521
+ if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > q || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
509
522
  for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
510
523
  let o = a.datasets;
511
524
  if (r === "scatter") {
512
- for (let e of o) if (e.data.length < 1 || e.data.length > K || !e.data.every(ne)) return null;
525
+ for (let e of o) if (e.data.length < 1 || e.data.length > ne || !e.data.every(re)) return null;
513
526
  return {
514
527
  type: r,
515
528
  title: i,
@@ -517,7 +530,7 @@ var F = 5, I = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
517
530
  };
518
531
  }
519
532
  if (!Array.isArray(a.labels) || !a.labels.every((e) => typeof e == "string")) return null;
520
- let s = a.labels, c = r === "pie" || r === "doughnut" ? G : W;
533
+ let s = a.labels, c = r === "pie" || r === "doughnut" ? te : J;
521
534
  if (s.length < 1 || s.length > c) return null;
522
535
  for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
523
536
  return {
@@ -528,7 +541,7 @@ var F = 5, I = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
528
541
  datasets: o
529
542
  }
530
543
  };
531
- }, ie = {
544
+ }, ae = {
532
545
  tool_start: "Tool start",
533
546
  tool_end: "Tool end",
534
547
  pseudo_tool_call: "Narrated tool call",
@@ -537,13 +550,13 @@ var F = 5, I = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
537
550
  error: "Error",
538
551
  raw: "Raw event"
539
552
  };
540
- function q(e) {
541
- return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : P(e.name, e.args);
553
+ function Y(e) {
554
+ return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : I(e.name, e.args);
542
555
  }
543
- function J(e, t = q(e)) {
556
+ function X(e, t = Y(e)) {
544
557
  return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
545
558
  }
546
- function ae(e, t = q(e)) {
559
+ function oe(e, t = Y(e)) {
547
560
  switch (e.kind) {
548
561
  case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
549
562
  case "tool_end": return `${t.viaCallTool ? `${t.name} (via call_tool)` : t.name}${e.runtimeSeconds === void 0 ? "" : ` — ${e.runtimeSeconds.toFixed(2)}s`}${e.isError ? " — failed" : ""}`;
@@ -554,20 +567,20 @@ function ae(e, t = q(e)) {
554
567
  case "raw": return `Unrecognized event: ${e.eventType}`;
555
568
  }
556
569
  }
557
- function oe(e, t = q(e)) {
570
+ function se(e, t = Y(e)) {
558
571
  return e.kind === "tool_start" || e.kind === "tool_end" ? t.args ? JSON.stringify(t.args, null, 2) : e.args ?? null : e.kind === "pseudo_tool_call" ? e.args ?? null : null;
559
572
  }
560
- function se(e) {
573
+ function ce(e) {
561
574
  return e.kind === "tool_end" ? e.output ?? null : null;
562
575
  }
563
- function ce(e) {
576
+ function le(e) {
564
577
  return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
565
578
  }
566
- function Y(e) {
579
+ function Z(e) {
567
580
  switch (e.kind) {
568
- case "tool_start": return `Calling ${P(e.name, e.args).name}...`;
581
+ case "tool_start": return `Calling ${I(e.name, e.args).name}...`;
569
582
  case "tool_end": {
570
- let t = P(e.name, e.args).name;
583
+ let t = I(e.name, e.args).name;
571
584
  return e.isError ? `${t} failed` : `${t} returned`;
572
585
  }
573
586
  case "pseudo_tool_call": return `${e.name} (written as text, not called)`;
@@ -577,11 +590,11 @@ function Y(e) {
577
590
  case "raw": return `Unrecognized event: ${e.eventType}`;
578
591
  }
579
592
  }
580
- function le(e) {
593
+ function ue(e) {
581
594
  let t = new Date(e);
582
595
  return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}:${String(t.getSeconds()).padStart(2, "0")}.${String(t.getMilliseconds()).padStart(3, "0")}`;
583
596
  }
584
- function ue(e) {
597
+ function de(e) {
585
598
  if (e <= 0) return "+0ms";
586
599
  if (e < 1e3) return `+${Math.round(e)}ms`;
587
600
  let t = e / 1e3;
@@ -589,30 +602,30 @@ function ue(e) {
589
602
  let n = Math.floor(t / 60), r = Math.round(t % 60);
590
603
  return `+${n}m${String(r).padStart(2, "0")}s`;
591
604
  }
592
- function de(e) {
605
+ function fe(e) {
593
606
  return e.map((t, n) => {
594
- let r = q(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
607
+ let r = Y(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
595
608
  return {
596
609
  key: `${t.at}-${n}`,
597
610
  kind: t.kind,
598
- toolName: J(t, r),
611
+ toolName: X(t, r),
599
612
  isToolStart: t.kind === "tool_start",
600
613
  failed: t.kind === "tool_end" && t.isError === !0,
601
- time: le(t.at),
614
+ time: ue(t.at),
602
615
  gapMs: t.at - i,
603
- label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : ie[t.kind],
604
- summary: ae(t, r),
605
- argsDetail: oe(t, r),
606
- outputDetail: se(t),
607
- rawDetail: ce(t)
616
+ label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : ae[t.kind],
617
+ summary: oe(t, r),
618
+ argsDetail: se(t, r),
619
+ outputDetail: ce(t),
620
+ rawDetail: le(t)
608
621
  };
609
622
  });
610
623
  }
611
- function fe(e) {
624
+ function pe(e) {
612
625
  let t = e.filter((e) => e.kind === "tool_end"), n = t.filter((e) => e.kind === "tool_end" && e.isError), r = e.filter((e) => e.kind === "error"), i = [];
613
626
  return t.length > 0 && i.push(`${t.length} tool call${t.length === 1 ? "" : "s"}` + (n.length > 0 ? `, ${n.length} failed` : "")), r.length > 0 && i.push(`${r.length} stream error${r.length === 1 ? "" : "s"}`), i.join(" · ");
614
627
  }
615
- function pe(e) {
628
+ function me(e) {
616
629
  let t = [];
617
630
  for (let n of e) {
618
631
  let e = t[t.length - 1];
@@ -631,103 +644,103 @@ function pe(e) {
631
644
  }
632
645
  return t;
633
646
  }
634
- function me(e) {
647
+ function he(e) {
635
648
  return e.some((e) => e.kind === "tool_end" && e.isError || e.kind === "error");
636
649
  }
637
- function he(e, t) {
650
+ function ge(e, t) {
638
651
  return t === void 0 ? [] : e.filter((e) => e.turnSentAt === t && (e.kind === "tool_end" || e.kind === "pseudo_tool_call" || e.kind === "progress")).map((e, t) => ({
639
652
  key: `${e.at}-${t}`,
640
- text: Y(e),
641
- toolName: J(e)
653
+ text: Z(e),
654
+ toolName: X(e)
642
655
  }));
643
656
  }
644
657
  //#endregion
645
658
  //#region src/styles.css?inline
646
- var ge = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-border-style:solid;--tw-leading:initial;--tw-space-y-reverse:0}}}@layer theme{:root,:host{--font-sans:\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--color-red-100:oklch(93.6% .032 17.717);--color-green-100:oklch(96.2% .044 156.743);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-700:oklch(48.8% .243 264.376);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-700:oklch(49.6% .265 301.924);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-md:.375rem;--radius-2xl:1rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-bailey-accent:#4f46e5;--color-bailey-bubble-bg:#fff;--color-bailey-error:#d32f2f;--color-bailey-border:#e5e5e5;--color-bailey-surface:#fff;--color-bailey-surface-muted:#f9fafb;--color-bailey-text:#000;--color-bailey-text-secondary:#6b6b6b;--color-bailey-tooltip-bg:#000;--color-bailey-tooltip-text:#fff;--color-bailey-page-bg:#eceef4;--color-bailey-heart:#16a34a}}@layer utilities;.bailey-chat-panel{box-sizing:border-box;background-color:var(--color-bailey-page-bg);height:100%;padding:calc(var(--spacing) * 3);font-family:var(--font-sans);flex-direction:column;display:flex}.bailey-chat-panel-inner{width:100%;min-height:0;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;flex:1;margin-inline:auto;display:flex;overflow-y:auto}.bailey-toolbar-row{justify-content:flex-end;align-items:center;gap:calc(var(--spacing) * 3);display:flex}.bailey-new-chat-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-new-chat-button:hover{text-decoration-line:underline}}.bailey-new-chat-button:disabled{cursor:default;opacity:.5;text-decoration-line:none}.bailey-history-button{height:calc(var(--spacing) * 8);width:calc(var(--spacing) * 8);color:var(--color-gray-700);border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-history-button:hover{background-color:var(--color-gray-100)}}.bailey-history-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-chat-transcript{min-height:0;padding:calc(var(--spacing) * 2);padding-bottom:calc(var(--spacing) * 4);flex:1;overflow-y:auto}.bailey-message-row{margin-bottom:calc(var(--spacing) * 3);justify-content:flex-start;display:flex}.bailey-message-row-user{justify-content:flex-end}.bailey-user-message{flex-direction:column;align-items:flex-end;max-width:75%;display:flex}.bailey-message-meta{margin-bottom:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-message-meta-name{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-text)}.bailey-user-bubble{border-radius:var(--radius-2xl);background-color:var(--color-bailey-bubble-bg);max-width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);white-space:pre-wrap;color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.bailey-assistant-message{width:100%;padding-inline:var(--spacing)}.bailey-thinking-hint{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic}.bailey-streaming-hint{margin-top:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:block}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);display:flex}.bailey-empty-state{text-align:center;height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-activity-line{margin-bottom:calc(var(--spacing) * 2);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}", _e = t(void 0), ve = /:root\s*,\s*:host\s*\{/, ye = ".bailey-chat-panel{";
647
- function be(e) {
648
- let t = e.match(new RegExp(ve, "g"))?.length ?? 0;
659
+ var _e = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-border-style:solid;--tw-leading:initial;--tw-space-y-reverse:0}}}@layer theme{:root,:host{--font-sans:\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--color-red-100:oklch(93.6% .032 17.717);--color-green-100:oklch(96.2% .044 156.743);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-700:oklch(48.8% .243 264.376);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-700:oklch(49.6% .265 301.924);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-2xl:1rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-bailey-accent:#4f46e5;--color-bailey-bubble-bg:#fff;--color-bailey-error:#d32f2f;--color-bailey-border:#e5e5e5;--color-bailey-surface:#fff;--color-bailey-surface-muted:#f9fafb;--color-bailey-text:#000;--color-bailey-text-secondary:#6b6b6b;--color-bailey-tooltip-bg:#000;--color-bailey-tooltip-text:#fff;--color-bailey-page-bg:#eceef4;--color-bailey-heart:#16a34a}}@layer utilities;.bailey-chat-panel{box-sizing:border-box;background-color:var(--color-bailey-page-bg);height:100%;padding:calc(var(--spacing) * 3);font-family:var(--font-sans);flex-direction:column;display:flex}.bailey-chat-panel-inner{width:100%;min-height:0;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;flex:1;margin-inline:auto;display:flex;overflow-y:auto}.bailey-toolbar-row{justify-content:flex-end;align-items:center;gap:calc(var(--spacing) * 3);display:flex}.bailey-new-chat-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-new-chat-button:hover{text-decoration-line:underline}}.bailey-new-chat-button:disabled{cursor:default;opacity:.5;text-decoration-line:none}.bailey-history-button{height:calc(var(--spacing) * 8);width:calc(var(--spacing) * 8);color:var(--color-gray-700);border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-history-button:hover{background-color:var(--color-gray-100)}}.bailey-history-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-chat-transcript{min-height:0;padding:calc(var(--spacing) * 2);padding-bottom:calc(var(--spacing) * 4);flex:1;overflow-y:auto}.bailey-message-row{margin-bottom:calc(var(--spacing) * 3);justify-content:flex-start;display:flex}.bailey-message-row-user{justify-content:flex-end}.bailey-user-message{flex-direction:column;align-items:flex-end;max-width:75%;display:flex}.bailey-message-meta{margin-bottom:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-message-meta-name{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-text)}.bailey-user-bubble{border-radius:var(--radius-2xl);background-color:var(--color-bailey-bubble-bg);max-width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);white-space:pre-wrap;color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.bailey-assistant-message{width:100%;padding-inline:var(--spacing)}.bailey-tool-result-image{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);max-width:100%;height:auto;display:block}.bailey-thinking-hint{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic}.bailey-streaming-hint{margin-top:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:block}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);display:flex}.bailey-empty-state{text-align:center;height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-activity-line{margin-bottom:calc(var(--spacing) * 2);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}", ve = n(void 0), ye = /:root\s*,\s*:host\s*\{/, be = ".bailey-chat-panel{";
660
+ function xe(e) {
661
+ let t = e.match(new RegExp(ye, "g"))?.length ?? 0;
649
662
  if (t !== 1) throw Error(`Expected exactly one ":root, :host {" rule in the compiled styles.css, found ${t}. Tailwind likely changed how @theme compiles — update this rewrite (and its sibling, scripts/scope-theme-vars.js) before shipping.`);
650
- return e.replace(ve, ye);
663
+ return e.replace(ye, be);
651
664
  }
652
- var xe = be(ge), X = "data-source", Z = "baileyai-chat-ui", Q = /* @__PURE__ */ new WeakMap();
653
- function Se(e) {
665
+ var Se = xe(_e), Ce = "data-source", we = "baileyai-chat-ui", Q = /* @__PURE__ */ new WeakMap();
666
+ function Te(e) {
654
667
  let t = e.getRootNode();
655
668
  return t instanceof ShadowRoot ? t : document;
656
669
  }
657
- function Ce(e) {
670
+ function Ee(e) {
658
671
  let t = e instanceof ShadowRoot ? e : document.head, n = Q.get(e) ?? 0;
659
- if (n === 0 && !t.querySelector(`style[${X}="${Z}"]`)) {
672
+ if (n === 0 && !t.querySelector(`style[${Ce}="${we}"]`)) {
660
673
  let e = document.createElement("style");
661
- e.setAttribute(X, Z), e.textContent = xe, t.appendChild(e);
674
+ e.setAttribute(Ce, we), e.textContent = Se, t.appendChild(e);
662
675
  }
663
676
  return Q.set(e, n + 1), () => {
664
677
  let n = (Q.get(e) ?? 1) - 1;
665
- n <= 0 ? (Q.delete(e), t.querySelector(`style[${X}="${Z}"]`)?.remove()) : Q.set(e, n);
678
+ n <= 0 ? (Q.delete(e), t.querySelector(`style[${Ce}="${we}"]`)?.remove()) : Q.set(e, n);
666
679
  };
667
680
  }
668
- function we(e, t = !1) {
669
- let [n, r] = l(null);
670
- return o(() => {
681
+ function De(e, t = !1) {
682
+ let [n, r] = u(null);
683
+ return s(() => {
671
684
  if (t) return;
672
685
  let n = e.current;
673
686
  if (!n) return;
674
- let i = Se(n);
675
- return r(i), Ce(i);
687
+ let i = Te(n);
688
+ return r(i), Ee(i);
676
689
  }, [t, e]), n;
677
690
  }
678
- function Te(e) {
679
- let t = i(_e), n = t !== void 0, r = we(e, n);
691
+ function Oe(e) {
692
+ let t = a(ve), n = t !== void 0, r = De(e, n);
680
693
  return n ? t : r;
681
694
  }
682
695
  //#endregion
683
696
  //#region src/ui/markdown.tsx
684
- function Ee({ renderTable: t, renderChart: n } = {}) {
697
+ function ke({ renderTable: t, renderChart: n } = {}) {
685
698
  return {
686
- a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ m(p, { children: n }) : /* @__PURE__ */ m("a", {
699
+ a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ h(m, { children: n }) : /* @__PURE__ */ h("a", {
687
700
  href: t,
688
701
  target: "_blank",
689
702
  rel: "noopener noreferrer",
690
703
  children: n
691
704
  }),
692
705
  table: ({ node: n, children: r }) => {
693
- let i = n && V(n);
694
- if (i && H(i.rows) && t) {
706
+ let i = n && U(n);
707
+ if (i && W(i.rows) && t) {
695
708
  let n = i.rows.map((t) => t.map((t) => t.href && !e(t.href) ? { text: t.text } : t));
696
- return /* @__PURE__ */ m(p, { children: t({
709
+ return /* @__PURE__ */ h(m, { children: t({
697
710
  headers: i.headers,
698
711
  rows: n
699
712
  }) });
700
713
  }
701
- return /* @__PURE__ */ m("table", { children: r });
714
+ return /* @__PURE__ */ h("table", { children: r });
702
715
  },
703
716
  pre: ({ children: e }) => {
704
717
  let t = (Array.isArray(e) ? e[0] : e)?.props;
705
718
  if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
706
- let e = t?.children, r = re(Array.isArray(e) ? e.join("") : String(e ?? ""));
707
- if (r) return /* @__PURE__ */ m(p, { children: n(r) });
719
+ let e = t?.children, r = ie(Array.isArray(e) ? e.join("") : String(e ?? ""));
720
+ if (r) return /* @__PURE__ */ h(m, { children: n(r) });
708
721
  }
709
- return /* @__PURE__ */ m("pre", { children: e });
722
+ return /* @__PURE__ */ h("pre", { children: e });
710
723
  }
711
724
  };
712
725
  }
713
726
  //#endregion
714
727
  //#region src/ui/icons.tsx
715
- function De({ className: e }) {
716
- return /* @__PURE__ */ m("svg", {
728
+ function Ae({ className: e }) {
729
+ return /* @__PURE__ */ h("svg", {
717
730
  viewBox: "0 0 24 24",
718
731
  fill: "currentColor",
719
732
  className: e,
720
733
  "aria-hidden": "true",
721
- children: /* @__PURE__ */ m("path", { d: "M12 20.3s-7.6-4.7-10-9.4C.4 7.7 1.7 4 5.2 3.1c2.2-.6 4.4.4 5.5 2.2 1.2-1.8 3.4-2.8 5.6-2.2 3.5.9 4.8 4.6 3.2 7.8-2.4 4.7-10 9.4-10 9.4z" })
734
+ children: /* @__PURE__ */ h("path", { d: "M12 20.3s-7.6-4.7-10-9.4C.4 7.7 1.7 4 5.2 3.1c2.2-.6 4.4.4 5.5 2.2 1.2-1.8 3.4-2.8 5.6-2.2 3.5.9 4.8 4.6 3.2 7.8-2.4 4.7-10 9.4-10 9.4z" })
722
735
  });
723
736
  }
724
- function Oe({ className: e }) {
725
- return /* @__PURE__ */ m("svg", {
737
+ function je({ className: e }) {
738
+ return /* @__PURE__ */ h("svg", {
726
739
  viewBox: "0 0 24 24",
727
740
  fill: "currentColor",
728
741
  className: e,
729
742
  "aria-hidden": "true",
730
- children: /* @__PURE__ */ m("rect", {
743
+ children: /* @__PURE__ */ h("rect", {
731
744
  x: "6",
732
745
  y: "6",
733
746
  width: "12",
@@ -736,8 +749,8 @@ function Oe({ className: e }) {
736
749
  })
737
750
  });
738
751
  }
739
- function ke({ className: e }) {
740
- return /* @__PURE__ */ h("svg", {
752
+ function Me({ className: e }) {
753
+ return /* @__PURE__ */ g("svg", {
741
754
  viewBox: "0 0 24 24",
742
755
  fill: "none",
743
756
  stroke: "currentColor",
@@ -746,11 +759,11 @@ function ke({ className: e }) {
746
759
  strokeLinejoin: "round",
747
760
  className: e,
748
761
  "aria-hidden": "true",
749
- children: [/* @__PURE__ */ m("path", { d: "M7 17 17 7" }), /* @__PURE__ */ m("path", { d: "M9 7h8v8" })]
762
+ children: [/* @__PURE__ */ h("path", { d: "M7 17 17 7" }), /* @__PURE__ */ h("path", { d: "M9 7h8v8" })]
750
763
  });
751
764
  }
752
- function Ae({ className: e }) {
753
- return /* @__PURE__ */ h("svg", {
765
+ function Ne({ className: e }) {
766
+ return /* @__PURE__ */ g("svg", {
754
767
  viewBox: "0 0 24 24",
755
768
  fill: "none",
756
769
  stroke: "currentColor",
@@ -759,17 +772,17 @@ function Ae({ className: e }) {
759
772
  strokeLinejoin: "round",
760
773
  className: e,
761
774
  "aria-hidden": "true",
762
- children: [/* @__PURE__ */ m("rect", {
775
+ children: [/* @__PURE__ */ h("rect", {
763
776
  x: "8",
764
777
  y: "8",
765
778
  width: "12",
766
779
  height: "12",
767
780
  rx: "2"
768
- }), /* @__PURE__ */ m("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
781
+ }), /* @__PURE__ */ h("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
769
782
  });
770
783
  }
771
- function je({ className: e }) {
772
- return /* @__PURE__ */ m("svg", {
784
+ function Pe({ className: e }) {
785
+ return /* @__PURE__ */ h("svg", {
773
786
  viewBox: "0 0 24 24",
774
787
  fill: "none",
775
788
  stroke: "currentColor",
@@ -778,11 +791,11 @@ function je({ className: e }) {
778
791
  strokeLinejoin: "round",
779
792
  className: e,
780
793
  "aria-hidden": "true",
781
- children: /* @__PURE__ */ m("path", { d: "M5 12.5 9.5 17 19 7" })
794
+ children: /* @__PURE__ */ h("path", { d: "M5 12.5 9.5 17 19 7" })
782
795
  });
783
796
  }
784
- function Me({ className: e }) {
785
- return /* @__PURE__ */ m("svg", {
797
+ function Fe({ className: e }) {
798
+ return /* @__PURE__ */ h("svg", {
786
799
  viewBox: "0 0 24 24",
787
800
  fill: "none",
788
801
  stroke: "currentColor",
@@ -791,11 +804,11 @@ function Me({ className: e }) {
791
804
  strokeLinejoin: "round",
792
805
  className: e,
793
806
  "aria-hidden": "true",
794
- children: /* @__PURE__ */ m("path", { d: "m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2" })
807
+ children: /* @__PURE__ */ h("path", { d: "m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2" })
795
808
  });
796
809
  }
797
- function Ne({ className: e }) {
798
- return /* @__PURE__ */ h("svg", {
810
+ function Ie({ className: e }) {
811
+ return /* @__PURE__ */ g("svg", {
799
812
  viewBox: "0 0 24 24",
800
813
  fill: "none",
801
814
  stroke: "currentColor",
@@ -804,29 +817,29 @@ function Ne({ className: e }) {
804
817
  strokeLinejoin: "round",
805
818
  className: e,
806
819
  "aria-hidden": "true",
807
- children: [/* @__PURE__ */ m("circle", {
820
+ children: [/* @__PURE__ */ h("circle", {
808
821
  cx: "12",
809
822
  cy: "12",
810
823
  r: "9"
811
- }), /* @__PURE__ */ m("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
824
+ }), /* @__PURE__ */ h("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
812
825
  });
813
826
  }
814
827
  //#endregion
815
828
  //#region src/ui/CopyMarkdownButton.tsx
816
- var Pe = 1500;
817
- function Fe({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
818
- let [o, s] = l(!1), [u, d] = l(!1), p = c(null), g = c(null), _ = Te(g);
819
- return a(() => () => {
820
- p.current !== null && clearTimeout(p.current);
821
- }, []), /* @__PURE__ */ m(f.Provider, {
829
+ var Le = 1500;
830
+ function Re({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
831
+ let [a, s] = u(!1), [c, d] = u(!1), f = l(null), m = l(null), _ = Oe(m);
832
+ return o(() => () => {
833
+ f.current !== null && clearTimeout(f.current);
834
+ }, []), /* @__PURE__ */ h(p.Provider, {
822
835
  delayDuration: 200,
823
- children: /* @__PURE__ */ h(f.Root, {
824
- open: o || u,
836
+ children: /* @__PURE__ */ g(p.Root, {
837
+ open: a || c,
825
838
  onOpenChange: d,
826
- children: [/* @__PURE__ */ m(f.Trigger, {
839
+ children: [/* @__PURE__ */ h(p.Trigger, {
827
840
  asChild: !0,
828
- children: /* @__PURE__ */ m("button", {
829
- ref: g,
841
+ children: /* @__PURE__ */ h("button", {
842
+ ref: m,
830
843
  type: "button",
831
844
  onClick: async () => {
832
845
  try {
@@ -834,18 +847,18 @@ function Fe({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
834
847
  } catch {
835
848
  return;
836
849
  }
837
- s(!0), p.current !== null && clearTimeout(p.current), p.current = setTimeout(() => s(!1), Pe);
850
+ s(!0), f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => s(!1), Le);
838
851
  },
839
852
  "aria-label": n,
840
853
  className: `bailey-copy-button${t ? ` ${t}` : ""}`,
841
- children: m(o ? je : Ae, { className: "bailey-copy-icon" })
854
+ children: h(a ? Pe : Ne, { className: "bailey-copy-icon" })
842
855
  })
843
- }), /* @__PURE__ */ m(f.Portal, {
856
+ }), /* @__PURE__ */ h(p.Portal, {
844
857
  container: _ instanceof ShadowRoot ? _ : void 0,
845
- children: /* @__PURE__ */ h(f.Content, {
858
+ children: /* @__PURE__ */ g(p.Content, {
846
859
  side: "top",
847
860
  className: "bailey-tooltip-content",
848
- children: [o ? i : r, /* @__PURE__ */ m(f.Arrow, { className: "bailey-tooltip-arrow" })]
861
+ children: [a ? i : r, /* @__PURE__ */ h(p.Arrow, { className: "bailey-tooltip-arrow" })]
849
862
  })
850
863
  })]
851
864
  })
@@ -853,20 +866,20 @@ function Fe({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
853
866
  }
854
867
  //#endregion
855
868
  //#region src/ui/BaileyTracePanel.tsx
856
- async function Ie(e) {
869
+ async function ze(e) {
857
870
  try {
858
871
  await navigator.clipboard.writeText(e);
859
872
  } catch {}
860
873
  }
861
- function Le({ text: e, label: t = "Copy" }) {
862
- return /* @__PURE__ */ m("button", {
874
+ function Be({ text: e, label: t = "Copy" }) {
875
+ return /* @__PURE__ */ h("button", {
863
876
  type: "button",
864
- onClick: () => Ie(e),
877
+ onClick: () => ze(e),
865
878
  className: "bailey-trace-copy-button",
866
879
  children: t
867
880
  });
868
881
  }
869
- function Re(e) {
882
+ function Ve(e) {
870
883
  if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
871
884
  switch (e.kind) {
872
885
  case "tool_start": return "bailey-trace-chip bailey-trace-chip-info";
@@ -876,73 +889,73 @@ function Re(e) {
876
889
  }
877
890
  }
878
891
  function $({ label: e, content: t, copyable: n }) {
879
- return /* @__PURE__ */ h("details", {
892
+ return /* @__PURE__ */ g("details", {
880
893
  className: "bailey-trace-disclosure",
881
894
  children: [
882
- /* @__PURE__ */ m("summary", {
895
+ /* @__PURE__ */ h("summary", {
883
896
  className: "bailey-trace-disclosure-summary",
884
897
  children: e
885
898
  }),
886
- n && /* @__PURE__ */ m("div", {
899
+ n && /* @__PURE__ */ h("div", {
887
900
  className: "bailey-trace-disclosure-actions",
888
- children: /* @__PURE__ */ m(Le, { text: t })
901
+ children: /* @__PURE__ */ h(Be, { text: t })
889
902
  }),
890
- /* @__PURE__ */ m("pre", {
903
+ /* @__PURE__ */ h("pre", {
891
904
  className: "bailey-trace-disclosure-content",
892
905
  children: t
893
906
  })
894
907
  ]
895
908
  });
896
909
  }
897
- function ze({ row: e }) {
898
- return /* @__PURE__ */ h("div", {
910
+ function He({ row: e }) {
911
+ return /* @__PURE__ */ g("div", {
899
912
  className: "bailey-trace-row",
900
913
  children: [
901
- /* @__PURE__ */ h("div", {
914
+ /* @__PURE__ */ g("div", {
902
915
  className: "bailey-trace-row-header",
903
916
  children: [
904
- /* @__PURE__ */ m("span", {
917
+ /* @__PURE__ */ h("span", {
905
918
  className: "bailey-trace-row-time",
906
919
  children: e.time
907
920
  }),
908
- /* @__PURE__ */ m("span", {
921
+ /* @__PURE__ */ h("span", {
909
922
  className: "bailey-trace-row-gap",
910
923
  title: "Time since the previous event",
911
- children: ue(e.gapMs)
924
+ children: de(e.gapMs)
912
925
  }),
913
- /* @__PURE__ */ m("span", {
914
- className: Re(e),
926
+ /* @__PURE__ */ h("span", {
927
+ className: Ve(e),
915
928
  children: e.label
916
929
  }),
917
- /* @__PURE__ */ m("span", {
930
+ /* @__PURE__ */ h("span", {
918
931
  className: "bailey-trace-row-summary",
919
932
  children: e.summary
920
933
  })
921
934
  ]
922
935
  }),
923
- e.argsDetail && /* @__PURE__ */ m($, {
936
+ e.argsDetail && /* @__PURE__ */ h($, {
924
937
  label: "args",
925
938
  content: e.argsDetail
926
939
  }),
927
- e.outputDetail && /* @__PURE__ */ m($, {
940
+ e.outputDetail && /* @__PURE__ */ h($, {
928
941
  label: "output",
929
942
  content: e.outputDetail
930
943
  }),
931
- e.rawDetail && /* @__PURE__ */ m($, {
944
+ e.rawDetail && /* @__PURE__ */ h($, {
932
945
  label: "raw",
933
946
  content: e.rawDetail
934
947
  })
935
948
  ]
936
949
  });
937
950
  }
938
- function Be(e, t) {
951
+ function Ue(e, t) {
939
952
  if (e.chunkCount === 0) return "Streamed: no chunks received";
940
953
  if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
941
954
  let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
942
955
  return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
943
956
  }
944
- function Ve({ request: e }) {
945
- let t = s(() => JSON.stringify({
957
+ function We({ request: e }) {
958
+ let t = c(() => JSON.stringify({
946
959
  model: e.model,
947
960
  instructions: e.systemPrompt,
948
961
  input: e.messages,
@@ -950,10 +963,10 @@ function Ve({ request: e }) {
950
963
  tools: e.tools,
951
964
  toolChoice: e.toolChoice
952
965
  }, null, 2), [e]);
953
- return /* @__PURE__ */ h("div", {
966
+ return /* @__PURE__ */ g("div", {
954
967
  className: "bailey-trace-request-details",
955
968
  children: [
956
- /* @__PURE__ */ h("span", {
969
+ /* @__PURE__ */ g("span", {
957
970
  className: "bailey-trace-request-meta",
958
971
  children: [
959
972
  "Last request — ",
@@ -963,26 +976,26 @@ function Ve({ request: e }) {
963
976
  e.requestId ? ` · ${e.requestId}` : ""
964
977
  ]
965
978
  }),
966
- /* @__PURE__ */ m("span", {
979
+ /* @__PURE__ */ h("span", {
967
980
  className: "bailey-trace-request-meta",
968
- children: Be(e.streamStats, e.sentAt)
981
+ children: Ue(e.streamStats, e.sentAt)
969
982
  }),
970
- /* @__PURE__ */ m($, {
983
+ /* @__PURE__ */ h($, {
971
984
  label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
972
985
  content: e.systemPrompt,
973
986
  copyable: !0
974
987
  }),
975
- /* @__PURE__ */ m($, {
988
+ /* @__PURE__ */ h($, {
976
989
  label: `Messages (${e.messages.length})`,
977
990
  content: JSON.stringify(e.messages, null, 2),
978
991
  copyable: !0
979
992
  }),
980
- e.response && /* @__PURE__ */ m($, {
993
+ e.response && /* @__PURE__ */ h($, {
981
994
  label: `Response (${e.response.content.length.toLocaleString()} chars)`,
982
995
  content: e.response.content,
983
996
  copyable: !0
984
997
  }),
985
- /* @__PURE__ */ m($, {
998
+ /* @__PURE__ */ h($, {
986
999
  label: "Full payload (JSON)",
987
1000
  content: t,
988
1001
  copyable: !0
@@ -990,43 +1003,43 @@ function Ve({ request: e }) {
990
1003
  ]
991
1004
  });
992
1005
  }
993
- function He({ events: e, lastRequest: t, onClear: n }) {
994
- let r = s(() => de(e), [e]), i = s(() => pe(r), [r]), a = s(() => JSON.stringify(e, null, 2), [e]);
995
- return /* @__PURE__ */ h("div", {
1006
+ function Ge({ events: e, lastRequest: t, onClear: n }) {
1007
+ let r = c(() => fe(e), [e]), i = c(() => me(r), [r]), a = c(() => JSON.stringify(e, null, 2), [e]);
1008
+ return /* @__PURE__ */ g("div", {
996
1009
  className: "bailey-trace-body",
997
1010
  children: [
998
- /* @__PURE__ */ h("div", {
1011
+ /* @__PURE__ */ g("div", {
999
1012
  className: "bailey-trace-actions-row",
1000
- children: [e.length > 0 && /* @__PURE__ */ m(Le, {
1013
+ children: [e.length > 0 && /* @__PURE__ */ h(Be, {
1001
1014
  text: a,
1002
1015
  label: "Copy trace as JSON"
1003
- }), /* @__PURE__ */ m("button", {
1016
+ }), /* @__PURE__ */ h("button", {
1004
1017
  type: "button",
1005
1018
  onClick: n,
1006
1019
  className: "bailey-trace-copy-button",
1007
1020
  children: "Clear"
1008
1021
  })]
1009
1022
  }),
1010
- t && /* @__PURE__ */ m(Ve, { request: t }),
1011
- /* @__PURE__ */ m("div", {
1023
+ t && /* @__PURE__ */ h(We, { request: t }),
1024
+ /* @__PURE__ */ h("div", {
1012
1025
  className: "bailey-trace-rows",
1013
1026
  children: i.map((e, t) => {
1014
- if (e.type === "single") return /* @__PURE__ */ m(ze, { row: e.row }, e.row.key);
1027
+ if (e.type === "single") return /* @__PURE__ */ h(He, { row: e.row }, e.row.key);
1015
1028
  let n = e.rows.filter((e) => e.isToolStart).length;
1016
- if (n <= 1) return /* @__PURE__ */ m("div", {
1029
+ if (n <= 1) return /* @__PURE__ */ h("div", {
1017
1030
  className: "bailey-trace-rows",
1018
- children: e.rows.map((e) => /* @__PURE__ */ m(ze, { row: e }, e.key))
1031
+ children: e.rows.map((e) => /* @__PURE__ */ h(He, { row: e }, e.key))
1019
1032
  }, `group-${t}`);
1020
1033
  let r = e.rows.filter((e) => e.failed).length;
1021
- return /* @__PURE__ */ h("details", {
1034
+ return /* @__PURE__ */ g("details", {
1022
1035
  className: "bailey-trace-group",
1023
- children: [/* @__PURE__ */ h("summary", {
1036
+ children: [/* @__PURE__ */ g("summary", {
1024
1037
  className: "bailey-trace-group-summary",
1025
1038
  children: [
1026
- /* @__PURE__ */ m("strong", { children: e.toolName }),
1039
+ /* @__PURE__ */ h("strong", { children: e.toolName }),
1027
1040
  " × ",
1028
1041
  n,
1029
- r > 0 && /* @__PURE__ */ h("span", {
1042
+ r > 0 && /* @__PURE__ */ g("span", {
1030
1043
  className: "bailey-trace-group-failed",
1031
1044
  children: [
1032
1045
  " ",
@@ -1035,9 +1048,9 @@ function He({ events: e, lastRequest: t, onClear: n }) {
1035
1048
  ]
1036
1049
  })
1037
1050
  ]
1038
- }), /* @__PURE__ */ m("div", {
1051
+ }), /* @__PURE__ */ h("div", {
1039
1052
  className: "bailey-trace-rows",
1040
- children: e.rows.map((e) => /* @__PURE__ */ m(ze, { row: e }, e.key))
1053
+ children: e.rows.map((e) => /* @__PURE__ */ h(He, { row: e }, e.key))
1041
1054
  })]
1042
1055
  }, `group-${t}`);
1043
1056
  })
@@ -1045,13 +1058,13 @@ function He({ events: e, lastRequest: t, onClear: n }) {
1045
1058
  ]
1046
1059
  });
1047
1060
  }
1048
- function Ue({ events: e, lastRequest: t, onClear: n }) {
1049
- let [r, i] = l(!1), a = s(() => me(e), [e]), o = s(() => fe(e), [e]);
1050
- return e.length === 0 && !t ? null : /* @__PURE__ */ h("div", {
1061
+ function Ke({ events: e, lastRequest: t, onClear: n }) {
1062
+ let [r, i] = u(!1), a = c(() => he(e), [e]), o = c(() => pe(e), [e]);
1063
+ return e.length === 0 && !t ? null : /* @__PURE__ */ g("div", {
1051
1064
  className: "bailey-trace-panel",
1052
- children: [/* @__PURE__ */ h("div", {
1065
+ children: [/* @__PURE__ */ g("div", {
1053
1066
  className: "bailey-trace-toggle-row",
1054
- children: [/* @__PURE__ */ h("button", {
1067
+ children: [/* @__PURE__ */ g("button", {
1055
1068
  type: "button",
1056
1069
  onClick: () => i((e) => !e),
1057
1070
  "aria-expanded": r,
@@ -1063,11 +1076,11 @@ function Ue({ events: e, lastRequest: t, onClear: n }) {
1063
1076
  e.length,
1064
1077
  ")"
1065
1078
  ]
1066
- }), o && /* @__PURE__ */ m("span", {
1079
+ }), o && /* @__PURE__ */ h("span", {
1067
1080
  className: a ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
1068
1081
  children: o
1069
1082
  })]
1070
- }), r && /* @__PURE__ */ m(He, {
1083
+ }), r && /* @__PURE__ */ h(Ge, {
1071
1084
  events: e,
1072
1085
  lastRequest: t,
1073
1086
  onClear: n
@@ -1075,8 +1088,18 @@ function Ue({ events: e, lastRequest: t, onClear: n }) {
1075
1088
  });
1076
1089
  }
1077
1090
  //#endregion
1091
+ //#region src/ui/ToolResultImage.tsx
1092
+ function qe({ src: e, alt: n, className: r }) {
1093
+ return t(e) ? /* @__PURE__ */ h("img", {
1094
+ src: e,
1095
+ alt: n ?? "",
1096
+ className: `bailey-tool-result-image${r ? ` ${r}` : ""}`,
1097
+ referrerPolicy: "no-referrer"
1098
+ }) : null;
1099
+ }
1100
+ //#endregion
1078
1101
  //#region src/ui/BaileyChatPanel.tsx
1079
- var We = "How can bailey AI help you today?", Ge = "Reply to bailey AI", Ke = {
1102
+ var Je = "How can bailey AI help you today?", Ye = "Reply to bailey AI", Xe = {
1080
1103
  newChatButtonText: "New chat",
1081
1104
  newChatAriaLabel: "new chat",
1082
1105
  historyAriaLabel: "conversation history",
@@ -1092,232 +1115,236 @@ var We = "How can bailey AI help you today?", Ge = "Reply to bailey AI", Ke = {
1092
1115
  copyButtonAriaLabel: "copy response as markdown",
1093
1116
  copyButtonTooltipDefault: "Copy as markdown",
1094
1117
  copyButtonTooltipCopied: "Copied!"
1095
- }, qe = [d], Je = {
1096
- ...Ee(),
1097
- p: ({ children: e }) => /* @__PURE__ */ m(p, { children: e })
1098
- }, Ye = n(function({ content: e, components: t }) {
1099
- return /* @__PURE__ */ m("div", {
1118
+ }, Ze = [f], Qe = {
1119
+ ...ke(),
1120
+ p: ({ children: e }) => /* @__PURE__ */ h(m, { children: e })
1121
+ }, $e = r(function({ content: e, components: t }) {
1122
+ return /* @__PURE__ */ h("div", {
1100
1123
  className: "bailey-markdown-content",
1101
- children: /* @__PURE__ */ m(u, {
1102
- remarkPlugins: qe,
1124
+ children: /* @__PURE__ */ h(d, {
1125
+ remarkPlugins: Ze,
1103
1126
  components: t,
1104
1127
  skipHtml: !0,
1105
1128
  children: e
1106
1129
  })
1107
1130
  });
1108
1131
  });
1109
- function Xe(e, t, n) {
1132
+ function et(e, t, n) {
1110
1133
  if (e !== "streaming") return;
1111
1134
  let r = t.filter((e) => e.turnSentAt === n?.sentAt);
1112
- if (r.length !== 0) return Y(r[r.length - 1]);
1135
+ if (r.length !== 0) return Z(r[r.length - 1]);
1113
1136
  }
1114
- function Ze(e) {
1137
+ function tt(e) {
1115
1138
  let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
1116
1139
  hour: "numeric",
1117
1140
  minute: "2-digit"
1118
1141
  });
1119
1142
  return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
1120
1143
  }
1121
- function Qe({ chat: e, placeholder: t, replyPlaceholder: n = Ge, emptyPlaceholder: r, suggestions: i, onHistoryClick: o, privacyNote: d, resolveActivityIcon: p, className: g, height: _, width: v, hideDeveloperDetails: y = !1, renderMessageActions: b, renderTable: x, renderChart: S, labels: C, formatMessageTime: w }) {
1122
- let { messages: T, traceEvents: E, lastRequest: D, status: O, error: k, send: A, stop: j, retryLast: M, clearTrace: N, clearError: P, newChat: F } = e, [I, L] = l(""), R = {
1123
- ...Ke,
1144
+ function nt({ chat: e, placeholder: t, replyPlaceholder: n = Ye, emptyPlaceholder: r, suggestions: i, onHistoryClick: a, privacyNote: s, resolveActivityIcon: f, className: m, height: _, width: v, hideDeveloperDetails: y = !1, renderMessageActions: b, renderTable: x, renderChart: S, labels: C, formatMessageTime: w }) {
1145
+ let { messages: T, traceEvents: E, lastRequest: D, status: O, error: k, send: A, stop: j, retryLast: ee, clearTrace: M, clearError: N, newChat: P } = e, [F, I] = u(""), L = {
1146
+ ...Xe,
1124
1147
  ...C
1125
- }, z = w ?? Ze, B = c(null), V = we(B), H = c(null), ee = c(null), U = c(!0), te = s(() => Ee({
1148
+ }, R = w ?? tt, z = l(null), B = De(z), V = l(null), H = l(null), U = l(!0), W = c(() => ke({
1126
1149
  renderTable: x,
1127
1150
  renderChart: S
1128
- }), [x, S]), W = s(() => Xe(O, E, D), [
1151
+ }), [x, S]), G = c(() => et(O, E, D), [
1129
1152
  O,
1130
1153
  E,
1131
1154
  D
1132
- ]), G = T.length === 0, K = t ?? (G ? r ?? We : n);
1133
- a(() => {
1134
- let e = ee.current;
1155
+ ]), K = T.length === 0, q = t ?? (K ? r ?? Je : n);
1156
+ o(() => {
1157
+ let e = H.current;
1135
1158
  if (!e) return;
1136
1159
  let t = () => {
1137
1160
  let t = e.scrollHeight - e.scrollTop - e.clientHeight;
1138
1161
  U.current = t < 60;
1139
1162
  };
1140
1163
  return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
1141
- }, []), a(() => {
1142
- U.current && H.current?.scrollIntoView({
1164
+ }, []), o(() => {
1165
+ U.current && V.current?.scrollIntoView({
1143
1166
  behavior: O === "streaming" ? "auto" : "smooth",
1144
1167
  block: "nearest"
1145
1168
  });
1146
1169
  }, [T, O]);
1147
- let ne = (e) => {
1170
+ let J = (e) => {
1148
1171
  U.current = !0, A(e);
1149
1172
  };
1150
- return /* @__PURE__ */ m(_e.Provider, {
1151
- value: V,
1152
- children: /* @__PURE__ */ m("div", {
1153
- ref: B,
1154
- className: `bailey-chat-panel${g ? ` ${g}` : ""}`,
1173
+ return /* @__PURE__ */ h(ve.Provider, {
1174
+ value: B,
1175
+ children: /* @__PURE__ */ h("div", {
1176
+ ref: z,
1177
+ className: `bailey-chat-panel${m ? ` ${m}` : ""}`,
1155
1178
  style: _ !== void 0 || v !== void 0 ? {
1156
1179
  height: _,
1157
1180
  width: v
1158
1181
  } : void 0,
1159
- children: /* @__PURE__ */ h("div", {
1182
+ children: /* @__PURE__ */ g("div", {
1160
1183
  className: "bailey-chat-panel-inner",
1161
1184
  children: [
1162
- /* @__PURE__ */ h("div", {
1185
+ /* @__PURE__ */ g("div", {
1163
1186
  className: "bailey-toolbar-row",
1164
- children: [!G && /* @__PURE__ */ m("button", {
1187
+ children: [!K && /* @__PURE__ */ h("button", {
1165
1188
  type: "button",
1166
- onClick: F,
1167
- "aria-label": R.newChatAriaLabel,
1189
+ onClick: P,
1190
+ "aria-label": L.newChatAriaLabel,
1168
1191
  className: "bailey-new-chat-button",
1169
- children: R.newChatButtonText
1170
- }), o && /* @__PURE__ */ m("button", {
1192
+ children: L.newChatButtonText
1193
+ }), a && /* @__PURE__ */ h("button", {
1171
1194
  type: "button",
1172
- onClick: o,
1173
- "aria-label": R.historyAriaLabel,
1195
+ onClick: a,
1196
+ "aria-label": L.historyAriaLabel,
1174
1197
  className: "bailey-history-button",
1175
- children: /* @__PURE__ */ m(Me, { className: "bailey-history-icon" })
1198
+ children: /* @__PURE__ */ h(Fe, { className: "bailey-history-icon" })
1176
1199
  })]
1177
1200
  }),
1178
- /* @__PURE__ */ h("div", {
1201
+ /* @__PURE__ */ g("div", {
1179
1202
  className: "bailey-chat-transcript",
1180
- ref: ee,
1203
+ ref: H,
1181
1204
  children: [
1182
- G && (i && i.length > 0 ? /* @__PURE__ */ h("div", {
1205
+ K && (i && i.length > 0 ? /* @__PURE__ */ g("div", {
1183
1206
  className: "bailey-suggestions",
1184
- children: [/* @__PURE__ */ m("div", {
1207
+ children: [/* @__PURE__ */ h("div", {
1185
1208
  className: "bailey-suggestions-title",
1186
- children: R.suggestionsTitle
1187
- }), i.map((e, t) => /* @__PURE__ */ h("button", {
1209
+ children: L.suggestionsTitle
1210
+ }), i.map((e, t) => /* @__PURE__ */ g("button", {
1188
1211
  type: "button",
1189
- onClick: () => ne(e.value ?? e.label),
1212
+ onClick: () => J(e.value ?? e.label),
1190
1213
  className: "bailey-suggestion-card",
1191
- children: [/* @__PURE__ */ m("span", { children: e.label }), /* @__PURE__ */ m(ke, { className: "bailey-suggestion-icon" })]
1214
+ children: [/* @__PURE__ */ h("span", { children: e.label }), /* @__PURE__ */ h(Me, { className: "bailey-suggestion-icon" })]
1192
1215
  }, `${e.label}-${t}`))]
1193
- }) : /* @__PURE__ */ m("div", {
1216
+ }) : /* @__PURE__ */ h("div", {
1194
1217
  className: "bailey-empty-state",
1195
- children: R.emptyStateMessage
1218
+ children: L.emptyStateMessage
1196
1219
  })),
1197
1220
  T.map((e, t) => {
1198
- let n = e.role === "assistant" && t === T.length - 1, r = O === "streaming" && n && e.content === "", i = e.role === "assistant" && !r ? he(E, e.createdAt) : [], a = i[i.length - 1];
1199
- return /* @__PURE__ */ m("div", {
1221
+ let n = e.role === "assistant" && t === T.length - 1, r = O === "streaming" && n && e.content === "", i = e.role === "assistant" && !r ? ge(E, e.createdAt) : [], a = i[i.length - 1];
1222
+ return /* @__PURE__ */ h("div", {
1200
1223
  className: e.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
1201
- children: e.role === "user" ? /* @__PURE__ */ h("div", {
1224
+ children: e.role === "user" ? /* @__PURE__ */ g("div", {
1202
1225
  className: "bailey-user-message",
1203
- children: [/* @__PURE__ */ h("div", {
1226
+ children: [/* @__PURE__ */ g("div", {
1204
1227
  className: "bailey-message-meta",
1205
- children: [/* @__PURE__ */ m("span", {
1228
+ children: [/* @__PURE__ */ h("span", {
1206
1229
  className: "bailey-message-meta-name",
1207
- children: R.youLabel
1208
- }), e.createdAt !== void 0 && /* @__PURE__ */ m("span", { children: z(e.createdAt) })]
1209
- }), /* @__PURE__ */ m("div", {
1230
+ children: L.youLabel
1231
+ }), e.createdAt !== void 0 && /* @__PURE__ */ h("span", { children: R(e.createdAt) })]
1232
+ }), /* @__PURE__ */ h("div", {
1210
1233
  className: "bailey-user-bubble",
1211
1234
  children: e.content
1212
1235
  })]
1213
- }) : r ? /* @__PURE__ */ m("div", {
1236
+ }) : r ? /* @__PURE__ */ h("div", {
1214
1237
  className: "bailey-thinking-hint",
1215
- children: W ?? R.thinkingHint
1216
- }) : /* @__PURE__ */ h("div", {
1238
+ children: G ?? L.thinkingHint
1239
+ }) : /* @__PURE__ */ g("div", {
1217
1240
  className: "bailey-assistant-message",
1218
1241
  children: [
1219
- a && /* @__PURE__ */ h("div", {
1242
+ a && /* @__PURE__ */ g("div", {
1220
1243
  className: "bailey-activity-line",
1221
- children: [/* @__PURE__ */ m("span", {
1244
+ children: [/* @__PURE__ */ h("span", {
1222
1245
  className: "bailey-activity-icon",
1223
- children: p?.(a.toolName) ?? /* @__PURE__ */ m(Ne, {})
1224
- }), /* @__PURE__ */ m("span", { children: a.text })]
1246
+ children: f?.(a.toolName) ?? /* @__PURE__ */ h(Ie, {})
1247
+ }), /* @__PURE__ */ h("span", { children: a.text })]
1225
1248
  }),
1226
- /* @__PURE__ */ m(Ye, {
1249
+ /* @__PURE__ */ h($e, {
1227
1250
  content: e.content,
1228
- components: te
1251
+ components: W
1229
1252
  }),
1230
- e.streaming && W && /* @__PURE__ */ m("div", {
1253
+ e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ h(qe, {
1254
+ src: e.src,
1255
+ alt: e.alt
1256
+ }, t) : null),
1257
+ e.streaming && G && /* @__PURE__ */ h("div", {
1231
1258
  className: "bailey-streaming-hint",
1232
- children: W
1259
+ children: G
1233
1260
  }),
1234
- !e.streaming && /* @__PURE__ */ h("div", {
1261
+ !e.streaming && /* @__PURE__ */ g("div", {
1235
1262
  className: "bailey-message-actions",
1236
- children: [/* @__PURE__ */ m(Fe, {
1263
+ children: [/* @__PURE__ */ h(Re, {
1237
1264
  markdown: e.content,
1238
- ariaLabel: R.copyButtonAriaLabel,
1239
- tooltipDefaultText: R.copyButtonTooltipDefault,
1240
- tooltipCopiedText: R.copyButtonTooltipCopied
1265
+ ariaLabel: L.copyButtonAriaLabel,
1266
+ tooltipDefaultText: L.copyButtonTooltipDefault,
1267
+ tooltipCopiedText: L.copyButtonTooltipCopied
1241
1268
  }), b?.(e)]
1242
1269
  })
1243
1270
  ]
1244
1271
  })
1245
1272
  }, e.id);
1246
1273
  }),
1247
- /* @__PURE__ */ m("div", { ref: H })
1274
+ /* @__PURE__ */ h("div", { ref: V })
1248
1275
  ]
1249
1276
  }),
1250
- k && /* @__PURE__ */ h("div", {
1277
+ k && /* @__PURE__ */ g("div", {
1251
1278
  className: "bailey-error-banner",
1252
1279
  role: "alert",
1253
- children: [/* @__PURE__ */ m("span", { children: k }), /* @__PURE__ */ h("div", {
1280
+ children: [/* @__PURE__ */ h("span", { children: k }), /* @__PURE__ */ g("div", {
1254
1281
  className: "bailey-error-actions",
1255
- children: [/* @__PURE__ */ m("button", {
1282
+ children: [/* @__PURE__ */ h("button", {
1256
1283
  type: "button",
1257
- onClick: M,
1284
+ onClick: ee,
1258
1285
  className: "bailey-retry-button",
1259
- children: R.retryButtonText
1260
- }), /* @__PURE__ */ m("button", {
1286
+ children: L.retryButtonText
1287
+ }), /* @__PURE__ */ h("button", {
1261
1288
  type: "button",
1262
- onClick: P,
1263
- "aria-label": R.dismissErrorAriaLabel,
1289
+ onClick: N,
1290
+ "aria-label": L.dismissErrorAriaLabel,
1264
1291
  className: "bailey-dismiss-button",
1265
1292
  children: "✕"
1266
1293
  })]
1267
1294
  })]
1268
1295
  }),
1269
- !y && /* @__PURE__ */ m(Ue, {
1296
+ !y && /* @__PURE__ */ h(Ke, {
1270
1297
  events: E,
1271
1298
  lastRequest: D,
1272
- onClear: N
1299
+ onClear: M
1273
1300
  }),
1274
- /* @__PURE__ */ h("form", {
1301
+ /* @__PURE__ */ g("form", {
1275
1302
  onSubmit: (e) => {
1276
- e.preventDefault(), !(!I.trim() || O === "streaming") && (ne(I), L(""));
1303
+ e.preventDefault(), !(!F.trim() || O === "streaming") && (J(F), I(""));
1277
1304
  },
1278
1305
  className: "bailey-input-row",
1279
- children: [/* @__PURE__ */ m("input", {
1306
+ children: [/* @__PURE__ */ h("input", {
1280
1307
  type: "text",
1281
- placeholder: K,
1282
- "aria-label": K,
1283
- value: I,
1284
- onChange: (e) => L(e.target.value),
1308
+ placeholder: q,
1309
+ "aria-label": q,
1310
+ value: F,
1311
+ onChange: (e) => I(e.target.value),
1285
1312
  disabled: O === "streaming",
1286
1313
  className: "bailey-input"
1287
- }), O === "streaming" ? /* @__PURE__ */ m(f.Provider, {
1314
+ }), O === "streaming" ? /* @__PURE__ */ h(p.Provider, {
1288
1315
  delayDuration: 200,
1289
- children: /* @__PURE__ */ h(f.Root, { children: [/* @__PURE__ */ m(f.Trigger, {
1316
+ children: /* @__PURE__ */ g(p.Root, { children: [/* @__PURE__ */ h(p.Trigger, {
1290
1317
  asChild: !0,
1291
- children: /* @__PURE__ */ m("button", {
1318
+ children: /* @__PURE__ */ h("button", {
1292
1319
  type: "button",
1293
1320
  onClick: j,
1294
- "aria-label": R.stopAriaLabel,
1321
+ "aria-label": L.stopAriaLabel,
1295
1322
  className: "bailey-stop-button",
1296
- children: /* @__PURE__ */ m(Oe, { className: "bailey-stop-icon" })
1323
+ children: /* @__PURE__ */ h(je, { className: "bailey-stop-icon" })
1297
1324
  })
1298
- }), /* @__PURE__ */ m(f.Portal, {
1299
- container: V instanceof ShadowRoot ? V : void 0,
1300
- children: /* @__PURE__ */ h(f.Content, {
1325
+ }), /* @__PURE__ */ h(p.Portal, {
1326
+ container: B instanceof ShadowRoot ? B : void 0,
1327
+ children: /* @__PURE__ */ g(p.Content, {
1301
1328
  side: "top",
1302
1329
  className: "bailey-tooltip-content",
1303
- children: [R.stopButtonText, /* @__PURE__ */ m(f.Arrow, { className: "bailey-tooltip-arrow" })]
1330
+ children: [L.stopButtonText, /* @__PURE__ */ h(p.Arrow, { className: "bailey-tooltip-arrow" })]
1304
1331
  })
1305
1332
  })] })
1306
- }) : /* @__PURE__ */ m("button", {
1333
+ }) : /* @__PURE__ */ h("button", {
1307
1334
  type: "submit",
1308
- "aria-label": R.sendAriaLabel,
1309
- disabled: !I.trim(),
1335
+ "aria-label": L.sendAriaLabel,
1336
+ disabled: !F.trim(),
1310
1337
  className: "bailey-send-button",
1311
- children: /* @__PURE__ */ m(De, { className: "bailey-send-icon" })
1338
+ children: /* @__PURE__ */ h(Ae, { className: "bailey-send-icon" })
1312
1339
  })]
1313
1340
  }),
1314
- (G || d?.alwaysVisible) && d && /* @__PURE__ */ m("div", {
1341
+ (K || s?.alwaysVisible) && s && /* @__PURE__ */ h("div", {
1315
1342
  className: "bailey-privacy-note",
1316
- children: /* @__PURE__ */ m(u, {
1317
- remarkPlugins: qe,
1318
- components: Je,
1343
+ children: /* @__PURE__ */ h(d, {
1344
+ remarkPlugins: Ze,
1345
+ components: Qe,
1319
1346
  skipHtml: !0,
1320
- children: d.markdown
1347
+ children: s.markdown
1321
1348
  })
1322
1349
  })
1323
1350
  ]
@@ -1327,6 +1354,6 @@ function Qe({ chat: e, placeholder: t, replyPlaceholder: n = Ge, emptyPlaceholde
1327
1354
  }
1328
1355
  //#endregion
1329
1356
  //#region src/index.ts
1330
- var $e = "0.3.1-pre.2";
1357
+ var rt = "0.3.1-pre.2";
1331
1358
  //#endregion
1332
- export { Ne as ActivityIcon, ke as ArrowUpRightIcon, $e as BAILEYAI_CHAT_UI_VERSION, ee as BAILEY_CHART_PROMPT_FRAGMENT, F as BAILEY_TABLE_GRID_ROW_THRESHOLD, Qe as BaileyChatPanel, Ue as BaileyTracePanel, Fe as CopyMarkdownButton, De as HeartIcon, ie as TRACE_KIND_LABEL, Ee as createBaileyMarkdownComponents, C as extractPseudoToolCalls, V as extractTableData, ue as formatTraceGap, le as formatTraceTime, me as hasTraceFailure, e as isSafeMarkdownUrl, j as joinInstructions, re as parseBaileyChartSpec, T as parseSseFrames, P as resolveToolCall, H as shouldUseGrid, he as toActivityLines, de as toTraceRows, pe as toTraceSegments, oe as traceEventArgsDetail, Y as traceEventHint, se as traceEventOutputDetail, ce as traceEventRawDetail, ae as traceEventSummary, J as traceEventToolName, fe as traceSummaryLine, A as useBaileyChat };
1359
+ export { Ie as ActivityIcon, Me as ArrowUpRightIcon, rt as BAILEYAI_CHAT_UI_VERSION, G as BAILEY_CHART_PROMPT_FRAGMENT, L as BAILEY_TABLE_GRID_ROW_THRESHOLD, nt as BaileyChatPanel, Ke as BaileyTracePanel, Re as CopyMarkdownButton, Ae as HeartIcon, ae as TRACE_KIND_LABEL, ke as createBaileyMarkdownComponents, E as extractPseudoToolCalls, U as extractTableData, de as formatTraceGap, ue as formatTraceTime, he as hasTraceFailure, e as isSafeMarkdownUrl, N as joinInstructions, ie as parseBaileyChartSpec, O as parseSseFrames, I as resolveToolCall, W as shouldUseGrid, ge as toActivityLines, fe as toTraceRows, me as toTraceSegments, se as traceEventArgsDetail, Z as traceEventHint, ce as traceEventOutputDetail, le as traceEventRawDetail, oe as traceEventSummary, X as traceEventToolName, pe as traceSummaryLine, M as useBaileyChat };