@anzusystems/common-admin 1.47.0-beta.dev-1776195285 → 1.47.0-beta.dev-1777971796

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/labs.js CHANGED
@@ -1,24 +1,29 @@
1
- import { bV as de, d as F, j as L, k as Ne, a1 as Ve, h as Q, i as te, aj as me, ak as fe, al as pe, am as ge, ag as ae, b0 as ve, aa as be, ab as he, ac as ye, ad as Ce, an as Ae, ao as Pe, ae as we, af as _e, bW as xe, bX as ke, bg as Te, bY as je, as as Se, bZ as oe, ap as Le, aq as Re, aU as ze, b4 as $e, ar as Ue, E as Me, a8 as qe, a2 as Je, b_ as Ke, q as He, p as We, x as Qe, a7 as Ye, aI as Ge, m as Xe, b$ as Ze, l as et } from "./AFormRemoteAutocomplete.vue_vue_type_script_setup_true_lang-DjYHyeck.mjs";
2
- import { aE as ga, c0 as va, c1 as ba, aA as ha, aB as ya, aD as Ca, aF as Aa, aC as Pa, aR as wa, aJ as _a, bd as xa, aG as ka, aH as Ta, ay as Sa, az as Fa, c2 as Ea, c3 as Ba, c4 as Oa, c5 as Da, c6 as Ia, ai as Na, ah as Va, c7 as ja, c8 as La, c9 as Ra } from "./AFormRemoteAutocomplete.vue_vue_type_script_setup_true_lang-DjYHyeck.mjs";
3
- import { defineComponent as se, useModel as tt, inject as Fe, computed as w, watch as G, openBlock as S, createElementBlock as R, createElementVNode as k, toDisplayString as _, unref as y, createVNode as P, withCtx as T, createTextVNode as z, Fragment as ne, renderList as Ee, createBlock as Y, normalizeClass as Be, mergeModels as ie, createCommentVNode as Oe, withModifiers as J, ref as q, onMounted as De, toRaw as ce, provide as at, resolveComponent as ue, renderSlot as j, mergeProps as ot, withDirectives as st, vShow as nt } from "vue";
4
- import { useI18n as re } from "vue-i18n";
5
- import { VBtn as M } from "vuetify/components/VBtn";
6
- import { VList as rt, VListItem as lt, VListItemTitle as it } from "vuetify/components/VList";
7
- import { VMenu as ct } from "vuetify/components/VMenu";
8
- import { useThrottleFn as X, useDebounceFn as ut } from "@vueuse/core";
9
- import { VBtnToggle as dt } from "vuetify/components/VBtnToggle";
10
- import Ie from "axios";
11
- import { useDisplay as mt } from "vuetify";
12
- import { VCard as ft } from "vuetify/components/VCard";
13
- import { VDialog as pt } from "vuetify/components/VDialog";
14
- import { VSpacer as gt } from "vuetify/components/VGrid";
15
- import { VIcon as vt } from "vuetify/components/VIcon";
16
- import { VToolbar as bt } from "vuetify/components/VToolbar";
17
- import { VTooltip as ht } from "vuetify/components/VTooltip";
18
- import { Intersect as yt } from "vuetify/directives";
19
- const Ct = { class: "d-flex align-center justify-center" }, At = { class: "text-body-small mr-1" }, la = /* @__PURE__ */ se({
1
+ import { bS as Cn, d as pe, j as Ue, k as Ra, a1 as Ka, h as ft, i as Tt, aj as xn, ak as An, al as Sn, am as Pn, ag as Et, aZ as In, aa as Dn, ab as Tn, ac as En, ad as $n, an as Fn, ao as Bn, ae as Rn, af as Kn, bT as Vn, bU as Ln, bd as Mn, bV as Va, as as zn, bW as Yt, ap as La, aq as Ma, aU as za, b1 as Na, ar as Oa, E as Ua, a8 as ja, a2 as qa, bX as Ga, q as Ha, p as Ja, x as Wa, a7 as Ya, aI as Xa, m as Nn, bY as Qa, l as Za, bZ as _a, b_ as On, b$ as Un, c0 as jn, c1 as qn, c2 as Gn, c3 as Hn, c4 as Jn, c5 as Wn, c6 as Yn, c7 as Xn, g as Ce, c8 as eo, _ as to, c9 as no, ca as ao, cb as oo, cc as lo, aT as io, cd as so, ce as ro, cf as co, z as uo } from "./AFormRemoteAutocomplete.vue_vue_type_script_setup_true_lang-1FJ-5Ucu.mjs";
2
+ import { aE as Di, cg as Ti, ch as Ei, aA as $i, aB as Fi, aD as Bi, aF as Ri, aC as Ki, aR as Vi, aJ as Li, ba as Mi, aW as zi, aG as Ni, aH as Oi, ay as Ui, az as ji, ci as qi, cj as Gi, ck as Hi, cl as Ji, cm as Wi, cn as Yi, co as Xi, ai as Qi, ah as Zi, cp as _i, cq as es, cr as ts, cs as ns } from "./AFormRemoteAutocomplete.vue_vue_type_script_setup_true_lang-1FJ-5Ucu.mjs";
3
+ import { defineComponent as He, useModel as Ge, inject as Qn, computed as k, watch as Pe, openBlock as g, createElementBlock as M, createElementVNode as z, toDisplayString as B, unref as d, createVNode as i, withCtx as s, createTextVNode as J, Fragment as be, renderList as at, createBlock as X, normalizeClass as xe, mergeModels as Ve, createCommentVNode as G, withModifiers as ae, ref as fe, onMounted as Qt, toRaw as yn, provide as fo, resolveComponent as hn, renderSlot as L, mergeProps as oe, withDirectives as mo, vShow as vo, useSlots as Zn, useTemplateRef as $t, isRef as _n, normalizeStyle as mt, normalizeProps as Ke, guardReactiveProps as qe, shallowRef as Xt, nextTick as Oe, onBeforeUnmount as ea, getCurrentInstance as yo } from "vue";
4
+ import { useI18n as Je } from "vue-i18n";
5
+ import { VBtn as ee } from "vuetify/components/VBtn";
6
+ import { VList as vt, VListItem as Ae, VListItemTitle as Ee } from "vuetify/components/VList";
7
+ import { VMenu as Ft } from "vuetify/components/VMenu";
8
+ import { useThrottleFn as At, useDebounceFn as ho } from "@vueuse/core";
9
+ import { VBtnToggle as po } from "vuetify/components/VBtnToggle";
10
+ import ta from "axios";
11
+ import { useDisplay as Zt } from "vuetify";
12
+ import { VCard as _t, VCardTitle as na, VCardText as Dt, VCardActions as aa } from "vuetify/components/VCard";
13
+ import { VDialog as en } from "vuetify/components/VDialog";
14
+ import { VSpacer as tn } from "vuetify/components/VGrid";
15
+ import { VIcon as te } from "vuetify/components/VIcon";
16
+ import { VToolbar as go } from "vuetify/components/VToolbar";
17
+ import { VTooltip as Se } from "vuetify/components/VTooltip";
18
+ import { Intersect as bo } from "vuetify/directives";
19
+ import { VAlert as nn } from "vuetify/components/VAlert";
20
+ import { VProgressCircular as oa } from "vuetify/components/VProgressCircular";
21
+ import { VRadio as pn } from "vuetify/components/VRadio";
22
+ import { VRadioGroup as ko } from "vuetify/components/VRadioGroup";
23
+ import { onBeforeRouteLeave as wo } from "vue-router";
24
+ const Co = { class: "d-flex align-center justify-center" }, xo = { class: "text-body-small mr-1" }, yi = /* @__PURE__ */ He({
20
25
  __name: "ADatatableOrdering",
21
- props: /* @__PURE__ */ ie({
26
+ props: /* @__PURE__ */ Ve({
22
27
  variant: { default: "id" },
23
28
  customOptions: { default: void 0 },
24
29
  paginationUpdateCustomCb: { type: Function, default: void 0 }
@@ -29,111 +34,111 @@ const Ct = { class: "d-flex align-center justify-center" }, At = { class: "text-
29
34
  },
30
35
  modelModifiers: {}
31
36
  }),
32
- emits: /* @__PURE__ */ ie(["sortByChange"], ["update:modelValue"]),
33
- setup(r, { emit: f }) {
34
- const d = r, e = f, i = tt(r, "modelValue"), c = Fe(de);
35
- if (F(c))
37
+ emits: /* @__PURE__ */ Ve(["sortByChange"], ["update:modelValue"]),
38
+ setup(t, { emit: x }) {
39
+ const v = t, n = x, y = Ge(t, "modelValue"), p = Qn(Cn);
40
+ if (pe(p))
36
41
  throw new Error("Incorrect provide/inject config.");
37
- const { t: s } = re(), m = [
42
+ const { t: h } = Je(), b = [
38
43
  {
39
44
  id: 1,
40
45
  titleT: "common.system.datatable.ordering.mostRecent",
41
- sortBy: { key: "createdAt", order: L.Desc }
46
+ sortBy: { key: "createdAt", order: Ue.Desc }
42
47
  },
43
48
  {
44
49
  id: 2,
45
50
  titleT: "common.system.datatable.ordering.oldest",
46
- sortBy: { key: "createdAt", order: L.Asc }
51
+ sortBy: { key: "createdAt", order: Ue.Asc }
47
52
  }
48
- ], l = [
53
+ ], m = [
49
54
  {
50
55
  id: 1,
51
56
  titleT: "common.system.datatable.ordering.mostRecent",
52
- sortBy: { key: "id", order: L.Desc }
57
+ sortBy: { key: "id", order: Ue.Desc }
53
58
  },
54
59
  {
55
60
  id: 2,
56
61
  titleT: "common.system.datatable.ordering.oldest",
57
- sortBy: { key: "id", order: L.Asc }
62
+ sortBy: { key: "id", order: Ue.Asc }
58
63
  }
59
- ], v = [
64
+ ], c = [
60
65
  {
61
66
  id: 3,
62
67
  titleT: "common.system.datatable.ordering.mostRelevant",
63
- sortBy: { key: Ne, order: L.Desc }
68
+ sortBy: { key: Ra, order: Ue.Desc }
64
69
  },
65
70
  {
66
71
  id: 1,
67
72
  titleT: "common.system.datatable.ordering.mostRecent",
68
- sortBy: { key: "createdAt", order: L.Desc }
73
+ sortBy: { key: "createdAt", order: Ue.Desc }
69
74
  },
70
75
  {
71
76
  id: 2,
72
77
  titleT: "common.system.datatable.ordering.oldest",
73
- sortBy: { key: "createdAt", order: L.Asc }
74
- }
75
- ], C = w(() => {
76
- const t = p.value.find((h) => h.id === i.value);
77
- return t ? s(t.titleT) : "";
78
- }), p = w(() => d.customOptions ? d.customOptions : d.variant === "most-relevant" ? v : d.variant === "id" ? l : m), b = (t) => {
79
- i.value = t.id;
80
- }, u = (t) => {
81
- t.sortBy || (c.value = {
82
- ...c.value,
78
+ sortBy: { key: "createdAt", order: Ue.Asc }
79
+ }
80
+ ], I = k(() => {
81
+ const P = D.value.find((T) => T.id === y.value);
82
+ return P ? h(P.titleT) : "";
83
+ }), D = k(() => v.customOptions ? v.customOptions : v.variant === "most-relevant" ? c : v.variant === "id" ? m : b), O = (P) => {
84
+ y.value = P.id;
85
+ }, K = (P) => {
86
+ P.sortBy || (p.value = {
87
+ ...p.value,
83
88
  sortBy: null
84
- }, e("sortByChange", t)), c.value.sortBy = t.sortBy, e("sortByChange", t);
89
+ }, n("sortByChange", P)), p.value.sortBy = P.sortBy, n("sortByChange", P);
85
90
  };
86
- return G(i, (t, h) => {
87
- if (t === h) return;
88
- const g = p.value.find((a) => a.id === t);
89
- if (!F(g)) {
90
- if (F(d.paginationUpdateCustomCb)) {
91
- u(g);
91
+ return Pe(y, (P, T) => {
92
+ if (P === T) return;
93
+ const U = D.value.find((R) => R.id === P);
94
+ if (!pe(U)) {
95
+ if (pe(v.paginationUpdateCustomCb)) {
96
+ K(U);
92
97
  return;
93
98
  }
94
- d.paginationUpdateCustomCb(g, c);
99
+ v.paginationUpdateCustomCb(U, p);
95
100
  }
96
- }), G(
97
- c,
98
- (t, h) => {
99
- if (t.sortBy?.key === h?.sortBy?.key && t.sortBy?.order === h?.sortBy?.order)
101
+ }), Pe(
102
+ p,
103
+ (P, T) => {
104
+ if (P.sortBy?.key === T?.sortBy?.key && P.sortBy?.order === T?.sortBy?.order)
100
105
  return;
101
- const g = p.value.find((a) => t.sortBy?.key === a.sortBy?.key && t.sortBy?.order === a.sortBy?.order);
102
- F(g) || (i.value = g.id);
106
+ const U = D.value.find((R) => P.sortBy?.key === R.sortBy?.key && P.sortBy?.order === R.sortBy?.order);
107
+ pe(U) || (y.value = U.id);
103
108
  },
104
109
  { immediate: !0 }
105
- ), (t, h) => (S(), R("div", Ct, [
106
- k("div", At, _(y(s)("common.system.datatable.ordering.title")) + ": ", 1),
107
- P(M, {
110
+ ), (P, T) => (g(), M("div", Co, [
111
+ z("div", xo, B(d(h)("common.system.datatable.ordering.title")) + ": ", 1),
112
+ i(ee, {
108
113
  variant: "text",
109
114
  rounded: "xl",
110
115
  size: "small",
111
116
  class: "text-medium-emphasis",
112
117
  "append-icon": "mdi-chevron-down"
113
118
  }, {
114
- default: T(() => [
115
- z(_(C.value) + " ", 1),
116
- P(ct, {
119
+ default: s(() => [
120
+ J(B(I.value) + " ", 1),
121
+ i(Ft, {
117
122
  activator: "parent",
118
123
  location: "bottom",
119
124
  "close-on-content-click": ""
120
125
  }, {
121
- default: T(() => [
122
- P(rt, {
126
+ default: s(() => [
127
+ i(vt, {
123
128
  density: "compact",
124
129
  class: "pa-0"
125
130
  }, {
126
- default: T(() => [
127
- (S(!0), R(ne, null, Ee(p.value, (g) => (S(), Y(lt, {
128
- key: g.id,
129
- onClick: (a) => b(g)
131
+ default: s(() => [
132
+ (g(!0), M(be, null, at(D.value, (U) => (g(), X(Ae, {
133
+ key: U.id,
134
+ onClick: (R) => O(U)
130
135
  }, {
131
- default: T(() => [
132
- P(it, {
133
- class: Be({ "font-weight-bold": g.id === i.value })
136
+ default: s(() => [
137
+ i(Ee, {
138
+ class: xe({ "font-weight-bold": U.id === y.value })
134
139
  }, {
135
- default: T(() => [
136
- z(_(y(s)(g.titleT)), 1)
140
+ default: s(() => [
141
+ J(B(d(h)(U.titleT)), 1)
137
142
  ]),
138
143
  _: 2
139
144
  }, 1032, ["class"])
@@ -151,63 +156,63 @@ const Ct = { class: "d-flex align-center justify-center" }, At = { class: "text-
151
156
  })
152
157
  ]));
153
158
  }
154
- }), Pt = { class: "anzu-data-footer" }, wt = {
159
+ }), Ao = { class: "anzu-data-footer" }, So = {
155
160
  key: 0,
156
161
  class: "anzu-data-footer__page-limit"
157
- }, _t = { class: "anzu-data-footer__pagination" }, xt = { class: "anzu-data-footer__icons-before" }, kt = { class: "current-page" }, Tt = { class: "anzu-data-footer__icons-after" }, St = /* @__PURE__ */ se({
162
+ }, Po = { class: "anzu-data-footer__pagination" }, Io = { class: "anzu-data-footer__icons-before" }, Do = { class: "current-page" }, To = { class: "anzu-data-footer__icons-after" }, Eo = /* @__PURE__ */ He({
158
163
  __name: "ADatatablePagination",
159
164
  props: {
160
165
  itemsPerPageOptions: { default: () => [10, 25, 50] },
161
166
  hideRecordsPerPage: { type: Boolean, default: !1 }
162
167
  },
163
168
  emits: ["change"],
164
- setup(r, { emit: f }) {
165
- const d = f, e = Fe(de);
166
- if (F(e))
169
+ setup(t, { emit: x }) {
170
+ const v = x, n = Qn(Cn);
171
+ if (pe(n))
167
172
  throw new Error("Incorrect provide/inject config.");
168
- const { t: i } = re(), { setStoredPage: c } = Ve(), s = w(() => Math.ceil(e.value.totalCount / e.value.rowsPerPage)), m = w(() => e.value.page * e.value.rowsPerPage - e.value.rowsPerPage + 1), l = w(() => e.value.page * e.value.rowsPerPage - e.value.rowsPerPage + e.value.currentViewCount), v = w(() => e.value.page === 1), C = w(() => !Q(e.value.hasNextPage) || e.value.page === s.value), p = w(() => Q(e.value.hasNextPage) && e.value.page === s.value || e.value.hasNextPage === !1), b = w(() => Q(e.value.hasNextPage) ? e.value.totalCount : e.value.hasNextPage ? l.value + 1 + "+" : l.value);
169
- G(
170
- () => e.value.rowsPerPage,
171
- (a, A) => {
172
- a !== A && (e.value.page = 1, d("change"));
173
+ const { t: y } = Je(), { setStoredPage: p } = Ka(), h = k(() => Math.ceil(n.value.totalCount / n.value.rowsPerPage)), b = k(() => n.value.page * n.value.rowsPerPage - n.value.rowsPerPage + 1), m = k(() => n.value.page * n.value.rowsPerPage - n.value.rowsPerPage + n.value.currentViewCount), c = k(() => n.value.page === 1), I = k(() => !ft(n.value.hasNextPage) || n.value.page === h.value), D = k(() => ft(n.value.hasNextPage) && n.value.page === h.value || n.value.hasNextPage === !1), O = k(() => ft(n.value.hasNextPage) ? n.value.totalCount : n.value.hasNextPage ? m.value + 1 + "+" : m.value);
174
+ Pe(
175
+ () => n.value.rowsPerPage,
176
+ (R, E) => {
177
+ R !== E && (n.value.page = 1, v("change"));
173
178
  }
174
- ), G(
175
- () => e.value.page,
176
- (a, A) => {
177
- a !== A && (c(a), d("change"));
179
+ ), Pe(
180
+ () => n.value.page,
181
+ (R, E) => {
182
+ R !== E && (p(R), v("change"));
178
183
  }
179
184
  );
180
- const u = X(() => {
181
- e.value.page = 1;
182
- }, 300), t = X(() => {
183
- e.value.page = s.value;
184
- }, 300), h = X(() => {
185
- e.value.page = e.value.page - 1;
186
- }, 300), g = X(() => {
187
- e.value.page = e.value.page + 1;
185
+ const K = At(() => {
186
+ n.value.page = 1;
187
+ }, 300), P = At(() => {
188
+ n.value.page = h.value;
189
+ }, 300), T = At(() => {
190
+ n.value.page = n.value.page - 1;
191
+ }, 300), U = At(() => {
192
+ n.value.page = n.value.page + 1;
188
193
  }, 300);
189
- return (a, A) => (S(), R("div", Pt, [
190
- r.hideRecordsPerPage ? Oe("", !0) : (S(), R("div", wt, [
191
- z(_(y(i)("common.system.datatable.itemsPerPage")) + ": ", 1),
192
- P(dt, {
193
- modelValue: y(e).rowsPerPage,
194
- "onUpdate:modelValue": A[0] || (A[0] = (x) => y(e).rowsPerPage = x),
194
+ return (R, E) => (g(), M("div", Ao, [
195
+ t.hideRecordsPerPage ? G("", !0) : (g(), M("div", So, [
196
+ J(B(d(y)("common.system.datatable.itemsPerPage")) + ": ", 1),
197
+ i(po, {
198
+ modelValue: d(n).rowsPerPage,
199
+ "onUpdate:modelValue": E[0] || (E[0] = (Q) => d(n).rowsPerPage = Q),
195
200
  class: "ml-2",
196
201
  density: "compact",
197
202
  mandatory: "",
198
203
  "data-cy": "table-size"
199
204
  }, {
200
- default: T(() => [
201
- (S(!0), R(ne, null, Ee(r.itemsPerPageOptions, (x) => (S(), Y(M, {
202
- key: x,
203
- color: x === y(e).rowsPerPage ? "secondary" : "",
204
- value: x,
205
+ default: s(() => [
206
+ (g(!0), M(be, null, at(t.itemsPerPageOptions, (Q) => (g(), X(ee, {
207
+ key: Q,
208
+ color: Q === d(n).rowsPerPage ? "secondary" : "",
209
+ value: Q,
205
210
  density: "compact",
206
211
  size: "small",
207
212
  variant: "text"
208
213
  }, {
209
- default: T(() => [
210
- z(_(x), 1)
214
+ default: s(() => [
215
+ J(B(Q), 1)
211
216
  ]),
212
217
  _: 2
213
218
  }, 1032, ["color", "value"]))), 128))
@@ -215,306 +220,306 @@ const Ct = { class: "d-flex align-center justify-center" }, At = { class: "text-
215
220
  _: 1
216
221
  }, 8, ["modelValue"])
217
222
  ])),
218
- k("div", _t, _(m.value) + " - " + _(l.value) + " " + _(y(i)("common.system.datatable.from")) + " " + _(b.value), 1),
219
- k("div", xt, [
220
- P(M, {
221
- disabled: v.value,
223
+ z("div", Po, B(b.value) + " - " + B(m.value) + " " + B(d(y)("common.system.datatable.from")) + " " + B(O.value), 1),
224
+ z("div", Io, [
225
+ i(ee, {
226
+ disabled: c.value,
222
227
  icon: "mdi-page-first",
223
228
  size: "small",
224
229
  variant: "text",
225
- onClick: J(y(u), ["stop"])
230
+ onClick: ae(d(K), ["stop"])
226
231
  }, null, 8, ["disabled", "onClick"]),
227
- P(M, {
228
- disabled: v.value,
232
+ i(ee, {
233
+ disabled: c.value,
229
234
  icon: "mdi-chevron-left",
230
235
  size: "small",
231
236
  variant: "text",
232
- onClick: J(y(h), ["stop"])
237
+ onClick: ae(d(T), ["stop"])
233
238
  }, null, 8, ["disabled", "onClick"])
234
239
  ]),
235
- k("div", kt, [
236
- k("span", null, _(y(e).page), 1)
240
+ z("div", Do, [
241
+ z("span", null, B(d(n).page), 1)
237
242
  ]),
238
- k("div", Tt, [
239
- P(M, {
240
- disabled: p.value,
243
+ z("div", To, [
244
+ i(ee, {
245
+ disabled: D.value,
241
246
  icon: "mdi-chevron-right",
242
247
  size: "small",
243
248
  variant: "text",
244
- onClick: J(y(g), ["stop"])
249
+ onClick: ae(d(U), ["stop"])
245
250
  }, null, 8, ["disabled", "onClick"]),
246
- P(M, {
247
- disabled: C.value,
251
+ i(ee, {
252
+ disabled: I.value,
248
253
  icon: "mdi-page-last",
249
254
  size: "small",
250
255
  variant: "text",
251
- onClick: J(y(t), ["stop"])
256
+ onClick: ae(d(P), ["stop"])
252
257
  }, null, 8, ["disabled", "onClick"])
253
258
  ])
254
259
  ]));
255
260
  }
256
- }), Ft = (r, f, d = "id") => {
257
- const { querySetLimit: e, querySetOffset: i, querySetOrder: c, queryBuild: s, queryAddFilter: m, queryAdd: l } = je(), v = r.length;
258
- return e(v), i(1, v), c(d, !1), f ? l(d, r.join(",")) : m("in", d, r.join(",")), s();
259
- }, ia = (r) => {
261
+ }), $o = (t, x, v = "id") => {
262
+ const { querySetLimit: n, querySetOffset: y, querySetOrder: p, queryBuild: h, queryAddFilter: b, queryAdd: m } = Va(), c = t.length;
263
+ return n(c), y(1, c), p(v, !1), x ? m(v, t.join(",")) : b("in", v, t.join(",")), h();
264
+ }, hi = (t) => {
260
265
  const {
261
- client: f,
262
- system: d,
263
- entity: e,
264
- urlTemplate: i,
265
- urlParams: c,
266
- options: s = {},
267
- isSearchApi: m = !1,
268
- field: l = "id",
269
- silentConsoleError: v = !1
270
- } = r;
271
- let C = null;
266
+ client: x,
267
+ system: v,
268
+ entity: n,
269
+ urlTemplate: y,
270
+ urlParams: p,
271
+ options: h = {},
272
+ isSearchApi: b = !1,
273
+ field: m = "id",
274
+ silentConsoleError: c = !1
275
+ } = t;
276
+ let I = null;
272
277
  return {
273
- executeFetch: async (u, t = {}) => {
274
- C = new AbortController();
275
- const { urlTemplate: h, urlParams: g } = t;
278
+ executeFetch: async (K, P = {}) => {
279
+ I = new AbortController();
280
+ const { urlTemplate: T, urlParams: U } = P;
276
281
  try {
277
- const a = te(g) ? g : c, A = te(h) ? h : i;
278
- if (F(A)) throw new Error("Url template is undefined");
279
- const x = (F(a) ? A : me(A, a)) + Ft(u, m, l), o = await f().get(x, {
280
- ...s,
281
- signal: C.signal
282
+ const R = Tt(U) ? U : p, E = Tt(T) ? T : y;
283
+ if (pe(E)) throw new Error("Url template is undefined");
284
+ const Q = (pe(R) ? E : xn(E, R)) + $o(K, b, m), C = await x().get(Q, {
285
+ ...h,
286
+ signal: I.signal
282
287
  });
283
- if (!fe(o.status))
284
- throw new pe(o.status);
285
- if (o.data?.data)
286
- return o.data.data;
287
- if (o.status === ge)
288
+ if (!An(C.status))
289
+ throw new Sn(C.status);
290
+ if (C.data?.data)
291
+ return C.data.data;
292
+ if (C.status === Pn)
288
293
  return [];
289
- throw new ae();
290
- } catch (a) {
291
- if (a instanceof DOMException && a.name === "AbortError")
294
+ throw new Et();
295
+ } catch (R) {
296
+ if (R instanceof DOMException && R.name === "AbortError")
292
297
  return [];
293
- throw ve(a) ? a : be(a) ? new he(a, a.config?.url) : ye(a) ? new Ce(a, d, e, a) : Ae(a) ? new Pe(a, d, e, a) : we(a) ? new _e(a, a) : xe(a) ? new ke(a) : Ie.isAxiosError(a) ? (v || console.error("Axios error: " + i, ...a.cause ? [a.cause] : []), new Te(a)) : (v || console.error("AnzuFatalError: ", a), new ae(a));
298
+ throw In(R) ? R : Dn(R) ? new Tn(R, R.config?.url) : En(R) ? new $n(R, v, n, R) : Fn(R) ? new Bn(R, v, n, R) : Rn(R) ? new Kn(R, R) : Vn(R) ? new Ln(R) : ta.isAxiosError(R) ? (c || console.error("Axios error: " + y, ...R.cause ? [R.cause] : []), new Mn(R)) : (c || console.error("AnzuFatalError: ", R), new Et(R));
294
299
  } finally {
295
- C = null;
300
+ I = null;
296
301
  }
297
302
  },
298
303
  abortFetch: () => {
299
- C && C.abort();
304
+ I && I.abort();
300
305
  }
301
306
  };
302
- }, ca = (r) => {
307
+ }, pi = (t) => {
303
308
  const {
304
- client: f,
305
- system: d,
306
- entity: e,
307
- urlTemplate: i,
308
- urlParams: c,
309
- options: s = {},
310
- silentConsoleError: m = !1
311
- } = r;
312
- let l = null;
309
+ client: x,
310
+ system: v,
311
+ entity: n,
312
+ urlTemplate: y,
313
+ urlParams: p,
314
+ options: h = {},
315
+ silentConsoleError: b = !1
316
+ } = t;
317
+ let m = null;
313
318
  return {
314
- executeFetch: async (p, b, u = {}) => {
315
- l = new AbortController();
319
+ executeFetch: async (D, O, K = {}) => {
320
+ m = new AbortController();
316
321
  const {
317
- urlTemplate: t,
318
- urlParams: h,
319
- sortBy: g = "id",
320
- sortDesc: a = !0,
321
- batchSize: A = 100,
322
- forceElastic: x = !1
323
- } = u;
322
+ urlTemplate: P,
323
+ urlParams: T,
324
+ sortBy: U = "id",
325
+ sortDesc: R = !0,
326
+ batchSize: E = 100,
327
+ forceElastic: Q = !1
328
+ } = K;
324
329
  try {
325
- const o = b.general.elastic || x ? "/search" : "", $ = te(h) ? h : c, U = te(t) ? t : i;
326
- if (F(U)) throw new Error("Url template is undefined");
327
- const { pagination: n } = Se(g, a ? L.Desc : L.Asc, {
328
- rowsPerPage: A
329
- }), B = (F($) ? U : me(U, $)) + o, I = [], N = await f().get(
330
- B + oe(n, p, b),
330
+ const C = O.general.elastic || Q ? "/search" : "", W = Tt(T) ? T : p, V = Tt(P) ? P : y;
331
+ if (pe(V)) throw new Error("Url template is undefined");
332
+ const { pagination: S } = zn(U, R ? Ue.Desc : Ue.Asc, {
333
+ rowsPerPage: E
334
+ }), se = (pe(W) ? V : xn(V, W)) + C, Y = [], re = await x().get(
335
+ se + Yt(S, D, O),
331
336
  {
332
- ...s,
333
- signal: l.signal
337
+ ...h,
338
+ signal: m.signal
334
339
  }
335
340
  );
336
- if (!fe(N.status))
337
- throw new pe(N.status);
338
- if (N.data) {
339
- const E = N.data;
340
- if (I.push(...E.data), Le(E))
341
- for (n.value.hasNextPage = E.hasNextPage; n.value.hasNextPage; ) {
342
- n.value.page++;
343
- const K = (await f().get(
344
- B + oe(n, p, b),
341
+ if (!An(re.status))
342
+ throw new Sn(re.status);
343
+ if (re.data) {
344
+ const _ = re.data;
345
+ if (Y.push(..._.data), La(_))
346
+ for (S.value.hasNextPage = _.hasNextPage; S.value.hasNextPage; ) {
347
+ S.value.page++;
348
+ const $ = (await x().get(
349
+ se + Yt(S, D, O),
345
350
  {
346
- ...s,
347
- signal: l.signal
351
+ ...h,
352
+ signal: m.signal
348
353
  }
349
354
  )).data;
350
- I.push(...K.data), n.value.hasNextPage = K.hasNextPage;
355
+ Y.push(...$.data), S.value.hasNextPage = $.hasNextPage;
351
356
  }
352
- else if (Re(E)) {
353
- if (n.value.totalCount = E.totalCount, n.value.totalCount <= n.value.rowsPerPage)
354
- return I;
355
- const V = [], K = Math.ceil(n.value.totalCount / n.value.rowsPerPage);
356
- for (let D = 1; D < K; D++) {
357
- const H = { ...n.value, page: D + 1 }, W = q(H);
358
- V.push(
359
- f().get(B + oe(W, p, b), {
360
- ...s,
361
- signal: l.signal
357
+ else if (Ma(_)) {
358
+ if (S.value.totalCount = _.totalCount, S.value.totalCount <= S.value.rowsPerPage)
359
+ return Y;
360
+ const ne = [], $ = Math.ceil(S.value.totalCount / S.value.rowsPerPage);
361
+ for (let r = 1; r < $; r++) {
362
+ const A = { ...S.value, page: r + 1 }, F = fe(A);
363
+ ne.push(
364
+ x().get(se + Yt(F, D, O), {
365
+ ...h,
366
+ signal: m.signal
362
367
  })
363
368
  );
364
369
  }
365
- (await Promise.all(V)).forEach((D) => {
366
- I.push(...D.data.data);
370
+ (await Promise.all(ne)).forEach((r) => {
371
+ Y.push(...r.data.data);
367
372
  });
368
373
  }
369
- return I;
374
+ return Y;
370
375
  }
371
- if (N.status === ge)
376
+ if (re.status === Pn)
372
377
  return [];
373
- throw new ae();
374
- } catch (o) {
375
- if (o instanceof DOMException && o.name === "AbortError")
378
+ throw new Et();
379
+ } catch (C) {
380
+ if (C instanceof DOMException && C.name === "AbortError")
376
381
  return [];
377
- throw ve(o) ? o : be(o) ? new he(o, o.config?.url) : ye(o) ? new Ce(o, d, e, o) : Ae(o) ? new Pe(o, d, e, o) : we(o) ? new _e(o, o) : xe(o) ? new ke(o) : Ie.isAxiosError(o) ? (m || console.error("Axios error: " + i, ...o.cause ? [o.cause] : []), new Te(o)) : (m || console.error("AnzuFatalError: ", o), new ae(o));
382
+ throw In(C) ? C : Dn(C) ? new Tn(C, C.config?.url) : En(C) ? new $n(C, v, n, C) : Fn(C) ? new Bn(C, v, n, C) : Rn(C) ? new Kn(C, C) : Vn(C) ? new Ln(C) : ta.isAxiosError(C) ? (b || console.error("Axios error: " + y, ...C.cause ? [C.cause] : []), new Mn(C)) : (b || console.error("AnzuFatalError: ", C), new Et(C));
378
383
  } finally {
379
- l = null;
384
+ m = null;
380
385
  }
381
386
  },
382
387
  abortFetch: () => {
383
- l && l.abort();
388
+ m && m.abort();
384
389
  }
385
390
  };
386
- }, Z = "/adm/v1/job", ee = "job";
387
- function ua(r, f) {
391
+ }, St = "/adm/v1/job", Pt = "job";
392
+ function gi(t, x) {
388
393
  return {
389
- useFetchJobList: () => qe({ client: r, system: f, entity: ee, urlTemplate: Z }),
390
- fetchJob: (s) => Me(r, Z + "/:id", { id: s }, f, ee),
391
- createJob: (s) => {
392
- const m = $e(s._resourceName).slice(4).replace("-kind-", "-kind/");
393
- return Ue(r, s, Z + "/:type", { type: m }, f, ee);
394
+ useFetchJobList: () => ja({ client: t, system: x, entity: Pt, urlTemplate: St }),
395
+ fetchJob: (h) => Ua(t, St + "/:id", { id: h }, x, Pt),
396
+ createJob: (h) => {
397
+ const b = Na(h._resourceName).slice(4).replace("-kind-", "-kind/");
398
+ return Oa(t, h, St + "/:type", { type: b }, x, Pt);
394
399
  },
395
- deleteJob: (s) => ze(r, Z + "/:id", { id: s }, f, ee)
400
+ deleteJob: (h) => za(t, St + "/:id", { id: h }, x, Pt)
396
401
  };
397
402
  }
398
- const Et = {
403
+ const Fo = {
399
404
  key: "",
400
405
  title: void 0,
401
406
  sortable: !1,
402
407
  fixed: !1
403
- }, Bt = {
408
+ }, Bo = {
404
409
  storeColumnsLocalStorage: !0,
405
410
  disableActions: !1,
406
411
  customI18n: void 0,
407
412
  showExpand: !1
408
413
  };
409
- function Ot(r, f, d, e, i = {}) {
410
- const c = { ...Bt, ...i }, s = c.customI18n ?? Je, { t: m } = s.global || s;
411
- let l;
412
- Qe(c.storeColumnsLocalStorage) ? l = c.storeColumnsLocalStorage : Ye(c.storeColumnsLocalStorage) && c.storeColumnsLocalStorage === !0 && (l = "table_" + d + "_" + e);
413
- const v = r.map((u) => {
414
- const t = { ...Et, ...u };
415
- return F(t.title) && (F(t.title) && Ke.includes(t.key) ? t.title = m("common.model.tracking." + t.key) : F(t.title) && d && e ? t.title = m(d + "." + e + ".model." + t.key) : t.title = ""), t;
416
- }), C = w(() => {
417
- const u = [];
418
- return c.showExpand && u.push({ key: "data-table-expand", sortable: !1 }), v.forEach((t) => {
419
- f.value.includes(t.key) || u.push(t);
420
- }), c.disableActions || u.push({ key: "actions", sortable: !1, fixed: "end" }), u;
421
- }), p = () => {
422
- if (!l || !localStorage) return;
423
- const u = localStorage.getItem(l);
424
- if (!u) return;
425
- const t = JSON.parse(u);
426
- He(t) && We(t.hidden) && (f.value = t.hidden);
427
- }, b = (u) => {
428
- !l || !localStorage || localStorage.setItem(l, JSON.stringify({ hidden: u }));
414
+ function Ro(t, x, v, n, y = {}) {
415
+ const p = { ...Bo, ...y }, h = p.customI18n ?? qa, { t: b } = h.global || h;
416
+ let m;
417
+ Wa(p.storeColumnsLocalStorage) ? m = p.storeColumnsLocalStorage : Ya(p.storeColumnsLocalStorage) && p.storeColumnsLocalStorage === !0 && (m = "table_" + v + "_" + n);
418
+ const c = t.map((K) => {
419
+ const P = { ...Fo, ...K };
420
+ return pe(P.title) && (pe(P.title) && Ga.includes(P.key) ? P.title = b("common.model.tracking." + P.key) : pe(P.title) && v && n ? P.title = b(v + "." + n + ".model." + P.key) : P.title = ""), P;
421
+ }), I = k(() => {
422
+ const K = [];
423
+ return p.showExpand && K.push({ key: "data-table-expand", sortable: !1 }), c.forEach((P) => {
424
+ x.value.includes(P.key) || K.push(P);
425
+ }), p.disableActions || K.push({ key: "actions", sortable: !1, fixed: "end" }), K;
426
+ }), D = () => {
427
+ if (!m || !localStorage) return;
428
+ const K = localStorage.getItem(m);
429
+ if (!K) return;
430
+ const P = JSON.parse(K);
431
+ Ha(P) && Ja(P.hidden) && (x.value = P.hidden);
432
+ }, O = (K) => {
433
+ !m || !localStorage || localStorage.setItem(m, JSON.stringify({ hidden: K }));
429
434
  };
430
- return De(() => {
431
- p();
432
- }), G(f, (u) => {
433
- b(u);
435
+ return Qt(() => {
436
+ D();
437
+ }), Pe(x, (K) => {
438
+ O(K);
434
439
  }), {
435
- columnsAll: v,
436
- columnsVisible: C,
437
- columnsHidden: f
440
+ columnsAll: c,
441
+ columnsVisible: I,
442
+ columnsHidden: x
438
443
  };
439
444
  }
440
- function da(r, f, d, e, i, c, s, m = null, l = void 0, v = !1) {
441
- const C = q(!1), p = q([]), b = q([]), u = q(!1), { pagination: t, setSortBy: h, incrementPage: g } = Se(
442
- Q(m) ? null : m.key,
443
- m?.order
444
- ), { resetFilter: a, submitFilter: A } = Ge(c, s, {
445
+ function bi(t, x, v, n, y, p, h, b = null, m = void 0, c = !1) {
446
+ const I = fe(!1), D = fe([]), O = fe([]), K = fe(!1), { pagination: P, setSortBy: T, incrementPage: U } = zn(
447
+ ft(b) ? null : b.key,
448
+ b?.order
449
+ ), { resetFilter: R, submitFilter: E } = Xa(p, h, {
445
450
  storeFiltersLocalStorage: !1,
446
451
  populateUrlParams: !1
447
- }), { showErrorsDefault: x } = Xe(), { columnsVisible: o, columnsAll: $, columnsHidden: U } = Ot(
448
- r,
449
- f,
450
- d,
451
- e,
452
- { storeColumnsLocalStorage: !1, disableActions: !v }
453
- ), n = () => {
454
- N(), V();
455
- }, B = (O) => {
456
- h(O.sortBy), V();
457
- }, I = async () => {
458
- u.value = !0, g();
452
+ }), { showErrorsDefault: Q } = Nn(), { columnsVisible: C, columnsAll: W, columnsHidden: V } = Ro(
453
+ t,
454
+ x,
455
+ v,
456
+ n,
457
+ { storeColumnsLocalStorage: !1, disableActions: !c }
458
+ ), S = () => {
459
+ re(), ne();
460
+ }, se = (f) => {
461
+ T(f.sortBy), ne();
462
+ }, Y = async () => {
463
+ K.value = !0, U();
459
464
  try {
460
- const O = await i(t, c, s, l);
461
- p.value.push(...O);
462
- } catch (O) {
463
- x(O);
465
+ const f = await y(P, p, h, m);
466
+ D.value.push(...f);
467
+ } catch (f) {
468
+ Q(f);
464
469
  } finally {
465
- u.value = !1;
470
+ K.value = !1;
466
471
  }
467
- }, N = () => {
468
- p.value = [], b.value = [];
469
- }, E = async () => {
470
- u.value = !0;
472
+ }, re = () => {
473
+ D.value = [], O.value = [];
474
+ }, _ = async () => {
475
+ K.value = !0;
471
476
  try {
472
- p.value = await i(
473
- t,
474
- c,
475
- s,
476
- l
477
+ D.value = await y(
478
+ P,
479
+ p,
480
+ h,
481
+ m
477
482
  );
478
- } catch (O) {
479
- x(O);
483
+ } catch (f) {
484
+ Q(f);
480
485
  } finally {
481
- u.value = !1;
486
+ K.value = !1;
482
487
  }
483
- }, V = ut(async () => {
484
- await E();
488
+ }, ne = ho(async () => {
489
+ await _();
485
490
  });
486
491
  return {
487
- items: p,
488
- selected: b,
489
- pagination: t,
490
- columnsVisible: o,
491
- columnsHidden: U,
492
- columnsAll: $,
493
- filterTouched: C,
494
- loading: u,
495
- onRowClick: (O) => {
496
- const D = O.target;
497
- if (!D || D.tagName === "INPUT" && D.type === "checkbox")
492
+ items: D,
493
+ selected: O,
494
+ pagination: P,
495
+ columnsVisible: C,
496
+ columnsHidden: V,
497
+ columnsAll: W,
498
+ filterTouched: I,
499
+ loading: K,
500
+ onRowClick: (f) => {
501
+ const r = f.target;
502
+ if (!r || r.tagName === "INPUT" && r.type === "checkbox")
498
503
  return;
499
- const H = D.closest(".v-data-table__tr");
500
- if (!H || !H.classList.contains("v-data-table__tr")) return;
501
- const W = H.firstElementChild;
502
- if (!W || !W.classList.contains("v-data-table__td")) return;
503
- const le = W.querySelector("input");
504
- le && le.click();
504
+ const A = r.closest(".v-data-table__tr");
505
+ if (!A || !A.classList.contains("v-data-table__tr")) return;
506
+ const F = A.firstElementChild;
507
+ if (!F || !F.classList.contains("v-data-table__td")) return;
508
+ const j = F.querySelector("input");
509
+ j && j.click();
505
510
  },
506
- onFetchNextPage: I,
507
- onOpen: n,
508
- sortByChange: B,
509
- getList: V,
510
- resetFilter: () => a(t, V),
511
- submitFilter: () => A(t, V)
511
+ onFetchNextPage: Y,
512
+ onOpen: S,
513
+ sortByChange: se,
514
+ getList: ne,
515
+ resetFilter: () => R(P, ne),
516
+ submitFilter: () => E(P, ne)
512
517
  };
513
518
  }
514
- const Dt = { class: "d-flex flex-column w-100 px-1 align-center" }, It = { class: "d-flex justify-space-between w-100 align-center" }, Nt = { class: "d-flex align-center" }, Vt = { class: "d-flex align-center" }, jt = { class: "subject-select__sidebar system-border-r" }, Lt = { class: "subject-select-filter" }, Rt = { class: "subject-select__content" }, zt = {
519
+ const Ko = { class: "d-flex flex-column w-100 px-1 align-center" }, Vo = { class: "d-flex justify-space-between w-100 align-center" }, Lo = { class: "d-flex align-center" }, Mo = { class: "d-flex align-center" }, zo = { class: "subject-select__sidebar system-border-r" }, No = { class: "subject-select-filter" }, Oo = { class: "subject-select__content" }, Uo = {
515
520
  key: 0,
516
521
  class: "d-flex w-100 align-center justify-center pa-4"
517
- }, $t = { class: "subject-select__actions system-border-t" }, Ut = { key: 0 }, Mt = { key: 1 }, ma = /* @__PURE__ */ se({
522
+ }, jo = { class: "subject-select__actions system-border-t" }, qo = { key: 0 }, Go = { key: 1 }, ki = /* @__PURE__ */ He({
518
523
  __name: "ASubjectSelect",
519
524
  props: {
520
525
  selectedItems: {},
@@ -528,114 +533,114 @@ const Dt = { class: "d-flex flex-column w-100 px-1 align-center" }, It = { class
528
533
  autoOpen: { type: Boolean, default: !1 }
529
534
  },
530
535
  emits: ["update:modelValue", "update:pagination", "onOpen", "onPageChange", "onConfirm", "onFetchNextPage"],
531
- setup(r, { expose: f, emit: d }) {
532
- const e = r, i = d, c = q(!1), s = w({
536
+ setup(t, { expose: x, emit: v }) {
537
+ const n = t, y = v, p = fe(!1), h = k({
533
538
  get() {
534
- return F(e.modelValue) ? c.value : e.modelValue;
539
+ return pe(n.modelValue) ? p.value : n.modelValue;
535
540
  },
536
- set(n) {
537
- c.value = n, i("update:modelValue", n);
541
+ set(S) {
542
+ p.value = S, y("update:modelValue", S);
538
543
  }
539
- }), m = w({
540
- get: () => e.pagination,
541
- set: (n) => {
542
- i("update:pagination", { ...ce(n) });
544
+ }), b = k({
545
+ get: () => n.pagination,
546
+ set: (S) => {
547
+ y("update:pagination", { ...yn(S) });
543
548
  }
544
- }), { mdAndDown: l } = mt(), v = q(!l.value), C = () => {
545
- l.value && (v.value = !1);
549
+ }), { mdAndDown: m } = Zt(), c = fe(!m.value), I = () => {
550
+ m.value && (c.value = !1);
546
551
  };
547
- at(Ze, C);
548
- const { t: p } = re(), b = w(() => e.selectedItems.length), u = w(() => b.value < e.minCount || b.value > e.maxCount), t = () => {
549
- i("onOpen"), v.value = !l.value, s.value = !0;
550
- }, h = () => {
551
- v.value = !v.value;
552
- }, g = () => {
553
- s.value = !1;
554
- }, a = () => {
555
- i(
552
+ fo(Qa, I);
553
+ const { t: D } = Je(), O = k(() => n.selectedItems.length), K = k(() => O.value < n.minCount || O.value > n.maxCount), P = () => {
554
+ y("onOpen"), c.value = !m.value, h.value = !0;
555
+ }, T = () => {
556
+ c.value = !c.value;
557
+ }, U = () => {
558
+ h.value = !1;
559
+ }, R = () => {
560
+ y(
556
561
  "onConfirm",
557
- e.selectedItems.map((n) => ce(n))
558
- ), g();
559
- }, A = () => {
560
- i("onFetchNextPage");
561
- }, x = () => {
562
- i("onPageChange");
563
- }, o = w(() => Math.ceil(m.value.totalCount / m.value.rowsPerPage)), $ = w(() => !(Q(m.value.hasNextPage) && m.value.page === o.value || m.value.hasNextPage === !1)), U = (n) => {
564
- n && $.value && !e.loading && A();
562
+ n.selectedItems.map((S) => yn(S))
563
+ ), U();
564
+ }, E = () => {
565
+ y("onFetchNextPage");
566
+ }, Q = () => {
567
+ y("onPageChange");
568
+ }, C = k(() => Math.ceil(b.value.totalCount / b.value.rowsPerPage)), W = k(() => !(ft(b.value.hasNextPage) && b.value.page === C.value || b.value.hasNextPage === !1)), V = (S) => {
569
+ S && W.value && !n.loading && E();
565
570
  };
566
- return De(() => {
567
- e.autoOpen && t();
568
- }), f({
569
- open: t,
570
- closeSidebarOnMobile: C
571
- }), (n, B) => {
572
- const I = ue("ABtnSecondary"), N = ue("ABtnPrimary");
573
- return S(), R(ne, null, [
574
- j(n.$slots, "activator", {
575
- props: { onClick: J(() => t(), ["stop"]) }
571
+ return Qt(() => {
572
+ n.autoOpen && P();
573
+ }), x({
574
+ open: P,
575
+ closeSidebarOnMobile: I
576
+ }), (S, se) => {
577
+ const Y = hn("ABtnSecondary"), re = hn("ABtnPrimary");
578
+ return g(), M(be, null, [
579
+ L(S.$slots, "activator", {
580
+ props: { onClick: ae(() => P(), ["stop"]) }
576
581
  }),
577
- P(pt, ot(n.$attrs, {
578
- "model-value": s.value,
582
+ i(en, oe(S.$attrs, {
583
+ "model-value": h.value,
579
584
  fullscreen: "",
580
585
  class: "subject-select",
581
- "onUpdate:modelValue": B[1] || (B[1] = (E) => i("update:modelValue", E))
586
+ "onUpdate:modelValue": se[1] || (se[1] = (_) => y("update:modelValue", _))
582
587
  }), {
583
- default: T(() => [
584
- s.value ? (S(), Y(ft, {
588
+ default: s(() => [
589
+ h.value ? (g(), X(_t, {
585
590
  key: 0,
586
591
  class: "subject-select__card"
587
592
  }, {
588
- default: T(() => [
589
- P(et, {
593
+ default: s(() => [
594
+ i(Za, {
590
595
  class: "subject-select__toolbar system-border-b",
591
- onOnCancel: g
596
+ onOnCancel: U
592
597
  }, {
593
- default: T(() => [
594
- j(n.$slots, "title", {}, () => [
595
- z(_(y(p)(r.dialogTitleT)), 1)
598
+ default: s(() => [
599
+ L(S.$slots, "title", {}, () => [
600
+ J(B(d(D)(t.dialogTitleT)), 1)
596
601
  ])
597
602
  ]),
598
603
  _: 3
599
604
  }),
600
- P(bt, {
605
+ i(go, {
601
606
  density: "compact",
602
607
  color: "transparent",
603
608
  height: 46,
604
609
  elevation: "0",
605
610
  class: "system-border-b subject-select__second-bar"
606
611
  }, {
607
- default: T(() => [
608
- j(n.$slots, "second-bar", {}, () => [
609
- k("div", Dt, [
610
- k("div", It, [
611
- k("div", Nt, [
612
- P(M, {
612
+ default: s(() => [
613
+ L(S.$slots, "second-bar", {}, () => [
614
+ z("div", Ko, [
615
+ z("div", Vo, [
616
+ z("div", Lo, [
617
+ i(ee, {
613
618
  icon: "",
614
619
  width: 30,
615
620
  height: 30,
616
- onClick: h
621
+ onClick: T
617
622
  }, {
618
- default: T(() => [
619
- P(vt, {
623
+ default: s(() => [
624
+ i(te, {
620
625
  icon: "mdi-tune",
621
626
  size: 16
622
627
  }),
623
- P(ht, {
628
+ i(Se, {
624
629
  activator: "parent",
625
630
  location: "bottom"
626
631
  }, {
627
- default: T(() => [
628
- z(_(y(p)("common.subjectSelect.filter.toggle")), 1)
632
+ default: s(() => [
633
+ J(B(d(D)("common.subjectSelect.filter.toggle")), 1)
629
634
  ]),
630
635
  _: 1
631
636
  })
632
637
  ]),
633
638
  _: 1
634
639
  }),
635
- j(n.$slots, "second-bar-left")
640
+ L(S.$slots, "second-bar-left")
636
641
  ]),
637
- k("div", Vt, [
638
- j(n.$slots, "second-bar-right")
642
+ z("div", Mo, [
643
+ L(S.$slots, "second-bar-right")
639
644
  ])
640
645
  ])
641
646
  ])
@@ -643,62 +648,62 @@ const Dt = { class: "d-flex flex-column w-100 px-1 align-center" }, It = { class
643
648
  ]),
644
649
  _: 3
645
650
  }),
646
- k("div", {
647
- class: Be(["subject-select__main", { "subject-select__main--sidebar-active": v.value }])
651
+ z("div", {
652
+ class: xe(["subject-select__main", { "subject-select__main--sidebar-active": c.value }])
648
653
  }, [
649
- k("div", jt, [
650
- k("div", Lt, [
651
- j(n.$slots, "filter")
654
+ z("div", zo, [
655
+ z("div", No, [
656
+ L(S.$slots, "filter")
652
657
  ])
653
658
  ]),
654
- k("div", Rt, [
655
- j(n.$slots, "content"),
656
- r.paginationMode === "more" ? (S(), R("div", zt, [
657
- st((S(), Y(I, {
658
- loading: r.loading,
659
+ z("div", Oo, [
660
+ L(S.$slots, "content"),
661
+ t.paginationMode === "more" ? (g(), M("div", Uo, [
662
+ mo((g(), X(Y, {
663
+ loading: t.loading,
659
664
  size: "small",
660
- onClick: A
665
+ onClick: E
661
666
  }, {
662
- default: T(() => [
663
- j(n.$slots, "button-confirm-title", {}, () => [
664
- z(_(y(p)("common.button.loadMore")), 1)
667
+ default: s(() => [
668
+ L(S.$slots, "button-confirm-title", {}, () => [
669
+ J(B(d(D)("common.button.loadMore")), 1)
665
670
  ])
666
671
  ]),
667
672
  _: 3
668
673
  }, 8, ["loading"])), [
669
- [nt, $.value || r.loading],
674
+ [vo, W.value || t.loading],
670
675
  [
671
- yt,
672
- U,
676
+ bo,
677
+ V,
673
678
  void 0,
674
679
  { quiet: !0 }
675
680
  ]
676
681
  ])
677
- ])) : (S(), Y(St, {
682
+ ])) : (g(), X(Eo, {
678
683
  key: 1,
679
- modelValue: m.value,
680
- "onUpdate:modelValue": B[0] || (B[0] = (E) => m.value = E),
681
- onChange: x
684
+ modelValue: b.value,
685
+ "onUpdate:modelValue": se[0] || (se[0] = (_) => b.value = _),
686
+ onChange: Q
682
687
  }, null, 8, ["modelValue"]))
683
688
  ])
684
689
  ], 2),
685
- k("div", $t, [
686
- r.minCount === r.maxCount ? (S(), R("div", Ut, _(y(p)("common.subjectSelect.texts.pickExactCount", {
687
- count: r.minCount,
688
- selected: b.value
689
- })), 1)) : (S(), R("div", Mt, _(y(p)("common.subjectSelect.texts.pickRangeCount", {
690
- minCount: r.minCount,
691
- maxCount: r.maxCount,
692
- selected: b.value
690
+ z("div", jo, [
691
+ t.minCount === t.maxCount ? (g(), M("div", qo, B(d(D)("common.subjectSelect.texts.pickExactCount", {
692
+ count: t.minCount,
693
+ selected: O.value
694
+ })), 1)) : (g(), M("div", Go, B(d(D)("common.subjectSelect.texts.pickRangeCount", {
695
+ minCount: t.minCount,
696
+ maxCount: t.maxCount,
697
+ selected: O.value
693
698
  })), 1)),
694
- P(gt),
695
- P(N, {
696
- disabled: u.value,
697
- onClick: J(a, ["stop"])
699
+ i(tn),
700
+ i(re, {
701
+ disabled: K.value,
702
+ onClick: ae(R, ["stop"])
698
703
  }, {
699
- default: T(() => [
700
- j(n.$slots, "button-confirm-title", {}, () => [
701
- z(_(y(p)("common.button.confirm")), 1)
704
+ default: s(() => [
705
+ L(S.$slots, "button-confirm-title", {}, () => [
706
+ J(B(d(D)("common.button.confirm")), 1)
702
707
  ])
703
708
  ]),
704
709
  _: 3
@@ -706,53 +711,2796 @@ const Dt = { class: "d-flex flex-column w-100 px-1 align-center" }, It = { class
706
711
  ])
707
712
  ]),
708
713
  _: 3
709
- })) : Oe("", !0)
714
+ })) : G("", !0)
710
715
  ]),
711
716
  _: 3
712
717
  }, 16, ["model-value"])
713
718
  ], 64);
714
719
  };
715
720
  }
716
- });
721
+ }), Ho = {
722
+ key: 0,
723
+ class: "a-le-header"
724
+ }, Jo = {
725
+ key: 0,
726
+ class: "a-le-title-heading"
727
+ }, Wo = {
728
+ key: 1,
729
+ class: "a-le-state a-le-state--loading"
730
+ }, Yo = {
731
+ key: 2,
732
+ class: "a-le-state a-le-state--error"
733
+ }, Xo = {
734
+ key: 3,
735
+ class: "a-le-state a-le-state--empty"
736
+ }, Qo = ["data-id", "tabindex", "onKeydown"], Zo = ["onClick"], _o = { class: "a-le-row-main" }, el = { class: "a-le-title" }, tl = {
737
+ key: 0,
738
+ class: "a-le-status"
739
+ }, nl = {
740
+ key: 0,
741
+ class: "a-le-status-badge"
742
+ }, al = { class: "a-le-actions" }, ol = { class: "a-le-row-body" }, ll = { class: "a-le-form" }, il = {
743
+ key: 0,
744
+ class: "a-le-row-footer"
745
+ }, sl = {
746
+ key: 1,
747
+ class: "a-le-row-body"
748
+ }, rl = { class: "a-le-form" }, dl = {
749
+ class: "a-le-sr-only",
750
+ "aria-live": "polite",
751
+ role: "status"
752
+ }, wi = /* @__PURE__ */ He({
753
+ __name: "AListEditor",
754
+ props: /* @__PURE__ */ Ve({
755
+ keyField: { default: "id" },
756
+ positionField: { default: "position" },
757
+ positionMultiplier: { default: 1 },
758
+ updatePosition: { type: Boolean, default: !1 },
759
+ readonly: { type: Boolean, default: !1 },
760
+ disabled: { type: Boolean, default: !1 },
761
+ loading: { type: Boolean, default: !1 },
762
+ error: { default: null },
763
+ title: { default: null },
764
+ compactField: { default: null },
765
+ statusField: { default: null },
766
+ twoRows: { default: "never" },
767
+ chips: { type: Boolean, default: !1 },
768
+ showAddButton: { type: Boolean, default: !0 },
769
+ showDeleteButton: { type: Boolean, default: !0 },
770
+ showEditButton: { type: Boolean, default: !0 },
771
+ showAddAfterAction: { type: Boolean, default: !1 },
772
+ addLabel: { default: null },
773
+ emptyTitle: { default: null },
774
+ emptyText: { default: null },
775
+ disableRowClick: { type: Boolean, default: !1 },
776
+ disableDeleteConfirm: { type: Boolean, default: !1 },
777
+ deleteConfirmTitle: { default: null },
778
+ deleteConfirmText: { default: null },
779
+ closeVariant: { default: "auto" },
780
+ loadingKeys: { default: null },
781
+ getValidationState: { type: Function, default: void 0 },
782
+ onDeleteConfirm: { type: Function, default: void 0 },
783
+ onDelete: { type: Function, default: void 0 },
784
+ onItemSave: { type: Function, default: void 0 }
785
+ }, {
786
+ modelValue: { required: !0 },
787
+ modelModifiers: {},
788
+ unsavedKeys: {
789
+ default: () => /* @__PURE__ */ new Set()
790
+ },
791
+ unsavedKeysModifiers: {}
792
+ }),
793
+ emits: /* @__PURE__ */ Ve(["add", "edit", "deleted", "close", "item-saved", "item-expand"], ["update:modelValue", "update:unsavedKeys"]),
794
+ setup(t, { expose: x, emit: v }) {
795
+ const n = t, y = v, p = Ge(t, "modelValue"), { t: h } = Je(), b = Zn(), m = Zt(), c = $t("rootEl"), I = k(() => m.platform.value.touch), D = _a(p, {
796
+ keyField: n.keyField,
797
+ positionField: n.positionField,
798
+ positionMultiplier: n.positionMultiplier,
799
+ updatePosition: n.updatePosition
800
+ }), O = fe(/* @__PURE__ */ new Set()), K = $t("rowsContainer"), P = k(() => !n.chips && !!b.item), T = k(() => !n.chips && !!b["item-readonly"]), { captureDirtyBaseline: U, rebaselineKey: R, isItemDirty: E } = On(
801
+ () => p.value.map((o) => ({
802
+ key: o[n.keyField],
803
+ data: o
804
+ }))
805
+ ), {
806
+ editingKeys: Q,
807
+ editingSnapshots: C,
808
+ beginEdit: W,
809
+ cancelEdit: V,
810
+ commitEdit: S,
811
+ closeEdit: se,
812
+ requestAutoOpen: Y
813
+ } = Un({
814
+ rowsContainer: K,
815
+ rowSelector: ".a-le-row",
816
+ isInlineEdit: P,
817
+ restoreSnapshot: (o, N) => D.updateItem(o, N),
818
+ watchKeys: () => p.value.map((o) => o[n.keyField]),
819
+ findEntry: (o) => {
820
+ const N = p.value.find((u) => u[n.keyField] === o);
821
+ return N ? { data: N } : null;
822
+ },
823
+ afterAutoOpen: (o) => {
824
+ O.value.delete(o);
825
+ }
826
+ }), re = k(() => n.addLabel ?? h("common.sortable.add")), _ = k(() => n.emptyTitle ?? h("common.sortable.emptyTitle")), ne = k(() => n.emptyText ?? h("common.sortable.emptyText")), $ = k(
827
+ () => n.deleteConfirmTitle ?? h("common.sortable.deleteConfirmTitle")
828
+ ), f = k(
829
+ () => n.deleteConfirmText ?? h("common.sortable.deleteConfirmText")
830
+ ), r = k(() => !n.readonly && !n.disabled && !n.loading), A = k(() => r.value && n.showAddButton), F = k(() => !!(n.title || b.header)), j = k(() => !!n.onItemSave), H = k(() => {
831
+ const o = /* @__PURE__ */ new Set();
832
+ for (const N of p.value) {
833
+ const u = N[n.keyField];
834
+ E(u, N) && o.add(u);
835
+ }
836
+ return o;
837
+ }), le = /* @__PURE__ */ new Map(), q = k(() => {
838
+ const o = [], N = /* @__PURE__ */ new Set();
839
+ for (const u of D.viewItems.value) {
840
+ N.add(u.key);
841
+ const ie = Q.value.has(u.key), kt = O.value.has(u.key), tt = n.loadingKeys?.has(u.key) ?? !1, nt = H.value.has(u.key), Te = le.get(u.key);
842
+ if (Te && Te.raw === u.raw && Te.index === u.index && Te.position === u.position && Te.editing === ie && Te.expanded === kt && Te.loading === tt && Te.dirty === nt) {
843
+ o.push(Te);
844
+ continue;
845
+ }
846
+ const ze = {
847
+ ...u,
848
+ editing: ie,
849
+ expanded: kt,
850
+ loading: tt,
851
+ dirty: nt
852
+ };
853
+ le.set(u.key, ze), o.push(ze);
854
+ }
855
+ for (const u of le.keys())
856
+ N.has(u) || le.delete(u);
857
+ return o;
858
+ }), ce = k(() => q.value.length === 0), de = (o) => q.value.find((N) => N.key === o), ve = jn({
859
+ viewItems: k(() => q.value.map((o) => ({ key: o.key }))),
860
+ variant: "flat",
861
+ isReorderMode: fe(!1),
862
+ disabled: k(() => !r.value),
863
+ isEditing: (o) => Q.value.has(o),
864
+ onToggleEdit: (o) => {
865
+ const N = de(o);
866
+ N && we(N);
867
+ },
868
+ onCancelEdit: (o) => {
869
+ const N = de(o);
870
+ N && et(N);
871
+ }
872
+ }), Le = (o, N) => Xn(o, N, {
873
+ compactField: n.compactField,
874
+ fallback: h("common.sortable.itemFallback")
875
+ }), { resolveValidation: $e } = qn({
876
+ getValidationState: (o, N, u) => n.getValidationState?.(o, N, u) ?? null
877
+ }), ke = () => {
878
+ A.value && (Y(), y("add", void 0));
879
+ }, ye = (o) => {
880
+ r.value && (Y(), y("add", { afterId: o.key }));
881
+ }, we = (o) => {
882
+ if (r.value) {
883
+ if (Q.value.has(o.key)) {
884
+ et(o);
885
+ return;
886
+ }
887
+ P.value && (W(o), O.value.delete(o.key)), y("edit", o);
888
+ }
889
+ }, Fe = (o) => {
890
+ if (n.disabled || n.loading) return;
891
+ const N = o.key, u = O.value.has(N);
892
+ if (u)
893
+ O.value.delete(N);
894
+ else {
895
+ for (const ie of O.value) O.value.delete(ie);
896
+ O.value.add(N);
897
+ }
898
+ y("item-expand", o, !u);
899
+ }, Be = (o) => n.chips || n.disableRowClick || n.disabled || n.loading ? !1 : !!(o.editing || o.expanded || !n.readonly && n.showEditButton || n.readonly && T.value), yt = (o) => {
900
+ if (Be(o)) {
901
+ if (o.editing || o.expanded) {
902
+ et(o);
903
+ return;
904
+ }
905
+ n.readonly && T.value ? Fe(o) : we(o);
906
+ }
907
+ }, {
908
+ deleteDialog: ge,
909
+ deleteInFlight: Ze,
910
+ deleteError: We,
911
+ onDeleteClick: ot,
912
+ onDeleteDialogConfirm: lt,
913
+ onDeleteDialogCancel: Ie
914
+ } = Gn({
915
+ onDeleteConfirm: (o) => n.onDeleteConfirm ? n.onDeleteConfirm(o) : !0,
916
+ onDelete: (o) => n.onDelete?.(o),
917
+ onDeleted: (o) => {
918
+ D.deleteItem(o.key), Q.value.delete(o.key), C.value.delete(o.key), O.value.delete(o.key), y("deleted", o);
919
+ },
920
+ disableDeleteConfirm: () => n.disableDeleteConfirm || n.chips
921
+ }), _e = async (o) => {
922
+ r.value && await ot(o);
923
+ }, ht = async (o) => {
924
+ n.onItemSave && await n.onItemSave(o.raw), S(o), y("item-saved", o);
925
+ }, pt = (o) => {
926
+ V(o);
927
+ }, et = (o) => {
928
+ se(o), O.value.delete(o.key), y("close", o);
929
+ }, Ye = /* @__PURE__ */ new Map(), gt = (o) => {
930
+ let N = Ye.get(o);
931
+ return N || (N = {
932
+ edit: () => {
933
+ const u = de(o);
934
+ u && we(u);
935
+ },
936
+ save: () => {
937
+ const u = de(o);
938
+ if (u) return ht(u);
939
+ },
940
+ cancel: () => {
941
+ const u = de(o);
942
+ u && pt(u);
943
+ },
944
+ close: () => {
945
+ const u = de(o);
946
+ u && et(u);
947
+ },
948
+ delete: async () => {
949
+ const u = de(o);
950
+ u && await _e(u);
951
+ },
952
+ addAfter: () => {
953
+ const u = de(o);
954
+ u && ye(u);
955
+ },
956
+ toggleExpand: () => {
957
+ const u = de(o);
958
+ u && Fe(u);
959
+ },
960
+ update: (u) => D.updateItem(o, u)
961
+ }, Ye.set(o, N)), N;
962
+ };
963
+ Pe(
964
+ () => q.value,
965
+ (o) => {
966
+ if (Ye.size === 0) return;
967
+ const N = new Set(o.map((u) => u.key));
968
+ for (const u of Ye.keys())
969
+ N.has(u) || Ye.delete(u);
970
+ }
971
+ );
972
+ const De = (o) => ({
973
+ item: { ...o, validationState: $e(o.raw, o.key, o.index) },
974
+ raw: o.raw,
975
+ index: o.index,
976
+ key: o.key,
977
+ readonly: n.readonly,
978
+ disabled: n.disabled,
979
+ expanded: o.expanded,
980
+ editing: o.editing,
981
+ dirty: o.dirty,
982
+ unsaved: o.dirty,
983
+ touch: I.value,
984
+ actions: gt(o.key)
985
+ }), Me = Ge(t, "unsavedKeys"), Xe = k(() => {
986
+ const o = /* @__PURE__ */ new Set();
987
+ for (const N of q.value)
988
+ N.dirty && o.add(N.key);
989
+ return o;
990
+ }), { hasUnsavedChanges: it, unsavedCount: bt, clearUnsavedState: Rt } = Hn({
991
+ unsavedKeysModel: Me,
992
+ internalUnsavedKeys: Xe,
993
+ onClearAll: () => U(),
994
+ onClearKey: (o) => R(o)
995
+ });
996
+ return x({
997
+ addItem: D.addItem,
998
+ deleteItem: D.deleteItem,
999
+ updateItem: D.updateItem,
1000
+ moveItem: D.moveItem,
1001
+ recalculatePositions: D.recalculatePositions,
1002
+ viewItems: D.viewItems,
1003
+ resetDirtyBaseline: U,
1004
+ hasUnsavedChanges: it,
1005
+ unsavedCount: bt,
1006
+ clearUnsavedState: Rt
1007
+ }), (o, N) => (g(), M("div", {
1008
+ ref_key: "rootEl",
1009
+ ref: c,
1010
+ class: xe(["a-list-editor", [
1011
+ `a-list-editor--two-rows-${t.twoRows}`,
1012
+ {
1013
+ "a-list-editor--readonly": t.readonly,
1014
+ "a-list-editor--disabled": t.disabled,
1015
+ "a-list-editor--touch": I.value,
1016
+ "a-list-editor--chips": t.chips
1017
+ }
1018
+ ]])
1019
+ }, [
1020
+ z("div", {
1021
+ ref_key: "rowsContainer",
1022
+ ref: K,
1023
+ class: "a-le-card"
1024
+ }, [
1025
+ F.value ? (g(), M("div", Ho, [
1026
+ L(o.$slots, "header", { title: t.title }, () => [
1027
+ t.title ? (g(), M("h3", Jo, B(t.title), 1)) : G("", !0)
1028
+ ])
1029
+ ])) : G("", !0),
1030
+ t.loading ? (g(), M("div", Wo, [
1031
+ i(oa, {
1032
+ indeterminate: "",
1033
+ color: "primary",
1034
+ size: "32"
1035
+ })
1036
+ ])) : t.error ? (g(), M("div", Yo, [
1037
+ i(nn, {
1038
+ type: "error",
1039
+ variant: "tonal",
1040
+ density: "compact",
1041
+ border: "start"
1042
+ }, {
1043
+ default: s(() => [
1044
+ J(B(t.error), 1)
1045
+ ]),
1046
+ _: 1
1047
+ })
1048
+ ])) : ce.value ? (g(), M("div", Xo, [
1049
+ L(o.$slots, "empty", {
1050
+ readonly: t.readonly,
1051
+ disabled: t.disabled,
1052
+ actions: { add: ke }
1053
+ }, () => [
1054
+ i(Jn, {
1055
+ title: _.value,
1056
+ text: ne.value,
1057
+ "add-label": re.value,
1058
+ "can-add": A.value,
1059
+ onAdd: ke
1060
+ }, null, 8, ["title", "text", "add-label", "can-add"])
1061
+ ])
1062
+ ])) : (g(!0), M(be, { key: 4 }, at(q.value, (u) => (g(), M("div", {
1063
+ key: String(u.key),
1064
+ "data-id": String(u.key),
1065
+ role: "listitem",
1066
+ tabindex: d(ve).rowTabindex(u.key),
1067
+ class: xe(["a-le-row", {
1068
+ "a-le-row--two-rows": t.twoRows === "always",
1069
+ "a-le-row--editing": u.editing,
1070
+ "a-le-row--expanded": u.expanded,
1071
+ "a-le-row--unsaved": u.dirty,
1072
+ "a-le-row--clickable": Be(u),
1073
+ [`a-le-row--validation-${d($e)(u.raw, u.key, u.index)}`]: d($e)(u.raw, u.key, u.index) !== null
1074
+ }]),
1075
+ onKeydown: (ie) => d(ve).handleKeydown(u.key, ie)
1076
+ }, [
1077
+ L(o.$slots, "before-item", oe({ ref_for: !0 }, De(u))),
1078
+ z("div", {
1079
+ class: "a-le-row-header",
1080
+ onClick: (ie) => yt(u)
1081
+ }, [
1082
+ z("div", _o, [
1083
+ L(o.$slots, "item-compact", oe({ ref_for: !0 }, De(u)), () => [
1084
+ z("span", el, B(Le(u.raw, u.key)), 1)
1085
+ ]),
1086
+ u.dirty ? (g(), X(Wn, { key: 0 })) : G("", !0)
1087
+ ]),
1088
+ t.chips ? G("", !0) : (g(), M("div", tl, [
1089
+ L(o.$slots, "item-status", oe({ ref_for: !0 }, De(u)), () => [
1090
+ t.statusField && u.raw[t.statusField] != null && u.raw[t.statusField] !== "" ? (g(), M("span", nl, B(u.raw[t.statusField]), 1)) : G("", !0)
1091
+ ])
1092
+ ])),
1093
+ z("div", al, [
1094
+ L(o.$slots, "item-actions", oe({ ref_for: !0 }, De(u)), () => [
1095
+ t.chips && t.showDeleteButton && r.value ? (g(), X(ee, {
1096
+ key: 0,
1097
+ icon: "",
1098
+ size: "x-small",
1099
+ variant: "text",
1100
+ density: "compact",
1101
+ active: !1,
1102
+ class: "a-le-action a-le-action--chip-close",
1103
+ onClick: ae((ie) => _e(u), ["stop"])
1104
+ }, {
1105
+ default: s(() => [
1106
+ i(te, {
1107
+ icon: "mdi-close",
1108
+ size: "14"
1109
+ })
1110
+ ]),
1111
+ _: 1
1112
+ }, 8, ["onClick"])) : (g(), M(be, { key: 1 }, [
1113
+ t.showEditButton && r.value ? (g(), X(ee, {
1114
+ key: 0,
1115
+ icon: "",
1116
+ size: "small",
1117
+ variant: "tonal",
1118
+ color: "primary",
1119
+ density: "comfortable",
1120
+ class: "mx-1 a-le-action a-le-action--edit",
1121
+ onClick: ae((ie) => we(u), ["stop"])
1122
+ }, {
1123
+ default: s(() => [
1124
+ i(te, {
1125
+ icon: "mdi-pencil-outline",
1126
+ size: "18"
1127
+ }),
1128
+ i(Se, {
1129
+ activator: "parent",
1130
+ location: "bottom",
1131
+ text: d(h)("common.sortable.edit")
1132
+ }, null, 8, ["text"])
1133
+ ]),
1134
+ _: 1
1135
+ }, 8, ["onClick"])) : G("", !0),
1136
+ t.showDeleteButton && r.value ? (g(), X(ee, {
1137
+ key: 1,
1138
+ icon: "",
1139
+ size: "small",
1140
+ variant: "text",
1141
+ density: "comfortable",
1142
+ class: "mx-1 a-le-action a-le-action--delete",
1143
+ onClick: ae((ie) => _e(u), ["stop"])
1144
+ }, {
1145
+ default: s(() => [
1146
+ i(te, {
1147
+ icon: "mdi-trash-can-outline",
1148
+ size: "18"
1149
+ }),
1150
+ i(Se, {
1151
+ activator: "parent",
1152
+ location: "bottom",
1153
+ text: d(h)("common.sortable.delete")
1154
+ }, null, 8, ["text"])
1155
+ ]),
1156
+ _: 1
1157
+ }, 8, ["onClick"])) : G("", !0),
1158
+ t.showAddAfterAction && r.value ? (g(), X(ee, {
1159
+ key: 2,
1160
+ icon: "",
1161
+ size: "small",
1162
+ variant: "text",
1163
+ density: "comfortable",
1164
+ active: !1,
1165
+ class: "mx-1 a-le-action a-le-action--menu"
1166
+ }, {
1167
+ default: s(() => [
1168
+ i(te, {
1169
+ icon: "mdi-dots-vertical",
1170
+ size: "18"
1171
+ }),
1172
+ i(Se, {
1173
+ activator: "parent",
1174
+ location: "bottom",
1175
+ text: d(h)("common.sortable.more")
1176
+ }, null, 8, ["text"]),
1177
+ i(Ft, { activator: "parent" }, {
1178
+ default: s(() => [
1179
+ i(vt, { density: "compact" }, {
1180
+ default: s(() => [
1181
+ i(Ae, {
1182
+ onClick: ae((ie) => ye(u), ["stop"])
1183
+ }, {
1184
+ prepend: s(() => [
1185
+ i(te, { icon: "mdi-plus" })
1186
+ ]),
1187
+ default: s(() => [
1188
+ i(Ee, null, {
1189
+ default: s(() => [
1190
+ J(B(d(h)("common.sortable.addAfter")), 1)
1191
+ ]),
1192
+ _: 1
1193
+ })
1194
+ ]),
1195
+ _: 1
1196
+ }, 8, ["onClick"])
1197
+ ]),
1198
+ _: 2
1199
+ }, 1024)
1200
+ ]),
1201
+ _: 2
1202
+ }, 1024)
1203
+ ]),
1204
+ _: 2
1205
+ }, 1024)) : G("", !0)
1206
+ ], 64))
1207
+ ])
1208
+ ])
1209
+ ], 8, Zo),
1210
+ u.editing && o.$slots.item ? (g(), M(be, { key: 0 }, [
1211
+ z("div", ol, [
1212
+ z("div", ll, [
1213
+ L(o.$slots, "item", oe({ ref_for: !0 }, De(u)))
1214
+ ])
1215
+ ]),
1216
+ L(o.$slots, "item-footer", oe({ ref_for: !0 }, De(u)), () => [
1217
+ j.value ? (g(), M("div", il, [
1218
+ N[1] || (N[1] = z("div", { class: "a-le-row-footer-spacer" }, null, -1)),
1219
+ i(ee, {
1220
+ variant: "text",
1221
+ disabled: u.loading,
1222
+ onClick: ae((ie) => pt(u), ["stop"])
1223
+ }, {
1224
+ default: s(() => [
1225
+ J(B(d(h)("common.button.cancel")), 1)
1226
+ ]),
1227
+ _: 1
1228
+ }, 8, ["disabled", "onClick"]),
1229
+ i(ee, {
1230
+ color: "primary",
1231
+ variant: "flat",
1232
+ "prepend-icon": "mdi-check",
1233
+ disabled: u.loading,
1234
+ onClick: ae((ie) => ht(u), ["stop"])
1235
+ }, {
1236
+ default: s(() => [
1237
+ J(B(d(h)("common.button.save")), 1)
1238
+ ]),
1239
+ _: 1
1240
+ }, 8, ["disabled", "onClick"])
1241
+ ])) : G("", !0)
1242
+ ])
1243
+ ], 64)) : u.expanded && o.$slots["item-readonly"] ? (g(), M("div", sl, [
1244
+ z("div", rl, [
1245
+ L(o.$slots, "item-readonly", oe({ ref_for: !0 }, De(u)))
1246
+ ])
1247
+ ])) : G("", !0),
1248
+ L(o.$slots, "after-item", oe({ ref_for: !0 }, De(u)))
1249
+ ], 42, Qo))), 128)),
1250
+ A.value && !t.loading && !t.error && !ce.value ? L(o.$slots, "add-button", {
1251
+ key: 5,
1252
+ readonly: t.readonly,
1253
+ disabled: t.disabled,
1254
+ props: { onClick: ke },
1255
+ actions: { add: ke }
1256
+ }, () => [
1257
+ z("button", {
1258
+ type: "button",
1259
+ class: "a-le-row-add",
1260
+ onClick: ke
1261
+ }, [
1262
+ i(te, {
1263
+ icon: "mdi-plus",
1264
+ size: "18"
1265
+ }),
1266
+ z("span", null, B(re.value), 1)
1267
+ ])
1268
+ ]) : G("", !0)
1269
+ ], 512),
1270
+ i(Yn, {
1271
+ modelValue: d(ge),
1272
+ "onUpdate:modelValue": N[0] || (N[0] = (u) => _n(ge) ? ge.value = u : null),
1273
+ title: $.value,
1274
+ text: f.value,
1275
+ "confirm-label": d(h)("common.sortable.delete"),
1276
+ "cancel-label": d(h)("common.button.cancel"),
1277
+ error: d(We),
1278
+ "in-flight": d(Ze),
1279
+ onConfirm: d(lt),
1280
+ onCancel: d(Ie)
1281
+ }, null, 8, ["modelValue", "title", "text", "confirm-label", "cancel-label", "error", "in-flight", "onConfirm", "onCancel"]),
1282
+ z("div", dl, B(d(ve).grabbedKey.value !== null ? d(h)("common.sortable.keyboardGrab.status", {
1283
+ n: d(ve).grabbedIndex.value + 1,
1284
+ total: d(ve).totalCount.value
1285
+ }) : ""), 1)
1286
+ ], 2));
1287
+ }
1288
+ }), cl = "id", ul = "position", fl = "parent";
1289
+ function ml(t, x) {
1290
+ const v = x.keyField ?? cl, n = x.positionField ?? ul, y = x.parentField ?? fl, p = x.positionMultiplier ?? 1, h = x.maxDepth, b = ($) => $[v], m = ($) => {
1291
+ if (!$.children || $.children.length === 0) return 1;
1292
+ let f = 0;
1293
+ for (const r of $.children) {
1294
+ const A = m(r);
1295
+ A > f && (f = A);
1296
+ }
1297
+ return f + 1;
1298
+ }, c = ($, f = t.value.children, r = null) => {
1299
+ for (const A of f) {
1300
+ if (b(A.data) === $) return { node: A, parent: r };
1301
+ if (A.children && A.children.length > 0) {
1302
+ const F = c($, A.children, A);
1303
+ if (F.node) return F;
1304
+ }
1305
+ }
1306
+ return { node: null, parent: null };
1307
+ }, I = ($) => {
1308
+ let f = 1 * p;
1309
+ for (const r of $)
1310
+ r.data[n] !== f && (r.data[n] = f), f += p;
1311
+ }, D = ($) => {
1312
+ const f = (r) => {
1313
+ I(r);
1314
+ for (const A of r) A.children && A.children.length && f(A.children);
1315
+ };
1316
+ f($.children);
1317
+ }, O = ($) => {
1318
+ const f = Ce($);
1319
+ return D(f), f;
1320
+ }, K = ($) => {
1321
+ const f = [], r = x.expandedKeys?.value;
1322
+ let A = 0;
1323
+ const F = (j, H, le) => {
1324
+ for (let q = 0; q < j.length; q++) {
1325
+ const ce = j[q], de = b(ce.data), ve = !pe(ce.children), Le = ve && (ce.children?.length ?? 0) > 0, $e = ce.children?.length ?? 0, ke = r ? r.has(de) : !0, ye = h - (H + 1), we = ve && ye > 0, Fe = H > 0, Be = q > 0;
1326
+ f.push({
1327
+ key: de,
1328
+ index: A++,
1329
+ raw: ce.data,
1330
+ position: ce.data[n],
1331
+ node: ce,
1332
+ depth: H,
1333
+ parent: le?.data ?? null,
1334
+ parentKey: le ? b(le.data) : null,
1335
+ childrenCount: $e,
1336
+ hasChildren: Le,
1337
+ childrenAllowed: ve,
1338
+ siblingIndex: q,
1339
+ siblingCount: j.length,
1340
+ firstInParent: q === 0,
1341
+ lastInParent: q === j.length - 1,
1342
+ canAddChild: we,
1343
+ canIndent: Be,
1344
+ canOutdent: Fe
1345
+ }), Le && ke && F(ce.children, H + 1, ce);
1346
+ }
1347
+ };
1348
+ return F($.children, 0, null), f;
1349
+ }, P = k(() => K(t.value)), T = ($, f, r) => {
1350
+ $.splice(f + 1, 0, r);
1351
+ }, U = ($, f) => {
1352
+ if (!f) return $.length;
1353
+ if (f.afterId !== void 0) {
1354
+ const r = $.findIndex((A) => b(A.data) === f.afterId);
1355
+ return r === -1 ? $.length : r + 1;
1356
+ }
1357
+ return f.afterIndex !== void 0 ? f.afterIndex < 0 ? $.length : Math.min(f.afterIndex + 1, $.length) : f.index !== void 0 ? Math.max(0, Math.min(f.index, $.length)) : $.length;
1358
+ }, R = ($, f) => {
1359
+ const r = Ce(t.value), A = f?.childrenAllowed ?? !0, F = {
1360
+ data: Ce($),
1361
+ children: A ? [] : void 0,
1362
+ meta: { dirty: !1 }
1363
+ };
1364
+ let j = r.children, H = null;
1365
+ if (f?.parentId !== void 0 && f.parentId !== null) {
1366
+ const { node: q } = c(f.parentId, r.children);
1367
+ q && q.children && (j = q.children, H = q);
1368
+ }
1369
+ if (f?.afterId !== void 0) {
1370
+ const { node: q, parent: ce } = c(f.afterId, r.children);
1371
+ if (q) {
1372
+ const de = ce ? ce.children : r.children, ve = de.indexOf(q);
1373
+ if (ve !== -1)
1374
+ return T(de, ve, F), F.data[y] = ce ? b(ce.data) : null, I(de), t.value = r, r;
1375
+ }
1376
+ }
1377
+ const le = f?.asFirstChild ? 0 : U(j, f);
1378
+ return j.splice(le, 0, F), F.data[y] = H ? b(H.data) : null, I(j), t.value = r, r;
1379
+ }, E = ($) => {
1380
+ const f = Ce(t.value), { node: r, parent: A } = c($, f.children);
1381
+ if (!r) return f;
1382
+ const F = A ? A.children : f.children, j = F.indexOf(r);
1383
+ return j === -1 || (F.splice(j, 1), I(F), t.value = f), f;
1384
+ }, Q = ($, f) => {
1385
+ const r = Ce(t.value), { node: A } = c($, r.children);
1386
+ return A && (A.data = Ce(f), t.value = r), r;
1387
+ }, C = ($, f, r) => {
1388
+ const { node: A, parent: F } = c(f, $.children);
1389
+ if (!A) return null;
1390
+ const j = F ? F.children : $.children, H = j.indexOf(A);
1391
+ if (H === -1) return null;
1392
+ const le = r(j, H);
1393
+ if (le === null || le === H) return null;
1394
+ const [q] = j.splice(H, 1);
1395
+ return j.splice(le, 0, q), I(j), $;
1396
+ }, W = ($) => {
1397
+ const f = Ce(t.value), r = C(f, $, (A, F) => F > 0 ? F - 1 : null);
1398
+ return r && (t.value = r), r;
1399
+ }, V = ($) => {
1400
+ const f = Ce(t.value), r = C(f, $, (A, F) => F < A.length - 1 ? F + 1 : null);
1401
+ return r && (t.value = r), r;
1402
+ }, S = ($) => {
1403
+ const f = Ce(t.value), r = C(f, $, (A, F) => F > 0 ? 0 : null);
1404
+ return r && (t.value = r), r;
1405
+ }, se = ($) => {
1406
+ const f = Ce(t.value), r = C(f, $, (A, F) => F < A.length - 1 ? A.length - 1 : null);
1407
+ return r && (t.value = r), r;
1408
+ }, Y = ($) => {
1409
+ const f = Ce(t.value), { node: r, parent: A } = c($, f.children);
1410
+ if (!r) return null;
1411
+ const F = A ? A.children : f.children, j = F.indexOf(r);
1412
+ if (j <= 0) return null;
1413
+ const H = F[j - 1];
1414
+ if (pe(H.children)) return null;
1415
+ const le = m(r);
1416
+ return _(f, b(H.data)) + 1 + le > h ? null : (F.splice(j, 1), H.children.push(r), r.data[y] = b(H.data), I(F), I(H.children), t.value = f, f);
1417
+ }, re = ($) => {
1418
+ const f = Ce(t.value), { node: r, parent: A } = c($, f.children);
1419
+ if (!r || !A) return null;
1420
+ const { parent: F } = c(b(A.data), f.children), j = F ? F.children : f.children, H = j.indexOf(A);
1421
+ if (H === -1) return null;
1422
+ const le = A.children, q = le.indexOf(r);
1423
+ return q === -1 ? null : (le.splice(q, 1), j.splice(H + 1, 0, r), r.data[y] = F ? b(F.data) : null, I(le), I(j), t.value = f, f);
1424
+ }, _ = ($, f) => {
1425
+ const r = (A, F) => {
1426
+ for (const j of A) {
1427
+ if (b(j.data) === f) return F;
1428
+ if (j.children && j.children.length) {
1429
+ const H = r(j.children, F + 1);
1430
+ if (H !== null) return H;
1431
+ }
1432
+ }
1433
+ return null;
1434
+ };
1435
+ return r($.children, 0) ?? 0;
1436
+ };
1437
+ return {
1438
+ viewItems: P,
1439
+ findNode: c,
1440
+ addItem: R,
1441
+ deleteItem: E,
1442
+ updateItem: Q,
1443
+ moveUp: W,
1444
+ moveDown: V,
1445
+ moveTop: S,
1446
+ moveBottom: se,
1447
+ indent: Y,
1448
+ outdent: re,
1449
+ moveTo: ($, f, r) => {
1450
+ const A = Ce(t.value), { node: F, parent: j } = c($, A.children);
1451
+ if (!F) return null;
1452
+ if (f !== null) {
1453
+ const ye = (we) => {
1454
+ if (!we.children) return !1;
1455
+ for (const Fe of we.children)
1456
+ if (b(Fe.data) === f || ye(Fe)) return !0;
1457
+ return !1;
1458
+ };
1459
+ if (b(F.data) === f || ye(F)) return null;
1460
+ }
1461
+ let H, le = null, q = 0;
1462
+ if (f === null)
1463
+ H = A.children, q = 0;
1464
+ else {
1465
+ const { node: ye } = c(f, A.children);
1466
+ if (!ye || pe(ye.children)) return null;
1467
+ H = ye.children, le = ye, q = _(A, f) + 1;
1468
+ }
1469
+ const ce = m(F);
1470
+ if (q + ce > h) return null;
1471
+ const de = j ? j.children : A.children, ve = de.indexOf(F);
1472
+ if (ve === -1) return null;
1473
+ const Le = de === H, [$e] = de.splice(ve, 1);
1474
+ let ke = r;
1475
+ return Le && ve < r && (ke = r - 1), ke = Math.max(0, Math.min(ke, H.length)), H.splice(ke, 0, $e), $e.data[y] = le ? b(le.data) : null, Le || I(de), I(H), t.value = A, A;
1476
+ },
1477
+ recalculatePositions: O,
1478
+ calculateSubtreeDepth: m
1479
+ };
1480
+ }
1481
+ const Bt = (t, x) => t.find((v) => v.key === x) ?? null, la = (t, x, v) => {
1482
+ let n = Bt(t, v);
1483
+ for (; n && n.parentKey !== null; ) {
1484
+ if (n.parentKey === x) return !0;
1485
+ n = Bt(t, n.parentKey);
1486
+ }
1487
+ return !1;
1488
+ }, vl = (t, x, v) => {
1489
+ let n = Bt(t, x);
1490
+ for (; n && n.depth > v; ) {
1491
+ if (n.parentKey === null) return null;
1492
+ n = Bt(t, n.parentKey);
1493
+ }
1494
+ return n && n.depth === v ? n : null;
1495
+ }, yl = (t, x, v) => v === x || la(t, x, v), It = (t, x, v, n) => {
1496
+ for (let y = x; y >= 0 && y < t.length; y += v) {
1497
+ const p = t[y];
1498
+ if (!yl(t, n, p.key)) return p;
1499
+ }
1500
+ return null;
1501
+ }, hl = (t) => {
1502
+ const {
1503
+ pointer: x,
1504
+ hoveredRow: v,
1505
+ sourceKey: n,
1506
+ sourceSubtreeDepth: y,
1507
+ viewItems: p,
1508
+ maxDepth: h,
1509
+ indentPx: b,
1510
+ containerLeft: m,
1511
+ containerPaddingLeft: c
1512
+ } = t;
1513
+ if (v.key === n || la(p, n, v.key)) return null;
1514
+ const I = x.y - v.rect.top, D = v.rect.height, O = I < D / 2, K = O ? "top" : "bottom", P = p.findIndex((S) => S.key === v.key), T = O ? It(p, P - 1, -1, n) : It(p, P, -1, n), U = O ? It(p, P, 1, n) : It(p, P + 1, 1, n), R = x.x - m - c, E = Math.round(R / b), Q = T ? T.depth + 1 : 0, C = U ? U.depth : 0, W = Math.max(C, Math.min(E, Q));
1515
+ let V;
1516
+ if (!T)
1517
+ V = {
1518
+ type: "insert",
1519
+ refKey: v.key,
1520
+ refEdge: "top",
1521
+ parentKey: null,
1522
+ index: 0,
1523
+ depth: 0,
1524
+ makeChild: !1,
1525
+ levelRowKey: null
1526
+ };
1527
+ else if (W === T.depth + 1)
1528
+ V = {
1529
+ type: "insert",
1530
+ refKey: v.key,
1531
+ refEdge: K,
1532
+ parentKey: T.key,
1533
+ index: 0,
1534
+ depth: W,
1535
+ makeChild: !0,
1536
+ levelRowKey: null
1537
+ };
1538
+ else if (W === T.depth)
1539
+ V = {
1540
+ type: "insert",
1541
+ refKey: v.key,
1542
+ refEdge: K,
1543
+ parentKey: T.parentKey,
1544
+ index: T.siblingIndex + 1,
1545
+ depth: W,
1546
+ makeChild: !1,
1547
+ levelRowKey: T.key
1548
+ };
1549
+ else {
1550
+ const S = vl(p, T.key, W);
1551
+ S ? V = {
1552
+ type: "insert",
1553
+ refKey: v.key,
1554
+ refEdge: K,
1555
+ parentKey: S.parentKey,
1556
+ index: S.siblingIndex + 1,
1557
+ depth: W,
1558
+ makeChild: !1,
1559
+ levelRowKey: S.key
1560
+ } : V = {
1561
+ type: "insert",
1562
+ refKey: v.key,
1563
+ refEdge: K,
1564
+ parentKey: T.parentKey,
1565
+ index: T.siblingIndex + 1,
1566
+ depth: T.depth,
1567
+ makeChild: !1,
1568
+ levelRowKey: T.key
1569
+ };
1570
+ }
1571
+ return V.depth + y - 1 >= h ? { type: "blocked", desired: V, reason: "maxDepth" } : V;
1572
+ }, pl = ["data-id", "aria-level", "tabindex"], gl = ["aria-label"], bl = {
1573
+ key: 2,
1574
+ class: "a-nested-list-editor__tree-toggle a-nested-list-editor__tree-toggle--spacer",
1575
+ "aria-hidden": "true"
1576
+ }, kl = { class: "a-le-row-main" }, wl = { class: "a-le-title" }, Cl = {
1577
+ key: 0,
1578
+ class: "a-nested-list-editor__drag-count",
1579
+ "aria-hidden": "true"
1580
+ }, xl = {
1581
+ key: 3,
1582
+ class: "a-le-status"
1583
+ }, Al = {
1584
+ key: 0,
1585
+ class: "a-le-status-badge"
1586
+ }, Sl = { class: "a-le-actions" }, Pl = { class: "a-le-row-body" }, Il = { class: "a-le-form" }, Dl = {
1587
+ key: 0,
1588
+ class: "a-le-row-footer"
1589
+ }, Tl = {
1590
+ key: 1,
1591
+ class: "a-le-row-body"
1592
+ }, El = { class: "a-le-form" }, $l = ["data-parent-id"], Fl = "a-nested-list-editor__group", Bl = "a-le-drag-handle", ia = /* @__PURE__ */ He({
1593
+ __name: "LeNestedRow",
1594
+ props: {
1595
+ vi: {},
1596
+ viewItems: {},
1597
+ dragState: {},
1598
+ context: {},
1599
+ callbacks: {}
1600
+ },
1601
+ setup(t) {
1602
+ const x = t, v = ia, { t: n } = Je(), y = (m) => `--row-${String(m).replace(/\W/g, "_")}`, p = (m) => {
1603
+ if (typeof x.context.resolveValidation == "function")
1604
+ return x.context.resolveValidation(m, x.vi.key, x.vi.index);
1605
+ const c = m.validationState;
1606
+ return c === "valid" || c === "invalid" || c === "warning" ? c : null;
1607
+ }, h = () => x.context.buildSlotProps(x.vi), b = () => x.viewItems.filter((m) => m.parentKey === x.vi.key);
1608
+ return (m, c) => (g(), M("div", {
1609
+ class: xe([
1610
+ "a-le-row-wrapper",
1611
+ {
1612
+ "a-le-row-wrapper--drop-disabled": t.dragState !== null && t.dragState.sourceKey === t.vi.key
1613
+ }
1614
+ ]),
1615
+ "data-id": String(t.vi.key),
1616
+ role: "treeitem",
1617
+ "aria-level": t.vi.depth + 1,
1618
+ tabindex: t.context.keyboardNav ? t.context.keyboardNav.rowTabindex(t.vi.key) : void 0,
1619
+ onKeydown: c[17] || (c[17] = (I) => t.context.keyboardNav ? t.context.keyboardNav.handleKeydown(t.vi.key, I) : void 0)
1620
+ }, [
1621
+ z("div", {
1622
+ class: xe([
1623
+ "a-le-row",
1624
+ t.vi.depth > 0 ? "a-le-row--child" : null,
1625
+ {
1626
+ "a-le-row--editing": t.vi.editing,
1627
+ "a-le-row--expanded": t.vi.expanded,
1628
+ "a-le-row--unsaved": t.vi.unsaved,
1629
+ "a-le-row--reorder": t.context.reorderMode,
1630
+ "a-le-row--grabbed": t.context.keyboardNav && t.context.keyboardNav.isGrabbed(t.vi.key),
1631
+ "a-le-row--clickable": t.context.isRowClickable(t.vi),
1632
+ "a-le-row--drop-source": t.dragState !== null && t.dragState.sourceKey === t.vi.key,
1633
+ [`a-le-row--validation-${p(t.vi.raw)}`]: p(t.vi.raw) !== null
1634
+ }
1635
+ ]),
1636
+ style: mt({
1637
+ "--nested-depth": t.vi.depth,
1638
+ "anchor-name": y(t.vi.key),
1639
+ "--parent-anchor": t.vi.parentKey !== null ? y(t.vi.parentKey) : "none"
1640
+ })
1641
+ }, [
1642
+ L(m.$slots, "before-item", Ke(qe(h()))),
1643
+ z("div", {
1644
+ class: "a-le-row-header",
1645
+ onClick: c[14] || (c[14] = (I) => t.callbacks.onRowClick(t.vi))
1646
+ }, [
1647
+ t.context.dragEnabled ? (g(), X(eo, {
1648
+ key: 0,
1649
+ class: xe(Bl)
1650
+ })) : G("", !0),
1651
+ t.context.showExpandToggle && t.vi.childrenAllowed ? (g(), M("button", {
1652
+ key: 1,
1653
+ type: "button",
1654
+ class: xe([
1655
+ "a-nested-list-editor__tree-toggle",
1656
+ {
1657
+ "a-nested-list-editor__tree-toggle--empty": !t.vi.hasChildren,
1658
+ "a-nested-list-editor__tree-toggle--open": t.vi.childrenExpanded
1659
+ }
1660
+ ]),
1661
+ "aria-label": t.vi.childrenExpanded ? d(n)("common.sortable.close") : d(n)("common.sortable.edit"),
1662
+ onClick: c[0] || (c[0] = ae((I) => t.vi.hasChildren && t.callbacks.onChevronClick(t.vi), ["stop"]))
1663
+ }, [...c[18] || (c[18] = [
1664
+ z("span", { class: "a-nested-list-editor__tree-toggle-caret" }, null, -1)
1665
+ ])], 10, gl)) : t.context.showExpandToggle ? (g(), M("span", bl)) : G("", !0),
1666
+ z("div", kl, [
1667
+ L(m.$slots, "item-compact", Ke(qe(h())), () => [
1668
+ z("span", wl, B(t.context.resolveCompactText(t.vi.raw, t.vi.key)), 1)
1669
+ ]),
1670
+ t.vi.hasChildren ? (g(), M("span", Cl, [
1671
+ i(te, {
1672
+ icon: "mdi-file-tree",
1673
+ size: "14"
1674
+ }),
1675
+ J(" +" + B(t.vi.childrenCount), 1)
1676
+ ])) : G("", !0),
1677
+ t.vi.unsaved ? (g(), X(Wn, { key: 1 })) : G("", !0)
1678
+ ]),
1679
+ t.context.reorderMode ? G("", !0) : (g(), M("div", xl, [
1680
+ L(m.$slots, "item-status", Ke(qe(h())), () => [
1681
+ t.context.statusField && t.vi.raw[t.context.statusField] != null && t.vi.raw[t.context.statusField] !== "" ? (g(), M("span", Al, B(t.vi.raw[t.context.statusField]), 1)) : G("", !0)
1682
+ ])
1683
+ ])),
1684
+ z("div", Sl, [
1685
+ L(m.$slots, "item-actions", Ke(qe(h())), () => [
1686
+ t.context.reorderMode ? (g(), M(be, { key: 0 }, [
1687
+ i(ee, {
1688
+ icon: "",
1689
+ size: "small",
1690
+ variant: "text",
1691
+ density: "comfortable",
1692
+ disabled: t.vi.firstInParent,
1693
+ class: "mx-1 a-le-action a-le-action--up",
1694
+ onClick: c[1] || (c[1] = ae((I) => t.callbacks.moveUp(t.vi.key), ["stop"]))
1695
+ }, {
1696
+ default: s(() => [
1697
+ i(te, {
1698
+ icon: "mdi-arrow-up",
1699
+ size: "18"
1700
+ }),
1701
+ i(Se, {
1702
+ activator: "parent",
1703
+ location: "bottom",
1704
+ text: d(n)("common.sortable.moveUp")
1705
+ }, null, 8, ["text"])
1706
+ ]),
1707
+ _: 1
1708
+ }, 8, ["disabled"]),
1709
+ i(ee, {
1710
+ icon: "",
1711
+ size: "small",
1712
+ variant: "text",
1713
+ density: "comfortable",
1714
+ disabled: t.vi.lastInParent,
1715
+ class: "mx-1 a-le-action a-le-action--down",
1716
+ onClick: c[2] || (c[2] = ae((I) => t.callbacks.moveDown(t.vi.key), ["stop"]))
1717
+ }, {
1718
+ default: s(() => [
1719
+ i(te, {
1720
+ icon: "mdi-arrow-down",
1721
+ size: "18"
1722
+ }),
1723
+ i(Se, {
1724
+ activator: "parent",
1725
+ location: "bottom",
1726
+ text: d(n)("common.sortable.moveDown")
1727
+ }, null, 8, ["text"])
1728
+ ]),
1729
+ _: 1
1730
+ }, 8, ["disabled"]),
1731
+ i(ee, {
1732
+ icon: "",
1733
+ size: "small",
1734
+ variant: "text",
1735
+ density: "comfortable",
1736
+ active: !1,
1737
+ class: "mx-1 a-le-action a-le-action--menu"
1738
+ }, {
1739
+ default: s(() => [
1740
+ i(te, {
1741
+ icon: "mdi-dots-vertical",
1742
+ size: "18"
1743
+ }),
1744
+ i(Se, {
1745
+ activator: "parent",
1746
+ location: "bottom",
1747
+ text: d(n)("common.sortable.more")
1748
+ }, null, 8, ["text"]),
1749
+ i(Ft, { activator: "parent" }, {
1750
+ default: s(() => [
1751
+ i(vt, { density: "compact" }, {
1752
+ default: s(() => [
1753
+ i(Ae, {
1754
+ disabled: t.vi.firstInParent,
1755
+ onClick: c[3] || (c[3] = ae((I) => t.callbacks.moveTop(t.vi.key), ["stop"]))
1756
+ }, {
1757
+ prepend: s(() => [
1758
+ i(te, { icon: "mdi-arrow-collapse-up" })
1759
+ ]),
1760
+ default: s(() => [
1761
+ i(Ee, null, {
1762
+ default: s(() => [
1763
+ J(B(d(n)("common.sortable.moveToTop")), 1)
1764
+ ]),
1765
+ _: 1
1766
+ })
1767
+ ]),
1768
+ _: 1
1769
+ }, 8, ["disabled"]),
1770
+ i(Ae, {
1771
+ disabled: t.vi.lastInParent,
1772
+ onClick: c[4] || (c[4] = ae((I) => t.callbacks.moveBottom(t.vi.key), ["stop"]))
1773
+ }, {
1774
+ prepend: s(() => [
1775
+ i(te, { icon: "mdi-arrow-collapse-down" })
1776
+ ]),
1777
+ default: s(() => [
1778
+ i(Ee, null, {
1779
+ default: s(() => [
1780
+ J(B(d(n)("common.sortable.moveToBottom")), 1)
1781
+ ]),
1782
+ _: 1
1783
+ })
1784
+ ]),
1785
+ _: 1
1786
+ }, 8, ["disabled"]),
1787
+ t.context.showMoveToPosition && (!t.vi.firstInParent || !t.vi.lastInParent) ? (g(), X(Ae, {
1788
+ key: 0,
1789
+ onClick: c[5] || (c[5] = ae((I) => t.callbacks.openMoveToPosition(t.vi), ["stop"]))
1790
+ }, {
1791
+ prepend: s(() => [
1792
+ i(te, { icon: "mdi-target" })
1793
+ ]),
1794
+ default: s(() => [
1795
+ i(Ee, null, {
1796
+ default: s(() => [
1797
+ J(B(d(n)("common.sortable.moveToPosition.action")), 1)
1798
+ ]),
1799
+ _: 1
1800
+ })
1801
+ ]),
1802
+ _: 1
1803
+ })) : G("", !0),
1804
+ t.context.showChangeParent ? (g(), X(Ae, {
1805
+ key: 1,
1806
+ onClick: c[6] || (c[6] = ae((I) => t.callbacks.openChangeParent(t.vi), ["stop"]))
1807
+ }, {
1808
+ prepend: s(() => [
1809
+ i(te, { icon: "mdi-folder-move-outline" })
1810
+ ]),
1811
+ default: s(() => [
1812
+ i(Ee, null, {
1813
+ default: s(() => [
1814
+ J(B(d(n)("common.sortable.changeParent.action")), 1)
1815
+ ]),
1816
+ _: 1
1817
+ })
1818
+ ]),
1819
+ _: 1
1820
+ })) : G("", !0),
1821
+ i(Ae, {
1822
+ disabled: !t.vi.canIndent,
1823
+ onClick: c[7] || (c[7] = ae((I) => t.callbacks.indent(t.vi), ["stop"]))
1824
+ }, {
1825
+ prepend: s(() => [
1826
+ i(te, { icon: "mdi-format-indent-increase" })
1827
+ ]),
1828
+ default: s(() => [
1829
+ i(Ee, null, {
1830
+ default: s(() => [
1831
+ J(B(d(n)("common.sortable.indent")), 1)
1832
+ ]),
1833
+ _: 1
1834
+ })
1835
+ ]),
1836
+ _: 1
1837
+ }, 8, ["disabled"]),
1838
+ i(Ae, {
1839
+ disabled: !t.vi.canOutdent,
1840
+ onClick: c[8] || (c[8] = ae((I) => t.callbacks.outdent(t.vi), ["stop"]))
1841
+ }, {
1842
+ prepend: s(() => [
1843
+ i(te, { icon: "mdi-format-indent-decrease" })
1844
+ ]),
1845
+ default: s(() => [
1846
+ i(Ee, null, {
1847
+ default: s(() => [
1848
+ J(B(d(n)("common.sortable.outdent")), 1)
1849
+ ]),
1850
+ _: 1
1851
+ })
1852
+ ]),
1853
+ _: 1
1854
+ }, 8, ["disabled"]),
1855
+ t.context.showDeleteButton && t.context.canInteract ? (g(), X(Ae, {
1856
+ key: 2,
1857
+ onClick: c[9] || (c[9] = ae((I) => t.callbacks.onDeleteClick(t.vi), ["stop"]))
1858
+ }, {
1859
+ prepend: s(() => [
1860
+ i(te, {
1861
+ icon: "mdi-trash-can-outline",
1862
+ color: "error"
1863
+ })
1864
+ ]),
1865
+ default: s(() => [
1866
+ i(Ee, { class: "text-error" }, {
1867
+ default: s(() => [
1868
+ J(B(d(n)("common.sortable.delete")), 1)
1869
+ ]),
1870
+ _: 1
1871
+ })
1872
+ ]),
1873
+ _: 1
1874
+ })) : G("", !0)
1875
+ ]),
1876
+ _: 1
1877
+ })
1878
+ ]),
1879
+ _: 1
1880
+ })
1881
+ ]),
1882
+ _: 1
1883
+ })
1884
+ ], 64)) : (g(), M(be, { key: 1 }, [
1885
+ t.context.showEditButton && t.context.canInteract ? (g(), X(ee, {
1886
+ key: 0,
1887
+ icon: "",
1888
+ size: "small",
1889
+ variant: "tonal",
1890
+ color: "primary",
1891
+ density: "comfortable",
1892
+ class: "mx-1 a-le-action a-le-action--edit",
1893
+ onClick: c[10] || (c[10] = ae((I) => t.callbacks.onEditClick(t.vi), ["stop"]))
1894
+ }, {
1895
+ default: s(() => [
1896
+ i(te, {
1897
+ icon: "mdi-pencil-outline",
1898
+ size: "18"
1899
+ }),
1900
+ i(Se, {
1901
+ activator: "parent",
1902
+ location: "bottom",
1903
+ text: d(n)("common.sortable.edit")
1904
+ }, null, 8, ["text"])
1905
+ ]),
1906
+ _: 1
1907
+ })) : G("", !0),
1908
+ t.context.showDeleteButton && t.context.canInteract ? (g(), X(ee, {
1909
+ key: 1,
1910
+ icon: "",
1911
+ size: "small",
1912
+ variant: "text",
1913
+ density: "comfortable",
1914
+ class: "mx-1 a-le-action a-le-action--delete",
1915
+ onClick: c[11] || (c[11] = ae((I) => t.callbacks.onDeleteClick(t.vi), ["stop"]))
1916
+ }, {
1917
+ default: s(() => [
1918
+ i(te, {
1919
+ icon: "mdi-trash-can-outline",
1920
+ size: "18"
1921
+ }),
1922
+ i(Se, {
1923
+ activator: "parent",
1924
+ location: "bottom",
1925
+ text: d(n)("common.sortable.delete")
1926
+ }, null, 8, ["text"])
1927
+ ]),
1928
+ _: 1
1929
+ })) : G("", !0),
1930
+ t.context.canInteract && (t.context.showAddChildButton && t.vi.canAddChild || t.context.showAddAfterAction) ? (g(), X(ee, {
1931
+ key: 2,
1932
+ icon: "",
1933
+ size: "small",
1934
+ variant: "text",
1935
+ density: "comfortable",
1936
+ active: !1,
1937
+ class: "mx-1 a-le-action a-le-action--menu"
1938
+ }, {
1939
+ default: s(() => [
1940
+ i(te, {
1941
+ icon: "mdi-dots-vertical",
1942
+ size: "18"
1943
+ }),
1944
+ i(Se, {
1945
+ activator: "parent",
1946
+ location: "bottom",
1947
+ text: d(n)("common.sortable.more")
1948
+ }, null, 8, ["text"]),
1949
+ i(Ft, { activator: "parent" }, {
1950
+ default: s(() => [
1951
+ i(vt, { density: "compact" }, {
1952
+ default: s(() => [
1953
+ t.context.showAddAfterAction ? (g(), X(Ae, {
1954
+ key: 0,
1955
+ onClick: c[12] || (c[12] = ae((I) => t.callbacks.onAddAfterClick(t.vi), ["stop"]))
1956
+ }, {
1957
+ prepend: s(() => [
1958
+ i(te, { icon: "mdi-playlist-plus" })
1959
+ ]),
1960
+ default: s(() => [
1961
+ i(Ee, null, {
1962
+ default: s(() => [
1963
+ J(B(d(n)("common.sortable.addAfter")), 1)
1964
+ ]),
1965
+ _: 1
1966
+ })
1967
+ ]),
1968
+ _: 1
1969
+ })) : G("", !0),
1970
+ t.context.showAddChildButton && t.vi.canAddChild ? (g(), X(Ae, {
1971
+ key: 1,
1972
+ onClick: c[13] || (c[13] = ae((I) => t.callbacks.onAddChildClick(t.vi), ["stop"]))
1973
+ }, {
1974
+ prepend: s(() => [
1975
+ i(te, { icon: "mdi-subdirectory-arrow-right" })
1976
+ ]),
1977
+ default: s(() => [
1978
+ i(Ee, null, {
1979
+ default: s(() => [
1980
+ J(B(d(n)("common.sortable.addChild")), 1)
1981
+ ]),
1982
+ _: 1
1983
+ })
1984
+ ]),
1985
+ _: 1
1986
+ })) : G("", !0)
1987
+ ]),
1988
+ _: 1
1989
+ })
1990
+ ]),
1991
+ _: 1
1992
+ })
1993
+ ]),
1994
+ _: 1
1995
+ })) : G("", !0)
1996
+ ], 64))
1997
+ ])
1998
+ ])
1999
+ ]),
2000
+ t.vi.editing && !t.context.reorderMode && m.$slots.item ? (g(), M(be, { key: 0 }, [
2001
+ z("div", Pl, [
2002
+ z("div", Il, [
2003
+ L(m.$slots, "item", Ke(qe(h())))
2004
+ ])
2005
+ ]),
2006
+ L(m.$slots, "item-footer", Ke(qe(h())), () => [
2007
+ t.context.showInlineSaveFooter ? (g(), M("div", Dl, [
2008
+ c[19] || (c[19] = z("div", { class: "a-le-row-footer-spacer" }, null, -1)),
2009
+ i(ee, {
2010
+ variant: "text",
2011
+ disabled: t.vi.loading,
2012
+ onClick: c[15] || (c[15] = ae((I) => t.callbacks.onCancelClick(t.vi), ["stop"]))
2013
+ }, {
2014
+ default: s(() => [
2015
+ J(B(d(n)("common.button.cancel")), 1)
2016
+ ]),
2017
+ _: 1
2018
+ }, 8, ["disabled"]),
2019
+ i(ee, {
2020
+ color: "primary",
2021
+ variant: "flat",
2022
+ "prepend-icon": "mdi-check",
2023
+ disabled: t.vi.loading,
2024
+ onClick: c[16] || (c[16] = ae((I) => t.callbacks.onSaveClick(t.vi), ["stop"]))
2025
+ }, {
2026
+ default: s(() => [
2027
+ J(B(d(n)("common.button.save")), 1)
2028
+ ]),
2029
+ _: 1
2030
+ }, 8, ["disabled"])
2031
+ ])) : G("", !0)
2032
+ ])
2033
+ ], 64)) : t.vi.expanded && !t.context.reorderMode && m.$slots["item-readonly"] ? (g(), M("div", Tl, [
2034
+ z("div", El, [
2035
+ L(m.$slots, "item-readonly", Ke(qe(h())))
2036
+ ])
2037
+ ])) : G("", !0),
2038
+ L(m.$slots, "after-item", Ke(qe(h())))
2039
+ ], 6),
2040
+ t.vi.hasChildren && t.vi.childrenExpanded ? (g(), M("div", {
2041
+ key: 0,
2042
+ class: "a-nested-list-editor__children",
2043
+ style: mt({ "--parent-depth": t.vi.depth })
2044
+ }, [
2045
+ z("div", {
2046
+ class: xe([Fl]),
2047
+ "data-parent-id": String(t.vi.key)
2048
+ }, [
2049
+ (g(!0), M(be, null, at(b(), (I) => (g(), X(d(v), {
2050
+ key: String(I.key),
2051
+ vi: I,
2052
+ "view-items": t.viewItems,
2053
+ "drag-state": t.dragState,
2054
+ context: t.context,
2055
+ callbacks: t.callbacks
2056
+ }, {
2057
+ item: s((D) => [
2058
+ L(m.$slots, "item", oe({ ref_for: !0 }, D))
2059
+ ]),
2060
+ "item-compact": s((D) => [
2061
+ L(m.$slots, "item-compact", oe({ ref_for: !0 }, D))
2062
+ ]),
2063
+ "item-readonly": s((D) => [
2064
+ L(m.$slots, "item-readonly", oe({ ref_for: !0 }, D))
2065
+ ]),
2066
+ "item-status": s((D) => [
2067
+ L(m.$slots, "item-status", oe({ ref_for: !0 }, D))
2068
+ ]),
2069
+ "item-footer": s((D) => [
2070
+ L(m.$slots, "item-footer", oe({ ref_for: !0 }, D))
2071
+ ]),
2072
+ "item-actions": s((D) => [
2073
+ L(m.$slots, "item-actions", oe({ ref_for: !0 }, D))
2074
+ ]),
2075
+ "before-item": s((D) => [
2076
+ L(m.$slots, "before-item", oe({ ref_for: !0 }, D))
2077
+ ]),
2078
+ "after-item": s((D) => [
2079
+ L(m.$slots, "after-item", oe({ ref_for: !0 }, D))
2080
+ ]),
2081
+ _: 3
2082
+ }, 8, ["vi", "view-items", "drag-state", "context", "callbacks"]))), 128))
2083
+ ], 10, $l)
2084
+ ], 4)) : G("", !0)
2085
+ ], 42, pl));
2086
+ }
2087
+ }), Rl = { class: "text-body-medium mb-2" }, Kl = /* @__PURE__ */ He({
2088
+ __name: "LeChangeParentDialog",
2089
+ props: /* @__PURE__ */ Ve({
2090
+ tree: {},
2091
+ sourceKey: {},
2092
+ keyField: {},
2093
+ maxDepth: {},
2094
+ resolveLabel: { type: Function },
2095
+ calculateSubtreeDepth: { type: Function }
2096
+ }, {
2097
+ modelValue: { type: Boolean, required: !0 },
2098
+ modelModifiers: {}
2099
+ }),
2100
+ emits: /* @__PURE__ */ Ve(["confirm"], ["update:modelValue"]),
2101
+ setup(t, { emit: x }) {
2102
+ const v = t, n = x, y = Ge(t, "modelValue"), { t: p } = Je(), h = fe(void 0), b = fe("last");
2103
+ Pe(y, (C) => {
2104
+ C && (h.value = void 0, b.value = "last");
2105
+ });
2106
+ const m = k(() => {
2107
+ const C = /* @__PURE__ */ new Set();
2108
+ if (v.sourceKey === null) return C;
2109
+ const W = (V) => {
2110
+ for (const S of V) {
2111
+ if (S.data[v.keyField] === v.sourceKey) {
2112
+ const Y = (re) => {
2113
+ for (const _ of re)
2114
+ C.add(_.data[v.keyField]), _.children?.length && Y(_.children);
2115
+ };
2116
+ return S.children?.length && Y(S.children), !0;
2117
+ }
2118
+ if (S.children?.length && W(S.children)) return !0;
2119
+ }
2120
+ return !1;
2121
+ };
2122
+ return W(v.tree.children), C;
2123
+ }), c = k(() => {
2124
+ if (v.sourceKey === null) return null;
2125
+ const C = (W) => {
2126
+ for (const V of W) {
2127
+ if (V.data[v.keyField] === v.sourceKey) return V;
2128
+ if (V.children?.length) {
2129
+ const S = C(V.children);
2130
+ if (S) return S;
2131
+ }
2132
+ }
2133
+ return null;
2134
+ };
2135
+ return C(v.tree.children);
2136
+ }), I = k(() => {
2137
+ if (v.sourceKey === null) return;
2138
+ const C = (W, V) => {
2139
+ for (const S of W) {
2140
+ if (S.data[v.keyField] === v.sourceKey) return V;
2141
+ if (S.children?.length) {
2142
+ const se = C(S.children, S.data[v.keyField]);
2143
+ if (se !== void 0) return se;
2144
+ }
2145
+ }
2146
+ };
2147
+ return C(v.tree.children, null);
2148
+ }), D = k(() => {
2149
+ const C = [], W = c.value ? v.calculateSubtreeDepth(c.value) : 1;
2150
+ C.push({
2151
+ key: null,
2152
+ depth: 0,
2153
+ label: p("common.sortable.changeParent.rootLabel"),
2154
+ hasChildren: v.tree.children.length > 0,
2155
+ disallowed: I.value === null,
2156
+ reason: I.value === null ? "currentParent" : null
2157
+ });
2158
+ const V = (S, se) => {
2159
+ for (const Y of S) {
2160
+ const re = Y.data[v.keyField];
2161
+ let _ = !1, ne = null;
2162
+ re === v.sourceKey ? (_ = !0, ne = "self") : m.value.has(re) ? (_ = !0, ne = "descendant") : I.value !== void 0 && I.value === re ? (_ = !0, ne = "currentParent") : se + 1 + W > v.maxDepth && (_ = !0, ne = "maxDepth"), C.push({
2163
+ key: re,
2164
+ depth: se + 1,
2165
+ label: v.resolveLabel(Y.data, re),
2166
+ hasChildren: !!(Y.children && Y.children.length > 0),
2167
+ disallowed: _,
2168
+ reason: ne
2169
+ }), Y.children?.length && V(Y.children, se + 1);
2170
+ }
2171
+ };
2172
+ return V(v.tree.children, 0), C;
2173
+ }), O = k(() => D.value.filter((C) => !C.disallowed)), K = k(
2174
+ () => h.value === void 0 ? null : D.value.find((C) => C.key === h.value) ?? null
2175
+ ), P = k(
2176
+ () => !!K.value && K.value.hasChildren
2177
+ ), T = (C) => {
2178
+ C.disallowed || (h.value = C.key);
2179
+ }, U = () => {
2180
+ K.value && (n("confirm", K.value.key, b.value), y.value = !1);
2181
+ }, R = () => {
2182
+ y.value = !1;
2183
+ }, E = (C) => `${C * 16}px`, Q = (C) => C === "maxDepth" ? p("common.sortable.changeParent.errorMaxDepth") : "";
2184
+ return (C, W) => (g(), X(en, {
2185
+ modelValue: y.value,
2186
+ "onUpdate:modelValue": W[1] || (W[1] = (V) => y.value = V),
2187
+ "max-width": "540",
2188
+ persistent: ""
2189
+ }, {
2190
+ default: s(() => [
2191
+ i(_t, null, {
2192
+ default: s(() => [
2193
+ i(na, null, {
2194
+ default: s(() => [
2195
+ J(B(d(p)("common.sortable.changeParent.title")), 1)
2196
+ ]),
2197
+ _: 1
2198
+ }),
2199
+ O.value.length === 0 ? (g(), X(Dt, {
2200
+ key: 0,
2201
+ class: "text-body-medium"
2202
+ }, {
2203
+ default: s(() => [
2204
+ i(nn, {
2205
+ type: "info",
2206
+ variant: "tonal",
2207
+ density: "compact"
2208
+ }, {
2209
+ default: s(() => [
2210
+ z("strong", null, B(d(p)("common.sortable.changeParent.noTargetsTitle")), 1),
2211
+ z("div", null, B(d(p)("common.sortable.changeParent.noTargetsText")), 1)
2212
+ ]),
2213
+ _: 1
2214
+ })
2215
+ ]),
2216
+ _: 1
2217
+ })) : (g(), M(be, { key: 1 }, [
2218
+ i(Dt, { class: "pb-1" }, {
2219
+ default: s(() => [
2220
+ i(vt, {
2221
+ density: "compact",
2222
+ class: "le-change-parent__list"
2223
+ }, {
2224
+ default: s(() => [
2225
+ (g(!0), M(be, null, at(D.value, (V) => (g(), X(Ae, {
2226
+ key: V.key === null ? "__root__" : String(V.key),
2227
+ disabled: V.disallowed,
2228
+ active: h.value === V.key,
2229
+ title: V.label,
2230
+ subtitle: Q(V.reason),
2231
+ style: mt({ paddingInlineStart: E(V.depth) }),
2232
+ "data-disallowed": V.disallowed ? "true" : "false",
2233
+ "data-reason": V.reason ?? "",
2234
+ onClick: (S) => T(V)
2235
+ }, {
2236
+ prepend: s(() => [
2237
+ V.key === null ? (g(), X(te, {
2238
+ key: 0,
2239
+ icon: "mdi-folder-home-outline",
2240
+ size: "18"
2241
+ })) : V.hasChildren ? (g(), X(te, {
2242
+ key: 1,
2243
+ icon: "mdi-folder-outline",
2244
+ size: "18"
2245
+ })) : (g(), X(te, {
2246
+ key: 2,
2247
+ icon: "mdi-file-outline",
2248
+ size: "18"
2249
+ }))
2250
+ ]),
2251
+ _: 2
2252
+ }, 1032, ["disabled", "active", "title", "subtitle", "style", "data-disallowed", "data-reason", "onClick"]))), 128))
2253
+ ]),
2254
+ _: 1
2255
+ })
2256
+ ]),
2257
+ _: 1
2258
+ }),
2259
+ P.value ? (g(), X(Dt, {
2260
+ key: 0,
2261
+ class: "pt-0"
2262
+ }, {
2263
+ default: s(() => [
2264
+ z("div", Rl, B(d(p)("common.sortable.changeParent.placementHeading", {
2265
+ label: K.value?.label ?? ""
2266
+ })), 1),
2267
+ i(ko, {
2268
+ modelValue: b.value,
2269
+ "onUpdate:modelValue": W[0] || (W[0] = (V) => b.value = V),
2270
+ density: "compact",
2271
+ "hide-details": ""
2272
+ }, {
2273
+ default: s(() => [
2274
+ i(pn, {
2275
+ value: "first",
2276
+ label: d(p)("common.sortable.changeParent.placeFirst")
2277
+ }, null, 8, ["label"]),
2278
+ i(pn, {
2279
+ value: "last",
2280
+ label: d(p)("common.sortable.changeParent.placeLast")
2281
+ }, null, 8, ["label"])
2282
+ ]),
2283
+ _: 1
2284
+ }, 8, ["modelValue"])
2285
+ ]),
2286
+ _: 1
2287
+ })) : G("", !0)
2288
+ ], 64)),
2289
+ i(aa, null, {
2290
+ default: s(() => [
2291
+ i(tn),
2292
+ i(ee, {
2293
+ variant: "text",
2294
+ onClick: R
2295
+ }, {
2296
+ default: s(() => [
2297
+ J(B(d(p)("common.sortable.reorderCancel")), 1)
2298
+ ]),
2299
+ _: 1
2300
+ }),
2301
+ i(ee, {
2302
+ color: "primary",
2303
+ variant: "elevated",
2304
+ disabled: !K.value || K.value.disallowed,
2305
+ onClick: U
2306
+ }, {
2307
+ default: s(() => [
2308
+ J(B(d(p)("common.sortable.changeParent.confirm")), 1)
2309
+ ]),
2310
+ _: 1
2311
+ }, 8, ["disabled"])
2312
+ ]),
2313
+ _: 1
2314
+ })
2315
+ ]),
2316
+ _: 1
2317
+ })
2318
+ ]),
2319
+ _: 1
2320
+ }, 8, ["modelValue"]));
2321
+ }
2322
+ }), Vl = /* @__PURE__ */ to(Kl, [["__scopeId", "data-v-0058f5cc"]]), Ll = { class: "a-le-card" }, Ml = {
2323
+ key: 0,
2324
+ class: "a-le-header"
2325
+ }, zl = {
2326
+ key: 0,
2327
+ class: "a-le-title-heading"
2328
+ }, Nl = { class: "a-le-header-actions" }, Ol = {
2329
+ key: 1,
2330
+ class: "a-le-state a-le-state--loading"
2331
+ }, Ul = {
2332
+ key: 2,
2333
+ class: "a-le-state a-le-state--error"
2334
+ }, jl = {
2335
+ key: 3,
2336
+ class: "a-le-state a-le-state--empty"
2337
+ }, ql = {
2338
+ class: "a-le-sr-only",
2339
+ "aria-live": "polite",
2340
+ role: "status"
2341
+ }, gn = "a-nested-list-editor__group", Gl = "a-le-drag-handle", bn = 24, kn = 22, Ci = /* @__PURE__ */ He({
2342
+ __name: "ANestedSortableListEditor",
2343
+ props: /* @__PURE__ */ Ve({
2344
+ maxDepth: {},
2345
+ keyField: { default: "id" },
2346
+ positionField: { default: "position" },
2347
+ parentField: { default: "parent" },
2348
+ positionMultiplier: { default: 1 },
2349
+ readonly: { type: Boolean, default: !1 },
2350
+ disabled: { type: Boolean, default: !1 },
2351
+ loading: { type: Boolean, default: !1 },
2352
+ error: { default: null },
2353
+ title: { default: null },
2354
+ compactField: { default: null },
2355
+ statusField: { default: null },
2356
+ showAddButton: { type: Boolean, default: !0 },
2357
+ showAddChildButton: { type: Boolean, default: !0 },
2358
+ showDeleteButton: { type: Boolean, default: !0 },
2359
+ showEditButton: { type: Boolean, default: !0 },
2360
+ showAddAfterAction: { type: Boolean, default: !1 },
2361
+ showMoveToPosition: { type: Boolean, default: !1 },
2362
+ showChangeParent: { type: Boolean, default: !1 },
2363
+ showExpandToggle: { type: Boolean, default: !0 },
2364
+ getValidationState: { type: Function, default: void 0 },
2365
+ addLabel: { default: null },
2366
+ emptyTitle: { default: null },
2367
+ emptyText: { default: null },
2368
+ disableRowClick: { type: Boolean, default: !1 },
2369
+ disableDeleteConfirm: { type: Boolean, default: !1 },
2370
+ deleteConfirmTitle: { default: null },
2371
+ deleteConfirmText: { default: null },
2372
+ closeVariant: { default: "auto" },
2373
+ loadingKeys: { default: null },
2374
+ showReorderToggle: { type: Boolean, default: !0 },
2375
+ disableReorder: { type: Boolean, default: !1 },
2376
+ disableDrag: { type: Boolean, default: !1 },
2377
+ onDeleteConfirm: { type: Function, default: void 0 },
2378
+ onDelete: { type: Function, default: void 0 },
2379
+ onItemSave: { type: Function, default: void 0 },
2380
+ onReorderApply: { type: Function, default: void 0 }
2381
+ }, {
2382
+ modelValue: { required: !0 },
2383
+ modelModifiers: {},
2384
+ mode: { default: "view" },
2385
+ modeModifiers: {},
2386
+ unsavedKeys: {
2387
+ default: () => /* @__PURE__ */ new Set()
2388
+ },
2389
+ unsavedKeysModifiers: {}
2390
+ }),
2391
+ emits: /* @__PURE__ */ Ve(["add", "add-child", "edit", "deleted", "close", "item-saved", "item-expand", "reorder-start", "reorder-cancel", "reorder-applied", "reorder-apply-error", "reorder-end", "indent", "outdent"], ["update:modelValue", "update:mode", "update:unsavedKeys"]),
2392
+ setup(t, { expose: x, emit: v }) {
2393
+ const n = t, y = v, p = Ge(t, "modelValue"), h = Ge(t, "mode"), { t: b } = Je(), m = Zn(), c = Zt(), { showWarningT: I } = Nn(), D = $t("rootEl"), { isNarrow: O } = no(D), K = k(() => c.platform.value.touch), P = k(() => n.closeVariant === "icon" ? "icon" : n.closeVariant === "labeled" ? "labeled" : O.value ? "icon" : "labeled"), T = fe(/* @__PURE__ */ new Set()), U = fe(/* @__PURE__ */ new Set());
2394
+ ((e) => {
2395
+ const l = (a) => {
2396
+ for (const w of a)
2397
+ w.children && w.children.length > 0 && (T.value.add(w.data[n.keyField]), l(w.children));
2398
+ };
2399
+ l(e.children);
2400
+ })(p.value);
2401
+ const E = ml(p, {
2402
+ keyField: n.keyField,
2403
+ positionField: n.positionField,
2404
+ parentField: n.parentField,
2405
+ positionMultiplier: n.positionMultiplier,
2406
+ maxDepth: n.maxDepth,
2407
+ expandedKeys: T
2408
+ }), { captureDirtyBaseline: Q, rebaselineKey: C, isItemDirty: W } = On(
2409
+ () => {
2410
+ const e = [], l = (a) => {
2411
+ for (const w of a)
2412
+ e.push({ key: w.data[n.keyField], data: w.data }), w.children && w.children.length && l(w.children);
2413
+ };
2414
+ return l(p.value.children), e;
2415
+ },
2416
+ { excludeFields: [n.positionField, n.parentField] }
2417
+ ), V = Xt(null), S = fe(/* @__PURE__ */ new Set()), se = () => {
2418
+ Q(), S.value = /* @__PURE__ */ new Set();
2419
+ }, Y = (e) => {
2420
+ const { node: l } = E.findNode(e);
2421
+ if (!l) {
2422
+ S.value.add(e);
2423
+ return;
2424
+ }
2425
+ const a = (w) => {
2426
+ S.value.add(w.data[n.keyField]), w.children && w.children.forEach(a);
2427
+ };
2428
+ a(l);
2429
+ }, re = k(() => {
2430
+ const e = /* @__PURE__ */ new Set(), l = (a) => {
2431
+ for (const w of a) {
2432
+ const Z = w.data[n.keyField];
2433
+ W(Z, w.data) && e.add(Z), w.children?.length && l(w.children);
2434
+ }
2435
+ };
2436
+ return l(p.value.children), e;
2437
+ }), _ = /* @__PURE__ */ new Map(), ne = k(() => {
2438
+ const e = [], l = /* @__PURE__ */ new Set();
2439
+ for (const a of E.viewItems.value) {
2440
+ l.add(a.key);
2441
+ const w = q.value.has(a.key), Z = U.value.has(a.key), me = T.value.has(a.key), Re = n.loadingKeys?.has(a.key) ?? !1, Ne = S.value.has(a.key), ct = re.value.has(a.key), ut = ct || Ne, ue = _.get(a.key);
2442
+ if (ue && ue.raw === a.raw && ue.index === a.index && ue.position === a.position && ue.depth === a.depth && ue.parentKey === a.parentKey && ue.childrenCount === a.childrenCount && ue.firstInParent === a.firstInParent && ue.lastInParent === a.lastInParent && ue.editing === w && ue.expanded === Z && ue.childrenExpanded === me && ue.loading === Re && ue.dirty === ct && ue.moved === Ne && ue.unsaved === ut) {
2443
+ e.push(ue);
2444
+ continue;
2445
+ }
2446
+ const Jt = {
2447
+ ...a,
2448
+ editing: w,
2449
+ expanded: Z,
2450
+ childrenExpanded: me,
2451
+ loading: Re,
2452
+ dirty: ct,
2453
+ moved: Ne,
2454
+ unsaved: ut
2455
+ };
2456
+ _.set(a.key, Jt), e.push(Jt);
2457
+ }
2458
+ for (const a of _.keys())
2459
+ l.has(a) || _.delete(a);
2460
+ return e;
2461
+ }), $ = k(() => p.value.children.length === 0), f = k(() => E.viewItems.value.length), r = $t("rowsContainer"), A = k(() => !n.readonly && !n.disabled && !n.loading), F = k(
2462
+ () => A.value && !n.disableReorder && f.value > 1
2463
+ ), j = k(() => !!m.item), H = k(() => !!m["item-readonly"]), le = k(() => !!n.onItemSave), {
2464
+ editingKeys: q,
2465
+ editingSnapshots: ce,
2466
+ clearEditing: de,
2467
+ beginEdit: ve,
2468
+ cancelEdit: Le,
2469
+ commitEdit: $e,
2470
+ closeEdit: ke,
2471
+ requestAutoOpen: ye
2472
+ } = Un({
2473
+ rowsContainer: r,
2474
+ rowSelector: ".a-le-row-wrapper",
2475
+ isInlineEdit: j,
2476
+ restoreSnapshot: (e, l) => E.updateItem(e, l),
2477
+ watchKeys: () => {
2478
+ const e = [], l = (a) => {
2479
+ for (const w of a)
2480
+ e.push(w.data[n.keyField]), w.children && w.children.length && l(w.children);
2481
+ };
2482
+ return l(p.value.children), e;
2483
+ },
2484
+ findEntry: (e) => {
2485
+ const { node: l } = E.findNode(e);
2486
+ return l ? { data: l.data } : null;
2487
+ },
2488
+ afterAutoOpen: (e) => {
2489
+ const { parent: l } = E.findNode(e);
2490
+ l && T.value.add(l.data[n.keyField]);
2491
+ }
2492
+ }), {
2493
+ applying: we,
2494
+ applyError: Fe,
2495
+ hasPendingChanges: Be,
2496
+ movedCount: yt,
2497
+ reorderMode: ge,
2498
+ enterReorderMode: Ze,
2499
+ cancelReorderMode: We,
2500
+ applyReorder: ot
2501
+ } = ao({
2502
+ mode: h,
2503
+ snapshot: V,
2504
+ movedKeys: S,
2505
+ modelValue: p,
2506
+ cloneModel: (e) => Ce(e),
2507
+ applyModel: (e) => {
2508
+ p.value = e;
2509
+ },
2510
+ canEnterReorder: F,
2511
+ onEnter: () => {
2512
+ de();
2513
+ for (const e of Me.value) T.value.add(e);
2514
+ Oe(() => {
2515
+ Ie.value && ze();
2516
+ });
2517
+ },
2518
+ onExternalEnter: () => {
2519
+ de();
2520
+ },
2521
+ onCancel: () => {
2522
+ u();
2523
+ },
2524
+ onApplyEnd: () => {
2525
+ u();
2526
+ },
2527
+ onReorderApply: (e) => n.onReorderApply?.(e),
2528
+ emit: {
2529
+ reorderStart: () => y("reorder-start"),
2530
+ reorderCancel: () => y("reorder-cancel"),
2531
+ reorderApplied: (e) => y("reorder-applied", e),
2532
+ reorderApplyError: (e) => y("reorder-apply-error", e),
2533
+ reorderEnd: () => y("reorder-end")
2534
+ }
2535
+ }), lt = k(() => A.value && n.showAddButton && !ge.value), Ie = k(() => ge.value && !K.value && !n.disableDrag), _e = k(() => n.addLabel ?? b("common.sortable.add")), ht = k(() => n.emptyTitle ?? b("common.sortable.emptyTitle")), pt = k(() => n.emptyText ?? b("common.sortable.emptyText")), et = k(
2536
+ () => n.deleteConfirmTitle ?? b("common.sortable.deleteConfirmTitle")
2537
+ ), Ye = k(
2538
+ () => n.deleteConfirmText ?? b("common.sortable.deleteConfirmText")
2539
+ ), gt = k(
2540
+ () => !n.readonly && n.showReorderToggle && !ge.value && f.value > 0
2541
+ ), De = k(() => !!n.title && O.value), Me = k(() => {
2542
+ const e = [], l = (a) => {
2543
+ for (const w of a)
2544
+ w.children && w.children.length > 0 && (e.push(w.data[n.keyField]), l(w.children));
2545
+ };
2546
+ return l(p.value.children), e;
2547
+ }), Xe = k(
2548
+ () => Me.value.length > 0 && Me.value.every((e) => T.value.has(e))
2549
+ ), it = k(
2550
+ () => !ge.value && Me.value.length > 0
2551
+ ), bt = () => {
2552
+ if (Xe.value)
2553
+ for (const e of Me.value) T.value.delete(e);
2554
+ else
2555
+ for (const e of Me.value) T.value.add(e);
2556
+ }, Rt = k(
2557
+ () => !!(n.title || m.header || m["reorder-toggle"] || gt.value || it.value || ge.value)
2558
+ ), o = fe([]), N = fe(0), u = () => {
2559
+ for (const e of o.value)
2560
+ try {
2561
+ e.stop();
2562
+ } catch {
2563
+ }
2564
+ o.value = [];
2565
+ }, ie = fe(null), kt = (e, l) => {
2566
+ const a = document.elementFromPoint(e, l);
2567
+ if (!a) return null;
2568
+ const w = a.closest(".a-le-row-wrapper");
2569
+ if (!w || !r.value || !r.value.contains(w)) return null;
2570
+ const Z = an(w.getAttribute("data-id"));
2571
+ if (Z === null) return null;
2572
+ const me = ne.value.find((Re) => Re.key === Z);
2573
+ return me ? { el: w, viewItem: me } : null;
2574
+ }, tt = (e, l) => {
2575
+ if (!ie.value || !r.value) return;
2576
+ const a = kt(e, l);
2577
+ if (!a) {
2578
+ ie.value.instruction = null;
2579
+ return;
2580
+ }
2581
+ const w = r.value.getBoundingClientRect(), me = (a.el.querySelector(":scope > .a-le-row") ?? a.el).getBoundingClientRect();
2582
+ ie.value.instruction = hl({
2583
+ pointer: { x: e, y: l },
2584
+ hoveredRow: {
2585
+ key: a.viewItem.key,
2586
+ rect: me,
2587
+ depth: a.viewItem.depth,
2588
+ parentKey: a.viewItem.parentKey,
2589
+ siblingIndex: a.viewItem.siblingIndex,
2590
+ siblingCount: a.viewItem.siblingCount
2591
+ },
2592
+ sourceKey: ie.value.sourceKey,
2593
+ sourceSubtreeDepth: ie.value.sourceSubtreeDepth,
2594
+ viewItems: ne.value,
2595
+ maxDepth: n.maxDepth,
2596
+ indentPx: bn,
2597
+ containerLeft: w.left,
2598
+ containerPaddingLeft: kn
2599
+ });
2600
+ }, nt = (e) => {
2601
+ tt(e.clientX, e.clientY);
2602
+ }, Te = (e, l) => {
2603
+ if (E.moveTo(l, e.parentKey, e.index) === null) {
2604
+ I("common.sortable.error.maxDeepExceed"), N.value++, Oe(() => ze());
2605
+ return;
2606
+ }
2607
+ Y(l), e.makeChild && e.parentKey !== null && T.value.add(e.parentKey);
2608
+ }, ze = () => {
2609
+ if (u(), !Ie.value || !r.value) return;
2610
+ const e = Array.from(r.value.querySelectorAll("." + gn));
2611
+ for (const l of e) {
2612
+ const a = io(l, [], {
2613
+ group: { name: "a-nested", pull: !0, put: !0 },
2614
+ handle: "." + Gl,
2615
+ animation: 0,
2616
+ ghostClass: co,
2617
+ chosenClass: ro,
2618
+ dragClass: so,
2619
+ fallbackOnBody: !0,
2620
+ forceFallback: !0,
2621
+ fallbackTolerance: 3,
2622
+ onStart: (w) => {
2623
+ const Z = w.item, me = an(Z.getAttribute("data-id"));
2624
+ if (me === null) return;
2625
+ const Re = E.findNode(me).node, Ne = Re ? E.calculateSubtreeDepth(Re) : 1;
2626
+ ie.value = {
2627
+ sourceKey: me,
2628
+ sourceSubtreeDepth: Ne,
2629
+ instruction: null
2630
+ }, document.addEventListener("pointermove", nt, { passive: !0 });
2631
+ },
2632
+ onMove: (w) => {
2633
+ const Z = w.originalEvent;
2634
+ if (Z) {
2635
+ if ("clientX" in Z && "clientY" in Z)
2636
+ tt(Z.clientX, Z.clientY);
2637
+ else if ("touches" in Z) {
2638
+ const me = Z;
2639
+ me.touches.length > 0 && tt(me.touches[0].clientX, me.touches[0].clientY);
2640
+ }
2641
+ }
2642
+ return !1;
2643
+ },
2644
+ onEnd: () => {
2645
+ document.removeEventListener("pointermove", nt);
2646
+ const w = ie.value;
2647
+ if (ie.value = null, !w) return;
2648
+ const Z = w.instruction;
2649
+ Z !== null && Z.type !== "blocked" && Te(Z, w.sourceKey);
2650
+ }
2651
+ });
2652
+ o.value.push(a);
2653
+ }
2654
+ }, an = (e) => {
2655
+ if (e === null || e === "") return null;
2656
+ const l = uo(e);
2657
+ return l > 0 ? l : e;
2658
+ };
2659
+ Pe(
2660
+ () => Ie.value,
2661
+ () => {
2662
+ Ie.value ? Oe(() => ze()) : u();
2663
+ }
2664
+ ), Pe(
2665
+ () => N.value,
2666
+ () => {
2667
+ Ie.value && Oe(() => ze());
2668
+ }
2669
+ ), Pe(
2670
+ () => ne.value.map((e) => e.key).join("|"),
2671
+ () => {
2672
+ Ie.value && Oe(() => ze());
2673
+ }
2674
+ ), Qt(() => {
2675
+ Ie.value && ze();
2676
+ }), ea(() => {
2677
+ u(), document.removeEventListener("pointermove", nt);
2678
+ });
2679
+ const je = k(() => {
2680
+ const e = ie.value;
2681
+ if (!e || e.instruction === null || !r.value) return null;
2682
+ const l = e.instruction;
2683
+ if (l.type === "blocked") return null;
2684
+ const a = r.value.querySelector(
2685
+ `.a-le-row-wrapper[data-id="${CSS.escape(String(l.refKey))}"]`
2686
+ );
2687
+ if (!a) return null;
2688
+ const w = a.querySelector(":scope > .a-le-row"), Z = r.value.getBoundingClientRect(), me = (w ?? a).getBoundingClientRect(), Re = kn + l.depth * bn, Ne = l.refEdge === "top" ? me.top - Z.top : me.bottom - Z.top, ct = { top: Ne, left: Re, right: 16 };
2689
+ let ut = null;
2690
+ if (l.levelRowKey !== null) {
2691
+ const ue = r.value.querySelector(
2692
+ `.a-le-row-wrapper[data-id="${CSS.escape(String(l.levelRowKey))}"]`
2693
+ );
2694
+ if (ue) {
2695
+ const vn = (ue.querySelector(":scope > .a-le-row") ?? ue).getBoundingClientRect(), Wt = vn.top - Z.top + vn.height / 2;
2696
+ Wt < Ne && (ut = {
2697
+ top: Wt,
2698
+ height: Ne - Wt,
2699
+ left: Re
2700
+ });
2701
+ }
2702
+ }
2703
+ return { line: ct, connector: ut };
2704
+ }), st = () => {
2705
+ lt.value && (ye(), y("add", void 0));
2706
+ }, on = (e) => {
2707
+ A.value && (ye(), y("add", { afterId: e.key, childrenAllowed: e.childrenAllowed }));
2708
+ }, ln = (e) => {
2709
+ A.value && e.canAddChild && (ye(), T.value.add(e.key), y("add-child", e), y("add", { parentId: e.key, childrenAllowed: !0 }));
2710
+ }, wt = (e) => {
2711
+ if (!(!A.value || ge.value)) {
2712
+ if (q.value.has(e.key)) {
2713
+ rt(e);
2714
+ return;
2715
+ }
2716
+ j.value && ve(e), y("edit", e);
2717
+ }
2718
+ }, Kt = (e) => {
2719
+ if (n.disabled || n.loading) return;
2720
+ const l = e.key, a = T.value.has(l);
2721
+ a ? T.value.delete(l) : T.value.add(l), y("item-expand", e, !a);
2722
+ }, sn = (e) => {
2723
+ if (n.disabled || n.loading) return;
2724
+ const l = e.key, a = U.value.has(l);
2725
+ a ? U.value.delete(l) : U.value.add(l), y("item-expand", e, !a);
2726
+ }, rn = (e) => n.disableRowClick || n.disabled || n.loading || ge.value ? !1 : !!(e.editing || e.expanded || !n.readonly && n.showEditButton || n.readonly && H.value), sa = (e) => {
2727
+ if (rn(e)) {
2728
+ if (e.editing || e.expanded) {
2729
+ rt(e);
2730
+ return;
2731
+ }
2732
+ n.readonly && H.value ? sn(e) : wt(e);
2733
+ }
2734
+ }, {
2735
+ deleteDialog: Vt,
2736
+ deleteInFlight: ra,
2737
+ deleteError: da,
2738
+ onDeleteClick: ca,
2739
+ onDeleteDialogConfirm: ua,
2740
+ onDeleteDialogCancel: fa
2741
+ } = Gn({
2742
+ onDeleteConfirm: (e) => n.onDeleteConfirm ? n.onDeleteConfirm(e) : !0,
2743
+ onDelete: (e) => n.onDelete?.(e),
2744
+ onDeleted: (e) => {
2745
+ E.deleteItem(e.key), q.value.delete(e.key), ce.value.delete(e.key), U.value.delete(e.key), T.value.delete(e.key), y("deleted", e);
2746
+ },
2747
+ disableDeleteConfirm: () => n.disableDeleteConfirm
2748
+ }), dn = async (e) => {
2749
+ A.value && await ca(e);
2750
+ }, cn = async (e) => {
2751
+ n.onItemSave && await n.onItemSave(e.raw), $e(e), y("item-saved", e);
2752
+ }, un = (e) => {
2753
+ Le(e);
2754
+ }, rt = (e) => {
2755
+ ke(e), y("close", e);
2756
+ }, Lt = (e) => {
2757
+ E.moveUp(e) && Y(e);
2758
+ }, Mt = (e) => {
2759
+ E.moveDown(e) && Y(e);
2760
+ }, zt = (e) => {
2761
+ E.moveTop(e) && Y(e);
2762
+ }, Nt = (e) => {
2763
+ E.moveBottom(e) && Y(e);
2764
+ }, Ot = (e) => {
2765
+ if (E.indent(e.key) === null) {
2766
+ I("common.sortable.error.maxDeepExceed");
2767
+ return;
2768
+ }
2769
+ Y(e.key), y("indent", e);
2770
+ }, Ut = (e) => {
2771
+ E.outdent(e.key) !== null && (Y(e.key), y("outdent", e));
2772
+ }, jt = (e, l) => Xn(e, l, {
2773
+ compactField: n.compactField,
2774
+ fallback: b("common.sortable.itemFallback")
2775
+ }), { resolveValidation: fn } = qn({
2776
+ getValidationState: (e, l, a) => n.getValidationState?.(e, l, a) ?? null
2777
+ }), dt = /* @__PURE__ */ new Map(), ma = (e) => {
2778
+ let l = dt.get(e);
2779
+ return l || (l = {
2780
+ edit: () => {
2781
+ const a = he(e);
2782
+ a && wt(a);
2783
+ },
2784
+ save: () => {
2785
+ const a = he(e);
2786
+ if (a) return cn(a);
2787
+ },
2788
+ cancel: () => {
2789
+ const a = he(e);
2790
+ a && un(a);
2791
+ },
2792
+ close: () => {
2793
+ const a = he(e);
2794
+ a && rt(a);
2795
+ },
2796
+ delete: async () => {
2797
+ const a = he(e);
2798
+ a && await dn(a);
2799
+ },
2800
+ addAfter: () => {
2801
+ const a = he(e);
2802
+ a && on(a);
2803
+ },
2804
+ addChild: () => {
2805
+ const a = he(e);
2806
+ a && ln(a);
2807
+ },
2808
+ toggleExpand: () => {
2809
+ const a = he(e);
2810
+ a && Kt(a);
2811
+ },
2812
+ toggleDetail: () => {
2813
+ const a = he(e);
2814
+ a && sn(a);
2815
+ },
2816
+ moveUp: () => Lt(e),
2817
+ moveDown: () => Mt(e),
2818
+ moveTop: () => zt(e),
2819
+ moveBottom: () => Nt(e),
2820
+ indent: () => {
2821
+ const a = he(e);
2822
+ a && Ot(a);
2823
+ },
2824
+ outdent: () => {
2825
+ const a = he(e);
2826
+ a && Ut(a);
2827
+ },
2828
+ update: (a) => E.updateItem(e, a)
2829
+ }, dt.set(e, l)), l;
2830
+ };
2831
+ Pe(
2832
+ () => ne.value,
2833
+ (e) => {
2834
+ if (dt.size === 0) return;
2835
+ const l = new Set(e.map((a) => a.key));
2836
+ for (const a of dt.keys())
2837
+ l.has(a) || dt.delete(a);
2838
+ }
2839
+ );
2840
+ const va = (e) => ({
2841
+ item: { ...e, validationState: fn(e.raw, e.key, e.index) },
2842
+ raw: e.raw,
2843
+ index: e.index,
2844
+ key: e.key,
2845
+ depth: e.depth,
2846
+ parent: e.parent,
2847
+ parentKey: e.parentKey,
2848
+ childrenCount: e.childrenCount,
2849
+ hasChildren: e.hasChildren,
2850
+ childrenAllowed: e.childrenAllowed,
2851
+ firstInParent: e.firstInParent,
2852
+ lastInParent: e.lastInParent,
2853
+ readonly: n.readonly,
2854
+ disabled: n.disabled,
2855
+ expanded: e.expanded,
2856
+ childrenExpanded: e.childrenExpanded,
2857
+ editing: e.editing,
2858
+ dirty: e.dirty,
2859
+ unsaved: e.unsaved,
2860
+ moved: e.moved,
2861
+ reorderMode: ge.value,
2862
+ canMoveUp: !e.firstInParent,
2863
+ canMoveDown: !e.lastInParent,
2864
+ canIndent: e.canIndent,
2865
+ canOutdent: e.canOutdent,
2866
+ canAddChild: e.canAddChild,
2867
+ touch: K.value,
2868
+ actions: ma(e.key)
2869
+ }), ya = k(() => ({
2870
+ applying: we.value,
2871
+ hasPendingChanges: Be.value,
2872
+ movedCount: yt.value,
2873
+ error: Fe.value,
2874
+ actions: {
2875
+ apply: ot,
2876
+ cancel: We
2877
+ }
2878
+ })), mn = k(() => ({
2879
+ mode: h.value,
2880
+ disabled: !F.value,
2881
+ hasPendingChanges: Be.value,
2882
+ actions: {
2883
+ enterReorderMode: Ze,
2884
+ exitReorderMode: We
2885
+ }
2886
+ })), ha = k(() => new Set(Me.value)), he = (e) => ne.value.find((l) => l.key === e), Ct = jn({
2887
+ viewItems: k(
2888
+ () => ne.value.map((e) => ({
2889
+ key: e.key,
2890
+ expanded: e.childrenExpanded,
2891
+ canExpand: ha.value.has(e.key),
2892
+ canIndent: !0,
2893
+ canOutdent: !0
2894
+ }))
2895
+ ),
2896
+ variant: "nested",
2897
+ isReorderMode: ge,
2898
+ disabled: k(() => !A.value),
2899
+ isEditing: (e) => q.value.has(e),
2900
+ onToggleEdit: (e) => {
2901
+ const l = he(e);
2902
+ l && wt(l);
2903
+ },
2904
+ onCancelEdit: (e) => {
2905
+ const l = he(e);
2906
+ l && rt(l);
2907
+ },
2908
+ onMoveUp: (e) => Lt(e),
2909
+ onMoveDown: (e) => Mt(e),
2910
+ onMoveTop: (e) => zt(e),
2911
+ onMoveBottom: (e) => Nt(e),
2912
+ onIndent: (e) => {
2913
+ const l = he(e);
2914
+ l && Ot(l);
2915
+ },
2916
+ onOutdent: (e) => {
2917
+ const l = he(e);
2918
+ l && Ut(l);
2919
+ },
2920
+ onToggleChildren: (e) => {
2921
+ const l = he(e);
2922
+ l && Kt(l);
2923
+ },
2924
+ onCancelReorder: () => We()
2925
+ }), qt = fe(!1), Qe = Xt(null), Gt = k(() => {
2926
+ const e = Qe.value;
2927
+ if (!e) return null;
2928
+ const l = E.findNode(e.key), a = l.parent?.children ?? p.value.children, w = a.findIndex((Z) => Z.data[n.keyField] === e.key);
2929
+ return {
2930
+ parentId: l.parent ? l.parent.data[n.keyField] : null,
2931
+ total: a.length,
2932
+ currentIndex: w
2933
+ };
2934
+ }), pa = k(
2935
+ () => Qe.value ? jt(Qe.value.raw, Qe.value.key) : ""
2936
+ ), ga = (e) => {
2937
+ n.showMoveToPosition && (Qe.value = e, qt.value = !0);
2938
+ }, ba = (e) => {
2939
+ const l = Gt.value, a = Qe.value;
2940
+ Qe.value = null, !(!l || !a) && e !== l.currentIndex && E.moveTo(a.key, l.parentId, e) && Y(a.key);
2941
+ }, Ht = fe(!1), xt = Xt(null), ka = (e) => {
2942
+ n.showChangeParent && (xt.value = e, Ht.value = !0);
2943
+ }, wa = (e, l) => {
2944
+ const a = xt.value;
2945
+ if (xt.value = null, !a) return;
2946
+ let w = 0;
2947
+ e === null ? w = p.value.children.length : w = E.findNode(e).node?.children?.length ?? 0;
2948
+ const Z = l === "first" ? 0 : w;
2949
+ E.moveTo(a.key, e, Z) && (Y(a.key), e !== null && T.value.add(e));
2950
+ }, Ca = k(() => ({
2951
+ reorderMode: ge.value,
2952
+ canInteract: A.value,
2953
+ dragEnabled: Ie.value,
2954
+ showExpandToggle: n.showExpandToggle,
2955
+ showEditButton: n.showEditButton,
2956
+ showDeleteButton: n.showDeleteButton,
2957
+ showAddChildButton: n.showAddChildButton,
2958
+ showAddAfterAction: n.showAddAfterAction,
2959
+ showMoveToPosition: n.showMoveToPosition,
2960
+ showChangeParent: n.showChangeParent,
2961
+ showInlineSaveFooter: le.value,
2962
+ statusField: n.statusField,
2963
+ effectiveCloseVariant: P.value,
2964
+ keyboardNav: Ct,
2965
+ isRowClickable: rn,
2966
+ resolveCompactText: jt,
2967
+ resolveValidation: (e, l, a) => fn(e, l, a),
2968
+ buildSlotProps: va
2969
+ })), xa = {
2970
+ onRowClick: sa,
2971
+ onChevronClick: Kt,
2972
+ onEditClick: wt,
2973
+ onDeleteClick: dn,
2974
+ onCloseClick: rt,
2975
+ onSaveClick: cn,
2976
+ onCancelClick: un,
2977
+ onAddAfterClick: on,
2978
+ onAddChildClick: ln,
2979
+ moveUp: (e) => Lt(e),
2980
+ moveDown: (e) => Mt(e),
2981
+ moveTop: (e) => zt(e),
2982
+ moveBottom: (e) => Nt(e),
2983
+ indent: Ot,
2984
+ outdent: Ut,
2985
+ openMoveToPosition: ga,
2986
+ openChangeParent: ka
2987
+ }, Aa = k(() => ne.value.filter((e) => e.parentKey === null)), Sa = (e, l, a) => {
2988
+ const w = E.addItem(l, { afterId: e ?? void 0, childrenAllowed: a });
2989
+ return Oe(() => Q()), w;
2990
+ }, Pa = (e, l, a) => {
2991
+ T.value.add(e);
2992
+ const w = E.addItem(l, { parentId: e, asFirstChild: !0, childrenAllowed: a });
2993
+ return Oe(() => Q()), w;
2994
+ }, Ia = (e) => {
2995
+ E.deleteItem(e), q.value.delete(e), ce.value.delete(e), U.value.delete(e), T.value.delete(e), Oe(() => Q());
2996
+ }, Da = (e, l, a = null, w = null, Z = null) => {
2997
+ E.updateItem(e, l), Oe(() => Q());
2998
+ }, Ta = Ge(t, "unsavedKeys"), Ea = k(() => {
2999
+ const e = /* @__PURE__ */ new Set();
3000
+ for (const l of ne.value)
3001
+ l.unsaved && e.add(l.key);
3002
+ return e;
3003
+ }), { hasUnsavedChanges: $a, unsavedCount: Fa, clearUnsavedState: Ba } = Hn({
3004
+ unsavedKeysModel: Ta,
3005
+ internalUnsavedKeys: Ea,
3006
+ onClearAll: () => {
3007
+ Q(), S.value = /* @__PURE__ */ new Set();
3008
+ },
3009
+ onClearKey: (e) => {
3010
+ C(e), S.value.delete(e);
3011
+ }
3012
+ });
3013
+ return x({
3014
+ addItem: E.addItem,
3015
+ addAfterId: Sa,
3016
+ addChildToId: Pa,
3017
+ removeById: Ia,
3018
+ updateData: Da,
3019
+ updateItem: E.updateItem,
3020
+ deleteItem: E.deleteItem,
3021
+ moveUp: E.moveUp,
3022
+ moveDown: E.moveDown,
3023
+ moveTop: E.moveTop,
3024
+ moveBottom: E.moveBottom,
3025
+ indent: E.indent,
3026
+ outdent: E.outdent,
3027
+ moveTo: E.moveTo,
3028
+ recalculatePositions: E.recalculatePositions,
3029
+ viewItems: E.viewItems,
3030
+ resetDirtyBaseline: se,
3031
+ hasUnsavedChanges: $a,
3032
+ unsavedCount: Fa,
3033
+ clearUnsavedState: Ba,
3034
+ enterReorderMode: Ze,
3035
+ cancelReorderMode: We,
3036
+ applyReorder: ot,
3037
+ // Tree children visibility (expand/collapse a branch)
3038
+ expand: (e) => T.value.add(e),
3039
+ collapse: (e) => T.value.delete(e),
3040
+ toggleExpand: (e) => {
3041
+ T.value.has(e) ? T.value.delete(e) : T.value.add(e);
3042
+ },
3043
+ // Row readonly-detail body visibility
3044
+ expandDetail: (e) => U.value.add(e),
3045
+ collapseDetail: (e) => U.value.delete(e)
3046
+ }), (e, l) => (g(), M("div", {
3047
+ ref_key: "rootEl",
3048
+ ref: D,
3049
+ class: xe(["a-nested-list-editor", [
3050
+ `a-nested-list-editor--mode-${h.value}`,
3051
+ {
3052
+ "a-nested-list-editor--readonly": t.readonly,
3053
+ "a-nested-list-editor--disabled": t.disabled,
3054
+ "a-nested-list-editor--touch": K.value,
3055
+ "a-nested-list-editor--drag-enabled": Ie.value
3056
+ }
3057
+ ]])
3058
+ }, [
3059
+ z("div", Ll, [
3060
+ Rt.value ? (g(), M("div", Ml, [
3061
+ L(e.$slots, "header", oe({ title: t.title }, mn.value), () => [
3062
+ t.title ? (g(), M("h3", zl, B(t.title), 1)) : G("", !0),
3063
+ z("div", Nl, [
3064
+ d(ge) ? L(e.$slots, "reorder-toolbar", Ke(oe({ key: 0 }, ya.value)), () => [
3065
+ i(oo, {
3066
+ class: xe({ "a-le-toolbar-status--pending": d(Be) }),
3067
+ "has-pending-changes": d(Be),
3068
+ "pending-count": d(yt),
3069
+ error: d(Fe)
3070
+ }, null, 8, ["class", "has-pending-changes", "pending-count", "error"]),
3071
+ i(ee, {
3072
+ variant: "text",
3073
+ size: "small",
3074
+ disabled: d(we),
3075
+ onClick: d(We)
3076
+ }, {
3077
+ default: s(() => [
3078
+ J(B(d(b)("common.sortable.reorderCancel")), 1)
3079
+ ]),
3080
+ _: 1
3081
+ }, 8, ["disabled", "onClick"]),
3082
+ i(ee, {
3083
+ color: "primary",
3084
+ variant: "flat",
3085
+ size: "small",
3086
+ "prepend-icon": "mdi-check",
3087
+ loading: d(we),
3088
+ disabled: d(we) || !d(Be),
3089
+ onClick: d(ot)
3090
+ }, {
3091
+ default: s(() => [
3092
+ J(B(d(b)("common.sortable.reorderApply")), 1)
3093
+ ]),
3094
+ _: 1
3095
+ }, 8, ["loading", "disabled", "onClick"])
3096
+ ]) : (g(), M(be, { key: 1 }, [
3097
+ it.value && De.value ? (g(), X(ee, {
3098
+ key: 0,
3099
+ variant: "tonal",
3100
+ color: "primary",
3101
+ icon: "",
3102
+ size: "x-small",
3103
+ onClick: bt
3104
+ }, {
3105
+ default: s(() => [
3106
+ i(te, {
3107
+ icon: Xe.value ? "mdi-unfold-less-horizontal" : "mdi-unfold-more-horizontal",
3108
+ size: "18"
3109
+ }, null, 8, ["icon"]),
3110
+ i(Se, {
3111
+ activator: "parent",
3112
+ location: "bottom",
3113
+ text: Xe.value ? d(b)("common.sortable.collapseAll") : d(b)("common.sortable.expandAll")
3114
+ }, null, 8, ["text"])
3115
+ ]),
3116
+ _: 1
3117
+ })) : it.value ? (g(), X(ee, {
3118
+ key: 1,
3119
+ variant: "tonal",
3120
+ color: "primary",
3121
+ size: "small",
3122
+ "prepend-icon": Xe.value ? "mdi-unfold-less-horizontal" : "mdi-unfold-more-horizontal",
3123
+ onClick: bt
3124
+ }, {
3125
+ default: s(() => [
3126
+ J(B(Xe.value ? d(b)("common.sortable.collapseAll") : d(b)("common.sortable.expandAll")), 1)
3127
+ ]),
3128
+ _: 1
3129
+ }, 8, ["prepend-icon"])) : G("", !0),
3130
+ gt.value ? L(e.$slots, "reorder-toggle", Ke(oe({ key: 2 }, mn.value)), () => [
3131
+ De.value ? (g(), X(ee, {
3132
+ key: 0,
3133
+ variant: "tonal",
3134
+ color: "primary",
3135
+ icon: "",
3136
+ size: "x-small",
3137
+ disabled: !F.value,
3138
+ onClick: d(Ze)
3139
+ }, {
3140
+ default: s(() => [
3141
+ i(te, {
3142
+ icon: "mdi-sort",
3143
+ size: "18"
3144
+ }),
3145
+ i(Se, {
3146
+ activator: "parent",
3147
+ location: "bottom",
3148
+ text: d(b)("common.sortable.reorder")
3149
+ }, null, 8, ["text"])
3150
+ ]),
3151
+ _: 1
3152
+ }, 8, ["disabled", "onClick"])) : (g(), X(ee, {
3153
+ key: 1,
3154
+ variant: "tonal",
3155
+ color: "primary",
3156
+ "prepend-icon": "mdi-sort",
3157
+ size: "small",
3158
+ disabled: !F.value,
3159
+ onClick: d(Ze)
3160
+ }, {
3161
+ default: s(() => [
3162
+ J(B(d(b)("common.sortable.reorder")), 1)
3163
+ ]),
3164
+ _: 1
3165
+ }, 8, ["disabled", "onClick"]))
3166
+ ]) : G("", !0)
3167
+ ], 64))
3168
+ ])
3169
+ ])
3170
+ ])) : G("", !0),
3171
+ t.loading ? (g(), M("div", Ol, [
3172
+ i(oa, {
3173
+ indeterminate: "",
3174
+ color: "primary",
3175
+ size: "32"
3176
+ })
3177
+ ])) : t.error ? (g(), M("div", Ul, [
3178
+ i(nn, {
3179
+ type: "error",
3180
+ variant: "tonal",
3181
+ density: "compact",
3182
+ border: "start"
3183
+ }, {
3184
+ default: s(() => [
3185
+ J(B(t.error), 1)
3186
+ ]),
3187
+ _: 1
3188
+ })
3189
+ ])) : $.value ? (g(), M("div", jl, [
3190
+ L(e.$slots, "empty", {
3191
+ readonly: t.readonly,
3192
+ disabled: t.disabled,
3193
+ actions: { add: st }
3194
+ }, () => [
3195
+ i(Jn, {
3196
+ title: ht.value,
3197
+ text: pt.value,
3198
+ "add-label": _e.value,
3199
+ "can-add": lt.value,
3200
+ onAdd: st
3201
+ }, null, 8, ["title", "text", "add-label", "can-add"])
3202
+ ])
3203
+ ])) : (g(), M("div", {
3204
+ key: N.value,
3205
+ ref_key: "rowsContainer",
3206
+ ref: r,
3207
+ class: xe(["a-nested-list-editor__rows", { "a-nested-list-editor__rows--dragging": ie.value !== null }])
3208
+ }, [
3209
+ z("div", {
3210
+ class: xe([gn, "a-nested-list-editor__group--root"]),
3211
+ "data-parent-id": ""
3212
+ }, [
3213
+ (g(!0), M(be, null, at(Aa.value, (a) => (g(), X(ia, {
3214
+ key: String(a.key),
3215
+ vi: a,
3216
+ "view-items": ne.value,
3217
+ "drag-state": ie.value,
3218
+ context: Ca.value,
3219
+ callbacks: xa
3220
+ }, {
3221
+ item: s((w) => [
3222
+ L(e.$slots, "item", oe({ ref_for: !0 }, w))
3223
+ ]),
3224
+ "item-compact": s((w) => [
3225
+ L(e.$slots, "item-compact", oe({ ref_for: !0 }, w))
3226
+ ]),
3227
+ "item-readonly": s((w) => [
3228
+ L(e.$slots, "item-readonly", oe({ ref_for: !0 }, w))
3229
+ ]),
3230
+ "item-status": s((w) => [
3231
+ L(e.$slots, "item-status", oe({ ref_for: !0 }, w))
3232
+ ]),
3233
+ "item-footer": s((w) => [
3234
+ L(e.$slots, "item-footer", oe({ ref_for: !0 }, w))
3235
+ ]),
3236
+ "item-actions": s((w) => [
3237
+ L(e.$slots, "item-actions", oe({ ref_for: !0 }, w))
3238
+ ]),
3239
+ "before-item": s((w) => [
3240
+ L(e.$slots, "before-item", oe({ ref_for: !0 }, w))
3241
+ ]),
3242
+ "after-item": s((w) => [
3243
+ L(e.$slots, "after-item", oe({ ref_for: !0 }, w))
3244
+ ]),
3245
+ _: 3
3246
+ }, 8, ["vi", "view-items", "drag-state", "context"]))), 128))
3247
+ ], 2),
3248
+ je.value !== null ? (g(), M(be, { key: 0 }, [
3249
+ je.value.connector !== null ? (g(), M("div", {
3250
+ key: 0,
3251
+ class: "a-nested-list-editor__drop-connector",
3252
+ style: mt({
3253
+ left: `${je.value.connector.left}px`,
3254
+ top: `${je.value.connector.top}px`,
3255
+ height: `${je.value.connector.height}px`
3256
+ })
3257
+ }, null, 4)) : G("", !0),
3258
+ z("div", {
3259
+ class: "a-nested-list-editor__drop-line",
3260
+ style: mt({
3261
+ top: `${je.value.line.top}px`,
3262
+ left: `${je.value.line.left}px`,
3263
+ right: `${je.value.line.right}px`
3264
+ })
3265
+ }, [...l[3] || (l[3] = [
3266
+ z("span", { class: "a-nested-list-editor__drop-line-dot" }, null, -1)
3267
+ ])], 4)
3268
+ ], 64)) : G("", !0)
3269
+ ], 2)),
3270
+ lt.value && !t.loading && !t.error && !$.value ? L(e.$slots, "add-button", {
3271
+ key: 5,
3272
+ readonly: t.readonly,
3273
+ disabled: t.disabled,
3274
+ props: { onClick: st },
3275
+ actions: { add: st }
3276
+ }, () => [
3277
+ z("button", {
3278
+ type: "button",
3279
+ class: "a-le-row-add",
3280
+ onClick: st
3281
+ }, [
3282
+ i(te, {
3283
+ icon: "mdi-plus",
3284
+ size: "18"
3285
+ }),
3286
+ z("span", null, B(_e.value), 1)
3287
+ ])
3288
+ ]) : G("", !0)
3289
+ ]),
3290
+ i(lo, {
3291
+ modelValue: qt.value,
3292
+ "onUpdate:modelValue": l[0] || (l[0] = (a) => qt.value = a),
3293
+ total: Gt.value?.total ?? 0,
3294
+ "current-index": Gt.value?.currentIndex ?? 0,
3295
+ "item-label": pa.value,
3296
+ onConfirm: ba
3297
+ }, null, 8, ["modelValue", "total", "current-index", "item-label"]),
3298
+ i(Vl, {
3299
+ modelValue: Ht.value,
3300
+ "onUpdate:modelValue": l[1] || (l[1] = (a) => Ht.value = a),
3301
+ tree: p.value,
3302
+ "source-key": xt.value?.key ?? null,
3303
+ "key-field": t.keyField,
3304
+ "max-depth": t.maxDepth,
3305
+ "resolve-label": jt,
3306
+ "calculate-subtree-depth": d(E).calculateSubtreeDepth,
3307
+ onConfirm: wa
3308
+ }, null, 8, ["modelValue", "tree", "source-key", "key-field", "max-depth", "calculate-subtree-depth"]),
3309
+ i(Yn, {
3310
+ modelValue: d(Vt),
3311
+ "onUpdate:modelValue": l[2] || (l[2] = (a) => _n(Vt) ? Vt.value = a : null),
3312
+ title: et.value,
3313
+ text: Ye.value,
3314
+ "confirm-label": d(b)("common.sortable.delete"),
3315
+ "cancel-label": d(b)("common.button.cancel"),
3316
+ error: d(da),
3317
+ "in-flight": d(ra),
3318
+ onConfirm: d(ua),
3319
+ onCancel: d(fa)
3320
+ }, null, 8, ["modelValue", "title", "text", "confirm-label", "cancel-label", "error", "in-flight", "onConfirm", "onCancel"]),
3321
+ z("div", ql, B(d(Ct).grabbedKey.value !== null ? d(b)("common.sortable.keyboardGrab.status", {
3322
+ n: d(Ct).grabbedIndex.value + 1,
3323
+ total: d(Ct).totalCount.value
3324
+ }) : ""), 1)
3325
+ ], 2));
3326
+ }
3327
+ }), xi = /* @__PURE__ */ He({
3328
+ __name: "AUnsavedConfirmDialog",
3329
+ props: /* @__PURE__ */ Ve({
3330
+ title: { default: void 0 },
3331
+ body: { default: void 0 },
3332
+ stayLabel: { default: void 0 },
3333
+ discardLabel: { default: void 0 }
3334
+ }, {
3335
+ modelValue: { type: Boolean, required: !0 },
3336
+ modelModifiers: {}
3337
+ }),
3338
+ emits: /* @__PURE__ */ Ve(["resolve"], ["update:modelValue"]),
3339
+ setup(t, { emit: x }) {
3340
+ const v = x, n = Ge(t, "modelValue"), { t: y } = Je(), p = () => {
3341
+ v("resolve", !1);
3342
+ }, h = () => {
3343
+ v("resolve", !0);
3344
+ };
3345
+ return (b, m) => (g(), X(en, {
3346
+ modelValue: n.value,
3347
+ "onUpdate:modelValue": m[0] || (m[0] = (c) => n.value = c),
3348
+ "max-width": "480",
3349
+ persistent: ""
3350
+ }, {
3351
+ default: s(() => [
3352
+ i(_t, null, {
3353
+ default: s(() => [
3354
+ i(na, null, {
3355
+ default: s(() => [
3356
+ J(B(t.title ?? d(y)("common.sortable.unsavedChanges.title")), 1)
3357
+ ]),
3358
+ _: 1
3359
+ }),
3360
+ i(Dt, null, {
3361
+ default: s(() => [
3362
+ J(B(t.body ?? d(y)("common.sortable.unsavedChanges.body")), 1)
3363
+ ]),
3364
+ _: 1
3365
+ }),
3366
+ i(aa, null, {
3367
+ default: s(() => [
3368
+ i(tn),
3369
+ i(ee, {
3370
+ variant: "text",
3371
+ onClick: p
3372
+ }, {
3373
+ default: s(() => [
3374
+ J(B(t.stayLabel ?? d(y)("common.sortable.unsavedChanges.stay")), 1)
3375
+ ]),
3376
+ _: 1
3377
+ }),
3378
+ i(ee, {
3379
+ color: "warning",
3380
+ variant: "elevated",
3381
+ onClick: h
3382
+ }, {
3383
+ default: s(() => [
3384
+ J(B(t.discardLabel ?? d(y)("common.sortable.unsavedChanges.discard")), 1)
3385
+ ]),
3386
+ _: 1
3387
+ })
3388
+ ]),
3389
+ _: 1
3390
+ })
3391
+ ]),
3392
+ _: 1
3393
+ })
3394
+ ]),
3395
+ _: 1
3396
+ }, 8, ["modelValue"]));
3397
+ }
3398
+ }), Hl = (t) => t == null ? !1 : typeof t == "boolean" ? t : t instanceof Set ? t.size > 0 : Array.isArray(t) ? t.length > 0 : !!t, wn = (t, x) => t === void 0 ? x : typeof t == "boolean" ? t : t.value;
3399
+ function Ai(t) {
3400
+ const x = k(
3401
+ () => t.sources.some((m) => Hl(m.value))
3402
+ ), v = fe(!1);
3403
+ let n = null, y = !1;
3404
+ const p = () => y ? (y = !1, Promise.resolve(!0)) : new Promise((m) => {
3405
+ n = m, v.value = !0;
3406
+ }), h = (m) => {
3407
+ v.value = !1, n && (n(m), n = null);
3408
+ }, b = () => {
3409
+ y = !0;
3410
+ };
3411
+ if (wn(t.guardRoute, !0) && yo())
3412
+ try {
3413
+ wo(async () => x.value ? await p() : !0);
3414
+ } catch {
3415
+ }
3416
+ if (wn(t.guardWindowUnload, !0)) {
3417
+ const m = (c) => {
3418
+ x.value && (c.preventDefault(), c.returnValue = "");
3419
+ };
3420
+ typeof window < "u" && (window.addEventListener("beforeunload", m), ea(() => {
3421
+ window.removeEventListener("beforeunload", m);
3422
+ }));
3423
+ }
3424
+ if (t.guardDialogModel) {
3425
+ const m = t.guardDialogModel;
3426
+ let c = !1;
3427
+ Pe(m, async (I, D) => {
3428
+ if (c) {
3429
+ c = !1;
3430
+ return;
3431
+ }
3432
+ D === !0 && I === !1 && x.value && (c = !0, m.value = !0, await p() && (c = !0, m.value = !1));
3433
+ });
3434
+ }
3435
+ return {
3436
+ hasUnsavedChanges: x,
3437
+ promptOpen: v,
3438
+ resolvePrompt: h,
3439
+ acknowledge: b
3440
+ };
3441
+ }
3442
+ function Si() {
3443
+ const t = fe(/* @__PURE__ */ new Map()), x = /* @__PURE__ */ new Set(), v = (h) => t.value.get(h) ?? x, n = (h, b) => {
3444
+ b.size === 0 ? t.value.delete(h) : t.value.set(h, b), t.value = new Map(t.value);
3445
+ }, y = k(() => {
3446
+ const h = /* @__PURE__ */ new Set();
3447
+ for (const [b, m] of t.value.entries())
3448
+ for (const c of m)
3449
+ h.add(`${String(b)}:${String(c)}`);
3450
+ return h;
3451
+ }), p = k(() => y.value.size);
3452
+ return { getForParent: v, setForParent: n, merged: y, count: p };
3453
+ }
717
3454
  export {
718
- la as ADatatableOrdering,
719
- St as ADatatablePagination,
720
- ga as AFilterBooleanSelect,
721
- va as AFilterDatetimePicker,
722
- ba as AFilterInteger,
723
- ha as AFilterRemoteAutocomplete,
724
- ya as AFilterRemoteAutocompleteWithMinimal,
725
- Ca as AFilterString,
726
- Aa as AFilterTimeInterval,
727
- Pa as AFilterValueObjectOptionsSelect,
728
- wa as AFilterWrapper,
729
- _a as AFilterWrapperSubjectSelect,
730
- xa as AFormRemoteAutocomplete,
731
- ma as ASubjectSelect,
732
- de as DatatablePaginationKey,
733
- ka as FilterConfigKey,
734
- Ta as FilterDataKey,
735
- Sa as FilterInnerConfigKey,
736
- Fa as FilterInnerDataKey,
737
- Ea as TimeIntervalSpecialOptions,
738
- Ba as UserAdminConfigLayoutType,
739
- Oa as UserAdminConfigLayoutTypeDefault,
740
- Da as UserAdminConfigType,
741
- Ia as UserAdminConfigTypeDefault,
742
- Ot as createDatatableColumnsConfig,
743
- Na as createFilter,
744
- Va as createFilterStore,
745
- oe as generateListQuery,
746
- ia as useApiFetchByIds,
747
- qe as useApiFetchList,
748
- ca as useApiFetchListBatch,
749
- je as useApiQueryBuilder,
750
- ja as useApiRequest,
751
- Ge as useFilterHelpers,
752
- ua as useJobApi,
753
- Se as usePagination,
754
- da as useSubjectSelect,
755
- La as useUserAdminConfigApi,
756
- Ra as useUserAdminConfigFactory
3455
+ yi as ADatatableOrdering,
3456
+ Eo as ADatatablePagination,
3457
+ Di as AFilterBooleanSelect,
3458
+ Ti as AFilterDatetimePicker,
3459
+ Ei as AFilterInteger,
3460
+ $i as AFilterRemoteAutocomplete,
3461
+ Fi as AFilterRemoteAutocompleteWithMinimal,
3462
+ Bi as AFilterString,
3463
+ Ri as AFilterTimeInterval,
3464
+ Ki as AFilterValueObjectOptionsSelect,
3465
+ Vi as AFilterWrapper,
3466
+ Li as AFilterWrapperSubjectSelect,
3467
+ Mi as AFormRemoteAutocomplete,
3468
+ wi as AListEditor,
3469
+ Ci as ANestedSortableListEditor,
3470
+ zi as ASortableListEditor,
3471
+ ki as ASubjectSelect,
3472
+ xi as AUnsavedConfirmDialog,
3473
+ Cn as DatatablePaginationKey,
3474
+ Ni as FilterConfigKey,
3475
+ Oi as FilterDataKey,
3476
+ Ui as FilterInnerConfigKey,
3477
+ ji as FilterInnerDataKey,
3478
+ qi as ListEditorValidationKey,
3479
+ Gi as SharedReorderRegistryKey,
3480
+ Hi as TimeIntervalSpecialOptions,
3481
+ Ji as UserAdminConfigLayoutType,
3482
+ Wi as UserAdminConfigLayoutTypeDefault,
3483
+ Yi as UserAdminConfigType,
3484
+ Xi as UserAdminConfigTypeDefault,
3485
+ Ro as createDatatableColumnsConfig,
3486
+ Qi as createFilter,
3487
+ Zi as createFilterStore,
3488
+ Yt as generateListQuery,
3489
+ hi as useApiFetchByIds,
3490
+ ja as useApiFetchList,
3491
+ pi as useApiFetchListBatch,
3492
+ Va as useApiQueryBuilder,
3493
+ _i as useApiRequest,
3494
+ Xa as useFilterHelpers,
3495
+ gi as useJobApi,
3496
+ _a as useListEditor,
3497
+ es as useListEditorItemValidation,
3498
+ ml as useNestedListEditor,
3499
+ Si as useNestedUnsavedKeys,
3500
+ zn as usePagination,
3501
+ bi as useSubjectSelect,
3502
+ Ai as useUnsavedChangesGuard,
3503
+ ts as useUserAdminConfigApi,
3504
+ ns as useUserAdminConfigFactory
757
3505
  };
758
3506
  //# sourceMappingURL=labs.js.map