{"version":3,"file":"elementIsVisibleInViewport.cjs","sources":["../../../../src/components/lib/elementIsVisibleInViewport.ts"],"sourcesContent":["/**\n * Checks if an element is visible in the viewport\n * @param el - The DOM element to check\n * @param partiallyVisible - Whether to check for partial visibility (default: false)\n * @returns True if the element is visible in the viewport\n */\nconst elementIsVisibleInViewport = (\n  el: HTMLElement,\n  partiallyVisible: boolean = false\n): boolean => {\n  const { top, left, bottom, right } = el.getBoundingClientRect();\n  const { innerHeight, innerWidth } = window;\n\n  return partiallyVisible\n    ? ((top > 0 && top < innerHeight) ||\n        (bottom > 0 && bottom < innerHeight)) &&\n        ((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth))\n    : top >= 0 && left >= 0 && bottom <= innerHeight && right <= innerWidth;\n};\n\nexport default elementIsVisibleInViewport;\n"],"names":["el","partiallyVisible","arguments","length","undefined","_el$getBoundingClient","getBoundingClientRect","top","left","bottom","right","_window","window","innerHeight","innerWidth"],"mappings":"oFAMmC,SACjCA,GAEW,IADXC,EAA4BC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GAE5BG,EAAqCL,EAAGM,wBAAhCC,EAAGF,EAAHE,IAAKC,EAAIH,EAAJG,KAAMC,EAAMJ,EAANI,OAAQC,EAAKL,EAALK,MAC3BC,EAAoCC,OAA5BC,EAAWF,EAAXE,YAAaC,EAAUH,EAAVG,WAErB,OAAOb,GACDM,EAAM,GAAKA,EAAMM,GAChBJ,EAAS,GAAKA,EAASI,KACtBL,EAAO,GAAKA,EAAOM,GAAgBJ,EAAQ,GAAKA,EAAQI,GAC5DP,GAAO,GAAKC,GAAQ,GAAKC,GAAUI,GAAeH,GAASI,CACjE"}