PageSourceSearch

https://catnic.com/dist/assets/navigation.858c4098.js

js catnic.com collected 2026-10-08 05:50:16 UTC 5,985 bytes, 1 lines download raw bytes

1import{l as x}from"./app.380896f1.js";const I=()=>{const f=document.getElementById("site-navigation-bar"),i=document.getElementById("primary-nav"),g=document.getElementById("primary-nav-trigger"),c=document.getElementById("subnav-bg"),p="mobile-nav-open",v="nav-open",b=1180,E=document.getElementById("search-results"),L="search-open",r="overlay-open",y="navbar-offscreen";if(g&&g.addEventListener("click",()=>{document.documentElement.classList.contains(p)&&document.documentElement.classList.remove(r),document.documentElement.classList.toggle(p)}),i&&f){const d="is-open",w=t=>{t[0].isIntersecting?document.documentElement.classList.remove(y):document.documentElement.classList.add(y)};new IntersectionObserver(w).observe(f);const l=(t,n)=>{let e=t.previousElementSibling;const a=t.nextElementSibling,o=t.closest(["[data-subnav]"]);switch(n){case"left":e&&(e.hasAttribute("data-nav-item")&&e.getElementsByTagName("span")&&!e.getElementsByTagName("a")[0]&&(e=e.previousElementSibling),e.hasAttribute("data-nav-item")&&e.getElementsByTagName("a")[0].focus(),e.hasAttribute("data-menu-current")&&e.focus());break;case"right":a&&a.hasAttribute("data-nav-item")&&a.getElementsByTagName("a")[0].focus();break;case"down":if(t.hasAttribute("data-nav-item-children")&&t.getAttribute("data-nav-item-children")==="open"&&window.matchMedia(`(min-width: ${minWidth}px)`).matches)t.querySelector("[data-submenu]").getElementsByTagName("a")[0].focus();else if(a&&a.hasAttribute("data-nav-item")){let s=a.getElementsByTagName("a")[0];const m=a.getElementsByTagName("span");s?s.focus():m&&a.nextElementSibling&&(s=a.nextElementSibling.getElementsByTagName("a")[0],s&&s.focus())}break;case"up":e&&(e.hasAttribute("data-nav-item")&&e.getElementsByTagName("span")&&!e.getElementsByTagName("a")[0]&&(e=e.previousElementSibling),e&&e.hasAttribute("data-nav-item")&&e.getElementsByTagName("a")[0]&&e.getElementsByTagName("a")[0].focus(),e&&e.hasAttribute("data-menu-current")&&e.focus(),e&&e.tagName==="BUTTON"&&closeSubMenu(o,o.dataset.menuId));break;case"tab":break;default:return}},k=t=>{const n=document.activeElement,e=n.parentNode,a=n.closest("[data-subnav]");switch(t.key){case"Escape":if(a){u(a.id);const o=document.querySelector(`[aria-controls="${a.id}"]`);o&&o.focus()}else A();break;case"ArrowLeft":t.preventDefault(),l(e,"left");break;case"ArrowUp":t.preventDefault(),l(e,"up");break;case"ArrowRight":t.preventDefault(),l(e,"right");break;case"ArrowDown":t.preventDefault(),l(e,"down");break;case"Tab":t.shiftKey||l(e,"tab");break;default:return}};i.addEventListener("keydown",k,!1);const B=()=>Math.floor(f.offsetHeight),h=()=>{const t=B();window.innerWidth<b?c.style.top="0":c.style.top=`${t}px`,c.style.height=`${window.innerHeight-t}px`;for(const n of i.querySelectorAll('[data-subnav][data-level="2"]'))window.innerWidth<b?n.style.top="0":(n.style.top=`${t}px`,c.style.top=`${t}px`),n.style.height=`${window.innerHeight}px`};h();const N=()=>{h()};window.addEventListener("resize",x(N,250));const A=()=>{for(const t of i.querySelectorAll('[aria-hidden="false"]')){t.classList.remove(d);const n=i.querySelector(`[aria-controls="${t.getAttribute("id")}"]`);n&&n.setAttribute("aria-expanded","false")}document.documentElement.classList.remove("nav-open-level-2"),document.documentElement.classList.remove("nav-open-level-3")};document.documentElement.addEventListener("overlay-clicked",A);const u=t=>{const n=document.getElementById(t),e=parseInt(n.getAttribute("data-level"));if(e===2&&document.documentElement.classList.contains(v)&&document.documentElement.classList.contains(r)&&document.documentElement.classList.remove(r),e===2&&document.documentElement.removeAttribute("data-nav-id"),n){const a=i.querySelector(`[aria-controls="${t}"]`),o=a.parentElement;if(o){for(const s of o.querySelectorAll("[data-level]"))s.classList.remove(d);for(const s of o.querySelectorAll("[aria-expanded]"))s.setAttribute("aria-expanded","false");for(const s of o.querySelectorAll("[aria-hidden]"))s.setAttribute("aria-hidden","true")}n.classList.remove(d),n.setAttribute("aria-hidden","true"),a.setAttribute("aria-expanded","fal
1se"),n.getAttribute("data-level")==="2"&&document.documentElement.classList.remove("nav-open-level-3"),document.documentElement.classList.remove(`nav-open-level-${n.getAttribute("data-level")}`)}},S=t=>{E&&(E.classList.remove("is-open"),document.documentElement.classList.remove(L)),document.documentElement.classList.contains(r)===!1&&document.documentElement.classList.add(r);const n=i.querySelector(`[aria-controls="${t}"]`),e=document.getElementById(t),a=e.getAttribute("data-level");for(const o of i.querySelectorAll(`[data-level="${a}"]`))u(o.getAttribute("id"));T(e),e.classList.add(d),e.setAttribute("aria-hidden","false"),n.setAttribute("aria-expanded","true"),document.documentElement.classList.add(v),document.documentElement.classList.add(`nav-open-level-${e.getAttribute("data-level")}`),a==2&&document.documentElement.setAttribute("data-nav-id",t)},T=t=>{var n=t.querySelectorAll("a[href]:not([disabled]), button:not([disabled])"),e=n[0],a=n[n.length-1],o=9;setTimeout(function(){n[0].focus()},200),t.addEventListener("keydown",function(s){var m=s.key==="Tab"||s.keyCode===o;!m||window.innerWidth<b&&(s.shiftKey?document.activeElement===e&&(a.focus(),s.preventDefault()):document.activeElement===a&&(e.focus(),s.preventDefault()))})};for(const t of i.querySelectorAll('[data-level="2"]'))t.addEventListener("transitionend",n=>{n.propertyName==="transform"&&t.classList.contains("is-open")===!1&&document.documentElement.classList.remove(v)});for(const t of i.querySelectorAll('[data-has-children="true"] > a'))t.addEventListener("click",n=>{n.preventDefault();const e=t.getAttribute("aria-expanded"),a=t.getAttribute("aria-controls");e==="true"?u(a):S(a)});for(const t of i.querySelectorAll("[data-menu-back-button]"))t.addEventListener("click",()=>{const n=t.closest("[data-subnav]");if(n){const e=n.getAttribute("id");e&&u(e)}})}};export{I as initNavigation};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.