@webx-ui/module-media 0.6.1 → 0.7.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,17 +1,17 @@
1
- import { defineComponent as O, useModel as I, ref as L, watch as K, openBlock as b, createBlock as T, unref as e, mergeModels as j, computed as U, resolveDirective as Ke, withCtx as x, createElementBlock as W, Fragment as se, renderList as re, withDirectives as je, createCommentVNode as R, createVNode as v, createTextVNode as N, toDisplayString as z, isRef as me, useTemplateRef as de, onMounted as Fe, nextTick as Ge, createElementVNode as M, withKeys as Ye, normalizeClass as ue, createSlots as Je, inject as Qe, normalizeStyle as ce, mergeProps as pe } from "vue";
2
- import { useTranslate as X, useAdmin as fe, adminKey as Ze } from "@webx-ui/module-admin";
3
- import { WxTree as et, WxSelectionArea as tt, WxFileCard as Ue, WxEmpty as lt, toast as Q, WxAction as D, WxInput as Z, WxDropdown as Ce, WxDropdownItem as Ve, WxActions as le, useModal as ve, WxDialog as ge, WxSelect as at, WxSpace as ye, WxButton as H, useElementWidth as it, createModal as ae, WxPagination as nt, WxDrawer as ot, confirm as Me, openImageEditor as st, WxSortableList as rt, WxPopover as We, WxPopconfirm as Le, WxImage as dt, WxCard as ut } from "@webx-ui/core";
4
- function he(t) {
5
- const i = `${t.apiPath}/media`, o = (l) => l.data;
1
+ import { defineComponent as S, useModel as A, ref as R, watch as G, openBlock as b, createBlock as T, unref as e, mergeModels as q, computed as z, resolveDirective as Ge, withCtx as w, createElementBlock as L, Fragment as ce, renderList as me, withDirectives as Ye, createCommentVNode as D, createVNode as g, createTextVNode as O, toDisplayString as U, isRef as ve, useTemplateRef as oe, onMounted as Fe, nextTick as Je, createElementVNode as V, withKeys as Qe, normalizeClass as pe, createSlots as We, inject as Ze, normalizeStyle as fe, mergeProps as ge } from "vue";
2
+ import { useTranslate as H, useAdmin as se, useErrorText as et, adminKey as tt, WxListScreen as lt } from "@webx-ui/module-admin";
3
+ import { WxTree as at, WxSelectionArea as it, WxFileCard as Le, WxEmpty as nt, toast as J, WxAction as B, WxInput as Z, WxDropdown as Ve, WxDropdownItem as Te, WxActions as le, useModal as ye, WxDialog as he, WxSelect as ot, WxSpace as be, WxButton as I, useElementWidth as st, createModal as ae, WxPagination as rt, WxDrawer as dt, confirm as ue, openImageEditor as ut, WxSortableList as ct, WxPopover as Re, WxPopconfirm as De, WxImage as mt, WxCard as pt } from "@webx-ui/core";
4
+ function we(a) {
5
+ const i = `${a.apiPath}/media`, n = (l) => l.data;
6
6
  return {
7
- directories: () => t.http.get(`${i}/directories`).then(o),
8
- createDirectory: (l, c) => t.http.post(`${i}/directories`, { parent_id: l, title: c }).then(o),
9
- renameDirectory: (l, c) => t.http.patch(`${i}/directories/${l}`, { title: c }).then(o),
10
- moveDirectory: (l, c) => t.http.patch(`${i}/directories/${l}/move`, { parent_id: c }).then(o),
11
- deleteDirectory: (l, c = !1) => t.http.delete(`${i}/directories/${l}`, {
12
- query: { force: c ? 1 : void 0 }
7
+ directories: () => a.http.get(`${i}/directories`).then(n),
8
+ createDirectory: (l, r) => a.http.post(`${i}/directories`, { parent_id: l, title: r }).then(n),
9
+ renameDirectory: (l, r) => a.http.patch(`${i}/directories/${l}`, { title: r }).then(n),
10
+ moveDirectory: (l, r) => a.http.patch(`${i}/directories/${l}/move`, { parent_id: r }).then(n),
11
+ deleteDirectory: (l, r = !1) => a.http.delete(`${i}/directories/${l}`, {
12
+ query: { force: r ? 1 : void 0 }
13
13
  }),
14
- files: (l = {}) => t.http.get(`${i}/files`, {
14
+ files: (l = {}) => a.http.get(`${i}/files`, {
15
15
  query: {
16
16
  directory_id: l.directory_id ?? void 0,
17
17
  q: l.q || void 0,
@@ -21,111 +21,111 @@ function he(t) {
21
21
  per_page: l.per_page
22
22
  }
23
23
  }),
24
- file: (l) => t.http.get(`${i}/files/${l}`).then(o),
25
- fileByPath: (l) => t.http.get(`${i}/files/by-path?path=${encodeURIComponent(l)}`).then(o).catch(() => null),
26
- async upload(l, c, s) {
27
- const a = new FormData();
28
- return a.append("directory_id", String(l)), c.forEach((n) => a.append("files[]", n)), new Promise((n, k) => {
29
- const w = new XMLHttpRequest();
30
- w.open("POST", `${i}/files`), w.responseType = "json", w.withCredentials = !0, w.setRequestHeader("Accept", "application/json"), w.setRequestHeader("X-Requested-With", "XMLHttpRequest"), w.setRequestHeader("X-Webx-Locale", t.i18n.state.locale);
31
- const u = ct();
32
- u && w.setRequestHeader("X-XSRF-TOKEN", u), w.upload.addEventListener("progress", (r) => {
33
- r.lengthComputable && s?.(Math.round(r.loaded / r.total * 100));
34
- }), w.addEventListener("load", () => {
35
- const r = w.response;
36
- if (w.status >= 200 && w.status < 300 && r?.data) {
37
- n(r.data);
24
+ file: (l) => a.http.get(`${i}/files/${l}`).then(n),
25
+ fileByPath: (l) => a.http.get(`${i}/files/by-path?path=${encodeURIComponent(l)}`).then(n).catch(() => null),
26
+ async upload(l, r, d) {
27
+ const v = new FormData();
28
+ return v.append("directory_id", String(l)), r.forEach((t) => v.append("files[]", t)), new Promise((t, x) => {
29
+ const y = new XMLHttpRequest();
30
+ y.open("POST", `${i}/files`), y.responseType = "json", y.withCredentials = !0, y.setRequestHeader("Accept", "application/json"), y.setRequestHeader("X-Requested-With", "XMLHttpRequest"), y.setRequestHeader("X-Webx-Locale", a.i18n.state.locale);
31
+ const s = ft();
32
+ s && y.setRequestHeader("X-XSRF-TOKEN", s), y.upload.addEventListener("progress", (u) => {
33
+ u.lengthComputable && d?.(Math.round(u.loaded / u.total * 100));
34
+ }), y.addEventListener("load", () => {
35
+ const u = y.response;
36
+ if (y.status >= 200 && y.status < 300 && u?.data) {
37
+ t(u.data);
38
38
  return;
39
39
  }
40
- k(
41
- Object.assign(new Error(r?.message ?? "Upload failed"), {
42
- status: w.status,
43
- body: r
40
+ x(
41
+ Object.assign(new Error(u?.message ?? "Upload failed"), {
42
+ status: y.status,
43
+ body: u
44
44
  })
45
45
  );
46
- }), w.addEventListener("error", () => k(new Error("Upload failed"))), w.send(a);
46
+ }), y.addEventListener("error", () => x(new Error("Upload failed"))), y.send(v);
47
47
  });
48
48
  },
49
- rename: (l, c) => t.http.patch(`${i}/files/${l}`, { name: c }).then(o),
50
- move: (l, c) => t.http.post(`${i}/files/move`, { ids: l, directory_id: c }).then((s) => s.data.moved),
49
+ rename: (l, r) => a.http.patch(`${i}/files/${l}`, { name: r }).then(n),
50
+ move: (l, r) => a.http.post(`${i}/files/move`, { ids: l, directory_id: r }).then((d) => d.data.moved),
51
51
  // A POST for the batch, not a DELETE: the panel's own client sends no body on DELETE, and
52
52
  // a list of ids in a query string is a worse answer than an honest verb.
53
- remove: (l) => t.http.post(`${i}/files/delete`, { ids: l }).then((c) => c.data.deleted),
54
- removeOne: (l) => t.http.delete(`${i}/files/${l}`),
55
- edit: (l, c) => t.http.post(`${i}/files/${l}/edit`, c).then(o),
56
- copy: (l) => t.http.post(`${i}/files/${l}/copy`).then(o),
57
- restoreOriginal: (l) => t.http.post(`${i}/files/${l}/restore-original`).then(o),
58
- thumb(l, c, s, a = "cover") {
53
+ remove: (l) => a.http.post(`${i}/files/delete`, { ids: l }).then((r) => r.data.deleted),
54
+ removeOne: (l) => a.http.delete(`${i}/files/${l}`),
55
+ edit: (l, r) => a.http.post(`${i}/files/${l}/edit`, r).then(n),
56
+ copy: (l) => a.http.post(`${i}/files/${l}/copy`).then(n),
57
+ restoreOriginal: (l) => a.http.post(`${i}/files/${l}/restore-original`).then(n),
58
+ thumb(l, r, d, v = "cover") {
59
59
  if (!l.thumb)
60
60
  return null;
61
- const n = new URL(l.thumb, window.location.origin);
62
- return n.searchParams.set("w", String(c)), s && n.searchParams.set("h", String(s)), n.searchParams.set("fit", a), n.pathname + n.search;
61
+ const t = new URL(l.thumb, window.location.origin);
62
+ return t.searchParams.set("w", String(r)), d && t.searchParams.set("h", String(d)), t.searchParams.set("fit", v), t.pathname + t.search;
63
63
  }
64
64
  };
65
65
  }
66
- function ct() {
67
- const t = document.cookie.split("; ").find((i) => i.startsWith("XSRF-TOKEN="));
68
- return t ? decodeURIComponent(t.slice(11)) : null;
66
+ function ft() {
67
+ const a = document.cookie.split("; ").find((i) => i.startsWith("XSRF-TOKEN="));
68
+ return a ? decodeURIComponent(a.slice(11)) : null;
69
69
  }
70
- function Re(t) {
70
+ function Be(a) {
71
71
  const i = ["B", "KB", "MB", "GB", "TB"];
72
- let o = t, l = 0;
73
- for (; o >= 1024 && l < i.length - 1; )
74
- o /= 1024, l++;
75
- return `${o >= 10 || l === 0 ? Math.round(o) : o.toFixed(1)} ${i[l]}`;
72
+ let n = a, l = 0;
73
+ for (; n >= 1024 && l < i.length - 1; )
74
+ n /= 1024, l++;
75
+ return `${n >= 10 || l === 0 ? Math.round(n) : n.toFixed(1)} ${i[l]}`;
76
76
  }
77
- function mt(t) {
78
- return t.split("/").pop() || t;
77
+ function vt(a) {
78
+ return a.split("/").pop() || a;
79
79
  }
80
- const Te = /* @__PURE__ */ O({
80
+ const ze = /* @__PURE__ */ S({
81
81
  __name: "DirectoryTree",
82
- props: /* @__PURE__ */ j({
82
+ props: /* @__PURE__ */ q({
83
83
  directories: {}
84
84
  }, {
85
85
  selected: { default: null },
86
86
  selectedModifiers: {}
87
87
  }),
88
- emits: /* @__PURE__ */ j(["move"], ["update:selected"]),
89
- setup(t, { emit: i }) {
90
- const o = t, l = I(t, "selected"), c = i, s = X("webx-media"), a = L([]), n = L([]);
91
- K(
92
- () => o.directories,
93
- (r) => {
94
- a.value = r.map(k), n.value = w(r);
88
+ emits: /* @__PURE__ */ q(["move"], ["update:selected"]),
89
+ setup(a, { emit: i }) {
90
+ const n = a, l = A(a, "selected"), r = i, d = H("webx-media"), v = R([]), t = R([]);
91
+ G(
92
+ () => n.directories,
93
+ (u) => {
94
+ v.value = u.map(x), t.value = y(u);
95
95
  },
96
96
  { immediate: !0, deep: !0 }
97
97
  );
98
- function k(r) {
98
+ function x(u) {
99
99
  return {
100
- ...r,
101
- label: r.is_root ? s("manager.root") : r.title,
102
- children: (r.children ?? []).map(k)
100
+ ...u,
101
+ label: u.is_root ? d("manager.root") : u.title,
102
+ children: (u.children ?? []).map(x)
103
103
  };
104
104
  }
105
- function w(r) {
106
- return r.flatMap((g) => [g.id, ...w(g.children ?? [])]);
105
+ function y(u) {
106
+ return u.flatMap((k) => [k.id, ...y(k.children ?? [])]);
107
107
  }
108
- function u(r) {
109
- const g = r.zone === "inside" ? r.target : r.parent;
110
- g && c("move", r.node.id, g.id);
108
+ function s(u) {
109
+ const k = u.zone === "inside" ? u.target : u.parent;
110
+ k && r("move", u.node.id, k.id);
111
111
  }
112
- return (r, g) => (b(), T(e(et), {
112
+ return (u, k) => (b(), T(e(at), {
113
113
  selected: l.value,
114
- "onUpdate:selected": g[0] || (g[0] = (f) => l.value = f),
115
- expanded: n.value,
116
- "onUpdate:expanded": g[1] || (g[1] = (f) => n.value = f),
117
- modelValue: a.value,
118
- "onUpdate:modelValue": g[2] || (g[2] = (f) => a.value = f),
114
+ "onUpdate:selected": k[0] || (k[0] = (h) => l.value = h),
115
+ expanded: t.value,
116
+ "onUpdate:expanded": k[1] || (k[1] = (h) => t.value = h),
117
+ modelValue: v.value,
118
+ "onUpdate:modelValue": k[2] || (k[2] = (h) => v.value = h),
119
119
  class: "wx-media-tree",
120
120
  "node-key": "id",
121
121
  draggable: "",
122
122
  "show-lines": "",
123
- onDrop: u
123
+ onDrop: s
124
124
  }, null, 8, ["selected", "expanded", "modelValue"]));
125
125
  }
126
- }), pt = /* @__PURE__ */ O({
126
+ }), gt = /* @__PURE__ */ S({
127
127
  __name: "FileGrid",
128
- props: /* @__PURE__ */ j({
128
+ props: /* @__PURE__ */ q({
129
129
  files: {},
130
130
  api: {},
131
131
  query: {},
@@ -134,79 +134,82 @@ const Te = /* @__PURE__ */ O({
134
134
  selected: { default: () => [] },
135
135
  selectedModifiers: {}
136
136
  }),
137
- emits: /* @__PURE__ */ j(["open", "rename", "edit", "remove"], ["update:selected"]),
138
- setup(t, { emit: i }) {
139
- const o = t, l = I(t, "selected"), c = i, s = X("webx-media"), a = U(
140
- () => o.query ? s("manager.empty-search", { query: o.query }) : s("manager.empty")
137
+ emits: /* @__PURE__ */ q(["open", "rename", "edit", "remove"], ["update:selected"]),
138
+ setup(a, { emit: i }) {
139
+ const n = a, l = A(a, "selected"), r = i, d = H("webx-media"), v = z(
140
+ () => n.query ? d("manager.empty-search", { query: n.query }) : d("manager.empty")
141
141
  );
142
- function n() {
143
- Q.success(s("manager.link-copied"));
142
+ function t() {
143
+ J.success(d("manager.link-copied"));
144
144
  }
145
- function k(w) {
146
- const u = document.createElement("textarea");
147
- u.value = w.url, u.setAttribute("readonly", ""), u.style.position = "fixed", u.style.opacity = "0", document.body.appendChild(u), u.select();
148
- let r = !1;
145
+ function x(y) {
146
+ const s = document.createElement("textarea");
147
+ s.value = y.url, s.setAttribute("readonly", ""), s.style.position = "fixed", s.style.opacity = "0", document.body.appendChild(s), s.select();
148
+ let u = !1;
149
149
  try {
150
- r = document.execCommand("copy");
150
+ u = document.execCommand("copy");
151
151
  } catch {
152
- r = !1;
152
+ u = !1;
153
153
  }
154
- if (u.remove(), r) {
155
- n();
154
+ if (s.remove(), u) {
155
+ t();
156
156
  return;
157
157
  }
158
- Q.danger(`${s("errors.copy")} ${w.url}`, { duration: 0 });
158
+ J.danger(`${d("errors.copy")} ${y.url}`, { duration: 0 });
159
159
  }
160
- return (w, u) => {
161
- const r = Ke("wx-select");
162
- return t.files.length > 0 ? (b(), T(e(tt), {
160
+ return (y, s) => {
161
+ const u = Ge("wx-select");
162
+ return a.files.length > 0 ? (b(), T(e(it), {
163
163
  key: 0,
164
164
  modelValue: l.value,
165
- "onUpdate:modelValue": u[0] || (u[0] = (g) => l.value = g),
165
+ "onUpdate:modelValue": s[0] || (s[0] = (k) => l.value = k),
166
166
  class: "wx-media-grid",
167
- multiple: !t.single
167
+ multiple: !a.single
168
168
  }, {
169
- default: x(({ isSelected: g }) => [
170
- (b(!0), W(se, null, re(t.files, (f) => je((b(), T(e(Ue), {
171
- key: f.id,
169
+ default: w(({ isSelected: k }) => [
170
+ (b(!0), L(ce, null, me(a.files, (h) => Ye((b(), T(e(Le), {
171
+ key: h.id,
172
172
  class: "wx-media-grid__card",
173
- name: f.name,
174
- url: f.url,
175
- thumbnail: t.api.thumb(f, 320, 320) ?? void 0,
176
- type: f.mime,
177
- selected: g(f.id),
173
+ name: h.name,
174
+ url: h.url,
175
+ thumbnail: a.api.thumb(h, 320, 320) ?? void 0,
176
+ type: h.mime,
177
+ selected: k(h.id),
178
178
  renamable: "",
179
- editable: f.editable,
179
+ editable: h.editable,
180
180
  removable: "",
181
181
  copyable: "",
182
- "rename-label": e(s)("manager.rename"),
183
- "edit-label": e(s)("manager.edit"),
184
- "remove-label": e(s)("manager.delete"),
185
- "remove-confirm-text": e(s)("dialogs.delete-file", { name: f.name }),
186
- "cancel-label": e(s)("manager.cancel"),
187
- "save-label": e(s)("manager.save"),
188
- "copy-label": e(s)("manager.copy-link"),
189
- "copied-label": e(s)("manager.link-copied"),
190
- onRename: (d) => c("rename", f, d),
191
- onEdit: (d) => c("edit", f),
192
- onRemove: (d) => c("remove", f),
193
- onCopy: n,
194
- onCopyError: (d) => k(f),
195
- onDblclick: (d) => c("open", f)
196
- }, 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"])), [
197
- [r, f.id]
182
+ "actions-menu": "",
183
+ "rename-label": e(d)("manager.rename"),
184
+ "edit-label": e(d)("manager.edit"),
185
+ "remove-label": e(d)("manager.delete"),
186
+ "remove-confirm-text": e(d)("dialogs.delete-file", { name: h.name }),
187
+ "cancel-label": e(d)("manager.cancel"),
188
+ "save-label": e(d)("manager.save"),
189
+ "download-url": h.source ?? h.url,
190
+ "copy-label": e(d)("manager.copy-link"),
191
+ "download-label": e(d)("manager.download"),
192
+ "copied-label": e(d)("manager.link-copied"),
193
+ onRename: (o) => r("rename", h, o),
194
+ onEdit: (o) => r("edit", h),
195
+ onRemove: (o) => r("remove", h),
196
+ onCopy: t,
197
+ onCopyError: (o) => x(h),
198
+ onDblclick: (o) => r("open", h)
199
+ }, null, 8, ["name", "url", "thumbnail", "type", "selected", "editable", "rename-label", "edit-label", "remove-label", "remove-confirm-text", "cancel-label", "save-label", "download-url", "copy-label", "download-label", "copied-label", "onRename", "onEdit", "onRemove", "onCopyError", "onDblclick"])), [
200
+ [u, h.id]
198
201
  ])), 128))
199
202
  ]),
200
203
  _: 1
201
- }, 8, ["modelValue", "multiple"])) : (b(), T(e(lt), {
204
+ }, 8, ["modelValue", "multiple"])) : (b(), T(e(nt), {
202
205
  key: 1,
203
- description: a.value
206
+ description: v.value
204
207
  }, null, 8, ["description"]));
205
208
  };
206
209
  }
207
- }), ft = { class: "wx-media-toolbar" }, vt = /* @__PURE__ */ O({
210
+ }), yt = { class: "wx-media-toolbar" }, ht = /* @__PURE__ */ S({
208
211
  __name: "MediaToolbar",
209
- props: /* @__PURE__ */ j({
212
+ props: /* @__PURE__ */ q({
210
213
  canUpload: { type: Boolean },
211
214
  canManage: { type: Boolean },
212
215
  selected: {},
@@ -220,155 +223,155 @@ const Te = /* @__PURE__ */ O({
220
223
  sort: { default: "-created_at" },
221
224
  sortModifiers: {}
222
225
  }),
223
- emits: /* @__PURE__ */ j(["upload", "move", "remove", "folders"], ["update:search", "update:type", "update:sort"]),
224
- setup(t, { emit: i }) {
225
- const o = t, l = I(t, "search"), c = I(t, "type"), s = I(t, "sort"), a = i, n = X("webx-media"), k = U(() => [
226
- { value: "all", label: n("manager.all-types") },
227
- ...["image", "video", "audio", "document", "other"].map((g) => ({
228
- value: g,
229
- label: n(`manager.${g}`)
226
+ emits: /* @__PURE__ */ q(["upload", "move", "remove", "folders"], ["update:search", "update:type", "update:sort"]),
227
+ setup(a, { emit: i }) {
228
+ const n = a, l = A(a, "search"), r = A(a, "type"), d = A(a, "sort"), v = i, t = H("webx-media"), x = z(() => [
229
+ { value: "all", label: t("manager.all-types") },
230
+ ...["image", "video", "audio", "document", "other"].map((k) => ({
231
+ value: k,
232
+ label: t(`manager.${k}`)
230
233
  }))
231
- ]), w = U(() => [
232
- { value: "-created_at", label: n("manager.sort-newest") },
233
- { value: "created_at", label: n("manager.sort-oldest") },
234
- { value: "name", label: n("manager.sort-name") },
235
- { value: "-size", label: n("manager.sort-size") }
236
- ]), u = U(() => k.value.find((g) => g.value === c.value)?.label ?? ""), r = U(() => w.value.find((g) => g.value === s.value)?.label ?? "");
237
- return (g, f) => (b(), W("header", ft, [
238
- t.compact ? (b(), T(e(D), {
234
+ ]), y = z(() => [
235
+ { value: "-created_at", label: t("manager.sort-newest") },
236
+ { value: "created_at", label: t("manager.sort-oldest") },
237
+ { value: "name", label: t("manager.sort-name") },
238
+ { value: "-size", label: t("manager.sort-size") }
239
+ ]), s = z(() => x.value.find((k) => k.value === r.value)?.label ?? ""), u = z(() => y.value.find((k) => k.value === d.value)?.label ?? "");
240
+ return (k, h) => (b(), L("header", yt, [
241
+ a.compact ? (b(), T(e(B), {
239
242
  key: 0,
240
- icon: "folder",
241
- title: e(n)("manager.folders"),
243
+ icon: "sidebar",
244
+ title: e(t)("manager.folders"),
242
245
  size: "sm",
243
- onClick: f[0] || (f[0] = (d) => a("folders"))
244
- }, null, 8, ["title"])) : R("", !0),
245
- v(e(Z), {
246
+ onClick: h[0] || (h[0] = (o) => v("folders"))
247
+ }, null, 8, ["title"])) : D("", !0),
248
+ g(e(Z), {
246
249
  modelValue: l.value,
247
- "onUpdate:modelValue": f[1] || (f[1] = (d) => l.value = d),
250
+ "onUpdate:modelValue": h[1] || (h[1] = (o) => l.value = o),
248
251
  class: "wx-media-toolbar__search",
249
- placeholder: e(n)("manager.search"),
252
+ placeholder: e(t)("manager.search"),
250
253
  clearable: "",
251
254
  size: "sm"
252
255
  }, null, 8, ["modelValue", "placeholder"]),
253
- t.fixedType ? R("", !0) : (b(), T(e(Ce), { key: 1 }, {
254
- trigger: x(() => [
255
- v(e(D), {
256
+ a.fixedType ? D("", !0) : (b(), T(e(Ve), { key: 1 }, {
257
+ trigger: w(() => [
258
+ g(e(B), {
256
259
  icon: "filter",
257
- title: `${e(n)("manager.all-types")}: ${u.value}`,
260
+ title: `${e(t)("manager.all-types")}: ${s.value}`,
258
261
  size: "sm"
259
262
  }, null, 8, ["title"])
260
263
  ]),
261
- default: x(() => [
262
- (b(!0), W(se, null, re(k.value, (d) => (b(), T(e(Ve), {
263
- key: String(d.value),
264
- active: d.value === c.value,
265
- onClick: ($) => c.value = d.value
264
+ default: w(() => [
265
+ (b(!0), L(ce, null, me(x.value, (o) => (b(), T(e(Te), {
266
+ key: String(o.value),
267
+ active: o.value === r.value,
268
+ onClick: ($) => r.value = o.value
266
269
  }, {
267
- default: x(() => [
268
- N(z(d.label), 1)
270
+ default: w(() => [
271
+ O(U(o.label), 1)
269
272
  ]),
270
273
  _: 2
271
274
  }, 1032, ["active", "onClick"]))), 128))
272
275
  ]),
273
276
  _: 1
274
277
  })),
275
- v(e(Ce), null, {
276
- trigger: x(() => [
277
- v(e(D), {
278
+ g(e(Ve), null, {
279
+ trigger: w(() => [
280
+ g(e(B), {
278
281
  icon: "arrow-down",
279
- title: r.value,
282
+ title: u.value,
280
283
  size: "sm"
281
284
  }, null, 8, ["title"])
282
285
  ]),
283
- default: x(() => [
284
- (b(!0), W(se, null, re(w.value, (d) => (b(), T(e(Ve), {
285
- key: d.value,
286
- active: d.value === s.value,
287
- onClick: ($) => s.value = d.value
286
+ default: w(() => [
287
+ (b(!0), L(ce, null, me(y.value, (o) => (b(), T(e(Te), {
288
+ key: o.value,
289
+ active: o.value === d.value,
290
+ onClick: ($) => d.value = o.value
288
291
  }, {
289
- default: x(() => [
290
- N(z(d.label), 1)
292
+ default: w(() => [
293
+ O(U(o.label), 1)
291
294
  ]),
292
295
  _: 2
293
296
  }, 1032, ["active", "onClick"]))), 128))
294
297
  ]),
295
298
  _: 1
296
299
  }),
297
- t.canUpload ? (b(), T(e(D), {
300
+ a.canUpload ? (b(), T(e(B), {
298
301
  key: 2,
299
302
  type: "upload",
300
- title: e(n)("manager.upload"),
303
+ title: e(t)("manager.upload"),
301
304
  size: "sm",
302
- onClick: f[2] || (f[2] = (d) => a("upload"))
303
- }, null, 8, ["title"])) : R("", !0),
304
- t.canManage ? (b(), T(e(le), {
305
+ onClick: h[2] || (h[2] = (o) => v("upload"))
306
+ }, null, 8, ["title"])) : D("", !0),
307
+ a.canManage ? (b(), T(e(le), {
305
308
  key: 3,
306
309
  size: "sm"
307
310
  }, {
308
- default: x(() => [
309
- v(e(D), {
310
- icon: "folder",
311
- title: e(n)("manager.move"),
312
- disabled: o.selected === 0,
313
- onClick: f[3] || (f[3] = (d) => a("move"))
311
+ default: w(() => [
312
+ g(e(B), {
313
+ icon: "folder-move",
314
+ title: e(t)("manager.move"),
315
+ disabled: n.selected === 0,
316
+ onClick: h[3] || (h[3] = (o) => v("move"))
314
317
  }, null, 8, ["title", "disabled"]),
315
- v(e(D), {
318
+ g(e(B), {
316
319
  type: "remove",
317
- title: e(n)("manager.delete"),
318
- disabled: o.selected === 0,
319
- onClick: f[4] || (f[4] = (d) => a("remove"))
320
+ title: e(t)("manager.delete"),
321
+ disabled: n.selected === 0,
322
+ onClick: h[4] || (h[4] = (o) => v("remove"))
320
323
  }, null, 8, ["title", "disabled"])
321
324
  ]),
322
325
  _: 1
323
- })) : R("", !0)
326
+ })) : D("", !0)
324
327
  ]));
325
328
  }
326
- }), gt = /* @__PURE__ */ O({
329
+ }), bt = /* @__PURE__ */ S({
327
330
  __name: "MoveDialog",
328
331
  props: {
329
332
  directories: {},
330
333
  from: {},
331
334
  count: {}
332
335
  },
333
- setup(t) {
334
- const i = t, { open: o, resolve: l, dismiss: c } = ve(), s = X("webx-media"), a = U(
335
- () => k(i.directories).filter((w) => w.value !== i.from)
336
- ), n = L(a.value[0]?.value ?? null);
337
- function k(w) {
338
- return w.flatMap((u) => [
336
+ setup(a) {
337
+ const i = a, { open: n, resolve: l, dismiss: r } = ye(), d = H("webx-media"), v = z(
338
+ () => x(i.directories).filter((y) => y.value !== i.from)
339
+ ), t = R(v.value[0]?.value ?? null);
340
+ function x(y) {
341
+ return y.flatMap((s) => [
339
342
  {
340
- value: u.id,
343
+ value: s.id,
341
344
  // Indented, so the tree is still readable once it is a flat list.
342
- label: " ".repeat(u.depth * 3) + (u.is_root ? s("manager.root") : u.title)
345
+ label: " ".repeat(s.depth * 3) + (s.is_root ? d("manager.root") : s.title)
343
346
  },
344
- ...k(u.children ?? [])
347
+ ...x(s.children ?? [])
345
348
  ]);
346
349
  }
347
- return (w, u) => (b(), T(e(ge), {
348
- open: e(o),
349
- "onUpdate:open": u[3] || (u[3] = (r) => me(o) ? o.value = r : null),
350
- title: e(s)("manager.move-to"),
350
+ return (y, s) => (b(), T(e(he), {
351
+ open: e(n),
352
+ "onUpdate:open": s[3] || (s[3] = (u) => ve(n) ? n.value = u : null),
353
+ title: e(d)("manager.move-to"),
351
354
  width: 420
352
355
  }, {
353
- footer: x(() => [
354
- v(e(ye), { size: "sm" }, {
355
- default: x(() => [
356
- v(e(H), {
356
+ footer: w(() => [
357
+ g(e(be), { size: "sm" }, {
358
+ default: w(() => [
359
+ g(e(I), {
357
360
  variant: "outline",
358
- onClick: u[1] || (u[1] = (r) => e(c)())
361
+ onClick: s[1] || (s[1] = (u) => e(r)())
359
362
  }, {
360
- default: x(() => [
361
- N(z(e(s)("manager.cancel")), 1)
363
+ default: w(() => [
364
+ O(U(e(d)("manager.cancel")), 1)
362
365
  ]),
363
366
  _: 1
364
367
  }),
365
- v(e(H), {
368
+ g(e(I), {
366
369
  type: "primary",
367
- disabled: n.value === null,
368
- onClick: u[2] || (u[2] = (r) => e(l)(n.value))
370
+ disabled: t.value === null,
371
+ onClick: s[2] || (s[2] = (u) => e(l)(t.value))
369
372
  }, {
370
- default: x(() => [
371
- N(z(e(s)("manager.move")), 1)
373
+ default: w(() => [
374
+ O(U(e(d)("manager.move")), 1)
372
375
  ]),
373
376
  _: 1
374
377
  }, 8, ["disabled"])
@@ -376,17 +379,17 @@ const Te = /* @__PURE__ */ O({
376
379
  _: 1
377
380
  })
378
381
  ]),
379
- default: x(() => [
380
- v(e(at), {
381
- modelValue: n.value,
382
- "onUpdate:modelValue": u[0] || (u[0] = (r) => n.value = r),
383
- options: a.value
382
+ default: w(() => [
383
+ g(e(ot), {
384
+ modelValue: t.value,
385
+ "onUpdate:modelValue": s[0] || (s[0] = (u) => t.value = u),
386
+ options: v.value
384
387
  }, null, 8, ["modelValue", "options"])
385
388
  ]),
386
389
  _: 1
387
390
  }, 8, ["open", "title"]));
388
391
  }
389
- }), yt = /* @__PURE__ */ O({
392
+ }), wt = /* @__PURE__ */ S({
390
393
  __name: "NameDialog",
391
394
  props: {
392
395
  title: {},
@@ -394,40 +397,40 @@ const Te = /* @__PURE__ */ O({
394
397
  value: { default: "" },
395
398
  confirmText: { default: void 0 }
396
399
  },
397
- setup(t) {
398
- const i = t, { open: o, resolve: l, dismiss: c } = ve(), s = X("webx-media"), a = L(i.value), n = de("input");
400
+ setup(a) {
401
+ const i = a, { open: n, resolve: l, dismiss: r } = ye(), d = H("webx-media"), v = R(i.value), t = oe("input");
399
402
  Fe(async () => {
400
- await Ge(), n.value?.querySelector("input")?.focus();
403
+ await Je(), t.value?.querySelector("input")?.focus();
401
404
  });
402
- function k() {
403
- const w = a.value.trim();
404
- w !== "" && l(w);
405
+ function x() {
406
+ const y = v.value.trim();
407
+ y !== "" && l(y);
405
408
  }
406
- return (w, u) => (b(), T(e(ge), {
407
- open: e(o),
408
- "onUpdate:open": u[2] || (u[2] = (r) => me(o) ? o.value = r : null),
409
- title: t.title,
409
+ return (y, s) => (b(), T(e(he), {
410
+ open: e(n),
411
+ "onUpdate:open": s[2] || (s[2] = (u) => ve(n) ? n.value = u : null),
412
+ title: a.title,
410
413
  width: 420
411
414
  }, {
412
- footer: x(() => [
413
- v(e(ye), { size: "sm" }, {
414
- default: x(() => [
415
- v(e(H), {
415
+ footer: w(() => [
416
+ g(e(be), { size: "sm" }, {
417
+ default: w(() => [
418
+ g(e(I), {
416
419
  variant: "outline",
417
- onClick: u[1] || (u[1] = (r) => e(c)())
420
+ onClick: s[1] || (s[1] = (u) => e(r)())
418
421
  }, {
419
- default: x(() => [
420
- N(z(e(s)("manager.cancel")), 1)
422
+ default: w(() => [
423
+ O(U(e(d)("manager.cancel")), 1)
421
424
  ]),
422
425
  _: 1
423
426
  }),
424
- v(e(H), {
427
+ g(e(I), {
425
428
  type: "primary",
426
- disabled: a.value.trim() === "",
427
- onClick: k
429
+ disabled: v.value.trim() === "",
430
+ onClick: x
428
431
  }, {
429
- default: x(() => [
430
- N(z(t.confirmText ?? e(s)("manager.save")), 1)
432
+ default: w(() => [
433
+ O(U(a.confirmText ?? e(d)("manager.save")), 1)
431
434
  ]),
432
435
  _: 1
433
436
  }, 8, ["disabled"])
@@ -435,24 +438,24 @@ const Te = /* @__PURE__ */ O({
435
438
  _: 1
436
439
  })
437
440
  ]),
438
- default: x(() => [
439
- M("div", {
441
+ default: w(() => [
442
+ V("div", {
440
443
  ref_key: "input",
441
- ref: n
444
+ ref: t
442
445
  }, [
443
- v(e(Z), {
444
- modelValue: a.value,
445
- "onUpdate:modelValue": u[0] || (u[0] = (r) => a.value = r),
446
- placeholder: t.label ?? e(s)("manager.folder-name"),
447
- "aria-label": t.label ?? e(s)("manager.folder-name"),
448
- onKeyup: Ye(k, ["enter"])
446
+ g(e(Z), {
447
+ modelValue: v.value,
448
+ "onUpdate:modelValue": s[0] || (s[0] = (u) => v.value = u),
449
+ placeholder: a.label ?? e(d)("manager.folder-name"),
450
+ "aria-label": a.label ?? e(d)("manager.folder-name"),
451
+ onKeyup: Qe(x, ["enter"])
449
452
  }, null, 8, ["modelValue", "placeholder", "aria-label"])
450
453
  ], 512)
451
454
  ]),
452
455
  _: 1
453
456
  }, 8, ["open", "title"]));
454
457
  }
455
- }), ht = {
458
+ }), xt = {
456
459
  module: {
457
460
  title: "Files"
458
461
  },
@@ -488,6 +491,7 @@ const Te = /* @__PURE__ */ O({
488
491
  folders: "Folders",
489
492
  edit: "Edit",
490
493
  "copy-link": "Copy the link",
494
+ download: "Download",
491
495
  "link-copied": "Link copied",
492
496
  "status-files": "Files: :count",
493
497
  "status-selected": "selected: :count",
@@ -543,6 +547,7 @@ const Te = /* @__PURE__ */ O({
543
547
  "delete-files-title": "Delete :count file(s)?",
544
548
  "delete-files-text": "Anywhere they are already used, they will stop opening.",
545
549
  "delete-folder-title": "Delete the folder :title?",
550
+ "delete-folder-text": "It goes for good, and so does whatever is inside it.",
546
551
  "delete-folder-contents": "It holds :files file(s) and :directories folder(s).",
547
552
  "delete-folder-warning": "Everything inside goes too, and pictures already placed in content will stop opening.",
548
553
  confirm: "Delete",
@@ -581,374 +586,384 @@ const Te = /* @__PURE__ */ O({
581
586
  other: "other files"
582
587
  }
583
588
  }
584
- }, ze = /* @__PURE__ */ new WeakSet();
585
- function be() {
589
+ }, Ue = /* @__PURE__ */ new WeakSet();
590
+ function re() {
586
591
  try {
587
- const { i18n: t } = fe();
588
- ze.has(t) || (t.defaults("webx-media", ht), ze.add(t));
592
+ const { i18n: a } = se();
593
+ Ue.has(a) || (a.defaults("webx-media", xt), Ue.add(a));
589
594
  } catch {
590
595
  }
591
596
  }
592
- const bt = {
597
+ const kt = {
593
598
  key: 0,
594
599
  class: "wx-media__folders"
595
- }, wt = { class: "wx-media__files" }, xt = ["accept"], kt = { class: "wx-media__status" }, $t = { key: 0 }, _t = { class: "wx-media__drawer" }, De = /* @__PURE__ */ O({
600
+ }, $t = { class: "wx-media__files" }, _t = ["accept"], Ct = { class: "wx-media__status" }, Mt = { key: 0 }, Vt = { class: "wx-media__drawer" }, Se = /* @__PURE__ */ S({
596
601
  __name: "MediaManager",
597
- props: {
602
+ props: /* @__PURE__ */ q({
598
603
  picking: { type: Boolean, default: !1 },
599
604
  accept: { default: null },
600
605
  multiple: { type: Boolean, default: !1 },
601
- max: { default: null }
602
- },
603
- emits: ["pick", "selection"],
604
- setup(t, { emit: i }) {
605
- const o = t, l = i, c = fe(), s = he(c);
606
- be();
607
- const a = X("webx-media");
608
- function n() {
606
+ max: { default: null },
607
+ inPage: { type: Boolean, default: !1 }
608
+ }, {
609
+ type: { default: "all" },
610
+ typeModifiers: {}
611
+ }),
612
+ emits: /* @__PURE__ */ q(["pick", "selection"], ["update:type"]),
613
+ setup(a, { expose: i, emit: n }) {
614
+ const l = a, r = n, d = se(), v = we(d);
615
+ re();
616
+ const t = H("webx-media"), x = et();
617
+ function y() {
609
618
  return {
610
- title: a("editor.title"),
611
- saveLabel: a("editor.save"),
612
- cancelLabel: a("editor.cancel"),
613
- resetLabel: a("editor.reset"),
614
- rotateLeftLabel: a("editor.rotate-left"),
615
- rotateRightLabel: a("editor.rotate-right"),
616
- flipHorizontalLabel: a("editor.flip-horizontal"),
617
- flipVerticalLabel: a("editor.flip-vertical"),
618
- ratioLabel: a("editor.ratio"),
619
- cropLabel: a("editor.crop"),
620
- outputLabel: a("editor.output"),
621
- outputHint: a("editor.output-hint"),
622
- widthLabel: a("editor.width"),
623
- heightLabel: a("editor.height"),
624
- freeLabel: a("editor.free"),
625
- originalLabel: a("editor.original"),
626
- errorText: a("editor.error")
619
+ title: t("editor.title"),
620
+ saveLabel: t("editor.save"),
621
+ cancelLabel: t("editor.cancel"),
622
+ resetLabel: t("editor.reset"),
623
+ rotateLeftLabel: t("editor.rotate-left"),
624
+ rotateRightLabel: t("editor.rotate-right"),
625
+ flipHorizontalLabel: t("editor.flip-horizontal"),
626
+ flipVerticalLabel: t("editor.flip-vertical"),
627
+ ratioLabel: t("editor.ratio"),
628
+ cropLabel: t("editor.crop"),
629
+ outputLabel: t("editor.output"),
630
+ outputHint: t("editor.output-hint"),
631
+ widthLabel: t("editor.width"),
632
+ heightLabel: t("editor.height"),
633
+ freeLabel: t("editor.free"),
634
+ originalLabel: t("editor.original"),
635
+ errorText: t("editor.error")
627
636
  };
628
637
  }
629
- const k = de("root"), w = it(k), u = U(() => w.value > 0 && w.value < 640), r = L([]), g = L(null), f = L(null), d = L([]), $ = L(""), B = L(o.accept ?? "all");
630
- K(
631
- () => o.accept,
632
- (m) => {
633
- B.value = m ?? "all";
638
+ const s = oe("root"), u = st(s), k = z(() => u.value > 0 && u.value < 640), h = R([]), o = R(null), $ = R(null), F = R([]), K = R(""), X = A(a, "type");
639
+ l.accept && (X.value = l.accept), G(
640
+ () => l.accept,
641
+ (p) => {
642
+ X.value = p ?? "all";
634
643
  }
635
644
  );
636
- const Y = L("-created_at"), ee = L(!1), P = L(!1), ie = de("picker"), te = U(() => f.value?.data ?? []), G = U(() => c.can("media.manage")), ne = U(() => c.can("media.upload") || G.value), E = U(() => qe(g.value)), oe = U(() => o.picking && !o.multiple);
637
- K(d, (m) => {
638
- if (o.max !== null && o.max > 0 && m.length > o.max) {
639
- d.value = m.slice(0, o.max);
645
+ const N = R("-created_at"), ee = R(!1), j = R(!1), te = oe("picker"), ie = z(() => $.value?.data ?? []), Q = z(() => d.can("media.manage")), de = z(() => d.can("media.upload") || Q.value), E = z(() => He(o.value)), ne = z(() => l.picking && !l.multiple);
646
+ G(F, (p) => {
647
+ if (l.max !== null && l.max > 0 && p.length > l.max) {
648
+ F.value = p.slice(0, l.max);
640
649
  return;
641
650
  }
642
- l(
651
+ r(
643
652
  "selection",
644
- te.value.filter((p) => m.includes(p.id))
653
+ ie.value.filter((f) => p.includes(f.id))
645
654
  );
646
- }), Fe(A), K([g, B, Y], () => S(1)), K(
647
- $,
648
- He(() => S(1), 300)
649
- ), K(u, (m) => {
650
- m || (P.value = !1);
655
+ }), Fe(c), G([o, X, N], () => m(1)), G(
656
+ K,
657
+ Ke(() => m(1), 300)
658
+ ), G(k, (p) => {
659
+ p || (j.value = !1);
651
660
  });
652
- async function A() {
653
- r.value = await s.directories(), g.value ??= r.value[0]?.id ?? null, await S(1);
661
+ async function c() {
662
+ h.value = await v.directories(), o.value ??= h.value[0]?.id ?? null, await m(1);
654
663
  }
655
- async function S(m = f.value?.meta.current_page ?? 1) {
664
+ async function m(p = $.value?.meta.current_page ?? 1) {
656
665
  ee.value = !0;
657
666
  try {
658
- f.value = await s.files({
659
- directory_id: $.value ? null : g.value,
660
- q: $.value,
661
- type: B.value === "all" ? null : B.value,
662
- sort: Y.value,
663
- page: m
664
- }), d.value = [];
667
+ $.value = await v.files({
668
+ directory_id: K.value ? null : o.value,
669
+ q: K.value,
670
+ type: X.value === "all" ? null : X.value,
671
+ sort: N.value,
672
+ page: p
673
+ }), F.value = [];
665
674
  } finally {
666
675
  ee.value = !1;
667
676
  }
668
677
  }
669
- function y() {
670
- ie.value?.click();
678
+ function M() {
679
+ te.value?.click();
671
680
  }
672
- async function h(m) {
673
- const p = m.target, _ = Array.from(p.files ?? []);
674
- if (p.value = "", !(_.length === 0 || g.value === null))
681
+ async function C(p) {
682
+ const f = p.target, _ = Array.from(f.files ?? []);
683
+ if (f.value = "", !(_.length === 0 || o.value === null))
675
684
  try {
676
- const q = await s.upload(g.value, _), J = q.filter((Xe) => Xe.duplicate).length;
677
- q.length > J && Q.success(a("manager.uploaded", { count: q.length - J })), J > 0 && Q.info(a("manager.duplicate-added")), await Promise.all([A(), S(1)]);
678
- } catch (q) {
679
- Q.danger(_e(q) ?? a("errors.upload"));
685
+ const P = await v.upload(o.value, _), Y = P.filter((je) => je.duplicate).length;
686
+ P.length > Y && J.success(t("manager.uploaded", { count: P.length - Y })), Y > 0 && J.info(t("manager.duplicate-added")), await Promise.all([c(), m(1)]);
687
+ } catch (P) {
688
+ J.danger(x(P, t("errors.upload")));
680
689
  }
681
690
  }
682
- const V = ae(yt);
683
- async function C() {
684
- const m = await V({
685
- title: a("manager.new-folder"),
686
- confirmText: a("manager.new-folder")
691
+ const W = ae(wt);
692
+ async function $e() {
693
+ const p = await W({
694
+ title: t("manager.new-folder"),
695
+ confirmText: t("manager.new-folder")
687
696
  });
688
- m === void 0 || g.value === null || (await s.createDirectory(g.value, m), await A());
697
+ p === void 0 || o.value === null || (await v.createDirectory(o.value, p), await c());
689
698
  }
690
- async function F() {
691
- const m = E.value;
692
- if (!m || m.is_root)
699
+ async function _e() {
700
+ const p = E.value;
701
+ if (!p || p.is_root)
693
702
  return;
694
- const p = await V({
695
- title: a("manager.rename"),
696
- value: m.title,
697
- confirmText: a("manager.save")
703
+ const f = await W({
704
+ title: t("manager.rename"),
705
+ value: p.title,
706
+ confirmText: t("manager.save")
698
707
  });
699
- p !== void 0 && (await s.renameDirectory(m.id, p), await A());
708
+ f !== void 0 && (await v.renameDirectory(p.id, f), await c());
700
709
  }
701
- async function ke() {
702
- const m = E.value;
703
- if (!(!m || m.is_root)) {
710
+ async function Ce() {
711
+ const p = E.value;
712
+ if (!(!p || p.is_root || !await ue({
713
+ title: t("dialogs.delete-folder-title", { title: p.title }),
714
+ message: t("dialogs.delete-folder-text"),
715
+ confirmText: t("dialogs.confirm"),
716
+ cancelText: t("manager.cancel"),
717
+ tone: "danger"
718
+ }))) {
704
719
  try {
705
- await s.deleteDirectory(m.id);
706
- } catch (p) {
707
- const _ = Ie(p);
708
- if (!_)
709
- throw p;
710
- if (!await Me({
711
- title: a("dialogs.delete-folder-title", { title: m.title }),
712
- message: `${a("dialogs.delete-folder-contents", _)} ${a("dialogs.delete-folder-warning")}`,
713
- confirmText: a("dialogs.confirm"),
714
- cancelText: a("manager.cancel"),
720
+ await v.deleteDirectory(p.id);
721
+ } catch (_) {
722
+ const P = Xe(_);
723
+ if (!P) {
724
+ J.danger(x(_));
725
+ return;
726
+ }
727
+ if (!await ue({
728
+ title: t("dialogs.delete-folder-title", { title: p.title }),
729
+ message: `${t("dialogs.delete-folder-contents", P)} ${t("dialogs.delete-folder-warning")}`,
730
+ confirmText: t("dialogs.confirm"),
731
+ cancelText: t("manager.cancel"),
715
732
  tone: "danger"
716
733
  }))
717
734
  return;
718
- await s.deleteDirectory(m.id, !0);
735
+ await v.deleteDirectory(p.id, !0);
719
736
  }
720
- g.value = null, await A();
737
+ o.value = null, await c();
721
738
  }
722
739
  }
723
- async function $e(m, p) {
740
+ async function Me(p, f) {
724
741
  try {
725
- await s.moveDirectory(m, p);
742
+ await v.moveDirectory(p, f);
726
743
  } catch (_) {
727
- Q.danger(_e(_) ?? a("errors.directory-into-itself"));
744
+ J.danger(x(_, t("errors.directory-into-itself")));
728
745
  }
729
- await A();
746
+ await c();
730
747
  }
731
- const Be = ae(gt);
732
- async function Se() {
733
- const m = await Be({
734
- directories: r.value,
735
- from: g.value,
736
- count: d.value.length
748
+ const Ee = ae(bt);
749
+ async function Pe() {
750
+ const p = await Ee({
751
+ directories: h.value,
752
+ from: o.value,
753
+ count: F.value.length
737
754
  });
738
- m !== void 0 && (await s.move([...d.value], m), await Promise.all([A(), S()]));
755
+ p !== void 0 && (await v.move([...F.value], p), await Promise.all([c(), m()]));
739
756
  }
740
757
  async function Oe() {
741
- const m = [...d.value];
742
- await Me({
743
- title: a("dialogs.delete-files-title", { count: m.length }),
744
- message: a("dialogs.delete-files-text"),
745
- confirmText: a("dialogs.confirm"),
746
- cancelText: a("manager.cancel"),
758
+ const p = [...F.value];
759
+ await ue({
760
+ title: t("dialogs.delete-files-title", { count: p.length }),
761
+ message: t("dialogs.delete-files-text"),
762
+ confirmText: t("dialogs.confirm"),
763
+ cancelText: t("manager.cancel"),
747
764
  tone: "danger"
748
- }) && (await s.remove(m), await Promise.all([A(), S()]));
765
+ }) && (await v.remove(p), await Promise.all([c(), m()]));
749
766
  }
750
- async function Ee(m, p) {
751
- await s.rename(m.id, p), await S();
767
+ async function Ae(p, f) {
768
+ await v.rename(p.id, f), await m();
752
769
  }
753
- async function Pe(m) {
754
- await s.removeOne(m.id), await Promise.all([A(), S()]);
770
+ async function Ne(p) {
771
+ await v.removeOne(p.id), await Promise.all([c(), m()]);
755
772
  }
756
- async function Ae(m) {
757
- const p = await st({
758
- src: m.source ?? m.url,
759
- fileName: m.file_name,
773
+ async function qe(p) {
774
+ const f = await ut({
775
+ src: p.source ?? p.url,
776
+ fileName: p.file_name,
760
777
  filters: !1,
761
778
  // The editor is a component of the design system: its words are props with English
762
779
  // defaults, not lines in the panel's dictionary. Whoever opens it is the one who knows
763
780
  // what language the panel is being read in.
764
- ...n()
781
+ ...y()
765
782
  });
766
- p && (await s.edit(m.id, {
783
+ f && (await v.edit(p.id, {
767
784
  // The editor's frame is read against the picture as it is on screen — already turned — and
768
785
  // the server applies the operations in that order for the same reason.
769
- crop: p.crop,
770
- rotate: (p.rotation % 360 + 360) % 360,
771
- flip: p.flipX ? "horizontal" : p.flipY ? "vertical" : void 0,
772
- resize: { width: p.width, height: p.height }
773
- }), await S());
786
+ crop: f.crop,
787
+ rotate: (f.rotation % 360 + 360) % 360,
788
+ flip: f.flipX ? "horizontal" : f.flipY ? "vertical" : void 0,
789
+ resize: { width: f.width, height: f.height }
790
+ }), await m());
774
791
  }
775
- function Ne(m) {
776
- o.multiple || l("pick", m);
792
+ function Ie(p) {
793
+ l.multiple || r("pick", p);
777
794
  }
778
- function qe(m) {
779
- const p = (_) => {
780
- for (const q of _) {
781
- if (q.id === m)
782
- return q;
783
- const J = p(q.children ?? []);
784
- if (J)
785
- return J;
795
+ function He(p) {
796
+ const f = (_) => {
797
+ for (const P of _) {
798
+ if (P.id === p)
799
+ return P;
800
+ const Y = f(P.children ?? []);
801
+ if (Y)
802
+ return Y;
786
803
  }
787
804
  return null;
788
805
  };
789
- return m === null ? null : p(r.value);
790
- }
791
- function Ie(m) {
792
- const p = m?.body;
793
- return p?.code === "directory_not_empty" ? p.counts ?? null : null;
806
+ return p === null ? null : f(h.value);
794
807
  }
795
- function _e(m) {
796
- return m?.message ?? null;
808
+ function Xe(p) {
809
+ const f = p?.body;
810
+ return f?.code === "directory_not_empty" ? f.counts ?? null : null;
797
811
  }
798
- function He(m, p) {
812
+ i({ upload: M });
813
+ function Ke(p, f) {
799
814
  let _;
800
815
  return () => {
801
- clearTimeout(_), _ = setTimeout(m, p);
816
+ clearTimeout(_), _ = setTimeout(p, f);
802
817
  };
803
818
  }
804
- return (m, p) => (b(), W("div", {
819
+ return (p, f) => (b(), L("div", {
805
820
  ref_key: "root",
806
- ref: k,
807
- class: ue(["wx-media", { "wx-media--compact": u.value }])
821
+ ref: s,
822
+ class: pe(["wx-media", { "wx-media--compact": k.value }])
808
823
  }, [
809
- u.value ? R("", !0) : (b(), W("aside", bt, [
810
- v(Te, {
811
- selected: g.value,
812
- "onUpdate:selected": p[0] || (p[0] = (_) => g.value = _),
813
- directories: r.value,
814
- onMove: $e
824
+ k.value ? D("", !0) : (b(), L("aside", kt, [
825
+ g(ze, {
826
+ selected: o.value,
827
+ "onUpdate:selected": f[0] || (f[0] = (_) => o.value = _),
828
+ directories: h.value,
829
+ onMove: Me
815
830
  }, null, 8, ["selected", "directories"]),
816
- G.value ? (b(), T(e(le), {
831
+ Q.value ? (b(), T(e(le), {
817
832
  key: 0,
818
833
  size: "sm",
819
834
  align: "start"
820
835
  }, {
821
- default: x(() => [
822
- v(e(D), {
836
+ default: w(() => [
837
+ g(e(B), {
823
838
  type: "add",
824
- title: e(a)("manager.new-folder"),
825
- onClick: C
839
+ title: e(t)("manager.new-folder"),
840
+ onClick: $e
826
841
  }, null, 8, ["title"]),
827
- v(e(D), {
842
+ g(e(B), {
828
843
  type: "edit",
829
- title: e(a)("manager.rename"),
844
+ title: e(t)("manager.rename"),
830
845
  disabled: !E.value || E.value.is_root,
831
- onClick: F
846
+ onClick: _e
832
847
  }, null, 8, ["title", "disabled"]),
833
- v(e(D), {
848
+ g(e(B), {
834
849
  type: "remove",
835
- title: e(a)("manager.delete"),
850
+ title: e(t)("manager.delete"),
836
851
  disabled: !E.value || E.value.is_root,
837
- onClick: ke
852
+ onClick: Ce
838
853
  }, null, 8, ["title", "disabled"])
839
854
  ]),
840
855
  _: 1
841
- })) : R("", !0)
856
+ })) : D("", !0)
842
857
  ])),
843
- M("section", wt, [
844
- v(vt, {
845
- search: $.value,
846
- "onUpdate:search": p[1] || (p[1] = (_) => $.value = _),
847
- type: B.value,
848
- "onUpdate:type": p[2] || (p[2] = (_) => B.value = _),
849
- sort: Y.value,
850
- "onUpdate:sort": p[3] || (p[3] = (_) => Y.value = _),
851
- "can-upload": ne.value,
852
- "fixed-type": t.accept !== null,
853
- "can-manage": G.value,
854
- selected: d.value.length,
855
- compact: u.value,
856
- onUpload: y,
857
- onMove: Se,
858
+ V("section", $t, [
859
+ g(ht, {
860
+ search: K.value,
861
+ "onUpdate:search": f[1] || (f[1] = (_) => K.value = _),
862
+ type: X.value,
863
+ "onUpdate:type": f[2] || (f[2] = (_) => X.value = _),
864
+ sort: N.value,
865
+ "onUpdate:sort": f[3] || (f[3] = (_) => N.value = _),
866
+ "can-upload": de.value && !a.inPage,
867
+ "fixed-type": a.accept !== null || a.inPage,
868
+ "can-manage": Q.value,
869
+ selected: F.value.length,
870
+ compact: k.value,
871
+ onUpload: M,
872
+ onMove: Pe,
858
873
  onRemove: Oe,
859
- onFolders: p[4] || (p[4] = (_) => P.value = !0)
874
+ onFolders: f[4] || (f[4] = (_) => j.value = !0)
860
875
  }, null, 8, ["search", "type", "sort", "can-upload", "fixed-type", "can-manage", "selected", "compact"]),
861
- M("input", {
876
+ V("input", {
862
877
  ref_key: "picker",
863
- ref: ie,
878
+ ref: te,
864
879
  type: "file",
865
880
  multiple: "",
866
881
  hidden: "",
867
- accept: t.accept === null ? void 0 : `${t.accept}/*`,
868
- onChange: h
869
- }, null, 40, xt),
870
- v(pt, {
871
- selected: d.value,
872
- "onUpdate:selected": p[5] || (p[5] = (_) => d.value = _),
873
- files: te.value,
874
- api: e(s),
875
- query: $.value,
876
- single: oe.value,
877
- onRename: Ee,
878
- onEdit: Ae,
879
- onRemove: Pe,
880
- onOpen: Ne
882
+ accept: a.accept === null ? void 0 : `${a.accept}/*`,
883
+ onChange: C
884
+ }, null, 40, _t),
885
+ g(gt, {
886
+ selected: F.value,
887
+ "onUpdate:selected": f[5] || (f[5] = (_) => F.value = _),
888
+ files: ie.value,
889
+ api: e(v),
890
+ query: K.value,
891
+ single: ne.value,
892
+ onRename: Ae,
893
+ onEdit: qe,
894
+ onRemove: Ne,
895
+ onOpen: Ie
881
896
  }, null, 8, ["selected", "files", "api", "query", "single"]),
882
- M("footer", kt, [
883
- M("span", null, z(e(a)("manager.status-files", { count: f.value?.stats.files ?? 0 })), 1),
884
- d.value.length > 0 ? (b(), W("span", $t, z(e(a)("manager.status-selected", { count: d.value.length })), 1)) : R("", !0),
885
- M("span", null, z(e(a)("manager.status-size", { size: e(Re)(f.value?.stats.size ?? 0) })), 1)
897
+ V("footer", Ct, [
898
+ V("span", null, U(e(t)("manager.status-files", { count: $.value?.stats.files ?? 0 })), 1),
899
+ F.value.length > 0 ? (b(), L("span", Mt, U(e(t)("manager.status-selected", { count: F.value.length })), 1)) : D("", !0),
900
+ V("span", null, U(e(t)("manager.status-size", { size: e(Be)($.value?.stats.size ?? 0) })), 1)
886
901
  ]),
887
- f.value && f.value.meta.last_page > 1 ? (b(), T(e(nt), {
902
+ $.value && $.value.meta.last_page > 1 ? (b(), T(e(rt), {
888
903
  key: 0,
889
- page: f.value.meta.current_page,
890
- "per-page": f.value.meta.per_page,
891
- total: f.value.meta.total,
892
- "last-page": f.value.meta.last_page,
904
+ page: $.value.meta.current_page,
905
+ "per-page": $.value.meta.per_page,
906
+ total: $.value.meta.total,
907
+ "last-page": $.value.meta.last_page,
893
908
  disabled: ee.value,
894
909
  size: "sm",
895
- onChange: p[6] || (p[6] = ({ page: _ }) => S(_))
896
- }, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) : R("", !0)
910
+ onChange: f[6] || (f[6] = ({ page: _ }) => m(_))
911
+ }, null, 8, ["page", "per-page", "total", "last-page", "disabled"])) : D("", !0)
897
912
  ]),
898
- v(e(ot), {
899
- open: P.value,
900
- "onUpdate:open": p[9] || (p[9] = (_) => P.value = _),
913
+ g(e(dt), {
914
+ open: j.value,
915
+ "onUpdate:open": f[9] || (f[9] = (_) => j.value = _),
901
916
  side: "left",
902
- title: e(a)("manager.folders"),
917
+ title: e(t)("manager.folders"),
903
918
  size: 280
904
919
  }, {
905
- default: x(() => [
906
- M("div", _t, [
907
- v(Te, {
908
- selected: g.value,
920
+ default: w(() => [
921
+ V("div", Vt, [
922
+ g(ze, {
923
+ selected: o.value,
909
924
  "onUpdate:selected": [
910
- p[7] || (p[7] = (_) => g.value = _),
911
- p[8] || (p[8] = (_) => P.value = !1)
925
+ f[7] || (f[7] = (_) => o.value = _),
926
+ f[8] || (f[8] = (_) => j.value = !1)
912
927
  ],
913
- directories: r.value,
914
- onMove: $e
928
+ directories: h.value,
929
+ onMove: Me
915
930
  }, null, 8, ["selected", "directories"]),
916
- G.value ? (b(), T(e(le), {
931
+ Q.value ? (b(), T(e(le), {
917
932
  key: 0,
918
933
  size: "sm",
919
934
  align: "start"
920
935
  }, {
921
- default: x(() => [
922
- v(e(D), {
936
+ default: w(() => [
937
+ g(e(B), {
923
938
  type: "add",
924
- title: e(a)("manager.new-folder"),
925
- onClick: C
939
+ title: e(t)("manager.new-folder"),
940
+ onClick: $e
926
941
  }, null, 8, ["title"]),
927
- v(e(D), {
942
+ g(e(B), {
928
943
  type: "edit",
929
- title: e(a)("manager.rename"),
944
+ title: e(t)("manager.rename"),
930
945
  disabled: !E.value || E.value.is_root,
931
- onClick: F
946
+ onClick: _e
932
947
  }, null, 8, ["title", "disabled"]),
933
- v(e(D), {
948
+ g(e(B), {
934
949
  type: "remove",
935
- title: e(a)("manager.delete"),
950
+ title: e(t)("manager.delete"),
936
951
  disabled: !E.value || E.value.is_root,
937
- onClick: ke
952
+ onClick: Ce
938
953
  }, null, 8, ["title", "disabled"])
939
954
  ]),
940
955
  _: 1
941
- })) : R("", !0)
956
+ })) : D("", !0)
942
957
  ])
943
958
  ]),
944
959
  _: 1
945
960
  }, 8, ["open", "title"])
946
961
  ], 2));
947
962
  }
948
- }), Ct = { class: "wx-media-picker" }, Vt = {
963
+ }), Tt = { class: "wx-media-picker" }, zt = {
949
964
  key: 0,
950
965
  class: "wx-media-picker__count"
951
- }, we = /* @__PURE__ */ O({
966
+ }, xe = /* @__PURE__ */ S({
952
967
  __name: "MediaPicker",
953
968
  props: {
954
969
  accept: { default: "image" },
@@ -957,51 +972,51 @@ const bt = {
957
972
  multiple: { type: Boolean, default: !1 },
958
973
  max: { default: null }
959
974
  },
960
- setup(t) {
961
- const { open: i, resolve: o, dismiss: l } = ve(), c = X("webx-media"), s = L([]);
962
- return (a, n) => (b(), T(e(ge), {
975
+ setup(a) {
976
+ const { open: i, resolve: n, dismiss: l } = ye(), r = H("webx-media"), d = R([]);
977
+ return (v, t) => (b(), T(e(he), {
963
978
  open: e(i),
964
- "onUpdate:open": n[4] || (n[4] = (k) => me(i) ? i.value = k : null),
965
- title: t.title ?? e(c)("module.title"),
979
+ "onUpdate:open": t[4] || (t[4] = (x) => ve(i) ? i.value = x : null),
980
+ title: a.title ?? e(r)("module.title"),
966
981
  width: 960
967
- }, Je({
968
- default: x(() => [
969
- M("div", Ct, [
970
- v(De, {
971
- picking: !t.manage,
972
- accept: t.manage ? null : t.accept,
973
- multiple: t.multiple && !t.manage,
974
- max: t.max,
975
- onPick: n[0] || (n[0] = (k) => e(o)(k)),
976
- onSelection: n[1] || (n[1] = (k) => s.value = k)
982
+ }, We({
983
+ default: w(() => [
984
+ V("div", Tt, [
985
+ g(Se, {
986
+ picking: !a.manage,
987
+ accept: a.manage ? null : a.accept,
988
+ multiple: a.multiple && !a.manage,
989
+ max: a.max,
990
+ onPick: t[0] || (t[0] = (x) => e(n)(x)),
991
+ onSelection: t[1] || (t[1] = (x) => d.value = x)
977
992
  }, null, 8, ["picking", "accept", "multiple", "max"])
978
993
  ])
979
994
  ]),
980
995
  _: 2
981
996
  }, [
982
- t.multiple && !t.manage ? {
997
+ a.multiple && !a.manage ? {
983
998
  name: "footer",
984
- fn: x(() => [
985
- v(e(ye), { size: "sm" }, {
986
- default: x(() => [
987
- t.max !== null && t.max > 0 ? (b(), W("span", Vt, z(e(c)("manager.chosen", { count: s.value.length, max: t.max })), 1)) : R("", !0),
988
- v(e(H), {
999
+ fn: w(() => [
1000
+ g(e(be), { size: "sm" }, {
1001
+ default: w(() => [
1002
+ a.max !== null && a.max > 0 ? (b(), L("span", zt, U(e(r)("manager.chosen", { count: d.value.length, max: a.max })), 1)) : D("", !0),
1003
+ g(e(I), {
989
1004
  variant: "outline",
990
- onClick: n[2] || (n[2] = (k) => e(l)())
1005
+ onClick: t[2] || (t[2] = (x) => e(l)())
991
1006
  }, {
992
- default: x(() => [
993
- N(z(e(c)("manager.cancel")), 1)
1007
+ default: w(() => [
1008
+ O(U(e(r)("manager.cancel")), 1)
994
1009
  ]),
995
1010
  _: 1
996
1011
  }),
997
- v(e(H), {
1012
+ g(e(I), {
998
1013
  class: "wx-media-picker__confirm",
999
1014
  type: "primary",
1000
- disabled: s.value.length === 0,
1001
- onClick: n[3] || (n[3] = (k) => e(o)(s.value))
1015
+ disabled: d.value.length === 0,
1016
+ onClick: t[3] || (t[3] = (x) => e(n)(d.value))
1002
1017
  }, {
1003
- default: x(() => [
1004
- N(z(e(c)("manager.pick", { count: s.value.length })), 1)
1018
+ default: w(() => [
1019
+ O(U(e(r)("manager.pick", { count: d.value.length })), 1)
1005
1020
  ]),
1006
1021
  _: 1
1007
1022
  }, 8, ["disabled"])
@@ -1013,26 +1028,26 @@ const bt = {
1013
1028
  } : void 0
1014
1029
  ]), 1032, ["open", "title"]));
1015
1030
  }
1016
- }), Mt = ae(we), Tt = ae(we, {
1031
+ }), Ut = ae(xe), Ft = ae(xe, {
1017
1032
  props: { multiple: !0 }
1018
- }), zt = ae(
1019
- we,
1033
+ }), Wt = ae(
1034
+ xe,
1020
1035
  { props: { manage: !0 } }
1021
- ), Ft = {
1036
+ ), Lt = {
1022
1037
  key: 0,
1023
1038
  class: "wx-media-list__label"
1024
- }, Ut = {
1039
+ }, Rt = {
1025
1040
  key: 0,
1026
1041
  class: "wx-media-list__missing"
1027
- }, Wt = { key: 1 }, Lt = {
1042
+ }, Dt = { key: 1 }, Bt = {
1028
1043
  key: 0,
1029
1044
  class: "wx-media-list__tools"
1030
- }, Rt = { class: "wx-media-list__captions" }, Dt = { class: "wx-media-list__caption" }, Bt = { class: "wx-media-list__caption" }, St = { class: "wx-media-list__captions-footer" }, Ot = { class: "wx-media-list__footer" }, Et = {
1045
+ }, St = { class: "wx-media-list__captions" }, Et = { class: "wx-media-list__caption" }, Pt = { class: "wx-media-list__caption" }, Ot = { class: "wx-media-list__captions-footer" }, At = { class: "wx-media-list__footer" }, Nt = {
1031
1046
  key: 0,
1032
1047
  class: "wx-media-list__hint"
1033
- }, xe = /* @__PURE__ */ O({
1048
+ }, ke = /* @__PURE__ */ S({
1034
1049
  __name: "MediaList",
1035
- props: /* @__PURE__ */ j({
1050
+ props: /* @__PURE__ */ q({
1036
1051
  label: { default: void 0 },
1037
1052
  layout: { default: "grid" },
1038
1053
  accept: { default: null },
@@ -1048,174 +1063,174 @@ const bt = {
1048
1063
  modelModifiers: {}
1049
1064
  }),
1050
1065
  emits: ["update:modelValue"],
1051
- setup(t) {
1052
- const i = t, o = I(t, "modelValue");
1053
- be();
1054
- const l = X("webx-media"), c = Qe(Ze, null), s = c ? he(c) : null, a = {
1066
+ setup(a) {
1067
+ const i = a, n = A(a, "modelValue");
1068
+ re();
1069
+ const l = H("webx-media"), r = Ze(tt, null), d = r ? we(r) : null, v = {
1055
1070
  "16/9": "16 / 9",
1056
1071
  "4/3": "4 / 3",
1057
1072
  "1/1": "1 / 1"
1058
- }, n = U({
1059
- get: () => Array.isArray(o.value) ? o.value : [],
1060
- set: (y) => {
1061
- o.value = y;
1073
+ }, t = z({
1074
+ get: () => Array.isArray(n.value) ? n.value : [],
1075
+ set: (c) => {
1076
+ n.value = c;
1062
1077
  }
1063
- }), k = U(() => i.single ? 1 : i.max ?? null), w = U(() => k.value !== null && n.value.length >= k.value), u = L({}), r = /* @__PURE__ */ new Set();
1064
- async function g(y) {
1065
- if (!s) return;
1066
- const h = y.filter((C) => !(C in u.value) && !r.has(C));
1067
- if (h.length === 0) return;
1068
- h.forEach((C) => r.add(C));
1069
- const V = await Promise.all(
1070
- h.map(async (C) => [C, await s.fileByPath(C)])
1078
+ }), x = z(() => i.single ? 1 : i.max ?? null), y = z(() => x.value !== null && t.value.length >= x.value), s = R({}), u = /* @__PURE__ */ new Set();
1079
+ async function k(c) {
1080
+ if (!d) return;
1081
+ const m = c.filter((C) => !(C in s.value) && !u.has(C));
1082
+ if (m.length === 0) return;
1083
+ m.forEach((C) => u.add(C));
1084
+ const M = await Promise.all(
1085
+ m.map(async (C) => [C, await d.fileByPath(C)])
1071
1086
  );
1072
- h.forEach((C) => r.delete(C)), u.value = { ...u.value, ...Object.fromEntries(V) };
1087
+ m.forEach((C) => u.delete(C)), s.value = { ...s.value, ...Object.fromEntries(M) };
1073
1088
  }
1074
- K(
1075
- () => n.value.map((y) => y.path),
1076
- (y) => {
1077
- g(y.filter(Boolean));
1089
+ G(
1090
+ () => t.value.map((c) => c.path),
1091
+ (c) => {
1092
+ k(c.filter(Boolean));
1078
1093
  },
1079
1094
  { immediate: !0 }
1080
1095
  );
1081
- function f(y) {
1082
- u.value = { ...u.value, ...Object.fromEntries(y.map((h) => [h.path, h])) };
1096
+ function h(c) {
1097
+ s.value = { ...s.value, ...Object.fromEntries(c.map((m) => [m.path, m])) };
1083
1098
  }
1084
- function d(y) {
1085
- return u.value[y.path];
1099
+ function o(c) {
1100
+ return s.value[c.path];
1086
1101
  }
1087
- function $(y) {
1088
- return d(y) === null;
1102
+ function $(c) {
1103
+ return o(c) === null;
1089
1104
  }
1090
- function B(y) {
1091
- return d(y)?.name ?? mt(y.path);
1105
+ function F(c) {
1106
+ return o(c)?.name ?? vt(c.path);
1092
1107
  }
1093
- function Y(y) {
1094
- const h = d(y);
1095
- return h && s ? s.thumb(h, 320, 320) ?? void 0 : void 0;
1108
+ function K(c) {
1109
+ const m = o(c);
1110
+ return m && d ? d.thumb(m, 320, 320) ?? void 0 : void 0;
1096
1111
  }
1097
- function ee(y) {
1098
- const h = d(y);
1099
- if (!h) return "";
1100
- const V = Re(h.size);
1101
- return h.width && h.height ? `${h.width}×${h.height} · ${V}` : V;
1112
+ function X(c) {
1113
+ const m = o(c);
1114
+ if (!m) return "";
1115
+ const M = Be(m.size);
1116
+ return m.width && m.height ? `${m.width}×${m.height} · ${M}` : M;
1102
1117
  }
1103
- const P = L(null);
1104
- function ie(y, h) {
1105
- return n.value.findIndex((C) => C.path === y.path) === h ? y.path : `${y.path}#${h}`;
1118
+ const N = R(null);
1119
+ function ee(c, m) {
1120
+ return t.value.findIndex((C) => C.path === c.path) === m ? c.path : `${c.path}#${m}`;
1106
1121
  }
1107
- function te(y, h) {
1108
- return n.value[y]?.[h] ?? {};
1122
+ function j(c, m) {
1123
+ return t.value[c]?.[m] ?? {};
1109
1124
  }
1110
- function G(y, h, V) {
1111
- const C = n.value[y];
1125
+ function te(c, m, M) {
1126
+ const C = t.value[c];
1112
1127
  if (!C) return;
1113
- const F = [...n.value];
1114
- F[y] = { ...C, [h]: V }, n.value = F;
1128
+ const W = [...t.value];
1129
+ W[c] = { ...C, [m]: M }, t.value = W;
1115
1130
  }
1116
- async function ne() {
1131
+ async function ie() {
1117
1132
  if (i.disabled) return;
1118
- const y = k.value === null ? null : k.value - n.value.length, h = await Tt({ accept: i.accept, max: y });
1119
- if (!h || h.length === 0) return;
1120
- f(h);
1121
- const V = new Set(n.value.map((F) => F.path)), C = h.filter((F) => !V.has(F.path)).map((F) => ({ path: F.path }));
1122
- n.value = i.single ? C.slice(0, 1) : [...n.value, ...C];
1133
+ const c = x.value === null ? null : x.value - t.value.length, m = await Ft({ accept: i.accept, max: c });
1134
+ if (!m || m.length === 0) return;
1135
+ h(m);
1136
+ const M = new Set(t.value.map((W) => W.path)), C = m.filter((W) => !M.has(W.path)).map((W) => ({ path: W.path }));
1137
+ t.value = i.single ? C.slice(0, 1) : [...t.value, ...C];
1123
1138
  }
1124
- function E(y) {
1125
- n.value = n.value.filter((h, V) => V !== y), P.value = null;
1139
+ function Q(c) {
1140
+ t.value = t.value.filter((m, M) => M !== c), N.value = null;
1126
1141
  }
1127
- async function oe(y) {
1128
- await zt({});
1129
- const h = { ...u.value };
1130
- delete h[y.path], u.value = h, g([y.path]);
1142
+ async function de(c) {
1143
+ await Wt({});
1144
+ const m = { ...s.value };
1145
+ delete m[c.path], s.value = m, k([c.path]);
1131
1146
  }
1132
- const A = U(() => {
1133
- const y = i.columns ? `repeat(${i.columns}, minmax(0, 1fr))` : "repeat(auto-fill, minmax(140px, 1fr))";
1147
+ const E = z(() => {
1148
+ const c = i.columns ? `repeat(${i.columns}, minmax(0, 1fr))` : "repeat(auto-fill, minmax(140px, 1fr))";
1134
1149
  return i.aspect ? {
1135
- "--wx-media-list-columns": y,
1136
- "--wx-media-list-aspect": a[i.aspect] ?? i.aspect
1137
- } : { "--wx-media-list-columns": y };
1138
- }), S = U(() => {
1139
- const y = n.value.length;
1140
- return i.min && y < i.min ? l("field.at-least", { count: i.min }) : k.value === null ? "" : l("field.count", { count: y, max: k.value });
1150
+ "--wx-media-list-columns": c,
1151
+ "--wx-media-list-aspect": v[i.aspect] ?? i.aspect
1152
+ } : { "--wx-media-list-columns": c };
1153
+ }), ne = z(() => {
1154
+ const c = t.value.length;
1155
+ return i.min && c < i.min ? l("field.at-least", { count: i.min }) : x.value === null ? "" : l("field.count", { count: c, max: x.value });
1141
1156
  });
1142
- return (y, h) => (b(), W("div", {
1143
- class: ue(["wx-media-list", [`wx-media-list--${t.layout}`, { "is-disabled": t.disabled }]]),
1144
- style: ce(A.value)
1157
+ return (c, m) => (b(), L("div", {
1158
+ class: pe(["wx-media-list", [`wx-media-list--${a.layout}`, { "is-disabled": a.disabled }]]),
1159
+ style: fe(E.value)
1145
1160
  }, [
1146
- t.label ? (b(), W("span", Ft, z(t.label), 1)) : R("", !0),
1147
- v(e(rt), {
1148
- modelValue: n.value,
1149
- "onUpdate:modelValue": h[1] || (h[1] = (V) => n.value = V),
1161
+ a.label ? (b(), L("span", Lt, U(a.label), 1)) : D("", !0),
1162
+ g(e(ct), {
1163
+ modelValue: t.value,
1164
+ "onUpdate:modelValue": m[1] || (m[1] = (M) => t.value = M),
1150
1165
  plain: "",
1151
- disabled: t.disabled,
1152
- handle: t.layout === "grid" ? "row" : "grip",
1153
- "item-key": ie,
1154
- "item-label": B,
1166
+ disabled: a.disabled,
1167
+ handle: a.layout === "grid" ? "row" : "grip",
1168
+ "item-key": ee,
1169
+ "item-label": F,
1155
1170
  "drag-label": e(l)("field.reorder"),
1156
1171
  "empty-text": e(l)("field.empty")
1157
1172
  }, {
1158
- default: x(({ item: V, index: C }) => [
1159
- M("div", {
1160
- class: ue(["wx-media-list__cell", { "is-broken": $(V), "is-busy": P.value === C }])
1173
+ default: w(({ item: M, index: C }) => [
1174
+ V("div", {
1175
+ class: pe(["wx-media-list__cell", { "is-broken": $(M), "is-busy": N.value === C }])
1161
1176
  }, [
1162
- v(e(Ue), {
1163
- name: B(V),
1164
- thumbnail: Y(V),
1165
- type: d(V)?.mime,
1166
- size: t.layout === "rows" ? "sm" : "md"
1177
+ g(e(Le), {
1178
+ name: F(M),
1179
+ thumbnail: K(M),
1180
+ type: o(M)?.mime,
1181
+ size: a.layout === "rows" ? "sm" : "md"
1167
1182
  }, {
1168
- meta: x(() => [
1169
- $(V) ? (b(), W("span", Ut, z(e(l)("field.missing")), 1)) : (b(), W("span", Wt, z(ee(V)), 1))
1183
+ meta: w(() => [
1184
+ $(M) ? (b(), L("span", Rt, U(e(l)("field.missing")), 1)) : (b(), L("span", Dt, U(X(M)), 1))
1170
1185
  ]),
1171
1186
  _: 2
1172
1187
  }, 1032, ["name", "thumbnail", "type", "size"]),
1173
- t.disabled ? R("", !0) : (b(), W("div", Lt, [
1174
- v(e(le), { size: "sm" }, {
1175
- default: x(() => [
1176
- t.captions ? (b(), T(e(We), {
1188
+ a.disabled ? D("", !0) : (b(), L("div", Bt, [
1189
+ g(e(le), { size: "sm" }, {
1190
+ default: w(() => [
1191
+ a.captions ? (b(), T(e(Re), {
1177
1192
  key: 0,
1178
- open: P.value === C,
1193
+ open: N.value === C,
1179
1194
  title: e(l)("field.captions"),
1180
1195
  width: 360,
1181
1196
  side: "top",
1182
1197
  teleport: "",
1183
- "onUpdate:open": (F) => P.value = F ? C : null
1198
+ "onUpdate:open": (W) => N.value = W ? C : null
1184
1199
  }, {
1185
- trigger: x(() => [
1186
- v(e(D), {
1200
+ trigger: w(() => [
1201
+ g(e(B), {
1187
1202
  type: "edit",
1188
1203
  title: e(l)("field.captions")
1189
1204
  }, null, 8, ["title"])
1190
1205
  ]),
1191
- default: x(() => [
1192
- M("div", Rt, [
1193
- M("div", Dt, [
1194
- h[2] || (h[2] = M("span", { class: "wx-media-list__caption-label" }, "alt", -1)),
1195
- v(e(Z), {
1206
+ default: w(() => [
1207
+ V("div", St, [
1208
+ V("div", Et, [
1209
+ m[2] || (m[2] = V("span", { class: "wx-media-list__caption-label" }, "alt", -1)),
1210
+ g(e(Z), {
1196
1211
  localized: "",
1197
- "model-value": te(C, "alt"),
1212
+ "model-value": j(C, "alt"),
1198
1213
  placeholder: e(l)("field.alt-hint"),
1199
- "onUpdate:modelValue": (F) => G(C, "alt", F)
1214
+ "onUpdate:modelValue": (W) => te(C, "alt", W)
1200
1215
  }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
1201
1216
  ]),
1202
- M("div", Bt, [
1203
- h[3] || (h[3] = M("span", { class: "wx-media-list__caption-label" }, "title", -1)),
1204
- v(e(Z), {
1217
+ V("div", Pt, [
1218
+ m[3] || (m[3] = V("span", { class: "wx-media-list__caption-label" }, "title", -1)),
1219
+ g(e(Z), {
1205
1220
  localized: "",
1206
- "model-value": te(C, "title"),
1221
+ "model-value": j(C, "title"),
1207
1222
  placeholder: e(l)("field.title-hint"),
1208
- "onUpdate:modelValue": (F) => G(C, "title", F)
1223
+ "onUpdate:modelValue": (W) => te(C, "title", W)
1209
1224
  }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])
1210
1225
  ]),
1211
- M("div", St, [
1212
- v(e(H), {
1226
+ V("div", Ot, [
1227
+ g(e(I), {
1213
1228
  size: "sm",
1214
1229
  type: "primary",
1215
- onClick: h[0] || (h[0] = (F) => P.value = null)
1230
+ onClick: m[0] || (m[0] = (W) => N.value = null)
1216
1231
  }, {
1217
- default: x(() => [
1218
- N(z(e(l)("manager.save")), 1)
1232
+ default: w(() => [
1233
+ O(U(e(l)("manager.save")), 1)
1219
1234
  ]),
1220
1235
  _: 1
1221
1236
  })
@@ -1223,24 +1238,24 @@ const bt = {
1223
1238
  ])
1224
1239
  ]),
1225
1240
  _: 2
1226
- }, 1032, ["open", "title", "onUpdate:open"])) : R("", !0),
1227
- $(V) ? R("", !0) : (b(), T(e(D), {
1241
+ }, 1032, ["open", "title", "onUpdate:open"])) : D("", !0),
1242
+ $(M) ? D("", !0) : (b(), T(e(B), {
1228
1243
  key: 1,
1229
1244
  type: "goto",
1230
1245
  title: e(l)("field.open"),
1231
- onClick: (F) => oe(V)
1246
+ onClick: (W) => de(M)
1232
1247
  }, null, 8, ["title", "onClick"])),
1233
- v(e(Le), {
1248
+ g(e(De), {
1234
1249
  title: e(l)("field.remove-title"),
1235
1250
  description: e(l)("field.remove-text"),
1236
1251
  "confirm-text": e(l)("field.remove-confirm"),
1237
1252
  "cancel-text": e(l)("manager.cancel"),
1238
1253
  "confirm-type": "danger",
1239
1254
  side: "top",
1240
- onConfirm: (F) => E(C)
1255
+ onConfirm: (W) => Q(C)
1241
1256
  }, {
1242
- trigger: x(() => [
1243
- v(e(D), {
1257
+ trigger: w(() => [
1258
+ g(e(B), {
1244
1259
  type: "remove",
1245
1260
  title: e(l)("field.remove-confirm")
1246
1261
  }, null, 8, ["title"])
@@ -1255,23 +1270,23 @@ const bt = {
1255
1270
  ]),
1256
1271
  _: 1
1257
1272
  }, 8, ["modelValue", "disabled", "handle", "drag-label", "empty-text"]),
1258
- M("div", Ot, [
1259
- v(e(H), {
1273
+ V("div", At, [
1274
+ g(e(I), {
1260
1275
  size: "sm",
1261
1276
  variant: "outline",
1262
- disabled: t.disabled || w.value,
1263
- onClick: ne
1277
+ disabled: a.disabled || y.value,
1278
+ onClick: ie
1264
1279
  }, {
1265
- default: x(() => [
1266
- N(z(e(l)("field.add")), 1)
1280
+ default: w(() => [
1281
+ O(U(e(l)("field.add")), 1)
1267
1282
  ]),
1268
1283
  _: 1
1269
1284
  }, 8, ["disabled"]),
1270
- S.value ? (b(), W("span", Et, z(S.value), 1)) : R("", !0)
1285
+ ne.value ? (b(), L("span", Nt, U(ne.value), 1)) : D("", !0)
1271
1286
  ])
1272
1287
  ], 6));
1273
1288
  }
1274
- }), Pt = /* @__PURE__ */ O({
1289
+ }), qt = /* @__PURE__ */ S({
1275
1290
  name: "WxFileField",
1276
1291
  inheritAttrs: !1,
1277
1292
  __name: "FileField",
@@ -1280,21 +1295,21 @@ const bt = {
1280
1295
  modelModifiers: {}
1281
1296
  },
1282
1297
  emits: ["update:modelValue"],
1283
- setup(t) {
1284
- const i = I(t, "modelValue"), o = U({
1298
+ setup(a) {
1299
+ const i = A(a, "modelValue"), n = z({
1285
1300
  get: () => i.value ? [i.value] : [],
1286
1301
  set: (l) => {
1287
1302
  i.value = l[0] ?? null;
1288
1303
  }
1289
1304
  });
1290
- return (l, c) => (b(), T(xe, pe(l.$attrs, {
1291
- modelValue: o.value,
1292
- "onUpdate:modelValue": c[0] || (c[0] = (s) => o.value = s),
1305
+ return (l, r) => (b(), T(ke, ge(l.$attrs, {
1306
+ modelValue: n.value,
1307
+ "onUpdate:modelValue": r[0] || (r[0] = (d) => n.value = d),
1293
1308
  layout: "rows",
1294
1309
  single: ""
1295
1310
  }), null, 16, ["modelValue"]));
1296
1311
  }
1297
- }), At = /* @__PURE__ */ O({
1312
+ }), It = /* @__PURE__ */ S({
1298
1313
  name: "WxFilesField",
1299
1314
  inheritAttrs: !1,
1300
1315
  __name: "FilesField",
@@ -1303,15 +1318,15 @@ const bt = {
1303
1318
  modelModifiers: {}
1304
1319
  },
1305
1320
  emits: ["update:modelValue"],
1306
- setup(t) {
1307
- const i = I(t, "modelValue");
1308
- return (o, l) => (b(), T(xe, pe(o.$attrs, {
1321
+ setup(a) {
1322
+ const i = A(a, "modelValue");
1323
+ return (n, l) => (b(), T(ke, ge(n.$attrs, {
1309
1324
  modelValue: i.value,
1310
- "onUpdate:modelValue": l[0] || (l[0] = (c) => i.value = c),
1325
+ "onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
1311
1326
  layout: "rows"
1312
1327
  }), null, 16, ["modelValue"]));
1313
1328
  }
1314
- }), Nt = /* @__PURE__ */ O({
1329
+ }), Ht = /* @__PURE__ */ S({
1315
1330
  name: "WxGalleryField",
1316
1331
  inheritAttrs: !1,
1317
1332
  __name: "GalleryField",
@@ -1320,27 +1335,27 @@ const bt = {
1320
1335
  modelModifiers: {}
1321
1336
  },
1322
1337
  emits: ["update:modelValue"],
1323
- setup(t) {
1324
- const i = I(t, "modelValue");
1325
- return (o, l) => (b(), T(xe, pe(o.$attrs, {
1338
+ setup(a) {
1339
+ const i = A(a, "modelValue");
1340
+ return (n, l) => (b(), T(ke, ge(n.$attrs, {
1326
1341
  modelValue: i.value,
1327
- "onUpdate:modelValue": l[0] || (l[0] = (c) => i.value = c),
1342
+ "onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
1328
1343
  layout: "grid",
1329
1344
  accept: "image"
1330
1345
  }), null, 16, ["modelValue"]));
1331
1346
  }
1332
- }), qt = { class: "wx-media-field" }, It = {
1347
+ }), Xt = { class: "wx-media-field" }, Kt = {
1333
1348
  key: 0,
1334
1349
  class: "wx-media-field__label"
1335
- }, Ht = ["disabled"], Xt = ["disabled", "title"], Kt = {
1350
+ }, jt = ["disabled"], Gt = ["disabled", "title"], Yt = {
1336
1351
  key: 1,
1337
1352
  class: "wx-media-field__missing"
1338
- }, jt = {
1353
+ }, Jt = {
1339
1354
  key: 0,
1340
1355
  class: "wx-media-field__bar"
1341
- }, Gt = { class: "wx-media-field__captions" }, Yt = { class: "wx-media-field__caption" }, Jt = { class: "wx-media-field__caption" }, Qt = { class: "wx-media-field__captions-footer" }, Zt = /* @__PURE__ */ O({
1356
+ }, Qt = { class: "wx-media-field__captions" }, Zt = { class: "wx-media-field__caption" }, el = { class: "wx-media-field__caption" }, tl = { class: "wx-media-field__captions-footer" }, ll = /* @__PURE__ */ S({
1342
1357
  __name: "MediaField",
1343
- props: /* @__PURE__ */ j({
1358
+ props: /* @__PURE__ */ q({
1344
1359
  label: { default: void 0 },
1345
1360
  accept: { default: "image" },
1346
1361
  captions: { type: Boolean, default: !0 },
@@ -1352,119 +1367,119 @@ const bt = {
1352
1367
  modelModifiers: {}
1353
1368
  }),
1354
1369
  emits: ["update:modelValue"],
1355
- setup(t) {
1356
- const i = t, o = I(t, "modelValue");
1357
- be();
1358
- const l = X("webx-media"), c = he(fe()), s = {
1370
+ setup(a) {
1371
+ const i = a, n = A(a, "modelValue");
1372
+ re();
1373
+ const l = H("webx-media"), r = we(se()), d = {
1359
1374
  "16/9": "16 / 9",
1360
1375
  "4/3": "4 / 3",
1361
1376
  "1/1": "1 / 1"
1362
- }, a = L(!1), n = L({});
1363
- K(
1364
- () => o.value?.path,
1365
- async (d) => {
1366
- if (!d || o.value?.url || n.value[d]) return;
1367
- const $ = await c.fileByPath(d);
1368
- $ && (n.value = { ...n.value, [d]: $.url });
1377
+ }, v = R(!1), t = R({});
1378
+ G(
1379
+ () => n.value?.path,
1380
+ async (o) => {
1381
+ if (!o || n.value?.url || t.value[o]) return;
1382
+ const $ = await r.fileByPath(o);
1383
+ $ && (t.value = { ...t.value, [o]: $.url });
1369
1384
  },
1370
1385
  { immediate: !0 }
1371
1386
  );
1372
- const k = U(() => {
1373
- const d = o.value;
1374
- return d ? d.url ?? n.value[d.path] ?? null : null;
1375
- }), w = U(
1376
- () => i.aspect ? { aspectRatio: s[i.aspect] ?? i.aspect } : { height: typeof i.height == "number" ? `${i.height}px` : i.height }
1387
+ const x = z(() => {
1388
+ const o = n.value;
1389
+ return o ? o.url ?? t.value[o.path] ?? null : null;
1390
+ }), y = z(
1391
+ () => i.aspect ? { aspectRatio: d[i.aspect] ?? i.aspect } : { height: typeof i.height == "number" ? `${i.height}px` : i.height }
1377
1392
  );
1378
- function u(d) {
1379
- return o.value?.[d] ?? {};
1393
+ function s(o) {
1394
+ return n.value?.[o] ?? {};
1380
1395
  }
1381
- function r(d, $) {
1382
- o.value && (o.value = { ...o.value, [d]: $ });
1396
+ function u(o, $) {
1397
+ n.value && (n.value = { ...n.value, [o]: $ });
1383
1398
  }
1384
- async function g() {
1399
+ async function k() {
1385
1400
  if (i.disabled) return;
1386
- const d = await Mt({ accept: i.accept });
1387
- d && (o.value = { ...o.value, path: d.path, url: d.url });
1401
+ const o = await Ut({ accept: i.accept });
1402
+ o && (t.value = { ...t.value, [o.path]: o.url }, n.value = { ...n.value, path: o.path, url: o.url });
1388
1403
  }
1389
- function f() {
1390
- o.value = null, a.value = !1;
1404
+ function h() {
1405
+ n.value = null, v.value = !1;
1391
1406
  }
1392
- return (d, $) => (b(), W("div", qt, [
1393
- t.label ? (b(), W("span", It, z(t.label), 1)) : R("", !0),
1394
- o.value ? (b(), W("div", {
1407
+ return (o, $) => (b(), L("div", Xt, [
1408
+ a.label ? (b(), L("span", Kt, U(a.label), 1)) : D("", !0),
1409
+ n.value ? (b(), L("div", {
1395
1410
  key: 2,
1396
1411
  class: "wx-media-field__frame",
1397
- style: ce(w.value)
1412
+ style: fe(y.value)
1398
1413
  }, [
1399
- M("button", {
1414
+ V("button", {
1400
1415
  type: "button",
1401
1416
  class: "wx-media-field__picture",
1402
- disabled: t.disabled,
1417
+ disabled: a.disabled,
1403
1418
  title: e(l)("field.replace"),
1404
- onClick: g
1419
+ onClick: k
1405
1420
  }, [
1406
- k.value ? (b(), T(e(dt), {
1421
+ x.value ? (b(), T(e(mt), {
1407
1422
  key: 0,
1408
- src: k.value,
1423
+ src: x.value,
1409
1424
  fit: "contain",
1410
1425
  width: "100%",
1411
1426
  height: "100%"
1412
- }, null, 8, ["src"])) : (b(), W("span", Kt, z(e(l)("field.no-preview")), 1))
1413
- ], 8, Xt),
1414
- t.disabled ? R("", !0) : (b(), W("div", jt, [
1415
- v(e(le), { size: "sm" }, {
1416
- default: x(() => [
1417
- t.captions ? (b(), T(e(We), {
1427
+ }, null, 8, ["src"])) : (b(), L("span", Yt, U(e(l)("field.no-preview")), 1))
1428
+ ], 8, Gt),
1429
+ a.disabled ? D("", !0) : (b(), L("div", Jt, [
1430
+ g(e(le), { size: "sm" }, {
1431
+ default: w(() => [
1432
+ a.captions ? (b(), T(e(Re), {
1418
1433
  key: 0,
1419
- open: a.value,
1420
- "onUpdate:open": $[3] || ($[3] = (B) => a.value = B),
1434
+ open: v.value,
1435
+ "onUpdate:open": $[3] || ($[3] = (F) => v.value = F),
1421
1436
  title: e(l)("field.captions"),
1422
1437
  width: 360,
1423
1438
  side: "top",
1424
1439
  teleport: ""
1425
1440
  }, {
1426
- trigger: x(() => [
1427
- v(e(D), {
1441
+ trigger: w(() => [
1442
+ g(e(B), {
1428
1443
  type: "edit",
1429
1444
  title: e(l)("field.edit")
1430
1445
  }, null, 8, ["title"])
1431
1446
  ]),
1432
- default: x(() => [
1433
- M("div", Gt, [
1434
- M("div", Yt, [
1435
- $[4] || ($[4] = M("label", {
1447
+ default: w(() => [
1448
+ V("div", Qt, [
1449
+ V("div", Zt, [
1450
+ $[4] || ($[4] = V("label", {
1436
1451
  class: "wx-media-field__caption-label",
1437
1452
  for: "wx-media-alt"
1438
1453
  }, "alt", -1)),
1439
- v(e(Z), {
1454
+ g(e(Z), {
1440
1455
  id: "wx-media-alt",
1441
1456
  localized: "",
1442
- "model-value": u("alt"),
1457
+ "model-value": s("alt"),
1443
1458
  placeholder: e(l)("field.alt-hint"),
1444
- "onUpdate:modelValue": $[0] || ($[0] = (B) => r("alt", B))
1459
+ "onUpdate:modelValue": $[0] || ($[0] = (F) => u("alt", F))
1445
1460
  }, null, 8, ["model-value", "placeholder"])
1446
1461
  ]),
1447
- M("div", Jt, [
1448
- $[5] || ($[5] = M("label", {
1462
+ V("div", el, [
1463
+ $[5] || ($[5] = V("label", {
1449
1464
  class: "wx-media-field__caption-label",
1450
1465
  for: "wx-media-title"
1451
1466
  }, "title", -1)),
1452
- v(e(Z), {
1467
+ g(e(Z), {
1453
1468
  id: "wx-media-title",
1454
1469
  localized: "",
1455
- "model-value": u("title"),
1470
+ "model-value": s("title"),
1456
1471
  placeholder: e(l)("field.title-hint"),
1457
- "onUpdate:modelValue": $[1] || ($[1] = (B) => r("title", B))
1472
+ "onUpdate:modelValue": $[1] || ($[1] = (F) => u("title", F))
1458
1473
  }, null, 8, ["model-value", "placeholder"])
1459
1474
  ]),
1460
- M("div", Qt, [
1461
- v(e(H), {
1475
+ V("div", tl, [
1476
+ g(e(I), {
1462
1477
  size: "sm",
1463
1478
  type: "primary",
1464
- onClick: $[2] || ($[2] = (B) => a.value = !1)
1479
+ onClick: $[2] || ($[2] = (F) => v.value = !1)
1465
1480
  }, {
1466
- default: x(() => [
1467
- N(z(e(l)("manager.save")), 1)
1481
+ default: w(() => [
1482
+ O(U(e(l)("manager.save")), 1)
1468
1483
  ]),
1469
1484
  _: 1
1470
1485
  })
@@ -1472,18 +1487,18 @@ const bt = {
1472
1487
  ])
1473
1488
  ]),
1474
1489
  _: 1
1475
- }, 8, ["open", "title"])) : R("", !0),
1476
- v(e(Le), {
1490
+ }, 8, ["open", "title"])) : D("", !0),
1491
+ g(e(De), {
1477
1492
  title: e(l)("field.clear-title"),
1478
1493
  description: e(l)("field.clear-text"),
1479
1494
  "confirm-text": e(l)("field.clear-confirm"),
1480
1495
  "cancel-text": e(l)("manager.cancel"),
1481
1496
  "confirm-type": "danger",
1482
1497
  side: "top",
1483
- onConfirm: f
1498
+ onConfirm: h
1484
1499
  }, {
1485
- trigger: x(() => [
1486
- v(e(D), {
1500
+ trigger: w(() => [
1501
+ g(e(B), {
1487
1502
  type: "remove",
1488
1503
  title: e(l)("field.clear-confirm")
1489
1504
  }, null, 8, ["title"])
@@ -1494,36 +1509,81 @@ const bt = {
1494
1509
  _: 1
1495
1510
  })
1496
1511
  ]))
1497
- ], 4)) : (b(), W("div", {
1512
+ ], 4)) : (b(), L("div", {
1498
1513
  key: 1,
1499
1514
  class: "wx-media-field__frame is-empty",
1500
- style: ce(w.value)
1515
+ style: fe(y.value)
1501
1516
  }, [
1502
- M("button", {
1517
+ V("button", {
1503
1518
  type: "button",
1504
1519
  class: "wx-media-field__pick",
1505
- disabled: t.disabled,
1506
- onClick: g
1507
- }, z(e(l)("field.select")), 9, Ht)
1520
+ disabled: a.disabled,
1521
+ onClick: k
1522
+ }, U(e(l)("field.select")), 9, jt)
1508
1523
  ], 4))
1509
1524
  ]));
1510
1525
  }
1511
- }), el = /* @__PURE__ */ O({
1526
+ }), al = /* @__PURE__ */ S({
1512
1527
  __name: "MediaPage",
1513
- setup(t) {
1514
- return (i, o) => (b(), T(e(ut), {
1515
- class: "wx-media-page",
1516
- padding: "md"
1517
- }, {
1518
- default: x(() => [
1519
- v(De)
1528
+ setup(a) {
1529
+ const i = se();
1530
+ re();
1531
+ const n = H("webx-media"), l = oe("manager"), r = R("all"), d = z(() => r.value), v = z(() => i.can("media.upload") || i.can("media.manage")), t = z(
1532
+ () => i.state.manifest?.modules.find((y) => y.id === "media")?.title ?? n("module.title")
1533
+ ), x = z(() => [
1534
+ { value: "all", label: n("manager.all-types") },
1535
+ ...["image", "video", "audio", "document", "other"].map((y) => ({
1536
+ value: y,
1537
+ label: n(`manager.${y}`)
1538
+ }))
1539
+ ]);
1540
+ return (y, s) => (b(), T(e(lt), {
1541
+ view: r.value,
1542
+ "onUpdate:view": s[1] || (s[1] = (u) => r.value = u),
1543
+ title: t.value,
1544
+ views: x.value,
1545
+ card: !1,
1546
+ fill: ""
1547
+ }, We({
1548
+ default: w(() => [
1549
+ g(e(pt), {
1550
+ class: "wx-media-page",
1551
+ padding: "md"
1552
+ }, {
1553
+ default: w(() => [
1554
+ g(Se, {
1555
+ ref_key: "manager",
1556
+ ref: l,
1557
+ type: d.value,
1558
+ "in-page": ""
1559
+ }, null, 8, ["type"])
1560
+ ]),
1561
+ _: 1
1562
+ })
1520
1563
  ]),
1521
- _: 1
1522
- }));
1564
+ _: 2
1565
+ }, [
1566
+ v.value ? {
1567
+ name: "actions",
1568
+ fn: w(() => [
1569
+ g(e(I), {
1570
+ type: "primary",
1571
+ icon: "upload",
1572
+ onClick: s[0] || (s[0] = (u) => l.value?.upload())
1573
+ }, {
1574
+ default: w(() => [
1575
+ O(U(e(n)("manager.upload")), 1)
1576
+ ]),
1577
+ _: 1
1578
+ })
1579
+ ]),
1580
+ key: "0"
1581
+ } : void 0
1582
+ ]), 1032, ["view", "title", "views"]));
1523
1583
  }
1524
1584
  });
1525
- function il(t = {}) {
1526
- const i = t.path ?? "/media";
1585
+ function sl(a = {}) {
1586
+ const i = a.path ?? "/media";
1527
1587
  return {
1528
1588
  id: "media",
1529
1589
  path: i,
@@ -1531,7 +1591,7 @@ function il(t = {}) {
1531
1591
  {
1532
1592
  path: i,
1533
1593
  name: "webx.media",
1534
- component: el
1594
+ component: al
1535
1595
  }
1536
1596
  ],
1537
1597
  // What a screen means by these four: the fields over the library. The server registers the
@@ -1539,26 +1599,26 @@ function il(t = {}) {
1539
1599
  // limit — the names are what an author picks from a list, and nobody picks "media with
1540
1600
  // `multiple: true` and `accept: document`".
1541
1601
  types: {
1542
- "wx-media": { component: Zt, kind: "field" },
1543
- "wx-gallery": { component: Nt, kind: "field" },
1544
- "wx-file": { component: Pt, kind: "field" },
1545
- "wx-files": { component: At, kind: "field" }
1602
+ "wx-media": { component: ll, kind: "field" },
1603
+ "wx-gallery": { component: Ht, kind: "field" },
1604
+ "wx-file": { component: qt, kind: "field" },
1605
+ "wx-files": { component: It, kind: "field" }
1546
1606
  }
1547
1607
  };
1548
1608
  }
1549
1609
  export {
1550
- Pt as WxFileField,
1551
- At as WxFilesField,
1552
- Nt as WxGalleryField,
1553
- Zt as WxMediaField,
1554
- De as WxMediaManager,
1555
- el as WxMediaPage,
1556
- we as WxMediaPicker,
1557
- he as createMediaApi,
1558
- il as media,
1559
- ht as mediaMessages,
1560
- Tt as openMediaFiles,
1561
- zt as openMediaLibrary,
1562
- Mt as openMediaPicker
1610
+ qt as WxFileField,
1611
+ It as WxFilesField,
1612
+ Ht as WxGalleryField,
1613
+ ll as WxMediaField,
1614
+ Se as WxMediaManager,
1615
+ al as WxMediaPage,
1616
+ xe as WxMediaPicker,
1617
+ we as createMediaApi,
1618
+ sl as media,
1619
+ xt as mediaMessages,
1620
+ Ft as openMediaFiles,
1621
+ Wt as openMediaLibrary,
1622
+ Ut as openMediaPicker
1563
1623
  };
1564
1624
  //# sourceMappingURL=index.js.map