{"version":3,"file":"communityspecificjs.js","sources":["../../../ClientApp/src/js/components/CommunityPhotoSlideshow.ts","../../../ClientApp/src/js/components/PlatMapPopup.ts","../../../ClientApp/src/js/page/communityspecific.ts"],"sourcesContent":["import Swiper from 'swiper';\r\nimport { Navigation } from 'swiper/modules';\r\nimport { SwiperOptions } from 'swiper/types';\r\n\r\nSwiper.use([Navigation]);\r\n\r\nexport function initCommunityPhotoSlideShows() {\r\n const slideshowEls = document.querySelectorAll(\r\n '.js-community-slideshows',\r\n );\r\n\r\n const getAnimationType = () => {\r\n const width = window.innerWidth;\r\n if (width < 1024) return 'tablet'; // Tablet Down\r\n return 'desktop'; // Desktop\r\n };\r\n\r\n const slidesPer = getAnimationType() === 'tablet' ? 1 : 1.5;\r\n \r\n slideshowEls.forEach(swiperElement => {\r\n const parentElement = swiperElement.closest(\r\n '.js-community-slideshow-container',\r\n )!;\r\n const options: SwiperOptions = {\r\n slidesPerView: slidesPer, // Show a portion of the next and previous slides\r\n centeredSlides: true,\r\n spaceBetween: 10,\r\n loop: true,\r\n slideToClickedSlide: true,\r\n navigation: {\r\n nextEl: parentElement.querySelector(\r\n '.js-btn-slideshow-next',\r\n ) as HTMLElement,\r\n prevEl: parentElement.querySelector(\r\n '.js-btn-slideshow-prev',\r\n ) as HTMLElement,\r\n },\r\n };\r\n\r\n const swiper = new Swiper(swiperElement, options);\r\n swiper.update();\r\n });\r\n}\r\n","export default class PlatMap {\r\n private platMapContainerId: string;\r\n private fullPlatMapClass: string;\r\n private platInfoBoxClass: string;\r\n private btnPlatClassName: string;\r\n\r\n constructor() {\r\n this.platMapContainerId = '#js-plat-map-container';\r\n this.fullPlatMapClass = '.full-plat-map';\r\n this.platInfoBoxClass = '.plat-info-box';\r\n this.btnPlatClassName = '.js-btn-full-plat';\r\n this.init();\r\n }\r\n\r\n private init() {\r\n // Event listeners for hotspots and dotspots (SVGElements)\r\n document\r\n .querySelectorAll(\r\n `${this.fullPlatMapClass} .hotspot, ${this.fullPlatMapClass} .dotspot`\r\n )\r\n .forEach(el => {\r\n el.addEventListener('click', evt => this.handleClick(el as SVGElement, evt as MouseEvent));\r\n });\r\n\r\n // Event listener for close button (HTMLElements)\r\n document\r\n .querySelectorAll(`${this.fullPlatMapClass} .js-platmap-popup-close`)\r\n .forEach(el => {\r\n el.addEventListener('click', () => this.closeInfoBox());\r\n });\r\n\r\n // Global click event listener to close the info box if clicking outside\r\n document.addEventListener('click', (evt) => {\r\n const infoBox = document.querySelector(this.platInfoBoxClass) as HTMLElement;\r\n const target = evt.target as Node;\r\n\r\n // Close the info box if it's active and the click target is outside the info box\r\n if (infoBox.classList.contains('active') && !infoBox.contains(target) && !this.isClickOnHotspot(target)) {\r\n this.closeInfoBox();\r\n }\r\n });\r\n\r\n // Window resize event to hide info box\r\n window.addEventListener('resize', () => {\r\n document.querySelectorAll(this.platInfoBoxClass).forEach(box => box.classList.remove('active'));\r\n });\r\n }\r\n\r\n private isClickOnHotspot(target: Node): boolean {\r\n // Check if the click was on any of the hotspot elements\r\n return target instanceof SVGElement &&\r\n (target.classList.contains('hotspot') || target.classList.contains('dotspot'));\r\n }\r\n\r\n private closeInfoBox() {\r\n document.querySelectorAll(this.platInfoBoxClass).forEach(box => box.classList.remove('active'));\r\n }\r\n\r\n private handleClick(element: SVGElement | HTMLElement, evt: MouseEvent) {\r\n this.openFullPlatHotSpot(element, evt);\r\n }\r\n\r\n private openFullPlatHotSpot(element: SVGElement | HTMLElement, evt: MouseEvent) {\r\n const container = document.querySelector(`${this.platMapContainerId} .content-container`) as HTMLElement;\r\n const infoBox = document.querySelector(this.platInfoBoxClass) as HTMLElement;\r\n\r\n if (!infoBox) {\r\n console.error('Info box element not found');\r\n return; // Exit if infoBox is not found\r\n }\r\n\r\n //const position = (document.querySelector(this.platMapContainerId) as HTMLElement).getBoundingClientRect();\r\n //const ibHeight = parseInt(infoBox.clientHeight.toString()) / 2;\r\n //const ibWidth = parseInt(infoBox.clientWidth.toString());\r\n\r\n //const relativeX = evt.pageX - position.left;\r\n //const relativeY = evt.pageY - position.top;\r\n\r\n //const newLeftPos = relativeX - ibWidth;\r\n //let newTopPos = relativeY - ibHeight - 10;\r\n\r\n //// Adjust the position of the info box to stay within the container bounds\r\n //const containerBottom = position.bottom;\r\n //const infoBoxBottom = newTopPos + ibHeight;\r\n\r\n //if (infoBoxBottom > containerBottom) {\r\n // newTopPos = containerBottom - ibHeight; // Set to bottom of the container\r\n //}\r\n\r\n //// Set new position\r\n //infoBox.style.top = `${newTopPos}px`;\r\n //infoBox.style.left = `${newLeftPos}px`;\r\n\r\n const dataUrl = (document.querySelector(this.platMapContainerId) as HTMLElement).dataset.url + element.id;\r\n\r\n container.classList.add('blur');\r\n \r\n // Add 'active' class to the info box\r\n infoBox.classList.add('active');\r\n\r\n // Fetch request for loading content\r\n fetch(dataUrl, {\r\n method: 'GET',\r\n headers: { 'Content-Type': 'text/html' },\r\n cache: 'no-cache',\r\n })\r\n .then(response => response.text())\r\n .then(result => {\r\n container.innerHTML = result;\r\n })\r\n .catch(error => {\r\n console.error('Error fetching data:', error);\r\n container.innerHTML = '
Error loading content
';\r\n }).finally(() => {\r\n container.classList.remove('blur');\r\n });\r\n }\r\n}\r\n","import StickyNav from '../components/StickyNav';\r\nimport QuickViewModal from '../components/QuickViewModal';\r\nimport { initMap } from '../components/CommunityMap';\r\nimport HFSPanels from '../components/HFSPanels';\r\nimport Panels from '../components/Panels';\r\nimport { initCommunityPhotoSlideShows } from '../components/CommunityPhotoSlideshow';\r\nimport LightBox from '../components/LightBox';\r\nimport HFSGridFilter from '../components/HFSGridFilter';\r\nimport PlatMap from '../components/PlatMapPopup';\r\n\r\ndocument.addEventListener('DOMContentLoaded', () => {\r\n //sticky nav init\r\n StickyNav().init();\r\n\r\n //quick view init\r\n const quickviewModal = QuickViewModal('js-quickview-modal');\r\n\r\n //init panels\r\n HFSPanels('js-hfs-panels');\r\n Panels('js-community-features-panels');\r\n Panels('js-community-location-panels');\r\n //init community slideshow\r\n initCommunityPhotoSlideShows();\r\n LightBox();\r\n new HFSGridFilter();\r\n new PlatMap();\r\n});\r\n\r\nwindow.addEventListener('load', () => {\r\n //initialize map\r\n initMap().catch(error => {\r\n console.error('Failed to initialize map:', error);\r\n });\r\n});\r\n"],"names":["Swiper","Navigation","initCommunityPhotoSlideShows","slideshowEls","slidesPer","swiperElement","parentElement","options","PlatMap","__publicField","el","evt","infoBox","target","box","element","container","dataUrl","response","result","error","StickyNav","QuickViewModal","HFSPanels","Panels","LightBox","HFSGridFilter","initMap"],"mappings":"utBAIAA,EAAO,IAAI,CAACC,CAAU,CAAC,EAEhB,SAASC,GAA+B,CAC3C,MAAMC,EAAe,SAAS,iBAC1B,0BAAA,EASEC,GALY,OAAO,WACT,KAAa,SAClB,aAG8B,SAAW,EAAI,IAExDD,EAAa,QAAyBE,GAAA,CAClC,MAAMC,EAAgBD,EAAc,QAChC,mCAAA,EAEEE,EAAyB,CAC3B,cAAeH,EACf,eAAgB,GAChB,aAAc,GACd,KAAM,GACN,oBAAqB,GACrB,WAAY,CACR,OAAQE,EAAc,cAClB,wBACJ,EACA,OAAQA,EAAc,cAClB,wBACJ,CACJ,CAAA,EAGW,IAAIN,EAAOK,EAAeE,CAAO,EACzC,OAAO,CAAA,CACjB,CACL,CC1CA,MAAqBC,CAAQ,CAMzB,aAAc,CALNC,EAAA,2BACAA,EAAA,yBACAA,EAAA,yBACAA,EAAA,yBAGJ,KAAK,mBAAqB,yBAC1B,KAAK,iBAAmB,iBACxB,KAAK,iBAAmB,iBACxB,KAAK,iBAAmB,oBACxB,KAAK,KAAK,CACd,CAEQ,MAAO,CAGN,SAAA,iBACG,GAAG,KAAK,gBAAgB,cAAc,KAAK,gBAAgB,WAAA,EAE9D,QAAcC,GAAA,CACXA,EAAG,iBAAiB,QAASC,GAAO,KAAK,YAAYD,EAAkBC,CAAiB,CAAC,CAAA,CAC5F,EAGL,SACK,iBAAiB,GAAG,KAAK,gBAAgB,0BAA0B,EACnE,QAAcD,GAAA,CACX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