/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var utils_renderNode = require('../../utils/render-node.js');
var components_configProvider_configReceiver = require('../config-provider/config-receiver.js');
var utils_mixins = require('../../utils/mixins.js');
var components_comment_props = require('./props.js');
require('vue');
require('lodash');
require('lodash/mergeWith');
require('../config-provider/context.js');
require('../../chunks/zh_CN.js');

const classPrefixMixins = components_configProvider_configReceiver.getClassPrefixMixins("comment");
var _Comment = utils_mixins["default"](classPrefixMixins).extend({
  name: "LComment",
  props: components_comment_props["default"],
  methods: {
    renderReply() {
      const h = this.$createElement;
      const reply = utils_renderNode.renderLNodeJSX(this, "reply");
      return reply ? h("div", {
        "class": `${this.componentName}__reply`
      }, [reply]) : null;
    },
    renderActions() {
      const h = this.$createElement;
      const actions = utils_renderNode.renderLNodeJSX(this, "actions");
      return actions && actions.length ? h("ul", {
        "class": `${this.componentName}__actions`
      }, [actions.map((action, index) => h("li", {
        "key": `action-${index}`
      }, [action]))]) : null;
    },
    renderQuote() {
      const h = this.$createElement;
      const quote = utils_renderNode.renderLNodeJSX(this, "quote");
      return quote ? h("div", {
        "class": `${this.componentName}__quote`
      }, [quote]) : null;
    },
    renderAuthorDatetime() {
      const h = this.$createElement;
      const author = utils_renderNode.renderLNodeJSX(this, "author");
      const datetime = utils_renderNode.renderLNodeJSX(this, "datetime");
      return (author || datetime) && h("div", {
        "class": `${this.componentName}__author`
      }, [author && h("span", {
        "class": `${this.componentName}__name`
      }, [author]), datetime && h("span", {
        "class": `${this.componentName}__time`
      }, [datetime])]);
    },
    renderContent() {
      const h = this.$createElement;
      return h("div", {
        "class": `${this.componentName}__content`
      }, [this.renderAuthorDatetime(), h("div", {
        "class": `${this.componentName}__detail`
      }, [utils_renderNode.renderLNodeJSX(this, "content")]), this.renderQuote(), this.renderActions()]);
    },
    renderAvatar() {
      const h = this.$createElement;
      const avatar = utils_renderNode.renderLNodeJSX(this, "avatar");
      return avatar ? h("div", {
        "class": `${this.componentName}__avatar`
      }, [typeof avatar === "string" ? h("img", {
        "attrs": {
          "src": avatar,
          "alt": ""
        },
        "class": `${this.componentName}__avatar-image`
      }) : avatar]) : null;
    }
  },
  render() {
    const h = arguments[0];
    return h("div", {
      "class": this.componentName
    }, [h("div", {
      "class": `${this.componentName}__inner`
    }, [this.renderAvatar(), this.renderContent()]), this.renderReply()]);
  }
});

exports["default"] = _Comment;
//# sourceMappingURL=comment.js.map
