"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../../Class/Holder");
const ImageData_1 = require("../../../../../wrap/ImageData");
const _ids_1 = require("../../../../_ids");
class ImageData_ extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['data', 'width', 'height', 'opt'],
            fo: ['image'],
            o: ['done'],
        }, {
            input: {
                data: {
                    ref: true,
                },
            },
            output: {
                image: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_IMAGE_DATA);
    }
    async f({ data, width, height, opt }, done, fail) {
        let imageData;
        try {
            const _data = data.raw();
            imageData = new ImageData(_data, width, height, opt);
        }
        catch (err) {
            fail(err.message);
            return;
        }
        const image = (0, ImageData_1.wrapImageData)(imageData, this.__system);
        done({
            image,
        });
    }
    b() {
        this._output.done.push(true);
    }
}
exports.default = ImageData_;
//# sourceMappingURL=index.js.map