@webx-ui/module-auth 0.6.3 → 0.7.2

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/index.js CHANGED
@@ -1,27 +1,27 @@
1
- import { inject as te, defineComponent as R, computed as P, ref as g, useTemplateRef as oe, onBeforeUnmount as ze, resolveComponent as B, openBlock as L, createBlock as S, withCtx as l, createVNode as t, withModifiers as Be, createCommentVNode as T, createElementVNode as N, createTextVNode as F, toDisplayString as $, watch as Z, unref as e, isRef as se, createElementBlock as O, resolveDynamicComponent as ge, createSlots as ne, Fragment as le, renderList as _e, h as xe, normalizeClass as Te } from "vue";
2
- import { useTranslate as I, HttpError as Me, useAdmin as q, useI18n as ke, useErrorText as re, WxDate as Ne, WxRowMenu as he, WxListScreen as Ee } from "@webx-ui/module-admin";
3
- import { useModal as ie, WxDialog as ue, WxFormItem as M, WxInput as E, WxSelect as X, WxSpace as Y, WxCheckbox as be, WxText as de, WxButton as D, toast as j, WxTable as Oe, WxBadge as ae, WxAvatar as De, createModal as ce, confirm as Re } from "@webx-ui/core";
4
- const Ve = /* @__PURE__ */ Symbol("webx-auth");
5
- function me() {
6
- const a = te(Ve, null);
1
+ import { inject as ue, defineComponent as j, computed as P, ref as V, useTemplateRef as ne, onBeforeUnmount as Be, resolveComponent as T, openBlock as x, createBlock as F, withCtx as t, createVNode as l, withModifiers as Te, createCommentVNode as M, createElementVNode as O, createTextVNode as $, toDisplayString as C, watch as re, unref as e, isRef as ce, createElementBlock as R, resolveDynamicComponent as Ve, createSlots as Ae, Fragment as oe, renderList as de, h as Ce, normalizeClass as Me } from "vue";
2
+ import { useTranslate as D, HttpError as Ee, useAdmin as X, useI18n as $e, useErrorText as ve, rowMenuWidth as Ne, WxDate as Oe, WxRowMenu as ge, WxFilterChips as Re, WxListScreen as De } from "@webx-ui/module-admin";
3
+ import { useModal as me, WxDialog as pe, WxFormItem as N, WxInput as K, WxSelect as se, WxSpace as ee, WxCheckbox as _e, WxText as fe, WxButton as Y, toast as Q, useElementWidth as Ie, WxTable as Ke, WxEntityCard as Ye, WxBadge as J, WxAvatar as je, WxIcon as qe, createModal as he, confirm as He } from "@webx-ui/core";
4
+ const Le = /* @__PURE__ */ Symbol("webx-auth");
5
+ function we() {
6
+ const a = ue(Le, null);
7
7
  if (a === null)
8
8
  throw new Error("useAuth() was called outside a panel that installed the auth plugin.");
9
9
  return a;
10
10
  }
11
- function Ie(a) {
12
- const i = `${a.apiPath}/auth`;
11
+ function Ge(a) {
12
+ const r = `${a.apiPath}/auth`;
13
13
  return {
14
14
  async me() {
15
15
  try {
16
- return (await a.http.get(`${i}/me`)).data;
16
+ return (await a.http.get(`${r}/me`)).data;
17
17
  } catch (s) {
18
- if (Ye(s))
18
+ if (Qe(s))
19
19
  return null;
20
20
  throw s;
21
21
  }
22
22
  },
23
23
  async login(s) {
24
- const o = await a.http.post(`${i}/login`, {
24
+ const o = await a.http.post(`${r}/login`, {
25
25
  email: s.email,
26
26
  password: s.password,
27
27
  remember: s.remember ?? !1
@@ -29,33 +29,33 @@ function Ie(a) {
29
29
  return a.setUser(o.data), await a.reload(), o.data;
30
30
  },
31
31
  async setLocale(s) {
32
- const o = await a.http.put(`${i}/locale`, { locale: s });
32
+ const o = await a.http.put(`${r}/locale`, { locale: s });
33
33
  a.setUser(o.data), await a.setLocale(s);
34
34
  },
35
35
  async updateProfile(s) {
36
36
  const o = await a.http.put(
37
- `${i}/me`,
37
+ `${r}/me`,
38
38
  s
39
39
  );
40
40
  return a.setUser(o.data), o.data;
41
41
  },
42
42
  async logout() {
43
43
  try {
44
- await a.http.post(`${i}/logout`);
44
+ await a.http.post(`${r}/logout`);
45
45
  } finally {
46
46
  a.setUser(null), a.state.status = "unauthenticated", a.state.manifest = null;
47
47
  }
48
48
  }
49
49
  };
50
50
  }
51
- const Ae = /* @__PURE__ */ Symbol("webx-auth-avatar"), Le = /* @__PURE__ */ Symbol("webx-auth-avatar-field");
52
- function Ke(a, i, s = null, o = null) {
53
- a.provide(Ve, i), a.provide(Ae, s), a.provide(Le, o);
51
+ const Ue = /* @__PURE__ */ Symbol("webx-auth-avatar"), Fe = /* @__PURE__ */ Symbol("webx-auth-avatar-field");
52
+ function Je(a, r, s = null, o = null) {
53
+ a.provide(Le, r), a.provide(Ue, s), a.provide(Fe, o);
54
54
  }
55
- function Ye(a) {
55
+ function Qe(a) {
56
56
  return typeof a == "object" && a !== null && "status" in a && a.status === 401;
57
57
  }
58
- const je = ["title", "aria-label", "aria-pressed"], qe = /* @__PURE__ */ R({
58
+ const Xe = ["title", "aria-label", "aria-pressed"], Ze = /* @__PURE__ */ j({
59
59
  __name: "LoginCard",
60
60
  props: {
61
61
  emailLabel: { default: void 0 },
@@ -70,171 +70,171 @@ const je = ["title", "aria-label", "aria-pressed"], qe = /* @__PURE__ */ R({
70
70
  autofocus: { type: Boolean, default: !0 }
71
71
  },
72
72
  emits: ["success"],
73
- setup(a, { expose: i, emit: s }) {
74
- const o = a, u = s, k = me(), m = I("webx-auth"), n = P(() => ({
75
- email: o.emailLabel ?? m("card.email"),
76
- password: o.passwordLabel ?? m("card.password"),
77
- remember: o.rememberLabel ?? m("card.remember"),
78
- submit: o.submitLabel ?? m("card.submit"),
79
- capsLock: o.capsLockWarning ?? m("card.caps-lock"),
80
- reveal: o.revealLabel ?? m("card.reveal"),
81
- hide: o.hideLabel ?? m("card.hide")
82
- })), p = g(""), C = g(""), V = g(!1), d = g(!1), w = g(!1), r = g(!1), b = g(""), _ = g({}), f = g(0), U = oe("emailField");
83
- let W = null;
84
- ze(H);
85
- const z = P(() => f.value > 0), h = P(
86
- () => o.throttleMessage === void 0 ? m("card.throttled", { seconds: f.value }) : o.throttleMessage.replace(":seconds", String(f.value))
73
+ setup(a, { expose: r, emit: s }) {
74
+ const o = a, i = s, A = we(), f = D("webx-auth"), v = P(() => ({
75
+ email: o.emailLabel ?? f("card.email"),
76
+ password: o.passwordLabel ?? f("card.password"),
77
+ remember: o.rememberLabel ?? f("card.remember"),
78
+ submit: o.submitLabel ?? f("card.submit"),
79
+ capsLock: o.capsLockWarning ?? f("card.caps-lock"),
80
+ reveal: o.revealLabel ?? f("card.reveal"),
81
+ hide: o.hideLabel ?? f("card.hide")
82
+ })), h = V(""), S = V(""), n = V(!1), m = V(!1), g = V(!1), u = V(!1), w = V(""), b = V({}), d = V(0), L = ne("emailField");
83
+ let U = null;
84
+ Be(Z);
85
+ const B = P(() => d.value > 0), y = P(
86
+ () => o.throttleMessage === void 0 ? f("card.throttled", { seconds: d.value }) : o.throttleMessage.replace(":seconds", String(d.value))
87
87
  );
88
- async function c() {
89
- if (!(d.value || z.value)) {
90
- d.value = !0, b.value = "", _.value = {};
88
+ async function p() {
89
+ if (!(m.value || B.value)) {
90
+ m.value = !0, w.value = "", b.value = {};
91
91
  try {
92
- await k.login({
93
- email: p.value,
94
- password: C.value,
95
- remember: V.value
96
- }), C.value = "", u("success");
97
- } catch (y) {
98
- x(y);
92
+ await A.login({
93
+ email: h.value,
94
+ password: S.value,
95
+ remember: n.value
96
+ }), S.value = "", i("success");
97
+ } catch (W) {
98
+ k(W);
99
99
  } finally {
100
- d.value = !1;
100
+ m.value = !1;
101
101
  }
102
102
  }
103
103
  }
104
- function x(y) {
105
- if (!(y instanceof Me)) {
106
- b.value = y instanceof Error ? y.message : String(y);
104
+ function k(W) {
105
+ if (!(W instanceof Ee)) {
106
+ w.value = W instanceof Error ? W.message : String(W);
107
107
  return;
108
108
  }
109
- if (y.isValidation) {
110
- _.value = y.errors;
109
+ if (W.isValidation) {
110
+ b.value = W.errors;
111
111
  return;
112
112
  }
113
- if (y.isThrottled) {
114
- Q(y.retryAfter ?? 60);
113
+ if (W.isThrottled) {
114
+ ie(W.retryAfter ?? 60);
115
115
  return;
116
116
  }
117
- b.value = y.message;
117
+ w.value = W.message;
118
118
  }
119
- function Q(y) {
120
- H(), f.value = y, W = setInterval(() => {
121
- f.value -= 1, f.value <= 0 && H();
119
+ function ie(W) {
120
+ Z(), d.value = W, U = setInterval(() => {
121
+ d.value -= 1, d.value <= 0 && Z();
122
122
  }, 1e3);
123
123
  }
124
- function H() {
125
- W !== null && (clearInterval(W), W = null), f.value = 0;
124
+ function Z() {
125
+ U !== null && (clearInterval(U), U = null), d.value = 0;
126
126
  }
127
- function A(y) {
128
- r.value = y.getModifierState("CapsLock");
127
+ function q(W) {
128
+ u.value = W.getModifierState("CapsLock");
129
129
  }
130
- return i({ focus: () => U.value?.focus() }), (y, v) => {
131
- const G = B("wx-alert"), ee = B("wx-icon"), fe = B("wx-input"), we = B("wx-form-item"), Fe = B("wx-checkbox"), Se = B("wx-button"), We = B("wx-form"), Pe = B("wx-card");
132
- return L(), S(Pe, {
130
+ return r({ focus: () => L.value?.focus() }), (W, E) => {
131
+ const te = T("wx-alert"), H = T("wx-icon"), le = T("wx-input"), _ = T("wx-form-item"), z = T("wx-checkbox"), c = T("wx-button"), I = T("wx-form"), Pe = T("wx-card");
132
+ return x(), F(Pe, {
133
133
  class: "wx-login",
134
134
  padding: 24
135
135
  }, {
136
- default: l(() => [
137
- t(We, {
138
- errors: _.value,
139
- disabled: d.value,
136
+ default: t(() => [
137
+ l(I, {
138
+ errors: b.value,
139
+ disabled: m.value,
140
140
  gap: "md",
141
- onSubmit: Be(c, ["prevent"])
141
+ onSubmit: Te(p, ["prevent"])
142
142
  }, {
143
- default: l(() => [
144
- b.value !== "" ? (L(), S(G, {
143
+ default: t(() => [
144
+ w.value !== "" ? (x(), F(te, {
145
145
  key: 0,
146
146
  type: "danger",
147
147
  variant: "soft",
148
148
  live: "",
149
- description: b.value,
149
+ description: w.value,
150
150
  class: "wx-login__message"
151
- }, null, 8, ["description"])) : z.value ? (L(), S(G, {
151
+ }, null, 8, ["description"])) : B.value ? (x(), F(te, {
152
152
  key: 1,
153
153
  type: "warning",
154
154
  variant: "soft",
155
155
  live: "",
156
- description: h.value,
156
+ description: y.value,
157
157
  class: "wx-login__message"
158
- }, null, 8, ["description"])) : T("", !0),
159
- t(we, { name: "email" }, {
160
- default: l(() => [
161
- t(fe, {
158
+ }, null, 8, ["description"])) : M("", !0),
159
+ l(_, { name: "email" }, {
160
+ default: t(() => [
161
+ l(le, {
162
162
  ref_key: "emailField",
163
- ref: U,
164
- modelValue: p.value,
165
- "onUpdate:modelValue": v[0] || (v[0] = (K) => p.value = K),
163
+ ref: L,
164
+ modelValue: h.value,
165
+ "onUpdate:modelValue": E[0] || (E[0] = (G) => h.value = G),
166
166
  type: "email",
167
- placeholder: n.value.email,
168
- "aria-label": n.value.email,
167
+ placeholder: v.value.email,
168
+ "aria-label": v.value.email,
169
169
  autocomplete: "username",
170
170
  autofocus: a.autofocus,
171
171
  inputmode: "email",
172
172
  size: "lg"
173
173
  }, {
174
- prefix: l(() => [
175
- t(ee, { name: "mail" })
174
+ prefix: t(() => [
175
+ l(H, { name: "mail" })
176
176
  ]),
177
177
  _: 1
178
178
  }, 8, ["modelValue", "placeholder", "aria-label", "autofocus"])
179
179
  ]),
180
180
  _: 1
181
181
  }),
182
- t(we, {
182
+ l(_, {
183
183
  name: "password",
184
- help: r.value ? n.value.capsLock : void 0
184
+ help: u.value ? v.value.capsLock : void 0
185
185
  }, {
186
- default: l(() => [
187
- t(fe, {
188
- modelValue: C.value,
189
- "onUpdate:modelValue": v[2] || (v[2] = (K) => C.value = K),
190
- type: w.value ? "text" : "password",
191
- placeholder: n.value.password,
192
- "aria-label": n.value.password,
186
+ default: t(() => [
187
+ l(le, {
188
+ modelValue: S.value,
189
+ "onUpdate:modelValue": E[2] || (E[2] = (G) => S.value = G),
190
+ type: g.value ? "text" : "password",
191
+ placeholder: v.value.password,
192
+ "aria-label": v.value.password,
193
193
  autocomplete: "current-password",
194
194
  size: "lg",
195
- onKeydown: A,
196
- onKeyup: A
195
+ onKeydown: q,
196
+ onKeyup: q
197
197
  }, {
198
- prefix: l(() => [
199
- t(ee, { name: "lock" })
198
+ prefix: t(() => [
199
+ l(H, { name: "lock" })
200
200
  ]),
201
- suffix: l(() => [
202
- N("button", {
201
+ suffix: t(() => [
202
+ O("button", {
203
203
  type: "button",
204
204
  class: "wx-login__reveal",
205
- title: w.value ? n.value.hide : n.value.reveal,
206
- "aria-label": w.value ? n.value.hide : n.value.reveal,
207
- "aria-pressed": w.value,
205
+ title: g.value ? v.value.hide : v.value.reveal,
206
+ "aria-label": g.value ? v.value.hide : v.value.reveal,
207
+ "aria-pressed": g.value,
208
208
  tabindex: "-1",
209
- onClick: v[1] || (v[1] = (K) => w.value = !w.value)
209
+ onClick: E[1] || (E[1] = (G) => g.value = !g.value)
210
210
  }, [
211
- t(ee, {
212
- name: w.value ? "eye-off" : "eye"
211
+ l(H, {
212
+ name: g.value ? "eye-off" : "eye"
213
213
  }, null, 8, ["name"])
214
- ], 8, je)
214
+ ], 8, Xe)
215
215
  ]),
216
216
  _: 1
217
217
  }, 8, ["modelValue", "type", "placeholder", "aria-label"])
218
218
  ]),
219
219
  _: 1
220
220
  }, 8, ["help"]),
221
- a.remember ? (L(), S(Fe, {
221
+ a.remember ? (x(), F(z, {
222
222
  key: 2,
223
- modelValue: V.value,
224
- "onUpdate:modelValue": v[3] || (v[3] = (K) => V.value = K),
225
- label: n.value.remember,
223
+ modelValue: n.value,
224
+ "onUpdate:modelValue": E[3] || (E[3] = (G) => n.value = G),
225
+ label: v.value.remember,
226
226
  class: "wx-login__remember"
227
- }, null, 8, ["modelValue", "label"])) : T("", !0),
228
- t(Se, {
227
+ }, null, 8, ["modelValue", "label"])) : M("", !0),
228
+ l(c, {
229
229
  type: "primary",
230
230
  "native-type": "submit",
231
231
  size: "lg",
232
232
  block: "",
233
- loading: d.value,
234
- disabled: z.value
233
+ loading: m.value,
234
+ disabled: B.value
235
235
  }, {
236
- default: l(() => [
237
- F($(n.value.submit), 1)
236
+ default: t(() => [
237
+ $(C(v.value.submit), 1)
238
238
  ]),
239
239
  _: 1
240
240
  }, 8, ["loading", "disabled"])
@@ -246,12 +246,12 @@ const je = ["title", "aria-label", "aria-pressed"], qe = /* @__PURE__ */ R({
246
246
  });
247
247
  };
248
248
  }
249
- }), ve = (a, i) => {
249
+ }), be = (a, r) => {
250
250
  const s = a.__vccOpts || a;
251
- for (const [o, u] of i)
252
- s[o] = u;
251
+ for (const [o, i] of r)
252
+ s[o] = i;
253
253
  return s;
254
- }, He = /* @__PURE__ */ ve(qe, [["__scopeId", "data-v-3c206e31"]]), $e = {
254
+ }, ea = /* @__PURE__ */ be(Ze, [["__scopeId", "data-v-3c206e31"]]), Se = {
255
255
  card: {
256
256
  email: "Email",
257
257
  password: "Password",
@@ -265,6 +265,8 @@ const je = ["title", "aria-label", "aria-pressed"], qe = /* @__PURE__ */ R({
265
265
  },
266
266
  admins: {
267
267
  title: "Administrators",
268
+ "filter-role": "Role",
269
+ "filter-state": "State",
268
270
  search: "Search administrators",
269
271
  new: "New administrator",
270
272
  edit: "Edit administrator",
@@ -329,10 +331,10 @@ const je = ["title", "aria-label", "aria-pressed"], qe = /* @__PURE__ */ R({
329
331
  language: "Interface language"
330
332
  }
331
333
  };
332
- function pe(a) {
333
- const i = `${a.apiPath}/auth`, s = (o) => o.data;
334
+ function ye(a) {
335
+ const r = `${a.apiPath}/auth`, s = (o) => o.data;
334
336
  return {
335
- list: (o = {}) => a.http.get(`${i}/admins`, {
337
+ list: (o = {}) => a.http.get(`${r}/admins`, {
336
338
  query: {
337
339
  q: o.q || void 0,
338
340
  role: o.role ?? void 0,
@@ -341,35 +343,35 @@ function pe(a) {
341
343
  page: o.page,
342
344
  per_page: o.per_page
343
345
  }
344
- }).then((u) => ({ ...u.meta, data: u.data })),
345
- get: (o) => a.http.get(`${i}/admins/${o}`).then(s),
346
- create: (o) => a.http.post(`${i}/admins`, o).then(s),
347
- update: (o, u) => a.http.patch(`${i}/admins/${o}`, u).then(s),
348
- remove: (o) => a.http.delete(`${i}/admins/${o}`),
349
- roles: () => a.http.get(`${i}/roles`).then(s)
346
+ }).then((i) => ({ ...i.meta, data: i.data })),
347
+ get: (o) => a.http.get(`${r}/admins/${o}`).then(s),
348
+ create: (o) => a.http.post(`${r}/admins`, o).then(s),
349
+ update: (o, i) => a.http.patch(`${r}/admins/${o}`, i).then(s),
350
+ remove: (o) => a.http.delete(`${r}/admins/${o}`),
351
+ roles: () => a.http.get(`${r}/roles`).then(s)
350
352
  };
351
353
  }
352
- const ye = /* @__PURE__ */ new WeakSet();
353
- function J() {
354
+ const xe = /* @__PURE__ */ new WeakSet();
355
+ function ae() {
354
356
  try {
355
- const { i18n: a } = q();
356
- ye.has(a) || (a.defaults("webx-auth", $e), ye.add(a));
357
+ const { i18n: a } = X();
358
+ xe.has(a) || (a.defaults("webx-auth", Se), xe.add(a));
357
359
  } catch {
358
360
  }
359
361
  }
360
- const Ge = { class: "wx-admin-form" }, Je = { class: "wx-admin-form__grid" }, Qe = {
362
+ const aa = { class: "wx-admin-form" }, ta = { class: "wx-admin-form__grid" }, la = {
361
363
  key: 0,
362
364
  class: "wx-admin-form__aside"
363
- }, Xe = { class: "wx-admin-form__fields" }, Ze = /* @__PURE__ */ R({
365
+ }, oa = { class: "wx-admin-form__fields" }, sa = /* @__PURE__ */ j({
364
366
  __name: "AdminDialog",
365
367
  props: {
366
368
  admin: { default: null },
367
369
  avatarField: { default: void 0 }
368
370
  },
369
371
  setup(a) {
370
- const i = a, { resolve: s, dismiss: o, open: u } = ie(), k = q(), m = pe(k), n = ke();
371
- J();
372
- const p = I("webx-auth"), C = re(), V = g([]), d = g(!1), w = g({}), r = g({
372
+ const r = a, { resolve: s, dismiss: o, open: i } = me(), A = X(), f = ye(A), v = $e();
373
+ ae();
374
+ const h = D("webx-auth"), S = ve(), n = V([]), m = V(!1), g = V({}), u = V({
373
375
  name: "",
374
376
  email: "",
375
377
  password: "",
@@ -378,81 +380,81 @@ const Ge = { class: "wx-admin-form" }, Je = { class: "wx-admin-form__grid" }, Qe
378
380
  is_super: !1,
379
381
  locale: null,
380
382
  roles: []
381
- }), b = P({
382
- get: () => r.value.avatar ? { path: r.value.avatar } : null,
383
- set: (h) => {
384
- r.value.avatar = h?.path ?? null;
383
+ }), w = P({
384
+ get: () => u.value.avatar ? { path: u.value.avatar } : null,
385
+ set: (y) => {
386
+ u.value.avatar = y?.path ?? null;
385
387
  }
386
- }), _ = P(() => i.admin !== null), f = P(() => V.value.map((h) => ({ value: h.id, label: h.name }))), U = P(() => [
387
- { value: "auto", label: p("admins.locale-auto") },
388
- ...n.state.panelLocales.map((h) => ({ value: h.code, label: h.nativeName }))
388
+ }), b = P(() => r.admin !== null), d = P(() => n.value.map((y) => ({ value: y.id, label: y.name }))), L = P(() => [
389
+ { value: "auto", label: h("admins.locale-auto") },
390
+ ...v.state.panelLocales.map((y) => ({ value: y.code, label: y.nativeName }))
389
391
  ]);
390
- m.roles().then((h) => V.value = h), Z(
391
- () => i.admin,
392
- (h) => {
393
- r.value = {
394
- name: h?.name ?? "",
395
- email: h?.email ?? "",
392
+ f.roles().then((y) => n.value = y), re(
393
+ () => r.admin,
394
+ (y) => {
395
+ u.value = {
396
+ name: y?.name ?? "",
397
+ email: y?.email ?? "",
396
398
  password: "",
397
- avatar: h?.avatar ?? null,
398
- is_active: h?.is_active ?? !0,
399
- is_super: h?.is_super ?? !1,
400
- locale: h?.locale ?? "auto",
401
- roles: h?.roles.map((c) => c.id) ?? []
402
- }, w.value = {};
399
+ avatar: y?.avatar ?? null,
400
+ is_active: y?.is_active ?? !0,
401
+ is_super: y?.is_super ?? !1,
402
+ locale: y?.locale ?? "auto",
403
+ roles: y?.roles.map((p) => p.id) ?? []
404
+ }, g.value = {};
403
405
  },
404
406
  { immediate: !0 }
405
407
  );
406
- function W(h) {
407
- return w.value[h]?.[0];
408
+ function U(y) {
409
+ return g.value[y]?.[0];
408
410
  }
409
- async function z() {
410
- d.value = !0, w.value = {};
411
- const h = {
412
- name: r.value.name,
413
- email: r.value.email,
414
- avatar: r.value.avatar,
415
- is_active: r.value.is_active,
416
- is_super: r.value.is_super,
417
- locale: r.value.locale === "auto" ? null : r.value.locale,
418
- roles: r.value.roles ?? []
411
+ async function B() {
412
+ m.value = !0, g.value = {};
413
+ const y = {
414
+ name: u.value.name,
415
+ email: u.value.email,
416
+ avatar: u.value.avatar,
417
+ is_active: u.value.is_active,
418
+ is_super: u.value.is_super,
419
+ locale: u.value.locale === "auto" ? null : u.value.locale,
420
+ roles: u.value.roles ?? []
419
421
  };
420
- r.value.password && (h.password = r.value.password);
422
+ u.value.password && (y.password = u.value.password);
421
423
  try {
422
- const c = i.admin ? await m.update(i.admin.id, h) : await m.create(h);
423
- j.success(p(_.value ? "admins.updated" : "admins.created")), s(c);
424
- } catch (c) {
425
- const x = c.body;
426
- x?.errors ? w.value = x.errors : j.danger(C(c));
424
+ const p = r.admin ? await f.update(r.admin.id, y) : await f.create(y);
425
+ Q.success(h(b.value ? "admins.updated" : "admins.created")), s(p);
426
+ } catch (p) {
427
+ const k = p.body;
428
+ k?.errors ? g.value = k.errors : Q.danger(S(p));
427
429
  } finally {
428
- d.value = !1;
430
+ m.value = !1;
429
431
  }
430
432
  }
431
- return (h, c) => (L(), S(e(ue), {
432
- open: e(u),
433
- "onUpdate:open": c[9] || (c[9] = (x) => se(u) ? u.value = x : null),
434
- title: _.value ? e(p)("admins.edit-short") : e(p)("admins.new-short"),
433
+ return (y, p) => (x(), F(e(pe), {
434
+ open: e(i),
435
+ "onUpdate:open": p[9] || (p[9] = (k) => ce(i) ? i.value = k : null),
436
+ title: b.value ? e(h)("admins.edit-short") : e(h)("admins.new-short"),
435
437
  width: 720
436
438
  }, {
437
- footer: l(() => [
438
- t(e(Y), { size: "sm" }, {
439
- default: l(() => [
440
- t(e(D), {
439
+ footer: t(() => [
440
+ l(e(ee), { size: "sm" }, {
441
+ default: t(() => [
442
+ l(e(Y), {
441
443
  variant: "outline",
442
- onClick: c[8] || (c[8] = (x) => e(o)())
444
+ onClick: p[8] || (p[8] = (k) => e(o)())
443
445
  }, {
444
- default: l(() => [
445
- F($(e(p)("admins.cancel")), 1)
446
+ default: t(() => [
447
+ $(C(e(h)("admins.cancel")), 1)
446
448
  ]),
447
449
  _: 1
448
450
  }),
449
- t(e(D), {
451
+ l(e(Y), {
450
452
  type: "primary",
451
- loading: d.value,
452
- onClick: z
453
+ loading: m.value,
454
+ onClick: B
453
455
  }, {
454
- default: l(() => [
455
- F($(e(p)("admins.save")), 1)
456
+ default: t(() => [
457
+ $(C(e(h)("admins.save")), 1)
456
458
  ]),
457
459
  _: 1
458
460
  }, 8, ["loading"])
@@ -460,40 +462,40 @@ const Ge = { class: "wx-admin-form" }, Je = { class: "wx-admin-form__grid" }, Qe
460
462
  _: 1
461
463
  })
462
464
  ]),
463
- default: l(() => [
464
- N("div", Ge, [
465
- N("div", Je, [
466
- a.avatarField ? (L(), O("div", Qe, [
467
- (L(), S(ge(a.avatarField), {
468
- modelValue: b.value,
469
- "onUpdate:modelValue": c[0] || (c[0] = (x) => b.value = x),
470
- label: e(p)("admins.avatar"),
465
+ default: t(() => [
466
+ O("div", aa, [
467
+ O("div", ta, [
468
+ a.avatarField ? (x(), R("div", la, [
469
+ (x(), F(Ve(a.avatarField), {
470
+ modelValue: w.value,
471
+ "onUpdate:modelValue": p[0] || (p[0] = (k) => w.value = k),
472
+ label: e(h)("admins.avatar"),
471
473
  aspect: "1/1",
472
474
  captions: !1
473
475
  }, null, 8, ["modelValue", "label"]))
474
- ])) : T("", !0),
475
- N("div", Xe, [
476
- t(e(M), {
477
- label: e(p)("admins.name"),
478
- error: W("name")
476
+ ])) : M("", !0),
477
+ O("div", oa, [
478
+ l(e(N), {
479
+ label: e(h)("admins.name"),
480
+ error: U("name")
479
481
  }, {
480
- default: l(() => [
481
- t(e(E), {
482
- modelValue: r.value.name,
483
- "onUpdate:modelValue": c[1] || (c[1] = (x) => r.value.name = x),
482
+ default: t(() => [
483
+ l(e(K), {
484
+ modelValue: u.value.name,
485
+ "onUpdate:modelValue": p[1] || (p[1] = (k) => u.value.name = k),
484
486
  name: "name"
485
487
  }, null, 8, ["modelValue"])
486
488
  ]),
487
489
  _: 1
488
490
  }, 8, ["label", "error"]),
489
- t(e(M), {
490
- label: e(p)("admins.email"),
491
- error: W("email")
491
+ l(e(N), {
492
+ label: e(h)("admins.email"),
493
+ error: U("email")
492
494
  }, {
493
- default: l(() => [
494
- t(e(E), {
495
- modelValue: r.value.email,
496
- "onUpdate:modelValue": c[2] || (c[2] = (x) => r.value.email = x),
495
+ default: t(() => [
496
+ l(e(K), {
497
+ modelValue: u.value.email,
498
+ "onUpdate:modelValue": p[2] || (p[2] = (k) => u.value.email = k),
497
499
  type: "email",
498
500
  name: "email",
499
501
  autocomplete: "off"
@@ -501,15 +503,15 @@ const Ge = { class: "wx-admin-form" }, Je = { class: "wx-admin-form__grid" }, Qe
501
503
  ]),
502
504
  _: 1
503
505
  }, 8, ["label", "error"]),
504
- t(e(M), {
505
- label: e(p)("admins.password"),
506
- error: W("password"),
507
- help: _.value ? e(p)("admins.password-keep") : e(p)("admins.password-hint")
506
+ l(e(N), {
507
+ label: e(h)("admins.password"),
508
+ error: U("password"),
509
+ help: b.value ? e(h)("admins.password-keep") : e(h)("admins.password-hint")
508
510
  }, {
509
- default: l(() => [
510
- t(e(E), {
511
- modelValue: r.value.password,
512
- "onUpdate:modelValue": c[3] || (c[3] = (x) => r.value.password = x),
511
+ default: t(() => [
512
+ l(e(K), {
513
+ modelValue: u.value.password,
514
+ "onUpdate:modelValue": p[3] || (p[3] = (k) => u.value.password = k),
513
515
  type: "password",
514
516
  name: "password",
515
517
  autocomplete: "new-password"
@@ -517,53 +519,53 @@ const Ge = { class: "wx-admin-form" }, Je = { class: "wx-admin-form__grid" }, Qe
517
519
  ]),
518
520
  _: 1
519
521
  }, 8, ["label", "error", "help"]),
520
- t(e(M), {
521
- label: e(p)("admins.roles"),
522
- error: W("roles")
522
+ l(e(N), {
523
+ label: e(h)("admins.roles"),
524
+ error: U("roles")
523
525
  }, {
524
- default: l(() => [
525
- t(e(X), {
526
- modelValue: r.value.roles,
527
- "onUpdate:modelValue": c[4] || (c[4] = (x) => r.value.roles = x),
528
- options: f.value,
526
+ default: t(() => [
527
+ l(e(se), {
528
+ modelValue: u.value.roles,
529
+ "onUpdate:modelValue": p[4] || (p[4] = (k) => u.value.roles = k),
530
+ options: d.value,
529
531
  multiple: ""
530
532
  }, null, 8, ["modelValue", "options"])
531
533
  ]),
532
534
  _: 1
533
535
  }, 8, ["label", "error"]),
534
- t(e(M), {
535
- label: e(p)("admins.locale")
536
+ l(e(N), {
537
+ label: e(h)("admins.locale")
536
538
  }, {
537
- default: l(() => [
538
- t(e(X), {
539
- modelValue: r.value.locale,
540
- "onUpdate:modelValue": c[5] || (c[5] = (x) => r.value.locale = x),
541
- options: U.value
539
+ default: t(() => [
540
+ l(e(se), {
541
+ modelValue: u.value.locale,
542
+ "onUpdate:modelValue": p[5] || (p[5] = (k) => u.value.locale = k),
543
+ options: L.value
542
544
  }, null, 8, ["modelValue", "options"])
543
545
  ]),
544
546
  _: 1
545
547
  }, 8, ["label"]),
546
- t(e(Y), { size: "md" }, {
547
- default: l(() => [
548
- t(e(be), {
549
- modelValue: r.value.is_active,
550
- "onUpdate:modelValue": c[6] || (c[6] = (x) => r.value.is_active = x),
551
- label: e(p)("admins.active")
548
+ l(e(ee), { size: "md" }, {
549
+ default: t(() => [
550
+ l(e(_e), {
551
+ modelValue: u.value.is_active,
552
+ "onUpdate:modelValue": p[6] || (p[6] = (k) => u.value.is_active = k),
553
+ label: e(h)("admins.active")
552
554
  }, null, 8, ["modelValue", "label"]),
553
- t(e(be), {
554
- modelValue: r.value.is_super,
555
- "onUpdate:modelValue": c[7] || (c[7] = (x) => r.value.is_super = x),
556
- label: e(p)("admins.super")
555
+ l(e(_e), {
556
+ modelValue: u.value.is_super,
557
+ "onUpdate:modelValue": p[7] || (p[7] = (k) => u.value.is_super = k),
558
+ label: e(h)("admins.super")
557
559
  }, null, 8, ["modelValue", "label"])
558
560
  ]),
559
561
  _: 1
560
562
  }),
561
- t(e(de), {
563
+ l(e(fe), {
562
564
  size: "sm",
563
565
  tone: "muted"
564
566
  }, {
565
- default: l(() => [
566
- F($(e(p)("admins.super-hint")), 1)
567
+ default: t(() => [
568
+ $(C(e(h)("admins.super-hint")), 1)
567
569
  ]),
568
570
  _: 1
569
571
  })
@@ -574,7 +576,7 @@ const Ge = { class: "wx-admin-form" }, Je = { class: "wx-admin-form__grid" }, Qe
574
576
  _: 1
575
577
  }, 8, ["open", "title"]));
576
578
  }
577
- }), ea = { class: "wx-admin-list" }, Ce = /* @__PURE__ */ R({
579
+ }), ke = 480, We = /* @__PURE__ */ j({
578
580
  __name: "AdminList",
579
581
  props: {
580
582
  picking: { type: Boolean, default: !1 },
@@ -584,19 +586,34 @@ const Ge = { class: "wx-admin-form" }, Je = { class: "wx-admin-form__grid" }, Qe
584
586
  resolveAvatar: { type: Function, default: void 0 }
585
587
  },
586
588
  emits: ["open", "chosen", "selection", "remove"],
587
- setup(a, { expose: i, emit: s }) {
588
- const o = a, u = s, k = q(), m = pe(k);
589
- J();
590
- const n = I("webx-auth"), p = g(null), C = g([]), V = g(!1), d = g("all"), w = g("any"), r = g([]), b = g({});
591
- let _ = { page: 1, perPage: 20, sort: null, search: "" };
592
- const f = P(() => [
589
+ setup(a, { expose: r, emit: s }) {
590
+ const o = a, i = s, A = X(), f = ye(A);
591
+ ae();
592
+ const v = ne("root"), h = Ie(v), S = P(() => h.value > 0 && h.value < ke), n = D("webx-auth"), m = D("webx-admin"), g = V(null), u = V([]), w = V(!1), b = V("all"), d = V("any"), L = V([]), U = V({});
593
+ let B = { page: 1, perPage: 20, sort: null, search: "" };
594
+ const y = P(() => [
593
595
  { value: "all", label: n("admins.all-roles") },
594
- ...C.value.map((A) => ({ value: A.slug, label: A.name }))
595
- ]), U = P(() => [
596
+ ...u.value.map((_) => ({ value: _.slug, label: _.name }))
597
+ ]), p = P(() => [
596
598
  { value: "any", label: n("admins.any-state") },
597
599
  { value: "yes", label: n("admins.only-active") },
598
600
  { value: "no", label: n("admins.only-inactive") }
599
- ]), W = P(() => [
601
+ ]), k = P(() => {
602
+ const _ = [], z = u.value.find((c) => c.slug === b.value);
603
+ return z && _.push({
604
+ key: "role",
605
+ label: `${n("admins.filter-role")}: ${z.name}`,
606
+ clear: () => b.value = "all"
607
+ }), d.value !== "any" && _.push({
608
+ key: "state",
609
+ label: `${n("admins.filter-state")}: ${d.value === "yes" ? n("admins.only-active") : n("admins.only-inactive")}`,
610
+ clear: () => d.value = "any"
611
+ }), _;
612
+ });
613
+ function ie() {
614
+ b.value = "all", d.value = "any";
615
+ }
616
+ const Z = P(() => S.value ? [{ key: "card", label: "" }] : [
600
617
  { key: "name", label: n("admins.name"), sortable: !0 },
601
618
  { key: "email", label: n("admins.email"), sortable: !0, hideBelow: 560 },
602
619
  { key: "roles", label: n("admins.roles"), hideBelow: 760 },
@@ -613,262 +630,339 @@ const Ge = { class: "wx-admin-form" }, Je = { class: "wx-admin-form__grid" }, Qe
613
630
  {
614
631
  key: "actions",
615
632
  label: "",
616
- width: 56,
633
+ width: Ne,
617
634
  align: "right",
618
635
  hidden: !o.removable,
619
636
  // A card puts them along its top instead, through the `card-actions` slot.
620
637
  hideOnCards: !0
621
638
  }
622
639
  ]);
623
- m.roles().then((A) => C.value = A), Z([d, w], () => z(_));
624
- async function z(A) {
625
- _ = A, V.value = !0;
640
+ f.roles().then((_) => u.value = _), re([b, d], () => q(B));
641
+ async function q(_) {
642
+ B = _, w.value = !0;
626
643
  try {
627
- p.value = await m.list({
628
- q: A.search,
629
- role: d.value === "all" ? null : d.value,
630
- active: w.value === "any" ? null : w.value,
631
- sort: A.sort ? `${A.sort.order === "desc" ? "-" : ""}${A.sort.key}` : "name",
632
- page: A.page,
633
- per_page: A.perPage
634
- }), h();
644
+ g.value = await f.list({
645
+ q: _.search,
646
+ role: b.value === "all" ? null : b.value,
647
+ active: d.value === "any" ? null : d.value,
648
+ sort: _.sort ? `${_.sort.order === "desc" ? "-" : ""}${_.sort.key}` : "name",
649
+ page: _.page,
650
+ per_page: _.perPage
651
+ }), W();
635
652
  } finally {
636
- V.value = !1;
653
+ w.value = !1;
637
654
  }
638
655
  }
639
- async function h() {
640
- const A = o.resolveAvatar;
641
- if (A)
642
- for (const y of p.value?.data ?? []) {
643
- if (!y.avatar || b.value[y.avatar]) continue;
644
- const v = await A(y.avatar);
645
- v && (b.value = { ...b.value, [y.avatar]: v });
656
+ async function W() {
657
+ const _ = o.resolveAvatar;
658
+ if (_)
659
+ for (const z of g.value?.data ?? []) {
660
+ if (!z.avatar || U.value[z.avatar]) continue;
661
+ const c = await _(z.avatar);
662
+ c && (U.value = { ...U.value, [z.avatar]: c });
646
663
  }
647
664
  }
648
- function c(A) {
665
+ function E(_) {
649
666
  return [
650
667
  {
651
668
  key: "delete",
652
669
  icon: "trash",
653
670
  label: n("admins.delete"),
654
671
  danger: !0,
655
- run: () => u("remove", A)
672
+ run: () => i("remove", _)
656
673
  }
657
674
  ];
658
675
  }
659
- function x(A) {
676
+ function te(_) {
660
677
  if (o.picking) {
661
- u("chosen", [A]);
678
+ i("chosen", [_]);
662
679
  return;
663
680
  }
664
- u("open", A);
681
+ i("open", _);
665
682
  }
666
- const Q = P(() => !(o.picking && o.multiple));
667
- function H(A, y) {
668
- r.value = y, u("selection", y);
683
+ const H = P(() => !(o.picking && o.multiple));
684
+ function le(_, z) {
685
+ L.value = z, i("selection", z);
669
686
  }
670
- return i({ reload: () => z(_), chosen: () => r.value }), (A, y) => (L(), O("div", ea, [
671
- t(e(Oe), {
672
- data: p.value,
673
- columns: W.value,
687
+ return r({ reload: () => q(B), chosen: () => L.value }), (_, z) => (x(), R("div", {
688
+ ref_key: "root",
689
+ ref: v,
690
+ class: "wx-admin-list"
691
+ }, [
692
+ l(e(Ke), {
693
+ data: g.value,
694
+ columns: Z.value,
674
695
  "row-key": "id",
675
696
  searchable: "",
676
- clickable: Q.value,
677
- hover: Q.value,
697
+ clickable: H.value,
698
+ hover: H.value,
678
699
  flush: "",
679
- loading: V.value,
700
+ loading: w.value,
680
701
  "search-placeholder": e(n)("admins.search"),
681
702
  "empty-text": e(n)("admins.empty"),
682
703
  selectable: a.picking && a.multiple,
683
- onRowClick: x,
684
- onStateChange: z,
685
- onSelectionChange: H
686
- }, ne({
687
- "cell-name": l(({ row: v }) => [
688
- t(e(Y), {
704
+ "cards-below": ke,
705
+ "filters-count": k.value.length,
706
+ "filters-label": e(m)("filters.title"),
707
+ onRowClick: te,
708
+ onStateChange: q,
709
+ onSelectionChange: le
710
+ }, Ae({
711
+ "cell-name": t(({ row: c }) => [
712
+ l(e(ee), {
689
713
  size: "sm",
690
714
  align: "center"
691
715
  }, {
692
- default: l(() => [
693
- t(e(De), {
694
- name: v.name,
695
- src: v.avatar ? b.value[v.avatar] : void 0,
716
+ default: t(() => [
717
+ l(e(je), {
718
+ name: c.name,
719
+ src: c.avatar ? U.value[c.avatar] : void 0,
696
720
  size: "sm"
697
721
  }, null, 8, ["name", "src"]),
698
- N("span", null, $(v.name), 1),
699
- v.is_super ? (L(), S(e(ae), {
722
+ O("span", null, C(c.name), 1),
723
+ c.is_super ? (x(), F(e(J), {
700
724
  key: 0,
701
725
  type: "warning"
702
726
  }, {
703
- default: l(() => [
704
- F($(e(n)("admins.super")), 1)
727
+ default: t(() => [
728
+ $(C(e(n)("admins.super")), 1)
705
729
  ]),
706
730
  _: 1
707
- })) : T("", !0)
731
+ })) : M("", !0)
708
732
  ]),
709
733
  _: 2
710
734
  }, 1024)
711
735
  ]),
712
- "cell-roles": l(({ row: v }) => [
713
- v.roles.length > 0 ? (L(), S(e(Y), {
736
+ "cell-roles": t(({ row: c }) => [
737
+ c.roles.length > 0 ? (x(), F(e(ee), {
714
738
  key: 0,
715
739
  size: "xs",
716
740
  wrap: ""
717
741
  }, {
718
- default: l(() => [
719
- (L(!0), O(le, null, _e(v.roles, (G) => (L(), S(e(ae), {
720
- key: G.id
742
+ default: t(() => [
743
+ (x(!0), R(oe, null, de(c.roles, (I) => (x(), F(e(J), {
744
+ key: I.id
721
745
  }, {
722
- default: l(() => [
723
- F($(G.name), 1)
746
+ default: t(() => [
747
+ $(C(I.name), 1)
724
748
  ]),
725
749
  _: 2
726
750
  }, 1024))), 128))
727
751
  ]),
728
752
  _: 2
729
- }, 1024)) : (L(), S(e(de), {
753
+ }, 1024)) : (x(), F(e(fe), {
730
754
  key: 1,
731
755
  size: "sm",
732
756
  tone: "muted"
733
757
  }, {
734
- default: l(() => [
735
- F($(e(n)("admins.no-roles")), 1)
758
+ default: t(() => [
759
+ $(C(e(n)("admins.no-roles")), 1)
736
760
  ]),
737
761
  _: 1
738
762
  }))
739
763
  ]),
740
- "cell-is_active": l(({ row: v }) => [
741
- t(e(ae), {
742
- type: v.is_active ? "success" : "default",
764
+ "cell-is_active": t(({ row: c }) => [
765
+ l(e(J), {
766
+ type: c.is_active ? "success" : "default",
743
767
  dot: ""
744
768
  }, {
745
- default: l(() => [
746
- F($(v.is_active ? e(n)("admins.active") : e(n)("admins.only-inactive")), 1)
769
+ default: t(() => [
770
+ $(C(c.is_active ? e(n)("admins.active") : e(n)("admins.only-inactive")), 1)
747
771
  ]),
748
772
  _: 2
749
773
  }, 1032, ["type"])
750
774
  ]),
751
- "card-actions": l(({ row: v }) => [
752
- a.removable ? (L(), S(e(he), {
775
+ "card-actions": t(({ row: c }) => [
776
+ a.removable ? (x(), F(e(ge), {
753
777
  key: 0,
754
- actions: c(v),
755
- label: v.name
756
- }, null, 8, ["actions", "label"])) : T("", !0)
778
+ actions: E(c),
779
+ label: c.name
780
+ }, null, 8, ["actions", "label"])) : M("", !0)
757
781
  ]),
758
- "cell-actions": l(({ row: v }) => [
759
- t(e(he), {
760
- actions: c(v),
761
- label: v.name
782
+ "cell-actions": t(({ row: c }) => [
783
+ l(e(ge), {
784
+ actions: E(c),
785
+ label: c.name
762
786
  }, null, 8, ["actions", "label"])
763
787
  ]),
764
- "cell-last_login_at": l(({ row: v }) => [
765
- t(e(Ne), {
766
- value: v.last_login_at,
767
- tone: v.last_login_at ? "default" : "muted"
788
+ "cell-last_login_at": t(({ row: c }) => [
789
+ l(e(Oe), {
790
+ value: c.last_login_at,
791
+ tone: c.last_login_at ? "default" : "muted",
792
+ compact: ""
768
793
  }, null, 8, ["value", "tone"])
769
794
  ]),
795
+ "cell-card": t(({ row: c }) => [
796
+ l(e(Ye), {
797
+ variant: "plain",
798
+ shape: "circle",
799
+ title: c.name,
800
+ image: c.avatar ? U.value[c.avatar] : void 0,
801
+ subtitle: c.email
802
+ }, {
803
+ meta: t(() => [
804
+ c.is_super ? (x(), F(e(J), {
805
+ key: 0,
806
+ type: "warning",
807
+ size: "sm"
808
+ }, {
809
+ default: t(() => [
810
+ $(C(e(n)("admins.super")), 1)
811
+ ]),
812
+ _: 1
813
+ })) : M("", !0),
814
+ (x(!0), R(oe, null, de(c.roles, (I) => (x(), F(e(J), {
815
+ key: I.id,
816
+ size: "sm"
817
+ }, {
818
+ default: t(() => [
819
+ $(C(I.name), 1)
820
+ ]),
821
+ _: 2
822
+ }, 1024))), 128)),
823
+ l(e(J), {
824
+ type: c.is_active ? "success" : "default",
825
+ dot: "",
826
+ size: "sm"
827
+ }, {
828
+ default: t(() => [
829
+ $(C(c.is_active ? e(n)("admins.active") : e(n)("admins.only-inactive")), 1)
830
+ ]),
831
+ _: 2
832
+ }, 1032, ["type"])
833
+ ]),
834
+ _: 2
835
+ }, 1032, ["title", "image", "subtitle"])
836
+ ]),
770
837
  _: 2
771
838
  }, [
772
839
  a.filters ? {
773
- name: "actions",
774
- fn: l(() => [
775
- t(e(Y), { size: "sm" }, {
776
- default: l(() => [
777
- t(e(X), {
840
+ name: "filters",
841
+ fn: t(() => [
842
+ l(e(N), {
843
+ label: e(n)("admins.filter-role")
844
+ }, {
845
+ default: t(() => [
846
+ l(e(se), {
847
+ modelValue: b.value,
848
+ "onUpdate:modelValue": z[0] || (z[0] = (c) => b.value = c),
849
+ options: y.value,
850
+ size: "sm"
851
+ }, null, 8, ["modelValue", "options"])
852
+ ]),
853
+ _: 1
854
+ }, 8, ["label"]),
855
+ l(e(N), {
856
+ label: e(n)("admins.filter-state")
857
+ }, {
858
+ default: t(() => [
859
+ l(e(se), {
778
860
  modelValue: d.value,
779
- "onUpdate:modelValue": y[0] || (y[0] = (v) => d.value = v),
780
- options: f.value,
781
- size: "sm",
782
- style: { width: "180px" }
783
- }, null, 8, ["modelValue", "options"]),
784
- t(e(X), {
785
- modelValue: w.value,
786
- "onUpdate:modelValue": y[1] || (y[1] = (v) => w.value = v),
787
- options: U.value,
788
- size: "sm",
789
- style: { width: "180px" }
861
+ "onUpdate:modelValue": z[1] || (z[1] = (c) => d.value = c),
862
+ options: p.value,
863
+ size: "sm"
790
864
  }, null, 8, ["modelValue", "options"])
791
865
  ]),
792
866
  _: 1
793
- })
867
+ }, 8, ["label"]),
868
+ k.value.length > 0 ? (x(), F(e(Y), {
869
+ key: 0,
870
+ variant: "text",
871
+ size: "sm",
872
+ block: "",
873
+ onClick: ie
874
+ }, {
875
+ icon: t(() => [
876
+ l(e(qe), { name: "close" })
877
+ ]),
878
+ default: t(() => [
879
+ $(" " + C(e(m)("filters.reset")), 1)
880
+ ]),
881
+ _: 1
882
+ })) : M("", !0)
794
883
  ]),
795
884
  key: "0"
885
+ } : void 0,
886
+ a.filters ? {
887
+ name: "applied",
888
+ fn: t(() => [
889
+ l(e(Re), { filters: k.value }, null, 8, ["filters"])
890
+ ]),
891
+ key: "1"
796
892
  } : void 0
797
- ]), 1032, ["data", "columns", "clickable", "hover", "loading", "search-placeholder", "empty-text", "selectable"])
798
- ]));
893
+ ]), 1032, ["data", "columns", "clickable", "hover", "loading", "search-placeholder", "empty-text", "selectable", "filters-count", "filters-label"])
894
+ ], 512));
799
895
  }
800
- }), aa = /* @__PURE__ */ R({
896
+ }), na = /* @__PURE__ */ j({
801
897
  __name: "AdminsPage",
802
898
  props: {
803
899
  avatarField: { default: void 0 },
804
900
  resolveAvatar: { type: Function, default: void 0 }
805
901
  },
806
902
  setup(a) {
807
- const i = a, s = q(), o = pe(s);
808
- J();
809
- const u = I("webx-auth"), k = re(), m = oe("list"), n = g(null), p = ce(Ze), C = s.can("admins.manage"), V = P(
810
- () => s.state.manifest?.modules.find((r) => r.id === "admins")?.title ?? u("admins.title")
903
+ const r = a, s = X(), o = ye(s);
904
+ ae();
905
+ const i = D("webx-auth"), A = ve(), f = ne("list"), v = V(null), h = he(sa), S = s.can("admins.manage"), n = P(
906
+ () => s.state.manifest?.modules.find((w) => w.id === "admins")?.title ?? i("admins.title")
907
+ ), m = P(
908
+ () => S ? [
909
+ {
910
+ key: "new",
911
+ label: i("admins.new-short"),
912
+ icon: "plus",
913
+ primary: !0,
914
+ run: () => {
915
+ g(null);
916
+ }
917
+ }
918
+ ] : []
811
919
  );
812
- async function d(r) {
813
- n.value = r, await p({ admin: r, avatarField: i.avatarField }) && m.value?.reload();
920
+ async function g(w) {
921
+ v.value = w, await h({ admin: w, avatarField: r.avatarField }) && f.value?.reload();
814
922
  }
815
- async function w(r) {
816
- if (await Re({
817
- title: u("admins.delete-title", { name: r.name }),
818
- message: u("admins.delete-text"),
819
- confirmText: u("admins.delete"),
820
- cancelText: u("admins.cancel"),
923
+ async function u(w) {
924
+ if (await He({
925
+ title: i("admins.delete-title", { name: w.name }),
926
+ message: i("admins.delete-text"),
927
+ confirmText: i("admins.delete"),
928
+ cancelText: i("admins.cancel"),
821
929
  tone: "danger"
822
930
  }))
823
931
  try {
824
- await o.remove(r.id), j.success(u("admins.deleted")), m.value?.reload();
825
- } catch (_) {
826
- j.danger(k(_));
932
+ await o.remove(w.id), Q.success(i("admins.deleted")), f.value?.reload();
933
+ } catch (d) {
934
+ Q.danger(A(d));
827
935
  }
828
936
  }
829
- return (r, b) => (L(), S(e(Ee), { title: V.value }, ne({
830
- default: l(() => [
831
- t(Ce, {
937
+ return (w, b) => (x(), F(e(De), {
938
+ title: n.value,
939
+ actions: m.value
940
+ }, {
941
+ default: t(() => [
942
+ l(We, {
832
943
  ref_key: "list",
833
- ref: m,
834
- removable: e(C),
835
- "resolve-avatar": i.resolveAvatar,
836
- onOpen: d,
837
- onRemove: w
944
+ ref: f,
945
+ removable: e(S),
946
+ "resolve-avatar": r.resolveAvatar,
947
+ onOpen: g,
948
+ onRemove: u
838
949
  }, null, 8, ["removable", "resolve-avatar"])
839
950
  ]),
840
- _: 2
841
- }, [
842
- e(C) ? {
843
- name: "actions",
844
- fn: l(() => [
845
- t(e(D), {
846
- type: "primary",
847
- icon: "add",
848
- onClick: b[0] || (b[0] = (_) => d(null))
849
- }, {
850
- default: l(() => [
851
- F($(e(u)("admins.new-short")), 1)
852
- ]),
853
- _: 1
854
- })
855
- ]),
856
- key: "0"
857
- } : void 0
858
- ]), 1032, ["title"]));
951
+ _: 1
952
+ }, 8, ["title", "actions"]));
859
953
  }
860
954
  });
861
- function fa(a = {}) {
862
- const i = a.path ?? "/admins";
955
+ function ga(a = {}) {
956
+ const r = a.path ?? "/admins";
863
957
  return {
864
958
  id: "admins",
865
- path: i,
959
+ path: r,
866
960
  routes: [
867
961
  {
868
- path: i,
962
+ path: r,
869
963
  name: "webx.admins",
870
964
  component: {
871
- render: () => xe(aa, {
965
+ render: () => Ce(na, {
872
966
  avatarField: a.avatarField,
873
967
  resolveAvatar: a.resolveAvatar
874
968
  })
@@ -877,7 +971,7 @@ function fa(a = {}) {
877
971
  ]
878
972
  };
879
973
  }
880
- const ta = /* @__PURE__ */ R({
974
+ const ra = /* @__PURE__ */ j({
881
975
  __name: "AdminPicker",
882
976
  props: {
883
977
  multiple: { type: Boolean, default: !1 },
@@ -885,67 +979,67 @@ const ta = /* @__PURE__ */ R({
885
979
  resolveAvatar: { type: Function, default: void 0 }
886
980
  },
887
981
  setup(a) {
888
- const i = a, { open: s, resolve: o, dismiss: u } = ie();
889
- J();
890
- const k = I("webx-auth"), m = oe("list"), n = g(0);
891
- function p(V) {
892
- o(V);
982
+ const r = a, { open: s, resolve: o, dismiss: i } = me();
983
+ ae();
984
+ const A = D("webx-auth"), f = ne("list"), v = V(0);
985
+ function h(n) {
986
+ o(n);
893
987
  }
894
- function C(V) {
895
- n.value = V.length;
988
+ function S(n) {
989
+ v.value = n.length;
896
990
  }
897
- return (V, d) => (L(), S(e(ue), {
991
+ return (n, m) => (x(), F(e(pe), {
898
992
  open: e(s),
899
- "onUpdate:open": d[2] || (d[2] = (w) => se(s) ? s.value = w : null),
900
- title: a.title ?? e(k)(a.multiple ? "admins.select-many" : "admins.select-one"),
993
+ "onUpdate:open": m[2] || (m[2] = (g) => ce(s) ? s.value = g : null),
994
+ title: a.title ?? e(A)(a.multiple ? "admins.select-many" : "admins.select-one"),
901
995
  width: 880
902
- }, ne({
903
- default: l(() => [
904
- t(Ce, {
996
+ }, Ae({
997
+ default: t(() => [
998
+ l(We, {
905
999
  ref_key: "list",
906
- ref: m,
1000
+ ref: f,
907
1001
  picking: "",
908
1002
  multiple: a.multiple,
909
- "resolve-avatar": i.resolveAvatar,
910
- onChosen: p,
911
- onSelection: C
1003
+ "resolve-avatar": r.resolveAvatar,
1004
+ onChosen: h,
1005
+ onSelection: S
912
1006
  }, null, 8, ["multiple", "resolve-avatar"])
913
1007
  ]),
914
1008
  _: 2
915
1009
  }, [
916
1010
  a.multiple ? {
917
1011
  name: "footer",
918
- fn: l(() => [
919
- t(e(Y), {
1012
+ fn: t(() => [
1013
+ l(e(ee), {
920
1014
  size: "sm",
921
1015
  align: "center"
922
1016
  }, {
923
- default: l(() => [
924
- t(e(de), {
1017
+ default: t(() => [
1018
+ l(e(fe), {
925
1019
  size: "sm",
926
1020
  tone: "muted"
927
1021
  }, {
928
- default: l(() => [
929
- F($(e(k)("admins.chosen", { count: n.value })), 1)
1022
+ default: t(() => [
1023
+ $(C(e(A)("admins.chosen", { count: v.value })), 1)
930
1024
  ]),
931
1025
  _: 1
932
1026
  }),
933
- t(e(D), {
1027
+ l(e(Y), {
934
1028
  variant: "outline",
935
- onClick: d[0] || (d[0] = (w) => e(u)())
1029
+ onClick: m[0] || (m[0] = (g) => e(i)())
936
1030
  }, {
937
- default: l(() => [
938
- F($(e(k)("admins.cancel")), 1)
1031
+ default: t(() => [
1032
+ $(C(e(A)("admins.cancel")), 1)
939
1033
  ]),
940
1034
  _: 1
941
1035
  }),
942
- t(e(D), {
1036
+ l(e(Y), {
943
1037
  type: "primary",
944
- disabled: n.value === 0,
945
- onClick: d[1] || (d[1] = (w) => e(o)(m.value?.chosen() ?? []))
1038
+ disabled: v.value === 0,
1039
+ onClick: m[1] || (m[1] = (g) => e(o)(f.value?.chosen() ?? []))
946
1040
  }, {
947
- default: l(() => [
948
- F($(e(k)("admins.save")), 1)
1041
+ default: t(() => [
1042
+ $(C(e(A)("admins.save")), 1)
949
1043
  ]),
950
1044
  _: 1
951
1045
  }, 8, ["disabled"])
@@ -957,144 +1051,144 @@ const ta = /* @__PURE__ */ R({
957
1051
  } : void 0
958
1052
  ]), 1032, ["open", "title"]));
959
1053
  }
960
- }), Ue = ce(ta);
961
- async function wa(a = {}) {
962
- return (await Ue({ ...a, multiple: !1 }))?.[0];
1054
+ }), ze = he(ra);
1055
+ async function _a(a = {}) {
1056
+ return (await ze({ ...a, multiple: !1 }))?.[0];
963
1057
  }
964
- function ha(a = {}) {
965
- return Ue({ ...a, multiple: !0 });
1058
+ function xa(a = {}) {
1059
+ return ze({ ...a, multiple: !0 });
966
1060
  }
967
- const la = { class: "wx-profile-host" }, oa = { class: "wx-profile" }, sa = {
1061
+ const ia = { class: "wx-profile-host" }, ua = { class: "wx-profile" }, da = {
968
1062
  key: 0,
969
1063
  class: "wx-profile__aside"
970
- }, na = { class: "wx-profile__fields" }, ra = /* @__PURE__ */ R({
1064
+ }, ca = { class: "wx-profile__fields" }, va = /* @__PURE__ */ j({
971
1065
  __name: "ProfileDialog",
972
1066
  props: {
973
1067
  avatarField: { default: void 0 }
974
1068
  },
975
1069
  setup(a) {
976
- const i = a, { resolve: s, dismiss: o, open: u } = ie(), k = q(), m = me();
977
- J();
978
- const n = I("webx-auth"), p = re(), C = g(!1), V = g({}), d = g({
979
- name: k.state.user?.name ?? "",
980
- avatar: k.state.user?.avatar ?? null,
1070
+ const r = a, { resolve: s, dismiss: o, open: i } = me(), A = X(), f = we();
1071
+ ae();
1072
+ const v = D("webx-auth"), h = ve(), S = V(!1), n = V({}), m = V({
1073
+ name: A.state.user?.name ?? "",
1074
+ avatar: A.state.user?.avatar ?? null,
981
1075
  password: "",
982
1076
  current_password: ""
983
- }), w = g(d.value.avatar ? { path: d.value.avatar } : null);
984
- function r(_) {
985
- return V.value[_]?.[0];
1077
+ }), g = V(m.value.avatar ? { path: m.value.avatar } : null);
1078
+ function u(b) {
1079
+ return n.value[b]?.[0];
986
1080
  }
987
- async function b() {
988
- C.value = !0, V.value = {};
1081
+ async function w() {
1082
+ S.value = !0, n.value = {};
989
1083
  try {
990
- await m.updateProfile({
991
- name: d.value.name,
992
- avatar: w.value?.path ?? null,
1084
+ await f.updateProfile({
1085
+ name: m.value.name,
1086
+ avatar: g.value?.path ?? null,
993
1087
  // Blank is left out entirely rather than sent as an empty string: the server reads a
994
1088
  // filled password as "change it", and an empty one would be a change to nothing.
995
- ...d.value.password ? { password: d.value.password, current_password: d.value.current_password } : {}
996
- }), j.success(n("profile.saved")), s(!0);
997
- } catch (_) {
998
- const f = _.body;
999
- f?.errors ? V.value = f.errors : j.danger(p(_));
1089
+ ...m.value.password ? { password: m.value.password, current_password: m.value.current_password } : {}
1090
+ }), Q.success(v("profile.saved")), s(!0);
1091
+ } catch (b) {
1092
+ const d = b.body;
1093
+ d?.errors ? n.value = d.errors : Q.danger(h(b));
1000
1094
  } finally {
1001
- C.value = !1;
1095
+ S.value = !1;
1002
1096
  }
1003
1097
  }
1004
- return (_, f) => (L(), S(e(ue), {
1005
- open: e(u),
1006
- "onUpdate:open": f[5] || (f[5] = (U) => se(u) ? u.value = U : null),
1007
- title: e(n)("profile.title"),
1098
+ return (b, d) => (x(), F(e(pe), {
1099
+ open: e(i),
1100
+ "onUpdate:open": d[5] || (d[5] = (L) => ce(i) ? i.value = L : null),
1101
+ title: e(v)("profile.title"),
1008
1102
  width: 560
1009
1103
  }, {
1010
- footer: l(() => [
1011
- t(e(D), {
1012
- onClick: f[4] || (f[4] = (U) => e(o)())
1104
+ footer: t(() => [
1105
+ l(e(Y), {
1106
+ onClick: d[4] || (d[4] = (L) => e(o)())
1013
1107
  }, {
1014
- default: l(() => [
1015
- F($(e(n)("profile.cancel")), 1)
1108
+ default: t(() => [
1109
+ $(C(e(v)("profile.cancel")), 1)
1016
1110
  ]),
1017
1111
  _: 1
1018
1112
  }),
1019
- t(e(D), {
1113
+ l(e(Y), {
1020
1114
  type: "primary",
1021
- loading: C.value,
1022
- onClick: b
1115
+ loading: S.value,
1116
+ onClick: w
1023
1117
  }, {
1024
- default: l(() => [
1025
- F($(e(n)("profile.save")), 1)
1118
+ default: t(() => [
1119
+ $(C(e(v)("profile.save")), 1)
1026
1120
  ]),
1027
1121
  _: 1
1028
1122
  }, 8, ["loading"])
1029
1123
  ]),
1030
- default: l(() => [
1031
- N("div", la, [
1032
- N("div", oa, [
1033
- i.avatarField ? (L(), O("div", sa, [
1034
- (L(), S(ge(i.avatarField), {
1035
- modelValue: w.value,
1036
- "onUpdate:modelValue": f[0] || (f[0] = (U) => w.value = U),
1037
- label: e(n)("profile.avatar"),
1124
+ default: t(() => [
1125
+ O("div", ia, [
1126
+ O("div", ua, [
1127
+ r.avatarField ? (x(), R("div", da, [
1128
+ (x(), F(Ve(r.avatarField), {
1129
+ modelValue: g.value,
1130
+ "onUpdate:modelValue": d[0] || (d[0] = (L) => g.value = L),
1131
+ label: e(v)("profile.avatar"),
1038
1132
  aspect: "1/1",
1039
1133
  captions: !1
1040
1134
  }, null, 8, ["modelValue", "label"]))
1041
- ])) : T("", !0),
1042
- N("div", na, [
1043
- t(e(M), {
1044
- label: e(n)("profile.name"),
1045
- error: r("name")
1135
+ ])) : M("", !0),
1136
+ O("div", ca, [
1137
+ l(e(N), {
1138
+ label: e(v)("profile.name"),
1139
+ error: u("name")
1046
1140
  }, {
1047
- default: l(() => [
1048
- t(e(E), {
1049
- modelValue: d.value.name,
1050
- "onUpdate:modelValue": f[1] || (f[1] = (U) => d.value.name = U),
1141
+ default: t(() => [
1142
+ l(e(K), {
1143
+ modelValue: m.value.name,
1144
+ "onUpdate:modelValue": d[1] || (d[1] = (L) => m.value.name = L),
1051
1145
  name: "name"
1052
1146
  }, null, 8, ["modelValue"])
1053
1147
  ]),
1054
1148
  _: 1
1055
1149
  }, 8, ["label", "error"]),
1056
- t(e(M), {
1057
- label: e(n)("admins.email")
1150
+ l(e(N), {
1151
+ label: e(v)("admins.email")
1058
1152
  }, {
1059
- default: l(() => [
1060
- t(e(E), {
1061
- "model-value": e(k).state.user?.email ?? "",
1153
+ default: t(() => [
1154
+ l(e(K), {
1155
+ "model-value": e(A).state.user?.email ?? "",
1062
1156
  readonly: ""
1063
1157
  }, null, 8, ["model-value"])
1064
1158
  ]),
1065
1159
  _: 1
1066
1160
  }, 8, ["label"]),
1067
- t(e(M), {
1068
- label: e(n)("profile.password"),
1069
- help: e(n)("profile.password-hint"),
1070
- error: r("password")
1161
+ l(e(N), {
1162
+ label: e(v)("profile.password"),
1163
+ help: e(v)("profile.password-hint"),
1164
+ error: u("password")
1071
1165
  }, {
1072
- default: l(() => [
1073
- t(e(E), {
1074
- modelValue: d.value.password,
1075
- "onUpdate:modelValue": f[2] || (f[2] = (U) => d.value.password = U),
1166
+ default: t(() => [
1167
+ l(e(K), {
1168
+ modelValue: m.value.password,
1169
+ "onUpdate:modelValue": d[2] || (d[2] = (L) => m.value.password = L),
1076
1170
  type: "password",
1077
1171
  autocomplete: "new-password"
1078
1172
  }, null, 8, ["modelValue"])
1079
1173
  ]),
1080
1174
  _: 1
1081
1175
  }, 8, ["label", "help", "error"]),
1082
- d.value.password ? (L(), S(e(M), {
1176
+ m.value.password ? (x(), F(e(N), {
1083
1177
  key: 0,
1084
- label: e(n)("profile.current-password"),
1085
- help: e(n)("profile.current-password-hint"),
1086
- error: r("current_password")
1178
+ label: e(v)("profile.current-password"),
1179
+ help: e(v)("profile.current-password-hint"),
1180
+ error: u("current_password")
1087
1181
  }, {
1088
- default: l(() => [
1089
- t(e(E), {
1090
- modelValue: d.value.current_password,
1091
- "onUpdate:modelValue": f[3] || (f[3] = (U) => d.value.current_password = U),
1182
+ default: t(() => [
1183
+ l(e(K), {
1184
+ modelValue: m.value.current_password,
1185
+ "onUpdate:modelValue": d[3] || (d[3] = (L) => m.value.current_password = L),
1092
1186
  type: "password",
1093
1187
  autocomplete: "current-password"
1094
1188
  }, null, 8, ["modelValue"])
1095
1189
  ]),
1096
1190
  _: 1
1097
- }, 8, ["label", "help", "error"])) : T("", !0)
1191
+ }, 8, ["label", "help", "error"])) : M("", !0)
1098
1192
  ])
1099
1193
  ])
1100
1194
  ])
@@ -1102,10 +1196,10 @@ const la = { class: "wx-profile-host" }, oa = { class: "wx-profile" }, sa = {
1102
1196
  _: 1
1103
1197
  }, 8, ["open", "title"]));
1104
1198
  }
1105
- }), ia = /* @__PURE__ */ ve(ra, [["__scopeId", "data-v-9583a67a"]]), ua = ["title"], da = {
1199
+ }), ma = /* @__PURE__ */ be(va, [["__scopeId", "data-v-9583a67a"]]), pa = ["title"], fa = {
1106
1200
  key: 0,
1107
1201
  class: "wx-user-menu__name"
1108
- }, ca = /* @__PURE__ */ R({
1202
+ }, ha = /* @__PURE__ */ j({
1109
1203
  __name: "UserMenu",
1110
1204
  props: {
1111
1205
  signOutLabel: { default: void 0 },
@@ -1114,137 +1208,137 @@ const la = { class: "wx-profile-host" }, oa = { class: "wx-profile" }, sa = {
1114
1208
  expanded: { type: Boolean, default: !1 }
1115
1209
  },
1116
1210
  setup(a) {
1117
- const i = a, s = q(), o = me(), u = ke(), k = I("webx-auth"), m = P(() => s.state.user), n = P(
1118
- () => u.state.panelLocales.length > 1 ? u.state.panelLocales : []
1119
- ), p = te(Ae, null), C = te(Le, null), V = g(void 0);
1120
- Z(
1121
- () => typeof m.value?.avatar == "string" ? m.value.avatar : null,
1122
- async (b) => {
1123
- const _ = i.resolveAvatar ?? p;
1124
- if (b === null || b === "" || _ === null) {
1125
- V.value = void 0;
1211
+ const r = a, s = X(), o = we(), i = $e(), A = D("webx-auth"), f = P(() => s.state.user), v = P(
1212
+ () => i.state.panelLocales.length > 1 ? i.state.panelLocales : []
1213
+ ), h = ue(Ue, null), S = ue(Fe, null), n = V(void 0);
1214
+ re(
1215
+ () => typeof f.value?.avatar == "string" ? f.value.avatar : null,
1216
+ async (w) => {
1217
+ const b = r.resolveAvatar ?? h;
1218
+ if (w === null || w === "" || b === null) {
1219
+ n.value = void 0;
1126
1220
  return;
1127
1221
  }
1128
- const f = await _(b);
1129
- m.value?.avatar === b && (V.value = f ?? void 0);
1222
+ const d = await b(w);
1223
+ f.value?.avatar === w && (n.value = d ?? void 0);
1130
1224
  },
1131
1225
  { immediate: !0 }
1132
1226
  );
1133
- const d = ce(ia);
1134
- function w() {
1227
+ const m = he(ma);
1228
+ function g() {
1135
1229
  setTimeout(
1136
1230
  () => {
1137
- d({ avatarField: i.avatarField ?? C ?? void 0 });
1231
+ m({ avatarField: r.avatarField ?? S ?? void 0 });
1138
1232
  },
1139
1233
  0
1140
1234
  );
1141
1235
  }
1142
- async function r(b) {
1143
- b !== u.state.locale && await o.setLocale(b);
1236
+ async function u(w) {
1237
+ w !== i.state.locale && await o.setLocale(w);
1144
1238
  }
1145
- return (b, _) => {
1146
- const f = B("wx-avatar"), U = B("wx-text"), W = B("wx-dropdown-item"), z = B("wx-divider"), h = B("wx-dropdown");
1147
- return m.value !== null ? (L(), S(h, { key: 0 }, {
1148
- trigger: l(() => [
1149
- N("button", {
1239
+ return (w, b) => {
1240
+ const d = T("wx-avatar"), L = T("wx-text"), U = T("wx-dropdown-item"), B = T("wx-divider"), y = T("wx-dropdown");
1241
+ return f.value !== null ? (x(), F(y, { key: 0 }, {
1242
+ trigger: t(() => [
1243
+ O("button", {
1150
1244
  type: "button",
1151
- class: Te(["wx-user-menu__trigger", { "wx-user-menu__trigger--named": a.expanded }]),
1152
- title: m.value.name
1245
+ class: Me(["wx-user-menu__trigger", { "wx-user-menu__trigger--named": a.expanded }]),
1246
+ title: f.value.name
1153
1247
  }, [
1154
- t(f, {
1155
- name: m.value.name,
1156
- src: V.value,
1248
+ l(d, {
1249
+ name: f.value.name,
1250
+ src: n.value,
1157
1251
  size: "lg"
1158
1252
  }, null, 8, ["name", "src"]),
1159
- a.expanded ? (L(), O("span", da, $(m.value.name), 1)) : T("", !0)
1160
- ], 10, ua)
1253
+ a.expanded ? (x(), R("span", fa, C(f.value.name), 1)) : M("", !0)
1254
+ ], 10, pa)
1161
1255
  ]),
1162
- default: l(() => [
1163
- t(W, { disabled: "" }, {
1164
- default: l(() => [
1165
- t(U, { size: "sm" }, {
1166
- default: l(() => [
1167
- F($(m.value.email), 1)
1256
+ default: t(() => [
1257
+ l(U, { disabled: "" }, {
1258
+ default: t(() => [
1259
+ l(L, { size: "sm" }, {
1260
+ default: t(() => [
1261
+ $(C(f.value.email), 1)
1168
1262
  ]),
1169
1263
  _: 1
1170
1264
  })
1171
1265
  ]),
1172
1266
  _: 1
1173
1267
  }),
1174
- t(z, { spacing: "sm" }),
1175
- t(W, {
1268
+ l(B, { spacing: "sm" }),
1269
+ l(U, {
1176
1270
  icon: "user",
1177
- onClick: w
1271
+ onClick: g
1178
1272
  }, {
1179
- default: l(() => [
1180
- F($(e(k)("profile.menu")), 1)
1273
+ default: t(() => [
1274
+ $(C(e(A)("profile.menu")), 1)
1181
1275
  ]),
1182
1276
  _: 1
1183
1277
  }),
1184
- n.value.length > 0 ? (L(), O(le, { key: 0 }, [
1185
- t(z, { spacing: "sm" }),
1186
- t(W, { disabled: "" }, {
1187
- default: l(() => [
1188
- t(U, {
1278
+ v.value.length > 0 ? (x(), R(oe, { key: 0 }, [
1279
+ l(B, { spacing: "sm" }),
1280
+ l(U, { disabled: "" }, {
1281
+ default: t(() => [
1282
+ l(L, {
1189
1283
  size: "sm",
1190
1284
  tone: "muted"
1191
1285
  }, {
1192
- default: l(() => [
1193
- F($(e(k)("menu.language")), 1)
1286
+ default: t(() => [
1287
+ $(C(e(A)("menu.language")), 1)
1194
1288
  ]),
1195
1289
  _: 1
1196
1290
  })
1197
1291
  ]),
1198
1292
  _: 1
1199
1293
  }),
1200
- (L(!0), O(le, null, _e(n.value, (c) => (L(), S(W, {
1201
- key: c.code,
1202
- icon: c.code === e(u).state.locale ? "check" : void 0,
1203
- onClick: (x) => r(c.code)
1294
+ (x(!0), R(oe, null, de(v.value, (p) => (x(), F(U, {
1295
+ key: p.code,
1296
+ icon: p.code === e(i).state.locale ? "check" : void 0,
1297
+ onClick: (k) => u(p.code)
1204
1298
  }, {
1205
- default: l(() => [
1206
- F($(c.nativeName), 1)
1299
+ default: t(() => [
1300
+ $(C(p.nativeName), 1)
1207
1301
  ]),
1208
1302
  _: 2
1209
1303
  }, 1032, ["icon", "onClick"]))), 128)),
1210
- t(z, { spacing: "sm" })
1211
- ], 64)) : T("", !0),
1212
- t(W, {
1304
+ l(B, { spacing: "sm" })
1305
+ ], 64)) : M("", !0),
1306
+ l(U, {
1213
1307
  icon: "logout",
1214
- onClick: _[0] || (_[0] = (c) => e(o).logout())
1308
+ onClick: b[0] || (b[0] = (p) => e(o).logout())
1215
1309
  }, {
1216
- default: l(() => [
1217
- F($(a.signOutLabel ?? e(k)("menu.sign-out")), 1)
1310
+ default: t(() => [
1311
+ $(C(a.signOutLabel ?? e(A)("menu.sign-out")), 1)
1218
1312
  ]),
1219
1313
  _: 1
1220
1314
  })
1221
1315
  ]),
1222
1316
  _: 1
1223
- })) : T("", !0);
1317
+ })) : M("", !0);
1224
1318
  };
1225
1319
  }
1226
- }), ba = /* @__PURE__ */ ve(ca, [["__scopeId", "data-v-d51d13e4"]]);
1227
- function ya(a = {}) {
1228
- const i = a.path ?? "/login";
1320
+ }), ka = /* @__PURE__ */ be(ha, [["__scopeId", "data-v-d51d13e4"]]);
1321
+ function Va(a = {}) {
1322
+ const r = a.path ?? "/login";
1229
1323
  return {
1230
1324
  install(s) {
1231
- const o = Ie(s.context);
1232
- s.i18n.defaults("webx-auth", $e), Ke(s.app, o, a.resolveAvatar ?? null, a.avatarField ?? null), s.context.useSessionLoader(() => o.me()), s.router.addRoute({
1233
- path: i,
1325
+ const o = Ge(s.context);
1326
+ s.i18n.defaults("webx-auth", Se), Je(s.app, o, a.resolveAvatar ?? null, a.avatarField ?? null), s.context.useSessionLoader(() => o.me()), s.router.addRoute({
1327
+ path: r,
1234
1328
  name: "webx.login",
1235
1329
  meta: { public: !0 },
1236
- component: { render: () => xe(He, { ...a.card }) }
1237
- }), s.router.beforeEach((u) => u.meta.public === !0 || s.context.state.status !== "unauthenticated" ? !0 : { path: i, query: u.fullPath === "/" ? {} : { next: u.fullPath } }), Z(
1330
+ component: { render: () => Ce(ea, { ...a.card }) }
1331
+ }), s.router.beforeEach((i) => i.meta.public === !0 || s.context.state.status !== "unauthenticated" ? !0 : { path: r, query: i.fullPath === "/" ? {} : { next: i.fullPath } }), re(
1238
1332
  () => s.context.state.status,
1239
- (u) => {
1240
- const k = s.router.currentRoute.value;
1241
- if (u === "unauthenticated" && k.path !== i) {
1242
- s.router.replace({ path: i, query: { next: k.fullPath } });
1333
+ (i) => {
1334
+ const A = s.router.currentRoute.value;
1335
+ if (i === "unauthenticated" && A.path !== r) {
1336
+ s.router.replace({ path: r, query: { next: A.fullPath } });
1243
1337
  return;
1244
1338
  }
1245
- if (u === "ready" && k.path === i) {
1246
- const m = k.query.next;
1247
- s.router.replace(typeof m == "string" ? m : "/");
1339
+ if (i === "ready" && A.path === r) {
1340
+ const f = A.query.next;
1341
+ s.router.replace(typeof f == "string" ? f : "/");
1248
1342
  }
1249
1343
  }
1250
1344
  );
@@ -1252,22 +1346,22 @@ function ya(a = {}) {
1252
1346
  };
1253
1347
  }
1254
1348
  export {
1255
- Ce as WxAdminList,
1256
- aa as WxAdminsPage,
1257
- He as WxLoginCard,
1258
- ia as WxProfileDialog,
1259
- ba as WxUserMenu,
1260
- fa as admins,
1261
- ya as auth,
1262
- Ve as authKey,
1263
- $e as authMessages,
1264
- Le as avatarFieldKey,
1265
- Ae as avatarResolverKey,
1266
- pe as createAdminsApi,
1267
- Ie as createAuthSession,
1268
- Ke as provideAuth,
1269
- wa as selectAdmin,
1270
- ha as selectAdmins,
1271
- me as useAuth
1349
+ We as WxAdminList,
1350
+ na as WxAdminsPage,
1351
+ ea as WxLoginCard,
1352
+ ma as WxProfileDialog,
1353
+ ka as WxUserMenu,
1354
+ ga as admins,
1355
+ Va as auth,
1356
+ Le as authKey,
1357
+ Se as authMessages,
1358
+ Fe as avatarFieldKey,
1359
+ Ue as avatarResolverKey,
1360
+ ye as createAdminsApi,
1361
+ Ge as createAuthSession,
1362
+ Je as provideAuth,
1363
+ _a as selectAdmin,
1364
+ xa as selectAdmins,
1365
+ we as useAuth
1272
1366
  };
1273
1367
  //# sourceMappingURL=index.js.map