export const THEME_CHANGE_EVENT = 'pterodactyl:theme-change'; type ThemeChangeListener = () => void; const listeners = new Set(); let stopWatching: (() => void) | undefined; let frame: number | undefined; const isStylesheetNode = (node: Node | null): boolean => node instanceof HTMLStyleElement || (node instanceof HTMLLinkElement && node.relList.contains('stylesheet')); const affectsTheme = (mutation: MutationRecord): boolean => { if (mutation.target === document.documentElement) { return mutation.type === 'attributes'; } if (mutation.type === 'childList') { return ( isStylesheetNode(mutation.target) || [...mutation.addedNodes, ...mutation.removedNodes].some((node) => isStylesheetNode(node)) ); } //