import '@das-fed/upf-ui/packages/components/progress/style.css';
import { withInstall as S } from "@das-fed/upf-utils/with-install/index";
import { ElIcon as W, ElProgress as F } from "element-plus/es";
import "element-plus/es/components/base/style/css";
import "element-plus/es/components/progress/style/css";
import "element-plus/es/components/icon/style/css";
import { defineComponent as _, openBlock as t, createElementBlock as r, createElementVNode as v, useCssVars as O, computed as n, ref as R, normalizeStyle as P, createVNode as V, mergeProps as j, withCtx as b, createCommentVNode as l, renderSlot as q, Fragment as G, toDisplayString as u, createBlock as y, unref as h, normalizeClass as E } from "vue";
import { DasAutoRegisterIcon as H, DasIcon as I } from "@das-fed/upf-ui/packages/components/icon/index";
import { t as w } from "@das-fed/upf-web/packages/i18n/index";
/*! Element Plus Icons Vue v2.3.2 */
var J = /* @__PURE__ */ _({
  name: "CloseBold",
  __name: "close-bold",
  setup(s) {
    return (d, e) => (t(), r("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      v("path", {
        fill: "currentColor",
        d: "M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496"
      })
    ]));
  }
}), K = J, Q = /* @__PURE__ */ _({
  name: "Select",
  __name: "select",
  setup(s) {
    return (d, e) => (t(), r("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      v("path", {
        fill: "currentColor",
        d: "M77.248 415.04a64 64 0 0 1 90.496 0l226.304 226.304L846.528 188.8a64 64 0 1 1 90.56 90.496l-543.04 543.04-316.8-316.8a64 64 0 0 1 0-90.496"
      })
    ]));
  }
}), U = Q;
const X = {
  key: 0,
  class: "percentage-color"
}, Y = { key: 0 }, Z = { class: "percentage-value" }, ee = { key: 1 }, te = { class: "percentage-value" }, se = { key: 1 }, oe = {
  key: 0,
  class: "end-text"
}, le = {
  key: 1,
  class: "end-text"
}, re = {
  key: 0,
  class: "line-left"
}, ae = { key: 1 }, ne = { key: 2 }, ie = {
  key: 1,
  class: "tip-circle"
}, ce = /* @__PURE__ */ _({
  __name: "Index",
  props: {
    modelValue: { default: 0 },
    type: { default: "line" },
    tipType: { default: "percentage" },
    percentages: { default: 100 },
    strokeWidth: {},
    width: { default: 88 },
    status: {},
    textMap: { default: void 0 },
    showText: { type: Boolean },
    showAnimation: { type: Boolean, default: !0 },
    showTextTip: { type: Boolean, default: !0 },
    showProcessTip: { type: Boolean, default: !0 },
    showEndText: { type: Boolean, default: !1 },
    singleTipPosition: { default: "" }
  },
  setup(s, { expose: d }) {
    O((a) => ({
      v65035b45: A.value
    }));
    const e = s;
    H({
      success: import("@das-fed/upf-ui/packages/icons/success"),
      reload: import("@das-fed/upf-ui/packages/icons/reload")
    });
    const g = n(() => e.textMap ?? [w("正在加载中..."), w("加载失败"), w("加载成功")]), i = n(() => e.tipType === "percentage" ? 100 : e.percentages), c = n(() => {
      let a = e.modelValue;
      return a < 0 && (a = 0), a > i.value && (a = i.value), a;
    }), L = n(() => e.tipType === "percentage" ? c.value : c.value !== 0 ? Number(c.value / i.value) * 100 : 0), o = n(() => !e.status || e.status === "normal" ? i.value > 0 && c.value === i.value ? "success" : "normal" : e.status), M = n(() => {
      if (e.strokeWidth)
        return e.strokeWidth;
      if (e.type === "line") return 8;
      if (e.type === "circle") return 4;
    }), z = n(() => {
      if (e.showText)
        return e.showText;
      if (e.type === "line") return !1;
      if (e.type === "circle") return !0;
    }), m = {
      normal: "var(--upf-color-primary)",
      success: "var(--upf-color-success)",
      exception: "var(--upf-color-error)"
    }, x = n(() => m[o.value] || m.normal), A = n(() => o.value === "normal" ? "var(--upf-text-secondary)" : m[o.value] || m.normal), k = n(() => {
      let a = 1;
      return o.value === "normal" && (a = 0), o.value === "exception" && (a = 1), o.value === "success" && (a = 2), g.value[a];
    }), $ = n(() => {
      if (["success", "exception"].includes(o.value)) return "center";
      if (f.value && p.value) return "";
      if (e.singleTipPosition) return e.singleTipPosition;
      if (!f.value && p.value) return "right";
      if (f.value && !p.value) return "left";
    }), p = n(() => ["success", "exception"].includes(o.value) ? !1 : e.showProcessTip), f = n(() => e.showTextTip), T = R(null);
    return d({
      $progress: T
    }), (a, B) => {
      const D = W, N = F;
      return t(), r(
        "div",
        {
          class: "das-ui-progress",
          style: P({ display: s.type == "circle" ? "inline-block" : "block" })
        },
        [
          v(
            "div",
            {
              class: "percentage-graph",
              style: P({ width: s.type == "circle" ? s.width + "px" : "100%" })
            },
            [
              V(N, j({
                ref_key: "$progress",
                ref: T,
                class: {
                  showLoading: e.showAnimation && e.type === "line" && o.value === "normal" && !a.$attrs.indeterminate
                },
                type: s.type
              }, a.$attrs, {
                color: x.value,
                percentage: L.value,
                width: s.width,
                "stroke-width": M.value,
                "show-text": z.value
              }), {
                default: b(({ percentage: C }) => [
                  l(" @slot 默认插槽 "),
                  q(a.$slots, "default", { percentage: C }, () => [
                    e.type === "circle" ? (t(), r(
                      G,
                      { key: 0 },
                      [
                        o.value === "normal" ? (t(), r("div", X, [
                          s.tipType === "percentage" ? (t(), r("div", Y, [
                            v(
                              "span",
                              Z,
                              u(C),
                              1
                              /* TEXT */
                            ),
                            B[0] || (B[0] = v(
                              "span",
                              null,
                              "%",
                              -1
                              /* CACHED */
                            ))
                          ])) : l("v-if", !0),
                          s.tipType === "score" ? (t(), r("div", ee, [
                            v(
                              "span",
                              te,
                              u(c.value + "/" + i.value),
                              1
                              /* TEXT */
                            )
                          ])) : l("v-if", !0)
                        ])) : (t(), r("div", se, [
                          V(D, { size: 40 }, {
                            default: b(() => [
                              o.value === "success" ? (t(), y(h(U), {
                                key: 0,
                                color: x.value
                              }, null, 8, ["color"])) : l("v-if", !0),
                              o.value === "exception" ? (t(), y(h(K), {
                                key: 1,
                                color: x.value
                              }, null, 8, ["color"])) : l("v-if", !0)
                            ]),
                            _: 1
                            /* STABLE */
                          })
                        ]))
                      ],
                      64
                      /* STABLE_FRAGMENT */
                    )) : l("v-if", !0)
                  ], !0)
                ]),
                _: 3
                /* FORWARDED */
              }, 16, ["class", "type", "color", "percentage", "width", "stroke-width", "show-text"]),
              e.type === "line" ? (t(), r(
                "div",
                {
                  key: 0,
                  class: E(["line-icon", o.value])
                },
                [
                  s.tipType === "percentage" && s.showEndText && o.value === "normal" ? (t(), r(
                    "span",
                    oe,
                    u(c.value) + "%",
                    1
                    /* TEXT */
                  )) : l("v-if", !0),
                  s.tipType === "score" && s.showEndText && o.value === "normal" ? (t(), r(
                    "span",
                    le,
                    u(c.value + "/" + i.value),
                    1
                    /* TEXT */
                  )) : l("v-if", !0),
                  o.value === "success" ? (t(), y(h(I), {
                    key: 2,
                    icon: "success",
                    "icon-color": "#12AA53",
                    "custom-size": "14px"
                  })) : l("v-if", !0),
                  o.value === "exception" ? (t(), y(h(I), {
                    key: 3,
                    icon: "reload",
                    "icon-color": "red",
                    "custom-size": "16px"
                  })) : l("v-if", !0)
                ],
                2
                /* CLASS */
              )) : l("v-if", !0)
            ],
            4
            /* STYLE */
          ),
          e.type === "line" && (f.value || p.value) ? (t(), r(
            "div",
            {
              key: 0,
              class: E(["tip-line", $.value])
            },
            [
              f.value ? (t(), r(
                "div",
                re,
                u(k.value),
                1
                /* TEXT */
              )) : l("v-if", !0),
              s.tipType === "percentage" && p.value ? (t(), r(
                "div",
                ae,
                u(c.value) + "%",
                1
                /* TEXT */
              )) : l("v-if", !0),
              s.tipType === "score" && p.value ? (t(), r(
                "div",
                ne,
                u(c.value + "/" + i.value),
                1
                /* TEXT */
              )) : l("v-if", !0)
            ],
            2
            /* CLASS */
          )) : l("v-if", !0),
          e.type === "circle" ? (t(), r(
            "div",
            ie,
            u(k.value),
            1
            /* TEXT */
          )) : l("v-if", !0)
        ],
        4
        /* STYLE */
      );
    };
  }
}), ue = (s, d) => {
  const e = s.__vccOpts || s;
  for (const [g, i] of d)
    e[g] = i;
  return e;
}, pe = /* @__PURE__ */ ue(ce, [["__scopeId", "data-v-52282ce8"]]), we = S(pe);
export {
  we as DasProgress,
  we as default
};
