1"use strict";(self["webpackChunkrudy_demo"]=self["webpackChunkrudy_demo"]||[]).push([[8592],{78592:function(t,i,e){e.d(i,{c:function(){return u}});var s=function(){var t=this,i=t._self._c;return i("div",{staticClass:"carousel"},[i("div",{staticClass:"carousel-before d-flex flex-wrap justify-content-end gap-1"},[t._t("before"),t.buttonNeed?i("div",{staticClass:"carousel_navigation"},[i("ButtonComponent",{staticClass:"left_arrow",attrs:{variant:"icon",title:"swipe left"},on:{"btn-click":function(i){return t.onLeft()}}},[i("single-angle")],1),i("ButtonComponent",{staticClass:"right_arrow",attrs:{variant:"icon",title:"swipe right"},on:{"btn-click":t.onRightHandle}},[i("single-angle")],1)],1):t._e()],2),i("div",{ref:"itemsListWrapper",staticClass:"carousel_wrapper",style:{"scroll-behavior":t.behaviour},on:{touchstart:t.startSwipe,mousedown:t.startSwipe,touchmove:t.throttledSwipeProcessing,mousemove:function(i){return i.preventDefault(),t.throttledSwipeProcessing.apply(null,arguments)},touchend:t.endSwipe,mouseleave:t.endSwipe,mouseup:function(i){return i.preventDefault(),t.endSwipe.apply(null,arguments)}}},[i("div",{staticClass:"carousel_items",style:{"grid-template-columns":`repeat(${t.maxItemInLine}, calc(100%/${t.itemsOnScreen}))`,pointerEvents:t.itemClickDisabled?"none":"all"},attrs:{id:"carousel_items"},on:{mouseover:t.onFocus,mouseleave:t.onBlur}},[t._l(t.scrolledData,(function(i,e){return t._t("default",null,{props:i,index:e})}))],2),t._t("after")],2),t.showDots&&t.itemData.length>1?i("div",{staticClass:"carousel_dots"},t._l(t.itemData,(function(e){return i("span",{key:e.id,class:{active:e.id===t.currentActive.id},on:{click:function(i){return i.stopPropagation(),i.preventDefault(),t.swipeTo(e)}}})})),0):t._e()])},n=[],l=(e(41960),e(21992),e(94976),e(39952),e(54904)),r=e(33568),o=e(70224),h={name:"CarouselComponent",components:{SingleAngle:o.c,ButtonComponent:l.c},props:{itemData:{type:Array,required:!0},scrolledQuantity:{type:Number,default:4},displayedQuantity:{type:Number},maxPerLine:{type:Number,default:6},autoscrollDelay:{type:Number,default:5e3},minItemWidth:{type:Number,required:!0},maxItemWidth:{type:Number},needInfinity:{type:Boolean,default:!0},showArrow:{type:Boolean,default:!0},showDots:{type:Boolean,default:!1},integerItemsQuantity:{type:Boolean,default:!0},selectedItem:{type:Object},minMobileCount:{type:Number,default:1}},SCROLL_BEHAVIOUR:{SMOOTH:"smooth",AUTO:"auto"},data(){return{scrollLeft:0,itemWidth:null,maxScrollLeft:0,autoscrollIntervalId:null,itemsOnScreen:this.displayedQuantity,beforeDestroyCb:[],scrolledData:this.itemData.slice(),maxItemInLine:this.maxPerLine,behaviour:this.$options.SCROLL_BEHAVIOUR.SMOOTH,scrollProcessing:!1,animateId:null,dragAnimateId:null,dataLength:this.itemData.length,startSwipeX:0,currentSwipeX:0,startSwiping:!1,currentActive:this.itemData[0],itemClickDisabled:!1}},watch:{itemData(){this.scrolledData=this.itemData.slice(),this.dataLength=this.itemData.length,this.currentActive=this.itemData[0],this.scrollLeft=0,this.maxItemInLine=this.maxPerLine,this.onResize()},scrollLeft(){this.$refs.itemsListWrapper.scrollLeft=this.scrollLeft},itemWidth(t,i){if(i){const e=this.scrollLeft/i;this.setNewLeft(e*t)}const e=this.displayedQuantity?this.minItemWidth:this.maxItemWidth,s=this.$refs.itemsListWrapper.clientWidth/e,n=this.integerItemsQuantity?Math.trunc(s):s,l=this.displayedQuantity?Math.min(n,this.displayedQuantity):n;this.itemsOnScreen=Math.max(l,this.minMobileCount)},itemsOnScreen(){this.$nextTick().then(this.onResize)},async currentSwipeX(t,i){if(!this.startSwiping)return;if(!i||!t)return;const e=i?t-i:t-this.startSwipeX;if(!this.itemClickDisabled&&Math.abs(t-this.startSwipeX)>.05*this.scrolledWidth&&(this.itemClickDisabled=!0),e>0){if(!this.needInfinity&&!this.scrollLeft)return;this.scrollLeft>0?this.setNewLeft(Math.max(this.scrollLeft-e,0)):this.itemWidth<=this.maxScrollLeft&&(await this.$nextTick(),this.setNewLeft(this.scrollLeft+this.scrolledWidth),this.replaceItemToStart())}else{if(!this.needInfinity&&this.scrollLeft>=this.maxScrollLeft)return;if(await this.$nextTick(),this.setNewLeft(Math.min(this.scrollLeft-e,this.maxScrollLeft)),await this.$nextTick(),!this.needInfinity)return;this.scrollLeft>=this.scrolledWidth&&Math.floor(this.itemsOnScreen)>this.dataLength&&(this.setNewLeft(this.scrollLeft-this.scrolledWidth),this.needInfinity&&this.replaceItemToEnd())}},scrolledData(){this.currentActive=this.scrolledData[0]},selectedItem(){this.swipeTo(this.selectedItem)}},computed:{normalizedScrolledQuantity(){const t=Math.max(this.dataLength-this.itemsOnScreen,0),i=Math.min(t,this.scrolledQuantity);return this.needInfinity&&t<1?1:Math.min(i,this.itemsOnScreen)},scrolledWidth(){return this.itemWidth*this.normalizedScrolledQuantity},buttonNeed(){return this.showArrow&&this.itemsOnScreen<this.maxItemInLine},scrollWidth(){return this.itemWidth*this.maxPerLine},hasEnoughItemsToSmoothScroll(){return this.itemsOnScreen+this.normalizedScrolledQuantity<=this.dataLength}},methods:{setNewLeft(t){this.scrollLeft=t},waitForAnimate(t){cancelAnimationFrame(this.animateId);let i,e=2;const s=()=>{this.animateId=window.requestAnimationFrame((()=>
1{if("undefined"===typeof i)return i=0,s();let n;i&&i>this.$refs.itemsListWrapper.scrollLeft?n=!this.$refs.itemsListWrapper.scrollLeft:i===this.$refs.itemsListWrapper.scrollLeft?n=!e--:e=2,i=this.$refs.itemsListWrapper.scrollLeft,n?t():s()}))};s()},throttledSwipeProcessing(t){this.startSwiping&&!this.dragAnimateId&&(this.dragAnimateId=window.requestAnimationFrame((()=>this.swipeProcessing(t))))},swipeLeft(t){var i;let e=null!==(i=null===t||void 0===t?void 0:t.left)&&void 0!==i?i:this.scrolledWidth;(this.needInfinity||!this.needInfinity&&!t)&&(e=this.scrollLeft-e);const s=Math.max(e,0);this.setNewLeft(s)},swipeRight(t){var i;let e=null!==(i=null===t||void 0===t?void 0:t.left)&&void 0!==i?i:this.scrolledWidth;(this.needInfinity||!this.needInfinity&&!t)&&(e+=this.scrollLeft);const s=Math.min(e,this.maxScrollLeft);this.setNewLeft(s)},async infinityRight(t){this.scrollProcessing||(this.scrollProcessing=!0,this.getMaxScrollLeft(),await this.$nextTick(),this.swipeRight(t),this.waitForAnimate((async()=>{this.behaviour=this.$options.SCROLL_BEHAVIOUR.AUTO,await this.$nextTick(),this.setNewLeft(0),this.replaceItemToEnd(null===t||void 0===t?void 0:t.replacedQuantity),await this.$nextTick(),this.behaviour=this.$options.SCROLL_BEHAVIOUR.SMOOTH,this.scrollProcessing=!1})))},infinityLeft(t){this.scrollProcessing||(this.scrollProcessing=!0,this.behaviour=this.$options.SCROLL_BEHAVIOUR.AUTO,this.$nextTick().then((()=>{this.replaceItemToStart(null===t||void 0===t?void 0:t.replacedQuantity);const i=t?null===t||void 0===t?void 0:t.left:this.scrolledWidth;this.setNewLeft(this.scrollLeft+i),this.behaviour=this.$options.SCROLL_BEHAVIOUR.SMOOTH})).then((()=>this.swipeLeft(t))).then((()=>{this.waitForAnimate((()=>{this.scrollProcessing=!1}))})))},onRight(t){0!==this.maxScrollLeft&&(this.needInfinity&&this.hasEnoughItemsToSmoothScroll?this.infinityRight(t):this.scrollLeft!==this.maxScrollLeft?this.swipeRight(t):this.setNewLeft(0))},onLeft(t){(this.needInfinity||this.scrollLeft)&&(this.stopAutoscroll(),this.needInfinity&&this.hasEnoughItemsToSmoothScroll?this.infinityLeft(t):this.swipeLeft(t),this.initAutoscroll())},onRightHandle(){this.stopAutoscroll(),this.onRight(),this.initAutoscroll()},getItemWidth(){var t;const i=null===(t=this.$refs.itemsListWrapper)||void 0===t?void 0:t.clientWidth;i&&(this.itemWidth=i/this.itemsOnScreen)},getMaxScrollLeft(){this.maxScrollLeft=Math.max(this.scrollWidth-this.$refs.itemsListWrapper.clientWidth,0)},onResize(){this.onFocus(),this.getItemWidth(),this.getMaxScrollLeft(),this.onBlur()},onFocus(){this.stopAutoscroll()},onBlur(){this.initAutoscroll()},stopAutoscroll(){this.autoscrollIntervalId&&clearInterval(this.autoscrollIntervalId)},initAutoscroll(){if(!this.autoscrollDelay||Math.ceil(this.itemsOnScreen)===this.dataLength)return!1;this.stopAutoscroll(),this.autoscrollIntervalId=setInterval((()=>{this.onRight()}),this.autoscrollDelay),this.cleanOnDestroy((()=>{clearInterval(this.autoscrollIntervalId)}))},initFirstCalculate(){const t=this.$refs.itemsListWrapper.firstChild;if(t.hasChildNodes())this.onResize();else{const i=new MutationObserver(this.onResize);
1i.observe(t,{childList:!0}),this.cleanOnDestroy((()=>i.disconnect()))}},cleanOnDestroy(t){this.beforeDestroyCb.push(t)},replaceItemToStart(t=this.normalizedScrolledQuantity){this.scrolledData=[...this.scrolledData.slice(-t),...this.scrolledData.slice(0,-t)]},replaceItemToEnd(t=this.normalizedScrolledQuantity){this.scrolledData=[...this.scrolledData.slice(t),...this.scrolledData.slice(0,t)]},startSwipe(t){var i,e;0!==this.maxScrollLeft&&(this.onFocus(),this.startSwiping=!0,this.scrollProcessing=!0,this.startSwipeX=this.currentSwipeX=null!==(i=t.screenX)&&void 0!==i?i:null===t||void 0===t||null===(e=t.targetTouches)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.screenX,this.behaviour=this.$options.SCROLL_BEHAVIOUR.AUTO)},async endSwipe(){if(!this.startSwiping)return;this.startSwiping=!1;const t=this.startSwipeX>this.currentSwipeX,i=this.scrollLeft%this.itemWidth>this.itemWidth/2;if(this.currentSwipeX=null,this.startSwipeX=null,this.behaviour=this.$options.SCROLL_BEHAVIOUR.SMOOTH,this.itemClickDisabled=!1,await this.$nextTick(),Math.ceil(this.itemsOnScreen)===this.dataLength)return;let e=t&&i?this.itemWidth:0;const s=Math.round(this.scrollLeft/this.itemWidth);if(t){e=s*this.itemWidth;const t=this.maxScrollLeft-this.scrollLeft<this.itemWidth;!this.needInfinity&&t&&(e=this.maxScrollLeft)}else e=Math.round(this.scrollLeft/this.itemWidth)*this.itemWidth;this.setNewLeft(e),this.waitForAnimate((async()=>{this.behaviour=this.$options.SCROLL_BEHAVIOUR.AUTO,await this.$nextTick(),this.needInfinity&&(this.setNewLeft(0),this.replaceItemToEnd(Math.abs(Math.floor(e/this.itemWidth)))),await this.$nextTick(),this.behaviour=this.$options.SCROLL_BEHAVIOUR.SMOOTH,this.scrollProcessing=!1,this.onBlur()}))},swipeProcessing(t){var i;this.dragAnimateId=null,this.startSwiping&&(this.currentSwipeX=t.screenX||(null===t||void 0===t||null===(i=t.targetTouches)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.screenX))},swipeTo(t){this.stopAutoscroll();const i=this.showDots?this.itemData:this.scrolledData,e=i.findIndex((t=>t.id===this.currentActive.id)),s=i.findIndex((i=>i.id===t.id)),n=s-e,l=Math.abs(n),r=this.needInfinity?this.scrollLeft+n*this.itemWidth:this.itemWidth*s,o={left:Math.abs(r),replacedQuantity:l};this.needInfinity||(this.currentActive=i[s]);const h=this.needInfinity?e>s:o.left&&this.scrollLeft>o.left;e!==s&&this.scrollLeft!==o.left&&(h?this.onLeft(o):this.onRight(o))}},mounted(){this.initFirstCalculate();const t=(0,r.throttle)(this.onResize,30);window.addEventListener("resize",t),this.initAutoscroll(),this.cleanOnDestroy((()=>{var i;null===t||void 0===t||null===(i=t.cancel)||void 0===i||i.call(t),window.removeEventListener("resize",t)}))},beforeDestroy(){this.beforeDestroyCb.forEach((t=>t())),cancelAnimationFrame(this.animateId)}},a=h,c=e(82528),d=(0,c.c)(a,s,n,!1,null,"39a89af6",null),u=d.exports}}]); 2//# sourceMappingURL=8592.801d1e71.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.