import { defineComponent, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createCommentVNode, renderSlot, createBlock, createElementVNode, toDisplayString, createVNode, render, watchEffect, withCtx, createTextVNode, Fragment, renderList, withModifiers, mergeProps } from "vue";
import WlSvg from "@wltech/svg";
import { ActionSheet, Dialog, Icon } from "vant";
var employeeSelector = {
  employeeData: null,
  topFiveEmployeeData: null,
  organization: null,
  organization_count: null,
  count: 0,
  dept_list: [],
  company_list: [],
  company_list_count: 0,
  companyEmployeeList: [],
  totalCompanyEmployeeList: [],
  totalCompanyEmployeeObjList: []
};
let Store = {
  sid: "",
  app_id: "",
  user_id: "",
  user_name: "",
  corp_id: "",
  node_env: "",
  domain: "",
  token: "",
  card_resource: "",
  employeeSelector
};
var Store$1 = new Proxy(Store, {
  get(target, name, property) {
    return Reflect.get(target, name, property);
  },
  set(target, name, value, property) {
    return Reflect.set(target, name, value, property);
  }
});
const domain = "https://wlmvp-cos.weiling.cn";
const loadingPic = domain + "/frontend/weilingMobileUI/loading.png";
const loadingFailPic = domain + "/frontend/weilingMobileUI/loadingFail.png";
const calling_icon = domain + "/frontend/weilingMobileUI/wl-call-out/calling.png ";
const phone_icon = domain + "/frontend/weilingMobileUI/wl-call-out/phone.png";
const phone_white_icon = domain + "/frontend/weilingMobileUI/wl-call-out/phone-white.png";
const phone_green_icon = domain + "/frontend/weilingMobileUI/wl-call-out/phone-green.png";
const call_bag_icon = domain + "/frontend/weilingMobileUI/wl-call-out/call-bag.png";
const aimengyx_icon = domain + "/frontend/weilingMobileUI/wl-call-out/aimengyx.png";
const aivo_icon = domain + "/frontend/weilingMobileUI/wl-call-out/aivo.png";
const aliyun_icon = domain + "/frontend/weilingMobileUI/wl-call-out/aliyun.png";
const rongying_icon = domain + "/frontend/weilingMobileUI/wl-call-out/rongying.png";
const callTelephone = (tel) => {
  const a = document.createElement("a");
  a.setAttribute("href", `tel:${tel}`);
  a.click();
};
const loadImage = (url) => {
  return new Promise((resolve, reject) => {
    const newImg = new Image();
    newImg.src = url;
    newImg.onerror = () => {
      reject("failure");
    };
    newImg.onload = (e) => {
      resolve(e.target);
    };
  });
};
const isTencentCosPic = (url) => {
  return url.includes("wlmvp-cos.weiling.cn");
};
const isBase64 = (str) => {
  return str.indexOf("data:") != -1 && str.indexOf("base64") != -1;
};
const removeEmptyField = (obj) => {
  let newObj = {};
  if (typeof obj === "string") {
    obj = JSON.parse(obj);
  }
  if (obj instanceof Array) {
    newObj = [];
  }
  if (obj instanceof Object) {
    for (let attr in obj) {
      if (obj[attr] !== "" && obj[attr] !== null && obj[attr] !== void 0) {
        if (obj[attr] instanceof Object) {
          if (JSON.stringify(obj[attr]) === "{}" || JSON.stringify(obj[attr]) === "[]") {
            continue;
          }
          newObj[attr] = removeEmptyField(obj[attr]);
        } else if (typeof obj[attr] === "string" && (obj[attr].indexOf("{") > -1 && obj[attr].indexOf("}") > -1 || obj[attr].indexOf("[") > -1 && obj[attr].indexOf("]") > -1)) {
          try {
            let attrObj = JSON.parse(obj[attr]);
            if (attrObj instanceof Object) {
              newObj[attr] = removeEmptyField(attrObj);
            }
          } catch (e) {
            newObj[attr] = obj[attr];
          }
        } else {
          newObj[attr] = obj[attr];
        }
      }
    }
  }
  return newObj;
};
const _hoisted_1$5 = ["src", "alt"];
const _hoisted_2$5 = ["src"];
const _hoisted_3$4 = ["src"];
var ECosType = /* @__PURE__ */ ((ECosType2) => {
  ECosType2["normal"] = "imageView2/1/q/85";
  ECosType2["thumbnail"] = "imageView2/1/w/100/h/100/q/85";
  return ECosType2;
})(ECosType || {});
const __default__$6 = {
  name: "WlPic"
};
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  ...__default__$6,
  props: {
    src: { default: "" },
    needCos: { type: Boolean, default: true },
    cosType: { default: "normal" },
    radius: { type: Boolean, default: false },
    round: { type: Boolean, default: false },
    needLoading: { type: Boolean, default: true },
    needMiddleCenter: { type: Boolean, default: true },
    needHeightAuto: { type: Boolean, default: false },
    fit: { default: "fill" }
  },
  setup(__props, { expose }) {
    const props = __props;
    const isLoading = ref(true);
    const isError = ref(false);
    const imgSrc = ref("");
    const imgWrapRef = ref("");
    const imgStyleComputed = computed(() => {
      return {
        "border-radius": props.round ? "50%" : "",
        "object-fit": props.fit
      };
    });
    const imgWrapClassComputed = computed(() => {
      return [
        "wl-img",
        "wh-full",
        "relative",
        "flex-col",
        props.needMiddleCenter ? "flex-middle-center" : ""
      ];
    });
    const onLoadImage = (url) => {
      return new Promise((resolve, reject) => {
        loadImage(url).then((elem) => {
          resolve(elem);
        }).catch((reason) => {
          reject(reason);
        }).finally(() => {
          isLoading.value = false;
        });
      });
    };
    const setImgSrc = (url) => {
      const needCos = isTencentCosPic(url) && props.needCos;
      const file_type = url.split(".").pop();
      let isSvg = file_type === "svg";
      let isBase64Bool = isBase64(url);
      if (isSvg || !needCos || isBase64Bool) {
        imgSrc.value = url;
        onLoadImage(imgSrc.value).catch(() => {
          isError.value = true;
        });
      } else {
        imgSrc.value = `${url}?${ECosType[props.cosType]}`;
        onLoadImage(imgSrc.value).catch(() => {
          imgSrc.value = url;
        });
      }
    };
    watch(
      () => props.src,
      (val) => {
        if (val) {
          isLoading.value = true;
          setImgSrc(props.src);
        }
      },
      { immediate: true }
    );
    expose({
      imgWrapRef
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(unref(imgWrapClassComputed)),
        ref_key: "imgWrapRef",
        ref: imgWrapRef
      }, [
        !isLoading.value && !isError.value ? (openBlock(), createElementBlock("img", {
          key: 0,
          src: imgSrc.value,
          style: normalizeStyle(unref(imgStyleComputed)),
          class: normalizeClass(`w-full block ${__props.needHeightAuto ? "h-auto" : "h-full"}`),
          alt: imgSrc.value
        }, null, 14, _hoisted_1$5)) : createCommentVNode("", true),
        isLoading.value && __props.needLoading ? (openBlock(), createElementBlock("img", {
          key: 1,
          src: unref(loadingPic),
          alt: "loading",
          class: "w-1/5 uno-min-w-20 uno-min-h-20 uno-max-w-60 uno-max-h-60 absolute-middle-center animate-spin"
        }, null, 8, _hoisted_2$5)) : createCommentVNode("", true),
        isError.value ? (openBlock(), createElementBlock("img", {
          key: 2,
          src: unref(loadingFailPic),
          alt: "failure",
          class: "w-1/5 uno-min-w-20 uno-min-h-20 uno-max-w-60 uno-max-h-60 absolute-middle-center"
        }, null, 8, _hoisted_3$4)) : createCommentVNode("", true),
        renderSlot(_ctx.$slots, "picFooter")
      ], 2);
    };
  }
});
var __uno = "";
_sfc_main$6.install = (app) => {
  app.component(_sfc_main$6.name, _sfc_main$6);
};
const proxy_api = {
  dev_uat: "/uat_api",
  dev_stg: "/stg_api",
  dev_prd: "/prd_api",
  dev_cos_api: "/cos_api",
  dev_uat_xsf: "/xsf_api",
  dev: "/uat_api",
  uat: "",
  stg: "",
  prd: "",
  gray: "",
  production: "",
  uat_xsf: "https://test.xsfapi.weiling.cn",
  stg_xsf: "https://pre-xsfapi.weiling.cn",
  prd_xsf: "https://xsfapi.weiling.cn",
  gray_xsf: "https://xsfapi.weiling.cn"
};
const token_key = {
  dev_uat: "auth-token-mp-test",
  dev_stg: "auth-token-mp",
  dev_prd: "auth-token-mp",
  dev_uat_xsf: "auth-token-se-test",
  dev_stg_xsf: "auth-token-se",
  dev_gray_xsf: "auth-token-se",
  dev_prd_xsf: "auth-token-se",
  uat: "auth-token-mp-test",
  stg: "auth-token-mp",
  prd: "auth-token-mp",
  gray: "auth-token-mp",
  uat_xsf: "auth-token-se-test",
  stg_xsf: "auth-token-se",
  prd_xsf: "auth-token-se",
  gray_xsf: "auth-token-se"
};
const __default__$5 = {
  name: "WlSvgIcon"
};
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  ...__default__$5,
  props: {
    type: { default: "" },
    color: { default: "var(--wl-text-color-title-1)" },
    width: { default: "16" },
    height: { default: "16" }
  },
  setup(__props) {
    const sub = location.origin;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(WlSvg), {
        type: __props.type,
        width: __props.width,
        height: __props.height,
        color: __props.color,
        sub: unref(sub)
      }, null, 8, ["type", "width", "height", "color", "sub"]);
    };
  }
});
var index_vue_vue_type_style_index_0_lang$1 = "";
const _hoisted_1$4 = { class: "icon" };
const _hoisted_2$4 = { class: "text" };
const __default__$4 = {
  name: "WlNotice"
};
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  ...__default__$4,
  props: {
    show_toast: { type: Boolean, default: true },
    message: { default: "" },
    type: { default: "success" },
    duration: { default: 1500 }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return __props.show_toast ? (openBlock(), createElementBlock("div", {
        key: 0,
        class: normalizeClass(`notice ${__props.type}`),
        "data-weiling-mobile-ui-wl-notice": ""
      }, [
        createElementVNode("div", _hoisted_1$4, [
          __props.type === "success" ? (openBlock(), createBlock(_sfc_main$5, {
            key: 0,
            type: "successFill",
            width: "24",
            height: "24",
            color: "#45ce03"
          })) : __props.type === "warning" ? (openBlock(), createBlock(_sfc_main$5, {
            key: 1,
            type: "warningFill",
            width: "24",
            height: "24",
            color: "#f3a401"
          })) : __props.type === "alert" ? (openBlock(), createBlock(_sfc_main$5, {
            key: 2,
            type: "tipsFill",
            width: "24",
            height: "24",
            color: "#1b9fff"
          })) : __props.type === "error" ? (openBlock(), createBlock(_sfc_main$5, {
            key: 3,
            type: "closeFill",
            width: "24",
            height: "24",
            color: "#ff2a2d"
          })) : createCommentVNode("", true)
        ]),
        createElementVNode("p", _hoisted_2$4, toDisplayString(__props.message), 1)
      ], 2)) : createCommentVNode("", true);
    };
  }
});
let mountNode = null;
var WlNotice = (options) => {
  const duration = options.duration | 2e3;
  if (mountNode) {
    document.body.removeChild(mountNode);
    mountNode = null;
  }
  const app = createVNode(_sfc_main$4, {
    ...options,
    duration,
    show_toast: true
  });
  let timer = setTimeout(() => {
    if (mountNode) {
      document.body.removeChild(mountNode);
      mountNode = null;
    }
    clearTimeout(timer);
  }, duration);
  mountNode = document.createElement("div");
  render(app, mountNode);
  document.body.appendChild(mountNode);
};
function obj2String(obj, arr = [], idx = 0) {
  for (let item in obj) {
    arr[idx++] = [item, obj[item]];
  }
  return new URLSearchParams(arr).toString();
}
function getOptions(options) {
  const { sid = "", corp_id = "", card_resource = "" } = Store$1 != null ? Store$1 : {};
  const params = {
    sid,
    corp_id,
    card_resource,
    ...options
  };
  return obj2String(params);
}
const onHandleUrl = (url) => {
  const { node_env } = Store$1;
  const isPersonMiniApp = node_env.includes("xsf");
  if (isPersonMiniApp) {
    return setPersonMiniAppUrl(url);
  }
  return url;
};
const setPersonMiniAppUrl = (url) => {
  let filterUrl = url;
  if (filterUrl.includes("/api/user/share/path")) {
    filterUrl = filterUrl.replace("/api/user/share/path", "/apise/material/share/path");
  } else if (filterUrl.includes("/interact/")) {
    filterUrl = filterUrl.replace("/interact/", "/apise/");
  } else if (filterUrl.includes("/api/")) {
    filterUrl = filterUrl.replace("/api/", "/apise/");
  } else if (filterUrl.includes("/wx/track")) {
    filterUrl = filterUrl.replace("/wx/track", "/apise/track/wx/track");
  }
  return filterUrl;
};
function request(url, options, method = "GET") {
  const staticOption = {
    sid: Store$1.sid,
    corp_id: Store$1.corp_id,
    tab_change: 0
  };
  const data = {
    ...staticOption,
    ...options
  };
  const searchStr = getOptions(removeEmptyField(data));
  const staticSearchStr = getOptions(removeEmptyField(staticOption));
  let initObj = {};
  let params = "";
  if (method === "GET") {
    initObj = {
      method,
      credentials: "include",
      headers: new Headers({
        [token_key[Store$1.node_env]]: Store$1.token
      })
    };
    params = searchStr;
  } else if (method === "FormPOST") {
    initObj = {
      method: "POST",
      credentials: "include",
      headers: new Headers({
        [token_key[Store$1.node_env]]: Store$1.token
      }),
      body: options
    };
    params = staticSearchStr;
  } else {
    initObj = {
      method,
      credentials: "include",
      headers: new Headers({
        Accept: "application/json, text/plain, */*",
        "Content-Type": "application/json",
        [token_key[Store$1.node_env]]: Store$1.token
      }),
      body: JSON.stringify(data)
    };
    params = staticSearchStr;
  }
  const filterUrl = onHandleUrl(url) + "?" + params;
  return fetch(filterUrl, initObj).then((res) => {
    const isArea = url.includes("region.json");
    return res.json().then((result) => {
      var _a;
      if (result.code === 200 || isArea) {
        return result;
      } else {
        WlNotice({ message: (_a = result.msg) != null ? _a : "\u670D\u52A1\u5668\u5185\u90E8\u9519\u8BEF", type: "error", duration: 3e3 });
        throw Error(result);
      }
    });
  }).then((res) => {
    return res;
  });
}
const GET = (url, options) => {
  return request(url, options, "GET");
};
const POST = (url, options) => {
  return request(url, options, "POST");
};
var Api = {
  onTouchCall(params) {
    return POST(`${proxy_api[Store$1.node_env]}/crm_v2/web/call/touch_call`, params);
  },
  getXwCodeUrl(params) {
    return GET(`${proxy_api[Store$1.node_env]}/dialogue/xw/url/get`, params);
  }
};
_sfc_main$5.install = (app) => {
  app.component(_sfc_main$5.name, _sfc_main$5);
};
var CallOutTip_vue_vue_type_style_index_0_lang = "";
const _hoisted_1$3 = { class: "outband" };
const _hoisted_2$3 = { class: "outband-content fsc-c" };
const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("span", { class: "outband-content_text" }, "\u63A5\u542C\u540E\uFF0C\u5C06\u81EA\u52A8\u547C\u53EB\u8054\u7CFB\u4EBA ", -1);
const _hoisted_4$3 = {
  key: 0,
  class: "outband-content_tips"
};
const _hoisted_5$3 = { class: "outband-content_img" };
const _hoisted_6$2 = { class: "outband-content_img_bac" };
const _hoisted_7$1 = {
  key: 0,
  class: "outband-content_img_name"
};
const _hoisted_8 = {
  key: 1,
  class: "outband-content_img_avatar"
};
const _hoisted_9 = {
  key: 2,
  class: "outband-content_img_icon"
};
const _hoisted_10 = { class: "outband-content_img_phone" };
const _hoisted_11 = {
  key: 1,
  class: "sponsor fcc"
};
const _hoisted_12 = /* @__PURE__ */ createTextVNode(" \u672C\u529F\u80FD\u7531 ");
const _hoisted_13 = { class: "sponsor_img" };
const _hoisted_14 = /* @__PURE__ */ createTextVNode(" \u63D0\u4F9B\u6280\u672F\u652F\u6301 ");
const __default__$3 = {
  name: "CallOutTip"
};
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  ...__default__$3,
  props: {
    phone: { default: null },
    userInfo: { default: null },
    calleeInfo: { default: null },
    modelValue: { type: Boolean, default: false }
  },
  emits: ["update:modelValue"],
  setup(__props, { emit }) {
    const props = __props;
    const actionSheetVisible = ref(false);
    const callOutCompany = ref({
      1: aivo_icon,
      2: aimengyx_icon,
      3: rongying_icon,
      4: aliyun_icon
    });
    watchEffect(() => {
      actionSheetVisible.value = props.modelValue;
    });
    const onClose = () => {
      emit("update:modelValue", false);
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$3, [
        createVNode(unref(ActionSheet), {
          show: actionSheetVisible.value,
          "onUpdate:show": _cache[0] || (_cache[0] = ($event) => actionSheetVisible.value = $event),
          "close-on-click-action": "",
          teleport: "body",
          "header-visible": "",
          title: "\u8BF7\u5148\u63A5\u542C\u6765\u7535",
          "cancel-text": "",
          onOnClose: onClose
        }, {
          default: withCtx(() => {
            var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
            return [
              createElementVNode("div", _hoisted_2$3, [
                _hoisted_3$3,
                ((_b = (_a = __props.userInfo) == null ? void 0 : _a.call_platform) == null ? void 0 : _b.type) != 4 ? (openBlock(), createElementBlock("span", _hoisted_4$3, "\uFF08\u5BF9\u65B9\u770B\u5230\u7684\u662F\u4F60\u81EA\u5DF1\u7684\u624B\u673A\u53F7\u54E6\uFF5E\uFF09")) : createCommentVNode("", true),
                createElementVNode("div", _hoisted_5$3, [
                  createElementVNode("div", _hoisted_6$2, [
                    createVNode(unref(_sfc_main$6), { src: unref(call_bag_icon) }, null, 8, ["src"])
                  ]),
                  ((_c = __props.calleeInfo) == null ? void 0 : _c.type) == "clue" && ((_e = (_d = __props.calleeInfo) == null ? void 0 : _d.info) == null ? void 0 : _e.user_name) ? (openBlock(), createElementBlock("div", _hoisted_7$1, toDisplayString((_h = (_g = (_f = __props.calleeInfo) == null ? void 0 : _f.info) == null ? void 0 : _g.user_name) == null ? void 0 : _h.substring(0, 1)), 1)) : ((_i = __props.calleeInfo) == null ? void 0 : _i.type) == "customer" && ((_k = (_j = __props.calleeInfo) == null ? void 0 : _j.info) == null ? void 0 : _k.avatar) ? (openBlock(), createElementBlock("div", _hoisted_8, [
                    createVNode(unref(_sfc_main$6), {
                      round: "",
                      src: (_m = (_l = __props.calleeInfo) == null ? void 0 : _l.info) == null ? void 0 : _m.avatar
                    }, null, 8, ["src"])
                  ])) : (openBlock(), createElementBlock("div", _hoisted_9, [
                    createVNode(unref(_sfc_main$5), {
                      type: "userFill",
                      width: "60",
                      height: "60",
                      color: "#fff"
                    })
                  ])),
                  createElementVNode("div", _hoisted_10, toDisplayString(__props.phone), 1)
                ]),
                ((_n = __props.userInfo) == null ? void 0 : _n.call_platform) ? (openBlock(), createElementBlock("div", _hoisted_11, [
                  _hoisted_12,
                  createElementVNode("div", _hoisted_13, [
                    createVNode(unref(_sfc_main$6), {
                      src: callOutCompany.value[(_o = __props.userInfo.call_platform) == null ? void 0 : _o.type]
                    }, null, 8, ["src"])
                  ]),
                  createElementVNode("span", null, toDisplayString((_p = __props.userInfo.call_platform) == null ? void 0 : _p.name), 1),
                  _hoisted_14
                ])) : createCommentVNode("", true)
              ])
            ];
          }),
          _: 1
        }, 8, ["show"])
      ]);
    };
  }
});
var CallOutDialog_vue_vue_type_style_index_0_lang = "";
const _hoisted_1$2 = { class: "outband" };
const _hoisted_2$2 = { class: "fcc-c outband-dialog" };
const _hoisted_3$2 = { class: "fss outband-dialog-content" };
const _hoisted_4$2 = ["innerHTML"];
const _hoisted_5$2 = ["innerHTML"];
const _hoisted_6$1 = {
  key: 1,
  class: "mess_img"
};
const __default__$2 = {
  name: "CallOutDialog"
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  ...__default__$2,
  props: {
    modelValue: { type: Boolean, default: false },
    phone: { default: null },
    type: { default: 1 },
    title: { default: "" },
    icon: { default: "warning" },
    message: { default: "" },
    xw_info: { default: null }
  },
  emits: ["update:modelValue", "onCall"],
  setup(__props, { emit }) {
    const props = __props;
    const dialogVisible = ref(false);
    const isShowCancel = ref(false);
    const confirmButtonColor = ref("#5B5B5B");
    const confirmButtonText = ref("\u6211\u77E5\u9053\u5566");
    watchEffect(() => {
      switch (props.type) {
        case 1:
          break;
        case 2:
          isShowCancel.value = true;
          confirmButtonColor.value = "var(--wl-primary-color)";
          confirmButtonText.value = "\u53BB\u62E8\u6253";
          break;
        case 3:
          isShowCancel.value = true;
          confirmButtonColor.value = "var(--wl-primary-color)";
          confirmButtonText.value = "\u8054\u7CFB\u5C0F\u5FAE";
          break;
        default:
          console.error("\u5916\u547C\u547C\u53EB\u5F39\u7A97type\u68C0\u67E5\u9519\u8BEF");
          break;
      }
      dialogVisible.value = props.modelValue;
    });
    const onConfirm = () => {
      if (props.type == 2) {
        callTelephone(props.phone);
      }
      dialogVisible.value = false;
    };
    const onClose = () => {
      emit("update:modelValue", false);
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$2, [
        createVNode(unref(Dialog), {
          show: dialogVisible.value,
          "onUpdate:show": _cache[0] || (_cache[0] = ($event) => dialogVisible.value = $event),
          "show-cancel-button": isShowCancel.value,
          "confirm-button-text": confirmButtonText.value,
          "confirm-button-color": confirmButtonColor.value,
          width: "310",
          teleport: "body",
          onConfirm,
          onClose
        }, {
          default: withCtx(() => [
            createElementVNode("div", _hoisted_2$2, [
              createElementVNode("div", _hoisted_3$2, [
                createVNode(unref(Icon), {
                  name: __props.icon,
                  class: normalizeClass([
                    "outband-dialog-content_icon",
                    __props.icon == "clear" ? "outband-dialog-content_icon--FF2B2D" : ""
                  ])
                }, null, 8, ["name", "class"]),
                createElementVNode("span", { innerHTML: __props.title }, null, 8, _hoisted_4$2)
              ]),
              __props.message ? (openBlock(), createElementBlock("span", {
                key: 0,
                class: "outband-dialog_message",
                innerHTML: __props.message
              }, null, 8, _hoisted_5$2)) : createCommentVNode("", true),
              __props.xw_info.xw_code_url && !__props.xw_info.friend_flag ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
                createVNode(unref(_sfc_main$6), {
                  src: __props.xw_info.xw_code_url
                }, null, 8, ["src"])
              ])) : createCommentVNode("", true)
            ])
          ]),
          _: 1
        }, 8, ["show", "show-cancel-button", "confirm-button-text", "confirm-button-color"])
      ]);
    };
  }
});
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeGlobal$1 = freeGlobal;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal$1 || freeSelf || Function("return this")();
var root$1 = root;
var Symbol$1 = root$1.Symbol;
var Symbol$2 = Symbol$1;
var objectProto$1 = Object.prototype;
var hasOwnProperty = objectProto$1.hasOwnProperty;
var nativeObjectToString$1 = objectProto$1.toString;
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
function getRawTag(value) {
  var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  try {
    value[symToStringTag$1] = void 0;
    var unmasked = true;
  } catch (e) {
  }
  var result = nativeObjectToString$1.call(value);
  if (unmasked) {
    if (isOwn) {
      value[symToStringTag$1] = tag;
    } else {
      delete value[symToStringTag$1];
    }
  }
  return result;
}
var objectProto = Object.prototype;
var nativeObjectToString = objectProto.toString;
function objectToString(value) {
  return nativeObjectToString.call(value);
}
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
function baseGetTag(value) {
  if (value == null) {
    return value === void 0 ? undefinedTag : nullTag;
  }
  return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}
function isObjectLike(value) {
  return value != null && typeof value == "object";
}
var symbolTag = "[object Symbol]";
function isSymbol(value) {
  return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
}
var reWhitespace = /\s/;
function trimmedEndIndex(string) {
  var index = string.length;
  while (index-- && reWhitespace.test(string.charAt(index))) {
  }
  return index;
}
var reTrimStart = /^\s+/;
function baseTrim(string) {
  return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
}
function isObject(value) {
  var type = typeof value;
  return value != null && (type == "object" || type == "function");
}
var NAN = 0 / 0;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsOctal = /^0o[0-7]+$/i;
var freeParseInt = parseInt;
function toNumber(value) {
  if (typeof value == "number") {
    return value;
  }
  if (isSymbol(value)) {
    return NAN;
  }
  if (isObject(value)) {
    var other = typeof value.valueOf == "function" ? value.valueOf() : value;
    value = isObject(other) ? other + "" : other;
  }
  if (typeof value != "string") {
    return value === 0 ? value : +value;
  }
  value = baseTrim(value);
  var isBinary = reIsBinary.test(value);
  return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
}
var now = function() {
  return root$1.Date.now();
};
var now$1 = now;
var FUNC_ERROR_TEXT = "Expected a function";
var nativeMax = Math.max, nativeMin = Math.min;
function debounce(func, wait, options) {
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  if (typeof func != "function") {
    throw new TypeError(FUNC_ERROR_TEXT);
  }
  wait = toNumber(wait) || 0;
  if (isObject(options)) {
    leading = !!options.leading;
    maxing = "maxWait" in options;
    maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
    trailing = "trailing" in options ? !!options.trailing : trailing;
  }
  function invokeFunc(time) {
    var args = lastArgs, thisArg = lastThis;
    lastArgs = lastThis = void 0;
    lastInvokeTime = time;
    result = func.apply(thisArg, args);
    return result;
  }
  function leadingEdge(time) {
    lastInvokeTime = time;
    timerId = setTimeout(timerExpired, wait);
    return leading ? invokeFunc(time) : result;
  }
  function remainingWait(time) {
    var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
    return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  }
  function shouldInvoke(time) {
    var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
    return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  }
  function timerExpired() {
    var time = now$1();
    if (shouldInvoke(time)) {
      return trailingEdge(time);
    }
    timerId = setTimeout(timerExpired, remainingWait(time));
  }
  function trailingEdge(time) {
    timerId = void 0;
    if (trailing && lastArgs) {
      return invokeFunc(time);
    }
    lastArgs = lastThis = void 0;
    return result;
  }
  function cancel() {
    if (timerId !== void 0) {
      clearTimeout(timerId);
    }
    lastInvokeTime = 0;
    lastArgs = lastCallTime = lastThis = timerId = void 0;
  }
  function flush() {
    return timerId === void 0 ? result : trailingEdge(now$1());
  }
  function debounced() {
    var time = now$1(), isInvoking = shouldInvoke(time);
    lastArgs = arguments;
    lastThis = this;
    lastCallTime = time;
    if (isInvoking) {
      if (timerId === void 0) {
        return leadingEdge(lastCallTime);
      }
      if (maxing) {
        clearTimeout(timerId);
        timerId = setTimeout(timerExpired, wait);
        return invokeFunc(lastCallTime);
      }
    }
    if (timerId === void 0) {
      timerId = setTimeout(timerExpired, wait);
    }
    return result;
  }
  debounced.cancel = cancel;
  debounced.flush = flush;
  return debounced;
}
var CallOutSheet_vue_vue_type_style_index_0_lang = "";
const _hoisted_1$1 = { class: "call-out-sheet" };
const _hoisted_2$1 = {
  key: 0,
  class: "fcc-c call-out-sheet-cell"
};
const _hoisted_3$1 = {
  key: 0,
  class: "fcc call-out-sheet-cell_text"
};
const _hoisted_4$1 = ["onClick"];
const _hoisted_5$1 = { class: "phone_icon" };
const _hoisted_6 = /* @__PURE__ */ createElementVNode("span", null, "\u547C\u53EB", -1);
const _hoisted_7 = { class: "ml5" };
const __default__$1 = {
  name: "CallOutSheet"
};
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  ...__default__$1,
  props: {
    modelValue: { type: Boolean, default: false },
    mobiles: { default: null },
    calleeInfo: { default: null },
    userInfo: { default: null }
  },
  emits: ["update:modelValue", "onCall", "onCalling"],
  setup(__props, { expose, emit }) {
    const props = __props;
    const xw_info = ref({});
    const actionSheetVisible = ref(false);
    const callOutTipVisible = ref(false);
    const callOutDialogVisible = ref(false);
    const callType = ref(1);
    const reasonTitle = ref("");
    const reasonIcon = ref("");
    const reasonMessage = ref("");
    const currentPhone = ref("");
    const failMap = ref({
      11: "\u7CFB\u7EDF\u5F02\u5E38\uFF0C\u8BF7\u91CD\u8BD5\u6216\u8054\u7CFB\u5C0F\u5FAE",
      13: "\u547C\u53EB\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u6216\u8054\u7CFB\u5C0F\u5FAE",
      17: "\u8BF7\u5728 8:00~12:00 \u6216 13:30~20:00 \u62E8\u6253\u54E6",
      18: "\u4F60\u7684\u624B\u673A\u53F7\u65E0\u6548\uFF0C\u5FEB\u53BB\u770B\u770B\u662F\u5426\u5199\u9519\u4E86",
      19: "\u88AB\u53EB\u53F7\u7801\u65E0\u6548\uFF0C\u6362\u4E2A\u624B\u673A\u53F7\u8BD5\u8BD5\u5427",
      20: "\u62E8\u6253\u6B21\u6570\u7528\u5B8C\u5566\uFF0C\u8BF7\u8054\u7CFB\u5C0F\u5FAE",
      21: "\u6253\u8FD9\u4E2A\u7535\u8BDD\u7684\u4EBA\u592A\u591A\u5566\uFF0C\u6362\u4E2A\u8BD5\u8BD5\u5427~",
      22: "\u4F60\u7684\u53F7\u7801\u5728\u8FD0\u8425\u5546\u9ED1\u540D\u5355\u4E2D<br>\u8BF7\u8054\u7CFB\u8FD0\u8425\u5546\u8FDB\u4E00\u6B65\u4E86\u89E3",
      23: "\u8BE5\u53F7\u7801\u5728\u8FD0\u8425\u5546\u9ED1\u540D\u5355\u4E2D<br>\u6362\u4E2A\u53F7\u7801\u8BD5\u8BD5\u5427~",
      24: "\u8D26\u6237\u4F59\u989D\u4E0D\u8DB3",
      25: "\u8D26\u6237\u5F02\u5E38\uFF0C\u8BF7\u8054\u7CFB\u5C0F\u5FAE",
      29: "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5\u6216\u8054\u7CFB\u5C0F\u5FAE",
      30: "\u7EBF\u8DEF\u6682\u505C\uFF0C\u8FC7\u4F1A\u518D\u8BD5\u8BD5\u5427",
      31: "\u4F60\u7684\u624B\u673A\u53F7\u8FD8\u6CA1\u6709\u52A0\u767D\uFF0C\u8BF7\u8054\u7CFB\u5C0F\u5FAE~",
      99: "\u8054\u7CFB\u5C0F\u5FAE\uFF0C\u54A8\u8BE2\u539F\u56E0\uFF5E"
    });
    const onClose = () => {
      emit("update:modelValue", false);
    };
    watchEffect(() => {
      actionSheetVisible.value = props.modelValue;
    });
    const onCall = debounce(async (phone) => {
      var _a, _b, _c, _d, _e, _f, _g, _h, _i;
      try {
        emit("onCall");
        actionSheetVisible.value = false;
        const isOutband = (_b = (_a = props.userInfo) == null ? void 0 : _a.business_flags) == null ? void 0 : _b.some((e) => {
          if (e.flag_type == 2)
            return e.business_flag;
        });
        if (!isOutband) {
          callTelephone(phone);
          return;
        }
        let type = 0;
        if (((_c = props.calleeInfo) == null ? void 0 : _c.type) == "customer")
          type = 2;
        if (((_d = props.calleeInfo) == null ? void 0 : _d.type) == "clue")
          type = 3;
        const related_id = ((_e = props.calleeInfo) == null ? void 0 : _e.type) == "clue" ? (_g = (_f = props.calleeInfo) == null ? void 0 : _f.info) == null ? void 0 : _g.clue_id : (_i = (_h = props.calleeInfo) == null ? void 0 : _h.info) == null ? void 0 : _i.id;
        const { data } = await Api.onTouchCall({
          callee: phone,
          type,
          related_id
        });
        if ((data == null ? void 0 : data.status_code) == 10) {
          emit("onCalling");
          currentPhone.value = phone;
          callOutTipVisible.value = true;
          setTimeout(() => {
            callOutTipVisible.value = false;
          }, 5e3);
        } else {
          failType(data == null ? void 0 : data.status_code);
        }
      } catch (error) {
        console.log("wlCallOut error:", error);
      }
    }, 500);
    const failType = async (code) => {
      callType.value = 1;
      reasonIcon.value = "clear";
      reasonTitle.value = "\u547C\u53EB\u5931\u8D25";
      reasonMessage.value = failMap.value[code] || "\u8054\u7CFB\u5C0F\u5FAE\uFF0C\u54A8\u8BE2\u539F\u56E0~";
      const notXwCodes = [17, 18, 19, 21, 22, 23, 30];
      if (!notXwCodes.includes(+code)) {
        const res = await Api.getXwCodeUrl({ name: "common_use" });
        xw_info.value["xw_code_url"] = encodeURI(res.data.replace(/\ufeff/g, ""));
      }
      callOutTipVisible.value = false;
      callOutDialogVisible.value = true;
    };
    expose({
      onCall
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1$1, [
        createVNode(unref(ActionSheet), {
          show: actionSheetVisible.value,
          "onUpdate:show": _cache[0] || (_cache[0] = ($event) => actionSheetVisible.value = $event),
          "cancel-text": "\u53D6\u6D88",
          "close-on-click-action": "",
          teleport: "body",
          onClose
        }, {
          default: withCtx(() => [
            __props.mobiles && __props.mobiles.length ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
              __props.mobiles.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_3$1, " \u9009\u62E9\u60A8\u8981\u547C\u53EB\u7684\u53F7\u7801 ")) : createCommentVNode("", true),
              (openBlock(true), createElementBlock(Fragment, null, renderList(__props.mobiles, (item) => {
                return openBlock(), createElementBlock("div", {
                  class: "fcc call-out-sheet-cell_phone",
                  key: item,
                  onClick: withModifiers(($event) => unref(onCall)(item), ["stop"])
                }, [
                  createElementVNode("div", _hoisted_5$1, [
                    createVNode(unref(_sfc_main$6), { src: unref(phone_green_icon) }, null, 8, ["src"])
                  ]),
                  _hoisted_6,
                  createElementVNode("span", _hoisted_7, toDisplayString(item), 1)
                ], 8, _hoisted_4$1);
              }), 128))
            ])) : createCommentVNode("", true)
          ]),
          _: 1
        }, 8, ["show"]),
        createVNode(_sfc_main$3, {
          modelValue: callOutTipVisible.value,
          "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => callOutTipVisible.value = $event),
          userInfo: __props.userInfo,
          phone: currentPhone.value,
          calleeInfo: __props.calleeInfo
        }, null, 8, ["modelValue", "userInfo", "phone", "calleeInfo"]),
        createVNode(_sfc_main$2, {
          modelValue: callOutDialogVisible.value,
          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => callOutDialogVisible.value = $event),
          phone: currentPhone.value,
          type: callType.value,
          title: reasonTitle.value,
          message: reasonMessage.value,
          icon: reasonIcon.value,
          xw_info: xw_info.value
        }, null, 8, ["modelValue", "phone", "type", "title", "message", "icon", "xw_info"])
      ]);
    };
  }
});
var index_vue_vue_type_style_index_0_lang = "";
const _hoisted_1 = {
  class: "call-out-wrap",
  "data-weiling-mobile-ui-bc-call-out": ""
};
const _hoisted_2 = ["onClick"];
const _hoisted_3 = {
  key: 0,
  class: "pic-wrap"
};
const _hoisted_4 = {
  key: 1,
  class: "pic-wrap"
};
const _hoisted_5 = {
  key: 1,
  class: "opt_img"
};
const __default__ = {
  name: "BCCallOut"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    env_data: { default: () => {
      return {
        sid: "",
        token: "",
        domain: "",
        corp_id: "",
        card_resource: "",
        node_env: "dev",
        app_id: ""
      };
    } },
    mobiles: { default: null },
    calleeInfo: { default: null },
    userInfo: { default: null },
    styleType: { default: 1 }
  },
  emits: ["onCalling"],
  setup(__props, { expose, emit }) {
    const props = __props;
    Store$1.corp_id = props.env_data.corp_id;
    Store$1.node_env = props.env_data.node_env;
    Store$1.sid = props.env_data.sid;
    Store$1.token = props.env_data.token;
    Store$1.card_resource = props.env_data.card_resource;
    const outbandShow = ref(false);
    const isCalling = ref(false);
    const onCallTelephone = () => {
      var _a, _b, _c;
      if (!props.mobiles && !Array.isArray(props.mobiles) || isCalling.value)
        return;
      const isOutband = (_a = props.userInfo) == null ? void 0 : _a.business_flags.some((e) => {
        if (e.flag_type == 2)
          return e.business_flag;
      });
      if (!isOutband && ((_b = props.mobiles) == null ? void 0 : _b.length) <= 1) {
        callTelephone(((_c = props.mobiles) == null ? void 0 : _c.length) ? props.mobiles[0] : "");
        return;
      }
      outbandShow.value = true;
    };
    const onCalling = () => {
      isCalling.value = true;
      emit("onCalling", isCalling.value);
      setTimeout(() => {
        isCalling.value = false;
        emit("onCalling", isCalling.value);
      }, 5e3);
    };
    const CallOutSheetRef = ref(null);
    const onCall = (phone) => {
      var _a;
      (_a = CallOutSheetRef.value) == null ? void 0 : _a.onCall(phone);
    };
    expose({
      onCallTelephone,
      onCall
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createElementVNode("div", {
          class: "call-out",
          onClick: withModifiers(onCallTelephone, ["stop"])
        }, [
          _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
            __props.styleType == 1 ? (openBlock(), createElementBlock("div", {
              key: 0,
              class: normalizeClass(["call-out-icon", { "call-out-icon--opacity": isCalling.value }])
            }, [
              !isCalling.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
                createVNode(unref(_sfc_main$6), { src: unref(phone_white_icon) }, null, 8, ["src"])
              ])) : (openBlock(), createElementBlock("div", _hoisted_4, [
                createVNode(unref(_sfc_main$6), { src: unref(calling_icon) }, null, 8, ["src"])
              ])),
              createElementVNode("span", null, toDisplayString(isCalling.value ? "\u547C\u53EB\u4E2D..." : "\u6253\u7535\u8BDD"), 1)
            ], 2)) : (openBlock(), createElementBlock("div", _hoisted_5, [
              createVNode(unref(_sfc_main$6), {
                round: "",
                src: unref(phone_icon)
              }, null, 8, ["src"])
            ]))
          ], 64))
        ], 8, _hoisted_2),
        createVNode(_sfc_main$1, mergeProps({
          ref_key: "CallOutSheetRef",
          ref: CallOutSheetRef
        }, _ctx.$attrs, {
          modelValue: outbandShow.value,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => outbandShow.value = $event),
          userInfo: __props.userInfo,
          mobiles: __props.mobiles,
          calleeInfo: __props.calleeInfo,
          onOnCalling: onCalling
        }), null, 16, ["modelValue", "userInfo", "mobiles", "calleeInfo"])
      ]);
    };
  }
});
_sfc_main.install = (app) => {
  app.component(_sfc_main.name, _sfc_main);
};
export { _sfc_main as default };
