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