"use strict";
const common_vendor = require("../../../../common/vendor.js");
require("../../../adapter-vue.js");
const TUIKit_components_common_Toast_index = require("../../common/Toast/index.js");
const TUIKit_utils_env = require("../../../utils/env.js");
const TUIKit_components_common_Toast_type = require("../../common/Toast/type.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "manage-notification",
  props: {
    data: {
      type: Object,
      default: () => ({})
    },
    isAuthor: {
      type: Boolean,
      default: false
    }
  },
  emits: ["update", "close"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const groupProfile = common_vendor.ref({});
    const input = common_vendor.ref("");
    const isAuthorNotification = common_vendor.ref(false);
    const isEdit = common_vendor.ref(false);
    common_vendor.watchEffect(() => {
      groupProfile.value = props.data;
      input.value = groupProfile.value.notification;
      isAuthorNotification.value = props.isAuthor;
    });
    const emits = __emit;
    const updateProfile = () => {
      if (input.value.length > 150) {
        TUIKit_components_common_Toast_index.Toast({
          message: common_vendor.Wt.t("TUIGroup.群公告字数超出限制，最大长度为150"),
          type: TUIKit_components_common_Toast_type.TOAST_TYPE.ERROR
        });
        return;
      }
      if (input.value && input.value !== groupProfile.value.notification) {
        emits("update", { key: "notification", value: input.value });
        common_vendor.nextTick$1(() => {
          input.value = "";
        });
      }
      isEdit.value = !isEdit.value;
    };
    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.unref(isEdit)
      }, common_vendor.unref(isEdit) ? {
        c: common_vendor.o$1(updateProfile),
        d: common_vendor.unref(input),
        e: common_vendor.o$1(($event) => common_vendor.isRef(input) ? input.value = $event.detail.value : null)
      } : common_vendor.e({
        f: !common_vendor.unref(groupProfile).notification
      }, !common_vendor.unref(groupProfile).notification ? {
        g: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.暂无公告`))
      } : {
        h: common_vendor.t(common_vendor.unref(groupProfile).notification)
      }), {
        i: common_vendor.unref(isAuthorNotification)
      }, common_vendor.unref(isAuthorNotification) ? common_vendor.e({
        j: common_vendor.unref(isEdit)
      }, common_vendor.unref(isEdit) ? {
        k: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.发布`)),
        l: common_vendor.o$1(updateProfile)
      } : {
        m: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.编辑`)),
        n: common_vendor.o$1(($event) => isEdit.value = !common_vendor.unref(isEdit))
      }) : {}) : common_vendor.e({
        o: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.群公告`)),
        p: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`关闭`)),
        q: common_vendor.o$1(($event) => close("notification")),
        r: common_vendor.unref(isEdit)
      }, common_vendor.unref(isEdit) ? {
        s: common_vendor.n(common_vendor.unref(TUIKit_utils_env.isUniFrameWork) ? "uni-height" : ""),
        t: common_vendor.o$1(updateProfile),
        v: common_vendor.unref(input),
        w: common_vendor.o$1(($event) => common_vendor.isRef(input) ? input.value = $event.detail.value : null)
      } : common_vendor.e({
        x: !common_vendor.unref(groupProfile).notification
      }, !common_vendor.unref(groupProfile).notification ? {
        y: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.暂无公告`))
      } : {
        z: common_vendor.t(common_vendor.unref(groupProfile).notification)
      }), {
        A: common_vendor.unref(isAuthorNotification)
      }, common_vendor.unref(isAuthorNotification) ? common_vendor.e({
        B: common_vendor.unref(isEdit)
      }, common_vendor.unref(isEdit) ? {
        C: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.发布`)),
        D: common_vendor.o$1(updateProfile)
      } : {
        E: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.编辑`)),
        F: common_vendor.o$1(($event) => isEdit.value = !common_vendor.unref(isEdit))
      }) : {}));
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7e758e1e"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIGroup/manage-group/manage-notification.js.map
