"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Field = void 0;
const Element_1 = require("./Element");
class Field extends Element_1.Element_ {
    constructor({ i = [], o = [] }, opt, system, id, key) {
        super({
            i,
            o,
        }, opt, system, id);
        this._ever_played = false;
        this._key = key;
        this.addListener('reset', () => {
            this._ever_played = false;
        });
        this.addListener('play', () => {
            if (!this._ever_played) {
                this._ever_played = true;
                const value = this.initialValue();
                if (value !== undefined) {
                    this._output[this._key].push(value);
                }
            }
        });
    }
    initialValue() {
        return this._input?.[this._key]?.peak() ?? this._defaultState[this._key];
    }
}
exports.Field = Field;
//# sourceMappingURL=Field.js.map