function f(t){const o=window.getComputedStyle(t);return{marginTop:parseFloat(o.getPropertyValue("margin-top"))||0,marginBottom:parseFloat(o.getPropertyValue("margin-bottom"))||0}}const s=t=>!!t&&(t instanceof HTMLHeadingElement||/^H[1-6]$/.test(t.tagName));function p(){const t=[],o=Array.from(document.querySelectorAll("article > *")??[]);let e=0,r=l(o[0]),a=0;return o.forEach(n=>{const{marginTop:i,marginBottom:c}=f(n);s(n)&&e&&(t.push({height:e,offset:r}),r=n.offsetTop-Math.max(a,i),e=0),e+=n.offsetHeight,e+=Math.max(a,i),a=c}),e!==0&&t.push({height:e,offset:r}),t}function u(t){if(t===0)return 0;const e=Array.from(document.querySelectorAll("article > *")).filter(r=>s(r));if(t<e.length){const r=document.querySelector("nav")?.offsetHeight??0;return e[t].offsetTop-r}return 0}const m=()=>{const t=document.querySelector("article")?.offsetTop??0,o=g();return t-o},g=()=>document.querySelector("nav")?.offsetHeight??0;function l(t){if(!t)return 0;const o=window.getComputedStyle(t),e=parseFloat(o.getPropertyValue("margin-top"))||0;return t.offsetTop-e}export{m as getArticleOffsetTop,u as getBlockOffsetTop,p as getBlocksHeight,g as getNavHeight};
