require("../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_objectWithoutProperties = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_ChildComponentProps = require("../provider/ChildComponentProps.js");
const require_HandleActions = require("../provider/HandleActions.js");
const require_RefManager = require("../provider/RefManager.js");
let react = require("react");
//#region src/components/pisellDataSourceContainer/hooks/useContainerContext.ts
const _excluded = ["form"];
const useContainerContext = (displayName) => {
	const handleActionsValue = require_HandleActions.useHandleActionProvider();
	const refManager = require_RefManager.useRefManagerProvider();
	const childComponentProps = require_ChildComponentProps.useChildComponentPropsContext();
	const onValuesChange = (0, react.useCallback)((changedValues, _allValues) => {
		try {
			handleActionsValue.list.onSearch(changedValues);
		} catch (error) {
			console.error("[useContainerContext] onValuesChange 执行失败:", error);
		}
	}, [handleActionsValue.list]);
	return (0, react.useMemo)(() => {
		const { form } = childComponentProps, childProps = require_objectWithoutProperties._objectWithoutProperties(childComponentProps, _excluded);
		let contextValue = {
			serverActions: handleActionsValue,
			refManager,
			form,
			onValuesChange
		};
		if (displayName && childProps) {
			const specificProps = childProps[displayName];
			if (specificProps !== void 0) contextValue = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, contextValue), specificProps);
		}
		return contextValue;
	}, [
		displayName,
		onValuesChange,
		handleActionsValue,
		refManager,
		childComponentProps
	]);
};
//#endregion
exports.default = useContainerContext;
