"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const react = require("@emotion/react");
const React = require("react");
const jsxRuntime = require("@emotion/react/jsx-runtime");
const ReactDOM = require("react-dom");
const blackInfo = require("../../assets/icon/blackInfo.svg.js");
const greenCheck = require("../../assets/icon/greenCheck.svg.js");
const redError = require("../../assets/icon/redError.svg.js");
const index = require("../BottomTabBar/index.js");
var MessageTypes = /* @__PURE__ */ ((MessageTypes2) => {
  MessageTypes2["Success"] = "Success";
  MessageTypes2["Info"] = "Info";
  MessageTypes2["Error"] = "Error";
  return MessageTypes2;
})(MessageTypes || {});
const MessageBottomComp = React.memo(function MessageBottomComp2({
  content,
  actions,
  type,
  cssStyle,
  className,
  style
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    index.BottomTabBar,
    {
      cssStyle,
      className,
      style,
      defaultVisible: true,
      modalId: "MessageTip",
      icon: /* @__PURE__ */ jsxRuntime.jsx(
        "img",
        {
          src: type === "Error" ? redError : type === "Info" ? blackInfo : greenCheck,
          css: react.css`
            width: 36px;
            height: 36px;
            margin-left: 3px;
          `
        }
      ),
      tips: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
        "div",
        {
          css: react.css`
              font-family: Poppins-Bold;
              font-weight: 700;
              font-size: 1rem;
              line-height: 1.5rem;
              color: ${type === "Error" ? "#CB2424" : type === "Info" ? " #000000" : "#48A92F"};
            `,
          children: content
        }
      ) }),
      actions
    }
  );
});
const message = (props) => {
  const holder = document.createElement("div");
  holder.setAttribute("id", "dataverseMessageBox");
  document.body.append(holder);
  const destroy = () => {
    holder.remove();
  };
  setTimeout(() => {
    destroy();
  }, props.duration || 3e3);
  holder.addEventListener("click", () => {
    holder.remove();
  });
  ReactDOM.render(/* @__PURE__ */ jsxRuntime.jsx(MessageBottomComp, { ...props }), holder);
};
message.info = (content) => {
  message({
    content,
    type: "Info"
    /* Info */
  });
};
message.success = (content) => {
  message({
    content,
    type: "Success"
    /* Success */
  });
};
message.error = (content) => {
  message({
    content,
    type: "Error"
    /* Error */
  });
};
exports.MessageTypes = MessageTypes;
exports.message = message;
//# sourceMappingURL=index.js.map
