import { defineComponent, ref, computed, openBlock, createElementBlock, Fragment, renderList, withModifiers, createElementVNode, createVNode, toDisplayString, unref, createBlock, normalizeClass, isRef, withCtx, watch, watchEffect, withDirectives, vModelText, createCommentVNode, renderSlot, normalizeStyle, pushScopeId, popScopeId, nextTick } from "vue";
import { a as _sfc_main$8, _ as _export_sfc, S as Store } from "./index2.js";
import { e as en_default_logo, _ as _sfc_main$6, o as onDebounce, c as corp_search_no_result } from "./index4.js";
import { _ as _sfc_main$7 } from "./index12.js";
import { G as GET, p as proxy_api } from "./http.js";
import { d as deleteIcon } from "./delete.js";
import "vant";
import "@wltech/svg";
var index_vue_vue_type_style_index_0_lang$3 = "";
const _hoisted_1$5 = {
  class: "enterprise-list",
  "data-weiling-mobile-ui-bc-enterprise-list": ""
};
const _hoisted_2$4 = ["onClick"];
const _hoisted_3$4 = { class: "avatar" };
const _hoisted_4$2 = { class: "item-name" };
const _hoisted_5$2 = {
  key: 1,
  class: "retract-enterprise"
};
const _hoisted_6$2 = { class: "retract-avatars" };
const _hoisted_7$2 = { class: "retract-text-wrap" };
const _hoisted_8$1 = { class: "retract-text name" };
const _hoisted_9$1 = ["onClick"];
const _hoisted_10$1 = {
  class: "enterprise-popup",
  "data-weiling-mobile-ui-bc-enterprise-list-enterprise-popup": ""
};
const _hoisted_11$1 = { class: "content" };
const _hoisted_12$1 = ["onClick"];
const _hoisted_13$1 = { class: "avatar" };
const _hoisted_14$1 = { class: "item-name" };
const __default__$4 = {
  name: "BCEnterpriseList"
};
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  ...__default__$4,
  props: {
    data: { default: () => [] },
    retract: { default: 2 },
    defaultAvatar: { default: en_default_logo },
    canViewMore: { type: Boolean, default: true }
  },
  emits: ["onClickEnterprise", "onClickRetract"],
  setup(__props, { emit }) {
    const props = __props;
    let popupVisible = ref(false);
    const retractImgs = computed(() => {
      const temp_arr = props.data.slice(0, props.retract + 1);
      return temp_arr.reduce((acc, item) => {
        if (props.retract < props.data.length) {
          acc.push(item["image_url"]);
        }
        return acc;
      }, []);
    });
    const onClickEnterprise = (item) => {
      emit("onClickEnterprise", item);
    };
    const onClickRetract = () => {
      if (!props.canViewMore)
        return;
      popupVisible.value = true;
      emit("onClickRetract", true);
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$5, [
        __props.data.length <= __props.retract ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.data, (item) => {
          return openBlock(), createElementBlock("div", {
            class: "enterprise-item",
            key: item.company_id,
            onClick: withModifiers(($event) => onClickEnterprise(item), ["stop"])
          }, [
            createElementVNode("p", _hoisted_3$4, [
              createVNode(_sfc_main$6, {
                src: item.image_url || __props.defaultAvatar
              }, null, 8, ["src"])
            ]),
            createElementVNode("p", _hoisted_4$2, toDisplayString(item.company_name), 1)
          ], 8, _hoisted_2$4);
        }), 128)) : (openBlock(), createElementBlock("div", _hoisted_5$2, [
          createElementVNode("div", _hoisted_6$2, [
            (openBlock(true), createElementBlock(Fragment, null, renderList(unref(retractImgs), (item, index2) => {
              return openBlock(), createBlock(_sfc_main$6, {
                class: "avatar",
                key: index2,
                src: item || __props.defaultAvatar
              }, null, 8, ["src"]);
            }), 128))
          ]),
          createElementVNode("div", _hoisted_7$2, [
            createElementVNode("p", _hoisted_8$1, toDisplayString(__props.data[0].company_name), 1),
            createElementVNode("p", {
              class: normalizeClass(["retract-text", { "retract-text--clickable": __props.canViewMore }]),
              onClick: withModifiers(onClickRetract, ["stop"])
            }, " \u5171" + toDisplayString(__props.data.length) + "\u5BB6 ", 11, _hoisted_9$1)
          ])
        ])),
        createVNode(_sfc_main$7, {
          modelValue: unref(popupVisible),
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(popupVisible) ? popupVisible.value = $event : popupVisible = $event),
          position: "bottom",
          style: { height: "300px" },
          round: "",
          title: "\u4F01\u4E1A",
          headerVisible: true
        }, {
          default: withCtx(() => [
            createElementVNode("div", _hoisted_10$1, [
              createElementVNode("div", _hoisted_11$1, [
                (openBlock(true), createElementBlock(Fragment, null, renderList(__props.data, (item) => {
                  return openBlock(), createElementBlock("div", {
                    class: "enterprise-popup-item",
                    key: item.company_id,
                    onClick: withModifiers(($event) => onClickEnterprise(item), ["stop"])
                  }, [
                    createElementVNode("p", _hoisted_13$1, [
                      createVNode(_sfc_main$6, {
                        src: item.image_url || __props.defaultAvatar
                      }, null, 8, ["src"])
                    ]),
                    createElementVNode("p", _hoisted_14$1, toDisplayString(item.company_name), 1),
                    createVNode(_sfc_main$8, {
                      type: "arrowRight",
                      width: "16",
                      height: "16",
                      color: "var(--wl-text-color-secondary-2)"
                    })
                  ], 8, _hoisted_12$1);
                }), 128))
              ])
            ])
          ]),
          _: 1
        }, 8, ["modelValue"])
      ]);
    };
  }
});
_sfc_main$5.install = (app) => {
  app.component(_sfc_main$5.name, _sfc_main$5);
};
var Api = {
  getCompanySearchList(paramas, node_env) {
    return GET(
      `${proxy_api[node_env]}/crm_v2/web/company/fuzzy_search/list`,
      paramas
    );
  }
};
var loading = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKgAAACoCAMAAABDlVWGAAAAn1BMVEUAAADPz8/Pz8/Ozs7Pz8/f39/Pz8/Pz8/Pz8/Pz8/R0dHNzc3KysrPz8/Q0NBYr+/Ozs4povxFqvRvtekcn/+IvOK9ytWoxdrR0dEhoP0cn/82pvggn/8gn/9PrfIdn/8dn/8cn/9jsewen/8env8cn/8iof4dn/8upPuXwN4bn/8dn//U1NTR0dEcnv8cn/98uecbn/8+p/ZIq/Mcn/8h8HKLAAAANHRSTlMAgHB4EAhgIDBQSDgYQGi/WO/Pr5+fh48o93/fIBDH79+/t29fz5Aw55hgUBhYP6+n39d/L+ykBAAABpNJREFUeNrUmmt7ojAQhScJBAigteKt1lp1vXTdXpf//9u2UFtNJiIagez7vfU858wZEhSuhBv5oQg4pZTkMNriNyIeei5YQ+QLzkhGr9vuftLrPfXJD4wLP4Km8cJcY05vnB7QGX+0u73+j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EgVIWG1Y0C6H+0ECq+2fdkaDqsidmuWx0hjCcp6tLGXHBPe0If04sHoKajMhsuT3BMwpKIuaDPERvaAxyYJbn3xzEHtVYBePtrOgPkXtAHJ43B4Tk0VDyqi+l9xis09vz8POMVQHiULCZYxhabxDdcx55Vem2GoO41mcNSs9SWYGu8Nv0xReIlgCMsxSL80B9ZK+xzICTP+Qgj0zvonJ9UgdAEiaElUMrUNiRcYfES0XkCwSky6OkRbtbe1rl+j6G5PNrLHFgCsjaiRIhKkvKwhIIi8ZE3KIpKuULaoSqySDmxUjyODyBYhOgsMUfSQirmnHTlED9IhJBD0X/YSlqolKPjyRLWcYuGdTk6zMue5d0xhqkrweov0RawjXZPx/gZFJbyYJ14hQY/lGMSvB/QSZomvCyhFgEKdObogNwpbi6MDS/VV1mEWgUo0LM5i9HHBHgJ871w/Ak3ktdzHlbTkC1tVRGSCCCxFXAtrqW+VFW/oYoIjQmQmlgR3o0AjEsE7aXm22XRy+AhwpsiyxI5keaWd2UBBYIlTGD+AzomWAQ4RCtcYzpWYrNHT5w4cTz8Aaz4M79MeVvFAAAAAElFTkSuQmCC";
var index_vue_vue_type_style_index_0_lang$2 = "";
const _hoisted_1$4 = {
  class: "search-wrap",
  "data-weiling-mobile-ui-wl-search": ""
};
const _hoisted_2$3 = { class: "search-icon" };
const _hoisted_3$3 = { class: "search-input" };
const _hoisted_4$1 = ["placeholder"];
const _hoisted_5$1 = { class: "action" };
const _hoisted_6$1 = { class: "default-search-content" };
const _hoisted_7$1 = { class: "search-text" };
const __default__$3 = {
  name: "WlSearch"
};
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  ...__default__$3,
  props: {
    modelValue: { default: "" },
    icon: { default: searchIcon },
    placeholder: { default: "\u641C\u7D22" },
    closable: { type: Boolean, default: true },
    needBorder: { type: Boolean, default: true },
    showType: { default: "search" }
  },
  emits: ["onClear", "onClickDefault", "onChange", "onBlurChange", "onChinaChange", "update:modelValue"],
  setup(__props, { expose, emit }) {
    const props = __props;
    const fieldValue = ref("");
    const is_focus = ref(false);
    const inputRef = ref(null);
    let isChinaInput = false;
    const searchClass = computed(() => {
      return {
        search: true,
        "search-focus": is_focus.value,
        "search-border": props.needBorder
      };
    });
    const onClickDefault = () => emit("onClickDefault");
    const onClear = () => {
      fieldValue.value = "";
      emit("update:modelValue", "");
      emit("onChange", "");
      emit("onClear");
    };
    const onDebounceSave = onDebounce((event) => {
      if (!isChinaInput) {
        const val = event.target.value;
        emit("update:modelValue", val);
        emit("onChange", val);
      }
    }, 300);
    const onContentChange = onDebounce((event) => {
      var _a;
      const val = (_a = event.target) == null ? void 0 : _a.value;
      emit("update:modelValue", val);
      emit("onBlurChange", val);
    }, 300);
    const compositionend = () => {
      isChinaInput = false;
    };
    const compositionstart = () => {
      isChinaInput = true;
    };
    const onFocus = () => {
      var _a;
      (_a = inputRef.value) == null ? void 0 : _a.focus();
    };
    expose({
      onFocus,
      inputEl: inputRef
    });
    watch(
      () => fieldValue.value,
      (val) => {
        emit("update:modelValue", val);
      }
    );
    watchEffect(() => {
      fieldValue.value = props.modelValue;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$4, [
        __props.showType === "search" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
          createElementVNode("div", {
            class: normalizeClass(unref(searchClass))
          }, [
            createElementVNode("div", _hoisted_2$3, [
              createVNode(_sfc_main$6, { src: __props.icon }, null, 8, ["src"])
            ]),
            createElementVNode("div", _hoisted_3$3, [
              withDirectives(createElementVNode("input", {
                type: "text",
                placeholder: __props.placeholder,
                "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => fieldValue.value = $event),
                ref_key: "inputRef",
                ref: inputRef,
                onInput: _cache[1] || (_cache[1] = (...args) => unref(onDebounceSave) && unref(onDebounceSave)(...args)),
                onChange: _cache[2] || (_cache[2] = (...args) => unref(onContentChange) && unref(onContentChange)(...args)),
                onFocus: _cache[3] || (_cache[3] = ($event) => is_focus.value = true),
                onBlur: _cache[4] || (_cache[4] = ($event) => is_focus.value = false),
                onCompositionend: compositionend,
                onCompositionstart: compositionstart
              }, null, 40, _hoisted_4$1), [
                [vModelText, fieldValue.value]
              ])
            ]),
            __props.closable && fieldValue.value ? (openBlock(), createElementBlock("div", {
              key: 0,
              class: "search-close-icon",
              onClick: onClear
            }, [
              createVNode(_sfc_main$6, { src: unref(deleteIcon) }, null, 8, ["src"])
            ])) : createCommentVNode("", true)
          ], 2),
          createElementVNode("div", _hoisted_5$1, [
            renderSlot(_ctx.$slots, "action")
          ])
        ], 64)) : createCommentVNode("", true),
        __props.showType === "default" ? (openBlock(), createElementBlock("div", {
          key: 1,
          class: "default-search",
          onClick: onClickDefault
        }, [
          createElementVNode("div", _hoisted_6$1, [
            createVNode(_sfc_main$8, {
              type: "search",
              width: "18",
              height: "18",
              color: "#c1c1c1"
            }),
            createElementVNode("span", _hoisted_7$1, toDisplayString(__props.placeholder), 1)
          ])
        ])) : createCommentVNode("", true)
      ]);
    };
  }
});
var freeLimit = "data:image/png;base64, ";
var index_vue_vue_type_style_index_0_lang$1 = "";
const _hoisted_1$3 = { class: "limit-time-free" };
const __default__$2 = {
  name: "LimitedTimeFreeTag"
};
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  ...__default__$2,
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$3, [
        createVNode(_sfc_main$6, {
          class: "img",
          src: unref(freeLimit)
        }, null, 8, ["src"])
      ]);
    };
  }
});
var index_vue_vue_type_style_index_0_scoped_true_lang$1 = "";
const _withScopeId$1 = (n) => (pushScopeId("data-v-775b3ca8"), n = n(), popScopeId(), n);
const _hoisted_1$2 = { class: "wrapper" };
const _hoisted_2$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("div", { class: "text" }, "\u4EE5\u4E0A\u7ED3\u679C\u6CA1\u6709\u6211\u60F3\u8981\u7684\u4F01\u4E1A\uFF0C\u76F4\u63A5\u521B\u5EFA\uFF1A", -1));
const _hoisted_3$2 = { class: "company-name" };
const __default__$1 = {
  name: "Tip"
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  ...__default__$1,
  props: {
    modelValue: { type: Boolean, default: false },
    company_name: { default: "" }
  },
  emits: ["close_tip_visible"],
  setup(__props, { emit }) {
    const props = __props;
    const tip_visible = ref();
    const onClick = () => {
      tip_visible.value = false;
      emit("close_tip_visible", tip_visible.value);
    };
    watchEffect(() => {
      tip_visible.value = props.modelValue;
    });
    const tipPopStyle = computed(() => {
      return {
        height: "15%",
        boxShadow: "0px 0px 4px 6px #eee",
        overflow: "initial",
        boxSizing: "border-box"
      };
    });
    return (_ctx, _cache) => {
      return openBlock(), createBlock(_sfc_main$7, {
        modelValue: tip_visible.value,
        "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => tip_visible.value = $event),
        round: "",
        position: "bottom",
        overlay: false,
        style: normalizeStyle(unref(tipPopStyle)),
        onClick
      }, {
        default: withCtx(() => [
          createElementVNode("div", _hoisted_1$2, [
            _hoisted_2$2,
            createElementVNode("div", _hoisted_3$2, toDisplayString(__props.company_name), 1)
          ])
        ]),
        _: 1
      }, 8, ["modelValue", "style"]);
    };
  }
});
var Tip = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-775b3ca8"]]);
var index_vue_vue_type_style_index_0_lang = "";
const _hoisted_1$1 = {
  class: "search-enterprise-popup",
  "data-weiling-mobile-ui-bc-search-enterprise-popup": ""
};
const _hoisted_2$1 = { class: "search-list-content-wrap" };
const _hoisted_3$1 = { class: "operation-wrap" };
const _hoisted_4 = { class: "search-wrap" };
const _hoisted_5 = {
  key: 0,
  class: "recommend-list"
};
const _hoisted_6 = /* @__PURE__ */ createElementVNode("span", { class: "title" }, "\u63A8\u8350\uFF1A", -1);
const _hoisted_7 = ["onClick"];
const _hoisted_8 = {
  key: 1,
  class: "search-result"
};
const _hoisted_9 = ["onClick"];
const _hoisted_10 = { class: "content" };
const _hoisted_11 = { class: "company-name" };
const _hoisted_12 = ["innerHTML"];
const _hoisted_13 = {
  key: 0,
  class: "is_exist"
};
const _hoisted_14 = {
  key: 1,
  class: "matching-reason"
};
const _hoisted_15 = {
  key: 0,
  class: "oper-name-wrap"
};
const _hoisted_16 = /* @__PURE__ */ createElementVNode("span", null, "\u6CD5\u4EBA\uFF1A", -1);
const _hoisted_17 = { key: 0 };
const _hoisted_18 = ["innerHTML"];
const _hoisted_19 = {
  key: 1,
  class: "loading"
};
const _hoisted_20 = { class: "loading-pic" };
const _hoisted_21 = { key: 2 };
const __default__ = {
  name: "BCSearchEnterprisePopup"
};
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    defaultSearchVal: { default: "" },
    modelValue: { type: Boolean, default: false },
    recommendList: { default: () => {
      return { list: [] };
    } },
    needFreeTag: { type: Boolean, default: true },
    hidden_mathch_type: { default: () => {
      return { type: ["\u516C\u53F8\u540D\u79F0\u5339\u914D", "\u6CD5\u5B9A\u4EE3\u8868\u4EBA\u5339\u914D"] };
    } },
    env_data: { default: () => {
      return {
        sid: "",
        domain: "",
        corp_id: "",
        node_env: "dev",
        app_id: "",
        token: "",
        card_resource: ""
      };
    } }
  },
  emits: ["onChange", "onChoose", "update:modelValue", "onClose", "sendSearchValue"],
  setup(__props, { emit }) {
    const props = __props;
    let popUpVisible = ref(false);
    let searchValue = ref("");
    let showLoading = ref(false);
    let searchResult = ref([]);
    const showRecommend = computed(() => {
      var _a, _b;
      return !searchValue.value && ((_b = (_a = props.recommendList) == null ? void 0 : _a.list) == null ? void 0 : _b.length) !== 0;
    });
    Store.corp_id = props.env_data.corp_id;
    Store.sid = props.env_data.sid;
    Store.node_env = props.env_data.node_env;
    Store.token = props.env_data.token;
    Store.card_resource = props.env_data.card_resource;
    const getData = async () => {
      if (!searchValue.value) {
        searchResult.value = [];
        showLoading.value = false;
        onSetTipVisible(searchResult.value);
        return;
      }
      const res = await Api.getCompanySearchList(
        {
          keyword: searchValue.value,
          corp_id: props.env_data.corp_id,
          sid: props.env_data.sid
        },
        props.env_data.node_env
      );
      const { data = [] } = res;
      const list = data.map((ele) => {
        const {
          name,
          company_id: value,
          start_date,
          status,
          credit_code: creditCode,
          flag,
          oper_name,
          match_type,
          platform_id,
          company_id
        } = ele;
        return {
          ...ele,
          label: name,
          value,
          isExist: flag === 1,
          startDate: start_date,
          status,
          creditCode,
          oper_name,
          match_type,
          platform_id,
          company_id,
          highlightLabel: name == null ? void 0 : name.replace(
            searchValue,
            `<span class="search-text">${searchValue.value}</span>`
          ),
          highlightOper: oper_name == null ? void 0 : oper_name.replace(
            searchValue,
            `<span class="search-text">${searchValue.value}</span>`
          )
        };
      });
      searchValue.value ? searchResult.value = list : searchResult.value = [];
      showLoading.value = false;
      onSetTipVisible(searchResult.value);
    };
    const onClosePopup = () => {
      setTimeout(() => {
        emit("update:modelValue", false);
      }, 350);
      emit("onClose");
      nextTick(() => {
        popUpVisible.value = false;
      });
    };
    const onClear = () => {
      searchValue.value = "";
      showLoading.value = false;
      onClearList();
    };
    const onChange = (val) => {
      if (val.trim()) {
        showLoading.value = true;
      }
      if (val && !val.trim()) {
        searchValue.value = "";
      }
      matching.value = false;
      getData();
    };
    const onChoose = (item) => {
      emit("onChoose", item);
      popUpVisible.value = false;
      matching.value = false;
    };
    const onSelectRecommend = (item) => {
      searchValue.value = item;
      emit("onChange", item);
      showLoading.value = true;
      getData();
    };
    const onClearList = () => {
      searchResult.value = [];
    };
    const popStyle = computed(() => {
      return {
        height: "75%",
        "border-top-left-radius": props.needFreeTag ? 0 : "",
        overflow: "initial",
        zIndex: 2001
      };
    });
    const matching = ref(false);
    const close_tip_visible = (flag) => {
      matching.value = flag;
      popUpVisible.value = flag;
      emit("sendSearchValue", searchValue.value);
    };
    const onSetTipVisible = (list) => {
      if (searchValue.value) {
        matching.value = popUpVisible.value && !list.some((i) => i.label === searchValue.value);
      } else {
        matching.value = false;
      }
    };
    const init = () => {
      if (searchValue.value !== "") {
        showLoading.value = true;
        getData();
      } else {
        onClearList();
      }
    };
    watch(
      () => props.modelValue,
      () => {
        popUpVisible.value = props.modelValue;
        if (!popUpVisible.value) {
          matching.value = false;
        }
        if (searchValue.value !== props.defaultSearchVal) {
          searchValue.value = props.defaultSearchVal;
          init();
        }
      },
      {
        immediate: true
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", null, [
        createVNode(_sfc_main$7, {
          modelValue: unref(popUpVisible),
          "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(popUpVisible) ? popUpVisible.value = $event : popUpVisible = $event),
          round: "",
          position: "bottom",
          style: normalizeStyle(unref(popStyle)),
          "overlay-style": {
            zIndex: 2e3
          },
          onOnClose: onClosePopup,
          closeOnClickAction: true
        }, {
          default: withCtx(() => {
            var _a;
            return [
              createElementVNode("div", _hoisted_1$1, [
                __props.needFreeTag ? (openBlock(), createBlock(_sfc_main$3, {
                  key: 0,
                  class: "free-tag"
                })) : createCommentVNode("", true),
                createElementVNode("div", _hoisted_2$1, [
                  createElementVNode("div", _hoisted_3$1, [
                    createElementVNode("div", _hoisted_4, [
                      createVNode(_sfc_main$4, {
                        closable: "",
                        closeIconSize: "12px",
                        modelValue: unref(searchValue),
                        "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchValue) ? searchValue.value = $event : searchValue = $event),
                        placeholder: "\u8F93\u5165\u4F01\u4E1A\u540D\u79F0",
                        onOnChange: onChange,
                        onOnClear: onClear
                      }, null, 8, ["modelValue"])
                    ]),
                    createElementVNode("div", {
                      class: "cancel-btn",
                      onClick: onClosePopup
                    }, "\u53D6\u6D88")
                  ]),
                  unref(showRecommend) ? (openBlock(), createElementBlock("div", _hoisted_5, [
                    _hoisted_6,
                    (openBlock(true), createElementBlock(Fragment, null, renderList((_a = __props.recommendList) == null ? void 0 : _a.list, (item, index2) => {
                      return openBlock(), createElementBlock("span", {
                        onClick: ($event) => onSelectRecommend(item),
                        class: "item",
                        key: index2
                      }, toDisplayString(item), 9, _hoisted_7);
                    }), 128))
                  ])) : (openBlock(), createElementBlock("div", _hoisted_8, [
                    unref(searchResult).length !== 0 && !unref(showLoading) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(searchResult), (item) => {
                      return openBlock(), createElementBlock("div", {
                        class: "search-result-item",
                        key: item.value,
                        onClick: ($event) => onChoose(item)
                      }, [
                        createElementVNode("div", _hoisted_10, [
                          createElementVNode("div", _hoisted_11, [
                            createElementVNode("span", {
                              innerHTML: item.highlightLabel,
                              class: "name"
                            }, null, 8, _hoisted_12),
                            item.isExist ? (openBlock(), createElementBlock("span", _hoisted_13, "\u5DF2\u5B58\u5728")) : createCommentVNode("", true),
                            item.match_type && !__props.hidden_mathch_type.type.includes(item.match_type) ? (openBlock(), createElementBlock("span", _hoisted_14, toDisplayString(item.match_type), 1)) : createCommentVNode("", true)
                          ]),
                          item.oper_name ? (openBlock(), createElementBlock("p", _hoisted_15, [
                            _hoisted_16,
                            item.match_type !== "\u6CD5\u5B9A\u4EE3\u8868\u4EBA\u5339\u914D" ? (openBlock(), createElementBlock("span", _hoisted_17, toDisplayString(item.oper_name), 1)) : (openBlock(), createElementBlock("span", {
                              key: 1,
                              innerHTML: item.highlightOper
                            }, null, 8, _hoisted_18))
                          ])) : createCommentVNode("", true)
                        ])
                      ], 8, _hoisted_9);
                    }), 128)) : unref(showLoading) ? (openBlock(), createElementBlock("div", _hoisted_19, [
                      createElementVNode("div", _hoisted_20, [
                        createVNode(_sfc_main$6, { src: unref(loading) }, null, 8, ["src"])
                      ])
                    ])) : !unref(searchValue) && unref(searchResult).length === 0 && !unref(showLoading) ? (openBlock(), createElementBlock("div", _hoisted_21, [
                      createVNode(_sfc_main$6, { src: unref(corp_search_no_result) }, null, 8, ["src"])
                    ])) : createCommentVNode("", true)
                  ]))
                ])
              ])
            ];
          }),
          _: 1
        }, 8, ["modelValue", "style"]),
        createVNode(Tip, {
          modelValue: matching.value,
          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => matching.value = $event),
          company_name: unref(searchValue),
          onClose_tip_visible: close_tip_visible
        }, null, 8, ["modelValue", "company_name"])
      ]);
    };
  }
});
_sfc_main$1.install = (app) => {
  app.component(_sfc_main$1.name, _sfc_main$1);
};
var index_vue_vue_type_style_index_0_scoped_true_lang = "";
const _withScopeId = (n) => (pushScopeId("data-v-01b1ba05"), n = n(), popScopeId(), n);
const _hoisted_1 = { class: "render-card-company" };
const _hoisted_2 = ["onClick"];
const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", null, "\u6DFB\u52A0", -1));
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    data: { default: () => {
    } },
    listItem: { default: () => {
      return {};
    } },
    env_data: { default: () => {
      return {};
    } }
  },
  emits: ["onClickEnterprise", "onClickRetract", "onChoose", "sendSearchValue"],
  setup(__props, { emit }) {
    const props = __props;
    const onClickEnterprise = (item) => {
      var _a;
      if (!((_a = props.listItem) == null ? void 0 : _a.allowClick))
        return;
      emit("onClickEnterprise", item);
    };
    const onClickRetract = (bol) => {
      var _a;
      if (!((_a = props.listItem) == null ? void 0 : _a.allowClick))
        return;
      emit("onClickRetract", bol);
    };
    const enterpriseVisible = ref(false);
    const onAdd = () => {
      enterpriseVisible.value = true;
    };
    const onChoose = (item) => {
      emit("onChoose", item);
    };
    const sendSearchValue = (name) => {
      emit("sendSearchValue", name);
    };
    return (_ctx, _cache) => {
      var _a;
      return openBlock(), createElementBlock("div", _hoisted_1, [
        ((_a = __props.data) == null ? void 0 : _a.length) ? (openBlock(), createBlock(unref(_sfc_main$5), {
          key: 0,
          class: "company-list",
          data: __props.data,
          canViewMore: !!__props.listItem.allowClick,
          retract: __props.listItem.retract || 0,
          onOnClickEnterprise: onClickEnterprise,
          onOnClickRetract: onClickRetract
        }, null, 8, ["data", "canViewMore", "retract"])) : createCommentVNode("", true),
        __props.listItem.isAdd ? (openBlock(), createElementBlock("div", {
          key: 1,
          class: "company-add",
          onClick: withModifiers(onAdd, ["stop"])
        }, [
          createVNode(_sfc_main$8, {
            type: "add",
            width: "12",
            height: "12",
            color: "var(--wl-primary-color)"
          }),
          _hoisted_3
        ], 8, _hoisted_2)) : createCommentVNode("", true),
        createVNode(unref(_sfc_main$1), {
          modelValue: enterpriseVisible.value,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => enterpriseVisible.value = $event),
          env_data: __props.env_data,
          onOnChoose: onChoose,
          onSendSearchValue: sendSearchValue
        }, null, 8, ["modelValue", "env_data"])
      ]);
    };
  }
});
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-01b1ba05"]]);
export { index as default };
