var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/pisellDataSourceContainer/hooks/useContainerContext.ts
var useContainerContext_exports = {};
__export(useContainerContext_exports, {
  default: () => useContainerContext_default
});
module.exports = __toCommonJS(useContainerContext_exports);
var import_react = require("react");
var import_HandleActions = require("../provider/HandleActions");
var import_RefManager = require("../provider/RefManager");
var import_ChildComponentProps = require("../provider/ChildComponentProps");
var useContainerContext = (displayName) => {
  const handleActionsValue = (0, import_HandleActions.useHandleActionProvider)();
  const refManager = (0, import_RefManager.useRefManagerProvider)();
  const childComponentProps = (0, import_ChildComponentProps.useChildComponentPropsContext)();
  const onValuesChange = (0, import_react.useCallback)(
    (changedValues, _allValues) => {
      try {
        handleActionsValue.list.onSearch(changedValues);
      } catch (error) {
        console.error("[useContainerContext] onValuesChange 执行失败:", error);
      }
    },
    [handleActionsValue.list]
  );
  return (0, import_react.useMemo)(() => {
    const { form, ...childProps } = childComponentProps;
    let contextValue = {
      serverActions: handleActionsValue,
      refManager,
      form,
      onValuesChange
    };
    if (displayName && childProps) {
      const specificProps = childProps[displayName];
      if (specificProps !== void 0) {
        contextValue = {
          ...contextValue,
          ...specificProps
        };
      }
    }
    return contextValue;
  }, [
    displayName,
    onValuesChange,
    handleActionsValue,
    refManager,
    childComponentProps
  ]);
};
var useContainerContext_default = useContainerContext;
