import{defaultDocRegistry as C}from"@contractspec/lib.contracts-spec/docs";import{useMemo as E}from"react";function I(q,w){return E(()=>{try{return C.list().filter(({block:j})=>{let v=j.id.toLowerCase().includes(q.toLowerCase())||j.title.toLowerCase().includes(q.toLowerCase()),z=w?.some((A)=>j.tags?.some((B)=>B.toLowerCase().includes(A.toLowerCase())));return v||z}).map(({block:j,route:v})=>({id:j.id,title:j.title,summary:j.summary,route:v}))}catch(x){return console.error("Failed to fetch related docs:",x),[]}},[q,w])}export{I as useRelatedDocs};
