{"version":3,"file":"theme_head.4cb181fc19f2a308ba73.js","mappings":"AAIiB,M,MACf,MAUMA,EAAe,QACfC,EAASC,SAASC,gBACxB,IAAIC,EAAQJ,EAGZ,MAAMK,EACmD,QAAvD,EAAAC,OAAOC,aAAaC,QAAQ,mCAA2B,QAhBlC,MAIrB,MAAMC,EAAcH,OAAOC,aAAaC,QAAQ,UAE1CE,EAAoBC,KAAKC,MAAMH,GACrC,OAAOC,EAAoBA,EAAkBN,MAAQ,IAAI,EASES,GAEzDR,IACEA,EAAeS,QAAQ,WAAa,EACtCV,EAAQE,OAAOS,WAAW,gCAAgCC,QAAU,OAAS,QACpEX,EAAeS,QAAQ,SAAW,IAC3CV,EAAQ,SAIPH,EAAOgB,UAAUC,SAAS,SAAWd,KAExCH,EAAOgB,UAAUE,OAAO,SAAWnB,GACnCC,EAAOgB,UAAUG,IAAI,SAAWhB,GAClC,EAGFiB","sources":["webpack://@bitwarden/web-vault/./src/theme.ts"],"sourcesContent":["// FIXME: Update this file to be type safe and remove this and next line\n// @ts-strict-ignore\n// Set theme on page load\n// This is done outside the Angular app to avoid a flash of unthemed content before it loads\nconst setTheme = () => {\n const getLegacyTheme = (): string | null => {\n // MANUAL-STATE-ACCESS: Calling global to get setting before migration\n // has had a chance to run, can be remove in the future.\n // Tracking Issue: https://bitwarden.atlassian.net/browse/PM-6676\n const globalState = window.localStorage.getItem(\"global\");\n\n const parsedGlobalState = JSON.parse(globalState) as { theme?: string } | null;\n return parsedGlobalState ? parsedGlobalState.theme : null;\n };\n\n const defaultTheme = \"light\";\n const htmlEl = document.documentElement;\n let theme = defaultTheme;\n\n // First try the new state providers location, then the legacy location\n const themeFromState =\n window.localStorage.getItem(\"global_theming_selection\") ?? getLegacyTheme();\n\n if (themeFromState) {\n if (themeFromState.indexOf(\"system\") > -1) {\n theme = window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n } else if (themeFromState.indexOf(\"dark\") > -1) {\n theme = \"dark\";\n }\n }\n\n if (!htmlEl.classList.contains(\"theme_\" + theme)) {\n // The defaultTheme is also set in the html itself to make sure that some theming is always applied\n htmlEl.classList.remove(\"theme_\" + defaultTheme);\n htmlEl.classList.add(\"theme_\" + theme);\n }\n};\n\nsetTheme();\n"],"names":["defaultTheme","htmlEl","document","documentElement","theme","themeFromState","window","localStorage","getItem","globalState","parsedGlobalState","JSON","parse","getLegacyTheme","indexOf","matchMedia","matches","classList","contains","remove","add","setTheme"],"sourceRoot":""}