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/GraphicTextCard/hooks/useGraphicTextCardStyle.ts
/**
* useGraphicTextCardStyle Hook
* 处理组件样式和类名的合并逻辑
* 
* @param props - GraphicTextCard 组件的 Props
* @returns 合并后的样式和类名
* 
* @example
* ```tsx
* const { mergedStyle, mergedClassName } = useGraphicTextCardStyle(props);
* ```
*/
const useGraphicTextCardStyle = (props) => {
	const { variant = "vertical-image", size = "default", active, disabled, loading, className, style, widthMode = "auto", width, maxWidth = 400, clickable = true } = props;
	return {
		mergedStyle: useMemo(() => {
			let finalStyle = _objectSpread2({ height: "100%" }, style);
			if (widthMode === "auto") {
				finalStyle.width = "auto";
				finalStyle.maxWidth = maxWidth;
			} else if (widthMode === "fixed" && width) finalStyle.width = width;
			else if (widthMode === "full") finalStyle.width = "100%";
			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,
			widthMode,
			width,
			maxWidth
		]),
		mergedClassName: useMemo(() => {
			return classNames("graphic-text-card", `graphic-text-card--${variant}`, `graphic-text-card--${size}`, className, {
				"graphic-text-card--active": active === null || active === void 0 ? void 0 : active.value,
				"graphic-text-card--disabled": disabled === null || disabled === void 0 ? void 0 : disabled.value,
				"graphic-text-card--loading": loading === null || loading === void 0 ? void 0 : loading.value,
				"graphic-text-card--clickable": clickable && !(disabled === null || disabled === void 0 ? void 0 : disabled.value) && !(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,
			variant,
			size,
			active,
			disabled,
			loading,
			clickable
		])
	};
};
//#endregion
export { useGraphicTextCardStyle };
