"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 button = require("./button.js");
const useButton = require("./use-button.js");
const buttonCustom = require("./button-custom.js");
const vue = require("vue");
var button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  name: "ElButton",
  __name: "button",
  props: button.buttonProps,
  emits: button.buttonEmits,
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const buttonStyle = buttonCustom.useButtonCustomStyle(props);
    const ns = index.useNamespace("button");
    const { _ref, _size, _type, _disabled, _props, _plain, _round, _text, _dashed, shouldAddSpace, handleClick } = useButton.useButton(props, emit);
    const buttonKls = vue.computed(() => [
      ns.b(),
      ns.m(_type.value),
      ns.m(_size.value),
      ns.is("disabled", _disabled.value),
      ns.is("loading", props.loading),
      ns.is("plain", _plain.value),
      ns.is("round", _round.value),
      ns.is("circle", props.circle),
      ns.is("text", _text.value),
      ns.is("dashed", _dashed.value),
      ns.is("link", props.link),
      ns.is("has-bg", props.bg)
    ]);
    __expose({
      ref: _ref,
      size: _size,
      type: _type,
      disabled: _disabled,
      shouldAddSpace
    });
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(__props.tag), vue.mergeProps({
        ref_key: "_ref",
        ref: _ref
      }, vue.unref(_props), {
        class: buttonKls.value,
        style: vue.unref(buttonStyle),
        onClick: vue.unref(handleClick)
      }), {
        default: vue.withCtx(() => [__props.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [_ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(index$1.ElIcon), {
          key: 1,
          class: vue.normalizeClass(vue.unref(ns).is("loading"))
        }, {
          default: vue.withCtx(() => [(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(__props.loadingIcon)))]),
          _: 1
        }, 8, ["class"]))], 64)) : __props.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.ElIcon), { key: 1 }, {
          default: vue.withCtx(() => [__props.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(__props.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 })]),
          _: 3
        })) : vue.createCommentVNode("v-if", true), _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
          key: 2,
          class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) })
        }, [vue.renderSlot(_ctx.$slots, "default")], 2)) : vue.createCommentVNode("v-if", true)]),
        _: 3
      }, 16, [
        "class",
        "style",
        "onClick"
      ]);
    };
  }
});
exports.default = button_vue_vue_type_script_setup_true_lang_default;
