import '../../globals.js';
// Copyright 2019-2024, University of Colorado Boulder
/**
 * Property whose value must be a Vector2.
 *
 * @author Sam Reid (PhET Interactive Simulations)
 */
import Property from '../../axon/js/Property.js';
import optionize from '../../phet-core/js/optionize.js';
import dot from './dot.js';
import Vector2 from './Vector2.js';
const VALID_NON_NAN = { isValidValue: (v) => !isNaN(v.x) && !isNaN(v.y), validationMessage: 'Vector2 x/y should not be NaN' };
class Vector2Property extends Property {
    constructor(initialValue, providedOptions) {
        // Fill in superclass options that are controlled by Vector2Property.
        const options = optionize()({
            valueType: Vector2,
            // {Bounds2|null} - Confine the valid area of acceptable Vector2 values to within a Bounds2.
            validBounds: null,
            validators: [],
            // phet-io
            phetioValueType: Vector2.Vector2IO
        }, providedOptions);
        options.validators.push(VALID_NON_NAN);
        options.validBounds && options.validators.push({
            validationMessage: 'Vector2 is not within validBounds',
            isValidValue: v => options.validBounds.containsPoint(v)
        });
        super(initialValue, options);
        this.validBounds = options.validBounds;
    }
}
dot.register('Vector2Property', Vector2Property);
export default Vector2Property;
//# sourceMappingURL=Vector2Property.js.map