import { defaultProfiler } from "../RenderProfiler.js";

//#region src/preview/rendering/loadImage.ts
/**
* Load an image from a data URI. Returns a Promise that resolves when loaded.
*/
function loadImageFromDataUri(dataUri) {
	const img = new Image();
	const imageLoadStart = performance.now();
	return new Promise((resolve, reject) => {
		img.onload = () => {
			defaultProfiler.addTime("imageLoad", performance.now() - imageLoadStart);
			resolve(img);
		};
		img.onerror = reject;
		img.src = dataUri;
	});
}

//#endregion
export { loadImageFromDataUri };
//# sourceMappingURL=loadImage.js.map