const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_index = require("../button/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _ant_design_icons = require("@ant-design/icons");
//#region src/components/buttonGroupPreview/index.tsx
/**
*
* @param param0 { buttonConfig, buttonGroupList }
* @returns 整合按钮配置 返回最新的组件数据
*/
const updateSourceData = ({ buttonConfig, buttonGroupList }) => {
	if (Object.keys(buttonConfig).length !== 0) return buttonGroupList.map((subArray) => {
		return subArray.map((item) => {
			if (buttonConfig.hasOwnProperty(item.id)) return buttonConfig[item.id];
			return item;
		});
	});
	return buttonGroupList;
};
const ButtonGroupPreview = (0, react.forwardRef)((props, ref) => {
	const { buttonConfig = {}, buttonGroupList = [] } = props;
	const sourceDatas = (0, react.useMemo)(() => {
		return updateSourceData({
			buttonConfig,
			buttonGroupList
		});
	}, [buttonGroupList, buttonConfig]);
	return /* @__PURE__ */ react.default.createElement(antd.Flex, {
		wrap: true,
		vertical: true,
		style: { marginBottom: 10 }
	}, sourceDatas.map((item, index) => /* @__PURE__ */ react.default.createElement(antd.Space, { key: index }, item.map((items, index) => {
		const { isMore = false, id = "", menuData = [], buttonProps } = items;
		const btnProps = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, buttonProps), props.updateButtonProps);
		return isMore ? /* @__PURE__ */ react.default.createElement(antd.Dropdown, { menu: { items: menuData } }, /* @__PURE__ */ react.default.createElement(require_index.default, null, /* @__PURE__ */ react.default.createElement(_ant_design_icons.MoreOutlined, null))) : /* @__PURE__ */ react.default.createElement(require_index.default, require_objectSpread2._objectSpread2({ key: id }, btnProps));
	}))));
});
var buttonGroupPreview_default = (0, react.memo)(ButtonGroupPreview);
//#endregion
exports.default = buttonGroupPreview_default;
