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

import { isVNode, defineComponent, computed, createVNode } from 'vue';
import { i as isString_1 } from '../_chunks/dep-1cf2b129.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-a0b4a044.mjs';
import '../_chunks/dep-c959a6fb.mjs';
import '../_chunks/dep-b4041200.mjs';
import '../_chunks/dep-e3b14d70.mjs';
import '../_chunks/dep-66d6733b.mjs';
import '../_chunks/dep-c31e1d9e.mjs';
import '../config-provider/useConfig.mjs';
import '../_chunks/dep-44417261.mjs';
import '../_chunks/dep-bf74f1c2.mjs';
import '../_chunks/dep-79821ff2.mjs';
import '../_chunks/dep-0bfbf721.mjs';
import '../_chunks/dep-39cc276d.mjs';
import '../_chunks/dep-6b22dd27.mjs';
import '../_chunks/dep-0f0c89ff.mjs';
import '../_chunks/dep-8f777748.mjs';
import '../_chunks/dep-ae357f26.mjs';
import '../_chunks/dep-352691c2.mjs';
import '../_chunks/dep-2cfd5b3a.mjs';
import '../_chunks/dep-05fa17c9.mjs';
import '../_chunks/dep-a9c8a5d5.mjs';
import '../_chunks/dep-10085c61.mjs';
import '../_chunks/dep-1b058de3.mjs';
import '../_chunks/dep-c852a61a.mjs';
import '../_chunks/dep-92e7085e.mjs';
import '../_chunks/dep-44f056cd.mjs';
import '../_chunks/dep-23a0f453.mjs';
import '../_chunks/dep-99920870.mjs';
import '../_chunks/dep-c7e9ce16.mjs';
import '../_chunks/dep-3afa94cf.mjs';
import '../_chunks/dep-ba3c0b2e.mjs';
import '../_chunks/dep-ee57d235.mjs';
import '../_common/js/global-config/default-config.mjs';
import '../_common/js/global-config/locale/zh_CN.mjs';
import '../_chunks/dep-6b4aa943.mjs';
import '../_chunks/dep-d52291a9.mjs';
import '../config-provider/type.mjs';
import '../_chunks/dep-f6649a46.mjs';
import '../_chunks/dep-37ba476d.mjs';
import '../_chunks/dep-be27d184.mjs';
import '../_chunks/dep-1fe0ad42.mjs';
import '../_chunks/dep-d54f2690.mjs';
import '../_chunks/dep-59c8420d.mjs';
import '../_chunks/dep-74848b92.mjs';
import '../_chunks/dep-c4e1a112.mjs';
import '../utils/render-tnode.mjs';
import '../_chunks/dep-bd03960e.mjs';
import '../utils/withInstall.mjs';
import '../loading/directive.mjs';
import '../loading/plugin.mjs';
import '../_chunks/dep-eb20e23f.mjs';
import '../utils/dom.mjs';
import '../utils/easing.mjs';
import '../loading/loading.mjs';
import '../_chunks/dep-55846619.mjs';
import '../_chunks/dep-cfcedf47.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-e091cfd9.mjs';
import '../_chunks/dep-b6a73f93.mjs';
import '../_chunks/dep-6f89b77e.mjs';
import '../_chunks/dep-30451c48.mjs';
import '../_chunks/dep-6eea369f.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
