import{a as _}from"./index.684c656d.js";import{u as d}from"./ScrollTo.81bea8a7.js";import{g as h,r as m}from"./params.af7ed354.js";import{l as T,m as f,v as A}from"./runtime-dom.esm-bundler.d8b05b6d.js";const H=(p={})=>{const{scrollTimeout:r=500,highlightTimeout:v=500,scrollAndHighlightTimeout:y=1500}=p,t=T(!1),o=_();f(()=>o.navigate.scroll,()=>{t.value||(t.value=!0,l())}),f(()=>o.navigate.highlight,()=>{t.value||(t.value=!0,l())});const l=()=>{var n,a;const e=h()["aioseo-scroll"]||((n=history.state)==null?void 0:n.scroll)||o.navigate.scroll;e&&typeof e=="string"&&setTimeout(()=>{var s;d().scrollTo(e,{mods:{scrollMarginClass:"aioseo-scroll-and-highlight-margin",timeout:r}}),m("aioseo-scroll"),(s=history.state)==null||delete s.scroll,o.navigate.scroll=null,t.value=!1},r);const i=h()["aioseo-highlight"]||((a=history.state)==null?void 0:a.highlight)||o.navigate.highlight;i&&typeof i=="string"&&setTimeout(()=>{var c;const u=document.querySelectorAll(`#${i.replace(/,/g,", #").replace(/%2C/ig,", #")}`);u.length&&u.forEach(g=>{g.classList.add("aioseo-row-highlight"),setTimeout(()=>{g.classList.remove("aioseo-row-highlight")},1500)}),m("aioseo-highlight"),(c=history.state)==null||delete c.highlight,o.navigate.highlight=null,t.value=!1},e?y:v)};A(l)};export{H as u};
