import { _objectSpread2 } from "../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import useToast$1 from "../../../../../../hooks/useToast.js";
import DiscountTextMode from "./DiscountTextMode.js";
import React, { useMemo } from "react";
import { locales } from "@pisell/utils";
import { PisellCardList } from "@pisell/materials";
import "./index.less";
//#region src/components/checkout/components/WalletPassModule/components/DiscountWallet/index.tsx
const DiscountWallet = (props) => {
	const { isCardMode, cardData, selectedWalletIds, onSelectWallet, onDetail, discountDisabled } = props;
	const Toast = useToast$1();
	const formatData = useMemo(() => {
		if (!discountDisabled) return cardData;
		return cardData.map((item) => _objectSpread2(_objectSpread2({}, item), {}, { disabled: true }));
	}, [discountDisabled, cardData]);
	const handleClick = () => {
		if (discountDisabled) Toast.info(locales.getText("wallet-pass-module-discount-partially-paid"));
	};
	return /* @__PURE__ */ React.createElement("div", { className: "discount-wallet-list-container" }, isCardMode ? /* @__PURE__ */ React.createElement(PisellCardList, {
		className: "",
		showName: true,
		showActiveBackground: true,
		showStoreName: (data) => {
			var _data$originData;
			if ((data === null || data === void 0 || (_data$originData = data.originData) === null || _data$originData === void 0 ? void 0 : _data$originData.tag) === "good_pass") return data.active;
			return true;
		},
		onItemClick: handleClick,
		disabled: discountDisabled,
		showRedeem: false,
		showBalance: false,
		showCode: false,
		showValidDate: false,
		showDetail: false,
		showQrCode: false,
		showCover: false,
		showActions: false,
		platform: "pc",
		mode: "multiple",
		direction: "horizontal",
		type: "mini",
		data: formatData,
		hasMore: false,
		showEmpty: false,
		fullWidth: false,
		value: selectedWalletIds,
		useExternalDetail: true,
		onDetail,
		showStatus: false,
		nameTitleStyle: {
			fontSize: 20,
			fontWeight: 600,
			color: "#FF8A1E"
		},
		onChange: onSelectWallet,
		actions: {
			layout: "expanded",
			detail: {
				visible: false,
				iconColor: "#1570EF"
			},
			edit: {
				visible: false,
				iconColor: "#1570EF"
			}
		},
		enableEditAmount: false
	}) : /* @__PURE__ */ React.createElement(DiscountTextMode, {
		cardData,
		selectedWalletIds
	}));
};
//#endregion
export { DiscountWallet as default };
