require("../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
let react = require("react");
let lodash = require("lodash");
//#region src/pro/Selector/hooks/usePresetItemProps.ts
/**
* 根据预设项生成 option Item 的 props
*
* 规则说明：
* 1. variant='default': 使用 Card，borderless，horizontal，selectedType='none'，actionsPosition='left'
*    1.1 preset.variant='1': renderContent={() => <span>{dataSource._label}</span>}
*    1.2 preset.variant='2': renderContent={() => <span>{dataSource._label}</span>}
* 2. variant='media': 使用 MediaItem
*    2.1 preset.variant='1': size='small', showIndicator=false, 单选shape='circle'，多选shape='square'
*    2.2 preset.variant='2': size='large', showIndicator=true, shape='circle'
* 3. variant='card': 根据 itemLayout 区分横向和纵向
*    3.1 横向（horizontal）:
*        - preset.variant='2': selectedType='filled'
*        - preset.variant='5': variant='borderless'
*        - 默认样式: styles.container = { padding: 8 }
*        - 使用 lodash merge 深度合并样式，itemProps.styles 优先级更高
*    3.2 纵向（vertical）:
*        - 统一使用 borderless，selectedType='none'
*        - preset.variant='2': indicator 通过 corner 传入
*    3.3 actions 处理:
*        - 优先使用 numberSelector（如果存在）
*        - 其次使用 indicator
*        - 纵向且 preset.variant='2': indicator 放到 corner，actions 仅展示 numberSelector
*/
const usePresetItemProps = (params) => {
	const { variant, itemLayout, preset, itemProps = {}, indicator: originIndicator, numberSelector, mode, disabled, selected } = params;
	return (0, react.useMemo)(() => {
		let mediaProps = {};
		let cardProps = {};
		let indicator = originIndicator;
		const presetVariant = preset === null || preset === void 0 ? void 0 : preset.variant;
		if (variant === "media") {
			let presetProps = {};
			if (presetVariant === "1") presetProps = {
				size: "small",
				showIndicator: false,
				shape: mode === "single" ? "circle" : "square",
				coverType: "text"
			};
			else if (presetVariant === "2") presetProps = {
				size: "large",
				showIndicator: true,
				shape: "circle"
			};
			mediaProps = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, presetProps), itemProps);
			return {
				mediaProps,
				cardProps
			};
		}
		if (variant === "default") {
			cardProps = require_objectSpread2._objectSpread2({
				variant: "borderless",
				layout: "horizontal",
				selectedType: "none",
				actionsPosition: "left",
				actions: numberSelector ? [numberSelector] : [indicator],
				renderContent: presetVariant === "1" || presetVariant === "2" ? ({ dataSource }) => dataSource === null || dataSource === void 0 ? void 0 : dataSource._label : void 0
			}, itemProps);
			return {
				mediaProps,
				cardProps
			};
		}
		if (variant === "card") {
			const isVertical = ((itemProps === null || itemProps === void 0 ? void 0 : itemProps.layout) || itemLayout || "horizontal") === "vertical";
			let baseProps = {};
			if (isVertical) {
				const defaultStyles = { content: { minHeight: "264px" } };
				baseProps = {
					layout: "vertical",
					variant: "borderless"
				};
				if (presetVariant === "2") {
					const mergedStyles = (0, lodash.merge)({}, defaultStyles, itemProps === null || itemProps === void 0 ? void 0 : itemProps.styles);
					cardProps = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, baseProps), {}, {
						corner: indicator,
						actions: numberSelector ? [numberSelector] : []
					}, itemProps), {}, { styles: mergedStyles });
				} else {
					const mergedStyles = (0, lodash.merge)({}, defaultStyles, itemProps === null || itemProps === void 0 ? void 0 : itemProps.styles);
					cardProps = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, baseProps), {}, { actions: numberSelector ? [numberSelector] : [indicator] }, itemProps), {}, { styles: mergedStyles });
				}
			} else {
				const defaultStyles = {
					container: { padding: 8 },
					content: {}
				};
				if (presetVariant === "1") {
					defaultStyles.container.padding = "12px 16px";
					defaultStyles.content.textAlign = "center";
					baseProps = { selectedType: "outlined-bold" };
					if (selected) defaultStyles.content.fontWeight = "600";
					indicator = null;
				} else if (presetVariant === "2") {
					defaultStyles.container.padding = "12px 16px";
					baseProps = { selectedType: "filled" };
					indicator = selected ? indicator : null;
				} else if (presetVariant === "5") baseProps = {
					variant: "borderless",
					selectedType: "none"
				};
				const mergedStyles = (0, lodash.merge)({}, defaultStyles, itemProps === null || itemProps === void 0 ? void 0 : itemProps.styles);
				cardProps = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, baseProps), {}, { actions: numberSelector ? [numberSelector] : [indicator] }, itemProps), {}, { styles: mergedStyles });
			}
			return {
				mediaProps,
				cardProps
			};
		}
		return {
			mediaProps,
			cardProps
		};
	}, [
		variant,
		itemLayout,
		preset,
		itemProps,
		originIndicator,
		numberSelector,
		mode,
		disabled,
		selected
	]);
};
//#endregion
exports.default = usePresetItemProps;
