import { defineComponent, ref, computed, watchEffect, createVNode } from 'vue';
import '../../../utils/index.mjs';
import '../../../vue-components/index.mjs';
import useConfigInject from '../../config-provider/src/hooks/useConfigInject.mjs';
import useStyle from '../style/index.mjs';
import { carouselProps } from './props.mjs';
import { devWarning } from '../../../utils/log.mjs';
import { classNames } from '../../../utils/dom/class.mjs';
import VCSlick from '../../../vue-components/vc-slick/src/slider.mjs';

var ACarousel = /* @__PURE__ */ defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ACarousel",
  inheritAttrs: false,
  props: carouselProps(),
  setup(props, {
    slots,
    attrs,
    expose
  }) {
    const slickRef = ref();
    const goTo = (slide, dotAnimate = false) => {
      var _a;
      (_a = slickRef.value) == null ? void 0 : _a.slickGoTo(slide, dotAnimate);
    };
    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: computed(() => {
        var _a;
        return (_a = slickRef.value) == null ? void 0 : _a.innerSlider;
      })
    });
    watchEffect(() => {
      devWarning(props.vertical === void 0, "Carousel", "`vertical` is deprecated, please use `dotPosition` instead.");
    });
    const {
      prefixCls,
      direction
    } = useConfigInject("carousel", props);
    const [wrapSSR, hashId] = useStyle(prefixCls);
    const dotPosition = computed(() => {
      if (props.dotPosition)
        return props.dotPosition;
      if (props.vertical !== void 0)
        return props.vertical ? "right" : "bottom";
      return "bottom";
    });
    const vertical = computed(() => dotPosition.value === "left" || dotPosition.value === "right");
    const dsClass = computed(() => {
      const dotsClass = "slick-dots";
      return classNames({
        [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(prefixCls.value, {
        [`${prefixCls.value}-rtl`]: direction.value === "rtl",
        [`${prefixCls.value}-vertical`]: vertical.value,
        [`${cls}`]: !!cls
      }, hashId.value);
      return wrapSSR(createVNode("div", {
        "class": className,
        "style": style
      }, [createVNode(VCSlick, {
        "ref": slickRef,
        ...props,
        ...restAttrs,
        "dots": !!dots,
        "dotsClass": dsClass.value,
        "arrows": arrows,
        "draggable": draggable,
        "fade": fade,
        "vertical": vertical.value
      }, slots)]));
    };
  }
});

export { ACarousel as default };
//# sourceMappingURL=Carousel.mjs.map
