import { defineComponent as C, computed as d, createElementBlock as l, openBlock as n, normalizeStyle as T, createBlock as h, toDisplayString as m, unref as y, withCtx as $, createElementVNode as r, onBeforeMount as z, Fragment as v, renderList as f, createVNode as B, createTextVNode as I } from "vue";
import { U as x, l as R, L as j, O as F } from "./start-BYfL32Oe.mjs";
import { useI18n as M } from "vue-i18n";
import { storeToRefs as U } from "pinia";
import "vue-router";
import "./header-Droxy2Kd.mjs";
import "./moment-h96o7c8I.mjs";
const b = {
  0: "alert",
  30: "secondary_7",
  80: "secondary_6",
  100: "primary"
}, P = { key: 0 }, q = { class: "completeness-value__percentage" }, A = /* @__PURE__ */ C({
  __name: "CompletenessValue",
  props: {
    value: {},
    hideCircle: { type: Boolean }
  },
  setup(u) {
    const e = u, c = d(() => {
      var t;
      return e.value ? ((t = Object.entries(b).find(
        ([p]) => Number(p) >= e.value
      )) == null ? void 0 : t[1]) ?? b[0] : b[0];
    });
    return (t, p) => (n(), l("div", {
      class: "completeness-value",
      style: T(`--value-color: rgb(var(--v-theme-${c.value}))`)
    }, [
      t.hideCircle ? (n(), l("span", P, m(t.value) + "%", 1)) : (n(), h(y(x), {
        key: 1,
        "model-value": t.value,
        error: !t.value
      }, {
        default: $(() => [
          r("div", q, m(t.value) + "%", 1)
        ]),
        _: 1
      }, 8, ["model-value", "error"]))
    ], 4));
  }
}), G = /* @__PURE__ */ R(A, [["__scopeId", "data-v-4511641e"]]), H = { class: "w-100" }, J = { class: "d-flex justify-center align-center my-1" }, K = { key: 0 }, Q = { class: "ml-2" }, D = /* @__PURE__ */ C({
  __name: "CompletenessByScopes",
  props: {
    data: {},
    languages: {},
    scopes: {}
  },
  setup(u) {
    const e = u, { t: c } = M(), t = j(), { getCountryFlag: p } = U(t), { ensureCountries: o } = t, i = d(() => {
      const _ = e.data.completeness[0] ? {
        0: {
          id: 0,
          name: c("datahub-plugin.completeness.notScopable")
        }
      } : {};
      return e.scopes.reduce((s, a) => (s[a.id] = a, s), _);
    }), w = d(() => {
      const _ = e.data.completeness[0] ? {
        0: {
          id: 0,
          name: c("datahub-plugin.completeness.singleLanguage")
        }
      } : {};
      return e.languages.reduce((s, a) => (s[a.id] = a, s), _);
    });
    return z(o), (_, s) => (n(), l("table", H, [
      s[1] || (s[1] = r("colgroup", null, [
        r("col", { style: { width: "150px" } })
      ], -1)),
      r("thead", null, [
        r("tr", null, [
          s[0] || (s[0] = r("th", null, null, -1)),
          (n(!0), l(v, null, f(i.value, ({ id: a, name: g }) => (n(), l("th", { key: a }, m(g), 1))), 128))
        ])
      ]),
      r("tbody", null, [
        (n(!0), l(v, null, f(w.value, ({ id: a, key: g, name: O }) => (n(), l("tr", { key: a }, [
          r("td", J, [
            g ? (n(), l(v, { key: 1 }, [
              B(y(F), {
                icon: y(p)(g)
              }, null, 8, ["icon"]),
              r("b", Q, m(g), 1)
            ], 64)) : (n(), l("b", K, m(O), 1))
          ]),
          (n(!0), l(v, null, f(i.value, ({ id: S }) => {
            var k, V, E, L;
            return n(), l("td", {
              key: S,
              class: "pt-2 px-2"
            }, [
              B(G, {
                value: (L = (E = (V = (k = _.data) == null ? void 0 : k.completeness) == null ? void 0 : V[S]) == null ? void 0 : E[a]) == null ? void 0 : L.completeness
              }, null, 8, ["value"])
            ]);
          }), 128))
        ]))), 128))
      ])
    ]));
  }
});
function N(u) {
  const e = u;
  e.__i18n = e.__i18n || [], e.__i18n.push({
    locale: "",
    resource: {
      "en-US": {
        "datahub-plugin": {
          completeness: {
            singleLanguage: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Single Language" } },
            notScopable: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Not scopable" } }
          }
        }
      },
      "de-DE": {
        "datahub-plugin": {
          completeness: {
            singleLanguage: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Einzelne Sprache" } },
            notScopable: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Nicht skalierbar" } }
          }
        }
      }
    }
  });
}
typeof N == "function" && N(D);
const le = /* @__PURE__ */ C({
  __name: "DatahubDataTypeCompletenessRenderer",
  props: {
    row: {},
    rowIndex: {},
    cell: {},
    cellValue: {},
    dataTypeInstance: {},
    modelValue: {},
    extended: { type: Boolean },
    languages: {},
    scopes: {}
  },
  setup(u) {
    const e = u, c = d(
      () => {
        var o, i;
        return e.extended && ((o = e.languages) == null ? void 0 : o.length) && ((i = e.scopes) == null ? void 0 : i.length) && typeof e.cellValue != "number";
      }
    ), t = d(() => {
      var o;
      return typeof e.cellValue == "number" ? e.cellValue : ((o = e.cellValue) == null ? void 0 : o.totalCompleteness) ?? 0;
    }), p = d(() => t.value >= 100 ? "accent" : t.value >= 80 ? "secondary_4" : t.value > 30 ? "secondary_7" : "error");
    return (o, i) => c.value ? (n(), h(D, {
      key: 0,
      data: e.cellValue,
      languages: o.languages,
      scopes: o.scopes
    }, null, 8, ["data", "languages", "scopes"])) : (n(), h(y(x), {
      key: 1,
      "model-value": t.value,
      color: p.value,
      size: "28"
    }, {
      default: $(() => [
        I(m(t.value) + "% ", 1)
      ]),
      _: 1
    }, 8, ["model-value", "color"]));
  }
});
export {
  G as C,
  le as _
};
