research-agent-ui 0.1.352 → 0.1.354
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/ArticleExtractPanel-BnRqqEL_.cjs +2 -0
- package/dist/ArticleExtractPanel-Dce2hQz6.js +418 -0
- package/dist/{ChatConversationThread-B70yZMw_.js → ChatConversationThread-CEsCKbEo.js} +38 -38
- package/dist/{ChatConversationThread-BDzlHmvK.cjs → ChatConversationThread-CPqjlfWV.cjs} +3 -3
- package/dist/components/ArticleReader/ArticleContent.d.ts +2 -0
- package/dist/components/ArticleReader/ArticleOutline.d.ts +7 -0
- package/dist/components/ArticleReader/ArticleSidebarTabs.d.ts +15 -0
- package/dist/components/ArticleReader/LexicalArticleViewer.d.ts +3 -0
- package/dist/components/ArticleReader/articleOutline.d.ts +29 -0
- package/dist/components/ArticleReader/index.d.ts +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{src-Cgy6IAES.js → src-Czo4Yrd2.js} +895 -790
- package/dist/src-DgR_99cQ.cjs +34 -0
- package/dist/workspace.cjs +1 -1
- package/dist/workspace.mjs +87 -87
- package/package.json +14 -12
- package/dist/ArticleExtractPanel-B6tyR_bs.js +0 -389
- package/dist/ArticleExtractPanel-YlXZ8P18.cjs +0 -2
- package/dist/src-D7eu9lB9.cjs +0 -34
|
@@ -5,26 +5,28 @@ import v, { Suspense as y, createContext as b, forwardRef as x, lazy as S, useCa
|
|
|
5
5
|
import { useParams as k, usePathname as A, useRouter as j, useSearchParams as M } from "next/navigation";
|
|
6
6
|
import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
7
7
|
import { AnimatePresence as I, motion as L } from "motion/react";
|
|
8
|
-
import { AlertCircle as R, Archive as z, ArrowUp as B, BadgePercent as V, BookMarked as H, BookOpen as
|
|
9
|
-
import { Toaster as
|
|
10
|
-
import
|
|
11
|
-
import { agentChat as
|
|
12
|
-
import { LiveTranscriber as
|
|
13
|
-
import { SpokenPhraseOverlay as
|
|
14
|
-
import * as
|
|
15
|
-
import
|
|
16
|
-
import { Slot as
|
|
17
|
-
import { cva as
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
8
|
+
import { AlertCircle as R, Archive as z, ArrowUp as B, BadgePercent as V, BookMarked as H, BookOpen as U, Bot as ee, Building2 as W, CalendarDays as te, Check as ne, CheckIcon as re, ChevronDown as ie, ChevronRightIcon as ae, Clipboard as oe, Clock as se, Cloud as ce, CloudIcon as le, Copy as ue, Cpu as de, Download as fe, ExternalLink as pe, EyeOff as me, File as he, FileDown as ge, FileSpreadsheet as _e, FileText as ve, FileType as ye, FolderOpen as be, Globe as xe, HelpCircle as Se, Highlighter as Ce, History as we, Info as Te, LayoutGrid as Ee, Link as De, Loader2 as G, Lock as Oe, LogIn as ke, LogOut as Ae, Mail as je, MessageCircle as Me, MessageCircleQuestion as Ne, MessageSquare as Pe, Mic as Fe, Newspaper as Ie, Paperclip as Le, Pencil as Re, Pin as ze, Plus as Be, Search as Ve, Settings as He, Settings2 as Ue, Share2 as We, SlidersHorizontal as Ge, Sparkles as Ke, Square as qe, SquarePen as Je, Star as Ye, Sun as Xe, SwatchBook as Ze, Trash as Qe, Trash2 as $e, Upload as et, Volume2 as tt, X as nt, ZoomIn as rt, ZoomOut as it } from "lucide-react";
|
|
9
|
+
import { Toaster as at, toast as K } from "sonner";
|
|
10
|
+
import q from "grab-url";
|
|
11
|
+
import { agentChat as ot, autocomplete as st, createDocument as ct, deleteAllChats as lt, deleteChatById as ut, deleteUploadedFile as dt, getChatById as ft, getGoogleDriveFile as pt, getGoogleToken as mt, googleDocsAuth as ht, googleDocsAuthStatus as gt, listChats as _t, listProviders as vt, saveMessage as yt, searchChats as bt, shareChat as xt, uploadFiles as St } from "qwksearch-api-client";
|
|
12
|
+
import { LiveTranscriber as Ct } from "use-voice-control/client";
|
|
13
|
+
import { SpokenPhraseOverlay as wt } from "use-voice-control/react";
|
|
14
|
+
import * as J from "@radix-ui/react-dropdown-menu";
|
|
15
|
+
import Tt from "next/link";
|
|
16
|
+
import { Slot as Et } from "@radix-ui/react-slot";
|
|
17
|
+
import { cva as Dt } from "class-variance-authority";
|
|
18
|
+
import Ot from "quantum-sphere-loading-icon/react";
|
|
19
|
+
import kt from "dompurify";
|
|
20
|
+
import { TOCProvider as At, TOCScrollArea as jt } from "fumadocs-ui/components/toc";
|
|
21
|
+
import { TOCEmpty as Mt, TOCItem as Nt, TOCItems as Pt } from "fumadocs-ui/components/toc/clerk";
|
|
22
|
+
import { Streamdown as Ft } from "streamdown";
|
|
23
|
+
import { FaReddit as It, FaYoutube as Lt } from "react-icons/fa";
|
|
24
|
+
import { ThemeProvider as Rt } from "shadcn-theme-menu";
|
|
25
|
+
import { CategoryDock as zt, CategoryDockProvider as Bt, DropdownMenuItem as Vt, DropdownMenuSeparator as Ht, ThemeMenu as Ut } from "shadcn-app-dock";
|
|
26
|
+
import Wt from "next/image";
|
|
27
|
+
import { CookieConsent as Gt } from "legal-terms-privacy-policy/react";
|
|
26
28
|
// src/ui/gradient-blur.tsx
|
|
27
|
-
function
|
|
29
|
+
function Kt({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "transparent", color: r, colorGenerator: i }) {
|
|
28
30
|
let a = D(null), o = D({
|
|
29
31
|
x: 0,
|
|
30
32
|
y: 0
|
|
@@ -83,8 +85,8 @@ function Ht({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "tran
|
|
|
83
85
|
});
|
|
84
86
|
}
|
|
85
87
|
// ../search-autocomplete/dist/react.mjs
|
|
86
|
-
var
|
|
87
|
-
function
|
|
88
|
+
var qt = "w-full text-left px-4 py-1.5 text-[15px] flex items-center gap-3 transition-colors", Jt = "bg-bg-200 text-text-100", Yt = "text-text-200 hover:bg-bg-100 dark:hover:bg-[#3A3A38]", Xt = "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";
|
|
89
|
+
function Zt({ open: e, suggestions: t, domains: n, placement: r, highlightedIndex: i, setHighlightedIndex: a, selectSuggestion: o, selectDomain: s, className: c = "left-2 right-2 md:left-0 md:right-0" }) {
|
|
88
90
|
let l = r === "above" ? 4 : -4;
|
|
89
91
|
return /* @__PURE__ */ P(I, { children: e && n.length + t.length > 0 && /* @__PURE__ */ P(L.div, {
|
|
90
92
|
initial: {
|
|
@@ -112,10 +114,10 @@ function qt({ open: e, suggestions: t, domains: n, placement: r, highlightedInde
|
|
|
112
114
|
type: "button",
|
|
113
115
|
onMouseEnter: () => a(t),
|
|
114
116
|
onClick: () => s(e),
|
|
115
|
-
className: `${
|
|
117
|
+
className: `${qt} ${t === i ? Jt : Yt}`,
|
|
116
118
|
children: [
|
|
117
119
|
/* @__PURE__ */ P("span", {
|
|
118
|
-
className:
|
|
120
|
+
className: Xt,
|
|
119
121
|
children: t + 1
|
|
120
122
|
}),
|
|
121
123
|
/* @__PURE__ */ P("img", {
|
|
@@ -146,13 +148,13 @@ function qt({ open: e, suggestions: t, domains: n, placement: r, highlightedInde
|
|
|
146
148
|
type: "button",
|
|
147
149
|
onMouseEnter: () => a(r),
|
|
148
150
|
onClick: () => o(e),
|
|
149
|
-
className: `${
|
|
151
|
+
className: `${qt} ${r === i ? Jt : Yt}`,
|
|
150
152
|
children: [
|
|
151
153
|
/* @__PURE__ */ P("span", {
|
|
152
|
-
className:
|
|
154
|
+
className: Xt,
|
|
153
155
|
children: r + 1
|
|
154
156
|
}),
|
|
155
|
-
/* @__PURE__ */ P(
|
|
157
|
+
/* @__PURE__ */ P(Ve, { className: "w-4 h-4 text-text-400 shrink-0" }),
|
|
156
158
|
/* @__PURE__ */ P("span", {
|
|
157
159
|
className: "truncate",
|
|
158
160
|
children: e
|
|
@@ -164,8 +166,8 @@ function qt({ open: e, suggestions: t, domains: n, placement: r, highlightedInde
|
|
|
164
166
|
})
|
|
165
167
|
}) });
|
|
166
168
|
}
|
|
167
|
-
var
|
|
168
|
-
function
|
|
169
|
+
var Qt = "/api/agent/autocomplete";
|
|
170
|
+
function $t(e, t = 4) {
|
|
169
171
|
let n = e.trimEnd();
|
|
170
172
|
if (!n) return {
|
|
171
173
|
prefix: "",
|
|
@@ -177,7 +179,7 @@ function Yt(e, t = 4) {
|
|
|
177
179
|
query: a
|
|
178
180
|
};
|
|
179
181
|
}
|
|
180
|
-
function
|
|
182
|
+
function en(e, t) {
|
|
181
183
|
return async (n, { signal: r, limit: i }) => {
|
|
182
184
|
let a = new URLSearchParams({
|
|
183
185
|
q: n,
|
|
@@ -188,10 +190,10 @@ function Xt(e, t) {
|
|
|
188
190
|
return s.ok ? await s.json() : null;
|
|
189
191
|
};
|
|
190
192
|
}
|
|
191
|
-
var
|
|
192
|
-
function
|
|
193
|
-
let { value: t, onChange: n, enabled: r = !0, endpoint: i =
|
|
194
|
-
E.current = e.fetchSuggestions ??
|
|
193
|
+
var tn = 36, nn = 288;
|
|
194
|
+
function rn(e) {
|
|
195
|
+
let { value: t, onChange: n, enabled: r = !0, endpoint: i = Qt, engine: a, limit: o = 8, debounceMs: s = 180, minChars: c = 2, maxWords: l = 4, anchorRef: u, inputRef: d } = e, [f, p] = O([]), [m, h] = O([]), [g, _] = O(!1), [v, y] = O("below"), [b, x] = O(-1), S = D(!1), w = D(null), E = D(e.fetchSuggestions ?? en(i, a));
|
|
196
|
+
E.current = e.fetchSuggestions ?? en(i, a);
|
|
195
197
|
let k = D(e.onSelectDomain);
|
|
196
198
|
k.current = e.onSelectDomain;
|
|
197
199
|
let A = C(() => {
|
|
@@ -202,7 +204,7 @@ function $t(e) {
|
|
|
202
204
|
S.current = !1;
|
|
203
205
|
return;
|
|
204
206
|
}
|
|
205
|
-
let { query: e } =
|
|
207
|
+
let { query: e } = $t(t, l);
|
|
206
208
|
if (!r || e.length < c) {
|
|
207
209
|
w.current?.abort(), p([]), h([]), A();
|
|
208
210
|
return;
|
|
@@ -221,7 +223,7 @@ function $t(e) {
|
|
|
221
223
|
p(r), h(i);
|
|
222
224
|
let a = r.length + i.length;
|
|
223
225
|
if (a > 0 && u?.current && typeof window < "u") {
|
|
224
|
-
let e = u.current.getBoundingClientRect(), t = window.innerHeight - e.bottom, n = e.top, r = Math.min(
|
|
226
|
+
let e = u.current.getBoundingClientRect(), t = window.innerHeight - e.bottom, n = e.top, r = Math.min(nn, a * tn);
|
|
225
227
|
y(t < r && n > t ? "above" : "below");
|
|
226
228
|
}
|
|
227
229
|
_(a > 0), x(-1);
|
|
@@ -242,7 +244,7 @@ function $t(e) {
|
|
|
242
244
|
]), T(() => () => w.current?.abort(), []);
|
|
243
245
|
let j = C((e) => {
|
|
244
246
|
S.current = !0;
|
|
245
|
-
let { prefix: r } =
|
|
247
|
+
let { prefix: r } = $t(t, l);
|
|
246
248
|
n(r + e), p([]), h([]), A(), d?.current?.focus();
|
|
247
249
|
}, [
|
|
248
250
|
t,
|
|
@@ -294,13 +296,13 @@ function $t(e) {
|
|
|
294
296
|
};
|
|
295
297
|
}
|
|
296
298
|
// src/components/MessageComposer/MessageInputIconSet.tsx
|
|
297
|
-
var
|
|
298
|
-
Plus:
|
|
299
|
-
Paperclip:
|
|
300
|
-
Cloud:
|
|
301
|
-
Upload:
|
|
302
|
-
File:
|
|
303
|
-
SquarePen:
|
|
299
|
+
var Y = {
|
|
300
|
+
Plus: Be,
|
|
301
|
+
Paperclip: Le,
|
|
302
|
+
Cloud: ce,
|
|
303
|
+
Upload: et,
|
|
304
|
+
File: he,
|
|
305
|
+
SquarePen: Je,
|
|
304
306
|
Thinking: (e) => /* @__PURE__ */ P("svg", {
|
|
305
307
|
width: "20",
|
|
306
308
|
height: "20",
|
|
@@ -310,15 +312,15 @@ var J = {
|
|
|
310
312
|
...e,
|
|
311
313
|
children: /* @__PURE__ */ P("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" })
|
|
312
314
|
}),
|
|
313
|
-
SelectArrow:
|
|
315
|
+
SelectArrow: ie,
|
|
314
316
|
ArrowUp: B,
|
|
315
|
-
X:
|
|
316
|
-
FileText:
|
|
317
|
-
Loader2:
|
|
318
|
-
Check:
|
|
317
|
+
X: nt,
|
|
318
|
+
FileText: ve,
|
|
319
|
+
Loader2: G,
|
|
320
|
+
Check: ne,
|
|
319
321
|
Archive: z,
|
|
320
|
-
Mic:
|
|
321
|
-
Stop:
|
|
322
|
+
Mic: Fe,
|
|
323
|
+
Stop: qe,
|
|
322
324
|
Clock: (e) => /* @__PURE__ */ P("svg", {
|
|
323
325
|
xmlns: "http://www.w3.org/2000/svg",
|
|
324
326
|
width: "20",
|
|
@@ -328,7 +330,7 @@ var J = {
|
|
|
328
330
|
...e,
|
|
329
331
|
children: /* @__PURE__ */ P("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" })
|
|
330
332
|
})
|
|
331
|
-
},
|
|
333
|
+
}, an = (e) => {
|
|
332
334
|
if (e === 0) return "0 Bytes";
|
|
333
335
|
let t = 1024, n = [
|
|
334
336
|
"Bytes",
|
|
@@ -337,7 +339,7 @@ var J = {
|
|
|
337
339
|
"GB"
|
|
338
340
|
], r = Math.floor(Math.log(e) / Math.log(t));
|
|
339
341
|
return parseFloat((e / t ** r).toFixed(2)) + " " + n[r];
|
|
340
|
-
},
|
|
342
|
+
}, on = ({ file: e, onRemove: t }) => {
|
|
341
343
|
let n = e.type.startsWith("image/") && e.preview;
|
|
342
344
|
return /* @__PURE__ */ F("div", {
|
|
343
345
|
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",
|
|
@@ -354,7 +356,7 @@ var J = {
|
|
|
354
356
|
/* @__PURE__ */ P("span", {
|
|
355
357
|
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",
|
|
356
358
|
title: e.file.name,
|
|
357
|
-
children:
|
|
359
|
+
children: an(e.file.size)
|
|
358
360
|
})
|
|
359
361
|
]
|
|
360
362
|
}) : /* @__PURE__ */ F("div", {
|
|
@@ -363,7 +365,7 @@ var J = {
|
|
|
363
365
|
className: "flex items-center gap-2",
|
|
364
366
|
children: [/* @__PURE__ */ P("div", {
|
|
365
367
|
className: "p-1.5 bg-bg-300 rounded",
|
|
366
|
-
children: /* @__PURE__ */ P(
|
|
368
|
+
children: /* @__PURE__ */ P(Y.FileText, { className: "w-4 h-4 text-text-300" })
|
|
367
369
|
}), /* @__PURE__ */ P("span", {
|
|
368
370
|
className: "text-[10px] font-medium text-text-400 uppercase tracking-wider truncate",
|
|
369
371
|
children: e.file.name.split(".").pop()
|
|
@@ -376,26 +378,26 @@ var J = {
|
|
|
376
378
|
children: e.file.name
|
|
377
379
|
}), /* @__PURE__ */ P("p", {
|
|
378
380
|
className: "text-[10px] text-text-500",
|
|
379
|
-
children:
|
|
381
|
+
children: an(e.file.size)
|
|
380
382
|
})]
|
|
381
383
|
})]
|
|
382
384
|
}),
|
|
383
385
|
/* @__PURE__ */ P("button", {
|
|
384
386
|
onClick: () => t(e.id),
|
|
385
387
|
className: "absolute top-1 right-1 p-1 bg-black/50 hover:bg-black/70 rounded-full text-white opacity-0 group-hover:opacity-100 transition-opacity",
|
|
386
|
-
children: /* @__PURE__ */ P(
|
|
388
|
+
children: /* @__PURE__ */ P(Y.X, { className: "w-3 h-3" })
|
|
387
389
|
}),
|
|
388
390
|
e.uploadStatus === "uploading" && /* @__PURE__ */ P("div", {
|
|
389
391
|
className: "absolute inset-0 bg-black/40 flex items-center justify-center",
|
|
390
|
-
children: /* @__PURE__ */ P(
|
|
392
|
+
children: /* @__PURE__ */ P(Y.Loader2, { className: "w-5 h-5 text-white animate-spin" })
|
|
391
393
|
}),
|
|
392
394
|
e.uploadStatus === "error" && /* @__PURE__ */ P("div", {
|
|
393
395
|
className: "absolute inset-0 bg-red-900/60 flex items-center justify-center",
|
|
394
|
-
children: /* @__PURE__ */ P(
|
|
396
|
+
children: /* @__PURE__ */ P(Y.X, { className: "w-5 h-5 text-red-300" })
|
|
395
397
|
})
|
|
396
398
|
]
|
|
397
399
|
});
|
|
398
|
-
},
|
|
400
|
+
}, sn = ({ content: e, onRemove: t }) => /* @__PURE__ */ F("div", {
|
|
399
401
|
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)]",
|
|
400
402
|
children: [
|
|
401
403
|
/* @__PURE__ */ P("div", {
|
|
@@ -418,12 +420,12 @@ var J = {
|
|
|
418
420
|
/* @__PURE__ */ P("button", {
|
|
419
421
|
onClick: () => t(e.id),
|
|
420
422
|
className: "absolute top-2 right-2 p-[3px] bg-white dark:bg-[#30302E] border border-[#E5E5E5] dark:border-[#404040] rounded-full text-[#9CA3AF] hover:text-[#6B7280] dark:hover:text-white transition-colors shadow-sm opacity-0 group-hover:opacity-100",
|
|
421
|
-
children: /* @__PURE__ */ P(
|
|
423
|
+
children: /* @__PURE__ */ P(Y.X, { className: "w-2 h-2" })
|
|
422
424
|
})
|
|
423
425
|
]
|
|
424
|
-
}),
|
|
426
|
+
}), cn = async (e, t, n) => {
|
|
425
427
|
try {
|
|
426
|
-
let n = localStorage.getItem("chatModelKey"), r = localStorage.getItem("chatModelProviderId"), i = (await
|
|
428
|
+
let n = localStorage.getItem("chatModelKey"), r = localStorage.getItem("chatModelProviderId"), i = (await q("agent/providers"))?.providers || [];
|
|
427
429
|
if (!i || i.length === 0) {
|
|
428
430
|
t(!0);
|
|
429
431
|
return;
|
|
@@ -444,53 +446,53 @@ var J = {
|
|
|
444
446
|
providerId: r
|
|
445
447
|
}), t(!0);
|
|
446
448
|
} catch (e) {
|
|
447
|
-
console.error("An error occurred while checking the configuration:", e),
|
|
449
|
+
console.error("An error occurred while checking the configuration:", e), K.error(`Could not load AI providers: ${e?.message ?? String(e)}`), t(!0);
|
|
448
450
|
}
|
|
449
|
-
},
|
|
450
|
-
function
|
|
451
|
-
if (!
|
|
451
|
+
}, ln = "qwksearch_guest_chats", un = typeof window < "u";
|
|
452
|
+
function dn() {
|
|
453
|
+
if (!un) return [];
|
|
452
454
|
try {
|
|
453
|
-
let e = localStorage.getItem(
|
|
455
|
+
let e = localStorage.getItem(ln);
|
|
454
456
|
return e ? JSON.parse(e).sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime()) : [];
|
|
455
457
|
} catch (e) {
|
|
456
458
|
return console.error("Failed to get guest chats:", e), [];
|
|
457
459
|
}
|
|
458
460
|
}
|
|
459
|
-
function
|
|
460
|
-
return
|
|
461
|
+
function fn(e) {
|
|
462
|
+
return un && dn().find((t) => t.id === e) || null;
|
|
461
463
|
}
|
|
462
|
-
function
|
|
463
|
-
if (
|
|
464
|
-
let t =
|
|
465
|
-
n >= 0 ? t[n] = e : t.push(e), localStorage.setItem(
|
|
464
|
+
function pn(e) {
|
|
465
|
+
if (un) try {
|
|
466
|
+
let t = dn(), n = t.findIndex((t) => t.id === e.id);
|
|
467
|
+
n >= 0 ? t[n] = e : t.push(e), localStorage.setItem(ln, JSON.stringify(t));
|
|
466
468
|
} catch (e) {
|
|
467
469
|
console.error("Failed to save guest chat:", e);
|
|
468
470
|
}
|
|
469
471
|
}
|
|
470
|
-
function
|
|
471
|
-
if (
|
|
472
|
-
let t =
|
|
473
|
-
localStorage.setItem(
|
|
472
|
+
function mn(e) {
|
|
473
|
+
if (un) try {
|
|
474
|
+
let t = dn().filter((t) => t.id !== e);
|
|
475
|
+
localStorage.setItem(ln, JSON.stringify(t));
|
|
474
476
|
} catch (e) {
|
|
475
477
|
console.error("Failed to delete guest chat:", e);
|
|
476
478
|
}
|
|
477
479
|
}
|
|
478
|
-
function
|
|
479
|
-
if (
|
|
480
|
-
localStorage.removeItem(
|
|
480
|
+
function hn() {
|
|
481
|
+
if (un) try {
|
|
482
|
+
localStorage.removeItem(ln);
|
|
481
483
|
} catch (e) {
|
|
482
484
|
console.error("Failed to clear guest chats:", e);
|
|
483
485
|
}
|
|
484
486
|
}
|
|
485
|
-
function
|
|
486
|
-
if (!
|
|
487
|
-
let n =
|
|
488
|
-
n && (n.title = t,
|
|
487
|
+
function gn(e, t) {
|
|
488
|
+
if (!un) return;
|
|
489
|
+
let n = fn(e);
|
|
490
|
+
n && (n.title = t, pn(n));
|
|
489
491
|
}
|
|
490
492
|
// src/hooks/useChat/chatMessages.ts
|
|
491
|
-
var
|
|
493
|
+
var _n = async (e, t, n, r, i, a, o, s, c) => {
|
|
492
494
|
if (!t) {
|
|
493
|
-
let t =
|
|
495
|
+
let t = fn(e);
|
|
494
496
|
if (t) {
|
|
495
497
|
n(t.messages);
|
|
496
498
|
let e = t.messages.filter((e) => e.role === "user" || e.role === "assistant"), o = e.map((e) => [e.role, e.content]);
|
|
@@ -498,7 +500,7 @@ var fn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
498
500
|
return;
|
|
499
501
|
}
|
|
500
502
|
try {
|
|
501
|
-
let { data: t, error: l } = await
|
|
503
|
+
let { data: t, error: l } = await ft({ path: { id: e } });
|
|
502
504
|
if (l) {
|
|
503
505
|
let e = l.status;
|
|
504
506
|
if (e === 404 || e === 403) {
|
|
@@ -528,7 +530,7 @@ var fn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
528
530
|
}
|
|
529
531
|
}
|
|
530
532
|
try {
|
|
531
|
-
let { data: t, error: l } = await
|
|
533
|
+
let { data: t, error: l } = await ft({ path: { id: e } });
|
|
532
534
|
if (l) {
|
|
533
535
|
let e = l.status;
|
|
534
536
|
if (e === 404 || e === 401 || e === 403) {
|
|
@@ -554,7 +556,7 @@ var fn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
554
556
|
} catch (e) {
|
|
555
557
|
console.error("[chatMessages] Failed to load chat:", e), o(!0), r(!0);
|
|
556
558
|
}
|
|
557
|
-
},
|
|
559
|
+
}, vn = (e) => {
|
|
558
560
|
let t = [];
|
|
559
561
|
return e.forEach((n, r) => {
|
|
560
562
|
if (n.role === "user") {
|
|
@@ -586,10 +588,10 @@ var fn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
586
588
|
});
|
|
587
589
|
}
|
|
588
590
|
}), t;
|
|
589
|
-
},
|
|
591
|
+
}, yn = async (e) => {
|
|
590
592
|
let t = localStorage.getItem("chatModelKey"), n = localStorage.getItem("chatModelProviderId"), r = parseInt(localStorage.getItem("maxFollowupQuestions") || "4"), i = localStorage.getItem("followUpQuestionsPrompt")?.trim() || void 0, a = e.filter((e) => e.role === "user" || e.role === "assistant");
|
|
591
593
|
try {
|
|
592
|
-
let e = await
|
|
594
|
+
let e = await q("agent/suggestions", {
|
|
593
595
|
method: "POST",
|
|
594
596
|
body: JSON.stringify({
|
|
595
597
|
chatHistory: a,
|
|
@@ -605,18 +607,18 @@ var fn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
605
607
|
} catch {
|
|
606
608
|
return [];
|
|
607
609
|
}
|
|
608
|
-
},
|
|
609
|
-
async function
|
|
610
|
-
let { message: r, messageId: i, rewrite: a = !1 } = e, { chatId: o, loading: s, messages: c, fileIds: l, files: u, focusMode: d, category: f, optimizationMode: p, chatHistory: m, chatModelProvider: h, isAuthenticated: g, messagesRef: _, abortControllerRef: v, setLoading: y, setMessageAppeared: b, setMessages: x, setChatHistory: S, setChatModelProvider: C } = n, w = typeof window < "u" && localStorage.getItem(
|
|
610
|
+
}, bn = 3, xn = "Analyze the uploaded file(s) and summarize the key points.", Sn = () => Array.from(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(7)), (e) => e.toString(16).padStart(2, "0")).join(""), Cn = "sourceExtractionEnabled", wn = "thinkingTimeLimit";
|
|
611
|
+
async function Tn(e, n) {
|
|
612
|
+
let { message: r, messageId: i, rewrite: a = !1 } = e, { chatId: o, loading: s, messages: c, fileIds: l, files: u, focusMode: d, category: f, optimizationMode: p, chatHistory: m, chatModelProvider: h, isAuthenticated: g, messagesRef: _, abortControllerRef: v, setLoading: y, setMessageAppeared: b, setMessages: x, setChatHistory: S, setChatModelProvider: C } = n, w = typeof window < "u" && localStorage.getItem(Cn) === "true", T = typeof window < "u" && Number(localStorage.getItem(wn) ?? "0") || 0;
|
|
611
613
|
if (s) return;
|
|
612
614
|
let E = r?.trim() ?? "", D = Array.isArray(l) && l.length > 0;
|
|
613
615
|
if (!E && !D) return;
|
|
614
|
-
let O = E ? r :
|
|
616
|
+
let O = E ? r : xn, k = new AbortController();
|
|
615
617
|
if (v.current = k, y(!0), b(!1), c.length <= 1 && !t.onOpenChat) {
|
|
616
618
|
let e = new URL(window.location.href);
|
|
617
619
|
e.searchParams.set("chat", o), window.history.replaceState(null, "", `${e.pathname}?${e.searchParams.toString()}${e.hash}`);
|
|
618
620
|
}
|
|
619
|
-
let A = "", j = !1, M = !1, N = [], P = Date.now(), F = T > 0, I = "", L = "", R = i ??
|
|
621
|
+
let A = "", j = !1, M = !1, N = [], P = Date.now(), F = T > 0, I = "", L = "", R = i ?? Sn(), z = Array.isArray(u) ? [...u] : [];
|
|
620
622
|
x((e) => [...e, {
|
|
621
623
|
content: O,
|
|
622
624
|
messageId: R,
|
|
@@ -628,7 +630,7 @@ async function bn(e, n) {
|
|
|
628
630
|
let B = (e) => {
|
|
629
631
|
x((t) => [...t, {
|
|
630
632
|
content: `⚠️ **The response failed:** ${e}`,
|
|
631
|
-
messageId:
|
|
633
|
+
messageId: Sn(),
|
|
632
634
|
chatId: o,
|
|
633
635
|
role: "assistant",
|
|
634
636
|
createdAt: /* @__PURE__ */ new Date()
|
|
@@ -639,7 +641,7 @@ async function bn(e, n) {
|
|
|
639
641
|
typeof t == "string" && (t.includes("no longer available") || t.includes("deprecated") || t.includes("410")) && (localStorage.removeItem("chatModelKey"), localStorage.removeItem("chatModelProviderId"), C?.({
|
|
640
642
|
key: "",
|
|
641
643
|
providerId: ""
|
|
642
|
-
})),
|
|
644
|
+
})), K.error(t), B(t), y(!1);
|
|
643
645
|
} else {
|
|
644
646
|
if (e.type === "searching") {
|
|
645
647
|
let t = e.data;
|
|
@@ -683,9 +685,9 @@ async function bn(e, n) {
|
|
|
683
685
|
role: "source",
|
|
684
686
|
sources: N,
|
|
685
687
|
createdAt: /* @__PURE__ */ new Date()
|
|
686
|
-
}]), N.length > 0 && (b(!0), N.slice(0,
|
|
688
|
+
}]), N.length > 0 && (b(!0), N.slice(0, bn).forEach((e) => {
|
|
687
689
|
let t = e?.metadata?.url;
|
|
688
|
-
t && t !== "File" &&
|
|
690
|
+
t && t !== "File" && q(`doc/article?url=${encodeURIComponent(t)}`).catch(() => {});
|
|
689
691
|
}))), e.type === "message" && (A += e.data, F ? (I += e.data, L ||= e.messageId, j = !0) : j ? x((t) => t.map((t) => t.messageId === e.messageId && t.role === "assistant" ? {
|
|
690
692
|
...t,
|
|
691
693
|
content: t.content + e.data
|
|
@@ -711,7 +713,7 @@ async function bn(e, n) {
|
|
|
711
713
|
let e = _.current[_.current.length - 1];
|
|
712
714
|
if (t.getAutoMediaSearch() && (document.getElementById(`search-images-${e.messageId}`)?.click(), document.getElementById(`search-videos-${e.messageId}`)?.click()), !M) {
|
|
713
715
|
M = !0;
|
|
714
|
-
let e = await
|
|
716
|
+
let e = await yn(_.current), t = Sn();
|
|
715
717
|
if (x((n) => [...n, {
|
|
716
718
|
role: "suggestion",
|
|
717
719
|
suggestions: e,
|
|
@@ -719,7 +721,7 @@ async function bn(e, n) {
|
|
|
719
721
|
createdAt: /* @__PURE__ */ new Date(),
|
|
720
722
|
messageId: t
|
|
721
723
|
}]), g && e.length > 0) try {
|
|
722
|
-
await
|
|
724
|
+
await yt({ body: {
|
|
723
725
|
chatId: o,
|
|
724
726
|
messageId: t,
|
|
725
727
|
role: "suggestion",
|
|
@@ -739,7 +741,7 @@ async function bn(e, n) {
|
|
|
739
741
|
}
|
|
740
742
|
}, H = c.findIndex((e) => e.messageId === R);
|
|
741
743
|
try {
|
|
742
|
-
let { stream: e } = await
|
|
744
|
+
let { stream: e } = await ot({
|
|
743
745
|
signal: k.signal,
|
|
744
746
|
body: {
|
|
745
747
|
message: {
|
|
@@ -765,7 +767,7 @@ async function bn(e, n) {
|
|
|
765
767
|
sseMaxRetryAttempts: 1,
|
|
766
768
|
onSseError: (e) => {
|
|
767
769
|
let t = e instanceof Error ? e.message : String(e);
|
|
768
|
-
t.includes("401") && g ? (
|
|
770
|
+
t.includes("401") && g ? (K.error("Your session has expired. Please sign in again."), y(!1), window.location.href = "/") : (K.error("Failed to send message. Please try again."), B(`${t}. Please try again.`), y(!1));
|
|
769
771
|
}
|
|
770
772
|
});
|
|
771
773
|
for await (let t of e) await V(t);
|
|
@@ -789,11 +791,11 @@ async function bn(e, n) {
|
|
|
789
791
|
v.current = null;
|
|
790
792
|
}
|
|
791
793
|
// src/hooks/useChat/useChatState.ts
|
|
792
|
-
function
|
|
794
|
+
function En(e) {
|
|
793
795
|
let [t, n] = O(e), [r, i] = O(!1), [a, o] = O(!1), [s, c] = O(!1), [l, u] = O(!1), [d, f] = O(!1), [p, m] = O(!1), [h, g] = O(!1), [_, v] = O(!1), [y, b] = O([]), [x, S] = O([]), [C, w] = O([]), [T, k] = O([]), [A, j] = O("webSearch"), [M, N] = O("general"), [P, F] = O("speed"), [I, L] = O({
|
|
794
796
|
key: "",
|
|
795
797
|
providerId: ""
|
|
796
|
-
}), R = D([]), z = E(() => x.filter((e) => e.role === "user" || e.role === "assistant"), [x]), B = E(() =>
|
|
798
|
+
}), R = D([]), z = E(() => x.filter((e) => e.role === "user" || e.role === "assistant"), [x]), B = E(() => vn(x), [x]);
|
|
797
799
|
return {
|
|
798
800
|
state: {
|
|
799
801
|
chatId: t,
|
|
@@ -839,14 +841,14 @@ function xn(e) {
|
|
|
839
841
|
};
|
|
840
842
|
}
|
|
841
843
|
// src/lib/chatTitle.ts
|
|
842
|
-
var
|
|
844
|
+
var Dn = async (e, t) => {
|
|
843
845
|
let n = localStorage.getItem("chatModelKey"), r = localStorage.getItem("chatModelProviderId"), i = t.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
|
|
844
846
|
role: e.role,
|
|
845
847
|
content: e.content ?? ""
|
|
846
848
|
}));
|
|
847
849
|
if (i.length === 0) return "";
|
|
848
850
|
try {
|
|
849
|
-
let t = await
|
|
851
|
+
let t = await q("agent/chat-title", {
|
|
850
852
|
method: "POST",
|
|
851
853
|
body: JSON.stringify({
|
|
852
854
|
chatId: e,
|
|
@@ -863,16 +865,16 @@ var Sn = async (e, t) => {
|
|
|
863
865
|
}
|
|
864
866
|
};
|
|
865
867
|
// src/hooks/useChat/ChatProvider.tsx
|
|
866
|
-
function
|
|
867
|
-
let t = k(), r = M(), a = j(), o = r.get("q"), { isAuthenticated: s, isLoading: c } = n(), { state: l, setters: u, messagesRef: d, chatTurns: f, sections: p } =
|
|
868
|
+
function On({ children: e }) {
|
|
869
|
+
let t = k(), r = M(), a = j(), o = r.get("q"), { isAuthenticated: s, isLoading: c } = n(), { state: l, setters: u, messagesRef: d, chatTurns: f, sections: p } = En(t.chatId), m = D(null), [h, g] = O(!1), _ = D({}), v = D(/* @__PURE__ */ new Set());
|
|
868
870
|
T(() => {
|
|
869
|
-
|
|
871
|
+
cn(u.setChatModelProvider, u.setIsConfigReady, u.setHasError);
|
|
870
872
|
}, []), T(() => {
|
|
871
873
|
t.chatId && t.chatId !== l.chatId && (u.setChatId(t.chatId), u.setMessages([]), u.setChatHistory([]), u.setFiles([]), u.setFileIds([]), u.setIsMessagesLoaded(!1), u.setNotFound(!1), u.setNewChatCreated(!1));
|
|
872
874
|
}, [t.chatId, l.chatId]), T(() => {
|
|
873
875
|
if (l.chatId && !l.newChatCreated && !l.isMessagesLoaded && l.messages.length === 0) {
|
|
874
876
|
if (c) return;
|
|
875
|
-
|
|
877
|
+
_n(l.chatId, s, u.setMessages, u.setIsMessagesLoaded, u.setChatHistory, u.setFocusMode, u.setNotFound, u.setFiles, u.setFileIds);
|
|
876
878
|
} else l.chatId || (u.setNewChatCreated(!0), u.setIsMessagesLoaded(!0), u.setChatId(crypto.randomUUID()));
|
|
877
879
|
}, [
|
|
878
880
|
l.chatId,
|
|
@@ -886,7 +888,7 @@ function Cn({ children: e }) {
|
|
|
886
888
|
let e = l.messages.filter((e) => e.role === "user" || e.role === "assistant");
|
|
887
889
|
if (e.length > 0) {
|
|
888
890
|
let t = _.current[l.chatId] ?? e[0].content.slice(0, 50);
|
|
889
|
-
|
|
891
|
+
pn({
|
|
890
892
|
id: l.chatId,
|
|
891
893
|
title: t,
|
|
892
894
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -906,8 +908,8 @@ function Cn({ children: e }) {
|
|
|
906
908
|
if (h || !l.chatId || !l.isMessagesLoaded || !l.newChatCreated || l.loading || f.filter((e) => e.role === "user").length < 2) return;
|
|
907
909
|
let e = l.chatId;
|
|
908
910
|
v.current.has(e) || (v.current.add(e), (async () => {
|
|
909
|
-
let t = await
|
|
910
|
-
t ? (_.current[e] = t, s ||
|
|
911
|
+
let t = await Dn(e, l.messages);
|
|
912
|
+
t ? (_.current[e] = t, s || gn(e, t)) : v.current.delete(e);
|
|
911
913
|
})());
|
|
912
914
|
}, [
|
|
913
915
|
f,
|
|
@@ -930,7 +932,7 @@ function Cn({ children: e }) {
|
|
|
930
932
|
o
|
|
931
933
|
]);
|
|
932
934
|
let y = C(async (e, t, n = !1) => {
|
|
933
|
-
l.chatId && await
|
|
935
|
+
l.chatId && await Tn({
|
|
934
936
|
message: e,
|
|
935
937
|
messageId: t,
|
|
936
938
|
rewrite: n
|
|
@@ -986,10 +988,10 @@ function Cn({ children: e }) {
|
|
|
986
988
|
} : t;
|
|
987
989
|
}));
|
|
988
990
|
try {
|
|
989
|
-
let { error: t } = await
|
|
991
|
+
let { error: t } = await dt({ query: { fileId: e } });
|
|
990
992
|
if (t) throw Error(t.message ?? "Delete failed");
|
|
991
993
|
} catch (e) {
|
|
992
|
-
console.error("[ChatProvider] Failed to delete uploaded file:", e),
|
|
994
|
+
console.error("[ChatProvider] Failed to delete uploaded file:", e), K.error("Removed from the chat, but the file could not be deleted from storage.");
|
|
993
995
|
}
|
|
994
996
|
}, [l.files, l.fileIds]), S = C(() => {
|
|
995
997
|
m.current &&= (m.current.abort(), null);
|
|
@@ -1039,10 +1041,10 @@ function Cn({ children: e }) {
|
|
|
1039
1041
|
});
|
|
1040
1042
|
}
|
|
1041
1043
|
// src/hooks/voice/useSpeechToTranscript.ts
|
|
1042
|
-
function
|
|
1044
|
+
function kn() {
|
|
1043
1045
|
return typeof window > "u" ? !1 : !!(window.SpeechRecognition || window.webkitSpeechRecognition);
|
|
1044
1046
|
}
|
|
1045
|
-
function
|
|
1047
|
+
function An(e, t, n = {}) {
|
|
1046
1048
|
let [r, i] = O(!1), [a, o] = O(""), [s, c] = O(""), [l, u] = O(0), d = D(null), f = D(null), p = D([]), m = D({
|
|
1047
1049
|
onTranscript: e,
|
|
1048
1050
|
onEnd: t,
|
|
@@ -1053,7 +1055,7 @@ function Tn(e, t, n = {}) {
|
|
|
1053
1055
|
onEnd: t,
|
|
1054
1056
|
onPartial: n.onPartial
|
|
1055
1057
|
};
|
|
1056
|
-
let h = E(() => new
|
|
1058
|
+
let h = E(() => new Ct({
|
|
1057
1059
|
engine: "webspeech",
|
|
1058
1060
|
language: n.language ?? "en-US",
|
|
1059
1061
|
onStateChange: i,
|
|
@@ -1064,19 +1066,19 @@ function Tn(e, t, n = {}) {
|
|
|
1064
1066
|
o(""), c(e), u((e) => e + 1), m.current.onTranscript(e);
|
|
1065
1067
|
},
|
|
1066
1068
|
onError: () => {
|
|
1067
|
-
|
|
1069
|
+
K.error("Speech recognition stopped unexpectedly.");
|
|
1068
1070
|
}
|
|
1069
1071
|
}), [n.language]), g = C(() => {
|
|
1070
1072
|
let e = d.current;
|
|
1071
1073
|
e && e.state !== "inactive" ? e.stop() : (f.current?.getTracks().forEach((e) => e.stop()), f.current = null, d.current = null);
|
|
1072
1074
|
}, []), _ = async (e) => {
|
|
1073
1075
|
let t = new FormData();
|
|
1074
|
-
return t.append("file", e, "speech-input.webm"), t.append("languageCode", "en"), ((await
|
|
1076
|
+
return t.append("file", e, "speech-input.webm"), t.append("languageCode", "en"), ((await q("agent/transcript", {
|
|
1075
1077
|
method: "POST",
|
|
1076
1078
|
body: t
|
|
1077
1079
|
}))?.text ?? "").trim();
|
|
1078
1080
|
}, v = C(async () => {
|
|
1079
|
-
if (typeof navigator > "u" || !navigator.mediaDevices?.getUserMedia || typeof MediaRecorder > "u")
|
|
1081
|
+
if (typeof navigator > "u" || !navigator.mediaDevices?.getUserMedia || typeof MediaRecorder > "u") K.error("Speech input is not supported in this browser", { duration: 5e3 }), i(!1), m.current.onEnd();
|
|
1080
1082
|
else try {
|
|
1081
1083
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 }), t = new MediaRecorder(e);
|
|
1082
1084
|
p.current = [], f.current = e, d.current = t, t.ondataavailable = (e) => {
|
|
@@ -1088,18 +1090,18 @@ function Tn(e, t, n = {}) {
|
|
|
1088
1090
|
let e = new Blob(p.current, { type: "audio/webm" });
|
|
1089
1091
|
if (p.current = [], f.current?.getTracks().forEach((e) => e.stop()), f.current = null, d.current = null, i(!1), e.size === 0) return;
|
|
1090
1092
|
let t = await _(e);
|
|
1091
|
-
t ? (c(t), u((e) => e + 1), m.current.onTranscript(t)) :
|
|
1093
|
+
t ? (c(t), u((e) => e + 1), m.current.onTranscript(t)) : K.error("No speech detected. Please try again.");
|
|
1092
1094
|
} catch {
|
|
1093
|
-
|
|
1095
|
+
K.error("Unable to transcribe audio.");
|
|
1094
1096
|
} finally {
|
|
1095
1097
|
m.current.onEnd();
|
|
1096
1098
|
}
|
|
1097
1099
|
}, t.start();
|
|
1098
1100
|
} catch {
|
|
1099
|
-
|
|
1101
|
+
K.error("Microphone access is required for speech input."), i(!1), m.current.onEnd();
|
|
1100
1102
|
}
|
|
1101
1103
|
}, []), y = C(async () => {
|
|
1102
|
-
h.isListening() ? (await h.stop(), o(""), m.current.onEnd()) : d.current ? g() :
|
|
1104
|
+
h.isListening() ? (await h.stop(), o(""), m.current.onEnd()) : d.current ? g() : kn() ? await h.start() : await v();
|
|
1103
1105
|
}, [
|
|
1104
1106
|
h,
|
|
1105
1107
|
v,
|
|
@@ -1117,48 +1119,48 @@ function Tn(e, t, n = {}) {
|
|
|
1117
1119
|
return {
|
|
1118
1120
|
isListening: r,
|
|
1119
1121
|
toggleSpeech: y,
|
|
1120
|
-
isSpeechSupported:
|
|
1122
|
+
isSpeechSupported: kn() || b,
|
|
1121
1123
|
partial: a,
|
|
1122
1124
|
lastPhrase: s,
|
|
1123
1125
|
phraseId: l
|
|
1124
1126
|
};
|
|
1125
1127
|
}
|
|
1126
1128
|
// src/lib/voiceAutoStart.ts
|
|
1127
|
-
var
|
|
1128
|
-
function
|
|
1129
|
-
return
|
|
1129
|
+
var jn = "voiceAutoStart", Mn = "voiceAutoStartTriggered", Nn = typeof window < "u";
|
|
1130
|
+
function Pn() {
|
|
1131
|
+
return Nn ? localStorage.getItem(jn) === "true" : !1;
|
|
1130
1132
|
}
|
|
1131
|
-
function
|
|
1132
|
-
|
|
1133
|
+
function Fn(e) {
|
|
1134
|
+
Nn && localStorage.setItem(jn, String(e));
|
|
1133
1135
|
}
|
|
1134
|
-
function
|
|
1135
|
-
|
|
1136
|
+
function In() {
|
|
1137
|
+
Nn && localStorage.setItem(Mn, "true");
|
|
1136
1138
|
}
|
|
1137
|
-
function
|
|
1139
|
+
function Ln({ enabled: e, isSpeechSupported: t, isListening: n }, r) {
|
|
1138
1140
|
return e && t && !n && !r;
|
|
1139
1141
|
}
|
|
1140
|
-
function
|
|
1141
|
-
return
|
|
1142
|
+
function Rn() {
|
|
1143
|
+
return Nn ? localStorage.getItem(Mn) === "true" : !1;
|
|
1142
1144
|
}
|
|
1143
1145
|
// src/hooks/voice/useVoiceAutoStart.ts
|
|
1144
|
-
function
|
|
1146
|
+
function zn({ isSpeechSupported: e, isListening: t, toggleSpeech: n }) {
|
|
1145
1147
|
T(() => {
|
|
1146
|
-
|
|
1147
|
-
enabled:
|
|
1148
|
+
Ln({
|
|
1149
|
+
enabled: Pn(),
|
|
1148
1150
|
isSpeechSupported: e,
|
|
1149
1151
|
isListening: t
|
|
1150
|
-
},
|
|
1152
|
+
}, Rn()) && (In(), n());
|
|
1151
1153
|
}, [e]);
|
|
1152
1154
|
}
|
|
1153
1155
|
// src/components/FileUpload/useFileHandling.ts
|
|
1154
|
-
var
|
|
1156
|
+
var Bn = [
|
|
1155
1157
|
"pdf",
|
|
1156
1158
|
"docx",
|
|
1157
1159
|
"txt",
|
|
1158
1160
|
"md",
|
|
1159
1161
|
"html",
|
|
1160
1162
|
"htm"
|
|
1161
|
-
],
|
|
1163
|
+
], Vn = [
|
|
1162
1164
|
"png",
|
|
1163
1165
|
"jpg",
|
|
1164
1166
|
"jpeg",
|
|
@@ -1167,21 +1169,21 @@ var Fn = [
|
|
|
1167
1169
|
"svg",
|
|
1168
1170
|
"bmp",
|
|
1169
1171
|
"avif"
|
|
1170
|
-
],
|
|
1172
|
+
], Hn = [...Bn, ...Vn], Un = 10, Wn = 52428800, Gn = (e, t) => {
|
|
1171
1173
|
if (e && typeof e == "object") {
|
|
1172
1174
|
let t = e.message ?? e.error ?? e.data?.message;
|
|
1173
1175
|
if (typeof t == "string" && t.length > 0) return t;
|
|
1174
1176
|
}
|
|
1175
1177
|
return typeof e == "string" && e.length > 0 ? e : t;
|
|
1176
1178
|
};
|
|
1177
|
-
function
|
|
1179
|
+
function Kn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles: r, setContextFileIds: i }) {
|
|
1178
1180
|
let [a, o] = O([]), [s, c] = O([]), [l, u] = O(!1), [d, f] = O(!1), p = C(async (e) => {
|
|
1179
1181
|
let a = Array.from(e);
|
|
1180
|
-
a.length >
|
|
1181
|
-
let s = a.filter((e) => e.size >
|
|
1182
|
-
if (s.length > 0 && (
|
|
1182
|
+
a.length > Un && (K.error(`You can attach up to ${Un} files at a time.`), a = a.slice(0, Un));
|
|
1183
|
+
let s = a.filter((e) => e.size > Wn);
|
|
1184
|
+
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 <= Wn)), a.length === 0) return;
|
|
1183
1185
|
let c = a.map((e) => {
|
|
1184
|
-
let t = e.type.startsWith("image/") || /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(e.name), n = e.name.split(".").pop()?.toLowerCase() ?? "", r =
|
|
1186
|
+
let t = e.type.startsWith("image/") || /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(e.name), n = e.name.split(".").pop()?.toLowerCase() ?? "", r = Hn.includes(n);
|
|
1185
1187
|
return {
|
|
1186
1188
|
id: Math.random().toString(36).substr(2, 9),
|
|
1187
1189
|
file: e,
|
|
@@ -1191,7 +1193,7 @@ function Vn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
1191
1193
|
_ext: n
|
|
1192
1194
|
};
|
|
1193
1195
|
});
|
|
1194
|
-
o((e) => [...e, ...c]), c.filter((e) => !
|
|
1196
|
+
o((e) => [...e, ...c]), c.filter((e) => !Hn.includes(e._ext)).forEach((e) => {
|
|
1195
1197
|
setTimeout(() => {
|
|
1196
1198
|
o((t) => t.map((t) => t.id === e.id ? {
|
|
1197
1199
|
...t,
|
|
@@ -1199,16 +1201,16 @@ function Vn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
1199
1201
|
} : t));
|
|
1200
1202
|
}, 600 + Math.random() * 600);
|
|
1201
1203
|
});
|
|
1202
|
-
let l = c.filter((e) =>
|
|
1204
|
+
let l = c.filter((e) => Hn.includes(e._ext));
|
|
1203
1205
|
if (l.length !== 0) try {
|
|
1204
|
-
let { data: e, error: a } = await
|
|
1205
|
-
if (a || !e?.files) throw Error(
|
|
1206
|
+
let { data: e, error: a } = await St({ body: { files: l.map((e) => e.file) } });
|
|
1207
|
+
if (a || !e?.files) throw Error(Gn(a ?? e, "Upload failed."));
|
|
1206
1208
|
o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
|
|
1207
1209
|
...e,
|
|
1208
1210
|
uploadStatus: "complete"
|
|
1209
1211
|
} : e)), r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]);
|
|
1210
1212
|
} catch (e) {
|
|
1211
|
-
|
|
1213
|
+
K.error(Gn(e, "Failed to upload files.")), o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
|
|
1212
1214
|
...e,
|
|
1213
1215
|
uploadStatus: "error"
|
|
1214
1216
|
} : e));
|
|
@@ -1230,7 +1232,7 @@ function Vn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
1230
1232
|
handleFiles: p,
|
|
1231
1233
|
extractUrl: C(async (e) => {
|
|
1232
1234
|
let a = e.trim();
|
|
1233
|
-
if (!/^https?:\/\//i.test(a)) return
|
|
1235
|
+
if (!/^https?:\/\//i.test(a)) return K.error("Enter a valid http(s) URL."), !1;
|
|
1234
1236
|
f(!0);
|
|
1235
1237
|
try {
|
|
1236
1238
|
let e = await (await fetch("/api/doc/uploads", {
|
|
@@ -1238,10 +1240,10 @@ function Vn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
1238
1240
|
headers: { "Content-Type": "application/json" },
|
|
1239
1241
|
body: JSON.stringify({ url: a })
|
|
1240
1242
|
})).json();
|
|
1241
|
-
if (!e?.files || e.files.length === 0) throw Error(
|
|
1242
|
-
return r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]),
|
|
1243
|
+
if (!e?.files || e.files.length === 0) throw Error(Gn(e, `Could not extract content from ${a}`));
|
|
1244
|
+
return r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]), K.success(`Added "${e.files[0].fileName}" as context.`), !0;
|
|
1243
1245
|
} catch (e) {
|
|
1244
|
-
return
|
|
1246
|
+
return K.error(Gn(e, "Failed to extract URL.")), !1;
|
|
1245
1247
|
} finally {
|
|
1246
1248
|
f(!1);
|
|
1247
1249
|
}
|
|
@@ -1287,20 +1289,20 @@ function Vn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
1287
1289
|
};
|
|
1288
1290
|
}
|
|
1289
1291
|
// src/ui/dropdown-menu.tsx
|
|
1290
|
-
function
|
|
1291
|
-
return /* @__PURE__ */ P(
|
|
1292
|
+
function qn({ ...e }) {
|
|
1293
|
+
return /* @__PURE__ */ P(J.Root, {
|
|
1292
1294
|
"data-slot": "dropdown-menu",
|
|
1293
1295
|
...e
|
|
1294
1296
|
});
|
|
1295
1297
|
}
|
|
1296
|
-
function
|
|
1297
|
-
return /* @__PURE__ */ P(
|
|
1298
|
+
function Jn({ ...e }) {
|
|
1299
|
+
return /* @__PURE__ */ P(J.Trigger, {
|
|
1298
1300
|
"data-slot": "dropdown-menu-trigger",
|
|
1299
1301
|
...e
|
|
1300
1302
|
});
|
|
1301
1303
|
}
|
|
1302
|
-
function
|
|
1303
|
-
return /* @__PURE__ */ P(
|
|
1304
|
+
function Yn({ className: e, sideOffset: t = 4, ...n }) {
|
|
1305
|
+
return /* @__PURE__ */ P(J.Portal, { children: /* @__PURE__ */ P(J.Content, {
|
|
1304
1306
|
"data-slot": "dropdown-menu-content",
|
|
1305
1307
|
sideOffset: t,
|
|
1306
1308
|
className: h("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 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl border p-1 shadow-md", e),
|
|
@@ -1308,7 +1310,7 @@ function Wn({ className: e, sideOffset: t = 4, ...n }) {
|
|
|
1308
1310
|
}) });
|
|
1309
1311
|
}
|
|
1310
1312
|
function X({ className: e, inset: t, variant: n = "default", ...r }) {
|
|
1311
|
-
return /* @__PURE__ */ P(
|
|
1313
|
+
return /* @__PURE__ */ P(J.Item, {
|
|
1312
1314
|
"data-slot": "dropdown-menu-item",
|
|
1313
1315
|
"data-inset": t,
|
|
1314
1316
|
"data-variant": n,
|
|
@@ -1316,20 +1318,20 @@ function X({ className: e, inset: t, variant: n = "default", ...r }) {
|
|
|
1316
1318
|
...r
|
|
1317
1319
|
});
|
|
1318
1320
|
}
|
|
1319
|
-
function
|
|
1320
|
-
return /* @__PURE__ */ F(
|
|
1321
|
+
function Xn({ className: e, children: t, checked: n, ...r }) {
|
|
1322
|
+
return /* @__PURE__ */ F(J.CheckboxItem, {
|
|
1321
1323
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
1322
1324
|
className: h("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),
|
|
1323
1325
|
checked: n,
|
|
1324
1326
|
...r,
|
|
1325
1327
|
children: [/* @__PURE__ */ P("span", {
|
|
1326
1328
|
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
1327
|
-
children: /* @__PURE__ */ P(
|
|
1329
|
+
children: /* @__PURE__ */ P(J.ItemIndicator, { children: /* @__PURE__ */ P(re, { className: "size-4" }) })
|
|
1328
1330
|
}), t]
|
|
1329
1331
|
});
|
|
1330
1332
|
}
|
|
1331
|
-
function
|
|
1332
|
-
return /* @__PURE__ */ P(
|
|
1333
|
+
function Zn({ className: e, inset: t, ...n }) {
|
|
1334
|
+
return /* @__PURE__ */ P(J.Label, {
|
|
1333
1335
|
"data-slot": "dropdown-menu-label",
|
|
1334
1336
|
"data-inset": t,
|
|
1335
1337
|
className: h("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", e),
|
|
@@ -1337,60 +1339,60 @@ function Kn({ className: e, inset: t, ...n }) {
|
|
|
1337
1339
|
});
|
|
1338
1340
|
}
|
|
1339
1341
|
function Z({ className: e, ...t }) {
|
|
1340
|
-
return /* @__PURE__ */ P(
|
|
1342
|
+
return /* @__PURE__ */ P(J.Separator, {
|
|
1341
1343
|
"data-slot": "dropdown-menu-separator",
|
|
1342
1344
|
className: h("bg-border -mx-1 my-1 h-px", e),
|
|
1343
1345
|
...t
|
|
1344
1346
|
});
|
|
1345
1347
|
}
|
|
1346
|
-
function
|
|
1347
|
-
return /* @__PURE__ */ P(
|
|
1348
|
+
function Qn({ ...e }) {
|
|
1349
|
+
return /* @__PURE__ */ P(J.Sub, {
|
|
1348
1350
|
"data-slot": "dropdown-menu-sub",
|
|
1349
1351
|
...e
|
|
1350
1352
|
});
|
|
1351
1353
|
}
|
|
1352
|
-
function
|
|
1353
|
-
return /* @__PURE__ */ F(
|
|
1354
|
+
function $n({ className: e, inset: t, children: n, ...r }) {
|
|
1355
|
+
return /* @__PURE__ */ F(J.SubTrigger, {
|
|
1354
1356
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
1355
1357
|
"data-inset": t,
|
|
1356
1358
|
className: h("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-2xl px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8", e),
|
|
1357
1359
|
...r,
|
|
1358
|
-
children: [n, /* @__PURE__ */ P(
|
|
1360
|
+
children: [n, /* @__PURE__ */ P(ae, { className: "ml-auto size-4" })]
|
|
1359
1361
|
});
|
|
1360
1362
|
}
|
|
1361
|
-
function
|
|
1362
|
-
return /* @__PURE__ */ P(
|
|
1363
|
+
function er({ className: e, ...t }) {
|
|
1364
|
+
return /* @__PURE__ */ P(J.SubContent, {
|
|
1363
1365
|
"data-slot": "dropdown-menu-sub-content",
|
|
1364
1366
|
className: h("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),
|
|
1365
1367
|
...t
|
|
1366
1368
|
});
|
|
1367
1369
|
}
|
|
1368
1370
|
// src/components/FileUpload/GoogleDrivePicker.tsx
|
|
1369
|
-
var
|
|
1370
|
-
function
|
|
1371
|
+
var tr = () => window.gapi, nr = () => window.google, rr = null;
|
|
1372
|
+
function ir(e) {
|
|
1371
1373
|
return new Promise((t, n) => {
|
|
1372
1374
|
let r = document.createElement("script");
|
|
1373
1375
|
r.src = e, r.async = !0, r.onload = () => t(), r.onerror = () => n(/* @__PURE__ */ Error(`Failed to load ${e}`)), document.body.appendChild(r);
|
|
1374
1376
|
});
|
|
1375
1377
|
}
|
|
1376
|
-
function
|
|
1377
|
-
if (
|
|
1378
|
-
if (!
|
|
1379
|
-
let e = (
|
|
1380
|
-
|
|
1381
|
-
|
|
1378
|
+
function ar() {
|
|
1379
|
+
if (tr() && nr()?.picker) return Promise.resolve();
|
|
1380
|
+
if (!rr) {
|
|
1381
|
+
let e = (tr() ? Promise.resolve() : ir("https://apis.google.com/js/api.js")).then(() => new Promise((e) => tr().load("client:picker", () => e()))), t = nr()?.picker ? Promise.resolve() : ir("https://www.google.com/jsapi");
|
|
1382
|
+
rr = Promise.all([e, t]).then(() => void 0), rr.catch(() => {
|
|
1383
|
+
rr = null;
|
|
1382
1384
|
});
|
|
1383
1385
|
}
|
|
1384
|
-
return
|
|
1386
|
+
return rr;
|
|
1385
1387
|
}
|
|
1386
|
-
var
|
|
1388
|
+
var or = () => ({ openPicker: async (e, n, r) => {
|
|
1387
1389
|
try {
|
|
1388
|
-
await
|
|
1390
|
+
await ar();
|
|
1389
1391
|
} catch {
|
|
1390
1392
|
r?.("Google Picker API could not be loaded. Please try again.");
|
|
1391
1393
|
return;
|
|
1392
1394
|
}
|
|
1393
|
-
let i =
|
|
1395
|
+
let i = nr();
|
|
1394
1396
|
if (!i?.picker) r?.("Google Picker API not loaded yet. Please try again.");
|
|
1395
1397
|
else try {
|
|
1396
1398
|
let { picker: r } = i, a = new r.PickerBuilder().addView(r.ViewId.DOCS).addView(r.ViewId.DOCS_IMAGES).addView(r.ViewId.DOCS_VIDEOS).addView(new r.DocsView().setIncludeFolders(!0).setMimeTypes("application/pdf,application/vnd.google-apps.document,application/vnd.google-apps.spreadsheet,text/plain,image/jpeg,image/png")).setOAuthToken(e).setDeveloperKey(t.googleApiKey);
|
|
@@ -1405,7 +1407,7 @@ var tr = () => ({ openPicker: async (e, n, r) => {
|
|
|
1405
1407
|
}
|
|
1406
1408
|
} });
|
|
1407
1409
|
// src/icons/IconSearchWeb.tsx
|
|
1408
|
-
function
|
|
1410
|
+
function sr(e) {
|
|
1409
1411
|
return /* @__PURE__ */ F("svg", {
|
|
1410
1412
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1411
1413
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
@@ -1446,7 +1448,7 @@ function nr(e) {
|
|
|
1446
1448
|
});
|
|
1447
1449
|
}
|
|
1448
1450
|
// src/icons/IconSearchNews.tsx
|
|
1449
|
-
function
|
|
1451
|
+
function cr(e) {
|
|
1450
1452
|
return /* @__PURE__ */ F("svg", {
|
|
1451
1453
|
version: "1.1",
|
|
1452
1454
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1521,7 +1523,7 @@ function rr(e) {
|
|
|
1521
1523
|
});
|
|
1522
1524
|
}
|
|
1523
1525
|
// src/icons/IconSearchVideos.tsx
|
|
1524
|
-
function
|
|
1526
|
+
function lr(e) {
|
|
1525
1527
|
return /* @__PURE__ */ F("svg", {
|
|
1526
1528
|
version: "1.1",
|
|
1527
1529
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1761,7 +1763,7 @@ function ir(e) {
|
|
|
1761
1763
|
});
|
|
1762
1764
|
}
|
|
1763
1765
|
// src/icons/IconSearchImages.tsx
|
|
1764
|
-
function
|
|
1766
|
+
function ur(e) {
|
|
1765
1767
|
return /* @__PURE__ */ P("svg", {
|
|
1766
1768
|
width: "800px",
|
|
1767
1769
|
height: "800px",
|
|
@@ -1825,7 +1827,7 @@ function ar(e) {
|
|
|
1825
1827
|
});
|
|
1826
1828
|
}
|
|
1827
1829
|
// src/icons/IconSearchAcademic.tsx
|
|
1828
|
-
function
|
|
1830
|
+
function dr(e) {
|
|
1829
1831
|
return /* @__PURE__ */ F("svg", {
|
|
1830
1832
|
width: "800px",
|
|
1831
1833
|
height: "800px",
|
|
@@ -1870,7 +1872,7 @@ function or(e) {
|
|
|
1870
1872
|
});
|
|
1871
1873
|
}
|
|
1872
1874
|
// src/icons/IconSearchFiles.tsx
|
|
1873
|
-
function
|
|
1875
|
+
function fr(e) {
|
|
1874
1876
|
return /* @__PURE__ */ F("svg", {
|
|
1875
1877
|
height: "800px",
|
|
1876
1878
|
width: "800px",
|
|
@@ -1922,7 +1924,7 @@ function sr(e) {
|
|
|
1922
1924
|
});
|
|
1923
1925
|
}
|
|
1924
1926
|
// src/icons/IconSearchTech.tsx
|
|
1925
|
-
function
|
|
1927
|
+
function pr(e) {
|
|
1926
1928
|
return /* @__PURE__ */ F("svg", {
|
|
1927
1929
|
height: "800px",
|
|
1928
1930
|
width: "800px",
|
|
@@ -2048,49 +2050,49 @@ function cr(e) {
|
|
|
2048
2050
|
});
|
|
2049
2051
|
}
|
|
2050
2052
|
// src/components/SearchConfig/categories.ts
|
|
2051
|
-
var
|
|
2053
|
+
var mr = [
|
|
2052
2054
|
{
|
|
2053
2055
|
code: "general",
|
|
2054
|
-
icon:
|
|
2056
|
+
icon: sr,
|
|
2055
2057
|
name: "Web"
|
|
2056
2058
|
},
|
|
2057
2059
|
{
|
|
2058
2060
|
code: "news",
|
|
2059
|
-
icon:
|
|
2061
|
+
icon: cr,
|
|
2060
2062
|
name: "News"
|
|
2061
2063
|
},
|
|
2062
2064
|
{
|
|
2063
2065
|
code: "videos",
|
|
2064
|
-
icon:
|
|
2066
|
+
icon: lr,
|
|
2065
2067
|
name: "Videos"
|
|
2066
2068
|
},
|
|
2067
2069
|
{
|
|
2068
2070
|
code: "images",
|
|
2069
|
-
icon:
|
|
2071
|
+
icon: ur,
|
|
2070
2072
|
name: "Images"
|
|
2071
2073
|
},
|
|
2072
2074
|
{
|
|
2073
2075
|
code: "science",
|
|
2074
|
-
icon:
|
|
2076
|
+
icon: dr,
|
|
2075
2077
|
name: "Academic"
|
|
2076
2078
|
},
|
|
2077
2079
|
{
|
|
2078
2080
|
code: "files",
|
|
2079
|
-
icon:
|
|
2081
|
+
icon: fr,
|
|
2080
2082
|
name: "Files"
|
|
2081
2083
|
},
|
|
2082
2084
|
{
|
|
2083
2085
|
code: "it",
|
|
2084
|
-
icon:
|
|
2086
|
+
icon: pr,
|
|
2085
2087
|
name: "Tech"
|
|
2086
2088
|
}
|
|
2087
|
-
],
|
|
2089
|
+
], hr = () => {
|
|
2088
2090
|
let { chatModelProvider: e, setChatModelProvider: t } = u(), [n, r] = O([]), [i, a] = O(!0), o = j();
|
|
2089
2091
|
T(() => {
|
|
2090
2092
|
(async () => {
|
|
2091
2093
|
try {
|
|
2092
2094
|
a(!0);
|
|
2093
|
-
let { data: n } = await
|
|
2095
|
+
let { data: n } = await vt(), i = n?.providers ?? [];
|
|
2094
2096
|
if (r(i), !e.key && i.length > 0) {
|
|
2095
2097
|
let e = localStorage.getItem("chatModelKey"), n = localStorage.getItem("chatModelProviderId");
|
|
2096
2098
|
if (e && n) t({
|
|
@@ -2125,27 +2127,27 @@ var lr = [
|
|
|
2125
2127
|
key: n
|
|
2126
2128
|
}), localStorage.setItem("chatModelProviderId", e), localStorage.setItem("chatModelKey", n);
|
|
2127
2129
|
};
|
|
2128
|
-
return /* @__PURE__ */ F(
|
|
2130
|
+
return /* @__PURE__ */ F(Qn, { children: [/* @__PURE__ */ F($n, {
|
|
2129
2131
|
className: "gap-2",
|
|
2130
2132
|
children: [
|
|
2131
|
-
/* @__PURE__ */ P(
|
|
2133
|
+
/* @__PURE__ */ P(de, { className: "w-4 h-4 flex-shrink-0 text-sky-500" }),
|
|
2132
2134
|
/* @__PURE__ */ P("span", { children: "Model" }),
|
|
2133
2135
|
/* @__PURE__ */ P("span", {
|
|
2134
2136
|
className: "ml-auto text-xs text-muted-foreground truncate max-w-[55px]",
|
|
2135
2137
|
children: s
|
|
2136
2138
|
})
|
|
2137
2139
|
]
|
|
2138
|
-
}), /* @__PURE__ */ F(
|
|
2140
|
+
}), /* @__PURE__ */ F(er, {
|
|
2139
2141
|
className: "w-52 max-h-[400px] overflow-y-auto",
|
|
2140
2142
|
children: [
|
|
2141
2143
|
i ? /* @__PURE__ */ P("div", {
|
|
2142
2144
|
className: "flex items-center justify-center py-4",
|
|
2143
|
-
children: /* @__PURE__ */ P(
|
|
2145
|
+
children: /* @__PURE__ */ P(G, { className: "h-4 w-4 animate-spin text-muted-foreground" })
|
|
2144
2146
|
}) : n.length === 0 ? /* @__PURE__ */ P("div", {
|
|
2145
2147
|
className: "px-3 py-2 text-xs text-muted-foreground",
|
|
2146
2148
|
children: "No models configured"
|
|
2147
2149
|
}) : n.map((t, r) => /* @__PURE__ */ F("div", { children: [
|
|
2148
|
-
/* @__PURE__ */ P(
|
|
2150
|
+
/* @__PURE__ */ P(Zn, {
|
|
2149
2151
|
className: "text-[10px] uppercase tracking-wider text-muted-foreground font-medium",
|
|
2150
2152
|
children: t.name
|
|
2151
2153
|
}),
|
|
@@ -2153,7 +2155,7 @@ var lr = [
|
|
|
2153
2155
|
onSelect: () => c(t.id, n.key),
|
|
2154
2156
|
className: h("gap-2", e?.providerId === t.id && e?.key === n.key && "bg-secondary"),
|
|
2155
2157
|
children: [
|
|
2156
|
-
/* @__PURE__ */ P(
|
|
2158
|
+
/* @__PURE__ */ P(de, { className: h("h-3.5 w-3.5 flex-shrink-0", e?.providerId === t.id && e?.key === n.key ? "text-sky-500" : "text-muted-foreground") }),
|
|
2157
2159
|
/* @__PURE__ */ P("span", {
|
|
2158
2160
|
className: "truncate",
|
|
2159
2161
|
children: n.name
|
|
@@ -2178,13 +2180,13 @@ var lr = [
|
|
|
2178
2180
|
/* @__PURE__ */ F(X, {
|
|
2179
2181
|
onSelect: () => o.push("/settings?section=models"),
|
|
2180
2182
|
className: "gap-2",
|
|
2181
|
-
children: [/* @__PURE__ */ P(
|
|
2183
|
+
children: [/* @__PURE__ */ P(Be, { className: "h-3.5 w-3.5 text-sky-500 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Add model" })]
|
|
2182
2184
|
})
|
|
2183
2185
|
]
|
|
2184
2186
|
})] });
|
|
2185
2187
|
};
|
|
2186
2188
|
// src/components/ChatHistoryDropdown/useRecentChats.ts
|
|
2187
|
-
function
|
|
2189
|
+
function gr(e) {
|
|
2188
2190
|
let t = e.messages?.[e.messages.length - 1], n = t && "createdAt" in t ? t.createdAt : void 0;
|
|
2189
2191
|
if (n) {
|
|
2190
2192
|
let e = new Date(n).getTime();
|
|
@@ -2192,27 +2194,27 @@ function dr(e) {
|
|
|
2192
2194
|
}
|
|
2193
2195
|
return e.createdAt;
|
|
2194
2196
|
}
|
|
2195
|
-
var
|
|
2196
|
-
function
|
|
2197
|
-
return
|
|
2197
|
+
var _r = (e) => new Date(e.lastMessageAt || e.createdAt).getTime();
|
|
2198
|
+
function vr() {
|
|
2199
|
+
return dn().map((e) => ({
|
|
2198
2200
|
...e,
|
|
2199
2201
|
messageCount: e.messages?.filter((e) => e.role === "user").length ?? 0,
|
|
2200
|
-
lastMessageAt:
|
|
2202
|
+
lastMessageAt: gr(e)
|
|
2201
2203
|
}));
|
|
2202
2204
|
}
|
|
2203
|
-
function
|
|
2205
|
+
function yr(e = 10) {
|
|
2204
2206
|
let [t, r] = O([]), [i, a] = O(!1), { isAuthenticated: o, isLoading: s } = n(), c = D(!1), l = C(async (e = !1) => {
|
|
2205
2207
|
if (!s && (!c.current || e)) {
|
|
2206
2208
|
c.current = !0, a(!0);
|
|
2207
2209
|
try {
|
|
2208
2210
|
if (o) {
|
|
2209
|
-
let { data: e, error: t } = await
|
|
2211
|
+
let { data: e, error: t } = await _t();
|
|
2210
2212
|
if (t) {
|
|
2211
|
-
r(
|
|
2213
|
+
r(vr());
|
|
2212
2214
|
return;
|
|
2213
2215
|
}
|
|
2214
2216
|
r(Array.isArray(e?.chats) ? e.chats : []);
|
|
2215
|
-
} else r(
|
|
2217
|
+
} else r(vr());
|
|
2216
2218
|
} catch (e) {
|
|
2217
2219
|
console.error("Failed to fetch recent chats:", e), r([]);
|
|
2218
2220
|
} finally {
|
|
@@ -2221,13 +2223,13 @@ function mr(e = 10) {
|
|
|
2221
2223
|
}
|
|
2222
2224
|
}, [o, s]);
|
|
2223
2225
|
return {
|
|
2224
|
-
recentChats: [...t].sort((e, t) =>
|
|
2226
|
+
recentChats: [...t].sort((e, t) => _r(t) - _r(e)).slice(0, e),
|
|
2225
2227
|
loading: i,
|
|
2226
2228
|
load: l
|
|
2227
2229
|
};
|
|
2228
2230
|
}
|
|
2229
2231
|
// src/lib/relative-time.ts
|
|
2230
|
-
function
|
|
2232
|
+
function br(e) {
|
|
2231
2233
|
let t = new Date(e).getTime();
|
|
2232
2234
|
if (Number.isNaN(t)) return "";
|
|
2233
2235
|
let n = Math.round((Date.now() - t) / 1e3);
|
|
@@ -2247,34 +2249,34 @@ function hr(e) {
|
|
|
2247
2249
|
return `${c} year${c === 1 ? "" : "s"}`;
|
|
2248
2250
|
}
|
|
2249
2251
|
// src/components/ChatHistoryDropdown/HistorySubmenu.tsx
|
|
2250
|
-
var
|
|
2251
|
-
let e = j(), { incognito: n, setIncognito: r } = u(), { recentChats: i, loading: a, load: o } =
|
|
2252
|
-
r(e),
|
|
2252
|
+
var xr = 10, Sr = () => {
|
|
2253
|
+
let e = j(), { incognito: n, setIncognito: r } = u(), { recentChats: i, loading: a, load: o } = yr(xr), s = (e) => {
|
|
2254
|
+
r(e), K.success(e ? "Private mode on — messages won't be saved" : "Private mode off");
|
|
2253
2255
|
}, c = (n) => {
|
|
2254
2256
|
t.onOpenChat?.(n) || e.push(`/c/${n}`);
|
|
2255
2257
|
};
|
|
2256
|
-
return /* @__PURE__ */ F(
|
|
2258
|
+
return /* @__PURE__ */ F(Qn, {
|
|
2257
2259
|
onOpenChange: (e) => {
|
|
2258
2260
|
e && o();
|
|
2259
2261
|
},
|
|
2260
|
-
children: [/* @__PURE__ */ F(
|
|
2262
|
+
children: [/* @__PURE__ */ F($n, {
|
|
2261
2263
|
className: "gap-2",
|
|
2262
|
-
children: [/* @__PURE__ */ P(
|
|
2263
|
-
}), /* @__PURE__ */ F(
|
|
2264
|
+
children: [/* @__PURE__ */ P(we, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "History" })]
|
|
2265
|
+
}), /* @__PURE__ */ F(er, {
|
|
2264
2266
|
className: "w-64 max-h-[70vh] overflow-y-auto",
|
|
2265
2267
|
children: [
|
|
2266
|
-
/* @__PURE__ */ F(
|
|
2268
|
+
/* @__PURE__ */ F(Xn, {
|
|
2267
2269
|
checked: n,
|
|
2268
2270
|
onCheckedChange: s,
|
|
2269
2271
|
onSelect: (e) => e.preventDefault(),
|
|
2270
2272
|
className: "gap-2",
|
|
2271
|
-
children: [/* @__PURE__ */ P(
|
|
2273
|
+
children: [/* @__PURE__ */ P(me, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "Private" })]
|
|
2272
2274
|
}),
|
|
2273
2275
|
/* @__PURE__ */ P(Z, {}),
|
|
2274
2276
|
a ? /* @__PURE__ */ F(X, {
|
|
2275
2277
|
disabled: !0,
|
|
2276
2278
|
className: "gap-2",
|
|
2277
|
-
children: [/* @__PURE__ */ P(
|
|
2279
|
+
children: [/* @__PURE__ */ P(G, { className: "w-3.5 h-3.5 animate-spin flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Loading…" })]
|
|
2278
2280
|
}) : i.length === 0 ? /* @__PURE__ */ P(X, {
|
|
2279
2281
|
disabled: !0,
|
|
2280
2282
|
children: /* @__PURE__ */ P("span", {
|
|
@@ -2282,7 +2284,7 @@ var gr = 10, _r = () => {
|
|
|
2282
2284
|
children: "No recent chats"
|
|
2283
2285
|
})
|
|
2284
2286
|
}) : i.map((e) => {
|
|
2285
|
-
let t =
|
|
2287
|
+
let t = br(e.lastMessageAt || e.createdAt);
|
|
2286
2288
|
return /* @__PURE__ */ F(X, {
|
|
2287
2289
|
onSelect: () => c(e.id),
|
|
2288
2290
|
className: "gap-2",
|
|
@@ -2300,15 +2302,15 @@ var gr = 10, _r = () => {
|
|
|
2300
2302
|
/* @__PURE__ */ F(X, {
|
|
2301
2303
|
onSelect: () => e.push("/library"),
|
|
2302
2304
|
className: "gap-2",
|
|
2303
|
-
children: [/* @__PURE__ */ P(
|
|
2305
|
+
children: [/* @__PURE__ */ P(we, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "All history" })]
|
|
2304
2306
|
})
|
|
2305
2307
|
]
|
|
2306
2308
|
})]
|
|
2307
2309
|
});
|
|
2308
|
-
},
|
|
2309
|
-
function
|
|
2310
|
+
}, Cr = /* @__PURE__ */ new Map();
|
|
2311
|
+
function wr(e) {
|
|
2310
2312
|
if (typeof window > "u") return Promise.reject(/* @__PURE__ */ Error("CDN scripts require a browser environment"));
|
|
2311
|
-
let t =
|
|
2313
|
+
let t = Cr.get(e);
|
|
2312
2314
|
if (t) return t;
|
|
2313
2315
|
let n = new Promise((t, n) => {
|
|
2314
2316
|
let r = document.querySelector(`script[data-cdn-loader="${e}"]`);
|
|
@@ -2320,34 +2322,34 @@ function yr(e) {
|
|
|
2320
2322
|
i.src = e, i.async = !0, i.dataset.cdnLoader = e, i.onload = () => {
|
|
2321
2323
|
i.dataset.loaded = "true", t();
|
|
2322
2324
|
}, i.onerror = () => {
|
|
2323
|
-
|
|
2325
|
+
Cr.delete(e), n(/* @__PURE__ */ Error(`Failed to load ${e}`));
|
|
2324
2326
|
}, document.head.appendChild(i);
|
|
2325
2327
|
});
|
|
2326
|
-
return
|
|
2328
|
+
return Cr.set(e, n), n;
|
|
2327
2329
|
}
|
|
2328
|
-
var
|
|
2329
|
-
async function
|
|
2330
|
-
await
|
|
2330
|
+
var Tr = "https://cdn.jsdelivr.net/npm/jspdf@2.5.2/dist/jspdf.umd.min.js", Er = "https://cdn.jsdelivr.net/npm/docx@9.5.1/build/index.umd.min.js";
|
|
2331
|
+
async function Dr() {
|
|
2332
|
+
await wr(Tr);
|
|
2331
2333
|
let e = window.jspdf?.jsPDF;
|
|
2332
2334
|
if (!e) throw Error("jsPDF global not found after CDN load");
|
|
2333
2335
|
return e;
|
|
2334
2336
|
}
|
|
2335
|
-
async function
|
|
2336
|
-
await
|
|
2337
|
+
async function Or() {
|
|
2338
|
+
await wr(Er);
|
|
2337
2339
|
let e = window.docx;
|
|
2338
2340
|
if (!e) throw Error("docx global not found after CDN load");
|
|
2339
2341
|
return e;
|
|
2340
2342
|
}
|
|
2341
2343
|
// src/lib/export.ts
|
|
2342
|
-
async function
|
|
2344
|
+
async function kr(e, t) {
|
|
2343
2345
|
let { default: n } = await import("turndown");
|
|
2344
|
-
|
|
2346
|
+
Nr(`# ${e}\n\n${new n({
|
|
2345
2347
|
headingStyle: "atx",
|
|
2346
2348
|
codeBlockStyle: "fenced"
|
|
2347
2349
|
}).turndown(t)}`, `${e}.md`, "text/markdown");
|
|
2348
2350
|
}
|
|
2349
|
-
async function
|
|
2350
|
-
let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await
|
|
2351
|
+
async function Ar(e, t) {
|
|
2352
|
+
let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await Or(), s = new DOMParser().parseFromString(t, "text/html"), c = [];
|
|
2351
2353
|
c.push(new r({
|
|
2352
2354
|
text: e,
|
|
2353
2355
|
heading: a.HEADING_1,
|
|
@@ -2421,14 +2423,14 @@ async function Tr(e, t) {
|
|
|
2421
2423
|
}] }), d = await o.toBlob(u), f = URL.createObjectURL(d), p = document.createElement("a");
|
|
2422
2424
|
p.href = f, p.download = `${e}.docx`, p.click(), URL.revokeObjectURL(f);
|
|
2423
2425
|
}
|
|
2424
|
-
async function
|
|
2426
|
+
async function jr(e, t) {
|
|
2425
2427
|
let n = document.createElement("div");
|
|
2426
2428
|
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 = `
|
|
2427
2429
|
<h1 style="font-size: 24pt; margin-bottom: 20px;">${e}</h1>
|
|
2428
2430
|
${t}
|
|
2429
2431
|
`, document.body.appendChild(n);
|
|
2430
2432
|
try {
|
|
2431
|
-
let [t, { default: r }] = await Promise.all([
|
|
2433
|
+
let [t, { default: r }] = await Promise.all([Dr(), import("html2canvas")]), i = await r(n, {
|
|
2432
2434
|
scale: 2,
|
|
2433
2435
|
useCORS: !0,
|
|
2434
2436
|
logging: !1
|
|
@@ -2443,7 +2445,7 @@ async function Er(e, t) {
|
|
|
2443
2445
|
document.body.removeChild(n);
|
|
2444
2446
|
}
|
|
2445
2447
|
}
|
|
2446
|
-
async function
|
|
2448
|
+
async function Mr(e, t) {
|
|
2447
2449
|
try {
|
|
2448
2450
|
let { default: n } = await import("turndown"), r = `${e}\n\n${new n().turndown(t)}`;
|
|
2449
2451
|
await navigator.clipboard.writeText(r), window.open("https://docs.google.com/document/create", "_blank"), alert("Content copied to clipboard! Paste it into the new Google Doc.");
|
|
@@ -2451,12 +2453,12 @@ async function Dr(e, t) {
|
|
|
2451
2453
|
console.error("Failed to export to Google Docs:", e), alert("Failed to copy content to clipboard. Please try again.");
|
|
2452
2454
|
}
|
|
2453
2455
|
}
|
|
2454
|
-
function
|
|
2456
|
+
function Nr(e, t, n) {
|
|
2455
2457
|
let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
2456
2458
|
a.href = i, a.download = t, a.click(), URL.revokeObjectURL(i);
|
|
2457
2459
|
}
|
|
2458
2460
|
// src/components/FileUpload/FileUploadDropdown.tsx
|
|
2459
|
-
var
|
|
2461
|
+
var Pr = [
|
|
2460
2462
|
{
|
|
2461
2463
|
label: "5s",
|
|
2462
2464
|
value: 5
|
|
@@ -2481,28 +2483,28 @@ var kr = [
|
|
|
2481
2483
|
label: "Unlimited",
|
|
2482
2484
|
value: 0
|
|
2483
2485
|
}
|
|
2484
|
-
],
|
|
2486
|
+
], Fr = [
|
|
2485
2487
|
"pdf",
|
|
2486
2488
|
"docx",
|
|
2487
2489
|
"txt",
|
|
2488
2490
|
"md",
|
|
2489
2491
|
"html",
|
|
2490
2492
|
"htm"
|
|
2491
|
-
],
|
|
2492
|
-
let i = j(), { category: a, setCategory: o, sections: s, chatId: c } = u(), { isAuthenticated: l } = n(), d = a ? a.split(",").filter(Boolean) : ["general"], f =
|
|
2493
|
+
], Ir = /* @__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("."), Lr = ({ onFileSelect: e, disabled: r = !1 }) => {
|
|
2494
|
+
let i = j(), { category: a, setCategory: o, sections: s, chatId: c } = u(), { isAuthenticated: l } = n(), d = a ? a.split(",").filter(Boolean) : ["general"], f = mr.find((e) => e.code === d[0]) || mr[0], p = (e) => {
|
|
2493
2495
|
let t = a ? a.split(",").filter(Boolean) : ["general"], n = t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
|
|
2494
2496
|
o(n.length > 0 ? n.join(",") : "general");
|
|
2495
2497
|
}, [m, g] = O(!1), [_, y] = O(!1), [b, x] = O(!1), [S, C] = O(!1), [w, E] = O(() => {
|
|
2496
2498
|
if (typeof window > "u") return 5;
|
|
2497
2499
|
let e = Number(localStorage.getItem("thinkingTimeLimit") ?? "5");
|
|
2498
2500
|
return Number.isFinite(e) ? e : 5;
|
|
2499
|
-
}), D = v.useRef(null), { openPicker: k } =
|
|
2501
|
+
}), D = v.useRef(null), { openPicker: k } = or();
|
|
2500
2502
|
T(() => {
|
|
2501
2503
|
A();
|
|
2502
2504
|
}, []);
|
|
2503
2505
|
let A = async () => {
|
|
2504
2506
|
try {
|
|
2505
|
-
let { data: e } = await
|
|
2507
|
+
let { data: e } = await gt();
|
|
2506
2508
|
g(e?.isConnected || !1);
|
|
2507
2509
|
} catch {}
|
|
2508
2510
|
}, M = (e) => {
|
|
@@ -2540,8 +2542,8 @@ var kr = [
|
|
|
2540
2542
|
let n = [];
|
|
2541
2543
|
for await (let r of e.values()) if (r.kind === "file") {
|
|
2542
2544
|
let e = await r.getFile(), i = e.name.split(".").pop()?.toLowerCase() ?? "";
|
|
2543
|
-
if (
|
|
2544
|
-
else if (
|
|
2545
|
+
if (Fr.includes(i)) n.push(e);
|
|
2546
|
+
else if (Ir.includes(i)) try {
|
|
2545
2547
|
let r = await e.text(), i = t ? `${t}/${e.name}` : e.name;
|
|
2546
2548
|
n.push(new File([r], `${i.replace(/[/\\]/g, "_")}.txt`, { type: "text/plain" }));
|
|
2547
2549
|
} catch {}
|
|
@@ -2568,7 +2570,7 @@ var kr = [
|
|
|
2568
2570
|
}, z = async () => {
|
|
2569
2571
|
y(!0);
|
|
2570
2572
|
try {
|
|
2571
|
-
let { data: e } = await
|
|
2573
|
+
let { data: e } = await ht();
|
|
2572
2574
|
if (e?.success && e?.data?.authUrl) {
|
|
2573
2575
|
let t = e.data.authUrl, n = window.screenX + (window.outerWidth - 600) / 2, r = window.screenY + (window.outerHeight - 700) / 2, i = window.open(t, "Google Drive Authorization", `width=600,height=700,left=${n},top=${r}`), a = (e) => {
|
|
2574
2576
|
e.data.type === "google-drive-connected" && (g(!0), i?.close(), window.removeEventListener("message", a));
|
|
@@ -2582,14 +2584,14 @@ var kr = [
|
|
|
2582
2584
|
}
|
|
2583
2585
|
}, B = async () => {
|
|
2584
2586
|
try {
|
|
2585
|
-
let { data: t } = await
|
|
2587
|
+
let { data: t } = await mt();
|
|
2586
2588
|
if (!t?.success || !t.accessToken) throw Error("Failed to get access token");
|
|
2587
2589
|
await k(t.accessToken, async (t) => {
|
|
2588
2590
|
x(!0);
|
|
2589
2591
|
try {
|
|
2590
2592
|
let n = [];
|
|
2591
2593
|
for (let e of t) {
|
|
2592
|
-
let { data: t } = await
|
|
2594
|
+
let { data: t } = await pt({ query: { fileId: e.id } });
|
|
2593
2595
|
if (t?.success && t?.file) {
|
|
2594
2596
|
let e = atob(t.file.content), r = new Uint8Array(e.length);
|
|
2595
2597
|
for (let t = 0; t < e.length; t++) r[t] = e.charCodeAt(t);
|
|
@@ -2608,32 +2610,32 @@ var kr = [
|
|
|
2608
2610
|
} catch (e) {
|
|
2609
2611
|
alert(e.message || "Failed to open Google Drive picker");
|
|
2610
2612
|
}
|
|
2611
|
-
}, V =
|
|
2613
|
+
}, V = Pr.find((e) => e.value === w)?.label ?? "Unlimited";
|
|
2612
2614
|
return /* @__PURE__ */ F(N, { children: [
|
|
2613
2615
|
/* @__PURE__ */ F("div", {
|
|
2614
2616
|
className: "relative flex shrink min-w-8 !shrink-0 group",
|
|
2615
|
-
children: [/* @__PURE__ */ F(
|
|
2617
|
+
children: [/* @__PURE__ */ F(qn, { children: [/* @__PURE__ */ P(Jn, {
|
|
2616
2618
|
asChild: !0,
|
|
2617
2619
|
children: /* @__PURE__ */ P("button", {
|
|
2618
2620
|
disabled: r,
|
|
2619
2621
|
className: "inline-flex items-center justify-center relative shrink-0 transition-colors duration-200 h-8 w-8 rounded-lg active:scale-95 text-text-400 hover:text-text-200 hover:bg-bg-200 disabled:opacity-50 disabled:cursor-not-allowed group-active:scale-95",
|
|
2620
2622
|
type: "button",
|
|
2621
2623
|
"aria-label": "Search options",
|
|
2622
|
-
children: /* @__PURE__ */ P(
|
|
2624
|
+
children: /* @__PURE__ */ P(Ge, { className: "w-5 h-5" })
|
|
2623
2625
|
})
|
|
2624
|
-
}), /* @__PURE__ */ F(
|
|
2626
|
+
}), /* @__PURE__ */ F(Yn, {
|
|
2625
2627
|
align: "start",
|
|
2626
2628
|
side: "top",
|
|
2627
2629
|
sideOffset: 8,
|
|
2628
2630
|
className: "w-44",
|
|
2629
2631
|
children: [
|
|
2630
|
-
/* @__PURE__ */ F(
|
|
2632
|
+
/* @__PURE__ */ F(Qn, { children: [/* @__PURE__ */ F($n, {
|
|
2631
2633
|
className: "gap-2",
|
|
2632
2634
|
children: [f && /* @__PURE__ */ P(f.icon, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Category" })]
|
|
2633
|
-
}), /* @__PURE__ */ F(
|
|
2635
|
+
}), /* @__PURE__ */ F(er, {
|
|
2634
2636
|
className: "w-44",
|
|
2635
2637
|
children: [
|
|
2636
|
-
/* @__PURE__ */ F(
|
|
2638
|
+
/* @__PURE__ */ F(Xn, {
|
|
2637
2639
|
checked: d.length === 0,
|
|
2638
2640
|
onCheckedChange: () => o("general"),
|
|
2639
2641
|
onSelect: (e) => e.preventDefault(),
|
|
@@ -2641,7 +2643,7 @@ var kr = [
|
|
|
2641
2643
|
children: [/* @__PURE__ */ P("div", { className: "w-3.5 h-3.5 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "None" })]
|
|
2642
2644
|
}),
|
|
2643
2645
|
/* @__PURE__ */ P(Z, {}),
|
|
2644
|
-
|
|
2646
|
+
mr.map((e) => /* @__PURE__ */ F(Xn, {
|
|
2645
2647
|
checked: d.includes(e.code),
|
|
2646
2648
|
onCheckedChange: () => p(e.code),
|
|
2647
2649
|
onSelect: (e) => e.preventDefault(),
|
|
@@ -2650,19 +2652,19 @@ var kr = [
|
|
|
2650
2652
|
}, e.code))
|
|
2651
2653
|
]
|
|
2652
2654
|
})] }),
|
|
2653
|
-
/* @__PURE__ */ F(
|
|
2655
|
+
/* @__PURE__ */ F(Qn, { children: [/* @__PURE__ */ F($n, {
|
|
2654
2656
|
className: "gap-2",
|
|
2655
2657
|
children: [
|
|
2656
|
-
/* @__PURE__ */ P(
|
|
2658
|
+
/* @__PURE__ */ P(se, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }),
|
|
2657
2659
|
/* @__PURE__ */ P("span", { children: "Speed" }),
|
|
2658
2660
|
/* @__PURE__ */ P("span", {
|
|
2659
2661
|
className: "ml-auto text-xs text-muted-foreground",
|
|
2660
2662
|
children: V
|
|
2661
2663
|
})
|
|
2662
2664
|
]
|
|
2663
|
-
}), /* @__PURE__ */ P(
|
|
2665
|
+
}), /* @__PURE__ */ P(er, {
|
|
2664
2666
|
className: "w-36",
|
|
2665
|
-
children:
|
|
2667
|
+
children: Pr.map((e) => /* @__PURE__ */ F(X, {
|
|
2666
2668
|
onSelect: () => M(e.value),
|
|
2667
2669
|
className: h("justify-between", w === e.value && "bg-secondary"),
|
|
2668
2670
|
children: [/* @__PURE__ */ P("span", { children: e.label }), w === e.value && /* @__PURE__ */ P("svg", {
|
|
@@ -2680,27 +2682,27 @@ var kr = [
|
|
|
2680
2682
|
}, e.value))
|
|
2681
2683
|
})] }),
|
|
2682
2684
|
/* @__PURE__ */ P(Z, {}),
|
|
2683
|
-
/* @__PURE__ */ P(
|
|
2685
|
+
/* @__PURE__ */ P(hr, {}),
|
|
2684
2686
|
/* @__PURE__ */ P(Z, {}),
|
|
2685
|
-
/* @__PURE__ */ F(
|
|
2687
|
+
/* @__PURE__ */ F(Qn, { children: [/* @__PURE__ */ F($n, {
|
|
2686
2688
|
className: "gap-2",
|
|
2687
|
-
children: [/* @__PURE__ */ P(
|
|
2688
|
-
}), /* @__PURE__ */ F(
|
|
2689
|
+
children: [/* @__PURE__ */ P(et, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "Upload" })]
|
|
2690
|
+
}), /* @__PURE__ */ F(er, {
|
|
2689
2691
|
className: "w-44",
|
|
2690
2692
|
children: [
|
|
2691
2693
|
/* @__PURE__ */ F(X, {
|
|
2692
2694
|
onSelect: I,
|
|
2693
2695
|
className: "gap-2",
|
|
2694
|
-
children: [/* @__PURE__ */ P(
|
|
2696
|
+
children: [/* @__PURE__ */ P(et, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Your Device" })]
|
|
2695
2697
|
}),
|
|
2696
2698
|
/* @__PURE__ */ F(X, {
|
|
2697
2699
|
onSelect: R,
|
|
2698
2700
|
disabled: S,
|
|
2699
2701
|
className: "gap-2",
|
|
2700
|
-
children: [S ? /* @__PURE__ */ P(
|
|
2702
|
+
children: [S ? /* @__PURE__ */ P(G, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ P(be, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: S ? "Scanning…" : "Local Folder" })]
|
|
2701
2703
|
}),
|
|
2702
2704
|
/* @__PURE__ */ P(Z, {}),
|
|
2703
|
-
/* @__PURE__ */ P(
|
|
2705
|
+
/* @__PURE__ */ P(Zn, {
|
|
2704
2706
|
className: "text-xs font-normal text-muted-foreground",
|
|
2705
2707
|
children: "Cloud"
|
|
2706
2708
|
}),
|
|
@@ -2708,44 +2710,44 @@ var kr = [
|
|
|
2708
2710
|
onSelect: B,
|
|
2709
2711
|
disabled: b,
|
|
2710
2712
|
className: "gap-2",
|
|
2711
|
-
children: [b ? /* @__PURE__ */ P(
|
|
2713
|
+
children: [b ? /* @__PURE__ */ P(G, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ P(le, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: b ? "Loading…" : "Google Drive" })]
|
|
2712
2714
|
}) : /* @__PURE__ */ F(X, {
|
|
2713
2715
|
onSelect: z,
|
|
2714
2716
|
disabled: _,
|
|
2715
2717
|
className: "gap-2",
|
|
2716
|
-
children: [_ ? /* @__PURE__ */ P(
|
|
2718
|
+
children: [_ ? /* @__PURE__ */ P(G, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ P(le, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: _ ? "Connecting…" : "Connect Google Drive" })]
|
|
2717
2719
|
})
|
|
2718
2720
|
]
|
|
2719
2721
|
})] }),
|
|
2720
2722
|
/* @__PURE__ */ P(Z, {}),
|
|
2721
|
-
s.length > 0 && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ F(
|
|
2723
|
+
s.length > 0 && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ F(Qn, { children: [/* @__PURE__ */ F($n, {
|
|
2722
2724
|
className: "gap-2",
|
|
2723
|
-
children: [/* @__PURE__ */ P(
|
|
2724
|
-
}), /* @__PURE__ */ F(
|
|
2725
|
+
children: [/* @__PURE__ */ P(We, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "Share" })]
|
|
2726
|
+
}), /* @__PURE__ */ F(er, {
|
|
2725
2727
|
className: "w-48",
|
|
2726
2728
|
children: [
|
|
2727
2729
|
/* @__PURE__ */ F(X, {
|
|
2728
2730
|
onSelect: async () => {
|
|
2729
|
-
if (!c)
|
|
2730
|
-
else if (!l)
|
|
2731
|
+
if (!c) K.error("No chat to share");
|
|
2732
|
+
else if (!l) K.error("Please sign in to share chats");
|
|
2731
2733
|
else try {
|
|
2732
|
-
let { data: e, error: t } = await
|
|
2733
|
-
if (!t && e?.success && e?.data?.shareUrl) await navigator.clipboard.writeText(e.data.shareUrl),
|
|
2734
|
+
let { data: e, error: t } = await xt({ body: { chatId: c } });
|
|
2735
|
+
if (!t && e?.success && e?.data?.shareUrl) await navigator.clipboard.writeText(e.data.shareUrl), K.success("Chat is now public - link copied to clipboard");
|
|
2734
2736
|
else throw Error(t?.error || "Failed to share chat");
|
|
2735
2737
|
} catch (e) {
|
|
2736
2738
|
console.error("Error sharing chat:", e);
|
|
2737
2739
|
let t = e instanceof Error ? e.message : "Failed to share chat";
|
|
2738
|
-
|
|
2740
|
+
K.error(t);
|
|
2739
2741
|
}
|
|
2740
2742
|
},
|
|
2741
2743
|
className: "gap-2",
|
|
2742
|
-
children: [/* @__PURE__ */ P(
|
|
2744
|
+
children: [/* @__PURE__ */ P(De, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Copy link" })]
|
|
2743
2745
|
}),
|
|
2744
2746
|
/* @__PURE__ */ F(X, {
|
|
2745
2747
|
onSelect: async () => {
|
|
2746
2748
|
let e = s[0]?.userMessage?.content || "Chat", t = s.map((e) => `## ${e.userMessage.content}\n\n${e.assistantMessage?.content || ""}`).join("\n\n---\n\n");
|
|
2747
2749
|
try {
|
|
2748
|
-
await
|
|
2750
|
+
await ct({ body: {
|
|
2749
2751
|
title: e,
|
|
2750
2752
|
name: e,
|
|
2751
2753
|
content: t,
|
|
@@ -2753,9 +2755,9 @@ var kr = [
|
|
|
2753
2755
|
source: "chat",
|
|
2754
2756
|
chatId: window.location.pathname
|
|
2755
2757
|
}
|
|
2756
|
-
} }),
|
|
2758
|
+
} }), K.success("Saved to QwkDocs");
|
|
2757
2759
|
} catch {
|
|
2758
|
-
|
|
2760
|
+
K.error("Failed to save to QwkDocs");
|
|
2759
2761
|
}
|
|
2760
2762
|
},
|
|
2761
2763
|
className: "gap-2",
|
|
@@ -2764,41 +2766,41 @@ var kr = [
|
|
|
2764
2766
|
/* @__PURE__ */ P(Z, {}),
|
|
2765
2767
|
/* @__PURE__ */ F(X, {
|
|
2766
2768
|
onSelect: () => {
|
|
2767
|
-
|
|
2769
|
+
kr(s[0]?.userMessage?.content || "Chat", s.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
2768
2770
|
},
|
|
2769
2771
|
className: "gap-2",
|
|
2770
|
-
children: [/* @__PURE__ */ P(
|
|
2772
|
+
children: [/* @__PURE__ */ P(ve, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Export as Markdown" })]
|
|
2771
2773
|
}),
|
|
2772
2774
|
/* @__PURE__ */ F(X, {
|
|
2773
2775
|
onSelect: () => {
|
|
2774
|
-
|
|
2776
|
+
jr(s[0]?.userMessage?.content || "Chat", s.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
2775
2777
|
},
|
|
2776
2778
|
className: "gap-2",
|
|
2777
|
-
children: [/* @__PURE__ */ P(
|
|
2779
|
+
children: [/* @__PURE__ */ P(ye, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Export as PDF" })]
|
|
2778
2780
|
}),
|
|
2779
2781
|
/* @__PURE__ */ F(X, {
|
|
2780
2782
|
onSelect: () => {
|
|
2781
|
-
|
|
2783
|
+
Ar(s[0]?.userMessage?.content || "Chat", s.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
2782
2784
|
},
|
|
2783
2785
|
className: "gap-2",
|
|
2784
|
-
children: [/* @__PURE__ */ P(
|
|
2786
|
+
children: [/* @__PURE__ */ P(ge, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Export as DOCX" })]
|
|
2785
2787
|
}),
|
|
2786
2788
|
/* @__PURE__ */ F(X, {
|
|
2787
2789
|
onSelect: () => {
|
|
2788
|
-
|
|
2790
|
+
Mr(s[0]?.userMessage?.content || "Chat", s.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
2789
2791
|
},
|
|
2790
2792
|
className: "gap-2",
|
|
2791
|
-
children: [/* @__PURE__ */ P(
|
|
2793
|
+
children: [/* @__PURE__ */ P(_e, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Export to Google Docs" })]
|
|
2792
2794
|
})
|
|
2793
2795
|
]
|
|
2794
2796
|
})] }), /* @__PURE__ */ P(Z, {})] }),
|
|
2795
|
-
/* @__PURE__ */ P(
|
|
2797
|
+
/* @__PURE__ */ P(Sr, {}),
|
|
2796
2798
|
/* @__PURE__ */ F(X, {
|
|
2797
2799
|
onSelect: () => {
|
|
2798
2800
|
t.onOpenSettings?.() || i.push("/settings");
|
|
2799
2801
|
},
|
|
2800
2802
|
className: "gap-2",
|
|
2801
|
-
children: [/* @__PURE__ */ P(
|
|
2803
|
+
children: [/* @__PURE__ */ P(He, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "Settings" })]
|
|
2802
2804
|
})
|
|
2803
2805
|
]
|
|
2804
2806
|
})] }), /* @__PURE__ */ P("div", {
|
|
@@ -2817,7 +2819,7 @@ var kr = [
|
|
|
2817
2819
|
onClick: I,
|
|
2818
2820
|
"aria-label": "Attach files",
|
|
2819
2821
|
className: "inline-flex items-center justify-center relative shrink-0 transition-colors duration-200 h-7 w-7 rounded-md active:scale-95 text-text-400 hover:text-text-200 hover:bg-bg-200 disabled:opacity-50 disabled:cursor-not-allowed group-active:scale-95",
|
|
2820
|
-
children: /* @__PURE__ */ P(
|
|
2822
|
+
children: /* @__PURE__ */ P(Le, { className: "w-[18px] h-[18px]" })
|
|
2821
2823
|
}), /* @__PURE__ */ P("div", {
|
|
2822
2824
|
className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-[#1F1E1D] dark:bg-[#EEEEEC] text-[11px] font-medium rounded-[6px] opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-50 shadow-sm tracking-wide",
|
|
2823
2825
|
children: /* @__PURE__ */ P("span", {
|
|
@@ -2836,7 +2838,7 @@ var kr = [
|
|
|
2836
2838
|
className: "hidden"
|
|
2837
2839
|
})
|
|
2838
2840
|
] });
|
|
2839
|
-
},
|
|
2841
|
+
}, Rr = x(({ 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: c = 24, height: l = 64, sensitivity: u = 1, smoothingTimeConstant: d = .8, fftSize: f = 256, historySize: p = 60, updateRate: m = 30, mode: h = "static", onError: g, onStreamReady: _, onStreamEnd: v, className: y, ...b }, x) => {
|
|
2840
2842
|
let S = D(null), w = D(null), E = D(null), O = D(null), k = D(null), A = D(0), j = D([]), M = D(0), N = D(0), F = C(() => {
|
|
2841
2843
|
A.current &&= (cancelAnimationFrame(A.current), 0), k.current &&= (k.current.disconnect(), null), O.current &&= (O.current.getTracks().forEach((e) => e.stop()), null), w.current &&= (w.current.close().catch(() => {}), null), E.current = null, j.current = [], v?.();
|
|
2842
2844
|
}, [v]), I = C((e, t, o, s, c) => {
|
|
@@ -2982,10 +2984,10 @@ var kr = [
|
|
|
2982
2984
|
})
|
|
2983
2985
|
});
|
|
2984
2986
|
});
|
|
2985
|
-
|
|
2987
|
+
Rr.displayName = "LiveWaveform";
|
|
2986
2988
|
// src/components/MessageComposer/ChatInputBox.tsx
|
|
2987
|
-
var
|
|
2988
|
-
let { data: r, error: i } = await
|
|
2989
|
+
var zr = async (e, { signal: t, limit: n }) => {
|
|
2990
|
+
let { data: r, error: i } = await st({
|
|
2989
2991
|
query: {
|
|
2990
2992
|
q: e,
|
|
2991
2993
|
limit: n
|
|
@@ -2996,20 +2998,20 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
2996
2998
|
suggestions: r?.suggestions ?? [],
|
|
2997
2999
|
domains: r?.domains ?? []
|
|
2998
3000
|
};
|
|
2999
|
-
},
|
|
3001
|
+
}, Br = [
|
|
3000
3002
|
"What are you curious to research?",
|
|
3001
3003
|
"Search the latest news...",
|
|
3002
3004
|
"Analyze a video, doc, or URL...",
|
|
3003
3005
|
"Find academic research on...",
|
|
3004
3006
|
"Compare products to buy..."
|
|
3005
|
-
],
|
|
3007
|
+
], Vr = {
|
|
3006
3008
|
initial: {},
|
|
3007
3009
|
animate: { transition: { staggerChildren: .025 } },
|
|
3008
3010
|
exit: { transition: {
|
|
3009
3011
|
staggerChildren: .015,
|
|
3010
3012
|
staggerDirection: -1
|
|
3011
3013
|
} }
|
|
3012
|
-
},
|
|
3014
|
+
}, Hr = {
|
|
3013
3015
|
initial: {
|
|
3014
3016
|
opacity: 0,
|
|
3015
3017
|
filter: "blur(12px)",
|
|
@@ -3043,8 +3045,8 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3043
3045
|
}
|
|
3044
3046
|
}
|
|
3045
3047
|
}
|
|
3046
|
-
},
|
|
3047
|
-
let { loading: t, sendMessage: n, stopStreaming: r, files: i, fileIds: a, setFiles: o, setFileIds: s, newChat: c, sections: l } = u(), [d, f] = O(""), p = D(null), m = D(null), { files: h, setFiles: g, pastedContent: _, setPastedContent: v, isDragging: y, handleFiles: b, onDragOver: x, onDragLeave: S, onDrop: C, handlePaste: w, resetAttachments: E } =
|
|
3048
|
+
}, Ur = ({ onNewChat: e }) => {
|
|
3049
|
+
let { loading: t, sendMessage: n, stopStreaming: r, files: i, fileIds: a, setFiles: o, setFileIds: s, newChat: c, sections: l } = u(), [d, f] = O(""), p = D(null), m = D(null), { files: h, setFiles: g, pastedContent: _, setPastedContent: v, isDragging: y, handleFiles: b, onDragOver: x, onDragLeave: S, onDrop: C, handlePaste: w, resetAttachments: E } = Kn({
|
|
3048
3050
|
setMessage: f,
|
|
3049
3051
|
contextFiles: i,
|
|
3050
3052
|
contextFileIds: a,
|
|
@@ -3052,7 +3054,7 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3052
3054
|
setContextFileIds: s
|
|
3053
3055
|
}), k = () => {
|
|
3054
3056
|
f(""), E(), p.current && (p.current.style.height = "auto");
|
|
3055
|
-
}, A = D(""), j = (e, t) => e && !/\s$/.test(e) ? `${e} ${t}` : `${e}${t}`, { isListening: M, toggleSpeech: N, isSpeechSupported: R, lastPhrase: z, phraseId: B } =
|
|
3057
|
+
}, A = D(""), j = (e, t) => e && !/\s$/.test(e) ? `${e} ${t}` : `${e}${t}`, { isListening: M, toggleSpeech: N, isSpeechSupported: R, lastPhrase: z, phraseId: B } = An((e) => {
|
|
3056
3058
|
f(() => {
|
|
3057
3059
|
let t = `${j(A.current, e)} `;
|
|
3058
3060
|
return A.current = t, t;
|
|
@@ -3064,40 +3066,40 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3064
3066
|
}, { onPartial: (e) => f(e ? j(A.current, e) : A.current) });
|
|
3065
3067
|
T(() => {
|
|
3066
3068
|
M && (A.current = d);
|
|
3067
|
-
}, [M]),
|
|
3069
|
+
}, [M]), zn({
|
|
3068
3070
|
isSpeechSupported: R,
|
|
3069
3071
|
isListening: M,
|
|
3070
3072
|
toggleSpeech: N
|
|
3071
3073
|
});
|
|
3072
|
-
let [V, H] = O(0), [
|
|
3074
|
+
let [V, H] = O(0), [U, ee] = O(!0), [W, te] = O(!1), { handleKeyDown: ne, ...re } = rn({
|
|
3073
3075
|
value: d,
|
|
3074
3076
|
onChange: f,
|
|
3075
|
-
enabled:
|
|
3076
|
-
fetchSuggestions:
|
|
3077
|
+
enabled: W,
|
|
3078
|
+
fetchSuggestions: zr,
|
|
3077
3079
|
anchorRef: m,
|
|
3078
3080
|
inputRef: p
|
|
3079
3081
|
});
|
|
3080
3082
|
T(() => {
|
|
3081
|
-
if (
|
|
3083
|
+
if (W || d) return;
|
|
3082
3084
|
let e = setInterval(() => {
|
|
3083
|
-
|
|
3084
|
-
H((e) => (e + 1) %
|
|
3085
|
+
ee(!1), setTimeout(() => {
|
|
3086
|
+
H((e) => (e + 1) % Br.length), ee(!0);
|
|
3085
3087
|
}, 400);
|
|
3086
3088
|
}, 3e3);
|
|
3087
3089
|
return () => clearInterval(e);
|
|
3088
|
-
}, [
|
|
3090
|
+
}, [W, d]), T(() => {
|
|
3089
3091
|
let e = (e) => {
|
|
3090
|
-
m.current && !m.current.contains(e.target) && (d ||
|
|
3092
|
+
m.current && !m.current.contains(e.target) && (d || te(!1));
|
|
3091
3093
|
};
|
|
3092
3094
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
3093
3095
|
}, [d]), T(() => {
|
|
3094
3096
|
p.current && (p.current.style.height = "auto", p.current.style.height = Math.min(p.current.scrollHeight, 384) + "px");
|
|
3095
3097
|
}, [d]);
|
|
3096
|
-
let
|
|
3098
|
+
let ie = () => {
|
|
3097
3099
|
t || (d.trim() || h.length !== 0 || _.length !== 0) && (n(d), k());
|
|
3098
|
-
},
|
|
3099
|
-
|
|
3100
|
-
},
|
|
3100
|
+
}, ae = (e) => {
|
|
3101
|
+
ne(e) || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), ie());
|
|
3102
|
+
}, oe = !!(d.trim() || h.length > 0 || _.length > 0);
|
|
3101
3103
|
return /* @__PURE__ */ F("div", {
|
|
3102
3104
|
className: "relative w-full max-w-2xl mx-auto transition-all duration-300 font-sans",
|
|
3103
3105
|
onDragOver: x,
|
|
@@ -3107,27 +3109,27 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3107
3109
|
/* @__PURE__ */ F(L.div, {
|
|
3108
3110
|
ref: m,
|
|
3109
3111
|
className: "!box-content flex flex-col mx-2 md:mx-0 items-stretch relative z-10 rounded-[28px] bg-gray-50 dark:bg-[#30302E] border border-bg-300 dark:border-transparent cursor-text font-sans antialiased",
|
|
3110
|
-
animate: { boxShadow:
|
|
3112
|
+
animate: { boxShadow: W || d ? "0 8px 32px 0 rgba(0,0,0,0.16)" : "0 2px 8px 0 rgba(0,0,0,0.08)" },
|
|
3111
3113
|
transition: {
|
|
3112
3114
|
type: "spring",
|
|
3113
3115
|
stiffness: 120,
|
|
3114
3116
|
damping: 18
|
|
3115
3117
|
},
|
|
3116
|
-
onClick: () =>
|
|
3118
|
+
onClick: () => te(!0),
|
|
3117
3119
|
children: [
|
|
3118
3120
|
(h.length > 0 || _.length > 0) && /* @__PURE__ */ F("div", {
|
|
3119
3121
|
className: "flex gap-3 overflow-x-auto custom-scrollbar px-3 pt-3 pb-1",
|
|
3120
|
-
children: [_.map((e) => /* @__PURE__ */ P(
|
|
3122
|
+
children: [_.map((e) => /* @__PURE__ */ P(sn, {
|
|
3121
3123
|
content: e,
|
|
3122
3124
|
onRemove: (e) => v((t) => t.filter((t) => t.id !== e))
|
|
3123
|
-
}, e.id)), h.map((e) => /* @__PURE__ */ P(
|
|
3125
|
+
}, e.id)), h.map((e) => /* @__PURE__ */ P(on, {
|
|
3124
3126
|
file: e,
|
|
3125
3127
|
onRemove: (e) => g((t) => t.filter((t) => t.id !== e))
|
|
3126
3128
|
}, e.id))]
|
|
3127
3129
|
}),
|
|
3128
3130
|
M && /* @__PURE__ */ P("div", {
|
|
3129
3131
|
className: "px-3 pt-2",
|
|
3130
|
-
children: /* @__PURE__ */ P(
|
|
3132
|
+
children: /* @__PURE__ */ P(Rr, {
|
|
3131
3133
|
active: M,
|
|
3132
3134
|
mode: "static",
|
|
3133
3135
|
height: 48,
|
|
@@ -3139,7 +3141,7 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3139
3141
|
className: "w-full rounded-lg"
|
|
3140
3142
|
})
|
|
3141
3143
|
}),
|
|
3142
|
-
/* @__PURE__ */ P(
|
|
3144
|
+
/* @__PURE__ */ P(wt, {
|
|
3143
3145
|
phrase: z,
|
|
3144
3146
|
phraseId: B,
|
|
3145
3147
|
visible: M
|
|
@@ -3147,7 +3149,7 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3147
3149
|
/* @__PURE__ */ F("div", {
|
|
3148
3150
|
className: "flex items-center gap-2 p-3",
|
|
3149
3151
|
children: [
|
|
3150
|
-
/* @__PURE__ */ P(
|
|
3152
|
+
/* @__PURE__ */ P(Lr, {
|
|
3151
3153
|
onFileSelect: b,
|
|
3152
3154
|
disabled: t
|
|
3153
3155
|
}),
|
|
@@ -3160,8 +3162,8 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3160
3162
|
value: d,
|
|
3161
3163
|
onChange: (e) => f(e.target.value),
|
|
3162
3164
|
onPaste: w,
|
|
3163
|
-
onKeyDown:
|
|
3164
|
-
onFocus: () =>
|
|
3165
|
+
onKeyDown: ae,
|
|
3166
|
+
onFocus: () => te(!0),
|
|
3165
3167
|
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",
|
|
3166
3168
|
rows: 1,
|
|
3167
3169
|
autoFocus: !0,
|
|
@@ -3171,19 +3173,19 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3171
3173
|
className: "absolute left-0 top-0 w-full h-full pointer-events-none flex items-center",
|
|
3172
3174
|
children: /* @__PURE__ */ P(I, {
|
|
3173
3175
|
mode: "wait",
|
|
3174
|
-
children:
|
|
3176
|
+
children: U && !W && !d && /* @__PURE__ */ P(L.span, {
|
|
3175
3177
|
className: "absolute left-0 top-1/2 -translate-y-1/2 text-text-400 select-none pointer-events-none text-[16px] font-normal",
|
|
3176
3178
|
style: {
|
|
3177
3179
|
whiteSpace: "nowrap",
|
|
3178
3180
|
overflow: "hidden",
|
|
3179
3181
|
textOverflow: "ellipsis"
|
|
3180
3182
|
},
|
|
3181
|
-
variants:
|
|
3183
|
+
variants: Vr,
|
|
3182
3184
|
initial: "initial",
|
|
3183
3185
|
animate: "animate",
|
|
3184
3186
|
exit: "exit",
|
|
3185
|
-
children:
|
|
3186
|
-
variants:
|
|
3187
|
+
children: Br[V].split("").map((e, t) => /* @__PURE__ */ P(L.span, {
|
|
3188
|
+
variants: Hr,
|
|
3187
3189
|
style: { display: "inline-block" },
|
|
3188
3190
|
children: e === " " ? "\xA0" : e
|
|
3189
3191
|
}, t))
|
|
@@ -3202,7 +3204,7 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3202
3204
|
${M ? "text-red-500 bg-red-500/10 animate-pulse" : "text-text-400 hover:text-text-200 hover:bg-bg-200"}
|
|
3203
3205
|
`,
|
|
3204
3206
|
"aria-label": M ? "Stop listening" : "Voice input",
|
|
3205
|
-
children: /* @__PURE__ */ P(
|
|
3207
|
+
children: /* @__PURE__ */ P(Y.Mic, { className: "w-5 h-5" })
|
|
3206
3208
|
}), /* @__PURE__ */ P("div", {
|
|
3207
3209
|
className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-[#1F1E1D] dark:bg-[#EEEEEC] text-[11px] font-medium rounded-[6px] opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-50 shadow-sm tracking-wide",
|
|
3208
3210
|
children: /* @__PURE__ */ P("span", {
|
|
@@ -3220,7 +3222,7 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3220
3222
|
disabled: t,
|
|
3221
3223
|
className: "transition-all duration-200 h-8 w-8 flex items-center justify-center rounded-full active:scale-95 text-text-400 hover:text-text-200 hover:bg-bg-200",
|
|
3222
3224
|
"aria-label": "New chat",
|
|
3223
|
-
children: /* @__PURE__ */ P(
|
|
3225
|
+
children: /* @__PURE__ */ P(Y.SquarePen, { className: "w-5 h-5" })
|
|
3224
3226
|
}), /* @__PURE__ */ P("div", {
|
|
3225
3227
|
className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-[#1F1E1D] dark:bg-[#EEEEEC] text-[11px] font-medium rounded-[6px] opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-50 shadow-sm tracking-wide",
|
|
3226
3228
|
children: /* @__PURE__ */ P("span", {
|
|
@@ -3238,18 +3240,18 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3238
3240
|
className: "inline-flex items-center justify-center shrink-0 transition-colors h-8 w-8 rounded-full active:scale-95 bg-red-500 text-white hover:bg-red-600 shadow-md",
|
|
3239
3241
|
type: "button",
|
|
3240
3242
|
"aria-label": "Stop generating",
|
|
3241
|
-
children: /* @__PURE__ */ P(
|
|
3243
|
+
children: /* @__PURE__ */ P(Y.Stop, { className: "w-3.5 h-3.5 fill-current" })
|
|
3242
3244
|
}) : /* @__PURE__ */ P("button", {
|
|
3243
3245
|
onClick: (e) => {
|
|
3244
|
-
e.stopPropagation(),
|
|
3246
|
+
e.stopPropagation(), ie();
|
|
3245
3247
|
},
|
|
3246
|
-
disabled: !
|
|
3248
|
+
disabled: !oe,
|
|
3247
3249
|
className: `inline-flex items-center justify-center shrink-0 transition-all duration-200 h-8 w-8 rounded-full active:scale-95
|
|
3248
|
-
${
|
|
3250
|
+
${oe ? "bg-accent text-bg-0 hover:bg-accent-hover shadow-md" : "bg-bg-300 text-text-400 cursor-default opacity-50"}
|
|
3249
3251
|
`,
|
|
3250
3252
|
type: "button",
|
|
3251
3253
|
"aria-label": "Send message",
|
|
3252
|
-
children: /* @__PURE__ */ P(
|
|
3254
|
+
children: /* @__PURE__ */ P(Y.ArrowUp, { className: "w-4 h-4" })
|
|
3253
3255
|
}), /* @__PURE__ */ P("div", {
|
|
3254
3256
|
className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-[#1F1E1D] dark:bg-[#EEEEEC] text-[11px] font-medium rounded-[6px] opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-50 shadow-sm tracking-wide",
|
|
3255
3257
|
children: /* @__PURE__ */ P("span", {
|
|
@@ -3262,42 +3264,42 @@ var Pr = async (e, { signal: t, limit: n }) => {
|
|
|
3262
3264
|
})
|
|
3263
3265
|
]
|
|
3264
3266
|
}),
|
|
3265
|
-
/* @__PURE__ */ P(
|
|
3267
|
+
/* @__PURE__ */ P(Zt, { ...re }),
|
|
3266
3268
|
y && /* @__PURE__ */ F("div", {
|
|
3267
3269
|
className: "absolute inset-0 bg-bg-200/90 border-2 border-dashed border-accent rounded-[28px] z-50 flex flex-col items-center justify-center backdrop-blur-sm pointer-events-none",
|
|
3268
|
-
children: [/* @__PURE__ */ P(
|
|
3270
|
+
children: [/* @__PURE__ */ P(Y.Archive, { className: "w-10 h-10 text-accent mb-2 animate-bounce" }), /* @__PURE__ */ P("p", {
|
|
3269
3271
|
className: "text-accent font-medium",
|
|
3270
3272
|
children: "Drop files to upload"
|
|
3271
3273
|
})]
|
|
3272
3274
|
})
|
|
3273
3275
|
]
|
|
3274
3276
|
});
|
|
3275
|
-
},
|
|
3277
|
+
}, Wr = 200, Gr = [
|
|
3276
3278
|
"message",
|
|
3277
3279
|
"error",
|
|
3278
3280
|
"detail"
|
|
3279
3281
|
];
|
|
3280
|
-
function
|
|
3281
|
-
return e.length >
|
|
3282
|
+
function Kr(e) {
|
|
3283
|
+
return e.length > Wr ? `${e.slice(0, 199).trimEnd()}…` : e;
|
|
3282
3284
|
}
|
|
3283
|
-
function
|
|
3285
|
+
function qr(e, t) {
|
|
3284
3286
|
let n = t ? `HTTP ${t}` : "Unknown error";
|
|
3285
3287
|
if (typeof e == "string") {
|
|
3286
3288
|
let t = e.trim();
|
|
3287
|
-
return !t || t.startsWith("<") ? n :
|
|
3289
|
+
return !t || t.startsWith("<") ? n : Kr(t);
|
|
3288
3290
|
}
|
|
3289
3291
|
if (e && typeof e == "object") {
|
|
3290
3292
|
let t = e;
|
|
3291
|
-
for (let e of
|
|
3293
|
+
for (let e of Gr) {
|
|
3292
3294
|
let n = t[e];
|
|
3293
|
-
if (typeof n == "string" && n.trim()) return
|
|
3295
|
+
if (typeof n == "string" && n.trim()) return Kr(n.trim());
|
|
3294
3296
|
}
|
|
3295
3297
|
}
|
|
3296
3298
|
return n;
|
|
3297
3299
|
}
|
|
3298
3300
|
// src/components/ChatHistoryDropdown/useHistoryState.ts
|
|
3299
|
-
var
|
|
3300
|
-
function
|
|
3301
|
+
var Jr = "qwksearch_pinned_chats";
|
|
3302
|
+
function Yr(e) {
|
|
3301
3303
|
let t = e.messages?.[e.messages.length - 1], n = t && "createdAt" in t ? t.createdAt : void 0;
|
|
3302
3304
|
if (n) {
|
|
3303
3305
|
let e = new Date(n).getTime();
|
|
@@ -3305,27 +3307,27 @@ function Wr(e) {
|
|
|
3305
3307
|
}
|
|
3306
3308
|
return e.createdAt;
|
|
3307
3309
|
}
|
|
3308
|
-
function
|
|
3310
|
+
function Xr() {
|
|
3309
3311
|
if (typeof window > "u") return [];
|
|
3310
3312
|
try {
|
|
3311
|
-
let e = localStorage.getItem(
|
|
3313
|
+
let e = localStorage.getItem(Jr);
|
|
3312
3314
|
return e ? JSON.parse(e) : [];
|
|
3313
3315
|
} catch {
|
|
3314
3316
|
return [];
|
|
3315
3317
|
}
|
|
3316
3318
|
}
|
|
3317
|
-
function
|
|
3318
|
-
typeof window < "u" && localStorage.setItem(
|
|
3319
|
+
function Zr(e) {
|
|
3320
|
+
typeof window < "u" && localStorage.setItem(Jr, JSON.stringify(e));
|
|
3319
3321
|
}
|
|
3320
|
-
function
|
|
3322
|
+
function Qr() {
|
|
3321
3323
|
let [e, t] = O([]), [r, i] = O(!0), [a, o] = O(!1), [s, c] = O(null), [l, d] = O(!1), [f, p] = O(!1), [m, h] = O(!1), [g, _] = O([]), [v, y] = O(""), [b, x] = O([]), [S, w] = O(!1), { isAuthenticated: D, isLoading: k } = n(), { incognito: A, setIncognito: j } = u();
|
|
3322
3324
|
T(() => {
|
|
3323
|
-
_(
|
|
3325
|
+
_(Xr());
|
|
3324
3326
|
}, []);
|
|
3325
3327
|
let M = C((e, t) => {
|
|
3326
3328
|
e.preventDefault(), e.stopPropagation(), _((e) => {
|
|
3327
3329
|
let n = e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
|
|
3328
|
-
return
|
|
3330
|
+
return Zr(n), n;
|
|
3329
3331
|
});
|
|
3330
3332
|
}, []), N = E(() => [...e].sort((e, t) => {
|
|
3331
3333
|
let n = g.includes(e.id), r = g.includes(t.id);
|
|
@@ -3339,27 +3341,27 @@ function qr() {
|
|
|
3339
3341
|
i(!0);
|
|
3340
3342
|
try {
|
|
3341
3343
|
if (D) {
|
|
3342
|
-
let { data: e, error: n, response: r } = await
|
|
3344
|
+
let { data: e, error: n, response: r } = await _t();
|
|
3343
3345
|
if (n && r?.status === 401) {
|
|
3344
|
-
let e =
|
|
3346
|
+
let e = dn().map((e) => ({
|
|
3345
3347
|
...e,
|
|
3346
3348
|
messageCount: e.messages?.filter((e) => e.role === "user").length ?? 0,
|
|
3347
|
-
lastMessageAt:
|
|
3349
|
+
lastMessageAt: Yr(e)
|
|
3348
3350
|
}));
|
|
3349
3351
|
t(e);
|
|
3350
3352
|
return;
|
|
3351
3353
|
}
|
|
3352
|
-
if (n) throw Error(`Failed to fetch chats: ${
|
|
3354
|
+
if (n) throw Error(`Failed to fetch chats: ${qr(n, r?.status)}`);
|
|
3353
3355
|
t(Array.isArray(e?.chats) ? e.chats : []);
|
|
3354
3356
|
} else {
|
|
3355
|
-
let e =
|
|
3357
|
+
let e = dn().map((e) => ({
|
|
3356
3358
|
...e,
|
|
3357
3359
|
messageCount: e.messages?.filter((e) => e.role === "user").length ?? 0
|
|
3358
3360
|
}));
|
|
3359
3361
|
t(e);
|
|
3360
3362
|
}
|
|
3361
3363
|
} catch (e) {
|
|
3362
|
-
console.error("Failed to fetch chat history:", e), t([]),
|
|
3364
|
+
console.error("Failed to fetch chat history:", e), t([]), K.error("Failed to load chat history");
|
|
3363
3365
|
} finally {
|
|
3364
3366
|
i(!1);
|
|
3365
3367
|
}
|
|
@@ -3375,12 +3377,12 @@ function qr() {
|
|
|
3375
3377
|
d(!0);
|
|
3376
3378
|
try {
|
|
3377
3379
|
if (D) {
|
|
3378
|
-
let { error: e, response: t } = await
|
|
3379
|
-
if (e) throw Error(`Failed to delete chat: ${
|
|
3380
|
-
} else
|
|
3381
|
-
t((e) => e.filter((e) => e.id !== s)),
|
|
3380
|
+
let { error: e, response: t } = await ut({ path: { id: s } });
|
|
3381
|
+
if (e) throw Error(`Failed to delete chat: ${qr(e, t?.status)}`);
|
|
3382
|
+
} else mn(s);
|
|
3383
|
+
t((e) => e.filter((e) => e.id !== s)), K.success("Chat deleted");
|
|
3382
3384
|
} catch (e) {
|
|
3383
|
-
|
|
3385
|
+
K.error(e.message || "Failed to delete chat");
|
|
3384
3386
|
} finally {
|
|
3385
3387
|
o(!1), c(null), d(!1);
|
|
3386
3388
|
}
|
|
@@ -3391,39 +3393,39 @@ function qr() {
|
|
|
3391
3393
|
h(!0);
|
|
3392
3394
|
try {
|
|
3393
3395
|
if (D) {
|
|
3394
|
-
let { error: e, response: t } = await
|
|
3395
|
-
if (e) throw Error(`Failed to clear history: ${
|
|
3396
|
-
} else
|
|
3397
|
-
t([]),
|
|
3396
|
+
let { error: e, response: t } = await lt();
|
|
3397
|
+
if (e) throw Error(`Failed to clear history: ${qr(e, t?.status)}`);
|
|
3398
|
+
} else hn();
|
|
3399
|
+
t([]), K.success("All history cleared");
|
|
3398
3400
|
} catch (e) {
|
|
3399
|
-
|
|
3401
|
+
K.error(e.message || "Failed to clear history");
|
|
3400
3402
|
} finally {
|
|
3401
3403
|
p(!1), h(!1);
|
|
3402
3404
|
}
|
|
3403
3405
|
}, B = () => {
|
|
3404
|
-
j(!A),
|
|
3406
|
+
j(!A), K.success(A ? "Private mode off" : "Private mode on — messages won't be saved");
|
|
3405
3407
|
}, V = C(async (e) => {
|
|
3406
3408
|
if (!e.trim()) x([]), w(!1);
|
|
3407
3409
|
else {
|
|
3408
3410
|
w(!0);
|
|
3409
3411
|
try {
|
|
3410
3412
|
if (D) {
|
|
3411
|
-
let { data: t, error: n, response: r } = await
|
|
3412
|
-
if (n) throw Error(`Failed to search chats: ${
|
|
3413
|
+
let { data: t, error: n, response: r } = await bt({ query: { q: e } });
|
|
3414
|
+
if (n) throw Error(`Failed to search chats: ${qr(n, r?.status)}`);
|
|
3413
3415
|
x(Array.isArray(t?.chats) ? t.chats : []);
|
|
3414
3416
|
} else {
|
|
3415
|
-
let t =
|
|
3417
|
+
let t = dn().filter((t) => {
|
|
3416
3418
|
let n = t.title.toLowerCase().includes(e.toLowerCase()), r = t.messages?.some((t) => "content" in t && t.content?.toLowerCase().includes(e.toLowerCase()));
|
|
3417
3419
|
return n || r;
|
|
3418
3420
|
});
|
|
3419
3421
|
x(t.map((e) => ({
|
|
3420
3422
|
...e,
|
|
3421
3423
|
messageCount: e.messages?.filter((e) => e.role === "user").length ?? 0,
|
|
3422
|
-
lastMessageAt:
|
|
3424
|
+
lastMessageAt: Yr(e)
|
|
3423
3425
|
})));
|
|
3424
3426
|
}
|
|
3425
3427
|
} catch (e) {
|
|
3426
|
-
console.error("Failed to search chat history:", e), x([]),
|
|
3428
|
+
console.error("Failed to search chat history:", e), x([]), K.error("Failed to search chat history");
|
|
3427
3429
|
} finally {
|
|
3428
3430
|
w(!1);
|
|
3429
3431
|
}
|
|
@@ -3464,7 +3466,7 @@ function qr() {
|
|
|
3464
3466
|
};
|
|
3465
3467
|
}
|
|
3466
3468
|
// src/components/ChatHistoryDropdown/HistoryHeader.tsx
|
|
3467
|
-
function
|
|
3469
|
+
function $r({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r, searchQuery: i, onSearchChange: a }) {
|
|
3468
3470
|
return /* @__PURE__ */ F("div", {
|
|
3469
3471
|
className: "mb-2 pb-2 border-b border-border space-y-2",
|
|
3470
3472
|
children: [/* @__PURE__ */ F("div", {
|
|
@@ -3478,18 +3480,18 @@ function Jr({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r
|
|
|
3478
3480
|
onClick: t,
|
|
3479
3481
|
className: `flex items-center gap-1 px-2 py-1 text-xs rounded-lg transition-colors duration-200 ${e ? "text-primary bg-primary/10" : "text-muted-foreground hover:text-foreground hover:bg-secondary"}`,
|
|
3480
3482
|
title: e ? "Private mode on" : "Private mode",
|
|
3481
|
-
children: [/* @__PURE__ */ P(
|
|
3483
|
+
children: [/* @__PURE__ */ P(Oe, { size: 12 }), /* @__PURE__ */ P("span", { children: "Private" })]
|
|
3482
3484
|
}), n && /* @__PURE__ */ F("button", {
|
|
3483
3485
|
onClick: r,
|
|
3484
3486
|
className: "flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-red-500 hover:bg-red-500/10 rounded-lg transition-colors duration-200",
|
|
3485
3487
|
title: "Clear all history",
|
|
3486
|
-
children: [/* @__PURE__ */ P(
|
|
3488
|
+
children: [/* @__PURE__ */ P($e, { size: 12 }), /* @__PURE__ */ P("span", { children: "Clear All" })]
|
|
3487
3489
|
})]
|
|
3488
3490
|
})]
|
|
3489
3491
|
}), /* @__PURE__ */ F("div", {
|
|
3490
3492
|
className: "relative",
|
|
3491
3493
|
children: [
|
|
3492
|
-
/* @__PURE__ */ P(
|
|
3494
|
+
/* @__PURE__ */ P(Ve, {
|
|
3493
3495
|
className: "absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground",
|
|
3494
3496
|
size: 14
|
|
3495
3497
|
}),
|
|
@@ -3503,14 +3505,14 @@ function Jr({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r
|
|
|
3503
3505
|
i && /* @__PURE__ */ P("button", {
|
|
3504
3506
|
onClick: () => a(""),
|
|
3505
3507
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
3506
|
-
children: /* @__PURE__ */ P(
|
|
3508
|
+
children: /* @__PURE__ */ P(nt, { size: 14 })
|
|
3507
3509
|
})
|
|
3508
3510
|
]
|
|
3509
3511
|
})]
|
|
3510
3512
|
});
|
|
3511
3513
|
}
|
|
3512
3514
|
// src/ui/badge.tsx
|
|
3513
|
-
var
|
|
3515
|
+
var ei = Dt("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", {
|
|
3514
3516
|
variants: { variant: {
|
|
3515
3517
|
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
3516
3518
|
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",
|
|
@@ -3522,20 +3524,20 @@ var Yr = Ot("inline-flex items-center justify-center rounded-2xl border px-3 py-
|
|
|
3522
3524
|
} },
|
|
3523
3525
|
defaultVariants: { variant: "default" }
|
|
3524
3526
|
});
|
|
3525
|
-
function
|
|
3526
|
-
return /* @__PURE__ */ P(n ?
|
|
3527
|
+
function ti({ className: e, variant: t, asChild: n = !1, ...r }) {
|
|
3528
|
+
return /* @__PURE__ */ P(n ? Et : "span", {
|
|
3527
3529
|
"data-slot": "badge",
|
|
3528
|
-
className: h(
|
|
3530
|
+
className: h(ei({ variant: t }), e),
|
|
3529
3531
|
...r
|
|
3530
3532
|
});
|
|
3531
3533
|
}
|
|
3532
3534
|
// src/components/ChatHistoryDropdown/HistoryChatItem.tsx
|
|
3533
|
-
function
|
|
3535
|
+
function ni({ chat: e, isPinned: n, onTogglePin: r, onDelete: i }) {
|
|
3534
3536
|
let a = e.messageCount ?? 0;
|
|
3535
3537
|
return /* @__PURE__ */ F("div", {
|
|
3536
3538
|
className: "group flex items-center gap-1 px-2 py-1 rounded-lg hover:bg-secondary transition-colors duration-200",
|
|
3537
3539
|
children: [
|
|
3538
|
-
/* @__PURE__ */ F(
|
|
3540
|
+
/* @__PURE__ */ F(Tt, {
|
|
3539
3541
|
href: `/c/${e.id}`,
|
|
3540
3542
|
onClick: (n) => {
|
|
3541
3543
|
t.onOpenChat?.(e.id) && n.preventDefault();
|
|
@@ -3543,16 +3545,16 @@ function Zr({ chat: e, isPinned: n, onTogglePin: r, onDelete: i }) {
|
|
|
3543
3545
|
className: "flex-1 min-w-0 flex items-center gap-1.5",
|
|
3544
3546
|
children: [/* @__PURE__ */ F("span", {
|
|
3545
3547
|
className: "flex items-center gap-1 shrink-0",
|
|
3546
|
-
children: [a > 0 && /* @__PURE__ */ F(
|
|
3548
|
+
children: [a > 0 && /* @__PURE__ */ F(ti, {
|
|
3547
3549
|
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",
|
|
3548
3550
|
children: [a, "Q"]
|
|
3549
|
-
}), /* @__PURE__ */ P(
|
|
3551
|
+
}), /* @__PURE__ */ P(ti, {
|
|
3550
3552
|
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",
|
|
3551
3553
|
children: f(/* @__PURE__ */ new Date(), e.createdAt)
|
|
3552
3554
|
})]
|
|
3553
3555
|
}), /* @__PURE__ */ F("p", {
|
|
3554
3556
|
className: "text-xs text-popover-foreground truncate",
|
|
3555
|
-
children: [n && /* @__PURE__ */ P(
|
|
3557
|
+
children: [n && /* @__PURE__ */ P(ze, {
|
|
3556
3558
|
size: 10,
|
|
3557
3559
|
className: "inline mr-1 text-primary"
|
|
3558
3560
|
}), e.title]
|
|
@@ -3562,19 +3564,19 @@ function Zr({ chat: e, isPinned: n, onTogglePin: r, onDelete: i }) {
|
|
|
3562
3564
|
onClick: (t) => r(t, e.id),
|
|
3563
3565
|
className: `p-1.5 rounded-lg transition-all duration-200 ${n ? "opacity-100 text-primary hover:bg-primary/10" : "opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-primary hover:bg-primary/10"}`,
|
|
3564
3566
|
title: n ? "Unpin chat" : "Pin chat",
|
|
3565
|
-
children: /* @__PURE__ */ P(
|
|
3567
|
+
children: /* @__PURE__ */ P(ze, { size: 14 })
|
|
3566
3568
|
}),
|
|
3567
3569
|
/* @__PURE__ */ P("button", {
|
|
3568
3570
|
onClick: (t) => i(t, e.id),
|
|
3569
3571
|
className: "opacity-0 group-hover:opacity-100 p-1.5 rounded-lg hover:bg-red-500/10 text-muted-foreground hover:text-red-500 transition-all duration-200",
|
|
3570
3572
|
title: "Delete chat",
|
|
3571
|
-
children: /* @__PURE__ */ P(
|
|
3573
|
+
children: /* @__PURE__ */ P(Qe, { size: 14 })
|
|
3572
3574
|
})
|
|
3573
3575
|
]
|
|
3574
3576
|
});
|
|
3575
3577
|
}
|
|
3576
3578
|
// src/components/ChatHistoryDropdown/HistoryDialogs.tsx
|
|
3577
|
-
function
|
|
3579
|
+
function ri({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i, loadingLabel: a, loading: o, onConfirm: s }) {
|
|
3578
3580
|
return /* @__PURE__ */ P(_, {
|
|
3579
3581
|
open: e,
|
|
3580
3582
|
onOpenChange: (e) => {
|
|
@@ -3610,8 +3612,8 @@ function Qr({ open: e, onOpenChange: t, title: n, description: r, confirmLabel:
|
|
|
3610
3612
|
})
|
|
3611
3613
|
});
|
|
3612
3614
|
}
|
|
3613
|
-
function
|
|
3614
|
-
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
3615
|
+
function ii({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setChatToDelete: r, deleting: i, onConfirmDelete: a, clearAllDialogOpen: o, setClearAllDialogOpen: s, clearingAll: c, onConfirmClearAll: l }) {
|
|
3616
|
+
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(ri, {
|
|
3615
3617
|
open: e,
|
|
3616
3618
|
onOpenChange: (e) => {
|
|
3617
3619
|
t(e), e || r(null);
|
|
@@ -3622,7 +3624,7 @@ function $r({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
|
|
|
3622
3624
|
loadingLabel: "Deleting...",
|
|
3623
3625
|
loading: i,
|
|
3624
3626
|
onConfirm: a
|
|
3625
|
-
}), /* @__PURE__ */ P(
|
|
3627
|
+
}), /* @__PURE__ */ P(ri, {
|
|
3626
3628
|
open: o,
|
|
3627
3629
|
onOpenChange: s,
|
|
3628
3630
|
title: "Clear All History",
|
|
@@ -3634,13 +3636,13 @@ function $r({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
|
|
|
3634
3636
|
})] });
|
|
3635
3637
|
}
|
|
3636
3638
|
// src/components/ChatHistoryDropdown/HistoryDropdown.tsx
|
|
3637
|
-
var
|
|
3638
|
-
Today: /* @__PURE__ */ P(
|
|
3639
|
-
Yesterday: /* @__PURE__ */ P(
|
|
3640
|
-
"This Week": /* @__PURE__ */ P(
|
|
3639
|
+
var ai = {
|
|
3640
|
+
Today: /* @__PURE__ */ P(Xe, { size: 12 }),
|
|
3641
|
+
Yesterday: /* @__PURE__ */ P(se, { size: 12 }),
|
|
3642
|
+
"This Week": /* @__PURE__ */ P(te, { size: 12 }),
|
|
3641
3643
|
Older: /* @__PURE__ */ P(z, { size: 12 })
|
|
3642
3644
|
};
|
|
3643
|
-
function
|
|
3645
|
+
function oi(e) {
|
|
3644
3646
|
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() - 5184e5), a = {
|
|
3645
3647
|
Today: [],
|
|
3646
3648
|
Yesterday: [],
|
|
@@ -3661,11 +3663,11 @@ function ti(e) {
|
|
|
3661
3663
|
chats: a[e]
|
|
3662
3664
|
}));
|
|
3663
3665
|
}
|
|
3664
|
-
var
|
|
3665
|
-
let t =
|
|
3666
|
+
var si = ({ showLabel: e = !1 }) => {
|
|
3667
|
+
let t = Qr();
|
|
3666
3668
|
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ F(_, { children: [/* @__PURE__ */ F(d, {
|
|
3667
3669
|
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",
|
|
3668
|
-
children: [/* @__PURE__ */ P(
|
|
3670
|
+
children: [/* @__PURE__ */ P(we, { size: e ? 14 : 18 }), e && /* @__PURE__ */ P("span", { children: "History" })]
|
|
3669
3671
|
}), /* @__PURE__ */ F(m, {
|
|
3670
3672
|
className: "max-w-[420px] p-3",
|
|
3671
3673
|
children: [
|
|
@@ -3673,7 +3675,7 @@ var ni = ({ showLabel: e = !1 }) => {
|
|
|
3673
3675
|
className: "sr-only",
|
|
3674
3676
|
children: "Chat History"
|
|
3675
3677
|
}),
|
|
3676
|
-
/* @__PURE__ */ P(
|
|
3678
|
+
/* @__PURE__ */ P($r, {
|
|
3677
3679
|
incognito: t.incognito,
|
|
3678
3680
|
onToggleIncognito: t.toggleIncognito,
|
|
3679
3681
|
showClearAll: t.chats.length > 0 && !t.loading,
|
|
@@ -3711,15 +3713,15 @@ var ni = ({ showLabel: e = !1 }) => {
|
|
|
3711
3713
|
})
|
|
3712
3714
|
}) : /* @__PURE__ */ P("div", {
|
|
3713
3715
|
className: "space-y-1 max-h-[500px] overflow-y-auto",
|
|
3714
|
-
children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ P(
|
|
3716
|
+
children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ P(ni, {
|
|
3715
3717
|
chat: e,
|
|
3716
3718
|
isPinned: t.pinnedIds.includes(e.id),
|
|
3717
3719
|
onTogglePin: t.togglePin,
|
|
3718
3720
|
onDelete: t.handleDeleteClick
|
|
3719
|
-
}, e.id)) :
|
|
3721
|
+
}, e.id)) : oi(t.displayChats).map(({ label: e, chats: n }) => /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ F("div", {
|
|
3720
3722
|
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-muted-foreground/70 uppercase tracking-wider",
|
|
3721
|
-
children: [
|
|
3722
|
-
}), n.map((e) => /* @__PURE__ */ P(
|
|
3723
|
+
children: [ai[e], e]
|
|
3724
|
+
}), n.map((e) => /* @__PURE__ */ P(ni, {
|
|
3723
3725
|
chat: e,
|
|
3724
3726
|
isPinned: t.pinnedIds.includes(e.id),
|
|
3725
3727
|
onTogglePin: t.togglePin,
|
|
@@ -3728,14 +3730,14 @@ var ni = ({ showLabel: e = !1 }) => {
|
|
|
3728
3730
|
}),
|
|
3729
3731
|
t.chats.length > 0 && /* @__PURE__ */ P("div", {
|
|
3730
3732
|
className: "mt-2 pt-2 border-t border-border",
|
|
3731
|
-
children: /* @__PURE__ */ P(
|
|
3733
|
+
children: /* @__PURE__ */ P(Tt, {
|
|
3732
3734
|
href: "/library",
|
|
3733
3735
|
className: "block text-center text-xs text-primary hover:underline",
|
|
3734
3736
|
children: "View all chats"
|
|
3735
3737
|
})
|
|
3736
3738
|
})
|
|
3737
3739
|
]
|
|
3738
|
-
})] }), /* @__PURE__ */ P(
|
|
3740
|
+
})] }), /* @__PURE__ */ P(ii, {
|
|
3739
3741
|
deleteDialogOpen: t.deleteDialogOpen,
|
|
3740
3742
|
setDeleteDialogOpen: t.setDeleteDialogOpen,
|
|
3741
3743
|
chatToDelete: t.chatToDelete,
|
|
@@ -3747,14 +3749,14 @@ var ni = ({ showLabel: e = !1 }) => {
|
|
|
3747
3749
|
clearingAll: t.clearingAll,
|
|
3748
3750
|
onConfirmClearAll: t.handleConfirmClearAll
|
|
3749
3751
|
})] });
|
|
3750
|
-
},
|
|
3751
|
-
function
|
|
3752
|
-
let { chats: e, loading: n } =
|
|
3752
|
+
}, ci = (e) => new Date(e.lastMessageAt || e.createdAt).getTime();
|
|
3753
|
+
function li() {
|
|
3754
|
+
let { chats: e, loading: n } = Qr(), r = [...e].sort((e, t) => ci(t) - ci(e)).slice(0, 5);
|
|
3753
3755
|
return n || r.length === 0 ? null : /* @__PURE__ */ F("div", {
|
|
3754
3756
|
className: "flex flex-row items-center justify-center gap-2 flex-wrap",
|
|
3755
|
-
children: [/* @__PURE__ */ P(
|
|
3756
|
-
let n =
|
|
3757
|
-
return /* @__PURE__ */ F(
|
|
3757
|
+
children: [/* @__PURE__ */ P(si, { showLabel: !0 }), r.map((e) => {
|
|
3758
|
+
let n = br(e.lastMessageAt || e.createdAt);
|
|
3759
|
+
return /* @__PURE__ */ F(Tt, {
|
|
3758
3760
|
href: `/c/${e.id}`,
|
|
3759
3761
|
onClick: (n) => {
|
|
3760
3762
|
t.onOpenChat?.(e.id) && n.preventDefault();
|
|
@@ -3773,25 +3775,25 @@ function ii() {
|
|
|
3773
3775
|
});
|
|
3774
3776
|
}
|
|
3775
3777
|
// src/components/Footer.tsx
|
|
3776
|
-
var
|
|
3777
|
-
Bot:
|
|
3778
|
-
BookOpen:
|
|
3779
|
-
Building2:
|
|
3780
|
-
Download:
|
|
3781
|
-
HelpCircle:
|
|
3782
|
-
Info:
|
|
3783
|
-
Lock:
|
|
3784
|
-
Mail:
|
|
3785
|
-
MessageCircle:
|
|
3786
|
-
Newspaper:
|
|
3787
|
-
Sparkles:
|
|
3778
|
+
var ui = {
|
|
3779
|
+
Bot: ee,
|
|
3780
|
+
BookOpen: U,
|
|
3781
|
+
Building2: W,
|
|
3782
|
+
Download: fe,
|
|
3783
|
+
HelpCircle: Se,
|
|
3784
|
+
Info: Te,
|
|
3785
|
+
Lock: Oe,
|
|
3786
|
+
Mail: je,
|
|
3787
|
+
MessageCircle: Me,
|
|
3788
|
+
Newspaper: Ie,
|
|
3789
|
+
Sparkles: Ke
|
|
3788
3790
|
};
|
|
3789
|
-
function
|
|
3790
|
-
let t =
|
|
3791
|
+
function di({ name: e }) {
|
|
3792
|
+
let t = ui[e];
|
|
3791
3793
|
return t ? /* @__PURE__ */ P(t, { size: 14 }) : null;
|
|
3792
3794
|
}
|
|
3793
|
-
var
|
|
3794
|
-
function
|
|
3795
|
+
var fi = "relative group inline-flex items-center gap-1 px-[3px] sm:px-1.5 py-0.5 rounded-md whitespace-nowrap transition-all duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:text-white hover:bg-white/10 hover:-translate-y-0.5 hover:scale-110 hover:drop-shadow-[0_0_8px_rgba(255,255,255,0.8)] active:scale-95 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/60";
|
|
3796
|
+
function pi({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackgroundColor: n = "bg-black/40" }) {
|
|
3795
3797
|
return e.length === 0 ? null : /* @__PURE__ */ P("nav", {
|
|
3796
3798
|
"aria-label": "Footer",
|
|
3797
3799
|
className: `relative z-20 mx-auto flex w-max flex-nowrap items-center justify-center gap-0 sm:gap-1 max-w-full text-slate-200 ${n} backdrop-blur-sm rounded-full px-1 sm:px-1.5 py-0.5 shadow-lg hover:shadow-xl transition-shadow duration-300`,
|
|
@@ -3802,7 +3804,7 @@ function ci({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackground
|
|
|
3802
3804
|
} : {}, s = /* @__PURE__ */ F(N, { children: [
|
|
3803
3805
|
t && r && /* @__PURE__ */ P("span", {
|
|
3804
3806
|
className: "hidden sm:inline-flex transition-transform duration-300 group-hover:-rotate-12 group-hover:scale-125",
|
|
3805
|
-
children: /* @__PURE__ */ P(
|
|
3807
|
+
children: /* @__PURE__ */ P(di, { name: r })
|
|
3806
3808
|
}),
|
|
3807
3809
|
/* @__PURE__ */ P("span", {
|
|
3808
3810
|
className: "font-semibold tracking-wide text-[11px] sm:text-xs",
|
|
@@ -3814,83 +3816,83 @@ function ci({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackground
|
|
|
3814
3816
|
return i ? /* @__PURE__ */ P("button", {
|
|
3815
3817
|
type: "button",
|
|
3816
3818
|
onClick: i,
|
|
3817
|
-
className:
|
|
3819
|
+
className: fi,
|
|
3818
3820
|
children: s
|
|
3819
3821
|
}, e) : a ? /* @__PURE__ */ P("a", {
|
|
3820
3822
|
href: e,
|
|
3821
3823
|
...o,
|
|
3822
|
-
className:
|
|
3824
|
+
className: fi,
|
|
3823
3825
|
children: s
|
|
3824
|
-
}, e) : /* @__PURE__ */ P(
|
|
3826
|
+
}, e) : /* @__PURE__ */ P(Tt, {
|
|
3825
3827
|
href: e,
|
|
3826
|
-
className:
|
|
3828
|
+
className: fi,
|
|
3827
3829
|
children: s
|
|
3828
3830
|
}, e);
|
|
3829
3831
|
})
|
|
3830
3832
|
});
|
|
3831
3833
|
}
|
|
3832
3834
|
// src/components/ArticleReader/ArticleReaderMount.tsx
|
|
3833
|
-
var
|
|
3834
|
-
function
|
|
3835
|
+
var mi = S(() => import("./ArticleExtractPanel-Dce2hQz6.js"));
|
|
3836
|
+
function hi() {
|
|
3835
3837
|
let e = o()?.isOpen ?? !1, [t, n] = O(!1);
|
|
3836
3838
|
return T(() => {
|
|
3837
3839
|
e && n(!0);
|
|
3838
3840
|
}, [e]), !t && !e ? null : /* @__PURE__ */ P(y, {
|
|
3839
3841
|
fallback: null,
|
|
3840
|
-
children: /* @__PURE__ */ P(
|
|
3842
|
+
children: /* @__PURE__ */ P(mi, {})
|
|
3841
3843
|
});
|
|
3842
3844
|
}
|
|
3843
|
-
var
|
|
3844
|
-
function
|
|
3845
|
+
var gi = (/* @__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(",")).map((e) => "https://i.imgur.com/" + e), _i = "qwksearch-background-art-v1", vi = "backgroundArtCache", yi = (e) => typeof e == "string" && gi.includes(e);
|
|
3846
|
+
function bi() {
|
|
3845
3847
|
try {
|
|
3846
3848
|
let e = JSON.parse(localStorage.getItem("backgroundArtCache") || "[]");
|
|
3847
|
-
return Array.isArray(e) ? [...new Set(e.filter(
|
|
3849
|
+
return Array.isArray(e) ? [...new Set(e.filter(yi))] : [];
|
|
3848
3850
|
} catch {
|
|
3849
3851
|
return [];
|
|
3850
3852
|
}
|
|
3851
3853
|
}
|
|
3852
|
-
function
|
|
3854
|
+
function xi(e) {
|
|
3853
3855
|
try {
|
|
3854
|
-
localStorage.setItem(
|
|
3856
|
+
localStorage.setItem(vi, JSON.stringify(e));
|
|
3855
3857
|
} catch {}
|
|
3856
3858
|
}
|
|
3857
|
-
function
|
|
3858
|
-
let t =
|
|
3859
|
+
function Si(e) {
|
|
3860
|
+
let t = bi().filter((t) => t !== e);
|
|
3859
3861
|
t.push(e);
|
|
3860
3862
|
let n = t.splice(0, Math.max(0, t.length - 10));
|
|
3861
|
-
return
|
|
3863
|
+
return xi(t), n;
|
|
3862
3864
|
}
|
|
3863
|
-
function
|
|
3864
|
-
|
|
3865
|
+
function Ci(e) {
|
|
3866
|
+
xi(bi().filter((t) => t !== e));
|
|
3865
3867
|
}
|
|
3866
|
-
var
|
|
3867
|
-
function
|
|
3868
|
-
return
|
|
3868
|
+
var wi = (e) => e.length ? e[Math.floor(Math.random() * e.length)] : null;
|
|
3869
|
+
function Ti(e) {
|
|
3870
|
+
return wi(bi().filter((t) => t !== e));
|
|
3869
3871
|
}
|
|
3870
|
-
function
|
|
3871
|
-
let e = new Set(
|
|
3872
|
-
return
|
|
3872
|
+
function Ei() {
|
|
3873
|
+
let e = new Set(bi());
|
|
3874
|
+
return wi(gi.filter((t) => !e.has(t)));
|
|
3873
3875
|
}
|
|
3874
|
-
async function
|
|
3876
|
+
async function Di() {
|
|
3875
3877
|
if (typeof caches > "u") return null;
|
|
3876
3878
|
try {
|
|
3877
|
-
return await caches.open(
|
|
3879
|
+
return await caches.open(_i);
|
|
3878
3880
|
} catch {
|
|
3879
3881
|
return null;
|
|
3880
3882
|
}
|
|
3881
3883
|
}
|
|
3882
|
-
async function
|
|
3883
|
-
let t = await
|
|
3884
|
+
async function Oi(e) {
|
|
3885
|
+
let t = await Di();
|
|
3884
3886
|
if (!t) return null;
|
|
3885
3887
|
try {
|
|
3886
3888
|
let n = await t.match(e);
|
|
3887
|
-
return n ? URL.createObjectURL(await n.blob()) : (
|
|
3889
|
+
return n ? URL.createObjectURL(await n.blob()) : (Ci(e), null);
|
|
3888
3890
|
} catch {
|
|
3889
3891
|
return null;
|
|
3890
3892
|
}
|
|
3891
3893
|
}
|
|
3892
|
-
async function
|
|
3893
|
-
let t = await
|
|
3894
|
+
async function ki(e) {
|
|
3895
|
+
let t = await Di();
|
|
3894
3896
|
if (!t) return e;
|
|
3895
3897
|
let n;
|
|
3896
3898
|
try {
|
|
@@ -3905,17 +3907,17 @@ async function wi(e) {
|
|
|
3905
3907
|
}
|
|
3906
3908
|
if (n.size <= 15728640) try {
|
|
3907
3909
|
await t.put(e, new Response(n, { headers: { "Content-Type": n.type } }));
|
|
3908
|
-
let r =
|
|
3910
|
+
let r = Si(e);
|
|
3909
3911
|
await Promise.all(r.map((e) => t.delete(e)));
|
|
3910
3912
|
} catch {}
|
|
3911
3913
|
return URL.createObjectURL(n);
|
|
3912
3914
|
}
|
|
3913
3915
|
// src/components/ChatConversation/ChatHomepage.tsx
|
|
3914
|
-
var
|
|
3915
|
-
function
|
|
3916
|
+
var Ai = S(() => import("use-weather-forecast").then((e) => ({ default: e.WeatherForecast }))), ji = S(() => import("trending-news-api").then((e) => ({ default: e.TrendingNews }))), Mi = S(() => import("education-playlists").then((e) => ({ default: e.EducationPlaylists }))), Ni = S(() => import("./DownloadsDialog-D71PJHTm.js")), Pi = 15;
|
|
3917
|
+
function Fi(e) {
|
|
3916
3918
|
return e ? e.split(/[,\n]/).map((e) => e.trim()).filter(Boolean) : [];
|
|
3917
3919
|
}
|
|
3918
|
-
function
|
|
3920
|
+
function Ii(e) {
|
|
3919
3921
|
return e ? e.split(/\r?\n/).map((e) => e.trim()).filter(Boolean).map((e) => {
|
|
3920
3922
|
let t = e.split(",").map((e) => e.trim()), n = Number(t[t.length - 2]), r = Number(t[t.length - 1]);
|
|
3921
3923
|
return t.length >= 2 && t[t.length - 2] !== "" && t[t.length - 1] !== "" && Number.isFinite(n) && Number.isFinite(r) ? {
|
|
@@ -3925,36 +3927,36 @@ function ji(e) {
|
|
|
3925
3927
|
} : { label: e };
|
|
3926
3928
|
}) : [];
|
|
3927
3929
|
}
|
|
3928
|
-
var
|
|
3929
|
-
function
|
|
3930
|
-
return
|
|
3930
|
+
var Li = (e) => e.endsWith(".webm") || e.endsWith(".mp4"), Ri = (e) => e.startsWith("blob:");
|
|
3931
|
+
function zi({ url: e, src: t }) {
|
|
3932
|
+
return Li(e) ? Promise.resolve(!0) : new Promise((e) => {
|
|
3931
3933
|
let n = new Image();
|
|
3932
3934
|
n.decoding = "async", n.onload = () => e(!0), n.onerror = () => e(!1), n.src = t;
|
|
3933
3935
|
});
|
|
3934
3936
|
}
|
|
3935
|
-
function
|
|
3936
|
-
let { sendMessage: e } = u(), n = o(), r = n ? (e) => n.openPanel(e.url, "", { suggestQuestions: !0 }) : void 0, [i, a] = O(null), [s, c] = O(null), [l, d] = O(!1), [f, p] = O(!1), [m, h] = O(!1), [g, _] = O([]), [v, b] = O(!0), [x, S] = O(5), [C, w] = O(12), [E, D] = O("fahrenheit"), [k, A] = O(null), [j, M] = O(!0), [N, I] = O(null), [L, R] = O(null), [z, B] = O([]), [V, H] = O("trending"), [
|
|
3937
|
+
function Bi() {
|
|
3938
|
+
let { sendMessage: e } = u(), n = o(), r = n ? (e) => n.openPanel(e.url, "", { suggestQuestions: !0 }) : void 0, [i, a] = O(null), [s, c] = O(null), [l, d] = O(!1), [f, p] = O(!1), [m, h] = O(!1), [g, _] = O([]), [v, b] = O(!0), [x, S] = O(5), [C, w] = O(12), [E, D] = O("fahrenheit"), [k, A] = O(null), [j, M] = O(!0), [N, I] = O(null), [L, R] = O(null), [z, B] = O([]), [V, H] = O("trending"), [U, ee] = O(null), [W, te] = O(!0), [ne, re] = O(!1), [ie, ae] = O(!1), [oe, se] = O(!1), ce = t.footerLinks.map((e) => e.url === "/#downloads" ? {
|
|
3937
3939
|
...e,
|
|
3938
3940
|
onClick: () => {
|
|
3939
3941
|
h(!0), p(!0);
|
|
3940
3942
|
}
|
|
3941
|
-
} : e),
|
|
3943
|
+
} : e), le = k || t.trendingNewsApiUrl, ue = U?.enabled !== !1, de = U?.allowUserTopics === !1 ? [] : z, fe = N ?? U?.maxTopics ?? 6, pe = L ?? U?.showImages ?? !0, me = j && ue;
|
|
3942
3944
|
T(() => {
|
|
3943
3945
|
let e = t.trendingNewsSettingsUrl;
|
|
3944
3946
|
if (!e) return;
|
|
3945
3947
|
let n = !0;
|
|
3946
3948
|
return fetch(e).then((e) => e.ok ? e.json() : null).then((e) => {
|
|
3947
|
-
n && e &&
|
|
3949
|
+
n && e && ee(e);
|
|
3948
3950
|
}).catch(() => {}), () => {
|
|
3949
3951
|
n = !1;
|
|
3950
3952
|
};
|
|
3951
3953
|
}, []), T(() => {
|
|
3952
3954
|
let e = () => {
|
|
3953
|
-
_(
|
|
3955
|
+
_(Ii(localStorage.getItem("weatherLocations"))), b(localStorage.getItem("showWeatherWidget") !== "false"), S(Number(localStorage.getItem("weatherForecastDays")) || 5), w(Number(localStorage.getItem("weatherForecastHours")) || 12), D(localStorage.getItem("weatherTemperatureUnit") === "celsius" ? "celsius" : "fahrenheit"), A(localStorage.getItem("trendingNewsApiUrl")), M(localStorage.getItem("showTrendingNewsWidget") !== "false");
|
|
3954
3956
|
let e = localStorage.getItem("trendingNewsMaxTopics");
|
|
3955
3957
|
I(e && Number(e) || null);
|
|
3956
3958
|
let t = localStorage.getItem("trendingNewsShowImages");
|
|
3957
|
-
R(t === null ? null : t !== "false"), B(
|
|
3959
|
+
R(t === null ? null : t !== "false"), B(Fi(localStorage.getItem("trendingNewsCustomTopics"))), H(localStorage.getItem("trendingNewsSource") === "hckrnews" ? "hckrnews" : "trending"), te(localStorage.getItem("showEducationPlaylistsWidget") !== "false"), ae(localStorage.getItem("orbHoverGlow") === "true"), se(localStorage.getItem("cursorGlowTrail") === "true");
|
|
3958
3960
|
};
|
|
3959
3961
|
return e(), window.addEventListener("client-config-changed", e), window.addEventListener("storage", e), () => {
|
|
3960
3962
|
window.removeEventListener("client-config-changed", e), window.removeEventListener("storage", e);
|
|
@@ -3962,10 +3964,10 @@ function Fi() {
|
|
|
3962
3964
|
}, []), T(() => {
|
|
3963
3965
|
let e, t = () => {
|
|
3964
3966
|
if (typeof window.requestIdleCallback == "function") {
|
|
3965
|
-
let t = window.requestIdleCallback(() =>
|
|
3967
|
+
let t = window.requestIdleCallback(() => re(!0), { timeout: 2500 });
|
|
3966
3968
|
e = () => window.cancelIdleCallback(t);
|
|
3967
3969
|
} else {
|
|
3968
|
-
let t = window.setTimeout(() =>
|
|
3970
|
+
let t = window.setTimeout(() => re(!0), 800);
|
|
3969
3971
|
e = () => window.clearTimeout(t);
|
|
3970
3972
|
}
|
|
3971
3973
|
};
|
|
@@ -3974,25 +3976,25 @@ function Fi() {
|
|
|
3974
3976
|
};
|
|
3975
3977
|
}, []), T(() => {
|
|
3976
3978
|
if (localStorage.getItem("showBackgroundArt") === "false") return;
|
|
3977
|
-
let e = !1, t, n, r, i = null, o = null, s = /* @__PURE__ */ new Set(), l = (e) => (e &&
|
|
3978
|
-
e &&
|
|
3979
|
-
}, f = async (t) => t ? e || !await
|
|
3979
|
+
let e = !1, t, n, r, i = null, o = null, s = /* @__PURE__ */ new Set(), l = (e) => (e && Ri(e.src) && s.add(e.src), e), u = (e) => {
|
|
3980
|
+
e && Ri(e.src) && (URL.revokeObjectURL(e.src), s.delete(e.src));
|
|
3981
|
+
}, f = async (t) => t ? e || !await zi(t) ? (u(t), null) : t : null, p = async (e) => {
|
|
3980
3982
|
if (!e) return null;
|
|
3981
|
-
let t = await
|
|
3983
|
+
let t = await Oi(e);
|
|
3982
3984
|
return f(l(t ? {
|
|
3983
3985
|
url: e,
|
|
3984
3986
|
src: t
|
|
3985
3987
|
} : null));
|
|
3986
3988
|
}, m = async (e) => {
|
|
3987
|
-
let t =
|
|
3989
|
+
let t = bi().length < 10 ? Ei() : null;
|
|
3988
3990
|
if (t) {
|
|
3989
|
-
let e = await
|
|
3991
|
+
let e = await ki(t), n = await f(l(e ? {
|
|
3990
3992
|
url: t,
|
|
3991
3993
|
src: e
|
|
3992
3994
|
} : null));
|
|
3993
3995
|
if (n) return n;
|
|
3994
3996
|
}
|
|
3995
|
-
return p(
|
|
3997
|
+
return p(Ti(e?.url));
|
|
3996
3998
|
}, h = (e) => {
|
|
3997
3999
|
let t = i;
|
|
3998
4000
|
i = e, t ? (c(e), d(!0), n = setTimeout(() => {
|
|
@@ -4003,7 +4005,7 @@ function Fi() {
|
|
|
4003
4005
|
g = !0;
|
|
4004
4006
|
let t = await (o ?? m(i));
|
|
4005
4007
|
o = null, g = !1, e || (t && h(t), o = m(i));
|
|
4006
|
-
}, v = p(
|
|
4008
|
+
}, v = p(Ti()).then((t) => {
|
|
4007
4009
|
t && !e && h(t);
|
|
4008
4010
|
}), y = () => {
|
|
4009
4011
|
v.then(() => {
|
|
@@ -4023,7 +4025,7 @@ function Fi() {
|
|
|
4023
4025
|
for (let e of s) URL.revokeObjectURL(e);
|
|
4024
4026
|
};
|
|
4025
4027
|
}, []);
|
|
4026
|
-
let
|
|
4028
|
+
let he = ({ url: e, src: t }, n) => Li(e) ? /* @__PURE__ */ P("video", {
|
|
4027
4029
|
src: t,
|
|
4028
4030
|
autoPlay: !0,
|
|
4029
4031
|
loop: !0,
|
|
@@ -4042,9 +4044,9 @@ function Fi() {
|
|
|
4042
4044
|
/* @__PURE__ */ F("div", {
|
|
4043
4045
|
className: "absolute inset-0 z-0",
|
|
4044
4046
|
children: [
|
|
4045
|
-
i &&
|
|
4046
|
-
s &&
|
|
4047
|
-
|
|
4047
|
+
i && he(i, l ? "opacity-0" : "opacity-30"),
|
|
4048
|
+
s && he(s, l ? "opacity-30" : "opacity-0"),
|
|
4049
|
+
oe && /* @__PURE__ */ P(Kt, {})
|
|
4048
4050
|
]
|
|
4049
4051
|
}),
|
|
4050
4052
|
/* @__PURE__ */ P("div", {
|
|
@@ -4059,8 +4061,8 @@ function Fi() {
|
|
|
4059
4061
|
alignItems: "center",
|
|
4060
4062
|
justifyContent: "center"
|
|
4061
4063
|
},
|
|
4062
|
-
className:
|
|
4063
|
-
children: /* @__PURE__ */ P(
|
|
4064
|
+
className: ie ? void 0 : "pointer-events-none",
|
|
4065
|
+
children: /* @__PURE__ */ P(Ot, {
|
|
4064
4066
|
autoRandomize: !0,
|
|
4065
4067
|
onSphereClick: () => console.log("Sphere clicked"),
|
|
4066
4068
|
className: "my-custom-class"
|
|
@@ -4068,14 +4070,14 @@ function Fi() {
|
|
|
4068
4070
|
}), /* @__PURE__ */ F("div", {
|
|
4069
4071
|
className: "w-full max-w-2xl mt-2 space-y-2",
|
|
4070
4072
|
children: [
|
|
4071
|
-
/* @__PURE__ */ P(
|
|
4072
|
-
/* @__PURE__ */ P(
|
|
4073
|
-
|
|
4073
|
+
/* @__PURE__ */ P(li, {}),
|
|
4074
|
+
/* @__PURE__ */ P(Ur, {}),
|
|
4075
|
+
ne && (W || v || me) && /* @__PURE__ */ P(y, {
|
|
4074
4076
|
fallback: null,
|
|
4075
4077
|
children: /* @__PURE__ */ F("div", {
|
|
4076
4078
|
className: "flex flex-col gap-2 w-full",
|
|
4077
4079
|
children: [
|
|
4078
|
-
|
|
4080
|
+
W && /* @__PURE__ */ P(Mi, {
|
|
4079
4081
|
compact: !0,
|
|
4080
4082
|
planEndpoint: t.educationPlaylistsApiUrl || void 0,
|
|
4081
4083
|
openHref: t.educationPlaylistsPageUrl || void 0,
|
|
@@ -4089,16 +4091,16 @@ function Fi() {
|
|
|
4089
4091
|
maxWidth: "100%"
|
|
4090
4092
|
}
|
|
4091
4093
|
}),
|
|
4092
|
-
|
|
4094
|
+
me && /* @__PURE__ */ P(ji, {
|
|
4093
4095
|
compact: !0,
|
|
4094
4096
|
expandable: !0,
|
|
4095
|
-
maxTopics:
|
|
4096
|
-
expandedMaxTopics:
|
|
4097
|
-
showImages:
|
|
4098
|
-
apiEndpoint:
|
|
4099
|
-
topics:
|
|
4097
|
+
maxTopics: fe,
|
|
4098
|
+
expandedMaxTopics: Pi,
|
|
4099
|
+
showImages: pe,
|
|
4100
|
+
apiEndpoint: le,
|
|
4101
|
+
topics: de,
|
|
4100
4102
|
source: V,
|
|
4101
|
-
limit:
|
|
4103
|
+
limit: Pi,
|
|
4102
4104
|
className: "rounded-2xl w-full",
|
|
4103
4105
|
style: {
|
|
4104
4106
|
background: "rgba(255,255,255,0.08)",
|
|
@@ -4108,7 +4110,7 @@ function Fi() {
|
|
|
4108
4110
|
maxWidth: "100%"
|
|
4109
4111
|
}
|
|
4110
4112
|
}),
|
|
4111
|
-
v && /* @__PURE__ */ P(
|
|
4113
|
+
v && /* @__PURE__ */ P(Ai, {
|
|
4112
4114
|
compact: !0,
|
|
4113
4115
|
forecastDays: x,
|
|
4114
4116
|
forecastHours: C,
|
|
@@ -4125,24 +4127,24 @@ function Fi() {
|
|
|
4125
4127
|
]
|
|
4126
4128
|
})
|
|
4127
4129
|
}),
|
|
4128
|
-
/* @__PURE__ */ P(
|
|
4130
|
+
/* @__PURE__ */ P(pi, { listFooterLinks: ce })
|
|
4129
4131
|
]
|
|
4130
4132
|
})]
|
|
4131
4133
|
})
|
|
4132
4134
|
}),
|
|
4133
4135
|
m && /* @__PURE__ */ P(y, {
|
|
4134
4136
|
fallback: null,
|
|
4135
|
-
children: /* @__PURE__ */ P(
|
|
4137
|
+
children: /* @__PURE__ */ P(Ni, {
|
|
4136
4138
|
open: f,
|
|
4137
4139
|
onOpenChange: p
|
|
4138
4140
|
})
|
|
4139
4141
|
}),
|
|
4140
|
-
/* @__PURE__ */ P(
|
|
4142
|
+
/* @__PURE__ */ P(hi, {})
|
|
4141
4143
|
]
|
|
4142
4144
|
});
|
|
4143
4145
|
}
|
|
4144
4146
|
// src/ui/Loader.tsx
|
|
4145
|
-
var
|
|
4147
|
+
var Vi = () => /* @__PURE__ */ F("svg", {
|
|
4146
4148
|
"aria-hidden": "true",
|
|
4147
4149
|
className: "w-8 h-8 text-border fill-secondary animate-spin",
|
|
4148
4150
|
viewBox: "0 0 100 101",
|
|
@@ -4157,7 +4159,7 @@ var Ii = () => /* @__PURE__ */ F("svg", {
|
|
|
4157
4159
|
})]
|
|
4158
4160
|
});
|
|
4159
4161
|
// src/components/ConfigError.tsx
|
|
4160
|
-
function
|
|
4162
|
+
function Hi() {
|
|
4161
4163
|
return /* @__PURE__ */ P("div", {
|
|
4162
4164
|
className: "flex min-h-screen flex-col items-center justify-center p-8",
|
|
4163
4165
|
children: /* @__PURE__ */ F("div", {
|
|
@@ -4274,15 +4276,15 @@ function Li() {
|
|
|
4274
4276
|
});
|
|
4275
4277
|
}
|
|
4276
4278
|
// src/components/ChatConversation/ChatWindow.tsx
|
|
4277
|
-
var
|
|
4279
|
+
var Ui = () => import("./ChatConversationThread-CEsCKbEo.js"), Wi = S(Ui), Gi = () => {
|
|
4278
4280
|
let e = j(), { hasError: t, isReady: r, notFound: i, messages: a } = u(), { isAuthenticated: o } = n(), s = r && !i && a.length === 0;
|
|
4279
4281
|
return T(() => {
|
|
4280
4282
|
if (!s) return;
|
|
4281
4283
|
if (typeof window.requestIdleCallback == "function") {
|
|
4282
|
-
let e = window.requestIdleCallback(() => void
|
|
4284
|
+
let e = window.requestIdleCallback(() => void Ui(), { timeout: 5e3 });
|
|
4283
4285
|
return () => window.cancelIdleCallback(e);
|
|
4284
4286
|
}
|
|
4285
|
-
let e = window.setTimeout(() => void
|
|
4287
|
+
let e = window.setTimeout(() => void Ui(), 3e3);
|
|
4286
4288
|
return () => window.clearTimeout(e);
|
|
4287
4289
|
}, [s]), T(() => {
|
|
4288
4290
|
r && i && !o && e.replace("/");
|
|
@@ -4291,9 +4293,9 @@ var Ri = () => import("./ChatConversationThread-B70yZMw_.js"), zi = S(Ri), Bi =
|
|
|
4291
4293
|
i,
|
|
4292
4294
|
o,
|
|
4293
4295
|
e
|
|
4294
|
-
]), t ? /* @__PURE__ */ P(
|
|
4296
|
+
]), t ? /* @__PURE__ */ P(Hi, {}) : r && i && !o ? /* @__PURE__ */ P("div", {
|
|
4295
4297
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
4296
|
-
children: /* @__PURE__ */ P(
|
|
4298
|
+
children: /* @__PURE__ */ P(Vi, {})
|
|
4297
4299
|
}) : r ? i ? /* @__PURE__ */ F("div", {
|
|
4298
4300
|
className: "flex min-h-screen flex-col items-center justify-center gap-3 px-4 text-center",
|
|
4299
4301
|
children: [/* @__PURE__ */ P("p", {
|
|
@@ -4308,15 +4310,15 @@ var Ri = () => import("./ChatConversationThread-B70yZMw_.js"), zi = S(Ri), Bi =
|
|
|
4308
4310
|
}) : /* @__PURE__ */ P("div", { children: a.length > 0 ? /* @__PURE__ */ P(N, { children: /* @__PURE__ */ P(y, {
|
|
4309
4311
|
fallback: /* @__PURE__ */ P("div", {
|
|
4310
4312
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
4311
|
-
children: /* @__PURE__ */ P(
|
|
4313
|
+
children: /* @__PURE__ */ P(Vi, {})
|
|
4312
4314
|
}),
|
|
4313
|
-
children: /* @__PURE__ */ P(
|
|
4314
|
-
}) }) : /* @__PURE__ */ P(
|
|
4315
|
+
children: /* @__PURE__ */ P(Wi, {})
|
|
4316
|
+
}) }) : /* @__PURE__ */ P(Bi, {}) }) : /* @__PURE__ */ P("div", {
|
|
4315
4317
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
4316
|
-
children: /* @__PURE__ */ P(
|
|
4318
|
+
children: /* @__PURE__ */ P(Vi, {})
|
|
4317
4319
|
});
|
|
4318
|
-
},
|
|
4319
|
-
function
|
|
4320
|
+
}, Ki = "https://qwksearch.com", qi = null, Ji = Ki, Yi = !1;
|
|
4321
|
+
function Xi(e, t) {
|
|
4320
4322
|
let n;
|
|
4321
4323
|
n = typeof e == "string" ? e : e instanceof URL ? e.href : e.url;
|
|
4322
4324
|
try {
|
|
@@ -4326,32 +4328,32 @@ function Gi(e, t) {
|
|
|
4326
4328
|
return !1;
|
|
4327
4329
|
}
|
|
4328
4330
|
}
|
|
4329
|
-
function
|
|
4330
|
-
if (
|
|
4331
|
-
|
|
4331
|
+
function Zi() {
|
|
4332
|
+
if (Yi || typeof window > "u" || typeof window.fetch != "function") return;
|
|
4333
|
+
Yi = !0;
|
|
4332
4334
|
let e = window.fetch.bind(window);
|
|
4333
4335
|
window.fetch = (t, n) => {
|
|
4334
|
-
if (!
|
|
4336
|
+
if (!qi || !Xi(t, Ji)) return e(t, n);
|
|
4335
4337
|
let r = new Headers(n?.headers ?? (t instanceof Request ? t.headers : void 0));
|
|
4336
|
-
return !r.has("x-api-key") && !r.has("authorization") && r.set("X-API-Key",
|
|
4338
|
+
return !r.has("x-api-key") && !r.has("authorization") && r.set("X-API-Key", qi), e(t, {
|
|
4337
4339
|
...n,
|
|
4338
4340
|
headers: r
|
|
4339
4341
|
});
|
|
4340
4342
|
};
|
|
4341
4343
|
}
|
|
4342
|
-
function
|
|
4343
|
-
|
|
4344
|
+
function Qi(e, t = Ki) {
|
|
4345
|
+
qi = e || null, Ji = t.replace(/\/+$/, ""), qi && Zi();
|
|
4344
4346
|
}
|
|
4345
|
-
function
|
|
4346
|
-
return
|
|
4347
|
+
function $i() {
|
|
4348
|
+
return qi;
|
|
4347
4349
|
}
|
|
4348
|
-
function
|
|
4350
|
+
function ea(e, t) {
|
|
4349
4351
|
let n = t ?? (typeof window < "u" ? `${window.location.pathname}${window.location.search}` : "/");
|
|
4350
4352
|
return `${e}${e.includes("?") ? "&" : "?"}returnTo=${encodeURIComponent(n)}`;
|
|
4351
4353
|
}
|
|
4352
|
-
function
|
|
4354
|
+
function ta(e) {
|
|
4353
4355
|
let t = e.qwksearchOrigin ?? "https://qwksearch.com", n = { connected: !1 }, r = /* @__PURE__ */ new Set(), i = (i) => {
|
|
4354
|
-
n = i,
|
|
4356
|
+
n = i, Qi(i.connected ? i.apiKey ?? null : null, t), e.onSession?.(i), r.forEach((e) => e());
|
|
4355
4357
|
}, a = null, o = () => (a ??= fetch(e.sessionUrl, {
|
|
4356
4358
|
credentials: "same-origin",
|
|
4357
4359
|
headers: { Accept: "application/json" }
|
|
@@ -4368,7 +4370,7 @@ function Xi(e) {
|
|
|
4368
4370
|
},
|
|
4369
4371
|
oneTap: (e) => {},
|
|
4370
4372
|
signIn: { social: (t) => {
|
|
4371
|
-
typeof window < "u" && window.location.assign(
|
|
4373
|
+
typeof window < "u" && window.location.assign(ea(e.connectUrl));
|
|
4372
4374
|
} },
|
|
4373
4375
|
signOut: async (t) => {
|
|
4374
4376
|
try {
|
|
@@ -4384,14 +4386,14 @@ function Xi(e) {
|
|
|
4384
4386
|
};
|
|
4385
4387
|
}
|
|
4386
4388
|
// src/components/ArticleReader/ArticlePanelHeader.tsx
|
|
4387
|
-
var
|
|
4389
|
+
var na = ({ onClose: e }) => /* @__PURE__ */ P("div", {
|
|
4388
4390
|
className: "flex items-center justify-between bg-secondary px-4 py-3 border-b border-border",
|
|
4389
4391
|
children: /* @__PURE__ */ P("button", {
|
|
4390
4392
|
onClick: e,
|
|
4391
4393
|
className: "rounded-md p-1 hover:bg-accent transition-colors",
|
|
4392
|
-
children: /* @__PURE__ */ P(
|
|
4394
|
+
children: /* @__PURE__ */ P(nt, { className: "h-5 w-5" })
|
|
4393
4395
|
})
|
|
4394
|
-
}),
|
|
4396
|
+
}), ra = Dt("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", {
|
|
4395
4397
|
variants: {
|
|
4396
4398
|
variant: {
|
|
4397
4399
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
@@ -4414,9 +4416,9 @@ var Zi = ({ onClose: e }) => /* @__PURE__ */ P("div", {
|
|
|
4414
4416
|
}
|
|
4415
4417
|
});
|
|
4416
4418
|
function Q({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
4417
|
-
return /* @__PURE__ */ P(r ?
|
|
4419
|
+
return /* @__PURE__ */ P(r ? Et : "button", {
|
|
4418
4420
|
"data-slot": "button",
|
|
4419
|
-
className: h(
|
|
4421
|
+
className: h(ra({
|
|
4420
4422
|
variant: t,
|
|
4421
4423
|
size: n,
|
|
4422
4424
|
className: e
|
|
@@ -4425,7 +4427,7 @@ function Q({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
|
4425
4427
|
});
|
|
4426
4428
|
}
|
|
4427
4429
|
// src/components/ArticleReader/ArticleActionButtons.tsx
|
|
4428
|
-
var
|
|
4430
|
+
var ia = {
|
|
4429
4431
|
ask: {
|
|
4430
4432
|
alt: !0,
|
|
4431
4433
|
key: "a"
|
|
@@ -4466,12 +4468,12 @@ var $i = {
|
|
|
4466
4468
|
alt: !1,
|
|
4467
4469
|
key: "Escape"
|
|
4468
4470
|
}
|
|
4469
|
-
},
|
|
4470
|
-
function
|
|
4471
|
-
let { alt: t, key: n } =
|
|
4472
|
-
return t ?
|
|
4471
|
+
}, aa = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent || "");
|
|
4472
|
+
function oa(e) {
|
|
4473
|
+
let { alt: t, key: n } = ia[e], r = n === "Escape" ? "Esc" : n.length === 1 ? n.toUpperCase() : n;
|
|
4474
|
+
return t ? aa ? `⌥${r}` : `Alt+${r}` : r;
|
|
4473
4475
|
}
|
|
4474
|
-
var
|
|
4476
|
+
var sa = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80 hover:text-foreground text-muted-foreground"), $ = ({ label: e, action: t, children: n }) => /* @__PURE__ */ F(l, { children: [/* @__PURE__ */ P(s, {
|
|
4475
4477
|
asChild: !0,
|
|
4476
4478
|
children: n
|
|
4477
4479
|
}), /* @__PURE__ */ P(a, {
|
|
@@ -4480,10 +4482,10 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4480
4482
|
className: "flex items-center gap-1.5",
|
|
4481
4483
|
children: [/* @__PURE__ */ P("span", { children: e }), t && /* @__PURE__ */ P("kbd", {
|
|
4482
4484
|
className: "rounded bg-primary-foreground/20 px-1 py-0.5 text-[10px] font-semibold leading-none tracking-wide",
|
|
4483
|
-
children:
|
|
4485
|
+
children: oa(t)
|
|
4484
4486
|
})]
|
|
4485
4487
|
})
|
|
4486
|
-
})] }),
|
|
4488
|
+
})] }), ca = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavorited: r, isHighlightMode: i, articleUrl: a, fontScale: o, onAskClick: s, onSuggestClick: c, onCopyClick: l, onShareClick: u, onFavoriteClick: d, onHighlightToggle: f, onZoomIn: p, onZoomOut: m, onZoomReset: g, onClose: _ }) => {
|
|
4487
4489
|
let v = p || m, y = Math.round((o ?? 1) * 100);
|
|
4488
4490
|
return /* @__PURE__ */ F("div", {
|
|
4489
4491
|
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",
|
|
@@ -4497,7 +4499,7 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4497
4499
|
variant: "ghost",
|
|
4498
4500
|
size: "sm",
|
|
4499
4501
|
className: h("flex items-center gap-2 px-3 h-9 rounded-xl transition-all duration-200", "hover:bg-muted/80 hover:text-foreground text-muted-foreground"),
|
|
4500
|
-
children: [/* @__PURE__ */ P(
|
|
4502
|
+
children: [/* @__PURE__ */ P(ee, { className: "size-4" }), /* @__PURE__ */ P("span", {
|
|
4501
4503
|
className: "font-medium",
|
|
4502
4504
|
children: e ? "..." : "Ask"
|
|
4503
4505
|
})]
|
|
@@ -4512,7 +4514,7 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4512
4514
|
variant: "ghost",
|
|
4513
4515
|
size: "sm",
|
|
4514
4516
|
className: h("flex items-center gap-2 px-3 h-9 rounded-xl transition-all duration-200", "hover:bg-muted/80 hover:text-foreground text-muted-foreground"),
|
|
4515
|
-
children: [/* @__PURE__ */ P(
|
|
4517
|
+
children: [/* @__PURE__ */ P(Ne, { className: "size-4" }), /* @__PURE__ */ P("span", {
|
|
4516
4518
|
className: "font-medium",
|
|
4517
4519
|
children: "Suggest"
|
|
4518
4520
|
})]
|
|
@@ -4525,8 +4527,8 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4525
4527
|
onClick: l,
|
|
4526
4528
|
variant: "ghost",
|
|
4527
4529
|
size: "icon",
|
|
4528
|
-
className:
|
|
4529
|
-
children: /* @__PURE__ */ P(
|
|
4530
|
+
className: sa,
|
|
4531
|
+
children: /* @__PURE__ */ P(oe, { className: "size-4" })
|
|
4530
4532
|
})
|
|
4531
4533
|
}),
|
|
4532
4534
|
/* @__PURE__ */ P($, {
|
|
@@ -4535,8 +4537,8 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4535
4537
|
onClick: u,
|
|
4536
4538
|
variant: "ghost",
|
|
4537
4539
|
size: "icon",
|
|
4538
|
-
className:
|
|
4539
|
-
children: /* @__PURE__ */ P(
|
|
4540
|
+
className: sa,
|
|
4541
|
+
children: /* @__PURE__ */ P(We, { className: "size-4" })
|
|
4540
4542
|
})
|
|
4541
4543
|
}),
|
|
4542
4544
|
/* @__PURE__ */ P($, {
|
|
@@ -4547,7 +4549,7 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4547
4549
|
variant: "ghost",
|
|
4548
4550
|
size: "icon",
|
|
4549
4551
|
className: h("h-9 w-9 rounded-xl transition-all duration-200", i ? "text-yellow-500 bg-yellow-50 dark:bg-yellow-950/30 hover:bg-yellow-100 dark:hover:bg-yellow-950/50" : "hover:bg-muted/80 hover:text-foreground text-muted-foreground"),
|
|
4550
|
-
children: /* @__PURE__ */ P(
|
|
4552
|
+
children: /* @__PURE__ */ P(Ce, { className: "size-4" })
|
|
4551
4553
|
})
|
|
4552
4554
|
}),
|
|
4553
4555
|
/* @__PURE__ */ P($, {
|
|
@@ -4559,7 +4561,7 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4559
4561
|
variant: "ghost",
|
|
4560
4562
|
size: "icon",
|
|
4561
4563
|
className: h("h-9 w-9 rounded-xl transition-all duration-200", r ? "text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50 dark:hover:bg-yellow-950/30" : "hover:bg-muted/80 hover:text-foreground text-muted-foreground"),
|
|
4562
|
-
children: /* @__PURE__ */ P(
|
|
4564
|
+
children: /* @__PURE__ */ P(Ye, { className: h("size-4", r && "fill-yellow-400") })
|
|
4563
4565
|
})
|
|
4564
4566
|
}),
|
|
4565
4567
|
a && /* @__PURE__ */ P($, {
|
|
@@ -4569,12 +4571,12 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4569
4571
|
asChild: !0,
|
|
4570
4572
|
variant: "ghost",
|
|
4571
4573
|
size: "icon",
|
|
4572
|
-
className:
|
|
4574
|
+
className: sa,
|
|
4573
4575
|
children: /* @__PURE__ */ P("a", {
|
|
4574
4576
|
href: a,
|
|
4575
4577
|
target: "_blank",
|
|
4576
4578
|
rel: "noopener noreferrer",
|
|
4577
|
-
children: /* @__PURE__ */ P(
|
|
4579
|
+
children: /* @__PURE__ */ P(pe, { className: "size-4" })
|
|
4578
4580
|
})
|
|
4579
4581
|
})
|
|
4580
4582
|
}),
|
|
@@ -4589,7 +4591,7 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4589
4591
|
variant: "ghost",
|
|
4590
4592
|
size: "icon",
|
|
4591
4593
|
className: "h-8 w-8 rounded-lg text-muted-foreground transition-all duration-200 hover:bg-muted/80 hover:text-foreground",
|
|
4592
|
-
children: /* @__PURE__ */ P(
|
|
4594
|
+
children: /* @__PURE__ */ P(it, { className: "size-4" })
|
|
4593
4595
|
})
|
|
4594
4596
|
}),
|
|
4595
4597
|
/* @__PURE__ */ P($, {
|
|
@@ -4610,7 +4612,7 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4610
4612
|
variant: "ghost",
|
|
4611
4613
|
size: "icon",
|
|
4612
4614
|
className: "h-8 w-8 rounded-lg text-muted-foreground transition-all duration-200 hover:bg-muted/80 hover:text-foreground",
|
|
4613
|
-
children: /* @__PURE__ */ P(
|
|
4615
|
+
children: /* @__PURE__ */ P(rt, { className: "size-4" })
|
|
4614
4616
|
})
|
|
4615
4617
|
})
|
|
4616
4618
|
]
|
|
@@ -4622,13 +4624,13 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4622
4624
|
onClick: _,
|
|
4623
4625
|
variant: "ghost",
|
|
4624
4626
|
size: "icon",
|
|
4625
|
-
className: h(
|
|
4626
|
-
children: /* @__PURE__ */ P(
|
|
4627
|
+
className: h(sa, !v && "ml-auto"),
|
|
4628
|
+
children: /* @__PURE__ */ P(nt, { className: "size-4" })
|
|
4627
4629
|
})
|
|
4628
4630
|
})
|
|
4629
4631
|
]
|
|
4630
4632
|
});
|
|
4631
|
-
},
|
|
4633
|
+
}, la = ({ value: e, onChange: t, onSubmit: n }) => /* @__PURE__ */ P("div", {
|
|
4632
4634
|
className: "relative",
|
|
4633
4635
|
children: /* @__PURE__ */ P("input", {
|
|
4634
4636
|
value: e,
|
|
@@ -4638,7 +4640,7 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4638
4640
|
placeholder: "Ask AI any question...",
|
|
4639
4641
|
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"
|
|
4640
4642
|
})
|
|
4641
|
-
}),
|
|
4643
|
+
}), ua = ({ questions: e, isLoading: n, error: r, onQuestionClick: i }) => {
|
|
4642
4644
|
let a = v.useMemo(() => {
|
|
4643
4645
|
let t = [];
|
|
4644
4646
|
return e.forEach((e) => {
|
|
@@ -4675,7 +4677,7 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4675
4677
|
children: r
|
|
4676
4678
|
})
|
|
4677
4679
|
] });
|
|
4678
|
-
},
|
|
4680
|
+
}, da = ({ response: e, isLoading: t, error: n }) => /* @__PURE__ */ F(N, { children: [
|
|
4679
4681
|
t && /* @__PURE__ */ P("div", {
|
|
4680
4682
|
className: "flex justify-center",
|
|
4681
4683
|
children: /* @__PURE__ */ P("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" })
|
|
@@ -4689,13 +4691,47 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4689
4691
|
className: "bg-red-500 text-white p-2 rounded-md text-sm",
|
|
4690
4692
|
children: n
|
|
4691
4693
|
})
|
|
4692
|
-
] }),
|
|
4693
|
-
|
|
4694
|
-
return
|
|
4695
|
-
|
|
4694
|
+
] }), fa = "h1, h2, h3", pa = /^[A-Za-z][\w:.-]*$/;
|
|
4695
|
+
function ma(e) {
|
|
4696
|
+
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48) || "section";
|
|
4697
|
+
}
|
|
4698
|
+
function ha(e) {
|
|
4699
|
+
if (!e || typeof DOMParser > "u") return {
|
|
4700
|
+
html: e,
|
|
4701
|
+
items: []
|
|
4702
|
+
};
|
|
4703
|
+
let t = new DOMParser().parseFromString(`<body>${e}</body>`, "text/html"), n = Array.from(t.body.querySelectorAll(fa)).filter((e) => (e.textContent ?? "").trim() !== "");
|
|
4704
|
+
if (n.length === 0) return {
|
|
4705
|
+
html: e,
|
|
4706
|
+
items: []
|
|
4707
|
+
};
|
|
4708
|
+
let r = new Set(n.map((e) => e.id).filter((e) => pa.test(e))), i = /* @__PURE__ */ new Set(), a = n.map((e, t) => {
|
|
4709
|
+
let n = e.id;
|
|
4710
|
+
if (!pa.test(n) || i.has(n)) {
|
|
4711
|
+
let a = (e.textContent ?? "").trim();
|
|
4712
|
+
for (n = `outline-${t + 1}-${ma(a)}`; r.has(n) || i.has(n);) n = `${n}-x`;
|
|
4713
|
+
e.id = n;
|
|
4714
|
+
}
|
|
4715
|
+
return i.add(n), {
|
|
4716
|
+
title: (e.textContent ?? "").replace(/\s+/g, " ").trim(),
|
|
4717
|
+
url: `#${n}`,
|
|
4718
|
+
depth: Number(e.tagName.slice(1))
|
|
4719
|
+
};
|
|
4720
|
+
});
|
|
4721
|
+
return {
|
|
4722
|
+
html: t.body.innerHTML,
|
|
4723
|
+
items: a
|
|
4724
|
+
};
|
|
4725
|
+
}
|
|
4726
|
+
// src/components/ArticleReader/LexicalArticleViewer.tsx
|
|
4727
|
+
var ga = ({ html: e, isHighlightMode: t = !1, fontScale: n = 1, onOutlineChange: r }) => {
|
|
4728
|
+
let [i, a] = O(""), o = D(r);
|
|
4729
|
+
return o.current = r, T(() => {
|
|
4730
|
+
let t = ha(kt.sanitize(e || "", {
|
|
4696
4731
|
ADD_TAGS: ["figure", "figcaption"],
|
|
4697
4732
|
ADD_ATTR: ["loading"]
|
|
4698
4733
|
}));
|
|
4734
|
+
a(t.html), o.current?.(t.items);
|
|
4699
4735
|
}, [e]), /* @__PURE__ */ P("div", {
|
|
4700
4736
|
className: [
|
|
4701
4737
|
"prose prose-neutral dark:prose-invert max-w-none",
|
|
@@ -4710,9 +4746,9 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4710
4746
|
fontSize: `${n}em`,
|
|
4711
4747
|
fontFamily: "ui-serif, Georgia, Cambria, \"Times New Roman\", Times, serif"
|
|
4712
4748
|
},
|
|
4713
|
-
dangerouslySetInnerHTML: { __html:
|
|
4749
|
+
dangerouslySetInnerHTML: { __html: i }
|
|
4714
4750
|
});
|
|
4715
|
-
},
|
|
4751
|
+
}, _a = ({ article: e, isHighlightMode: t, fontScale: n = 1, onOutlineChange: r }) => /* @__PURE__ */ P("div", {
|
|
4716
4752
|
className: "border-t border-border pt-6",
|
|
4717
4753
|
children: /* @__PURE__ */ F("div", { children: [
|
|
4718
4754
|
/* @__PURE__ */ P("div", { className: "flex items-start justify-between mb-2" }),
|
|
@@ -4733,24 +4769,93 @@ var na = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4733
4769
|
}),
|
|
4734
4770
|
/* @__PURE__ */ P("div", {
|
|
4735
4771
|
id: "article-content",
|
|
4736
|
-
children: /* @__PURE__ */ P(
|
|
4772
|
+
children: /* @__PURE__ */ P(ga, {
|
|
4737
4773
|
html: e.html || "",
|
|
4738
4774
|
isHighlightMode: t,
|
|
4739
|
-
fontScale: n
|
|
4775
|
+
fontScale: n,
|
|
4776
|
+
onOutlineChange: r
|
|
4740
4777
|
})
|
|
4741
4778
|
})
|
|
4742
4779
|
] })
|
|
4743
|
-
})
|
|
4744
|
-
|
|
4780
|
+
});
|
|
4781
|
+
// src/components/ArticleReader/ArticleOutline.tsx
|
|
4782
|
+
function va() {
|
|
4783
|
+
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
4784
|
+
}
|
|
4785
|
+
function ya(e) {
|
|
4786
|
+
let t = decodeURIComponent((e.currentTarget.getAttribute("href") ?? "").slice(1)), n = t ? document.getElementById(t) : null;
|
|
4787
|
+
n && (e.preventDefault(), n.scrollIntoView({
|
|
4788
|
+
behavior: va() ? "auto" : "smooth",
|
|
4789
|
+
block: "start"
|
|
4790
|
+
}), n.hasAttribute("tabindex") || n.setAttribute("tabindex", "-1"), n.focus({ preventScroll: !0 }));
|
|
4791
|
+
}
|
|
4792
|
+
var ba = ({ items: e }) => {
|
|
4793
|
+
let t = C(ya, []);
|
|
4794
|
+
return e.length === 0 ? /* @__PURE__ */ P(Mt, {}) : /* @__PURE__ */ P(At, {
|
|
4795
|
+
toc: e,
|
|
4796
|
+
children: /* @__PURE__ */ P(jt, { children: /* @__PURE__ */ P(Pt, { children: e.map((e) => /* @__PURE__ */ P(Nt, {
|
|
4797
|
+
item: e,
|
|
4798
|
+
onClick: t
|
|
4799
|
+
}, e.url)) }) })
|
|
4800
|
+
});
|
|
4801
|
+
}, xa = [{
|
|
4802
|
+
value: "questions",
|
|
4803
|
+
label: "Questions"
|
|
4804
|
+
}, {
|
|
4805
|
+
value: "outline",
|
|
4806
|
+
label: "Outline"
|
|
4807
|
+
}];
|
|
4808
|
+
function Sa(e, t) {
|
|
4809
|
+
return {
|
|
4810
|
+
tab: `${e}-tab-${t}`,
|
|
4811
|
+
panel: `${e}-panel-${t}`
|
|
4812
|
+
};
|
|
4813
|
+
}
|
|
4814
|
+
var Ca = ({ value: e, onValueChange: t, idBase: n }) => {
|
|
4815
|
+
let r = D({}), i = (e) => {
|
|
4816
|
+
t(e), r.current[e]?.focus();
|
|
4817
|
+
}, a = (e, t) => {
|
|
4818
|
+
let n = xa.length - 1, r = e.key === "ArrowRight" ? t === n ? 0 : t + 1 : e.key === "ArrowLeft" ? t === 0 ? n : t - 1 : e.key === "Home" ? 0 : e.key === "End" ? n : null;
|
|
4819
|
+
r !== null && (e.preventDefault(), i(xa[r].value));
|
|
4820
|
+
};
|
|
4821
|
+
return /* @__PURE__ */ P("div", {
|
|
4822
|
+
role: "tablist",
|
|
4823
|
+
"aria-label": "Article sidebar",
|
|
4824
|
+
className: "flex gap-1 border-b border-border",
|
|
4825
|
+
children: xa.map((i, o) => {
|
|
4826
|
+
let s = i.value === e, c = Sa(n, i.value);
|
|
4827
|
+
return /* @__PURE__ */ P("button", {
|
|
4828
|
+
ref: (e) => {
|
|
4829
|
+
r.current[i.value] = e;
|
|
4830
|
+
},
|
|
4831
|
+
type: "button",
|
|
4832
|
+
role: "tab",
|
|
4833
|
+
id: c.tab,
|
|
4834
|
+
"aria-selected": s,
|
|
4835
|
+
"aria-controls": c.panel,
|
|
4836
|
+
tabIndex: s ? 0 : -1,
|
|
4837
|
+
onClick: () => t(i.value),
|
|
4838
|
+
onKeyDown: (e) => a(e, o),
|
|
4839
|
+
className: [
|
|
4840
|
+
"-mb-px rounded-t-md border-b-2 px-3 py-1.5 text-sm font-medium transition-colors",
|
|
4841
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
4842
|
+
s ? "border-primary text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
4843
|
+
].join(" "),
|
|
4844
|
+
children: i.label
|
|
4845
|
+
}, i.value);
|
|
4846
|
+
})
|
|
4847
|
+
});
|
|
4848
|
+
}, wa = /(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/g, Ta = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
|
|
4849
|
+
function Ea(e) {
|
|
4745
4850
|
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);
|
|
4746
4851
|
}
|
|
4747
|
-
function
|
|
4852
|
+
function Da(e) {
|
|
4748
4853
|
return /^https?:\/\//i.test(e) ? e : `https://${e}`;
|
|
4749
4854
|
}
|
|
4750
|
-
function
|
|
4855
|
+
function Oa(e) {
|
|
4751
4856
|
if (!e || typeof e != "string") return e;
|
|
4752
4857
|
let t = e, n = [], r;
|
|
4753
|
-
for (
|
|
4858
|
+
for (Ta.lastIndex = 0; (r = Ta.exec(t)) !== null;) {
|
|
4754
4859
|
let e = r[0], i = r.index, a = t.substring(0, i), o = t.substring(i + e.length);
|
|
4755
4860
|
!a.endsWith("](") && !o.startsWith(")") && n.push({
|
|
4756
4861
|
email: e,
|
|
@@ -4762,9 +4867,9 @@ function pa(e) {
|
|
|
4762
4867
|
t = t.substring(0, i) + `[${r}](mailto:${r})` + t.substring(i + r.length);
|
|
4763
4868
|
}
|
|
4764
4869
|
let i = [], a;
|
|
4765
|
-
for (
|
|
4870
|
+
for (wa.lastIndex = 0; (a = wa.exec(t)) !== null;) {
|
|
4766
4871
|
let e = a[0], n = a.index;
|
|
4767
|
-
if (
|
|
4872
|
+
if (Ta.test(e)) continue;
|
|
4768
4873
|
let r = t.substring(0, n), o = t.substring(n + e.length);
|
|
4769
4874
|
if (r.endsWith("](") || o.startsWith(")") || (r.match(/```/g) || []).length % 2 != 0) continue;
|
|
4770
4875
|
let s = r.lastIndexOf("`");
|
|
@@ -4772,22 +4877,22 @@ function pa(e) {
|
|
|
4772
4877
|
let e = t.substring(s + 1).indexOf("`");
|
|
4773
4878
|
if (e !== -1 && e > n - s - 1) continue;
|
|
4774
4879
|
}
|
|
4775
|
-
|
|
4880
|
+
Ea(e) && i.push({
|
|
4776
4881
|
url: e,
|
|
4777
4882
|
index: n
|
|
4778
4883
|
});
|
|
4779
4884
|
}
|
|
4780
4885
|
for (let e = i.length - 1; e >= 0; e--) {
|
|
4781
|
-
let { url: n, index: r } = i[e], a =
|
|
4886
|
+
let { url: n, index: r } = i[e], a = Da(n);
|
|
4782
4887
|
t = t.substring(0, r) + `[${n}](${a})` + t.substring(r + n.length);
|
|
4783
4888
|
}
|
|
4784
4889
|
return t;
|
|
4785
4890
|
}
|
|
4786
4891
|
// src/components/ArticleReader/unified-markdown.tsx
|
|
4787
|
-
function
|
|
4892
|
+
function ka(e) {
|
|
4788
4893
|
return !e || e.startsWith("http://") || e.startsWith("https://") || e.includes("://") ? !1 : e.startsWith("/") || e.startsWith("#");
|
|
4789
4894
|
}
|
|
4790
|
-
function
|
|
4895
|
+
function Aa(e, t) {
|
|
4791
4896
|
if (t.startsWith("#")) {
|
|
4792
4897
|
e.preventDefault();
|
|
4793
4898
|
let n = t.substring(1), r = document.getElementById(n);
|
|
@@ -4797,7 +4902,7 @@ function ha(e, t) {
|
|
|
4797
4902
|
});
|
|
4798
4903
|
}
|
|
4799
4904
|
}
|
|
4800
|
-
function
|
|
4905
|
+
function ja({ code: e }) {
|
|
4801
4906
|
let [t, n] = O(!1), r = C(async () => {
|
|
4802
4907
|
try {
|
|
4803
4908
|
await navigator.clipboard.writeText(e), n(!0), setTimeout(() => n(!1), 2e3);
|
|
@@ -4809,10 +4914,10 @@ function ga({ code: e }) {
|
|
|
4809
4914
|
onClick: r,
|
|
4810
4915
|
className: h("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"),
|
|
4811
4916
|
"aria-label": t ? "Copied!" : "Copy code",
|
|
4812
|
-
children: t ? /* @__PURE__ */ P(
|
|
4917
|
+
children: t ? /* @__PURE__ */ P(ne, { className: "h-4 w-4 text-green-600 dark:text-green-400" }) : /* @__PURE__ */ P(ue, { className: "h-4 w-4" })
|
|
4813
4918
|
});
|
|
4814
4919
|
}
|
|
4815
|
-
function
|
|
4920
|
+
function Ma({ children: e }) {
|
|
4816
4921
|
let t = D(null), [n, r] = O("");
|
|
4817
4922
|
return T(() => {
|
|
4818
4923
|
if (t.current) {
|
|
@@ -4828,18 +4933,18 @@ function _a({ children: e }) {
|
|
|
4828
4933
|
ref: t,
|
|
4829
4934
|
className: h("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"),
|
|
4830
4935
|
children: e
|
|
4831
|
-
}), n && /* @__PURE__ */ P(
|
|
4936
|
+
}), n && /* @__PURE__ */ P(ja, { code: n })]
|
|
4832
4937
|
});
|
|
4833
4938
|
}
|
|
4834
|
-
var
|
|
4939
|
+
var Na = v.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
4835
4940
|
if (!e) return /* @__PURE__ */ P("div", {
|
|
4836
4941
|
className: h("text-muted-foreground text-sm", t),
|
|
4837
4942
|
children: "No content"
|
|
4838
4943
|
});
|
|
4839
|
-
let r =
|
|
4944
|
+
let r = Oa(e);
|
|
4840
4945
|
return /* @__PURE__ */ P("div", {
|
|
4841
4946
|
className: h("kortix-markdown", t),
|
|
4842
|
-
children: /* @__PURE__ */ P(
|
|
4947
|
+
children: /* @__PURE__ */ P(Ft, {
|
|
4843
4948
|
isAnimating: n,
|
|
4844
4949
|
components: {
|
|
4845
4950
|
h1: ({ children: e }) => /* @__PURE__ */ P("h1", {
|
|
@@ -4883,13 +4988,13 @@ var va = v.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4883
4988
|
children: e
|
|
4884
4989
|
}),
|
|
4885
4990
|
a: ({ href: e, children: t }) => {
|
|
4886
|
-
let n =
|
|
4991
|
+
let n = ka(e), r = e?.startsWith("#"), i = h("font-medium text-foreground", "underline decoration-foreground/30 underline-offset-[3px] decoration-[1px]", "hover:decoration-foreground/60 transition-colors duration-150");
|
|
4887
4992
|
return r ? /* @__PURE__ */ P("a", {
|
|
4888
4993
|
href: e,
|
|
4889
|
-
onClick: (t) =>
|
|
4994
|
+
onClick: (t) => Aa(t, e),
|
|
4890
4995
|
className: i,
|
|
4891
4996
|
children: t
|
|
4892
|
-
}) : n ? /* @__PURE__ */ P(
|
|
4997
|
+
}) : n ? /* @__PURE__ */ P(Tt, {
|
|
4893
4998
|
href: e || "#",
|
|
4894
4999
|
className: i,
|
|
4895
5000
|
children: t
|
|
@@ -4908,7 +5013,7 @@ var va = v.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4908
5013
|
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",
|
|
4909
5014
|
children: e
|
|
4910
5015
|
}),
|
|
4911
|
-
pre: ({ children: e }) => /* @__PURE__ */ P(
|
|
5016
|
+
pre: ({ children: e }) => /* @__PURE__ */ P(Ma, { children: e }),
|
|
4912
5017
|
blockquote: ({ children: e }) => /* @__PURE__ */ P("blockquote", {
|
|
4913
5018
|
className: h("my-5 pl-4 py-1 text-sm", "border-l-2 border-border", "text-muted-foreground", "[&>p]:my-2"),
|
|
4914
5019
|
children: e
|
|
@@ -4989,17 +5094,17 @@ var va = v.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4989
5094
|
})
|
|
4990
5095
|
});
|
|
4991
5096
|
});
|
|
4992
|
-
|
|
5097
|
+
Na.displayName = "UnifiedMarkdown";
|
|
4993
5098
|
// src/app/MainViewProvider.tsx
|
|
4994
|
-
var
|
|
4995
|
-
function
|
|
5099
|
+
var Pa = b(null), Fa = "qwksearch-main-view";
|
|
5100
|
+
function Ia({ children: e, docsEnabled: t = !0 }) {
|
|
4996
5101
|
let [n, r] = O("research"), [i, a] = O(0), o = C((e) => r(t ? e : "research"), [t]);
|
|
4997
5102
|
T(() => {
|
|
4998
5103
|
if (typeof window > "u" || !t) return;
|
|
4999
|
-
let e = window.localStorage.getItem(
|
|
5104
|
+
let e = window.localStorage.getItem(Fa);
|
|
5000
5105
|
(e === "research" || e === "docs") && r(e);
|
|
5001
5106
|
}, [t]), T(() => {
|
|
5002
|
-
typeof window < "u" && t && window.localStorage.setItem(
|
|
5107
|
+
typeof window < "u" && t && window.localStorage.setItem(Fa, n);
|
|
5003
5108
|
}, [n, t]);
|
|
5004
5109
|
let s = E(() => ({
|
|
5005
5110
|
activeView: n,
|
|
@@ -5015,12 +5120,12 @@ function xa({ children: e, docsEnabled: t = !0 }) {
|
|
|
5015
5120
|
t,
|
|
5016
5121
|
i
|
|
5017
5122
|
]);
|
|
5018
|
-
return /* @__PURE__ */ P(
|
|
5123
|
+
return /* @__PURE__ */ P(Pa.Provider, {
|
|
5019
5124
|
value: s,
|
|
5020
5125
|
children: e
|
|
5021
5126
|
});
|
|
5022
5127
|
}
|
|
5023
|
-
var
|
|
5128
|
+
var La = Object.freeze({
|
|
5024
5129
|
activeView: "research",
|
|
5025
5130
|
setActiveView: () => {},
|
|
5026
5131
|
docsEnabled: !1,
|
|
@@ -5028,12 +5133,12 @@ var Sa = Object.freeze({
|
|
|
5028
5133
|
toggleToResearch: () => {},
|
|
5029
5134
|
filesSidebarRequestId: 0,
|
|
5030
5135
|
requestFilesSidebar: () => {}
|
|
5031
|
-
}),
|
|
5032
|
-
function
|
|
5033
|
-
return w(
|
|
5136
|
+
}), Ra = !1;
|
|
5137
|
+
function za() {
|
|
5138
|
+
return w(Pa) || (!Ra && process.env.NODE_ENV !== "production" && (Ra = !0, console.error("useMainView was called outside a MainViewProvider. The component is rendering with view switching disabled — mount it inside MainViewProvider (see QwkSearchProviders).")), La);
|
|
5034
5139
|
}
|
|
5035
5140
|
// src/settings/sections.json
|
|
5036
|
-
var
|
|
5141
|
+
var Ba = [
|
|
5037
5142
|
{
|
|
5038
5143
|
key: "account",
|
|
5039
5144
|
name: "Account",
|
|
@@ -5097,24 +5202,24 @@ var Ta = [
|
|
|
5097
5202
|
icon: "Volume2",
|
|
5098
5203
|
dataAdd: "voice"
|
|
5099
5204
|
}
|
|
5100
|
-
],
|
|
5205
|
+
], Va = [
|
|
5101
5206
|
{
|
|
5102
5207
|
key: "webSearch",
|
|
5103
5208
|
title: "All",
|
|
5104
5209
|
description: "Searches across all of the internet",
|
|
5105
|
-
icon: /* @__PURE__ */ P(
|
|
5210
|
+
icon: /* @__PURE__ */ P(xe, { size: 16 })
|
|
5106
5211
|
},
|
|
5107
5212
|
{
|
|
5108
5213
|
key: "academicSearch",
|
|
5109
5214
|
title: "Academic",
|
|
5110
5215
|
description: "Search in published academic papers",
|
|
5111
|
-
icon: /* @__PURE__ */ P(
|
|
5216
|
+
icon: /* @__PURE__ */ P(Ze, { size: 16 })
|
|
5112
5217
|
},
|
|
5113
5218
|
{
|
|
5114
5219
|
key: "writingAssistant",
|
|
5115
5220
|
title: "Writing",
|
|
5116
5221
|
description: "Chat without searching the web",
|
|
5117
|
-
icon: /* @__PURE__ */ P(
|
|
5222
|
+
icon: /* @__PURE__ */ P(Re, { size: 16 })
|
|
5118
5223
|
},
|
|
5119
5224
|
{
|
|
5120
5225
|
key: "wolframAlphaSearch",
|
|
@@ -5126,15 +5231,15 @@ var Ta = [
|
|
|
5126
5231
|
key: "youtubeSearch",
|
|
5127
5232
|
title: "Youtube",
|
|
5128
5233
|
description: "Search and watch videos",
|
|
5129
|
-
icon: /* @__PURE__ */ P(
|
|
5234
|
+
icon: /* @__PURE__ */ P(Lt, { className: "h-[16px] w-auto mr-0.5" })
|
|
5130
5235
|
},
|
|
5131
5236
|
{
|
|
5132
5237
|
key: "redditSearch",
|
|
5133
5238
|
title: "Reddit",
|
|
5134
5239
|
description: "Search for discussions and opinions",
|
|
5135
|
-
icon: /* @__PURE__ */ P(
|
|
5240
|
+
icon: /* @__PURE__ */ P(It, { className: "h-[16px] w-auto mr-0.5" })
|
|
5136
5241
|
}
|
|
5137
|
-
],
|
|
5242
|
+
], Ha = [
|
|
5138
5243
|
{
|
|
5139
5244
|
href: "/",
|
|
5140
5245
|
label: "Research",
|
|
@@ -5192,9 +5297,9 @@ var Ta = [
|
|
|
5192
5297
|
}
|
|
5193
5298
|
];
|
|
5194
5299
|
// src/components/SpotlightPalette/spotlightItems.ts
|
|
5195
|
-
function
|
|
5196
|
-
let t = (e) => e === "/" ?
|
|
5197
|
-
return
|
|
5300
|
+
function Ua(e) {
|
|
5301
|
+
let t = (e) => e === "/" ? Ve : e === "/workspace" ? ve : e === "/settings" ? He : e === "/docs" ? U : Ee;
|
|
5302
|
+
return Ha.filter((t) => !t.docsOnly || e.docsEnabled).map((n) => ({
|
|
5198
5303
|
id: `page:${n.href}`,
|
|
5199
5304
|
source: "page",
|
|
5200
5305
|
name: n.label,
|
|
@@ -5204,7 +5309,7 @@ function Oa(e) {
|
|
|
5204
5309
|
run: () => e.navigate(n.href)
|
|
5205
5310
|
}));
|
|
5206
5311
|
}
|
|
5207
|
-
function
|
|
5312
|
+
function Wa(e, t) {
|
|
5208
5313
|
let n = /* @__PURE__ */ new Date();
|
|
5209
5314
|
return e.map((e) => ({
|
|
5210
5315
|
id: `chat:${e.id}`,
|
|
@@ -5212,23 +5317,23 @@ function ka(e, t) {
|
|
|
5212
5317
|
name: e.title || "Untitled chat",
|
|
5213
5318
|
meta: `${e.messageCount ?? 0} question${(e.messageCount ?? 0) === 1 ? "" : "s"}`,
|
|
5214
5319
|
keywords: e.focusMode ?? "",
|
|
5215
|
-
icon:
|
|
5320
|
+
icon: Pe,
|
|
5216
5321
|
hint: f(n, e.lastMessageAt || e.createdAt),
|
|
5217
5322
|
run: () => t.openChat(e.id)
|
|
5218
5323
|
}));
|
|
5219
5324
|
}
|
|
5220
|
-
function
|
|
5221
|
-
return
|
|
5325
|
+
function Ga(e) {
|
|
5326
|
+
return Ba.map((t) => ({
|
|
5222
5327
|
id: `setting:${t.key}`,
|
|
5223
5328
|
source: "setting",
|
|
5224
5329
|
name: t.name,
|
|
5225
5330
|
meta: t.description,
|
|
5226
5331
|
keywords: `settings ${t.key}`,
|
|
5227
|
-
icon:
|
|
5332
|
+
icon: Ge,
|
|
5228
5333
|
run: () => e.openSettings(t.key)
|
|
5229
5334
|
}));
|
|
5230
5335
|
}
|
|
5231
|
-
function
|
|
5336
|
+
function Ka(e) {
|
|
5232
5337
|
let t = [
|
|
5233
5338
|
{
|
|
5234
5339
|
id: "action:new-chat",
|
|
@@ -5236,7 +5341,7 @@ function ja(e) {
|
|
|
5236
5341
|
name: "New chat",
|
|
5237
5342
|
meta: "Start a fresh conversation",
|
|
5238
5343
|
keywords: "clear reset blank",
|
|
5239
|
-
icon:
|
|
5344
|
+
icon: Be,
|
|
5240
5345
|
run: e.newChat
|
|
5241
5346
|
},
|
|
5242
5347
|
{
|
|
@@ -5245,7 +5350,7 @@ function ja(e) {
|
|
|
5245
5350
|
name: "Open settings",
|
|
5246
5351
|
meta: "Models, connectors, search sources and preferences",
|
|
5247
5352
|
keywords: "preferences configure",
|
|
5248
|
-
icon:
|
|
5353
|
+
icon: He,
|
|
5249
5354
|
run: () => e.openSettings()
|
|
5250
5355
|
},
|
|
5251
5356
|
{
|
|
@@ -5254,18 +5359,18 @@ function ja(e) {
|
|
|
5254
5359
|
name: e.incognito ? "Turn off incognito" : "Turn on incognito",
|
|
5255
5360
|
meta: "Stop saving this conversation to history",
|
|
5256
5361
|
keywords: "private incognito history off",
|
|
5257
|
-
icon:
|
|
5362
|
+
icon: me,
|
|
5258
5363
|
hint: e.incognito ? "on" : "off",
|
|
5259
5364
|
run: () => e.setIncognito(!e.incognito)
|
|
5260
5365
|
}
|
|
5261
5366
|
];
|
|
5262
|
-
for (let n of
|
|
5367
|
+
for (let n of Va) t.push({
|
|
5263
5368
|
id: `action:focus:${n.key}`,
|
|
5264
5369
|
source: "action",
|
|
5265
5370
|
name: `Focus: ${n.title}`,
|
|
5266
5371
|
meta: n.description,
|
|
5267
5372
|
keywords: `focus mode ${n.key}`,
|
|
5268
|
-
icon:
|
|
5373
|
+
icon: xe,
|
|
5269
5374
|
hint: e.focusMode === n.key ? "current" : void 0,
|
|
5270
5375
|
run: () => e.setFocusMode(n.key)
|
|
5271
5376
|
});
|
|
@@ -5275,7 +5380,7 @@ function ja(e) {
|
|
|
5275
5380
|
name: "Switch to documents",
|
|
5276
5381
|
meta: "Open the REASON editor view",
|
|
5277
5382
|
keywords: "reason editor write docs",
|
|
5278
|
-
icon:
|
|
5383
|
+
icon: ve,
|
|
5279
5384
|
run: () => e.setActiveView("docs")
|
|
5280
5385
|
}, {
|
|
5281
5386
|
id: "action:view-research",
|
|
@@ -5283,7 +5388,7 @@ function ja(e) {
|
|
|
5283
5388
|
name: "Switch to research",
|
|
5284
5389
|
meta: "Back to the search and chat view",
|
|
5285
5390
|
keywords: "chat search",
|
|
5286
|
-
icon:
|
|
5391
|
+
icon: Ve,
|
|
5287
5392
|
run: () => e.setActiveView("research")
|
|
5288
5393
|
}, {
|
|
5289
5394
|
id: "action:files-sidebar",
|
|
@@ -5291,7 +5396,7 @@ function ja(e) {
|
|
|
5291
5396
|
name: "Show files sidebar",
|
|
5292
5397
|
meta: "Browse REASON documents",
|
|
5293
5398
|
keywords: "files documents sidebar",
|
|
5294
|
-
icon:
|
|
5399
|
+
icon: ve,
|
|
5295
5400
|
run: () => {
|
|
5296
5401
|
e.setActiveView("docs"), e.requestFilesSidebar();
|
|
5297
5402
|
}
|
|
@@ -5301,7 +5406,7 @@ function ja(e) {
|
|
|
5301
5406
|
name: "Sign out",
|
|
5302
5407
|
meta: "End this session",
|
|
5303
5408
|
keywords: "logout log out",
|
|
5304
|
-
icon:
|
|
5409
|
+
icon: Ae,
|
|
5305
5410
|
run: e.signOut
|
|
5306
5411
|
} : {
|
|
5307
5412
|
id: "action:sign-in",
|
|
@@ -5309,24 +5414,24 @@ function ja(e) {
|
|
|
5309
5414
|
name: "Sign in",
|
|
5310
5415
|
meta: "Sync chats and settings across devices",
|
|
5311
5416
|
keywords: "login log in account",
|
|
5312
|
-
icon:
|
|
5417
|
+
icon: ke,
|
|
5313
5418
|
run: e.signIn
|
|
5314
5419
|
}), t;
|
|
5315
5420
|
}
|
|
5316
|
-
function
|
|
5421
|
+
function qa(e, t) {
|
|
5317
5422
|
let n = e.trim();
|
|
5318
5423
|
return n ? {
|
|
5319
5424
|
id: "search:ask",
|
|
5320
5425
|
source: "search",
|
|
5321
5426
|
name: n,
|
|
5322
5427
|
meta: `Ask ${t.appName} — searches the web and answers with sources`,
|
|
5323
|
-
icon:
|
|
5428
|
+
icon: Ke,
|
|
5324
5429
|
hint: "Enter",
|
|
5325
5430
|
run: () => t.ask(n)
|
|
5326
5431
|
} : null;
|
|
5327
5432
|
}
|
|
5328
5433
|
// src/components/SpotlightPalette/spotlightMatch.ts
|
|
5329
|
-
var
|
|
5434
|
+
var Ja = [
|
|
5330
5435
|
{
|
|
5331
5436
|
prefix: "c",
|
|
5332
5437
|
source: "chat",
|
|
@@ -5353,10 +5458,10 @@ var Na = [
|
|
|
5353
5458
|
label: "web"
|
|
5354
5459
|
}
|
|
5355
5460
|
];
|
|
5356
|
-
function
|
|
5461
|
+
function Ya(e) {
|
|
5357
5462
|
let t = e.match(/^([a-zA-Z])\s+(.*)$/);
|
|
5358
5463
|
if (t) {
|
|
5359
|
-
let e = t[1].toLowerCase(), n =
|
|
5464
|
+
let e = t[1].toLowerCase(), n = Ja.find((t) => t.prefix === e);
|
|
5360
5465
|
if (n) return {
|
|
5361
5466
|
prefix: n.prefix,
|
|
5362
5467
|
query: t[2]
|
|
@@ -5367,11 +5472,11 @@ function Pa(e) {
|
|
|
5367
5472
|
query: e
|
|
5368
5473
|
};
|
|
5369
5474
|
}
|
|
5370
|
-
var
|
|
5371
|
-
function
|
|
5475
|
+
var Xa = 18;
|
|
5476
|
+
function Za(e) {
|
|
5372
5477
|
return `${e.meta ?? ""} ${e.keywords ?? ""}`.toLowerCase();
|
|
5373
5478
|
}
|
|
5374
|
-
function
|
|
5479
|
+
function Qa(e, t) {
|
|
5375
5480
|
let n = t.toLowerCase().split(/\s+/).filter(Boolean);
|
|
5376
5481
|
if (n.length === 0) return e.map((e) => ({
|
|
5377
5482
|
item: e,
|
|
@@ -5383,7 +5488,7 @@ function La(e, t) {
|
|
|
5383
5488
|
let e = t.name.toLowerCase();
|
|
5384
5489
|
if (n.every((t) => e.includes(t))) r.push(t);
|
|
5385
5490
|
else {
|
|
5386
|
-
let r = `${e} ${
|
|
5491
|
+
let r = `${e} ${Za(t)}`;
|
|
5387
5492
|
n.every((e) => r.includes(e)) && i.push(t);
|
|
5388
5493
|
}
|
|
5389
5494
|
}
|
|
@@ -5395,32 +5500,32 @@ function La(e, t) {
|
|
|
5395
5500
|
})), ...i.map((e) => ({
|
|
5396
5501
|
item: e,
|
|
5397
5502
|
matchedName: !1,
|
|
5398
|
-
snippet:
|
|
5503
|
+
snippet: $a(Za(e), a)
|
|
5399
5504
|
}))];
|
|
5400
5505
|
}
|
|
5401
|
-
function
|
|
5506
|
+
function $a(e, t) {
|
|
5402
5507
|
let n = e.indexOf(t);
|
|
5403
5508
|
if (n < 0) return "";
|
|
5404
|
-
let r = Math.max(0, n -
|
|
5509
|
+
let r = Math.max(0, n - Xa), i = Math.min(e.length, n + t.length + Xa), a = e.slice(r, i).replace(/\s+/g, " ").trim();
|
|
5405
5510
|
return r > 0 && (a = "…" + a), i < e.length && (a += "…"), a;
|
|
5406
5511
|
}
|
|
5407
5512
|
// src/components/SpotlightPalette/SpotlightPalette.tsx
|
|
5408
|
-
var
|
|
5409
|
-
function
|
|
5410
|
-
typeof window < "u" && window.dispatchEvent(new Event(
|
|
5513
|
+
var eo = "qwksearch:open-spotlight", to = 100, no = 6, ro = 40;
|
|
5514
|
+
function io() {
|
|
5515
|
+
typeof window < "u" && window.dispatchEvent(new Event(eo));
|
|
5411
5516
|
}
|
|
5412
|
-
function
|
|
5517
|
+
function ao(e) {
|
|
5413
5518
|
return e.ctrlKey && !e.metaKey && !e.altKey && (e.code === "Space" || e.key === " ");
|
|
5414
5519
|
}
|
|
5415
|
-
var
|
|
5520
|
+
var oo = {
|
|
5416
5521
|
search: "ask",
|
|
5417
5522
|
chat: "chat",
|
|
5418
5523
|
page: "page",
|
|
5419
5524
|
setting: "setting",
|
|
5420
5525
|
action: "action"
|
|
5421
5526
|
};
|
|
5422
|
-
function
|
|
5423
|
-
let [e, r] = O(!1), [i, a] = O(""), [o, s] = O(0), c = j(), l = u(), { isAuthenticated: d, signIn: f, signOut: p } = n(), { docsEnabled: m, setActiveView: g, requestFilesSidebar: _ } =
|
|
5527
|
+
function so() {
|
|
5528
|
+
let [e, r] = O(!1), [i, a] = O(""), [o, s] = O(0), c = j(), l = u(), { isAuthenticated: d, signIn: f, signOut: p } = n(), { docsEnabled: m, setActiveView: g, requestFilesSidebar: _ } = za(), { recentChats: v, load: y } = yr(to), b = D(null), x = D(null), S = D(null), w = C(() => r(!1), []), k = D(y);
|
|
5424
5529
|
T(() => {
|
|
5425
5530
|
k.current = y;
|
|
5426
5531
|
}, [y]);
|
|
@@ -5460,30 +5565,30 @@ function Ka() {
|
|
|
5460
5565
|
m,
|
|
5461
5566
|
g,
|
|
5462
5567
|
_
|
|
5463
|
-
]), { prefix: M, query: N } =
|
|
5464
|
-
chat:
|
|
5465
|
-
page:
|
|
5466
|
-
setting:
|
|
5467
|
-
action:
|
|
5568
|
+
]), { prefix: M, query: N } = Ya(i), I = N.trim(), L = E(() => ({
|
|
5569
|
+
chat: Wa(v, A),
|
|
5570
|
+
page: Ua(A),
|
|
5571
|
+
setting: Ga(A),
|
|
5572
|
+
action: Ka(A)
|
|
5468
5573
|
}), [v, A]), R = E(() => {
|
|
5469
|
-
let e =
|
|
5574
|
+
let e = qa(N, A);
|
|
5470
5575
|
if (M === "w") return e ? [e] : [];
|
|
5471
5576
|
if (M) {
|
|
5472
|
-
let e =
|
|
5473
|
-
return
|
|
5577
|
+
let e = Ja.find((e) => e.prefix === M).source;
|
|
5578
|
+
return Qa(L[e], N).map((e) => e.item).slice(0, ro);
|
|
5474
5579
|
}
|
|
5475
5580
|
if (!I) return [
|
|
5476
|
-
...L.chat.slice(0,
|
|
5581
|
+
...L.chat.slice(0, no),
|
|
5477
5582
|
...L.action,
|
|
5478
5583
|
...L.page
|
|
5479
|
-
].slice(0,
|
|
5480
|
-
let t =
|
|
5584
|
+
].slice(0, ro);
|
|
5585
|
+
let t = Qa([
|
|
5481
5586
|
...L.action,
|
|
5482
5587
|
...L.page,
|
|
5483
5588
|
...L.setting,
|
|
5484
5589
|
...L.chat
|
|
5485
5590
|
], N).map((e) => e.item);
|
|
5486
|
-
return [...e ? [e] : [], ...t].slice(0,
|
|
5591
|
+
return [...e ? [e] : [], ...t].slice(0, ro);
|
|
5487
5592
|
}, [
|
|
5488
5593
|
M,
|
|
5489
5594
|
N,
|
|
@@ -5493,10 +5598,10 @@ function Ka() {
|
|
|
5493
5598
|
]);
|
|
5494
5599
|
T(() => {
|
|
5495
5600
|
let e = (e) => {
|
|
5496
|
-
|
|
5601
|
+
ao(e) && (e.preventDefault(), r((e) => !e));
|
|
5497
5602
|
}, t = () => r(!0);
|
|
5498
|
-
return window.addEventListener("keydown", e), window.addEventListener(
|
|
5499
|
-
window.removeEventListener("keydown", e), window.removeEventListener(
|
|
5603
|
+
return window.addEventListener("keydown", e), window.addEventListener(eo, t), () => {
|
|
5604
|
+
window.removeEventListener("keydown", e), window.removeEventListener(eo, t);
|
|
5500
5605
|
};
|
|
5501
5606
|
}, []), T(() => {
|
|
5502
5607
|
e ? (s(0), k.current(), x.current?.focus()) : (a(""), s(0));
|
|
@@ -5514,7 +5619,7 @@ function Ka() {
|
|
|
5514
5619
|
let z = C((e) => {
|
|
5515
5620
|
e && (w(), e.run());
|
|
5516
5621
|
}, [w]), B = C(() => {
|
|
5517
|
-
let e =
|
|
5622
|
+
let e = Ja.map((e) => e.prefix), t = e[((M ? e.indexOf(M) : -1) + 1) % e.length];
|
|
5518
5623
|
a(`${t} ${N}`), s(0);
|
|
5519
5624
|
}, [M, N]), V = (e) => {
|
|
5520
5625
|
switch (e.key) {
|
|
@@ -5534,7 +5639,7 @@ function Ka() {
|
|
|
5534
5639
|
}
|
|
5535
5640
|
};
|
|
5536
5641
|
if (!e) return null;
|
|
5537
|
-
let H = M ?
|
|
5642
|
+
let H = M ? Ja.find((e) => e.prefix === M) : null;
|
|
5538
5643
|
return /* @__PURE__ */ P("div", {
|
|
5539
5644
|
className: "fixed inset-0 z-[10000] flex items-start justify-center bg-black/40 backdrop-blur-[2px] px-4 pt-[12vh]",
|
|
5540
5645
|
role: "presentation",
|
|
@@ -5548,7 +5653,7 @@ function Ka() {
|
|
|
5548
5653
|
/* @__PURE__ */ F("div", {
|
|
5549
5654
|
className: "flex items-center gap-3 border-b border-border px-4",
|
|
5550
5655
|
children: [
|
|
5551
|
-
/* @__PURE__ */ P(
|
|
5656
|
+
/* @__PURE__ */ P(Ve, {
|
|
5552
5657
|
size: 18,
|
|
5553
5658
|
className: "shrink-0 text-muted-foreground"
|
|
5554
5659
|
}),
|
|
@@ -5616,7 +5721,7 @@ function Ka() {
|
|
|
5616
5721
|
}),
|
|
5617
5722
|
/* @__PURE__ */ P("span", {
|
|
5618
5723
|
className: "shrink-0 rounded-md bg-secondary px-1.5 py-0 text-[10px] text-muted-foreground",
|
|
5619
|
-
children:
|
|
5724
|
+
children: oo[e.source]
|
|
5620
5725
|
})
|
|
5621
5726
|
]
|
|
5622
5727
|
}, e.id);
|
|
@@ -5631,7 +5736,7 @@ function Ka() {
|
|
|
5631
5736
|
/* @__PURE__ */ P("span", { children: "esc close" }),
|
|
5632
5737
|
/* @__PURE__ */ P("span", {
|
|
5633
5738
|
className: "ml-auto",
|
|
5634
|
-
children:
|
|
5739
|
+
children: Ja.map((e) => `${e.prefix} ${e.label}`).join(" · ")
|
|
5635
5740
|
})
|
|
5636
5741
|
]
|
|
5637
5742
|
})
|
|
@@ -5640,57 +5745,57 @@ function Ka() {
|
|
|
5640
5745
|
});
|
|
5641
5746
|
}
|
|
5642
5747
|
// src/lib/kokoro.ts
|
|
5643
|
-
var
|
|
5748
|
+
var co = {
|
|
5644
5749
|
device: "webgpu",
|
|
5645
5750
|
dtype: "fp32"
|
|
5646
|
-
},
|
|
5751
|
+
}, lo = {
|
|
5647
5752
|
device: "wasm",
|
|
5648
5753
|
dtype: "q8"
|
|
5649
|
-
},
|
|
5650
|
-
function
|
|
5754
|
+
}, uo = "hexgrad/Kokoro-82M", fo = null, po = null;
|
|
5755
|
+
function mo() {
|
|
5651
5756
|
return typeof navigator < "u" && "gpu" in navigator;
|
|
5652
5757
|
}
|
|
5653
|
-
async function
|
|
5654
|
-
if (!
|
|
5758
|
+
async function ho() {
|
|
5759
|
+
if (!mo()) return !1;
|
|
5655
5760
|
try {
|
|
5656
5761
|
return await navigator.gpu.requestAdapter() != null;
|
|
5657
5762
|
} catch {
|
|
5658
5763
|
return !1;
|
|
5659
5764
|
}
|
|
5660
5765
|
}
|
|
5661
|
-
async function
|
|
5766
|
+
async function go(e) {
|
|
5662
5767
|
let t = [];
|
|
5663
|
-
await
|
|
5768
|
+
await ho() && t.push(co), t.push(lo);
|
|
5664
5769
|
let { KokoroTTS: n } = await import("kokoro-js"), r;
|
|
5665
5770
|
for (let i of t) try {
|
|
5666
|
-
let t = await n.from_pretrained(
|
|
5771
|
+
let t = await n.from_pretrained(uo, {
|
|
5667
5772
|
device: i.device,
|
|
5668
5773
|
dtype: i.dtype,
|
|
5669
5774
|
progress_callback: e
|
|
5670
5775
|
});
|
|
5671
|
-
return
|
|
5776
|
+
return po = i.device, t;
|
|
5672
5777
|
} catch (e) {
|
|
5673
5778
|
r = e, console.warn(`Kokoro model failed to load on "${i.device}" backend:`, e);
|
|
5674
5779
|
}
|
|
5675
5780
|
throw r instanceof Error ? r : /* @__PURE__ */ Error("Failed to load Kokoro model");
|
|
5676
5781
|
}
|
|
5677
|
-
async function
|
|
5678
|
-
return
|
|
5679
|
-
throw
|
|
5680
|
-
}),
|
|
5782
|
+
async function _o(e) {
|
|
5783
|
+
return fo ||= go(e).catch((e) => {
|
|
5784
|
+
throw fo = null, e;
|
|
5785
|
+
}), fo;
|
|
5681
5786
|
}
|
|
5682
|
-
async function
|
|
5683
|
-
return
|
|
5787
|
+
async function vo(e) {
|
|
5788
|
+
return _o(e);
|
|
5684
5789
|
}
|
|
5685
|
-
async function
|
|
5686
|
-
let e = await
|
|
5790
|
+
async function yo() {
|
|
5791
|
+
let e = await vo();
|
|
5687
5792
|
return Object.keys(e.voices);
|
|
5688
5793
|
}
|
|
5689
|
-
function
|
|
5690
|
-
return
|
|
5794
|
+
function bo() {
|
|
5795
|
+
return po;
|
|
5691
5796
|
}
|
|
5692
5797
|
// src/hooks/voice/useKokoroTTS.ts
|
|
5693
|
-
function
|
|
5798
|
+
function xo(e, t) {
|
|
5694
5799
|
let [n, r] = O("idle"), [i, a] = O(!1), [o, s] = O([]), [c, l] = O("af_heart"), [u, d] = O(null), [f, p] = O(null), m = D(null), h = D(null);
|
|
5695
5800
|
T(() => {
|
|
5696
5801
|
t?.autoPreload && !i && _();
|
|
@@ -5704,10 +5809,10 @@ function ao(e, t) {
|
|
|
5704
5809
|
m.current &&= (m.current.pause(), m.current.src.startsWith("blob:") && URL.revokeObjectURL(m.current.src), null), h.current?.abort(), h.current = null;
|
|
5705
5810
|
}, []), _ = C(async () => {
|
|
5706
5811
|
try {
|
|
5707
|
-
r("loading"), d(null), p(null), await
|
|
5812
|
+
r("loading"), d(null), p(null), await _o((e) => {
|
|
5708
5813
|
p(e);
|
|
5709
5814
|
});
|
|
5710
|
-
let e = await
|
|
5815
|
+
let e = await yo();
|
|
5711
5816
|
s(e), e.length && !e.includes(c) && l(e[0]), a(!0), r("idle");
|
|
5712
5817
|
} catch (e) {
|
|
5713
5818
|
let t = e instanceof Error ? e.message : "Failed to load model";
|
|
@@ -5729,7 +5834,7 @@ function ao(e, t) {
|
|
|
5729
5834
|
g(), r("generating"), d(null);
|
|
5730
5835
|
let t = new AbortController();
|
|
5731
5836
|
h.current = t;
|
|
5732
|
-
let n = (await (await
|
|
5837
|
+
let n = (await (await vo()).generate(e.slice(0, 5e3), { voice: c })).toWav(), i = new Blob([n], { type: "audio/wav" }), a = URL.createObjectURL(i), o = new Audio(a);
|
|
5733
5838
|
m.current = o, o.onended = () => {
|
|
5734
5839
|
r("idle"), URL.revokeObjectURL(a), m.current = null;
|
|
5735
5840
|
}, o.onerror = () => {
|
|
@@ -5754,11 +5859,11 @@ function ao(e, t) {
|
|
|
5754
5859
|
changeVoice: C((e) => {
|
|
5755
5860
|
l(e), localStorage.setItem("kokoroVoice", e);
|
|
5756
5861
|
}, []),
|
|
5757
|
-
backend:
|
|
5862
|
+
backend: bo()
|
|
5758
5863
|
};
|
|
5759
5864
|
}
|
|
5760
5865
|
// src/hooks/voice/useTextToVoice.ts
|
|
5761
|
-
function
|
|
5866
|
+
function So(e, t) {
|
|
5762
5867
|
let [n, r] = O("stopped"), [i, a] = O(!1), o = D(null), s = D(null), c = D(null), l = D(t);
|
|
5763
5868
|
l.current = t;
|
|
5764
5869
|
let u = C(() => {
|
|
@@ -5790,7 +5895,7 @@ function oo(e, t) {
|
|
|
5790
5895
|
try {
|
|
5791
5896
|
let n = localStorage.getItem("useTTSKokoro");
|
|
5792
5897
|
if (n === null || n !== "false") try {
|
|
5793
|
-
let t = await
|
|
5898
|
+
let t = await vo((e) => {
|
|
5794
5899
|
(e.status === "progress_total" || e.status === "progress" || e.status === "download") && console.log(`[Kokoro] Loading: ${Math.round(e.progress ?? 0)}%`);
|
|
5795
5900
|
}), n = localStorage.getItem("kokoroVoice") || "af_heart", i = (await t.generate(e.slice(0, 5e3), { voice: n })).toWav(), s = new Blob([i], { type: "audio/wav" }), c = URL.createObjectURL(s), l = new Audio(c);
|
|
5796
5901
|
o.current = l, l.onended = () => {
|
|
@@ -5803,7 +5908,7 @@ function oo(e, t) {
|
|
|
5803
5908
|
console.debug("Kokoro TTS unavailable, using server-side TTS:", e instanceof Error ? e.message : String(e)), a(!1);
|
|
5804
5909
|
}
|
|
5805
5910
|
a(!1);
|
|
5806
|
-
let i = await
|
|
5911
|
+
let i = await q("agent/voice", {
|
|
5807
5912
|
method: "POST",
|
|
5808
5913
|
body: {
|
|
5809
5914
|
text: e.slice(0, 5e3),
|
|
@@ -5833,7 +5938,7 @@ function oo(e, t) {
|
|
|
5833
5938
|
};
|
|
5834
5939
|
}
|
|
5835
5940
|
// src/components/VoiceSettings/KokoroVoiceSelector.tsx
|
|
5836
|
-
var
|
|
5941
|
+
var Co = {
|
|
5837
5942
|
af_heart: "American Female - Heart",
|
|
5838
5943
|
af_bella: "American Female - Bella",
|
|
5839
5944
|
af_nicole: "American Female - Nicole",
|
|
@@ -5845,8 +5950,8 @@ var so = {
|
|
|
5845
5950
|
bm_george: "British Male - George",
|
|
5846
5951
|
bm_thomas: "British Male - Thomas"
|
|
5847
5952
|
};
|
|
5848
|
-
function
|
|
5849
|
-
let { status: t, modelReady: n, voices: r, selectedVoice: i, error: o, progress: c, warmupModel: u, changeVoice: d, backend: f } =
|
|
5953
|
+
function wo({ preloadOnMount: e = !1 }) {
|
|
5954
|
+
let { status: t, modelReady: n, voices: r, selectedVoice: i, error: o, progress: c, warmupModel: u, changeVoice: d, backend: f } = xo("", { autoPreload: e }), [p, m] = O(!1), g = t === "loading", _ = t === "error";
|
|
5850
5955
|
return /* @__PURE__ */ F("div", {
|
|
5851
5956
|
className: "flex flex-col gap-3",
|
|
5852
5957
|
children: [/* @__PURE__ */ F("div", {
|
|
@@ -5858,10 +5963,10 @@ function co({ preloadOnMount: e = !1 }) {
|
|
|
5858
5963
|
onClick: u,
|
|
5859
5964
|
disabled: g || n,
|
|
5860
5965
|
className: h("p-2 rounded-full transition duration-200", n ? "bg-green-500/10 text-green-600 dark:text-green-400" : "bg-white/10 dark:bg-black/10 text-muted-foreground hover:bg-white/20 dark:hover:bg-black/20", g && "opacity-70 cursor-not-allowed"),
|
|
5861
|
-
children: g ? /* @__PURE__ */ P(
|
|
5966
|
+
children: g ? /* @__PURE__ */ P(G, {
|
|
5862
5967
|
size: 18,
|
|
5863
5968
|
className: "animate-spin"
|
|
5864
|
-
}) : /* @__PURE__ */ P(
|
|
5969
|
+
}) : /* @__PURE__ */ P(fe, { size: 18 })
|
|
5865
5970
|
})
|
|
5866
5971
|
}), /* @__PURE__ */ P(a, {
|
|
5867
5972
|
side: "bottom",
|
|
@@ -5908,7 +6013,7 @@ function co({ preloadOnMount: e = !1 }) {
|
|
|
5908
6013
|
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",
|
|
5909
6014
|
children: /* @__PURE__ */ F("div", {
|
|
5910
6015
|
className: "flex items-center gap-2",
|
|
5911
|
-
children: [/* @__PURE__ */ P(
|
|
6016
|
+
children: [/* @__PURE__ */ P(tt, { size: 16 }), Co[i] || i]
|
|
5912
6017
|
})
|
|
5913
6018
|
}), p && /* @__PURE__ */ P("div", {
|
|
5914
6019
|
className: "grid grid-cols-2 gap-2 p-2 bg-white/5 dark:bg-black/5 rounded-md max-h-64 overflow-y-auto",
|
|
@@ -5917,23 +6022,23 @@ function co({ preloadOnMount: e = !1 }) {
|
|
|
5917
6022
|
d(e), m(!1);
|
|
5918
6023
|
},
|
|
5919
6024
|
className: h("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"),
|
|
5920
|
-
children:
|
|
6025
|
+
children: Co[e] || e
|
|
5921
6026
|
}, e))
|
|
5922
6027
|
})]
|
|
5923
6028
|
})]
|
|
5924
6029
|
});
|
|
5925
6030
|
}
|
|
5926
6031
|
// src/components/VoiceSettings/VoiceSettingsPanel.tsx
|
|
5927
|
-
function
|
|
6032
|
+
function To() {
|
|
5928
6033
|
let [e, t] = O(!1), [n, r] = O(() => {
|
|
5929
6034
|
let e = localStorage.getItem("useTTSKokoro");
|
|
5930
6035
|
return e === null || e !== "false";
|
|
5931
|
-
}), [i, o] = O(() => localStorage.getItem("ttsSpeaker") || "angus"), [c, u] = O(() =>
|
|
6036
|
+
}), [i, o] = O(() => localStorage.getItem("ttsSpeaker") || "angus"), [c, u] = O(() => Pn()), { start: d, speechStatus: f } = So("This is a preview of the selected voice.", { enableInterrupt: !1 }), p = (e) => {
|
|
5932
6037
|
r(e), localStorage.setItem("useTTSKokoro", String(e));
|
|
5933
6038
|
}, m = (e) => {
|
|
5934
6039
|
o(e), localStorage.setItem("ttsSpeaker", e);
|
|
5935
6040
|
}, g = (e) => {
|
|
5936
|
-
u(e),
|
|
6041
|
+
u(e), Fn(e);
|
|
5937
6042
|
};
|
|
5938
6043
|
return /* @__PURE__ */ F("div", {
|
|
5939
6044
|
className: "space-y-4",
|
|
@@ -5941,7 +6046,7 @@ function lo() {
|
|
|
5941
6046
|
className: "flex items-center justify-between",
|
|
5942
6047
|
children: [/* @__PURE__ */ F("div", {
|
|
5943
6048
|
className: "flex items-center gap-2",
|
|
5944
|
-
children: [/* @__PURE__ */ P(
|
|
6049
|
+
children: [/* @__PURE__ */ P(Ue, { size: 18 }), /* @__PURE__ */ P("h3", {
|
|
5945
6050
|
className: "font-semibold",
|
|
5946
6051
|
children: "Voice Settings"
|
|
5947
6052
|
})]
|
|
@@ -5980,7 +6085,7 @@ function lo() {
|
|
|
5980
6085
|
children: "Runs locally in your browser. No server requests, lower latency, and multiple voice options."
|
|
5981
6086
|
})] })
|
|
5982
6087
|
]
|
|
5983
|
-
}), n && /* @__PURE__ */ P(
|
|
6088
|
+
}), n && /* @__PURE__ */ P(wo, { preloadOnMount: !1 })]
|
|
5984
6089
|
}),
|
|
5985
6090
|
/* @__PURE__ */ F("div", {
|
|
5986
6091
|
className: "space-y-2",
|
|
@@ -6037,7 +6142,7 @@ function lo() {
|
|
|
6037
6142
|
onClick: () => d(),
|
|
6038
6143
|
disabled: f === "started",
|
|
6039
6144
|
className: h("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition", f === "started" ? "bg-gray-500/20 text-gray-600 dark:text-gray-400 cursor-not-allowed" : "bg-blue-500/20 text-blue-600 dark:text-blue-400 hover:bg-blue-500/30"),
|
|
6040
|
-
children: [/* @__PURE__ */ P(
|
|
6145
|
+
children: [/* @__PURE__ */ P(tt, { size: 16 }), f === "started" ? "Playing..." : "Preview"]
|
|
6041
6146
|
})]
|
|
6042
6147
|
})]
|
|
6043
6148
|
}),
|
|
@@ -6079,18 +6184,18 @@ function lo() {
|
|
|
6079
6184
|
});
|
|
6080
6185
|
}
|
|
6081
6186
|
// src/icons/icon-read.svg
|
|
6082
|
-
var
|
|
6187
|
+
var Eo = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%23FE5022;'%20d='M438.802,390.609V278.595h55.174c9.938,0,18.023,8.085,18.023,18.023v75.967%20c0,9.938-8.086,18.024-18.023,18.024L438.802,390.609L438.802,390.609z'/%3e%3cpath%20style='fill:%23ECE5DD;'%20d='M28.107,511.637C12.609,511.637,0,499.027,0,483.529V134.326c0-1.441,0-12.123,0-12.123%20L121.715,0.363c0,0,10.8,0,12.248,0h271.569c15.498,0,28.107,12.609,28.107,28.106v455.059c0,15.499-12.609,28.108-28.107,28.108%20H28.107V511.637z'/%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M405.533,0.363h-31.991c15.498,0,28.107,12.609,28.107,28.107v455.059%20c0,15.499-12.609,28.108-28.107,28.108h31.991c15.498,0,28.107-12.609,28.107-28.108V28.469%20C433.64,12.972,421.031,0.363,405.533,0.363z'/%3e%3cg%3e%3cpath%20style='fill:%23BABABA;'%20d='M167.639,132.2h133.086c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318H167.639%20c-4.594,0-8.318,3.723-8.318,8.318C159.321,128.477,163.045,132.2,167.639,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M356.178,132.2h22.181c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318h-22.181%20c-4.594,0-8.318,3.723-8.318,8.318C347.86,128.477,351.584,132.2,356.178,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M242.5,212.606c0-4.595-3.724-8.318-8.318-8.318H56.734c-4.594,0-8.318,3.723-8.318,8.318%20s3.724,8.318,8.318,8.318h177.449C238.776,220.924,242.5,217.201,242.5,212.606z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M378.359,204.288h-99.815c-4.594,0-8.318,3.723-8.318,8.318s3.724,8.318,8.318,8.318h99.815%20c4.594,0,8.318-3.723,8.318-8.318S382.953,204.288,378.359,204.288z'/%3e%3c/g%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M0.726,123.171L122.442,1.331l1.39,105.939c0,9.465-7.7,17.166-17.166,17.166L0.726,123.171z'/%3e%3cpath%20style='fill:%23FFB656;'%20d='M270.226,401.7V267.504H456.87c5.938,0,10.768,4.83,10.768,10.768v112.659%20c0,5.938-4.83,10.769-10.768,10.769H270.226z'/%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M367.785,335.156c-12.822,0-23.252-10.431-23.252-23.254v-44.399h89.833v44.399%20c0,12.823-10.431,23.254-23.252,23.254H367.785z'/%3e%3cg%3e%3cpath%20style='fill:%23BABABA;'%20d='M167.639,132.2h133.086c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318H167.639%20c-4.594,0-8.318,3.723-8.318,8.318C159.321,128.477,163.045,132.2,167.639,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M356.178,132.2h22.181c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318h-22.181%20c-4.594,0-8.318,3.723-8.318,8.318C347.86,128.477,351.584,132.2,356.178,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M242.5,212.606c0-4.595-3.724-8.318-8.318-8.318H56.734c-4.594,0-8.318,3.723-8.318,8.318%20s3.724,8.318,8.318,8.318h177.449C238.776,220.924,242.5,217.201,242.5,212.606z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M378.359,204.288h-99.815c-4.594,0-8.318,3.723-8.318,8.318s3.724,8.318,8.318,8.318h99.815%20c4.594,0,8.318-3.723,8.318-8.318S382.953,204.288,378.359,204.288z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M345.087,448.28H101.096c-4.594,0-8.318,3.723-8.318,8.318c0,4.595,3.724,8.318,8.318,8.318h243.992%20c4.594,0,8.318-3.723,8.318-8.318C353.405,452.003,349.681,448.28,345.087,448.28z'/%3e%3c/g%3e%3cpath%20style='fill:%23FE5022;'%20d='M163.689,357.337c-3.692,0-6.094-3.886-4.443-7.189l16.225-32.451%20c1.799-3.597,5.416-5.833,9.438-5.833h44.282v45.471h-65.503V357.337z'/%3e%3cpolygon%20style='fill:%23FFB656;'%20points='256.918,278.252%20211.447,300.988%20211.447,368.216%20256.918,390.953%20284.321,390.953%20284.321,278.214%20'/%3e%3cg%3e%3cpath%20style='fill:%23FE5022;'%20d='M268.64,401.7c-7.075,0-12.832-5.756-12.832-12.832V280.336c0-7.075,5.756-12.831,12.832-12.831%20h19.808c7.075,0,12.832,5.756,12.832,12.831v108.532c0,7.076-5.756,12.832-12.832,12.832H268.64z'/%3e%3cpath%20style='fill:%23FE5022;'%20d='M104.156,379.377H26.143V301.33h91.398c8.546,0,14.88,7.936,12.986,16.27l-11.313,49.758%20C117.615,374.388,111.366,379.377,104.156,379.377z'/%3e%3c/g%3e%3c/svg%3e", Do = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2064%2064'%20xml:space='preserve'%3e%3cstyle%20type='text/css'%3e%20.st0{fill:%2376C2AF;}%20.st1{fill:%234F5D73;}%20.st2{opacity:0.2;}%20.st3{fill:%23231F20;}%20.st4{fill:%23FFFFFF;}%20%3c/style%3e%3cg%20id='Layer_1'%3e%3cg%3e%3ccircle%20class='st0'%20cx='32'%20cy='32'%20r='32'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M32,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C34,51.1,33.1,52,32,52L32,52z'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M46,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C48,51.1,47.1,52,46,52L46,52z'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M18,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C20,51.1,19.1,52,18,52L18,52z'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='45.9'%20cy='38'%20r='4'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='32'%20cy='27'%20r='4'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='18'%20cy='44'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='45.9'%20cy='36'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='32'%20cy='25'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='18'%20cy='42'%20r='4'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Layer_2'%3e%3c/g%3e%3c/svg%3e";
|
|
6083
6188
|
// src/app/CategoryDock.tsx
|
|
6084
|
-
function
|
|
6085
|
-
let e = A(), r = j(), { isAuthenticated: i, signIn: a, signOut: o } = n(), { newChat: s } = u(), { activeView: c, setActiveView: l, docsEnabled: d, requestFilesSidebar: f } =
|
|
6189
|
+
function Oo() {
|
|
6190
|
+
let e = A(), r = j(), { isAuthenticated: i, signIn: a, signOut: o } = n(), { newChat: s } = u(), { activeView: c, setActiveView: l, docsEnabled: d, requestFilesSidebar: f } = za(), p = [{
|
|
6086
6191
|
href: "/",
|
|
6087
6192
|
label: "Research",
|
|
6088
6193
|
icon: t.appIconUrl
|
|
6089
6194
|
}, ...d ? [{
|
|
6090
6195
|
href: "/workspace",
|
|
6091
6196
|
label: "Docs",
|
|
6092
|
-
icon: /* @__PURE__ */ P(
|
|
6093
|
-
src:
|
|
6197
|
+
icon: /* @__PURE__ */ P(Wt, {
|
|
6198
|
+
src: Eo,
|
|
6094
6199
|
alt: "Docs",
|
|
6095
6200
|
width: 24,
|
|
6096
6201
|
height: 24,
|
|
@@ -6110,7 +6215,7 @@ function po() {
|
|
|
6110
6215
|
...d ? [{
|
|
6111
6216
|
key: "files",
|
|
6112
6217
|
label: "Files",
|
|
6113
|
-
icon: /* @__PURE__ */ P(
|
|
6218
|
+
icon: /* @__PURE__ */ P(ve, { className: "w-full h-full p-1" }),
|
|
6114
6219
|
onClick: () => {
|
|
6115
6220
|
l("docs"), f();
|
|
6116
6221
|
}
|
|
@@ -6118,8 +6223,8 @@ function po() {
|
|
|
6118
6223
|
{
|
|
6119
6224
|
key: "settings",
|
|
6120
6225
|
label: "Settings",
|
|
6121
|
-
icon: /* @__PURE__ */ P(
|
|
6122
|
-
src:
|
|
6226
|
+
icon: /* @__PURE__ */ P(Wt, {
|
|
6227
|
+
src: Do,
|
|
6123
6228
|
alt: "Settings",
|
|
6124
6229
|
width: 24,
|
|
6125
6230
|
height: 24,
|
|
@@ -6127,11 +6232,11 @@ function po() {
|
|
|
6127
6232
|
className: "w-full h-full"
|
|
6128
6233
|
}),
|
|
6129
6234
|
menu: { renderContent: () => /* @__PURE__ */ F(N, { children: [
|
|
6130
|
-
/* @__PURE__ */ F(
|
|
6131
|
-
onClick: () =>
|
|
6235
|
+
/* @__PURE__ */ F(Vt, {
|
|
6236
|
+
onClick: () => io(),
|
|
6132
6237
|
className: "cursor-pointer py-1 h-7",
|
|
6133
6238
|
children: [
|
|
6134
|
-
/* @__PURE__ */ P(
|
|
6239
|
+
/* @__PURE__ */ P(Ve, { className: "mr-2 h-3.5 w-3.5" }),
|
|
6135
6240
|
/* @__PURE__ */ P("span", {
|
|
6136
6241
|
className: "text-sm",
|
|
6137
6242
|
children: "Search"
|
|
@@ -6142,36 +6247,36 @@ function po() {
|
|
|
6142
6247
|
})
|
|
6143
6248
|
]
|
|
6144
6249
|
}),
|
|
6145
|
-
/* @__PURE__ */ F(
|
|
6250
|
+
/* @__PURE__ */ F(Vt, {
|
|
6146
6251
|
onClick: () => {
|
|
6147
6252
|
t.onOpenSettings?.() || r.push("/settings");
|
|
6148
6253
|
},
|
|
6149
6254
|
className: "cursor-pointer py-1 h-7",
|
|
6150
|
-
children: [/* @__PURE__ */ P(
|
|
6255
|
+
children: [/* @__PURE__ */ P(He, { className: "mr-2 h-3.5 w-3.5" }), /* @__PURE__ */ P("span", {
|
|
6151
6256
|
className: "text-sm",
|
|
6152
6257
|
children: "Settings"
|
|
6153
6258
|
})]
|
|
6154
6259
|
}),
|
|
6155
|
-
i ? /* @__PURE__ */ F(
|
|
6260
|
+
i ? /* @__PURE__ */ F(Vt, {
|
|
6156
6261
|
onClick: () => o(),
|
|
6157
6262
|
className: "cursor-pointer py-1 h-7",
|
|
6158
|
-
children: [/* @__PURE__ */ P(
|
|
6263
|
+
children: [/* @__PURE__ */ P(Ae, { className: "mr-2 h-3.5 w-3.5" }), /* @__PURE__ */ P("span", {
|
|
6159
6264
|
className: "text-sm",
|
|
6160
6265
|
children: "Logout"
|
|
6161
6266
|
})]
|
|
6162
|
-
}) : /* @__PURE__ */ F(
|
|
6267
|
+
}) : /* @__PURE__ */ F(Vt, {
|
|
6163
6268
|
onClick: () => a(),
|
|
6164
6269
|
className: "cursor-pointer py-1 h-7",
|
|
6165
|
-
children: [/* @__PURE__ */ P(
|
|
6270
|
+
children: [/* @__PURE__ */ P(ke, { className: "mr-2 h-3.5 w-3.5" }), /* @__PURE__ */ P("span", {
|
|
6166
6271
|
className: "text-sm",
|
|
6167
6272
|
children: "Login"
|
|
6168
6273
|
})]
|
|
6169
6274
|
}),
|
|
6170
|
-
/* @__PURE__ */ P(
|
|
6171
|
-
/* @__PURE__ */ P(
|
|
6275
|
+
/* @__PURE__ */ P(Ht, {}),
|
|
6276
|
+
/* @__PURE__ */ P(Ut, {})
|
|
6172
6277
|
] }) }
|
|
6173
6278
|
}
|
|
6174
|
-
], g = h.filter((e) => e.key !== "files"), _ = (e, t, n) => /* @__PURE__ */ P(
|
|
6279
|
+
], g = h.filter((e) => e.key !== "files"), _ = (e, t, n) => /* @__PURE__ */ P(Wt, {
|
|
6175
6280
|
src: e,
|
|
6176
6281
|
alt: t,
|
|
6177
6282
|
width: n,
|
|
@@ -6179,7 +6284,7 @@ function po() {
|
|
|
6179
6284
|
unoptimized: !0,
|
|
6180
6285
|
className: "w-full h-full"
|
|
6181
6286
|
});
|
|
6182
|
-
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
6287
|
+
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(zt, {
|
|
6183
6288
|
items: g,
|
|
6184
6289
|
enableKeyboardShortcuts: !0,
|
|
6185
6290
|
placements: {
|
|
@@ -6187,7 +6292,7 @@ function po() {
|
|
|
6187
6292
|
mobile: !1
|
|
6188
6293
|
},
|
|
6189
6294
|
renderImage: _
|
|
6190
|
-
}), /* @__PURE__ */ P(
|
|
6295
|
+
}), /* @__PURE__ */ P(zt, {
|
|
6191
6296
|
items: h,
|
|
6192
6297
|
placements: {
|
|
6193
6298
|
desktop: !1,
|
|
@@ -6198,42 +6303,42 @@ function po() {
|
|
|
6198
6303
|
})] });
|
|
6199
6304
|
}
|
|
6200
6305
|
// src/app/CookieConsent.tsx
|
|
6201
|
-
function
|
|
6202
|
-
return /* @__PURE__ */ P(
|
|
6306
|
+
function ko() {
|
|
6307
|
+
return /* @__PURE__ */ P(Gt, {
|
|
6203
6308
|
appName: t.appName,
|
|
6204
6309
|
links: t.footerLinks,
|
|
6205
6310
|
heightVar: "--qs-bottom-right-inset"
|
|
6206
6311
|
});
|
|
6207
6312
|
}
|
|
6208
6313
|
// src/app/useChunkErrorReload.ts
|
|
6209
|
-
var
|
|
6210
|
-
function
|
|
6211
|
-
if (typeof e == "string") return
|
|
6314
|
+
var Ao = "qwk:chunk-error-reload", jo = 6e4, Mo = /Loading (CSS )?chunk|ChunkLoadError|Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed|Unable to preload CSS/i;
|
|
6315
|
+
function No(e) {
|
|
6316
|
+
if (typeof e == "string") return Mo.test(e);
|
|
6212
6317
|
if (e && typeof e == "object") {
|
|
6213
6318
|
let { name: t, message: n } = e;
|
|
6214
|
-
return t === "ChunkLoadError" || typeof n == "string" &&
|
|
6319
|
+
return t === "ChunkLoadError" || typeof n == "string" && Mo.test(n);
|
|
6215
6320
|
}
|
|
6216
6321
|
return !1;
|
|
6217
6322
|
}
|
|
6218
|
-
function
|
|
6219
|
-
if (typeof window > "u" || !
|
|
6323
|
+
function Po(e) {
|
|
6324
|
+
if (typeof window > "u" || !No(e)) return !1;
|
|
6220
6325
|
try {
|
|
6221
|
-
let e = Number(window.sessionStorage.getItem(
|
|
6222
|
-
if (e && Date.now() - e <
|
|
6223
|
-
window.sessionStorage.setItem(
|
|
6326
|
+
let e = Number(window.sessionStorage.getItem(Ao));
|
|
6327
|
+
if (e && Date.now() - e < jo) return !1;
|
|
6328
|
+
window.sessionStorage.setItem(Ao, String(Date.now()));
|
|
6224
6329
|
} catch {
|
|
6225
6330
|
return !1;
|
|
6226
6331
|
}
|
|
6227
6332
|
return window.location.reload(), !0;
|
|
6228
6333
|
}
|
|
6229
|
-
function
|
|
6334
|
+
function Fo() {
|
|
6230
6335
|
T(() => {
|
|
6231
6336
|
let e = (e) => {
|
|
6232
|
-
|
|
6337
|
+
Po(e.error ?? e.message);
|
|
6233
6338
|
}, t = (e) => {
|
|
6234
|
-
|
|
6339
|
+
Po(e.reason);
|
|
6235
6340
|
}, n = (e) => {
|
|
6236
|
-
|
|
6341
|
+
Po(e.payload ?? "Loading chunk") && e.preventDefault();
|
|
6237
6342
|
};
|
|
6238
6343
|
return window.addEventListener("error", e), window.addEventListener("unhandledrejection", t), window.addEventListener("vite:preloadError", n), () => {
|
|
6239
6344
|
window.removeEventListener("error", e), window.removeEventListener("unhandledrejection", t), window.removeEventListener("vite:preloadError", n);
|
|
@@ -6241,8 +6346,8 @@ function bo() {
|
|
|
6241
6346
|
}, []);
|
|
6242
6347
|
}
|
|
6243
6348
|
// src/app/QwkSearchProviders.tsx
|
|
6244
|
-
var
|
|
6245
|
-
function
|
|
6349
|
+
var Io = ({ children: e }) => /* @__PURE__ */ P(N, { children: e });
|
|
6350
|
+
function Lo(e) {
|
|
6246
6351
|
let [t, n] = O(e === !0);
|
|
6247
6352
|
return T(() => {
|
|
6248
6353
|
if (e !== "auto") {
|
|
@@ -6250,7 +6355,7 @@ function So(e) {
|
|
|
6250
6355
|
return;
|
|
6251
6356
|
}
|
|
6252
6357
|
let t = !1;
|
|
6253
|
-
return
|
|
6358
|
+
return q("auth/providers").then((e) => {
|
|
6254
6359
|
t || n(!!e.providers?.includes("google"));
|
|
6255
6360
|
}).catch(() => {
|
|
6256
6361
|
t || n(!1);
|
|
@@ -6259,10 +6364,10 @@ function So(e) {
|
|
|
6259
6364
|
};
|
|
6260
6365
|
}, [e]), t;
|
|
6261
6366
|
}
|
|
6262
|
-
function
|
|
6367
|
+
function Ro({ children: t, authClient: n, config: i, googleOneTap: a = "auto", docsEnabled: o = !0, ChromeProvider: s = Io, showDock: l = !0, showCookieConsent: u = !0, showToaster: d = !0, showSpotlight: f = !0 }) {
|
|
6263
6368
|
i && e(i);
|
|
6264
|
-
let p =
|
|
6265
|
-
return
|
|
6369
|
+
let p = Lo(a);
|
|
6370
|
+
return Fo(), /* @__PURE__ */ P(Rt, {
|
|
6266
6371
|
attribute: "class",
|
|
6267
6372
|
defaultTheme: "system",
|
|
6268
6373
|
enableSystem: !0,
|
|
@@ -6270,54 +6375,54 @@ function Co({ children: t, authClient: n, config: i, googleOneTap: a = "auto", d
|
|
|
6270
6375
|
children: /* @__PURE__ */ P(c, {
|
|
6271
6376
|
authClient: n,
|
|
6272
6377
|
enableGoogleOneTap: p,
|
|
6273
|
-
children: /* @__PURE__ */ P(r, { children: /* @__PURE__ */ P(
|
|
6378
|
+
children: /* @__PURE__ */ P(r, { children: /* @__PURE__ */ P(On, { children: /* @__PURE__ */ P(Ia, {
|
|
6274
6379
|
docsEnabled: o,
|
|
6275
|
-
children: /* @__PURE__ */ P(
|
|
6380
|
+
children: /* @__PURE__ */ P(Bt, { children: /* @__PURE__ */ F(s, { children: [
|
|
6276
6381
|
/* @__PURE__ */ F("div", {
|
|
6277
6382
|
id: "app-scroll-root",
|
|
6278
6383
|
className: "w-screen h-screen overflow-y-auto overflow-x-hidden pb-[calc(60px+env(safe-area-inset-bottom,0px))] md:pb-0",
|
|
6279
|
-
children: [l && /* @__PURE__ */ P(
|
|
6384
|
+
children: [l && /* @__PURE__ */ P(Oo, {}), /* @__PURE__ */ P("main", {
|
|
6280
6385
|
className: "bg-light-primary dark:bg-dark-primary min-h-screen",
|
|
6281
6386
|
children: t
|
|
6282
6387
|
})]
|
|
6283
6388
|
}),
|
|
6284
|
-
d && /* @__PURE__ */ P(
|
|
6389
|
+
d && /* @__PURE__ */ P(at, { toastOptions: {
|
|
6285
6390
|
unstyled: !0,
|
|
6286
6391
|
classNames: { toast: "bg-light-secondary dark:bg-dark-secondary dark:text-white/70 text-black-70 rounded-lg p-4 flex flex-row items-center space-x-2" }
|
|
6287
6392
|
} }),
|
|
6288
|
-
u && /* @__PURE__ */ P(
|
|
6289
|
-
f && /* @__PURE__ */ P(
|
|
6393
|
+
u && /* @__PURE__ */ P(ko, {}),
|
|
6394
|
+
f && /* @__PURE__ */ P(so, {})
|
|
6290
6395
|
] }) })
|
|
6291
6396
|
}) }) })
|
|
6292
6397
|
})
|
|
6293
6398
|
});
|
|
6294
6399
|
}
|
|
6295
6400
|
// src/app/QwkSearchApp.tsx
|
|
6296
|
-
function
|
|
6297
|
-
return /* @__PURE__ */ P(
|
|
6401
|
+
function zo(e) {
|
|
6402
|
+
return /* @__PURE__ */ P(Ro, {
|
|
6298
6403
|
...e,
|
|
6299
6404
|
docsEnabled: !1,
|
|
6300
|
-
children: /* @__PURE__ */ P(
|
|
6405
|
+
children: /* @__PURE__ */ P(Gi, {})
|
|
6301
6406
|
});
|
|
6302
6407
|
}
|
|
6303
6408
|
// src/app/useChatTabs.ts
|
|
6304
|
-
var
|
|
6305
|
-
function
|
|
6409
|
+
var Bo = "qwksearch-open-chat-tabs", Vo = 50;
|
|
6410
|
+
function Ho() {
|
|
6306
6411
|
if (typeof window > "u") return [];
|
|
6307
6412
|
try {
|
|
6308
|
-
let e = window.localStorage.getItem(
|
|
6413
|
+
let e = window.localStorage.getItem(Bo);
|
|
6309
6414
|
return e ? JSON.parse(e) : [];
|
|
6310
6415
|
} catch {
|
|
6311
6416
|
return [];
|
|
6312
6417
|
}
|
|
6313
6418
|
}
|
|
6314
|
-
function
|
|
6315
|
-
let { chatId: e, chatTurns: t, startNewChat: n, switchToChat: r } = u(), [i, a] = O(
|
|
6419
|
+
function Uo() {
|
|
6420
|
+
let { chatId: e, chatTurns: t, startNewChat: n, switchToChat: r } = u(), [i, a] = O(Ho), o = D(null);
|
|
6316
6421
|
T(() => {
|
|
6317
|
-
window.localStorage.setItem(
|
|
6422
|
+
window.localStorage.setItem(Bo, JSON.stringify(i));
|
|
6318
6423
|
}, [i]), T(() => {
|
|
6319
6424
|
if (!e) return;
|
|
6320
|
-
let n = t[0]?.content?.slice(0,
|
|
6425
|
+
let n = t[0]?.content?.slice(0, Vo), r = t.length > 0;
|
|
6321
6426
|
a((t) => {
|
|
6322
6427
|
let i = t.find((t) => t.id === e);
|
|
6323
6428
|
return !i && e === o.current && !r ? t : i ? n && i.title !== n || i.hasMessages !== r ? t.map((t) => t.id === e ? {
|
|
@@ -6380,4 +6485,4 @@ function Oo() {
|
|
|
6380
6485
|
closeChats: d
|
|
6381
6486
|
};
|
|
6382
6487
|
}
|
|
6383
|
-
export {
|
|
6488
|
+
export { qn as $, la as A, Qi as B, Sa as C, ha as D, ga as E, Ki as F, ti as G, hi as H, ea as I, Ar as J, Qr as K, ta as L, ca as M, oa as N, da as O, na as P, mr as Q, $i as R, Ca as S, _a as T, si as U, Gi as V, ii as W, jr as X, kr as Y, Mr as Z, Ya as _, Po as a, Y as at, za as b, Oo as c, So as d, Yn as et, xo as f, Qa as g, Ja as h, No as i, En as it, ia as j, ua as k, To as l, io as m, zo as n, Jn as nt, Fo as o, so as p, Ur as q, Ro as r, On as rt, ko as s, Uo as t, X as tt, wo as u, Ha as v, ba as w, Na as x, Ia as y, Xi as z };
|