import { $constructor } from "../core/core.js";
import { jsonStringifyReplacer } from "../core/util.js";
import { $ZodError, flattenError, formatError } from "../core/errors.js";
var initializer = (e, o) => {
	$ZodError.init(e, o), e.name = "ZodError", Object.defineProperties(e, {
		format: { value: (i) => formatError(e, i) },
		flatten: { value: (i) => flattenError(e, i) },
		addIssue: { value: (a) => {
			e.issues.push(a), e.message = JSON.stringify(e.issues, jsonStringifyReplacer, 2);
		} },
		addIssues: { value: (a) => {
			e.issues.push(...a), e.message = JSON.stringify(e.issues, jsonStringifyReplacer, 2);
		} },
		isEmpty: { get() {
			return e.issues.length === 0;
		} }
	});
};
$constructor("ZodError", initializer);
const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
export { ZodRealError };
