{"version":3,"file":"scroll.js","names":["mobileScrollDisable","document","documentElement","classList","add","mobileScrollEnable","remove","scrollTo","element","scrollTopOffset","snapDirection","getElementCoords","getBoundingClientRect","topCoordCalc","window","scrollY","top","topCoord","leftCoord","scrollX","left","scroll","setters","execute"],"sources":["toolbox/scroll.js"],"sourcesContent":["/**\n * Perform necessary DOM modifications in order to prevent main content scrolling when a full-screen overlay is opened.\n *\n * It's recommended to use this functionality for iOS platform related issues caused by fixed full-screen overlay\n *\n */\nexport function mobileScrollDisable() {\n document.documentElement.classList.add('m-prevent-mobile-scroll');\n}\n\n/**\n * Perform necessary DOM modifications in order to enable main content scrolling when a full-screen overlay is closed.\n *\n * It's recommended to use this functionality for iOS platform related issues caused by fixed full-screen overlay\n *\n */\nexport function mobileScrollEnable() {\n document.documentElement.classList.remove('m-prevent-mobile-scroll');\n}\n\n/**\n * Function for scroll\n * @param {String|HTMLElement} element element you want to scroll to\n * @param {String|HTMLElement} scrollTopOffset fixed header navigation height\n * @param {String} snapDirection - set to 'vertical' or 'horizontal' to scroll only on one axis\n */\nexport function scrollTo(element, scrollTopOffset, snapDirection) {\n if (element) {\n const getElementCoords = element.getBoundingClientRect();\n const topCoordCalc = (window.scrollY + getElementCoords.top) - (scrollTopOffset || 0);\n const topCoord = snapDirection === 'horizontal' ? window.scrollY : topCoordCalc;\n const leftCoord = snapDirection === 'vertical' ? window.scrollX : getElementCoords.left;\n\n window.scroll(leftCoord, topCoord);\n }\n}\n"],"mappings":"uFAMO,QAAAA,CAAA,CAA+B,CAClCC,QAAQ,CAACC,eAAe,CAACC,SAAS,CAACC,GAAG,CAAC,yBAAyB,CACpE,CAAC,CAAAC,kBAAA,CAQM,QAAAA,CAAA,CAA8B,CACjCJ,QAAQ,CAACC,eAAe,CAACC,SAAS,CAACG,MAAM,CAAC,yBAAyB,CACvE,CAAC,CAAAC,QAAA,CAQM,QAAAA,CAAkBC,CAAO,CAAEC,CAAe,CAAEC,CAAa,CAAE,CAC9D,GAAIF,CAAO,CAAE,MACH,CAAAG,CAAgB,CAAGH,CAAO,CAACI,qBAAqB,CAAC,CAAC,CAClDC,CAAY,CAAIC,MAAM,CAACC,OAAO,CAAGJ,CAAgB,CAACK,GAAG,EAAKP,CAAe,EAAI,CAAC,CAAC,CAC/EQ,CAAQ,CAAqB,YAAY,GAA9BP,CAA8B,CAAGI,MAAM,CAACC,OAAO,CAAGF,CAAY,CACzEK,CAAS,CAAqB,UAAU,GAA5BR,CAA4B,CAAGI,MAAM,CAACK,OAAO,CAAGR,CAAgB,CAACS,IAAI,CAEvFN,MAAM,CAACO,MAAM,CAACH,CAAS,CAAED,CAAQ,CACrC,CACJ,CAAC,IAAAK,OAAA,IAAAC,OAAA,SAAAA,CAAA","ignoreList":[]}