{"version":3,"sources":["../src/themeize.ts","../src/config.ts","../src/utils/hashCode.ts"],"sourcesContent":["import { colorize } from '@lskjs/colors';\n\nimport { randomColors, theme } from './config';\nimport { ThemeKey } from './types';\nimport hashCode from './utils/hashCode';\n\nexport function themeizeRandom(str: string, randomName?: string | number | null): string {\n  const colors = randomColors[hashCode(randomName || '') % randomColors.length] || [];\n  return colorize(str, colors);\n}\n\nexport function themeize(str: string, themeKey?: ThemeKey | null): string {\n  const colors = themeKey ? theme[themeKey] : [];\n  return colorize(str, colors);\n}\n","// eslint-disable-next-line import/named\nimport { Color } from '@lskjs/colors';\n\nimport { Theme } from './types';\n\nexport const levelsPriority = {\n  start: 99,\n  log: 99,\n  fatal: 60,\n  error: 50,\n  warn: 40,\n  success: 35,\n  info: 30,\n  debug: 20,\n  trace: 10,\n};\n\nexport const theme: Theme = {\n  fatal: ['bgRed'],\n  error: ['bold', 'bgRed'],\n  warn: ['bgYellow'],\n  debug: ['bold', 'cyan'],\n  info: ['bold', 'green'],\n  trace: ['gray'],\n  log: ['bgWhite'],\n};\n\nexport const randomColors: Color[][] = [\n  ['red'],\n  ['green'],\n  ['yellow'],\n  ['blue'],\n  ['magenta'],\n  ['cyan'],\n  ['bold', 'red'],\n  ['bold', 'green'],\n  ['bold', 'yellow'],\n  ['bold', 'blue'],\n  ['bold', 'magenta'],\n  ['bold', 'cyan'],\n  // ['dim', 'red'],\n  // ['dim', 'green'],\n  // ['dim', 'yellow'],\n  // ['dim', 'blue'],\n  // ['dim', 'magenta'],\n  // ['dim', 'cyan'],\n];\n\nexport const contentColors: Color[][] = [\n  ['bold', 'white'],\n  ['bold', 'cyan'],\n  ['bold', 'green'],\n  ['white'],\n];\n","/**\n * NOTE: copied from @lskjs utils\n */\n\n/* eslint-disable no-bitwise */\nexport const hashCode = (s: string | number): number => {\n  if (typeof s === 'number') return s;\n  return Math.abs(\n    String(s)\n      .split('')\n      .reduce((a, b) => {\n        const c = (a << 5) - a + b.charCodeAt(0);\n        return c & c;\n      }, 0) - 48,\n  );\n};\n\nexport default hashCode;\n"],"mappings":"+EAAA,OAASA,YAAAA,MAAgB,gBCiBlB,IAAMC,EAAe,CAC1BC,MAAO,CAAC,SACRC,MAAO,CAAC,OAAQ,SAChBC,KAAM,CAAC,YACPC,MAAO,CAAC,OAAQ,QAChBC,KAAM,CAAC,OAAQ,SACfC,MAAO,CAAC,QACRC,IAAK,CAAC,UACR,EAEaC,EAA0B,CACrC,CAAC,OACD,CAAC,SACD,CAAC,UACD,CAAC,QACD,CAAC,WACD,CAAC,QACD,CAAC,OAAQ,OACT,CAAC,OAAQ,SACT,CAAC,OAAQ,UACT,CAAC,OAAQ,QACT,CAAC,OAAQ,WACT,CAAC,OAAQ,SClCJ,IAAMC,EAAWC,EAACC,GACnB,OAAOA,GAAM,SAAiBA,EAC3BC,KAAKC,IACVC,OAAOH,CAAAA,EACJI,MAAM,EAAA,EACNC,OAAO,CAACC,EAAGC,IAAAA,CACV,IAAMC,GAAKF,GAAK,GAAKA,EAAIC,EAAEE,WAAW,CAAA,EACtC,OAAOD,EAAIA,CACb,EAAG,CAAA,EAAK,EAAA,EARU,YAYxBE,EAAeZ,EFXR,SAASa,EAAeC,EAAaC,EAAmC,CAC7E,IAAMC,EAASC,EAAaC,EAASH,GAAc,EAAA,EAAME,EAAaE,MAAM,GAAK,CAAA,EACjF,OAAOC,EAASN,EAAKE,CAAAA,CACvB,CAHgBH,EAAAA,EAAAA,kBAKT,SAASQ,EAASP,EAAaQ,EAA0B,CAC9D,IAAMN,EAASM,EAAWC,EAAMD,CAAAA,EAAY,CAAA,EAC5C,OAAOF,EAASN,EAAKE,CAAAA,CACvB,CAHgBK,EAAAA,EAAAA","names":["colorize","theme","fatal","error","warn","debug","info","trace","log","randomColors","hashCode","__name","s","Math","abs","String","split","reduce","a","b","c","charCodeAt","hashCode_default","themeizeRandom","str","randomName","colors","randomColors","hashCode","length","colorize","themeize","themeKey","theme"]}