import{getElement as t,store as e}from"@wordpress/interactivity";let i=0,s=!1,n=!1,o=100;const{state:r}=e("twentig/sticky-header",{state:{isHidden:!1},callbacks:{init:()=>{const{ref:e}=t();o=e.offsetHeight??100,i=window.scrollY,s=window.scrollY>0},handleScroll:()=>{if(n)return;n=!0;const t=window.scrollY;Math.abs(t-i)<=5&&t>0?n=!1:requestAnimationFrame((()=>{const e=t>i;t>o?e!==s&&(r.isHidden=e,s=e):r.isHidden&&(r.isHidden=!1),i=t,n=!1}))}}});