const buildTextValidationRules = (e, t) => {
	let n = {};
	t && (n.required = "This field is required"), e.minLength !== void 0 && (n.minLength = {
		value: e.minLength,
		message: `Minimum length is ${e.minLength} characters`
	}), e.maxLength !== void 0 && (n.maxLength = {
		value: e.maxLength,
		message: `Maximum length is ${e.maxLength} characters`
	});
	let r = e.min ?? e.minimum;
	r !== void 0 && (n.min = {
		value: r,
		message: `Minimum value is ${r}`
	});
	let i = e.max ?? e.maximum;
	return i !== void 0 && (n.max = {
		value: i,
		message: `Maximum value is ${i}`
	}), e.pattern && (n.pattern = {
		value: new RegExp(e.pattern),
		message: "Invalid format"
	}), e.format === "email" && (n.pattern = {
		value: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
		message: "Invalid email address"
	}), e.format === "url" && (n.pattern = {
		value: /^https?:\/\/.+/,
		message: "Invalid URL"
	}), e.format === "phone" && (n.pattern = {
		value: /^[+]?[(]?[0-9]{1,4}[)]?[-\s.]?[(]?[0-9]{1,4}[)]?[-\s.]?[0-9]{1,9}$/,
		message: "Invalid phone number"
	}), e.multipleOf !== void 0 && (n.validate = { multipleOf: (t) => t % e.multipleOf === 0 || `Value must be a multiple of ${e.multipleOf}` }), n;
};
export { buildTextValidationRules };
