import useEngineContext from "../../../../hooks/useEngineContext.js";
import { useGetApp } from "../../hooks.js";
import React from "react";
import { PageHeader } from "@pisell/materials";
import { LeftOutlined } from "@ant-design/icons";
import "./index.less";
//#region src/components/ecocup/components/PageHeader/index.tsx
const prefixCls = "ecocup-page-header";
const CustomPageHeader = (props) => {
	var _context$appHelper;
	const { title, rightContent, isReturn = true } = props;
	const context = useEngineContext();
	const { history } = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
	const app = useGetApp();
	const onBack = () => {
		if (!isReturn) return;
		if (app === null || app === void 0 ? void 0 : app.history) {
			var _app$history;
			(_app$history = app.history) === null || _app$history === void 0 || _app$history.goBack();
		} else {
			var _history$goBack;
			history === null || history === void 0 || (_history$goBack = history.goBack) === null || _history$goBack === void 0 || _history$goBack.call(history);
		}
	};
	return /* @__PURE__ */ React.createElement("div", {
		className: prefixCls,
		onClick: onBack
	}, /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-left-container` }, isReturn ? /* @__PURE__ */ React.createElement(LeftOutlined, { style: { fontSize: 18 } }) : null, /* @__PURE__ */ React.createElement(PageHeader, {
		title,
		showTitle: true
	})), /* @__PURE__ */ React.createElement("div", {
		className: `${prefixCls}-right-container`,
		onClick: (e) => e.stopPropagation()
	}, rightContent || ""));
};
//#endregion
export { CustomPageHeader as default };
