function waitForWindow(): Promise<Window> {
return new Promise((resolve) => {
if (typeof window !== 'undefined') {
resolve(window);
} else {
const intervalId = setInterval(() => {
clearInterval(intervalId);
}
}, 100);
});