1function w({getTargets:f,getKey:c,onActiveChange:a,threshold:h=.2,rootMargin:y="0px",root:p=null}={}){if(typeof f!="function"||typeof c!="function"||typeof a!="function")throw new TypeError("createActiveItemObserver - getTargets, getKey and onActiveChange are required and must be functions");let n=null;const r=new Set;let i=null,l=null,d=!1,o=0;function g(t){if(o>0)return;let e=t.filter(s=>s.isIntersecting).sort((s,x)=>s.boundingClientRect.top-x.boundingClientRect.top);if(e.length>0&&l!==null&&(e=e.filter(s=>String(c(s.target))===String(l)),l=null),e.length===0)return;const b=e[0].target,u=c(b);u!=null&&(i!==null&&String(u)===String(i)||(i=u,a(u,b)))}function v(){const t=new Set(f()||[]);r.forEach(e=>{t.has(e)||(n.unobserve(e),r.delete(e))}),t.forEach(e=>{r.has(e)||(n.observe(e),r.add(e))})}function E(){const t=Array.from(r);t.forEach(e=>n.unobserve(e)),t.forEach(e=>n.observe(e))}return{start(){d||n||(n=new IntersectionObserver(g,{root:p,rootMargin:y,threshold:h}),v())},stop(){n&&(n.disconnect(),n=null,r.clear(),i=null,l=null)},refresh(){n&&v()},async runExclusive(t,{reevaluate:e=!1}={}){o+=1;try{return await t()}finally{o=Math.max(0,o-1),o===0&&e&&n&&E()}},selectExternally(t){l=t===void 0?null:t},getActiveKey(){return i},destroy(){this.stop(),d=!0}}}export{w as createActiveItemObserver};
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.