import { defineComponent, ref, computed, resolveComponent, unref, openBlock, createBlock, withCtx, createElementVNode, createCommentVNode } from "vue";
const isIframe = () => {
  return window.parent !== window;
};
var index_vue_vue_type_style_index_0_lang = "";
const _hoisted_1 = /* @__PURE__ */ createElementVNode("span", { class: "left-text" }, "\u65B0\u7248\u672C\u4F53\u9A8C\u4E2D...", -1);
const __default__ = {
  name: "BCGrayNav"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    env_data: { default: () => {
      return {
        sid: "",
        domain: "",
        corp_id: "",
        node_env: "uat",
        app_id: "",
        token: "",
        wl_corp_ids: [],
        card_resource: ""
      };
    } }
  },
  setup(__props) {
    const props = __props;
    const isNormal = ref(true);
    const corpList = computed(() => props.env_data.wl_corp_ids || []);
    const corp_id = computed(() => props.env_data.corp_id);
    const node_env = computed(() => props.env_data.node_env);
    const isIframeBool = isIframe();
    const isWl = corpList.value.includes(corp_id.value);
    const isPre = node_env.value === "stg";
    function backToNormal() {
      let d = new Date();
      d.setTime(d.getTime() + 2 * 24 * 60 * 60 * 1e3);
      let expires = "expires=" + d.toUTCString();
      document.cookie = "env=tmp-prod;path=/;" + expires;
      window.location.reload();
    }
    function autoBackToAlpha() {
      let d = new Date();
      d.setTime(d.getTime() + 365 * 24 * 60 * 60 * 1e3);
      let expires = "expires=" + d.toUTCString();
      document.cookie = "env=gray;path=/;" + expires;
      window.location.reload();
    }
    function judgeCookie() {
      let cookie = document.cookie;
      if (cookie == null ? void 0 : cookie.includes("env=tmp-prod")) {
        isNormal.value = true;
        return;
      }
      if (cookie == null ? void 0 : cookie.includes("env=gray")) {
        isNormal.value = false;
        return;
      }
      isNormal.value = true;
      if (isWl && !isPre) {
        autoBackToAlpha();
      }
    }
    judgeCookie();
    return (_ctx, _cache) => {
      const _component_van_sticky = resolveComponent("van-sticky");
      return !isNormal.value && !unref(isIframeBool) ? (openBlock(), createBlock(_component_van_sticky, {
        key: 0,
        "offset-top": 0
      }, {
        default: withCtx(() => [
          createElementVNode("div", {
            class: "to-normal",
            "data-weiling-mobile-ui-bc-gray": ""
          }, [
            _hoisted_1,
            createElementVNode("div", {
              class: "right-back",
              onClick: backToNormal
            }, "\u8FD4\u56DE\u6B63\u5F0F\u7248")
          ])
        ]),
        _: 1
      })) : createCommentVNode("", true);
    };
  }
});
var __uno = "";
_sfc_main.install = (app) => {
  app.component(_sfc_main.name, _sfc_main);
};
export { _sfc_main as default };
