"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get convertQoiToPng () {
        return convertQoiToPng;
    },
    get processThumbnail () {
        return processThumbnail;
    }
});
const _bgcodetypes = require("./bgcode.types");
const _qoidecoder = require("./qoi-decoder");
const _pngencoder = require("./png-encoder");
function convertQoiToPng(qoiBuffer) {
    const decoded = (0, _qoidecoder.decodeQOI)(qoiBuffer);
    return (0, _pngencoder.encodePNG)(decoded.width, decoded.height, decoded.data);
}
function processThumbnail(data, parameters) {
    switch(parameters.format){
        case _bgcodetypes.BgCodeThumbnailFormats.PNG:
            return {
                extension: _bgcodetypes.BgCodeThumbnailFormatExtension[_bgcodetypes.BgCodeThumbnailFormats.PNG],
                data: data
            };
        case _bgcodetypes.BgCodeThumbnailFormats.JPG:
            return {
                extension: _bgcodetypes.BgCodeThumbnailFormatExtension[_bgcodetypes.BgCodeThumbnailFormats.JPG],
                data: data
            };
        case _bgcodetypes.BgCodeThumbnailFormats.QOI:
            const pngData = convertQoiToPng(data);
            return {
                extension: _bgcodetypes.BgCodeThumbnailFormatExtension[_bgcodetypes.BgCodeThumbnailFormats.PNG],
                data: pngData,
                converted: true
            };
        default:
            throw new Error(`Unsupported thumbnail format: ${parameters.format}`);
    }
}

//# sourceMappingURL=bgcode-thumbnail.parser.js.map