@webx-ui/module-media 0.3.0 → 0.4.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,7 +1,7 @@
1
- import { defineComponent as E, useModel as A, ref as M, watch as q, openBlock as b, createBlock as k, unref as e, mergeModels as F, computed as W, resolveDirective as Pe, withCtx as w, createElementBlock as z, Fragment as Q, renderList as Z, withDirectives as Oe, createCommentVNode as L, createVNode as h, createTextVNode as S, toDisplayString as D, isRef as te, useTemplateRef as ee, onMounted as he, nextTick as qe, createElementVNode as $, withKeys as Ne, normalizeClass as Ae, normalizeStyle as me } from "vue";
2
- import { WxTree as He, WxSelectionArea as Xe, WxFileCard as Ie, WxEmpty as Ke, toast as N, WxAction as T, WxInput as j, WxDropdown as pe, WxDropdownItem as fe, WxActions as G, useModal as ae, WxDialog as le, WxSelect as je, WxSpace as be, WxButton as X, useElementWidth as Ge, createModal as Y, WxPagination as Ye, WxDrawer as Je, confirm as ve, openImageEditor as Qe, WxCard as Ze, WxImage as et, WxPopover as tt, WxPopconfirm as at } from "@webx-ui/core";
1
+ import { defineComponent as S, useModel as A, ref as M, watch as q, openBlock as b, createBlock as $, unref as e, mergeModels as F, computed as D, resolveDirective as Pe, withCtx as w, createElementBlock as W, Fragment as Q, renderList as Z, withDirectives as Oe, createCommentVNode as U, createVNode as h, createTextVNode as P, toDisplayString as L, isRef as te, useTemplateRef as ee, onMounted as he, nextTick as qe, createElementVNode as _, withKeys as Ne, normalizeClass as Ae, normalizeStyle as me } from "vue";
2
+ import { WxTree as He, WxSelectionArea as Ie, WxFileCard as Xe, WxEmpty as Ke, toast as N, WxAction as T, WxInput as j, WxDropdown as pe, WxDropdownItem as fe, WxActions as G, useModal as ae, WxDialog as le, WxSelect as je, WxSpace as be, WxButton as I, useElementWidth as Ge, createModal as Y, WxPagination as Ye, WxDrawer as Je, confirm as ve, openImageEditor as Qe, WxCard as Ze, WxImage as et, WxPopover as tt, WxPopconfirm as at } from "@webx-ui/core";
3
3
  import { useTranslate as B, useAdmin as ie } from "@webx-ui/admin";
4
- const ge = /* @__PURE__ */ E({
4
+ const ge = /* @__PURE__ */ S({
5
5
  __name: "DirectoryTree",
6
6
  props: /* @__PURE__ */ F({
7
7
  directories: {}
@@ -10,36 +10,36 @@ const ge = /* @__PURE__ */ E({
10
10
  selectedModifiers: {}
11
11
  }),
12
12
  emits: /* @__PURE__ */ F(["move"], ["update:selected"]),
13
- setup(a, { emit: c }) {
14
- const m = a, l = A(a, "selected"), f = c, o = B("webx-media"), t = M([]), p = M([]);
13
+ setup(a, { emit: d }) {
14
+ const m = a, l = A(a, "selected"), v = d, i = B("webx-media"), t = M([]), p = M([]);
15
15
  q(
16
16
  () => m.directories,
17
- (r) => {
18
- t.value = r.map(x), p.value = g(r);
17
+ (n) => {
18
+ t.value = n.map(k), p.value = g(n);
19
19
  },
20
20
  { immediate: !0, deep: !0 }
21
21
  );
22
- function x(r) {
22
+ function k(n) {
23
23
  return {
24
- ...r,
25
- label: r.is_root ? o("manager.root") : r.title,
26
- children: (r.children ?? []).map(x)
24
+ ...n,
25
+ label: n.is_root ? i("manager.root") : n.title,
26
+ children: (n.children ?? []).map(k)
27
27
  };
28
28
  }
29
- function g(r) {
30
- return r.flatMap((v) => [v.id, ...g(v.children ?? [])]);
29
+ function g(n) {
30
+ return n.flatMap((f) => [f.id, ...g(f.children ?? [])]);
31
31
  }
32
- function u(r) {
33
- const v = r.zone === "inside" ? r.target : r.parent;
34
- v && f("move", r.node.id, v.id);
32
+ function u(n) {
33
+ const f = n.zone === "inside" ? n.target : n.parent;
34
+ f && v("move", n.node.id, f.id);
35
35
  }
36
- return (r, v) => (b(), k(e(He), {
36
+ return (n, f) => (b(), $(e(He), {
37
37
  selected: l.value,
38
- "onUpdate:selected": v[0] || (v[0] = (i) => l.value = i),
38
+ "onUpdate:selected": f[0] || (f[0] = (c) => l.value = c),
39
39
  expanded: p.value,
40
- "onUpdate:expanded": v[1] || (v[1] = (i) => p.value = i),
40
+ "onUpdate:expanded": f[1] || (f[1] = (c) => p.value = c),
41
41
  modelValue: t.value,
42
- "onUpdate:modelValue": v[2] || (v[2] = (i) => t.value = i),
42
+ "onUpdate:modelValue": f[2] || (f[2] = (c) => t.value = c),
43
43
  class: "wx-media-tree",
44
44
  "node-key": "id",
45
45
  draggable: "",
@@ -47,7 +47,7 @@ const ge = /* @__PURE__ */ E({
47
47
  onDrop: u
48
48
  }, null, 8, ["selected", "expanded", "modelValue"]));
49
49
  }
50
- }), lt = /* @__PURE__ */ E({
50
+ }), lt = /* @__PURE__ */ S({
51
51
  __name: "FileGrid",
52
52
  props: /* @__PURE__ */ F({
53
53
  files: {},
@@ -59,76 +59,76 @@ const ge = /* @__PURE__ */ E({
59
59
  selectedModifiers: {}
60
60
  }),
61
61
  emits: /* @__PURE__ */ F(["open", "rename", "edit", "remove"], ["update:selected"]),
62
- setup(a, { emit: c }) {
63
- const m = a, l = A(a, "selected"), f = c, o = B("webx-media"), t = W(
64
- () => m.query ? o("manager.empty-search", { query: m.query }) : o("manager.empty")
62
+ setup(a, { emit: d }) {
63
+ const m = a, l = A(a, "selected"), v = d, i = B("webx-media"), t = D(
64
+ () => m.query ? i("manager.empty-search", { query: m.query }) : i("manager.empty")
65
65
  );
66
66
  function p() {
67
- N.success(o("manager.link-copied"));
67
+ N.success(i("manager.link-copied"));
68
68
  }
69
- function x(g) {
69
+ function k(g) {
70
70
  const u = document.createElement("textarea");
71
71
  u.value = g.url, u.setAttribute("readonly", ""), u.style.position = "fixed", u.style.opacity = "0", document.body.appendChild(u), u.select();
72
- let r = !1;
72
+ let n = !1;
73
73
  try {
74
- r = document.execCommand("copy");
74
+ n = document.execCommand("copy");
75
75
  } catch {
76
- r = !1;
76
+ n = !1;
77
77
  }
78
- if (u.remove(), r) {
78
+ if (u.remove(), n) {
79
79
  p();
80
80
  return;
81
81
  }
82
- N.danger(`${o("errors.copy")} ${g.url}`, { duration: 0 });
82
+ N.danger(`${i("errors.copy")} ${g.url}`, { duration: 0 });
83
83
  }
84
84
  return (g, u) => {
85
- const r = Pe("wx-select");
86
- return a.files.length > 0 ? (b(), k(e(Xe), {
85
+ const n = Pe("wx-select");
86
+ return a.files.length > 0 ? (b(), $(e(Ie), {
87
87
  key: 0,
88
88
  modelValue: l.value,
89
- "onUpdate:modelValue": u[0] || (u[0] = (v) => l.value = v),
89
+ "onUpdate:modelValue": u[0] || (u[0] = (f) => l.value = f),
90
90
  class: "wx-media-grid",
91
91
  multiple: !a.single
92
92
  }, {
93
- default: w(({ isSelected: v }) => [
94
- (b(!0), z(Q, null, Z(a.files, (i) => Oe((b(), k(e(Ie), {
95
- key: i.id,
93
+ default: w(({ isSelected: f }) => [
94
+ (b(!0), W(Q, null, Z(a.files, (c) => Oe((b(), $(e(Xe), {
95
+ key: c.id,
96
96
  class: "wx-media-grid__card",
97
- name: i.name,
98
- url: i.url,
99
- thumbnail: a.api.thumb(i, 320, 320) ?? void 0,
100
- type: i.mime,
101
- selected: v(i.id),
97
+ name: c.name,
98
+ url: c.url,
99
+ thumbnail: a.api.thumb(c, 320, 320) ?? void 0,
100
+ type: c.mime,
101
+ selected: f(c.id),
102
102
  renamable: "",
103
- editable: i.editable,
103
+ editable: c.editable,
104
104
  removable: "",
105
105
  copyable: "",
106
- "rename-label": e(o)("manager.rename"),
107
- "edit-label": e(o)("manager.edit"),
108
- "remove-label": e(o)("manager.delete"),
109
- "remove-confirm-text": e(o)("dialogs.delete-file", { name: i.name }),
110
- "cancel-label": e(o)("manager.cancel"),
111
- "save-label": e(o)("manager.save"),
112
- "copy-label": e(o)("manager.copy-link"),
113
- "copied-label": e(o)("manager.link-copied"),
114
- onRename: (d) => f("rename", i, d),
115
- onEdit: (d) => f("edit", i),
116
- onRemove: (d) => f("remove", i),
106
+ "rename-label": e(i)("manager.rename"),
107
+ "edit-label": e(i)("manager.edit"),
108
+ "remove-label": e(i)("manager.delete"),
109
+ "remove-confirm-text": e(i)("dialogs.delete-file", { name: c.name }),
110
+ "cancel-label": e(i)("manager.cancel"),
111
+ "save-label": e(i)("manager.save"),
112
+ "copy-label": e(i)("manager.copy-link"),
113
+ "copied-label": e(i)("manager.link-copied"),
114
+ onRename: (s) => v("rename", c, s),
115
+ onEdit: (s) => v("edit", c),
116
+ onRemove: (s) => v("remove", c),
117
117
  onCopy: p,
118
- onCopyError: (d) => x(i),
119
- onDblclick: (d) => f("open", i)
118
+ onCopyError: (s) => k(c),
119
+ onDblclick: (s) => v("open", c)
120
120
  }, null, 8, ["name", "url", "thumbnail", "type", "selected", "editable", "rename-label", "edit-label", "remove-label", "remove-confirm-text", "cancel-label", "save-label", "copy-label", "copied-label", "onRename", "onEdit", "onRemove", "onCopyError", "onDblclick"])), [
121
- [r, i.id]
121
+ [n, c.id]
122
122
  ])), 128))
123
123
  ]),
124
124
  _: 1
125
- }, 8, ["modelValue", "multiple"])) : (b(), k(e(Ke), {
125
+ }, 8, ["modelValue", "multiple"])) : (b(), $(e(Ke), {
126
126
  key: 1,
127
127
  description: t.value
128
128
  }, null, 8, ["description"]));
129
129
  };
130
130
  }
131
- }), it = { class: "wx-media-toolbar" }, ot = /* @__PURE__ */ E({
131
+ }), it = { class: "wx-media-toolbar" }, ot = /* @__PURE__ */ S({
132
132
  __name: "MediaToolbar",
133
133
  props: /* @__PURE__ */ F({
134
134
  canUpload: { type: Boolean },
@@ -145,36 +145,36 @@ const ge = /* @__PURE__ */ E({
145
145
  sortModifiers: {}
146
146
  }),
147
147
  emits: /* @__PURE__ */ F(["upload", "move", "remove", "folders"], ["update:search", "update:type", "update:sort"]),
148
- setup(a, { emit: c }) {
149
- const m = a, l = A(a, "search"), f = A(a, "type"), o = A(a, "sort"), t = c, p = B("webx-media"), x = W(() => [
148
+ setup(a, { emit: d }) {
149
+ const m = a, l = A(a, "search"), v = A(a, "type"), i = A(a, "sort"), t = d, p = B("webx-media"), k = D(() => [
150
150
  { value: "all", label: p("manager.all-types") },
151
- ...["image", "video", "audio", "document", "other"].map((v) => ({
152
- value: v,
153
- label: p(`manager.${v}`)
151
+ ...["image", "video", "audio", "document", "other"].map((f) => ({
152
+ value: f,
153
+ label: p(`manager.${f}`)
154
154
  }))
155
- ]), g = W(() => [
155
+ ]), g = D(() => [
156
156
  { value: "-created_at", label: p("manager.sort-newest") },
157
157
  { value: "created_at", label: p("manager.sort-oldest") },
158
158
  { value: "name", label: p("manager.sort-name") },
159
159
  { value: "-size", label: p("manager.sort-size") }
160
- ]), u = W(() => x.value.find((v) => v.value === f.value)?.label ?? ""), r = W(() => g.value.find((v) => v.value === o.value)?.label ?? "");
161
- return (v, i) => (b(), z("header", it, [
162
- a.compact ? (b(), k(e(T), {
160
+ ]), u = D(() => k.value.find((f) => f.value === v.value)?.label ?? ""), n = D(() => g.value.find((f) => f.value === i.value)?.label ?? "");
161
+ return (f, c) => (b(), W("header", it, [
162
+ a.compact ? (b(), $(e(T), {
163
163
  key: 0,
164
164
  icon: "folder",
165
165
  title: e(p)("manager.folders"),
166
166
  size: "sm",
167
- onClick: i[0] || (i[0] = (d) => t("folders"))
168
- }, null, 8, ["title"])) : L("", !0),
167
+ onClick: c[0] || (c[0] = (s) => t("folders"))
168
+ }, null, 8, ["title"])) : U("", !0),
169
169
  h(e(j), {
170
170
  modelValue: l.value,
171
- "onUpdate:modelValue": i[1] || (i[1] = (d) => l.value = d),
171
+ "onUpdate:modelValue": c[1] || (c[1] = (s) => l.value = s),
172
172
  class: "wx-media-toolbar__search",
173
173
  placeholder: e(p)("manager.search"),
174
174
  clearable: "",
175
175
  size: "sm"
176
176
  }, null, 8, ["modelValue", "placeholder"]),
177
- a.fixedType ? L("", !0) : (b(), k(e(pe), { key: 1 }, {
177
+ a.fixedType ? U("", !0) : (b(), $(e(pe), { key: 1 }, {
178
178
  trigger: w(() => [
179
179
  h(e(T), {
180
180
  icon: "filter",
@@ -183,13 +183,13 @@ const ge = /* @__PURE__ */ E({
183
183
  }, null, 8, ["title"])
184
184
  ]),
185
185
  default: w(() => [
186
- (b(!0), z(Q, null, Z(x.value, (d) => (b(), k(e(fe), {
187
- key: String(d.value),
188
- active: d.value === f.value,
189
- onClick: (_) => f.value = d.value
186
+ (b(!0), W(Q, null, Z(k.value, (s) => (b(), $(e(fe), {
187
+ key: String(s.value),
188
+ active: s.value === v.value,
189
+ onClick: (x) => v.value = s.value
190
190
  }, {
191
191
  default: w(() => [
192
- S(D(d.label), 1)
192
+ P(L(s.label), 1)
193
193
  ]),
194
194
  _: 2
195
195
  }, 1032, ["active", "onClick"]))), 128))
@@ -200,32 +200,32 @@ const ge = /* @__PURE__ */ E({
200
200
  trigger: w(() => [
201
201
  h(e(T), {
202
202
  icon: "arrow-down",
203
- title: r.value,
203
+ title: n.value,
204
204
  size: "sm"
205
205
  }, null, 8, ["title"])
206
206
  ]),
207
207
  default: w(() => [
208
- (b(!0), z(Q, null, Z(g.value, (d) => (b(), k(e(fe), {
209
- key: d.value,
210
- active: d.value === o.value,
211
- onClick: (_) => o.value = d.value
208
+ (b(!0), W(Q, null, Z(g.value, (s) => (b(), $(e(fe), {
209
+ key: s.value,
210
+ active: s.value === i.value,
211
+ onClick: (x) => i.value = s.value
212
212
  }, {
213
213
  default: w(() => [
214
- S(D(d.label), 1)
214
+ P(L(s.label), 1)
215
215
  ]),
216
216
  _: 2
217
217
  }, 1032, ["active", "onClick"]))), 128))
218
218
  ]),
219
219
  _: 1
220
220
  }),
221
- a.canUpload ? (b(), k(e(T), {
221
+ a.canUpload ? (b(), $(e(T), {
222
222
  key: 2,
223
223
  type: "upload",
224
224
  title: e(p)("manager.upload"),
225
225
  size: "sm",
226
- onClick: i[2] || (i[2] = (d) => t("upload"))
227
- }, null, 8, ["title"])) : L("", !0),
228
- a.canManage ? (b(), k(e(G), {
226
+ onClick: c[2] || (c[2] = (s) => t("upload"))
227
+ }, null, 8, ["title"])) : U("", !0),
228
+ a.canManage ? (b(), $(e(G), {
229
229
  key: 3,
230
230
  size: "sm"
231
231
  }, {
@@ -234,20 +234,20 @@ const ge = /* @__PURE__ */ E({
234
234
  icon: "folder",
235
235
  title: e(p)("manager.move"),
236
236
  disabled: m.selected === 0,
237
- onClick: i[3] || (i[3] = (d) => t("move"))
237
+ onClick: c[3] || (c[3] = (s) => t("move"))
238
238
  }, null, 8, ["title", "disabled"]),
239
239
  h(e(T), {
240
240
  type: "remove",
241
241
  title: e(p)("manager.delete"),
242
242
  disabled: m.selected === 0,
243
- onClick: i[4] || (i[4] = (d) => t("remove"))
243
+ onClick: c[4] || (c[4] = (s) => t("remove"))
244
244
  }, null, 8, ["title", "disabled"])
245
245
  ]),
246
246
  _: 1
247
- })) : L("", !0)
247
+ })) : U("", !0)
248
248
  ]));
249
249
  }
250
- }), nt = /* @__PURE__ */ E({
250
+ }), nt = /* @__PURE__ */ S({
251
251
  __name: "MoveDialog",
252
252
  props: {
253
253
  directories: {},
@@ -255,44 +255,44 @@ const ge = /* @__PURE__ */ E({
255
255
  count: {}
256
256
  },
257
257
  setup(a) {
258
- const c = a, { open: m, resolve: l, dismiss: f } = ae(), o = B("webx-media"), t = W(
259
- () => x(c.directories).filter((g) => g.value !== c.from)
258
+ const d = a, { open: m, resolve: l, dismiss: v } = ae(), i = B("webx-media"), t = D(
259
+ () => k(d.directories).filter((g) => g.value !== d.from)
260
260
  ), p = M(t.value[0]?.value ?? null);
261
- function x(g) {
261
+ function k(g) {
262
262
  return g.flatMap((u) => [
263
263
  {
264
264
  value: u.id,
265
265
  // Indented, so the tree is still readable once it is a flat list.
266
- label: " ".repeat(u.depth * 3) + (u.is_root ? o("manager.root") : u.title)
266
+ label: " ".repeat(u.depth * 3) + (u.is_root ? i("manager.root") : u.title)
267
267
  },
268
- ...x(u.children ?? [])
268
+ ...k(u.children ?? [])
269
269
  ]);
270
270
  }
271
- return (g, u) => (b(), k(e(le), {
271
+ return (g, u) => (b(), $(e(le), {
272
272
  open: e(m),
273
- "onUpdate:open": u[3] || (u[3] = (r) => te(m) ? m.value = r : null),
274
- title: e(o)("manager.move-to"),
273
+ "onUpdate:open": u[3] || (u[3] = (n) => te(m) ? m.value = n : null),
274
+ title: e(i)("manager.move-to"),
275
275
  width: 420
276
276
  }, {
277
277
  footer: w(() => [
278
278
  h(e(be), { size: "sm" }, {
279
279
  default: w(() => [
280
- h(e(X), {
280
+ h(e(I), {
281
281
  variant: "outline",
282
- onClick: u[1] || (u[1] = (r) => e(f)())
282
+ onClick: u[1] || (u[1] = (n) => e(v)())
283
283
  }, {
284
284
  default: w(() => [
285
- S(D(e(o)("manager.cancel")), 1)
285
+ P(L(e(i)("manager.cancel")), 1)
286
286
  ]),
287
287
  _: 1
288
288
  }),
289
- h(e(X), {
289
+ h(e(I), {
290
290
  type: "primary",
291
291
  disabled: p.value === null,
292
- onClick: u[2] || (u[2] = (r) => e(l)(p.value))
292
+ onClick: u[2] || (u[2] = (n) => e(l)(p.value))
293
293
  }, {
294
294
  default: w(() => [
295
- S(D(e(o)("manager.move")), 1)
295
+ P(L(e(i)("manager.move")), 1)
296
296
  ]),
297
297
  _: 1
298
298
  }, 8, ["disabled"])
@@ -303,14 +303,14 @@ const ge = /* @__PURE__ */ E({
303
303
  default: w(() => [
304
304
  h(e(je), {
305
305
  modelValue: p.value,
306
- "onUpdate:modelValue": u[0] || (u[0] = (r) => p.value = r),
306
+ "onUpdate:modelValue": u[0] || (u[0] = (n) => p.value = n),
307
307
  options: t.value
308
308
  }, null, 8, ["modelValue", "options"])
309
309
  ]),
310
310
  _: 1
311
311
  }, 8, ["open", "title"]));
312
312
  }
313
- }), rt = /* @__PURE__ */ E({
313
+ }), rt = /* @__PURE__ */ S({
314
314
  __name: "NameDialog",
315
315
  props: {
316
316
  title: {},
@@ -319,39 +319,39 @@ const ge = /* @__PURE__ */ E({
319
319
  confirmText: { default: void 0 }
320
320
  },
321
321
  setup(a) {
322
- const c = a, { open: m, resolve: l, dismiss: f } = ae(), o = B("webx-media"), t = M(c.value), p = ee("input");
322
+ const d = a, { open: m, resolve: l, dismiss: v } = ae(), i = B("webx-media"), t = M(d.value), p = ee("input");
323
323
  he(async () => {
324
324
  await qe(), p.value?.querySelector("input")?.focus();
325
325
  });
326
- function x() {
326
+ function k() {
327
327
  const g = t.value.trim();
328
328
  g !== "" && l(g);
329
329
  }
330
- return (g, u) => (b(), k(e(le), {
330
+ return (g, u) => (b(), $(e(le), {
331
331
  open: e(m),
332
- "onUpdate:open": u[2] || (u[2] = (r) => te(m) ? m.value = r : null),
332
+ "onUpdate:open": u[2] || (u[2] = (n) => te(m) ? m.value = n : null),
333
333
  title: a.title,
334
334
  width: 420
335
335
  }, {
336
336
  footer: w(() => [
337
337
  h(e(be), { size: "sm" }, {
338
338
  default: w(() => [
339
- h(e(X), {
339
+ h(e(I), {
340
340
  variant: "outline",
341
- onClick: u[1] || (u[1] = (r) => e(f)())
341
+ onClick: u[1] || (u[1] = (n) => e(v)())
342
342
  }, {
343
343
  default: w(() => [
344
- S(D(e(o)("manager.cancel")), 1)
344
+ P(L(e(i)("manager.cancel")), 1)
345
345
  ]),
346
346
  _: 1
347
347
  }),
348
- h(e(X), {
348
+ h(e(I), {
349
349
  type: "primary",
350
350
  disabled: t.value.trim() === "",
351
- onClick: x
351
+ onClick: k
352
352
  }, {
353
353
  default: w(() => [
354
- S(D(a.confirmText ?? e(o)("manager.save")), 1)
354
+ P(L(a.confirmText ?? e(i)("manager.save")), 1)
355
355
  ]),
356
356
  _: 1
357
357
  }, 8, ["disabled"])
@@ -360,16 +360,16 @@ const ge = /* @__PURE__ */ E({
360
360
  })
361
361
  ]),
362
362
  default: w(() => [
363
- $("div", {
363
+ _("div", {
364
364
  ref_key: "input",
365
365
  ref: p
366
366
  }, [
367
367
  h(e(j), {
368
368
  modelValue: t.value,
369
- "onUpdate:modelValue": u[0] || (u[0] = (r) => t.value = r),
370
- placeholder: a.label ?? e(o)("manager.folder-name"),
371
- "aria-label": a.label ?? e(o)("manager.folder-name"),
372
- onKeyup: Ne(x, ["enter"])
369
+ "onUpdate:modelValue": u[0] || (u[0] = (n) => t.value = n),
370
+ placeholder: a.label ?? e(i)("manager.folder-name"),
371
+ "aria-label": a.label ?? e(i)("manager.folder-name"),
372
+ onKeyup: Ne(k, ["enter"])
373
373
  }, null, 8, ["modelValue", "placeholder", "aria-label"])
374
374
  ], 512)
375
375
  ]),
@@ -378,16 +378,16 @@ const ge = /* @__PURE__ */ E({
378
378
  }
379
379
  });
380
380
  function we(a) {
381
- const c = `${a.apiPath}/media`, m = (l) => l.data;
381
+ const d = `${a.apiPath}/media`, m = (l) => l.data;
382
382
  return {
383
- directories: () => a.http.get(`${c}/directories`).then(m),
384
- createDirectory: (l, f) => a.http.post(`${c}/directories`, { parent_id: l, title: f }).then(m),
385
- renameDirectory: (l, f) => a.http.patch(`${c}/directories/${l}`, { title: f }).then(m),
386
- moveDirectory: (l, f) => a.http.patch(`${c}/directories/${l}/move`, { parent_id: f }).then(m),
387
- deleteDirectory: (l, f = !1) => a.http.delete(`${c}/directories/${l}`, {
388
- query: { force: f ? 1 : void 0 }
383
+ directories: () => a.http.get(`${d}/directories`).then(m),
384
+ createDirectory: (l, v) => a.http.post(`${d}/directories`, { parent_id: l, title: v }).then(m),
385
+ renameDirectory: (l, v) => a.http.patch(`${d}/directories/${l}`, { title: v }).then(m),
386
+ moveDirectory: (l, v) => a.http.patch(`${d}/directories/${l}/move`, { parent_id: v }).then(m),
387
+ deleteDirectory: (l, v = !1) => a.http.delete(`${d}/directories/${l}`, {
388
+ query: { force: v ? 1 : void 0 }
389
389
  }),
390
- files: (l = {}) => a.http.get(`${c}/files`, {
390
+ files: (l = {}) => a.http.get(`${d}/files`, {
391
391
  query: {
392
392
  directory_id: l.directory_id ?? void 0,
393
393
  q: l.q || void 0,
@@ -397,50 +397,50 @@ function we(a) {
397
397
  per_page: l.per_page
398
398
  }
399
399
  }),
400
- file: (l) => a.http.get(`${c}/files/${l}`).then(m),
401
- fileByPath: (l) => a.http.get(`${c}/files/by-path?path=${encodeURIComponent(l)}`).then(m).catch(() => null),
402
- async upload(l, f, o) {
400
+ file: (l) => a.http.get(`${d}/files/${l}`).then(m),
401
+ fileByPath: (l) => a.http.get(`${d}/files/by-path?path=${encodeURIComponent(l)}`).then(m).catch(() => null),
402
+ async upload(l, v, i) {
403
403
  const t = new FormData();
404
- return t.append("directory_id", String(l)), f.forEach((p) => t.append("files[]", p)), new Promise((p, x) => {
404
+ return t.append("directory_id", String(l)), v.forEach((p) => t.append("files[]", p)), new Promise((p, k) => {
405
405
  const g = new XMLHttpRequest();
406
- g.open("POST", `${c}/files`), g.responseType = "json", g.withCredentials = !0, g.setRequestHeader("Accept", "application/json"), g.setRequestHeader("X-Requested-With", "XMLHttpRequest"), g.setRequestHeader("X-Webx-Locale", a.i18n.state.locale);
406
+ g.open("POST", `${d}/files`), g.responseType = "json", g.withCredentials = !0, g.setRequestHeader("Accept", "application/json"), g.setRequestHeader("X-Requested-With", "XMLHttpRequest"), g.setRequestHeader("X-Webx-Locale", a.i18n.state.locale);
407
407
  const u = st();
408
- u && g.setRequestHeader("X-XSRF-TOKEN", u), g.upload.addEventListener("progress", (r) => {
409
- r.lengthComputable && o?.(Math.round(r.loaded / r.total * 100));
408
+ u && g.setRequestHeader("X-XSRF-TOKEN", u), g.upload.addEventListener("progress", (n) => {
409
+ n.lengthComputable && i?.(Math.round(n.loaded / n.total * 100));
410
410
  }), g.addEventListener("load", () => {
411
- const r = g.response;
412
- if (g.status >= 200 && g.status < 300 && r?.data) {
413
- p(r.data);
411
+ const n = g.response;
412
+ if (g.status >= 200 && g.status < 300 && n?.data) {
413
+ p(n.data);
414
414
  return;
415
415
  }
416
- x(
417
- Object.assign(new Error(r?.message ?? "Upload failed"), {
416
+ k(
417
+ Object.assign(new Error(n?.message ?? "Upload failed"), {
418
418
  status: g.status,
419
- body: r
419
+ body: n
420
420
  })
421
421
  );
422
- }), g.addEventListener("error", () => x(new Error("Upload failed"))), g.send(t);
422
+ }), g.addEventListener("error", () => k(new Error("Upload failed"))), g.send(t);
423
423
  });
424
424
  },
425
- rename: (l, f) => a.http.patch(`${c}/files/${l}`, { name: f }).then(m),
426
- move: (l, f) => a.http.post(`${c}/files/move`, { ids: l, directory_id: f }).then((o) => o.data.moved),
425
+ rename: (l, v) => a.http.patch(`${d}/files/${l}`, { name: v }).then(m),
426
+ move: (l, v) => a.http.post(`${d}/files/move`, { ids: l, directory_id: v }).then((i) => i.data.moved),
427
427
  // A POST for the batch, not a DELETE: the panel's own client sends no body on DELETE, and
428
428
  // a list of ids in a query string is a worse answer than an honest verb.
429
- remove: (l) => a.http.post(`${c}/files/delete`, { ids: l }).then((f) => f.data.deleted),
430
- removeOne: (l) => a.http.delete(`${c}/files/${l}`),
431
- edit: (l, f) => a.http.post(`${c}/files/${l}/edit`, f).then(m),
432
- copy: (l) => a.http.post(`${c}/files/${l}/copy`).then(m),
433
- restoreOriginal: (l) => a.http.post(`${c}/files/${l}/restore-original`).then(m),
434
- thumb(l, f, o, t = "cover") {
429
+ remove: (l) => a.http.post(`${d}/files/delete`, { ids: l }).then((v) => v.data.deleted),
430
+ removeOne: (l) => a.http.delete(`${d}/files/${l}`),
431
+ edit: (l, v) => a.http.post(`${d}/files/${l}/edit`, v).then(m),
432
+ copy: (l) => a.http.post(`${d}/files/${l}/copy`).then(m),
433
+ restoreOriginal: (l) => a.http.post(`${d}/files/${l}/restore-original`).then(m),
434
+ thumb(l, v, i, t = "cover") {
435
435
  if (!l.thumb)
436
436
  return null;
437
437
  const p = new URL(l.thumb, window.location.origin);
438
- return p.searchParams.set("w", String(f)), o && p.searchParams.set("h", String(o)), p.searchParams.set("fit", t), p.pathname + p.search;
438
+ return p.searchParams.set("w", String(v)), i && p.searchParams.set("h", String(i)), p.searchParams.set("fit", t), p.pathname + p.search;
439
439
  }
440
440
  };
441
441
  }
442
442
  function st() {
443
- const a = document.cookie.split("; ").find((c) => c.startsWith("XSRF-TOKEN="));
443
+ const a = document.cookie.split("; ").find((d) => d.startsWith("XSRF-TOKEN="));
444
444
  return a ? decodeURIComponent(a.slice(11)) : null;
445
445
  }
446
446
  const dt = {
@@ -559,15 +559,15 @@ function xe() {
559
559
  const ut = {
560
560
  key: 0,
561
561
  class: "wx-media__folders"
562
- }, ct = { class: "wx-media__files" }, mt = ["accept"], pt = { class: "wx-media__status" }, ft = { key: 0 }, vt = { class: "wx-media__drawer" }, ke = /* @__PURE__ */ E({
562
+ }, ct = { class: "wx-media__files" }, mt = ["accept"], pt = { class: "wx-media__status" }, ft = { key: 0 }, vt = { class: "wx-media__drawer" }, ke = /* @__PURE__ */ S({
563
563
  __name: "MediaManager",
564
564
  props: {
565
565
  picking: { type: Boolean, default: !1 },
566
566
  accept: { default: null }
567
567
  },
568
568
  emits: ["pick"],
569
- setup(a, { emit: c }) {
570
- const m = a, l = c, f = ie(), o = we(f);
569
+ setup(a, { emit: d }) {
570
+ const m = a, l = d, v = ie(), i = we(v);
571
571
  xe();
572
572
  const t = B("webx-media");
573
573
  function p() {
@@ -591,33 +591,33 @@ const ut = {
591
591
  errorText: t("editor.error")
592
592
  };
593
593
  }
594
- const x = ee("root"), g = Ge(x), u = W(() => g.value > 0 && g.value < 640), r = M([]), v = M(null), i = M(null), d = M([]), _ = M(""), P = M(m.accept ?? "all");
594
+ const k = ee("root"), g = Ge(k), u = D(() => g.value > 0 && g.value < 640), n = M([]), f = M(null), c = M(null), s = M([]), x = M(""), z = M(m.accept ?? "all");
595
595
  q(
596
596
  () => m.accept,
597
- (s) => {
598
- P.value = s ?? "all";
597
+ (r) => {
598
+ z.value = r ?? "all";
599
599
  }
600
600
  );
601
- const I = M("-created_at"), J = M(!1), H = M(!1), oe = ee("picker"), _e = W(() => i.value?.data ?? []), K = W(() => f.can("media.manage")), Ce = W(() => f.can("media.upload") || K.value), U = W(() => Ve(v.value));
602
- he(V), q([v, P, I], () => R(1)), q(
603
- _,
604
- Fe(() => R(1), 300)
605
- ), q(u, (s) => {
606
- s || (H.value = !1);
601
+ const X = M("-created_at"), J = M(!1), H = M(!1), oe = ee("picker"), _e = D(() => c.value?.data ?? []), K = D(() => v.can("media.manage")), Ce = D(() => v.can("media.upload") || K.value), R = D(() => Ve(f.value));
602
+ he(E), q([f, z, X], () => V(1)), q(
603
+ x,
604
+ Be(() => V(1), 300)
605
+ ), q(u, (r) => {
606
+ r || (H.value = !1);
607
607
  });
608
- async function V() {
609
- r.value = await o.directories(), v.value ??= r.value[0]?.id ?? null, await R(1);
608
+ async function E() {
609
+ n.value = await i.directories(), f.value ??= n.value[0]?.id ?? null, await V(1);
610
610
  }
611
- async function R(s = i.value?.meta.current_page ?? 1) {
611
+ async function V(r = c.value?.meta.current_page ?? 1) {
612
612
  J.value = !0;
613
613
  try {
614
- i.value = await o.files({
615
- directory_id: _.value ? null : v.value,
616
- q: _.value,
617
- type: P.value === "all" ? null : P.value,
618
- sort: I.value,
619
- page: s
620
- }), d.value = [];
614
+ c.value = await i.files({
615
+ directory_id: x.value ? null : f.value,
616
+ q: x.value,
617
+ type: z.value === "all" ? null : z.value,
618
+ sort: X.value,
619
+ page: r
620
+ }), s.value = [];
621
621
  } finally {
622
622
  J.value = !1;
623
623
  }
@@ -625,155 +625,155 @@ const ut = {
625
625
  function Me() {
626
626
  oe.value?.click();
627
627
  }
628
- async function Te(s) {
629
- const n = s.target, y = Array.from(n.files ?? []);
630
- if (n.value = "", !(y.length === 0 || v.value === null))
628
+ async function Te(r) {
629
+ const o = r.target, y = Array.from(o.files ?? []);
630
+ if (o.value = "", !(y.length === 0 || f.value === null))
631
631
  try {
632
- const C = await o.upload(v.value, y), O = C.filter((Se) => Se.duplicate).length;
633
- C.length > O && N.success(t("manager.uploaded", { count: C.length - O })), O > 0 && N.info(t("manager.duplicate-added")), await Promise.all([V(), R(1)]);
632
+ const C = await i.upload(f.value, y), O = C.filter((Fe) => Fe.duplicate).length;
633
+ C.length > O && N.success(t("manager.uploaded", { count: C.length - O })), O > 0 && N.info(t("manager.duplicate-added")), await Promise.all([E(), V(1)]);
634
634
  } catch (C) {
635
635
  N.danger(ce(C) ?? t("errors.upload"));
636
636
  }
637
637
  }
638
638
  const ne = Y(rt);
639
639
  async function re() {
640
- const s = await ne({
640
+ const r = await ne({
641
641
  title: t("manager.new-folder"),
642
642
  confirmText: t("manager.new-folder")
643
643
  });
644
- s === void 0 || v.value === null || (await o.createDirectory(v.value, s), await V());
644
+ r === void 0 || f.value === null || (await i.createDirectory(f.value, r), await E());
645
645
  }
646
646
  async function se() {
647
- const s = U.value;
648
- if (!s || s.is_root)
647
+ const r = R.value;
648
+ if (!r || r.is_root)
649
649
  return;
650
- const n = await ne({
650
+ const o = await ne({
651
651
  title: t("manager.rename"),
652
- value: s.title,
652
+ value: r.title,
653
653
  confirmText: t("manager.save")
654
654
  });
655
- n !== void 0 && (await o.renameDirectory(s.id, n), await V());
655
+ o !== void 0 && (await i.renameDirectory(r.id, o), await E());
656
656
  }
657
657
  async function de() {
658
- const s = U.value;
659
- if (!(!s || s.is_root)) {
658
+ const r = R.value;
659
+ if (!(!r || r.is_root)) {
660
660
  try {
661
- await o.deleteDirectory(s.id);
662
- } catch (n) {
663
- const y = Ee(n);
661
+ await i.deleteDirectory(r.id);
662
+ } catch (o) {
663
+ const y = Ee(o);
664
664
  if (!y)
665
- throw n;
665
+ throw o;
666
666
  if (!await ve({
667
- title: t("dialogs.delete-folder-title", { title: s.title }),
667
+ title: t("dialogs.delete-folder-title", { title: r.title }),
668
668
  message: `${t("dialogs.delete-folder-contents", y)} ${t("dialogs.delete-folder-warning")}`,
669
669
  confirmText: t("dialogs.confirm"),
670
670
  cancelText: t("manager.cancel"),
671
671
  tone: "danger"
672
672
  }))
673
673
  return;
674
- await o.deleteDirectory(s.id, !0);
674
+ await i.deleteDirectory(r.id, !0);
675
675
  }
676
- v.value = null, await V();
676
+ f.value = null, await E();
677
677
  }
678
678
  }
679
- async function ue(s, n) {
679
+ async function ue(r, o) {
680
680
  try {
681
- await o.moveDirectory(s, n);
681
+ await i.moveDirectory(r, o);
682
682
  } catch (y) {
683
683
  N.danger(ce(y) ?? t("errors.directory-into-itself"));
684
684
  }
685
- await V();
685
+ await E();
686
686
  }
687
687
  const ze = Y(nt);
688
688
  async function We() {
689
- const s = await ze({
690
- directories: r.value,
691
- from: v.value,
692
- count: d.value.length
689
+ const r = await ze({
690
+ directories: n.value,
691
+ from: f.value,
692
+ count: s.value.length
693
693
  });
694
- s !== void 0 && (await o.move([...d.value], s), await Promise.all([V(), R()]));
694
+ r !== void 0 && (await i.move([...s.value], r), await Promise.all([E(), V()]));
695
695
  }
696
696
  async function De() {
697
- const s = [...d.value];
697
+ const r = [...s.value];
698
698
  await ve({
699
- title: t("dialogs.delete-files-title", { count: s.length }),
699
+ title: t("dialogs.delete-files-title", { count: r.length }),
700
700
  message: t("dialogs.delete-files-text"),
701
701
  confirmText: t("dialogs.confirm"),
702
702
  cancelText: t("manager.cancel"),
703
703
  tone: "danger"
704
- }) && (await o.remove(s), await Promise.all([V(), R()]));
704
+ }) && (await i.remove(r), await Promise.all([E(), V()]));
705
705
  }
706
- async function Le(s, n) {
707
- await o.rename(s.id, n), await R();
706
+ async function Le(r, o) {
707
+ await i.rename(r.id, o), await V();
708
708
  }
709
- async function Ue(s) {
710
- await o.removeOne(s.id), await Promise.all([V(), R()]);
709
+ async function Ue(r) {
710
+ await i.removeOne(r.id), await Promise.all([E(), V()]);
711
711
  }
712
- async function Re(s) {
713
- const n = await Qe({
714
- src: s.source ?? s.url,
715
- fileName: s.file_name,
712
+ async function Re(r) {
713
+ const o = await Qe({
714
+ src: r.source ?? r.url,
715
+ fileName: r.file_name,
716
716
  filters: !1,
717
717
  // The editor is a component of the design system: its words are props with English
718
718
  // defaults, not lines in the panel's dictionary. Whoever opens it is the one who knows
719
719
  // what language the panel is being read in.
720
720
  ...p()
721
721
  });
722
- n && (await o.edit(s.id, {
722
+ o && (await i.edit(r.id, {
723
723
  // The editor's frame is read against the picture as it is on screen — already turned — and
724
724
  // the server applies the operations in that order for the same reason.
725
- crop: n.crop,
726
- rotate: (n.rotation % 360 + 360) % 360,
727
- flip: n.flipX ? "horizontal" : n.flipY ? "vertical" : void 0,
728
- resize: { width: n.width, height: n.height }
729
- }), await R());
725
+ crop: o.crop,
726
+ rotate: (o.rotation % 360 + 360) % 360,
727
+ flip: o.flipX ? "horizontal" : o.flipY ? "vertical" : void 0,
728
+ resize: { width: o.width, height: o.height }
729
+ }), await V());
730
730
  }
731
- function Ve(s) {
732
- const n = (y) => {
731
+ function Ve(r) {
732
+ const o = (y) => {
733
733
  for (const C of y) {
734
- if (C.id === s)
734
+ if (C.id === r)
735
735
  return C;
736
- const O = n(C.children ?? []);
736
+ const O = o(C.children ?? []);
737
737
  if (O)
738
738
  return O;
739
739
  }
740
740
  return null;
741
741
  };
742
- return s === null ? null : n(r.value);
742
+ return r === null ? null : o(n.value);
743
743
  }
744
- function Ee(s) {
745
- const n = s?.body;
746
- return n?.code === "directory_not_empty" ? n.counts ?? null : null;
744
+ function Ee(r) {
745
+ const o = r?.body;
746
+ return o?.code === "directory_not_empty" ? o.counts ?? null : null;
747
747
  }
748
- function ce(s) {
749
- return s?.message ?? null;
748
+ function ce(r) {
749
+ return r?.message ?? null;
750
750
  }
751
- function Be(s) {
752
- const n = ["B", "KB", "MB", "GB", "TB"];
753
- let y = s, C = 0;
754
- for (; y >= 1024 && C < n.length - 1; )
751
+ function Se(r) {
752
+ const o = ["B", "KB", "MB", "GB", "TB"];
753
+ let y = r, C = 0;
754
+ for (; y >= 1024 && C < o.length - 1; )
755
755
  y /= 1024, C++;
756
- return `${y >= 10 || C === 0 ? Math.round(y) : y.toFixed(1)} ${n[C]}`;
756
+ return `${y >= 10 || C === 0 ? Math.round(y) : y.toFixed(1)} ${o[C]}`;
757
757
  }
758
- function Fe(s, n) {
758
+ function Be(r, o) {
759
759
  let y;
760
760
  return () => {
761
- clearTimeout(y), y = setTimeout(s, n);
761
+ clearTimeout(y), y = setTimeout(r, o);
762
762
  };
763
763
  }
764
- return (s, n) => (b(), z("div", {
764
+ return (r, o) => (b(), W("div", {
765
765
  ref_key: "root",
766
- ref: x,
766
+ ref: k,
767
767
  class: Ae(["wx-media", { "wx-media--compact": u.value }])
768
768
  }, [
769
- u.value ? L("", !0) : (b(), z("aside", ut, [
769
+ u.value ? U("", !0) : (b(), W("aside", ut, [
770
770
  h(ge, {
771
- selected: v.value,
772
- "onUpdate:selected": n[0] || (n[0] = (y) => v.value = y),
773
- directories: r.value,
771
+ selected: f.value,
772
+ "onUpdate:selected": o[0] || (o[0] = (y) => f.value = y),
773
+ directories: n.value,
774
774
  onMove: ue
775
775
  }, null, 8, ["selected", "directories"]),
776
- K.value ? (b(), k(e(G), {
776
+ K.value ? (b(), $(e(G), {
777
777
  key: 0,
778
778
  size: "sm",
779
779
  align: "start"
@@ -787,38 +787,38 @@ const ut = {
787
787
  h(e(T), {
788
788
  type: "edit",
789
789
  title: e(t)("manager.rename"),
790
- disabled: !U.value || U.value.is_root,
790
+ disabled: !R.value || R.value.is_root,
791
791
  onClick: se
792
792
  }, null, 8, ["title", "disabled"]),
793
793
  h(e(T), {
794
794
  type: "remove",
795
795
  title: e(t)("manager.delete"),
796
- disabled: !U.value || U.value.is_root,
796
+ disabled: !R.value || R.value.is_root,
797
797
  onClick: de
798
798
  }, null, 8, ["title", "disabled"])
799
799
  ]),
800
800
  _: 1
801
- })) : L("", !0)
801
+ })) : U("", !0)
802
802
  ])),
803
- $("section", ct, [
803
+ _("section", ct, [
804
804
  h(ot, {
805
- search: _.value,
806
- "onUpdate:search": n[1] || (n[1] = (y) => _.value = y),
807
- type: P.value,
808
- "onUpdate:type": n[2] || (n[2] = (y) => P.value = y),
809
- sort: I.value,
810
- "onUpdate:sort": n[3] || (n[3] = (y) => I.value = y),
805
+ search: x.value,
806
+ "onUpdate:search": o[1] || (o[1] = (y) => x.value = y),
807
+ type: z.value,
808
+ "onUpdate:type": o[2] || (o[2] = (y) => z.value = y),
809
+ sort: X.value,
810
+ "onUpdate:sort": o[3] || (o[3] = (y) => X.value = y),
811
811
  "can-upload": Ce.value,
812
812
  "fixed-type": a.accept !== null,
813
813
  "can-manage": K.value,
814
- selected: d.value.length,
814
+ selected: s.value.length,
815
815
  compact: u.value,
816
816
  onUpload: Me,
817
817
  onMove: We,
818
818
  onRemove: De,
819
- onFolders: n[4] || (n[4] = (y) => H.value = !0)
819
+ onFolders: o[4] || (o[4] = (y) => H.value = !0)
820
820
  }, null, 8, ["search", "type", "sort", "can-upload", "fixed-type", "can-manage", "selected", "compact"]),
821
- $("input", {
821
+ _("input", {
822
822
  ref_key: "picker",
823
823
  ref: oe,
824
824
  type: "file",
@@ -828,52 +828,52 @@ const ut = {
828
828
  onChange: Te
829
829
  }, null, 40, mt),
830
830
  h(lt, {
831
- selected: d.value,
832
- "onUpdate:selected": n[5] || (n[5] = (y) => d.value = y),
831
+ selected: s.value,
832
+ "onUpdate:selected": o[5] || (o[5] = (y) => s.value = y),
833
833
  files: _e.value,
834
- api: e(o),
835
- query: _.value,
834
+ api: e(i),
835
+ query: x.value,
836
836
  single: a.picking,
837
837
  onRename: Le,
838
838
  onEdit: Re,
839
839
  onRemove: Ue,
840
- onOpen: n[6] || (n[6] = (y) => l("pick", y))
840
+ onOpen: o[6] || (o[6] = (y) => l("pick", y))
841
841
  }, null, 8, ["selected", "files", "api", "query", "single"]),
842
- $("footer", pt, [
843
- $("span", null, D(e(t)("manager.status-files", { count: i.value?.stats.files ?? 0 })), 1),
844
- d.value.length > 0 ? (b(), z("span", ft, D(e(t)("manager.status-selected", { count: d.value.length })), 1)) : L("", !0),
845
- $("span", null, D(e(t)("manager.status-size", { size: Be(i.value?.stats.size ?? 0) })), 1)
842
+ _("footer", pt, [
843
+ _("span", null, L(e(t)("manager.status-files", { count: c.value?.stats.files ?? 0 })), 1),
844
+ s.value.length > 0 ? (b(), W("span", ft, L(e(t)("manager.status-selected", { count: s.value.length })), 1)) : U("", !0),
845
+ _("span", null, L(e(t)("manager.status-size", { size: Se(c.value?.stats.size ?? 0) })), 1)
846
846
  ]),
847
- i.value && i.value.meta.last_page > 1 ? (b(), k(e(Ye), {
847
+ c.value && c.value.meta.last_page > 1 ? (b(), $(e(Ye), {
848
848
  key: 0,
849
- page: i.value.meta.current_page,
850
- "per-page": i.value.meta.per_page,
851
- total: i.value.meta.total,
852
- "last-page": i.value.meta.last_page,
849
+ page: c.value.meta.current_page,
850
+ "per-page": c.value.meta.per_page,
851
+ total: c.value.meta.total,
852
+ "last-page": c.value.meta.last_page,
853
853
  disabled: J.value,
854
854
  size: "sm",
855
- onChange: n[7] || (n[7] = ({ page: y }) => R(y))
856
- }, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) : L("", !0)
855
+ onChange: o[7] || (o[7] = ({ page: y }) => V(y))
856
+ }, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) : U("", !0)
857
857
  ]),
858
858
  h(e(Je), {
859
859
  open: H.value,
860
- "onUpdate:open": n[10] || (n[10] = (y) => H.value = y),
860
+ "onUpdate:open": o[10] || (o[10] = (y) => H.value = y),
861
861
  side: "left",
862
862
  title: e(t)("manager.folders"),
863
863
  size: 280
864
864
  }, {
865
865
  default: w(() => [
866
- $("div", vt, [
866
+ _("div", vt, [
867
867
  h(ge, {
868
- selected: v.value,
868
+ selected: f.value,
869
869
  "onUpdate:selected": [
870
- n[8] || (n[8] = (y) => v.value = y),
871
- n[9] || (n[9] = (y) => H.value = !1)
870
+ o[8] || (o[8] = (y) => f.value = y),
871
+ o[9] || (o[9] = (y) => H.value = !1)
872
872
  ],
873
- directories: r.value,
873
+ directories: n.value,
874
874
  onMove: ue
875
875
  }, null, 8, ["selected", "directories"]),
876
- K.value ? (b(), k(e(G), {
876
+ K.value ? (b(), $(e(G), {
877
877
  key: 0,
878
878
  size: "sm",
879
879
  align: "start"
@@ -887,28 +887,28 @@ const ut = {
887
887
  h(e(T), {
888
888
  type: "edit",
889
889
  title: e(t)("manager.rename"),
890
- disabled: !U.value || U.value.is_root,
890
+ disabled: !R.value || R.value.is_root,
891
891
  onClick: se
892
892
  }, null, 8, ["title", "disabled"]),
893
893
  h(e(T), {
894
894
  type: "remove",
895
895
  title: e(t)("manager.delete"),
896
- disabled: !U.value || U.value.is_root,
896
+ disabled: !R.value || R.value.is_root,
897
897
  onClick: de
898
898
  }, null, 8, ["title", "disabled"])
899
899
  ]),
900
900
  _: 1
901
- })) : L("", !0)
901
+ })) : U("", !0)
902
902
  ])
903
903
  ]),
904
904
  _: 1
905
905
  }, 8, ["open", "title"])
906
906
  ], 2));
907
907
  }
908
- }), gt = /* @__PURE__ */ E({
908
+ }), gt = /* @__PURE__ */ S({
909
909
  __name: "MediaPage",
910
910
  setup(a) {
911
- return (c, m) => (b(), k(e(Ze), {
911
+ return (d, m) => (b(), $(e(Ze), {
912
912
  class: "wx-media-page",
913
913
  padding: "md"
914
914
  }, {
@@ -918,7 +918,7 @@ const ut = {
918
918
  _: 1
919
919
  }));
920
920
  }
921
- }), yt = { class: "wx-media-picker" }, $e = /* @__PURE__ */ E({
921
+ }), yt = { class: "wx-media-picker" }, $e = /* @__PURE__ */ S({
922
922
  __name: "MediaPicker",
923
923
  props: {
924
924
  accept: { default: "image" },
@@ -926,19 +926,19 @@ const ut = {
926
926
  manage: { type: Boolean, default: !1 }
927
927
  },
928
928
  setup(a) {
929
- const { open: c, resolve: m } = ae(), l = B("webx-media");
930
- return (f, o) => (b(), k(e(le), {
931
- open: e(c),
932
- "onUpdate:open": o[1] || (o[1] = (t) => te(c) ? c.value = t : null),
929
+ const { open: d, resolve: m } = ae(), l = B("webx-media");
930
+ return (v, i) => (b(), $(e(le), {
931
+ open: e(d),
932
+ "onUpdate:open": i[1] || (i[1] = (t) => te(d) ? d.value = t : null),
933
933
  title: a.title ?? e(l)("module.title"),
934
934
  width: 960
935
935
  }, {
936
936
  default: w(() => [
937
- $("div", yt, [
937
+ _("div", yt, [
938
938
  h(ke, {
939
939
  picking: !a.manage,
940
940
  accept: a.manage ? null : a.accept,
941
- onPick: o[0] || (o[0] = (t) => e(m)(t))
941
+ onPick: i[0] || (i[0] = (t) => e(m)(t))
942
942
  }, null, 8, ["picking", "accept"])
943
943
  ])
944
944
  ]),
@@ -957,12 +957,13 @@ const ut = {
957
957
  }, _t = {
958
958
  key: 0,
959
959
  class: "wx-media-field__bar"
960
- }, Ct = { class: "wx-media-field__captions" }, Mt = { class: "wx-media-field__caption" }, Tt = { class: "wx-media-field__caption" }, zt = { class: "wx-media-field__captions-footer" }, Rt = /* @__PURE__ */ E({
960
+ }, Ct = { class: "wx-media-field__captions" }, Mt = { class: "wx-media-field__caption" }, Tt = { class: "wx-media-field__caption" }, zt = { class: "wx-media-field__captions-footer" }, Rt = /* @__PURE__ */ S({
961
961
  __name: "MediaField",
962
962
  props: /* @__PURE__ */ F({
963
963
  label: { default: void 0 },
964
964
  accept: { default: "image" },
965
965
  captions: { type: Boolean, default: !0 },
966
+ aspect: { default: "16/9" },
966
967
  height: { default: 220 },
967
968
  disabled: { type: Boolean, default: !1 }
968
969
  }, {
@@ -971,67 +972,71 @@ const ut = {
971
972
  }),
972
973
  emits: ["update:modelValue"],
973
974
  setup(a) {
974
- const c = a, m = A(a, "modelValue");
975
+ const d = a, m = A(a, "modelValue");
975
976
  xe();
976
- const l = B("webx-media"), f = we(ie()), o = M(!1), t = M({});
977
+ const l = B("webx-media"), v = we(ie()), i = {
978
+ "16/9": "16 / 9",
979
+ "4/3": "4 / 3",
980
+ "1/1": "1 / 1"
981
+ }, t = M(!1), p = M({});
977
982
  q(
978
983
  () => m.value?.path,
979
- async (i) => {
980
- if (!i || m.value?.url || t.value[i]) return;
981
- const d = await f.fileByPath(i);
982
- d && (t.value = { ...t.value, [i]: d.url });
984
+ async (s) => {
985
+ if (!s || m.value?.url || p.value[s]) return;
986
+ const x = await v.fileByPath(s);
987
+ x && (p.value = { ...p.value, [s]: x.url });
983
988
  },
984
989
  { immediate: !0 }
985
990
  );
986
- const p = W(() => {
987
- const i = m.value;
988
- return i ? i.url ?? t.value[i.path] ?? null : null;
989
- }), x = W(() => ({
990
- height: typeof c.height == "number" ? `${c.height}px` : c.height
991
- }));
992
- function g(i) {
993
- return m.value?.[i] ?? {};
991
+ const k = D(() => {
992
+ const s = m.value;
993
+ return s ? s.url ?? p.value[s.path] ?? null : null;
994
+ }), g = D(
995
+ () => d.aspect ? { aspectRatio: i[d.aspect] ?? d.aspect } : { height: typeof d.height == "number" ? `${d.height}px` : d.height }
996
+ );
997
+ function u(s) {
998
+ return m.value?.[s] ?? {};
994
999
  }
995
- function u(i, d) {
996
- m.value && (m.value = { ...m.value, [i]: d });
1000
+ function n(s, x) {
1001
+ m.value && (m.value = { ...m.value, [s]: x });
997
1002
  }
998
- async function r() {
999
- if (c.disabled) return;
1000
- const i = await ht({ accept: c.accept });
1001
- i && (m.value = { ...m.value, path: i.path, url: i.url });
1003
+ async function f() {
1004
+ if (d.disabled) return;
1005
+ const s = await ht({ accept: d.accept });
1006
+ s && (m.value = { ...m.value, path: s.path, url: s.url });
1002
1007
  }
1003
- function v() {
1004
- m.value = null, o.value = !1;
1008
+ function c() {
1009
+ m.value = null, t.value = !1;
1005
1010
  }
1006
- return (i, d) => (b(), z("div", bt, [
1007
- a.label ? (b(), z("span", wt, D(a.label), 1)) : L("", !0),
1008
- m.value ? (b(), z("div", {
1011
+ return (s, x) => (b(), W("div", bt, [
1012
+ a.label ? (b(), W("span", wt, L(a.label), 1)) : U("", !0),
1013
+ m.value ? (b(), W("div", {
1009
1014
  key: 2,
1010
1015
  class: "wx-media-field__frame",
1011
- style: me(x.value)
1016
+ style: me(g.value)
1012
1017
  }, [
1013
- $("button", {
1018
+ _("button", {
1014
1019
  type: "button",
1015
1020
  class: "wx-media-field__picture",
1016
1021
  disabled: a.disabled,
1017
1022
  title: e(l)("field.replace"),
1018
- onClick: r
1023
+ onClick: f
1019
1024
  }, [
1020
- p.value ? (b(), k(e(et), {
1025
+ k.value ? (b(), $(e(et), {
1021
1026
  key: 0,
1022
- src: p.value,
1027
+ src: k.value,
1023
1028
  fit: "contain",
1024
1029
  width: "100%",
1025
1030
  height: "100%"
1026
- }, null, 8, ["src"])) : (b(), z("span", $t, D(e(l)("field.no-preview")), 1))
1031
+ }, null, 8, ["src"])) : (b(), W("span", $t, L(e(l)("field.no-preview")), 1))
1027
1032
  ], 8, kt),
1028
- a.disabled ? L("", !0) : (b(), z("div", _t, [
1033
+ a.disabled ? U("", !0) : (b(), W("div", _t, [
1029
1034
  h(e(G), { size: "sm" }, {
1030
1035
  default: w(() => [
1031
- a.captions ? (b(), k(e(tt), {
1036
+ a.captions ? (b(), $(e(tt), {
1032
1037
  key: 0,
1033
- open: o.value,
1034
- "onUpdate:open": d[3] || (d[3] = (_) => o.value = _),
1038
+ open: t.value,
1039
+ "onUpdate:open": x[3] || (x[3] = (z) => t.value = z),
1035
1040
  title: e(l)("field.captions"),
1036
1041
  width: 360,
1037
1042
  side: "top",
@@ -1044,41 +1049,41 @@ const ut = {
1044
1049
  }, null, 8, ["title"])
1045
1050
  ]),
1046
1051
  default: w(() => [
1047
- $("div", Ct, [
1048
- $("div", Mt, [
1049
- d[4] || (d[4] = $("label", {
1052
+ _("div", Ct, [
1053
+ _("div", Mt, [
1054
+ x[4] || (x[4] = _("label", {
1050
1055
  class: "wx-media-field__caption-label",
1051
1056
  for: "wx-media-alt"
1052
1057
  }, "alt", -1)),
1053
1058
  h(e(j), {
1054
1059
  id: "wx-media-alt",
1055
1060
  localized: "",
1056
- "model-value": g("alt"),
1061
+ "model-value": u("alt"),
1057
1062
  placeholder: e(l)("field.alt-hint"),
1058
- "onUpdate:modelValue": d[0] || (d[0] = (_) => u("alt", _))
1063
+ "onUpdate:modelValue": x[0] || (x[0] = (z) => n("alt", z))
1059
1064
  }, null, 8, ["model-value", "placeholder"])
1060
1065
  ]),
1061
- $("div", Tt, [
1062
- d[5] || (d[5] = $("label", {
1066
+ _("div", Tt, [
1067
+ x[5] || (x[5] = _("label", {
1063
1068
  class: "wx-media-field__caption-label",
1064
1069
  for: "wx-media-title"
1065
1070
  }, "title", -1)),
1066
1071
  h(e(j), {
1067
1072
  id: "wx-media-title",
1068
1073
  localized: "",
1069
- "model-value": g("title"),
1074
+ "model-value": u("title"),
1070
1075
  placeholder: e(l)("field.title-hint"),
1071
- "onUpdate:modelValue": d[1] || (d[1] = (_) => u("title", _))
1076
+ "onUpdate:modelValue": x[1] || (x[1] = (z) => n("title", z))
1072
1077
  }, null, 8, ["model-value", "placeholder"])
1073
1078
  ]),
1074
- $("div", zt, [
1075
- h(e(X), {
1079
+ _("div", zt, [
1080
+ h(e(I), {
1076
1081
  size: "sm",
1077
1082
  type: "primary",
1078
- onClick: d[2] || (d[2] = (_) => o.value = !1)
1083
+ onClick: x[2] || (x[2] = (z) => t.value = !1)
1079
1084
  }, {
1080
1085
  default: w(() => [
1081
- S(D(e(l)("manager.save")), 1)
1086
+ P(L(e(l)("manager.save")), 1)
1082
1087
  ]),
1083
1088
  _: 1
1084
1089
  })
@@ -1086,7 +1091,7 @@ const ut = {
1086
1091
  ])
1087
1092
  ]),
1088
1093
  _: 1
1089
- }, 8, ["open", "title"])) : L("", !0),
1094
+ }, 8, ["open", "title"])) : U("", !0),
1090
1095
  h(e(at), {
1091
1096
  title: e(l)("field.clear-title"),
1092
1097
  description: e(l)("field.clear-text"),
@@ -1094,7 +1099,7 @@ const ut = {
1094
1099
  "cancel-text": e(l)("manager.cancel"),
1095
1100
  "confirm-type": "danger",
1096
1101
  side: "top",
1097
- onConfirm: v
1102
+ onConfirm: c
1098
1103
  }, {
1099
1104
  trigger: w(() => [
1100
1105
  h(e(T), {
@@ -1108,29 +1113,29 @@ const ut = {
1108
1113
  _: 1
1109
1114
  })
1110
1115
  ]))
1111
- ], 4)) : (b(), z("div", {
1116
+ ], 4)) : (b(), W("div", {
1112
1117
  key: 1,
1113
1118
  class: "wx-media-field__frame is-empty",
1114
- style: me(x.value)
1119
+ style: me(g.value)
1115
1120
  }, [
1116
- $("button", {
1121
+ _("button", {
1117
1122
  type: "button",
1118
1123
  class: "wx-media-field__pick",
1119
1124
  disabled: a.disabled,
1120
- onClick: r
1121
- }, D(e(l)("field.select")), 9, xt)
1125
+ onClick: f
1126
+ }, L(e(l)("field.select")), 9, xt)
1122
1127
  ], 4))
1123
1128
  ]));
1124
1129
  }
1125
1130
  });
1126
1131
  function Vt(a = {}) {
1127
- const c = a.path ?? "/media";
1132
+ const d = a.path ?? "/media";
1128
1133
  return {
1129
1134
  id: "media",
1130
- path: c,
1135
+ path: d,
1131
1136
  routes: [
1132
1137
  {
1133
- path: c,
1138
+ path: d,
1134
1139
  name: "webx.media",
1135
1140
  component: gt
1136
1141
  }