import '../../globals.js';
// Copyright 2018-2024, University of Colorado Boulder
/**
 * ElapsedTimeNode shows the elapsed time in a game status bar (FiniteStatusBar).
 *
 * @author Chris Malley (PixelZoom, Inc.)
 */
import Multilink from '../../axon/js/Multilink.js';
import optionize from '../../phet-core/js/optionize.js';
import SimpleClockIcon from '../../scenery-phet/js/SimpleClockIcon.js';
import StatusBar from '../../scenery-phet/js/StatusBar.js';
import { HBox, Text } from '../../scenery/js/imports.js';
import GameTimer from './GameTimer.js';
import vegas from './vegas.js';
import VegasStrings from './VegasStrings.js';
export default class ElapsedTimeNode extends HBox {
    constructor(elapsedTimeProperty, providedOptions) {
        const options = optionize()({
            // SelfOptions
            clockIconRadius: 15,
            font: StatusBar.DEFAULT_FONT,
            textFill: 'black',
            // HBoxOptions
            spacing: 8
        }, providedOptions);
        const clockIcon = new SimpleClockIcon(options.clockIconRadius);
        const timeValue = new Text('', {
            font: options.font,
            fill: options.textFill
        });
        options.children = [clockIcon, timeValue];
        super(options);
        // Update the time display.
        const multilink = new Multilink([
            elapsedTimeProperty,
            // Dynamic strings used by GameTimer.formatTime
            VegasStrings.pattern['0hours']['1minutes']['2secondsStringProperty'],
            VegasStrings.pattern['0minutes']['1secondsStringProperty']
        ], (elapsedTime, pattern1, pattern2) => {
            timeValue.string = GameTimer.formatTime(elapsedTime);
        });
        this.disposeElapsedTimeNode = () => {
            multilink.dispose();
        };
    }
    dispose() {
        this.disposeElapsedTimeNode();
        super.dispose();
    }
}
vegas.register('ElapsedTimeNode', ElapsedTimeNode);
//# sourceMappingURL=ElapsedTimeNode.js.map