import { isArray } from "../../../../../@vue/shared/dist/shared.esm-bundler.mjs";
import { flattedChildren } from "../../../utils/vue/vnode.mjs";
import { defineComponent } from "vue";
var steps_default = defineComponent({
  name: "ElTourSteps",
  props: { current: {
    type: Number,
    default: 0
  } },
  emits: ["update-total"],
  setup(props, { slots, emit }) {
    let cacheTotal = 0;
    return () => {
      var _a, _b;
      const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
      const result = [];
      let total = 0;
      function filterSteps(children2) {
        if (!isArray(children2)) return;
        children2.forEach((item) => {
          var _a2;
          if (((_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name) === "ElTourStep") {
            result.push(item);
            total += 1;
          }
        });
      }
      if (children.length) filterSteps(flattedChildren((_b = children[0]) == null ? void 0 : _b.children));
      if (cacheTotal !== total) {
        cacheTotal = total;
        emit("update-total", total);
      }
      if (result.length) return result[props.current];
      return null;
    };
  }
});
export {
  steps_default as default
};
