"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../../Class/Holder");
const Async_1 = require("../../../../../types/interface/async/Async");
const weakMerge_1 = require("../../../../../weakMerge");
const System_1 = require("../../../../../wrap/System");
const _ids_1 = require("../../../../_ids");
class Boot extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['init'],
            fo: ['system'],
            i: [],
            o: [],
        }, {
            output: {
                system: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_BOOT);
    }
    f({ init }, done) {
        const _system = this.__system.boot({
            ...init,
            specs: (0, weakMerge_1.weakMerge)(this.__system.specs, init.specs ?? {}),
            classes: this.__system.classes,
            components: this.__system.components,
        });
        this._system = _system;
        const system_ = (0, System_1.wrapSystem)(_system, this.__system);
        const system = (0, Async_1.Async)(system_, ['S'], this.__system.async);
        done({
            system,
        });
    }
    d() {
        if (this._system) {
            this._system = undefined;
        }
    }
}
exports.default = Boot;
//# sourceMappingURL=index.js.map