import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { RecordBoardContext } from "../context/RecordBoardContext.js";
import { useContext } from "react";
//#region src/components/pisellRecordBoard/hooks/useRecordBoardContext.ts
function useRecordBoardContext(options = {}) {
	const ctx = useContext(RecordBoardContext);
	if (!ctx) throw new Error("useRecordBoardContext 必须在 PisellRecordBoard（或 RecordBoardProvider）下使用");
	const { displayName, childComponentProps } = options;
	const mergedChildProps = childComponentProps !== null && childComponentProps !== void 0 ? childComponentProps : ctx.childComponentProps;
	if (displayName && (mergedChildProps === null || mergedChildProps === void 0 ? void 0 : mergedChildProps[displayName])) return _objectSpread2(_objectSpread2({}, ctx), mergedChildProps[displayName]);
	return ctx;
}
//#endregion
export { useRecordBoardContext };
