const formatValue = (tinyColor) => {
  if (!tinyColor) {
    return '';
  }
  const { r, g, b, a } = tinyColor.toRgb();
  return `${r} ${g} ${b} / ${a}`;
};
export const OverridableColorTokens = [
  {
    name: 'bg-action',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-action',
  },
  {
    name: 'bg-action-hover',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(10);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-10);
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-action-hover',
  },
  {
    name: 'bg-action-focus',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-action-focus',
  },
  {
    name: 'bg-action-active',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(15);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-15);
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-action-active',
  },
  {
    name: 'bg-action-secondary-hover',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(10);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-10);
      }
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.15);
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-action-secondary-hover',
  },
  {
    name: 'bg-action-secondary-active',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(20);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-20);
      }
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.15);
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-action-secondary-active',
  },
  {
    name: 'bg-divider',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-divider',
  },
  {
    name: 'bg-keypad-btn-active',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.3);
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-keypad-btn-active',
  },
  {
    name: 'bg-selected',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(10);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-10);
      }
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.25);
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-selected',
  },
  {
    name: 'bg-sidebar',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['sidebarColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-sidebar',
  },
  {
    name: 'bg-sidebar-item-hover',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['sidebarColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = tinycolor({ a: 0.9, r: 255, b: 255, g: 255 });
      }
      else {
        value = tinycolor({ a: 0.86, r: 15, b: 15, g: 15 });
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-sidebar-item-hover',
  },
  {
    name: 'bg-sidebar-item-selected',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.4);
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-sidebar-item-selected',
  },
  {
    name: 'bg-table-selected-row',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.2);
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-table-selected-row',
  },
  {
    name: 'bg-toggle-switch-selected-disabled',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.5);
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-toggle-switch-selected-disabled',
  },
  {
    name: 'bg-date-picker-range',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(10);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-10);
      }
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.15);
      return formatValue(value);
    },
  },
  {
    name: 'dark-bg-date-picker-range',
  },
  {
    name: 'text-link',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      return formatValue(value);
    },
  },
  {
    name: 'dark-text-link',
  },
  {
    name: 'text-link-hover',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(10);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-10);
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-text-link-hover',
  },
  {
    name: 'text-link-active',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(15);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-15);
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-text-link-active',
  },
  {
    name: 'text-link-focus',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(10);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-10);
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-text-link-focus',
  },
  {
    name: 'text-link-visited',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(20);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-22);
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-text-link-visited',
  },
  {
    name: 'text-sidebar-link',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['sidebarColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = tinycolor({ a: 0.9, b: 255, r: 255, g: 255 });
      }
      else {
        value = tinycolor({ a: 0.86, b: 15, r: 15, g: 15 });
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-text-sidebar-link',
  },
  {
    name: 'text-sidebar-link-hover',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['sidebarColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = tinycolor({ a: 0.86, r: 15, b: 15, g: 15 });
      }
      else {
        value = tinycolor({ a: 0.9, r: 255, b: 255, g: 255 });
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-text-sidebar-link-hover',
  },
  {
    name: 'text-sidebar-link-selected',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['sidebarColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = tinycolor({ a: 0.9, r: 255, b: 255, g: 255 });
      }
      else {
        value = tinycolor({ a: 0.86, b: 15, r: 15, g: 15 });
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-text-sidebar-link-selected',
  },
  {
    name: 'border-color-action',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-action',
  },
  {
    name: 'border-color-action-hover',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(10);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-10);
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-action-hover',
  },
  {
    name: 'border-color-action-active',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(15);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-15);
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-action-active',
  },
  {
    name: 'border-color-divider',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-divider',
  },
  {
    name: 'border-color-divider-secondary',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(15);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-15);
      }
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.4);
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-divider-secondary',
  },
  {
    name: 'border-color-input-field',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-input-field',
  },
  {
    name: 'border-color-input-field-hover',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(10);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-10);
      }
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-input-field-hover',
  },
  {
    name: 'border-color-input-field-focus',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(15);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-15);
      }
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-input-field-focus',
  },
  {
    name: 'border-color-input-field-disabled',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      value = tinycolor({ a: 0.2, r: 15, b: 15, g: 15 });
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-input-field-disabled',
  },
  {
    name: 'border-color-tile-focus',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-tile-focus',
  },
  {
    name: 'border-color-tile-selected-focus',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(15);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-15);
      }
      value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-tile-selected-focus',
  },
  {
    name: 'border-color-tile-selected',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-tile-selected',
  },
  {
    name: 'border-color-tile-selected-hover',
    overrideGetter: (overrideColors, tinycolor) => {
      const overrideBaseColor = overrideColors['actionColor'];
      if (!overrideBaseColor) {
        return '';
      }
      const baseColor = overrideBaseColor
        ? tinycolor(overrideBaseColor)
        : undefined;
      let value = baseColor
        ? baseColor.clone()
        : undefined;
      if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
        value = value === null || value === void 0 ? void 0 : value.lighten(10);
      }
      else {
        value = value === null || value === void 0 ? void 0 : value.lighten(-10);
      }
      return formatValue(value);
    },
  },
  {
    name: 'dark-border-color-tile-selected-hover',
  },
];
