{"version":3,"file":"helpers.mjs","sources":["../src/helpers.ts"],"sourcesContent":["import type {\n  ModernTheme,\n  ExtraTheme,\n  ForestGreenTheme,\n  ScreenMode,\n  ScreenModeDark,\n  Theming,\n} from './const';\nimport { extraThemes, screenModes, modernThemes } from './const';\n\n/**\n * @deprecated \"modern\" theme is released, you should not need check for \"modern\" theme anymore\n */\nexport const isThemeModern = (theme: NonNullable<Theming['theme']>): theme is ModernTheme => true;\n\nexport const isExtraTheme = (theme: NonNullable<Theming['theme']>): theme is ExtraTheme =>\n  extraThemes.includes(theme as ExtraTheme);\n\nexport const isForestGreenTheme = (\n  theme: NonNullable<Theming['theme']>,\n): theme is ForestGreenTheme => theme === extraThemes[0];\n\nexport const isScreenModeDark = (\n  theme: NonNullable<Theming['theme']>,\n  screenMode: ScreenMode,\n): screenMode is ScreenModeDark => screenModes[1] === screenMode;\n\nexport const getThemeClassName = (theme: NonNullable<Theming['theme']>, screenMode: ScreenMode) => {\n  // Personal light is always there by default\n  const themeClasses = ['np-theme-personal'];\n\n  /* eslint-disable functional/immutable-data */\n  // Personal dark theme\n  if (theme === 'personal' && screenMode === 'dark') {\n    themeClasses.push(`np-theme-personal--${screenMode}`);\n  }\n\n  // Personal forest-green and bright-green themes\n  else if (['forest-green', 'bright-green'].includes(theme)) {\n    themeClasses.push(`np-theme-personal--${theme}`);\n  }\n\n  // Business light\n  else if (theme === 'business') {\n    themeClasses.push(`np-theme-business`);\n    // Business dark theme\n    if (screenMode === 'dark') {\n      themeClasses.push(`np-theme-business--${screenMode}`);\n    }\n  }\n\n  // Business forest-green and bright-green themes\n  else if (['business--forest-green', 'business--bright-green'].includes(theme)) {\n    themeClasses.push(`np-theme-${theme}`);\n  }\n\n  // Platform themes\n  else if (theme.startsWith('platform')) {\n    themeClasses.push(`np-theme-${theme}`);\n  }\n  /* eslint-enable functional/immutable-data */\n  return themeClasses.join(' ');\n};\n\nexport const normalizeTheme = (\n  theme: NonNullable<Theming['theme']>,\n): NonNullable<Theming['theme']> => (theme === 'light' ? 'personal' : theme);\n"],"names":["isThemeModern","theme","isExtraTheme","extraThemes","includes","isForestGreenTheme","isScreenModeDark","screenMode","screenModes","getThemeClassName","themeClasses","push","startsWith","join","normalizeTheme"],"mappings":";;AAUA;;AAEG;AACI,MAAMA,aAAa,GAAIC,KAAoC,IAA2B;AAEtF,MAAMC,YAAY,GAAID,KAAoC,IAC/DE,WAAW,CAACC,QAAQ,CAACH,KAAmB;AAEnC,MAAMI,kBAAkB,GAC7BJ,KAAoC,IACNA,KAAK,KAAKE,WAAW,CAAC,CAAC;AAEhD,MAAMG,gBAAgB,GAAGA,CAC9BL,KAAoC,EACpCM,UAAsB,KACWC,WAAW,CAAC,CAAC,CAAC,KAAKD;MAEzCE,iBAAiB,GAAGA,CAACR,KAAoC,EAAEM,UAAsB,KAAI;AAChG;AACA,EAAA,MAAMG,YAAY,GAAG,CAAC,mBAAmB,CAAC;AAE1C;AACA;AACA,EAAA,IAAIT,KAAK,KAAK,UAAU,IAAIM,UAAU,KAAK,MAAM,EAAE;AACjDG,IAAAA,YAAY,CAACC,IAAI,CAAC,CAAA,mBAAA,EAAsBJ,UAAU,EAAE,CAAC;AACvD,EAAA;AAEA;OACK,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAACH,QAAQ,CAACH,KAAK,CAAC,EAAE;AACzDS,IAAAA,YAAY,CAACC,IAAI,CAAC,CAAA,mBAAA,EAAsBV,KAAK,EAAE,CAAC;AAClD,EAAA;AAEA;AAAA,OACK,IAAIA,KAAK,KAAK,UAAU,EAAE;AAC7BS,IAAAA,YAAY,CAACC,IAAI,CAAC,CAAA,iBAAA,CAAmB,CAAC;AACtC;IACA,IAAIJ,UAAU,KAAK,MAAM,EAAE;AACzBG,MAAAA,YAAY,CAACC,IAAI,CAAC,CAAA,mBAAA,EAAsBJ,UAAU,EAAE,CAAC;AACvD,IAAA;AACF,EAAA;AAEA;OACK,IAAI,CAAC,wBAAwB,EAAE,wBAAwB,CAAC,CAACH,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