{"version":3,"file":"staticv2-BI5jTAZ3.js","sources":["../../../app/javascript/entrypoints/staticv2.js"],"sourcesContent":["import { Application } from \"@hotwired/stimulus\";\n\nimport Swiper_controller from \"./controllers/swiper_controller.js\";\nimport Accordion_controller from \"./controllers/ui/accordion_controller.js\";\nimport Dropdown_controller from \"./controllers/ui/dropdown_controller.js\";\nimport Dropdownv2_controller from \"./controllers/ui/dropdownv2_controller.js\";\nimport Mobile_menu_controller from \"./controllers/mobile_menu_controller.js\";\nimport Nouislider_controller from \"./controllers/nouislider_controller.js\";\n\nconst application = Application.start();\n\napplication.register(\"swiper\", Swiper_controller);\napplication.register(\"ui--accordion\", Accordion_controller);\napplication.register(\"ui--popover\", Dropdown_controller);\napplication.register(\"ui--dropdownv2\", Dropdownv2_controller);\napplication.register(\"mobile-menu\", Mobile_menu_controller);\napplication.register(\"nouislider\", Nouislider_controller);\n\nconsole.log(\"Staticv2 loaded with selected controllers\");\n\n// Lazy Load Images when the page is loaded or navigated with Turbo\nfunction initializeLazyLoad() {\n document.removeEventListener('DOMContentLoaded', initializeLazyLoad)\n\n // Select all images with the data-lazy attribute\n const lazyImages = document.querySelectorAll('img[data-lazy]');\n\n // IntersectionObserver options\n const options = {\n root: null, // Use the viewport as the root\n rootMargin: '0px 0px 600px 0px', // Load images just before they enter the viewport\n threshold: 0.1 // Trigger when 10% of the image is visible\n };\n\n // IntersectionObserver callback function\n function onIntersection(entries, observer) {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n const img = entry.target;\n const imgSrc = img.getAttribute('data-src');\n\n // Set the actual image source\n img.setAttribute('src', imgSrc);\n\n // Remove data-lazy attribute after loading the image\n img.removeAttribute('data-lazy');\n img.removeAttribute('data-src');\n\n // Stop observing this image once it's loaded\n observer.unobserve(img);\n }\n });\n }\n\n // Create the IntersectionObserver\n const observer = new IntersectionObserver(onIntersection, options);\n\n // Observe each lazy image\n lazyImages.forEach(image => {\n observer.observe(image);\n });\n}\n\n// Run the lazy load script on the document load event\ndocument.addEventListener('DOMContentLoaded', initializeLazyLoad);\ndocument.addEventListener('turbo:render', initializeLazyLoad)\n\nconsole.log(\"Lazy loading initialized.\");\n"],"names":["application","Application","Swiper_controller","Accordion_controller","Dropdown_controller","Dropdownv2_controller","Mobile_menu_controller","Nouislider_controller","initializeLazyLoad","lazyImages","options","onIntersection","entries","observer","entry","img","imgSrc","image"],"mappings":"8ZASA,MAAMA,EAAcC,EAAY,QAEhCD,EAAY,SAAS,SAAUE,CAAiB,EAChDF,EAAY,SAAS,gBAAiBG,CAAoB,EAC1DH,EAAY,SAAS,cAAeI,CAAmB,EACvDJ,EAAY,SAAS,iBAAkBK,CAAqB,EAC5DL,EAAY,SAAS,cAAeM,CAAsB,EAC1DN,EAAY,SAAS,aAAcO,CAAqB,EAExD,QAAQ,IAAI,2CAA2C,EAGvD,SAASC,GAAqB,CAC1B,SAAS,oBAAoB,mBAAoBA,CAAkB,EAGnE,MAAMC,EAAa,SAAS,iBAAiB,gBAAgB,EAGvDC,EAAU,CACZ,KAAM,KACN,WAAY,oBACZ,UAAW,EACnB,EAGI,SAASC,EAAeC,EAASC,EAAU,CACvCD,EAAQ,QAAQE,GAAS,CACrB,GAAIA,EAAM,eAAgB,CACtB,MAAMC,EAAMD,EAAM,OACZE,EAASD,EAAI,aAAa,UAAU,EAG1CA,EAAI,aAAa,MAAOC,CAAM,EAG9BD,EAAI,gBAAgB,WAAW,EAC/BA,EAAI,gBAAgB,UAAU,EAG9BF,EAAS,UAAUE,CAAG,CACzB,CACb,CAAS,CACJ,CAGD,MAAMF,EAAW,IAAI,qBAAqBF,EAAgBD,CAAO,EAGjED,EAAW,QAAQQ,GAAS,CACxBJ,EAAS,QAAQI,CAAK,CAC9B,CAAK,CACL,CAGA,SAAS,iBAAiB,mBAAoBT,CAAkB,EAChE,SAAS,iBAAiB,eAAgBA,CAAkB,EAE5D,QAAQ,IAAI,2BAA2B"}