@syncagent/react 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -34,6 +34,7 @@ function useSyncAgent(options = {}) {
34
34
  const [messages, setMessages] = useState([]);
35
35
  const [isLoading, setIsLoading] = useState(false);
36
36
  const [error, setError] = useState(null);
37
+ const [status, setStatus] = useState(null);
37
38
  const abortRef = useRef(null);
38
39
  const sendMessage = useCallback(
39
40
  async (content) => {
@@ -43,12 +44,14 @@ function useSyncAgent(options = {}) {
43
44
  setMessages(updated);
44
45
  setIsLoading(true);
45
46
  setError(null);
47
+ setStatus(null);
46
48
  const placeholder = { role: "assistant", content: "" };
47
49
  setMessages([...updated, placeholder]);
48
50
  abortRef.current = new AbortController();
49
51
  try {
50
52
  await client.chat(updated, {
51
53
  signal: abortRef.current.signal,
54
+ onStatus: (step, label) => setStatus({ step, label }),
52
55
  onToken: (token) => {
53
56
  placeholder.content += token;
54
57
  setMessages((prev) => {
@@ -58,6 +61,7 @@ function useSyncAgent(options = {}) {
58
61
  });
59
62
  },
60
63
  onComplete: (text) => {
64
+ setStatus(null);
61
65
  setMessages((prev) => {
62
66
  const next = [...prev];
63
67
  next[next.length - 1] = { role: "assistant", content: text };
@@ -76,6 +80,7 @@ function useSyncAgent(options = {}) {
76
80
  }
77
81
  } finally {
78
82
  setIsLoading(false);
83
+ setStatus(null);
79
84
  abortRef.current = null;
80
85
  }
81
86
  },
@@ -89,8 +94,9 @@ function useSyncAgent(options = {}) {
89
94
  setMessages([]);
90
95
  setError(null);
91
96
  setIsLoading(false);
97
+ setStatus(null);
92
98
  }, []);
93
- return { messages, isLoading, error, sendMessage, stop, reset };
99
+ return { messages, isLoading, error, status, sendMessage, stop, reset };
94
100
  }
95
101
 
96
102
  // src/chat.tsx
@@ -101,62 +107,107 @@ import {
101
107
  useCallback as useCallback2
102
108
  } from "react";
103
109
  import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
104
- function renderMarkdown(text) {
105
- return text.replace(/```[\w]*\n?([\s\S]*?)```/g, `<pre style="background:#1e1e2e;color:#cdd6f4;padding:12px 14px;border-radius:8px;overflow-x:auto;font-size:12px;line-height:1.6;margin:8px 0;font-family:'Fira Code','Cascadia Code',monospace">$1</pre>`).replace(/`([^`]+)`/g, '<code style="background:rgba(0,0,0,0.08);padding:2px 6px;border-radius:4px;font-size:12px;font-family:monospace">$1</code>').replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replace(/\*(.+?)\*/g, "<em>$1</em>").replace(/^### (.+)$/gm, '<div style="font-weight:700;font-size:13px;margin:10px 0 4px">$1</div>').replace(/^## (.+)$/gm, '<div style="font-weight:700;font-size:14px;margin:12px 0 4px">$1</div>').replace(/^# (.+)$/gm, '<div style="font-weight:700;font-size:15px;margin:12px 0 6px">$1</div>').replace(/\|(.+)\|\n\|[-| :]+\|\n((?:\|.+\|\n?)+)/g, (_, header, rows) => {
106
- const ths = header.split("|").filter((c) => c.trim()).map((c) => `<th style="padding:6px 10px;text-align:left;font-weight:600;border-bottom:2px solid rgba(0,0,0,0.1)">${c.trim()}</th>`).join("");
107
- const trs = rows.trim().split("\n").map((row) => {
108
- const tds = row.split("|").filter((c) => c.trim()).map((c) => `<td style="padding:6px 10px;border-bottom:1px solid rgba(0,0,0,0.06)">${c.trim()}</td>`).join("");
110
+ var GLOBAL_CSS = (accent) => `
111
+ @keyframes sa-bounce { 0%,80%,100%{transform:translateY(0);opacity:.35} 40%{transform:translateY(-5px);opacity:1} }
112
+ @keyframes sa-fadein { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
113
+ @keyframes sa-cursor { 0%,100%{opacity:1} 50%{opacity:0} }
114
+ @keyframes sa-pulse { 0%,100%{opacity:.6} 50%{opacity:1} }
115
+ .sa-msg { animation: sa-fadein .22s cubic-bezier(.16,1,.3,1) }
116
+ .sa-fab { transition: transform .2s, box-shadow .2s }
117
+ .sa-fab:hover { transform: scale(1.08) }
118
+ .sa-fab:active { transform: scale(.96) }
119
+ .sa-chip:hover { background: ${accent}22 !important; border-color: ${accent}88 !important }
120
+ .sa-send:hover:not(:disabled) { filter: brightness(1.1); transform: scale(1.05) }
121
+ .sa-send:active:not(:disabled) { transform: scale(.96) }
122
+ .sa-send:disabled { opacity: .4; cursor: not-allowed }
123
+ .sa-copy:hover { opacity: 1 !important; background: rgba(0,0,0,.06) !important }
124
+ .sa-scroll::-webkit-scrollbar { width: 4px }
125
+ .sa-scroll::-webkit-scrollbar-track { background: transparent }
126
+ .sa-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 4px }
127
+ .sa-cursor { display:inline-block; width:2px; height:1em; background:currentColor; margin-left:1px; vertical-align:text-bottom; animation: sa-cursor .7s infinite }
128
+ .sa-md table { width:100%; border-collapse:collapse; font-size:12.5px; margin:10px 0 }
129
+ .sa-md th { padding:7px 10px; text-align:left; font-weight:600; background:rgba(0,0,0,.04); border-bottom:2px solid rgba(0,0,0,.1); white-space:nowrap }
130
+ .sa-md td { padding:6px 10px; border-bottom:1px solid rgba(0,0,0,.06); vertical-align:top }
131
+ .sa-md tr:last-child td { border-bottom:none }
132
+ .sa-md tr:hover td { background:rgba(0,0,0,.02) }
133
+ .sa-md pre { background:#0f1117; color:#e2e8f0; padding:14px 16px; border-radius:10px; overflow-x:auto; font-size:12px; line-height:1.7; margin:10px 0; font-family:'Fira Code','Cascadia Code','JetBrains Mono',monospace; border:1px solid rgba(255,255,255,.06) }
134
+ .sa-md code { background:rgba(0,0,0,.07); padding:2px 6px; border-radius:4px; font-size:12px; font-family:monospace; color:#1e293b }
135
+ .sa-md pre code { background:none; padding:0; color:inherit; font-size:inherit }
136
+ .sa-md ul,.sa-md ol { margin:6px 0; padding-left:20px }
137
+ .sa-md li { margin:3px 0; line-height:1.6 }
138
+ .sa-md h1 { font-size:16px; font-weight:700; margin:14px 0 6px; color:#0f172a }
139
+ .sa-md h2 { font-size:14px; font-weight:700; margin:12px 0 5px; color:#0f172a }
140
+ .sa-md h3 { font-size:13px; font-weight:600; margin:10px 0 4px; color:#1e293b }
141
+ .sa-md p { margin:4px 0; line-height:1.65 }
142
+ .sa-md strong { font-weight:600; color:#0f172a }
143
+ .sa-md em { font-style:italic; color:#475569 }
144
+ .sa-md blockquote { border-left:3px solid rgba(0,0,0,.15); padding:4px 12px; margin:8px 0; color:#64748b; font-style:italic }
145
+ .sa-md hr { border:none; border-top:1px solid rgba(0,0,0,.1); margin:12px 0 }
146
+ .sa-md a { color:${accent}; text-decoration:underline }
147
+ @media (max-width:480px) {
148
+ .sa-panel-float { width:calc(100vw - 24px) !important; right:12px !important; left:12px !important; bottom:76px !important }
149
+ .sa-panel { border-radius:14px !important; height:calc(100vh - 100px) !important; max-height:none !important }
150
+ }
151
+ `;
152
+ function md(text) {
153
+ let s = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/```(\w*)\n?([\s\S]*?)```/g, (_, lang, code) => `<pre><code class="lang-${lang}">${code.trimEnd()}</code></pre>`).replace(/`([^`\n]+)`/g, "<code>$1</code>").replace(/^### (.+)$/gm, "<h3>$1</h3>").replace(/^## (.+)$/gm, "<h2>$1</h2>").replace(/^# (.+)$/gm, "<h1>$1</h1>").replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replace(/\*(.+?)\*/g, "<em>$1</em>").replace(/^> (.+)$/gm, "<blockquote>$1</blockquote>").replace(/^---$/gm, "<hr/>").replace(/\|(.+)\|\r?\n\|[-| :]+\|\r?\n((?:\|.+\|\r?\n?)+)/g, (_, hdr, body) => {
154
+ const ths = hdr.split("|").filter((c) => c.trim()).map((c) => `<th>${c.trim()}</th>`).join("");
155
+ const trs = body.trim().split("\n").map((row) => {
156
+ const tds = row.split("|").filter((c) => c.trim()).map((c) => `<td>${c.trim()}</td>`).join("");
109
157
  return `<tr>${tds}</tr>`;
110
158
  }).join("");
111
- return `<div style="overflow-x:auto;margin:8px 0"><table style="width:100%;border-collapse:collapse;font-size:13px"><thead><tr>${ths}</tr></thead><tbody>${trs}</tbody></table></div>`;
112
- }).replace(/^[-*] (.+)$/gm, '<li style="margin:2px 0;padding-left:4px">$1</li>').replace(/(<li[^>]*>.*<\/li>\n?)+/g, (m) => `<ul style="margin:6px 0;padding-left:18px;list-style:disc">${m}</ul>`).replace(/^\d+\. (.+)$/gm, '<li style="margin:2px 0;padding-left:4px">$1</li>').replace(/\n\n/g, "<br/><br/>").replace(/\n/g, "<br/>");
159
+ return `<div style="overflow-x:auto"><table><thead><tr>${ths}</tr></thead><tbody>${trs}</tbody></table></div>`;
160
+ }).replace(/^[-*+] (.+)$/gm, "<li>$1</li>").replace(/(<li>[\s\S]*?<\/li>\n?)+/g, (m) => `<ul>${m}</ul>`).replace(/^\d+\. (.+)$/gm, "<li>$1</li>").replace(/\n\n+/g, "</p><p>").replace(/\n/g, "<br/>");
161
+ return `<p>${s}</p>`;
113
162
  }
114
- function TypingDots({ color }) {
115
- return /* @__PURE__ */ jsx2("span", { style: { display: "inline-flex", gap: 4, alignItems: "center", padding: "2px 0" }, children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx2("span", { style: {
116
- width: 6,
117
- height: 6,
163
+ function Dots({ color }) {
164
+ return /* @__PURE__ */ jsx2("span", { style: { display: "inline-flex", gap: 4, alignItems: "center", padding: "4px 2px" }, children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx2("span", { style: {
165
+ width: 7,
166
+ height: 7,
118
167
  borderRadius: "50%",
119
168
  background: color,
120
- animation: "sa-bounce 1.2s infinite",
121
- animationDelay: `${i * 0.2}s`,
122
- display: "inline-block"
169
+ display: "inline-block",
170
+ animation: "sa-bounce 1.3s infinite",
171
+ animationDelay: `${i * 0.18}s`
123
172
  } }, i)) });
124
173
  }
125
- function CopyBtn({ text }) {
126
- const [copied, setCopied] = useState2(false);
127
- const copy = useCallback2(() => {
174
+ function Copy({ text }) {
175
+ const [ok, setOk] = useState2(false);
176
+ return /* @__PURE__ */ jsx2("button", { className: "sa-copy", onClick: () => {
128
177
  navigator.clipboard?.writeText(text).then(() => {
129
- setCopied(true);
130
- setTimeout(() => setCopied(false), 1500);
178
+ setOk(true);
179
+ setTimeout(() => setOk(false), 1600);
131
180
  });
132
- }, [text]);
133
- return /* @__PURE__ */ jsx2("button", { onClick: copy, title: "Copy", style: {
181
+ }, title: "Copy response", style: {
134
182
  background: "none",
135
183
  border: "none",
136
184
  cursor: "pointer",
137
- padding: "2px 6px",
138
- borderRadius: 4,
185
+ padding: "3px 7px",
186
+ borderRadius: 5,
139
187
  fontSize: 11,
140
- color: "#9ca3af",
141
- opacity: 0.7,
142
- transition: "opacity 0.15s"
143
- }, children: copied ? "\u2713" : "\u2398" });
188
+ color: "#94a3b8",
189
+ opacity: 0.65,
190
+ transition: "all .15s",
191
+ display: "flex",
192
+ alignItems: "center",
193
+ gap: 3
194
+ }, children: ok ? /* @__PURE__ */ jsxs(Fragment, { children: [
195
+ /* @__PURE__ */ jsx2("svg", { width: "11", height: "11", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx2("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }) }),
196
+ " Copied"
197
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
198
+ /* @__PURE__ */ jsx2("svg", { width: "11", height: "11", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx2("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }) }),
199
+ " Copy"
200
+ ] }) });
144
201
  }
145
- function MessageBubble({
146
- role,
147
- content,
148
- isStreaming,
149
- accentColor,
150
- timestamp
151
- }) {
202
+ function Bubble({ role, content, streaming, accent, time }) {
152
203
  const isUser = role === "user";
153
- const timeStr = timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
154
- return /* @__PURE__ */ jsxs("div", { style: {
204
+ const t = time.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
205
+ return /* @__PURE__ */ jsxs("div", { className: "sa-msg", style: {
155
206
  display: "flex",
156
207
  flexDirection: "column",
157
208
  alignItems: isUser ? "flex-end" : "flex-start",
158
- gap: 3,
159
- maxWidth: "88%",
209
+ gap: 4,
210
+ maxWidth: "90%",
160
211
  alignSelf: isUser ? "flex-end" : "flex-start"
161
212
  }, children: [
162
213
  /* @__PURE__ */ jsxs("div", { style: {
@@ -166,48 +217,53 @@ function MessageBubble({
166
217
  flexDirection: isUser ? "row-reverse" : "row"
167
218
  }, children: [
168
219
  /* @__PURE__ */ jsx2("div", { style: {
169
- width: 24,
170
- height: 24,
220
+ width: 26,
221
+ height: 26,
171
222
  borderRadius: "50%",
172
- background: isUser ? accentColor : "linear-gradient(135deg,#6366f1,#8b5cf6)",
223
+ flexShrink: 0,
224
+ background: isUser ? `linear-gradient(135deg,${accent},${adj(accent, -25)})` : "linear-gradient(135deg,#6366f1,#8b5cf6)",
173
225
  display: "flex",
174
226
  alignItems: "center",
175
227
  justifyContent: "center",
176
228
  fontSize: 11,
177
229
  color: "white",
178
230
  fontWeight: 700,
179
- flexShrink: 0
231
+ boxShadow: isUser ? `0 2px 8px ${accent}44` : "0 2px 8px #6366f144"
180
232
  }, children: isUser ? "U" : "\u2726" }),
181
- /* @__PURE__ */ jsx2("span", { style: { fontSize: 11, color: "#9ca3af", fontWeight: 500 }, children: isUser ? "You" : "SyncAgent" }),
182
- /* @__PURE__ */ jsx2("span", { style: { fontSize: 10, color: "#d1d5db" }, children: timeStr })
233
+ /* @__PURE__ */ jsx2("span", { style: { fontSize: 11.5, fontWeight: 600, color: isUser ? "#475569" : "#6366f1" }, children: isUser ? "You" : "SyncAgent" }),
234
+ /* @__PURE__ */ jsx2("span", { style: { fontSize: 10, color: "#cbd5e1" }, children: t })
183
235
  ] }),
184
- /* @__PURE__ */ jsx2("div", { style: {
185
- padding: "10px 14px",
186
- borderRadius: isUser ? "16px 4px 16px 16px" : "4px 16px 16px 16px",
187
- background: isUser ? accentColor : "#f8fafc",
236
+ /* @__PURE__ */ jsxs("div", { style: {
237
+ padding: isUser ? "10px 14px" : "12px 16px",
238
+ borderRadius: isUser ? "18px 4px 18px 18px" : "4px 18px 18px 18px",
239
+ background: isUser ? `linear-gradient(135deg,${accent},${adj(accent, -20)})` : "#ffffff",
188
240
  color: isUser ? "white" : "#1e293b",
189
241
  fontSize: 13.5,
190
- lineHeight: 1.6,
242
+ lineHeight: 1.65,
191
243
  wordBreak: "break-word",
192
- border: isUser ? "none" : "1px solid #e2e8f0",
193
- boxShadow: isUser ? `0 2px 8px ${accentColor}33` : "0 1px 4px rgba(0,0,0,0.06)",
194
- position: "relative"
195
- }, children: isStreaming && !content ? /* @__PURE__ */ jsx2(TypingDots, { color: accentColor }) : isUser ? /* @__PURE__ */ jsx2("span", { style: { whiteSpace: "pre-wrap" }, children: content }) : /* @__PURE__ */ jsx2("div", { dangerouslySetInnerHTML: { __html: renderMarkdown(content) } }) }),
196
- !isUser && content && !isStreaming && /* @__PURE__ */ jsx2("div", { style: { paddingLeft: 30 }, children: /* @__PURE__ */ jsx2(CopyBtn, { text: content }) })
244
+ border: isUser ? "none" : "1px solid #e8edf3",
245
+ boxShadow: isUser ? `0 4px 16px ${accent}33` : "0 2px 12px rgba(0,0,0,0.07)",
246
+ maxWidth: "100%"
247
+ }, children: [
248
+ streaming && !content ? /* @__PURE__ */ jsx2(Dots, { color: accent }) : isUser ? /* @__PURE__ */ jsx2("span", { style: { whiteSpace: "pre-wrap" }, children: content }) : /* @__PURE__ */ jsx2("div", { className: "sa-md", dangerouslySetInnerHTML: { __html: md(content) } }),
249
+ streaming && content && /* @__PURE__ */ jsx2("span", { className: "sa-cursor", style: { color: accent } })
250
+ ] }),
251
+ !isUser && content && !streaming && /* @__PURE__ */ jsx2("div", { style: { paddingLeft: 32, display: "flex", gap: 2 }, children: /* @__PURE__ */ jsx2(Copy, { text: content }) })
197
252
  ] });
198
253
  }
199
- function Suggestions({ items, onSelect, accentColor }) {
200
- return /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, padding: "0 16px 12px" }, children: items.map((s2) => /* @__PURE__ */ jsx2("button", { onClick: () => onSelect(s2), style: {
201
- padding: "5px 12px",
254
+ function Chips({ items, onPick, accent }) {
255
+ return /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, padding: "0 14px 10px" }, children: items.map((s) => /* @__PURE__ */ jsx2("button", { className: "sa-chip", onClick: () => onPick(s), style: {
256
+ padding: "5px 13px",
202
257
  borderRadius: 20,
203
258
  fontSize: 12,
204
259
  cursor: "pointer",
205
- border: `1px solid ${accentColor}44`,
206
- background: `${accentColor}0d`,
207
- color: accentColor,
260
+ border: `1px solid ${accent}33`,
261
+ background: `${accent}0a`,
262
+ color: accent,
208
263
  fontWeight: 500,
209
- transition: "all 0.15s"
210
- }, children: s2 }, s2)) });
264
+ transition: "all .15s",
265
+ whiteSpace: "nowrap"
266
+ }, children: s }, s)) });
211
267
  }
212
268
  function ChatInner({
213
269
  mode = "floating",
@@ -216,135 +272,155 @@ function ChatInner({
216
272
  title = "SyncAgent",
217
273
  subtitle = "AI Database Assistant",
218
274
  placeholder = "Ask anything about your data...",
219
- welcomeMessage = "Hi! I can query, analyze, and manage your database using natural language. What would you like to know?",
275
+ welcomeMessage = "Hi! I can query, analyze, and manage your database using natural language.",
220
276
  accentColor = "#10b981",
221
277
  className,
222
278
  style: customStyle,
223
279
  suggestions = ["Show all records", "Count total entries", "Show recent activity"]
224
280
  }) {
225
- const { messages, isLoading, error, sendMessage, stop, reset } = useSyncAgent();
226
- const [isOpen, setIsOpen] = useState2(defaultOpen);
281
+ const { messages, isLoading, error, status, sendMessage, stop, reset } = useSyncAgent();
282
+ const [open, setOpen] = useState2(defaultOpen);
227
283
  const [input, setInput] = useState2("");
228
- const [timestamps] = useState2(() => /* @__PURE__ */ new Map());
229
- const messagesEndRef = useRef2(null);
284
+ const [ts] = useState2(() => /* @__PURE__ */ new Map());
285
+ const endRef = useRef2(null);
230
286
  const inputRef = useRef2(null);
231
- const msgCount = useRef2(0);
232
- if (messages.length > msgCount.current) {
233
- for (let i = msgCount.current; i < messages.length; i++) {
234
- if (!timestamps.has(i)) timestamps.set(i, /* @__PURE__ */ new Date());
235
- }
236
- msgCount.current = messages.length;
287
+ const prevLen = useRef2(0);
288
+ if (messages.length > prevLen.current) {
289
+ for (let i = prevLen.current; i < messages.length; i++)
290
+ if (!ts.has(i)) ts.set(i, /* @__PURE__ */ new Date());
291
+ prevLen.current = messages.length;
237
292
  }
238
293
  useEffect(() => {
239
- messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
294
+ endRef.current?.scrollIntoView({ behavior: "smooth" });
240
295
  }, [messages, isLoading]);
241
296
  useEffect(() => {
242
- if (isOpen) setTimeout(() => inputRef.current?.focus(), 100);
243
- }, [isOpen]);
244
- const handleSend = useCallback2(() => {
245
- const text = input.trim();
246
- if (!text || isLoading) return;
297
+ if (open) setTimeout(() => inputRef.current?.focus(), 120);
298
+ }, [open]);
299
+ const send = useCallback2(() => {
300
+ const t = input.trim();
301
+ if (!t || isLoading) return;
247
302
  setInput("");
248
- sendMessage(text);
303
+ sendMessage(t);
249
304
  }, [input, isLoading, sendMessage]);
250
- const handleKeyDown = (e) => {
305
+ const onKey = (e) => {
251
306
  if (e.key === "Enter" && !e.shiftKey) {
252
307
  e.preventDefault();
253
- handleSend();
308
+ send();
254
309
  }
255
310
  };
256
- const showSuggestions = messages.length === 0 && suggestions.length > 0;
257
- const panel = /* @__PURE__ */ jsxs("div", { style: {
258
- ...s.panel,
259
- ...mode === "inline" ? s.panelInline : {},
311
+ const noMsgs = messages.length === 0;
312
+ const panel = /* @__PURE__ */ jsxs("div", { className: `sa-panel ${className || ""}`, style: {
313
+ height: mode === "inline" ? "100%" : 600,
314
+ maxHeight: mode === "inline" ? "none" : "calc(100vh - 110px)",
315
+ background: "#f8fafc",
316
+ borderRadius: mode === "inline" ? 14 : 20,
317
+ boxShadow: mode === "inline" ? "0 2px 20px rgba(0,0,0,.08)" : "0 24px 64px rgba(0,0,0,.18), 0 4px 24px rgba(0,0,0,.08)",
318
+ display: "flex",
319
+ flexDirection: "column",
320
+ overflow: "hidden",
321
+ fontFamily: "-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif",
322
+ border: "1px solid rgba(0,0,0,.07)",
260
323
  ...customStyle
261
- }, className, children: [
262
- /* @__PURE__ */ jsx2("style", { children: `
263
- @keyframes sa-bounce {
264
- 0%,80%,100% { transform: translateY(0); opacity:0.4 }
265
- 40% { transform: translateY(-5px); opacity:1 }
266
- }
267
- @keyframes sa-fadein {
268
- from { opacity:0; transform:translateY(6px) }
269
- to { opacity:1; transform:translateY(0) }
270
- }
271
- .sa-msg-wrap { animation: sa-fadein 0.2s ease }
272
- .sa-input:focus { outline:none; border-color:${accentColor} !important; box-shadow:0 0 0 3px ${accentColor}22 !important }
273
- .sa-send:hover:not(:disabled) { opacity:0.88; transform:scale(1.04) }
274
- .sa-send:disabled { opacity:0.4; cursor:not-allowed }
275
- .sa-fab-btn:hover { transform:scale(1.08) }
276
- ` }),
324
+ }, children: [
325
+ /* @__PURE__ */ jsx2("style", { children: GLOBAL_CSS(accentColor) }),
277
326
  /* @__PURE__ */ jsxs("div", { style: {
278
- padding: "14px 16px",
279
- background: `linear-gradient(135deg, ${accentColor}, ${adjustColor(accentColor, -30)})`,
327
+ padding: "13px 16px",
328
+ background: `linear-gradient(135deg,${accentColor},${adj(accentColor, -28)})`,
280
329
  display: "flex",
281
330
  alignItems: "center",
282
331
  justifyContent: "space-between",
283
- flexShrink: 0
332
+ flexShrink: 0,
333
+ boxShadow: "0 2px 12px rgba(0,0,0,.12)"
284
334
  }, children: [
285
335
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
286
336
  /* @__PURE__ */ jsx2("div", { style: {
287
- width: 34,
288
- height: 34,
337
+ width: 36,
338
+ height: 36,
289
339
  borderRadius: "50%",
290
- background: "rgba(255,255,255,0.2)",
340
+ background: "rgba(255,255,255,.18)",
341
+ backdropFilter: "blur(8px)",
291
342
  display: "flex",
292
343
  alignItems: "center",
293
344
  justifyContent: "center",
294
- fontSize: 16
345
+ fontSize: 17,
346
+ boxShadow: "0 2px 8px rgba(0,0,0,.15)"
295
347
  }, children: "\u2726" }),
296
348
  /* @__PURE__ */ jsxs("div", { children: [
297
- /* @__PURE__ */ jsx2("div", { style: { color: "white", fontWeight: 700, fontSize: 14, lineHeight: 1.2 }, children: title }),
298
- /* @__PURE__ */ jsx2("div", { style: { color: "rgba(255,255,255,0.75)", fontSize: 11 }, children: subtitle })
349
+ /* @__PURE__ */ jsx2("div", { style: { color: "white", fontWeight: 700, fontSize: 14, lineHeight: 1.2, letterSpacing: "-0.01em" }, children: title }),
350
+ /* @__PURE__ */ jsx2("div", { style: { color: "rgba(255,255,255,.72)", fontSize: 11, marginTop: 1 }, children: isLoading ? /* @__PURE__ */ jsxs("span", { style: { animation: "sa-pulse 1.2s infinite" }, children: [
351
+ "\u25CF ",
352
+ status?.label || "Thinking..."
353
+ ] }) : subtitle })
299
354
  ] })
300
355
  ] }),
301
356
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 4 }, children: [
302
- messages.length > 0 && /* @__PURE__ */ jsx2("button", { onClick: reset, title: "Clear chat", style: {
303
- background: "rgba(255,255,255,0.15)",
357
+ messages.length > 0 && /* @__PURE__ */ jsx2("button", { onClick: reset, style: {
358
+ background: "rgba(255,255,255,.15)",
304
359
  border: "none",
305
360
  color: "white",
306
361
  cursor: "pointer",
307
- borderRadius: 6,
308
- padding: "4px 8px",
309
- fontSize: 11
362
+ borderRadius: 7,
363
+ padding: "4px 9px",
364
+ fontSize: 11,
365
+ fontWeight: 500,
366
+ backdropFilter: "blur(4px)"
310
367
  }, children: "Clear" }),
311
- mode === "floating" && /* @__PURE__ */ jsx2("button", { onClick: () => setIsOpen(false), style: {
312
- background: "rgba(255,255,255,0.15)",
368
+ mode === "floating" && /* @__PURE__ */ jsx2("button", { onClick: () => setOpen(false), style: {
369
+ background: "rgba(255,255,255,.15)",
313
370
  border: "none",
314
371
  color: "white",
315
372
  cursor: "pointer",
316
- borderRadius: 6,
317
- padding: "4px 8px",
318
- fontSize: 16,
319
- lineHeight: 1
373
+ borderRadius: 7,
374
+ padding: "4px 9px",
375
+ fontSize: 18,
376
+ lineHeight: 1,
377
+ backdropFilter: "blur(4px)"
320
378
  }, children: "\xD7" })
321
379
  ] })
322
380
  ] }),
323
- /* @__PURE__ */ jsxs("div", { style: s.messages, children: [
324
- messages.length === 0 && /* @__PURE__ */ jsxs("div", { style: s.welcome, children: [
381
+ /* @__PURE__ */ jsxs("div", { className: "sa-scroll", style: {
382
+ flex: 1,
383
+ overflowY: "auto",
384
+ padding: "16px 14px 8px",
385
+ display: "flex",
386
+ flexDirection: "column",
387
+ gap: 16,
388
+ background: "#f8fafc"
389
+ }, children: [
390
+ noMsgs && /* @__PURE__ */ jsxs("div", { style: {
391
+ flex: 1,
392
+ display: "flex",
393
+ flexDirection: "column",
394
+ alignItems: "center",
395
+ justifyContent: "center",
396
+ padding: "32px 20px",
397
+ textAlign: "center"
398
+ }, children: [
325
399
  /* @__PURE__ */ jsx2("div", { style: {
326
- width: 48,
327
- height: 48,
400
+ width: 56,
401
+ height: 56,
328
402
  borderRadius: "50%",
329
- margin: "0 auto 12px",
330
- background: `linear-gradient(135deg, ${accentColor}22, ${accentColor}44)`,
403
+ marginBottom: 14,
404
+ background: `linear-gradient(135deg,${accentColor}18,${accentColor}35)`,
331
405
  display: "flex",
332
406
  alignItems: "center",
333
407
  justifyContent: "center",
334
- fontSize: 22
408
+ fontSize: 24,
409
+ boxShadow: `0 4px 20px ${accentColor}22`
335
410
  }, children: "\u2726" }),
336
- /* @__PURE__ */ jsx2("p", { style: { fontSize: 14, color: "#64748b", lineHeight: 1.6, maxWidth: 260, margin: "0 auto" }, children: welcomeMessage })
411
+ /* @__PURE__ */ jsx2("p", { style: { fontSize: 14, color: "#64748b", lineHeight: 1.65, maxWidth: 260, margin: 0 }, children: welcomeMessage })
337
412
  ] }),
338
- messages.map((msg, i) => /* @__PURE__ */ jsx2("div", { className: "sa-msg-wrap", children: /* @__PURE__ */ jsx2(
339
- MessageBubble,
413
+ messages.map((msg, i) => /* @__PURE__ */ jsx2(
414
+ Bubble,
340
415
  {
341
416
  role: msg.role,
342
417
  content: msg.content,
343
- isStreaming: isLoading && i === messages.length - 1 && msg.role === "assistant",
344
- accentColor,
345
- timestamp: timestamps.get(i) ?? /* @__PURE__ */ new Date()
346
- }
347
- ) }, i)),
418
+ streaming: isLoading && i === messages.length - 1 && msg.role === "assistant",
419
+ accent: accentColor,
420
+ time: ts.get(i) ?? /* @__PURE__ */ new Date()
421
+ },
422
+ i
423
+ )),
348
424
  error && /* @__PURE__ */ jsxs("div", { style: {
349
425
  padding: "10px 14px",
350
426
  borderRadius: 10,
@@ -352,52 +428,87 @@ function ChatInner({
352
428
  background: "#fef2f2",
353
429
  color: "#dc2626",
354
430
  border: "1px solid #fecaca",
355
- alignSelf: "flex-start"
431
+ alignSelf: "flex-start",
432
+ display: "flex",
433
+ alignItems: "center",
434
+ gap: 6
356
435
  }, children: [
357
- "\u26A0\uFE0F ",
436
+ /* @__PURE__ */ jsx2("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx2("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
358
437
  error.message
359
438
  ] }),
360
- /* @__PURE__ */ jsx2("div", { ref: messagesEndRef })
439
+ /* @__PURE__ */ jsx2("div", { ref: endRef })
440
+ ] }),
441
+ noMsgs && suggestions.length > 0 && /* @__PURE__ */ jsx2(Chips, { items: suggestions, onPick: (s) => {
442
+ setInput(s);
443
+ inputRef.current?.focus();
444
+ }, accent: accentColor }),
445
+ isLoading && status && status.step !== "done" && /* @__PURE__ */ jsxs("div", { style: {
446
+ padding: "7px 14px",
447
+ borderTop: "1px solid #f0f4f8",
448
+ background: "#fafbfc",
449
+ display: "flex",
450
+ alignItems: "center",
451
+ gap: 8,
452
+ flexShrink: 0
453
+ }, children: [
454
+ /* @__PURE__ */ jsx2("div", { style: { display: "flex", gap: 3 }, children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx2("div", { style: {
455
+ width: 5,
456
+ height: 5,
457
+ borderRadius: "50%",
458
+ background: accentColor,
459
+ animation: "sa-bounce 1.2s infinite",
460
+ animationDelay: `${i * 0.15}s`
461
+ } }, i)) }),
462
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: 11.5, color: "#64748b", fontWeight: 500 }, children: [
463
+ status.step === "connecting" && "\u{1F50C} ",
464
+ status.step === "schema" && "\u{1F4CB} ",
465
+ status.step === "thinking" && "\u{1F9E0} ",
466
+ status.step === "querying" && "\u{1F50D} ",
467
+ status.step === "writing" && "\u270F\uFE0F ",
468
+ status.label
469
+ ] })
361
470
  ] }),
362
- showSuggestions && /* @__PURE__ */ jsx2(
363
- Suggestions,
364
- {
365
- items: suggestions,
366
- onSelect: (s2) => {
367
- setInput(s2);
368
- inputRef.current?.focus();
369
- },
370
- accentColor
371
- }
372
- ),
373
471
  /* @__PURE__ */ jsxs("div", { style: {
374
- padding: "10px 12px",
375
- borderTop: "1px solid #f1f5f9",
376
- background: "#fff",
472
+ padding: "10px 12px 12px",
473
+ borderTop: "1px solid #e8edf3",
474
+ background: "#ffffff",
377
475
  flexShrink: 0
378
476
  }, children: [
379
477
  /* @__PURE__ */ jsxs("div", { style: {
380
478
  display: "flex",
381
479
  gap: 8,
382
480
  alignItems: "flex-end",
383
- background: "#f8fafc",
384
- borderRadius: 12,
385
- border: "1px solid #e2e8f0",
386
- padding: "6px 6px 6px 12px",
387
- transition: "border-color 0.15s, box-shadow 0.15s"
481
+ background: "#f1f5f9",
482
+ borderRadius: 14,
483
+ border: "1.5px solid #e2e8f0",
484
+ padding: "8px 8px 8px 14px",
485
+ transition: "border-color .15s, box-shadow .15s"
388
486
  }, children: [
389
487
  /* @__PURE__ */ jsx2(
390
488
  "textarea",
391
489
  {
392
490
  ref: inputRef,
393
- className: "sa-input",
394
491
  value: input,
395
492
  onChange: (e) => {
396
493
  setInput(e.target.value);
397
494
  e.target.style.height = "auto";
398
- e.target.style.height = Math.min(e.target.scrollHeight, 120) + "px";
495
+ e.target.style.height = Math.min(e.target.scrollHeight, 130) + "px";
496
+ },
497
+ onKeyDown: onKey,
498
+ onFocus: (e) => {
499
+ const p = e.target.parentElement;
500
+ if (p) {
501
+ p.style.borderColor = accentColor;
502
+ p.style.boxShadow = `0 0 0 3px ${accentColor}1a`;
503
+ }
504
+ },
505
+ onBlur: (e) => {
506
+ const p = e.target.parentElement;
507
+ if (p) {
508
+ p.style.borderColor = "#e2e8f0";
509
+ p.style.boxShadow = "none";
510
+ }
399
511
  },
400
- onKeyDown: handleKeyDown,
401
512
  placeholder,
402
513
  disabled: isLoading,
403
514
  rows: 1,
@@ -407,161 +518,117 @@ function ChatInner({
407
518
  border: "none",
408
519
  resize: "none",
409
520
  fontSize: 13.5,
410
- lineHeight: 1.5,
521
+ lineHeight: 1.55,
411
522
  color: "#1e293b",
412
523
  fontFamily: "inherit",
413
524
  padding: 0,
414
- maxHeight: 120,
525
+ maxHeight: 130,
415
526
  outline: "none"
416
527
  }
417
528
  }
418
529
  ),
419
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 4, alignItems: "flex-end", flexShrink: 0 }, children: [
420
- isLoading && /* @__PURE__ */ jsx2("button", { onClick: stop, title: "Stop", style: {
530
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 5, alignItems: "flex-end", flexShrink: 0 }, children: [
531
+ isLoading && /* @__PURE__ */ jsxs("button", { onClick: stop, style: {
421
532
  background: "#fef2f2",
422
533
  border: "1px solid #fecaca",
423
534
  color: "#dc2626",
424
- borderRadius: 8,
425
- padding: "6px 10px",
535
+ borderRadius: 9,
536
+ padding: "6px 11px",
426
537
  cursor: "pointer",
427
- fontSize: 12,
428
- fontWeight: 600
429
- }, children: "\u25A0 Stop" }),
430
- /* @__PURE__ */ jsx2(
431
- "button",
432
- {
433
- className: "sa-send",
434
- onClick: handleSend,
435
- disabled: isLoading || !input.trim(),
436
- style: {
437
- width: 34,
438
- height: 34,
439
- borderRadius: 8,
440
- border: "none",
441
- background: input.trim() && !isLoading ? accentColor : "#e2e8f0",
442
- color: input.trim() && !isLoading ? "white" : "#94a3b8",
443
- cursor: "pointer",
444
- display: "flex",
445
- alignItems: "center",
446
- justifyContent: "center",
447
- transition: "all 0.15s",
448
- flexShrink: 0
449
- },
450
- children: /* @__PURE__ */ jsx2("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx2("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }) })
451
- }
452
- )
538
+ fontSize: 11.5,
539
+ fontWeight: 600,
540
+ display: "flex",
541
+ alignItems: "center",
542
+ gap: 4
543
+ }, children: [
544
+ /* @__PURE__ */ jsx2("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx2("rect", { x: "4", y: "4", width: "16", height: "16" }) }),
545
+ "Stop"
546
+ ] }),
547
+ /* @__PURE__ */ jsx2("button", { className: "sa-send", onClick: send, disabled: isLoading || !input.trim(), style: {
548
+ width: 36,
549
+ height: 36,
550
+ borderRadius: 10,
551
+ border: "none",
552
+ background: input.trim() && !isLoading ? `linear-gradient(135deg,${accentColor},${adj(accentColor, -20)})` : "#e2e8f0",
553
+ color: input.trim() && !isLoading ? "white" : "#94a3b8",
554
+ cursor: "pointer",
555
+ display: "flex",
556
+ alignItems: "center",
557
+ justifyContent: "center",
558
+ transition: "all .15s",
559
+ flexShrink: 0,
560
+ boxShadow: input.trim() && !isLoading ? `0 3px 12px ${accentColor}44` : "none"
561
+ }, children: /* @__PURE__ */ jsx2("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx2("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }) }) })
453
562
  ] })
454
563
  ] }),
455
- /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", marginTop: 6, fontSize: 10, color: "#cbd5e1" }, children: [
564
+ /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", marginTop: 7, fontSize: 10, color: "#c4cdd8", letterSpacing: ".01em" }, children: [
456
565
  "Powered by ",
457
566
  /* @__PURE__ */ jsx2("span", { style: { color: accentColor, fontWeight: 600 }, children: "SyncAgent" }),
458
- " \xB7 Enter to send \xB7 Shift+Enter for new line"
567
+ /* @__PURE__ */ jsx2("span", { style: { margin: "0 5px", opacity: 0.5 }, children: "\xB7" }),
568
+ "Enter to send \xB7 Shift+Enter for new line"
459
569
  ] })
460
570
  ] })
461
571
  ] });
462
572
  if (mode === "inline") return panel;
463
- const isLeft = position === "bottom-left";
573
+ const left = position === "bottom-left";
464
574
  return /* @__PURE__ */ jsxs(Fragment, { children: [
465
- /* @__PURE__ */ jsx2("div", { style: {
575
+ /* @__PURE__ */ jsx2("div", { className: "sa-panel-float", style: {
466
576
  position: "fixed",
467
- bottom: 88,
577
+ bottom: 84,
468
578
  zIndex: 99998,
469
- ...isLeft ? { left: 20 } : { right: 20 },
470
- width: 420,
471
- maxWidth: "calc(100vw - 40px)",
472
- transition: "opacity 0.25s, transform 0.25s",
473
- opacity: isOpen ? 1 : 0,
474
- transform: isOpen ? "translateY(0) scale(1)" : "translateY(16px) scale(0.96)",
475
- pointerEvents: isOpen ? "auto" : "none"
579
+ ...left ? { left: 16 } : { right: 16 },
580
+ width: 430,
581
+ maxWidth: "calc(100vw - 32px)",
582
+ transition: "opacity .28s cubic-bezier(.16,1,.3,1), transform .28s cubic-bezier(.16,1,.3,1)",
583
+ opacity: open ? 1 : 0,
584
+ transform: open ? "translateY(0) scale(1)" : "translateY(20px) scale(.95)",
585
+ pointerEvents: open ? "auto" : "none"
476
586
  }, children: panel }),
477
- /* @__PURE__ */ jsxs(
478
- "button",
479
- {
480
- className: "sa-fab-btn",
481
- onClick: () => setIsOpen(!isOpen),
482
- style: {
483
- position: "fixed",
484
- bottom: 20,
485
- zIndex: 99999,
486
- ...isLeft ? { left: 20 } : { right: 20 },
487
- width: 56,
488
- height: 56,
489
- borderRadius: "50%",
490
- border: "none",
491
- background: `linear-gradient(135deg, ${accentColor}, ${adjustColor(accentColor, -30)})`,
492
- cursor: "pointer",
493
- boxShadow: `0 4px 20px ${accentColor}55, 0 2px 8px rgba(0,0,0,0.15)`,
494
- display: "flex",
495
- alignItems: "center",
496
- justifyContent: "center",
497
- transition: "transform 0.2s, box-shadow 0.2s"
498
- },
499
- children: [
500
- isOpen ? /* @__PURE__ */ jsx2("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "white", children: /* @__PURE__ */ jsx2("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) }) : /* @__PURE__ */ jsx2("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "white", children: /* @__PURE__ */ jsx2("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z" }) }),
501
- !isOpen && messages.length > 0 && /* @__PURE__ */ jsx2("div", { style: {
502
- position: "absolute",
503
- top: 2,
504
- right: 2,
505
- width: 12,
506
- height: 12,
507
- borderRadius: "50%",
508
- background: "#ef4444",
509
- border: "2px solid white"
510
- } })
511
- ]
512
- }
513
- )
587
+ /* @__PURE__ */ jsxs("button", { className: "sa-fab", onClick: () => setOpen((o) => !o), style: {
588
+ position: "fixed",
589
+ bottom: 16,
590
+ zIndex: 99999,
591
+ ...left ? { left: 16 } : { right: 16 },
592
+ width: 58,
593
+ height: 58,
594
+ borderRadius: "50%",
595
+ border: "none",
596
+ background: `linear-gradient(135deg,${accentColor},${adj(accentColor, -28)})`,
597
+ cursor: "pointer",
598
+ boxShadow: `0 6px 24px ${accentColor}55, 0 2px 8px rgba(0,0,0,.18)`,
599
+ display: "flex",
600
+ alignItems: "center",
601
+ justifyContent: "center"
602
+ }, children: [
603
+ /* @__PURE__ */ jsx2("div", { style: {
604
+ transition: "transform .3s cubic-bezier(.16,1,.3,1), opacity .2s",
605
+ transform: open ? "rotate(90deg) scale(.9)" : "rotate(0) scale(1)",
606
+ opacity: open ? 0.85 : 1,
607
+ display: "flex"
608
+ }, children: open ? /* @__PURE__ */ jsx2("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "white", children: /* @__PURE__ */ jsx2("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) }) : /* @__PURE__ */ jsx2("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "white", children: /* @__PURE__ */ jsx2("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z" }) }) }),
609
+ !open && messages.length > 0 && /* @__PURE__ */ jsx2("div", { style: {
610
+ position: "absolute",
611
+ top: 3,
612
+ right: 3,
613
+ width: 13,
614
+ height: 13,
615
+ borderRadius: "50%",
616
+ background: "#ef4444",
617
+ border: "2.5px solid white",
618
+ animation: "sa-pulse 2s infinite"
619
+ } })
620
+ ] })
514
621
  ] });
515
622
  }
516
- var s = {
517
- panel: {
518
- height: 580,
519
- maxHeight: "calc(100vh - 110px)",
520
- background: "#ffffff",
521
- borderRadius: 18,
522
- boxShadow: "0 20px 60px rgba(0,0,0,0.15), 0 4px 20px rgba(0,0,0,0.08)",
523
- display: "flex",
524
- flexDirection: "column",
525
- overflow: "hidden",
526
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
527
- border: "1px solid rgba(0,0,0,0.06)"
528
- },
529
- panelInline: {
530
- height: "100%",
531
- maxHeight: "none",
532
- borderRadius: 14,
533
- boxShadow: "0 2px 16px rgba(0,0,0,0.08)"
534
- },
535
- messages: {
536
- flex: 1,
537
- overflowY: "auto",
538
- padding: "16px 16px 8px",
539
- display: "flex",
540
- flexDirection: "column",
541
- gap: 14,
542
- scrollbarWidth: "thin"
543
- },
544
- welcome: {
545
- textAlign: "center",
546
- padding: "32px 20px",
547
- flex: 1,
548
- display: "flex",
549
- flexDirection: "column",
550
- alignItems: "center",
551
- justifyContent: "center"
552
- }
553
- };
554
- function adjustColor(hex, amount) {
555
- const num = parseInt(hex.replace("#", ""), 16);
556
- const r = Math.min(255, Math.max(0, (num >> 16 & 255) + amount));
557
- const g = Math.min(255, Math.max(0, (num >> 8 & 255) + amount));
558
- const b = Math.min(255, Math.max(0, (num & 255) + amount));
623
+ function adj(hex, amt) {
624
+ const n = parseInt(hex.replace("#", ""), 16);
625
+ const r = Math.min(255, Math.max(0, (n >> 16 & 255) + amt));
626
+ const g = Math.min(255, Math.max(0, (n >> 8 & 255) + amt));
627
+ const b = Math.min(255, Math.max(0, (n & 255) + amt));
559
628
  return `#${(r << 16 | g << 8 | b).toString(16).padStart(6, "0")}`;
560
629
  }
561
630
  function SyncAgentChat({ config, ...props }) {
562
- if (config) {
563
- return /* @__PURE__ */ jsx2(SyncAgentProvider, { config, children: /* @__PURE__ */ jsx2(ChatInner, { ...props }) });
564
- }
631
+ if (config) return /* @__PURE__ */ jsx2(SyncAgentProvider, { config, children: /* @__PURE__ */ jsx2(ChatInner, { ...props }) });
565
632
  return /* @__PURE__ */ jsx2(ChatInner, { ...props });
566
633
  }
567
634