import { computed as g, ref as c, watch as Ht, onMounted as Yt, onBeforeUnmount as qt, openBlock as n, createElementBlock as i, normalizeClass as z, unref as t, normalizeStyle as W, createBlock as _, createCommentVNode as d, createSlots as Jt, withCtx as m, renderSlot as y, normalizeProps as M, guardReactiveProps as R, createVNode as tt, createElementVNode as $, Fragment as P, renderList as T, toDisplayString as U, createTextVNode as Tt, nextTick as Kt } from "vue";
import { u as Qt, c as Zt, t as te, a as ee, p as x, o as oe, e as F, b as ae, g as xt, d as Ot, O as At, v as re, i as Nt, f as V, X as le, s as et, w as ne, P as St, x as se, y as ie, q as ue, r as ce } from "./index-WrV3SAID.js";
import { t as de, u as pe } from "./useResponsive-CoxXLe23.js";
import { _ as he } from "./Title-BR-xoRp4.js";
import { u as ge, U as fe } from "./usePrinter-kVpf1iV8.js";
import { _ as ye } from "./Tooltip-ho4JxRm-.js";
import ve from "./vue-ui-sparkbar-BjpcvwYW.js";
import { L as me } from "./Legend-7H4oi6Sq.js";
import { D as be } from "./DataTable-DNPvKWC0.js";
import ke from "./vue-ui-skeleton-Qec_XSRf.js";
import Ce from "./vue-ui-accordion-BQCDXXDs.js";
import { u as Ft } from "./useNestedProp-Cj0kHD7k.js";
import { _ as we } from "./PackageVersion-1NslmM8M.js";
import { P as _e } from "./PenAndPaper-BF1ZRVm3.js";
import { u as $e } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as Pe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Te = ["id"], xe = ["xmlns", "viewBox"], Oe = ["width", "height"], Ae = ["id"], Ne = ["stop-color"], Se = ["stop-color"], Fe = { key: 1 }, Ie = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], Le = { key: 0 }, ze = ["d", "stroke", "stroke-width"], Me = ["d", "stroke", "stroke-width"], Re = { key: 2 }, Ue = ["x", "y", "text-anchor", "font-size", "fill", "onMouseenter"], Ve = ["points", "stroke", "stroke-width"], Ee = ["points", "stroke", "stroke-width", "fill"], Be = { key: 3 }, De = ["cx", "cy", "fill", "r", "stroke"], Ge = {
  key: 5,
  class: "vue-data-ui-watermark"
}, We = ["onClick"], Xe = {
  key: 0,
  style: { "max-width": "200px", margin: "0 auto" }
}, je = {
  __name: "vue-ui-radar",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  emits: ["selectLegend"],
  setup(It, { expose: Lt, emit: zt }) {
    const { vue_ui_radar: Mt } = Qt(), f = It, I = g(() => !!f.dataset && Object.keys(f.dataset).length), w = c(Zt()), Rt = c(null), X = c(!1), j = c(""), ot = c(0), O = c(null), at = c(null), rt = c(null), lt = c(null), nt = c(null), st = c(0), it = c(0), ut = c(0), e = g({
      get: () => pt(),
      set: (o) => o
    }), { userOptionsVisible: H, setUserOptionsVisibility: ct, keepUserOptionState: dt } = $e({ config: e.value });
    function pt() {
      const o = Ft({
        userConfig: f.config,
        defaultConfig: Mt
      });
      return o.theme ? {
        ...Ft({
          userConfig: te.vue_ui_radar[o.theme] || f.config,
          defaultConfig: o
        }),
        customPalette: ee[o.theme] || x
      } : o;
    }
    Ht(() => f.config, (o) => {
      e.value = pt(), H.value = !e.value.showOnChartHover, ht(), st.value += 1, it.value += 1, ut.value += 1;
    }, { deep: !0 });
    const E = c(null);
    function ht() {
      if (oe(f.dataset) && F({
        componentName: "VueUiRadar",
        type: "dataset"
      }), e.value.responsive) {
        const o = de(() => {
          const { width: a, height: r } = pe({
            chart: O.value,
            title: e.value.style.chart.title.text ? at.value : null,
            legend: e.value.style.chart.legend.show ? rt.value : null,
            source: lt.value,
            noTitle: nt.value
          });
          u.value.width = a, u.value.height = r;
        });
        E.value = new ResizeObserver(o), E.value.observe(O.value.parentNode);
      }
    }
    Yt(() => {
      ht();
    }), qt(() => {
      E.value && E.value.disconnect();
    });
    const { isPrinting: gt, isImaging: ft, generatePdf: yt, generateImage: vt } = ge({
      elementId: `vue-ui-radar_${w.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-radar"
    }), Ut = g(() => e.value.userOptions.show && !e.value.style.chart.title.text), mt = g(() => ae(e.value.customPalette)), k = c({
      dataLabels: {
        show: e.value.style.chart.layout.labels.dataLabels.show
      },
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), Vt = g(() => ({
      style: {
        backgroundColor: e.value.style.chart.tooltip.backgroundColor,
        animation: {
          show: e.value.style.chart.tooltip.animation.show,
          animationFrames: e.value.style.chart.tooltip.animation.animationFrames
        },
        labels: {
          fontSize: e.value.style.chart.tooltip.fontSize,
          name: {
            color: e.value.style.chart.tooltip.color
          }
        },
        gutter: {
          backgroundColor: "#CCCCCC",
          opacity: 30
        }
      }
    })), u = c({
      height: 312,
      width: 512
    }), Et = zt, p = c([]), L = c(null), A = c(!1);
    function bt(o) {
      A.value = !0, p.value.includes(o) ? (L.value = o, p.value = p.value.filter((a) => a !== o), setTimeout(() => {
        A.value = !1, L.value = null;
      }, 500)) : (p.value.push(o), setTimeout(() => {
        A.value = !1;
      }, 500)), Et("selectLegend", N.value.filter((a, r) => !p.value.includes(r)).map((a) => ({
        name: a.name,
        color: a.color,
        proportion: a.totalProportion
      })));
    }
    function Bt() {
      return N.value.map((o) => ({
        name: o.name,
        color: o.color,
        proportion: o.totalProportion
      }));
    }
    const v = g(() => [null, void 0].includes(f.dataset.categories) ? (F({
      componentName: "VueUiRadar",
      type: "datasetAttribute",
      property: "categories ({ name: string; prefix?: string; suffix?: string}[])"
    }), []) : (f.dataset.categories.length === 0 ? F({
      componentName: "VueUiRadar",
      type: "datasetAttributeEmpty",
      property: "categories"
    }) : f.dataset.categories.forEach((o, a) => {
      xt({
        datasetObject: o,
        requiredAttributes: ["name"]
      }).forEach((r) => {
        F({
          componentName: "VueUiRadar",
          type: "datasetAttribute",
          property: `category.${r} at index ${a}`,
          index: a
        });
      });
    }), [null, void 0].includes(f.dataset.series) ? F({
      componentName: "VueUiRadar",
      type: "datasetAttribute",
      property: "series ({ name: string; values: number[]; color?: string; target: number}[])"
    }) : f.dataset.series.forEach((o, a) => {
      xt({
        datasetObject: o,
        requiredAttributes: ["name", "values", "target"]
      }).forEach((r) => {
        F({
          componentName: "VueUiRadar",
          type: "datasetSerieAttribute",
          key: "series",
          property: r,
          index: a
        });
      });
    }), f.dataset.categories.map((o, a) => ({
      name: o.name,
      categoryId: `radar_category_${w.value}_${a}`,
      color: Ot(o.color) || mt.value[a] || x[a] || x[a % x.length],
      prefix: o.prefix ?? "",
      suffix: o.suffix ?? ""
    })))), b = g(() => I.value ? f.dataset.series.map((o, a) => ({
      ...o,
      color: Ot(o.color) || mt.value[a] || x[a] || x[a % x.length],
      serieId: `radar_serie_${w.value}_${a}`,
      formatter: o.formatter || null
    })) : []), kt = g(() => Math.max(...b.value.flatMap((o) => o.values))), Ct = g(() => b.value.length), Y = g(() => Math.min(u.value.width, u.value.height) / 3), wt = g(() => At({
      plot: { x: u.value.width / 2, y: u.value.height / 2 },
      radius: Y.value,
      sides: Ct.value,
      rotation: 0
    })), Dt = g(() => {
      const o = [];
      for (let a = 0; a < Y.value; a += Y.value / e.value.style.chart.layout.grid.graduations)
        o.push(a);
      return o;
    }), C = g(() => wt.value.coordinates.map((o, a) => {
      const r = b.value[a].values.map((l) => Gt({
        centerX: u.value.width / 2,
        centerY: u.value.height / 2,
        apexX: o.x,
        apexY: o.y,
        proportion: l / (b.value[a].target || kt.value)
      }));
      return {
        ...o,
        ...b.value[a],
        plots: r
      };
    }));
    function q({ x: o, y: a }) {
      let r = "middle";
      return o = Math.round(o), a = Math.round(a), o > u.value.width / 2 && (o += 12, r = "start"), o < u.value.width / 2 && (o -= 12, r = "end"), a > u.value.height / 2 && (a += 20), a < u.value.height / 2 && (a -= 12), a === u.value.height / 2 && (a += 4), { x: o, y: a, anchor: r };
    }
    function Gt({ centerX: o, centerY: a, apexX: r, apexY: l, proportion: s }) {
      return {
        x: o + (r - o) * s,
        y: a + (l - a) * s
      };
    }
    const N = g(() => {
      const o = b.value.map((a, r) => a.values.map((l) => l / (a.target || kt.value)));
      return v.value.map((a, r) => ({
        ...a,
        totalProportion: re(o.map((l) => l[r]).reduce((l, s) => l + s, 0) / b.value.length),
        shape: "circle",
        opacity: p.value.includes(r) ? 0.5 : 1,
        segregate: () => bt(r),
        isSegregated: p.value.includes(r)
      }));
    }), Wt = g(() => ({
      cy: "radar-div-legend",
      backgroundColor: e.value.style.chart.legend.backgroundColor,
      color: e.value.style.chart.legend.color,
      fontSize: e.value.style.chart.legend.fontSize,
      paddingBottom: 12,
      fontWeight: e.value.style.chart.legend.bold ? "bold" : ""
    })), B = g(() => {
      const o = [
        { name: e.value.translations.datapoint, color: "" },
        { name: e.value.translations.target, color: "" },
        ...N.value
      ], a = f.dataset.series.map((l) => [
        l.name,
        Nt(
          l.formatter,
          l.target,
          V({
            p: l.prefix,
            v: l.target,
            s: l.suffix,
            r: e.value.table.td.roundingValue
          })
        ),
        ...l.values.map((s, h) => `${Nt(
          l.formatter,
          s,
          V({ p: v.value[h].prefix, v: s, s: v.value[h].suffix, r: e.value.table.td.roundingValue })
        )} (${isNaN(s / l.target) ? "" : V({
          v: s / l.target * 100,
          s: "%",
          r: e.value.table.td.roundingPercentage
        })})`)
      ]), r = {
        th: {
          backgroundColor: e.value.table.th.backgroundColor,
          color: e.value.table.th.color,
          outline: e.value.table.th.outline
        },
        td: {
          backgroundColor: e.value.table.td.backgroundColor,
          color: e.value.table.td.color,
          outline: e.value.table.td.outline
        },
        breakpoint: e.value.table.responsiveBreakpoint
      };
      return { head: o, body: a, config: r, colNames: o };
    }), D = c(null), J = c([]), K = c(null);
    function Xt(o, a) {
      J.value = [], D.value = a, X.value = !0;
      let r = "";
      K.value = {
        datapoint: o,
        seriesIndex: a,
        series: {
          categories: v.value,
          datapoints: b.value,
          radar: C.value
        },
        config: e.value
      };
      const l = e.value.style.chart.tooltip.customFormat;
      if (se(l) && ie(() => l({
        seriesIndex: a,
        datapoint: o,
        series: { categories: v.value, datapoints: b.value, radar: C.value },
        config: e.value
      })))
        j.value = l({
          seriesIndex: a,
          datapoint: o,
          series: { categories: v.value, datapoints: b.value, radar: C.value },
          config: e.value
        });
      else {
        r += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${o.name}</div>`;
        for (let s = 0; s < o.values.length; s += 1)
          p.value.includes(s) || J.value.push({
            name: v.value[s].name,
            value: o.values[s] / o.target * 100,
            color: v.value[s].color,
            suffix: "%)",
            prefix: `${V({ p: v.value[s].prefix ?? "", v: o.values[s], s: v.value[s].suffix ?? "", r: e.value.style.chart.tooltip.roundingValue })} (`,
            rounding: e.value.style.chart.tooltip.roundingPercentage,
            formatter: o.formatter
          });
        j.value = r;
      }
    }
    function _t() {
      Kt(() => {
        const o = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [""]], a = [[""], [e.value.translations.target], ...N.value.flatMap((h) => [[h.name], ["%"]])], r = f.dataset.series.map((h, He) => [h.name, h.target, ...h.values.flatMap((Z) => [
          Z,
          isNaN(Z / h.target) ? "" : Z / h.target * 100
        ])]), l = o.concat([a]).concat(r), s = ue(l);
        ce({ csvContent: s, title: e.value.style.chart.title.text || "vue-ui-radar" });
      });
    }
    const S = c(!1);
    function jt(o) {
      S.value = o, ot.value += 1;
    }
    function $t() {
      k.value.showTable = !k.value.showTable;
    }
    function Pt() {
      k.value.showTooltip = !k.value.showTooltip;
    }
    const G = c(!1);
    function Q() {
      G.value = !G.value;
    }
    return Lt({
      getData: Bt,
      generatePdf: yt,
      generateCsv: _t,
      generateImage: vt,
      toggleTable: $t,
      toggleTooltip: Pt,
      toggleAnnotator: Q
    }), (o, a) => (n(), i("div", {
      class: z(`vue-ui-radar ${t(S) ? "vue-data-ui-wrapper-fullscreen" : ""} ${t(e).useCssAnimation ? "" : "vue-ui-dna"}`),
      ref_key: "radarChart",
      ref: O,
      id: `vue-ui-radar_${t(w)}`,
      style: W(`font-family:${t(e).style.fontFamily};width:100%; ${t(e).responsive ? "height: 100%;" : ""} text-align:center;background:${t(e).style.chart.backgroundColor}`),
      onMouseenter: a[3] || (a[3] = () => t(ct)(!0)),
      onMouseleave: a[4] || (a[4] = () => t(ct)(!1))
    }, [
      t(e).userOptions.buttons.annotator ? (n(), _(_e, {
        key: 0,
        parent: t(O),
        backgroundColor: t(e).style.chart.backgroundColor,
        color: t(e).style.chart.color,
        active: t(G),
        onClose: Q
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : d("", !0),
      t(Ut) ? (n(), i("div", {
        key: 1,
        ref_key: "noTitle",
        ref: nt,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : d("", !0),
      t(e).style.chart.title.text ? (n(), i("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: at,
        style: "width:100%;background:transparent;padding-bottom:12px"
      }, [
        (n(), _(he, {
          key: `title_${t(st)}`,
          config: {
            title: {
              cy: "radar-div-title",
              ...t(e).style.chart.title
            },
            subtitle: {
              cy: "radar-div-subtitle",
              ...t(e).style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : d("", !0),
      t(e).userOptions.show && t(I) && (t(dt) || t(H)) ? (n(), _(fe, {
        ref_key: "details",
        ref: Rt,
        key: `user_options_${t(ot)}`,
        backgroundColor: t(e).style.chart.backgroundColor,
        color: t(e).style.chart.color,
        isImaging: t(ft),
        isPrinting: t(gt),
        uid: t(w),
        hasTooltip: t(e).userOptions.buttons.tooltip && t(e).style.chart.tooltip.show,
        hasPdf: t(e).userOptions.buttons.pdf,
        hasImg: t(e).userOptions.buttons.img,
        hasXls: t(e).userOptions.buttons.csv,
        hasTable: t(e).userOptions.buttons.table,
        hasFullscreen: t(e).userOptions.buttons.fullscreen,
        isFullscreen: t(S),
        isTooltip: t(k).showTooltip,
        titles: { ...t(e).userOptions.buttonTitles },
        chartElement: t(O),
        position: t(e).userOptions.position,
        hasAnnotator: t(e).userOptions.buttons.annotator,
        isAnnotation: t(G),
        onToggleFullscreen: jt,
        onGeneratePdf: t(yt),
        onGenerateCsv: _t,
        onGenerateImage: t(vt),
        onToggleTable: $t,
        onToggleTooltip: Pt,
        onToggleAnnotator: Q,
        style: W({
          visibility: t(dt) ? t(H) ? "visible" : "hidden" : "visible"
        })
      }, Jt({ _: 2 }, [
        o.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: m(() => [
            y(o.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        o.$slots.optionPdf ? {
          name: "optionPdf",
          fn: m(() => [
            y(o.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        o.$slots.optionCsv ? {
          name: "optionCsv",
          fn: m(() => [
            y(o.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        o.$slots.optionImg ? {
          name: "optionImg",
          fn: m(() => [
            y(o.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        o.$slots.optionTable ? {
          name: "optionTable",
          fn: m(() => [
            y(o.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        o.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: m(({ toggleFullscreen: r, isFullscreen: l }) => [
            y(o.$slots, "optionFullscreen", M(R({ toggleFullscreen: r, isFullscreen: l })), void 0, !0)
          ]),
          key: "5"
        } : void 0,
        o.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: m(({ toggleAnnotator: r, isAnnotator: l }) => [
            y(o.$slots, "optionAnnotator", M(R({ toggleAnnotator: r, isAnnotator: l })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : d("", !0),
      t(I) ? (n(), i("svg", {
        key: 4,
        xmlns: t(le),
        class: z({ "vue-data-ui-fullscreen--on": t(S), "vue-data-ui-fulscreen--off": !t(S) }),
        viewBox: `0 0 ${t(u).width <= 0 ? 10 : t(u).width} ${t(u).height <= 0 ? 10 : t(u).height}`,
        style: W(`max-width:100%;overflow:visible;background:transparent;color:${t(e).style.chart.color}`)
      }, [
        tt(we),
        o.$slots["chart-background"] ? (n(), i("foreignObject", {
          key: 0,
          x: 0,
          y: 0,
          width: t(u).width <= 0 ? 10 : t(u).width,
          height: t(u).height <= 0 ? 10 : t(u).height,
          style: {
            pointerEvents: "none"
          }
        }, [
          y(o.$slots, "chart-background", {}, void 0, !0)
        ], 8, Oe)) : d("", !0),
        $("defs", null, [
          (n(!0), i(P, null, T(t(v), (r, l) => (n(), i("radialGradient", {
            cx: "50%",
            cy: "50%",
            r: "50%",
            fx: "50%",
            fy: "50%",
            id: `radar_gradient_${t(w)}_${l}`
          }, [
            $("stop", {
              offset: "0%",
              "stop-color": t(et)(t(ne)(r.color, 0.05), t(e).style.chart.layout.dataPolygon.opacity)
            }, null, 8, Ne),
            $("stop", {
              offset: "100%",
              "stop-color": t(et)(r.color, t(e).style.chart.layout.dataPolygon.opacity)
            }, null, 8, Se)
          ], 8, Ae))), 256))
        ]),
        t(e).style.chart.layout.grid.show ? (n(), i("g", Fe, [
          (n(!0), i(P, null, T(t(C), (r) => (n(), i("line", {
            x1: t(u).width / 2,
            y1: t(u).height / 2,
            x2: r.x,
            y2: r.y,
            stroke: t(e).style.chart.layout.grid.stroke,
            "stroke-width": t(e).style.chart.layout.grid.strokeWidth
          }, null, 8, Ie))), 256)),
          t(e).style.chart.layout.grid.graduations > 0 ? (n(), i("g", Le, [
            (n(!0), i(P, null, T(t(Dt), (r) => (n(), i("path", {
              d: t(At)({
                plot: { x: t(u).width / 2, y: t(u).height / 2 },
                radius: r,
                sides: t(Ct),
                rotation: 0
              }).path,
              fill: "none",
              stroke: t(e).style.chart.layout.grid.stroke,
              "stroke-width": t(e).style.chart.layout.grid.strokeWidth
            }, null, 8, ze))), 256))
          ])) : d("", !0)
        ])) : d("", !0),
        $("path", {
          d: t(wt).path,
          fill: "none",
          stroke: t(e).style.chart.layout.outerPolygon.stroke,
          "stroke-width": t(e).style.chart.layout.outerPolygon.strokeWidth,
          "stroke-linejoin": "round",
          "stroke-linecap": "round"
        }, null, 8, Me),
        t(e).style.chart.layout.labels.dataLabels.show ? (n(), i("g", Re, [
          (n(!0), i(P, null, T(t(C), (r, l) => (n(), i("text", {
            x: q(r).x,
            y: q(r).y,
            "text-anchor": q(r).anchor,
            "font-size": t(e).style.chart.layout.labels.dataLabels.fontSize,
            fill: t(e).style.chart.layout.labels.dataLabels.color,
            onMouseenter: (s) => Xt(r, l),
            onMouseleave: a[0] || (a[0] = (s) => {
              X.value = !1, D.value = null;
            })
          }, U(r.name), 41, Ue))), 256))
        ])) : d("", !0),
        (n(!0), i(P, null, T(t(v), (r, l) => (n(), i("g", null, [
          $("g", null, [
            t(e).useCssAnimation || !t(e).useCssAnimation && !t(p).includes(l) ? (n(), i("polygon", {
              key: 0,
              "data-cy-radar-path": "",
              points: t(St)(t(C).map((s) => s.plots[l]), !1, !0),
              stroke: t(e).style.chart.backgroundColor,
              "stroke-width": t(e).style.chart.layout.dataPolygon.strokeWidth + 1,
              fill: "none",
              class: z({ "animated-out": t(p).includes(l) && t(e).useCssAnimation, "animated-in": t(A) && t(L) === l && t(e).useCssAnimation })
            }, null, 10, Ve)) : d("", !0),
            t(e).useCssAnimation || !t(e).useCssAnimation && !t(p).includes(l) ? (n(), i("polygon", {
              key: 1,
              "data-cy-radar-path": "",
              points: t(St)(t(C).map((s) => s.plots[l]), !1, !0),
              stroke: r.color,
              "stroke-width": t(e).style.chart.layout.dataPolygon.strokeWidth,
              fill: t(e).style.chart.layout.dataPolygon.transparent ? "transparent" : t(e).style.chart.layout.dataPolygon.useGradient ? `url(#radar_gradient_${t(w)}_${l})` : t(et)(r.color, t(e).style.chart.layout.dataPolygon.opacity),
              class: z({ "animated-out": t(p).includes(l) && t(e).useCssAnimation, "animated-in": t(A) && t(L) === l && t(e).useCssAnimation })
            }, null, 10, Ee)) : d("", !0)
          ])
        ]))), 256)),
        t(e).style.chart.layout.plots.show ? (n(), i("g", Be, [
          (n(!0), i(P, null, T(t(C), (r, l) => (n(), i("g", null, [
            (n(!0), i(P, null, T(r.plots, (s, h) => (n(), i("circle", {
              cx: s.x,
              cy: s.y,
              fill: t(p).includes(h) ? "transparent" : t(v)[h].color,
              r: t(D) !== null && t(D) === l ? t(e).style.chart.layout.plots.radius * 1.6 : t(e).style.chart.layout.plots.radius,
              stroke: t(p).includes(h) ? "transparent" : t(e).style.chart.backgroundColor,
              "stroke-width": 0.5,
              class: z({ "animated-out": t(p).includes(h) && t(e).useCssAnimation, "animated-in": t(A) && t(L) === h && t(e).useCssAnimation })
            }, null, 10, De))), 256))
          ]))), 256))
        ])) : d("", !0),
        y(o.$slots, "svg", { svg: t(u) }, void 0, !0)
      ], 14, xe)) : d("", !0),
      o.$slots.watermark ? (n(), i("div", Ge, [
        y(o.$slots, "watermark", M(R({ isPrinting: t(gt) || t(ft) })), void 0, !0)
      ])) : d("", !0),
      t(I) ? d("", !0) : (n(), _(ke, {
        key: 6,
        config: {
          type: "radar",
          style: {
            backgroundColor: t(e).style.chart.backgroundColor,
            radar: {
              grid: {
                color: t(e).style.chart.layout.outerPolygon.stroke
              },
              shapes: {
                color: t(e).style.chart.layout.outerPolygon.stroke
              }
            }
          }
        }
      }, null, 8, ["config"])),
      $("div", {
        ref_key: "chartLegend",
        ref: rt
      }, [
        t(e).style.chart.legend.show ? (n(), _(me, {
          key: `legend_${t(ut)}`,
          legendSet: t(N),
          config: t(Wt),
          onClickMarker: a[1] || (a[1] = ({ i: r }) => bt(r))
        }, {
          item: m(({ legend: r, index: l }) => [
            $("div", {
              "data-cy-legend-item": "",
              onClick: (s) => r.segregate(),
              style: W(`opacity:${t(p).includes(l) ? 0.5 : 1}`)
            }, U(r.name) + ": " + U(t(V)({
              v: r.totalProportion * 100,
              s: "%",
              r: t(e).style.chart.legend.roundingPercentage
            })), 13, We)
          ]),
          _: 1
        }, 8, ["legendSet", "config"])) : y(o.$slots, "legend", {
          key: 1,
          legend: t(N)
        }, void 0, !0)
      ], 512),
      o.$slots.source ? (n(), i("div", {
        key: 7,
        ref_key: "source",
        ref: lt,
        dir: "auto"
      }, [
        y(o.$slots, "source", {}, void 0, !0)
      ], 512)) : d("", !0),
      tt(ye, {
        show: t(k).showTooltip && t(X),
        backgroundColor: t(e).style.chart.tooltip.backgroundColor,
        color: t(e).style.chart.tooltip.color,
        borderRadius: t(e).style.chart.tooltip.borderRadius,
        borderColor: t(e).style.chart.tooltip.borderColor,
        borderWidth: t(e).style.chart.tooltip.borderWidth,
        backgroundOpacity: t(e).style.chart.tooltip.backgroundOpacity,
        fontSize: t(e).style.chart.tooltip.fontSize,
        position: t(e).style.chart.tooltip.position,
        offsetY: t(e).style.chart.tooltip.offsetY,
        parent: t(O),
        content: t(j),
        isFullscreen: t(S),
        isCustom: t(e).style.chart.tooltip.customFormat && typeof t(e).style.chart.tooltip.customFormat == "function"
      }, {
        "tooltip-before": m(() => [
          y(o.$slots, "tooltip-before", M(R({ ...t(K) })), void 0, !0)
        ]),
        "tooltip-after": m(() => [
          ["function"].includes(typeof t(e).style.chart.tooltip.customFormat) ? d("", !0) : (n(), i("div", Xe, [
            tt(ve, {
              dataset: t(J),
              config: t(Vt),
              backgroundOpacity: t(e).style.chart.tooltip.backgroundOpacity
            }, null, 8, ["dataset", "config", "backgroundOpacity"])
          ])),
          y(o.$slots, "tooltip-after", M(R({ ...t(K) })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "fontSize", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      t(I) ? (n(), _(Ce, {
        key: 8,
        hideDetails: "",
        config: {
          open: t(k).showTable,
          maxHeight: 1e4,
          body: {
            backgroundColor: t(e).style.chart.backgroundColor,
            color: t(e).style.chart.color
          },
          head: {
            backgroundColor: t(e).style.chart.backgroundColor,
            color: t(e).style.chart.color
          }
        }
      }, {
        content: m(() => [
          (n(), _(be, {
            key: `table_${t(it)}`,
            colNames: t(B).colNames,
            head: t(B).head,
            body: t(B).body,
            config: t(B).config,
            title: `${t(e).style.chart.title.text}${t(e).style.chart.title.subtitle.text ? ` : ${t(e).style.chart.title.subtitle.text}` : ""}`,
            onClose: a[2] || (a[2] = (r) => t(k).showTable = !1)
          }, {
            th: m(({ th: r }) => [
              Tt(U(r.name), 1)
            ]),
            td: m(({ td: r }) => [
              Tt(U(r), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : d("", !0)
    ], 46, Te));
  }
}, co = /* @__PURE__ */ Pe(je, [["__scopeId", "data-v-386b7e4e"]]);
export {
  co as default
};
