"use strict";
const common_vendor = require("../../../../common/vendor.js");
require("../../../adapter-vue.js");
const common_assets = require("../../../../common/assets.js");
const TUIKit_utils_env = require("../../../utils/env.js");
if (!Math) {
  Icon();
}
const Icon = () => "../../common/Icon.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "manage-member",
  props: {
    list: {
      type: Array,
      default: () => []
    },
    total: {
      type: Number,
      default: () => 0
    },
    isShowDel: {
      type: Boolean,
      default: () => false
    },
    self: {
      type: Object,
      default: () => ({})
    }
  },
  emits: ["more", "del", "handleMemberProfileShow", "close"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const totalMember = common_vendor.ref(0);
    const memberList = common_vendor.ref([]);
    const isShowDeleteBtn = common_vendor.ref(false);
    const selfValue = common_vendor.ref({});
    common_vendor.watchEffect(() => {
      totalMember.value = props.total;
      isShowDeleteBtn.value = props.isShowDel;
      memberList.value = props.list;
      selfValue.value = props.self;
    });
    const emits = __emit;
    const handleRoleName = (item) => {
      let name = "";
      switch (item == null ? void 0 : item.role) {
        case common_vendor.qt.TYPES.GRP_MBR_ROLE_ADMIN:
          name = common_vendor.Wt.t("TUIGroup.管理员");
          break;
        case common_vendor.qt.TYPES.GRP_MBR_ROLE_OWNER:
          name = common_vendor.Wt.t("TUIGroup.群主");
          break;
      }
      if (name) {
        name = `(${name})`;
      }
      if (item.userID === selfValue.value.userID) {
        name += ` (${common_vendor.Wt.t("TUIGroup.我")})`;
      }
      return name;
    };
    const getMore = () => {
      emits("more");
    };
    const submit = (item) => {
      emits("del", [item]);
    };
    const handleMemberProfileShow = (user) => {
      emits("handleMemberProfileShow", user);
    };
    const close = (tabName) => {
      emits("close", tabName);
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: !common_vendor.unref(TUIKit_utils_env.isUniFrameWork)
      }, !common_vendor.unref(TUIKit_utils_env.isUniFrameWork) ? common_vendor.e({
        b: common_vendor.f(common_vendor.unref(memberList), (item, index, i0) => {
          return common_vendor.e({
            a: item.avatar || "https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png",
            b: common_vendor.t(item.nick || item.userID),
            c: common_vendor.t(handleRoleName(item)),
            d: common_vendor.o$1(($event) => handleMemberProfileShow(item), index),
            e: item.role !== "Owner" && common_vendor.unref(isShowDeleteBtn)
          }, item.role !== "Owner" && common_vendor.unref(isShowDeleteBtn) ? {
            f: "a4ec002a-0-" + i0,
            g: common_vendor.p({
              file: common_vendor.unref(common_assets.delIcon$1),
              width: "16px",
              height: "16px"
            })
          } : {}, {
            h: common_vendor.o$1(($event) => submit(item), index),
            i: index
          });
        }),
        c: common_vendor.unref(memberList).length < common_vendor.unref(totalMember)
      }, common_vendor.unref(memberList).length < common_vendor.unref(totalMember) ? {
        d: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.查看更多`)),
        e: common_vendor.o$1(getMore)
      } : {}) : common_vendor.e({
        f: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.群成员`)),
        g: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`关闭`)),
        h: common_vendor.o$1(($event) => close("member")),
        i: common_vendor.f(common_vendor.unref(memberList), (item, index, i0) => {
          return common_vendor.e({
            a: item.avatar || "https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png",
            b: common_vendor.t(item.nick || item.userID),
            c: common_vendor.t(handleRoleName(item)),
            d: common_vendor.o$1(($event) => handleMemberProfileShow(item), index),
            e: item.role !== "Owner" && common_vendor.unref(isShowDeleteBtn)
          }, item.role !== "Owner" && common_vendor.unref(isShowDeleteBtn) ? {
            f: "a4ec002a-1-" + i0,
            g: common_vendor.p({
              file: common_vendor.unref(common_assets.delIcon$1),
              width: "16px",
              height: "16px"
            })
          } : {}, {
            h: common_vendor.o$1(($event) => submit(item), index),
            i: index
          });
        }),
        j: common_vendor.unref(memberList).length < common_vendor.unref(totalMember)
      }, common_vendor.unref(memberList).length < common_vendor.unref(totalMember) ? {
        k: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.查看更多`)),
        l: common_vendor.o$1(getMore)
      } : {}));
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-a4ec002a"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIGroup/manage-group/manage-member.js.map
