"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isIE11=exports.scrollToLocationHashId=exports.applyPageFocus=exports.setPageFocusElement=void 0,require("core-js/modules/es6.regexp.replace"),require("core-js/modules/es7.array.includes"),require("core-js/modules/es6.string.includes");var pageFocusElements={},setPageFocusElement=function(e){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"default";pageFocusElements[o]=e};exports.setPageFocusElement=setPageFocusElement;var applyPageFocus=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"default";try{var o=pageFocusElements[e];"string"==typeof o&&"undefined"!=typeof document?o=document.querySelector(o):o||"undefined"==typeof document||(o=document.querySelector(".dnb-no-focus")),o instanceof HTMLElement&&(["h1","h2","h3","h4","h5","h6","p","div","main","nav","header","footer","aside","section","article"].includes(String(o.nodeName).toLowerCase())&&(o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.classList&&!o.classList.contains("dnb-no-focus")&&o.classList.add("dnb-no-focus")),o.focus({preventScroll:!0}))}catch(e){console.log("Error on applyPageFocus:",e)}};exports.applyPageFocus=applyPageFocus;var scrollToLocationHashId=function(){var e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).offset,o=void 0===e?0:e;if("undefined"!=typeof document&&"undefined"!=typeof window){var t=String(window.location.hash).replace("#",""),s=document.getElementById(t);if(s instanceof HTMLElement){var n=parseFloat(s.offsetTop)-o;try{window.scrollTop=n,window.scrollTo({top:n,behavior:"smooth"})}catch(e){console.log("Error on scrollToLocationHashId:",e)}}}};exports.scrollToLocationHashId=scrollToLocationHashId;var isIE11="undefined"!=typeof window&&"undefined"!=typeof document&&(!!window.MSInputMethodContext&&!!document.documentMode);exports.isIE11=isIE11;
//# sourceMappingURL=helpers.js.map
