@webx-ui/module-admin 0.12.2 → 0.14.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,64 +1,335 @@
1
- import { inject as te, reactive as oe, defineComponent as R, computed as x, openBlock as h, createBlock as w, unref as i, withModifiers as pe, withCtx as g, createElementBlock as k, Fragment as I, renderList as P, createCommentVNode as z, createVNode as _, createTextVNode as W, toDisplayString as C, useSlots as Le, useTemplateRef as ze, normalizeClass as H, renderSlot as L, createElementVNode as M, createSlots as ge, useModel as be, mergeModels as ie, mergeProps as We, watch as Y, resolveComponent as U, ref as A, watchEffect as Ae, onUnmounted as Re, isRef as Ee, createApp as Ue, h as G, onBeforeUnmount as Be, nextTick as Ie, withKeys as Me } from "vue";
2
- import { RouterLink as De, useRouter as we, useRoute as Ne, createRouter as Pe, createWebHistory as Ve } from "vue-router";
3
- import { WxAction as K, WxActions as Fe, WxDropdownItem as He, useElementWidth as Oe, WxHeading as je, WxText as q, WxButton as j, WxIcon as ye, WxTabs as qe, WxCard as me, WxRichText as Ye, WxResult as Ke, useResponsiveShell as Xe, shellLayoutFor as Ge, WxToaster as Je, WebxUI as Qe, dateLocaleKey as Ze, localesKey as et, WxAlert as tt, WxSkeleton as xe, WxBadge as nt, WxPopover as at, WxInput as lt, WxDialog as st, WxTooltip as ot, WxEmpty as it, WxAvatar as rt, WxTextarea as fe, toast as F, confirm as ut } from "@webx-ui/core";
4
- import { WxScreenRenderer as dt } from "@webx-ui/schema";
5
- const ne = /* @__PURE__ */ Symbol("webx-i18n");
6
- function Ln() {
7
- const e = te(ne, null);
1
+ import { inject as te, reactive as ue, defineComponent as E, useModel as de, ref as C, computed as x, onMounted as je, watch as J, openBlock as f, createElementBlock as $, createVNode as k, unref as o, createBlock as S, createCommentVNode as z, withCtx as g, createTextVNode as R, toDisplayString as W, createElementVNode as M, Fragment as D, renderList as K, mergeModels as ee, mergeProps as Te, withModifiers as Le, useSlots as Ke, useTemplateRef as qe, normalizeClass as G, renderSlot as N, createSlots as Ae, resolveComponent as I, watchEffect as Ye, onUnmounted as Xe, isRef as Ge, createApp as Je, h as le, onBeforeUnmount as Qe, nextTick as Ze, withKeys as et } from "vue";
2
+ import { RouterLink as tt, useRouter as We, useRoute as nt, createRouter as at, createWebHistory as lt } from "vue-router";
3
+ import { WxSegmented as st, WxSelect as ot, WxAutocomplete as ye, WxText as H, WxInput as Ce, WxCheckbox as we, WxAction as ne, WxActions as it, WxDropdownItem as rt, useElementWidth as ut, WxHeading as dt, WxButton as Z, WxIcon as ze, WxTabs as ct, WxCard as xe, WxRichText as mt, WxResult as ft, useResponsiveShell as vt, shellLayoutFor as ht, WxToaster as pt, WebxUI as bt, dateLocaleKey as gt, localesKey as yt, WxAlert as Re, WxSkeleton as Ue, WxBadge as wt, WxPopover as xt, WxDialog as kt, WxTooltip as _t, WxEmpty as $t, WxAvatar as St, WxTextarea as ke, toast as X, confirm as Tt } from "@webx-ui/core";
4
+ import { watchSystemTheme as Lt, applyTheme as At, systemTheme as Wt } from "@webx-ui/tokens";
5
+ import { WxScreenRenderer as Ct } from "@webx-ui/schema";
6
+ const ce = /* @__PURE__ */ Symbol("webx-i18n");
7
+ function zt() {
8
+ const e = te(ce, null);
8
9
  if (e === null)
9
10
  throw new Error("useI18n() was called outside a panel created by createAdmin().");
10
11
  return e;
11
12
  }
12
- function B(e) {
13
- const n = te(ne, null);
14
- return n === null ? de().scope(e) : n.scope(e);
13
+ function V(e) {
14
+ const t = te(ce, null);
15
+ return t === null ? ge().scope(e) : t.scope(e);
15
16
  }
16
- function ct(e, n) {
17
- e.provide(ne, n);
17
+ function Rt(e, t) {
18
+ e.provide(ce, t);
18
19
  }
19
- function de(e = {}) {
20
- const n = e.fallback ?? "en", t = oe({
21
- locale: e.locale ?? n,
22
- fallback: n,
20
+ function ge(e = {}) {
21
+ const t = e.fallback ?? "en", n = ue({
22
+ locale: e.locale ?? t,
23
+ fallback: t,
23
24
  panelLocales: [],
24
25
  contentLocales: []
25
- }), a = {}, u = oe({ value: {} });
26
- function s(o, r, m) {
27
- let v = o[r]?.[m[0] ?? ""];
28
- for (const f of m.slice(1)) {
26
+ }), a = {}, i = ue({ value: {} });
27
+ function s(r, u, d) {
28
+ let v = r[u]?.[d[0] ?? ""];
29
+ for (const m of d.slice(1)) {
29
30
  if (typeof v != "object" || v === null)
30
31
  return null;
31
- v = v[f];
32
+ v = v[m];
32
33
  }
33
34
  return typeof v == "string" ? v : null;
34
35
  }
35
- function l(o, r, m) {
36
- const [v, f] = r.includes("::") ? r.split("::", 2) : [o, r], d = f.split("."), p = s(u.value, v, d) ?? s(a, v, d) ?? // Not an empty string: a key on screen is ugly, but it says which key, and a blank
36
+ function l(r, u, d) {
37
+ const [v, m] = u.includes("::") ? u.split("::", 2) : [r, u], p = m.split("."), c = s(i.value, v, p) ?? s(a, v, p) ?? // Not an empty string: a key on screen is ugly, but it says which key, and a blank
37
38
  // label says nothing to anybody trying to fix it.
38
- r;
39
- return m === void 0 ? p : mt(p, m);
39
+ u;
40
+ return d === void 0 ? c : Ut(c, d);
40
41
  }
41
42
  return {
42
- state: t,
43
- defaults(o, r) {
44
- a[o] = { ...a[o], ...r };
43
+ state: n,
44
+ defaults(r, u) {
45
+ a[r] = { ...a[r], ...u };
45
46
  },
46
- load(o, r, m) {
47
- u.value = o ?? {}, t.locale = r ?? t.locale, m !== void 0 && (t.fallback = m);
47
+ load(r, u, d) {
48
+ i.value = r ?? {}, n.locale = u ?? n.locale, d !== void 0 && (n.fallback = d);
48
49
  },
49
- scope(o) {
50
- return (r, m) => l(o, r, m);
50
+ scope(r) {
51
+ return (u, d) => l(r, u, d);
51
52
  },
52
- t: (o, r) => l("", o, r)
53
+ t: (r, u) => l("", r, u)
54
+ };
55
+ }
56
+ function Ut(e, t) {
57
+ let n = e;
58
+ for (const [a, i] of Object.entries(t))
59
+ n = n.replaceAll(`:${a}`, String(i));
60
+ return n;
61
+ }
62
+ function Et() {
63
+ return {
64
+ target: "entity",
65
+ entity_type: null,
66
+ entity_id: null,
67
+ url: null,
68
+ hash: null,
69
+ new_tab: !1,
70
+ rel: []
53
71
  };
54
72
  }
55
- function mt(e, n) {
56
- let t = e;
57
- for (const [a, u] of Object.entries(n))
58
- t = t.replaceAll(`:${a}`, String(u));
59
- return t;
73
+ function Bt(e) {
74
+ const t = `${e.apiPath}/links`, n = (a) => a.data;
75
+ return {
76
+ sources: () => e.http.get(`${t}/sources`).then(n),
77
+ search: (a, i, s) => e.http.get(`${t}/search`, { query: { type: a, q: i, locale: s } }).then(n),
78
+ resolve: (a, i) => e.http.post(`${t}/resolve`, { links: a, locale: i }).then(n),
79
+ routes: () => e.http.get(`${t}/routes`).then(n)
80
+ };
60
81
  }
61
- const ft = /* @__PURE__ */ R({
82
+ const Nt = { class: "wx-link-picker" }, Vt = {
83
+ key: 0,
84
+ class: "wx-link-picker__entity"
85
+ }, It = {
86
+ key: 1,
87
+ class: "wx-link-picker__url"
88
+ }, Dt = {
89
+ key: 2,
90
+ class: "wx-link-picker__hash"
91
+ }, Mt = {
92
+ key: 3,
93
+ class: "wx-link-picker__attributes"
94
+ }, Pt = { class: "wx-link-picker__rel" }, Ft = /* @__PURE__ */ E({
95
+ name: "WxLinkPicker",
96
+ __name: "LinkPicker",
97
+ props: /* @__PURE__ */ ee({
98
+ allowNone: { type: Boolean, default: !0 },
99
+ attributes: { type: Boolean, default: !0 },
100
+ disabled: { type: Boolean, default: !1 }
101
+ }, {
102
+ modelValue: { default: null },
103
+ modelModifiers: {}
104
+ }),
105
+ emits: ["update:modelValue"],
106
+ setup(e) {
107
+ const t = e, n = de(e, "modelValue"), a = q(), i = zt(), s = Bt(a), l = V("webx-admin"), r = C([]), u = C([]), d = C([]), v = C(!1), m = C(null), p = C(""), c = C(null);
108
+ let _ = null;
109
+ const h = x(() => n.value ?? Et()), b = x(() => {
110
+ const y = [
111
+ { value: "entity", label: l("links.target-entity") },
112
+ { value: "url", label: l("links.target-url") }
113
+ ];
114
+ return t.allowNone ? [...y, { value: "none", label: l("links.target-none") }] : y;
115
+ }), w = x(
116
+ () => r.value.map((y) => ({ value: y.type, label: y.title }))
117
+ ), O = x(
118
+ () => u.value.map((y) => ({
119
+ value: y.title,
120
+ description: He(y),
121
+ id: y.id
122
+ }))
123
+ ), Q = x(
124
+ () => d.value.map((y) => ({ value: y.path, description: y.name }))
125
+ );
126
+ je(async () => {
127
+ r.value = await s.sources(), m.value = h.value.entity_type ?? r.value[0]?.type ?? null, await Promise.all([Y(), j()]);
128
+ }), J(
129
+ () => [h.value.entity_type, h.value.entity_id].join(":"),
130
+ () => {
131
+ Y();
132
+ }
133
+ );
134
+ async function Y() {
135
+ const { entity_type: y, entity_id: A } = h.value;
136
+ if (y === null || A === null) {
137
+ c.value = null, p.value = "";
138
+ return;
139
+ }
140
+ if (c.value?.id === A)
141
+ return;
142
+ const [U] = await s.resolve([{ type: y, id: A }], i.state.locale);
143
+ c.value = U ?? null, p.value = U?.title ?? l("links.missing"), _ = p.value;
144
+ }
145
+ async function j() {
146
+ d.value = await s.routes();
147
+ }
148
+ async function T(y) {
149
+ if (y === _) {
150
+ _ = null;
151
+ return;
152
+ }
153
+ if (_ = null, m.value !== null) {
154
+ v.value = !0;
155
+ try {
156
+ u.value = await s.search(m.value, y, i.state.locale);
157
+ } finally {
158
+ v.value = !1;
159
+ }
160
+ }
161
+ }
162
+ function B(y) {
163
+ y !== void 0 && (n.value = { ...h.value, target: y });
164
+ }
165
+ function L(y) {
166
+ m.value = y == null ? null : String(y), u.value = [], T("");
167
+ }
168
+ function P(y) {
169
+ const A = u.value.find((U) => U.id === y.id);
170
+ A === void 0 || m.value === null || (c.value = A, p.value = A.title, n.value = { ...h.value, entity_type: m.value, entity_id: A.id });
171
+ }
172
+ function me() {
173
+ c.value = null, p.value = "", u.value = [], n.value = { ...h.value, entity_type: null, entity_id: null };
174
+ }
175
+ function fe(y) {
176
+ n.value = { ...h.value, url: y === "" ? null : y };
177
+ }
178
+ function ae(y) {
179
+ const A = (typeof y == "string" || typeof y == "number" ? String(y) : "").replace(/^#+/, "").trim();
180
+ n.value = { ...h.value, hash: A === "" ? null : A };
181
+ }
182
+ function Pe(y) {
183
+ n.value = { ...h.value, new_tab: y };
184
+ }
185
+ function Fe(y, A) {
186
+ const U = h.value.rel.filter((ve) => ve !== y);
187
+ n.value = { ...h.value, rel: A ? [...U, y] : U };
188
+ }
189
+ function He(y) {
190
+ const A = [y.hint, y.url ?? void 0].filter(
191
+ (U) => typeof U == "string" && U !== ""
192
+ );
193
+ return y.available || A.push(l("links.unavailable")), A.join(" · ");
194
+ }
195
+ const Oe = ["nofollow", "sponsored", "ugc"];
196
+ return (y, A) => (f(), $("div", Nt, [
197
+ k(o(st), {
198
+ options: b.value,
199
+ "model-value": h.value.target,
200
+ disabled: t.disabled,
201
+ "aria-label": o(l)("links.target-entity"),
202
+ "onUpdate:modelValue": B
203
+ }, null, 8, ["options", "model-value", "disabled", "aria-label"]),
204
+ h.value.target === "entity" ? (f(), $("div", Vt, [
205
+ w.value.length > 1 ? (f(), S(o(ot), {
206
+ key: 0,
207
+ class: "wx-link-picker__section",
208
+ options: w.value,
209
+ "model-value": m.value,
210
+ disabled: t.disabled,
211
+ "aria-label": o(l)("links.section"),
212
+ "onUpdate:modelValue": L
213
+ }, null, 8, ["options", "model-value", "disabled", "aria-label"])) : z("", !0),
214
+ k(o(ye), {
215
+ class: "wx-link-picker__search",
216
+ "model-value": p.value,
217
+ options: O.value,
218
+ remote: "",
219
+ clearable: "",
220
+ loading: v.value,
221
+ "loading-text": o(l)("links.searching"),
222
+ "empty-text": o(l)("links.empty"),
223
+ placeholder: o(l)("links.search"),
224
+ "aria-label": o(l)("links.search"),
225
+ disabled: t.disabled,
226
+ "onUpdate:modelValue": A[0] || (A[0] = (U) => p.value = U),
227
+ onSearch: T,
228
+ onSelect: P,
229
+ onClear: me
230
+ }, null, 8, ["model-value", "options", "loading", "loading-text", "empty-text", "placeholder", "aria-label", "disabled"])
231
+ ])) : h.value.target === "url" ? (f(), $("div", It, [
232
+ k(o(ye), {
233
+ "model-value": h.value.url ?? "",
234
+ options: Q.value,
235
+ clearable: "",
236
+ "open-on-focus": "",
237
+ "empty-text": o(l)("links.url-routes"),
238
+ placeholder: o(l)("links.url-placeholder"),
239
+ "aria-label": o(l)("links.url-label"),
240
+ disabled: t.disabled,
241
+ "onUpdate:modelValue": fe
242
+ }, null, 8, ["model-value", "options", "empty-text", "placeholder", "aria-label", "disabled"])
243
+ ])) : z("", !0),
244
+ h.value.target !== "none" ? (f(), $("label", Dt, [
245
+ k(o(H), {
246
+ size: "sm",
247
+ tone: "muted"
248
+ }, {
249
+ default: g(() => [
250
+ R(W(o(l)("links.hash")), 1)
251
+ ]),
252
+ _: 1
253
+ }),
254
+ A[2] || (A[2] = M("span", {
255
+ class: "wx-link-picker__sign",
256
+ "aria-hidden": "true"
257
+ }, "#", -1)),
258
+ k(o(Ce), {
259
+ "model-value": h.value.hash ?? "",
260
+ placeholder: o(l)("links.hash-placeholder"),
261
+ "aria-label": o(l)("links.hash"),
262
+ disabled: t.disabled,
263
+ clearable: "",
264
+ "onUpdate:modelValue": ae
265
+ }, null, 8, ["model-value", "placeholder", "aria-label", "disabled"])
266
+ ])) : z("", !0),
267
+ t.attributes && h.value.target !== "none" ? (f(), $("div", Mt, [
268
+ k(o(we), {
269
+ "model-value": h.value.new_tab,
270
+ disabled: t.disabled,
271
+ "onUpdate:modelValue": A[1] || (A[1] = (U) => Pe(U))
272
+ }, {
273
+ default: g(() => [
274
+ R(W(o(l)("links.new-tab")), 1)
275
+ ]),
276
+ _: 1
277
+ }, 8, ["model-value", "disabled"]),
278
+ M("div", Pt, [
279
+ k(o(H), {
280
+ size: "sm",
281
+ tone: "muted"
282
+ }, {
283
+ default: g(() => [
284
+ R(W(o(l)("links.rel")), 1)
285
+ ]),
286
+ _: 1
287
+ }),
288
+ (f(), $(D, null, K(Oe, (U) => k(o(we), {
289
+ key: U,
290
+ "model-value": h.value.rel.includes(U),
291
+ disabled: t.disabled,
292
+ "onUpdate:modelValue": (ve) => Fe(U, ve)
293
+ }, {
294
+ default: g(() => [
295
+ R(W(o(l)(`links.rel-${U}`)), 1)
296
+ ]),
297
+ _: 2
298
+ }, 1032, ["model-value", "disabled", "onUpdate:modelValue"])), 64))
299
+ ])
300
+ ])) : z("", !0)
301
+ ]));
302
+ }
303
+ }), F = (e, t) => {
304
+ const n = e.__vccOpts || e;
305
+ for (const [a, i] of t)
306
+ n[a] = i;
307
+ return n;
308
+ }, Ht = /* @__PURE__ */ F(Ft, [["__scopeId", "data-v-e54022e5"]]), Ot = /* @__PURE__ */ E({
309
+ name: "WxLinkField",
310
+ inheritAttrs: !1,
311
+ __name: "LinkField",
312
+ props: /* @__PURE__ */ ee({
313
+ allowNone: { type: Boolean, default: !0 },
314
+ attributes: { type: Boolean, default: !0 },
315
+ disabled: { type: Boolean, default: !1 }
316
+ }, {
317
+ modelValue: { default: null },
318
+ modelModifiers: {}
319
+ }),
320
+ emits: ["update:modelValue"],
321
+ setup(e) {
322
+ const t = e, n = de(e, "modelValue");
323
+ return (a, i) => (f(), S(Ht, Te({
324
+ modelValue: n.value,
325
+ "onUpdate:modelValue": i[0] || (i[0] = (s) => n.value = s)
326
+ }, a.$attrs, {
327
+ "allow-none": t.allowNone,
328
+ attributes: t.attributes,
329
+ disabled: t.disabled
330
+ }), null, 16, ["modelValue", "allow-none", "attributes", "disabled"]));
331
+ }
332
+ }), jt = /* @__PURE__ */ E({
62
333
  __name: "BackButton",
63
334
  props: {
64
335
  to: {},
@@ -66,21 +337,21 @@ const ft = /* @__PURE__ */ R({
66
337
  size: { default: "sm" }
67
338
  },
68
339
  setup(e) {
69
- const n = e, t = B("webx-admin"), a = x(() => n.label ?? t("editor.back"));
70
- return (u, s) => (h(), w(i(K), {
340
+ const t = e, n = V("webx-admin"), a = x(() => t.label ?? n("editor.back"));
341
+ return (i, s) => (f(), S(o(ne), {
71
342
  icon: "arrow-left",
72
343
  class: "wx-back-button",
73
- as: i(De),
344
+ as: o(tt),
74
345
  to: e.to,
75
346
  title: a.value,
76
347
  size: e.size,
77
348
  "tooltip-side": "bottom"
78
349
  }, null, 8, ["as", "to", "title", "size"]));
79
350
  }
80
- }), vt = {
351
+ }), Kt = {
81
352
  key: 0,
82
353
  class: "wx-dropdown__divider"
83
- }, ht = /* @__PURE__ */ R({
354
+ }, qt = /* @__PURE__ */ E({
84
355
  __name: "RowMenu",
85
356
  props: {
86
357
  actions: {},
@@ -88,45 +359,45 @@ const ft = /* @__PURE__ */ R({
88
359
  size: { default: "sm" }
89
360
  },
90
361
  setup(e) {
91
- const n = B("webx-admin"), t = e, a = x(() => [
92
- ...t.actions.filter((s) => !s.danger),
93
- ...t.actions.filter((s) => s.danger)
94
- ]), u = x(() => {
362
+ const t = V("webx-admin"), n = e, a = x(() => [
363
+ ...n.actions.filter((s) => !s.danger),
364
+ ...n.actions.filter((s) => s.danger)
365
+ ]), i = x(() => {
95
366
  const s = a.value.find((l) => l.danger);
96
367
  return s && a.value[0] !== s ? s.key : null;
97
368
  });
98
- return (s, l) => a.value.length > 0 ? (h(), w(i(Fe), {
369
+ return (s, l) => a.value.length > 0 ? (f(), S(o(it), {
99
370
  key: 0,
100
371
  class: "wx-row-menu",
101
372
  collapse: "always",
102
373
  align: "end",
103
374
  size: e.size,
104
375
  "aria-label": e.label,
105
- onClick: l[0] || (l[0] = pe(() => {
376
+ onClick: l[0] || (l[0] = Le(() => {
106
377
  }, ["stop"]))
107
378
  }, {
108
379
  trigger: g(() => [
109
- _(i(K), {
380
+ k(o(ne), {
110
381
  type: "more",
111
382
  size: e.size,
112
- title: i(n)("editor.more")
383
+ title: o(t)("editor.more")
113
384
  }, null, 8, ["size", "title"])
114
385
  ]),
115
386
  collapsed: g(() => [
116
- (h(!0), k(I, null, P(a.value, (o) => (h(), k(I, {
117
- key: o.key
387
+ (f(!0), $(D, null, K(a.value, (r) => (f(), $(D, {
388
+ key: r.key
118
389
  }, [
119
- o.key === u.value ? (h(), k("hr", vt)) : z("", !0),
120
- _(i(He), {
121
- icon: o.icon,
122
- tone: o.danger ? "danger" : "default",
123
- href: o.href,
124
- target: o.href ? o.target ?? "_blank" : void 0,
125
- disabled: o.disabled,
126
- onClick: (r) => o.run?.()
390
+ r.key === i.value ? (f(), $("hr", Kt)) : z("", !0),
391
+ k(o(rt), {
392
+ icon: r.icon,
393
+ tone: r.danger ? "danger" : "default",
394
+ href: r.href,
395
+ target: r.href ? r.target ?? "_blank" : void 0,
396
+ disabled: r.disabled,
397
+ onClick: (u) => r.run?.()
127
398
  }, {
128
399
  default: g(() => [
129
- W(C(o.label), 1)
400
+ R(W(r.label), 1)
130
401
  ]),
131
402
  _: 2
132
403
  }, 1032, ["icon", "tone", "href", "target", "disabled", "onClick"])
@@ -135,18 +406,13 @@ const ft = /* @__PURE__ */ R({
135
406
  _: 1
136
407
  }, 8, ["size", "aria-label"])) : z("", !0);
137
408
  }
138
- }), N = (e, n) => {
139
- const t = e.__vccOpts || e;
140
- for (const [a, u] of n)
141
- t[a] = u;
142
- return t;
143
- }, ke = /* @__PURE__ */ N(ht, [["__scopeId", "data-v-cab01f7f"]]), pt = ["data-level"], gt = {
409
+ }), Ee = /* @__PURE__ */ F(qt, [["__scopeId", "data-v-cab01f7f"]]), Yt = ["data-level"], Xt = {
144
410
  key: 0,
145
411
  class: "wx-screen-head__trail"
146
- }, bt = { class: "wx-screen-head__name" }, wt = {
412
+ }, Gt = { class: "wx-screen-head__name" }, Jt = {
147
413
  key: 4,
148
414
  class: "wx-screen-head__actions"
149
- }, yt = /* @__PURE__ */ R({
415
+ }, Qt = /* @__PURE__ */ E({
150
416
  __name: "ScreenHead",
151
417
  props: {
152
418
  title: { default: void 0 },
@@ -159,58 +425,58 @@ const ft = /* @__PURE__ */ R({
159
425
  divider: { type: Boolean, default: !1 }
160
426
  },
161
427
  emits: ["back"],
162
- setup(e, { emit: n }) {
163
- const t = e, a = n, u = B("webx-admin"), s = Le(), l = ze("root"), o = Oe(l), r = x(() => o.value > 0 && o.value < t.collapseBelow), m = x(() => t.actions ?? []), v = x(
164
- () => m.value.find((c) => c.primary) ?? null
165
- ), f = x(() => r.value ? v.value ? [v.value] : [] : m.value.filter((c) => !c.menu && !c.danger)), d = x(() => r.value ? m.value.filter((c) => c !== v.value) : m.value.filter((c) => c.menu || c.danger)), p = x(
166
- () => t.back && t.back !== !0 ? t.back : null
167
- ), b = x(
168
- () => f.value.length > 0 || d.value.length > 0 || !!s.extra
428
+ setup(e, { emit: t }) {
429
+ const n = e, a = t, i = V("webx-admin"), s = Ke(), l = qe("root"), r = ut(l), u = x(() => r.value > 0 && r.value < n.collapseBelow), d = x(() => n.actions ?? []), v = x(
430
+ () => d.value.find((h) => h.primary) ?? null
431
+ ), m = x(() => u.value ? v.value ? [v.value] : [] : d.value.filter((h) => !h.menu && !h.danger)), p = x(() => u.value ? d.value.filter((h) => h !== v.value) : d.value.filter((h) => h.menu || h.danger)), c = x(
432
+ () => n.back && n.back !== !0 ? n.back : null
433
+ ), _ = x(
434
+ () => m.value.length > 0 || p.value.length > 0 || !!s.extra
169
435
  );
170
- return (c, y) => (h(), k("div", {
436
+ return (h, b) => (f(), $("div", {
171
437
  ref_key: "root",
172
438
  ref: l,
173
- class: H(["wx-screen-head", {
174
- "is-narrow": r.value,
175
- "has-button": f.value.length > 0,
176
- "has-trail": !!c.$slots.trail,
439
+ class: G(["wx-screen-head", {
440
+ "is-narrow": u.value,
441
+ "has-button": m.value.length > 0,
442
+ "has-trail": !!h.$slots.trail,
177
443
  "has-divider": e.divider
178
444
  }]),
179
445
  "data-level": e.level
180
446
  }, [
181
- c.$slots.trail ? (h(), k("div", gt, [
182
- L(c.$slots, "trail", {}, void 0, !0)
447
+ h.$slots.trail ? (f(), $("div", Xt, [
448
+ N(h.$slots, "trail", {}, void 0, !0)
183
449
  ])) : z("", !0),
184
- p.value ? (h(), w(ft, {
450
+ c.value ? (f(), S(jt, {
185
451
  key: 1,
186
452
  class: "wx-screen-head__back",
187
- to: p.value,
453
+ to: c.value,
188
454
  label: e.backLabel,
189
455
  "tooltip-side": "bottom"
190
- }, null, 8, ["to", "label"])) : e.back ? (h(), w(i(K), {
456
+ }, null, 8, ["to", "label"])) : e.back ? (f(), S(o(ne), {
191
457
  key: 2,
192
458
  class: "wx-screen-head__back",
193
459
  icon: "arrow-left",
194
460
  size: "sm",
195
461
  "tooltip-side": "bottom",
196
- title: e.backLabel ?? i(u)("editor.back"),
197
- onClick: y[0] || (y[0] = ($) => a("back"))
462
+ title: e.backLabel ?? o(i)("editor.back"),
463
+ onClick: b[0] || (b[0] = (w) => a("back"))
198
464
  }, null, 8, ["title"])) : z("", !0),
199
- M("div", bt, [
200
- e.title ? (h(), w(i(je), {
465
+ M("div", Gt, [
466
+ e.title ? (f(), S(o(dt), {
201
467
  key: 0,
202
468
  level: e.level,
203
469
  truncate: "",
204
470
  class: "wx-screen-head__title"
205
471
  }, {
206
472
  default: g(() => [
207
- W(C(e.title), 1)
473
+ R(W(e.title), 1)
208
474
  ]),
209
475
  _: 1
210
476
  }, 8, ["level"])) : z("", !0),
211
- L(c.$slots, "title-after", {}, void 0, !0)
477
+ N(h.$slots, "title-after", {}, void 0, !0)
212
478
  ]),
213
- e.subtitle || c.$slots.subtitle ? (h(), w(i(q), {
479
+ e.subtitle || h.$slots.subtitle ? (f(), S(o(H), {
214
480
  key: 3,
215
481
  class: "wx-screen-head__subtitle",
216
482
  size: "sm",
@@ -218,53 +484,53 @@ const ft = /* @__PURE__ */ R({
218
484
  truncate: ""
219
485
  }, {
220
486
  default: g(() => [
221
- L(c.$slots, "subtitle", {}, () => [
222
- W(C(e.subtitle), 1)
487
+ N(h.$slots, "subtitle", {}, () => [
488
+ R(W(e.subtitle), 1)
223
489
  ], !0)
224
490
  ]),
225
491
  _: 3
226
492
  })) : z("", !0),
227
- b.value ? (h(), k("div", wt, [
228
- L(c.$slots, "extra", {}, void 0, !0),
229
- (h(!0), k(I, null, P(f.value, ($) => (h(), w(i(j), {
230
- key: $.key,
231
- class: H(["wx-screen-head__button", { "is-primary": $.primary }]),
232
- type: $.primary ? "primary" : "default",
233
- variant: $.primary ? "solid" : $.variant ?? "outline",
234
- loading: $.loading,
235
- disabled: $.disabled,
236
- href: $.href,
237
- target: $.href ? $.target ?? "_blank" : void 0,
238
- rel: $.href ? "noopener" : void 0,
239
- onClick: (X) => $.run?.()
240
- }, ge({
493
+ _.value ? (f(), $("div", Jt, [
494
+ N(h.$slots, "extra", {}, void 0, !0),
495
+ (f(!0), $(D, null, K(m.value, (w) => (f(), S(o(Z), {
496
+ key: w.key,
497
+ class: G(["wx-screen-head__button", { "is-primary": w.primary }]),
498
+ type: w.primary ? "primary" : "default",
499
+ variant: w.primary ? "solid" : w.variant ?? "outline",
500
+ loading: w.loading,
501
+ disabled: w.disabled,
502
+ href: w.href,
503
+ target: w.href ? w.target ?? "_blank" : void 0,
504
+ rel: w.href ? "noopener" : void 0,
505
+ onClick: (O) => w.run?.()
506
+ }, Ae({
241
507
  default: g(() => [
242
- W(" " + C($.label), 1)
508
+ R(" " + W(w.label), 1)
243
509
  ]),
244
510
  _: 2
245
511
  }, [
246
- $.icon ? {
512
+ w.icon ? {
247
513
  name: "icon",
248
514
  fn: g(() => [
249
- _(i(ye), {
250
- name: $.icon
515
+ k(o(ze), {
516
+ name: w.icon
251
517
  }, null, 8, ["name"])
252
518
  ]),
253
519
  key: "0"
254
520
  } : void 0
255
521
  ]), 1032, ["class", "type", "variant", "loading", "disabled", "href", "target", "rel", "onClick"]))), 128)),
256
- d.value.length > 0 ? (h(), w(ke, {
522
+ p.value.length > 0 ? (f(), S(Ee, {
257
523
  key: 0,
258
- actions: d.value,
524
+ actions: p.value,
259
525
  size: "lg",
260
- label: e.title ?? i(u)("editor.more")
526
+ label: e.title ?? o(i)("editor.more")
261
527
  }, null, 8, ["actions", "label"])) : z("", !0)
262
528
  ])) : z("", !0)
263
- ], 10, pt));
529
+ ], 10, Yt));
264
530
  }
265
- }), xt = /* @__PURE__ */ N(yt, [["__scopeId", "data-v-e27d184e"]]), kt = ["data-wx-fill"], _t = /* @__PURE__ */ R({
531
+ }), Zt = /* @__PURE__ */ F(Qt, [["__scopeId", "data-v-e27d184e"]]), en = ["data-wx-fill"], tn = /* @__PURE__ */ E({
266
532
  __name: "ListScreen",
267
- props: /* @__PURE__ */ ie({
533
+ props: /* @__PURE__ */ ee({
268
534
  title: { default: void 0 },
269
535
  subtitle: { default: void 0 },
270
536
  back: { default: void 0 },
@@ -281,12 +547,12 @@ const ft = /* @__PURE__ */ R({
281
547
  }),
282
548
  emits: ["update:view"],
283
549
  setup(e) {
284
- const n = be(e, "view");
285
- return (t, a) => (h(), k("div", {
286
- class: H(["wx-list-screen", { "is-fill": e.fill }]),
550
+ const t = de(e, "view");
551
+ return (n, a) => (f(), $("div", {
552
+ class: G(["wx-list-screen", { "is-fill": e.fill }]),
287
553
  "data-wx-fill": e.fill ? "" : void 0
288
554
  }, [
289
- e.title || e.actions || t.$slots.actions ? (h(), w(xt, {
555
+ e.title || e.actions || n.$slots.actions ? (f(), S(Zt, {
290
556
  key: 0,
291
557
  class: "wx-list-screen__head",
292
558
  title: e.title,
@@ -295,293 +561,299 @@ const ft = /* @__PURE__ */ R({
295
561
  "back-label": e.backLabel,
296
562
  actions: e.actions,
297
563
  "collapse-below": 480
298
- }, ge({ _: 2 }, [
299
- t.$slots.actions ? {
564
+ }, Ae({ _: 2 }, [
565
+ n.$slots.actions ? {
300
566
  name: "extra",
301
567
  fn: g(() => [
302
- L(t.$slots, "actions", {}, void 0, !0)
568
+ N(n.$slots, "actions", {}, void 0, !0)
303
569
  ]),
304
570
  key: "0"
305
571
  } : void 0
306
572
  ]), 1032, ["title", "subtitle", "back", "back-label", "actions"])) : z("", !0),
307
- e.views && e.views.length > 0 ? (h(), w(i(qe), {
573
+ e.views && e.views.length > 0 ? (f(), S(o(ct), {
308
574
  key: 1,
309
- modelValue: n.value,
310
- "onUpdate:modelValue": a[0] || (a[0] = (u) => n.value = u),
575
+ modelValue: t.value,
576
+ "onUpdate:modelValue": a[0] || (a[0] = (i) => t.value = i),
311
577
  class: "wx-list-screen__views",
312
578
  items: e.views,
313
579
  "collapse-below": e.collapseBelow,
314
580
  "aria-label": e.title
315
581
  }, {
316
582
  default: g(() => [
317
- e.card ? (h(), w(i(me), {
583
+ e.card ? (f(), S(o(xe), {
318
584
  key: 0,
319
585
  class: "wx-list-screen__card",
320
586
  padding: e.padding
321
587
  }, {
322
588
  default: g(() => [
323
- L(t.$slots, "default", {}, void 0, !0)
589
+ N(n.$slots, "default", {}, void 0, !0)
324
590
  ]),
325
591
  _: 3
326
- }, 8, ["padding"])) : L(t.$slots, "default", {}, void 0, !0, 1)
592
+ }, 8, ["padding"])) : N(n.$slots, "default", {}, void 0, !0, 1)
327
593
  ]),
328
594
  _: 3
329
- }, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (h(), k(I, { key: 2 }, [
330
- e.card ? (h(), w(i(me), {
595
+ }, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (f(), $(D, { key: 2 }, [
596
+ e.card ? (f(), S(o(xe), {
331
597
  key: 0,
332
598
  class: "wx-list-screen__card",
333
599
  padding: e.padding
334
600
  }, {
335
601
  default: g(() => [
336
- L(t.$slots, "default", {}, void 0, !0)
602
+ N(n.$slots, "default", {}, void 0, !0)
337
603
  ]),
338
604
  _: 3
339
- }, 8, ["padding"])) : L(t.$slots, "default", {}, void 0, !0, 1)
605
+ }, 8, ["padding"])) : N(n.$slots, "default", {}, void 0, !0, 1)
340
606
  ], 64))
341
- ], 10, kt));
607
+ ], 10, en));
342
608
  }
343
- }), $t = /* @__PURE__ */ N(_t, [["__scopeId", "data-v-8c7e5ad1"]]), St = /* @__PURE__ */ R({
609
+ }), nn = /* @__PURE__ */ F(tn, [["__scopeId", "data-v-8c7e5ad1"]]), an = /* @__PURE__ */ E({
344
610
  name: "WxRichTextField",
345
611
  inheritAttrs: !1,
346
612
  __name: "RichTextField",
347
613
  setup(e) {
348
- const n = O(), t = B("webx-admin"), a = x(() => n.pickImage ?? void 0), u = x(() => ({
349
- bold: t("rich-text.bold"),
350
- italic: t("rich-text.italic"),
351
- strike: t("rich-text.strike"),
352
- code: t("rich-text.code"),
353
- h2: t("rich-text.h2"),
354
- h3: t("rich-text.h3"),
355
- h4: t("rich-text.h4"),
356
- bulletList: t("rich-text.bullet-list"),
357
- orderedList: t("rich-text.ordered-list"),
358
- blockquote: t("rich-text.blockquote"),
359
- hr: t("rich-text.hr"),
360
- link: t("rich-text.link"),
361
- table: t("rich-text.table"),
362
- image: t("rich-text.image"),
363
- youtube: t("rich-text.youtube"),
364
- undo: t("rich-text.undo"),
365
- redo: t("rich-text.redo"),
366
- addRowAfter: t("rich-text.row-below"),
367
- addRowBefore: t("rich-text.row-above"),
368
- addColumnAfter: t("rich-text.column-after"),
369
- addColumnBefore: t("rich-text.column-before"),
370
- deleteRow: t("rich-text.delete-row"),
371
- deleteColumn: t("rich-text.delete-column"),
372
- mergeOrSplit: t("rich-text.merge-cells"),
373
- deleteTable: t("rich-text.delete-table"),
374
- toolbar: t("rich-text.toolbar"),
375
- linkAddress: t("rich-text.link-address"),
376
- youtubeAddress: t("rich-text.youtube-address"),
377
- apply: t("rich-text.apply"),
378
- cancel: t("rich-text.cancel"),
379
- uploading: t("rich-text.uploading")
614
+ const t = q(), n = V("webx-admin"), a = x(() => t.pickImage ?? void 0), i = x(() => ({
615
+ bold: n("rich-text.bold"),
616
+ italic: n("rich-text.italic"),
617
+ strike: n("rich-text.strike"),
618
+ code: n("rich-text.code"),
619
+ h2: n("rich-text.h2"),
620
+ h3: n("rich-text.h3"),
621
+ h4: n("rich-text.h4"),
622
+ bulletList: n("rich-text.bullet-list"),
623
+ orderedList: n("rich-text.ordered-list"),
624
+ blockquote: n("rich-text.blockquote"),
625
+ hr: n("rich-text.hr"),
626
+ link: n("rich-text.link"),
627
+ table: n("rich-text.table"),
628
+ image: n("rich-text.image"),
629
+ youtube: n("rich-text.youtube"),
630
+ undo: n("rich-text.undo"),
631
+ redo: n("rich-text.redo"),
632
+ addRowAfter: n("rich-text.row-below"),
633
+ addRowBefore: n("rich-text.row-above"),
634
+ addColumnAfter: n("rich-text.column-after"),
635
+ addColumnBefore: n("rich-text.column-before"),
636
+ deleteRow: n("rich-text.delete-row"),
637
+ deleteColumn: n("rich-text.delete-column"),
638
+ mergeOrSplit: n("rich-text.merge-cells"),
639
+ deleteTable: n("rich-text.delete-table"),
640
+ toolbar: n("rich-text.toolbar"),
641
+ linkAddress: n("rich-text.link-address"),
642
+ youtubeAddress: n("rich-text.youtube-address"),
643
+ apply: n("rich-text.apply"),
644
+ cancel: n("rich-text.cancel"),
645
+ uploading: n("rich-text.uploading")
380
646
  }));
381
- return (s, l) => (h(), w(i(Ye), We(s.$attrs, {
382
- labels: u.value,
647
+ return (s, l) => (f(), S(o(mt), Te(s.$attrs, {
648
+ labels: i.value,
383
649
  "pick-image": a.value
384
650
  }), null, 16, ["labels", "pick-image"]));
385
651
  }
386
- }), Tt = {
387
- "wx-list": { component: $t, kind: "layout", labelProp: "title" },
652
+ }), ln = {
653
+ "wx-list": { component: nn, kind: "layout", labelProp: "title" },
388
654
  // Full width: an editor shares a row with nothing, and a form of two columns would give it
389
655
  // half a line to write a page of text in.
390
- "wx-rich-text": { component: St, kind: "field", wide: !0 }
391
- }, _e = /* @__PURE__ */ Symbol("webx-admin");
392
- function O() {
393
- const e = te(_e, null);
656
+ "wx-rich-text": { component: an, kind: "field", wide: !0 },
657
+ // Wide as well: a row of the picker is a segmented switch, a section and a search box, and half
658
+ // a form's width leaves the search box too narrow to read a page title in.
659
+ "wx-link": { component: Ot, kind: "field", wide: !0 }
660
+ }, Be = /* @__PURE__ */ Symbol("webx-admin");
661
+ function q() {
662
+ const e = te(Be, null);
394
663
  if (e === null)
395
664
  throw new Error("useAdmin() was called outside a panel created by createAdmin().");
396
665
  return e;
397
666
  }
398
- function Ct(e) {
399
- const n = oe({
667
+ function sn(e) {
668
+ const t = ue({
400
669
  status: "loading",
401
670
  manifest: null,
402
671
  user: null,
403
672
  error: null
404
- }), t = x(() => {
405
- const d = n.manifest;
406
- if (d === null)
673
+ }), n = x(() => {
674
+ const c = t.manifest;
675
+ if (c === null)
407
676
  return [];
408
- const p = [];
409
- for (const b of d.modules) {
410
- const c = e.modules.find(($) => $.id === b.id);
411
- if (c === void 0)
677
+ const _ = [];
678
+ for (const h of c.modules) {
679
+ const b = e.modules.find((O) => O.id === h.id);
680
+ if (b === void 0)
412
681
  continue;
413
- const y = c.path ?? c.routes?.[0]?.path;
414
- y !== void 0 && p.push({
415
- id: b.id,
416
- title: b.title,
417
- icon: b.icon,
418
- path: y,
419
- group: b.group ?? null
682
+ const w = b.path ?? b.routes?.[0]?.path;
683
+ w !== void 0 && _.push({
684
+ id: h.id,
685
+ title: h.title,
686
+ icon: h.icon,
687
+ path: w,
688
+ group: h.group ?? null
420
689
  });
421
690
  }
422
- return p;
691
+ return _;
423
692
  }), a = x(() => {
424
- const d = n.manifest?.groups ?? [], p = [], b = /* @__PURE__ */ new Map();
425
- for (const c of t.value)
426
- if (c.group !== null && d.some((y) => y.id === c.group)) {
427
- const y = b.get(c.group) ?? [];
428
- y.push(c), b.set(c.group, y);
693
+ const c = t.manifest?.groups ?? [], _ = [], h = /* @__PURE__ */ new Map();
694
+ for (const b of n.value)
695
+ if (b.group !== null && c.some((w) => w.id === b.group)) {
696
+ const w = h.get(b.group) ?? [];
697
+ w.push(b), h.set(b.group, w);
429
698
  } else
430
- p.push(c);
699
+ _.push(b);
431
700
  return {
432
- top: p,
433
- groups: d.filter((c) => b.has(c.id)).map((c) => ({
434
- id: c.id,
435
- title: c.title,
436
- icon: c.icon ?? null,
437
- entries: b.get(c.id) ?? []
701
+ top: _,
702
+ groups: c.filter((b) => h.has(b.id)).map((b) => ({
703
+ id: b.id,
704
+ title: b.title,
705
+ icon: b.icon ?? null,
706
+ entries: h.get(b.id) ?? []
438
707
  }))
439
708
  };
440
- }), u = { ...Tt };
441
- for (const d of e.modules)
442
- Object.assign(u, d.types);
443
- Object.assign(u, e.types);
444
- const s = e.modules.find((d) => d.pickImage !== void 0)?.pickImage, l = /* @__PURE__ */ new Map();
445
- async function o(d) {
446
- const p = `${e.i18n.state.locale}:${d}`;
447
- let b = l.get(p);
448
- return b === void 0 && (b = e.http.get(`${e.apiPath}/screens/${d}`).then((c) => c.data.root).catch((c) => {
449
- throw l.delete(p), c;
450
- }), l.set(p, b)), b;
709
+ }), i = { ...ln };
710
+ for (const c of e.modules)
711
+ Object.assign(i, c.types);
712
+ Object.assign(i, e.types);
713
+ const s = e.modules.find((c) => c.pickImage !== void 0)?.pickImage, l = /* @__PURE__ */ new Map();
714
+ async function r(c) {
715
+ const _ = `${e.i18n.state.locale}:${c}`;
716
+ let h = l.get(_);
717
+ return h === void 0 && (h = e.http.get(`${e.apiPath}/screens/${c}`).then((b) => b.data.root).catch((b) => {
718
+ throw l.delete(_), b;
719
+ }), l.set(_, h)), h;
451
720
  }
452
- let r = null;
453
- async function m() {
454
- n.status = "loading", n.error = null;
721
+ let u = null;
722
+ async function d() {
723
+ t.status = "loading", t.error = null;
455
724
  try {
456
- if (r !== null && (n.user = await r(), n.user === null)) {
457
- n.manifest = null, n.status = "unauthenticated";
725
+ if (u !== null && (t.user = await u(), m(t.user), t.user === null)) {
726
+ t.manifest = null, t.status = "unauthenticated";
458
727
  return;
459
728
  }
460
- const d = await e.loadManifest();
461
- n.manifest = d, e.i18n.state.contentLocales = d.locales ?? [], e.i18n.state.panelLocales = d.panelLocales ?? e.i18n.state.panelLocales, d.locale !== void 0 && d.locale !== e.i18n.state.locale && await f(d.locale), n.status = "ready";
462
- } catch (d) {
463
- if (zt(d)) {
464
- n.manifest = null, n.user = null, n.status = "unauthenticated";
729
+ const c = await e.loadManifest();
730
+ t.manifest = c, e.i18n.state.contentLocales = c.locales ?? [], e.i18n.state.panelLocales = c.panelLocales ?? e.i18n.state.panelLocales, c.locale !== void 0 && c.locale !== e.i18n.state.locale && await p(c.locale), t.status = "ready";
731
+ } catch (c) {
732
+ if (rn(c)) {
733
+ t.manifest = null, t.user = null, t.status = "unauthenticated";
465
734
  return;
466
735
  }
467
- n.error = d instanceof Error ? d.message : String(d), n.status = "error";
736
+ t.error = c instanceof Error ? c.message : String(c), t.status = "error";
468
737
  }
469
738
  }
470
739
  async function v() {
471
- if (n.manifest !== null)
740
+ if (t.manifest !== null)
472
741
  try {
473
- n.manifest = await e.loadManifest();
742
+ t.manifest = await e.loadManifest();
474
743
  } catch {
475
744
  }
476
745
  }
477
- async function f(d) {
746
+ function m(c) {
747
+ c !== null && e.theme?.adopt(c.theme);
748
+ }
749
+ async function p(c) {
478
750
  if (e.loadDictionary === void 0) {
479
- e.i18n.state.locale = d;
751
+ e.i18n.state.locale = c;
480
752
  return;
481
753
  }
482
- await e.loadDictionary(d), await v();
754
+ await e.loadDictionary(c), await v();
483
755
  }
484
756
  return {
485
757
  http: e.http,
486
758
  basePath: e.basePath,
487
759
  apiPath: e.apiPath,
488
- state: n,
760
+ state: t,
489
761
  i18n: e.i18n,
490
762
  modules: e.modules,
491
- nav: t,
763
+ nav: n,
492
764
  groups: a,
493
- types: u,
765
+ types: i,
494
766
  pickImage: s ?? null,
495
- reload: m,
767
+ reload: d,
496
768
  refreshManifest: v,
497
- setLocale: f,
498
- setUser(d) {
499
- n.user = d;
769
+ setLocale: p,
770
+ setUser(c) {
771
+ t.user = c, m(c);
500
772
  },
501
- useSessionLoader(d) {
502
- r = d;
773
+ useSessionLoader(c) {
774
+ u = c;
503
775
  },
504
- can(d) {
505
- const p = n.user;
506
- return p === null ? !1 : p.isSuper || p.permissions.includes(d);
776
+ can(c) {
777
+ const _ = t.user;
778
+ return _ === null ? !1 : _.isSuper || _.permissions.includes(c);
507
779
  },
508
- loadScreen: o,
509
- screenPatch(d) {
510
- return e.screens?.[d] ?? [];
780
+ loadScreen: r,
781
+ screenPatch(c) {
782
+ return e.screens?.[c] ?? [];
511
783
  }
512
784
  };
513
785
  }
514
- function Lt(e, n) {
515
- e.provide(_e, n);
786
+ function on(e, t) {
787
+ e.provide(Be, t);
516
788
  }
517
- function zt(e) {
789
+ function rn(e) {
518
790
  return typeof e == "object" && e !== null && "status" in e && e.status === 401;
519
791
  }
520
- const Wt = /* @__PURE__ */ R({
792
+ const un = /* @__PURE__ */ E({
521
793
  __name: "AdminLanding",
522
794
  props: {
523
795
  landing: { default: null }
524
796
  },
525
797
  setup(e) {
526
- const n = e, t = O(), a = we(), u = B("webx-admin"), s = x(() => {
527
- const l = t.nav.value;
528
- return l.length === 0 ? null : ((n.landing === null ? void 0 : l.find((r) => r.path === n.landing)) ?? l[0])?.path ?? null;
798
+ const t = e, n = q(), a = We(), i = V("webx-admin"), s = x(() => {
799
+ const l = n.nav.value;
800
+ return l.length === 0 ? null : ((t.landing === null ? void 0 : l.find((u) => u.path === t.landing)) ?? l[0])?.path ?? null;
529
801
  });
530
- return Y(
802
+ return J(
531
803
  s,
532
804
  (l) => {
533
805
  l !== null && a.replace(l);
534
806
  },
535
807
  { immediate: !0 }
536
- ), (l, o) => s.value === null && i(t).state.status === "ready" ? (h(), w(i(Ke), {
808
+ ), (l, r) => s.value === null && o(n).state.status === "ready" ? (f(), S(o(ft), {
537
809
  key: 0,
538
810
  status: "info",
539
- title: i(u)("shell.empty-title"),
540
- description: i(u)("shell.empty-description")
811
+ title: o(i)("shell.empty-title"),
812
+ description: o(i)("shell.empty-description")
541
813
  }, null, 8, ["title", "description"])) : z("", !0);
542
814
  }
543
- }), At = /* @__PURE__ */ R({
815
+ }), dn = /* @__PURE__ */ E({
544
816
  __name: "AdminNav",
545
817
  props: {
546
818
  collapsed: { type: Boolean }
547
819
  },
548
820
  emits: ["select"],
549
- setup(e, { emit: n }) {
550
- const t = n, a = O(), u = B("webx-admin"), s = we(), l = Ne(), o = x({
551
- get: () => a.nav.value.find((m) => l.path.startsWith(m.path))?.id ?? "",
552
- set: (r) => {
553
- const m = a.nav.value.find((v) => v.id === r);
554
- m !== void 0 && s.push(m.path);
821
+ setup(e, { emit: t }) {
822
+ const n = t, a = q(), i = V("webx-admin"), s = We(), l = nt(), r = x({
823
+ get: () => a.nav.value.find((d) => l.path.startsWith(d.path))?.id ?? "",
824
+ set: (u) => {
825
+ const d = a.nav.value.find((v) => v.id === u);
826
+ d !== void 0 && s.push(d.path);
555
827
  }
556
828
  });
557
- return (r, m) => {
558
- const v = U("wx-menu-item"), f = U("wx-submenu"), d = U("wx-menu");
559
- return h(), w(d, {
560
- modelValue: o.value,
561
- "onUpdate:modelValue": m[0] || (m[0] = (p) => o.value = p),
829
+ return (u, d) => {
830
+ const v = I("wx-menu-item"), m = I("wx-submenu"), p = I("wx-menu");
831
+ return f(), S(p, {
832
+ modelValue: r.value,
833
+ "onUpdate:modelValue": d[0] || (d[0] = (c) => r.value = c),
562
834
  collapsed: e.collapsed,
563
- label: i(u)("nav.sections"),
564
- onSelect: m[1] || (m[1] = (p) => t("select"))
835
+ label: o(i)("nav.sections"),
836
+ onSelect: d[1] || (d[1] = (c) => n("select"))
565
837
  }, {
566
838
  default: g(() => [
567
- (h(!0), k(I, null, P(i(a).groups.value.top, (p) => (h(), w(v, {
568
- key: p.id,
569
- value: p.id,
570
- icon: p.icon ?? void 0,
571
- label: p.title
839
+ (f(!0), $(D, null, K(o(a).groups.value.top, (c) => (f(), S(v, {
840
+ key: c.id,
841
+ value: c.id,
842
+ icon: c.icon ?? void 0,
843
+ label: c.title
572
844
  }, null, 8, ["value", "icon", "label"]))), 128)),
573
- (h(!0), k(I, null, P(i(a).groups.value.groups, (p) => (h(), w(f, {
574
- key: p.id,
575
- value: `group:${p.id}`,
576
- title: p.title,
577
- icon: p.icon ?? "gear"
845
+ (f(!0), $(D, null, K(o(a).groups.value.groups, (c) => (f(), S(m, {
846
+ key: c.id,
847
+ value: `group:${c.id}`,
848
+ title: c.title,
849
+ icon: c.icon ?? "gear"
578
850
  }, {
579
851
  default: g(() => [
580
- (h(!0), k(I, null, P(p.entries, (b) => (h(), w(v, {
581
- key: b.id,
582
- value: b.id,
583
- icon: b.icon ?? void 0,
584
- label: b.title
852
+ (f(!0), $(D, null, K(c.entries, (_) => (f(), S(v, {
853
+ key: _.id,
854
+ value: _.id,
855
+ icon: _.icon ?? void 0,
856
+ label: _.title
585
857
  }, null, 8, ["value", "icon", "label"]))), 128))
586
858
  ]),
587
859
  _: 2
@@ -591,68 +863,68 @@ const Wt = /* @__PURE__ */ R({
591
863
  }, 8, ["modelValue", "collapsed", "label"]);
592
864
  };
593
865
  }
594
- }), Rt = {
866
+ }), cn = {
595
867
  key: 0,
596
868
  class: "wx-root wx-admin-plain"
597
- }, Et = {
869
+ }, mn = {
598
870
  key: 1,
599
871
  class: "wx-root wx-admin-plain"
600
- }, Ut = {
872
+ }, fn = {
601
873
  key: 2,
602
874
  class: "wx-root wx-admin-plain"
603
- }, Bt = ["src", "alt", "width", "height"], It = ["src", "alt", "width", "height"], Mt = ["src", "alt"], Dt = { class: "wx-admin__user" }, Nt = { class: "wx-admin__user wx-admin__user--drawer" }, Pt = /* @__PURE__ */ R({
875
+ }, vn = ["src", "alt", "width", "height"], hn = ["src", "alt", "width", "height"], pn = ["src", "alt"], bn = { class: "wx-admin__user" }, gn = { class: "wx-admin__user wx-admin__user--drawer" }, yn = /* @__PURE__ */ E({
604
876
  __name: "AdminShell",
605
877
  setup(e) {
606
- const n = O(), t = B("webx-admin"), a = A(null), { width: u, layout: s, collapsed: l, showAside: o, drawerOpen: r, toggle: m, close: v } = Xe(
878
+ const t = q(), n = V("webx-admin"), a = C(null), { width: i, layout: s, collapsed: l, showAside: r, drawerOpen: u, toggle: d, close: v } = vt(
607
879
  a,
608
880
  { persist: "webx-admin-shell" }
609
- ), f = x(() => n.state.manifest?.title ?? ""), d = x(() => n.state.manifest?.branding?.logo ?? null), p = x(() => n.state.manifest?.branding?.mark ?? null), b = x(() => Ge(u.value, null));
610
- return Ae(() => {
611
- typeof document > "u" || (document.documentElement.dataset.wxShell = b.value);
612
- }), Re(() => {
881
+ ), m = x(() => t.state.manifest?.title ?? ""), p = x(() => t.state.manifest?.branding?.logo ?? null), c = x(() => t.state.manifest?.branding?.mark ?? null), _ = x(() => ht(i.value, null));
882
+ return Ye(() => {
883
+ typeof document > "u" || (document.documentElement.dataset.wxShell = _.value);
884
+ }), Xe(() => {
613
885
  typeof document < "u" && delete document.documentElement.dataset.wxShell;
614
- }), (c, y) => {
615
- const $ = U("router-view"), X = U("wx-loading"), ae = U("wx-button"), le = U("wx-result"), V = U("wx-action"), S = U("wx-text"), E = U("wx-header"), T = U("wx-aside"), D = U("wx-main"), Te = U("wx-container"), Ce = U("wx-drawer");
616
- return h(), k(I, null, [
617
- _(i(Je)),
618
- i(n).state.status === "unauthenticated" ? (h(), k("div", Rt, [
619
- _($)
620
- ])) : i(n).state.status === "loading" ? (h(), k("div", Et, [
621
- _(X, {
622
- label: i(t)("shell.loading")
886
+ }), (h, b) => {
887
+ const w = I("router-view"), O = I("wx-loading"), Q = I("wx-button"), Y = I("wx-result"), j = I("wx-action"), T = I("wx-text"), B = I("wx-header"), L = I("wx-aside"), P = I("wx-main"), me = I("wx-container"), fe = I("wx-drawer");
888
+ return f(), $(D, null, [
889
+ k(o(pt)),
890
+ o(t).state.status === "unauthenticated" ? (f(), $("div", cn, [
891
+ k(w)
892
+ ])) : o(t).state.status === "loading" ? (f(), $("div", mn, [
893
+ k(O, {
894
+ label: o(n)("shell.loading")
623
895
  }, null, 8, ["label"])
624
- ])) : i(n).state.status === "error" ? (h(), k("div", Ut, [
625
- _(le, {
896
+ ])) : o(t).state.status === "error" ? (f(), $("div", fn, [
897
+ k(Y, {
626
898
  status: "error",
627
- title: i(t)("shell.error-title"),
628
- description: i(n).state.error
899
+ title: o(n)("shell.error-title"),
900
+ description: o(t).state.error
629
901
  }, {
630
902
  default: g(() => [
631
- _(ae, {
903
+ k(Q, {
632
904
  type: "primary",
633
- onClick: y[0] || (y[0] = (ce) => i(n).reload())
905
+ onClick: b[0] || (b[0] = (ae) => o(t).reload())
634
906
  }, {
635
907
  default: g(() => [
636
- W(C(i(t)("shell.retry")), 1)
908
+ R(W(o(n)("shell.retry")), 1)
637
909
  ]),
638
910
  _: 1
639
911
  })
640
912
  ]),
641
913
  _: 1
642
914
  }, 8, ["title", "description"])
643
- ])) : (h(), k("div", {
915
+ ])) : (f(), $("div", {
644
916
  key: 3,
645
917
  ref_key: "shellEl",
646
918
  ref: a,
647
- class: H(["wx-root wx-admin", `wx-admin--${b.value}`])
919
+ class: G(["wx-root wx-admin", `wx-admin--${_.value}`])
648
920
  }, [
649
- _(Te, {
650
- direction: i(s) === "drawer" ? "vertical" : "horizontal",
921
+ k(me, {
922
+ direction: o(s) === "drawer" ? "vertical" : "horizontal",
651
923
  "full-height": "",
652
924
  class: "wx-admin__frame"
653
925
  }, {
654
926
  default: g(() => [
655
- i(s) === "drawer" ? (h(), w(E, {
927
+ o(s) === "drawer" ? (f(), S(B, {
656
928
  key: 0,
657
929
  class: "wx-admin__header",
658
930
  floating: "",
@@ -662,29 +934,29 @@ const Wt = /* @__PURE__ */ R({
662
934
  height: "var(--wx-admin-header-height)"
663
935
  }, {
664
936
  end: g(() => [
665
- L(c.$slots, "user", { expanded: !1 }, void 0, !0)
937
+ N(h.$slots, "user", { expanded: !1 }, void 0, !0)
666
938
  ]),
667
939
  default: g(() => [
668
- _(V, {
940
+ k(j, {
669
941
  icon: "menu",
670
- title: i(t)("nav.menu"),
671
- onClick: i(m)
942
+ title: o(n)("nav.menu"),
943
+ onClick: o(d)
672
944
  }, null, 8, ["title", "onClick"]),
673
- L(c.$slots, "brand", {}, () => [
674
- d.value ? (h(), k("img", {
945
+ N(h.$slots, "brand", {}, () => [
946
+ p.value ? (f(), $("img", {
675
947
  key: 0,
676
948
  class: "wx-admin__logo",
677
- src: d.value.url,
678
- alt: f.value,
679
- width: d.value.width ?? void 0,
680
- height: d.value.height ?? void 0
681
- }, null, 8, Bt)) : (h(), w(S, {
949
+ src: p.value.url,
950
+ alt: m.value,
951
+ width: p.value.width ?? void 0,
952
+ height: p.value.height ?? void 0
953
+ }, null, 8, vn)) : (f(), S(T, {
682
954
  key: 1,
683
955
  weight: "semibold",
684
956
  truncate: ""
685
957
  }, {
686
958
  default: g(() => [
687
- W(C(f.value), 1)
959
+ R(W(m.value), 1)
688
960
  ]),
689
961
  _: 1
690
962
  }))
@@ -692,96 +964,96 @@ const Wt = /* @__PURE__ */ R({
692
964
  ]),
693
965
  _: 3
694
966
  })) : z("", !0),
695
- i(o) ? (h(), w(T, {
967
+ o(r) ? (f(), S(L, {
696
968
  key: 1,
697
969
  class: "wx-admin__aside",
698
970
  sticky: "",
699
971
  floating: "",
700
972
  scroll: "",
701
973
  bordered: !1,
702
- collapsed: i(l),
974
+ collapsed: o(l),
703
975
  width: 220,
704
976
  "collapsed-width": 56
705
977
  }, {
706
978
  top: g(() => [
707
979
  M("div", {
708
- class: H(["wx-admin__brand", { "wx-admin__brand--stacked": i(l) && p.value }])
980
+ class: G(["wx-admin__brand", { "wx-admin__brand--stacked": o(l) && c.value }])
709
981
  }, [
710
- i(l) ? p.value ? (h(), k("img", {
982
+ o(l) ? c.value ? (f(), $("img", {
711
983
  key: 1,
712
984
  class: "wx-admin__mark",
713
- src: p.value.url,
714
- alt: f.value
715
- }, null, 8, Mt)) : z("", !0) : L(c.$slots, "brand", {}, () => [
716
- d.value ? (h(), k("img", {
985
+ src: c.value.url,
986
+ alt: m.value
987
+ }, null, 8, pn)) : z("", !0) : N(h.$slots, "brand", {}, () => [
988
+ p.value ? (f(), $("img", {
717
989
  key: 0,
718
990
  class: "wx-admin__logo",
719
- src: d.value.url,
720
- alt: f.value,
721
- width: d.value.width ?? void 0,
722
- height: d.value.height ?? void 0
723
- }, null, 8, It)) : (h(), w(S, {
991
+ src: p.value.url,
992
+ alt: m.value,
993
+ width: p.value.width ?? void 0,
994
+ height: p.value.height ?? void 0
995
+ }, null, 8, hn)) : (f(), S(T, {
724
996
  key: 1,
725
997
  weight: "semibold",
726
998
  truncate: "",
727
999
  class: "wx-admin__title"
728
1000
  }, {
729
1001
  default: g(() => [
730
- W(C(f.value), 1)
1002
+ R(W(m.value), 1)
731
1003
  ]),
732
1004
  _: 1
733
1005
  }))
734
1006
  ], !0, 0),
735
- _(V, {
1007
+ k(j, {
736
1008
  icon: "sidebar",
737
- title: i(l) ? i(t)("nav.expand") : i(t)("nav.collapse"),
738
- onClick: i(m)
1009
+ title: o(l) ? o(n)("nav.expand") : o(n)("nav.collapse"),
1010
+ onClick: o(d)
739
1011
  }, null, 8, ["title", "onClick"])
740
1012
  ], 2)
741
1013
  ]),
742
1014
  bottom: g(() => [
743
- M("div", Dt, [
744
- L(c.$slots, "user", {
745
- expanded: !i(l)
1015
+ M("div", bn, [
1016
+ N(h.$slots, "user", {
1017
+ expanded: !o(l)
746
1018
  }, void 0, !0)
747
1019
  ])
748
1020
  ]),
749
1021
  default: g(() => [
750
- L(c.$slots, "nav", { collapsed: i(l) }, void 0, !0)
1022
+ N(h.$slots, "nav", { collapsed: o(l) }, void 0, !0)
751
1023
  ]),
752
1024
  _: 3
753
1025
  }, 8, ["collapsed"])) : z("", !0),
754
- _(D, {
1026
+ k(P, {
755
1027
  padding: "none",
756
1028
  class: "wx-admin__screen"
757
1029
  }, {
758
1030
  default: g(() => [
759
- _($)
1031
+ k(w)
760
1032
  ]),
761
1033
  _: 1
762
1034
  })
763
1035
  ]),
764
1036
  _: 3
765
1037
  }, 8, ["direction"]),
766
- _(Ce, {
767
- open: i(r),
768
- "onUpdate:open": y[1] || (y[1] = (ce) => Ee(r) ? r.value = ce : null),
1038
+ k(fe, {
1039
+ open: o(u),
1040
+ "onUpdate:open": b[1] || (b[1] = (ae) => Ge(u) ? u.value = ae : null),
769
1041
  class: "wx-admin__drawer",
770
- title: f.value === "" ? i(t)("nav.menu") : f.value,
1042
+ title: m.value === "" ? o(n)("nav.menu") : m.value,
771
1043
  side: "left",
772
1044
  size: 260,
773
1045
  "full-screen": !1,
774
1046
  closable: ""
775
1047
  }, {
776
1048
  footer: g(() => [
777
- M("div", Nt, [
778
- L(c.$slots, "user", { expanded: !0 }, void 0, !0)
1049
+ M("div", gn, [
1050
+ N(h.$slots, "user", { expanded: !0 }, void 0, !0)
779
1051
  ])
780
1052
  ]),
781
1053
  default: g(() => [
782
- L(c.$slots, "nav", {
1054
+ N(h.$slots, "nav", {
783
1055
  collapsed: !1,
784
- select: i(v)
1056
+ select: o(v)
785
1057
  }, void 0, !0)
786
1058
  ]),
787
1059
  _: 3
@@ -790,10 +1062,10 @@ const Wt = /* @__PURE__ */ R({
790
1062
  ], 64);
791
1063
  };
792
1064
  }
793
- }), Vt = /* @__PURE__ */ N(Pt, [["__scopeId", "data-v-309fdb9d"]]);
794
- class re extends Error {
795
- constructor(n, t, a = {}, u = null, s = null) {
796
- super(n), this.status = t, this.errors = a, this.retryAfter = u, this.body = s, this.name = "HttpError";
1065
+ }), wn = /* @__PURE__ */ F(yn, [["__scopeId", "data-v-309fdb9d"]]);
1066
+ class pe extends Error {
1067
+ constructor(t, n, a = {}, i = null, s = null) {
1068
+ super(t), this.status = n, this.errors = a, this.retryAfter = i, this.body = s, this.name = "HttpError";
797
1069
  }
798
1070
  status;
799
1071
  errors;
@@ -810,86 +1082,136 @@ class re extends Error {
810
1082
  return this.status === 429;
811
1083
  }
812
1084
  }
813
- const Ft = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
814
- function Ht(e = {}) {
815
- const n = (e.baseUrl ?? "").replace(/\/$/, ""), t = e.csrfUrl ?? "/sanctum/csrf-cookie", a = e.fetch ?? globalThis.fetch.bind(globalThis), u = e.onUnauthenticated, s = e.headers;
1085
+ const xn = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
1086
+ function kn(e = {}) {
1087
+ const t = (e.baseUrl ?? "").replace(/\/$/, ""), n = e.csrfUrl ?? "/api/cms/auth/csrf-cookie", a = e.fetch ?? globalThis.fetch.bind(globalThis), i = e.onUnauthenticated, s = e.headers;
816
1088
  let l = !1;
817
- async function o(m = !1) {
818
- l && !m && ve("XSRF-TOKEN") !== null || (await a(t, { credentials: "same-origin" }), l = !0);
1089
+ async function r(d = !1) {
1090
+ l && !d && _e("XSRF-TOKEN") !== null || (await a(n, { credentials: "same-origin" }), l = !0);
819
1091
  }
820
- async function r(m, v, f, d = {}, p = !1) {
821
- const b = Ft.has(m);
822
- b && await o();
823
- const c = {
1092
+ async function u(d, v, m, p = {}, c = !1) {
1093
+ const _ = xn.has(d);
1094
+ _ && await r();
1095
+ const h = {
824
1096
  Accept: "application/json",
825
1097
  "X-Requested-With": "XMLHttpRequest",
826
1098
  // Standing headers first, so a caller can still override one for a single request.
827
1099
  ...s?.(),
828
- ...d.headers
1100
+ ...p.headers
829
1101
  };
830
- if (b) {
831
- const $ = ve("XSRF-TOKEN");
832
- $ !== null && (c["X-XSRF-TOKEN"] = $);
1102
+ if (_) {
1103
+ const w = _e("XSRF-TOKEN");
1104
+ w !== null && (h["X-XSRF-TOKEN"] = w);
833
1105
  }
834
- f !== void 0 && (c["Content-Type"] = "application/json");
835
- const y = await a(jt(n, v, d.query), {
836
- method: m,
1106
+ m !== void 0 && (h["Content-Type"] = "application/json");
1107
+ const b = await a($n(t, v, p.query), {
1108
+ method: d,
837
1109
  credentials: "same-origin",
838
- headers: c,
839
- signal: d.signal,
840
- body: f === void 0 ? void 0 : JSON.stringify(f)
1110
+ headers: h,
1111
+ signal: p.signal,
1112
+ body: m === void 0 ? void 0 : JSON.stringify(m)
841
1113
  });
842
- if (y.status === 419 && b && !p)
843
- return await o(!0), r(m, v, f, d, !0);
844
- if (y.status === 401 && u?.(), !y.ok)
845
- throw await Ot(y);
846
- if (y.status !== 204)
847
- return await y.json();
1114
+ if (b.status === 419 && _ && !c)
1115
+ return await r(!0), u(d, v, m, p, !0);
1116
+ if (b.status === 401 && i?.(), !b.ok)
1117
+ throw await _n(b);
1118
+ if (b.status !== 204)
1119
+ return await b.json();
848
1120
  }
849
1121
  return {
850
- get: (m, v) => r("GET", m, void 0, v),
851
- post: (m, v, f) => r("POST", m, v, f),
852
- put: (m, v, f) => r("PUT", m, v, f),
853
- patch: (m, v, f) => r("PATCH", m, v, f),
854
- delete: (m, v) => r("DELETE", m, void 0, v)
1122
+ get: (d, v) => u("GET", d, void 0, v),
1123
+ post: (d, v, m) => u("POST", d, v, m),
1124
+ put: (d, v, m) => u("PUT", d, v, m),
1125
+ patch: (d, v, m) => u("PATCH", d, v, m),
1126
+ delete: (d, v) => u("DELETE", d, void 0, v)
855
1127
  };
856
1128
  }
857
- async function Ot(e) {
858
- let n = null;
1129
+ async function _n(e) {
1130
+ let t = null;
859
1131
  try {
860
- n = await e.json();
1132
+ t = await e.json();
861
1133
  } catch {
862
1134
  }
863
- const t = n ?? {}, a = typeof t.message == "string" && t.message !== "" ? t.message : e.statusText || `Request failed with ${e.status}`, u = t.errors !== null && typeof t.errors == "object" ? t.errors : {}, s = e.headers.get("Retry-After"), l = s === null ? null : Number.parseInt(s, 10);
864
- return new re(
1135
+ const n = t ?? {}, a = typeof n.message == "string" && n.message !== "" ? n.message : e.statusText || `Request failed with ${e.status}`, i = n.errors !== null && typeof n.errors == "object" ? n.errors : {}, s = e.headers.get("Retry-After"), l = s === null ? null : Number.parseInt(s, 10);
1136
+ return new pe(
865
1137
  a,
866
1138
  e.status,
867
- u,
1139
+ i,
868
1140
  Number.isFinite(l) ? l : null,
869
- n
1141
+ t
870
1142
  );
871
1143
  }
872
- function jt(e, n, t) {
873
- const u = /^https?:\/\//i.test(n) ? n : `${e}/${n.replace(/^\//, "")}`;
874
- if (t === void 0)
875
- return u;
1144
+ function $n(e, t, n) {
1145
+ const i = /^https?:\/\//i.test(t) ? t : `${e}/${t.replace(/^\//, "")}`;
1146
+ if (n === void 0)
1147
+ return i;
876
1148
  const s = new URLSearchParams();
877
- for (const [o, r] of Object.entries(t))
878
- r != null && s.set(o, String(r));
1149
+ for (const [r, u] of Object.entries(n))
1150
+ u != null && s.set(r, String(u));
879
1151
  const l = s.toString();
880
- return l === "" ? u : `${u}${u.includes("?") ? "&" : "?"}${l}`;
1152
+ return l === "" ? i : `${i}${i.includes("?") ? "&" : "?"}${l}`;
881
1153
  }
882
- function ve(e) {
1154
+ function _e(e) {
883
1155
  if (typeof document > "u")
884
1156
  return null;
885
- for (const n of document.cookie.split(";")) {
886
- const [t, ...a] = n.trim().split("=");
887
- if (t === e)
1157
+ for (const t of document.cookie.split(";")) {
1158
+ const [n, ...a] = t.trim().split("=");
1159
+ if (n === e)
888
1160
  return decodeURIComponent(a.join("="));
889
1161
  }
890
1162
  return null;
891
1163
  }
892
- const $e = {
1164
+ const Sn = "webx.theme", Ne = /* @__PURE__ */ Symbol("webx-theme");
1165
+ function ma() {
1166
+ const e = te(Ne, null);
1167
+ if (e === null)
1168
+ throw new Error("useTheme() was called outside a panel created by createAdmin().");
1169
+ return e;
1170
+ }
1171
+ function Tn(e, t) {
1172
+ e.provide(Ne, t);
1173
+ }
1174
+ function Ln(e = {}) {
1175
+ const t = e.storageKey === void 0 ? Sn : e.storageKey, n = ue({
1176
+ preference: An(t) ?? "system",
1177
+ resolved: "light"
1178
+ });
1179
+ function a() {
1180
+ At(n.preference), n.resolved = n.preference === "system" ? Wt() : n.preference;
1181
+ }
1182
+ return a(), Lt((i) => {
1183
+ n.preference === "system" && (n.resolved = i);
1184
+ }), {
1185
+ state: n,
1186
+ set(i) {
1187
+ n.preference = i, a(), $e(t, i);
1188
+ },
1189
+ adopt(i) {
1190
+ if (i === void 0)
1191
+ return;
1192
+ const s = i ?? "system";
1193
+ s !== n.preference && (n.preference = s, a(), $e(t, s));
1194
+ }
1195
+ };
1196
+ }
1197
+ function $e(e, t) {
1198
+ if (e !== null)
1199
+ try {
1200
+ localStorage.setItem(e, t);
1201
+ } catch {
1202
+ }
1203
+ }
1204
+ function An(e) {
1205
+ if (e === null)
1206
+ return null;
1207
+ try {
1208
+ const t = localStorage.getItem(e);
1209
+ return t === "light" || t === "dark" || t === "system" ? t : null;
1210
+ } catch {
1211
+ return null;
1212
+ }
1213
+ }
1214
+ const Ve = {
893
1215
  shell: {
894
1216
  loading: "Loading the panel…",
895
1217
  "error-title": "The panel could not start",
@@ -906,6 +1228,15 @@ const $e = {
906
1228
  // The one menu group the panel names itself; a module's own group is named by the module.
907
1229
  system: "System"
908
1230
  },
1231
+ // The three words on the theme switch. They belong to the panel rather than to whoever
1232
+ // places the switch: a core component ships English prop defaults and knows nothing about
1233
+ // a dictionary, so the panel is the one that has to say them.
1234
+ theme: {
1235
+ label: "Theme",
1236
+ light: "Light",
1237
+ dark: "Dark",
1238
+ system: "Follow the system"
1239
+ },
909
1240
  // What a screen that edits one record offers whatever the record is: the way out of it, and
910
1241
  // the way to rename it. A module that opens an editor should not be inventing these.
911
1242
  editor: {
@@ -939,6 +1270,14 @@ const $e = {
939
1270
  // whether the panel failed to load it.
940
1271
  never: "never"
941
1272
  },
1273
+ // The one line the panel says about the nightly database dump. It lives at the foot of the
1274
+ // settings screen, and the warning is the whole point of it: a backup whose breakage is
1275
+ // discovered on the day it was needed is not a backup.
1276
+ backup: {
1277
+ title: "Last database snapshot:",
1278
+ stale: "No database snapshot since :date. Check the schedule.",
1279
+ never: "The database has never been backed up. Check the schedule."
1280
+ },
942
1281
  // How a request fails, in the panel's words rather than the server's (§13.3). `errors.ts`
943
1282
  // decides which of these a status gets.
944
1283
  errors: {
@@ -1009,201 +1348,237 @@ const $e = {
1009
1348
  missing: "That record no longer exists.",
1010
1349
  forbidden: "You may not read the notes of this record.",
1011
1350
  "not-yours": "A note is edited by whoever wrote it."
1351
+ },
1352
+ // Where a link goes. The sections of the picker are named by whichever modules registered them;
1353
+ // these are the words around them, plus the six the server says when a link will not do.
1354
+ links: {
1355
+ "target-entity": "This site",
1356
+ "target-url": "An address",
1357
+ "target-none": "Nowhere",
1358
+ section: "Section",
1359
+ search: "Start typing a name",
1360
+ searching: "Searching…",
1361
+ empty: "Nothing found",
1362
+ clear: "Clear the link",
1363
+ unavailable: "Not on the site yet",
1364
+ missing: "What this pointed at is gone",
1365
+ "url-label": "Address",
1366
+ "url-placeholder": "/account or https://example.com",
1367
+ hash: "Anchor",
1368
+ "hash-placeholder": "section-on-the-page",
1369
+ "url-routes": "Addresses of this site",
1370
+ "new-tab": "Open in a new tab",
1371
+ rel: "Relationship",
1372
+ "rel-nofollow": "Pass no link weight",
1373
+ "rel-sponsored": "Paid placement",
1374
+ "rel-ugc": "Written by a visitor",
1375
+ shape: "This field takes a link.",
1376
+ target: "This field does not know that kind of target.",
1377
+ "no-source": "Nothing here can link to that.",
1378
+ "no-entity": "Choose what to link to.",
1379
+ "url-length": "An address may be at most :max characters long.",
1380
+ "url-scheme": "An address has to be a path or start with http, https, mailto or tel.",
1381
+ "hash-length": "An anchor may be at most :max characters long.",
1382
+ "hash-shape": "An anchor is a name on the page: no spaces in it.",
1383
+ "not-localized": "A link is the same in every language and cannot be translated."
1012
1384
  }
1013
- }, Se = "webx.locale";
1014
- function zn(e = {}) {
1015
- const n = e.manifestUrl ?? Jt() ?? "/api/cms/manifest", t = e.apiPath ?? n.replace(/\/manifest\/?$/, ""), a = e.basePath ?? "/cms", u = e.modules ?? [], s = [...e.routes ?? []];
1016
- for (const c of u)
1017
- s.push(...c.routes ?? []);
1018
- if (!s.some((c) => c.path === "/")) {
1019
- const c = u.find((y) => y.landing === !0);
1385
+ }, Ie = "webx.locale";
1386
+ function fa(e = {}) {
1387
+ const t = e.manifestUrl ?? En() ?? "/api/cms/manifest", n = e.apiPath ?? t.replace(/\/manifest\/?$/, ""), a = e.basePath ?? "/cms", i = e.modules ?? [], s = [...e.routes ?? []];
1388
+ for (const b of i)
1389
+ s.push(...b.routes ?? []);
1390
+ if (!s.some((b) => b.path === "/")) {
1391
+ const b = i.find((w) => w.landing === !0);
1020
1392
  s.push({
1021
1393
  path: "/",
1022
1394
  name: "webx.home",
1023
- component: Wt,
1024
- props: { landing: c?.path ?? c?.routes?.[0]?.path ?? null }
1395
+ component: un,
1396
+ props: { landing: b?.path ?? b?.routes?.[0]?.path ?? null }
1025
1397
  });
1026
1398
  }
1027
- const l = Pe({
1028
- history: Ve(a),
1399
+ const l = at({
1400
+ history: lt(a),
1029
1401
  routes: s
1030
- }), o = de({ locale: e.locale ?? Yt() }), r = e.http ?? Ht({
1402
+ }), r = ge({ locale: e.locale ?? Cn() }), u = Ln(), d = e.http ?? kn({
1031
1403
  baseUrl: "",
1404
+ csrfUrl: `${n}/auth/csrf-cookie`,
1032
1405
  onUnauthenticated: () => {
1033
- v.setUser(null), v.state.status = "unauthenticated";
1406
+ m.setUser(null), m.state.status = "unauthenticated";
1034
1407
  },
1035
1408
  // Every request says which language the panel is currently showing. It decides what
1036
1409
  // the server writes its own messages in — a 422 under a field — for anybody who has
1037
1410
  // not stored a preference yet, which is everybody until they choose one. Without it,
1038
1411
  // signing in on a Russian sign-in screen lands in an English panel.
1039
- headers: () => ({ "X-Webx-Locale": o.state.locale })
1412
+ headers: () => ({ "X-Webx-Locale": r.state.locale })
1040
1413
  });
1041
- o.defaults("webx-admin", $e);
1042
- async function m(c) {
1043
- const y = await r.get(`${t}/translations/${c}`);
1044
- o.load(y.data.namespaces, y.data.locale, y.data.fallback), Kt(y.data.locale), Gt(y.data.locale, o.state.panelLocales);
1414
+ r.defaults("webx-admin", Ve);
1415
+ async function v(b) {
1416
+ const w = await d.get(`${n}/translations/${b}`);
1417
+ r.load(w.data.namespaces, w.data.locale, w.data.fallback), zn(w.data.locale), Un(w.data.locale, r.state.panelLocales);
1045
1418
  }
1046
- const v = Ct({
1047
- http: r,
1419
+ const m = sn({
1420
+ http: d,
1421
+ theme: u,
1048
1422
  basePath: a,
1049
- apiPath: t,
1050
- modules: u,
1051
- i18n: o,
1052
- loadDictionary: m,
1423
+ apiPath: n,
1424
+ modules: i,
1425
+ i18n: r,
1426
+ loadDictionary: v,
1053
1427
  types: e.types,
1054
1428
  screens: e.screens,
1055
- loadManifest: async () => (await r.get(n)).data
1056
- }), f = Ue(qt(e));
1057
- f.use(Qe), Lt(f, v), ct(f, o);
1058
- const d = A("");
1059
- f.provide(
1060
- Ze,
1061
- x(() => o.state.locale)
1062
- ), f.provide(et, {
1429
+ loadManifest: async () => (await d.get(t)).data
1430
+ }), p = Je(Wn(e));
1431
+ p.use(bt), on(p, m), Rt(p, r), Tn(p, u);
1432
+ const c = C("");
1433
+ p.provide(
1434
+ gt,
1435
+ x(() => r.state.locale)
1436
+ ), p.provide(yt, {
1063
1437
  list: x(
1064
- () => o.state.contentLocales.map((c) => ({
1065
- code: c.code,
1066
- label: c.code.toUpperCase()
1438
+ () => r.state.contentLocales.map((b) => ({
1439
+ code: b.code,
1440
+ label: b.code.toUpperCase()
1067
1441
  }))
1068
1442
  ),
1069
1443
  active: x({
1070
- get: () => d.value || (o.state.contentLocales[0]?.code ?? ""),
1071
- set: (c) => {
1072
- d.value = c;
1444
+ get: () => c.value || (r.state.contentLocales[0]?.code ?? ""),
1445
+ set: (b) => {
1446
+ c.value = b;
1073
1447
  }
1074
1448
  })
1075
1449
  });
1076
- const p = {
1077
- app: f,
1450
+ const _ = {
1451
+ app: p,
1078
1452
  router: l,
1079
- context: v,
1080
- i18n: o,
1453
+ context: m,
1454
+ i18n: r,
1455
+ theme: u,
1081
1456
  async mount() {
1082
- await Promise.all([b(), m(o.state.locale)]).catch(() => {
1083
- }), f.mount(e.el ?? "#webx-app"), await v.reload();
1457
+ await Promise.all([h(), v(r.state.locale)]).catch(() => {
1458
+ }), p.mount(e.el ?? "#webx-app"), await m.reload();
1084
1459
  }
1085
1460
  };
1086
- async function b() {
1087
- const c = await r.get(`${t}/locales`);
1088
- o.state.panelLocales = c.data.panel, o.state.contentLocales = c.data.content;
1461
+ async function h() {
1462
+ const b = await d.get(`${n}/locales`);
1463
+ r.state.panelLocales = b.data.panel, r.state.contentLocales = b.data.content;
1089
1464
  }
1090
- for (const c of e.plugins ?? [])
1091
- c.install(p);
1092
- return f.use(l), p;
1465
+ for (const b of e.plugins ?? [])
1466
+ b.install(_);
1467
+ return p.use(l), _;
1093
1468
  }
1094
- function qt(e) {
1095
- const n = {
1469
+ function Wn(e) {
1470
+ const t = {
1096
1471
  // The menu is the panel's own: it is the manifest, drawn.
1097
1472
  // The shell hands in what a choice means where it drew the menu — in the drawer it is what
1098
1473
  // closes it, and a drawer that stays open over the section it just opened is a drawer the
1099
1474
  // reader has to dismiss by hand.
1100
- nav: (t) => G(At, { collapsed: t.collapsed === !0, onSelect: t.select })
1475
+ nav: (n) => le(dn, { collapsed: n.collapsed === !0, onSelect: n.select })
1101
1476
  };
1102
- return e.brand !== void 0 && (n.brand = () => G(e.brand)), e.userMenu !== void 0 && (n.user = (t) => G(e.userMenu, { expanded: t.expanded === !0 })), { render: () => G(Vt, null, n) };
1477
+ return e.brand !== void 0 && (t.brand = () => le(e.brand)), e.userMenu !== void 0 && (t.user = (n) => le(e.userMenu, { expanded: n.expanded === !0 })), { render: () => le(wn, null, t) };
1103
1478
  }
1104
- function Yt() {
1105
- const e = Xt(Se);
1479
+ function Cn() {
1480
+ const e = Rn(Ie);
1106
1481
  return e !== null ? e : typeof document < "u" && document.documentElement.lang !== "" ? document.documentElement.lang : typeof navigator > "u" ? "en" : navigator.language;
1107
1482
  }
1108
- function Kt(e) {
1483
+ function zn(e) {
1109
1484
  try {
1110
- localStorage.setItem(Se, e);
1485
+ localStorage.setItem(Ie, e);
1111
1486
  } catch {
1112
1487
  }
1113
1488
  }
1114
- function Xt(e) {
1489
+ function Rn(e) {
1115
1490
  try {
1116
1491
  return localStorage.getItem(e);
1117
1492
  } catch {
1118
1493
  return null;
1119
1494
  }
1120
1495
  }
1121
- function Gt(e, n) {
1122
- typeof document > "u" || (document.documentElement.lang = e, document.documentElement.dir = n.find((t) => t.code === e)?.direction ?? "ltr");
1496
+ function Un(e, t) {
1497
+ typeof document > "u" || (document.documentElement.lang = e, document.documentElement.dir = t.find((n) => n.code === e)?.direction ?? "ltr");
1123
1498
  }
1124
- function Jt() {
1499
+ function En() {
1125
1500
  return typeof document > "u" ? null : document.querySelector('meta[name="webx-manifest"]')?.getAttribute("content") ?? null;
1126
1501
  }
1127
- function Qt(e) {
1128
- const n = e.replace(/\r\n?/g, `
1502
+ function Bn(e) {
1503
+ const t = e.replace(/\r\n?/g, `
1129
1504
  `).split(`
1130
- `), t = [];
1505
+ `), n = [];
1131
1506
  let a = 0;
1132
- for (; a < n.length; ) {
1133
- const u = n[a] ?? "";
1134
- if (u.trim() === "") {
1507
+ for (; a < t.length; ) {
1508
+ const i = t[a] ?? "";
1509
+ if (i.trim() === "") {
1135
1510
  a += 1;
1136
1511
  continue;
1137
1512
  }
1138
- if (/^```([\w-]*)\s*$/.exec(u)) {
1139
- const r = [];
1140
- for (a += 1; a < n.length && !/^```\s*$/.test(n[a] ?? ""); )
1141
- r.push(n[a] ?? ""), a += 1;
1142
- a += 1, t.push(`<pre><code>${ue(r.join(`
1513
+ if (/^```([\w-]*)\s*$/.exec(i)) {
1514
+ const u = [];
1515
+ for (a += 1; a < t.length && !/^```\s*$/.test(t[a] ?? ""); )
1516
+ u.push(t[a] ?? ""), a += 1;
1517
+ a += 1, n.push(`<pre><code>${be(u.join(`
1143
1518
  `))}</code></pre>`);
1144
1519
  continue;
1145
1520
  }
1146
- const l = /^(#{1,4})\s+(.*)$/.exec(u);
1521
+ const l = /^(#{1,4})\s+(.*)$/.exec(i);
1147
1522
  if (l) {
1148
- const r = Math.min(l[1].length + 1, 5);
1149
- t.push(`<h${r}>${se(l[2] ?? "")}</h${r}>`), a += 1;
1523
+ const u = Math.min(l[1].length + 1, 5);
1524
+ n.push(`<h${u}>${he(l[2] ?? "")}</h${u}>`), a += 1;
1150
1525
  continue;
1151
1526
  }
1152
- if (Q(u)) {
1153
- const r = /^\s*\d+[.)]\s+/.test(u), m = [];
1154
- for (; a < n.length && Q(n[a] ?? ""); )
1155
- for (m.push((n[a] ?? "").replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "")), a += 1; a < n.length; ) {
1156
- const f = n[a] ?? "";
1157
- if (f.trim() === "" || Q(f) || /^(#{1,4})\s/.test(f) || /^```/.test(f))
1527
+ if (oe(i)) {
1528
+ const u = /^\s*\d+[.)]\s+/.test(i), d = [];
1529
+ for (; a < t.length && oe(t[a] ?? ""); )
1530
+ for (d.push((t[a] ?? "").replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "")), a += 1; a < t.length; ) {
1531
+ const m = t[a] ?? "";
1532
+ if (m.trim() === "" || oe(m) || /^(#{1,4})\s/.test(m) || /^```/.test(m))
1158
1533
  break;
1159
- m[m.length - 1] += ` ${f.trim()}`, a += 1;
1534
+ d[d.length - 1] += ` ${m.trim()}`, a += 1;
1160
1535
  }
1161
- const v = r ? "ol" : "ul";
1162
- t.push(`<${v}>${m.map((f) => `<li>${se(f)}</li>`).join("")}</${v}>`);
1536
+ const v = u ? "ol" : "ul";
1537
+ n.push(`<${v}>${d.map((m) => `<li>${he(m)}</li>`).join("")}</${v}>`);
1163
1538
  continue;
1164
1539
  }
1165
- const o = [];
1166
- for (; a < n.length; ) {
1167
- const r = n[a] ?? "";
1168
- if (r.trim() === "" || Q(r) || /^(#{1,4})\s/.test(r) || /^```/.test(r)) break;
1169
- o.push(r.trim()), a += 1;
1540
+ const r = [];
1541
+ for (; a < t.length; ) {
1542
+ const u = t[a] ?? "";
1543
+ if (u.trim() === "" || oe(u) || /^(#{1,4})\s/.test(u) || /^```/.test(u)) break;
1544
+ r.push(u.trim()), a += 1;
1170
1545
  }
1171
- t.push(`<p>${se(o.join(" "))}</p>`);
1546
+ n.push(`<p>${he(r.join(" "))}</p>`);
1172
1547
  }
1173
- return t.join("");
1548
+ return n.join("");
1174
1549
  }
1175
- const J = "\0";
1176
- function Q(e) {
1550
+ const se = "\0";
1551
+ function oe(e) {
1177
1552
  return /^\s*(?:[-*+]|\d+[.)])\s+/.test(e);
1178
1553
  }
1179
- function se(e) {
1180
- const n = [], t = e.replace(/`([^`]+)`/g, (u, s) => (n.push(`<code>${ue(s)}</code>`), `${J}${n.length - 1}${J}`));
1181
- return ue(t).replace(
1554
+ function he(e) {
1555
+ const t = [], n = e.replace(/`([^`]+)`/g, (i, s) => (t.push(`<code>${be(s)}</code>`), `${se}${t.length - 1}${se}`));
1556
+ return be(n).replace(
1182
1557
  /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,
1183
1558
  '<a href="$2" target="_blank" rel="noopener">$1</a>'
1184
1559
  ).replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(
1185
- new RegExp(`${J}(\\d+)${J}`, "g"),
1186
- (u, s) => n[Number(s)] ?? ""
1560
+ new RegExp(`${se}(\\d+)${se}`, "g"),
1561
+ (i, s) => t[Number(s)] ?? ""
1187
1562
  );
1188
1563
  }
1189
- function ue(e) {
1564
+ function be(e) {
1190
1565
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1191
1566
  }
1192
- function Zt(e) {
1193
- const n = e.scope("webx-admin"), t = /* @__PURE__ */ new Map();
1194
- function a(s, l, o) {
1195
- const r = e.state.locale, m = `${r}:${s}`;
1196
- let v = t.get(m);
1197
- return v === void 0 && (v = new Intl.DateTimeFormat(r, l), t.set(m, v)), v.format(o);
1567
+ function Nn(e) {
1568
+ const t = e.scope("webx-admin"), n = /* @__PURE__ */ new Map();
1569
+ function a(s, l, r) {
1570
+ const u = e.state.locale, d = `${u}:${s}`;
1571
+ let v = n.get(d);
1572
+ return v === void 0 && (v = new Intl.DateTimeFormat(u, l), n.set(d, v)), v.format(r);
1198
1573
  }
1199
- const u = (s) => a("time", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }, s);
1574
+ const i = (s) => a("time", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }, s);
1200
1575
  return {
1201
1576
  short(s) {
1202
- const l = ee(s);
1577
+ const l = re(s);
1203
1578
  if (l === null)
1204
- return n("dates.never");
1205
- const o = /* @__PURE__ */ new Date(), r = he(l, o);
1206
- return r === 0 ? n("dates.today", { time: u(l) }) : r === -1 ? n("dates.yesterday", { time: u(l) }) : l.getFullYear() === o.getFullYear() ? a(
1579
+ return t("dates.never");
1580
+ const r = /* @__PURE__ */ new Date(), u = Se(l, r);
1581
+ return u === 0 ? t("dates.today", { time: i(l) }) : u === -1 ? t("dates.yesterday", { time: i(l) }) : l.getFullYear() === r.getFullYear() ? a(
1207
1582
  "this-year",
1208
1583
  {
1209
1584
  day: "numeric",
@@ -1216,79 +1591,79 @@ function Zt(e) {
1216
1591
  ) : a("earlier", { day: "numeric", month: "long", year: "numeric" }, l);
1217
1592
  },
1218
1593
  compact(s) {
1219
- const l = ee(s);
1594
+ const l = re(s);
1220
1595
  if (l === null)
1221
- return n("dates.never");
1222
- const o = /* @__PURE__ */ new Date();
1223
- return he(l, o) === 0 ? u(l) : l.getFullYear() === o.getFullYear() ? a("compact", { day: "numeric", month: "short" }, l) : a("compact-earlier", { dateStyle: "short" }, l);
1596
+ return t("dates.never");
1597
+ const r = /* @__PURE__ */ new Date();
1598
+ return Se(l, r) === 0 ? i(l) : l.getFullYear() === r.getFullYear() ? a("compact", { day: "numeric", month: "short" }, l) : a("compact-earlier", { dateStyle: "short" }, l);
1224
1599
  },
1225
1600
  exact(s) {
1226
- const l = ee(s);
1601
+ const l = re(s);
1227
1602
  return l === null ? "" : a("exact", { dateStyle: "long", timeStyle: "medium", hourCycle: "h23" }, l);
1228
1603
  },
1229
1604
  iso(s) {
1230
- const l = ee(s);
1605
+ const l = re(s);
1231
1606
  return l === null ? "" : l.toISOString();
1232
1607
  }
1233
1608
  };
1234
1609
  }
1235
- function en() {
1236
- const e = te(ne, null);
1237
- return Zt(e ?? tn());
1610
+ function De() {
1611
+ const e = te(ce, null);
1612
+ return Nn(e ?? Vn());
1238
1613
  }
1239
- let Z = null;
1240
- function tn() {
1241
- return Z === null && (Z = de(), Z.defaults("webx-admin", $e)), Z;
1614
+ let ie = null;
1615
+ function Vn() {
1616
+ return ie === null && (ie = ge(), ie.defaults("webx-admin", Ve)), ie;
1242
1617
  }
1243
- function ee(e) {
1618
+ function re(e) {
1244
1619
  if (e == null || e === "")
1245
1620
  return null;
1246
- const n = e instanceof Date ? e : new Date(e);
1247
- return Number.isNaN(n.getTime()) ? null : n;
1621
+ const t = e instanceof Date ? e : new Date(e);
1622
+ return Number.isNaN(t.getTime()) ? null : t;
1248
1623
  }
1249
- function he(e, n) {
1250
- const t = (a) => Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
1251
- return Math.round((t(e) - t(n)) / 864e5);
1624
+ function Se(e, t) {
1625
+ const n = (a) => Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
1626
+ return Math.round((n(e) - n(t)) / 864e5);
1252
1627
  }
1253
- function nn(e, n, t) {
1254
- const a = e instanceof re ? e.status : ln(e);
1628
+ function In(e, t, n) {
1629
+ const a = e instanceof pe ? e.status : Mn(e);
1255
1630
  if (a === 422)
1256
- return sn(e) ?? t ?? n("errors.unknown");
1257
- if (a === 401) return n("errors.signed-out");
1258
- if (a === 403) return n("errors.forbidden");
1259
- if (a === 404) return n("errors.gone");
1260
- if (a === 409) return n("errors.conflict");
1631
+ return Pn(e) ?? n ?? t("errors.unknown");
1632
+ if (a === 401) return t("errors.signed-out");
1633
+ if (a === 403) return t("errors.forbidden");
1634
+ if (a === 404) return t("errors.gone");
1635
+ if (a === 409) return t("errors.conflict");
1261
1636
  if (a === 429) {
1262
- const u = e instanceof re ? e.retryAfter : null;
1263
- return u === null ? n("errors.throttled") : n("errors.throttled-in", { seconds: u });
1637
+ const i = e instanceof pe ? e.retryAfter : null;
1638
+ return i === null ? t("errors.throttled") : t("errors.throttled-in", { seconds: i });
1264
1639
  }
1265
- return a !== null && a >= 500 ? n("errors.server") : a === null ? n("errors.offline") : t ?? n("errors.unknown");
1640
+ return a !== null && a >= 500 ? t("errors.server") : a === null ? t("errors.offline") : n ?? t("errors.unknown");
1266
1641
  }
1267
- function an() {
1268
- const e = B("webx-admin");
1269
- return (n, t) => nn(n, e, t);
1642
+ function Dn() {
1643
+ const e = V("webx-admin");
1644
+ return (t, n) => In(t, e, n);
1270
1645
  }
1271
- function ln(e) {
1272
- const n = e?.status;
1273
- return typeof n == "number" ? n : null;
1646
+ function Mn(e) {
1647
+ const t = e?.status;
1648
+ return typeof t == "number" ? t : null;
1274
1649
  }
1275
- function sn(e) {
1276
- const t = e?.body?.message;
1277
- return typeof t == "string" && t !== "" ? t : null;
1650
+ function Pn(e) {
1651
+ const n = e?.body?.message;
1652
+ return typeof n == "string" && n !== "" ? n : null;
1278
1653
  }
1279
- function on(e, n, t) {
1280
- const a = `${e.apiPath}/entities/${n}/${t}/notes`, u = (l) => `${e.apiPath}/notes/${l}`, s = (l) => l.data;
1654
+ function Fn(e, t, n) {
1655
+ const a = `${e.apiPath}/entities/${t}/${n}/notes`, i = (l) => `${e.apiPath}/notes/${l}`, s = (l) => l.data;
1281
1656
  return {
1282
1657
  list: () => e.http.get(a).then(s),
1283
1658
  add: (l) => e.http.post(a, { body: l }).then(s),
1284
- save: (l, o) => e.http.put(u(l), { body: o }).then(s),
1285
- remove: (l) => e.http.delete(u(l)).then(() => {
1659
+ save: (l, r) => e.http.put(i(l), { body: r }).then(s),
1660
+ remove: (l) => e.http.delete(i(l)).then(() => {
1286
1661
  })
1287
1662
  };
1288
1663
  }
1289
- const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1664
+ const Hn = { class: "wx-screen-host" }, va = /* @__PURE__ */ E({
1290
1665
  __name: "Screen",
1291
- props: /* @__PURE__ */ ie({
1666
+ props: /* @__PURE__ */ ee({
1292
1667
  name: {},
1293
1668
  errors: { default: void 0 },
1294
1669
  disabled: { type: Boolean, default: !1 },
@@ -1299,39 +1674,39 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1299
1674
  modelValue: { default: () => ({}) },
1300
1675
  modelModifiers: {}
1301
1676
  }),
1302
- emits: /* @__PURE__ */ ie(["loaded"], ["update:modelValue"]),
1303
- setup(e, { expose: n, emit: t }) {
1304
- const a = e, u = t, s = be(e, "modelValue"), l = O(), o = B("webx-admin"), r = A(null), m = A(null);
1677
+ emits: /* @__PURE__ */ ee(["loaded"], ["update:modelValue"]),
1678
+ setup(e, { expose: t, emit: n }) {
1679
+ const a = e, i = n, s = de(e, "modelValue"), l = q(), r = V("webx-admin"), u = C(null), d = C(null);
1305
1680
  async function v() {
1306
- r.value = null, m.value = null;
1681
+ u.value = null, d.value = null;
1307
1682
  try {
1308
- const f = await l.loadScreen(a.name);
1309
- r.value = f, u("loaded", f);
1310
- } catch (f) {
1311
- m.value = f instanceof Error ? f.message : String(f);
1683
+ const m = await l.loadScreen(a.name);
1684
+ u.value = m, i("loaded", m);
1685
+ } catch (m) {
1686
+ d.value = m instanceof Error ? m.message : String(m);
1312
1687
  }
1313
1688
  }
1314
- return Y([() => a.name, () => l.i18n.state.locale], () => {
1689
+ return J([() => a.name, () => l.i18n.state.locale], () => {
1315
1690
  v();
1316
- }, { immediate: !0 }), n({ reload: v }), (f, d) => (h(), k("div", rn, [
1317
- m.value ? (h(), w(i(tt), {
1691
+ }, { immediate: !0 }), t({ reload: v }), (m, p) => (f(), $("div", Hn, [
1692
+ d.value ? (f(), S(o(Re), {
1318
1693
  key: 0,
1319
1694
  type: "danger",
1320
- title: i(o)("shell.error-title"),
1321
- description: m.value
1322
- }, null, 8, ["title", "description"])) : r.value === null ? (h(), w(i(xe), {
1695
+ title: o(r)("shell.error-title"),
1696
+ description: d.value
1697
+ }, null, 8, ["title", "description"])) : u.value === null ? (f(), S(o(Ue), {
1323
1698
  key: 1,
1324
1699
  rows: 4
1325
- })) : (h(), w(i(dt), {
1700
+ })) : (f(), S(o(Ct), {
1326
1701
  key: 2,
1327
1702
  modelValue: s.value,
1328
- "onUpdate:modelValue": d[0] || (d[0] = (p) => s.value = p),
1329
- root: r.value,
1330
- patch: i(l).screenPatch(e.name),
1331
- types: i(l).types,
1703
+ "onUpdate:modelValue": p[0] || (p[0] = (c) => s.value = c),
1704
+ root: u.value,
1705
+ patch: o(l).screenPatch(e.name),
1706
+ types: o(l).types,
1332
1707
  errors: e.errors,
1333
- translate: i(l).i18n.t,
1334
- can: i(l).can,
1708
+ translate: o(l).i18n.t,
1709
+ can: o(l).can,
1335
1710
  disabled: e.disabled,
1336
1711
  "label-position": e.labelPosition,
1337
1712
  "label-width": e.labelWidth,
@@ -1339,63 +1714,63 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1339
1714
  }, null, 8, ["modelValue", "root", "patch", "types", "errors", "translate", "can", "disabled", "label-position", "label-width", "size"]))
1340
1715
  ]));
1341
1716
  }
1342
- }), An = 76, un = {
1717
+ }), ha = 76, On = {
1343
1718
  class: "wx-save-state",
1344
1719
  role: "status",
1345
1720
  "aria-live": "polite"
1346
- }, dn = /* @__PURE__ */ R({
1721
+ }, jn = /* @__PURE__ */ E({
1347
1722
  __name: "SaveState",
1348
1723
  props: {
1349
1724
  state: {},
1350
1725
  linger: { default: 2e3 }
1351
1726
  },
1352
1727
  setup(e) {
1353
- const n = e, t = B("webx-admin"), a = A(!1);
1354
- let u = null;
1355
- Y(
1356
- () => n.state,
1357
- (l, o) => {
1358
- u !== null && clearTimeout(u), a.value = o === "saving" && l === "saved", a.value && (u = window.setTimeout(() => {
1359
- a.value = !1, u = null;
1360
- }, n.linger));
1728
+ const t = e, n = V("webx-admin"), a = C(!1);
1729
+ let i = null;
1730
+ J(
1731
+ () => t.state,
1732
+ (l, r) => {
1733
+ i !== null && clearTimeout(i), a.value = r === "saving" && l === "saved", a.value && (i = window.setTimeout(() => {
1734
+ a.value = !1, i = null;
1735
+ }, t.linger));
1361
1736
  }
1362
1737
  );
1363
1738
  const s = x(
1364
- () => n.state === "saving" ? "saving" : a.value ? "saved" : null
1739
+ () => t.state === "saving" ? "saving" : a.value ? "saved" : null
1365
1740
  );
1366
- return Be(() => {
1367
- u !== null && clearTimeout(u);
1368
- }), (l, o) => (h(), k("span", un, [
1369
- s.value ? (h(), w(i(ye), {
1741
+ return Qe(() => {
1742
+ i !== null && clearTimeout(i);
1743
+ }), (l, r) => (f(), $("span", On, [
1744
+ s.value ? (f(), S(o(ze), {
1370
1745
  key: 0,
1371
- class: H(["wx-save-state__mark", { "is-saved": s.value === "saved" }]),
1746
+ class: G(["wx-save-state__mark", { "is-saved": s.value === "saved" }]),
1372
1747
  name: s.value === "saving" ? "loader" : "check",
1373
1748
  spin: s.value === "saving",
1374
- label: i(t)(`editor.${s.value}`)
1749
+ label: o(n)(`editor.${s.value}`)
1375
1750
  }, null, 8, ["class", "name", "spin", "label"])) : z("", !0)
1376
1751
  ]));
1377
1752
  }
1378
- }), Rn = /* @__PURE__ */ N(dn, [["__scopeId", "data-v-216e5e44"]]), En = /* @__PURE__ */ R({
1753
+ }), pa = /* @__PURE__ */ F(jn, [["__scopeId", "data-v-216e5e44"]]), ba = /* @__PURE__ */ E({
1379
1754
  __name: "FilterChips",
1380
1755
  props: {
1381
1756
  filters: {}
1382
1757
  },
1383
1758
  setup(e) {
1384
- return (n, t) => (h(!0), k(I, null, P(e.filters, (a) => (h(), w(i(nt), {
1759
+ return (t, n) => (f(!0), $(D, null, K(e.filters, (a) => (f(), S(o(wt), {
1385
1760
  key: a.key,
1386
1761
  class: "wx-filter-chip",
1387
1762
  size: "sm",
1388
1763
  round: "",
1389
1764
  closable: "",
1390
- onClose: (u) => a.clear()
1765
+ onClose: (i) => a.clear()
1391
1766
  }, {
1392
1767
  default: g(() => [
1393
- W(C(a.label), 1)
1768
+ R(W(a.label), 1)
1394
1769
  ]),
1395
1770
  _: 2
1396
1771
  }, 1032, ["onClose"]))), 128));
1397
1772
  }
1398
- }), cn = { class: "wx-rename__footer" }, mn = /* @__PURE__ */ R({
1773
+ }), Kn = { class: "wx-rename__footer" }, qn = /* @__PURE__ */ E({
1399
1774
  __name: "RenameButton",
1400
1775
  props: {
1401
1776
  name: { default: "" },
@@ -1405,32 +1780,32 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1405
1780
  size: { default: "sm" }
1406
1781
  },
1407
1782
  emits: ["rename"],
1408
- setup(e, { emit: n }) {
1409
- const t = e, a = n, u = B("webx-admin"), s = A(!1), l = A(t.name), o = A(null), r = x(() => t.label ?? u("editor.rename"));
1410
- Y(s, async (v) => {
1411
- v && (l.value = t.name, await Ie(), o.value?.focus(), o.value?.select());
1783
+ setup(e, { emit: t }) {
1784
+ const n = e, a = t, i = V("webx-admin"), s = C(!1), l = C(n.name), r = C(null), u = x(() => n.label ?? i("editor.rename"));
1785
+ J(s, async (v) => {
1786
+ v && (l.value = n.name, await Ze(), r.value?.focus(), r.value?.select());
1412
1787
  });
1413
- function m() {
1788
+ function d() {
1414
1789
  const v = l.value.trim();
1415
- if (v === "" || v === t.name) {
1790
+ if (v === "" || v === n.name) {
1416
1791
  s.value = !1;
1417
1792
  return;
1418
1793
  }
1419
1794
  a("rename", v), s.value = !1;
1420
1795
  }
1421
- return (v, f) => (h(), w(i(at), {
1796
+ return (v, m) => (f(), S(o(xt), {
1422
1797
  open: s.value,
1423
- "onUpdate:open": f[2] || (f[2] = (d) => s.value = d),
1424
- title: r.value,
1798
+ "onUpdate:open": m[2] || (m[2] = (p) => s.value = p),
1799
+ title: u.value,
1425
1800
  width: 320,
1426
1801
  side: "bottom",
1427
1802
  align: "start",
1428
1803
  teleport: ""
1429
1804
  }, {
1430
1805
  trigger: g(() => [
1431
- _(i(K), {
1806
+ k(o(ne), {
1432
1807
  type: "edit",
1433
- title: r.value,
1808
+ title: u.value,
1434
1809
  size: e.size,
1435
1810
  disabled: e.disabled
1436
1811
  }, null, 8, ["title", "size", "disabled"])
@@ -1438,25 +1813,25 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1438
1813
  default: g(() => [
1439
1814
  M("form", {
1440
1815
  class: "wx-rename",
1441
- onSubmit: pe(m, ["prevent"])
1816
+ onSubmit: Le(d, ["prevent"])
1442
1817
  }, [
1443
- _(i(lt), {
1818
+ k(o(Ce), {
1444
1819
  ref_key: "field",
1445
- ref: o,
1820
+ ref: r,
1446
1821
  modelValue: l.value,
1447
- "onUpdate:modelValue": f[0] || (f[0] = (d) => l.value = d),
1448
- "aria-label": r.value,
1822
+ "onUpdate:modelValue": m[0] || (m[0] = (p) => l.value = p),
1823
+ "aria-label": u.value,
1449
1824
  placeholder: e.placeholder,
1450
- onKeydown: f[1] || (f[1] = Me((d) => s.value = !1, ["esc"]))
1825
+ onKeydown: m[1] || (m[1] = et((p) => s.value = !1, ["esc"]))
1451
1826
  }, null, 8, ["modelValue", "aria-label", "placeholder"]),
1452
- M("div", cn, [
1453
- _(i(j), {
1827
+ M("div", Kn, [
1828
+ k(o(Z), {
1454
1829
  type: "primary",
1455
1830
  size: "sm",
1456
1831
  "native-type": "submit"
1457
1832
  }, {
1458
1833
  default: g(() => [
1459
- W(C(i(u)("editor.save")), 1)
1834
+ R(W(o(i)("editor.save")), 1)
1460
1835
  ]),
1461
1836
  _: 1
1462
1837
  })
@@ -1466,7 +1841,7 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1466
1841
  _: 1
1467
1842
  }, 8, ["open", "title"]));
1468
1843
  }
1469
- }), Un = /* @__PURE__ */ N(mn, [["__scopeId", "data-v-d879e8d3"]]), fn = ["innerHTML"], vn = /* @__PURE__ */ R({
1844
+ }), ga = /* @__PURE__ */ F(qn, [["__scopeId", "data-v-d879e8d3"]]), Yn = ["innerHTML"], Xn = /* @__PURE__ */ E({
1470
1845
  __name: "HelpButton",
1471
1846
  props: {
1472
1847
  body: {},
@@ -1476,33 +1851,33 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1476
1851
  width: { default: 720 }
1477
1852
  },
1478
1853
  setup(e) {
1479
- const n = e, t = B("webx-admin"), a = A(!1), u = x(() => n.title ?? t("help.title")), s = x(() => Qt(n.body));
1480
- return (l, o) => (h(), k(I, null, [
1481
- _(i(K), {
1854
+ const t = e, n = V("webx-admin"), a = C(!1), i = x(() => t.title ?? n("help.title")), s = x(() => Bn(t.body));
1855
+ return (l, r) => (f(), $(D, null, [
1856
+ k(o(ne), {
1482
1857
  type: "details",
1483
1858
  icon: "question",
1484
1859
  tone: "neutral",
1485
1860
  size: e.size,
1486
- title: e.label ?? u.value,
1487
- onClick: o[0] || (o[0] = (r) => a.value = !0)
1861
+ title: e.label ?? i.value,
1862
+ onClick: r[0] || (r[0] = (u) => a.value = !0)
1488
1863
  }, null, 8, ["size", "title"]),
1489
- _(i(st), {
1864
+ k(o(kt), {
1490
1865
  open: a.value,
1491
- "onUpdate:open": o[1] || (o[1] = (r) => a.value = r),
1492
- title: u.value,
1866
+ "onUpdate:open": r[1] || (r[1] = (u) => a.value = u),
1867
+ title: i.value,
1493
1868
  width: e.width
1494
1869
  }, {
1495
1870
  default: g(() => [
1496
1871
  M("div", {
1497
1872
  class: "wx-help",
1498
1873
  innerHTML: s.value
1499
- }, null, 8, fn)
1874
+ }, null, 8, Yn)
1500
1875
  ]),
1501
1876
  _: 1
1502
1877
  }, 8, ["open", "title", "width"])
1503
1878
  ], 64));
1504
1879
  }
1505
- }), Bn = /* @__PURE__ */ N(vn, [["__scopeId", "data-v-6c280d42"]]), hn = /* @__PURE__ */ R({
1880
+ }), ya = /* @__PURE__ */ F(Xn, [["__scopeId", "data-v-6c280d42"]]), Me = /* @__PURE__ */ E({
1506
1881
  name: "WxDate",
1507
1882
  __name: "DateText",
1508
1883
  props: {
@@ -1512,46 +1887,46 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1512
1887
  tone: { default: "muted" }
1513
1888
  },
1514
1889
  setup(e) {
1515
- const n = e, t = en(), a = x(() => n.compact ? t.compact(n.value) : t.short(n.value)), u = x(() => t.exact(n.value)), s = x(() => t.iso(n.value));
1516
- return (l, o) => u.value ? (h(), w(i(ot), {
1890
+ const t = e, n = De(), a = x(() => t.compact ? n.compact(t.value) : n.short(t.value)), i = x(() => n.exact(t.value)), s = x(() => n.iso(t.value));
1891
+ return (l, r) => i.value ? (f(), S(o(_t), {
1517
1892
  key: 0,
1518
- content: u.value
1893
+ content: i.value
1519
1894
  }, {
1520
1895
  default: g(() => [
1521
- _(i(q), {
1896
+ k(o(H), {
1522
1897
  as: "time",
1523
1898
  datetime: s.value,
1524
1899
  size: e.size,
1525
1900
  tone: e.tone
1526
1901
  }, {
1527
1902
  default: g(() => [
1528
- W(C(a.value), 1)
1903
+ R(W(a.value), 1)
1529
1904
  ]),
1530
1905
  _: 1
1531
1906
  }, 8, ["datetime", "size", "tone"])
1532
1907
  ]),
1533
1908
  _: 1
1534
- }, 8, ["content"])) : (h(), w(i(q), {
1909
+ }, 8, ["content"])) : (f(), S(o(H), {
1535
1910
  key: 1,
1536
1911
  size: e.size,
1537
1912
  tone: e.tone
1538
1913
  }, {
1539
1914
  default: g(() => [
1540
- W(C(a.value), 1)
1915
+ R(W(a.value), 1)
1541
1916
  ]),
1542
1917
  _: 1
1543
1918
  }, 8, ["size", "tone"]));
1544
1919
  }
1545
- }), pn = { class: "wx-notes" }, gn = {
1920
+ }), Gn = { class: "wx-notes" }, Jn = {
1546
1921
  key: 3,
1547
1922
  class: "wx-notes__list"
1548
- }, bn = { class: "wx-note__body" }, wn = { class: "wx-note__head" }, yn = { class: "wx-note__buttons" }, xn = {
1923
+ }, Qn = { class: "wx-note__body" }, Zn = { class: "wx-note__head" }, ea = { class: "wx-note__buttons" }, ta = {
1549
1924
  key: 1,
1550
1925
  class: "wx-note__text"
1551
- }, kn = {
1926
+ }, na = {
1552
1927
  key: 4,
1553
1928
  class: "wx-notes__new"
1554
- }, _n = /* @__PURE__ */ R({
1929
+ }, aa = /* @__PURE__ */ E({
1555
1930
  name: "WxNotes",
1556
1931
  __name: "NotesFeed",
1557
1932
  props: {
@@ -1561,53 +1936,53 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1561
1936
  title: { default: void 0 }
1562
1937
  },
1563
1938
  emits: ["change"],
1564
- setup(e, { emit: n }) {
1565
- const t = e, a = n, u = O(), s = B("webx-admin"), l = an(), o = A([]), r = A(!0), m = A(""), v = A(!1), f = A(null), d = A(""), p = x(() => on(u, t.type, t.id)), b = x(() => t.title ?? s("notes.title"));
1566
- async function c() {
1567
- r.value = !0;
1939
+ setup(e, { emit: t }) {
1940
+ const n = e, a = t, i = q(), s = V("webx-admin"), l = Dn(), r = C([]), u = C(!0), d = C(""), v = C(!1), m = C(null), p = C(""), c = x(() => Fn(i, n.type, n.id)), _ = x(() => n.title ?? s("notes.title"));
1941
+ async function h() {
1942
+ u.value = !0;
1568
1943
  try {
1569
- o.value = await p.value.list();
1570
- } catch (S) {
1571
- F.danger(l(S));
1944
+ r.value = await c.value.list();
1945
+ } catch (T) {
1946
+ X.danger(l(T));
1572
1947
  } finally {
1573
- r.value = !1;
1948
+ u.value = !1;
1574
1949
  }
1575
1950
  }
1576
- Y(
1577
- () => [t.type, t.id],
1951
+ J(
1952
+ () => [n.type, n.id],
1578
1953
  () => {
1579
- f.value = null, m.value = "", c();
1954
+ m.value = null, d.value = "", h();
1580
1955
  },
1581
1956
  { immediate: !0 }
1582
1957
  );
1583
- async function y() {
1584
- const S = m.value.trim();
1585
- if (!(S === "" || v.value)) {
1958
+ async function b() {
1959
+ const T = d.value.trim();
1960
+ if (!(T === "" || v.value)) {
1586
1961
  v.value = !0;
1587
1962
  try {
1588
- o.value = [...o.value, await p.value.add(S)], m.value = "", a("change");
1589
- } catch (E) {
1590
- F.danger(l(E));
1963
+ r.value = [...r.value, await c.value.add(T)], d.value = "", a("change");
1964
+ } catch (B) {
1965
+ X.danger(l(B));
1591
1966
  } finally {
1592
1967
  v.value = !1;
1593
1968
  }
1594
1969
  }
1595
1970
  }
1596
- function $(S) {
1597
- f.value = S.id, d.value = S.body;
1971
+ function w(T) {
1972
+ m.value = T.id, p.value = T.body;
1598
1973
  }
1599
- async function X(S) {
1600
- const E = d.value.trim();
1601
- if (E !== "")
1974
+ async function O(T) {
1975
+ const B = p.value.trim();
1976
+ if (B !== "")
1602
1977
  try {
1603
- const T = await p.value.save(S.id, E);
1604
- o.value = o.value.map((D) => D.id === T.id ? T : D), f.value = null, F.success(s("notes.saved")), a("change");
1605
- } catch (T) {
1606
- F.danger(l(T));
1978
+ const L = await c.value.save(T.id, B);
1979
+ r.value = r.value.map((P) => P.id === L.id ? L : P), m.value = null, X.success(s("notes.saved")), a("change");
1980
+ } catch (L) {
1981
+ X.danger(l(L));
1607
1982
  }
1608
1983
  }
1609
- async function ae(S) {
1610
- if (await ut({
1984
+ async function Q(T) {
1985
+ if (await Tt({
1611
1986
  title: s("notes.delete-title"),
1612
1987
  message: s("notes.delete-text"),
1613
1988
  confirmText: s("notes.delete"),
@@ -1615,168 +1990,235 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1615
1990
  tone: "danger"
1616
1991
  }))
1617
1992
  try {
1618
- await p.value.remove(S.id), o.value = o.value.filter((T) => T.id !== S.id), F.success(s("notes.deleted")), a("change");
1619
- } catch (T) {
1620
- F.danger(l(T));
1993
+ await c.value.remove(T.id), r.value = r.value.filter((L) => L.id !== T.id), X.success(s("notes.deleted")), a("change");
1994
+ } catch (L) {
1995
+ X.danger(l(L));
1621
1996
  }
1622
1997
  }
1623
- function le(S) {
1624
- return !t.can || !S.is_mine ? [] : [
1625
- { key: "edit", icon: "edit", label: s("notes.edit"), run: () => $(S) },
1998
+ function Y(T) {
1999
+ return !n.can || !T.is_mine ? [] : [
2000
+ { key: "edit", icon: "edit", label: s("notes.edit"), run: () => w(T) },
1626
2001
  {
1627
2002
  key: "delete",
1628
2003
  icon: "trash",
1629
2004
  label: s("notes.delete"),
1630
2005
  danger: !0,
1631
2006
  run: () => {
1632
- ae(S);
2007
+ Q(T);
1633
2008
  }
1634
2009
  }
1635
2010
  ];
1636
2011
  }
1637
- function V(S) {
1638
- return S.author?.name ?? s("notes.unknown-author");
2012
+ function j(T) {
2013
+ return T.author?.name ?? s("notes.unknown-author");
1639
2014
  }
1640
- return (S, E) => (h(), k("section", pn, [
1641
- b.value ? (h(), w(i(q), {
2015
+ return (T, B) => (f(), $("section", Gn, [
2016
+ _.value ? (f(), S(o(H), {
1642
2017
  key: 0,
1643
2018
  weight: "medium",
1644
2019
  class: "wx-notes__title"
1645
2020
  }, {
1646
2021
  default: g(() => [
1647
- W(C(b.value), 1)
2022
+ R(W(_.value), 1)
1648
2023
  ]),
1649
2024
  _: 1
1650
2025
  })) : z("", !0),
1651
- r.value ? (h(), w(i(xe), {
2026
+ u.value ? (f(), S(o(Ue), {
1652
2027
  key: 1,
1653
2028
  rows: 2
1654
- })) : o.value.length === 0 ? (h(), w(i(it), {
2029
+ })) : r.value.length === 0 ? (f(), S(o($t), {
1655
2030
  key: 2,
1656
2031
  size: "sm",
1657
- description: i(s)("notes.empty")
1658
- }, null, 8, ["description"])) : (h(), k("ul", gn, [
1659
- (h(!0), k(I, null, P(o.value, (T) => (h(), k("li", {
1660
- key: T.id,
2032
+ description: o(s)("notes.empty")
2033
+ }, null, 8, ["description"])) : (f(), $("ul", Jn, [
2034
+ (f(!0), $(D, null, K(r.value, (L) => (f(), $("li", {
2035
+ key: L.id,
1661
2036
  class: "wx-note"
1662
2037
  }, [
1663
- _(i(rt), {
1664
- name: V(T),
2038
+ k(o(St), {
2039
+ name: j(L),
1665
2040
  size: "sm",
1666
2041
  tone: "auto"
1667
2042
  }, null, 8, ["name"]),
1668
- M("div", bn, [
1669
- M("div", wn, [
1670
- _(i(q), {
2043
+ M("div", Qn, [
2044
+ M("div", Zn, [
2045
+ k(o(H), {
1671
2046
  size: "sm",
1672
2047
  weight: "medium",
1673
2048
  truncate: ""
1674
2049
  }, {
1675
2050
  default: g(() => [
1676
- W(C(V(T)), 1)
2051
+ R(W(j(L)), 1)
1677
2052
  ]),
1678
2053
  _: 2
1679
2054
  }, 1024),
1680
- _(hn, {
1681
- value: T.created_at
2055
+ k(Me, {
2056
+ value: L.created_at
1682
2057
  }, null, 8, ["value"]),
1683
- _(ke, {
1684
- actions: le(T),
1685
- label: V(T)
2058
+ k(Ee, {
2059
+ actions: Y(L),
2060
+ label: j(L)
1686
2061
  }, null, 8, ["actions", "label"])
1687
2062
  ]),
1688
- f.value === T.id ? (h(), k(I, { key: 0 }, [
1689
- _(i(fe), {
1690
- modelValue: d.value,
1691
- "onUpdate:modelValue": E[0] || (E[0] = (D) => d.value = D),
2063
+ m.value === L.id ? (f(), $(D, { key: 0 }, [
2064
+ k(o(ke), {
2065
+ modelValue: p.value,
2066
+ "onUpdate:modelValue": B[0] || (B[0] = (P) => p.value = P),
1692
2067
  autosize: { minRows: 2, maxRows: 10 }
1693
2068
  }, null, 8, ["modelValue"]),
1694
- M("div", yn, [
1695
- _(i(j), {
2069
+ M("div", ea, [
2070
+ k(o(Z), {
1696
2071
  size: "sm",
1697
2072
  type: "primary",
1698
- onClick: (D) => X(T)
2073
+ onClick: (P) => O(L)
1699
2074
  }, {
1700
2075
  default: g(() => [
1701
- W(C(i(s)("notes.save")), 1)
2076
+ R(W(o(s)("notes.save")), 1)
1702
2077
  ]),
1703
2078
  _: 1
1704
2079
  }, 8, ["onClick"]),
1705
- _(i(j), {
2080
+ k(o(Z), {
1706
2081
  size: "sm",
1707
2082
  variant: "text",
1708
- onClick: E[1] || (E[1] = (D) => f.value = null)
2083
+ onClick: B[1] || (B[1] = (P) => m.value = null)
1709
2084
  }, {
1710
2085
  default: g(() => [
1711
- W(C(i(s)("notes.cancel")), 1)
2086
+ R(W(o(s)("notes.cancel")), 1)
1712
2087
  ]),
1713
2088
  _: 1
1714
2089
  })
1715
2090
  ])
1716
- ], 64)) : (h(), k("p", xn, C(T.body), 1))
2091
+ ], 64)) : (f(), $("p", ta, W(L.body), 1))
1717
2092
  ])
1718
2093
  ]))), 128))
1719
2094
  ])),
1720
- e.can ? (h(), k("div", kn, [
1721
- _(i(fe), {
1722
- modelValue: m.value,
1723
- "onUpdate:modelValue": E[2] || (E[2] = (T) => m.value = T),
1724
- placeholder: i(s)("notes.placeholder"),
2095
+ e.can ? (f(), $("div", na, [
2096
+ k(o(ke), {
2097
+ modelValue: d.value,
2098
+ "onUpdate:modelValue": B[2] || (B[2] = (L) => d.value = L),
2099
+ placeholder: o(s)("notes.placeholder"),
1725
2100
  autosize: { minRows: 2, maxRows: 8 }
1726
2101
  }, null, 8, ["modelValue", "placeholder"]),
1727
- _(i(j), {
2102
+ k(o(Z), {
1728
2103
  size: "sm",
1729
2104
  type: "primary",
1730
- disabled: m.value.trim() === "",
2105
+ disabled: d.value.trim() === "",
1731
2106
  loading: v.value,
1732
- onClick: y
2107
+ onClick: b
1733
2108
  }, {
1734
2109
  default: g(() => [
1735
- W(C(i(s)("notes.add")), 1)
2110
+ R(W(o(s)("notes.add")), 1)
1736
2111
  ]),
1737
2112
  _: 1
1738
2113
  }, 8, ["disabled", "loading"])
1739
2114
  ])) : z("", !0)
1740
2115
  ]));
1741
2116
  }
1742
- }), In = /* @__PURE__ */ N(_n, [["__scopeId", "data-v-71004c1a"]]);
2117
+ }), wa = /* @__PURE__ */ F(aa, [["__scopeId", "data-v-71004c1a"]]), la = {
2118
+ key: 1,
2119
+ class: "wx-backup-note"
2120
+ }, sa = 48, oa = /* @__PURE__ */ E({
2121
+ name: "WxBackupNote",
2122
+ __name: "BackupNote",
2123
+ setup(e) {
2124
+ const t = q(), n = De(), a = V("webx-admin"), i = x(() => t.state.manifest?.backup ?? null), s = x(() => i.value !== null && t.can("settings.view")), l = x(() => {
2125
+ const d = i.value?.at;
2126
+ if (d == null) return !0;
2127
+ const v = new Date(d).getTime();
2128
+ return Number.isNaN(v) || Date.now() - v > sa * 36e5;
2129
+ }), r = x(() => {
2130
+ const d = i.value?.bytes;
2131
+ if (d == null) return "";
2132
+ const v = ["byte", "kilobyte", "megabyte", "gigabyte", "terabyte"];
2133
+ let m = d, p = 0;
2134
+ for (; m >= 1024 && p < v.length - 1; )
2135
+ m /= 1024, p++;
2136
+ return new Intl.NumberFormat(t.i18n.state.locale, {
2137
+ style: "unit",
2138
+ unit: v[p],
2139
+ unitDisplay: "short",
2140
+ maximumFractionDigits: m >= 10 || p === 0 ? 0 : 1
2141
+ }).format(m);
2142
+ }), u = x(
2143
+ () => i.value?.at == null ? a("backup.never") : a("backup.stale", { date: n.short(i.value.at) })
2144
+ );
2145
+ return (d, v) => s.value && l.value ? (f(), S(o(Re), {
2146
+ key: 0,
2147
+ type: "warning",
2148
+ variant: "soft",
2149
+ description: u.value
2150
+ }, null, 8, ["description"])) : s.value ? (f(), $("p", la, [
2151
+ k(o(H), {
2152
+ size: "sm",
2153
+ tone: "muted"
2154
+ }, {
2155
+ default: g(() => [
2156
+ R(W(o(a)("backup.title")), 1)
2157
+ ]),
2158
+ _: 1
2159
+ }),
2160
+ k(Me, {
2161
+ value: i.value?.at
2162
+ }, null, 8, ["value"]),
2163
+ r.value ? (f(), S(o(H), {
2164
+ key: 0,
2165
+ size: "sm",
2166
+ tone: "muted"
2167
+ }, {
2168
+ default: g(() => [
2169
+ R("· " + W(r.value), 1)
2170
+ ]),
2171
+ _: 1
2172
+ })) : z("", !0)
2173
+ ])) : z("", !0);
2174
+ }
2175
+ }), xa = /* @__PURE__ */ F(oa, [["__scopeId", "data-v-beeee67e"]]);
1743
2176
  export {
1744
- Wt as AdminLanding,
1745
- At as AdminNav,
1746
- Vt as AdminShell,
1747
- re as HttpError,
1748
- ft as WxBackButton,
1749
- hn as WxDate,
1750
- En as WxFilterChips,
1751
- Bn as WxHelpButton,
1752
- $t as WxListScreen,
1753
- In as WxNotes,
1754
- Un as WxRenameButton,
1755
- St as WxRichTextField,
1756
- ke as WxRowMenu,
1757
- Rn as WxSaveState,
1758
- Wn as WxScreen,
1759
- xt as WxScreenHead,
1760
- _e as adminKey,
1761
- $e as adminMessages,
1762
- Tt as adminTypes,
1763
- zn as createAdmin,
1764
- Ct as createAdminContext,
1765
- Zt as createDates,
1766
- Ht as createHttp,
1767
- de as createI18n,
1768
- on as createNotesApi,
1769
- nn as errorText,
1770
- ne as i18nKey,
1771
- Lt as provideAdmin,
1772
- ct as provideI18n,
1773
- ve as readCookie,
1774
- Qt as renderMarkdown,
1775
- An as rowMenuWidth,
1776
- O as useAdmin,
1777
- en as useDates,
1778
- an as useErrorText,
1779
- Ln as useI18n,
1780
- B as useTranslate
2177
+ un as AdminLanding,
2178
+ dn as AdminNav,
2179
+ wn as AdminShell,
2180
+ pe as HttpError,
2181
+ jt as WxBackButton,
2182
+ xa as WxBackupNote,
2183
+ Me as WxDate,
2184
+ ba as WxFilterChips,
2185
+ ya as WxHelpButton,
2186
+ Ot as WxLinkField,
2187
+ Ht as WxLinkPicker,
2188
+ nn as WxListScreen,
2189
+ wa as WxNotes,
2190
+ ga as WxRenameButton,
2191
+ an as WxRichTextField,
2192
+ Ee as WxRowMenu,
2193
+ pa as WxSaveState,
2194
+ va as WxScreen,
2195
+ Zt as WxScreenHead,
2196
+ Be as adminKey,
2197
+ Ve as adminMessages,
2198
+ ln as adminTypes,
2199
+ fa as createAdmin,
2200
+ sn as createAdminContext,
2201
+ Nn as createDates,
2202
+ kn as createHttp,
2203
+ ge as createI18n,
2204
+ Bt as createLinksApi,
2205
+ Fn as createNotesApi,
2206
+ Ln as createTheme,
2207
+ Et as emptyLink,
2208
+ In as errorText,
2209
+ ce as i18nKey,
2210
+ on as provideAdmin,
2211
+ Rt as provideI18n,
2212
+ Tn as provideTheme,
2213
+ _e as readCookie,
2214
+ Bn as renderMarkdown,
2215
+ ha as rowMenuWidth,
2216
+ Ne as themeKey,
2217
+ q as useAdmin,
2218
+ De as useDates,
2219
+ Dn as useErrorText,
2220
+ zt as useI18n,
2221
+ ma as useTheme,
2222
+ V as useTranslate
1781
2223
  };
1782
2224
  //# sourceMappingURL=index.js.map