<commit_before>import Vue from 'vue'

import BtnMixin from './btn-mixin.js'
import QIcon from '../icon/QIcon.js'
import QSpinner from '../spinner/QSpinner.js'
import { between } from '../../utils/format.js'
import { stopAndPrevent } from '../../utils/event.js'

export default Vue.extend({
  name: 'QBtn',

  mixins: [ BtnMixin ],

  props: {
    percentage: Number,
    darkPercentage: Boolean
  },

  computed: {
    hasPercentage () {
      return this.percentage !== void 0
    },

    width () {
      return `${between(this.percentage, 0, 100)}%`
    },

    hasLabel () {
      return this.label && this.isRectangle
    }
  },

  methods: {
    click (e) {
      if (e.defaultPrevented) { return }

      if (document.activeElement !== this.$el || (e instanceof PointerEvent && !e.screenX && !e.screenY)) {
        stopAndPrevent(e)
        e.preventRipple = true
        this.$el.focus()
        return
      }

      this.to !== void 0 && e && stopAndPrevent(e)

      const go = () => {
        this.$router[this.replace ? 'replace' : 'push'](this.to)
      }

      this.$emit('click', e, go)
      this.to !== void 0 && e.navigate !== false && go()
    },

    __onKeydown (e) {
      const classes = this.$el.classList
      if ([13, 32].includes(e.keyCode)) {
        !this.isLink && e.preventDefault()<commit_msg>[v1] QBtn: prevent errors on PointerEvent on Firefox mobile (#2657)<commit_after>import Vue from 'vue'

import BtnMixin from './btn-mixin.js'
import QIcon from '../icon/QIcon.js'
import QSpinner from '../spinner/QSpinner.js'
import { between } from '../../utils/format.js'
import { stopAndPrevent } from '../../utils/event.js'
import { isSSR } from '../../plugins/platform.js'

const isIESubmit = isSSR || window.PointerEvent === void 0
  ? () => false
  : e => e instanceof PointerEvent && !e.screenX && !e.screenY

export default Vue.extend({
  name: 'QBtn',

  mixins: [ BtnMixin ],

  props: {
    percentage: Number,
    darkPercentage: Boolean
  },

  computed: {
    hasPercentage () {
      return this.percentage !== void 0
    },

    width () {
      return `${between(this.percentage, 0, 100)}%`
    },

    hasLabel () {
      return this.label && this.isRectangle
    }
  },

  methods: {
    click (e) {
      if (e.defaultPrevented) { return }

      if (document.activeElement !== this.$el || isIESubmit(e)) {
        stopAndPrevent(e)
        e.preventRipple = true
        this.$el.focus()
        return
      }

      this.to !== void 0 && e && stopAndPrevent(e)

      const go = () => {
        this.$router[this.replace ? 'replace' : 'push'](this.to)
      }

      this.$emit('click', e, go)
      this.to !== void 0 && e.navigate !== false && go()
    },

    __onKeydown (e) {
      const classes = this.$el.classList
      if ([13, 32].includes(e.keyCode)) {
        !this.isLink && e.preventDefault()
{'fraction_non_alphanumeric': 0.16835841792089604, 'fraction_numerical': 0.009800490024501224, 'mean_word_length': 2.3584018801410105, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5276406', 'n_tokens_mistral': 988, 'n_tokens_neox': 949, 'n_words': 219}