<commit_before>import { $, fastdom, getIndex, toJQuery, Transition } from '../util/index';
import { Class, Toggable } from '../mixin/index';

export default function (UIkit) {

    UIkit.component('accordion', {

        mixins: [Class, Toggable],

        props: {
            targets: String,
            active: null,
            collapsible: Boolean,
            multiple: Boolean,
            toggle: String,
            content: String,
            transition: String
        },

        defaults: {
            targets: '> *',
            active: false,
            animation: true,
            collapsible: true,
            multiple: false,
            clsOpen: 'uk-open',
            toggle: '.uk-accordion-title',
            content: '.uk-accordion-content',
            transition: 'ease'
        },

        ready() {

            this.items = toJQuery(this.targets, this.$el);

            if (!this.items) {
                return;
            }

            this.$el.on('click', `${this.targets} ${this.toggle}`, e => {
                e.preventDefault();
                this.show(this.items.find(this.toggle).index(e.currentTarget));
            });

            fastdom.mutate(() => {
                this.items.each((i, el) => {
                    el = $(el);
                    this.toggleNow(el.find(this.content), el.hasClass(this.clsOpen));
                });
            });

            var active = this.active !== false && toJQuery(this.items.eq(Number(this.active))) || !this.collapsible && toJQuery(this.items.eq(0));
            if (active && !active.hasClass(this.clsOpen)) {
                fastdom.mutate(() => {
                    this.show(active, false);
                });
            }
        },

        methods: {

            show(item, animate) {

                var index = getIndex(item, this.items),
                    active = this.items.filter(`.${this.clsOpen}`);<commit_msg>cleanup<commit_after>import { $, fastdom, getIndex, toJQuery, Transition } from '../util/index';
import { Class, Toggable } from '../mixin/index';

export default function (UIkit) {

    UIkit.component('accordion', {

        mixins: [Class, Toggable],

        props: {
            targets: String,
            active: null,
            collapsible: Boolean,
            multiple: Boolean,
            toggle: String,
            content: String,
            transition: String
        },

        defaults: {
            targets: '> *',
            active: false,
            animation: true,
            collapsible: true,
            multiple: false,
            clsOpen: 'uk-open',
            toggle: '.uk-accordion-title',
            content: '.uk-accordion-content',
            transition: 'ease'
        },

        ready() {

            this.items = toJQuery(this.targets, this.$el);

            if (!this.items) {
                return;
            }

            this.$el.on('click', `${this.targets} ${this.toggle}`, e => {
                e.preventDefault();
                this.show(this.items.find(this.toggle).index(e.currentTarget));
            });

            fastdom.mutate(() =>
                this.items.each((i, el) => {
                    el = $(el);
                    this.toggleNow(el.find(this.content), el.hasClass(this.clsOpen));
                })
            );

            var active = this.active !== false && toJQuery(this.items.eq(Number(this.active))) || !this.collapsible && toJQuery(this.items.eq(0));
            if (active && !active.hasClass(this.clsOpen)) {
                fastdom.mutate(() => this.show(active, false));
            }
        },

        methods: {

            show(item, animate) {

                var index = getIndex(item, this.items),
                    active = this.items.filter(`.${this.clsOpen}`);
{'fraction_non_alphanumeric': 0.14521625163826998, 'fraction_numerical': 0.0005242463958060288, 'mean_word_length': 1.4243964421855146, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1970389', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1019, 'n_words': 189}