"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var helpers_exports = {};
__export(helpers_exports, {
  darken: () => darken,
  ensureContrast: () => ensureContrast,
  ff: () => ff,
  lighten: () => lighten,
  mix: () => mix,
  rgba: () => rgba
});
module.exports = __toCommonJS(helpers_exports);
var import_color = __toESM(require("color"));
var import_theme = require("./theme");
const rgba = (c, a) => (0, import_color.default)(c).alpha(a).rgb().toString();
const darken = (c, a) => (0, import_color.default)(c).darken(a).toString();
const lighten = (c, a) => (0, import_color.default)(c).lighten(a).toString();
const mix = (c, b, a) => (0, import_color.default)(c).mix((0, import_color.default)(b), a).toString();
const ff = (v) => {
  const [font, type = "Regular"] = v.split("|");
  const { style, weight } = import_theme.fontFamilies[font][type];
  const fallback = import_theme.fontFamilies[font].fallback ?? "Arial";
  return {
    fontFamily: `${font}, ${fallback}`,
    fontWeight: weight,
    fontStyle: style
  };
};
const ensureContrast = (color1, color2) => {
  const colorL1 = (0, import_color.default)(color1).luminosity() + 0.05;
  const colorL2 = (0, import_color.default)(color2).luminosity() + 0.05;
  const lRatio = colorL1 > colorL2 ? colorL1 / colorL2 : colorL2 / colorL1;
  if (lRatio < 1.5) {
    return (0, import_color.default)(color1).rotate(180).negate().string();
  }
  return color1;
};
//# sourceMappingURL=helpers.js.map
