research-agent-ui 0.1.63 → 0.1.64
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.cjs +11 -11
- package/dist/index.mjs +445 -435
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { clsx as _ } from "clsx";
|
|
|
8
8
|
import { twMerge as v } from "tailwind-merge";
|
|
9
9
|
import y from "markdown-to-jsx";
|
|
10
10
|
import * as b from "lucide-react";
|
|
11
|
-
import { AlertCircle as x, Archive as S, ArrowLeftRight as C, ArrowUp as w, BookMarked as T, Bot as E, BrainCircuit as D, CalendarDays as O, Check as k, CheckIcon as A, ChevronDown as j, ChevronRight as M, ChevronRightIcon as N, ChevronUp as P, Clipboard as F, ClipboardList as I, Clock as
|
|
11
|
+
import { AlertCircle as x, Archive as S, ArrowLeftRight as C, ArrowUp as w, BookMarked as T, Bot as E, BrainCircuit as D, CalendarDays as O, Check as k, CheckIcon as A, ChevronDown as j, ChevronRight as M, ChevronRightIcon as N, ChevronUp as P, Clipboard as F, ClipboardList as I, Clock as L, Cloud as R, CloudIcon as z, Copy as ee, Cpu as te, Download as B, ExternalLink as V, EyeOff as ne, File as re, FileDown as ie, FileSpreadsheet as ae, FileText as oe, FileType as se, FolderOpen as ce, Highlighter as le, History as ue, Link as de, Loader2 as H, Lock as fe, MessageCircleQuestion as pe, Mic as me, Paperclip as he, Pencil as ge, Pin as _e, Plus as ve, Search as ye, Settings as be, Settings2 as xe, Share2 as Se, SlidersHorizontal as Ce, Square as we, SquarePen as Te, Star as Ee, StopCircle as De, Sun as Oe, Trash as ke, Trash2 as Ae, Upload as je, Video as Me, Volume2 as Ne, X as Pe, XIcon as Fe } from "lucide-react";
|
|
12
12
|
import { addFavorite as Ie, agentChat as Le, agentSearch as Re, articleFollowups as ze, articleQa as Be, autocomplete as Ve, createDocument as He, deleteAllChats as Ue, deleteChatById as We, getArticle as Ge, getChatById as Ke, getGoogleDriveFile as qe, getGoogleToken as Je, googleDocsAuth as Ye, googleDocsAuthStatus as Xe, listChats as Ze, listFavorites as Qe, listProviders as $e, removeFavorite as et, saveMessage as tt, searchChats as nt, shareChat as rt, updateArticle as it, uploadFiles as at } from "qwksearch-api-client";
|
|
13
13
|
import { convertURLSafeHTMLToHTML as ot } from "extract-webpage/html-to-content/html-utils";
|
|
14
14
|
import { AnimatePresence as st, animate as ct, motion as lt } from "motion/react";
|
|
@@ -1049,7 +1049,7 @@ var Pt = [
|
|
|
1049
1049
|
children: o === "loading" ? /* @__PURE__ */ W(H, {
|
|
1050
1050
|
size: 14,
|
|
1051
1051
|
className: "text-primary animate-spin"
|
|
1052
|
-
}) : /* @__PURE__ */ W(
|
|
1052
|
+
}) : /* @__PURE__ */ W(oe, {
|
|
1053
1053
|
size: 14,
|
|
1054
1054
|
className: "text-green-500"
|
|
1055
1055
|
})
|
|
@@ -1061,7 +1061,7 @@ var Pt = [
|
|
|
1061
1061
|
onClick: (e) => e.stopPropagation(),
|
|
1062
1062
|
className: "absolute top-1.5 right-1.5 p-1 rounded-md bg-secondary/50 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-secondary z-10",
|
|
1063
1063
|
title: "Open in new tab",
|
|
1064
|
-
children: /* @__PURE__ */ W(
|
|
1064
|
+
children: /* @__PURE__ */ W(V, {
|
|
1065
1065
|
size: 12,
|
|
1066
1066
|
className: "text-muted-foreground"
|
|
1067
1067
|
})
|
|
@@ -1073,7 +1073,7 @@ var Pt = [
|
|
|
1073
1073
|
className: "inline-flex items-center gap-1 font-semibold text-foreground/70 align-middle",
|
|
1074
1074
|
children: [e.metadata.url === "File" ? /* @__PURE__ */ W("span", {
|
|
1075
1075
|
className: "inline-flex items-center justify-center w-3.5 h-3.5 rounded-full bg-secondary flex-shrink-0",
|
|
1076
|
-
children: /* @__PURE__ */ W(
|
|
1076
|
+
children: /* @__PURE__ */ W(re, {
|
|
1077
1077
|
size: 10,
|
|
1078
1078
|
className: "text-muted-foreground"
|
|
1079
1079
|
})
|
|
@@ -1477,21 +1477,23 @@ var cn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
1477
1477
|
} catch {
|
|
1478
1478
|
return [];
|
|
1479
1479
|
}
|
|
1480
|
-
}, dn = 3, fn = () => Array.from(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(7)), (e) => e.toString(16).padStart(2, "0")).join(""),
|
|
1481
|
-
async function
|
|
1482
|
-
let { message: r, messageId: i, rewrite: a = !1 } = e, { chatId: o, loading: s, messages: c, fileIds: l, focusMode: u, category: d, optimizationMode: f, chatHistory: p, chatModelProvider: m, isAuthenticated: h, messagesRef: g, abortControllerRef: _, setLoading: v, setMessageAppeared: y, setMessages: b, setChatHistory: x, setChatModelProvider: S } = n, C = typeof window < "u" && localStorage.getItem(
|
|
1483
|
-
if (s
|
|
1484
|
-
let T =
|
|
1485
|
-
|
|
1486
|
-
let
|
|
1480
|
+
}, dn = 3, fn = "Analyze the uploaded file(s) and summarize the key points.", pn = () => Array.from(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(7)), (e) => e.toString(16).padStart(2, "0")).join(""), mn = "sourceExtractionEnabled", hn = "thinkingTimeLimit";
|
|
1481
|
+
async function gn(e, n) {
|
|
1482
|
+
let { message: r, messageId: i, rewrite: a = !1 } = e, { chatId: o, loading: s, messages: c, fileIds: l, focusMode: u, category: d, optimizationMode: f, chatHistory: p, chatModelProvider: m, isAuthenticated: h, messagesRef: g, abortControllerRef: _, setLoading: v, setMessageAppeared: y, setMessages: b, setChatHistory: x, setChatModelProvider: S } = n, C = typeof window < "u" && localStorage.getItem(mn) === "true", w = typeof window < "u" && Number(localStorage.getItem(hn) ?? "0") || 0;
|
|
1483
|
+
if (s) return;
|
|
1484
|
+
let T = r?.trim() ?? "", E = Array.isArray(l) && l.length > 0;
|
|
1485
|
+
if (!T && !E) return;
|
|
1486
|
+
let D = T ? r : fn, O = new AbortController();
|
|
1487
|
+
_.current = O, v(!0), y(!1), c.length <= 1 && window.history.replaceState(null, "", `/c/${o}`);
|
|
1488
|
+
let k = "", A = !1, j = !1, M = [], N = Date.now(), P = w > 0, F = "", I = "", L = i ?? pn();
|
|
1487
1489
|
b((e) => [...e, {
|
|
1488
|
-
content:
|
|
1489
|
-
messageId:
|
|
1490
|
+
content: D,
|
|
1491
|
+
messageId: L,
|
|
1490
1492
|
chatId: o,
|
|
1491
1493
|
role: "user",
|
|
1492
1494
|
createdAt: /* @__PURE__ */ new Date()
|
|
1493
1495
|
}]);
|
|
1494
|
-
let
|
|
1496
|
+
let R = async (e) => {
|
|
1495
1497
|
if (e.type === "error") {
|
|
1496
1498
|
let t = e.data;
|
|
1497
1499
|
typeof t == "string" && (t.includes("no longer available") || t.includes("deprecated") || t.includes("410")) && (localStorage.removeItem("chatModelKey"), localStorage.removeItem("chatModelProviderId"), S?.({
|
|
@@ -1536,16 +1538,16 @@ async function hn(e, n) {
|
|
|
1536
1538
|
});
|
|
1537
1539
|
});
|
|
1538
1540
|
}
|
|
1539
|
-
if (e.type === "sources" && (
|
|
1541
|
+
if (e.type === "sources" && (M = e.data || [], b((t) => [...t, {
|
|
1540
1542
|
messageId: e.messageId,
|
|
1541
1543
|
chatId: o,
|
|
1542
1544
|
role: "source",
|
|
1543
|
-
sources:
|
|
1545
|
+
sources: M,
|
|
1544
1546
|
createdAt: /* @__PURE__ */ new Date()
|
|
1545
|
-
}]),
|
|
1547
|
+
}]), M.length > 0 && (y(!0), M.slice(0, dn).forEach((e) => {
|
|
1546
1548
|
let t = e?.metadata?.url;
|
|
1547
1549
|
t && t !== "File" && ut(`doc/article?url=${encodeURIComponent(t)}`).catch(() => {});
|
|
1548
|
-
}))), e.type === "message" && (
|
|
1550
|
+
}))), e.type === "message" && (k += e.data, P ? (F += e.data, I ||= e.messageId, A = !0) : A ? b((t) => t.map((t) => t.messageId === e.messageId && t.role === "assistant" ? {
|
|
1549
1551
|
...t,
|
|
1550
1552
|
content: t.content + e.data
|
|
1551
1553
|
} : t)) : (b((t) => [...t, {
|
|
@@ -1554,23 +1556,23 @@ async function hn(e, n) {
|
|
|
1554
1556
|
chatId: o,
|
|
1555
1557
|
role: "assistant",
|
|
1556
1558
|
createdAt: /* @__PURE__ */ new Date()
|
|
1557
|
-
}]),
|
|
1559
|
+
}]), A = !0, y(!0))), e.type === "messageEnd") {
|
|
1558
1560
|
let e = async () => {
|
|
1559
|
-
|
|
1560
|
-
content:
|
|
1561
|
-
messageId:
|
|
1561
|
+
P && F && (b((e) => [...e, {
|
|
1562
|
+
content: F,
|
|
1563
|
+
messageId: I,
|
|
1562
1564
|
chatId: o,
|
|
1563
1565
|
role: "assistant",
|
|
1564
1566
|
createdAt: /* @__PURE__ */ new Date()
|
|
1565
1567
|
}]), y(!0)), x((e) => [
|
|
1566
1568
|
...e,
|
|
1567
|
-
["human",
|
|
1568
|
-
["assistant",
|
|
1569
|
+
["human", D],
|
|
1570
|
+
["assistant", k]
|
|
1569
1571
|
]), v(!1);
|
|
1570
1572
|
let e = g.current[g.current.length - 1];
|
|
1571
|
-
if (t.getAutoMediaSearch() && (document.getElementById(`search-images-${e.messageId}`)?.click(), document.getElementById(`search-videos-${e.messageId}`)?.click()), !
|
|
1572
|
-
|
|
1573
|
-
let e = await un(g.current), t =
|
|
1573
|
+
if (t.getAutoMediaSearch() && (document.getElementById(`search-images-${e.messageId}`)?.click(), document.getElementById(`search-videos-${e.messageId}`)?.click()), !j) {
|
|
1574
|
+
j = !0;
|
|
1575
|
+
let e = await un(g.current), t = pn();
|
|
1574
1576
|
if (b((n) => [...n, {
|
|
1575
1577
|
role: "suggestion",
|
|
1576
1578
|
suggestions: e,
|
|
@@ -1589,26 +1591,26 @@ async function hn(e, n) {
|
|
|
1589
1591
|
}
|
|
1590
1592
|
}
|
|
1591
1593
|
};
|
|
1592
|
-
if (
|
|
1593
|
-
let e = Date.now() -
|
|
1594
|
+
if (P) {
|
|
1595
|
+
let e = Date.now() - N, t = w * 1e3 - e;
|
|
1594
1596
|
t > 0 && await new Promise((e) => setTimeout(e, t));
|
|
1595
1597
|
}
|
|
1596
1598
|
await e();
|
|
1597
1599
|
}
|
|
1598
|
-
},
|
|
1600
|
+
}, z = c.findIndex((e) => e.messageId === L);
|
|
1599
1601
|
try {
|
|
1600
1602
|
let { stream: e } = await Le({
|
|
1601
|
-
signal:
|
|
1603
|
+
signal: O.signal,
|
|
1602
1604
|
body: {
|
|
1603
1605
|
message: {
|
|
1604
|
-
messageId:
|
|
1606
|
+
messageId: L,
|
|
1605
1607
|
chatId: o,
|
|
1606
|
-
content:
|
|
1608
|
+
content: D
|
|
1607
1609
|
},
|
|
1608
1610
|
optimizationMode: f,
|
|
1609
1611
|
focusMode: u,
|
|
1610
1612
|
category: d,
|
|
1611
|
-
history: a ? p.slice(0,
|
|
1613
|
+
history: a ? p.slice(0, z === -1 ? void 0 : z) : p,
|
|
1612
1614
|
files: l,
|
|
1613
1615
|
chatModel: {
|
|
1614
1616
|
key: m.key,
|
|
@@ -1626,19 +1628,19 @@ async function hn(e, n) {
|
|
|
1626
1628
|
K.error("Failed to send message. Please try again."), v(!1);
|
|
1627
1629
|
}
|
|
1628
1630
|
});
|
|
1629
|
-
for await (let t of e) await
|
|
1631
|
+
for await (let t of e) await R(t);
|
|
1630
1632
|
} catch (e) {
|
|
1631
1633
|
if (e.name === "AbortError") {
|
|
1632
|
-
|
|
1633
|
-
content:
|
|
1634
|
-
messageId:
|
|
1634
|
+
P && F && (b((e) => [...e, {
|
|
1635
|
+
content: F,
|
|
1636
|
+
messageId: I,
|
|
1635
1637
|
chatId: o,
|
|
1636
1638
|
role: "assistant",
|
|
1637
1639
|
createdAt: /* @__PURE__ */ new Date()
|
|
1638
|
-
}]), y(!0)),
|
|
1640
|
+
}]), y(!0)), k && x((e) => [
|
|
1639
1641
|
...e,
|
|
1640
|
-
["human",
|
|
1641
|
-
["assistant",
|
|
1642
|
+
["human", D],
|
|
1643
|
+
["assistant", k]
|
|
1642
1644
|
]), v(!1), _.current = null;
|
|
1643
1645
|
return;
|
|
1644
1646
|
}
|
|
@@ -1648,11 +1650,11 @@ async function hn(e, n) {
|
|
|
1648
1650
|
}
|
|
1649
1651
|
//#endregion
|
|
1650
1652
|
//#region src/hooks/useChat/useChatState.ts
|
|
1651
|
-
function
|
|
1652
|
-
let [t, n] = p(e), [r, i] = p(!1), [a, o] = p(!1), [s, c] = p(!1), [l, u] = p(!1), [m, h] = p(!1), [g, _] = p(!1), [v, y] = p(!1), [b, x] = p(!1), [S, C] = p([]), [w, T] = p([]), [E, D] = p([]), [O, k] = p([]), [A, j] = p("webSearch"), [M, N] = p("general"), [P, F] = p("speed"), [I,
|
|
1653
|
+
function _n(e) {
|
|
1654
|
+
let [t, n] = p(e), [r, i] = p(!1), [a, o] = p(!1), [s, c] = p(!1), [l, u] = p(!1), [m, h] = p(!1), [g, _] = p(!1), [v, y] = p(!1), [b, x] = p(!1), [S, C] = p([]), [w, T] = p([]), [E, D] = p([]), [O, k] = p([]), [A, j] = p("webSearch"), [M, N] = p("general"), [P, F] = p("speed"), [I, L] = p({
|
|
1653
1655
|
key: "",
|
|
1654
1656
|
providerId: ""
|
|
1655
|
-
}),
|
|
1657
|
+
}), R = f([]), z = d(() => w.filter((e) => e.role === "user" || e.role === "assistant"), [w]), ee = d(() => ln(w), [w]);
|
|
1656
1658
|
return {
|
|
1657
1659
|
state: {
|
|
1658
1660
|
chatId: t,
|
|
@@ -1687,19 +1689,19 @@ function gn(e) {
|
|
|
1687
1689
|
setOptimizationMode: F,
|
|
1688
1690
|
setIsMessagesLoaded: u,
|
|
1689
1691
|
setNotFound: x,
|
|
1690
|
-
setChatModelProvider:
|
|
1692
|
+
setChatModelProvider: L,
|
|
1691
1693
|
setIsConfigReady: h,
|
|
1692
1694
|
setHasError: _,
|
|
1693
1695
|
setIsReady: y
|
|
1694
1696
|
},
|
|
1695
|
-
messagesRef:
|
|
1696
|
-
chatTurns:
|
|
1697
|
-
sections:
|
|
1697
|
+
messagesRef: R,
|
|
1698
|
+
chatTurns: z,
|
|
1699
|
+
sections: ee
|
|
1698
1700
|
};
|
|
1699
1701
|
}
|
|
1700
1702
|
//#endregion
|
|
1701
1703
|
//#region src/hooks/useChat/ChatContext.tsx
|
|
1702
|
-
var
|
|
1704
|
+
var vn = a({
|
|
1703
1705
|
chatHistory: [],
|
|
1704
1706
|
chatId: "",
|
|
1705
1707
|
fileIds: [],
|
|
@@ -1733,19 +1735,19 @@ var _n = a({
|
|
|
1733
1735
|
incognito: !1,
|
|
1734
1736
|
setIncognito: () => {}
|
|
1735
1737
|
});
|
|
1736
|
-
function
|
|
1737
|
-
return l(
|
|
1738
|
+
function yn() {
|
|
1739
|
+
return l(vn);
|
|
1738
1740
|
}
|
|
1739
1741
|
//#endregion
|
|
1740
1742
|
//#region src/hooks/useSession.tsx
|
|
1741
|
-
var
|
|
1743
|
+
var bn = a({
|
|
1742
1744
|
user: null,
|
|
1743
1745
|
isLoading: !0,
|
|
1744
1746
|
isAuthenticated: !1,
|
|
1745
1747
|
signIn: () => {},
|
|
1746
1748
|
signOut: async () => {}
|
|
1747
1749
|
});
|
|
1748
|
-
function
|
|
1750
|
+
function xn({ children: e, authClient: t }) {
|
|
1749
1751
|
let [n, r] = p(null), [i, a] = p(!0);
|
|
1750
1752
|
return u(() => {
|
|
1751
1753
|
(async () => {
|
|
@@ -1763,7 +1765,7 @@ function bn({ children: e, authClient: t }) {
|
|
|
1763
1765
|
let { data: e } = await t.getSession();
|
|
1764
1766
|
r(e?.user ?? null);
|
|
1765
1767
|
} } });
|
|
1766
|
-
}, [i, n]), /* @__PURE__ */ W(
|
|
1768
|
+
}, [i, n]), /* @__PURE__ */ W(bn.Provider, {
|
|
1767
1769
|
value: {
|
|
1768
1770
|
user: n,
|
|
1769
1771
|
isLoading: i,
|
|
@@ -1787,15 +1789,15 @@ function bn({ children: e, authClient: t }) {
|
|
|
1787
1789
|
children: e
|
|
1788
1790
|
});
|
|
1789
1791
|
}
|
|
1790
|
-
function
|
|
1791
|
-
let e = l(
|
|
1792
|
+
function Sn() {
|
|
1793
|
+
let e = l(bn);
|
|
1792
1794
|
if (!e) throw Error("useSession must be used within SessionProvider");
|
|
1793
1795
|
return e;
|
|
1794
1796
|
}
|
|
1795
1797
|
//#endregion
|
|
1796
1798
|
//#region src/hooks/useChat/ChatProvider.tsx
|
|
1797
|
-
function
|
|
1798
|
-
let t = m(), n = g(), r = h(), i = n.get("q"), { isAuthenticated: a, isLoading: o } =
|
|
1799
|
+
function Cn({ children: e }) {
|
|
1800
|
+
let t = m(), n = g(), r = h(), i = n.get("q"), { isAuthenticated: a, isLoading: o } = Sn(), { state: s, setters: l, messagesRef: d, chatTurns: _, sections: v } = _n(t.chatId), y = f(null), [b, x] = p(!1);
|
|
1799
1801
|
u(() => {
|
|
1800
1802
|
$t(l.setChatModelProvider, l.setIsConfigReady, l.setHasError);
|
|
1801
1803
|
}, []), u(() => {
|
|
@@ -1845,7 +1847,7 @@ function Sn({ children: e }) {
|
|
|
1845
1847
|
i
|
|
1846
1848
|
]);
|
|
1847
1849
|
let S = c(async (e, t, n = !1) => {
|
|
1848
|
-
s.chatId && await
|
|
1850
|
+
s.chatId && await gn({
|
|
1849
1851
|
message: e,
|
|
1850
1852
|
messageId: t,
|
|
1851
1853
|
rewrite: n
|
|
@@ -1924,14 +1926,14 @@ function Sn({ children: e }) {
|
|
|
1924
1926
|
newChat: T,
|
|
1925
1927
|
setIncognito: x
|
|
1926
1928
|
};
|
|
1927
|
-
return /* @__PURE__ */ W(
|
|
1929
|
+
return /* @__PURE__ */ W(vn.Provider, {
|
|
1928
1930
|
value: E,
|
|
1929
1931
|
children: e
|
|
1930
1932
|
});
|
|
1931
1933
|
}
|
|
1932
1934
|
//#endregion
|
|
1933
1935
|
//#region src/ui/tooltip.tsx
|
|
1934
|
-
function
|
|
1936
|
+
function wn({ delayDuration: e = 0, ...t }) {
|
|
1935
1937
|
return /* @__PURE__ */ W(dt.Provider, {
|
|
1936
1938
|
"data-slot": "tooltip-provider",
|
|
1937
1939
|
delayDuration: e,
|
|
@@ -1939,7 +1941,7 @@ function Cn({ delayDuration: e = 0, ...t }) {
|
|
|
1939
1941
|
});
|
|
1940
1942
|
}
|
|
1941
1943
|
function Y({ ...e }) {
|
|
1942
|
-
return /* @__PURE__ */ W(
|
|
1944
|
+
return /* @__PURE__ */ W(wn, { children: /* @__PURE__ */ W(dt.Root, {
|
|
1943
1945
|
"data-slot": "tooltip",
|
|
1944
1946
|
...e
|
|
1945
1947
|
}) });
|
|
@@ -1961,7 +1963,7 @@ function Z({ className: e, sideOffset: t = 0, children: n, ...r }) {
|
|
|
1961
1963
|
}
|
|
1962
1964
|
//#endregion
|
|
1963
1965
|
//#region src/components/SearchResults/WebCitationBadge.tsx
|
|
1964
|
-
var
|
|
1966
|
+
var Tn = ({ href: e, children: t, sources: n }) => {
|
|
1965
1967
|
let { openPanel: r } = Tt(), i = d(() => !n || !e ? null : n.find((t) => t.metadata?.url === e) ?? null, [n, e]), a = d(() => {
|
|
1966
1968
|
try {
|
|
1967
1969
|
return new URL(e).hostname.replace("www.", "");
|
|
@@ -2002,7 +2004,7 @@ var wn = ({ href: e, children: t, sources: n }) => {
|
|
|
2002
2004
|
})]
|
|
2003
2005
|
})
|
|
2004
2006
|
})] });
|
|
2005
|
-
},
|
|
2007
|
+
}, En = ({ content: e, thinkingEnded: t }) => {
|
|
2006
2008
|
let [n, r] = p(!0);
|
|
2007
2009
|
return u(() => {
|
|
2008
2010
|
r(!t);
|
|
@@ -2029,10 +2031,10 @@ var wn = ({ href: e, children: t, sources: n }) => {
|
|
|
2029
2031
|
children: e
|
|
2030
2032
|
})]
|
|
2031
2033
|
});
|
|
2032
|
-
},
|
|
2034
|
+
}, Dn = ({ children: e, thinkingEnded: t }) => /* @__PURE__ */ W(En, {
|
|
2033
2035
|
content: e,
|
|
2034
2036
|
thinkingEnded: t
|
|
2035
|
-
}),
|
|
2037
|
+
}), On = ({ section: e, isExpanded: t, setIsExpanded: n, isEditing: r, setIsEditing: i, editText: a, setEditText: o, handleEditSubmit: s, copiedUserMsg: c, handleCopyUserMsg: l }) => {
|
|
2036
2038
|
let u = f(null);
|
|
2037
2039
|
return /* @__PURE__ */ G("div", {
|
|
2038
2040
|
className: "w-full pt-8 break-words",
|
|
@@ -2113,19 +2115,19 @@ var wn = ({ href: e, children: t, sources: n }) => {
|
|
|
2113
2115
|
};
|
|
2114
2116
|
//#endregion
|
|
2115
2117
|
//#region src/ui/dropdown-menu.tsx
|
|
2116
|
-
function
|
|
2118
|
+
function kn({ ...e }) {
|
|
2117
2119
|
return /* @__PURE__ */ W(q.Root, {
|
|
2118
2120
|
"data-slot": "dropdown-menu",
|
|
2119
2121
|
...e
|
|
2120
2122
|
});
|
|
2121
2123
|
}
|
|
2122
|
-
function
|
|
2124
|
+
function An({ ...e }) {
|
|
2123
2125
|
return /* @__PURE__ */ W(q.Trigger, {
|
|
2124
2126
|
"data-slot": "dropdown-menu-trigger",
|
|
2125
2127
|
...e
|
|
2126
2128
|
});
|
|
2127
2129
|
}
|
|
2128
|
-
function
|
|
2130
|
+
function jn({ className: e, sideOffset: t = 4, ...n }) {
|
|
2129
2131
|
return /* @__PURE__ */ W(q.Portal, { children: /* @__PURE__ */ W(q.Content, {
|
|
2130
2132
|
"data-slot": "dropdown-menu-content",
|
|
2131
2133
|
sideOffset: t,
|
|
@@ -2142,7 +2144,7 @@ function Q({ className: e, inset: t, variant: n = "default", ...r }) {
|
|
|
2142
2144
|
...r
|
|
2143
2145
|
});
|
|
2144
2146
|
}
|
|
2145
|
-
function
|
|
2147
|
+
function Mn({ className: e, children: t, checked: n, ...r }) {
|
|
2146
2148
|
return /* @__PURE__ */ G(q.CheckboxItem, {
|
|
2147
2149
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
2148
2150
|
className: J("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-2xl py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", e),
|
|
@@ -2154,7 +2156,7 @@ function jn({ className: e, children: t, checked: n, ...r }) {
|
|
|
2154
2156
|
}), t]
|
|
2155
2157
|
});
|
|
2156
2158
|
}
|
|
2157
|
-
function
|
|
2159
|
+
function Nn({ className: e, inset: t, ...n }) {
|
|
2158
2160
|
return /* @__PURE__ */ W(q.Label, {
|
|
2159
2161
|
"data-slot": "dropdown-menu-label",
|
|
2160
2162
|
"data-inset": t,
|
|
@@ -2162,20 +2164,20 @@ function Mn({ className: e, inset: t, ...n }) {
|
|
|
2162
2164
|
...n
|
|
2163
2165
|
});
|
|
2164
2166
|
}
|
|
2165
|
-
function
|
|
2167
|
+
function Pn({ className: e, ...t }) {
|
|
2166
2168
|
return /* @__PURE__ */ W(q.Separator, {
|
|
2167
2169
|
"data-slot": "dropdown-menu-separator",
|
|
2168
2170
|
className: J("bg-border -mx-1 my-1 h-px", e),
|
|
2169
2171
|
...t
|
|
2170
2172
|
});
|
|
2171
2173
|
}
|
|
2172
|
-
function
|
|
2174
|
+
function Fn({ ...e }) {
|
|
2173
2175
|
return /* @__PURE__ */ W(q.Sub, {
|
|
2174
2176
|
"data-slot": "dropdown-menu-sub",
|
|
2175
2177
|
...e
|
|
2176
2178
|
});
|
|
2177
2179
|
}
|
|
2178
|
-
function
|
|
2180
|
+
function In({ className: e, inset: t, children: n, ...r }) {
|
|
2179
2181
|
return /* @__PURE__ */ G(q.SubTrigger, {
|
|
2180
2182
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
2181
2183
|
"data-inset": t,
|
|
@@ -2184,7 +2186,7 @@ function Fn({ className: e, inset: t, children: n, ...r }) {
|
|
|
2184
2186
|
children: [n, /* @__PURE__ */ W(N, { className: "ml-auto size-4" })]
|
|
2185
2187
|
});
|
|
2186
2188
|
}
|
|
2187
|
-
function
|
|
2189
|
+
function Ln({ className: e, ...t }) {
|
|
2188
2190
|
return /* @__PURE__ */ W(q.SubContent, {
|
|
2189
2191
|
"data-slot": "dropdown-menu-sub-content",
|
|
2190
2192
|
className: J("bg-card text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-2xl border p-1 shadow-lg", e),
|
|
@@ -2193,7 +2195,7 @@ function In({ className: e, ...t }) {
|
|
|
2193
2195
|
}
|
|
2194
2196
|
//#endregion
|
|
2195
2197
|
//#region src/components/MessageActions/CopyMessageButton.tsx
|
|
2196
|
-
var
|
|
2198
|
+
var Rn = ({ section: e, initialMessage: t }) => {
|
|
2197
2199
|
let [n, r] = p(!1);
|
|
2198
2200
|
return /* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2199
2201
|
asChild: !0,
|
|
@@ -2212,19 +2214,19 @@ var Ln = ({ section: e, initialMessage: t }) => {
|
|
|
2212
2214
|
};
|
|
2213
2215
|
//#endregion
|
|
2214
2216
|
//#region src/ui/popover.tsx
|
|
2215
|
-
function
|
|
2217
|
+
function zn({ ...e }) {
|
|
2216
2218
|
return /* @__PURE__ */ W(ft.Root, {
|
|
2217
2219
|
"data-slot": "popover",
|
|
2218
2220
|
...e
|
|
2219
2221
|
});
|
|
2220
2222
|
}
|
|
2221
|
-
function
|
|
2223
|
+
function Bn({ ...e }) {
|
|
2222
2224
|
return /* @__PURE__ */ W(ft.Trigger, {
|
|
2223
2225
|
"data-slot": "popover-trigger",
|
|
2224
2226
|
...e
|
|
2225
2227
|
});
|
|
2226
2228
|
}
|
|
2227
|
-
function
|
|
2229
|
+
function Vn({ className: e, align: t = "center", sideOffset: n = 4, container: r, ...i }) {
|
|
2228
2230
|
return /* @__PURE__ */ W(ft.Portal, {
|
|
2229
2231
|
container: r,
|
|
2230
2232
|
children: /* @__PURE__ */ W(ft.Content, {
|
|
@@ -2241,9 +2243,9 @@ function Bn({ className: e, align: t = "center", sideOffset: n = 4, container: r
|
|
|
2241
2243
|
var $ = {
|
|
2242
2244
|
Plus: ve,
|
|
2243
2245
|
Paperclip: he,
|
|
2244
|
-
Cloud:
|
|
2246
|
+
Cloud: R,
|
|
2245
2247
|
Upload: je,
|
|
2246
|
-
File:
|
|
2248
|
+
File: re,
|
|
2247
2249
|
SquarePen: Te,
|
|
2248
2250
|
Thinking: (e) => /* @__PURE__ */ W("svg", {
|
|
2249
2251
|
width: "20",
|
|
@@ -2257,7 +2259,7 @@ var $ = {
|
|
|
2257
2259
|
SelectArrow: j,
|
|
2258
2260
|
ArrowUp: w,
|
|
2259
2261
|
X: Pe,
|
|
2260
|
-
FileText:
|
|
2262
|
+
FileText: oe,
|
|
2261
2263
|
Loader2: H,
|
|
2262
2264
|
Check: k,
|
|
2263
2265
|
Archive: S,
|
|
@@ -2272,8 +2274,8 @@ var $ = {
|
|
|
2272
2274
|
...e,
|
|
2273
2275
|
children: /* @__PURE__ */ W("path", { d: "M10.3857 2.50977C14.3486 2.71054 17.5 5.98724 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 9.72386 2.72386 9.5 3 9.5C3.27614 9.5 3.5 9.72386 3.5 10C3.5 13.5899 6.41015 16.5 10 16.5C13.5899 16.5 16.5 13.5899 16.5 10C16.5 6.5225 13.7691 3.68312 10.335 3.50879L10 3.5L9.89941 3.49023C9.67145 3.44371 9.5 3.24171 9.5 3C9.5 2.72386 9.72386 2.5 10 2.5L10.3857 2.50977ZM10 5.5C10.2761 5.5 10.5 5.72386 10.5 6V9.69043L13.2236 11.0527C13.4706 11.1762 13.5708 11.4766 13.4473 11.7236C13.3392 11.9397 13.0957 12.0435 12.8711 11.9834L12.7764 11.9473L9.77637 10.4473C9.60698 10.3626 9.5 10.1894 9.5 10V6C9.5 5.72386 9.72386 5.5 10 5.5ZM3.66211 6.94141C4.0273 6.94159 4.32303 7.23735 4.32324 7.60254C4.32324 7.96791 4.02743 8.26446 3.66211 8.26465C3.29663 8.26465 3 7.96802 3 7.60254C3.00021 7.23723 3.29676 6.94141 3.66211 6.94141ZM4.95605 4.29395C5.32146 4.29404 5.61719 4.59063 5.61719 4.95605C5.6171 5.3214 5.3214 5.61709 4.95605 5.61719C4.59063 5.61719 4.29403 5.32146 4.29395 4.95605C4.29395 4.59057 4.59057 4.29395 4.95605 4.29395ZM7.60254 3C7.96802 3 8.26465 3.29663 8.26465 3.66211C8.26446 4.02743 7.96791 4.32324 7.60254 4.32324C7.23736 4.32302 6.94159 4.0273 6.94141 3.66211C6.94141 3.29676 7.23724 3.00022 7.60254 3Z" })
|
|
2274
2276
|
})
|
|
2275
|
-
},
|
|
2276
|
-
let { rewrite: t, chatModelProvider: n, setChatModelProvider: r } =
|
|
2277
|
+
}, Hn = ({ messageId: e }) => {
|
|
2278
|
+
let { rewrite: t, chatModelProvider: n, setChatModelProvider: r } = yn(), [i, a] = p([]), [o, s] = p(!0), [c, l] = p(""), [f, m] = p(!1);
|
|
2277
2279
|
u(() => {
|
|
2278
2280
|
f && (async () => {
|
|
2279
2281
|
try {
|
|
@@ -2307,12 +2309,12 @@ var $ = {
|
|
|
2307
2309
|
key: i
|
|
2308
2310
|
}), localStorage.setItem("chatModelProviderId", n), localStorage.setItem("chatModelKey", i), m(!1), t(e);
|
|
2309
2311
|
};
|
|
2310
|
-
return /* @__PURE__ */ G(
|
|
2312
|
+
return /* @__PURE__ */ G(zn, {
|
|
2311
2313
|
open: f,
|
|
2312
2314
|
onOpenChange: m,
|
|
2313
2315
|
children: [/* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2314
2316
|
asChild: !0,
|
|
2315
|
-
children: /* @__PURE__ */ W(
|
|
2317
|
+
children: /* @__PURE__ */ W(Bn, {
|
|
2316
2318
|
asChild: !0,
|
|
2317
2319
|
children: /* @__PURE__ */ W("button", {
|
|
2318
2320
|
className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
|
|
@@ -2322,7 +2324,7 @@ var $ = {
|
|
|
2322
2324
|
}), /* @__PURE__ */ G(Z, {
|
|
2323
2325
|
side: "bottom",
|
|
2324
2326
|
children: ["Rewrite with ", g]
|
|
2325
|
-
})] }), /* @__PURE__ */ W(
|
|
2327
|
+
})] }), /* @__PURE__ */ W(Vn, {
|
|
2326
2328
|
className: "w-[280px] p-0",
|
|
2327
2329
|
align: "start",
|
|
2328
2330
|
side: "top",
|
|
@@ -2373,7 +2375,7 @@ var $ = {
|
|
|
2373
2375
|
className: J("px-3 py-2 flex items-center justify-between text-start duration-200 cursor-pointer transition rounded-xl group", n?.providerId === e.id && n?.key === t.key ? "bg-sky-50 dark:bg-sky-500/10" : "hover:bg-bg-100 dark:hover:bg-[#30302E]"),
|
|
2374
2376
|
children: [/* @__PURE__ */ G("div", {
|
|
2375
2377
|
className: "flex items-center space-x-2.5 min-w-0 flex-1",
|
|
2376
|
-
children: [/* @__PURE__ */ W(
|
|
2378
|
+
children: [/* @__PURE__ */ W(te, {
|
|
2377
2379
|
size: 14,
|
|
2378
2380
|
className: J("shrink-0", n?.providerId === e.id && n?.key === t.key ? "text-sky-500" : "text-text-400 dark:text-[#999999] group-hover:text-text-300 dark:group-hover:text-[#B4B4B4]")
|
|
2379
2381
|
}), /* @__PURE__ */ W("p", {
|
|
@@ -2390,10 +2392,10 @@ var $ = {
|
|
|
2390
2392
|
})
|
|
2391
2393
|
})]
|
|
2392
2394
|
});
|
|
2393
|
-
},
|
|
2394
|
-
function
|
|
2395
|
+
}, Un = /* @__PURE__ */ new Map();
|
|
2396
|
+
function Wn(e) {
|
|
2395
2397
|
if (typeof window > "u") return Promise.reject(/* @__PURE__ */ Error("CDN scripts require a browser environment"));
|
|
2396
|
-
let t =
|
|
2398
|
+
let t = Un.get(e);
|
|
2397
2399
|
if (t) return t;
|
|
2398
2400
|
let n = new Promise((t, n) => {
|
|
2399
2401
|
let r = document.querySelector(`script[data-cdn-loader="${e}"]`);
|
|
@@ -2405,34 +2407,34 @@ function Un(e) {
|
|
|
2405
2407
|
i.src = e, i.async = !0, i.dataset.cdnLoader = e, i.onload = () => {
|
|
2406
2408
|
i.dataset.loaded = "true", t();
|
|
2407
2409
|
}, i.onerror = () => {
|
|
2408
|
-
|
|
2410
|
+
Un.delete(e), n(/* @__PURE__ */ Error(`Failed to load ${e}`));
|
|
2409
2411
|
}, document.head.appendChild(i);
|
|
2410
2412
|
});
|
|
2411
|
-
return
|
|
2413
|
+
return Un.set(e, n), n;
|
|
2412
2414
|
}
|
|
2413
|
-
var
|
|
2414
|
-
async function
|
|
2415
|
-
await
|
|
2415
|
+
var Gn = "https://cdn.jsdelivr.net/npm/jspdf@2.5.2/dist/jspdf.umd.min.js", Kn = "https://cdn.jsdelivr.net/npm/docx@9.5.1/build/index.umd.min.js";
|
|
2416
|
+
async function qn() {
|
|
2417
|
+
await Wn(Gn);
|
|
2416
2418
|
let e = window.jspdf?.jsPDF;
|
|
2417
2419
|
if (!e) throw Error("jsPDF global not found after CDN load");
|
|
2418
2420
|
return e;
|
|
2419
2421
|
}
|
|
2420
|
-
async function
|
|
2421
|
-
await
|
|
2422
|
+
async function Jn() {
|
|
2423
|
+
await Wn(Kn);
|
|
2422
2424
|
let e = window.docx;
|
|
2423
2425
|
if (!e) throw Error("docx global not found after CDN load");
|
|
2424
2426
|
return e;
|
|
2425
2427
|
}
|
|
2426
2428
|
//#endregion
|
|
2427
2429
|
//#region src/lib/export.ts
|
|
2428
|
-
async function
|
|
2429
|
-
|
|
2430
|
+
async function Yn(e, t) {
|
|
2431
|
+
$n(`# ${e}\n\n${new mt({
|
|
2430
2432
|
headingStyle: "atx",
|
|
2431
2433
|
codeBlockStyle: "fenced"
|
|
2432
2434
|
}).turndown(t)}`, `${e}.md`, "text/markdown");
|
|
2433
2435
|
}
|
|
2434
|
-
async function
|
|
2435
|
-
let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await
|
|
2436
|
+
async function Xn(e, t) {
|
|
2437
|
+
let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await Jn(), s = new DOMParser().parseFromString(t, "text/html"), c = [];
|
|
2436
2438
|
c.push(new r({
|
|
2437
2439
|
text: e,
|
|
2438
2440
|
heading: a.HEADING_1,
|
|
@@ -2506,14 +2508,14 @@ async function Yn(e, t) {
|
|
|
2506
2508
|
}] }), d = await o.toBlob(u), f = URL.createObjectURL(d), p = document.createElement("a");
|
|
2507
2509
|
p.href = f, p.download = `${e}.docx`, p.click(), URL.revokeObjectURL(f);
|
|
2508
2510
|
}
|
|
2509
|
-
async function
|
|
2511
|
+
async function Zn(e, t) {
|
|
2510
2512
|
let n = document.createElement("div");
|
|
2511
2513
|
n.style.position = "absolute", n.style.left = "-9999px", n.style.width = "210mm", n.style.padding = "20mm", n.style.backgroundColor = "white", n.style.fontFamily = "Arial, sans-serif", n.style.fontSize = "12pt", n.style.lineHeight = "1.6", n.innerHTML = `
|
|
2512
2514
|
<h1 style="font-size: 24pt; margin-bottom: 20px;">${e}</h1>
|
|
2513
2515
|
${t}
|
|
2514
2516
|
`, document.body.appendChild(n);
|
|
2515
2517
|
try {
|
|
2516
|
-
let t = await
|
|
2518
|
+
let t = await qn(), r = await pt(n, {
|
|
2517
2519
|
scale: 2,
|
|
2518
2520
|
useCORS: !0,
|
|
2519
2521
|
logging: !1
|
|
@@ -2528,7 +2530,7 @@ async function Xn(e, t) {
|
|
|
2528
2530
|
document.body.removeChild(n);
|
|
2529
2531
|
}
|
|
2530
2532
|
}
|
|
2531
|
-
async function
|
|
2533
|
+
async function Qn(e, t) {
|
|
2532
2534
|
try {
|
|
2533
2535
|
let n = `${e}\n\n${new mt().turndown(t)}`;
|
|
2534
2536
|
await navigator.clipboard.writeText(n), window.open("https://docs.google.com/document/create", "_blank"), alert("Content copied to clipboard! Paste it into the new Google Doc.");
|
|
@@ -2536,19 +2538,19 @@ async function Zn(e, t) {
|
|
|
2536
2538
|
console.error("Failed to export to Google Docs:", e), alert("Failed to copy content to clipboard. Please try again.");
|
|
2537
2539
|
}
|
|
2538
2540
|
}
|
|
2539
|
-
function
|
|
2541
|
+
function $n(e, t, n) {
|
|
2540
2542
|
let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
2541
2543
|
a.href = i, a.download = t, a.click(), URL.revokeObjectURL(i);
|
|
2542
2544
|
}
|
|
2543
2545
|
//#endregion
|
|
2544
2546
|
//#region src/components/ChatConversation/MessageBubble/AssistantMessageActions.tsx
|
|
2545
|
-
var
|
|
2547
|
+
var er = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }) => e.assistantMessage ? /* @__PURE__ */ W("div", {
|
|
2546
2548
|
className: "flex flex-row items-center justify-end w-full text-foreground py-4 -mx-2",
|
|
2547
2549
|
children: /* @__PURE__ */ G("div", {
|
|
2548
2550
|
className: "flex flex-row items-center space-x-1",
|
|
2549
2551
|
children: [
|
|
2550
|
-
/* @__PURE__ */ W(
|
|
2551
|
-
/* @__PURE__ */ W(
|
|
2552
|
+
/* @__PURE__ */ W(Hn, { messageId: e.assistantMessage.messageId }),
|
|
2553
|
+
/* @__PURE__ */ W(Rn, {
|
|
2552
2554
|
initialMessage: e.assistantMessage.content,
|
|
2553
2555
|
section: e
|
|
2554
2556
|
}),
|
|
@@ -2565,53 +2567,53 @@ var $n = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
|
|
|
2565
2567
|
side: "bottom",
|
|
2566
2568
|
children: t === "started" ? "Stop" : "Read aloud"
|
|
2567
2569
|
})] }),
|
|
2568
|
-
/* @__PURE__ */ G(
|
|
2570
|
+
/* @__PURE__ */ G(kn, { children: [/* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2569
2571
|
asChild: !0,
|
|
2570
|
-
children: /* @__PURE__ */ W(
|
|
2572
|
+
children: /* @__PURE__ */ W(An, {
|
|
2571
2573
|
asChild: !0,
|
|
2572
2574
|
children: /* @__PURE__ */ W("button", {
|
|
2573
2575
|
className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
|
|
2574
|
-
children: /* @__PURE__ */ W(
|
|
2576
|
+
children: /* @__PURE__ */ W(B, { size: 18 })
|
|
2575
2577
|
})
|
|
2576
2578
|
})
|
|
2577
2579
|
}), /* @__PURE__ */ W(Z, {
|
|
2578
2580
|
side: "bottom",
|
|
2579
2581
|
children: "Export"
|
|
2580
|
-
})] }), /* @__PURE__ */ G(
|
|
2582
|
+
})] }), /* @__PURE__ */ G(jn, {
|
|
2581
2583
|
align: "end",
|
|
2582
2584
|
side: "top",
|
|
2583
2585
|
children: [
|
|
2584
2586
|
/* @__PURE__ */ G(Q, {
|
|
2585
|
-
onClick: () =>
|
|
2586
|
-
children: [/* @__PURE__ */ W(
|
|
2587
|
+
onClick: () => Yn(e.userMessage.content, e.assistantMessage.content),
|
|
2588
|
+
children: [/* @__PURE__ */ W(oe, { size: 16 }), "Markdown"]
|
|
2587
2589
|
}),
|
|
2588
2590
|
/* @__PURE__ */ G(Q, {
|
|
2589
|
-
onClick: () =>
|
|
2591
|
+
onClick: () => Zn(e.userMessage.content, e.assistantMessage.content),
|
|
2590
2592
|
children: [/* @__PURE__ */ W(se, { size: 16 }), "PDF"]
|
|
2591
2593
|
}),
|
|
2592
2594
|
/* @__PURE__ */ G(Q, {
|
|
2593
|
-
onClick: () =>
|
|
2594
|
-
children: [/* @__PURE__ */ W(
|
|
2595
|
+
onClick: () => Xn(e.userMessage.content, e.assistantMessage.content),
|
|
2596
|
+
children: [/* @__PURE__ */ W(ie, { size: 16 }), "DOCX"]
|
|
2595
2597
|
}),
|
|
2596
2598
|
/* @__PURE__ */ G(Q, {
|
|
2597
|
-
onClick: () =>
|
|
2598
|
-
children: [/* @__PURE__ */ W(
|
|
2599
|
+
onClick: () => Qn(e.userMessage.content, e.assistantMessage.content),
|
|
2600
|
+
children: [/* @__PURE__ */ W(ae, { size: 16 }), "Google Docs"]
|
|
2599
2601
|
})
|
|
2600
2602
|
]
|
|
2601
2603
|
})] }),
|
|
2602
|
-
/* @__PURE__ */ G(
|
|
2604
|
+
/* @__PURE__ */ G(kn, { children: [/* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2603
2605
|
asChild: !0,
|
|
2604
|
-
children: /* @__PURE__ */ W(
|
|
2606
|
+
children: /* @__PURE__ */ W(An, {
|
|
2605
2607
|
asChild: !0,
|
|
2606
2608
|
children: /* @__PURE__ */ W("button", {
|
|
2607
2609
|
className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
|
|
2608
|
-
children: /* @__PURE__ */ W(
|
|
2610
|
+
children: /* @__PURE__ */ W(V, { size: 18 })
|
|
2609
2611
|
})
|
|
2610
2612
|
})
|
|
2611
2613
|
}), /* @__PURE__ */ W(Z, {
|
|
2612
2614
|
side: "bottom",
|
|
2613
2615
|
children: "Open in LLM"
|
|
2614
|
-
})] }), /* @__PURE__ */ G(
|
|
2616
|
+
})] }), /* @__PURE__ */ G(jn, {
|
|
2615
2617
|
align: "end",
|
|
2616
2618
|
side: "top",
|
|
2617
2619
|
children: [
|
|
@@ -2639,7 +2641,7 @@ var $n = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
|
|
|
2639
2641
|
})] })
|
|
2640
2642
|
]
|
|
2641
2643
|
})
|
|
2642
|
-
}) : null,
|
|
2644
|
+
}) : null, tr = gt("inline-flex items-center justify-center rounded-2xl border px-3 py-1.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", {
|
|
2643
2645
|
variants: { variant: {
|
|
2644
2646
|
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
2645
2647
|
secondary: "border-transparent bg-gray-100 text-gray-700 [a&]:hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:[a&]:hover:bg-gray-700",
|
|
@@ -2651,16 +2653,16 @@ var $n = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
|
|
|
2651
2653
|
} },
|
|
2652
2654
|
defaultVariants: { variant: "default" }
|
|
2653
2655
|
});
|
|
2654
|
-
function
|
|
2656
|
+
function nr({ className: e, variant: t, asChild: n = !1, ...r }) {
|
|
2655
2657
|
return /* @__PURE__ */ W(n ? ht : "span", {
|
|
2656
2658
|
"data-slot": "badge",
|
|
2657
|
-
className: J(
|
|
2659
|
+
className: J(tr({ variant: t }), e),
|
|
2658
2660
|
...r
|
|
2659
2661
|
});
|
|
2660
2662
|
}
|
|
2661
2663
|
//#endregion
|
|
2662
2664
|
//#region src/components/ChatConversation/MessageBubble/FollowUpSuggestions.tsx
|
|
2663
|
-
var
|
|
2665
|
+
var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
2664
2666
|
let i = f([]);
|
|
2665
2667
|
return u(() => {
|
|
2666
2668
|
e.suggestions && e.suggestions.length > 0 && (i.current = e.suggestions.slice(0, 5));
|
|
@@ -2682,7 +2684,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2682
2684
|
children: /* @__PURE__ */ G("div", {
|
|
2683
2685
|
className: "flex items-center gap-3",
|
|
2684
2686
|
children: [
|
|
2685
|
-
/* @__PURE__ */ W(
|
|
2687
|
+
/* @__PURE__ */ W(nr, {
|
|
2686
2688
|
variant: "secondary",
|
|
2687
2689
|
className: "flex-shrink-0 h-6 w-6 p-0 flex items-center justify-center rounded-full text-sm font-semibold",
|
|
2688
2690
|
children: t + 1
|
|
@@ -2700,8 +2702,8 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2700
2702
|
}, t))
|
|
2701
2703
|
})
|
|
2702
2704
|
});
|
|
2703
|
-
},
|
|
2704
|
-
let { loading: r, sendMessage: i } =
|
|
2705
|
+
}, ir = ({ section: e, dividerRef: t, isLast: n }) => {
|
|
2706
|
+
let { loading: r, sendMessage: i } = yn(), [a, o] = p(!0), [s, c] = p(!1), [l, u] = p(!1), [d, f] = p(e.userMessage.content), m = () => {
|
|
2705
2707
|
navigator.clipboard.writeText(e.userMessage.content), c(!0), setTimeout(() => c(!1), 1500);
|
|
2706
2708
|
}, h = () => {
|
|
2707
2709
|
d.trim() && (i(d.trim()), u(!1));
|
|
@@ -2719,11 +2721,11 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2719
2721
|
r && window.open(`${r}${encodeURIComponent(n)}`, "_blank");
|
|
2720
2722
|
}, w = { overrides: {
|
|
2721
2723
|
think: {
|
|
2722
|
-
component:
|
|
2724
|
+
component: Dn,
|
|
2723
2725
|
props: { thinkingEnded: v }
|
|
2724
2726
|
},
|
|
2725
2727
|
citation: {
|
|
2726
|
-
component:
|
|
2728
|
+
component: Tn,
|
|
2727
2729
|
props: { sources: e.sourceMessage?.sources || [] }
|
|
2728
2730
|
},
|
|
2729
2731
|
table: { component: ({ children: e, ...t }) => /* @__PURE__ */ W("div", {
|
|
@@ -2737,7 +2739,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2737
2739
|
} };
|
|
2738
2740
|
return /* @__PURE__ */ G("div", {
|
|
2739
2741
|
className: "space-y-3",
|
|
2740
|
-
children: [/* @__PURE__ */ W(
|
|
2742
|
+
children: [/* @__PURE__ */ W(On, {
|
|
2741
2743
|
section: e,
|
|
2742
2744
|
isExpanded: a,
|
|
2743
2745
|
setIsExpanded: o,
|
|
@@ -2773,14 +2775,14 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2773
2775
|
options: w,
|
|
2774
2776
|
children: g
|
|
2775
2777
|
}),
|
|
2776
|
-
r && n ? null : /* @__PURE__ */ W(
|
|
2778
|
+
r && n ? null : /* @__PURE__ */ W(er, {
|
|
2777
2779
|
section: e,
|
|
2778
2780
|
speechStatus: b,
|
|
2779
2781
|
start: x,
|
|
2780
2782
|
stop: S,
|
|
2781
2783
|
handleOpenInLLM: C
|
|
2782
2784
|
}),
|
|
2783
|
-
/* @__PURE__ */ W(
|
|
2785
|
+
/* @__PURE__ */ W(rr, {
|
|
2784
2786
|
section: e,
|
|
2785
2787
|
isLast: n,
|
|
2786
2788
|
loading: r,
|
|
@@ -2792,7 +2794,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2792
2794
|
})
|
|
2793
2795
|
})]
|
|
2794
2796
|
});
|
|
2795
|
-
},
|
|
2797
|
+
}, ar = (e) => {
|
|
2796
2798
|
if (e === 0) return "0 Bytes";
|
|
2797
2799
|
let t = 1024, n = [
|
|
2798
2800
|
"Bytes",
|
|
@@ -2801,16 +2803,24 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2801
2803
|
"GB"
|
|
2802
2804
|
], r = Math.floor(Math.log(e) / Math.log(t));
|
|
2803
2805
|
return parseFloat((e / t ** r).toFixed(2)) + " " + n[r];
|
|
2804
|
-
},
|
|
2806
|
+
}, or = ({ file: e, onRemove: t }) => /* @__PURE__ */ G("div", {
|
|
2805
2807
|
className: "relative group flex-shrink-0 w-24 h-24 rounded-xl overflow-hidden border border-bg-300 bg-bg-200 animate-fade-in transition-all hover:border-text-400",
|
|
2806
2808
|
children: [
|
|
2807
2809
|
e.type.startsWith("image/") && e.preview ? /* @__PURE__ */ G("div", {
|
|
2808
2810
|
className: "w-full h-full relative",
|
|
2809
|
-
children: [
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2811
|
+
children: [
|
|
2812
|
+
/* @__PURE__ */ W("img", {
|
|
2813
|
+
src: e.preview,
|
|
2814
|
+
alt: e.file.name,
|
|
2815
|
+
className: "w-full h-full object-cover"
|
|
2816
|
+
}),
|
|
2817
|
+
/* @__PURE__ */ W("div", { className: "absolute inset-0 bg-black/20 group-hover:bg-black/0 transition-colors" }),
|
|
2818
|
+
/* @__PURE__ */ W("span", {
|
|
2819
|
+
className: "absolute bottom-1 left-1 px-1.5 py-0.5 rounded-md bg-black/60 text-white text-[10px] font-medium leading-none backdrop-blur-sm pointer-events-none",
|
|
2820
|
+
title: e.file.name,
|
|
2821
|
+
children: ar(e.file.size)
|
|
2822
|
+
})
|
|
2823
|
+
]
|
|
2814
2824
|
}) : /* @__PURE__ */ G("div", {
|
|
2815
2825
|
className: "w-full h-full p-3 flex flex-col justify-between",
|
|
2816
2826
|
children: [/* @__PURE__ */ G("div", {
|
|
@@ -2830,7 +2840,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2830
2840
|
children: e.file.name
|
|
2831
2841
|
}), /* @__PURE__ */ W("p", {
|
|
2832
2842
|
className: "text-[10px] text-text-500",
|
|
2833
|
-
children:
|
|
2843
|
+
children: ar(e.file.size)
|
|
2834
2844
|
})]
|
|
2835
2845
|
})]
|
|
2836
2846
|
}),
|
|
@@ -2848,7 +2858,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2848
2858
|
children: /* @__PURE__ */ W($.X, { className: "w-5 h-5 text-red-300" })
|
|
2849
2859
|
})
|
|
2850
2860
|
]
|
|
2851
|
-
}),
|
|
2861
|
+
}), sr = ({ content: e, onRemove: t }) => /* @__PURE__ */ G("div", {
|
|
2852
2862
|
className: "relative group flex-shrink-0 w-28 h-28 rounded-2xl overflow-hidden border border-[#E5E5E5] dark:border-[#30302E] bg-white dark:bg-[#20201F] animate-fade-in p-3 flex flex-col justify-between shadow-[0_1px_2px_rgba(0,0,0,0.05)]",
|
|
2853
2863
|
children: [
|
|
2854
2864
|
/* @__PURE__ */ W("div", {
|
|
@@ -2877,7 +2887,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2877
2887
|
});
|
|
2878
2888
|
//#endregion
|
|
2879
2889
|
//#region src/hooks/voice/useSpeechToTranscript.ts
|
|
2880
|
-
function
|
|
2890
|
+
function cr(e, t) {
|
|
2881
2891
|
let [n, r] = p(!1), i = f(null), a = f(null), o = f(null), s = f([]), c = f(!1), l = f(!1), d = typeof window < "u" ? window.SpeechRecognition || window.webkitSpeechRecognition : null, m = () => {
|
|
2882
2892
|
let e = a.current;
|
|
2883
2893
|
e && e.state !== "inactive" ? e.stop() : (o.current?.getTracks().forEach((e) => e.stop()), o.current = null, a.current = null, r(!1), t());
|
|
@@ -2966,28 +2976,28 @@ function sr(e, t) {
|
|
|
2966
2976
|
}
|
|
2967
2977
|
//#endregion
|
|
2968
2978
|
//#region src/components/FileUpload/useFileHandling.ts
|
|
2969
|
-
var
|
|
2979
|
+
var lr = [
|
|
2970
2980
|
"pdf",
|
|
2971
2981
|
"docx",
|
|
2972
2982
|
"txt",
|
|
2973
2983
|
"md",
|
|
2974
2984
|
"html",
|
|
2975
2985
|
"htm"
|
|
2976
|
-
],
|
|
2986
|
+
], ur = 10, dr = 50 * 1024 * 1024, fr = (e, t) => {
|
|
2977
2987
|
if (e && typeof e == "object") {
|
|
2978
2988
|
let t = e.message ?? e.error ?? e.data?.message;
|
|
2979
2989
|
if (typeof t == "string" && t.length > 0) return t;
|
|
2980
2990
|
}
|
|
2981
2991
|
return typeof e == "string" && e.length > 0 ? e : t;
|
|
2982
2992
|
};
|
|
2983
|
-
function
|
|
2993
|
+
function pr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles: r, setContextFileIds: i }) {
|
|
2984
2994
|
let [a, o] = p([]), [s, l] = p([]), [u, d] = p(!1), [f, m] = p(!1), h = c(async (e) => {
|
|
2985
2995
|
let a = Array.from(e);
|
|
2986
|
-
a.length >
|
|
2987
|
-
let s = a.filter((e) => e.size >
|
|
2988
|
-
if (s.length > 0 && (K.error(`${s.map((e) => e.name).join(", ")} exceed${s.length === 1 ? "s" : ""} the 50 MB per-file limit.`), a = a.filter((e) => e.size <=
|
|
2996
|
+
a.length > ur && (K.error(`You can attach up to ${ur} files at a time.`), a = a.slice(0, ur));
|
|
2997
|
+
let s = a.filter((e) => e.size > dr);
|
|
2998
|
+
if (s.length > 0 && (K.error(`${s.map((e) => e.name).join(", ")} exceed${s.length === 1 ? "s" : ""} the 50 MB per-file limit.`), a = a.filter((e) => e.size <= dr)), a.length === 0) return;
|
|
2989
2999
|
let c = a.map((e) => {
|
|
2990
|
-
let t = e.type.startsWith("image/") || /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(e.name), n = e.name.split(".").pop()?.toLowerCase() ?? "", r =
|
|
3000
|
+
let t = e.type.startsWith("image/") || /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(e.name), n = e.name.split(".").pop()?.toLowerCase() ?? "", r = lr.includes(n);
|
|
2991
3001
|
return {
|
|
2992
3002
|
id: Math.random().toString(36).substr(2, 9),
|
|
2993
3003
|
file: e,
|
|
@@ -2997,7 +3007,7 @@ function fr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
2997
3007
|
_ext: n
|
|
2998
3008
|
};
|
|
2999
3009
|
});
|
|
3000
|
-
o((e) => [...e, ...c]), c.filter((e) => !
|
|
3010
|
+
o((e) => [...e, ...c]), c.filter((e) => !lr.includes(e._ext)).forEach((e) => {
|
|
3001
3011
|
setTimeout(() => {
|
|
3002
3012
|
o((t) => t.map((t) => t.id === e.id ? {
|
|
3003
3013
|
...t,
|
|
@@ -3005,16 +3015,16 @@ function fr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
3005
3015
|
} : t));
|
|
3006
3016
|
}, 600 + Math.random() * 600);
|
|
3007
3017
|
});
|
|
3008
|
-
let l = c.filter((e) =>
|
|
3018
|
+
let l = c.filter((e) => lr.includes(e._ext));
|
|
3009
3019
|
if (l.length !== 0) try {
|
|
3010
3020
|
let { data: e, error: a } = await at({ body: { files: l.map((e) => e.file) } });
|
|
3011
|
-
if (a || !e?.files) throw Error(
|
|
3021
|
+
if (a || !e?.files) throw Error(fr(a ?? e, "Upload failed."));
|
|
3012
3022
|
o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
|
|
3013
3023
|
...e,
|
|
3014
3024
|
uploadStatus: "complete"
|
|
3015
3025
|
} : e)), r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]);
|
|
3016
3026
|
} catch (e) {
|
|
3017
|
-
K.error(
|
|
3027
|
+
K.error(fr(e, "Failed to upload files.")), o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
|
|
3018
3028
|
...e,
|
|
3019
3029
|
uploadStatus: "error"
|
|
3020
3030
|
} : e));
|
|
@@ -3044,10 +3054,10 @@ function fr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
3044
3054
|
headers: { "Content-Type": "application/json" },
|
|
3045
3055
|
body: JSON.stringify({ url: a })
|
|
3046
3056
|
})).json();
|
|
3047
|
-
if (!e?.files || e.files.length === 0) throw Error(
|
|
3057
|
+
if (!e?.files || e.files.length === 0) throw Error(fr(e, `Could not extract content from ${a}`));
|
|
3048
3058
|
return r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]), K.success(`Added "${e.files[0].fileName}" as context.`), !0;
|
|
3049
3059
|
} catch (e) {
|
|
3050
|
-
return K.error(
|
|
3060
|
+
return K.error(fr(e, "Failed to extract URL.")), !1;
|
|
3051
3061
|
} finally {
|
|
3052
3062
|
m(!1);
|
|
3053
3063
|
}
|
|
@@ -3094,24 +3104,24 @@ function fr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
3094
3104
|
}
|
|
3095
3105
|
//#endregion
|
|
3096
3106
|
//#region src/components/FileUpload/GoogleDrivePicker.tsx
|
|
3097
|
-
var
|
|
3107
|
+
var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
3098
3108
|
let e = f(!1), n = f(!1);
|
|
3099
3109
|
return u(() => {
|
|
3100
|
-
|
|
3110
|
+
mr() ? n.current = !0 : (() => {
|
|
3101
3111
|
let e = document.createElement("script");
|
|
3102
3112
|
e.src = "https://apis.google.com/js/api.js", e.onload = () => {
|
|
3103
|
-
|
|
3113
|
+
mr()?.load("client:picker", () => {
|
|
3104
3114
|
n.current = !0;
|
|
3105
3115
|
});
|
|
3106
3116
|
}, document.body.appendChild(e);
|
|
3107
|
-
})(),
|
|
3117
|
+
})(), hr()?.picker ? e.current = !0 : (() => {
|
|
3108
3118
|
let t = document.createElement("script");
|
|
3109
3119
|
t.src = "https://www.google.com/jsapi", t.onload = () => {
|
|
3110
3120
|
e.current = !0;
|
|
3111
3121
|
}, document.body.appendChild(t);
|
|
3112
3122
|
})();
|
|
3113
3123
|
}, []), { openPicker: async (e, r, i) => {
|
|
3114
|
-
let a =
|
|
3124
|
+
let a = hr();
|
|
3115
3125
|
if (!n.current || !a?.picker) {
|
|
3116
3126
|
i?.("Google Picker API not loaded yet. Please try again.");
|
|
3117
3127
|
return;
|
|
@@ -3128,8 +3138,8 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3128
3138
|
i?.(e.message || "Failed to open Google Picker");
|
|
3129
3139
|
}
|
|
3130
3140
|
} };
|
|
3131
|
-
},
|
|
3132
|
-
let { chatModelProvider: e, setChatModelProvider: t } =
|
|
3141
|
+
}, _r = () => {
|
|
3142
|
+
let { chatModelProvider: e, setChatModelProvider: t } = yn(), [n, r] = p([]), [i, a] = p(!0), o = h();
|
|
3133
3143
|
u(() => {
|
|
3134
3144
|
(async () => {
|
|
3135
3145
|
try {
|
|
@@ -3169,17 +3179,17 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3169
3179
|
key: n
|
|
3170
3180
|
}), localStorage.setItem("chatModelProviderId", e), localStorage.setItem("chatModelKey", n);
|
|
3171
3181
|
};
|
|
3172
|
-
return /* @__PURE__ */ G(
|
|
3182
|
+
return /* @__PURE__ */ G(Fn, { children: [/* @__PURE__ */ G(In, {
|
|
3173
3183
|
className: "gap-2",
|
|
3174
3184
|
children: [
|
|
3175
|
-
/* @__PURE__ */ W(
|
|
3185
|
+
/* @__PURE__ */ W(te, { className: "w-4 h-4 flex-shrink-0 text-sky-500" }),
|
|
3176
3186
|
/* @__PURE__ */ W("span", { children: "Model" }),
|
|
3177
3187
|
/* @__PURE__ */ W("span", {
|
|
3178
3188
|
className: "ml-auto text-xs text-muted-foreground truncate max-w-[55px]",
|
|
3179
3189
|
children: s
|
|
3180
3190
|
})
|
|
3181
3191
|
]
|
|
3182
|
-
}), /* @__PURE__ */ G(
|
|
3192
|
+
}), /* @__PURE__ */ G(Ln, {
|
|
3183
3193
|
className: "w-52 max-h-[400px] overflow-y-auto",
|
|
3184
3194
|
children: [
|
|
3185
3195
|
i ? /* @__PURE__ */ W("div", {
|
|
@@ -3189,7 +3199,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3189
3199
|
className: "px-3 py-2 text-xs text-muted-foreground",
|
|
3190
3200
|
children: "No models configured"
|
|
3191
3201
|
}) : n.map((t, r) => /* @__PURE__ */ G("div", { children: [
|
|
3192
|
-
/* @__PURE__ */ W(
|
|
3202
|
+
/* @__PURE__ */ W(Nn, {
|
|
3193
3203
|
className: "text-[10px] uppercase tracking-wider text-muted-foreground font-medium",
|
|
3194
3204
|
children: t.name
|
|
3195
3205
|
}),
|
|
@@ -3197,7 +3207,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3197
3207
|
onSelect: () => c(t.id, n.key),
|
|
3198
3208
|
className: J("gap-2", e?.providerId === t.id && e?.key === n.key && "bg-secondary"),
|
|
3199
3209
|
children: [
|
|
3200
|
-
/* @__PURE__ */ W(
|
|
3210
|
+
/* @__PURE__ */ W(te, { className: J("h-3.5 w-3.5 flex-shrink-0", e?.providerId === t.id && e?.key === n.key ? "text-sky-500" : "text-muted-foreground") }),
|
|
3201
3211
|
/* @__PURE__ */ W("span", {
|
|
3202
3212
|
className: "truncate",
|
|
3203
3213
|
children: n.name
|
|
@@ -3216,9 +3226,9 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3216
3226
|
})
|
|
3217
3227
|
]
|
|
3218
3228
|
}, n.key)),
|
|
3219
|
-
r < n.length - 1 && /* @__PURE__ */ W(
|
|
3229
|
+
r < n.length - 1 && /* @__PURE__ */ W(Pn, {})
|
|
3220
3230
|
] }, t.id)),
|
|
3221
|
-
/* @__PURE__ */ W(
|
|
3231
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3222
3232
|
/* @__PURE__ */ G(Q, {
|
|
3223
3233
|
onSelect: () => o.push("/settings?section=models"),
|
|
3224
3234
|
className: "gap-2",
|
|
@@ -3226,7 +3236,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3226
3236
|
})
|
|
3227
3237
|
]
|
|
3228
3238
|
})] });
|
|
3229
|
-
},
|
|
3239
|
+
}, vr = [
|
|
3230
3240
|
{
|
|
3231
3241
|
label: "5s",
|
|
3232
3242
|
value: 5
|
|
@@ -3251,22 +3261,22 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3251
3261
|
label: "Unlimited",
|
|
3252
3262
|
value: 0
|
|
3253
3263
|
}
|
|
3254
|
-
],
|
|
3264
|
+
], yr = [
|
|
3255
3265
|
"pdf",
|
|
3256
3266
|
"docx",
|
|
3257
3267
|
"txt",
|
|
3258
3268
|
"md",
|
|
3259
3269
|
"html",
|
|
3260
3270
|
"htm"
|
|
3261
|
-
],
|
|
3262
|
-
let n = h(), { category: i, setCategory: a, incognito: o, setIncognito: s, sections: c, chatId: l } =
|
|
3271
|
+
], br = /* @__PURE__ */ "markdown.js.jsx.ts.tsx.py.rb.go.rs.java.c.cpp.h.hpp.cs.swift.kt.sh.bash.zsh.json.yaml.yml.toml.ini.cfg.conf.xml.csv.tsv.log.env.sql.graphql.vue.svelte.astro.css.scss.less.sass.tex.bib.rst.adoc.org".split("."), xr = ({ onFileSelect: e, disabled: t = !1 }) => {
|
|
3272
|
+
let n = h(), { category: i, setCategory: a, incognito: o, setIncognito: s, sections: c, chatId: l } = yn(), { isAuthenticated: d } = Sn(), f = i ? i.split(",").filter(Boolean) : ["general"], m = Pt.find((e) => e.code === f[0]) || Pt[0], g = (e) => {
|
|
3263
3273
|
let t = i ? i.split(",").filter(Boolean) : ["general"], n = t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
|
|
3264
3274
|
a(n.length > 0 ? n.join(",") : "general");
|
|
3265
3275
|
}, [_, v] = p(!1), [y, b] = p(!1), [x, S] = p(!1), [C, w] = p(!1), [E, D] = p(() => {
|
|
3266
3276
|
if (typeof window > "u") return 5;
|
|
3267
3277
|
let e = Number(localStorage.getItem("thinkingTimeLimit") ?? "5");
|
|
3268
3278
|
return Number.isFinite(e) ? e : 5;
|
|
3269
|
-
}), O = r.useRef(null), { openPicker: k } =
|
|
3279
|
+
}), O = r.useRef(null), { openPicker: k } = gr();
|
|
3270
3280
|
u(() => {
|
|
3271
3281
|
A();
|
|
3272
3282
|
}, []);
|
|
@@ -3310,8 +3320,8 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3310
3320
|
let n = [];
|
|
3311
3321
|
for await (let r of e.values()) if (r.kind === "file") {
|
|
3312
3322
|
let e = await r.getFile(), i = e.name.split(".").pop()?.toLowerCase() ?? "";
|
|
3313
|
-
if (
|
|
3314
|
-
else if (
|
|
3323
|
+
if (yr.includes(i)) n.push(e);
|
|
3324
|
+
else if (br.includes(i)) try {
|
|
3315
3325
|
let r = await e.text(), i = t ? `${t}/${e.name}` : e.name;
|
|
3316
3326
|
n.push(new File([r], `${i.replace(/[/\\]/g, "_")}.txt`, { type: "text/plain" }));
|
|
3317
3327
|
} catch {}
|
|
@@ -3379,11 +3389,11 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3379
3389
|
} catch (e) {
|
|
3380
3390
|
alert(e.message || "Failed to open Google Drive picker");
|
|
3381
3391
|
}
|
|
3382
|
-
},
|
|
3392
|
+
}, R = vr.find((e) => e.value === E)?.label ?? "Unlimited";
|
|
3383
3393
|
return /* @__PURE__ */ G(U, { children: [
|
|
3384
3394
|
/* @__PURE__ */ G("div", {
|
|
3385
3395
|
className: "relative flex shrink min-w-8 !shrink-0 group",
|
|
3386
|
-
children: [/* @__PURE__ */ G(
|
|
3396
|
+
children: [/* @__PURE__ */ G(kn, { children: [/* @__PURE__ */ W(An, {
|
|
3387
3397
|
asChild: !0,
|
|
3388
3398
|
children: /* @__PURE__ */ W("button", {
|
|
3389
3399
|
disabled: t,
|
|
@@ -3392,27 +3402,27 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3392
3402
|
"aria-label": "Search options",
|
|
3393
3403
|
children: /* @__PURE__ */ W(Ce, { className: "w-5 h-5" })
|
|
3394
3404
|
})
|
|
3395
|
-
}), /* @__PURE__ */ G(
|
|
3405
|
+
}), /* @__PURE__ */ G(jn, {
|
|
3396
3406
|
align: "start",
|
|
3397
3407
|
side: "top",
|
|
3398
3408
|
sideOffset: 8,
|
|
3399
3409
|
className: "w-44",
|
|
3400
3410
|
children: [
|
|
3401
|
-
/* @__PURE__ */ G(
|
|
3411
|
+
/* @__PURE__ */ G(Fn, { children: [/* @__PURE__ */ G(In, {
|
|
3402
3412
|
className: "gap-2",
|
|
3403
3413
|
children: [m && /* @__PURE__ */ W(m.icon, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Category" })]
|
|
3404
|
-
}), /* @__PURE__ */ G(
|
|
3414
|
+
}), /* @__PURE__ */ G(Ln, {
|
|
3405
3415
|
className: "w-44",
|
|
3406
3416
|
children: [
|
|
3407
|
-
/* @__PURE__ */ G(
|
|
3417
|
+
/* @__PURE__ */ G(Mn, {
|
|
3408
3418
|
checked: f.length === 0,
|
|
3409
3419
|
onCheckedChange: () => a("general"),
|
|
3410
3420
|
onSelect: (e) => e.preventDefault(),
|
|
3411
3421
|
className: "gap-2",
|
|
3412
3422
|
children: [/* @__PURE__ */ W("div", { className: "w-3.5 h-3.5 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "None" })]
|
|
3413
3423
|
}),
|
|
3414
|
-
/* @__PURE__ */ W(
|
|
3415
|
-
Pt.map((e) => /* @__PURE__ */ G(
|
|
3424
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3425
|
+
Pt.map((e) => /* @__PURE__ */ G(Mn, {
|
|
3416
3426
|
checked: f.includes(e.code),
|
|
3417
3427
|
onCheckedChange: () => g(e.code),
|
|
3418
3428
|
onSelect: (e) => e.preventDefault(),
|
|
@@ -3421,19 +3431,19 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3421
3431
|
}, e.code))
|
|
3422
3432
|
]
|
|
3423
3433
|
})] }),
|
|
3424
|
-
/* @__PURE__ */ G(
|
|
3434
|
+
/* @__PURE__ */ G(Fn, { children: [/* @__PURE__ */ G(In, {
|
|
3425
3435
|
className: "gap-2",
|
|
3426
3436
|
children: [
|
|
3427
|
-
/* @__PURE__ */ W(
|
|
3437
|
+
/* @__PURE__ */ W(L, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }),
|
|
3428
3438
|
/* @__PURE__ */ W("span", { children: "Speed" }),
|
|
3429
3439
|
/* @__PURE__ */ W("span", {
|
|
3430
3440
|
className: "ml-auto text-xs text-muted-foreground",
|
|
3431
|
-
children:
|
|
3441
|
+
children: R
|
|
3432
3442
|
})
|
|
3433
3443
|
]
|
|
3434
|
-
}), /* @__PURE__ */ W(
|
|
3444
|
+
}), /* @__PURE__ */ W(Ln, {
|
|
3435
3445
|
className: "w-36",
|
|
3436
|
-
children:
|
|
3446
|
+
children: vr.map((e) => /* @__PURE__ */ G(Q, {
|
|
3437
3447
|
onSelect: () => j(e.value),
|
|
3438
3448
|
className: J("justify-between", E === e.value && "bg-secondary"),
|
|
3439
3449
|
children: [/* @__PURE__ */ W("span", { children: e.label }), E === e.value && /* @__PURE__ */ W("svg", {
|
|
@@ -3450,13 +3460,13 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3450
3460
|
})]
|
|
3451
3461
|
}, e.value))
|
|
3452
3462
|
})] }),
|
|
3453
|
-
/* @__PURE__ */ W(
|
|
3454
|
-
/* @__PURE__ */ W(
|
|
3455
|
-
/* @__PURE__ */ W(
|
|
3456
|
-
/* @__PURE__ */ G(
|
|
3463
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3464
|
+
/* @__PURE__ */ W(_r, {}),
|
|
3465
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3466
|
+
/* @__PURE__ */ G(Fn, { children: [/* @__PURE__ */ G(In, {
|
|
3457
3467
|
className: "gap-2",
|
|
3458
3468
|
children: [/* @__PURE__ */ W(je, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ W("span", { children: "Upload" })]
|
|
3459
|
-
}), /* @__PURE__ */ G(
|
|
3469
|
+
}), /* @__PURE__ */ G(Ln, {
|
|
3460
3470
|
className: "w-44",
|
|
3461
3471
|
children: [
|
|
3462
3472
|
/* @__PURE__ */ G(Q, {
|
|
@@ -3470,8 +3480,8 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3470
3480
|
className: "gap-2",
|
|
3471
3481
|
children: [C ? /* @__PURE__ */ W(H, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ W(ce, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: C ? "Scanning…" : "Local Folder" })]
|
|
3472
3482
|
}),
|
|
3473
|
-
/* @__PURE__ */ W(
|
|
3474
|
-
/* @__PURE__ */ W(
|
|
3483
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3484
|
+
/* @__PURE__ */ W(Nn, {
|
|
3475
3485
|
className: "text-xs font-normal text-muted-foreground",
|
|
3476
3486
|
children: "Cloud"
|
|
3477
3487
|
}),
|
|
@@ -3479,28 +3489,28 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3479
3489
|
onSelect: I,
|
|
3480
3490
|
disabled: x,
|
|
3481
3491
|
className: "gap-2",
|
|
3482
|
-
children: [x ? /* @__PURE__ */ W(H, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ W(
|
|
3492
|
+
children: [x ? /* @__PURE__ */ W(H, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ W(z, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: x ? "Loading…" : "Google Drive" })]
|
|
3483
3493
|
}) : /* @__PURE__ */ G(Q, {
|
|
3484
3494
|
onSelect: F,
|
|
3485
3495
|
disabled: y,
|
|
3486
3496
|
className: "gap-2",
|
|
3487
|
-
children: [y ? /* @__PURE__ */ W(H, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ W(
|
|
3497
|
+
children: [y ? /* @__PURE__ */ W(H, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ W(z, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: y ? "Connecting…" : "Connect Google Drive" })]
|
|
3488
3498
|
})
|
|
3489
3499
|
]
|
|
3490
3500
|
})] }),
|
|
3491
|
-
/* @__PURE__ */ W(
|
|
3492
|
-
/* @__PURE__ */ G(
|
|
3501
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3502
|
+
/* @__PURE__ */ G(Mn, {
|
|
3493
3503
|
checked: o,
|
|
3494
3504
|
onCheckedChange: s,
|
|
3495
3505
|
onSelect: (e) => e.preventDefault(),
|
|
3496
3506
|
className: "gap-2",
|
|
3497
|
-
children: [/* @__PURE__ */ W(
|
|
3507
|
+
children: [/* @__PURE__ */ W(ne, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ W("span", { children: "Private" })]
|
|
3498
3508
|
}),
|
|
3499
|
-
/* @__PURE__ */ W(
|
|
3500
|
-
c.length > 0 && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(
|
|
3509
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3510
|
+
c.length > 0 && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(Fn, { children: [/* @__PURE__ */ G(In, {
|
|
3501
3511
|
className: "gap-2",
|
|
3502
3512
|
children: [/* @__PURE__ */ W(Se, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ W("span", { children: "Share" })]
|
|
3503
|
-
}), /* @__PURE__ */ G(
|
|
3513
|
+
}), /* @__PURE__ */ G(Ln, {
|
|
3504
3514
|
className: "w-48",
|
|
3505
3515
|
children: [
|
|
3506
3516
|
/* @__PURE__ */ G(Q, {
|
|
@@ -3546,37 +3556,37 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3546
3556
|
className: "gap-2",
|
|
3547
3557
|
children: [/* @__PURE__ */ W(T, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Save to QwkDocs" })]
|
|
3548
3558
|
}),
|
|
3549
|
-
/* @__PURE__ */ W(
|
|
3559
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3550
3560
|
/* @__PURE__ */ G(Q, {
|
|
3551
3561
|
onSelect: () => {
|
|
3552
|
-
|
|
3562
|
+
Yn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3553
3563
|
},
|
|
3554
3564
|
className: "gap-2",
|
|
3555
|
-
children: [/* @__PURE__ */ W(
|
|
3565
|
+
children: [/* @__PURE__ */ W(oe, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export as Markdown" })]
|
|
3556
3566
|
}),
|
|
3557
3567
|
/* @__PURE__ */ G(Q, {
|
|
3558
3568
|
onSelect: () => {
|
|
3559
|
-
|
|
3569
|
+
Zn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3560
3570
|
},
|
|
3561
3571
|
className: "gap-2",
|
|
3562
3572
|
children: [/* @__PURE__ */ W(se, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export as PDF" })]
|
|
3563
3573
|
}),
|
|
3564
3574
|
/* @__PURE__ */ G(Q, {
|
|
3565
3575
|
onSelect: () => {
|
|
3566
|
-
|
|
3576
|
+
Xn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3567
3577
|
},
|
|
3568
3578
|
className: "gap-2",
|
|
3569
|
-
children: [/* @__PURE__ */ W(
|
|
3579
|
+
children: [/* @__PURE__ */ W(ie, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export as DOCX" })]
|
|
3570
3580
|
}),
|
|
3571
3581
|
/* @__PURE__ */ G(Q, {
|
|
3572
3582
|
onSelect: () => {
|
|
3573
|
-
|
|
3583
|
+
Qn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3574
3584
|
},
|
|
3575
3585
|
className: "gap-2",
|
|
3576
|
-
children: [/* @__PURE__ */ W(
|
|
3586
|
+
children: [/* @__PURE__ */ W(ae, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export to Google Docs" })]
|
|
3577
3587
|
})
|
|
3578
3588
|
]
|
|
3579
|
-
})] }), /* @__PURE__ */ W(
|
|
3589
|
+
})] }), /* @__PURE__ */ W(Pn, {})] }),
|
|
3580
3590
|
/* @__PURE__ */ G(Q, {
|
|
3581
3591
|
onSelect: () => n.push("/library"),
|
|
3582
3592
|
className: "gap-2",
|
|
@@ -3623,7 +3633,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3623
3633
|
className: "hidden"
|
|
3624
3634
|
})
|
|
3625
3635
|
] });
|
|
3626
|
-
},
|
|
3636
|
+
}, Sr = o(({ active: e = !1, processing: t = !1, barWidth: n = 3, barHeight: r = 4, barGap: i = 1, barRadius: a = 1.5, barColor: o, fadeEdges: s = !0, fadeWidth: l = 24, height: d = 64, sensitivity: p = 1, smoothingTimeConstant: m = .8, fftSize: h = 256, historySize: g = 60, updateRate: _ = 30, mode: v = "static", onError: y, onStreamReady: b, onStreamEnd: x, className: S, ...C }, w) => {
|
|
3627
3637
|
let T = f(null), E = f(null), D = f(null), O = f(null), k = f(null), A = f(0), j = f([]), M = f(0), N = f(0), P = c(() => {
|
|
3628
3638
|
A.current &&= (cancelAnimationFrame(A.current), 0), k.current &&= (k.current.disconnect(), null), O.current &&= (O.current.getTracks().forEach((e) => e.stop()), null), E.current &&= (E.current.close().catch(() => {}), null), D.current = null, j.current = [], x?.();
|
|
3629
3639
|
}, [x]), F = c((e, t, o, s, c) => {
|
|
@@ -3651,7 +3661,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3651
3661
|
a,
|
|
3652
3662
|
p,
|
|
3653
3663
|
g
|
|
3654
|
-
]),
|
|
3664
|
+
]), L = c((e, t, o, s, c) => {
|
|
3655
3665
|
let l = n + i, u = Math.floor(t / s / l), d = u * l - i, f = (t / s - d) / 2;
|
|
3656
3666
|
for (let t = 0; t < u; t++) {
|
|
3657
3667
|
let i = Math.sin(t / u * Math.PI * 2 + c) * .5 + .5, d = Math.max(r, o / s * i * .6), p = f + t * l, m = (o / s - d) / 2;
|
|
@@ -3662,7 +3672,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3662
3672
|
i,
|
|
3663
3673
|
r,
|
|
3664
3674
|
a
|
|
3665
|
-
]),
|
|
3675
|
+
]), R = c((e, t, n) => {
|
|
3666
3676
|
if (!s) return;
|
|
3667
3677
|
e.save(), e.globalCompositeOperation = "destination-in";
|
|
3668
3678
|
let r = e.createLinearGradient(0, 0, t, 0);
|
|
@@ -3696,7 +3706,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3696
3706
|
A.current = requestAnimationFrame(r);
|
|
3697
3707
|
return;
|
|
3698
3708
|
}
|
|
3699
|
-
if (d.clearRect(0, 0, l, u), d.fillStyle = o || getComputedStyle(a).getPropertyValue("color") || "#888", d.save(), d.setTransform(1, 0, 0, 1, 0, 0), t && !e) M.current += .06,
|
|
3709
|
+
if (d.clearRect(0, 0, l, u), d.fillStyle = o || getComputedStyle(a).getPropertyValue("color") || "#888", d.save(), d.setTransform(1, 0, 0, 1, 0, 0), t && !e) M.current += .06, L(d, l, u, s, M.current);
|
|
3700
3710
|
else if (e && D.current) {
|
|
3701
3711
|
let e = new Uint8Array(D.current.frequencyBinCount);
|
|
3702
3712
|
if (D.current.getByteFrequencyData(e), v === "scrolling") {
|
|
@@ -3706,7 +3716,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3706
3716
|
j.current.push(n), j.current.length > g * 2 && (j.current = j.current.slice(-g)), I(d, l, u, s);
|
|
3707
3717
|
} else F(d, l, u, e, s);
|
|
3708
3718
|
}
|
|
3709
|
-
|
|
3719
|
+
R(d, l, u), d.restore(), A.current = requestAnimationFrame(r);
|
|
3710
3720
|
};
|
|
3711
3721
|
return A.current = requestAnimationFrame(r), () => {
|
|
3712
3722
|
n = !1, A.current &&= (cancelAnimationFrame(A.current), 0);
|
|
@@ -3720,8 +3730,8 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3720
3730
|
g,
|
|
3721
3731
|
F,
|
|
3722
3732
|
I,
|
|
3723
|
-
|
|
3724
|
-
|
|
3733
|
+
L,
|
|
3734
|
+
R
|
|
3725
3735
|
]), u(() => {
|
|
3726
3736
|
if (!e) {
|
|
3727
3737
|
P();
|
|
@@ -3772,23 +3782,23 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3772
3782
|
})
|
|
3773
3783
|
});
|
|
3774
3784
|
});
|
|
3775
|
-
|
|
3785
|
+
Sr.displayName = "LiveWaveform";
|
|
3776
3786
|
//#endregion
|
|
3777
3787
|
//#region src/components/MessageComposer/ChatInputBox.tsx
|
|
3778
|
-
var
|
|
3788
|
+
var Cr = [
|
|
3779
3789
|
"What are you curious to research?",
|
|
3780
3790
|
"Search the latest news...",
|
|
3781
3791
|
"Analyze a video, doc, or URL...",
|
|
3782
3792
|
"Find academic research on...",
|
|
3783
3793
|
"Compare products to buy..."
|
|
3784
|
-
],
|
|
3794
|
+
], wr = {
|
|
3785
3795
|
initial: {},
|
|
3786
3796
|
animate: { transition: { staggerChildren: .025 } },
|
|
3787
3797
|
exit: { transition: {
|
|
3788
3798
|
staggerChildren: .015,
|
|
3789
3799
|
staggerDirection: -1
|
|
3790
3800
|
} }
|
|
3791
|
-
},
|
|
3801
|
+
}, Tr = {
|
|
3792
3802
|
initial: {
|
|
3793
3803
|
opacity: 0,
|
|
3794
3804
|
filter: "blur(12px)",
|
|
@@ -3822,8 +3832,8 @@ var Sr = [
|
|
|
3822
3832
|
}
|
|
3823
3833
|
}
|
|
3824
3834
|
}
|
|
3825
|
-
},
|
|
3826
|
-
let { loading: t, sendMessage: n, stopStreaming: r, files: i, fileIds: a, setFiles: o, setFileIds: s, newChat: c, sections: l } =
|
|
3835
|
+
}, Er = ({ onNewChat: e }) => {
|
|
3836
|
+
let { loading: t, sendMessage: n, stopStreaming: r, files: i, fileIds: a, setFiles: o, setFileIds: s, newChat: c, sections: l } = yn(), [d, m] = p(""), h = f(null), g = f(null), { files: _, setFiles: v, pastedContent: y, setPastedContent: b, isDragging: x, handleFiles: S, onDragOver: C, onDragLeave: w, onDrop: T, handlePaste: E, resetAttachments: D } = pr({
|
|
3827
3837
|
setMessage: m,
|
|
3828
3838
|
contextFiles: i,
|
|
3829
3839
|
contextFileIds: a,
|
|
@@ -3831,19 +3841,19 @@ var Sr = [
|
|
|
3831
3841
|
setContextFileIds: s
|
|
3832
3842
|
}), O = () => {
|
|
3833
3843
|
m(""), D(), h.current && (h.current.style.height = "auto");
|
|
3834
|
-
}, { isListening: k, toggleSpeech: A, isSpeechSupported: j } =
|
|
3844
|
+
}, { isListening: k, toggleSpeech: A, isSpeechSupported: j } = cr((e) => m(e), () => {
|
|
3835
3845
|
m((e) => (e.trim() && setTimeout(() => {
|
|
3836
3846
|
n(e), O();
|
|
3837
3847
|
}, 0), e));
|
|
3838
|
-
}), [M, N] = p(0), [P, F] = p(!0), [I,
|
|
3848
|
+
}), [M, N] = p(0), [P, F] = p(!0), [I, L] = p(!1), [R, z] = p([]), [ee, te] = p([]), [B, V] = p(-1), [ne, re] = p(!1), [ie, ae] = p("below"), oe = f(!1), se = f(null);
|
|
3839
3849
|
u(() => {
|
|
3840
|
-
if (
|
|
3841
|
-
|
|
3850
|
+
if (oe.current) {
|
|
3851
|
+
oe.current = !1;
|
|
3842
3852
|
return;
|
|
3843
3853
|
}
|
|
3844
3854
|
let { query: e } = ce(d);
|
|
3845
3855
|
if (!I || e.length < 2) {
|
|
3846
|
-
|
|
3856
|
+
z([]), te([]), re(!1), V(-1);
|
|
3847
3857
|
return;
|
|
3848
3858
|
}
|
|
3849
3859
|
let t = setTimeout(async () => {
|
|
@@ -3860,14 +3870,14 @@ var Sr = [
|
|
|
3860
3870
|
});
|
|
3861
3871
|
if (r) return;
|
|
3862
3872
|
let i = Array.isArray(n?.suggestions) ? n.suggestions : [], a = Array.isArray(n?.domains) ? n.domains : [];
|
|
3863
|
-
if (
|
|
3873
|
+
if (z(i), te(a), i.length + a.length > 0) {
|
|
3864
3874
|
if (g.current) {
|
|
3865
3875
|
let e = g.current.getBoundingClientRect(), t = window.innerHeight - e.bottom, n = e.top;
|
|
3866
|
-
t < Math.min(288, (i.length + a.length) * 36) && n > t ?
|
|
3876
|
+
t < Math.min(288, (i.length + a.length) * 36) && n > t ? ae("above") : ae("below");
|
|
3867
3877
|
}
|
|
3868
|
-
|
|
3869
|
-
} else
|
|
3870
|
-
|
|
3878
|
+
re(!0);
|
|
3879
|
+
} else re(!1);
|
|
3880
|
+
V(-1);
|
|
3871
3881
|
} catch (e) {
|
|
3872
3882
|
e?.name !== "AbortError" && console.error("Autocomplete fetch failed", e);
|
|
3873
3883
|
}
|
|
@@ -3886,25 +3896,25 @@ var Sr = [
|
|
|
3886
3896
|
query: i
|
|
3887
3897
|
};
|
|
3888
3898
|
}, le = (e) => {
|
|
3889
|
-
|
|
3899
|
+
oe.current = !0;
|
|
3890
3900
|
let { prefix: t } = ce(d);
|
|
3891
|
-
m(t + e),
|
|
3901
|
+
m(t + e), z([]), te([]), re(!1), V(-1), h.current?.focus();
|
|
3892
3902
|
}, ue = (e) => {
|
|
3893
|
-
|
|
3894
|
-
}, de =
|
|
3895
|
-
e <
|
|
3903
|
+
re(!1), V(-1), window.location.href = `https://${e.domain}`;
|
|
3904
|
+
}, de = ee.length + R.length, H = (e) => {
|
|
3905
|
+
e < ee.length ? ue(ee[e]) : le(R[e - ee.length]);
|
|
3896
3906
|
};
|
|
3897
3907
|
u(() => {
|
|
3898
3908
|
if (I || d) return;
|
|
3899
3909
|
let e = setInterval(() => {
|
|
3900
3910
|
F(!1), setTimeout(() => {
|
|
3901
|
-
N((e) => (e + 1) %
|
|
3911
|
+
N((e) => (e + 1) % Cr.length), F(!0);
|
|
3902
3912
|
}, 400);
|
|
3903
3913
|
}, 3e3);
|
|
3904
3914
|
return () => clearInterval(e);
|
|
3905
3915
|
}, [I, d]), u(() => {
|
|
3906
3916
|
let e = (e) => {
|
|
3907
|
-
g.current && !g.current.contains(e.target) && (d ||
|
|
3917
|
+
g.current && !g.current.contains(e.target) && (d || L(!1));
|
|
3908
3918
|
};
|
|
3909
3919
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
3910
3920
|
}, [d]), u(() => {
|
|
@@ -3913,25 +3923,25 @@ var Sr = [
|
|
|
3913
3923
|
let fe = () => {
|
|
3914
3924
|
t || !d.trim() && _.length === 0 && y.length === 0 || (n(d), O());
|
|
3915
3925
|
}, pe = (e) => {
|
|
3916
|
-
if (
|
|
3926
|
+
if (ne && de > 0) {
|
|
3917
3927
|
if (e.key === "ArrowDown") {
|
|
3918
|
-
e.preventDefault(),
|
|
3928
|
+
e.preventDefault(), V((e) => (e + 1) % de);
|
|
3919
3929
|
return;
|
|
3920
3930
|
}
|
|
3921
3931
|
if (e.key === "ArrowUp") {
|
|
3922
|
-
e.preventDefault(),
|
|
3932
|
+
e.preventDefault(), V((e) => e <= 0 ? de - 1 : e - 1);
|
|
3923
3933
|
return;
|
|
3924
3934
|
}
|
|
3925
3935
|
if (e.key === "Escape") {
|
|
3926
|
-
e.preventDefault(),
|
|
3936
|
+
e.preventDefault(), re(!1), V(-1);
|
|
3927
3937
|
return;
|
|
3928
3938
|
}
|
|
3929
|
-
if (e.key === "Tab" &&
|
|
3930
|
-
e.preventDefault(), H(
|
|
3939
|
+
if (e.key === "Tab" && B >= 0) {
|
|
3940
|
+
e.preventDefault(), H(B);
|
|
3931
3941
|
return;
|
|
3932
3942
|
}
|
|
3933
|
-
if (e.key === "Enter" && !e.shiftKey &&
|
|
3934
|
-
e.preventDefault(), H(
|
|
3943
|
+
if (e.key === "Enter" && !e.shiftKey && B >= 0) {
|
|
3944
|
+
e.preventDefault(), H(B);
|
|
3935
3945
|
return;
|
|
3936
3946
|
}
|
|
3937
3947
|
let t = parseInt(e.key, 10);
|
|
@@ -3957,21 +3967,21 @@ var Sr = [
|
|
|
3957
3967
|
stiffness: 120,
|
|
3958
3968
|
damping: 18
|
|
3959
3969
|
},
|
|
3960
|
-
onClick: () =>
|
|
3970
|
+
onClick: () => L(!0),
|
|
3961
3971
|
children: [
|
|
3962
3972
|
(_.length > 0 || y.length > 0) && /* @__PURE__ */ G("div", {
|
|
3963
3973
|
className: "flex gap-3 overflow-x-auto custom-scrollbar px-3 pt-3 pb-1",
|
|
3964
|
-
children: [y.map((e) => /* @__PURE__ */ W(
|
|
3974
|
+
children: [y.map((e) => /* @__PURE__ */ W(sr, {
|
|
3965
3975
|
content: e,
|
|
3966
3976
|
onRemove: (e) => b((t) => t.filter((t) => t.id !== e))
|
|
3967
|
-
}, e.id)), _.map((e) => /* @__PURE__ */ W(
|
|
3977
|
+
}, e.id)), _.map((e) => /* @__PURE__ */ W(or, {
|
|
3968
3978
|
file: e,
|
|
3969
3979
|
onRemove: (e) => v((t) => t.filter((t) => t.id !== e))
|
|
3970
3980
|
}, e.id))]
|
|
3971
3981
|
}),
|
|
3972
3982
|
k && /* @__PURE__ */ W("div", {
|
|
3973
3983
|
className: "px-3 pt-2",
|
|
3974
|
-
children: /* @__PURE__ */ W(
|
|
3984
|
+
children: /* @__PURE__ */ W(Sr, {
|
|
3975
3985
|
active: k,
|
|
3976
3986
|
mode: "static",
|
|
3977
3987
|
height: 48,
|
|
@@ -3986,7 +3996,7 @@ var Sr = [
|
|
|
3986
3996
|
/* @__PURE__ */ G("div", {
|
|
3987
3997
|
className: "flex items-center gap-2 p-3",
|
|
3988
3998
|
children: [
|
|
3989
|
-
/* @__PURE__ */ W(
|
|
3999
|
+
/* @__PURE__ */ W(xr, {
|
|
3990
4000
|
onFileSelect: S,
|
|
3991
4001
|
disabled: t
|
|
3992
4002
|
}),
|
|
@@ -4000,7 +4010,7 @@ var Sr = [
|
|
|
4000
4010
|
onChange: (e) => m(e.target.value),
|
|
4001
4011
|
onPaste: E,
|
|
4002
4012
|
onKeyDown: pe,
|
|
4003
|
-
onFocus: () =>
|
|
4013
|
+
onFocus: () => L(!0),
|
|
4004
4014
|
className: "w-full bg-transparent border-0 outline-none text-text-200 dark:text-text-100 text-[16px] resize-none overflow-hidden py-1 leading-relaxed block font-normal antialiased",
|
|
4005
4015
|
rows: 1,
|
|
4006
4016
|
autoFocus: !0,
|
|
@@ -4017,12 +4027,12 @@ var Sr = [
|
|
|
4017
4027
|
overflow: "hidden",
|
|
4018
4028
|
textOverflow: "ellipsis"
|
|
4019
4029
|
},
|
|
4020
|
-
variants:
|
|
4030
|
+
variants: wr,
|
|
4021
4031
|
initial: "initial",
|
|
4022
4032
|
animate: "animate",
|
|
4023
4033
|
exit: "exit",
|
|
4024
|
-
children:
|
|
4025
|
-
variants:
|
|
4034
|
+
children: Cr[M].split("").map((e, t) => /* @__PURE__ */ W(lt.span, {
|
|
4035
|
+
variants: Tr,
|
|
4026
4036
|
style: { display: "inline-block" },
|
|
4027
4037
|
children: e === " " ? "\xA0" : e
|
|
4028
4038
|
}, t))
|
|
@@ -4101,13 +4111,13 @@ var Sr = [
|
|
|
4101
4111
|
})
|
|
4102
4112
|
]
|
|
4103
4113
|
}),
|
|
4104
|
-
/* @__PURE__ */ W(st, { children:
|
|
4114
|
+
/* @__PURE__ */ W(st, { children: ne && de > 0 && /* @__PURE__ */ W(lt.div, {
|
|
4105
4115
|
ref: (e) => {
|
|
4106
4116
|
e && g.current && g.current.contains(e);
|
|
4107
4117
|
},
|
|
4108
4118
|
initial: {
|
|
4109
4119
|
opacity: 0,
|
|
4110
|
-
y:
|
|
4120
|
+
y: ie === "above" ? 4 : -4
|
|
4111
4121
|
},
|
|
4112
4122
|
animate: {
|
|
4113
4123
|
opacity: 1,
|
|
@@ -4115,18 +4125,18 @@ var Sr = [
|
|
|
4115
4125
|
},
|
|
4116
4126
|
exit: {
|
|
4117
4127
|
opacity: 0,
|
|
4118
|
-
y:
|
|
4128
|
+
y: ie === "above" ? 4 : -4
|
|
4119
4129
|
},
|
|
4120
4130
|
transition: { duration: .12 },
|
|
4121
|
-
className: `absolute left-2 right-2 md:left-0 md:right-0 z-20 rounded-2xl bg-gray-50 dark:bg-[#30302E] border border-bg-300 dark:border-transparent shadow-xl overflow-hidden ${
|
|
4131
|
+
className: `absolute left-2 right-2 md:left-0 md:right-0 z-20 rounded-2xl bg-gray-50 dark:bg-[#30302E] border border-bg-300 dark:border-transparent shadow-xl overflow-hidden ${ie === "above" ? "bottom-full" : "top-full"}`,
|
|
4122
4132
|
onMouseDown: (e) => e.preventDefault(),
|
|
4123
4133
|
children: /* @__PURE__ */ G("ul", {
|
|
4124
4134
|
className: "max-h-72 overflow-y-auto custom-scrollbar py-1",
|
|
4125
|
-
children: [
|
|
4135
|
+
children: [ee.map((e, t) => /* @__PURE__ */ W("li", { children: /* @__PURE__ */ G("button", {
|
|
4126
4136
|
type: "button",
|
|
4127
|
-
onMouseEnter: () =>
|
|
4137
|
+
onMouseEnter: () => V(t),
|
|
4128
4138
|
onClick: () => ue(e),
|
|
4129
|
-
className: `w-full text-left px-4 py-1.5 text-[15px] flex items-center gap-3 transition-colors ${t ===
|
|
4139
|
+
className: `w-full text-left px-4 py-1.5 text-[15px] flex items-center gap-3 transition-colors ${t === B ? "bg-bg-200 text-text-100" : "text-text-200 hover:bg-bg-100 dark:hover:bg-[#3A3A38]"}`,
|
|
4130
4140
|
children: [
|
|
4131
4141
|
/* @__PURE__ */ W("span", {
|
|
4132
4142
|
className: "w-5 h-5 flex items-center justify-center rounded bg-bg-200 dark:bg-[#3A3A38] text-[11px] font-semibold text-text-400 shrink-0",
|
|
@@ -4146,13 +4156,13 @@ var Sr = [
|
|
|
4146
4156
|
children: e.domain
|
|
4147
4157
|
})
|
|
4148
4158
|
]
|
|
4149
|
-
}) }, `domain-${e.domain}`)),
|
|
4150
|
-
let n =
|
|
4159
|
+
}) }, `domain-${e.domain}`)), R.map((e, t) => {
|
|
4160
|
+
let n = ee.length + t;
|
|
4151
4161
|
return /* @__PURE__ */ W("li", { children: /* @__PURE__ */ G("button", {
|
|
4152
4162
|
type: "button",
|
|
4153
|
-
onMouseEnter: () =>
|
|
4163
|
+
onMouseEnter: () => V(n),
|
|
4154
4164
|
onClick: () => le(e),
|
|
4155
|
-
className: `w-full text-left px-4 py-1.5 text-[15px] flex items-center gap-3 transition-colors ${n ===
|
|
4165
|
+
className: `w-full text-left px-4 py-1.5 text-[15px] flex items-center gap-3 transition-colors ${n === B ? "bg-bg-200 text-text-100" : "text-text-200 hover:bg-bg-100 dark:hover:bg-[#3A3A38]"}`,
|
|
4156
4166
|
children: [
|
|
4157
4167
|
/* @__PURE__ */ W("span", {
|
|
4158
4168
|
className: "w-5 h-5 flex items-center justify-center rounded bg-bg-200 dark:bg-[#3A3A38] text-[11px] font-semibold text-text-400 shrink-0",
|
|
@@ -4180,35 +4190,35 @@ var Sr = [
|
|
|
4180
4190
|
};
|
|
4181
4191
|
//#endregion
|
|
4182
4192
|
//#region src/ui/dialog.tsx
|
|
4183
|
-
function
|
|
4193
|
+
function Dr({ ...e }) {
|
|
4184
4194
|
return /* @__PURE__ */ W(vt.Root, {
|
|
4185
4195
|
"data-slot": "dialog",
|
|
4186
4196
|
...e
|
|
4187
4197
|
});
|
|
4188
4198
|
}
|
|
4189
|
-
function
|
|
4199
|
+
function Or({ ...e }) {
|
|
4190
4200
|
return /* @__PURE__ */ W(vt.Trigger, {
|
|
4191
4201
|
"data-slot": "dialog-trigger",
|
|
4192
4202
|
...e
|
|
4193
4203
|
});
|
|
4194
4204
|
}
|
|
4195
|
-
function
|
|
4205
|
+
function kr({ ...e }) {
|
|
4196
4206
|
return /* @__PURE__ */ W(vt.Portal, {
|
|
4197
4207
|
"data-slot": "dialog-portal",
|
|
4198
4208
|
...e
|
|
4199
4209
|
});
|
|
4200
4210
|
}
|
|
4201
|
-
function
|
|
4211
|
+
function Ar({ className: e, ...t }) {
|
|
4202
4212
|
return /* @__PURE__ */ W(vt.Overlay, {
|
|
4203
4213
|
"data-slot": "dialog-overlay",
|
|
4204
4214
|
className: J("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs", e),
|
|
4205
4215
|
...t
|
|
4206
4216
|
});
|
|
4207
4217
|
}
|
|
4208
|
-
function
|
|
4209
|
-
return /* @__PURE__ */ G(
|
|
4218
|
+
function jr({ className: e, children: t, hideCloseButton: n = !1, ...r }) {
|
|
4219
|
+
return /* @__PURE__ */ G(kr, {
|
|
4210
4220
|
"data-slot": "dialog-portal",
|
|
4211
|
-
children: [/* @__PURE__ */ W(
|
|
4221
|
+
children: [/* @__PURE__ */ W(Ar, {}), /* @__PURE__ */ G(vt.Content, {
|
|
4212
4222
|
"data-slot": "dialog-content",
|
|
4213
4223
|
"aria-describedby": r["aria-describedby"] ?? void 0,
|
|
4214
4224
|
className: J("z-[9999] bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200", e),
|
|
@@ -4223,14 +4233,14 @@ function Ar({ className: e, children: t, hideCloseButton: n = !1, ...r }) {
|
|
|
4223
4233
|
})]
|
|
4224
4234
|
});
|
|
4225
4235
|
}
|
|
4226
|
-
function
|
|
4236
|
+
function Mr({ className: e, ...t }) {
|
|
4227
4237
|
return /* @__PURE__ */ W(vt.Title, {
|
|
4228
4238
|
"data-slot": "dialog-title",
|
|
4229
4239
|
className: J("text-lg leading-none font-semibold", e),
|
|
4230
4240
|
...t
|
|
4231
4241
|
});
|
|
4232
4242
|
}
|
|
4233
|
-
function
|
|
4243
|
+
function Nr({ className: e, ...t }) {
|
|
4234
4244
|
return /* @__PURE__ */ W(vt.Description, {
|
|
4235
4245
|
"data-slot": "dialog-description",
|
|
4236
4246
|
className: J("text-muted-foreground text-sm", e),
|
|
@@ -4239,7 +4249,7 @@ function Mr({ className: e, ...t }) {
|
|
|
4239
4249
|
}
|
|
4240
4250
|
//#endregion
|
|
4241
4251
|
//#region src/ui/visually-hidden.tsx
|
|
4242
|
-
var
|
|
4252
|
+
var Pr = n.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ W("span", {
|
|
4243
4253
|
ref: n,
|
|
4244
4254
|
className: J("absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0", e),
|
|
4245
4255
|
style: {
|
|
@@ -4248,17 +4258,17 @@ var Nr = n.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ W("span", {
|
|
|
4248
4258
|
},
|
|
4249
4259
|
...t
|
|
4250
4260
|
}));
|
|
4251
|
-
|
|
4261
|
+
Pr.displayName = "VisuallyHidden";
|
|
4252
4262
|
//#endregion
|
|
4253
4263
|
//#region src/components/ArticleReader/ArticlePanelHeader.tsx
|
|
4254
|
-
var
|
|
4264
|
+
var Fr = ({ onClose: e }) => /* @__PURE__ */ W("div", {
|
|
4255
4265
|
className: "flex items-center justify-between bg-secondary px-4 py-3 border-b border-border",
|
|
4256
4266
|
children: /* @__PURE__ */ W("button", {
|
|
4257
4267
|
onClick: e,
|
|
4258
4268
|
className: "rounded-md p-1 hover:bg-accent transition-colors",
|
|
4259
4269
|
children: /* @__PURE__ */ W(Pe, { className: "h-5 w-5" })
|
|
4260
4270
|
})
|
|
4261
|
-
}),
|
|
4271
|
+
}), Ir = gt("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-2xl text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
4262
4272
|
variants: {
|
|
4263
4273
|
variant: {
|
|
4264
4274
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
@@ -4280,10 +4290,10 @@ var Pr = ({ onClose: e }) => /* @__PURE__ */ W("div", {
|
|
|
4280
4290
|
size: "default"
|
|
4281
4291
|
}
|
|
4282
4292
|
});
|
|
4283
|
-
function
|
|
4293
|
+
function Lr({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
4284
4294
|
return /* @__PURE__ */ W(r ? ht : "button", {
|
|
4285
4295
|
"data-slot": "button",
|
|
4286
|
-
className: J(
|
|
4296
|
+
className: J(Ir({
|
|
4287
4297
|
variant: t,
|
|
4288
4298
|
size: n,
|
|
4289
4299
|
className: e
|
|
@@ -4293,10 +4303,10 @@ function Ir({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
|
4293
4303
|
}
|
|
4294
4304
|
//#endregion
|
|
4295
4305
|
//#region src/components/ArticleReader/ArticleActionButtons.tsx
|
|
4296
|
-
var
|
|
4306
|
+
var Rr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80 hover:text-foreground text-muted-foreground"), zr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavorited: r, isHighlightMode: i, articleUrl: a, onAskClick: o, onSuggestClick: s, onCopyClick: c, onFavoriteClick: l, onHighlightToggle: u, onClose: d }) => /* @__PURE__ */ G("div", {
|
|
4297
4307
|
className: "flex flex-nowrap items-center gap-1 rounded-2xl border border-muted bg-gradient-to-b from-background to-muted/30 p-1 shadow-sm",
|
|
4298
4308
|
children: [
|
|
4299
|
-
/* @__PURE__ */ G(
|
|
4309
|
+
/* @__PURE__ */ G(Lr, {
|
|
4300
4310
|
onClick: o,
|
|
4301
4311
|
disabled: e,
|
|
4302
4312
|
variant: "ghost",
|
|
@@ -4307,7 +4317,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4307
4317
|
children: e ? "..." : "Ask"
|
|
4308
4318
|
})]
|
|
4309
4319
|
}),
|
|
4310
|
-
/* @__PURE__ */ G(
|
|
4320
|
+
/* @__PURE__ */ G(Lr, {
|
|
4311
4321
|
onClick: s,
|
|
4312
4322
|
disabled: t,
|
|
4313
4323
|
variant: "ghost",
|
|
@@ -4318,15 +4328,15 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4318
4328
|
children: "Suggest"
|
|
4319
4329
|
})]
|
|
4320
4330
|
}),
|
|
4321
|
-
/* @__PURE__ */ W(
|
|
4331
|
+
/* @__PURE__ */ W(Lr, {
|
|
4322
4332
|
onClick: c,
|
|
4323
4333
|
variant: "ghost",
|
|
4324
4334
|
size: "icon",
|
|
4325
|
-
className:
|
|
4335
|
+
className: Rr,
|
|
4326
4336
|
title: "Copy article",
|
|
4327
4337
|
children: /* @__PURE__ */ W(F, { className: "size-4" })
|
|
4328
4338
|
}),
|
|
4329
|
-
/* @__PURE__ */ W(
|
|
4339
|
+
/* @__PURE__ */ W(Lr, {
|
|
4330
4340
|
onClick: u,
|
|
4331
4341
|
variant: "ghost",
|
|
4332
4342
|
size: "icon",
|
|
@@ -4334,7 +4344,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4334
4344
|
title: i ? "Disable highlighting" : "Enable highlighting",
|
|
4335
4345
|
children: /* @__PURE__ */ W(le, { className: "size-4" })
|
|
4336
4346
|
}),
|
|
4337
|
-
/* @__PURE__ */ W(
|
|
4347
|
+
/* @__PURE__ */ W(Lr, {
|
|
4338
4348
|
onClick: l,
|
|
4339
4349
|
disabled: n,
|
|
4340
4350
|
variant: "ghost",
|
|
@@ -4343,29 +4353,29 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4343
4353
|
title: r ? "Remove from favorites" : "Add to favorites",
|
|
4344
4354
|
children: /* @__PURE__ */ W(Ee, { className: J("size-4", r && "fill-yellow-400") })
|
|
4345
4355
|
}),
|
|
4346
|
-
a && /* @__PURE__ */ W(
|
|
4356
|
+
a && /* @__PURE__ */ W(Lr, {
|
|
4347
4357
|
asChild: !0,
|
|
4348
4358
|
variant: "ghost",
|
|
4349
4359
|
size: "icon",
|
|
4350
|
-
className:
|
|
4360
|
+
className: Rr,
|
|
4351
4361
|
title: "Open in new tab",
|
|
4352
4362
|
children: /* @__PURE__ */ W("a", {
|
|
4353
4363
|
href: a,
|
|
4354
4364
|
target: "_blank",
|
|
4355
4365
|
rel: "noopener noreferrer",
|
|
4356
|
-
children: /* @__PURE__ */ W(
|
|
4366
|
+
children: /* @__PURE__ */ W(V, { className: "size-4" })
|
|
4357
4367
|
})
|
|
4358
4368
|
}),
|
|
4359
|
-
/* @__PURE__ */ W(
|
|
4369
|
+
/* @__PURE__ */ W(Lr, {
|
|
4360
4370
|
onClick: d,
|
|
4361
4371
|
variant: "ghost",
|
|
4362
4372
|
size: "icon",
|
|
4363
|
-
className: J(
|
|
4373
|
+
className: J(Rr, "ml-auto"),
|
|
4364
4374
|
title: "Close",
|
|
4365
4375
|
children: /* @__PURE__ */ W(Pe, { className: "size-4" })
|
|
4366
4376
|
})
|
|
4367
4377
|
]
|
|
4368
|
-
}),
|
|
4378
|
+
}), Br = ({ value: e, onChange: t, onSubmit: n }) => /* @__PURE__ */ W("div", {
|
|
4369
4379
|
className: "relative",
|
|
4370
4380
|
children: /* @__PURE__ */ W("input", {
|
|
4371
4381
|
value: e,
|
|
@@ -4375,7 +4385,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4375
4385
|
placeholder: "Ask AI any question...",
|
|
4376
4386
|
className: "w-full px-3 py-2 text-sm rounded-md border border-input bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
4377
4387
|
})
|
|
4378
|
-
}),
|
|
4388
|
+
}), Vr = ({ questions: e, isLoading: n, error: i, onQuestionClick: a }) => {
|
|
4379
4389
|
let o = r.useMemo(() => {
|
|
4380
4390
|
let t = [];
|
|
4381
4391
|
return e.forEach((e) => {
|
|
@@ -4412,7 +4422,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4412
4422
|
children: i
|
|
4413
4423
|
})
|
|
4414
4424
|
] });
|
|
4415
|
-
},
|
|
4425
|
+
}, Hr = ({ response: e, isLoading: t, error: n }) => /* @__PURE__ */ G(U, { children: [
|
|
4416
4426
|
t && /* @__PURE__ */ W("div", {
|
|
4417
4427
|
className: "flex justify-center",
|
|
4418
4428
|
children: /* @__PURE__ */ W("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" })
|
|
@@ -4426,7 +4436,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4426
4436
|
className: "bg-red-500 text-white p-2 rounded-md text-sm",
|
|
4427
4437
|
children: n
|
|
4428
4438
|
})
|
|
4429
|
-
] }),
|
|
4439
|
+
] }), Ur = ({ html: e, isHighlightMode: t = !1 }) => {
|
|
4430
4440
|
let [n, r] = p("");
|
|
4431
4441
|
return u(() => {
|
|
4432
4442
|
r(yt.sanitize(e || "", {
|
|
@@ -4437,7 +4447,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4437
4447
|
className: `prose prose-neutral dark:prose-invert max-w-none ${t ? "select-text" : ""}`,
|
|
4438
4448
|
dangerouslySetInnerHTML: { __html: n }
|
|
4439
4449
|
});
|
|
4440
|
-
},
|
|
4450
|
+
}, Wr = ({ article: e, isHighlightMode: t }) => /* @__PURE__ */ W("div", {
|
|
4441
4451
|
className: "border-t border-border pt-6",
|
|
4442
4452
|
children: /* @__PURE__ */ G("div", { children: [
|
|
4443
4453
|
/* @__PURE__ */ W("div", { className: "flex items-start justify-between mb-2" }),
|
|
@@ -4458,23 +4468,23 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4458
4468
|
}),
|
|
4459
4469
|
/* @__PURE__ */ W("div", {
|
|
4460
4470
|
id: "article-content",
|
|
4461
|
-
children: /* @__PURE__ */ W(
|
|
4471
|
+
children: /* @__PURE__ */ W(Ur, {
|
|
4462
4472
|
html: e.html || "",
|
|
4463
4473
|
isHighlightMode: t
|
|
4464
4474
|
})
|
|
4465
4475
|
})
|
|
4466
4476
|
] })
|
|
4467
|
-
}),
|
|
4468
|
-
function
|
|
4477
|
+
}), Gr = /(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/g, Kr = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
|
|
4478
|
+
function qr(e) {
|
|
4469
4479
|
return e.includes("](") || e.includes(")[") ? !1 : /\.(com|org|net|io|dev|co|uk|de|fr|it|es|jp|cn|in|br|au|ca|us|gov|edu|mil|int|xyz|info|app|tech|online|site|website|store|shop|blog|news|tv|me|cc|ws|name|mobi|asia|tel|travel|jobs|pro|museum|coop|aero|arpa|biz|cat|jobs|post|tel|xxx|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)(?:\/|$)/i.test(e);
|
|
4470
4480
|
}
|
|
4471
|
-
function
|
|
4481
|
+
function Jr(e) {
|
|
4472
4482
|
return /^https?:\/\//i.test(e) ? e : `https://${e}`;
|
|
4473
4483
|
}
|
|
4474
|
-
function
|
|
4484
|
+
function Yr(e) {
|
|
4475
4485
|
if (!e || typeof e != "string") return e;
|
|
4476
4486
|
let t = e, n = [], r;
|
|
4477
|
-
for (
|
|
4487
|
+
for (Kr.lastIndex = 0; (r = Kr.exec(t)) !== null;) {
|
|
4478
4488
|
let e = r[0], i = r.index, a = t.substring(0, i), o = t.substring(i + e.length);
|
|
4479
4489
|
!a.endsWith("](") && !o.startsWith(")") && n.push({
|
|
4480
4490
|
email: e,
|
|
@@ -4486,9 +4496,9 @@ function Jr(e) {
|
|
|
4486
4496
|
t = t.substring(0, i) + `[${r}](mailto:${r})` + t.substring(i + r.length);
|
|
4487
4497
|
}
|
|
4488
4498
|
let i = [], a;
|
|
4489
|
-
for (
|
|
4499
|
+
for (Gr.lastIndex = 0; (a = Gr.exec(t)) !== null;) {
|
|
4490
4500
|
let e = a[0], n = a.index;
|
|
4491
|
-
if (
|
|
4501
|
+
if (Kr.test(e)) continue;
|
|
4492
4502
|
let r = t.substring(0, n), o = t.substring(n + e.length);
|
|
4493
4503
|
if (r.endsWith("](") || o.startsWith(")") || (r.match(/```/g) || []).length % 2 != 0) continue;
|
|
4494
4504
|
let s = r.lastIndexOf("`");
|
|
@@ -4496,23 +4506,23 @@ function Jr(e) {
|
|
|
4496
4506
|
let e = t.substring(s + 1).indexOf("`");
|
|
4497
4507
|
if (e !== -1 && e > n - s - 1) continue;
|
|
4498
4508
|
}
|
|
4499
|
-
|
|
4509
|
+
qr(e) && i.push({
|
|
4500
4510
|
url: e,
|
|
4501
4511
|
index: n
|
|
4502
4512
|
});
|
|
4503
4513
|
}
|
|
4504
4514
|
for (let e = i.length - 1; e >= 0; e--) {
|
|
4505
|
-
let { url: n, index: r } = i[e], a =
|
|
4515
|
+
let { url: n, index: r } = i[e], a = Jr(n);
|
|
4506
4516
|
t = t.substring(0, r) + `[${n}](${a})` + t.substring(r + n.length);
|
|
4507
4517
|
}
|
|
4508
4518
|
return t;
|
|
4509
4519
|
}
|
|
4510
4520
|
//#endregion
|
|
4511
4521
|
//#region src/components/ArticleReader/unified-markdown.tsx
|
|
4512
|
-
function
|
|
4522
|
+
function Xr(e) {
|
|
4513
4523
|
return !e || e.startsWith("http://") || e.startsWith("https://") || e.includes("://") ? !1 : e.startsWith("/") || e.startsWith("#");
|
|
4514
4524
|
}
|
|
4515
|
-
function
|
|
4525
|
+
function Zr(e, t) {
|
|
4516
4526
|
if (t.startsWith("#")) {
|
|
4517
4527
|
e.preventDefault();
|
|
4518
4528
|
let n = t.substring(1), r = document.getElementById(n);
|
|
@@ -4522,7 +4532,7 @@ function Xr(e, t) {
|
|
|
4522
4532
|
});
|
|
4523
4533
|
}
|
|
4524
4534
|
}
|
|
4525
|
-
function
|
|
4535
|
+
function Qr({ code: e }) {
|
|
4526
4536
|
let [t, n] = p(!1);
|
|
4527
4537
|
return /* @__PURE__ */ W("button", {
|
|
4528
4538
|
onClick: c(async () => {
|
|
@@ -4534,10 +4544,10 @@ function Zr({ code: e }) {
|
|
|
4534
4544
|
}, [e]),
|
|
4535
4545
|
className: J("absolute top-3 right-3 p-1.5 rounded-md", "opacity-0 group-hover:opacity-100 transition-opacity duration-150", "bg-zinc-200/80 hover:bg-zinc-300 dark:bg-zinc-700/80 dark:hover:bg-zinc-600", "text-zinc-600 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200", "focus:outline-none focus:ring-1 focus:ring-zinc-400 dark:focus:ring-zinc-500"),
|
|
4536
4546
|
"aria-label": t ? "Copied!" : "Copy code",
|
|
4537
|
-
children: t ? /* @__PURE__ */ W(k, { className: "h-4 w-4 text-green-600 dark:text-green-400" }) : /* @__PURE__ */ W(
|
|
4547
|
+
children: t ? /* @__PURE__ */ W(k, { className: "h-4 w-4 text-green-600 dark:text-green-400" }) : /* @__PURE__ */ W(ee, { className: "h-4 w-4" })
|
|
4538
4548
|
});
|
|
4539
4549
|
}
|
|
4540
|
-
function
|
|
4550
|
+
function $r({ children: e }) {
|
|
4541
4551
|
let t = f(null), [n, r] = p("");
|
|
4542
4552
|
return u(() => {
|
|
4543
4553
|
if (t.current) {
|
|
@@ -4553,15 +4563,15 @@ function Qr({ children: e }) {
|
|
|
4553
4563
|
ref: t,
|
|
4554
4564
|
className: J("p-4 rounded-xl overflow-x-auto", "bg-zinc-100 dark:bg-zinc-900", "border border-zinc-200 dark:border-zinc-800", "text-[13px] font-mono leading-relaxed", "text-zinc-800 dark:text-zinc-200", "[&_code]:bg-transparent [&_code]:text-inherit [&_code]:p-0"),
|
|
4555
4565
|
children: e
|
|
4556
|
-
}), n && /* @__PURE__ */ W(
|
|
4566
|
+
}), n && /* @__PURE__ */ W(Qr, { code: n })]
|
|
4557
4567
|
});
|
|
4558
4568
|
}
|
|
4559
|
-
var
|
|
4569
|
+
var ei = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
4560
4570
|
if (!e) return /* @__PURE__ */ W("div", {
|
|
4561
4571
|
className: J("text-muted-foreground text-sm", t),
|
|
4562
4572
|
children: "No content"
|
|
4563
4573
|
});
|
|
4564
|
-
let r =
|
|
4574
|
+
let r = Yr(e);
|
|
4565
4575
|
return /* @__PURE__ */ W("div", {
|
|
4566
4576
|
className: J("kortix-markdown", t),
|
|
4567
4577
|
children: /* @__PURE__ */ W(xt, {
|
|
@@ -4608,10 +4618,10 @@ var $r = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4608
4618
|
children: e
|
|
4609
4619
|
}),
|
|
4610
4620
|
a: ({ href: e, children: t }) => {
|
|
4611
|
-
let n =
|
|
4621
|
+
let n = Xr(e), r = e?.startsWith("#"), i = J("font-medium text-foreground", "underline decoration-foreground/30 underline-offset-[3px] decoration-[1px]", "hover:decoration-foreground/60 transition-colors duration-150");
|
|
4612
4622
|
return r ? /* @__PURE__ */ W("a", {
|
|
4613
4623
|
href: e,
|
|
4614
|
-
onClick: (t) =>
|
|
4624
|
+
onClick: (t) => Zr(t, e),
|
|
4615
4625
|
className: i,
|
|
4616
4626
|
children: t
|
|
4617
4627
|
}) : n ? /* @__PURE__ */ W(bt, {
|
|
@@ -4633,7 +4643,7 @@ var $r = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4633
4643
|
className: "px-2 py-1 rounded-md text-[13px] font-mono bg-card dark:bg-[#161618] border border-neutral-200 dark:border-neutral-700/50 text-foreground",
|
|
4634
4644
|
children: e
|
|
4635
4645
|
}),
|
|
4636
|
-
pre: ({ children: e }) => /* @__PURE__ */ W(
|
|
4646
|
+
pre: ({ children: e }) => /* @__PURE__ */ W($r, { children: e }),
|
|
4637
4647
|
blockquote: ({ children: e }) => /* @__PURE__ */ W("blockquote", {
|
|
4638
4648
|
className: J("my-5 pl-4 py-1 text-sm", "border-l-2 border-border", "text-muted-foreground", "[&>p]:my-2"),
|
|
4639
4649
|
children: e
|
|
@@ -4714,28 +4724,28 @@ var $r = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4714
4724
|
})
|
|
4715
4725
|
});
|
|
4716
4726
|
});
|
|
4717
|
-
|
|
4727
|
+
ei.displayName = "UnifiedMarkdown";
|
|
4718
4728
|
//#endregion
|
|
4719
4729
|
//#region src/components/ArticleReader/ArticleExtractPanel.tsx
|
|
4720
|
-
var
|
|
4721
|
-
let { isOpen: n, url: r, searchText: i, panelWidth: a, setPanelWidth: o, closePanel: s } = Tt(), { isAuthenticated: c } =
|
|
4730
|
+
var ti = (e) => {
|
|
4731
|
+
let { isOpen: n, url: r, searchText: i, panelWidth: a, setPanelWidth: o, closePanel: s } = Tt(), { isAuthenticated: c } = Sn(), l = e.isOpen === void 0 ? n : e.isOpen, d = e.onClose || s, m = e.url || r, h = e.searchText === void 0 ? i : e.searchText, [g, _] = p(null), [v, y] = p([]), [b, x] = p(!1), [S, C] = p(t.defaultSummarizePrompt), [w, T] = p(!1), [E, D] = p(!1), [O, k] = p(!1), [A, j] = p(""), [M, N] = p(""), [P, F] = p([]), [I, L] = p(""), [R, z] = p(!1), [ee, te] = p(!1), [B, V] = p(!1), [ne, re] = p(!1), [ie, ae] = p(a), [oe, se] = p(!1), [ce, le] = p(!1), ue = f(null);
|
|
4722
4732
|
u(() => {
|
|
4723
4733
|
let e = () => {
|
|
4724
|
-
|
|
4734
|
+
re(window.innerWidth >= 1024);
|
|
4725
4735
|
};
|
|
4726
4736
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
4727
4737
|
}, []), u(() => {
|
|
4728
4738
|
let e = (e) => {
|
|
4729
|
-
if (!
|
|
4739
|
+
if (!oe) return;
|
|
4730
4740
|
let t = window.innerWidth - e.clientX, n = Math.max(400, Math.min(t, window.innerWidth - 100));
|
|
4731
|
-
|
|
4741
|
+
ae(n), o(n);
|
|
4732
4742
|
}, t = () => {
|
|
4733
4743
|
se(!1);
|
|
4734
4744
|
};
|
|
4735
|
-
return
|
|
4745
|
+
return oe && (document.addEventListener("mousemove", e), document.addEventListener("mouseup", t), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none"), () => {
|
|
4736
4746
|
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", t), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
4737
4747
|
};
|
|
4738
|
-
}, [
|
|
4748
|
+
}, [oe, o]), u(() => {
|
|
4739
4749
|
l && m ? (le(!1), de()) : l || le(!1);
|
|
4740
4750
|
}, [l, m]);
|
|
4741
4751
|
let de = async () => {
|
|
@@ -4776,15 +4786,15 @@ var ei = (e) => {
|
|
|
4776
4786
|
}, H = async () => {
|
|
4777
4787
|
try {
|
|
4778
4788
|
let { data: e } = await Qe(), t = e?.favorites?.some((e) => e.url === m);
|
|
4779
|
-
|
|
4789
|
+
z(!!t);
|
|
4780
4790
|
} catch (e) {
|
|
4781
4791
|
console.error("Error checking favorite status:", e);
|
|
4782
4792
|
}
|
|
4783
4793
|
}, fe = async () => {
|
|
4784
4794
|
if (g) {
|
|
4785
|
-
|
|
4795
|
+
te(!0);
|
|
4786
4796
|
try {
|
|
4787
|
-
|
|
4797
|
+
R ? (await et({ query: { url: m } }), z(!1), K.info("Removed from favorites")) : (await Ie({ body: {
|
|
4788
4798
|
url: g.url || m,
|
|
4789
4799
|
title: g.title,
|
|
4790
4800
|
cite: g.cite,
|
|
@@ -4794,16 +4804,16 @@ var ei = (e) => {
|
|
|
4794
4804
|
source: g.source,
|
|
4795
4805
|
word_count: g.word_count,
|
|
4796
4806
|
html: g.html
|
|
4797
|
-
} }),
|
|
4807
|
+
} }), z(!0), K.success("Added to favorites"));
|
|
4798
4808
|
} catch (e) {
|
|
4799
4809
|
console.error("Error toggling favorite:", e), K.error("Failed to toggle favorite");
|
|
4800
4810
|
} finally {
|
|
4801
|
-
|
|
4811
|
+
te(!1);
|
|
4802
4812
|
}
|
|
4803
4813
|
}
|
|
4804
4814
|
}, pe = async (e) => {
|
|
4805
4815
|
if (!g) return;
|
|
4806
|
-
let n = g.html?.replace(/<[^>]*>?/g, "").slice(0, t.maxArticleLength), r = e === "question", i = r ? D : k, a = r ? N :
|
|
4816
|
+
let n = g.html?.replace(/<[^>]*>?/g, "").slice(0, t.maxArticleLength), r = e === "question", i = r ? D : k, a = r ? N : L;
|
|
4807
4817
|
i(!0), a("");
|
|
4808
4818
|
try {
|
|
4809
4819
|
if (r) {
|
|
@@ -4880,30 +4890,30 @@ var ei = (e) => {
|
|
|
4880
4890
|
children: [/* @__PURE__ */ G("div", {
|
|
4881
4891
|
className: "space-y-4",
|
|
4882
4892
|
children: [
|
|
4883
|
-
/* @__PURE__ */ W(
|
|
4893
|
+
/* @__PURE__ */ W(zr, {
|
|
4884
4894
|
isLoadingAI: E,
|
|
4885
4895
|
isLoadingFollowups: O,
|
|
4886
|
-
isLoadingFavorite:
|
|
4887
|
-
isFavorited:
|
|
4888
|
-
isHighlightMode:
|
|
4896
|
+
isLoadingFavorite: ee,
|
|
4897
|
+
isFavorited: R,
|
|
4898
|
+
isHighlightMode: B,
|
|
4889
4899
|
articleUrl: g?.url || m,
|
|
4890
4900
|
onAskClick: () => pe("question"),
|
|
4891
4901
|
onSuggestClick: () => pe("suggest-followups"),
|
|
4892
4902
|
onCopyClick: he,
|
|
4893
4903
|
onFavoriteClick: fe,
|
|
4894
|
-
onHighlightToggle: () =>
|
|
4904
|
+
onHighlightToggle: () => V(!B),
|
|
4895
4905
|
onClose: d
|
|
4896
4906
|
}),
|
|
4897
4907
|
b && /* @__PURE__ */ W("div", {
|
|
4898
4908
|
className: "bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg",
|
|
4899
4909
|
children: "Copied!"
|
|
4900
4910
|
}),
|
|
4901
|
-
/* @__PURE__ */ W(
|
|
4911
|
+
/* @__PURE__ */ W(Br, {
|
|
4902
4912
|
value: S,
|
|
4903
4913
|
onChange: C,
|
|
4904
4914
|
onSubmit: () => pe("question")
|
|
4905
4915
|
}),
|
|
4906
|
-
/* @__PURE__ */ W(
|
|
4916
|
+
/* @__PURE__ */ W(Vr, {
|
|
4907
4917
|
questions: P,
|
|
4908
4918
|
isLoading: O,
|
|
4909
4919
|
error: I,
|
|
@@ -4934,7 +4944,7 @@ var ei = (e) => {
|
|
|
4934
4944
|
})
|
|
4935
4945
|
}, t))
|
|
4936
4946
|
}),
|
|
4937
|
-
(E || A && v.length === 0) && /* @__PURE__ */ W(
|
|
4947
|
+
(E || A && v.length === 0) && /* @__PURE__ */ W(Hr, {
|
|
4938
4948
|
response: A,
|
|
4939
4949
|
isLoading: E,
|
|
4940
4950
|
error: M
|
|
@@ -4944,16 +4954,16 @@ var ei = (e) => {
|
|
|
4944
4954
|
children: M
|
|
4945
4955
|
})
|
|
4946
4956
|
]
|
|
4947
|
-
}), g && /* @__PURE__ */ W(
|
|
4957
|
+
}), g && /* @__PURE__ */ W(Wr, {
|
|
4948
4958
|
article: g,
|
|
4949
|
-
isHighlightMode:
|
|
4959
|
+
isHighlightMode: B
|
|
4950
4960
|
})]
|
|
4951
4961
|
})
|
|
4952
4962
|
})
|
|
4953
4963
|
});
|
|
4954
|
-
return !l || !ce ? null :
|
|
4964
|
+
return !l || !ce ? null : ne ? /* @__PURE__ */ G("div", {
|
|
4955
4965
|
className: "fixed top-0 right-0 h-screen z-40 transition-all duration-300",
|
|
4956
|
-
style: { width: `${
|
|
4966
|
+
style: { width: `${ie}px` },
|
|
4957
4967
|
children: [/* @__PURE__ */ W("div", {
|
|
4958
4968
|
ref: ue,
|
|
4959
4969
|
onMouseDown: () => se(!0),
|
|
@@ -4961,20 +4971,20 @@ var ei = (e) => {
|
|
|
4961
4971
|
style: { touchAction: "none" },
|
|
4962
4972
|
children: /* @__PURE__ */ W("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-1 h-12 rounded-full bg-muted-foreground opacity-50 hover:opacity-100 transition-opacity" })
|
|
4963
4973
|
}), ge()]
|
|
4964
|
-
}) : /* @__PURE__ */ W(
|
|
4974
|
+
}) : /* @__PURE__ */ W(Dr, {
|
|
4965
4975
|
open: l,
|
|
4966
4976
|
onOpenChange: (e) => !e && d(),
|
|
4967
|
-
children: /* @__PURE__ */ G(
|
|
4977
|
+
children: /* @__PURE__ */ G(jr, {
|
|
4968
4978
|
className: "pointer-events-auto fixed inset-0 !top-0 !left-0 !translate-x-0 !translate-y-0 h-full w-full max-w-none p-0 m-0 rounded-none border-0 overflow-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",
|
|
4969
4979
|
hideCloseButton: !0,
|
|
4970
|
-
children: [/* @__PURE__ */ W(
|
|
4980
|
+
children: [/* @__PURE__ */ W(Pr, { children: /* @__PURE__ */ W(Mr, { children: "Article Details" }) }), /* @__PURE__ */ W("div", {
|
|
4971
4981
|
className: "h-full overflow-y-auto",
|
|
4972
4982
|
children: ge()
|
|
4973
4983
|
})]
|
|
4974
4984
|
})
|
|
4975
4985
|
});
|
|
4976
|
-
},
|
|
4977
|
-
let { sections: e, chatTurns: n, loading: r, messageAppeared: a, newChat: o, chatId: s } =
|
|
4986
|
+
}, ni = () => {
|
|
4987
|
+
let { sections: e, chatTurns: n, loading: r, messageAppeared: a, newChat: o, chatId: s } = yn(), { isOpen: c, panelWidth: l } = Tt(), { isAuthenticated: d } = Sn(), [m, h] = p(!1), g = f(null), _ = f(null), v = f(!1);
|
|
4978
4988
|
return u(() => {
|
|
4979
4989
|
let e = () => {
|
|
4980
4990
|
h(window.innerWidth >= 1024);
|
|
@@ -4995,7 +5005,7 @@ var ei = (e) => {
|
|
|
4995
5005
|
children: [
|
|
4996
5006
|
e.map((t, n) => {
|
|
4997
5007
|
let r = n === e.length - 1;
|
|
4998
|
-
return /* @__PURE__ */ G(i, { children: [/* @__PURE__ */ W(
|
|
5008
|
+
return /* @__PURE__ */ G(i, { children: [/* @__PURE__ */ W(ir, {
|
|
4999
5009
|
section: t,
|
|
5000
5010
|
sectionIndex: n,
|
|
5001
5011
|
dividerRef: r ? g : void 0,
|
|
@@ -5026,13 +5036,13 @@ var ei = (e) => {
|
|
|
5026
5036
|
]
|
|
5027
5037
|
}), /* @__PURE__ */ W("div", {
|
|
5028
5038
|
className: "sticky bottom-[60px] md:bottom-0 z-40 bg-gradient-to-t from-background via-background to-transparent pt-4 pb-2",
|
|
5029
|
-
children: /* @__PURE__ */ W(
|
|
5039
|
+
children: /* @__PURE__ */ W(Er, {})
|
|
5030
5040
|
})]
|
|
5031
|
-
}), /* @__PURE__ */ W(
|
|
5041
|
+
}), /* @__PURE__ */ W(ti, {})] });
|
|
5032
5042
|
};
|
|
5033
5043
|
//#endregion
|
|
5034
5044
|
//#region src/ui/gradient-blur.tsx
|
|
5035
|
-
function
|
|
5045
|
+
function ri({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "transparent", color: r, colorGenerator: i }) {
|
|
5036
5046
|
let a = f(null), o = f({
|
|
5037
5047
|
x: 0,
|
|
5038
5048
|
y: 0
|
|
@@ -5092,28 +5102,28 @@ function ni({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "tran
|
|
|
5092
5102
|
}
|
|
5093
5103
|
//#endregion
|
|
5094
5104
|
//#region src/components/ChatHistoryDropdown/useHistoryState.ts
|
|
5095
|
-
var
|
|
5096
|
-
function
|
|
5105
|
+
var ii = "qwksearch_pinned_chats";
|
|
5106
|
+
function ai() {
|
|
5097
5107
|
if (typeof window > "u") return [];
|
|
5098
5108
|
try {
|
|
5099
|
-
let e = localStorage.getItem(
|
|
5109
|
+
let e = localStorage.getItem(ii);
|
|
5100
5110
|
return e ? JSON.parse(e) : [];
|
|
5101
5111
|
} catch {
|
|
5102
5112
|
return [];
|
|
5103
5113
|
}
|
|
5104
5114
|
}
|
|
5105
|
-
function
|
|
5106
|
-
typeof window > "u" || localStorage.setItem(
|
|
5115
|
+
function oi(e) {
|
|
5116
|
+
typeof window > "u" || localStorage.setItem(ii, JSON.stringify(e));
|
|
5107
5117
|
}
|
|
5108
|
-
function
|
|
5109
|
-
let [e, t] = p([]), [n, r] = p(!0), [i, a] = p(!1), [o, s] = p(null), [l, f] = p(!1), [m, h] = p(!1), [g, _] = p(!1), [v, y] = p([]), [b, x] = p(""), [S, C] = p([]), [w, T] = p(!1), { isAuthenticated: E, isLoading: D } =
|
|
5118
|
+
function si() {
|
|
5119
|
+
let [e, t] = p([]), [n, r] = p(!0), [i, a] = p(!1), [o, s] = p(null), [l, f] = p(!1), [m, h] = p(!1), [g, _] = p(!1), [v, y] = p([]), [b, x] = p(""), [S, C] = p([]), [w, T] = p(!1), { isAuthenticated: E, isLoading: D } = Sn(), { incognito: O, setIncognito: k } = yn();
|
|
5110
5120
|
u(() => {
|
|
5111
|
-
y(
|
|
5121
|
+
y(ai());
|
|
5112
5122
|
}, []);
|
|
5113
5123
|
let A = c((e, t) => {
|
|
5114
5124
|
e.preventDefault(), e.stopPropagation(), y((e) => {
|
|
5115
5125
|
let n = e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
|
|
5116
|
-
return
|
|
5126
|
+
return oi(n), n;
|
|
5117
5127
|
});
|
|
5118
5128
|
}, []), j = d(() => [...e].sort((e, t) => {
|
|
5119
5129
|
let n = v.includes(e.id), r = v.includes(t.id);
|
|
@@ -5174,7 +5184,7 @@ function oi() {
|
|
|
5174
5184
|
}
|
|
5175
5185
|
}, I = () => {
|
|
5176
5186
|
h(!0);
|
|
5177
|
-
},
|
|
5187
|
+
}, L = async () => {
|
|
5178
5188
|
_(!0);
|
|
5179
5189
|
try {
|
|
5180
5190
|
if (E) {
|
|
@@ -5187,9 +5197,9 @@ function oi() {
|
|
|
5187
5197
|
} finally {
|
|
5188
5198
|
h(!1), _(!1);
|
|
5189
5199
|
}
|
|
5190
|
-
},
|
|
5200
|
+
}, R = () => {
|
|
5191
5201
|
k(!O), K.success(O ? "Private mode off" : "Private mode on — messages won't be saved");
|
|
5192
|
-
},
|
|
5202
|
+
}, z = c(async (e) => {
|
|
5193
5203
|
if (!e.trim()) {
|
|
5194
5204
|
C([]), T(!1);
|
|
5195
5205
|
return;
|
|
@@ -5218,10 +5228,10 @@ function oi() {
|
|
|
5218
5228
|
}, [E]);
|
|
5219
5229
|
return u(() => {
|
|
5220
5230
|
let e = setTimeout(() => {
|
|
5221
|
-
|
|
5231
|
+
z(b);
|
|
5222
5232
|
}, 300);
|
|
5223
5233
|
return () => clearTimeout(e);
|
|
5224
|
-
}, [b,
|
|
5234
|
+
}, [b, z]), {
|
|
5225
5235
|
chats: e,
|
|
5226
5236
|
sortedChats: j,
|
|
5227
5237
|
displayChats: M,
|
|
@@ -5229,7 +5239,7 @@ function oi() {
|
|
|
5229
5239
|
pinnedIds: v,
|
|
5230
5240
|
togglePin: A,
|
|
5231
5241
|
incognito: O,
|
|
5232
|
-
toggleIncognito:
|
|
5242
|
+
toggleIncognito: R,
|
|
5233
5243
|
searchQuery: b,
|
|
5234
5244
|
searchResults: S,
|
|
5235
5245
|
searching: w,
|
|
@@ -5247,12 +5257,12 @@ function oi() {
|
|
|
5247
5257
|
setClearAllDialogOpen: h,
|
|
5248
5258
|
clearingAll: g,
|
|
5249
5259
|
handleClearAllClick: I,
|
|
5250
|
-
handleConfirmClearAll:
|
|
5260
|
+
handleConfirmClearAll: L
|
|
5251
5261
|
};
|
|
5252
5262
|
}
|
|
5253
5263
|
//#endregion
|
|
5254
5264
|
//#region src/components/ChatHistoryDropdown/HistoryHeader.tsx
|
|
5255
|
-
function
|
|
5265
|
+
function ci({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r, searchQuery: i, onSearchChange: a }) {
|
|
5256
5266
|
return /* @__PURE__ */ G("div", {
|
|
5257
5267
|
className: "mb-2 pb-2 border-b border-border space-y-2",
|
|
5258
5268
|
children: [/* @__PURE__ */ G("div", {
|
|
@@ -5299,7 +5309,7 @@ function si({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r
|
|
|
5299
5309
|
}
|
|
5300
5310
|
//#endregion
|
|
5301
5311
|
//#region src/components/ChatHistoryDropdown/HistoryChatItem.tsx
|
|
5302
|
-
function
|
|
5312
|
+
function li({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
|
|
5303
5313
|
let i = e.messageCount ?? 0;
|
|
5304
5314
|
return /* @__PURE__ */ G("div", {
|
|
5305
5315
|
className: "group flex items-center gap-1 px-2 py-1 rounded-lg hover:bg-secondary transition-colors duration-200",
|
|
@@ -5309,10 +5319,10 @@ function ci({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
|
|
|
5309
5319
|
className: "flex-1 min-w-0 flex items-center gap-1.5",
|
|
5310
5320
|
children: [/* @__PURE__ */ G("span", {
|
|
5311
5321
|
className: "flex items-center gap-1 shrink-0",
|
|
5312
|
-
children: [i > 0 && /* @__PURE__ */ G(
|
|
5322
|
+
children: [i > 0 && /* @__PURE__ */ G(nr, {
|
|
5313
5323
|
className: "px-1.5 py-0 text-[10px] font-medium bg-zinc-200 text-zinc-700 hover:bg-zinc-200 dark:bg-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-700 border-0 rounded-md",
|
|
5314
5324
|
children: [i, "Q"]
|
|
5315
|
-
}), /* @__PURE__ */ W(
|
|
5325
|
+
}), /* @__PURE__ */ W(nr, {
|
|
5316
5326
|
className: "px-1.5 py-0 text-[10px] font-medium bg-zinc-100 text-zinc-500 hover:bg-zinc-100 dark:bg-zinc-800 dark:text-zinc-400 dark:hover:bg-zinc-800 border-0 rounded-md",
|
|
5317
5327
|
children: St(/* @__PURE__ */ new Date(), e.createdAt)
|
|
5318
5328
|
})]
|
|
@@ -5341,20 +5351,20 @@ function ci({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
|
|
|
5341
5351
|
}
|
|
5342
5352
|
//#endregion
|
|
5343
5353
|
//#region src/components/ChatHistoryDropdown/HistoryDialogs.tsx
|
|
5344
|
-
function
|
|
5345
|
-
return /* @__PURE__ */ W(
|
|
5354
|
+
function ui({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i, loadingLabel: a, loading: o, onConfirm: s }) {
|
|
5355
|
+
return /* @__PURE__ */ W(Dr, {
|
|
5346
5356
|
open: e,
|
|
5347
5357
|
onOpenChange: (e) => {
|
|
5348
5358
|
!e && !o && t(!1);
|
|
5349
5359
|
},
|
|
5350
|
-
children: /* @__PURE__ */ G(
|
|
5360
|
+
children: /* @__PURE__ */ G(jr, {
|
|
5351
5361
|
className: "w-full max-w-md transform rounded-2xl bg-light-secondary dark:bg-dark-secondary border border-light-200 dark:border-dark-200 p-6 text-left align-middle shadow-xl",
|
|
5352
5362
|
children: [
|
|
5353
|
-
/* @__PURE__ */ W(
|
|
5363
|
+
/* @__PURE__ */ W(Mr, {
|
|
5354
5364
|
className: "text-lg font-medium leading-6 dark:text-white",
|
|
5355
5365
|
children: n
|
|
5356
5366
|
}),
|
|
5357
|
-
/* @__PURE__ */ W(
|
|
5367
|
+
/* @__PURE__ */ W(Nr, {
|
|
5358
5368
|
className: "text-sm dark:text-white/70 text-black/70 mt-2",
|
|
5359
5369
|
children: r
|
|
5360
5370
|
}),
|
|
@@ -5377,8 +5387,8 @@ function li({ open: e, onOpenChange: t, title: n, description: r, confirmLabel:
|
|
|
5377
5387
|
})
|
|
5378
5388
|
});
|
|
5379
5389
|
}
|
|
5380
|
-
function
|
|
5381
|
-
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(
|
|
5390
|
+
function di({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setChatToDelete: r, deleting: i, onConfirmDelete: a, clearAllDialogOpen: o, setClearAllDialogOpen: s, clearingAll: c, onConfirmClearAll: l }) {
|
|
5391
|
+
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(ui, {
|
|
5382
5392
|
open: e,
|
|
5383
5393
|
onOpenChange: (e) => {
|
|
5384
5394
|
t(e), e || r(null);
|
|
@@ -5389,7 +5399,7 @@ function ui({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
|
|
|
5389
5399
|
loadingLabel: "Deleting...",
|
|
5390
5400
|
loading: i,
|
|
5391
5401
|
onConfirm: a
|
|
5392
|
-
}), /* @__PURE__ */ W(
|
|
5402
|
+
}), /* @__PURE__ */ W(ui, {
|
|
5393
5403
|
open: o,
|
|
5394
5404
|
onOpenChange: s,
|
|
5395
5405
|
title: "Clear All History",
|
|
@@ -5402,13 +5412,13 @@ function ui({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
|
|
|
5402
5412
|
}
|
|
5403
5413
|
//#endregion
|
|
5404
5414
|
//#region src/components/ChatHistoryDropdown/HistoryDropdown.tsx
|
|
5405
|
-
var
|
|
5415
|
+
var fi = {
|
|
5406
5416
|
Today: /* @__PURE__ */ W(Oe, { size: 12 }),
|
|
5407
|
-
Yesterday: /* @__PURE__ */ W(
|
|
5417
|
+
Yesterday: /* @__PURE__ */ W(L, { size: 12 }),
|
|
5408
5418
|
"This Week": /* @__PURE__ */ W(O, { size: 12 }),
|
|
5409
5419
|
Older: /* @__PURE__ */ W(S, { size: 12 })
|
|
5410
5420
|
};
|
|
5411
|
-
function
|
|
5421
|
+
function pi(e) {
|
|
5412
5422
|
let t = /* @__PURE__ */ new Date(), n = new Date(t.getFullYear(), t.getMonth(), t.getDate()), r = /* @__PURE__ */ new Date(n.getTime() - 864e5), i = /* @__PURE__ */ new Date(n.getTime() - 6 * 864e5), a = {
|
|
5413
5423
|
Today: [],
|
|
5414
5424
|
Yesterday: [],
|
|
@@ -5429,19 +5439,19 @@ function fi(e) {
|
|
|
5429
5439
|
chats: a[e]
|
|
5430
5440
|
}));
|
|
5431
5441
|
}
|
|
5432
|
-
var
|
|
5433
|
-
let t =
|
|
5434
|
-
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(
|
|
5442
|
+
var mi = ({ showLabel: e = !1 }) => {
|
|
5443
|
+
let t = si();
|
|
5444
|
+
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(Dr, { children: [/* @__PURE__ */ G(Or, {
|
|
5435
5445
|
className: e ? "inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs text-muted-foreground bg-secondary hover:bg-secondary/80 hover:text-foreground transition-colors duration-150" : "p-2 text-muted-foreground rounded-2xl bg-background/60 backdrop-blur-md hover:bg-secondary/80 transition duration-200 hover:text-foreground border border-border/30",
|
|
5436
5446
|
children: [/* @__PURE__ */ W(ue, { size: e ? 14 : 18 }), e && /* @__PURE__ */ W("span", { children: "History" })]
|
|
5437
|
-
}), /* @__PURE__ */ G(
|
|
5447
|
+
}), /* @__PURE__ */ G(jr, {
|
|
5438
5448
|
className: "max-w-[420px] p-3",
|
|
5439
5449
|
children: [
|
|
5440
|
-
/* @__PURE__ */ W(
|
|
5450
|
+
/* @__PURE__ */ W(Mr, {
|
|
5441
5451
|
className: "sr-only",
|
|
5442
5452
|
children: "Chat History"
|
|
5443
5453
|
}),
|
|
5444
|
-
/* @__PURE__ */ W(
|
|
5454
|
+
/* @__PURE__ */ W(ci, {
|
|
5445
5455
|
incognito: t.incognito,
|
|
5446
5456
|
onToggleIncognito: t.toggleIncognito,
|
|
5447
5457
|
showClearAll: t.chats.length > 0 && !t.loading,
|
|
@@ -5479,15 +5489,15 @@ var pi = ({ showLabel: e = !1 }) => {
|
|
|
5479
5489
|
})
|
|
5480
5490
|
}) : /* @__PURE__ */ W("div", {
|
|
5481
5491
|
className: "space-y-1 max-h-[500px] overflow-y-auto",
|
|
5482
|
-
children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ W(
|
|
5492
|
+
children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ W(li, {
|
|
5483
5493
|
chat: e,
|
|
5484
5494
|
isPinned: t.pinnedIds.includes(e.id),
|
|
5485
5495
|
onTogglePin: t.togglePin,
|
|
5486
5496
|
onDelete: t.handleDeleteClick
|
|
5487
|
-
}, e.id)) :
|
|
5497
|
+
}, e.id)) : pi(t.displayChats).map(({ label: e, chats: n }) => /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ G("div", {
|
|
5488
5498
|
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-muted-foreground/70 uppercase tracking-wider",
|
|
5489
|
-
children: [
|
|
5490
|
-
}), n.map((e) => /* @__PURE__ */ W(
|
|
5499
|
+
children: [fi[e], e]
|
|
5500
|
+
}), n.map((e) => /* @__PURE__ */ W(li, {
|
|
5491
5501
|
chat: e,
|
|
5492
5502
|
isPinned: t.pinnedIds.includes(e.id),
|
|
5493
5503
|
onTogglePin: t.togglePin,
|
|
@@ -5503,7 +5513,7 @@ var pi = ({ showLabel: e = !1 }) => {
|
|
|
5503
5513
|
})
|
|
5504
5514
|
})
|
|
5505
5515
|
]
|
|
5506
|
-
})] }), /* @__PURE__ */ W(
|
|
5516
|
+
})] }), /* @__PURE__ */ W(di, {
|
|
5507
5517
|
deleteDialogOpen: t.deleteDialogOpen,
|
|
5508
5518
|
setDeleteDialogOpen: t.setDeleteDialogOpen,
|
|
5509
5519
|
chatToDelete: t.chatToDelete,
|
|
@@ -5518,11 +5528,11 @@ var pi = ({ showLabel: e = !1 }) => {
|
|
|
5518
5528
|
};
|
|
5519
5529
|
//#endregion
|
|
5520
5530
|
//#region src/components/ChatConversation/RecentHistoryChips.tsx
|
|
5521
|
-
function
|
|
5522
|
-
let { chats: e, loading: t } =
|
|
5531
|
+
function hi() {
|
|
5532
|
+
let { chats: e, loading: t } = si(), n = [...e].sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime()).slice(0, 3);
|
|
5523
5533
|
return t ? null : /* @__PURE__ */ G("div", {
|
|
5524
5534
|
className: "flex flex-row items-center justify-center gap-2 flex-wrap",
|
|
5525
|
-
children: [/* @__PURE__ */ W(
|
|
5535
|
+
children: [/* @__PURE__ */ W(mi, { showLabel: !0 }), n.map((e) => /* @__PURE__ */ W(bt, {
|
|
5526
5536
|
href: `/c/${e.id}`,
|
|
5527
5537
|
className: "px-3 py-1 rounded-full text-xs text-muted-foreground bg-secondary hover:bg-secondary/80 hover:text-foreground transition-colors duration-150 truncate max-w-[160px]",
|
|
5528
5538
|
title: e.title,
|
|
@@ -5532,7 +5542,7 @@ function mi() {
|
|
|
5532
5542
|
}
|
|
5533
5543
|
//#endregion
|
|
5534
5544
|
//#region src/components/Footer.tsx
|
|
5535
|
-
function
|
|
5545
|
+
function gi({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackgroundColor: n = "bg-black/40" }) {
|
|
5536
5546
|
let [r, i] = p(!1), a = f(null);
|
|
5537
5547
|
u(() => {
|
|
5538
5548
|
if (!r) return;
|
|
@@ -5589,19 +5599,19 @@ function hi({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackground
|
|
|
5589
5599
|
}
|
|
5590
5600
|
//#endregion
|
|
5591
5601
|
//#region src/components/ChatConversation/background-art.ts
|
|
5592
|
-
function
|
|
5602
|
+
function _i() {
|
|
5593
5603
|
let e = /* @__PURE__ */ "hyZbH3n.mp4,iOeZcCk.mp4,dUZlxYE.mp4,GpWeP6E.gif,LuKUsLE.png,w7X11Dd.png,MHmVtCr.png,HmnUAee.png,vKP22VU.png,l1lsV39.png,Ku8F2qc.png,KUEXtwm.png,vvKFPmY.png,5p8eaEf.png,VAKuJcG.png,sTMPtQW.png,m0gHbZZ.png,cKu7dWQ.png,ogfefYD.png,ey5vAae.png,twuLrvk.png,ELILiYt.png,9el5qpP.png,Up6xTkk.png,W1XKBo0.png,1Y6xvW0.png,JXOytMz.png,DNiI6pp.png,XDv5s6p.jpeg,eRwiRJ9.jpeg,DRAfJoc.jpeg,ASVRQ1G.jpeg,35svwUT.jpeg,81xLiVI.jpeg,6kod2Em.jpeg,eU0C8zt.jpeg,Bv0PBY8.jpeg,DQNbjIZ.jpeg,2uACPqZ.jpeg,XEKltMF.jpeg,WHgLfBm.jpeg,QFYM0Fw.jpeg,K12HCao.jpeg,oN8rtsE.jpeg,9fGnrns.jpeg,2ONJJeW.jpeg,DO23Va7.jpeg,QaKeoXk.jpeg,QU5oCBR.jpeg,MhlYZmh.jpeg,ylL1ToB.jpeg,AWWsCv8.jpeg,Tk9Tzzj.jpeg".split(",");
|
|
5594
5604
|
return "https://i.imgur.com/" + e[Math.floor(Math.random() * e.length)];
|
|
5595
5605
|
}
|
|
5596
5606
|
//#endregion
|
|
5597
5607
|
//#region src/components/ChatConversation/ChatHomepage.tsx
|
|
5598
|
-
function
|
|
5599
|
-
let { sendMessage: e } =
|
|
5608
|
+
function vi() {
|
|
5609
|
+
let { sendMessage: e } = yn(), [n, r] = p(null), [i, a] = p(null), [o, s] = p(!1), [c, l] = p({ os: "" });
|
|
5600
5610
|
u(() => {
|
|
5601
5611
|
if (localStorage.getItem("showBackgroundArt") === "false") return;
|
|
5602
|
-
r(
|
|
5612
|
+
r(_i());
|
|
5603
5613
|
let e = setInterval(() => {
|
|
5604
|
-
let e =
|
|
5614
|
+
let e = _i();
|
|
5605
5615
|
a(e), s(!0), setTimeout(() => {
|
|
5606
5616
|
r(e), s(!1), a(null);
|
|
5607
5617
|
}, 1e3);
|
|
@@ -5633,7 +5643,7 @@ function _i() {
|
|
|
5633
5643
|
children: [
|
|
5634
5644
|
n && f(n, o ? "opacity-0" : "opacity-30"),
|
|
5635
5645
|
i && f(i, o ? "opacity-30" : "opacity-0"),
|
|
5636
|
-
/* @__PURE__ */ W(
|
|
5646
|
+
/* @__PURE__ */ W(ri, {})
|
|
5637
5647
|
]
|
|
5638
5648
|
}),
|
|
5639
5649
|
/* @__PURE__ */ W("div", {
|
|
@@ -5671,18 +5681,18 @@ function _i() {
|
|
|
5671
5681
|
}),
|
|
5672
5682
|
/* @__PURE__ */ G("div", {
|
|
5673
5683
|
className: "w-full max-w-2xl mt-8 space-y-2",
|
|
5674
|
-
children: [/* @__PURE__ */ W(
|
|
5684
|
+
children: [/* @__PURE__ */ W(hi, {}), /* @__PURE__ */ W(Er, {})]
|
|
5675
5685
|
})
|
|
5676
5686
|
]
|
|
5677
5687
|
})
|
|
5678
5688
|
}),
|
|
5679
|
-
/* @__PURE__ */ W(
|
|
5689
|
+
/* @__PURE__ */ W(gi, { listFooterLinks: t.footerLinks })
|
|
5680
5690
|
]
|
|
5681
5691
|
});
|
|
5682
5692
|
}
|
|
5683
5693
|
//#endregion
|
|
5684
5694
|
//#region src/ui/Loader.tsx
|
|
5685
|
-
var
|
|
5695
|
+
var yi = () => /* @__PURE__ */ G("svg", {
|
|
5686
5696
|
"aria-hidden": "true",
|
|
5687
5697
|
className: "w-8 h-8 text-border fill-secondary animate-spin",
|
|
5688
5698
|
viewBox: "0 0 100 101",
|
|
@@ -5698,7 +5708,7 @@ var vi = () => /* @__PURE__ */ G("svg", {
|
|
|
5698
5708
|
});
|
|
5699
5709
|
//#endregion
|
|
5700
5710
|
//#region src/components/ConfigError.tsx
|
|
5701
|
-
function
|
|
5711
|
+
function bi() {
|
|
5702
5712
|
return /* @__PURE__ */ W("div", {
|
|
5703
5713
|
className: "flex min-h-screen flex-col items-center justify-center p-8",
|
|
5704
5714
|
children: /* @__PURE__ */ G("div", {
|
|
@@ -5816,8 +5826,8 @@ function yi() {
|
|
|
5816
5826
|
}
|
|
5817
5827
|
//#endregion
|
|
5818
5828
|
//#region src/components/ChatConversation/ChatWindow.tsx
|
|
5819
|
-
var
|
|
5820
|
-
let e = h(), { hasError: t, isReady: n, notFound: r, messages: i } =
|
|
5829
|
+
var xi = () => {
|
|
5830
|
+
let e = h(), { hasError: t, isReady: n, notFound: r, messages: i } = yn(), { isAuthenticated: a } = Sn();
|
|
5821
5831
|
return u(() => {
|
|
5822
5832
|
n && r && !a && e.replace("/");
|
|
5823
5833
|
}, [
|
|
@@ -5825,9 +5835,9 @@ var bi = () => {
|
|
|
5825
5835
|
r,
|
|
5826
5836
|
a,
|
|
5827
5837
|
e
|
|
5828
|
-
]), t ? /* @__PURE__ */ W(
|
|
5838
|
+
]), t ? /* @__PURE__ */ W(bi, {}) : n && r && !a ? /* @__PURE__ */ W("div", {
|
|
5829
5839
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
5830
|
-
children: /* @__PURE__ */ W(
|
|
5840
|
+
children: /* @__PURE__ */ W(yi, {})
|
|
5831
5841
|
}) : n ? r ? /* @__PURE__ */ G("div", {
|
|
5832
5842
|
className: "flex min-h-screen flex-col items-center justify-center gap-3 px-4 text-center",
|
|
5833
5843
|
children: [/* @__PURE__ */ W("p", {
|
|
@@ -5839,14 +5849,14 @@ var bi = () => {
|
|
|
5839
5849
|
className: "rounded-md border border-black/15 px-3 py-1.5 text-sm hover:bg-black/5 dark:border-white/20 dark:hover:bg-white/10",
|
|
5840
5850
|
children: "Go Home"
|
|
5841
5851
|
})]
|
|
5842
|
-
}) : /* @__PURE__ */ W("div", { children: i.length > 0 ? /* @__PURE__ */ W(U, { children: /* @__PURE__ */ W(
|
|
5852
|
+
}) : /* @__PURE__ */ W("div", { children: i.length > 0 ? /* @__PURE__ */ W(U, { children: /* @__PURE__ */ W(ni, {}) }) : /* @__PURE__ */ W(vi, {}) }) : /* @__PURE__ */ W("div", {
|
|
5843
5853
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
5844
|
-
children: /* @__PURE__ */ W(
|
|
5854
|
+
children: /* @__PURE__ */ W(yi, {})
|
|
5845
5855
|
});
|
|
5846
5856
|
};
|
|
5847
5857
|
//#endregion
|
|
5848
5858
|
//#region src/hooks/voice/useKokoroTTS.ts
|
|
5849
|
-
function
|
|
5859
|
+
function Si(e, t) {
|
|
5850
5860
|
let [n, r] = p("idle"), [i, a] = p(!1), [o, s] = p([]), [l, d] = p("af_heart"), [m, h] = p(null), g = f(null), _ = f(null);
|
|
5851
5861
|
u(() => {
|
|
5852
5862
|
t?.autoPreload && !i && y();
|
|
@@ -5915,7 +5925,7 @@ function xi(e, t) {
|
|
|
5915
5925
|
}
|
|
5916
5926
|
//#endregion
|
|
5917
5927
|
//#region src/components/VoiceSettings/KokoroVoiceSelector.tsx
|
|
5918
|
-
var
|
|
5928
|
+
var Ci = {
|
|
5919
5929
|
af_heart: "American Female - Heart",
|
|
5920
5930
|
af_bella: "American Female - Bella",
|
|
5921
5931
|
af_nicole: "American Female - Nicole",
|
|
@@ -5927,8 +5937,8 @@ var Si = {
|
|
|
5927
5937
|
bm_george: "British Male - George",
|
|
5928
5938
|
bm_thomas: "British Male - Thomas"
|
|
5929
5939
|
};
|
|
5930
|
-
function
|
|
5931
|
-
let { status: t, modelReady: n, voices: r, selectedVoice: i, error: a, warmupModel: o, changeVoice: s, backend: c } =
|
|
5940
|
+
function wi({ preloadOnMount: e = !1 }) {
|
|
5941
|
+
let { status: t, modelReady: n, voices: r, selectedVoice: i, error: a, warmupModel: o, changeVoice: s, backend: c } = Si("", { autoPreload: e }), [l, u] = p(!1), d = t === "loading", f = t === "error";
|
|
5932
5942
|
return /* @__PURE__ */ G("div", {
|
|
5933
5943
|
className: "flex flex-col gap-3",
|
|
5934
5944
|
children: [/* @__PURE__ */ G("div", {
|
|
@@ -5943,7 +5953,7 @@ function Ci({ preloadOnMount: e = !1 }) {
|
|
|
5943
5953
|
children: d ? /* @__PURE__ */ W(H, {
|
|
5944
5954
|
size: 18,
|
|
5945
5955
|
className: "animate-spin"
|
|
5946
|
-
}) : /* @__PURE__ */ W(
|
|
5956
|
+
}) : /* @__PURE__ */ W(B, { size: 18 })
|
|
5947
5957
|
})
|
|
5948
5958
|
}), /* @__PURE__ */ W(Z, {
|
|
5949
5959
|
side: "bottom",
|
|
@@ -5977,7 +5987,7 @@ function Ci({ preloadOnMount: e = !1 }) {
|
|
|
5977
5987
|
className: "w-full text-left px-3 py-2 rounded-md bg-white/5 dark:bg-black/5 hover:bg-white/10 dark:hover:bg-black/10 transition text-sm font-medium",
|
|
5978
5988
|
children: /* @__PURE__ */ G("div", {
|
|
5979
5989
|
className: "flex items-center gap-2",
|
|
5980
|
-
children: [/* @__PURE__ */ W(Ne, { size: 16 }),
|
|
5990
|
+
children: [/* @__PURE__ */ W(Ne, { size: 16 }), Ci[i] || i]
|
|
5981
5991
|
})
|
|
5982
5992
|
}), l && /* @__PURE__ */ W("div", {
|
|
5983
5993
|
className: "grid grid-cols-2 gap-2 p-2 bg-white/5 dark:bg-black/5 rounded-md max-h-64 overflow-y-auto",
|
|
@@ -5986,7 +5996,7 @@ function Ci({ preloadOnMount: e = !1 }) {
|
|
|
5986
5996
|
s(e), u(!1);
|
|
5987
5997
|
},
|
|
5988
5998
|
className: J("p-2 text-left text-sm rounded transition duration-200", i === e ? "bg-blue-500/20 text-blue-600 dark:text-blue-400 font-medium" : "bg-white/5 dark:bg-black/5 text-foreground hover:bg-white/10 dark:hover:bg-black/10"),
|
|
5989
|
-
children:
|
|
5999
|
+
children: Ci[e] || e
|
|
5990
6000
|
}, e))
|
|
5991
6001
|
})]
|
|
5992
6002
|
})]
|
|
@@ -5994,7 +6004,7 @@ function Ci({ preloadOnMount: e = !1 }) {
|
|
|
5994
6004
|
}
|
|
5995
6005
|
//#endregion
|
|
5996
6006
|
//#region src/components/VoiceSettings/VoiceSettingsPanel.tsx
|
|
5997
|
-
function
|
|
6007
|
+
function Ti() {
|
|
5998
6008
|
let [e, t] = p(!1), [n, r] = p(() => localStorage.getItem("useTTSKokoro") !== "false"), [i, a] = p(() => localStorage.getItem("ttsSpeaker") || "angus"), { start: o, speechStatus: s } = Qt("This is a preview of the selected voice.", { enableInterrupt: !1 }), c = (e) => {
|
|
5999
6009
|
r(e), localStorage.setItem("useTTSKokoro", String(e));
|
|
6000
6010
|
}, l = (e) => {
|
|
@@ -6045,7 +6055,7 @@ function wi() {
|
|
|
6045
6055
|
children: "Runs locally in your browser. No server requests, lower latency, and multiple voice options."
|
|
6046
6056
|
})] })
|
|
6047
6057
|
]
|
|
6048
|
-
}), n && /* @__PURE__ */ W(
|
|
6058
|
+
}), n && /* @__PURE__ */ W(wi, { preloadOnMount: !1 })]
|
|
6049
6059
|
}),
|
|
6050
6060
|
/* @__PURE__ */ G("div", {
|
|
6051
6061
|
className: "space-y-2",
|
|
@@ -6115,4 +6125,4 @@ function wi() {
|
|
|
6115
6125
|
});
|
|
6116
6126
|
}
|
|
6117
6127
|
//#endregion
|
|
6118
|
-
export {
|
|
6128
|
+
export { Hr as ArticleAIResponse, zr as ArticleActionButtons, Wr as ArticleContent, Vr as ArticleFollowupQuestions, Fr as ArticlePanelHeader, Br as ArticlePromptInput, Cn as ChatProvider, xi as ChatWindow, Et as ExtractPanelProvider, di as HistoryDialogs, mi as HistoryDropdown, wi as KokoroVoiceSelector, Ur as LexicalArticleViewer, xn as SessionProvider, ei as UnifiedMarkdown, Ti as VoiceSettingsPanel, J as cn, e as configureResearchAgentUI, St as formatTimeDifference, t as researchAgentUIConfig, yn as useChat, _n as useChatState, Tt as useExtractPanel, si as useHistoryState, Si as useKokoroTTS, Sn as useSession, Qt as useTextToSpeech };
|