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ED,YACEqB,EAAAA,EAAAA,GAAGjC,KAAKK,WAAY,UAAWL,KAAKkC,YAAYC,KAAKnC,MACvD,GAAC,CAAAW,IAAA,cAAAC,MAED,SAAYwB,GACV,IAAMC,EAAQD,EAAME,OAAOC,QAAQC,MAC/BH,GAASrC,KAAKwB,UAChBxB,KAAKwB,SAASiB,KAAKJ,EAEvB,M,6EAAC,CA3FsB,GA8FzB,W","sources":["webpack://@upstatement/harvard-law-school-wp-theme/./static/js/components/visual-cards-carousel.js"],"sourcesContent":["import { tns } from 'tiny-slider/src/tiny-slider';\nimport { on } from '@src/utils';\n\nclass VisualCardsCarousel {\n constructor(el) {\n this.container = el.querySelector('.js-visual-cards-carousel-container');\n this.nextButton = el.querySelector('.js-visual-cards-carousel-next');\n this.prevButton = el.querySelector('.js-visual-cards-carousel-prev');\n this.slideLinks = Array.from(el.querySelectorAll('.ups-block__visual-cards-link'));\n\n this.init();\n this.setupListeners();\n }\n\n init() {\n // Set up different layouts based on the page template and existence of block intro.\n const isGuidePage = document.body.classList.contains('js-guide-page');\n const isDetailPage = document.body.classList.contains('js-detail-page');\n const isArticlePage = document.body.classList.contains('js-article-page');\n const isWaypointPage = document.body.classList.contains('js-waypoint-page');\n\n let responsive = false;\n if (isGuidePage || isArticlePage || isWaypointPage) {\n responsive = {\n 0: {\n edgePadding: 12.25,\n items: 1.25,\n },\n 400: {\n items: 1.75,\n },\n 600: {\n items: 2.25,\n },\n 768: {\n edgePadding: 20,\n items: 2.75,\n },\n 1024: {\n items: 3.5,\n },\n };\n }\n\n if (isDetailPage) {\n responsive = {\n 0: {\n edgePadding: 12.25,\n items: 1.5,\n },\n 400: {\n items: 1.75,\n },\n 600: {\n items: 2.25,\n },\n 768: {\n edgePadding: 20,\n items: 1.75,\n },\n 800: {\n items: 2.25,\n },\n 1024: {\n items: 2.5,\n },\n };\n }\n\n this.carousel = tns({\n container: this.container,\n nextButton: this.nextButton,\n prevButton: this.prevButton,\n loop: false,\n mouseDrag: true,\n nav: false,\n responsive: responsive,\n touch: true,\n onInit({ nextButton, prevButton }) {\n nextButton.removeAttribute('tabindex');\n prevButton.removeAttribute('tabindex');\n },\n });\n }\n\n setupListeners() {\n on(this.slideLinks, 'focusin', this.handleFocus.bind(this));\n }\n\n handleFocus(event) {\n const index = event.target.dataset.slide;\n if (index && this.carousel) {\n this.carousel.goTo(index);\n }\n }\n}\n\nexport default VisualCardsCarousel;\n"],"names":["VisualCardsCarousel","el","_classCallCheck","this","container","querySelector","nextButton","prevButton","slideLinks","Array","from","querySelectorAll","init","setupListeners","key","value","isGuidePage","document","body","classList","contains","isDetailPage","isArticlePage","isWaypointPage","responsive","edgePadding","items","carousel","tns","loop","mouseDrag","nav","touch","onInit","_ref","removeAttribute","on","handleFocus","bind","event","index","target","dataset","slide","goTo"],"sourceRoot":""}