import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import Modal from "../../modal/index.js";
import icon_default from "../../icon/index.js";
import React, { useMemo } from "react";
import classNames from "classnames";
import "./index.less";
//#region src/components/pisellToast/squareToast/toast.tsx
const _excluded = [
	"content",
	"open",
	"icon",
	"className"
];
const icons = {
	info: "",
	success: "iconchenggong-1-01",
	error: "icon-warning",
	warning: "icon-warning",
	loading: "icon-loading",
	fail: "icon-warning"
};
const Toast = (_ref) => {
	let { content, open, icon, className } = _ref, rest = _objectWithoutProperties(_ref, _excluded);
	const iconElement = useMemo(() => {
		if (icon === null || icon === void 0) return null;
		if (typeof icon === "string" && icon in icons) {
			if (!icons[icon]) return null;
			return /* @__PURE__ */ React.createElement(icon_default, {
				type: icons[icon],
				className: `pisell-square-toast-icon pisell-square-toast-icon-${icon}`
			});
		}
		return icon;
	}, [icon]);
	return /* @__PURE__ */ React.createElement(Modal, _objectSpread2({
		open,
		footer: null,
		closable: false,
		centered: true,
		maskTransitionName: "",
		transitionName: "",
		width: "unset",
		wrapClassName: "pisell-square-toast-wrap",
		className: classNames("pisell-square-toast-modal", className),
		bodyStyle: { padding: 0 },
		destroyOnClose: true,
		modalRender: () => /* @__PURE__ */ React.createElement("div", { className: `pisell-square-toast` }, iconElement && /* @__PURE__ */ React.createElement("div", { className: "pisell-square-toast-icon-wrapper" }, iconElement), /* @__PURE__ */ React.createElement("div", { className: "pisell-square-toast-content" }, content))
	}, rest));
};
//#endregion
export { Toast as default };
