"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 ToBlob extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['body', 'any'],
            fo: ['blob'],
            i: [],
            o: ['done'],
        }, {
            input: {
                body: {
                    ref: true,
                },
            },
            output: {
                blob: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_TO_BLOB);
    }
    async f({ body }, done, fail) {
        let blob_;
        try {
            blob_ = await body.blob();
        }
        catch (err) {
            fail(err.message.toLowerCase());
            return;
        }
        const blob = (0, Blob_1.wrapBlob)(blob_, this.__system);
        done({ blob });
    }
    b() {
        this._output.done.push(true);
    }
}
exports.default = ToBlob;
//# sourceMappingURL=index.js.map