"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index = require("../../../hooks/use-namespace/index.js");
const index$1 = require("../../icon/index.js");
const constants = require("./constants.js");
const breadcrumbItem = require("./breadcrumb-item.js");
const Vue = require("vue");
var breadcrumb_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElBreadcrumbItem",
  __name: "breadcrumb-item",
  props: breadcrumbItem.breadcrumbItemProps,
  setup(__props) {
    const props = __props;
    const instance = Vue.getCurrentInstance();
    const breadcrumbContext = Vue.inject(constants.breadcrumbKey, void 0);
    const ns = index.useNamespace("breadcrumb");
    const router = instance.appContext.config.globalProperties.$router;
    const onClick = () => {
      if (!props.to || !router) return;
      props.replace ? router.replace(props.to) : router.push(props.to);
    };
    return (_ctx, _cache) => {
      var _a, _b;
      return Vue.openBlock(), Vue.createElementBlock("span", { class: Vue.normalizeClass(Vue.unref(ns).e("item")) }, [Vue.createElementVNode("span", {
        class: Vue.normalizeClass([Vue.unref(ns).e("inner"), Vue.unref(ns).is("link", !!__props.to)]),
        role: "link",
        onClick
      }, [Vue.renderSlot(_ctx.$slots, "default")], 2), ((_a = Vue.unref(breadcrumbContext)) == null ? void 0 : _a.separatorIcon) ? (Vue.openBlock(), Vue.createBlock(Vue.unref(index$1.ElIcon), {
        key: 0,
        class: Vue.normalizeClass(Vue.unref(ns).e("separator"))
      }, {
        default: Vue.withCtx(() => [(Vue.openBlock(), Vue.createBlock(Vue.resolveDynamicComponent(Vue.unref(breadcrumbContext).separatorIcon)))]),
        _: 1
      }, 8, ["class"])) : (Vue.openBlock(), Vue.createElementBlock("span", {
        key: 1,
        class: Vue.normalizeClass(Vue.unref(ns).e("separator")),
        role: "presentation"
      }, Vue.toDisplayString((_b = Vue.unref(breadcrumbContext)) == null ? void 0 : _b.separator), 3))], 2);
    };
  }
});
exports.default = breadcrumb_item_vue_vue_type_script_setup_true_lang_default;
