import '../../../tandem/js/PhetioIDUtils.js';
import '../../../globals.js';
// Copyright 2024, University of Colorado Boulder
/**
 * The GatedVisibleProperty class abstracts the process of creating a "gated" visibility Property
 * designed for PhET-iO integration. This pattern comes in handy when an object's visibility is already controlled
 * within the simulation, but there is a need to grant additional visibility control to an external entity,
 * such as a studio or a PhET-iO client.
 *
 * @author Marla Schulz (PhET Interactive Simulations)
 * @author Michael Kauzmann (PhET Interactive Simulations)
 */
import BooleanProperty from '../../../axon/js/BooleanProperty.js';
import { DerivedProperty2 } from '../../../axon/js/DerivedProperty.js';
import optionize from '../../../phet-core/js/optionize.js';
import BooleanIO from '../../../tandem/js/types/BooleanIO.js';
import { scenery } from '../imports.js';
class GatedVisibleProperty extends DerivedProperty2 {
    constructor(providedVisibleProperty, parentTandem, providedOptions) {
        const options = optionize()({
            selfVisibleInitiallyVisible: true,
            selfVisiblePropertyOptions: {
                tandem: parentTandem.createTandem('selfVisibleProperty'),
                phetioFeatured: true,
                phetioDocumentation: 'Provides an additional way to toggle the visibility for the PhET-iO Element.'
            },
            tandem: parentTandem.createTandem('visibleProperty'),
            phetioValueType: BooleanIO
            // see below for phetioDocumentation
        }, providedOptions);
        const selfVisibleProperty = new BooleanProperty(options.selfVisibleInitiallyVisible, options.selfVisiblePropertyOptions);
        if (!options.phetioDocumentation) {
            options.phetioDocumentation = `Whether the PhET-iO Element is visible, see ${selfVisibleProperty.tandem.name} for customization.`;
        }
        super([providedVisibleProperty, selfVisibleProperty], (providedVisible, selfVisible) => providedVisible && selfVisible, options);
        this.selfVisibleProperty = selfVisibleProperty;
    }
    dispose() {
        // Remove the selfVisibleProperty from the PhET-iO registry
        this.selfVisibleProperty.dispose();
        super.dispose();
    }
}
export default GatedVisibleProperty;
scenery.register('GatedVisibleProperty', GatedVisibleProperty);
//# sourceMappingURL=GatedVisibleProperty.js.map