import { RTEFilterStylesStrategy } from '../filter-styles-strategy.abstract';
import { Predicate } from '../predicate';
/**
 * Filter styles strategy for code block node, which defines the styles to be filtered and the conditions for filtering and refilling styles for code block nodes.
 */
export class CodeBlockNodeFilterStylesStrategy extends RTEFilterStylesStrategy {
  constructor() {
    super(...arguments);
    this.stylesToBeFiltered = CodeBlockNodeFilterStylesStrategy.STYLES;
    this.elementTagName = 'pre code';
  }
  /**
   * @inheritDoc
   */
  canFilter(blockOrNodeInstance) {
    return Predicate.isCodeBlockNode(blockOrNodeInstance);
  }
  /**
   * The code node styles is preset and will convert to vega-code-block element so we don't need to to refill styles back to element.
   *
   * @param {string} _blockOrNodeClassName The class name of the block or node.
   * @param {HTMLElement} _element The HTML element to check.
   * @returns {boolean} False, as we don't need to refill styles for code nodes.
   */
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  canRefill(_blockOrNodeClassName, _element) {
    return false;
  }
  /**
   * @inheritDoc
   */
  toCssText() {
    return this.buildCssTextForStyles(this.elementTagName, this.classNameToBeAdded);
  }
}
CodeBlockNodeFilterStylesStrategy.STYLES = {
  boxSizing: 'border-box',
  color: 'rgba(var(--v-text-primary, 32, 54, 69, 1))',
  textAlign: 'left',
  fontFamily: '"Roboto Mono"',
  fontWeight: '400',
  lineHeight: '22px',
  fontSize: '16px',
  whiteSpace: 'pre-wrap',
  minHeight: '22px',
  tabSize: '2px',
};
