import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { useMemo } from "react";
import classNames from "classnames";
//#region src/components/PisellCards/components/PisellImageCard/hooks/usePisellImageCardStyle.ts
/**
* 样式合并 Hook
* @param props - 组件 Props
* @returns 合并后的样式和类名
*/
const usePisellImageCardStyle = (props) => {
	const { style, className, active, disabled, loading, fillMode = "cover", width = "100%", height = "100%" } = props;
	return {
		mergedStyle: useMemo(() => {
			let finalStyle = _objectSpread2({
				width,
				height
			}, style);
			if ((loading === null || loading === void 0 ? void 0 : loading.value) && (loading === null || loading === void 0 ? void 0 : loading.style)) finalStyle = _objectSpread2(_objectSpread2({}, finalStyle), loading.style);
			else if ((disabled === null || disabled === void 0 ? void 0 : disabled.value) && (disabled === null || disabled === void 0 ? void 0 : disabled.style)) finalStyle = _objectSpread2(_objectSpread2({}, finalStyle), disabled.style);
			else if ((active === null || active === void 0 ? void 0 : active.value) && (active === null || active === void 0 ? void 0 : active.style)) finalStyle = _objectSpread2(_objectSpread2({}, finalStyle), active.style);
			return finalStyle;
		}, [
			style,
			active,
			disabled,
			loading,
			width,
			height
		]),
		mergedClassName: useMemo(() => {
			return classNames("pisell-image-card", className, `pisell-image-card--${fillMode}`, {
				"pisell-image-card--active": active === null || active === void 0 ? void 0 : active.value,
				"pisell-image-card--disabled": disabled === null || disabled === void 0 ? void 0 : disabled.value,
				"pisell-image-card--loading": loading === null || loading === void 0 ? void 0 : loading.value
			}, (active === null || active === void 0 ? void 0 : active.value) && (active === null || active === void 0 ? void 0 : active.className), (disabled === null || disabled === void 0 ? void 0 : disabled.value) && (disabled === null || disabled === void 0 ? void 0 : disabled.className), (loading === null || loading === void 0 ? void 0 : loading.value) && (loading === null || loading === void 0 ? void 0 : loading.className));
		}, [
			className,
			active,
			disabled,
			loading,
			fillMode
		])
	};
};
//#endregion
export { usePisellImageCardStyle };
