@retrivora-ai/rag-engine 1.2.2 → 1.2.4
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-X4TMJV23.mjs} +39 -3
- package/dist/handlers/index.js +39 -3
- package/dist/handlers/index.mjs +1 -1
- package/dist/index.js +231 -106
- package/dist/index.mjs +201 -73
- package/dist/server.js +39 -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 +54 -1
- package/src/core/LangChainAgent.ts +21 -2
- package/src/core/Pipeline.ts +18 -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,90 @@ 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
|
+
const rawContent = String(children).trim();
|
|
369
|
+
try {
|
|
370
|
+
const config = JSON.parse(rawContent);
|
|
371
|
+
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(
|
|
372
|
+
DynamicChart,
|
|
373
|
+
{
|
|
374
|
+
config,
|
|
375
|
+
primaryColor,
|
|
376
|
+
accentColor
|
|
377
|
+
}
|
|
378
|
+
));
|
|
379
|
+
} catch (err) {
|
|
380
|
+
console.error("[MessageBubble] Chart parsing failed:", err, "\nRaw content:", rawContent);
|
|
381
|
+
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 border border-red-100 dark:border-red-900/30" }, /* @__PURE__ */ React5.createElement("p", { className: "font-medium mb-1" }, "Failed to render chart"), /* @__PURE__ */ React5.createElement("p", { className: "opacity-70 text-xs" }, "The generated configuration is invalid. Check console for details."));
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return /* @__PURE__ */ React5.createElement("code", __spreadValues({ className }, props), children);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
cleanContent || message.content
|
|
389
|
+
), 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" }))
|
|
390
|
+
), !isUser && hasProducts && /* @__PURE__ */ React5.createElement("div", { className: "w-full mt-1" }, /* @__PURE__ */ React5.createElement(
|
|
264
391
|
ProductCarousel,
|
|
265
392
|
{
|
|
266
393
|
products: allProducts,
|
|
267
394
|
primaryColor,
|
|
268
395
|
onAddToCart
|
|
269
396
|
}
|
|
270
|
-
)), !isUser && sources && sources.length > 0 && /* @__PURE__ */
|
|
397
|
+
)), !isUser && sources && sources.length > 0 && /* @__PURE__ */ React5.createElement("div", { className: "w-full" }, /* @__PURE__ */ React5.createElement(
|
|
271
398
|
"button",
|
|
272
399
|
{
|
|
273
400
|
onClick: () => setShowSources((s) => !s),
|
|
274
401
|
className: "text-[11px] text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-1 mt-1"
|
|
275
402
|
},
|
|
276
|
-
showSources ? /* @__PURE__ */
|
|
403
|
+
showSources ? /* @__PURE__ */ React5.createElement(ChevronDown2, { className: "w-3 h-3" }) : /* @__PURE__ */ React5.createElement(ChevronRight2, { className: "w-3 h-3" }),
|
|
277
404
|
sources.length,
|
|
278
405
|
" source",
|
|
279
406
|
sources.length !== 1 ? "s" : "",
|
|
280
407
|
" used"
|
|
281
|
-
), showSources && /* @__PURE__ */
|
|
408
|
+
), 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
409
|
}
|
|
283
410
|
|
|
284
411
|
// src/components/ConfigProvider.tsx
|
|
285
|
-
import
|
|
412
|
+
import React6, { createContext, useContext } from "react";
|
|
286
413
|
|
|
287
414
|
// src/config/uiConstants.ts
|
|
288
415
|
var DEFAULT_CONFIG = {
|
|
@@ -329,7 +456,7 @@ function ConfigProvider({
|
|
|
329
456
|
projectId: (config == null ? void 0 : config.projectId) || DEFAULT_CONFIG.projectId,
|
|
330
457
|
ui: mergeDefined(DEFAULT_CONFIG.ui, config == null ? void 0 : config.ui)
|
|
331
458
|
};
|
|
332
|
-
return /* @__PURE__ */
|
|
459
|
+
return /* @__PURE__ */ React6.createElement(ConfigContext.Provider, { value: merged }, children);
|
|
333
460
|
}
|
|
334
461
|
function useConfig() {
|
|
335
462
|
return useContext(ConfigContext);
|
|
@@ -339,7 +466,7 @@ function useConfig() {
|
|
|
339
466
|
import { useState as useState3, useCallback, useRef as useRef2, useEffect as useEffect3 } from "react";
|
|
340
467
|
|
|
341
468
|
// src/hooks/useStoredMessages.ts
|
|
342
|
-
import * as
|
|
469
|
+
import * as React7 from "react";
|
|
343
470
|
function readStoredMessages(storageKey) {
|
|
344
471
|
if (typeof window === "undefined") {
|
|
345
472
|
return [];
|
|
@@ -356,8 +483,8 @@ function readStoredMessages(storageKey) {
|
|
|
356
483
|
}
|
|
357
484
|
}
|
|
358
485
|
function useStoredMessages(storageKey, persist) {
|
|
359
|
-
const [messages, setMessages] =
|
|
360
|
-
|
|
486
|
+
const [messages, setMessages] = React7.useState(() => persist ? readStoredMessages(storageKey) : []);
|
|
487
|
+
React7.useEffect(() => {
|
|
361
488
|
if (!persist || typeof window === "undefined") {
|
|
362
489
|
return;
|
|
363
490
|
}
|
|
@@ -660,83 +787,83 @@ function ChatWindow({
|
|
|
660
787
|
}, 800);
|
|
661
788
|
return () => clearTimeout(timer);
|
|
662
789
|
}, [input, projectId]);
|
|
663
|
-
return /* @__PURE__ */
|
|
790
|
+
return /* @__PURE__ */ React8.createElement(
|
|
664
791
|
"div",
|
|
665
792
|
{
|
|
666
793
|
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
794
|
style: __spreadValues({ "--primary": ui.primaryColor, "--accent": ui.accentColor }, style)
|
|
668
795
|
},
|
|
669
|
-
onResizeStart && /* @__PURE__ */
|
|
796
|
+
onResizeStart && /* @__PURE__ */ React8.createElement(
|
|
670
797
|
"div",
|
|
671
798
|
{
|
|
672
799
|
onMouseDown: onResizeStart,
|
|
673
800
|
className: "absolute top-0 left-0 w-6 h-6 cursor-nw-resize z-[100] group flex items-start justify-start p-1",
|
|
674
801
|
title: "Drag to resize"
|
|
675
802
|
},
|
|
676
|
-
/* @__PURE__ */
|
|
803
|
+
/* @__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
804
|
),
|
|
678
|
-
/* @__PURE__ */
|
|
805
|
+
/* @__PURE__ */ React8.createElement(
|
|
679
806
|
"div",
|
|
680
807
|
{
|
|
681
808
|
className: "flex items-center justify-between px-5 py-4 border-b border-slate-200 dark:border-white/10",
|
|
682
809
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}15, ${ui.accentColor}10)` }
|
|
683
810
|
},
|
|
684
|
-
/* @__PURE__ */
|
|
811
|
+
/* @__PURE__ */ React8.createElement("div", { className: "flex items-center gap-3" }, ui.logoUrl ? (
|
|
685
812
|
// eslint-disable-next-line @next/next/no-img-element
|
|
686
|
-
/* @__PURE__ */
|
|
687
|
-
) : /* @__PURE__ */
|
|
813
|
+
/* @__PURE__ */ React8.createElement("img", { src: ui.logoUrl, alt: "logo", className: "w-8 h-8 rounded-lg object-cover" })
|
|
814
|
+
) : /* @__PURE__ */ React8.createElement(
|
|
688
815
|
"div",
|
|
689
816
|
{
|
|
690
817
|
className: `w-9 h-9 flex items-center justify-center shadow-md ${ui.borderRadius === "full" ? "rounded-full" : "rounded-xl"}`,
|
|
691
818
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` }
|
|
692
819
|
},
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
), /* @__PURE__ */
|
|
695
|
-
/* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ React8.createElement(Bot2, { className: "w-5 h-5 text-white" })
|
|
821
|
+
), /* @__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}`))),
|
|
822
|
+
/* @__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
823
|
"button",
|
|
697
824
|
{
|
|
698
825
|
onClick: clearHistory,
|
|
699
826
|
title: "Clear conversation",
|
|
700
827
|
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
828
|
},
|
|
702
|
-
/* @__PURE__ */
|
|
703
|
-
), isResized && onResetResize && /* @__PURE__ */
|
|
829
|
+
/* @__PURE__ */ React8.createElement(Trash2, { className: "w-3.5 h-3.5" })
|
|
830
|
+
), isResized && onResetResize && /* @__PURE__ */ React8.createElement(
|
|
704
831
|
"button",
|
|
705
832
|
{
|
|
706
833
|
onClick: onResetResize,
|
|
707
834
|
title: "Reset to default size",
|
|
708
835
|
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
836
|
},
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
), onMaximize && /* @__PURE__ */
|
|
837
|
+
/* @__PURE__ */ React8.createElement(RotateCcw, { className: "w-3.5 h-3.5" })
|
|
838
|
+
), onMaximize && /* @__PURE__ */ React8.createElement(
|
|
712
839
|
"button",
|
|
713
840
|
{
|
|
714
841
|
onClick: onMaximize,
|
|
715
842
|
title: isMaximized ? "Minimize" : "Maximize",
|
|
716
843
|
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
844
|
},
|
|
718
|
-
isMaximized ? /* @__PURE__ */
|
|
719
|
-
), showClose && onClose && /* @__PURE__ */
|
|
845
|
+
isMaximized ? /* @__PURE__ */ React8.createElement(Minimize2, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ React8.createElement(Maximize2, { className: "w-3.5 h-3.5" })
|
|
846
|
+
), showClose && onClose && /* @__PURE__ */ React8.createElement(
|
|
720
847
|
"button",
|
|
721
848
|
{
|
|
722
849
|
onClick: onClose,
|
|
723
850
|
title: "Close chat",
|
|
724
851
|
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
852
|
},
|
|
726
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ React8.createElement(X, { className: "w-4 h-4" })
|
|
727
854
|
)))
|
|
728
855
|
),
|
|
729
|
-
/* @__PURE__ */
|
|
856
|
+
/* @__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
857
|
/* Welcome state */
|
|
731
|
-
/* @__PURE__ */
|
|
858
|
+
/* @__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
859
|
"div",
|
|
733
860
|
{
|
|
734
861
|
className: `w-16 h-16 flex items-center justify-center shadow-lg ${ui.borderRadius === "full" ? "rounded-full" : "rounded-2xl"}`,
|
|
735
862
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` }
|
|
736
863
|
},
|
|
737
|
-
/* @__PURE__ */
|
|
738
|
-
), /* @__PURE__ */
|
|
739
|
-
(suggestion) => /* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ React8.createElement(Sparkles, { className: "w-8 h-8 text-white" })
|
|
865
|
+
), /* @__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(
|
|
866
|
+
(suggestion) => /* @__PURE__ */ React8.createElement(
|
|
740
867
|
"button",
|
|
741
868
|
{
|
|
742
869
|
key: suggestion,
|
|
@@ -750,7 +877,7 @@ function ChatWindow({
|
|
|
750
877
|
suggestion
|
|
751
878
|
)
|
|
752
879
|
)))
|
|
753
|
-
) : messages.map((msg, index) => /* @__PURE__ */
|
|
880
|
+
) : messages.map((msg, index) => /* @__PURE__ */ React8.createElement(
|
|
754
881
|
MessageBubble,
|
|
755
882
|
{
|
|
756
883
|
key: msg.id,
|
|
@@ -761,7 +888,7 @@ function ChatWindow({
|
|
|
761
888
|
accentColor: ui.accentColor,
|
|
762
889
|
onAddToCart
|
|
763
890
|
}
|
|
764
|
-
)), isLoading && ((_a = messages[messages.length - 1]) == null ? void 0 : _a.role) !== "assistant" && /* @__PURE__ */
|
|
891
|
+
)), isLoading && ((_a = messages[messages.length - 1]) == null ? void 0 : _a.role) !== "assistant" && /* @__PURE__ */ React8.createElement(
|
|
765
892
|
MessageBubble,
|
|
766
893
|
{
|
|
767
894
|
message: { id: "loading", role: "assistant", content: "", createdAt: (/* @__PURE__ */ new Date()).toISOString() },
|
|
@@ -770,8 +897,8 @@ function ChatWindow({
|
|
|
770
897
|
accentColor: ui.accentColor,
|
|
771
898
|
onAddToCart
|
|
772
899
|
}
|
|
773
|
-
), error && /* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
900
|
+
), 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 })),
|
|
901
|
+
/* @__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
902
|
"button",
|
|
776
903
|
{
|
|
777
904
|
key: suggestion,
|
|
@@ -783,9 +910,9 @@ function ChatWindow({
|
|
|
783
910
|
},
|
|
784
911
|
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
912
|
},
|
|
786
|
-
/* @__PURE__ */
|
|
913
|
+
/* @__PURE__ */ React8.createElement(Sparkles, { className: "w-3 h-3 text-amber-400" }),
|
|
787
914
|
suggestion
|
|
788
|
-
)), isSuggesting && suggestions.length === 0 && /* @__PURE__ */
|
|
915
|
+
)), 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
916
|
"textarea",
|
|
790
917
|
{
|
|
791
918
|
ref: inputRef,
|
|
@@ -804,16 +931,17 @@ function ChatWindow({
|
|
|
804
931
|
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
932
|
style: { scrollbarWidth: "none" }
|
|
806
933
|
}
|
|
807
|
-
), ui.enableVoiceInput !== false && /* @__PURE__ */
|
|
934
|
+
), ui.enableVoiceInput !== false && /* @__PURE__ */ React8.createElement(
|
|
808
935
|
"button",
|
|
809
936
|
{
|
|
810
937
|
type: "button",
|
|
811
938
|
onClick: toggleListening,
|
|
812
|
-
|
|
939
|
+
disabled: isLoading,
|
|
940
|
+
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
941
|
title: isListening ? "Stop listening" : "Start voice input"
|
|
814
942
|
},
|
|
815
|
-
isListening ? /* @__PURE__ */
|
|
816
|
-
), /* @__PURE__ */
|
|
943
|
+
isListening ? /* @__PURE__ */ React8.createElement(MicOff, { className: "w-4 h-4" }) : /* @__PURE__ */ React8.createElement(Mic, { className: "w-4 h-4" })
|
|
944
|
+
), /* @__PURE__ */ React8.createElement(
|
|
817
945
|
"button",
|
|
818
946
|
{
|
|
819
947
|
onClick: sendMessage,
|
|
@@ -824,8 +952,8 @@ function ChatWindow({
|
|
|
824
952
|
// slate-400/20 for light mode disabled
|
|
825
953
|
}
|
|
826
954
|
},
|
|
827
|
-
/* @__PURE__ */
|
|
828
|
-
)), /* @__PURE__ */
|
|
955
|
+
/* @__PURE__ */ React8.createElement(ArrowUp, { className: "w-4 h-4 text-white" })
|
|
956
|
+
)), /* @__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
957
|
);
|
|
830
958
|
}
|
|
831
959
|
|
|
@@ -888,7 +1016,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
|
|
|
888
1016
|
}
|
|
889
1017
|
};
|
|
890
1018
|
const isResized = dimensions.width !== DEFAULT_DIMENSIONS.width || dimensions.height !== DEFAULT_DIMENSIONS.height;
|
|
891
|
-
return /* @__PURE__ */
|
|
1019
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
|
|
892
1020
|
"div",
|
|
893
1021
|
{
|
|
894
1022
|
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 +1026,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
|
|
|
898
1026
|
maxHeight: "calc(100vh - 6rem)"
|
|
899
1027
|
}
|
|
900
1028
|
},
|
|
901
|
-
/* @__PURE__ */
|
|
1029
|
+
/* @__PURE__ */ React9.createElement(
|
|
902
1030
|
ChatWindow,
|
|
903
1031
|
{
|
|
904
1032
|
className: "h-full relative z-10",
|
|
@@ -912,13 +1040,13 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
|
|
|
912
1040
|
onAddToCart
|
|
913
1041
|
}
|
|
914
1042
|
),
|
|
915
|
-
/* @__PURE__ */
|
|
1043
|
+
/* @__PURE__ */ React9.createElement(
|
|
916
1044
|
"div",
|
|
917
1045
|
{
|
|
918
1046
|
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
1047
|
}
|
|
920
1048
|
)
|
|
921
|
-
), /* @__PURE__ */
|
|
1049
|
+
), /* @__PURE__ */ React9.createElement(
|
|
922
1050
|
"button",
|
|
923
1051
|
{
|
|
924
1052
|
onClick: isOpen ? () => setIsOpen(false) : handleOpen,
|
|
@@ -926,26 +1054,26 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
|
|
|
926
1054
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` },
|
|
927
1055
|
"aria-label": "Open chat"
|
|
928
1056
|
},
|
|
929
|
-
/* @__PURE__ */
|
|
1057
|
+
/* @__PURE__ */ React9.createElement(
|
|
930
1058
|
"span",
|
|
931
1059
|
{
|
|
932
1060
|
className: "absolute inset-0 rounded-full animate-ping opacity-20",
|
|
933
1061
|
style: { background: ui.primaryColor }
|
|
934
1062
|
}
|
|
935
1063
|
),
|
|
936
|
-
/* @__PURE__ */
|
|
1064
|
+
/* @__PURE__ */ React9.createElement(
|
|
937
1065
|
"span",
|
|
938
1066
|
{
|
|
939
1067
|
className: `transition-transform duration-300 ${isOpen ? "rotate-90 scale-90" : "rotate-0 scale-100"}`
|
|
940
1068
|
},
|
|
941
|
-
isOpen ? /* @__PURE__ */
|
|
1069
|
+
isOpen ? /* @__PURE__ */ React9.createElement(X2, { className: "w-6 h-6 text-white" }) : /* @__PURE__ */ React9.createElement(MessageSquare, { className: "w-6 h-6 text-white" })
|
|
942
1070
|
),
|
|
943
|
-
hasUnread && !isOpen && /* @__PURE__ */
|
|
1071
|
+
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
1072
|
));
|
|
945
1073
|
}
|
|
946
1074
|
|
|
947
1075
|
// src/components/DocumentUpload.tsx
|
|
948
|
-
import
|
|
1076
|
+
import React10, { useState as useState6, useRef as useRef4 } from "react";
|
|
949
1077
|
import { Upload, File, X as X3, CheckCircle, AlertCircle, Loader2 } from "lucide-react";
|
|
950
1078
|
function DocumentUpload({ namespace, onUploadComplete, className = "" }) {
|
|
951
1079
|
const { ui } = useConfig();
|
|
@@ -1001,7 +1129,7 @@ function DocumentUpload({ namespace, onUploadComplete, className = "" }) {
|
|
|
1001
1129
|
};
|
|
1002
1130
|
const isUploading = fileStates.some((s) => s.status === "uploading");
|
|
1003
1131
|
const hasIdle = fileStates.some((s) => s.status === "idle");
|
|
1004
|
-
return /* @__PURE__ */
|
|
1132
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1005
1133
|
"div",
|
|
1006
1134
|
{
|
|
1007
1135
|
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 +1137,14 @@ function DocumentUpload({ namespace, onUploadComplete, className = "" }) {
|
|
|
1009
1137
|
onDragLeave,
|
|
1010
1138
|
onDrop
|
|
1011
1139
|
},
|
|
1012
|
-
/* @__PURE__ */
|
|
1140
|
+
/* @__PURE__ */ React10.createElement("div", { className: "flex flex-col items-center justify-center text-center" }, /* @__PURE__ */ React10.createElement(
|
|
1013
1141
|
"div",
|
|
1014
1142
|
{
|
|
1015
1143
|
className: "w-12 h-12 rounded-full flex items-center justify-center mb-4 shadow-sm",
|
|
1016
1144
|
style: { background: `linear-gradient(135deg, ${ui.primaryColor}20, ${ui.accentColor}20)` }
|
|
1017
1145
|
},
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
), /* @__PURE__ */
|
|
1146
|
+
/* @__PURE__ */ React10.createElement(Upload, { className: "w-6 h-6", style: { color: ui.primaryColor } })
|
|
1147
|
+
), /* @__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
1148
|
"button",
|
|
1021
1149
|
{
|
|
1022
1150
|
onClick: () => {
|
|
@@ -1032,7 +1160,7 @@ function DocumentUpload({ namespace, onUploadComplete, className = "" }) {
|
|
|
1032
1160
|
}
|
|
1033
1161
|
},
|
|
1034
1162
|
"Select Files"
|
|
1035
|
-
), /* @__PURE__ */
|
|
1163
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1036
1164
|
"input",
|
|
1037
1165
|
{
|
|
1038
1166
|
ref: fileInputRef,
|
|
@@ -1043,22 +1171,22 @@ function DocumentUpload({ namespace, onUploadComplete, className = "" }) {
|
|
|
1043
1171
|
accept: ".pdf,.docx,.txt,.md,.json,.csv"
|
|
1044
1172
|
}
|
|
1045
1173
|
)),
|
|
1046
|
-
fileStates.length > 0 && /* @__PURE__ */
|
|
1174
|
+
fileStates.length > 0 && /* @__PURE__ */ React10.createElement("div", { className: "mt-8 space-y-3" }, fileStates.map((state, i) => /* @__PURE__ */ React10.createElement(
|
|
1047
1175
|
"div",
|
|
1048
1176
|
{
|
|
1049
1177
|
key: i,
|
|
1050
1178
|
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
1179
|
},
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__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"))),
|
|
1181
|
+
/* @__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
1182
|
"button",
|
|
1055
1183
|
{
|
|
1056
1184
|
onClick: () => removeFile(i),
|
|
1057
1185
|
className: "p-1 rounded-md hover:bg-slate-200 dark:hover:bg-white/10 transition-colors"
|
|
1058
1186
|
},
|
|
1059
|
-
/* @__PURE__ */
|
|
1187
|
+
/* @__PURE__ */ React10.createElement(X3, { className: "w-3.5 h-3.5 text-slate-400" })
|
|
1060
1188
|
))
|
|
1061
|
-
)), hasIdle && !isUploading && /* @__PURE__ */
|
|
1189
|
+
)), hasIdle && !isUploading && /* @__PURE__ */ React10.createElement(
|
|
1062
1190
|
"button",
|
|
1063
1191
|
{
|
|
1064
1192
|
onClick: uploadFiles,
|