import { c as FlowGraphExecutionBlockWithOutSignal } from './KHR_interactivity-BGk_Crki.esm.js';
import { R as RichTypeAny } from './declarationMapper-CyxdrUFP.esm.js';
import { R as RegisterClass } from './index-BvJBnIUK.esm.js';
import './objectModelMapping-BtiDAwYm.esm.js';

/** This file must only contain pure code and pure imports */
/**
 * @experimental
 * A block that pauses an Audio V2 sound. If the sound is already paused, resumes it.
 */
class FlowGraphPauseSoundBlock extends FlowGraphExecutionBlockWithOutSignal {
    /**
     * Constructs a new FlowGraphPauseSoundBlock.
     * @param config - optional configuration for the block
     */
    constructor(config) {
        super(config);
        this.sound = this.registerDataInput("sound", RichTypeAny);
    }
    /**
     * @internal
     */
    _execute(context, _callingSignal) {
        const soundValue = this.sound.getValue(context);
        if (!soundValue) {
            this._reportError(context, "No sound provided");
            this.out._activateSignal(context);
            return;
        }
        if (soundValue.state === 5 /* SoundState.Paused */) {
            soundValue.resume();
        }
        else if (soundValue.state === 2 /* SoundState.Starting */ || soundValue.state === 3 /* SoundState.Started */) {
            soundValue.pause();
        }
        this.out._activateSignal(context);
    }
    /**
     * @returns class name of the block.
     */
    getClassName() {
        return "FlowGraphPauseSoundBlock" /* FlowGraphBlockNames.AudioPauseSound */;
    }
}
let _Registered = false;
/**
 * Register side effects for flowGraphPauseSoundBlock.
 * Safe to call multiple times; only the first call has an effect.
 */
function RegisterFlowGraphPauseSoundBlock() {
    if (_Registered) {
        return;
    }
    _Registered = true;
    RegisterClass("FlowGraphPauseSoundBlock" /* FlowGraphBlockNames.AudioPauseSound */, FlowGraphPauseSoundBlock);
}

/**
 * Re-exports pure implementation and applies runtime side effects.
 * Import flowGraphPauseSoundBlock.pure for tree-shakeable, side-effect-free usage.
 */
RegisterFlowGraphPauseSoundBlock();

export { FlowGraphPauseSoundBlock, RegisterFlowGraphPauseSoundBlock };
//# sourceMappingURL=flowGraphPauseSoundBlock-Bz5bpPd0.esm.js.map
