import { defineComponent, ref, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, withModifiers, createCommentVNode, createVNode, withCtx, Fragment, renderList, unref, createTextVNode } from "vue";
import { _ as _sfc_main$2 } from "./index12.js";
import { _ as _export_sfc, a as _sfc_main$1, u as useCopy } from "./index2.js";
import "vant";
import "@wltech/svg";
var index_vue_vue_type_style_index_0_scoped_true_lang = "";
var index_vue_vue_type_style_index_1_lang = "";
const _hoisted_1 = { class: "contact-way a-row" };
const _hoisted_2 = { class: "a-row" };
const _hoisted_3 = {
  key: 1,
  class: "fsc"
};
const _hoisted_4 = { class: "ways-popover" };
const _hoisted_5 = { class: "ways-title" };
const _hoisted_6 = ["onClick"];
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    data: { default: () => {
      return [];
    } },
    listItem: { default: () => {
      return {
        aRow: false
      };
    } }
  },
  setup(__props) {
    const props = __props;
    const popupVisible = ref(false);
    const typeIcon = {
      1: "smart-phone",
      2: "landline",
      3: "mail"
    };
    const infoPop = computed(() => {
      var _a;
      return (_a = props.data) == null ? void 0 : _a.reduce((acc, item) => {
        const existingType = acc.find((i) => i.type === item.type);
        if (existingType) {
          existingType.list.push(item);
        } else {
          acc.push({
            type: item.type,
            icon: typeIcon[item.type] || "jigsaw",
            contact_way_name: item.contact_way_name,
            list: [item]
          });
        }
        return acc;
      }, []);
    });
    const onCopy = (content) => {
      useCopy(content);
    };
    return (_ctx, _cache) => {
      var _a, _b, _c, _d, _e, _f, _g;
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createElementVNode("span", _hoisted_2, toDisplayString(((_b = (_a = __props.data) == null ? void 0 : _a[0]) == null ? void 0 : _b.contact_way) || "--"), 1),
        ((_c = __props.data) == null ? void 0 : _c.length) === 1 && ((_e = (_d = __props.data) == null ? void 0 : _d[0]) == null ? void 0 : _e.contact_way) ? (openBlock(), createElementBlock("span", {
          key: 0,
          class: "way-length",
          onClick: _cache[0] || (_cache[0] = withModifiers(($event) => {
            var _a2, _b2;
            return onCopy((_b2 = (_a2 = __props.data) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.contact_way);
          }, ["stop"]))
        }, "\u590D\u5236")) : createCommentVNode("", true),
        ((_f = __props.data) == null ? void 0 : _f.length) > 1 ? (openBlock(), createElementBlock("div", _hoisted_3, [
          createElementVNode("span", {
            class: "way-length",
            onClick: _cache[1] || (_cache[1] = withModifiers(($event) => popupVisible.value = true, ["stop"]))
          }, "\u5171" + toDisplayString((_g = __props.data) == null ? void 0 : _g.length) + "\u6761", 1),
          createVNode(_sfc_main$1, {
            class: "icon",
            type: "arrowRight"
          })
        ])) : createCommentVNode("", true),
        createVNode(_sfc_main$2, {
          modelValue: popupVisible.value,
          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => popupVisible.value = $event),
          title: "\u8054\u7CFB\u65B9\u5F0F\u5217\u8868",
          position: "center",
          headerVisible: "",
          round: "",
          style: { height: "auto" }
        }, {
          default: withCtx(() => [
            createElementVNode("div", _hoisted_4, [
              (openBlock(true), createElementBlock(Fragment, null, renderList(unref(infoPop), (item) => {
                return openBlock(), createElementBlock(Fragment, {
                  key: item.type
                }, [
                  createElementVNode("div", _hoisted_5, [
                    createVNode(_sfc_main$1, {
                      class: "ways-icon",
                      type: item.icon
                    }, null, 8, ["type"]),
                    createTextVNode(" " + toDisplayString(item.contact_way_name) + "\uFF1A ", 1)
                  ]),
                  (openBlock(true), createElementBlock(Fragment, null, renderList(item.list, (v, i) => {
                    return openBlock(), createElementBlock("div", {
                      class: "ways-phone",
                      key: i
                    }, [
                      createElementVNode("span", null, toDisplayString(v.contact_way), 1),
                      createElementVNode("span", {
                        class: "copy-text",
                        onClick: withModifiers(($event) => onCopy(v.contact_way), ["stop"])
                      }, "\u590D\u5236", 8, _hoisted_6)
                    ]);
                  }), 128))
                ], 64);
              }), 128))
            ])
          ]),
          _: 1
        }, 8, ["modelValue"])
      ]);
    };
  }
});
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d433b2a"]]);
export { index as default };
