'use strict';

var vue = require('vue');
require('../../../utils/index.cjs');
var innerSliderUtils = require('./utils/innerSliderUtils.cjs');
var vnode = require('../../../utils/vue/vnode.cjs');
var _class = require('../../../utils/dom/class.cjs');

function noop() {
}
function handler(options, handle, e) {
  if (e)
    e.preventDefault();
  handle(options, e);
}
function PrevArrow(_, {
  attrs
}) {
  const {
    clickHandler,
    infinite,
    currentSlide,
    slideCount,
    slidesToShow
  } = attrs;
  const prevClasses = {
    "slick-arrow": true,
    "slick-prev": true
  };
  let prevHandler = function(e) {
    handler({
      message: "previous"
    }, clickHandler, e);
  };
  if (!infinite && (currentSlide === 0 || slideCount <= slidesToShow)) {
    prevClasses["slick-disabled"] = true;
    prevHandler = noop;
  }
  const prevArrowProps = {
    "key": "0",
    "data-role": "none",
    "class": prevClasses,
    "style": {
      display: "block"
    },
    "onClick": prevHandler
  };
  const customProps = {
    currentSlide,
    slideCount
  };
  let prevArrow;
  if (attrs.prevArrow) {
    prevArrow = vnode.cloneElement(attrs.prevArrow({
      ...prevArrowProps,
      ...customProps
    }), {
      key: "0",
      class: prevClasses,
      style: {
        display: "block"
      },
      onClick: prevHandler
    }, false);
  } else {
    prevArrow = vue.createVNode("button", {
      "key": "0",
      "type": "button",
      ...prevArrowProps
    }, [" ", vue.createTextVNode("Previous")]);
  }
  return prevArrow;
}
PrevArrow.inheritAttrs = false;
function NextArrow(_, {
  attrs
}) {
  const {
    clickHandler,
    currentSlide,
    slideCount
  } = attrs;
  const nextClasses = {
    "slick-arrow": true,
    "slick-next": true
  };
  let nextHandler = function(e) {
    handler({
      message: "next"
    }, clickHandler, e);
  };
  if (!innerSliderUtils.canGoNext(attrs)) {
    nextClasses["slick-disabled"] = true;
    nextHandler = noop;
  }
  const nextArrowProps = {
    "key": "1",
    "data-role": "none",
    "class": _class.classNames(nextClasses),
    "style": {
      display: "block"
    },
    "onClick": nextHandler
  };
  const customProps = {
    currentSlide,
    slideCount
  };
  let nextArrow;
  if (attrs.nextArrow) {
    nextArrow = vnode.cloneElement(attrs.nextArrow({
      ...nextArrowProps,
      ...customProps
    }), {
      key: "1",
      class: _class.classNames(nextClasses),
      style: {
        display: "block"
      },
      onClick: nextHandler
    }, false);
  } else {
    nextArrow = vue.createVNode("button", {
      "key": "1",
      "type": "button",
      ...nextArrowProps
    }, [" ", vue.createTextVNode("Next")]);
  }
  return nextArrow;
}
NextArrow.inheritAttrs = false;

exports.NextArrow = NextArrow;
exports.PrevArrow = PrevArrow;
//# sourceMappingURL=arrows.cjs.map
