chordia-ui 3.7.0 → 3.7.2
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/ChatMessage.cjs.js +15 -0
- package/dist/ChatMessage.cjs.js.map +1 -0
- package/dist/ChatMessage.es.js +915 -0
- package/dist/ChatMessage.es.js.map +1 -0
- package/dist/SideDrawer.cjs.js +2 -0
- package/dist/SideDrawer.cjs.js.map +1 -0
- package/dist/SideDrawer.es.js +358 -0
- package/dist/SideDrawer.es.js.map +1 -0
- package/dist/Toast.cjs.js +2 -2
- package/dist/Toast.cjs.js.map +1 -1
- package/dist/Toast.es.js +301 -671
- package/dist/Toast.es.js.map +1 -1
- package/dist/components/UpdatedInteractionDetails.cjs.js +4 -4
- package/dist/components/UpdatedInteractionDetails.cjs.js.map +1 -1
- package/dist/components/UpdatedInteractionDetails.es.js +652 -603
- package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
- package/dist/components/chat.cjs.js +5 -7
- package/dist/components/chat.cjs.js.map +1 -1
- package/dist/components/chat.es.js +393 -849
- package/dist/components/chat.es.js.map +1 -1
- package/dist/components/common.cjs.js +1 -1
- package/dist/components/common.es.js +28 -27
- package/dist/components/common.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +73 -72
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/UpdatedInteractionDetails/UpdatedInteractionContext.jsx +6 -2
- package/src/components/UpdatedInteractionDetails/UpdatedInteractionDetails.jsx +190 -139
- package/src/components/chat/ChartRenderer.jsx +300 -49
- package/src/components/common/AskCompass.jsx +91 -87
- package/src/components/common/SideDrawer.jsx +7 -3
- package/dist/ChartRenderer.cjs.js +0 -3
- package/dist/ChartRenderer.cjs.js.map +0 -1
- package/dist/ChartRenderer.es.js +0 -304
- package/dist/ChartRenderer.es.js.map +0 -1
|
@@ -0,0 +1,915 @@
|
|
|
1
|
+
import { jsxs as y, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import Z, { useRef as pt, useCallback as at, useState as gt } from "react";
|
|
3
|
+
import { ResponsiveContainer as N, PieChart as ut, Pie as mt, Cell as nt, Tooltip as O, AreaChart as ft, CartesianGrid as q, XAxis as G, YAxis as V, Legend as J, Area as xt, LineChart as bt, Line as yt, BarChart as st, Bar as lt } from "recharts";
|
|
4
|
+
import { Wrench as vt, Check as wt, Copy as St, PanelRightOpen as kt } from "lucide-react";
|
|
5
|
+
const w = [
|
|
6
|
+
"#5E88B0",
|
|
7
|
+
// rail-discovery / rail-blue
|
|
8
|
+
"#9B7AA8",
|
|
9
|
+
// rail-purple / rail-tone
|
|
10
|
+
"#C98A5A",
|
|
11
|
+
// rail-compliance / rail-orange
|
|
12
|
+
"#7BA89D",
|
|
13
|
+
// rail-signal-upsell (teal-green)
|
|
14
|
+
"#D17B6B",
|
|
15
|
+
// rail-coral / rail-signal-churn
|
|
16
|
+
"#6B7C93",
|
|
17
|
+
// rail-slate / rail-outcome
|
|
18
|
+
"#9B8E6F",
|
|
19
|
+
// rail-olive / rail-signal-satisfaction
|
|
20
|
+
"#8A9BAF",
|
|
21
|
+
// rail-quality
|
|
22
|
+
"#B8976A",
|
|
23
|
+
// rail-teal (warm gold)
|
|
24
|
+
"#A8C76B"
|
|
25
|
+
// green accent (complementary)
|
|
26
|
+
], ot = { fill: "var(--text-muted, #666)", fontSize: 12 }, I = { stroke: "var(--border, #e0e0e0)" }, Q = "var(--border, #e0e0e0)", F = {
|
|
27
|
+
// pointerEvents: 'none' is critical — without it, the tooltip steals hover from chart elements
|
|
28
|
+
// and flickers (especially noticeable on pie slices).
|
|
29
|
+
// transition: 'none' disables Recharts' default position-slide animation, so the tooltip
|
|
30
|
+
// snaps to the active point instead of flying in from its previous location.
|
|
31
|
+
wrapperStyle: {
|
|
32
|
+
zIndex: 9999,
|
|
33
|
+
pointerEvents: "none",
|
|
34
|
+
outline: "none",
|
|
35
|
+
transition: "none"
|
|
36
|
+
}
|
|
37
|
+
}, Ct = { color: "var(--text-ink, #1e2125)", fontSize: "12px" }, X = ({ active: d, payload: c, label: g }) => !d || !c || !c.length ? null : /* @__PURE__ */ y(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: "chordia-chart-tooltip",
|
|
41
|
+
style: {
|
|
42
|
+
background: "#ffffff",
|
|
43
|
+
border: "1px solid rgba(52, 58, 64, 0.12)",
|
|
44
|
+
borderRadius: 8,
|
|
45
|
+
boxShadow: "0 8px 24px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06)",
|
|
46
|
+
padding: "10px 12px",
|
|
47
|
+
minWidth: 140,
|
|
48
|
+
maxWidth: 280,
|
|
49
|
+
maxHeight: 280,
|
|
50
|
+
overflowY: "auto",
|
|
51
|
+
fontSize: 12,
|
|
52
|
+
lineHeight: 1.5,
|
|
53
|
+
color: "#1E2125",
|
|
54
|
+
// Re-enable pointer events on the inner content so the user can scroll with the wheel
|
|
55
|
+
// even though the wrapper above has pointerEvents: 'none' (which prevents hover flicker).
|
|
56
|
+
pointerEvents: "auto"
|
|
57
|
+
},
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ t("style", { children: `
|
|
60
|
+
.chordia-chart-tooltip::-webkit-scrollbar { width: 8px; }
|
|
61
|
+
.chordia-chart-tooltip::-webkit-scrollbar-track { background: transparent; }
|
|
62
|
+
.chordia-chart-tooltip::-webkit-scrollbar-thumb {
|
|
63
|
+
background: rgba(52, 58, 64, 0.25);
|
|
64
|
+
border-radius: 4px;
|
|
65
|
+
}
|
|
66
|
+
.chordia-chart-tooltip::-webkit-scrollbar-thumb:hover {
|
|
67
|
+
background: rgba(52, 58, 64, 0.4);
|
|
68
|
+
}
|
|
69
|
+
` }),
|
|
70
|
+
g !== void 0 && g !== "" && /* @__PURE__ */ t(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
style: {
|
|
74
|
+
fontSize: 11,
|
|
75
|
+
fontWeight: 600,
|
|
76
|
+
letterSpacing: "0.02em",
|
|
77
|
+
color: "#6B7280",
|
|
78
|
+
textTransform: "uppercase",
|
|
79
|
+
marginBottom: 6,
|
|
80
|
+
paddingBottom: 6,
|
|
81
|
+
borderBottom: "1px solid rgba(52, 58, 64, 0.08)"
|
|
82
|
+
},
|
|
83
|
+
children: g
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: c.map((a, i) => {
|
|
87
|
+
var h;
|
|
88
|
+
const u = a.color || ((h = a.payload) == null ? void 0 : h.fill) || "#9CA3AF";
|
|
89
|
+
return /* @__PURE__ */ y(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
style: {
|
|
93
|
+
display: "flex",
|
|
94
|
+
alignItems: "center",
|
|
95
|
+
gap: 8,
|
|
96
|
+
justifyContent: "space-between"
|
|
97
|
+
},
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ y("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
|
|
100
|
+
/* @__PURE__ */ t(
|
|
101
|
+
"span",
|
|
102
|
+
{
|
|
103
|
+
style: {
|
|
104
|
+
width: 8,
|
|
105
|
+
height: 8,
|
|
106
|
+
borderRadius: "50%",
|
|
107
|
+
background: u,
|
|
108
|
+
flexShrink: 0
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ t(
|
|
113
|
+
"span",
|
|
114
|
+
{
|
|
115
|
+
style: {
|
|
116
|
+
color: "#374151",
|
|
117
|
+
overflow: "hidden",
|
|
118
|
+
textOverflow: "ellipsis",
|
|
119
|
+
whiteSpace: "nowrap"
|
|
120
|
+
},
|
|
121
|
+
children: a.name
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
] }),
|
|
125
|
+
/* @__PURE__ */ t("span", { style: { color: "#111827", fontWeight: 600, marginLeft: 8 }, children: a.value })
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
i
|
|
129
|
+
);
|
|
130
|
+
}) })
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
), At = (d, c) => {
|
|
134
|
+
if (!d)
|
|
135
|
+
return !1;
|
|
136
|
+
const g = d.toLowerCase();
|
|
137
|
+
return c.filter((i) => String(i).toLowerCase().includes(g)).length < c.length * 0.5;
|
|
138
|
+
}, Bt = (d) => {
|
|
139
|
+
const c = Array.from(d.querySelectorAll(".recharts-wrapper")), g = c.length ? c.reduce((h, k) => {
|
|
140
|
+
const x = h.getBoundingClientRect(), o = k.getBoundingClientRect();
|
|
141
|
+
return o.width * o.height > x.width * x.height ? k : h;
|
|
142
|
+
}) : null;
|
|
143
|
+
if (g) {
|
|
144
|
+
const h = g.querySelector("svg.recharts-surface");
|
|
145
|
+
if (h) {
|
|
146
|
+
const k = h.getBoundingClientRect();
|
|
147
|
+
if (k.width >= 100 && k.height >= 100)
|
|
148
|
+
return h;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const a = Array.from(d.querySelectorAll("svg"));
|
|
152
|
+
if (!a.length)
|
|
153
|
+
return null;
|
|
154
|
+
const i = a.reduce((h, k) => {
|
|
155
|
+
const x = h.getBoundingClientRect(), o = k.getBoundingClientRect();
|
|
156
|
+
return o.width * o.height > x.width * x.height ? k : h;
|
|
157
|
+
}), u = i.getBoundingClientRect();
|
|
158
|
+
return u.width < 100 || u.height < 100 ? null : i;
|
|
159
|
+
}, Rt = (d) => String(d).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), Lt = ({ chartSvg: d, width: c, height: g, legendItems: a = [] }) => {
|
|
160
|
+
const i = d.cloneNode(!0), u = 20, h = 16, x = c - 16, o = [];
|
|
161
|
+
let l = [], n = 0;
|
|
162
|
+
a.forEach(({ label: f, color: s }) => {
|
|
163
|
+
const m = Math.max(40, String(f).length * 7 + 34);
|
|
164
|
+
l.length && h + n + m > x && (o.push(l), l = [], n = 0), l.push({ label: f, color: s, itemWidth: m }), n += m;
|
|
165
|
+
}), l.length && o.push(l);
|
|
166
|
+
const e = o.length ? o.length * u + 20 : 0, r = g + e;
|
|
167
|
+
i.setAttribute("width", c), i.setAttribute("height", g), i.setAttribute("x", 0), i.setAttribute("y", 0);
|
|
168
|
+
const b = o.map((f, s) => {
|
|
169
|
+
let m = h;
|
|
170
|
+
const S = g + 20 + s * u;
|
|
171
|
+
return f.map(({ label: B, color: L, itemWidth: D }) => {
|
|
172
|
+
const T = `<line x1="${m}" y1="${S}" x2="${m + 10}" y2="${S}" stroke="${L}" stroke-width="2" />`, R = `<circle cx="${m + 5}" cy="${S}" r="2.5" fill="#fff" stroke="${L}" stroke-width="1.5" />`, z = `<text x="${m + 14}" y="${S + 4}" fill="#666" font-size="12">${Rt(B)}</text>`;
|
|
173
|
+
return m += D, `${T}${R}${z}`;
|
|
174
|
+
}).join("");
|
|
175
|
+
}).join("");
|
|
176
|
+
return [
|
|
177
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="${c}" height="${r}" viewBox="0 0 ${c} ${r}">`,
|
|
178
|
+
'<style>text { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }</style>',
|
|
179
|
+
'<rect x="0" y="0" width="100%" height="100%" fill="#ffffff" />',
|
|
180
|
+
new XMLSerializer().serializeToString(i),
|
|
181
|
+
b,
|
|
182
|
+
"</svg>"
|
|
183
|
+
].join("");
|
|
184
|
+
}, zt = async (d, c, g = []) => {
|
|
185
|
+
const a = Bt(d);
|
|
186
|
+
if (!a)
|
|
187
|
+
return;
|
|
188
|
+
const i = a.getBoundingClientRect(), u = i.width || a.clientWidth || Number(a.getAttribute("width")) || 600, h = i.height || a.clientHeight || Number(a.getAttribute("height")) || 300, k = Lt({ chartSvg: a, width: u, height: h, legendItems: g }), x = new Blob([k], { type: "image/svg+xml;charset=utf-8" }), o = URL.createObjectURL(x), l = new Image();
|
|
189
|
+
l.onload = () => {
|
|
190
|
+
const n = document.createElement("canvas"), e = 2;
|
|
191
|
+
n.width = u * e, n.height = h * e;
|
|
192
|
+
const r = n.getContext("2d");
|
|
193
|
+
r.fillStyle = "#ffffff", r.fillRect(0, 0, n.width, n.height), r.scale(e, e), r.drawImage(l, 0, 0, u, h), URL.revokeObjectURL(o);
|
|
194
|
+
const b = document.createElement("a");
|
|
195
|
+
b.download = `${(c || "chart").replace(/[^a-z0-9]+/gi, "_")}.png`, b.href = n.toDataURL("image/png"), b.click();
|
|
196
|
+
}, l.src = o;
|
|
197
|
+
}, Wt = (d, c) => {
|
|
198
|
+
const g = ["", ...d.map((u) => u.name)].join(","), a = c.map((u) => {
|
|
199
|
+
const h = d.map((k) => {
|
|
200
|
+
const x = k.data.find((o) => o.x === u);
|
|
201
|
+
return x ? x.y : "";
|
|
202
|
+
});
|
|
203
|
+
return [u, ...h].join(",");
|
|
204
|
+
}), i = [g, ...a].join(`
|
|
205
|
+
`);
|
|
206
|
+
navigator.clipboard.writeText(i);
|
|
207
|
+
}, Dt = ({ onDownloadPng: d, onCopy: c, copied: g }) => /* @__PURE__ */ y("div", { style: {
|
|
208
|
+
display: "flex",
|
|
209
|
+
gap: 6,
|
|
210
|
+
justifyContent: "flex-end",
|
|
211
|
+
marginBottom: 8,
|
|
212
|
+
opacity: 0.7,
|
|
213
|
+
transition: "opacity 0.15s"
|
|
214
|
+
}, children: [
|
|
215
|
+
/* @__PURE__ */ t("button", { onClick: c, title: "Copy data as CSV", style: {
|
|
216
|
+
background: "none",
|
|
217
|
+
border: "1px solid var(--border, #e0e0e0)",
|
|
218
|
+
borderRadius: "var(--radius-sm, 4px)",
|
|
219
|
+
padding: "3px 8px",
|
|
220
|
+
fontSize: 11,
|
|
221
|
+
color: "var(--text-muted, #666)",
|
|
222
|
+
cursor: "pointer",
|
|
223
|
+
display: "flex",
|
|
224
|
+
alignItems: "center",
|
|
225
|
+
gap: 4
|
|
226
|
+
}, children: g ? "✓ Copied" : "📋 CSV" }),
|
|
227
|
+
/* @__PURE__ */ t("button", { onClick: d, title: "Download as PNG", style: {
|
|
228
|
+
background: "none",
|
|
229
|
+
border: "1px solid var(--border, #e0e0e0)",
|
|
230
|
+
borderRadius: "var(--radius-sm, 4px)",
|
|
231
|
+
padding: "3px 8px",
|
|
232
|
+
fontSize: 11,
|
|
233
|
+
color: "var(--text-muted, #666)",
|
|
234
|
+
cursor: "pointer",
|
|
235
|
+
display: "flex",
|
|
236
|
+
alignItems: "center",
|
|
237
|
+
gap: 4
|
|
238
|
+
}, children: "📥 PNG" })
|
|
239
|
+
] }), Pt = ({ chartType: d, title: c, xLabel: g, yLabel: a, series: i, compact: u = !1 }) => {
|
|
240
|
+
const h = pt(null), [k, x] = Z.useState(!1);
|
|
241
|
+
if (!i || i.length === 0)
|
|
242
|
+
return null;
|
|
243
|
+
const o = [...new Set(i.flatMap((p) => p.data.map((v) => v.x)))], l = o.map((p) => {
|
|
244
|
+
const v = { x: p };
|
|
245
|
+
return i.forEach((W) => {
|
|
246
|
+
const C = W.data.find((M) => M.x === p);
|
|
247
|
+
v[W.name] = C ? C.y : null;
|
|
248
|
+
}), v;
|
|
249
|
+
}), n = i.map((p) => p.name), e = n.length === 1, r = At(g, o), f = Math.max(...o.map((p) => String(p).length)) > 12 || o.length > 8, S = (f ? 40 : 5) + (r ? 25 : 0), A = e ? 0 : Math.max(1, Math.ceil(n.length / 4)), B = A > 0 ? A * 24 + (r ? 24 : 12) : 0, D = (u ? 240 : 300) + Math.max(0, (A - 1) * 28), R = { ...Ct, paddingTop: r ? 24 : 12, zIndex: 0 }, z = {
|
|
250
|
+
background: "var(--paper-elevated, #fff)",
|
|
251
|
+
border: "1px solid var(--border, #e0e0e0)",
|
|
252
|
+
borderRadius: "var(--radius-md, 8px)",
|
|
253
|
+
padding: "16px",
|
|
254
|
+
marginBottom: "16px"
|
|
255
|
+
}, tt = {
|
|
256
|
+
color: "var(--text-strong, #1e2125)",
|
|
257
|
+
fontSize: "14px",
|
|
258
|
+
fontWeight: "600",
|
|
259
|
+
marginBottom: "12px"
|
|
260
|
+
}, j = {
|
|
261
|
+
dataKey: "x",
|
|
262
|
+
tick: f ? { fill: "var(--text-muted, #666)", fontSize: 11, angle: -35, textAnchor: "end" } : ot,
|
|
263
|
+
axisLine: I,
|
|
264
|
+
tickLine: I,
|
|
265
|
+
...r ? {
|
|
266
|
+
label: {
|
|
267
|
+
value: g,
|
|
268
|
+
position: "insideBottom",
|
|
269
|
+
// Push label below rotated ticks (which take ~40px) when present
|
|
270
|
+
offset: f ? -45 : -10,
|
|
271
|
+
style: { textAnchor: "middle", fill: "var(--text-muted, #666)" }
|
|
272
|
+
}
|
|
273
|
+
} : {}
|
|
274
|
+
}, et = {
|
|
275
|
+
tick: ot,
|
|
276
|
+
axisLine: I,
|
|
277
|
+
tickLine: I,
|
|
278
|
+
...a ? {
|
|
279
|
+
width: 72,
|
|
280
|
+
label: {
|
|
281
|
+
value: a,
|
|
282
|
+
angle: -90,
|
|
283
|
+
position: "insideLeft",
|
|
284
|
+
offset: 10,
|
|
285
|
+
style: { textAnchor: "middle", fill: "var(--text-muted, #666)" }
|
|
286
|
+
}
|
|
287
|
+
} : {}
|
|
288
|
+
}, ct = () => {
|
|
289
|
+
switch (d) {
|
|
290
|
+
case "bar":
|
|
291
|
+
return /* @__PURE__ */ t(N, { width: "100%", height: D, children: /* @__PURE__ */ y(st, { data: l, margin: { top: 5, right: 30, left: a ? 10 : 20, bottom: S }, children: [
|
|
292
|
+
/* @__PURE__ */ t(q, { strokeDasharray: "3 3", stroke: Q }),
|
|
293
|
+
/* @__PURE__ */ t(G, { ...j }),
|
|
294
|
+
/* @__PURE__ */ t(V, { ...et }),
|
|
295
|
+
!e && /* @__PURE__ */ t(J, { wrapperStyle: R, height: B }),
|
|
296
|
+
n.map((p, v) => /* @__PURE__ */ t(lt, { dataKey: p, fill: w[v % w.length], radius: [2, 2, 0, 0], isAnimationActive: !1, children: e && l.map((W, C) => /* @__PURE__ */ t(nt, { fill: w[C % w.length] }, C)) }, p)),
|
|
297
|
+
/* @__PURE__ */ t(O, { wrapperStyle: F.wrapperStyle, content: /* @__PURE__ */ t(X, {}), cursor: { fill: "rgba(94, 136, 176, 0.06)", stroke: "rgba(52, 58, 64, 0.18)", strokeDasharray: "3 3" }, isAnimationActive: !1, animationDuration: 0 })
|
|
298
|
+
] }) });
|
|
299
|
+
case "horizontal_bar":
|
|
300
|
+
return /* @__PURE__ */ t(N, { width: "100%", height: Math.max(u ? 240 : 300, l.length * (u ? 32 : 40)), children: /* @__PURE__ */ y(st, { data: l, layout: "vertical", margin: { top: 5, right: 30, left: 100, bottom: 5 }, children: [
|
|
301
|
+
/* @__PURE__ */ t(q, { strokeDasharray: "3 3", stroke: Q }),
|
|
302
|
+
/* @__PURE__ */ t(
|
|
303
|
+
G,
|
|
304
|
+
{
|
|
305
|
+
type: "number",
|
|
306
|
+
tick: ot,
|
|
307
|
+
axisLine: I,
|
|
308
|
+
tickLine: I,
|
|
309
|
+
...a ? { label: { value: a, position: "insideBottom", offset: -5, style: { textAnchor: "middle", fill: "var(--text-muted, #666)" } } } : {}
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
/* @__PURE__ */ t(V, { type: "category", dataKey: "x", tick: { fill: "var(--text-muted, #666)", fontSize: 11 }, width: 90, axisLine: I, tickLine: I }),
|
|
313
|
+
!e && /* @__PURE__ */ t(J, { wrapperStyle: R, height: B }),
|
|
314
|
+
n.map((p, v) => /* @__PURE__ */ t(lt, { dataKey: p, fill: w[v % w.length], radius: [0, 2, 2, 0], isAnimationActive: !1, children: e && l.map((W, C) => /* @__PURE__ */ t(nt, { fill: w[C % w.length] }, C)) }, p)),
|
|
315
|
+
/* @__PURE__ */ t(O, { wrapperStyle: F.wrapperStyle, content: /* @__PURE__ */ t(X, {}), cursor: { fill: "rgba(94, 136, 176, 0.06)", stroke: "rgba(52, 58, 64, 0.18)", strokeDasharray: "3 3" }, isAnimationActive: !1, animationDuration: 0 })
|
|
316
|
+
] }) });
|
|
317
|
+
case "line":
|
|
318
|
+
return /* @__PURE__ */ t(N, { width: "100%", height: D, children: /* @__PURE__ */ y(bt, { data: l, margin: { top: 5, right: 30, left: a ? 10 : 20, bottom: S }, children: [
|
|
319
|
+
/* @__PURE__ */ t(q, { strokeDasharray: "3 3", stroke: Q }),
|
|
320
|
+
/* @__PURE__ */ t(G, { ...j }),
|
|
321
|
+
/* @__PURE__ */ t(V, { ...et }),
|
|
322
|
+
/* @__PURE__ */ t(J, { wrapperStyle: R, height: B }),
|
|
323
|
+
n.map((p, v) => /* @__PURE__ */ t(
|
|
324
|
+
yt,
|
|
325
|
+
{
|
|
326
|
+
type: "monotone",
|
|
327
|
+
dataKey: p,
|
|
328
|
+
stroke: w[v % w.length],
|
|
329
|
+
strokeWidth: 2,
|
|
330
|
+
dot: { r: 4, fill: w[v % w.length] },
|
|
331
|
+
activeDot: { r: 6, fill: w[v % w.length] },
|
|
332
|
+
isAnimationActive: !1
|
|
333
|
+
},
|
|
334
|
+
p
|
|
335
|
+
)),
|
|
336
|
+
/* @__PURE__ */ t(O, { wrapperStyle: F.wrapperStyle, content: /* @__PURE__ */ t(X, {}), cursor: { fill: "rgba(94, 136, 176, 0.06)", stroke: "rgba(52, 58, 64, 0.18)", strokeDasharray: "3 3" }, isAnimationActive: !1, animationDuration: 0 })
|
|
337
|
+
] }) });
|
|
338
|
+
case "area":
|
|
339
|
+
return /* @__PURE__ */ t(N, { width: "100%", height: D, children: /* @__PURE__ */ y(ft, { data: l, margin: { top: 5, right: 30, left: a ? 10 : 20, bottom: S }, children: [
|
|
340
|
+
/* @__PURE__ */ t(q, { strokeDasharray: "3 3", stroke: Q }),
|
|
341
|
+
/* @__PURE__ */ t(G, { ...j }),
|
|
342
|
+
/* @__PURE__ */ t(V, { ...et }),
|
|
343
|
+
/* @__PURE__ */ t(J, { wrapperStyle: R, height: B }),
|
|
344
|
+
n.map((p, v) => /* @__PURE__ */ t(
|
|
345
|
+
xt,
|
|
346
|
+
{
|
|
347
|
+
type: "monotone",
|
|
348
|
+
dataKey: p,
|
|
349
|
+
stroke: w[v % w.length],
|
|
350
|
+
strokeWidth: 2,
|
|
351
|
+
fill: w[v % w.length],
|
|
352
|
+
fillOpacity: 0.15,
|
|
353
|
+
isAnimationActive: !1
|
|
354
|
+
},
|
|
355
|
+
p
|
|
356
|
+
)),
|
|
357
|
+
/* @__PURE__ */ t(O, { wrapperStyle: F.wrapperStyle, content: /* @__PURE__ */ t(X, {}), cursor: { fill: "rgba(94, 136, 176, 0.06)", stroke: "rgba(52, 58, 64, 0.18)", strokeDasharray: "3 3" }, isAnimationActive: !1, animationDuration: 0 })
|
|
358
|
+
] }) });
|
|
359
|
+
case "pie": {
|
|
360
|
+
const p = i[0].data.map((C, M) => ({
|
|
361
|
+
name: C.x,
|
|
362
|
+
value: C.y,
|
|
363
|
+
fill: w[M % w.length]
|
|
364
|
+
})), v = Math.PI / 180;
|
|
365
|
+
return /* @__PURE__ */ t(N, { width: "100%", height: u ? 260 : 320, children: /* @__PURE__ */ y(ut, { margin: { top: 16, right: 16, bottom: 16, left: 16 }, children: [
|
|
366
|
+
/* @__PURE__ */ t(
|
|
367
|
+
mt,
|
|
368
|
+
{
|
|
369
|
+
data: p,
|
|
370
|
+
cx: u ? "42%" : "38%",
|
|
371
|
+
cy: "50%",
|
|
372
|
+
outerRadius: u ? 88 : 110,
|
|
373
|
+
dataKey: "value",
|
|
374
|
+
label: ({ cx: C, cy: M, midAngle: E, innerRadius: P, outerRadius: rt, percent: H, name: _ }) => {
|
|
375
|
+
const U = rt + 20, K = C + U * Math.cos(-E * v), Y = M + U * Math.sin(-E * v);
|
|
376
|
+
return H < 0.04 ? null : /* @__PURE__ */ y(
|
|
377
|
+
"text",
|
|
378
|
+
{
|
|
379
|
+
x: K,
|
|
380
|
+
y: Y,
|
|
381
|
+
fill: "var(--text-ink, #1e2125)",
|
|
382
|
+
fontSize: 11,
|
|
383
|
+
textAnchor: K > C ? "start" : "end",
|
|
384
|
+
dominantBaseline: "central",
|
|
385
|
+
children: [
|
|
386
|
+
_,
|
|
387
|
+
" (",
|
|
388
|
+
(H * 100).toFixed(0),
|
|
389
|
+
"%)"
|
|
390
|
+
]
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
},
|
|
394
|
+
labelLine: { stroke: "var(--text-muted, #666)" },
|
|
395
|
+
isAnimationActive: !1,
|
|
396
|
+
children: p.map((C, M) => /* @__PURE__ */ t(nt, { fill: C.fill }, M))
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ t(O, { wrapperStyle: F.wrapperStyle, content: /* @__PURE__ */ t(X, {}), cursor: { fill: "rgba(94, 136, 176, 0.06)", stroke: "rgba(52, 58, 64, 0.18)", strokeDasharray: "3 3" }, isAnimationActive: !1, animationDuration: 0 })
|
|
400
|
+
] }) });
|
|
401
|
+
}
|
|
402
|
+
case "metric": {
|
|
403
|
+
const p = i[0], v = p.data[0], W = p.data.length > 1 ? p.data[1] : null, C = v.y, M = v.x || "", E = W !== null, P = E ? C - W.y : 0, rt = E && W.y !== 0 ? P / Math.abs(W.y) * 100 : 0, H = P > 0, _ = P < 0, U = H ? "#7BA89D" : _ ? "#D17B6B" : "var(--text-muted, #666)", K = H ? "↑" : _ ? "↓" : "→", Y = ($) => Number.isInteger($) && Math.abs($) >= 1e3 ? $.toLocaleString() : typeof $ == "number" ? $ % 1 === 0 ? $.toString() : $.toFixed($ < 10 ? 2 : 1) : String($);
|
|
404
|
+
return /* @__PURE__ */ y("div", { style: { display: "flex", alignItems: "baseline", gap: 12, padding: "8px 0" }, children: [
|
|
405
|
+
/* @__PURE__ */ t("div", { style: {
|
|
406
|
+
fontSize: "36px",
|
|
407
|
+
fontWeight: 700,
|
|
408
|
+
lineHeight: 1,
|
|
409
|
+
color: "var(--text-strong, #1e2125)",
|
|
410
|
+
fontVariantNumeric: "tabular-nums"
|
|
411
|
+
}, children: Y(C) }),
|
|
412
|
+
M && /* @__PURE__ */ t("div", { style: { fontSize: "14px", color: "var(--text-muted, #666)", fontWeight: 500 }, children: M }),
|
|
413
|
+
E && /* @__PURE__ */ y("div", { style: {
|
|
414
|
+
display: "flex",
|
|
415
|
+
alignItems: "center",
|
|
416
|
+
gap: 4,
|
|
417
|
+
fontSize: "13px",
|
|
418
|
+
fontWeight: 600,
|
|
419
|
+
color: U,
|
|
420
|
+
background: H ? "rgba(123,168,157,0.12)" : _ ? "rgba(209,123,107,0.12)" : "rgba(128,128,128,0.08)",
|
|
421
|
+
padding: "3px 8px",
|
|
422
|
+
borderRadius: "var(--radius-sm, 4px)"
|
|
423
|
+
}, children: [
|
|
424
|
+
/* @__PURE__ */ t("span", { children: K }),
|
|
425
|
+
/* @__PURE__ */ y("span", { children: [
|
|
426
|
+
Y(Math.abs(P)),
|
|
427
|
+
" (",
|
|
428
|
+
Math.abs(rt).toFixed(1),
|
|
429
|
+
"%)"
|
|
430
|
+
] })
|
|
431
|
+
] }),
|
|
432
|
+
E && /* @__PURE__ */ y("div", { style: { fontSize: "11px", color: "var(--text-faint, #999)" }, children: [
|
|
433
|
+
"vs ",
|
|
434
|
+
W.x || "previous"
|
|
435
|
+
] })
|
|
436
|
+
] });
|
|
437
|
+
}
|
|
438
|
+
default:
|
|
439
|
+
return /* @__PURE__ */ y("div", { style: { color: "var(--text-muted)", fontSize: 12, padding: 8 }, children: [
|
|
440
|
+
"Unsupported chart type: ",
|
|
441
|
+
d
|
|
442
|
+
] });
|
|
443
|
+
}
|
|
444
|
+
}, it = d === "line" || d === "area" || (d === "bar" || d === "horizontal_bar") && !e ? n.map((p, v) => ({ label: p, color: w[v % w.length] })) : [], dt = at(() => {
|
|
445
|
+
h.current && zt(h.current, c, it);
|
|
446
|
+
}, [c, it]), ht = at(() => {
|
|
447
|
+
Wt(i, o), x(!0), setTimeout(() => x(!1), 2e3);
|
|
448
|
+
}, [i, o]);
|
|
449
|
+
return /* @__PURE__ */ y("div", { style: z, children: [
|
|
450
|
+
c && /* @__PURE__ */ t("div", { style: tt, children: c }),
|
|
451
|
+
d !== "metric" && /* @__PURE__ */ t(Dt, { onDownloadPng: dt, onCopy: ht, copied: k }),
|
|
452
|
+
/* @__PURE__ */ t("div", { ref: h, children: ct() })
|
|
453
|
+
] });
|
|
454
|
+
}, Mt = ({ content: d, onCodeBlockClick: c, onFilePathClick: g }) => {
|
|
455
|
+
const [a, i] = gt(/* @__PURE__ */ new Set()), u = async (l, n) => {
|
|
456
|
+
try {
|
|
457
|
+
await navigator.clipboard.writeText(l), i((e) => /* @__PURE__ */ new Set([...e, n])), setTimeout(() => {
|
|
458
|
+
i((e) => {
|
|
459
|
+
const r = new Set(e);
|
|
460
|
+
return r.delete(n), r;
|
|
461
|
+
});
|
|
462
|
+
}, 2e3);
|
|
463
|
+
} catch (e) {
|
|
464
|
+
console.error("Failed to copy text:", e);
|
|
465
|
+
}
|
|
466
|
+
}, h = (l, n, e) => {
|
|
467
|
+
const r = a.has(e);
|
|
468
|
+
return /* @__PURE__ */ y(
|
|
469
|
+
"div",
|
|
470
|
+
{
|
|
471
|
+
style: {
|
|
472
|
+
position: "relative",
|
|
473
|
+
marginBottom: "16px",
|
|
474
|
+
borderRadius: "8px",
|
|
475
|
+
background: "var(--ink, #1E2125)",
|
|
476
|
+
border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
|
|
477
|
+
overflow: "hidden"
|
|
478
|
+
},
|
|
479
|
+
children: [
|
|
480
|
+
/* @__PURE__ */ y("div", { style: {
|
|
481
|
+
display: "flex",
|
|
482
|
+
justifyContent: "space-between",
|
|
483
|
+
alignItems: "center",
|
|
484
|
+
padding: "8px 12px",
|
|
485
|
+
background: "rgba(255,255,255,0.05)",
|
|
486
|
+
borderBottom: "1px solid rgba(255,255,255,0.1)"
|
|
487
|
+
}, children: [
|
|
488
|
+
/* @__PURE__ */ t("span", { style: {
|
|
489
|
+
fontSize: "11px",
|
|
490
|
+
color: "rgba(255,255,255,0.7)",
|
|
491
|
+
fontFamily: "var(--font-mono, monospace)",
|
|
492
|
+
textTransform: "uppercase",
|
|
493
|
+
letterSpacing: "0.05em"
|
|
494
|
+
}, children: n || "code" }),
|
|
495
|
+
/* @__PURE__ */ y(
|
|
496
|
+
"button",
|
|
497
|
+
{
|
|
498
|
+
onClick: () => u(l, e),
|
|
499
|
+
style: {
|
|
500
|
+
background: "none",
|
|
501
|
+
border: "none",
|
|
502
|
+
color: "rgba(255,255,255,0.7)",
|
|
503
|
+
cursor: "pointer",
|
|
504
|
+
padding: "4px",
|
|
505
|
+
borderRadius: "4px",
|
|
506
|
+
display: "flex",
|
|
507
|
+
alignItems: "center",
|
|
508
|
+
gap: "4px",
|
|
509
|
+
fontSize: "11px",
|
|
510
|
+
transition: "all 0.15s ease"
|
|
511
|
+
},
|
|
512
|
+
onMouseEnter: (b) => {
|
|
513
|
+
b.target.style.background = "rgba(255,255,255,0.1)", b.target.style.color = "rgba(255,255,255,0.9)";
|
|
514
|
+
},
|
|
515
|
+
onMouseLeave: (b) => {
|
|
516
|
+
b.target.style.background = "none", b.target.style.color = "rgba(255,255,255,0.7)";
|
|
517
|
+
},
|
|
518
|
+
children: [
|
|
519
|
+
r ? /* @__PURE__ */ t(wt, { size: 12 }) : /* @__PURE__ */ t(St, { size: 12 }),
|
|
520
|
+
r ? "Copied!" : "Copy"
|
|
521
|
+
]
|
|
522
|
+
}
|
|
523
|
+
),
|
|
524
|
+
c && /* @__PURE__ */ y(
|
|
525
|
+
"button",
|
|
526
|
+
{
|
|
527
|
+
onClick: () => c({ code: l, language: n }),
|
|
528
|
+
style: {
|
|
529
|
+
background: "none",
|
|
530
|
+
border: "none",
|
|
531
|
+
color: "rgba(255,255,255,0.7)",
|
|
532
|
+
cursor: "pointer",
|
|
533
|
+
padding: "4px",
|
|
534
|
+
borderRadius: "4px",
|
|
535
|
+
display: "flex",
|
|
536
|
+
alignItems: "center",
|
|
537
|
+
gap: "4px",
|
|
538
|
+
fontSize: "11px",
|
|
539
|
+
transition: "all 0.15s ease"
|
|
540
|
+
},
|
|
541
|
+
onMouseEnter: (b) => {
|
|
542
|
+
b.currentTarget.style.background = "rgba(255,255,255,0.1)", b.currentTarget.style.color = "rgba(255,255,255,0.9)";
|
|
543
|
+
},
|
|
544
|
+
onMouseLeave: (b) => {
|
|
545
|
+
b.currentTarget.style.background = "none", b.currentTarget.style.color = "rgba(255,255,255,0.7)";
|
|
546
|
+
},
|
|
547
|
+
children: [
|
|
548
|
+
/* @__PURE__ */ t(kt, { size: 12 }),
|
|
549
|
+
"Canvas"
|
|
550
|
+
]
|
|
551
|
+
}
|
|
552
|
+
)
|
|
553
|
+
] }),
|
|
554
|
+
/* @__PURE__ */ t("pre", { style: {
|
|
555
|
+
margin: 0,
|
|
556
|
+
padding: "12px",
|
|
557
|
+
fontFamily: "var(--font-mono, monospace)",
|
|
558
|
+
fontSize: "13px",
|
|
559
|
+
lineHeight: 1.4,
|
|
560
|
+
color: "rgba(255,255,255,0.95)",
|
|
561
|
+
overflow: "auto",
|
|
562
|
+
whiteSpace: "pre-wrap",
|
|
563
|
+
wordBreak: "break-word"
|
|
564
|
+
}, children: l })
|
|
565
|
+
]
|
|
566
|
+
},
|
|
567
|
+
e
|
|
568
|
+
);
|
|
569
|
+
}, k = (l) => {
|
|
570
|
+
const n = [], e = l.split(`
|
|
571
|
+
`);
|
|
572
|
+
let r = 0, b = 0;
|
|
573
|
+
for (; r < e.length; ) {
|
|
574
|
+
const f = e[r];
|
|
575
|
+
if (f.trim().startsWith("```")) {
|
|
576
|
+
const s = f.trim().slice(3);
|
|
577
|
+
let m = [];
|
|
578
|
+
for (r++; r < e.length && !e[r].trim().startsWith("```"); )
|
|
579
|
+
m.push(e[r]), r++;
|
|
580
|
+
r < e.length && r++, n.push(h(m.join(`
|
|
581
|
+
`), s, `code-${b++}`));
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
584
|
+
if (f.startsWith("#")) {
|
|
585
|
+
const s = f.match(/^#+/)[0].length, m = f.slice(s).trim(), S = s === 1 ? "h2" : s === 2 ? "h3" : s === 3 ? "h4" : "h5";
|
|
586
|
+
n.push(
|
|
587
|
+
Z.createElement(S, {
|
|
588
|
+
key: `header-${r}`,
|
|
589
|
+
style: {
|
|
590
|
+
fontSize: s === 1 ? "18px" : s === 2 ? "16px" : "14px",
|
|
591
|
+
fontWeight: 720,
|
|
592
|
+
color: "var(--text-strong, rgba(30,33,37,0.92))",
|
|
593
|
+
marginTop: n.length > 0 ? "20px" : "0",
|
|
594
|
+
marginBottom: "8px",
|
|
595
|
+
lineHeight: 1.3
|
|
596
|
+
}
|
|
597
|
+
}, m)
|
|
598
|
+
), r++;
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
if (f.trim() === "---" || f.trim() === "***") {
|
|
602
|
+
n.push(
|
|
603
|
+
/* @__PURE__ */ t("hr", { style: {
|
|
604
|
+
border: "none",
|
|
605
|
+
borderTop: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
|
|
606
|
+
margin: "16px 0"
|
|
607
|
+
} }, `hr-${r}`)
|
|
608
|
+
), r++;
|
|
609
|
+
continue;
|
|
610
|
+
}
|
|
611
|
+
if (f.match(/^(\s*)([-*+]|\d+\.)\s/)) {
|
|
612
|
+
const s = [], m = /^\s*\d+\./.test(f);
|
|
613
|
+
for (; r < e.length && (e[r].match(/^(\s*)([-*+]|\d+\.)\s/) || e[r].trim() === ""); ) {
|
|
614
|
+
if (e[r].trim() !== "") {
|
|
615
|
+
const A = e[r].match(/^(\s*)([-*+]|\d+\.)\s(.*)$/);
|
|
616
|
+
A && s.push(A[3]);
|
|
617
|
+
}
|
|
618
|
+
r++;
|
|
619
|
+
}
|
|
620
|
+
const S = m ? "ol" : "ul";
|
|
621
|
+
n.push(
|
|
622
|
+
Z.createElement(S, {
|
|
623
|
+
key: `list-${r}`,
|
|
624
|
+
style: {
|
|
625
|
+
margin: "8px 0",
|
|
626
|
+
paddingLeft: "20px",
|
|
627
|
+
color: "var(--text-strong, rgba(30,33,37,0.92))"
|
|
628
|
+
}
|
|
629
|
+
}, s.map(
|
|
630
|
+
(A, B) => Z.createElement("li", {
|
|
631
|
+
key: `item-${B}`,
|
|
632
|
+
style: { marginBottom: "4px" }
|
|
633
|
+
}, o(A))
|
|
634
|
+
))
|
|
635
|
+
);
|
|
636
|
+
continue;
|
|
637
|
+
}
|
|
638
|
+
if (f.trim().startsWith("|") && f.trim().endsWith("|")) {
|
|
639
|
+
const s = [];
|
|
640
|
+
for (; r < e.length && e[r].trim().startsWith("|") && e[r].trim().endsWith("|"); )
|
|
641
|
+
s.push(e[r]), r++;
|
|
642
|
+
if (s.length >= 2) {
|
|
643
|
+
const m = (R) => R.trim().slice(1, -1).split("|").map((z) => z.trim()), S = m(s[0]), A = (R) => m(R).every((z) => /^[-:]+$/.test(z)), B = s.length >= 2 && A(s[1]), L = B ? 2 : 1, D = B ? m(s[1]).map((R) => R.startsWith(":") && R.endsWith(":") ? "center" : R.endsWith(":") ? "right" : "left") : S.map(() => "left"), T = {
|
|
644
|
+
padding: "6px 12px",
|
|
645
|
+
borderBottom: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
|
|
646
|
+
fontSize: "13px",
|
|
647
|
+
lineHeight: 1.5,
|
|
648
|
+
color: "var(--text-strong, rgba(30,33,37,0.92))",
|
|
649
|
+
// Override the chat bubble's inherited `word-break: break-word`
|
|
650
|
+
// so cells size to natural min-content; the wrapper's
|
|
651
|
+
// overflow-x: auto handles wide tables via horizontal scroll
|
|
652
|
+
// instead of collapsing columns char-by-char on long URLs.
|
|
653
|
+
wordBreak: "normal",
|
|
654
|
+
overflowWrap: "normal"
|
|
655
|
+
};
|
|
656
|
+
n.push(
|
|
657
|
+
/* @__PURE__ */ t("div", { style: { overflowX: "auto", margin: "8px 0" }, children: /* @__PURE__ */ y("table", { style: {
|
|
658
|
+
borderCollapse: "collapse",
|
|
659
|
+
width: "100%",
|
|
660
|
+
border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
|
|
661
|
+
borderRadius: "6px",
|
|
662
|
+
overflow: "hidden"
|
|
663
|
+
}, children: [
|
|
664
|
+
B && /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { style: { background: "var(--hover-warm-subtle, rgba(231,212,162,0.08))" }, children: S.map((R, z) => /* @__PURE__ */ t("th", { style: { ...T, fontWeight: 660, textAlign: D[z] || "left", whiteSpace: "nowrap" }, children: o(R) }, z)) }) }),
|
|
665
|
+
/* @__PURE__ */ t("tbody", { children: (B ? s.slice(L) : s).map((R, z) => /* @__PURE__ */ t("tr", { style: { background: z % 2 === 1 ? "var(--hover-warm-subtle, rgba(231,212,162,0.04))" : "transparent" }, children: m(R).map((tt, j) => /* @__PURE__ */ t("td", { style: { ...T, textAlign: D[j] || "left" }, children: o(tt) }, j)) }, z)) })
|
|
666
|
+
] }) }, `table-${r}`)
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
if (f.trim()) {
|
|
672
|
+
const s = [];
|
|
673
|
+
for (; r < e.length && e[r].trim() && !e[r].match(/^(#|```|---|\*\*\*|(\s*)([-*+]|\d+\.)\s)/) && !(e[r].trim().startsWith("|") && e[r].trim().endsWith("|")); )
|
|
674
|
+
s.push(e[r]), r++;
|
|
675
|
+
s.length > 0 && n.push(
|
|
676
|
+
/* @__PURE__ */ t("p", { style: {
|
|
677
|
+
margin: "8px 0",
|
|
678
|
+
lineHeight: 1.6,
|
|
679
|
+
color: "var(--text-strong, rgba(30,33,37,0.92))"
|
|
680
|
+
}, children: o(s.join(" ")) }, `p-${r}`)
|
|
681
|
+
);
|
|
682
|
+
} else
|
|
683
|
+
r++;
|
|
684
|
+
}
|
|
685
|
+
return n;
|
|
686
|
+
}, x = (l) => {
|
|
687
|
+
const n = [];
|
|
688
|
+
let e = l, r = 0;
|
|
689
|
+
for (; e.length > 0; ) {
|
|
690
|
+
if (g) {
|
|
691
|
+
const A = e.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|$))/);
|
|
692
|
+
if (A) {
|
|
693
|
+
const B = A[1];
|
|
694
|
+
n.push(
|
|
695
|
+
/* @__PURE__ */ t(
|
|
696
|
+
"span",
|
|
697
|
+
{
|
|
698
|
+
onClick: () => g(B),
|
|
699
|
+
style: {
|
|
700
|
+
color: "var(--rail-discovery, #5E88B0)",
|
|
701
|
+
textDecoration: "underline",
|
|
702
|
+
textDecorationStyle: "dotted",
|
|
703
|
+
textUnderlineOffset: "2px",
|
|
704
|
+
cursor: "pointer",
|
|
705
|
+
fontFamily: "var(--font-mono, monospace)",
|
|
706
|
+
fontSize: "13px",
|
|
707
|
+
transition: "all 0.15s ease",
|
|
708
|
+
":hover": {
|
|
709
|
+
background: "var(--hover-warm-subtle, rgba(231,212,162,0.08))",
|
|
710
|
+
textDecoration: "underline",
|
|
711
|
+
textDecorationStyle: "solid"
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
onMouseEnter: (L) => {
|
|
715
|
+
L.target.style.background = "var(--hover-warm-subtle, rgba(231,212,162,0.08))", L.target.style.textDecorationStyle = "solid";
|
|
716
|
+
},
|
|
717
|
+
onMouseLeave: (L) => {
|
|
718
|
+
L.target.style.background = "none", L.target.style.textDecorationStyle = "dotted";
|
|
719
|
+
},
|
|
720
|
+
children: B
|
|
721
|
+
},
|
|
722
|
+
`file-path-${r++}`
|
|
723
|
+
)
|
|
724
|
+
), e = e.slice(A[0].length);
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
const b = e.match(/^`([^`]+)`/);
|
|
729
|
+
if (b) {
|
|
730
|
+
n.push(
|
|
731
|
+
/* @__PURE__ */ t("code", { style: {
|
|
732
|
+
background: "var(--hover-warm-subtle, rgba(231,212,162,0.08))",
|
|
733
|
+
border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
|
|
734
|
+
borderRadius: "3px",
|
|
735
|
+
padding: "2px 4px",
|
|
736
|
+
fontFamily: "var(--font-mono, monospace)",
|
|
737
|
+
fontSize: "12px",
|
|
738
|
+
color: "var(--text-strong, rgba(30,33,37,0.92))"
|
|
739
|
+
}, children: b[1] }, `inline-code-${r++}`)
|
|
740
|
+
), e = e.slice(b[0].length);
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
const f = e.match(/^\*\*([^*]+)\*\*/);
|
|
744
|
+
if (f) {
|
|
745
|
+
n.push(
|
|
746
|
+
/* @__PURE__ */ t("strong", { style: {
|
|
747
|
+
fontWeight: 720,
|
|
748
|
+
color: "var(--text-strong, rgba(30,33,37,0.92))"
|
|
749
|
+
}, children: f[1] }, `bold-${r++}`)
|
|
750
|
+
), e = e.slice(f[0].length);
|
|
751
|
+
continue;
|
|
752
|
+
}
|
|
753
|
+
const s = e.match(/^\*([^*]+)\*/);
|
|
754
|
+
if (s) {
|
|
755
|
+
n.push(
|
|
756
|
+
/* @__PURE__ */ t("em", { style: {
|
|
757
|
+
fontStyle: "italic",
|
|
758
|
+
color: "var(--text-strong, rgba(30,33,37,0.92))"
|
|
759
|
+
}, children: s[1] }, `italic-${r++}`)
|
|
760
|
+
), e = e.slice(s[0].length);
|
|
761
|
+
continue;
|
|
762
|
+
}
|
|
763
|
+
const m = e.match(/^\[([^\]]+)\]\(([^)]+)\)/);
|
|
764
|
+
if (m) {
|
|
765
|
+
const A = m[1], B = m[2], L = A === "View", D = {
|
|
766
|
+
display: "inline-flex",
|
|
767
|
+
alignItems: "center",
|
|
768
|
+
padding: "3px 10px",
|
|
769
|
+
background: "var(--rail-discovery, #5E88B0)",
|
|
770
|
+
color: "#fff",
|
|
771
|
+
textDecoration: "none",
|
|
772
|
+
borderRadius: "4px",
|
|
773
|
+
fontSize: "12px",
|
|
774
|
+
fontWeight: 600,
|
|
775
|
+
whiteSpace: "nowrap",
|
|
776
|
+
cursor: "pointer"
|
|
777
|
+
}, T = {
|
|
778
|
+
color: "var(--rail-discovery, #5E88B0)",
|
|
779
|
+
textDecoration: "underline",
|
|
780
|
+
textUnderlineOffset: "2px"
|
|
781
|
+
};
|
|
782
|
+
n.push(
|
|
783
|
+
/* @__PURE__ */ t(
|
|
784
|
+
"a",
|
|
785
|
+
{
|
|
786
|
+
href: B,
|
|
787
|
+
target: "_blank",
|
|
788
|
+
rel: "noopener noreferrer",
|
|
789
|
+
style: L ? D : T,
|
|
790
|
+
children: A
|
|
791
|
+
},
|
|
792
|
+
`link-${r++}`
|
|
793
|
+
)
|
|
794
|
+
), e = e.slice(m[0].length);
|
|
795
|
+
continue;
|
|
796
|
+
}
|
|
797
|
+
const S = e.search(/[`*\[]/);
|
|
798
|
+
if (S === -1) {
|
|
799
|
+
n.push(e);
|
|
800
|
+
break;
|
|
801
|
+
} else
|
|
802
|
+
S === 0 ? (n.push(e[0]), e = e.slice(1)) : (n.push(e.slice(0, S)), e = e.slice(S));
|
|
803
|
+
}
|
|
804
|
+
return n.length === 1 && typeof n[0] == "string" ? n[0] : n;
|
|
805
|
+
}, o = (l) => x(l);
|
|
806
|
+
return /* @__PURE__ */ t("div", { children: k(d) });
|
|
807
|
+
};
|
|
808
|
+
function _t({
|
|
809
|
+
role: d,
|
|
810
|
+
content: c,
|
|
811
|
+
html: g,
|
|
812
|
+
timestamp: a,
|
|
813
|
+
toolBadges: i,
|
|
814
|
+
isStreaming: u,
|
|
815
|
+
onCodeBlockClick: h,
|
|
816
|
+
onFilePathClick: k
|
|
817
|
+
}) {
|
|
818
|
+
const x = d === "user";
|
|
819
|
+
return /* @__PURE__ */ y(
|
|
820
|
+
"div",
|
|
821
|
+
{
|
|
822
|
+
style: {
|
|
823
|
+
display: "flex",
|
|
824
|
+
flexDirection: "column",
|
|
825
|
+
alignItems: x ? "flex-end" : "flex-start",
|
|
826
|
+
marginBottom: "16px",
|
|
827
|
+
maxWidth: "100%"
|
|
828
|
+
},
|
|
829
|
+
children: [
|
|
830
|
+
/* @__PURE__ */ y(
|
|
831
|
+
"div",
|
|
832
|
+
{
|
|
833
|
+
style: {
|
|
834
|
+
fontSize: "var(--text-sm, 11px)",
|
|
835
|
+
color: "var(--text-faint, rgba(30,33,37,0.36))",
|
|
836
|
+
marginBottom: "6px",
|
|
837
|
+
fontWeight: 650,
|
|
838
|
+
letterSpacing: "0.02em"
|
|
839
|
+
},
|
|
840
|
+
children: [
|
|
841
|
+
x ? "You" : "Chordia",
|
|
842
|
+
u && !x && /* @__PURE__ */ t("span", { style: { marginLeft: "6px", color: "var(--rail-purple, #9B7AA8)" }, children: "●" })
|
|
843
|
+
]
|
|
844
|
+
}
|
|
845
|
+
),
|
|
846
|
+
i && i.length > 0 && /* @__PURE__ */ t("div", { style: {
|
|
847
|
+
marginBottom: "8px",
|
|
848
|
+
display: "flex",
|
|
849
|
+
flexWrap: "wrap",
|
|
850
|
+
gap: "4px",
|
|
851
|
+
maxWidth: "75%"
|
|
852
|
+
}, children: i.map((o, l) => /* @__PURE__ */ y(
|
|
853
|
+
"span",
|
|
854
|
+
{
|
|
855
|
+
style: {
|
|
856
|
+
display: "inline-block",
|
|
857
|
+
fontSize: "11px",
|
|
858
|
+
padding: "2px 8px",
|
|
859
|
+
borderRadius: "6px",
|
|
860
|
+
background: "var(--paper-elevated, rgba(255,255,255,0.82))",
|
|
861
|
+
border: `1px solid ${o.pending ? "var(--rail-discovery, #5A8CC0)" : o.success !== !1 ? "var(--state-present, #5CB85C)" : "var(--rail-signal-churn, #C98A5A)"}`,
|
|
862
|
+
color: o.pending ? "var(--rail-discovery, #5A8CC0)" : o.success !== !1 ? "var(--state-present, #5CB85C)" : "var(--rail-signal-churn, #C98A5A)"
|
|
863
|
+
},
|
|
864
|
+
children: [
|
|
865
|
+
/* @__PURE__ */ t(vt, { size: 10, style: { marginRight: 3, verticalAlign: "middle" } }),
|
|
866
|
+
o.name,
|
|
867
|
+
o.pending ? "..." : o.success !== !1 ? " ✓" : " ✗"
|
|
868
|
+
]
|
|
869
|
+
},
|
|
870
|
+
o.id || l
|
|
871
|
+
)) }),
|
|
872
|
+
/* @__PURE__ */ t(
|
|
873
|
+
"div",
|
|
874
|
+
{
|
|
875
|
+
style: {
|
|
876
|
+
maxWidth: "75%",
|
|
877
|
+
padding: "12px 16px",
|
|
878
|
+
borderRadius: "var(--radius-lg, 12px)",
|
|
879
|
+
background: x ? "var(--card-customer, rgba(94,136,176,0.08))" : "var(--paper-elevated, rgba(255,255,255,0.82))",
|
|
880
|
+
border: x ? "1px solid var(--border-subtle, rgba(52,58,64,0.08))" : "1px solid var(--border, rgba(52,58,64,0.12))",
|
|
881
|
+
fontSize: "var(--text-base, 14px)",
|
|
882
|
+
lineHeight: 1.6,
|
|
883
|
+
color: "var(--text-strong, rgba(30,33,37,0.92))",
|
|
884
|
+
wordBreak: "break-word"
|
|
885
|
+
},
|
|
886
|
+
children: g ? /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: g } }) : x ? (
|
|
887
|
+
// User messages stay plain text
|
|
888
|
+
/* @__PURE__ */ t("div", { style: { whiteSpace: "pre-wrap" }, children: c })
|
|
889
|
+
) : (
|
|
890
|
+
// Assistant messages get markdown rendering
|
|
891
|
+
/* @__PURE__ */ t(Mt, { content: c || "", onCodeBlockClick: h, onFilePathClick: k })
|
|
892
|
+
)
|
|
893
|
+
}
|
|
894
|
+
),
|
|
895
|
+
a && /* @__PURE__ */ t(
|
|
896
|
+
"div",
|
|
897
|
+
{
|
|
898
|
+
style: {
|
|
899
|
+
fontSize: "var(--text-xs-plus, 10.5px)",
|
|
900
|
+
color: "var(--text-faint, rgba(30,33,37,0.36))",
|
|
901
|
+
marginTop: "4px",
|
|
902
|
+
fontFamily: "var(--font-mono, monospace)"
|
|
903
|
+
},
|
|
904
|
+
children: a
|
|
905
|
+
}
|
|
906
|
+
)
|
|
907
|
+
]
|
|
908
|
+
}
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
export {
|
|
912
|
+
_t as C,
|
|
913
|
+
Pt as a
|
|
914
|
+
};
|
|
915
|
+
//# sourceMappingURL=ChatMessage.es.js.map
|