"use strict";const C=require("react/jsx-runtime"),r=require("react"),N=require("../global.module.cjs"),i=require("../tools/tools.cjs"),b=function(h){const{as:I="div",children:x,className:a,dropOldClass:u,onActiveChange:s,rootMargin:d="0px 0px -25%",sectionIds:n=[],smoothScroll:f,style:m,threshold:y=.5,variables:p,...g}=h,S=r.useRef(null),[E,q]=r.useState(null),R=r.useMemo(()=>{const o=i.classx(!u&&"",f&&N.treeStyles.brlScrollSmooth,a),t=i.stylex((c,e)=>({tKey:i.convertBsKeyToVar(e)}),p,m);return{className:o,style:t}},[a,u,f,m,p]);return r.useEffect(()=>{const o=S.current;if(!o)return;const t=new IntersectionObserver(e=>{for(const v of e)if(v.isIntersecting){const l=n.find(B=>v.target.id===B);if(l){q(l),s==null||s(l);break}}},{root:o,rootMargin:d,threshold:y}),c=n.map(e=>document.getElementById(e)).filter(Boolean);return c.forEach(e=>e&&t.observe(e)),()=>{c.forEach(e=>e&&t.unobserve(e)),t.disconnect()}},[s,d,n,y]),C.jsx(I,{...g,...R,ref:S,children:x(E)})};b.displayName="BRL.Scrollspy";exports.Scrollspy=b;
//# sourceMappingURL=scrollspy.cjs.map
