const e=require("../_util/props-util/index.js"),t=require("../_util/vnode.js"),n=require("../_util/BaseMixin.js"),r=require("../_util/json2mq.js"),i=require("./default-props.js"),a=require("./utils/innerSliderUtils.js");let o=require("vue");var s=(0,o.defineComponent)({name:`Slider`,mixins:[n.default],inheritAttrs:!1,props:{...i.default},data(){return this._responsiveMediaHandlers=[],{breakpoint:null}},mounted(){if(this.responsive){let e=this.responsive.map(e=>e.breakpoint);e.sort((e,t)=>e-t),e.forEach((t,n)=>{let i;i=n===0?r.default({minWidth:0,maxWidth:t}):r.default({minWidth:e[n-1]+1,maxWidth:t}),a.canUseDOM()&&this.media(i,()=>{this.setState({breakpoint:t})})});let t=r.default({minWidth:e.slice(-1)[0]});a.canUseDOM()&&this.media(t,()=>{this.setState({breakpoint:null})})}},beforeUnmount(){this._responsiveMediaHandlers.forEach(e=>{e.mql.removeListener(e.listener)})},methods:{innerSliderRefHandler(e){this.innerSlider=e},media(e,t){let n=window.matchMedia(e),r=({matches:e})=>{e&&t()};n.addListener(r),r(n),this._responsiveMediaHandlers.push({mql:n,query:e,listener:r})},slickPrev(){this.innerSlider?.slickPrev()},slickNext(){this.innerSlider?.slickNext()},slickGoTo(e,t=!1){this.innerSlider?.slickGoTo(e,t)},slickPause(){this.innerSlider?.pause(`paused`)},slickPlay(){this.innerSlider?.handleAutoPlay(`play`)}},render(){let n,r;this.breakpoint?(r=this.responsive.filter(e=>e.breakpoint===this.breakpoint),n=r[0].settings===`unslick`?`unslick`:{...this.$props,...r[0].settings}):n={...this.$props},n.centerMode&&(n.slidesToScroll,n.slidesToScroll=1),n.fade&&(n.slidesToShow,n.slidesToScroll,n.slidesToShow=1,n.slidesToScroll=1);let i=e.getSlot(this)||[];i=i.filter(e=>typeof e==`string`?!!e.trim():!!e),n.variableWidth&&(n.rows>1||n.slidesPerRow>1)&&(console.warn(`variableWidth is not supported in case of rows > 1 or slidesPerRow > 1`),n.variableWidth=!1);let a=[],s=null;for(let e=0;e<i.length;e+=n.rows*n.slidesPerRow){let r=[];for(let a=e;a<e+n.rows*n.slidesPerRow;a+=n.slidesPerRow){let c=[];for(let r=a;r<a+n.slidesPerRow&&(n.variableWidth&&i[r].props?.style&&(s=i[r].props.style.width),!(r>=i.length));r+=1)c.push(t.cloneElement(i[r],{key:100*e+10*a+r,tabindex:-1,style:{width:`${100/n.slidesPerRow}%`,display:`inline-block`}}));r.push((0,o.createVNode)(`div`,{key:10*e+a},[c]))}n.variableWidth?a.push((0,o.createVNode)(`div`,{key:e,style:{width:s}},[r])):a.push((0,o.createVNode)(`div`,{key:e},[r]))}if(n===`unslick`)return(0,o.createVNode)(`div`,{class:`regular slider ${this.className||``}`},[i]);a.length<=n.slidesToShow&&(n.unslick=!0);let c={...this.$attrs,...n,children:a,ref:this.innerSliderRefHandler};return(0,o.createVNode)((0,o.resolveComponent)(`InnerSlider`),{...c,__propsSymbol__:[]},this.$slots)}});exports.default=s;