import{normalizePath as n}from"../../utils/index.js";import{isRenderableMenuItem as f}from"../../utils/menu.js";function c(t){return t.type==="section"&&t.id===""}function m(t){const r=[],e=[],s=[];let i;for(const o of t)switch(o.type){case"group":r.push(o);break;case"tag":e.push(o);break;case"operation":s.push(o);break;case"section":c(o)&&(i=o);break}return{groupItems:r,tagItems:e,operationItems:s,rootItem:i}}function p(t,r){for(const e of t){if(e.type==="group")return p(e.items,r);if(e.type==="tag"){if(!e.description)return n(p(e.items,r));if(e.href)return n(e.href)}else if(f(e))return n(e.href)}return r}export{p as getFirstPageLink,m as getItemsByType,c as isRootItem};
