"use strict";
const common_vendor = require("../../../common/vendor.js");
const sheep_index = require("../../index.js");
const sheep_hooks_useModal = require("../../hooks/useModal.js");
const sheep_api_distri_share = require("../../api/distri/share.js");
require("../../api/index.js");
require("../../api/distri/score.js");
require("../../request/index.js");
require("../../config/index.js");
require("../../store/index.js");
require("../../store/app.js");
require("../../api/promotion/diy.js");
require("../../platform/index.js");
require("../../platform/provider/wechat/index.js");
require("../../platform/provider/wechat/miniProgram.js");
require("../../api/member/auth.js");
require("../../api/member/social.js");
require("../../api/member/user.js");
require("../../platform/provider/apple/index.js");
require("../../platform/share.js");
require("../../router/index.js");
require("../../helper/throttle.js");
require("../../url/index.js");
require("../../platform/pay.js");
require("../../helper/index.js");
require("../../helper/test.js");
require("../../helper/digit.js");
require("../../api/pay/order.js");
require("../../store/user.js");
require("../../store/cart.js");
require("../../api/trade/cart.js");
require("../../api/pay/wallet.js");
require("../../api/trade/order.js");
require("../../api/promotion/coupon.js");
require("../../store/sys.js");
require("../../store/modal.js");
require("../../api/distri/team.js");
require("../../api/infra/file.js");
require("../../api/member/address.js");
require("../../api/member/point.js");
require("../../api/member/signin.js");
require("../../api/migration/app.js");
require("../../api/migration/chat.js");
require("../../api/migration/index.js");
require("../../api/migration/third.js");
require("../../api/pay/channel.js");
require("../../api/product/category.js");
require("../../api/product/comment.js");
require("../../api/product/favorite.js");
require("../../api/product/history.js");
require("../../api/product/spu.js");
require("../../api/promotion/activity.js");
require("../../api/promotion/article.js");
require("../../api/promotion/bargain.js");
require("../../api/promotion/combination.js");
require("../../api/promotion/rewardActivity.js");
require("../../api/promotion/seckill.js");
require("../../api/system/area.js");
require("../../api/system/voice.js");
require("../../api/trade/afterSale.js");
require("../../api/trade/brokerage.js");
require("../../api/trade/config.js");
require("../../api/trade/delivery.js");
require("../../config/zIndex.js");
if (!Array) {
  const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  _easycom_su_popup2();
}
const _easycom_su_popup = () => "../../ui/su-popup/su-popup.js";
if (!Math) {
  (_easycom_su_popup + canvasPoster)();
}
const canvasPoster = () => "./canvas-poster/index.js";
const _sfc_main = {
  __name: "s-share-modal",
  props: {
    shareInfo: {
      type: Object,
      default() {
      }
    }
  },
  setup(__props) {
    const show = common_vendor.computed(() => sheep_index.sheep.$store("modal").share);
    const shareConfig = common_vendor.computed(() => sheep_index.sheep.$store("app").platform.share);
    const SharePosterRef = common_vendor.ref("");
    const props = __props;
    const state = common_vendor.reactive({
      showShareGuide: false,
      // H5 的指引
      showPosterModal: false
      // 海报弹窗
    });
    let ShareInfo = common_vendor.computed(() => {
      return {
        ...props.shareInfo
      };
    });
    const onShareByPoster = () => {
      const shareId = common_vendor.computed(() => sheep_index.sheep.$store("modal").shareInfo.spuId);
      sheep_hooks_useModal.closeShareModal();
      if (!sheep_index.sheep.$store("user").isLogin) {
        sheep_hooks_useModal.showAuthModal();
        return;
      }
      if (shareId.value) {
        sheep_api_distri_share.ShareApi.getLinkId(3, shareId.value).then((res) => {
          if (res.code !== 0) {
            return;
          }
          ShareInfo.value.link = ShareInfo.value.link.replace("0", res.data.linkId);
          ShareInfo.value.query = ShareInfo.value.query.replace("0", res.data.linkId);
        });
      }
      common_vendor.unref(SharePosterRef).getPoster();
      state.showPosterModal = true;
    };
    const onShareByForward = () => {
      sheep_hooks_useModal.closeShareModal();
    };
    function onCloseGuide() {
      state.showShareGuide = false;
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.o(onCloseGuide),
        b: common_vendor.p({
          show: state.showShareGuide,
          showClose: false
        }),
        c: state.showShareGuide
      }, state.showShareGuide ? {
        d: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/share_guide.png")
      } : {}, {
        e: shareConfig.value.methods.includes("forward")
      }, shareConfig.value.methods.includes("forward") ? {
        f: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/share_wx.png"),
        g: common_vendor.o(onShareByForward)
      } : {}, {
        h: shareConfig.value.methods.includes("poster")
      }, shareConfig.value.methods.includes("poster") ? {
        i: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/share_poster.png"),
        j: common_vendor.o(onShareByPoster)
      } : {}, {
        k: common_vendor.o((...args) => common_vendor.unref(sheep_hooks_useModal.closeShareModal) && common_vendor.unref(sheep_hooks_useModal.closeShareModal)(...args)),
        l: common_vendor.o(common_vendor.unref(sheep_hooks_useModal.closeShareModal)),
        m: common_vendor.p({
          show: show.value,
          round: "10",
          showClose: false
        }),
        n: common_vendor.sr(SharePosterRef, "a2a58660-2", {
          "k": "SharePosterRef"
        }),
        o: common_vendor.o(($event) => state.showPosterModal = false),
        p: common_vendor.p({
          show: state.showPosterModal,
          shareInfo: common_vendor.unref(ShareInfo)
        })
      });
    };
  }
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-a2a58660"], ["__file", "D:/zx/mall-front-app/sheep/components/s-share-modal/s-share-modal.vue"]]);
wx.createComponent(Component);
