import { $ZodEncodeError, $constructor } from "../core/core.js";
import { clone, defineLazy, extend, issue, merge, mergeDefs, normalizeParams, omit, partial, pick, required, safeExtend, shallowClone } from "../core/util.js";
import { $ZodArray, $ZodBase64, $ZodBase64URL, $ZodBoolean, $ZodCIDRv4, $ZodCIDRv6, $ZodCUID, $ZodCUID2, $ZodCatch, $ZodCustom, $ZodDefault, $ZodDiscriminatedUnion, $ZodE164, $ZodEmail, $ZodEmoji, $ZodEnum, $ZodExactOptional, $ZodGUID, $ZodIPv4, $ZodIPv6, $ZodIntersection, $ZodJWT, $ZodKSUID, $ZodLazy, $ZodLiteral, $ZodNanoID, $ZodNever, $ZodNonOptional, $ZodNull, $ZodNullable, $ZodNumber, $ZodNumberFormat, $ZodObjectJIT, $ZodOptional, $ZodPipe, $ZodPrefault, $ZodReadonly, $ZodRecord, $ZodString, $ZodStringFormat, $ZodTransform, $ZodType, $ZodULID, $ZodURL, $ZodUUID, $ZodUnion, $ZodUnknown, $ZodXID } from "../core/schemas.js";
import { globalRegistry } from "../core/registries.js";
import { _array, _base64, _base64url, _boolean, _cidrv4, _cidrv6, _cuid, _cuid2, _custom, _e164, _email, _emoji, _endsWith, _gt, _gte, _guid, _includes, _int, _ipv4, _ipv6, _jwt, _ksuid, _length, _lowercase, _lt, _lte, _maxLength, _minLength, _multipleOf, _nanoid, _never, _normalize, _null as _null$1, _number, _overwrite, _refine, _regex, _slugify, _startsWith, _string, _superRefine, _toLowerCase, _toUpperCase, _trim, _ulid, _unknown, _uppercase, _url, _uuid, _uuidv4, _uuidv6, _uuidv7, _xid, describe as describe$1, meta as meta$1 } from "../core/api.js";
import { createStandardJSONSchemaMethod, createToJSONSchemaMethod } from "../core/to-json-schema.js";
import { arrayProcessor, booleanProcessor, catchProcessor, customProcessor, defaultProcessor, enumProcessor, intersectionProcessor, lazyProcessor, literalProcessor, neverProcessor, nonoptionalProcessor, nullProcessor, nullableProcessor, numberProcessor, objectProcessor, optionalProcessor, pipeProcessor, prefaultProcessor, readonlyProcessor, recordProcessor, stringProcessor, transformProcessor, unionProcessor, unknownProcessor } from "../core/json-schema-processors.js";
import { date, datetime, duration, time } from "./iso.js";
import { decode, decodeAsync, encode, encodeAsync, parse, parseAsync, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync } from "./parse.js";
const ZodType = /* @__PURE__ */ $constructor("ZodType", (b, Y) => ($ZodType.init(b, Y), Object.assign(b["~standard"], { jsonSchema: {
	input: createStandardJSONSchemaMethod(b, "input"),
	output: createStandardJSONSchemaMethod(b, "output")
} }), b.toJSONSchema = createToJSONSchemaMethod(b, {}), b.def = Y, b.type = Y.type, Object.defineProperty(b, "_def", { value: Y }), b.check = (...X) => b.clone(mergeDefs(Y, { checks: [...Y.checks ?? [], ...X.map((b) => typeof b == "function" ? { _zod: {
	check: b,
	def: { check: "custom" },
	onattach: []
} } : b)] }), { parent: !0 }), b.with = b.check, b.clone = (Y, Z) => clone(b, Y, Z), b.brand = () => b, b.register = ((Y, X) => (Y.add(b, X), b)), b.parse = (Y, X) => parse(b, Y, X, { callee: b.parse }), b.safeParse = (Y, X) => safeParse(b, Y, X), b.parseAsync = async (Y, X) => parseAsync(b, Y, X, { callee: b.parseAsync }), b.safeParseAsync = async (Y, X) => safeParseAsync(b, Y, X), b.spa = b.safeParseAsync, b.encode = (Y, X) => encode(b, Y, X), b.decode = (Y, X) => decode(b, Y, X), b.encodeAsync = async (Y, X) => encodeAsync(b, Y, X), b.decodeAsync = async (Y, X) => decodeAsync(b, Y, X), b.safeEncode = (Y, X) => safeEncode(b, Y, X), b.safeDecode = (Y, X) => safeDecode(b, Y, X), b.safeEncodeAsync = async (Y, X) => safeEncodeAsync(b, Y, X), b.safeDecodeAsync = async (Y, X) => safeDecodeAsync(b, Y, X), b.refine = (Y, X) => b.check(refine(Y, X)), b.superRefine = (Y) => b.check(superRefine(Y)), b.overwrite = (Y) => b.check(_overwrite(Y)), b.optional = () => optional(b), b.exactOptional = () => exactOptional(b), b.nullable = () => nullable(b), b.nullish = () => optional(nullable(b)), b.nonoptional = (Y) => nonoptional(b, Y), b.array = () => array(b), b.or = (Y) => union([b, Y]), b.and = (Y) => intersection(b, Y), b.transform = (Y) => pipe(b, transform(Y)), b.default = (Y) => _default(b, Y), b.prefault = (Y) => prefault(b, Y), b.catch = (Y) => _catch(b, Y), b.pipe = (Y) => pipe(b, Y), b.readonly = () => readonly(b), b.describe = (Y) => {
	let X = b.clone();
	return globalRegistry.add(X, { description: Y }), X;
}, Object.defineProperty(b, "description", {
	get() {
		return globalRegistry.get(b)?.description;
	},
	configurable: !0
}), b.meta = (...Y) => {
	if (Y.length === 0) return globalRegistry.get(b);
	let X = b.clone();
	return globalRegistry.add(X, Y[0]), X;
}, b.isOptional = () => b.safeParse(void 0).success, b.isNullable = () => b.safeParse(null).success, b.apply = (Y) => Y(b), b)), _ZodString = /* @__PURE__ */ $constructor("_ZodString", (b, Y) => {
	$ZodString.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => stringProcessor(b, Y, X, Z);
	let X = b._zod.bag;
	b.format = X.format ?? null, b.minLength = X.minimum ?? null, b.maxLength = X.maximum ?? null, b.regex = (...Y) => b.check(_regex(...Y)), b.includes = (...Y) => b.check(_includes(...Y)), b.startsWith = (...Y) => b.check(_startsWith(...Y)), b.endsWith = (...Y) => b.check(_endsWith(...Y)), b.min = (...Y) => b.check(_minLength(...Y)), b.max = (...Y) => b.check(_maxLength(...Y)), b.length = (...Y) => b.check(_length(...Y)), b.nonempty = (...Y) => b.check(_minLength(1, ...Y)), b.lowercase = (Y) => b.check(_lowercase(Y)), b.uppercase = (Y) => b.check(_uppercase(Y)), b.trim = () => b.check(_trim()), b.normalize = (...Y) => b.check(_normalize(...Y)), b.toLowerCase = () => b.check(_toLowerCase()), b.toUpperCase = () => b.check(_toUpperCase()), b.slugify = () => b.check(_slugify());
}), ZodString = /* @__PURE__ */ $constructor("ZodString", (b, Y) => {
	$ZodString.init(b, Y), _ZodString.init(b, Y), b.email = (Y) => b.check(_email(ZodEmail, Y)), b.url = (Y) => b.check(_url(ZodURL, Y)), b.jwt = (Y) => b.check(_jwt(ZodJWT, Y)), b.emoji = (Y) => b.check(_emoji(ZodEmoji, Y)), b.guid = (Y) => b.check(_guid(ZodGUID, Y)), b.uuid = (Y) => b.check(_uuid(ZodUUID, Y)), b.uuidv4 = (Y) => b.check(_uuidv4(ZodUUID, Y)), b.uuidv6 = (Y) => b.check(_uuidv6(ZodUUID, Y)), b.uuidv7 = (Y) => b.check(_uuidv7(ZodUUID, Y)), b.nanoid = (Y) => b.check(_nanoid(ZodNanoID, Y)), b.guid = (Y) => b.check(_guid(ZodGUID, Y)), b.cuid = (Y) => b.check(_cuid(ZodCUID, Y)), b.cuid2 = (Y) => b.check(_cuid2(ZodCUID2, Y)), b.ulid = (Y) => b.check(_ulid(ZodULID, Y)), b.base64 = (Y) => b.check(_base64(ZodBase64, Y)), b.base64url = (Y) => b.check(_base64url(ZodBase64URL, Y)), b.xid = (Y) => b.check(_xid(ZodXID, Y)), b.ksuid = (Y) => b.check(_ksuid(ZodKSUID, Y)), b.ipv4 = (Y) => b.check(_ipv4(ZodIPv4, Y)), b.ipv6 = (Y) => b.check(_ipv6(ZodIPv6, Y)), b.cidrv4 = (Y) => b.check(_cidrv4(ZodCIDRv4, Y)), b.cidrv6 = (Y) => b.check(_cidrv6(ZodCIDRv6, Y)), b.e164 = (Y) => b.check(_e164(ZodE164, Y)), b.datetime = (Y) => b.check(datetime(Y)), b.date = (Y) => b.check(date(Y)), b.time = (Y) => b.check(time(Y)), b.duration = (Y) => b.check(duration(Y));
});
function string(b) {
	return _string(ZodString, b);
}
const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (b, Y) => {
	$ZodStringFormat.init(b, Y), _ZodString.init(b, Y);
}), ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (b, Y) => {
	$ZodEmail.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (b, Y) => {
	$ZodGUID.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (b, Y) => {
	$ZodUUID.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodURL = /* @__PURE__ */ $constructor("ZodURL", (b, Y) => {
	$ZodURL.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (b, Y) => {
	$ZodEmoji.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (b, Y) => {
	$ZodNanoID.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (b, Y) => {
	$ZodCUID.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (b, Y) => {
	$ZodCUID2.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodULID = /* @__PURE__ */ $constructor("ZodULID", (b, Y) => {
	$ZodULID.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodXID = /* @__PURE__ */ $constructor("ZodXID", (b, Y) => {
	$ZodXID.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (b, Y) => {
	$ZodKSUID.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (b, Y) => {
	$ZodIPv4.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (b, Y) => {
	$ZodIPv6.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (b, Y) => {
	$ZodCIDRv4.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (b, Y) => {
	$ZodCIDRv6.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (b, Y) => {
	$ZodBase64.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (b, Y) => {
	$ZodBase64URL.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (b, Y) => {
	$ZodE164.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (b, Y) => {
	$ZodJWT.init(b, Y), ZodStringFormat.init(b, Y);
}), ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (b, Y) => {
	$ZodNumber.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => numberProcessor(b, Y, X, Z), b.gt = (Y, X) => b.check(_gt(Y, X)), b.gte = (Y, X) => b.check(_gte(Y, X)), b.min = (Y, X) => b.check(_gte(Y, X)), b.lt = (Y, X) => b.check(_lt(Y, X)), b.lte = (Y, X) => b.check(_lte(Y, X)), b.max = (Y, X) => b.check(_lte(Y, X)), b.int = (Y) => b.check(int(Y)), b.safe = (Y) => b.check(int(Y)), b.positive = (Y) => b.check(_gt(0, Y)), b.nonnegative = (Y) => b.check(_gte(0, Y)), b.negative = (Y) => b.check(_lt(0, Y)), b.nonpositive = (Y) => b.check(_lte(0, Y)), b.multipleOf = (Y, X) => b.check(_multipleOf(Y, X)), b.step = (Y, X) => b.check(_multipleOf(Y, X)), b.finite = () => b;
	let X = b._zod.bag;
	b.minValue = Math.max(X.minimum ?? -Infinity, X.exclusiveMinimum ?? -Infinity) ?? null, b.maxValue = Math.min(X.maximum ?? Infinity, X.exclusiveMaximum ?? Infinity) ?? null, b.isInt = (X.format ?? "").includes("int") || Number.isSafeInteger(X.multipleOf ?? .5), b.isFinite = !0, b.format = X.format ?? null;
});
function number(b) {
	return _number(ZodNumber, b);
}
const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (b, Y) => {
	$ZodNumberFormat.init(b, Y), ZodNumber.init(b, Y);
});
function int(b) {
	return _int(ZodNumberFormat, b);
}
const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (b, Y) => {
	$ZodBoolean.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => booleanProcessor(b, Y, X, Z);
});
function boolean(b) {
	return _boolean(ZodBoolean, b);
}
const ZodNull = /* @__PURE__ */ $constructor("ZodNull", (b, Y) => {
	$ZodNull.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => nullProcessor(b, Y, X, Z);
});
function _null(b) {
	return _null$1(ZodNull, b);
}
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (b, Y) => {
	$ZodUnknown.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => unknownProcessor(b, Y, X, Z);
});
function unknown() {
	return _unknown(ZodUnknown);
}
const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (b, Y) => {
	$ZodNever.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => neverProcessor(b, Y, X, Z);
});
function never(b) {
	return _never(ZodNever, b);
}
const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (b, Y) => {
	$ZodArray.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => arrayProcessor(b, Y, X, Z), b.element = Y.element, b.min = (Y, X) => b.check(_minLength(Y, X)), b.nonempty = (Y) => b.check(_minLength(1, Y)), b.max = (Y, X) => b.check(_maxLength(Y, X)), b.length = (Y, X) => b.check(_length(Y, X)), b.unwrap = () => b.element;
});
function array(b, Y) {
	return _array(ZodArray, b, Y);
}
const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (b, Y) => {
	$ZodObjectJIT.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => objectProcessor(b, Y, X, Z), defineLazy(b, "shape", () => Y.shape), b.keyof = () => _enum(Object.keys(b._zod.def.shape)), b.catchall = (Y) => b.clone({
		...b._zod.def,
		catchall: Y
	}), b.passthrough = () => b.clone({
		...b._zod.def,
		catchall: unknown()
	}), b.loose = () => b.clone({
		...b._zod.def,
		catchall: unknown()
	}), b.strict = () => b.clone({
		...b._zod.def,
		catchall: never()
	}), b.strip = () => b.clone({
		...b._zod.def,
		catchall: void 0
	}), b.extend = (Y) => extend(b, Y), b.safeExtend = (Y) => safeExtend(b, Y), b.merge = (Y) => merge(b, Y), b.pick = (Y) => pick(b, Y), b.omit = (Y) => omit(b, Y), b.partial = (...Y) => partial(ZodOptional, b, Y[0]), b.required = (...Y) => required(ZodNonOptional, b, Y[0]);
});
function object(b, Y) {
	return new ZodObject({
		type: "object",
		shape: b ?? {},
		...normalizeParams(Y)
	});
}
function strictObject(b, Y) {
	return new ZodObject({
		type: "object",
		shape: b,
		catchall: never(),
		...normalizeParams(Y)
	});
}
const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (b, Y) => {
	$ZodUnion.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => unionProcessor(b, Y, X, Z), b.options = Y.options;
});
function union(b, Y) {
	return new ZodUnion({
		type: "union",
		options: b,
		...normalizeParams(Y)
	});
}
const ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (b, Y) => {
	ZodUnion.init(b, Y), $ZodDiscriminatedUnion.init(b, Y);
});
function discriminatedUnion(b, Y, X) {
	return new ZodDiscriminatedUnion({
		type: "union",
		options: Y,
		discriminator: b,
		...normalizeParams(X)
	});
}
const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (b, Y) => {
	$ZodIntersection.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => intersectionProcessor(b, Y, X, Z);
});
function intersection(b, Y) {
	return new ZodIntersection({
		type: "intersection",
		left: b,
		right: Y
	});
}
const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (b, Y) => {
	$ZodRecord.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => recordProcessor(b, Y, X, Z), b.keyType = Y.keyType, b.valueType = Y.valueType;
});
function record(b, Y, X) {
	return new ZodRecord({
		type: "record",
		keyType: b,
		valueType: Y,
		...normalizeParams(X)
	});
}
const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (b, Y) => {
	$ZodEnum.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => enumProcessor(b, Y, X, Z), b.enum = Y.entries, b.options = Object.values(Y.entries);
	let X = new Set(Object.keys(Y.entries));
	b.extract = (b, Z) => {
		let Q = {};
		for (let Z of b) if (X.has(Z)) Q[Z] = Y.entries[Z];
		else throw Error(`Key ${Z} not found in enum`);
		return new ZodEnum({
			...Y,
			checks: [],
			...normalizeParams(Z),
			entries: Q
		});
	}, b.exclude = (b, Z) => {
		let Q = { ...Y.entries };
		for (let Y of b) if (X.has(Y)) delete Q[Y];
		else throw Error(`Key ${Y} not found in enum`);
		return new ZodEnum({
			...Y,
			checks: [],
			...normalizeParams(Z),
			entries: Q
		});
	};
});
function _enum(b, Y) {
	return new ZodEnum({
		type: "enum",
		entries: Array.isArray(b) ? Object.fromEntries(b.map((b) => [b, b])) : b,
		...normalizeParams(Y)
	});
}
const ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (b, Y) => {
	$ZodLiteral.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => literalProcessor(b, Y, X, Z), b.values = new Set(Y.values), Object.defineProperty(b, "value", { get() {
		if (Y.values.length > 1) throw Error("This schema contains multiple valid literal values. Use `.values` instead.");
		return Y.values[0];
	} });
});
function literal(b, Y) {
	return new ZodLiteral({
		type: "literal",
		values: Array.isArray(b) ? b : [b],
		...normalizeParams(Y)
	});
}
const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (Y, X) => {
	$ZodTransform.init(Y, X), ZodType.init(Y, X), Y._zod.processJSONSchema = (b, X, Z) => transformProcessor(Y, b, X, Z), Y._zod.parse = (Z, Q) => {
		if (Q.direction === "backward") throw new $ZodEncodeError(Y.constructor.name);
		Z.addIssue = (b) => {
			if (typeof b == "string") Z.issues.push(issue(b, Z.value, X));
			else {
				let X = b;
				X.fatal && (X.continue = !1), X.code ??= "custom", X.input ??= Z.value, X.inst ??= Y, Z.issues.push(issue(X));
			}
		};
		let $ = X.transform(Z.value, Z);
		return $ instanceof Promise ? $.then((b) => (Z.value = b, Z)) : (Z.value = $, Z);
	};
});
function transform(b) {
	return new ZodTransform({
		type: "transform",
		transform: b
	});
}
const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (b, Y) => {
	$ZodOptional.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => optionalProcessor(b, Y, X, Z), b.unwrap = () => b._zod.def.innerType;
});
function optional(b) {
	return new ZodOptional({
		type: "optional",
		innerType: b
	});
}
const ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (b, Y) => {
	$ZodExactOptional.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => optionalProcessor(b, Y, X, Z), b.unwrap = () => b._zod.def.innerType;
});
function exactOptional(b) {
	return new ZodExactOptional({
		type: "optional",
		innerType: b
	});
}
const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (b, Y) => {
	$ZodNullable.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => nullableProcessor(b, Y, X, Z), b.unwrap = () => b._zod.def.innerType;
});
function nullable(b) {
	return new ZodNullable({
		type: "nullable",
		innerType: b
	});
}
const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (b, Y) => {
	$ZodDefault.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => defaultProcessor(b, Y, X, Z), b.unwrap = () => b._zod.def.innerType, b.removeDefault = b.unwrap;
});
function _default(b, Y) {
	return new ZodDefault({
		type: "default",
		innerType: b,
		get defaultValue() {
			return typeof Y == "function" ? Y() : shallowClone(Y);
		}
	});
}
const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (b, Y) => {
	$ZodPrefault.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => prefaultProcessor(b, Y, X, Z), b.unwrap = () => b._zod.def.innerType;
});
function prefault(b, Y) {
	return new ZodPrefault({
		type: "prefault",
		innerType: b,
		get defaultValue() {
			return typeof Y == "function" ? Y() : shallowClone(Y);
		}
	});
}
const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (b, Y) => {
	$ZodNonOptional.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => nonoptionalProcessor(b, Y, X, Z), b.unwrap = () => b._zod.def.innerType;
});
function nonoptional(b, Y) {
	return new ZodNonOptional({
		type: "nonoptional",
		innerType: b,
		...normalizeParams(Y)
	});
}
const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (b, Y) => {
	$ZodCatch.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => catchProcessor(b, Y, X, Z), b.unwrap = () => b._zod.def.innerType, b.removeCatch = b.unwrap;
});
function _catch(b, Y) {
	return new ZodCatch({
		type: "catch",
		innerType: b,
		catchValue: typeof Y == "function" ? Y : () => Y
	});
}
const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (b, Y) => {
	$ZodPipe.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => pipeProcessor(b, Y, X, Z), b.in = Y.in, b.out = Y.out;
});
function pipe(b, Y) {
	return new ZodPipe({
		type: "pipe",
		in: b,
		out: Y
	});
}
const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (b, Y) => {
	$ZodReadonly.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => readonlyProcessor(b, Y, X, Z), b.unwrap = () => b._zod.def.innerType;
});
function readonly(b) {
	return new ZodReadonly({
		type: "readonly",
		innerType: b
	});
}
const ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (b, Y) => {
	$ZodLazy.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => lazyProcessor(b, Y, X, Z), b.unwrap = () => b._zod.def.getter();
});
function lazy(b) {
	return new ZodLazy({
		type: "lazy",
		getter: b
	});
}
const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (b, Y) => {
	$ZodCustom.init(b, Y), ZodType.init(b, Y), b._zod.processJSONSchema = (Y, X, Z) => customProcessor(b, Y, X, Z);
});
function custom(b, Y) {
	return _custom(ZodCustom, b ?? (() => !0), Y);
}
function refine(b, Y = {}) {
	return _refine(ZodCustom, b, Y);
}
function superRefine(b) {
	return _superRefine(b);
}
function _instanceof(b, Y = {}) {
	let X = new ZodCustom({
		type: "custom",
		check: "custom",
		fn: (Y) => Y instanceof b,
		abort: !0,
		...normalizeParams(Y)
	});
	return X._zod.bag.Class = b, X._zod.check = (Y) => {
		Y.value instanceof b || Y.issues.push({
			code: "invalid_type",
			expected: b.name,
			input: Y.value,
			inst: X,
			path: [...X._zod.def.path ?? []]
		});
	}, X;
}
export { ZodStringFormat, _enum, _instanceof, _null, array, boolean, custom, discriminatedUnion, lazy, literal, never, number, object, record, strictObject, string, union, unknown };
