import { defineComponent, toRefs, createVNode, mergeProps, computed } from 'vue';
import '../vc-tour/index.mjs';
import classNames from '../_util/classNames.mjs';
import '../hooks/index.mjs';
import { withInstall } from '../_util/type.mjs';
import getPlacements from '../_util/placements.mjs';
import panelRender from './panelRender.mjs';
import { tourProps } from './interface.mjs';
import useMergedType from './useMergedType.mjs';
import useStyle from './style/index.mjs';
import useConfigInject from '../config-provider/hooks/useConfigInject.mjs';
import Tour$1 from '../vc-tour/Tour.mjs';

const Tour = /* @__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(panelRender, mergeProps(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$1, mergeProps(attrs, restProps, {
        "rootClassName": customClassName,
        "prefixCls": prefixCls.value,
        "current": current2,
        "defaultCurrent": props.defaultCurrent,
        "animated": true,
        "renderPanel": mergedRenderPanel,
        "onChange": onStepChange,
        "steps": steps2,
        "builtinPlacements": builtinPlacements.value
      }), null));
    };
  }
});
var index = withInstall(Tour);

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