<commit_before>import Slidy from '..'
import { Options } from '../defs'
import { parseTpl } from '../utils'

/**
 * Create controls.
 */
export class Controls {
  /**
   * Disable control.
   */
  private static disable(el: HTMLButtonElement) {
    el.setAttribute('disabled', '')
    el.classList.add('is-disabled')
  }

  /**
   * Enable control.
   */
  private static enable(el: HTMLButtonElement) {
    el.removeAttribute('disabled')
    el.classList.remove('is-disabled')
  }

  private _el: HTMLDivElement
  private _prev: HTMLButtonElement
  private _next: HTMLButtonElement

  /**
   * Creates an instance of Controls.
   */
  constructor(private _slidy: Slidy, private _opts: Options) {
    this._init()
    this._bind()
  }

  /**
   * Destroy component.
   */
  public destroy() {
    this._el = document.querySelector('.slidy-controls')
    this._el.parentNode.removeChild(this._el)
    this._slidy.hooks.remove('beforeSlide', this._update)
  }

  /**
   * Init component.
   */
  private _init() {
    const { namespace: ns, outer } = this._slidy
    const { controls } = this._opts

    let prev = '<'
    let next = '>'

    if (controls !== true) {
      prev = parseTpl(controls as string, {
        label: 'prev slide',
      })
      next = parseTpl(controls as string, {
        label: 'next slide',
      })
    }

    const tpl = document.createElement('template')
    const html = `<div class="${ns}-controls">
  <button type="button" class="${ns}-controls__item--prev">${prev}</button>
  <button type="button class="${ns}-controls__item--next">${next}</button>
</div>`

    tpl.innerHTML = html

    this._el = tpl.content.firstChild as HTMLDivElement
    this._prev = this._el.querySelector('button:first-child')
    this._next = this._el.querySelector('button:last-child')
    outer.appendChild(this._el)

    this._update()
  }

  /**
   * Bind event handlers.
   */
  private _bind() {
    this._prevClick = this._prevClick.bind(this)
    this._nextClick = this._nextClick.bind(this)<commit_msg>fix: :pencil2: missing quote<commit_after>import Slidy from '..'
import { Options } from '../defs'
import { parseTpl } from '../utils'

/**
 * Create controls.
 */
export class Controls {
  /**
   * Disable control.
   */
  private static disable(el: HTMLButtonElement) {
    el.setAttribute('disabled', '')
    el.classList.add('is-disabled')
  }

  /**
   * Enable control.
   */
  private static enable(el: HTMLButtonElement) {
    el.removeAttribute('disabled')
    el.classList.remove('is-disabled')
  }

  private _el: HTMLDivElement
  private _prev: HTMLButtonElement
  private _next: HTMLButtonElement

  /**
   * Creates an instance of Controls.
   */
  constructor(private _slidy: Slidy, private _opts: Options) {
    this._init()
    this._bind()
  }

  /**
   * Destroy component.
   */
  public destroy() {
    this._el = document.querySelector('.slidy-controls')
    this._el.parentNode.removeChild(this._el)
    this._slidy.hooks.remove('beforeSlide', this._update)
  }

  /**
   * Init component.
   */
  private _init() {
    const { namespace: ns, outer } = this._slidy
    const { controls } = this._opts

    let prev = '<'
    let next = '>'

    if (controls !== true) {
      prev = parseTpl(controls as string, {
        label: 'prev slide',
      })
      next = parseTpl(controls as string, {
        label: 'next slide',
      })
    }

    const tpl = document.createElement('template')
    const html = `<div class="${ns}-controls">
  <button type="button" class="${ns}-controls__item--prev">${prev}</button>
  <button type="button" class="${ns}-controls__item--next">${next}</button>
</div>`

    tpl.innerHTML = html

    this._el = tpl.content.firstChild as HTMLDivElement
    this._prev = this._el.querySelector('button:first-child')
    this._next = this._el.querySelector('button:last-child')
    outer.appendChild(this._el)

    this._update()
  }

  /**
   * Bind event handlers.
   */
  private _bind() {
    this._prevClick = this._prevClick.bind(this)
    this._nextClick = this._nextClick.bind(this)
{'fraction_non_alphanumeric': 0.1530511811023622, 'fraction_numerical': 0.00024606299212598425, 'mean_word_length': 2.9161849710982657, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2064332', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1270, 'n_words': 264}