"use strict";var React=require("react");const useScrollPercentage=e=>{let[t,r]=React.useState(0),c=React.useCallback(t=>{if(e)return;let c=document.documentElement.scrollHeight-document.documentElement.clientHeight,n=t.currentTarget.scrollY;try{React.startTransition(()=>{r(Math.ceil(n/c*100))})}catch{React.startTransition(()=>{r(0)})}},[e]);return React.useEffect(()=>(window.addEventListener("scroll",c),()=>{window.removeEventListener("scroll",c)}),[c]),t};exports.useScrollPercentage=useScrollPercentage;
