const c="pz-scroll-to-highlight",f="smooth",s=o=>typeof o=="number"?{offsetTop:o}:o??{},u=o=>{if(typeof window>"u"||typeof document>"u")return null;if(typeof o=="number")return o;const t=typeof o=="string"?document.querySelector(o):o instanceof HTMLElement?o:null;return t?window.scrollY+t.getBoundingClientRect().top:null},l=(o,t)=>{if(!o||typeof window>"u")return;const n=t.highlightClassName??c,e=t.highlightDuration??2e3;n&&(o.classList.add(n),window.setTimeout(()=>{o.classList.remove(n)},e))};class i{static moveById(t,n){if(typeof document>"u")return!1;const e=document.getElementById(t);if(!e)return!1;const r=i.moveToElement(e,n);return r&&l(e,s(n)),r}static moveToTop(t){return i.moveTo(0,t)}static moveTo(t,n){if(typeof window>"u")return!1;const e=s(n);return window.scrollTo({top:Math.max(t-(e.offsetTop??0),0),left:0,behavior:e.behavior??f}),!0}static moveByQuerySelector(t,n){if(typeof document>"u")return!1;const e=document.querySelector(t);if(!e)return!1;const r=i.moveToElement(e,n);return r&&l(e,s(n)),r}static moveToElement(t,n){const e=u(t);return e===null?!1:i.moveTo(e,n)}static move(t,n){const e=u(t);return e===null?!1:i.moveTo(e,n)}}export{i as P};
