"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const react_1=require("react"),react_router_dom_1=require("react-router-dom"),theme_1=require("@redocly/theme"),useAutoScroll_1=require("../Content/useAutoScroll");function useScrollOnRender(e,r){const t=(0,react_1.useRef)(null),o=(0,react_router_dom_1.useLocation)(),l=(0,theme_1.removeLeadingSlash)(o.pathname.replace(r,""));return(0,react_1.useEffect)((()=>{var r;if(t.current&&e.href&&(0,theme_1.removeLeadingSlash)(e.href)===l&&("function"==typeof(null===(r=null==t?void 0:t.current)||void 0===r?void 0:r.scrollIntoView)&&t.current.scrollIntoView(),o.hash)){const e=(0,useAutoScroll_1.getElementById)(o.hash.replace("#","").toLowerCase());e&&e.scrollIntoView()}}),[]),t}exports.default=useScrollOnRender;
//# sourceMappingURL=useScrollOnRender.js.map