const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_index = require("./Buttons/index.js");
const require_index$1 = require("../../page-header/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
require("./index.less");
//#region src/components/table/Header/index.tsx
const Header = ({ buttons, title, subTitle, showTitle, showSubTitle }) => {
	const showHeader = (0, react.useMemo)(() => {
		return title && showTitle || (Array.isArray(buttons) ? buttons.length > 0 : buttons) || subTitle && showSubTitle;
	}, [
		buttons,
		title,
		subTitle,
		showTitle,
		showSubTitle
	]);
	const titleNode = (0, react.useMemo)(() => {
		if ((0, _pisell_utils.isFunction)(title)) return title();
		return title;
	}, [title]);
	const buttonsNode = (0, react.useMemo)(() => {
		if (Array.isArray(buttons)) return /* @__PURE__ */ react.default.createElement(require_index.default, { list: buttons });
		return buttons;
	}, [buttons]);
	const subTitleNode = (0, react.useMemo)(() => {
		if ((0, _pisell_utils.isFunction)(subTitle)) return subTitle();
		return subTitle;
	}, [subTitle]);
	return showHeader ? /* @__PURE__ */ react.default.createElement(require_index$1.default, {
		title: titleNode,
		showTitle,
		subTitle: subTitleNode,
		showSubTitle,
		extra: buttonsNode
	}) : null;
};
//#endregion
exports.default = Header;
