import{r as t,c as n,h as e,g as i}from"./p-1a84f38a.js";import{e as a}from"./p-9158fc11.js";const s=class{constructor(e){t(this,e),this.anjNavigationItemSelected=n(this,"anjNavigationItemSelected",7)}onClick(t){t.preventDefault(),this.anjNavigationItemSelected.emit()}render(){const t=window.location.pathname;return e("anj-headline",null,e("h4",null,e("a",{href:`${t}#${this.section}`,onClick:t=>this.onClick(t)},e("slot",null))))}static get style(){return".sc-anj-navigation-item-h{display:block;font-size:.875rem;font-family:var(--anj-font-family);font-weight:400;line-height:1.5;outline:none}.sc-anj-navigation-item-h, .sc-anj-navigation-item-h:after, .sc-anj-navigation-item-h:before{-webkit-box-sizing:border-box;box-sizing:border-box;outline:none}.sc-anj-navigation-item-h:active, .sc-anj-navigation-item-h .sc-anj-navigation-item:active, .sc-anj-navigation-item-h:focus, .sc-anj-navigation-item-h .sc-anj-navigation-item:focus{outline:none}.sc-anj-navigation-item-h:not(:last-child){margin-bottom:.5rem}[active].sc-anj-navigation-item-h a.sc-anj-navigation-item{color:var(--anj-text)}[active].sc-anj-navigation-item-h a.sc-anj-navigation-item:hover{text-decoration:none}"}},o=class{constructor(n){t(this,n)}connectedCallback(){this.setActive=a(this.setActive.bind(this),50)}async componentWillRender(){return this.setActive()}onItemSelected({target:t},n){this.getItems().forEach(n=>n.active=n===t);const e=document.getElementById(t.section);n||e&&window.scrollTo({top:e.offsetTop,left:0,behavior:"smooth"})}async setActive(){const t=this.getItems().map(t=>document.getElementById(t.section));let n=t[0];if(t.slice(1).forEach(t=>{t&&Math.abs(window.scrollY-t.offsetTop)<Math.abs(window.scrollY-n.offsetTop)&&(n=t)}),!n)return;const e=this.element.querySelector(`anj-navigation-item[section="${n.getAttribute("id")}"]`);this.onItemSelected({target:e},!0)}getItems(){return Array.from(this.element.querySelectorAll("anj-navigation-item"))}get element(){return i(this)}static get style(){return".sc-anj-navigation-pane-h{display:block;font-size:.875rem;font-family:var(--anj-font-family);font-weight:400;line-height:1.5;outline:none;background-color:inherit;position:-webkit-sticky;position:sticky;top:0}.sc-anj-navigation-pane-h, .sc-anj-navigation-pane-h:after, .sc-anj-navigation-pane-h:before{-webkit-box-sizing:border-box;box-sizing:border-box;outline:none}.sc-anj-navigation-pane-h:active, .sc-anj-navigation-pane-h .sc-anj-navigation-pane:active, .sc-anj-navigation-pane-h:focus, .sc-anj-navigation-pane-h .sc-anj-navigation-pane:focus{outline:none}"}};export{s as anj_navigation_item,o as anj_navigation_pane};