research-agent-ui 0.1.294 → 0.1.296
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-D_y16YHG.js → ArticleExtractPanel-BPNXuezE.js} +1 -1
- package/dist/{ArticleExtractPanel-25tRTnpl.cjs → ArticleExtractPanel-DAPLUpyx.cjs} +1 -1
- package/dist/{ChatConversationThread-BoNH0wvs.cjs → ChatConversationThread-D1RR0Bcx.cjs} +2 -2
- package/dist/{ChatConversationThread-BIJ8aNug.js → ChatConversationThread-DMPdu2sr.js} +2 -2
- package/dist/api.cjs +6 -6
- package/dist/api.mjs +304 -66
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-GPr1ceY8.js → src-BqV2Vwpv.js} +912 -702
- package/dist/src-Ckb1ciEL.cjs +34 -0
- package/dist/workspace.cjs +1 -1
- package/dist/workspace.mjs +1 -1
- package/package.json +14 -14
- package/dist/src-ebmQu_if.cjs +0 -34
|
@@ -5,27 +5,26 @@ 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 {
|
|
9
|
-
import {
|
|
10
|
-
import { Toaster as ct, toast as G } from "sonner";
|
|
8
|
+
import { AlertCircle as R, Archive as z, ArrowUp as B, BadgePercent as V, BookMarked as H, BookOpen as ee, Bot as te, Building2 as U, CalendarDays as ne, Check as re, CheckIcon as ie, ChevronDown as ae, ChevronRightIcon as oe, Clipboard as se, Clock as ce, Cloud as le, CloudIcon as ue, Copy as de, Cpu as fe, Download as pe, ExternalLink as me, EyeOff as he, File as ge, FileDown as _e, FileSpreadsheet as ve, FileText as ye, FileType as be, FolderOpen as xe, Globe as Se, HelpCircle as Ce, Highlighter as we, History as Te, Info as Ee, LayoutGrid as De, Link as Oe, Loader2 as W, Lock as ke, LogIn as Ae, LogOut as je, Mail as Me, MessageCircle as Ne, MessageCircleQuestion as Pe, MessageSquare as Fe, Mic as Ie, Newspaper as Le, Paperclip as Re, Pencil as ze, Pin as Be, Plus as Ve, Search as He, Settings as Ue, Settings2 as We, Share2 as Ge, SlidersHorizontal as Ke, Sparkles as qe, Square as Je, SquarePen as Ye, Star as Xe, Sun as Ze, SwatchBook as Qe, Trash as $e, Trash2 as et, Upload as tt, Volume2 as nt, X as rt, ZoomIn as it, ZoomOut as at } from "lucide-react";
|
|
9
|
+
import { Toaster as ot, toast as G } from "sonner";
|
|
11
10
|
import K from "grab-url";
|
|
12
|
-
import { agentChat as
|
|
13
|
-
import { LiveTranscriber as
|
|
14
|
-
import { SpokenPhraseOverlay as
|
|
11
|
+
import { agentChat as st, autocomplete as ct, createDocument as lt, deleteAllChats as ut, deleteChatById as dt, deleteUploadedFile as ft, getChatById as pt, getGoogleDriveFile as mt, getGoogleToken as ht, googleDocsAuth as gt, googleDocsAuthStatus as _t, listChats as vt, listProviders as yt, saveMessage as bt, searchChats as xt, shareChat as St, uploadFiles as Ct } from "qwksearch-api-client";
|
|
12
|
+
import { LiveTranscriber as wt } from "use-voice-control/client";
|
|
13
|
+
import { SpokenPhraseOverlay as Tt } from "use-voice-control/react";
|
|
15
14
|
import * as q from "@radix-ui/react-dropdown-menu";
|
|
16
|
-
import
|
|
17
|
-
import { Slot as
|
|
18
|
-
import { cva as
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import { Streamdown as
|
|
22
|
-
import { FaReddit as
|
|
23
|
-
import { ThemeProvider as
|
|
24
|
-
import { CategoryDock as
|
|
25
|
-
import
|
|
26
|
-
import { CookieConsent as
|
|
15
|
+
import Et from "next/link";
|
|
16
|
+
import { Slot as Dt } from "@radix-ui/react-slot";
|
|
17
|
+
import { cva as Ot } from "class-variance-authority";
|
|
18
|
+
import kt from "quantum-sphere-loading-icon/react";
|
|
19
|
+
import At from "dompurify";
|
|
20
|
+
import { Streamdown as jt } from "streamdown";
|
|
21
|
+
import { FaReddit as Mt, FaYoutube as Nt } from "react-icons/fa";
|
|
22
|
+
import { ThemeProvider as Pt } from "shadcn-theme-menu";
|
|
23
|
+
import { CategoryDock as Ft, CategoryDockProvider as It, DropdownMenuItem as Lt, DropdownMenuSeparator as Rt, ThemeMenu as zt } from "shadcn-app-dock";
|
|
24
|
+
import Bt from "next/image";
|
|
25
|
+
import { CookieConsent as Vt } from "legal-terms-privacy-policy/react";
|
|
27
26
|
// src/ui/gradient-blur.tsx
|
|
28
|
-
function
|
|
27
|
+
function Ht({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "transparent", color: r, colorGenerator: i }) {
|
|
29
28
|
let a = D(null), o = D({
|
|
30
29
|
x: 0,
|
|
31
30
|
y: 0
|
|
@@ -83,14 +82,225 @@ function Wt({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "tran
|
|
|
83
82
|
})
|
|
84
83
|
});
|
|
85
84
|
}
|
|
85
|
+
// ../search-autocomplete/dist/react.mjs
|
|
86
|
+
var Ut = "w-full text-left px-4 py-1.5 text-[15px] flex items-center gap-3 transition-colors", Wt = "bg-bg-200 text-text-100", Gt = "text-text-200 hover:bg-bg-100 dark:hover:bg-[#3A3A38]", Kt = "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";
|
|
87
|
+
function qt({ 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
|
+
let l = r === "above" ? 4 : -4;
|
|
89
|
+
return /* @__PURE__ */ P(I, { children: e && n.length + t.length > 0 && /* @__PURE__ */ P(L.div, {
|
|
90
|
+
initial: {
|
|
91
|
+
opacity: 0,
|
|
92
|
+
y: l
|
|
93
|
+
},
|
|
94
|
+
animate: {
|
|
95
|
+
opacity: 1,
|
|
96
|
+
y: 0
|
|
97
|
+
},
|
|
98
|
+
exit: {
|
|
99
|
+
opacity: 0,
|
|
100
|
+
y: l
|
|
101
|
+
},
|
|
102
|
+
transition: { duration: .12 },
|
|
103
|
+
className: `absolute ${c} z-20 rounded-2xl bg-gray-50 dark:bg-[#30302E] border border-bg-300 dark:border-transparent shadow-xl overflow-hidden ${r === "above" ? "bottom-full" : "top-full"}`,
|
|
104
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
105
|
+
children: /* @__PURE__ */ F("ul", {
|
|
106
|
+
role: "listbox",
|
|
107
|
+
className: "max-h-72 overflow-y-auto custom-scrollbar py-1",
|
|
108
|
+
children: [n.map((e, t) => /* @__PURE__ */ P("li", {
|
|
109
|
+
role: "option",
|
|
110
|
+
"aria-selected": t === i,
|
|
111
|
+
children: /* @__PURE__ */ F("button", {
|
|
112
|
+
type: "button",
|
|
113
|
+
onMouseEnter: () => a(t),
|
|
114
|
+
onClick: () => s(e),
|
|
115
|
+
className: `${Ut} ${t === i ? Wt : Gt}`,
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ P("span", {
|
|
118
|
+
className: Kt,
|
|
119
|
+
children: t + 1
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ P("img", {
|
|
122
|
+
src: e.favicon,
|
|
123
|
+
alt: "",
|
|
124
|
+
className: "w-4 h-4 rounded-sm shrink-0"
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ P("span", {
|
|
127
|
+
className: "truncate font-medium",
|
|
128
|
+
children: e.name || e.domain
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ P("span", {
|
|
131
|
+
className: "truncate text-[13px] text-text-400 shrink-0",
|
|
132
|
+
children: e.domain
|
|
133
|
+
}),
|
|
134
|
+
Number.isFinite(e.rank) && e.rank < 2 ** 53 - 1 && /* @__PURE__ */ F("span", {
|
|
135
|
+
className: "ml-auto shrink-0 px-1.5 py-0.5 rounded-full text-[10px] font-semibold tabular-nums bg-bg-200 dark:bg-[#3A3A38] text-text-400",
|
|
136
|
+
children: ["#", e.rank.toLocaleString()]
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
})
|
|
140
|
+
}, `domain-${e.domain}`)), t.map((e, t) => {
|
|
141
|
+
let r = n.length + t;
|
|
142
|
+
return /* @__PURE__ */ P("li", {
|
|
143
|
+
role: "option",
|
|
144
|
+
"aria-selected": r === i,
|
|
145
|
+
children: /* @__PURE__ */ F("button", {
|
|
146
|
+
type: "button",
|
|
147
|
+
onMouseEnter: () => a(r),
|
|
148
|
+
onClick: () => o(e),
|
|
149
|
+
className: `${Ut} ${r === i ? Wt : Gt}`,
|
|
150
|
+
children: [
|
|
151
|
+
/* @__PURE__ */ P("span", {
|
|
152
|
+
className: Kt,
|
|
153
|
+
children: r + 1
|
|
154
|
+
}),
|
|
155
|
+
/* @__PURE__ */ P(He, { className: "w-4 h-4 text-text-400 shrink-0" }),
|
|
156
|
+
/* @__PURE__ */ P("span", {
|
|
157
|
+
className: "truncate",
|
|
158
|
+
children: e
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
})
|
|
162
|
+
}, `${e}-${t}`);
|
|
163
|
+
})]
|
|
164
|
+
})
|
|
165
|
+
}) });
|
|
166
|
+
}
|
|
167
|
+
var Jt = "/api/agent/autocomplete";
|
|
168
|
+
function Yt(e, t = 4) {
|
|
169
|
+
let n = e.trimEnd();
|
|
170
|
+
if (!n) return {
|
|
171
|
+
prefix: "",
|
|
172
|
+
query: ""
|
|
173
|
+
};
|
|
174
|
+
let r = n.split(/\s+/), i = Math.min(t, r.length), a = r.slice(-i).join(" ");
|
|
175
|
+
return {
|
|
176
|
+
prefix: r.length > i ? r.slice(0, -i).join(" ") + " " : "",
|
|
177
|
+
query: a
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function Xt(e, t) {
|
|
181
|
+
return async (n, { signal: r, limit: i }) => {
|
|
182
|
+
let a = new URLSearchParams({
|
|
183
|
+
q: n,
|
|
184
|
+
limit: String(i)
|
|
185
|
+
});
|
|
186
|
+
t && a.set("engine", t);
|
|
187
|
+
let o = e.includes("?") ? "&" : "?", s = await fetch(`${e}${o}${a}`, { signal: r });
|
|
188
|
+
return s.ok ? await s.json() : null;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
var Zt = 36, Qt = 288;
|
|
192
|
+
function $t(e) {
|
|
193
|
+
let { value: t, onChange: n, enabled: r = !0, endpoint: i = Jt, 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 ?? Xt(i, a));
|
|
194
|
+
E.current = e.fetchSuggestions ?? Xt(i, a);
|
|
195
|
+
let k = D(e.onSelectDomain);
|
|
196
|
+
k.current = e.onSelectDomain;
|
|
197
|
+
let A = C(() => {
|
|
198
|
+
_(!1), x(-1);
|
|
199
|
+
}, []);
|
|
200
|
+
T(() => {
|
|
201
|
+
if (S.current) {
|
|
202
|
+
S.current = !1;
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
let { query: e } = Yt(t, l);
|
|
206
|
+
if (!r || e.length < c) {
|
|
207
|
+
w.current?.abort(), p([]), h([]), A();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
let n = setTimeout(async () => {
|
|
211
|
+
w.current?.abort();
|
|
212
|
+
let t = new AbortController();
|
|
213
|
+
w.current = t;
|
|
214
|
+
try {
|
|
215
|
+
let n = await E.current(e, {
|
|
216
|
+
signal: t.signal,
|
|
217
|
+
limit: o
|
|
218
|
+
});
|
|
219
|
+
if (!n || t.signal.aborted) return;
|
|
220
|
+
let r = Array.isArray(n.suggestions) ? n.suggestions : [], i = Array.isArray(n.domains) ? n.domains : [];
|
|
221
|
+
p(r), h(i);
|
|
222
|
+
let a = r.length + i.length;
|
|
223
|
+
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(Qt, a * Zt);
|
|
225
|
+
y(t < r && n > t ? "above" : "below");
|
|
226
|
+
}
|
|
227
|
+
_(a > 0), x(-1);
|
|
228
|
+
} catch (e) {
|
|
229
|
+
e?.name !== "AbortError" && console.error("Autocomplete fetch failed", e);
|
|
230
|
+
}
|
|
231
|
+
}, s);
|
|
232
|
+
return () => clearTimeout(n);
|
|
233
|
+
}, [
|
|
234
|
+
t,
|
|
235
|
+
r,
|
|
236
|
+
o,
|
|
237
|
+
s,
|
|
238
|
+
c,
|
|
239
|
+
l,
|
|
240
|
+
u,
|
|
241
|
+
A
|
|
242
|
+
]), T(() => () => w.current?.abort(), []);
|
|
243
|
+
let j = C((e) => {
|
|
244
|
+
S.current = !0;
|
|
245
|
+
let { prefix: r } = Yt(t, l);
|
|
246
|
+
n(r + e), p([]), h([]), A(), d?.current?.focus();
|
|
247
|
+
}, [
|
|
248
|
+
t,
|
|
249
|
+
l,
|
|
250
|
+
n,
|
|
251
|
+
A,
|
|
252
|
+
d
|
|
253
|
+
]), M = C((e) => {
|
|
254
|
+
A(), k.current ? k.current(e) : window.location.href = `https://${e.domain}`;
|
|
255
|
+
}, [A]), N = m.length + f.length, P = C((e) => {
|
|
256
|
+
e < m.length ? M(m[e]) : f[e - m.length] !== void 0 && j(f[e - m.length]);
|
|
257
|
+
}, [
|
|
258
|
+
m,
|
|
259
|
+
f,
|
|
260
|
+
M,
|
|
261
|
+
j
|
|
262
|
+
]);
|
|
263
|
+
return {
|
|
264
|
+
suggestions: f,
|
|
265
|
+
domains: m,
|
|
266
|
+
open: g,
|
|
267
|
+
placement: v,
|
|
268
|
+
highlightedIndex: b,
|
|
269
|
+
setHighlightedIndex: x,
|
|
270
|
+
totalOptions: N,
|
|
271
|
+
selectSuggestion: j,
|
|
272
|
+
selectDomain: M,
|
|
273
|
+
chooseOption: P,
|
|
274
|
+
close: A,
|
|
275
|
+
handleKeyDown: C((e) => {
|
|
276
|
+
if (!g || N === 0) return !1;
|
|
277
|
+
let t = () => (e.preventDefault(), !0);
|
|
278
|
+
switch (e.key) {
|
|
279
|
+
case "ArrowDown": return x((e) => (e + 1) % N), t();
|
|
280
|
+
case "ArrowUp": return x((e) => e <= 0 ? N - 1 : e - 1), t();
|
|
281
|
+
case "Escape": return A(), t();
|
|
282
|
+
case "Tab": return b < 0 ? !1 : (P(b), t());
|
|
283
|
+
case "Enter": return e.shiftKey || b < 0 ? !1 : (P(b), t());
|
|
284
|
+
}
|
|
285
|
+
let n = parseInt(e.key, 10);
|
|
286
|
+
return n >= 1 && n <= Math.min(9, N) && (P(n - 1), t());
|
|
287
|
+
}, [
|
|
288
|
+
g,
|
|
289
|
+
N,
|
|
290
|
+
b,
|
|
291
|
+
P,
|
|
292
|
+
A
|
|
293
|
+
])
|
|
294
|
+
};
|
|
295
|
+
}
|
|
86
296
|
// src/components/MessageComposer/MessageInputIconSet.tsx
|
|
87
297
|
var J = {
|
|
88
|
-
Plus:
|
|
89
|
-
Paperclip:
|
|
90
|
-
Cloud:
|
|
91
|
-
Upload:
|
|
92
|
-
File:
|
|
93
|
-
SquarePen:
|
|
298
|
+
Plus: Ve,
|
|
299
|
+
Paperclip: Re,
|
|
300
|
+
Cloud: le,
|
|
301
|
+
Upload: tt,
|
|
302
|
+
File: ge,
|
|
303
|
+
SquarePen: Ye,
|
|
94
304
|
Thinking: (e) => /* @__PURE__ */ P("svg", {
|
|
95
305
|
width: "20",
|
|
96
306
|
height: "20",
|
|
@@ -100,15 +310,15 @@ var J = {
|
|
|
100
310
|
...e,
|
|
101
311
|
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" })
|
|
102
312
|
}),
|
|
103
|
-
SelectArrow:
|
|
104
|
-
ArrowUp:
|
|
105
|
-
X:
|
|
106
|
-
FileText:
|
|
313
|
+
SelectArrow: ae,
|
|
314
|
+
ArrowUp: B,
|
|
315
|
+
X: rt,
|
|
316
|
+
FileText: ye,
|
|
107
317
|
Loader2: W,
|
|
108
|
-
Check:
|
|
109
|
-
Archive:
|
|
110
|
-
Mic:
|
|
111
|
-
Stop:
|
|
318
|
+
Check: re,
|
|
319
|
+
Archive: z,
|
|
320
|
+
Mic: Ie,
|
|
321
|
+
Stop: Je,
|
|
112
322
|
Clock: (e) => /* @__PURE__ */ P("svg", {
|
|
113
323
|
xmlns: "http://www.w3.org/2000/svg",
|
|
114
324
|
width: "20",
|
|
@@ -118,7 +328,7 @@ var J = {
|
|
|
118
328
|
...e,
|
|
119
329
|
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" })
|
|
120
330
|
})
|
|
121
|
-
},
|
|
331
|
+
}, en = (e) => {
|
|
122
332
|
if (e === 0) return "0 Bytes";
|
|
123
333
|
let t = 1024, n = [
|
|
124
334
|
"Bytes",
|
|
@@ -127,7 +337,7 @@ var J = {
|
|
|
127
337
|
"GB"
|
|
128
338
|
], r = Math.floor(Math.log(e) / Math.log(t));
|
|
129
339
|
return parseFloat((e / t ** r).toFixed(2)) + " " + n[r];
|
|
130
|
-
},
|
|
340
|
+
}, tn = ({ file: e, onRemove: t }) => {
|
|
131
341
|
let n = e.type.startsWith("image/") && e.preview;
|
|
132
342
|
return /* @__PURE__ */ F("div", {
|
|
133
343
|
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",
|
|
@@ -144,7 +354,7 @@ var J = {
|
|
|
144
354
|
/* @__PURE__ */ P("span", {
|
|
145
355
|
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",
|
|
146
356
|
title: e.file.name,
|
|
147
|
-
children:
|
|
357
|
+
children: en(e.file.size)
|
|
148
358
|
})
|
|
149
359
|
]
|
|
150
360
|
}) : /* @__PURE__ */ F("div", {
|
|
@@ -166,7 +376,7 @@ var J = {
|
|
|
166
376
|
children: e.file.name
|
|
167
377
|
}), /* @__PURE__ */ P("p", {
|
|
168
378
|
className: "text-[10px] text-text-500",
|
|
169
|
-
children:
|
|
379
|
+
children: en(e.file.size)
|
|
170
380
|
})]
|
|
171
381
|
})]
|
|
172
382
|
}),
|
|
@@ -185,7 +395,7 @@ var J = {
|
|
|
185
395
|
})
|
|
186
396
|
]
|
|
187
397
|
});
|
|
188
|
-
},
|
|
398
|
+
}, nn = ({ content: e, onRemove: t }) => /* @__PURE__ */ F("div", {
|
|
189
399
|
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)]",
|
|
190
400
|
children: [
|
|
191
401
|
/* @__PURE__ */ P("div", {
|
|
@@ -211,7 +421,7 @@ var J = {
|
|
|
211
421
|
children: /* @__PURE__ */ P(J.X, { className: "w-2 h-2" })
|
|
212
422
|
})
|
|
213
423
|
]
|
|
214
|
-
}),
|
|
424
|
+
}), rn = async (e, t, n) => {
|
|
215
425
|
try {
|
|
216
426
|
let n = localStorage.getItem("chatModelKey"), r = localStorage.getItem("chatModelProviderId"), i = (await K("agent/providers"))?.providers || [];
|
|
217
427
|
if (!i || i.length === 0) {
|
|
@@ -236,51 +446,51 @@ var J = {
|
|
|
236
446
|
} catch (e) {
|
|
237
447
|
console.error("An error occurred while checking the configuration:", e), G.error(`Could not load AI providers: ${e?.message ?? String(e)}`), t(!0);
|
|
238
448
|
}
|
|
239
|
-
},
|
|
449
|
+
}, an = "qwksearch_guest_chats", on = typeof window < "u";
|
|
240
450
|
function Y() {
|
|
241
|
-
if (!
|
|
451
|
+
if (!on) return [];
|
|
242
452
|
try {
|
|
243
|
-
let e = localStorage.getItem(
|
|
453
|
+
let e = localStorage.getItem(an);
|
|
244
454
|
return e ? JSON.parse(e).sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime()) : [];
|
|
245
455
|
} catch (e) {
|
|
246
456
|
return console.error("Failed to get guest chats:", e), [];
|
|
247
457
|
}
|
|
248
458
|
}
|
|
249
|
-
function
|
|
250
|
-
return
|
|
459
|
+
function sn(e) {
|
|
460
|
+
return on && Y().find((t) => t.id === e) || null;
|
|
251
461
|
}
|
|
252
|
-
function
|
|
253
|
-
if (
|
|
462
|
+
function cn(e) {
|
|
463
|
+
if (on) try {
|
|
254
464
|
let t = Y(), n = t.findIndex((t) => t.id === e.id);
|
|
255
|
-
n >= 0 ? t[n] = e : t.push(e), localStorage.setItem(
|
|
465
|
+
n >= 0 ? t[n] = e : t.push(e), localStorage.setItem(an, JSON.stringify(t));
|
|
256
466
|
} catch (e) {
|
|
257
467
|
console.error("Failed to save guest chat:", e);
|
|
258
468
|
}
|
|
259
469
|
}
|
|
260
|
-
function
|
|
261
|
-
if (
|
|
470
|
+
function ln(e) {
|
|
471
|
+
if (on) try {
|
|
262
472
|
let t = Y().filter((t) => t.id !== e);
|
|
263
|
-
localStorage.setItem(
|
|
473
|
+
localStorage.setItem(an, JSON.stringify(t));
|
|
264
474
|
} catch (e) {
|
|
265
475
|
console.error("Failed to delete guest chat:", e);
|
|
266
476
|
}
|
|
267
477
|
}
|
|
268
|
-
function
|
|
269
|
-
if (
|
|
270
|
-
localStorage.removeItem(
|
|
478
|
+
function un() {
|
|
479
|
+
if (on) try {
|
|
480
|
+
localStorage.removeItem(an);
|
|
271
481
|
} catch (e) {
|
|
272
482
|
console.error("Failed to clear guest chats:", e);
|
|
273
483
|
}
|
|
274
484
|
}
|
|
275
|
-
function
|
|
276
|
-
if (!
|
|
277
|
-
let n =
|
|
278
|
-
n && (n.title = t,
|
|
485
|
+
function dn(e, t) {
|
|
486
|
+
if (!on) return;
|
|
487
|
+
let n = sn(e);
|
|
488
|
+
n && (n.title = t, cn(n));
|
|
279
489
|
}
|
|
280
490
|
// src/hooks/useChat/chatMessages.ts
|
|
281
|
-
var
|
|
491
|
+
var fn = async (e, t, n, r, i, a, o, s, c) => {
|
|
282
492
|
if (!t) {
|
|
283
|
-
let t =
|
|
493
|
+
let t = sn(e);
|
|
284
494
|
if (t) {
|
|
285
495
|
n(t.messages);
|
|
286
496
|
let e = t.messages.filter((e) => e.role === "user" || e.role === "assistant"), o = e.map((e) => [e.role, e.content]);
|
|
@@ -288,7 +498,7 @@ var nn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
288
498
|
return;
|
|
289
499
|
}
|
|
290
500
|
try {
|
|
291
|
-
let { data: t, error: l } = await
|
|
501
|
+
let { data: t, error: l } = await pt({ path: { id: e } });
|
|
292
502
|
if (l) {
|
|
293
503
|
let e = l.status;
|
|
294
504
|
if (e === 404 || e === 403) {
|
|
@@ -318,7 +528,7 @@ var nn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
318
528
|
}
|
|
319
529
|
}
|
|
320
530
|
try {
|
|
321
|
-
let { data: t, error: l } = await
|
|
531
|
+
let { data: t, error: l } = await pt({ path: { id: e } });
|
|
322
532
|
if (l) {
|
|
323
533
|
let e = l.status;
|
|
324
534
|
if (e === 404 || e === 401 || e === 403) {
|
|
@@ -344,7 +554,7 @@ var nn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
344
554
|
} catch (e) {
|
|
345
555
|
console.error("[chatMessages] Failed to load chat:", e), o(!0), r(!0);
|
|
346
556
|
}
|
|
347
|
-
},
|
|
557
|
+
}, pn = (e) => {
|
|
348
558
|
let t = [];
|
|
349
559
|
return e.forEach((n, r) => {
|
|
350
560
|
if (n.role === "user") {
|
|
@@ -376,7 +586,7 @@ var nn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
376
586
|
});
|
|
377
587
|
}
|
|
378
588
|
}), t;
|
|
379
|
-
},
|
|
589
|
+
}, mn = async (e) => {
|
|
380
590
|
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");
|
|
381
591
|
try {
|
|
382
592
|
let e = await K("agent/suggestions", {
|
|
@@ -395,18 +605,18 @@ var nn = async (e, t, n, r, i, a, o, s, c) => {
|
|
|
395
605
|
} catch {
|
|
396
606
|
return [];
|
|
397
607
|
}
|
|
398
|
-
},
|
|
399
|
-
async function
|
|
400
|
-
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(
|
|
608
|
+
}, hn = 3, gn = "Analyze the uploaded file(s) and summarize the key points.", _n = () => Array.from(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(7)), (e) => e.toString(16).padStart(2, "0")).join(""), vn = "sourceExtractionEnabled", yn = "thinkingTimeLimit";
|
|
609
|
+
async function bn(e, n) {
|
|
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(vn) === "true", T = typeof window < "u" && Number(localStorage.getItem(yn) ?? "0") || 0;
|
|
401
611
|
if (s) return;
|
|
402
612
|
let E = r?.trim() ?? "", D = Array.isArray(l) && l.length > 0;
|
|
403
613
|
if (!E && !D) return;
|
|
404
|
-
let O = E ? r :
|
|
614
|
+
let O = E ? r : gn, k = new AbortController();
|
|
405
615
|
if (v.current = k, y(!0), b(!1), c.length <= 1 && !t.onOpenChat) {
|
|
406
616
|
let e = new URL(window.location.href);
|
|
407
617
|
e.searchParams.set("chat", o), window.history.replaceState(null, "", `${e.pathname}?${e.searchParams.toString()}${e.hash}`);
|
|
408
618
|
}
|
|
409
|
-
let A = "", j = !1, M = !1, N = [], P = Date.now(), F = T > 0, I = "", L = "", R = i ??
|
|
619
|
+
let A = "", j = !1, M = !1, N = [], P = Date.now(), F = T > 0, I = "", L = "", R = i ?? _n(), z = Array.isArray(u) ? [...u] : [];
|
|
410
620
|
x((e) => [...e, {
|
|
411
621
|
content: O,
|
|
412
622
|
messageId: R,
|
|
@@ -418,7 +628,7 @@ async function dn(e, n) {
|
|
|
418
628
|
let B = (e) => {
|
|
419
629
|
x((t) => [...t, {
|
|
420
630
|
content: `⚠️ **The response failed:** ${e}`,
|
|
421
|
-
messageId:
|
|
631
|
+
messageId: _n(),
|
|
422
632
|
chatId: o,
|
|
423
633
|
role: "assistant",
|
|
424
634
|
createdAt: /* @__PURE__ */ new Date()
|
|
@@ -473,7 +683,7 @@ async function dn(e, n) {
|
|
|
473
683
|
role: "source",
|
|
474
684
|
sources: N,
|
|
475
685
|
createdAt: /* @__PURE__ */ new Date()
|
|
476
|
-
}]), N.length > 0 && (b(!0), N.slice(0,
|
|
686
|
+
}]), N.length > 0 && (b(!0), N.slice(0, hn).forEach((e) => {
|
|
477
687
|
let t = e?.metadata?.url;
|
|
478
688
|
t && t !== "File" && K(`doc/article?url=${encodeURIComponent(t)}`).catch(() => {});
|
|
479
689
|
}))), 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" ? {
|
|
@@ -501,7 +711,7 @@ async function dn(e, n) {
|
|
|
501
711
|
let e = _.current[_.current.length - 1];
|
|
502
712
|
if (t.getAutoMediaSearch() && (document.getElementById(`search-images-${e.messageId}`)?.click(), document.getElementById(`search-videos-${e.messageId}`)?.click()), !M) {
|
|
503
713
|
M = !0;
|
|
504
|
-
let e = await
|
|
714
|
+
let e = await mn(_.current), t = _n();
|
|
505
715
|
if (x((n) => [...n, {
|
|
506
716
|
role: "suggestion",
|
|
507
717
|
suggestions: e,
|
|
@@ -509,7 +719,7 @@ async function dn(e, n) {
|
|
|
509
719
|
createdAt: /* @__PURE__ */ new Date(),
|
|
510
720
|
messageId: t
|
|
511
721
|
}]), g && e.length > 0) try {
|
|
512
|
-
await
|
|
722
|
+
await bt({ body: {
|
|
513
723
|
chatId: o,
|
|
514
724
|
messageId: t,
|
|
515
725
|
role: "suggestion",
|
|
@@ -529,7 +739,7 @@ async function dn(e, n) {
|
|
|
529
739
|
}
|
|
530
740
|
}, H = c.findIndex((e) => e.messageId === R);
|
|
531
741
|
try {
|
|
532
|
-
let { stream: e } = await
|
|
742
|
+
let { stream: e } = await st({
|
|
533
743
|
signal: k.signal,
|
|
534
744
|
body: {
|
|
535
745
|
message: {
|
|
@@ -579,11 +789,11 @@ async function dn(e, n) {
|
|
|
579
789
|
v.current = null;
|
|
580
790
|
}
|
|
581
791
|
// src/hooks/useChat/useChatState.ts
|
|
582
|
-
function
|
|
792
|
+
function xn(e) {
|
|
583
793
|
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({
|
|
584
794
|
key: "",
|
|
585
795
|
providerId: ""
|
|
586
|
-
}), R = D([]), z = E(() => x.filter((e) => e.role === "user" || e.role === "assistant"), [x]), B = E(() =>
|
|
796
|
+
}), R = D([]), z = E(() => x.filter((e) => e.role === "user" || e.role === "assistant"), [x]), B = E(() => pn(x), [x]);
|
|
587
797
|
return {
|
|
588
798
|
state: {
|
|
589
799
|
chatId: t,
|
|
@@ -629,7 +839,7 @@ function fn(e) {
|
|
|
629
839
|
};
|
|
630
840
|
}
|
|
631
841
|
// src/lib/chatTitle.ts
|
|
632
|
-
var
|
|
842
|
+
var Sn = async (e, t) => {
|
|
633
843
|
let n = localStorage.getItem("chatModelKey"), r = localStorage.getItem("chatModelProviderId"), i = t.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
|
|
634
844
|
role: e.role,
|
|
635
845
|
content: e.content ?? ""
|
|
@@ -653,16 +863,16 @@ var pn = async (e, t) => {
|
|
|
653
863
|
}
|
|
654
864
|
};
|
|
655
865
|
// src/hooks/useChat/ChatProvider.tsx
|
|
656
|
-
function
|
|
657
|
-
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 } =
|
|
866
|
+
function Cn({ children: e }) {
|
|
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 } = xn(t.chatId), m = D(null), [h, g] = O(!1), _ = D({}), v = D(/* @__PURE__ */ new Set());
|
|
658
868
|
T(() => {
|
|
659
|
-
|
|
869
|
+
rn(u.setChatModelProvider, u.setIsConfigReady, u.setHasError);
|
|
660
870
|
}, []), T(() => {
|
|
661
871
|
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));
|
|
662
872
|
}, [t.chatId, l.chatId]), T(() => {
|
|
663
873
|
if (l.chatId && !l.newChatCreated && !l.isMessagesLoaded && l.messages.length === 0) {
|
|
664
874
|
if (c) return;
|
|
665
|
-
|
|
875
|
+
fn(l.chatId, s, u.setMessages, u.setIsMessagesLoaded, u.setChatHistory, u.setFocusMode, u.setNotFound, u.setFiles, u.setFileIds);
|
|
666
876
|
} else l.chatId || (u.setNewChatCreated(!0), u.setIsMessagesLoaded(!0), u.setChatId(crypto.randomUUID()));
|
|
667
877
|
}, [
|
|
668
878
|
l.chatId,
|
|
@@ -676,7 +886,7 @@ function mn({ children: e }) {
|
|
|
676
886
|
let e = l.messages.filter((e) => e.role === "user" || e.role === "assistant");
|
|
677
887
|
if (e.length > 0) {
|
|
678
888
|
let t = _.current[l.chatId] ?? e[0].content.slice(0, 50);
|
|
679
|
-
|
|
889
|
+
cn({
|
|
680
890
|
id: l.chatId,
|
|
681
891
|
title: t,
|
|
682
892
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -696,8 +906,8 @@ function mn({ children: e }) {
|
|
|
696
906
|
if (h || !l.chatId || !l.isMessagesLoaded || !l.newChatCreated || l.loading || f.filter((e) => e.role === "user").length < 2) return;
|
|
697
907
|
let e = l.chatId;
|
|
698
908
|
v.current.has(e) || (v.current.add(e), (async () => {
|
|
699
|
-
let t = await
|
|
700
|
-
t ? (_.current[e] = t, s ||
|
|
909
|
+
let t = await Sn(e, l.messages);
|
|
910
|
+
t ? (_.current[e] = t, s || dn(e, t)) : v.current.delete(e);
|
|
701
911
|
})());
|
|
702
912
|
}, [
|
|
703
913
|
f,
|
|
@@ -720,7 +930,7 @@ function mn({ children: e }) {
|
|
|
720
930
|
o
|
|
721
931
|
]);
|
|
722
932
|
let y = C(async (e, t, n = !1) => {
|
|
723
|
-
l.chatId && await
|
|
933
|
+
l.chatId && await bn({
|
|
724
934
|
message: e,
|
|
725
935
|
messageId: t,
|
|
726
936
|
rewrite: n
|
|
@@ -776,7 +986,7 @@ function mn({ children: e }) {
|
|
|
776
986
|
} : t;
|
|
777
987
|
}));
|
|
778
988
|
try {
|
|
779
|
-
let { error: t } = await
|
|
989
|
+
let { error: t } = await ft({ query: { fileId: e } });
|
|
780
990
|
if (t) throw Error(t.message ?? "Delete failed");
|
|
781
991
|
} catch (e) {
|
|
782
992
|
console.error("[ChatProvider] Failed to delete uploaded file:", e), G.error("Removed from the chat, but the file could not be deleted from storage.");
|
|
@@ -829,10 +1039,10 @@ function mn({ children: e }) {
|
|
|
829
1039
|
});
|
|
830
1040
|
}
|
|
831
1041
|
// src/hooks/voice/useSpeechToTranscript.ts
|
|
832
|
-
function
|
|
1042
|
+
function wn() {
|
|
833
1043
|
return typeof window > "u" ? !1 : !!(window.SpeechRecognition || window.webkitSpeechRecognition);
|
|
834
1044
|
}
|
|
835
|
-
function
|
|
1045
|
+
function Tn(e, t, n = {}) {
|
|
836
1046
|
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({
|
|
837
1047
|
onTranscript: e,
|
|
838
1048
|
onEnd: t,
|
|
@@ -843,7 +1053,7 @@ function gn(e, t, n = {}) {
|
|
|
843
1053
|
onEnd: t,
|
|
844
1054
|
onPartial: n.onPartial
|
|
845
1055
|
};
|
|
846
|
-
let h = E(() => new
|
|
1056
|
+
let h = E(() => new wt({
|
|
847
1057
|
engine: "webspeech",
|
|
848
1058
|
language: n.language ?? "en-US",
|
|
849
1059
|
onStateChange: i,
|
|
@@ -889,7 +1099,7 @@ function gn(e, t, n = {}) {
|
|
|
889
1099
|
G.error("Microphone access is required for speech input."), i(!1), m.current.onEnd();
|
|
890
1100
|
}
|
|
891
1101
|
}, []), y = C(async () => {
|
|
892
|
-
h.isListening() ? (await h.stop(), o(""), m.current.onEnd()) : d.current ? g() :
|
|
1102
|
+
h.isListening() ? (await h.stop(), o(""), m.current.onEnd()) : d.current ? g() : wn() ? await h.start() : await v();
|
|
893
1103
|
}, [
|
|
894
1104
|
h,
|
|
895
1105
|
v,
|
|
@@ -907,48 +1117,48 @@ function gn(e, t, n = {}) {
|
|
|
907
1117
|
return {
|
|
908
1118
|
isListening: r,
|
|
909
1119
|
toggleSpeech: y,
|
|
910
|
-
isSpeechSupported:
|
|
1120
|
+
isSpeechSupported: wn() || b,
|
|
911
1121
|
partial: a,
|
|
912
1122
|
lastPhrase: s,
|
|
913
1123
|
phraseId: l
|
|
914
1124
|
};
|
|
915
1125
|
}
|
|
916
1126
|
// src/lib/voiceAutoStart.ts
|
|
917
|
-
var
|
|
918
|
-
function
|
|
919
|
-
return
|
|
1127
|
+
var En = "voiceAutoStart", Dn = "voiceAutoStartTriggered", On = typeof window < "u";
|
|
1128
|
+
function kn() {
|
|
1129
|
+
return On ? localStorage.getItem(En) === "true" : !1;
|
|
920
1130
|
}
|
|
921
|
-
function
|
|
922
|
-
|
|
1131
|
+
function An(e) {
|
|
1132
|
+
On && localStorage.setItem(En, String(e));
|
|
923
1133
|
}
|
|
924
|
-
function
|
|
925
|
-
|
|
1134
|
+
function jn() {
|
|
1135
|
+
On && localStorage.setItem(Dn, "true");
|
|
926
1136
|
}
|
|
927
|
-
function
|
|
1137
|
+
function Mn({ enabled: e, isSpeechSupported: t, isListening: n }, r) {
|
|
928
1138
|
return e && t && !n && !r;
|
|
929
1139
|
}
|
|
930
|
-
function
|
|
931
|
-
return
|
|
1140
|
+
function Nn() {
|
|
1141
|
+
return On ? localStorage.getItem(Dn) === "true" : !1;
|
|
932
1142
|
}
|
|
933
1143
|
// src/hooks/voice/useVoiceAutoStart.ts
|
|
934
|
-
function
|
|
1144
|
+
function Pn({ isSpeechSupported: e, isListening: t, toggleSpeech: n }) {
|
|
935
1145
|
T(() => {
|
|
936
|
-
|
|
937
|
-
enabled:
|
|
1146
|
+
Mn({
|
|
1147
|
+
enabled: kn(),
|
|
938
1148
|
isSpeechSupported: e,
|
|
939
1149
|
isListening: t
|
|
940
|
-
},
|
|
1150
|
+
}, Nn()) && (jn(), n());
|
|
941
1151
|
}, [e]);
|
|
942
1152
|
}
|
|
943
1153
|
// src/components/FileUpload/useFileHandling.ts
|
|
944
|
-
var
|
|
1154
|
+
var Fn = [
|
|
945
1155
|
"pdf",
|
|
946
1156
|
"docx",
|
|
947
1157
|
"txt",
|
|
948
1158
|
"md",
|
|
949
1159
|
"html",
|
|
950
1160
|
"htm"
|
|
951
|
-
],
|
|
1161
|
+
], In = [
|
|
952
1162
|
"png",
|
|
953
1163
|
"jpg",
|
|
954
1164
|
"jpeg",
|
|
@@ -957,21 +1167,21 @@ var En = [
|
|
|
957
1167
|
"svg",
|
|
958
1168
|
"bmp",
|
|
959
1169
|
"avif"
|
|
960
|
-
],
|
|
1170
|
+
], Ln = [...Fn, ...In], Rn = 10, zn = 52428800, Bn = (e, t) => {
|
|
961
1171
|
if (e && typeof e == "object") {
|
|
962
1172
|
let t = e.message ?? e.error ?? e.data?.message;
|
|
963
1173
|
if (typeof t == "string" && t.length > 0) return t;
|
|
964
1174
|
}
|
|
965
1175
|
return typeof e == "string" && e.length > 0 ? e : t;
|
|
966
1176
|
};
|
|
967
|
-
function
|
|
1177
|
+
function Vn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles: r, setContextFileIds: i }) {
|
|
968
1178
|
let [a, o] = O([]), [s, c] = O([]), [l, u] = O(!1), [d, f] = O(!1), p = C(async (e) => {
|
|
969
1179
|
let a = Array.from(e);
|
|
970
|
-
a.length >
|
|
971
|
-
let s = a.filter((e) => e.size >
|
|
972
|
-
if (s.length > 0 && (G.error(`${s.map((e) => e.name).join(", ")} exceed${s.length === 1 ? "s" : ""} the 50 MB per-file limit.`), a = a.filter((e) => e.size <=
|
|
1180
|
+
a.length > Rn && (G.error(`You can attach up to ${Rn} files at a time.`), a = a.slice(0, Rn));
|
|
1181
|
+
let s = a.filter((e) => e.size > zn);
|
|
1182
|
+
if (s.length > 0 && (G.error(`${s.map((e) => e.name).join(", ")} exceed${s.length === 1 ? "s" : ""} the 50 MB per-file limit.`), a = a.filter((e) => e.size <= zn)), a.length === 0) return;
|
|
973
1183
|
let c = a.map((e) => {
|
|
974
|
-
let t = e.type.startsWith("image/") || /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(e.name), n = e.name.split(".").pop()?.toLowerCase() ?? "", r =
|
|
1184
|
+
let t = e.type.startsWith("image/") || /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(e.name), n = e.name.split(".").pop()?.toLowerCase() ?? "", r = Ln.includes(n);
|
|
975
1185
|
return {
|
|
976
1186
|
id: Math.random().toString(36).substr(2, 9),
|
|
977
1187
|
file: e,
|
|
@@ -981,7 +1191,7 @@ function Mn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
981
1191
|
_ext: n
|
|
982
1192
|
};
|
|
983
1193
|
});
|
|
984
|
-
o((e) => [...e, ...c]), c.filter((e) => !
|
|
1194
|
+
o((e) => [...e, ...c]), c.filter((e) => !Ln.includes(e._ext)).forEach((e) => {
|
|
985
1195
|
setTimeout(() => {
|
|
986
1196
|
o((t) => t.map((t) => t.id === e.id ? {
|
|
987
1197
|
...t,
|
|
@@ -989,16 +1199,16 @@ function Mn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
989
1199
|
} : t));
|
|
990
1200
|
}, 600 + Math.random() * 600);
|
|
991
1201
|
});
|
|
992
|
-
let l = c.filter((e) =>
|
|
1202
|
+
let l = c.filter((e) => Ln.includes(e._ext));
|
|
993
1203
|
if (l.length !== 0) try {
|
|
994
|
-
let { data: e, error: a } = await
|
|
995
|
-
if (a || !e?.files) throw Error(
|
|
1204
|
+
let { data: e, error: a } = await Ct({ body: { files: l.map((e) => e.file) } });
|
|
1205
|
+
if (a || !e?.files) throw Error(Bn(a ?? e, "Upload failed."));
|
|
996
1206
|
o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
|
|
997
1207
|
...e,
|
|
998
1208
|
uploadStatus: "complete"
|
|
999
1209
|
} : e)), r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]);
|
|
1000
1210
|
} catch (e) {
|
|
1001
|
-
G.error(
|
|
1211
|
+
G.error(Bn(e, "Failed to upload files.")), o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
|
|
1002
1212
|
...e,
|
|
1003
1213
|
uploadStatus: "error"
|
|
1004
1214
|
} : e));
|
|
@@ -1028,10 +1238,10 @@ function Mn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
1028
1238
|
headers: { "Content-Type": "application/json" },
|
|
1029
1239
|
body: JSON.stringify({ url: a })
|
|
1030
1240
|
})).json();
|
|
1031
|
-
if (!e?.files || e.files.length === 0) throw Error(
|
|
1241
|
+
if (!e?.files || e.files.length === 0) throw Error(Bn(e, `Could not extract content from ${a}`));
|
|
1032
1242
|
return r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]), G.success(`Added "${e.files[0].fileName}" as context.`), !0;
|
|
1033
1243
|
} catch (e) {
|
|
1034
|
-
return G.error(
|
|
1244
|
+
return G.error(Bn(e, "Failed to extract URL.")), !1;
|
|
1035
1245
|
} finally {
|
|
1036
1246
|
f(!1);
|
|
1037
1247
|
}
|
|
@@ -1077,19 +1287,19 @@ function Mn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
|
|
|
1077
1287
|
};
|
|
1078
1288
|
}
|
|
1079
1289
|
// src/ui/dropdown-menu.tsx
|
|
1080
|
-
function
|
|
1290
|
+
function Hn({ ...e }) {
|
|
1081
1291
|
return /* @__PURE__ */ P(q.Root, {
|
|
1082
1292
|
"data-slot": "dropdown-menu",
|
|
1083
1293
|
...e
|
|
1084
1294
|
});
|
|
1085
1295
|
}
|
|
1086
|
-
function
|
|
1296
|
+
function Un({ ...e }) {
|
|
1087
1297
|
return /* @__PURE__ */ P(q.Trigger, {
|
|
1088
1298
|
"data-slot": "dropdown-menu-trigger",
|
|
1089
1299
|
...e
|
|
1090
1300
|
});
|
|
1091
1301
|
}
|
|
1092
|
-
function
|
|
1302
|
+
function Wn({ className: e, sideOffset: t = 4, ...n }) {
|
|
1093
1303
|
return /* @__PURE__ */ P(q.Portal, { children: /* @__PURE__ */ P(q.Content, {
|
|
1094
1304
|
"data-slot": "dropdown-menu-content",
|
|
1095
1305
|
sideOffset: t,
|
|
@@ -1106,7 +1316,7 @@ function X({ className: e, inset: t, variant: n = "default", ...r }) {
|
|
|
1106
1316
|
...r
|
|
1107
1317
|
});
|
|
1108
1318
|
}
|
|
1109
|
-
function
|
|
1319
|
+
function Gn({ className: e, children: t, checked: n, ...r }) {
|
|
1110
1320
|
return /* @__PURE__ */ F(q.CheckboxItem, {
|
|
1111
1321
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
1112
1322
|
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),
|
|
@@ -1114,11 +1324,11 @@ function In({ className: e, children: t, checked: n, ...r }) {
|
|
|
1114
1324
|
...r,
|
|
1115
1325
|
children: [/* @__PURE__ */ P("span", {
|
|
1116
1326
|
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
1117
|
-
children: /* @__PURE__ */ P(q.ItemIndicator, { children: /* @__PURE__ */ P(
|
|
1327
|
+
children: /* @__PURE__ */ P(q.ItemIndicator, { children: /* @__PURE__ */ P(ie, { className: "size-4" }) })
|
|
1118
1328
|
}), t]
|
|
1119
1329
|
});
|
|
1120
1330
|
}
|
|
1121
|
-
function
|
|
1331
|
+
function Kn({ className: e, inset: t, ...n }) {
|
|
1122
1332
|
return /* @__PURE__ */ P(q.Label, {
|
|
1123
1333
|
"data-slot": "dropdown-menu-label",
|
|
1124
1334
|
"data-inset": t,
|
|
@@ -1133,22 +1343,22 @@ function Z({ className: e, ...t }) {
|
|
|
1133
1343
|
...t
|
|
1134
1344
|
});
|
|
1135
1345
|
}
|
|
1136
|
-
function
|
|
1346
|
+
function qn({ ...e }) {
|
|
1137
1347
|
return /* @__PURE__ */ P(q.Sub, {
|
|
1138
1348
|
"data-slot": "dropdown-menu-sub",
|
|
1139
1349
|
...e
|
|
1140
1350
|
});
|
|
1141
1351
|
}
|
|
1142
|
-
function
|
|
1352
|
+
function Jn({ className: e, inset: t, children: n, ...r }) {
|
|
1143
1353
|
return /* @__PURE__ */ F(q.SubTrigger, {
|
|
1144
1354
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
1145
1355
|
"data-inset": t,
|
|
1146
1356
|
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),
|
|
1147
1357
|
...r,
|
|
1148
|
-
children: [n, /* @__PURE__ */ P(
|
|
1358
|
+
children: [n, /* @__PURE__ */ P(oe, { className: "ml-auto size-4" })]
|
|
1149
1359
|
});
|
|
1150
1360
|
}
|
|
1151
|
-
function
|
|
1361
|
+
function Yn({ className: e, ...t }) {
|
|
1152
1362
|
return /* @__PURE__ */ P(q.SubContent, {
|
|
1153
1363
|
"data-slot": "dropdown-menu-sub-content",
|
|
1154
1364
|
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),
|
|
@@ -1156,31 +1366,31 @@ function Bn({ className: e, ...t }) {
|
|
|
1156
1366
|
});
|
|
1157
1367
|
}
|
|
1158
1368
|
// src/components/FileUpload/GoogleDrivePicker.tsx
|
|
1159
|
-
var
|
|
1160
|
-
function
|
|
1369
|
+
var Xn = () => window.gapi, Zn = () => window.google, Qn = null;
|
|
1370
|
+
function $n(e) {
|
|
1161
1371
|
return new Promise((t, n) => {
|
|
1162
1372
|
let r = document.createElement("script");
|
|
1163
1373
|
r.src = e, r.async = !0, r.onload = () => t(), r.onerror = () => n(/* @__PURE__ */ Error(`Failed to load ${e}`)), document.body.appendChild(r);
|
|
1164
1374
|
});
|
|
1165
1375
|
}
|
|
1166
|
-
function
|
|
1167
|
-
if (
|
|
1168
|
-
if (!
|
|
1169
|
-
let e = (
|
|
1170
|
-
|
|
1171
|
-
|
|
1376
|
+
function er() {
|
|
1377
|
+
if (Xn() && Zn()?.picker) return Promise.resolve();
|
|
1378
|
+
if (!Qn) {
|
|
1379
|
+
let e = (Xn() ? Promise.resolve() : $n("https://apis.google.com/js/api.js")).then(() => new Promise((e) => Xn().load("client:picker", () => e()))), t = Zn()?.picker ? Promise.resolve() : $n("https://www.google.com/jsapi");
|
|
1380
|
+
Qn = Promise.all([e, t]).then(() => void 0), Qn.catch(() => {
|
|
1381
|
+
Qn = null;
|
|
1172
1382
|
});
|
|
1173
1383
|
}
|
|
1174
|
-
return
|
|
1384
|
+
return Qn;
|
|
1175
1385
|
}
|
|
1176
|
-
var
|
|
1386
|
+
var tr = () => ({ openPicker: async (e, n, r) => {
|
|
1177
1387
|
try {
|
|
1178
|
-
await
|
|
1388
|
+
await er();
|
|
1179
1389
|
} catch {
|
|
1180
1390
|
r?.("Google Picker API could not be loaded. Please try again.");
|
|
1181
1391
|
return;
|
|
1182
1392
|
}
|
|
1183
|
-
let i =
|
|
1393
|
+
let i = Zn();
|
|
1184
1394
|
if (!i?.picker) r?.("Google Picker API not loaded yet. Please try again.");
|
|
1185
1395
|
else try {
|
|
1186
1396
|
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);
|
|
@@ -1195,7 +1405,7 @@ var Kn = () => ({ openPicker: async (e, n, r) => {
|
|
|
1195
1405
|
}
|
|
1196
1406
|
} });
|
|
1197
1407
|
// src/icons/IconSearchWeb.tsx
|
|
1198
|
-
function
|
|
1408
|
+
function nr(e) {
|
|
1199
1409
|
return /* @__PURE__ */ F("svg", {
|
|
1200
1410
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1201
1411
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
@@ -1236,7 +1446,7 @@ function qn(e) {
|
|
|
1236
1446
|
});
|
|
1237
1447
|
}
|
|
1238
1448
|
// src/icons/IconSearchNews.tsx
|
|
1239
|
-
function
|
|
1449
|
+
function rr(e) {
|
|
1240
1450
|
return /* @__PURE__ */ F("svg", {
|
|
1241
1451
|
version: "1.1",
|
|
1242
1452
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1311,7 +1521,7 @@ function Jn(e) {
|
|
|
1311
1521
|
});
|
|
1312
1522
|
}
|
|
1313
1523
|
// src/icons/IconSearchVideos.tsx
|
|
1314
|
-
function
|
|
1524
|
+
function ir(e) {
|
|
1315
1525
|
return /* @__PURE__ */ F("svg", {
|
|
1316
1526
|
version: "1.1",
|
|
1317
1527
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1551,7 +1761,7 @@ function Yn(e) {
|
|
|
1551
1761
|
});
|
|
1552
1762
|
}
|
|
1553
1763
|
// src/icons/IconSearchImages.tsx
|
|
1554
|
-
function
|
|
1764
|
+
function ar(e) {
|
|
1555
1765
|
return /* @__PURE__ */ P("svg", {
|
|
1556
1766
|
width: "800px",
|
|
1557
1767
|
height: "800px",
|
|
@@ -1615,7 +1825,7 @@ function Xn(e) {
|
|
|
1615
1825
|
});
|
|
1616
1826
|
}
|
|
1617
1827
|
// src/icons/IconSearchAcademic.tsx
|
|
1618
|
-
function
|
|
1828
|
+
function or(e) {
|
|
1619
1829
|
return /* @__PURE__ */ F("svg", {
|
|
1620
1830
|
width: "800px",
|
|
1621
1831
|
height: "800px",
|
|
@@ -1660,7 +1870,7 @@ function Zn(e) {
|
|
|
1660
1870
|
});
|
|
1661
1871
|
}
|
|
1662
1872
|
// src/icons/IconSearchFiles.tsx
|
|
1663
|
-
function
|
|
1873
|
+
function sr(e) {
|
|
1664
1874
|
return /* @__PURE__ */ F("svg", {
|
|
1665
1875
|
height: "800px",
|
|
1666
1876
|
width: "800px",
|
|
@@ -1712,7 +1922,7 @@ function Qn(e) {
|
|
|
1712
1922
|
});
|
|
1713
1923
|
}
|
|
1714
1924
|
// src/icons/IconSearchTech.tsx
|
|
1715
|
-
function
|
|
1925
|
+
function cr(e) {
|
|
1716
1926
|
return /* @__PURE__ */ F("svg", {
|
|
1717
1927
|
height: "800px",
|
|
1718
1928
|
width: "800px",
|
|
@@ -1838,49 +2048,49 @@ function $n(e) {
|
|
|
1838
2048
|
});
|
|
1839
2049
|
}
|
|
1840
2050
|
// src/components/SearchConfig/categories.ts
|
|
1841
|
-
var
|
|
2051
|
+
var lr = [
|
|
1842
2052
|
{
|
|
1843
2053
|
code: "general",
|
|
1844
|
-
icon:
|
|
2054
|
+
icon: nr,
|
|
1845
2055
|
name: "Web"
|
|
1846
2056
|
},
|
|
1847
2057
|
{
|
|
1848
2058
|
code: "news",
|
|
1849
|
-
icon:
|
|
2059
|
+
icon: rr,
|
|
1850
2060
|
name: "News"
|
|
1851
2061
|
},
|
|
1852
2062
|
{
|
|
1853
2063
|
code: "videos",
|
|
1854
|
-
icon:
|
|
2064
|
+
icon: ir,
|
|
1855
2065
|
name: "Videos"
|
|
1856
2066
|
},
|
|
1857
2067
|
{
|
|
1858
2068
|
code: "images",
|
|
1859
|
-
icon:
|
|
2069
|
+
icon: ar,
|
|
1860
2070
|
name: "Images"
|
|
1861
2071
|
},
|
|
1862
2072
|
{
|
|
1863
2073
|
code: "science",
|
|
1864
|
-
icon:
|
|
2074
|
+
icon: or,
|
|
1865
2075
|
name: "Academic"
|
|
1866
2076
|
},
|
|
1867
2077
|
{
|
|
1868
2078
|
code: "files",
|
|
1869
|
-
icon:
|
|
2079
|
+
icon: sr,
|
|
1870
2080
|
name: "Files"
|
|
1871
2081
|
},
|
|
1872
2082
|
{
|
|
1873
2083
|
code: "it",
|
|
1874
|
-
icon:
|
|
2084
|
+
icon: cr,
|
|
1875
2085
|
name: "Tech"
|
|
1876
2086
|
}
|
|
1877
|
-
],
|
|
2087
|
+
], ur = () => {
|
|
1878
2088
|
let { chatModelProvider: e, setChatModelProvider: t } = u(), [n, r] = O([]), [i, a] = O(!0), o = j();
|
|
1879
2089
|
T(() => {
|
|
1880
2090
|
(async () => {
|
|
1881
2091
|
try {
|
|
1882
2092
|
a(!0);
|
|
1883
|
-
let { data: n } = await
|
|
2093
|
+
let { data: n } = await yt(), i = n?.providers ?? [];
|
|
1884
2094
|
if (r(i), !e.key && i.length > 0) {
|
|
1885
2095
|
let e = localStorage.getItem("chatModelKey"), n = localStorage.getItem("chatModelProviderId");
|
|
1886
2096
|
if (e && n) t({
|
|
@@ -1915,17 +2125,17 @@ var er = [
|
|
|
1915
2125
|
key: n
|
|
1916
2126
|
}), localStorage.setItem("chatModelProviderId", e), localStorage.setItem("chatModelKey", n);
|
|
1917
2127
|
};
|
|
1918
|
-
return /* @__PURE__ */ F(
|
|
2128
|
+
return /* @__PURE__ */ F(qn, { children: [/* @__PURE__ */ F(Jn, {
|
|
1919
2129
|
className: "gap-2",
|
|
1920
2130
|
children: [
|
|
1921
|
-
/* @__PURE__ */ P(
|
|
2131
|
+
/* @__PURE__ */ P(fe, { className: "w-4 h-4 flex-shrink-0 text-sky-500" }),
|
|
1922
2132
|
/* @__PURE__ */ P("span", { children: "Model" }),
|
|
1923
2133
|
/* @__PURE__ */ P("span", {
|
|
1924
2134
|
className: "ml-auto text-xs text-muted-foreground truncate max-w-[55px]",
|
|
1925
2135
|
children: s
|
|
1926
2136
|
})
|
|
1927
2137
|
]
|
|
1928
|
-
}), /* @__PURE__ */ F(
|
|
2138
|
+
}), /* @__PURE__ */ F(Yn, {
|
|
1929
2139
|
className: "w-52 max-h-[400px] overflow-y-auto",
|
|
1930
2140
|
children: [
|
|
1931
2141
|
i ? /* @__PURE__ */ P("div", {
|
|
@@ -1935,7 +2145,7 @@ var er = [
|
|
|
1935
2145
|
className: "px-3 py-2 text-xs text-muted-foreground",
|
|
1936
2146
|
children: "No models configured"
|
|
1937
2147
|
}) : n.map((t, r) => /* @__PURE__ */ F("div", { children: [
|
|
1938
|
-
/* @__PURE__ */ P(
|
|
2148
|
+
/* @__PURE__ */ P(Kn, {
|
|
1939
2149
|
className: "text-[10px] uppercase tracking-wider text-muted-foreground font-medium",
|
|
1940
2150
|
children: t.name
|
|
1941
2151
|
}),
|
|
@@ -1943,7 +2153,7 @@ var er = [
|
|
|
1943
2153
|
onSelect: () => c(t.id, n.key),
|
|
1944
2154
|
className: h("gap-2", e?.providerId === t.id && e?.key === n.key && "bg-secondary"),
|
|
1945
2155
|
children: [
|
|
1946
|
-
/* @__PURE__ */ P(
|
|
2156
|
+
/* @__PURE__ */ P(fe, { 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") }),
|
|
1947
2157
|
/* @__PURE__ */ P("span", {
|
|
1948
2158
|
className: "truncate",
|
|
1949
2159
|
children: n.name
|
|
@@ -1968,13 +2178,13 @@ var er = [
|
|
|
1968
2178
|
/* @__PURE__ */ F(X, {
|
|
1969
2179
|
onSelect: () => o.push("/settings?section=models"),
|
|
1970
2180
|
className: "gap-2",
|
|
1971
|
-
children: [/* @__PURE__ */ P(
|
|
2181
|
+
children: [/* @__PURE__ */ P(Ve, { className: "h-3.5 w-3.5 text-sky-500 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Add model" })]
|
|
1972
2182
|
})
|
|
1973
2183
|
]
|
|
1974
2184
|
})] });
|
|
1975
2185
|
};
|
|
1976
2186
|
// src/components/ChatHistoryDropdown/useRecentChats.ts
|
|
1977
|
-
function
|
|
2187
|
+
function dr(e) {
|
|
1978
2188
|
let t = e.messages?.[e.messages.length - 1], n = t && "createdAt" in t ? t.createdAt : void 0;
|
|
1979
2189
|
if (n) {
|
|
1980
2190
|
let e = new Date(n).getTime();
|
|
@@ -1982,27 +2192,27 @@ function nr(e) {
|
|
|
1982
2192
|
}
|
|
1983
2193
|
return e.createdAt;
|
|
1984
2194
|
}
|
|
1985
|
-
var
|
|
1986
|
-
function
|
|
2195
|
+
var fr = (e) => new Date(e.lastMessageAt || e.createdAt).getTime();
|
|
2196
|
+
function pr() {
|
|
1987
2197
|
return Y().map((e) => ({
|
|
1988
2198
|
...e,
|
|
1989
2199
|
messageCount: e.messages?.filter((e) => e.role === "user").length ?? 0,
|
|
1990
|
-
lastMessageAt:
|
|
2200
|
+
lastMessageAt: dr(e)
|
|
1991
2201
|
}));
|
|
1992
2202
|
}
|
|
1993
|
-
function
|
|
2203
|
+
function mr(e = 10) {
|
|
1994
2204
|
let [t, r] = O([]), [i, a] = O(!1), { isAuthenticated: o, isLoading: s } = n(), c = D(!1), l = C(async (e = !1) => {
|
|
1995
2205
|
if (!s && (!c.current || e)) {
|
|
1996
2206
|
c.current = !0, a(!0);
|
|
1997
2207
|
try {
|
|
1998
2208
|
if (o) {
|
|
1999
|
-
let { data: e, error: t } = await
|
|
2209
|
+
let { data: e, error: t } = await vt();
|
|
2000
2210
|
if (t) {
|
|
2001
|
-
r(
|
|
2211
|
+
r(pr());
|
|
2002
2212
|
return;
|
|
2003
2213
|
}
|
|
2004
2214
|
r(Array.isArray(e?.chats) ? e.chats : []);
|
|
2005
|
-
} else r(
|
|
2215
|
+
} else r(pr());
|
|
2006
2216
|
} catch (e) {
|
|
2007
2217
|
console.error("Failed to fetch recent chats:", e), r([]);
|
|
2008
2218
|
} finally {
|
|
@@ -2011,13 +2221,13 @@ function ar(e = 10) {
|
|
|
2011
2221
|
}
|
|
2012
2222
|
}, [o, s]);
|
|
2013
2223
|
return {
|
|
2014
|
-
recentChats: [...t].sort((e, t) =>
|
|
2224
|
+
recentChats: [...t].sort((e, t) => fr(t) - fr(e)).slice(0, e),
|
|
2015
2225
|
loading: i,
|
|
2016
2226
|
load: l
|
|
2017
2227
|
};
|
|
2018
2228
|
}
|
|
2019
2229
|
// src/lib/relative-time.ts
|
|
2020
|
-
function
|
|
2230
|
+
function hr(e) {
|
|
2021
2231
|
let t = new Date(e).getTime();
|
|
2022
2232
|
if (Number.isNaN(t)) return "";
|
|
2023
2233
|
let n = Math.round((Date.now() - t) / 1e3);
|
|
@@ -2037,28 +2247,28 @@ function or(e) {
|
|
|
2037
2247
|
return `${c} year${c === 1 ? "" : "s"}`;
|
|
2038
2248
|
}
|
|
2039
2249
|
// src/components/ChatHistoryDropdown/HistorySubmenu.tsx
|
|
2040
|
-
var
|
|
2041
|
-
let e = j(), { incognito: n, setIncognito: r } = u(), { recentChats: i, loading: a, load: o } =
|
|
2250
|
+
var gr = 10, _r = () => {
|
|
2251
|
+
let e = j(), { incognito: n, setIncognito: r } = u(), { recentChats: i, loading: a, load: o } = mr(gr), s = (e) => {
|
|
2042
2252
|
r(e), G.success(e ? "Private mode on — messages won't be saved" : "Private mode off");
|
|
2043
2253
|
}, c = (n) => {
|
|
2044
2254
|
t.onOpenChat?.(n) || e.push(`/c/${n}`);
|
|
2045
2255
|
};
|
|
2046
|
-
return /* @__PURE__ */ F(
|
|
2256
|
+
return /* @__PURE__ */ F(qn, {
|
|
2047
2257
|
onOpenChange: (e) => {
|
|
2048
2258
|
e && o();
|
|
2049
2259
|
},
|
|
2050
|
-
children: [/* @__PURE__ */ F(
|
|
2260
|
+
children: [/* @__PURE__ */ F(Jn, {
|
|
2051
2261
|
className: "gap-2",
|
|
2052
|
-
children: [/* @__PURE__ */ P(
|
|
2053
|
-
}), /* @__PURE__ */ F(
|
|
2262
|
+
children: [/* @__PURE__ */ P(Te, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "History" })]
|
|
2263
|
+
}), /* @__PURE__ */ F(Yn, {
|
|
2054
2264
|
className: "w-64 max-h-[70vh] overflow-y-auto",
|
|
2055
2265
|
children: [
|
|
2056
|
-
/* @__PURE__ */ F(
|
|
2266
|
+
/* @__PURE__ */ F(Gn, {
|
|
2057
2267
|
checked: n,
|
|
2058
2268
|
onCheckedChange: s,
|
|
2059
2269
|
onSelect: (e) => e.preventDefault(),
|
|
2060
2270
|
className: "gap-2",
|
|
2061
|
-
children: [/* @__PURE__ */ P(
|
|
2271
|
+
children: [/* @__PURE__ */ P(he, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "Private" })]
|
|
2062
2272
|
}),
|
|
2063
2273
|
/* @__PURE__ */ P(Z, {}),
|
|
2064
2274
|
a ? /* @__PURE__ */ F(X, {
|
|
@@ -2072,7 +2282,7 @@ var sr = 10, cr = () => {
|
|
|
2072
2282
|
children: "No recent chats"
|
|
2073
2283
|
})
|
|
2074
2284
|
}) : i.map((e) => {
|
|
2075
|
-
let t =
|
|
2285
|
+
let t = hr(e.lastMessageAt || e.createdAt);
|
|
2076
2286
|
return /* @__PURE__ */ F(X, {
|
|
2077
2287
|
onSelect: () => c(e.id),
|
|
2078
2288
|
className: "gap-2",
|
|
@@ -2090,15 +2300,15 @@ var sr = 10, cr = () => {
|
|
|
2090
2300
|
/* @__PURE__ */ F(X, {
|
|
2091
2301
|
onSelect: () => e.push("/library"),
|
|
2092
2302
|
className: "gap-2",
|
|
2093
|
-
children: [/* @__PURE__ */ P(
|
|
2303
|
+
children: [/* @__PURE__ */ P(Te, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "All history" })]
|
|
2094
2304
|
})
|
|
2095
2305
|
]
|
|
2096
2306
|
})]
|
|
2097
2307
|
});
|
|
2098
|
-
},
|
|
2099
|
-
function
|
|
2308
|
+
}, vr = /* @__PURE__ */ new Map();
|
|
2309
|
+
function yr(e) {
|
|
2100
2310
|
if (typeof window > "u") return Promise.reject(/* @__PURE__ */ Error("CDN scripts require a browser environment"));
|
|
2101
|
-
let t =
|
|
2311
|
+
let t = vr.get(e);
|
|
2102
2312
|
if (t) return t;
|
|
2103
2313
|
let n = new Promise((t, n) => {
|
|
2104
2314
|
let r = document.querySelector(`script[data-cdn-loader="${e}"]`);
|
|
@@ -2110,34 +2320,34 @@ function ur(e) {
|
|
|
2110
2320
|
i.src = e, i.async = !0, i.dataset.cdnLoader = e, i.onload = () => {
|
|
2111
2321
|
i.dataset.loaded = "true", t();
|
|
2112
2322
|
}, i.onerror = () => {
|
|
2113
|
-
|
|
2323
|
+
vr.delete(e), n(/* @__PURE__ */ Error(`Failed to load ${e}`));
|
|
2114
2324
|
}, document.head.appendChild(i);
|
|
2115
2325
|
});
|
|
2116
|
-
return
|
|
2326
|
+
return vr.set(e, n), n;
|
|
2117
2327
|
}
|
|
2118
|
-
var
|
|
2119
|
-
async function
|
|
2120
|
-
await
|
|
2328
|
+
var br = "https://cdn.jsdelivr.net/npm/jspdf@2.5.2/dist/jspdf.umd.min.js", xr = "https://cdn.jsdelivr.net/npm/docx@9.5.1/build/index.umd.min.js";
|
|
2329
|
+
async function Sr() {
|
|
2330
|
+
await yr(br);
|
|
2121
2331
|
let e = window.jspdf?.jsPDF;
|
|
2122
2332
|
if (!e) throw Error("jsPDF global not found after CDN load");
|
|
2123
2333
|
return e;
|
|
2124
2334
|
}
|
|
2125
|
-
async function
|
|
2126
|
-
await
|
|
2335
|
+
async function Cr() {
|
|
2336
|
+
await yr(xr);
|
|
2127
2337
|
let e = window.docx;
|
|
2128
2338
|
if (!e) throw Error("docx global not found after CDN load");
|
|
2129
2339
|
return e;
|
|
2130
2340
|
}
|
|
2131
2341
|
// src/lib/export.ts
|
|
2132
|
-
async function
|
|
2342
|
+
async function wr(e, t) {
|
|
2133
2343
|
let { default: n } = await import("turndown");
|
|
2134
|
-
|
|
2344
|
+
Or(`# ${e}\n\n${new n({
|
|
2135
2345
|
headingStyle: "atx",
|
|
2136
2346
|
codeBlockStyle: "fenced"
|
|
2137
2347
|
}).turndown(t)}`, `${e}.md`, "text/markdown");
|
|
2138
2348
|
}
|
|
2139
|
-
async function
|
|
2140
|
-
let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await
|
|
2349
|
+
async function Tr(e, t) {
|
|
2350
|
+
let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await Cr(), s = new DOMParser().parseFromString(t, "text/html"), c = [];
|
|
2141
2351
|
c.push(new r({
|
|
2142
2352
|
text: e,
|
|
2143
2353
|
heading: a.HEADING_1,
|
|
@@ -2211,14 +2421,14 @@ async function gr(e, t) {
|
|
|
2211
2421
|
}] }), d = await o.toBlob(u), f = URL.createObjectURL(d), p = document.createElement("a");
|
|
2212
2422
|
p.href = f, p.download = `${e}.docx`, p.click(), URL.revokeObjectURL(f);
|
|
2213
2423
|
}
|
|
2214
|
-
async function
|
|
2424
|
+
async function Er(e, t) {
|
|
2215
2425
|
let n = document.createElement("div");
|
|
2216
2426
|
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 = `
|
|
2217
2427
|
<h1 style="font-size: 24pt; margin-bottom: 20px;">${e}</h1>
|
|
2218
2428
|
${t}
|
|
2219
2429
|
`, document.body.appendChild(n);
|
|
2220
2430
|
try {
|
|
2221
|
-
let [t, { default: r }] = await Promise.all([
|
|
2431
|
+
let [t, { default: r }] = await Promise.all([Sr(), import("html2canvas")]), i = await r(n, {
|
|
2222
2432
|
scale: 2,
|
|
2223
2433
|
useCORS: !0,
|
|
2224
2434
|
logging: !1
|
|
@@ -2233,7 +2443,7 @@ async function _r(e, t) {
|
|
|
2233
2443
|
document.body.removeChild(n);
|
|
2234
2444
|
}
|
|
2235
2445
|
}
|
|
2236
|
-
async function
|
|
2446
|
+
async function Dr(e, t) {
|
|
2237
2447
|
try {
|
|
2238
2448
|
let { default: n } = await import("turndown"), r = `${e}\n\n${new n().turndown(t)}`;
|
|
2239
2449
|
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.");
|
|
@@ -2241,12 +2451,12 @@ async function vr(e, t) {
|
|
|
2241
2451
|
console.error("Failed to export to Google Docs:", e), alert("Failed to copy content to clipboard. Please try again.");
|
|
2242
2452
|
}
|
|
2243
2453
|
}
|
|
2244
|
-
function
|
|
2454
|
+
function Or(e, t, n) {
|
|
2245
2455
|
let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
2246
2456
|
a.href = i, a.download = t, a.click(), URL.revokeObjectURL(i);
|
|
2247
2457
|
}
|
|
2248
2458
|
// src/components/FileUpload/FileUploadDropdown.tsx
|
|
2249
|
-
var
|
|
2459
|
+
var kr = [
|
|
2250
2460
|
{
|
|
2251
2461
|
label: "5s",
|
|
2252
2462
|
value: 5
|
|
@@ -2271,28 +2481,28 @@ var br = [
|
|
|
2271
2481
|
label: "Unlimited",
|
|
2272
2482
|
value: 0
|
|
2273
2483
|
}
|
|
2274
|
-
],
|
|
2484
|
+
], Ar = [
|
|
2275
2485
|
"pdf",
|
|
2276
2486
|
"docx",
|
|
2277
2487
|
"txt",
|
|
2278
2488
|
"md",
|
|
2279
2489
|
"html",
|
|
2280
2490
|
"htm"
|
|
2281
|
-
],
|
|
2282
|
-
let i = j(), { category: a, setCategory: o, sections: s, chatId: c } = u(), { isAuthenticated: l } = n(), d = a ? a.split(",").filter(Boolean) : ["general"], f =
|
|
2491
|
+
], jr = /* @__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("."), Mr = ({ onFileSelect: e, disabled: r = !1 }) => {
|
|
2492
|
+
let i = j(), { category: a, setCategory: o, sections: s, chatId: c } = u(), { isAuthenticated: l } = n(), d = a ? a.split(",").filter(Boolean) : ["general"], f = lr.find((e) => e.code === d[0]) || lr[0], p = (e) => {
|
|
2283
2493
|
let t = a ? a.split(",").filter(Boolean) : ["general"], n = t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
|
|
2284
2494
|
o(n.length > 0 ? n.join(",") : "general");
|
|
2285
2495
|
}, [m, g] = O(!1), [_, y] = O(!1), [b, x] = O(!1), [S, C] = O(!1), [w, E] = O(() => {
|
|
2286
2496
|
if (typeof window > "u") return 5;
|
|
2287
2497
|
let e = Number(localStorage.getItem("thinkingTimeLimit") ?? "5");
|
|
2288
2498
|
return Number.isFinite(e) ? e : 5;
|
|
2289
|
-
}), D = v.useRef(null), { openPicker: k } =
|
|
2499
|
+
}), D = v.useRef(null), { openPicker: k } = tr();
|
|
2290
2500
|
T(() => {
|
|
2291
2501
|
A();
|
|
2292
2502
|
}, []);
|
|
2293
2503
|
let A = async () => {
|
|
2294
2504
|
try {
|
|
2295
|
-
let { data: e } = await
|
|
2505
|
+
let { data: e } = await _t();
|
|
2296
2506
|
g(e?.isConnected || !1);
|
|
2297
2507
|
} catch {}
|
|
2298
2508
|
}, M = (e) => {
|
|
@@ -2330,8 +2540,8 @@ var br = [
|
|
|
2330
2540
|
let n = [];
|
|
2331
2541
|
for await (let r of e.values()) if (r.kind === "file") {
|
|
2332
2542
|
let e = await r.getFile(), i = e.name.split(".").pop()?.toLowerCase() ?? "";
|
|
2333
|
-
if (
|
|
2334
|
-
else if (
|
|
2543
|
+
if (Ar.includes(i)) n.push(e);
|
|
2544
|
+
else if (jr.includes(i)) try {
|
|
2335
2545
|
let r = await e.text(), i = t ? `${t}/${e.name}` : e.name;
|
|
2336
2546
|
n.push(new File([r], `${i.replace(/[/\\]/g, "_")}.txt`, { type: "text/plain" }));
|
|
2337
2547
|
} catch {}
|
|
@@ -2358,7 +2568,7 @@ var br = [
|
|
|
2358
2568
|
}, z = async () => {
|
|
2359
2569
|
y(!0);
|
|
2360
2570
|
try {
|
|
2361
|
-
let { data: e } = await
|
|
2571
|
+
let { data: e } = await gt();
|
|
2362
2572
|
if (e?.success && e?.data?.authUrl) {
|
|
2363
2573
|
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) => {
|
|
2364
2574
|
e.data.type === "google-drive-connected" && (g(!0), i?.close(), window.removeEventListener("message", a));
|
|
@@ -2372,14 +2582,14 @@ var br = [
|
|
|
2372
2582
|
}
|
|
2373
2583
|
}, B = async () => {
|
|
2374
2584
|
try {
|
|
2375
|
-
let { data: t } = await
|
|
2585
|
+
let { data: t } = await ht();
|
|
2376
2586
|
if (!t?.success || !t.accessToken) throw Error("Failed to get access token");
|
|
2377
2587
|
await k(t.accessToken, async (t) => {
|
|
2378
2588
|
x(!0);
|
|
2379
2589
|
try {
|
|
2380
2590
|
let n = [];
|
|
2381
2591
|
for (let e of t) {
|
|
2382
|
-
let { data: t } = await
|
|
2592
|
+
let { data: t } = await mt({ query: { fileId: e.id } });
|
|
2383
2593
|
if (t?.success && t?.file) {
|
|
2384
2594
|
let e = atob(t.file.content), r = new Uint8Array(e.length);
|
|
2385
2595
|
for (let t = 0; t < e.length; t++) r[t] = e.charCodeAt(t);
|
|
@@ -2398,32 +2608,32 @@ var br = [
|
|
|
2398
2608
|
} catch (e) {
|
|
2399
2609
|
alert(e.message || "Failed to open Google Drive picker");
|
|
2400
2610
|
}
|
|
2401
|
-
}, V =
|
|
2611
|
+
}, V = kr.find((e) => e.value === w)?.label ?? "Unlimited";
|
|
2402
2612
|
return /* @__PURE__ */ F(N, { children: [
|
|
2403
2613
|
/* @__PURE__ */ F("div", {
|
|
2404
2614
|
className: "relative flex shrink min-w-8 !shrink-0 group",
|
|
2405
|
-
children: [/* @__PURE__ */ F(
|
|
2615
|
+
children: [/* @__PURE__ */ F(Hn, { children: [/* @__PURE__ */ P(Un, {
|
|
2406
2616
|
asChild: !0,
|
|
2407
2617
|
children: /* @__PURE__ */ P("button", {
|
|
2408
2618
|
disabled: r,
|
|
2409
2619
|
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",
|
|
2410
2620
|
type: "button",
|
|
2411
2621
|
"aria-label": "Search options",
|
|
2412
|
-
children: /* @__PURE__ */ P(
|
|
2622
|
+
children: /* @__PURE__ */ P(Ke, { className: "w-5 h-5" })
|
|
2413
2623
|
})
|
|
2414
|
-
}), /* @__PURE__ */ F(
|
|
2624
|
+
}), /* @__PURE__ */ F(Wn, {
|
|
2415
2625
|
align: "start",
|
|
2416
2626
|
side: "top",
|
|
2417
2627
|
sideOffset: 8,
|
|
2418
2628
|
className: "w-44",
|
|
2419
2629
|
children: [
|
|
2420
|
-
/* @__PURE__ */ F(
|
|
2630
|
+
/* @__PURE__ */ F(qn, { children: [/* @__PURE__ */ F(Jn, {
|
|
2421
2631
|
className: "gap-2",
|
|
2422
2632
|
children: [f && /* @__PURE__ */ P(f.icon, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Category" })]
|
|
2423
|
-
}), /* @__PURE__ */ F(
|
|
2633
|
+
}), /* @__PURE__ */ F(Yn, {
|
|
2424
2634
|
className: "w-44",
|
|
2425
2635
|
children: [
|
|
2426
|
-
/* @__PURE__ */ F(
|
|
2636
|
+
/* @__PURE__ */ F(Gn, {
|
|
2427
2637
|
checked: d.length === 0,
|
|
2428
2638
|
onCheckedChange: () => o("general"),
|
|
2429
2639
|
onSelect: (e) => e.preventDefault(),
|
|
@@ -2431,7 +2641,7 @@ var br = [
|
|
|
2431
2641
|
children: [/* @__PURE__ */ P("div", { className: "w-3.5 h-3.5 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "None" })]
|
|
2432
2642
|
}),
|
|
2433
2643
|
/* @__PURE__ */ P(Z, {}),
|
|
2434
|
-
|
|
2644
|
+
lr.map((e) => /* @__PURE__ */ F(Gn, {
|
|
2435
2645
|
checked: d.includes(e.code),
|
|
2436
2646
|
onCheckedChange: () => p(e.code),
|
|
2437
2647
|
onSelect: (e) => e.preventDefault(),
|
|
@@ -2440,19 +2650,19 @@ var br = [
|
|
|
2440
2650
|
}, e.code))
|
|
2441
2651
|
]
|
|
2442
2652
|
})] }),
|
|
2443
|
-
/* @__PURE__ */ F(
|
|
2653
|
+
/* @__PURE__ */ F(qn, { children: [/* @__PURE__ */ F(Jn, {
|
|
2444
2654
|
className: "gap-2",
|
|
2445
2655
|
children: [
|
|
2446
|
-
/* @__PURE__ */ P(
|
|
2656
|
+
/* @__PURE__ */ P(ce, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }),
|
|
2447
2657
|
/* @__PURE__ */ P("span", { children: "Speed" }),
|
|
2448
2658
|
/* @__PURE__ */ P("span", {
|
|
2449
2659
|
className: "ml-auto text-xs text-muted-foreground",
|
|
2450
2660
|
children: V
|
|
2451
2661
|
})
|
|
2452
2662
|
]
|
|
2453
|
-
}), /* @__PURE__ */ P(
|
|
2663
|
+
}), /* @__PURE__ */ P(Yn, {
|
|
2454
2664
|
className: "w-36",
|
|
2455
|
-
children:
|
|
2665
|
+
children: kr.map((e) => /* @__PURE__ */ F(X, {
|
|
2456
2666
|
onSelect: () => M(e.value),
|
|
2457
2667
|
className: h("justify-between", w === e.value && "bg-secondary"),
|
|
2458
2668
|
children: [/* @__PURE__ */ P("span", { children: e.label }), w === e.value && /* @__PURE__ */ P("svg", {
|
|
@@ -2470,27 +2680,27 @@ var br = [
|
|
|
2470
2680
|
}, e.value))
|
|
2471
2681
|
})] }),
|
|
2472
2682
|
/* @__PURE__ */ P(Z, {}),
|
|
2473
|
-
/* @__PURE__ */ P(
|
|
2683
|
+
/* @__PURE__ */ P(ur, {}),
|
|
2474
2684
|
/* @__PURE__ */ P(Z, {}),
|
|
2475
|
-
/* @__PURE__ */ F(
|
|
2685
|
+
/* @__PURE__ */ F(qn, { children: [/* @__PURE__ */ F(Jn, {
|
|
2476
2686
|
className: "gap-2",
|
|
2477
|
-
children: [/* @__PURE__ */ P(
|
|
2478
|
-
}), /* @__PURE__ */ F(
|
|
2687
|
+
children: [/* @__PURE__ */ P(tt, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "Upload" })]
|
|
2688
|
+
}), /* @__PURE__ */ F(Yn, {
|
|
2479
2689
|
className: "w-44",
|
|
2480
2690
|
children: [
|
|
2481
2691
|
/* @__PURE__ */ F(X, {
|
|
2482
2692
|
onSelect: I,
|
|
2483
2693
|
className: "gap-2",
|
|
2484
|
-
children: [/* @__PURE__ */ P(
|
|
2694
|
+
children: [/* @__PURE__ */ P(tt, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Your Device" })]
|
|
2485
2695
|
}),
|
|
2486
2696
|
/* @__PURE__ */ F(X, {
|
|
2487
2697
|
onSelect: R,
|
|
2488
2698
|
disabled: S,
|
|
2489
2699
|
className: "gap-2",
|
|
2490
|
-
children: [S ? /* @__PURE__ */ P(W, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ P(
|
|
2700
|
+
children: [S ? /* @__PURE__ */ P(W, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ P(xe, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: S ? "Scanning…" : "Local Folder" })]
|
|
2491
2701
|
}),
|
|
2492
2702
|
/* @__PURE__ */ P(Z, {}),
|
|
2493
|
-
/* @__PURE__ */ P(
|
|
2703
|
+
/* @__PURE__ */ P(Kn, {
|
|
2494
2704
|
className: "text-xs font-normal text-muted-foreground",
|
|
2495
2705
|
children: "Cloud"
|
|
2496
2706
|
}),
|
|
@@ -2498,20 +2708,20 @@ var br = [
|
|
|
2498
2708
|
onSelect: B,
|
|
2499
2709
|
disabled: b,
|
|
2500
2710
|
className: "gap-2",
|
|
2501
|
-
children: [b ? /* @__PURE__ */ P(W, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ P(
|
|
2711
|
+
children: [b ? /* @__PURE__ */ P(W, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ P(ue, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: b ? "Loading…" : "Google Drive" })]
|
|
2502
2712
|
}) : /* @__PURE__ */ F(X, {
|
|
2503
2713
|
onSelect: z,
|
|
2504
2714
|
disabled: _,
|
|
2505
2715
|
className: "gap-2",
|
|
2506
|
-
children: [_ ? /* @__PURE__ */ P(W, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ P(
|
|
2716
|
+
children: [_ ? /* @__PURE__ */ P(W, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ P(ue, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: _ ? "Connecting…" : "Connect Google Drive" })]
|
|
2507
2717
|
})
|
|
2508
2718
|
]
|
|
2509
2719
|
})] }),
|
|
2510
2720
|
/* @__PURE__ */ P(Z, {}),
|
|
2511
|
-
s.length > 0 && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ F(
|
|
2721
|
+
s.length > 0 && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ F(qn, { children: [/* @__PURE__ */ F(Jn, {
|
|
2512
2722
|
className: "gap-2",
|
|
2513
|
-
children: [/* @__PURE__ */ P(
|
|
2514
|
-
}), /* @__PURE__ */ F(
|
|
2723
|
+
children: [/* @__PURE__ */ P(Ge, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "Share" })]
|
|
2724
|
+
}), /* @__PURE__ */ F(Yn, {
|
|
2515
2725
|
className: "w-48",
|
|
2516
2726
|
children: [
|
|
2517
2727
|
/* @__PURE__ */ F(X, {
|
|
@@ -2519,7 +2729,7 @@ var br = [
|
|
|
2519
2729
|
if (!c) G.error("No chat to share");
|
|
2520
2730
|
else if (!l) G.error("Please sign in to share chats");
|
|
2521
2731
|
else try {
|
|
2522
|
-
let { data: e, error: t } = await
|
|
2732
|
+
let { data: e, error: t } = await St({ body: { chatId: c } });
|
|
2523
2733
|
if (!t && e?.success && e?.data?.shareUrl) await navigator.clipboard.writeText(e.data.shareUrl), G.success("Chat is now public - link copied to clipboard");
|
|
2524
2734
|
else throw Error(t?.error || "Failed to share chat");
|
|
2525
2735
|
} catch (e) {
|
|
@@ -2529,13 +2739,13 @@ var br = [
|
|
|
2529
2739
|
}
|
|
2530
2740
|
},
|
|
2531
2741
|
className: "gap-2",
|
|
2532
|
-
children: [/* @__PURE__ */ P(
|
|
2742
|
+
children: [/* @__PURE__ */ P(Oe, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Copy link" })]
|
|
2533
2743
|
}),
|
|
2534
2744
|
/* @__PURE__ */ F(X, {
|
|
2535
2745
|
onSelect: async () => {
|
|
2536
2746
|
let e = s[0]?.userMessage?.content || "Chat", t = s.map((e) => `## ${e.userMessage.content}\n\n${e.assistantMessage?.content || ""}`).join("\n\n---\n\n");
|
|
2537
2747
|
try {
|
|
2538
|
-
await
|
|
2748
|
+
await lt({ body: {
|
|
2539
2749
|
title: e,
|
|
2540
2750
|
name: e,
|
|
2541
2751
|
content: t,
|
|
@@ -2549,46 +2759,46 @@ var br = [
|
|
|
2549
2759
|
}
|
|
2550
2760
|
},
|
|
2551
2761
|
className: "gap-2",
|
|
2552
|
-
children: [/* @__PURE__ */ P(
|
|
2762
|
+
children: [/* @__PURE__ */ P(H, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Save to QwkDocs" })]
|
|
2553
2763
|
}),
|
|
2554
2764
|
/* @__PURE__ */ P(Z, {}),
|
|
2555
2765
|
/* @__PURE__ */ F(X, {
|
|
2556
2766
|
onSelect: () => {
|
|
2557
|
-
|
|
2767
|
+
wr(s[0]?.userMessage?.content || "Chat", s.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
2558
2768
|
},
|
|
2559
2769
|
className: "gap-2",
|
|
2560
|
-
children: [/* @__PURE__ */ P(
|
|
2770
|
+
children: [/* @__PURE__ */ P(ye, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Export as Markdown" })]
|
|
2561
2771
|
}),
|
|
2562
2772
|
/* @__PURE__ */ F(X, {
|
|
2563
2773
|
onSelect: () => {
|
|
2564
|
-
|
|
2774
|
+
Er(s[0]?.userMessage?.content || "Chat", s.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
2565
2775
|
},
|
|
2566
2776
|
className: "gap-2",
|
|
2567
|
-
children: [/* @__PURE__ */ P(
|
|
2777
|
+
children: [/* @__PURE__ */ P(be, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Export as PDF" })]
|
|
2568
2778
|
}),
|
|
2569
2779
|
/* @__PURE__ */ F(X, {
|
|
2570
2780
|
onSelect: () => {
|
|
2571
|
-
|
|
2781
|
+
Tr(s[0]?.userMessage?.content || "Chat", s.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
2572
2782
|
},
|
|
2573
2783
|
className: "gap-2",
|
|
2574
|
-
children: [/* @__PURE__ */ P(
|
|
2784
|
+
children: [/* @__PURE__ */ P(_e, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Export as DOCX" })]
|
|
2575
2785
|
}),
|
|
2576
2786
|
/* @__PURE__ */ F(X, {
|
|
2577
2787
|
onSelect: () => {
|
|
2578
|
-
|
|
2788
|
+
Dr(s[0]?.userMessage?.content || "Chat", s.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
|
|
2579
2789
|
},
|
|
2580
2790
|
className: "gap-2",
|
|
2581
|
-
children: [/* @__PURE__ */ P(
|
|
2791
|
+
children: [/* @__PURE__ */ P(ve, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ P("span", { children: "Export to Google Docs" })]
|
|
2582
2792
|
})
|
|
2583
2793
|
]
|
|
2584
2794
|
})] }), /* @__PURE__ */ P(Z, {})] }),
|
|
2585
|
-
/* @__PURE__ */ P(
|
|
2795
|
+
/* @__PURE__ */ P(_r, {}),
|
|
2586
2796
|
/* @__PURE__ */ F(X, {
|
|
2587
2797
|
onSelect: () => {
|
|
2588
2798
|
t.onOpenSettings?.() || i.push("/settings");
|
|
2589
2799
|
},
|
|
2590
2800
|
className: "gap-2",
|
|
2591
|
-
children: [/* @__PURE__ */ P(
|
|
2801
|
+
children: [/* @__PURE__ */ P(Ue, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ P("span", { children: "Settings" })]
|
|
2592
2802
|
})
|
|
2593
2803
|
]
|
|
2594
2804
|
})] }), /* @__PURE__ */ P("div", {
|
|
@@ -2607,7 +2817,7 @@ var br = [
|
|
|
2607
2817
|
onClick: I,
|
|
2608
2818
|
"aria-label": "Attach files",
|
|
2609
2819
|
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",
|
|
2610
|
-
children: /* @__PURE__ */ P(
|
|
2820
|
+
children: /* @__PURE__ */ P(Re, { className: "w-[18px] h-[18px]" })
|
|
2611
2821
|
}), /* @__PURE__ */ P("div", {
|
|
2612
2822
|
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",
|
|
2613
2823
|
children: /* @__PURE__ */ P("span", {
|
|
@@ -2626,7 +2836,7 @@ var br = [
|
|
|
2626
2836
|
className: "hidden"
|
|
2627
2837
|
})
|
|
2628
2838
|
] });
|
|
2629
|
-
},
|
|
2839
|
+
}, Nr = 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) => {
|
|
2630
2840
|
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(() => {
|
|
2631
2841
|
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?.();
|
|
2632
2842
|
}, [v]), I = C((e, t, o, s, c) => {
|
|
@@ -2772,10 +2982,10 @@ var br = [
|
|
|
2772
2982
|
})
|
|
2773
2983
|
});
|
|
2774
2984
|
});
|
|
2775
|
-
|
|
2985
|
+
Nr.displayName = "LiveWaveform";
|
|
2776
2986
|
// src/components/MessageComposer/ChatInputBox.tsx
|
|
2777
|
-
var
|
|
2778
|
-
let { data: r, error: i } = await
|
|
2987
|
+
var Pr = async (e, { signal: t, limit: n }) => {
|
|
2988
|
+
let { data: r, error: i } = await ct({
|
|
2779
2989
|
query: {
|
|
2780
2990
|
q: e,
|
|
2781
2991
|
limit: n
|
|
@@ -2786,20 +2996,20 @@ var Tr = async (e, { signal: t, limit: n }) => {
|
|
|
2786
2996
|
suggestions: r?.suggestions ?? [],
|
|
2787
2997
|
domains: r?.domains ?? []
|
|
2788
2998
|
};
|
|
2789
|
-
},
|
|
2999
|
+
}, Fr = [
|
|
2790
3000
|
"What are you curious to research?",
|
|
2791
3001
|
"Search the latest news...",
|
|
2792
3002
|
"Analyze a video, doc, or URL...",
|
|
2793
3003
|
"Find academic research on...",
|
|
2794
3004
|
"Compare products to buy..."
|
|
2795
|
-
],
|
|
3005
|
+
], Ir = {
|
|
2796
3006
|
initial: {},
|
|
2797
3007
|
animate: { transition: { staggerChildren: .025 } },
|
|
2798
3008
|
exit: { transition: {
|
|
2799
3009
|
staggerChildren: .015,
|
|
2800
3010
|
staggerDirection: -1
|
|
2801
3011
|
} }
|
|
2802
|
-
},
|
|
3012
|
+
}, Lr = {
|
|
2803
3013
|
initial: {
|
|
2804
3014
|
opacity: 0,
|
|
2805
3015
|
filter: "blur(12px)",
|
|
@@ -2833,8 +3043,8 @@ var Tr = async (e, { signal: t, limit: n }) => {
|
|
|
2833
3043
|
}
|
|
2834
3044
|
}
|
|
2835
3045
|
}
|
|
2836
|
-
},
|
|
2837
|
-
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 } =
|
|
3046
|
+
}, Rr = ({ onNewChat: e }) => {
|
|
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 } = Vn({
|
|
2838
3048
|
setMessage: f,
|
|
2839
3049
|
contextFiles: i,
|
|
2840
3050
|
contextFileIds: a,
|
|
@@ -2842,7 +3052,7 @@ var Tr = async (e, { signal: t, limit: n }) => {
|
|
|
2842
3052
|
setContextFileIds: s
|
|
2843
3053
|
}), k = () => {
|
|
2844
3054
|
f(""), E(), p.current && (p.current.style.height = "auto");
|
|
2845
|
-
}, A = D(""), j = (e, t) => e && !/\s$/.test(e) ? `${e} ${t}` : `${e}${t}`, { isListening: M, toggleSpeech: N, isSpeechSupported:
|
|
3055
|
+
}, A = D(""), j = (e, t) => e && !/\s$/.test(e) ? `${e} ${t}` : `${e}${t}`, { isListening: M, toggleSpeech: N, isSpeechSupported: R, lastPhrase: z, phraseId: B } = Tn((e) => {
|
|
2846
3056
|
f(() => {
|
|
2847
3057
|
let t = `${j(A.current, e)} `;
|
|
2848
3058
|
return A.current = t, t;
|
|
@@ -2854,40 +3064,40 @@ var Tr = async (e, { signal: t, limit: n }) => {
|
|
|
2854
3064
|
}, { onPartial: (e) => f(e ? j(A.current, e) : A.current) });
|
|
2855
3065
|
T(() => {
|
|
2856
3066
|
M && (A.current = d);
|
|
2857
|
-
}, [M]),
|
|
2858
|
-
isSpeechSupported:
|
|
3067
|
+
}, [M]), Pn({
|
|
3068
|
+
isSpeechSupported: R,
|
|
2859
3069
|
isListening: M,
|
|
2860
3070
|
toggleSpeech: N
|
|
2861
3071
|
});
|
|
2862
|
-
let [
|
|
3072
|
+
let [V, H] = O(0), [ee, te] = O(!0), [U, ne] = O(!1), { handleKeyDown: re, ...ie } = $t({
|
|
2863
3073
|
value: d,
|
|
2864
3074
|
onChange: f,
|
|
2865
3075
|
enabled: U,
|
|
2866
|
-
fetchSuggestions:
|
|
3076
|
+
fetchSuggestions: Pr,
|
|
2867
3077
|
anchorRef: m,
|
|
2868
3078
|
inputRef: p
|
|
2869
3079
|
});
|
|
2870
3080
|
T(() => {
|
|
2871
3081
|
if (U || d) return;
|
|
2872
3082
|
let e = setInterval(() => {
|
|
2873
|
-
|
|
2874
|
-
|
|
3083
|
+
te(!1), setTimeout(() => {
|
|
3084
|
+
H((e) => (e + 1) % Fr.length), te(!0);
|
|
2875
3085
|
}, 400);
|
|
2876
3086
|
}, 3e3);
|
|
2877
3087
|
return () => clearInterval(e);
|
|
2878
3088
|
}, [U, d]), T(() => {
|
|
2879
3089
|
let e = (e) => {
|
|
2880
|
-
m.current && !m.current.contains(e.target) && (d ||
|
|
3090
|
+
m.current && !m.current.contains(e.target) && (d || ne(!1));
|
|
2881
3091
|
};
|
|
2882
3092
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
2883
3093
|
}, [d]), T(() => {
|
|
2884
3094
|
p.current && (p.current.style.height = "auto", p.current.style.height = Math.min(p.current.scrollHeight, 384) + "px");
|
|
2885
3095
|
}, [d]);
|
|
2886
|
-
let
|
|
3096
|
+
let ae = () => {
|
|
2887
3097
|
t || (d.trim() || h.length !== 0 || _.length !== 0) && (n(d), k());
|
|
2888
|
-
},
|
|
2889
|
-
|
|
2890
|
-
},
|
|
3098
|
+
}, oe = (e) => {
|
|
3099
|
+
re(e) || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), ae());
|
|
3100
|
+
}, se = !!(d.trim() || h.length > 0 || _.length > 0);
|
|
2891
3101
|
return /* @__PURE__ */ F("div", {
|
|
2892
3102
|
className: "relative w-full max-w-2xl mx-auto transition-all duration-300 font-sans",
|
|
2893
3103
|
onDragOver: x,
|
|
@@ -2903,21 +3113,21 @@ var Tr = async (e, { signal: t, limit: n }) => {
|
|
|
2903
3113
|
stiffness: 120,
|
|
2904
3114
|
damping: 18
|
|
2905
3115
|
},
|
|
2906
|
-
onClick: () =>
|
|
3116
|
+
onClick: () => ne(!0),
|
|
2907
3117
|
children: [
|
|
2908
3118
|
(h.length > 0 || _.length > 0) && /* @__PURE__ */ F("div", {
|
|
2909
3119
|
className: "flex gap-3 overflow-x-auto custom-scrollbar px-3 pt-3 pb-1",
|
|
2910
|
-
children: [_.map((e) => /* @__PURE__ */ P(
|
|
3120
|
+
children: [_.map((e) => /* @__PURE__ */ P(nn, {
|
|
2911
3121
|
content: e,
|
|
2912
3122
|
onRemove: (e) => v((t) => t.filter((t) => t.id !== e))
|
|
2913
|
-
}, e.id)), h.map((e) => /* @__PURE__ */ P(
|
|
3123
|
+
}, e.id)), h.map((e) => /* @__PURE__ */ P(tn, {
|
|
2914
3124
|
file: e,
|
|
2915
3125
|
onRemove: (e) => g((t) => t.filter((t) => t.id !== e))
|
|
2916
3126
|
}, e.id))]
|
|
2917
3127
|
}),
|
|
2918
3128
|
M && /* @__PURE__ */ P("div", {
|
|
2919
3129
|
className: "px-3 pt-2",
|
|
2920
|
-
children: /* @__PURE__ */ P(
|
|
3130
|
+
children: /* @__PURE__ */ P(Nr, {
|
|
2921
3131
|
active: M,
|
|
2922
3132
|
mode: "static",
|
|
2923
3133
|
height: 48,
|
|
@@ -2929,15 +3139,15 @@ var Tr = async (e, { signal: t, limit: n }) => {
|
|
|
2929
3139
|
className: "w-full rounded-lg"
|
|
2930
3140
|
})
|
|
2931
3141
|
}),
|
|
2932
|
-
/* @__PURE__ */ P(
|
|
2933
|
-
phrase:
|
|
2934
|
-
phraseId:
|
|
3142
|
+
/* @__PURE__ */ P(Tt, {
|
|
3143
|
+
phrase: z,
|
|
3144
|
+
phraseId: B,
|
|
2935
3145
|
visible: M
|
|
2936
3146
|
}),
|
|
2937
3147
|
/* @__PURE__ */ F("div", {
|
|
2938
3148
|
className: "flex items-center gap-2 p-3",
|
|
2939
3149
|
children: [
|
|
2940
|
-
/* @__PURE__ */ P(
|
|
3150
|
+
/* @__PURE__ */ P(Mr, {
|
|
2941
3151
|
onFileSelect: b,
|
|
2942
3152
|
disabled: t
|
|
2943
3153
|
}),
|
|
@@ -2950,8 +3160,8 @@ var Tr = async (e, { signal: t, limit: n }) => {
|
|
|
2950
3160
|
value: d,
|
|
2951
3161
|
onChange: (e) => f(e.target.value),
|
|
2952
3162
|
onPaste: w,
|
|
2953
|
-
onKeyDown:
|
|
2954
|
-
onFocus: () =>
|
|
3163
|
+
onKeyDown: oe,
|
|
3164
|
+
onFocus: () => ne(!0),
|
|
2955
3165
|
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",
|
|
2956
3166
|
rows: 1,
|
|
2957
3167
|
autoFocus: !0,
|
|
@@ -2961,27 +3171,27 @@ var Tr = async (e, { signal: t, limit: n }) => {
|
|
|
2961
3171
|
className: "absolute left-0 top-0 w-full h-full pointer-events-none flex items-center",
|
|
2962
3172
|
children: /* @__PURE__ */ P(I, {
|
|
2963
3173
|
mode: "wait",
|
|
2964
|
-
children:
|
|
3174
|
+
children: ee && !U && !d && /* @__PURE__ */ P(L.span, {
|
|
2965
3175
|
className: "absolute left-0 top-1/2 -translate-y-1/2 text-text-400 select-none pointer-events-none text-[16px] font-normal",
|
|
2966
3176
|
style: {
|
|
2967
3177
|
whiteSpace: "nowrap",
|
|
2968
3178
|
overflow: "hidden",
|
|
2969
3179
|
textOverflow: "ellipsis"
|
|
2970
3180
|
},
|
|
2971
|
-
variants:
|
|
3181
|
+
variants: Ir,
|
|
2972
3182
|
initial: "initial",
|
|
2973
3183
|
animate: "animate",
|
|
2974
3184
|
exit: "exit",
|
|
2975
|
-
children:
|
|
2976
|
-
variants:
|
|
3185
|
+
children: Fr[V].split("").map((e, t) => /* @__PURE__ */ P(L.span, {
|
|
3186
|
+
variants: Lr,
|
|
2977
3187
|
style: { display: "inline-block" },
|
|
2978
3188
|
children: e === " " ? "\xA0" : e
|
|
2979
3189
|
}, t))
|
|
2980
|
-
},
|
|
3190
|
+
}, V)
|
|
2981
3191
|
})
|
|
2982
3192
|
})]
|
|
2983
3193
|
}),
|
|
2984
|
-
|
|
3194
|
+
R && /* @__PURE__ */ F("div", {
|
|
2985
3195
|
className: "relative flex shrink !shrink-0 group",
|
|
2986
3196
|
children: [/* @__PURE__ */ P("button", {
|
|
2987
3197
|
onClick: (e) => {
|
|
@@ -3031,11 +3241,11 @@ var Tr = async (e, { signal: t, limit: n }) => {
|
|
|
3031
3241
|
children: /* @__PURE__ */ P(J.Stop, { className: "w-3.5 h-3.5 fill-current" })
|
|
3032
3242
|
}) : /* @__PURE__ */ P("button", {
|
|
3033
3243
|
onClick: (e) => {
|
|
3034
|
-
e.stopPropagation(),
|
|
3244
|
+
e.stopPropagation(), ae();
|
|
3035
3245
|
},
|
|
3036
|
-
disabled: !
|
|
3246
|
+
disabled: !se,
|
|
3037
3247
|
className: `inline-flex items-center justify-center shrink-0 transition-all duration-200 h-8 w-8 rounded-full active:scale-95
|
|
3038
|
-
${
|
|
3248
|
+
${se ? "bg-accent text-bg-0 hover:bg-accent-hover shadow-md" : "bg-bg-300 text-text-400 cursor-default opacity-50"}
|
|
3039
3249
|
`,
|
|
3040
3250
|
type: "button",
|
|
3041
3251
|
"aria-label": "Send message",
|
|
@@ -3052,7 +3262,7 @@ var Tr = async (e, { signal: t, limit: n }) => {
|
|
|
3052
3262
|
})
|
|
3053
3263
|
]
|
|
3054
3264
|
}),
|
|
3055
|
-
/* @__PURE__ */ P(
|
|
3265
|
+
/* @__PURE__ */ P(qt, { ...ie }),
|
|
3056
3266
|
y && /* @__PURE__ */ F("div", {
|
|
3057
3267
|
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",
|
|
3058
3268
|
children: [/* @__PURE__ */ P(J.Archive, { className: "w-10 h-10 text-accent mb-2 animate-bounce" }), /* @__PURE__ */ P("p", {
|
|
@@ -3062,32 +3272,32 @@ var Tr = async (e, { signal: t, limit: n }) => {
|
|
|
3062
3272
|
})
|
|
3063
3273
|
]
|
|
3064
3274
|
});
|
|
3065
|
-
},
|
|
3275
|
+
}, zr = 200, Br = [
|
|
3066
3276
|
"message",
|
|
3067
3277
|
"error",
|
|
3068
3278
|
"detail"
|
|
3069
3279
|
];
|
|
3070
|
-
function
|
|
3071
|
-
return e.length >
|
|
3280
|
+
function Vr(e) {
|
|
3281
|
+
return e.length > zr ? `${e.slice(0, 199).trimEnd()}…` : e;
|
|
3072
3282
|
}
|
|
3073
|
-
function
|
|
3283
|
+
function Hr(e, t) {
|
|
3074
3284
|
let n = t ? `HTTP ${t}` : "Unknown error";
|
|
3075
3285
|
if (typeof e == "string") {
|
|
3076
3286
|
let t = e.trim();
|
|
3077
|
-
return !t || t.startsWith("<") ? n :
|
|
3287
|
+
return !t || t.startsWith("<") ? n : Vr(t);
|
|
3078
3288
|
}
|
|
3079
3289
|
if (e && typeof e == "object") {
|
|
3080
3290
|
let t = e;
|
|
3081
|
-
for (let e of
|
|
3291
|
+
for (let e of Br) {
|
|
3082
3292
|
let n = t[e];
|
|
3083
|
-
if (typeof n == "string" && n.trim()) return
|
|
3293
|
+
if (typeof n == "string" && n.trim()) return Vr(n.trim());
|
|
3084
3294
|
}
|
|
3085
3295
|
}
|
|
3086
3296
|
return n;
|
|
3087
3297
|
}
|
|
3088
3298
|
// src/components/ChatHistoryDropdown/useHistoryState.ts
|
|
3089
|
-
var
|
|
3090
|
-
function
|
|
3299
|
+
var Ur = "qwksearch_pinned_chats";
|
|
3300
|
+
function Wr(e) {
|
|
3091
3301
|
let t = e.messages?.[e.messages.length - 1], n = t && "createdAt" in t ? t.createdAt : void 0;
|
|
3092
3302
|
if (n) {
|
|
3093
3303
|
let e = new Date(n).getTime();
|
|
@@ -3095,27 +3305,27 @@ function Fr(e) {
|
|
|
3095
3305
|
}
|
|
3096
3306
|
return e.createdAt;
|
|
3097
3307
|
}
|
|
3098
|
-
function
|
|
3308
|
+
function Gr() {
|
|
3099
3309
|
if (typeof window > "u") return [];
|
|
3100
3310
|
try {
|
|
3101
|
-
let e = localStorage.getItem(
|
|
3311
|
+
let e = localStorage.getItem(Ur);
|
|
3102
3312
|
return e ? JSON.parse(e) : [];
|
|
3103
3313
|
} catch {
|
|
3104
3314
|
return [];
|
|
3105
3315
|
}
|
|
3106
3316
|
}
|
|
3107
|
-
function
|
|
3108
|
-
typeof window < "u" && localStorage.setItem(
|
|
3317
|
+
function Kr(e) {
|
|
3318
|
+
typeof window < "u" && localStorage.setItem(Ur, JSON.stringify(e));
|
|
3109
3319
|
}
|
|
3110
|
-
function
|
|
3320
|
+
function qr() {
|
|
3111
3321
|
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();
|
|
3112
3322
|
T(() => {
|
|
3113
|
-
_(
|
|
3323
|
+
_(Gr());
|
|
3114
3324
|
}, []);
|
|
3115
3325
|
let M = C((e, t) => {
|
|
3116
3326
|
e.preventDefault(), e.stopPropagation(), _((e) => {
|
|
3117
3327
|
let n = e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
|
|
3118
|
-
return
|
|
3328
|
+
return Kr(n), n;
|
|
3119
3329
|
});
|
|
3120
3330
|
}, []), N = E(() => [...e].sort((e, t) => {
|
|
3121
3331
|
let n = g.includes(e.id), r = g.includes(t.id);
|
|
@@ -3129,17 +3339,17 @@ function Rr() {
|
|
|
3129
3339
|
i(!0);
|
|
3130
3340
|
try {
|
|
3131
3341
|
if (D) {
|
|
3132
|
-
let { data: e, error: n, response: r } = await
|
|
3342
|
+
let { data: e, error: n, response: r } = await vt();
|
|
3133
3343
|
if (n && r?.status === 401) {
|
|
3134
3344
|
let e = Y().map((e) => ({
|
|
3135
3345
|
...e,
|
|
3136
3346
|
messageCount: e.messages?.filter((e) => e.role === "user").length ?? 0,
|
|
3137
|
-
lastMessageAt:
|
|
3347
|
+
lastMessageAt: Wr(e)
|
|
3138
3348
|
}));
|
|
3139
3349
|
t(e);
|
|
3140
3350
|
return;
|
|
3141
3351
|
}
|
|
3142
|
-
if (n) throw Error(`Failed to fetch chats: ${
|
|
3352
|
+
if (n) throw Error(`Failed to fetch chats: ${Hr(n, r?.status)}`);
|
|
3143
3353
|
t(Array.isArray(e?.chats) ? e.chats : []);
|
|
3144
3354
|
} else {
|
|
3145
3355
|
let e = Y().map((e) => ({
|
|
@@ -3165,9 +3375,9 @@ function Rr() {
|
|
|
3165
3375
|
d(!0);
|
|
3166
3376
|
try {
|
|
3167
3377
|
if (D) {
|
|
3168
|
-
let { error: e, response: t } = await
|
|
3169
|
-
if (e) throw Error(`Failed to delete chat: ${
|
|
3170
|
-
} else
|
|
3378
|
+
let { error: e, response: t } = await dt({ path: { id: s } });
|
|
3379
|
+
if (e) throw Error(`Failed to delete chat: ${Hr(e, t?.status)}`);
|
|
3380
|
+
} else ln(s);
|
|
3171
3381
|
t((e) => e.filter((e) => e.id !== s)), G.success("Chat deleted");
|
|
3172
3382
|
} catch (e) {
|
|
3173
3383
|
G.error(e.message || "Failed to delete chat");
|
|
@@ -3181,9 +3391,9 @@ function Rr() {
|
|
|
3181
3391
|
h(!0);
|
|
3182
3392
|
try {
|
|
3183
3393
|
if (D) {
|
|
3184
|
-
let { error: e, response: t } = await
|
|
3185
|
-
if (e) throw Error(`Failed to clear history: ${
|
|
3186
|
-
} else
|
|
3394
|
+
let { error: e, response: t } = await ut();
|
|
3395
|
+
if (e) throw Error(`Failed to clear history: ${Hr(e, t?.status)}`);
|
|
3396
|
+
} else un();
|
|
3187
3397
|
t([]), G.success("All history cleared");
|
|
3188
3398
|
} catch (e) {
|
|
3189
3399
|
G.error(e.message || "Failed to clear history");
|
|
@@ -3198,8 +3408,8 @@ function Rr() {
|
|
|
3198
3408
|
w(!0);
|
|
3199
3409
|
try {
|
|
3200
3410
|
if (D) {
|
|
3201
|
-
let { data: t, error: n, response: r } = await
|
|
3202
|
-
if (n) throw Error(`Failed to search chats: ${
|
|
3411
|
+
let { data: t, error: n, response: r } = await xt({ query: { q: e } });
|
|
3412
|
+
if (n) throw Error(`Failed to search chats: ${Hr(n, r?.status)}`);
|
|
3203
3413
|
x(Array.isArray(t?.chats) ? t.chats : []);
|
|
3204
3414
|
} else {
|
|
3205
3415
|
let t = Y().filter((t) => {
|
|
@@ -3209,7 +3419,7 @@ function Rr() {
|
|
|
3209
3419
|
x(t.map((e) => ({
|
|
3210
3420
|
...e,
|
|
3211
3421
|
messageCount: e.messages?.filter((e) => e.role === "user").length ?? 0,
|
|
3212
|
-
lastMessageAt:
|
|
3422
|
+
lastMessageAt: Wr(e)
|
|
3213
3423
|
})));
|
|
3214
3424
|
}
|
|
3215
3425
|
} catch (e) {
|
|
@@ -3254,7 +3464,7 @@ function Rr() {
|
|
|
3254
3464
|
};
|
|
3255
3465
|
}
|
|
3256
3466
|
// src/components/ChatHistoryDropdown/HistoryHeader.tsx
|
|
3257
|
-
function
|
|
3467
|
+
function Jr({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r, searchQuery: i, onSearchChange: a }) {
|
|
3258
3468
|
return /* @__PURE__ */ F("div", {
|
|
3259
3469
|
className: "mb-2 pb-2 border-b border-border space-y-2",
|
|
3260
3470
|
children: [/* @__PURE__ */ F("div", {
|
|
@@ -3268,18 +3478,18 @@ function zr({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r
|
|
|
3268
3478
|
onClick: t,
|
|
3269
3479
|
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"}`,
|
|
3270
3480
|
title: e ? "Private mode on" : "Private mode",
|
|
3271
|
-
children: [/* @__PURE__ */ P(
|
|
3481
|
+
children: [/* @__PURE__ */ P(ke, { size: 12 }), /* @__PURE__ */ P("span", { children: "Private" })]
|
|
3272
3482
|
}), n && /* @__PURE__ */ F("button", {
|
|
3273
3483
|
onClick: r,
|
|
3274
3484
|
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",
|
|
3275
3485
|
title: "Clear all history",
|
|
3276
|
-
children: [/* @__PURE__ */ P(
|
|
3486
|
+
children: [/* @__PURE__ */ P(et, { size: 12 }), /* @__PURE__ */ P("span", { children: "Clear All" })]
|
|
3277
3487
|
})]
|
|
3278
3488
|
})]
|
|
3279
3489
|
}), /* @__PURE__ */ F("div", {
|
|
3280
3490
|
className: "relative",
|
|
3281
3491
|
children: [
|
|
3282
|
-
/* @__PURE__ */ P(
|
|
3492
|
+
/* @__PURE__ */ P(He, {
|
|
3283
3493
|
className: "absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground",
|
|
3284
3494
|
size: 14
|
|
3285
3495
|
}),
|
|
@@ -3293,14 +3503,14 @@ function zr({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r
|
|
|
3293
3503
|
i && /* @__PURE__ */ P("button", {
|
|
3294
3504
|
onClick: () => a(""),
|
|
3295
3505
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
3296
|
-
children: /* @__PURE__ */ P(
|
|
3506
|
+
children: /* @__PURE__ */ P(rt, { size: 14 })
|
|
3297
3507
|
})
|
|
3298
3508
|
]
|
|
3299
3509
|
})]
|
|
3300
3510
|
});
|
|
3301
3511
|
}
|
|
3302
3512
|
// src/ui/badge.tsx
|
|
3303
|
-
var
|
|
3513
|
+
var Yr = Ot("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", {
|
|
3304
3514
|
variants: { variant: {
|
|
3305
3515
|
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
3306
3516
|
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",
|
|
@@ -3312,20 +3522,20 @@ var Br = At("inline-flex items-center justify-center rounded-2xl border px-3 py-
|
|
|
3312
3522
|
} },
|
|
3313
3523
|
defaultVariants: { variant: "default" }
|
|
3314
3524
|
});
|
|
3315
|
-
function
|
|
3316
|
-
return /* @__PURE__ */ P(n ?
|
|
3525
|
+
function Xr({ className: e, variant: t, asChild: n = !1, ...r }) {
|
|
3526
|
+
return /* @__PURE__ */ P(n ? Dt : "span", {
|
|
3317
3527
|
"data-slot": "badge",
|
|
3318
|
-
className: h(
|
|
3528
|
+
className: h(Yr({ variant: t }), e),
|
|
3319
3529
|
...r
|
|
3320
3530
|
});
|
|
3321
3531
|
}
|
|
3322
3532
|
// src/components/ChatHistoryDropdown/HistoryChatItem.tsx
|
|
3323
|
-
function
|
|
3533
|
+
function Zr({ chat: e, isPinned: n, onTogglePin: r, onDelete: i }) {
|
|
3324
3534
|
let a = e.messageCount ?? 0;
|
|
3325
3535
|
return /* @__PURE__ */ F("div", {
|
|
3326
3536
|
className: "group flex items-center gap-1 px-2 py-1 rounded-lg hover:bg-secondary transition-colors duration-200",
|
|
3327
3537
|
children: [
|
|
3328
|
-
/* @__PURE__ */ F(
|
|
3538
|
+
/* @__PURE__ */ F(Et, {
|
|
3329
3539
|
href: `/c/${e.id}`,
|
|
3330
3540
|
onClick: (n) => {
|
|
3331
3541
|
t.onOpenChat?.(e.id) && n.preventDefault();
|
|
@@ -3333,16 +3543,16 @@ function Hr({ chat: e, isPinned: n, onTogglePin: r, onDelete: i }) {
|
|
|
3333
3543
|
className: "flex-1 min-w-0 flex items-center gap-1.5",
|
|
3334
3544
|
children: [/* @__PURE__ */ F("span", {
|
|
3335
3545
|
className: "flex items-center gap-1 shrink-0",
|
|
3336
|
-
children: [a > 0 && /* @__PURE__ */ F(
|
|
3546
|
+
children: [a > 0 && /* @__PURE__ */ F(Xr, {
|
|
3337
3547
|
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",
|
|
3338
3548
|
children: [a, "Q"]
|
|
3339
|
-
}), /* @__PURE__ */ P(
|
|
3549
|
+
}), /* @__PURE__ */ P(Xr, {
|
|
3340
3550
|
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",
|
|
3341
3551
|
children: f(/* @__PURE__ */ new Date(), e.createdAt)
|
|
3342
3552
|
})]
|
|
3343
3553
|
}), /* @__PURE__ */ F("p", {
|
|
3344
3554
|
className: "text-xs text-popover-foreground truncate",
|
|
3345
|
-
children: [n && /* @__PURE__ */ P(
|
|
3555
|
+
children: [n && /* @__PURE__ */ P(Be, {
|
|
3346
3556
|
size: 10,
|
|
3347
3557
|
className: "inline mr-1 text-primary"
|
|
3348
3558
|
}), e.title]
|
|
@@ -3352,19 +3562,19 @@ function Hr({ chat: e, isPinned: n, onTogglePin: r, onDelete: i }) {
|
|
|
3352
3562
|
onClick: (t) => r(t, e.id),
|
|
3353
3563
|
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"}`,
|
|
3354
3564
|
title: n ? "Unpin chat" : "Pin chat",
|
|
3355
|
-
children: /* @__PURE__ */ P(
|
|
3565
|
+
children: /* @__PURE__ */ P(Be, { size: 14 })
|
|
3356
3566
|
}),
|
|
3357
3567
|
/* @__PURE__ */ P("button", {
|
|
3358
3568
|
onClick: (t) => i(t, e.id),
|
|
3359
3569
|
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",
|
|
3360
3570
|
title: "Delete chat",
|
|
3361
|
-
children: /* @__PURE__ */ P(
|
|
3571
|
+
children: /* @__PURE__ */ P($e, { size: 14 })
|
|
3362
3572
|
})
|
|
3363
3573
|
]
|
|
3364
3574
|
});
|
|
3365
3575
|
}
|
|
3366
3576
|
// src/components/ChatHistoryDropdown/HistoryDialogs.tsx
|
|
3367
|
-
function
|
|
3577
|
+
function Qr({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i, loadingLabel: a, loading: o, onConfirm: s }) {
|
|
3368
3578
|
return /* @__PURE__ */ P(_, {
|
|
3369
3579
|
open: e,
|
|
3370
3580
|
onOpenChange: (e) => {
|
|
@@ -3400,8 +3610,8 @@ function Ur({ open: e, onOpenChange: t, title: n, description: r, confirmLabel:
|
|
|
3400
3610
|
})
|
|
3401
3611
|
});
|
|
3402
3612
|
}
|
|
3403
|
-
function
|
|
3404
|
-
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
3613
|
+
function $r({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setChatToDelete: r, deleting: i, onConfirmDelete: a, clearAllDialogOpen: o, setClearAllDialogOpen: s, clearingAll: c, onConfirmClearAll: l }) {
|
|
3614
|
+
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(Qr, {
|
|
3405
3615
|
open: e,
|
|
3406
3616
|
onOpenChange: (e) => {
|
|
3407
3617
|
t(e), e || r(null);
|
|
@@ -3412,7 +3622,7 @@ function Wr({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
|
|
|
3412
3622
|
loadingLabel: "Deleting...",
|
|
3413
3623
|
loading: i,
|
|
3414
3624
|
onConfirm: a
|
|
3415
|
-
}), /* @__PURE__ */ P(
|
|
3625
|
+
}), /* @__PURE__ */ P(Qr, {
|
|
3416
3626
|
open: o,
|
|
3417
3627
|
onOpenChange: s,
|
|
3418
3628
|
title: "Clear All History",
|
|
@@ -3424,13 +3634,13 @@ function Wr({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
|
|
|
3424
3634
|
})] });
|
|
3425
3635
|
}
|
|
3426
3636
|
// src/components/ChatHistoryDropdown/HistoryDropdown.tsx
|
|
3427
|
-
var
|
|
3428
|
-
Today: /* @__PURE__ */ P(
|
|
3429
|
-
Yesterday: /* @__PURE__ */ P(
|
|
3430
|
-
"This Week": /* @__PURE__ */ P(
|
|
3431
|
-
Older: /* @__PURE__ */ P(
|
|
3637
|
+
var ei = {
|
|
3638
|
+
Today: /* @__PURE__ */ P(Ze, { size: 12 }),
|
|
3639
|
+
Yesterday: /* @__PURE__ */ P(ce, { size: 12 }),
|
|
3640
|
+
"This Week": /* @__PURE__ */ P(ne, { size: 12 }),
|
|
3641
|
+
Older: /* @__PURE__ */ P(z, { size: 12 })
|
|
3432
3642
|
};
|
|
3433
|
-
function
|
|
3643
|
+
function ti(e) {
|
|
3434
3644
|
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 = {
|
|
3435
3645
|
Today: [],
|
|
3436
3646
|
Yesterday: [],
|
|
@@ -3451,11 +3661,11 @@ function Kr(e) {
|
|
|
3451
3661
|
chats: a[e]
|
|
3452
3662
|
}));
|
|
3453
3663
|
}
|
|
3454
|
-
var
|
|
3455
|
-
let t =
|
|
3664
|
+
var ni = ({ showLabel: e = !1 }) => {
|
|
3665
|
+
let t = qr();
|
|
3456
3666
|
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ F(_, { children: [/* @__PURE__ */ F(d, {
|
|
3457
3667
|
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",
|
|
3458
|
-
children: [/* @__PURE__ */ P(
|
|
3668
|
+
children: [/* @__PURE__ */ P(Te, { size: e ? 14 : 18 }), e && /* @__PURE__ */ P("span", { children: "History" })]
|
|
3459
3669
|
}), /* @__PURE__ */ F(m, {
|
|
3460
3670
|
className: "max-w-[420px] p-3",
|
|
3461
3671
|
children: [
|
|
@@ -3463,7 +3673,7 @@ var qr = ({ showLabel: e = !1 }) => {
|
|
|
3463
3673
|
className: "sr-only",
|
|
3464
3674
|
children: "Chat History"
|
|
3465
3675
|
}),
|
|
3466
|
-
/* @__PURE__ */ P(
|
|
3676
|
+
/* @__PURE__ */ P(Jr, {
|
|
3467
3677
|
incognito: t.incognito,
|
|
3468
3678
|
onToggleIncognito: t.toggleIncognito,
|
|
3469
3679
|
showClearAll: t.chats.length > 0 && !t.loading,
|
|
@@ -3501,15 +3711,15 @@ var qr = ({ showLabel: e = !1 }) => {
|
|
|
3501
3711
|
})
|
|
3502
3712
|
}) : /* @__PURE__ */ P("div", {
|
|
3503
3713
|
className: "space-y-1 max-h-[500px] overflow-y-auto",
|
|
3504
|
-
children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ P(
|
|
3714
|
+
children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ P(Zr, {
|
|
3505
3715
|
chat: e,
|
|
3506
3716
|
isPinned: t.pinnedIds.includes(e.id),
|
|
3507
3717
|
onTogglePin: t.togglePin,
|
|
3508
3718
|
onDelete: t.handleDeleteClick
|
|
3509
|
-
}, e.id)) :
|
|
3719
|
+
}, e.id)) : ti(t.displayChats).map(({ label: e, chats: n }) => /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ F("div", {
|
|
3510
3720
|
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-muted-foreground/70 uppercase tracking-wider",
|
|
3511
|
-
children: [
|
|
3512
|
-
}), n.map((e) => /* @__PURE__ */ P(
|
|
3721
|
+
children: [ei[e], e]
|
|
3722
|
+
}), n.map((e) => /* @__PURE__ */ P(Zr, {
|
|
3513
3723
|
chat: e,
|
|
3514
3724
|
isPinned: t.pinnedIds.includes(e.id),
|
|
3515
3725
|
onTogglePin: t.togglePin,
|
|
@@ -3518,14 +3728,14 @@ var qr = ({ showLabel: e = !1 }) => {
|
|
|
3518
3728
|
}),
|
|
3519
3729
|
t.chats.length > 0 && /* @__PURE__ */ P("div", {
|
|
3520
3730
|
className: "mt-2 pt-2 border-t border-border",
|
|
3521
|
-
children: /* @__PURE__ */ P(
|
|
3731
|
+
children: /* @__PURE__ */ P(Et, {
|
|
3522
3732
|
href: "/library",
|
|
3523
3733
|
className: "block text-center text-xs text-primary hover:underline",
|
|
3524
3734
|
children: "View all chats"
|
|
3525
3735
|
})
|
|
3526
3736
|
})
|
|
3527
3737
|
]
|
|
3528
|
-
})] }), /* @__PURE__ */ P(
|
|
3738
|
+
})] }), /* @__PURE__ */ P($r, {
|
|
3529
3739
|
deleteDialogOpen: t.deleteDialogOpen,
|
|
3530
3740
|
setDeleteDialogOpen: t.setDeleteDialogOpen,
|
|
3531
3741
|
chatToDelete: t.chatToDelete,
|
|
@@ -3537,14 +3747,14 @@ var qr = ({ showLabel: e = !1 }) => {
|
|
|
3537
3747
|
clearingAll: t.clearingAll,
|
|
3538
3748
|
onConfirmClearAll: t.handleConfirmClearAll
|
|
3539
3749
|
})] });
|
|
3540
|
-
},
|
|
3541
|
-
function
|
|
3542
|
-
let { chats: e, loading: n } =
|
|
3750
|
+
}, ri = (e) => new Date(e.lastMessageAt || e.createdAt).getTime();
|
|
3751
|
+
function ii() {
|
|
3752
|
+
let { chats: e, loading: n } = qr(), r = [...e].sort((e, t) => ri(t) - ri(e)).slice(0, 5);
|
|
3543
3753
|
return n || r.length === 0 ? null : /* @__PURE__ */ F("div", {
|
|
3544
3754
|
className: "flex flex-row items-center justify-center gap-2 flex-wrap",
|
|
3545
|
-
children: [/* @__PURE__ */ P(
|
|
3546
|
-
let n =
|
|
3547
|
-
return /* @__PURE__ */ F(
|
|
3755
|
+
children: [/* @__PURE__ */ P(ni, { showLabel: !0 }), r.map((e) => {
|
|
3756
|
+
let n = hr(e.lastMessageAt || e.createdAt);
|
|
3757
|
+
return /* @__PURE__ */ F(Et, {
|
|
3548
3758
|
href: `/c/${e.id}`,
|
|
3549
3759
|
onClick: (n) => {
|
|
3550
3760
|
t.onOpenChat?.(e.id) && n.preventDefault();
|
|
@@ -3563,25 +3773,25 @@ function Yr() {
|
|
|
3563
3773
|
});
|
|
3564
3774
|
}
|
|
3565
3775
|
// src/components/Footer.tsx
|
|
3566
|
-
var
|
|
3567
|
-
Bot:
|
|
3568
|
-
BookOpen:
|
|
3776
|
+
var ai = {
|
|
3777
|
+
Bot: te,
|
|
3778
|
+
BookOpen: ee,
|
|
3569
3779
|
Building2: U,
|
|
3570
|
-
Download:
|
|
3571
|
-
HelpCircle:
|
|
3572
|
-
Info:
|
|
3573
|
-
Lock:
|
|
3574
|
-
Mail:
|
|
3575
|
-
MessageCircle:
|
|
3576
|
-
Newspaper:
|
|
3577
|
-
Sparkles:
|
|
3780
|
+
Download: pe,
|
|
3781
|
+
HelpCircle: Ce,
|
|
3782
|
+
Info: Ee,
|
|
3783
|
+
Lock: ke,
|
|
3784
|
+
Mail: Me,
|
|
3785
|
+
MessageCircle: Ne,
|
|
3786
|
+
Newspaper: Le,
|
|
3787
|
+
Sparkles: qe
|
|
3578
3788
|
};
|
|
3579
|
-
function
|
|
3580
|
-
let t =
|
|
3789
|
+
function oi({ name: e }) {
|
|
3790
|
+
let t = ai[e];
|
|
3581
3791
|
return t ? /* @__PURE__ */ P(t, { size: 14 }) : null;
|
|
3582
3792
|
}
|
|
3583
|
-
var
|
|
3584
|
-
function
|
|
3793
|
+
var si = "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";
|
|
3794
|
+
function ci({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackgroundColor: n = "bg-black/40" }) {
|
|
3585
3795
|
return e.length === 0 ? null : /* @__PURE__ */ P("nav", {
|
|
3586
3796
|
"aria-label": "Footer",
|
|
3587
3797
|
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`,
|
|
@@ -3592,7 +3802,7 @@ function $r({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackground
|
|
|
3592
3802
|
} : {}, s = /* @__PURE__ */ F(N, { children: [
|
|
3593
3803
|
t && r && /* @__PURE__ */ P("span", {
|
|
3594
3804
|
className: "hidden sm:inline-flex transition-transform duration-300 group-hover:-rotate-12 group-hover:scale-125",
|
|
3595
|
-
children: /* @__PURE__ */ P(
|
|
3805
|
+
children: /* @__PURE__ */ P(oi, { name: r })
|
|
3596
3806
|
}),
|
|
3597
3807
|
/* @__PURE__ */ P("span", {
|
|
3598
3808
|
className: "font-semibold tracking-wide text-[11px] sm:text-xs",
|
|
@@ -3604,83 +3814,83 @@ function $r({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackground
|
|
|
3604
3814
|
return i ? /* @__PURE__ */ P("button", {
|
|
3605
3815
|
type: "button",
|
|
3606
3816
|
onClick: i,
|
|
3607
|
-
className:
|
|
3817
|
+
className: si,
|
|
3608
3818
|
children: s
|
|
3609
3819
|
}, e) : a ? /* @__PURE__ */ P("a", {
|
|
3610
3820
|
href: e,
|
|
3611
3821
|
...o,
|
|
3612
|
-
className:
|
|
3822
|
+
className: si,
|
|
3613
3823
|
children: s
|
|
3614
|
-
}, e) : /* @__PURE__ */ P(
|
|
3824
|
+
}, e) : /* @__PURE__ */ P(Et, {
|
|
3615
3825
|
href: e,
|
|
3616
|
-
className:
|
|
3826
|
+
className: si,
|
|
3617
3827
|
children: s
|
|
3618
3828
|
}, e);
|
|
3619
3829
|
})
|
|
3620
3830
|
});
|
|
3621
3831
|
}
|
|
3622
3832
|
// src/components/ArticleReader/ArticleReaderMount.tsx
|
|
3623
|
-
var
|
|
3624
|
-
function
|
|
3833
|
+
var li = S(() => import("./ArticleExtractPanel-BPNXuezE.js"));
|
|
3834
|
+
function ui() {
|
|
3625
3835
|
let e = o()?.isOpen ?? !1, [t, n] = O(!1);
|
|
3626
3836
|
return T(() => {
|
|
3627
3837
|
e && n(!0);
|
|
3628
3838
|
}, [e]), !t && !e ? null : /* @__PURE__ */ P(y, {
|
|
3629
3839
|
fallback: null,
|
|
3630
|
-
children: /* @__PURE__ */ P(
|
|
3840
|
+
children: /* @__PURE__ */ P(li, {})
|
|
3631
3841
|
});
|
|
3632
3842
|
}
|
|
3633
|
-
var
|
|
3634
|
-
function
|
|
3843
|
+
var di = (/* @__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), fi = "qwksearch-background-art-v1", pi = "backgroundArtCache", mi = (e) => typeof e == "string" && di.includes(e);
|
|
3844
|
+
function hi() {
|
|
3635
3845
|
try {
|
|
3636
3846
|
let e = JSON.parse(localStorage.getItem("backgroundArtCache") || "[]");
|
|
3637
|
-
return Array.isArray(e) ? [...new Set(e.filter(
|
|
3847
|
+
return Array.isArray(e) ? [...new Set(e.filter(mi))] : [];
|
|
3638
3848
|
} catch {
|
|
3639
3849
|
return [];
|
|
3640
3850
|
}
|
|
3641
3851
|
}
|
|
3642
|
-
function
|
|
3852
|
+
function gi(e) {
|
|
3643
3853
|
try {
|
|
3644
|
-
localStorage.setItem(
|
|
3854
|
+
localStorage.setItem(pi, JSON.stringify(e));
|
|
3645
3855
|
} catch {}
|
|
3646
3856
|
}
|
|
3647
|
-
function
|
|
3648
|
-
let t =
|
|
3857
|
+
function _i(e) {
|
|
3858
|
+
let t = hi().filter((t) => t !== e);
|
|
3649
3859
|
t.push(e);
|
|
3650
3860
|
let n = t.splice(0, Math.max(0, t.length - 10));
|
|
3651
|
-
return
|
|
3861
|
+
return gi(t), n;
|
|
3652
3862
|
}
|
|
3653
|
-
function
|
|
3654
|
-
|
|
3863
|
+
function vi(e) {
|
|
3864
|
+
gi(hi().filter((t) => t !== e));
|
|
3655
3865
|
}
|
|
3656
|
-
var
|
|
3657
|
-
function
|
|
3658
|
-
return
|
|
3866
|
+
var yi = (e) => e.length ? e[Math.floor(Math.random() * e.length)] : null;
|
|
3867
|
+
function bi(e) {
|
|
3868
|
+
return yi(hi().filter((t) => t !== e));
|
|
3659
3869
|
}
|
|
3660
|
-
function
|
|
3661
|
-
let e = new Set(
|
|
3662
|
-
return
|
|
3870
|
+
function xi() {
|
|
3871
|
+
let e = new Set(hi());
|
|
3872
|
+
return yi(di.filter((t) => !e.has(t)));
|
|
3663
3873
|
}
|
|
3664
|
-
async function
|
|
3874
|
+
async function Si() {
|
|
3665
3875
|
if (typeof caches > "u") return null;
|
|
3666
3876
|
try {
|
|
3667
|
-
return await caches.open(
|
|
3877
|
+
return await caches.open(fi);
|
|
3668
3878
|
} catch {
|
|
3669
3879
|
return null;
|
|
3670
3880
|
}
|
|
3671
3881
|
}
|
|
3672
|
-
async function
|
|
3673
|
-
let t = await
|
|
3882
|
+
async function Ci(e) {
|
|
3883
|
+
let t = await Si();
|
|
3674
3884
|
if (!t) return null;
|
|
3675
3885
|
try {
|
|
3676
3886
|
let n = await t.match(e);
|
|
3677
|
-
return n ? URL.createObjectURL(await n.blob()) : (
|
|
3887
|
+
return n ? URL.createObjectURL(await n.blob()) : (vi(e), null);
|
|
3678
3888
|
} catch {
|
|
3679
3889
|
return null;
|
|
3680
3890
|
}
|
|
3681
3891
|
}
|
|
3682
|
-
async function
|
|
3683
|
-
let t = await
|
|
3892
|
+
async function wi(e) {
|
|
3893
|
+
let t = await Si();
|
|
3684
3894
|
if (!t) return e;
|
|
3685
3895
|
let n;
|
|
3686
3896
|
try {
|
|
@@ -3695,17 +3905,17 @@ async function hi(e) {
|
|
|
3695
3905
|
}
|
|
3696
3906
|
if (n.size <= 15728640) try {
|
|
3697
3907
|
await t.put(e, new Response(n, { headers: { "Content-Type": n.type } }));
|
|
3698
|
-
let r =
|
|
3908
|
+
let r = _i(e);
|
|
3699
3909
|
await Promise.all(r.map((e) => t.delete(e)));
|
|
3700
3910
|
} catch {}
|
|
3701
3911
|
return URL.createObjectURL(n);
|
|
3702
3912
|
}
|
|
3703
3913
|
// src/components/ChatConversation/ChatHomepage.tsx
|
|
3704
|
-
var
|
|
3705
|
-
function
|
|
3914
|
+
var Ti = S(() => import("use-weather-forecast").then((e) => ({ default: e.WeatherForecast }))), Ei = S(() => import("trending-news-api").then((e) => ({ default: e.TrendingNews }))), Di = S(() => import("education-playlists").then((e) => ({ default: e.EducationPlaylists }))), Oi = S(() => import("./DownloadsDialog-DvS23Dh-.js")), ki = 15;
|
|
3915
|
+
function Ai(e) {
|
|
3706
3916
|
return e ? e.split(/[,\n]/).map((e) => e.trim()).filter(Boolean) : [];
|
|
3707
3917
|
}
|
|
3708
|
-
function
|
|
3918
|
+
function ji(e) {
|
|
3709
3919
|
return e ? e.split(/\r?\n/).map((e) => e.trim()).filter(Boolean).map((e) => {
|
|
3710
3920
|
let t = e.split(",").map((e) => e.trim()), n = Number(t[t.length - 2]), r = Number(t[t.length - 1]);
|
|
3711
3921
|
return t.length >= 2 && t[t.length - 2] !== "" && t[t.length - 1] !== "" && Number.isFinite(n) && Number.isFinite(r) ? {
|
|
@@ -3715,15 +3925,15 @@ function Si(e) {
|
|
|
3715
3925
|
} : { label: e };
|
|
3716
3926
|
}) : [];
|
|
3717
3927
|
}
|
|
3718
|
-
var
|
|
3719
|
-
function
|
|
3720
|
-
return
|
|
3928
|
+
var Mi = (e) => e.endsWith(".webm") || e.endsWith(".mp4"), Ni = (e) => e.startsWith("blob:");
|
|
3929
|
+
function Pi({ url: e, src: t }) {
|
|
3930
|
+
return Mi(e) ? Promise.resolve(!0) : new Promise((e) => {
|
|
3721
3931
|
let n = new Image();
|
|
3722
3932
|
n.decoding = "async", n.onload = () => e(!0), n.onerror = () => e(!1), n.src = t;
|
|
3723
3933
|
});
|
|
3724
3934
|
}
|
|
3725
|
-
function
|
|
3726
|
-
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(null), [ee, te] = O(!0), [
|
|
3935
|
+
function Fi() {
|
|
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(null), [ee, te] = O(!0), [U, ne] = O(!1), [re, ie] = O(!1), [ae, oe] = O(!1), se = t.footerLinks.map((e) => e.url === "/#downloads" ? {
|
|
3727
3937
|
...e,
|
|
3728
3938
|
onClick: () => {
|
|
3729
3939
|
h(!0), p(!0);
|
|
@@ -3740,11 +3950,11 @@ function Ei() {
|
|
|
3740
3950
|
};
|
|
3741
3951
|
}, []), T(() => {
|
|
3742
3952
|
let e = () => {
|
|
3743
|
-
_(
|
|
3953
|
+
_(ji(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");
|
|
3744
3954
|
let e = localStorage.getItem("trendingNewsMaxTopics");
|
|
3745
3955
|
I(e && Number(e) || null);
|
|
3746
3956
|
let t = localStorage.getItem("trendingNewsShowImages");
|
|
3747
|
-
R(t === null ? null : t !== "false"), B(
|
|
3957
|
+
R(t === null ? null : t !== "false"), B(Ai(localStorage.getItem("trendingNewsCustomTopics"))), te(localStorage.getItem("showEducationPlaylistsWidget") !== "false"), ie(localStorage.getItem("orbHoverGlow") === "true"), oe(localStorage.getItem("cursorGlowTrail") === "true");
|
|
3748
3958
|
};
|
|
3749
3959
|
return e(), window.addEventListener("client-config-changed", e), window.addEventListener("storage", e), () => {
|
|
3750
3960
|
window.removeEventListener("client-config-changed", e), window.removeEventListener("storage", e);
|
|
@@ -3752,10 +3962,10 @@ function Ei() {
|
|
|
3752
3962
|
}, []), T(() => {
|
|
3753
3963
|
let e, t = () => {
|
|
3754
3964
|
if (typeof window.requestIdleCallback == "function") {
|
|
3755
|
-
let t = window.requestIdleCallback(() =>
|
|
3965
|
+
let t = window.requestIdleCallback(() => ne(!0), { timeout: 2500 });
|
|
3756
3966
|
e = () => window.cancelIdleCallback(t);
|
|
3757
3967
|
} else {
|
|
3758
|
-
let t = window.setTimeout(() =>
|
|
3968
|
+
let t = window.setTimeout(() => ne(!0), 800);
|
|
3759
3969
|
e = () => window.clearTimeout(t);
|
|
3760
3970
|
}
|
|
3761
3971
|
};
|
|
@@ -3764,25 +3974,25 @@ function Ei() {
|
|
|
3764
3974
|
};
|
|
3765
3975
|
}, []), T(() => {
|
|
3766
3976
|
if (localStorage.getItem("showBackgroundArt") === "false") return;
|
|
3767
|
-
let e = !1, t, n, r, i = null, o = null, s = /* @__PURE__ */ new Set(), l = (e) => (e &&
|
|
3768
|
-
e &&
|
|
3769
|
-
}, f = async (t) => t ? e || !await
|
|
3977
|
+
let e = !1, t, n, r, i = null, o = null, s = /* @__PURE__ */ new Set(), l = (e) => (e && Ni(e.src) && s.add(e.src), e), u = (e) => {
|
|
3978
|
+
e && Ni(e.src) && (URL.revokeObjectURL(e.src), s.delete(e.src));
|
|
3979
|
+
}, f = async (t) => t ? e || !await Pi(t) ? (u(t), null) : t : null, p = async (e) => {
|
|
3770
3980
|
if (!e) return null;
|
|
3771
|
-
let t = await
|
|
3981
|
+
let t = await Ci(e);
|
|
3772
3982
|
return f(l(t ? {
|
|
3773
3983
|
url: e,
|
|
3774
3984
|
src: t
|
|
3775
3985
|
} : null));
|
|
3776
3986
|
}, m = async (e) => {
|
|
3777
|
-
let t =
|
|
3987
|
+
let t = hi().length < 10 ? xi() : null;
|
|
3778
3988
|
if (t) {
|
|
3779
|
-
let e = await
|
|
3989
|
+
let e = await wi(t), n = await f(l(e ? {
|
|
3780
3990
|
url: t,
|
|
3781
3991
|
src: e
|
|
3782
3992
|
} : null));
|
|
3783
3993
|
if (n) return n;
|
|
3784
3994
|
}
|
|
3785
|
-
return p(
|
|
3995
|
+
return p(bi(e?.url));
|
|
3786
3996
|
}, h = (e) => {
|
|
3787
3997
|
let t = i;
|
|
3788
3998
|
i = e, t ? (c(e), d(!0), n = setTimeout(() => {
|
|
@@ -3793,7 +4003,7 @@ function Ei() {
|
|
|
3793
4003
|
g = !0;
|
|
3794
4004
|
let t = await (o ?? m(i));
|
|
3795
4005
|
o = null, g = !1, e || (t && h(t), o = m(i));
|
|
3796
|
-
}, v = p(
|
|
4006
|
+
}, v = p(bi()).then((t) => {
|
|
3797
4007
|
t && !e && h(t);
|
|
3798
4008
|
}), y = () => {
|
|
3799
4009
|
v.then(() => {
|
|
@@ -3813,7 +4023,7 @@ function Ei() {
|
|
|
3813
4023
|
for (let e of s) URL.revokeObjectURL(e);
|
|
3814
4024
|
};
|
|
3815
4025
|
}, []);
|
|
3816
|
-
let me = ({ url: e, src: t }, n) =>
|
|
4026
|
+
let me = ({ url: e, src: t }, n) => Mi(e) ? /* @__PURE__ */ P("video", {
|
|
3817
4027
|
src: t,
|
|
3818
4028
|
autoPlay: !0,
|
|
3819
4029
|
loop: !0,
|
|
@@ -3834,7 +4044,7 @@ function Ei() {
|
|
|
3834
4044
|
children: [
|
|
3835
4045
|
i && me(i, l ? "opacity-0" : "opacity-30"),
|
|
3836
4046
|
s && me(s, l ? "opacity-30" : "opacity-0"),
|
|
3837
|
-
ae && /* @__PURE__ */ P(
|
|
4047
|
+
ae && /* @__PURE__ */ P(Ht, {})
|
|
3838
4048
|
]
|
|
3839
4049
|
}),
|
|
3840
4050
|
/* @__PURE__ */ P("div", {
|
|
@@ -3849,8 +4059,8 @@ function Ei() {
|
|
|
3849
4059
|
alignItems: "center",
|
|
3850
4060
|
justifyContent: "center"
|
|
3851
4061
|
},
|
|
3852
|
-
className:
|
|
3853
|
-
children: /* @__PURE__ */ P(
|
|
4062
|
+
className: re ? void 0 : "pointer-events-none",
|
|
4063
|
+
children: /* @__PURE__ */ P(kt, {
|
|
3854
4064
|
autoRandomize: !0,
|
|
3855
4065
|
onSphereClick: () => console.log("Sphere clicked"),
|
|
3856
4066
|
className: "my-custom-class"
|
|
@@ -3858,14 +4068,14 @@ function Ei() {
|
|
|
3858
4068
|
}), /* @__PURE__ */ F("div", {
|
|
3859
4069
|
className: "w-full max-w-2xl mt-2 space-y-2",
|
|
3860
4070
|
children: [
|
|
3861
|
-
/* @__PURE__ */ P(
|
|
3862
|
-
/* @__PURE__ */ P(
|
|
3863
|
-
|
|
4071
|
+
/* @__PURE__ */ P(ii, {}),
|
|
4072
|
+
/* @__PURE__ */ P(Rr, {}),
|
|
4073
|
+
U && (ee || v || pe) && /* @__PURE__ */ P(y, {
|
|
3864
4074
|
fallback: null,
|
|
3865
4075
|
children: /* @__PURE__ */ F("div", {
|
|
3866
4076
|
className: "flex flex-col gap-2 w-full",
|
|
3867
4077
|
children: [
|
|
3868
|
-
ee && /* @__PURE__ */ P(
|
|
4078
|
+
ee && /* @__PURE__ */ P(Di, {
|
|
3869
4079
|
planEndpoint: t.educationPlaylistsApiUrl || void 0,
|
|
3870
4080
|
openHref: t.educationPlaylistsPageUrl || void 0,
|
|
3871
4081
|
onOpenItem: r,
|
|
@@ -3878,14 +4088,14 @@ function Ei() {
|
|
|
3878
4088
|
maxWidth: "100%"
|
|
3879
4089
|
}
|
|
3880
4090
|
}),
|
|
3881
|
-
pe && /* @__PURE__ */ P(
|
|
4091
|
+
pe && /* @__PURE__ */ P(Ei, {
|
|
3882
4092
|
expandable: !0,
|
|
3883
4093
|
maxTopics: de,
|
|
3884
|
-
expandedMaxTopics:
|
|
4094
|
+
expandedMaxTopics: ki,
|
|
3885
4095
|
showImages: fe,
|
|
3886
4096
|
apiEndpoint: ce,
|
|
3887
4097
|
topics: ue,
|
|
3888
|
-
limit:
|
|
4098
|
+
limit: ki,
|
|
3889
4099
|
className: "rounded-2xl w-full",
|
|
3890
4100
|
style: {
|
|
3891
4101
|
background: "rgba(255,255,255,0.08)",
|
|
@@ -3895,7 +4105,7 @@ function Ei() {
|
|
|
3895
4105
|
maxWidth: "100%"
|
|
3896
4106
|
}
|
|
3897
4107
|
}),
|
|
3898
|
-
v && /* @__PURE__ */ P(
|
|
4108
|
+
v && /* @__PURE__ */ P(Ti, {
|
|
3899
4109
|
forecastDays: x,
|
|
3900
4110
|
forecastHours: C,
|
|
3901
4111
|
temperatureUnit: E,
|
|
@@ -3911,24 +4121,24 @@ function Ei() {
|
|
|
3911
4121
|
]
|
|
3912
4122
|
})
|
|
3913
4123
|
}),
|
|
3914
|
-
/* @__PURE__ */ P(
|
|
4124
|
+
/* @__PURE__ */ P(ci, { listFooterLinks: se })
|
|
3915
4125
|
]
|
|
3916
4126
|
})]
|
|
3917
4127
|
})
|
|
3918
4128
|
}),
|
|
3919
4129
|
m && /* @__PURE__ */ P(y, {
|
|
3920
4130
|
fallback: null,
|
|
3921
|
-
children: /* @__PURE__ */ P(
|
|
4131
|
+
children: /* @__PURE__ */ P(Oi, {
|
|
3922
4132
|
open: f,
|
|
3923
4133
|
onOpenChange: p
|
|
3924
4134
|
})
|
|
3925
4135
|
}),
|
|
3926
|
-
/* @__PURE__ */ P(
|
|
4136
|
+
/* @__PURE__ */ P(ui, {})
|
|
3927
4137
|
]
|
|
3928
4138
|
});
|
|
3929
4139
|
}
|
|
3930
4140
|
// src/ui/Loader.tsx
|
|
3931
|
-
var
|
|
4141
|
+
var Ii = () => /* @__PURE__ */ F("svg", {
|
|
3932
4142
|
"aria-hidden": "true",
|
|
3933
4143
|
className: "w-8 h-8 text-border fill-secondary animate-spin",
|
|
3934
4144
|
viewBox: "0 0 100 101",
|
|
@@ -3943,7 +4153,7 @@ var Di = () => /* @__PURE__ */ F("svg", {
|
|
|
3943
4153
|
})]
|
|
3944
4154
|
});
|
|
3945
4155
|
// src/components/ConfigError.tsx
|
|
3946
|
-
function
|
|
4156
|
+
function Li() {
|
|
3947
4157
|
return /* @__PURE__ */ P("div", {
|
|
3948
4158
|
className: "flex min-h-screen flex-col items-center justify-center p-8",
|
|
3949
4159
|
children: /* @__PURE__ */ F("div", {
|
|
@@ -4060,15 +4270,15 @@ function Oi() {
|
|
|
4060
4270
|
});
|
|
4061
4271
|
}
|
|
4062
4272
|
// src/components/ChatConversation/ChatWindow.tsx
|
|
4063
|
-
var
|
|
4273
|
+
var Ri = () => import("./ChatConversationThread-DMPdu2sr.js"), zi = S(Ri), Bi = () => {
|
|
4064
4274
|
let e = j(), { hasError: t, isReady: r, notFound: i, messages: a } = u(), { isAuthenticated: o } = n(), s = r && !i && a.length === 0;
|
|
4065
4275
|
return T(() => {
|
|
4066
4276
|
if (!s) return;
|
|
4067
4277
|
if (typeof window.requestIdleCallback == "function") {
|
|
4068
|
-
let e = window.requestIdleCallback(() => void
|
|
4278
|
+
let e = window.requestIdleCallback(() => void Ri(), { timeout: 5e3 });
|
|
4069
4279
|
return () => window.cancelIdleCallback(e);
|
|
4070
4280
|
}
|
|
4071
|
-
let e = window.setTimeout(() => void
|
|
4281
|
+
let e = window.setTimeout(() => void Ri(), 3e3);
|
|
4072
4282
|
return () => window.clearTimeout(e);
|
|
4073
4283
|
}, [s]), T(() => {
|
|
4074
4284
|
r && i && !o && e.replace("/");
|
|
@@ -4077,9 +4287,9 @@ var ki = () => import("./ChatConversationThread-BIJ8aNug.js"), Ai = S(ki), ji =
|
|
|
4077
4287
|
i,
|
|
4078
4288
|
o,
|
|
4079
4289
|
e
|
|
4080
|
-
]), t ? /* @__PURE__ */ P(
|
|
4290
|
+
]), t ? /* @__PURE__ */ P(Li, {}) : r && i && !o ? /* @__PURE__ */ P("div", {
|
|
4081
4291
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
4082
|
-
children: /* @__PURE__ */ P(
|
|
4292
|
+
children: /* @__PURE__ */ P(Ii, {})
|
|
4083
4293
|
}) : r ? i ? /* @__PURE__ */ F("div", {
|
|
4084
4294
|
className: "flex min-h-screen flex-col items-center justify-center gap-3 px-4 text-center",
|
|
4085
4295
|
children: [/* @__PURE__ */ P("p", {
|
|
@@ -4094,15 +4304,15 @@ var ki = () => import("./ChatConversationThread-BIJ8aNug.js"), Ai = S(ki), ji =
|
|
|
4094
4304
|
}) : /* @__PURE__ */ P("div", { children: a.length > 0 ? /* @__PURE__ */ P(N, { children: /* @__PURE__ */ P(y, {
|
|
4095
4305
|
fallback: /* @__PURE__ */ P("div", {
|
|
4096
4306
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
4097
|
-
children: /* @__PURE__ */ P(
|
|
4307
|
+
children: /* @__PURE__ */ P(Ii, {})
|
|
4098
4308
|
}),
|
|
4099
|
-
children: /* @__PURE__ */ P(
|
|
4100
|
-
}) }) : /* @__PURE__ */ P(
|
|
4309
|
+
children: /* @__PURE__ */ P(zi, {})
|
|
4310
|
+
}) }) : /* @__PURE__ */ P(Fi, {}) }) : /* @__PURE__ */ P("div", {
|
|
4101
4311
|
className: "flex flex-row items-center justify-center min-h-screen",
|
|
4102
|
-
children: /* @__PURE__ */ P(
|
|
4312
|
+
children: /* @__PURE__ */ P(Ii, {})
|
|
4103
4313
|
});
|
|
4104
|
-
},
|
|
4105
|
-
function
|
|
4314
|
+
}, Vi = "https://qwksearch.com", Hi = null, Ui = Vi, Wi = !1;
|
|
4315
|
+
function Gi(e, t) {
|
|
4106
4316
|
let n;
|
|
4107
4317
|
n = typeof e == "string" ? e : e instanceof URL ? e.href : e.url;
|
|
4108
4318
|
try {
|
|
@@ -4112,32 +4322,32 @@ function Ii(e, t) {
|
|
|
4112
4322
|
return !1;
|
|
4113
4323
|
}
|
|
4114
4324
|
}
|
|
4115
|
-
function
|
|
4116
|
-
if (
|
|
4117
|
-
|
|
4325
|
+
function Ki() {
|
|
4326
|
+
if (Wi || typeof window > "u" || typeof window.fetch != "function") return;
|
|
4327
|
+
Wi = !0;
|
|
4118
4328
|
let e = window.fetch.bind(window);
|
|
4119
4329
|
window.fetch = (t, n) => {
|
|
4120
|
-
if (!
|
|
4330
|
+
if (!Hi || !Gi(t, Ui)) return e(t, n);
|
|
4121
4331
|
let r = new Headers(n?.headers ?? (t instanceof Request ? t.headers : void 0));
|
|
4122
|
-
return !r.has("x-api-key") && !r.has("authorization") && r.set("X-API-Key",
|
|
4332
|
+
return !r.has("x-api-key") && !r.has("authorization") && r.set("X-API-Key", Hi), e(t, {
|
|
4123
4333
|
...n,
|
|
4124
4334
|
headers: r
|
|
4125
4335
|
});
|
|
4126
4336
|
};
|
|
4127
4337
|
}
|
|
4128
|
-
function
|
|
4129
|
-
|
|
4338
|
+
function qi(e, t = Vi) {
|
|
4339
|
+
Hi = e || null, Ui = t.replace(/\/+$/, ""), Hi && Ki();
|
|
4130
4340
|
}
|
|
4131
|
-
function
|
|
4132
|
-
return
|
|
4341
|
+
function Ji() {
|
|
4342
|
+
return Hi;
|
|
4133
4343
|
}
|
|
4134
|
-
function
|
|
4344
|
+
function Yi(e, t) {
|
|
4135
4345
|
let n = t ?? (typeof window < "u" ? `${window.location.pathname}${window.location.search}` : "/");
|
|
4136
4346
|
return `${e}${e.includes("?") ? "&" : "?"}returnTo=${encodeURIComponent(n)}`;
|
|
4137
4347
|
}
|
|
4138
|
-
function
|
|
4348
|
+
function Xi(e) {
|
|
4139
4349
|
let t = e.qwksearchOrigin ?? "https://qwksearch.com", n = { connected: !1 }, r = /* @__PURE__ */ new Set(), i = (i) => {
|
|
4140
|
-
n = i,
|
|
4350
|
+
n = i, qi(i.connected ? i.apiKey ?? null : null, t), e.onSession?.(i), r.forEach((e) => e());
|
|
4141
4351
|
}, a = null, o = () => (a ??= fetch(e.sessionUrl, {
|
|
4142
4352
|
credentials: "same-origin",
|
|
4143
4353
|
headers: { Accept: "application/json" }
|
|
@@ -4154,7 +4364,7 @@ function Vi(e) {
|
|
|
4154
4364
|
},
|
|
4155
4365
|
oneTap: (e) => {},
|
|
4156
4366
|
signIn: { social: (t) => {
|
|
4157
|
-
typeof window < "u" && window.location.assign(
|
|
4367
|
+
typeof window < "u" && window.location.assign(Yi(e.connectUrl));
|
|
4158
4368
|
} },
|
|
4159
4369
|
signOut: async (t) => {
|
|
4160
4370
|
try {
|
|
@@ -4170,14 +4380,14 @@ function Vi(e) {
|
|
|
4170
4380
|
};
|
|
4171
4381
|
}
|
|
4172
4382
|
// src/components/ArticleReader/ArticlePanelHeader.tsx
|
|
4173
|
-
var
|
|
4383
|
+
var Zi = ({ onClose: e }) => /* @__PURE__ */ P("div", {
|
|
4174
4384
|
className: "flex items-center justify-between bg-secondary px-4 py-3 border-b border-border",
|
|
4175
4385
|
children: /* @__PURE__ */ P("button", {
|
|
4176
4386
|
onClick: e,
|
|
4177
4387
|
className: "rounded-md p-1 hover:bg-accent transition-colors",
|
|
4178
|
-
children: /* @__PURE__ */ P(
|
|
4388
|
+
children: /* @__PURE__ */ P(rt, { className: "h-5 w-5" })
|
|
4179
4389
|
})
|
|
4180
|
-
}),
|
|
4390
|
+
}), Qi = Ot("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", {
|
|
4181
4391
|
variants: {
|
|
4182
4392
|
variant: {
|
|
4183
4393
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
@@ -4200,9 +4410,9 @@ var Hi = ({ onClose: e }) => /* @__PURE__ */ P("div", {
|
|
|
4200
4410
|
}
|
|
4201
4411
|
});
|
|
4202
4412
|
function Q({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
4203
|
-
return /* @__PURE__ */ P(r ?
|
|
4413
|
+
return /* @__PURE__ */ P(r ? Dt : "button", {
|
|
4204
4414
|
"data-slot": "button",
|
|
4205
|
-
className: h(
|
|
4415
|
+
className: h(Qi({
|
|
4206
4416
|
variant: t,
|
|
4207
4417
|
size: n,
|
|
4208
4418
|
className: e
|
|
@@ -4211,7 +4421,7 @@ function Q({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
|
4211
4421
|
});
|
|
4212
4422
|
}
|
|
4213
4423
|
// src/components/ArticleReader/ArticleActionButtons.tsx
|
|
4214
|
-
var
|
|
4424
|
+
var $i = {
|
|
4215
4425
|
ask: {
|
|
4216
4426
|
alt: !0,
|
|
4217
4427
|
key: "a"
|
|
@@ -4252,12 +4462,12 @@ var Wi = {
|
|
|
4252
4462
|
alt: !1,
|
|
4253
4463
|
key: "Escape"
|
|
4254
4464
|
}
|
|
4255
|
-
},
|
|
4256
|
-
function
|
|
4257
|
-
let { alt: t, key: n } =
|
|
4258
|
-
return t ?
|
|
4465
|
+
}, ea = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent || "");
|
|
4466
|
+
function ta(e) {
|
|
4467
|
+
let { alt: t, key: n } = $i[e], r = n === "Escape" ? "Esc" : n.length === 1 ? n.toUpperCase() : n;
|
|
4468
|
+
return t ? ea ? `⌥${r}` : `Alt+${r}` : r;
|
|
4259
4469
|
}
|
|
4260
|
-
var
|
|
4470
|
+
var na = 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, {
|
|
4261
4471
|
asChild: !0,
|
|
4262
4472
|
children: n
|
|
4263
4473
|
}), /* @__PURE__ */ P(a, {
|
|
@@ -4266,10 +4476,10 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4266
4476
|
className: "flex items-center gap-1.5",
|
|
4267
4477
|
children: [/* @__PURE__ */ P("span", { children: e }), t && /* @__PURE__ */ P("kbd", {
|
|
4268
4478
|
className: "rounded bg-primary-foreground/20 px-1 py-0.5 text-[10px] font-semibold leading-none tracking-wide",
|
|
4269
|
-
children:
|
|
4479
|
+
children: ta(t)
|
|
4270
4480
|
})]
|
|
4271
4481
|
})
|
|
4272
|
-
})] }),
|
|
4482
|
+
})] }), ra = ({ 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: _ }) => {
|
|
4273
4483
|
let v = p || m, y = Math.round((o ?? 1) * 100);
|
|
4274
4484
|
return /* @__PURE__ */ F("div", {
|
|
4275
4485
|
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",
|
|
@@ -4283,7 +4493,7 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4283
4493
|
variant: "ghost",
|
|
4284
4494
|
size: "sm",
|
|
4285
4495
|
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"),
|
|
4286
|
-
children: [/* @__PURE__ */ P(
|
|
4496
|
+
children: [/* @__PURE__ */ P(te, { className: "size-4" }), /* @__PURE__ */ P("span", {
|
|
4287
4497
|
className: "font-medium",
|
|
4288
4498
|
children: e ? "..." : "Ask"
|
|
4289
4499
|
})]
|
|
@@ -4298,7 +4508,7 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4298
4508
|
variant: "ghost",
|
|
4299
4509
|
size: "sm",
|
|
4300
4510
|
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"),
|
|
4301
|
-
children: [/* @__PURE__ */ P(
|
|
4511
|
+
children: [/* @__PURE__ */ P(Pe, { className: "size-4" }), /* @__PURE__ */ P("span", {
|
|
4302
4512
|
className: "font-medium",
|
|
4303
4513
|
children: "Suggest"
|
|
4304
4514
|
})]
|
|
@@ -4311,8 +4521,8 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4311
4521
|
onClick: l,
|
|
4312
4522
|
variant: "ghost",
|
|
4313
4523
|
size: "icon",
|
|
4314
|
-
className:
|
|
4315
|
-
children: /* @__PURE__ */ P(
|
|
4524
|
+
className: na,
|
|
4525
|
+
children: /* @__PURE__ */ P(se, { className: "size-4" })
|
|
4316
4526
|
})
|
|
4317
4527
|
}),
|
|
4318
4528
|
/* @__PURE__ */ P($, {
|
|
@@ -4321,8 +4531,8 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4321
4531
|
onClick: u,
|
|
4322
4532
|
variant: "ghost",
|
|
4323
4533
|
size: "icon",
|
|
4324
|
-
className:
|
|
4325
|
-
children: /* @__PURE__ */ P(
|
|
4534
|
+
className: na,
|
|
4535
|
+
children: /* @__PURE__ */ P(Ge, { className: "size-4" })
|
|
4326
4536
|
})
|
|
4327
4537
|
}),
|
|
4328
4538
|
/* @__PURE__ */ P($, {
|
|
@@ -4333,7 +4543,7 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4333
4543
|
variant: "ghost",
|
|
4334
4544
|
size: "icon",
|
|
4335
4545
|
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"),
|
|
4336
|
-
children: /* @__PURE__ */ P(
|
|
4546
|
+
children: /* @__PURE__ */ P(we, { className: "size-4" })
|
|
4337
4547
|
})
|
|
4338
4548
|
}),
|
|
4339
4549
|
/* @__PURE__ */ P($, {
|
|
@@ -4345,7 +4555,7 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4345
4555
|
variant: "ghost",
|
|
4346
4556
|
size: "icon",
|
|
4347
4557
|
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"),
|
|
4348
|
-
children: /* @__PURE__ */ P(
|
|
4558
|
+
children: /* @__PURE__ */ P(Xe, { className: h("size-4", r && "fill-yellow-400") })
|
|
4349
4559
|
})
|
|
4350
4560
|
}),
|
|
4351
4561
|
a && /* @__PURE__ */ P($, {
|
|
@@ -4355,12 +4565,12 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4355
4565
|
asChild: !0,
|
|
4356
4566
|
variant: "ghost",
|
|
4357
4567
|
size: "icon",
|
|
4358
|
-
className:
|
|
4568
|
+
className: na,
|
|
4359
4569
|
children: /* @__PURE__ */ P("a", {
|
|
4360
4570
|
href: a,
|
|
4361
4571
|
target: "_blank",
|
|
4362
4572
|
rel: "noopener noreferrer",
|
|
4363
|
-
children: /* @__PURE__ */ P(
|
|
4573
|
+
children: /* @__PURE__ */ P(me, { className: "size-4" })
|
|
4364
4574
|
})
|
|
4365
4575
|
})
|
|
4366
4576
|
}),
|
|
@@ -4375,7 +4585,7 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4375
4585
|
variant: "ghost",
|
|
4376
4586
|
size: "icon",
|
|
4377
4587
|
className: "h-8 w-8 rounded-lg text-muted-foreground transition-all duration-200 hover:bg-muted/80 hover:text-foreground",
|
|
4378
|
-
children: /* @__PURE__ */ P(
|
|
4588
|
+
children: /* @__PURE__ */ P(at, { className: "size-4" })
|
|
4379
4589
|
})
|
|
4380
4590
|
}),
|
|
4381
4591
|
/* @__PURE__ */ P($, {
|
|
@@ -4396,7 +4606,7 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4396
4606
|
variant: "ghost",
|
|
4397
4607
|
size: "icon",
|
|
4398
4608
|
className: "h-8 w-8 rounded-lg text-muted-foreground transition-all duration-200 hover:bg-muted/80 hover:text-foreground",
|
|
4399
|
-
children: /* @__PURE__ */ P(
|
|
4609
|
+
children: /* @__PURE__ */ P(it, { className: "size-4" })
|
|
4400
4610
|
})
|
|
4401
4611
|
})
|
|
4402
4612
|
]
|
|
@@ -4408,13 +4618,13 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4408
4618
|
onClick: _,
|
|
4409
4619
|
variant: "ghost",
|
|
4410
4620
|
size: "icon",
|
|
4411
|
-
className: h(
|
|
4412
|
-
children: /* @__PURE__ */ P(
|
|
4621
|
+
className: h(na, !v && "ml-auto"),
|
|
4622
|
+
children: /* @__PURE__ */ P(rt, { className: "size-4" })
|
|
4413
4623
|
})
|
|
4414
4624
|
})
|
|
4415
4625
|
]
|
|
4416
4626
|
});
|
|
4417
|
-
},
|
|
4627
|
+
}, ia = ({ value: e, onChange: t, onSubmit: n }) => /* @__PURE__ */ P("div", {
|
|
4418
4628
|
className: "relative",
|
|
4419
4629
|
children: /* @__PURE__ */ P("input", {
|
|
4420
4630
|
value: e,
|
|
@@ -4424,7 +4634,7 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4424
4634
|
placeholder: "Ask AI any question...",
|
|
4425
4635
|
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"
|
|
4426
4636
|
})
|
|
4427
|
-
}),
|
|
4637
|
+
}), aa = ({ questions: e, isLoading: n, error: r, onQuestionClick: i }) => {
|
|
4428
4638
|
let a = v.useMemo(() => {
|
|
4429
4639
|
let t = [];
|
|
4430
4640
|
return e.forEach((e) => {
|
|
@@ -4461,7 +4671,7 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4461
4671
|
children: r
|
|
4462
4672
|
})
|
|
4463
4673
|
] });
|
|
4464
|
-
},
|
|
4674
|
+
}, oa = ({ response: e, isLoading: t, error: n }) => /* @__PURE__ */ F(N, { children: [
|
|
4465
4675
|
t && /* @__PURE__ */ P("div", {
|
|
4466
4676
|
className: "flex justify-center",
|
|
4467
4677
|
children: /* @__PURE__ */ P("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" })
|
|
@@ -4475,10 +4685,10 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4475
4685
|
className: "bg-red-500 text-white p-2 rounded-md text-sm",
|
|
4476
4686
|
children: n
|
|
4477
4687
|
})
|
|
4478
|
-
] }),
|
|
4688
|
+
] }), sa = ({ html: e, isHighlightMode: t = !1, fontScale: n = 1 }) => {
|
|
4479
4689
|
let [r, i] = O("");
|
|
4480
4690
|
return T(() => {
|
|
4481
|
-
i(
|
|
4691
|
+
i(At.sanitize(e || "", {
|
|
4482
4692
|
ADD_TAGS: ["figure", "figcaption"],
|
|
4483
4693
|
ADD_ATTR: ["loading"]
|
|
4484
4694
|
}));
|
|
@@ -4498,7 +4708,7 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4498
4708
|
},
|
|
4499
4709
|
dangerouslySetInnerHTML: { __html: r }
|
|
4500
4710
|
});
|
|
4501
|
-
},
|
|
4711
|
+
}, ca = ({ article: e, isHighlightMode: t, fontScale: n = 1 }) => /* @__PURE__ */ P("div", {
|
|
4502
4712
|
className: "border-t border-border pt-6",
|
|
4503
4713
|
children: /* @__PURE__ */ F("div", { children: [
|
|
4504
4714
|
/* @__PURE__ */ P("div", { className: "flex items-start justify-between mb-2" }),
|
|
@@ -4519,24 +4729,24 @@ var qi = h("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80
|
|
|
4519
4729
|
}),
|
|
4520
4730
|
/* @__PURE__ */ P("div", {
|
|
4521
4731
|
id: "article-content",
|
|
4522
|
-
children: /* @__PURE__ */ P(
|
|
4732
|
+
children: /* @__PURE__ */ P(sa, {
|
|
4523
4733
|
html: e.html || "",
|
|
4524
4734
|
isHighlightMode: t,
|
|
4525
4735
|
fontScale: n
|
|
4526
4736
|
})
|
|
4527
4737
|
})
|
|
4528
4738
|
] })
|
|
4529
|
-
}),
|
|
4530
|
-
function
|
|
4739
|
+
}), la = /(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/g, ua = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
|
|
4740
|
+
function da(e) {
|
|
4531
4741
|
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);
|
|
4532
4742
|
}
|
|
4533
|
-
function
|
|
4743
|
+
function fa(e) {
|
|
4534
4744
|
return /^https?:\/\//i.test(e) ? e : `https://${e}`;
|
|
4535
4745
|
}
|
|
4536
|
-
function
|
|
4746
|
+
function pa(e) {
|
|
4537
4747
|
if (!e || typeof e != "string") return e;
|
|
4538
4748
|
let t = e, n = [], r;
|
|
4539
|
-
for (
|
|
4749
|
+
for (ua.lastIndex = 0; (r = ua.exec(t)) !== null;) {
|
|
4540
4750
|
let e = r[0], i = r.index, a = t.substring(0, i), o = t.substring(i + e.length);
|
|
4541
4751
|
!a.endsWith("](") && !o.startsWith(")") && n.push({
|
|
4542
4752
|
email: e,
|
|
@@ -4548,9 +4758,9 @@ function ia(e) {
|
|
|
4548
4758
|
t = t.substring(0, i) + `[${r}](mailto:${r})` + t.substring(i + r.length);
|
|
4549
4759
|
}
|
|
4550
4760
|
let i = [], a;
|
|
4551
|
-
for (
|
|
4761
|
+
for (la.lastIndex = 0; (a = la.exec(t)) !== null;) {
|
|
4552
4762
|
let e = a[0], n = a.index;
|
|
4553
|
-
if (
|
|
4763
|
+
if (ua.test(e)) continue;
|
|
4554
4764
|
let r = t.substring(0, n), o = t.substring(n + e.length);
|
|
4555
4765
|
if (r.endsWith("](") || o.startsWith(")") || (r.match(/```/g) || []).length % 2 != 0) continue;
|
|
4556
4766
|
let s = r.lastIndexOf("`");
|
|
@@ -4558,22 +4768,22 @@ function ia(e) {
|
|
|
4558
4768
|
let e = t.substring(s + 1).indexOf("`");
|
|
4559
4769
|
if (e !== -1 && e > n - s - 1) continue;
|
|
4560
4770
|
}
|
|
4561
|
-
|
|
4771
|
+
da(e) && i.push({
|
|
4562
4772
|
url: e,
|
|
4563
4773
|
index: n
|
|
4564
4774
|
});
|
|
4565
4775
|
}
|
|
4566
4776
|
for (let e = i.length - 1; e >= 0; e--) {
|
|
4567
|
-
let { url: n, index: r } = i[e], a =
|
|
4777
|
+
let { url: n, index: r } = i[e], a = fa(n);
|
|
4568
4778
|
t = t.substring(0, r) + `[${n}](${a})` + t.substring(r + n.length);
|
|
4569
4779
|
}
|
|
4570
4780
|
return t;
|
|
4571
4781
|
}
|
|
4572
4782
|
// src/components/ArticleReader/unified-markdown.tsx
|
|
4573
|
-
function
|
|
4783
|
+
function ma(e) {
|
|
4574
4784
|
return !e || e.startsWith("http://") || e.startsWith("https://") || e.includes("://") ? !1 : e.startsWith("/") || e.startsWith("#");
|
|
4575
4785
|
}
|
|
4576
|
-
function
|
|
4786
|
+
function ha(e, t) {
|
|
4577
4787
|
if (t.startsWith("#")) {
|
|
4578
4788
|
e.preventDefault();
|
|
4579
4789
|
let n = t.substring(1), r = document.getElementById(n);
|
|
@@ -4583,7 +4793,7 @@ function oa(e, t) {
|
|
|
4583
4793
|
});
|
|
4584
4794
|
}
|
|
4585
4795
|
}
|
|
4586
|
-
function
|
|
4796
|
+
function ga({ code: e }) {
|
|
4587
4797
|
let [t, n] = O(!1), r = C(async () => {
|
|
4588
4798
|
try {
|
|
4589
4799
|
await navigator.clipboard.writeText(e), n(!0), setTimeout(() => n(!1), 2e3);
|
|
@@ -4595,10 +4805,10 @@ function sa({ code: e }) {
|
|
|
4595
4805
|
onClick: r,
|
|
4596
4806
|
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"),
|
|
4597
4807
|
"aria-label": t ? "Copied!" : "Copy code",
|
|
4598
|
-
children: t ? /* @__PURE__ */ P(
|
|
4808
|
+
children: t ? /* @__PURE__ */ P(re, { className: "h-4 w-4 text-green-600 dark:text-green-400" }) : /* @__PURE__ */ P(de, { className: "h-4 w-4" })
|
|
4599
4809
|
});
|
|
4600
4810
|
}
|
|
4601
|
-
function
|
|
4811
|
+
function _a({ children: e }) {
|
|
4602
4812
|
let t = D(null), [n, r] = O("");
|
|
4603
4813
|
return T(() => {
|
|
4604
4814
|
if (t.current) {
|
|
@@ -4614,18 +4824,18 @@ function ca({ children: e }) {
|
|
|
4614
4824
|
ref: t,
|
|
4615
4825
|
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"),
|
|
4616
4826
|
children: e
|
|
4617
|
-
}), n && /* @__PURE__ */ P(
|
|
4827
|
+
}), n && /* @__PURE__ */ P(ga, { code: n })]
|
|
4618
4828
|
});
|
|
4619
4829
|
}
|
|
4620
|
-
var
|
|
4830
|
+
var va = v.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
4621
4831
|
if (!e) return /* @__PURE__ */ P("div", {
|
|
4622
4832
|
className: h("text-muted-foreground text-sm", t),
|
|
4623
4833
|
children: "No content"
|
|
4624
4834
|
});
|
|
4625
|
-
let r =
|
|
4835
|
+
let r = pa(e);
|
|
4626
4836
|
return /* @__PURE__ */ P("div", {
|
|
4627
4837
|
className: h("kortix-markdown", t),
|
|
4628
|
-
children: /* @__PURE__ */ P(
|
|
4838
|
+
children: /* @__PURE__ */ P(jt, {
|
|
4629
4839
|
isAnimating: n,
|
|
4630
4840
|
components: {
|
|
4631
4841
|
h1: ({ children: e }) => /* @__PURE__ */ P("h1", {
|
|
@@ -4669,13 +4879,13 @@ var la = v.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4669
4879
|
children: e
|
|
4670
4880
|
}),
|
|
4671
4881
|
a: ({ href: e, children: t }) => {
|
|
4672
|
-
let n =
|
|
4882
|
+
let n = ma(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");
|
|
4673
4883
|
return r ? /* @__PURE__ */ P("a", {
|
|
4674
4884
|
href: e,
|
|
4675
|
-
onClick: (t) =>
|
|
4885
|
+
onClick: (t) => ha(t, e),
|
|
4676
4886
|
className: i,
|
|
4677
4887
|
children: t
|
|
4678
|
-
}) : n ? /* @__PURE__ */ P(
|
|
4888
|
+
}) : n ? /* @__PURE__ */ P(Et, {
|
|
4679
4889
|
href: e || "#",
|
|
4680
4890
|
className: i,
|
|
4681
4891
|
children: t
|
|
@@ -4694,7 +4904,7 @@ var la = v.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4694
4904
|
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",
|
|
4695
4905
|
children: e
|
|
4696
4906
|
}),
|
|
4697
|
-
pre: ({ children: e }) => /* @__PURE__ */ P(
|
|
4907
|
+
pre: ({ children: e }) => /* @__PURE__ */ P(_a, { children: e }),
|
|
4698
4908
|
blockquote: ({ children: e }) => /* @__PURE__ */ P("blockquote", {
|
|
4699
4909
|
className: h("my-5 pl-4 py-1 text-sm", "border-l-2 border-border", "text-muted-foreground", "[&>p]:my-2"),
|
|
4700
4910
|
children: e
|
|
@@ -4775,17 +4985,17 @@ var la = v.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
|
|
|
4775
4985
|
})
|
|
4776
4986
|
});
|
|
4777
4987
|
});
|
|
4778
|
-
|
|
4988
|
+
va.displayName = "UnifiedMarkdown";
|
|
4779
4989
|
// src/app/MainViewProvider.tsx
|
|
4780
|
-
var
|
|
4781
|
-
function
|
|
4990
|
+
var ya = b(null), ba = "qwksearch-main-view";
|
|
4991
|
+
function xa({ children: e, docsEnabled: t = !0 }) {
|
|
4782
4992
|
let [n, r] = O("research"), [i, a] = O(0), o = C((e) => r(t ? e : "research"), [t]);
|
|
4783
4993
|
T(() => {
|
|
4784
4994
|
if (typeof window > "u" || !t) return;
|
|
4785
|
-
let e = window.localStorage.getItem(
|
|
4995
|
+
let e = window.localStorage.getItem(ba);
|
|
4786
4996
|
(e === "research" || e === "docs") && r(e);
|
|
4787
4997
|
}, [t]), T(() => {
|
|
4788
|
-
typeof window < "u" && t && window.localStorage.setItem(
|
|
4998
|
+
typeof window < "u" && t && window.localStorage.setItem(ba, n);
|
|
4789
4999
|
}, [n, t]);
|
|
4790
5000
|
let s = E(() => ({
|
|
4791
5001
|
activeView: n,
|
|
@@ -4801,12 +5011,12 @@ function fa({ children: e, docsEnabled: t = !0 }) {
|
|
|
4801
5011
|
t,
|
|
4802
5012
|
i
|
|
4803
5013
|
]);
|
|
4804
|
-
return /* @__PURE__ */ P(
|
|
5014
|
+
return /* @__PURE__ */ P(ya.Provider, {
|
|
4805
5015
|
value: s,
|
|
4806
5016
|
children: e
|
|
4807
5017
|
});
|
|
4808
5018
|
}
|
|
4809
|
-
var
|
|
5019
|
+
var Sa = Object.freeze({
|
|
4810
5020
|
activeView: "research",
|
|
4811
5021
|
setActiveView: () => {},
|
|
4812
5022
|
docsEnabled: !1,
|
|
@@ -4814,12 +5024,12 @@ var pa = Object.freeze({
|
|
|
4814
5024
|
toggleToResearch: () => {},
|
|
4815
5025
|
filesSidebarRequestId: 0,
|
|
4816
5026
|
requestFilesSidebar: () => {}
|
|
4817
|
-
}),
|
|
4818
|
-
function
|
|
4819
|
-
return w(
|
|
5027
|
+
}), Ca = !1;
|
|
5028
|
+
function wa() {
|
|
5029
|
+
return w(ya) || (!Ca && process.env.NODE_ENV !== "production" && (Ca = !0, console.error("useMainView was called outside a MainViewProvider. The component is rendering with view switching disabled — mount it inside MainViewProvider (see QwkSearchProviders).")), Sa);
|
|
4820
5030
|
}
|
|
4821
5031
|
// src/settings/sections.json
|
|
4822
|
-
var
|
|
5032
|
+
var Ta = [
|
|
4823
5033
|
{
|
|
4824
5034
|
key: "account",
|
|
4825
5035
|
name: "Account",
|
|
@@ -4883,44 +5093,44 @@ var ga = [
|
|
|
4883
5093
|
icon: "Volume2",
|
|
4884
5094
|
dataAdd: "voice"
|
|
4885
5095
|
}
|
|
4886
|
-
],
|
|
5096
|
+
], Ea = [
|
|
4887
5097
|
{
|
|
4888
5098
|
key: "webSearch",
|
|
4889
5099
|
title: "All",
|
|
4890
5100
|
description: "Searches across all of the internet",
|
|
4891
|
-
icon: /* @__PURE__ */ P(
|
|
5101
|
+
icon: /* @__PURE__ */ P(Se, { size: 16 })
|
|
4892
5102
|
},
|
|
4893
5103
|
{
|
|
4894
5104
|
key: "academicSearch",
|
|
4895
5105
|
title: "Academic",
|
|
4896
5106
|
description: "Search in published academic papers",
|
|
4897
|
-
icon: /* @__PURE__ */ P(
|
|
5107
|
+
icon: /* @__PURE__ */ P(Qe, { size: 16 })
|
|
4898
5108
|
},
|
|
4899
5109
|
{
|
|
4900
5110
|
key: "writingAssistant",
|
|
4901
5111
|
title: "Writing",
|
|
4902
5112
|
description: "Chat without searching the web",
|
|
4903
|
-
icon: /* @__PURE__ */ P(
|
|
5113
|
+
icon: /* @__PURE__ */ P(ze, { size: 16 })
|
|
4904
5114
|
},
|
|
4905
5115
|
{
|
|
4906
5116
|
key: "wolframAlphaSearch",
|
|
4907
5117
|
title: "Wolfram Alpha",
|
|
4908
5118
|
description: "Computational knowledge engine",
|
|
4909
|
-
icon: /* @__PURE__ */ P(
|
|
5119
|
+
icon: /* @__PURE__ */ P(V, { size: 16 })
|
|
4910
5120
|
},
|
|
4911
5121
|
{
|
|
4912
5122
|
key: "youtubeSearch",
|
|
4913
5123
|
title: "Youtube",
|
|
4914
5124
|
description: "Search and watch videos",
|
|
4915
|
-
icon: /* @__PURE__ */ P(
|
|
5125
|
+
icon: /* @__PURE__ */ P(Nt, { className: "h-[16px] w-auto mr-0.5" })
|
|
4916
5126
|
},
|
|
4917
5127
|
{
|
|
4918
5128
|
key: "redditSearch",
|
|
4919
5129
|
title: "Reddit",
|
|
4920
5130
|
description: "Search for discussions and opinions",
|
|
4921
|
-
icon: /* @__PURE__ */ P(
|
|
5131
|
+
icon: /* @__PURE__ */ P(Mt, { className: "h-[16px] w-auto mr-0.5" })
|
|
4922
5132
|
}
|
|
4923
|
-
],
|
|
5133
|
+
], Da = [
|
|
4924
5134
|
{
|
|
4925
5135
|
href: "/",
|
|
4926
5136
|
label: "Research",
|
|
@@ -4978,9 +5188,9 @@ var ga = [
|
|
|
4978
5188
|
}
|
|
4979
5189
|
];
|
|
4980
5190
|
// src/components/SpotlightPalette/spotlightItems.ts
|
|
4981
|
-
function
|
|
4982
|
-
let t = (e) => e === "/" ?
|
|
4983
|
-
return
|
|
5191
|
+
function Oa(e) {
|
|
5192
|
+
let t = (e) => e === "/" ? He : e === "/workspace" ? ye : e === "/settings" ? Ue : e === "/docs" ? ee : De;
|
|
5193
|
+
return Da.filter((t) => !t.docsOnly || e.docsEnabled).map((n) => ({
|
|
4984
5194
|
id: `page:${n.href}`,
|
|
4985
5195
|
source: "page",
|
|
4986
5196
|
name: n.label,
|
|
@@ -4990,7 +5200,7 @@ function ya(e) {
|
|
|
4990
5200
|
run: () => e.navigate(n.href)
|
|
4991
5201
|
}));
|
|
4992
5202
|
}
|
|
4993
|
-
function
|
|
5203
|
+
function ka(e, t) {
|
|
4994
5204
|
let n = /* @__PURE__ */ new Date();
|
|
4995
5205
|
return e.map((e) => ({
|
|
4996
5206
|
id: `chat:${e.id}`,
|
|
@@ -4998,23 +5208,23 @@ function ba(e, t) {
|
|
|
4998
5208
|
name: e.title || "Untitled chat",
|
|
4999
5209
|
meta: `${e.messageCount ?? 0} question${(e.messageCount ?? 0) === 1 ? "" : "s"}`,
|
|
5000
5210
|
keywords: e.focusMode ?? "",
|
|
5001
|
-
icon:
|
|
5211
|
+
icon: Fe,
|
|
5002
5212
|
hint: f(n, e.lastMessageAt || e.createdAt),
|
|
5003
5213
|
run: () => t.openChat(e.id)
|
|
5004
5214
|
}));
|
|
5005
5215
|
}
|
|
5006
|
-
function
|
|
5007
|
-
return
|
|
5216
|
+
function Aa(e) {
|
|
5217
|
+
return Ta.map((t) => ({
|
|
5008
5218
|
id: `setting:${t.key}`,
|
|
5009
5219
|
source: "setting",
|
|
5010
5220
|
name: t.name,
|
|
5011
5221
|
meta: t.description,
|
|
5012
5222
|
keywords: `settings ${t.key}`,
|
|
5013
|
-
icon:
|
|
5223
|
+
icon: Ke,
|
|
5014
5224
|
run: () => e.openSettings(t.key)
|
|
5015
5225
|
}));
|
|
5016
5226
|
}
|
|
5017
|
-
function
|
|
5227
|
+
function ja(e) {
|
|
5018
5228
|
let t = [
|
|
5019
5229
|
{
|
|
5020
5230
|
id: "action:new-chat",
|
|
@@ -5022,7 +5232,7 @@ function Sa(e) {
|
|
|
5022
5232
|
name: "New chat",
|
|
5023
5233
|
meta: "Start a fresh conversation",
|
|
5024
5234
|
keywords: "clear reset blank",
|
|
5025
|
-
icon:
|
|
5235
|
+
icon: Ve,
|
|
5026
5236
|
run: e.newChat
|
|
5027
5237
|
},
|
|
5028
5238
|
{
|
|
@@ -5031,7 +5241,7 @@ function Sa(e) {
|
|
|
5031
5241
|
name: "Open settings",
|
|
5032
5242
|
meta: "Models, connectors, search sources and preferences",
|
|
5033
5243
|
keywords: "preferences configure",
|
|
5034
|
-
icon:
|
|
5244
|
+
icon: Ue,
|
|
5035
5245
|
run: () => e.openSettings()
|
|
5036
5246
|
},
|
|
5037
5247
|
{
|
|
@@ -5040,18 +5250,18 @@ function Sa(e) {
|
|
|
5040
5250
|
name: e.incognito ? "Turn off incognito" : "Turn on incognito",
|
|
5041
5251
|
meta: "Stop saving this conversation to history",
|
|
5042
5252
|
keywords: "private incognito history off",
|
|
5043
|
-
icon:
|
|
5253
|
+
icon: he,
|
|
5044
5254
|
hint: e.incognito ? "on" : "off",
|
|
5045
5255
|
run: () => e.setIncognito(!e.incognito)
|
|
5046
5256
|
}
|
|
5047
5257
|
];
|
|
5048
|
-
for (let n of
|
|
5258
|
+
for (let n of Ea) t.push({
|
|
5049
5259
|
id: `action:focus:${n.key}`,
|
|
5050
5260
|
source: "action",
|
|
5051
5261
|
name: `Focus: ${n.title}`,
|
|
5052
5262
|
meta: n.description,
|
|
5053
5263
|
keywords: `focus mode ${n.key}`,
|
|
5054
|
-
icon:
|
|
5264
|
+
icon: Se,
|
|
5055
5265
|
hint: e.focusMode === n.key ? "current" : void 0,
|
|
5056
5266
|
run: () => e.setFocusMode(n.key)
|
|
5057
5267
|
});
|
|
@@ -5061,7 +5271,7 @@ function Sa(e) {
|
|
|
5061
5271
|
name: "Switch to documents",
|
|
5062
5272
|
meta: "Open the REASON editor view",
|
|
5063
5273
|
keywords: "reason editor write docs",
|
|
5064
|
-
icon:
|
|
5274
|
+
icon: ye,
|
|
5065
5275
|
run: () => e.setActiveView("docs")
|
|
5066
5276
|
}, {
|
|
5067
5277
|
id: "action:view-research",
|
|
@@ -5069,7 +5279,7 @@ function Sa(e) {
|
|
|
5069
5279
|
name: "Switch to research",
|
|
5070
5280
|
meta: "Back to the search and chat view",
|
|
5071
5281
|
keywords: "chat search",
|
|
5072
|
-
icon:
|
|
5282
|
+
icon: He,
|
|
5073
5283
|
run: () => e.setActiveView("research")
|
|
5074
5284
|
}, {
|
|
5075
5285
|
id: "action:files-sidebar",
|
|
@@ -5077,7 +5287,7 @@ function Sa(e) {
|
|
|
5077
5287
|
name: "Show files sidebar",
|
|
5078
5288
|
meta: "Browse REASON documents",
|
|
5079
5289
|
keywords: "files documents sidebar",
|
|
5080
|
-
icon:
|
|
5290
|
+
icon: ye,
|
|
5081
5291
|
run: () => {
|
|
5082
5292
|
e.setActiveView("docs"), e.requestFilesSidebar();
|
|
5083
5293
|
}
|
|
@@ -5087,7 +5297,7 @@ function Sa(e) {
|
|
|
5087
5297
|
name: "Sign out",
|
|
5088
5298
|
meta: "End this session",
|
|
5089
5299
|
keywords: "logout log out",
|
|
5090
|
-
icon:
|
|
5300
|
+
icon: je,
|
|
5091
5301
|
run: e.signOut
|
|
5092
5302
|
} : {
|
|
5093
5303
|
id: "action:sign-in",
|
|
@@ -5095,24 +5305,24 @@ function Sa(e) {
|
|
|
5095
5305
|
name: "Sign in",
|
|
5096
5306
|
meta: "Sync chats and settings across devices",
|
|
5097
5307
|
keywords: "login log in account",
|
|
5098
|
-
icon:
|
|
5308
|
+
icon: Ae,
|
|
5099
5309
|
run: e.signIn
|
|
5100
5310
|
}), t;
|
|
5101
5311
|
}
|
|
5102
|
-
function
|
|
5312
|
+
function Ma(e, t) {
|
|
5103
5313
|
let n = e.trim();
|
|
5104
5314
|
return n ? {
|
|
5105
5315
|
id: "search:ask",
|
|
5106
5316
|
source: "search",
|
|
5107
5317
|
name: n,
|
|
5108
5318
|
meta: `Ask ${t.appName} — searches the web and answers with sources`,
|
|
5109
|
-
icon:
|
|
5319
|
+
icon: qe,
|
|
5110
5320
|
hint: "Enter",
|
|
5111
5321
|
run: () => t.ask(n)
|
|
5112
5322
|
} : null;
|
|
5113
5323
|
}
|
|
5114
5324
|
// src/components/SpotlightPalette/spotlightMatch.ts
|
|
5115
|
-
var
|
|
5325
|
+
var Na = [
|
|
5116
5326
|
{
|
|
5117
5327
|
prefix: "c",
|
|
5118
5328
|
source: "chat",
|
|
@@ -5139,10 +5349,10 @@ var wa = [
|
|
|
5139
5349
|
label: "web"
|
|
5140
5350
|
}
|
|
5141
5351
|
];
|
|
5142
|
-
function
|
|
5352
|
+
function Pa(e) {
|
|
5143
5353
|
let t = e.match(/^([a-zA-Z])\s+(.*)$/);
|
|
5144
5354
|
if (t) {
|
|
5145
|
-
let e = t[1].toLowerCase(), n =
|
|
5355
|
+
let e = t[1].toLowerCase(), n = Na.find((t) => t.prefix === e);
|
|
5146
5356
|
if (n) return {
|
|
5147
5357
|
prefix: n.prefix,
|
|
5148
5358
|
query: t[2]
|
|
@@ -5153,11 +5363,11 @@ function Ta(e) {
|
|
|
5153
5363
|
query: e
|
|
5154
5364
|
};
|
|
5155
5365
|
}
|
|
5156
|
-
var
|
|
5157
|
-
function
|
|
5366
|
+
var Fa = 18;
|
|
5367
|
+
function Ia(e) {
|
|
5158
5368
|
return `${e.meta ?? ""} ${e.keywords ?? ""}`.toLowerCase();
|
|
5159
5369
|
}
|
|
5160
|
-
function
|
|
5370
|
+
function La(e, t) {
|
|
5161
5371
|
let n = t.toLowerCase().split(/\s+/).filter(Boolean);
|
|
5162
5372
|
if (n.length === 0) return e.map((e) => ({
|
|
5163
5373
|
item: e,
|
|
@@ -5169,7 +5379,7 @@ function Oa(e, t) {
|
|
|
5169
5379
|
let e = t.name.toLowerCase();
|
|
5170
5380
|
if (n.every((t) => e.includes(t))) r.push(t);
|
|
5171
5381
|
else {
|
|
5172
|
-
let r = `${e} ${
|
|
5382
|
+
let r = `${e} ${Ia(t)}`;
|
|
5173
5383
|
n.every((e) => r.includes(e)) && i.push(t);
|
|
5174
5384
|
}
|
|
5175
5385
|
}
|
|
@@ -5181,32 +5391,32 @@ function Oa(e, t) {
|
|
|
5181
5391
|
})), ...i.map((e) => ({
|
|
5182
5392
|
item: e,
|
|
5183
5393
|
matchedName: !1,
|
|
5184
|
-
snippet:
|
|
5394
|
+
snippet: Ra(Ia(e), a)
|
|
5185
5395
|
}))];
|
|
5186
5396
|
}
|
|
5187
|
-
function
|
|
5397
|
+
function Ra(e, t) {
|
|
5188
5398
|
let n = e.indexOf(t);
|
|
5189
5399
|
if (n < 0) return "";
|
|
5190
|
-
let r = Math.max(0, n -
|
|
5400
|
+
let r = Math.max(0, n - Fa), i = Math.min(e.length, n + t.length + Fa), a = e.slice(r, i).replace(/\s+/g, " ").trim();
|
|
5191
5401
|
return r > 0 && (a = "…" + a), i < e.length && (a += "…"), a;
|
|
5192
5402
|
}
|
|
5193
5403
|
// src/components/SpotlightPalette/SpotlightPalette.tsx
|
|
5194
|
-
var
|
|
5195
|
-
function
|
|
5196
|
-
typeof window < "u" && window.dispatchEvent(new Event(
|
|
5404
|
+
var za = "qwksearch:open-spotlight", Ba = 100, Va = 6, Ha = 40;
|
|
5405
|
+
function Ua() {
|
|
5406
|
+
typeof window < "u" && window.dispatchEvent(new Event(za));
|
|
5197
5407
|
}
|
|
5198
|
-
function
|
|
5408
|
+
function Wa(e) {
|
|
5199
5409
|
return e.ctrlKey && !e.metaKey && !e.altKey && (e.code === "Space" || e.key === " ");
|
|
5200
5410
|
}
|
|
5201
|
-
var
|
|
5411
|
+
var Ga = {
|
|
5202
5412
|
search: "ask",
|
|
5203
5413
|
chat: "chat",
|
|
5204
5414
|
page: "page",
|
|
5205
5415
|
setting: "setting",
|
|
5206
5416
|
action: "action"
|
|
5207
5417
|
};
|
|
5208
|
-
function
|
|
5209
|
-
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: _ } =
|
|
5418
|
+
function Ka() {
|
|
5419
|
+
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: _ } = wa(), { recentChats: v, load: y } = mr(Ba), b = D(null), x = D(null), S = D(null), w = C(() => r(!1), []), k = D(y);
|
|
5210
5420
|
T(() => {
|
|
5211
5421
|
k.current = y;
|
|
5212
5422
|
}, [y]);
|
|
@@ -5246,30 +5456,30 @@ function La() {
|
|
|
5246
5456
|
m,
|
|
5247
5457
|
g,
|
|
5248
5458
|
_
|
|
5249
|
-
]), { prefix: M, query: N } =
|
|
5250
|
-
chat:
|
|
5251
|
-
page:
|
|
5252
|
-
setting:
|
|
5253
|
-
action:
|
|
5459
|
+
]), { prefix: M, query: N } = Pa(i), I = N.trim(), L = E(() => ({
|
|
5460
|
+
chat: ka(v, A),
|
|
5461
|
+
page: Oa(A),
|
|
5462
|
+
setting: Aa(A),
|
|
5463
|
+
action: ja(A)
|
|
5254
5464
|
}), [v, A]), R = E(() => {
|
|
5255
|
-
let e =
|
|
5465
|
+
let e = Ma(N, A);
|
|
5256
5466
|
if (M === "w") return e ? [e] : [];
|
|
5257
5467
|
if (M) {
|
|
5258
|
-
let e =
|
|
5259
|
-
return
|
|
5468
|
+
let e = Na.find((e) => e.prefix === M).source;
|
|
5469
|
+
return La(L[e], N).map((e) => e.item).slice(0, Ha);
|
|
5260
5470
|
}
|
|
5261
5471
|
if (!I) return [
|
|
5262
|
-
...L.chat.slice(0,
|
|
5472
|
+
...L.chat.slice(0, Va),
|
|
5263
5473
|
...L.action,
|
|
5264
5474
|
...L.page
|
|
5265
|
-
].slice(0,
|
|
5266
|
-
let t =
|
|
5475
|
+
].slice(0, Ha);
|
|
5476
|
+
let t = La([
|
|
5267
5477
|
...L.action,
|
|
5268
5478
|
...L.page,
|
|
5269
5479
|
...L.setting,
|
|
5270
5480
|
...L.chat
|
|
5271
5481
|
], N).map((e) => e.item);
|
|
5272
|
-
return [...e ? [e] : [], ...t].slice(0,
|
|
5482
|
+
return [...e ? [e] : [], ...t].slice(0, Ha);
|
|
5273
5483
|
}, [
|
|
5274
5484
|
M,
|
|
5275
5485
|
N,
|
|
@@ -5279,10 +5489,10 @@ function La() {
|
|
|
5279
5489
|
]);
|
|
5280
5490
|
T(() => {
|
|
5281
5491
|
let e = (e) => {
|
|
5282
|
-
|
|
5492
|
+
Wa(e) && (e.preventDefault(), r((e) => !e));
|
|
5283
5493
|
}, t = () => r(!0);
|
|
5284
|
-
return window.addEventListener("keydown", e), window.addEventListener(
|
|
5285
|
-
window.removeEventListener("keydown", e), window.removeEventListener(
|
|
5494
|
+
return window.addEventListener("keydown", e), window.addEventListener(za, t), () => {
|
|
5495
|
+
window.removeEventListener("keydown", e), window.removeEventListener(za, t);
|
|
5286
5496
|
};
|
|
5287
5497
|
}, []), T(() => {
|
|
5288
5498
|
e ? (s(0), k.current(), x.current?.focus()) : (a(""), s(0));
|
|
@@ -5300,7 +5510,7 @@ function La() {
|
|
|
5300
5510
|
let z = C((e) => {
|
|
5301
5511
|
e && (w(), e.run());
|
|
5302
5512
|
}, [w]), B = C(() => {
|
|
5303
|
-
let e =
|
|
5513
|
+
let e = Na.map((e) => e.prefix), t = e[((M ? e.indexOf(M) : -1) + 1) % e.length];
|
|
5304
5514
|
a(`${t} ${N}`), s(0);
|
|
5305
5515
|
}, [M, N]), V = (e) => {
|
|
5306
5516
|
switch (e.key) {
|
|
@@ -5320,7 +5530,7 @@ function La() {
|
|
|
5320
5530
|
}
|
|
5321
5531
|
};
|
|
5322
5532
|
if (!e) return null;
|
|
5323
|
-
let H = M ?
|
|
5533
|
+
let H = M ? Na.find((e) => e.prefix === M) : null;
|
|
5324
5534
|
return /* @__PURE__ */ P("div", {
|
|
5325
5535
|
className: "fixed inset-0 z-[10000] flex items-start justify-center bg-black/40 backdrop-blur-[2px] px-4 pt-[12vh]",
|
|
5326
5536
|
role: "presentation",
|
|
@@ -5334,7 +5544,7 @@ function La() {
|
|
|
5334
5544
|
/* @__PURE__ */ F("div", {
|
|
5335
5545
|
className: "flex items-center gap-3 border-b border-border px-4",
|
|
5336
5546
|
children: [
|
|
5337
|
-
/* @__PURE__ */ P(
|
|
5547
|
+
/* @__PURE__ */ P(He, {
|
|
5338
5548
|
size: 18,
|
|
5339
5549
|
className: "shrink-0 text-muted-foreground"
|
|
5340
5550
|
}),
|
|
@@ -5402,7 +5612,7 @@ function La() {
|
|
|
5402
5612
|
}),
|
|
5403
5613
|
/* @__PURE__ */ P("span", {
|
|
5404
5614
|
className: "shrink-0 rounded-md bg-secondary px-1.5 py-0 text-[10px] text-muted-foreground",
|
|
5405
|
-
children:
|
|
5615
|
+
children: Ga[e.source]
|
|
5406
5616
|
})
|
|
5407
5617
|
]
|
|
5408
5618
|
}, e.id);
|
|
@@ -5417,7 +5627,7 @@ function La() {
|
|
|
5417
5627
|
/* @__PURE__ */ P("span", { children: "esc close" }),
|
|
5418
5628
|
/* @__PURE__ */ P("span", {
|
|
5419
5629
|
className: "ml-auto",
|
|
5420
|
-
children:
|
|
5630
|
+
children: Na.map((e) => `${e.prefix} ${e.label}`).join(" · ")
|
|
5421
5631
|
})
|
|
5422
5632
|
]
|
|
5423
5633
|
})
|
|
@@ -5426,57 +5636,57 @@ function La() {
|
|
|
5426
5636
|
});
|
|
5427
5637
|
}
|
|
5428
5638
|
// src/lib/kokoro.ts
|
|
5429
|
-
var
|
|
5639
|
+
var qa = {
|
|
5430
5640
|
device: "webgpu",
|
|
5431
5641
|
dtype: "fp32"
|
|
5432
|
-
},
|
|
5642
|
+
}, Ja = {
|
|
5433
5643
|
device: "wasm",
|
|
5434
5644
|
dtype: "q8"
|
|
5435
|
-
},
|
|
5436
|
-
function
|
|
5645
|
+
}, Ya = "hexgrad/Kokoro-82M", Xa = null, Za = null;
|
|
5646
|
+
function Qa() {
|
|
5437
5647
|
return typeof navigator < "u" && "gpu" in navigator;
|
|
5438
5648
|
}
|
|
5439
|
-
async function
|
|
5440
|
-
if (!
|
|
5649
|
+
async function $a() {
|
|
5650
|
+
if (!Qa()) return !1;
|
|
5441
5651
|
try {
|
|
5442
5652
|
return await navigator.gpu.requestAdapter() != null;
|
|
5443
5653
|
} catch {
|
|
5444
5654
|
return !1;
|
|
5445
5655
|
}
|
|
5446
5656
|
}
|
|
5447
|
-
async function
|
|
5657
|
+
async function eo(e) {
|
|
5448
5658
|
let t = [];
|
|
5449
|
-
await
|
|
5659
|
+
await $a() && t.push(qa), t.push(Ja);
|
|
5450
5660
|
let { KokoroTTS: n } = await import("kokoro-js"), r;
|
|
5451
5661
|
for (let i of t) try {
|
|
5452
|
-
let t = await n.from_pretrained(
|
|
5662
|
+
let t = await n.from_pretrained(Ya, {
|
|
5453
5663
|
device: i.device,
|
|
5454
5664
|
dtype: i.dtype,
|
|
5455
5665
|
progress_callback: e
|
|
5456
5666
|
});
|
|
5457
|
-
return
|
|
5667
|
+
return Za = i.device, t;
|
|
5458
5668
|
} catch (e) {
|
|
5459
5669
|
r = e, console.warn(`Kokoro model failed to load on "${i.device}" backend:`, e);
|
|
5460
5670
|
}
|
|
5461
5671
|
throw r instanceof Error ? r : /* @__PURE__ */ Error("Failed to load Kokoro model");
|
|
5462
5672
|
}
|
|
5463
|
-
async function
|
|
5464
|
-
return
|
|
5465
|
-
throw
|
|
5466
|
-
}),
|
|
5673
|
+
async function to(e) {
|
|
5674
|
+
return Xa ||= eo(e).catch((e) => {
|
|
5675
|
+
throw Xa = null, e;
|
|
5676
|
+
}), Xa;
|
|
5467
5677
|
}
|
|
5468
|
-
async function
|
|
5469
|
-
return
|
|
5678
|
+
async function no(e) {
|
|
5679
|
+
return to(e);
|
|
5470
5680
|
}
|
|
5471
|
-
async function
|
|
5472
|
-
let e = await
|
|
5681
|
+
async function ro() {
|
|
5682
|
+
let e = await no();
|
|
5473
5683
|
return Object.keys(e.voices);
|
|
5474
5684
|
}
|
|
5475
|
-
function
|
|
5476
|
-
return
|
|
5685
|
+
function io() {
|
|
5686
|
+
return Za;
|
|
5477
5687
|
}
|
|
5478
5688
|
// src/hooks/voice/useKokoroTTS.ts
|
|
5479
|
-
function
|
|
5689
|
+
function ao(e, t) {
|
|
5480
5690
|
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);
|
|
5481
5691
|
T(() => {
|
|
5482
5692
|
t?.autoPreload && !i && _();
|
|
@@ -5490,10 +5700,10 @@ function Xa(e, t) {
|
|
|
5490
5700
|
m.current &&= (m.current.pause(), m.current.src.startsWith("blob:") && URL.revokeObjectURL(m.current.src), null), h.current?.abort(), h.current = null;
|
|
5491
5701
|
}, []), _ = C(async () => {
|
|
5492
5702
|
try {
|
|
5493
|
-
r("loading"), d(null), p(null), await
|
|
5703
|
+
r("loading"), d(null), p(null), await to((e) => {
|
|
5494
5704
|
p(e);
|
|
5495
5705
|
});
|
|
5496
|
-
let e = await
|
|
5706
|
+
let e = await ro();
|
|
5497
5707
|
s(e), e.length && !e.includes(c) && l(e[0]), a(!0), r("idle");
|
|
5498
5708
|
} catch (e) {
|
|
5499
5709
|
let t = e instanceof Error ? e.message : "Failed to load model";
|
|
@@ -5515,7 +5725,7 @@ function Xa(e, t) {
|
|
|
5515
5725
|
g(), r("generating"), d(null);
|
|
5516
5726
|
let t = new AbortController();
|
|
5517
5727
|
h.current = t;
|
|
5518
|
-
let n = (await (await
|
|
5728
|
+
let n = (await (await no()).generate(e.slice(0, 5e3), { voice: c })).toWav(), i = new Blob([n], { type: "audio/wav" }), a = URL.createObjectURL(i), o = new Audio(a);
|
|
5519
5729
|
m.current = o, o.onended = () => {
|
|
5520
5730
|
r("idle"), URL.revokeObjectURL(a), m.current = null;
|
|
5521
5731
|
}, o.onerror = () => {
|
|
@@ -5540,11 +5750,11 @@ function Xa(e, t) {
|
|
|
5540
5750
|
changeVoice: C((e) => {
|
|
5541
5751
|
l(e), localStorage.setItem("kokoroVoice", e);
|
|
5542
5752
|
}, []),
|
|
5543
|
-
backend:
|
|
5753
|
+
backend: io()
|
|
5544
5754
|
};
|
|
5545
5755
|
}
|
|
5546
5756
|
// src/hooks/voice/useTextToVoice.ts
|
|
5547
|
-
function
|
|
5757
|
+
function oo(e, t) {
|
|
5548
5758
|
let [n, r] = O("stopped"), [i, a] = O(!1), o = D(null), s = D(null), c = D(null), l = D(t);
|
|
5549
5759
|
l.current = t;
|
|
5550
5760
|
let u = C(() => {
|
|
@@ -5576,7 +5786,7 @@ function Za(e, t) {
|
|
|
5576
5786
|
try {
|
|
5577
5787
|
let n = localStorage.getItem("useTTSKokoro");
|
|
5578
5788
|
if (n === null || n !== "false") try {
|
|
5579
|
-
let t = await
|
|
5789
|
+
let t = await no((e) => {
|
|
5580
5790
|
(e.status === "progress_total" || e.status === "progress" || e.status === "download") && console.log(`[Kokoro] Loading: ${Math.round(e.progress ?? 0)}%`);
|
|
5581
5791
|
}), 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);
|
|
5582
5792
|
o.current = l, l.onended = () => {
|
|
@@ -5619,7 +5829,7 @@ function Za(e, t) {
|
|
|
5619
5829
|
};
|
|
5620
5830
|
}
|
|
5621
5831
|
// src/components/VoiceSettings/KokoroVoiceSelector.tsx
|
|
5622
|
-
var
|
|
5832
|
+
var so = {
|
|
5623
5833
|
af_heart: "American Female - Heart",
|
|
5624
5834
|
af_bella: "American Female - Bella",
|
|
5625
5835
|
af_nicole: "American Female - Nicole",
|
|
@@ -5631,8 +5841,8 @@ var Qa = {
|
|
|
5631
5841
|
bm_george: "British Male - George",
|
|
5632
5842
|
bm_thomas: "British Male - Thomas"
|
|
5633
5843
|
};
|
|
5634
|
-
function
|
|
5635
|
-
let { status: t, modelReady: n, voices: r, selectedVoice: i, error: o, progress: c, warmupModel: u, changeVoice: d, backend: f } =
|
|
5844
|
+
function co({ preloadOnMount: e = !1 }) {
|
|
5845
|
+
let { status: t, modelReady: n, voices: r, selectedVoice: i, error: o, progress: c, warmupModel: u, changeVoice: d, backend: f } = ao("", { autoPreload: e }), [p, m] = O(!1), g = t === "loading", _ = t === "error";
|
|
5636
5846
|
return /* @__PURE__ */ F("div", {
|
|
5637
5847
|
className: "flex flex-col gap-3",
|
|
5638
5848
|
children: [/* @__PURE__ */ F("div", {
|
|
@@ -5647,7 +5857,7 @@ function $a({ preloadOnMount: e = !1 }) {
|
|
|
5647
5857
|
children: g ? /* @__PURE__ */ P(W, {
|
|
5648
5858
|
size: 18,
|
|
5649
5859
|
className: "animate-spin"
|
|
5650
|
-
}) : /* @__PURE__ */ P(
|
|
5860
|
+
}) : /* @__PURE__ */ P(pe, { size: 18 })
|
|
5651
5861
|
})
|
|
5652
5862
|
}), /* @__PURE__ */ P(a, {
|
|
5653
5863
|
side: "bottom",
|
|
@@ -5677,7 +5887,7 @@ function $a({ preloadOnMount: e = !1 }) {
|
|
|
5677
5887
|
}),
|
|
5678
5888
|
_ && /* @__PURE__ */ F(l, { children: [/* @__PURE__ */ P(s, {
|
|
5679
5889
|
asChild: !0,
|
|
5680
|
-
children: /* @__PURE__ */ P(
|
|
5890
|
+
children: /* @__PURE__ */ P(R, {
|
|
5681
5891
|
size: 18,
|
|
5682
5892
|
className: "text-red-500"
|
|
5683
5893
|
})
|
|
@@ -5694,7 +5904,7 @@ function $a({ preloadOnMount: e = !1 }) {
|
|
|
5694
5904
|
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",
|
|
5695
5905
|
children: /* @__PURE__ */ F("div", {
|
|
5696
5906
|
className: "flex items-center gap-2",
|
|
5697
|
-
children: [/* @__PURE__ */ P(
|
|
5907
|
+
children: [/* @__PURE__ */ P(nt, { size: 16 }), so[i] || i]
|
|
5698
5908
|
})
|
|
5699
5909
|
}), p && /* @__PURE__ */ P("div", {
|
|
5700
5910
|
className: "grid grid-cols-2 gap-2 p-2 bg-white/5 dark:bg-black/5 rounded-md max-h-64 overflow-y-auto",
|
|
@@ -5703,23 +5913,23 @@ function $a({ preloadOnMount: e = !1 }) {
|
|
|
5703
5913
|
d(e), m(!1);
|
|
5704
5914
|
},
|
|
5705
5915
|
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"),
|
|
5706
|
-
children:
|
|
5916
|
+
children: so[e] || e
|
|
5707
5917
|
}, e))
|
|
5708
5918
|
})]
|
|
5709
5919
|
})]
|
|
5710
5920
|
});
|
|
5711
5921
|
}
|
|
5712
5922
|
// src/components/VoiceSettings/VoiceSettingsPanel.tsx
|
|
5713
|
-
function
|
|
5923
|
+
function lo() {
|
|
5714
5924
|
let [e, t] = O(!1), [n, r] = O(() => {
|
|
5715
5925
|
let e = localStorage.getItem("useTTSKokoro");
|
|
5716
5926
|
return e === null || e !== "false";
|
|
5717
|
-
}), [i, o] = O(() => localStorage.getItem("ttsSpeaker") || "angus"), [c, u] = O(() =>
|
|
5927
|
+
}), [i, o] = O(() => localStorage.getItem("ttsSpeaker") || "angus"), [c, u] = O(() => kn()), { start: d, speechStatus: f } = oo("This is a preview of the selected voice.", { enableInterrupt: !1 }), p = (e) => {
|
|
5718
5928
|
r(e), localStorage.setItem("useTTSKokoro", String(e));
|
|
5719
5929
|
}, m = (e) => {
|
|
5720
5930
|
o(e), localStorage.setItem("ttsSpeaker", e);
|
|
5721
5931
|
}, g = (e) => {
|
|
5722
|
-
u(e),
|
|
5932
|
+
u(e), An(e);
|
|
5723
5933
|
};
|
|
5724
5934
|
return /* @__PURE__ */ F("div", {
|
|
5725
5935
|
className: "space-y-4",
|
|
@@ -5727,7 +5937,7 @@ function eo() {
|
|
|
5727
5937
|
className: "flex items-center justify-between",
|
|
5728
5938
|
children: [/* @__PURE__ */ F("div", {
|
|
5729
5939
|
className: "flex items-center gap-2",
|
|
5730
|
-
children: [/* @__PURE__ */ P(
|
|
5940
|
+
children: [/* @__PURE__ */ P(We, { size: 18 }), /* @__PURE__ */ P("h3", {
|
|
5731
5941
|
className: "font-semibold",
|
|
5732
5942
|
children: "Voice Settings"
|
|
5733
5943
|
})]
|
|
@@ -5766,7 +5976,7 @@ function eo() {
|
|
|
5766
5976
|
children: "Runs locally in your browser. No server requests, lower latency, and multiple voice options."
|
|
5767
5977
|
})] })
|
|
5768
5978
|
]
|
|
5769
|
-
}), n && /* @__PURE__ */ P(
|
|
5979
|
+
}), n && /* @__PURE__ */ P(co, { preloadOnMount: !1 })]
|
|
5770
5980
|
}),
|
|
5771
5981
|
/* @__PURE__ */ F("div", {
|
|
5772
5982
|
className: "space-y-2",
|
|
@@ -5823,7 +6033,7 @@ function eo() {
|
|
|
5823
6033
|
onClick: () => d(),
|
|
5824
6034
|
disabled: f === "started",
|
|
5825
6035
|
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"),
|
|
5826
|
-
children: [/* @__PURE__ */ P(
|
|
6036
|
+
children: [/* @__PURE__ */ P(nt, { size: 16 }), f === "started" ? "Playing..." : "Preview"]
|
|
5827
6037
|
})]
|
|
5828
6038
|
})]
|
|
5829
6039
|
}),
|
|
@@ -5865,18 +6075,18 @@ function eo() {
|
|
|
5865
6075
|
});
|
|
5866
6076
|
}
|
|
5867
6077
|
// src/icons/icon-read.svg
|
|
5868
|
-
var
|
|
6078
|
+
var uo = "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", fo = "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";
|
|
5869
6079
|
// src/app/CategoryDock.tsx
|
|
5870
|
-
function
|
|
5871
|
-
let e = A(), r = j(), { isAuthenticated: i, signIn: a, signOut: o } = n(), { newChat: s } = u(), { activeView: c, setActiveView: l, docsEnabled: d, requestFilesSidebar: f } =
|
|
6080
|
+
function po() {
|
|
6081
|
+
let e = A(), r = j(), { isAuthenticated: i, signIn: a, signOut: o } = n(), { newChat: s } = u(), { activeView: c, setActiveView: l, docsEnabled: d, requestFilesSidebar: f } = wa(), p = [{
|
|
5872
6082
|
href: "/",
|
|
5873
6083
|
label: "Research",
|
|
5874
6084
|
icon: t.appIconUrl
|
|
5875
6085
|
}, ...d ? [{
|
|
5876
6086
|
href: "/workspace",
|
|
5877
6087
|
label: "Docs",
|
|
5878
|
-
icon: /* @__PURE__ */ P(
|
|
5879
|
-
src:
|
|
6088
|
+
icon: /* @__PURE__ */ P(Bt, {
|
|
6089
|
+
src: uo,
|
|
5880
6090
|
alt: "Docs",
|
|
5881
6091
|
width: 24,
|
|
5882
6092
|
height: 24,
|
|
@@ -5896,7 +6106,7 @@ function ro() {
|
|
|
5896
6106
|
...d ? [{
|
|
5897
6107
|
key: "files",
|
|
5898
6108
|
label: "Files",
|
|
5899
|
-
icon: /* @__PURE__ */ P(
|
|
6109
|
+
icon: /* @__PURE__ */ P(ye, { className: "w-full h-full p-1" }),
|
|
5900
6110
|
onClick: () => {
|
|
5901
6111
|
l("docs"), f();
|
|
5902
6112
|
}
|
|
@@ -5904,8 +6114,8 @@ function ro() {
|
|
|
5904
6114
|
{
|
|
5905
6115
|
key: "settings",
|
|
5906
6116
|
label: "Settings",
|
|
5907
|
-
icon: /* @__PURE__ */ P(
|
|
5908
|
-
src:
|
|
6117
|
+
icon: /* @__PURE__ */ P(Bt, {
|
|
6118
|
+
src: fo,
|
|
5909
6119
|
alt: "Settings",
|
|
5910
6120
|
width: 24,
|
|
5911
6121
|
height: 24,
|
|
@@ -5913,11 +6123,11 @@ function ro() {
|
|
|
5913
6123
|
className: "w-full h-full"
|
|
5914
6124
|
}),
|
|
5915
6125
|
menu: { renderContent: () => /* @__PURE__ */ F(N, { children: [
|
|
5916
|
-
/* @__PURE__ */ F(
|
|
5917
|
-
onClick: () =>
|
|
6126
|
+
/* @__PURE__ */ F(Lt, {
|
|
6127
|
+
onClick: () => Ua(),
|
|
5918
6128
|
className: "cursor-pointer py-1 h-7",
|
|
5919
6129
|
children: [
|
|
5920
|
-
/* @__PURE__ */ P(
|
|
6130
|
+
/* @__PURE__ */ P(He, { className: "mr-2 h-3.5 w-3.5" }),
|
|
5921
6131
|
/* @__PURE__ */ P("span", {
|
|
5922
6132
|
className: "text-sm",
|
|
5923
6133
|
children: "Search"
|
|
@@ -5928,36 +6138,36 @@ function ro() {
|
|
|
5928
6138
|
})
|
|
5929
6139
|
]
|
|
5930
6140
|
}),
|
|
5931
|
-
/* @__PURE__ */ F(
|
|
6141
|
+
/* @__PURE__ */ F(Lt, {
|
|
5932
6142
|
onClick: () => {
|
|
5933
6143
|
t.onOpenSettings?.() || r.push("/settings");
|
|
5934
6144
|
},
|
|
5935
6145
|
className: "cursor-pointer py-1 h-7",
|
|
5936
|
-
children: [/* @__PURE__ */ P(
|
|
6146
|
+
children: [/* @__PURE__ */ P(Ue, { className: "mr-2 h-3.5 w-3.5" }), /* @__PURE__ */ P("span", {
|
|
5937
6147
|
className: "text-sm",
|
|
5938
6148
|
children: "Settings"
|
|
5939
6149
|
})]
|
|
5940
6150
|
}),
|
|
5941
|
-
i ? /* @__PURE__ */ F(
|
|
6151
|
+
i ? /* @__PURE__ */ F(Lt, {
|
|
5942
6152
|
onClick: () => o(),
|
|
5943
6153
|
className: "cursor-pointer py-1 h-7",
|
|
5944
|
-
children: [/* @__PURE__ */ P(
|
|
6154
|
+
children: [/* @__PURE__ */ P(je, { className: "mr-2 h-3.5 w-3.5" }), /* @__PURE__ */ P("span", {
|
|
5945
6155
|
className: "text-sm",
|
|
5946
6156
|
children: "Logout"
|
|
5947
6157
|
})]
|
|
5948
|
-
}) : /* @__PURE__ */ F(
|
|
6158
|
+
}) : /* @__PURE__ */ F(Lt, {
|
|
5949
6159
|
onClick: () => a(),
|
|
5950
6160
|
className: "cursor-pointer py-1 h-7",
|
|
5951
|
-
children: [/* @__PURE__ */ P(
|
|
6161
|
+
children: [/* @__PURE__ */ P(Ae, { className: "mr-2 h-3.5 w-3.5" }), /* @__PURE__ */ P("span", {
|
|
5952
6162
|
className: "text-sm",
|
|
5953
6163
|
children: "Login"
|
|
5954
6164
|
})]
|
|
5955
6165
|
}),
|
|
5956
|
-
/* @__PURE__ */ P(
|
|
5957
|
-
/* @__PURE__ */ P(
|
|
6166
|
+
/* @__PURE__ */ P(Rt, {}),
|
|
6167
|
+
/* @__PURE__ */ P(zt, {})
|
|
5958
6168
|
] }) }
|
|
5959
6169
|
}
|
|
5960
|
-
], g = h.filter((e) => e.key !== "files"), _ = (e, t, n) => /* @__PURE__ */ P(
|
|
6170
|
+
], g = h.filter((e) => e.key !== "files"), _ = (e, t, n) => /* @__PURE__ */ P(Bt, {
|
|
5961
6171
|
src: e,
|
|
5962
6172
|
alt: t,
|
|
5963
6173
|
width: n,
|
|
@@ -5965,7 +6175,7 @@ function ro() {
|
|
|
5965
6175
|
unoptimized: !0,
|
|
5966
6176
|
className: "w-full h-full"
|
|
5967
6177
|
});
|
|
5968
|
-
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
6178
|
+
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(Ft, {
|
|
5969
6179
|
items: g,
|
|
5970
6180
|
enableKeyboardShortcuts: !0,
|
|
5971
6181
|
placements: {
|
|
@@ -5973,7 +6183,7 @@ function ro() {
|
|
|
5973
6183
|
mobile: !1
|
|
5974
6184
|
},
|
|
5975
6185
|
renderImage: _
|
|
5976
|
-
}), /* @__PURE__ */ P(
|
|
6186
|
+
}), /* @__PURE__ */ P(Ft, {
|
|
5977
6187
|
items: h,
|
|
5978
6188
|
placements: {
|
|
5979
6189
|
desktop: !1,
|
|
@@ -5984,42 +6194,42 @@ function ro() {
|
|
|
5984
6194
|
})] });
|
|
5985
6195
|
}
|
|
5986
6196
|
// src/app/CookieConsent.tsx
|
|
5987
|
-
function
|
|
5988
|
-
return /* @__PURE__ */ P(
|
|
6197
|
+
function mo() {
|
|
6198
|
+
return /* @__PURE__ */ P(Vt, {
|
|
5989
6199
|
appName: t.appName,
|
|
5990
6200
|
links: t.footerLinks,
|
|
5991
6201
|
heightVar: "--qs-bottom-right-inset"
|
|
5992
6202
|
});
|
|
5993
6203
|
}
|
|
5994
6204
|
// src/app/useChunkErrorReload.ts
|
|
5995
|
-
var
|
|
5996
|
-
function
|
|
5997
|
-
if (typeof e == "string") return
|
|
6205
|
+
var ho = "qwk:chunk-error-reload", go = 6e4, _o = /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;
|
|
6206
|
+
function vo(e) {
|
|
6207
|
+
if (typeof e == "string") return _o.test(e);
|
|
5998
6208
|
if (e && typeof e == "object") {
|
|
5999
6209
|
let { name: t, message: n } = e;
|
|
6000
|
-
return t === "ChunkLoadError" || typeof n == "string" &&
|
|
6210
|
+
return t === "ChunkLoadError" || typeof n == "string" && _o.test(n);
|
|
6001
6211
|
}
|
|
6002
6212
|
return !1;
|
|
6003
6213
|
}
|
|
6004
|
-
function
|
|
6005
|
-
if (typeof window > "u" || !
|
|
6214
|
+
function yo(e) {
|
|
6215
|
+
if (typeof window > "u" || !vo(e)) return !1;
|
|
6006
6216
|
try {
|
|
6007
|
-
let e = Number(window.sessionStorage.getItem(
|
|
6008
|
-
if (e && Date.now() - e <
|
|
6009
|
-
window.sessionStorage.setItem(
|
|
6217
|
+
let e = Number(window.sessionStorage.getItem(ho));
|
|
6218
|
+
if (e && Date.now() - e < go) return !1;
|
|
6219
|
+
window.sessionStorage.setItem(ho, String(Date.now()));
|
|
6010
6220
|
} catch {
|
|
6011
6221
|
return !1;
|
|
6012
6222
|
}
|
|
6013
6223
|
return window.location.reload(), !0;
|
|
6014
6224
|
}
|
|
6015
|
-
function
|
|
6225
|
+
function bo() {
|
|
6016
6226
|
T(() => {
|
|
6017
6227
|
let e = (e) => {
|
|
6018
|
-
|
|
6228
|
+
yo(e.error ?? e.message);
|
|
6019
6229
|
}, t = (e) => {
|
|
6020
|
-
|
|
6230
|
+
yo(e.reason);
|
|
6021
6231
|
}, n = (e) => {
|
|
6022
|
-
|
|
6232
|
+
yo(e.payload ?? "Loading chunk") && e.preventDefault();
|
|
6023
6233
|
};
|
|
6024
6234
|
return window.addEventListener("error", e), window.addEventListener("unhandledrejection", t), window.addEventListener("vite:preloadError", n), () => {
|
|
6025
6235
|
window.removeEventListener("error", e), window.removeEventListener("unhandledrejection", t), window.removeEventListener("vite:preloadError", n);
|
|
@@ -6027,8 +6237,8 @@ function uo() {
|
|
|
6027
6237
|
}, []);
|
|
6028
6238
|
}
|
|
6029
6239
|
// src/app/QwkSearchProviders.tsx
|
|
6030
|
-
var
|
|
6031
|
-
function
|
|
6240
|
+
var xo = ({ children: e }) => /* @__PURE__ */ P(N, { children: e });
|
|
6241
|
+
function So(e) {
|
|
6032
6242
|
let [t, n] = O(e === !0);
|
|
6033
6243
|
return T(() => {
|
|
6034
6244
|
if (e !== "auto") {
|
|
@@ -6045,10 +6255,10 @@ function po(e) {
|
|
|
6045
6255
|
};
|
|
6046
6256
|
}, [e]), t;
|
|
6047
6257
|
}
|
|
6048
|
-
function
|
|
6258
|
+
function Co({ children: t, authClient: n, config: i, googleOneTap: a = "auto", docsEnabled: o = !0, ChromeProvider: s = xo, showDock: l = !0, showCookieConsent: u = !0, showToaster: d = !0, showSpotlight: f = !0 }) {
|
|
6049
6259
|
i && e(i);
|
|
6050
|
-
let p =
|
|
6051
|
-
return
|
|
6260
|
+
let p = So(a);
|
|
6261
|
+
return bo(), /* @__PURE__ */ P(Pt, {
|
|
6052
6262
|
attribute: "class",
|
|
6053
6263
|
defaultTheme: "system",
|
|
6054
6264
|
enableSystem: !0,
|
|
@@ -6056,54 +6266,54 @@ function mo({ children: t, authClient: n, config: i, googleOneTap: a = "auto", d
|
|
|
6056
6266
|
children: /* @__PURE__ */ P(c, {
|
|
6057
6267
|
authClient: n,
|
|
6058
6268
|
enableGoogleOneTap: p,
|
|
6059
|
-
children: /* @__PURE__ */ P(r, { children: /* @__PURE__ */ P(
|
|
6269
|
+
children: /* @__PURE__ */ P(r, { children: /* @__PURE__ */ P(Cn, { children: /* @__PURE__ */ P(xa, {
|
|
6060
6270
|
docsEnabled: o,
|
|
6061
|
-
children: /* @__PURE__ */ P(
|
|
6271
|
+
children: /* @__PURE__ */ P(It, { children: /* @__PURE__ */ F(s, { children: [
|
|
6062
6272
|
/* @__PURE__ */ F("div", {
|
|
6063
6273
|
id: "app-scroll-root",
|
|
6064
6274
|
className: "w-screen h-screen overflow-y-auto overflow-x-hidden pb-[calc(60px+env(safe-area-inset-bottom,0px))] md:pb-0",
|
|
6065
|
-
children: [l && /* @__PURE__ */ P(
|
|
6275
|
+
children: [l && /* @__PURE__ */ P(po, {}), /* @__PURE__ */ P("main", {
|
|
6066
6276
|
className: "bg-light-primary dark:bg-dark-primary min-h-screen",
|
|
6067
6277
|
children: t
|
|
6068
6278
|
})]
|
|
6069
6279
|
}),
|
|
6070
|
-
d && /* @__PURE__ */ P(
|
|
6280
|
+
d && /* @__PURE__ */ P(ot, { toastOptions: {
|
|
6071
6281
|
unstyled: !0,
|
|
6072
6282
|
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" }
|
|
6073
6283
|
} }),
|
|
6074
|
-
u && /* @__PURE__ */ P(
|
|
6075
|
-
f && /* @__PURE__ */ P(
|
|
6284
|
+
u && /* @__PURE__ */ P(mo, {}),
|
|
6285
|
+
f && /* @__PURE__ */ P(Ka, {})
|
|
6076
6286
|
] }) })
|
|
6077
6287
|
}) }) })
|
|
6078
6288
|
})
|
|
6079
6289
|
});
|
|
6080
6290
|
}
|
|
6081
6291
|
// src/app/QwkSearchApp.tsx
|
|
6082
|
-
function
|
|
6083
|
-
return /* @__PURE__ */ P(
|
|
6292
|
+
function wo(e) {
|
|
6293
|
+
return /* @__PURE__ */ P(Co, {
|
|
6084
6294
|
...e,
|
|
6085
6295
|
docsEnabled: !1,
|
|
6086
|
-
children: /* @__PURE__ */ P(
|
|
6296
|
+
children: /* @__PURE__ */ P(Bi, {})
|
|
6087
6297
|
});
|
|
6088
6298
|
}
|
|
6089
6299
|
// src/app/useChatTabs.ts
|
|
6090
|
-
var
|
|
6091
|
-
function
|
|
6300
|
+
var To = "qwksearch-open-chat-tabs", Eo = 50;
|
|
6301
|
+
function Do() {
|
|
6092
6302
|
if (typeof window > "u") return [];
|
|
6093
6303
|
try {
|
|
6094
|
-
let e = window.localStorage.getItem(
|
|
6304
|
+
let e = window.localStorage.getItem(To);
|
|
6095
6305
|
return e ? JSON.parse(e) : [];
|
|
6096
6306
|
} catch {
|
|
6097
6307
|
return [];
|
|
6098
6308
|
}
|
|
6099
6309
|
}
|
|
6100
|
-
function
|
|
6101
|
-
let { chatId: e, chatTurns: t, startNewChat: n, switchToChat: r } = u(), [i, a] = O(
|
|
6310
|
+
function Oo() {
|
|
6311
|
+
let { chatId: e, chatTurns: t, startNewChat: n, switchToChat: r } = u(), [i, a] = O(Do);
|
|
6102
6312
|
T(() => {
|
|
6103
|
-
window.localStorage.setItem(
|
|
6313
|
+
window.localStorage.setItem(To, JSON.stringify(i));
|
|
6104
6314
|
}, [i]), T(() => {
|
|
6105
6315
|
if (!e) return;
|
|
6106
|
-
let n = t[0]?.content?.slice(0,
|
|
6316
|
+
let n = t[0]?.content?.slice(0, Eo), r = t.length > 0;
|
|
6107
6317
|
a((t) => {
|
|
6108
6318
|
let i = t.find((t) => t.id === e);
|
|
6109
6319
|
return i ? n && i.title !== n || i.hasMessages !== r ? t.map((t) => t.id === e ? {
|
|
@@ -6162,4 +6372,4 @@ function yo() {
|
|
|
6162
6372
|
closeChats: l
|
|
6163
6373
|
};
|
|
6164
6374
|
}
|
|
6165
|
-
export {
|
|
6375
|
+
export { Cn as $, Zi as A, $r as B, sa as C, $i as D, ia as E, Gi as F, wr as G, qr as H, qi as I, lr as J, Er as K, Bi as L, Yi as M, Xi as N, ra as O, Ji as P, Un as Q, ui as R, ca as S, aa as T, Rr as U, Xr as V, Tr as W, Wn as X, Hn as Y, X as Z, Pa as _, yo as a, wa as b, po as c, oo as d, xn as et, ao as f, La as g, Na as h, vo as i, Vi as j, ta as k, lo as l, Ua as m, wo as n, bo as o, Ka as p, Dr as q, Co as r, mo as s, Oo as t, J as tt, co as u, Da as v, oa as w, va as x, xa as y, ni as z };
|