{"version":3,"sources":["jsdelivr-header.js","/npm/badgen@3.3.2/src/calc-text-width.ts","/npm/badgen@3.3.2/src/color-presets.ts","/npm/badgen@3.3.2/src/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,+FCWA,IAAa,EAAA,CAfM,IACjB,IAAM,EAAgB,EAAe,IAErC,WAAY,MACV,IAAI,EAAQ,EACR,EAAY,EACZ,EAAI,EAAK,OACb,KAAO,KACL,EAAY,EAAe,EAAK,GAAG,cACnC,QAAuB,IAAd,EAA0B,EAAgB,EAErD,OAAO,EAAA,EAIE,CAJF,KAAA,MAAA,6vyBCbX,EAAe,CACb,MAAO,MACP,KAAM,MACN,IAAK,MACL,OAAQ,MACR,OAAQ,MACR,OAAQ,MACR,KAAM,MACN,KAAM,MACN,KAAM,MACN,KAAM,MACN,MAAO,UCWT,SAAS,EAAiB,GASxB,OARmB,IAAf,EAAI,SACN,EAAM,EAAI,GAAK,EAAI,GAAK,EAAI,GAAK,EAAI,GAAK,EAAI,GAAK,EAAI,KAO7C,IAJF,SAAS,EAAI,MAAM,EAAG,GAAI,IAId,IAHZ,SAAS,EAAI,MAAM,EAAG,GAAI,IAGJ,IAFtB,SAAS,EAAI,MAAM,EAAG,GAAI,KAEG,MAMzC,SAAS,EAAqB,GAI1B,OAHE,EAAgB,IAAQ,IACnB,CAAE,UAAW,OAAQ,YAAa,QAElC,CAAE,UAAW,OAAQ,YAAa,OAAQ,CAIrD,SAAgB,GACd,MAAA,EACA,QAAA,EACA,OAAA,EACA,MAAA,EAAQ,OACR,MAAA,EACA,KAAA,EACA,UAAA,EAAY,GACZ,WAAA,EAAa,MACb,MAAA,EAAQ,IAKR,GAHA,EAA6B,iBAAX,EAAqB,6BAEvC,OAAkB,IAAV,EAAsB,EAAU,KACzB,EACb,OAAO,EAAK,CAAE,OAAA,EAAQ,MAAA,EAAO,MAAA,EAAO,MAAA,IAGtC,EAAQ,EAAa,IAAU,EAC/B,EAAa,EAAa,IAAe,E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MAAA,EAAO,MAAA,EAAQ,IACtD,EAA6B,iBAAX,EAAqB,2BACvC,EAAQ,EAAa,IAAU,GAAS,EAAa,KAErD,IAAQ,UAAW,EAAiB,YAAa,GAAsB,EAAoB,GAErF,EAAc,EAAU,GACxB,EAAc,EAAc,IAE5B,EAAa,EAAiB,GAC9B,EAAS,EAAiB,GAkBhC,OAhBA,EAAS,EAAS,GAClB,EAAQ,EAAS,GAEH,SAAV,EACK,eAAe,EAAQ,EAAc,eAAuB,GAAR,mBAA4B,oEAA8E,iBAC9J,sCAEQ,mBAAuB,8KAGH,YAAsB,oBAAoC,kDAC1D,YAAsB,MAAoB,2BAKxE,eAAe,EAAQ,EAAc,eAAuB,GAAR,mBAA4B,oEAA8E,iBAC5J,oCACa,gKAIV,mBAAwB,iEACpB,0BACC,0BAAoC,gCACpC,8BAAwC,kKAGpB,YAAsB,qBAAqC,kDAC3D,YAAsB,MAAoB,0B,CAKjF,SAAS,EAAU,GACjB,OAAO,EACJ,QAAQ,UAAW,SACnB,QAAQ,UAAW,QACnB,QAAQ,UAAW,QACnB,QAAQ,UAAW,UACnB,QAAQ,UAAW,SAAS,CAQjC,SAAS,EAAiB,GACxB,IACI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,uDAAW,OAAO,KAAK,MAAsB,GAAhB,KAAK,WAG9C,OAAO,CAAA,CAGT,SAAS,GAAsB,MAAA,EAAO,OAAA,IAEpC,OADoB,EAAQ,GAAG,MAAY,IACtB,CAAA,CAGvB,SAAS,EAAY,EAAoB,GACvC,IAAK,EAAW,MAAU,UAAU,EAAQ,CAAA,QAAA,OAAA,EAAA,QAAA,QAAA,EAAA,QAAA,UAAA","file":"/npm/badgen@3.3.2/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.48.0.\n * Original file: /npm/badgen@3.3.2/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import widthsVerdana110 from './widths-verdana-110.json'\n\nconst calcWidth = (charWidthTable: number[]) => {\n  const fallbackWidth = charWidthTable[64] // Width as \"@\" for overflows\n\n  return ([...text]) => {\n    let total = 0\n    let charWidth = 0\n    let i = text.length\n    while (i--) {\n      charWidth = charWidthTable[text[i].charCodeAt()]\n      total += charWidth === undefined ? fallbackWidth : charWidth\n    }\n    return total\n  }\n}\n\nexport const Verdana110 = calcWidth(widthsVerdana110)\n","export default {\n  green: '3C1',\n  blue: '08C',\n  red: 'E43',\n  yellow: 'DB1',\n  orange: 'F73',\n  purple: '94E',\n  pink: 'E5B',\n  grey: '999',\n  gray: '999',\n  cyan: '1BC',\n  black: '2A2A2A'\n} as Record<string, string>\n","export { Verdana110 as calcWidth } from './calc-text-width'\nimport { Verdana110 as calcWidth } from './calc-text-width'\nimport colorPresets from './color-presets'\n\nexport type StyleOption = 'flat' | 'classic'\nexport type ColorPreset = keyof typeof colorPresets\n\nexport interface BadgenOptions {\n  status: string;\n  subject?: string;\n  color?: ColorPreset;\n  label?: string;\n  labelColor?: string;\n  style?: StyleOption;\n  icon?: string;\n  iconWidth?: number;\n  scale?: number;\n}\n\n/**\n * Based on Shields.io (brightness() function)\n */\nfunction colorBrightness (hex: string): number {\n  if (hex.length === 3) {\n    hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]\n  }\n\n  const r = parseInt(hex.slice(0, 2), 16)\n  const g = parseInt(hex.slice(2, 4), 16)\n  const b = parseInt(hex.slice(4, 6), 16)\n\n  return (r * 299 + g * 587 + b * 114) / 255000\n}\n\n/**\n * Based on Shields.io (colorsForBackground() function)\n */\nfunction colorsForBackground (hex: string): { textColor: string; shadowColor: string } {\n  if (colorBrightness(hex) <= 0.69) {\n    return { textColor: '#fff', shadowColor: '#000' }\n  } else {\n    return { textColor: '#000', shadowColor: '#fff' }\n  }\n}\n\nexport function badgen ({\n  label,\n  subject,\n  status,\n  color = 'blue',\n  style,\n  icon,\n  iconWidth = 13,\n  labelColor = '555',\n  scale = 1\n}: BadgenOptions) {\n  typeAssert(typeof status === 'string', '<status> must be string')\n\n  label = label === undefined ? subject : label // subject is deprecated\n  if (!label && !icon) {\n    return bare({ status, color, style, scale })\n  }\n\n  color = colorPresets[color] || color\n  labelColor = colorPresets[labelColor] || labelColor\n  iconWidth = iconWidth * 10\n\n  const { textColor: labelTextColor, shadowColor: labelShadowColor } = colorsForBackground(labelColor)\n  const { textColor: statusTextColor, shadowColor: statusShadowColor } = colorsForBackground(color)\n\n  const iconSpanWidth = icon ? (label?.length ? iconWidth + 30 : iconWidth - 18) : 0\n  const sbTextStart = icon ? (iconSpanWidth + 50) : 50\n  const sbTextWidth = label ? calcWidth(label) : 0\n  const stTextWidth = calcWidth(status)\n  const sbRectWidth = sbTextWidth + 100 + iconSpanWidth\n  const stRectWidth = stTextWidth + 100\n  const width = sbRectWidth + stRectWidth\n  const xlink = icon ? ' xmlns:xlink=\"http://www.w3.org/1999/xlink\"' : ''\n\n  const gradientId = generateRandomID(5)\n  const maskId = generateRandomID(5)\n\n  label = label ? sanitize(label) : ''\n  status = sanitize(status)\n  color = sanitize(color)\n  labelColor = sanitize(labelColor)\n  icon = icon ? sanitize(icon) : icon\n  const accessibleText = createAccessibleText({label, status})\n\n  if (style === 'flat') {\n    return `<svg width=\"${scale * width / 10}\" height=\"${scale * 20}\" viewBox=\"0 0 ${width} 200\" xmlns=\"http://www.w3.org/2000/svg\"${xlink} role=\"img\" aria-label=\"${accessibleText}\">\n  <title>${accessibleText}</title>\n  <g>\n    <rect fill=\"#${labelColor}\" width=\"${sbRectWidth}\" height=\"200\"/>\n    <rect fill=\"#${color}\" x=\"${sbRectWidth}\" width=\"${stRectWidth}\" height=\"200\"/>\n  </g>\n  <g aria-hidden=\"true\" text-anchor=\"start\" font-family=\"Verdana,DejaVu Sans,sans-serif\" font-size=\"110\">\n    <text x=\"${sbTextStart + 10}\" y=\"148\" textLength=\"${sbTextWidth}\" fill=\"${labelShadowColor}\" opacity=\"0.1\">${label}</text>\n    <text x=\"${sbTextStart}\" y=\"138\" textLength=\"${sbTextWidth}\" fill=\"${labelTextColor}\">${label}</text>\n    <text x=\"${sbRectWidth + 55}\" y=\"148\" textLength=\"${stTextWidth}\" fill=\"${statusShadowColor}\" opacity=\"0.1\">${status}</text>\n    <text x=\"${sbRectWidth + 45}\" y=\"138\" textLength=\"${stTextWidth}\" fill=\"${statusTextColor}\">${status}</text>\n  </g>\n  ${icon ? `<image x=\"40\" y=\"35\" width=\"${iconWidth}\" height=\"132\" xlink:href=\"${icon}\"/>` : ''}\n</svg>`\n  }\n\n  return `<svg width=\"${scale * width / 10}\" height=\"${scale * 20}\" viewBox=\"0 0 ${width} 200\" xmlns=\"http://www.w3.org/2000/svg\"${xlink} role=\"img\" aria-label=\"${accessibleText}\">\n  <title>${accessibleText}</title>\n  <linearGradient id=\"${gradientId}\" x2=\"0\" y2=\"100%\">\n    <stop offset=\"0\" stop-opacity=\".1\" stop-color=\"#EEE\"/>\n    <stop offset=\"1\" stop-opacity=\".1\"/>\n  </linearGradient>\n  <mask id=\"${maskId}\"><rect width=\"${width}\" height=\"200\" rx=\"30\" fill=\"#FFF\"/></mask>\n  <g mask=\"url(#${maskId})\">\n    <rect width=\"${sbRectWidth}\" height=\"200\" fill=\"#${labelColor}\"/>\n    <rect width=\"${stRectWidth}\" height=\"200\" fill=\"#${color}\" x=\"${sbRectWidth}\"/>\n    <rect width=\"${width}\" height=\"200\" fill=\"url(#${gradientId})\"/>\n  </g>\n  <g aria-hidden=\"true\" text-anchor=\"start\" font-family=\"Verdana,DejaVu Sans,sans-serif\" font-size=\"110\">\n    <text x=\"${sbTextStart + 10}\" y=\"148\" textLength=\"${sbTextWidth}\" fill=\"${labelShadowColor}\" opacity=\"0.25\">${label}</text>\n    <text x=\"${sbTextStart}\" y=\"138\" textLength=\"${sbTextWidth}\" fill=\"${labelTextColor}\">${label}</text>\n    <text x=\"${sbRectWidth + 55}\" y=\"148\" textLength=\"${stTextWidth}\" fill=\"${statusShadowColor}\" opacity=\"0.25\">${status}</text>\n    <text x=\"${sbRectWidth + 45}\" y=\"138\" textLength=\"${stTextWidth}\" fill=\"${statusTextColor}\">${status}</text>\n  </g>\n  ${icon ? `<image x=\"40\" y=\"35\" width=\"${iconWidth}\" height=\"130\" xlink:href=\"${icon}\"/>` : ''}\n</svg>`\n}\n\nexport default badgen\n\nfunction bare ({ status, color = 'blue', style, scale = 1 }: BadgenOptions) {\n  typeAssert(typeof status === 'string', '<status> must be string')\n  color = colorPresets[color] || color || colorPresets.blue\n\n  const { textColor: statusTextColor, shadowColor: statusShadowColor } = colorsForBackground(color)\n\n  const stTextWidth = calcWidth(status)\n  const stRectWidth = stTextWidth + 115\n\n  const gradientId = generateRandomID(5)\n  const maskId = generateRandomID(5)\n\n  status = sanitize(status)\n  color = sanitize(color)\n\n  if (style === 'flat') {\n    return `<svg width=\"${scale * stRectWidth / 10}\" height=\"${scale * 20}\" viewBox=\"0 0 ${stRectWidth} 200\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-label=\"${status}\">\n  <title>${status}</title>\n  <g>\n    <rect fill=\"#${color}\" x=\"0\" width=\"${stRectWidth}\" height=\"200\"/>\n  </g>\n  <g aria-hidden=\"true\" text-anchor=\"start\" font-family=\"Verdana,DejaVu Sans,sans-serif\" font-size=\"110\">\n    <text x=\"65\" y=\"148\" textLength=\"${stTextWidth}\" fill=\"${statusShadowColor}\" opacity=\"0.1\">${status}</text>\n    <text x=\"55\" y=\"138\" textLength=\"${stTextWidth}\" fill=\"${statusTextColor}\">${status}</text>\n  </g>\n</svg>`\n  }\n\n  return `<svg width=\"${scale * stRectWidth / 10}\" height=\"${scale * 20}\" viewBox=\"0 0 ${stRectWidth} 200\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-label=\"${status}\">\n  <title>${status}</title>\n  <linearGradient id=\"${gradientId}\" x2=\"0\" y2=\"100%\">\n    <stop offset=\"0\" stop-opacity=\".1\" stop-color=\"#EEE\"/>\n    <stop offset=\"1\" stop-opacity=\".1\"/>\n  </linearGradient>\n  <mask id=\"${maskId}\"><rect width=\"${stRectWidth}\" height=\"200\" rx=\"30\" fill=\"#FFF\"/></mask>\n  <g mask=\"url(#${maskId})\">\n    <rect width=\"${stRectWidth}\" height=\"200\" fill=\"#${color}\" x=\"0\"/>\n    <rect width=\"${stRectWidth}\" height=\"200\" fill=\"url(#${gradientId})\"/>\n  </g>\n  <g aria-hidden=\"true\" text-anchor=\"start\" font-family=\"Verdana,DejaVu Sans,sans-serif\" font-size=\"110\">\n    <text x=\"65\" y=\"148\" textLength=\"${stTextWidth}\" fill=\"${statusShadowColor}\" opacity=\"0.25\">${status}</text>\n    <text x=\"55\" y=\"138\" textLength=\"${stTextWidth}\" fill=\"${statusTextColor}\">${status}</text>\n  </g>\n</svg>`\n}\n\nfunction sanitize (str: string): string {\n  return str\n    .replace(/\\u0026/g, '&amp;')\n    .replace(/\\u003C/g, '&lt;')\n    .replace(/\\u003E/g, '&gt;')\n    .replace(/\\u0022/g, '&quot;')\n    .replace(/\\u0027/g, '&apos;')\n}\n\ninterface AccessibleTextProps {\n  status: string;\n  label?: string;\n}\n\nfunction generateRandomID(length: number): string {\n  const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';\n  let result = '';\n\n  for (let i = 0; i < length; i++) {\n    result += characters.charAt(Math.floor(Math.random() * characters.length));\n  }\n\n  return result;\n}\n\nfunction createAccessibleText({label, status}: AccessibleTextProps): string {\n  const labelPrefix = label ? `${label}: ` : '';\n  return labelPrefix + status;\n}\n\nfunction typeAssert (assertion: boolean, message: string): void {\n  if (!assertion) throw new TypeError(message)\n}\n\ndeclare global {\n  interface Window {\n    badgen: typeof badgen;\n  }\n}\n"]}