import { computed as E, defineComponent as fe, ref as g, watch as ue, openBlock as l, createElementBlock as a, createElementVNode as n, Fragment as w, renderList as V, unref as S, normalizeClass as $e, toDisplayString as _, toRef as he, renderSlot as A, withKeys as pe, withDirectives as F, createCommentVNode as T, vModelSelect as Y, normalizeStyle as Z, vModelText as ke, createTextVNode as ve, createVNode as be, pushScopeId as ye, popScopeId as ge, createStaticVNode as _e, onMounted as Ve, withModifiers as ne, vShow as Ce } from "vue"; function xe(t, o) { return { getColumnProperties: E(() => t.value.map((v) => { if (typeof v == "object" && "prop" in v || "property" in v) return v.prop || v.property; })), getColumnData: (v) => { const p = o.value.map((y) => y[v]); return Array.from(new Set(p)); } }; } function Te(t, o, e) { const c = E(() => { let y = []; return o.value.length > 1 ? y = t.value.filter((d) => { for (const u of Object.keys(d)) { if (isNaN(d[u]) === !1 && Number(d[u]) === Number(o.value)) return !0; if (typeof d[u] == "string" && String(d[u]).toLowerCase().includes(String(o.value).toLowerCase())) return !0; } return !1; }) : y = t.value, y; }), v = E(() => { const y = {}, d = /* @__PURE__ */ new Set(["", 0, null, void 0]); for (const u of Object.keys(e.value)) d.has(e.value[u]) || (y[u] = e.value[u]); return y; }), p = E(() => { let y = c.value; for (const d of Object.keys(v.value)) y = y.filter((u) => { if (d in u) { if (isNaN(u[d]) === !1 && Number(u[d]) === Number(v.value[d])) return !0; if (typeof u[d] == "string" && String(u[d]).toLowerCase().includes(String(v.value[d]).toLowerCase())) return !0; } return !1; }); return y; }); return { searchedEntries: c, getCleanFilter: v, filteredEntries: p }; } function Be(t, o) { return { sortedEntries: E(() => { let c = t.value; return "by" in o.value && o.value.by !== "" && c.sort((v, p) => { if (o.value.col in v && o.value.col in p) { if (isNaN(v[o.value.col]) === !1 && isNaN(p[o.value.col]) === !1) return o.value.by === "asc" ? Number(v[o.value.col]) - Number(p[o.value.col]) : Number(p[o.value.col]) - Number(v[o.value.col]); if (typeof v[o.value.col] == "string" && typeof p[o.value.col] == "string") return o.value.by === "asc" ? v[o.value.col].localeCompare(p[o.value.col]) : p[o.value.col].localeCompare(v[o.value.col]); } }), c; }) }; } function Ie(t, o, e, c) { const v = E(() => o.value * e.value - (o.value - 1)), p = E(() => { let k = Math.ceil(t.value.length / o.value); return k < 1 && (k = 1), k; }), y = E(() => t.value.slice(v.value - 1, o.value * e.value)), d = E(() => { const k = o.value * e.value; return { start: v.value, end: k < t.value.length ? k : t.value.length, length: t.value.length }; }), u = E(() => { let k = []; const x = p.value < e.value ? p.value : e.value, D = e.value < 1 ? 1 : e.value, P = x + c.value, z = D - c.value; if (c.value === 0) for (let N = 1; N <= p.value; N++) k.push(N); else { if (D > 1) for (let N = z; N < D; N++) k.push(N); for (let N = x; N <= P; N++) k.push(N); } const B = k.filter((N) => Number(N) > 0).filter((N) => Number(N) <= p.value); return P < p.value && c.value !== 0 && B.push("..."), z > 1 && c.value !== 0 && B.unshift("..."), B; }); return { getOffset: v, getPages: p, paginatedEntries: y, getPageInfo: d, getPagination: u, handleEllipsis: (k, x) => { let D = x, P = Math.floor(Number(x) / 2), z = x; return Number(x) % 2 === 0 && (z = Number(x) + 1), Number(k) <= P ? D = z - (Number(k) - 1) : D = P, D; } }; } var Me = function(t, o) { o === void 0 && (o = 10); var e = Array.isArray(t) ? t.length : t, c = Number(e) / Number(o), v = Math.ceil(c); return v; }, Le = function(t, o, e) { o === void 0 && (o = 1), e === void 0 && (e = 0); var c = [], v = Number(t) < Number(o) ? Number(t) : Number(o), p = Number(o) < 1 ? 1 : Number(o), y = v + Number(e), d = p - Number(e); if (Number(e) === 0) for (var u = 1; u <= Number(t); u++) c.push(String(u)); else { if (p > 1) for (var u = d; u < p; u++) c.push(String(u)); for (var u = v; u <= y; u++) c.push(String(u)); } var L = c.filter(function(x) { return Number(x) > 0; }), k = L.filter(function(x) { return Number(x) <= Number(t); }); return y < Number(t) && Number(e) !== 0 && k.push("..."), d > 1 && Number(e) !== 0 && k.unshift("..."), k; }; const ze = { class: "pagination dense" }, He = { class: "item" }, Ee = { class: "item" }, Se = { key: 0, class: "link" }, De = { key: 1, class: "link" }, Re = ["onClick"], Ue = { class: "item" }, Ae = { class: "item" }, Pe = /* @__PURE__ */ fe({ __name: "PaginationBox", props: { modelValue: null, pages: null, items: null, ellipsis: null }, emits: ["update:modelValue", "handler"], setup(t, { emit: o }) { const e = t, c = g((e == null ? void 0 : e.modelValue) || 1); ue(() => e.modelValue, () => { c.value = e.modelValue; }); const v = E(() => { let y = []; if (e != null && e.items) y = (e == null ? void 0 : e.items) || []; else { const d = e.pages, u = (e == null ? void 0 : e.ellipsis) || 2; y = Le(d, c.value, u); } return y; }), p = (y) => { c.value = y, o("update:modelValue", c.value), o("handler", c.value); }; return (y, d) => (l(), a("nav", null, [ n("ul", ze, [ n("li", He, [ n("span", { class: "link", onClick: d[0] || (d[0] = (u) => p(1)) }, " « ") ]), n("li", Ee, [ n("span", { class: "link", onClick: d[1] || (d[1] = (u) => p(Number(c.value) > 1 ? Number(c.value) - 1 : 1)) }, " ‹ ") ]), (l(!0), a(w, null, V(S(v), (u, L) => (l(), a("li", { key: "item-" + L, class: $e(["item", Number(u) === Number(c.value) ? "active" : ""]) }, [ Number(u) === Number(c.value) ? (l(), a("span", Se, _(u), 1)) : u === "..." ? (l(), a("span", De, _(u), 1)) : (l(), a("span", { key: 2, onClick: (k) => p(Number(u)), class: "link" }, _(u), 9, Re)) ], 2))), 128)), n("li", Ue, [ n("span", { class: "link", onClick: d[2] || (d[2] = (u) => p(Number(c.value) < Number(t.pages) ? Number(c.value) + 1 : Number(t.pages))) }, " › ") ]), n("li", Ae, [ n("span", { class: "link", onClick: d[3] || (d[3] = (u) => p(Number(t.pages))) }, " » ") ]) ]) ])); } }); const me = (t, o) => { const e = t.__vccOpts || t; for (const [c, v] of o) e[c] = v; return e; }, Ne = /* @__PURE__ */ me(Pe, [["__scopeId", "data-v-3a47d1ad"]]), se = (t) => (ye("data-v-4b215064"), t = t(), ge(), t), Ke = { class: "card cardBody dataTable" }, Fe = { class: "dataTableHeader" }, Oe = { class: "group" }, qe = /* @__PURE__ */ se(() => /* @__PURE__ */ n("span", { class: "button groupItem" }, [ /* @__PURE__ */ n("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", class: "pointerEvents-none bi bi-search", viewBox: "0 0 16 16" }, [ /* @__PURE__ */ n("path", { d: "M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z" }) ]) ], -1)), Ge = ["onKeyup"], Je = { value: "" }, Qe = ["value"], We = { class: "tableResponsive" }, Xe = { class: "table tableList dataTableBody" }, Ye = { key: 0, class: "check" }, Ze = ["onChange", "checked"], je = { key: 1 }, et = { key: 2, class: "dataTableSort" }, tt = ["onClick"], lt = /* @__PURE__ */ se(() => /* @__PURE__ */ n("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", class: "bi bi-sort-alpha-down tableEvent", viewBox: "0 0 16 16" }, [ /* @__PURE__ */ n("path", { "fill-rule": "evenodd", d: "M10.082 5.629 9.664 7H8.598l1.789-5.332h1.234L13.402 7h-1.12l-.419-1.371h-1.781zm1.57-.785L11 2.687h-.047l-.652 2.157h1.351z" }), /* @__PURE__ */ n("path", { d: "M12.96 14H9.028v-.691l2.579-3.72v-.054H9.098v-.867h3.785v.691l-2.567 3.72v.054h2.645V14zM4.5 2.5a.5.5 0 0 0-1 0v9.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L4.5 12.293V2.5z" }) ], -1)), at = [ lt ], nt = ["onClick"], ut = /* @__PURE__ */ se(() => /* @__PURE__ */ n("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", class: "bi bi-sort-alpha-up-alt tableEvent", viewBox: "0 0 16 16" }, [ /* @__PURE__ */ n("path", { d: "M12.96 7H9.028v-.691l2.579-3.72v-.054H9.098v-.867h3.785v.691l-2.567 3.72v.054h2.645V7z" }), /* @__PURE__ */ n("path", { "fill-rule": "evenodd", d: "M10.082 12.629 9.664 14H8.598l1.789-5.332h1.234L13.402 14h-1.12l-.419-1.371h-1.781zm1.57-.785L11 9.688h-.047l-.652 2.156h1.351z" }), /* @__PURE__ */ n("path", { d: "M4.5 13.5a.5.5 0 0 1-1 0V3.707L2.354 4.854a.5.5 0 1 1-.708-.708l2-1.999.007-.007a.498.498 0 0 1 .7.006l2 2a.5.5 0 1 1-.707.708L4.5 3.707V13.5z" }) ], -1)), st = [ ut ], ot = ["onClick"], rt = /* @__PURE__ */ se(() => /* @__PURE__ */ n("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", class: "bi bi-sort-numeric-up tableEvent", viewBox: "0 0 16 16" }, [ /* @__PURE__ */ n("path", { d: "M4.5 2.5a.5.5 0 0 0-1 0v9.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L4.5 12.293V2.5z" }), /* @__PURE__ */ n("g", { transform: "translate(7 0)" }, [ /* @__PURE__ */ n("path", { d: "M4.5 13.5a.5.5 0 0 1-1 0V3.707L2.354 4.854a.5.5 0 1 1-.708-.708l2-1.999.007-.007a.498.498 0 0 1 .7.006l2 2a.5.5 0 1 1-.707.708L4.5 3.707V13.5z" }) ]) ], -1)), it = [ rt ], vt = { key: 0 }, ct = { key: 0 }, dt = ["onUpdate:modelValue"], ht = /* @__PURE__ */ se(() => /* @__PURE__ */ n("option", { value: "", selected: "" }, null, -1)), ft = ["value"], mt = ["onUpdate:modelValue", "onInput"], pt = { key: 0 }, kt = ["colspan"], bt = { key: 1, class: "check" }, yt = ["value", "checked", "onChange"], gt = { style: { height: "60px" } }, _t = ["rowspan", "colspan"], Nt = { key: 0 }, wt = { class: "dataTableFooter" }, $t = { class: "dataTableLimit" }, Vt = { class: "dataTableSelect" }, Ct = /* @__PURE__ */ _e('', 6), xt = [ Ct ], Tt = { class: "dataTableInfo" }, Bt = /* @__PURE__ */ fe({ __name: "DataTable", props: { columns: null, filterBy: null, filterDelay: null, sortBy: null, entries: null, footers: null, placeholder: null, translate: null, checks: null, checkprop: null }, emits: ["checklist", "filter", "sort"], setup(t, { emit: o }) { var te, le, ae, b; const e = t, c = g(10), v = g(1), p = g(2), y = g(""), d = g({}), u = g({ col: ((te = e == null ? void 0 : e.sortBy) == null ? void 0 : te[0]) || ((ae = (le = e.columns) == null ? void 0 : le[0]) == null ? void 0 : ae.prop) || "", by: ((b = e == null ? void 0 : e.sortBy) == null ? void 0 : b[1]) || "desc" }), { getColumnProperties: L, getColumnData: k } = xe(he(e, "columns"), he(e, "entries")), { filteredEntries: x } = Te(he(e, "entries"), y, d), { sortedEntries: D } = Be(x, u), { getOffset: P, getPages: z, paginatedEntries: C, getPagination: B, getPageInfo: N } = Ie(D, c, v, p), R = g(null), K = g(!1), I = g([]), ce = (i) => { i && I.value.push(i); }, M = g((e == null ? void 0 : e.checks) || []); ue(() => e == null ? void 0 : e.checks, () => { if (M.value = (e == null ? void 0 : e.checks) || [], e != null && e.checkprop) { let i = Number(e.entries.length) < Number(c.value) ? Number(e.entries.length) : Number(c.value); Number(C.value.filter((m) => M.value.includes(m[e.checkprop])).length) === Number(i) ? (R.value && (R.value.checked = !0), K.value = !0) : (R.value && (R.value.checked = !1), K.value = !1); } }); const de = (i, m) => { i.target.checked === !0 ? (M.value = C.value.map(($) => $[m]), K.value = !0) : (M.value = [], K.value = !1), o("checklist", M.value); }, J = (i) => { const m = M.value.findIndex(($) => $ === i); M.value.splice(m, 1); }, re = (i, m, $) => { i.target.checked === !0 && !M.value.includes(m) ? M.value.push(m) : J(m); let H = Number(e.entries.length) < Number(c.value) ? Number(e.entries.length) : Number(c.value); Number(C.value.filter((U) => M.value.includes(U[$])).length) === Number(H) ? (R.value && (R.value.checked = !0), K.value = !0) : (R.value && (R.value.checked = !1), K.value = !1), o("checklist", M.value); }, Q = g(""), q = g(null), j = g(void 0), W = () => { clearTimeout(j.value), j.value = setTimeout(() => { var i; y.value = "", d.value = {}, (i = q.value) != null && i.value && (Q.value !== "" ? d.value[Q.value] = q.value.value : y.value = q.value.value, G()); }, (e == null ? void 0 : e.filterDelay) || 500); }, G = () => { v.value >= z.value && (v.value = z.value); }, O = g({}), ee = g(void 0), ie = (i) => { clearTimeout(ee.value), ee.value = setTimeout(() => { var m, $; d.value[i] = "", (m = O.value) != null && m[i] && (($ = O.value) == null ? void 0 : $[i]) !== "" && (d.value[i] = O.value[i]), o("filter", d.value), G(); }, (e == null ? void 0 : e.filterDelay) || 1e3); }; return (i, m) => { var $, H, U, r; return l(), a("div", Ke, [ A(i.$slots, "header", {}, void 0, !0), n("div", Fe, [ n("div", Oe, [ qe, n("input", { type: "search", ref_key: "searchRef", ref: q, onInput: W, onKeyup: pe(W, ["enter"]), class: "input groupItem" }, null, 40, Ge), t.filterBy === "search" ? F((l(), a("select", { key: 0, "onUpdate:modelValue": m[0] || (m[0] = (s) => Q.value = s), onChange: W, class: "select groupItem dataTableSearchBy" }, [ n("option", Je, _((($ = t.translate) == null ? void 0 : $.all) || "All"), 1), (l(!0), a(w, null, V(t.columns, (s, h) => (l(), a(w, { key: h }, [ s != null && s.filter ? (l(), a("option", { key: 0, value: s.prop }, _(s.text), 9, Qe)) : T("", !0) ], 64))), 128)) ], 544)), [ [Y, Q.value] ]) : T("", !0) ]), n("div", null, [ A(i.$slots, "default", {}, void 0, !0) ]) ]), n("div", We, [ n("table", Xe, [ n("thead", null, [ n("tr", null, [ (l(!0), a(w, null, V(t.columns, (s, h) => (l(), a("th", { key: "col-" + h, style: Z({ "text-align": s == null ? void 0 : s.align, width: s == null ? void 0 : s.width }) }, [ s.type === "checkbox" ? (l(), a("div", Ye, [ n("input", { type: "checkbox", ref_for: !0, ref_key: "checkedAll", ref: R, class: "checkInput", onChange: (f) => de(f, s.prop), checked: K.value }, null, 40, Ze) ])) : s.sort === !1 ? (l(), a("span", je, _(s.text), 1)) : (l(), a("div", et, [ n("span", null, _(s.text), 1), u.value.col === s.prop && u.value.by === "asc" ? (l(), a("span", { key: 0, onClick: (f) => { u.value.col = s.prop, u.value.by = "desc", o("sort", u.value); } }, at, 8, tt)) : u.value.col === s.prop && u.value.by === "desc" ? (l(), a("span", { key: 1, onClick: (f) => { u.value.col = s.prop, u.value.by = "asc", o("sort", u.value); } }, st, 8, nt)) : (l(), a("span", { key: 2, onClick: (f) => { u.value.col = s.prop, u.value.by = "asc", o("sort", u.value); } }, it, 8, ot)) ])) ], 4))), 128)) ]), t.filterBy === "column" || t.filterBy === "filter" ? (l(), a("tr", vt, [ (l(!0), a(w, null, V(t.columns, (s, h) => (l(), a("th", { key: "filter-" + h }, [ s.filter === !0 && "prop" in s ? (l(), a("div", ct, [ s.filterType === "select" ? F((l(), a("select", { key: 0, class: "select", "onUpdate:modelValue": (f) => d.value[s.prop] = f, onChange: m[1] || (m[1] = (f) => { o("filter", d.value), G(); }) }, [ ht, (l(!0), a(w, null, V(S(k)(s.prop), (f, X) => (l(), a("option", { key: X, value: f }, _(f), 9, ft))), 128)) ], 40, dt)), [ [Y, d.value[s.prop]] ]) : F((l(), a("input", { key: 1, type: "text", "onUpdate:modelValue": (f) => O.value[s.prop] = f, class: "input", onInput: (f) => ie(s.prop) }, null, 40, mt)), [ [ke, O.value[s.prop]] ]) ])) : T("", !0) ]))), 128)) ])) : T("", !0) ]), n("tbody", { style: Z({ height: (S(C).length <= 4 ? 240 : Number(S(C).length) * 60) + "px" }) }, [ Number(S(C).length) === 0 ? (l(), a("tr", pt, [ n("td", { colspan: t.columns.length, class: "dataTableEmpty" }, _(t.placeholder || "The data on this page is not yet available."), 9, kt) ])) : T("", !0), (l(!0), a(w, null, V(S(C), (s, h) => (l(), a("tr", { key: "entry-" + h }, [ (l(!0), a(w, null, V(t.columns, (f, X) => (l(), a("td", { key: "col-" + X, style: Z({ "text-align": f == null ? void 0 : f.align, width: f == null ? void 0 : f.width }) }, [ f.type === "slot" ? A(i.$slots, f.prop, { key: 0, entry: s, index: h }, void 0, !0) : f.type === "checkbox" ? (l(), a("div", bt, [ n("input", { type: "checkbox", class: "checkInput", ref_for: !0, ref: ce, value: s[f.prop], checked: M.value.includes(s[f.prop]), onChange: (we) => re(we, s[f.prop], f.prop) }, null, 40, yt) ])) : (l(), a(w, { key: 2 }, [ ve(_(s[f.prop]), 1) ], 64)) ], 4))), 128)) ]))), 128)), Number(t.entries.length) >= 1 && Number(t.entries.length) <= 3 ? (l(!0), a(w, { key: 1 }, V(4 - Number(t.entries.length), (s) => (l(), a("tr", gt, [ s === 1 ? (l(), a("td", { key: 0, rowspan: 4 - Number(t.entries.length), colspan: t.columns.length }, null, 8, _t)) : T("", !0) ]))), 256)) : T("", !0) ], 4), t.footers && Array.isArray(t.footers[0]) ? (l(), a("tfoot", Nt, [ (l(!0), a(w, null, V(t.footers, (s, h) => (l(), a("tr", { key: "row-" + h }, [ (l(!0), a(w, null, V(s, (f, X) => (l(), a("th", { key: "foot-" + X }, [ f.type === "slot" ? A(i.$slots, "default", { key: 0, value: f.value, options: f.options }, void 0, !0) : (l(), a(w, { key: 1 }, [ ve(_(f.text), 1) ], 64)) ]))), 128)) ]))), 128)) ])) : T("", !0) ]) ]), n("div", wt, [ n("div", $t, [ n("div", Vt, [ F(n("select", { "onUpdate:modelValue": m[2] || (m[2] = (s) => c.value = s), class: "select", onChange: m[3] || (m[3] = (s) => { G(); }) }, xt, 544), [ [Y, c.value] ]) ]), n("div", Tt, _(((H = t.translate) == null ? void 0 : H.from) || "from") + " " + _(S(N).start) + " " + _(((U = t.translate) == null ? void 0 : U.to) || "to") + " " + _(S(N).end) + " " + _(((r = t.translate) == null ? void 0 : r.of) || "of") + " " + _(S(N).length), 1) ]), be(Ne, { modelValue: v.value, "onUpdate:modelValue": m[4] || (m[4] = (s) => v.value = s), pages: S(z), items: S(B) }, null, 8, ["modelValue", "pages", "items"]) ]), A(i.$slots, "footer", {}, void 0, !0) ]); }; } }); const yl = /* @__PURE__ */ me(Bt, [["__scopeId", "data-v-4b215064"]]), oe = (t) => (ye("data-v-42a51e72"), t = t(), ge(), t), It = { class: "card cardBody dataTable" }, Mt = { class: "dataTableHeader" }, Lt = { class: "group" }, zt = /* @__PURE__ */ oe(() => /* @__PURE__ */ n("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", class: "dataTableEvent bi bi-search", viewBox: "0 0 16 16" }, [ /* @__PURE__ */ n("path", { d: "M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z" }) ], -1)), Ht = [ zt ], Et = ["onKeyup"], St = { value: "" }, Dt = ["value"], Rt = { class: "tableResponsive" }, Ut = { class: "table tableList dataTableBody" }, At = { key: 0, class: "check" }, Pt = ["onClick", "checked"], Kt = { key: 1 }, Ft = { key: 2, class: "dataTableSort" }, Ot = ["onClick"], qt = /* @__PURE__ */ oe(() => /* @__PURE__ */ n("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", class: "bi bi-sort-alpha-down dataTableEvent", viewBox: "0 0 16 16" }, [ /* @__PURE__ */ n("path", { "fill-rule": "evenodd", d: "M10.082 5.629 9.664 7H8.598l1.789-5.332h1.234L13.402 7h-1.12l-.419-1.371h-1.781zm1.57-.785L11 2.687h-.047l-.652 2.157h1.351z" }), /* @__PURE__ */ n("path", { d: "M12.96 14H9.028v-.691l2.579-3.72v-.054H9.098v-.867h3.785v.691l-2.567 3.72v.054h2.645V14zM4.5 2.5a.5.5 0 0 0-1 0v9.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L4.5 12.293V2.5z" }) ], -1)), Gt = [ qt ], Jt = ["onClick"], Qt = /* @__PURE__ */ oe(() => /* @__PURE__ */ n("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", class: "bi bi-sort-alpha-up-alt dataTableEvent", viewBox: "0 0 16 16" }, [ /* @__PURE__ */ n("path", { d: "M12.96 7H9.028v-.691l2.579-3.72v-.054H9.098v-.867h3.785v.691l-2.567 3.72v.054h2.645V7z" }), /* @__PURE__ */ n("path", { "fill-rule": "evenodd", d: "M10.082 12.629 9.664 14H8.598l1.789-5.332h1.234L13.402 14h-1.12l-.419-1.371h-1.781zm1.57-.785L11 9.688h-.047l-.652 2.156h1.351z" }), /* @__PURE__ */ n("path", { d: "M4.5 13.5a.5.5 0 0 1-1 0V3.707L2.354 4.854a.5.5 0 1 1-.708-.708l2-1.999.007-.007a.498.498 0 0 1 .7.006l2 2a.5.5 0 1 1-.707.708L4.5 3.707V13.5z" }) ], -1)), Wt = [ Qt ], Xt = ["onClick"], Yt = /* @__PURE__ */ oe(() => /* @__PURE__ */ n("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", class: "bi bi-sort-numeric-up dataTableEvent", viewBox: "0 0 16 16" }, [ /* @__PURE__ */ n("path", { d: "M4.5 2.5a.5.5 0 0 0-1 0v9.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L4.5 12.293V2.5z" }), /* @__PURE__ */ n("g", { transform: "translate(7 0)" }, [ /* @__PURE__ */ n("path", { d: "M4.5 13.5a.5.5 0 0 1-1 0V3.707L2.354 4.854a.5.5 0 1 1-.708-.708l2-1.999.007-.007a.498.498 0 0 1 .7.006l2 2a.5.5 0 1 1-.707.708L4.5 3.707V13.5z" }) ]) ], -1)), Zt = [ Yt ], jt = { key: 0 }, el = { key: 0 }, tl = ["onUpdate:modelValue"], ll = /* @__PURE__ */ oe(() => /* @__PURE__ */ n("option", { value: "", selected: "" }, null, -1)), al = ["value"], nl = ["onUpdate:modelValue", "onInput"], ul = { key: 0 }, sl = ["colspan"], ol = { key: 1, class: "check" }, rl = ["value", "checked", "onClick"], il = { style: { height: "60px" } }, vl = ["rowspan", "colspan"], cl = { key: 0 }, dl = { class: "dataTableFooter" }, hl = { class: "dataTableLimit" }, fl = { class: "dataTableSelect" }, ml = /* @__PURE__ */ _e('', 6), pl = [ ml ], kl = /* @__PURE__ */ fe({ __name: "ServerTable", props: { modelValue: null, columns: null, entries: null, select: null, filterBy: null, filterDelay: null, footers: null, placeholder: null, translate: null, checks: null, checkprop: null }, emits: ["update:modelValue", "checklist", "handler"], setup(t, { emit: o }) { var q, j, W, G, O, ee, ie, te, le, ae; const e = t, c = g((e == null ? void 0 : e.columns) || []); ue(() => e == null ? void 0 : e.columns, () => { c.value = e.columns; }); const v = g(((q = e.modelValue) == null ? void 0 : q.limit) || 10), p = g(((j = e.modelValue) == null ? void 0 : j.page) || 1); g(((W = e.modelValue) == null ? void 0 : W.ellipsis) || 2); const y = g(((G = e.modelValue) == null ? void 0 : G.search) || ""), d = g(((O = e.modelValue) == null ? void 0 : O.searchBy) || ""), u = g(null), L = g(((ee = e.modelValue) == null ? void 0 : ee.filter) || {}), k = g({ col: ((ie = e.modelValue) == null ? void 0 : ie.sort) || ((le = (te = e.columns) == null ? void 0 : te[0]) == null ? void 0 : le.prop) || "", by: ((ae = e.modelValue) == null ? void 0 : ae.sortBy) || "" }); ue(() => e.modelValue, () => { var b, i, m, $, H, U; k.value = { col: ((b = e.modelValue) == null ? void 0 : b.sort) || ((m = (i = e.columns) == null ? void 0 : i[0]) == null ? void 0 : m.prop) || "", by: (($ = e.modelValue) == null ? void 0 : $.sortBy) || "" }, y.value = ((H = e.modelValue) == null ? void 0 : H.search) || "", d.value = ((U = e.modelValue) == null ? void 0 : U.searchBy) || "", u.value !== null && (u.value.value = y.value); }), Ve(() => { var b; u.value !== null && (u.value.value = ((b = e.modelValue) == null ? void 0 : b.search) || ""); }); const x = E(() => Number(v.value) * Number(p.value) - Number(v.value)), D = E(() => { var b; return Me((b = e.modelValue) == null ? void 0 : b.total, v.value); }), P = g(void 0), z = () => { clearTimeout(P.value), P.value = setTimeout(() => { var b, i; y.value = "", L.value = {}, u.value && (d.value !== "" ? L.value[d.value] = ((b = u.value) == null ? void 0 : b.value) || "" : y.value = ((i = u.value) == null ? void 0 : i.value) || "", J(), C()); }, (e == null ? void 0 : e.filterDelay) || 1e3); }, C = () => { var i, m, $, H; const b = { limit: v.value, page: p.value, offset: x.value, search: y.value, searchBy: d.value, filter: L.value, sort: k.value.col, sortBy: k.value.by, total: (i = e.modelValue) == null ? void 0 : i.total, length: (m = e.modelValue) == null ? void 0 : m.length, from: ($ = e.modelValue) == null ? void 0 : $.from, to: (H = e.modelValue) == null ? void 0 : H.to }; o("update:modelValue", b), o("handler", b); }, B = g(null), N = g(!1), R = g([]), K = (b) => { b && R.value.push(b); }, I = g((e == null ? void 0 : e.checks) || []); ue(() => e == null ? void 0 : e.checks, () => { if (I.value = (e == null ? void 0 : e.checks) || [], e.entries && (e != null && e.checkprop)) { let b = Number(e.entries.length) < Number(v.value) ? Number(e.entries.length) : Number(v.value); Number(e.entries.filter((i) => I.value.includes(i[e.checkprop])).length) === Number(b) ? (B.value && (B.value.checked = !0), N.value = !0) : (B.value && (B.value.checked = !1), N.value = !1); } }); const ce = (b, i) => { b.target.checked === !0 ? (I.value = e.entries.map((m) => m[i]), N.value = !0) : (I.value = [], N.value = !1), C(), o("checklist", I.value); }, M = (b) => { let i = Number(e.entries.length) < Number(v.value) ? Number(e.entries.length) : Number(v.value); Number(e.entries.filter((m) => I.value.includes(m[b])).length) === Number(i) ? (B.value && (B.value.checked = !0), N.value = !0) : (B.value && (B.value.checked = !1), N.value = !1), o("checklist", I.value); }, de = (b) => { const i = I.value.findIndex((m) => m === b); I.value.splice(i, 1); }, J = () => { p.value = 1; }, re = g(void 0), Q = (b) => { clearTimeout(re.value), re.value = setTimeout(() => { J(), C(); }, (e == null ? void 0 : e.filterDelay) || 1e3); }; return (b, i) => { var m, $, H, U; return l(), a("div", It, [ A(b.$slots, "header", {}, void 0, !0), n("div", Mt, [ n("div", Lt, [ n("span", { class: "button groupItem", onClick: z }, Ht), n("input", { type: "search", ref_key: "searchRef", ref: u, onKeyup: pe(z, ["enter"]), class: "input groupItem" }, null, 40, Et), t.filterBy === "search" ? F((l(), a("select", { key: 0, "onUpdate:modelValue": i[0] || (i[0] = (r) => d.value = r), onChange: z, class: "select groupItem dataTableSearchBy" }, [ n("option", St, _(((m = t.translate) == null ? void 0 : m.all) || "All"), 1), (l(!0), a(w, null, V(c.value, (r, s) => (l(), a(w, { key: s }, [ r != null && r.filter ? (l(), a("option", { key: 0, value: r.prop }, _(r.text), 9, Dt)) : T("", !0) ], 64))), 128)) ], 544)), [ [Y, d.value] ]) : T("", !0) ]), n("div", null, [ A(b.$slots, "default", {}, void 0, !0) ]) ]), n("div", Rt, [ n("table", Ut, [ n("thead", null, [ n("tr", null, [ (l(!0), a(w, null, V(c.value, (r, s) => (l(), a("th", { key: "col-" + s, style: Z({ "text-align": r == null ? void 0 : r.align, width: r == null ? void 0 : r.width }) }, [ r.type === "checkbox" ? (l(), a("div", At, [ n("input", { type: "checkbox", ref_for: !0, ref_key: "checkedAll", ref: B, class: "checkInput", onClick: ne((h) => ce(h, r.prop), ["self"]), checked: N.value }, null, 8, Pt) ])) : r.sort === !1 ? (l(), a("span", Kt, _(r.text), 1)) : (l(), a("div", Ft, [ n("span", null, _(r.text), 1), k.value.col === r.prop && k.value.by === "asc" ? (l(), a("span", { key: 0, onClick: ne((h) => { k.value.col = r.prop, k.value.by = "desc", C(); }, ["self"]) }, Gt, 8, Ot)) : k.value.col === r.prop && k.value.by === "desc" ? (l(), a("span", { key: 1, onClick: ne((h) => { k.value.col = r.prop, k.value.by = "", C(); }, ["self"]) }, Wt, 8, Jt)) : (l(), a("span", { key: 2, onClick: ne((h) => { k.value.col = r.prop, k.value.by = "asc", C(); }, ["self"]) }, Zt, 8, Xt)) ])) ], 4))), 128)) ]), t.filterBy === "column" || t.filterBy === "filter" ? (l(), a("tr", jt, [ (l(!0), a(w, null, V(c.value, (r, s) => (l(), a("th", { key: "filter-" + s }, [ r.filter === !0 && "prop" in r ? (l(), a("div", el, [ r.filterType === "select" ? F((l(), a("select", { key: 0, class: "select", "onUpdate:modelValue": (h) => L.value[r.prop] = h, onChange: i[1] || (i[1] = (h) => { J(), C(); }) }, [ ll, (l(!0), a(w, null, V(t.select[r.prop] || [], (h, f) => (l(), a("option", { key: f, value: h }, _(h), 9, al))), 128)) ], 40, tl)), [ [Y, L.value[r.prop]] ]) : F((l(), a("input", { key: 1, type: "text", "onUpdate:modelValue": (h) => L.value[r.prop] = h, class: "input", onInput: (h) => Q(r.prop) }, null, 40, nl)), [ [ke, L.value[r.prop]] ]) ])) : T("", !0) ]))), 128)) ])) : T("", !0) ]), n("tbody", { style: Z({ height: (t.entries.length <= 4 ? 240 : Number(t.entries.length) * 60) + "px" }) }, [ Number(t.entries.length) === 0 ? (l(), a("tr", ul, [ n("td", { colspan: c.value.length, class: "dataTableEmpty" }, _(t.placeholder || "The data on this page is not yet available."), 9, sl) ])) : T("", !0), (l(!0), a(w, null, V(t.entries, (r, s) => (l(), a("tr", { key: "entry-" + s }, [ (l(!0), a(w, null, V(c.value, (h, f) => (l(), a("td", { key: "col-" + f, style: Z({ "text-align": h == null ? void 0 : h.align, width: h == null ? void 0 : h.width }) }, [ h.type === "slot" ? A(b.$slots, h.prop, { key: 0, entry: r, index: s }, void 0, !0) : h.type === "checkbox" ? (l(), a("div", ol, [ n("input", { type: "checkbox", class: "checkInput", ref_for: !0, ref: K, value: r[h.prop], checked: I.value.includes(r[h.prop]), onClick: ne((X) => { I.value.includes(r[h.prop]) ? de(r[h.prop]) : I.value.push(r[h.prop]), M(h.prop); }, ["self"]) }, null, 8, rl) ])) : (l(), a(w, { key: 2 }, [ ve(_(r[h.prop]), 1) ], 64)) ], 4))), 128)) ]))), 128)), Number(t.entries.length) >= 1 && Number(t.entries.length) <= 3 ? (l(!0), a(w, { key: 1 }, V(4 - Number(t.entries.length), (r) => (l(), a("tr", il, [ r === 1 ? (l(), a("td", { key: 0, rowspan: 4 - Number(t.entries.length), colspan: c.value.length }, null, 8, vl)) : T("", !0) ]))), 256)) : T("", !0) ], 4), t.footers && Array.isArray(t.footers[0]) ? (l(), a("tfoot", cl, [ (l(!0), a(w, null, V(t.footers, (r, s) => (l(), a("tr", { key: "row-" + s }, [ (l(!0), a(w, null, V(r, (h, f) => (l(), a("th", { key: "foot-" + f }, [ h.type === "slot" ? A(b.$slots, "default", { key: 0, value: h.value, options: h.options }, void 0, !0) : (l(), a(w, { key: 1 }, [ ve(_(h.text), 1) ], 64)) ]))), 128)) ]))), 128)) ])) : T("", !0) ]) ]), n("div", dl, [ n("div", hl, [ n("div", fl, [ F(n("select", { "onUpdate:modelValue": i[2] || (i[2] = (r) => v.value = r), onChange: i[3] || (i[3] = (r) => { J(), C(); }), class: "select" }, pl, 544), [ [Y, v.value] ]) ]), F(n("div", { class: "dataTableInfo" }, _((($ = t.translate) == null ? void 0 : $.from) || "from") + " " + _(t.modelValue.from) + " " + _(((H = t.translate) == null ? void 0 : H.to) || "to") + " " + _(Number(t.modelValue.length) <= Number(t.modelValue.to) ? t.modelValue.length : t.modelValue.to) + " " + _(((U = t.translate) == null ? void 0 : U.of) || "of") + " " + _(t.modelValue.length), 513), [ [Ce, t.modelValue.length > 0] ]) ]), be(Ne, { modelValue: p.value, "onUpdate:modelValue": i[4] || (i[4] = (r) => p.value = r), pages: S(D), onHandler: C }, null, 8, ["modelValue", "pages"]) ]), A(b.$slots, "footer", {}, void 0, !0) ]); }; } }); const gl = /* @__PURE__ */ me(kl, [["__scopeId", "data-v-42a51e72"]]); export { yl as DataTable, Ne as PaginationBox, gl as ServerTable };