import { bP as Bt, bQ as Ie, aC as we, aD as Ae, d as _, bR as Yt, H as Se, bS as Qt, l as qe, p as ze, ah as $e, g as Q, bT as je, bU as Ne, n as Fe, k as He, o as ue, a5 as bt, ar as Ke, m as Xt, A as Pt, ag as Gt, af as Zt, ap as Ee, h as ee, s as yt, i as Z, ai as We, aj as Je, ak as Ye, al as Qe, ae as pe, aZ as Xe, a8 as Ge, a9 as Ze, aa as et, ab as tt, am as at, an as ot, ac as nt, ad as st, bV as lt, bW as rt, bX as it, a6 as Dt, bY as Ue, aG as ea, aE as ut, aJ as ht, bb as Ct, bc as ta, f as St, a_ as aa, bN as oa, B as na, D as sa, aV as la, bZ as ra, j as ia, b_ as ua, b$ as Le, aX as ca, aY as da, aN as ma, F as fa, b1 as va, ao as ga, a1 as pa, c0 as ba, q as ya, x as ha } from "./AFormRemoteAutocomplete.vue_vue_type_script_setup_true_lang-DdIqxBUs.mjs";
import { aB as un, c1 as cn, c2 as dn, ax as mn, ay as fn, aA as vn, az as gn, aF as pn, ba as bn, av as yn, aw as hn } from "./AFormRemoteAutocomplete.vue_vue_type_script_setup_true_lang-DdIqxBUs.mjs";
import { defineComponent as oe, inject as q, computed as U, nextTick as de, ref as E, watch as se, resolveComponent as be, createElementBlock as I, openBlock as h, Fragment as te, createBlock as V, createCommentVNode as W, withModifiers as M, unref as b, withCtx as u, createVNode as r, mergeProps as ct, renderSlot as K, createTextVNode as O, toDisplayString as P, normalizeClass as _e, renderList as me, createElementVNode as L, useTemplateRef as $t, createSlots as Ca, mergeModels as fe, useModel as Ce, onMounted as Et, provide as kt, resolveDynamicComponent as ka, withDirectives as Vt, vShow as It, toRaw as wt } from "vue";
import { useI18n as le } from "vue-i18n";
import { VCard as dt, VCardText as Ut, VCardActions as Rt } from "vuetify/components/VCard";
import { VDialog as mt } from "vuetify/components/VDialog";
import { VSpacer as ft, VRow as Te, VCol as ge } from "vuetify/components/VGrid";
import { VListItem as vt, VList as Ot, VListItemTitle as jt } from "vuetify/components/VList";
import { VSelect as wa } from "vuetify/components/VSelect";
import { VTextarea as Aa } from "vuetify/components/VTextarea";
import { VBtn as G } from "vuetify/components/VBtn";
import { VIcon as ye } from "vuetify/components/VIcon";
import { VTooltip as ke } from "vuetify/components/VTooltip";
import { VChip as At } from "vuetify/components/VChip";
import { defineStore as _a } from "pinia";
import gt from "axios";
import _t from "@vuelidate/core";
import { VProgressCircular as xa } from "vuetify/components/VProgressCircular";
import { VTabs as Fa, VTab as xt } from "vuetify/components/VTabs";
import { useResizeObserver as Ta, watchThrottled as Ba, useThrottleFn as Be, useDebounceFn as Pa } from "@vueuse/core";
import { VMenu as Nt } from "vuetify/components/VMenu";
import { VForm as Da } from "vuetify/components/VForm";
import { VBtnToggle as Sa } from "vuetify/components/VBtnToggle";
import { VToolbar as $a } from "vuetify/components/VToolbar";
import { Intersect as Ea } from "vuetify/directives";
const Va = /* @__PURE__ */ oe({
  __name: "AFilterTimeInterval",
  props: {
    nameFrom: {},
    nameUntil: {},
    allowed: { default: void 0 },
    placeholder: { default: void 0 },
    dataCy: { default: "filter-time-interval" }
  },
  emits: ["change"],
  setup(e, { emit: d }) {
    const s = e, o = d, C = q(Bt), m = q(Ie), l = q(we), a = q(Ae);
    if (_(C) || _(m) || _(l) || // eslint-disable-next-line vue/no-setup-props-reactivity-loss
    _(l.fields[s.nameFrom]) || // eslint-disable-next-line vue/no-setup-props-reactivity-loss
    _(l.fields[s.nameUntil]) || _(a) || // eslint-disable-next-line vue/no-setup-props-reactivity-loss
    _(a[s.nameFrom]) || // eslint-disable-next-line vue/no-setup-props-reactivity-loss
    _(a[s.nameUntil]))
      throw new Error("Incorrect provide/inject config.");
    const v = U({
      get() {
        return a[s.nameFrom];
      },
      set(w) {
        a[s.nameFrom] = w, j(w), l.touched = !0, de(() => {
          o("change");
        });
      }
    }), { timeIntervalOptions: g, getTimeIntervalOption: c } = Yt(s.allowed), i = E(null), p = E(!1), n = E({
      from: null,
      until: Se()
    }), t = E(!1), { v$: y } = Qt(n), A = U(() => l.fields[s.nameFrom]), { t: f } = le(), D = U(() => A.value.titleT ? f(A.value.titleT) : void 0), { clearOne: N } = Ke(), { showValidationError: x } = qe(), F = () => {
      t.value = !1, i.value = null, S();
    }, k = () => {
      if (y.value.$touch(), y.value.$invalid) {
        x();
        return;
      }
      t.value = !0, p.value = !1, a[s.nameUntil] = n.value.until, v.value = n.value.from;
    }, $ = () => {
      p.value = !1, i.value = null;
    }, S = () => {
      N(s.nameFrom, a, l), N(s.nameUntil, a, l), m.value.delete(s.nameFrom);
    }, j = (w) => {
      if (ze(w) || $e(w)) return;
      if (Q(w) || _(w)) {
        m.value.delete(s.nameFrom);
        return;
      }
      const B = c(w);
      if (!B && je(w)) {
        const X = c(Ne.Custom);
        m.value.set(s.nameFrom, [
          {
            title: X.title + ": " + Fe(n.value.from) + " - " + Fe(n.value.until),
            value: w
          }
        ]);
        return;
      }
      B && m.value.set(s.nameFrom, [{ title: B.title, value: w }]);
    }, R = (w = !1) => {
      y.value.$reset(), w && (n.value.from = null, n.value.until = Se()), p.value = !0;
    };
    se(
      v,
      (w) => {
        if (ze(w) || $e(w)) return;
        if (t.value = !1, _(w) || Q(w)) {
          i.value = null;
          return;
        }
        const B = c(v.value), X = a[s.nameUntil];
        !B && je(v.value) && je(X) && (i.value = Ne.Custom, n.value.from = v.value, n.value.until = X, t.value = !0), B && (i.value = B.value);
      },
      { immediate: !0 }
    ), se(
      [() => a[s.nameFrom], () => a[s.nameUntil]],
      ([w, B], [X, J]) => {
        w === X && B === J || j(w);
      },
      { immediate: !0 }
    );
    const ae = (w) => {
      if (w.value === Ne.Custom) {
        R(!0);
        return;
      }
      a[s.nameUntil] = null, v.value = w.value;
    };
    return (w, B) => {
      const X = be("ABtnTertiary"), J = be("ABtnPrimary");
      return h(), I(te, null, [
        t.value ? (h(), V(Aa, {
          key: 0,
          label: D.value,
          "model-value": b(Fe)(n.value.from) + " - " + b(Fe)(n.value.until),
          readonly: "",
          rows: "1",
          "auto-grow": "",
          "hide-details": "",
          "append-inner-icon": "mdi-menu-down",
          clearable: "",
          class: "cursor-pointer",
          "onClick:clear": M(F, ["stop"]),
          onClick: B[0] || (B[0] = M((Y) => R(), ["stop"]))
        }, null, 8, ["label", "model-value"])) : (h(), V(wa, {
          key: 1,
          modelValue: i.value,
          "onUpdate:modelValue": B[1] || (B[1] = (Y) => i.value = Y),
          "item-title": "title",
          "item-value": "value",
          label: D.value,
          clearable: !b(Q)(i.value),
          "no-filter": "",
          "data-cy": e.dataCy,
          items: b(g),
          "hide-details": "",
          autocomplete: "off",
          "onClick:clear": M(F, ["stop"])
        }, {
          item: u(({ props: Y, item: re }) => [
            r(vt, ct(Y, {
              onClick: (ve) => ae(re)
            }), null, 16, ["onClick"])
          ]),
          _: 1
        }, 8, ["modelValue", "label", "clearable", "data-cy", "items"])),
        p.value ? (h(), V(mt, {
          key: 2,
          "model-value": !0,
          width: "auto",
          "min-width": 360
        }, {
          default: u(() => [
            r(dt, null, {
              default: u(() => [
                r(He, { onOnCancel: $ }, {
                  default: u(() => [
                    K(w.$slots, "title", {}, () => [
                      O(P(D.value), 1)
                    ], !0)
                  ]),
                  _: 3
                }),
                r(Ut, null, {
                  default: u(() => [
                    r(ue, null, {
                      default: u(() => [
                        r(bt, {
                          modelValue: n.value.from,
                          "onUpdate:modelValue": B[2] || (B[2] = (Y) => n.value.from = Y),
                          v: b(y).dialogData.from,
                          label: b(f)("common.filter.timeInterval.from"),
                          required: ""
                        }, null, 8, ["modelValue", "v", "label"])
                      ]),
                      _: 1
                    }),
                    r(ue, null, {
                      default: u(() => [
                        r(bt, {
                          modelValue: n.value.until,
                          "onUpdate:modelValue": B[3] || (B[3] = (Y) => n.value.until = Y),
                          v: b(y).dialogData.until,
                          label: b(f)("common.filter.timeInterval.until"),
                          required: ""
                        }, null, 8, ["modelValue", "v", "label"])
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                }),
                r(Rt, null, {
                  default: u(() => [
                    r(ft),
                    r(X, {
                      "data-cy": "button-cancel",
                      onClick: M($, ["stop"])
                    }, {
                      default: u(() => [
                        O(P(b(f)("common.button.cancel")), 1)
                      ]),
                      _: 1
                    }),
                    r(J, {
                      "data-cy": "button-confirm",
                      onClick: M(k, ["stop"])
                    }, {
                      default: u(() => [
                        O(P(b(f)("common.button.confirm")), 1)
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                })
              ]),
              _: 3
            })
          ]),
          _: 3
        })) : W("", !0)
      ], 64);
    };
  }
}), Go = /* @__PURE__ */ Xt(Va, [["__scopeId", "data-v-622f5681"]]), Ia = /* @__PURE__ */ oe({
  __name: "AFilterAdvancedButton",
  props: {
    tooltipT: { default: "common.button.advancedFilters" },
    buttonClass: { default: "mt-1" },
    dataCy: { default: "filter-advanced" }
  },
  emits: ["advancedFilter"],
  setup(e, { emit: d }) {
    const s = d, o = E(!1), C = (l) => {
      Pt(l), o.value = !o.value, s("advancedFilter");
    }, { t: m } = le();
    return (l, a) => (h(), V(G, {
      class: _e(e.buttonClass),
      "data-cy": e.dataCy,
      icon: "",
      size: "x-small",
      variant: "text",
      onClick: M(C, ["stop"])
    }, {
      default: u(() => [
        r(ye, { icon: "mdi-filter-variant" }),
        r(ke, {
          activator: "parent",
          location: "bottom"
        }, {
          default: u(() => [
            O(P(b(m)(e.tooltipT)), 1)
          ]),
          _: 1
        })
      ]),
      _: 1
    }, 8, ["class", "data-cy"]));
  }
}), Ua = { class: "a-selected-filters__label text-caption" }, Ra = /* @__PURE__ */ oe({
  __name: "FiltersSelected",
  setup(e) {
    const d = q(we), s = q(Ae), o = q(Ie);
    if (_(d) || _(s) || _(o))
      throw new Error("Incorrect provide/inject config.");
    const { t: C } = le(), m = (c) => {
      const i = d.fields?.[c]?.titleT;
      return i ? C(i) : c;
    }, l = U(() => {
      const c = Object.keys(d.fields);
      return Array.from(o.value).map(([i, p]) => ({
        name: i,
        title: m(i),
        options: p
      })).sort((i, p) => c.indexOf(i.name) - c.indexOf(p.name));
    }), { clearOneFilterSelected: a, isClearable: v } = Ke(), g = (c, i) => {
      a(c, i, s, d, o), d.touched = !0;
    };
    return (c, i) => (h(!0), I(te, null, me(l.value, (p) => (h(), I("div", {
      key: p.name,
      class: "a-selected-filters"
    }, [
      L("div", Ua, P(p.title) + ": ", 1),
      (h(!0), I(te, null, me(p.options, (n) => (h(), I("div", {
        key: n.value,
        class: "a-selected-filters__chips"
      }, [
        b(v)(p.name, b(d)) ? (h(), V(At, {
          key: 0,
          closable: "",
          size: "small",
          class: "a-selected-filters__chip",
          "onClick:close": M((t) => g(p.name, n.value), ["stop"])
        }, {
          close: u(() => [
            r(ye, {
              size: "16",
              icon: "mdi-close-circle"
            })
          ]),
          default: u(() => [
            O(" " + P(n.title), 1)
          ]),
          _: 2
        }, 1032, ["onClick:close"])) : (h(), V(At, {
          key: 1,
          size: "small",
          class: "a-selected-filters__chip"
        }, {
          default: u(() => [
            O(P(n.title), 1)
          ]),
          _: 2
        }, 1024))
      ]))), 128))
    ]))), 128));
  }
});
function Ft(e, d = "userAdminConfig") {
  const s = [
    { name: "user", default: null },
    { name: "configType", default: null },
    { name: "layoutType", default: null },
    { name: "systemResource", default: null },
    { name: "customName", default: null },
    { name: "defaultConfig", default: null }
  ], { filterConfig: o, filterData: C } = Gt(s, Zt(s), {
    system: e,
    subject: d
  });
  return {
    filterConfig: o,
    filterData: C
  };
}
const Ve = {
  PinnedWidgets: "pinnedWidgets",
  FilterBookmark: "filterBookmark"
}, Oa = Ve.PinnedWidgets, ce = {
  Desktop: "desktop",
  Mobile: "mobile"
}, ja = ce.Desktop, Na = 3, Me = 8, Lt = _a("filterBookmarkStore", () => {
  const e = E(/* @__PURE__ */ new Map()), d = E(!1);
  function s(a, v) {
    return `userAdminConfig/${v}/${a}/`;
  }
  function o() {
    let a = null, v = 1 / 0;
    e.value.forEach((g, c) => {
      g.lastUsed < v && (v = g.lastUsed, a = c);
    }), a !== null && e.value.delete(a);
  }
  async function C(a, v, g = !1) {
    d.value = !1;
    const c = s(a.layoutType, a.systemResource), i = Date.now();
    if (!g) {
      const D = e.value.get(c);
      if (D)
        return D.lastUsed = i, D.items;
    }
    const { pagination: p } = Ee("position", ee.Asc, {
      rowsPerPage: Me
    }), { start: n, end: t } = yt(a.systemResource, "_"), { filterConfig: y, filterData: A } = Ft(n, t);
    A.configType = Ve.FilterBookmark, A.layoutType = a.layoutType, A.systemResource = a.systemResource, A.user = a.user;
    let f = [];
    try {
      const { executeFetch: D } = v();
      f = await D(p, A, y), e.value.set(c, { lastUsed: i, items: f });
    } catch {
      d.value = !0;
    }
    return e.value.size > Na && o(), f;
  }
  async function m(a, v) {
    d.value = !1;
    const { pagination: g } = Ee("position", ee.Asc, {
      rowsPerPage: Me + 1
    }), { start: c, end: i } = yt(a.systemResource, "_"), { filterConfig: p, filterData: n } = Ft(c, i);
    n.configType = Ve.FilterBookmark, n.layoutType = a.layoutType, n.systemResource = a.systemResource, n.user = a.user;
    let t = 1 / 0;
    try {
      const { executeFetch: y } = v();
      t = (await y(g, n, p)).length;
    } catch {
      d.value = !0;
    }
    return t;
  }
  function l(a, v) {
    e.value.get(a)?.items.push(v);
  }
  return {
    bookmarks: e,
    error: d,
    getBookmarks: C,
    generateKey: s,
    addOne: l,
    fetchBookmarksCount: m
  };
}), he = (e, d, s, o, C = void 0, m = void 0, l = {}) => {
  let a = null;
  return {
    executeRequest: async (c = void 0, i = void 0, p = void 0) => {
      a = new AbortController();
      try {
        const n = { method: d }, t = Z(i) ? i : m, y = Z(c) ? c : C;
        if (_(y)) throw new Error("Url template is undefined");
        n.url = y, y !== "" && !_(t) && (n.url = We(y, t)), Q(p) || (n.data = JSON.stringify(p));
        const A = await e().request({
          ...l,
          ...n,
          signal: a.signal
        });
        if (!Je(A.status))
          throw new Ye(A.status);
        if (A.data)
          return A.data;
        if (A.status === Qe)
          return;
        throw new pe();
      } catch (n) {
        if (n instanceof DOMException && n.name === "AbortError")
          return [];
        throw Xe(n) ? n : Ge(n) ? new Ze(n, n.config?.url) : et(n) ? new tt(n, s, o, n) : at(n) ? new ot(n, s, o, n) : nt(n) ? new st(n, n) : lt(n) ? new rt(n) : gt.isAxiosError(n) ? (console.error("Axios error: " + C, n.cause), new it(n)) : (console.error("AnzuFatalError: ", n), new pe(n));
      } finally {
        a = null;
      }
    },
    abortRequest: () => {
      a && a.abort();
    }
  };
}, Tt = "/adm/v1/user-admin-config", La = "userAdminConfig";
function zt(e, d, s = La, o = Tt) {
  return {
    useFetchUserAdminConfigList: () => Dt(e, d, s, Tt),
    fetchUserAdminConfig: (c) => {
      const { executeRequest: i } = he(e, "GET", d, s);
      return i(o + "/:id", { id: c });
    },
    createUserAdminConfig: (c) => {
      const { executeRequest: i } = he(e, "POST", d, s);
      return i(o, void 0, c);
    },
    updateUserAdminConfig: (c, i) => {
      const { executeRequest: p } = he(e, "PUT", d, s);
      return p(o + "/:id", { id: c }, i);
    },
    deleteUserAdminConfig: (c) => {
      const { executeRequest: i } = he(e, "DELETE", d, s);
      return i(o + "/:id", { id: c });
    },
    updateUserAdminConfigPositions: (c) => {
      const { executeRequest: i } = he(e, "PATCH", d, s);
      return i(o + "/update-positions", void 0, { userAdminConfigs: c });
    }
  };
}
function za() {
  return {
    createDefaultUserAdminConfig: (d) => ({
      id: 0,
      user: 0,
      configType: Oa,
      layoutType: ja,
      systemResource: "",
      customName: "",
      defaultConfig: !1,
      data: [],
      position: 0,
      createdAt: Se(),
      modifiedAt: Se(),
      createdBy: null,
      modifiedBy: null,
      _resourceName: "userAdminConfig",
      _system: d
    })
  };
}
const Ma = {
  key: 0,
  class: "w-100 pt-4"
}, qa = {
  key: 1,
  class: "w-100 pt-4"
}, Ha = {
  key: 0,
  class: "d-flex w-100 align-center justify-center"
}, Ka = { key: 1 }, Wa = {
  key: 0,
  class: "d-flex align-center justify-end"
}, Ja = /* @__PURE__ */ oe({
  __name: "FilterBookmarkDialog",
  props: {
    client: {},
    system: {},
    subject: {},
    user: {},
    datatableHiddenColumns: { default: void 0 }
  },
  emits: ["onClose"],
  setup(e, { emit: d }) {
    const s = e, o = d, C = q(we), m = q(Ae), l = q(Ue);
    if (_(l) || _(C) || _(m))
      throw new Error("Incorrect provide/inject config.");
    const a = E("add"), v = E(""), g = E(!1), c = E(!1), i = E(!1), p = E(!1), n = E(!1), t = E([]), y = E(null), { required: A, maxLength: f } = ea(), D = {
      customName: {
        required: A,
        maxLength: f(100)
      }
    }, N = _t(D, { customName: v }, { $stopPropagation: !0 }), x = {
      itemEdit: {
        required: A,
        maxLength: f(100)
      }
    }, F = _t(x, { itemEdit: y }, { $stopPropagation: !0 }), k = Lt(), {
      createUserAdminConfig: $,
      useFetchUserAdminConfigList: S,
      updateUserAdminConfigPositions: j,
      deleteUserAdminConfig: R,
      updateUserAdminConfig: ae
    } = (
      // eslint-disable-next-line vue/no-setup-props-reactivity-loss
      zt(s.client, s.system)
    ), { t: w } = le(), { showErrorsDefault: B, showValidationError: X, showWarningT: J } = qe(), { createDefaultUserAdminConfig: Y } = za(), re = async () => {
      i.value = !0;
      const T = t.value.map((ne) => ne.id);
      try {
        await j(T), i.value = !1, await xe(), o("onClose");
      } catch (ne) {
        B(ne), i.value = !1;
      }
    }, { serializeFilters: ve } = ut(m, C), ie = s.system + "_" + s.subject, Mt = async () => {
      i.value = !0, n.value = !1;
      const z = Y(s.system);
      z.user = s.user, z.configType = Ve.FilterBookmark, z.layoutType = ce.Desktop, z.systemResource = ie, z.customName = v.value, z.data = {
        filter: ve(m, l, !1),
        datatableHiddenColumns: g.value && s.datatableHiddenColumns ? s.datatableHiddenColumns : void 0,
        sortBy: c.value && l.value.sortBy ? l.value.sortBy : void 0
      };
      try {
        const T = await k.fetchBookmarksCount(
          {
            user: s.user,
            layoutType: ce.Desktop,
            systemResource: ie
          },
          S
        );
        if (T >= Me) {
          n.value = !0, i.value = !1;
          return;
        }
        z.position = T + 1;
        const ne = await $(z);
        k.addOne(
          k.generateKey(ce.Desktop, ie),
          ne
        ), o("onClose");
      } catch (T) {
        if (aa(T) && oa(T, "error_field_not_unique", "cms.userAdminConfig.model.systemResource")) {
          J("common.filter.bookmark.nameUniqueError");
          return;
        }
        B(T);
      } finally {
        i.value = !1;
      }
    }, qt = () => {
      if (a.value === "add") {
        if (N.value.$touch(), N.value.$invalid) {
          X();
          return;
        }
        Mt();
      } else a.value === "manage" && t.value.length > 0 && re();
    }, Ht = async (z) => {
      p.value = !0;
      try {
        await R(z.raw.id), await xe(), Re();
      } catch (T) {
        B(T);
      } finally {
        p.value = !1;
      }
    }, pt = $t("inputRef"), Kt = async (z) => {
      y.value = { id: z.raw.id, customName: z.raw.customName }, await de(), pt.value?.focus();
    }, Wt = async (z) => {
      if (Q(y.value)) return;
      p.value = !0;
      const T = St(z.raw);
      T.customName = y.value.customName;
      try {
        Re(), await ae(T.id, T), await xe();
      } catch (ne) {
        B(ne);
      } finally {
        p.value = !1;
      }
    }, Re = () => {
      y.value = null;
    }, xe = async () => {
      p.value = !0;
      try {
        t.value = await k.getBookmarks(
          {
            user: s.user,
            layoutType: ce.Desktop,
            systemResource: ie
          },
          S,
          !0
        );
      } catch (z) {
        B(z);
      } finally {
        p.value = !1;
      }
    };
    return se(a, () => {
      n.value = !1, a.value === "manage" && xe();
    }), (z, T) => {
      const ne = be("ABtnTertiary"), Jt = be("ABtnPrimary");
      return h(), V(mt, {
        "model-value": !0,
        width: 500
      }, {
        default: u(() => [
          r(dt, null, {
            default: u(() => [
              r(He, {
                onOnCancel: T[0] || (T[0] = (H) => o("onClose"))
              }, {
                default: u(() => [
                  O(P(b(w)("common.filter.bookmark.title")), 1)
                ]),
                _: 1
              }),
              r(Ut, { class: "pt-0" }, {
                default: u(() => [
                  r(Fa, {
                    modelValue: a.value,
                    "onUpdate:modelValue": T[1] || (T[1] = (H) => a.value = H),
                    "fixed-tabs": ""
                  }, {
                    default: u(() => [
                      r(xt, { value: "add" }, {
                        default: u(() => [
                          O(P(b(w)("common.filter.bookmark.add")), 1)
                        ]),
                        _: 1
                      }),
                      r(xt, { value: "manage" }, {
                        default: u(() => [
                          O(P(b(w)("common.filter.bookmark.manage")), 1)
                        ]),
                        _: 1
                      })
                    ]),
                    _: 1
                  }, 8, ["modelValue"]),
                  a.value === "add" ? (h(), I("div", Ma, [
                    r(ue, {
                      title: b(w)("common.filter.bookmark.infoSave")
                    }, null, 8, ["title"]),
                    n.value ? (h(), V(ue, {
                      key: 0,
                      class: "text-error",
                      title: b(w)("common.filter.bookmark.errorMax")
                    }, null, 8, ["title"])) : W("", !0),
                    r(ue, null, {
                      default: u(() => [
                        r(ht, {
                          modelValue: v.value,
                          "onUpdate:modelValue": T[2] || (T[2] = (H) => v.value = H),
                          label: b(w)("common.filter.bookmark.name"),
                          required: "",
                          v: b(N).customName
                        }, null, 8, ["modelValue", "label", "v"])
                      ]),
                      _: 1
                    }),
                    r(ue, null, {
                      default: u(() => [
                        r(Ct, {
                          modelValue: g.value,
                          "onUpdate:modelValue": T[3] || (T[3] = (H) => g.value = H),
                          label: b(w)("common.filter.bookmark.storeTableColumns")
                        }, null, 8, ["modelValue", "label"])
                      ]),
                      _: 1
                    }),
                    r(ue, null, {
                      default: u(() => [
                        r(Ct, {
                          modelValue: c.value,
                          "onUpdate:modelValue": T[4] || (T[4] = (H) => c.value = H),
                          label: b(w)("common.filter.bookmark.storeTableOrder")
                        }, null, 8, ["modelValue", "label"])
                      ]),
                      _: 1
                    })
                  ])) : a.value === "manage" ? (h(), I("div", qa, [
                    p.value ? (h(), I("div", Ha, [
                      r(xa, { indeterminate: "" })
                    ])) : (h(), V(ta, {
                      key: 1,
                      modelValue: t.value,
                      "onUpdate:modelValue": T[7] || (T[7] = (H) => t.value = H),
                      "show-edit-button": "",
                      "show-delete-button": "",
                      "permanent-buttons": "",
                      onOnDelete: Ht,
                      onOnEdit: Kt
                    }, Ca({
                      item: u(({ item: H }) => [
                        y.value && y.value.id === H.raw.id ? (h(), V(ht, {
                          key: 0,
                          ref_key: "inputRef",
                          ref: pt,
                          modelValue: y.value.customName,
                          "onUpdate:modelValue": T[5] || (T[5] = (Oe) => y.value.customName = Oe),
                          "hide-details": "auto",
                          v: b(F)
                        }, null, 8, ["modelValue", "v"])) : (h(), I("div", Ka, P(H.raw.customName), 1))
                      ]),
                      _: 2
                    }, [
                      b(Q)(y.value) ? void 0 : {
                        name: "item-buttons",
                        fn: u(({ item: H }) => [
                          y.value && y.value.id === H.raw.id ? (h(), I("div", Wa, [
                            r(G, {
                              icon: "",
                              size: "x-small",
                              variant: "text",
                              class: "mx-1",
                              onClick: M((Oe) => Wt(H), ["stop"])
                            }, {
                              default: u(() => [
                                r(ye, { icon: "mdi-check" }),
                                r(ke, {
                                  anchor: "bottom",
                                  activator: "parent",
                                  text: b(w)("common.button.confirm")
                                }, null, 8, ["text"])
                              ]),
                              _: 1
                            }, 8, ["onClick"]),
                            r(G, {
                              icon: "",
                              size: "x-small",
                              variant: "text",
                              class: "mx-1",
                              onClick: T[6] || (T[6] = M((Oe) => Re(), ["stop"]))
                            }, {
                              default: u(() => [
                                r(ye, { icon: "mdi-close" }),
                                r(ke, {
                                  anchor: "bottom",
                                  activator: "parent",
                                  text: b(w)("common.button.cancel")
                                }, null, 8, ["text"])
                              ]),
                              _: 1
                            })
                          ])) : W("", !0)
                        ]),
                        key: "0"
                      }
                    ]), 1032, ["modelValue"]))
                  ])) : W("", !0)
                ]),
                _: 1
              }),
              r(Rt, null, {
                default: u(() => [
                  r(ft),
                  r(ne, {
                    "data-cy": "button-cancel",
                    onClick: T[8] || (T[8] = M((H) => o("onClose"), ["stop"]))
                  }, {
                    default: u(() => [
                      O(P(b(w)("common.button.cancel")), 1)
                    ]),
                    _: 1
                  }),
                  r(Jt, {
                    "data-cy": "button-confirm",
                    loading: i.value,
                    onClick: M(qt, ["stop"])
                  }, {
                    default: u(() => [
                      O(P(a.value === "add" ? b(w)("common.button.add") : b(w)("common.filter.bookmark.saveBookmarkOrder")), 1)
                    ]),
                    _: 1
                  }, 8, ["loading"])
                ]),
                _: 1
              })
            ]),
            _: 1
          })
        ]),
        _: 1
      });
    };
  }
}), Ya = /* @__PURE__ */ oe({
  __name: "AFilterBookmarkButton",
  props: /* @__PURE__ */ fe({
    client: {},
    system: {},
    subject: {},
    user: {},
    tooltipT: { default: "common.button.bookmarkFilter" },
    buttonClass: { default: "ml-2" },
    dataCy: { default: "filter-bookmark" },
    datatableHiddenColumns: { default: void 0 },
    datatableSortBy: { default: void 0 }
  }, {
    dialog: { type: Boolean, default: !1, required: !1 },
    dialogModifiers: {}
  }),
  emits: ["update:dialog"],
  setup(e) {
    const d = Ce(e, "dialog"), s = (C) => {
      Pt(C), d.value = !0;
    }, { t: o } = le();
    return (C, m) => (h(), I(te, null, [
      r(G, {
        class: _e([e.buttonClass, "px-2"]),
        "data-cy": e.dataCy,
        color: "light",
        "min-width": "36px",
        variant: "flat",
        onClick: M(s, ["stop"])
      }, {
        default: u(() => [
          r(ye, {
            color: "grey darken-1",
            icon: "mdi-bookmark-outline"
          }),
          r(ke, {
            activator: "parent",
            location: "bottom"
          }, {
            default: u(() => [
              O(P(b(o)(e.tooltipT)), 1)
            ]),
            _: 1
          })
        ]),
        _: 1
      }, 8, ["class", "data-cy"]),
      d.value ? (h(), V(Ja, {
        key: 0,
        client: e.client,
        system: e.system,
        user: e.user,
        subject: e.subject,
        "datatable-hidden-columns": e.datatableHiddenColumns,
        onOnClose: m[0] || (m[0] = (l) => d.value = !1)
      }, null, 8, ["client", "system", "user", "subject", "datatable-hidden-columns"])) : W("", !0)
    ], 64));
  }
}), Qa = { key: 0 }, Xa = 32, Ga = /* @__PURE__ */ oe({
  __name: "FilterBookmarks",
  props: /* @__PURE__ */ fe({
    client: {},
    userId: {},
    system: {},
    subject: {}
  }, {
    datatableHiddenColumns: {
      default: void 0,
      required: !0
    },
    datatableHiddenColumnsModifiers: {}
  }),
  emits: /* @__PURE__ */ fe(["submit"], ["update:datatableHiddenColumns"]),
  setup(e, { emit: d }) {
    const s = e, o = d, C = Ce(e, "datatableHiddenColumns"), m = q(we), l = q(Ae), a = q(Ue), v = q(Ie);
    if (_(a) || _(m) || _(l) || _(v))
      throw new Error("Incorrect provide/inject config.");
    const g = E(!1), c = $t("toolbar"), i = E(300), p = E(1e3), n = Lt(), { useFetchUserAdminConfigList: t } = zt(s.client, s.system), y = s.system + "_" + s.subject, A = async (k = !1) => {
      g.value = !0, await n.getBookmarks(
        {
          user: s.userId,
          layoutType: ce.Desktop,
          systemResource: y
        },
        t,
        k
      ), g.value = !1;
    }, { deserializeFilters: f } = ut(l, m), D = (k) => {
      const $ = k.data;
      Z($.datatableHiddenColumns) && Z(C.value) && (C.value = $.datatableHiddenColumns), Z($.sortBy) && (a.value = { ...a.value, sortBy: { key: $.sortBy.key, order: $.sortBy.order } });
      const S = f($.filter);
      if (!Q(S)) {
        for (const j in l) {
          const R = j, ae = S.filters[R];
          if (_(ae) && m.fields[R]?.clearable) {
            l[R] = St(m.fields[R].default), v.value.delete(R);
            continue;
          }
          l[R] = ae;
        }
        o("submit");
      }
    }, N = async (k) => {
      const $ = c.value;
      if (Q($)) return;
      p.value = 1e3, await de();
      let S = 0, j = 0;
      for (let R = 0; R < $.children.length; R++) {
        const w = $.children[R].offsetWidth;
        if (S += w, S >= k - Xa)
          break;
        j++;
      }
      p.value = j;
    };
    Ta(c, (k) => {
      k[0] && (i.value = k[0].contentRect.width);
    }), Ba(
      i,
      (k, $) => {
        k !== $ && N(k);
      },
      { throttle: 1e3 }
    );
    const x = U(() => {
      const k = n.generateKey(ce.Desktop, y);
      return n.bookmarks.get(k)?.items ?? [];
    }), F = U(() => {
      const k = p.value;
      return {
        visible: x.value.slice(0, k),
        hidden: x.value.slice(k)
      };
    });
    return se([g, () => x.value.length], ([k]) => {
      k === !0 || Q(c.value) || (i.value = c.value.clientWidth, de(() => {
        N(i.value);
      }));
    }), Et(() => {
      A();
    }), (k, $) => (h(), I("div", {
      ref: "toolbar",
      key: x.value.length,
      class: "w-100 d-flex overflow-hidden align-center mb-1"
    }, [
      g.value ? (h(), I("div", Qa)) : (h(), I(te, { key: 1 }, [
        (h(!0), I(te, null, me(F.value.visible, (S) => (h(), I("div", {
          key: S.id,
          class: "white-space-nowrap"
        }, [
          r(G, {
            text: "",
            "prepend-icon": "mdi-bookmark-outline",
            size: "small",
            class: "mr-1 mb-1 bg-grey-lighten-4 text-grey-darken-3",
            onClick: (j) => D(S)
          }, {
            default: u(() => [
              O(P(S.customName), 1)
            ]),
            _: 2
          }, 1032, ["onClick"])
        ]))), 128)),
        F.value.hidden.length > 0 ? (h(), V(Nt, {
          key: 0,
          bottom: "",
          "offset-y": ""
        }, {
          activator: u(({ props: S }) => [
            r(G, ct({
              icon: "mdi-menu-down",
              size: "x-small",
              width: 28,
              height: 28
            }, S), null, 16)
          ]),
          default: u(() => [
            r(Ot, { density: "compact" }, {
              default: u(() => [
                (h(!0), I(te, null, me(F.value.hidden, (S) => (h(), V(vt, {
                  key: S.id,
                  onClick: (j) => D(S)
                }, {
                  default: u(() => [
                    r(jt, null, {
                      default: u(() => [
                        O(P(S.customName), 1)
                      ]),
                      _: 2
                    }, 1024)
                  ]),
                  _: 2
                }, 1032, ["onClick"]))), 128))
              ]),
              _: 1
            })
          ]),
          _: 1
        })) : W("", !0)
      ], 64))
    ]));
  }
}), Za = { class: "d-flex flex-wrap align-center" }, eo = { class: "a-filter__container" }, to = { class: "a-filter__search" }, ao = { key: 2 }, Zo = /* @__PURE__ */ oe({
  __name: "AFilterWrapper",
  props: /* @__PURE__ */ fe({
    enableTop: { type: Boolean, default: !1 },
    hideButtons: { type: Boolean, default: !1 },
    formName: { default: "search" },
    userId: { default: void 0 },
    client: { type: Function, default: void 0 },
    store: { type: [Object, Boolean], default: !0 },
    alwaysVisible: { type: Boolean, default: !1 },
    hideMore: { type: Boolean, default: !1 }
  }, {
    datatableHiddenColumns: {
      default: void 0,
      required: !1
    },
    datatableHiddenColumnsModifiers: {},
    showDetail: { type: Boolean, default: !1, required: !1 },
    showDetailModifiers: {}
  }),
  emits: /* @__PURE__ */ fe(["submit", "reset", "bookmarkLoadAfter"], ["update:datatableHiddenColumns", "update:showDetail"]),
  setup(e, { expose: d, emit: s }) {
    const o = e, C = s, m = Ce(e, "datatableHiddenColumns"), l = Ce(e, "showDetail"), a = q(we), v = q(Ae);
    if (_(a) || _(v))
      throw new Error("Incorrect provide/inject config.");
    const g = E({
      system: a.general.system,
      subject: a.general.subject
    });
    $e(o.store) ? o.store === !1 && (g.value.system = void 0, g.value.subject = void 0) : (g.value.system = o.store.system, g.value.subject = o.store.subject);
    const c = E(0);
    kt(Bt, c);
    const i = E(/* @__PURE__ */ new Map());
    kt(Ie, i);
    const p = () => {
      c.value++, de(() => {
        C("submit");
      });
    }, { clearAll: n, clearAllFilterSelected: t } = Ke(), y = () => {
      de(() => {
        c.value++, C("bookmarkLoadAfter");
      });
    }, A = () => {
      n(v, a), t(v, a, i), de(() => {
        c.value++, C("reset");
      });
    }, f = () => {
      l.value = !l.value;
    }, D = U(() => a.touched), N = U(() => Object.entries(a.fields).filter(([, x]) => !x.render.skip).map(([x]) => x));
    return o.alwaysVisible && (l.value = !0), d({
      submit: p,
      reset: A
    }), (x, F) => (h(), V(Da, {
      name: e.formName,
      onSubmit: M(p, ["prevent"])
    }, {
      default: u(() => [
        e.enableTop ? (h(), V(Te, {
          key: 0,
          dense: ""
        }, {
          default: u(() => [
            r(ge, null, {
              default: u(() => [
                K(x.$slots, "top")
              ]),
              _: 3
            })
          ]),
          _: 3
        })) : W("", !0),
        r(Te, { dense: "" }, {
          default: u(() => [
            e.store && e.userId && b(Z)(e.client) ? (h(), V(ge, { key: 0 }, {
              default: u(() => [
                K(x.$slots, "bookmarks", {}, () => [
                  L("div", Za, [
                    g.value.system && g.value.subject && e.userId && b(Z)(e.client) ? (h(), V(Ga, {
                      key: 0,
                      "datatable-hidden-columns": m.value,
                      "onUpdate:datatableHiddenColumns": F[0] || (F[0] = (k) => m.value = k),
                      client: e.client,
                      system: g.value.system,
                      subject: g.value.subject,
                      "user-id": e.userId,
                      onSubmit: y
                    }, null, 8, ["datatable-hidden-columns", "client", "system", "subject", "user-id"])) : W("", !0)
                  ])
                ])
              ]),
              _: 3
            })) : W("", !0)
          ]),
          _: 3
        }),
        e.alwaysVisible ? W("", !0) : (h(), V(Te, {
          key: 1,
          dense: ""
        }, {
          default: u(() => [
            e.hideMore ? W("", !0) : (h(), V(ge, {
              key: 0,
              cols: "auto"
            }, {
              default: u(() => [
                r(Ia, {
                  "button-active": l.value,
                  onAdvancedFilter: f
                }, null, 8, ["button-active"])
              ]),
              _: 1
            })),
            r(ge, null, {
              default: u(() => [
                L("div", eo, [
                  L("div", to, [
                    K(x.$slots, "search")
                  ]),
                  r(Ra)
                ])
              ]),
              _: 3
            }),
            e.hideButtons ? W("", !0) : (h(), V(ge, {
              key: 1,
              class: "text-right",
              cols: "auto"
            }, {
              default: u(() => [
                K(x.$slots, "buttons", {}, () => [
                  r(na, { touched: D.value }, null, 8, ["touched"]),
                  r(sa, { onReset: A }),
                  g.value.system && g.value.subject && e.userId && b(Z)(e.client) ? (h(), V(Ya, {
                    key: 0,
                    client: e.client,
                    user: e.userId,
                    system: g.value.system,
                    subject: g.value.subject,
                    "datatable-hidden-columns": m.value
                  }, null, 8, ["client", "user", "system", "subject", "datatable-hidden-columns"])) : W("", !0)
                ])
              ]),
              _: 3
            }))
          ]),
          _: 3
        })),
        e.hideMore ? W("", !0) : (h(), I("div", ao, [
          (h(), V(ka(e.alwaysVisible ? "div" : "VSlideYTransition"), null, {
            default: u(() => [
              Vt(L("div", {
                class: _e({ "mt-6 pa-4 system-border-a": !e.alwaysVisible })
              }, [
                K(x.$slots, "detail", {}, () => [
                  r(Te, null, {
                    default: u(() => [
                      (h(!0), I(te, null, me(N.value, (k) => (h(), V(ge, {
                        key: k,
                        cols: b(a).fields[k].render.xs || 12,
                        sm: b(a).fields[k].render.sm || 6,
                        md: b(a).fields[k].render.md || 4,
                        lg: b(a).fields[k].render.lg || 3,
                        xl: b(a).fields[k].render.xl || 2
                      }, {
                        default: u(() => [
                          K(x.$slots, b(la)(k), {
                            itemConfig: b(a).fields[k]
                          }, () => [
                            r(ra, { name: k }, null, 8, ["name"])
                          ])
                        ]),
                        _: 2
                      }, 1032, ["cols", "sm", "md", "lg", "xl"]))), 128))
                    ]),
                    _: 3
                  })
                ])
              ], 2), [
                [It, l.value]
              ])
            ]),
            _: 3
          }))
        ]))
      ]),
      _: 3
    }, 8, ["name"]));
  }
}), oo = { class: "d-flex align-center justify-center" }, no = { class: "text-caption mr-1" }, en = /* @__PURE__ */ oe({
  __name: "ADatatableOrdering",
  props: /* @__PURE__ */ fe({
    variant: { default: "id" },
    customOptions: { default: void 0 },
    paginationUpdateCustomCb: { type: Function, default: void 0 }
  }, {
    modelValue: {
      default: 1,
      required: !1
    },
    modelModifiers: {}
  }),
  emits: /* @__PURE__ */ fe(["sortByChange"], ["update:modelValue"]),
  setup(e, { emit: d }) {
    const s = e, o = d, C = Ce(e, "modelValue"), m = q(Ue);
    if (_(m))
      throw new Error("Incorrect provide/inject config.");
    const { t: l } = le(), a = [
      { id: 1, titleT: "common.system.datatable.ordering.mostRecent", sortBy: { key: "createdAt", order: ee.Desc } },
      { id: 2, titleT: "common.system.datatable.ordering.oldest", sortBy: { key: "createdAt", order: ee.Asc } }
    ], v = [
      { id: 1, titleT: "common.system.datatable.ordering.mostRecent", sortBy: { key: "id", order: ee.Desc } },
      { id: 2, titleT: "common.system.datatable.ordering.oldest", sortBy: { key: "id", order: ee.Asc } }
    ], g = [
      {
        id: 3,
        titleT: "common.system.datatable.ordering.mostRelevant",
        sortBy: { key: ia, order: ee.Desc }
      },
      { id: 1, titleT: "common.system.datatable.ordering.mostRecent", sortBy: { key: "createdAt", order: ee.Desc } },
      { id: 2, titleT: "common.system.datatable.ordering.oldest", sortBy: { key: "createdAt", order: ee.Asc } }
    ], c = U(() => {
      const t = i.value.find((y) => y.id === C.value);
      return t ? l(t.titleT) : "";
    }), i = U(() => s.customOptions ? s.customOptions : s.variant === "most-relevant" ? g : s.variant === "id" ? v : a), p = (t) => {
      C.value = t.id;
    }, n = (t) => {
      t.sortBy || (m.value = { ...m.value, sortBy: null, descending: !0 }, o("sortByChange", t)), m.value.sortBy = t.sortBy, o("sortByChange", t);
    };
    return se(
      C,
      (t, y) => {
        if (t === y) return;
        const A = i.value.find((f) => f.id === t);
        if (!_(A)) {
          if (_(s.paginationUpdateCustomCb)) {
            n(A);
            return;
          }
          s.paginationUpdateCustomCb(A, m);
        }
      }
    ), se(
      m,
      (t, y) => {
        if (t.sortBy?.key === y?.sortBy?.key && t.sortBy?.order === y?.sortBy?.order)
          return;
        const A = i.value.find((f) => t.sortBy?.key === f.sortBy?.key && t.sortBy?.order === f.sortBy?.order);
        _(A) || (C.value = A.id);
      },
      { immediate: !0 }
    ), (t, y) => (h(), I("div", oo, [
      L("div", no, P(b(l)("common.system.datatable.ordering.title")) + ": ", 1),
      r(G, {
        variant: "text",
        rounded: "xl",
        size: "small",
        "append-icon": "mdi-chevron-down"
      }, {
        default: u(() => [
          O(P(c.value) + " ", 1),
          r(Nt, {
            activator: "parent",
            location: "bottom",
            "close-on-content-click": ""
          }, {
            default: u(() => [
              r(Ot, {
                density: "compact",
                class: "pa-0"
              }, {
                default: u(() => [
                  (h(!0), I(te, null, me(i.value, (A) => (h(), V(vt, {
                    key: A.id,
                    onClick: (f) => p(A)
                  }, {
                    default: u(() => [
                      r(jt, {
                        class: _e({ "font-weight-bold": A.id === C.value })
                      }, {
                        default: u(() => [
                          O(P(b(l)(A.titleT)), 1)
                        ]),
                        _: 2
                      }, 1032, ["class"])
                    ]),
                    _: 2
                  }, 1032, ["onClick"]))), 128))
                ]),
                _: 1
              })
            ]),
            _: 1
          })
        ]),
        _: 1
      })
    ]));
  }
}), so = { class: "anzu-data-footer" }, lo = {
  key: 0,
  class: "anzu-data-footer__page-limit"
}, ro = { class: "anzu-data-footer__pagination" }, io = { class: "anzu-data-footer__icons-before" }, uo = { class: "current-page" }, co = { class: "anzu-data-footer__icons-after" }, mo = /* @__PURE__ */ oe({
  __name: "ADatatablePagination",
  props: {
    itemsPerPageOptions: { default: () => [10, 25, 50] },
    hideRecordsPerPage: { type: Boolean, default: !1 }
  },
  emits: ["change"],
  setup(e, { emit: d }) {
    const s = d, o = q(Ue);
    if (_(o))
      throw new Error("Incorrect provide/inject config.");
    const { t: C } = le(), m = U(() => Math.ceil(o.value.totalCount / o.value.rowsPerPage)), l = U(() => o.value.page * o.value.rowsPerPage - o.value.rowsPerPage + 1), a = U(() => o.value.page * o.value.rowsPerPage - o.value.rowsPerPage + o.value.currentViewCount), v = U(() => o.value.page === 1), g = U(() => !Q(o.value.hasNextPage) || o.value.page === m.value), c = U(() => Q(o.value.hasNextPage) && o.value.page === m.value || o.value.hasNextPage === !1), i = U(() => Q(o.value.hasNextPage) ? o.value.totalCount : o.value.hasNextPage ? a.value + 1 + "+" : a.value);
    se(
      () => o.value.rowsPerPage,
      (A, f) => {
        A !== f && (o.value.page = 1, s("change"));
      }
    ), se(
      () => o.value.page,
      (A, f) => {
        A !== f && s("change");
      }
    );
    const p = Be(() => {
      o.value.page = 1;
    }, 300), n = Be(() => {
      o.value.page = m.value;
    }, 300), t = Be(() => {
      o.value.page = o.value.page - 1;
    }, 300), y = Be(() => {
      o.value.page = o.value.page + 1;
    }, 300);
    return (A, f) => (h(), I("div", so, [
      e.hideRecordsPerPage ? W("", !0) : (h(), I("div", lo, [
        O(P(b(C)("common.system.datatable.itemsPerPage")) + ": ", 1),
        r(Sa, {
          modelValue: b(o).rowsPerPage,
          "onUpdate:modelValue": f[0] || (f[0] = (D) => b(o).rowsPerPage = D),
          class: "ml-2",
          density: "compact",
          mandatory: "",
          "data-cy": "table-size"
        }, {
          default: u(() => [
            (h(!0), I(te, null, me(e.itemsPerPageOptions, (D) => (h(), V(G, {
              key: D,
              color: D === b(o).rowsPerPage ? "secondary" : "",
              value: D,
              density: "compact",
              size: "small",
              variant: "text"
            }, {
              default: u(() => [
                O(P(D), 1)
              ]),
              _: 2
            }, 1032, ["color", "value"]))), 128))
          ]),
          _: 1
        }, 8, ["modelValue"])
      ])),
      L("div", ro, P(l.value) + " - " + P(a.value) + " " + P(b(C)("common.system.datatable.from")) + " " + P(i.value), 1),
      L("div", io, [
        r(G, {
          disabled: v.value,
          icon: "mdi-page-first",
          size: "small",
          variant: "text",
          onClick: M(b(p), ["stop"])
        }, null, 8, ["disabled", "onClick"]),
        r(G, {
          disabled: v.value,
          icon: "mdi-chevron-left",
          size: "small",
          variant: "text",
          onClick: M(b(t), ["stop"])
        }, null, 8, ["disabled", "onClick"])
      ]),
      L("div", uo, [
        L("span", null, P(b(o).page), 1)
      ]),
      L("div", co, [
        r(G, {
          disabled: c.value,
          icon: "mdi-chevron-right",
          size: "small",
          variant: "text",
          onClick: M(b(y), ["stop"])
        }, null, 8, ["disabled", "onClick"]),
        r(G, {
          disabled: g.value,
          icon: "mdi-page-last",
          size: "small",
          variant: "text",
          onClick: M(b(n), ["stop"])
        }, null, 8, ["disabled", "onClick"])
      ])
    ]));
  }
}), fo = (e, d, s = "id") => {
  const { querySetLimit: o, querySetOffset: C, querySetOrder: m, queryBuild: l, queryAddFilter: a, queryAdd: v } = ua(), g = e.length;
  return o(g), C(1, g), m(s, !1), d ? v(s, e.join(",")) : a("in", s, e.join(",")), l();
}, tn = (e, d, s, o = void 0, C = void 0, m = {}, l = !1, a = "id") => {
  let v = null;
  return {
    executeFetch: async (i, p = void 0, n = void 0) => {
      v = new AbortController();
      try {
        const t = Z(n) ? n : C, y = Z(p) ? p : o;
        if (_(y)) throw new Error("Url template is undefined");
        const A = (_(t) ? y : We(y, t)) + fo(i, l, a), f = await e().get(A, {
          ...m,
          signal: v.signal
        });
        if (!Je(f.status))
          throw new Ye(f.status);
        if (f.data?.data)
          return f.data.data;
        if (f.status === Qe)
          return [];
        throw new pe();
      } catch (t) {
        if (t instanceof DOMException && t.name === "AbortError")
          return [];
        throw Xe(t) ? t : Ge(t) ? new Ze(t, t.config?.url) : et(t) ? new tt(t, d, s, t) : at(t) ? new ot(t, d, s, t) : nt(t) ? new st(t, t) : lt(t) ? new rt(t) : gt.isAxiosError(t) ? (console.error("Axios error: " + o, t.cause), new it(t)) : (console.error("AnzuFatalError: ", t), new pe(t));
      } finally {
        v = null;
      }
    },
    abortFetch: () => {
      v && v.abort();
    }
  };
}, an = (e, d, s, o = void 0, C = void 0, m = {}) => {
  let l = null;
  return {
    executeFetch: async (g, c, i = void 0, p = void 0, n = "id", t = !0, y = 100, A = !1) => {
      l = new AbortController();
      try {
        const f = c.general.elastic || A ? "/search" : "", D = Z(p) ? p : C, N = Z(i) ? i : o;
        if (_(N)) throw new Error("Url template is undefined");
        const { pagination: x } = Ee(n, t ? ee.Desc : ee.Asc, {
          rowsPerPage: y
        }), F = (_(D) ? N : We(N, D)) + f, k = [], $ = await e().get(F + Le(x, g, c), {
          ...m,
          signal: l.signal
        });
        if (!Je($.status))
          throw new Ye($.status);
        if ($.data) {
          const S = $.data;
          if (k.push(...S.data), ca(S))
            for (x.value.hasNextPage = S.hasNextPage; x.value.hasNextPage; ) {
              x.value.page++;
              const R = (await e().get(F + Le(x, g, c), {
                ...m,
                signal: l.signal
              })).data;
              k.push(...R.data), x.value.hasNextPage = R.hasNextPage;
            }
          else if (da(S)) {
            if (x.value.totalCount = S.totalCount, x.value.totalCount <= x.value.rowsPerPage)
              return k;
            const j = [], R = Math.ceil(x.value.totalCount / x.value.rowsPerPage);
            for (let w = 1; w < R; w++) {
              const B = { ...x.value, page: w + 1 }, X = E(B);
              j.push(
                e().get(F + Le(X, g, c), {
                  ...m,
                  signal: l.signal
                })
              );
            }
            (await Promise.all(j)).forEach((w) => {
              k.push(...w.data.data);
            });
          }
          return k;
        }
        if ($.status === Qe)
          return [];
        throw new pe();
      } catch (f) {
        if (f instanceof DOMException && f.name === "AbortError")
          return [];
        throw Xe(f) ? f : Ge(f) ? new Ze(f, f.config?.url) : et(f) ? new tt(f, d, s, f) : at(f) ? new ot(f, d, s, f) : nt(f) ? new st(f, f) : lt(f) ? new rt(f) : gt.isAxiosError(f) ? (console.error("Axios error: " + o, f.cause), new it(f)) : (console.error("AnzuFatalError: ", f), new pe(f));
      } finally {
        l = null;
      }
    },
    abortFetch: () => {
      l && l.abort();
    }
  };
}, Pe = "/adm/v1/job", De = "job";
function on(e, d) {
  return {
    useFetchJobList: () => Dt(e, d, De, Pe),
    fetchJob: (l) => fa(e, Pe + "/:id", { id: l }, d, De),
    createJob: (l) => {
      const a = va(l._resourceName).slice(4).replace("-kind-", "-kind/");
      return ga(e, l, Pe + "/:type", { type: a }, d, De);
    },
    deleteJob: (l) => ma(e, Pe + "/:id", { id: l }, d, De)
  };
}
const vo = {
  key: "",
  title: void 0,
  sortable: !1,
  fixed: !1
}, go = {
  storeColumnsLocalStorage: !0,
  disableActions: !1,
  customI18n: void 0,
  showExpand: !1
};
function po(e, d, s, o, C = {}) {
  const m = { ...go, ...C }, l = m.customI18n ?? pa, { t: a } = l.global || l;
  let v;
  ha(m.storeColumnsLocalStorage) ? v = m.storeColumnsLocalStorage : $e(m.storeColumnsLocalStorage) && m.storeColumnsLocalStorage === !0 && (v = "table_" + s + "_" + o);
  const g = e.map((n) => {
    const t = { ...vo, ...n };
    return _(t.title) && (_(t.title) && ba.includes(t.key) ? t.title = a("common.model.tracking." + t.key) : _(t.title) && s && o ? t.title = a(s + "." + o + ".model." + t.key) : t.title = ""), t;
  }), c = U(() => {
    const n = [];
    return m.showExpand && n.push({ key: "data-table-expand", sortable: !1 }), g.forEach((t) => {
      d.value.includes(t.key) || n.push(t);
    }), m.disableActions || n.push({ key: "actions", sortable: !1, fixed: "end" }), n;
  }), i = () => {
    if (!v || !localStorage) return;
    const n = localStorage.getItem(v);
    if (!n) return;
    const t = JSON.parse(n);
    ya(t) && ze(t.hidden) && (d.value = t.hidden);
  }, p = (n) => {
    !v || !localStorage || localStorage.setItem(v, JSON.stringify({ hidden: n }));
  };
  return Et(() => {
    i();
  }), se(d, (n) => {
    p(n);
  }), {
    columnsAll: g,
    columnsVisible: c,
    columnsHidden: d
  };
}
function nn(e, d, s, o, C, m, l, a = null, v = void 0, g = void 0, c = !1) {
  const i = E(!1), p = E([]), n = E([]), t = E(!1), { pagination: y, setSortBy: A, incrementPage: f } = Ee(
    Q(a) ? null : a.key,
    a?.order
  ), { resetFilter: D, submitFilter: N } = ut(m, l, {
    storeFiltersLocalStorage: !1,
    populateUrlParams: !1
  }), { showErrorsDefault: x } = qe(), { columnsVisible: F, columnsAll: k, columnsHidden: $ } = po(
    e,
    d,
    s,
    o,
    { storeColumnsLocalStorage: !1, disableActions: !0 }
  ), S = () => {
    ae(), B();
  }, j = (J) => {
    A(J.sortBy), B();
  }, R = async () => {
    t.value = !0, f();
    try {
      const J = await C(
        y,
        m,
        l,
        v,
        g,
        c
      );
      p.value.push(...J);
    } catch (J) {
      x(J);
    } finally {
      t.value = !1;
    }
  }, ae = () => {
    p.value = [], n.value = [];
  }, w = async () => {
    t.value = !0;
    try {
      p.value = await C(
        y,
        m,
        l,
        v,
        g,
        c
      );
    } catch (J) {
      x(J);
    } finally {
      t.value = !1;
    }
  }, B = Pa(async () => {
    await w();
  });
  return {
    items: p,
    selected: n,
    pagination: y,
    columnsVisible: F,
    columnsHidden: $,
    columnsAll: k,
    filterTouched: i,
    loading: t,
    onRowClick: (J) => {
      const Y = J.target;
      if (!Y || Y.tagName === "INPUT" && Y.type === "checkbox")
        return;
      const re = Y.closest(".v-data-table__tr");
      if (!re || !re.classList.contains("v-data-table__tr")) return;
      const ve = re.firstElementChild;
      if (!ve || !ve.classList.contains("v-data-table__td")) return;
      const ie = ve.querySelector("input");
      ie && ie.click();
    },
    onFetchNextPage: R,
    onOpen: S,
    sortByChange: j,
    getList: B,
    resetFilter: () => D(y, B),
    submitFilter: () => N(y, B)
  };
}
const bo = { class: "d-flex flex-column w-100 px-1 align-center" }, yo = { class: "d-flex justify-space-between w-100 align-center" }, ho = { class: "d-flex align-center" }, Co = { class: "d-flex align-center" }, ko = { class: "subject-select__sidebar system-border-r" }, wo = { class: "subject-select-filter" }, Ao = { class: "subject-select__content" }, _o = {
  key: 0,
  class: "d-flex w-100 align-center justify-center pa-4"
}, xo = { class: "subject-select__actions system-border-t" }, Fo = { key: 0 }, To = { key: 1 }, sn = /* @__PURE__ */ oe({
  __name: "ASubjectSelect",
  props: {
    selectedItems: {},
    pagination: {},
    loading: { type: Boolean, default: !1 },
    minCount: { default: 1 },
    maxCount: { default: 1 },
    modelValue: { type: Boolean, default: void 0 },
    dialogTitleT: { default: "common.subjectSelect.texts.title" },
    paginationMode: { default: "standard" }
  },
  emits: ["update:modelValue", "update:pagination", "onOpen", "onPageChange", "onConfirm", "onFetchNextPage"],
  setup(e, { expose: d, emit: s }) {
    const o = e, C = s, m = E(!1), l = U({
      get() {
        return _(o.modelValue) ? m.value : o.modelValue;
      },
      set(F) {
        m.value = F, C("update:modelValue", F);
      }
    }), a = U({
      get: () => o.pagination,
      set: (F) => {
        C("update:pagination", { ...wt(F) });
      }
    }), v = E(!0), { t: g } = le(), c = U(() => o.selectedItems.length), i = U(() => c.value < o.minCount || c.value > o.maxCount), p = () => {
      C("onOpen"), v.value = !0, l.value = !0;
    }, n = () => {
      v.value = !v.value;
    }, t = () => {
      l.value = !1;
    }, y = () => {
      C(
        "onConfirm",
        o.selectedItems.map((F) => wt(F))
      ), t();
    }, A = () => {
      C("onFetchNextPage");
    }, f = () => {
      C("onPageChange");
    }, D = U(() => Math.ceil(a.value.totalCount / a.value.rowsPerPage)), N = U(() => !(Q(a.value.hasNextPage) && a.value.page === D.value || a.value.hasNextPage === !1)), x = (F) => {
      F && N.value && !o.loading && A();
    };
    return d({
      open: p
    }), (F, k) => {
      const $ = be("ABtnSecondary"), S = be("ABtnPrimary");
      return h(), I(te, null, [
        K(F.$slots, "activator", {
          props: { onClick: M(() => p(), ["stop"]) }
        }),
        r(mt, ct(F.$attrs, {
          "model-value": l.value,
          fullscreen: "",
          class: "subject-select",
          "onUpdate:modelValue": k[1] || (k[1] = (j) => C("update:modelValue", j))
        }), {
          default: u(() => [
            l.value ? (h(), V(dt, {
              key: 0,
              class: "subject-select__card"
            }, {
              default: u(() => [
                r(He, {
                  class: "subject-select__toolbar system-border-b",
                  onOnCancel: t
                }, {
                  default: u(() => [
                    K(F.$slots, "title", {}, () => [
                      O(P(b(g)(e.dialogTitleT)), 1)
                    ])
                  ]),
                  _: 3
                }),
                r($a, {
                  density: "compact",
                  color: "transparent",
                  height: 46,
                  elevation: "0",
                  class: "system-border-b subject-select__second-bar"
                }, {
                  default: u(() => [
                    K(F.$slots, "second-bar", {}, () => [
                      L("div", bo, [
                        L("div", yo, [
                          L("div", ho, [
                            r(G, {
                              icon: "",
                              width: 30,
                              height: 30,
                              onClick: n
                            }, {
                              default: u(() => [
                                r(ye, {
                                  icon: "mdi-tune",
                                  size: 16
                                }),
                                r(ke, {
                                  activator: "parent",
                                  location: "bottom"
                                }, {
                                  default: u(() => [
                                    O(P(b(g)("common.subjectSelect.filter.toggle")), 1)
                                  ]),
                                  _: 1
                                })
                              ]),
                              _: 1
                            }),
                            K(F.$slots, "second-bar-left")
                          ]),
                          L("div", Co, [
                            K(F.$slots, "second-bar-right")
                          ])
                        ])
                      ])
                    ])
                  ]),
                  _: 3
                }),
                L("div", {
                  class: _e(["subject-select__main", { "subject-select__main--sidebar-active": v.value }])
                }, [
                  L("div", ko, [
                    L("div", wo, [
                      K(F.$slots, "filter")
                    ])
                  ]),
                  L("div", Ao, [
                    K(F.$slots, "content"),
                    e.paginationMode === "more" ? (h(), I("div", _o, [
                      Vt((h(), V($, {
                        loading: e.loading,
                        size: "small",
                        onClick: A
                      }, {
                        default: u(() => [
                          K(F.$slots, "button-confirm-title", {}, () => [
                            O(P(b(g)("common.button.loadMore")), 1)
                          ])
                        ]),
                        _: 3
                      }, 8, ["loading"])), [
                        [It, N.value || e.loading],
                        [
                          Ea,
                          x,
                          void 0,
                          { quiet: !0 }
                        ]
                      ])
                    ])) : (h(), V(mo, {
                      key: 1,
                      modelValue: a.value,
                      "onUpdate:modelValue": k[0] || (k[0] = (j) => a.value = j),
                      onChange: f
                    }, null, 8, ["modelValue"]))
                  ])
                ], 2),
                L("div", xo, [
                  e.minCount === e.maxCount ? (h(), I("div", Fo, P(b(g)("common.subjectSelect.texts.pickExactCount", { count: e.minCount, selected: c.value })), 1)) : (h(), I("div", To, P(b(g)("common.subjectSelect.texts.pickRangeCount", {
                    minCount: e.minCount,
                    maxCount: e.maxCount,
                    selected: c.value
                  })), 1)),
                  r(ft),
                  r(S, {
                    disabled: i.value,
                    onClick: M(y, ["stop"])
                  }, {
                    default: u(() => [
                      K(F.$slots, "button-confirm-title", {}, () => [
                        O(P(b(g)("common.button.confirm")), 1)
                      ])
                    ]),
                    _: 3
                  }, 8, ["disabled"])
                ])
              ]),
              _: 3
            })) : W("", !0)
          ]),
          _: 3
        }, 16, ["model-value"])
      ], 64);
    };
  }
});
export {
  en as ADatatableOrdering,
  mo as ADatatablePagination,
  un as AFilterBooleanSelect,
  cn as AFilterDatetimePicker,
  dn as AFilterInteger,
  mn as AFilterRemoteAutocomplete,
  fn as AFilterRemoteAutocompleteWithMinimal,
  vn as AFilterString,
  Go as AFilterTimeInterval,
  gn as AFilterValueObjectOptionsSelect,
  Zo as AFilterWrapper,
  pn as AFilterWrapperSubjectSelect,
  bn as AFormRemoteAutocomplete,
  sn as ASubjectSelect,
  Ue as DatatablePaginationKey,
  we as FilterConfigKey,
  Ae as FilterDataKey,
  yn as FilterInnerConfigKey,
  hn as FilterInnerDataKey,
  Ne as TimeIntervalSpecialOptions,
  ce as UserAdminConfigLayoutType,
  ja as UserAdminConfigLayoutTypeDefault,
  Ve as UserAdminConfigType,
  Oa as UserAdminConfigTypeDefault,
  po as createDatatableColumnsConfig,
  Gt as createFilter,
  Zt as createFilterStore,
  Le as generateListQuery,
  tn as useApiFetchByIds,
  Dt as useApiFetchList,
  an as useApiFetchListBatch,
  ua as useApiQueryBuilder,
  he as useApiRequest,
  ut as useFilterHelpers,
  on as useJobApi,
  Ee as usePagination,
  nn as useSubjectSelect,
  zt as useUserAdminConfigApi,
  za as useUserAdminConfigFactory
};
//# sourceMappingURL=labs.js.map
