'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var normalizeComponent = require('./normalize-component-6fa50395.js');
var ThemeMixin = require('./ThemeMixin-37dd1318.js');
var fieldAtom = require('./field-atom-d871ec6f.js');

//
var SIZE_DEFAULT_STROKE = 188.4; // For initial state progress must show `action` like something is processing.
// But if progress have `0` value, circle will be static and '0%' title.
// Soo default behavior is always show animated circle without label
// and if progress more than `1`, show progress title

var MIN_PROGRESS_VALUE = 1;
var DEFAULT_VIEW_VALUE = 2;
var MAX_VALUE = 100;
var CIRCLE_PROPS = {
  r: '30px',
  cx: '41px',
  cy: '41px',
  stroke: '#6e32c9'
};
var script = {
  name: 'VProgressCircle',
  CIRCLE_PROPS: CIRCLE_PROPS,
  props: {
    progress: {
      type: [Number, String],
      default: 0
    },
    isLabelVisible: {
      type: Boolean,
      default: false
    },
    lineThickness: {
      type: [Number, String],
      default: 4
    }
  },
  computed: {
    strokeDasharray: function strokeDasharray() {
      var toStroke = Math.floor((this.progressValue - 0) * (SIZE_DEFAULT_STROKE / 100));
      return "".concat(toStroke, ", ").concat(SIZE_DEFAULT_STROKE);
    },
    progressText: function progressText() {
      return "".concat(this.progress, "%");
    },
    progressValue: function progressValue() {
      if (this.progress <= MIN_PROGRESS_VALUE) {
        return DEFAULT_VIEW_VALUE;
      }

      if (this.progress >= MAX_VALUE - MIN_PROGRESS_VALUE) {
        return MAX_VALUE - DEFAULT_VIEW_VALUE;
      }

      return this.progress;
    },
    isShowProgress: function isShowProgress() {
      return this.isLabelVisible && this.progress >= MIN_PROGRESS_VALUE;
    }
  },
  mixins: [ThemeMixin.ThemeMixin],
  components: {
    FieldAtom: fieldAtom.FieldAtom
  }
};

/* script */
const __vue_script__ = script;

/* template */
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('field-atom',{staticClass:"v-progress-circle",class:_vm.themeCssClass},[_c('svg',{staticClass:"v-progress-circle-back"},[_c('circle',{attrs:{"r":_vm.$options.CIRCLE_PROPS.r,"cx":_vm.$options.CIRCLE_PROPS.cx,"cy":_vm.$options.CIRCLE_PROPS.cy,"stroke-width":_vm.lineThickness}})]),_vm._v(" "),_c('svg',{staticClass:"v-progress-circle-over",style:({ strokeDasharray: _vm.strokeDasharray })},[_c('circle',{attrs:{"r":_vm.$options.CIRCLE_PROPS.r,"cx":_vm.$options.CIRCLE_PROPS.cx,"cy":_vm.$options.CIRCLE_PROPS.cy,"stroke":_vm.$options.CIRCLE_PROPS.stroke,"stroke-width":_vm.lineThickness}})]),_vm._v(" "),(_vm.isShowProgress)?_c('span',{staticClass:"v-progress-circle-text"},[_vm._v("\n    "+_vm._s(_vm.progressText)+"\n  ")]):_vm._e()])};
var __vue_staticRenderFns__ = [];

  /* style */
  const __vue_inject_styles__ = undefined;
  /* scoped */
  const __vue_scope_id__ = undefined;
  /* module identifier */
  const __vue_module_identifier__ = undefined;
  /* functional template */
  const __vue_is_functional_template__ = false;
  /* style inject */
  
  /* style inject SSR */
  

  
  var VProgressCircle = normalizeComponent.__vue_normalize__(
    { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
    __vue_inject_styles__,
    __vue_script__,
    __vue_scope_id__,
    __vue_is_functional_template__,
    __vue_module_identifier__,
    undefined,
    undefined
  );

exports.default = VProgressCircle;
