import{$ as e,C as t,D as n,E as r,F as i,H as a,I as o,Q as s,S as c,T as l,U as u,Y as d,_ as f,b as p,g as m,n as h,p as g,q as _,x as v}from"./app-TUitoOVa.js";import{t as y}from"./AppLayout-BpT0nFS-.js";import{n as b,t as x}from"./EmptyState-BiOaEbzT.js";var S={class:`mx-auto max-w-3xl`},C={key:0,class:`mt-3 text-sm text-ink-muted`},w={key:0,class:`ml-1 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-bold text-primary`},T={key:1,class:`mt-5 space-y-3`},E={key:3,class:`mt-10 text-center text-ink-muted`},D=n({__name:`Search`,props:{q:{},results:{},mode:{}},setup(n){let D=_(n.q);function O(){e.get(`/search`,{q:D.value.trim()},{preserveState:!0})}return(e,_)=>(i(),t(f,null,[r(d(h),{title:n.q?`Search: ${n.q}`:`Search`},null,8,[`title`]),r(y,null,{default:a(()=>[p(`div`,S,[_[2]||=p(`h1`,{class:`mb-4 text-2xl font-extrabold tracking-tight`},`Search`,-1),p(`form`,{class:`flex gap-2`,onSubmit:m(O,[`prevent`])},[u(p(`input`,{"onUpdate:modelValue":_[0]||=e=>D.value=e,type:`search`,autofocus:``,placeholder:`Search the community…`,class:`flex-1 rounded-c border-line bg-surface-2 text-ink placeholder:text-ink-muted focus:border-primary focus:ring-primary`},null,512),[[g,D.value]]),_[1]||=p(`button`,{type:`submit`,class:`rounded-c bg-primary px-5 py-2.5 text-sm font-semibold text-white hover:bg-primary-600`},`Search`,-1)],32),n.q?(i(),t(`p`,C,[l(s(n.results.length)+` result`+s(n.results.length===1?``:`s`)+` for “`+s(n.q)+`” `,1),n.mode===`semantic`?(i(),t(`span`,w,`✦ semantic`)):c(``,!0)])):c(``,!0),n.results.length?(i(),t(`div`,T,[(i(!0),t(f,null,o(n.results,e=>(i(),v(b,{key:e.id,topic:e},null,8,[`topic`]))),128))])):n.q?(i(),v(x,{key:2,class:`mt-10`,title:`No matching discussions`,body:`Nothing came up for “${n.q}”. Try different words — or start a new topic and let the community (and the assistant) help.`},null,8,[`body`])):(i(),t(`p`,E,`Type a question or a few keywords to search every discussion.`))])]),_:1})],64))}});export{D as default};