import _ from 'lodash';
import '../../globals.js';
import optionize from '../../phet-core/js/optionize.js';
import BackButton from '../../scenery-phet/js/buttons/BackButton.js';
import StatusBar from '../../scenery-phet/js/StatusBar.js';
import { HBox } from '../../scenery/js/imports.js';
import ScoreDisplayNumberAndStar from './ScoreDisplayNumberAndStar.js';
import vegas from './vegas.js';
export default class InfiniteStatusBar extends StatusBar {
    /**
     * @param layoutBounds - layoutBounds of the ScreenView
     * @param visibleBoundsProperty - visible bounds of the ScreenView
     * @param messageNode - to the right of the back button, typically Text
     * @param scoreProperty
     * @param providedOptions
     */
    constructor(layoutBounds, visibleBoundsProperty, messageNode, scoreProperty, providedOptions) {
        const options = optionize()({
            // SelfOptions
            backButtonListener: _.noop,
            xMargin: 20,
            yMargin: 10,
            spacing: 10,
            createScoreDisplay: scoreProperty => new ScoreDisplayNumberAndStar(scoreProperty)
        }, providedOptions);
        // button that typically takes us back to the level-selection UI
        const backButton = new BackButton({
            listener: options.backButtonListener,
            xMargin: 8,
            yMargin: 10,
            tandem: options.tandem?.createTandem('backButton')
        });
        // Nodes on the left end of the bar
        const leftNodes = new HBox({
            spacing: options.spacing,
            align: 'center',
            children: [backButton, messageNode],
            maxWidth: 0.7 * layoutBounds.width
        });
        // Create the score display.
        const scoreDisplay = options.createScoreDisplay(scoreProperty);
        scoreDisplay.maxWidth = 0.2 * layoutBounds.width;
        options.children = [leftNodes, scoreDisplay];
        options.barHeight = Math.max(leftNodes.height, scoreDisplay.height) + (2 * options.yMargin);
        super(layoutBounds, visibleBoundsProperty, options);
        // Position components on the bar.
        this.positioningBoundsProperty.link(positioningBounds => {
            leftNodes.left = positioningBounds.left;
            leftNodes.centerY = positioningBounds.centerY;
            scoreDisplay.right = positioningBounds.right;
            scoreDisplay.centerY = positioningBounds.centerY;
        });
        // Keep the score right justified.
        scoreDisplay.localBoundsProperty.link(() => {
            scoreDisplay.right = this.positioningBoundsProperty.value.right;
        });
        this.disposeInfiniteStatusBar = () => {
            scoreDisplay.dispose();
        };
    }
    dispose() {
        this.disposeInfiniteStatusBar();
        super.dispose();
    }
}
vegas.register('InfiniteStatusBar', InfiniteStatusBar);
//# sourceMappingURL=InfiniteStatusBar.js.map