import { ConvertImageWithImageMagickBrowserInputModel, ConvertImageWithImageMagickBrowserOutputModel, } from '../../../../../code/type/index.js';
import { buildFormDataRequestToConvert } from '../../shared.js';
import { resolveWorkFileAsBlob } from '../../../../../code/tool/shared/work.js';
import kink from '../../../../../code/tool/shared/kink.js';
export async function convertImageWithImageMagickBrowser(source) {
    const input = ConvertImageWithImageMagickBrowserInputModel.parse(source);
    switch (input.handle) {
        case 'remote':
            return await convertImageWithImageMagickBrowserRemote(input);
        default:
            return await convertImageWithImageMagickBrowserLocal(input);
    }
}
export async function convertImageWithImageMagickBrowserRemote(input) {
    const request = buildFormDataRequestToConvert(input);
    const content = await resolveWorkFileAsBlob(request);
    return ConvertImageWithImageMagickBrowserOutputModel.parse({
        file: {
            content,
        },
    });
}
export async function convertImageWithImageMagickBrowserLocal(input) {
    throw kink('task_not_implemented', {
        task: 'convertImageWithImageMagickBrowserLocal',
    });
}
//# sourceMappingURL=browser.js.map