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