import { a3 as z, A as P, l as T, r as U, f as V, h as X, q as j, z as Y, d as W, G as J, u as K, p as Z } from "./index-BI6O7K58.js";
import q from "./vue-ui-xy-B1HwPMFi.js";
import Q from "./vue-ui-donut-BGZIwC5D.js";
import { resolveComponent as x, createElementBlock as u, openBlock as c, normalizeStyle as g, createElementVNode as a, createCommentVNode as b, toDisplayString as d, Fragment as I, renderList as _, normalizeClass as p, createTextVNode as w, withDirectives as O, vModelText as S, withKeys as L, withModifiers as A, vModelSelect as $, createBlock as E, createVNode as ee } from "vue";
import { _ as te } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const se = {
  name: "vue-ui-table",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  components: { VueUiXy: q, VueUiDonut: Q },
  data() {
    return {
      uid: `vue-ui-table-${Math.random()}`,
      bodyCopy: JSON.parse(JSON.stringify(this.dataset.body)).map((s, r) => ({
        ...s,
        absoluteIndex: r
      })),
      buttonTimeout: null,
      canMoveChart: !1,
      chart: {
        height: 316,
        type: "bar",
        width: 512
      },
      constants: {
        ASC: 1,
        BAR: "bar",
        DATE: "date",
        DESC: -1,
        DONUT: "donut",
        LINE: "line",
        NUMERIC: "numeric",
        PERCENTAGE: "percentage",
        TEXT: "text"
      },
      clientX: 100,
      clientY: 100,
      dragOffsetX: 0,
      dragOffsetY: 0,
      modalWidth: 400,
      modalHeight: 200,
      cssClass: {
        CELL: "smart-td-selected",
        FIRST_TD: "smart-td-selected-first",
        LAST_TD: "smart-td-selected-last",
        ROW: "smart-td-selected-neighbor"
      },
      currentDonut: void 0,
      currentFilter: void 0,
      currentSearch: void 0,
      currentSelectionSpan: {
        col: void 0,
        rows: []
      },
      currentPage: 0,
      dates: {},
      filteredDatesIndexes: {},
      hasNaN: {},
      iconColor: "#2D353C",
      iconSize: 20,
      immutableRangeFilters: {},
      isExportRequest: !1,
      isLoading: !1,
      itemsPerPage: this.config.rowsPerPage ? this.config.rowsPerPage : 25,
      multiselects: {},
      paginatorOptions: [.../* @__PURE__ */ new Set([10, 25, 50, 100, 250, 500, this.config.rowsPerPage ? this.config.rowsPerPage : 25, this.dataset.body.length])].sort((s, r) => s - r),
      palette: Z,
      percentages: {},
      rafId: null,
      rangeFilters: {},
      searches: {},
      selectedColumn: void 0,
      selectedDonutCategory: void 0,
      selectedPlot: void 0,
      showChart: !1,
      showDonutOptions: !1,
      sorts: {},
      tableBody: JSON.parse(JSON.stringify(this.dataset.body)).map((s, r) => ({
        ...s,
        absoluteIndex: r
      })),
      tableHead: JSON.parse(JSON.stringify(this.dataset.header)).map((s) => ({
        average: Object.hasOwn(s, "average") ? s.average : !1,
        decimals: Object.hasOwn(s, "decimals") ? s.decimals : 0,
        isMultiselect: Object.hasOwn(s, "isMultiselect") ? s.isMultiselect : !1,
        isPercentage: Object.hasOwn(s, "isPercentage") ? s.isPercentage : !1,
        isSearch: Object.hasOwn(s, "isSearch") ? s.isSearch : !1,
        isSort: Object.hasOwn(s, "isSort") ? s.isSort : !1,
        name: s.name,
        // this attribute is mandatory
        percentageTo: Object.hasOwn(s, "percentageTo") ? s.percentageTo : void 0,
        prefix: Object.hasOwn(s, "prefix") ? s.prefix : "",
        rangeFilter: Object.hasOwn(s, "rangeFilter") ? s.rangeFilter : !1,
        suffix: Object.hasOwn(s, "suffix") ? s.suffix : "",
        sum: Object.hasOwn(s, "sum") ? s.sum : !1,
        type: s.type
        // this attribute is mandatory
      }))
    };
  },
  mounted() {
    if (this.dataset.header.length === 0)
      throw new Error(`vue-ui-table error: missing header data.
Provide an array of objects of type:
{
 name: string;
 type: string; ('text' | 'numeric' | 'date')
 average: boolean;
 decimals: number | undefined;
 sum: boolean;
 isSort:boolean;
 isSearch: boolean;
 isMultiselect: boolean;
 isPercentage: boolean;
 percentageTo: string; (or '')
}`);
    if (this.dataset.body.length === 0)
      throw new Error("vue-ui-table error: missing body data");
    this.isLoading = !0, this.promiseWithAsyncFunction(this.prepareBodyCopy, () => {
      this.$forceUpdate(), this.isLoading = !1;
    }), document.addEventListener("keydown", (n) => {
      const s = document.activeElement;
      (s && Array.from(s.classList).includes("td-focusable") && n.key.includes("Arrow") || n.code === "Space") && n.preventDefault();
    });
  },
  watch: {
    showChart: function(n) {
      n && this.$nextTick(() => {
        this.closeDragElement();
      });
    },
    dataset: {
      handler(n) {
        this.isLoading = !0, this.bodyCopy = JSON.parse(JSON.stringify(n.body)).map((s, r) => ({
          ...s,
          absoluteIndex: r
        })), this.tableBody = JSON.parse(JSON.stringify(n.body)).map((s, r) => ({
          ...s,
          absoluteIndex: r
        })), this.tableHead = JSON.parse(JSON.stringify(n.header)).map((s) => ({
          average: Object.hasOwn(s, "average") ? s.average : !1,
          decimals: Object.hasOwn(s, "decimals") ? s.decimals : 0,
          isMultiselect: Object.hasOwn(s, "isMultiselect") ? s.isMultiselect : !1,
          isPercentage: Object.hasOwn(s, "isPercentage") ? s.isPercentage : !1,
          isSearch: Object.hasOwn(s, "isSearch") ? s.isSearch : !1,
          isSort: Object.hasOwn(s, "isSort") ? s.isSort : !1,
          name: s.name,
          percentageTo: Object.hasOwn(s, "percentageTo") ? s.percentageTo : void 0,
          prefix: Object.hasOwn(s, "prefix") ? s.prefix : "",
          rangeFilter: Object.hasOwn(s, "rangeFilter") ? s.rangeFilter : !1,
          suffix: Object.hasOwn(s, "suffix") ? s.suffix : "",
          sum: Object.hasOwn(s, "sum") ? s.sum : !1,
          type: s.type
        })), this.currentSelectionSpan = { col: void 0, rows: [] }, this.selectedColumn = void 0, this.itemsPerPage = this.config.rowsPerPage ? this.config.rowsPerPage : 25, this.percentages = {}, this.dates = {}, this.filteredDatesIndexes = {}, this.hasNaN = {}, this.immutableRangeFilters = {}, this.rangeFilters = {}, this.multiselects = {}, this.searches = {}, this.sorts = {}, this.showChart = !1, this.currentDonut = void 0, this.selectedDonutCategory = void 0, this.selectedPlot = void 0, this.showDonutOptions = !1, this.currentSelectionSpan.col = void 0, this.currentSelectionSpan.rows = [], this.promiseWithAsyncFunction(this.prepareBodyCopy, () => {
          this.$forceUpdate(), this.updateCurrentPage(), this.isLoading = !1;
        });
      },
      deep: !0,
      // In case dataset.body/header are updated in-place
      immediate: !1
    }
  },
  computed: {
    availableDonutCategories() {
      return Object.keys(this.multiselects).map((n) => ({
        index: n,
        name: this.dataset.header[n].name,
        options: this.multiselects[n]
      }));
    },
    canChart() {
      return this.FINAL_CONFIG.useChart && this.currentSelectionSpan.rows.length > 1;
    },
    chartData() {
      if (!this.canChart) return [];
      const n = 316, s = 512, r = this.currentSelectionSpan.rows.length, i = s / r, t = Math.max(...this.currentSelectionSpan.rows.map((v) => v.value)), e = Math.min(...this.currentSelectionSpan.rows.map((v) => v.value)), y = this.dataset.header[this.currentSelectionSpan.col].isPercentage && this.dataset.header[this.currentSelectionSpan.col].percentageTo, f = this.chart.type === this.constants.DONUT && this.selectedDonutCategory && this.selectedDonutCategory.name, l = this.dataset.header[this.currentSelectionSpan.col].name + (y ? ` / ${this.dataset.header[this.percentages[this.currentSelectionSpan.col].referenceIndex].name}` : "") + (f ? ` ${this.FINAL_CONFIG.translations.by} ${this.selectedDonutCategory.name}` : ""), o = this.dataset.header[this.currentSelectionSpan.col].prefix, h = this.dataset.header[this.currentSelectionSpan.col].suffix, m = [
        {
          name: l,
          series: this.currentSelectionSpan.rows.map((v) => v.value),
          type: "line",
          useProgression: !0,
          smooth: this.FINAL_CONFIG.style.chart.layout.line.smooth,
          color: this.FINAL_CONFIG.style.chart.layout.line.stroke,
          useArea: this.FINAL_CONFIG.style.chart.layout.line.useArea
        }
      ], F = [
        {
          name: l,
          series: this.currentSelectionSpan.rows.map((v) => v.value),
          type: "bar",
          useProgression: !0,
          color: this.FINAL_CONFIG.style.chart.layout.bar.fill
        }
      ], k = this.FINAL_CONFIG.style.chart.modal.backgroundColor, N = this.adaptColorToBackground(k), C = this.dataset.header[this.currentSelectionSpan.col].decimals, B = {
        chart: {
          backgroundColor: k,
          color: N,
          labels: {
            fontSize: 18,
            prefix: o,
            suffix: h
          },
          grid: {
            stroke: T(N, 0.5),
            labels: {
              color: N,
              xAxisLabels: { show: !1 }
            }
          },
          highlighter: {
            color: N
          },
          legend: {
            color: N
          },
          padding: {
            left: 72,
            bottom: 24,
            top: 36
          },
          title: {
            text: l,
            color: N,
            fontSize: 18
          },
          tooltip: {
            showTimeLabel: !1,
            backgroundOpacity: 30,
            color: N,
            backgroundColor: k,
            showPercentage: !1,
            roundingValue: C
          },
          userOptions: {
            position: "left",
            buttons: {
              pdf: !1,
              csv: !1,
              table: !1,
              annotator: !1
            }
          },
          zoom: { show: !1 }
        },
        line: {
          labels: {
            show: !0,
            color: N,
            rounding: C
          },
          dot: {
            useSerieColor: !1,
            fill: this.FINAL_CONFIG.style.chart.layout.line.plot.fill,
            strokeWidth: this.FINAL_CONFIG.style.chart.layout.line.plot.strokeWidth
          }
        },
        bar: {
          useGradient: !1,
          border: {
            useSerieColor: !1,
            stroke: this.FINAL_CONFIG.style.chart.layout.bar.stroke,
            strokeWidth: this.FINAL_CONFIG.style.chart.layout.bar.strokeWidth
          },
          labels: {
            show: !0,
            color: N,
            rounding: C
          }
        }
      }, D = e >= 0 ? 0 : Math.abs(e), H = t + D, M = this.dataset.header[this.currentSelectionSpan.col].isPercentage, G = this.currentSelectionSpan.rows.map((v, R) => ({
        x: i * R + i / 2,
        y: (1 - (v.value + D) / H) * n,
        value: M ? v.value * 100 : v.value,
        suffix: M ? "%" : this.dataset.header[this.currentSelectionSpan.col].suffix ? this.dataset.header[this.currentSelectionSpan.col].suffix : "",
        prefix: this.dataset.header[this.currentSelectionSpan.col].prefix ? this.dataset.header[this.currentSelectionSpan.col].prefix : "",
        index: v.index,
        absoluteValue: M ? Math.abs(v.value) * 100 : Math.abs(v.value)
      }));
      return {
        donutConfig: {
          userOptions: {
            position: "left",
            buttons: {
              pdf: !1,
              csv: !1,
              table: !1,
              annotator: !1
            }
          },
          style: {
            chart: {
              backgroundColor: k,
              color: N,
              layout: {
                curvedMarkers: !0,
                donut: {
                  strokeWidth: 64
                },
                labels: {
                  dataLabels: {
                    suffix: M ? "%" : "",
                    prefix: o
                  },
                  value: {
                    rounding: C
                  },
                  percentage: {
                    color: N,
                    rounding: C
                  },
                  name: {
                    color: N
                  },
                  hollow: {
                    average: {
                      color: N,
                      text: this.FINAL_CONFIG.translations.average,
                      value: {
                        color: N
                      }
                    },
                    total: {
                      color: N,
                      offsetY: -12,
                      text: this.FINAL_CONFIG.translations.total,
                      value: {
                        color: N,
                        offsetY: -12
                      }
                    }
                  }
                }
              },
              legend: {
                backgroundColor: k,
                color: N,
                roundingValue: C,
                roundingPercentage: C
              },
              padding: {
                left: 12,
                right: 12
              },
              title: {
                text: l,
                color: N,
                fontSize: 18
              },
              tooltip: {
                backgroundOpacity: 30,
                color: N,
                backgroundColor: k,
                roundingValue: C,
                roundingValue: C
              }
            }
          }
        },
        xyConfig: B,
        xyDatasetLine: m,
        xyDatasetBar: F,
        progression: G.length >= 2 ? this.calcLinearProgression(G) : !1
      };
    },
    hasNumericTypes() {
      return this.dataset.header.map((n) => n.type).includes(this.constants.NUMERIC);
    },
    icons() {
      return {
        arrowSort: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 9l4 -4l4 4m-4 -4v14" /><path d="M21 15l-4 4l-4 -4m4 4v-14" /></svg>`,
        bar: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M9 8m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M15 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M4 20l14 0" /></svg>`,
        chart: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 19l16 0" /><path d="M4 15l4 -6l4 2l4 -5l4 4" /></svg>`,
        chevronDown: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 9l6 6l6 -6" /></svg>`,
        chevronLeft: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize * 1.6}" height="${this.iconSize * 1.6}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 6l-6 6l6 6" /></svg>`,
        chevronRight: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize * 1.6}" height="${this.iconSize * 1.6}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 6l6 6l-6 6" /></svg>`,
        donut: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize * 0.8}" height="${this.iconSize * 0.8}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 3v5m4 4h5" /><path d="M8.929 14.582l-3.429 2.918" /><path d="M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" /><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /></svg>`,
        export: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12.5 21h-7.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7.5" /><path d="M3 10h18" /><path d="M10 3v18" /><path d="M16 19h6" /><path d="M19 16l3 3l-3 3" /></svg>`,
        fileDownload: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14 3v4a1 1 0 0 0 1 1h4" /><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /><path d="M12 17v-6" /><path d="M9.5 14.5l2.5 2.5l2.5 -2.5" /></svg>`,
        filter: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z" /></svg>`,
        move: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 9l3 3l-3 3" /><path d="M15 12h6" /><path d="M6 9l-3 3l3 3" /><path d="M3 12h6" /><path d="M9 18l3 3l3 -3" /><path d="M12 15v6" /><path d="M15 6l-3 -3l-3 3" /><path d="M12 3v6" /></svg>`,
        sort09: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 15l3 3l3 -3" /><path d="M7 6v12" /><path d="M17 3a2 2 0 0 1 2 2v3a2 2 0 1 1 -4 0v-3a2 2 0 0 1 2 -2z" /><path d="M17 16m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" /><path d="M19 16v3a2 2 0 0 1 -2 2h-1.5" /></svg>`,
        sort90: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 15l3 3l3 -3" /><path d="M7 6v12" /><path d="M17 14a2 2 0 0 1 2 2v3a2 2 0 1 1 -4 0v-3a2 2 0 0 1 2 -2z" /><path d="M17 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" /><path d="M19 5v3a2 2 0 0 1 -2 2h-1.5" /></svg>`,
        sortAZ: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 10v-5c0 -1.38 .62 -2 2 -2s2 .62 2 2v5m0 -3h-4" /><path d="M19 21h-4l4 -7h-4" /><path d="M4 15l3 3l3 -3" /><path d="M7 6v12" /></svg>`,
        sortZA: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 21v-5c0 -1.38 .62 -2 2 -2s2 .62 2 2v5m0 -3h-4" /><path d="M19 10h-4l4 -7h-4" /><path d="M4 15l3 3l3 -3" /><path d="M7 6v12" /></svg>`,
        sum: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>`,
        table: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" fill="white" d="M 10 2, 21 2, 21 21, 10 21Z"/><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z" /><path d="M3 10h18" /><path d="M10 3v18" /></svg>`,
        warning: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize * 0.8}" height="${this.iconSize * 0.8}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z" /><path d="M12 9v4" /><path d="M12 17h.01" /></svg>`,
        grip: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><path d="M5 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M5 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M12 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M12 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M19 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M19 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /></svg>`
      };
    },
    pages() {
      const n = [];
      if (this.bodyCopy.length)
        for (let s = 0; s < this.bodyCopy.length; s += this.itemsPerPage)
          n.push(this.bodyCopy.slice(s, s + this.itemsPerPage));
      return n;
    },
    rows() {
      return this.bodyCopy.map((n) => n.td);
    },
    selectedCellsCalculations() {
      return {
        sumPercentage: Number((this.currentSelectionSpan.rows.map((n) => n.value).reduce((n, s) => n + s, 0) * 100).toFixed(this.dataset.header[this.currentSelectionSpan.col].decimals)).toLocaleString(),
        sumRegular: Number(this.currentSelectionSpan.rows.map((n) => n.value).reduce((n, s) => n + s, 0).toFixed(this.dataset.header[this.currentSelectionSpan.col].decimals)).toLocaleString(),
        averagePercentage: Number((this.currentSelectionSpan.rows.map((n) => n.value).reduce((n, s) => n + s, 0) / this.currentSelectionSpan.rows.length * 100).toFixed(this.dataset.header[this.currentSelectionSpan.col].decimals)).toLocaleString(),
        averageRegular: Number((this.currentSelectionSpan.rows.map((n) => n.value).reduce((n, s) => n + s, 0) / this.currentSelectionSpan.rows.length).toFixed(this.dataset.header[this.currentSelectionSpan.col].decimals)).toLocaleString()
      };
    },
    FINAL_CONFIG() {
      const { vue_ui_table: n } = K();
      if (!Object.keys(this.config || {}).length)
        return n;
      const s = this.treeShake({
        defaultConfig: n,
        userConfig: this.config
      });
      return this.convertConfigColors(s);
    },
    visibleRows() {
      return this.pages[this.currentPage];
    }
  },
  methods: {
    // lib
    adaptColorToBackground: J,
    convertColorToHex: W,
    convertConfigColors: Y,
    createCsvContent: j,
    darkenHexColor: X,
    dataLabel: V,
    downloadCsv: U,
    lightenHexColor: T,
    treeShake: P,
    // specific
    applyDonutOption() {
      const n = this.selectedDonutCategory.options.map((s, r) => ({
        name: s,
        color: this.palette[r] || this.palette[r % this.palette.length],
        values: [this.visibleRows.filter((i, t) => i.td[this.selectedDonutCategory.index] === s && this.currentSelectionSpan.rows.map((e) => e.index).includes(t)).map((i) => i.td[this.currentSelectionSpan.col]).reduce((i, t) => Math.abs(i) + Math.abs(t), 0)],
        absoluteValue: this.visibleRows.filter((i, t) => i.td[this.selectedDonutCategory.index] === s && this.currentSelectionSpan.rows.map((e) => e.index).includes(t)).map((i) => i.td[this.currentSelectionSpan.col]).reduce((i, t) => i + t, 0)
      })).sort((s, r) => r.value - s.value);
      this.currentDonut = n, this.$nextTick(() => {
        this.chart.type = this.constants.DONUT, this.showDonutOptions = !1;
      });
    },
    calcRectY(n, s) {
      return n >= 0 ? s : this.chartData.zero;
    },
    canResetColumn(n, s) {
      return !this.hasNaN[n] && (s.isSort || s.isSearch || s.isMultiselect || s.rangeFilter) && ![this.constants.DATE].includes(s.type);
    },
    createXls(n = "all") {
      const s = this.dataset.header.map((e) => e.name), r = n === "all" ? this.bodyCopy.map((e) => e.td) : this.visibleRows.map((e) => e.td), i = [s].concat(r), t = this.createCsvContent(i);
      this.downloadCsv({ csvContent: t, title: "vue-ui-table" });
    },
    calcLinearProgression: z,
    closeAllDropdowns() {
      const n = document.getElementsByClassName("th-dropdown");
      n.length && Array.from(n).forEach((s) => {
        s.dataset.isOpen = !1;
      });
    },
    debounce(n, s) {
      let r;
      clearTimeout(r), r = setTimeout(n, s);
    },
    filterBody() {
      this.bodyCopy = this.tableBody.filter((n) => {
        for (const s in this.searches)
          if (!n.td[s].toUpperCase().includes(this.searches[s].toUpperCase()))
            return !1;
        for (const s in this.multiselects)
          if (!this.multiselects[s].some((i) => i === n.td[s]))
            return !1;
        for (const s in this.dates) {
          const r = new Date(n.td[s]), i = new Date(this.dates[s].from), t = new Date(this.dates[s].to);
          if (r < i || r > t)
            return !1;
        }
        return !0;
      }), this.sortBody();
    },
    getAverage(n) {
      return this.rows.map((s) => s[n]).map((s) => isNaN(Number(s)) ? 0 : s).reduce((s, r) => s + r, 0) / this.bodyCopy.length;
    },
    getDatesRange(n) {
      const s = this.dataset.body.map((F) => new Date(F.td[n])), r = new Date(Math.min(...s)), i = new Date(Math.max(...s)), t = r.getFullYear(), e = i.getFullYear(), y = String(r.getMonth() + 1).padStart(2, "0"), f = String(i.getMonth() + 1).padStart(2, "0"), l = String(r.getDate()).padStart(2, "0"), o = String(i.getDate()).padStart(2, "0"), h = `${t}-${y}-${l}`, m = `${e}-${f}-${o}`;
      return {
        from: h,
        to: m
      };
    },
    getDonutLegendValue(n) {
      return Number((n * (this.dataset.header[this.currentSelectionSpan.col].isPercentage ? 100 : 1)).toFixed(this.dataset.header[this.currentSelectionSpan.col].decimals)).toLocaleString();
    },
    getDropdownOptions(n) {
      return [...new Set(this.dataset.body.map((s) => s.td[n]))];
    },
    getSum(n) {
      return this.rows.map((s) => s[n]).map((s) => isNaN(Number(s)) ? 0 : s).reduce((s, r) => s + r, 0);
    },
    includesNaN(n) {
      return n.includes(NaN);
    },
    isDropdownOptionSelected(n, s) {
      return this.multiselects[s] ? this.multiselects[s].includes(n) : !0;
    },
    isNumeric(n) {
      return !isNaN(Number(String(n).replaceAll("%", "")));
    },
    isResetDisabled(n, s) {
      const r = s.isSort, i = s.isSearch, t = s.isMultiselect && this.multiselects[n], e = s.rangeFilter, y = (f) => {
        if (e && this.rangeFilters[f])
          return Math.round(this.rangeFilters[f].min) === this.immutableRangeFilters[f].min && Math.round(this.rangeFilters[f].max) === this.immutableRangeFilters[f].max;
      };
      if (r && i && t && e)
        return ["", void 0].includes(this.searches[n]) && [void 0].includes(this.sorts[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length && y(n);
      if (r && i && t)
        return ["", void 0].includes(this.searches[n]) && [void 0].includes(this.sorts[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length;
      if (r && i && e)
        return ["", void 0].includes(this.searches[n]) && [void 0].includes(this.sorts[n]) && y(n);
      if (r && i)
        return ["", void 0].includes(this.searches[n]) && [void 0].includes(this.sorts[n]);
      if (r && t && e)
        return [void 0].includes(this.sorts[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length && y(n);
      if (r && t)
        return [void 0].includes(this.sorts[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length;
      if (i && t && e)
        return ["", void 0].includes(this.searches[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length && y(n);
      if (i && t)
        return ["", void 0].includes(this.searches[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length;
      if (i && e)
        return ["", void 0].includes(this.searches[n]) && y(n);
      if (i)
        return ["", void 0].includes(this.searches[n]);
      if (r && e)
        return [void 0].includes(this.sorts[n]) && y(n);
      if (r)
        return [void 0].includes(this.sorts[n]);
      if (t && e)
        return this.multiselects[n].length === this.getDropdownOptions(n).length && y(n);
      if (t)
        return this.multiselects[n].length === this.getDropdownOptions(n).length;
    },
    navigate(n) {
      this.resetSelection(), n === "next" && this.currentPage < this.pages.length ? this.currentPage += 1 : n === "previous" && this.currentPage >= 1 ? this.currentPage -= 1 : this.currentPage = n - 1, this.$refs.tableWrapper.scrollTo({
        top: 0,
        left: 0,
        behavior: "smooth"
      });
    },
    navigateCell(n) {
      n.preventDefault();
      const s = n.keyCode, r = 38, i = 40, t = 37, e = 39;
      if (![r, i, t, e].includes(s)) return;
      const y = n.target.id, f = /cell_(\d+)_(\d+)_vue-ui-table-(\d+)/, l = y.match(f), o = parseInt(l[1]), h = parseInt(l[2]), m = document.getElementById(`cell_${o}_${h + 1}_${this.uid}`), F = document.getElementById(`cell_${o}_${h - 1}_${this.uid}`), k = document.getElementById(`cell_${o + 1}_${h}_${this.uid}`), N = document.getElementById(`cell_${o - 1}_${h}_${this.uid}`);
      let C;
      switch (!0) {
        case s === e:
          C = m;
          break;
        case s === t:
          C = F;
          break;
        case s === r:
          C = N;
          break;
        case s === i:
          C = k;
          break;
        default:
          return;
      }
      C && (C.focus(), C.scrollIntoView({ behavior: "smooth", block: "center" }));
    },
    openDonutOptions() {
      this.selectedDonutCategory = this.availableDonutCategories[0], this.showDonutOptions = !0;
    },
    placeLabelOnTopOrBottom({ previousPlot: n, currentPlot: s, nextPlot: r }) {
      const i = s.y - 38, t = s.y + 16;
      return n && r ? n.value < s.value && r.value < s.value ? i : n.value > s.value && r.value > s.value ? t : (n.value > s.value && r.value < s.value || n.value < s.value && r.value > s.value, i) : n && !r ? n.value > s.value ? t : i : !n && r && r.value > s.value ? t : i;
    },
    async prepareBodyCopy() {
      return new Promise((n) => {
        const s = [];
        this.tableHead.forEach((r, i) => {
          if (r.isSearch && Object.assign(this.searches, { [i]: "" }), r.isMultiselect && Object.assign(this.multiselects, { [i]: this.getDropdownOptions(i) }), r.type === this.constants.DATE && (Object.assign(this.dates, { [i]: this.getDatesRange(i) }), Object.assign(this.filteredDatesIndexes, { [i]: !1 })), (r.isPercentage || r.percentageTo) && Object.assign(this.percentages, {
            [i]: {
              reference: r.percentageTo,
              referenceIndex: this.dataset.header.map((t) => t.name).indexOf(r.percentageTo)
            }
          }), r.rangeFilter && (Object.assign(this.rangeFilters, {
            [i]: {
              min: Math.round(Math.min(...this.dataset.body.map((t) => t.td).map((t) => t[i]))),
              max: Math.round(Math.max(...this.dataset.body.map((t) => t.td).map((t) => t[i])))
            }
          }), Object.assign(this.immutableRangeFilters, {
            [i]: {
              min: Math.round(Math.min(...this.dataset.body.map((t) => t.td).map((t) => t[i]))),
              max: Math.round(Math.max(...this.dataset.body.map((t) => t.td).map((t) => t[i])))
            }
          })), r.isPercentage) {
            const t = this.dataset.header.map((y) => y.name).indexOf(r.percentageTo), e = this.dataset.body.map((y) => y.td[t]).reduce((y, f) => y + f, 0);
            s.push([i, t, e]);
          }
          r.type === this.constants.NUMERIC && !r.isPercentage && Object.assign(this.hasNaN, { [i]: this.includesNaN(this.dataset.body.map((t) => Number(t.td[i]))) });
        }), this.bodyCopy.forEach((r, i) => {
          s.map((t) => {
            const [e, y, f] = t;
            r.td[e] = r.td[y] / f;
          }), r.td.forEach((t, e) => {
            this.dataset.header[e].type === this.constants.TEXT && this.dataset.header[e].isSearch && (r[e] = this.stringToNumber(t)), this.dataset.header[e].type === this.constants.DATE && (r[e] = new Date(t).getTime()), this.dataset.header[e].type === this.constants.NUMERIC && (r[e] = isNaN(Number(t)) ? e : t), this.tableBody[i][e] = r[e];
          });
        }), n(!0);
      });
    },
    promiseWithAsyncFunction(n, s) {
      return new Promise((r, i) => {
        n().then((t) => {
          try {
            const e = s(t);
            r(e);
          } catch (e) {
            i(e);
          }
        }).catch((t) => {
          i(t);
        });
      });
    },
    resetDates(n) {
      this.dates[n] = {
        from: this.getDatesRange(n).from,
        to: this.getDatesRange(n).to
      }, this.filteredDatesIndexes[n] = !1, this.$forceUpdate(), this.filterBody();
    },
    resetFilter(n, s, r) {
      const i = r.currentTarget;
      clearTimeout(this.buttonTimeout), i.classList.add("clicked"), this.buttonTimeout = setTimeout(() => {
        i.classList.remove("clicked");
      }, 200), this.currentFilter = void 0, s.rangeFilter && (this.rangeFilters[n].min = this.immutableRangeFilters[n].min, this.rangeFilters[n].max = this.immutableRangeFilters[n].max), s.isMultiselect ? (this.multiselects[n] = this.getDropdownOptions(n), s.type === this.constants.TEXT && (this.sorts[n] = void 0), s.isSearch && (this.searches[n] = "")) : s.type === this.constants.NUMERIC ? this.sorts[n] = void 0 : s.type === this.constants.TEXT ? (this.sorts[n] = void 0, this.searches[n] = "") : s.type === this.constants.DATE && (this.sorts[n] = void 0), this.filterBody();
    },
    resetSelection() {
      const n = document.getElementsByClassName(`tr_${this.uid}`);
      Array.from(n).forEach((s) => {
        Array.from(s.getElementsByTagName("td")).forEach((r) => {
          r.dataset.row === "even" ? (r.style.background = this.FINAL_CONFIG.style.rows.even.backgroundColor, r.style.color = this.FINAL_CONFIG.style.rows.even.color) : (r.style.background = this.FINAL_CONFIG.style.rows.odd.backgroundColor, r.style.color = this.FINAL_CONFIG.style.rows.odd.color);
        });
      }), Array.from(n).forEach((s) => s.dataset.selected = "false"), this.currentPage > this.pages.length - 1 && (this.currentPage = this.pages.length - 1), this.showChart = !1, this.currentDonut = void 0, this.selectedColumn = void 0, this.chart.type = this.constants.BAR, this.currentSelectionSpan = {
        col: void 0,
        rows: []
      }, this.clientX = 100, this.clientY = 100;
    },
    selectColumn(n) {
      this.currentSelectionSpan.col !== n ? (this.visibleRows.forEach((s, r) => {
        this.selectTd({
          td: s.td[n],
          rowIndex: r,
          colIndex: n,
          headerType: this.constants.NUMERIC,
          event: {
            currentTarget: document.getElementById(`cell_${r}_${n}_${this.uid}`)
          }
        });
      }), this.selectedColumn = n) : (this.selectedColumn = void 0, this.resetSelection());
    },
    selectDropdownOption(n, s) {
      this.multiselects[s].includes(n) ? this.multiselects[s] = this.multiselects[s].filter((r) => r !== n) : this.multiselects[s].push(n), this.$forceUpdate(), this.filterBody();
    },
    selectTd({ td: n, rowIndex: s, colIndex: r, headerType: i, event: t }) {
      if (i !== this.constants.NUMERIC || isNaN(Number(n))) {
        this.resetSelection();
        return;
      }
      this.currentSelectionSpan.col !== r && this.resetSelection();
      const e = t.currentTarget.parentNode;
      this.currentSelectionSpan.col = r, this.currentSelectionSpan.rows.map((y) => y.index).includes(s) ? (e.dataset.selected = "false", this.currentSelectionSpan.rows = this.currentSelectionSpan.rows.filter((y) => y.index !== s), t.currentTarget.classList.remove(this.cssClass.CELL), Array.from(e.children).forEach((y, f) => {
        y.dataset.row === "even" ? (y.style.background = this.FINAL_CONFIG.style.rows.even.backgroundColor, y.style.color = this.FINAL_CONFIG.style.rows.even.olor) : (y.style.background = this.FINAL_CONFIG.style.rows.odd.backgroundColor, y.style.color = this.FINAL_CONFIG.style.rows.odd.color);
      }), t.currentTarget.dataset.row === "even" ? (t.currentTarget.style.background = this.FINAL_CONFIG.style.rows.even.backgroundColor, t.currentTarget.style.color = this.FINAL_CONFIG.style.rows.even.color) : (t.currentTarget.style.background = this.FINAL_CONFIG.style.rows.odd.backgroundColor, t.currentTarget.style.color = this.FINAL_CONFIG.style.rows.odd.color)) : (e.dataset.selected = "true", this.currentSelectionSpan.rows.push({
        index: s,
        value: n
      }), Array.from(e.children).forEach((y, f) => {
        y.dataset.row === "even" ? (y.style.background = this.FINAL_CONFIG.style.rows.even.selectedNeighbors.backgroundColor, y.style.color = this.FINAL_CONFIG.style.rows.even.selectedNeighbors.color) : (y.style.background = this.FINAL_CONFIG.style.rows.odd.selectedNeighbors.backgroundColor, y.style.color = this.FINAL_CONFIG.style.rows.odd.selectedNeighbors.color);
      }), t.currentTarget.dataset.row === "odd" ? (t.currentTarget.style.background = this.FINAL_CONFIG.style.rows.odd.selectedCell.backgroundColor, t.currentTarget.style.color = this.FINAL_CONFIG.style.rows.odd.selectedCell.color) : (t.currentTarget.style.background = this.FINAL_CONFIG.style.rows.even.selectedCell.backgroundColor, t.currentTarget.style.color = this.FINAL_CONFIG.style.rows.even.selectedCell.color)), this.currentSelectionSpan.rows = this.currentSelectionSpan.rows.sort((y, f) => y.index - f.index), this.chart.type === this.constants.DONUT && this.currentSelectionSpan.rows.length > 0 && this.applyDonutOption();
    },
    setFilterDatesIndexes(n) {
      this.filteredDatesIndexes[n] = !(this.getDatesRange(n).from === this.dates[n].from && this.getDatesRange(n).to === this.dates[n].to);
    },
    sortBody() {
      this.resetSelection(), Object.keys(this.rangeFilters).forEach((n) => {
        this.filterByRange(this.bodyCopy, n);
      }), Object.keys(this.sorts).forEach((n) => {
        this.sortByNumber(this.bodyCopy, n);
      }), this.currentFilter !== void 0 && this.sortByNumber(this.bodyCopy, this.currentFilter), this.dataset.header.forEach((n, s) => {
        if (n.isPercentage) {
          const r = this.percentages[s].referenceIndex, i = this.bodyCopy.map((t) => t.td[r]).reduce((t, e) => t + e, 0);
          this.bodyCopy.forEach((t) => {
            t.td[s] = t.td[r] / i;
          });
        }
      }), this.currentPage > this.pages.length - 1 && (this.currentPage = this.pages.length - 1), [-1].includes(this.currentPage) && (this.currentPage = 0), this.$forceUpdate();
    },
    filterByRange(n, s) {
      this.bodyCopy = n.filter((r) => r.td[s] >= this.rangeFilters[s].min && r[s] <= this.rangeFilters[s].max);
    },
    sortByNumber(n, s) {
      if (this.sorts[s] === this.constants.ASC && (n = n.sort((r, i) => r[s] - i[s])), this.sorts[s] === this.constants.DESC)
        n = n.sort((r, i) => i[s] - r[s]);
      else
        return 0;
    },
    sortTh(n, s) {
      this.currentFilter = n;
      const r = s.currentTarget;
      clearTimeout(this.buttonTimeout), r.classList.add("clicked"), this.buttonTimeout = setTimeout(() => {
        r.classList.remove("clicked");
      }, 200), this.sorts[n] === 1 ? this.sorts[n] = this.constants.DESC : this.sorts[n] = this.constants.ASC, this.sortBody();
    },
    stringToNumber(n) {
      let s = 0;
      for (let r = 0; r < n.length; r += 1)
        s += n.charCodeAt(r);
      return s;
    },
    toggleMultiselect(n, s, r) {
      const i = r.currentTarget;
      clearTimeout(this.buttonTimeout), i.classList.add("clicked"), this.buttonTimeout = setTimeout(() => {
        i.classList.remove("clicked");
      }, 200);
      const t = document.getElementById(`th_dropdown_${n}`);
      t.dataset.isOpen === "false" ? t.dataset.isOpen = "true" : t.dataset.isOpen = "false";
    },
    updateCurrentPage(n) {
      this.resetSelection(), !n || !n.target.value ? this.currentPage = 0 : this.currentPage = Number(n.target.value);
    },
    // DONUTS
    calcDonutMarkerConnectorColor(n) {
      return n.proportion * 100 > 3 ? n.color : "transparent";
    },
    calcDonutMarkerLabelPositionX(n) {
      return n.center.endX + this.calcMarkerOffset(n, 50);
    },
    calcMarkerOffset(n, s) {
      return n.center.endX - s >= 0 ? 3 : -2;
    },
    displayArcPercentage(n, s) {
      return isNaN(n.value / this.sumValues(s)) ? 0 : (n.value / this.sumValues(s) * 100).toFixed(0) + "%";
    },
    isArcBigEnough(n) {
      return n.proportion * 100 > 3;
    },
    sumValues(n) {
      return [...n].map((s) => s.value).reduce((s, r) => s + r, 0);
    },
    // CHART DRAGGING METHODS
    closeDragElement() {
      document.onmouseup = null, document.onmousemove = null;
    },
    dragMouseDown(n) {
      n = n || window.event, n.preventDefault();
      const r = this.$refs.chartModal.getBoundingClientRect();
      this.dragOffsetX = n.clientX - r.left, this.dragOffsetY = n.clientY - r.top, this.modalWidth = r.width, this.modalHeight = r.height, document.onmouseup = this.closeDragElement, document.onmousemove = this.elementDrag;
    },
    elementDrag(n) {
      if (this.rafId) return;
      const r = this.$refs.chartModal.getBoundingClientRect();
      this.clientX = n.clientX - this.dragOffsetX, this.clientY = n.clientY - this.dragOffsetY - 40, this.clientX < 0 && (this.clientX = 0), this.clientX + r.width > window.innerWidth && (this.clientX = window.innerWidth - r.width - 48), this.clientY < 0 && (this.clientY = 0), this.clientY + r.height > window.innerHeight && (this.clientY = window.innerHeight - r.height - 24);
    }
  }
}, ne = { class: "vue-ui-table-export-hub" }, re = ["innerHTML"], oe = ["data-is-open"], le = { class: "vue-ui-table-export-hub-options" }, ae = { class: "vue-ui-table-export-hub-option-wrapper" }, ie = { class: "label" }, ce = ["innerHTML"], ue = { class: "vue-ui-table-export-hub-option-wrapper" }, he = { class: "label" }, de = ["innerHTML"], ge = { class: "vue-ui-table" }, ye = { id: "tableHead" }, me = { key: 0 }, be = { key: 0 }, fe = { key: 1 }, Ne = {
  key: 0,
  style: { display: "flex", "align-items": "center", "justify-content": "flex-end" }
}, pe = ["innerHTML"], Ce = {
  key: 0,
  style: { "margin-left": "3px" }
}, Ie = { key: 0 }, Fe = { class: "th-filter" }, ve = {
  key: 0,
  class: "th-date"
}, we = { class: "date-wrapper--inputs" }, _e = { class: "date-fieldset" }, ke = ["for"], Oe = ["id", "onUpdate:modelValue", "onInput"], Se = { class: "date-fieldset" }, Le = ["for"], Ae = ["id", "onUpdate:modelValue", "onInput"], Me = { class: "date-wrapper--button" }, De = ["onClick"], Ge = ["innerHTML"], Te = ["innerHTML"], xe = ["innerHTML"], Ee = ["onClick", "disabled"], Be = ["placeholder", "onUpdate:modelValue", "name"], He = ["onClick"], Re = ["innerHTML"], ze = ["innerHTML"], Pe = ["innerHTML"], Ue = ["onClick", "innerHTML"], Ve = ["innerHTML"], Xe = {
  key: 5,
  class: "th-range-filter"
}, je = ["for"], Ye = ["id", "max", "min", "onUpdate:modelValue"], We = ["id", "max", "min", "onUpdate:modelValue"], Je = ["for"], Ke = ["onClick", "disabled"], Ze = ["id"], qe = ["onClick"], Qe = ["onClick", "onKeyup"], $e = ["innerHTML", "onClick", "onKeyup"], et = ["data-row"], tt = ["data-row"], st = ["data-row", "onClick", "onKeyup", "id"], nt = ["innerHTML"], rt = { key: 1 }, ot = { key: 2 }, lt = { key: 5 }, at = ["innerHTML"], it = { key: 0 }, ct = { style: { "margin-left": "12px" } }, ut = { class: "format-num" }, ht = { style: { "margin-left": "12px" } }, dt = {
  key: 0,
  class: "format-num"
}, gt = {
  key: 1,
  class: "format-num"
}, yt = { key: 2 }, mt = { style: { "margin-left": "12px" } }, bt = {
  key: 0,
  class: "format-num"
}, ft = {
  key: 1,
  class: "format-num"
}, Nt = { key: 2 }, pt = {
  key: 0,
  class: "vue-ui-table-paginator format-num"
}, Ct = {
  key: 1,
  class: "vue-ui-table-size-warning"
}, It = ["innerHTML"], Ft = {
  key: 3,
  class: "vue-ui-table-pagination format-num"
}, vt = ["innerHTML", "disabled"], wt = ["disabled"], _t = {
  key: 0,
  class: "vue-ui-table-page-scroller-wrapper"
}, kt = {
  for: "pageScroller",
  style: { "font-size": "14px" }
}, Ot = ["max", "value"], St = { key: 1 }, Lt = ["disabled"], At = ["innerHTML", "disabled"], Mt = ["innerHTML"], Dt = { class: "chart-modal-options" }, Gt = ["innerHTML"], Tt = ["innerHTML"], xt = ["innerHTML"], Et = {
  style: { width: "100%", height: "fit-content" },
  ref: "chartModal"
}, Bt = { class: "vue-ui-table-fieldset" }, Ht = { class: "vue-ui-table-fieldset-wrapper" }, Rt = ["name", "id", "checked", "onInput"], zt = ["for"], Pt = ["disabled"], Ut = ["innerHTML"], Vt = { style: { width: "100%", "margin-bottom": "12px" } }, Xt = {
  key: 2,
  style: { width: "100%", "margin-bottom": "32px" }
};
function jt(n, s, r, i, t, e) {
  const y = x("VueUiXy"), f = x("VueUiDonut");
  return c(), u("div", {
    class: "vue-ui-table-main",
    style: g(`font-family: ${e.FINAL_CONFIG.fontFamily}`)
  }, [
    a("div", ne, [
      a("button", {
        onClick: s[0] || (s[0] = (l) => t.isExportRequest = !t.isExportRequest),
        innerHTML: e.icons.export,
        style: g(`background:${e.FINAL_CONFIG.style.exportMenu.backgroundColor};color:${e.FINAL_CONFIG.style.exportMenu.color}`)
      }, null, 12, re),
      a("div", {
        class: "vue-ui-table-export-hub-dropdown",
        "data-is-open": t.isExportRequest || "false",
        style: g(`background:${e.FINAL_CONFIG.style.exportMenu.backgroundColor};color:${e.FINAL_CONFIG.style.exportMenu.color}`)
      }, [
        s[25] || (s[25] = a("b", { class: "vue-ui-table-export-hub-title" }, " Export ", -1)),
        a("button", {
          class: "close-dropdown",
          onClick: s[1] || (s[1] = (l) => t.isExportRequest = !1),
          style: g(`background:${e.FINAL_CONFIG.style.closeButtons.backgroundColor};color:${e.FINAL_CONFIG.style.closeButtons.color};border-radius:${e.FINAL_CONFIG.style.closeButtons.borderRadius}`)
        }, " ✖ ", 4),
        a("div", le, [
          a("div", ae, [
            a("div", ie, d(e.FINAL_CONFIG.translations.exportAllLabel) + " (" + d(t.bodyCopy.length) + ") ", 1),
            a("button", {
              id: "exportAll",
              onClick: s[2] || (s[2] = (l) => e.createXls("all")),
              style: g(`background:${e.FINAL_CONFIG.style.exportMenu.buttons.backgroundColor};color:${e.FINAL_CONFIG.style.exportMenu.buttons.color}`)
            }, [
              a("div", {
                innerHTML: e.icons.fileDownload
              }, null, 8, ce),
              a("span", null, d(e.FINAL_CONFIG.translations.exportAllButton), 1)
            ], 4)
          ]),
          a("div", ue, [
            a("div", he, d(e.FINAL_CONFIG.translations.exportPageLabel), 1),
            a("button", {
              id: "exportPage",
              onClick: s[3] || (s[3] = (l) => e.createXls("page")),
              style: g(`background:${e.FINAL_CONFIG.style.exportMenu.buttons.backgroundColor};color:${e.FINAL_CONFIG.style.exportMenu.buttons.color}`)
            }, [
              a("div", {
                innerHTML: e.icons.fileDownload
              }, null, 8, de),
              a("span", null, d(e.FINAL_CONFIG.translations.exportPageButton), 1)
            ], 4)
          ])
        ])
      ], 12, oe)
    ]),
    a("div", {
      class: "vue-ui-table__wrapper",
      style: g(`max-height:${e.FINAL_CONFIG.maxHeight}px`),
      ref: "tableWrapper"
    }, [
      a("table", ge, [
        a("thead", ye, [
          a("tr", null, [
            s[26] || (s[26] = a("th", { class: "invisible-cell" }, null, -1)),
            (c(!0), u(I, null, _(t.tableHead, (l, o) => (c(), u("th", {
              key: `thead_${o}`,
              style: g(`overflow: visible;background:${e.FINAL_CONFIG.style.th.backgroundColor};color:${e.FINAL_CONFIG.style.th.color};outline:${e.FINAL_CONFIG.style.th.outline}`),
              class: p({ "th-has-nan": t.hasNaN[o] })
            }, [
              e.hasNumericTypes && ([t.constants.TEXT, t.constants.DATE].includes(l.type) || l.isPercentage) ? (c(), u("span", me, [
                w(d(l.name) + " ", 1),
                l.isPercentage ? (c(), u("span", be, " / " + d(l.percentageTo), 1)) : b("", !0)
              ])) : (c(), u("span", fe, d(l.name), 1))
            ], 6))), 128))
          ]),
          e.hasNumericTypes ? (c(), u(I, { key: 0 }, [
            a("tr", null, [
              s[27] || (s[27] = a("th", { class: "invisible-cell" }, null, -1)),
              (c(!0), u(I, null, _(t.tableHead, (l, o) => (c(), u("th", {
                key: `thead_${o}`,
                class: p({ "th-numeric": !0, "th-has-nan": t.hasNaN[o] }),
                style: g(`background:${e.FINAL_CONFIG.style.th.backgroundColor};color:${e.FINAL_CONFIG.style.th.color};outline:${e.FINAL_CONFIG.style.th.outline}`)
              }, [
                l.sum && !t.hasNaN[o] ? (c(), u("span", Ne, [
                  a("span", {
                    innerHTML: e.icons.sum,
                    style: { "margin-bottom": "-4px", "margin-right": "3px" }
                  }, null, 8, pe),
                  w(" " + d(e.dataLabel({
                    p: l.prefix,
                    v: Number(e.getSum(o)),
                    s: l.suffix,
                    r: l.decimals
                  })) + " ", 1),
                  t.percentages[o] && l.percentageTo && !l.isPercentage ? (c(), u("span", Ce, " (" + d(isNaN(e.getSum(o) / e.getSum(t.percentages[o].referenceIndex)) ? "-" : e.dataLabel({
                    v: e.getSum(o) / e.getSum(t.percentages[o].referenceIndex) * 100,
                    s: "%",
                    r: l.decimals
                  })) + ") ", 1)) : b("", !0)
                ])) : b("", !0)
              ], 6))), 128))
            ]),
            a("tr", null, [
              s[28] || (s[28] = a("th", { class: "invisible-cell" }, null, -1)),
              (c(!0), u(I, null, _(t.tableHead, (l, o) => (c(), u("th", {
                key: `thead_${o}`,
                class: p({ "th-numeric": !0, "th-has-nan": t.hasNaN[o] }),
                style: g(`background:${e.FINAL_CONFIG.style.th.backgroundColor};color:${e.FINAL_CONFIG.style.th.color};outline:${e.FINAL_CONFIG.style.th.outline}`)
              }, [
                l.average && !t.hasNaN[o] ? (c(), u("span", Ie, " ~ " + d(isNaN(e.getAverage(o)) ? "" : e.dataLabel({
                  p: l.prefix,
                  v: Number(e.getAverage(o)),
                  s: l.suffix,
                  r: l.decimals
                })), 1)) : b("", !0)
              ], 6))), 128))
            ]),
            a("tr", null, [
              s[31] || (s[31] = a("th", { class: "invisible-cell" }, null, -1)),
              (c(!0), u(I, null, _(t.tableHead, (l, o) => (c(), u("th", {
                key: `thead_${o}`,
                class: p({ "th-has-nan": t.hasNaN[o] }),
                style: g(`background:${e.FINAL_CONFIG.style.th.backgroundColor};color:${e.FINAL_CONFIG.style.th.color};outline:${e.FINAL_CONFIG.style.th.outline}`)
              }, [
                a("div", Fe, [
                  l.type === t.constants.DATE && t.dates[o] ? (c(), u("div", ve, [
                    a("div", we, [
                      a("div", _e, [
                        a("label", {
                          for: `from_${o}`
                        }, d(e.FINAL_CONFIG.translations.from), 9, ke),
                        O(a("input", {
                          id: `from_${o}`,
                          type: "date",
                          "onUpdate:modelValue": (h) => t.dates[o].from = h,
                          onInput: (h) => {
                            e.filterBody(), e.setFilterDatesIndexes(o);
                          },
                          style: g(`background:${e.FINAL_CONFIG.style.inputs.backgroundColor};color:${e.FINAL_CONFIG.style.inputs.color};border:${e.FINAL_CONFIG.style.inputs.border}`)
                        }, null, 44, Oe), [
                          [S, t.dates[o].from]
                        ])
                      ]),
                      a("div", Se, [
                        a("label", {
                          for: `to_${o}`
                        }, d(e.FINAL_CONFIG.translations.to), 9, Le),
                        O(a("input", {
                          id: `to_${o}`,
                          type: "date",
                          "onUpdate:modelValue": (h) => t.dates[o].to = h,
                          onInput: (h) => {
                            e.filterBody(), e.setFilterDatesIndexes(o);
                          },
                          style: g(`background:${e.FINAL_CONFIG.style.inputs.backgroundColor};color:${e.FINAL_CONFIG.style.inputs.color};border:${e.FINAL_CONFIG.style.inputs.border}`)
                        }, null, 44, Ae), [
                          [S, t.dates[o].to]
                        ])
                      ])
                    ]),
                    a("div", Me, [
                      l.isSort ? (c(), u("button", {
                        key: 0,
                        onClick: (h) => e.sortTh(o, h),
                        class: p({ "th-button-active": [t.constants.DESC, t.constants.ASC].includes(t.sorts[o]) }),
                        style: g(`background:${[t.constants.DESC, t.constants.ASC].includes(t.sorts[o]) ? "" : e.FINAL_CONFIG.style.pagination.buttons.backgroundColor};color:${[t.constants.DESC, t.constants.ASC].includes(t.sorts[o]) ? "" : e.FINAL_CONFIG.style.pagination.buttons.color}`)
                      }, [
                        t.sorts[o] === t.constants.ASC ? (c(), u("span", {
                          key: 0,
                          innerHTML: [t.constants.DATE].includes(l.type) ? e.icons.sort09 : e.icons.sortAZ
                        }, null, 8, Ge)) : t.sorts[o] === t.constants.DESC ? (c(), u("span", {
                          key: 1,
                          innerHTML: [t.constants.DATE].includes(l.type) ? e.icons.sort90 : e.icons.sortZA
                        }, null, 8, Te)) : (c(), u("span", {
                          key: 2,
                          innerHTML: e.icons.arrowSort
                        }, null, 8, xe))
                      ], 14, De)) : b("", !0),
                      a("button", {
                        onClick: (h) => {
                          e.resetDates(o), e.resetFilter(o, l, h);
                        },
                        disabled: !t.filteredDatesIndexes[o] && e.isResetDisabled(o, l),
                        class: "th-reset"
                      }, " ✖ ", 8, Ee)
                    ])
                  ])) : b("", !0),
                  l.isSearch ? O((c(), u("input", {
                    key: 1,
                    placeholder: e.FINAL_CONFIG.translations.inputPlaceholder,
                    "onUpdate:modelValue": (h) => t.searches[o] = h,
                    onInput: s[4] || (s[4] = (h) => e.debounce(e.filterBody, 400)),
                    name: `search_${o}`,
                    style: g(`background:${e.FINAL_CONFIG.style.inputs.backgroundColor};color:${e.FINAL_CONFIG.style.inputs.color};border:${e.FINAL_CONFIG.style.inputs.border}`)
                  }, null, 44, Be)), [
                    [S, t.searches[o]]
                  ]) : b("", !0),
                  !t.hasNaN[o] && l.isSort && l.type !== t.constants.DATE ? (c(), u("button", {
                    key: 2,
                    onClick: (h) => e.sortTh(o, h),
                    class: p({ "th-button-active": [t.constants.DESC, t.constants.ASC].includes(t.sorts[o]) }),
                    style: g(`background:${[t.constants.DESC, t.constants.ASC].includes(t.sorts[o]) ? "" : e.FINAL_CONFIG.style.pagination.buttons.backgroundColor};color:${[t.constants.DESC, t.constants.ASC].includes(t.sorts[o]) ? "" : e.FINAL_CONFIG.style.pagination.buttons.color}`)
                  }, [
                    t.sorts[o] === t.constants.ASC ? (c(), u("span", {
                      key: 0,
                      innerHTML: [t.constants.NUMERIC].includes(l.type) ? e.icons.sort09 : e.icons.sortZA
                    }, null, 8, Re)) : t.sorts[o] === t.constants.DESC ? (c(), u("span", {
                      key: 1,
                      innerHTML: [t.constants.NUMERIC].includes(l.type) ? e.icons.sort90 : e.icons.sortAZ
                    }, null, 8, ze)) : (c(), u("span", {
                      key: 2,
                      innerHTML: e.icons.arrowSort
                    }, null, 8, Pe))
                  ], 14, He)) : b("", !0),
                  l.isMultiselect ? (c(), u("button", {
                    key: 3,
                    onClick: (h) => e.toggleMultiselect(o, l, h),
                    innerHTML: e.icons.filter,
                    class: p({ "th-button-active": t.multiselects[o] && t.multiselects[o].length !== e.getDropdownOptions(o).length }),
                    style: g(`background:${t.multiselects[o] && t.multiselects[o].length !== e.getDropdownOptions(o).length ? "" : e.FINAL_CONFIG.style.pagination.buttons.backgroundColor};color:${t.multiselects[o] && t.multiselects[o].length !== e.getDropdownOptions(o).length ? "" : e.FINAL_CONFIG.style.pagination.buttons.color}`)
                  }, null, 14, Ue)) : b("", !0),
                  t.currentSelectionSpan.col === o && e.canChart ? (c(), u("button", {
                    key: 4,
                    onClick: s[5] || (s[5] = (h) => t.showChart = !t.showChart),
                    innerHTML: e.icons.chart,
                    class: p({ "th-button-active": t.showChart }),
                    style: g(`background:${t.showChart ? "" : e.FINAL_CONFIG.style.pagination.buttons.backgroundColor};color:${t.showChart ? "" : e.FINAL_CONFIG.style.pagination.buttons.color}`)
                  }, null, 14, Ve)) : b("", !0),
                  l.rangeFilter && t.rangeFilters[o] && !t.hasNaN[o] ? (c(), u("div", Xe, [
                    a("label", {
                      for: `rangeMin${o}`
                    }, s[29] || (s[29] = [
                      a("span", { style: { color: "grey" } }, "ᒥ", -1),
                      w(" min "),
                      a("span", { style: { color: "grey" } }, "ᒣ", -1)
                    ]), 8, je),
                    O(a("input", {
                      type: "number",
                      id: `rangeMin${o}`,
                      max: t.immutableRangeFilters[o].max,
                      min: t.immutableRangeFilters[o].min,
                      "onUpdate:modelValue": (h) => t.rangeFilters[o].min = h,
                      onInput: s[6] || (s[6] = (h) => e.debounce(e.filterBody, 400)),
                      style: g(`background:${e.FINAL_CONFIG.style.inputs.backgroundColor};color:${e.FINAL_CONFIG.style.inputs.color};border:${e.FINAL_CONFIG.style.inputs.border}`)
                    }, null, 44, Ye), [
                      [
                        S,
                        t.rangeFilters[o].min,
                        void 0,
                        { number: !0 }
                      ]
                    ]),
                    O(a("input", {
                      type: "number",
                      id: `rangeMax${o}`,
                      max: t.immutableRangeFilters[o].max,
                      min: t.immutableRangeFilters[o].min,
                      "onUpdate:modelValue": (h) => t.rangeFilters[o].max = h,
                      onInput: s[7] || (s[7] = (h) => e.debounce(e.filterBody, 400)),
                      style: g(`background:${e.FINAL_CONFIG.style.inputs.backgroundColor};color:${e.FINAL_CONFIG.style.inputs.color};border:${e.FINAL_CONFIG.style.inputs.border}`)
                    }, null, 44, We), [
                      [
                        S,
                        t.rangeFilters[o].max,
                        void 0,
                        { number: !0 }
                      ]
                    ]),
                    a("label", {
                      for: `rangeMax${o}`
                    }, s[30] || (s[30] = [
                      a("span", { style: { color: "grey" } }, "ᒪ", -1),
                      w(" max "),
                      a("span", { style: { color: "grey" } }, "ᒧ", -1)
                    ]), 8, Je)
                  ])) : b("", !0),
                  e.canResetColumn(o, l) ? (c(), u("button", {
                    key: 6,
                    onClick: (h) => e.resetFilter(o, l, h),
                    disabled: e.isResetDisabled(o, l),
                    class: "th-reset"
                  }, " ✖ ", 8, Ke)) : b("", !0),
                  l.isMultiselect ? (c(), u("div", {
                    key: 7,
                    class: "th-dropdown",
                    "data-is-open": "false",
                    id: `th_dropdown_${o}`,
                    style: g(`background:${e.FINAL_CONFIG.style.dropdowns.backgroundColor};color:${e.FINAL_CONFIG.style.dropdowns.color}`)
                  }, [
                    a("button", {
                      class: "close-dropdown",
                      onClick: (h) => e.toggleMultiselect(o, l, h),
                      style: g(`background:${e.FINAL_CONFIG.style.closeButtons.backgroundColor};color:${e.FINAL_CONFIG.style.closeButtons.color}`)
                    }, " ✖ ", 12, qe),
                    (c(!0), u(I, null, _(e.getDropdownOptions(o), (h, m) => (c(), u("span", {
                      class: "th-option",
                      key: `th_option_${o}_${m}`,
                      onClick: (F) => e.selectDropdownOption(h, o),
                      onKeyup: [
                        L((F) => e.selectDropdownOption(h, o), ["enter"]),
                        L((F) => e.selectDropdownOption(h, o), ["space"])
                      ],
                      style: g(`opacity:${e.isDropdownOptionSelected(h, o) ? 1 : 0.5}`),
                      tabindex: "0"
                    }, [
                      e.isDropdownOptionSelected(h, o) ? (c(), u("span", {
                        key: 0,
                        style: g(`color:${e.FINAL_CONFIG.style.dropdowns.icons.selected.color};margin-right:5px`),
                        class: "th-icon-green"
                      }, d(e.FINAL_CONFIG.style.dropdowns.icons.selected.unicode), 5)) : (c(), u("span", {
                        key: 1,
                        style: g(`color:${e.FINAL_CONFIG.style.dropdowns.icons.unselected.color};margin-right:5px`),
                        class: "th-icon-red"
                      }, d(e.FINAL_CONFIG.style.dropdowns.icons.unselected.unicode), 5)),
                      a("span", null, d(h), 1)
                    ], 44, Qe))), 128))
                  ], 12, Ze)) : b("", !0)
                ])
              ], 6))), 128))
            ])
          ], 64)) : b("", !0),
          a("tr", null, [
            s[32] || (s[32] = a("th", { class: "invisible-cell" }, null, -1)),
            (c(!0), u(I, null, _(t.tableHead, (l, o) => (c(), u("th", {
              key: `col_selector_${o}`,
              class: p({ "vue-ui-table-col-selector": !t.hasNaN[o], "th-has-nan": t.hasNaN[o] }),
              style: g(`background:${o === t.selectedColumn && !t.hasNaN[o] ? e.FINAL_CONFIG.style.th.selected.backgroundColor : e.FINAL_CONFIG.style.th.backgroundColor};color:${o === t.selectedColumn && !t.hasNaN[o] ? e.FINAL_CONFIG.style.th.selected.color : e.FINAL_CONFIG.style.th.color};outline:${e.FINAL_CONFIG.style.th.outline}`)
            }, [
              t.hasNaN[o] ? b("", !0) : (c(), u("div", {
                key: 0,
                innerHTML: t.tableHead[o].type === t.constants.NUMERIC ? e.icons.chevronDown : "",
                class: p({ "col-selector": t.tableHead[o].type === t.constants.NUMERIC }),
                tabindex: "0",
                onClick: A((h) => e.selectColumn(o), ["stop"]),
                onKeyup: L((h) => e.selectColumn(o), ["enter"])
              }, null, 42, $e))
            ], 6))), 128))
          ])
        ]),
        a("tbody", {
          onClick: s[8] || (s[8] = (...l) => e.closeAllDropdowns && e.closeAllDropdowns(...l)),
          onKeydown: s[9] || (s[9] = (l) => e.navigateCell(l))
        }, [
          (c(!0), u(I, null, _(e.visibleRows, (l, o) => (c(), u("tr", {
            key: `tbody_${o}`,
            "data-row": o % 2 === 0 ? "odd" : "even",
            class: p(`tr_${t.uid}`),
            style: g(`${o % 2 === 0 ? `background:${e.FINAL_CONFIG.style.rows.odd.backgroundColor};color:${e.FINAL_CONFIG.style.rows.odd.color}` : `background:${e.FINAL_CONFIG.style.rows.even.backgroundColor};color:${e.FINAL_CONFIG.style.rows.even.color}`}`)
          }, [
            a("td", {
              class: "vue-ui-table-td-iteration",
              "data-row": o % 2 === 0 ? "odd" : "even"
            }, d(l.absoluteIndex + 1), 9, tt),
            (c(!0), u(I, null, _(l.td, (h, m) => (c(), u("td", {
              "data-row": o % 2 === 0 ? "odd" : "even",
              key: `td_${o}_${m}`,
              style: g(e.isNumeric(h) || r.dataset.header[m].type === t.constants.DATE ? "text-align:right;font-variant-numeric: tabular-nums;" : ""),
              onClick: (F) => e.selectTd({
                td: h,
                rowIndex: o,
                colIndex: m,
                headerType: r.dataset.header[m].type,
                event: F
              }),
              onKeyup: [
                L((F) => e.selectTd({
                  td: h,
                  rowIndex: o,
                  colIndex: m,
                  headerType: r.dataset.header[m].type,
                  event: F
                }), ["enter"]),
                L((F) => e.selectTd({
                  td: h,
                  rowIndex: o,
                  colIndex: m,
                  headerType: r.dataset.header[m].type,
                  event: F
                }), ["space"])
              ],
              class: p({ "td-numeric": r.dataset.header[m].type === t.constants.NUMERIC, "td-focusable": !0, "td-has-nan": t.hasNaN[m] }),
              id: `cell_${o}_${m}_${t.uid}`,
              tabindex: "0"
            }, [
              l.meta && l.meta.markerIndices.includes(m) && l.meta.unicodeIcon ? (c(), u("span", {
                key: 0,
                style: g(`color:${l.meta.color};margin-right:3px`),
                innerHTML: l.meta.unicodeIcon
              }, null, 12, nt)) : b("", !0),
              r.dataset.header[m].type === t.constants.DATE ? (c(), u("span", rt, d(r.dataset.header[m].prefix) + " " + d(new Date(h).toLocaleString().slice(0, 10)) + " " + d(r.dataset.header[m].suffix), 1)) : r.dataset.header[m].isPercentage ? (c(), u("span", ot, d(e.dataLabel({
                v: Number(h * 100),
                s: "%",
                r: r.dataset.header[m].decimals
              })), 1)) : t.percentages[m] && r.dataset.header[m].percentageTo && !r.dataset.header[m].isPercentage ? (c(), u("span", {
                key: 3,
                class: p({ "td-nan": isNaN(Number(h)) })
              }, d(isNaN(Number(h)) ? `${h} is not ${t.constants.NUMERIC}` : e.dataLabel({
                p: r.dataset.header[m].prefix,
                v: Number(h),
                s: r.dataset.header[m].suffix,
                r: r.dataset.header[m].decimals
              })) + " (" + d(isNaN(Number(h)) ? "" : e.dataLabel({
                v: Number(h / e.getSum(t.percentages[m].referenceIndex) * 100),
                s: "%",
                r: r.dataset.header[m].decimals
              })) + ") ", 3)) : r.dataset.header[m].type === t.constants.NUMERIC ? (c(), u("span", {
                key: 4,
                class: p({ "td-nan": isNaN(Number(h)) })
              }, d(isNaN(Number(h)) ? `${h} is not ${t.constants.NUMERIC}` : e.dataLabel({
                p: r.dataset.header[m].prefix,
                v: Number(h.toFixed(r.dataset.header[m].decimals)),
                s: r.dataset.header[m].suffix,
                r: r.dataset.header[m].decimals
              })), 3)) : (c(), u("span", lt, d(r.dataset.header[m].prefix) + " " + d(h) + " " + d(r.dataset.header[m].suffix), 1))
            ], 46, st))), 128))
          ], 14, et))), 128))
        ], 32)
      ])
    ], 4),
    a("div", {
      class: p({ "td-selector-info": !0, "td-selector-info--active": t.currentSelectionSpan.col !== void 0 && t.currentSelectionSpan.rows.length }),
      style: g(`background:${e.FINAL_CONFIG.style.infoBar.backgroundColor};color:${e.FINAL_CONFIG.style.infoBar.color}`)
    }, [
      t.currentSelectionSpan.col !== void 0 && t.currentSelectionSpan.rows.length ? (c(), u(I, { key: 0 }, [
        a("div", {
          innerHTML: e.icons.table,
          class: "td-selector-icon"
        }, null, 8, at),
        a("span", null, [
          a("b", null, [
            w(d(r.dataset.header[t.currentSelectionSpan.col].name) + " ", 1),
            r.dataset.header[t.currentSelectionSpan.col].isPercentage ? (c(), u("span", it, " / " + d(r.dataset.header[t.percentages[t.currentSelectionSpan.col].referenceIndex].name), 1)) : b("", !0)
          ]),
          a("span", ct, [
            w(d(e.FINAL_CONFIG.translations.nb) + " : ", 1),
            a("b", ut, d(t.currentSelectionSpan.rows.length), 1)
          ]),
          a("span", ht, [
            w(d(e.FINAL_CONFIG.translations.sum) + " : ", 1),
            r.dataset.header[t.currentSelectionSpan.col].isPercentage ? (c(), u("b", dt, d(e.selectedCellsCalculations.sumPercentage), 1)) : (c(), u("b", gt, d(r.dataset.header[t.currentSelectionSpan.col].prefix) + " " + d(e.selectedCellsCalculations.sumRegular) + " " + d(r.dataset.header[t.currentSelectionSpan.col].suffix), 1)),
            r.dataset.header[t.currentSelectionSpan.col].isPercentage ? (c(), u("b", yt, "%")) : b("", !0)
          ]),
          a("span", mt, [
            w(d(e.FINAL_CONFIG.translations.average) + " : ", 1),
            r.dataset.header[t.currentSelectionSpan.col].isPercentage ? (c(), u("b", bt, d(e.selectedCellsCalculations.averagePercentage), 1)) : (c(), u("b", ft, d(r.dataset.header[t.currentSelectionSpan.col].prefix) + " " + d(e.selectedCellsCalculations.averageRegular) + " " + d(r.dataset.header[t.currentSelectionSpan.col].suffix), 1)),
            r.dataset.header[t.currentSelectionSpan.col].isPercentage ? (c(), u("b", Nt, "%")) : b("", !0)
          ])
        ]),
        a("button", {
          onClick: s[10] || (s[10] = (...l) => e.resetSelection && e.resetSelection(...l)),
          class: "td-selector-info-reset",
          style: g(`background:${e.FINAL_CONFIG.style.closeButtons.backgroundColor};color:${e.FINAL_CONFIG.style.closeButtons.color};border-radius:${e.FINAL_CONFIG.style.closeButtons.borderRadius}`)
        }, " ✖ ", 4)
      ], 64)) : b("", !0)
    ], 6),
    t.bodyCopy.length > 10 ? (c(), u("div", pt, [
      w(d(e.FINAL_CONFIG.translations.totalRows) + " : " + d(r.dataset.body.length) + " | " + d(e.FINAL_CONFIG.translations.paginatorLabel) + " : ", 1),
      t.bodyCopy.length > 10 ? O((c(), u("select", {
        key: 0,
        id: "paginatorSelector",
        "onUpdate:modelValue": s[11] || (s[11] = (l) => t.itemsPerPage = l),
        onChange: s[12] || (s[12] = (...l) => e.resetSelection && e.resetSelection(...l)),
        style: g(`background:${e.FINAL_CONFIG.style.inputs.backgroundColor};color:${e.FINAL_CONFIG.style.inputs.color};border:${e.FINAL_CONFIG.style.inputs.border}`)
      }, [
        (c(!0), u(I, null, _(t.paginatorOptions, (l, o) => (c(), u(I, null, [
          t.bodyCopy.length > l || r.dataset.body.length === l ? (c(), u("option", {
            key: `paginator_option_${o}`
          }, d(l), 1)) : b("", !0)
        ], 64))), 256))
      ], 36)), [
        [
          $,
          t.itemsPerPage,
          void 0,
          { number: !0 }
        ]
      ]) : b("", !0)
    ])) : b("", !0),
    t.itemsPerPage >= 250 ? (c(), u("div", Ct, [
      a("span", {
        innerHTML: e.icons.warning
      }, null, 8, It),
      w(d(e.FINAL_CONFIG.translations.sizeWarning), 1)
    ])) : b("", !0),
    e.pages.length > 1 && e.pages.length <= 10 ? (c(), u("div", {
      key: 2,
      class: "vue-ui-table-navigation-indicator",
      style: g(`background:${e.FINAL_CONFIG.style.pagination.navigationIndicator.backgroundColor};width:calc(${t.currentPage / (e.pages.length - 1) * 100}%)`)
    }, null, 4)) : b("", !0),
    e.pages.length > 1 ? (c(), u("div", Ft, [
      a("button", {
        class: "vue-ui-table-navigation",
        onClick: s[13] || (s[13] = A((l) => e.navigate("previous"), ["stop"])),
        innerHTML: e.icons.chevronLeft,
        disabled: t.currentPage === 0,
        style: g(`background:${e.FINAL_CONFIG.style.pagination.buttons.backgroundColor};color:${e.FINAL_CONFIG.style.pagination.buttons.color};opacity:${t.currentPage === 0 ? e.FINAL_CONFIG.style.pagination.buttons.opacityDisabled : 1}`)
      }, null, 12, vt),
      e.pages.length > 3 ? (c(), u(I, { key: 0 }, [
        a("button", {
          class: "vue-ui-table-navigation",
          onClick: s[14] || (s[14] = A((l) => e.navigate(1), ["stop"])),
          disabled: t.currentPage === 0,
          style: g(`background:${e.FINAL_CONFIG.style.pagination.buttons.backgroundColor};color:${e.FINAL_CONFIG.style.pagination.buttons.color};opacity:${t.currentPage === 0 ? e.FINAL_CONFIG.style.pagination.buttons.opacityDisabled : 1}`)
        }, " 1 ", 12, wt),
        e.pages.length > 10 ? (c(), u("div", _t, [
          a("label", kt, d(e.FINAL_CONFIG.translations.page) + " " + d(t.currentPage + 1) + " / " + d(e.pages.length), 1),
          a("input", {
            class: "vue-ui-table-page-scroller",
            id: "pageScroller",
            type: "range",
            step: "1",
            min: 0,
            max: e.pages.length - 1,
            onInput: s[15] || (s[15] = (l) => e.updateCurrentPage(l)),
            value: t.currentPage,
            style: g(`background:${e.FINAL_CONFIG.style.inputs.backgroundColor};color:${e.FINAL_CONFIG.style.inputs.color};border:${e.FINAL_CONFIG.style.inputs.border};accent-color:${e.FINAL_CONFIG.style.inputs.accentColor}`)
          }, null, 44, Ot)
        ])) : (c(), u("span", St, d(e.FINAL_CONFIG.translations.page) + " " + d(t.currentPage + 1) + " / " + d(e.pages.length), 1)),
        a("button", {
          class: "vue-ui-table-navigation",
          onClick: s[16] || (s[16] = A((l) => e.navigate(e.pages.length), ["stop"])),
          disabled: t.currentPage === e.pages.length - 1,
          style: g(`background:${e.FINAL_CONFIG.style.pagination.buttons.backgroundColor};color:${e.FINAL_CONFIG.style.pagination.buttons.color};opacity:${t.currentPage === e.pages.length - 1 ? e.FINAL_CONFIG.style.pagination.buttons.opacityDisabled : 1}`)
        }, d(e.pages.length), 13, Lt)
      ], 64)) : (c(), u(I, { key: 1 }, [
        w(d(e.FINAL_CONFIG.translations.page) + " " + d(t.currentPage + 1) + " / " + d(e.pages.length), 1)
      ], 64)),
      a("button", {
        class: "vue-ui-table-navigation",
        onClick: s[17] || (s[17] = A((l) => e.navigate("next"), ["stop"])),
        innerHTML: e.icons.chevronRight,
        disabled: t.currentPage === e.pages.length - 1,
        style: g(`background:${e.FINAL_CONFIG.style.pagination.buttons.backgroundColor};color:${e.FINAL_CONFIG.style.pagination.buttons.color};opacity:${t.currentPage === e.pages.length - 1 ? e.FINAL_CONFIG.style.pagination.buttons.opacityDisabled : 1}`)
      }, null, 12, At)
    ])) : b("", !0),
    t.showChart && e.canChart ? (c(), u("div", {
      key: 4,
      class: "vue-ui-table-chart-modal",
      style: g(`width: ${t.modalWidth}px;top:${t.clientY}px; left:${t.clientX}px;background:${e.FINAL_CONFIG.style.chart.modal.backgroundColor};color:${e.FINAL_CONFIG.style.chart.modal.color}`)
    }, [
      a("div", {
        class: "modal-drag-handle",
        onMousedown: s[19] || (s[19] = (...l) => e.dragMouseDown && e.dragMouseDown(...l))
      }, [
        a("span", {
          innerHTML: e.icons.grip
        }, null, 8, Mt),
        a("button", {
          class: "close-chart-modal",
          onClick: s[18] || (s[18] = (l) => t.showChart = !1)
        }, "✖")
      ], 32),
      a("button", {
        style: g([{ "z-index": "1" }, `background:${e.FINAL_CONFIG.style.closeButtons.backgroundColor};color:${e.FINAL_CONFIG.style.closeButtons.color};border-radius:${e.FINAL_CONFIG.style.closeButtons.borderRadius}`]),
        class: "close-chart-modal",
        onClick: s[20] || (s[20] = (l) => t.showChart = !1)
      }, " ✖ ", 4),
      a("div", Dt, [
        e.availableDonutCategories.length ? (c(), u("button", {
          key: 0,
          onClick: s[21] || (s[21] = (l) => t.showDonutOptions = !0),
          innerHTML: e.icons.donut,
          class: p({ "is-active-chart": t.chart.type === t.constants.DONUT || t.showDonutOptions }),
          style: g(`background:${t.chart.type === t.constants.DONUT || t.showDonutOptions ? e.FINAL_CONFIG.style.chart.modal.buttons.selected.backgroundColor : e.FINAL_CONFIG.style.chart.modal.buttons.unselected.backgroundColor};color:${t.chart.type === t.constants.DONUT || t.showDonutOptions ? e.FINAL_CONFIG.style.chart.modal.buttons.selected.color : e.FINAL_CONFIG.style.chart.modal.buttons.unselected.color}`)
        }, null, 14, Gt)) : b("", !0),
        a("button", {
          onClick: s[22] || (s[22] = (l) => {
            t.chart.type = t.constants.LINE, t.showDonutOptions = !1;
          }),
          innerHTML: e.icons.chart,
          class: p({ "is-active-chart": t.chart.type === t.constants.LINE && !t.showDonutOptions }),
          style: g(`background:${t.chart.type === t.constants.LINE && !t.showDonutOptions ? e.FINAL_CONFIG.style.chart.modal.buttons.selected.backgroundColor : e.FINAL_CONFIG.style.chart.modal.buttons.unselected.backgroundColor};color:${t.chart.type === t.constants.LINE && !t.showDonutOptions ? e.FINAL_CONFIG.style.chart.modal.buttons.selected.color : e.FINAL_CONFIG.style.chart.modal.buttons.unselected.color}`)
        }, null, 14, Tt),
        a("button", {
          onClick: s[23] || (s[23] = (l) => {
            t.chart.type = t.constants.BAR, t.showDonutOptions = !1;
          }),
          innerHTML: e.icons.bar,
          class: p({ "is-active-chart": t.chart.type === t.constants.BAR && !t.showDonutOptions }),
          style: g(`background:${t.chart.type === t.constants.BAR && !t.showDonutOptions ? e.FINAL_CONFIG.style.chart.modal.buttons.selected.backgroundColor : e.FINAL_CONFIG.style.chart.modal.buttons.unselected.backgroundColor};color:${t.chart.type === t.constants.BAR && !t.showDonutOptions ? e.FINAL_CONFIG.style.chart.modal.buttons.selected.color : e.FINAL_CONFIG.style.chart.modal.buttons.unselected.color}`)
        }, null, 14, xt)
      ]),
      a("div", Et, [
        t.showDonutOptions && e.availableDonutCategories.length ? (c(), u("div", {
          key: 0,
          style: g(`background:${e.FINAL_CONFIG.style.chart.modal.backgroundColor};color:${e.FINAL_CONFIG.style.chart.modal.color}`)
        }, [
          a("fieldset", Bt, [
            a("legend", null, d(e.FINAL_CONFIG.translations.chooseCategoryColumn), 1),
            a("div", Ht, [
              (c(!0), u(I, null, _(e.availableDonutCategories, (l, o) => (c(), u("div", {
                key: `donut_radio_${o}`,
                class: "vue-ui-table-fieldset-option"
              }, [
                a("input", {
                  type: "radio",
                  name: l.name,
                  id: l.name,
                  checked: t.selectedDonutCategory && l.name === t.selectedDonutCategory.name,
                  onInput: (h) => t.selectedDonutCategory = e.availableDonutCategories[o],
                  style: g(`background:${e.FINAL_CONFIG.style.inputs.backgroundColor};color:${e.FINAL_CONFIG.style.inputs.color};border:${e.FINAL_CONFIG.style.inputs.border};accent-color:${e.FINAL_CONFIG.style.inputs.accentColor}`)
                }, null, 44, Rt),
                a("label", {
                  for: l.name
                }, d(l.name), 9, zt)
              ]))), 128))
            ]),
            a("button", {
              class: "vue-ui-table-generate-donut",
              disabled: !t.selectedDonutCategory,
              onClick: s[24] || (s[24] = (...l) => e.applyDonutOption && e.applyDonutOption(...l)),
              style: g(`background:${e.FINAL_CONFIG.style.chart.modal.buttons.selected.backgroundColor};color:${e.FINAL_CONFIG.style.chart.modal.buttons.selected.color}`)
            }, [
              a("div", {
                style: { "margin-bottom": "-3px" },
                innerHTML: e.icons.donut
              }, null, 8, Ut),
              w(" " + d(e.FINAL_CONFIG.translations.makeDonut), 1)
            ], 12, Pt)
          ])
        ], 4)) : b("", !0),
        [t.constants.BAR, t.constants.LINE].includes(t.chart.type) && !t.showDonutOptions ? (c(), u(I, { key: 1 }, [
          a("div", Vt, [
            t.chart.type === t.constants.LINE ? (c(), E(y, {
              key: 0,
              dataset: e.chartData.xyDatasetLine,
              config: e.chartData.xyConfig
            }, null, 8, ["dataset", "config"])) : b("", !0),
            t.chart.type === t.constants.BAR ? (c(), E(y, {
              key: 1,
              dataset: e.chartData.xyDatasetBar,
              config: e.chartData.xyConfig
            }, null, 8, ["dataset", "config"])) : b("", !0)
          ]),
          t.currentSelectionSpan.rows.length >= 2 ? (c(), u("div", {
            key: 0,
            class: "chart-trend",
            style: g(`color:${e.FINAL_CONFIG.style.chart.modal.color}`)
          }, [
            s[33] || (s[33] = a("span", null, "---", -1)),
            w(" Trend: " + d(e.dataLabel({
              v: e.chartData.progression.trend,
              s: "%",
              r: 1
            })), 1)
          ], 4)) : b("", !0)
        ], 64)) : b("", !0),
        [t.constants.DONUT].includes(t.chart.type) && !t.showDonutOptions ? (c(), u("div", Xt, [
          ee(f, {
            dataset: t.currentDonut,
            config: e.chartData.donutConfig
          }, null, 8, ["dataset", "config"])
        ])) : b("", !0)
      ], 512)
    ], 4)) : b("", !0)
  ], 4);
}
const Qt = /* @__PURE__ */ te(se, [["render", jt], ["__scopeId", "data-v-1713331c"]]);
export {
  Qt as default
};
