{"version":3,"sources":["theme-manager.ts"],"sourcesContent":["import { client_type } from \"datex-core-legacy/utils/constants.ts\";\nimport { UIX_COOKIE, getCookie, setCookie } from \"../session/cookies.ts\";\nimport { Logger } from \"datex-core-legacy/utils/logger.ts\";\nimport { getCallerDir } from \"datex-core-legacy/utils/caller_metadata.ts\";\nimport { Path } from \"datex-core-legacy/utils/path.ts\";\nimport { uixLight } from \"../themes/uix-light.ts\";\nimport { uixDark } from \"../themes/uix-dark.ts\";\nimport { uixLightPlain } from \"../themes/uix-light-plain.ts\";\nimport { uixDarkPlain } from \"../themes/uix-dark-plain.ts\";\n\nconst logger = new Logger(\"uix theme\");\n\nexport interface Theme {\n\t/**\n\t * Unique name for the theme\n\t */\n\tname: string,\n\t/**\n\t * Mode of the theme, if not set, the theme is used for both dark and light mode\n\t */\n\tmode?: \"light\" | \"dark\",\n\t/**\n\t * Css variables for the theme\n\t */\n\tvalues?: Record<string, string>,\n\t/**\n\t * List of stylesheets to use when theme is activated\n\t */\n\tstylesheets?: Readonly<(URL|string)[]>,\n\t/**\n\t * Scripts that are executed when theme is activated\n\t */\n\tscripts?: Readonly<(URL|string)[]>,\n\t/**\n\t * Color used as theme-color when the theme is active\n\t */\n\tappColor?: string,\n\t/**\n\t * Called when theme is activated\n\t */\n\tonActivate?: () => void|Promise<void>,\n\t/**\n\t * Called when theme is deactivated\n\t */\n\tonDeactivate?: () => void|Promise<void>\n\t/**\n\t * Called when theme is registered\n\t */\n\tonRegister?: () => void|Promise<void>\n}\n\ntype themeName = \"uix-dark\" | \"uix-dark-plain\" | \"uix-light\" | \"uix-light-plain\" | (string&{});\ntype darkThemeName = \"uix-dark\" | \"uix-dark-plain\" | (string&{});\ntype lightThemeName = \"uix-light\" | \"uix-light-plain\" | (string&{});\n\nclass ThemeManager  {\n\n\t#loadedThemes = new Map<string, Theme>()\n\n\t#values:{[key:string]:string} = {}\n\n\t#auto_mode = true\n\t#current_mode!: \"dark\"|\"light\"\n\t#current_theme!: string\n\t#waiting_theme?: string;\n\n\t#default_light_theme:Theme = uixLight;\n\t#default_dark_theme:Theme = uixDark;\n\n\treadonly #current_theme_style_sheet = new CSSStyleSheet();\n\t#document_stylesheets_added = false;\n\n\t#themeCustomStylesheets = new Map<string, string[]>()\n\n\t#preferredModeIfThemeAvailable?: \"dark\"|\"light\"\n\n\t#global_style_sheet = new CSSStyleSheet();\n\n\t#themesCSS = new Map<string, string>()\n\n\tget stylesheet() {return this.#global_style_sheet}\n\n\tget mode() {return this.#current_mode} // important!: never reference this.mode inside ThemeManager, getter might be overridden\n\tset mode(name: \"dark\"|\"light\") {this.setMode(name)}\n\tget theme() {return this.#current_theme} // important!: never reference this.theme inside ThemeManager, getter might be overridden\n\tset theme(name: string) {this.setTheme(name)}\n\n\tget defaultDarkTheme() {return this.#default_dark_theme.name}\n\tget defaultLightTheme() {return this.#default_light_theme.name}\n\n\tget values() {return this.#values}\n\n\tget auto_mode() {return this.#auto_mode}\n\tset auto_mode(auto_mode:boolean) {this.#auto_mode = auto_mode}\n\n\tcustomStyleSheets = new Set<string>()\n\n\n\tconstructor() {\n\n\t\t// load themes from embedded style\n\t\tfor (const sheet of document.styleSheets??[]) {\n\t\t\t// themes\n\t\t\tif ((<HTMLStyleElement>sheet.ownerNode)?.classList?.contains(\"uix-themes\")) {\n\t\t\t\tconst themeStylesheets = JSON.parse(decodeURI(sheet.ownerNode.getAttribute(\"data-stylesheets\")??\"{}\"));\n\t\t\t\tthis.addThemeFromParsedStylesheet(sheet, themeStylesheets)\n\t\t\t}\n\t\t}\n\t\t\n\t\t// add default themes if not already loaded from html\n\t\tif (!this.getTheme(uixLightPlain.name, true)) this.registerTheme(uixLightPlain);\n\t\tif (!this.getTheme(uixDarkPlain.name, true)) this.registerTheme(uixDarkPlain);\n\t\tif (!this.getTheme(uixDark.name, true)) this.registerTheme(uixDark);\n\t\tif (!this.getTheme(uixLight.name, true)) this.registerTheme(uixLight);\n\n\t\tconst currentModeCookie = client_type == \"browser\" && (getCookie(UIX_COOKIE.colorMode) || getCookie(UIX_COOKIE.initialColorMode)) as \"dark\"|\"light\";\n\t\tconst currentMode = currentModeCookie || (client_type == \"browser\" ? (globalThis.matchMedia?.(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\") : \"light\");\n\t\t\n\t\tconst currentDarkTheme = client_type == \"browser\" ? (getCookie(UIX_COOKIE.themeDark) ?? \"uix-dark\") : \"uix-dark\";\n\t\tconst currentLightTheme = client_type == \"browser\" ? (getCookie(UIX_COOKIE.themeLight) ?? \"uix-light\") : \"uix-light\";\n\n\t\t// set default themes (set by cookies)\n\t\tif (this.getTheme(currentDarkTheme)) this.setDefaultDarkTheme(this.getTheme(currentDarkTheme)!);\n\t\tif (this.getTheme(currentLightTheme)) this.setDefaultLightTheme(this.getTheme(currentLightTheme)!);\n\n\t\t// set current theme if not a parsed theme\n\t\tif (currentMode == \"dark\" && this.getTheme(currentDarkTheme, true)) {\n\t\t\tthis.setTheme(currentDarkTheme, true);\n\t\t}\n\t\telse if (currentMode == \"light\" && this.getTheme(currentLightTheme, true)) {\n\t\t\tthis.setTheme(currentLightTheme, true);\n\t\t}\n\t\telse {\n\t\t\tthis.#current_mode = currentMode;\n\t\t\tthis.#current_theme = currentMode == \"dark\" ? currentDarkTheme : currentLightTheme;\n\t\t}\n\n\t\t// current server-guessed mode does not match client mode, remember preferred theme to enable if a frontend theme is loaded\n\t\tif (!currentModeCookie && this.getTheme(currentDarkTheme, true)?.mode != currentMode) {\n\t\t\tthis.#preferredModeIfThemeAvailable = currentMode;\n\t\t}\n\n\t\t// watch system theme change\n\t\tif (client_type == \"browser\") {\n\t\t\t(window as any).matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {\n\t\t\t\tif (!this.auto_mode) return;\n\t\t\t\tlogger.debug(\"system color scheme change\")\n\t\t\t\tif (event.matches) this.setMode(\"dark\")\n\t\t\t\telse this.setMode(\"light\");\n\t\t\t\tthis.auto_mode = true;\n\t\t\t})\n\t\t}\n\t}\n\n\tpublic getTheme(name: string, ignoreParsed = false) {\n\t\tconst theme = this.#loadedThemes.get(name)\n\t\tif (ignoreParsed && theme?.parsed) return;\n\t\treturn theme;\n\t}\n\n\t/**\n\t * Register a new theme\n\t * @param theme \n\t * @param useAsDefault use as default theme for dark/light mode\n\t */\n\tpublic registerTheme(theme: Theme) {\n\t\tif (theme.stylesheets) {\n\t\t\tconst dir = getCallerDir();\n\t\t\ttheme.stylesheets = theme.stylesheets.map(\n\t\t\t\ts => new Path(\n\t\t\t\t\ts, \n\t\t\t\t\ts.toString().startsWith(\"/\") && client_type == \"browser\" ? globalThis.location.origin : dir\n\t\t\t\t)\n\t\t\t)\n\t\t}\n\t\tthis.#loadedThemes.set(theme.name, theme);\n\t\tthis.addGlobalThemeClass(theme);\n\t\tthis.#themeCustomStylesheets.set(theme.name, [...this.#normalizeThemeStylesheets(theme)])\n\n\t\tif (theme.onRegister && client_type == \"deno\") theme.onRegister()\n\t}\n\n\t/**\n\t * Changes the mode to dark or light, selecting the current preferred\n\t * or light theme\n\t */\n\tpublic setMode(mode: \"dark\"|\"light\", force_update = false, persist = true) {\n\t\tif (!force_update && this.#current_mode == mode) return;\n\t\telse {\n\t\t\tif (persist) this.#auto_mode = false; // keep theme even if os changes theme\n\t\t\tlogger.debug(\"mode changed to \" + mode);\n\t\t\tthis.#activateTheme(mode == \"dark\" ? this.#default_dark_theme : this.#default_light_theme);\n\t\t}\n\t}\n\n\t/**\n\t * Sets a new theme (must be registered with registerTheem)\n\t */\n\tprivate setTheme(name: themeName, allowLazyLoad = false) {\n\t\tconst theme = this.getTheme(name)\n\t\tif (!theme) {\n\t\t\tif (allowLazyLoad) {\n\t\t\t\tthis.#waiting_theme = name;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse throw new Error(`Cannot set them \"${name}\", not registered`);\n\t\t}\n\t\tthis.#activateTheme(theme);\n\t}\n\n\t\n\t/**\n\t * Activate multiple themes. All previously activated themes\n\t * are disabled.\n\t * \n\t * The current theme is automatically selected\n\t * from the provided themes, depending on the current dark/light mode\n\t * @param themes \n\t */\n\tpublic useThemes(...themes: (themeName|Theme)[]) {\n\t\tlet hasDarkTheme = false;\n\t\tlet hasLightTheme = false;\n\t\tfor (const nameOrTheme of themes) {\n\t\t\tlet name: string;\n\t\t\tif (typeof nameOrTheme == \"object\") {\n\t\t\t\tthis.registerTheme(nameOrTheme);\n\t\t\t\tname = nameOrTheme.name;\n\t\t\t}\n\t\t\telse name = nameOrTheme;\n\n\t\t\tconst theme = this.getTheme(name);\n\t\t\tif (!theme) logger.warn(`Theme ${name} is not a registered theme`);\n\t\t\telse {\n\t\t\t\tif (!hasDarkTheme && (!theme.mode || theme.mode == \"dark\")) {\n\t\t\t\t\thasDarkTheme = true \n\t\t\t\t\tthis.setDefaultDarkTheme(theme);\n\t\t\t\t}\n\t\t\t\tif (!hasLightTheme && (!theme.mode || theme.mode == \"light\")) {\n\t\t\t\t\thasLightTheme = true;\n\t\t\t\t\tthis.setDefaultLightTheme(theme);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\n\t\t// no custom themes found, activate default themes\n\t\tif (!hasDarkTheme) this.setDefaultDarkTheme(uixDark)\n\t\tif (!hasLightTheme) this.setDefaultLightTheme(uixLight)\n\t}\n\n\t/**\n\t * Activate a theme. All previously activated themes\n\t * are disabled.\n\t * @param themes \n\t */\n\tpublic useTheme(theme: themeName|Theme) {\n\t\treturn this.useThemes(theme)\n\t}\n\n\t/**\n\t * Sets a theme as the preferred dark theme\n\t */\n\tprivate setDefaultDarkTheme(theme: Theme) {\n\t\tif (theme.mode && theme.mode !== \"dark\") throw new Error(`Theme \"${theme.name} is not a dark mode theme\"`)\n\n\t\tthis.#default_dark_theme = theme;\n\t\t// theme matches current mode, immediately apply\n\t\tif (!theme.mode || theme.mode == this.#current_mode) this.#activateTheme(theme);\n\t}\n\n\t/**\n\t * Sets a theme as the preferred light theme\n\t */\n\tprivate setDefaultLightTheme(theme: Theme) {\n\t\tif (theme.mode && theme.mode !== \"light\") throw new Error(`Theme \"${theme.name} is not a light mode theme\"`)\n\n\t\tthis.#default_light_theme = theme;\n\t\t// theme matches current mode, immediately apply\n\t\tif (!theme.mode || theme.mode == this.#current_mode) this.#activateTheme(theme);\n\t}\n\n\t#current_theme_css_text = \"\"\n\n\tgetCurrentThemeCSS(){\n\t\treturn this.#current_theme_css_text;\n\t}\n\n\tgetThemesCSS(){\n\t\treturn [...this.#themesCSS.values()].join(\"\\n\");\n\t}\n\n\t/**\n\t * returns css text for a theme, using .theme-xx selector\n\t * @param name theme name\n\t * @param useRootSelector use :root selector instead of .theme-xx selector\n\t * @returns \n\t */\n\tgetThemeCSS(name: string, useRootSelector = false) {\n\t\tconst css = this.#themesCSS.get(name);\n\t\tif (useRootSelector) return css?.replace('.theme-'+name, ':root') \n\t\telse return css;\n\t}\n\n\t/**\n\t * returns a list of stylesheets for a given theme\n\t * @param name\n\t */\n\tgetThemeStylesheets(name: string) {\n\t\treturn this.#themeCustomStylesheets.get(name);\n\t}\n\n\tgetAllStyleSheets() {\n\t\treturn this.#themeCustomStylesheets;\n\t}\n\n\t// update the current theme (changes immediately)\n\t#activateTheme(theme:Theme) {\n\n\t\tif (this.#current_theme == theme.name) return;\n\n\t\t// deactivate previous theme\n\t\tconst currentTheme = this.getTheme(this.#current_theme) \n\t\tif (currentTheme?.onDeactivate) {\n\t\t\ttry {\n\t\t\t\tcurrentTheme.onDeactivate()\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t}\n\n\t\tthis.#current_theme = theme.name;\n\t\tlogger.debug(`using theme \"${theme.name}\"`)\n\n\t\tif (!theme.mode || theme.mode == \"dark\") setCookie(UIX_COOKIE.themeDark, theme.name);\n\t\telse if (!theme.mode || theme.mode == \"light\") setCookie(UIX_COOKIE.themeLight, theme.name);\n\n\t\tif (theme.mode) setCookie(UIX_COOKIE.colorMode, theme.mode);\n\n\t\tlet text = \":root{\";\n\t\t// iterate over all properties (also from inherited prototypes)\n\t\t// TODO only iterate over allowed properties?\n\t\tconst added_properties = new Set();\n\t\tfor (let o = theme.values??{}; o && o != Object.prototype; o = Object.getPrototypeOf(o)) {\n\t\t\tfor (const [key, value] of Object.entries(o)) {\n\t\t\t\tif (added_properties.has(key)) continue;\n\t\t\t\tadded_properties.add(key);\n\t\t\t\tthis.#values[key] = value;\n\t\t\t\ttext += `--${key}: ${value};` // TODO escape?\n\t\t\t}\n\t\t}\n\n\t\ttext += \"}\";\n\t\tthis.#current_theme_css_text = text;\n\n\t\tthis.updateCurrentThemeStyle()\n\n\t\tconst modeChanged = this.#current_mode != (theme.mode ?? \"light\");\n\t\tthis.#current_mode = theme.mode ?? \"light\"; // only now trigger Theme.mode observers\n\t\t// css global color scheme\n\t\tif (client_type === \"browser\") {\n\t\t\tdocument.documentElement.style.colorScheme = theme.mode ?? \"light\";\n\t\t\tdocument.body.dataset.colorScheme = theme.mode ?? \"light\";\n\t\t}\n\n\t\t// stylesheets not available for parsed themes\n\t\t// stylesheets\n\t\tif (theme.stylesheets) {\t\t\t\n\t\t\tthis.#updateCustomStylesheets(this.#normalizeThemeStylesheets(theme))\n\t\t}\n\t\telse this.#clearCustomStyleSheets();\n\n\t\t// theme-color (TODO: only workaround until meta media query is supported in all browsers)\n\t\tif (theme.appColor) {\n\t\t\tif (client_type === \"browser\") document.querySelector(\"meta[name=theme-color]\")?.setAttribute(\"content\", theme.appColor);\n\t\t}\n\n\t\tif (theme.onActivate) {\n\t\t\ttry {\n\t\t\t\ttheme.onActivate()\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t}\n\n\t\t// call theme/mode change listeners\n\t\tif (modeChanged) for (const observer of this.mode_change_observers) observer(this.#current_mode);\n\t\tfor (const observer of this.theme_change_observers) observer(this.#current_theme);\n\t}\n\n\t#normalizeThemeStylesheets(theme: Theme) {\n\t\tconst customStylesheets = new Set<string>()\n\t\tfor (const url of theme.stylesheets??[]) {\n\t\t\tcustomStylesheets.add(new URL(url).toString())\n\t\t}\n\t\treturn customStylesheets;\n\t}\n\n\t#clearCustomStyleSheets(exclude?: Set<string>) {\n\t\tif (client_type == \"browser\") {\n\t\t\tfor (const link of document.head.querySelectorAll('link.custom-theme') as unknown as HTMLElement[]) {\n\t\t\t\tif (exclude?.has(link.href)) continue;\n\t\t\t\tlink.remove();\n\t\t\t}\n\t\t}\n\t\t\n\t\tthis.customStyleSheets.clear();\n\t}\n\n\t#updateCustomStylesheets(customStyleSheets: Set<string>) {\n\t\tif (client_type == \"browser\") {\n\t\t\t// remove stylesheets which are not in the new list\n\t\t\tthis.#clearCustomStyleSheets(customStyleSheets);\n\n\t\t\t// add new stylesheets\n\t\t\tfor (const url of customStyleSheets) {\n\t\t\t\tconst existingLink = document.head.querySelector('link.custom-theme');\n\t\t\t\tif (existingLink?.href == url) continue;\n\t\t\t\tconst stylesheet = document.createElement(\"link\");\n\t\t\t\tstylesheet.classList.add(\"custom-theme\");\n\t\t\t\tstylesheet.rel = \"stylesheet\"\n\t\t\t\tstylesheet.href = url.toString()\n\t\t\t\tdocument.head.append(stylesheet)\n\t\t\t}\n\t\t}\n\t\tthis.customStyleSheets = customStyleSheets;\n\t}\n\n\taddGlobalThemeClass(theme: Theme) {\n\t\tlet text = `.theme-${theme.name} {`;\n\t\t// iterate over all properties (also from inherited prototypes)\n\t\t// TODO only iterate over allowed properties?\n\t\tconst added_properties = new Set();\n\t\tfor (let o = theme.values??{}; o && o != Object.prototype; o = Object.getPrototypeOf(o)) {\n\t\t\tfor (const [key, value] of Object.entries(o)) {\n\t\t\t\tif (added_properties.has(key)) continue;\n\t\t\t\tadded_properties.add(key);\n\t\t\t\ttext += `--${key}: ${value};` // TODO escape?\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\t// update default current text colors\n\t\ttext += `--current_text_color: var(--text);`\n\t\ttext += `--current_text_color_highlight: var(--text_highlight);`\n\t\ttext += `color: var(--current_text_color);`\n\t\t// set color scheme\n\t\tif (theme.mode) text += `color-scheme: ${theme.mode}`\n\n\t\ttext += \"}\";\n\n\t\tthis.#themesCSS.set(theme.name, text);\n\n\t\tthis.updateGlobalThemeStyle(theme.name)\n\t}\n\n\tprivate updateCurrentThemeStyle(){\n\t\tthis.#current_theme_style_sheet.replaceSync?.(this.#current_theme_css_text);\n\n\t\t// add to document\n\t\tif (!this.#document_stylesheets_added) {\n\t\t\tif (client_type === \"browser\") document.adoptedStyleSheets = [...document.adoptedStyleSheets, this.#current_theme_style_sheet, this.#global_style_sheet];\n\t\t\tthis.#document_stylesheets_added = true;\n\t\t}\n\t}\n\n\tprivate updateGlobalThemeStyle(name:string){\n\t\t// set all current style classes global style\n\t\tlet global_style = \"\";\n\t\tfor (const style of this.#themesCSS.values()) {\n\t\t\tglobal_style += style + '\\n';\n\t\t}\n\t\tthis.#global_style_sheet.replaceSync?.(global_style);\n\n\t\t// add to document\n\t\tif (!this.#document_stylesheets_added) {\n\t\t\tif (client_type === \"browser\") document.adoptedStyleSheets = [...document.adoptedStyleSheets, this.#current_theme_style_sheet, this.#global_style_sheet];\n\t\t\tthis.#document_stylesheets_added = true;\n\t\t}\n\t}\n\n\taddThemeFromParsedStylesheet(sheet:CSSStyleSheet, themeStylesheets: Record<string, string[]>) {\n\t\tfor (const rule of <CSSStyleRule[]><any>sheet.cssRules) {\n\t\t\tconst name = rule.selectorText.replace(\".theme-\",\"\")\n\t\t\tconst values:Record<string,string> = {};\n\t\t\tconst mode:\"dark\"|\"light\" = rule.style.getPropertyValue(\"color-scheme\") ?? \"light\";\n\n\t\t\tfor (let i = 0; i < rule.style.length; i++) {\n\t\t\t\tconst prop = rule.style.item(i);\n\t\t\t\tif (!prop.startsWith(\"--\")) continue;\n\t\t\t\tif (prop === \"--current_text_color\" || prop === \"--current_text_color_highlight\") continue;\n\t\t\t\tconst key = prop.replace(\"--\",\"\");\n\t\t\t\tconst val = rule.style.getPropertyValue(prop);\n\t\t\t\tvalues[key] = val;\n\t\t\t}\n\n\t\t\tthis.registerTheme({\n\t\t\t\tname,\n\t\t\t\tmode,\n\t\t\t\tvalues,\n\t\t\t\tstylesheets: themeStylesheets[name] ?? [],\n\t\t\t\tparsed: true\n\t\t\t});\n\t\t}\n\t}\n\n\t// create new theme based on another theme\n\textend(theme:Theme, override:Partial<Theme> & {name: string}): Theme {\n\t\tconst dir = getCallerDir();\n\t\tif (!(\"mode\" in override)) override.mode = theme.mode;\n\t\tif (!(\"name\" in override)) throw new Error(\"Name required\");\n\n\t\tconst overrideValues = override.values ?? {};\n\t\toverride.values = Object.create(theme.values??{});\n\t\tfor (const [key, value] of Object.entries(overrideValues)) {\n\t\t\toverride.values![key] = value;\n\t\t}\n\t\toverride.stylesheets = [...(theme.stylesheets??[]), ...(override.stylesheets?.map(s => new Path(\n\t\t\ts,\n\t\t\ts.toString().startsWith(\"/\") && client_type == \"browser\" ? globalThis.location.origin : dir\n\t\t))??[])]\n\t\t\n\t\treturn override as Theme;\n\t}\n\n\tprivate mode_change_observers = new Set<Function>();\n\tonModeChange(observer:(theme:\"dark\"|\"light\")=>void) {\n\t\tthis.mode_change_observers.add(observer);\n\t}\n\n\tprivate theme_change_observers = new Set<Function>();\n\tonThemeChange(observer:(theme:string)=>void) {\n\t\tthis.theme_change_observers.add(observer);\n\t}\n\n}\n\nglobalThis.themeManager = undefined;\n\nexport function getThemeManager() {\n\tif (!globalThis.themeManager) globalThis.themeManager = new ThemeManager();\n\treturn globalThis.themeManager;\n}\n\nexport type ThemeManagerType = ThemeManager;"],"names":["client_type","UIX_COOKIE","getCookie","setCookie","Logger","getCallerDir","Path","uixLight","uixDark","uixLightPlain","uixDarkPlain","logger","ThemeManager","Map","CSSStyleSheet","stylesheet","mode","name","setMode","theme","setTheme","defaultDarkTheme","defaultLightTheme","values","auto_mode","customStyleSheets","Set","constructor","sheet","document","styleSheets","ownerNode","classList","contains","themeStylesheets","JSON","parse","decodeURI","getAttribute","addThemeFromParsedStylesheet","getTheme","registerTheme","currentModeCookie","colorMode","initialColorMode","currentMode","globalThis","matchMedia","matches","currentDarkTheme","themeDark","currentLightTheme","themeLight","setDefaultDarkTheme","setDefaultLightTheme","window","addEventListener","event","debug","ignoreParsed","get","parsed","stylesheets","dir","map","s","toString","startsWith","location","origin","set","addGlobalThemeClass","onRegister","force_update","persist","allowLazyLoad","Error","useThemes","themes","hasDarkTheme","hasLightTheme","nameOrTheme","warn","useTheme","getCurrentThemeCSS","getThemesCSS","join","getThemeCSS","useRootSelector","css","replace","getThemeStylesheets","getAllStyleSheets","currentTheme","onDeactivate","e","console","error","text","added_properties","o","Object","prototype","getPrototypeOf","key","value","entries","has","add","updateCurrentThemeStyle","modeChanged","documentElement","style","colorScheme","body","dataset","appColor","querySelector","setAttribute","onActivate","observer","mode_change_observers","theme_change_observers","customStylesheets","url","URL","exclude","link","head","querySelectorAll","href","remove","clear","existingLink","createElement","rel","append","updateGlobalThemeStyle","replaceSync","adoptedStyleSheets","global_style","rule","cssRules","selectorText","getPropertyValue","i","length","prop","item","val","extend","override","overrideValues","create","onModeChange","onThemeChange","themeManager","undefined","getThemeManager"],"mappings":"AAAA,SAASA,WAAW,QAAQ,uCAAuC;AACnE,SAASC,UAAU,EAAEC,SAAS,EAAEC,SAAS,QAAQ,wBAAwB;AACzE,SAASC,MAAM,QAAQ,oCAAoC;AAC3D,SAASC,YAAY,QAAQ,6CAA6C;AAC1E,SAASC,IAAI,QAAQ,kCAAkC;AACvD,SAASC,QAAQ,QAAQ,yBAAyB;AAClD,SAASC,OAAO,QAAQ,wBAAwB;AAChD,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,YAAY,QAAQ,8BAA8B;AAE3D,IAAMC,SAAS,IAAIP,OAAO;AA6C1B,IAAA,AAAMQ,eAAN,MAAMA;IAEL,CAAA,YAAa,GAAG,IAAIC,MAAoB;IAExC,CAAA,MAAO,GAAyB,CAAC,EAAC;IAElC,CAAA,SAAU,GAAG,CAAA,EAAI;IACjB,CAAA,YAAa,CAAiB;IAC9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