{"version":3,"sources":["webpack://frontendplaceholder/./Src/Scripts/components/related-articles.js"],"names":["constructor","elm","args","this","self","importSwiperPromise","importThrottlePromise","options","loop","slidesPerView","spaceBetween","watchSlidesVisibility","watchOverflow","pagination","el","type","formatFractionCurrent","number","formatFractionTotal","navigation","nextEl","prevEl","scrollbar","draggable","snapOnRelease","breakpoints","initializeSwiper","then","Swiper","Navigation","Pagination","Scrollbar","use","swiper","destroyed","enabledBreakpoint","throttleImport","default","throttle","onWindowResize","window","innerWidth","destroy","throttledOnWindowResize","addEventListener"],"mappings":"gNAAe,MACXA,YAAYC,EAAKC,GACbC,KAAKF,IAAMA,EACX,MAAMG,EAAOD,KAEb,IAAIE,EAAyBC,EAAwB,KAErD,MAAMC,EAAU,CACZC,MAAM,EACNC,cAAe,IACfC,aAAc,GACdC,uBAAuB,EACvBC,eAAe,EACfC,WAAY,CACRC,GAAI,oCACJC,KAAM,WACNC,sBAAuB,SAAUC,GAC7B,OAAQA,EAAS,GAAK,IAAM,IAAMA,GAEtCC,oBAAqB,SAAUD,GAC3B,OAAQA,EAAS,GAAK,IAAM,IAAMA,IAG1CE,WAAY,CACRC,OAAQ,qCACRC,OAAQ,sCAEZC,UAAW,CACPR,GAAI,mCACJS,WAAW,EACXC,eAAe,GAEnBC,YAAa,CACT,IAAK,CACDhB,cAAe,EACfC,aAAc,IAElB,IAAK,CACDD,cAAe,EACfC,aAAc,IAElB,KAAM,CACFD,cAAe,EACfC,aAAc,IAElB,KAAM,CACFD,cAAe,EACfC,aAAc,MA4BpBgB,EAAmB,YArBhBrB,IACDA,EAAsB,+BACjBsB,MAAK,EAAGC,SAAQC,aAAYC,aAAYC,gBAErCH,EAAOI,IAAI,CAACH,EAAYC,EAAYC,IAC7BH,MAGZvB,GAeFsB,MAAKC,IACGxB,EAAK6B,SAAU7B,EAAK6B,OAAOC,YAC5B9B,EAAK6B,OAAS,IAAIL,EAAO3B,EAAKM,QAK1CL,EAAKiC,mBAnBA7B,IACDA,EAAwB,mCACnBqB,MAAKS,GAEKA,EAAeC,WAG3B/B,GAcFqB,MAAKW,IACF,MAAMC,EAAiB,WACfC,OAAOC,WAAavC,EAAKiC,kBACpB/B,EAAK6B,SAAU7B,EAAK6B,OAAOC,WAC5BR,IAGAtB,EAAK6B,QACL7B,EAAK6B,OAAOS,WAIlBC,EAA0BL,EAASC,EAAgB,KAEzDC,OAAOI,iBAAiB,SAAUD,GAClCJ,OAGRb","file":"515.e0ca5eeffe20435d196f.js","sourcesContent":["export default class RelatedArticles {\n constructor(elm, args) {\n this.elm = elm;\n const self = this;\n\n let importSwiperPromise; let importThrottlePromise = null;\n\n const options = {\n loop: false,\n slidesPerView: 1.5,\n spaceBetween: 15,\n watchSlidesVisibility: true,\n watchOverflow: true,\n pagination: {\n el: '.column-slider .swiper-pagination',\n type: 'fraction',\n formatFractionCurrent: function (number) {\n return (number < 10 ? '0' : '') + number;\n },\n formatFractionTotal: function (number) {\n return (number < 10 ? '0' : '') + number;\n },\n },\n navigation: {\n nextEl: '.column-slider .swiper-button-next',\n prevEl: '.column-slider .swiper-button-prev',\n },\n scrollbar: {\n el: '.column-slider .swiper-scrollbar',\n draggable: true,\n snapOnRelease: true,\n },\n breakpoints: {\n 768: {\n slidesPerView: 2,\n spaceBetween: 20,\n },\n 992: {\n slidesPerView: 2,\n spaceBetween: 20,\n },\n 1200: {\n slidesPerView: 3,\n spaceBetween: 30,\n },\n 1837: {\n slidesPerView: 4,\n spaceBetween: 30,\n },\n },\n };\n\n // Only import Swiper script if it is actually needed\n const importSwiper = function () {\n if (!importSwiperPromise) {\n importSwiperPromise = import('swiper')\n .then(({ Swiper, Navigation, Pagination, Scrollbar }) => {\n // Install modules\n Swiper.use([Navigation, Pagination, Scrollbar]);\n return Swiper;\n });\n }\n return importSwiperPromise;\n };\n const importThrottle = function () {\n if (!importThrottlePromise) {\n importThrottlePromise = import('lodash/throttle')\n .then(throttleImport => {\n // unwrap the throttle function from the import\n return throttleImport.default;\n });\n }\n return importThrottlePromise;\n };\n\n const initializeSwiper = function () {\n importSwiper()\n .then(Swiper => {\n if (!self.swiper || self.swiper.destroyed) {\n self.swiper = new Swiper(elm, options);\n }\n });\n };\n\n if (args.enabledBreakpoint) {\n importThrottle()\n .then(throttle => {\n const onWindowResize = function () {\n if (window.innerWidth < args.enabledBreakpoint) {\n if (!self.swiper || self.swiper.destroyed) {\n initializeSwiper();\n }\n } else {\n if (self.swiper) {\n self.swiper.destroy();\n }\n }\n };\n const throttledOnWindowResize = throttle(onWindowResize, 100);\n\n window.addEventListener('resize', throttledOnWindowResize);\n onWindowResize();\n });\n } else {\n initializeSwiper();\n }\n }\n}\n"],"sourceRoot":""}