//#region ../react-intlayer/dist/esm/client/useLoadDynamic.mjs
const createSuspender = (promise) => {
	let status = "pending";
	let result;
	const suspender = promise.then((r) => {
		status = "success";
		result = r;
	}, (e) => {
		status = "error";
		result = e;
	});
	return { read() {
		if (status === "pending") throw suspender;
		if (status === "error") throw result;
		return result;
	} };
};
const cache = /* @__PURE__ */ new Map();
const useLoadDynamic = (key, promise) => {
	if (!cache.has(key)) cache.set(key, createSuspender(promise));
	return cache.get(key).read();
};

//#endregion
export { useLoadDynamic };
//# sourceMappingURL=useLoadDynamic.mjs.map