research-agent-ui 0.1.63 → 0.1.65
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/hooks/useSession.d.ts +8 -1
- package/dist/index.cjs +11 -11
- package/dist/index.mjs +459 -445
- 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,41 +1735,45 @@ 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
|
|
1749
|
-
let [
|
|
1750
|
+
function xn({ children: e, authClient: t, enableGoogleOneTap: n = !0 }) {
|
|
1751
|
+
let [r, i] = p(null), [a, o] = p(!0);
|
|
1750
1752
|
return u(() => {
|
|
1751
1753
|
(async () => {
|
|
1752
1754
|
try {
|
|
1753
1755
|
let { data: e } = await t.getSession();
|
|
1754
|
-
|
|
1756
|
+
i(e?.user ?? null);
|
|
1755
1757
|
} catch (e) {
|
|
1756
|
-
console.error("Failed to fetch session:", e),
|
|
1758
|
+
console.error("Failed to fetch session:", e), i(null);
|
|
1757
1759
|
} finally {
|
|
1758
|
-
|
|
1760
|
+
o(!1);
|
|
1759
1761
|
}
|
|
1760
1762
|
})();
|
|
1761
1763
|
}, []), u(() => {
|
|
1762
|
-
|
|
1764
|
+
a || r || !n || t.oneTap({ fetchOptions: { onSuccess: async () => {
|
|
1763
1765
|
let { data: e } = await t.getSession();
|
|
1764
|
-
|
|
1766
|
+
i(e?.user ?? null);
|
|
1765
1767
|
} } });
|
|
1766
|
-
}, [
|
|
1768
|
+
}, [
|
|
1769
|
+
a,
|
|
1770
|
+
r,
|
|
1771
|
+
n
|
|
1772
|
+
]), /* @__PURE__ */ W(bn.Provider, {
|
|
1767
1773
|
value: {
|
|
1768
|
-
user:
|
|
1769
|
-
isLoading:
|
|
1770
|
-
isAuthenticated: !!
|
|
1774
|
+
user: r,
|
|
1775
|
+
isLoading: a,
|
|
1776
|
+
isAuthenticated: !!r,
|
|
1771
1777
|
signIn: () => {
|
|
1772
1778
|
t.signIn.social({
|
|
1773
1779
|
provider: "google",
|
|
@@ -1777,7 +1783,7 @@ function bn({ children: e, authClient: t }) {
|
|
|
1777
1783
|
signOut: async () => {
|
|
1778
1784
|
try {
|
|
1779
1785
|
await t.signOut({ fetchOptions: { onSuccess: () => {
|
|
1780
|
-
|
|
1786
|
+
i(null), window.location.href = "/";
|
|
1781
1787
|
} } });
|
|
1782
1788
|
} catch (e) {
|
|
1783
1789
|
console.error("Sign out failed:", e);
|
|
@@ -1787,15 +1793,15 @@ function bn({ children: e, authClient: t }) {
|
|
|
1787
1793
|
children: e
|
|
1788
1794
|
});
|
|
1789
1795
|
}
|
|
1790
|
-
function
|
|
1791
|
-
let e = l(
|
|
1796
|
+
function Sn() {
|
|
1797
|
+
let e = l(bn);
|
|
1792
1798
|
if (!e) throw Error("useSession must be used within SessionProvider");
|
|
1793
1799
|
return e;
|
|
1794
1800
|
}
|
|
1795
1801
|
//#endregion
|
|
1796
1802
|
//#region src/hooks/useChat/ChatProvider.tsx
|
|
1797
|
-
function
|
|
1798
|
-
let t = m(), n = g(), r = h(), i = n.get("q"), { isAuthenticated: a, isLoading: o } =
|
|
1803
|
+
function Cn({ children: e }) {
|
|
1804
|
+
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
1805
|
u(() => {
|
|
1800
1806
|
$t(l.setChatModelProvider, l.setIsConfigReady, l.setHasError);
|
|
1801
1807
|
}, []), u(() => {
|
|
@@ -1845,7 +1851,7 @@ function Sn({ children: e }) {
|
|
|
1845
1851
|
i
|
|
1846
1852
|
]);
|
|
1847
1853
|
let S = c(async (e, t, n = !1) => {
|
|
1848
|
-
s.chatId && await
|
|
1854
|
+
s.chatId && await gn({
|
|
1849
1855
|
message: e,
|
|
1850
1856
|
messageId: t,
|
|
1851
1857
|
rewrite: n
|
|
@@ -1924,14 +1930,14 @@ function Sn({ children: e }) {
|
|
|
1924
1930
|
newChat: T,
|
|
1925
1931
|
setIncognito: x
|
|
1926
1932
|
};
|
|
1927
|
-
return /* @__PURE__ */ W(
|
|
1933
|
+
return /* @__PURE__ */ W(vn.Provider, {
|
|
1928
1934
|
value: E,
|
|
1929
1935
|
children: e
|
|
1930
1936
|
});
|
|
1931
1937
|
}
|
|
1932
1938
|
//#endregion
|
|
1933
1939
|
//#region src/ui/tooltip.tsx
|
|
1934
|
-
function
|
|
1940
|
+
function wn({ delayDuration: e = 0, ...t }) {
|
|
1935
1941
|
return /* @__PURE__ */ W(dt.Provider, {
|
|
1936
1942
|
"data-slot": "tooltip-provider",
|
|
1937
1943
|
delayDuration: e,
|
|
@@ -1939,7 +1945,7 @@ function Cn({ delayDuration: e = 0, ...t }) {
|
|
|
1939
1945
|
});
|
|
1940
1946
|
}
|
|
1941
1947
|
function Y({ ...e }) {
|
|
1942
|
-
return /* @__PURE__ */ W(
|
|
1948
|
+
return /* @__PURE__ */ W(wn, { children: /* @__PURE__ */ W(dt.Root, {
|
|
1943
1949
|
"data-slot": "tooltip",
|
|
1944
1950
|
...e
|
|
1945
1951
|
}) });
|
|
@@ -1961,7 +1967,7 @@ function Z({ className: e, sideOffset: t = 0, children: n, ...r }) {
|
|
|
1961
1967
|
}
|
|
1962
1968
|
//#endregion
|
|
1963
1969
|
//#region src/components/SearchResults/WebCitationBadge.tsx
|
|
1964
|
-
var
|
|
1970
|
+
var Tn = ({ href: e, children: t, sources: n }) => {
|
|
1965
1971
|
let { openPanel: r } = Tt(), i = d(() => !n || !e ? null : n.find((t) => t.metadata?.url === e) ?? null, [n, e]), a = d(() => {
|
|
1966
1972
|
try {
|
|
1967
1973
|
return new URL(e).hostname.replace("www.", "");
|
|
@@ -2002,7 +2008,7 @@ var wn = ({ href: e, children: t, sources: n }) => {
|
|
|
2002
2008
|
})]
|
|
2003
2009
|
})
|
|
2004
2010
|
})] });
|
|
2005
|
-
},
|
|
2011
|
+
}, En = ({ content: e, thinkingEnded: t }) => {
|
|
2006
2012
|
let [n, r] = p(!0);
|
|
2007
2013
|
return u(() => {
|
|
2008
2014
|
r(!t);
|
|
@@ -2029,10 +2035,10 @@ var wn = ({ href: e, children: t, sources: n }) => {
|
|
|
2029
2035
|
children: e
|
|
2030
2036
|
})]
|
|
2031
2037
|
});
|
|
2032
|
-
},
|
|
2038
|
+
}, Dn = ({ children: e, thinkingEnded: t }) => /* @__PURE__ */ W(En, {
|
|
2033
2039
|
content: e,
|
|
2034
2040
|
thinkingEnded: t
|
|
2035
|
-
}),
|
|
2041
|
+
}), On = ({ section: e, isExpanded: t, setIsExpanded: n, isEditing: r, setIsEditing: i, editText: a, setEditText: o, handleEditSubmit: s, copiedUserMsg: c, handleCopyUserMsg: l }) => {
|
|
2036
2042
|
let u = f(null);
|
|
2037
2043
|
return /* @__PURE__ */ G("div", {
|
|
2038
2044
|
className: "w-full pt-8 break-words",
|
|
@@ -2113,19 +2119,19 @@ var wn = ({ href: e, children: t, sources: n }) => {
|
|
|
2113
2119
|
};
|
|
2114
2120
|
//#endregion
|
|
2115
2121
|
//#region src/ui/dropdown-menu.tsx
|
|
2116
|
-
function
|
|
2122
|
+
function kn({ ...e }) {
|
|
2117
2123
|
return /* @__PURE__ */ W(q.Root, {
|
|
2118
2124
|
"data-slot": "dropdown-menu",
|
|
2119
2125
|
...e
|
|
2120
2126
|
});
|
|
2121
2127
|
}
|
|
2122
|
-
function
|
|
2128
|
+
function An({ ...e }) {
|
|
2123
2129
|
return /* @__PURE__ */ W(q.Trigger, {
|
|
2124
2130
|
"data-slot": "dropdown-menu-trigger",
|
|
2125
2131
|
...e
|
|
2126
2132
|
});
|
|
2127
2133
|
}
|
|
2128
|
-
function
|
|
2134
|
+
function jn({ className: e, sideOffset: t = 4, ...n }) {
|
|
2129
2135
|
return /* @__PURE__ */ W(q.Portal, { children: /* @__PURE__ */ W(q.Content, {
|
|
2130
2136
|
"data-slot": "dropdown-menu-content",
|
|
2131
2137
|
sideOffset: t,
|
|
@@ -2142,7 +2148,7 @@ function Q({ className: e, inset: t, variant: n = "default", ...r }) {
|
|
|
2142
2148
|
...r
|
|
2143
2149
|
});
|
|
2144
2150
|
}
|
|
2145
|
-
function
|
|
2151
|
+
function Mn({ className: e, children: t, checked: n, ...r }) {
|
|
2146
2152
|
return /* @__PURE__ */ G(q.CheckboxItem, {
|
|
2147
2153
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
2148
2154
|
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 +2160,7 @@ function jn({ className: e, children: t, checked: n, ...r }) {
|
|
|
2154
2160
|
}), t]
|
|
2155
2161
|
});
|
|
2156
2162
|
}
|
|
2157
|
-
function
|
|
2163
|
+
function Nn({ className: e, inset: t, ...n }) {
|
|
2158
2164
|
return /* @__PURE__ */ W(q.Label, {
|
|
2159
2165
|
"data-slot": "dropdown-menu-label",
|
|
2160
2166
|
"data-inset": t,
|
|
@@ -2162,20 +2168,20 @@ function Mn({ className: e, inset: t, ...n }) {
|
|
|
2162
2168
|
...n
|
|
2163
2169
|
});
|
|
2164
2170
|
}
|
|
2165
|
-
function
|
|
2171
|
+
function Pn({ className: e, ...t }) {
|
|
2166
2172
|
return /* @__PURE__ */ W(q.Separator, {
|
|
2167
2173
|
"data-slot": "dropdown-menu-separator",
|
|
2168
2174
|
className: J("bg-border -mx-1 my-1 h-px", e),
|
|
2169
2175
|
...t
|
|
2170
2176
|
});
|
|
2171
2177
|
}
|
|
2172
|
-
function
|
|
2178
|
+
function Fn({ ...e }) {
|
|
2173
2179
|
return /* @__PURE__ */ W(q.Sub, {
|
|
2174
2180
|
"data-slot": "dropdown-menu-sub",
|
|
2175
2181
|
...e
|
|
2176
2182
|
});
|
|
2177
2183
|
}
|
|
2178
|
-
function
|
|
2184
|
+
function In({ className: e, inset: t, children: n, ...r }) {
|
|
2179
2185
|
return /* @__PURE__ */ G(q.SubTrigger, {
|
|
2180
2186
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
2181
2187
|
"data-inset": t,
|
|
@@ -2184,7 +2190,7 @@ function Fn({ className: e, inset: t, children: n, ...r }) {
|
|
|
2184
2190
|
children: [n, /* @__PURE__ */ W(N, { className: "ml-auto size-4" })]
|
|
2185
2191
|
});
|
|
2186
2192
|
}
|
|
2187
|
-
function
|
|
2193
|
+
function Ln({ className: e, ...t }) {
|
|
2188
2194
|
return /* @__PURE__ */ W(q.SubContent, {
|
|
2189
2195
|
"data-slot": "dropdown-menu-sub-content",
|
|
2190
2196
|
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 +2199,7 @@ function In({ className: e, ...t }) {
|
|
|
2193
2199
|
}
|
|
2194
2200
|
//#endregion
|
|
2195
2201
|
//#region src/components/MessageActions/CopyMessageButton.tsx
|
|
2196
|
-
var
|
|
2202
|
+
var Rn = ({ section: e, initialMessage: t }) => {
|
|
2197
2203
|
let [n, r] = p(!1);
|
|
2198
2204
|
return /* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2199
2205
|
asChild: !0,
|
|
@@ -2212,19 +2218,19 @@ var Ln = ({ section: e, initialMessage: t }) => {
|
|
|
2212
2218
|
};
|
|
2213
2219
|
//#endregion
|
|
2214
2220
|
//#region src/ui/popover.tsx
|
|
2215
|
-
function
|
|
2221
|
+
function zn({ ...e }) {
|
|
2216
2222
|
return /* @__PURE__ */ W(ft.Root, {
|
|
2217
2223
|
"data-slot": "popover",
|
|
2218
2224
|
...e
|
|
2219
2225
|
});
|
|
2220
2226
|
}
|
|
2221
|
-
function
|
|
2227
|
+
function Bn({ ...e }) {
|
|
2222
2228
|
return /* @__PURE__ */ W(ft.Trigger, {
|
|
2223
2229
|
"data-slot": "popover-trigger",
|
|
2224
2230
|
...e
|
|
2225
2231
|
});
|
|
2226
2232
|
}
|
|
2227
|
-
function
|
|
2233
|
+
function Vn({ className: e, align: t = "center", sideOffset: n = 4, container: r, ...i }) {
|
|
2228
2234
|
return /* @__PURE__ */ W(ft.Portal, {
|
|
2229
2235
|
container: r,
|
|
2230
2236
|
children: /* @__PURE__ */ W(ft.Content, {
|
|
@@ -2241,9 +2247,9 @@ function Bn({ className: e, align: t = "center", sideOffset: n = 4, container: r
|
|
|
2241
2247
|
var $ = {
|
|
2242
2248
|
Plus: ve,
|
|
2243
2249
|
Paperclip: he,
|
|
2244
|
-
Cloud:
|
|
2250
|
+
Cloud: R,
|
|
2245
2251
|
Upload: je,
|
|
2246
|
-
File:
|
|
2252
|
+
File: re,
|
|
2247
2253
|
SquarePen: Te,
|
|
2248
2254
|
Thinking: (e) => /* @__PURE__ */ W("svg", {
|
|
2249
2255
|
width: "20",
|
|
@@ -2257,7 +2263,7 @@ var $ = {
|
|
|
2257
2263
|
SelectArrow: j,
|
|
2258
2264
|
ArrowUp: w,
|
|
2259
2265
|
X: Pe,
|
|
2260
|
-
FileText:
|
|
2266
|
+
FileText: oe,
|
|
2261
2267
|
Loader2: H,
|
|
2262
2268
|
Check: k,
|
|
2263
2269
|
Archive: S,
|
|
@@ -2272,8 +2278,8 @@ var $ = {
|
|
|
2272
2278
|
...e,
|
|
2273
2279
|
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
2280
|
})
|
|
2275
|
-
},
|
|
2276
|
-
let { rewrite: t, chatModelProvider: n, setChatModelProvider: r } =
|
|
2281
|
+
}, Hn = ({ messageId: e }) => {
|
|
2282
|
+
let { rewrite: t, chatModelProvider: n, setChatModelProvider: r } = yn(), [i, a] = p([]), [o, s] = p(!0), [c, l] = p(""), [f, m] = p(!1);
|
|
2277
2283
|
u(() => {
|
|
2278
2284
|
f && (async () => {
|
|
2279
2285
|
try {
|
|
@@ -2307,12 +2313,12 @@ var $ = {
|
|
|
2307
2313
|
key: i
|
|
2308
2314
|
}), localStorage.setItem("chatModelProviderId", n), localStorage.setItem("chatModelKey", i), m(!1), t(e);
|
|
2309
2315
|
};
|
|
2310
|
-
return /* @__PURE__ */ G(
|
|
2316
|
+
return /* @__PURE__ */ G(zn, {
|
|
2311
2317
|
open: f,
|
|
2312
2318
|
onOpenChange: m,
|
|
2313
2319
|
children: [/* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2314
2320
|
asChild: !0,
|
|
2315
|
-
children: /* @__PURE__ */ W(
|
|
2321
|
+
children: /* @__PURE__ */ W(Bn, {
|
|
2316
2322
|
asChild: !0,
|
|
2317
2323
|
children: /* @__PURE__ */ W("button", {
|
|
2318
2324
|
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 +2328,7 @@ var $ = {
|
|
|
2322
2328
|
}), /* @__PURE__ */ G(Z, {
|
|
2323
2329
|
side: "bottom",
|
|
2324
2330
|
children: ["Rewrite with ", g]
|
|
2325
|
-
})] }), /* @__PURE__ */ W(
|
|
2331
|
+
})] }), /* @__PURE__ */ W(Vn, {
|
|
2326
2332
|
className: "w-[280px] p-0",
|
|
2327
2333
|
align: "start",
|
|
2328
2334
|
side: "top",
|
|
@@ -2373,7 +2379,7 @@ var $ = {
|
|
|
2373
2379
|
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
2380
|
children: [/* @__PURE__ */ G("div", {
|
|
2375
2381
|
className: "flex items-center space-x-2.5 min-w-0 flex-1",
|
|
2376
|
-
children: [/* @__PURE__ */ W(
|
|
2382
|
+
children: [/* @__PURE__ */ W(te, {
|
|
2377
2383
|
size: 14,
|
|
2378
2384
|
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
2385
|
}), /* @__PURE__ */ W("p", {
|
|
@@ -2390,10 +2396,10 @@ var $ = {
|
|
|
2390
2396
|
})
|
|
2391
2397
|
})]
|
|
2392
2398
|
});
|
|
2393
|
-
},
|
|
2394
|
-
function
|
|
2399
|
+
}, Un = /* @__PURE__ */ new Map();
|
|
2400
|
+
function Wn(e) {
|
|
2395
2401
|
if (typeof window > "u") return Promise.reject(/* @__PURE__ */ Error("CDN scripts require a browser environment"));
|
|
2396
|
-
let t =
|
|
2402
|
+
let t = Un.get(e);
|
|
2397
2403
|
if (t) return t;
|
|
2398
2404
|
let n = new Promise((t, n) => {
|
|
2399
2405
|
let r = document.querySelector(`script[data-cdn-loader="${e}"]`);
|
|
@@ -2405,34 +2411,34 @@ function Un(e) {
|
|
|
2405
2411
|
i.src = e, i.async = !0, i.dataset.cdnLoader = e, i.onload = () => {
|
|
2406
2412
|
i.dataset.loaded = "true", t();
|
|
2407
2413
|
}, i.onerror = () => {
|
|
2408
|
-
|
|
2414
|
+
Un.delete(e), n(/* @__PURE__ */ Error(`Failed to load ${e}`));
|
|
2409
2415
|
}, document.head.appendChild(i);
|
|
2410
2416
|
});
|
|
2411
|
-
return
|
|
2417
|
+
return Un.set(e, n), n;
|
|
2412
2418
|
}
|
|
2413
|
-
var
|
|
2414
|
-
async function
|
|
2415
|
-
await
|
|
2419
|
+
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";
|
|
2420
|
+
async function qn() {
|
|
2421
|
+
await Wn(Gn);
|
|
2416
2422
|
let e = window.jspdf?.jsPDF;
|
|
2417
2423
|
if (!e) throw Error("jsPDF global not found after CDN load");
|
|
2418
2424
|
return e;
|
|
2419
2425
|
}
|
|
2420
|
-
async function
|
|
2421
|
-
await
|
|
2426
|
+
async function Jn() {
|
|
2427
|
+
await Wn(Kn);
|
|
2422
2428
|
let e = window.docx;
|
|
2423
2429
|
if (!e) throw Error("docx global not found after CDN load");
|
|
2424
2430
|
return e;
|
|
2425
2431
|
}
|
|
2426
2432
|
//#endregion
|
|
2427
2433
|
//#region src/lib/export.ts
|
|
2428
|
-
async function
|
|
2429
|
-
|
|
2434
|
+
async function Yn(e, t) {
|
|
2435
|
+
$n(`# ${e}\n\n${new mt({
|
|
2430
2436
|
headingStyle: "atx",
|
|
2431
2437
|
codeBlockStyle: "fenced"
|
|
2432
2438
|
}).turndown(t)}`, `${e}.md`, "text/markdown");
|
|
2433
2439
|
}
|
|
2434
|
-
async function
|
|
2435
|
-
let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await
|
|
2440
|
+
async function Xn(e, t) {
|
|
2441
|
+
let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await Jn(), s = new DOMParser().parseFromString(t, "text/html"), c = [];
|
|
2436
2442
|
c.push(new r({
|
|
2437
2443
|
text: e,
|
|
2438
2444
|
heading: a.HEADING_1,
|
|
@@ -2506,14 +2512,14 @@ async function Yn(e, t) {
|
|
|
2506
2512
|
}] }), d = await o.toBlob(u), f = URL.createObjectURL(d), p = document.createElement("a");
|
|
2507
2513
|
p.href = f, p.download = `${e}.docx`, p.click(), URL.revokeObjectURL(f);
|
|
2508
2514
|
}
|
|
2509
|
-
async function
|
|
2515
|
+
async function Zn(e, t) {
|
|
2510
2516
|
let n = document.createElement("div");
|
|
2511
2517
|
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
2518
|
<h1 style="font-size: 24pt; margin-bottom: 20px;">${e}</h1>
|
|
2513
2519
|
${t}
|
|
2514
2520
|
`, document.body.appendChild(n);
|
|
2515
2521
|
try {
|
|
2516
|
-
let t = await
|
|
2522
|
+
let t = await qn(), r = await pt(n, {
|
|
2517
2523
|
scale: 2,
|
|
2518
2524
|
useCORS: !0,
|
|
2519
2525
|
logging: !1
|
|
@@ -2528,7 +2534,7 @@ async function Xn(e, t) {
|
|
|
2528
2534
|
document.body.removeChild(n);
|
|
2529
2535
|
}
|
|
2530
2536
|
}
|
|
2531
|
-
async function
|
|
2537
|
+
async function Qn(e, t) {
|
|
2532
2538
|
try {
|
|
2533
2539
|
let n = `${e}\n\n${new mt().turndown(t)}`;
|
|
2534
2540
|
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 +2542,19 @@ async function Zn(e, t) {
|
|
|
2536
2542
|
console.error("Failed to export to Google Docs:", e), alert("Failed to copy content to clipboard. Please try again.");
|
|
2537
2543
|
}
|
|
2538
2544
|
}
|
|
2539
|
-
function
|
|
2545
|
+
function $n(e, t, n) {
|
|
2540
2546
|
let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
2541
2547
|
a.href = i, a.download = t, a.click(), URL.revokeObjectURL(i);
|
|
2542
2548
|
}
|
|
2543
2549
|
//#endregion
|
|
2544
2550
|
//#region src/components/ChatConversation/MessageBubble/AssistantMessageActions.tsx
|
|
2545
|
-
var
|
|
2551
|
+
var er = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }) => e.assistantMessage ? /* @__PURE__ */ W("div", {
|
|
2546
2552
|
className: "flex flex-row items-center justify-end w-full text-foreground py-4 -mx-2",
|
|
2547
2553
|
children: /* @__PURE__ */ G("div", {
|
|
2548
2554
|
className: "flex flex-row items-center space-x-1",
|
|
2549
2555
|
children: [
|
|
2550
|
-
/* @__PURE__ */ W(
|
|
2551
|
-
/* @__PURE__ */ W(
|
|
2556
|
+
/* @__PURE__ */ W(Hn, { messageId: e.assistantMessage.messageId }),
|
|
2557
|
+
/* @__PURE__ */ W(Rn, {
|
|
2552
2558
|
initialMessage: e.assistantMessage.content,
|
|
2553
2559
|
section: e
|
|
2554
2560
|
}),
|
|
@@ -2565,53 +2571,53 @@ var $n = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
|
|
|
2565
2571
|
side: "bottom",
|
|
2566
2572
|
children: t === "started" ? "Stop" : "Read aloud"
|
|
2567
2573
|
})] }),
|
|
2568
|
-
/* @__PURE__ */ G(
|
|
2574
|
+
/* @__PURE__ */ G(kn, { children: [/* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2569
2575
|
asChild: !0,
|
|
2570
|
-
children: /* @__PURE__ */ W(
|
|
2576
|
+
children: /* @__PURE__ */ W(An, {
|
|
2571
2577
|
asChild: !0,
|
|
2572
2578
|
children: /* @__PURE__ */ W("button", {
|
|
2573
2579
|
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(
|
|
2580
|
+
children: /* @__PURE__ */ W(B, { size: 18 })
|
|
2575
2581
|
})
|
|
2576
2582
|
})
|
|
2577
2583
|
}), /* @__PURE__ */ W(Z, {
|
|
2578
2584
|
side: "bottom",
|
|
2579
2585
|
children: "Export"
|
|
2580
|
-
})] }), /* @__PURE__ */ G(
|
|
2586
|
+
})] }), /* @__PURE__ */ G(jn, {
|
|
2581
2587
|
align: "end",
|
|
2582
2588
|
side: "top",
|
|
2583
2589
|
children: [
|
|
2584
2590
|
/* @__PURE__ */ G(Q, {
|
|
2585
|
-
onClick: () =>
|
|
2586
|
-
children: [/* @__PURE__ */ W(
|
|
2591
|
+
onClick: () => Yn(e.userMessage.content, e.assistantMessage.content),
|
|
2592
|
+
children: [/* @__PURE__ */ W(oe, { size: 16 }), "Markdown"]
|
|
2587
2593
|
}),
|
|
2588
2594
|
/* @__PURE__ */ G(Q, {
|
|
2589
|
-
onClick: () =>
|
|
2595
|
+
onClick: () => Zn(e.userMessage.content, e.assistantMessage.content),
|
|
2590
2596
|
children: [/* @__PURE__ */ W(se, { size: 16 }), "PDF"]
|
|
2591
2597
|
}),
|
|
2592
2598
|
/* @__PURE__ */ G(Q, {
|
|
2593
|
-
onClick: () =>
|
|
2594
|
-
children: [/* @__PURE__ */ W(
|
|
2599
|
+
onClick: () => Xn(e.userMessage.content, e.assistantMessage.content),
|
|
2600
|
+
children: [/* @__PURE__ */ W(ie, { size: 16 }), "DOCX"]
|
|
2595
2601
|
}),
|
|
2596
2602
|
/* @__PURE__ */ G(Q, {
|
|
2597
|
-
onClick: () =>
|
|
2598
|
-
children: [/* @__PURE__ */ W(
|
|
2603
|
+
onClick: () => Qn(e.userMessage.content, e.assistantMessage.content),
|
|
2604
|
+
children: [/* @__PURE__ */ W(ae, { size: 16 }), "Google Docs"]
|
|
2599
2605
|
})
|
|
2600
2606
|
]
|
|
2601
2607
|
})] }),
|
|
2602
|
-
/* @__PURE__ */ G(
|
|
2608
|
+
/* @__PURE__ */ G(kn, { children: [/* @__PURE__ */ G(Y, { children: [/* @__PURE__ */ W(X, {
|
|
2603
2609
|
asChild: !0,
|
|
2604
|
-
children: /* @__PURE__ */ W(
|
|
2610
|
+
children: /* @__PURE__ */ W(An, {
|
|
2605
2611
|
asChild: !0,
|
|
2606
2612
|
children: /* @__PURE__ */ W("button", {
|
|
2607
2613
|
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(
|
|
2614
|
+
children: /* @__PURE__ */ W(V, { size: 18 })
|
|
2609
2615
|
})
|
|
2610
2616
|
})
|
|
2611
2617
|
}), /* @__PURE__ */ W(Z, {
|
|
2612
2618
|
side: "bottom",
|
|
2613
2619
|
children: "Open in LLM"
|
|
2614
|
-
})] }), /* @__PURE__ */ G(
|
|
2620
|
+
})] }), /* @__PURE__ */ G(jn, {
|
|
2615
2621
|
align: "end",
|
|
2616
2622
|
side: "top",
|
|
2617
2623
|
children: [
|
|
@@ -2639,7 +2645,7 @@ var $n = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
|
|
|
2639
2645
|
})] })
|
|
2640
2646
|
]
|
|
2641
2647
|
})
|
|
2642
|
-
}) : null,
|
|
2648
|
+
}) : 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
2649
|
variants: { variant: {
|
|
2644
2650
|
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
2645
2651
|
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 +2657,16 @@ var $n = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
|
|
|
2651
2657
|
} },
|
|
2652
2658
|
defaultVariants: { variant: "default" }
|
|
2653
2659
|
});
|
|
2654
|
-
function
|
|
2660
|
+
function nr({ className: e, variant: t, asChild: n = !1, ...r }) {
|
|
2655
2661
|
return /* @__PURE__ */ W(n ? ht : "span", {
|
|
2656
2662
|
"data-slot": "badge",
|
|
2657
|
-
className: J(
|
|
2663
|
+
className: J(tr({ variant: t }), e),
|
|
2658
2664
|
...r
|
|
2659
2665
|
});
|
|
2660
2666
|
}
|
|
2661
2667
|
//#endregion
|
|
2662
2668
|
//#region src/components/ChatConversation/MessageBubble/FollowUpSuggestions.tsx
|
|
2663
|
-
var
|
|
2669
|
+
var rr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
2664
2670
|
let i = f([]);
|
|
2665
2671
|
return u(() => {
|
|
2666
2672
|
e.suggestions && e.suggestions.length > 0 && (i.current = e.suggestions.slice(0, 5));
|
|
@@ -2682,7 +2688,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2682
2688
|
children: /* @__PURE__ */ G("div", {
|
|
2683
2689
|
className: "flex items-center gap-3",
|
|
2684
2690
|
children: [
|
|
2685
|
-
/* @__PURE__ */ W(
|
|
2691
|
+
/* @__PURE__ */ W(nr, {
|
|
2686
2692
|
variant: "secondary",
|
|
2687
2693
|
className: "flex-shrink-0 h-6 w-6 p-0 flex items-center justify-center rounded-full text-sm font-semibold",
|
|
2688
2694
|
children: t + 1
|
|
@@ -2700,8 +2706,8 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2700
2706
|
}, t))
|
|
2701
2707
|
})
|
|
2702
2708
|
});
|
|
2703
|
-
},
|
|
2704
|
-
let { loading: r, sendMessage: i } =
|
|
2709
|
+
}, ir = ({ section: e, dividerRef: t, isLast: n }) => {
|
|
2710
|
+
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
2711
|
navigator.clipboard.writeText(e.userMessage.content), c(!0), setTimeout(() => c(!1), 1500);
|
|
2706
2712
|
}, h = () => {
|
|
2707
2713
|
d.trim() && (i(d.trim()), u(!1));
|
|
@@ -2719,11 +2725,11 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2719
2725
|
r && window.open(`${r}${encodeURIComponent(n)}`, "_blank");
|
|
2720
2726
|
}, w = { overrides: {
|
|
2721
2727
|
think: {
|
|
2722
|
-
component:
|
|
2728
|
+
component: Dn,
|
|
2723
2729
|
props: { thinkingEnded: v }
|
|
2724
2730
|
},
|
|
2725
2731
|
citation: {
|
|
2726
|
-
component:
|
|
2732
|
+
component: Tn,
|
|
2727
2733
|
props: { sources: e.sourceMessage?.sources || [] }
|
|
2728
2734
|
},
|
|
2729
2735
|
table: { component: ({ children: e, ...t }) => /* @__PURE__ */ W("div", {
|
|
@@ -2737,7 +2743,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2737
2743
|
} };
|
|
2738
2744
|
return /* @__PURE__ */ G("div", {
|
|
2739
2745
|
className: "space-y-3",
|
|
2740
|
-
children: [/* @__PURE__ */ W(
|
|
2746
|
+
children: [/* @__PURE__ */ W(On, {
|
|
2741
2747
|
section: e,
|
|
2742
2748
|
isExpanded: a,
|
|
2743
2749
|
setIsExpanded: o,
|
|
@@ -2773,14 +2779,14 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2773
2779
|
options: w,
|
|
2774
2780
|
children: g
|
|
2775
2781
|
}),
|
|
2776
|
-
r && n ? null : /* @__PURE__ */ W(
|
|
2782
|
+
r && n ? null : /* @__PURE__ */ W(er, {
|
|
2777
2783
|
section: e,
|
|
2778
2784
|
speechStatus: b,
|
|
2779
2785
|
start: x,
|
|
2780
2786
|
stop: S,
|
|
2781
2787
|
handleOpenInLLM: C
|
|
2782
2788
|
}),
|
|
2783
|
-
/* @__PURE__ */ W(
|
|
2789
|
+
/* @__PURE__ */ W(rr, {
|
|
2784
2790
|
section: e,
|
|
2785
2791
|
isLast: n,
|
|
2786
2792
|
loading: r,
|
|
@@ -2792,7 +2798,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2792
2798
|
})
|
|
2793
2799
|
})]
|
|
2794
2800
|
});
|
|
2795
|
-
},
|
|
2801
|
+
}, ar = (e) => {
|
|
2796
2802
|
if (e === 0) return "0 Bytes";
|
|
2797
2803
|
let t = 1024, n = [
|
|
2798
2804
|
"Bytes",
|
|
@@ -2801,16 +2807,24 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2801
2807
|
"GB"
|
|
2802
2808
|
], r = Math.floor(Math.log(e) / Math.log(t));
|
|
2803
2809
|
return parseFloat((e / t ** r).toFixed(2)) + " " + n[r];
|
|
2804
|
-
},
|
|
2810
|
+
}, or = ({ file: e, onRemove: t }) => /* @__PURE__ */ G("div", {
|
|
2805
2811
|
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
2812
|
children: [
|
|
2807
2813
|
e.type.startsWith("image/") && e.preview ? /* @__PURE__ */ G("div", {
|
|
2808
2814
|
className: "w-full h-full relative",
|
|
2809
|
-
children: [
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2815
|
+
children: [
|
|
2816
|
+
/* @__PURE__ */ W("img", {
|
|
2817
|
+
src: e.preview,
|
|
2818
|
+
alt: e.file.name,
|
|
2819
|
+
className: "w-full h-full object-cover"
|
|
2820
|
+
}),
|
|
2821
|
+
/* @__PURE__ */ W("div", { className: "absolute inset-0 bg-black/20 group-hover:bg-black/0 transition-colors" }),
|
|
2822
|
+
/* @__PURE__ */ W("span", {
|
|
2823
|
+
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",
|
|
2824
|
+
title: e.file.name,
|
|
2825
|
+
children: ar(e.file.size)
|
|
2826
|
+
})
|
|
2827
|
+
]
|
|
2814
2828
|
}) : /* @__PURE__ */ G("div", {
|
|
2815
2829
|
className: "w-full h-full p-3 flex flex-col justify-between",
|
|
2816
2830
|
children: [/* @__PURE__ */ G("div", {
|
|
@@ -2830,7 +2844,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2830
2844
|
children: e.file.name
|
|
2831
2845
|
}), /* @__PURE__ */ W("p", {
|
|
2832
2846
|
className: "text-[10px] text-text-500",
|
|
2833
|
-
children:
|
|
2847
|
+
children: ar(e.file.size)
|
|
2834
2848
|
})]
|
|
2835
2849
|
})]
|
|
2836
2850
|
}),
|
|
@@ -2848,7 +2862,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2848
2862
|
children: /* @__PURE__ */ W($.X, { className: "w-5 h-5 text-red-300" })
|
|
2849
2863
|
})
|
|
2850
2864
|
]
|
|
2851
|
-
}),
|
|
2865
|
+
}), sr = ({ content: e, onRemove: t }) => /* @__PURE__ */ G("div", {
|
|
2852
2866
|
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
2867
|
children: [
|
|
2854
2868
|
/* @__PURE__ */ W("div", {
|
|
@@ -2877,7 +2891,7 @@ var nr = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
|
|
|
2877
2891
|
});
|
|
2878
2892
|
//#endregion
|
|
2879
2893
|
//#region src/hooks/voice/useSpeechToTranscript.ts
|
|
2880
|
-
function
|
|
2894
|
+
function cr(e, t) {
|
|
2881
2895
|
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
2896
|
let e = a.current;
|
|
2883
2897
|
e && e.state !== "inactive" ? e.stop() : (o.current?.getTracks().forEach((e) => e.stop()), o.current = null, a.current = null, r(!1), t());
|
|
@@ -2966,28 +2980,28 @@ function sr(e, t) {
|
|
|
2966
2980
|
}
|
|
2967
2981
|
//#endregion
|
|
2968
2982
|
//#region src/components/FileUpload/useFileHandling.ts
|
|
2969
|
-
var
|
|
2983
|
+
var lr = [
|
|
2970
2984
|
"pdf",
|
|
2971
2985
|
"docx",
|
|
2972
2986
|
"txt",
|
|
2973
2987
|
"md",
|
|
2974
2988
|
"html",
|
|
2975
2989
|
"htm"
|
|
2976
|
-
],
|
|
2990
|
+
], ur = 10, dr = 50 * 1024 * 1024, fr = (e, t) => {
|
|
2977
2991
|
if (e && typeof e == "object") {
|
|
2978
2992
|
let t = e.message ?? e.error ?? e.data?.message;
|
|
2979
2993
|
if (typeof t == "string" && t.length > 0) return t;
|
|
2980
2994
|
}
|
|
2981
2995
|
return typeof e == "string" && e.length > 0 ? e : t;
|
|
2982
2996
|
};
|
|
2983
|
-
function
|
|
2997
|
+
function pr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles: r, setContextFileIds: i }) {
|
|
2984
2998
|
let [a, o] = p([]), [s, l] = p([]), [u, d] = p(!1), [f, m] = p(!1), h = c(async (e) => {
|
|
2985
2999
|
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 <=
|
|
3000
|
+
a.length > ur && (K.error(`You can attach up to ${ur} files at a time.`), a = a.slice(0, ur));
|
|
3001
|
+
let s = a.filter((e) => e.size > dr);
|
|
3002
|
+
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
3003
|
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 =
|
|
3004
|
+
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
3005
|
return {
|
|
2992
3006
|
id: Math.random().toString(36).substr(2, 9),
|
|
2993
3007
|
file: e,
|
|
@@ -2997,7 +3011,7 @@ function fr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
2997
3011
|
_ext: n
|
|
2998
3012
|
};
|
|
2999
3013
|
});
|
|
3000
|
-
o((e) => [...e, ...c]), c.filter((e) => !
|
|
3014
|
+
o((e) => [...e, ...c]), c.filter((e) => !lr.includes(e._ext)).forEach((e) => {
|
|
3001
3015
|
setTimeout(() => {
|
|
3002
3016
|
o((t) => t.map((t) => t.id === e.id ? {
|
|
3003
3017
|
...t,
|
|
@@ -3005,16 +3019,16 @@ function fr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
3005
3019
|
} : t));
|
|
3006
3020
|
}, 600 + Math.random() * 600);
|
|
3007
3021
|
});
|
|
3008
|
-
let l = c.filter((e) =>
|
|
3022
|
+
let l = c.filter((e) => lr.includes(e._ext));
|
|
3009
3023
|
if (l.length !== 0) try {
|
|
3010
3024
|
let { data: e, error: a } = await at({ body: { files: l.map((e) => e.file) } });
|
|
3011
|
-
if (a || !e?.files) throw Error(
|
|
3025
|
+
if (a || !e?.files) throw Error(fr(a ?? e, "Upload failed."));
|
|
3012
3026
|
o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
|
|
3013
3027
|
...e,
|
|
3014
3028
|
uploadStatus: "complete"
|
|
3015
3029
|
} : e)), r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]);
|
|
3016
3030
|
} catch (e) {
|
|
3017
|
-
K.error(
|
|
3031
|
+
K.error(fr(e, "Failed to upload files.")), o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
|
|
3018
3032
|
...e,
|
|
3019
3033
|
uploadStatus: "error"
|
|
3020
3034
|
} : e));
|
|
@@ -3044,10 +3058,10 @@ function fr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
3044
3058
|
headers: { "Content-Type": "application/json" },
|
|
3045
3059
|
body: JSON.stringify({ url: a })
|
|
3046
3060
|
})).json();
|
|
3047
|
-
if (!e?.files || e.files.length === 0) throw Error(
|
|
3061
|
+
if (!e?.files || e.files.length === 0) throw Error(fr(e, `Could not extract content from ${a}`));
|
|
3048
3062
|
return r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]), K.success(`Added "${e.files[0].fileName}" as context.`), !0;
|
|
3049
3063
|
} catch (e) {
|
|
3050
|
-
return K.error(
|
|
3064
|
+
return K.error(fr(e, "Failed to extract URL.")), !1;
|
|
3051
3065
|
} finally {
|
|
3052
3066
|
m(!1);
|
|
3053
3067
|
}
|
|
@@ -3094,24 +3108,24 @@ function fr({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
3094
3108
|
}
|
|
3095
3109
|
//#endregion
|
|
3096
3110
|
//#region src/components/FileUpload/GoogleDrivePicker.tsx
|
|
3097
|
-
var
|
|
3111
|
+
var mr = () => window.gapi, hr = () => window.google, gr = () => {
|
|
3098
3112
|
let e = f(!1), n = f(!1);
|
|
3099
3113
|
return u(() => {
|
|
3100
|
-
|
|
3114
|
+
mr() ? n.current = !0 : (() => {
|
|
3101
3115
|
let e = document.createElement("script");
|
|
3102
3116
|
e.src = "https://apis.google.com/js/api.js", e.onload = () => {
|
|
3103
|
-
|
|
3117
|
+
mr()?.load("client:picker", () => {
|
|
3104
3118
|
n.current = !0;
|
|
3105
3119
|
});
|
|
3106
3120
|
}, document.body.appendChild(e);
|
|
3107
|
-
})(),
|
|
3121
|
+
})(), hr()?.picker ? e.current = !0 : (() => {
|
|
3108
3122
|
let t = document.createElement("script");
|
|
3109
3123
|
t.src = "https://www.google.com/jsapi", t.onload = () => {
|
|
3110
3124
|
e.current = !0;
|
|
3111
3125
|
}, document.body.appendChild(t);
|
|
3112
3126
|
})();
|
|
3113
3127
|
}, []), { openPicker: async (e, r, i) => {
|
|
3114
|
-
let a =
|
|
3128
|
+
let a = hr();
|
|
3115
3129
|
if (!n.current || !a?.picker) {
|
|
3116
3130
|
i?.("Google Picker API not loaded yet. Please try again.");
|
|
3117
3131
|
return;
|
|
@@ -3128,8 +3142,8 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3128
3142
|
i?.(e.message || "Failed to open Google Picker");
|
|
3129
3143
|
}
|
|
3130
3144
|
} };
|
|
3131
|
-
},
|
|
3132
|
-
let { chatModelProvider: e, setChatModelProvider: t } =
|
|
3145
|
+
}, _r = () => {
|
|
3146
|
+
let { chatModelProvider: e, setChatModelProvider: t } = yn(), [n, r] = p([]), [i, a] = p(!0), o = h();
|
|
3133
3147
|
u(() => {
|
|
3134
3148
|
(async () => {
|
|
3135
3149
|
try {
|
|
@@ -3169,17 +3183,17 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3169
3183
|
key: n
|
|
3170
3184
|
}), localStorage.setItem("chatModelProviderId", e), localStorage.setItem("chatModelKey", n);
|
|
3171
3185
|
};
|
|
3172
|
-
return /* @__PURE__ */ G(
|
|
3186
|
+
return /* @__PURE__ */ G(Fn, { children: [/* @__PURE__ */ G(In, {
|
|
3173
3187
|
className: "gap-2",
|
|
3174
3188
|
children: [
|
|
3175
|
-
/* @__PURE__ */ W(
|
|
3189
|
+
/* @__PURE__ */ W(te, { className: "w-4 h-4 flex-shrink-0 text-sky-500" }),
|
|
3176
3190
|
/* @__PURE__ */ W("span", { children: "Model" }),
|
|
3177
3191
|
/* @__PURE__ */ W("span", {
|
|
3178
3192
|
className: "ml-auto text-xs text-muted-foreground truncate max-w-[55px]",
|
|
3179
3193
|
children: s
|
|
3180
3194
|
})
|
|
3181
3195
|
]
|
|
3182
|
-
}), /* @__PURE__ */ G(
|
|
3196
|
+
}), /* @__PURE__ */ G(Ln, {
|
|
3183
3197
|
className: "w-52 max-h-[400px] overflow-y-auto",
|
|
3184
3198
|
children: [
|
|
3185
3199
|
i ? /* @__PURE__ */ W("div", {
|
|
@@ -3189,7 +3203,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3189
3203
|
className: "px-3 py-2 text-xs text-muted-foreground",
|
|
3190
3204
|
children: "No models configured"
|
|
3191
3205
|
}) : n.map((t, r) => /* @__PURE__ */ G("div", { children: [
|
|
3192
|
-
/* @__PURE__ */ W(
|
|
3206
|
+
/* @__PURE__ */ W(Nn, {
|
|
3193
3207
|
className: "text-[10px] uppercase tracking-wider text-muted-foreground font-medium",
|
|
3194
3208
|
children: t.name
|
|
3195
3209
|
}),
|
|
@@ -3197,7 +3211,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3197
3211
|
onSelect: () => c(t.id, n.key),
|
|
3198
3212
|
className: J("gap-2", e?.providerId === t.id && e?.key === n.key && "bg-secondary"),
|
|
3199
3213
|
children: [
|
|
3200
|
-
/* @__PURE__ */ W(
|
|
3214
|
+
/* @__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
3215
|
/* @__PURE__ */ W("span", {
|
|
3202
3216
|
className: "truncate",
|
|
3203
3217
|
children: n.name
|
|
@@ -3216,9 +3230,9 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3216
3230
|
})
|
|
3217
3231
|
]
|
|
3218
3232
|
}, n.key)),
|
|
3219
|
-
r < n.length - 1 && /* @__PURE__ */ W(
|
|
3233
|
+
r < n.length - 1 && /* @__PURE__ */ W(Pn, {})
|
|
3220
3234
|
] }, t.id)),
|
|
3221
|
-
/* @__PURE__ */ W(
|
|
3235
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3222
3236
|
/* @__PURE__ */ G(Q, {
|
|
3223
3237
|
onSelect: () => o.push("/settings?section=models"),
|
|
3224
3238
|
className: "gap-2",
|
|
@@ -3226,7 +3240,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3226
3240
|
})
|
|
3227
3241
|
]
|
|
3228
3242
|
})] });
|
|
3229
|
-
},
|
|
3243
|
+
}, vr = [
|
|
3230
3244
|
{
|
|
3231
3245
|
label: "5s",
|
|
3232
3246
|
value: 5
|
|
@@ -3251,22 +3265,22 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3251
3265
|
label: "Unlimited",
|
|
3252
3266
|
value: 0
|
|
3253
3267
|
}
|
|
3254
|
-
],
|
|
3268
|
+
], yr = [
|
|
3255
3269
|
"pdf",
|
|
3256
3270
|
"docx",
|
|
3257
3271
|
"txt",
|
|
3258
3272
|
"md",
|
|
3259
3273
|
"html",
|
|
3260
3274
|
"htm"
|
|
3261
|
-
],
|
|
3262
|
-
let n = h(), { category: i, setCategory: a, incognito: o, setIncognito: s, sections: c, chatId: l } =
|
|
3275
|
+
], 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 }) => {
|
|
3276
|
+
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
3277
|
let t = i ? i.split(",").filter(Boolean) : ["general"], n = t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
|
|
3264
3278
|
a(n.length > 0 ? n.join(",") : "general");
|
|
3265
3279
|
}, [_, v] = p(!1), [y, b] = p(!1), [x, S] = p(!1), [C, w] = p(!1), [E, D] = p(() => {
|
|
3266
3280
|
if (typeof window > "u") return 5;
|
|
3267
3281
|
let e = Number(localStorage.getItem("thinkingTimeLimit") ?? "5");
|
|
3268
3282
|
return Number.isFinite(e) ? e : 5;
|
|
3269
|
-
}), O = r.useRef(null), { openPicker: k } =
|
|
3283
|
+
}), O = r.useRef(null), { openPicker: k } = gr();
|
|
3270
3284
|
u(() => {
|
|
3271
3285
|
A();
|
|
3272
3286
|
}, []);
|
|
@@ -3310,8 +3324,8 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3310
3324
|
let n = [];
|
|
3311
3325
|
for await (let r of e.values()) if (r.kind === "file") {
|
|
3312
3326
|
let e = await r.getFile(), i = e.name.split(".").pop()?.toLowerCase() ?? "";
|
|
3313
|
-
if (
|
|
3314
|
-
else if (
|
|
3327
|
+
if (yr.includes(i)) n.push(e);
|
|
3328
|
+
else if (br.includes(i)) try {
|
|
3315
3329
|
let r = await e.text(), i = t ? `${t}/${e.name}` : e.name;
|
|
3316
3330
|
n.push(new File([r], `${i.replace(/[/\\]/g, "_")}.txt`, { type: "text/plain" }));
|
|
3317
3331
|
} catch {}
|
|
@@ -3379,11 +3393,11 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3379
3393
|
} catch (e) {
|
|
3380
3394
|
alert(e.message || "Failed to open Google Drive picker");
|
|
3381
3395
|
}
|
|
3382
|
-
},
|
|
3396
|
+
}, R = vr.find((e) => e.value === E)?.label ?? "Unlimited";
|
|
3383
3397
|
return /* @__PURE__ */ G(U, { children: [
|
|
3384
3398
|
/* @__PURE__ */ G("div", {
|
|
3385
3399
|
className: "relative flex shrink min-w-8 !shrink-0 group",
|
|
3386
|
-
children: [/* @__PURE__ */ G(
|
|
3400
|
+
children: [/* @__PURE__ */ G(kn, { children: [/* @__PURE__ */ W(An, {
|
|
3387
3401
|
asChild: !0,
|
|
3388
3402
|
children: /* @__PURE__ */ W("button", {
|
|
3389
3403
|
disabled: t,
|
|
@@ -3392,27 +3406,27 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3392
3406
|
"aria-label": "Search options",
|
|
3393
3407
|
children: /* @__PURE__ */ W(Ce, { className: "w-5 h-5" })
|
|
3394
3408
|
})
|
|
3395
|
-
}), /* @__PURE__ */ G(
|
|
3409
|
+
}), /* @__PURE__ */ G(jn, {
|
|
3396
3410
|
align: "start",
|
|
3397
3411
|
side: "top",
|
|
3398
3412
|
sideOffset: 8,
|
|
3399
3413
|
className: "w-44",
|
|
3400
3414
|
children: [
|
|
3401
|
-
/* @__PURE__ */ G(
|
|
3415
|
+
/* @__PURE__ */ G(Fn, { children: [/* @__PURE__ */ G(In, {
|
|
3402
3416
|
className: "gap-2",
|
|
3403
3417
|
children: [m && /* @__PURE__ */ W(m.icon, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Category" })]
|
|
3404
|
-
}), /* @__PURE__ */ G(
|
|
3418
|
+
}), /* @__PURE__ */ G(Ln, {
|
|
3405
3419
|
className: "w-44",
|
|
3406
3420
|
children: [
|
|
3407
|
-
/* @__PURE__ */ G(
|
|
3421
|
+
/* @__PURE__ */ G(Mn, {
|
|
3408
3422
|
checked: f.length === 0,
|
|
3409
3423
|
onCheckedChange: () => a("general"),
|
|
3410
3424
|
onSelect: (e) => e.preventDefault(),
|
|
3411
3425
|
className: "gap-2",
|
|
3412
3426
|
children: [/* @__PURE__ */ W("div", { className: "w-3.5 h-3.5 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "None" })]
|
|
3413
3427
|
}),
|
|
3414
|
-
/* @__PURE__ */ W(
|
|
3415
|
-
Pt.map((e) => /* @__PURE__ */ G(
|
|
3428
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3429
|
+
Pt.map((e) => /* @__PURE__ */ G(Mn, {
|
|
3416
3430
|
checked: f.includes(e.code),
|
|
3417
3431
|
onCheckedChange: () => g(e.code),
|
|
3418
3432
|
onSelect: (e) => e.preventDefault(),
|
|
@@ -3421,19 +3435,19 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3421
3435
|
}, e.code))
|
|
3422
3436
|
]
|
|
3423
3437
|
})] }),
|
|
3424
|
-
/* @__PURE__ */ G(
|
|
3438
|
+
/* @__PURE__ */ G(Fn, { children: [/* @__PURE__ */ G(In, {
|
|
3425
3439
|
className: "gap-2",
|
|
3426
3440
|
children: [
|
|
3427
|
-
/* @__PURE__ */ W(
|
|
3441
|
+
/* @__PURE__ */ W(L, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }),
|
|
3428
3442
|
/* @__PURE__ */ W("span", { children: "Speed" }),
|
|
3429
3443
|
/* @__PURE__ */ W("span", {
|
|
3430
3444
|
className: "ml-auto text-xs text-muted-foreground",
|
|
3431
|
-
children:
|
|
3445
|
+
children: R
|
|
3432
3446
|
})
|
|
3433
3447
|
]
|
|
3434
|
-
}), /* @__PURE__ */ W(
|
|
3448
|
+
}), /* @__PURE__ */ W(Ln, {
|
|
3435
3449
|
className: "w-36",
|
|
3436
|
-
children:
|
|
3450
|
+
children: vr.map((e) => /* @__PURE__ */ G(Q, {
|
|
3437
3451
|
onSelect: () => j(e.value),
|
|
3438
3452
|
className: J("justify-between", E === e.value && "bg-secondary"),
|
|
3439
3453
|
children: [/* @__PURE__ */ W("span", { children: e.label }), E === e.value && /* @__PURE__ */ W("svg", {
|
|
@@ -3450,13 +3464,13 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3450
3464
|
})]
|
|
3451
3465
|
}, e.value))
|
|
3452
3466
|
})] }),
|
|
3453
|
-
/* @__PURE__ */ W(
|
|
3454
|
-
/* @__PURE__ */ W(
|
|
3455
|
-
/* @__PURE__ */ W(
|
|
3456
|
-
/* @__PURE__ */ G(
|
|
3467
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3468
|
+
/* @__PURE__ */ W(_r, {}),
|
|
3469
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3470
|
+
/* @__PURE__ */ G(Fn, { children: [/* @__PURE__ */ G(In, {
|
|
3457
3471
|
className: "gap-2",
|
|
3458
3472
|
children: [/* @__PURE__ */ W(je, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ W("span", { children: "Upload" })]
|
|
3459
|
-
}), /* @__PURE__ */ G(
|
|
3473
|
+
}), /* @__PURE__ */ G(Ln, {
|
|
3460
3474
|
className: "w-44",
|
|
3461
3475
|
children: [
|
|
3462
3476
|
/* @__PURE__ */ G(Q, {
|
|
@@ -3470,8 +3484,8 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3470
3484
|
className: "gap-2",
|
|
3471
3485
|
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
3486
|
}),
|
|
3473
|
-
/* @__PURE__ */ W(
|
|
3474
|
-
/* @__PURE__ */ W(
|
|
3487
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3488
|
+
/* @__PURE__ */ W(Nn, {
|
|
3475
3489
|
className: "text-xs font-normal text-muted-foreground",
|
|
3476
3490
|
children: "Cloud"
|
|
3477
3491
|
}),
|
|
@@ -3479,28 +3493,28 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3479
3493
|
onSelect: I,
|
|
3480
3494
|
disabled: x,
|
|
3481
3495
|
className: "gap-2",
|
|
3482
|
-
children: [x ? /* @__PURE__ */ W(H, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ W(
|
|
3496
|
+
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
3497
|
}) : /* @__PURE__ */ G(Q, {
|
|
3484
3498
|
onSelect: F,
|
|
3485
3499
|
disabled: y,
|
|
3486
3500
|
className: "gap-2",
|
|
3487
|
-
children: [y ? /* @__PURE__ */ W(H, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ W(
|
|
3501
|
+
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
3502
|
})
|
|
3489
3503
|
]
|
|
3490
3504
|
})] }),
|
|
3491
|
-
/* @__PURE__ */ W(
|
|
3492
|
-
/* @__PURE__ */ G(
|
|
3505
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3506
|
+
/* @__PURE__ */ G(Mn, {
|
|
3493
3507
|
checked: o,
|
|
3494
3508
|
onCheckedChange: s,
|
|
3495
3509
|
onSelect: (e) => e.preventDefault(),
|
|
3496
3510
|
className: "gap-2",
|
|
3497
|
-
children: [/* @__PURE__ */ W(
|
|
3511
|
+
children: [/* @__PURE__ */ W(ne, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ W("span", { children: "Private" })]
|
|
3498
3512
|
}),
|
|
3499
|
-
/* @__PURE__ */ W(
|
|
3500
|
-
c.length > 0 && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(
|
|
3513
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3514
|
+
c.length > 0 && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(Fn, { children: [/* @__PURE__ */ G(In, {
|
|
3501
3515
|
className: "gap-2",
|
|
3502
3516
|
children: [/* @__PURE__ */ W(Se, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ W("span", { children: "Share" })]
|
|
3503
|
-
}), /* @__PURE__ */ G(
|
|
3517
|
+
}), /* @__PURE__ */ G(Ln, {
|
|
3504
3518
|
className: "w-48",
|
|
3505
3519
|
children: [
|
|
3506
3520
|
/* @__PURE__ */ G(Q, {
|
|
@@ -3546,37 +3560,37 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3546
3560
|
className: "gap-2",
|
|
3547
3561
|
children: [/* @__PURE__ */ W(T, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Save to QwkDocs" })]
|
|
3548
3562
|
}),
|
|
3549
|
-
/* @__PURE__ */ W(
|
|
3563
|
+
/* @__PURE__ */ W(Pn, {}),
|
|
3550
3564
|
/* @__PURE__ */ G(Q, {
|
|
3551
3565
|
onSelect: () => {
|
|
3552
|
-
|
|
3566
|
+
Yn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3553
3567
|
},
|
|
3554
3568
|
className: "gap-2",
|
|
3555
|
-
children: [/* @__PURE__ */ W(
|
|
3569
|
+
children: [/* @__PURE__ */ W(oe, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export as Markdown" })]
|
|
3556
3570
|
}),
|
|
3557
3571
|
/* @__PURE__ */ G(Q, {
|
|
3558
3572
|
onSelect: () => {
|
|
3559
|
-
|
|
3573
|
+
Zn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3560
3574
|
},
|
|
3561
3575
|
className: "gap-2",
|
|
3562
3576
|
children: [/* @__PURE__ */ W(se, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export as PDF" })]
|
|
3563
3577
|
}),
|
|
3564
3578
|
/* @__PURE__ */ G(Q, {
|
|
3565
3579
|
onSelect: () => {
|
|
3566
|
-
|
|
3580
|
+
Xn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3567
3581
|
},
|
|
3568
3582
|
className: "gap-2",
|
|
3569
|
-
children: [/* @__PURE__ */ W(
|
|
3583
|
+
children: [/* @__PURE__ */ W(ie, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export as DOCX" })]
|
|
3570
3584
|
}),
|
|
3571
3585
|
/* @__PURE__ */ G(Q, {
|
|
3572
3586
|
onSelect: () => {
|
|
3573
|
-
|
|
3587
|
+
Qn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
3574
3588
|
},
|
|
3575
3589
|
className: "gap-2",
|
|
3576
|
-
children: [/* @__PURE__ */ W(
|
|
3590
|
+
children: [/* @__PURE__ */ W(ae, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ W("span", { children: "Export to Google Docs" })]
|
|
3577
3591
|
})
|
|
3578
3592
|
]
|
|
3579
|
-
})] }), /* @__PURE__ */ W(
|
|
3593
|
+
})] }), /* @__PURE__ */ W(Pn, {})] }),
|
|
3580
3594
|
/* @__PURE__ */ G(Q, {
|
|
3581
3595
|
onSelect: () => n.push("/library"),
|
|
3582
3596
|
className: "gap-2",
|
|
@@ -3623,7 +3637,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3623
3637
|
className: "hidden"
|
|
3624
3638
|
})
|
|
3625
3639
|
] });
|
|
3626
|
-
},
|
|
3640
|
+
}, 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
3641
|
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
3642
|
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
3643
|
}, [x]), F = c((e, t, o, s, c) => {
|
|
@@ -3651,7 +3665,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3651
3665
|
a,
|
|
3652
3666
|
p,
|
|
3653
3667
|
g
|
|
3654
|
-
]),
|
|
3668
|
+
]), L = c((e, t, o, s, c) => {
|
|
3655
3669
|
let l = n + i, u = Math.floor(t / s / l), d = u * l - i, f = (t / s - d) / 2;
|
|
3656
3670
|
for (let t = 0; t < u; t++) {
|
|
3657
3671
|
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 +3676,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3662
3676
|
i,
|
|
3663
3677
|
r,
|
|
3664
3678
|
a
|
|
3665
|
-
]),
|
|
3679
|
+
]), R = c((e, t, n) => {
|
|
3666
3680
|
if (!s) return;
|
|
3667
3681
|
e.save(), e.globalCompositeOperation = "destination-in";
|
|
3668
3682
|
let r = e.createLinearGradient(0, 0, t, 0);
|
|
@@ -3696,7 +3710,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3696
3710
|
A.current = requestAnimationFrame(r);
|
|
3697
3711
|
return;
|
|
3698
3712
|
}
|
|
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,
|
|
3713
|
+
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
3714
|
else if (e && D.current) {
|
|
3701
3715
|
let e = new Uint8Array(D.current.frequencyBinCount);
|
|
3702
3716
|
if (D.current.getByteFrequencyData(e), v === "scrolling") {
|
|
@@ -3706,7 +3720,7 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3706
3720
|
j.current.push(n), j.current.length > g * 2 && (j.current = j.current.slice(-g)), I(d, l, u, s);
|
|
3707
3721
|
} else F(d, l, u, e, s);
|
|
3708
3722
|
}
|
|
3709
|
-
|
|
3723
|
+
R(d, l, u), d.restore(), A.current = requestAnimationFrame(r);
|
|
3710
3724
|
};
|
|
3711
3725
|
return A.current = requestAnimationFrame(r), () => {
|
|
3712
3726
|
n = !1, A.current &&= (cancelAnimationFrame(A.current), 0);
|
|
@@ -3720,8 +3734,8 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3720
3734
|
g,
|
|
3721
3735
|
F,
|
|
3722
3736
|
I,
|
|
3723
|
-
|
|
3724
|
-
|
|
3737
|
+
L,
|
|
3738
|
+
R
|
|
3725
3739
|
]), u(() => {
|
|
3726
3740
|
if (!e) {
|
|
3727
3741
|
P();
|
|
@@ -3772,23 +3786,23 @@ var pr = () => window.gapi, mr = () => window.google, hr = () => {
|
|
|
3772
3786
|
})
|
|
3773
3787
|
});
|
|
3774
3788
|
});
|
|
3775
|
-
|
|
3789
|
+
Sr.displayName = "LiveWaveform";
|
|
3776
3790
|
//#endregion
|
|
3777
3791
|
//#region src/components/MessageComposer/ChatInputBox.tsx
|
|
3778
|
-
var
|
|
3792
|
+
var Cr = [
|
|
3779
3793
|
"What are you curious to research?",
|
|
3780
3794
|
"Search the latest news...",
|
|
3781
3795
|
"Analyze a video, doc, or URL...",
|
|
3782
3796
|
"Find academic research on...",
|
|
3783
3797
|
"Compare products to buy..."
|
|
3784
|
-
],
|
|
3798
|
+
], wr = {
|
|
3785
3799
|
initial: {},
|
|
3786
3800
|
animate: { transition: { staggerChildren: .025 } },
|
|
3787
3801
|
exit: { transition: {
|
|
3788
3802
|
staggerChildren: .015,
|
|
3789
3803
|
staggerDirection: -1
|
|
3790
3804
|
} }
|
|
3791
|
-
},
|
|
3805
|
+
}, Tr = {
|
|
3792
3806
|
initial: {
|
|
3793
3807
|
opacity: 0,
|
|
3794
3808
|
filter: "blur(12px)",
|
|
@@ -3822,8 +3836,8 @@ var Sr = [
|
|
|
3822
3836
|
}
|
|
3823
3837
|
}
|
|
3824
3838
|
}
|
|
3825
|
-
},
|
|
3826
|
-
let { loading: t, sendMessage: n, stopStreaming: r, files: i, fileIds: a, setFiles: o, setFileIds: s, newChat: c, sections: l } =
|
|
3839
|
+
}, Er = ({ onNewChat: e }) => {
|
|
3840
|
+
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
3841
|
setMessage: m,
|
|
3828
3842
|
contextFiles: i,
|
|
3829
3843
|
contextFileIds: a,
|
|
@@ -3831,19 +3845,19 @@ var Sr = [
|
|
|
3831
3845
|
setContextFileIds: s
|
|
3832
3846
|
}), O = () => {
|
|
3833
3847
|
m(""), D(), h.current && (h.current.style.height = "auto");
|
|
3834
|
-
}, { isListening: k, toggleSpeech: A, isSpeechSupported: j } =
|
|
3848
|
+
}, { isListening: k, toggleSpeech: A, isSpeechSupported: j } = cr((e) => m(e), () => {
|
|
3835
3849
|
m((e) => (e.trim() && setTimeout(() => {
|
|
3836
3850
|
n(e), O();
|
|
3837
3851
|
}, 0), e));
|
|
3838
|
-
}), [M, N] = p(0), [P, F] = p(!0), [I,
|
|
3852
|
+
}), [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
3853
|
u(() => {
|
|
3840
|
-
if (
|
|
3841
|
-
|
|
3854
|
+
if (oe.current) {
|
|
3855
|
+
oe.current = !1;
|
|
3842
3856
|
return;
|
|
3843
3857
|
}
|
|
3844
3858
|
let { query: e } = ce(d);
|
|
3845
3859
|
if (!I || e.length < 2) {
|
|
3846
|
-
|
|
3860
|
+
z([]), te([]), re(!1), V(-1);
|
|
3847
3861
|
return;
|
|
3848
3862
|
}
|
|
3849
3863
|
let t = setTimeout(async () => {
|
|
@@ -3860,14 +3874,14 @@ var Sr = [
|
|
|
3860
3874
|
});
|
|
3861
3875
|
if (r) return;
|
|
3862
3876
|
let i = Array.isArray(n?.suggestions) ? n.suggestions : [], a = Array.isArray(n?.domains) ? n.domains : [];
|
|
3863
|
-
if (
|
|
3877
|
+
if (z(i), te(a), i.length + a.length > 0) {
|
|
3864
3878
|
if (g.current) {
|
|
3865
3879
|
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 ?
|
|
3880
|
+
t < Math.min(288, (i.length + a.length) * 36) && n > t ? ae("above") : ae("below");
|
|
3867
3881
|
}
|
|
3868
|
-
|
|
3869
|
-
} else
|
|
3870
|
-
|
|
3882
|
+
re(!0);
|
|
3883
|
+
} else re(!1);
|
|
3884
|
+
V(-1);
|
|
3871
3885
|
} catch (e) {
|
|
3872
3886
|
e?.name !== "AbortError" && console.error("Autocomplete fetch failed", e);
|
|
3873
3887
|
}
|
|
@@ -3886,25 +3900,25 @@ var Sr = [
|
|
|
3886
3900
|
query: i
|
|
3887
3901
|
};
|
|
3888
3902
|
}, le = (e) => {
|
|
3889
|
-
|
|
3903
|
+
oe.current = !0;
|
|
3890
3904
|
let { prefix: t } = ce(d);
|
|
3891
|
-
m(t + e),
|
|
3905
|
+
m(t + e), z([]), te([]), re(!1), V(-1), h.current?.focus();
|
|
3892
3906
|
}, ue = (e) => {
|
|
3893
|
-
|
|
3894
|
-
}, de =
|
|
3895
|
-
e <
|
|
3907
|
+
re(!1), V(-1), window.location.href = `https://${e.domain}`;
|
|
3908
|
+
}, de = ee.length + R.length, H = (e) => {
|
|
3909
|
+
e < ee.length ? ue(ee[e]) : le(R[e - ee.length]);
|
|
3896
3910
|
};
|
|
3897
3911
|
u(() => {
|
|
3898
3912
|
if (I || d) return;
|
|
3899
3913
|
let e = setInterval(() => {
|
|
3900
3914
|
F(!1), setTimeout(() => {
|
|
3901
|
-
N((e) => (e + 1) %
|
|
3915
|
+
N((e) => (e + 1) % Cr.length), F(!0);
|
|
3902
3916
|
}, 400);
|
|
3903
3917
|
}, 3e3);
|
|
3904
3918
|
return () => clearInterval(e);
|
|
3905
3919
|
}, [I, d]), u(() => {
|
|
3906
3920
|
let e = (e) => {
|
|
3907
|
-
g.current && !g.current.contains(e.target) && (d ||
|
|
3921
|
+
g.current && !g.current.contains(e.target) && (d || L(!1));
|
|
3908
3922
|
};
|
|
3909
3923
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
3910
3924
|
}, [d]), u(() => {
|
|
@@ -3913,25 +3927,25 @@ var Sr = [
|
|
|
3913
3927
|
let fe = () => {
|
|
3914
3928
|
t || !d.trim() && _.length === 0 && y.length === 0 || (n(d), O());
|
|
3915
3929
|
}, pe = (e) => {
|
|
3916
|
-
if (
|
|
3930
|
+
if (ne && de > 0) {
|
|
3917
3931
|
if (e.key === "ArrowDown") {
|
|
3918
|
-
e.preventDefault(),
|
|
3932
|
+
e.preventDefault(), V((e) => (e + 1) % de);
|
|
3919
3933
|
return;
|
|
3920
3934
|
}
|
|
3921
3935
|
if (e.key === "ArrowUp") {
|
|
3922
|
-
e.preventDefault(),
|
|
3936
|
+
e.preventDefault(), V((e) => e <= 0 ? de - 1 : e - 1);
|
|
3923
3937
|
return;
|
|
3924
3938
|
}
|
|
3925
3939
|
if (e.key === "Escape") {
|
|
3926
|
-
e.preventDefault(),
|
|
3940
|
+
e.preventDefault(), re(!1), V(-1);
|
|
3927
3941
|
return;
|
|
3928
3942
|
}
|
|
3929
|
-
if (e.key === "Tab" &&
|
|
3930
|
-
e.preventDefault(), H(
|
|
3943
|
+
if (e.key === "Tab" && B >= 0) {
|
|
3944
|
+
e.preventDefault(), H(B);
|
|
3931
3945
|
return;
|
|
3932
3946
|
}
|
|
3933
|
-
if (e.key === "Enter" && !e.shiftKey &&
|
|
3934
|
-
e.preventDefault(), H(
|
|
3947
|
+
if (e.key === "Enter" && !e.shiftKey && B >= 0) {
|
|
3948
|
+
e.preventDefault(), H(B);
|
|
3935
3949
|
return;
|
|
3936
3950
|
}
|
|
3937
3951
|
let t = parseInt(e.key, 10);
|
|
@@ -3957,21 +3971,21 @@ var Sr = [
|
|
|
3957
3971
|
stiffness: 120,
|
|
3958
3972
|
damping: 18
|
|
3959
3973
|
},
|
|
3960
|
-
onClick: () =>
|
|
3974
|
+
onClick: () => L(!0),
|
|
3961
3975
|
children: [
|
|
3962
3976
|
(_.length > 0 || y.length > 0) && /* @__PURE__ */ G("div", {
|
|
3963
3977
|
className: "flex gap-3 overflow-x-auto custom-scrollbar px-3 pt-3 pb-1",
|
|
3964
|
-
children: [y.map((e) => /* @__PURE__ */ W(
|
|
3978
|
+
children: [y.map((e) => /* @__PURE__ */ W(sr, {
|
|
3965
3979
|
content: e,
|
|
3966
3980
|
onRemove: (e) => b((t) => t.filter((t) => t.id !== e))
|
|
3967
|
-
}, e.id)), _.map((e) => /* @__PURE__ */ W(
|
|
3981
|
+
}, e.id)), _.map((e) => /* @__PURE__ */ W(or, {
|
|
3968
3982
|
file: e,
|
|
3969
3983
|
onRemove: (e) => v((t) => t.filter((t) => t.id !== e))
|
|
3970
3984
|
}, e.id))]
|
|
3971
3985
|
}),
|
|
3972
3986
|
k && /* @__PURE__ */ W("div", {
|
|
3973
3987
|
className: "px-3 pt-2",
|
|
3974
|
-
children: /* @__PURE__ */ W(
|
|
3988
|
+
children: /* @__PURE__ */ W(Sr, {
|
|
3975
3989
|
active: k,
|
|
3976
3990
|
mode: "static",
|
|
3977
3991
|
height: 48,
|
|
@@ -3986,7 +4000,7 @@ var Sr = [
|
|
|
3986
4000
|
/* @__PURE__ */ G("div", {
|
|
3987
4001
|
className: "flex items-center gap-2 p-3",
|
|
3988
4002
|
children: [
|
|
3989
|
-
/* @__PURE__ */ W(
|
|
4003
|
+
/* @__PURE__ */ W(xr, {
|
|
3990
4004
|
onFileSelect: S,
|
|
3991
4005
|
disabled: t
|
|
3992
4006
|
}),
|
|
@@ -4000,7 +4014,7 @@ var Sr = [
|
|
|
4000
4014
|
onChange: (e) => m(e.target.value),
|
|
4001
4015
|
onPaste: E,
|
|
4002
4016
|
onKeyDown: pe,
|
|
4003
|
-
onFocus: () =>
|
|
4017
|
+
onFocus: () => L(!0),
|
|
4004
4018
|
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
4019
|
rows: 1,
|
|
4006
4020
|
autoFocus: !0,
|
|
@@ -4017,12 +4031,12 @@ var Sr = [
|
|
|
4017
4031
|
overflow: "hidden",
|
|
4018
4032
|
textOverflow: "ellipsis"
|
|
4019
4033
|
},
|
|
4020
|
-
variants:
|
|
4034
|
+
variants: wr,
|
|
4021
4035
|
initial: "initial",
|
|
4022
4036
|
animate: "animate",
|
|
4023
4037
|
exit: "exit",
|
|
4024
|
-
children:
|
|
4025
|
-
variants:
|
|
4038
|
+
children: Cr[M].split("").map((e, t) => /* @__PURE__ */ W(lt.span, {
|
|
4039
|
+
variants: Tr,
|
|
4026
4040
|
style: { display: "inline-block" },
|
|
4027
4041
|
children: e === " " ? "\xA0" : e
|
|
4028
4042
|
}, t))
|
|
@@ -4101,13 +4115,13 @@ var Sr = [
|
|
|
4101
4115
|
})
|
|
4102
4116
|
]
|
|
4103
4117
|
}),
|
|
4104
|
-
/* @__PURE__ */ W(st, { children:
|
|
4118
|
+
/* @__PURE__ */ W(st, { children: ne && de > 0 && /* @__PURE__ */ W(lt.div, {
|
|
4105
4119
|
ref: (e) => {
|
|
4106
4120
|
e && g.current && g.current.contains(e);
|
|
4107
4121
|
},
|
|
4108
4122
|
initial: {
|
|
4109
4123
|
opacity: 0,
|
|
4110
|
-
y:
|
|
4124
|
+
y: ie === "above" ? 4 : -4
|
|
4111
4125
|
},
|
|
4112
4126
|
animate: {
|
|
4113
4127
|
opacity: 1,
|
|
@@ -4115,18 +4129,18 @@ var Sr = [
|
|
|
4115
4129
|
},
|
|
4116
4130
|
exit: {
|
|
4117
4131
|
opacity: 0,
|
|
4118
|
-
y:
|
|
4132
|
+
y: ie === "above" ? 4 : -4
|
|
4119
4133
|
},
|
|
4120
4134
|
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 ${
|
|
4135
|
+
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
4136
|
onMouseDown: (e) => e.preventDefault(),
|
|
4123
4137
|
children: /* @__PURE__ */ G("ul", {
|
|
4124
4138
|
className: "max-h-72 overflow-y-auto custom-scrollbar py-1",
|
|
4125
|
-
children: [
|
|
4139
|
+
children: [ee.map((e, t) => /* @__PURE__ */ W("li", { children: /* @__PURE__ */ G("button", {
|
|
4126
4140
|
type: "button",
|
|
4127
|
-
onMouseEnter: () =>
|
|
4141
|
+
onMouseEnter: () => V(t),
|
|
4128
4142
|
onClick: () => ue(e),
|
|
4129
|
-
className: `w-full text-left px-4 py-1.5 text-[15px] flex items-center gap-3 transition-colors ${t ===
|
|
4143
|
+
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
4144
|
children: [
|
|
4131
4145
|
/* @__PURE__ */ W("span", {
|
|
4132
4146
|
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 +4160,13 @@ var Sr = [
|
|
|
4146
4160
|
children: e.domain
|
|
4147
4161
|
})
|
|
4148
4162
|
]
|
|
4149
|
-
}) }, `domain-${e.domain}`)),
|
|
4150
|
-
let n =
|
|
4163
|
+
}) }, `domain-${e.domain}`)), R.map((e, t) => {
|
|
4164
|
+
let n = ee.length + t;
|
|
4151
4165
|
return /* @__PURE__ */ W("li", { children: /* @__PURE__ */ G("button", {
|
|
4152
4166
|
type: "button",
|
|
4153
|
-
onMouseEnter: () =>
|
|
4167
|
+
onMouseEnter: () => V(n),
|
|
4154
4168
|
onClick: () => le(e),
|
|
4155
|
-
className: `w-full text-left px-4 py-1.5 text-[15px] flex items-center gap-3 transition-colors ${n ===
|
|
4169
|
+
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
4170
|
children: [
|
|
4157
4171
|
/* @__PURE__ */ W("span", {
|
|
4158
4172
|
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 +4194,35 @@ var Sr = [
|
|
|
4180
4194
|
};
|
|
4181
4195
|
//#endregion
|
|
4182
4196
|
//#region src/ui/dialog.tsx
|
|
4183
|
-
function
|
|
4197
|
+
function Dr({ ...e }) {
|
|
4184
4198
|
return /* @__PURE__ */ W(vt.Root, {
|
|
4185
4199
|
"data-slot": "dialog",
|
|
4186
4200
|
...e
|
|
4187
4201
|
});
|
|
4188
4202
|
}
|
|
4189
|
-
function
|
|
4203
|
+
function Or({ ...e }) {
|
|
4190
4204
|
return /* @__PURE__ */ W(vt.Trigger, {
|
|
4191
4205
|
"data-slot": "dialog-trigger",
|
|
4192
4206
|
...e
|
|
4193
4207
|
});
|
|
4194
4208
|
}
|
|
4195
|
-
function
|
|
4209
|
+
function kr({ ...e }) {
|
|
4196
4210
|
return /* @__PURE__ */ W(vt.Portal, {
|
|
4197
4211
|
"data-slot": "dialog-portal",
|
|
4198
4212
|
...e
|
|
4199
4213
|
});
|
|
4200
4214
|
}
|
|
4201
|
-
function
|
|
4215
|
+
function Ar({ className: e, ...t }) {
|
|
4202
4216
|
return /* @__PURE__ */ W(vt.Overlay, {
|
|
4203
4217
|
"data-slot": "dialog-overlay",
|
|
4204
4218
|
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
4219
|
...t
|
|
4206
4220
|
});
|
|
4207
4221
|
}
|
|
4208
|
-
function
|
|
4209
|
-
return /* @__PURE__ */ G(
|
|
4222
|
+
function jr({ className: e, children: t, hideCloseButton: n = !1, ...r }) {
|
|
4223
|
+
return /* @__PURE__ */ G(kr, {
|
|
4210
4224
|
"data-slot": "dialog-portal",
|
|
4211
|
-
children: [/* @__PURE__ */ W(
|
|
4225
|
+
children: [/* @__PURE__ */ W(Ar, {}), /* @__PURE__ */ G(vt.Content, {
|
|
4212
4226
|
"data-slot": "dialog-content",
|
|
4213
4227
|
"aria-describedby": r["aria-describedby"] ?? void 0,
|
|
4214
4228
|
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 +4237,14 @@ function Ar({ className: e, children: t, hideCloseButton: n = !1, ...r }) {
|
|
|
4223
4237
|
})]
|
|
4224
4238
|
});
|
|
4225
4239
|
}
|
|
4226
|
-
function
|
|
4240
|
+
function Mr({ className: e, ...t }) {
|
|
4227
4241
|
return /* @__PURE__ */ W(vt.Title, {
|
|
4228
4242
|
"data-slot": "dialog-title",
|
|
4229
4243
|
className: J("text-lg leading-none font-semibold", e),
|
|
4230
4244
|
...t
|
|
4231
4245
|
});
|
|
4232
4246
|
}
|
|
4233
|
-
function
|
|
4247
|
+
function Nr({ className: e, ...t }) {
|
|
4234
4248
|
return /* @__PURE__ */ W(vt.Description, {
|
|
4235
4249
|
"data-slot": "dialog-description",
|
|
4236
4250
|
className: J("text-muted-foreground text-sm", e),
|
|
@@ -4239,7 +4253,7 @@ function Mr({ className: e, ...t }) {
|
|
|
4239
4253
|
}
|
|
4240
4254
|
//#endregion
|
|
4241
4255
|
//#region src/ui/visually-hidden.tsx
|
|
4242
|
-
var
|
|
4256
|
+
var Pr = n.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ W("span", {
|
|
4243
4257
|
ref: n,
|
|
4244
4258
|
className: J("absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0", e),
|
|
4245
4259
|
style: {
|
|
@@ -4248,17 +4262,17 @@ var Nr = n.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ W("span", {
|
|
|
4248
4262
|
},
|
|
4249
4263
|
...t
|
|
4250
4264
|
}));
|
|
4251
|
-
|
|
4265
|
+
Pr.displayName = "VisuallyHidden";
|
|
4252
4266
|
//#endregion
|
|
4253
4267
|
//#region src/components/ArticleReader/ArticlePanelHeader.tsx
|
|
4254
|
-
var
|
|
4268
|
+
var Fr = ({ onClose: e }) => /* @__PURE__ */ W("div", {
|
|
4255
4269
|
className: "flex items-center justify-between bg-secondary px-4 py-3 border-b border-border",
|
|
4256
4270
|
children: /* @__PURE__ */ W("button", {
|
|
4257
4271
|
onClick: e,
|
|
4258
4272
|
className: "rounded-md p-1 hover:bg-accent transition-colors",
|
|
4259
4273
|
children: /* @__PURE__ */ W(Pe, { className: "h-5 w-5" })
|
|
4260
4274
|
})
|
|
4261
|
-
}),
|
|
4275
|
+
}), 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
4276
|
variants: {
|
|
4263
4277
|
variant: {
|
|
4264
4278
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
@@ -4280,10 +4294,10 @@ var Pr = ({ onClose: e }) => /* @__PURE__ */ W("div", {
|
|
|
4280
4294
|
size: "default"
|
|
4281
4295
|
}
|
|
4282
4296
|
});
|
|
4283
|
-
function
|
|
4297
|
+
function Lr({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
4284
4298
|
return /* @__PURE__ */ W(r ? ht : "button", {
|
|
4285
4299
|
"data-slot": "button",
|
|
4286
|
-
className: J(
|
|
4300
|
+
className: J(Ir({
|
|
4287
4301
|
variant: t,
|
|
4288
4302
|
size: n,
|
|
4289
4303
|
className: e
|
|
@@ -4293,10 +4307,10 @@ function Ir({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
|
4293
4307
|
}
|
|
4294
4308
|
//#endregion
|
|
4295
4309
|
//#region src/components/ArticleReader/ArticleActionButtons.tsx
|
|
4296
|
-
var
|
|
4310
|
+
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
4311
|
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
4312
|
children: [
|
|
4299
|
-
/* @__PURE__ */ G(
|
|
4313
|
+
/* @__PURE__ */ G(Lr, {
|
|
4300
4314
|
onClick: o,
|
|
4301
4315
|
disabled: e,
|
|
4302
4316
|
variant: "ghost",
|
|
@@ -4307,7 +4321,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4307
4321
|
children: e ? "..." : "Ask"
|
|
4308
4322
|
})]
|
|
4309
4323
|
}),
|
|
4310
|
-
/* @__PURE__ */ G(
|
|
4324
|
+
/* @__PURE__ */ G(Lr, {
|
|
4311
4325
|
onClick: s,
|
|
4312
4326
|
disabled: t,
|
|
4313
4327
|
variant: "ghost",
|
|
@@ -4318,15 +4332,15 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4318
4332
|
children: "Suggest"
|
|
4319
4333
|
})]
|
|
4320
4334
|
}),
|
|
4321
|
-
/* @__PURE__ */ W(
|
|
4335
|
+
/* @__PURE__ */ W(Lr, {
|
|
4322
4336
|
onClick: c,
|
|
4323
4337
|
variant: "ghost",
|
|
4324
4338
|
size: "icon",
|
|
4325
|
-
className:
|
|
4339
|
+
className: Rr,
|
|
4326
4340
|
title: "Copy article",
|
|
4327
4341
|
children: /* @__PURE__ */ W(F, { className: "size-4" })
|
|
4328
4342
|
}),
|
|
4329
|
-
/* @__PURE__ */ W(
|
|
4343
|
+
/* @__PURE__ */ W(Lr, {
|
|
4330
4344
|
onClick: u,
|
|
4331
4345
|
variant: "ghost",
|
|
4332
4346
|
size: "icon",
|
|
@@ -4334,7 +4348,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4334
4348
|
title: i ? "Disable highlighting" : "Enable highlighting",
|
|
4335
4349
|
children: /* @__PURE__ */ W(le, { className: "size-4" })
|
|
4336
4350
|
}),
|
|
4337
|
-
/* @__PURE__ */ W(
|
|
4351
|
+
/* @__PURE__ */ W(Lr, {
|
|
4338
4352
|
onClick: l,
|
|
4339
4353
|
disabled: n,
|
|
4340
4354
|
variant: "ghost",
|
|
@@ -4343,29 +4357,29 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4343
4357
|
title: r ? "Remove from favorites" : "Add to favorites",
|
|
4344
4358
|
children: /* @__PURE__ */ W(Ee, { className: J("size-4", r && "fill-yellow-400") })
|
|
4345
4359
|
}),
|
|
4346
|
-
a && /* @__PURE__ */ W(
|
|
4360
|
+
a && /* @__PURE__ */ W(Lr, {
|
|
4347
4361
|
asChild: !0,
|
|
4348
4362
|
variant: "ghost",
|
|
4349
4363
|
size: "icon",
|
|
4350
|
-
className:
|
|
4364
|
+
className: Rr,
|
|
4351
4365
|
title: "Open in new tab",
|
|
4352
4366
|
children: /* @__PURE__ */ W("a", {
|
|
4353
4367
|
href: a,
|
|
4354
4368
|
target: "_blank",
|
|
4355
4369
|
rel: "noopener noreferrer",
|
|
4356
|
-
children: /* @__PURE__ */ W(
|
|
4370
|
+
children: /* @__PURE__ */ W(V, { className: "size-4" })
|
|
4357
4371
|
})
|
|
4358
4372
|
}),
|
|
4359
|
-
/* @__PURE__ */ W(
|
|
4373
|
+
/* @__PURE__ */ W(Lr, {
|
|
4360
4374
|
onClick: d,
|
|
4361
4375
|
variant: "ghost",
|
|
4362
4376
|
size: "icon",
|
|
4363
|
-
className: J(
|
|
4377
|
+
className: J(Rr, "ml-auto"),
|
|
4364
4378
|
title: "Close",
|
|
4365
4379
|
children: /* @__PURE__ */ W(Pe, { className: "size-4" })
|
|
4366
4380
|
})
|
|
4367
4381
|
]
|
|
4368
|
-
}),
|
|
4382
|
+
}), Br = ({ value: e, onChange: t, onSubmit: n }) => /* @__PURE__ */ W("div", {
|
|
4369
4383
|
className: "relative",
|
|
4370
4384
|
children: /* @__PURE__ */ W("input", {
|
|
4371
4385
|
value: e,
|
|
@@ -4375,7 +4389,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4375
4389
|
placeholder: "Ask AI any question...",
|
|
4376
4390
|
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
4391
|
})
|
|
4378
|
-
}),
|
|
4392
|
+
}), Vr = ({ questions: e, isLoading: n, error: i, onQuestionClick: a }) => {
|
|
4379
4393
|
let o = r.useMemo(() => {
|
|
4380
4394
|
let t = [];
|
|
4381
4395
|
return e.forEach((e) => {
|
|
@@ -4412,7 +4426,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4412
4426
|
children: i
|
|
4413
4427
|
})
|
|
4414
4428
|
] });
|
|
4415
|
-
},
|
|
4429
|
+
}, Hr = ({ response: e, isLoading: t, error: n }) => /* @__PURE__ */ G(U, { children: [
|
|
4416
4430
|
t && /* @__PURE__ */ W("div", {
|
|
4417
4431
|
className: "flex justify-center",
|
|
4418
4432
|
children: /* @__PURE__ */ W("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" })
|
|
@@ -4426,7 +4440,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4426
4440
|
className: "bg-red-500 text-white p-2 rounded-md text-sm",
|
|
4427
4441
|
children: n
|
|
4428
4442
|
})
|
|
4429
|
-
] }),
|
|
4443
|
+
] }), Ur = ({ html: e, isHighlightMode: t = !1 }) => {
|
|
4430
4444
|
let [n, r] = p("");
|
|
4431
4445
|
return u(() => {
|
|
4432
4446
|
r(yt.sanitize(e || "", {
|
|
@@ -4437,7 +4451,7 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4437
4451
|
className: `prose prose-neutral dark:prose-invert max-w-none ${t ? "select-text" : ""}`,
|
|
4438
4452
|
dangerouslySetInnerHTML: { __html: n }
|
|
4439
4453
|
});
|
|
4440
|
-
},
|
|
4454
|
+
}, Wr = ({ article: e, isHighlightMode: t }) => /* @__PURE__ */ W("div", {
|
|
4441
4455
|
className: "border-t border-border pt-6",
|
|
4442
4456
|
children: /* @__PURE__ */ G("div", { children: [
|
|
4443
4457
|
/* @__PURE__ */ W("div", { className: "flex items-start justify-between mb-2" }),
|
|
@@ -4458,23 +4472,23 @@ var Lr = J("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4458
4472
|
}),
|
|
4459
4473
|
/* @__PURE__ */ W("div", {
|
|
4460
4474
|
id: "article-content",
|
|
4461
|
-
children: /* @__PURE__ */ W(
|
|
4475
|
+
children: /* @__PURE__ */ W(Ur, {
|
|
4462
4476
|
html: e.html || "",
|
|
4463
4477
|
isHighlightMode: t
|
|
4464
4478
|
})
|
|
4465
4479
|
})
|
|
4466
4480
|
] })
|
|
4467
|
-
}),
|
|
4468
|
-
function
|
|
4481
|
+
}), 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;
|
|
4482
|
+
function qr(e) {
|
|
4469
4483
|
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
4484
|
}
|
|
4471
|
-
function
|
|
4485
|
+
function Jr(e) {
|
|
4472
4486
|
return /^https?:\/\//i.test(e) ? e : `https://${e}`;
|
|
4473
4487
|
}
|
|
4474
|
-
function
|
|
4488
|
+
function Yr(e) {
|
|
4475
4489
|
if (!e || typeof e != "string") return e;
|
|
4476
4490
|
let t = e, n = [], r;
|
|
4477
|
-
for (
|
|
4491
|
+
for (Kr.lastIndex = 0; (r = Kr.exec(t)) !== null;) {
|
|
4478
4492
|
let e = r[0], i = r.index, a = t.substring(0, i), o = t.substring(i + e.length);
|
|
4479
4493
|
!a.endsWith("](") && !o.startsWith(")") && n.push({
|
|
4480
4494
|
email: e,
|
|
@@ -4486,9 +4500,9 @@ function Jr(e) {
|
|
|
4486
4500
|
t = t.substring(0, i) + `[${r}](mailto:${r})` + t.substring(i + r.length);
|
|
4487
4501
|
}
|
|
4488
4502
|
let i = [], a;
|
|
4489
|
-
for (
|
|
4503
|
+
for (Gr.lastIndex = 0; (a = Gr.exec(t)) !== null;) {
|
|
4490
4504
|
let e = a[0], n = a.index;
|
|
4491
|
-
if (
|
|
4505
|
+
if (Kr.test(e)) continue;
|
|
4492
4506
|
let r = t.substring(0, n), o = t.substring(n + e.length);
|
|
4493
4507
|
if (r.endsWith("](") || o.startsWith(")") || (r.match(/```/g) || []).length % 2 != 0) continue;
|
|
4494
4508
|
let s = r.lastIndexOf("`");
|
|
@@ -4496,23 +4510,23 @@ function Jr(e) {
|
|
|
4496
4510
|
let e = t.substring(s + 1).indexOf("`");
|
|
4497
4511
|
if (e !== -1 && e > n - s - 1) continue;
|
|
4498
4512
|
}
|
|
4499
|
-
|
|
4513
|
+
qr(e) && i.push({
|
|
4500
4514
|
url: e,
|
|
4501
4515
|
index: n
|
|
4502
4516
|
});
|
|
4503
4517
|
}
|
|
4504
4518
|
for (let e = i.length - 1; e >= 0; e--) {
|
|
4505
|
-
let { url: n, index: r } = i[e], a =
|
|
4519
|
+
let { url: n, index: r } = i[e], a = Jr(n);
|
|
4506
4520
|
t = t.substring(0, r) + `[${n}](${a})` + t.substring(r + n.length);
|
|
4507
4521
|
}
|
|
4508
4522
|
return t;
|
|
4509
4523
|
}
|
|
4510
4524
|
//#endregion
|
|
4511
4525
|
//#region src/components/ArticleReader/unified-markdown.tsx
|
|
4512
|
-
function
|
|
4526
|
+
function Xr(e) {
|
|
4513
4527
|
return !e || e.startsWith("http://") || e.startsWith("https://") || e.includes("://") ? !1 : e.startsWith("/") || e.startsWith("#");
|
|
4514
4528
|
}
|
|
4515
|
-
function
|
|
4529
|
+
function Zr(e, t) {
|
|
4516
4530
|
if (t.startsWith("#")) {
|
|
4517
4531
|
e.preventDefault();
|
|
4518
4532
|
let n = t.substring(1), r = document.getElementById(n);
|
|
@@ -4522,7 +4536,7 @@ function Xr(e, t) {
|
|
|
4522
4536
|
});
|
|
4523
4537
|
}
|
|
4524
4538
|
}
|
|
4525
|
-
function
|
|
4539
|
+
function Qr({ code: e }) {
|
|
4526
4540
|
let [t, n] = p(!1);
|
|
4527
4541
|
return /* @__PURE__ */ W("button", {
|
|
4528
4542
|
onClick: c(async () => {
|
|
@@ -4534,10 +4548,10 @@ function Zr({ code: e }) {
|
|
|
4534
4548
|
}, [e]),
|
|
4535
4549
|
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
4550
|
"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(
|
|
4551
|
+
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
4552
|
});
|
|
4539
4553
|
}
|
|
4540
|
-
function
|
|
4554
|
+
function $r({ children: e }) {
|
|
4541
4555
|
let t = f(null), [n, r] = p("");
|
|
4542
4556
|
return u(() => {
|
|
4543
4557
|
if (t.current) {
|
|
@@ -4553,15 +4567,15 @@ function Qr({ children: e }) {
|
|
|
4553
4567
|
ref: t,
|
|
4554
4568
|
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
4569
|
children: e
|
|
4556
|
-
}), n && /* @__PURE__ */ W(
|
|
4570
|
+
}), n && /* @__PURE__ */ W(Qr, { code: n })]
|
|
4557
4571
|
});
|
|
4558
4572
|
}
|
|
4559
|
-
var
|
|
4573
|
+
var ei = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
4560
4574
|
if (!e) return /* @__PURE__ */ W("div", {
|
|
4561
4575
|
className: J("text-muted-foreground text-sm", t),
|
|
4562
4576
|
children: "No content"
|
|
4563
4577
|
});
|
|
4564
|
-
let r =
|
|
4578
|
+
let r = Yr(e);
|
|
4565
4579
|
return /* @__PURE__ */ W("div", {
|
|
4566
4580
|
className: J("kortix-markdown", t),
|
|
4567
4581
|
children: /* @__PURE__ */ W(xt, {
|
|
@@ -4608,10 +4622,10 @@ var $r = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4608
4622
|
children: e
|
|
4609
4623
|
}),
|
|
4610
4624
|
a: ({ href: e, children: t }) => {
|
|
4611
|
-
let n =
|
|
4625
|
+
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
4626
|
return r ? /* @__PURE__ */ W("a", {
|
|
4613
4627
|
href: e,
|
|
4614
|
-
onClick: (t) =>
|
|
4628
|
+
onClick: (t) => Zr(t, e),
|
|
4615
4629
|
className: i,
|
|
4616
4630
|
children: t
|
|
4617
4631
|
}) : n ? /* @__PURE__ */ W(bt, {
|
|
@@ -4633,7 +4647,7 @@ var $r = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4633
4647
|
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
4648
|
children: e
|
|
4635
4649
|
}),
|
|
4636
|
-
pre: ({ children: e }) => /* @__PURE__ */ W(
|
|
4650
|
+
pre: ({ children: e }) => /* @__PURE__ */ W($r, { children: e }),
|
|
4637
4651
|
blockquote: ({ children: e }) => /* @__PURE__ */ W("blockquote", {
|
|
4638
4652
|
className: J("my-5 pl-4 py-1 text-sm", "border-l-2 border-border", "text-muted-foreground", "[&>p]:my-2"),
|
|
4639
4653
|
children: e
|
|
@@ -4714,28 +4728,28 @@ var $r = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4714
4728
|
})
|
|
4715
4729
|
});
|
|
4716
4730
|
});
|
|
4717
|
-
|
|
4731
|
+
ei.displayName = "UnifiedMarkdown";
|
|
4718
4732
|
//#endregion
|
|
4719
4733
|
//#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 } =
|
|
4734
|
+
var ti = (e) => {
|
|
4735
|
+
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
4736
|
u(() => {
|
|
4723
4737
|
let e = () => {
|
|
4724
|
-
|
|
4738
|
+
re(window.innerWidth >= 1024);
|
|
4725
4739
|
};
|
|
4726
4740
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
4727
4741
|
}, []), u(() => {
|
|
4728
4742
|
let e = (e) => {
|
|
4729
|
-
if (!
|
|
4743
|
+
if (!oe) return;
|
|
4730
4744
|
let t = window.innerWidth - e.clientX, n = Math.max(400, Math.min(t, window.innerWidth - 100));
|
|
4731
|
-
|
|
4745
|
+
ae(n), o(n);
|
|
4732
4746
|
}, t = () => {
|
|
4733
4747
|
se(!1);
|
|
4734
4748
|
};
|
|
4735
|
-
return
|
|
4749
|
+
return oe && (document.addEventListener("mousemove", e), document.addEventListener("mouseup", t), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none"), () => {
|
|
4736
4750
|
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", t), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
4737
4751
|
};
|
|
4738
|
-
}, [
|
|
4752
|
+
}, [oe, o]), u(() => {
|
|
4739
4753
|
l && m ? (le(!1), de()) : l || le(!1);
|
|
4740
4754
|
}, [l, m]);
|
|
4741
4755
|
let de = async () => {
|
|
@@ -4776,15 +4790,15 @@ var ei = (e) => {
|
|
|
4776
4790
|
}, H = async () => {
|
|
4777
4791
|
try {
|
|
4778
4792
|
let { data: e } = await Qe(), t = e?.favorites?.some((e) => e.url === m);
|
|
4779
|
-
|
|
4793
|
+
z(!!t);
|
|
4780
4794
|
} catch (e) {
|
|
4781
4795
|
console.error("Error checking favorite status:", e);
|
|
4782
4796
|
}
|
|
4783
4797
|
}, fe = async () => {
|
|
4784
4798
|
if (g) {
|
|
4785
|
-
|
|
4799
|
+
te(!0);
|
|
4786
4800
|
try {
|
|
4787
|
-
|
|
4801
|
+
R ? (await et({ query: { url: m } }), z(!1), K.info("Removed from favorites")) : (await Ie({ body: {
|
|
4788
4802
|
url: g.url || m,
|
|
4789
4803
|
title: g.title,
|
|
4790
4804
|
cite: g.cite,
|
|
@@ -4794,16 +4808,16 @@ var ei = (e) => {
|
|
|
4794
4808
|
source: g.source,
|
|
4795
4809
|
word_count: g.word_count,
|
|
4796
4810
|
html: g.html
|
|
4797
|
-
} }),
|
|
4811
|
+
} }), z(!0), K.success("Added to favorites"));
|
|
4798
4812
|
} catch (e) {
|
|
4799
4813
|
console.error("Error toggling favorite:", e), K.error("Failed to toggle favorite");
|
|
4800
4814
|
} finally {
|
|
4801
|
-
|
|
4815
|
+
te(!1);
|
|
4802
4816
|
}
|
|
4803
4817
|
}
|
|
4804
4818
|
}, pe = async (e) => {
|
|
4805
4819
|
if (!g) return;
|
|
4806
|
-
let n = g.html?.replace(/<[^>]*>?/g, "").slice(0, t.maxArticleLength), r = e === "question", i = r ? D : k, a = r ? N :
|
|
4820
|
+
let n = g.html?.replace(/<[^>]*>?/g, "").slice(0, t.maxArticleLength), r = e === "question", i = r ? D : k, a = r ? N : L;
|
|
4807
4821
|
i(!0), a("");
|
|
4808
4822
|
try {
|
|
4809
4823
|
if (r) {
|
|
@@ -4880,30 +4894,30 @@ var ei = (e) => {
|
|
|
4880
4894
|
children: [/* @__PURE__ */ G("div", {
|
|
4881
4895
|
className: "space-y-4",
|
|
4882
4896
|
children: [
|
|
4883
|
-
/* @__PURE__ */ W(
|
|
4897
|
+
/* @__PURE__ */ W(zr, {
|
|
4884
4898
|
isLoadingAI: E,
|
|
4885
4899
|
isLoadingFollowups: O,
|
|
4886
|
-
isLoadingFavorite:
|
|
4887
|
-
isFavorited:
|
|
4888
|
-
isHighlightMode:
|
|
4900
|
+
isLoadingFavorite: ee,
|
|
4901
|
+
isFavorited: R,
|
|
4902
|
+
isHighlightMode: B,
|
|
4889
4903
|
articleUrl: g?.url || m,
|
|
4890
4904
|
onAskClick: () => pe("question"),
|
|
4891
4905
|
onSuggestClick: () => pe("suggest-followups"),
|
|
4892
4906
|
onCopyClick: he,
|
|
4893
4907
|
onFavoriteClick: fe,
|
|
4894
|
-
onHighlightToggle: () =>
|
|
4908
|
+
onHighlightToggle: () => V(!B),
|
|
4895
4909
|
onClose: d
|
|
4896
4910
|
}),
|
|
4897
4911
|
b && /* @__PURE__ */ W("div", {
|
|
4898
4912
|
className: "bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg",
|
|
4899
4913
|
children: "Copied!"
|
|
4900
4914
|
}),
|
|
4901
|
-
/* @__PURE__ */ W(
|
|
4915
|
+
/* @__PURE__ */ W(Br, {
|
|
4902
4916
|
value: S,
|
|
4903
4917
|
onChange: C,
|
|
4904
4918
|
onSubmit: () => pe("question")
|
|
4905
4919
|
}),
|
|
4906
|
-
/* @__PURE__ */ W(
|
|
4920
|
+
/* @__PURE__ */ W(Vr, {
|
|
4907
4921
|
questions: P,
|
|
4908
4922
|
isLoading: O,
|
|
4909
4923
|
error: I,
|
|
@@ -4934,7 +4948,7 @@ var ei = (e) => {
|
|
|
4934
4948
|
})
|
|
4935
4949
|
}, t))
|
|
4936
4950
|
}),
|
|
4937
|
-
(E || A && v.length === 0) && /* @__PURE__ */ W(
|
|
4951
|
+
(E || A && v.length === 0) && /* @__PURE__ */ W(Hr, {
|
|
4938
4952
|
response: A,
|
|
4939
4953
|
isLoading: E,
|
|
4940
4954
|
error: M
|
|
@@ -4944,16 +4958,16 @@ var ei = (e) => {
|
|
|
4944
4958
|
children: M
|
|
4945
4959
|
})
|
|
4946
4960
|
]
|
|
4947
|
-
}), g && /* @__PURE__ */ W(
|
|
4961
|
+
}), g && /* @__PURE__ */ W(Wr, {
|
|
4948
4962
|
article: g,
|
|
4949
|
-
isHighlightMode:
|
|
4963
|
+
isHighlightMode: B
|
|
4950
4964
|
})]
|
|
4951
4965
|
})
|
|
4952
4966
|
})
|
|
4953
4967
|
});
|
|
4954
|
-
return !l || !ce ? null :
|
|
4968
|
+
return !l || !ce ? null : ne ? /* @__PURE__ */ G("div", {
|
|
4955
4969
|
className: "fixed top-0 right-0 h-screen z-40 transition-all duration-300",
|
|
4956
|
-
style: { width: `${
|
|
4970
|
+
style: { width: `${ie}px` },
|
|
4957
4971
|
children: [/* @__PURE__ */ W("div", {
|
|
4958
4972
|
ref: ue,
|
|
4959
4973
|
onMouseDown: () => se(!0),
|
|
@@ -4961,20 +4975,20 @@ var ei = (e) => {
|
|
|
4961
4975
|
style: { touchAction: "none" },
|
|
4962
4976
|
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
4977
|
}), ge()]
|
|
4964
|
-
}) : /* @__PURE__ */ W(
|
|
4978
|
+
}) : /* @__PURE__ */ W(Dr, {
|
|
4965
4979
|
open: l,
|
|
4966
4980
|
onOpenChange: (e) => !e && d(),
|
|
4967
|
-
children: /* @__PURE__ */ G(
|
|
4981
|
+
children: /* @__PURE__ */ G(jr, {
|
|
4968
4982
|
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
4983
|
hideCloseButton: !0,
|
|
4970
|
-
children: [/* @__PURE__ */ W(
|
|
4984
|
+
children: [/* @__PURE__ */ W(Pr, { children: /* @__PURE__ */ W(Mr, { children: "Article Details" }) }), /* @__PURE__ */ W("div", {
|
|
4971
4985
|
className: "h-full overflow-y-auto",
|
|
4972
4986
|
children: ge()
|
|
4973
4987
|
})]
|
|
4974
4988
|
})
|
|
4975
4989
|
});
|
|
4976
|
-
},
|
|
4977
|
-
let { sections: e, chatTurns: n, loading: r, messageAppeared: a, newChat: o, chatId: s } =
|
|
4990
|
+
}, ni = () => {
|
|
4991
|
+
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
4992
|
return u(() => {
|
|
4979
4993
|
let e = () => {
|
|
4980
4994
|
h(window.innerWidth >= 1024);
|
|
@@ -4995,7 +5009,7 @@ var ei = (e) => {
|
|
|
4995
5009
|
children: [
|
|
4996
5010
|
e.map((t, n) => {
|
|
4997
5011
|
let r = n === e.length - 1;
|
|
4998
|
-
return /* @__PURE__ */ G(i, { children: [/* @__PURE__ */ W(
|
|
5012
|
+
return /* @__PURE__ */ G(i, { children: [/* @__PURE__ */ W(ir, {
|
|
4999
5013
|
section: t,
|
|
5000
5014
|
sectionIndex: n,
|
|
5001
5015
|
dividerRef: r ? g : void 0,
|
|
@@ -5026,13 +5040,13 @@ var ei = (e) => {
|
|
|
5026
5040
|
]
|
|
5027
5041
|
}), /* @__PURE__ */ W("div", {
|
|
5028
5042
|
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(
|
|
5043
|
+
children: /* @__PURE__ */ W(Er, {})
|
|
5030
5044
|
})]
|
|
5031
|
-
}), /* @__PURE__ */ W(
|
|
5045
|
+
}), /* @__PURE__ */ W(ti, {})] });
|
|
5032
5046
|
};
|
|
5033
5047
|
//#endregion
|
|
5034
5048
|
//#region src/ui/gradient-blur.tsx
|
|
5035
|
-
function
|
|
5049
|
+
function ri({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "transparent", color: r, colorGenerator: i }) {
|
|
5036
5050
|
let a = f(null), o = f({
|
|
5037
5051
|
x: 0,
|
|
5038
5052
|
y: 0
|
|
@@ -5092,28 +5106,28 @@ function ni({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "tran
|
|
|
5092
5106
|
}
|
|
5093
5107
|
//#endregion
|
|
5094
5108
|
//#region src/components/ChatHistoryDropdown/useHistoryState.ts
|
|
5095
|
-
var
|
|
5096
|
-
function
|
|
5109
|
+
var ii = "qwksearch_pinned_chats";
|
|
5110
|
+
function ai() {
|
|
5097
5111
|
if (typeof window > "u") return [];
|
|
5098
5112
|
try {
|
|
5099
|
-
let e = localStorage.getItem(
|
|
5113
|
+
let e = localStorage.getItem(ii);
|
|
5100
5114
|
return e ? JSON.parse(e) : [];
|
|
5101
5115
|
} catch {
|
|
5102
5116
|
return [];
|
|
5103
5117
|
}
|
|
5104
5118
|
}
|
|
5105
|
-
function
|
|
5106
|
-
typeof window > "u" || localStorage.setItem(
|
|
5119
|
+
function oi(e) {
|
|
5120
|
+
typeof window > "u" || localStorage.setItem(ii, JSON.stringify(e));
|
|
5107
5121
|
}
|
|
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 } =
|
|
5122
|
+
function si() {
|
|
5123
|
+
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
5124
|
u(() => {
|
|
5111
|
-
y(
|
|
5125
|
+
y(ai());
|
|
5112
5126
|
}, []);
|
|
5113
5127
|
let A = c((e, t) => {
|
|
5114
5128
|
e.preventDefault(), e.stopPropagation(), y((e) => {
|
|
5115
5129
|
let n = e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
|
|
5116
|
-
return
|
|
5130
|
+
return oi(n), n;
|
|
5117
5131
|
});
|
|
5118
5132
|
}, []), j = d(() => [...e].sort((e, t) => {
|
|
5119
5133
|
let n = v.includes(e.id), r = v.includes(t.id);
|
|
@@ -5174,7 +5188,7 @@ function oi() {
|
|
|
5174
5188
|
}
|
|
5175
5189
|
}, I = () => {
|
|
5176
5190
|
h(!0);
|
|
5177
|
-
},
|
|
5191
|
+
}, L = async () => {
|
|
5178
5192
|
_(!0);
|
|
5179
5193
|
try {
|
|
5180
5194
|
if (E) {
|
|
@@ -5187,9 +5201,9 @@ function oi() {
|
|
|
5187
5201
|
} finally {
|
|
5188
5202
|
h(!1), _(!1);
|
|
5189
5203
|
}
|
|
5190
|
-
},
|
|
5204
|
+
}, R = () => {
|
|
5191
5205
|
k(!O), K.success(O ? "Private mode off" : "Private mode on — messages won't be saved");
|
|
5192
|
-
},
|
|
5206
|
+
}, z = c(async (e) => {
|
|
5193
5207
|
if (!e.trim()) {
|
|
5194
5208
|
C([]), T(!1);
|
|
5195
5209
|
return;
|
|
@@ -5218,10 +5232,10 @@ function oi() {
|
|
|
5218
5232
|
}, [E]);
|
|
5219
5233
|
return u(() => {
|
|
5220
5234
|
let e = setTimeout(() => {
|
|
5221
|
-
|
|
5235
|
+
z(b);
|
|
5222
5236
|
}, 300);
|
|
5223
5237
|
return () => clearTimeout(e);
|
|
5224
|
-
}, [b,
|
|
5238
|
+
}, [b, z]), {
|
|
5225
5239
|
chats: e,
|
|
5226
5240
|
sortedChats: j,
|
|
5227
5241
|
displayChats: M,
|
|
@@ -5229,7 +5243,7 @@ function oi() {
|
|
|
5229
5243
|
pinnedIds: v,
|
|
5230
5244
|
togglePin: A,
|
|
5231
5245
|
incognito: O,
|
|
5232
|
-
toggleIncognito:
|
|
5246
|
+
toggleIncognito: R,
|
|
5233
5247
|
searchQuery: b,
|
|
5234
5248
|
searchResults: S,
|
|
5235
5249
|
searching: w,
|
|
@@ -5247,12 +5261,12 @@ function oi() {
|
|
|
5247
5261
|
setClearAllDialogOpen: h,
|
|
5248
5262
|
clearingAll: g,
|
|
5249
5263
|
handleClearAllClick: I,
|
|
5250
|
-
handleConfirmClearAll:
|
|
5264
|
+
handleConfirmClearAll: L
|
|
5251
5265
|
};
|
|
5252
5266
|
}
|
|
5253
5267
|
//#endregion
|
|
5254
5268
|
//#region src/components/ChatHistoryDropdown/HistoryHeader.tsx
|
|
5255
|
-
function
|
|
5269
|
+
function ci({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r, searchQuery: i, onSearchChange: a }) {
|
|
5256
5270
|
return /* @__PURE__ */ G("div", {
|
|
5257
5271
|
className: "mb-2 pb-2 border-b border-border space-y-2",
|
|
5258
5272
|
children: [/* @__PURE__ */ G("div", {
|
|
@@ -5299,7 +5313,7 @@ function si({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r
|
|
|
5299
5313
|
}
|
|
5300
5314
|
//#endregion
|
|
5301
5315
|
//#region src/components/ChatHistoryDropdown/HistoryChatItem.tsx
|
|
5302
|
-
function
|
|
5316
|
+
function li({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
|
|
5303
5317
|
let i = e.messageCount ?? 0;
|
|
5304
5318
|
return /* @__PURE__ */ G("div", {
|
|
5305
5319
|
className: "group flex items-center gap-1 px-2 py-1 rounded-lg hover:bg-secondary transition-colors duration-200",
|
|
@@ -5309,10 +5323,10 @@ function ci({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
|
|
|
5309
5323
|
className: "flex-1 min-w-0 flex items-center gap-1.5",
|
|
5310
5324
|
children: [/* @__PURE__ */ G("span", {
|
|
5311
5325
|
className: "flex items-center gap-1 shrink-0",
|
|
5312
|
-
children: [i > 0 && /* @__PURE__ */ G(
|
|
5326
|
+
children: [i > 0 && /* @__PURE__ */ G(nr, {
|
|
5313
5327
|
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
5328
|
children: [i, "Q"]
|
|
5315
|
-
}), /* @__PURE__ */ W(
|
|
5329
|
+
}), /* @__PURE__ */ W(nr, {
|
|
5316
5330
|
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
5331
|
children: St(/* @__PURE__ */ new Date(), e.createdAt)
|
|
5318
5332
|
})]
|
|
@@ -5341,20 +5355,20 @@ function ci({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
|
|
|
5341
5355
|
}
|
|
5342
5356
|
//#endregion
|
|
5343
5357
|
//#region src/components/ChatHistoryDropdown/HistoryDialogs.tsx
|
|
5344
|
-
function
|
|
5345
|
-
return /* @__PURE__ */ W(
|
|
5358
|
+
function ui({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i, loadingLabel: a, loading: o, onConfirm: s }) {
|
|
5359
|
+
return /* @__PURE__ */ W(Dr, {
|
|
5346
5360
|
open: e,
|
|
5347
5361
|
onOpenChange: (e) => {
|
|
5348
5362
|
!e && !o && t(!1);
|
|
5349
5363
|
},
|
|
5350
|
-
children: /* @__PURE__ */ G(
|
|
5364
|
+
children: /* @__PURE__ */ G(jr, {
|
|
5351
5365
|
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
5366
|
children: [
|
|
5353
|
-
/* @__PURE__ */ W(
|
|
5367
|
+
/* @__PURE__ */ W(Mr, {
|
|
5354
5368
|
className: "text-lg font-medium leading-6 dark:text-white",
|
|
5355
5369
|
children: n
|
|
5356
5370
|
}),
|
|
5357
|
-
/* @__PURE__ */ W(
|
|
5371
|
+
/* @__PURE__ */ W(Nr, {
|
|
5358
5372
|
className: "text-sm dark:text-white/70 text-black/70 mt-2",
|
|
5359
5373
|
children: r
|
|
5360
5374
|
}),
|
|
@@ -5377,8 +5391,8 @@ function li({ open: e, onOpenChange: t, title: n, description: r, confirmLabel:
|
|
|
5377
5391
|
})
|
|
5378
5392
|
});
|
|
5379
5393
|
}
|
|
5380
|
-
function
|
|
5381
|
-
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(
|
|
5394
|
+
function di({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setChatToDelete: r, deleting: i, onConfirmDelete: a, clearAllDialogOpen: o, setClearAllDialogOpen: s, clearingAll: c, onConfirmClearAll: l }) {
|
|
5395
|
+
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(ui, {
|
|
5382
5396
|
open: e,
|
|
5383
5397
|
onOpenChange: (e) => {
|
|
5384
5398
|
t(e), e || r(null);
|
|
@@ -5389,7 +5403,7 @@ function ui({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
|
|
|
5389
5403
|
loadingLabel: "Deleting...",
|
|
5390
5404
|
loading: i,
|
|
5391
5405
|
onConfirm: a
|
|
5392
|
-
}), /* @__PURE__ */ W(
|
|
5406
|
+
}), /* @__PURE__ */ W(ui, {
|
|
5393
5407
|
open: o,
|
|
5394
5408
|
onOpenChange: s,
|
|
5395
5409
|
title: "Clear All History",
|
|
@@ -5402,13 +5416,13 @@ function ui({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
|
|
|
5402
5416
|
}
|
|
5403
5417
|
//#endregion
|
|
5404
5418
|
//#region src/components/ChatHistoryDropdown/HistoryDropdown.tsx
|
|
5405
|
-
var
|
|
5419
|
+
var fi = {
|
|
5406
5420
|
Today: /* @__PURE__ */ W(Oe, { size: 12 }),
|
|
5407
|
-
Yesterday: /* @__PURE__ */ W(
|
|
5421
|
+
Yesterday: /* @__PURE__ */ W(L, { size: 12 }),
|
|
5408
5422
|
"This Week": /* @__PURE__ */ W(O, { size: 12 }),
|
|
5409
5423
|
Older: /* @__PURE__ */ W(S, { size: 12 })
|
|
5410
5424
|
};
|
|
5411
|
-
function
|
|
5425
|
+
function pi(e) {
|
|
5412
5426
|
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
5427
|
Today: [],
|
|
5414
5428
|
Yesterday: [],
|
|
@@ -5429,19 +5443,19 @@ function fi(e) {
|
|
|
5429
5443
|
chats: a[e]
|
|
5430
5444
|
}));
|
|
5431
5445
|
}
|
|
5432
|
-
var
|
|
5433
|
-
let t =
|
|
5434
|
-
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(
|
|
5446
|
+
var mi = ({ showLabel: e = !1 }) => {
|
|
5447
|
+
let t = si();
|
|
5448
|
+
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(Dr, { children: [/* @__PURE__ */ G(Or, {
|
|
5435
5449
|
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
5450
|
children: [/* @__PURE__ */ W(ue, { size: e ? 14 : 18 }), e && /* @__PURE__ */ W("span", { children: "History" })]
|
|
5437
|
-
}), /* @__PURE__ */ G(
|
|
5451
|
+
}), /* @__PURE__ */ G(jr, {
|
|
5438
5452
|
className: "max-w-[420px] p-3",
|
|
5439
5453
|
children: [
|
|
5440
|
-
/* @__PURE__ */ W(
|
|
5454
|
+
/* @__PURE__ */ W(Mr, {
|
|
5441
5455
|
className: "sr-only",
|
|
5442
5456
|
children: "Chat History"
|
|
5443
5457
|
}),
|
|
5444
|
-
/* @__PURE__ */ W(
|
|
5458
|
+
/* @__PURE__ */ W(ci, {
|
|
5445
5459
|
incognito: t.incognito,
|
|
5446
5460
|
onToggleIncognito: t.toggleIncognito,
|
|
5447
5461
|
showClearAll: t.chats.length > 0 && !t.loading,
|
|
@@ -5479,15 +5493,15 @@ var pi = ({ showLabel: e = !1 }) => {
|
|
|
5479
5493
|
})
|
|
5480
5494
|
}) : /* @__PURE__ */ W("div", {
|
|
5481
5495
|
className: "space-y-1 max-h-[500px] overflow-y-auto",
|
|
5482
|
-
children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ W(
|
|
5496
|
+
children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ W(li, {
|
|
5483
5497
|
chat: e,
|
|
5484
5498
|
isPinned: t.pinnedIds.includes(e.id),
|
|
5485
5499
|
onTogglePin: t.togglePin,
|
|
5486
5500
|
onDelete: t.handleDeleteClick
|
|
5487
|
-
}, e.id)) :
|
|
5501
|
+
}, e.id)) : pi(t.displayChats).map(({ label: e, chats: n }) => /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ G("div", {
|
|
5488
5502
|
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(
|
|
5503
|
+
children: [fi[e], e]
|
|
5504
|
+
}), n.map((e) => /* @__PURE__ */ W(li, {
|
|
5491
5505
|
chat: e,
|
|
5492
5506
|
isPinned: t.pinnedIds.includes(e.id),
|
|
5493
5507
|
onTogglePin: t.togglePin,
|
|
@@ -5503,7 +5517,7 @@ var pi = ({ showLabel: e = !1 }) => {
|
|
|
5503
5517
|
})
|
|
5504
5518
|
})
|
|
5505
5519
|
]
|
|
5506
|
-
})] }), /* @__PURE__ */ W(
|
|
5520
|
+
})] }), /* @__PURE__ */ W(di, {
|
|
5507
5521
|
deleteDialogOpen: t.deleteDialogOpen,
|
|
5508
5522
|
setDeleteDialogOpen: t.setDeleteDialogOpen,
|
|
5509
5523
|
chatToDelete: t.chatToDelete,
|
|
@@ -5518,11 +5532,11 @@ var pi = ({ showLabel: e = !1 }) => {
|
|
|
5518
5532
|
};
|
|
5519
5533
|
//#endregion
|
|
5520
5534
|
//#region src/components/ChatConversation/RecentHistoryChips.tsx
|
|
5521
|
-
function
|
|
5522
|
-
let { chats: e, loading: t } =
|
|
5535
|
+
function hi() {
|
|
5536
|
+
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
5537
|
return t ? null : /* @__PURE__ */ G("div", {
|
|
5524
5538
|
className: "flex flex-row items-center justify-center gap-2 flex-wrap",
|
|
5525
|
-
children: [/* @__PURE__ */ W(
|
|
5539
|
+
children: [/* @__PURE__ */ W(mi, { showLabel: !0 }), n.map((e) => /* @__PURE__ */ W(bt, {
|
|
5526
5540
|
href: `/c/${e.id}`,
|
|
5527
5541
|
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
5542
|
title: e.title,
|
|
@@ -5532,7 +5546,7 @@ function mi() {
|
|
|
5532
5546
|
}
|
|
5533
5547
|
//#endregion
|
|
5534
5548
|
//#region src/components/Footer.tsx
|
|
5535
|
-
function
|
|
5549
|
+
function gi({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackgroundColor: n = "bg-black/40" }) {
|
|
5536
5550
|
let [r, i] = p(!1), a = f(null);
|
|
5537
5551
|
u(() => {
|
|
5538
5552
|
if (!r) return;
|
|
@@ -5589,19 +5603,19 @@ function hi({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackground
|
|
|
5589
5603
|
}
|
|
5590
5604
|
//#endregion
|
|
5591
5605
|
//#region src/components/ChatConversation/background-art.ts
|
|
5592
|
-
function
|
|
5606
|
+
function _i() {
|
|
5593
5607
|
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
5608
|
return "https://i.imgur.com/" + e[Math.floor(Math.random() * e.length)];
|
|
5595
5609
|
}
|
|
5596
5610
|
//#endregion
|
|
5597
5611
|
//#region src/components/ChatConversation/ChatHomepage.tsx
|
|
5598
|
-
function
|
|
5599
|
-
let { sendMessage: e } =
|
|
5612
|
+
function vi() {
|
|
5613
|
+
let { sendMessage: e } = yn(), [n, r] = p(null), [i, a] = p(null), [o, s] = p(!1), [c, l] = p({ os: "" });
|
|
5600
5614
|
u(() => {
|
|
5601
5615
|
if (localStorage.getItem("showBackgroundArt") === "false") return;
|
|
5602
|
-
r(
|
|
5616
|
+
r(_i());
|
|
5603
5617
|
let e = setInterval(() => {
|
|
5604
|
-
let e =
|
|
5618
|
+
let e = _i();
|
|
5605
5619
|
a(e), s(!0), setTimeout(() => {
|
|
5606
5620
|
r(e), s(!1), a(null);
|
|
5607
5621
|
}, 1e3);
|
|
@@ -5633,7 +5647,7 @@ function _i() {
|
|
|
5633
5647
|
children: [
|
|
5634
5648
|
n && f(n, o ? "opacity-0" : "opacity-30"),
|
|
5635
5649
|
i && f(i, o ? "opacity-30" : "opacity-0"),
|
|
5636
|
-
/* @__PURE__ */ W(
|
|
5650
|
+
/* @__PURE__ */ W(ri, {})
|
|
5637
5651
|
]
|
|
5638
5652
|
}),
|
|
5639
5653
|
/* @__PURE__ */ W("div", {
|
|
@@ -5671,18 +5685,18 @@ function _i() {
|
|
|
5671
5685
|
}),
|
|
5672
5686
|
/* @__PURE__ */ G("div", {
|
|
5673
5687
|
className: "w-full max-w-2xl mt-8 space-y-2",
|
|
5674
|
-
children: [/* @__PURE__ */ W(
|
|
5688
|
+
children: [/* @__PURE__ */ W(hi, {}), /* @__PURE__ */ W(Er, {})]
|
|
5675
5689
|
})
|
|
5676
5690
|
]
|
|
5677
5691
|
})
|
|
5678
5692
|
}),
|
|
5679
|
-
/* @__PURE__ */ W(
|
|
5693
|
+
/* @__PURE__ */ W(gi, { listFooterLinks: t.footerLinks })
|
|
5680
5694
|
]
|
|
5681
5695
|
});
|
|
5682
5696
|
}
|
|
5683
5697
|
//#endregion
|
|
5684
5698
|
//#region src/ui/Loader.tsx
|
|
5685
|
-
var
|
|
5699
|
+
var yi = () => /* @__PURE__ */ G("svg", {
|
|
5686
5700
|
"aria-hidden": "true",
|
|
5687
5701
|
className: "w-8 h-8 text-border fill-secondary animate-spin",
|
|
5688
5702
|
viewBox: "0 0 100 101",
|
|
@@ -5698,7 +5712,7 @@ var vi = () => /* @__PURE__ */ G("svg", {
|
|
|
5698
5712
|
});
|
|
5699
5713
|
//#endregion
|
|
5700
5714
|
//#region src/components/ConfigError.tsx
|
|
5701
|
-
function
|
|
5715
|
+
function bi() {
|
|
5702
5716
|
return /* @__PURE__ */ W("div", {
|
|
5703
5717
|
className: "flex min-h-screen flex-col items-center justify-center p-8",
|
|
5704
5718
|
children: /* @__PURE__ */ G("div", {
|
|
@@ -5816,8 +5830,8 @@ function yi() {
|
|
|
5816
5830
|
}
|
|
5817
5831
|
//#endregion
|
|
5818
5832
|
//#region src/components/ChatConversation/ChatWindow.tsx
|
|
5819
|
-
var
|
|
5820
|
-
let e = h(), { hasError: t, isReady: n, notFound: r, messages: i } =
|
|
5833
|
+
var xi = () => {
|
|
5834
|
+
let e = h(), { hasError: t, isReady: n, notFound: r, messages: i } = yn(), { isAuthenticated: a } = Sn();
|
|
5821
5835
|
return u(() => {
|
|
5822
5836
|
n && r && !a && e.replace("/");
|
|
5823
5837
|
}, [
|
|
@@ -5825,9 +5839,9 @@ var bi = () => {
|
|
|
5825
5839
|
r,
|
|
5826
5840
|
a,
|
|
5827
5841
|
e
|
|
5828
|
-
]), t ? /* @__PURE__ */ W(
|
|
5842
|
+
]), t ? /* @__PURE__ */ W(bi, {}) : n && r && !a ? /* @__PURE__ */ W("div", {
|
|
5829
5843
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
5830
|
-
children: /* @__PURE__ */ W(
|
|
5844
|
+
children: /* @__PURE__ */ W(yi, {})
|
|
5831
5845
|
}) : n ? r ? /* @__PURE__ */ G("div", {
|
|
5832
5846
|
className: "flex min-h-screen flex-col items-center justify-center gap-3 px-4 text-center",
|
|
5833
5847
|
children: [/* @__PURE__ */ W("p", {
|
|
@@ -5839,14 +5853,14 @@ var bi = () => {
|
|
|
5839
5853
|
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
5854
|
children: "Go Home"
|
|
5841
5855
|
})]
|
|
5842
|
-
}) : /* @__PURE__ */ W("div", { children: i.length > 0 ? /* @__PURE__ */ W(U, { children: /* @__PURE__ */ W(
|
|
5856
|
+
}) : /* @__PURE__ */ W("div", { children: i.length > 0 ? /* @__PURE__ */ W(U, { children: /* @__PURE__ */ W(ni, {}) }) : /* @__PURE__ */ W(vi, {}) }) : /* @__PURE__ */ W("div", {
|
|
5843
5857
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
5844
|
-
children: /* @__PURE__ */ W(
|
|
5858
|
+
children: /* @__PURE__ */ W(yi, {})
|
|
5845
5859
|
});
|
|
5846
5860
|
};
|
|
5847
5861
|
//#endregion
|
|
5848
5862
|
//#region src/hooks/voice/useKokoroTTS.ts
|
|
5849
|
-
function
|
|
5863
|
+
function Si(e, t) {
|
|
5850
5864
|
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
5865
|
u(() => {
|
|
5852
5866
|
t?.autoPreload && !i && y();
|
|
@@ -5915,7 +5929,7 @@ function xi(e, t) {
|
|
|
5915
5929
|
}
|
|
5916
5930
|
//#endregion
|
|
5917
5931
|
//#region src/components/VoiceSettings/KokoroVoiceSelector.tsx
|
|
5918
|
-
var
|
|
5932
|
+
var Ci = {
|
|
5919
5933
|
af_heart: "American Female - Heart",
|
|
5920
5934
|
af_bella: "American Female - Bella",
|
|
5921
5935
|
af_nicole: "American Female - Nicole",
|
|
@@ -5927,8 +5941,8 @@ var Si = {
|
|
|
5927
5941
|
bm_george: "British Male - George",
|
|
5928
5942
|
bm_thomas: "British Male - Thomas"
|
|
5929
5943
|
};
|
|
5930
|
-
function
|
|
5931
|
-
let { status: t, modelReady: n, voices: r, selectedVoice: i, error: a, warmupModel: o, changeVoice: s, backend: c } =
|
|
5944
|
+
function wi({ preloadOnMount: e = !1 }) {
|
|
5945
|
+
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
5946
|
return /* @__PURE__ */ G("div", {
|
|
5933
5947
|
className: "flex flex-col gap-3",
|
|
5934
5948
|
children: [/* @__PURE__ */ G("div", {
|
|
@@ -5943,7 +5957,7 @@ function Ci({ preloadOnMount: e = !1 }) {
|
|
|
5943
5957
|
children: d ? /* @__PURE__ */ W(H, {
|
|
5944
5958
|
size: 18,
|
|
5945
5959
|
className: "animate-spin"
|
|
5946
|
-
}) : /* @__PURE__ */ W(
|
|
5960
|
+
}) : /* @__PURE__ */ W(B, { size: 18 })
|
|
5947
5961
|
})
|
|
5948
5962
|
}), /* @__PURE__ */ W(Z, {
|
|
5949
5963
|
side: "bottom",
|
|
@@ -5977,7 +5991,7 @@ function Ci({ preloadOnMount: e = !1 }) {
|
|
|
5977
5991
|
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
5992
|
children: /* @__PURE__ */ G("div", {
|
|
5979
5993
|
className: "flex items-center gap-2",
|
|
5980
|
-
children: [/* @__PURE__ */ W(Ne, { size: 16 }),
|
|
5994
|
+
children: [/* @__PURE__ */ W(Ne, { size: 16 }), Ci[i] || i]
|
|
5981
5995
|
})
|
|
5982
5996
|
}), l && /* @__PURE__ */ W("div", {
|
|
5983
5997
|
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 +6000,7 @@ function Ci({ preloadOnMount: e = !1 }) {
|
|
|
5986
6000
|
s(e), u(!1);
|
|
5987
6001
|
},
|
|
5988
6002
|
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:
|
|
6003
|
+
children: Ci[e] || e
|
|
5990
6004
|
}, e))
|
|
5991
6005
|
})]
|
|
5992
6006
|
})]
|
|
@@ -5994,7 +6008,7 @@ function Ci({ preloadOnMount: e = !1 }) {
|
|
|
5994
6008
|
}
|
|
5995
6009
|
//#endregion
|
|
5996
6010
|
//#region src/components/VoiceSettings/VoiceSettingsPanel.tsx
|
|
5997
|
-
function
|
|
6011
|
+
function Ti() {
|
|
5998
6012
|
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
6013
|
r(e), localStorage.setItem("useTTSKokoro", String(e));
|
|
6000
6014
|
}, l = (e) => {
|
|
@@ -6045,7 +6059,7 @@ function wi() {
|
|
|
6045
6059
|
children: "Runs locally in your browser. No server requests, lower latency, and multiple voice options."
|
|
6046
6060
|
})] })
|
|
6047
6061
|
]
|
|
6048
|
-
}), n && /* @__PURE__ */ W(
|
|
6062
|
+
}), n && /* @__PURE__ */ W(wi, { preloadOnMount: !1 })]
|
|
6049
6063
|
}),
|
|
6050
6064
|
/* @__PURE__ */ G("div", {
|
|
6051
6065
|
className: "space-y-2",
|
|
@@ -6115,4 +6129,4 @@ function wi() {
|
|
|
6115
6129
|
});
|
|
6116
6130
|
}
|
|
6117
6131
|
//#endregion
|
|
6118
|
-
export {
|
|
6132
|
+
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 };
|