{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/helpers/motion.js","webpack://@verndale/toolkit/./src/js/modules/CardRowSwiper.js"],"names":[],"mappings":"qYAEO,KAAM,GAAO,CAAC,EAAS,EAAW,EAAG,EAAS,CAAC,IAAM,EAAG,IAAM,KACnE,QACE,EACA,CACE,UAAW,GAAG,EAAQ,iBACtB,QAAS,GAEX,CACE,WACA,WAIO,EAAQ,CAAC,EAAS,EAAW,EAAG,EAAS,CAAC,IAAM,EAAG,IAAM,KACpE,QACE,EACA,CACE,UAAW,EACX,QAAS,GAEX,CACE,WACA,WAIO,EAAc,CACzB,EACA,EAAW,EACX,EAAQ,EACR,EAAS,CAAC,IAAM,EAAG,IAAM,KAEzB,QACE,EACA,CACE,QAAS,GAEX,CACE,WACA,QACA,WAIO,EAAc,CACzB,EACA,EAAW,EACX,EAAQ,EACR,EAAS,CAAC,IAAM,EAAG,IAAM,KAEzB,QACE,EACA,CACE,QAAS,GAEX,CACE,WACA,QACA,WAIO,EAAO,CAClB,EACA,EAAW,EACX,EAAQ,EACR,EAAS,CAAC,IAAM,EAAG,IAAM,KAEzB,QACE,EACA,CACE,aAAc,SAEhB,CACE,WACA,QACA,WAIO,EAAO,CAClB,EACA,EAAe,EACf,EAAW,EACX,EAAQ,EACR,EAAS,CAAC,IAAM,EAAG,IAAM,KAEzB,QACE,EACA,CACE,gBAEF,CACE,WACA,QACA,WAIO,EAAiB,CAC5B,EACA,EAAQ,GACR,EAAW,GACX,EAAS,CAAC,IAAM,EAAG,GAAK,KAExB,QACE,EACA,CACE,QAAS,EACT,WAAY,GAEd,CACE,QACA,WACA,WAIO,EAAc,CACzB,EACA,EAAQ,GACR,EAAW,GACX,EAAS,CAAC,IAAM,EAAG,GAAK,KAExB,QACE,EACA,CACE,QAAS,EACT,WAAY,IAEd,CACE,QACA,WACA,WAIO,EAAc,CACzB,EACA,EAAQ,GACR,EAAW,GACX,EAAS,CAAC,IAAM,EAAG,GAAK,KAExB,QACE,EACA,CACE,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B,UAC5B,MAAK,IAAI,iBAAiB,UAAU,OAAO,iBAC3C,KAAK,IAAI,iBAAiB,QAI9B,6BAA6B,EAAQ,CACnC,KAAK,IAAI,aAAa,QAAQ,CAAC,EAAS,IAAU,CAChD,GACW,EAAO,aAChB,EAAQ,EAAO,YAAc,KAAK,cAE7B,MAAK,WACJ,GAAQ,KACV,GAAQ,KAAK,OACb,sBAAsB,IAAM,CAC1B,EAAQ,MAAM,WAAa,UAC3B,EAAQ,KAAO,SAAY,EAAS,MAGtC,GAAQ,MAAM,WAAa,UAC3B,EAAQ,KAAO,SAAY,EAAS,QAM5C,KAAK,uBAGP,iCAAiC,EAAQ,CACvC,KAAK,IAAI,aAAa,QAAQ,CAAC,EAAS,IAAU,CAChD,GACU,EAAO,aACf,GAAS,EAAO,YAAc,KAAK,eAE/B,GAAQ,MAAM,EAAQ,KAAK,OAC1B,KAAK,WACJ,MAAK,KAEL,EAAO,YACP,KAAK,IAAI,aAAa,OAAS,KAAK,MAAM,KAAK,eAE/C,GAAQ,KAAO,SAAY,EAAS,EAAG,IACvC,EAAQ,KAAK,SAAS,KAAK,IAAM,CAC/B,EAAQ,MAAM,WAAa,YAI/B,GAAQ,KAAO,SAAY,EAAS,EAAG,IACvC,EAAQ,KAAK,SAAS,KAAK,IAAM,CAC/B,EAAQ,MAAM,WAAa,iBASzC,UAAe","file":"scripts/5808.ad4475a56a46b5c533e1.js","sourcesContent":["import { animate } from 'motion';\n\nexport const open = (element, duration = 1, easing = [0.19, 1, 0.22, 1]) =>\n animate(\n element,\n {\n maxHeight: `${element.scrollHeight}px`,\n opacity: 1\n },\n {\n duration,\n easing\n }\n );\n\nexport const close = (element, duration = 1, easing = [0.19, 1, 0.22, 1]) =>\n animate(\n element,\n {\n maxHeight: 0,\n opacity: 0\n },\n {\n duration,\n easing\n }\n );\n\nexport const hideOpacity = (\n element,\n duration = 1,\n delay = 0,\n easing = [0.19, 1, 0.22, 1]\n) =>\n animate(\n element,\n {\n opacity: 0\n },\n {\n duration,\n delay,\n easing\n }\n );\n\nexport const showOpacity = (\n element,\n duration = 1,\n delay = 0,\n easing = [0.19, 1, 0.22, 1]\n) =>\n animate(\n element,\n {\n opacity: 1\n },\n {\n duration,\n delay,\n easing\n }\n );\n\nexport const show = (\n element,\n duration = 1,\n delay = 0,\n easing = [0.19, 1, 0.22, 1]\n) =>\n animate(\n element,\n {\n maxBlockSize: 'unset'\n },\n {\n duration,\n delay,\n easing\n }\n );\n\nexport const hide = (\n element,\n maxBlockSize = 0,\n duration = 1,\n delay = 0,\n easing = [0.19, 1, 0.22, 1]\n) =>\n animate(\n element,\n {\n maxBlockSize\n },\n {\n duration,\n delay,\n easing\n }\n );\n\nexport const showFromBottom = (\n element,\n delay = 0.2,\n duration = 0.2,\n easing = [0.11, 0, 0.5, 0]\n) =>\n animate(\n element,\n {\n opacity: 1,\n translateY: 0\n },\n {\n delay,\n duration,\n easing\n }\n );\n\nexport const hideFromTop = (\n element,\n delay = 0.2,\n duration = 0.2,\n easing = [0.11, 0, 0.5, 0]\n) =>\n animate(\n element,\n {\n opacity: 0,\n translateY: 30\n },\n {\n delay,\n duration,\n easing\n }\n );\n\nexport const hideToRight = (\n element,\n delay = 0.2,\n duration = 0.2,\n easing = [0.11, 0, 0.5, 0]\n) =>\n animate(\n element,\n {\n opacity: 0,\n translateX: 90\n },\n {\n delay,\n duration,\n easing\n }\n );\n\nexport const hideToLeft = (\n element,\n delay = 0.2,\n duration = 0.2,\n easing = [0.11, 0, 0.5, 0]\n) =>\n animate(\n element,\n {\n opacity: 0,\n translateX: -90\n },\n {\n delay,\n duration,\n easing\n }\n );\n","import { Component } from '@verndale/core';\nimport Swiper, { Navigation, Pagination, A11y } from 'swiper';\nimport { hideOpacity, showOpacity } from '../helpers/motion';\n\nSwiper.use([Navigation, Pagination, A11y]);\n\nclass CardRow extends Component {\n setupDefaults() {\n this.dom = {\n swiperContainer: this.el.querySelector('.card-row__swiper-container'),\n swiperSlides: Array.from(\n this.el.querySelector('.swiper-wrapper').children\n ),\n swiperPagination: this.el.querySelector('.card-row__swiper-pagination'),\n swiperButtonPrev: this.el.querySelector('.card-row__swiper-btn-prev'),\n swiperButtonNext: this.el.querySelector('.card-row__swiper-btn-next'),\n swiperControls: this.el.querySelector('.card-row__swiper-controls'),\n homeSwiperControls: this.el.querySelector('.home-tab-content__controls')\n };\n\n this.dom.swiperSlides.forEach(card => {\n card.classList.add('swiper-slide');\n });\n\n this.desktopCards =\n this.dom.swiperSlides.length > 4 ? 4 : this.dom.swiperSlides.length;\n this.tabletCards = this.desktopCards > 2 ? 2 : this.desktopCards;\n this.currentBreakpoint = 'desktop';\n this.visibleCards = this.desktopCards;\n this.isEditing = this.el.dataset.isEditing;\n\n if (this.el.dataset.home) {\n this.home = true;\n this.tabletCards = 1.5;\n this.desktopCards = 2.5;\n this.currentBreakpoint = 'desktop';\n this.visibleCards = this.desktopCards + 0.5;\n }\n\n this.initSlider();\n this.handleResize();\n if (!this.isEditing) {\n this.handleSlideChangeTransitionStart(this.swiper);\n this.handleSlideActiveIndexChange(this.swiper);\n }\n }\n\n hideArrows(isLocked) {\n const controls = this.dom.homeSwiperControls || this.dom.swiperControls;\n if (isLocked && controls) {\n controls.style.display = 'none';\n return;\n }\n\n if (!isLocked && controls) {\n controls.style.removeProperty('display');\n }\n }\n\n initSlider() {\n const context = this;\n\n this.swiper = new Swiper(this.dom.swiperContainer, {\n speed: 1000,\n spaceBetween: 40,\n autoHeight: false,\n centeredSlides: true,\n slidesPerView: 1,\n slidesPerGroup: 1,\n breakpoints: {\n 768: {\n slidesPerView: this.tabletCards,\n speed: 1500,\n spaceBetween: 20,\n centeredSlides: false\n },\n 1440: {\n slidesPerView: this.desktopCards,\n speed: 1500,\n spaceBetween: 20,\n centeredSlides: false\n }\n },\n pagination: {\n el: this.dom.swiperPagination\n },\n navigation: {\n prevEl: this.dom.swiperButtonPrev,\n nextEl: this.dom.swiperButtonNext\n },\n a11y: {\n prevSlideMessage: this.el.dataset.previousSlideAriaLabel,\n nextSlideMessage: this.el.dataset.nextSlideAriaLabel\n },\n on: {\n resize(swiper) {\n context.hideArrows(swiper.isLocked);\n }\n }\n });\n }\n\n addListeners() {\n this.swiper.on(\n 'activeIndexChange',\n this.handleSlideActiveIndexChange.bind(this)\n );\n this.swiper.on(\n 'slideChangeTransitionStart',\n this.handleSlideChangeTransitionStart.bind(this)\n );\n this.swiper.on('resize', this.handleResize.bind(this));\n }\n\n handleResize() {\n let breakpoint = false;\n switch (this.swiper.currentBreakpoint) {\n case '768':\n if (this.currentBreakpoint !== 'tablet') {\n this.currentBreakpoint = 'tablet';\n this.visibleCards = this.tabletCards;\n breakpoint = true;\n }\n break;\n\n case '1440':\n if (this.currentBreakpoint !== 'desktop') {\n this.currentBreakpoint = 'desktop';\n this.visibleCards = this.desktopCards;\n breakpoint = true;\n }\n break;\n\n default:\n if (this.currentBreakpoint !== 'mobile') {\n this.currentBreakpoint = 'mobile';\n this.visibleCards = 1;\n breakpoint = true;\n }\n break;\n }\n\n if (this.dom.swiperSlides.length <= this.visibleCards) {\n if (!this.isEditing) {\n this.dom.swiperButtonNext.parentNode.style.display = 'none';\n }\n }\n\n if (breakpoint) {\n if (!this.isEditing) {\n this.handleSlideChangeTransitionStart(this.swiper);\n this.handleSlideActiveIndexChange(this.swiper);\n }\n }\n }\n\n checkNavigationState() {\n if (this.dom.swiperButtonNext.disabled) {\n this.dom.swiperButtonNext.classList.remove('focus-visible');\n this.dom.swiperButtonNext.blur();\n }\n if (this.dom.swiperButtonPrev.disabled) {\n this.dom.swiperButtonPrev.classList.remove('focus-visible');\n this.dom.swiperButtonPrev.blur();\n }\n }\n\n handleSlideActiveIndexChange(swiper) {\n this.dom.swiperSlides.forEach((element, index) => {\n if (\n index >= swiper.activeIndex &&\n index < swiper.activeIndex + this.visibleCards\n ) {\n if (!this.isEditing) {\n if (element.anim) {\n element.anim.stop();\n requestAnimationFrame(() => {\n element.style.visibility = 'visible';\n element.anim = showOpacity(element, 1);\n });\n } else {\n element.style.visibility = 'visible';\n element.anim = showOpacity(element, 1);\n }\n }\n }\n });\n\n this.checkNavigationState();\n }\n\n handleSlideChangeTransitionStart(swiper) {\n this.dom.swiperSlides.forEach((element, index) => {\n if (\n index < swiper.activeIndex ||\n index >= swiper.activeIndex + this.visibleCards\n ) {\n if (element.anim) element.anim.stop();\n if (!this.isEditing) {\n if (this.home) {\n if (\n swiper.activeIndex <\n this.dom.swiperSlides.length - Math.floor(this.visibleCards)\n ) {\n element.anim = hideOpacity(element, 1, 0.5);\n element.anim.finished.then(() => {\n element.style.visibility = 'hidden';\n });\n }\n } else {\n element.anim = hideOpacity(element, 1, 0.5);\n element.anim.finished.then(() => {\n element.style.visibility = 'hidden';\n });\n }\n }\n }\n });\n }\n}\n\nexport default CardRow;\n"],"sourceRoot":""}