import{withPathPrefix as f}from"@redocly/theme/core/utils";import{OPENAPI_DOCS_TEMPLATE_ID as g}from"../constants/index.js";import{normalizeRouteSlug as a}from"../shared/utils";function h(){const t=typeof document<"u"&&document.querySelectorAll("nav")||[];for(let e=0;e<t.length;e++)if(t[e].getBoundingClientRect().height>1)return t[e];return t[0]||null}function m(t){return t.replace("#","%23")}function x(t){return t==="hook"?"event":t}function c(t,e=[]){for(const n of t)e.push(n),Array.isArray(n?.items)&&c(n.items,e);return e}function P(t,e){const n=a(e),o=t?c(t).filter(r=>!r.external&&!!r.link):[],i=o.findIndex(({link:r})=>a(r)===n);return i!==-1?{prevPage:u(o,i,"prev"),nextPage:u(o,i,"next")}:{}}function u(t,e,n,o=1){const i=t[e]?.routeSlug;switch(n){case"next":{const r=t[e+o];return!i||r?.routeSlug!==i?r:u(t,e,n,o+1)}case"prev":{const r=t[e-o];return i?r?.routeSlug!==i?t.find(l=>l.link===r?.routeSlug)||r:u(t,e,n,o+1):r}default:return}}function S({templateId:t,sharedData:e}){if(t===g){const{basePath:n}=e?.openAPIDocsStore||{};return f(n?`${n}/*`:"*")}return"*"}function w(){try{return typeof window<"u"&&window!==window.parent}catch{return!0}}function y(t,e){return t.ctrlKey||t.metaKey||t.altKey||t.shiftKey||e==="_blank"}export{c as flattenNestedItems,h as getNavbarElement,S as getRouteBasePath,P as getSiblingPages,y as isForcedNavigationLinkClick,w as isInIframe,x as normalizeRedocBadge,m as replaceHashInColor};
