import { useCssVars as ae, computed as V, defineAsyncComponent as o, ref as r, watch as ue, createElementBlock as y, openBlock as g, createCommentVNode as Y, createElementVNode as b, normalizeStyle as S, createStaticVNode as ie, Fragment as N, renderList as ne, normalizeClass as le, createBlock as re, renderSlot as se, resolveDynamicComponent as de, mergeProps as ce } from "vue";
import he from "./pdf-DhJ5pt15.js";
import { u as ve } from "./useNestedProp-nW23xHng.js";
import { u as pe, c as fe } from "./index-DJL8Ofhe.js";
import { _ as me } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const ge = {
  key: 0,
  "data-dom-to-png-ignore": "",
  style: { width: "100%", display: "flex", "justify-content": "end" }
}, be = ["disabled"], Ue = ["stroke"], Ve = { key: 1 }, ye = ["id"], we = ["onMousedown", "onTouchstart"], ke = ["onMousedown", "onTouchstart"], Te = ["onMousedown", "onTouchstart"], Me = ["onMousedown", "onTouchstart"], Ce = ["onMousedown", "onTouchstart"], z = 1, _e = {
  __name: "vue-ui-dashboard",
  props: {
    dataset: Array,
    config: Object
  },
  emits: ["change"],
  setup(W, { expose: R, emit: B }) {
    ae((e) => ({
      "3d03b7eb": q.value,
      "5286e662": J.value
    }));
    const E = {
      VueDataUi: o(() => import("./vue-data-ui-CgQH4LgG.js")),
      VueUi3dBar: o(() => import("./vue-ui-3d-bar-HpDKnl32.js")),
      VueUiAccordion: o(() => import("./vue-ui-accordion-CFo12sAN.js")),
      VueUiAgePyramid: o(() => import("./vue-ui-age-pyramid-CN-sq5YS.js")),
      VueUiAnnotator: o(() => import("./vue-ui-annotator-D0LfKtI0.js")),
      VueUiCandlestick: o(() => import("./vue-ui-candlestick-CZXoNI5-.js")),
      VueUiChestnut: o(() => import("./vue-ui-chestnut-DtwKoZVx.js")),
      VueUiDigits: o(() => import("./vue-ui-digits-DJbK1Zc6.js")),
      VueUiDonut: o(() => import("./vue-ui-donut-BYzTJfDn.js")),
      VueUiDonutEvolution: o(() => import("./vue-ui-donut-evolution-BrGPzJc1.js")),
      VueUiDumbbell: o(() => import("./vue-ui-dumbbell-Df1Urqjs.js")),
      VueUiFlow: o(() => import("./vue-ui-flow-MlzqqBrd.js")),
      VueUiGalaxy: o(() => import("./vue-ui-galaxy-DOUHqcDm.js")),
      VueUiGauge: o(() => import("./vue-ui-gauge-BbI8A7r2.js")),
      VueUiHeatmap: o(() => import("./vue-ui-heatmap-gEpHCMS4.js")),
      VueUiKpi: o(() => import("./vue-ui-kpi-rNIvGzIt.js")),
      VueUiMiniLoader: o(() => import("./vue-ui-mini-loader-BbgEf7vG.js")),
      VueUiMolecule: o(() => import("./vue-ui-molecule-CesW7xLf.js")),
      VueUiMoodRadar: o(() => import("./vue-ui-mood-radar-CAzWMx5r.js")),
      VueUiNestedDonuts: o(() => import("./vue-ui-nested-donuts-uxgCIhIq.js")),
      VueUiOnion: o(() => import("./vue-ui-onion-LcWmxpSV.js")),
      VueUiParallelCoordinatePlot: o(() => import("./vue-ui-parallel-coordinate-plot-BhAk5SsH.js")),
      VueUiQuadrant: o(() => import("./vue-ui-quadrant-DnOiPnEZ.js")),
      VueUiQuickChart: o(() => import("./vue-ui-quick-chart-BiuwgTza.js")),
      VueUiRadar: o(() => import("./vue-ui-radar-B44Cnogk.js")),
      VueUiRating: o(() => import("./vue-ui-rating-HcMLaCbL.js")),
      VueUiRelationCircle: o(() => import("./vue-ui-relation-circle-D3hnErJq.js")),
      VueUiRings: o(() => import("./vue-ui-rings-D-aQntRc.js")),
      VueUiScatter: o(() => import("./vue-ui-scatter-br228rFX.js")),
      VueUiSkeleton: o(() => import("./vue-ui-skeleton-D7wiUDgm.js")),
      VueUiSmiley: o(() => import("./vue-ui-smiley-DVo_0MHj.js")),
      VueUiSparkHistogram: o(() => import("./vue-ui-sparkhistogram-B7U0t5tO.js")),
      VueUiSparkStackbar: o(() => import("./vue-ui-sparkstackbar-DhVYMKpF.js")),
      VueUiSparkTrend: o(() => import("./vue-ui-spark-trend-D_ModK3j.js")),
      VueUiSparkbar: o(() => import("./vue-ui-sparkbar-D7Vsnq63.js")),
      VueUiSparkgauge: o(() => import("./vue-ui-sparkgauge-DRA3dpfC.js")),
      VueUiSparkline: o(() => import("./vue-ui-sparkline-Dcqe9RMU.js")),
      VueUiStripPlot: o(() => import("./vue-ui-strip-plot-CHPFuwaa.js")),
      VueUiTable: o(() => import("./vue-ui-table-BU_RX8eF.js")),
      VueUiTableHeatmap: o(() => import("./vue-ui-table-heatmap--MfqVTuk.js")),
      VueUiTableSparkline: o(() => import("./vue-ui-table-sparkline-AnQprRCq.js")),
      VueUiThermometer: o(() => import("./vue-ui-thermometer-DEcbD5Vl.js")),
      VueUiTimer: o(() => import("./vue-ui-timer-sF5kCLeW.js")),
      VueUiTiremarks: o(() => import("./vue-ui-tiremarks-CjrIF2Mk.js")),
      VueUiTreemap: o(() => import("./vue-ui-treemap-Bxg0U82X.js")),
      VueUiVerticalBar: o(() => import("./vue-ui-vertical-bar-Bj0TK9XT.js")),
      VueUiWaffle: o(() => import("./vue-ui-waffle-DPDYdYlN.js")),
      VueUiWheel: o(() => import("./vue-ui-wheel-BpzWH2Ar.js")),
      VueUiWordCloud: o(() => import("./vue-ui-word-cloud-ajv3G3Ci.js")),
      VueUiXy: o(() => import("./vue-ui-xy-N35O_x2x.js")),
      VueUiXyCanvas: o(() => import("./vue-ui-xy-canvas-C9PGQ5GZ.js")),
      VueUiCarouselTable: o(() => import("./vue-ui-carousel-table-BJks-t0F.js")),
      VueUiGizmo: o(() => import("./vue-ui-gizmo-CMG7lxqw.js")),
      VueUiStackbar: o(() => import("./vue-ui-stackbar-DXyeVGTw.js")),
      VueUiBullet: o(() => import("./vue-ui-bullet-CIs7dVYD.js")),
      VueUiFunnel: o(() => import("./vue-ui-funnel-DTdKm16w.js")),
      VueUiHistoryPlot: o(() => import("./vue-ui-history-plot-DK23xnI5.js")),
      VueUiCirclePack: o(() => import("./vue-ui-circle-pack-bUeFMf5j.js")),
      VueUiWorld: o(() => import("./vue-ui-world-CQ0SuEaE.js"))
    }, { vue_ui_dashboard: L } = pe(), $ = W, s = V(() => ve({
      userConfig: $.config,
      defaultConfig: L
    })), x = r(fe()), h = r(s.value.locked);
    function F() {
      h.value = !h.value;
    }
    const l = r($.dataset.map((e, t) => ({
      ...e,
      index: t
    }))), D = V(
      () => l.value.map((e) => ({
        ...e,
        resolvedComponent: typeof e.component == "string" ? E[e.component] : e.component
      }))
    ), v = r(null), n = r(null), p = r({ x: 0, y: 0 }), f = r({ x: 0, y: 0 }), d = r(null), c = r(!1), m = r(null), T = r(!1), w = r(!1);
    function P(e) {
      const t = e.target;
      (t.tagName === "INPUT" && t.type === "range" || t.classList.contains("range-handle")) && (w.value = !0);
    }
    function X(e) {
      const t = e.target;
      t.tagName === "INPUT" && t.type === "range" && (w.value = !1);
    }
    function H() {
      T.value = !0, he({
        domElement: document.getElementById(`vue-ui-dashboard_${x.value}`),
        fileName: "vue-ui-dashboard"
      }).finally(() => {
        T.value = !1;
      });
    }
    function A(e) {
      if (!h.value && (c.value = !0, m.value = e, n.value === null)) {
        v.value = e, p.value = { x: event.clientX, y: event.clientY };
        const t = l.value[e], u = 100 - t.width, a = 100 - t.height;
        t.left < 0 && (t.left = 0), t.top < 0 && (t.top = 0), t.left > u && (t.left = u), t.top > a && (t.top = a), t.left < 0 && (t.left = 0), t.top < 0 && (t.top = 0), t.left + t.width > 100 && (t.left = 100 - t.width), t.top + t.height > 100 && (t.top = 100 - t.height);
      }
    }
    function M(e, t) {
      c.value = !0, m.value = e, n.value = { index: e, direction: t };
      const u = l.value[e];
      f.value = { x: event.clientX, y: event.clientY, initialWidth: u.width, initialHeight: u.height };
    }
    function I(e, t, u) {
      if (n.value.direction.includes("top")) {
        const a = e.height - u / d.value.offsetHeight * 100;
        a >= z && (e.top += u / d.value.offsetHeight * 100, e.height = a);
      }
      if (n.value.direction.includes("bottom")) {
        const a = e.height + u / d.value.offsetHeight * 100;
        a >= z && (e.height = a);
      }
      if (n.value.direction.includes("left")) {
        const a = e.width - t / d.value.offsetWidth * 100;
        a >= z && (e.left += t / d.value.offsetWidth * 100, e.width = a);
      }
      if (n.value.direction.includes("right")) {
        const a = e.width + t / d.value.offsetWidth * 100;
        a >= z && (e.width = a);
      }
    }
    function G(e) {
      if (!(h.value || w.value)) {
        if (c.value = !0, v.value !== null) {
          const t = l.value[v.value], u = e.clientX - p.value.x, a = e.clientY - p.value.y, i = t.left + u / d.value.offsetWidth * 100, U = t.top + a / d.value.offsetHeight * 100;
          i >= 0 && U >= 0 && i + t.width <= 100 && U + t.height <= 100 && (t.left = i, t.top = U), p.value = { x: e.clientX, y: e.clientY };
        }
        if (n.value !== null) {
          const t = l.value[n.value.index], u = e.clientX - f.value.x, a = e.clientY - f.value.y;
          I(t, u, a), f.value = { x: e.clientX, y: e.clientY };
        }
      }
    }
    const O = B;
    ue(
      l,
      (e) => {
        e && !c.value && O("change", l.value);
      },
      { deep: !0 }
    );
    function j() {
      v.value = null, n.value = null, c.value = !1, m.value = null, l.value.forEach((e) => {
        e.left = Math.round(e.left / 100 * 100), e.top = Math.round(e.top / 100 * 100), e.width = Math.round(e.width / 100 * 100), e.height = Math.round(e.height / 100 * 100);
      });
    }
    function Q(e) {
      h.value || w.value || (c.value = !0, m.value = e, n.value === null && (v.value = e, p.value = { x: event.touches[0].clientX, y: event.touches[0].clientY }));
    }
    function C(e, t, u) {
      if (c.value = !0, m.value = e, n.value === null) {
        n.value = { index: e, direction: t };
        const a = l.value[e];
        f.value = { x: u.touches[0].clientX, y: u.touches[0].clientY, initialWidth: a.width, initialHeight: a.height };
      }
    }
    function _(e) {
      if (c.value = !0, e.preventDefault(), n.value !== null) {
        const t = l.value[n.value.index], u = e.touches[0].clientX - f.value.x, a = e.touches[0].clientY - f.value.y;
        I(t, u, a), f.value = { x: e.touches[0].clientX, y: e.touches[0].clientY };
      }
    }
    function K(e) {
      if (!(h.value || w.value) && (c.value = !0, e.preventDefault(), v.value !== null)) {
        const t = l.value[v.value], u = e.touches[0].clientX - p.value.x, a = e.touches[0].clientY - p.value.y, i = t.left + u / d.value.offsetWidth * 100, U = t.top + a / d.value.offsetHeight * 100;
        i >= 0 && U >= 0 && i + t.width <= 100 && U + t.height <= 100 && (t.left = i, t.top = U), p.value = { x: e.touches[0].clientX, y: e.touches[0].clientY };
      }
    }
    function k() {
      c.value = !1, m.value = null, v.value = null, n.value = null, l.value.forEach((e) => {
        e.left = Math.round(e.left / 100 * 100), e.top = Math.round(e.top / 100 * 100), e.width = Math.round(e.width / 100 * 100), e.height = Math.round(e.height / 100 * 100);
      });
    }
    const q = V(() => s.value.style.item.borderColor), J = V(() => s.value.style.resizeHandles.backgroundColor), Z = V(() => s.value.style.board.aspectRatio), ee = V(() => s.value.style.board.backgroundColor), te = V(() => s.value.style.board.border);
    function oe() {
      return l.value;
    }
    return R({
      generatePdf: H,
      getItemsPositions: oe,
      toggleLock: F
    }), (e, t) => (g(), y("div", {
      onMousedown: P,
      onMouseup: X,
      onTouchstart: P,
      onTouchend: X
    }, [
      s.value.allowPrint ? (g(), y("div", ge, [
        b("button", {
          class: "vue-ui-dashboard-button",
          onClick: H,
          disabled: T.value,
          style: S([{ "margin-top": "12px" }, `color:${s.value.style.board.color}`])
        }, [
          T.value ? (g(), y("svg", {
            key: 0,
            class: "vue-ui-dashboard-print-icon",
            xmlns: "http://www.w3.org/2000/svg",
            width: "20",
            height: "20",
            viewBox: "0 0 24 24",
            "stroke-width": "1.5",
            stroke: s.value.style.board.color,
            fill: "none",
            "stroke-linecap": "round",
            "stroke-linejoin": "round"
          }, t[4] || (t[4] = [
            ie('<path stroke="none" d="M0 0h24v24H0z" fill="none" data-v-dc9ae697></path><path d="M18 16v.01" data-v-dc9ae697></path><path d="M6 16v.01" data-v-dc9ae697></path><path d="M12 5v.01" data-v-dc9ae697></path><path d="M12 12v.01" data-v-dc9ae697></path><path d="M12 1a4 4 0 0 1 2.001 7.464l.001 .072a3.998 3.998 0 0 1 1.987 3.758l.22 .128a3.978 3.978 0 0 1 1.591 -.417l.2 -.005a4 4 0 1 1 -3.994 3.77l-.28 -.16c-.522 .25 -1.108 .39 -1.726 .39c-.619 0 -1.205 -.14 -1.728 -.391l-.279 .16l.007 .231a4 4 0 1 1 -2.212 -3.579l.222 -.129a3.998 3.998 0 0 1 1.988 -3.756l.002 -.071a4 4 0 0 1 -1.995 -3.265l-.005 -.2a4 4 0 0 1 4 -4z" data-v-dc9ae697></path>', 6)
          ]), 8, Ue)) : (g(), y("span", Ve, "PDF"))
        ], 12, be)
      ])) : Y("", !0),
      b("div", {
        class: "vue-ui-dashboard-container",
        ref_key: "dashboardContainer",
        ref: d,
        id: `vue-ui-dashboard_${x.value}`,
        style: S(`border:${te.value}; background:${ee.value}; aspect-ratio:${Z.value}`)
      }, [
        b("div", {
          class: "vue-ui-dashboard-grid-container",
          ref: "container",
          onMousemove: G,
          onMouseup: j,
          onTouchmove: K,
          onTouchend: k,
          style: S(`background:${s.value.style.board.backgroundColor}`)
        }, [
          t[5] || (t[5] = b("div", { class: "vue-ui-dashboard-grid" }, null, -1)),
          (g(!0), y(N, null, ne(D.value, (u, a) => (g(), y("div", {
            key: u.id,
            class: le({ "vue-ui-dashboard-grid-item": !0, "vue-ui-dashboard-grid-item--locked": h.value }),
            style: S({
              width: `${u.width}%`,
              height: `${u.height}%`,
              left: `${u.left}%`,
              top: `${u.top}%`,
              cursor: "move",
              boxShadow: m.value === a ? "0 6px 12px -3px rgba(0,0,0,0.3)" : "",
              zIndex: m.value === a ? D.value.length + 1 : u.index,
              backgroundColor: s.value.style.item.backgroundColor
            }),
            onMousedown: (i) => A(a),
            onTouchstart: (i) => Q(a)
          }, [
            h.value ? Y("", !0) : (g(), y(N, { key: 0 }, [
              b("div", {
                class: "vue-ui-dashboard-resize-handle vue-ui-dashboard-top-left",
                onMousedown: (i) => M(a, "top-left"),
                onTouchstart: (i) => C(a, "top-left", i),
                onTouchmove: t[0] || (t[0] = (i) => _(i)),
                onTouchend: k
              }, null, 40, ke),
              b("div", {
                class: "vue-ui-dashboard-resize-handle vue-ui-dashboard-top-right",
                onMousedown: (i) => M(a, "top-right"),
                onTouchstart: (i) => C(a, "top-right", i),
                onTouchmove: t[1] || (t[1] = (i) => _(i)),
                onTouchend: k
              }, null, 40, Te),
              b("div", {
                class: "vue-ui-dashboard-resize-handle vue-ui-dashboard-bottom-left",
                onMousedown: (i) => M(a, "bottom-left"),
                onTouchstart: (i) => C(a, "bottom-left", i),
                onTouchmove: t[2] || (t[2] = (i) => _(i)),
                onTouchend: k
              }, null, 40, Me),
              b("div", {
                class: "vue-ui-dashboard-resize-handle vue-ui-dashboard-bottom-right",
                onMousedown: (i) => M(a, "bottom-right"),
                onTouchstart: (i) => C(a, "bottom-right", i),
                onTouchmove: t[3] || (t[3] = (i) => _(i)),
                onTouchend: k
              }, null, 40, Ce)
            ], 64)),
            u.resolvedComponent ? (g(), re(de(u.resolvedComponent), ce({
              key: 1,
              ref_for: !0
            }, u.props), null, 16)) : se(e.$slots, "content", {
              key: 2,
              item: u,
              index: a,
              left: u.left,
              top: u.top,
              height: u.height,
              width: u.width
            }, void 0, !0)
          ], 46, we))), 128))
        ], 36)
      ], 12, ye)
    ], 32));
  }
}, Pe = /* @__PURE__ */ me(_e, [["__scopeId", "data-v-dc9ae697"]]);
export {
  Pe as default
};
