research-agent-ui 0.1.235 → 0.1.236
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./config.cjs"),t=require("./src-
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./config.cjs"),t=require("./src-2jpriFrk.cjs");exports.ARTICLE_TOOLBAR_SHORTCUTS=t.O,exports.ArticleAIResponse=t.T,exports.ArticleActionButtons=t.k,exports.ArticleContent=t.C,exports.ArticleFollowupQuestions=t.E,exports.ArticlePanelHeader=t.j,exports.ArticlePromptInput=t.D,exports.CategoryDock=t.o,exports.ChatInputBox=t.M,exports.ChatProvider=t.N,exports.ChatWindow=t.v,exports.CookieConsent=t.a,exports.ExtractPanelProvider=t.z,exports.HistoryDialogs=t.b,exports.HistoryDropdown=t.y,exports.KokoroVoiceSelector=t.c,exports.LexicalArticleViewer=t.w,exports.MainViewProvider=t.g,exports.QwkSearchApp=t.n,exports.QwkSearchProviders=t.r,exports.SPOTLIGHT_LINKS=t.h,exports.SPOTLIGHT_PREFIXES=t.f,exports.SessionProvider=t.P,exports.SpotlightPalette=t.u,exports.UnifiedMarkdown=t.S,exports.VoiceSettingsPanel=t.s,exports.cn=t.V,exports.configureResearchAgentUI=e.configureResearchAgentUI,exports.formatMessageTime=t.H,exports.formatTimeDifference=t.U,exports.formatToolbarShortcut=t.A,exports.matchSpotlight=t.p,exports.openSpotlight=t.d,exports.parsePrefix=t.m,exports.researchAgentUIConfig=e.researchAgentUIConfig,exports.useChat=t.I,exports.useChatState=t.L,exports.useChatTabs=t.t,exports.useChunkErrorReload=t.i,exports.useExtractPanel=t.B,exports.useHistoryState=t.x,exports.useKokoroTTS=t.l,exports.useMainView=t._,exports.useSession=t.F,exports.useTextToSpeech=t.R;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { configureResearchAgentUI as e, researchAgentUIConfig as t } from "./config.mjs";
|
|
4
|
-
import { A as n, B as r, C as i, D as a, E as o, F as s, H as c, I as l, L as u, M as d, N as f, O as p, P as m, R as h, S as g, T as _, U as v, V as y, _ as b, a as x, b as S, c as C, d as w, f as T, g as E, h as D, i as O, j as k, k as A, l as j, m as M, n as N, o as P, p as F, r as I, s as L, t as R, u as z, v as B, w as V, x as H, y as U, z as W } from "./src-
|
|
4
|
+
import { A as n, B as r, C as i, D as a, E as o, F as s, H as c, I as l, L as u, M as d, N as f, O as p, P as m, R as h, S as g, T as _, U as v, V as y, _ as b, a as x, b as S, c as C, d as w, f as T, g as E, h as D, i as O, j as k, k as A, l as j, m as M, n as N, o as P, p as F, r as I, s as L, t as R, u as z, v as B, w as V, x as H, y as U, z as W } from "./src-BT2fOBqk.js";
|
|
5
5
|
export { p as ARTICLE_TOOLBAR_SHORTCUTS, _ as ArticleAIResponse, A as ArticleActionButtons, i as ArticleContent, o as ArticleFollowupQuestions, k as ArticlePanelHeader, a as ArticlePromptInput, P as CategoryDock, d as ChatInputBox, f as ChatProvider, B as ChatWindow, x as CookieConsent, W as ExtractPanelProvider, S as HistoryDialogs, U as HistoryDropdown, C as KokoroVoiceSelector, V as LexicalArticleViewer, E as MainViewProvider, N as QwkSearchApp, I as QwkSearchProviders, D as SPOTLIGHT_LINKS, T as SPOTLIGHT_PREFIXES, m as SessionProvider, z as SpotlightPalette, g as UnifiedMarkdown, L as VoiceSettingsPanel, y as cn, e as configureResearchAgentUI, c as formatMessageTime, v as formatTimeDifference, n as formatToolbarShortcut, F as matchSpotlight, w as openSpotlight, M as parsePrefix, t as researchAgentUIConfig, l as useChat, u as useChatState, R as useChatTabs, O as useChunkErrorReload, r as useExtractPanel, H as useHistoryState, j as useKokoroTTS, b as useMainView, s as useSession, h as useTextToSpeech };
|
|
@@ -48,4 +48,4 @@ OPENAI_API_KEY=sk-your_key_here
|
|
|
48
48
|
OPENAI_BASE_URL=https://api.openai.com/v1
|
|
49
49
|
|
|
50
50
|
# Or Anthropic
|
|
51
|
-
ANTHROPIC_API_KEY=sk-ant-your_key_here`})]}),(0,d.jsxs)(`div`,{className:`bg-black/5 dark:bg-white/5 rounded p-4`,children:[(0,d.jsx)(`p`,{className:`font-medium text-black dark:text-white mb-2`,children:`3. Restart the server`}),(0,d.jsx)(`code`,{className:`block bg-black/10 dark:bg-white/10 rounded p-2 text-xs`,children:`Ctrl+C, then: npm run dev`})]})]}),(0,d.jsxs)(`div`,{className:`pt-4 border-t border-black/10 dark:border-white/10`,children:[(0,d.jsx)(`h3`,{className:`font-medium text-black dark:text-white mb-2`,children:`Get API Keys:`}),(0,d.jsxs)(`ul`,{className:`space-y-2 text-sm text-black/70 dark:text-white/70`,children:[(0,d.jsxs)(`li`,{children:[(0,d.jsx)(`strong`,{children:`Groq`}),` (FREE): `,(0,d.jsx)(`a`,{href:`https://console.groq.com/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 dark:text-blue-400 hover:underline`,children:`console.groq.com/keys`})]}),(0,d.jsxs)(`li`,{children:[(0,d.jsx)(`strong`,{children:`OpenAI`}),`: `,(0,d.jsx)(`a`,{href:`https://platform.openai.com/api-keys`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 dark:text-blue-400 hover:underline`,children:`platform.openai.com/api-keys`})]}),(0,d.jsxs)(`li`,{children:[(0,d.jsx)(`strong`,{children:`Anthropic`}),`: `,(0,d.jsx)(`a`,{href:`https://console.anthropic.com/settings/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 dark:text-blue-400 hover:underline`,children:`console.anthropic.com`})]})]})]})]}),(0,d.jsxs)(`div`,{className:`text-xs text-black/50 dark:text-white/50 pt-4 border-t border-black/10 dark:border-white/10`,children:[`See `,(0,d.jsx)(`code`,{children:`SETUP_INSTRUCTIONS.md`}),` in the project root for full details.`]})]})})}var qr=()=>{let e=(0,r.useRouter)(),{hasError:t,isReady:i,notFound:a,messages:o}=W(),{isAuthenticated:s}=G();return(0,n.useEffect)(()=>{i&&a&&!s&&e.replace(`/`)},[i,a,s,e]),t?(0,d.jsx)(Kr,{}):i&&a&&!s?(0,d.jsx)(`div`,{className:`flex flex-row items-center justify-center min-h-screen`,children:(0,d.jsx)(Gr,{})}):i?a?(0,d.jsxs)(`div`,{className:`flex min-h-screen flex-col items-center justify-center gap-3 px-4 text-center`,children:[(0,d.jsx)(`p`,{className:`text-sm text-black/70 dark:text-white/70`,children:`This chat could not be found.`}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>e.push(`/`),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`,children:`Go Home`})]}):(0,d.jsx)(`div`,{children:o.length>0?(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(yr,{})}):(0,d.jsx)(Wr,{})}):(0,d.jsx)(`div`,{className:`flex flex-row items-center justify-center min-h-screen`,children:(0,d.jsx)(Gr,{})})},Jr=(0,n.createContext)(null),Yr=`qwksearch-main-view`;function Xr({children:e,docsEnabled:t=!0}){let[r,i]=(0,n.useState)(`research`),[a,o]=(0,n.useState)(0),s=(0,n.useCallback)(e=>i(t?e:`research`),[t]);(0,n.useEffect)(()=>{if(typeof window>`u`||!t)return;let e=window.localStorage.getItem(Yr);(e===`research`||e===`docs`)&&i(e)},[t]),(0,n.useEffect)(()=>{typeof window<`u`&&t&&window.localStorage.setItem(Yr,r)},[r,t]);let c=(0,n.useMemo)(()=>({activeView:r,setActiveView:s,docsEnabled:t,toggleToDocs:()=>s(`docs`),toggleToResearch:()=>s(`research`),filesSidebarRequestId:a,requestFilesSidebar:()=>o(e=>e+1)}),[r,s,t,a]);return(0,d.jsx)(Jr.Provider,{value:c,children:e})}function Zr(){let e=(0,n.useContext)(Jr);if(!e)throw Error(`useMainView must be used within a MainViewProvider`);return e}var Qr=[{key:`account`,name:`Account`,description:`Manage your profile, password, and linked accounts.`,icon:`UserCircle`,dataAdd:`account`},{key:`models`,name:`Language Models`,description:`Connect to AI services and manage connections.`,icon:`BrainCog`,dataAdd:`modelProviders`},{key:`mcpservers`,name:`Connectors`,description:`Configure Model Context Protocol servers.`,icon:`Server`,dataAdd:`mcpServers`},{key:`skills-memory`,name:`Skills & Memory`,description:`Manage agent skills and view your stored memories.`,icon:`Brain`,dataAdd:`skillsMemory`},{key:`searchEngines`,name:`Search Sources`,description:`Manage search engine sources by category.`,icon:`Search`,dataAdd:`searchEngines`},{key:`search`,name:`Search Settings`,description:`Configure search parameters.`,icon:`Search`,dataAdd:`search`},{key:`fileSources`,name:`Cloud Storage`,description:`Manage storage sources (SSH, S3, R2, B2, Google Docs, Turso DB).`,icon:`HardDrive`,dataAdd:`storage`},{key:`aiRewriteModes`,name:`Rewrite Modes`,description:`Customize AI rewrite prompts and add your own modes.`,icon:`Wand2`,dataAdd:`rewritePrompts`},{key:`voice`,name:`Voice Settings`,description:`Configure text-to-speech with Kokoro.js or Cloudflare TTS.`,icon:`Volume2`,dataAdd:`voice`}],$r=[{key:`webSearch`,title:`All`,description:`Searches across all of the internet`,icon:(0,d.jsx)(s.Globe,{size:16})},{key:`academicSearch`,title:`Academic`,description:`Search in published academic papers`,icon:(0,d.jsx)(s.SwatchBook,{size:16})},{key:`writingAssistant`,title:`Writing`,description:`Chat without searching the web`,icon:(0,d.jsx)(s.Pencil,{size:16})},{key:`wolframAlphaSearch`,title:`Wolfram Alpha`,description:`Computational knowledge engine`,icon:(0,d.jsx)(s.BadgePercent,{size:16})},{key:`youtubeSearch`,title:`Youtube`,description:`Search and watch videos`,icon:(0,d.jsx)(M.FaYoutube,{className:`h-[16px] w-auto mr-0.5`})},{key:`redditSearch`,title:`Reddit`,description:`Search for discussions and opinions`,icon:(0,d.jsx)(M.FaReddit,{className:`h-[16px] w-auto mr-0.5`})}],ei=[{href:`/`,label:`Research`,description:`The search and chat window`,keywords:`home chat ask question search`},{href:`/workspace`,label:`REASON Editor`,description:`Write up findings in the document editor`,keywords:`docs document write draft report`,docsOnly:!0},{href:`/library`,label:`Library`,description:`Saved chats, uploads and extracted articles`,keywords:`history saved files uploads archive`},{href:`/news`,label:`News`,description:`Trending stories by topic`,keywords:`discover trending headlines`},{href:`/docs`,label:`User Guide`,description:`How every part of the app works`,keywords:`documentation help manual`},{href:`/features`,label:`Features`,description:`Everything the research agent can do`,keywords:`capabilities tour`},{href:`/settings`,label:`Settings`,description:`Models, connectors, search sources and preferences`,keywords:`preferences configure options`},{href:`/enterprise`,label:`Enterprise`,description:`Self-hosting and team plans`,keywords:`business pricing teams`},{href:`/legal/privacy`,label:`Privacy Policy`,description:`What is stored and what is not`,keywords:`legal terms data`}];function ti(e){let t=e=>e===`/`?s.Search:e===`/workspace`?s.FileText:e===`/settings`?s.Settings:e===`/docs`?s.BookOpen:s.LayoutGrid;return ei.filter(t=>!t.docsOnly||e.docsEnabled).map(n=>({id:`page:${n.href}`,source:`page`,name:n.label,meta:n.description,keywords:`${n.keywords??``} ${n.href}`,icon:t(n.href),run:()=>e.navigate(n.href)}))}function ni(e,t){let n=new Date;return e.map(e=>({id:`chat:${e.id}`,source:`chat`,name:e.title||`Untitled chat`,meta:`${e.messageCount??0} question${(e.messageCount??0)===1?``:`s`}`,keywords:e.focusMode??``,icon:s.MessageSquare,hint:R(n,e.lastMessageAt||e.createdAt),run:()=>t.openChat(e.id)}))}function ri(e){return Qr.map(t=>({id:`setting:${t.key}`,source:`setting`,name:t.name,meta:t.description,keywords:`settings ${t.key}`,icon:s.SlidersHorizontal,run:()=>e.openSettings(t.key)}))}function ii(e){let t=[{id:`action:new-chat`,source:`action`,name:`New chat`,meta:`Start a fresh conversation`,keywords:`clear reset blank`,icon:s.Plus,run:e.newChat},{id:`action:settings`,source:`action`,name:`Open settings`,meta:`Models, connectors, search sources and preferences`,keywords:`preferences configure`,icon:s.Settings,run:()=>e.openSettings()},{id:`action:incognito`,source:`action`,name:e.incognito?`Turn off incognito`:`Turn on incognito`,meta:`Stop saving this conversation to history`,keywords:`private incognito history off`,icon:s.EyeOff,hint:e.incognito?`on`:`off`,run:()=>e.setIncognito(!e.incognito)}];for(let n of $r)t.push({id:`action:focus:${n.key}`,source:`action`,name:`Focus: ${n.title}`,meta:n.description,keywords:`focus mode ${n.key}`,icon:s.Globe,hint:e.focusMode===n.key?`current`:void 0,run:()=>e.setFocusMode(n.key)});return e.docsEnabled&&t.push({id:`action:view-docs`,source:`action`,name:`Switch to documents`,meta:`Open the REASON editor view`,keywords:`reason editor write docs`,icon:s.FileText,run:()=>e.setActiveView(`docs`)},{id:`action:view-research`,source:`action`,name:`Switch to research`,meta:`Back to the search and chat view`,keywords:`chat search`,icon:s.Search,run:()=>e.setActiveView(`research`)},{id:`action:files-sidebar`,source:`action`,name:`Show files sidebar`,meta:`Browse REASON documents`,keywords:`files documents sidebar`,icon:s.FileText,run:()=>{e.setActiveView(`docs`),e.requestFilesSidebar()}}),t.push(e.isAuthenticated?{id:`action:sign-out`,source:`action`,name:`Sign out`,meta:`End this session`,keywords:`logout log out`,icon:s.LogOut,run:e.signOut}:{id:`action:sign-in`,source:`action`,name:`Sign in`,meta:`Sync chats and settings across devices`,keywords:`login log in account`,icon:s.LogIn,run:e.signIn}),t}function ai(e,t){let n=e.trim();return n?{id:`search:ask`,source:`search`,name:n,meta:`Ask ${t.appName} — searches the web and answers with sources`,icon:s.Sparkles,hint:`Enter`,run:()=>t.ask(n)}:null}var oi=[{prefix:`c`,source:`chat`,label:`chats`},{prefix:`t`,source:`page`,label:`pages`},{prefix:`s`,source:`setting`,label:`settings`},{prefix:`a`,source:`action`,label:`actions`},{prefix:`w`,source:`search`,label:`web`}];function si(e){let t=e.match(/^([a-zA-Z])\s+(.*)$/);if(t){let e=t[1].toLowerCase(),n=oi.find(t=>t.prefix===e);if(n)return{prefix:n.prefix,query:t[2]}}return{prefix:null,query:e}}var ci=18;function li(e){return`${e.meta??``} ${e.keywords??``}`.toLowerCase()}function ui(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return e.map(e=>({item:e,matchedName:!0,snippet:null}));let r=[],i=[];for(let t of e){let e=t.name.toLowerCase();if(n.every(t=>e.includes(t)))r.push(t);else{let r=`${e} ${li(t)}`;n.every(e=>r.includes(e))&&i.push(t)}}let a=n[0];return r.sort((e,t)=>e.name.toLowerCase().indexOf(a)-t.name.toLowerCase().indexOf(a)),[...r.map(e=>({item:e,matchedName:!0,snippet:null})),...i.map(e=>({item:e,matchedName:!1,snippet:di(li(e),a)}))]}function di(e,t){let n=e.indexOf(t);if(n<0)return``;let r=Math.max(0,n-ci),i=Math.min(e.length,n+t.length+ci),a=e.slice(r,i).replace(/\s+/g,` `).trim();return r>0&&(a=`…`+a),i<e.length&&(a+=`…`),a}var fi=`qwksearch:open-spotlight`,pi=100,mi=6,hi=40;function gi(){typeof window>`u`||window.dispatchEvent(new Event(fi))}function _i(e){return e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.code===`Space`||e.key===` `)}var vi={search:`ask`,chat:`chat`,page:`page`,setting:`setting`,action:`action`};function yi(){let[e,i]=(0,n.useState)(!1),[a,o]=(0,n.useState)(``),[c,l]=(0,n.useState)(0),u=(0,r.useRouter)(),f=W(),{isAuthenticated:p,signIn:m,signOut:h}=G(),{docsEnabled:g,setActiveView:_,requestFilesSidebar:v}=Zr(),{recentChats:y,load:b}=Pn(pi),x=(0,n.useRef)(null),S=(0,n.useRef)(null),C=(0,n.useRef)(null),w=(0,n.useCallback)(()=>i(!1),[]),T=(0,n.useRef)(b);(0,n.useEffect)(()=>{T.current=b},[b]);let E=(0,n.useMemo)(()=>({appName:t.researchAgentUIConfig.appName,navigate:e=>u.push(e),openChat:e=>{t.researchAgentUIConfig.onOpenChat?.(e)||u.push(`/c/${e}`)},openSettings:e=>{t.researchAgentUIConfig.onOpenSettings?.(e)||u.push(e?`/settings/${e}`:`/settings`)},ask:e=>{f.newChat(),u.push(`/?q=${encodeURIComponent(e)}`)},newChat:f.newChat,focusMode:f.focusMode,setFocusMode:f.setFocusMode,incognito:f.incognito,setIncognito:f.setIncognito,isAuthenticated:p,signIn:m,signOut:h,docsEnabled:g,setActiveView:_,requestFilesSidebar:v}),[u,f.newChat,f.focusMode,f.setFocusMode,f.incognito,f.setIncognito,p,m,h,g,_,v]),{prefix:D,query:O}=si(a),k=O.trim(),A=(0,n.useMemo)(()=>({chat:ni(y,E),page:ti(E),setting:ri(E),action:ii(E)}),[y,E]),j=(0,n.useMemo)(()=>{let e=ai(O,E);if(D===`w`)return e?[e]:[];if(D){let e=oi.find(e=>e.prefix===D).source;return ui(A[e],O).map(e=>e.item).slice(0,hi)}if(!k)return[...A.chat.slice(0,mi),...A.action,...A.page].slice(0,hi);let t=ui([...A.action,...A.page,...A.setting,...A.chat],O).map(e=>e.item);return[...e?[e]:[],...t].slice(0,hi)},[D,O,k,A,E]);(0,n.useEffect)(()=>{let e=e=>{_i(e)&&(e.preventDefault(),i(e=>!e))},t=()=>i(!0);return window.addEventListener(`keydown`,e),window.addEventListener(fi,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(fi,t)}},[]),(0,n.useEffect)(()=>{if(!e){o(``),l(0);return}l(0),T.current(),S.current?.focus()},[e]),(0,n.useEffect)(()=>{if(!e)return;let t=e=>{x.current&&!x.current.contains(e.target)&&w()};return document.addEventListener(`pointerdown`,t,!0),()=>document.removeEventListener(`pointerdown`,t,!0)},[e,w]),(0,n.useEffect)(()=>{l(e=>e<j.length?e:Math.max(0,j.length-1))},[j.length]),(0,n.useEffect)(()=>{C.current?.querySelector(`[data-selected="true"]`)?.scrollIntoView?.({block:`nearest`})},[c,j.length]);let M=(0,n.useCallback)(e=>{e&&(w(),e.run())},[w]),N=(0,n.useCallback)(()=>{let e=oi.map(e=>e.prefix),t=e[((D?e.indexOf(D):-1)+1)%e.length];o(`${t} ${O}`),l(0)},[D,O]),P=e=>{switch(e.key){case`Escape`:e.preventDefault(),w();break;case`ArrowDown`:e.preventDefault(),l(e=>j.length?(e+1)%j.length:0);break;case`ArrowUp`:e.preventDefault(),l(e=>j.length?(e-1+j.length)%j.length:0);break;case`Enter`:e.preventDefault(),e.stopPropagation(),M(j[c]);break;case`Tab`:e.preventDefault(),N()}};if(!e)return null;let F=D?oi.find(e=>e.prefix===D):null;return(0,d.jsx)(`div`,{className:`fixed inset-0 z-[10000] flex items-start justify-center bg-black/40 backdrop-blur-[2px] px-4 pt-[12vh]`,role:`presentation`,children:(0,d.jsxs)(`div`,{ref:x,role:`dialog`,"aria-modal":`true`,"aria-label":`Search everything`,className:`w-full max-w-xl overflow-hidden rounded-2xl border border-border bg-popover shadow-2xl`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-4`,children:[(0,d.jsx)(s.Search,{size:18,className:`shrink-0 text-muted-foreground`}),(0,d.jsx)(`input`,{ref:S,value:a,onChange:e=>{o(e.target.value),l(0)},onKeyDown:P,type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Search everything`,"aria-autocomplete":`list`,"aria-controls":`spotlight-results`,"aria-activedescendant":j[c]?.id,placeholder:F?`Search ${F.label}…`:`Search chats, pages, settings — or ask anything`,className:`w-full bg-transparent py-4 text-base text-popover-foreground outline-none placeholder:text-muted-foreground`}),F&&(0,d.jsx)(`span`,{className:`shrink-0 rounded-md bg-secondary px-2 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:F.label})]}),(0,d.jsx)(`div`,{ref:C,id:`spotlight-results`,role:`listbox`,"aria-label":`Results`,className:`max-h-[50vh] overflow-y-auto p-1`,onMouseDown:e=>e.preventDefault(),children:j.length===0?(0,d.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:`No matches. Press Tab to search another source.`}):j.map((e,t)=>{let n=e.icon;return(0,d.jsxs)(`div`,{id:e.id,role:`option`,"aria-selected":t===c,"data-selected":t===c,onMouseMove:()=>l(t),onClick:()=>M(e),className:I(`flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2 transition-colors`,t===c?`bg-secondary`:`hover:bg-secondary/60`),children:[(0,d.jsx)(n,{size:16,className:I(`shrink-0`,t===c?`text-primary`:`text-muted-foreground`)}),(0,d.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,d.jsx)(`p`,{className:`truncate text-sm text-popover-foreground`,children:e.name}),e.meta&&(0,d.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.meta})]}),e.hint&&(0,d.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:e.hint}),(0,d.jsx)(`span`,{className:`shrink-0 rounded-md bg-secondary px-1.5 py-0 text-[10px] text-muted-foreground`,children:vi[e.source]})]},e.id)})}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-border px-4 py-2 text-[11px] text-muted-foreground`,children:[(0,d.jsx)(`span`,{children:`↑↓ move`}),(0,d.jsx)(`span`,{children:`↵ open`}),(0,d.jsx)(`span`,{children:`⇥ next source`}),(0,d.jsx)(`span`,{children:`esc close`}),(0,d.jsx)(`span`,{className:`ml-auto`,children:oi.map(e=>`${e.prefix} ${e.label}`).join(` · `)})]})]})})}function bi(e,t){let[r,i]=(0,n.useState)(`idle`),[a,o]=(0,n.useState)(!1),[s,c]=(0,n.useState)([]),[l,u]=(0,n.useState)(`af_heart`),[d,f]=(0,n.useState)(null),p=(0,n.useRef)(null),m=(0,n.useRef)(null);(0,n.useEffect)(()=>{t?.autoPreload&&!a&&g()},[t?.autoPreload,a]),(0,n.useEffect)(()=>{let e=localStorage.getItem(`kokoroVoice`);e&&u(e)},[]),(0,n.useEffect)(()=>()=>{p.current&&p.current.pause(),m.current?.abort()},[]);let h=(0,n.useCallback)(()=>{p.current&&=(p.current.pause(),p.current.src.startsWith(`blob:`)&&URL.revokeObjectURL(p.current.src),null),m.current?.abort(),m.current=null},[]),g=(0,n.useCallback)(async()=>{try{i(`loading`),f(null),await Ae();let e=await Me();c(e),e.length&&!e.includes(l)&&u(e[0]),o(!0),i(`idle`)}catch(e){let t=e instanceof Error?e.message:`Failed to load model`;f(t),i(`error`),console.error(`Failed to load Kokoro model:`,e)}},[l]);return{status:r,modelReady:a,voices:s,selectedVoice:l,error:d,warmupModel:g,speak:(0,n.useCallback)(async()=>{if(e?.trim()){if(!a){f(`Model not loaded. Click "Preload Model" first.`);return}try{h(),i(`generating`),f(null);let t=new AbortController;m.current=t;let n=(await(await je()).generate(e.slice(0,5e3),{voice:l})).toWav(),r=new Blob([n],{type:`audio/wav`}),a=URL.createObjectURL(r),o=new Audio(a);p.current=o,o.onended=()=>{i(`idle`),URL.revokeObjectURL(a),p.current=null},o.onerror=()=>{i(`error`),f(`Failed to play audio`),URL.revokeObjectURL(a),p.current=null},i(`playing`),await o.play()}catch(e){if(e?.name!==`AbortError`){let t=e instanceof Error?e.message:`Speech generation failed`;f(t),i(`error`),console.error(`Kokoro TTS error:`,e)}}}},[e,l,a,h]),stop:(0,n.useCallback)(()=>{h(),i(`idle`),f(null)},[h]),changeVoice:(0,n.useCallback)(e=>{u(e),localStorage.setItem(`kokoroVoice`,e)},[]),backend:Ne()}}var xi={af_heart:`American Female - Heart`,af_bella:`American Female - Bella`,af_nicole:`American Female - Nicole`,af_sarah:`American Female - Sarah`,am_adam:`American Male - Adam`,am_michael:`American Male - Michael`,am_tony:`American Male - Tony`,bf_emma:`British Female - Emma`,bm_george:`British Male - George`,bm_thomas:`British Male - Thomas`};function Si({preloadOnMount:e=!1}){let{status:t,modelReady:r,voices:i,selectedVoice:a,error:o,warmupModel:c,changeVoice:l,backend:u}=bi(``,{autoPreload:e}),[f,p]=(0,n.useState)(!1),m=t===`loading`,h=t===`error`;return(0,d.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsxs)(K,{children:[(0,d.jsx)(q,{asChild:!0,children:(0,d.jsx)(`button`,{onClick:c,disabled:m||r,className:I(`p-2 rounded-full transition duration-200`,r?`bg-green-500/10 text-green-600 dark:text-green-400`:`bg-white/10 dark:bg-black/10 text-muted-foreground hover:bg-white/20 dark:hover:bg-black/20`,m&&`opacity-70 cursor-not-allowed`),children:m?(0,d.jsx)(s.Loader2,{size:18,className:`animate-spin`}):(0,d.jsx)(s.Download,{size:18})})}),(0,d.jsx)(J,{side:`bottom`,children:m?`Loading Kokoro model...`:r?`Model ready`:`Preload Kokoro.js model`})]}),r&&u&&(0,d.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[u,` • `,i.length,` voices`]}),h&&(0,d.jsxs)(K,{children:[(0,d.jsx)(q,{asChild:!0,children:(0,d.jsx)(s.AlertCircle,{size:18,className:`text-red-500`})}),(0,d.jsx)(J,{side:`bottom`,className:`max-w-xs`,children:o})]})]}),r&&(0,d.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,d.jsx)(`button`,{onClick:()=>p(!f),className:`w-full text-left px-3 py-2 rounded-md bg-white/5 dark:bg-black/5 hover:bg-white/10 dark:hover:bg-black/10 transition text-sm font-medium`,children:(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(s.Volume2,{size:16}),xi[a]||a]})}),f&&(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-2 p-2 bg-white/5 dark:bg-black/5 rounded-md max-h-64 overflow-y-auto`,children:i.map(e=>(0,d.jsx)(`button`,{onClick:()=>{l(e),p(!1)},className:I(`p-2 text-left text-sm rounded transition duration-200`,a===e?`bg-blue-500/20 text-blue-600 dark:text-blue-400 font-medium`:`bg-white/5 dark:bg-black/5 text-foreground hover:bg-white/10 dark:hover:bg-black/10`),children:xi[e]||e},e))})]})]})}function Ci(){let[e,t]=(0,n.useState)(!1),[r,i]=(0,n.useState)(()=>localStorage.getItem(`useTTSKokoro`)!==`false`),[a,o]=(0,n.useState)(()=>localStorage.getItem(`ttsSpeaker`)||`angus`),[c,l]=(0,n.useState)(()=>mn()),{start:u,speechStatus:f}=Pe(`This is a preview of the selected voice.`,{enableInterrupt:!1}),p=e=>{i(e),localStorage.setItem(`useTTSKokoro`,String(e))},m=e=>{o(e),localStorage.setItem(`ttsSpeaker`,e)},h=e=>{l(e),hn(e)};return(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(s.Settings2,{size:18}),(0,d.jsx)(`h3`,{className:`font-semibold`,children:`Voice Settings`})]}),(0,d.jsx)(`button`,{onClick:()=>t(!e),className:`text-xs px-3 py-1 rounded-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition`,children:e?`Collapse`:`Expand`})]}),e&&(0,d.jsxs)(`div`,{className:`space-y-4 p-4 rounded-lg bg-white/5 dark:bg-black/5 border border-white/10 dark:border-black/10`,children:[(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>p(e.target.checked),className:`rounded`}),(0,d.jsx)(`span`,{className:`font-medium text-sm`,children:`Use Kokoro.js (Local TTS)`}),(0,d.jsxs)(K,{children:[(0,d.jsx)(q,{asChild:!0,children:(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground cursor-help`,children:`ⓘ`})}),(0,d.jsx)(J,{side:`right`,className:`max-w-xs`,children:`Runs locally in your browser. No server requests, lower latency, and multiple voice options.`})]})]}),r&&(0,d.jsx)(Si,{preloadOnMount:!1})]}),(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:!r,onChange:e=>p(!e.target.checked),className:`rounded`}),(0,d.jsx)(`span`,{className:`font-medium text-sm`,children:`Use Cloudflare TTS (Fallback)`}),(0,d.jsxs)(K,{children:[(0,d.jsx)(q,{asChild:!0,children:(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground cursor-help`,children:`ⓘ`})}),(0,d.jsx)(J,{side:`right`,className:`max-w-xs`,children:`Uses Cloudflare Workers AI. Slightly higher latency but can be a fallback.`})]})]}),!r&&(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`select`,{value:a,onChange:e=>m(e.target.value),className:`w-full px-3 py-2 rounded-md bg-white/10 dark:bg-black/10 border border-white/20 dark:border-black/20 text-sm`,children:[(0,d.jsx)(`option`,{value:`angus`,children:`Angus`}),(0,d.jsx)(`option`,{value:`flora`,children:`Flora`}),(0,d.jsx)(`option`,{value:`james`,children:`James`}),(0,d.jsx)(`option`,{value:`natalie`,children:`Natalie`})]}),(0,d.jsxs)(`button`,{onClick:()=>u(),disabled:f===`started`,className:I(`w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition`,f===`started`?`bg-gray-500/20 text-gray-600 dark:text-gray-400 cursor-not-allowed`:`bg-blue-500/20 text-blue-600 dark:text-blue-400 hover:bg-blue-500/30`),children:[(0,d.jsx)(s.Volume2,{size:16}),f===`started`?`Playing...`:`Preview`]})]})]}),(0,d.jsx)(`div`,{className:`space-y-2 pt-2 border-t border-white/10 dark:border-black/10`,children:(0,d.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>h(e.target.checked),className:`rounded`}),(0,d.jsx)(`span`,{className:`font-medium text-sm`,children:`Start talking automatically on first visit`}),(0,d.jsxs)(K,{children:[(0,d.jsx)(q,{asChild:!0,children:(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground cursor-help`,children:`ⓘ`})}),(0,d.jsx)(J,{side:`right`,className:`max-w-xs`,children:`Opens the mic the first time you load the chat composer in this browser, so you can start talking right away instead of clicking the mic button.`})]})]})}),(0,d.jsx)(`div`,{className:`text-xs text-muted-foreground pt-2 border-t border-white/10 dark:border-black/10`,children:(0,d.jsxs)(`p`,{children:[(0,d.jsx)(`strong`,{children:`Tip:`}),` Kokoro.js loads once and runs locally. The first model load may take a few seconds, but subsequent TTS generation is very fast.`]})})]})]})}var wi=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%23FE5022;'%20d='M438.802,390.609V278.595h55.174c9.938,0,18.023,8.085,18.023,18.023v75.967%20c0,9.938-8.086,18.024-18.023,18.024L438.802,390.609L438.802,390.609z'/%3e%3cpath%20style='fill:%23ECE5DD;'%20d='M28.107,511.637C12.609,511.637,0,499.027,0,483.529V134.326c0-1.441,0-12.123,0-12.123%20L121.715,0.363c0,0,10.8,0,12.248,0h271.569c15.498,0,28.107,12.609,28.107,28.106v455.059c0,15.499-12.609,28.108-28.107,28.108%20H28.107V511.637z'/%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M405.533,0.363h-31.991c15.498,0,28.107,12.609,28.107,28.107v455.059%20c0,15.499-12.609,28.108-28.107,28.108h31.991c15.498,0,28.107-12.609,28.107-28.108V28.469%20C433.64,12.972,421.031,0.363,405.533,0.363z'/%3e%3cg%3e%3cpath%20style='fill:%23BABABA;'%20d='M167.639,132.2h133.086c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318H167.639%20c-4.594,0-8.318,3.723-8.318,8.318C159.321,128.477,163.045,132.2,167.639,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M356.178,132.2h22.181c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318h-22.181%20c-4.594,0-8.318,3.723-8.318,8.318C347.86,128.477,351.584,132.2,356.178,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M242.5,212.606c0-4.595-3.724-8.318-8.318-8.318H56.734c-4.594,0-8.318,3.723-8.318,8.318%20s3.724,8.318,8.318,8.318h177.449C238.776,220.924,242.5,217.201,242.5,212.606z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M378.359,204.288h-99.815c-4.594,0-8.318,3.723-8.318,8.318s3.724,8.318,8.318,8.318h99.815%20c4.594,0,8.318-3.723,8.318-8.318S382.953,204.288,378.359,204.288z'/%3e%3c/g%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M0.726,123.171L122.442,1.331l1.39,105.939c0,9.465-7.7,17.166-17.166,17.166L0.726,123.171z'/%3e%3cpath%20style='fill:%23FFB656;'%20d='M270.226,401.7V267.504H456.87c5.938,0,10.768,4.83,10.768,10.768v112.659%20c0,5.938-4.83,10.769-10.768,10.769H270.226z'/%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M367.785,335.156c-12.822,0-23.252-10.431-23.252-23.254v-44.399h89.833v44.399%20c0,12.823-10.431,23.254-23.252,23.254H367.785z'/%3e%3cg%3e%3cpath%20style='fill:%23BABABA;'%20d='M167.639,132.2h133.086c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318H167.639%20c-4.594,0-8.318,3.723-8.318,8.318C159.321,128.477,163.045,132.2,167.639,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M356.178,132.2h22.181c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318h-22.181%20c-4.594,0-8.318,3.723-8.318,8.318C347.86,128.477,351.584,132.2,356.178,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M242.5,212.606c0-4.595-3.724-8.318-8.318-8.318H56.734c-4.594,0-8.318,3.723-8.318,8.318%20s3.724,8.318,8.318,8.318h177.449C238.776,220.924,242.5,217.201,242.5,212.606z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M378.359,204.288h-99.815c-4.594,0-8.318,3.723-8.318,8.318s3.724,8.318,8.318,8.318h99.815%20c4.594,0,8.318-3.723,8.318-8.318S382.953,204.288,378.359,204.288z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M345.087,448.28H101.096c-4.594,0-8.318,3.723-8.318,8.318c0,4.595,3.724,8.318,8.318,8.318h243.992%20c4.594,0,8.318-3.723,8.318-8.318C353.405,452.003,349.681,448.28,345.087,448.28z'/%3e%3c/g%3e%3cpath%20style='fill:%23FE5022;'%20d='M163.689,357.337c-3.692,0-6.094-3.886-4.443-7.189l16.225-32.451%20c1.799-3.597,5.416-5.833,9.438-5.833h44.282v45.471h-65.503V357.337z'/%3e%3cpolygon%20style='fill:%23FFB656;'%20points='256.918,278.252%20211.447,300.988%20211.447,368.216%20256.918,390.953%20284.321,390.953%20284.321,278.214%20'/%3e%3cg%3e%3cpath%20style='fill:%23FE5022;'%20d='M268.64,401.7c-7.075,0-12.832-5.756-12.832-12.832V280.336c0-7.075,5.756-12.831,12.832-12.831%20h19.808c7.075,0,12.832,5.756,12.832,12.831v108.532c0,7.076-5.756,12.832-12.832,12.832H268.64z'/%3e%3cpath%20style='fill:%23FE5022;'%20d='M104.156,379.377H26.143V301.33h91.398c8.546,0,14.88,7.936,12.986,16.27l-11.313,49.758%20C117.615,374.388,111.366,379.377,104.156,379.377z'/%3e%3c/g%3e%3c/svg%3e`,Ti=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2064%2064'%20xml:space='preserve'%3e%3cstyle%20type='text/css'%3e%20.st0{fill:%2376C2AF;}%20.st1{fill:%234F5D73;}%20.st2{opacity:0.2;}%20.st3{fill:%23231F20;}%20.st4{fill:%23FFFFFF;}%20%3c/style%3e%3cg%20id='Layer_1'%3e%3cg%3e%3ccircle%20class='st0'%20cx='32'%20cy='32'%20r='32'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M32,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C34,51.1,33.1,52,32,52L32,52z'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M46,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C48,51.1,47.1,52,46,52L46,52z'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M18,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C20,51.1,19.1,52,18,52L18,52z'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='45.9'%20cy='38'%20r='4'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='32'%20cy='27'%20r='4'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='18'%20cy='44'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='45.9'%20cy='36'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='32'%20cy='25'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='18'%20cy='42'%20r='4'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Layer_2'%3e%3c/g%3e%3c/svg%3e`;function Ei(){let e=(0,r.usePathname)(),n=(0,r.useRouter)(),{isAuthenticated:i,signIn:a,signOut:o}=G(),{newChat:c}=W(),{activeView:l,setActiveView:u,docsEnabled:f,requestFilesSidebar:p}=Zr(),m=[{href:`/`,label:`Research`,icon:t.researchAgentUIConfig.appIconUrl},...f?[{href:`/workspace`,label:`Docs`,icon:(0,d.jsx)(F.default,{src:wi,alt:`Docs`,width:24,height:24,unoptimized:!0,className:`w-full h-full`})}]:[]],h=e===`/`||e.startsWith(`/c`),g=[...m.map(({href:e,label:t,icon:n})=>({key:e,label:t,icon:n,active:e===`/`?l===`research`:l===`docs`,onClick:()=>{if(e===`/`){u(`research`),h&&c();return}u(`docs`)}})),...f?[{key:`files`,label:`Files`,icon:(0,d.jsx)(s.FileText,{className:`w-full h-full p-1`}),onClick:()=>{u(`docs`),p()}}]:[],{key:`settings`,label:`Settings`,icon:(0,d.jsx)(F.default,{src:Ti,alt:`Settings`,width:24,height:24,unoptimized:!0,className:`w-full h-full`}),menu:{renderContent:()=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(P.DropdownMenuItem,{onClick:()=>gi(),className:`cursor-pointer py-1 h-7`,children:[(0,d.jsx)(s.Search,{className:`mr-2 h-3.5 w-3.5`}),(0,d.jsx)(`span`,{className:`text-sm`,children:`Search everything`}),(0,d.jsx)(`span`,{className:`ml-auto pl-3 text-[10px] text-muted-foreground`,children:`Ctrl Space`})]}),(0,d.jsxs)(P.DropdownMenuItem,{onClick:()=>{t.researchAgentUIConfig.onOpenSettings?.()||n.push(`/settings`)},className:`cursor-pointer py-1 h-7`,children:[(0,d.jsx)(s.Settings,{className:`mr-2 h-3.5 w-3.5`}),(0,d.jsx)(`span`,{className:`text-sm`,children:`Settings`})]}),i?(0,d.jsxs)(P.DropdownMenuItem,{onClick:()=>o(),className:`cursor-pointer py-1 h-7`,children:[(0,d.jsx)(s.LogOut,{className:`mr-2 h-3.5 w-3.5`}),(0,d.jsx)(`span`,{className:`text-sm`,children:`Logout`})]}):(0,d.jsxs)(P.DropdownMenuItem,{onClick:()=>a(),className:`cursor-pointer py-1 h-7`,children:[(0,d.jsx)(s.LogIn,{className:`mr-2 h-3.5 w-3.5`}),(0,d.jsx)(`span`,{className:`text-sm`,children:`Login`})]}),(0,d.jsx)(P.DropdownMenuSeparator,{}),(0,d.jsx)(P.ThemeMenu,{})]})}}],_=g.filter(e=>e.key!==`files`),v=(e,t,n)=>(0,d.jsx)(F.default,{src:e,alt:t,width:n,height:n,unoptimized:!0,className:`w-full h-full`});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(P.CategoryDock,{items:_,enableKeyboardShortcuts:!0,placements:{desktop:!0,mobile:!1},renderImage:v}),(0,d.jsx)(P.CategoryDock,{items:g,placements:{desktop:!1,mobile:!0},mobileAlign:l===`docs`?`end`:`center`,renderImage:v})]})}function Di(){let[e,r]=(0,n.useState)(!1),i=(0,n.useRef)(null);return(0,n.useEffect)(()=>{localStorage.getItem(`cookie-consent`)||r(!0)},[]),(0,n.useEffect)(()=>{let t=document.documentElement,n=i.current;if(!e||!n){t.style.removeProperty(`--qs-bottom-right-inset`);return}let r=()=>t.style.setProperty(`--qs-bottom-right-inset`,`${Math.ceil(n.getBoundingClientRect().height)+16}px`);r();let a=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return a?.observe(n),()=>{a?.disconnect(),t.style.removeProperty(`--qs-bottom-right-inset`)}},[e]),e?(0,d.jsx)(`div`,{className:`fixed bottom-0 right-0 m-4 max-w-sm z-50`,children:(0,d.jsxs)(`div`,{ref:i,className:`bg-light-secondary dark:bg-dark-secondary rounded-lg shadow-lg border border-light-tertiary dark:border-dark-tertiary p-4 space-y-3`,children:[(0,d.jsxs)(`div`,{className:`flex justify-between items-start gap-3`,children:[(0,d.jsxs)(`div`,{className:`flex-1`,children:[(0,d.jsx)(`h3`,{className:`font-semibold text-sm text-black dark:text-white mb-2`,children:`Cookies & Privacy`}),(0,d.jsxs)(`p`,{className:`text-xs text-black/70 dark:text-white/70 mb-3`,children:[t.researchAgentUIConfig.appName,` uses cookies to enhance your research experience, analyze usage patterns, and improve our service. We respect your privacy and only use essential cookies by default.`]}),(0,d.jsx)(`div`,{className:`flex flex-wrap gap-2 text-xs mb-3`,children:t.researchAgentUIConfig.footerLinks.map(e=>(0,d.jsx)(`a`,{href:e.url,target:e.url.startsWith(`/`)?void 0:`_blank`,rel:e.url.startsWith(`/`)?void 0:`noopener noreferrer`,className:`text-blue-600 dark:text-blue-400 hover:underline`,children:e.text},e.url))})]}),(0,d.jsx)(`button`,{onClick:()=>{r(!1)},className:`text-black/50 dark:text-white/50 hover:text-black dark:hover:text-white transition-colors`,"aria-label":`Close`,children:(0,d.jsx)(s.X,{className:`w-4 h-4`})})]}),(0,d.jsxs)(`div`,{className:`flex gap-2`,children:[(0,d.jsx)(Q,{onClick:()=>{localStorage.setItem(`cookie-consent`,JSON.stringify({analytics:!0,marketing:!0,functional:!0,timestamp:new Date().toISOString()})),r(!1)},size:`sm`,className:`flex-1 bg-blue-600 hover:bg-blue-700 text-white`,children:`Accept All`}),(0,d.jsx)(Q,{onClick:()=>{localStorage.setItem(`cookie-consent`,JSON.stringify({analytics:!1,marketing:!1,functional:!0,timestamp:new Date().toISOString()})),r(!1)},size:`sm`,variant:`outline`,className:`flex-1 bg-light-tertiary dark:bg-dark-tertiary text-black dark:text-white border-0 hover:bg-light-tertiary/80 dark:hover:bg-dark-tertiary/80`,children:`Reject`})]})]})}):null}var Oi=`qwk:chunk-error-reload`,ki=e=>typeof e==`string`&&/Loading (chunk|CSS chunk)|ChunkLoadError/i.test(e);function Ai(){(0,n.useEffect)(()=>{let e=e=>{ki(e)&&(sessionStorage.getItem(Oi)||(sessionStorage.setItem(Oi,`1`),window.location.reload()))},t=t=>e(t.message),n=t=>e(t.reason?.message??t.reason);return window.addEventListener(`error`,t),window.addEventListener(`unhandledrejection`,n),()=>{window.removeEventListener(`error`,t),window.removeEventListener(`unhandledrejection`,n)}},[])}var ji=({children:e})=>(0,d.jsx)(d.Fragment,{children:e});function Mi(e){let[t,r]=(0,n.useState)(e===!0);return(0,n.useEffect)(()=>{if(e!==`auto`){r(e);return}let t=!1;return(0,p.default)(`auth/providers`).then(e=>{t||r(!!e.providers?.includes(`google`))}).catch(()=>{t||r(!1)}),()=>{t=!0}},[e]),t}function Ni({children:e,authClient:n,config:r,googleOneTap:i=`auto`,docsEnabled:a=!0,ChromeProvider:o=ji,showDock:s=!0,showCookieConsent:c=!0,showToaster:l=!0,showSpotlight:u=!0}){r&&t.configureResearchAgentUI(r);let f=Mi(i);return Ai(),(0,d.jsx)(N.ThemeProvider,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,children:(0,d.jsx)(rt,{authClient:n,enableGoogleOneTap:f,children:(0,d.jsx)(ne,{children:(0,d.jsxs)(it,{children:[(0,d.jsx)(P.CategoryDockProvider,{children:(0,d.jsx)(o,{children:(0,d.jsx)(Xr,{docsEnabled:a,children:(0,d.jsxs)(`div`,{id:`app-scroll-root`,className:`w-screen h-screen overflow-y-auto overflow-x-hidden pb-[calc(60px+env(safe-area-inset-bottom,0px))] md:pb-0`,children:[s&&(0,d.jsx)(Ei,{}),(0,d.jsx)(`main`,{className:`bg-light-primary dark:bg-dark-primary min-h-screen`,children:e})]})})})}),l&&(0,d.jsx)(m.Toaster,{toastOptions:{unstyled:!0,classNames:{toast:`bg-light-secondary dark:bg-dark-secondary dark:text-white/70 text-black-70 rounded-lg p-4 flex flex-row items-center space-x-2`}}}),c&&(0,d.jsx)(Di,{}),u&&(0,d.jsx)(yi,{})]})})})})}function Pi(e){return(0,d.jsx)(Ni,{...e,docsEnabled:!1,children:(0,d.jsx)(qr,{})})}var Fi=`qwksearch-open-chat-tabs`,Ii=50;function Li(){if(typeof window>`u`)return[];try{let e=window.localStorage.getItem(Fi);return e?JSON.parse(e):[]}catch{return[]}}function Ri(){let{chatId:e,chatTurns:t,startNewChat:r,switchToChat:i}=W(),[a,o]=(0,n.useState)(Li);(0,n.useEffect)(()=>{window.localStorage.setItem(Fi,JSON.stringify(a))},[a]),(0,n.useEffect)(()=>{if(!e)return;let n=t[0]?.content?.slice(0,Ii),r=t.length>0;o(t=>{let i=t.find(t=>t.id===e);return i?n&&i.title!==n||i.hasMessages!==r?t.map(t=>t.id===e?{...t,title:n||t.title,hasMessages:r}:t):t:[...t,{id:e,title:n||`New Chat`,hasMessages:r}]})},[e,t]);let s=(0,n.useCallback)((e,t)=>{let n=t.find(t=>t.id===e);n&&!n.hasMessages?r(e):i(e)},[r,i]),c=(0,n.useCallback)(e=>{s(e,a)},[s,a]),l=(0,n.useCallback)(()=>{let e=crypto.randomUUID();return o(t=>[...t,{id:e,title:`New Chat`}]),r(e),e},[r]),u=(0,n.useCallback)(t=>{let n=new Set(t),r=a.filter(e=>!n.has(e.id));o(r);let i=e!=null&&n.has(e);if(!i)return{closedWasActive:!1,nextActiveId:null};if(r.length===0)return{closedWasActive:i,nextActiveId:null};let c=a.findIndex(t=>t.id===e),l=e=>e!=null&&!n.has(e.id),u;for(let e=c-1;e>=0&&!u;e--)l(a[e])&&(u=a[e]);for(let e=c+1;e<a.length&&!u;e++)l(a[e])&&(u=a[e]);let d=(u??r[0]).id;return s(d,r),{closedWasActive:i,nextActiveId:d}},[a,e,s]),d=(0,n.useCallback)(e=>u([e]),[u]);return{chatTabs:a,activeChatId:e??null,openChat:c,newChat:l,closeChat:d,closeChats:u}}Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Qn}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return Kn}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Zr}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Di}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Nr}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Si}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return gi}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return oi}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Xr}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return ei}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Ai}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Jn}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return er}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return bi}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return si}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Pi}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Ei}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return ui}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Ni}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Ci}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Ri}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return yi}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return qr}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return kr}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return Ir}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return ne}});
|
|
51
|
+
ANTHROPIC_API_KEY=sk-ant-your_key_here`})]}),(0,d.jsxs)(`div`,{className:`bg-black/5 dark:bg-white/5 rounded p-4`,children:[(0,d.jsx)(`p`,{className:`font-medium text-black dark:text-white mb-2`,children:`3. Restart the server`}),(0,d.jsx)(`code`,{className:`block bg-black/10 dark:bg-white/10 rounded p-2 text-xs`,children:`Ctrl+C, then: npm run dev`})]})]}),(0,d.jsxs)(`div`,{className:`pt-4 border-t border-black/10 dark:border-white/10`,children:[(0,d.jsx)(`h3`,{className:`font-medium text-black dark:text-white mb-2`,children:`Get API Keys:`}),(0,d.jsxs)(`ul`,{className:`space-y-2 text-sm text-black/70 dark:text-white/70`,children:[(0,d.jsxs)(`li`,{children:[(0,d.jsx)(`strong`,{children:`Groq`}),` (FREE): `,(0,d.jsx)(`a`,{href:`https://console.groq.com/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 dark:text-blue-400 hover:underline`,children:`console.groq.com/keys`})]}),(0,d.jsxs)(`li`,{children:[(0,d.jsx)(`strong`,{children:`OpenAI`}),`: `,(0,d.jsx)(`a`,{href:`https://platform.openai.com/api-keys`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 dark:text-blue-400 hover:underline`,children:`platform.openai.com/api-keys`})]}),(0,d.jsxs)(`li`,{children:[(0,d.jsx)(`strong`,{children:`Anthropic`}),`: `,(0,d.jsx)(`a`,{href:`https://console.anthropic.com/settings/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 dark:text-blue-400 hover:underline`,children:`console.anthropic.com`})]})]})]})]}),(0,d.jsxs)(`div`,{className:`text-xs text-black/50 dark:text-white/50 pt-4 border-t border-black/10 dark:border-white/10`,children:[`See `,(0,d.jsx)(`code`,{children:`SETUP_INSTRUCTIONS.md`}),` in the project root for full details.`]})]})})}var qr=()=>{let e=(0,r.useRouter)(),{hasError:t,isReady:i,notFound:a,messages:o}=W(),{isAuthenticated:s}=G();return(0,n.useEffect)(()=>{i&&a&&!s&&e.replace(`/`)},[i,a,s,e]),t?(0,d.jsx)(Kr,{}):i&&a&&!s?(0,d.jsx)(`div`,{className:`flex flex-row items-center justify-center min-h-screen`,children:(0,d.jsx)(Gr,{})}):i?a?(0,d.jsxs)(`div`,{className:`flex min-h-screen flex-col items-center justify-center gap-3 px-4 text-center`,children:[(0,d.jsx)(`p`,{className:`text-sm text-black/70 dark:text-white/70`,children:`This chat could not be found.`}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>e.push(`/`),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`,children:`Go Home`})]}):(0,d.jsx)(`div`,{children:o.length>0?(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(yr,{})}):(0,d.jsx)(Wr,{})}):(0,d.jsx)(`div`,{className:`flex flex-row items-center justify-center min-h-screen`,children:(0,d.jsx)(Gr,{})})},Jr=(0,n.createContext)(null),Yr=`qwksearch-main-view`;function Xr({children:e,docsEnabled:t=!0}){let[r,i]=(0,n.useState)(`research`),[a,o]=(0,n.useState)(0),s=(0,n.useCallback)(e=>i(t?e:`research`),[t]);(0,n.useEffect)(()=>{if(typeof window>`u`||!t)return;let e=window.localStorage.getItem(Yr);(e===`research`||e===`docs`)&&i(e)},[t]),(0,n.useEffect)(()=>{typeof window<`u`&&t&&window.localStorage.setItem(Yr,r)},[r,t]);let c=(0,n.useMemo)(()=>({activeView:r,setActiveView:s,docsEnabled:t,toggleToDocs:()=>s(`docs`),toggleToResearch:()=>s(`research`),filesSidebarRequestId:a,requestFilesSidebar:()=>o(e=>e+1)}),[r,s,t,a]);return(0,d.jsx)(Jr.Provider,{value:c,children:e})}var Zr=Object.freeze({activeView:`research`,setActiveView:()=>{},docsEnabled:!1,toggleToDocs:()=>{},toggleToResearch:()=>{},filesSidebarRequestId:0,requestFilesSidebar:()=>{}}),Qr=!1;function $r(){return(0,n.useContext)(Jr)||(!Qr&&process.env.NODE_ENV!==`production`&&(Qr=!0,console.error(`useMainView was called outside a MainViewProvider. The component is rendering with view switching disabled — mount it inside MainViewProvider (see QwkSearchProviders).`)),Zr)}var ei=[{key:`account`,name:`Account`,description:`Manage your profile, password, and linked accounts.`,icon:`UserCircle`,dataAdd:`account`},{key:`models`,name:`Language Models`,description:`Connect to AI services and manage connections.`,icon:`BrainCog`,dataAdd:`modelProviders`},{key:`mcpservers`,name:`Connectors`,description:`Configure Model Context Protocol servers.`,icon:`Server`,dataAdd:`mcpServers`},{key:`skills-memory`,name:`Skills & Memory`,description:`Manage agent skills and view your stored memories.`,icon:`Brain`,dataAdd:`skillsMemory`},{key:`searchEngines`,name:`Search Sources`,description:`Manage search engine sources by category.`,icon:`Search`,dataAdd:`searchEngines`},{key:`search`,name:`Search Settings`,description:`Configure search parameters.`,icon:`Search`,dataAdd:`search`},{key:`fileSources`,name:`Cloud Storage`,description:`Manage storage sources (SSH, S3, R2, B2, Google Docs, Turso DB).`,icon:`HardDrive`,dataAdd:`storage`},{key:`aiRewriteModes`,name:`Rewrite Modes`,description:`Customize AI rewrite prompts and add your own modes.`,icon:`Wand2`,dataAdd:`rewritePrompts`},{key:`voice`,name:`Voice Settings`,description:`Configure text-to-speech with Kokoro.js or Cloudflare TTS.`,icon:`Volume2`,dataAdd:`voice`}],ti=[{key:`webSearch`,title:`All`,description:`Searches across all of the internet`,icon:(0,d.jsx)(s.Globe,{size:16})},{key:`academicSearch`,title:`Academic`,description:`Search in published academic papers`,icon:(0,d.jsx)(s.SwatchBook,{size:16})},{key:`writingAssistant`,title:`Writing`,description:`Chat without searching the web`,icon:(0,d.jsx)(s.Pencil,{size:16})},{key:`wolframAlphaSearch`,title:`Wolfram Alpha`,description:`Computational knowledge engine`,icon:(0,d.jsx)(s.BadgePercent,{size:16})},{key:`youtubeSearch`,title:`Youtube`,description:`Search and watch videos`,icon:(0,d.jsx)(M.FaYoutube,{className:`h-[16px] w-auto mr-0.5`})},{key:`redditSearch`,title:`Reddit`,description:`Search for discussions and opinions`,icon:(0,d.jsx)(M.FaReddit,{className:`h-[16px] w-auto mr-0.5`})}],ni=[{href:`/`,label:`Research`,description:`The search and chat window`,keywords:`home chat ask question search`},{href:`/workspace`,label:`REASON Editor`,description:`Write up findings in the document editor`,keywords:`docs document write draft report`,docsOnly:!0},{href:`/library`,label:`Library`,description:`Saved chats, uploads and extracted articles`,keywords:`history saved files uploads archive`},{href:`/news`,label:`News`,description:`Trending stories by topic`,keywords:`discover trending headlines`},{href:`/docs`,label:`User Guide`,description:`How every part of the app works`,keywords:`documentation help manual`},{href:`/features`,label:`Features`,description:`Everything the research agent can do`,keywords:`capabilities tour`},{href:`/settings`,label:`Settings`,description:`Models, connectors, search sources and preferences`,keywords:`preferences configure options`},{href:`/enterprise`,label:`Enterprise`,description:`Self-hosting and team plans`,keywords:`business pricing teams`},{href:`/legal/privacy`,label:`Privacy Policy`,description:`What is stored and what is not`,keywords:`legal terms data`}];function ri(e){let t=e=>e===`/`?s.Search:e===`/workspace`?s.FileText:e===`/settings`?s.Settings:e===`/docs`?s.BookOpen:s.LayoutGrid;return ni.filter(t=>!t.docsOnly||e.docsEnabled).map(n=>({id:`page:${n.href}`,source:`page`,name:n.label,meta:n.description,keywords:`${n.keywords??``} ${n.href}`,icon:t(n.href),run:()=>e.navigate(n.href)}))}function ii(e,t){let n=new Date;return e.map(e=>({id:`chat:${e.id}`,source:`chat`,name:e.title||`Untitled chat`,meta:`${e.messageCount??0} question${(e.messageCount??0)===1?``:`s`}`,keywords:e.focusMode??``,icon:s.MessageSquare,hint:R(n,e.lastMessageAt||e.createdAt),run:()=>t.openChat(e.id)}))}function ai(e){return ei.map(t=>({id:`setting:${t.key}`,source:`setting`,name:t.name,meta:t.description,keywords:`settings ${t.key}`,icon:s.SlidersHorizontal,run:()=>e.openSettings(t.key)}))}function oi(e){let t=[{id:`action:new-chat`,source:`action`,name:`New chat`,meta:`Start a fresh conversation`,keywords:`clear reset blank`,icon:s.Plus,run:e.newChat},{id:`action:settings`,source:`action`,name:`Open settings`,meta:`Models, connectors, search sources and preferences`,keywords:`preferences configure`,icon:s.Settings,run:()=>e.openSettings()},{id:`action:incognito`,source:`action`,name:e.incognito?`Turn off incognito`:`Turn on incognito`,meta:`Stop saving this conversation to history`,keywords:`private incognito history off`,icon:s.EyeOff,hint:e.incognito?`on`:`off`,run:()=>e.setIncognito(!e.incognito)}];for(let n of ti)t.push({id:`action:focus:${n.key}`,source:`action`,name:`Focus: ${n.title}`,meta:n.description,keywords:`focus mode ${n.key}`,icon:s.Globe,hint:e.focusMode===n.key?`current`:void 0,run:()=>e.setFocusMode(n.key)});return e.docsEnabled&&t.push({id:`action:view-docs`,source:`action`,name:`Switch to documents`,meta:`Open the REASON editor view`,keywords:`reason editor write docs`,icon:s.FileText,run:()=>e.setActiveView(`docs`)},{id:`action:view-research`,source:`action`,name:`Switch to research`,meta:`Back to the search and chat view`,keywords:`chat search`,icon:s.Search,run:()=>e.setActiveView(`research`)},{id:`action:files-sidebar`,source:`action`,name:`Show files sidebar`,meta:`Browse REASON documents`,keywords:`files documents sidebar`,icon:s.FileText,run:()=>{e.setActiveView(`docs`),e.requestFilesSidebar()}}),t.push(e.isAuthenticated?{id:`action:sign-out`,source:`action`,name:`Sign out`,meta:`End this session`,keywords:`logout log out`,icon:s.LogOut,run:e.signOut}:{id:`action:sign-in`,source:`action`,name:`Sign in`,meta:`Sync chats and settings across devices`,keywords:`login log in account`,icon:s.LogIn,run:e.signIn}),t}function si(e,t){let n=e.trim();return n?{id:`search:ask`,source:`search`,name:n,meta:`Ask ${t.appName} — searches the web and answers with sources`,icon:s.Sparkles,hint:`Enter`,run:()=>t.ask(n)}:null}var ci=[{prefix:`c`,source:`chat`,label:`chats`},{prefix:`t`,source:`page`,label:`pages`},{prefix:`s`,source:`setting`,label:`settings`},{prefix:`a`,source:`action`,label:`actions`},{prefix:`w`,source:`search`,label:`web`}];function li(e){let t=e.match(/^([a-zA-Z])\s+(.*)$/);if(t){let e=t[1].toLowerCase(),n=ci.find(t=>t.prefix===e);if(n)return{prefix:n.prefix,query:t[2]}}return{prefix:null,query:e}}var ui=18;function di(e){return`${e.meta??``} ${e.keywords??``}`.toLowerCase()}function fi(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return e.map(e=>({item:e,matchedName:!0,snippet:null}));let r=[],i=[];for(let t of e){let e=t.name.toLowerCase();if(n.every(t=>e.includes(t)))r.push(t);else{let r=`${e} ${di(t)}`;n.every(e=>r.includes(e))&&i.push(t)}}let a=n[0];return r.sort((e,t)=>e.name.toLowerCase().indexOf(a)-t.name.toLowerCase().indexOf(a)),[...r.map(e=>({item:e,matchedName:!0,snippet:null})),...i.map(e=>({item:e,matchedName:!1,snippet:pi(di(e),a)}))]}function pi(e,t){let n=e.indexOf(t);if(n<0)return``;let r=Math.max(0,n-ui),i=Math.min(e.length,n+t.length+ui),a=e.slice(r,i).replace(/\s+/g,` `).trim();return r>0&&(a=`…`+a),i<e.length&&(a+=`…`),a}var mi=`qwksearch:open-spotlight`,hi=100,gi=6,_i=40;function vi(){typeof window>`u`||window.dispatchEvent(new Event(mi))}function yi(e){return e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.code===`Space`||e.key===` `)}var bi={search:`ask`,chat:`chat`,page:`page`,setting:`setting`,action:`action`};function xi(){let[e,i]=(0,n.useState)(!1),[a,o]=(0,n.useState)(``),[c,l]=(0,n.useState)(0),u=(0,r.useRouter)(),f=W(),{isAuthenticated:p,signIn:m,signOut:h}=G(),{docsEnabled:g,setActiveView:_,requestFilesSidebar:v}=$r(),{recentChats:y,load:b}=Pn(hi),x=(0,n.useRef)(null),S=(0,n.useRef)(null),C=(0,n.useRef)(null),w=(0,n.useCallback)(()=>i(!1),[]),T=(0,n.useRef)(b);(0,n.useEffect)(()=>{T.current=b},[b]);let E=(0,n.useMemo)(()=>({appName:t.researchAgentUIConfig.appName,navigate:e=>u.push(e),openChat:e=>{t.researchAgentUIConfig.onOpenChat?.(e)||u.push(`/c/${e}`)},openSettings:e=>{t.researchAgentUIConfig.onOpenSettings?.(e)||u.push(e?`/settings/${e}`:`/settings`)},ask:e=>{f.newChat(),u.push(`/?q=${encodeURIComponent(e)}`)},newChat:f.newChat,focusMode:f.focusMode,setFocusMode:f.setFocusMode,incognito:f.incognito,setIncognito:f.setIncognito,isAuthenticated:p,signIn:m,signOut:h,docsEnabled:g,setActiveView:_,requestFilesSidebar:v}),[u,f.newChat,f.focusMode,f.setFocusMode,f.incognito,f.setIncognito,p,m,h,g,_,v]),{prefix:D,query:O}=li(a),k=O.trim(),A=(0,n.useMemo)(()=>({chat:ii(y,E),page:ri(E),setting:ai(E),action:oi(E)}),[y,E]),j=(0,n.useMemo)(()=>{let e=si(O,E);if(D===`w`)return e?[e]:[];if(D){let e=ci.find(e=>e.prefix===D).source;return fi(A[e],O).map(e=>e.item).slice(0,_i)}if(!k)return[...A.chat.slice(0,gi),...A.action,...A.page].slice(0,_i);let t=fi([...A.action,...A.page,...A.setting,...A.chat],O).map(e=>e.item);return[...e?[e]:[],...t].slice(0,_i)},[D,O,k,A,E]);(0,n.useEffect)(()=>{let e=e=>{yi(e)&&(e.preventDefault(),i(e=>!e))},t=()=>i(!0);return window.addEventListener(`keydown`,e),window.addEventListener(mi,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(mi,t)}},[]),(0,n.useEffect)(()=>{if(!e){o(``),l(0);return}l(0),T.current(),S.current?.focus()},[e]),(0,n.useEffect)(()=>{if(!e)return;let t=e=>{x.current&&!x.current.contains(e.target)&&w()};return document.addEventListener(`pointerdown`,t,!0),()=>document.removeEventListener(`pointerdown`,t,!0)},[e,w]),(0,n.useEffect)(()=>{l(e=>e<j.length?e:Math.max(0,j.length-1))},[j.length]),(0,n.useEffect)(()=>{C.current?.querySelector(`[data-selected="true"]`)?.scrollIntoView?.({block:`nearest`})},[c,j.length]);let M=(0,n.useCallback)(e=>{e&&(w(),e.run())},[w]),N=(0,n.useCallback)(()=>{let e=ci.map(e=>e.prefix),t=e[((D?e.indexOf(D):-1)+1)%e.length];o(`${t} ${O}`),l(0)},[D,O]),P=e=>{switch(e.key){case`Escape`:e.preventDefault(),w();break;case`ArrowDown`:e.preventDefault(),l(e=>j.length?(e+1)%j.length:0);break;case`ArrowUp`:e.preventDefault(),l(e=>j.length?(e-1+j.length)%j.length:0);break;case`Enter`:e.preventDefault(),e.stopPropagation(),M(j[c]);break;case`Tab`:e.preventDefault(),N()}};if(!e)return null;let F=D?ci.find(e=>e.prefix===D):null;return(0,d.jsx)(`div`,{className:`fixed inset-0 z-[10000] flex items-start justify-center bg-black/40 backdrop-blur-[2px] px-4 pt-[12vh]`,role:`presentation`,children:(0,d.jsxs)(`div`,{ref:x,role:`dialog`,"aria-modal":`true`,"aria-label":`Search everything`,className:`w-full max-w-xl overflow-hidden rounded-2xl border border-border bg-popover shadow-2xl`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-4`,children:[(0,d.jsx)(s.Search,{size:18,className:`shrink-0 text-muted-foreground`}),(0,d.jsx)(`input`,{ref:S,value:a,onChange:e=>{o(e.target.value),l(0)},onKeyDown:P,type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Search everything`,"aria-autocomplete":`list`,"aria-controls":`spotlight-results`,"aria-activedescendant":j[c]?.id,placeholder:F?`Search ${F.label}…`:`Search chats, pages, settings — or ask anything`,className:`w-full bg-transparent py-4 text-base text-popover-foreground outline-none placeholder:text-muted-foreground`}),F&&(0,d.jsx)(`span`,{className:`shrink-0 rounded-md bg-secondary px-2 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:F.label})]}),(0,d.jsx)(`div`,{ref:C,id:`spotlight-results`,role:`listbox`,"aria-label":`Results`,className:`max-h-[50vh] overflow-y-auto p-1`,onMouseDown:e=>e.preventDefault(),children:j.length===0?(0,d.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:`No matches. Press Tab to search another source.`}):j.map((e,t)=>{let n=e.icon;return(0,d.jsxs)(`div`,{id:e.id,role:`option`,"aria-selected":t===c,"data-selected":t===c,onMouseMove:()=>l(t),onClick:()=>M(e),className:I(`flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2 transition-colors`,t===c?`bg-secondary`:`hover:bg-secondary/60`),children:[(0,d.jsx)(n,{size:16,className:I(`shrink-0`,t===c?`text-primary`:`text-muted-foreground`)}),(0,d.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,d.jsx)(`p`,{className:`truncate text-sm text-popover-foreground`,children:e.name}),e.meta&&(0,d.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.meta})]}),e.hint&&(0,d.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:e.hint}),(0,d.jsx)(`span`,{className:`shrink-0 rounded-md bg-secondary px-1.5 py-0 text-[10px] text-muted-foreground`,children:bi[e.source]})]},e.id)})}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-border px-4 py-2 text-[11px] text-muted-foreground`,children:[(0,d.jsx)(`span`,{children:`↑↓ move`}),(0,d.jsx)(`span`,{children:`↵ open`}),(0,d.jsx)(`span`,{children:`⇥ next source`}),(0,d.jsx)(`span`,{children:`esc close`}),(0,d.jsx)(`span`,{className:`ml-auto`,children:ci.map(e=>`${e.prefix} ${e.label}`).join(` · `)})]})]})})}function Si(e,t){let[r,i]=(0,n.useState)(`idle`),[a,o]=(0,n.useState)(!1),[s,c]=(0,n.useState)([]),[l,u]=(0,n.useState)(`af_heart`),[d,f]=(0,n.useState)(null),p=(0,n.useRef)(null),m=(0,n.useRef)(null);(0,n.useEffect)(()=>{t?.autoPreload&&!a&&g()},[t?.autoPreload,a]),(0,n.useEffect)(()=>{let e=localStorage.getItem(`kokoroVoice`);e&&u(e)},[]),(0,n.useEffect)(()=>()=>{p.current&&p.current.pause(),m.current?.abort()},[]);let h=(0,n.useCallback)(()=>{p.current&&=(p.current.pause(),p.current.src.startsWith(`blob:`)&&URL.revokeObjectURL(p.current.src),null),m.current?.abort(),m.current=null},[]),g=(0,n.useCallback)(async()=>{try{i(`loading`),f(null),await Ae();let e=await Me();c(e),e.length&&!e.includes(l)&&u(e[0]),o(!0),i(`idle`)}catch(e){let t=e instanceof Error?e.message:`Failed to load model`;f(t),i(`error`),console.error(`Failed to load Kokoro model:`,e)}},[l]);return{status:r,modelReady:a,voices:s,selectedVoice:l,error:d,warmupModel:g,speak:(0,n.useCallback)(async()=>{if(e?.trim()){if(!a){f(`Model not loaded. Click "Preload Model" first.`);return}try{h(),i(`generating`),f(null);let t=new AbortController;m.current=t;let n=(await(await je()).generate(e.slice(0,5e3),{voice:l})).toWav(),r=new Blob([n],{type:`audio/wav`}),a=URL.createObjectURL(r),o=new Audio(a);p.current=o,o.onended=()=>{i(`idle`),URL.revokeObjectURL(a),p.current=null},o.onerror=()=>{i(`error`),f(`Failed to play audio`),URL.revokeObjectURL(a),p.current=null},i(`playing`),await o.play()}catch(e){if(e?.name!==`AbortError`){let t=e instanceof Error?e.message:`Speech generation failed`;f(t),i(`error`),console.error(`Kokoro TTS error:`,e)}}}},[e,l,a,h]),stop:(0,n.useCallback)(()=>{h(),i(`idle`),f(null)},[h]),changeVoice:(0,n.useCallback)(e=>{u(e),localStorage.setItem(`kokoroVoice`,e)},[]),backend:Ne()}}var Ci={af_heart:`American Female - Heart`,af_bella:`American Female - Bella`,af_nicole:`American Female - Nicole`,af_sarah:`American Female - Sarah`,am_adam:`American Male - Adam`,am_michael:`American Male - Michael`,am_tony:`American Male - Tony`,bf_emma:`British Female - Emma`,bm_george:`British Male - George`,bm_thomas:`British Male - Thomas`};function wi({preloadOnMount:e=!1}){let{status:t,modelReady:r,voices:i,selectedVoice:a,error:o,warmupModel:c,changeVoice:l,backend:u}=Si(``,{autoPreload:e}),[f,p]=(0,n.useState)(!1),m=t===`loading`,h=t===`error`;return(0,d.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsxs)(K,{children:[(0,d.jsx)(q,{asChild:!0,children:(0,d.jsx)(`button`,{onClick:c,disabled:m||r,className:I(`p-2 rounded-full transition duration-200`,r?`bg-green-500/10 text-green-600 dark:text-green-400`:`bg-white/10 dark:bg-black/10 text-muted-foreground hover:bg-white/20 dark:hover:bg-black/20`,m&&`opacity-70 cursor-not-allowed`),children:m?(0,d.jsx)(s.Loader2,{size:18,className:`animate-spin`}):(0,d.jsx)(s.Download,{size:18})})}),(0,d.jsx)(J,{side:`bottom`,children:m?`Loading Kokoro model...`:r?`Model ready`:`Preload Kokoro.js model`})]}),r&&u&&(0,d.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[u,` • `,i.length,` voices`]}),h&&(0,d.jsxs)(K,{children:[(0,d.jsx)(q,{asChild:!0,children:(0,d.jsx)(s.AlertCircle,{size:18,className:`text-red-500`})}),(0,d.jsx)(J,{side:`bottom`,className:`max-w-xs`,children:o})]})]}),r&&(0,d.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,d.jsx)(`button`,{onClick:()=>p(!f),className:`w-full text-left px-3 py-2 rounded-md bg-white/5 dark:bg-black/5 hover:bg-white/10 dark:hover:bg-black/10 transition text-sm font-medium`,children:(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(s.Volume2,{size:16}),Ci[a]||a]})}),f&&(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-2 p-2 bg-white/5 dark:bg-black/5 rounded-md max-h-64 overflow-y-auto`,children:i.map(e=>(0,d.jsx)(`button`,{onClick:()=>{l(e),p(!1)},className:I(`p-2 text-left text-sm rounded transition duration-200`,a===e?`bg-blue-500/20 text-blue-600 dark:text-blue-400 font-medium`:`bg-white/5 dark:bg-black/5 text-foreground hover:bg-white/10 dark:hover:bg-black/10`),children:Ci[e]||e},e))})]})]})}function Ti(){let[e,t]=(0,n.useState)(!1),[r,i]=(0,n.useState)(()=>localStorage.getItem(`useTTSKokoro`)!==`false`),[a,o]=(0,n.useState)(()=>localStorage.getItem(`ttsSpeaker`)||`angus`),[c,l]=(0,n.useState)(()=>mn()),{start:u,speechStatus:f}=Pe(`This is a preview of the selected voice.`,{enableInterrupt:!1}),p=e=>{i(e),localStorage.setItem(`useTTSKokoro`,String(e))},m=e=>{o(e),localStorage.setItem(`ttsSpeaker`,e)},h=e=>{l(e),hn(e)};return(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(s.Settings2,{size:18}),(0,d.jsx)(`h3`,{className:`font-semibold`,children:`Voice Settings`})]}),(0,d.jsx)(`button`,{onClick:()=>t(!e),className:`text-xs px-3 py-1 rounded-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition`,children:e?`Collapse`:`Expand`})]}),e&&(0,d.jsxs)(`div`,{className:`space-y-4 p-4 rounded-lg bg-white/5 dark:bg-black/5 border border-white/10 dark:border-black/10`,children:[(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>p(e.target.checked),className:`rounded`}),(0,d.jsx)(`span`,{className:`font-medium text-sm`,children:`Use Kokoro.js (Local TTS)`}),(0,d.jsxs)(K,{children:[(0,d.jsx)(q,{asChild:!0,children:(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground cursor-help`,children:`ⓘ`})}),(0,d.jsx)(J,{side:`right`,className:`max-w-xs`,children:`Runs locally in your browser. No server requests, lower latency, and multiple voice options.`})]})]}),r&&(0,d.jsx)(wi,{preloadOnMount:!1})]}),(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:!r,onChange:e=>p(!e.target.checked),className:`rounded`}),(0,d.jsx)(`span`,{className:`font-medium text-sm`,children:`Use Cloudflare TTS (Fallback)`}),(0,d.jsxs)(K,{children:[(0,d.jsx)(q,{asChild:!0,children:(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground cursor-help`,children:`ⓘ`})}),(0,d.jsx)(J,{side:`right`,className:`max-w-xs`,children:`Uses Cloudflare Workers AI. Slightly higher latency but can be a fallback.`})]})]}),!r&&(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`select`,{value:a,onChange:e=>m(e.target.value),className:`w-full px-3 py-2 rounded-md bg-white/10 dark:bg-black/10 border border-white/20 dark:border-black/20 text-sm`,children:[(0,d.jsx)(`option`,{value:`angus`,children:`Angus`}),(0,d.jsx)(`option`,{value:`flora`,children:`Flora`}),(0,d.jsx)(`option`,{value:`james`,children:`James`}),(0,d.jsx)(`option`,{value:`natalie`,children:`Natalie`})]}),(0,d.jsxs)(`button`,{onClick:()=>u(),disabled:f===`started`,className:I(`w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition`,f===`started`?`bg-gray-500/20 text-gray-600 dark:text-gray-400 cursor-not-allowed`:`bg-blue-500/20 text-blue-600 dark:text-blue-400 hover:bg-blue-500/30`),children:[(0,d.jsx)(s.Volume2,{size:16}),f===`started`?`Playing...`:`Preview`]})]})]}),(0,d.jsx)(`div`,{className:`space-y-2 pt-2 border-t border-white/10 dark:border-black/10`,children:(0,d.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>h(e.target.checked),className:`rounded`}),(0,d.jsx)(`span`,{className:`font-medium text-sm`,children:`Start talking automatically on first visit`}),(0,d.jsxs)(K,{children:[(0,d.jsx)(q,{asChild:!0,children:(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground cursor-help`,children:`ⓘ`})}),(0,d.jsx)(J,{side:`right`,className:`max-w-xs`,children:`Opens the mic the first time you load the chat composer in this browser, so you can start talking right away instead of clicking the mic button.`})]})]})}),(0,d.jsx)(`div`,{className:`text-xs text-muted-foreground pt-2 border-t border-white/10 dark:border-black/10`,children:(0,d.jsxs)(`p`,{children:[(0,d.jsx)(`strong`,{children:`Tip:`}),` Kokoro.js loads once and runs locally. The first model load may take a few seconds, but subsequent TTS generation is very fast.`]})})]})]})}var Ei=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%23FE5022;'%20d='M438.802,390.609V278.595h55.174c9.938,0,18.023,8.085,18.023,18.023v75.967%20c0,9.938-8.086,18.024-18.023,18.024L438.802,390.609L438.802,390.609z'/%3e%3cpath%20style='fill:%23ECE5DD;'%20d='M28.107,511.637C12.609,511.637,0,499.027,0,483.529V134.326c0-1.441,0-12.123,0-12.123%20L121.715,0.363c0,0,10.8,0,12.248,0h271.569c15.498,0,28.107,12.609,28.107,28.106v455.059c0,15.499-12.609,28.108-28.107,28.108%20H28.107V511.637z'/%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M405.533,0.363h-31.991c15.498,0,28.107,12.609,28.107,28.107v455.059%20c0,15.499-12.609,28.108-28.107,28.108h31.991c15.498,0,28.107-12.609,28.107-28.108V28.469%20C433.64,12.972,421.031,0.363,405.533,0.363z'/%3e%3cg%3e%3cpath%20style='fill:%23BABABA;'%20d='M167.639,132.2h133.086c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318H167.639%20c-4.594,0-8.318,3.723-8.318,8.318C159.321,128.477,163.045,132.2,167.639,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M356.178,132.2h22.181c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318h-22.181%20c-4.594,0-8.318,3.723-8.318,8.318C347.86,128.477,351.584,132.2,356.178,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M242.5,212.606c0-4.595-3.724-8.318-8.318-8.318H56.734c-4.594,0-8.318,3.723-8.318,8.318%20s3.724,8.318,8.318,8.318h177.449C238.776,220.924,242.5,217.201,242.5,212.606z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M378.359,204.288h-99.815c-4.594,0-8.318,3.723-8.318,8.318s3.724,8.318,8.318,8.318h99.815%20c4.594,0,8.318-3.723,8.318-8.318S382.953,204.288,378.359,204.288z'/%3e%3c/g%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M0.726,123.171L122.442,1.331l1.39,105.939c0,9.465-7.7,17.166-17.166,17.166L0.726,123.171z'/%3e%3cpath%20style='fill:%23FFB656;'%20d='M270.226,401.7V267.504H456.87c5.938,0,10.768,4.83,10.768,10.768v112.659%20c0,5.938-4.83,10.769-10.768,10.769H270.226z'/%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M367.785,335.156c-12.822,0-23.252-10.431-23.252-23.254v-44.399h89.833v44.399%20c0,12.823-10.431,23.254-23.252,23.254H367.785z'/%3e%3cg%3e%3cpath%20style='fill:%23BABABA;'%20d='M167.639,132.2h133.086c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318H167.639%20c-4.594,0-8.318,3.723-8.318,8.318C159.321,128.477,163.045,132.2,167.639,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M356.178,132.2h22.181c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318h-22.181%20c-4.594,0-8.318,3.723-8.318,8.318C347.86,128.477,351.584,132.2,356.178,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M242.5,212.606c0-4.595-3.724-8.318-8.318-8.318H56.734c-4.594,0-8.318,3.723-8.318,8.318%20s3.724,8.318,8.318,8.318h177.449C238.776,220.924,242.5,217.201,242.5,212.606z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M378.359,204.288h-99.815c-4.594,0-8.318,3.723-8.318,8.318s3.724,8.318,8.318,8.318h99.815%20c4.594,0,8.318-3.723,8.318-8.318S382.953,204.288,378.359,204.288z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M345.087,448.28H101.096c-4.594,0-8.318,3.723-8.318,8.318c0,4.595,3.724,8.318,8.318,8.318h243.992%20c4.594,0,8.318-3.723,8.318-8.318C353.405,452.003,349.681,448.28,345.087,448.28z'/%3e%3c/g%3e%3cpath%20style='fill:%23FE5022;'%20d='M163.689,357.337c-3.692,0-6.094-3.886-4.443-7.189l16.225-32.451%20c1.799-3.597,5.416-5.833,9.438-5.833h44.282v45.471h-65.503V357.337z'/%3e%3cpolygon%20style='fill:%23FFB656;'%20points='256.918,278.252%20211.447,300.988%20211.447,368.216%20256.918,390.953%20284.321,390.953%20284.321,278.214%20'/%3e%3cg%3e%3cpath%20style='fill:%23FE5022;'%20d='M268.64,401.7c-7.075,0-12.832-5.756-12.832-12.832V280.336c0-7.075,5.756-12.831,12.832-12.831%20h19.808c7.075,0,12.832,5.756,12.832,12.831v108.532c0,7.076-5.756,12.832-12.832,12.832H268.64z'/%3e%3cpath%20style='fill:%23FE5022;'%20d='M104.156,379.377H26.143V301.33h91.398c8.546,0,14.88,7.936,12.986,16.27l-11.313,49.758%20C117.615,374.388,111.366,379.377,104.156,379.377z'/%3e%3c/g%3e%3c/svg%3e`,Di=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2064%2064'%20xml:space='preserve'%3e%3cstyle%20type='text/css'%3e%20.st0{fill:%2376C2AF;}%20.st1{fill:%234F5D73;}%20.st2{opacity:0.2;}%20.st3{fill:%23231F20;}%20.st4{fill:%23FFFFFF;}%20%3c/style%3e%3cg%20id='Layer_1'%3e%3cg%3e%3ccircle%20class='st0'%20cx='32'%20cy='32'%20r='32'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M32,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C34,51.1,33.1,52,32,52L32,52z'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M46,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C48,51.1,47.1,52,46,52L46,52z'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M18,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C20,51.1,19.1,52,18,52L18,52z'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='45.9'%20cy='38'%20r='4'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='32'%20cy='27'%20r='4'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='18'%20cy='44'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='45.9'%20cy='36'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='32'%20cy='25'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='18'%20cy='42'%20r='4'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Layer_2'%3e%3c/g%3e%3c/svg%3e`;function Oi(){let e=(0,r.usePathname)(),n=(0,r.useRouter)(),{isAuthenticated:i,signIn:a,signOut:o}=G(),{newChat:c}=W(),{activeView:l,setActiveView:u,docsEnabled:f,requestFilesSidebar:p}=$r(),m=[{href:`/`,label:`Research`,icon:t.researchAgentUIConfig.appIconUrl},...f?[{href:`/workspace`,label:`Docs`,icon:(0,d.jsx)(F.default,{src:Ei,alt:`Docs`,width:24,height:24,unoptimized:!0,className:`w-full h-full`})}]:[]],h=e===`/`||e.startsWith(`/c`),g=[...m.map(({href:e,label:t,icon:n})=>({key:e,label:t,icon:n,active:e===`/`?l===`research`:l===`docs`,onClick:()=>{if(e===`/`){u(`research`),h&&c();return}u(`docs`)}})),...f?[{key:`files`,label:`Files`,icon:(0,d.jsx)(s.FileText,{className:`w-full h-full p-1`}),onClick:()=>{u(`docs`),p()}}]:[],{key:`settings`,label:`Settings`,icon:(0,d.jsx)(F.default,{src:Di,alt:`Settings`,width:24,height:24,unoptimized:!0,className:`w-full h-full`}),menu:{renderContent:()=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(P.DropdownMenuItem,{onClick:()=>vi(),className:`cursor-pointer py-1 h-7`,children:[(0,d.jsx)(s.Search,{className:`mr-2 h-3.5 w-3.5`}),(0,d.jsx)(`span`,{className:`text-sm`,children:`Search everything`}),(0,d.jsx)(`span`,{className:`ml-auto pl-3 text-[10px] text-muted-foreground`,children:`Ctrl Space`})]}),(0,d.jsxs)(P.DropdownMenuItem,{onClick:()=>{t.researchAgentUIConfig.onOpenSettings?.()||n.push(`/settings`)},className:`cursor-pointer py-1 h-7`,children:[(0,d.jsx)(s.Settings,{className:`mr-2 h-3.5 w-3.5`}),(0,d.jsx)(`span`,{className:`text-sm`,children:`Settings`})]}),i?(0,d.jsxs)(P.DropdownMenuItem,{onClick:()=>o(),className:`cursor-pointer py-1 h-7`,children:[(0,d.jsx)(s.LogOut,{className:`mr-2 h-3.5 w-3.5`}),(0,d.jsx)(`span`,{className:`text-sm`,children:`Logout`})]}):(0,d.jsxs)(P.DropdownMenuItem,{onClick:()=>a(),className:`cursor-pointer py-1 h-7`,children:[(0,d.jsx)(s.LogIn,{className:`mr-2 h-3.5 w-3.5`}),(0,d.jsx)(`span`,{className:`text-sm`,children:`Login`})]}),(0,d.jsx)(P.DropdownMenuSeparator,{}),(0,d.jsx)(P.ThemeMenu,{})]})}}],_=g.filter(e=>e.key!==`files`),v=(e,t,n)=>(0,d.jsx)(F.default,{src:e,alt:t,width:n,height:n,unoptimized:!0,className:`w-full h-full`});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(P.CategoryDock,{items:_,enableKeyboardShortcuts:!0,placements:{desktop:!0,mobile:!1},renderImage:v}),(0,d.jsx)(P.CategoryDock,{items:g,placements:{desktop:!1,mobile:!0},mobileAlign:l===`docs`?`end`:`center`,renderImage:v})]})}function ki(){let[e,r]=(0,n.useState)(!1),i=(0,n.useRef)(null);return(0,n.useEffect)(()=>{localStorage.getItem(`cookie-consent`)||r(!0)},[]),(0,n.useEffect)(()=>{let t=document.documentElement,n=i.current;if(!e||!n){t.style.removeProperty(`--qs-bottom-right-inset`);return}let r=()=>t.style.setProperty(`--qs-bottom-right-inset`,`${Math.ceil(n.getBoundingClientRect().height)+16}px`);r();let a=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return a?.observe(n),()=>{a?.disconnect(),t.style.removeProperty(`--qs-bottom-right-inset`)}},[e]),e?(0,d.jsx)(`div`,{className:`fixed bottom-0 right-0 m-4 max-w-sm z-50`,children:(0,d.jsxs)(`div`,{ref:i,className:`bg-light-secondary dark:bg-dark-secondary rounded-lg shadow-lg border border-light-tertiary dark:border-dark-tertiary p-4 space-y-3`,children:[(0,d.jsxs)(`div`,{className:`flex justify-between items-start gap-3`,children:[(0,d.jsxs)(`div`,{className:`flex-1`,children:[(0,d.jsx)(`h3`,{className:`font-semibold text-sm text-black dark:text-white mb-2`,children:`Cookies & Privacy`}),(0,d.jsxs)(`p`,{className:`text-xs text-black/70 dark:text-white/70 mb-3`,children:[t.researchAgentUIConfig.appName,` uses cookies to enhance your research experience, analyze usage patterns, and improve our service. We respect your privacy and only use essential cookies by default.`]}),(0,d.jsx)(`div`,{className:`flex flex-wrap gap-2 text-xs mb-3`,children:t.researchAgentUIConfig.footerLinks.map(e=>(0,d.jsx)(`a`,{href:e.url,target:e.url.startsWith(`/`)?void 0:`_blank`,rel:e.url.startsWith(`/`)?void 0:`noopener noreferrer`,className:`text-blue-600 dark:text-blue-400 hover:underline`,children:e.text},e.url))})]}),(0,d.jsx)(`button`,{onClick:()=>{r(!1)},className:`text-black/50 dark:text-white/50 hover:text-black dark:hover:text-white transition-colors`,"aria-label":`Close`,children:(0,d.jsx)(s.X,{className:`w-4 h-4`})})]}),(0,d.jsxs)(`div`,{className:`flex gap-2`,children:[(0,d.jsx)(Q,{onClick:()=>{localStorage.setItem(`cookie-consent`,JSON.stringify({analytics:!0,marketing:!0,functional:!0,timestamp:new Date().toISOString()})),r(!1)},size:`sm`,className:`flex-1 bg-blue-600 hover:bg-blue-700 text-white`,children:`Accept All`}),(0,d.jsx)(Q,{onClick:()=>{localStorage.setItem(`cookie-consent`,JSON.stringify({analytics:!1,marketing:!1,functional:!0,timestamp:new Date().toISOString()})),r(!1)},size:`sm`,variant:`outline`,className:`flex-1 bg-light-tertiary dark:bg-dark-tertiary text-black dark:text-white border-0 hover:bg-light-tertiary/80 dark:hover:bg-dark-tertiary/80`,children:`Reject`})]})]})}):null}var Ai=`qwk:chunk-error-reload`,ji=e=>typeof e==`string`&&/Loading (chunk|CSS chunk)|ChunkLoadError/i.test(e);function Mi(){(0,n.useEffect)(()=>{let e=e=>{ji(e)&&(sessionStorage.getItem(Ai)||(sessionStorage.setItem(Ai,`1`),window.location.reload()))},t=t=>e(t.message),n=t=>e(t.reason?.message??t.reason);return window.addEventListener(`error`,t),window.addEventListener(`unhandledrejection`,n),()=>{window.removeEventListener(`error`,t),window.removeEventListener(`unhandledrejection`,n)}},[])}var Ni=({children:e})=>(0,d.jsx)(d.Fragment,{children:e});function Pi(e){let[t,r]=(0,n.useState)(e===!0);return(0,n.useEffect)(()=>{if(e!==`auto`){r(e);return}let t=!1;return(0,p.default)(`auth/providers`).then(e=>{t||r(!!e.providers?.includes(`google`))}).catch(()=>{t||r(!1)}),()=>{t=!0}},[e]),t}function Fi({children:e,authClient:n,config:r,googleOneTap:i=`auto`,docsEnabled:a=!0,ChromeProvider:o=Ni,showDock:s=!0,showCookieConsent:c=!0,showToaster:l=!0,showSpotlight:u=!0}){r&&t.configureResearchAgentUI(r);let f=Pi(i);return Mi(),(0,d.jsx)(N.ThemeProvider,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,children:(0,d.jsx)(rt,{authClient:n,enableGoogleOneTap:f,children:(0,d.jsx)(ne,{children:(0,d.jsx)(it,{children:(0,d.jsx)(Xr,{docsEnabled:a,children:(0,d.jsx)(P.CategoryDockProvider,{children:(0,d.jsxs)(o,{children:[(0,d.jsxs)(`div`,{id:`app-scroll-root`,className:`w-screen h-screen overflow-y-auto overflow-x-hidden pb-[calc(60px+env(safe-area-inset-bottom,0px))] md:pb-0`,children:[s&&(0,d.jsx)(Oi,{}),(0,d.jsx)(`main`,{className:`bg-light-primary dark:bg-dark-primary min-h-screen`,children:e})]}),l&&(0,d.jsx)(m.Toaster,{toastOptions:{unstyled:!0,classNames:{toast:`bg-light-secondary dark:bg-dark-secondary dark:text-white/70 text-black-70 rounded-lg p-4 flex flex-row items-center space-x-2`}}}),c&&(0,d.jsx)(ki,{}),u&&(0,d.jsx)(xi,{})]})})})})})})})}function Ii(e){return(0,d.jsx)(Fi,{...e,docsEnabled:!1,children:(0,d.jsx)(qr,{})})}var Li=`qwksearch-open-chat-tabs`,Ri=50;function zi(){if(typeof window>`u`)return[];try{let e=window.localStorage.getItem(Li);return e?JSON.parse(e):[]}catch{return[]}}function Bi(){let{chatId:e,chatTurns:t,startNewChat:r,switchToChat:i}=W(),[a,o]=(0,n.useState)(zi);(0,n.useEffect)(()=>{window.localStorage.setItem(Li,JSON.stringify(a))},[a]),(0,n.useEffect)(()=>{if(!e)return;let n=t[0]?.content?.slice(0,Ri),r=t.length>0;o(t=>{let i=t.find(t=>t.id===e);return i?n&&i.title!==n||i.hasMessages!==r?t.map(t=>t.id===e?{...t,title:n||t.title,hasMessages:r}:t):t:[...t,{id:e,title:n||`New Chat`,hasMessages:r}]})},[e,t]);let s=(0,n.useCallback)((e,t)=>{let n=t.find(t=>t.id===e);n&&!n.hasMessages?r(e):i(e)},[r,i]),c=(0,n.useCallback)(e=>{s(e,a)},[s,a]),l=(0,n.useCallback)(()=>{let e=crypto.randomUUID();return o(t=>[...t,{id:e,title:`New Chat`}]),r(e),e},[r]),u=(0,n.useCallback)(t=>{let n=new Set(t),r=a.filter(e=>!n.has(e.id));o(r);let i=e!=null&&n.has(e);if(!i)return{closedWasActive:!1,nextActiveId:null};if(r.length===0)return{closedWasActive:i,nextActiveId:null};let c=a.findIndex(t=>t.id===e),l=e=>e!=null&&!n.has(e.id),u;for(let e=c-1;e>=0&&!u;e--)l(a[e])&&(u=a[e]);for(let e=c+1;e<a.length&&!u;e++)l(a[e])&&(u=a[e]);let d=(u??r[0]).id;return s(d,r),{closedWasActive:i,nextActiveId:d}},[a,e,s]),d=(0,n.useCallback)(e=>u([e]),[u]);return{chatTabs:a,activeChatId:e??null,openChat:c,newChat:l,closeChat:d,closeChats:u}}Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Qn}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return Kn}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return $r}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return ki}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Nr}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return wi}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return vi}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return ci}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Xr}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return ni}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Mi}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Jn}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return er}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Si}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return li}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Ii}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Oi}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return fi}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Fi}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Ti}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Bi}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return xi}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return qr}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return kr}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return Ir}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return ne}});
|
|
@@ -6969,14 +6969,21 @@ function so({ children: e, docsEnabled: t = !0 }) {
|
|
|
6969
6969
|
children: e
|
|
6970
6970
|
});
|
|
6971
6971
|
}
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6972
|
+
var co = Object.freeze({
|
|
6973
|
+
activeView: "research",
|
|
6974
|
+
setActiveView: () => {},
|
|
6975
|
+
docsEnabled: !1,
|
|
6976
|
+
toggleToDocs: () => {},
|
|
6977
|
+
toggleToResearch: () => {},
|
|
6978
|
+
filesSidebarRequestId: 0,
|
|
6979
|
+
requestFilesSidebar: () => {}
|
|
6980
|
+
}), lo = !1;
|
|
6981
|
+
function uo() {
|
|
6982
|
+
return l(ao) || (!lo && process.env.NODE_ENV !== "production" && (lo = !0, console.error("useMainView was called outside a MainViewProvider. The component is rendering with view switching disabled — mount it inside MainViewProvider (see QwkSearchProviders).")), co);
|
|
6976
6983
|
}
|
|
6977
6984
|
//#endregion
|
|
6978
6985
|
//#region src/settings/sections.json
|
|
6979
|
-
var
|
|
6986
|
+
var fo = [
|
|
6980
6987
|
{
|
|
6981
6988
|
key: "account",
|
|
6982
6989
|
name: "Account",
|
|
@@ -7040,7 +7047,7 @@ var lo = [
|
|
|
7040
7047
|
icon: "Volume2",
|
|
7041
7048
|
dataAdd: "voice"
|
|
7042
7049
|
}
|
|
7043
|
-
],
|
|
7050
|
+
], po = [
|
|
7044
7051
|
{
|
|
7045
7052
|
key: "webSearch",
|
|
7046
7053
|
title: "All",
|
|
@@ -7077,7 +7084,7 @@ var lo = [
|
|
|
7077
7084
|
description: "Search for discussions and opinions",
|
|
7078
7085
|
icon: /* @__PURE__ */ W(Wt, { className: "h-[16px] w-auto mr-0.5" })
|
|
7079
7086
|
}
|
|
7080
|
-
],
|
|
7087
|
+
], mo = [
|
|
7081
7088
|
{
|
|
7082
7089
|
href: "/",
|
|
7083
7090
|
label: "Research",
|
|
@@ -7136,9 +7143,9 @@ var lo = [
|
|
|
7136
7143
|
];
|
|
7137
7144
|
//#endregion
|
|
7138
7145
|
//#region src/components/SpotlightPalette/spotlightItems.ts
|
|
7139
|
-
function
|
|
7146
|
+
function ho(e) {
|
|
7140
7147
|
let t = (e) => e === "/" ? ke : e === "/workspace" ? V : e === "/settings" ? Ae : e === "/docs" ? O : ge;
|
|
7141
|
-
return
|
|
7148
|
+
return mo.filter((t) => !t.docsOnly || e.docsEnabled).map((n) => ({
|
|
7142
7149
|
id: `page:${n.href}`,
|
|
7143
7150
|
source: "page",
|
|
7144
7151
|
name: n.label,
|
|
@@ -7148,7 +7155,7 @@ function po(e) {
|
|
|
7148
7155
|
run: () => e.navigate(n.href)
|
|
7149
7156
|
}));
|
|
7150
7157
|
}
|
|
7151
|
-
function
|
|
7158
|
+
function go(e, t) {
|
|
7152
7159
|
let n = /* @__PURE__ */ new Date();
|
|
7153
7160
|
return e.map((e) => ({
|
|
7154
7161
|
id: `chat:${e.id}`,
|
|
@@ -7161,8 +7168,8 @@ function mo(e, t) {
|
|
|
7161
7168
|
run: () => t.openChat(e.id)
|
|
7162
7169
|
}));
|
|
7163
7170
|
}
|
|
7164
|
-
function
|
|
7165
|
-
return
|
|
7171
|
+
function _o(e) {
|
|
7172
|
+
return fo.map((t) => ({
|
|
7166
7173
|
id: `setting:${t.key}`,
|
|
7167
7174
|
source: "setting",
|
|
7168
7175
|
name: t.name,
|
|
@@ -7172,7 +7179,7 @@ function ho(e) {
|
|
|
7172
7179
|
run: () => e.openSettings(t.key)
|
|
7173
7180
|
}));
|
|
7174
7181
|
}
|
|
7175
|
-
function
|
|
7182
|
+
function vo(e) {
|
|
7176
7183
|
let t = [
|
|
7177
7184
|
{
|
|
7178
7185
|
id: "action:new-chat",
|
|
@@ -7203,7 +7210,7 @@ function go(e) {
|
|
|
7203
7210
|
run: () => e.setIncognito(!e.incognito)
|
|
7204
7211
|
}
|
|
7205
7212
|
];
|
|
7206
|
-
for (let n of
|
|
7213
|
+
for (let n of po) t.push({
|
|
7207
7214
|
id: `action:focus:${n.key}`,
|
|
7208
7215
|
source: "action",
|
|
7209
7216
|
name: `Focus: ${n.title}`,
|
|
@@ -7257,7 +7264,7 @@ function go(e) {
|
|
|
7257
7264
|
run: e.signIn
|
|
7258
7265
|
}), t;
|
|
7259
7266
|
}
|
|
7260
|
-
function
|
|
7267
|
+
function yo(e, t) {
|
|
7261
7268
|
let n = e.trim();
|
|
7262
7269
|
return n ? {
|
|
7263
7270
|
id: "search:ask",
|
|
@@ -7271,7 +7278,7 @@ function _o(e, t) {
|
|
|
7271
7278
|
}
|
|
7272
7279
|
//#endregion
|
|
7273
7280
|
//#region src/components/SpotlightPalette/spotlightMatch.ts
|
|
7274
|
-
var
|
|
7281
|
+
var bo = [
|
|
7275
7282
|
{
|
|
7276
7283
|
prefix: "c",
|
|
7277
7284
|
source: "chat",
|
|
@@ -7298,10 +7305,10 @@ var vo = [
|
|
|
7298
7305
|
label: "web"
|
|
7299
7306
|
}
|
|
7300
7307
|
];
|
|
7301
|
-
function
|
|
7308
|
+
function xo(e) {
|
|
7302
7309
|
let t = e.match(/^([a-zA-Z])\s+(.*)$/);
|
|
7303
7310
|
if (t) {
|
|
7304
|
-
let e = t[1].toLowerCase(), n =
|
|
7311
|
+
let e = t[1].toLowerCase(), n = bo.find((t) => t.prefix === e);
|
|
7305
7312
|
if (n) return {
|
|
7306
7313
|
prefix: n.prefix,
|
|
7307
7314
|
query: t[2]
|
|
@@ -7312,11 +7319,11 @@ function yo(e) {
|
|
|
7312
7319
|
query: e
|
|
7313
7320
|
};
|
|
7314
7321
|
}
|
|
7315
|
-
var
|
|
7316
|
-
function
|
|
7322
|
+
var So = 18;
|
|
7323
|
+
function Co(e) {
|
|
7317
7324
|
return `${e.meta ?? ""} ${e.keywords ?? ""}`.toLowerCase();
|
|
7318
7325
|
}
|
|
7319
|
-
function
|
|
7326
|
+
function wo(e, t) {
|
|
7320
7327
|
let n = t.toLowerCase().split(/\s+/).filter(Boolean);
|
|
7321
7328
|
if (n.length === 0) return e.map((e) => ({
|
|
7322
7329
|
item: e,
|
|
@@ -7328,7 +7335,7 @@ function So(e, t) {
|
|
|
7328
7335
|
let e = t.name.toLowerCase();
|
|
7329
7336
|
if (n.every((t) => e.includes(t))) r.push(t);
|
|
7330
7337
|
else {
|
|
7331
|
-
let r = `${e} ${
|
|
7338
|
+
let r = `${e} ${Co(t)}`;
|
|
7332
7339
|
n.every((e) => r.includes(e)) && i.push(t);
|
|
7333
7340
|
}
|
|
7334
7341
|
}
|
|
@@ -7340,33 +7347,33 @@ function So(e, t) {
|
|
|
7340
7347
|
})), ...i.map((e) => ({
|
|
7341
7348
|
item: e,
|
|
7342
7349
|
matchedName: !1,
|
|
7343
|
-
snippet: Co(
|
|
7350
|
+
snippet: To(Co(e), a)
|
|
7344
7351
|
}))];
|
|
7345
7352
|
}
|
|
7346
|
-
function
|
|
7353
|
+
function To(e, t) {
|
|
7347
7354
|
let n = e.indexOf(t);
|
|
7348
7355
|
if (n < 0) return "";
|
|
7349
|
-
let r = Math.max(0, n -
|
|
7356
|
+
let r = Math.max(0, n - So), i = Math.min(e.length, n + t.length + So), a = e.slice(r, i).replace(/\s+/g, " ").trim();
|
|
7350
7357
|
return r > 0 && (a = "…" + a), i < e.length && (a += "…"), a;
|
|
7351
7358
|
}
|
|
7352
7359
|
//#endregion
|
|
7353
7360
|
//#region src/components/SpotlightPalette/SpotlightPalette.tsx
|
|
7354
|
-
var
|
|
7355
|
-
function
|
|
7356
|
-
typeof window > "u" || window.dispatchEvent(new Event(
|
|
7361
|
+
var Eo = "qwksearch:open-spotlight", Do = 100, Oo = 6, ko = 40;
|
|
7362
|
+
function Ao() {
|
|
7363
|
+
typeof window > "u" || window.dispatchEvent(new Event(Eo));
|
|
7357
7364
|
}
|
|
7358
|
-
function
|
|
7365
|
+
function jo(e) {
|
|
7359
7366
|
return e.ctrlKey && !e.metaKey && !e.altKey && (e.code === "Space" || e.key === " ");
|
|
7360
7367
|
}
|
|
7361
|
-
var
|
|
7368
|
+
var Mo = {
|
|
7362
7369
|
search: "ask",
|
|
7363
7370
|
chat: "chat",
|
|
7364
7371
|
page: "page",
|
|
7365
7372
|
setting: "setting",
|
|
7366
7373
|
action: "action"
|
|
7367
7374
|
};
|
|
7368
|
-
function
|
|
7369
|
-
let [e, n] = p(!1), [r, i] = p(""), [a, o] = p(0), s = g(), l = Y(), { isAuthenticated: m, signIn: h, signOut: _ } = dr(), { docsEnabled: v, setActiveView: y, requestFilesSidebar: b } =
|
|
7375
|
+
function No() {
|
|
7376
|
+
let [e, n] = p(!1), [r, i] = p(""), [a, o] = p(0), s = g(), l = Y(), { isAuthenticated: m, signIn: h, signOut: _ } = dr(), { docsEnabled: v, setActiveView: y, requestFilesSidebar: b } = uo(), { recentChats: x, load: S } = Ui(Do), C = f(null), w = f(null), T = f(null), E = c(() => n(!1), []), D = f(S);
|
|
7370
7377
|
u(() => {
|
|
7371
7378
|
D.current = S;
|
|
7372
7379
|
}, [S]);
|
|
@@ -7406,30 +7413,30 @@ function jo() {
|
|
|
7406
7413
|
v,
|
|
7407
7414
|
y,
|
|
7408
7415
|
b
|
|
7409
|
-
]), { prefix: k, query: A } =
|
|
7410
|
-
chat:
|
|
7411
|
-
page:
|
|
7412
|
-
setting:
|
|
7413
|
-
action:
|
|
7416
|
+
]), { prefix: k, query: A } = xo(r), j = A.trim(), M = d(() => ({
|
|
7417
|
+
chat: go(x, O),
|
|
7418
|
+
page: ho(O),
|
|
7419
|
+
setting: _o(O),
|
|
7420
|
+
action: vo(O)
|
|
7414
7421
|
}), [x, O]), N = d(() => {
|
|
7415
|
-
let e =
|
|
7422
|
+
let e = yo(A, O);
|
|
7416
7423
|
if (k === "w") return e ? [e] : [];
|
|
7417
7424
|
if (k) {
|
|
7418
|
-
let e =
|
|
7419
|
-
return
|
|
7425
|
+
let e = bo.find((e) => e.prefix === k).source;
|
|
7426
|
+
return wo(M[e], A).map((e) => e.item).slice(0, ko);
|
|
7420
7427
|
}
|
|
7421
7428
|
if (!j) return [
|
|
7422
|
-
...M.chat.slice(0,
|
|
7429
|
+
...M.chat.slice(0, Oo),
|
|
7423
7430
|
...M.action,
|
|
7424
7431
|
...M.page
|
|
7425
|
-
].slice(0,
|
|
7426
|
-
let t =
|
|
7432
|
+
].slice(0, ko);
|
|
7433
|
+
let t = wo([
|
|
7427
7434
|
...M.action,
|
|
7428
7435
|
...M.page,
|
|
7429
7436
|
...M.setting,
|
|
7430
7437
|
...M.chat
|
|
7431
7438
|
], A).map((e) => e.item);
|
|
7432
|
-
return [...e ? [e] : [], ...t].slice(0,
|
|
7439
|
+
return [...e ? [e] : [], ...t].slice(0, ko);
|
|
7433
7440
|
}, [
|
|
7434
7441
|
k,
|
|
7435
7442
|
A,
|
|
@@ -7439,10 +7446,10 @@ function jo() {
|
|
|
7439
7446
|
]);
|
|
7440
7447
|
u(() => {
|
|
7441
7448
|
let e = (e) => {
|
|
7442
|
-
|
|
7449
|
+
jo(e) && (e.preventDefault(), n((e) => !e));
|
|
7443
7450
|
}, t = () => n(!0);
|
|
7444
|
-
return window.addEventListener("keydown", e), window.addEventListener(
|
|
7445
|
-
window.removeEventListener("keydown", e), window.removeEventListener(
|
|
7451
|
+
return window.addEventListener("keydown", e), window.addEventListener(Eo, t), () => {
|
|
7452
|
+
window.removeEventListener("keydown", e), window.removeEventListener(Eo, t);
|
|
7446
7453
|
};
|
|
7447
7454
|
}, []), u(() => {
|
|
7448
7455
|
if (!e) {
|
|
@@ -7464,7 +7471,7 @@ function jo() {
|
|
|
7464
7471
|
let P = c((e) => {
|
|
7465
7472
|
e && (E(), e.run());
|
|
7466
7473
|
}, [E]), F = c(() => {
|
|
7467
|
-
let e =
|
|
7474
|
+
let e = bo.map((e) => e.prefix), t = e[((k ? e.indexOf(k) : -1) + 1) % e.length];
|
|
7468
7475
|
i(`${t} ${A}`), o(0);
|
|
7469
7476
|
}, [k, A]), I = (e) => {
|
|
7470
7477
|
switch (e.key) {
|
|
@@ -7484,7 +7491,7 @@ function jo() {
|
|
|
7484
7491
|
}
|
|
7485
7492
|
};
|
|
7486
7493
|
if (!e) return null;
|
|
7487
|
-
let L = k ?
|
|
7494
|
+
let L = k ? bo.find((e) => e.prefix === k) : null;
|
|
7488
7495
|
return /* @__PURE__ */ W("div", {
|
|
7489
7496
|
className: "fixed inset-0 z-[10000] flex items-start justify-center bg-black/40 backdrop-blur-[2px] px-4 pt-[12vh]",
|
|
7490
7497
|
role: "presentation",
|
|
@@ -7566,7 +7573,7 @@ function jo() {
|
|
|
7566
7573
|
}),
|
|
7567
7574
|
/* @__PURE__ */ W("span", {
|
|
7568
7575
|
className: "shrink-0 rounded-md bg-secondary px-1.5 py-0 text-[10px] text-muted-foreground",
|
|
7569
|
-
children:
|
|
7576
|
+
children: Mo[e.source]
|
|
7570
7577
|
})
|
|
7571
7578
|
]
|
|
7572
7579
|
}, e.id);
|
|
@@ -7581,7 +7588,7 @@ function jo() {
|
|
|
7581
7588
|
/* @__PURE__ */ W("span", { children: "esc close" }),
|
|
7582
7589
|
/* @__PURE__ */ W("span", {
|
|
7583
7590
|
className: "ml-auto",
|
|
7584
|
-
children:
|
|
7591
|
+
children: bo.map((e) => `${e.prefix} ${e.label}`).join(" · ")
|
|
7585
7592
|
})
|
|
7586
7593
|
]
|
|
7587
7594
|
})
|
|
@@ -7591,7 +7598,7 @@ function jo() {
|
|
|
7591
7598
|
}
|
|
7592
7599
|
//#endregion
|
|
7593
7600
|
//#region src/hooks/voice/useKokoroTTS.ts
|
|
7594
|
-
function
|
|
7601
|
+
function Po(e, t) {
|
|
7595
7602
|
let [n, r] = p("idle"), [i, a] = p(!1), [o, s] = p([]), [l, d] = p("af_heart"), [m, h] = p(null), g = f(null), _ = f(null);
|
|
7596
7603
|
u(() => {
|
|
7597
7604
|
t?.autoPreload && !i && y();
|
|
@@ -7660,7 +7667,7 @@ function Mo(e, t) {
|
|
|
7660
7667
|
}
|
|
7661
7668
|
//#endregion
|
|
7662
7669
|
//#region src/components/VoiceSettings/KokoroVoiceSelector.tsx
|
|
7663
|
-
var
|
|
7670
|
+
var Fo = {
|
|
7664
7671
|
af_heart: "American Female - Heart",
|
|
7665
7672
|
af_bella: "American Female - Bella",
|
|
7666
7673
|
af_nicole: "American Female - Nicole",
|
|
@@ -7672,8 +7679,8 @@ var No = {
|
|
|
7672
7679
|
bm_george: "British Male - George",
|
|
7673
7680
|
bm_thomas: "British Male - Thomas"
|
|
7674
7681
|
};
|
|
7675
|
-
function
|
|
7676
|
-
let { status: t, modelReady: n, voices: r, selectedVoice: i, error: a, warmupModel: o, changeVoice: s, backend: c } =
|
|
7682
|
+
function Io({ preloadOnMount: e = !1 }) {
|
|
7683
|
+
let { status: t, modelReady: n, voices: r, selectedVoice: i, error: a, warmupModel: o, changeVoice: s, backend: c } = Po("", { autoPreload: e }), [l, u] = p(!1), d = t === "loading", f = t === "error";
|
|
7677
7684
|
return /* @__PURE__ */ G("div", {
|
|
7678
7685
|
className: "flex flex-col gap-3",
|
|
7679
7686
|
children: [/* @__PURE__ */ G("div", {
|
|
@@ -7722,7 +7729,7 @@ function Po({ preloadOnMount: e = !1 }) {
|
|
|
7722
7729
|
className: "w-full text-left px-3 py-2 rounded-md bg-white/5 dark:bg-black/5 hover:bg-white/10 dark:hover:bg-black/10 transition text-sm font-medium",
|
|
7723
7730
|
children: /* @__PURE__ */ G("div", {
|
|
7724
7731
|
className: "flex items-center gap-2",
|
|
7725
|
-
children: [/* @__PURE__ */ W(Ge, { size: 16 }),
|
|
7732
|
+
children: [/* @__PURE__ */ W(Ge, { size: 16 }), Fo[i] || i]
|
|
7726
7733
|
})
|
|
7727
7734
|
}), l && /* @__PURE__ */ W("div", {
|
|
7728
7735
|
className: "grid grid-cols-2 gap-2 p-2 bg-white/5 dark:bg-black/5 rounded-md max-h-64 overflow-y-auto",
|
|
@@ -7731,7 +7738,7 @@ function Po({ preloadOnMount: e = !1 }) {
|
|
|
7731
7738
|
s(e), u(!1);
|
|
7732
7739
|
},
|
|
7733
7740
|
className: J("p-2 text-left text-sm rounded transition duration-200", i === e ? "bg-blue-500/20 text-blue-600 dark:text-blue-400 font-medium" : "bg-white/5 dark:bg-black/5 text-foreground hover:bg-white/10 dark:hover:bg-black/10"),
|
|
7734
|
-
children:
|
|
7741
|
+
children: Fo[e] || e
|
|
7735
7742
|
}, e))
|
|
7736
7743
|
})]
|
|
7737
7744
|
})]
|
|
@@ -7739,7 +7746,7 @@ function Po({ preloadOnMount: e = !1 }) {
|
|
|
7739
7746
|
}
|
|
7740
7747
|
//#endregion
|
|
7741
7748
|
//#region src/components/VoiceSettings/VoiceSettingsPanel.tsx
|
|
7742
|
-
function
|
|
7749
|
+
function Lo() {
|
|
7743
7750
|
let [e, t] = p(!1), [n, r] = p(() => localStorage.getItem("useTTSKokoro") !== "false"), [i, a] = p(() => localStorage.getItem("ttsSpeaker") || "angus"), [o, s] = p(() => Ci()), { start: c, speechStatus: l } = Vn("This is a preview of the selected voice.", { enableInterrupt: !1 }), u = (e) => {
|
|
7744
7751
|
r(e), localStorage.setItem("useTTSKokoro", String(e));
|
|
7745
7752
|
}, d = (e) => {
|
|
@@ -7792,7 +7799,7 @@ function Fo() {
|
|
|
7792
7799
|
children: "Runs locally in your browser. No server requests, lower latency, and multiple voice options."
|
|
7793
7800
|
})] })
|
|
7794
7801
|
]
|
|
7795
|
-
}), n && /* @__PURE__ */ W(
|
|
7802
|
+
}), n && /* @__PURE__ */ W(Io, { preloadOnMount: !1 })]
|
|
7796
7803
|
}),
|
|
7797
7804
|
/* @__PURE__ */ G("div", {
|
|
7798
7805
|
className: "space-y-2",
|
|
@@ -7892,11 +7899,11 @@ function Fo() {
|
|
|
7892
7899
|
}
|
|
7893
7900
|
//#endregion
|
|
7894
7901
|
//#region src/icons/icon-read.svg
|
|
7895
|
-
var
|
|
7902
|
+
var Ro = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20512%20512'%20xml:space='preserve'%3e%3cpath%20style='fill:%23FE5022;'%20d='M438.802,390.609V278.595h55.174c9.938,0,18.023,8.085,18.023,18.023v75.967%20c0,9.938-8.086,18.024-18.023,18.024L438.802,390.609L438.802,390.609z'/%3e%3cpath%20style='fill:%23ECE5DD;'%20d='M28.107,511.637C12.609,511.637,0,499.027,0,483.529V134.326c0-1.441,0-12.123,0-12.123%20L121.715,0.363c0,0,10.8,0,12.248,0h271.569c15.498,0,28.107,12.609,28.107,28.106v455.059c0,15.499-12.609,28.108-28.107,28.108%20H28.107V511.637z'/%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M405.533,0.363h-31.991c15.498,0,28.107,12.609,28.107,28.107v455.059%20c0,15.499-12.609,28.108-28.107,28.108h31.991c15.498,0,28.107-12.609,28.107-28.108V28.469%20C433.64,12.972,421.031,0.363,405.533,0.363z'/%3e%3cg%3e%3cpath%20style='fill:%23BABABA;'%20d='M167.639,132.2h133.086c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318H167.639%20c-4.594,0-8.318,3.723-8.318,8.318C159.321,128.477,163.045,132.2,167.639,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M356.178,132.2h22.181c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318h-22.181%20c-4.594,0-8.318,3.723-8.318,8.318C347.86,128.477,351.584,132.2,356.178,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M242.5,212.606c0-4.595-3.724-8.318-8.318-8.318H56.734c-4.594,0-8.318,3.723-8.318,8.318%20s3.724,8.318,8.318,8.318h177.449C238.776,220.924,242.5,217.201,242.5,212.606z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M378.359,204.288h-99.815c-4.594,0-8.318,3.723-8.318,8.318s3.724,8.318,8.318,8.318h99.815%20c4.594,0,8.318-3.723,8.318-8.318S382.953,204.288,378.359,204.288z'/%3e%3c/g%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M0.726,123.171L122.442,1.331l1.39,105.939c0,9.465-7.7,17.166-17.166,17.166L0.726,123.171z'/%3e%3cpath%20style='fill:%23FFB656;'%20d='M270.226,401.7V267.504H456.87c5.938,0,10.768,4.83,10.768,10.768v112.659%20c0,5.938-4.83,10.769-10.768,10.769H270.226z'/%3e%3cpath%20style='fill:%23D9CBBD;'%20d='M367.785,335.156c-12.822,0-23.252-10.431-23.252-23.254v-44.399h89.833v44.399%20c0,12.823-10.431,23.254-23.252,23.254H367.785z'/%3e%3cg%3e%3cpath%20style='fill:%23BABABA;'%20d='M167.639,132.2h133.086c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318H167.639%20c-4.594,0-8.318,3.723-8.318,8.318C159.321,128.477,163.045,132.2,167.639,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M356.178,132.2h22.181c4.594,0,8.318-3.723,8.318-8.318c0-4.595-3.724-8.318-8.318-8.318h-22.181%20c-4.594,0-8.318,3.723-8.318,8.318C347.86,128.477,351.584,132.2,356.178,132.2z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M242.5,212.606c0-4.595-3.724-8.318-8.318-8.318H56.734c-4.594,0-8.318,3.723-8.318,8.318%20s3.724,8.318,8.318,8.318h177.449C238.776,220.924,242.5,217.201,242.5,212.606z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M378.359,204.288h-99.815c-4.594,0-8.318,3.723-8.318,8.318s3.724,8.318,8.318,8.318h99.815%20c4.594,0,8.318-3.723,8.318-8.318S382.953,204.288,378.359,204.288z'/%3e%3cpath%20style='fill:%23BABABA;'%20d='M345.087,448.28H101.096c-4.594,0-8.318,3.723-8.318,8.318c0,4.595,3.724,8.318,8.318,8.318h243.992%20c4.594,0,8.318-3.723,8.318-8.318C353.405,452.003,349.681,448.28,345.087,448.28z'/%3e%3c/g%3e%3cpath%20style='fill:%23FE5022;'%20d='M163.689,357.337c-3.692,0-6.094-3.886-4.443-7.189l16.225-32.451%20c1.799-3.597,5.416-5.833,9.438-5.833h44.282v45.471h-65.503V357.337z'/%3e%3cpolygon%20style='fill:%23FFB656;'%20points='256.918,278.252%20211.447,300.988%20211.447,368.216%20256.918,390.953%20284.321,390.953%20284.321,278.214%20'/%3e%3cg%3e%3cpath%20style='fill:%23FE5022;'%20d='M268.64,401.7c-7.075,0-12.832-5.756-12.832-12.832V280.336c0-7.075,5.756-12.831,12.832-12.831%20h19.808c7.075,0,12.832,5.756,12.832,12.831v108.532c0,7.076-5.756,12.832-12.832,12.832H268.64z'/%3e%3cpath%20style='fill:%23FE5022;'%20d='M104.156,379.377H26.143V301.33h91.398c8.546,0,14.88,7.936,12.986,16.27l-11.313,49.758%20C117.615,374.388,111.366,379.377,104.156,379.377z'/%3e%3c/g%3e%3c/svg%3e", zo = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20height='800px'%20width='800px'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2064%2064'%20xml:space='preserve'%3e%3cstyle%20type='text/css'%3e%20.st0{fill:%2376C2AF;}%20.st1{fill:%234F5D73;}%20.st2{opacity:0.2;}%20.st3{fill:%23231F20;}%20.st4{fill:%23FFFFFF;}%20%3c/style%3e%3cg%20id='Layer_1'%3e%3cg%3e%3ccircle%20class='st0'%20cx='32'%20cy='32'%20r='32'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M32,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C34,51.1,33.1,52,32,52L32,52z'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M46,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C48,51.1,47.1,52,46,52L46,52z'/%3e%3c/g%3e%3cg%3e%3cpath%20class='st1'%20d='M18,52c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2l0,0c1.1,0,2,0.9,2,2v32C20,51.1,19.1,52,18,52L18,52z'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='45.9'%20cy='38'%20r='4'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='32'%20cy='27'%20r='4'/%3e%3c/g%3e%3cg%20class='st2'%3e%3ccircle%20class='st3'%20cx='18'%20cy='44'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='45.9'%20cy='36'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='32'%20cy='25'%20r='4'/%3e%3c/g%3e%3cg%3e%3ccircle%20class='st4'%20cx='18'%20cy='42'%20r='4'/%3e%3c/g%3e%3c/g%3e%3cg%20id='Layer_2'%3e%3c/g%3e%3c/svg%3e";
|
|
7896
7903
|
//#endregion
|
|
7897
7904
|
//#region src/app/CategoryDock.tsx
|
|
7898
|
-
function
|
|
7899
|
-
let e = h(), n = g(), { isAuthenticated: r, signIn: i, signOut: a } = dr(), { newChat: o } = Y(), { activeView: s, setActiveView: c, docsEnabled: l, requestFilesSidebar: u } =
|
|
7905
|
+
function Bo() {
|
|
7906
|
+
let e = h(), n = g(), { isAuthenticated: r, signIn: i, signOut: a } = dr(), { newChat: o } = Y(), { activeView: s, setActiveView: c, docsEnabled: l, requestFilesSidebar: u } = uo(), d = [{
|
|
7900
7907
|
href: "/",
|
|
7901
7908
|
label: "Research",
|
|
7902
7909
|
icon: t.appIconUrl
|
|
@@ -7904,7 +7911,7 @@ function Ro() {
|
|
|
7904
7911
|
href: "/workspace",
|
|
7905
7912
|
label: "Docs",
|
|
7906
7913
|
icon: /* @__PURE__ */ W(Qt, {
|
|
7907
|
-
src:
|
|
7914
|
+
src: Ro,
|
|
7908
7915
|
alt: "Docs",
|
|
7909
7916
|
width: 24,
|
|
7910
7917
|
height: 24,
|
|
@@ -7937,7 +7944,7 @@ function Ro() {
|
|
|
7937
7944
|
key: "settings",
|
|
7938
7945
|
label: "Settings",
|
|
7939
7946
|
icon: /* @__PURE__ */ W(Qt, {
|
|
7940
|
-
src:
|
|
7947
|
+
src: zo,
|
|
7941
7948
|
alt: "Settings",
|
|
7942
7949
|
width: 24,
|
|
7943
7950
|
height: 24,
|
|
@@ -7946,7 +7953,7 @@ function Ro() {
|
|
|
7946
7953
|
}),
|
|
7947
7954
|
menu: { renderContent: () => /* @__PURE__ */ G(U, { children: [
|
|
7948
7955
|
/* @__PURE__ */ G(Yt, {
|
|
7949
|
-
onClick: () =>
|
|
7956
|
+
onClick: () => Ao(),
|
|
7950
7957
|
className: "cursor-pointer py-1 h-7",
|
|
7951
7958
|
children: [
|
|
7952
7959
|
/* @__PURE__ */ W(ke, { className: "mr-2 h-3.5 w-3.5" }),
|
|
@@ -8017,7 +8024,7 @@ function Ro() {
|
|
|
8017
8024
|
}
|
|
8018
8025
|
//#endregion
|
|
8019
8026
|
//#region src/app/CookieConsent.tsx
|
|
8020
|
-
function
|
|
8027
|
+
function Vo() {
|
|
8021
8028
|
let [e, n] = p(!1), r = f(null);
|
|
8022
8029
|
return u(() => {
|
|
8023
8030
|
localStorage.getItem("cookie-consent") || n(!0);
|
|
@@ -8104,11 +8111,11 @@ function zo() {
|
|
|
8104
8111
|
}
|
|
8105
8112
|
//#endregion
|
|
8106
8113
|
//#region src/app/useChunkErrorReload.ts
|
|
8107
|
-
var
|
|
8108
|
-
function
|
|
8114
|
+
var Ho = "qwk:chunk-error-reload", Uo = (e) => typeof e == "string" && /Loading (chunk|CSS chunk)|ChunkLoadError/i.test(e);
|
|
8115
|
+
function Wo() {
|
|
8109
8116
|
u(() => {
|
|
8110
8117
|
let e = (e) => {
|
|
8111
|
-
|
|
8118
|
+
Uo(e) && (sessionStorage.getItem(Ho) || (sessionStorage.setItem(Ho, "1"), window.location.reload()));
|
|
8112
8119
|
}, t = (t) => e(t.message), n = (t) => e(t.reason?.message ?? t.reason);
|
|
8113
8120
|
return window.addEventListener("error", t), window.addEventListener("unhandledrejection", n), () => {
|
|
8114
8121
|
window.removeEventListener("error", t), window.removeEventListener("unhandledrejection", n);
|
|
@@ -8117,8 +8124,8 @@ function Ho() {
|
|
|
8117
8124
|
}
|
|
8118
8125
|
//#endregion
|
|
8119
8126
|
//#region src/app/QwkSearchProviders.tsx
|
|
8120
|
-
var
|
|
8121
|
-
function
|
|
8127
|
+
var Go = ({ children: e }) => /* @__PURE__ */ W(U, { children: e });
|
|
8128
|
+
function Ko(e) {
|
|
8122
8129
|
let [t, n] = p(e === !0);
|
|
8123
8130
|
return u(() => {
|
|
8124
8131
|
if (e !== "auto") {
|
|
@@ -8135,10 +8142,10 @@ function Wo(e) {
|
|
|
8135
8142
|
};
|
|
8136
8143
|
}, [e]), t;
|
|
8137
8144
|
}
|
|
8138
|
-
function
|
|
8145
|
+
function qo({ children: t, authClient: n, config: r, googleOneTap: i = "auto", docsEnabled: a = !0, ChromeProvider: o = Go, showDock: s = !0, showCookieConsent: c = !0, showToaster: l = !0, showSpotlight: u = !0 }) {
|
|
8139
8146
|
r && e(r);
|
|
8140
|
-
let d =
|
|
8141
|
-
return
|
|
8147
|
+
let d = Ko(i);
|
|
8148
|
+
return Wo(), /* @__PURE__ */ W(Kt, {
|
|
8142
8149
|
attribute: "class",
|
|
8143
8150
|
defaultTheme: "system",
|
|
8144
8151
|
enableSystem: !0,
|
|
@@ -8146,32 +8153,32 @@ function Go({ children: t, authClient: n, config: r, googleOneTap: i = "auto", d
|
|
|
8146
8153
|
children: /* @__PURE__ */ W(ur, {
|
|
8147
8154
|
authClient: n,
|
|
8148
8155
|
enableGoogleOneTap: d,
|
|
8149
|
-
children: /* @__PURE__ */ W(an, { children: /* @__PURE__ */
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8156
|
+
children: /* @__PURE__ */ W(an, { children: /* @__PURE__ */ W(fr, { children: /* @__PURE__ */ W(so, {
|
|
8157
|
+
docsEnabled: a,
|
|
8158
|
+
children: /* @__PURE__ */ W(Jt, { children: /* @__PURE__ */ G(o, { children: [
|
|
8159
|
+
/* @__PURE__ */ G("div", {
|
|
8153
8160
|
id: "app-scroll-root",
|
|
8154
8161
|
className: "w-screen h-screen overflow-y-auto overflow-x-hidden pb-[calc(60px+env(safe-area-inset-bottom,0px))] md:pb-0",
|
|
8155
|
-
children: [s && /* @__PURE__ */ W(
|
|
8162
|
+
children: [s && /* @__PURE__ */ W(Bo, {}), /* @__PURE__ */ W("main", {
|
|
8156
8163
|
className: "bg-light-primary dark:bg-dark-primary min-h-screen",
|
|
8157
8164
|
children: t
|
|
8158
8165
|
})]
|
|
8159
|
-
})
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8166
|
+
}),
|
|
8167
|
+
l && /* @__PURE__ */ W(Dt, { toastOptions: {
|
|
8168
|
+
unstyled: !0,
|
|
8169
|
+
classNames: { toast: "bg-light-secondary dark:bg-dark-secondary dark:text-white/70 text-black-70 rounded-lg p-4 flex flex-row items-center space-x-2" }
|
|
8170
|
+
} }),
|
|
8171
|
+
c && /* @__PURE__ */ W(Vo, {}),
|
|
8172
|
+
u && /* @__PURE__ */ W(No, {})
|
|
8173
|
+
] }) })
|
|
8174
|
+
}) }) })
|
|
8168
8175
|
})
|
|
8169
8176
|
});
|
|
8170
8177
|
}
|
|
8171
8178
|
//#endregion
|
|
8172
8179
|
//#region src/app/QwkSearchApp.tsx
|
|
8173
|
-
function
|
|
8174
|
-
return /* @__PURE__ */ W(
|
|
8180
|
+
function Jo(e) {
|
|
8181
|
+
return /* @__PURE__ */ W(qo, {
|
|
8175
8182
|
...e,
|
|
8176
8183
|
docsEnabled: !1,
|
|
8177
8184
|
children: /* @__PURE__ */ W(io, {})
|
|
@@ -8179,23 +8186,23 @@ function Ko(e) {
|
|
|
8179
8186
|
}
|
|
8180
8187
|
//#endregion
|
|
8181
8188
|
//#region src/app/useChatTabs.ts
|
|
8182
|
-
var
|
|
8183
|
-
function
|
|
8189
|
+
var Yo = "qwksearch-open-chat-tabs", Xo = 50;
|
|
8190
|
+
function Zo() {
|
|
8184
8191
|
if (typeof window > "u") return [];
|
|
8185
8192
|
try {
|
|
8186
|
-
let e = window.localStorage.getItem(
|
|
8193
|
+
let e = window.localStorage.getItem(Yo);
|
|
8187
8194
|
return e ? JSON.parse(e) : [];
|
|
8188
8195
|
} catch {
|
|
8189
8196
|
return [];
|
|
8190
8197
|
}
|
|
8191
8198
|
}
|
|
8192
|
-
function
|
|
8193
|
-
let { chatId: e, chatTurns: t, startNewChat: n, switchToChat: r } = Y(), [i, a] = p(
|
|
8199
|
+
function Qo() {
|
|
8200
|
+
let { chatId: e, chatTurns: t, startNewChat: n, switchToChat: r } = Y(), [i, a] = p(Zo);
|
|
8194
8201
|
u(() => {
|
|
8195
|
-
window.localStorage.setItem(
|
|
8202
|
+
window.localStorage.setItem(Yo, JSON.stringify(i));
|
|
8196
8203
|
}, [i]), u(() => {
|
|
8197
8204
|
if (!e) return;
|
|
8198
|
-
let n = t[0]?.content?.slice(0,
|
|
8205
|
+
let n = t[0]?.content?.slice(0, Xo), r = t.length > 0;
|
|
8199
8206
|
a((t) => {
|
|
8200
8207
|
let i = t.find((t) => t.id === e);
|
|
8201
8208
|
return i ? n && i.title !== n || i.hasMessages !== r ? t.map((t) => t.id === e ? {
|
|
@@ -8255,4 +8262,4 @@ function Xo() {
|
|
|
8255
8262
|
};
|
|
8256
8263
|
}
|
|
8257
8264
|
//#endregion
|
|
8258
|
-
export { ca as A, rn as B, ga as C, fa as D, pa as E, dr as F, $t as H, Y as I, or as L, ta as M, fr as N, oa as O, ur as P, Vn as R, Ea as S, ma as T, en as U, J as V,
|
|
8265
|
+
export { ca as A, rn as B, ga as C, fa as D, pa as E, dr as F, $t as H, Y as I, or as L, ta as M, fr as N, oa as O, ur as P, Vn as R, Ea as S, ma as T, en as U, J as V, uo as _, Vo as a, Wa as b, Io as c, Ao as d, bo as f, so as g, mo as h, Wo as i, ra as j, da as k, Po as l, xo as m, Jo as n, Bo as o, wo as p, qo as r, Lo as s, Qo as t, No as u, io as v, ha as w, Ba as x, qa as y, an as z };
|
package/dist/workspace.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BocRIvOZ.cjs"),t=require("./config.cjs"),n=require("./src-
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BocRIvOZ.cjs"),t=require("./config.cjs"),n=require("./src-2jpriFrk.cjs");let r=require("react"),i=require("next/navigation"),a=require("react/jsx-runtime"),o=require("grab-url");o=e.t(o,1);let s=require("react-reason-editor/reason-docs"),c=require("react-reason-editor/theme"),l=require("react-reason-editor/locale-bundle"),u=require("react-reason-editor-sidebar");require("katex/dist/katex.min.css"),require("easydrawer/styles.css"),require("katex/contrib/mhchem");function d(e){return e.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/gi,` `).replace(/<[^>]+>/g,` `).replace(/ /g,` `).replace(/\s+/g,` `).trim()}var f=async(e,t)=>{try{let n=await(0,o.default)(`agent/page-tips`,{method:`POST`,body:JSON.stringify({title:e,content:t})});return Array.isArray(n.tips)?n.tips:[]}catch{return[]}},p=async(e,t)=>{try{let n=await(0,o.default)(`agent/topic-searches`,{method:`POST`,body:JSON.stringify({title:e,content:t})});return Array.isArray(n.topics)?n.topics:[]}catch{return[]}};function m(){let{activeView:e,toggleToDocs:o,toggleToResearch:m,filesSidebarRequestId:h}=n._(),{chatTabs:g,activeChatId:_,openChat:v,newChat:y,closeChat:b,closeChats:x}=n.t(),{sendMessage:S}=n.I(),{signIn:C}=n.F(),w=(0,i.useSearchParams)(),[T,E]=(0,r.useState)(null),[D,O]=(0,r.useState)(null),[k,A]=(0,r.useState)(!1),[j,M]=(0,r.useState)(null);(0,r.useEffect)(()=>{l.localeActions.setLang(`en`),c.themeActions.setColor(`default`)},[]);let N=(0,r.useRef)(!1);(0,r.useEffect)(()=>{if(N.current)return;N.current=!0;let e=w.get(`docs`),t=w.get(`chat`);e?(O(e),o()):t&&(v(t),m()),A(!0)},[]),(0,r.useEffect)(()=>{if(typeof window>`u`||!k)return;let t=new URL(window.location.href);t.searchParams.set(`chat`,e===`research`?_??``:``),t.searchParams.set(`docs`,e===`docs`?T??``:``);let n=`${t.pathname}?${t.searchParams.toString()}${t.hash}`;n!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.replaceState(null,``,n)},[e,_,T,k]);let P=g.map(e=>({id:e.id,title:e.title,kind:`chat`})),F=e=>{v(e),m()},I=e=>{let{closedWasActive:t,nextActiveId:n}=b(e);t&&!n&&o()},L=e=>{let{closedWasActive:t,nextActiveId:n}=x(e);t&&!n&&o()},R=()=>{y(),m()},z=(0,r.useCallback)(e=>(v(e),m(),!0),[v,m]);(0,r.useEffect)(()=>(t.configureResearchAgentUI({onOpenChat:z}),()=>t.configureResearchAgentUI({onOpenChat:void 0})),[z]);let B=async(e,t)=>f(e,d(t)),V=async(e,t)=>p(e,d(t)),H=(0,r.useCallback)(e=>{y(),m(),M(e)},[y,m]);(0,r.useEffect)(()=>{j&&_&&(S(j),M(null))},[j,_,S]);let U={extraTabs:P,activeExtraTabId:e===`research`?_??void 0:void 0,onExtraTabSelect:F,onExtraTabClose:I,onExtraTabsClose:L,onExtraTabAdd:R,onFileTabSelect:o,initialDocId:D,onActiveDocumentChange:E,onGenerateTips:B,onGenerateTopics:V,onSearchTopic:H,onSignIn:C};return e===`docs`?(0,a.jsx)(s.ReasonDocs,{SidebarComponent:u.Sidebar,SidebarContentComponent:u.SidebarContent,belowMainContent:(0,a.jsx)(n.M,{}),openFilesSidebarSignal:h,...U}):(0,a.jsx)(s.ReasonDocs,{SidebarComponent:u.Sidebar,SidebarContentComponent:u.SidebarContent,mainContent:(0,a.jsx)(n.v,{}),openFilesSidebarSignal:h,...U})}function h(e){return(0,a.jsx)(n.r,{...e,docsEnabled:!0,children:(0,a.jsx)(m,{})})}exports.ARTICLE_TOOLBAR_SHORTCUTS=n.O,exports.ArticleAIResponse=n.T,exports.ArticleActionButtons=n.k,exports.ArticleContent=n.C,exports.ArticleFollowupQuestions=n.E,exports.ArticlePanelHeader=n.j,exports.ArticlePromptInput=n.D,exports.CategoryDock=n.o,exports.ChatInputBox=n.M,exports.ChatProvider=n.N,exports.ChatWindow=n.v,exports.CookieConsent=n.a,exports.ExtractPanelProvider=n.z,exports.HistoryDialogs=n.b,exports.HistoryDropdown=n.y,exports.KokoroVoiceSelector=n.c,exports.LexicalArticleViewer=n.w,exports.MainViewProvider=n.g,exports.QwkSearchApp=n.n,exports.QwkSearchProviders=n.r,exports.QwkSearchWorkspaceApp=h,exports.ResearchWorkspaceView=m,exports.SPOTLIGHT_LINKS=n.h,exports.SPOTLIGHT_PREFIXES=n.f,exports.SessionProvider=n.P,exports.SpotlightPalette=n.u,exports.UnifiedMarkdown=n.S,exports.VoiceSettingsPanel=n.s,exports.cn=n.V,exports.configureResearchAgentUI=t.configureResearchAgentUI,exports.formatMessageTime=n.H,exports.formatTimeDifference=n.U,exports.formatToolbarShortcut=n.A,exports.getPageTips=f,exports.getTopicSearches=p,exports.htmlToPlainText=d,exports.matchSpotlight=n.p,exports.openSpotlight=n.d,exports.parsePrefix=n.m,exports.researchAgentUIConfig=t.researchAgentUIConfig,exports.useChat=n.I,exports.useChatState=n.L,exports.useChatTabs=n.t,exports.useChunkErrorReload=n.i,exports.useExtractPanel=n.B,exports.useHistoryState=n.x,exports.useKokoroTTS=n.l,exports.useMainView=n._,exports.useSession=n.F,exports.useTextToSpeech=n.R;
|
package/dist/workspace.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { configureResearchAgentUI as e, researchAgentUIConfig as t } from "./config.mjs";
|
|
4
|
-
import { A as n, B as r, C as i, D as a, E as o, F as s, H as c, I as l, L as u, M as d, N as f, O as p, P as m, R as h, S as g, T as _, U as v, V as y, _ as b, a as x, b as S, c as C, d as w, f as T, g as E, h as D, i as O, j as k, k as A, l as j, m as M, n as N, o as P, p as F, r as I, s as ee, t as L, u as te, v as R, w as ne, x as re, y as z, z as B } from "./src-
|
|
4
|
+
import { A as n, B as r, C as i, D as a, E as o, F as s, H as c, I as l, L as u, M as d, N as f, O as p, P as m, R as h, S as g, T as _, U as v, V as y, _ as b, a as x, b as S, c as C, d as w, f as T, g as E, h as D, i as O, j as k, k as A, l as j, m as M, n as N, o as P, p as F, r as I, s as ee, t as L, u as te, v as R, w as ne, x as re, y as z, z as B } from "./src-BT2fOBqk.js";
|
|
5
5
|
import { useCallback as V, useEffect as H, useRef as ie, useState as U } from "react";
|
|
6
6
|
import { useSearchParams as ae } from "next/navigation";
|
|
7
7
|
import { jsx as W } from "react/jsx-runtime";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "research-agent-ui",
|
|
3
3
|
"description": "The QwkSearch app UI: conversation window, article reader, search config, file uploads, chat history, and the app shell — exported both with and without the REASON editor and its sidebar",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.236",
|
|
5
5
|
"author": "vtempest",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -90,13 +90,13 @@
|
|
|
90
90
|
"@radix-ui/react-tooltip": "^1.2.16",
|
|
91
91
|
"@ricky0123/vad-web": "^0.0.30",
|
|
92
92
|
"ai": "^7.0.94",
|
|
93
|
-
"chat-agent-toolkit": "^1.2.
|
|
93
|
+
"chat-agent-toolkit": "^1.2.369",
|
|
94
94
|
"class-variance-authority": "^0.7.1",
|
|
95
95
|
"clsx": "^2.1.1",
|
|
96
|
-
"domain-rank": "^0.1.
|
|
96
|
+
"domain-rank": "^0.1.358",
|
|
97
97
|
"dompurify": "^3.4.15",
|
|
98
98
|
"drizzle-orm": "^0.45.2",
|
|
99
|
-
"extract-webpage": "^1.2.
|
|
99
|
+
"extract-webpage": "^1.2.363",
|
|
100
100
|
"framer-motion": "^13.2.0",
|
|
101
101
|
"fuse.js": "^7.5.0",
|
|
102
102
|
"grab-url": "^1.6.22",
|
|
@@ -106,21 +106,21 @@
|
|
|
106
106
|
"markdown-to-jsx": "^9.10.2",
|
|
107
107
|
"motion": "^13.2.0",
|
|
108
108
|
"quantum-sphere-loading-icon": "^1.0.3",
|
|
109
|
-
"qwksearch-api-client": "^1.0.
|
|
109
|
+
"qwksearch-api-client": "^1.0.41",
|
|
110
110
|
"react-icons": "^5.7.0",
|
|
111
111
|
"react-native-app-buttons": "^0.1.4",
|
|
112
112
|
"react-textarea-autosize": "^8.5.9",
|
|
113
|
-
"search-web-api": "^1.0.
|
|
114
|
-
"shadcn-app-dock": "^0.1.
|
|
113
|
+
"search-web-api": "^1.0.221",
|
|
114
|
+
"shadcn-app-dock": "^0.1.219",
|
|
115
115
|
"shadcn-theme-menu": "^1.1.47",
|
|
116
116
|
"sonner": "^2.0.8",
|
|
117
117
|
"streamdown": "^2.6.0",
|
|
118
118
|
"tailwind-merge": "^3.6.0",
|
|
119
119
|
"tldts": "^7.4.12",
|
|
120
|
-
"trending-news-api": "^0.1.
|
|
120
|
+
"trending-news-api": "^0.1.97",
|
|
121
121
|
"turndown": "^7.2.4",
|
|
122
122
|
"use-voice-control": "^0.1.95",
|
|
123
|
-
"use-weather-forecast": "^0.1.
|
|
123
|
+
"use-weather-forecast": "^0.1.183"
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
126
|
"@cloudflare/workers-types": "^5.20260908.1",
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
"next": "^16.3.4",
|
|
140
140
|
"react": "^19.2.8",
|
|
141
141
|
"react-dom": "^19.2.8",
|
|
142
|
-
"react-reason-editor": "^1.0.
|
|
143
|
-
"react-reason-editor-sidebar": "^0.1.
|
|
142
|
+
"react-reason-editor": "^1.0.171",
|
|
143
|
+
"react-reason-editor-sidebar": "^0.1.88",
|
|
144
144
|
"storybook": "^10.6.0",
|
|
145
145
|
"tailwindcss": "^4.3.3",
|
|
146
146
|
"typescript": "^7.0.2",
|