import { defineComponent, toRefs, createVNode, computed } 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 TourPanel from './PanelRender.mjs';
import useMergedType from './useMergedType.mjs';
import { tourProps } from './props.mjs';
import { classNames } from '../../../utils/dom/class.mjs';
import { getPlacements } from '../../../utils/placement.mjs';
import Tour from '../../../vue-components/vc-tour/src/Tour.mjs';

var ATour = /* @__PURE__ */ defineComponent({
  name: "ATour",
  inheritAttrs: false,
  props: tourProps(),
  setup(props, {
    attrs,
    emit,
    slots
  }) {
    const {
      current,
      type,
      steps,
      defaultCurrent
    } = toRefs(props);
    const {
      prefixCls,
      direction
    } = useConfigInject("tour", props);
    const [wrapSSR, hashId] = useStyle(prefixCls);
    const {
      currentMergedType,
      updateInnerCurrent
    } = useMergedType({
      defaultType: type,
      steps,
      current,
      defaultCurrent
    });
    return () => {
      const {
        steps: steps2,
        current: current2,
        type: type2,
        rootClassName,
        ...restProps
      } = props;
      const customClassName = classNames({
        [`${prefixCls.value}-primary`]: currentMergedType.value === "primary",
        [`${prefixCls.value}-rtl`]: direction.value === "rtl"
      }, hashId.value, rootClassName);
      const mergedRenderPanel = (stepProps, stepCurrent) => {
        return createVNode(TourPanel, {
          ...stepProps,
          "type": type2,
          "current": stepCurrent
        }, {
          indicatorsRender: slots.indicatorsRender
        });
      };
      const onStepChange = (stepCurrent) => {
        updateInnerCurrent(stepCurrent);
        emit("update:current", stepCurrent);
        emit("change", stepCurrent);
      };
      const builtinPlacements = computed(() => getPlacements({
        arrowPointAtCenter: true,
        autoAdjustOverflow: true
      }));
      return wrapSSR(createVNode(Tour, {
        ...attrs,
        ...restProps,
        "rootClassName": customClassName,
        "prefixCls": prefixCls.value,
        "current": current2,
        "defaultCurrent": props.defaultCurrent,
        "animated": true,
        "renderPanel": mergedRenderPanel,
        "onChange": onStepChange,
        "steps": steps2,
        "builtinPlacements": builtinPlacements.value
      }, null));
    };
  }
});

export { ATour as default };
//# sourceMappingURL=Tour.mjs.map
