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

import { isVNode, defineComponent, computed, createVNode } from 'vue';
import isString from 'lodash/isString';
import isArray from 'lodash/isArray';
import { usePrefixClass } from '../hooks/useConfig.js';
import { useTNodeJSX } from '../hooks/tnode.js';
import { Button } from '../button/index.js';
import props from './props.js';
import '../config-provider/useConfig.js';
import 'lodash/cloneDeep';
import 'lodash/isFunction';
import '../config-provider/context.js';
import 'lodash/mergeWith';
import 'lodash/merge';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import '../_chunks/dep-512eb181.js';
import 'dayjs';
import '../_chunks/dep-ac28b67c.js';
import '../config-provider/type.js';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../utils/render-tnode.js';
import 'lodash/isEmpty';
import 'lodash/isObject';
import '../utils/withInstall.js';
import '../button/button.js';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/defineProperty';
import '../loading/index.js';
import '../loading/directive.js';
import '../loading/plugin.js';
import '../utils/dom.js';
import '../utils/easing.js';
import '../loading/loading.js';
import '@babel/runtime/helpers/slicedToArray';
import '../hooks/useTeleport.js';
import '../loading/props.js';
import '../loading/icon/gradient.js';
import '../_common/js/loading/circle-adapter.js';
import '../_common/js/utils/set-style.js';
import '../_common/js/utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import 'lodash/isNull';
import 'lodash/isUndefined';
import 'lodash/isNumber';
import '../loading/style';
import '../loading/type.js';
import '../hooks/useRipple.js';
import '../utils/set-style.js';
import '../hooks/useKeepAnimation.js';
import '../form/hooks.js';
import '../button/props.js';
import '../button/style';
import '../button/type.js';

function _isSlot(s) {
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
}
var _Comment = defineComponent({
  name: "TComment",
  props: props,
  setup: function setup() {
    var COMPONENT_NAME = usePrefixClass("comment");
    var renderTNodeJSX = useTNodeJSX();
    return function () {
      var reply = renderTNodeJSX("reply");
      var author = renderTNodeJSX("author");
      var datetime = renderTNodeJSX("datetime");
      var quote = renderTNodeJSX("quote");
      var actions = renderTNodeJSX("actions");
      var content = renderTNodeJSX("content");
      var avatar = renderTNodeJSX("avatar");
      var showAuthorDatetime = computed(function () {
        return author || datetime;
      });
      var replyDom = reply ? createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__reply")
      }, [reply]) : null;
      var quoteDom = quote ? createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__quote")
      }, [quote]) : null;
      var avatarDom = avatar ? createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__avatar")
      }, [isString(avatar) ? createVNode("img", {
        "src": avatar,
        "alt": "",
        "class": "".concat(COMPONENT_NAME.value, "__avatar-image")
      }, null) : avatar]) : null;
      var authorDatetimeDom = showAuthorDatetime.value && createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__author")
      }, [author && createVNode("span", {
        "class": "".concat(COMPONENT_NAME.value, "__name")
      }, [author]), datetime && createVNode("span", {
        "class": "".concat(COMPONENT_NAME.value, "__time")
      }, [datetime])]);
      var renderActions = function renderActions() {
        if (!actions || !actions.length) return null;
        return createVNode("div", {
          "class": "".concat(COMPONENT_NAME.value, "__actions")
        }, [(isArray(actions) ? actions : [actions]).map(function (action, index) {
          return createVNode(Button, {
            "key": "action-".concat(index),
            "size": "small",
            "variant": "text"
          }, _isSlot(action) ? action : {
            "default": function _default() {
              return [action];
            }
          });
        })]);
      };
      var contentDom = createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__content")
      }, [authorDatetimeDom, createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__detail")
      }, [content]), quoteDom, renderActions()]);
      return createVNode("div", {
        "class": COMPONENT_NAME.value
      }, [createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__inner")
      }, [avatarDom, contentDom]), replyDom]);
    };
  }
});

export { _Comment as default };
//# sourceMappingURL=comment.js.map
