chordia-ui 3.3.2 → 3.3.3
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/README.md +4 -0
- package/dist/SmallButton.cjs.js +1 -1
- package/dist/SmallButton.cjs.js.map +1 -1
- package/dist/SmallButton.es.js +170 -162
- package/dist/SmallButton.es.js.map +1 -1
- package/dist/components/chat.cjs.js +8 -8
- package/dist/components/chat.cjs.js.map +1 -1
- package/dist/components/chat.es.js +329 -335
- package/dist/components/chat.es.js.map +1 -1
- package/dist/components/data.cjs.js +1 -1
- package/dist/components/data.cjs.js.map +1 -1
- package/dist/components/data.es.js +83 -80
- package/dist/components/data.es.js.map +1 -1
- package/dist/components/layout.cjs.js +1 -1
- package/dist/components/layout.cjs.js.map +1 -1
- package/dist/components/layout.es.js +3 -1
- package/dist/components/layout.es.js.map +1 -1
- package/dist/index.cjs2.js +1 -1
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.es2.js +4 -4
- package/dist/index.es2.js.map +1 -1
- package/dist/pages/interactionDetails.cjs.js +2 -2
- package/dist/pages/interactionDetails.cjs.js.map +1 -1
- package/dist/pages/interactionDetails.es.js +117 -123
- package/dist/pages/interactionDetails.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/chat/ChatHistoryPanel.jsx +3 -3
- package/src/components/chat/ChatInterface.jsx +14 -14
- package/src/components/common/MessageThread.jsx +19 -19
- package/src/components/data/DataTable.jsx +18 -15
- package/src/components/layout/SplitPane.jsx +2 -0
- package/src/components/login/LoginPage.jsx +4 -4
- package/src/components/primitives/SmallButton.jsx +14 -6
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as s, jsx as e, Fragment as J } from "react/jsx-runtime";
|
|
2
2
|
import de, { useState as M, useRef as Y, useEffect as G, useCallback as xe } from "react";
|
|
3
|
-
import { Wrench as ve, Check as Se, Copy as
|
|
4
|
-
import { ResponsiveContainer as Z, PieChart as
|
|
3
|
+
import { Wrench as ve, Check as Se, Copy as we, PanelRightOpen as ke, Send as ye, Search as Ce, MessageSquare as ze, Pin as Te, Clock as ge, Hash as he, AtSign as Be, Paperclip as Re } from "lucide-react";
|
|
4
|
+
import { ResponsiveContainer as Z, PieChart as Ae, Pie as Le, Cell as ce, Tooltip as ee, AreaChart as Ie, CartesianGrid as ne, XAxis as oe, YAxis as ie, Legend as ae, Area as Me, LineChart as De, Line as Ee, BarChart as fe, Bar as me } from "recharts";
|
|
5
5
|
const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
6
|
-
const [y,
|
|
6
|
+
const [y, i] = M(/* @__PURE__ */ new Set()), v = async (o, n) => {
|
|
7
7
|
try {
|
|
8
|
-
await navigator.clipboard.writeText(o),
|
|
9
|
-
|
|
8
|
+
await navigator.clipboard.writeText(o), i((t) => /* @__PURE__ */ new Set([...t, n])), setTimeout(() => {
|
|
9
|
+
i((t) => {
|
|
10
10
|
const r = new Set(t);
|
|
11
11
|
return r.delete(n), r;
|
|
12
12
|
});
|
|
@@ -67,7 +67,7 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
67
67
|
c.target.style.background = "none", c.target.style.color = "rgba(255,255,255,0.7)";
|
|
68
68
|
},
|
|
69
69
|
children: [
|
|
70
|
-
r ? /* @__PURE__ */ e(Se, { size: 12 }) : /* @__PURE__ */ e(
|
|
70
|
+
r ? /* @__PURE__ */ e(Se, { size: 12 }) : /* @__PURE__ */ e(we, { size: 12 }),
|
|
71
71
|
r ? "Copied!" : "Copy"
|
|
72
72
|
]
|
|
73
73
|
}
|
|
@@ -96,7 +96,7 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
96
96
|
c.currentTarget.style.background = "none", c.currentTarget.style.color = "rgba(255,255,255,0.7)";
|
|
97
97
|
},
|
|
98
98
|
children: [
|
|
99
|
-
/* @__PURE__ */ e(
|
|
99
|
+
/* @__PURE__ */ e(ke, { size: 12 }),
|
|
100
100
|
"Canvas"
|
|
101
101
|
]
|
|
102
102
|
}
|
|
@@ -117,14 +117,14 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
117
117
|
},
|
|
118
118
|
t
|
|
119
119
|
);
|
|
120
|
-
},
|
|
120
|
+
}, k = (o) => {
|
|
121
121
|
const n = [], t = o.split(`
|
|
122
122
|
`);
|
|
123
123
|
let r = 0, c = 0;
|
|
124
124
|
for (; r < t.length; ) {
|
|
125
|
-
const
|
|
126
|
-
if (
|
|
127
|
-
const p =
|
|
125
|
+
const g = t[r];
|
|
126
|
+
if (g.trim().startsWith("```")) {
|
|
127
|
+
const p = g.trim().slice(3);
|
|
128
128
|
let C = [];
|
|
129
129
|
for (r++; r < t.length && !t[r].trim().startsWith("```"); )
|
|
130
130
|
C.push(t[r]), r++;
|
|
@@ -132,10 +132,10 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
132
132
|
`), p, `code-${c++}`));
|
|
133
133
|
continue;
|
|
134
134
|
}
|
|
135
|
-
if (
|
|
136
|
-
const p =
|
|
135
|
+
if (g.startsWith("#")) {
|
|
136
|
+
const p = g.match(/^#+/)[0].length, C = g.slice(p).trim(), z = p === 1 ? "h2" : p === 2 ? "h3" : p === 3 ? "h4" : "h5";
|
|
137
137
|
n.push(
|
|
138
|
-
de.createElement(
|
|
138
|
+
de.createElement(z, {
|
|
139
139
|
key: `header-${r}`,
|
|
140
140
|
style: {
|
|
141
141
|
fontSize: p === 1 ? "18px" : p === 2 ? "16px" : "14px",
|
|
@@ -149,7 +149,7 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
149
149
|
), r++;
|
|
150
150
|
continue;
|
|
151
151
|
}
|
|
152
|
-
if (
|
|
152
|
+
if (g.trim() === "---" || g.trim() === "***") {
|
|
153
153
|
n.push(
|
|
154
154
|
/* @__PURE__ */ e("hr", { style: {
|
|
155
155
|
border: "none",
|
|
@@ -159,18 +159,18 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
159
159
|
), r++;
|
|
160
160
|
continue;
|
|
161
161
|
}
|
|
162
|
-
if (
|
|
163
|
-
const p = [], C = /^\s*\d+\./.test(
|
|
162
|
+
if (g.match(/^(\s*)([-*+]|\d+\.)\s/)) {
|
|
163
|
+
const p = [], C = /^\s*\d+\./.test(g);
|
|
164
164
|
for (; r < t.length && (t[r].match(/^(\s*)([-*+]|\d+\.)\s/) || t[r].trim() === ""); ) {
|
|
165
165
|
if (t[r].trim() !== "") {
|
|
166
|
-
const
|
|
167
|
-
|
|
166
|
+
const B = t[r].match(/^(\s*)([-*+]|\d+\.)\s(.*)$/);
|
|
167
|
+
B && p.push(B[3]);
|
|
168
168
|
}
|
|
169
169
|
r++;
|
|
170
170
|
}
|
|
171
|
-
const
|
|
171
|
+
const z = C ? "ol" : "ul";
|
|
172
172
|
n.push(
|
|
173
|
-
de.createElement(
|
|
173
|
+
de.createElement(z, {
|
|
174
174
|
key: `list-${r}`,
|
|
175
175
|
style: {
|
|
176
176
|
margin: "8px 0",
|
|
@@ -178,20 +178,20 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
178
178
|
color: "var(--text-strong, rgba(30,33,37,0.92))"
|
|
179
179
|
}
|
|
180
180
|
}, p.map(
|
|
181
|
-
(
|
|
182
|
-
key: `item-${
|
|
181
|
+
(B, a) => de.createElement("li", {
|
|
182
|
+
key: `item-${a}`,
|
|
183
183
|
style: { marginBottom: "4px" }
|
|
184
|
-
},
|
|
184
|
+
}, d(B))
|
|
185
185
|
))
|
|
186
186
|
);
|
|
187
187
|
continue;
|
|
188
188
|
}
|
|
189
|
-
if (
|
|
189
|
+
if (g.trim().startsWith("|") && g.trim().endsWith("|")) {
|
|
190
190
|
const p = [];
|
|
191
191
|
for (; r < t.length && t[r].trim().startsWith("|") && t[r].trim().endsWith("|"); )
|
|
192
192
|
p.push(t[r]), r++;
|
|
193
193
|
if (p.length >= 2) {
|
|
194
|
-
const C = (
|
|
194
|
+
const C = (l) => l.trim().slice(1, -1).split("|").map((x) => x.trim()), z = C(p[0]), B = (l) => C(l).every((x) => /^[-:]+$/.test(x)), a = p.length >= 2 && B(p[1]), w = a ? 2 : 1, D = a ? C(p[1]).map((l) => l.startsWith(":") && l.endsWith(":") ? "center" : l.endsWith(":") ? "right" : "left") : z.map(() => "left"), T = {
|
|
195
195
|
padding: "6px 12px",
|
|
196
196
|
borderBottom: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
|
|
197
197
|
fontSize: "13px",
|
|
@@ -206,14 +206,14 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
206
206
|
borderRadius: "6px",
|
|
207
207
|
overflow: "hidden"
|
|
208
208
|
}, children: [
|
|
209
|
-
|
|
210
|
-
/* @__PURE__ */ e("tbody", { children: (
|
|
209
|
+
a && /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { style: { background: "var(--hover-warm-subtle, rgba(231,212,162,0.08))" }, children: z.map((l, x) => /* @__PURE__ */ e("th", { style: { ...T, fontWeight: 660, textAlign: D[x] || "left", whiteSpace: "nowrap" }, children: d(l) }, x)) }) }),
|
|
210
|
+
/* @__PURE__ */ e("tbody", { children: (a ? p.slice(w) : p).map((l, x) => /* @__PURE__ */ e("tr", { style: { background: x % 2 === 1 ? "var(--hover-warm-subtle, rgba(231,212,162,0.04))" : "transparent" }, children: C(l).map((I, S) => /* @__PURE__ */ e("td", { style: { ...T, textAlign: D[S] || "left" }, children: d(I) }, S)) }, x)) })
|
|
211
211
|
] }) }, `table-${r}`)
|
|
212
212
|
);
|
|
213
213
|
}
|
|
214
214
|
continue;
|
|
215
215
|
}
|
|
216
|
-
if (
|
|
216
|
+
if (g.trim()) {
|
|
217
217
|
const p = [];
|
|
218
218
|
for (; r < t.length && t[r].trim() && !t[r].match(/^(#|```|---|\*\*\*|(\s*)([-*+]|\d+\.)\s)/) && !(t[r].trim().startsWith("|") && t[r].trim().endsWith("|")); )
|
|
219
219
|
p.push(t[r]), r++;
|
|
@@ -222,7 +222,7 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
222
222
|
margin: "8px 0",
|
|
223
223
|
lineHeight: 1.6,
|
|
224
224
|
color: "var(--text-strong, rgba(30,33,37,0.92))"
|
|
225
|
-
}, children:
|
|
225
|
+
}, children: d(p.join(" ")) }, `p-${r}`)
|
|
226
226
|
);
|
|
227
227
|
} else
|
|
228
228
|
r++;
|
|
@@ -233,14 +233,14 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
233
233
|
let t = o, r = 0;
|
|
234
234
|
for (; t.length > 0; ) {
|
|
235
235
|
if (m) {
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
238
|
-
const
|
|
236
|
+
const B = t.match(/^([^\s`*\[]+(?:\/src\/|\/components\/|\/packages\/)[^\s`*\[]*|[^\s`*\[]*\.(ts|tsx|js|jsx|py|css|scss|sass|json|md|yaml|yml|html|xml|sh|sql|go|rs|php|java|c|cpp|h|hpp)(?:\b|$))/);
|
|
237
|
+
if (B) {
|
|
238
|
+
const a = B[1];
|
|
239
239
|
n.push(
|
|
240
240
|
/* @__PURE__ */ e(
|
|
241
241
|
"span",
|
|
242
242
|
{
|
|
243
|
-
onClick: () => m(
|
|
243
|
+
onClick: () => m(a),
|
|
244
244
|
style: {
|
|
245
245
|
color: "var(--rail-discovery, #5E88B0)",
|
|
246
246
|
textDecoration: "underline",
|
|
@@ -256,17 +256,17 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
256
256
|
textDecorationStyle: "solid"
|
|
257
257
|
}
|
|
258
258
|
},
|
|
259
|
-
onMouseEnter: (
|
|
260
|
-
|
|
259
|
+
onMouseEnter: (w) => {
|
|
260
|
+
w.target.style.background = "var(--hover-warm-subtle, rgba(231,212,162,0.08))", w.target.style.textDecorationStyle = "solid";
|
|
261
261
|
},
|
|
262
|
-
onMouseLeave: (
|
|
263
|
-
|
|
262
|
+
onMouseLeave: (w) => {
|
|
263
|
+
w.target.style.background = "none", w.target.style.textDecorationStyle = "dotted";
|
|
264
264
|
},
|
|
265
|
-
children:
|
|
265
|
+
children: a
|
|
266
266
|
},
|
|
267
267
|
`file-path-${r++}`
|
|
268
268
|
)
|
|
269
|
-
), t = t.slice(
|
|
269
|
+
), t = t.slice(B[0].length);
|
|
270
270
|
continue;
|
|
271
271
|
}
|
|
272
272
|
}
|
|
@@ -285,14 +285,14 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
285
285
|
), t = t.slice(c[0].length);
|
|
286
286
|
continue;
|
|
287
287
|
}
|
|
288
|
-
const
|
|
289
|
-
if (
|
|
288
|
+
const g = t.match(/^\*\*([^*]+)\*\*/);
|
|
289
|
+
if (g) {
|
|
290
290
|
n.push(
|
|
291
291
|
/* @__PURE__ */ e("strong", { style: {
|
|
292
292
|
fontWeight: 720,
|
|
293
293
|
color: "var(--text-strong, rgba(30,33,37,0.92))"
|
|
294
|
-
}, children:
|
|
295
|
-
), t = t.slice(
|
|
294
|
+
}, children: g[1] }, `bold-${r++}`)
|
|
295
|
+
), t = t.slice(g[0].length);
|
|
296
296
|
continue;
|
|
297
297
|
}
|
|
298
298
|
const p = t.match(/^\*([^*]+)\*/);
|
|
@@ -326,26 +326,26 @@ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
|
|
|
326
326
|
), t = t.slice(C[0].length);
|
|
327
327
|
continue;
|
|
328
328
|
}
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
329
|
+
const z = t.search(/[`*\[]/);
|
|
330
|
+
if (z === -1) {
|
|
331
331
|
n.push(t);
|
|
332
332
|
break;
|
|
333
333
|
} else
|
|
334
|
-
|
|
334
|
+
z === 0 ? (n.push(t[0]), t = t.slice(1)) : (n.push(t.slice(0, z)), t = t.slice(z));
|
|
335
335
|
}
|
|
336
336
|
return n.length === 1 && typeof n[0] == "string" ? n[0] : n;
|
|
337
|
-
},
|
|
338
|
-
return /* @__PURE__ */ e("div", { children:
|
|
337
|
+
}, d = (o) => f(o);
|
|
338
|
+
return /* @__PURE__ */ e("div", { children: k(h) });
|
|
339
339
|
};
|
|
340
340
|
function be({
|
|
341
341
|
role: h,
|
|
342
342
|
content: b,
|
|
343
343
|
html: m,
|
|
344
344
|
timestamp: y,
|
|
345
|
-
toolBadges:
|
|
345
|
+
toolBadges: i,
|
|
346
346
|
isStreaming: v,
|
|
347
347
|
onCodeBlockClick: L,
|
|
348
|
-
onFilePathClick:
|
|
348
|
+
onFilePathClick: k
|
|
349
349
|
}) {
|
|
350
350
|
const f = h === "user";
|
|
351
351
|
return /* @__PURE__ */ s(
|
|
@@ -375,13 +375,13 @@ function be({
|
|
|
375
375
|
]
|
|
376
376
|
}
|
|
377
377
|
),
|
|
378
|
-
|
|
378
|
+
i && i.length > 0 && /* @__PURE__ */ e("div", { style: {
|
|
379
379
|
marginBottom: "8px",
|
|
380
380
|
display: "flex",
|
|
381
381
|
flexWrap: "wrap",
|
|
382
382
|
gap: "4px",
|
|
383
383
|
maxWidth: "75%"
|
|
384
|
-
}, children:
|
|
384
|
+
}, children: i.map((d, o) => /* @__PURE__ */ s(
|
|
385
385
|
"span",
|
|
386
386
|
{
|
|
387
387
|
style: {
|
|
@@ -390,16 +390,16 @@ function be({
|
|
|
390
390
|
padding: "2px 8px",
|
|
391
391
|
borderRadius: "6px",
|
|
392
392
|
background: "var(--paper-elevated, rgba(255,255,255,0.82))",
|
|
393
|
-
border: `1px solid ${
|
|
394
|
-
color:
|
|
393
|
+
border: `1px solid ${d.pending ? "var(--rail-discovery, #5A8CC0)" : d.success !== !1 ? "var(--state-present, #5CB85C)" : "var(--rail-signal-churn, #C98A5A)"}`,
|
|
394
|
+
color: d.pending ? "var(--rail-discovery, #5A8CC0)" : d.success !== !1 ? "var(--state-present, #5CB85C)" : "var(--rail-signal-churn, #C98A5A)"
|
|
395
395
|
},
|
|
396
396
|
children: [
|
|
397
397
|
/* @__PURE__ */ e(ve, { size: 10, style: { marginRight: 3, verticalAlign: "middle" } }),
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
d.name,
|
|
399
|
+
d.pending ? "..." : d.success !== !1 ? " ✓" : " ✗"
|
|
400
400
|
]
|
|
401
401
|
},
|
|
402
|
-
|
|
402
|
+
d.id || o
|
|
403
403
|
)) }),
|
|
404
404
|
/* @__PURE__ */ e(
|
|
405
405
|
"div",
|
|
@@ -420,7 +420,7 @@ function be({
|
|
|
420
420
|
/* @__PURE__ */ e("div", { style: { whiteSpace: "pre-wrap" }, children: b })
|
|
421
421
|
) : (
|
|
422
422
|
// Assistant messages get markdown rendering
|
|
423
|
-
/* @__PURE__ */ e(We, { content: b || "", onCodeBlockClick: L, onFilePathClick:
|
|
423
|
+
/* @__PURE__ */ e(We, { content: b || "", onCodeBlockClick: L, onFilePathClick: k })
|
|
424
424
|
)
|
|
425
425
|
}
|
|
426
426
|
),
|
|
@@ -440,12 +440,12 @@ function be({
|
|
|
440
440
|
}
|
|
441
441
|
);
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function Fe({
|
|
444
444
|
phase: h = "thinking",
|
|
445
445
|
toolSteps: b = [],
|
|
446
446
|
label: m,
|
|
447
447
|
elapsedMs: y,
|
|
448
|
-
compact:
|
|
448
|
+
compact: i = !1
|
|
449
449
|
}) {
|
|
450
450
|
const v = (t) => {
|
|
451
451
|
if (!t || t < 1e3)
|
|
@@ -453,8 +453,8 @@ function _e({
|
|
|
453
453
|
const r = Math.floor(t / 1e3);
|
|
454
454
|
if (r < 60)
|
|
455
455
|
return `${r}s`;
|
|
456
|
-
const c = Math.floor(r / 60),
|
|
457
|
-
return
|
|
456
|
+
const c = Math.floor(r / 60), g = r % 60;
|
|
457
|
+
return g > 0 ? `${c}m ${g}s` : `${c}m`;
|
|
458
458
|
}, L = () => {
|
|
459
459
|
if (m)
|
|
460
460
|
return m;
|
|
@@ -468,14 +468,14 @@ function _e({
|
|
|
468
468
|
default:
|
|
469
469
|
return "Thinking...";
|
|
470
470
|
}
|
|
471
|
-
},
|
|
471
|
+
}, k = (t, r) => {
|
|
472
472
|
const c = () => {
|
|
473
473
|
const p = {
|
|
474
|
-
width:
|
|
475
|
-
height:
|
|
474
|
+
width: i ? "4px" : "6px",
|
|
475
|
+
height: i ? "4px" : "6px",
|
|
476
476
|
borderRadius: "50%",
|
|
477
477
|
display: "inline-block",
|
|
478
|
-
marginRight:
|
|
478
|
+
marginRight: i ? "6px" : "8px"
|
|
479
479
|
};
|
|
480
480
|
switch (t.status) {
|
|
481
481
|
case "active":
|
|
@@ -520,17 +520,17 @@ function _e({
|
|
|
520
520
|
}
|
|
521
521
|
);
|
|
522
522
|
}
|
|
523
|
-
},
|
|
523
|
+
}, g = () => {
|
|
524
524
|
switch (t.status) {
|
|
525
525
|
case "done":
|
|
526
526
|
return /* @__PURE__ */ e("span", { style: {
|
|
527
527
|
color: "var(--text-faint, rgba(30,33,37,0.36))",
|
|
528
|
-
fontSize:
|
|
528
|
+
fontSize: i ? "9px" : "var(--text-xs-plus, 10.5px)"
|
|
529
529
|
}, children: "✓" });
|
|
530
530
|
case "error":
|
|
531
531
|
return /* @__PURE__ */ e("span", { style: {
|
|
532
532
|
color: "var(--rail-compliance, #C98A5A)",
|
|
533
|
-
fontSize:
|
|
533
|
+
fontSize: i ? "9px" : "var(--text-xs-plus, 10.5px)"
|
|
534
534
|
}, children: "failed" });
|
|
535
535
|
default:
|
|
536
536
|
return null;
|
|
@@ -543,27 +543,27 @@ function _e({
|
|
|
543
543
|
display: "flex",
|
|
544
544
|
alignItems: "center",
|
|
545
545
|
justifyContent: "space-between",
|
|
546
|
-
marginBottom:
|
|
546
|
+
marginBottom: i ? "2px" : "4px"
|
|
547
547
|
},
|
|
548
548
|
children: [
|
|
549
549
|
/* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
550
550
|
c(),
|
|
551
551
|
/* @__PURE__ */ e("span", { style: {
|
|
552
552
|
fontFamily: "var(--font-mono)",
|
|
553
|
-
fontSize:
|
|
553
|
+
fontSize: i ? "9px" : "var(--text-xs-plus, 10.5px)",
|
|
554
554
|
color: "var(--text-muted)"
|
|
555
555
|
}, children: t.name })
|
|
556
556
|
] }),
|
|
557
|
-
|
|
557
|
+
g()
|
|
558
558
|
]
|
|
559
559
|
},
|
|
560
560
|
r
|
|
561
561
|
);
|
|
562
562
|
}, f = () => /* @__PURE__ */ e("div", { style: {
|
|
563
563
|
width: "100%",
|
|
564
|
-
height:
|
|
564
|
+
height: i ? "2px" : "3px",
|
|
565
565
|
backgroundColor: "var(--border-subtle, rgba(52,58,64,0.08))",
|
|
566
|
-
borderRadius:
|
|
566
|
+
borderRadius: i ? "2px" : "3px",
|
|
567
567
|
overflow: "hidden",
|
|
568
568
|
position: "relative"
|
|
569
569
|
}, children: /* @__PURE__ */ e("div", { style: {
|
|
@@ -574,9 +574,9 @@ function _e({
|
|
|
574
574
|
bottom: 0,
|
|
575
575
|
background: "linear-gradient(90deg, transparent 0%, rgba(155,122,168,0.3) 50%, transparent 100%)",
|
|
576
576
|
animation: "shimmer 2s linear infinite"
|
|
577
|
-
} }) }),
|
|
578
|
-
width:
|
|
579
|
-
height:
|
|
577
|
+
} }) }), d = () => /* @__PURE__ */ e("span", { style: {
|
|
578
|
+
width: i ? "4px" : "6px",
|
|
579
|
+
height: i ? "10px" : "14px",
|
|
580
580
|
backgroundColor: "var(--rail-purple, #9B7AA8)",
|
|
581
581
|
borderRadius: "1px",
|
|
582
582
|
display: "inline-block",
|
|
@@ -584,11 +584,11 @@ function _e({
|
|
|
584
584
|
animation: "cursorBlink 0.8s ease-in-out infinite"
|
|
585
585
|
} }), o = L(), n = v(y);
|
|
586
586
|
return /* @__PURE__ */ s("div", { style: {
|
|
587
|
-
borderLeft: `${
|
|
587
|
+
borderLeft: `${i ? "3px" : "4px"} solid var(--rail-purple, #9B7AA8)`,
|
|
588
588
|
backgroundColor: "var(--card-assistant, rgba(155,122,168,0.06))",
|
|
589
589
|
border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
|
|
590
|
-
borderRadius:
|
|
591
|
-
padding:
|
|
590
|
+
borderRadius: i ? "8px" : "10px",
|
|
591
|
+
padding: i ? "8px 10px 8px 12px" : "10px 14px 10px 18px"
|
|
592
592
|
}, children: [
|
|
593
593
|
/* @__PURE__ */ e("style", { children: `
|
|
594
594
|
@keyframes shimmer {
|
|
@@ -606,7 +606,7 @@ function _e({
|
|
|
606
606
|
50% { opacity: 1; }
|
|
607
607
|
}
|
|
608
608
|
` }),
|
|
609
|
-
!
|
|
609
|
+
!i && /* @__PURE__ */ e("div", { style: {
|
|
610
610
|
fontSize: "var(--text-xs-plus, 10.5px)",
|
|
611
611
|
fontWeight: 650,
|
|
612
612
|
textTransform: "uppercase",
|
|
@@ -618,15 +618,15 @@ function _e({
|
|
|
618
618
|
/* @__PURE__ */ s("div", { style: {
|
|
619
619
|
color: "var(--text-muted)",
|
|
620
620
|
fontWeight: 400,
|
|
621
|
-
fontSize:
|
|
622
|
-
marginBottom:
|
|
621
|
+
fontSize: i ? "11px" : "13px",
|
|
622
|
+
marginBottom: i ? "4px" : "8px",
|
|
623
623
|
display: "flex",
|
|
624
624
|
alignItems: "center",
|
|
625
625
|
gap: "6px"
|
|
626
626
|
}, children: [
|
|
627
627
|
o,
|
|
628
628
|
n && /* @__PURE__ */ e("span", { style: {
|
|
629
|
-
fontSize:
|
|
629
|
+
fontSize: i ? "9px" : "10px",
|
|
630
630
|
color: "var(--text-faint, rgba(30,33,37,0.36))",
|
|
631
631
|
fontFamily: "var(--font-mono, monospace)"
|
|
632
632
|
}, children: n })
|
|
@@ -637,43 +637,43 @@ function _e({
|
|
|
637
637
|
o && /* @__PURE__ */ s("div", { style: {
|
|
638
638
|
color: "var(--text-muted)",
|
|
639
639
|
fontWeight: 400,
|
|
640
|
-
fontSize:
|
|
641
|
-
marginBottom:
|
|
640
|
+
fontSize: i ? "11px" : "13px",
|
|
641
|
+
marginBottom: i ? "4px" : "8px",
|
|
642
642
|
display: "flex",
|
|
643
643
|
alignItems: "center",
|
|
644
644
|
gap: "6px"
|
|
645
645
|
}, children: [
|
|
646
646
|
o,
|
|
647
647
|
n && /* @__PURE__ */ e("span", { style: {
|
|
648
|
-
fontSize:
|
|
648
|
+
fontSize: i ? "9px" : "10px",
|
|
649
649
|
color: "var(--text-faint, rgba(30,33,37,0.36))",
|
|
650
650
|
fontFamily: "var(--font-mono, monospace)"
|
|
651
651
|
}, children: n })
|
|
652
652
|
] }),
|
|
653
|
-
/* @__PURE__ */ e("div", { style: { marginBottom:
|
|
653
|
+
/* @__PURE__ */ e("div", { style: { marginBottom: i ? "4px" : "8px" }, children: b.map((t, r) => k(t, r)) }),
|
|
654
654
|
f()
|
|
655
655
|
] }),
|
|
656
656
|
h === "responding" && /* @__PURE__ */ s("div", { style: {
|
|
657
657
|
color: "var(--text-muted)",
|
|
658
658
|
fontWeight: 400,
|
|
659
|
-
fontSize:
|
|
659
|
+
fontSize: i ? "11px" : "13px",
|
|
660
660
|
display: "flex",
|
|
661
661
|
alignItems: "center",
|
|
662
662
|
gap: "6px"
|
|
663
663
|
}, children: [
|
|
664
664
|
/* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
665
665
|
o,
|
|
666
|
-
|
|
666
|
+
d()
|
|
667
667
|
] }),
|
|
668
668
|
n && /* @__PURE__ */ e("span", { style: {
|
|
669
|
-
fontSize:
|
|
669
|
+
fontSize: i ? "9px" : "10px",
|
|
670
670
|
color: "var(--text-faint, rgba(30,33,37,0.36))",
|
|
671
671
|
fontFamily: "var(--font-mono, monospace)"
|
|
672
672
|
}, children: n })
|
|
673
673
|
] })
|
|
674
674
|
] });
|
|
675
675
|
}
|
|
676
|
-
const
|
|
676
|
+
const _e = { error: (...h) => console.warn("toast.error:", ...h) };
|
|
677
677
|
function qe({
|
|
678
678
|
initialMessages: h = [],
|
|
679
679
|
onSendMessage: b,
|
|
@@ -681,39 +681,39 @@ function qe({
|
|
|
681
681
|
// NEW: streaming version of onSendMessage
|
|
682
682
|
onMessagesChange: y,
|
|
683
683
|
// NEW: callback when messages array changes
|
|
684
|
-
onCodeBlockClick:
|
|
684
|
+
onCodeBlockClick: i,
|
|
685
685
|
// callback when "Canvas" button clicked on a code block: ({ code, language }) => void
|
|
686
686
|
placeholder: v = "Ask a question about this interaction...",
|
|
687
687
|
title: L = "Chat with Chordia"
|
|
688
688
|
}) {
|
|
689
|
-
const [
|
|
689
|
+
const [k, f] = M(h || []), [d, o] = M(""), [n, t] = M(!1), [r, c] = M(!1), [g, p] = M(null), [C, z] = M("thinking"), [B, a] = M(null), [w, D] = M(0), T = Y(null), l = Y(null), x = Y(null), I = Y(null), S = Y(null), [E, _] = M(!1), [H, X] = M(0);
|
|
690
690
|
G(() => {
|
|
691
|
-
var
|
|
692
|
-
(
|
|
693
|
-
}, [
|
|
694
|
-
|
|
695
|
-
|
|
691
|
+
var u;
|
|
692
|
+
(u = T.current) == null || u.scrollIntoView({ behavior: "smooth" });
|
|
693
|
+
}, [k, n]), G(() => {
|
|
694
|
+
l.current && (l.current.style.height = "auto", l.current.style.height = `${Math.min(
|
|
695
|
+
l.current.scrollHeight,
|
|
696
696
|
120
|
|
697
697
|
)}px`);
|
|
698
|
-
}, [
|
|
698
|
+
}, [d]), G(() => {
|
|
699
699
|
if (y) {
|
|
700
|
-
const
|
|
701
|
-
|
|
700
|
+
const u = [...k];
|
|
701
|
+
g && u.push(g), y(u);
|
|
702
702
|
}
|
|
703
|
-
}, [
|
|
704
|
-
let
|
|
705
|
-
return n &&
|
|
706
|
-
if (D(Date.now() -
|
|
703
|
+
}, [k, g, y]), G(() => {
|
|
704
|
+
let u;
|
|
705
|
+
return n && B && (u = setInterval(() => {
|
|
706
|
+
if (D(Date.now() - B), S.current) {
|
|
707
707
|
const W = (Date.now() - S.current) / 1e3;
|
|
708
|
-
W >= 3 ? (
|
|
708
|
+
W >= 3 ? (_(!0), X(Math.floor(W))) : _(!1);
|
|
709
709
|
}
|
|
710
|
-
}, 500)), () =>
|
|
711
|
-
}, [n,
|
|
710
|
+
}, 500)), () => u && clearInterval(u);
|
|
711
|
+
}, [n, B]);
|
|
712
712
|
const P = () => {
|
|
713
|
-
t(!1), c(!1), p(null), I.current = null,
|
|
714
|
-
}, N = (
|
|
715
|
-
if (
|
|
716
|
-
const W =
|
|
713
|
+
t(!1), c(!1), p(null), I.current = null, z("thinking"), _(!1), X(0), S.current = null, a(null), D(0), x.current && (x.current.abort(), x.current = null);
|
|
714
|
+
}, N = (u) => {
|
|
715
|
+
if (u.startsWith("data: ")) {
|
|
716
|
+
const W = u.slice(6);
|
|
717
717
|
if (W === "[DONE]")
|
|
718
718
|
return { type: "done" };
|
|
719
719
|
try {
|
|
@@ -723,18 +723,18 @@ function qe({
|
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
725
|
return null;
|
|
726
|
-
}, q = (
|
|
727
|
-
var j,
|
|
728
|
-
if (!((
|
|
726
|
+
}, q = (u) => {
|
|
727
|
+
var j, R;
|
|
728
|
+
if (!((R = (j = u.choices) == null ? void 0 : j[0]) != null && R.delta))
|
|
729
729
|
return;
|
|
730
|
-
S.current = Date.now(),
|
|
731
|
-
const W =
|
|
730
|
+
S.current = Date.now(), _(!1);
|
|
731
|
+
const W = u.choices[0].delta;
|
|
732
732
|
if (W.tool_calls || W.tool_results) {
|
|
733
|
-
|
|
733
|
+
z("tool");
|
|
734
734
|
return;
|
|
735
735
|
}
|
|
736
|
-
W.content !== void 0 && (
|
|
737
|
-
const V =
|
|
736
|
+
W.content !== void 0 && (z("responding"), p((F) => {
|
|
737
|
+
const V = F || {
|
|
738
738
|
id: Date.now().toString(),
|
|
739
739
|
role: "assistant",
|
|
740
740
|
content: "",
|
|
@@ -749,18 +749,18 @@ function qe({
|
|
|
749
749
|
};
|
|
750
750
|
return I.current = Q, Q;
|
|
751
751
|
}));
|
|
752
|
-
}, U = async (
|
|
753
|
-
const W =
|
|
754
|
-
let
|
|
752
|
+
}, U = async (u) => {
|
|
753
|
+
const W = u.getReader(), j = new TextDecoder();
|
|
754
|
+
let R = "";
|
|
755
755
|
try {
|
|
756
756
|
for (; ; ) {
|
|
757
|
-
const { done:
|
|
758
|
-
if (
|
|
757
|
+
const { done: F, value: V } = await W.read();
|
|
758
|
+
if (F)
|
|
759
759
|
break;
|
|
760
|
-
|
|
761
|
-
const Q =
|
|
760
|
+
R += j.decode(V, { stream: !0 });
|
|
761
|
+
const Q = R.split(`
|
|
762
762
|
`);
|
|
763
|
-
|
|
763
|
+
R = Q.pop() || "";
|
|
764
764
|
for (const ue of Q)
|
|
765
765
|
if (ue.trim()) {
|
|
766
766
|
const re = N(ue);
|
|
@@ -775,27 +775,27 @@ function qe({
|
|
|
775
775
|
W.releaseLock();
|
|
776
776
|
}
|
|
777
777
|
}, K = async () => {
|
|
778
|
-
if (!
|
|
778
|
+
if (!d.trim() || r)
|
|
779
779
|
return;
|
|
780
|
-
const
|
|
780
|
+
const u = d.trim(), W = {
|
|
781
781
|
id: Date.now().toString(),
|
|
782
782
|
role: "user",
|
|
783
|
-
content:
|
|
783
|
+
content: u,
|
|
784
784
|
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
|
|
785
785
|
hour: "2-digit",
|
|
786
786
|
minute: "2-digit"
|
|
787
787
|
})
|
|
788
|
-
}, j = [...
|
|
789
|
-
f(j), o(""), t(!0), c(!0),
|
|
788
|
+
}, j = [...k, W];
|
|
789
|
+
f(j), o(""), t(!0), c(!0), z("thinking"), a(Date.now()), S.current = Date.now(), x.current = new AbortController();
|
|
790
790
|
try {
|
|
791
|
-
let
|
|
791
|
+
let R;
|
|
792
792
|
if (m)
|
|
793
|
-
|
|
793
|
+
R = await m(u, j);
|
|
794
794
|
else if (b)
|
|
795
|
-
|
|
795
|
+
R = await b(u, j);
|
|
796
796
|
else {
|
|
797
797
|
setTimeout(() => {
|
|
798
|
-
const
|
|
798
|
+
const F = {
|
|
799
799
|
id: (Date.now() + 1).toString(),
|
|
800
800
|
role: "assistant",
|
|
801
801
|
content: "This is a demonstration response. In a real implementation, this would connect to your LLM backend.",
|
|
@@ -804,29 +804,29 @@ function qe({
|
|
|
804
804
|
minute: "2-digit"
|
|
805
805
|
})
|
|
806
806
|
};
|
|
807
|
-
f((V) => [...V,
|
|
807
|
+
f((V) => [...V, F]), P();
|
|
808
808
|
}, 1e3);
|
|
809
809
|
return;
|
|
810
810
|
}
|
|
811
|
-
if (
|
|
812
|
-
await U(
|
|
813
|
-
else if (
|
|
814
|
-
await U(
|
|
815
|
-
else if (
|
|
816
|
-
const
|
|
817
|
-
|
|
811
|
+
if (R instanceof ReadableStream)
|
|
812
|
+
await U(R);
|
|
813
|
+
else if (R instanceof Response && R.body)
|
|
814
|
+
await U(R.body);
|
|
815
|
+
else if (R && typeof R.then == "function") {
|
|
816
|
+
const F = await R;
|
|
817
|
+
F instanceof ReadableStream ? await U(F) : F instanceof Response && F.body && await U(F.body);
|
|
818
818
|
}
|
|
819
|
-
I.current && f((
|
|
819
|
+
I.current && f((F) => [...F, {
|
|
820
820
|
...I.current,
|
|
821
821
|
isStreaming: !1
|
|
822
822
|
}]);
|
|
823
|
-
} catch (
|
|
824
|
-
|
|
823
|
+
} catch (R) {
|
|
824
|
+
R.name !== "AbortError" && (_e.error("Failed to send message"), console.error("Stream error:", R));
|
|
825
825
|
} finally {
|
|
826
826
|
P();
|
|
827
827
|
}
|
|
828
|
-
}, $ = (
|
|
829
|
-
|
|
828
|
+
}, $ = (u) => {
|
|
829
|
+
u.key === "Enter" && !u.shiftKey && (u.preventDefault(), K());
|
|
830
830
|
};
|
|
831
831
|
return /* @__PURE__ */ s(
|
|
832
832
|
"div",
|
|
@@ -887,7 +887,7 @@ function qe({
|
|
|
887
887
|
display: "flex",
|
|
888
888
|
flexDirection: "column"
|
|
889
889
|
},
|
|
890
|
-
children:
|
|
890
|
+
children: k.length === 0 ? /* @__PURE__ */ e(
|
|
891
891
|
"div",
|
|
892
892
|
{
|
|
893
893
|
style: {
|
|
@@ -903,39 +903,39 @@ function qe({
|
|
|
903
903
|
children: "No messages yet. Start a conversation by asking a question below."
|
|
904
904
|
}
|
|
905
905
|
) : /* @__PURE__ */ s(J, { children: [
|
|
906
|
-
|
|
906
|
+
k.map((u) => /* @__PURE__ */ e(
|
|
907
907
|
be,
|
|
908
908
|
{
|
|
909
|
-
role:
|
|
910
|
-
content:
|
|
911
|
-
html:
|
|
912
|
-
timestamp:
|
|
913
|
-
toolBadges:
|
|
914
|
-
isStreaming:
|
|
915
|
-
onCodeBlockClick:
|
|
909
|
+
role: u.role,
|
|
910
|
+
content: u.content,
|
|
911
|
+
html: u.html,
|
|
912
|
+
timestamp: u.timestamp,
|
|
913
|
+
toolBadges: u.toolBadges,
|
|
914
|
+
isStreaming: u.isStreaming,
|
|
915
|
+
onCodeBlockClick: i
|
|
916
916
|
},
|
|
917
|
-
|
|
917
|
+
u.id
|
|
918
918
|
)),
|
|
919
|
-
|
|
919
|
+
g && /* @__PURE__ */ e(
|
|
920
920
|
be,
|
|
921
921
|
{
|
|
922
|
-
role:
|
|
923
|
-
content:
|
|
924
|
-
timestamp:
|
|
922
|
+
role: g.role,
|
|
923
|
+
content: g.content,
|
|
924
|
+
timestamp: g.timestamp,
|
|
925
925
|
isStreaming: !0,
|
|
926
|
-
onCodeBlockClick:
|
|
926
|
+
onCodeBlockClick: i
|
|
927
927
|
},
|
|
928
|
-
|
|
928
|
+
g.id
|
|
929
929
|
),
|
|
930
|
-
n && (!
|
|
931
|
-
|
|
930
|
+
n && (!g || E) && /* @__PURE__ */ e("div", { style: { marginBottom: "16px" }, children: /* @__PURE__ */ e(
|
|
931
|
+
Fe,
|
|
932
932
|
{
|
|
933
933
|
phase: E ? "tool" : C,
|
|
934
|
-
elapsedMs:
|
|
934
|
+
elapsedMs: w,
|
|
935
935
|
label: E && H >= 30 ? "Compacting conversation — trimming context to stay sharp..." : E && H >= 10 ? "Running background tasks..." : E ? "Still working..." : void 0
|
|
936
936
|
}
|
|
937
937
|
) }),
|
|
938
|
-
/* @__PURE__ */ e("div", { ref:
|
|
938
|
+
/* @__PURE__ */ e("div", { ref: T })
|
|
939
939
|
] })
|
|
940
940
|
}
|
|
941
941
|
),
|
|
@@ -960,9 +960,9 @@ function qe({
|
|
|
960
960
|
/* @__PURE__ */ e(
|
|
961
961
|
"textarea",
|
|
962
962
|
{
|
|
963
|
-
ref:
|
|
964
|
-
value:
|
|
965
|
-
onChange: (
|
|
963
|
+
ref: l,
|
|
964
|
+
value: d,
|
|
965
|
+
onChange: (u) => o(u.target.value),
|
|
966
966
|
onKeyDown: $,
|
|
967
967
|
placeholder: v,
|
|
968
968
|
rows: 1,
|
|
@@ -985,11 +985,11 @@ function qe({
|
|
|
985
985
|
opacity: r ? 0.6 : 1,
|
|
986
986
|
cursor: r ? "not-allowed" : "text"
|
|
987
987
|
},
|
|
988
|
-
onFocus: (
|
|
989
|
-
r || (
|
|
988
|
+
onFocus: (u) => {
|
|
989
|
+
r || (u.target.style.borderColor = "rgba(94, 136, 176, 0.35)");
|
|
990
990
|
},
|
|
991
|
-
onBlur: (
|
|
992
|
-
|
|
991
|
+
onBlur: (u) => {
|
|
992
|
+
u.target.style.borderColor = "rgba(52, 58, 64, 0.18)";
|
|
993
993
|
}
|
|
994
994
|
}
|
|
995
995
|
),
|
|
@@ -997,14 +997,14 @@ function qe({
|
|
|
997
997
|
"button",
|
|
998
998
|
{
|
|
999
999
|
onClick: K,
|
|
1000
|
-
disabled: !
|
|
1000
|
+
disabled: !d.trim() || r,
|
|
1001
1001
|
style: {
|
|
1002
1002
|
padding: "10px 16px",
|
|
1003
|
-
background:
|
|
1004
|
-
color:
|
|
1003
|
+
background: d.trim() && !r ? "var(--Base-Strong, #0B0B0B)" : "#ECEEF2",
|
|
1004
|
+
color: d.trim() && !r ? "white" : "var(--text-base)",
|
|
1005
1005
|
border: "none",
|
|
1006
1006
|
borderRadius: "var(--radius-md, 8px)",
|
|
1007
|
-
cursor:
|
|
1007
|
+
cursor: d.trim() && !r ? "pointer" : "not-allowed",
|
|
1008
1008
|
display: "flex",
|
|
1009
1009
|
alignItems: "center",
|
|
1010
1010
|
gap: "6px",
|
|
@@ -1013,12 +1013,6 @@ function qe({
|
|
|
1013
1013
|
transition: "all 0.15s ease",
|
|
1014
1014
|
height: "42px"
|
|
1015
1015
|
},
|
|
1016
|
-
onMouseEnter: (g) => {
|
|
1017
|
-
l.trim() && !r && (g.currentTarget.style.background = "rgba(94, 136, 176, 1)");
|
|
1018
|
-
},
|
|
1019
|
-
onMouseLeave: (g) => {
|
|
1020
|
-
l.trim() && !r && (g.currentTarget.style.background = "var(--rail-discovery, #5E88B0)");
|
|
1021
|
-
},
|
|
1022
1016
|
children: r ? /* @__PURE__ */ s(J, { children: [
|
|
1023
1017
|
/* @__PURE__ */ e("style", { children: `
|
|
1024
1018
|
@keyframes buttonSpin {
|
|
@@ -1072,7 +1066,7 @@ function Ve({
|
|
|
1072
1066
|
activeThreadId: b,
|
|
1073
1067
|
onSelectThread: m,
|
|
1074
1068
|
onNewChat: y,
|
|
1075
|
-
loading:
|
|
1069
|
+
loading: i = !1
|
|
1076
1070
|
}) {
|
|
1077
1071
|
const [v, L] = M(""), f = [...h.filter((o) => {
|
|
1078
1072
|
if (!v)
|
|
@@ -1086,7 +1080,7 @@ function Ve({
|
|
|
1086
1080
|
return 1;
|
|
1087
1081
|
const t = new Date(o.updated_at || o.created_at || 0).getTime();
|
|
1088
1082
|
return new Date(n.updated_at || n.created_at || 0).getTime() - t;
|
|
1089
|
-
}),
|
|
1083
|
+
}), d = (o) => {
|
|
1090
1084
|
if (!o)
|
|
1091
1085
|
return "";
|
|
1092
1086
|
const n = new Date(o), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), c = Math.floor(r / 864e5);
|
|
@@ -1142,15 +1136,15 @@ function Ve({
|
|
|
1142
1136
|
padding: "4px 10px",
|
|
1143
1137
|
fontSize: "11px",
|
|
1144
1138
|
fontWeight: 600,
|
|
1145
|
-
color: "var(--
|
|
1146
|
-
background: "
|
|
1139
|
+
color: "var(--Base-Strong, #0B0B0B)",
|
|
1140
|
+
background: "#ECEEF2",
|
|
1147
1141
|
border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
|
|
1148
1142
|
borderRadius: "6px",
|
|
1149
1143
|
cursor: "pointer",
|
|
1150
1144
|
transition: "all 0.15s ease"
|
|
1151
1145
|
},
|
|
1152
1146
|
onMouseEnter: (o) => {
|
|
1153
|
-
o.currentTarget.style.background = "
|
|
1147
|
+
o.currentTarget.style.background = "#ECEEF2";
|
|
1154
1148
|
},
|
|
1155
1149
|
onMouseLeave: (o) => {
|
|
1156
1150
|
o.currentTarget.style.background = "rgba(94, 136, 176, 0.08)";
|
|
@@ -1207,7 +1201,7 @@ function Ve({
|
|
|
1207
1201
|
]
|
|
1208
1202
|
}
|
|
1209
1203
|
),
|
|
1210
|
-
/* @__PURE__ */ e("div", { style: { flex: 1, overflowY: "auto", padding: "4px 6px" }, children:
|
|
1204
|
+
/* @__PURE__ */ e("div", { style: { flex: 1, overflowY: "auto", padding: "4px 6px" }, children: i ? /* @__PURE__ */ e(
|
|
1211
1205
|
"div",
|
|
1212
1206
|
{
|
|
1213
1207
|
style: {
|
|
@@ -1253,7 +1247,7 @@ function Ve({
|
|
|
1253
1247
|
children: [
|
|
1254
1248
|
/* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginBottom: "4px" }, children: [
|
|
1255
1249
|
/* @__PURE__ */ e(
|
|
1256
|
-
|
|
1250
|
+
ze,
|
|
1257
1251
|
{
|
|
1258
1252
|
size: 12,
|
|
1259
1253
|
style: {
|
|
@@ -1277,7 +1271,7 @@ function Ve({
|
|
|
1277
1271
|
children: o.title || "Untitled thread"
|
|
1278
1272
|
}
|
|
1279
1273
|
),
|
|
1280
|
-
o.pinned && /* @__PURE__ */ e(
|
|
1274
|
+
o.pinned && /* @__PURE__ */ e(Te, { size: 10, style: { color: "var(--rail-discovery, #5E88B0)", flexShrink: 0 } })
|
|
1281
1275
|
] }),
|
|
1282
1276
|
o.last_message_preview && /* @__PURE__ */ e(
|
|
1283
1277
|
"div",
|
|
@@ -1307,7 +1301,7 @@ function Ve({
|
|
|
1307
1301
|
},
|
|
1308
1302
|
children: [
|
|
1309
1303
|
/* @__PURE__ */ e(ge, { size: 9 }),
|
|
1310
|
-
/* @__PURE__ */ e("span", { children:
|
|
1304
|
+
/* @__PURE__ */ e("span", { children: d(o.updated_at || o.created_at) }),
|
|
1311
1305
|
o.message_count != null && /* @__PURE__ */ s(J, { children: [
|
|
1312
1306
|
/* @__PURE__ */ e("span", { children: "·" }),
|
|
1313
1307
|
/* @__PURE__ */ s("span", { children: [
|
|
@@ -1335,23 +1329,23 @@ function Ge({
|
|
|
1335
1329
|
onSendMessage: m,
|
|
1336
1330
|
currentUser: y
|
|
1337
1331
|
}) {
|
|
1338
|
-
var
|
|
1339
|
-
const [
|
|
1332
|
+
var B;
|
|
1333
|
+
const [i, v] = M(""), [L, k] = M(!1), [f, d] = M(b || []), [o, n] = M(!1), [t, r] = M(!1), { userData: c } = je(), g = Y(null), p = y || {
|
|
1340
1334
|
name: (c == null ? void 0 : c.name) || "You",
|
|
1341
|
-
initials: ((
|
|
1335
|
+
initials: ((B = c == null ? void 0 : c.name) == null ? void 0 : B.split(" ").map((a) => a[0]).join("").toUpperCase()) || "YO",
|
|
1342
1336
|
color: "#6B7C93"
|
|
1343
1337
|
};
|
|
1344
1338
|
G(() => {
|
|
1345
|
-
|
|
1339
|
+
d(b || []);
|
|
1346
1340
|
}, [b]), G(() => {
|
|
1347
|
-
|
|
1341
|
+
g.current && g.current.scrollIntoView({ behavior: "smooth" });
|
|
1348
1342
|
}, [f]);
|
|
1349
1343
|
const C = async () => {
|
|
1350
|
-
if (!
|
|
1344
|
+
if (!i.trim())
|
|
1351
1345
|
return;
|
|
1352
|
-
const
|
|
1346
|
+
const a = i.trim();
|
|
1353
1347
|
v(""), r(!0);
|
|
1354
|
-
const
|
|
1348
|
+
const w = {
|
|
1355
1349
|
id: `temp-${Date.now()}`,
|
|
1356
1350
|
author: {
|
|
1357
1351
|
name: p.name,
|
|
@@ -1359,34 +1353,34 @@ function Ge({
|
|
|
1359
1353
|
initials: p.initials,
|
|
1360
1354
|
color: p.color
|
|
1361
1355
|
},
|
|
1362
|
-
content:
|
|
1356
|
+
content: a,
|
|
1363
1357
|
timestamp: "Just now",
|
|
1364
1358
|
type: "comment",
|
|
1365
1359
|
isOptimistic: !0
|
|
1366
1360
|
};
|
|
1367
|
-
if (
|
|
1361
|
+
if (d((D) => [...D, w]), m) {
|
|
1368
1362
|
try {
|
|
1369
|
-
await m(
|
|
1363
|
+
await m(a), d(
|
|
1370
1364
|
(D) => D.map(
|
|
1371
|
-
(
|
|
1365
|
+
(T) => T.id === w.id ? { ...T, isOptimistic: !1 } : T
|
|
1372
1366
|
)
|
|
1373
1367
|
);
|
|
1374
1368
|
} catch {
|
|
1375
|
-
|
|
1369
|
+
d((T) => T.filter((l) => l.id !== w.id)), $e.error("Failed to send message");
|
|
1376
1370
|
} finally {
|
|
1377
1371
|
r(!1);
|
|
1378
1372
|
}
|
|
1379
1373
|
return;
|
|
1380
1374
|
}
|
|
1381
1375
|
setTimeout(() => {
|
|
1382
|
-
|
|
1376
|
+
d(
|
|
1383
1377
|
(D) => D.map(
|
|
1384
|
-
(
|
|
1378
|
+
(T) => T.id === w.id ? { ...T, isOptimistic: !1 } : T
|
|
1385
1379
|
)
|
|
1386
1380
|
), r(!1);
|
|
1387
1381
|
}, 500);
|
|
1388
|
-
},
|
|
1389
|
-
|
|
1382
|
+
}, z = (a) => {
|
|
1383
|
+
a.key === "Enter" && !a.shiftKey && (a.preventDefault(), C());
|
|
1390
1384
|
};
|
|
1391
1385
|
return /* @__PURE__ */ s(
|
|
1392
1386
|
"div",
|
|
@@ -1474,23 +1468,23 @@ function Ge({
|
|
|
1474
1468
|
},
|
|
1475
1469
|
children: "No messages yet. Start the conversation!"
|
|
1476
1470
|
}
|
|
1477
|
-
) : f.map((
|
|
1471
|
+
) : f.map((a) => /* @__PURE__ */ s(
|
|
1478
1472
|
"div",
|
|
1479
1473
|
{
|
|
1480
1474
|
style: {
|
|
1481
1475
|
display: "flex",
|
|
1482
1476
|
gap: "12px",
|
|
1483
|
-
opacity:
|
|
1477
|
+
opacity: a.type === "system" ? 0.75 : 1
|
|
1484
1478
|
},
|
|
1485
1479
|
children: [
|
|
1486
|
-
|
|
1480
|
+
a.type !== "system" && /* @__PURE__ */ e(
|
|
1487
1481
|
"div",
|
|
1488
1482
|
{
|
|
1489
1483
|
style: {
|
|
1490
1484
|
width: "32px",
|
|
1491
1485
|
height: "32px",
|
|
1492
1486
|
borderRadius: "8px",
|
|
1493
|
-
background:
|
|
1487
|
+
background: a.author.color,
|
|
1494
1488
|
color: "white",
|
|
1495
1489
|
display: "flex",
|
|
1496
1490
|
alignItems: "center",
|
|
@@ -1500,10 +1494,10 @@ function Ge({
|
|
|
1500
1494
|
flexShrink: 0,
|
|
1501
1495
|
opacity: 0.9
|
|
1502
1496
|
},
|
|
1503
|
-
children:
|
|
1497
|
+
children: a.author.initials
|
|
1504
1498
|
}
|
|
1505
1499
|
),
|
|
1506
|
-
|
|
1500
|
+
a.type === "system" && /* @__PURE__ */ e(
|
|
1507
1501
|
"div",
|
|
1508
1502
|
{
|
|
1509
1503
|
style: {
|
|
@@ -1541,7 +1535,7 @@ function Ge({
|
|
|
1541
1535
|
fontWeight: 650,
|
|
1542
1536
|
color: "var(--text-base, rgba(30,33,37,0.78))"
|
|
1543
1537
|
},
|
|
1544
|
-
children:
|
|
1538
|
+
children: a.author.name
|
|
1545
1539
|
}
|
|
1546
1540
|
),
|
|
1547
1541
|
/* @__PURE__ */ e(
|
|
@@ -1552,10 +1546,10 @@ function Ge({
|
|
|
1552
1546
|
color: "var(--text-faint, rgba(30,33,37,0.36))",
|
|
1553
1547
|
fontFamily: "var(--font-mono, monospace)"
|
|
1554
1548
|
},
|
|
1555
|
-
children:
|
|
1549
|
+
children: a.timestamp
|
|
1556
1550
|
}
|
|
1557
1551
|
),
|
|
1558
|
-
|
|
1552
|
+
a.author.role && /* @__PURE__ */ e(
|
|
1559
1553
|
"span",
|
|
1560
1554
|
{
|
|
1561
1555
|
style: {
|
|
@@ -1568,10 +1562,10 @@ function Ge({
|
|
|
1568
1562
|
letterSpacing: "0.04em",
|
|
1569
1563
|
fontWeight: 600
|
|
1570
1564
|
},
|
|
1571
|
-
children:
|
|
1565
|
+
children: a.author.role
|
|
1572
1566
|
}
|
|
1573
1567
|
),
|
|
1574
|
-
|
|
1568
|
+
a.isEdited && /* @__PURE__ */ e(
|
|
1575
1569
|
"span",
|
|
1576
1570
|
{
|
|
1577
1571
|
style: {
|
|
@@ -1592,12 +1586,12 @@ function Ge({
|
|
|
1592
1586
|
fontSize: "var(--text-md, 13px)",
|
|
1593
1587
|
color: "var(--text-base, rgba(30,33,37,0.78))",
|
|
1594
1588
|
lineHeight: 1.5,
|
|
1595
|
-
marginBottom:
|
|
1589
|
+
marginBottom: a.references ? "8px" : 0
|
|
1596
1590
|
},
|
|
1597
|
-
children:
|
|
1591
|
+
children: a.content
|
|
1598
1592
|
}
|
|
1599
1593
|
),
|
|
1600
|
-
|
|
1594
|
+
a.references && a.references.length > 0 && /* @__PURE__ */ e(
|
|
1601
1595
|
"div",
|
|
1602
1596
|
{
|
|
1603
1597
|
style: {
|
|
@@ -1606,7 +1600,7 @@ function Ge({
|
|
|
1606
1600
|
gap: "6px",
|
|
1607
1601
|
marginTop: "8px"
|
|
1608
1602
|
},
|
|
1609
|
-
children:
|
|
1603
|
+
children: a.references.map((w, D) => /* @__PURE__ */ s(
|
|
1610
1604
|
"button",
|
|
1611
1605
|
{
|
|
1612
1606
|
type: "button",
|
|
@@ -1616,7 +1610,7 @@ function Ge({
|
|
|
1616
1610
|
borderRadius: "6px",
|
|
1617
1611
|
border: "1px solid rgba(52, 58, 64, 0.16)",
|
|
1618
1612
|
background: "rgba(255, 255, 255, 0.7)",
|
|
1619
|
-
color:
|
|
1613
|
+
color: w.type === "condition" ? "rgba(94, 136, 176, 0.85)" : w.type === "observation" ? "rgba(107, 123, 147, 0.85)" : w.type === "timestamp" ? "rgba(184, 156, 106, 0.85)" : "rgba(30, 33, 37, 0.65)",
|
|
1620
1614
|
cursor: "pointer",
|
|
1621
1615
|
display: "inline-flex",
|
|
1622
1616
|
alignItems: "center",
|
|
@@ -1624,16 +1618,16 @@ function Ge({
|
|
|
1624
1618
|
transition: "all 0.15s ease",
|
|
1625
1619
|
fontWeight: 550
|
|
1626
1620
|
},
|
|
1627
|
-
onMouseEnter: (
|
|
1628
|
-
|
|
1621
|
+
onMouseEnter: (T) => {
|
|
1622
|
+
T.currentTarget.style.background = "rgba(255, 255, 255, 0.95)", T.currentTarget.style.borderColor = "rgba(52, 58, 64, 0.24)";
|
|
1629
1623
|
},
|
|
1630
|
-
onMouseLeave: (
|
|
1631
|
-
|
|
1624
|
+
onMouseLeave: (T) => {
|
|
1625
|
+
T.currentTarget.style.background = "rgba(255, 255, 255, 0.7)", T.currentTarget.style.borderColor = "rgba(52, 58, 64, 0.16)";
|
|
1632
1626
|
},
|
|
1633
1627
|
children: [
|
|
1634
|
-
|
|
1635
|
-
(
|
|
1636
|
-
|
|
1628
|
+
w.type === "timestamp" && /* @__PURE__ */ e(ge, { size: 12 }),
|
|
1629
|
+
(w.type === "condition" || w.type === "observation") && /* @__PURE__ */ e(he, { size: 12 }),
|
|
1630
|
+
w.label
|
|
1637
1631
|
]
|
|
1638
1632
|
},
|
|
1639
1633
|
D
|
|
@@ -1643,9 +1637,9 @@ function Ge({
|
|
|
1643
1637
|
] })
|
|
1644
1638
|
]
|
|
1645
1639
|
},
|
|
1646
|
-
|
|
1640
|
+
a.id
|
|
1647
1641
|
)),
|
|
1648
|
-
/* @__PURE__ */ e("div", { ref:
|
|
1642
|
+
/* @__PURE__ */ e("div", { ref: g })
|
|
1649
1643
|
]
|
|
1650
1644
|
}
|
|
1651
1645
|
),
|
|
@@ -1700,11 +1694,11 @@ function Ge({
|
|
|
1700
1694
|
/* @__PURE__ */ e(
|
|
1701
1695
|
"textarea",
|
|
1702
1696
|
{
|
|
1703
|
-
value:
|
|
1704
|
-
onChange: (
|
|
1705
|
-
onKeyDown:
|
|
1706
|
-
onFocus: () =>
|
|
1707
|
-
onBlur: () =>
|
|
1697
|
+
value: i,
|
|
1698
|
+
onChange: (a) => v(a.target.value),
|
|
1699
|
+
onKeyDown: z,
|
|
1700
|
+
onFocus: () => k(!0),
|
|
1701
|
+
onBlur: () => k(!1),
|
|
1708
1702
|
placeholder: "Add a comment...",
|
|
1709
1703
|
style: {
|
|
1710
1704
|
width: "100%",
|
|
@@ -1749,14 +1743,14 @@ function Ge({
|
|
|
1749
1743
|
alignItems: "center",
|
|
1750
1744
|
transition: "all 0.15s ease"
|
|
1751
1745
|
},
|
|
1752
|
-
onMouseEnter: (
|
|
1753
|
-
|
|
1746
|
+
onMouseEnter: (a) => {
|
|
1747
|
+
a.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", a.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
|
|
1754
1748
|
},
|
|
1755
|
-
onMouseLeave: (
|
|
1756
|
-
|
|
1749
|
+
onMouseLeave: (a) => {
|
|
1750
|
+
a.currentTarget.style.background = "transparent", a.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
|
|
1757
1751
|
},
|
|
1758
1752
|
title: "Mention user",
|
|
1759
|
-
children: /* @__PURE__ */ e(
|
|
1753
|
+
children: /* @__PURE__ */ e(Be, { size: 16 })
|
|
1760
1754
|
}
|
|
1761
1755
|
),
|
|
1762
1756
|
/* @__PURE__ */ e(
|
|
@@ -1774,11 +1768,11 @@ function Ge({
|
|
|
1774
1768
|
alignItems: "center",
|
|
1775
1769
|
transition: "all 0.15s ease"
|
|
1776
1770
|
},
|
|
1777
|
-
onMouseEnter: (
|
|
1778
|
-
|
|
1771
|
+
onMouseEnter: (a) => {
|
|
1772
|
+
a.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", a.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
|
|
1779
1773
|
},
|
|
1780
|
-
onMouseLeave: (
|
|
1781
|
-
|
|
1774
|
+
onMouseLeave: (a) => {
|
|
1775
|
+
a.currentTarget.style.background = "transparent", a.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
|
|
1782
1776
|
},
|
|
1783
1777
|
title: "Reference condition",
|
|
1784
1778
|
children: /* @__PURE__ */ e(he, { size: 16 })
|
|
@@ -1799,14 +1793,14 @@ function Ge({
|
|
|
1799
1793
|
alignItems: "center",
|
|
1800
1794
|
transition: "all 0.15s ease"
|
|
1801
1795
|
},
|
|
1802
|
-
onMouseEnter: (
|
|
1803
|
-
|
|
1796
|
+
onMouseEnter: (a) => {
|
|
1797
|
+
a.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", a.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
|
|
1804
1798
|
},
|
|
1805
|
-
onMouseLeave: (
|
|
1806
|
-
|
|
1799
|
+
onMouseLeave: (a) => {
|
|
1800
|
+
a.currentTarget.style.background = "transparent", a.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
|
|
1807
1801
|
},
|
|
1808
1802
|
title: "Attach file",
|
|
1809
|
-
children: /* @__PURE__ */ e(
|
|
1803
|
+
children: /* @__PURE__ */ e(Re, { size: 16 })
|
|
1810
1804
|
}
|
|
1811
1805
|
)
|
|
1812
1806
|
] }),
|
|
@@ -1815,26 +1809,26 @@ function Ge({
|
|
|
1815
1809
|
{
|
|
1816
1810
|
type: "button",
|
|
1817
1811
|
onClick: C,
|
|
1818
|
-
disabled: !
|
|
1812
|
+
disabled: !i.trim() || t,
|
|
1819
1813
|
style: {
|
|
1820
1814
|
padding: "6px 12px",
|
|
1821
|
-
background:
|
|
1815
|
+
background: i.trim() && !t ? "rgba(94, 136, 176, 0.85)" : "var(--border-subtle, rgba(52,58,64,0.08))",
|
|
1822
1816
|
border: "none",
|
|
1823
1817
|
borderRadius: "6px",
|
|
1824
|
-
color:
|
|
1818
|
+
color: i.trim() && !t ? "white" : "var(--text-faint, rgba(30,33,37,0.36))",
|
|
1825
1819
|
fontSize: "var(--text-sm, 11px)",
|
|
1826
1820
|
fontWeight: 600,
|
|
1827
|
-
cursor:
|
|
1821
|
+
cursor: i.trim() && !t ? "pointer" : "not-allowed",
|
|
1828
1822
|
display: "flex",
|
|
1829
1823
|
alignItems: "center",
|
|
1830
1824
|
gap: "6px",
|
|
1831
1825
|
transition: "all 0.15s ease"
|
|
1832
1826
|
},
|
|
1833
|
-
onMouseEnter: (
|
|
1834
|
-
|
|
1827
|
+
onMouseEnter: (a) => {
|
|
1828
|
+
i.trim() && !t && (a.currentTarget.style.background = "rgba(94, 136, 176, 1)");
|
|
1835
1829
|
},
|
|
1836
|
-
onMouseLeave: (
|
|
1837
|
-
|
|
1830
|
+
onMouseLeave: (a) => {
|
|
1831
|
+
i.trim() && !t && (a.currentTarget.style.background = "rgba(94, 136, 176, 0.85)");
|
|
1838
1832
|
},
|
|
1839
1833
|
children: t ? /* @__PURE__ */ s(J, { children: [
|
|
1840
1834
|
/* @__PURE__ */ e("style", { children: `
|
|
@@ -1926,7 +1920,7 @@ function Ge({
|
|
|
1926
1920
|
}
|
|
1927
1921
|
);
|
|
1928
1922
|
}
|
|
1929
|
-
const
|
|
1923
|
+
const A = [
|
|
1930
1924
|
"#5E88B0",
|
|
1931
1925
|
// rail-discovery / rail-blue
|
|
1932
1926
|
"#9B7AA8",
|
|
@@ -1960,34 +1954,34 @@ const B = [
|
|
|
1960
1954
|
if (!h)
|
|
1961
1955
|
return !1;
|
|
1962
1956
|
const m = h.toLowerCase();
|
|
1963
|
-
return b.filter((
|
|
1957
|
+
return b.filter((i) => String(i).toLowerCase().includes(m)).length < b.length * 0.5;
|
|
1964
1958
|
}, Ue = async (h, b) => {
|
|
1965
1959
|
const m = h.querySelector("svg");
|
|
1966
1960
|
if (!m)
|
|
1967
1961
|
return;
|
|
1968
|
-
const y = m.cloneNode(!0),
|
|
1969
|
-
y.setAttribute("width",
|
|
1962
|
+
const y = m.cloneNode(!0), i = m.clientWidth || 600, v = m.clientHeight || 300;
|
|
1963
|
+
y.setAttribute("width", i), y.setAttribute("height", v), y.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
1970
1964
|
const L = document.createElement("style");
|
|
1971
1965
|
L.textContent = 'text { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }', y.insertBefore(L, y.firstChild);
|
|
1972
|
-
const
|
|
1966
|
+
const k = new XMLSerializer().serializeToString(y), f = new Blob([k], { type: "image/svg+xml;charset=utf-8" }), d = URL.createObjectURL(f), o = new Image();
|
|
1973
1967
|
o.onload = () => {
|
|
1974
1968
|
const n = document.createElement("canvas"), t = 2;
|
|
1975
|
-
n.width =
|
|
1969
|
+
n.width = i * t, n.height = v * t;
|
|
1976
1970
|
const r = n.getContext("2d");
|
|
1977
|
-
r.fillStyle = "#ffffff", r.fillRect(0, 0, n.width, n.height), r.scale(t, t), r.drawImage(o, 0, 0,
|
|
1971
|
+
r.fillStyle = "#ffffff", r.fillRect(0, 0, n.width, n.height), r.scale(t, t), r.drawImage(o, 0, 0, i, v), URL.revokeObjectURL(d);
|
|
1978
1972
|
const c = document.createElement("a");
|
|
1979
1973
|
c.download = `${(b || "chart").replace(/[^a-z0-9]+/gi, "_")}.png`, c.href = n.toDataURL("image/png"), c.click();
|
|
1980
|
-
}, o.src =
|
|
1974
|
+
}, o.src = d;
|
|
1981
1975
|
}, He = (h, b) => {
|
|
1982
1976
|
const m = ["", ...h.map((v) => v.name)].join(","), y = b.map((v) => {
|
|
1983
|
-
const L = h.map((
|
|
1984
|
-
const f =
|
|
1977
|
+
const L = h.map((k) => {
|
|
1978
|
+
const f = k.data.find((d) => d.x === v);
|
|
1985
1979
|
return f ? f.y : "";
|
|
1986
1980
|
});
|
|
1987
1981
|
return [v, ...L].join(",");
|
|
1988
|
-
}),
|
|
1982
|
+
}), i = [m, ...y].join(`
|
|
1989
1983
|
`);
|
|
1990
|
-
navigator.clipboard.writeText(
|
|
1984
|
+
navigator.clipboard.writeText(i);
|
|
1991
1985
|
}, Oe = ({ onDownload: h, onCopy: b, copied: m }) => /* @__PURE__ */ s("div", { style: {
|
|
1992
1986
|
display: "flex",
|
|
1993
1987
|
gap: 6,
|
|
@@ -2020,17 +2014,17 @@ const B = [
|
|
|
2020
2014
|
alignItems: "center",
|
|
2021
2015
|
gap: 4
|
|
2022
2016
|
}, children: "📥 PNG" })
|
|
2023
|
-
] }), Je = ({ chartType: h, title: b, xLabel: m, yLabel: y, series:
|
|
2024
|
-
const v = Y(null), [L,
|
|
2025
|
-
if (!
|
|
2017
|
+
] }), Je = ({ chartType: h, title: b, xLabel: m, yLabel: y, series: i }) => {
|
|
2018
|
+
const v = Y(null), [L, k] = de.useState(!1);
|
|
2019
|
+
if (!i || i.length === 0)
|
|
2026
2020
|
return null;
|
|
2027
|
-
const f = [...new Set(
|
|
2028
|
-
const x = { x:
|
|
2029
|
-
return
|
|
2030
|
-
const S = I.data.find((E) => E.x ===
|
|
2021
|
+
const f = [...new Set(i.flatMap((l) => l.data.map((x) => x.x)))], d = f.map((l) => {
|
|
2022
|
+
const x = { x: l };
|
|
2023
|
+
return i.forEach((I) => {
|
|
2024
|
+
const S = I.data.find((E) => E.x === l);
|
|
2031
2025
|
x[I.name] = S ? S.y : null;
|
|
2032
2026
|
}), x;
|
|
2033
|
-
}), o =
|
|
2027
|
+
}), o = i.map((l) => l.name), n = o.length === 1, t = Pe(m, f), r = t ? 20 : 5, g = Math.max(...f.map((l) => String(l).length)) > 12 || f.length > 8, p = {
|
|
2034
2028
|
background: "var(--paper-elevated, #fff)",
|
|
2035
2029
|
border: "1px solid var(--border, #e0e0e0)",
|
|
2036
2030
|
borderRadius: "var(--radius-md, 8px)",
|
|
@@ -2041,34 +2035,34 @@ const B = [
|
|
|
2041
2035
|
fontSize: "14px",
|
|
2042
2036
|
fontWeight: "600",
|
|
2043
2037
|
marginBottom: "12px"
|
|
2044
|
-
},
|
|
2038
|
+
}, z = {
|
|
2045
2039
|
dataKey: "x",
|
|
2046
|
-
tick:
|
|
2040
|
+
tick: g ? { fill: "var(--text-muted, #666)", fontSize: 11, angle: -35, textAnchor: "end" } : pe,
|
|
2047
2041
|
axisLine: O,
|
|
2048
2042
|
tickLine: O,
|
|
2049
2043
|
...t ? {
|
|
2050
2044
|
label: { value: m, position: "insideBottom", offset: -10, style: { textAnchor: "middle", fill: "var(--text-muted, #666)" } }
|
|
2051
2045
|
} : {}
|
|
2052
|
-
},
|
|
2046
|
+
}, B = {
|
|
2053
2047
|
tick: pe,
|
|
2054
2048
|
axisLine: O,
|
|
2055
2049
|
tickLine: O,
|
|
2056
2050
|
...y ? {
|
|
2057
2051
|
label: { value: y, angle: -90, position: "insideLeft", style: { textAnchor: "middle", fill: "var(--text-muted, #666)" } }
|
|
2058
2052
|
} : {}
|
|
2059
|
-
},
|
|
2053
|
+
}, a = () => {
|
|
2060
2054
|
switch (h) {
|
|
2061
2055
|
case "bar":
|
|
2062
|
-
return /* @__PURE__ */ e(Z, { width: "100%", height: 300, children: /* @__PURE__ */ s(fe, { data:
|
|
2056
|
+
return /* @__PURE__ */ e(Z, { width: "100%", height: 300, children: /* @__PURE__ */ s(fe, { data: d, margin: { top: 5, right: 30, left: 20, bottom: g ? 40 : r }, children: [
|
|
2063
2057
|
/* @__PURE__ */ e(ne, { strokeDasharray: "3 3", stroke: se }),
|
|
2064
|
-
/* @__PURE__ */ e(oe, { ...
|
|
2065
|
-
/* @__PURE__ */ e(
|
|
2058
|
+
/* @__PURE__ */ e(oe, { ...z }),
|
|
2059
|
+
/* @__PURE__ */ e(ie, { ...B }),
|
|
2066
2060
|
/* @__PURE__ */ e(ee, { ...te }),
|
|
2067
|
-
!n && /* @__PURE__ */ e(
|
|
2068
|
-
o.map((
|
|
2061
|
+
!n && /* @__PURE__ */ e(ae, { wrapperStyle: le }),
|
|
2062
|
+
o.map((l, x) => /* @__PURE__ */ e(me, { dataKey: l, fill: A[x % A.length], radius: [2, 2, 0, 0], children: n && d.map((I, S) => /* @__PURE__ */ e(ce, { fill: A[S % A.length] }, S)) }, l))
|
|
2069
2063
|
] }) });
|
|
2070
2064
|
case "horizontal_bar":
|
|
2071
|
-
return /* @__PURE__ */ e(Z, { width: "100%", height: Math.max(300,
|
|
2065
|
+
return /* @__PURE__ */ e(Z, { width: "100%", height: Math.max(300, d.length * 40), children: /* @__PURE__ */ s(fe, { data: d, layout: "vertical", margin: { top: 5, right: 30, left: 100, bottom: 5 }, children: [
|
|
2072
2066
|
/* @__PURE__ */ e(ne, { strokeDasharray: "3 3", stroke: se }),
|
|
2073
2067
|
/* @__PURE__ */ e(
|
|
2074
2068
|
oe,
|
|
@@ -2080,68 +2074,68 @@ const B = [
|
|
|
2080
2074
|
...y ? { label: { value: y, position: "insideBottom", offset: -5, style: { textAnchor: "middle", fill: "var(--text-muted, #666)" } } } : {}
|
|
2081
2075
|
}
|
|
2082
2076
|
),
|
|
2083
|
-
/* @__PURE__ */ e(
|
|
2077
|
+
/* @__PURE__ */ e(ie, { type: "category", dataKey: "x", tick: { fill: "var(--text-muted, #666)", fontSize: 11 }, width: 90, axisLine: O, tickLine: O }),
|
|
2084
2078
|
/* @__PURE__ */ e(ee, { ...te }),
|
|
2085
|
-
!n && /* @__PURE__ */ e(
|
|
2086
|
-
o.map((
|
|
2079
|
+
!n && /* @__PURE__ */ e(ae, { wrapperStyle: le }),
|
|
2080
|
+
o.map((l, x) => /* @__PURE__ */ e(me, { dataKey: l, fill: A[x % A.length], radius: [0, 2, 2, 0], children: n && d.map((I, S) => /* @__PURE__ */ e(ce, { fill: A[S % A.length] }, S)) }, l))
|
|
2087
2081
|
] }) });
|
|
2088
2082
|
case "line":
|
|
2089
|
-
return /* @__PURE__ */ e(Z, { width: "100%", height: 300, children: /* @__PURE__ */ s(De, { data:
|
|
2083
|
+
return /* @__PURE__ */ e(Z, { width: "100%", height: 300, children: /* @__PURE__ */ s(De, { data: d, margin: { top: 5, right: 30, left: 20, bottom: g ? 40 : r }, children: [
|
|
2090
2084
|
/* @__PURE__ */ e(ne, { strokeDasharray: "3 3", stroke: se }),
|
|
2091
|
-
/* @__PURE__ */ e(oe, { ...
|
|
2092
|
-
/* @__PURE__ */ e(
|
|
2085
|
+
/* @__PURE__ */ e(oe, { ...z }),
|
|
2086
|
+
/* @__PURE__ */ e(ie, { ...B }),
|
|
2093
2087
|
/* @__PURE__ */ e(ee, { ...te }),
|
|
2094
|
-
/* @__PURE__ */ e(
|
|
2095
|
-
o.map((
|
|
2088
|
+
/* @__PURE__ */ e(ae, { wrapperStyle: le }),
|
|
2089
|
+
o.map((l, x) => /* @__PURE__ */ e(
|
|
2096
2090
|
Ee,
|
|
2097
2091
|
{
|
|
2098
2092
|
type: "monotone",
|
|
2099
|
-
dataKey:
|
|
2100
|
-
stroke:
|
|
2093
|
+
dataKey: l,
|
|
2094
|
+
stroke: A[x % A.length],
|
|
2101
2095
|
strokeWidth: 2,
|
|
2102
|
-
dot: { r: 4, fill:
|
|
2103
|
-
activeDot: { r: 6, fill:
|
|
2096
|
+
dot: { r: 4, fill: A[x % A.length] },
|
|
2097
|
+
activeDot: { r: 6, fill: A[x % A.length] }
|
|
2104
2098
|
},
|
|
2105
|
-
|
|
2099
|
+
l
|
|
2106
2100
|
))
|
|
2107
2101
|
] }) });
|
|
2108
2102
|
case "area":
|
|
2109
|
-
return /* @__PURE__ */ e(Z, { width: "100%", height: 300, children: /* @__PURE__ */ s(Ie, { data:
|
|
2103
|
+
return /* @__PURE__ */ e(Z, { width: "100%", height: 300, children: /* @__PURE__ */ s(Ie, { data: d, margin: { top: 5, right: 30, left: 20, bottom: g ? 40 : r }, children: [
|
|
2110
2104
|
/* @__PURE__ */ e(ne, { strokeDasharray: "3 3", stroke: se }),
|
|
2111
|
-
/* @__PURE__ */ e(oe, { ...
|
|
2112
|
-
/* @__PURE__ */ e(
|
|
2105
|
+
/* @__PURE__ */ e(oe, { ...z }),
|
|
2106
|
+
/* @__PURE__ */ e(ie, { ...B }),
|
|
2113
2107
|
/* @__PURE__ */ e(ee, { ...te }),
|
|
2114
|
-
/* @__PURE__ */ e(
|
|
2115
|
-
o.map((
|
|
2108
|
+
/* @__PURE__ */ e(ae, { wrapperStyle: le }),
|
|
2109
|
+
o.map((l, x) => /* @__PURE__ */ e(
|
|
2116
2110
|
Me,
|
|
2117
2111
|
{
|
|
2118
2112
|
type: "monotone",
|
|
2119
|
-
dataKey:
|
|
2120
|
-
stroke:
|
|
2113
|
+
dataKey: l,
|
|
2114
|
+
stroke: A[x % A.length],
|
|
2121
2115
|
strokeWidth: 2,
|
|
2122
|
-
fill:
|
|
2116
|
+
fill: A[x % A.length],
|
|
2123
2117
|
fillOpacity: 0.15
|
|
2124
2118
|
},
|
|
2125
|
-
|
|
2119
|
+
l
|
|
2126
2120
|
))
|
|
2127
2121
|
] }) });
|
|
2128
2122
|
case "pie": {
|
|
2129
|
-
const
|
|
2123
|
+
const l = i[0].data.map((S, E) => ({
|
|
2130
2124
|
name: S.x,
|
|
2131
2125
|
value: S.y,
|
|
2132
|
-
fill:
|
|
2126
|
+
fill: A[E % A.length]
|
|
2133
2127
|
})), x = Math.PI / 180;
|
|
2134
|
-
return /* @__PURE__ */ e(Z, { width: "100%", height: 320, children: /* @__PURE__ */ s(
|
|
2128
|
+
return /* @__PURE__ */ e(Z, { width: "100%", height: 320, children: /* @__PURE__ */ s(Ae, { children: [
|
|
2135
2129
|
/* @__PURE__ */ e(
|
|
2136
2130
|
Le,
|
|
2137
2131
|
{
|
|
2138
|
-
data:
|
|
2132
|
+
data: l,
|
|
2139
2133
|
cx: "50%",
|
|
2140
2134
|
cy: "50%",
|
|
2141
2135
|
outerRadius: 100,
|
|
2142
2136
|
dataKey: "value",
|
|
2143
|
-
label: ({ cx: S, cy: E, midAngle:
|
|
2144
|
-
const q = X + 20, U = S + q * Math.cos(-
|
|
2137
|
+
label: ({ cx: S, cy: E, midAngle: _, innerRadius: H, outerRadius: X, percent: P, name: N }) => {
|
|
2138
|
+
const q = X + 20, U = S + q * Math.cos(-_ * x), K = E + q * Math.sin(-_ * x);
|
|
2145
2139
|
return P < 0.04 ? null : /* @__PURE__ */ s(
|
|
2146
2140
|
"text",
|
|
2147
2141
|
{
|
|
@@ -2161,14 +2155,14 @@ const B = [
|
|
|
2161
2155
|
);
|
|
2162
2156
|
},
|
|
2163
2157
|
labelLine: { stroke: "var(--text-muted, #666)" },
|
|
2164
|
-
children:
|
|
2158
|
+
children: l.map((S, E) => /* @__PURE__ */ e(ce, { fill: S.fill }, E))
|
|
2165
2159
|
}
|
|
2166
2160
|
),
|
|
2167
2161
|
/* @__PURE__ */ e(ee, { ...te })
|
|
2168
2162
|
] }) });
|
|
2169
2163
|
}
|
|
2170
2164
|
case "metric": {
|
|
2171
|
-
const
|
|
2165
|
+
const l = i[0], x = l.data[0], I = l.data.length > 1 ? l.data[1] : null, S = x.y, E = x.x || "", _ = I !== null, H = _ ? S - I.y : 0, X = _ && I.y !== 0 ? H / Math.abs(I.y) * 100 : 0, P = H > 0, N = H < 0, q = P ? "#7BA89D" : N ? "#D17B6B" : "var(--text-muted, #666)", U = P ? "↑" : N ? "↓" : "→", K = ($) => Number.isInteger($) && Math.abs($) >= 1e3 ? $.toLocaleString() : typeof $ == "number" ? $ % 1 === 0 ? $.toString() : $.toFixed($ < 10 ? 2 : 1) : String($);
|
|
2172
2166
|
return /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "baseline", gap: 12, padding: "8px 0" }, children: [
|
|
2173
2167
|
/* @__PURE__ */ e("div", { style: {
|
|
2174
2168
|
fontSize: "36px",
|
|
@@ -2178,7 +2172,7 @@ const B = [
|
|
|
2178
2172
|
fontVariantNumeric: "tabular-nums"
|
|
2179
2173
|
}, children: K(S) }),
|
|
2180
2174
|
E && /* @__PURE__ */ e("div", { style: { fontSize: "14px", color: "var(--text-muted, #666)", fontWeight: 500 }, children: E }),
|
|
2181
|
-
|
|
2175
|
+
_ && /* @__PURE__ */ s("div", { style: {
|
|
2182
2176
|
display: "flex",
|
|
2183
2177
|
alignItems: "center",
|
|
2184
2178
|
gap: 4,
|
|
@@ -2197,7 +2191,7 @@ const B = [
|
|
|
2197
2191
|
"%)"
|
|
2198
2192
|
] })
|
|
2199
2193
|
] }),
|
|
2200
|
-
|
|
2194
|
+
_ && /* @__PURE__ */ s("div", { style: { fontSize: "11px", color: "var(--text-faint, #999)" }, children: [
|
|
2201
2195
|
"vs ",
|
|
2202
2196
|
I.x || "previous"
|
|
2203
2197
|
] })
|
|
@@ -2209,15 +2203,15 @@ const B = [
|
|
|
2209
2203
|
h
|
|
2210
2204
|
] });
|
|
2211
2205
|
}
|
|
2212
|
-
},
|
|
2206
|
+
}, w = xe(() => {
|
|
2213
2207
|
v.current && Ue(v.current, b);
|
|
2214
2208
|
}, [b]), D = xe(() => {
|
|
2215
|
-
He(
|
|
2216
|
-
}, [
|
|
2209
|
+
He(i, f), k(!0), setTimeout(() => k(!1), 2e3);
|
|
2210
|
+
}, [i, f]);
|
|
2217
2211
|
return /* @__PURE__ */ s("div", { style: p, children: [
|
|
2218
2212
|
b && /* @__PURE__ */ e("div", { style: C, children: b }),
|
|
2219
|
-
h !== "metric" && /* @__PURE__ */ e(Oe, { onDownload:
|
|
2220
|
-
/* @__PURE__ */ e("div", { ref: v, children:
|
|
2213
|
+
h !== "metric" && /* @__PURE__ */ e(Oe, { onDownload: w, onCopy: D, copied: L }),
|
|
2214
|
+
/* @__PURE__ */ e("div", { ref: v, children: a() })
|
|
2221
2215
|
] });
|
|
2222
2216
|
};
|
|
2223
2217
|
export {
|
|
@@ -2226,6 +2220,6 @@ export {
|
|
|
2226
2220
|
qe as ChatInterface,
|
|
2227
2221
|
be as ChatMessage,
|
|
2228
2222
|
Ge as MessageThread,
|
|
2229
|
-
|
|
2223
|
+
Fe as ThinkingIndicator
|
|
2230
2224
|
};
|
|
2231
2225
|
//# sourceMappingURL=chat.es.js.map
|