"use strict";
const common_vendor = require("../../../../../../common/vendor.js");
require("../../../../../adapter-vue.js");
const TUIKit_components_TUIChat_utils_translation = require("../../../utils/translation.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "translation-content",
  props: {
    message: { default: () => ({}) },
    translationContentVisible: { type: Boolean },
    isSingleTranslation: { type: Boolean },
    translationWrapperRef: {}
  },
  setup(__props) {
    const props = __props;
    const translationFinished = common_vendor.ref(false);
    const translationErrorText = common_vendor.ref("");
    const translationTextList = common_vendor.ref([]);
    common_vendor.watch(() => props.translationContentVisible, (newVal) => {
      if (newVal) {
        TUIKit_components_TUIChat_utils_translation.translator.get(props.message).then((result) => {
          translationFinished.value = true;
          translationTextList.value = result;
        }).catch((err) => {
          translationFinished.value = true;
          emits("toggleErrorStatus", true);
          translationErrorText.value = err.message;
        });
      }
    }, { immediate: true });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.unref(translationFinished)
      }, common_vendor.unref(translationFinished) ? common_vendor.e({
        b: common_vendor.unref(translationTextList).length > 0
      }, common_vendor.unref(translationTextList).length > 0 ? {
        c: common_vendor.f(common_vendor.unref(translationTextList), (text, index, i0) => {
          return common_vendor.e({
            a: text.type === "face"
          }, text.type === "face" ? {
            b: text.value
          } : {
            c: common_vendor.t(text.value)
          }, {
            d: index
          });
        })
      } : {
        d: common_vendor.t(common_vendor.unref(translationErrorText))
      }, {
        e: `translation-content-${props.message.ID}`
      }) : {}, {
        f: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUIChat.翻译中")),
        g: common_vendor.unref(translationFinished) ? 1 : ""
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-ef640ceb"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIChat/message-list/message-elements/message-translate/translation-content.js.map
