"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const Avatar = require("../../common/Avatar.vue.js");
const Button = require("../../common/base/Button.vue.js");
const index = require("../../../locales/index.js");
require("../../../services/main.js");
const roomService = require("../../../services/roomService.js");
const TUIRoomEngine = require("@tencentcloud/tuiroom-engine-js");
require("mitt");
require("../../../services/manager/roomActionManager.js");
require("@tencentcloud/tui-core");
const Message = require("../../common/base/Message/Message.js");
const message = require("../../../constants/message.js");
const _hoisted_1 = { class: "member-invite-container" };
const _hoisted_2 = { class: "member-invite-item" };
const _hoisted_3 = { class: "user-name" };
const _hoisted_4 = {
  key: 0,
  class: "member-invite-reject"
};
const _hoisted_5 = {
  key: 1,
  class: "member-invite-calling"
};
const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
  __name: "MemberInvite",
  props: {
    userInfo: {}
  },
  setup(__props) {
    const { t } = index.useI18n();
    const showReject = Vue.ref(false);
    const handleInvite = () => {
      roomService.roomService.conferenceInvitationManager.inviteUsers({
        userIdList: [props.userInfo.userId]
      });
      Message.default({
        type: "success",
        message: t("Invitation sent, waiting for members to join."),
        duration: message.MESSAGE_DURATION.NORMAL
      });
    };
    const props = __props;
    Vue.watch(props.userInfo, (val) => {
      if (val.status === TUIRoomEngine.TUIInvitationStatus.kRejected) {
        showReject.value = true;
        setTimeout(() => {
          showReject.value = false;
        }, 3e3);
      }
    });
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createElementVNode("div", _hoisted_2, [
          Vue.createVNode(Avatar.default, {
            class: "avatar-url",
            "img-src": _ctx.userInfo.avatarUrl
          }, null, 8, ["img-src"]),
          Vue.createElementVNode("div", _hoisted_3, Vue.toDisplayString(_ctx.userInfo.userId || _ctx.userInfo.userName), 1)
        ]),
        showReject.value ? (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_4, Vue.toDisplayString(Vue.unref(t)("Not joining for now")), 1)) : Vue.createCommentVNode("", true),
        _ctx.userInfo.status === Vue.unref(TUIRoomEngine.TUIInvitationStatus).kPending ? (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_5, Vue.toDisplayString(Vue.unref(t)("Calling...")), 1)) : (Vue.openBlock(), Vue.createBlock(Button.default, {
          key: 2,
          class: "button",
          size: "default",
          onClick: handleInvite
        }, {
          default: Vue.withCtx(() => [
            Vue.createTextVNode(Vue.toDisplayString(Vue.unref(t)("Call")), 1)
          ]),
          _: 1
        }))
      ]);
    };
  }
});
exports.default = _sfc_main;
