@webx-ui/module-media 0.8.12 → 0.8.14

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