import{getTagGroupsItems as d,getTagsItems as c,getTagsWithOperations as p}from"./tags.js";import{addMarkdownItems as g}from"./markdown.js";import{flattenByProp as h,getValueFromMdParsedExtension as l}from"../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as r}from"../../constants.js";function x(o,s){const{definition:e}=o,{schemaDefinitionsTagName:i}=s,a=[{id:"",name:e?.info?.["x-seo"]?.title||e?.info?.title||"Overview",href:"/",depth:1,level:1,type:"section",infoDefinition:e.info,items:[],keywords:e["x-keywords"]}],t=[...e.tags||[]];if(t.some(n=>n.name===r)||t.push({name:r}),!t.find(n=>n?.name===i)&&i&&t.push({name:i}),e["x-mcp"])for(const n of["Tools","Resources","Prompts"])e["x-mcp"][n]&&(t.find(u=>u?.name===n)||t.push({name:n}));const m=p(o,t),f=e["x-tagGroups"];return a.push(...g(l(e.info,"description")||"",void 0,1)),f&&f.length>0?a.push(...d(o,void 0,f,m,s)):a.push(...c(o,m,void 0,void 0,s)),a}function E(o,s){const e=x(o,s),i=h(e||[],"items");return{contentItems:e,flatItems:i}}export{E as buildContentItems,x as buildMenuStructure};
