'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var CloseOutlined = require('@ant-design/icons-vue');
var index = require('../_util/vue-types/index.js');
var index$1 = require('../_util/props-util/index.js');
var dropdown = require('../dropdown/dropdown.js');
require('../hooks/index.js');
var type = require('../_util/type.js');
var useConfigInject = require('../config-provider/hooks/useConfigInject.js');

const breadcrumbItemProps = () => ({
  prefixCls: String,
  href: String,
  separator: index.default.any,
  dropdownProps: type.objectType(),
  overlay: index.default.any,
  onClick: type.eventType()
});
var BreadcrumbItem = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ABreadcrumbItem",
  inheritAttrs: false,
  __ANT_BREADCRUMB_ITEM: true,
  props: breadcrumbItemProps(),
  // emits: ['click'],
  slots: Object,
  setup(props, {
    slots,
    attrs,
    emit
  }) {
    const {
      prefixCls
    } = useConfigInject.default("breadcrumb", props);
    const renderBreadcrumbNode = (breadcrumbItem, prefixCls2) => {
      const overlay = index$1.getPropsSlot(slots, props, "overlay");
      if (overlay) {
        return vue.createVNode(dropdown.default, vue.mergeProps(props.dropdownProps, {
          "overlay": overlay,
          "placement": "bottom"
        }), {
          default: () => [vue.createVNode("span", {
            "class": `${prefixCls2}-overlay-link`
          }, [breadcrumbItem, vue.createVNode(CloseOutlined.DownOutlined, null, null)])]
        });
      }
      return breadcrumbItem;
    };
    const handleClick = (e) => {
      emit("click", e);
    };
    return () => {
      var _a;
      const separator = (_a = index$1.getPropsSlot(slots, props, "separator")) != null ? _a : "/";
      const children = index$1.getPropsSlot(slots, props);
      const {
        class: cls,
        style,
        ...restAttrs
      } = attrs;
      let link;
      if (props.href !== void 0) {
        link = vue.createVNode("a", vue.mergeProps({
          "class": `${prefixCls.value}-link`,
          "onClick": handleClick
        }, restAttrs), [children]);
      } else {
        link = vue.createVNode("span", vue.mergeProps({
          "class": `${prefixCls.value}-link`,
          "onClick": handleClick
        }, restAttrs), [children]);
      }
      link = renderBreadcrumbNode(link, prefixCls.value);
      if (children !== void 0 && children !== null) {
        return vue.createVNode("li", {
          "class": cls,
          "style": style
        }, [link, separator && vue.createVNode("span", {
          "class": `${prefixCls.value}-separator`
        }, [separator])]);
      }
      return null;
    };
  }
});

exports.breadcrumbItemProps = breadcrumbItemProps;
exports.default = BreadcrumbItem;
//# sourceMappingURL=BreadcrumbItem.js.map
