import { must } from "../../../shared/src/must.js";
import { customMutatorKey } from "../../../zql/src/mutate/custom.js";
function addCustomMutatorsProperties(mutators, mutatorProxy, mutateObject, replicacheMutate) {
  const processMutators = (mutators2, path, mutateObject2) => {
    for (const [key, mutator] of Object.entries(mutators2)) {
      path.push(key);
      if (typeof mutator === "function") {
        const fullKey = customMutatorKey("|", path);
        mutateObject2[key] = mutatorProxy.wrapCustomMutator(
          fullKey,
          must(replicacheMutate[fullKey])
        );
      } else {
        let existing = mutateObject2[key];
        if (existing === void 0) {
          existing = {};
          mutateObject2[key] = existing;
        }
        processMutators(
          mutator,
          path,
          existing
        );
      }
      path.pop();
    }
  };
  processMutators(mutators, [], mutateObject);
}
export {
  addCustomMutatorsProperties
};
//# sourceMappingURL=make-mutate-property.js.map
