import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import IconFont from "../../../../iconfont/index.js";
import Provider from "../../PisellImageCard/PisellImageCard.js";
import React from "react";
import classNames from "classnames";
//#region src/components/PisellCards/components/GraphicTextCard/components/GraphicArea.tsx
/**
* GraphicArea 图形区域组件
* 负责渲染图片或图标
*
* @component
* @example
* ```tsx
* // 渲染图片
* <GraphicArea
*   image="https://example.com/image.png"
*   config={{ width: 60, height: 60, borderRadius: 8 }}
* />
*
* // 渲染图标
* <GraphicArea
*   icon={<SmileIcon />}
*   config={{ width: 36, height: 36, iconSize: 24, iconColor: '#7F56D9' }}
* />
* ```
*/
const GraphicArea = (props) => {
	var _config$dataSource, _config$dataSource2, _config$dataSource3;
	const { image, icon, config = {}, className } = props;
	const { width, height, borderRadius, background, border, boxShadow, padding, iconSize, iconColor, style: customStyle, hidden, aliWidth } = config;
	/**
	* 图形区域容器样式
	*/
	const graphicStyle = _objectSpread2({
		width,
		height,
		borderRadius,
		background,
		border,
		boxShadow,
		padding
	}, customStyle);
	if (hidden) return null;
	/**
	* 图标样式
	*/
	const iconStyle = {
		fontSize: iconSize,
		color: iconColor,
		width: iconSize,
		height: iconSize
	};
	if (icon) return /* @__PURE__ */ React.createElement("div", {
		className: classNames("graphic-text-card__graphic", className),
		style: graphicStyle
	}, /* @__PURE__ */ React.createElement(IconFont, {
		style: iconStyle,
		type: icon
	}));
	return /* @__PURE__ */ React.createElement("div", {
		className: classNames("graphic-text-card__graphic", className),
		style: graphicStyle
	}, /* @__PURE__ */ React.createElement(Provider, _objectSpread2(_objectSpread2({}, config), {}, {
		dataSource: {
			src: image,
			alt: (_config$dataSource = config.dataSource) === null || _config$dataSource === void 0 ? void 0 : _config$dataSource.alt,
			errorSrc: (_config$dataSource2 = config.dataSource) === null || _config$dataSource2 === void 0 ? void 0 : _config$dataSource2.errorSrc,
			fallbackSrc: (_config$dataSource3 = config.dataSource) === null || _config$dataSource3 === void 0 ? void 0 : _config$dataSource3.fallbackSrc
		},
		width: "100%",
		height: "100%",
		aliWidth
	})));
};
//#endregion
export { GraphicArea as default };
