"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../Class/Holder");
const Blob_1 = require("../../../../wrap/Blob");
const _ids_1 = require("../../../_ids");
class Blob_ extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['parts', 'opt'],
            fo: ['blob'],
            i: [],
            o: [],
        }, {
            input: {
                parts: {
                    ref: true,
                },
            },
            output: {
                blob: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_TO_BLOB, 'done');
    }
    async f({ parts, opt }, done, fail) {
        let _blob;
        const parts_ = await parts.raw();
        try {
            _blob = new Blob(parts_, opt);
        }
        catch (err) {
            fail(err.message);
            return;
        }
        const blob = (0, Blob_1.wrapBlob)(_blob, this.__system);
        done({
            blob,
        });
    }
}
exports.default = Blob_;
//# sourceMappingURL=index.js.map