define(["exports","./emby-apiclient/connectionmanager.js","./common/servicelocator.js","./common/usersettings/usersettings.js","./browser.js","./emby-apiclient/events.js","./common/appsettings.js"],function(_exports,_connectionmanager,_servicelocator,_usersettings,_browser,_events,_appsettings){var themeStyleElement,currentThemeId,currentThemeInfo,currentThemeController;function tryRemove(elem){try{elem.remove()}catch(err){console.log("Error removing child node: "+err)}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var supportsCssVariables=CSS.supports("color","var(--fake-var)");supportsCssVariables||document.documentElement.classList.add("nocssvars");var defaultSettingsThemeIsMainTheme=!supportsCssVariables||_servicelocator.appHost.supports("multiserver");var accentNode,skinManager={loadSkin:function(){return skinManager.setTheme(_usersettings.default.theme())},loadUserSkin:function(options){return skinManager.setTheme(_usersettings.default.theme()).then(function(){(options=options||{}).start?Emby.Page.invokeShortcut(options.start):Emby.Page.goHome()})},getThemes:function(){var defaultTheme="dark",themes=(supportsCssVariables&&_browser.default.electron&&(defaultTheme="blueradiance"),[]),defaultController="./modules/themes/themecontroller.js";return supportsCssVariables&&themes.push({name:"Apple TV",id:"appletv",controller:defaultController}),themes.push({name:"Black",id:"black",isDefault:"black"===defaultTheme,controller:defaultController}),themes.push({name:"Blue Radiance",id:"blueradiance",isDefault:"blueradiance"===defaultTheme,baseThemeId:"darkgradient",controller:defaultController}),themes.push({name:"Dark",id:"dark",isDefault:"dark"===defaultTheme,controller:defaultController}),supportsCssVariables&&(themes.push({name:"Light",id:"light",isSettingsDefault:!defaultSettingsThemeIsMainTheme,controller:defaultController}),themes.push({name:"Superman",id:"superman",baseThemeId:"darkgradient",controller:defaultController})),supportsCssVariables&&themes.push({name:"Windows Media Center",id:"wmc",baseThemeId:"darkgradient",controller:defaultController}),themes},getCurrentThemeId:function(){return currentThemeId},getCurrentThemeInfo:function(){return currentThemeInfo},getCurrentThemeController:function(){return currentThemeController}};function onRegistrationSuccess(){_appsettings.default.set("appthemesregistered","true")}function onRegistrationFailure(){_appsettings.default.set("appthemesregistered","false")}function isRegistered(){return require(["registrationServices"]).then(function(deps){deps[0].validateFeature("themes",{showDialog:!1}).then(onRegistrationSuccess,onRegistrationFailure)}),"false"!==_appsettings.default.get("appthemesregistered")}function setThemeOptionClassname(value,prefix){for(var elem=document.documentElement,classesToRemove=[],i=0,length=elem.classList.length;i