{"version":3,"file":"get-scrollbar-width.js","sources":["../../../../../KNHS.Website.Frontend/script/helpers/get-scrollbar-width.ts"],"sourcesContent":["export const getScrollbarWidth = () => {\n // Create a temporary div container and append it into the body\n const container = document.createElement('div');\n // Append the container in the body\n document.body.appendChild(container);\n // Force scrollbar on the container\n container.style.overflow = 'scroll';\n\n // Add ad fake div inside the container\n const inner = document.createElement('div');\n container.appendChild(inner);\n\n // Calculate the width based on the container width minus its child width\n const width = container.offsetWidth - inner.offsetWidth;\n // Remove the container from the body\n document.body.removeChild(container);\n\n return width;\n};\n\n// Get the scrollbar dimension\nconst scrollbarWidth = getScrollbarWidth();\n// Set a custom property with the value we calculated\ndocument.documentElement.style.setProperty('--scrollbar', `${scrollbarWidth}px`);\n"],"names":["getScrollbarWidth","container","inner","width","scrollbarWidth"],"mappings":"AAAO,MAAMA,EAAoB,IAAM,CAE7B,MAAAC,EAAY,SAAS,cAAc,KAAK,EAErC,SAAA,KAAK,YAAYA,CAAS,EAEnCA,EAAU,MAAM,SAAW,SAGrB,MAAAC,EAAQ,SAAS,cAAc,KAAK,EAC1CD,EAAU,YAAYC,CAAK,EAGrB,MAAAC,EAAQF,EAAU,YAAcC,EAAM,YAEnC,gBAAA,KAAK,YAAYD,CAAS,EAE5BE,CACX,EAGMC,EAAiBJ,EAAkB,EAEzC,SAAS,gBAAgB,MAAM,YAAY,cAAe,GAAGI,KAAkB"}