import { defineComponent, provide, computed, createVNode, Fragment } from 'vue';
import { useTheme } from '../_theme/useTheme';
import { breadcrumbProps } from './props';
import { BREADCRUMB_KEY, prefixCls } from './const';

var breadcrumb = defineComponent({
  name: 'FBreadcrumb',
  props: breadcrumbProps,
  setup(props, _ref) {
    let {
      slots
    } = _ref;
    useTheme();
    provide(BREADCRUMB_KEY, {
      props
    });
    const breadcrumbStyle = computed(() => {
      return {
        fontSize: `${props.fontSize}px`
      };
    });

    // 渲染所有的层级
    const renderAllItem = () => {
      var _slots$default;
      const children = ((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)) || [];
      return children.map(item => {
        return createVNode(Fragment, null, [item]);
      });
    };
    return () => createVNode("div", {
      "class": prefixCls,
      "style": breadcrumbStyle.value
    }, [renderAllItem()]);
  }
});

export { breadcrumb as default };
