"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Semifunctional_1 = require("../../../../../Class/Semifunctional");
const _ids_1 = require("../../../../_ids");
class CreateObjectURI extends Semifunctional_1.Semifunctional {
    constructor(system) {
        super({
            fi: ['blob', 'init'],
            fo: ['url'],
            i: [],
            o: ['done'],
        }, {
            input: {
                blob: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_CREATE_OBJECT_URL);
    }
    async f({ blob, init }, done, fail) {
        const { api: { url: { createObjectURL }, }, } = this.__system;
        let url;
        const _blob = await blob.blob();
        try {
            url = await createObjectURL(_blob);
        }
        catch (err) {
            fail(err.message);
            return;
        }
        done({ url });
    }
    b() {
        this._output.done.push(true);
    }
}
exports.default = CreateObjectURI;
//# sourceMappingURL=index.js.map