export{U as UUID,c as colorShade,g as getColorShade,s as setColorShade}from"./p-cb31d0af.js";export{F as FileManager}from"./p-5d187233.js";export{B as BceFile,m as modulo,r as ripple,t as throttle}from"./p-7085c7be.js";export{d as debounce,i as isEmail,v as validator}from"./p-afb19483.js";class o{constructor(t,s={}){this.current=null,this.nodes=[],this.offset=0,this.timeout=0,this.handleScroll=()=>{this.timeout&&window.cancelAnimationFrame(this.timeout),this.timeout=window.requestAnimationFrame(()=>this.detect())},this.selector=t,this.options=Object.assign({class:"active"},s),this.reload(),window.addEventListener("resize",this.handleScroll),window.addEventListener("scroll",this.handleScroll)}get active(){const t=this.nodes[this.nodes.length-1];if(t&&this.bottom&&this.isVisible(t.section))return t;for(let s=this.nodes.length-1;s>=0;s--)if(this.isVisible(this.nodes[s].section))return this.nodes[s];return null}get bottom(){const{root:t}=this;return t.scrollHeight-window.innerHeight<=t.scrollTop}get root(){return document.scrollingElement||document.documentElement}destroy(){this.current&&this.deactivate(this.current),window.removeEventListener("resize",this.handleScroll),window.removeEventListener("scroll",this.handleScroll)}detect(){const{active:t}=this,s=this.current;if(s){if(s===t)return;this.deactivate(s)}t&&this.activate(t),this.current=t}reload(){const{root:t}=this,s=t.querySelectorAll(this.selector);this.nodes=Array.from(s).reduce((t,s)=>{const i=decodeURIComponent(("hash"in s?s.hash:"").slice(1)),o=document.getElementById(i);return o?[...t,{nav:s,section:o}]:t},[]),this.offset=Math.min(...this.nodes.map(t=>t.section.offsetTop)),this.detect()}activate(t){t.nav.classList.add(this.options.class)}deactivate(t){t.nav.classList.remove(this.options.class)}isVisible(t,s){const i=t.getBoundingClientRect();return s?i.bottom<window.innerHeight:i.top<=this.offset}}export{o as ScrollSpy};