const require_rolldown_runtime = require('../../../../../../../_virtual/rolldown_runtime.js');

//#region ../../node_modules/.pnpm/class-validator@0.14.1/node_modules/class-validator/cjs/validation/ValidationUtils.js
var require_ValidationUtils = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/class-validator@0.14.1/node_modules/class-validator/cjs/validation/ValidationUtils.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	/**
	* Convert the constraint to a string to be shown in an error
	*/
	function constraintToString(constraint) {
		if (Array.isArray(constraint)) return constraint.join(", ");
		if (typeof constraint === "symbol") constraint = constraint.description;
		return `${constraint}`;
	}
	exports.constraintToString = constraintToString;
	var ValidationUtils = class {
		static replaceMessageSpecialTokens(message, validationArguments) {
			let messageString;
			if (message instanceof Function) messageString = message(validationArguments);
			else if (typeof message === "string") messageString = message;
			if (messageString && Array.isArray(validationArguments.constraints)) validationArguments.constraints.forEach((constraint, index) => {
				messageString = messageString.replace(new RegExp(`\\$constraint${index + 1}`, "g"), constraintToString(constraint));
			});
			if (messageString && validationArguments.value !== void 0 && validationArguments.value !== null && [
				"string",
				"boolean",
				"number"
			].includes(typeof validationArguments.value)) messageString = messageString.replace(/\$value/g, validationArguments.value);
			if (messageString) messageString = messageString.replace(/\$property/g, validationArguments.property);
			if (messageString) messageString = messageString.replace(/\$target/g, validationArguments.targetName);
			return messageString;
		}
	};
	exports.ValidationUtils = ValidationUtils;
}) });

//#endregion
Object.defineProperty(exports, 'default', {
  enumerable: true,
  get: function () {
    return require_ValidationUtils();
  }
});