var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { MapToComponentField, VegaSlimmer } from 'vega-slimmer/core';
import { LogUtility } from '../../../../utils/log';
import responsiveFormatFacade from '../../../../helpers/formatter/responsive-map-formatter/responsive-format-facade';
export const VEGA_FONT_AS_SAFE_LIST = [
  'h1',
  'h2',
  'h3',
  'h4',
  'h5',
  'h6',
  'i',
  'p',
  'span',
  'q',
  's',
  'del',
  'em',
  'cite',
  'b',
  'abbr',
  '',
];
/** The `VegaFontAsController` class is a TypeScript class that extends `VegaSlimmer` and provides methods for rendering and updating an extra node based on a specified `as` property. */
export class VegaFontAsController extends VegaSlimmer {
  /*
   * The below method is e2e-test covered in
   * @see{module:vega-font-responsive-as}
   */
  /* istanbul ignore next */
  /**
   * The function `getTagNameFromPropAs` returns a `VegaFontAs` value based on the input
   * `ResponsiveType<VegaFontAs>`.
   *
   * @returns {VegaFontAs} a value of type `VegaFontAs`.
   */
  getTagNameFromPropAs() {
    const result = responsiveFormatFacade.formatCustom(this.as) || '';
    if (!this.isSafeAs(result)) {
      LogUtility.warn(`The as value ${result} is invalid, it must be a value of: `, VEGA_FONT_AS_SAFE_LIST);
      return '';
    }
    return result;
  }
  /**
   * The function checks if a given value is safe to use as a VegaFontAs.
   *
   * @param {VegaFontAs} as - The parameter "as" is of type VegaFontAs.
   * @returns {boolean} a boolean value. If the input `as` is included in the `VEGA_FONT_AS_SAFE_LIST`, then it
   * returns `true`. Otherwise, it returns `false`.
   */
  isSafeAs(as) {
    if (VEGA_FONT_AS_SAFE_LIST.includes(as)) {
      return true;
    }
    return false;
  }
}
__decorate([
  MapToComponentField()
], VegaFontAsController.prototype, "as", void 0);
