/**
 * ldesign v0.3.13
 * (c) 2023 ldesign
 * @license MIT
 */

import { isVNode, defineComponent, computed, createVNode } from 'vue';
import { i as isString_1 } from '../_chunks/dep-876fb3ec.mjs';
import { usePrefixClass, useCommonClassName } from '../hooks/useConfig.mjs';
import { useTNodeJSX } from '../hooks/tnode.mjs';
import { Loading } from '../loading/index.mjs';
import props from './props.mjs';
import '../_chunks/dep-eba0ea6e.mjs';
import '../_chunks/dep-469b4ae0.mjs';
import '../_chunks/dep-255303ba.mjs';
import '../_chunks/dep-b57180d0.mjs';
import '../_chunks/dep-c8d7b6b4.mjs';
import '../_chunks/dep-3da99438.mjs';
import '../config-provider/useConfig.mjs';
import '../_chunks/dep-095107f7.mjs';
import '../_chunks/dep-c989dff3.mjs';
import '../_chunks/dep-9cf86cf1.mjs';
import '../_chunks/dep-bc1d737a.mjs';
import '../_chunks/dep-4d7a675b.mjs';
import '../_chunks/dep-5717e263.mjs';
import '../_chunks/dep-a8bcacea.mjs';
import '../_chunks/dep-2e7f59b1.mjs';
import '../_chunks/dep-855db8bc.mjs';
import '../_chunks/dep-a87f3e4c.mjs';
import '../_chunks/dep-1e566bb5.mjs';
import '../_chunks/dep-1434aa15.mjs';
import '../_chunks/dep-e5eb9f23.mjs';
import '../_chunks/dep-9fe2ef12.mjs';
import '../_chunks/dep-672e7d1a.mjs';
import '../_chunks/dep-42a19209.mjs';
import '../_chunks/dep-9262ee2f.mjs';
import '../_chunks/dep-334a4f6b.mjs';
import '../_chunks/dep-8d3e9aa3.mjs';
import '../_chunks/dep-40d69a9c.mjs';
import '../_chunks/dep-dcc83161.mjs';
import '../_chunks/dep-0fc02184.mjs';
import '../_chunks/dep-f1994936.mjs';
import '../_chunks/dep-345e1be3.mjs';
import '../_common/js/global-config/default-config.mjs';
import '../_common/js/global-config/locale/zh_CN.mjs';
import '../_chunks/dep-9888611c.mjs';
import '../_chunks/dep-697a1365.mjs';
import '../config-provider/type.mjs';
import '../_chunks/dep-406cd044.mjs';
import '../_chunks/dep-42cc3015.mjs';
import '../_chunks/dep-2bc37d52.mjs';
import '../_chunks/dep-327559e8.mjs';
import '../_chunks/dep-b2235f26.mjs';
import '../_chunks/dep-8b989474.mjs';
import '../_chunks/dep-1372b2d3.mjs';
import '../_chunks/dep-9a85dac1.mjs';
import '../utils/render-tnode.mjs';
import '../_chunks/dep-888e80c4.mjs';
import '../utils/withInstall.mjs';
import '../loading/directive.mjs';
import '../loading/plugin.mjs';
import '../_chunks/dep-2db7b3ec.mjs';
import '../utils/dom.mjs';
import '../utils/easing.mjs';
import '../loading/loading.mjs';
import '../_chunks/dep-84acf3c2.mjs';
import '../_chunks/dep-b8d7992c.mjs';
import '../hooks/useTeleport.mjs';
import '../loading/props.mjs';
import '../loading/icon/gradient.mjs';
import '../_common/js/loading/circle-adapter.mjs';
import '../_common/js/utils/set-style.mjs';
import '../_common/js/utils/helper.mjs';
import '../_chunks/dep-bf1e33c8.mjs';
import '../_chunks/dep-60fae668.mjs';
import '../_chunks/dep-ed5ebb35.mjs';
import '../_chunks/dep-78847b2e.mjs';
import '../_chunks/dep-3f21269a.mjs';
import '../loading/style/css.mjs';
import '../loading/type.mjs';

function _isSlot(s) {
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
}
var _Card = defineComponent({
  name: "TCard",
  props: props,
  setup: function setup(props2, _ref) {
    var slots = _ref.slots;
    var renderTNodeJSX = useTNodeJSX();
    var COMPONENT_NAME = usePrefixClass("card");
    var _useCommonClassName = useCommonClassName(),
      SIZE = _useCommonClassName.SIZE;
    var baseCls = computed(function () {
      var defaultClass = [COMPONENT_NAME.value];
      if (props2.size === "small") defaultClass.push("".concat(SIZE.value[props2.size]));
      if (props2.bordered) defaultClass.push("".concat(COMPONENT_NAME.value, "--bordered"));
      if (props2.shadow) defaultClass.push("".concat(COMPONENT_NAME.value, "--shadow"));
      if (props2.hoverShadow) defaultClass.push("".concat(COMPONENT_NAME.value, "--shadow-hover"));
      return defaultClass;
    });
    var headerCls = computed(function () {
      var defaultClass = ["".concat(COMPONENT_NAME.value, "__header")];
      return props2.headerBordered ? defaultClass.concat("".concat(COMPONENT_NAME.value, "__title--bordered")) : ["".concat(COMPONENT_NAME.value, "__header")];
    });
    var headerWrapperCls = usePrefixClass("card__header-wrapper");
    var headerAvatarCls = usePrefixClass("card__avatar");
    var headerTitleCls = usePrefixClass("card__title");
    var headerSubTitleCls = usePrefixClass("card__subtitle");
    var headerDescriptionCls = usePrefixClass("card__description");
    var actionsCls = usePrefixClass("card__actions");
    var bodyCls = usePrefixClass("card__body");
    var coverCls = usePrefixClass("card__cover");
    var footerCls = usePrefixClass("card__footer");
    var footerWrapperCls = usePrefixClass("card__footer-wrapper");
    var isPoster2 = computed(function () {
      return props2.theme === "poster2";
    });
    var showTitle = computed(function () {
      return props2.title || slots.title;
    });
    var showHeader = computed(function () {
      return props2.header || slots.header;
    });
    var showSubtitle = computed(function () {
      return props2.subtitle || slots.subtitle;
    });
    var showAvatar = computed(function () {
      return props2.avatar || slots.avatar;
    });
    var showDescription = computed(function () {
      return props2.description || slots.description;
    });
    var showStatus = computed(function () {
      return props2.status || slots.status;
    });
    var showActions = computed(function () {
      return props2.actions || slots.actions;
    });
    var showFooter = computed(function () {
      return props2.footer || slots.footer;
    });
    var showCover = computed(function () {
      return props2.cover || slots.cover;
    });
    var showLoading = computed(function () {
      return props2.loading || slots.loading;
    });
    var showContent = computed(function () {
      return props2.content || slots.content || props2["default"] || slots["default"];
    });
    var isHeaderRender = computed(function () {
      return showHeader.value || showTitle.value || showSubtitle.value || showDescription.value || showAvatar.value || showStatus.value && isPoster2.value || showActions.value && !isPoster2.value;
    });
    var isFooterRender = computed(function () {
      return showFooter.value || showActions.value && isPoster2.value;
    });
    var renderHeader = function renderHeader() {
      if (showHeader.value) return createVNode("div", {
        "class": headerCls.value
      }, [renderTNodeJSX("header")]);
      return createVNode("div", {
        "class": headerCls.value
      }, [createVNode("div", {
        "class": headerWrapperCls.value
      }, [showAvatar.value && createVNode("div", {
        "class": headerAvatarCls.value
      }, [renderTNodeJSX("avatar")]), createVNode("div", null, [showTitle.value && createVNode("span", {
        "class": headerTitleCls.value
      }, [renderTNodeJSX("title")]), showSubtitle.value && createVNode("span", {
        "class": headerSubTitleCls.value
      }, [renderTNodeJSX("subtitle")]), showDescription.value && createVNode("p", {
        "class": headerDescriptionCls.value
      }, [renderTNodeJSX("description")])])]), showActions.value && !isPoster2.value && createVNode("div", {
        "class": actionsCls.value
      }, [renderTNodeJSX("actions")]), showStatus.value && createVNode("div", {
        "class": actionsCls.value
      }, [renderTNodeJSX("status")])]);
    };
    var renderCover = function renderCover() {
      var textCover = isString_1(props2.cover);
      return createVNode("div", {
        "class": coverCls.value
      }, [textCover ? createVNode("img", {
        "src": props2.cover
      }, null) : renderTNodeJSX("cover")]);
    };
    return function () {
      var content = createVNode("div", {
        "class": baseCls.value
      }, [isHeaderRender.value ? renderHeader() : null, showCover.value ? renderCover() : null, showContent.value && createVNode("div", {
        "class": bodyCls.value
      }, [renderTNodeJSX("default") || renderTNodeJSX("content")]), isFooterRender.value && createVNode("div", {
        "class": footerCls.value
      }, [createVNode("div", {
        "class": footerWrapperCls.value
      }, [renderTNodeJSX("footer")]), showActions.value && isPoster2.value && createVNode("div", {
        "class": actionsCls.value
      }, [renderTNodeJSX("actions")])])]);
      if (showLoading.value) return renderTNodeJSX("loading") || createVNode(Loading, null, _isSlot(content) ? content : {
        "default": function _default() {
          return [content];
        }
      });
      return content;
    };
  }
});

export { _Card as default };
//# sourceMappingURL=card.mjs.map
