import { toRefs as R, defineAsyncComponent as e, computed as s, ref as o, onMounted as w, watch as G, shallowReactive as tt, openBlock as c, createElementBlock as et, normalizeStyle as ot, createElementVNode as it, createBlock as m, createCommentVNode as M, createTextVNode as at, toDisplayString as nt, resolveDynamicComponent as rt, mergeProps as lt, toHandlers as ut, createSlots as st, renderList as ct, withCtx as gt, renderSlot as pt, normalizeProps as mt, guardReactiveProps as dt } from "vue";
import $ from "./BaseIcon-CgOl0yXt.js";
const Vt = { style: { width: "36px" } }, kt = {
  __name: "vue-data-ui",
  props: {
    component: { type: String },
    dataset: { type: [Object, Array, Number, String] },
    config: { type: Object }
  },
  emits: [
    "selectLegend",
    "selectDatapoint",
    "toggleOpenState",
    "saveAnnotations",
    "selectRoot",
    "selectBranch",
    "selectNut",
    "change",
    "selectPlot",
    "selectSide",
    "rate",
    "postImage",
    "hoverIndex",
    "selectX",
    "toggleLock",
    "toggleTooltip",
    "start",
    "play",
    "pause",
    "reset",
    "restart",
    "lap",
    "toggleAnnotator"
  ],
  setup(W, { expose: X, emit: Q }) {
    const n = W, { component: Ut, dataset: j, config: z } = R(n), g = {
      VueUi3dBar: e(() => import("./vue-ui-3d-bar-vIP3nCRG.js")),
      VueUiAgePyramid: e(() => import("./vue-ui-age-pyramid-C15VX7G1.js")),
      VueUiAnnotator: e(() => import("./vue-ui-annotator-BhtsSaDR.js")),
      VueUiCandlestick: e(() => import("./vue-ui-candlestick-BLWsnTPr.js")),
      VueUiChestnut: e(() => import("./vue-ui-chestnut-DZPVlG7z.js")),
      VueUiDashboard: e(() => import("./vue-ui-dashboard-BJBOz0tQ.js")),
      VueUiDigits: e(() => import("./vue-ui-digits-a0Wd0sll.js")),
      VueUiDonut: e(() => import("./vue-ui-donut-Cm1k9I1a.js")),
      VueUiDonutEvolution: e(() => import("./vue-ui-donut-evolution-khk-S3e6.js")),
      VueUiGalaxy: e(() => import("./vue-ui-galaxy-L_b8up-c.js")),
      VueUiGauge: e(() => import("./vue-ui-gauge-i1loUdwb.js")),
      VueUiHeatmap: e(() => import("./vue-ui-heatmap-BMCUahJg.js")),
      VueUiKpi: e(() => import("./vue-ui-kpi-DG85na3Z.js")),
      VueUiMiniLoader: e(() => import("./vue-ui-mini-loader-g-wfME0o.js")),
      VueUiMolecule: e(() => import("./vue-ui-molecule-C22D7jDQ.js")),
      VueUiMoodRadar: e(() => import("./vue-ui-mood-radar-DHqkzff5.js")),
      VueUiNestedDonuts: e(() => import("./vue-ui-nested-donuts-CfvBkvqM.js")),
      VueUiOnion: e(() => import("./vue-ui-onion-BFtuRugn.js")),
      VueUiQuadrant: e(() => import("./vue-ui-quadrant-Cd2G90CO.js")),
      VueUiRadar: e(() => import("./vue-ui-radar-CtHDktMI.js")),
      VueUiRating: e(() => import("./vue-ui-rating-CYgVuBjo.js")),
      VueUiRelationCircle: e(() => import("./vue-ui-relation-circle-ejvqhT4b.js")),
      VueUiRings: e(() => import("./vue-ui-rings-KD_QCsYE.js")),
      VueUiScatter: e(() => import("./vue-ui-scatter-DOH1HPw3.js")),
      VueUiScreenshot: e(() => import("./vue-ui-screenshot-BITjkBS9.js")),
      VueUiSkeleton: e(() => import("./vue-ui-skeleton-Bo8ydREb.js")),
      VueUiSmiley: e(() => import("./vue-ui-smiley-BqHQ_97X.js")),
      VueUiSparkbar: e(() => import("./vue-ui-sparkbar-DV71hamO.js")),
      VueUiSparkgauge: e(() => import("./vue-ui-sparkgauge-DJxWC0FB.js")),
      VueUiSparkHistogram: e(() => import("./vue-ui-sparkhistogram-C_oCdruX.js")),
      VueUiSparkline: e(() => import("./vue-ui-sparkline-famAF3Kt.js")),
      VueUiSparkStackbar: e(() => import("./vue-ui-sparkstackbar-BLq5OGLn.js")),
      VueUiTable: e(() => import("./vue-ui-table-0jjDpR0j.js")),
      VueUiTableSparkline: e(() => import("./vue-ui-table-sparkline-BJ6dbbuD.js")),
      VueUiThermometer: e(() => import("./vue-ui-thermometer-f0uNNHZ1.js")),
      VueUiTiremarks: e(() => import("./vue-ui-tiremarks-CqeZ7inu.js")),
      VueUiTreemap: e(() => import("./vue-ui-treemap-DZPMwhAL.js")),
      VueUiVerticalBar: e(() => import("./vue-ui-vertical-bar-BuoDiJN8.js")),
      VueUiWaffle: e(() => import("./vue-ui-waffle-DhZwKoIz.js")),
      VueUiWheel: e(() => import("./vue-ui-wheel-HzkUuTdN.js")),
      VueUiXy: e(() => import("./vue-ui-xy-Br-7q7r_.js")),
      VueUiTableHeatmap: e(() => import("./vue-ui-table-heatmap-d9ATqjZ8.js")),
      VueUiAccordion: e(() => import("./vue-ui-accordion-BnV2tlGp.js")),
      VueUiQuickChart: e(() => import("./vue-ui-quick-chart-DjbkyEAn.js")),
      VueUiCursor: e(() => import("./vue-ui-cursor-DCiuO-e6.js")),
      VueUiSparkTrend: e(() => import("./vue-ui-spark-trend-BRK61Rnt.js")),
      VueUiStripPlot: e(() => import("./vue-ui-strip-plot-DsZccTxg.js")),
      VueUiDumbbell: e(() => import("./vue-ui-dumbbell-dKD-xCij.js")),
      VueUiWordCloud: e(() => import("./vue-ui-word-cloud-C3W2SptW.js")),
      VueUiXyCanvas: e(() => import("./vue-ui-xy-canvas-BpjQGfiF.js")),
      VueUiFlow: e(() => import("./vue-ui-flow-D5ZIyvku.js")),
      VueUiParallelCoordinatePlot: e(() => import("./vue-ui-parallel-coordinate-plot-BhbIRdY8.js")),
      VueUiTimer: e(() => import("./vue-ui-timer-CJm3cvYi.js")),
      VueUiCarouselTable: e(() => import("./vue-ui-carousel-table-xhtSLVVG.js")),
      VueUiGizmo: e(() => import("./vue-ui-gizmo-BhADCvS5.js")),
      VueUiStackbar: e(() => import("./vue-ui-stackbar-CI6DowT7.js")),
      VueUiBullet: e(() => import("./vue-ui-bullet-dHDkKetX.js")),
      VueUiFunnel: e(() => import("./vue-ui-funnel-CjcbxEZl.js")),
      VueUiHistoryPlot: e(() => import("./vue-ui-history-plot-Bh1B6SDn.js"))
    }, K = {
      VueUi3dBar: ["config", "dataset"],
      VueUiAgePyramid: ["config", "dataset"],
      VueUiAnnotator: ["config", "dataset"],
      VueUiCandlestick: ["config", "dataset"],
      VueUiChestnut: ["config", "dataset"],
      VueUiDashboard: ["config", "dataset"],
      VueUiDigits: ["config", "dataset"],
      VueUiDonut: ["config", "dataset"],
      VueUiDonutEvolution: ["config", "dataset"],
      VueUiGalaxy: ["config", "dataset"],
      VueUiGauge: ["config", "dataset"],
      VueUiHeatmap: ["config", "dataset"],
      VueUiKpi: ["config", "dataset"],
      VueUiMiniLoader: ["config"],
      VueUiMolecule: ["config", "dataset"],
      VueUiMoodRadar: ["config", "dataset"],
      VueUiNestedDonuts: ["config", "dataset"],
      VueUiOnion: ["config", "dataset"],
      VueUiQuadrant: ["config", "dataset"],
      VueUiRadar: ["config", "dataset"],
      VueUiRating: ["config", "dataset"],
      VueUiRelationCircle: ["config", "dataset"],
      VueUiRings: ["config", "dataset"],
      VueUiScatter: ["config", "dataset"],
      VueUiScreenshot: ["config"],
      VueUiSkeleton: ["config"],
      VueUiSmiley: ["config", "dataset"],
      VueUiSparkbar: ["config", "dataset"],
      VueUiSparkgauge: ["config", "dataset"],
      VueUiSparkHistogram: ["config", "dataset"],
      VueUiSparkline: ["config", "dataset"],
      VueUiSparkStackbar: ["config", "dataset"],
      VueUiTable: ["config", "dataset"],
      VueUiTableSparkline: ["config", "dataset"],
      VueUiThermometer: ["config", "dataset"],
      VueUiTiremarks: ["config", "dataset"],
      VueUiTreemap: ["config", "dataset"],
      VueUiVerticalBar: ["config", "dataset"],
      VueUiWaffle: ["config", "dataset"],
      VueUiWheel: ["config", "dataset"],
      VueUiXy: ["config", "dataset"],
      VueUiTableHeatmap: ["config", "dataset"],
      VueUiAccordion: ["config"],
      VueUiQuickChart: ["config", "dataset"],
      VueUiCursor: ["config"],
      VueUiSparkTrend: ["config", "dataset"],
      VueUiStripPlot: ["config", "dataset"],
      VueUiDumbbell: ["config", "dataset"],
      VueUiWordCloud: ["config", "dataset"],
      VueUiXyCanvas: ["config", "dataset"],
      VueUiFlow: ["config", "dataset"],
      VueUiParallelCoordinatePlot: ["config", "dataset"],
      VueUiTimer: ["config"],
      VueUiCarouselTable: ["config", "dataset"],
      VueUiGizmo: ["config", "dataset"],
      VueUiStackbar: ["config", "dataset"],
      VueUiBullet: ["config", "dataset"],
      VueUiFunnel: ["config", "dataset"],
      VueUiHistoryPlot: ["config", "dataset"]
    }, d = s(() => !g[n.component]), q = s(() => g[n.component] || null), i = o(null), Y = s(() => {
      const t = K[n.component] || [], a = {};
      return t.includes("config") && (a.config = z.value), t.includes("dataset") && (a.dataset = j.value), a;
    }), V = o(() => null), U = o(() => null), f = o(() => null), v = o(() => null), k = o(() => null), S = o(() => null), h = o(() => null), y = o(() => null), b = o(() => null), A = o(() => null), T = o(() => null), C = o(() => null), P = o(() => null), D = o(() => null), x = o(() => null), I = o(() => null), F = o(() => null), H = o(() => null), L = o(() => null), B = o(() => null), E = o(() => null), _ = o(() => null), O = o(() => null), N = o(() => null);
    w(() => {
      if (d.value)
        throw new Error(`

Vue Data UI exception:
The provided component "${n.component}" does not exist. Check the spelling.

Available components:

${Object.keys(g).map((t) => `. ${t}
`).join("")}`);
    }), G(i, async (t) => {
      t && (t.generatePdf && (V.value = t.generatePdf), t.generateImage && (f.value = t.generateImage), t.generateCsv && (U.value = t.generateCsv), t.getItemsPositions && (v.value = t.getItemsPositions), t.toggleReadonly && (k.value = t.toggleReadonly), t.shoot && (S.value = t.shoot), t.close && (h.value = t.close), t.restoreOrder && (y.value = t.restoreOrder), t.recalculateHeight && (b.value = t.recalculateHeight), t.toggleLock && (A.value = t.toggleLock), t.toggleTable && (T.value = t.toggleTable), t.toggleLabels && (C.value = t.toggleLabels), t.toggleSort && (P.value = t.toggleSort), t.toggleStack && (D.value = t.toggleStack), t.toggleTooltip && (x.value = t.toggleTooltip), t.start && (I.value = t.start), t.pause && (F.value = t.pause), t.reset && (H.value = t.reset), t.restart && (L.value = t.restart), t.lap && (B.value = t.lap), t.toggleAnimation && (E.value = t.toggleAnimation), t.pauseAnimation && (_.value = t.pauseAnimation), t.resumeAnimation && (O.value = t.resumeAnimation), t.toggleAnnotator && (N.value = t.toggleAnnotator));
    });
    const J = () => {
      const t = [
        "selectLegend",
        "selectDatapoint",
        "toggleOpenState",
        "saveAnnotations",
        "selectRoot",
        "selectBranch",
        "selectNut",
        "change",
        "selectPlot",
        "selectSide",
        "rate",
        "postImage",
        "hoverIndex",
        "selectX",
        "toggleLock",
        "toggleTooltip",
        "start",
        "pause",
        "reset",
        "restart",
        "lap",
        "toggleAnimation",
        "pauseAnimation",
        "resumeAnimation",
        "toggleAnnotator"
      ], a = {};
      return t.forEach((p) => {
        a[p] = (...u) => Q(p, ...u);
      }), a;
    }, r = tt([]);
    G([r, i], () => {
      if (i.value)
        for (; r.length; ) {
          const [t, ...a] = r.shift();
          typeof i.value[t] == "function" && i.value[t](...a);
        }
    }), X({
      getData: (...t) => i.value && typeof i.value.getData == "function" ? i.value.getData() : r.push(["getData", ...t]),
      generatePdf: V,
      generateCsv: U,
      generateImage: f,
      getItemsPositions: v,
      toggleReadonly: k,
      shoot: S,
      close: h,
      restoreOrder: y,
      recalculateHeight: b,
      toggleLock: A,
      toggleTable: T,
      toggleLabels: C,
      toggleSort: P,
      toggleStack: D,
      toggleTooltip: x,
      start: I,
      pause: F,
      reset: H,
      restart: L,
      lap: B,
      pauseAnimation: _,
      resumeAnimation: O,
      toggleAnimation: E,
      toggleAnnotator: N
    });
    const l = s(() => {
      let t = `The provided component ${n.component} does not exist.`;
      return ["VueUiIcon", "VueUiPattern", "Arrow"].includes(n.component) ? (t = `${n.component} is not supported by the VueDataUi universal component. You must import it individually.`, console.warn(t), {
        status: "notSupported",
        message: t
      }) : (console.warn(t), {
        status: "unknown",
        message: t
      });
    });
    return (t, a) => d.value ? (c(), et("div", {
      key: 0,
      style: ot({
        width: "100%",
        display: "flex",
        gap: "6px",
        alignItems: "center",
        color: l.value.status === "notSupported" ? "#FF9000" : "#FF0000"
      })
    }, [
      it("div", Vt, [
        l.value.status === "unknown" ? (c(), m($, {
          key: 0,
          name: "moodFlat",
          stroke: "#FF0000"
        })) : M("", !0),
        l.value.status === "notSupported" ? (c(), m($, {
          key: 1,
          name: "circleExclamation",
          stroke: "#FF9000"
        })) : M("", !0)
      ]),
      at(" " + nt(l.value.message), 1)
    ], 4)) : (c(), m(rt(q.value), lt({
      key: 1,
      ref_key: "currentComponentRef",
      ref: i
    }, Y.value, ut(J())), st({ _: 2 }, [
      ct(t.$slots, (p, u) => ({
        name: u,
        fn: gt((Z) => [
          pt(t.$slots, u, mt(dt(Z)))
        ])
      }))
    ]), 1040));
  }
};
export {
  kt as default
};
