import '@das-fed/ui/packages/components/progress/style.css';
import { withInstall as N } from "@das-fed/utils/with-install/index";
import { ElProgress as S, ElIcon as W } 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 w, createElementBlock as l, openBlock as s, createElementVNode as v, useCssVars as F, computed as a, ref as R, normalizeStyle as V, createCommentVNode as o, createVNode as b, mergeProps as O, withCtx as P, renderSlot as j, Fragment as q, toDisplayString as u, createBlock as _, unref as g, normalizeClass as C } from "vue";
import { DasAutoRegisterIcon as G, DasIcon as z } from "@das-fed/ui/packages/components/icon/index";
import { getVarValue as H, getVar as J, setThemeRule as K } from "@das-fed/web/packages/theme/index";
import { t as h } from "@das-fed/web/packages/i18n/index";
/*! Element Plus Icons Vue v2.3.1 */
var Q = /* @__PURE__ */ w({
  name: "CloseBold",
  __name: "close-bold",
  setup(c) {
    return (d, t) => (s(), l("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.496z"
      })
    ]));
  }
}), U = Q, X = /* @__PURE__ */ w({
  name: "Select",
  __name: "select",
  setup(c) {
    return (d, t) => (s(), l("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.496z"
      })
    ]));
  }
}), Y = X;
const Z = {
  key: 0,
  class: "percentage-color"
}, ee = { key: 0 }, te = { class: "percentage-value" }, se = { key: 1 }, re = { class: "percentage-value" }, oe = { key: 1 }, le = {
  key: 0,
  class: "end-text"
}, ae = {
  key: 1,
  class: "end-text"
}, ie = {
  key: 0,
  class: "line-left"
}, ne = { key: 1 }, ue = { key: 2 }, ce = {
  key: 1,
  class: "tip-circle"
}, pe = /* @__PURE__ */ w({
  __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(c, { expose: d }) {
    F((e) => ({
      "56b97d1c": I.value
    }));
    const t = c;
    G({
      success: import("@das-fed/ui/packages/icons/success"),
      reload: import("@das-fed/ui/packages/icons/reload")
    });
    const y = a(() => t.textMap ?? [h("正在加载中..."), h("加载失败"), h("加载成功")]), i = a(() => t.tipType === "percentage" ? 100 : t.percentages), n = a(() => {
      let e = t.modelValue;
      return e < 0 && (e = 0), e > i.value && (e = i.value), e;
    }), E = a(() => t.tipType === "percentage" ? n.value : n.value !== 0 ? Number(n.value / i.value) * 100 : 0), r = a(() => !t.status || t.status === "normal" ? i.value > 0 && n.value === i.value ? "success" : "normal" : t.status), $ = a(() => {
      if (t.strokeWidth)
        return t.strokeWidth;
      if (t.type === "line") return 8;
      if (t.type === "circle") return 4;
    }), A = a(() => {
      if (t.showText)
        return t.showText;
      if (t.type === "line") return !1;
      if (t.type === "circle") return !0;
    }), m = a(() => H(`--das-ui-progress-${r.value}`).value || ""), I = a(() => {
      let e = "";
      return r.value === "normal" ? e = "--das-ui-progress-percentage-tip" : e = `--das-ui-progress-${r.value}`, J(e);
    }), k = a(() => {
      let e = 1;
      return r.value === "normal" && (e = 0), r.value === "exception" && (e = 1), r.value === "success" && (e = 2), y.value[e];
    }), L = a(() => {
      if (["success", "exception"].includes(r.value)) return "center";
      if (f.value && p.value) return "";
      if (t.singleTipPosition) return t.singleTipPosition;
      if (!f.value && p.value) return "right";
      if (f.value && !p.value) return "left";
    }), p = a(() => ["success", "exception"].includes(r.value) ? !1 : t.showProcessTip), f = a(() => t.showTextTip), T = R(null);
    return d({
      $progress: T
    }), (e, x) => {
      const M = W, D = S;
      return s(), l(
        "div",
        {
          class: "das-ui-progress",
          style: V({ display: e.type == "circle" ? "inline-block" : "block" })
        },
        [
          v(
            "div",
            {
              class: "percentage-graph",
              style: V({ width: e.type == "circle" ? e.width + "px" : "100%" })
            },
            [
              b(D, O({
                ref_key: "$progress",
                ref: T,
                class: {
                  showLoading: t.showAnimation && t.type === "line" && r.value === "normal" && !e.$attrs.indeterminate
                },
                type: e.type
              }, e.$attrs, {
                color: m.value,
                percentage: E.value,
                width: e.width,
                "stroke-width": $.value,
                "show-text": A.value
              }), {
                default: P(({ percentage: B }) => [
                  o(" @slot 默认插槽 "),
                  j(e.$slots, "default", { percentage: B }, () => [
                    t.type === "circle" ? (s(), l(
                      q,
                      { key: 0 },
                      [
                        r.value === "normal" ? (s(), l("div", Z, [
                          e.tipType === "percentage" ? (s(), l("div", ee, [
                            v(
                              "span",
                              te,
                              u(B),
                              1
                              /* TEXT */
                            ),
                            x[0] || (x[0] = v(
                              "span",
                              null,
                              "%",
                              -1
                              /* HOISTED */
                            ))
                          ])) : o("v-if", !0),
                          e.tipType === "score" ? (s(), l("div", se, [
                            v(
                              "span",
                              re,
                              u(n.value + "/" + i.value),
                              1
                              /* TEXT */
                            )
                          ])) : o("v-if", !0)
                        ])) : (s(), l("div", oe, [
                          b(M, { size: 40 }, {
                            default: P(() => [
                              r.value === "success" ? (s(), _(g(Y), {
                                key: 0,
                                color: m.value
                              }, null, 8, ["color"])) : o("v-if", !0),
                              r.value === "exception" ? (s(), _(g(U), {
                                key: 1,
                                color: m.value
                              }, null, 8, ["color"])) : o("v-if", !0)
                            ]),
                            _: 1
                            /* STABLE */
                          })
                        ]))
                      ],
                      64
                      /* STABLE_FRAGMENT */
                    )) : o("v-if", !0)
                  ], !0)
                ]),
                _: 3
                /* FORWARDED */
              }, 16, ["class", "type", "color", "percentage", "width", "stroke-width", "show-text"]),
              t.type === "line" ? (s(), l(
                "div",
                {
                  key: 0,
                  class: C(["line-icon", r.value])
                },
                [
                  e.tipType === "percentage" && e.showEndText && r.value === "normal" ? (s(), l(
                    "span",
                    le,
                    u(n.value) + "%",
                    1
                    /* TEXT */
                  )) : o("v-if", !0),
                  e.tipType === "score" && e.showEndText && r.value === "normal" ? (s(), l(
                    "span",
                    ae,
                    u(n.value + "/" + i.value),
                    1
                    /* TEXT */
                  )) : o("v-if", !0),
                  r.value === "success" ? (s(), _(g(z), {
                    key: 2,
                    icon: "success",
                    "icon-color": "#12AA53",
                    "custom-size": "14px"
                  })) : o("v-if", !0),
                  r.value === "exception" ? (s(), _(g(z), {
                    key: 3,
                    icon: "reload",
                    "icon-color": "red",
                    "custom-size": "16px"
                  })) : o("v-if", !0)
                ],
                2
                /* CLASS */
              )) : o("v-if", !0)
            ],
            4
            /* STYLE */
          ),
          t.type === "line" && (f.value || p.value) ? (s(), l(
            "div",
            {
              key: 0,
              class: C(["tip-line", L.value])
            },
            [
              f.value ? (s(), l(
                "div",
                ie,
                u(k.value),
                1
                /* TEXT */
              )) : o("v-if", !0),
              e.tipType === "percentage" && p.value ? (s(), l(
                "div",
                ne,
                u(n.value) + "%",
                1
                /* TEXT */
              )) : o("v-if", !0),
              e.tipType === "score" && p.value ? (s(), l(
                "div",
                ue,
                u(n.value + "/" + i.value),
                1
                /* TEXT */
              )) : o("v-if", !0)
            ],
            2
            /* CLASS */
          )) : o("v-if", !0),
          t.type === "circle" ? (s(), l(
            "div",
            ce,
            u(k.value),
            1
            /* TEXT */
          )) : o("v-if", !0)
        ],
        4
        /* STYLE */
      );
    };
  }
}), ve = (c, d) => {
  const t = c.__vccOpts || c;
  for (const [y, i] of d)
    t[y] = i;
  return t;
}, de = /* @__PURE__ */ ve(pe, [["__scopeId", "data-v-c07cb4f9"]]), fe = {
  "--das-ui-progress-normal": "#5582F3",
  "--das-ui-progress-success": "#1BA854",
  "--das-ui-progress-exception": "#FB2323",
  "--das-ui-progress-percentage-text": "#212121",
  "--das-ui-progress-percentage-tip": "#666666",
  "--das-ui-progress-loading-start": "#64abff",
  "--das-ui-progress-loading-end": "#276ff5"
};
K(fe);
const Be = N(de);
export {
  Be as DasProgress,
  Be as default
};
