{"version":3,"file":"product-carousel.js","sources":["../../../../../Flow.Showcase.Static.Bundler/node_modules/swiper/modules/thumbs.mjs","../../../../../Flow.Showcase.Static.Bundler/Root/entrypoints/product-carousel.ts"],"sourcesContent":["import { g as getDocument } from '../shared/ssr-window.esm.mjs';\nimport { l as isObject, e as elementChildren } from '../shared/utils.mjs';\n\nfunction Thumb(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n thumbs: {\n swiper: null,\n multipleActiveThumbs: true,\n autoScrollOffset: 0,\n slideThumbActiveClass: 'swiper-slide-thumb-active',\n thumbsContainerClass: 'swiper-thumbs'\n }\n });\n let initialized = false;\n let swiperCreated = false;\n swiper.thumbs = {\n swiper: null\n };\n function onThumbClick() {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n const clickedIndex = thumbsSwiper.clickedIndex;\n const clickedSlide = thumbsSwiper.clickedSlide;\n if (clickedSlide && clickedSlide.classList.contains(swiper.params.thumbs.slideThumbActiveClass)) return;\n if (typeof clickedIndex === 'undefined' || clickedIndex === null) return;\n let slideToIndex;\n if (thumbsSwiper.params.loop) {\n slideToIndex = parseInt(thumbsSwiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);\n } else {\n slideToIndex = clickedIndex;\n }\n if (swiper.params.loop) {\n swiper.slideToLoop(slideToIndex);\n } else {\n swiper.slideTo(slideToIndex);\n }\n }\n function init() {\n const {\n thumbs: thumbsParams\n } = swiper.params;\n if (initialized) return false;\n initialized = true;\n const SwiperClass = swiper.constructor;\n if (thumbsParams.swiper instanceof SwiperClass) {\n swiper.thumbs.swiper = thumbsParams.swiper;\n Object.assign(swiper.thumbs.swiper.originalParams, {\n watchSlidesProgress: true,\n slideToClickedSlide: false\n });\n Object.assign(swiper.thumbs.swiper.params, {\n watchSlidesProgress: true,\n slideToClickedSlide: false\n });\n swiper.thumbs.swiper.update();\n } else if (isObject(thumbsParams.swiper)) {\n const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper);\n Object.assign(thumbsSwiperParams, {\n watchSlidesProgress: true,\n slideToClickedSlide: false\n });\n swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams);\n swiperCreated = true;\n }\n swiper.thumbs.swiper.el.classList.add(swiper.params.thumbs.thumbsContainerClass);\n swiper.thumbs.swiper.on('tap', onThumbClick);\n return true;\n }\n function update(initial) {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView;\n\n // Activate thumbs\n let thumbsToActivate = 1;\n const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;\n if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {\n thumbsToActivate = swiper.params.slidesPerView;\n }\n if (!swiper.params.thumbs.multipleActiveThumbs) {\n thumbsToActivate = 1;\n }\n thumbsToActivate = Math.floor(thumbsToActivate);\n thumbsSwiper.slides.forEach(slideEl => slideEl.classList.remove(thumbActiveClass));\n if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) {\n for (let i = 0; i < thumbsToActivate; i += 1) {\n elementChildren(thumbsSwiper.slidesEl, `[data-swiper-slide-index=\"${swiper.realIndex + i}\"]`).forEach(slideEl => {\n slideEl.classList.add(thumbActiveClass);\n });\n }\n } else {\n for (let i = 0; i < thumbsToActivate; i += 1) {\n if (thumbsSwiper.slides[swiper.realIndex + i]) {\n thumbsSwiper.slides[swiper.realIndex + i].classList.add(thumbActiveClass);\n }\n }\n }\n const autoScrollOffset = swiper.params.thumbs.autoScrollOffset;\n const useOffset = autoScrollOffset && !thumbsSwiper.params.loop;\n if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) {\n const currentThumbsIndex = thumbsSwiper.activeIndex;\n let newThumbsIndex;\n let direction;\n if (thumbsSwiper.params.loop) {\n const newThumbsSlide = thumbsSwiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') === `${swiper.realIndex}`)[0];\n newThumbsIndex = thumbsSwiper.slides.indexOf(newThumbsSlide);\n direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev';\n } else {\n newThumbsIndex = swiper.realIndex;\n direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev';\n }\n if (useOffset) {\n newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset;\n }\n if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {\n if (thumbsSwiper.params.centeredSlides) {\n if (newThumbsIndex > currentThumbsIndex) {\n newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;\n } else {\n newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;\n }\n } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ;\n thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);\n }\n }\n }\n on('beforeInit', () => {\n const {\n thumbs\n } = swiper.params;\n if (!thumbs || !thumbs.swiper) return;\n if (typeof thumbs.swiper === 'string' || thumbs.swiper instanceof HTMLElement) {\n const document = getDocument();\n const getThumbsElementAndInit = () => {\n const thumbsElement = typeof thumbs.swiper === 'string' ? document.querySelector(thumbs.swiper) : thumbs.swiper;\n if (thumbsElement && thumbsElement.swiper) {\n thumbs.swiper = thumbsElement.swiper;\n init();\n update(true);\n } else if (thumbsElement) {\n const eventName = `${swiper.params.eventsPrefix}init`;\n const onThumbsSwiper = e => {\n thumbs.swiper = e.detail[0];\n thumbsElement.removeEventListener(eventName, onThumbsSwiper);\n init();\n update(true);\n thumbs.swiper.update();\n swiper.update();\n };\n thumbsElement.addEventListener(eventName, onThumbsSwiper);\n }\n return thumbsElement;\n };\n const watchForThumbsToAppear = () => {\n if (swiper.destroyed) return;\n const thumbsElement = getThumbsElementAndInit();\n if (!thumbsElement) {\n requestAnimationFrame(watchForThumbsToAppear);\n }\n };\n requestAnimationFrame(watchForThumbsToAppear);\n } else {\n init();\n update(true);\n }\n });\n on('slideChange update resize observerUpdate', () => {\n update();\n });\n on('setTransition', (_s, duration) => {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n thumbsSwiper.setTransition(duration);\n });\n on('beforeDestroy', () => {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n if (swiperCreated) {\n thumbsSwiper.destroy();\n }\n });\n Object.assign(swiper.thumbs, {\n init,\n update\n });\n}\n\nexport { Thumb as default };\n","// @ts-nocheck\n/*Карусель изображений*/\n\nimport { Swiper } from \"swiper\";\nimport {\n Navigation,\n Pagination,\n Thumbs,\n} from \"swiper/modules\";\n\nlet previewsCarousel = null;\n\nconst previewsElem = document.querySelector(\".preview-carousel\");\n\nif (previewsElem) {\n previewsCarousel = new Swiper(previewsElem, {\n modules: [Navigation, Thumbs],\n spaceBetween: 10,\n slidesPerView: 4,\n freeMode: true,\n watchSlidesProgress: true,\n navigation: {\n nextEl: \".swiper-button-next\",\n prevEl: \".swiper-button-prev\",\n },\n });\n}\n\nconst imageCarousel = new Swiper(\".image-carousel\", {\n modules: [Navigation, Pagination, Thumbs],\n watchOverflow: true,\n navigation: {\n nextEl: \".swiper-button-next\",\n prevEl: \".swiper-button-prev\",\n },\n pagination: {\n el: \".swiper-pagination\",\n clickable: true\n },\n thumbs:\n previewsCarousel === null\n ? {}\n : {\n swiper: previewsCarousel,\n },\n});\n\nconst imageViewCarousel = new Swiper(\".image-viewer-carousel\", {\n modules: [Navigation, Pagination, Thumbs],\n watchOverflow: true,\n navigation: {\n nextEl: \".swiper-button-next\",\n prevEl: \".swiper-button-prev\",\n },\n pagination: {\n el: \".swiper-pagination\",\n clickable: true\n },\n});\n\nimageCarousel.on('activeIndexChange', (swiper) => {\n imageViewCarousel.slideTo(swiper.activeIndex);\n})\n"],"names":["Thumb","_ref","swiper","extendParams","on","initialized","swiperCreated","onThumbClick","thumbsSwiper","clickedIndex","clickedSlide","slideToIndex","init","thumbsParams","SwiperClass","isObject","thumbsSwiperParams","update","initial","slidesPerView","thumbsToActivate","thumbActiveClass","slideEl","elementChildren","autoScrollOffset","useOffset","currentThumbsIndex","newThumbsIndex","direction","newThumbsSlide","thumbs","document","getDocument","getThumbsElementAndInit","thumbsElement","eventName","onThumbsSwiper","e","watchForThumbsToAppear","_s","duration","previewsCarousel","previewsElem","Swiper","Navigation","Thumbs","imageCarousel","Pagination","imageViewCarousel"],"mappings":"uMAGA,SAASA,EAAMC,EAAM,CACnB,GAAI,CACF,OAAAC,EACA,aAAAC,EACA,GAAAC,CACJ,EAAMH,EACJE,EAAa,CACX,OAAQ,CACN,OAAQ,KACR,qBAAsB,GACtB,iBAAkB,EAClB,sBAAuB,4BACvB,qBAAsB,eAC5B,CACA,CAAG,EACD,IAAIE,EAAc,GACdC,EAAgB,GACpBJ,EAAO,OAAS,CACd,OAAQ,IACT,EACD,SAASK,GAAe,CACtB,MAAMC,EAAeN,EAAO,OAAO,OACnC,GAAI,CAACM,GAAgBA,EAAa,UAAW,OAC7C,MAAMC,EAAeD,EAAa,aAC5BE,EAAeF,EAAa,aAElC,GADIE,GAAgBA,EAAa,UAAU,SAASR,EAAO,OAAO,OAAO,qBAAqB,GAC1F,OAAOO,EAAiB,KAAeA,IAAiB,KAAM,OAClE,IAAIE,EACAH,EAAa,OAAO,KACtBG,EAAe,SAASH,EAAa,aAAa,aAAa,yBAAyB,EAAG,EAAE,EAE7FG,EAAeF,EAEbP,EAAO,OAAO,KAChBA,EAAO,YAAYS,CAAY,EAE/BT,EAAO,QAAQS,CAAY,CAEjC,CACE,SAASC,GAAO,CACd,KAAM,CACJ,OAAQC,CACT,EAAGX,EAAO,OACX,GAAIG,EAAa,MAAO,GACxBA,EAAc,GACd,MAAMS,EAAcZ,EAAO,YAC3B,GAAIW,E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