"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: "index",
  props: {
    searchType: {
      type: String,
      default: "global",
      // "global" / "conversation"
      validator(value) {
        return ["global", "conversation"].includes(value);
      }
    }
  },
  setup(__props) {
    const props = __props;
    const searchMoreRef = common_vendor.ref();
    const isListShow = common_vendor.ref(false);
    const toggleMore = () => {
      isListShow.value = !isListShow.value;
      if (!TUIKit_utils_env.isUniFrameWork && isListShow.value) {
        common_vendor.O.listen({
          domRefs: searchMoreRef.value,
          handler: closeSearchMore
        });
      }
    };
    const extensionList = common_vendor.ref([]);
    const handleMenu = (item) => {
      var _a;
      const { listener = { onClicked: () => {
      } } } = item;
      (_a = listener == null ? void 0 : listener.onClicked) == null ? void 0 : _a.call(listener, item);
      toggleMore();
    };
    const closeSearchMore = () => {
      isListShow.value = false;
    };
    common_vendor.onMounted(() => {
      extensionList.value = [
        ...common_vendor.R.getExtensionList(common_vendor.E.TUISearch.EXTENSION.SEARCH_MORE.EXT_ID)
      ];
      common_vendor.R.callService({
        serviceName: common_vendor.E.TUIConversation.SERVICE.NAME,
        method: common_vendor.E.TUIConversation.SERVICE.METHOD.HIDE_CONVERSATION_HEADER,
        params: {}
      });
    });
    common_vendor.watch(
      () => isListShow.value,
      () => {
        if (isListShow.value) {
          common_vendor.Jt.update(common_vendor.o.SEARCH, "currentSearchingStatus", {
            isSearching: false,
            searchType: props.searchType
          });
        }
      }
    );
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.p({
          file: common_vendor.unref(common_assets.searchMoreSVG),
          width: common_vendor.unref(TUIKit_utils_env.isPC) ? "28px" : "34px",
          height: common_vendor.unref(TUIKit_utils_env.isPC) ? "28px" : "34px"
        }),
        b: common_vendor.o$1(($event) => toggleMore()),
        c: common_vendor.unref(isListShow)
      }, common_vendor.unref(isListShow) ? {
        d: common_vendor.f(common_vendor.unref(extensionList), (extension, index, i0) => {
          return common_vendor.e({
            a: extension.icon
          }, extension.icon ? {
            b: "ea46662f-1-" + i0,
            c: common_vendor.p({
              file: extension.icon
            })
          } : {}, {
            d: common_vendor.t(extension.text),
            e: index,
            f: common_vendor.o$1(($event) => handleMenu(extension), index)
          });
        })
      } : {}, {
        e: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-search-more-h5")
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-ea46662f"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUISearch/search-more/index.js.map
