'use strict';

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

var vue = require('vue');
require('../../../utils/index.js');
var progressBar = require('./progress-bar.js');
var createNamespace = require('../../../utils/create-namespace.js');

"use strict";
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{ name: "LlProgressBar" },
  __name: "progress-bar",
  props: progressBar.progressBarProps,
  setup(__props) {
    const props = __props;
    const bem = createNamespace.createNamespace("progress-bar");
    const attrs = vue.useAttrs();
    const value = vue.computed(() => {
      const successPercent = props.success?.percent || 0;
      return (percent) => {
        return props.format && typeof props.format === "function" ? props.format(percent, successPercent) : percent;
      };
    });
    const getStrokeColor = vue.computed(() => {
      if (typeof props.strokeColor === "object") {
        if (Object.keys(props.strokeColor).length > 0) {
          if (props.steps && props.steps > 0) {
            return props.strokeColor[Object.keys(props.strokeColor)[0]];
          } else {
            return props.strokeColor;
          }
        } else {
          return void 0;
        }
      } else {
        return props.strokeColor;
      }
    });
    return (_ctx, _cache) => {
      const _component_ll_html = vue.resolveComponent("ll-html");
      const _component_a_progress = vue.resolveComponent("a-progress");
      const _component_ll_tooltip = vue.resolveComponent("ll-tooltip");
      return vue.openBlock(), vue.createBlock(_component_ll_tooltip, {
        open: _ctx.hoverTip ? void 0 : false,
        tip: _ctx.hoverTip,
        "show-container": false
      }, {
        default: vue.withCtx(() => [
          vue.createVNode(_component_a_progress, vue.mergeProps(vue.unref(attrs), {
            success: _ctx.success,
            steps: _ctx.steps,
            "stroke-color": getStrokeColor.value,
            class: [vue.unref(bem).b(), vue.unref(bem).is(_ctx.textPosition)]
          }), vue.createSlots({
            _: 2
            /* DYNAMIC */
          }, [
            _ctx.format || _ctx.$slots.format ? {
              name: "format",
              fn: vue.withCtx((percent) => [
                vue.renderSlot(_ctx.$slots, "format", { percent }, () => [
                  vue.createVNode(_component_ll_html, {
                    value: value.value(percent)
                  }, null, 8, ["value"])
                ])
              ]),
              key: "0"
            } : void 0
          ]), 1040, ["success", "steps", "stroke-color", "class"])
        ]),
        _: 3
        /* FORWARDED */
      }, 8, ["open", "tip"]);
    };
  }
});

exports.default = _sfc_main;
//# sourceMappingURL=progress-bar.vue2.js.map
