@retrivora-ai/rag-engine 1.2.2 → 1.2.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/dist/{chunk-GCPPRD2G.mjs → chunk-WGPNEAK3.mjs} +37 -3
- package/dist/handlers/index.js +37 -3
- package/dist/handlers/index.mjs +1 -1
- package/dist/index.js +229 -106
- package/dist/index.mjs +199 -73
- package/dist/server.js +37 -3
- package/dist/server.mjs +1 -1
- package/package.json +2 -1
- package/src/components/ChatWindow.tsx +2 -1
- package/src/components/DynamicChart.tsx +113 -0
- package/src/components/MessageBubble.tsx +50 -1
- package/src/core/LangChainAgent.ts +20 -2
- package/src/core/Pipeline.ts +17 -0
package/dist/index.mjs
CHANGED
|
@@ -2,16 +2,17 @@ import {
|
|
|
2
2
|
mergeDefined
|
|
3
3
|
} from "./chunk-YLTMFW4M.mjs";
|
|
4
4
|
import {
|
|
5
|
+
__objRest,
|
|
5
6
|
__spreadProps,
|
|
6
7
|
__spreadValues
|
|
7
8
|
} from "./chunk-X4TOT24V.mjs";
|
|
8
9
|
|
|
9
10
|
// src/components/ChatWidget.tsx
|
|
10
|
-
import
|
|
11
|
+
import React9, { useState as useState5 } from "react";
|
|
11
12
|
import { MessageSquare, X as X2 } from "lucide-react";
|
|
12
13
|
|
|
13
14
|
// src/components/ChatWindow.tsx
|
|
14
|
-
import
|
|
15
|
+
import React8, { useState as useState4, useRef as useRef3, useEffect as useEffect4, useCallback as useCallback2 } from "react";
|
|
15
16
|
import {
|
|
16
17
|
Bot as Bot2,
|
|
17
18
|
Trash2,
|
|
@@ -27,7 +28,7 @@ import {
|
|
|
27
28
|
} from "lucide-react";
|
|
28
29
|
|
|
29
30
|
// src/components/MessageBubble.tsx
|
|
30
|
-
import
|
|
31
|
+
import React5 from "react";
|
|
31
32
|
import { Bot, User, ChevronDown as ChevronDown2, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
32
33
|
import ReactMarkdown from "react-markdown";
|
|
33
34
|
import remarkGfm from "remark-gfm";
|
|
@@ -164,6 +165,85 @@ function ProductCarousel({ products, primaryColor = "#6366f1", onAddToCart }) {
|
|
|
164
165
|
));
|
|
165
166
|
}
|
|
166
167
|
|
|
168
|
+
// src/components/DynamicChart.tsx
|
|
169
|
+
import React4 from "react";
|
|
170
|
+
import {
|
|
171
|
+
BarChart,
|
|
172
|
+
Bar,
|
|
173
|
+
LineChart,
|
|
174
|
+
Line,
|
|
175
|
+
PieChart,
|
|
176
|
+
Pie,
|
|
177
|
+
Cell,
|
|
178
|
+
XAxis,
|
|
179
|
+
YAxis,
|
|
180
|
+
CartesianGrid,
|
|
181
|
+
Tooltip,
|
|
182
|
+
Legend,
|
|
183
|
+
ResponsiveContainer
|
|
184
|
+
} from "recharts";
|
|
185
|
+
var DEFAULT_COLORS = ["#6366f1", "#10b981", "#f59e0b", "#ef4444", "#8b5cf6", "#ec4899"];
|
|
186
|
+
function DynamicChart({ config, primaryColor = "#6366f1", accentColor = "#8b5cf6" }) {
|
|
187
|
+
const { type, data, xAxisKey = "name", dataKeys = [] } = config;
|
|
188
|
+
const colors = config.colors || [primaryColor, accentColor, ...DEFAULT_COLORS];
|
|
189
|
+
if (!data || data.length === 0) {
|
|
190
|
+
return /* @__PURE__ */ React4.createElement("div", { className: "p-4 text-sm text-slate-500" }, "No data available for chart.");
|
|
191
|
+
}
|
|
192
|
+
if (type === "pie") {
|
|
193
|
+
const pieDataKey = dataKeys[0] || Object.keys(data[0]).find((k) => k !== xAxisKey) || "value";
|
|
194
|
+
return /* @__PURE__ */ React4.createElement("div", { className: "w-full h-64 mt-4 mb-2 select-none" }, /* @__PURE__ */ React4.createElement(ResponsiveContainer, { width: "100%", height: "100%" }, /* @__PURE__ */ React4.createElement(PieChart, null, /* @__PURE__ */ React4.createElement(
|
|
195
|
+
Pie,
|
|
196
|
+
{
|
|
197
|
+
data,
|
|
198
|
+
dataKey: pieDataKey,
|
|
199
|
+
nameKey: xAxisKey,
|
|
200
|
+
cx: "50%",
|
|
201
|
+
cy: "50%",
|
|
202
|
+
outerRadius: 80,
|
|
203
|
+
label: ({ name, percent }) => `${name} ${((percent != null ? percent : 0) * 100).toFixed(0)}%`
|
|
204
|
+
},
|
|
205
|
+
data.map((entry, index) => /* @__PURE__ */ React4.createElement(Cell, { key: `cell-${index}`, fill: colors[index % colors.length] }))
|
|
206
|
+
), /* @__PURE__ */ React4.createElement(
|
|
207
|
+
Tooltip,
|
|
208
|
+
{
|
|
209
|
+
contentStyle: { borderRadius: "8px", border: "none", boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)" }
|
|
210
|
+
}
|
|
211
|
+
), /* @__PURE__ */ React4.createElement(Legend, null))));
|
|
212
|
+
}
|
|
213
|
+
return /* @__PURE__ */ React4.createElement("div", { className: "w-full h-64 mt-4 mb-2 select-none" }, /* @__PURE__ */ React4.createElement(ResponsiveContainer, { width: "100%", height: "100%" }, type === "bar" ? /* @__PURE__ */ React4.createElement(BarChart, { data, margin: { top: 10, right: 10, left: -20, bottom: 0 } }, /* @__PURE__ */ React4.createElement(CartesianGrid, { strokeDasharray: "3 3", vertical: false, stroke: "#e2e8f0" }), /* @__PURE__ */ React4.createElement(XAxis, { dataKey: xAxisKey, tick: { fontSize: 12, fill: "#64748b" }, tickLine: false, axisLine: { stroke: "#cbd5e1" } }), /* @__PURE__ */ React4.createElement(YAxis, { tick: { fontSize: 12, fill: "#64748b" }, tickLine: false, axisLine: false }), /* @__PURE__ */ React4.createElement(
|
|
214
|
+
Tooltip,
|
|
215
|
+
{
|
|
216
|
+
contentStyle: { borderRadius: "8px", border: "none", boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)" },
|
|
217
|
+
cursor: { fill: "#f1f5f9" }
|
|
218
|
+
}
|
|
219
|
+
), /* @__PURE__ */ React4.createElement(Legend, { wrapperStyle: { fontSize: 12 } }), dataKeys.map((key, index) => /* @__PURE__ */ React4.createElement(
|
|
220
|
+
Bar,
|
|
221
|
+
{
|
|
222
|
+
key,
|
|
223
|
+
dataKey: key,
|
|
224
|
+
fill: colors[index % colors.length],
|
|
225
|
+
radius: [4, 4, 0, 0],
|
|
226
|
+
barSize: Math.max(20, 60 / data.length)
|
|
227
|
+
}
|
|
228
|
+
))) : /* @__PURE__ */ React4.createElement(LineChart, { data, margin: { top: 10, right: 10, left: -20, bottom: 0 } }, /* @__PURE__ */ React4.createElement(CartesianGrid, { strokeDasharray: "3 3", vertical: false, stroke: "#e2e8f0" }), /* @__PURE__ */ React4.createElement(XAxis, { dataKey: xAxisKey, tick: { fontSize: 12, fill: "#64748b" }, tickLine: false, axisLine: { stroke: "#cbd5e1" } }), /* @__PURE__ */ React4.createElement(YAxis, { tick: { fontSize: 12, fill: "#64748b" }, tickLine: false, axisLine: false }), /* @__PURE__ */ React4.createElement(
|
|
229
|
+
Tooltip,
|
|
230
|
+
{
|
|
231
|
+
contentStyle: { borderRadius: "8px", border: "none", boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)" }
|
|
232
|
+
}
|
|
233
|
+
), /* @__PURE__ */ React4.createElement(Legend, { wrapperStyle: { fontSize: 12 } }), dataKeys.map((key, index) => /* @__PURE__ */ React4.createElement(
|
|
234
|
+
Line,
|
|
235
|
+
{
|
|
236
|
+
key,
|
|
237
|
+
type: "monotone",
|
|
238
|
+
dataKey: key,
|
|
239
|
+
stroke: colors[index % colors.length],
|
|
240
|
+
strokeWidth: 3,
|
|
241
|
+
dot: { r: 4, strokeWidth: 2 },
|
|
242
|
+
activeDot: { r: 6 }
|
|
243
|
+
}
|
|
244
|
+
)))));
|
|
245
|
+
}
|
|
246
|
+
|
|
167
247
|
// src/components/MessageBubble.tsx
|
|
168
248
|
function MessageBubble({
|
|
169
249
|
message,
|
|
@@ -174,7 +254,7 @@ function MessageBubble({
|
|
|
174
254
|
onAddToCart
|
|
175
255
|
}) {
|
|
176
256
|
const isUser = message.role === "user";
|
|
177
|
-
const [showSources, setShowSources] =
|
|
257
|
+
const [showSources, setShowSources] = React5.useState(false);
|
|
178
258
|
const resolveImage = (data) => {
|
|
179
259
|
if (!data) return void 0;
|
|
180
260
|
const singleFields = ["image", "img", "thumbnail"];
|
|
@@ -187,7 +267,7 @@ function MessageBubble({
|
|
|
187
267
|
}
|
|
188
268
|
return void 0;
|
|
189
269
|
};
|
|
190
|
-
const productsFromSources =
|
|
270
|
+
const productsFromSources = React5.useMemo(() => {
|
|
191
271
|
if (isUser || !sources) return [];
|
|
192
272
|
return sources.filter((s) => {
|
|
193
273
|
const m = s.metadata || {};
|
|
@@ -205,7 +285,7 @@ function MessageBubble({
|
|
|
205
285
|
};
|
|
206
286
|
});
|
|
207
287
|
}, [sources, isUser]);
|
|
208
|
-
const { productsFromContent, cleanContent } =
|
|
288
|
+
const { productsFromContent, cleanContent } = React5.useMemo(() => {
|
|
209
289
|
if (isUser) return { productsFromContent: [], cleanContent: message.content };
|
|
210
290
|
const jsonRegex = /```json\s*([\s\S]*?)\s*```/g;
|
|
211
291
|
const products = [];
|
|
@@ -228,7 +308,7 @@ function MessageBubble({
|
|
|
228
308
|
}
|
|
229
309
|
return { productsFromContent: products, cleanContent: content.trim() };
|
|
230
310
|
}, [message.content, isUser]);
|
|
231
|
-
const allProducts =
|
|
311
|
+
const allProducts = React5.useMemo(() => {
|
|
232
312
|
if (productsFromContent.length > 0) return productsFromContent;
|
|
233
313
|
const uniqueProducts = [];
|
|
234
314
|
const seenIds = /* @__PURE__ */ new Set();
|
|
@@ -246,43 +326,88 @@ function MessageBubble({
|
|
|
246
326
|
return uniqueProducts;
|
|
247
327
|
}, [productsFromSources, productsFromContent, message.content]);
|
|
248
328
|
const hasProducts = allProducts.length > 0;
|
|
249
|
-
return /* @__PURE__ */
|
|
329
|
+
return /* @__PURE__ */ React5.createElement("div", { className: `flex gap-3 ${isUser ? "flex-row-reverse" : "flex-row"} items-start` }, /* @__PURE__ */ React5.createElement(
|
|
250
330
|
"div",
|
|
251
331
|
{
|
|
252
332
|
className: `flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center shadow-lg ${isUser ? "text-white" : "bg-slate-100 dark:bg-white/10 text-slate-700 dark:text-white/80"}`,
|
|
253
333
|
style: isUser ? { background: `linear-gradient(135deg, ${primaryColor}, ${accentColor})` } : {}
|
|
254
334
|
},
|
|
255
|
-
isUser ? /* @__PURE__ */
|
|
256
|
-
), /* @__PURE__ */
|
|
335
|
+
isUser ? /* @__PURE__ */ React5.createElement(User, { className: "w-4 h-4 text-white" }) : /* @__PURE__ */ React5.createElement(Bot, { className: "w-4 h-4" })
|
|
336
|
+
), /* @__PURE__ */ React5.createElement("div", { className: `flex flex-col gap-1 max-w-[90%] ${isUser ? "items-end" : "items-start"}` }, /* @__PURE__ */ React5.createElement(
|
|
257
337
|
"div",
|
|
258
338
|
{
|
|
259
339
|
className: `relative px-4 py-3 rounded-2xl text-sm leading-relaxed shadow-sm dark:shadow-lg ${isUser ? "text-white rounded-tr-sm" : "bg-white dark:bg-white/5 border border-slate-200 dark:border-white/10 text-slate-800 dark:text-white/90 rounded-tl-sm"}`,
|
|
260
340
|
style: isUser ? { background: `linear-gradient(135deg, ${primaryColor}, ${accentColor})` } : {}
|
|
261
341
|
},
|
|
262
|
-
isStreaming && !message.content ? /* @__PURE__ */
|
|
263
|
-
|
|
342
|
+
isStreaming && !message.content ? /* @__PURE__ */ React5.createElement("span", { className: "flex items-center gap-1 py-1" }, /* @__PURE__ */ React5.createElement("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-400 dark:bg-white/60 animate-bounce [animation-delay:0ms]" }), /* @__PURE__ */ React5.createElement("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-400 dark:bg-white/60 animate-bounce [animation-delay:150ms]" }), /* @__PURE__ */ React5.createElement("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-400 dark:bg-white/60 animate-bounce [animation-delay:300ms]" })) : /* @__PURE__ */ React5.createElement("div", { className: `prose prose-sm max-w-none ${isUser ? "prose-invert" : "dark:prose-invert"}` }, /* @__PURE__ */ React5.createElement(
|
|
343
|
+
ReactMarkdown,
|
|
344
|
+
{
|
|
345
|
+
remarkPlugins: [remarkGfm],
|
|
346
|
+
components: {
|
|
347
|
+
table: (_a) => {
|
|
348
|
+
var props = __objRest(_a, []);
|
|
349
|
+
return /* @__PURE__ */ React5.createElement("div", { className: "overflow-x-auto my-4 rounded-xl border border-slate-200 dark:border-white/10 shadow-sm" }, /* @__PURE__ */ React5.createElement("table", __spreadValues({ className: "w-full text-left border-collapse min-w-[400px]" }, props)));
|
|
350
|
+
},
|
|
351
|
+
thead: (_b) => {
|
|
352
|
+
var props = __objRest(_b, []);
|
|
353
|
+
return /* @__PURE__ */ React5.createElement("thead", __spreadValues({ className: "bg-slate-50 dark:bg-white/5 border-b border-slate-200 dark:border-white/10" }, props));
|
|
354
|
+
},
|
|
355
|
+
th: (_c) => {
|
|
356
|
+
var props = __objRest(_c, []);
|
|
357
|
+
return /* @__PURE__ */ React5.createElement("th", __spreadValues({ className: "p-3 font-semibold text-slate-700 dark:text-white/90 first:rounded-tl-xl last:rounded-tr-xl" }, props));
|
|
358
|
+
},
|
|
359
|
+
td: (_d) => {
|
|
360
|
+
var props = __objRest(_d, []);
|
|
361
|
+
return /* @__PURE__ */ React5.createElement("td", __spreadValues({ className: "p-3 border-b border-slate-100 dark:border-white/5 last:border-0 text-slate-600 dark:text-white/70" }, props));
|
|
362
|
+
},
|
|
363
|
+
code(_e) {
|
|
364
|
+
var _f = _e, { inline, className, children } = _f, props = __objRest(_f, ["inline", "className", "children"]);
|
|
365
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
366
|
+
const isChart = match && match[1] === "chart";
|
|
367
|
+
if (!inline && isChart) {
|
|
368
|
+
try {
|
|
369
|
+
const config = JSON.parse(String(children).replace(/\n$/, ""));
|
|
370
|
+
return /* @__PURE__ */ React5.createElement("div", { className: "my-4 p-4 bg-white dark:bg-slate-900 rounded-xl border border-slate-200 dark:border-white/10 shadow-sm" }, /* @__PURE__ */ React5.createElement(
|
|
371
|
+
DynamicChart,
|
|
372
|
+
{
|
|
373
|
+
config,
|
|
374
|
+
primaryColor,
|
|
375
|
+
accentColor
|
|
376
|
+
}
|
|
377
|
+
));
|
|
378
|
+
} catch (e) {
|
|
379
|
+
return /* @__PURE__ */ React5.createElement("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 rounded-lg text-sm" }, "Failed to render chart: Invalid configuration.");
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return /* @__PURE__ */ React5.createElement("code", __spreadValues({ className }, props), children);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
cleanContent || message.content
|
|
387
|
+
), isStreaming && message.content && /* @__PURE__ */ React5.createElement("span", { className: "inline-block w-1.5 h-3.5 ml-1 bg-emerald-500 animate-pulse align-middle" }))
|
|
388
|
+
), !isUser && hasProducts && /* @__PURE__ */ React5.createElement("div", { className: "w-full mt-1" }, /* @__PURE__ */ React5.createElement(
|
|
264
389
|
ProductCarousel,
|
|
265
390
|
{
|
|
266
391
|
products: allProducts,
|
|
267
392
|
primaryColor,
|
|
268
393
|
onAddToCart
|
|
269
394
|
}
|
|
270
|
-
)), !isUser && sources && sources.length > 0 && /* @__PURE__ */
|
|
395
|
+
)), !isUser && sources && sources.length > 0 && /* @__PURE__ */ React5.createElement("div", { className: "w-full" }, /* @__PURE__ */ React5.createElement(
|
|
271
396
|
"button",
|
|
272
397
|
{
|
|
273
398
|
onClick: () => setShowSources((s) => !s),
|
|
274
399
|
className: "text-[11px] text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-1 mt-1"
|
|
275
400
|
},
|
|
276
|
-
showSources ? /* @__PURE__ */
|
|
401
|
+
showSources ? /* @__PURE__ */ React5.createElement(ChevronDown2, { className: "w-3 h-3" }) : /* @__PURE__ */ React5.createElement(ChevronRight2, { className: "w-3 h-3" }),
|
|
277
402
|
sources.length,
|
|
278
403
|
" source",
|
|
279
404
|
sources.length !== 1 ? "s" : "",
|
|
280
405
|
" used"
|
|
281
|
-
), showSources && /* @__PURE__ */
|
|
406
|
+
), showSources && /* @__PURE__ */ React5.createElement("div", { className: "mt-2 flex flex-col gap-2" }, sources.map((src, i) => /* @__PURE__ */ React5.createElement(SourceCard, { key: src.id, source: src, index: i }))))));
|
|
282
407
|
}
|
|
283
408
|
|
|
284
409
|
// src/components/ConfigProvider.tsx
|
|
285
|
-
import
|
|
410
|
+
import React6, { createContext, useContext } from "react";
|
|
286
411
|
|
|
287
412
|
// src/config/uiConstants.ts
|
|
288
413
|
var DEFAULT_CONFIG = {
|
|
@@ -329,7 +454,7 @@ function ConfigProvider({
|
|
|
329
454
|
projectId: (config == null ? void 0 : config.projectId) || DEFAULT_CONFIG.projectId,
|
|
330
455
|
ui: mergeDefined(DEFAULT_CONFIG.ui, config == null ? void 0 : config.ui)
|
|
331
456
|
};
|
|
332
|
-
return /* @__PURE__ */
|
|
457
|
+
return /* @__PURE__ */ React6.createElement(ConfigContext.Provider, { value: merged }, children);
|
|
333
458
|
}
|
|
334
459
|
function useConfig() {
|
|
335
460
|
return useContext(ConfigContext);
|
|
@@ -339,7 +464,7 @@ function useConfig() {
|
|
|
339
464
|
import { useState as useState3, useCallback, useRef as useRef2, useEffect as useEffect3 } from "react";
|
|
340
465
|
|
|
341
466
|
// src/hooks/useStoredMessages.ts
|
|
342
|
-
import * as
|
|
467
|
+
import * as React7 from "react";
|
|
343
468
|
function readStoredMessages(storageKey) {
|
|
344
469
|
if (typeof window === "undefined") {
|
|
345
470
|
return [];
|
|
@@ -356,8 +481,8 @@ function readStoredMessages(storageKey) {
|
|
|
356
481
|
}
|
|
357
482
|
}
|
|
358
483
|
function useStoredMessages(storageKey, persist) {
|
|
359
|
-
const [messages, setMessages] =
|
|
360
|
-
|
|
484
|
+
const [messages, setMessages] = React7.useState(() => persist ? readStoredMessages(storageKey) : []);
|
|
485
|
+
React7.useEffect(() => {
|
|
361
486
|
if (!persist || typeof window === "undefined") {
|
|
362
487
|
return;
|
|
363
488
|
}
|
|
@@ -660,83 +785,83 @@ function ChatWindow({
|
|
|
660
785
|
}, 800);
|
|
661
786
|
return () => clearTimeout(timer);
|
|
662
787
|
}, [input, projectId]);
|
|
663
|
-
return /* @__PURE__ */
|
|
788
|
+
return /* @__PURE__ */ React8.createElement(
|
|
664
789
|
"div",
|
|
665
790
|
{
|
|
666
791
|
className: `relative flex flex-col border border-slate-200 dark:border-white/10 shadow-2xl transition-all duration-300 ${currentRadius} ${isGlass ? "bg-white/90 dark:bg-[#0f0f1a]/90 backdrop-blur-xl" : "bg-white dark:bg-[#0f0f1a]"} ${className}`,
|
|
667
792
|
style: __spreadValues({ "--primary": ui.primaryColor, "--accent": ui.accentColor }, style)
|
|
668
793
|
},
|
|
669
|
-
onResizeStart && /* @__PURE__ */
|
|
794
|
+
onResizeStart && /* @__PURE__ */ React8.createElement(
|
|
670
795
|
"div",
|
|
671
796
|
{
|
|
672
797
|
onMouseDown: onResizeStart,
|
|
673
798
|
className: "absolute top-0 left-0 w-6 h-6 cursor-nw-resize z-[100] group flex items-start justify-start p-1",
|
|
674
799
|
title: "Drag to resize"
|
|
675
800
|
},
|
|
676
|
-
/* @__PURE__ */
|
|
801
|
+
/* @__PURE__ */ React8.createElement("div", { className: "w-2.5 h-2.5 border-t-2 border-l-2 border-slate-300 dark:border-white/20 group-hover:border-slate-500 dark:group-hover:border-white/50 transition-colors rounded-tl-[2px]" })
|
|
677
802
|
),
|
|
678
|
-
/* @__PURE__ */
|
|
803
|
+
/* @__PURE__ */ React8.createElement(
|
|
679
804
|
"div",
|
|
680
805
|
{
|
|
681
806
|
className: "flex items-center justify-between px-5 py-4 border-b border-slate-200 dark:border-white/10",
|
|
682
807
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}15, ${ui.accentColor}10)` }
|
|
683
808
|
},
|
|
684
|
-
/* @__PURE__ */
|
|
809
|
+
/* @__PURE__ */ React8.createElement("div", { className: "flex items-center gap-3" }, ui.logoUrl ? (
|
|
685
810
|
// eslint-disable-next-line @next/next/no-img-element
|
|
686
|
-
/* @__PURE__ */
|
|
687
|
-
) : /* @__PURE__ */
|
|
811
|
+
/* @__PURE__ */ React8.createElement("img", { src: ui.logoUrl, alt: "logo", className: "w-8 h-8 rounded-lg object-cover" })
|
|
812
|
+
) : /* @__PURE__ */ React8.createElement(
|
|
688
813
|
"div",
|
|
689
814
|
{
|
|
690
815
|
className: `w-9 h-9 flex items-center justify-center shadow-md ${ui.borderRadius === "full" ? "rounded-full" : "rounded-xl"}`,
|
|
691
816
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` }
|
|
692
817
|
},
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
), /* @__PURE__ */
|
|
695
|
-
/* @__PURE__ */
|
|
818
|
+
/* @__PURE__ */ React8.createElement(Bot2, { className: "w-5 h-5 text-white" })
|
|
819
|
+
), /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement("h2", { className: "text-slate-900 dark:text-white font-semibold text-sm leading-tight" }, ui.title), ui.poweredBy && /* @__PURE__ */ React8.createElement("p", { className: "text-slate-500 dark:text-white/40 text-[11px] leading-tight" }, `Powered by ${ui.poweredBy}`))),
|
|
820
|
+
/* @__PURE__ */ React8.createElement("div", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ React8.createElement("span", { className: "flex items-center gap-1 text-[10px] text-emerald-500 dark:text-emerald-400 mr-2" }, /* @__PURE__ */ React8.createElement("span", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500 dark:bg-emerald-400 animate-pulse" }), "Online"), /* @__PURE__ */ React8.createElement("div", { className: "flex items-center bg-slate-100/50 dark:bg-white/5 rounded-lg p-0.5 border border-slate-200/50 dark:border-white/5" }, mounted && messages.length > 0 && /* @__PURE__ */ React8.createElement(
|
|
696
821
|
"button",
|
|
697
822
|
{
|
|
698
823
|
onClick: clearHistory,
|
|
699
824
|
title: "Clear conversation",
|
|
700
825
|
className: "w-7 h-7 rounded-md flex items-center justify-center text-slate-400 hover:text-rose-500 dark:text-white/40 dark:hover:text-rose-400 hover:bg-white dark:hover:bg-white/10 transition-all cursor-pointer"
|
|
701
826
|
},
|
|
702
|
-
/* @__PURE__ */
|
|
703
|
-
), isResized && onResetResize && /* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ React8.createElement(Trash2, { className: "w-3.5 h-3.5" })
|
|
828
|
+
), isResized && onResetResize && /* @__PURE__ */ React8.createElement(
|
|
704
829
|
"button",
|
|
705
830
|
{
|
|
706
831
|
onClick: onResetResize,
|
|
707
832
|
title: "Reset to default size",
|
|
708
833
|
className: "w-7 h-7 rounded-md flex items-center justify-center text-slate-400 hover:text-blue-500 dark:text-white/40 dark:hover:text-blue-400 hover:bg-white dark:hover:bg-white/10 transition-all cursor-pointer"
|
|
709
834
|
},
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
), onMaximize && /* @__PURE__ */
|
|
835
|
+
/* @__PURE__ */ React8.createElement(RotateCcw, { className: "w-3.5 h-3.5" })
|
|
836
|
+
), onMaximize && /* @__PURE__ */ React8.createElement(
|
|
712
837
|
"button",
|
|
713
838
|
{
|
|
714
839
|
onClick: onMaximize,
|
|
715
840
|
title: isMaximized ? "Minimize" : "Maximize",
|
|
716
841
|
className: "w-7 h-7 rounded-md flex items-center justify-center text-slate-400 hover:text-blue-500 dark:text-white/40 dark:hover:text-blue-400 hover:bg-white dark:hover:bg-white/10 transition-all cursor-pointer"
|
|
717
842
|
},
|
|
718
|
-
isMaximized ? /* @__PURE__ */
|
|
719
|
-
), showClose && onClose && /* @__PURE__ */
|
|
843
|
+
isMaximized ? /* @__PURE__ */ React8.createElement(Minimize2, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ React8.createElement(Maximize2, { className: "w-3.5 h-3.5" })
|
|
844
|
+
), showClose && onClose && /* @__PURE__ */ React8.createElement(
|
|
720
845
|
"button",
|
|
721
846
|
{
|
|
722
847
|
onClick: onClose,
|
|
723
848
|
title: "Close chat",
|
|
724
849
|
className: "w-7 h-7 rounded-md flex items-center justify-center text-slate-400 hover:text-slate-600 dark:text-white/40 dark:hover:text-white/70 hover:bg-white dark:hover:bg-white/10 transition-all cursor-pointer"
|
|
725
850
|
},
|
|
726
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ React8.createElement(X, { className: "w-4 h-4" })
|
|
727
852
|
)))
|
|
728
853
|
),
|
|
729
|
-
/* @__PURE__ */
|
|
854
|
+
/* @__PURE__ */ React8.createElement("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5 scrollbar-thin scrollbar-thumb-slate-200 dark:scrollbar-thumb-white/10 scrollbar-track-transparent min-h-0 bg-slate-50 dark:bg-transparent" }, !mounted || isEmpty ? (
|
|
730
855
|
/* Welcome state */
|
|
731
|
-
/* @__PURE__ */
|
|
856
|
+
/* @__PURE__ */ React8.createElement("div", { className: "h-full flex flex-col items-center justify-center text-center gap-4 px-6 py-12" }, /* @__PURE__ */ React8.createElement(
|
|
732
857
|
"div",
|
|
733
858
|
{
|
|
734
859
|
className: `w-16 h-16 flex items-center justify-center shadow-lg ${ui.borderRadius === "full" ? "rounded-full" : "rounded-2xl"}`,
|
|
735
860
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` }
|
|
736
861
|
},
|
|
737
|
-
/* @__PURE__ */
|
|
738
|
-
), /* @__PURE__ */
|
|
739
|
-
(suggestion) => /* @__PURE__ */
|
|
862
|
+
/* @__PURE__ */ React8.createElement(Sparkles, { className: "w-8 h-8 text-white" })
|
|
863
|
+
), /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement("p", { className: "text-slate-800 dark:text-white/80 font-medium leading-relaxed" }, ui.welcomeMessage), /* @__PURE__ */ React8.createElement("p", { className: "text-slate-500 dark:text-white/30 text-sm mt-2" }, "Ask a question to get started")), /* @__PURE__ */ React8.createElement("div", { className: "flex flex-wrap gap-2 justify-center mt-2" }, CHAT_SUGGESTIONS.map(
|
|
864
|
+
(suggestion) => /* @__PURE__ */ React8.createElement(
|
|
740
865
|
"button",
|
|
741
866
|
{
|
|
742
867
|
key: suggestion,
|
|
@@ -750,7 +875,7 @@ function ChatWindow({
|
|
|
750
875
|
suggestion
|
|
751
876
|
)
|
|
752
877
|
)))
|
|
753
|
-
) : messages.map((msg, index) => /* @__PURE__ */
|
|
878
|
+
) : messages.map((msg, index) => /* @__PURE__ */ React8.createElement(
|
|
754
879
|
MessageBubble,
|
|
755
880
|
{
|
|
756
881
|
key: msg.id,
|
|
@@ -761,7 +886,7 @@ function ChatWindow({
|
|
|
761
886
|
accentColor: ui.accentColor,
|
|
762
887
|
onAddToCart
|
|
763
888
|
}
|
|
764
|
-
)), isLoading && ((_a = messages[messages.length - 1]) == null ? void 0 : _a.role) !== "assistant" && /* @__PURE__ */
|
|
889
|
+
)), isLoading && ((_a = messages[messages.length - 1]) == null ? void 0 : _a.role) !== "assistant" && /* @__PURE__ */ React8.createElement(
|
|
765
890
|
MessageBubble,
|
|
766
891
|
{
|
|
767
892
|
message: { id: "loading", role: "assistant", content: "", createdAt: (/* @__PURE__ */ new Date()).toISOString() },
|
|
@@ -770,8 +895,8 @@ function ChatWindow({
|
|
|
770
895
|
accentColor: ui.accentColor,
|
|
771
896
|
onAddToCart
|
|
772
897
|
}
|
|
773
|
-
), error && /* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
898
|
+
), error && /* @__PURE__ */ React8.createElement("div", { className: "flex items-center gap-2 text-rose-500 dark:text-rose-400 text-sm bg-rose-50 dark:bg-rose-400/10 border border-rose-200 dark:border-rose-400/20 rounded-xl px-4 py-3" }, /* @__PURE__ */ React8.createElement(TriangleAlert, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ React8.createElement("span", null, error)), /* @__PURE__ */ React8.createElement("div", { ref: bottomRef })),
|
|
899
|
+
/* @__PURE__ */ React8.createElement("div", { className: `px-4 pb-4 pt-2 border-t border-slate-200 dark:border-white/10 ${isGlass ? "bg-transparent" : "bg-white dark:bg-[#0f0f1a]"}` }, (suggestions.length > 0 || isSuggesting) && !isLoading && /* @__PURE__ */ React8.createElement("div", { className: "mb-3 flex flex-wrap gap-2 animate-in fade-in slide-in-from-bottom-2 duration-300" }, suggestions.map((suggestion) => /* @__PURE__ */ React8.createElement(
|
|
775
900
|
"button",
|
|
776
901
|
{
|
|
777
902
|
key: suggestion,
|
|
@@ -783,9 +908,9 @@ function ChatWindow({
|
|
|
783
908
|
},
|
|
784
909
|
className: "flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-medium bg-white dark:bg-white/5 border border-slate-200 dark:border-white/10 text-slate-600 dark:text-white/60 hover:text-slate-900 dark:hover:text-white/90 hover:border-slate-300 dark:hover:border-white/20 transition-all shadow-sm cursor-pointer group"
|
|
785
910
|
},
|
|
786
|
-
/* @__PURE__ */
|
|
911
|
+
/* @__PURE__ */ React8.createElement(Sparkles, { className: "w-3 h-3 text-amber-400" }),
|
|
787
912
|
suggestion
|
|
788
|
-
)), isSuggesting && suggestions.length === 0 && /* @__PURE__ */
|
|
913
|
+
)), isSuggesting && suggestions.length === 0 && /* @__PURE__ */ React8.createElement("div", { className: "flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-medium text-slate-400 dark:text-white/30 animate-pulse" }, /* @__PURE__ */ React8.createElement(Sparkles, { className: "w-3 h-3" }), "Thinking...")), /* @__PURE__ */ React8.createElement("div", { className: `flex items-end gap-2 bg-slate-50 dark:bg-white/5 border border-slate-200 dark:border-white/10 p-2 focus-within:border-slate-300 dark:focus-within:border-white/20 transition-all ${ui.borderRadius === "full" ? "rounded-3xl" : "rounded-2xl"}` }, /* @__PURE__ */ React8.createElement(
|
|
789
914
|
"textarea",
|
|
790
915
|
{
|
|
791
916
|
ref: inputRef,
|
|
@@ -804,16 +929,17 @@ function ChatWindow({
|
|
|
804
929
|
className: "flex-1 bg-transparent text-slate-900 dark:text-white/90 placeholder-slate-400 dark:placeholder-white/30 text-sm resize-none outline-none py-1.5 px-2 max-h-32 leading-relaxed disabled:opacity-50",
|
|
805
930
|
style: { scrollbarWidth: "none" }
|
|
806
931
|
}
|
|
807
|
-
), ui.enableVoiceInput !== false && /* @__PURE__ */
|
|
932
|
+
), ui.enableVoiceInput !== false && /* @__PURE__ */ React8.createElement(
|
|
808
933
|
"button",
|
|
809
934
|
{
|
|
810
935
|
type: "button",
|
|
811
936
|
onClick: toggleListening,
|
|
812
|
-
|
|
937
|
+
disabled: isLoading,
|
|
938
|
+
className: `flex-shrink-0 w-9 h-9 rounded-xl flex items-center justify-center transition-all hover:scale-105 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100 disabled:active:scale-100 ${isListening ? "bg-rose-500 text-white animate-pulse shadow-md shadow-rose-500/20" : "text-slate-400 dark:text-white/40 hover:bg-slate-200 dark:hover:bg-white/10"}`,
|
|
813
939
|
title: isListening ? "Stop listening" : "Start voice input"
|
|
814
940
|
},
|
|
815
|
-
isListening ? /* @__PURE__ */
|
|
816
|
-
), /* @__PURE__ */
|
|
941
|
+
isListening ? /* @__PURE__ */ React8.createElement(MicOff, { className: "w-4 h-4" }) : /* @__PURE__ */ React8.createElement(Mic, { className: "w-4 h-4" })
|
|
942
|
+
), /* @__PURE__ */ React8.createElement(
|
|
817
943
|
"button",
|
|
818
944
|
{
|
|
819
945
|
onClick: sendMessage,
|
|
@@ -824,8 +950,8 @@ function ChatWindow({
|
|
|
824
950
|
// slate-400/20 for light mode disabled
|
|
825
951
|
}
|
|
826
952
|
},
|
|
827
|
-
/* @__PURE__ */
|
|
828
|
-
)), /* @__PURE__ */
|
|
953
|
+
/* @__PURE__ */ React8.createElement(ArrowUp, { className: "w-4 h-4 text-white" })
|
|
954
|
+
)), /* @__PURE__ */ React8.createElement("p", { className: "text-center text-[10px] text-slate-400 dark:text-white/20 mt-2" }, "Press Enter to send \xB7 Shift+Enter for new line"))
|
|
829
955
|
);
|
|
830
956
|
}
|
|
831
957
|
|
|
@@ -888,7 +1014,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
|
|
|
888
1014
|
}
|
|
889
1015
|
};
|
|
890
1016
|
const isResized = dimensions.width !== DEFAULT_DIMENSIONS.width || dimensions.height !== DEFAULT_DIMENSIONS.height;
|
|
891
|
-
return /* @__PURE__ */
|
|
1017
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
|
|
892
1018
|
"div",
|
|
893
1019
|
{
|
|
894
1020
|
className: `fixed z-[9998] max-w-[calc(100vw-3rem)] ease-in-out ${windowPositionClass} ${isOpen ? "opacity-100 translate-y-0 pointer-events-auto" : "opacity-0 translate-y-4 pointer-events-none"} ${isResizing ? "" : "transition-all duration-300"}`,
|
|
@@ -898,7 +1024,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
|
|
|
898
1024
|
maxHeight: "calc(100vh - 6rem)"
|
|
899
1025
|
}
|
|
900
1026
|
},
|
|
901
|
-
/* @__PURE__ */
|
|
1027
|
+
/* @__PURE__ */ React9.createElement(
|
|
902
1028
|
ChatWindow,
|
|
903
1029
|
{
|
|
904
1030
|
className: "h-full relative z-10",
|
|
@@ -912,13 +1038,13 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
|
|
|
912
1038
|
onAddToCart
|
|
913
1039
|
}
|
|
914
1040
|
),
|
|
915
|
-
/* @__PURE__ */
|
|
1041
|
+
/* @__PURE__ */ React9.createElement(
|
|
916
1042
|
"div",
|
|
917
1043
|
{
|
|
918
1044
|
className: `absolute -bottom-1.5 w-4 h-4 rotate-45 border-r border-b border-slate-200 dark:border-white/10 z-0 ${ui.visualStyle === "solid" ? "bg-white dark:bg-[#0f0f1a]" : "bg-white/90 dark:bg-[#0f0f1a]/90 backdrop-blur-xl"} ${position === "bottom-left" ? "left-5" : "right-5"}`
|
|
919
1045
|
}
|
|
920
1046
|
)
|
|
921
|
-
), /* @__PURE__ */
|
|
1047
|
+
), /* @__PURE__ */ React9.createElement(
|
|
922
1048
|
"button",
|
|
923
1049
|
{
|
|
924
1050
|
onClick: isOpen ? () => setIsOpen(false) : handleOpen,
|
|
@@ -926,26 +1052,26 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
|
|
|
926
1052
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` },
|
|
927
1053
|
"aria-label": "Open chat"
|
|
928
1054
|
},
|
|
929
|
-
/* @__PURE__ */
|
|
1055
|
+
/* @__PURE__ */ React9.createElement(
|
|
930
1056
|
"span",
|
|
931
1057
|
{
|
|
932
1058
|
className: "absolute inset-0 rounded-full animate-ping opacity-20",
|
|
933
1059
|
style: { background: ui.primaryColor }
|
|
934
1060
|
}
|
|
935
1061
|
),
|
|
936
|
-
/* @__PURE__ */
|
|
1062
|
+
/* @__PURE__ */ React9.createElement(
|
|
937
1063
|
"span",
|
|
938
1064
|
{
|
|
939
1065
|
className: `transition-transform duration-300 ${isOpen ? "rotate-90 scale-90" : "rotate-0 scale-100"}`
|
|
940
1066
|
},
|
|
941
|
-
isOpen ? /* @__PURE__ */
|
|
1067
|
+
isOpen ? /* @__PURE__ */ React9.createElement(X2, { className: "w-6 h-6 text-white" }) : /* @__PURE__ */ React9.createElement(MessageSquare, { className: "w-6 h-6 text-white" })
|
|
942
1068
|
),
|
|
943
|
-
hasUnread && !isOpen && /* @__PURE__ */
|
|
1069
|
+
hasUnread && !isOpen && /* @__PURE__ */ React9.createElement("span", { className: "absolute top-0 right-0 w-4 h-4 bg-rose-500 rounded-full border-2 border-white flex items-center justify-center text-[9px] font-bold text-white" }, "1")
|
|
944
1070
|
));
|
|
945
1071
|
}
|
|
946
1072
|
|
|
947
1073
|
// src/components/DocumentUpload.tsx
|
|
948
|
-
import
|
|
1074
|
+
import React10, { useState as useState6, useRef as useRef4 } from "react";
|
|
949
1075
|
import { Upload, File, X as X3, CheckCircle, AlertCircle, Loader2 } from "lucide-react";
|
|
950
1076
|
function DocumentUpload({ namespace, onUploadComplete, className = "" }) {
|
|
951
1077
|
const { ui } = useConfig();
|
|
@@ -1001,7 +1127,7 @@ function DocumentUpload({ namespace, onUploadComplete, className = "" }) {
|
|
|
1001
1127
|
};
|
|
1002
1128
|
const isUploading = fileStates.some((s) => s.status === "uploading");
|
|
1003
1129
|
const hasIdle = fileStates.some((s) => s.status === "idle");
|
|
1004
|
-
return /* @__PURE__ */
|
|
1130
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1005
1131
|
"div",
|
|
1006
1132
|
{
|
|
1007
1133
|
className: `p-6 border-2 border-dashed transition-all duration-300 rounded-2xl ${isDragging ? "border-emerald-500 bg-emerald-50/50 dark:bg-emerald-500/5" : "border-slate-200 dark:border-white/10 bg-white dark:bg-white/5"} ${className}`,
|
|
@@ -1009,14 +1135,14 @@ function DocumentUpload({ namespace, onUploadComplete, className = "" }) {
|
|
|
1009
1135
|
onDragLeave,
|
|
1010
1136
|
onDrop
|
|
1011
1137
|
},
|
|
1012
|
-
/* @__PURE__ */
|
|
1138
|
+
/* @__PURE__ */ React10.createElement("div", { className: "flex flex-col items-center justify-center text-center" }, /* @__PURE__ */ React10.createElement(
|
|
1013
1139
|
"div",
|
|
1014
1140
|
{
|
|
1015
1141
|
className: "w-12 h-12 rounded-full flex items-center justify-center mb-4 shadow-sm",
|
|
1016
1142
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}20, ${ui.accentColor}20)` }
|
|
1017
1143
|
},
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
), /* @__PURE__ */
|
|
1144
|
+
/* @__PURE__ */ React10.createElement(Upload, { className: "w-6 h-6", style: { color: ui.primaryColor } })
|
|
1145
|
+
), /* @__PURE__ */ React10.createElement("h3", { className: "text-slate-900 dark:text-white font-semibold mb-1" }, "Upload Documents"), /* @__PURE__ */ React10.createElement("p", { className: "text-slate-500 dark:text-white/40 text-sm mb-6 max-w-xs" }, "Drag and drop PDF, DOCX, TXT, or JSON files to train your AI on your own data."), /* @__PURE__ */ React10.createElement(
|
|
1020
1146
|
"button",
|
|
1021
1147
|
{
|
|
1022
1148
|
onClick: () => {
|
|
@@ -1032,7 +1158,7 @@ function DocumentUpload({ namespace, onUploadComplete, className = "" }) {
|
|
|
1032
1158
|
}
|
|
1033
1159
|
},
|
|
1034
1160
|
"Select Files"
|
|
1035
|
-
), /* @__PURE__ */
|
|
1161
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1036
1162
|
"input",
|
|
1037
1163
|
{
|
|
1038
1164
|
ref: fileInputRef,
|
|
@@ -1043,22 +1169,22 @@ function DocumentUpload({ namespace, onUploadComplete, className = "" }) {
|
|
|
1043
1169
|
accept: ".pdf,.docx,.txt,.md,.json,.csv"
|
|
1044
1170
|
}
|
|
1045
1171
|
)),
|
|
1046
|
-
fileStates.length > 0 && /* @__PURE__ */
|
|
1172
|
+
fileStates.length > 0 && /* @__PURE__ */ React10.createElement("div", { className: "mt-8 space-y-3" }, fileStates.map((state, i) => /* @__PURE__ */ React10.createElement(
|
|
1047
1173
|
"div",
|
|
1048
1174
|
{
|
|
1049
1175
|
key: i,
|
|
1050
1176
|
className: "flex items-center justify-between p-3 rounded-xl bg-slate-50 dark:bg-white/5 border border-slate-100 dark:border-white/10"
|
|
1051
1177
|
},
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
/* @__PURE__ */
|
|
1178
|
+
/* @__PURE__ */ React10.createElement("div", { className: "flex items-center gap-3 overflow-hidden" }, /* @__PURE__ */ React10.createElement("div", { className: "w-8 h-8 rounded-lg bg-white dark:bg-white/10 flex items-center justify-center shadow-sm" }, /* @__PURE__ */ React10.createElement(File, { className: "w-4 h-4 text-slate-400" })), /* @__PURE__ */ React10.createElement("div", { className: "truncate" }, /* @__PURE__ */ React10.createElement("p", { className: "text-xs font-medium text-slate-700 dark:text-white/80 truncate" }, state.file.name), /* @__PURE__ */ React10.createElement("p", { className: "text-[10px] text-slate-400" }, (state.file.size / 1024).toFixed(1), " KB"))),
|
|
1179
|
+
/* @__PURE__ */ React10.createElement("div", { className: "flex items-center gap-2" }, state.status === "uploading" && /* @__PURE__ */ React10.createElement(Loader2, { className: "w-4 h-4 text-slate-400 animate-spin" }), state.status === "success" && /* @__PURE__ */ React10.createElement(CheckCircle, { className: "w-4 h-4 text-emerald-500" }), state.status === "error" && /* @__PURE__ */ React10.createElement("div", { title: state.error }, /* @__PURE__ */ React10.createElement(AlertCircle, { className: "w-4 h-4 text-rose-500" })), state.status !== "uploading" && /* @__PURE__ */ React10.createElement(
|
|
1054
1180
|
"button",
|
|
1055
1181
|
{
|
|
1056
1182
|
onClick: () => removeFile(i),
|
|
1057
1183
|
className: "p-1 rounded-md hover:bg-slate-200 dark:hover:bg-white/10 transition-colors"
|
|
1058
1184
|
},
|
|
1059
|
-
/* @__PURE__ */
|
|
1185
|
+
/* @__PURE__ */ React10.createElement(X3, { className: "w-3.5 h-3.5 text-slate-400" })
|
|
1060
1186
|
))
|
|
1061
|
-
)), hasIdle && !isUploading && /* @__PURE__ */
|
|
1187
|
+
)), hasIdle && !isUploading && /* @__PURE__ */ React10.createElement(
|
|
1062
1188
|
"button",
|
|
1063
1189
|
{
|
|
1064
1190
|
onClick: uploadFiles,
|