{"version":3,"file":"home-page.js","sources":["../../../../../Flow.Showcase.Static.Bundler/Wellness/entrypoints/home-page.ts"],"sourcesContent":["import { Swiper } from \"swiper\";\nimport { Navigation, Pagination } from \"swiper/modules\";\n\n// Слайдер для карточек продуктов\nfunction createProductCardSlider(className: string) {\n new Swiper(`.${className} .swiper`, {\n modules: [Navigation, Pagination],\n\n slidesPerView: \"auto\",\n slidesPerGroup: 1,\n\n navigation: {\n prevEl: `.${className} .product-card-slider__btn-prev`,\n nextEl: `.${className} .product-card-slider__btn-next`,\n disabledClass: \"swiper-nav-disabled\",\n hiddenClass: \"swiper-nav-hidden\",\n lockClass: \"swiper-nav-hidden\",\n },\n\n pagination: {\n el: `.${className} .swiper-pagination`,\n clickable: true,\n },\n\n breakpoints: {\n 1100: {\n slidesPerView: 2,\n slidesPerGroup: 2,\n },\n 1300: {\n slidesPerView: 3,\n slidesPerGroup: 3,\n },\n },\n });\n}\n\n// Слайдер для остальных карточек (описания категорий, отзывы)\n\nconst rootStyle = window.getComputedStyle(document.documentElement);\n\nfunction createCardSlider(className: string) {\n const selector = `.${className} .swiper`;\n const slidesOffset = getSlidesOffset();\n const swiper = new Swiper(selector, {\n modules: [Navigation],\n\n slidesPerView: \"auto\",\n spaceBetween: 26,\n\n slidesOffsetBefore: slidesOffset,\n slidesOffsetAfter: slidesOffset,\n\n navigation: {\n prevEl: `.${className} .card-slider__btn-prev`,\n nextEl: `.${className} .card-slider__btn-next`,\n disabledClass: \"swiper-nav-disabled\",\n hiddenClass: \"swiper-nav-hidden\",\n lockClass: \"swiper-nav-hidden\",\n },\n });\n\n function getSlidesOffset() {\n const contentBoxWidth = parseFloat(\n rootStyle.getPropertyValue(\"--content-box-width\")\n );\n const contentSideGap = parseFloat(\n rootStyle.getPropertyValue(\"--content-side-gap\")\n );\n // @ts-ignore\n const swiperWidth = document.querySelector(selector).offsetWidth;\n return (\n Math.max(0, (swiperWidth - contentBoxWidth) / 2) + contentSideGap\n );\n }\n\n window.addEventListener(\"resize\", () => {\n const slidesOffset = getSlidesOffset();\n swiper.params.slidesOffsetBefore = slidesOffset;\n swiper.params.slidesOffsetAfter = slidesOffset;\n });\n}\n\ncreateProductCardSlider(\"home-page__top-sales\");\ncreateProductCardSlider(\"home-page__discounts\");\ncreateProductCardSlider(\"home-page__recently-purchased\");\n\ncreateCardSlider(\"home-page__reviews\");\ncreateCardSlider(\"popular-categories__descriptions\");\n"],"names":["createProductCardSlider","className","Swiper","Navigation","Pagination","rootStyle","createCardSlider","selector","slidesOffset","getSlidesOffset","swiper","contentBoxWidth","contentSideGap","swiperWidth"],"mappings":"iHAIA,SAASA,EAAwBC,EAAmB,CAC5C,IAAAC,EAAO,IAAID,CAAS,WAAY,CAChC,QAAS,CAACE,EAAYC,CAAU,EAEhC,cAAe,OACf,eAAgB,EAEhB,WAAY,CACR,OAAQ,IAAIH,CAAS,kCACrB,OAAQ,IAAIA,CAAS,kCACrB,cAAe,sBACf,YAAa,oBACb,UAAW,mBACf,EAEA,WAAY,CACR,GAAI,IAAIA,CAAS,sBACjB,UAAW,EACf,EAEA,YAAa,CACT,KAAM,CACF,cAAe,EACf,eAAgB,CACpB,EACA,KAAM,CACF,cAAe,EACf,eAAgB,CAAA,CACpB,CACJ,CACH,CACL,CAIA,MAAMI,EAAY,OAAO,iBAAiB,SAAS,eAAe,EAElE,SAASC,EAAiBL,EAAmB,CACnC,MAAAM,EAAW,IAAIN,CAAS,WACxBO,EAAeC,EAAgB,EAC/BC,EAAS,IAAIR,EAAOK,EAAU,CAChC,QAAS,CAACJ,CAAU,EAEpB,cAAe,OACf,aAAc,GAEd,mBAAoBK,EACpB,kBAAmBA,EAEnB,WAAY,CACR,OAAQ,IAAIP,CAAS,0BACrB,OAAQ,IAAIA,CAAS,0BACrB,cAAe,sBACf,YAAa,oBACb,UAAW,mBAAA,CACf,CACH,EAED,SAASQ,GAAkB,CACvB,MAAME,EAAkB,WACpBN,EAAU,iBAAiB,qBAAqB,CACpD,EACMO,EAAiB,WACnB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