<commit_before>'use strict'

class ElasticSlider {
    constructor(el, options) {

        // Public properties
        // ====================================================================
        this.NAMESPACE = 'ElasticSlider';
        this.options = this._filterOptions(options);
        this.CLASS_NAME_LIST = {
            'container': `${this.NAMESPACE}-container`,
            'item': `${this.NAMESPACE}-item`,
            'itemActive': `${this.NAMESPACE}-item--isActive`,
            'itemClone': `${this.NAMESPACE}-item--clone`,
        }
        this._properties = new Map();

        // Class requirement pass check
        // ====================================================================
        this._checkClassRequirements(el);

        // Private properties
        // ====================================================================
        this._animationFunctionHash = {};
        this._slideCount = null;
        this._initialAnimationDelay = 50; // ms in which animation begins
        this._startAnimationUserCallback = () => {};
        this._endAnimationUserCallback = () => {};

        // Create animations
        // ====================================================================
        this._createAnimationFunctions();

        // Elements
        // ====================================================================
        this.elementList = {};
        this.elementList.slider = el;
        this.elementList.containerEl = this.elementList.slider.querySelector(`.${this.CLASS_NAME_LIST.container}`);
        this.elementList.slideArr = this.elementList.containerEl.children;
        this.elementList.slideActiveEl = this.elementList.slideArr[this.options.activeSlide - 1];
        this.elementList.cloneEl = null;
        this._slideCount = this.elementList.slideArr.length;

        // Run methods
        // ====================================================================
        this.setProp('activeSlideIndex', this.options.activeSlide - 1);
        this.setProp('nextActiveSlideIndex', this.options.activeSlide);
        this.setProp('isAnimating', false);

        // DOM manipulation
        // ====================================================================
        this.elementList.slider.classList.add(this.NAMESPACE);

        for (let i = 0; i < this.elementList.slideArr.length; i++) {
            let itemEl = this.elementList.slideArr[i]

            itemEl.classList.add(this.CLASS_NAME_LIST.item);
        }

        this._setActiveSlide(this.getProp('activeSlideIndex'));

        this._addCustomAnimationFunctions();
    }

    // ========================================================================
    // Public methods
    // ========================================================================
    // May be useful in future. No events to remove.
    destroy() {
        for (let k in this.CLASS_NAME_LIST) {
            let element = document.querySelector(`.${this.CLASS_NAME_LIST[k]}`);

            if (element) {
                element.classList.remove(`${this.CLASS_NAME_LIST[k]}`);
            }
        }

        this.elementList.slider.classList.remove(this.NAMESPACE);
    }

    toSlide(params = {}) {
        let {
            index,
            animation,<commit_msg>Fix destroy method<commit_after>'use strict'

class ElasticSlider {
    constructor(el, options) {

        // Public properties
        // ====================================================================
        this.NAMESPACE = 'ElasticSlider';
        this.options = this._filterOptions(options);
        this.CLASS_NAME_LIST = {
            'container': `${this.NAMESPACE}-container`,
            'item': `${this.NAMESPACE}-item`,
            'itemActive': `${this.NAMESPACE}-item--isActive`,
            'itemClone': `${this.NAMESPACE}-item--clone`,
        }
        this._properties = new Map();

        // Class requirement pass check
        // ====================================================================
        this._checkClassRequirements(el);

        // Private properties
        // ====================================================================
        this._animationFunctionHash = {};
        this._slideCount = null;
        this._initialAnimationDelay = 50; // ms in which animation begins
        this._startAnimationUserCallback = () => {};
        this._endAnimationUserCallback = () => {};

        // Create animations
        // ====================================================================
        this._createAnimationFunctions();

        // Elements
        // ====================================================================
        this.elementList = {};
        this.elementList.slider = el;
        this.elementList.containerEl = this.elementList.slider.querySelector(`.${this.CLASS_NAME_LIST.container}`);
        this.elementList.slideArr = this.elementList.containerEl.children;
        this.elementList.slideActiveEl = this.elementList.slideArr[this.options.activeSlide - 1];
        this.elementList.cloneEl = null;
        this._slideCount = this.elementList.slideArr.length;

        // Run methods
        // ====================================================================
        this.setProp('activeSlideIndex', this.options.activeSlide - 1);
        this.setProp('nextActiveSlideIndex', this.options.activeSlide);
        this.setProp('isAnimating', false);

        // DOM manipulation
        // ====================================================================
        this.elementList.slider.classList.add(this.NAMESPACE);

        for (let i = 0; i < this.elementList.slideArr.length; i++) {
            let itemEl = this.elementList.slideArr[i]

            itemEl.classList.add(this.CLASS_NAME_LIST.item);
        }

        this._setActiveSlide(this.getProp('activeSlideIndex'));

        this._addCustomAnimationFunctions();
    }

    // ========================================================================
    // Public methods
    // ========================================================================
    // May be useful in future. No events to remove.
    destroy() {
        for (let k in this.CLASS_NAME_LIST) {
            // Only remove sub-module classes that begin with "item"
            // The other items aren't added via the core plugin, so don't
            // remove them.
            if (k.indexOf('item') !== 0) continue;

            let elementList = this.elementList.slider.querySelectorAll(`.${this.CLASS_NAME_LIST[k]}`);

            if (elementList.length) {
                // Loop through elements and remove classes
                for (let i = 0; i < elementList.length; i++) {
                    let element = elementList[i];
                    element.classList.remove(`${this.CLASS_NAME_LIST[k]}`);
                }
            }
        }

        this.elementList.slider.classList.remove(this.NAMESPACE);
    }

    toSlide(params = {}) {
        let {
            index,
            animation,
{'fraction_non_alphanumeric': 0.2798060467769538, 'fraction_numerical': 0.0017113519680547634, 'mean_word_length': 2.603802672147996, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, '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': '7351087', 'n_tokens_mistral': 1693, 'n_tokens_neox': 1606, 'n_words': 270}