import { isFilesFromHtml, isFilesOnly } from "../../../utils/index.js";
export { uniqueId } from "../../../lodash.js";
export { isImageFile } from "../../../utils/clipboard.js";
export async function getImageDimensions(imgFile) {
    const img = await loadImage(imgFile);
    return { width: img.naturalWidth, height: img.naturalHeight };
}
export async function loadImage(imgFile) {
    return new Promise((resolve, reject) => {
        const img = document.createElement('img');
        img.src = URL.createObjectURL(imgFile);
        img.onload = () => {
            URL.revokeObjectURL(img.src);
            resolve(img);
        };
        img.onerror = (_e, _s, _l, _c, error) => reject(error);
    });
}
export function getTransferFiles(data) {
    if (!data)
        return null;
    if (!isFilesOnly(data) && !isFilesFromHtml(data))
        return null;
    return Array.from(data.files);
}
//# sourceMappingURL=utils.js.map
