import '@das-fed/ui/packages/components/message/style.css';
import { ElMessage as n } from "element-plus";
import { DasIconTongguo as f } from "@das-fed/ui/packages/icons/tongguo/index";
import { DasIconJinggao as g } from "@das-fed/ui/packages/icons/jinggao/index";
import { DasIconTongzhi as y } from "@das-fed/ui/packages/icons/tongzhi/index";
import { h as t } from "vue";
import "element-plus/es/components/message/style/css";
import { setThemeRule as F } from "@das-fed/web/packages/theme/index";
import { setI18nRule as w, t as x } from "@das-fed/web/packages/i18n/index";
const M = (e = 24) => {
  b("das-ui-message-container", [
    {
      styleName: "transform",
      style: `translateY(${e}px)`
    }
  ]);
}, b = (e, s) => {
  const o = document.getElementById(e);
  if (!o) {
    const a = document.createElement("div");
    a.style.transform = "translateY(24px)", a.id = e, a.style.position = "fixed", a.style.top = "0", a.style.left = "0", a.style.width = "100%", a.style.zIndex = "999999", document.body.appendChild(a);
    return;
  }
  for (const a of s)
    o.style[a.styleName] = a.style;
}, h = (e) => {
  let s = "";
  return e == "success" && (s = t(f, {
    iconColor: "#1BA854",
    customSize: "16"
  })), e == "warning" && (s = t(g, {
    iconColor: "#FF991C",
    customSize: "16"
  })), e == "info" && (s = t(y, {
    iconColor: "#0E5FD8",
    customSize: "16"
  })), e == "error" && (s = t(g, {
    iconColor: "#FB2323",
    customSize: "16"
  })), s;
}, C = (e) => {
  let s = "";
  return e == "success" && (s = " el-message--success"), e == "warning" && (s = " el-message--warning"), e == "info" && (s = " el-message--info"), e == "error" && (s = " el-message--error"), s;
};
M();
let i = {
  close() {
  }
};
const D = {
  offset: 16,
  // 默认3s
  duration: 3e3
}, r = (e) => {
  var s;
  return r.proxyStatus ? r.proxyMessage(e) : (typeof e == "string" && (e = { message: e }), e = { ...D, ...e }, e.customClass = ((s = e.customClass) == null ? void 0 : s.concat(" das-ui-message")) || "das-ui-message", e.appendTo || (e.appendTo = "#das-ui-message-container"), e.icon || (e.icon = h(e.type), e.customClass = e.customClass.concat(C(e.type))), i = n(e), i);
};
r.error = (e) => (typeof e == "string" && (e = { message: e }), e.type = "error", r(e));
r.success = (e) => (typeof e == "string" && (e = { message: e }), e.type = "success", r(e));
r.info = (e) => (typeof e == "string" && (e = { message: e }), e.type = "info", r(e));
r.warning = (e) => (typeof e == "string" && (e = { message: e }), e.type = "warning", r(e));
r.closeAll = (e) => n.closeAll(e);
window.addEventListener("message", (e) => {
  const { type: s, data: o } = e.data, a = { setProxyMessageStatus: "setProxyMessageStatus", showProxyMessage: "showProxyMessage" };
  if (Object.values(a).includes(s)) {
    if (console.log(s), s === a.setProxyMessageStatus) {
      const { visible: m, parentHref: l } = o;
      r.proxyStatus = m ?? !0, r.proxyMessage = (u) => {
        var c;
        const { origin: d } = new URL(l);
        (c = window.top) == null || c.postMessage({ type: "showProxyMessage", data: u }, d);
      };
    }
    s === a.showProxyMessage && r(o);
  }
});
const S = {
  "--das-ui-message-font-size-sm": "12px",
  "--das-ui-message-font-size-md": "14px",
  "--das-ui-message-font-size-lg": "16px",
  "--das-ui-message-color": "#0E5FD8",
  "--das-ui-message-bd-color": "#b3d5ff",
  "--das-ui-message-bg-color": "#e0efff",
  "--das-ui-message-thumb-color": "#B2B2B2",
  "--das-ui-message-close-color": "#666",
  "--das-ui-message-close-hover-color": "#87adff",
  "--das-ui-message-success-bg-color": "#dcfae4",
  "--das-ui-message-success-color": "#1BA854",
  "--das-ui-message-success-bd-color": "#a1e6b5",
  "--das-ui-message-info-bg-color": "#E0EFFF",
  "--das-ui-message-info-color": "#0E5FD8",
  "--das-ui-message-info-bd-color": "#B3D5FF",
  "--das-ui-message-warning-bg-color": "#FFF1D4",
  "--das-ui-message-warning-color": "#FF991C",
  "--das-ui-message-warning-bd-color": "#FFE0A6",
  "--das-ui-message-error-bg-color": "#FFDBE0",
  "--das-ui-message-error-color": "#FB2323",
  "--das-ui-message-error-bd-color": "##FFADB6"
}, B = { 消息提示: { "zh-CN": "消息提示", en: "Message Prompt", _appCode: "framework" } };
w(B);
F(S);
const E = r;
window.DasMessage = E;
const R = { name: `Message ${x("消息提示")}` };
export {
  E as DasMessage,
  R as default
};
