@webx-ui/module-admin 0.4.2 → 0.5.0

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,93 +1,177 @@
1
- import { inject as R, reactive as C, computed as k, defineComponent as M, resolveComponent as y, openBlock as w, createBlock as S, unref as d, withCtx as x, createElementBlock as _, Fragment as U, renderList as P, ref as T, createVNode as b, createTextVNode as I, toDisplayString as W, renderSlot as $, createCommentVNode as J, isRef as Q, createApp as Y, h as A, useModel as Z, watch as ee, mergeModels as D } from "vue";
2
- import { useRouter as te, useRoute as ne, createRouter as ae, createWebHistory as le } from "vue-router";
3
- import { useResponsiveShell as oe, WxToaster as se, WebxUI as re, localesKey as ie, WxAlert as ce, WxSkeleton as ue } from "@webx-ui/core";
4
- import { WxScreenRenderer as de } from "@webx-ui/schema";
5
- const F = /* @__PURE__ */ Symbol("webx-admin");
6
- function N() {
7
- const e = R(F, null);
1
+ import { defineComponent as A, useModel as Z, openBlock as v, createElementBlock as p, normalizeClass as O, createBlock as b, unref as f, withCtx as g, createTextVNode as C, toDisplayString as E, createCommentVNode as T, renderSlot as $, Fragment as L, mergeModels as j, inject as z, reactive as F, computed as k, resolveComponent as _, renderList as M, ref as D, createVNode as S, createElementVNode as I, isRef as fe, createApp as me, h as P, watch as he, withModifiers as ve } from "vue";
2
+ import { useRouter as we, useRoute as ge, createRouter as ye, createWebHistory as pe } from "vue-router";
3
+ import { WxHeading as be, WxTabs as xe, WxCard as G, useResponsiveShell as _e, shellLayoutFor as ke, WxToaster as Se, WebxUI as $e, localesKey as Te, WxAlert as Ce, WxSkeleton as Ee, WxActions as Le, WxDropdownItem as Ae, WxTooltip as Ue, WxText as J } from "@webx-ui/core";
4
+ import { WxScreenRenderer as Pe } from "@webx-ui/schema";
5
+ const We = ["data-wx-fill"], Me = {
6
+ key: 0,
7
+ class: "wx-list-screen__head"
8
+ }, De = {
9
+ key: 1,
10
+ class: "wx-list-screen__actions"
11
+ }, ze = /* @__PURE__ */ A({
12
+ __name: "ListScreen",
13
+ props: /* @__PURE__ */ j({
14
+ title: { default: void 0 },
15
+ views: { default: void 0 },
16
+ card: { type: Boolean, default: !0 },
17
+ padding: { default: void 0 },
18
+ fill: { type: Boolean, default: !1 },
19
+ collapseBelow: { default: 560 }
20
+ }, {
21
+ view: { default: void 0 },
22
+ viewModifiers: {}
23
+ }),
24
+ emits: ["update:view"],
25
+ setup(e) {
26
+ const t = Z(e, "view");
27
+ return (n, l) => (v(), p("div", {
28
+ class: O(["wx-list-screen", { "is-fill": e.fill }]),
29
+ "data-wx-fill": e.fill ? "" : void 0
30
+ }, [
31
+ e.title || n.$slots.actions ? (v(), p("div", Me, [
32
+ e.title ? (v(), b(f(be), {
33
+ key: 0,
34
+ level: 2,
35
+ class: "wx-list-screen__title"
36
+ }, {
37
+ default: g(() => [
38
+ C(E(e.title), 1)
39
+ ]),
40
+ _: 1
41
+ })) : T("", !0),
42
+ n.$slots.actions ? (v(), p("div", De, [
43
+ $(n.$slots, "actions", {}, void 0, !0)
44
+ ])) : T("", !0)
45
+ ])) : T("", !0),
46
+ e.views && e.views.length > 0 ? (v(), b(f(xe), {
47
+ key: 1,
48
+ modelValue: t.value,
49
+ "onUpdate:modelValue": l[0] || (l[0] = (u) => t.value = u),
50
+ class: "wx-list-screen__views",
51
+ items: e.views,
52
+ "collapse-below": e.collapseBelow,
53
+ "aria-label": e.title
54
+ }, {
55
+ default: g(() => [
56
+ e.card ? (v(), b(f(G), {
57
+ key: 0,
58
+ class: "wx-list-screen__card",
59
+ padding: e.padding
60
+ }, {
61
+ default: g(() => [
62
+ $(n.$slots, "default", {}, void 0, !0)
63
+ ]),
64
+ _: 3
65
+ }, 8, ["padding"])) : $(n.$slots, "default", {}, void 0, !0, 1)
66
+ ]),
67
+ _: 3
68
+ }, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (v(), p(L, { key: 2 }, [
69
+ e.card ? (v(), b(f(G), {
70
+ key: 0,
71
+ class: "wx-list-screen__card",
72
+ padding: e.padding
73
+ }, {
74
+ default: g(() => [
75
+ $(n.$slots, "default", {}, void 0, !0)
76
+ ]),
77
+ _: 3
78
+ }, 8, ["padding"])) : $(n.$slots, "default", {}, void 0, !0, 1)
79
+ ], 64))
80
+ ], 10, We));
81
+ }
82
+ }), ee = (e, t) => {
83
+ const n = e.__vccOpts || e;
84
+ for (const [l, u] of t)
85
+ n[l] = u;
86
+ return n;
87
+ }, Ne = /* @__PURE__ */ ee(ze, [["__scopeId", "data-v-7586ed04"]]), Re = {
88
+ "wx-list": { component: Ne, kind: "layout", labelProp: "title" }
89
+ }, te = /* @__PURE__ */ Symbol("webx-admin");
90
+ function H() {
91
+ const e = z(te, null);
8
92
  if (e === null)
9
93
  throw new Error("useAdmin() was called outside a panel created by createAdmin().");
10
94
  return e;
11
95
  }
12
- function fe(e) {
13
- const n = C({
96
+ function Ie(e) {
97
+ const t = F({
14
98
  status: "loading",
15
99
  manifest: null,
16
100
  user: null,
17
101
  error: null
18
- }), o = k(() => {
19
- const t = n.manifest;
20
- if (t === null)
102
+ }), n = k(() => {
103
+ const a = t.manifest;
104
+ if (a === null)
21
105
  return [];
22
- const a = [];
23
- for (const c of t.modules) {
24
- const s = e.modules.find((h) => h.id === c.id);
25
- if (s === void 0)
106
+ const o = [];
107
+ for (const h of a.modules) {
108
+ const d = e.modules.find((w) => w.id === h.id);
109
+ if (d === void 0)
26
110
  continue;
27
- const v = s.path ?? s.routes?.[0]?.path;
28
- v !== void 0 && a.push({
29
- id: c.id,
30
- title: c.title,
31
- icon: c.icon,
32
- path: v,
33
- group: c.group ?? null
111
+ const y = d.path ?? d.routes?.[0]?.path;
112
+ y !== void 0 && o.push({
113
+ id: h.id,
114
+ title: h.title,
115
+ icon: h.icon,
116
+ path: y,
117
+ group: h.group ?? null
34
118
  });
35
119
  }
36
- return a;
37
- }), u = k(() => {
38
- const t = n.manifest?.groups ?? [], a = [], c = /* @__PURE__ */ new Map();
39
- for (const s of o.value)
40
- if (s.group !== null && t.some((v) => v.id === s.group)) {
41
- const v = c.get(s.group) ?? [];
42
- v.push(s), c.set(s.group, v);
120
+ return o;
121
+ }), l = k(() => {
122
+ const a = t.manifest?.groups ?? [], o = [], h = /* @__PURE__ */ new Map();
123
+ for (const d of n.value)
124
+ if (d.group !== null && a.some((y) => y.id === d.group)) {
125
+ const y = h.get(d.group) ?? [];
126
+ y.push(d), h.set(d.group, y);
43
127
  } else
44
- a.push(s);
128
+ o.push(d);
45
129
  return {
46
- top: a,
47
- groups: t.filter((s) => c.has(s.id)).map((s) => ({
48
- id: s.id,
49
- title: s.title,
50
- entries: c.get(s.id) ?? []
130
+ top: o,
131
+ groups: a.filter((d) => h.has(d.id)).map((d) => ({
132
+ id: d.id,
133
+ title: d.title,
134
+ entries: h.get(d.id) ?? []
51
135
  }))
52
136
  };
53
- }), f = {};
54
- for (const t of e.modules)
55
- Object.assign(f, t.types);
56
- Object.assign(f, e.types);
137
+ }), u = { ...Re };
138
+ for (const a of e.modules)
139
+ Object.assign(u, a.types);
140
+ Object.assign(u, e.types);
57
141
  const m = /* @__PURE__ */ new Map();
58
- async function p(t) {
59
- const a = `${e.i18n.state.locale}:${t}`;
60
- let c = m.get(a);
61
- return c === void 0 && (c = e.http.get(`${e.apiPath}/screens/${t}`).then((s) => s.data.root).catch((s) => {
62
- throw m.delete(a), s;
63
- }), m.set(a, c)), c;
142
+ async function s(a) {
143
+ const o = `${e.i18n.state.locale}:${a}`;
144
+ let h = m.get(o);
145
+ return h === void 0 && (h = e.http.get(`${e.apiPath}/screens/${a}`).then((d) => d.data.root).catch((d) => {
146
+ throw m.delete(o), d;
147
+ }), m.set(o, h)), h;
64
148
  }
65
- let r = null;
149
+ let c = null;
66
150
  async function i() {
67
- n.status = "loading", n.error = null;
151
+ t.status = "loading", t.error = null;
68
152
  try {
69
- if (r !== null && (n.user = await r(), n.user === null)) {
70
- n.manifest = null, n.status = "unauthenticated";
153
+ if (c !== null && (t.user = await c(), t.user === null)) {
154
+ t.manifest = null, t.status = "unauthenticated";
71
155
  return;
72
156
  }
73
- const t = await e.loadManifest();
74
- n.manifest = t, e.i18n.state.contentLocales = t.locales ?? [], e.i18n.state.panelLocales = t.panelLocales ?? e.i18n.state.panelLocales, t.locale !== void 0 && t.locale !== e.i18n.state.locale && await l(t.locale), n.status = "ready";
75
- } catch (t) {
76
- if (pe(t)) {
77
- n.manifest = null, n.user = null, n.status = "unauthenticated";
157
+ const a = await e.loadManifest();
158
+ t.manifest = a, e.i18n.state.contentLocales = a.locales ?? [], e.i18n.state.panelLocales = a.panelLocales ?? e.i18n.state.panelLocales, a.locale !== void 0 && a.locale !== e.i18n.state.locale && await r(a.locale), t.status = "ready";
159
+ } catch (a) {
160
+ if (Oe(a)) {
161
+ t.manifest = null, t.user = null, t.status = "unauthenticated";
78
162
  return;
79
163
  }
80
- n.error = t instanceof Error ? t.message : String(t), n.status = "error";
164
+ t.error = a instanceof Error ? a.message : String(a), t.status = "error";
81
165
  }
82
166
  }
83
- async function l(t) {
167
+ async function r(a) {
84
168
  if (e.loadDictionary === void 0) {
85
- e.i18n.state.locale = t;
169
+ e.i18n.state.locale = a;
86
170
  return;
87
171
  }
88
- if (await e.loadDictionary(t), n.manifest !== null)
172
+ if (await e.loadDictionary(a), t.manifest !== null)
89
173
  try {
90
- n.manifest = await e.loadManifest();
174
+ t.manifest = await e.loadManifest();
91
175
  } catch {
92
176
  }
93
177
  }
@@ -95,134 +179,134 @@ function fe(e) {
95
179
  http: e.http,
96
180
  basePath: e.basePath,
97
181
  apiPath: e.apiPath,
98
- state: n,
182
+ state: t,
99
183
  i18n: e.i18n,
100
184
  modules: e.modules,
101
- nav: o,
102
- groups: u,
103
- types: f,
185
+ nav: n,
186
+ groups: l,
187
+ types: u,
104
188
  reload: i,
105
- setLocale: l,
106
- setUser(t) {
107
- n.user = t;
189
+ setLocale: r,
190
+ setUser(a) {
191
+ t.user = a;
108
192
  },
109
- useSessionLoader(t) {
110
- r = t;
193
+ useSessionLoader(a) {
194
+ c = a;
111
195
  },
112
- can(t) {
113
- const a = n.user;
114
- return a === null ? !1 : a.isSuper || a.permissions.includes(t);
196
+ can(a) {
197
+ const o = t.user;
198
+ return o === null ? !1 : o.isSuper || o.permissions.includes(a);
115
199
  },
116
- loadScreen: p,
117
- screenPatch(t) {
118
- return e.screens?.[t] ?? [];
200
+ loadScreen: s,
201
+ screenPatch(a) {
202
+ return e.screens?.[a] ?? [];
119
203
  }
120
204
  };
121
205
  }
122
- function me(e, n) {
123
- e.provide(F, n);
206
+ function Ve(e, t) {
207
+ e.provide(te, t);
124
208
  }
125
- function pe(e) {
209
+ function Oe(e) {
126
210
  return typeof e == "object" && e !== null && "status" in e && e.status === 401;
127
211
  }
128
- const O = /* @__PURE__ */ Symbol("webx-i18n");
129
- function De() {
130
- const e = R(O, null);
212
+ const N = /* @__PURE__ */ Symbol("webx-i18n");
213
+ function St() {
214
+ const e = z(N, null);
131
215
  if (e === null)
132
216
  throw new Error("useI18n() was called outside a panel created by createAdmin().");
133
217
  return e;
134
218
  }
135
- function j(e) {
136
- const n = R(O, null);
137
- return n === null ? X().scope(e) : n.scope(e);
219
+ function R(e) {
220
+ const t = z(N, null);
221
+ return t === null ? X().scope(e) : t.scope(e);
138
222
  }
139
- function he(e, n) {
140
- e.provide(O, n);
223
+ function je(e, t) {
224
+ e.provide(N, t);
141
225
  }
142
226
  function X(e = {}) {
143
- const n = e.fallback ?? "en", o = C({
144
- locale: e.locale ?? n,
145
- fallback: n,
227
+ const t = e.fallback ?? "en", n = F({
228
+ locale: e.locale ?? t,
229
+ fallback: t,
146
230
  panelLocales: [],
147
231
  contentLocales: []
148
- }), u = {}, f = C({ value: {} });
149
- function m(r, i, l) {
150
- let t = r[i]?.[l[0] ?? ""];
151
- for (const a of l.slice(1)) {
152
- if (typeof t != "object" || t === null)
232
+ }), l = {}, u = F({ value: {} });
233
+ function m(c, i, r) {
234
+ let a = c[i]?.[r[0] ?? ""];
235
+ for (const o of r.slice(1)) {
236
+ if (typeof a != "object" || a === null)
153
237
  return null;
154
- t = t[a];
238
+ a = a[o];
155
239
  }
156
- return typeof t == "string" ? t : null;
240
+ return typeof a == "string" ? a : null;
157
241
  }
158
- function p(r, i, l) {
159
- const [t, a] = i.includes("::") ? i.split("::", 2) : [r, i], c = a.split("."), s = m(f.value, t, c) ?? m(u, t, c) ?? // Not an empty string: a key on screen is ugly, but it says which key, and a blank
242
+ function s(c, i, r) {
243
+ const [a, o] = i.includes("::") ? i.split("::", 2) : [c, i], h = o.split("."), d = m(u.value, a, h) ?? m(l, a, h) ?? // Not an empty string: a key on screen is ugly, but it says which key, and a blank
160
244
  // label says nothing to anybody trying to fix it.
161
245
  i;
162
- return l === void 0 ? s : ve(s, l);
246
+ return r === void 0 ? d : Fe(d, r);
163
247
  }
164
248
  return {
165
- state: o,
166
- defaults(r, i) {
167
- u[r] = { ...u[r], ...i };
249
+ state: n,
250
+ defaults(c, i) {
251
+ l[c] = { ...l[c], ...i };
168
252
  },
169
- load(r, i, l) {
170
- f.value = r ?? {}, o.locale = i ?? o.locale, l !== void 0 && (o.fallback = l);
253
+ load(c, i, r) {
254
+ u.value = c ?? {}, n.locale = i ?? n.locale, r !== void 0 && (n.fallback = r);
171
255
  },
172
- scope(r) {
173
- return (i, l) => p(r, i, l);
256
+ scope(c) {
257
+ return (i, r) => s(c, i, r);
174
258
  },
175
- t: (r, i) => p("", r, i)
259
+ t: (c, i) => s("", c, i)
176
260
  };
177
261
  }
178
- function ve(e, n) {
179
- let o = e;
180
- for (const [u, f] of Object.entries(n))
181
- o = o.replaceAll(`:${u}`, String(f));
182
- return o;
262
+ function Fe(e, t) {
263
+ let n = e;
264
+ for (const [l, u] of Object.entries(t))
265
+ n = n.replaceAll(`:${l}`, String(u));
266
+ return n;
183
267
  }
184
- const we = /* @__PURE__ */ M({
268
+ const Be = /* @__PURE__ */ A({
185
269
  __name: "AdminNav",
186
270
  props: {
187
271
  collapsed: { type: Boolean }
188
272
  },
189
273
  emits: ["select"],
190
- setup(e, { emit: n }) {
191
- const o = n, u = N(), f = j("webx-admin"), m = te(), p = ne(), r = k({
192
- get: () => u.nav.value.find((l) => p.path.startsWith(l.path))?.id ?? "",
274
+ setup(e, { emit: t }) {
275
+ const n = t, l = H(), u = R("webx-admin"), m = we(), s = ge(), c = k({
276
+ get: () => l.nav.value.find((r) => s.path.startsWith(r.path))?.id ?? "",
193
277
  set: (i) => {
194
- const l = u.nav.value.find((t) => t.id === i);
195
- l !== void 0 && m.push(l.path);
278
+ const r = l.nav.value.find((a) => a.id === i);
279
+ r !== void 0 && m.push(r.path);
196
280
  }
197
281
  });
198
- return (i, l) => {
199
- const t = y("wx-menu-item"), a = y("wx-submenu"), c = y("wx-menu");
200
- return w(), S(c, {
201
- modelValue: r.value,
202
- "onUpdate:modelValue": l[0] || (l[0] = (s) => r.value = s),
282
+ return (i, r) => {
283
+ const a = _("wx-menu-item"), o = _("wx-submenu"), h = _("wx-menu");
284
+ return v(), b(h, {
285
+ modelValue: c.value,
286
+ "onUpdate:modelValue": r[0] || (r[0] = (d) => c.value = d),
203
287
  collapsed: e.collapsed,
204
- label: d(f)("nav.sections"),
205
- onSelect: l[1] || (l[1] = (s) => o("select"))
288
+ label: f(u)("nav.sections"),
289
+ onSelect: r[1] || (r[1] = (d) => n("select"))
206
290
  }, {
207
- default: x(() => [
208
- (w(!0), _(U, null, P(d(u).groups.value.top, (s) => (w(), S(t, {
209
- key: s.id,
210
- value: s.id,
211
- icon: s.icon ?? void 0,
212
- label: s.title
291
+ default: g(() => [
292
+ (v(!0), p(L, null, M(f(l).groups.value.top, (d) => (v(), b(a, {
293
+ key: d.id,
294
+ value: d.id,
295
+ icon: d.icon ?? void 0,
296
+ label: d.title
213
297
  }, null, 8, ["value", "icon", "label"]))), 128)),
214
- (w(!0), _(U, null, P(d(u).groups.value.groups, (s) => (w(), S(a, {
215
- key: s.id,
216
- value: `group:${s.id}`,
217
- title: s.title,
298
+ (v(!0), p(L, null, M(f(l).groups.value.groups, (d) => (v(), b(o, {
299
+ key: d.id,
300
+ value: `group:${d.id}`,
301
+ title: d.title,
218
302
  icon: "gear"
219
303
  }, {
220
- default: x(() => [
221
- (w(!0), _(U, null, P(s.entries, (v) => (w(), S(t, {
222
- key: v.id,
223
- value: v.id,
224
- icon: v.icon ?? void 0,
225
- label: v.title
304
+ default: g(() => [
305
+ (v(!0), p(L, null, M(d.entries, (y) => (v(), b(a, {
306
+ key: y.id,
307
+ value: y.id,
308
+ icon: y.icon ?? void 0,
309
+ label: y.title
226
310
  }, null, 8, ["value", "icon", "label"]))), 128))
227
311
  ]),
228
312
  _: 2
@@ -232,138 +316,201 @@ const we = /* @__PURE__ */ M({
232
316
  }, 8, ["modelValue", "collapsed", "label"]);
233
317
  };
234
318
  }
235
- }), ge = {
319
+ }), He = {
236
320
  key: 0,
237
321
  class: "wx-root wx-admin-plain"
238
- }, ye = {
322
+ }, Xe = {
239
323
  key: 1,
240
324
  class: "wx-root wx-admin-plain"
241
- }, be = {
325
+ }, Ke = {
242
326
  key: 2,
243
327
  class: "wx-root wx-admin-plain"
244
- }, xe = /* @__PURE__ */ M({
328
+ }, qe = ["src", "alt", "width", "height"], Ye = ["src", "alt", "width", "height"], Ge = ["src", "alt"], Je = { class: "wx-admin__user" }, Qe = { class: "wx-admin__user wx-admin__user--drawer" }, Ze = /* @__PURE__ */ A({
245
329
  __name: "AdminShell",
246
330
  setup(e) {
247
- const n = N(), o = j("webx-admin"), u = T(null), { layout: f, collapsed: m, showAside: p, drawerOpen: r, toggle: i, close: l } = oe(u, {
248
- persist: "webx-admin-shell"
249
- });
250
- return (t, a) => {
251
- const c = y("router-view"), s = y("wx-loading"), v = y("wx-button"), h = y("wx-result"), g = y("wx-action"), E = y("wx-text"), K = y("wx-header"), q = y("wx-aside"), B = y("wx-main"), V = y("wx-container"), G = y("wx-drawer");
252
- return w(), _(U, null, [
253
- b(d(se)),
254
- d(n).state.status === "unauthenticated" ? (w(), _("div", ge, [
255
- b(c)
256
- ])) : d(n).state.status === "loading" ? (w(), _("div", ye, [
257
- b(s, {
258
- label: d(o)("shell.loading")
331
+ const t = H(), n = R("webx-admin"), l = D(null), { width: u, layout: m, collapsed: s, showAside: c, drawerOpen: i, toggle: r, close: a } = _e(
332
+ l,
333
+ { persist: "webx-admin-shell" }
334
+ ), o = k(() => t.state.manifest?.title ?? ""), h = k(() => t.state.manifest?.branding?.logo ?? null), d = k(() => t.state.manifest?.branding?.mark ?? null), y = k(() => ke(u.value, null));
335
+ return (w, x) => {
336
+ const U = _("router-view"), le = _("wx-loading"), se = _("wx-button"), oe = _("wx-result"), K = _("wx-action"), q = _("wx-text"), re = _("wx-header"), ie = _("wx-aside"), ue = _("wx-main"), ce = _("wx-container"), de = _("wx-drawer");
337
+ return v(), p(L, null, [
338
+ S(f(Se)),
339
+ f(t).state.status === "unauthenticated" ? (v(), p("div", He, [
340
+ S(U)
341
+ ])) : f(t).state.status === "loading" ? (v(), p("div", Xe, [
342
+ S(le, {
343
+ label: f(n)("shell.loading")
259
344
  }, null, 8, ["label"])
260
- ])) : d(n).state.status === "error" ? (w(), _("div", be, [
261
- b(h, {
345
+ ])) : f(t).state.status === "error" ? (v(), p("div", Ke, [
346
+ S(oe, {
262
347
  status: "error",
263
- title: d(o)("shell.error-title"),
264
- description: d(n).state.error
348
+ title: f(n)("shell.error-title"),
349
+ description: f(t).state.error
265
350
  }, {
266
- default: x(() => [
267
- b(v, {
351
+ default: g(() => [
352
+ S(se, {
268
353
  type: "primary",
269
- onClick: a[0] || (a[0] = (L) => d(n).reload())
354
+ onClick: x[0] || (x[0] = (Y) => f(t).reload())
270
355
  }, {
271
- default: x(() => [
272
- I(W(d(o)("shell.retry")), 1)
356
+ default: g(() => [
357
+ C(E(f(n)("shell.retry")), 1)
273
358
  ]),
274
359
  _: 1
275
360
  })
276
361
  ]),
277
362
  _: 1
278
363
  }, 8, ["title", "description"])
279
- ])) : (w(), _("div", {
364
+ ])) : (v(), p("div", {
280
365
  key: 3,
281
366
  ref_key: "shellEl",
282
- ref: u,
283
- class: "wx-root wx-admin"
367
+ ref: l,
368
+ class: O(["wx-root wx-admin", `wx-admin--${y.value}`])
284
369
  }, [
285
- b(V, { viewport: "" }, {
286
- default: x(() => [
287
- b(K, null, {
288
- end: x(() => [
289
- $(t.$slots, "user", {}, void 0, !0)
370
+ S(ce, {
371
+ direction: f(m) === "drawer" ? "vertical" : "horizontal",
372
+ "full-height": "",
373
+ class: "wx-admin__frame"
374
+ }, {
375
+ default: g(() => [
376
+ f(m) === "drawer" ? (v(), b(re, {
377
+ key: 0,
378
+ class: "wx-admin__header",
379
+ floating: "",
380
+ sticky: "",
381
+ bordered: !1,
382
+ padding: "sm",
383
+ height: "var(--wx-admin-header-height)"
384
+ }, {
385
+ end: g(() => [
386
+ $(w.$slots, "user", {}, void 0, !0)
290
387
  ]),
291
- default: x(() => [
292
- b(g, {
293
- icon: d(f) === "drawer" ? "menu" : "sidebar",
294
- title: d(f) === "drawer" ? d(o)("nav.menu") : d(o)("nav.collapse"),
295
- onClick: d(i)
296
- }, null, 8, ["icon", "title", "onClick"]),
297
- $(t.$slots, "brand", {}, () => [
298
- b(E, { weight: "semibold" }, {
299
- default: x(() => [
300
- I(W(d(n).state.manifest?.title), 1)
388
+ default: g(() => [
389
+ S(K, {
390
+ icon: "menu",
391
+ title: f(n)("nav.menu"),
392
+ onClick: f(r)
393
+ }, null, 8, ["title", "onClick"]),
394
+ $(w.$slots, "brand", {}, () => [
395
+ h.value ? (v(), p("img", {
396
+ key: 0,
397
+ class: "wx-admin__logo",
398
+ src: h.value.url,
399
+ alt: o.value,
400
+ width: h.value.width ?? void 0,
401
+ height: h.value.height ?? void 0
402
+ }, null, 8, qe)) : (v(), b(q, {
403
+ key: 1,
404
+ weight: "semibold",
405
+ truncate: ""
406
+ }, {
407
+ default: g(() => [
408
+ C(E(o.value), 1)
301
409
  ]),
302
410
  _: 1
303
- })
411
+ }))
304
412
  ], !0)
305
413
  ]),
306
414
  _: 3
307
- }),
308
- b(V, { direction: "horizontal" }, {
309
- default: x(() => [
310
- d(p) ? (w(), S(q, {
311
- key: 0,
312
- collapsed: d(m),
313
- width: 220,
314
- scroll: ""
315
- }, {
316
- default: x(() => [
317
- $(t.$slots, "nav", { collapsed: d(m) }, void 0, !0)
318
- ]),
319
- _: 3
320
- }, 8, ["collapsed"])) : J("", !0),
321
- b(B, {
322
- padding: "md",
323
- scroll: "",
324
- class: "wx-admin__screen"
325
- }, {
326
- default: x(() => [
327
- b(c)
328
- ]),
329
- _: 1
330
- })
415
+ })) : T("", !0),
416
+ f(c) ? (v(), b(ie, {
417
+ key: 1,
418
+ class: "wx-admin__aside",
419
+ sticky: "",
420
+ floating: "",
421
+ scroll: "",
422
+ bordered: !1,
423
+ collapsed: f(s),
424
+ width: 220,
425
+ "collapsed-width": 56
426
+ }, {
427
+ top: g(() => [
428
+ I("div", {
429
+ class: O(["wx-admin__brand", { "wx-admin__brand--stacked": f(s) && d.value }])
430
+ }, [
431
+ f(s) ? d.value ? (v(), p("img", {
432
+ key: 1,
433
+ class: "wx-admin__mark",
434
+ src: d.value.url,
435
+ alt: o.value
436
+ }, null, 8, Ge)) : T("", !0) : $(w.$slots, "brand", {}, () => [
437
+ h.value ? (v(), p("img", {
438
+ key: 0,
439
+ class: "wx-admin__logo",
440
+ src: h.value.url,
441
+ alt: o.value,
442
+ width: h.value.width ?? void 0,
443
+ height: h.value.height ?? void 0
444
+ }, null, 8, Ye)) : (v(), b(q, {
445
+ key: 1,
446
+ weight: "semibold",
447
+ truncate: "",
448
+ class: "wx-admin__title"
449
+ }, {
450
+ default: g(() => [
451
+ C(E(o.value), 1)
452
+ ]),
453
+ _: 1
454
+ }))
455
+ ], !0, 0),
456
+ S(K, {
457
+ icon: "sidebar",
458
+ title: f(s) ? f(n)("nav.expand") : f(n)("nav.collapse"),
459
+ onClick: f(r)
460
+ }, null, 8, ["title", "onClick"])
461
+ ], 2)
462
+ ]),
463
+ bottom: g(() => [
464
+ I("div", Je, [
465
+ $(w.$slots, "user", {}, void 0, !0)
466
+ ])
467
+ ]),
468
+ default: g(() => [
469
+ $(w.$slots, "nav", { collapsed: f(s) }, void 0, !0)
331
470
  ]),
332
471
  _: 3
472
+ }, 8, ["collapsed"])) : T("", !0),
473
+ S(ue, {
474
+ padding: "none",
475
+ class: "wx-admin__screen"
476
+ }, {
477
+ default: g(() => [
478
+ S(U)
479
+ ]),
480
+ _: 1
333
481
  })
334
482
  ]),
335
483
  _: 3
336
- }),
337
- b(G, {
338
- open: d(r),
339
- "onUpdate:open": a[2] || (a[2] = (L) => Q(r) ? r.value = L : null),
340
- title: d(o)("nav.menu"),
484
+ }, 8, ["direction"]),
485
+ S(de, {
486
+ open: f(i),
487
+ "onUpdate:open": x[1] || (x[1] = (Y) => fe(i) ? i.value = Y : null),
488
+ title: o.value === "" ? f(n)("nav.menu") : o.value,
341
489
  side: "left",
342
490
  size: 260,
343
491
  closable: ""
344
492
  }, {
345
- default: x(() => [
346
- $(t.$slots, "nav", {
493
+ footer: g(() => [
494
+ I("div", Qe, [
495
+ $(w.$slots, "user", {}, void 0, !0)
496
+ ])
497
+ ]),
498
+ default: g(() => [
499
+ $(w.$slots, "nav", {
347
500
  collapsed: !1,
348
- onSelect: a[1] || (a[1] = //@ts-ignore
349
- (...L) => d(l) && d(l)(...L))
501
+ select: f(a)
350
502
  }, void 0, !0)
351
503
  ]),
352
504
  _: 3
353
505
  }, 8, ["open", "title"])
354
- ], 512))
506
+ ], 2))
355
507
  ], 64);
356
508
  };
357
509
  }
358
- }), _e = (e, n) => {
359
- const o = e.__vccOpts || e;
360
- for (const [u, f] of n)
361
- o[u] = f;
362
- return o;
363
- }, Se = /* @__PURE__ */ _e(xe, [["__scopeId", "data-v-9ef35d4d"]]);
364
- class ke extends Error {
365
- constructor(n, o, u = {}, f = null, m = null) {
366
- super(n), this.status = o, this.errors = u, this.retryAfter = f, this.body = m, this.name = "HttpError";
510
+ }), et = /* @__PURE__ */ ee(Ze, [["__scopeId", "data-v-bbe585dd"]]);
511
+ class B extends Error {
512
+ constructor(t, n, l = {}, u = null, m = null) {
513
+ super(t), this.status = n, this.errors = l, this.retryAfter = u, this.body = m, this.name = "HttpError";
367
514
  }
368
515
  status;
369
516
  errors;
@@ -380,86 +527,86 @@ class ke extends Error {
380
527
  return this.status === 429;
381
528
  }
382
529
  }
383
- const Ee = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
384
- function Le(e = {}) {
385
- const n = (e.baseUrl ?? "").replace(/\/$/, ""), o = e.csrfUrl ?? "/sanctum/csrf-cookie", u = e.fetch ?? globalThis.fetch.bind(globalThis), f = e.onUnauthenticated, m = e.headers;
386
- let p = !1;
387
- async function r(l = !1) {
388
- p && !l && H("XSRF-TOKEN") !== null || (await u(o, { credentials: "same-origin" }), p = !0);
530
+ const tt = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
531
+ function nt(e = {}) {
532
+ const t = (e.baseUrl ?? "").replace(/\/$/, ""), n = e.csrfUrl ?? "/sanctum/csrf-cookie", l = e.fetch ?? globalThis.fetch.bind(globalThis), u = e.onUnauthenticated, m = e.headers;
533
+ let s = !1;
534
+ async function c(r = !1) {
535
+ s && !r && Q("XSRF-TOKEN") !== null || (await l(n, { credentials: "same-origin" }), s = !0);
389
536
  }
390
- async function i(l, t, a, c = {}, s = !1) {
391
- const v = Ee.has(l);
392
- v && await r();
393
- const h = {
537
+ async function i(r, a, o, h = {}, d = !1) {
538
+ const y = tt.has(r);
539
+ y && await c();
540
+ const w = {
394
541
  Accept: "application/json",
395
542
  "X-Requested-With": "XMLHttpRequest",
396
543
  // Standing headers first, so a caller can still override one for a single request.
397
544
  ...m?.(),
398
- ...c.headers
545
+ ...h.headers
399
546
  };
400
- if (v) {
401
- const E = H("XSRF-TOKEN");
402
- E !== null && (h["X-XSRF-TOKEN"] = E);
547
+ if (y) {
548
+ const U = Q("XSRF-TOKEN");
549
+ U !== null && (w["X-XSRF-TOKEN"] = U);
403
550
  }
404
- a !== void 0 && (h["Content-Type"] = "application/json");
405
- const g = await u(Ae(n, t, c.query), {
406
- method: l,
551
+ o !== void 0 && (w["Content-Type"] = "application/json");
552
+ const x = await l(lt(t, a, h.query), {
553
+ method: r,
407
554
  credentials: "same-origin",
408
- headers: h,
409
- signal: c.signal,
410
- body: a === void 0 ? void 0 : JSON.stringify(a)
555
+ headers: w,
556
+ signal: h.signal,
557
+ body: o === void 0 ? void 0 : JSON.stringify(o)
411
558
  });
412
- if (g.status === 419 && v && !s)
413
- return await r(!0), i(l, t, a, c, !0);
414
- if (g.status === 401 && f?.(), !g.ok)
415
- throw await $e(g);
416
- if (g.status !== 204)
417
- return await g.json();
559
+ if (x.status === 419 && y && !d)
560
+ return await c(!0), i(r, a, o, h, !0);
561
+ if (x.status === 401 && u?.(), !x.ok)
562
+ throw await at(x);
563
+ if (x.status !== 204)
564
+ return await x.json();
418
565
  }
419
566
  return {
420
- get: (l, t) => i("GET", l, void 0, t),
421
- post: (l, t, a) => i("POST", l, t, a),
422
- put: (l, t, a) => i("PUT", l, t, a),
423
- patch: (l, t, a) => i("PATCH", l, t, a),
424
- delete: (l, t) => i("DELETE", l, void 0, t)
567
+ get: (r, a) => i("GET", r, void 0, a),
568
+ post: (r, a, o) => i("POST", r, a, o),
569
+ put: (r, a, o) => i("PUT", r, a, o),
570
+ patch: (r, a, o) => i("PATCH", r, a, o),
571
+ delete: (r, a) => i("DELETE", r, void 0, a)
425
572
  };
426
573
  }
427
- async function $e(e) {
428
- let n = null;
574
+ async function at(e) {
575
+ let t = null;
429
576
  try {
430
- n = await e.json();
577
+ t = await e.json();
431
578
  } catch {
432
579
  }
433
- const o = n ?? {}, u = typeof o.message == "string" && o.message !== "" ? o.message : e.statusText || `Request failed with ${e.status}`, f = o.errors !== null && typeof o.errors == "object" ? o.errors : {}, m = e.headers.get("Retry-After"), p = m === null ? null : Number.parseInt(m, 10);
434
- return new ke(
435
- u,
580
+ const n = t ?? {}, l = typeof n.message == "string" && n.message !== "" ? n.message : e.statusText || `Request failed with ${e.status}`, u = n.errors !== null && typeof n.errors == "object" ? n.errors : {}, m = e.headers.get("Retry-After"), s = m === null ? null : Number.parseInt(m, 10);
581
+ return new B(
582
+ l,
436
583
  e.status,
437
- f,
438
- Number.isFinite(p) ? p : null,
439
- n
584
+ u,
585
+ Number.isFinite(s) ? s : null,
586
+ t
440
587
  );
441
588
  }
442
- function Ae(e, n, o) {
443
- const f = /^https?:\/\//i.test(n) ? n : `${e}/${n.replace(/^\//, "")}`;
444
- if (o === void 0)
445
- return f;
589
+ function lt(e, t, n) {
590
+ const u = /^https?:\/\//i.test(t) ? t : `${e}/${t.replace(/^\//, "")}`;
591
+ if (n === void 0)
592
+ return u;
446
593
  const m = new URLSearchParams();
447
- for (const [r, i] of Object.entries(o))
448
- i != null && m.set(r, String(i));
449
- const p = m.toString();
450
- return p === "" ? f : `${f}${f.includes("?") ? "&" : "?"}${p}`;
594
+ for (const [c, i] of Object.entries(n))
595
+ i != null && m.set(c, String(i));
596
+ const s = m.toString();
597
+ return s === "" ? u : `${u}${u.includes("?") ? "&" : "?"}${s}`;
451
598
  }
452
- function H(e) {
599
+ function Q(e) {
453
600
  if (typeof document > "u")
454
601
  return null;
455
- for (const n of document.cookie.split(";")) {
456
- const [o, ...u] = n.trim().split("=");
457
- if (o === e)
458
- return decodeURIComponent(u.join("="));
602
+ for (const t of document.cookie.split(";")) {
603
+ const [n, ...l] = t.trim().split("=");
604
+ if (n === e)
605
+ return decodeURIComponent(l.join("="));
459
606
  }
460
607
  return null;
461
608
  }
462
- const Ue = {
609
+ const ne = {
463
610
  shell: {
464
611
  loading: "Loading the panel…",
465
612
  "error-title": "The panel could not start",
@@ -471,110 +618,218 @@ const Ue = {
471
618
  sections: "Sections",
472
619
  menu: "Menu",
473
620
  collapse: "Collapse the menu",
474
- language: "Language"
621
+ expand: "Expand the menu",
622
+ language: "Language",
623
+ // The one menu group the panel names itself; a module's own group is named by the module.
624
+ system: "System"
625
+ },
626
+ // When something happened, said the way a person would. The month names and the order of
627
+ // the parts come from `Intl` — only the words that no formatter knows are here.
628
+ dates: {
629
+ today: "today at :time",
630
+ yesterday: "yesterday at :time",
631
+ // Not an empty cell and not a dash: a column that says nothing leaves a reader wondering
632
+ // whether the panel failed to load it.
633
+ never: "never"
634
+ },
635
+ // How a request fails, in the panel's words rather than the server's (§13.3). `errors.ts`
636
+ // decides which of these a status gets.
637
+ errors: {
638
+ "signed-out": "You are signed out. Sign in again and try once more.",
639
+ forbidden: "You are not allowed to do that.",
640
+ gone: "It is not there any more — somebody may have deleted it.",
641
+ conflict: "Somebody changed this while you were working on it.",
642
+ throttled: "Too many attempts. Try again in a moment.",
643
+ "throttled-in": "Too many attempts. Try again in :seconds seconds.",
644
+ server: "The server could not do that. Try again in a moment.",
645
+ offline: "The server did not answer. Check the connection and try again.",
646
+ unknown: "That did not work."
475
647
  }
476
- }, z = "webx.locale";
477
- function He(e = {}) {
478
- const n = e.manifestUrl ?? Ne() ?? "/api/cms/manifest", o = e.apiPath ?? n.replace(/\/manifest\/?$/, ""), u = e.basePath ?? "/cms", f = e.modules ?? [], m = [...e.routes ?? []];
479
- for (const h of f)
480
- m.push(...h.routes ?? []);
481
- const p = ae({
482
- history: le(u),
648
+ }, ae = "webx.locale";
649
+ function $t(e = {}) {
650
+ const t = e.manifestUrl ?? ct() ?? "/api/cms/manifest", n = e.apiPath ?? t.replace(/\/manifest\/?$/, ""), l = e.basePath ?? "/cms", u = e.modules ?? [], m = [...e.routes ?? []];
651
+ for (const w of u)
652
+ m.push(...w.routes ?? []);
653
+ const s = ye({
654
+ history: pe(l),
483
655
  routes: m
484
- }), r = X({ locale: e.locale ?? Pe() }), i = e.http ?? Le({
656
+ }), c = X({ locale: e.locale ?? ot() }), i = e.http ?? nt({
485
657
  baseUrl: "",
486
658
  onUnauthenticated: () => {
487
- t.setUser(null), t.state.status = "unauthenticated";
659
+ a.setUser(null), a.state.status = "unauthenticated";
488
660
  },
489
661
  // Every request says which language the panel is currently showing. It decides what
490
662
  // the server writes its own messages in — a 422 under a field — for anybody who has
491
663
  // not stored a preference yet, which is everybody until they choose one. Without it,
492
664
  // signing in on a Russian sign-in screen lands in an English panel.
493
- headers: () => ({ "X-Webx-Locale": r.state.locale })
665
+ headers: () => ({ "X-Webx-Locale": c.state.locale })
494
666
  });
495
- r.defaults("webx-admin", Ue);
496
- async function l(h) {
497
- const g = await i.get(`${o}/translations/${h}`);
498
- r.load(g.data.namespaces, g.data.locale, g.data.fallback), Ce(g.data.locale), Me(g.data.locale, r.state.panelLocales);
667
+ c.defaults("webx-admin", ne);
668
+ async function r(w) {
669
+ const x = await i.get(`${n}/translations/${w}`);
670
+ c.load(x.data.namespaces, x.data.locale, x.data.fallback), rt(x.data.locale), ut(x.data.locale, c.state.panelLocales);
499
671
  }
500
- const t = fe({
672
+ const a = Ie({
501
673
  http: i,
502
- basePath: u,
503
- apiPath: o,
504
- modules: f,
505
- i18n: r,
506
- loadDictionary: l,
674
+ basePath: l,
675
+ apiPath: n,
676
+ modules: u,
677
+ i18n: c,
678
+ loadDictionary: r,
507
679
  types: e.types,
508
680
  screens: e.screens,
509
- loadManifest: async () => (await i.get(n)).data
510
- }), a = Y(Te(e));
511
- a.use(re), me(a, t), he(a, r);
512
- const c = T("");
513
- a.provide(ie, {
681
+ loadManifest: async () => (await i.get(t)).data
682
+ }), o = me(st(e));
683
+ o.use($e), Ve(o, a), je(o, c);
684
+ const h = D("");
685
+ o.provide(Te, {
514
686
  list: k(
515
- () => r.state.contentLocales.map((h) => ({
516
- code: h.code,
517
- label: h.code.toUpperCase()
687
+ () => c.state.contentLocales.map((w) => ({
688
+ code: w.code,
689
+ label: w.code.toUpperCase()
518
690
  }))
519
691
  ),
520
692
  active: k({
521
- get: () => c.value || (r.state.contentLocales[0]?.code ?? ""),
522
- set: (h) => {
523
- c.value = h;
693
+ get: () => h.value || (c.state.contentLocales[0]?.code ?? ""),
694
+ set: (w) => {
695
+ h.value = w;
524
696
  }
525
697
  })
526
698
  });
527
- const s = {
528
- app: a,
529
- router: p,
530
- context: t,
531
- i18n: r,
699
+ const d = {
700
+ app: o,
701
+ router: s,
702
+ context: a,
703
+ i18n: c,
532
704
  async mount() {
533
- await Promise.all([v(), l(r.state.locale)]).catch(() => {
534
- }), a.mount(e.el ?? "#webx-app"), await t.reload();
705
+ await Promise.all([y(), r(c.state.locale)]).catch(() => {
706
+ }), o.mount(e.el ?? "#webx-app"), await a.reload();
535
707
  }
536
708
  };
537
- async function v() {
538
- const h = await i.get(`${o}/locales`);
539
- r.state.panelLocales = h.data.panel, r.state.contentLocales = h.data.content;
709
+ async function y() {
710
+ const w = await i.get(`${n}/locales`);
711
+ c.state.panelLocales = w.data.panel, c.state.contentLocales = w.data.content;
540
712
  }
541
- for (const h of e.plugins ?? [])
542
- h.install(s);
543
- return a.use(p), s;
713
+ for (const w of e.plugins ?? [])
714
+ w.install(d);
715
+ return o.use(s), d;
544
716
  }
545
- function Te(e) {
546
- const n = {
717
+ function st(e) {
718
+ const t = {
547
719
  // The menu is the panel's own: it is the manifest, drawn.
548
- nav: (o) => A(we, { collapsed: o.collapsed === !0 })
720
+ // The shell hands in what a choice means where it drew the menu — in the drawer it is what
721
+ // closes it, and a drawer that stays open over the section it just opened is a drawer the
722
+ // reader has to dismiss by hand.
723
+ nav: (n) => P(Be, { collapsed: n.collapsed === !0, onSelect: n.select })
549
724
  };
550
- return e.brand !== void 0 && (n.brand = () => A(e.brand)), e.userMenu !== void 0 && (n.user = () => A(e.userMenu)), { render: () => A(Se, null, n) };
725
+ return e.brand !== void 0 && (t.brand = () => P(e.brand)), e.userMenu !== void 0 && (t.user = () => P(e.userMenu)), { render: () => P(et, null, t) };
551
726
  }
552
- function Pe() {
553
- const e = Re(z);
727
+ function ot() {
728
+ const e = it(ae);
554
729
  return e !== null ? e : typeof document < "u" && document.documentElement.lang !== "" ? document.documentElement.lang : typeof navigator > "u" ? "en" : navigator.language;
555
730
  }
556
- function Ce(e) {
731
+ function rt(e) {
557
732
  try {
558
- localStorage.setItem(z, e);
733
+ localStorage.setItem(ae, e);
559
734
  } catch {
560
735
  }
561
736
  }
562
- function Re(e) {
737
+ function it(e) {
563
738
  try {
564
739
  return localStorage.getItem(e);
565
740
  } catch {
566
741
  return null;
567
742
  }
568
743
  }
569
- function Me(e, n) {
570
- typeof document > "u" || (document.documentElement.lang = e, document.documentElement.dir = n.find((o) => o.code === e)?.direction ?? "ltr");
744
+ function ut(e, t) {
745
+ typeof document > "u" || (document.documentElement.lang = e, document.documentElement.dir = t.find((n) => n.code === e)?.direction ?? "ltr");
571
746
  }
572
- function Ne() {
747
+ function ct() {
573
748
  return typeof document > "u" ? null : document.querySelector('meta[name="webx-manifest"]')?.getAttribute("content") ?? null;
574
749
  }
575
- const Oe = { class: "wx-screen-host" }, Fe = /* @__PURE__ */ M({
750
+ function dt(e) {
751
+ const t = e.scope("webx-admin"), n = /* @__PURE__ */ new Map();
752
+ function l(m, s, c) {
753
+ const i = e.state.locale, r = `${i}:${m}`;
754
+ let a = n.get(r);
755
+ return a === void 0 && (a = new Intl.DateTimeFormat(i, s), n.set(r, a)), a.format(c);
756
+ }
757
+ const u = (m) => l("time", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }, m);
758
+ return {
759
+ short(m) {
760
+ const s = V(m);
761
+ if (s === null)
762
+ return t("dates.never");
763
+ const c = /* @__PURE__ */ new Date(), i = ht(s, c);
764
+ return i === 0 ? t("dates.today", { time: u(s) }) : i === -1 ? t("dates.yesterday", { time: u(s) }) : s.getFullYear() === c.getFullYear() ? l(
765
+ "this-year",
766
+ {
767
+ day: "numeric",
768
+ month: "long",
769
+ hour: "2-digit",
770
+ minute: "2-digit",
771
+ hourCycle: "h23"
772
+ },
773
+ s
774
+ ) : l("earlier", { day: "numeric", month: "long", year: "numeric" }, s);
775
+ },
776
+ exact(m) {
777
+ const s = V(m);
778
+ return s === null ? "" : l("exact", { dateStyle: "long", timeStyle: "medium", hourCycle: "h23" }, s);
779
+ },
780
+ iso(m) {
781
+ const s = V(m);
782
+ return s === null ? "" : s.toISOString();
783
+ }
784
+ };
785
+ }
786
+ function ft() {
787
+ const e = z(N, null);
788
+ return dt(e ?? mt());
789
+ }
790
+ let W = null;
791
+ function mt() {
792
+ return W === null && (W = X(), W.defaults("webx-admin", ne)), W;
793
+ }
794
+ function V(e) {
795
+ if (e == null || e === "")
796
+ return null;
797
+ const t = e instanceof Date ? e : new Date(e);
798
+ return Number.isNaN(t.getTime()) ? null : t;
799
+ }
800
+ function ht(e, t) {
801
+ const n = (l) => Date.UTC(l.getFullYear(), l.getMonth(), l.getDate());
802
+ return Math.round((n(e) - n(t)) / 864e5);
803
+ }
804
+ function vt(e, t, n) {
805
+ const l = e instanceof B ? e.status : wt(e);
806
+ if (l === 422)
807
+ return gt(e) ?? n ?? t("errors.unknown");
808
+ if (l === 401) return t("errors.signed-out");
809
+ if (l === 403) return t("errors.forbidden");
810
+ if (l === 404) return t("errors.gone");
811
+ if (l === 409) return t("errors.conflict");
812
+ if (l === 429) {
813
+ const u = e instanceof B ? e.retryAfter : null;
814
+ return u === null ? t("errors.throttled") : t("errors.throttled-in", { seconds: u });
815
+ }
816
+ return l !== null && l >= 500 ? t("errors.server") : l === null ? t("errors.offline") : n ?? t("errors.unknown");
817
+ }
818
+ function Tt() {
819
+ const e = R("webx-admin");
820
+ return (t, n) => vt(t, e, n);
821
+ }
822
+ function wt(e) {
823
+ const t = e?.status;
824
+ return typeof t == "number" ? t : null;
825
+ }
826
+ function gt(e) {
827
+ const n = e?.body?.message;
828
+ return typeof n == "string" && n !== "" ? n : null;
829
+ }
830
+ const yt = { class: "wx-screen-host" }, Ct = /* @__PURE__ */ A({
576
831
  __name: "Screen",
577
- props: /* @__PURE__ */ D({
832
+ props: /* @__PURE__ */ j({
578
833
  name: {},
579
834
  errors: { default: void 0 },
580
835
  disabled: { type: Boolean, default: !1 },
@@ -585,39 +840,39 @@ const Oe = { class: "wx-screen-host" }, Fe = /* @__PURE__ */ M({
585
840
  modelValue: { default: () => ({}) },
586
841
  modelModifiers: {}
587
842
  }),
588
- emits: /* @__PURE__ */ D(["loaded"], ["update:modelValue"]),
589
- setup(e, { expose: n, emit: o }) {
590
- const u = e, f = o, m = Z(e, "modelValue"), p = N(), r = j("webx-admin"), i = T(null), l = T(null);
591
- async function t() {
592
- i.value = null, l.value = null;
843
+ emits: /* @__PURE__ */ j(["loaded"], ["update:modelValue"]),
844
+ setup(e, { expose: t, emit: n }) {
845
+ const l = e, u = n, m = Z(e, "modelValue"), s = H(), c = R("webx-admin"), i = D(null), r = D(null);
846
+ async function a() {
847
+ i.value = null, r.value = null;
593
848
  try {
594
- const a = await p.loadScreen(u.name);
595
- i.value = a, f("loaded", a);
596
- } catch (a) {
597
- l.value = a instanceof Error ? a.message : String(a);
849
+ const o = await s.loadScreen(l.name);
850
+ i.value = o, u("loaded", o);
851
+ } catch (o) {
852
+ r.value = o instanceof Error ? o.message : String(o);
598
853
  }
599
854
  }
600
- return ee([() => u.name, () => p.i18n.state.locale], () => {
601
- t();
602
- }, { immediate: !0 }), n({ reload: t }), (a, c) => (w(), _("div", Oe, [
603
- l.value ? (w(), S(d(ce), {
855
+ return he([() => l.name, () => s.i18n.state.locale], () => {
856
+ a();
857
+ }, { immediate: !0 }), t({ reload: a }), (o, h) => (v(), p("div", yt, [
858
+ r.value ? (v(), b(f(Ce), {
604
859
  key: 0,
605
860
  type: "danger",
606
- title: d(r)("shell.error-title"),
607
- description: l.value
608
- }, null, 8, ["title", "description"])) : i.value === null ? (w(), S(d(ue), {
861
+ title: f(c)("shell.error-title"),
862
+ description: r.value
863
+ }, null, 8, ["title", "description"])) : i.value === null ? (v(), b(f(Ee), {
609
864
  key: 1,
610
865
  rows: 4
611
- })) : (w(), S(d(de), {
866
+ })) : (v(), b(f(Pe), {
612
867
  key: 2,
613
868
  modelValue: m.value,
614
- "onUpdate:modelValue": c[0] || (c[0] = (s) => m.value = s),
869
+ "onUpdate:modelValue": h[0] || (h[0] = (d) => m.value = d),
615
870
  root: i.value,
616
- patch: d(p).screenPatch(e.name),
617
- types: d(p).types,
871
+ patch: f(s).screenPatch(e.name),
872
+ types: f(s).types,
618
873
  errors: e.errors,
619
- translate: d(p).i18n.t,
620
- can: d(p).can,
874
+ translate: f(s).i18n.t,
875
+ can: f(s).can,
621
876
  disabled: e.disabled,
622
877
  "label-position": e.labelPosition,
623
878
  "label-width": e.labelWidth,
@@ -625,24 +880,121 @@ const Oe = { class: "wx-screen-host" }, Fe = /* @__PURE__ */ M({
625
880
  }, null, 8, ["modelValue", "root", "patch", "types", "errors", "translate", "can", "disabled", "label-position", "label-width", "size"]))
626
881
  ]));
627
882
  }
883
+ }), pt = {
884
+ key: 0,
885
+ class: "wx-dropdown__divider"
886
+ }, Et = /* @__PURE__ */ A({
887
+ __name: "RowMenu",
888
+ props: {
889
+ actions: {},
890
+ label: { default: void 0 },
891
+ size: { default: "sm" }
892
+ },
893
+ setup(e) {
894
+ const t = e, n = k(() => [
895
+ ...t.actions.filter((u) => !u.danger),
896
+ ...t.actions.filter((u) => u.danger)
897
+ ]), l = k(() => {
898
+ const u = n.value.find((m) => m.danger);
899
+ return u && n.value[0] !== u ? u.key : null;
900
+ });
901
+ return (u, m) => n.value.length > 0 ? (v(), b(f(Le), {
902
+ key: 0,
903
+ collapse: "always",
904
+ align: "end",
905
+ size: e.size,
906
+ "aria-label": e.label,
907
+ onClick: m[0] || (m[0] = ve(() => {
908
+ }, ["stop"]))
909
+ }, {
910
+ collapsed: g(() => [
911
+ (v(!0), p(L, null, M(n.value, (s) => (v(), p(L, {
912
+ key: s.key
913
+ }, [
914
+ s.key === l.value ? (v(), p("hr", pt)) : T("", !0),
915
+ S(f(Ae), {
916
+ icon: s.icon,
917
+ tone: s.danger ? "danger" : "default",
918
+ href: s.href,
919
+ target: s.href ? s.target ?? "_blank" : void 0,
920
+ disabled: s.disabled,
921
+ onClick: (c) => s.run?.()
922
+ }, {
923
+ default: g(() => [
924
+ C(E(s.label), 1)
925
+ ]),
926
+ _: 2
927
+ }, 1032, ["icon", "tone", "href", "target", "disabled", "onClick"])
928
+ ], 64))), 128))
929
+ ]),
930
+ _: 1
931
+ }, 8, ["size", "aria-label"])) : T("", !0);
932
+ }
933
+ }), Lt = /* @__PURE__ */ A({
934
+ name: "WxDate",
935
+ __name: "DateText",
936
+ props: {
937
+ value: {},
938
+ size: { default: "sm" },
939
+ tone: { default: "muted" }
940
+ },
941
+ setup(e) {
942
+ const t = e, n = ft(), l = k(() => n.short(t.value)), u = k(() => n.exact(t.value)), m = k(() => n.iso(t.value));
943
+ return (s, c) => u.value ? (v(), b(f(Ue), {
944
+ key: 0,
945
+ content: u.value
946
+ }, {
947
+ default: g(() => [
948
+ S(f(J), {
949
+ as: "time",
950
+ datetime: m.value,
951
+ size: e.size,
952
+ tone: e.tone
953
+ }, {
954
+ default: g(() => [
955
+ C(E(l.value), 1)
956
+ ]),
957
+ _: 1
958
+ }, 8, ["datetime", "size", "tone"])
959
+ ]),
960
+ _: 1
961
+ }, 8, ["content"])) : (v(), b(f(J), {
962
+ key: 1,
963
+ size: e.size,
964
+ tone: e.tone
965
+ }, {
966
+ default: g(() => [
967
+ C(E(l.value), 1)
968
+ ]),
969
+ _: 1
970
+ }, 8, ["size", "tone"]));
971
+ }
628
972
  });
629
973
  export {
630
- we as AdminNav,
631
- Se as AdminShell,
632
- ke as HttpError,
633
- Fe as WxScreen,
634
- F as adminKey,
635
- Ue as adminMessages,
636
- He as createAdmin,
637
- fe as createAdminContext,
638
- Le as createHttp,
974
+ Be as AdminNav,
975
+ et as AdminShell,
976
+ B as HttpError,
977
+ Lt as WxDate,
978
+ Ne as WxListScreen,
979
+ Et as WxRowMenu,
980
+ Ct as WxScreen,
981
+ te as adminKey,
982
+ ne as adminMessages,
983
+ Re as adminTypes,
984
+ $t as createAdmin,
985
+ Ie as createAdminContext,
986
+ dt as createDates,
987
+ nt as createHttp,
639
988
  X as createI18n,
640
- O as i18nKey,
641
- me as provideAdmin,
642
- he as provideI18n,
643
- H as readCookie,
644
- N as useAdmin,
645
- De as useI18n,
646
- j as useTranslate
989
+ vt as errorText,
990
+ N as i18nKey,
991
+ Ve as provideAdmin,
992
+ je as provideI18n,
993
+ Q as readCookie,
994
+ H as useAdmin,
995
+ ft as useDates,
996
+ Tt as useErrorText,
997
+ St as useI18n,
998
+ R as useTranslate
647
999
  };
648
1000
  //# sourceMappingURL=index.js.map