"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../../Class/Holder");
const _ids_1 = require("../../../../_ids");
class ToImageUrl extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['canvas', 'quality', 'type'],
            fo: ['url'],
        }, {
            input: {
                canvas: {
                    ref: true,
                },
            },
            output: {
                url: {},
            },
        }, system, _ids_1.ID_TO_DATA_URL);
    }
    async f({ canvas, quality, type }, done) {
        let _url;
        try {
            _url = await canvas.toDataUrl(type, quality);
        }
        catch (err) {
            done(undefined, err.message);
            return;
        }
        done({
            url: _url,
        });
    }
}
exports.default = ToImageUrl;
//# sourceMappingURL=index.js.map