const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_index = require("../../../modal/index.js");
const require_constants = require("../../constants.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let antd = require("antd");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
let _pisell_icon_es_XClose = require("@pisell/icon/es/XClose");
_pisell_icon_es_XClose = require_runtime.__toESM(_pisell_icon_es_XClose);
let _pisell_icon_es_Delete_wght300_24px = require("@pisell/icon/es/Delete_wght300_24px");
_pisell_icon_es_Delete_wght300_24px = require_runtime.__toESM(_pisell_icon_es_Delete_wght300_24px);
require("./index.less");
//#region src/components/pisellModal/components/PcModal/index.tsx
const PcModal = (props) => {
	const { wrapClassName, okButtonProps, cancelButtonProps, width: propsWidth, size = "middle", closeIcon: propsCloseIcon, headerDivider, footerDivider, title, centered = true, deleteButtonProps, onDelete, cancelVisible = true, okVisible = true, actions, footer, header } = props;
	const width = (0, react.useMemo)(() => {
		return propsWidth || require_constants.sizeMap[size];
	}, [propsWidth, size]);
	const closeIcon = (0, react.useMemo)(() => {
		if ((0, _pisell_utils.isUndefined)(propsCloseIcon)) return /* @__PURE__ */ react.default.createElement(_pisell_icon_es_XClose.default, { style: { fontSize: 20 } });
	}, [propsCloseIcon]);
	const deleteBtn = (0, react.useMemo)(() => {
		if (!deleteButtonProps) return null;
		return /* @__PURE__ */ react.default.createElement("span", { style: { flexShrink: 0 } }, /* @__PURE__ */ react.default.createElement(antd.Button, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
			icon: /* @__PURE__ */ react.default.createElement(_pisell_icon_es_Delete_wght300_24px.default, { style: { fontSize: 20 } }),
			size: "large"
		}, deleteButtonProps), {}, { onClick: (e) => {
			var _deleteButtonProps$on;
			deleteButtonProps === null || deleteButtonProps === void 0 || (_deleteButtonProps$on = deleteButtonProps.onClick) === null || _deleteButtonProps$on === void 0 || _deleteButtonProps$on.call(deleteButtonProps, e);
			onDelete === null || onDelete === void 0 || onDelete();
		} })));
	}, [deleteButtonProps]);
	const isHideFooter = (0, react.useMemo)(() => {
		return (0, _pisell_utils.isBoolean)(footer) && !footer || footer === null;
	}, [footer]);
	const isHideHeader = (0, react.useMemo)(() => {
		return (0, _pisell_utils.isBoolean)(header) && !header || header === null;
	}, [header]);
	const renderFooter = (_, { OkBtn, CancelBtn }) => {
		if (footer) return footer;
		if ([
			deleteBtn,
			actions,
			cancelVisible,
			okVisible
		].every((item) => !item)) return null;
		return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, deleteBtn, actions, cancelVisible && /* @__PURE__ */ react.default.createElement(CancelBtn, null), okVisible && /* @__PURE__ */ react.default.createElement(OkBtn, null));
	};
	return /* @__PURE__ */ react.default.createElement(require_index.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({ keyboard: false }, props), {}, {
		centered,
		title: title || /* @__PURE__ */ react.default.createElement("div", { style: { height: 24 } }),
		width,
		wrapClassName: (0, classnames.default)("pisell-pc-modal", { [wrapClassName]: wrapClassName }),
		closeIcon,
		footer: isHideFooter ? null : renderFooter,
		okButtonProps: require_objectSpread2._objectSpread2({
			block: true,
			size: "large",
			style: { margin: 0 }
		}, okButtonProps || {}),
		cancelButtonProps: require_objectSpread2._objectSpread2({
			block: true,
			size: "large"
		}, cancelButtonProps || {}),
		styles: {
			header: {
				borderBottom: headerDivider ? "1px solid var(--Gray-200, #EAECF0)" : "none",
				display: isHideHeader ? "none" : "block"
			},
			footer: { borderTop: footerDivider ? "1px solid var(--Gray-200, #EAECF0)" : "none" }
		}
	}));
};
//#endregion
exports.default = PcModal;
