import{REDOCLY_TEAMS_RBAC as n}from"@redocly/config";import{encodeBackSlashes as h,getOperationId as l,getOperationName as k}from"../../utils/index.js";function I(t,r,f,a){if(r.operations.length===0)return[];const s=[],d=[],p=[];if(a)for(const e of Object.values(a))(e.kind==="badge"||e.kind==="audience")&&p.push(e);for(const e of r.operations){const o=l(e,t),m="operation",c=[...e["x-badges"]||[]];if(e.tags)for(const b of e.tags){const i=p.find(g=>g.name===b);i&&c.push({name:i.summary||i.name,color:i.kind==="audience"?"grey":"blue",position:"after",icon:i.kind==="audience"?"user-group":void 0})}const u={id:o,type:m,parent:t,operationDefinition:e,depth:f,name:k(e),httpVerb:e.httpVerb,path:e.pathName,items:[],isAdditionalOperation:e.isAdditionalOperation,isWebhook:e.isWebhook,operationId:e.operationId,badges:c,href:N({id:o}),deprecated:!!e.deprecated,[n]:e[n]||t?.[n]};e.isWebhook?d.push(u):s.push(u)}return[...s.sort((e,o)=>Number(e.deprecated)-Number(o.deprecated)||Number(e.isAdditionalOperation)-Number(o.isAdditionalOperation)),...d.sort((e,o)=>Number(e.deprecated)-Number(o.deprecated))]}function N({id:t}){return h(`/${t}`.toLowerCase())}export{N as getHref,I as getOperationsItems};
