1const C={"Last month":1,"Last 3 months":3,"Last 6 months":6,"Last year":12};let p=null;const D=async()=>{if(p)return p;try{const n=await fetch("/search-index.json");if(!n.ok)throw new Error(`Failed to fetch search index: ${n.statusText}`);return p=await n.json(),p}catch(n){return console.error("[ClientSearch] Error fetching search index:",n),[]}},L=async(n={})=>{const{search:i,types:g,categories:u,tags:h,dateRange:c,page:f=1,limit:r=20}=n,d=(await D()).filter(s=>{if(i){const e=i.toLowerCase(),o=s.title?.toLowerCase().includes(e),a=s.excerpt?.toLowerCase().includes(e),x=s.categories?.some(m=>m.toLowerCase().includes(e)),S=s.tags?.some(m=>m.toLowerCase().includes(e));if(!o&&!a&&!x&&!S)return!1}if(g?.length&&!g.map(o=>o.toLowerCase()).includes(s.type.toLowerCase())||u?.length&&!s.categories?.some(e=>u.includes(e))||h?.length&&!s.tags?.some(e=>h.includes(e)))return!1;if(c&&C[c]){const e=C[c],o=new Date,a=new Date(o.getFullYear(),o.getMonth()-e,o.getDate());if(new Date(s.publishedAt||0)<a)return!1}return!0}).sort((s,e)=>new Date(e.publishedAt||0).getTime()-new Date(s.publishedAt||0).getTime()),l=d.length,t=(f-1)*r;return{items:d.slice(t,t+r),total:l,page:f,limit:r,totalPages:Math.ceil(l/r),hasMore:t+r<l}},T=async n=>{const{type:i,categories:g=[],categorySlugs:u=[],tags:h=[],tagSlugs:c=[],excludeSlug:f,limit:r=15}=n,y=await D(),d=f.replace(/^\/|\/$/g,""),l=y.filter(t=>{if(t.type!==i)return!1;const w=t.slug?.replace(/^\/|\/$/g,""),s=t.full_slug?.replace(/^\/|\/$/g,"");if(w===d||s===d)return!1;const e=g.length>0&&t.categories?.some(a=>g.includes(a))||u.length>0&&t.categorySlugs?.some(a=>u.includes(a)),o=h.length>0&&t.tags?.some(a=>h.includes(a))||c.length>0&&t.tagSlugs?.some(a=>c.includes(a));return e||o});return l.sort((t,w)=>new Date(w.publishedAt||0).getTime()-new Date(t.publishedAt||0).getTime()),l.slice(0,r)};export{T as g,L as s};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.