<commit_before>const ResourceService = require("services/ResourceService");

Vue.component("quantity-input", {

    props: [
        "value",
        "timeout",
        "min",
        "max",
        "vertical",
        "template",
        "waiting",
        "variationId"
    ],

    data()
    {
        return {
            timeoutHandle: null,
            internalMin: null,
            internalMax: null,
            basketItems: [],
            currentCount: 0
        };
    },

    created()
    {
        this.$options.template = this.template;
    },

    ready()
    {
        ResourceService.bind("basketItems", this);

        this.checkDefaultVars();
        this.initDefaultVars();
        this.initValueWatcher();

        if (!this.vertical)
        {
            this.initBasketValueWatcher();
            this.handleMissingItems();
        }
    },

    methods:
    {
        countValueUp()
        {
            if (!(this.max && this.value === this.internalMax) && !this.waiting)
            {
                this.value++;
            }
        },

        countValueDown()
        {
            if (!(this.min && this.value === this.min && this.min === this.internalMin) && !this.waiting)
            {
                this.value--;
            }
        },

        checkDefaultVars()
        {
            this.min = this.min === 0 ? null : this.min;
            this.max = this.max === 0 ? null : this.max;
        },

        initDefaultVars()
        {
            this.timeout = this.timeout || 300;
            this.internalMin = this.min || 1;
            this.internalMax = this.max || 9999;
            this.vertical = this.vertical || false;
        },

        initValueWatcher()
        {
            this.$watch("value", newValue =>
            {
                if (newValue < this.internalMin)
                {
                    this.value = this.internalMin;
                }
<commit_msg>fix value counter<commit_after>const ResourceService = require("services/ResourceService");

Vue.component("quantity-input", {

    props: [
        "value",
        "timeout",
        "min",
        "max",
        "vertical",
        "template",
        "waiting",
        "variationId"
    ],

    data()
    {
        return {
            timeoutHandle: null,
            internalMin: null,
            internalMax: null,
            basketItems: [],
            currentCount: 0
        };
    },

    created()
    {
        this.$options.template = this.template;
    },

    ready()
    {
        ResourceService.bind("basketItems", this);

        this.checkDefaultVars();
        this.initDefaultVars();
        this.initValueWatcher();

        if (!this.vertical)
        {
            this.initBasketValueWatcher();
            this.handleMissingItems();
        }
    },

    methods:
    {
        countValueUp()
        {
            if (!(this.value === this.internalMax) && !this.waiting)
            {
                this.value++;
            }
        },

        countValueDown()
        {
            if (!(this.value === this.internalMin) && !this.waiting)
            {
                this.value--;
            }
        },

        checkDefaultVars()
        {
            this.min = this.min === 0 ? null : this.min;
            this.max = this.max === 0 ? null : this.max;
        },

        initDefaultVars()
        {
            this.timeout = this.timeout || 300;
            this.internalMin = this.min || 1;
            this.internalMax = this.max || 9999;
            this.vertical = this.vertical || false;
        },

        initValueWatcher()
        {
            this.$watch("value", newValue =>
            {
                if (newValue < this.internalMin)
                {
                    this.value = this.internalMin;
                }

{'fraction_non_alphanumeric': 0.12909138517936633, 'fraction_numerical': 0.005760670332547788, 'mean_word_length': 1.2248107163657542, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2555406', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1018, 'n_words': 170}