import '@das-fed/upf-ui/packages/components/notification/style.css';
import { notification as t } from "ant-design-vue";
import "ant-design-vue/es/notification/style/css";
import { setI18nRule as w, t as m } from "@das-fed/upf-web/packages/i18n/index";
const y = () => {
  let i = document.getElementById("das-ui-notification-container");
  if (!i) {
    i = document.createElement("div"), i.id = "das-ui-notification-container", i.style.position = "relative", i.style.width = "100%", i.style.zIndex = "999999", document.body.appendChild(i);
    return;
  }
  return i;
};
y();
t.config({
  getContainer: y,
  maxCount: 3
});
const r = (i, n) => {
  var a, c, o, s, f, d, u, l;
  return e.proxyStatus ? (a = e.proxyNotification) == null ? void 0 : a.call(e, n) : i === "primary" ? (n.class = ((c = n.class) == null ? void 0 : c.concat(" das-ui-notification das-ui-notification-primary")) || "das-ui-notification das-ui-notification-primary", t.open(n)) : i === "warn" ? (n.class = ((o = n.class) == null ? void 0 : o.concat(" das-ui-notification das-ui-notification-warn")) || "das-ui-notification das-ui-notification-warn", t.warn(n)) : i === "success" ? (n.class = ((s = n.class) == null ? void 0 : s.concat(" das-ui-notification das-ui-notification-success")) || "das-ui-notification das-ui-notification-success", t.success(n)) : i === "error" ? (n.class = ((f = n.class) == null ? void 0 : f.concat(" das-ui-notification das-ui-notification-error")) || "das-ui-notification das-ui-notification-error", t.error(n)) : i === "info" ? (n.class = ((d = n.class) == null ? void 0 : d.concat(" das-ui-notification das-ui-notification-info")) || "das-ui-notification das-ui-notification-info", t.info(n)) : i === "warning" ? (n.class = ((u = n.class) == null ? void 0 : u.concat(" das-ui-notification das-ui-notification-warning")) || "das-ui-notification das-ui-notification-warning", t.warning(n)) : (n.class = ((l = n.class) == null ? void 0 : l.concat(" das-ui-notification das-ui-notification-open")) || "das-ui-notification das-ui-notification-open", t.open(n));
}, e = {
  success: (i) => r("success", i),
  error: (i) => r("error", i),
  info: (i) => r("info", i),
  warning: (i) => r("warning", i),
  warn: (i) => r("warn", i),
  open: (i) => r("open", i),
  primary(i) {
    return r("primary", i);
  },
  config: (i) => t.config(i),
  destroy: () => t.destroy(),
  close: (i) => t.close(i)
};
window.addEventListener("message", (i) => {
  const { type: n, data: a } = i.data || {}, c = { setProxyNotificationStatus: "setProxyNotificationStatus", showProxyNotification: "showProxyNotification" };
  if (Object.values(c).includes(n)) {
    if (n === c.setProxyNotificationStatus) {
      const { visible: o, parentHref: s } = a || {};
      e.proxyStatus = o ?? !0, e.proxyNotification = (f) => {
        var u;
        const { origin: d } = new URL(s || window.location.href);
        (u = window.top) == null || u.postMessage({ type: "showProxyNotification", data: f }, d);
      };
    }
    if (n === c.showProxyNotification && a && typeof a == "object") {
      const o = String((a == null ? void 0 : a.type) || "").trim();
      r(o === "success" || o === "error" || o === "info" || o === "warning" ? o : "open", a);
    }
  }
});
const g = { 通知: { "zh-CN": "通知", en: "Notification", "zh-MO": "通知", _appCode: "framework" } };
w(g);
const P = { name: `Notification ${m("通知")}` };
export {
  e as DasNotification,
  P as default
};
