'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var index$1 = require('../_util/vue-types/index.js');
var warning = require('../_util/warning.js');
var classNames = require('../_util/classNames.js');
require('../vc-slick/index.js');
var type = require('../_util/type.js');
require('../hooks/index.js');
var index$2 = require('./style/index.js');
var useConfigInject = require('../config-provider/hooks/useConfigInject.js');
var slider = require('../vc-slick/slider.js');

const carouselProps = () => ({
  effect: type.stringType(),
  dots: type.booleanType(true),
  vertical: type.booleanType(),
  autoplay: type.booleanType(),
  easing: String,
  beforeChange: type.functionType(),
  afterChange: type.functionType(),
  // style: PropTypes.React.CSSProperties,
  prefixCls: String,
  accessibility: type.booleanType(),
  nextArrow: index$1.default.any,
  prevArrow: index$1.default.any,
  pauseOnHover: type.booleanType(),
  // className: String,
  adaptiveHeight: type.booleanType(),
  arrows: type.booleanType(false),
  autoplaySpeed: Number,
  centerMode: type.booleanType(),
  centerPadding: String,
  cssEase: String,
  dotsClass: String,
  draggable: type.booleanType(false),
  fade: type.booleanType(),
  focusOnSelect: type.booleanType(),
  infinite: type.booleanType(),
  initialSlide: Number,
  lazyLoad: type.stringType(),
  rtl: type.booleanType(),
  slide: String,
  slidesToShow: Number,
  slidesToScroll: Number,
  speed: Number,
  swipe: type.booleanType(),
  swipeToSlide: type.booleanType(),
  swipeEvent: type.functionType(),
  touchMove: type.booleanType(),
  touchThreshold: Number,
  variableWidth: type.booleanType(),
  useCSS: type.booleanType(),
  slickGoTo: Number,
  responsive: Array,
  dotPosition: type.stringType(),
  verticalSwiping: type.booleanType(false)
});
const Carousel = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ACarousel",
  inheritAttrs: false,
  props: carouselProps(),
  setup(props, {
    slots,
    attrs,
    expose
  }) {
    const slickRef = vue.ref();
    const goTo = (slide, dontAnimate = false) => {
      var _a;
      (_a = slickRef.value) == null ? void 0 : _a.slickGoTo(slide, dontAnimate);
    };
    expose({
      goTo,
      autoplay: (palyType) => {
        var _a, _b;
        (_b = (_a = slickRef.value) == null ? void 0 : _a.innerSlider) == null ? void 0 : _b.handleAutoPlay(palyType);
      },
      prev: () => {
        var _a;
        (_a = slickRef.value) == null ? void 0 : _a.slickPrev();
      },
      next: () => {
        var _a;
        (_a = slickRef.value) == null ? void 0 : _a.slickNext();
      },
      innerSlider: vue.computed(() => {
        var _a;
        return (_a = slickRef.value) == null ? void 0 : _a.innerSlider;
      })
    });
    vue.watchEffect(() => {
      warning.default(props.vertical === void 0, "Carousel", "`vertical` is deprecated, please use `dotPosition` instead.");
    });
    const {
      prefixCls,
      direction
    } = useConfigInject.default("carousel", props);
    const [wrapSSR, hashId] = index$2.default(prefixCls);
    const dotPosition = vue.computed(() => {
      if (props.dotPosition)
        return props.dotPosition;
      if (props.vertical !== void 0)
        return props.vertical ? "right" : "bottom";
      return "bottom";
    });
    const vertical = vue.computed(() => dotPosition.value === "left" || dotPosition.value === "right");
    const dsClass = vue.computed(() => {
      const dotsClass = "slick-dots";
      return classNames.default({
        [dotsClass]: true,
        [`${dotsClass}-${dotPosition.value}`]: true,
        [`${props.dotsClass}`]: !!props.dotsClass
      });
    });
    return () => {
      const {
        dots,
        arrows,
        draggable,
        effect
      } = props;
      const {
        class: cls,
        style,
        ...restAttrs
      } = attrs;
      const fade = effect === "fade" ? true : props.fade;
      const className = classNames.default(prefixCls.value, {
        [`${prefixCls.value}-rtl`]: direction.value === "rtl",
        [`${prefixCls.value}-vertical`]: vertical.value,
        [`${cls}`]: !!cls
      }, hashId.value);
      return wrapSSR(vue.createVNode("div", {
        "class": className,
        "style": style
      }, [vue.createVNode(slider.default, vue.mergeProps({
        "ref": slickRef
      }, props, restAttrs, {
        "dots": !!dots,
        "dotsClass": dsClass.value,
        "arrows": arrows,
        "draggable": draggable,
        "fade": fade,
        "vertical": vertical.value
      }), slots)]));
    };
  }
});
var index = type.withInstall(Carousel);

exports.carouselProps = carouselProps;
exports.default = index;
//# sourceMappingURL=index.js.map
