// Config Manager - Main orchestrator for modular config system if (typeof window.ConfigManager === 'undefined') { //console.log('ConfigManager: Defining new ConfigManager class...'); class ConfigManager { constructor() { this.core = new ConfigCore(); this.domainManager = new DomainManager(); this.whitelistManager = new IPWhitelistManager(); this.renderer = new ConfigRenderer(); this.sidebar = new ConfigSidebar(); this.form = new ConfigForm(); this.utils = new ConfigUtils(); // Expose IPWhitelistManager globally for wrapper functions window.IPWhitelistManager = this.whitelistManager; } async renderConfig(category) { //console.log('ConfigManager: Rendering ' + category + ' config...'); const configSection = document.getElementById('config-section'); if (!configSection) { console.error('ConfigManager: config-section element not found'); return; } // The sidebar and page headers read window.configData. Load it up front so // populateSidebar() has categories on a cold admin visit (e.g. straight // from the dashboard); otherwise the overview/tools branches below render // an empty sidebar until something else populates configData. Cached after // the first call, so the config-category path below is a cache hit. try { await this.core.loadConfig(category); } catch (e) {} // Tool controllers are loaded on demand — they're not in index.html's // initial