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