import{withPathPrefix as a}from"@redocly/theme/core/utils";import{OPENAPI_DOCS_TEMPLATE_ID as p}from"../../constants/common";import{normalizeRouteSlug as c}from"../../utils/path/normalize-route-slug";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 l(t,e=[]){for(const r of t)e.push(r),Array.isArray(r?.items)&&l(r.items,e);return e}function P(t,e){const r=c(e),o=t?l(t).filter(n=>!n.external&&!!n.link):[],i=o.findIndex(({link:n})=>c(a(n))===r);return i!==-1?{prevPage:u(o,i,"prev"),nextPage:u(o,i,"next")}:{}}function u(t,e,r,o=1){const i=t[e]?.routeSlug;switch(r){case"next":{const n=t[e+o];return!i||n?.routeSlug!==i?n:u(t,e,r,o+1)}case"prev":{const n=t[e-o];return i?n?.routeSlug!==i?t.find(f=>f.link===n?.routeSlug)||n:u(t,e,r,o+1):n}default:return}}function w({templateId:t,sharedData:e}){if(t===p){const{basePath:r}=e?.openAPIDocsStore||{};return a(r?`${r}/*`:"*")}return"*"}function S(){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"}function k(t,e){return e?`${t}${e}`:window?.location?.search?`${t}${window.location.search}`:t}export{k as appendSearchParams,l as flattenNestedItems,h as getNavbarElement,w as getRouteBasePath,P as getSiblingPages,y as isForcedNavigationLinkClick,S as isInIframe,x as normalizeRedocBadge,m as replaceHashInColor};
