{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/modules/community-landing-masthead.js"],"names":["Module","Component","el","i","Swiper","index","$thumb","shouldAddClass"],"mappings":"uKAGA,MAAMA,UAAeC,WAAU,CAC7B,eAAgB,CACd,KAAK,IAAM,CACT,UAAW,KAAK,GAAG,GAAG,uCAAuC,EAC7D,OAAQ,KAAK,GAAG,IAAI,oCAAoC,CAC1D,EAEA,KAAK,OACL,KAAK,iBAAmB,4CACxB,KAAK,eAAe,CAAC,EACrB,KAAK,WAAW,CAClB,CAEA,cAAe,CACb,KAAK,OAAO,GAAG,oBAAqB,KAAK,kBAAkB,KAAK,IAAI,CAAC,EACrE,KAAK,IAAI,OAAO,QAAQ,CAACC,EAAIC,IAAMD,EAAG,IAAI,QAAS,KAAK,iBAAiB,KAAK,KAAMC,CAAC,CAAC,CAAC,CACzF,CAEA,YAAa,CACX,KAAK,OAAS,IAAIC,KAAO,KAAK,IAAI,UAAW,CAC3C,WAAY,EACd,CAAC,CACH,CAEA,iBAAiBC,EAAO,CACtB,KAAK,OAAO,QAAQA,CAAK,CAC3B,CAEA,mBAAoB,CAClB,KAAK,eAAe,KAAK,OAAO,WAAW,CAC7C,CAEA,eAAeA,EAAO,CACpB,KAAK,IAAI,OAAO,QAAQ,CAACC,EAAQH,IAAM,CACrC,MAAMI,EAAiBF,IAAUF,EACjCG,EAAO,UAAU,OAAO,KAAK,iBAAkBC,CAAc,CAC/D,CAAC,CACH,CACF,CAEA,UAAeP,C","file":"Areas/SunriseSeniorLiving/Scripts/9725.3d0640e4d225436f6f2f.bundle.js","sourcesContent":["import { Component } from '@verndale/core';\nimport Swiper from 'swiper';\n\nclass Module extends Component {\n  setupDefaults() {\n    this.dom = {\n      $previews: this.el._$('.community-landing-masthead__previews'),\n      $thumb: this.el._$$('.community-landing-masthead__thumb')\n    };\n\n    this.slider;\n    this.activeThumbClass = 'community-landing-masthead__thumb--active';\n    this.setActiveThumb(0);\n    this.initSlider();\n  }\n\n  addListeners() {\n    this.slider.on('activeIndexChange', this.handleSlideChange.bind(this));\n    this.dom.$thumb.forEach((el, i) => el._on('click', this.handleThumbClick.bind(this, i)));\n  }\n\n  initSlider() {\n    this.slider = new Swiper(this.dom.$previews, {\n      autoHeight: true\n    });\n  }\n\n  handleThumbClick(index) {\n    this.slider.slideTo(index);\n  }\n\n  handleSlideChange() {\n    this.setActiveThumb(this.slider.activeIndex);\n  }\n\n  setActiveThumb(index) {\n    this.dom.$thumb.forEach(($thumb, i) => {\n      const shouldAddClass = index === i;\n      $thumb.classList.toggle(this.activeThumbClass, shouldAddClass);\n    });\n  }\n}\n\nexport default Module;\n"],"sourceRoot":""}