research-agent-ui 0.1.35 → 0.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -9,33 +9,33 @@ import { twMerge as v } from "tailwind-merge";
9
9
  import y from "markdown-to-jsx";
10
10
  import * as b from "lucide-react";
11
11
  import { Archive as x, ArrowLeftRight as S, ArrowUp as C, BookMarked as w, Bot as T, BrainCircuit as E, CalendarDays as D, Check as O, CheckIcon as k, ChevronDown as A, ChevronRight as j, ChevronRightIcon as M, ChevronUp as N, Clipboard as P, ClipboardList as F, Clock as I, Cloud as L, CloudIcon as R, Copy as z, Cpu as B, Download as ee, ExternalLink as V, EyeOff as H, File as te, FileDown as ne, FileSpreadsheet as re, FileText as ie, FileType as ae, FolderOpen as oe, Highlighter as se, History as ce, Link as le, Loader2 as U, Lock as ue, MessageCircleQuestion as de, Mic as fe, Paperclip as pe, Pencil as me, Pin as he, Plus as ge, Search as _e, Settings as ve, Share2 as ye, SlidersHorizontal as be, Square as xe, SquarePen as Se, Star as Ce, StopCircle as we, Sun as Te, Trash as Ee, Trash2 as De, Upload as Oe, Video as ke, Volume2 as Ae, X as je, XIcon as Me } from "lucide-react";
12
- import { addFavorite as Ne, agentChat as Pe, agentSearch as Fe, articleFollowups as Ie, articleQa as Le, createDocument as Re, getArticle as ze, getGoogleDriveFile as Be, getGoogleToken as Ve, googleDocsAuth as He, googleDocsAuthStatus as Ue, listFavorites as We, listProviders as Ge, removeFavorite as Ke, shareChat as qe, updateArticle as Je, uploadFiles as Ye } from "qwksearch-api-client";
13
- import { convertURLSafeHTMLToHTML as Xe } from "extract-webpage/html-to-content/html-utils";
14
- import { AnimatePresence as Ze, animate as Qe, motion as $e } from "motion/react";
12
+ import { addFavorite as Ne, agentChat as Pe, agentSearch as Fe, articleFollowups as Ie, articleQa as Le, autocomplete as Re, createDocument as ze, deleteAllChats as Be, deleteChatById as Ve, getArticle as He, getChatById as Ue, getGoogleDriveFile as We, getGoogleToken as Ge, googleDocsAuth as Ke, googleDocsAuthStatus as qe, listChats as Je, listFavorites as Ye, listProviders as Xe, removeFavorite as Ze, saveMessage as Qe, searchChats as $e, shareChat as et, updateArticle as tt, uploadFiles as nt } from "qwksearch-api-client";
13
+ import { convertURLSafeHTMLToHTML as rt } from "extract-webpage/html-to-content/html-utils";
14
+ import { AnimatePresence as it, animate as at, motion as ot } from "motion/react";
15
15
  import { Fragment as W, jsx as G, jsxs as K } from "react/jsx-runtime";
16
- import et from "grab-url";
16
+ import st from "grab-url";
17
17
  import { toast as q } from "sonner";
18
- import * as tt from "@radix-ui/react-tooltip";
18
+ import * as ct from "@radix-ui/react-tooltip";
19
19
  import * as J from "@radix-ui/react-dropdown-menu";
20
- import * as nt from "@radix-ui/react-popover";
21
- import rt from "html2canvas";
22
- import it from "turndown";
23
- import { Slot as at } from "@radix-ui/react-slot";
24
- import { cva as ot } from "class-variance-authority";
25
- import st from "quantum-sphere-loading-icon/react";
26
- import * as ct from "@radix-ui/react-dialog";
27
- import lt from "dompurify";
28
- import ut from "next/link";
29
- import { Streamdown as dt } from "streamdown";
20
+ import * as lt from "@radix-ui/react-popover";
21
+ import ut from "html2canvas";
22
+ import dt from "turndown";
23
+ import { Slot as ft } from "@radix-ui/react-slot";
24
+ import { cva as pt } from "class-variance-authority";
25
+ import mt from "quantum-sphere-loading-icon/react";
26
+ import * as ht from "@radix-ui/react-dialog";
27
+ import gt from "dompurify";
28
+ import _t from "next/link";
29
+ import { Streamdown as vt } from "streamdown";
30
30
  //#region src/lib/utils.ts
31
31
  function Y(...e) {
32
32
  return v(_(e));
33
33
  }
34
- var ft = (e, t) => {
34
+ var yt = (e, t) => {
35
35
  e = new Date(e), t = new Date(t);
36
36
  let n = Math.floor(Math.abs(t.getTime() - e.getTime()) / 1e3);
37
37
  return n < 60 ? `${n} second${n === 1 ? "" : "s"}` : n < 3600 ? `${Math.floor(n / 60)} minute${Math.floor(n / 60) === 1 ? "" : "s"}` : n < 86400 ? `${Math.floor(n / 3600)} hour${Math.floor(n / 3600) === 1 ? "" : "s"}` : n < 31536e3 ? `${Math.floor(n / 86400)} day${Math.floor(n / 86400) === 1 ? "" : "s"}` : `${Math.floor(n / 31536e3)} year${Math.floor(n / 31536e3) === 1 ? "" : "s"}`;
38
- }, pt = s(({ blur: e = 0, inactiveZone: t = .7, proximity: n = 0, spread: r = 20, variant: i = "default", glow: a = !1, className: o, movementDuration: s = 2, borderWidth: l = 1, disabled: d = !0 }) => {
38
+ }, bt = s(({ blur: e = 0, inactiveZone: t = .7, proximity: n = 0, spread: r = 20, variant: i = "default", glow: a = !1, className: o, movementDuration: s = 2, borderWidth: l = 1, disabled: d = !0 }) => {
39
39
  let p = f(null), m = f({
40
40
  x: 0,
41
41
  y: 0
@@ -56,7 +56,7 @@ var ft = (e, t) => {
56
56
  let f = l > i - n && l < i + o + n && u > a - n && u < a + c + n;
57
57
  if (r.style.setProperty("--active", f ? "1" : "0"), !f) return;
58
58
  let h = parseFloat(r.style.getPropertyValue("--start")) || 0;
59
- Qe(h, h + ((180 * Math.atan2(u - d[1], l - d[0]) / Math.PI + 90 - h + 180) % 360 - 180), {
59
+ at(h, h + ((180 * Math.atan2(u - d[1], l - d[0]) / Math.PI + 90 - h + 180) % 360 - 180), {
60
60
  duration: s,
61
61
  ease: [
62
62
  .16,
@@ -95,16 +95,16 @@ var ft = (e, t) => {
95
95
  children: /* @__PURE__ */ G("div", { className: Y("glow", "rounded-[inherit]", "after:content-[\"\"] after:rounded-[inherit] after:absolute after:inset-[calc(-1*var(--glowingeffect-border-width))]", "after:[border:var(--glowingeffect-border-width)_solid_transparent]", "after:[background:var(--gradient)] after:[background-attachment:fixed]", "after:opacity-[var(--active)] after:transition-opacity after:duration-300", "after:[mask-clip:padding-box,border-box]", "after:[mask-composite:intersect]", "after:[mask-image:linear-gradient(#0000,#0000),conic-gradient(from_calc((var(--start)-var(--spread))*1deg),#00000000_0deg,#fff,#00000000_calc(var(--spread)*2deg))]") })
96
96
  })] });
97
97
  });
98
- pt.displayName = "GlowingEffect";
98
+ bt.displayName = "GlowingEffect";
99
99
  //#endregion
100
100
  //#region src/components/ArticleReader/ExtractPanelContext.tsx
101
- var mt = a(void 0), ht = () => {
102
- let e = l(mt);
101
+ var xt = a(void 0), St = () => {
102
+ let e = l(xt);
103
103
  if (!e) throw Error("useExtractPanel must be used within an ExtractPanelProvider");
104
104
  return e;
105
- }, gt = ({ children: e }) => {
105
+ }, Ct = ({ children: e }) => {
106
106
  let [t, n] = p(!1), [r, i] = p(""), [a, o] = p(""), [s, c] = p(600);
107
- return /* @__PURE__ */ G(mt.Provider, {
107
+ return /* @__PURE__ */ G(xt.Provider, {
108
108
  value: {
109
109
  isOpen: t,
110
110
  url: r,
@@ -143,7 +143,7 @@ var mt = a(void 0), ht = () => {
143
143
  };
144
144
  //#endregion
145
145
  //#region src/icons/IconSearchWeb.tsx
146
- function _t(e) {
146
+ function wt(e) {
147
147
  return /* @__PURE__ */ K("svg", {
148
148
  xmlns: "http://www.w3.org/2000/svg",
149
149
  xmlnsXlink: "http://www.w3.org/1999/xlink",
@@ -185,7 +185,7 @@ function _t(e) {
185
185
  }
186
186
  //#endregion
187
187
  //#region src/icons/IconSearchNews.tsx
188
- function vt(e) {
188
+ function Tt(e) {
189
189
  return /* @__PURE__ */ K("svg", {
190
190
  version: "1.1",
191
191
  xmlns: "http://www.w3.org/2000/svg",
@@ -261,7 +261,7 @@ function vt(e) {
261
261
  }
262
262
  //#endregion
263
263
  //#region src/icons/IconSearchVideos.tsx
264
- function yt(e) {
264
+ function Et(e) {
265
265
  return /* @__PURE__ */ K("svg", {
266
266
  version: "1.1",
267
267
  xmlns: "http://www.w3.org/2000/svg",
@@ -502,7 +502,7 @@ function yt(e) {
502
502
  }
503
503
  //#endregion
504
504
  //#region src/icons/IconSearchImages.tsx
505
- function bt(e) {
505
+ function Dt(e) {
506
506
  return /* @__PURE__ */ G("svg", {
507
507
  width: "800px",
508
508
  height: "800px",
@@ -567,7 +567,7 @@ function bt(e) {
567
567
  }
568
568
  //#endregion
569
569
  //#region src/icons/IconSearchAcademic.tsx
570
- function xt(e) {
570
+ function Ot(e) {
571
571
  return /* @__PURE__ */ K("svg", {
572
572
  width: "800px",
573
573
  height: "800px",
@@ -613,7 +613,7 @@ function xt(e) {
613
613
  }
614
614
  //#endregion
615
615
  //#region src/icons/IconSearchFiles.tsx
616
- function St(e) {
616
+ function kt(e) {
617
617
  return /* @__PURE__ */ K("svg", {
618
618
  height: "800px",
619
619
  width: "800px",
@@ -666,7 +666,7 @@ function St(e) {
666
666
  }
667
667
  //#endregion
668
668
  //#region src/icons/IconSearchTech.tsx
669
- function Ct(e) {
669
+ function At(e) {
670
670
  return /* @__PURE__ */ K("svg", {
671
671
  height: "800px",
672
672
  width: "800px",
@@ -793,51 +793,51 @@ function Ct(e) {
793
793
  }
794
794
  //#endregion
795
795
  //#region src/components/SearchConfig/categories.ts
796
- var wt = [
796
+ var jt = [
797
797
  {
798
798
  code: "general",
799
- icon: _t,
799
+ icon: wt,
800
800
  name: "Web"
801
801
  },
802
802
  {
803
803
  code: "news",
804
- icon: vt,
804
+ icon: Tt,
805
805
  name: "News"
806
806
  },
807
807
  {
808
808
  code: "videos",
809
- icon: yt,
809
+ icon: Et,
810
810
  name: "Videos"
811
811
  },
812
812
  {
813
813
  code: "images",
814
- icon: bt,
814
+ icon: Dt,
815
815
  name: "Images"
816
816
  },
817
817
  {
818
818
  code: "science",
819
- icon: xt,
819
+ icon: Ot,
820
820
  name: "Academic"
821
821
  },
822
822
  {
823
823
  code: "files",
824
- icon: St,
824
+ icon: kt,
825
825
  name: "Files"
826
826
  },
827
827
  {
828
828
  code: "it",
829
- icon: Ct,
829
+ icon: At,
830
830
  name: "Tech"
831
831
  }
832
- ], Tt = wt.filter((e) => [
832
+ ], Mt = jt.filter((e) => [
833
833
  "general",
834
834
  "news",
835
835
  "videos",
836
836
  "images",
837
837
  "science",
838
838
  "files"
839
- ].includes(e.code)), Et = ({ sources: e, query: t }) => {
840
- let [n, r] = p("general"), [i, a] = p(e), [o, s] = p(!1), [l, d] = p(!1), [m, h] = p(1), [g, _] = p(!0), [v, y] = p(!1), b = f(null), x = f(!1), S = f(!1), { openPanel: C, isOpen: w } = ht(), [T, E] = p({});
839
+ ].includes(e.code)), Nt = ({ sources: e, query: t }) => {
840
+ let [n, r] = p("general"), [i, a] = p(e), [o, s] = p(!1), [l, d] = p(!1), [m, h] = p(1), [g, _] = p(!0), [v, y] = p(!1), b = f(null), x = f(!1), S = f(!1), { openPanel: C, isOpen: w } = St(), [T, E] = p({});
841
841
  u(() => {
842
842
  let e = () => {
843
843
  y(window.innerWidth >= 1024);
@@ -849,8 +849,8 @@ var wt = [
849
849
  let D = c(async (e) => {
850
850
  let t = e.filter((e) => e.metadata.url && e.metadata.url !== "File" && !e.metadata.iframe_src);
851
851
  for (let e of t) try {
852
- let t = await (await fetch(`/api/doc/article?url=${encodeURIComponent(e.metadata.url)}`)).json();
853
- t.cached && t.article?.html && E((t) => ({
852
+ let { data: t } = await He({ query: { url: e.metadata.url } });
853
+ t?.cached && t?.article?.html && E((t) => ({
854
854
  ...t,
855
855
  [e.metadata.url]: "loaded"
856
856
  }));
@@ -877,7 +877,7 @@ var wt = [
877
877
  [t]: "loading"
878
878
  })), C(t, "");
879
879
  try {
880
- await ze({ query: { url: t } }), E((e) => ({
880
+ await He({ query: { url: t } }), E((e) => ({
881
881
  ...e,
882
882
  [t]: "loaded"
883
883
  }));
@@ -986,7 +986,7 @@ var wt = [
986
986
  className: "absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200",
987
987
  children: [/* @__PURE__ */ G("p", {
988
988
  className: "text-xs text-white line-clamp-2",
989
- children: Xe(e.metadata.title)
989
+ children: rt(e.metadata.title)
990
990
  }), /* @__PURE__ */ G("p", {
991
991
  className: "text-[10px] text-white/70 truncate mt-0.5",
992
992
  children: e.metadata.source
@@ -996,7 +996,7 @@ var wt = [
996
996
  }, t);
997
997
  if (i && a) return /* @__PURE__ */ K("div", {
998
998
  className: "relative rounded-xl",
999
- children: [/* @__PURE__ */ G(pt, {
999
+ children: [/* @__PURE__ */ G(bt, {
1000
1000
  spread: 40,
1001
1001
  glow: !0,
1002
1002
  disabled: !1,
@@ -1026,14 +1026,14 @@ var wt = [
1026
1026
  })]
1027
1027
  }), /* @__PURE__ */ G("p", {
1028
1028
  className: "text-xs line-clamp-2 p-2 text-muted-foreground",
1029
- children: Xe(e.metadata.title)
1029
+ children: rt(e.metadata.title)
1030
1030
  })]
1031
1031
  })]
1032
1032
  }, t);
1033
1033
  let o = T[e.metadata.url];
1034
1034
  return /* @__PURE__ */ K("div", {
1035
1035
  className: "relative rounded-xl group h-full",
1036
- children: [/* @__PURE__ */ G(pt, {
1036
+ children: [/* @__PURE__ */ G(bt, {
1037
1037
  spread: 40,
1038
1038
  glow: !0,
1039
1039
  disabled: !1,
@@ -1088,7 +1088,7 @@ var wt = [
1088
1088
  " ",
1089
1089
  /* @__PURE__ */ G("span", {
1090
1090
  className: "align-middle",
1091
- children: Xe(e.metadata.title)
1091
+ children: rt(e.metadata.title)
1092
1092
  })
1093
1093
  ]
1094
1094
  })
@@ -1098,7 +1098,7 @@ var wt = [
1098
1098
  };
1099
1099
  return /* @__PURE__ */ K(W, { children: [t && /* @__PURE__ */ G("div", {
1100
1100
  className: "flex items-center gap-1 mb-3 overflow-x-auto pb-1",
1101
- children: Tt.map((e) => /* @__PURE__ */ K("button", {
1101
+ children: Mt.map((e) => /* @__PURE__ */ K("button", {
1102
1102
  onClick: () => A(e.code),
1103
1103
  disabled: o,
1104
1104
  className: Y("flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-all duration-200 whitespace-nowrap", n === e.code ? "bg-primary text-primary-foreground" : "bg-secondary/50 text-muted-foreground hover:bg-secondary hover:text-foreground"),
@@ -1128,7 +1128,7 @@ var wt = [
1128
1128
  children: "No results found"
1129
1129
  })
1130
1130
  })] });
1131
- }, Dt = {
1131
+ }, Pt = {
1132
1132
  extract: "Extract",
1133
1133
  arxiv: "ArXiv",
1134
1134
  "google scholar": "Scholar",
@@ -1137,10 +1137,10 @@ var wt = [
1137
1137
  youtube: "YouTube",
1138
1138
  Web: "Web"
1139
1139
  };
1140
- function Ot(e) {
1141
- return e ? Dt[e] ?? e : "Web";
1140
+ function Ft(e) {
1141
+ return e ? Pt[e] ?? e : "Web";
1142
1142
  }
1143
- function kt({ queries: e, loading: t }) {
1143
+ function It({ queries: e, loading: t }) {
1144
1144
  let n = e.filter((e) => e.status === "done").length, r = e.length, i = t && e.some((e) => e.status === "running");
1145
1145
  return t ? /* @__PURE__ */ K("div", {
1146
1146
  className: "rounded-xl border border-border bg-secondary/20 overflow-hidden text-sm",
@@ -1169,7 +1169,7 @@ function kt({ queries: e, loading: t }) {
1169
1169
  className: "flex items-baseline gap-1.5 min-w-0 flex-1",
1170
1170
  children: [/* @__PURE__ */ K("span", {
1171
1171
  className: "text-xs text-muted-foreground whitespace-nowrap flex-shrink-0",
1172
- children: [Ot(e.category), " ·"]
1172
+ children: [Ft(e.category), " ·"]
1173
1173
  }), /* @__PURE__ */ G("span", {
1174
1174
  className: "text-foreground/80 truncate",
1175
1175
  children: e.query
@@ -1181,7 +1181,7 @@ function kt({ queries: e, loading: t }) {
1181
1181
  }
1182
1182
  //#endregion
1183
1183
  //#region src/hooks/voice/useTextToVoice.ts
1184
- function At(e, t) {
1184
+ function Lt(e, t) {
1185
1185
  let [n, r] = p("stopped"), i = f(null), a = f(null), o = f(null), s = f(t);
1186
1186
  s.current = t;
1187
1187
  let l = c(() => {
@@ -1208,7 +1208,7 @@ function At(e, t) {
1208
1208
  let t = new AbortController();
1209
1209
  o.current = t;
1210
1210
  try {
1211
- let n = await et("/api/agent/tts", {
1211
+ let n = await st("/api/agent/tts", {
1212
1212
  method: "POST",
1213
1213
  body: {
1214
1214
  text: e.slice(0, 5e3),
@@ -1241,8 +1241,8 @@ function At(e, t) {
1241
1241
  }
1242
1242
  //#endregion
1243
1243
  //#region src/hooks/useChat/chatConfig.ts
1244
- var jt = async (e, t, n) => {
1245
- let r = localStorage.getItem("chatModelKey"), i = localStorage.getItem("chatModelProviderId"), a = (await et("/api/agent/providers"))?.providers || [];
1244
+ var Rt = async (e, t, n) => {
1245
+ let r = localStorage.getItem("chatModelKey"), i = localStorage.getItem("chatModelProviderId"), a = (await st("/api/agent/providers"))?.providers || [];
1246
1246
  if (!a || a.length === 0) {
1247
1247
  t(!0);
1248
1248
  return;
@@ -1262,47 +1262,47 @@ var jt = async (e, t, n) => {
1262
1262
  key: r,
1263
1263
  providerId: i
1264
1264
  }), t(!0);
1265
- }, Mt = "qwksearch_guest_chats", Nt = typeof window < "u";
1266
- function Pt() {
1267
- if (!Nt) return [];
1265
+ }, zt = "qwksearch_guest_chats", Bt = typeof window < "u";
1266
+ function Vt() {
1267
+ if (!Bt) return [];
1268
1268
  try {
1269
- let e = localStorage.getItem(Mt);
1269
+ let e = localStorage.getItem(zt);
1270
1270
  return e ? JSON.parse(e).sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime()) : [];
1271
1271
  } catch (e) {
1272
1272
  return console.error("Failed to get guest chats:", e), [];
1273
1273
  }
1274
1274
  }
1275
- function Ft(e) {
1276
- return Nt && Pt().find((t) => t.id === e) || null;
1275
+ function Ht(e) {
1276
+ return Bt && Vt().find((t) => t.id === e) || null;
1277
1277
  }
1278
- function It(e) {
1279
- if (Nt) try {
1280
- let t = Pt(), n = t.findIndex((t) => t.id === e.id);
1281
- n >= 0 ? t[n] = e : t.push(e), localStorage.setItem(Mt, JSON.stringify(t));
1278
+ function Ut(e) {
1279
+ if (Bt) try {
1280
+ let t = Vt(), n = t.findIndex((t) => t.id === e.id);
1281
+ n >= 0 ? t[n] = e : t.push(e), localStorage.setItem(zt, JSON.stringify(t));
1282
1282
  } catch (e) {
1283
1283
  console.error("Failed to save guest chat:", e);
1284
1284
  }
1285
1285
  }
1286
- function Lt(e) {
1287
- if (Nt) try {
1288
- let t = Pt().filter((t) => t.id !== e);
1289
- localStorage.setItem(Mt, JSON.stringify(t));
1286
+ function Wt(e) {
1287
+ if (Bt) try {
1288
+ let t = Vt().filter((t) => t.id !== e);
1289
+ localStorage.setItem(zt, JSON.stringify(t));
1290
1290
  } catch (e) {
1291
1291
  console.error("Failed to delete guest chat:", e);
1292
1292
  }
1293
1293
  }
1294
- function Rt() {
1295
- if (Nt) try {
1296
- localStorage.removeItem(Mt);
1294
+ function Gt() {
1295
+ if (Bt) try {
1296
+ localStorage.removeItem(zt);
1297
1297
  } catch (e) {
1298
1298
  console.error("Failed to clear guest chats:", e);
1299
1299
  }
1300
1300
  }
1301
1301
  //#endregion
1302
1302
  //#region src/hooks/useChat/chatMessages.ts
1303
- var zt = async (e, t, n, r, i, a, o, s, c) => {
1303
+ var Kt = async (e, t, n, r, i, a, o, s, c) => {
1304
1304
  if (!t) {
1305
- let t = Ft(e);
1305
+ let t = Ht(e);
1306
1306
  if (t) {
1307
1307
  n(t.messages);
1308
1308
  let e = t.messages.filter((e) => e.role === "user" || e.role === "assistant"), o = e.map((e) => [e.role, e.content]);
@@ -1310,28 +1310,29 @@ var zt = async (e, t, n, r, i, a, o, s, c) => {
1310
1310
  return;
1311
1311
  }
1312
1312
  try {
1313
- let t = await fetch(`/api/agent/chats/${e}`, { headers: { "Content-Type": "application/json" } });
1314
- if (!t.ok) {
1315
- if (t.status === 404 || t.status === 403) {
1313
+ let { data: t, error: l } = await Ue({ path: { id: e } });
1314
+ if (l) {
1315
+ let e = l.status;
1316
+ if (e === 404 || e === 403) {
1316
1317
  o(!0), r(!0);
1317
1318
  return;
1318
1319
  }
1319
- throw Error(`HTTP ${t.status}: ${t.statusText}`);
1320
+ throw Error(`Failed to load chat: ${l.message}`);
1320
1321
  }
1321
- let { messages: l, chat: u } = await t.json();
1322
- if (!l || !u) {
1322
+ let { messages: u, chat: d } = t || {};
1323
+ if (!u || !d) {
1323
1324
  o(!0), r(!0);
1324
1325
  return;
1325
1326
  }
1326
- n(l);
1327
- let d = l.filter((e) => e.role === "user" || e.role === "assistant"), f = d.map((e) => [e.role, e.content]);
1328
- d.length > 0 && (document.title = d[0].content);
1329
- let p = u.files.map((e) => ({
1327
+ n(u);
1328
+ let f = u.filter((e) => e.role === "user" || e.role === "assistant"), p = f.map((e) => [e.role, e.content]);
1329
+ f.length > 0 && (document.title = f[0].content);
1330
+ let m = d.files.map((e) => ({
1330
1331
  fileName: e.name,
1331
1332
  fileExtension: e.name.split(".").pop(),
1332
1333
  fileId: e.fileId
1333
1334
  }));
1334
- s(p), c(p.map((e) => e.fileId)), i(f), a(u.focusMode), r(!0);
1335
+ s(m), c(m.map((e) => e.fileId)), i(p), a(d.focusMode), r(!0);
1335
1336
  return;
1336
1337
  } catch (e) {
1337
1338
  console.error("[chatMessages] Failed to load public chat:", e), o(!0), r(!0);
@@ -1339,35 +1340,33 @@ var zt = async (e, t, n, r, i, a, o, s, c) => {
1339
1340
  }
1340
1341
  }
1341
1342
  try {
1342
- let t = await fetch(`/api/agent/chats/${e}`, {
1343
- credentials: "include",
1344
- headers: { "Content-Type": "application/json" }
1345
- });
1346
- if (!t.ok) {
1347
- if (t.status === 404 || t.status === 401 || t.status === 403) {
1343
+ let { data: t, error: l } = await Ue({ path: { id: e } });
1344
+ if (l) {
1345
+ let e = l.status;
1346
+ if (e === 404 || e === 401 || e === 403) {
1348
1347
  o(!0), r(!0);
1349
1348
  return;
1350
1349
  }
1351
- throw Error(`HTTP ${t.status}: ${t.statusText}`);
1350
+ throw Error(`Failed to load chat: ${l.message}`);
1352
1351
  }
1353
- let { messages: l, chat: u } = await t.json();
1354
- if (!l || !u) {
1352
+ let { messages: u, chat: d } = t || {};
1353
+ if (!u || !d) {
1355
1354
  o(!0), r(!0);
1356
1355
  return;
1357
1356
  }
1358
- n(l);
1359
- let d = l.filter((e) => e.role === "user" || e.role === "assistant"), f = d.map((e) => [e.role, e.content]);
1360
- console.debug(/* @__PURE__ */ new Date(), "app:messages_loaded"), d.length > 0 && (document.title = d[0].content);
1361
- let p = u.files.map((e) => ({
1357
+ n(u);
1358
+ let f = u.filter((e) => e.role === "user" || e.role === "assistant"), p = f.map((e) => [e.role, e.content]);
1359
+ console.debug(/* @__PURE__ */ new Date(), "app:messages_loaded"), f.length > 0 && (document.title = f[0].content);
1360
+ let m = d.files.map((e) => ({
1362
1361
  fileName: e.name,
1363
1362
  fileExtension: e.name.split(".").pop(),
1364
1363
  fileId: e.fileId
1365
1364
  }));
1366
- s(p), c(p.map((e) => e.fileId)), i(f), a(u.focusMode), r(!0);
1365
+ s(m), c(m.map((e) => e.fileId)), i(p), a(d.focusMode), r(!0);
1367
1366
  } catch (e) {
1368
1367
  console.error("[chatMessages] Failed to load chat:", e), o(!0), r(!0);
1369
1368
  }
1370
- }, Bt = (e) => {
1369
+ }, qt = (e) => {
1371
1370
  let t = [];
1372
1371
  return e.forEach((n, r) => {
1373
1372
  if (n.role === "user") {
@@ -1399,10 +1398,10 @@ var zt = async (e, t, n, r, i, a, o, s, c) => {
1399
1398
  });
1400
1399
  }
1401
1400
  }), t;
1402
- }, Vt = async (e) => {
1401
+ }, Jt = async (e) => {
1403
1402
  let t = localStorage.getItem("chatModelKey"), n = localStorage.getItem("chatModelProviderId"), r = parseInt(localStorage.getItem("maxFollowupQuestions") || "4"), i = e.filter((e) => e.role === "user" || e.role === "assistant");
1404
1403
  try {
1405
- let e = await et("agent/suggestions", {
1404
+ let e = await st("agent/suggestions", {
1406
1405
  method: "POST",
1407
1406
  body: JSON.stringify({
1408
1407
  chatHistory: i,
@@ -1417,13 +1416,13 @@ var zt = async (e, t, n, r, i, a, o, s, c) => {
1417
1416
  } catch {
1418
1417
  return [];
1419
1418
  }
1420
- }, Ht = 3, Ut = () => Array.from(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(7)), (e) => e.toString(16).padStart(2, "0")).join(""), Wt = "sourceExtractionEnabled", Gt = "thinkingTimeLimit";
1421
- async function Kt(e, n) {
1422
- let { message: r, messageId: i, rewrite: a = !1 } = e, { chatId: o, loading: s, messages: c, fileIds: l, focusMode: u, category: d, optimizationMode: f, chatHistory: p, chatModelProvider: m, isAuthenticated: h, messagesRef: g, abortControllerRef: _, setLoading: v, setMessageAppeared: y, setMessages: b, setChatHistory: x, setChatModelProvider: S } = n, C = typeof window < "u" && localStorage.getItem(Wt) === "true", w = typeof window < "u" && Number(localStorage.getItem(Gt) ?? "0") || 0;
1419
+ }, Yt = 3, Xt = () => Array.from(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(7)), (e) => e.toString(16).padStart(2, "0")).join(""), Zt = "sourceExtractionEnabled", Qt = "thinkingTimeLimit";
1420
+ async function $t(e, n) {
1421
+ let { message: r, messageId: i, rewrite: a = !1 } = e, { chatId: o, loading: s, messages: c, fileIds: l, focusMode: u, category: d, optimizationMode: f, chatHistory: p, chatModelProvider: m, isAuthenticated: h, messagesRef: g, abortControllerRef: _, setLoading: v, setMessageAppeared: y, setMessages: b, setChatHistory: x, setChatModelProvider: S } = n, C = typeof window < "u" && localStorage.getItem(Zt) === "true", w = typeof window < "u" && Number(localStorage.getItem(Qt) ?? "0") || 0;
1423
1422
  if (s || !r) return;
1424
1423
  let T = new AbortController();
1425
1424
  _.current = T, v(!0), y(!1), c.length <= 1 && window.history.replaceState(null, "", `/c/${o}`);
1426
- let E = "", D = !1, O = !1, k = [], A = Date.now(), j = w > 0, M = "", N = "", P = i ?? Ut();
1425
+ let E = "", D = !1, O = !1, k = [], A = Date.now(), j = w > 0, M = "", N = "", P = i ?? Xt();
1427
1426
  b((e) => [...e, {
1428
1427
  content: r,
1429
1428
  messageId: P,
@@ -1482,9 +1481,9 @@ async function Kt(e, n) {
1482
1481
  role: "source",
1483
1482
  sources: k,
1484
1483
  createdAt: /* @__PURE__ */ new Date()
1485
- }]), k.length > 0 && (y(!0), k.slice(0, Ht).forEach((e) => {
1484
+ }]), k.length > 0 && (y(!0), k.slice(0, Yt).forEach((e) => {
1486
1485
  let t = e?.metadata?.url;
1487
- t && t !== "File" && et(`doc/article?url=${encodeURIComponent(t)}`).catch(() => {});
1486
+ t && t !== "File" && st(`doc/article?url=${encodeURIComponent(t)}`).catch(() => {});
1488
1487
  }))), e.type === "message" && (E += e.data, j ? (M += e.data, N ||= e.messageId, D = !0) : D ? b((t) => t.map((t) => t.messageId === e.messageId && t.role === "assistant" ? {
1489
1488
  ...t,
1490
1489
  content: t.content + e.data
@@ -1510,7 +1509,7 @@ async function Kt(e, n) {
1510
1509
  let e = g.current[g.current.length - 1];
1511
1510
  if (t.getAutoMediaSearch() && (document.getElementById(`search-images-${e.messageId}`)?.click(), document.getElementById(`search-videos-${e.messageId}`)?.click()), !O) {
1512
1511
  O = !0;
1513
- let e = await Vt(g.current), t = Ut();
1512
+ let e = await Jt(g.current), t = Xt();
1514
1513
  if (b((n) => [...n, {
1515
1514
  role: "suggestion",
1516
1515
  suggestions: e,
@@ -1518,16 +1517,12 @@ async function Kt(e, n) {
1518
1517
  createdAt: /* @__PURE__ */ new Date(),
1519
1518
  messageId: t
1520
1519
  }]), h && e.length > 0) try {
1521
- await fetch("/api/agent/messages", {
1522
- method: "POST",
1523
- headers: { "Content-Type": "application/json" },
1524
- body: JSON.stringify({
1525
- chatId: o,
1526
- messageId: t,
1527
- role: "suggestion",
1528
- suggestions: e
1529
- })
1530
- });
1520
+ await Qe({ body: {
1521
+ chatId: o,
1522
+ messageId: t,
1523
+ role: "suggestion",
1524
+ suggestions: e
1525
+ } });
1531
1526
  } catch (e) {
1532
1527
  console.error("Failed to save suggestions:", e);
1533
1528
  }
@@ -1592,11 +1587,11 @@ async function Kt(e, n) {
1592
1587
  }
1593
1588
  //#endregion
1594
1589
  //#region src/hooks/useChat/useChatState.ts
1595
- function qt(e) {
1590
+ function en(e) {
1596
1591
  let [t, n] = p(e), [r, i] = p(!1), [a, o] = p(!1), [s, c] = p(!1), [l, u] = p(!1), [m, h] = p(!1), [g, _] = p(!1), [v, y] = p(!1), [b, x] = p(!1), [S, C] = p([]), [w, T] = p([]), [E, D] = p([]), [O, k] = p([]), [A, j] = p("webSearch"), [M, N] = p("general"), [P, F] = p("speed"), [I, L] = p({
1597
1592
  key: "",
1598
1593
  providerId: ""
1599
- }), R = f([]), z = d(() => w.filter((e) => e.role === "user" || e.role === "assistant"), [w]), B = d(() => Bt(w), [w]);
1594
+ }), R = f([]), z = d(() => w.filter((e) => e.role === "user" || e.role === "assistant"), [w]), B = d(() => qt(w), [w]);
1600
1595
  return {
1601
1596
  state: {
1602
1597
  chatId: t,
@@ -1643,7 +1638,7 @@ function qt(e) {
1643
1638
  }
1644
1639
  //#endregion
1645
1640
  //#region src/hooks/useChat/ChatContext.tsx
1646
- var Jt = a({
1641
+ var tn = a({
1647
1642
  chatHistory: [],
1648
1643
  chatId: "",
1649
1644
  fileIds: [],
@@ -1678,18 +1673,18 @@ var Jt = a({
1678
1673
  setIncognito: () => {}
1679
1674
  });
1680
1675
  function X() {
1681
- return l(Jt);
1676
+ return l(tn);
1682
1677
  }
1683
1678
  //#endregion
1684
1679
  //#region src/hooks/useSession.tsx
1685
- var Yt = a({
1680
+ var nn = a({
1686
1681
  user: null,
1687
1682
  isLoading: !0,
1688
1683
  isAuthenticated: !1,
1689
1684
  signIn: () => {},
1690
1685
  signOut: async () => {}
1691
1686
  });
1692
- function Xt({ children: e, authClient: t }) {
1687
+ function rn({ children: e, authClient: t }) {
1693
1688
  let [n, r] = p(null), [i, a] = p(!0);
1694
1689
  return u(() => {
1695
1690
  (async () => {
@@ -1707,7 +1702,7 @@ function Xt({ children: e, authClient: t }) {
1707
1702
  let { data: e } = await t.getSession();
1708
1703
  r(e?.user ?? null);
1709
1704
  } } });
1710
- }, [i, n]), /* @__PURE__ */ G(Yt.Provider, {
1705
+ }, [i, n]), /* @__PURE__ */ G(nn.Provider, {
1711
1706
  value: {
1712
1707
  user: n,
1713
1708
  isLoading: i,
@@ -1731,23 +1726,23 @@ function Xt({ children: e, authClient: t }) {
1731
1726
  children: e
1732
1727
  });
1733
1728
  }
1734
- function Zt() {
1735
- let e = l(Yt);
1729
+ function an() {
1730
+ let e = l(nn);
1736
1731
  if (!e) throw Error("useSession must be used within SessionProvider");
1737
1732
  return e;
1738
1733
  }
1739
1734
  //#endregion
1740
1735
  //#region src/hooks/useChat/ChatProvider.tsx
1741
- function Qt({ children: e }) {
1742
- let t = m(), n = g(), r = h(), i = n.get("q"), { isAuthenticated: a, isLoading: o } = Zt(), { state: s, setters: l, messagesRef: d, chatTurns: _, sections: v } = qt(t.chatId), y = f(null), [b, x] = p(!1);
1736
+ function on({ children: e }) {
1737
+ let t = m(), n = g(), r = h(), i = n.get("q"), { isAuthenticated: a, isLoading: o } = an(), { state: s, setters: l, messagesRef: d, chatTurns: _, sections: v } = en(t.chatId), y = f(null), [b, x] = p(!1);
1743
1738
  u(() => {
1744
- jt(l.setChatModelProvider, l.setIsConfigReady, l.setHasError);
1739
+ Rt(l.setChatModelProvider, l.setIsConfigReady, l.setHasError);
1745
1740
  }, []), u(() => {
1746
1741
  t.chatId && t.chatId !== s.chatId && (l.setChatId(t.chatId), l.setMessages([]), l.setChatHistory([]), l.setFiles([]), l.setFileIds([]), l.setIsMessagesLoaded(!1), l.setNotFound(!1), l.setNewChatCreated(!1));
1747
1742
  }, [t.chatId, s.chatId]), u(() => {
1748
1743
  if (s.chatId && !s.newChatCreated && !s.isMessagesLoaded && s.messages.length === 0) {
1749
1744
  if (o) return;
1750
- zt(s.chatId, a, l.setMessages, l.setIsMessagesLoaded, l.setChatHistory, l.setFocusMode, l.setNotFound, l.setFiles, l.setFileIds);
1745
+ Kt(s.chatId, a, l.setMessages, l.setIsMessagesLoaded, l.setChatHistory, l.setFocusMode, l.setNotFound, l.setFiles, l.setFileIds);
1751
1746
  } else s.chatId || (l.setNewChatCreated(!0), l.setIsMessagesLoaded(!0), l.setChatId(crypto.randomUUID()));
1752
1747
  }, [
1753
1748
  s.chatId,
@@ -1761,7 +1756,7 @@ function Qt({ children: e }) {
1761
1756
  let e = s.messages.filter((e) => e.role === "user" || e.role === "assistant");
1762
1757
  if (e.length > 0) {
1763
1758
  let t = e[0].content.slice(0, 50);
1764
- It({
1759
+ Ut({
1765
1760
  id: s.chatId,
1766
1761
  title: t,
1767
1762
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -1789,7 +1784,7 @@ function Qt({ children: e }) {
1789
1784
  i
1790
1785
  ]);
1791
1786
  let S = c(async (e, t, n = !1) => {
1792
- s.chatId && await Kt({
1787
+ s.chatId && await $t({
1793
1788
  message: e,
1794
1789
  messageId: t,
1795
1790
  rewrite: n
@@ -1868,52 +1863,52 @@ function Qt({ children: e }) {
1868
1863
  newChat: T,
1869
1864
  setIncognito: x
1870
1865
  };
1871
- return /* @__PURE__ */ G(Jt.Provider, {
1866
+ return /* @__PURE__ */ G(tn.Provider, {
1872
1867
  value: E,
1873
1868
  children: e
1874
1869
  });
1875
1870
  }
1876
1871
  //#endregion
1877
1872
  //#region src/ui/tooltip.tsx
1878
- function $t({ delayDuration: e = 0, ...t }) {
1879
- return /* @__PURE__ */ G(tt.Provider, {
1873
+ function sn({ delayDuration: e = 0, ...t }) {
1874
+ return /* @__PURE__ */ G(ct.Provider, {
1880
1875
  "data-slot": "tooltip-provider",
1881
1876
  delayDuration: e,
1882
1877
  ...t
1883
1878
  });
1884
1879
  }
1885
- function en({ ...e }) {
1886
- return /* @__PURE__ */ G($t, { children: /* @__PURE__ */ G(tt.Root, {
1880
+ function cn({ ...e }) {
1881
+ return /* @__PURE__ */ G(sn, { children: /* @__PURE__ */ G(ct.Root, {
1887
1882
  "data-slot": "tooltip",
1888
1883
  ...e
1889
1884
  }) });
1890
1885
  }
1891
- function tn({ ...e }) {
1892
- return /* @__PURE__ */ G(tt.Trigger, {
1886
+ function ln({ ...e }) {
1887
+ return /* @__PURE__ */ G(ct.Trigger, {
1893
1888
  "data-slot": "tooltip-trigger",
1894
1889
  ...e
1895
1890
  });
1896
1891
  }
1897
- function nn({ className: e, sideOffset: t = 0, children: n, ...r }) {
1898
- return /* @__PURE__ */ G(tt.Portal, { children: /* @__PURE__ */ K(tt.Content, {
1892
+ function un({ className: e, sideOffset: t = 0, children: n, ...r }) {
1893
+ return /* @__PURE__ */ G(ct.Portal, { children: /* @__PURE__ */ K(ct.Content, {
1899
1894
  "data-slot": "tooltip-content",
1900
1895
  sideOffset: t,
1901
1896
  className: Y("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-2xl px-3 py-1.5 text-xs text-balance", e),
1902
1897
  ...r,
1903
- children: [n, /* @__PURE__ */ G(tt.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })]
1898
+ children: [n, /* @__PURE__ */ G(ct.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })]
1904
1899
  }) });
1905
1900
  }
1906
1901
  //#endregion
1907
1902
  //#region src/components/SearchResults/WebCitationBadge.tsx
1908
- var rn = ({ href: e, children: t, sources: n }) => {
1909
- let { openPanel: r } = ht(), i = d(() => !n || !e ? null : n.find((t) => t.metadata?.url === e) ?? null, [n, e]), a = d(() => {
1903
+ var dn = ({ href: e, children: t, sources: n }) => {
1904
+ let { openPanel: r } = St(), i = d(() => !n || !e ? null : n.find((t) => t.metadata?.url === e) ?? null, [n, e]), a = d(() => {
1910
1905
  try {
1911
1906
  return new URL(e).hostname.replace("www.", "");
1912
1907
  } catch {
1913
1908
  return i?.metadata?.source || "";
1914
1909
  }
1915
1910
  }, [e, i]), o = i?.metadata?.title || "", s = `https://s2.googleusercontent.com/s2/favicons?domain_url=${e}`;
1916
- return /* @__PURE__ */ K(en, { children: [/* @__PURE__ */ G(tn, {
1911
+ return /* @__PURE__ */ K(cn, { children: [/* @__PURE__ */ G(ln, {
1917
1912
  asChild: !0,
1918
1913
  children: /* @__PURE__ */ G("a", {
1919
1914
  href: e,
@@ -1923,7 +1918,7 @@ var rn = ({ href: e, children: t, sources: n }) => {
1923
1918
  className: "bg-light-secondary dark:bg-dark-secondary px-1 rounded ml-1 no-underline text-xs text-black/70 dark:text-white/70 relative cursor-pointer hover:bg-black/10 dark:hover:bg-white/20 transition-colors",
1924
1919
  children: t
1925
1920
  })
1926
- }), /* @__PURE__ */ G(nn, {
1921
+ }), /* @__PURE__ */ G(un, {
1927
1922
  side: "top",
1928
1923
  className: "max-w-72 p-2.5",
1929
1924
  children: /* @__PURE__ */ K("div", {
@@ -1946,7 +1941,7 @@ var rn = ({ href: e, children: t, sources: n }) => {
1946
1941
  })]
1947
1942
  })
1948
1943
  })] });
1949
- }, an = ({ content: e, thinkingEnded: t }) => {
1944
+ }, fn = ({ content: e, thinkingEnded: t }) => {
1950
1945
  let [n, r] = p(!0);
1951
1946
  return u(() => {
1952
1947
  r(!t);
@@ -1973,10 +1968,10 @@ var rn = ({ href: e, children: t, sources: n }) => {
1973
1968
  children: e
1974
1969
  })]
1975
1970
  });
1976
- }, on = ({ children: e, thinkingEnded: t }) => /* @__PURE__ */ G(an, {
1971
+ }, pn = ({ children: e, thinkingEnded: t }) => /* @__PURE__ */ G(fn, {
1977
1972
  content: e,
1978
1973
  thinkingEnded: t
1979
- }), sn = ({ section: e, isExpanded: t, setIsExpanded: n, isEditing: r, setIsEditing: i, editText: a, setEditText: o, handleEditSubmit: s, copiedUserMsg: c, handleCopyUserMsg: l }) => {
1974
+ }), mn = ({ section: e, isExpanded: t, setIsExpanded: n, isEditing: r, setIsEditing: i, editText: a, setEditText: o, handleEditSubmit: s, copiedUserMsg: c, handleCopyUserMsg: l }) => {
1980
1975
  let u = f(null);
1981
1976
  return /* @__PURE__ */ K("div", {
1982
1977
  className: "w-full pt-8 break-words",
@@ -1997,7 +1992,7 @@ var rn = ({ href: e, children: t, sources: n }) => {
1997
1992
  }),
1998
1993
  /* @__PURE__ */ K("div", {
1999
1994
  className: "flex items-center gap-0.5 mt-1 ml-10",
2000
- children: [/* @__PURE__ */ K(en, { children: [/* @__PURE__ */ G(tn, {
1995
+ children: [/* @__PURE__ */ K(cn, { children: [/* @__PURE__ */ G(ln, {
2001
1996
  asChild: !0,
2002
1997
  children: /* @__PURE__ */ G("button", {
2003
1998
  onClick: l,
@@ -2010,10 +2005,10 @@ var rn = ({ href: e, children: t, sources: n }) => {
2010
2005
  }) : /* @__PURE__ */ G(F, { size: 14 })
2011
2006
  })
2012
2007
  })
2013
- }), /* @__PURE__ */ G(nn, {
2008
+ }), /* @__PURE__ */ G(un, {
2014
2009
  side: "bottom",
2015
2010
  children: c ? "Copied!" : "Copy prompt"
2016
- })] }), /* @__PURE__ */ K(en, { children: [/* @__PURE__ */ G(tn, {
2011
+ })] }), /* @__PURE__ */ K(cn, { children: [/* @__PURE__ */ G(ln, {
2017
2012
  asChild: !0,
2018
2013
  children: /* @__PURE__ */ G("button", {
2019
2014
  onClick: () => {
@@ -2022,7 +2017,7 @@ var rn = ({ href: e, children: t, sources: n }) => {
2022
2017
  className: "p-1.5 text-muted-foreground rounded-lg hover:bg-secondary transition-all duration-200 hover:text-foreground",
2023
2018
  children: /* @__PURE__ */ G(me, { size: 14 })
2024
2019
  })
2025
- }), /* @__PURE__ */ G(nn, {
2020
+ }), /* @__PURE__ */ G(un, {
2026
2021
  side: "bottom",
2027
2022
  children: "Edit & resubmit"
2028
2023
  })] })]
@@ -2057,19 +2052,19 @@ var rn = ({ href: e, children: t, sources: n }) => {
2057
2052
  };
2058
2053
  //#endregion
2059
2054
  //#region src/ui/dropdown-menu.tsx
2060
- function cn({ ...e }) {
2055
+ function hn({ ...e }) {
2061
2056
  return /* @__PURE__ */ G(J.Root, {
2062
2057
  "data-slot": "dropdown-menu",
2063
2058
  ...e
2064
2059
  });
2065
2060
  }
2066
- function ln({ ...e }) {
2061
+ function gn({ ...e }) {
2067
2062
  return /* @__PURE__ */ G(J.Trigger, {
2068
2063
  "data-slot": "dropdown-menu-trigger",
2069
2064
  ...e
2070
2065
  });
2071
2066
  }
2072
- function un({ className: e, sideOffset: t = 4, ...n }) {
2067
+ function _n({ className: e, sideOffset: t = 4, ...n }) {
2073
2068
  return /* @__PURE__ */ G(J.Portal, { children: /* @__PURE__ */ G(J.Content, {
2074
2069
  "data-slot": "dropdown-menu-content",
2075
2070
  sideOffset: t,
@@ -2086,7 +2081,7 @@ function Z({ className: e, inset: t, variant: n = "default", ...r }) {
2086
2081
  ...r
2087
2082
  });
2088
2083
  }
2089
- function dn({ className: e, children: t, checked: n, ...r }) {
2084
+ function vn({ className: e, children: t, checked: n, ...r }) {
2090
2085
  return /* @__PURE__ */ K(J.CheckboxItem, {
2091
2086
  "data-slot": "dropdown-menu-checkbox-item",
2092
2087
  className: Y("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),
@@ -2098,7 +2093,7 @@ function dn({ className: e, children: t, checked: n, ...r }) {
2098
2093
  }), t]
2099
2094
  });
2100
2095
  }
2101
- function fn({ className: e, inset: t, ...n }) {
2096
+ function yn({ className: e, inset: t, ...n }) {
2102
2097
  return /* @__PURE__ */ G(J.Label, {
2103
2098
  "data-slot": "dropdown-menu-label",
2104
2099
  "data-inset": t,
@@ -2113,13 +2108,13 @@ function Q({ className: e, ...t }) {
2113
2108
  ...t
2114
2109
  });
2115
2110
  }
2116
- function pn({ ...e }) {
2111
+ function bn({ ...e }) {
2117
2112
  return /* @__PURE__ */ G(J.Sub, {
2118
2113
  "data-slot": "dropdown-menu-sub",
2119
2114
  ...e
2120
2115
  });
2121
2116
  }
2122
- function mn({ className: e, inset: t, children: n, ...r }) {
2117
+ function xn({ className: e, inset: t, children: n, ...r }) {
2123
2118
  return /* @__PURE__ */ K(J.SubTrigger, {
2124
2119
  "data-slot": "dropdown-menu-sub-trigger",
2125
2120
  "data-inset": t,
@@ -2128,7 +2123,7 @@ function mn({ className: e, inset: t, children: n, ...r }) {
2128
2123
  children: [n, /* @__PURE__ */ G(M, { className: "ml-auto size-4" })]
2129
2124
  });
2130
2125
  }
2131
- function hn({ className: e, ...t }) {
2126
+ function Sn({ className: e, ...t }) {
2132
2127
  return /* @__PURE__ */ G(J.SubContent, {
2133
2128
  "data-slot": "dropdown-menu-sub-content",
2134
2129
  className: Y("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),
@@ -2137,9 +2132,9 @@ function hn({ className: e, ...t }) {
2137
2132
  }
2138
2133
  //#endregion
2139
2134
  //#region src/components/MessageActions/CopyMessageButton.tsx
2140
- var gn = ({ section: e, initialMessage: t }) => {
2135
+ var Cn = ({ section: e, initialMessage: t }) => {
2141
2136
  let [n, r] = p(!1);
2142
- return /* @__PURE__ */ K(en, { children: [/* @__PURE__ */ G(tn, {
2137
+ return /* @__PURE__ */ K(cn, { children: [/* @__PURE__ */ G(ln, {
2143
2138
  asChild: !0,
2144
2139
  children: /* @__PURE__ */ G("button", {
2145
2140
  onClick: () => {
@@ -2149,29 +2144,29 @@ var gn = ({ section: e, initialMessage: t }) => {
2149
2144
  className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
2150
2145
  children: G(n ? O : F, { size: 18 })
2151
2146
  })
2152
- }), /* @__PURE__ */ G(nn, {
2147
+ }), /* @__PURE__ */ G(un, {
2153
2148
  side: "bottom",
2154
2149
  children: n ? "Copied!" : "Copy"
2155
2150
  })] });
2156
2151
  };
2157
2152
  //#endregion
2158
2153
  //#region src/ui/popover.tsx
2159
- function _n({ ...e }) {
2160
- return /* @__PURE__ */ G(nt.Root, {
2154
+ function wn({ ...e }) {
2155
+ return /* @__PURE__ */ G(lt.Root, {
2161
2156
  "data-slot": "popover",
2162
2157
  ...e
2163
2158
  });
2164
2159
  }
2165
- function vn({ ...e }) {
2166
- return /* @__PURE__ */ G(nt.Trigger, {
2160
+ function Tn({ ...e }) {
2161
+ return /* @__PURE__ */ G(lt.Trigger, {
2167
2162
  "data-slot": "popover-trigger",
2168
2163
  ...e
2169
2164
  });
2170
2165
  }
2171
- function yn({ className: e, align: t = "center", sideOffset: n = 4, container: r, ...i }) {
2172
- return /* @__PURE__ */ G(nt.Portal, {
2166
+ function En({ className: e, align: t = "center", sideOffset: n = 4, container: r, ...i }) {
2167
+ return /* @__PURE__ */ G(lt.Portal, {
2173
2168
  container: r,
2174
- children: /* @__PURE__ */ G(nt.Content, {
2169
+ children: /* @__PURE__ */ G(lt.Content, {
2175
2170
  "data-slot": "popover-content",
2176
2171
  align: t,
2177
2172
  sideOffset: n,
@@ -2216,13 +2211,13 @@ var $ = {
2216
2211
  ...e,
2217
2212
  children: /* @__PURE__ */ G("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" })
2218
2213
  })
2219
- }, bn = ({ messageId: e }) => {
2214
+ }, Dn = ({ messageId: e }) => {
2220
2215
  let { rewrite: t, chatModelProvider: n, setChatModelProvider: r } = X(), [i, a] = p([]), [o, s] = p(!0), [c, l] = p(""), [f, m] = p(!1);
2221
2216
  u(() => {
2222
2217
  f && (async () => {
2223
2218
  try {
2224
2219
  s(!0);
2225
- let { data: e } = await Ge();
2220
+ let { data: e } = await Xe();
2226
2221
  a(e?.providers ?? []);
2227
2222
  } catch (e) {
2228
2223
  console.error("Error loading providers:", e);
@@ -2251,22 +2246,22 @@ var $ = {
2251
2246
  key: i
2252
2247
  }), localStorage.setItem("chatModelProviderId", n), localStorage.setItem("chatModelKey", i), m(!1), t(e);
2253
2248
  };
2254
- return /* @__PURE__ */ K(_n, {
2249
+ return /* @__PURE__ */ K(wn, {
2255
2250
  open: f,
2256
2251
  onOpenChange: m,
2257
- children: [/* @__PURE__ */ K(en, { children: [/* @__PURE__ */ G(tn, {
2252
+ children: [/* @__PURE__ */ K(cn, { children: [/* @__PURE__ */ G(ln, {
2258
2253
  asChild: !0,
2259
- children: /* @__PURE__ */ G(vn, {
2254
+ children: /* @__PURE__ */ G(Tn, {
2260
2255
  asChild: !0,
2261
2256
  children: /* @__PURE__ */ G("button", {
2262
2257
  className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
2263
2258
  children: /* @__PURE__ */ G(S, { size: 18 })
2264
2259
  })
2265
2260
  })
2266
- }), /* @__PURE__ */ K(nn, {
2261
+ }), /* @__PURE__ */ K(un, {
2267
2262
  side: "bottom",
2268
2263
  children: ["Rewrite with ", g]
2269
- })] }), /* @__PURE__ */ G(yn, {
2264
+ })] }), /* @__PURE__ */ G(En, {
2270
2265
  className: "w-[280px] p-0",
2271
2266
  align: "start",
2272
2267
  side: "top",
@@ -2334,10 +2329,10 @@ var $ = {
2334
2329
  })
2335
2330
  })]
2336
2331
  });
2337
- }, xn = /* @__PURE__ */ new Map();
2338
- function Sn(e) {
2332
+ }, On = /* @__PURE__ */ new Map();
2333
+ function kn(e) {
2339
2334
  if (typeof window > "u") return Promise.reject(/* @__PURE__ */ Error("CDN scripts require a browser environment"));
2340
- let t = xn.get(e);
2335
+ let t = On.get(e);
2341
2336
  if (t) return t;
2342
2337
  let n = new Promise((t, n) => {
2343
2338
  let r = document.querySelector(`script[data-cdn-loader="${e}"]`);
@@ -2349,34 +2344,34 @@ function Sn(e) {
2349
2344
  i.src = e, i.async = !0, i.dataset.cdnLoader = e, i.onload = () => {
2350
2345
  i.dataset.loaded = "true", t();
2351
2346
  }, i.onerror = () => {
2352
- xn.delete(e), n(/* @__PURE__ */ Error(`Failed to load ${e}`));
2347
+ On.delete(e), n(/* @__PURE__ */ Error(`Failed to load ${e}`));
2353
2348
  }, document.head.appendChild(i);
2354
2349
  });
2355
- return xn.set(e, n), n;
2350
+ return On.set(e, n), n;
2356
2351
  }
2357
- var Cn = "https://cdn.jsdelivr.net/npm/jspdf@2.5.2/dist/jspdf.umd.min.js", wn = "https://cdn.jsdelivr.net/npm/docx@9.5.1/build/index.umd.min.js";
2358
- async function Tn() {
2359
- await Sn(Cn);
2352
+ var An = "https://cdn.jsdelivr.net/npm/jspdf@2.5.2/dist/jspdf.umd.min.js", jn = "https://cdn.jsdelivr.net/npm/docx@9.5.1/build/index.umd.min.js";
2353
+ async function Mn() {
2354
+ await kn(An);
2360
2355
  let e = window.jspdf?.jsPDF;
2361
2356
  if (!e) throw Error("jsPDF global not found after CDN load");
2362
2357
  return e;
2363
2358
  }
2364
- async function En() {
2365
- await Sn(wn);
2359
+ async function Nn() {
2360
+ await kn(jn);
2366
2361
  let e = window.docx;
2367
2362
  if (!e) throw Error("docx global not found after CDN load");
2368
2363
  return e;
2369
2364
  }
2370
2365
  //#endregion
2371
2366
  //#region src/lib/export.ts
2372
- async function Dn(e, t) {
2373
- jn(`# ${e}\n\n${new it({
2367
+ async function Pn(e, t) {
2368
+ Rn(`# ${e}\n\n${new dt({
2374
2369
  headingStyle: "atx",
2375
2370
  codeBlockStyle: "fenced"
2376
2371
  }).turndown(t)}`, `${e}.md`, "text/markdown");
2377
2372
  }
2378
- async function On(e, t) {
2379
- let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await En(), s = new DOMParser().parseFromString(t, "text/html"), c = [];
2373
+ async function Fn(e, t) {
2374
+ let { Document: n, Paragraph: r, TextRun: i, HeadingLevel: a, Packer: o } = await Nn(), s = new DOMParser().parseFromString(t, "text/html"), c = [];
2380
2375
  c.push(new r({
2381
2376
  text: e,
2382
2377
  heading: a.HEADING_1,
@@ -2450,14 +2445,14 @@ async function On(e, t) {
2450
2445
  }] }), d = await o.toBlob(u), f = URL.createObjectURL(d), p = document.createElement("a");
2451
2446
  p.href = f, p.download = `${e}.docx`, p.click(), URL.revokeObjectURL(f);
2452
2447
  }
2453
- async function kn(e, t) {
2448
+ async function In(e, t) {
2454
2449
  let n = document.createElement("div");
2455
2450
  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 = `
2456
2451
  <h1 style="font-size: 24pt; margin-bottom: 20px;">${e}</h1>
2457
2452
  ${t}
2458
2453
  `, document.body.appendChild(n);
2459
2454
  try {
2460
- let t = await Tn(), r = await rt(n, {
2455
+ let t = await Mn(), r = await ut(n, {
2461
2456
  scale: 2,
2462
2457
  useCORS: !0,
2463
2458
  logging: !1
@@ -2472,31 +2467,31 @@ async function kn(e, t) {
2472
2467
  document.body.removeChild(n);
2473
2468
  }
2474
2469
  }
2475
- async function An(e, t) {
2470
+ async function Ln(e, t) {
2476
2471
  try {
2477
- let n = `${e}\n\n${new it().turndown(t)}`;
2472
+ let n = `${e}\n\n${new dt().turndown(t)}`;
2478
2473
  await navigator.clipboard.writeText(n), window.open("https://docs.google.com/document/create", "_blank"), alert("Content copied to clipboard! Paste it into the new Google Doc.");
2479
2474
  } catch (e) {
2480
2475
  console.error("Failed to export to Google Docs:", e), alert("Failed to copy content to clipboard. Please try again.");
2481
2476
  }
2482
2477
  }
2483
- function jn(e, t, n) {
2478
+ function Rn(e, t, n) {
2484
2479
  let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
2485
2480
  a.href = i, a.download = t, a.click(), URL.revokeObjectURL(i);
2486
2481
  }
2487
2482
  //#endregion
2488
2483
  //#region src/components/ChatConversation/MessageBubble/AssistantMessageActions.tsx
2489
- var Mn = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }) => e.assistantMessage ? /* @__PURE__ */ G("div", {
2484
+ var zn = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }) => e.assistantMessage ? /* @__PURE__ */ G("div", {
2490
2485
  className: "flex flex-row items-center justify-end w-full text-foreground py-4 -mx-2",
2491
2486
  children: /* @__PURE__ */ K("div", {
2492
2487
  className: "flex flex-row items-center space-x-1",
2493
2488
  children: [
2494
- /* @__PURE__ */ G(bn, { messageId: e.assistantMessage.messageId }),
2495
- /* @__PURE__ */ G(gn, {
2489
+ /* @__PURE__ */ G(Dn, { messageId: e.assistantMessage.messageId }),
2490
+ /* @__PURE__ */ G(Cn, {
2496
2491
  initialMessage: e.assistantMessage.content,
2497
2492
  section: e
2498
2493
  }),
2499
- /* @__PURE__ */ K(en, { children: [/* @__PURE__ */ G(tn, {
2494
+ /* @__PURE__ */ K(cn, { children: [/* @__PURE__ */ G(ln, {
2500
2495
  asChild: !0,
2501
2496
  children: /* @__PURE__ */ G("button", {
2502
2497
  onClick: () => {
@@ -2505,57 +2500,57 @@ var Mn = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
2505
2500
  className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
2506
2501
  children: G(t === "started" ? we : Ae, { size: 18 })
2507
2502
  })
2508
- }), /* @__PURE__ */ G(nn, {
2503
+ }), /* @__PURE__ */ G(un, {
2509
2504
  side: "bottom",
2510
2505
  children: t === "started" ? "Stop" : "Read aloud"
2511
2506
  })] }),
2512
- /* @__PURE__ */ K(cn, { children: [/* @__PURE__ */ K(en, { children: [/* @__PURE__ */ G(tn, {
2507
+ /* @__PURE__ */ K(hn, { children: [/* @__PURE__ */ K(cn, { children: [/* @__PURE__ */ G(ln, {
2513
2508
  asChild: !0,
2514
- children: /* @__PURE__ */ G(ln, {
2509
+ children: /* @__PURE__ */ G(gn, {
2515
2510
  asChild: !0,
2516
2511
  children: /* @__PURE__ */ G("button", {
2517
2512
  className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
2518
2513
  children: /* @__PURE__ */ G(ee, { size: 18 })
2519
2514
  })
2520
2515
  })
2521
- }), /* @__PURE__ */ G(nn, {
2516
+ }), /* @__PURE__ */ G(un, {
2522
2517
  side: "bottom",
2523
2518
  children: "Export"
2524
- })] }), /* @__PURE__ */ K(un, {
2519
+ })] }), /* @__PURE__ */ K(_n, {
2525
2520
  align: "end",
2526
2521
  side: "top",
2527
2522
  children: [
2528
2523
  /* @__PURE__ */ K(Z, {
2529
- onClick: () => Dn(e.userMessage.content, e.assistantMessage.content),
2524
+ onClick: () => Pn(e.userMessage.content, e.assistantMessage.content),
2530
2525
  children: [/* @__PURE__ */ G(ie, { size: 16 }), "Markdown"]
2531
2526
  }),
2532
2527
  /* @__PURE__ */ K(Z, {
2533
- onClick: () => kn(e.userMessage.content, e.assistantMessage.content),
2528
+ onClick: () => In(e.userMessage.content, e.assistantMessage.content),
2534
2529
  children: [/* @__PURE__ */ G(ae, { size: 16 }), "PDF"]
2535
2530
  }),
2536
2531
  /* @__PURE__ */ K(Z, {
2537
- onClick: () => On(e.userMessage.content, e.assistantMessage.content),
2532
+ onClick: () => Fn(e.userMessage.content, e.assistantMessage.content),
2538
2533
  children: [/* @__PURE__ */ G(ne, { size: 16 }), "DOCX"]
2539
2534
  }),
2540
2535
  /* @__PURE__ */ K(Z, {
2541
- onClick: () => An(e.userMessage.content, e.assistantMessage.content),
2536
+ onClick: () => Ln(e.userMessage.content, e.assistantMessage.content),
2542
2537
  children: [/* @__PURE__ */ G(re, { size: 16 }), "Google Docs"]
2543
2538
  })
2544
2539
  ]
2545
2540
  })] }),
2546
- /* @__PURE__ */ K(cn, { children: [/* @__PURE__ */ K(en, { children: [/* @__PURE__ */ G(tn, {
2541
+ /* @__PURE__ */ K(hn, { children: [/* @__PURE__ */ K(cn, { children: [/* @__PURE__ */ G(ln, {
2547
2542
  asChild: !0,
2548
- children: /* @__PURE__ */ G(ln, {
2543
+ children: /* @__PURE__ */ G(gn, {
2549
2544
  asChild: !0,
2550
2545
  children: /* @__PURE__ */ G("button", {
2551
2546
  className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
2552
2547
  children: /* @__PURE__ */ G(V, { size: 18 })
2553
2548
  })
2554
2549
  })
2555
- }), /* @__PURE__ */ G(nn, {
2550
+ }), /* @__PURE__ */ G(un, {
2556
2551
  side: "bottom",
2557
2552
  children: "Open in LLM"
2558
- })] }), /* @__PURE__ */ K(un, {
2553
+ })] }), /* @__PURE__ */ K(_n, {
2559
2554
  align: "end",
2560
2555
  side: "top",
2561
2556
  children: [
@@ -2583,7 +2578,7 @@ var Mn = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
2583
2578
  })] })
2584
2579
  ]
2585
2580
  })
2586
- }) : null, Nn = 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", {
2581
+ }) : null, Bn = pt("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", {
2587
2582
  variants: { variant: {
2588
2583
  default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
2589
2584
  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",
@@ -2595,16 +2590,16 @@ var Mn = ({ section: e, speechStatus: t, start: n, stop: r, handleOpenInLLM: i }
2595
2590
  } },
2596
2591
  defaultVariants: { variant: "default" }
2597
2592
  });
2598
- function Pn({ className: e, variant: t, asChild: n = !1, ...r }) {
2599
- return /* @__PURE__ */ G(n ? at : "span", {
2593
+ function Vn({ className: e, variant: t, asChild: n = !1, ...r }) {
2594
+ return /* @__PURE__ */ G(n ? ft : "span", {
2600
2595
  "data-slot": "badge",
2601
- className: Y(Nn({ variant: t }), e),
2596
+ className: Y(Bn({ variant: t }), e),
2602
2597
  ...r
2603
2598
  });
2604
2599
  }
2605
2600
  //#endregion
2606
2601
  //#region src/components/ChatConversation/MessageBubble/FollowUpSuggestions.tsx
2607
- var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2602
+ var Hn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2608
2603
  let i = f([]);
2609
2604
  return u(() => {
2610
2605
  e.suggestions && e.suggestions.length > 0 && (i.current = e.suggestions.slice(0, 5));
@@ -2626,7 +2621,7 @@ var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2626
2621
  children: /* @__PURE__ */ K("div", {
2627
2622
  className: "flex items-center gap-3",
2628
2623
  children: [
2629
- /* @__PURE__ */ G(Pn, {
2624
+ /* @__PURE__ */ G(Vn, {
2630
2625
  variant: "secondary",
2631
2626
  className: "flex-shrink-0 h-6 w-6 p-0 flex items-center justify-center rounded-full text-sm font-semibold",
2632
2627
  children: t + 1
@@ -2644,12 +2639,12 @@ var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2644
2639
  }, t))
2645
2640
  })
2646
2641
  });
2647
- }, In = ({ section: e, dividerRef: t, isLast: n }) => {
2642
+ }, Un = ({ section: e, dividerRef: t, isLast: n }) => {
2648
2643
  let { loading: r, sendMessage: i } = X(), [a, o] = p(!0), [s, c] = p(!1), [l, u] = p(!1), [d, f] = p(e.userMessage.content), m = () => {
2649
2644
  navigator.clipboard.writeText(e.userMessage.content), c(!0), setTimeout(() => c(!1), 1500);
2650
2645
  }, h = () => {
2651
2646
  d.trim() && (i(d.trim()), u(!1));
2652
- }, g = e.parsedAssistantMessage || "", _ = e.speechMessage || "", v = e.thinkingEnded, { speechStatus: b, start: x, stop: S } = At(_, { enableInterrupt: !0 }), C = (t) => {
2647
+ }, g = e.parsedAssistantMessage || "", _ = e.speechMessage || "", v = e.thinkingEnded, { speechStatus: b, start: x, stop: S } = Lt(_, { enableInterrupt: !0 }), C = (t) => {
2653
2648
  if (!e.assistantMessage) return;
2654
2649
  let n = `${e.userMessage.content}\n\n${e.assistantMessage.content}`;
2655
2650
  navigator.clipboard.writeText(n);
@@ -2663,11 +2658,11 @@ var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2663
2658
  r && window.open(`${r}${encodeURIComponent(n)}`, "_blank");
2664
2659
  }, w = { overrides: {
2665
2660
  think: {
2666
- component: on,
2661
+ component: pn,
2667
2662
  props: { thinkingEnded: v }
2668
2663
  },
2669
2664
  citation: {
2670
- component: rn,
2665
+ component: dn,
2671
2666
  props: { sources: e.sourceMessage?.sources || [] }
2672
2667
  },
2673
2668
  table: { component: ({ children: e, ...t }) => /* @__PURE__ */ G("div", {
@@ -2681,7 +2676,7 @@ var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2681
2676
  } };
2682
2677
  return /* @__PURE__ */ K("div", {
2683
2678
  className: "space-y-3",
2684
- children: [/* @__PURE__ */ G(sn, {
2679
+ children: [/* @__PURE__ */ G(mn, {
2685
2680
  section: e,
2686
2681
  isExpanded: a,
2687
2682
  setIsExpanded: o,
@@ -2698,13 +2693,13 @@ var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2698
2693
  ref: t,
2699
2694
  className: "flex flex-col space-y-6 w-full",
2700
2695
  children: [
2701
- e.searchingMessage && e.searchingMessage.queries.length > 0 && /* @__PURE__ */ G(kt, {
2696
+ e.searchingMessage && e.searchingMessage.queries.length > 0 && /* @__PURE__ */ G(It, {
2702
2697
  queries: e.searchingMessage.queries,
2703
2698
  loading: r && n
2704
2699
  }),
2705
2700
  e.sourceMessage && e.sourceMessage.sources.length > 0 && /* @__PURE__ */ G("div", {
2706
2701
  className: "flex flex-col space-y-2",
2707
- children: /* @__PURE__ */ G(Et, {
2702
+ children: /* @__PURE__ */ G(Nt, {
2708
2703
  sources: e.sourceMessage.sources,
2709
2704
  query: e.userMessage.content
2710
2705
  })
@@ -2717,14 +2712,14 @@ var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2717
2712
  options: w,
2718
2713
  children: g
2719
2714
  }),
2720
- r && n ? null : /* @__PURE__ */ G(Mn, {
2715
+ r && n ? null : /* @__PURE__ */ G(zn, {
2721
2716
  section: e,
2722
2717
  speechStatus: b,
2723
2718
  start: x,
2724
2719
  stop: S,
2725
2720
  handleOpenInLLM: C
2726
2721
  }),
2727
- /* @__PURE__ */ G(Fn, {
2722
+ /* @__PURE__ */ G(Hn, {
2728
2723
  section: e,
2729
2724
  isLast: n,
2730
2725
  loading: r,
@@ -2736,7 +2731,7 @@ var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2736
2731
  })
2737
2732
  })]
2738
2733
  });
2739
- }, Ln = (e) => {
2734
+ }, Wn = (e) => {
2740
2735
  if (e === 0) return "0 Bytes";
2741
2736
  let t = 1024, n = [
2742
2737
  "Bytes",
@@ -2745,7 +2740,7 @@ var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2745
2740
  "GB"
2746
2741
  ], r = Math.floor(Math.log(e) / Math.log(t));
2747
2742
  return parseFloat((e / t ** r).toFixed(2)) + " " + n[r];
2748
- }, Rn = ({ file: e, onRemove: t }) => /* @__PURE__ */ K("div", {
2743
+ }, Gn = ({ file: e, onRemove: t }) => /* @__PURE__ */ K("div", {
2749
2744
  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",
2750
2745
  children: [
2751
2746
  e.type.startsWith("image/") && e.preview ? /* @__PURE__ */ K("div", {
@@ -2774,7 +2769,7 @@ var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2774
2769
  children: e.file.name
2775
2770
  }), /* @__PURE__ */ G("p", {
2776
2771
  className: "text-[10px] text-text-500",
2777
- children: Ln(e.file.size)
2772
+ children: Wn(e.file.size)
2778
2773
  })]
2779
2774
  })]
2780
2775
  }),
@@ -2792,7 +2787,7 @@ var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2792
2787
  children: /* @__PURE__ */ G($.X, { className: "w-5 h-5 text-red-300" })
2793
2788
  })
2794
2789
  ]
2795
- }), zn = ({ content: e, onRemove: t }) => /* @__PURE__ */ K("div", {
2790
+ }), Kn = ({ content: e, onRemove: t }) => /* @__PURE__ */ K("div", {
2796
2791
  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)]",
2797
2792
  children: [
2798
2793
  /* @__PURE__ */ G("div", {
@@ -2821,13 +2816,13 @@ var Fn = ({ section: e, isLast: t, loading: n, sendMessage: r }) => {
2821
2816
  });
2822
2817
  //#endregion
2823
2818
  //#region src/hooks/voice/useSpeechToTranscript.ts
2824
- function Bn(e, t) {
2819
+ function qn(e, t) {
2825
2820
  let [n, r] = p(!1), i = f(null), a = f(null), o = f(null), s = f([]), c = f(!1), l = f(!1), d = typeof window < "u" ? window.SpeechRecognition || window.webkitSpeechRecognition : null, m = () => {
2826
2821
  let e = a.current;
2827
2822
  e && e.state !== "inactive" ? e.stop() : (o.current?.getTracks().forEach((e) => e.stop()), o.current = null, a.current = null, r(!1), t());
2828
2823
  }, h = async (e) => {
2829
2824
  let t = new FormData();
2830
- return t.append("file", e, "speech-input.webm"), t.append("languageCode", "en"), ((await et("/api/agent/transcript", {
2825
+ return t.append("file", e, "speech-input.webm"), t.append("languageCode", "en"), ((await st("/api/agent/transcript", {
2831
2826
  method: "POST",
2832
2827
  body: t
2833
2828
  }))?.text ?? "").trim();
@@ -2910,28 +2905,28 @@ function Bn(e, t) {
2910
2905
  }
2911
2906
  //#endregion
2912
2907
  //#region src/components/FileUpload/useFileHandling.ts
2913
- var Vn = [
2908
+ var Jn = [
2914
2909
  "pdf",
2915
2910
  "docx",
2916
2911
  "txt",
2917
2912
  "md",
2918
2913
  "html",
2919
2914
  "htm"
2920
- ], Hn = 10, Un = 50 * 1024 * 1024, Wn = (e, t) => {
2915
+ ], Yn = 10, Xn = 50 * 1024 * 1024, Zn = (e, t) => {
2921
2916
  if (e && typeof e == "object") {
2922
2917
  let t = e.message ?? e.error ?? e.data?.message;
2923
2918
  if (typeof t == "string" && t.length > 0) return t;
2924
2919
  }
2925
2920
  return typeof e == "string" && e.length > 0 ? e : t;
2926
2921
  };
2927
- function Gn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles: r, setContextFileIds: i }) {
2922
+ function Qn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles: r, setContextFileIds: i }) {
2928
2923
  let [a, o] = p([]), [s, l] = p([]), [u, d] = p(!1), [f, m] = p(!1), h = c(async (e) => {
2929
2924
  let a = Array.from(e);
2930
- a.length > Hn && (q.error(`You can attach up to ${Hn} files at a time.`), a = a.slice(0, Hn));
2931
- let s = a.filter((e) => e.size > Un);
2932
- if (s.length > 0 && (q.error(`${s.map((e) => e.name).join(", ")} exceed${s.length === 1 ? "s" : ""} the 50 MB per-file limit.`), a = a.filter((e) => e.size <= Un)), a.length === 0) return;
2925
+ a.length > Yn && (q.error(`You can attach up to ${Yn} files at a time.`), a = a.slice(0, Yn));
2926
+ let s = a.filter((e) => e.size > Xn);
2927
+ if (s.length > 0 && (q.error(`${s.map((e) => e.name).join(", ")} exceed${s.length === 1 ? "s" : ""} the 50 MB per-file limit.`), a = a.filter((e) => e.size <= Xn)), a.length === 0) return;
2933
2928
  let c = a.map((e) => {
2934
- let t = e.type.startsWith("image/") || /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(e.name), n = e.name.split(".").pop()?.toLowerCase() ?? "", r = Vn.includes(n);
2929
+ let t = e.type.startsWith("image/") || /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(e.name), n = e.name.split(".").pop()?.toLowerCase() ?? "", r = Jn.includes(n);
2935
2930
  return {
2936
2931
  id: Math.random().toString(36).substr(2, 9),
2937
2932
  file: e,
@@ -2941,7 +2936,7 @@ function Gn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
2941
2936
  _ext: n
2942
2937
  };
2943
2938
  });
2944
- o((e) => [...e, ...c]), c.filter((e) => !Vn.includes(e._ext)).forEach((e) => {
2939
+ o((e) => [...e, ...c]), c.filter((e) => !Jn.includes(e._ext)).forEach((e) => {
2945
2940
  setTimeout(() => {
2946
2941
  o((t) => t.map((t) => t.id === e.id ? {
2947
2942
  ...t,
@@ -2949,16 +2944,16 @@ function Gn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
2949
2944
  } : t));
2950
2945
  }, 600 + Math.random() * 600);
2951
2946
  });
2952
- let l = c.filter((e) => Vn.includes(e._ext));
2947
+ let l = c.filter((e) => Jn.includes(e._ext));
2953
2948
  if (l.length !== 0) try {
2954
- let { data: e, error: a } = await Ye({ body: { files: l.map((e) => e.file) } });
2955
- if (a || !e?.files) throw Error(Wn(a ?? e, "Upload failed."));
2949
+ let { data: e, error: a } = await nt({ body: { files: l.map((e) => e.file) } });
2950
+ if (a || !e?.files) throw Error(Zn(a ?? e, "Upload failed."));
2956
2951
  o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
2957
2952
  ...e,
2958
2953
  uploadStatus: "complete"
2959
2954
  } : e)), r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]);
2960
2955
  } catch (e) {
2961
- q.error(Wn(e, "Failed to upload files.")), o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
2956
+ q.error(Zn(e, "Failed to upload files.")), o((e) => e.map((e) => l.some((t) => t.id === e.id) ? {
2962
2957
  ...e,
2963
2958
  uploadStatus: "error"
2964
2959
  } : e));
@@ -2988,10 +2983,10 @@ function Gn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
2988
2983
  headers: { "Content-Type": "application/json" },
2989
2984
  body: JSON.stringify({ url: a })
2990
2985
  })).json();
2991
- if (!e?.files || e.files.length === 0) throw Error(Wn(e, `Could not extract content from ${a}`));
2986
+ if (!e?.files || e.files.length === 0) throw Error(Zn(e, `Could not extract content from ${a}`));
2992
2987
  return r([...t, ...e.files]), i([...n, ...e.files.map((e) => e.fileId)]), q.success(`Added "${e.files[0].fileName}" as context.`), !0;
2993
2988
  } catch (e) {
2994
- return q.error(Wn(e, "Failed to extract URL.")), !1;
2989
+ return q.error(Zn(e, "Failed to extract URL.")), !1;
2995
2990
  } finally {
2996
2991
  m(!1);
2997
2992
  }
@@ -3038,24 +3033,24 @@ function Gn({ setMessage: e, contextFiles: t, contextFileIds: n, setContextFiles
3038
3033
  }
3039
3034
  //#endregion
3040
3035
  //#region src/components/FileUpload/GoogleDrivePicker.tsx
3041
- var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3036
+ var $n = () => window.gapi, er = () => window.google, tr = () => {
3042
3037
  let e = f(!1), n = f(!1);
3043
3038
  return u(() => {
3044
- Kn() ? n.current = !0 : (() => {
3039
+ $n() ? n.current = !0 : (() => {
3045
3040
  let e = document.createElement("script");
3046
3041
  e.src = "https://apis.google.com/js/api.js", e.onload = () => {
3047
- Kn()?.load("client:picker", () => {
3042
+ $n()?.load("client:picker", () => {
3048
3043
  n.current = !0;
3049
3044
  });
3050
3045
  }, document.body.appendChild(e);
3051
- })(), qn()?.picker ? e.current = !0 : (() => {
3046
+ })(), er()?.picker ? e.current = !0 : (() => {
3052
3047
  let t = document.createElement("script");
3053
3048
  t.src = "https://www.google.com/jsapi", t.onload = () => {
3054
3049
  e.current = !0;
3055
3050
  }, document.body.appendChild(t);
3056
3051
  })();
3057
3052
  }, []), { openPicker: async (e, r, i) => {
3058
- let a = qn();
3053
+ let a = er();
3059
3054
  if (!n.current || !a?.picker) {
3060
3055
  i?.("Google Picker API not loaded yet. Please try again.");
3061
3056
  return;
@@ -3072,13 +3067,13 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3072
3067
  i?.(e.message || "Failed to open Google Picker");
3073
3068
  }
3074
3069
  } };
3075
- }, Yn = () => {
3070
+ }, nr = () => {
3076
3071
  let { chatModelProvider: e, setChatModelProvider: t } = X(), [n, r] = p([]), [i, a] = p(!0), o = h();
3077
3072
  u(() => {
3078
3073
  (async () => {
3079
3074
  try {
3080
3075
  a(!0);
3081
- let { data: n } = await Ge(), i = n?.providers ?? [];
3076
+ let { data: n } = await Xe(), i = n?.providers ?? [];
3082
3077
  if (r(i), !e.key && i.length > 0) {
3083
3078
  let e = localStorage.getItem("chatModelKey"), n = localStorage.getItem("chatModelProviderId");
3084
3079
  if (e && n) t({
@@ -3113,7 +3108,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3113
3108
  key: n
3114
3109
  }), localStorage.setItem("chatModelProviderId", e), localStorage.setItem("chatModelKey", n);
3115
3110
  };
3116
- return /* @__PURE__ */ K(pn, { children: [/* @__PURE__ */ K(mn, {
3111
+ return /* @__PURE__ */ K(bn, { children: [/* @__PURE__ */ K(xn, {
3117
3112
  className: "gap-2",
3118
3113
  children: [
3119
3114
  /* @__PURE__ */ G(B, { className: "w-4 h-4 flex-shrink-0 text-sky-500" }),
@@ -3123,7 +3118,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3123
3118
  children: s
3124
3119
  })
3125
3120
  ]
3126
- }), /* @__PURE__ */ K(hn, {
3121
+ }), /* @__PURE__ */ K(Sn, {
3127
3122
  className: "w-52 max-h-[400px] overflow-y-auto",
3128
3123
  children: [
3129
3124
  i ? /* @__PURE__ */ G("div", {
@@ -3133,7 +3128,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3133
3128
  className: "px-3 py-2 text-xs text-muted-foreground",
3134
3129
  children: "No models configured"
3135
3130
  }) : n.map((t, r) => /* @__PURE__ */ K("div", { children: [
3136
- /* @__PURE__ */ G(fn, {
3131
+ /* @__PURE__ */ G(yn, {
3137
3132
  className: "text-[10px] uppercase tracking-wider text-muted-foreground font-medium",
3138
3133
  children: t.name
3139
3134
  }),
@@ -3170,7 +3165,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3170
3165
  })
3171
3166
  ]
3172
3167
  })] });
3173
- }, Xn = [
3168
+ }, rr = [
3174
3169
  {
3175
3170
  label: "5s",
3176
3171
  value: 5
@@ -3195,28 +3190,28 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3195
3190
  label: "Unlimited",
3196
3191
  value: 0
3197
3192
  }
3198
- ], Zn = [
3193
+ ], ir = [
3199
3194
  "pdf",
3200
3195
  "docx",
3201
3196
  "txt",
3202
3197
  "md",
3203
3198
  "html",
3204
3199
  "htm"
3205
- ], Qn = /* @__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("."), $n = ({ onFileSelect: e, disabled: t = !1 }) => {
3206
- let n = h(), { category: i, setCategory: a, incognito: o, setIncognito: s, sections: c, chatId: l } = X(), { isAuthenticated: d } = Zt(), f = i ? i.split(",").filter(Boolean) : ["general"], m = wt.find((e) => e.code === f[0]) || wt[0], g = (e) => {
3200
+ ], ar = /* @__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("."), or = ({ onFileSelect: e, disabled: t = !1 }) => {
3201
+ let n = h(), { category: i, setCategory: a, incognito: o, setIncognito: s, sections: c, chatId: l } = X(), { isAuthenticated: d } = an(), f = i ? i.split(",").filter(Boolean) : ["general"], m = jt.find((e) => e.code === f[0]) || jt[0], g = (e) => {
3207
3202
  let t = i ? i.split(",").filter(Boolean) : ["general"], n = t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
3208
3203
  a(n.length > 0 ? n.join(",") : "general");
3209
3204
  }, [_, v] = p(!1), [y, b] = p(!1), [x, S] = p(!1), [C, T] = p(!1), [E, D] = p(() => {
3210
3205
  if (typeof window > "u") return 5;
3211
3206
  let e = Number(localStorage.getItem("thinkingTimeLimit") ?? "5");
3212
3207
  return Number.isFinite(e) ? e : 5;
3213
- }), O = r.useRef(null), { openPicker: k } = Jn();
3208
+ }), O = r.useRef(null), { openPicker: k } = tr();
3214
3209
  u(() => {
3215
3210
  A();
3216
3211
  }, []);
3217
3212
  let A = async () => {
3218
3213
  try {
3219
- let { data: e } = await Ue();
3214
+ let { data: e } = await qe();
3220
3215
  v(e?.isConnected || !1);
3221
3216
  } catch {}
3222
3217
  }, j = (e) => {
@@ -3254,8 +3249,8 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3254
3249
  let n = [];
3255
3250
  for await (let r of e.values()) if (r.kind === "file") {
3256
3251
  let e = await r.getFile(), i = e.name.split(".").pop()?.toLowerCase() ?? "";
3257
- if (Zn.includes(i)) n.push(e);
3258
- else if (Qn.includes(i)) try {
3252
+ if (ir.includes(i)) n.push(e);
3253
+ else if (ar.includes(i)) try {
3259
3254
  let r = await e.text(), i = t ? `${t}/${e.name}` : e.name;
3260
3255
  n.push(new File([r], `${i.replace(/[/\\]/g, "_")}.txt`, { type: "text/plain" }));
3261
3256
  } catch {}
@@ -3283,7 +3278,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3283
3278
  }, F = async () => {
3284
3279
  b(!0);
3285
3280
  try {
3286
- let { data: e } = await He();
3281
+ let { data: e } = await Ke();
3287
3282
  if (e?.success && e?.data?.authUrl) {
3288
3283
  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) => {
3289
3284
  e.data.type === "google-drive-connected" && (v(!0), i?.close(), window.removeEventListener("message", a));
@@ -3297,14 +3292,14 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3297
3292
  }
3298
3293
  }, L = async () => {
3299
3294
  try {
3300
- let { data: t } = await Ve();
3295
+ let { data: t } = await Ge();
3301
3296
  if (!t?.success || !t.accessToken) throw Error("Failed to get access token");
3302
3297
  await k(t.accessToken, async (t) => {
3303
3298
  S(!0);
3304
3299
  try {
3305
3300
  let n = [];
3306
3301
  for (let e of t) {
3307
- let { data: t } = await Be({ query: { fileId: e.id } });
3302
+ let { data: t } = await We({ query: { fileId: e.id } });
3308
3303
  if (t?.success && t?.file) {
3309
3304
  let e = atob(t.file.content), r = new Uint8Array(e.length);
3310
3305
  for (let t = 0; t < e.length; t++) r[t] = e.charCodeAt(t);
@@ -3323,11 +3318,11 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3323
3318
  } catch (e) {
3324
3319
  alert(e.message || "Failed to open Google Drive picker");
3325
3320
  }
3326
- }, z = Xn.find((e) => e.value === E)?.label ?? "Unlimited";
3321
+ }, z = rr.find((e) => e.value === E)?.label ?? "Unlimited";
3327
3322
  return /* @__PURE__ */ K(W, { children: [
3328
3323
  /* @__PURE__ */ K("div", {
3329
3324
  className: "relative flex shrink min-w-8 !shrink-0 group",
3330
- children: [/* @__PURE__ */ K(cn, { children: [/* @__PURE__ */ G(ln, {
3325
+ children: [/* @__PURE__ */ K(hn, { children: [/* @__PURE__ */ G(gn, {
3331
3326
  asChild: !0,
3332
3327
  children: /* @__PURE__ */ G("button", {
3333
3328
  disabled: t,
@@ -3336,19 +3331,19 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3336
3331
  "aria-label": "Search options",
3337
3332
  children: /* @__PURE__ */ G(be, { className: "w-5 h-5" })
3338
3333
  })
3339
- }), /* @__PURE__ */ K(un, {
3334
+ }), /* @__PURE__ */ K(_n, {
3340
3335
  align: "start",
3341
3336
  side: "top",
3342
3337
  sideOffset: 8,
3343
3338
  className: "w-44",
3344
3339
  children: [
3345
- /* @__PURE__ */ K(pn, { children: [/* @__PURE__ */ K(mn, {
3340
+ /* @__PURE__ */ K(bn, { children: [/* @__PURE__ */ K(xn, {
3346
3341
  className: "gap-2",
3347
3342
  children: [m && /* @__PURE__ */ G(m.icon, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ G("span", { children: "Category" })]
3348
- }), /* @__PURE__ */ K(hn, {
3343
+ }), /* @__PURE__ */ K(Sn, {
3349
3344
  className: "w-44",
3350
3345
  children: [
3351
- /* @__PURE__ */ K(dn, {
3346
+ /* @__PURE__ */ K(vn, {
3352
3347
  checked: f.length === 0,
3353
3348
  onCheckedChange: () => a("general"),
3354
3349
  onSelect: (e) => e.preventDefault(),
@@ -3356,7 +3351,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3356
3351
  children: [/* @__PURE__ */ G("div", { className: "w-3.5 h-3.5 flex-shrink-0" }), /* @__PURE__ */ G("span", { children: "None" })]
3357
3352
  }),
3358
3353
  /* @__PURE__ */ G(Q, {}),
3359
- wt.map((e) => /* @__PURE__ */ K(dn, {
3354
+ jt.map((e) => /* @__PURE__ */ K(vn, {
3360
3355
  checked: f.includes(e.code),
3361
3356
  onCheckedChange: () => g(e.code),
3362
3357
  onSelect: (e) => e.preventDefault(),
@@ -3365,7 +3360,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3365
3360
  }, e.code))
3366
3361
  ]
3367
3362
  })] }),
3368
- /* @__PURE__ */ K(pn, { children: [/* @__PURE__ */ K(mn, {
3363
+ /* @__PURE__ */ K(bn, { children: [/* @__PURE__ */ K(xn, {
3369
3364
  className: "gap-2",
3370
3365
  children: [
3371
3366
  /* @__PURE__ */ G(I, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }),
@@ -3375,9 +3370,9 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3375
3370
  children: z
3376
3371
  })
3377
3372
  ]
3378
- }), /* @__PURE__ */ G(hn, {
3373
+ }), /* @__PURE__ */ G(Sn, {
3379
3374
  className: "w-36",
3380
- children: Xn.map((e) => /* @__PURE__ */ K(Z, {
3375
+ children: rr.map((e) => /* @__PURE__ */ K(Z, {
3381
3376
  onSelect: () => j(e.value),
3382
3377
  className: Y("justify-between", E === e.value && "bg-secondary"),
3383
3378
  children: [/* @__PURE__ */ G("span", { children: e.label }), E === e.value && /* @__PURE__ */ G("svg", {
@@ -3395,12 +3390,12 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3395
3390
  }, e.value))
3396
3391
  })] }),
3397
3392
  /* @__PURE__ */ G(Q, {}),
3398
- /* @__PURE__ */ G(Yn, {}),
3393
+ /* @__PURE__ */ G(nr, {}),
3399
3394
  /* @__PURE__ */ G(Q, {}),
3400
- /* @__PURE__ */ K(pn, { children: [/* @__PURE__ */ K(mn, {
3395
+ /* @__PURE__ */ K(bn, { children: [/* @__PURE__ */ K(xn, {
3401
3396
  className: "gap-2",
3402
3397
  children: [/* @__PURE__ */ G(Oe, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ G("span", { children: "Upload" })]
3403
- }), /* @__PURE__ */ K(hn, {
3398
+ }), /* @__PURE__ */ K(Sn, {
3404
3399
  className: "w-44",
3405
3400
  children: [
3406
3401
  /* @__PURE__ */ K(Z, {
@@ -3415,7 +3410,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3415
3410
  children: [C ? /* @__PURE__ */ G(U, { className: "h-3.5 w-3.5 animate-spin flex-shrink-0" }) : /* @__PURE__ */ G(oe, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ G("span", { children: C ? "Scanning…" : "Local Folder" })]
3416
3411
  }),
3417
3412
  /* @__PURE__ */ G(Q, {}),
3418
- /* @__PURE__ */ G(fn, {
3413
+ /* @__PURE__ */ G(yn, {
3419
3414
  className: "text-xs font-normal text-muted-foreground",
3420
3415
  children: "Cloud"
3421
3416
  }),
@@ -3433,7 +3428,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3433
3428
  ]
3434
3429
  })] }),
3435
3430
  /* @__PURE__ */ G(Q, {}),
3436
- /* @__PURE__ */ K(dn, {
3431
+ /* @__PURE__ */ K(vn, {
3437
3432
  checked: o,
3438
3433
  onCheckedChange: s,
3439
3434
  onSelect: (e) => e.preventDefault(),
@@ -3441,10 +3436,10 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3441
3436
  children: [/* @__PURE__ */ G(H, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ G("span", { children: "Private" })]
3442
3437
  }),
3443
3438
  /* @__PURE__ */ G(Q, {}),
3444
- c.length > 0 && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ K(pn, { children: [/* @__PURE__ */ K(mn, {
3439
+ c.length > 0 && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ K(bn, { children: [/* @__PURE__ */ K(xn, {
3445
3440
  className: "gap-2",
3446
3441
  children: [/* @__PURE__ */ G(ye, { className: "w-4 h-4 flex-shrink-0 text-muted-foreground" }), /* @__PURE__ */ G("span", { children: "Share" })]
3447
- }), /* @__PURE__ */ K(hn, {
3442
+ }), /* @__PURE__ */ K(Sn, {
3448
3443
  className: "w-48",
3449
3444
  children: [
3450
3445
  /* @__PURE__ */ K(Z, {
@@ -3458,7 +3453,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3458
3453
  return;
3459
3454
  }
3460
3455
  try {
3461
- let { data: e, error: t } = await qe({ body: { chatId: l } });
3456
+ let { data: e, error: t } = await et({ body: { chatId: l } });
3462
3457
  if (!t && e?.success && e?.data?.shareUrl) await navigator.clipboard.writeText(e.data.shareUrl), q.success("Chat is now public - link copied to clipboard");
3463
3458
  else throw Error(t?.error || "Failed to share chat");
3464
3459
  } catch (e) {
@@ -3474,7 +3469,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3474
3469
  onSelect: async () => {
3475
3470
  let e = c[0]?.userMessage?.content || "Chat", t = c.map((e) => `## ${e.userMessage.content}\n\n${e.assistantMessage?.content || ""}`).join("\n\n---\n\n");
3476
3471
  try {
3477
- await Re({ body: {
3472
+ await ze({ body: {
3478
3473
  title: e,
3479
3474
  name: e,
3480
3475
  content: t,
@@ -3493,28 +3488,28 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3493
3488
  /* @__PURE__ */ G(Q, {}),
3494
3489
  /* @__PURE__ */ K(Z, {
3495
3490
  onSelect: () => {
3496
- Dn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
3491
+ Pn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
3497
3492
  },
3498
3493
  className: "gap-2",
3499
3494
  children: [/* @__PURE__ */ G(ie, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ G("span", { children: "Export as Markdown" })]
3500
3495
  }),
3501
3496
  /* @__PURE__ */ K(Z, {
3502
3497
  onSelect: () => {
3503
- kn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
3498
+ In(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
3504
3499
  },
3505
3500
  className: "gap-2",
3506
3501
  children: [/* @__PURE__ */ G(ae, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ G("span", { children: "Export as PDF" })]
3507
3502
  }),
3508
3503
  /* @__PURE__ */ K(Z, {
3509
3504
  onSelect: () => {
3510
- On(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
3505
+ Fn(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
3511
3506
  },
3512
3507
  className: "gap-2",
3513
3508
  children: [/* @__PURE__ */ G(ne, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ G("span", { children: "Export as DOCX" })]
3514
3509
  }),
3515
3510
  /* @__PURE__ */ K(Z, {
3516
3511
  onSelect: () => {
3517
- An(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
3512
+ Ln(c[0]?.userMessage?.content || "Chat", c.map((e) => `<h2>${e.userMessage.content}</h2>${e.assistantMessage?.content || ""}`).join("\n"));
3518
3513
  },
3519
3514
  className: "gap-2",
3520
3515
  children: [/* @__PURE__ */ G(re, { className: "w-4 h-4 flex-shrink-0" }), /* @__PURE__ */ G("span", { children: "Export to Google Docs" })]
@@ -3567,7 +3562,7 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3567
3562
  className: "hidden"
3568
3563
  })
3569
3564
  ] });
3570
- }, er = o(({ active: e = !1, processing: t = !1, barWidth: n = 3, barHeight: r = 4, barGap: i = 1, barRadius: a = 1.5, barColor: o, fadeEdges: s = !0, fadeWidth: l = 24, height: d = 64, sensitivity: p = 1, smoothingTimeConstant: m = .8, fftSize: h = 256, historySize: g = 60, updateRate: _ = 30, mode: v = "static", onError: y, onStreamReady: b, onStreamEnd: x, className: S, ...C }, w) => {
3565
+ }, sr = o(({ active: e = !1, processing: t = !1, barWidth: n = 3, barHeight: r = 4, barGap: i = 1, barRadius: a = 1.5, barColor: o, fadeEdges: s = !0, fadeWidth: l = 24, height: d = 64, sensitivity: p = 1, smoothingTimeConstant: m = .8, fftSize: h = 256, historySize: g = 60, updateRate: _ = 30, mode: v = "static", onError: y, onStreamReady: b, onStreamEnd: x, className: S, ...C }, w) => {
3571
3566
  let T = f(null), E = f(null), D = f(null), O = f(null), k = f(null), A = f(0), j = f([]), M = f(0), N = f(0), P = c(() => {
3572
3567
  A.current &&= (cancelAnimationFrame(A.current), 0), k.current &&= (k.current.disconnect(), null), O.current &&= (O.current.getTracks().forEach((e) => e.stop()), null), E.current &&= (E.current.close().catch(() => {}), null), D.current = null, j.current = [], x?.();
3573
3568
  }, [x]), F = c((e, t, o, s, c) => {
@@ -3716,23 +3711,23 @@ var Kn = () => window.gapi, qn = () => window.google, Jn = () => {
3716
3711
  })
3717
3712
  });
3718
3713
  });
3719
- er.displayName = "LiveWaveform";
3714
+ sr.displayName = "LiveWaveform";
3720
3715
  //#endregion
3721
3716
  //#region src/components/MessageComposer/ChatInputBox.tsx
3722
- var tr = [
3717
+ var cr = [
3723
3718
  "What are you curious to research?",
3724
3719
  "Search the latest news...",
3725
3720
  "Analyze a video, doc, or URL...",
3726
3721
  "Find academic research on...",
3727
3722
  "Compare products to buy..."
3728
- ], nr = {
3723
+ ], lr = {
3729
3724
  initial: {},
3730
3725
  animate: { transition: { staggerChildren: .025 } },
3731
3726
  exit: { transition: {
3732
3727
  staggerChildren: .015,
3733
3728
  staggerDirection: -1
3734
3729
  } }
3735
- }, rr = {
3730
+ }, ur = {
3736
3731
  initial: {
3737
3732
  opacity: 0,
3738
3733
  filter: "blur(12px)",
@@ -3766,8 +3761,8 @@ var tr = [
3766
3761
  }
3767
3762
  }
3768
3763
  }
3769
- }, ir = ({ onNewChat: e }) => {
3770
- let { loading: t, sendMessage: n, stopStreaming: r, files: i, fileIds: a, setFiles: o, setFileIds: s, newChat: c, sections: l } = X(), [d, m] = p(""), h = f(null), g = f(null), { files: _, setFiles: v, pastedContent: y, setPastedContent: b, isDragging: x, handleFiles: S, onDragOver: C, onDragLeave: w, onDrop: T, handlePaste: E, resetAttachments: D } = Gn({
3764
+ }, dr = ({ onNewChat: e }) => {
3765
+ let { loading: t, sendMessage: n, stopStreaming: r, files: i, fileIds: a, setFiles: o, setFileIds: s, newChat: c, sections: l } = X(), [d, m] = p(""), h = f(null), g = f(null), { files: _, setFiles: v, pastedContent: y, setPastedContent: b, isDragging: x, handleFiles: S, onDragOver: C, onDragLeave: w, onDrop: T, handlePaste: E, resetAttachments: D } = Qn({
3771
3766
  setMessage: m,
3772
3767
  contextFiles: i,
3773
3768
  contextFileIds: a,
@@ -3775,7 +3770,7 @@ var tr = [
3775
3770
  setContextFileIds: s
3776
3771
  }), O = () => {
3777
3772
  m(""), D(), h.current && (h.current.style.height = "auto");
3778
- }, { isListening: k, toggleSpeech: A, isSpeechSupported: j } = Bn((e) => m(e), () => {
3773
+ }, { isListening: k, toggleSpeech: A, isSpeechSupported: j } = qn((e) => m(e), () => {
3779
3774
  m((e) => (e.trim() && setTimeout(() => {
3780
3775
  n(e), O();
3781
3776
  }, 0), e));
@@ -3795,9 +3790,15 @@ var tr = [
3795
3790
  let t = new AbortController();
3796
3791
  oe.current = t;
3797
3792
  try {
3798
- let n = await fetch(`/api/agent/autocomplete?q=${encodeURIComponent(e)}&limit=8`, { signal: t.signal });
3799
- if (!n.ok) return;
3800
- let r = await n.json(), i = Array.isArray(r?.suggestions) ? r.suggestions : [], a = Array.isArray(r?.domains) ? r.domains : [];
3793
+ let { data: n, error: r } = await Re({
3794
+ query: {
3795
+ q: e,
3796
+ limit: 8
3797
+ },
3798
+ signal: t.signal
3799
+ });
3800
+ if (r) return;
3801
+ let i = Array.isArray(n?.suggestions) ? n.suggestions : [], a = Array.isArray(n?.domains) ? n.domains : [];
3801
3802
  if (z(i), ee(a), i.length + a.length > 0) {
3802
3803
  if (g.current) {
3803
3804
  let e = g.current.getBoundingClientRect(), t = window.innerHeight - e.bottom, n = e.top;
@@ -3836,7 +3837,7 @@ var tr = [
3836
3837
  if (I || d) return;
3837
3838
  let e = setInterval(() => {
3838
3839
  F(!1), setTimeout(() => {
3839
- N((e) => (e + 1) % tr.length), F(!0);
3840
+ N((e) => (e + 1) % cr.length), F(!0);
3840
3841
  }, 400);
3841
3842
  }, 3e3);
3842
3843
  return () => clearInterval(e);
@@ -3886,7 +3887,7 @@ var tr = [
3886
3887
  onDragLeave: w,
3887
3888
  onDrop: T,
3888
3889
  children: [
3889
- /* @__PURE__ */ K($e.div, {
3890
+ /* @__PURE__ */ K(ot.div, {
3890
3891
  ref: g,
3891
3892
  className: "!box-content flex flex-col mx-2 md:mx-0 items-stretch relative z-10 rounded-[28px] bg-gray-50 dark:bg-[#30302E] border border-bg-300 dark:border-transparent cursor-text font-sans antialiased",
3892
3893
  animate: { boxShadow: I || d ? "0 8px 32px 0 rgba(0,0,0,0.16)" : "0 2px 8px 0 rgba(0,0,0,0.08)" },
@@ -3899,17 +3900,17 @@ var tr = [
3899
3900
  children: [
3900
3901
  (_.length > 0 || y.length > 0) && /* @__PURE__ */ K("div", {
3901
3902
  className: "flex gap-3 overflow-x-auto custom-scrollbar px-3 pt-3 pb-1",
3902
- children: [y.map((e) => /* @__PURE__ */ G(zn, {
3903
+ children: [y.map((e) => /* @__PURE__ */ G(Kn, {
3903
3904
  content: e,
3904
3905
  onRemove: (e) => b((t) => t.filter((t) => t.id !== e))
3905
- }, e.id)), _.map((e) => /* @__PURE__ */ G(Rn, {
3906
+ }, e.id)), _.map((e) => /* @__PURE__ */ G(Gn, {
3906
3907
  file: e,
3907
3908
  onRemove: (e) => v((t) => t.filter((t) => t.id !== e))
3908
3909
  }, e.id))]
3909
3910
  }),
3910
3911
  k && /* @__PURE__ */ G("div", {
3911
3912
  className: "px-3 pt-2",
3912
- children: /* @__PURE__ */ G(er, {
3913
+ children: /* @__PURE__ */ G(sr, {
3913
3914
  active: k,
3914
3915
  mode: "static",
3915
3916
  height: 48,
@@ -3924,7 +3925,7 @@ var tr = [
3924
3925
  /* @__PURE__ */ K("div", {
3925
3926
  className: "flex items-center gap-2 p-3",
3926
3927
  children: [
3927
- /* @__PURE__ */ G($n, {
3928
+ /* @__PURE__ */ G(or, {
3928
3929
  onFileSelect: S,
3929
3930
  disabled: t
3930
3931
  }),
@@ -3946,21 +3947,21 @@ var tr = [
3946
3947
  })
3947
3948
  }), /* @__PURE__ */ G("div", {
3948
3949
  className: "absolute left-0 top-0 w-full h-full pointer-events-none flex items-center",
3949
- children: /* @__PURE__ */ G(Ze, {
3950
+ children: /* @__PURE__ */ G(it, {
3950
3951
  mode: "wait",
3951
- children: P && !I && !d && /* @__PURE__ */ G($e.span, {
3952
+ children: P && !I && !d && /* @__PURE__ */ G(ot.span, {
3952
3953
  className: "absolute left-0 top-1/2 -translate-y-1/2 text-text-400 select-none pointer-events-none text-[16px] font-normal",
3953
3954
  style: {
3954
3955
  whiteSpace: "nowrap",
3955
3956
  overflow: "hidden",
3956
3957
  textOverflow: "ellipsis"
3957
3958
  },
3958
- variants: nr,
3959
+ variants: lr,
3959
3960
  initial: "initial",
3960
3961
  animate: "animate",
3961
3962
  exit: "exit",
3962
- children: tr[M].split("").map((e, t) => /* @__PURE__ */ G($e.span, {
3963
- variants: rr,
3963
+ children: cr[M].split("").map((e, t) => /* @__PURE__ */ G(ot.span, {
3964
+ variants: ur,
3964
3965
  style: { display: "inline-block" },
3965
3966
  children: e === " " ? "\xA0" : e
3966
3967
  }, t))
@@ -4039,7 +4040,7 @@ var tr = [
4039
4040
  })
4040
4041
  ]
4041
4042
  }),
4042
- /* @__PURE__ */ G(Ze, { children: te && U > 0 && /* @__PURE__ */ G($e.div, {
4043
+ /* @__PURE__ */ G(it, { children: te && U > 0 && /* @__PURE__ */ G(ot.div, {
4043
4044
  ref: (e) => {
4044
4045
  e && g.current && g.current.contains(e);
4045
4046
  },
@@ -4118,40 +4119,40 @@ var tr = [
4118
4119
  };
4119
4120
  //#endregion
4120
4121
  //#region src/ui/dialog.tsx
4121
- function ar({ ...e }) {
4122
- return /* @__PURE__ */ G(ct.Root, {
4122
+ function fr({ ...e }) {
4123
+ return /* @__PURE__ */ G(ht.Root, {
4123
4124
  "data-slot": "dialog",
4124
4125
  ...e
4125
4126
  });
4126
4127
  }
4127
- function or({ ...e }) {
4128
- return /* @__PURE__ */ G(ct.Trigger, {
4128
+ function pr({ ...e }) {
4129
+ return /* @__PURE__ */ G(ht.Trigger, {
4129
4130
  "data-slot": "dialog-trigger",
4130
4131
  ...e
4131
4132
  });
4132
4133
  }
4133
- function sr({ ...e }) {
4134
- return /* @__PURE__ */ G(ct.Portal, {
4134
+ function mr({ ...e }) {
4135
+ return /* @__PURE__ */ G(ht.Portal, {
4135
4136
  "data-slot": "dialog-portal",
4136
4137
  ...e
4137
4138
  });
4138
4139
  }
4139
- function cr({ className: e, ...t }) {
4140
- return /* @__PURE__ */ G(ct.Overlay, {
4140
+ function hr({ className: e, ...t }) {
4141
+ return /* @__PURE__ */ G(ht.Overlay, {
4141
4142
  "data-slot": "dialog-overlay",
4142
4143
  className: Y("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs", e),
4143
4144
  ...t
4144
4145
  });
4145
4146
  }
4146
- function lr({ className: e, children: t, hideCloseButton: n = !1, ...r }) {
4147
- return /* @__PURE__ */ K(sr, {
4147
+ function gr({ className: e, children: t, hideCloseButton: n = !1, ...r }) {
4148
+ return /* @__PURE__ */ K(mr, {
4148
4149
  "data-slot": "dialog-portal",
4149
- children: [/* @__PURE__ */ G(cr, {}), /* @__PURE__ */ K(ct.Content, {
4150
+ children: [/* @__PURE__ */ G(hr, {}), /* @__PURE__ */ K(ht.Content, {
4150
4151
  "data-slot": "dialog-content",
4151
4152
  "aria-describedby": r["aria-describedby"] ?? void 0,
4152
4153
  className: Y("z-[9999] bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200", e),
4153
4154
  ...r,
4154
- children: [t, !n && /* @__PURE__ */ K(ct.Close, {
4155
+ children: [t, !n && /* @__PURE__ */ K(ht.Close, {
4155
4156
  className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
4156
4157
  children: [/* @__PURE__ */ G(Me, {}), /* @__PURE__ */ G("span", {
4157
4158
  className: "sr-only",
@@ -4161,15 +4162,15 @@ function lr({ className: e, children: t, hideCloseButton: n = !1, ...r }) {
4161
4162
  })]
4162
4163
  });
4163
4164
  }
4164
- function ur({ className: e, ...t }) {
4165
- return /* @__PURE__ */ G(ct.Title, {
4165
+ function _r({ className: e, ...t }) {
4166
+ return /* @__PURE__ */ G(ht.Title, {
4166
4167
  "data-slot": "dialog-title",
4167
4168
  className: Y("text-lg leading-none font-semibold", e),
4168
4169
  ...t
4169
4170
  });
4170
4171
  }
4171
- function dr({ className: e, ...t }) {
4172
- return /* @__PURE__ */ G(ct.Description, {
4172
+ function vr({ className: e, ...t }) {
4173
+ return /* @__PURE__ */ G(ht.Description, {
4173
4174
  "data-slot": "dialog-description",
4174
4175
  className: Y("text-muted-foreground text-sm", e),
4175
4176
  ...t
@@ -4177,7 +4178,7 @@ function dr({ className: e, ...t }) {
4177
4178
  }
4178
4179
  //#endregion
4179
4180
  //#region src/ui/visually-hidden.tsx
4180
- var fr = n.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ G("span", {
4181
+ var yr = n.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ G("span", {
4181
4182
  ref: n,
4182
4183
  className: Y("absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0", e),
4183
4184
  style: {
@@ -4186,17 +4187,17 @@ var fr = n.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ G("span", {
4186
4187
  },
4187
4188
  ...t
4188
4189
  }));
4189
- fr.displayName = "VisuallyHidden";
4190
+ yr.displayName = "VisuallyHidden";
4190
4191
  //#endregion
4191
4192
  //#region src/components/ArticleReader/ArticlePanelHeader.tsx
4192
- var pr = ({ onClose: e }) => /* @__PURE__ */ G("div", {
4193
+ var br = ({ onClose: e }) => /* @__PURE__ */ G("div", {
4193
4194
  className: "flex items-center justify-between bg-secondary px-4 py-3 border-b border-border",
4194
4195
  children: /* @__PURE__ */ G("button", {
4195
4196
  onClick: e,
4196
4197
  className: "rounded-md p-1 hover:bg-accent transition-colors",
4197
4198
  children: /* @__PURE__ */ G(je, { className: "h-5 w-5" })
4198
4199
  })
4199
- }), mr = 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", {
4200
+ }), xr = pt("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", {
4200
4201
  variants: {
4201
4202
  variant: {
4202
4203
  default: "bg-primary text-primary-foreground hover:bg-primary/90",
@@ -4218,10 +4219,10 @@ var pr = ({ onClose: e }) => /* @__PURE__ */ G("div", {
4218
4219
  size: "default"
4219
4220
  }
4220
4221
  });
4221
- function hr({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
4222
- return /* @__PURE__ */ G(r ? at : "button", {
4222
+ function Sr({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
4223
+ return /* @__PURE__ */ G(r ? ft : "button", {
4223
4224
  "data-slot": "button",
4224
- className: Y(mr({
4225
+ className: Y(xr({
4225
4226
  variant: t,
4226
4227
  size: n,
4227
4228
  className: e
@@ -4231,10 +4232,10 @@ function hr({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
4231
4232
  }
4232
4233
  //#endregion
4233
4234
  //#region src/components/ArticleReader/ArticleActionButtons.tsx
4234
- var gr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavorited: r, isHighlightMode: i, onAskClick: a, onSuggestClick: o, onCopyClick: s, onFavoriteClick: c, onHighlightToggle: l }) => /* @__PURE__ */ K("div", {
4235
+ var Cr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavorited: r, isHighlightMode: i, onAskClick: a, onSuggestClick: o, onCopyClick: s, onFavoriteClick: c, onHighlightToggle: l }) => /* @__PURE__ */ K("div", {
4235
4236
  className: "flex flex-wrap items-center gap-1 rounded-2xl border border-muted bg-gradient-to-b from-background to-muted/30 p-1 shadow-sm",
4236
4237
  children: [
4237
- /* @__PURE__ */ K(hr, {
4238
+ /* @__PURE__ */ K(Sr, {
4238
4239
  onClick: a,
4239
4240
  disabled: e,
4240
4241
  variant: "ghost",
@@ -4245,7 +4246,7 @@ var gr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavor
4245
4246
  children: e ? "..." : "Ask"
4246
4247
  })]
4247
4248
  }),
4248
- /* @__PURE__ */ K(hr, {
4249
+ /* @__PURE__ */ K(Sr, {
4249
4250
  onClick: o,
4250
4251
  disabled: t,
4251
4252
  variant: "ghost",
@@ -4256,14 +4257,14 @@ var gr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavor
4256
4257
  children: "Suggest"
4257
4258
  })]
4258
4259
  }),
4259
- /* @__PURE__ */ G(hr, {
4260
+ /* @__PURE__ */ G(Sr, {
4260
4261
  onClick: s,
4261
4262
  variant: "ghost",
4262
4263
  size: "icon",
4263
4264
  className: Y("h-9 w-9 rounded-xl transition-all duration-200", "hover:bg-muted/80 hover:text-foreground text-muted-foreground"),
4264
4265
  children: /* @__PURE__ */ G(P, { className: "size-4" })
4265
4266
  }),
4266
- /* @__PURE__ */ G(hr, {
4267
+ /* @__PURE__ */ G(Sr, {
4267
4268
  onClick: l,
4268
4269
  variant: "ghost",
4269
4270
  size: "icon",
@@ -4271,7 +4272,7 @@ var gr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavor
4271
4272
  title: i ? "Disable highlighting" : "Enable highlighting",
4272
4273
  children: /* @__PURE__ */ G(se, { className: "size-4" })
4273
4274
  }),
4274
- /* @__PURE__ */ G(hr, {
4275
+ /* @__PURE__ */ G(Sr, {
4275
4276
  onClick: c,
4276
4277
  disabled: n,
4277
4278
  variant: "ghost",
@@ -4281,7 +4282,7 @@ var gr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavor
4281
4282
  children: /* @__PURE__ */ G(Ce, { className: Y("size-4", r && "fill-yellow-400") })
4282
4283
  })
4283
4284
  ]
4284
- }), _r = ({ value: e, onChange: t, onSubmit: n }) => /* @__PURE__ */ G("div", {
4285
+ }), wr = ({ value: e, onChange: t, onSubmit: n }) => /* @__PURE__ */ G("div", {
4285
4286
  className: "relative",
4286
4287
  children: /* @__PURE__ */ G("input", {
4287
4288
  value: e,
@@ -4291,7 +4292,7 @@ var gr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavor
4291
4292
  placeholder: "Ask AI any question...",
4292
4293
  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"
4293
4294
  })
4294
- }), vr = ({ questions: e, isLoading: n, error: i, onQuestionClick: a }) => {
4295
+ }), Tr = ({ questions: e, isLoading: n, error: i, onQuestionClick: a }) => {
4295
4296
  let o = r.useMemo(() => {
4296
4297
  let t = [];
4297
4298
  return e.forEach((e) => {
@@ -4328,7 +4329,7 @@ var gr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavor
4328
4329
  children: i
4329
4330
  })
4330
4331
  ] });
4331
- }, yr = ({ response: e, isLoading: t, error: n }) => /* @__PURE__ */ K(W, { children: [
4332
+ }, Er = ({ response: e, isLoading: t, error: n }) => /* @__PURE__ */ K(W, { children: [
4332
4333
  t && /* @__PURE__ */ G("div", {
4333
4334
  className: "flex justify-center",
4334
4335
  children: /* @__PURE__ */ G("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" })
@@ -4342,10 +4343,10 @@ var gr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavor
4342
4343
  className: "bg-red-500 text-white p-2 rounded-md text-sm",
4343
4344
  children: n
4344
4345
  })
4345
- ] }), br = ({ html: e, isHighlightMode: t = !1 }) => {
4346
+ ] }), Dr = ({ html: e, isHighlightMode: t = !1 }) => {
4346
4347
  let [n, r] = p("");
4347
4348
  return u(() => {
4348
- r(lt.sanitize(e || "", {
4349
+ r(gt.sanitize(e || "", {
4349
4350
  ADD_TAGS: ["figure", "figcaption"],
4350
4351
  ADD_ATTR: ["loading"]
4351
4352
  }));
@@ -4353,7 +4354,7 @@ var gr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavor
4353
4354
  className: `prose prose-neutral dark:prose-invert max-w-none ${t ? "select-text" : ""}`,
4354
4355
  dangerouslySetInnerHTML: { __html: n }
4355
4356
  });
4356
- }, xr = ({ article: e, isHighlightMode: t }) => /* @__PURE__ */ G("div", {
4357
+ }, Or = ({ article: e, isHighlightMode: t }) => /* @__PURE__ */ G("div", {
4357
4358
  className: "border-t border-border pt-6",
4358
4359
  children: /* @__PURE__ */ K("div", { children: [
4359
4360
  /* @__PURE__ */ G("div", { className: "flex items-start justify-between mb-2" }),
@@ -4384,23 +4385,23 @@ var gr = ({ isLoadingAI: e, isLoadingFollowups: t, isLoadingFavorite: n, isFavor
4384
4385
  }),
4385
4386
  /* @__PURE__ */ G("div", {
4386
4387
  id: "article-content",
4387
- children: /* @__PURE__ */ G(br, {
4388
+ children: /* @__PURE__ */ G(Dr, {
4388
4389
  html: e.html || "",
4389
4390
  isHighlightMode: t
4390
4391
  })
4391
4392
  })
4392
4393
  ] })
4393
- }), Sr = /(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/g, Cr = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
4394
- function wr(e) {
4394
+ }), kr = /(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/g, Ar = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
4395
+ function jr(e) {
4395
4396
  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);
4396
4397
  }
4397
- function Tr(e) {
4398
+ function Mr(e) {
4398
4399
  return /^https?:\/\//i.test(e) ? e : `https://${e}`;
4399
4400
  }
4400
- function Er(e) {
4401
+ function Nr(e) {
4401
4402
  if (!e || typeof e != "string") return e;
4402
4403
  let t = e, n = [], r;
4403
- for (Cr.lastIndex = 0; (r = Cr.exec(t)) !== null;) {
4404
+ for (Ar.lastIndex = 0; (r = Ar.exec(t)) !== null;) {
4404
4405
  let e = r[0], i = r.index, a = t.substring(0, i), o = t.substring(i + e.length);
4405
4406
  !a.endsWith("](") && !o.startsWith(")") && n.push({
4406
4407
  email: e,
@@ -4412,9 +4413,9 @@ function Er(e) {
4412
4413
  t = t.substring(0, i) + `[${r}](mailto:${r})` + t.substring(i + r.length);
4413
4414
  }
4414
4415
  let i = [], a;
4415
- for (Sr.lastIndex = 0; (a = Sr.exec(t)) !== null;) {
4416
+ for (kr.lastIndex = 0; (a = kr.exec(t)) !== null;) {
4416
4417
  let e = a[0], n = a.index;
4417
- if (Cr.test(e)) continue;
4418
+ if (Ar.test(e)) continue;
4418
4419
  let r = t.substring(0, n), o = t.substring(n + e.length);
4419
4420
  if (r.endsWith("](") || o.startsWith(")") || (r.match(/```/g) || []).length % 2 != 0) continue;
4420
4421
  let s = r.lastIndexOf("`");
@@ -4422,23 +4423,23 @@ function Er(e) {
4422
4423
  let e = t.substring(s + 1).indexOf("`");
4423
4424
  if (e !== -1 && e > n - s - 1) continue;
4424
4425
  }
4425
- wr(e) && i.push({
4426
+ jr(e) && i.push({
4426
4427
  url: e,
4427
4428
  index: n
4428
4429
  });
4429
4430
  }
4430
4431
  for (let e = i.length - 1; e >= 0; e--) {
4431
- let { url: n, index: r } = i[e], a = Tr(n);
4432
+ let { url: n, index: r } = i[e], a = Mr(n);
4432
4433
  t = t.substring(0, r) + `[${n}](${a})` + t.substring(r + n.length);
4433
4434
  }
4434
4435
  return t;
4435
4436
  }
4436
4437
  //#endregion
4437
4438
  //#region src/components/ArticleReader/unified-markdown.tsx
4438
- function Dr(e) {
4439
+ function Pr(e) {
4439
4440
  return !e || e.startsWith("http://") || e.startsWith("https://") || e.includes("://") ? !1 : e.startsWith("/") || e.startsWith("#");
4440
4441
  }
4441
- function Or(e, t) {
4442
+ function Fr(e, t) {
4442
4443
  if (t.startsWith("#")) {
4443
4444
  e.preventDefault();
4444
4445
  let n = t.substring(1), r = document.getElementById(n);
@@ -4448,7 +4449,7 @@ function Or(e, t) {
4448
4449
  });
4449
4450
  }
4450
4451
  }
4451
- function kr({ code: e }) {
4452
+ function Ir({ code: e }) {
4452
4453
  let [t, n] = p(!1);
4453
4454
  return /* @__PURE__ */ G("button", {
4454
4455
  onClick: c(async () => {
@@ -4463,7 +4464,7 @@ function kr({ code: e }) {
4463
4464
  children: t ? /* @__PURE__ */ G(O, { className: "h-4 w-4 text-green-600 dark:text-green-400" }) : /* @__PURE__ */ G(z, { className: "h-4 w-4" })
4464
4465
  });
4465
4466
  }
4466
- function Ar({ children: e }) {
4467
+ function Lr({ children: e }) {
4467
4468
  let t = f(null), [n, r] = p("");
4468
4469
  return u(() => {
4469
4470
  if (t.current) {
@@ -4479,18 +4480,18 @@ function Ar({ children: e }) {
4479
4480
  ref: t,
4480
4481
  className: Y("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"),
4481
4482
  children: e
4482
- }), n && /* @__PURE__ */ G(kr, { code: n })]
4483
+ }), n && /* @__PURE__ */ G(Ir, { code: n })]
4483
4484
  });
4484
4485
  }
4485
- var jr = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
4486
+ var Rr = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
4486
4487
  if (!e) return /* @__PURE__ */ G("div", {
4487
4488
  className: Y("text-muted-foreground text-sm", t),
4488
4489
  children: "No content"
4489
4490
  });
4490
- let r = Er(e);
4491
+ let r = Nr(e);
4491
4492
  return /* @__PURE__ */ G("div", {
4492
4493
  className: Y("kortix-markdown", t),
4493
- children: /* @__PURE__ */ G(dt, {
4494
+ children: /* @__PURE__ */ G(vt, {
4494
4495
  isAnimating: n,
4495
4496
  components: {
4496
4497
  h1: ({ children: e }) => /* @__PURE__ */ G("h1", {
@@ -4534,13 +4535,13 @@ var jr = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
4534
4535
  children: e
4535
4536
  }),
4536
4537
  a: ({ href: e, children: t }) => {
4537
- let n = Dr(e), r = e?.startsWith("#"), i = Y("font-medium text-foreground", "underline decoration-foreground/30 underline-offset-[3px] decoration-[1px]", "hover:decoration-foreground/60 transition-colors duration-150");
4538
+ let n = Pr(e), r = e?.startsWith("#"), i = Y("font-medium text-foreground", "underline decoration-foreground/30 underline-offset-[3px] decoration-[1px]", "hover:decoration-foreground/60 transition-colors duration-150");
4538
4539
  return r ? /* @__PURE__ */ G("a", {
4539
4540
  href: e,
4540
- onClick: (t) => Or(t, e),
4541
+ onClick: (t) => Fr(t, e),
4541
4542
  className: i,
4542
4543
  children: t
4543
- }) : n ? /* @__PURE__ */ G(ut, {
4544
+ }) : n ? /* @__PURE__ */ G(_t, {
4544
4545
  href: e || "#",
4545
4546
  className: i,
4546
4547
  children: t
@@ -4559,7 +4560,7 @@ var jr = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
4559
4560
  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",
4560
4561
  children: e
4561
4562
  }),
4562
- pre: ({ children: e }) => /* @__PURE__ */ G(Ar, { children: e }),
4563
+ pre: ({ children: e }) => /* @__PURE__ */ G(Lr, { children: e }),
4563
4564
  blockquote: ({ children: e }) => /* @__PURE__ */ G("blockquote", {
4564
4565
  className: Y("my-5 pl-4 py-1 text-sm", "border-l-2 border-border", "text-muted-foreground", "[&>p]:my-2"),
4565
4566
  children: e
@@ -4640,11 +4641,11 @@ var jr = r.memo(({ content: e, className: t, isStreaming: n = !1 }) => {
4640
4641
  })
4641
4642
  });
4642
4643
  });
4643
- jr.displayName = "UnifiedMarkdown";
4644
+ Rr.displayName = "UnifiedMarkdown";
4644
4645
  //#endregion
4645
4646
  //#region src/components/ArticleReader/ArticleExtractPanel.tsx
4646
- var Mr = (e) => {
4647
- let { isOpen: n, url: r, searchText: i, panelWidth: a, setPanelWidth: o, closePanel: s } = ht(), { isAuthenticated: c } = Zt(), l = e.isOpen === void 0 ? n : e.isOpen, d = e.onClose || s, m = e.url || r, h = e.searchText === void 0 ? i : e.searchText, [g, _] = p(null), [v, y] = p([]), [b, x] = p(!1), [S, C] = p(t.defaultSummarizePrompt), [w, T] = p(!1), [E, D] = p(!1), [O, k] = p(!1), [A, j] = p(""), [M, N] = p(""), [P, F] = p([]), [I, L] = p(""), [R, z] = p(!1), [B, ee] = p(!1), [V, H] = p(!1), [te, ne] = p(!1), [re, ie] = p(a), [ae, oe] = p(!1), [se, ce] = p(!1), le = f(null);
4647
+ var zr = (e) => {
4648
+ let { isOpen: n, url: r, searchText: i, panelWidth: a, setPanelWidth: o, closePanel: s } = St(), { isAuthenticated: c } = an(), l = e.isOpen === void 0 ? n : e.isOpen, d = e.onClose || s, m = e.url || r, h = e.searchText === void 0 ? i : e.searchText, [g, _] = p(null), [v, y] = p([]), [b, x] = p(!1), [S, C] = p(t.defaultSummarizePrompt), [w, T] = p(!1), [E, D] = p(!1), [O, k] = p(!1), [A, j] = p(""), [M, N] = p(""), [P, F] = p([]), [I, L] = p(""), [R, z] = p(!1), [B, ee] = p(!1), [V, H] = p(!1), [te, ne] = p(!1), [re, ie] = p(a), [ae, oe] = p(!1), [se, ce] = p(!1), le = f(null);
4648
4649
  u(() => {
4649
4650
  let e = () => {
4650
4651
  ne(window.innerWidth >= 1024);
@@ -4682,14 +4683,14 @@ var Mr = (e) => {
4682
4683
  }
4683
4684
  T(!0);
4684
4685
  try {
4685
- let { data: e } = await ze({ query: { url: m } }), t = e?.article, n = t?.html?.replace(/<[^>]*>/g, "").trim() || "";
4686
+ let { data: e } = await He({ query: { url: m } }), t = e?.article, n = t?.html?.replace(/<[^>]*>/g, "").trim() || "";
4686
4687
  t?.error || n.length < 20 ? (document.dispatchEvent(new CustomEvent("onInvokeChromeAPI", { detail: {
4687
4688
  type: "extractURL",
4688
4689
  url: m
4689
4690
  } })), await Promise.race([new Promise((e) => {
4690
4691
  let t = async (n) => {
4691
4692
  window.removeEventListener("onExtractionResult", t);
4692
- let { data: r } = await ze({ query: { url: m } }), i = r?.article;
4693
+ let { data: r } = await He({ query: { url: m } }), i = r?.article;
4693
4694
  i && (_(i), i.followUpQuestions?.length > 0 && F(i.followUpQuestions)), e();
4694
4695
  };
4695
4696
  window.addEventListener("onExtractionResult", t);
@@ -4701,7 +4702,7 @@ var Mr = (e) => {
4701
4702
  }
4702
4703
  }, ue = async () => {
4703
4704
  try {
4704
- let { data: e } = await We(), t = e?.favorites?.some((e) => e.url === m);
4705
+ let { data: e } = await Ye(), t = e?.favorites?.some((e) => e.url === m);
4705
4706
  z(!!t);
4706
4707
  } catch (e) {
4707
4708
  console.error("Error checking favorite status:", e);
@@ -4710,7 +4711,7 @@ var Mr = (e) => {
4710
4711
  if (g) {
4711
4712
  ee(!0);
4712
4713
  try {
4713
- R ? (await Ke({ query: { url: m } }), z(!1), q.info("Removed from favorites")) : (await Ne({ body: {
4714
+ R ? (await Ze({ query: { url: m } }), z(!1), q.info("Removed from favorites")) : (await Ne({ body: {
4714
4715
  url: g.url || m,
4715
4716
  title: g.title,
4716
4717
  cite: g.cite,
@@ -4755,7 +4756,7 @@ var Mr = (e) => {
4755
4756
  }
4756
4757
  ]);
4757
4758
  try {
4758
- await Je({ body: {
4759
+ await tt({ body: {
4759
4760
  url: m,
4760
4761
  question: S,
4761
4762
  answer: r
@@ -4774,7 +4775,7 @@ var Mr = (e) => {
4774
4775
  let i = t?.extract || [];
4775
4776
  F(i);
4776
4777
  try {
4777
- await Je({ body: {
4778
+ await tt({ body: {
4778
4779
  url: m,
4779
4780
  followUpQuestions: i
4780
4781
  } });
@@ -4799,14 +4800,14 @@ var Mr = (e) => {
4799
4800
  }
4800
4801
  }, he = () => /* @__PURE__ */ K("div", {
4801
4802
  className: "flex h-full flex-col bg-background shadow-xl",
4802
- children: [/* @__PURE__ */ G(pr, { onClose: d }), /* @__PURE__ */ G("div", {
4803
+ children: [/* @__PURE__ */ G(br, { onClose: d }), /* @__PURE__ */ G("div", {
4803
4804
  className: "flex-1 overflow-y-auto",
4804
4805
  children: /* @__PURE__ */ K("div", {
4805
4806
  className: "p-4 space-y-6",
4806
4807
  children: [/* @__PURE__ */ K("div", {
4807
4808
  className: "space-y-4",
4808
4809
  children: [
4809
- /* @__PURE__ */ G(gr, {
4810
+ /* @__PURE__ */ G(Cr, {
4810
4811
  isLoadingAI: E,
4811
4812
  isLoadingFollowups: O,
4812
4813
  isLoadingFavorite: B,
@@ -4822,12 +4823,12 @@ var Mr = (e) => {
4822
4823
  className: "bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg",
4823
4824
  children: "Copied!"
4824
4825
  }),
4825
- /* @__PURE__ */ G(_r, {
4826
+ /* @__PURE__ */ G(wr, {
4826
4827
  value: S,
4827
4828
  onChange: C,
4828
4829
  onSubmit: () => fe("question")
4829
4830
  }),
4830
- /* @__PURE__ */ G(vr, {
4831
+ /* @__PURE__ */ G(Tr, {
4831
4832
  questions: P,
4832
4833
  isLoading: O,
4833
4834
  error: I,
@@ -4858,7 +4859,7 @@ var Mr = (e) => {
4858
4859
  })
4859
4860
  }, t))
4860
4861
  }),
4861
- (E || A && v.length === 0) && /* @__PURE__ */ G(yr, {
4862
+ (E || A && v.length === 0) && /* @__PURE__ */ G(Er, {
4862
4863
  response: A,
4863
4864
  isLoading: E,
4864
4865
  error: M
@@ -4868,7 +4869,7 @@ var Mr = (e) => {
4868
4869
  children: M
4869
4870
  })
4870
4871
  ]
4871
- }), g && /* @__PURE__ */ G(xr, {
4872
+ }), g && /* @__PURE__ */ G(Or, {
4872
4873
  article: g,
4873
4874
  isHighlightMode: V
4874
4875
  })]
@@ -4885,20 +4886,20 @@ var Mr = (e) => {
4885
4886
  style: { touchAction: "none" },
4886
4887
  children: /* @__PURE__ */ G("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-1 h-12 rounded-full bg-muted-foreground opacity-50 hover:opacity-100 transition-opacity" })
4887
4888
  }), he()]
4888
- }) : /* @__PURE__ */ G(ar, {
4889
+ }) : /* @__PURE__ */ G(fr, {
4889
4890
  open: l,
4890
4891
  onOpenChange: (e) => !e && d(),
4891
- children: /* @__PURE__ */ K(lr, {
4892
+ children: /* @__PURE__ */ K(gr, {
4892
4893
  className: "pointer-events-auto fixed inset-0 !top-0 !left-0 !translate-x-0 !translate-y-0 h-full w-full max-w-none p-0 m-0 rounded-none border-0 overflow-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",
4893
4894
  hideCloseButton: !0,
4894
- children: [/* @__PURE__ */ G(fr, { children: /* @__PURE__ */ G(ur, { children: "Article Details" }) }), /* @__PURE__ */ G("div", {
4895
+ children: [/* @__PURE__ */ G(yr, { children: /* @__PURE__ */ G(_r, { children: "Article Details" }) }), /* @__PURE__ */ G("div", {
4895
4896
  className: "h-full overflow-y-auto",
4896
4897
  children: he()
4897
4898
  })]
4898
4899
  })
4899
4900
  });
4900
- }, Nr = () => {
4901
- let { sections: e, chatTurns: n, loading: r, messageAppeared: a, newChat: o, chatId: s } = X(), { isOpen: c, panelWidth: l } = ht(), { isAuthenticated: d } = Zt(), [m, h] = p(!1), g = f(null), _ = f(null), v = f(!1);
4901
+ }, Br = () => {
4902
+ let { sections: e, chatTurns: n, loading: r, messageAppeared: a, newChat: o, chatId: s } = X(), { isOpen: c, panelWidth: l } = St(), { isAuthenticated: d } = an(), [m, h] = p(!1), g = f(null), _ = f(null), v = f(!1);
4902
4903
  return u(() => {
4903
4904
  let e = () => {
4904
4905
  h(window.innerWidth >= 1024);
@@ -4919,7 +4920,7 @@ var Mr = (e) => {
4919
4920
  children: [
4920
4921
  e.map((t, n) => {
4921
4922
  let r = n === e.length - 1;
4922
- return /* @__PURE__ */ K(i, { children: [/* @__PURE__ */ G(In, {
4923
+ return /* @__PURE__ */ K(i, { children: [/* @__PURE__ */ G(Un, {
4923
4924
  section: t,
4924
4925
  sectionIndex: n,
4925
4926
  dividerRef: r ? g : void 0,
@@ -4936,7 +4937,7 @@ var Mr = (e) => {
4936
4937
  alignItems: "center",
4937
4938
  justifyContent: "center"
4938
4939
  },
4939
- children: /* @__PURE__ */ G(st, {
4940
+ children: /* @__PURE__ */ G(mt, {
4940
4941
  autoRandomize: !0,
4941
4942
  onSphereClick: () => console.log("Sphere clicked"),
4942
4943
  className: "my-custom-class"
@@ -4950,13 +4951,13 @@ var Mr = (e) => {
4950
4951
  ]
4951
4952
  }), /* @__PURE__ */ G("div", {
4952
4953
  className: "sticky bottom-[60px] md:bottom-0 z-40 bg-gradient-to-t from-background via-background to-transparent pt-4 pb-2",
4953
- children: /* @__PURE__ */ G(ir, {})
4954
+ children: /* @__PURE__ */ G(dr, {})
4954
4955
  })]
4955
- }), /* @__PURE__ */ G(Mr, {})] });
4956
+ }), /* @__PURE__ */ G(zr, {})] });
4956
4957
  };
4957
4958
  //#endregion
4958
4959
  //#region src/ui/gradient-blur.tsx
4959
- function Pr({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "transparent", color: r, colorGenerator: i }) {
4960
+ function Vr({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "transparent", color: r, colorGenerator: i }) {
4960
4961
  let a = f(null), o = f({
4961
4962
  x: 0,
4962
4963
  y: 0
@@ -5016,28 +5017,28 @@ function Pr({ radius: e = 60, opacityDecay: t = .025, backgroundColor: n = "tran
5016
5017
  }
5017
5018
  //#endregion
5018
5019
  //#region src/components/ChatHistoryDropdown/useHistoryState.ts
5019
- var Fr = "qwksearch_pinned_chats";
5020
- function Ir() {
5020
+ var Hr = "qwksearch_pinned_chats";
5021
+ function Ur() {
5021
5022
  if (typeof window > "u") return [];
5022
5023
  try {
5023
- let e = localStorage.getItem(Fr);
5024
+ let e = localStorage.getItem(Hr);
5024
5025
  return e ? JSON.parse(e) : [];
5025
5026
  } catch {
5026
5027
  return [];
5027
5028
  }
5028
5029
  }
5029
- function Lr(e) {
5030
- typeof window > "u" || localStorage.setItem(Fr, JSON.stringify(e));
5030
+ function Wr(e) {
5031
+ typeof window > "u" || localStorage.setItem(Hr, JSON.stringify(e));
5031
5032
  }
5032
- function Rr() {
5033
- let [e, t] = p([]), [n, r] = p(!0), [i, a] = p(!1), [o, s] = p(null), [l, f] = p(!1), [m, h] = p(!1), [g, _] = p(!1), [v, y] = p([]), [b, x] = p(""), [S, C] = p([]), [w, T] = p(!1), { isAuthenticated: E, isLoading: D } = Zt(), { incognito: O, setIncognito: k } = X();
5033
+ function Gr() {
5034
+ let [e, t] = p([]), [n, r] = p(!0), [i, a] = p(!1), [o, s] = p(null), [l, f] = p(!1), [m, h] = p(!1), [g, _] = p(!1), [v, y] = p([]), [b, x] = p(""), [S, C] = p([]), [w, T] = p(!1), { isAuthenticated: E, isLoading: D } = an(), { incognito: O, setIncognito: k } = X();
5034
5035
  u(() => {
5035
- y(Ir());
5036
+ y(Ur());
5036
5037
  }, []);
5037
5038
  let A = c((e, t) => {
5038
5039
  e.preventDefault(), e.stopPropagation(), y((e) => {
5039
5040
  let n = e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
5040
- return Lr(n), n;
5041
+ return Wr(n), n;
5041
5042
  });
5042
5043
  }, []), j = d(() => [...e].sort((e, t) => {
5043
5044
  let n = v.includes(e.id), r = v.includes(t.id);
@@ -5051,23 +5052,19 @@ function Rr() {
5051
5052
  r(!0);
5052
5053
  try {
5053
5054
  if (E) {
5054
- let e = await fetch("/api/agent/chats", {
5055
- credentials: "include",
5056
- headers: { "Content-Type": "application/json" }
5057
- });
5058
- if (e.status === 401) {
5059
- let e = Pt().map((e) => ({
5055
+ let { data: e, error: n } = await Je();
5056
+ if (n && n.status === 401) {
5057
+ let e = Vt().map((e) => ({
5060
5058
  ...e,
5061
5059
  messageCount: e.messages?.filter((e) => e.role === "user").length ?? 0
5062
5060
  }));
5063
5061
  t(e);
5064
5062
  return;
5065
5063
  }
5066
- if (!e.ok) throw Error(`HTTP ${e.status}: ${e.statusText}`);
5067
- let n = await e.json();
5068
- t(Array.isArray(n?.chats) ? n.chats : []);
5064
+ if (n) throw Error(`Failed to fetch chats: ${n.message}`);
5065
+ t(Array.isArray(e?.chats) ? e.chats : []);
5069
5066
  } else {
5070
- let e = Pt().map((e) => ({
5067
+ let e = Vt().map((e) => ({
5071
5068
  ...e,
5072
5069
  messageCount: e.messages?.filter((e) => e.role === "user").length ?? 0
5073
5070
  }));
@@ -5090,13 +5087,9 @@ function Rr() {
5090
5087
  f(!0);
5091
5088
  try {
5092
5089
  if (E) {
5093
- let e = await fetch(`/api/agent/chats/${o}`, {
5094
- method: "DELETE",
5095
- credentials: "include",
5096
- headers: { "Content-Type": "application/json" }
5097
- });
5098
- if (!e.ok) throw Error(`HTTP ${e.status}: ${e.statusText}`);
5099
- } else Lt(o);
5090
+ let { error: e } = await Ve({ path: { id: o } });
5091
+ if (e) throw Error(`Failed to delete chat: ${e.message}`);
5092
+ } else Wt(o);
5100
5093
  t((e) => e.filter((e) => e.id !== o)), q.success("Chat deleted");
5101
5094
  } catch (e) {
5102
5095
  q.error(e.message || "Failed to delete chat");
@@ -5110,13 +5103,9 @@ function Rr() {
5110
5103
  _(!0);
5111
5104
  try {
5112
5105
  if (E) {
5113
- let e = await fetch("/api/agent/chats", {
5114
- method: "DELETE",
5115
- credentials: "include",
5116
- headers: { "Content-Type": "application/json" }
5117
- });
5118
- if (!e.ok) throw Error(`HTTP ${e.status}: ${e.statusText}`);
5119
- } else Rt();
5106
+ let { error: e } = await Be();
5107
+ if (e) throw Error(`Failed to clear history: ${e.message}`);
5108
+ } else Gt();
5120
5109
  t([]), q.success("All history cleared");
5121
5110
  } catch (e) {
5122
5111
  q.error(e.message || "Failed to clear history");
@@ -5133,15 +5122,11 @@ function Rr() {
5133
5122
  T(!0);
5134
5123
  try {
5135
5124
  if (E) {
5136
- let t = await fetch(`/api/agent/chats/search?q=${encodeURIComponent(e)}`, {
5137
- credentials: "include",
5138
- headers: { "Content-Type": "application/json" }
5139
- });
5140
- if (!t.ok) throw Error(`HTTP ${t.status}: ${t.statusText}`);
5141
- let n = await t.json();
5142
- C(Array.isArray(n?.chats) ? n.chats : []);
5125
+ let { data: t, error: n } = await $e({ query: { q: e } });
5126
+ if (n) throw Error(`Failed to search chats: ${n.message}`);
5127
+ C(Array.isArray(t?.chats) ? t.chats : []);
5143
5128
  } else {
5144
- let t = Pt().filter((t) => {
5129
+ let t = Vt().filter((t) => {
5145
5130
  let n = t.title.toLowerCase().includes(e.toLowerCase()), r = t.messages?.some((t) => "content" in t && t.content?.toLowerCase().includes(e.toLowerCase()));
5146
5131
  return n || r;
5147
5132
  });
@@ -5192,7 +5177,7 @@ function Rr() {
5192
5177
  }
5193
5178
  //#endregion
5194
5179
  //#region src/components/ChatHistoryDropdown/HistoryHeader.tsx
5195
- function zr({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r, searchQuery: i, onSearchChange: a }) {
5180
+ function Kr({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r, searchQuery: i, onSearchChange: a }) {
5196
5181
  return /* @__PURE__ */ K("div", {
5197
5182
  className: "mb-2 pb-2 border-b border-border space-y-2",
5198
5183
  children: [/* @__PURE__ */ K("div", {
@@ -5239,22 +5224,22 @@ function zr({ incognito: e, onToggleIncognito: t, showClearAll: n, onClearAll: r
5239
5224
  }
5240
5225
  //#endregion
5241
5226
  //#region src/components/ChatHistoryDropdown/HistoryChatItem.tsx
5242
- function Br({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
5227
+ function qr({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
5243
5228
  let i = e.messageCount ?? 0;
5244
5229
  return /* @__PURE__ */ K("div", {
5245
5230
  className: "group flex items-center gap-1 px-2 py-1 rounded-lg hover:bg-secondary transition-colors duration-200",
5246
5231
  children: [
5247
- /* @__PURE__ */ K(ut, {
5232
+ /* @__PURE__ */ K(_t, {
5248
5233
  href: `/c/${e.id}`,
5249
5234
  className: "flex-1 min-w-0 flex items-center gap-1.5",
5250
5235
  children: [/* @__PURE__ */ K("span", {
5251
5236
  className: "flex items-center gap-1 shrink-0",
5252
- children: [i > 0 && /* @__PURE__ */ K(Pn, {
5237
+ children: [i > 0 && /* @__PURE__ */ K(Vn, {
5253
5238
  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",
5254
5239
  children: [i, "Q"]
5255
- }), /* @__PURE__ */ G(Pn, {
5240
+ }), /* @__PURE__ */ G(Vn, {
5256
5241
  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",
5257
- children: ft(/* @__PURE__ */ new Date(), e.createdAt)
5242
+ children: yt(/* @__PURE__ */ new Date(), e.createdAt)
5258
5243
  })]
5259
5244
  }), /* @__PURE__ */ K("p", {
5260
5245
  className: "text-xs text-popover-foreground truncate",
@@ -5281,20 +5266,20 @@ function Br({ chat: e, isPinned: t, onTogglePin: n, onDelete: r }) {
5281
5266
  }
5282
5267
  //#endregion
5283
5268
  //#region src/components/ChatHistoryDropdown/HistoryDialogs.tsx
5284
- function Vr({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i, loadingLabel: a, loading: o, onConfirm: s }) {
5285
- return /* @__PURE__ */ G(ar, {
5269
+ function Jr({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i, loadingLabel: a, loading: o, onConfirm: s }) {
5270
+ return /* @__PURE__ */ G(fr, {
5286
5271
  open: e,
5287
5272
  onOpenChange: (e) => {
5288
5273
  !e && !o && t(!1);
5289
5274
  },
5290
- children: /* @__PURE__ */ K(lr, {
5275
+ children: /* @__PURE__ */ K(gr, {
5291
5276
  className: "w-full max-w-md transform rounded-2xl bg-light-secondary dark:bg-dark-secondary border border-light-200 dark:border-dark-200 p-6 text-left align-middle shadow-xl",
5292
5277
  children: [
5293
- /* @__PURE__ */ G(ur, {
5278
+ /* @__PURE__ */ G(_r, {
5294
5279
  className: "text-lg font-medium leading-6 dark:text-white",
5295
5280
  children: n
5296
5281
  }),
5297
- /* @__PURE__ */ G(dr, {
5282
+ /* @__PURE__ */ G(vr, {
5298
5283
  className: "text-sm dark:text-white/70 text-black/70 mt-2",
5299
5284
  children: r
5300
5285
  }),
@@ -5317,8 +5302,8 @@ function Vr({ open: e, onOpenChange: t, title: n, description: r, confirmLabel:
5317
5302
  })
5318
5303
  });
5319
5304
  }
5320
- function Hr({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setChatToDelete: r, deleting: i, onConfirmDelete: a, clearAllDialogOpen: o, setClearAllDialogOpen: s, clearingAll: c, onConfirmClearAll: l }) {
5321
- return /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(Vr, {
5305
+ function Yr({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setChatToDelete: r, deleting: i, onConfirmDelete: a, clearAllDialogOpen: o, setClearAllDialogOpen: s, clearingAll: c, onConfirmClearAll: l }) {
5306
+ return /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(Jr, {
5322
5307
  open: e,
5323
5308
  onOpenChange: (e) => {
5324
5309
  t(e), e || r(null);
@@ -5329,7 +5314,7 @@ function Hr({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
5329
5314
  loadingLabel: "Deleting...",
5330
5315
  loading: i,
5331
5316
  onConfirm: a
5332
- }), /* @__PURE__ */ G(Vr, {
5317
+ }), /* @__PURE__ */ G(Jr, {
5333
5318
  open: o,
5334
5319
  onOpenChange: s,
5335
5320
  title: "Clear All History",
@@ -5342,13 +5327,13 @@ function Hr({ deleteDialogOpen: e, setDeleteDialogOpen: t, chatToDelete: n, setC
5342
5327
  }
5343
5328
  //#endregion
5344
5329
  //#region src/components/ChatHistoryDropdown/HistoryDropdown.tsx
5345
- var Ur = {
5330
+ var Xr = {
5346
5331
  Today: /* @__PURE__ */ G(Te, { size: 12 }),
5347
5332
  Yesterday: /* @__PURE__ */ G(I, { size: 12 }),
5348
5333
  "This Week": /* @__PURE__ */ G(D, { size: 12 }),
5349
5334
  Older: /* @__PURE__ */ G(x, { size: 12 })
5350
5335
  };
5351
- function Wr(e) {
5336
+ function Zr(e) {
5352
5337
  let t = /* @__PURE__ */ new Date(), n = new Date(t.getFullYear(), t.getMonth(), t.getDate()), r = /* @__PURE__ */ new Date(n.getTime() - 864e5), i = /* @__PURE__ */ new Date(n.getTime() - 6 * 864e5), a = {
5353
5338
  Today: [],
5354
5339
  Yesterday: [],
@@ -5369,19 +5354,19 @@ function Wr(e) {
5369
5354
  chats: a[e]
5370
5355
  }));
5371
5356
  }
5372
- var Gr = ({ showLabel: e = !1 }) => {
5373
- let t = Rr();
5374
- return /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ K(ar, { children: [/* @__PURE__ */ K(or, {
5357
+ var Qr = ({ showLabel: e = !1 }) => {
5358
+ let t = Gr();
5359
+ return /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ K(fr, { children: [/* @__PURE__ */ K(pr, {
5375
5360
  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",
5376
5361
  children: [/* @__PURE__ */ G(ce, { size: e ? 14 : 18 }), e && /* @__PURE__ */ G("span", { children: "History" })]
5377
- }), /* @__PURE__ */ K(lr, {
5362
+ }), /* @__PURE__ */ K(gr, {
5378
5363
  className: "max-w-[420px] p-3",
5379
5364
  children: [
5380
- /* @__PURE__ */ G(ur, {
5365
+ /* @__PURE__ */ G(_r, {
5381
5366
  className: "sr-only",
5382
5367
  children: "Chat History"
5383
5368
  }),
5384
- /* @__PURE__ */ G(zr, {
5369
+ /* @__PURE__ */ G(Kr, {
5385
5370
  incognito: t.incognito,
5386
5371
  onToggleIncognito: t.toggleIncognito,
5387
5372
  showClearAll: t.chats.length > 0 && !t.loading,
@@ -5419,15 +5404,15 @@ var Gr = ({ showLabel: e = !1 }) => {
5419
5404
  })
5420
5405
  }) : /* @__PURE__ */ G("div", {
5421
5406
  className: "space-y-1 max-h-[500px] overflow-y-auto",
5422
- children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ G(Br, {
5407
+ children: t.searchQuery.trim() ? t.displayChats.map((e) => /* @__PURE__ */ G(qr, {
5423
5408
  chat: e,
5424
5409
  isPinned: t.pinnedIds.includes(e.id),
5425
5410
  onTogglePin: t.togglePin,
5426
5411
  onDelete: t.handleDeleteClick
5427
- }, e.id)) : Wr(t.displayChats).map(({ label: e, chats: n }) => /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ K("div", {
5412
+ }, e.id)) : Zr(t.displayChats).map(({ label: e, chats: n }) => /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ K("div", {
5428
5413
  className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-muted-foreground/70 uppercase tracking-wider",
5429
- children: [Ur[e], e]
5430
- }), n.map((e) => /* @__PURE__ */ G(Br, {
5414
+ children: [Xr[e], e]
5415
+ }), n.map((e) => /* @__PURE__ */ G(qr, {
5431
5416
  chat: e,
5432
5417
  isPinned: t.pinnedIds.includes(e.id),
5433
5418
  onTogglePin: t.togglePin,
@@ -5436,14 +5421,14 @@ var Gr = ({ showLabel: e = !1 }) => {
5436
5421
  }),
5437
5422
  t.chats.length > 0 && /* @__PURE__ */ G("div", {
5438
5423
  className: "mt-2 pt-2 border-t border-border",
5439
- children: /* @__PURE__ */ G(ut, {
5424
+ children: /* @__PURE__ */ G(_t, {
5440
5425
  href: "/library",
5441
5426
  className: "block text-center text-xs text-primary hover:underline",
5442
5427
  children: "View all chats"
5443
5428
  })
5444
5429
  })
5445
5430
  ]
5446
- })] }), /* @__PURE__ */ G(Hr, {
5431
+ })] }), /* @__PURE__ */ G(Yr, {
5447
5432
  deleteDialogOpen: t.deleteDialogOpen,
5448
5433
  setDeleteDialogOpen: t.setDeleteDialogOpen,
5449
5434
  chatToDelete: t.chatToDelete,
@@ -5458,11 +5443,11 @@ var Gr = ({ showLabel: e = !1 }) => {
5458
5443
  };
5459
5444
  //#endregion
5460
5445
  //#region src/components/ChatConversation/RecentHistoryChips.tsx
5461
- function Kr() {
5462
- let { chats: e, loading: t } = Rr(), n = [...e].sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime()).slice(0, 3);
5446
+ function $r() {
5447
+ let { chats: e, loading: t } = Gr(), n = [...e].sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime()).slice(0, 3);
5463
5448
  return t ? null : /* @__PURE__ */ K("div", {
5464
5449
  className: "flex flex-row items-center justify-center gap-2 flex-wrap",
5465
- children: [/* @__PURE__ */ G(Gr, { showLabel: !0 }), n.map((e) => /* @__PURE__ */ G(ut, {
5450
+ children: [/* @__PURE__ */ G(Qr, { showLabel: !0 }), n.map((e) => /* @__PURE__ */ G(_t, {
5466
5451
  href: `/c/${e.id}`,
5467
5452
  className: "px-3 py-1 rounded-full text-xs text-muted-foreground bg-secondary hover:bg-secondary/80 hover:text-foreground transition-colors duration-150 truncate max-w-[160px]",
5468
5453
  title: e.title,
@@ -5472,7 +5457,7 @@ function Kr() {
5472
5457
  }
5473
5458
  //#endregion
5474
5459
  //#region src/components/Footer.tsx
5475
- function qr({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackgroundColor: n = "bg-black/40" }) {
5460
+ function ei({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackgroundColor: n = "bg-black/40" }) {
5476
5461
  return /* @__PURE__ */ G("div", {
5477
5462
  className: `absolute bottom-2 left-1/2 -translate-x-1/2 text-slate-200 text-xs z-20 ${n} rounded-lg px-2 py-1 shadow-lg hover:shadow-xl hover:-translate-y-1 transition-all duration-300 flex flex-wrap items-center justify-center gap-x-6 max-w-[90vw]`,
5478
5463
  children: /* @__PURE__ */ G("div", {
@@ -5495,7 +5480,7 @@ function qr({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackground
5495
5480
  ...o,
5496
5481
  className: "relative group inline-flex items-center gap-1 hover:text-white hover:drop-shadow-[0_0_8px_rgba(255,255,255,0.8)] transition-all duration-300 whitespace-nowrap",
5497
5482
  children: s
5498
- }, e) : /* @__PURE__ */ G(ut, {
5483
+ }, e) : /* @__PURE__ */ G(_t, {
5499
5484
  href: e,
5500
5485
  className: "relative group inline-flex items-center gap-1 hover:text-white hover:drop-shadow-[0_0_8px_rgba(255,255,255,0.8)] transition-all duration-300 whitespace-nowrap",
5501
5486
  children: s
@@ -5506,19 +5491,19 @@ function qr({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackground
5506
5491
  }
5507
5492
  //#endregion
5508
5493
  //#region src/components/ChatConversation/background-art.ts
5509
- function Jr() {
5494
+ function ti() {
5510
5495
  let e = /* @__PURE__ */ "hyZbH3n.mp4,iOeZcCk.mp4,dUZlxYE.mp4,GpWeP6E.gif,LuKUsLE.png,w7X11Dd.png,MHmVtCr.png,HmnUAee.png,vKP22VU.png,l1lsV39.png,Ku8F2qc.png,KUEXtwm.png,vvKFPmY.png,5p8eaEf.png,VAKuJcG.png,sTMPtQW.png,m0gHbZZ.png,cKu7dWQ.png,ogfefYD.png,ey5vAae.png,twuLrvk.png,ELILiYt.png,9el5qpP.png,Up6xTkk.png,W1XKBo0.png,1Y6xvW0.png,JXOytMz.png,DNiI6pp.png,XDv5s6p.jpeg,eRwiRJ9.jpeg,DRAfJoc.jpeg,ASVRQ1G.jpeg,35svwUT.jpeg,81xLiVI.jpeg,6kod2Em.jpeg,eU0C8zt.jpeg,Bv0PBY8.jpeg,DQNbjIZ.jpeg,2uACPqZ.jpeg,XEKltMF.jpeg,WHgLfBm.jpeg,QFYM0Fw.jpeg,K12HCao.jpeg,oN8rtsE.jpeg,9fGnrns.jpeg,2ONJJeW.jpeg,DO23Va7.jpeg,QaKeoXk.jpeg,QU5oCBR.jpeg,MhlYZmh.jpeg,ylL1ToB.jpeg,AWWsCv8.jpeg,Tk9Tzzj.jpeg".split(",");
5511
5496
  return "https://i.imgur.com/" + e[Math.floor(Math.random() * e.length)];
5512
5497
  }
5513
5498
  //#endregion
5514
5499
  //#region src/components/ChatConversation/ChatHomepage.tsx
5515
- function Yr() {
5500
+ function ni() {
5516
5501
  let { sendMessage: e } = X(), [n, r] = p(null), [i, a] = p(null), [o, s] = p(!1), [c, l] = p({ os: "" });
5517
5502
  u(() => {
5518
5503
  if (localStorage.getItem("showBackgroundArt") === "false") return;
5519
- r(Jr());
5504
+ r(ti());
5520
5505
  let e = setInterval(() => {
5521
- let e = Jr();
5506
+ let e = ti();
5522
5507
  a(e), s(!0), setTimeout(() => {
5523
5508
  r(e), s(!1), a(null);
5524
5509
  }, 1e3);
@@ -5550,7 +5535,7 @@ function Yr() {
5550
5535
  children: [
5551
5536
  n && f(n, o ? "opacity-0" : "opacity-30"),
5552
5537
  i && f(i, o ? "opacity-30" : "opacity-0"),
5553
- /* @__PURE__ */ G(Pr, {})
5538
+ /* @__PURE__ */ G(Vr, {})
5554
5539
  ]
5555
5540
  }),
5556
5541
  /* @__PURE__ */ G("div", {
@@ -5566,7 +5551,7 @@ function Yr() {
5566
5551
  alignItems: "center",
5567
5552
  justifyContent: "center"
5568
5553
  },
5569
- children: /* @__PURE__ */ G(st, {
5554
+ children: /* @__PURE__ */ G(mt, {
5570
5555
  autoRandomize: !0,
5571
5556
  onSphereClick: () => console.log("Sphere clicked"),
5572
5557
  className: "my-custom-class"
@@ -5588,18 +5573,18 @@ function Yr() {
5588
5573
  }),
5589
5574
  /* @__PURE__ */ K("div", {
5590
5575
  className: "w-full max-w-2xl mt-8 space-y-2",
5591
- children: [/* @__PURE__ */ G(Kr, {}), /* @__PURE__ */ G(ir, {})]
5576
+ children: [/* @__PURE__ */ G($r, {}), /* @__PURE__ */ G(dr, {})]
5592
5577
  })
5593
5578
  ]
5594
5579
  })
5595
5580
  }),
5596
- /* @__PURE__ */ G(qr, { listFooterLinks: t.footerLinks })
5581
+ /* @__PURE__ */ G(ei, { listFooterLinks: t.footerLinks })
5597
5582
  ]
5598
5583
  });
5599
5584
  }
5600
5585
  //#endregion
5601
5586
  //#region src/ui/Loader.tsx
5602
- var Xr = () => /* @__PURE__ */ K("svg", {
5587
+ var ri = () => /* @__PURE__ */ K("svg", {
5603
5588
  "aria-hidden": "true",
5604
5589
  className: "w-8 h-8 text-border fill-secondary animate-spin",
5605
5590
  viewBox: "0 0 100 101",
@@ -5615,7 +5600,7 @@ var Xr = () => /* @__PURE__ */ K("svg", {
5615
5600
  });
5616
5601
  //#endregion
5617
5602
  //#region src/components/ConfigError.tsx
5618
- function Zr() {
5603
+ function ii() {
5619
5604
  return /* @__PURE__ */ G("div", {
5620
5605
  className: "flex min-h-screen flex-col items-center justify-center p-8",
5621
5606
  children: /* @__PURE__ */ K("div", {
@@ -5733,8 +5718,8 @@ function Zr() {
5733
5718
  }
5734
5719
  //#endregion
5735
5720
  //#region src/components/ChatConversation/ChatWindow.tsx
5736
- var Qr = () => {
5737
- let e = h(), { hasError: t, isReady: n, notFound: r, messages: i } = X(), { isAuthenticated: a } = Zt();
5721
+ var ai = () => {
5722
+ let e = h(), { hasError: t, isReady: n, notFound: r, messages: i } = X(), { isAuthenticated: a } = an();
5738
5723
  return u(() => {
5739
5724
  n && r && !a && e.replace("/");
5740
5725
  }, [
@@ -5742,9 +5727,9 @@ var Qr = () => {
5742
5727
  r,
5743
5728
  a,
5744
5729
  e
5745
- ]), t ? /* @__PURE__ */ G(Zr, {}) : n && r && !a ? /* @__PURE__ */ G("div", {
5730
+ ]), t ? /* @__PURE__ */ G(ii, {}) : n && r && !a ? /* @__PURE__ */ G("div", {
5746
5731
  className: "flex flex-row items-center justify-center min-h-screen",
5747
- children: /* @__PURE__ */ G(Xr, {})
5732
+ children: /* @__PURE__ */ G(ri, {})
5748
5733
  }) : n ? r ? /* @__PURE__ */ K("div", {
5749
5734
  className: "flex min-h-screen flex-col items-center justify-center gap-3 px-4 text-center",
5750
5735
  children: [/* @__PURE__ */ G("p", {
@@ -5756,10 +5741,10 @@ var Qr = () => {
5756
5741
  className: "rounded-md border border-black/15 px-3 py-1.5 text-sm hover:bg-black/5 dark:border-white/20 dark:hover:bg-white/10",
5757
5742
  children: "Go Home"
5758
5743
  })]
5759
- }) : /* @__PURE__ */ G("div", { children: i.length > 0 ? /* @__PURE__ */ G(W, { children: /* @__PURE__ */ G(Nr, {}) }) : /* @__PURE__ */ G(Yr, {}) }) : /* @__PURE__ */ G("div", {
5744
+ }) : /* @__PURE__ */ G("div", { children: i.length > 0 ? /* @__PURE__ */ G(W, { children: /* @__PURE__ */ G(Br, {}) }) : /* @__PURE__ */ G(ni, {}) }) : /* @__PURE__ */ G("div", {
5760
5745
  className: "flex flex-row items-center justify-center min-h-screen",
5761
- children: /* @__PURE__ */ G(Xr, {})
5746
+ children: /* @__PURE__ */ G(ri, {})
5762
5747
  });
5763
5748
  };
5764
5749
  //#endregion
5765
- export { yr as ArticleAIResponse, gr as ArticleActionButtons, xr as ArticleContent, vr as ArticleFollowupQuestions, pr as ArticlePanelHeader, _r as ArticlePromptInput, Qt as ChatProvider, Qr as ChatWindow, gt as ExtractPanelProvider, Hr as HistoryDialogs, Gr as HistoryDropdown, br as LexicalArticleViewer, Xt as SessionProvider, jr as UnifiedMarkdown, Y as cn, e as configureResearchAgentUI, ft as formatTimeDifference, t as researchAgentUIConfig, X as useChat, qt as useChatState, ht as useExtractPanel, Rr as useHistoryState, Zt as useSession };
5750
+ export { Er as ArticleAIResponse, Cr as ArticleActionButtons, Or as ArticleContent, Tr as ArticleFollowupQuestions, br as ArticlePanelHeader, wr as ArticlePromptInput, on as ChatProvider, ai as ChatWindow, Ct as ExtractPanelProvider, Yr as HistoryDialogs, Qr as HistoryDropdown, Dr as LexicalArticleViewer, rn as SessionProvider, Rr as UnifiedMarkdown, Y as cn, e as configureResearchAgentUI, yt as formatTimeDifference, t as researchAgentUIConfig, X as useChat, en as useChatState, St as useExtractPanel, Gr as useHistoryState, an as useSession };