@icanbwell/baileyai-chat-ui 1.0.5 → 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.
- package/dist/baileyai-chat-ui.cjs +2 -2
- package/dist/baileyai-chat-ui.css +1 -1
- package/dist/baileyai-chat-ui.js +340 -326
- package/dist/index.d.ts +16 -0
- package/dist/{safeMarkdownUrl-xI42YYzd.js → safeMarkdownUrl-Bqv6Q4u1.js} +4 -1
- package/dist/safeMarkdownUrl-CnpKNwAf.cjs +1 -0
- package/dist/table.cjs +1 -1
- package/dist/table.js +1 -1
- package/package.json +1 -1
- package/dist/safeMarkdownUrl-DsMPGzpD.cjs +0 -1
package/dist/baileyai-chat-ui.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createContext as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
6
|
-
import { Fragment as
|
|
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
|
|
9
|
-
function
|
|
10
|
-
let t =
|
|
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
|
|
16
|
+
function T(e) {
|
|
17
17
|
let t = [];
|
|
18
|
-
|
|
18
|
+
S.lastIndex = 0;
|
|
19
19
|
let n;
|
|
20
|
-
for (; (n =
|
|
20
|
+
for (; (n = S.exec(e)) !== null;) {
|
|
21
21
|
let [, e, r] = n, i = {};
|
|
22
|
-
|
|
22
|
+
C.lastIndex = 0;
|
|
23
23
|
let a;
|
|
24
|
-
for (; (a =
|
|
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,14 +30,14 @@ function w(e) {
|
|
|
30
30
|
}
|
|
31
31
|
return t;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(
|
|
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
36
|
args: n.trim()
|
|
37
|
-
}) : t === "function_calls" ? r.push(...
|
|
37
|
+
}) : t === "function_calls" ? r.push(...T(n)) : r.push({
|
|
38
38
|
name: "function_result",
|
|
39
39
|
args: n.trim()
|
|
40
|
-
}), "")), a = n ? i.replace(
|
|
40
|
+
}), "")), a = n ? i.replace(y, "") : i;
|
|
41
41
|
return r.length === 0 && a === i ? {
|
|
42
42
|
cleanedText: i,
|
|
43
43
|
matches: r
|
|
@@ -48,7 +48,7 @@ function T(e, t = {}) {
|
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/logic/sse.ts
|
|
51
|
-
function
|
|
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 E(e) {
|
|
|
62
62
|
}
|
|
63
63
|
return t || null;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
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 D(e) {
|
|
|
87
87
|
message: e
|
|
88
88
|
});
|
|
89
89
|
} else if (c?.type === "response.output_text.delta" && typeof c.delta == "string") {
|
|
90
|
-
let e =
|
|
90
|
+
let e = D(c.delta);
|
|
91
91
|
e && r.push({
|
|
92
92
|
type: "response.output_text.delta",
|
|
93
93
|
delta: e
|
|
@@ -105,38 +105,38 @@ function D(e) {
|
|
|
105
105
|
}
|
|
106
106
|
//#endregion
|
|
107
107
|
//#region src/logic/useBaileyChat.ts
|
|
108
|
-
var
|
|
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 >
|
|
112
|
-
},
|
|
113
|
-
let [f, p] =
|
|
114
|
-
|
|
115
|
-
|
|
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
|
|
117
|
+
let D = l([]), k = l(/* @__PURE__ */ new Map()), M = l(/* @__PURE__ */ new Map()), N = l(null), P = i(() => {
|
|
118
118
|
N.current !== null && (clearTimeout(N.current), N.current = null);
|
|
119
|
-
}, []), F =
|
|
119
|
+
}, []), F = i((e) => {
|
|
120
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
123
|
}, [P, d]);
|
|
124
|
-
|
|
124
|
+
o(() => () => {
|
|
125
125
|
S.current?.abort(), P();
|
|
126
126
|
}, [P]);
|
|
127
|
-
let I =
|
|
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 =
|
|
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 } =
|
|
139
|
-
if (n.emittedCount = a.length,
|
|
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) {
|
|
@@ -183,9 +183,9 @@ var O = 200, k = 15e4, A = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
183
183
|
}), !0;
|
|
184
184
|
if (t.type === "response.output_text.done" || t.type === "response.created") return !1;
|
|
185
185
|
if (t.type === "response.completed") {
|
|
186
|
-
let t =
|
|
186
|
+
let t = k.current.get(e);
|
|
187
187
|
if (t) {
|
|
188
|
-
let { cleanedText: n } =
|
|
188
|
+
let { cleanedText: n } = E(t.raw, { hideOpenBlock: !1 }), r = n.trim();
|
|
189
189
|
r !== M.current.get(e) && (M.current.set(e, r), p((t) => t.map((t) => t.id === e ? {
|
|
190
190
|
...t,
|
|
191
191
|
content: r
|
|
@@ -205,19 +205,19 @@ var O = 200, k = 15e4, A = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
205
205
|
at: Date.now(),
|
|
206
206
|
turnSentAt: w.current
|
|
207
207
|
}), !0);
|
|
208
|
-
}, []), L =
|
|
208
|
+
}, []), L = i(async (i) => {
|
|
209
209
|
y("streaming"), x(null);
|
|
210
|
-
let
|
|
211
|
-
w.current =
|
|
212
|
-
let
|
|
213
|
-
id:
|
|
210
|
+
let o = Date.now();
|
|
211
|
+
w.current = o;
|
|
212
|
+
let l = j(), u = {
|
|
213
|
+
id: l,
|
|
214
214
|
role: "assistant",
|
|
215
215
|
content: "",
|
|
216
216
|
streaming: !0,
|
|
217
|
-
createdAt:
|
|
217
|
+
createdAt: o
|
|
218
218
|
};
|
|
219
|
-
p((e) => [...e,
|
|
220
|
-
let d =
|
|
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 ? {
|
|
221
221
|
role: e.role,
|
|
222
222
|
content: `${s}${e.content}`,
|
|
223
223
|
hidden: e.hidden,
|
|
@@ -232,10 +232,10 @@ var O = 200, k = 15e4, A = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
232
232
|
model: t,
|
|
233
233
|
systemPrompt: n,
|
|
234
234
|
messages: f,
|
|
235
|
-
tools:
|
|
236
|
-
toolChoice:
|
|
235
|
+
tools: r,
|
|
236
|
+
toolChoice: a,
|
|
237
237
|
stream: !0,
|
|
238
|
-
sentAt:
|
|
238
|
+
sentAt: o,
|
|
239
239
|
streamStats: {
|
|
240
240
|
chunkCount: 0,
|
|
241
241
|
firstChunkAt: null,
|
|
@@ -250,11 +250,11 @@ var O = 200, k = 15e4, A = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
250
250
|
kind: "error",
|
|
251
251
|
message: e,
|
|
252
252
|
at: Date.now(),
|
|
253
|
-
turnSentAt:
|
|
253
|
+
turnSentAt: o,
|
|
254
254
|
...t
|
|
255
255
|
};
|
|
256
256
|
T.push(n), h((e) => [...e, n]);
|
|
257
|
-
},
|
|
257
|
+
}, A = (e, t) => {
|
|
258
258
|
e.forEach((e) => {
|
|
259
259
|
if (e.type === "error") {
|
|
260
260
|
v = e.message;
|
|
@@ -262,31 +262,31 @@ var O = 200, k = 15e4, A = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
262
262
|
kind: "error",
|
|
263
263
|
message: e.message,
|
|
264
264
|
at: Date.now(),
|
|
265
|
-
turnSentAt:
|
|
265
|
+
turnSentAt: o
|
|
266
266
|
};
|
|
267
267
|
T.push(t), h((e) => [...e, t]);
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
|
-
e.type === "response.output_text.delta" && e.delta && (C = !0), I(
|
|
271
|
-
}), t && p((e) => e.map((e) => e.id ===
|
|
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 ? {
|
|
272
272
|
...e,
|
|
273
273
|
streaming: !1
|
|
274
274
|
} : e));
|
|
275
275
|
};
|
|
276
276
|
try {
|
|
277
|
-
let { status:
|
|
277
|
+
let { status: i, text: s, errorMessage: u } = await e.streamChat({
|
|
278
278
|
model: t,
|
|
279
279
|
instructions: n,
|
|
280
280
|
input: f,
|
|
281
|
-
tools:
|
|
282
|
-
toolChoice:
|
|
281
|
+
tools: r,
|
|
282
|
+
toolChoice: a,
|
|
283
283
|
signal: m.signal,
|
|
284
284
|
onChunk: (e) => {
|
|
285
285
|
F(m), g += e;
|
|
286
|
-
let { events: t, remainder: n, done: r } =
|
|
287
|
-
g = n,
|
|
286
|
+
let { events: t, remainder: n, done: r } = O(g);
|
|
287
|
+
g = n, A(t, r);
|
|
288
288
|
let i = Date.now();
|
|
289
|
-
_((e) => e && e.sentAt ===
|
|
289
|
+
_((e) => e && e.sentAt === o ? {
|
|
290
290
|
...e,
|
|
291
291
|
streamStats: {
|
|
292
292
|
chunkCount: e.streamStats.chunkCount + 1,
|
|
@@ -296,23 +296,23 @@ var O = 200, k = 15e4, A = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
296
296
|
} : e);
|
|
297
297
|
},
|
|
298
298
|
onRequestId: (e) => {
|
|
299
|
-
_((t) => t && t.sentAt ===
|
|
299
|
+
_((t) => t && t.sentAt === o ? {
|
|
300
300
|
...t,
|
|
301
301
|
requestId: e
|
|
302
302
|
} : t);
|
|
303
303
|
}
|
|
304
304
|
});
|
|
305
305
|
if (g.trim()) {
|
|
306
|
-
let { events: e, done: t } =
|
|
307
|
-
g = "",
|
|
306
|
+
let { events: e, done: t } = O(`${g}\n\n`);
|
|
307
|
+
g = "", A(e, t);
|
|
308
308
|
}
|
|
309
309
|
if (v) {
|
|
310
310
|
y("error"), x(v);
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
|
-
if (
|
|
314
|
-
E(ee(
|
|
315
|
-
httpStatus:
|
|
313
|
+
if (i === void 0 || i >= 400) {
|
|
314
|
+
E(ee(i, s, u), {
|
|
315
|
+
httpStatus: i,
|
|
316
316
|
rawBody: s || void 0
|
|
317
317
|
});
|
|
318
318
|
return;
|
|
@@ -326,12 +326,12 @@ var O = 200, k = 15e4, A = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
326
326
|
return;
|
|
327
327
|
}
|
|
328
328
|
y("idle");
|
|
329
|
-
let d = M.current.get(
|
|
330
|
-
_((e) => e && e.sentAt ===
|
|
329
|
+
let d = M.current.get(l) ?? "";
|
|
330
|
+
_((e) => e && e.sentAt === o ? {
|
|
331
331
|
...e,
|
|
332
332
|
response: { content: d }
|
|
333
|
-
} : e),
|
|
334
|
-
id:
|
|
333
|
+
} : e), c && await c({
|
|
334
|
+
id: l,
|
|
335
335
|
role: "assistant",
|
|
336
336
|
content: d,
|
|
337
337
|
streaming: !1
|
|
@@ -349,11 +349,11 @@ var O = 200, k = 15e4, A = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
349
349
|
E(t?.message || "Bailey request failed.");
|
|
350
350
|
} finally {
|
|
351
351
|
P();
|
|
352
|
-
let e = M.current.get(
|
|
353
|
-
|
|
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 ? [{
|
|
354
354
|
...e,
|
|
355
355
|
streaming: !1
|
|
356
|
-
}] : [] : [e])),
|
|
356
|
+
}] : [] : [e])), D.current = D.current.flatMap((t) => t.id === l ? e ? [{
|
|
357
357
|
...t,
|
|
358
358
|
content: e,
|
|
359
359
|
streaming: !1
|
|
@@ -363,15 +363,15 @@ var O = 200, k = 15e4, A = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
363
363
|
e,
|
|
364
364
|
t,
|
|
365
365
|
n,
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
r,
|
|
367
|
+
a,
|
|
368
368
|
s,
|
|
369
|
-
|
|
369
|
+
c,
|
|
370
370
|
I,
|
|
371
371
|
F,
|
|
372
372
|
P
|
|
373
|
-
]), R =
|
|
374
|
-
|
|
373
|
+
]), R = i((e) => {
|
|
374
|
+
T.current = e, p(e);
|
|
375
375
|
}, []);
|
|
376
376
|
return {
|
|
377
377
|
messages: f,
|
|
@@ -379,75 +379,75 @@ var O = 200, k = 15e4, A = () => typeof crypto < "u" && typeof crypto.randomUUID
|
|
|
379
379
|
lastRequest: g,
|
|
380
380
|
status: v,
|
|
381
381
|
error: b,
|
|
382
|
-
send:
|
|
382
|
+
send: i((e) => {
|
|
383
383
|
let t = e.trim();
|
|
384
384
|
if (!t) return;
|
|
385
385
|
C.current = t;
|
|
386
386
|
let n = {
|
|
387
|
-
id:
|
|
387
|
+
id: j(),
|
|
388
388
|
role: "user",
|
|
389
389
|
content: t,
|
|
390
390
|
createdAt: Date.now()
|
|
391
|
-
}, r = [...
|
|
392
|
-
|
|
391
|
+
}, r = [...D.current, n];
|
|
392
|
+
D.current = r, R([...T.current, n]), L(r);
|
|
393
393
|
}, [L, R]),
|
|
394
|
-
sendHidden:
|
|
394
|
+
sendHidden: i((e, t) => {
|
|
395
395
|
if (v === "streaming") return;
|
|
396
396
|
let n = e.trim();
|
|
397
397
|
if (!n) return;
|
|
398
398
|
C.current = n;
|
|
399
399
|
let r = t?.trim(), i = {
|
|
400
|
-
id:
|
|
400
|
+
id: j(),
|
|
401
401
|
role: "user",
|
|
402
402
|
content: n,
|
|
403
403
|
createdAt: Date.now(),
|
|
404
404
|
hidden: !0,
|
|
405
405
|
...r ? { titleHint: r } : {}
|
|
406
|
-
}, a = [...
|
|
407
|
-
|
|
406
|
+
}, a = [...D.current, i];
|
|
407
|
+
D.current = a, L(a);
|
|
408
408
|
}, [L, v]),
|
|
409
|
-
stop:
|
|
409
|
+
stop: i(() => {
|
|
410
410
|
S.current?.abort();
|
|
411
411
|
}, []),
|
|
412
|
-
retryLast:
|
|
412
|
+
retryLast: i(() => {
|
|
413
413
|
if (v === "streaming" || !C.current) return;
|
|
414
|
-
let e =
|
|
414
|
+
let e = T.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
|
|
415
415
|
R(n);
|
|
416
|
-
let r =
|
|
417
|
-
|
|
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);
|
|
418
418
|
}, [
|
|
419
419
|
L,
|
|
420
420
|
R,
|
|
421
421
|
v
|
|
422
422
|
]),
|
|
423
|
-
clearTrace:
|
|
424
|
-
clearError:
|
|
423
|
+
clearTrace: i(() => h([]), []),
|
|
424
|
+
clearError: i(() => {
|
|
425
425
|
x(null), y((e) => e === "error" ? "idle" : e);
|
|
426
426
|
}, []),
|
|
427
|
-
newChat:
|
|
428
|
-
S.current?.abort(), R([]),
|
|
427
|
+
newChat: i(() => {
|
|
428
|
+
S.current?.abort(), R([]), D.current = [], h([]), _(null), y("idle"), x(null), C.current = "";
|
|
429
429
|
}, [R]),
|
|
430
|
-
loadMessages:
|
|
430
|
+
loadMessages: i((e) => {
|
|
431
431
|
S.current?.abort();
|
|
432
432
|
let t = e.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
|
|
433
433
|
...e,
|
|
434
434
|
streaming: !1
|
|
435
435
|
}));
|
|
436
|
-
R(t.filter((e) => !e.hidden)),
|
|
436
|
+
R(t.filter((e) => !e.hidden)), D.current = t, h([]), _(null), y("idle"), x(null), C.current = "";
|
|
437
437
|
}, [R])
|
|
438
438
|
};
|
|
439
439
|
};
|
|
440
440
|
//#endregion
|
|
441
441
|
//#region src/utils/prompt.ts
|
|
442
|
-
function
|
|
442
|
+
function N(...e) {
|
|
443
443
|
return e.filter((e) => !!(e && e.trim())).join("\n\n");
|
|
444
444
|
}
|
|
445
445
|
//#endregion
|
|
446
446
|
//#region src/utils/toolCalls.ts
|
|
447
|
-
var
|
|
448
|
-
function
|
|
447
|
+
var P = "call_tool", F = "a tool";
|
|
448
|
+
function I(e, t) {
|
|
449
449
|
let n = {
|
|
450
|
-
name: e ===
|
|
450
|
+
name: e === P ? F : e,
|
|
451
451
|
args: null,
|
|
452
452
|
viaCallTool: !1
|
|
453
453
|
};
|
|
@@ -460,7 +460,7 @@ function F(e, t) {
|
|
|
460
460
|
}
|
|
461
461
|
if (typeof r != "object" || !r) return n;
|
|
462
462
|
let i = r;
|
|
463
|
-
if (e ===
|
|
463
|
+
if (e === P) {
|
|
464
464
|
let e = typeof i.name == "string" ? i.name : void 0;
|
|
465
465
|
if (!e) return n;
|
|
466
466
|
let t = i.arguments;
|
|
@@ -478,32 +478,32 @@ function F(e, t) {
|
|
|
478
478
|
}
|
|
479
479
|
//#endregion
|
|
480
480
|
//#region src/utils/table.ts
|
|
481
|
-
var
|
|
481
|
+
var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(R).join(""), z = (e) => {
|
|
482
482
|
if (e.tagName === "a" && e.properties?.href) return e.properties.href;
|
|
483
483
|
for (let t of e.children ?? []) {
|
|
484
|
-
let e =
|
|
484
|
+
let e = z(t);
|
|
485
485
|
if (e) return e;
|
|
486
486
|
}
|
|
487
|
-
},
|
|
488
|
-
let t =
|
|
487
|
+
}, B = (e, t) => (e.children ?? []).find((e) => e.tagName === t), V = (e) => {
|
|
488
|
+
let t = R(e), n = z(e);
|
|
489
489
|
return n ? {
|
|
490
490
|
text: t,
|
|
491
491
|
href: n
|
|
492
492
|
} : { text: t };
|
|
493
|
-
},
|
|
493
|
+
}, H = (e) => (e.children ?? []).filter((e) => e.type === "element").map(V), U = (e) => {
|
|
494
494
|
if (e.tagName !== "table") return null;
|
|
495
|
-
let t =
|
|
495
|
+
let t = B(e, "thead"), n = t && B(t, "tr");
|
|
496
496
|
return {
|
|
497
|
-
headers: n ?
|
|
498
|
-
rows: (
|
|
497
|
+
headers: n ? H(n).map((e) => e.text) : [],
|
|
498
|
+
rows: (B(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(H)
|
|
499
499
|
};
|
|
500
|
-
},
|
|
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 = [
|
|
501
501
|
"bar",
|
|
502
502
|
"line",
|
|
503
503
|
"pie",
|
|
504
504
|
"doughnut",
|
|
505
505
|
"scatter"
|
|
506
|
-
],
|
|
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) => {
|
|
507
507
|
let t;
|
|
508
508
|
try {
|
|
509
509
|
t = JSON.parse(e);
|
|
@@ -512,13 +512,13 @@ var I = 5, L = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
512
512
|
}
|
|
513
513
|
if (typeof t != "object" || !t) return null;
|
|
514
514
|
let n = t;
|
|
515
|
-
if (typeof n.type != "string" || !
|
|
515
|
+
if (typeof n.type != "string" || !K.includes(n.type)) return null;
|
|
516
516
|
let r = n.type;
|
|
517
517
|
if (n.title !== void 0 && typeof n.title != "string") return null;
|
|
518
518
|
let i = n.title;
|
|
519
519
|
if (typeof n.data != "object" || n.data === null) return null;
|
|
520
520
|
let a = n.data;
|
|
521
|
-
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length >
|
|
521
|
+
if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > q || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
|
|
522
522
|
for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
|
|
523
523
|
let o = a.datasets;
|
|
524
524
|
if (r === "scatter") {
|
|
@@ -530,7 +530,7 @@ var I = 5, L = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
530
530
|
};
|
|
531
531
|
}
|
|
532
532
|
if (!Array.isArray(a.labels) || !a.labels.every((e) => typeof e == "string")) return null;
|
|
533
|
-
let s = a.labels, c = r === "pie" || r === "doughnut" ?
|
|
533
|
+
let s = a.labels, c = r === "pie" || r === "doughnut" ? te : J;
|
|
534
534
|
if (s.length < 1 || s.length > c) return null;
|
|
535
535
|
for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
|
|
536
536
|
return {
|
|
@@ -550,13 +550,13 @@ var I = 5, L = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
|
|
|
550
550
|
error: "Error",
|
|
551
551
|
raw: "Raw event"
|
|
552
552
|
};
|
|
553
|
-
function
|
|
554
|
-
return e.kind !== "tool_start" && e.kind !== "tool_end" ? null :
|
|
553
|
+
function Y(e) {
|
|
554
|
+
return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : I(e.name, e.args);
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function X(e, t = Y(e)) {
|
|
557
557
|
return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
|
|
558
558
|
}
|
|
559
|
-
function oe(e, t =
|
|
559
|
+
function oe(e, t = Y(e)) {
|
|
560
560
|
switch (e.kind) {
|
|
561
561
|
case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
|
|
562
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" : ""}`;
|
|
@@ -567,7 +567,7 @@ function oe(e, t = J(e)) {
|
|
|
567
567
|
case "raw": return `Unrecognized event: ${e.eventType}`;
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
function se(e, t =
|
|
570
|
+
function se(e, t = Y(e)) {
|
|
571
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;
|
|
572
572
|
}
|
|
573
573
|
function ce(e) {
|
|
@@ -576,11 +576,11 @@ function ce(e) {
|
|
|
576
576
|
function le(e) {
|
|
577
577
|
return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
|
|
578
578
|
}
|
|
579
|
-
function
|
|
579
|
+
function Z(e) {
|
|
580
580
|
switch (e.kind) {
|
|
581
|
-
case "tool_start": return `Calling ${
|
|
581
|
+
case "tool_start": return `Calling ${I(e.name, e.args).name}...`;
|
|
582
582
|
case "tool_end": {
|
|
583
|
-
let t =
|
|
583
|
+
let t = I(e.name, e.args).name;
|
|
584
584
|
return e.isError ? `${t} failed` : `${t} returned`;
|
|
585
585
|
}
|
|
586
586
|
case "pseudo_tool_call": return `${e.name} (written as text, not called)`;
|
|
@@ -604,11 +604,11 @@ function de(e) {
|
|
|
604
604
|
}
|
|
605
605
|
function fe(e) {
|
|
606
606
|
return e.map((t, n) => {
|
|
607
|
-
let r =
|
|
607
|
+
let r = Y(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
|
|
608
608
|
return {
|
|
609
609
|
key: `${t.at}-${n}`,
|
|
610
610
|
kind: t.kind,
|
|
611
|
-
toolName:
|
|
611
|
+
toolName: X(t, r),
|
|
612
612
|
isToolStart: t.kind === "tool_start",
|
|
613
613
|
failed: t.kind === "tool_end" && t.isError === !0,
|
|
614
614
|
time: ue(t.at),
|
|
@@ -650,97 +650,97 @@ function he(e) {
|
|
|
650
650
|
function ge(e, t) {
|
|
651
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) => ({
|
|
652
652
|
key: `${e.at}-${t}`,
|
|
653
|
-
text:
|
|
654
|
-
toolName:
|
|
653
|
+
text: Z(e),
|
|
654
|
+
toolName: X(e)
|
|
655
655
|
}));
|
|
656
656
|
}
|
|
657
657
|
//#endregion
|
|
658
658
|
//#region src/styles.css?inline
|
|
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-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}", ve = t(void 0), ye = /:root\s*,\s*:host\s*\{/, be = ".bailey-chat-panel{";
|
|
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
660
|
function xe(e) {
|
|
661
661
|
let t = e.match(new RegExp(ye, "g"))?.length ?? 0;
|
|
662
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.`);
|
|
663
663
|
return e.replace(ye, be);
|
|
664
664
|
}
|
|
665
|
-
var Se = xe(_e),
|
|
666
|
-
function
|
|
665
|
+
var Se = xe(_e), Ce = "data-source", we = "baileyai-chat-ui", Q = /* @__PURE__ */ new WeakMap();
|
|
666
|
+
function Te(e) {
|
|
667
667
|
let t = e.getRootNode();
|
|
668
668
|
return t instanceof ShadowRoot ? t : document;
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function Ee(e) {
|
|
671
671
|
let t = e instanceof ShadowRoot ? e : document.head, n = Q.get(e) ?? 0;
|
|
672
|
-
if (n === 0 && !t.querySelector(`style[${
|
|
672
|
+
if (n === 0 && !t.querySelector(`style[${Ce}="${we}"]`)) {
|
|
673
673
|
let e = document.createElement("style");
|
|
674
|
-
e.setAttribute(
|
|
674
|
+
e.setAttribute(Ce, we), e.textContent = Se, t.appendChild(e);
|
|
675
675
|
}
|
|
676
676
|
return Q.set(e, n + 1), () => {
|
|
677
677
|
let n = (Q.get(e) ?? 1) - 1;
|
|
678
|
-
n <= 0 ? (Q.delete(e), t.querySelector(`style[${
|
|
678
|
+
n <= 0 ? (Q.delete(e), t.querySelector(`style[${Ce}="${we}"]`)?.remove()) : Q.set(e, n);
|
|
679
679
|
};
|
|
680
680
|
}
|
|
681
|
-
function
|
|
682
|
-
let [n, r] =
|
|
683
|
-
return
|
|
681
|
+
function De(e, t = !1) {
|
|
682
|
+
let [n, r] = u(null);
|
|
683
|
+
return s(() => {
|
|
684
684
|
if (t) return;
|
|
685
685
|
let n = e.current;
|
|
686
686
|
if (!n) return;
|
|
687
|
-
let i =
|
|
688
|
-
return r(i),
|
|
687
|
+
let i = Te(n);
|
|
688
|
+
return r(i), Ee(i);
|
|
689
689
|
}, [t, e]), n;
|
|
690
690
|
}
|
|
691
|
-
function
|
|
692
|
-
let t =
|
|
691
|
+
function Oe(e) {
|
|
692
|
+
let t = a(ve), n = t !== void 0, r = De(e, n);
|
|
693
693
|
return n ? t : r;
|
|
694
694
|
}
|
|
695
695
|
//#endregion
|
|
696
696
|
//#region src/ui/markdown.tsx
|
|
697
|
-
function
|
|
697
|
+
function ke({ renderTable: t, renderChart: n } = {}) {
|
|
698
698
|
return {
|
|
699
|
-
a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ m
|
|
699
|
+
a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ h(m, { children: n }) : /* @__PURE__ */ h("a", {
|
|
700
700
|
href: t,
|
|
701
701
|
target: "_blank",
|
|
702
702
|
rel: "noopener noreferrer",
|
|
703
703
|
children: n
|
|
704
704
|
}),
|
|
705
705
|
table: ({ node: n, children: r }) => {
|
|
706
|
-
let i = n &&
|
|
707
|
-
if (i &&
|
|
706
|
+
let i = n && U(n);
|
|
707
|
+
if (i && W(i.rows) && t) {
|
|
708
708
|
let n = i.rows.map((t) => t.map((t) => t.href && !e(t.href) ? { text: t.text } : t));
|
|
709
|
-
return /* @__PURE__ */ m
|
|
709
|
+
return /* @__PURE__ */ h(m, { children: t({
|
|
710
710
|
headers: i.headers,
|
|
711
711
|
rows: n
|
|
712
712
|
}) });
|
|
713
713
|
}
|
|
714
|
-
return /* @__PURE__ */
|
|
714
|
+
return /* @__PURE__ */ h("table", { children: r });
|
|
715
715
|
},
|
|
716
716
|
pre: ({ children: e }) => {
|
|
717
717
|
let t = (Array.isArray(e) ? e[0] : e)?.props;
|
|
718
718
|
if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
|
|
719
719
|
let e = t?.children, r = ie(Array.isArray(e) ? e.join("") : String(e ?? ""));
|
|
720
|
-
if (r) return /* @__PURE__ */ m
|
|
720
|
+
if (r) return /* @__PURE__ */ h(m, { children: n(r) });
|
|
721
721
|
}
|
|
722
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ h("pre", { children: e });
|
|
723
723
|
}
|
|
724
724
|
};
|
|
725
725
|
}
|
|
726
726
|
//#endregion
|
|
727
727
|
//#region src/ui/icons.tsx
|
|
728
|
-
function
|
|
729
|
-
return /* @__PURE__ */
|
|
728
|
+
function Ae({ className: e }) {
|
|
729
|
+
return /* @__PURE__ */ h("svg", {
|
|
730
730
|
viewBox: "0 0 24 24",
|
|
731
731
|
fill: "currentColor",
|
|
732
732
|
className: e,
|
|
733
733
|
"aria-hidden": "true",
|
|
734
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
735
735
|
});
|
|
736
736
|
}
|
|
737
|
-
function
|
|
738
|
-
return /* @__PURE__ */
|
|
737
|
+
function je({ className: e }) {
|
|
738
|
+
return /* @__PURE__ */ h("svg", {
|
|
739
739
|
viewBox: "0 0 24 24",
|
|
740
740
|
fill: "currentColor",
|
|
741
741
|
className: e,
|
|
742
742
|
"aria-hidden": "true",
|
|
743
|
-
children: /* @__PURE__ */
|
|
743
|
+
children: /* @__PURE__ */ h("rect", {
|
|
744
744
|
x: "6",
|
|
745
745
|
y: "6",
|
|
746
746
|
width: "12",
|
|
@@ -749,8 +749,8 @@ function Ae({ className: e }) {
|
|
|
749
749
|
})
|
|
750
750
|
});
|
|
751
751
|
}
|
|
752
|
-
function
|
|
753
|
-
return /* @__PURE__ */
|
|
752
|
+
function Me({ className: e }) {
|
|
753
|
+
return /* @__PURE__ */ g("svg", {
|
|
754
754
|
viewBox: "0 0 24 24",
|
|
755
755
|
fill: "none",
|
|
756
756
|
stroke: "currentColor",
|
|
@@ -759,11 +759,11 @@ function je({ className: e }) {
|
|
|
759
759
|
strokeLinejoin: "round",
|
|
760
760
|
className: e,
|
|
761
761
|
"aria-hidden": "true",
|
|
762
|
-
children: [/* @__PURE__ */
|
|
762
|
+
children: [/* @__PURE__ */ h("path", { d: "M7 17 17 7" }), /* @__PURE__ */ h("path", { d: "M9 7h8v8" })]
|
|
763
763
|
});
|
|
764
764
|
}
|
|
765
|
-
function
|
|
766
|
-
return /* @__PURE__ */
|
|
765
|
+
function Ne({ className: e }) {
|
|
766
|
+
return /* @__PURE__ */ g("svg", {
|
|
767
767
|
viewBox: "0 0 24 24",
|
|
768
768
|
fill: "none",
|
|
769
769
|
stroke: "currentColor",
|
|
@@ -772,17 +772,17 @@ function Me({ className: e }) {
|
|
|
772
772
|
strokeLinejoin: "round",
|
|
773
773
|
className: e,
|
|
774
774
|
"aria-hidden": "true",
|
|
775
|
-
children: [/* @__PURE__ */
|
|
775
|
+
children: [/* @__PURE__ */ h("rect", {
|
|
776
776
|
x: "8",
|
|
777
777
|
y: "8",
|
|
778
778
|
width: "12",
|
|
779
779
|
height: "12",
|
|
780
780
|
rx: "2"
|
|
781
|
-
}), /* @__PURE__ */
|
|
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" })]
|
|
782
782
|
});
|
|
783
783
|
}
|
|
784
|
-
function
|
|
785
|
-
return /* @__PURE__ */
|
|
784
|
+
function Pe({ className: e }) {
|
|
785
|
+
return /* @__PURE__ */ h("svg", {
|
|
786
786
|
viewBox: "0 0 24 24",
|
|
787
787
|
fill: "none",
|
|
788
788
|
stroke: "currentColor",
|
|
@@ -791,11 +791,11 @@ function Ne({ className: e }) {
|
|
|
791
791
|
strokeLinejoin: "round",
|
|
792
792
|
className: e,
|
|
793
793
|
"aria-hidden": "true",
|
|
794
|
-
children: /* @__PURE__ */
|
|
794
|
+
children: /* @__PURE__ */ h("path", { d: "M5 12.5 9.5 17 19 7" })
|
|
795
795
|
});
|
|
796
796
|
}
|
|
797
|
-
function
|
|
798
|
-
return /* @__PURE__ */
|
|
797
|
+
function Fe({ className: e }) {
|
|
798
|
+
return /* @__PURE__ */ h("svg", {
|
|
799
799
|
viewBox: "0 0 24 24",
|
|
800
800
|
fill: "none",
|
|
801
801
|
stroke: "currentColor",
|
|
@@ -804,11 +804,11 @@ function Pe({ className: e }) {
|
|
|
804
804
|
strokeLinejoin: "round",
|
|
805
805
|
className: e,
|
|
806
806
|
"aria-hidden": "true",
|
|
807
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
808
808
|
});
|
|
809
809
|
}
|
|
810
|
-
function
|
|
811
|
-
return /* @__PURE__ */
|
|
810
|
+
function Ie({ className: e }) {
|
|
811
|
+
return /* @__PURE__ */ g("svg", {
|
|
812
812
|
viewBox: "0 0 24 24",
|
|
813
813
|
fill: "none",
|
|
814
814
|
stroke: "currentColor",
|
|
@@ -817,29 +817,29 @@ function Fe({ className: e }) {
|
|
|
817
817
|
strokeLinejoin: "round",
|
|
818
818
|
className: e,
|
|
819
819
|
"aria-hidden": "true",
|
|
820
|
-
children: [/* @__PURE__ */
|
|
820
|
+
children: [/* @__PURE__ */ h("circle", {
|
|
821
821
|
cx: "12",
|
|
822
822
|
cy: "12",
|
|
823
823
|
r: "9"
|
|
824
|
-
}), /* @__PURE__ */
|
|
824
|
+
}), /* @__PURE__ */ h("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
|
|
825
825
|
});
|
|
826
826
|
}
|
|
827
827
|
//#endregion
|
|
828
828
|
//#region src/ui/CopyMarkdownButton.tsx
|
|
829
|
-
var
|
|
830
|
-
function
|
|
831
|
-
let [
|
|
832
|
-
return
|
|
833
|
-
|
|
834
|
-
}, []), /* @__PURE__ */
|
|
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, {
|
|
835
835
|
delayDuration: 200,
|
|
836
|
-
children: /* @__PURE__ */
|
|
837
|
-
open:
|
|
836
|
+
children: /* @__PURE__ */ g(p.Root, {
|
|
837
|
+
open: a || c,
|
|
838
838
|
onOpenChange: d,
|
|
839
|
-
children: [/* @__PURE__ */
|
|
839
|
+
children: [/* @__PURE__ */ h(p.Trigger, {
|
|
840
840
|
asChild: !0,
|
|
841
|
-
children: /* @__PURE__ */
|
|
842
|
-
ref:
|
|
841
|
+
children: /* @__PURE__ */ h("button", {
|
|
842
|
+
ref: m,
|
|
843
843
|
type: "button",
|
|
844
844
|
onClick: async () => {
|
|
845
845
|
try {
|
|
@@ -847,18 +847,18 @@ function Le({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
|
|
|
847
847
|
} catch {
|
|
848
848
|
return;
|
|
849
849
|
}
|
|
850
|
-
s(!0),
|
|
850
|
+
s(!0), f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => s(!1), Le);
|
|
851
851
|
},
|
|
852
852
|
"aria-label": n,
|
|
853
853
|
className: `bailey-copy-button${t ? ` ${t}` : ""}`,
|
|
854
|
-
children:
|
|
854
|
+
children: h(a ? Pe : Ne, { className: "bailey-copy-icon" })
|
|
855
855
|
})
|
|
856
|
-
}), /* @__PURE__ */
|
|
856
|
+
}), /* @__PURE__ */ h(p.Portal, {
|
|
857
857
|
container: _ instanceof ShadowRoot ? _ : void 0,
|
|
858
|
-
children: /* @__PURE__ */
|
|
858
|
+
children: /* @__PURE__ */ g(p.Content, {
|
|
859
859
|
side: "top",
|
|
860
860
|
className: "bailey-tooltip-content",
|
|
861
|
-
children: [
|
|
861
|
+
children: [a ? i : r, /* @__PURE__ */ h(p.Arrow, { className: "bailey-tooltip-arrow" })]
|
|
862
862
|
})
|
|
863
863
|
})]
|
|
864
864
|
})
|
|
@@ -866,20 +866,20 @@ function Le({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
|
|
|
866
866
|
}
|
|
867
867
|
//#endregion
|
|
868
868
|
//#region src/ui/BaileyTracePanel.tsx
|
|
869
|
-
async function
|
|
869
|
+
async function ze(e) {
|
|
870
870
|
try {
|
|
871
871
|
await navigator.clipboard.writeText(e);
|
|
872
872
|
} catch {}
|
|
873
873
|
}
|
|
874
|
-
function
|
|
875
|
-
return /* @__PURE__ */
|
|
874
|
+
function Be({ text: e, label: t = "Copy" }) {
|
|
875
|
+
return /* @__PURE__ */ h("button", {
|
|
876
876
|
type: "button",
|
|
877
|
-
onClick: () =>
|
|
877
|
+
onClick: () => ze(e),
|
|
878
878
|
className: "bailey-trace-copy-button",
|
|
879
879
|
children: t
|
|
880
880
|
});
|
|
881
881
|
}
|
|
882
|
-
function
|
|
882
|
+
function Ve(e) {
|
|
883
883
|
if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
|
|
884
884
|
switch (e.kind) {
|
|
885
885
|
case "tool_start": return "bailey-trace-chip bailey-trace-chip-info";
|
|
@@ -889,73 +889,73 @@ function Be(e) {
|
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
891
|
function $({ label: e, content: t, copyable: n }) {
|
|
892
|
-
return /* @__PURE__ */
|
|
892
|
+
return /* @__PURE__ */ g("details", {
|
|
893
893
|
className: "bailey-trace-disclosure",
|
|
894
894
|
children: [
|
|
895
|
-
/* @__PURE__ */
|
|
895
|
+
/* @__PURE__ */ h("summary", {
|
|
896
896
|
className: "bailey-trace-disclosure-summary",
|
|
897
897
|
children: e
|
|
898
898
|
}),
|
|
899
|
-
n && /* @__PURE__ */
|
|
899
|
+
n && /* @__PURE__ */ h("div", {
|
|
900
900
|
className: "bailey-trace-disclosure-actions",
|
|
901
|
-
children: /* @__PURE__ */
|
|
901
|
+
children: /* @__PURE__ */ h(Be, { text: t })
|
|
902
902
|
}),
|
|
903
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__PURE__ */ h("pre", {
|
|
904
904
|
className: "bailey-trace-disclosure-content",
|
|
905
905
|
children: t
|
|
906
906
|
})
|
|
907
907
|
]
|
|
908
908
|
});
|
|
909
909
|
}
|
|
910
|
-
function
|
|
911
|
-
return /* @__PURE__ */
|
|
910
|
+
function He({ row: e }) {
|
|
911
|
+
return /* @__PURE__ */ g("div", {
|
|
912
912
|
className: "bailey-trace-row",
|
|
913
913
|
children: [
|
|
914
|
-
/* @__PURE__ */
|
|
914
|
+
/* @__PURE__ */ g("div", {
|
|
915
915
|
className: "bailey-trace-row-header",
|
|
916
916
|
children: [
|
|
917
|
-
/* @__PURE__ */
|
|
917
|
+
/* @__PURE__ */ h("span", {
|
|
918
918
|
className: "bailey-trace-row-time",
|
|
919
919
|
children: e.time
|
|
920
920
|
}),
|
|
921
|
-
/* @__PURE__ */
|
|
921
|
+
/* @__PURE__ */ h("span", {
|
|
922
922
|
className: "bailey-trace-row-gap",
|
|
923
923
|
title: "Time since the previous event",
|
|
924
924
|
children: de(e.gapMs)
|
|
925
925
|
}),
|
|
926
|
-
/* @__PURE__ */
|
|
927
|
-
className:
|
|
926
|
+
/* @__PURE__ */ h("span", {
|
|
927
|
+
className: Ve(e),
|
|
928
928
|
children: e.label
|
|
929
929
|
}),
|
|
930
|
-
/* @__PURE__ */
|
|
930
|
+
/* @__PURE__ */ h("span", {
|
|
931
931
|
className: "bailey-trace-row-summary",
|
|
932
932
|
children: e.summary
|
|
933
933
|
})
|
|
934
934
|
]
|
|
935
935
|
}),
|
|
936
|
-
e.argsDetail && /* @__PURE__ */
|
|
936
|
+
e.argsDetail && /* @__PURE__ */ h($, {
|
|
937
937
|
label: "args",
|
|
938
938
|
content: e.argsDetail
|
|
939
939
|
}),
|
|
940
|
-
e.outputDetail && /* @__PURE__ */
|
|
940
|
+
e.outputDetail && /* @__PURE__ */ h($, {
|
|
941
941
|
label: "output",
|
|
942
942
|
content: e.outputDetail
|
|
943
943
|
}),
|
|
944
|
-
e.rawDetail && /* @__PURE__ */
|
|
944
|
+
e.rawDetail && /* @__PURE__ */ h($, {
|
|
945
945
|
label: "raw",
|
|
946
946
|
content: e.rawDetail
|
|
947
947
|
})
|
|
948
948
|
]
|
|
949
949
|
});
|
|
950
950
|
}
|
|
951
|
-
function
|
|
951
|
+
function Ue(e, t) {
|
|
952
952
|
if (e.chunkCount === 0) return "Streamed: no chunks received";
|
|
953
953
|
if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
|
|
954
954
|
let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
|
|
955
955
|
return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
|
|
956
956
|
}
|
|
957
|
-
function
|
|
958
|
-
let t =
|
|
957
|
+
function We({ request: e }) {
|
|
958
|
+
let t = c(() => JSON.stringify({
|
|
959
959
|
model: e.model,
|
|
960
960
|
instructions: e.systemPrompt,
|
|
961
961
|
input: e.messages,
|
|
@@ -963,10 +963,10 @@ function Ue({ request: e }) {
|
|
|
963
963
|
tools: e.tools,
|
|
964
964
|
toolChoice: e.toolChoice
|
|
965
965
|
}, null, 2), [e]);
|
|
966
|
-
return /* @__PURE__ */
|
|
966
|
+
return /* @__PURE__ */ g("div", {
|
|
967
967
|
className: "bailey-trace-request-details",
|
|
968
968
|
children: [
|
|
969
|
-
/* @__PURE__ */
|
|
969
|
+
/* @__PURE__ */ g("span", {
|
|
970
970
|
className: "bailey-trace-request-meta",
|
|
971
971
|
children: [
|
|
972
972
|
"Last request — ",
|
|
@@ -976,26 +976,26 @@ function Ue({ request: e }) {
|
|
|
976
976
|
e.requestId ? ` · ${e.requestId}` : ""
|
|
977
977
|
]
|
|
978
978
|
}),
|
|
979
|
-
/* @__PURE__ */
|
|
979
|
+
/* @__PURE__ */ h("span", {
|
|
980
980
|
className: "bailey-trace-request-meta",
|
|
981
|
-
children:
|
|
981
|
+
children: Ue(e.streamStats, e.sentAt)
|
|
982
982
|
}),
|
|
983
|
-
/* @__PURE__ */
|
|
983
|
+
/* @__PURE__ */ h($, {
|
|
984
984
|
label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
|
|
985
985
|
content: e.systemPrompt,
|
|
986
986
|
copyable: !0
|
|
987
987
|
}),
|
|
988
|
-
/* @__PURE__ */
|
|
988
|
+
/* @__PURE__ */ h($, {
|
|
989
989
|
label: `Messages (${e.messages.length})`,
|
|
990
990
|
content: JSON.stringify(e.messages, null, 2),
|
|
991
991
|
copyable: !0
|
|
992
992
|
}),
|
|
993
|
-
e.response && /* @__PURE__ */
|
|
993
|
+
e.response && /* @__PURE__ */ h($, {
|
|
994
994
|
label: `Response (${e.response.content.length.toLocaleString()} chars)`,
|
|
995
995
|
content: e.response.content,
|
|
996
996
|
copyable: !0
|
|
997
997
|
}),
|
|
998
|
-
/* @__PURE__ */
|
|
998
|
+
/* @__PURE__ */ h($, {
|
|
999
999
|
label: "Full payload (JSON)",
|
|
1000
1000
|
content: t,
|
|
1001
1001
|
copyable: !0
|
|
@@ -1003,43 +1003,43 @@ function Ue({ request: e }) {
|
|
|
1003
1003
|
]
|
|
1004
1004
|
});
|
|
1005
1005
|
}
|
|
1006
|
-
function
|
|
1007
|
-
let r =
|
|
1008
|
-
return /* @__PURE__ */
|
|
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", {
|
|
1009
1009
|
className: "bailey-trace-body",
|
|
1010
1010
|
children: [
|
|
1011
|
-
/* @__PURE__ */
|
|
1011
|
+
/* @__PURE__ */ g("div", {
|
|
1012
1012
|
className: "bailey-trace-actions-row",
|
|
1013
|
-
children: [e.length > 0 && /* @__PURE__ */
|
|
1013
|
+
children: [e.length > 0 && /* @__PURE__ */ h(Be, {
|
|
1014
1014
|
text: a,
|
|
1015
1015
|
label: "Copy trace as JSON"
|
|
1016
|
-
}), /* @__PURE__ */
|
|
1016
|
+
}), /* @__PURE__ */ h("button", {
|
|
1017
1017
|
type: "button",
|
|
1018
1018
|
onClick: n,
|
|
1019
1019
|
className: "bailey-trace-copy-button",
|
|
1020
1020
|
children: "Clear"
|
|
1021
1021
|
})]
|
|
1022
1022
|
}),
|
|
1023
|
-
t && /* @__PURE__ */
|
|
1024
|
-
/* @__PURE__ */
|
|
1023
|
+
t && /* @__PURE__ */ h(We, { request: t }),
|
|
1024
|
+
/* @__PURE__ */ h("div", {
|
|
1025
1025
|
className: "bailey-trace-rows",
|
|
1026
1026
|
children: i.map((e, t) => {
|
|
1027
|
-
if (e.type === "single") return /* @__PURE__ */
|
|
1027
|
+
if (e.type === "single") return /* @__PURE__ */ h(He, { row: e.row }, e.row.key);
|
|
1028
1028
|
let n = e.rows.filter((e) => e.isToolStart).length;
|
|
1029
|
-
if (n <= 1) return /* @__PURE__ */
|
|
1029
|
+
if (n <= 1) return /* @__PURE__ */ h("div", {
|
|
1030
1030
|
className: "bailey-trace-rows",
|
|
1031
|
-
children: e.rows.map((e) => /* @__PURE__ */
|
|
1031
|
+
children: e.rows.map((e) => /* @__PURE__ */ h(He, { row: e }, e.key))
|
|
1032
1032
|
}, `group-${t}`);
|
|
1033
1033
|
let r = e.rows.filter((e) => e.failed).length;
|
|
1034
|
-
return /* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ g("details", {
|
|
1035
1035
|
className: "bailey-trace-group",
|
|
1036
|
-
children: [/* @__PURE__ */
|
|
1036
|
+
children: [/* @__PURE__ */ g("summary", {
|
|
1037
1037
|
className: "bailey-trace-group-summary",
|
|
1038
1038
|
children: [
|
|
1039
|
-
/* @__PURE__ */
|
|
1039
|
+
/* @__PURE__ */ h("strong", { children: e.toolName }),
|
|
1040
1040
|
" × ",
|
|
1041
1041
|
n,
|
|
1042
|
-
r > 0 && /* @__PURE__ */
|
|
1042
|
+
r > 0 && /* @__PURE__ */ g("span", {
|
|
1043
1043
|
className: "bailey-trace-group-failed",
|
|
1044
1044
|
children: [
|
|
1045
1045
|
" ",
|
|
@@ -1048,9 +1048,9 @@ function We({ events: e, lastRequest: t, onClear: n }) {
|
|
|
1048
1048
|
]
|
|
1049
1049
|
})
|
|
1050
1050
|
]
|
|
1051
|
-
}), /* @__PURE__ */
|
|
1051
|
+
}), /* @__PURE__ */ h("div", {
|
|
1052
1052
|
className: "bailey-trace-rows",
|
|
1053
|
-
children: e.rows.map((e) => /* @__PURE__ */
|
|
1053
|
+
children: e.rows.map((e) => /* @__PURE__ */ h(He, { row: e }, e.key))
|
|
1054
1054
|
})]
|
|
1055
1055
|
}, `group-${t}`);
|
|
1056
1056
|
})
|
|
@@ -1058,13 +1058,13 @@ function We({ events: e, lastRequest: t, onClear: n }) {
|
|
|
1058
1058
|
]
|
|
1059
1059
|
});
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1062
|
-
let [r, i] =
|
|
1063
|
-
return e.length === 0 && !t ? null : /* @__PURE__ */
|
|
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", {
|
|
1064
1064
|
className: "bailey-trace-panel",
|
|
1065
|
-
children: [/* @__PURE__ */
|
|
1065
|
+
children: [/* @__PURE__ */ g("div", {
|
|
1066
1066
|
className: "bailey-trace-toggle-row",
|
|
1067
|
-
children: [/* @__PURE__ */
|
|
1067
|
+
children: [/* @__PURE__ */ g("button", {
|
|
1068
1068
|
type: "button",
|
|
1069
1069
|
onClick: () => i((e) => !e),
|
|
1070
1070
|
"aria-expanded": r,
|
|
@@ -1076,11 +1076,11 @@ function Ge({ events: e, lastRequest: t, onClear: n }) {
|
|
|
1076
1076
|
e.length,
|
|
1077
1077
|
")"
|
|
1078
1078
|
]
|
|
1079
|
-
}), o && /* @__PURE__ */
|
|
1079
|
+
}), o && /* @__PURE__ */ h("span", {
|
|
1080
1080
|
className: a ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
|
|
1081
1081
|
children: o
|
|
1082
1082
|
})]
|
|
1083
|
-
}), r && /* @__PURE__ */
|
|
1083
|
+
}), r && /* @__PURE__ */ h(Ge, {
|
|
1084
1084
|
events: e,
|
|
1085
1085
|
lastRequest: t,
|
|
1086
1086
|
onClear: n
|
|
@@ -1088,8 +1088,18 @@ function Ge({ events: e, lastRequest: t, onClear: n }) {
|
|
|
1088
1088
|
});
|
|
1089
1089
|
}
|
|
1090
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
|
|
1091
1101
|
//#region src/ui/BaileyChatPanel.tsx
|
|
1092
|
-
var
|
|
1102
|
+
var Je = "How can bailey AI help you today?", Ye = "Reply to bailey AI", Xe = {
|
|
1093
1103
|
newChatButtonText: "New chat",
|
|
1094
1104
|
newChatAriaLabel: "new chat",
|
|
1095
1105
|
historyAriaLabel: "conversation history",
|
|
@@ -1105,45 +1115,45 @@ var Ke = "How can bailey AI help you today?", qe = "Reply to bailey AI", Je = {
|
|
|
1105
1115
|
copyButtonAriaLabel: "copy response as markdown",
|
|
1106
1116
|
copyButtonTooltipDefault: "Copy as markdown",
|
|
1107
1117
|
copyButtonTooltipCopied: "Copied!"
|
|
1108
|
-
},
|
|
1109
|
-
...
|
|
1110
|
-
p: ({ children: e }) => /* @__PURE__ */ m
|
|
1111
|
-
},
|
|
1112
|
-
return /* @__PURE__ */
|
|
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", {
|
|
1113
1123
|
className: "bailey-markdown-content",
|
|
1114
|
-
children: /* @__PURE__ */
|
|
1115
|
-
remarkPlugins:
|
|
1124
|
+
children: /* @__PURE__ */ h(d, {
|
|
1125
|
+
remarkPlugins: Ze,
|
|
1116
1126
|
components: t,
|
|
1117
1127
|
skipHtml: !0,
|
|
1118
1128
|
children: e
|
|
1119
1129
|
})
|
|
1120
1130
|
});
|
|
1121
1131
|
});
|
|
1122
|
-
function
|
|
1132
|
+
function et(e, t, n) {
|
|
1123
1133
|
if (e !== "streaming") return;
|
|
1124
1134
|
let r = t.filter((e) => e.turnSentAt === n?.sentAt);
|
|
1125
|
-
if (r.length !== 0) return
|
|
1135
|
+
if (r.length !== 0) return Z(r[r.length - 1]);
|
|
1126
1136
|
}
|
|
1127
|
-
function
|
|
1137
|
+
function tt(e) {
|
|
1128
1138
|
let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
|
|
1129
1139
|
hour: "numeric",
|
|
1130
1140
|
minute: "2-digit"
|
|
1131
1141
|
});
|
|
1132
1142
|
return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
|
|
1133
1143
|
}
|
|
1134
|
-
function
|
|
1135
|
-
let { messages: T, traceEvents: E, lastRequest: D, status: O, error: k, send: A, stop:
|
|
1136
|
-
...
|
|
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,
|
|
1137
1147
|
...C
|
|
1138
|
-
}, R = w ??
|
|
1148
|
+
}, R = w ?? tt, z = l(null), B = De(z), V = l(null), H = l(null), U = l(!0), W = c(() => ke({
|
|
1139
1149
|
renderTable: x,
|
|
1140
1150
|
renderChart: S
|
|
1141
|
-
}), [x, S]),
|
|
1151
|
+
}), [x, S]), G = c(() => et(O, E, D), [
|
|
1142
1152
|
O,
|
|
1143
1153
|
E,
|
|
1144
1154
|
D
|
|
1145
|
-
]),
|
|
1146
|
-
|
|
1155
|
+
]), K = T.length === 0, q = t ?? (K ? r ?? Je : n);
|
|
1156
|
+
o(() => {
|
|
1147
1157
|
let e = H.current;
|
|
1148
1158
|
if (!e) return;
|
|
1149
1159
|
let t = () => {
|
|
@@ -1151,102 +1161,106 @@ function et({ chat: e, placeholder: t, replyPlaceholder: n = qe, emptyPlaceholde
|
|
|
1151
1161
|
U.current = t < 60;
|
|
1152
1162
|
};
|
|
1153
1163
|
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
1154
|
-
}, []),
|
|
1164
|
+
}, []), o(() => {
|
|
1155
1165
|
U.current && V.current?.scrollIntoView({
|
|
1156
1166
|
behavior: O === "streaming" ? "auto" : "smooth",
|
|
1157
1167
|
block: "nearest"
|
|
1158
1168
|
});
|
|
1159
1169
|
}, [T, O]);
|
|
1160
|
-
let
|
|
1170
|
+
let J = (e) => {
|
|
1161
1171
|
U.current = !0, A(e);
|
|
1162
1172
|
};
|
|
1163
|
-
return /* @__PURE__ */
|
|
1173
|
+
return /* @__PURE__ */ h(ve.Provider, {
|
|
1164
1174
|
value: B,
|
|
1165
|
-
children: /* @__PURE__ */
|
|
1175
|
+
children: /* @__PURE__ */ h("div", {
|
|
1166
1176
|
ref: z,
|
|
1167
|
-
className: `bailey-chat-panel${
|
|
1177
|
+
className: `bailey-chat-panel${m ? ` ${m}` : ""}`,
|
|
1168
1178
|
style: _ !== void 0 || v !== void 0 ? {
|
|
1169
1179
|
height: _,
|
|
1170
1180
|
width: v
|
|
1171
1181
|
} : void 0,
|
|
1172
|
-
children: /* @__PURE__ */
|
|
1182
|
+
children: /* @__PURE__ */ g("div", {
|
|
1173
1183
|
className: "bailey-chat-panel-inner",
|
|
1174
1184
|
children: [
|
|
1175
|
-
/* @__PURE__ */
|
|
1185
|
+
/* @__PURE__ */ g("div", {
|
|
1176
1186
|
className: "bailey-toolbar-row",
|
|
1177
|
-
children: [!
|
|
1187
|
+
children: [!K && /* @__PURE__ */ h("button", {
|
|
1178
1188
|
type: "button",
|
|
1179
1189
|
onClick: P,
|
|
1180
1190
|
"aria-label": L.newChatAriaLabel,
|
|
1181
1191
|
className: "bailey-new-chat-button",
|
|
1182
1192
|
children: L.newChatButtonText
|
|
1183
|
-
}),
|
|
1193
|
+
}), a && /* @__PURE__ */ h("button", {
|
|
1184
1194
|
type: "button",
|
|
1185
|
-
onClick:
|
|
1195
|
+
onClick: a,
|
|
1186
1196
|
"aria-label": L.historyAriaLabel,
|
|
1187
1197
|
className: "bailey-history-button",
|
|
1188
|
-
children: /* @__PURE__ */
|
|
1198
|
+
children: /* @__PURE__ */ h(Fe, { className: "bailey-history-icon" })
|
|
1189
1199
|
})]
|
|
1190
1200
|
}),
|
|
1191
|
-
/* @__PURE__ */
|
|
1201
|
+
/* @__PURE__ */ g("div", {
|
|
1192
1202
|
className: "bailey-chat-transcript",
|
|
1193
1203
|
ref: H,
|
|
1194
1204
|
children: [
|
|
1195
|
-
|
|
1205
|
+
K && (i && i.length > 0 ? /* @__PURE__ */ g("div", {
|
|
1196
1206
|
className: "bailey-suggestions",
|
|
1197
|
-
children: [/* @__PURE__ */
|
|
1207
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1198
1208
|
className: "bailey-suggestions-title",
|
|
1199
1209
|
children: L.suggestionsTitle
|
|
1200
|
-
}), i.map((e, t) => /* @__PURE__ */
|
|
1210
|
+
}), i.map((e, t) => /* @__PURE__ */ g("button", {
|
|
1201
1211
|
type: "button",
|
|
1202
|
-
onClick: () =>
|
|
1212
|
+
onClick: () => J(e.value ?? e.label),
|
|
1203
1213
|
className: "bailey-suggestion-card",
|
|
1204
|
-
children: [/* @__PURE__ */
|
|
1214
|
+
children: [/* @__PURE__ */ h("span", { children: e.label }), /* @__PURE__ */ h(Me, { className: "bailey-suggestion-icon" })]
|
|
1205
1215
|
}, `${e.label}-${t}`))]
|
|
1206
|
-
}) : /* @__PURE__ */
|
|
1216
|
+
}) : /* @__PURE__ */ h("div", {
|
|
1207
1217
|
className: "bailey-empty-state",
|
|
1208
1218
|
children: L.emptyStateMessage
|
|
1209
1219
|
})),
|
|
1210
1220
|
T.map((e, t) => {
|
|
1211
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];
|
|
1212
|
-
return /* @__PURE__ */
|
|
1222
|
+
return /* @__PURE__ */ h("div", {
|
|
1213
1223
|
className: e.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
|
|
1214
|
-
children: e.role === "user" ? /* @__PURE__ */
|
|
1224
|
+
children: e.role === "user" ? /* @__PURE__ */ g("div", {
|
|
1215
1225
|
className: "bailey-user-message",
|
|
1216
|
-
children: [/* @__PURE__ */
|
|
1226
|
+
children: [/* @__PURE__ */ g("div", {
|
|
1217
1227
|
className: "bailey-message-meta",
|
|
1218
|
-
children: [/* @__PURE__ */
|
|
1228
|
+
children: [/* @__PURE__ */ h("span", {
|
|
1219
1229
|
className: "bailey-message-meta-name",
|
|
1220
1230
|
children: L.youLabel
|
|
1221
|
-
}), e.createdAt !== void 0 && /* @__PURE__ */
|
|
1222
|
-
}), /* @__PURE__ */
|
|
1231
|
+
}), e.createdAt !== void 0 && /* @__PURE__ */ h("span", { children: R(e.createdAt) })]
|
|
1232
|
+
}), /* @__PURE__ */ h("div", {
|
|
1223
1233
|
className: "bailey-user-bubble",
|
|
1224
1234
|
children: e.content
|
|
1225
1235
|
})]
|
|
1226
|
-
}) : r ? /* @__PURE__ */
|
|
1236
|
+
}) : r ? /* @__PURE__ */ h("div", {
|
|
1227
1237
|
className: "bailey-thinking-hint",
|
|
1228
|
-
children:
|
|
1229
|
-
}) : /* @__PURE__ */
|
|
1238
|
+
children: G ?? L.thinkingHint
|
|
1239
|
+
}) : /* @__PURE__ */ g("div", {
|
|
1230
1240
|
className: "bailey-assistant-message",
|
|
1231
1241
|
children: [
|
|
1232
|
-
a && /* @__PURE__ */
|
|
1242
|
+
a && /* @__PURE__ */ g("div", {
|
|
1233
1243
|
className: "bailey-activity-line",
|
|
1234
|
-
children: [/* @__PURE__ */
|
|
1244
|
+
children: [/* @__PURE__ */ h("span", {
|
|
1235
1245
|
className: "bailey-activity-icon",
|
|
1236
|
-
children:
|
|
1237
|
-
}), /* @__PURE__ */
|
|
1246
|
+
children: f?.(a.toolName) ?? /* @__PURE__ */ h(Ie, {})
|
|
1247
|
+
}), /* @__PURE__ */ h("span", { children: a.text })]
|
|
1238
1248
|
}),
|
|
1239
|
-
/* @__PURE__ */
|
|
1249
|
+
/* @__PURE__ */ h($e, {
|
|
1240
1250
|
content: e.content,
|
|
1241
|
-
components:
|
|
1251
|
+
components: W
|
|
1242
1252
|
}),
|
|
1243
|
-
e.
|
|
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", {
|
|
1244
1258
|
className: "bailey-streaming-hint",
|
|
1245
|
-
children:
|
|
1259
|
+
children: G
|
|
1246
1260
|
}),
|
|
1247
|
-
!e.streaming && /* @__PURE__ */
|
|
1261
|
+
!e.streaming && /* @__PURE__ */ g("div", {
|
|
1248
1262
|
className: "bailey-message-actions",
|
|
1249
|
-
children: [/* @__PURE__ */
|
|
1263
|
+
children: [/* @__PURE__ */ h(Re, {
|
|
1250
1264
|
markdown: e.content,
|
|
1251
1265
|
ariaLabel: L.copyButtonAriaLabel,
|
|
1252
1266
|
tooltipDefaultText: L.copyButtonTooltipDefault,
|
|
@@ -1257,20 +1271,20 @@ function et({ chat: e, placeholder: t, replyPlaceholder: n = qe, emptyPlaceholde
|
|
|
1257
1271
|
})
|
|
1258
1272
|
}, e.id);
|
|
1259
1273
|
}),
|
|
1260
|
-
/* @__PURE__ */
|
|
1274
|
+
/* @__PURE__ */ h("div", { ref: V })
|
|
1261
1275
|
]
|
|
1262
1276
|
}),
|
|
1263
|
-
k && /* @__PURE__ */
|
|
1277
|
+
k && /* @__PURE__ */ g("div", {
|
|
1264
1278
|
className: "bailey-error-banner",
|
|
1265
1279
|
role: "alert",
|
|
1266
|
-
children: [/* @__PURE__ */
|
|
1280
|
+
children: [/* @__PURE__ */ h("span", { children: k }), /* @__PURE__ */ g("div", {
|
|
1267
1281
|
className: "bailey-error-actions",
|
|
1268
|
-
children: [/* @__PURE__ */
|
|
1282
|
+
children: [/* @__PURE__ */ h("button", {
|
|
1269
1283
|
type: "button",
|
|
1270
|
-
onClick:
|
|
1284
|
+
onClick: ee,
|
|
1271
1285
|
className: "bailey-retry-button",
|
|
1272
1286
|
children: L.retryButtonText
|
|
1273
|
-
}), /* @__PURE__ */
|
|
1287
|
+
}), /* @__PURE__ */ h("button", {
|
|
1274
1288
|
type: "button",
|
|
1275
1289
|
onClick: N,
|
|
1276
1290
|
"aria-label": L.dismissErrorAriaLabel,
|
|
@@ -1279,58 +1293,58 @@ function et({ chat: e, placeholder: t, replyPlaceholder: n = qe, emptyPlaceholde
|
|
|
1279
1293
|
})]
|
|
1280
1294
|
})]
|
|
1281
1295
|
}),
|
|
1282
|
-
!y && /* @__PURE__ */
|
|
1296
|
+
!y && /* @__PURE__ */ h(Ke, {
|
|
1283
1297
|
events: E,
|
|
1284
1298
|
lastRequest: D,
|
|
1285
1299
|
onClear: M
|
|
1286
1300
|
}),
|
|
1287
|
-
/* @__PURE__ */
|
|
1301
|
+
/* @__PURE__ */ g("form", {
|
|
1288
1302
|
onSubmit: (e) => {
|
|
1289
|
-
e.preventDefault(), !(!F.trim() || O === "streaming") && (
|
|
1303
|
+
e.preventDefault(), !(!F.trim() || O === "streaming") && (J(F), I(""));
|
|
1290
1304
|
},
|
|
1291
1305
|
className: "bailey-input-row",
|
|
1292
|
-
children: [/* @__PURE__ */
|
|
1306
|
+
children: [/* @__PURE__ */ h("input", {
|
|
1293
1307
|
type: "text",
|
|
1294
|
-
placeholder:
|
|
1295
|
-
"aria-label":
|
|
1308
|
+
placeholder: q,
|
|
1309
|
+
"aria-label": q,
|
|
1296
1310
|
value: F,
|
|
1297
1311
|
onChange: (e) => I(e.target.value),
|
|
1298
1312
|
disabled: O === "streaming",
|
|
1299
1313
|
className: "bailey-input"
|
|
1300
|
-
}), O === "streaming" ? /* @__PURE__ */
|
|
1314
|
+
}), O === "streaming" ? /* @__PURE__ */ h(p.Provider, {
|
|
1301
1315
|
delayDuration: 200,
|
|
1302
|
-
children: /* @__PURE__ */
|
|
1316
|
+
children: /* @__PURE__ */ g(p.Root, { children: [/* @__PURE__ */ h(p.Trigger, {
|
|
1303
1317
|
asChild: !0,
|
|
1304
|
-
children: /* @__PURE__ */
|
|
1318
|
+
children: /* @__PURE__ */ h("button", {
|
|
1305
1319
|
type: "button",
|
|
1306
|
-
onClick:
|
|
1320
|
+
onClick: j,
|
|
1307
1321
|
"aria-label": L.stopAriaLabel,
|
|
1308
1322
|
className: "bailey-stop-button",
|
|
1309
|
-
children: /* @__PURE__ */
|
|
1323
|
+
children: /* @__PURE__ */ h(je, { className: "bailey-stop-icon" })
|
|
1310
1324
|
})
|
|
1311
|
-
}), /* @__PURE__ */
|
|
1325
|
+
}), /* @__PURE__ */ h(p.Portal, {
|
|
1312
1326
|
container: B instanceof ShadowRoot ? B : void 0,
|
|
1313
|
-
children: /* @__PURE__ */
|
|
1327
|
+
children: /* @__PURE__ */ g(p.Content, {
|
|
1314
1328
|
side: "top",
|
|
1315
1329
|
className: "bailey-tooltip-content",
|
|
1316
|
-
children: [L.stopButtonText, /* @__PURE__ */
|
|
1330
|
+
children: [L.stopButtonText, /* @__PURE__ */ h(p.Arrow, { className: "bailey-tooltip-arrow" })]
|
|
1317
1331
|
})
|
|
1318
1332
|
})] })
|
|
1319
|
-
}) : /* @__PURE__ */
|
|
1333
|
+
}) : /* @__PURE__ */ h("button", {
|
|
1320
1334
|
type: "submit",
|
|
1321
1335
|
"aria-label": L.sendAriaLabel,
|
|
1322
1336
|
disabled: !F.trim(),
|
|
1323
1337
|
className: "bailey-send-button",
|
|
1324
|
-
children: /* @__PURE__ */
|
|
1338
|
+
children: /* @__PURE__ */ h(Ae, { className: "bailey-send-icon" })
|
|
1325
1339
|
})]
|
|
1326
1340
|
}),
|
|
1327
|
-
(
|
|
1341
|
+
(K || s?.alwaysVisible) && s && /* @__PURE__ */ h("div", {
|
|
1328
1342
|
className: "bailey-privacy-note",
|
|
1329
|
-
children: /* @__PURE__ */
|
|
1330
|
-
remarkPlugins:
|
|
1331
|
-
components:
|
|
1343
|
+
children: /* @__PURE__ */ h(d, {
|
|
1344
|
+
remarkPlugins: Ze,
|
|
1345
|
+
components: Qe,
|
|
1332
1346
|
skipHtml: !0,
|
|
1333
|
-
children:
|
|
1347
|
+
children: s.markdown
|
|
1334
1348
|
})
|
|
1335
1349
|
})
|
|
1336
1350
|
]
|
|
@@ -1340,6 +1354,6 @@ function et({ chat: e, placeholder: t, replyPlaceholder: n = qe, emptyPlaceholde
|
|
|
1340
1354
|
}
|
|
1341
1355
|
//#endregion
|
|
1342
1356
|
//#region src/index.ts
|
|
1343
|
-
var
|
|
1357
|
+
var rt = "0.3.1-pre.2";
|
|
1344
1358
|
//#endregion
|
|
1345
|
-
export {
|
|
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 };
|