import { issue, normalizeParams, slugify } from "./util.js";
import { $ZodCheck, $ZodCheckEndsWith, $ZodCheckGreaterThan, $ZodCheckIncludes, $ZodCheckLengthEquals, $ZodCheckLessThan, $ZodCheckLowerCase, $ZodCheckMaxLength, $ZodCheckMinLength, $ZodCheckMultipleOf, $ZodCheckOverwrite, $ZodCheckRegex, $ZodCheckStartsWith, $ZodCheckUpperCase } from "./checks.js";
import { globalRegistry } from "./registries.js";
/* @__NO_SIDE_EFFECTS__ */
function _string(x, Z) {
	return new x({
		type: "string",
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _email(x, Z) {
	return new x({
		type: "string",
		format: "email",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _guid(x, Z) {
	return new x({
		type: "string",
		format: "guid",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _uuid(x, Z) {
	return new x({
		type: "string",
		format: "uuid",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _uuidv4(x, Z) {
	return new x({
		type: "string",
		format: "uuid",
		check: "string_format",
		abort: !1,
		version: "v4",
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _uuidv6(x, Z) {
	return new x({
		type: "string",
		format: "uuid",
		check: "string_format",
		abort: !1,
		version: "v6",
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _uuidv7(x, Z) {
	return new x({
		type: "string",
		format: "uuid",
		check: "string_format",
		abort: !1,
		version: "v7",
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _url(x, Z) {
	return new x({
		type: "string",
		format: "url",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _emoji(x, Z) {
	return new x({
		type: "string",
		format: "emoji",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _nanoid(x, Z) {
	return new x({
		type: "string",
		format: "nanoid",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _cuid(x, Z) {
	return new x({
		type: "string",
		format: "cuid",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _cuid2(x, Z) {
	return new x({
		type: "string",
		format: "cuid2",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _ulid(x, Z) {
	return new x({
		type: "string",
		format: "ulid",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _xid(x, Z) {
	return new x({
		type: "string",
		format: "xid",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _ksuid(x, Z) {
	return new x({
		type: "string",
		format: "ksuid",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _ipv4(x, Z) {
	return new x({
		type: "string",
		format: "ipv4",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _ipv6(x, Z) {
	return new x({
		type: "string",
		format: "ipv6",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _cidrv4(x, Z) {
	return new x({
		type: "string",
		format: "cidrv4",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _cidrv6(x, Z) {
	return new x({
		type: "string",
		format: "cidrv6",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _base64(x, Z) {
	return new x({
		type: "string",
		format: "base64",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _base64url(x, Z) {
	return new x({
		type: "string",
		format: "base64url",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _e164(x, Z) {
	return new x({
		type: "string",
		format: "e164",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _jwt(x, Z) {
	return new x({
		type: "string",
		format: "jwt",
		check: "string_format",
		abort: !1,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _isoDateTime(x, Z) {
	return new x({
		type: "string",
		format: "datetime",
		check: "string_format",
		offset: !1,
		local: !1,
		precision: null,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _isoDate(x, Z) {
	return new x({
		type: "string",
		format: "date",
		check: "string_format",
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _isoTime(x, Z) {
	return new x({
		type: "string",
		format: "time",
		check: "string_format",
		precision: null,
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _isoDuration(x, Z) {
	return new x({
		type: "string",
		format: "duration",
		check: "string_format",
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _number(x, Z) {
	return new x({
		type: "number",
		checks: [],
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _int(x, Z) {
	return new x({
		type: "number",
		check: "number_format",
		abort: !1,
		format: "safeint",
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _boolean(x, Z) {
	return new x({
		type: "boolean",
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _null(x, Z) {
	return new x({
		type: "null",
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _unknown(x) {
	return new x({ type: "unknown" });
}
/* @__NO_SIDE_EFFECTS__ */
function _never(x, Z) {
	return new x({
		type: "never",
		...normalizeParams(Z)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _lt(x, Z) {
	return new $ZodCheckLessThan({
		check: "less_than",
		...normalizeParams(Z),
		value: x,
		inclusive: !1
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _lte(x, Z) {
	return new $ZodCheckLessThan({
		check: "less_than",
		...normalizeParams(Z),
		value: x,
		inclusive: !0
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _gt(x, Z) {
	return new $ZodCheckGreaterThan({
		check: "greater_than",
		...normalizeParams(Z),
		value: x,
		inclusive: !1
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _gte(x, Z) {
	return new $ZodCheckGreaterThan({
		check: "greater_than",
		...normalizeParams(Z),
		value: x,
		inclusive: !0
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _multipleOf(x, Z) {
	return new $ZodCheckMultipleOf({
		check: "multiple_of",
		...normalizeParams(Z),
		value: x
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _maxLength(x, Z) {
	return new $ZodCheckMaxLength({
		check: "max_length",
		...normalizeParams(Z),
		maximum: x
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _minLength(x, Z) {
	return new $ZodCheckMinLength({
		check: "min_length",
		...normalizeParams(Z),
		minimum: x
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _length(x, Z) {
	return new $ZodCheckLengthEquals({
		check: "length_equals",
		...normalizeParams(Z),
		length: x
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _regex(x, Z) {
	return new $ZodCheckRegex({
		check: "string_format",
		format: "regex",
		...normalizeParams(Z),
		pattern: x
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _lowercase(x) {
	return new $ZodCheckLowerCase({
		check: "string_format",
		format: "lowercase",
		...normalizeParams(x)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _uppercase(x) {
	return new $ZodCheckUpperCase({
		check: "string_format",
		format: "uppercase",
		...normalizeParams(x)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _includes(x, Z) {
	return new $ZodCheckIncludes({
		check: "string_format",
		format: "includes",
		...normalizeParams(Z),
		includes: x
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _startsWith(x, Z) {
	return new $ZodCheckStartsWith({
		check: "string_format",
		format: "starts_with",
		...normalizeParams(Z),
		prefix: x
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _endsWith(x, Z) {
	return new $ZodCheckEndsWith({
		check: "string_format",
		format: "ends_with",
		...normalizeParams(Z),
		suffix: x
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _overwrite(x) {
	return new $ZodCheckOverwrite({
		check: "overwrite",
		tx: x
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _normalize(x) {
	return /* @__PURE__ */ _overwrite((X) => X.normalize(x));
}
/* @__NO_SIDE_EFFECTS__ */
function _trim() {
	return /* @__PURE__ */ _overwrite((x) => x.trim());
}
/* @__NO_SIDE_EFFECTS__ */
function _toLowerCase() {
	return /* @__PURE__ */ _overwrite((x) => x.toLowerCase());
}
/* @__NO_SIDE_EFFECTS__ */
function _toUpperCase() {
	return /* @__PURE__ */ _overwrite((x) => x.toUpperCase());
}
/* @__NO_SIDE_EFFECTS__ */
function _slugify() {
	return /* @__PURE__ */ _overwrite((x) => slugify(x));
}
/* @__NO_SIDE_EFFECTS__ */
function _array(x, Z, Q) {
	return new x({
		type: "array",
		element: Z,
		...normalizeParams(Q)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _custom(x, Z, Q) {
	let $ = normalizeParams(Q);
	return $.abort ??= !0, new x({
		type: "custom",
		check: "custom",
		fn: Z,
		...$
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _refine(x, Z, Q) {
	return new x({
		type: "custom",
		check: "custom",
		fn: Z,
		...normalizeParams(Q)
	});
}
/* @__NO_SIDE_EFFECTS__ */
function _superRefine(X) {
	let Z = /* @__PURE__ */ _check((Q) => (Q.addIssue = (X) => {
		if (typeof X == "string") Q.issues.push(issue(X, Q.value, Z._zod.def));
		else {
			let $ = X;
			$.fatal && ($.continue = !1), $.code ??= "custom", $.input ??= Q.value, $.inst ??= Z, $.continue ??= !Z._zod.def.abort, Q.issues.push(issue($));
		}
	}, X(Q.value, Q)));
	return Z;
}
/* @__NO_SIDE_EFFECTS__ */
function _check(x, Z) {
	let $ = new $ZodCheck({
		check: "custom",
		...normalizeParams(Z)
	});
	return $._zod.check = x, $;
}
/* @__NO_SIDE_EFFECTS__ */
function describe(x) {
	let X = new $ZodCheck({ check: "describe" });
	return X._zod.onattach = [(X) => {
		let Z = globalRegistry.get(X) ?? {};
		globalRegistry.add(X, {
			...Z,
			description: x
		});
	}], X._zod.check = () => {}, X;
}
/* @__NO_SIDE_EFFECTS__ */
function meta(x) {
	let X = new $ZodCheck({ check: "meta" });
	return X._zod.onattach = [(X) => {
		let Z = globalRegistry.get(X) ?? {};
		globalRegistry.add(X, {
			...Z,
			...x
		});
	}], X._zod.check = () => {}, X;
}
export { _array, _base64, _base64url, _boolean, _cidrv4, _cidrv6, _cuid, _cuid2, _custom, _e164, _email, _emoji, _endsWith, _gt, _gte, _guid, _includes, _int, _ipv4, _ipv6, _isoDate, _isoDateTime, _isoDuration, _isoTime, _jwt, _ksuid, _length, _lowercase, _lt, _lte, _maxLength, _minLength, _multipleOf, _nanoid, _never, _normalize, _null, _number, _overwrite, _refine, _regex, _slugify, _startsWith, _string, _superRefine, _toLowerCase, _toUpperCase, _trim, _ulid, _unknown, _uppercase, _url, _uuid, _uuidv4, _uuidv6, _uuidv7, _xid, describe, meta };
