const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let antd = require("antd");
//#region src/components/productCard/cartSkuCard/components/discountReason/index.tsx
const DiscountReason = (props) => {
	const { dataSource = {}, hideDivider } = props;
	const { total, origin_total, symbol, tip, num, discount_reason } = dataSource;
	const isDiscount = (0, react.useMemo)(() => {
		if (!origin_total) return false;
		return Number(total) != Number(origin_total);
	}, [total, origin_total]);
	const renderDivider = () => {
		return isDiscount && discount_reason && !hideDivider ? /* @__PURE__ */ react.default.createElement(antd.Divider, { style: { margin: 0 } }) : null;
	};
	const renderDiscountReason = () => {
		if (isDiscount && discount_reason) {
			if (Array.isArray(discount_reason)) return /* @__PURE__ */ react.default.createElement("div", {
				className: `${require_index.PREFIX}_discount-reason`,
				style: {
					display: "flex",
					flexWrap: "wrap",
					gap: "4px"
				}
			}, discount_reason.map((reason, index) => {
				return /* @__PURE__ */ react.default.createElement(antd.Tag, {
					key: index,
					color: "red"
				}, reason);
			}));
			return /* @__PURE__ */ react.default.createElement("div", { className: `${require_index.PREFIX}_discount-reason` }, /* @__PURE__ */ react.default.createElement("span", null, `${_pisell_utils.locales.getText("pisell2.product.card.discount.reason")}: ${discount_reason}`));
		}
	};
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, renderDivider(), renderDiscountReason());
};
//#endregion
exports.default = DiscountReason;
