const require_rolldown_runtime = require('../../../../../../../../_virtual/rolldown_runtime.js');
const require_ValidationMetadata$1 = require('../../metadata/ValidationMetadata.js');
const require_MetadataStorage$1 = require('../../metadata/MetadataStorage.js');
const require_ValidationTypes$1 = require('../../validation/ValidationTypes.js');
const require_ConstraintMetadata$1 = require('../../metadata/ConstraintMetadata.js');

//#region ../../node_modules/.pnpm/class-validator@0.14.1/node_modules/class-validator/cjs/decorator/common/Validate.js
var require_Validate = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/class-validator@0.14.1/node_modules/class-validator/cjs/decorator/common/Validate.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	const ValidationMetadata_1 = require_ValidationMetadata$1.require_ValidationMetadata();
	const MetadataStorage_1 = require_MetadataStorage$1.require_MetadataStorage();
	const ValidationTypes_1 = require_ValidationTypes$1.require_ValidationTypes();
	const ConstraintMetadata_1 = require_ConstraintMetadata$1.require_ConstraintMetadata();
	/**
	* Registers custom validator class.
	*/
	function ValidatorConstraint(options) {
		return function(target) {
			const isAsync = options && options.async;
			let name = options && options.name ? options.name : "";
			if (!name) {
				name = target.name;
				if (!name) name = name.replace(/\.?([A-Z]+)/g, (x, y) => "_" + y.toLowerCase()).replace(/^_/, "");
			}
			const metadata = new ConstraintMetadata_1.ConstraintMetadata(target, name, isAsync);
			(0, MetadataStorage_1.getMetadataStorage)().addConstraintMetadata(metadata);
		};
	}
	exports.ValidatorConstraint = ValidatorConstraint;
	function Validate(constraintClass, constraintsOrValidationOptions, maybeValidationOptions) {
		return function(object, propertyName) {
			const args = {
				type: ValidationTypes_1.ValidationTypes.CUSTOM_VALIDATION,
				target: object.constructor,
				propertyName,
				constraintCls: constraintClass,
				constraints: Array.isArray(constraintsOrValidationOptions) ? constraintsOrValidationOptions : void 0,
				validationOptions: !Array.isArray(constraintsOrValidationOptions) ? constraintsOrValidationOptions : maybeValidationOptions
			};
			(0, MetadataStorage_1.getMetadataStorage)().addValidationMetadata(new ValidationMetadata_1.ValidationMetadata(args));
		};
	}
	exports.Validate = Validate;
}) });

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