import{C as e,G as t,H as n,I as r,J as i,R as a,S as o,T as s,f as c,ht as l,n as u,pt as d,r as f,v as p,w as m,x as h}from"./folders.j8Vf02Wn.js";import{c as g,p as _}from"./style.BtGWTIRi.js";import{i as v,n as y,r as b}from"../options.C1oHSPEM.js";import{t as x}from"./LinkCard.BUwb4UH-.js";var S={class:`search-view p-4`},C={class:`mb-4 flex items-center justify-between`},w={class:`mb-4`},T={key:0,class:`py-12 text-center`},E={__name:`SearchView`,setup(E){let D=y();b();let O=u(),k=g();f();let A=t([]),j=t(k.viewMode||c.LIST),M=t(D.query.q||``),N=h(()=>M.value.trim()?O.searchLinks(M.value):[]);function P(e){A.value.includes(e)?A.value=A.value.filter(t=>t!==e):A.value=[...A.value,e]}function F(){A.value=[]}function I(){A.value=N.value.map(e=>e.id)}let L=h(()=>A.value.length),R=h(()=>A.value.length>0);function z(e){window.open(e.url,`_blank`)}function B(e){O.starLink(e.id,!e.starred)}function V(){j.value=j.value===c.LIST?c.GRID:c.LIST,k.update(`viewMode`,j.value)}return(t,u)=>(r(),s(`div`,S,[o(`div`,C,[u[1]||=o(`h2`,{class:`text-lg font-medium text-foreground`},`Search Results`,-1),o(`button`,{onClick:V,class:`btn btn-ghost btn-sm`},l(j.value===i(c).LIST?`☰`:`⬜`),1)]),o(`div`,w,[n(o(`input`,{"onUpdate:modelValue":u[0]||=e=>M.value=e,type:`text`,placeholder:`Search links by title, URL, or tag...`,class:`input`},null,512),[[_,M.value]])]),N.value.length===0?(r(),s(`div`,T,[...u[2]||=[o(`div`,{class:`text-4xl mb-2`},`🔍`,-1),o(`h3`,{class:`text-lg font-medium text-foreground mb-1`},`No results`,-1),o(`p`,{class:`text-sm text-muted-foreground`},`No links match your search`,-1)]])):(r(),s(`div`,{key:1,class:d([`gap-2`,j.value===i(c).GRID?`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`:`grid grid-cols-1`])},[(r(!0),s(p,null,a(N.value,t=>(r(),e(x,{key:t.id,link:t,selected:A.value.includes(t.id),"view-mode":j.value,onToggleSelect:e=>P(t.id),onToggleStar:e=>B(t),onOpen:e=>z(t)},null,8,[`link`,`selected`,`view-mode`,`onToggleSelect`,`onToggleStar`,`onOpen`]))),128))],2)),R.value?(r(),e(v,{key:2,count:L.value,"selected-ids":A.value,onClear:F,onSelectAll:I},null,8,[`count`,`selected-ids`])):m(``,!0)]))}};export{E as default};