@templatical/media-library 0.35.0 → 0.37.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.
Files changed (34) hide show
  1. package/README.md +38 -24
  2. package/dist/{ca-DnghH5Xn.js → ca-CGf3MuE2.js} +1 -5
  3. package/dist/cdn/chunks/{ca-DnghH5Xn.js → ca-CGf3MuE2.js} +2 -6
  4. package/dist/cdn/chunks/ca-CGf3MuE2.js.map +1 -0
  5. package/dist/{de-ByQyu2jv.js → cdn/chunks/de-D5ebAV5i.js} +3 -5
  6. package/dist/cdn/chunks/de-D5ebAV5i.js.map +1 -0
  7. package/dist/{es-Bcp-DbmC.js → cdn/chunks/es-BG--QNW0.js} +3 -5
  8. package/dist/cdn/chunks/es-BG--QNW0.js.map +1 -0
  9. package/dist/{fr-DXb0cCZG.js → cdn/chunks/fr-Mdi4AlCR.js} +3 -5
  10. package/dist/cdn/chunks/fr-Mdi4AlCR.js.map +1 -0
  11. package/dist/cdn/chunks/{icons-Ds4F8sQq.js → icons-DMM4tyQd.js} +1149 -1104
  12. package/dist/cdn/chunks/{icons-Ds4F8sQq.js.map → icons-DMM4tyQd.js.map} +1 -1
  13. package/dist/{nl-DGT1t3Be.js → cdn/chunks/nl-D-6hT8te.js} +3 -5
  14. package/dist/cdn/chunks/nl-D-6hT8te.js.map +1 -0
  15. package/dist/{pt-BR-C0Hzc26R.js → cdn/chunks/pt-BR-DMfAgDWi.js} +3 -5
  16. package/dist/cdn/chunks/pt-BR-DMfAgDWi.js.map +1 -0
  17. package/dist/cdn/media-library.css +1 -1
  18. package/dist/cdn/media-library.js +1456 -1844
  19. package/dist/cdn/media-library.js.map +1 -1
  20. package/dist/{cdn/chunks/de-ByQyu2jv.js → de-D5ebAV5i.js} +1 -7
  21. package/dist/{cdn/chunks/es-Bcp-DbmC.js → es-BG--QNW0.js} +1 -7
  22. package/dist/{cdn/chunks/fr-DXb0cCZG.js → fr-Mdi4AlCR.js} +1 -7
  23. package/dist/index.d.ts +103 -160
  24. package/dist/{cdn/chunks/nl-DGT1t3Be.js → nl-D-6hT8te.js} +1 -7
  25. package/dist/{cdn/chunks/pt-BR-C0Hzc26R.js → pt-BR-DMfAgDWi.js} +1 -7
  26. package/dist/templatical-media-library.css +1 -1
  27. package/dist/templatical-media-library.js +1513 -1475
  28. package/package.json +4 -5
  29. package/dist/cdn/chunks/ca-DnghH5Xn.js.map +0 -1
  30. package/dist/cdn/chunks/de-ByQyu2jv.js.map +0 -1
  31. package/dist/cdn/chunks/es-Bcp-DbmC.js.map +0 -1
  32. package/dist/cdn/chunks/fr-DXb0cCZG.js.map +0 -1
  33. package/dist/cdn/chunks/nl-DGT1t3Be.js.map +0 -1
  34. package/dist/cdn/chunks/pt-BR-C0Hzc26R.js.map +0 -1
@@ -1,267 +1,136 @@
1
- import { API_ROUTES as e, ApiClient as t, buildUrl as n, createSdkAuthManager as r } from "@templatical/core/cloud";
2
- import { Fragment as i, Teleport as a, Transition as o, computed as s, createApp as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, h as g, inject as _, isRef as v, normalizeClass as y, normalizeStyle as b, onMounted as x, openBlock as S, provide as C, ref as w, renderList as T, resolveComponent as E, toDisplayString as D, toRef as O, unref as k, vModelText as A, watch as j, withCtx as M, withDirectives as N, withKeys as P, withModifiers as F } from "vue";
3
- import { Check as I, ChevronRight as L, Copy as R, File as z, Folder as B, Grid2x2 as V, Link as H, List as U, LoaderCircle as W, PanelLeft as G, Pencil as K, Plus as q, RefreshCw as J, Search as Y, Star as ee, Trash2 as X, Upload as te, X as ne } from "@lucide/vue";
1
+ import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, h as f, inject as p, isRef as m, normalizeClass as h, normalizeStyle as g, onMounted as _, openBlock as v, provide as y, ref as b, renderList as x, resolveComponent as S, toDisplayString as C, toRef as w, toValue as T, unref as E, vModelText as D, watch as O, withCtx as k, withDirectives as A, withKeys as j, withModifiers as M } from "vue";
2
+ import { Check as N, ChevronRight as P, Copy as F, File as I, Folder as L, Grid2x2 as R, Link as z, List as B, LoaderCircle as V, PanelLeft as H, Pencil as U, Plus as W, RefreshCw as G, Search as ee, Star as K, Trash2 as te, Upload as q, X as ne } from "@lucide/vue";
4
3
  import { Cropper as re } from "vue-advanced-cropper";
5
- import { onClickOutside as ie, useClipboard as ae, useDebounceFn as oe, useDropZone as se, useEventListener as ce, useFileDialog as le, useIntersectionObserver as ue } from "@vueuse/core";
4
+ import { onClickOutside as J, useClipboard as Y, useDebounceFn as ie, useDropZone as ae, useEventListener as oe, useFileDialog as se, useIntersectionObserver as X } from "@vueuse/core";
6
5
  //#region \0rolldown/runtime.js
7
- var de = Object.defineProperty, fe = (e, t) => {
6
+ var ce = Object.defineProperty, le = (e, t) => {
8
7
  let n = {};
9
- for (var r in e) de(n, r, {
8
+ for (var r in e) ce(n, r, {
10
9
  get: e[r],
11
10
  enumerable: !0
12
11
  });
13
- return t || de(n, Symbol.toStringTag, { value: "Module" }), n;
14
- }, pe = class {
15
- authManager;
16
- constructor(e) {
17
- this.authManager = e;
18
- }
19
- get projectId() {
20
- return this.authManager.projectId;
21
- }
22
- get tenantSlug() {
23
- return this.authManager.tenantSlug;
24
- }
25
- get baseParams() {
26
- return {
27
- project: this.projectId,
28
- tenant: this.tenantSlug
29
- };
30
- }
31
- async request(e, t = {}) {
32
- let n = await this.authManager.authenticatedFetch(e, {
33
- ...t,
34
- headers: {
35
- "Content-Type": "application/json",
36
- Accept: "application/json",
37
- ...t.headers
38
- }
39
- });
40
- if (!n.ok) {
41
- let e = await n.json().catch(() => ({ message: `HTTP error ${n.status}` }));
42
- throw Error(e.message, { cause: e });
43
- }
44
- if (n.status !== 204) return (await n.json()).data;
45
- }
46
- async browseMedia(t) {
47
- let r = new URLSearchParams();
48
- t.folder_id && r.set("folder_id", t.folder_id), t.search && r.set("search", t.search), t.category && r.set("category", t.category), t.sort && r.set("sort", t.sort), t.cursor && r.set("cursor", t.cursor);
49
- let i = r.toString(), a = `${n(e["media.browse"], this.baseParams)}${i ? `?${i}` : ""}`, o = await this.authManager.authenticatedFetch(a, { headers: { Accept: "application/json" } });
50
- if (!o.ok) {
51
- let e = await o.json().catch(() => ({ message: `HTTP error ${o.status}` }));
52
- throw Error(e.message, { cause: e });
53
- }
54
- return o.json();
55
- }
56
- async uploadMedia(t, r) {
57
- let i = new FormData();
58
- i.append("file", t), r && i.append("folder_id", r);
59
- let a = n(e["media.upload"], this.baseParams), o = await this.authManager.authenticatedFetch(a, {
60
- method: "POST",
61
- headers: { Accept: "application/json" },
62
- body: i
63
- });
64
- if (!o.ok) {
65
- let e = await o.json().catch(() => ({ message: `HTTP error ${o.status}` }));
66
- throw Error(e.message, { cause: e });
67
- }
68
- return (await o.json()).data;
69
- }
70
- async updateMedia(t, r, i) {
71
- return this.request(n(e["media.update"], {
72
- ...this.baseParams,
73
- media: t
74
- }), {
75
- method: "PUT",
76
- body: JSON.stringify({
77
- filename: r,
78
- alt_text: i
79
- })
80
- });
81
- }
82
- async deleteMedia(t) {
83
- return this.request(n(e["media.delete"], this.baseParams), {
84
- method: "POST",
85
- body: JSON.stringify({ ids: t })
86
- });
87
- }
88
- async moveMedia(t, r) {
89
- return this.request(n(e["media.move"], this.baseParams), {
90
- method: "POST",
91
- body: JSON.stringify({
92
- ids: t,
93
- folder_id: r
94
- })
95
- });
96
- }
97
- async getMediaFolders() {
98
- return this.request(n(e["folders.index"], this.baseParams));
99
- }
100
- async createMediaFolder(t, r) {
101
- return this.request(n(e["folders.store"], this.baseParams), {
102
- method: "POST",
103
- body: JSON.stringify({
104
- name: t,
105
- parent_id: r ?? null
106
- })
107
- });
12
+ return t || ce(n, Symbol.toStringTag, { value: "Module" }), n;
13
+ };
14
+ //#endregion
15
+ //#region src/composable.ts
16
+ function ue(e) {
17
+ let { provider: t } = e, n = b([]), r = b([]), i = b(null), a = b("files"), o = b(""), s = b(null), c = b("newest"), l = b(!1), u = b(!1), d = b(!1), f = b(null), p = b(null), m = b(/* @__PURE__ */ new Set()), h = b(null), g = b([]), _ = b({}), v = b(!1), y = b([]), x = b(!1), S = b(null), C = b(!1), w = b(null), E = b(!1), D = b(null), O = b(null), k = b(null), A = 0;
18
+ function j(t) {
19
+ try {
20
+ t();
21
+ } catch (t) {
22
+ e.onError?.(t);
23
+ }
108
24
  }
109
- async renameMediaFolder(t, r) {
110
- return this.request(n(e["folders.update"], {
111
- ...this.baseParams,
112
- mediaFolder: t
113
- }), {
114
- method: "PUT",
115
- body: JSON.stringify({ name: r })
116
- });
25
+ function M() {
26
+ return t.folders === !1 ? null : t.folders;
117
27
  }
118
- async deleteMediaFolder(t) {
119
- return this.request(n(e["folders.destroy"], {
120
- ...this.baseParams,
121
- mediaFolder: t
122
- }), { method: "DELETE" });
123
- }
124
- async checkMediaUsage(t) {
125
- let r = await this.authManager.authenticatedFetch(n(e["media.checkUsage"], this.baseParams), {
126
- method: "POST",
127
- headers: {
128
- "Content-Type": "application/json",
129
- Accept: "application/json"
130
- },
131
- body: JSON.stringify({ ids: t })
132
- });
133
- if (!r.ok) {
134
- let e = await r.json().catch(() => ({ message: `HTTP error ${r.status}` }));
135
- throw Error(e.message, { cause: e });
136
- }
137
- return r.json();
138
- }
139
- async getFrequentlyUsed() {
140
- return this.request(n(e["media.frequentlyUsed"], this.baseParams));
141
- }
142
- async importFromUrl(t, r) {
143
- return this.request(n(e["media.importFromUrl"], this.baseParams), {
144
- method: "POST",
145
- body: JSON.stringify({
146
- url: t,
147
- folder_id: r ?? null
148
- })
149
- });
28
+ function N() {
29
+ return T(e.templateId);
150
30
  }
151
- async replaceMedia(t, r) {
152
- let i = new FormData();
153
- i.append("file", r);
154
- let a = n(e["media.replace"], {
155
- ...this.baseParams,
156
- media: t
157
- }), o = await this.authManager.authenticatedFetch(a, {
158
- method: "POST",
159
- headers: { Accept: "application/json" },
160
- body: i
161
- });
162
- if (!o.ok) {
163
- let e = await o.json().catch(() => ({ message: `HTTP error ${o.status}` }));
164
- throw Error(e.message, { cause: e });
165
- }
166
- return (await o.json()).data;
31
+ function P(e) {
32
+ let t = {};
33
+ o.value ? t.search = o.value : i.value != null && (t.folderId = i.value), s.value && (t.category = s.value), e && (t.cursor = e);
34
+ let n = N();
35
+ return n && (t.templateId = n), t;
167
36
  }
168
- };
169
- //#endregion
170
- //#region src/composable.ts
171
- function me(e) {
172
- if (!e.projectId) throw Error("projectId is required for useMediaLibrary");
173
- let t = new pe(e.authManager), n = w([]), r = w([]), i = w(null), a = w("files"), o = w(""), s = w(null), c = w("newest"), l = w(!1), u = w(!1), d = w(!1), f = w(null), p = w(null), m = w(/* @__PURE__ */ new Set()), h = w(null), g = w([]), _ = w({}), v = w(!1), y = w([]), b = w(!1), x = w(null), S = w(!1), C = w(null), T = w(!1), E = w(null), D = w(null), O = 0;
174
- async function k() {
175
- let r = ++O;
37
+ async function F() {
38
+ let r = ++A;
176
39
  l.value = !0;
40
+ let i = P();
177
41
  try {
178
- let e = await t.browseMedia({
179
- folder_id: o.value ? void 0 : i.value,
180
- search: o.value || void 0,
181
- category: s.value || void 0,
182
- sort: c.value === "newest" ? void 0 : c.value
183
- });
184
- if (r !== O) return;
185
- n.value = e.data, f.value = e.meta.next_cursor, d.value = !!e.meta.next_cursor;
42
+ let e = await t.list(i);
43
+ if (r !== A) return;
44
+ n.value = e.items, f.value = e.nextCursor ?? null, d.value = !!e.nextCursor;
186
45
  } catch (t) {
187
- if (r !== O) return;
46
+ if (r !== A) return;
188
47
  e.onError?.(t);
189
48
  } finally {
190
- r === O && (l.value = !1);
49
+ r === A && (l.value = !1);
191
50
  }
192
51
  }
193
- async function A() {
52
+ async function I() {
194
53
  if (!d.value || !f.value || l.value) return;
195
- let r = ++O;
54
+ let r = ++A;
196
55
  l.value = !0;
56
+ let i = P(f.value);
197
57
  try {
198
- let e = await t.browseMedia({
199
- folder_id: o.value ? void 0 : i.value,
200
- search: o.value || void 0,
201
- category: s.value || void 0,
202
- sort: c.value === "newest" ? void 0 : c.value,
203
- cursor: f.value
204
- });
205
- if (r !== O) return;
206
- n.value = [...n.value, ...e.data], f.value = e.meta.next_cursor, d.value = !!e.meta.next_cursor;
58
+ let e = await t.list(i);
59
+ if (r !== A) return;
60
+ n.value = [...n.value, ...e.items], f.value = e.nextCursor ?? null, d.value = !!e.nextCursor;
207
61
  } catch (t) {
208
- if (r !== O) return;
62
+ if (r !== A) return;
209
63
  e.onError?.(t);
210
64
  } finally {
211
- r === O && (l.value = !1);
65
+ r === A && (l.value = !1);
212
66
  }
213
67
  }
214
- async function j(e) {
215
- o.value = e, await k();
68
+ async function L(e) {
69
+ o.value = e, await F();
216
70
  }
217
- async function M(e) {
218
- s.value = e, await k();
71
+ async function R(e) {
72
+ s.value = e, await F();
219
73
  }
220
- async function N(e) {
221
- c.value = e, await k();
74
+ async function z(e) {
75
+ c.value = e, await F();
222
76
  }
223
- async function P(e) {
224
- a.value = "files", i.value = e, o.value = "", m.value = /* @__PURE__ */ new Set(), h.value = null, await k();
77
+ async function B(e) {
78
+ a.value = "files", i.value = e, o.value = "", m.value = /* @__PURE__ */ new Set(), h.value = null, await F();
225
79
  }
226
- async function F() {
227
- a.value = "frequently-used", i.value = null, o.value = "", m.value = /* @__PURE__ */ new Set(), h.value = null, await V();
80
+ async function V() {
81
+ a.value = "frequently-used", i.value = null, o.value = "", m.value = /* @__PURE__ */ new Set(), h.value = null, await q();
228
82
  }
229
- async function I(r) {
83
+ async function H(r) {
84
+ let { create: a } = t;
85
+ if (typeof a != "function") return null;
230
86
  u.value = !0;
231
87
  try {
232
- let e = await t.uploadMedia(r, i.value);
233
- return n.value = [e, ...n.value], e;
88
+ let e = { file: r };
89
+ i.value != null && (e.folderId = i.value);
90
+ let o = N();
91
+ o && (e.templateId = o);
92
+ let s = await a(e);
93
+ return n.value = [s, ...n.value], j(() => t.onCreated?.(s)), s;
234
94
  } catch (t) {
235
95
  return e.onError?.(t), null;
236
96
  } finally {
237
97
  u.value = !1;
238
98
  }
239
99
  }
240
- async function L(r) {
241
- u.value = !0, p.value = {
242
- current: 0,
243
- total: r.length
244
- };
245
- try {
246
- for (let a = 0; a < r.length; a++) {
247
- p.value = {
248
- current: a + 1,
249
- total: r.length
250
- };
251
- try {
252
- let e = await t.uploadMedia(r[a], i.value);
253
- n.value = [e, ...n.value];
254
- } catch (t) {
255
- e.onError?.(t);
100
+ async function U(r) {
101
+ let { create: a } = t;
102
+ if (typeof a == "function") {
103
+ u.value = !0, p.value = {
104
+ current: 0,
105
+ total: r.length
106
+ };
107
+ try {
108
+ for (let o = 0; o < r.length; o++) {
109
+ p.value = {
110
+ current: o + 1,
111
+ total: r.length
112
+ };
113
+ try {
114
+ let e = { file: r[o] };
115
+ i.value != null && (e.folderId = i.value);
116
+ let s = N();
117
+ s && (e.templateId = s);
118
+ let c = await a(e);
119
+ n.value = [c, ...n.value], j(() => t.onCreated?.(c));
120
+ } catch (t) {
121
+ e.onError?.(t);
122
+ }
256
123
  }
124
+ } finally {
125
+ u.value = !1, p.value = null;
257
126
  }
258
- } finally {
259
- u.value = !1, p.value = null;
260
127
  }
261
128
  }
262
- async function R(r) {
263
- if (m.value.size !== 0) try {
264
- let e = await t.moveMedia([...m.value], r);
129
+ async function W(t) {
130
+ if (m.value.size === 0) return;
131
+ let { move: r } = M() ?? { move: !1 };
132
+ if (typeof r == "function") try {
133
+ let e = await r([...m.value], t);
265
134
  if (i.value === null) {
266
135
  let t = new Map(e.map((e) => [e.id, e]));
267
136
  n.value = n.value.map((e) => t.get(e.id) ?? e);
@@ -271,139 +140,189 @@ function me(e) {
271
140
  e.onError?.(t);
272
141
  }
273
142
  }
274
- async function z(r, i, a) {
275
- try {
276
- let e = await t.updateMedia(r, i, a);
277
- n.value = n.value.map((t) => t.id === r ? e : t), h.value?.id === r && (h.value = e);
143
+ async function G(r, i, a) {
144
+ let { update: o } = t;
145
+ if (typeof o == "function") try {
146
+ let e = { filename: i };
147
+ a !== void 0 && (e.alt = a);
148
+ let s = await o(r, e);
149
+ n.value = n.value.map((e) => e.id === r ? s : e), h.value?.id === r && (h.value = s), j(() => t.onUpdated?.(s));
278
150
  } catch (t) {
279
151
  e.onError?.(t);
280
152
  }
281
153
  }
282
- async function B() {
283
- if (m.value.size !== 0) try {
284
- await t.deleteMedia([...m.value]), n.value = n.value.filter((e) => !m.value.has(e.id)), g.value = g.value.filter((e) => !m.value.has(e.id)), m.value = /* @__PURE__ */ new Set(), h.value = null;
154
+ function ee(e) {
155
+ let t = /* @__PURE__ */ new Map();
156
+ for (let r of n.value) e.includes(r.id) && t.set(r.id, r);
157
+ for (let n of g.value) e.includes(n.id) && !t.has(n.id) && t.set(n.id, n);
158
+ return [...t.values()];
159
+ }
160
+ function K(e) {
161
+ n.value = n.value.filter((t) => !e.includes(t.id)), g.value = g.value.filter((t) => !e.includes(t.id)), m.value = /* @__PURE__ */ new Set(), h.value = null;
162
+ }
163
+ async function te() {
164
+ if (m.value.size === 0) return;
165
+ let { delete: n } = t;
166
+ if (typeof n != "function") return;
167
+ let r = [...m.value], i = ee(r);
168
+ try {
169
+ await n(r), K(r);
170
+ for (let e of i) j(() => t.onDeleted?.(e));
285
171
  } catch (t) {
286
172
  e.onError?.(t);
287
173
  }
288
174
  }
289
- async function V() {
290
- try {
291
- g.value = await t.getFrequentlyUsed();
175
+ async function q() {
176
+ let { frequentlyUsed: n } = t;
177
+ if (typeof n == "function") try {
178
+ g.value = await n();
292
179
  } catch (t) {
293
180
  e.onError?.(t);
294
181
  }
295
182
  }
296
- async function H() {
183
+ async function ne() {
297
184
  if (m.value.size === 0) return !1;
298
185
  y.value = [...m.value];
186
+ let { checkUsage: n } = t;
187
+ if (typeof n != "function") return _.value = {}, v.value = !0, !1;
299
188
  try {
300
- let e = await t.checkMediaUsage(y.value);
301
- _.value = e.data;
302
- let n = Object.values(e.data).some((e) => e.template_count > 0);
303
- return v.value = !0, n;
189
+ let e = await n(y.value);
190
+ _.value = e;
191
+ let t = Object.values(e).some((e) => e.templateCount > 0);
192
+ return v.value = !0, t;
304
193
  } catch (t) {
305
194
  return e.onError?.(t), !1;
306
195
  }
307
196
  }
308
- async function U() {
309
- if (v.value = !1, y.value.length !== 0) try {
310
- await t.deleteMedia(y.value), n.value = n.value.filter((e) => !y.value.includes(e.id)), g.value = g.value.filter((e) => !y.value.includes(e.id)), m.value = /* @__PURE__ */ new Set(), h.value = null, y.value = [], _.value = {};
197
+ async function re() {
198
+ let { delete: n } = t;
199
+ if (typeof n != "function" || (v.value = !1, y.value.length === 0)) return;
200
+ let r = y.value, i = ee(r);
201
+ try {
202
+ await n(r), K(r), y.value = [], _.value = {};
203
+ for (let e of i) j(() => t.onDeleted?.(e));
311
204
  } catch (t) {
312
205
  e.onError?.(t);
313
206
  }
314
207
  }
315
- function W() {
208
+ function J() {
316
209
  v.value = !1, y.value = [], _.value = {};
317
210
  }
318
- async function G(r) {
319
- b.value = !0, x.value = null;
211
+ async function Y(r) {
212
+ let a = t.importFromUrl;
213
+ if (typeof a != "function") return null;
214
+ x.value = !0, S.value = null;
320
215
  try {
321
- let e = await t.importFromUrl(r, i.value);
322
- return n.value = [e, ...n.value], e;
216
+ let e = await a(r, i.value, N());
217
+ return n.value = [e, ...n.value], j(() => t.onCreated?.(e)), e;
323
218
  } catch (t) {
324
- return x.value = t instanceof Error ? t.message : "Import failed", e.onError?.(t), null;
219
+ return S.value = t instanceof Error ? t.message : "Import failed", e.onError?.(t), null;
325
220
  } finally {
326
- b.value = !1;
221
+ x.value = !1;
327
222
  }
328
223
  }
329
- function K(e) {
224
+ function ie(e) {
330
225
  let t = new Set(m.value);
331
226
  t.has(e) ? t.delete(e) : t.add(e), m.value = t;
332
227
  }
333
- function q() {
228
+ function ae() {
334
229
  m.value = /* @__PURE__ */ new Set(), h.value = null;
335
230
  }
336
- function J(e) {
231
+ function oe(e) {
337
232
  h.value = e, m.value = /* @__PURE__ */ new Set([e.id]);
338
233
  }
339
- async function Y() {
234
+ async function se() {
235
+ let { storage: n } = t;
236
+ if (typeof n != "function") {
237
+ k.value = null;
238
+ return;
239
+ }
340
240
  try {
341
- r.value = await t.getMediaFolders();
241
+ k.value = await n();
242
+ } catch (t) {
243
+ e.onError?.(t);
244
+ }
245
+ }
246
+ async function X() {
247
+ let t = M();
248
+ if (t) try {
249
+ r.value = await t.list();
342
250
  } catch (t) {
343
251
  e.onError?.(t);
344
252
  }
345
253
  }
346
- async function ee(n, r) {
254
+ async function ce(t, n) {
255
+ let { create: r } = M() ?? { create: !1 };
256
+ if (typeof r != "function") return null;
347
257
  try {
348
- let e = await t.createMediaFolder(n, r);
349
- return await Y(), e;
258
+ let e = { name: t };
259
+ n !== void 0 && (e.parentId = n);
260
+ let i = await r(e);
261
+ return await X(), i;
350
262
  } catch (t) {
351
263
  return e.onError?.(t), null;
352
264
  }
353
265
  }
354
- function X(e, t) {
355
- for (let n of e) {
356
- if (n.id === t) return n;
357
- if (n.children) {
358
- let e = X(n.children, t);
359
- if (e) return e;
360
- }
361
- }
266
+ function le(e, t) {
267
+ for (let n of e) if (n.id === t) return n;
362
268
  return null;
363
269
  }
364
- async function te(n, r) {
365
- try {
366
- await t.renameMediaFolder(n, r), await Y();
270
+ async function ue(t, n) {
271
+ let { update: r } = M() ?? { update: !1 };
272
+ if (typeof r == "function") try {
273
+ await r(t, { name: n }), await X();
367
274
  } catch (t) {
368
275
  e.onError?.(t);
369
276
  }
370
277
  }
371
- async function ne(n) {
372
- try {
373
- let e = X(r.value, n)?.parent_id ?? null;
374
- await t.deleteMediaFolder(n), i.value === n && (i.value = e), await Y(), await k();
278
+ async function de(t) {
279
+ let { delete: n } = M() ?? { delete: !1 };
280
+ if (typeof n == "function") try {
281
+ let e = le(r.value, t)?.parentId ?? null;
282
+ await n(t), i.value === t && (i.value = e), await X(), await F();
375
283
  } catch (t) {
376
284
  e.onError?.(t);
377
285
  }
378
286
  }
379
- async function re(n) {
380
- E.value = n, C.value = null;
287
+ async function fe(n) {
288
+ D.value = n, w.value = null;
289
+ let { checkUsage: r } = t;
290
+ if (typeof r != "function") {
291
+ O.value = null, E.value = !0;
292
+ return;
293
+ }
381
294
  try {
382
- let e = await t.checkMediaUsage([n.id]);
383
- D.value = e.data[n.id] ?? null, T.value = !0;
295
+ let e = await r([n.id]);
296
+ O.value = e[n.id] ?? null, E.value = !0;
384
297
  } catch (t) {
385
298
  e.onError?.(t);
386
299
  }
387
300
  }
388
- function ie() {
389
- T.value = !1, E.value = null, D.value = null, C.value = null;
301
+ function pe() {
302
+ E.value = !1, D.value = null, O.value = null, w.value = null;
303
+ }
304
+ function Z(e) {
305
+ n.value = n.value.map((t) => t.id === e.id ? e : t), g.value = g.value.map((t) => t.id === e.id ? e : t), h.value?.id === e.id && (h.value = e), j(() => t.onUpdated?.(e));
390
306
  }
391
- async function ae(r) {
392
- if (!E.value) return null;
393
- S.value = !0, C.value = null;
307
+ async function me(n) {
308
+ let { replace: r } = t;
309
+ if (typeof r != "function" || !D.value) return null;
310
+ C.value = !0, w.value = null;
394
311
  try {
395
- let e = await t.replaceMedia(E.value.id, r);
396
- return n.value = n.value.map((t) => t.id === e.id ? e : t), g.value = g.value.map((t) => t.id === e.id ? e : t), h.value?.id === e.id && (h.value = e), T.value = !1, E.value = null, D.value = null, e;
312
+ let e = await r(D.value.id, n);
313
+ return Z(e), E.value = !1, D.value = null, O.value = null, e;
397
314
  } catch (t) {
398
- return C.value = t instanceof Error ? t.message : "Replace failed", e.onError?.(t), null;
315
+ return w.value = t instanceof Error ? t.message : "Replace failed", e.onError?.(t), null;
399
316
  } finally {
400
- S.value = !1;
317
+ C.value = !1;
401
318
  }
402
319
  }
403
- async function oe(r, i) {
320
+ async function he(n, r) {
321
+ let { replace: i } = t;
322
+ if (typeof i != "function") return null;
404
323
  try {
405
- let e = await t.replaceMedia(r, i);
406
- return n.value = n.value.map((t) => t.id === e.id ? e : t), g.value = g.value.map((t) => t.id === e.id ? e : t), h.value?.id === e.id && (h.value = e), e;
324
+ let e = await i(n, r);
325
+ return Z(e), e;
407
326
  } catch (t) {
408
327
  return e.onError?.(t), null;
409
328
  }
@@ -425,47 +344,49 @@ function me(e) {
425
344
  frequentlyUsedItems: g,
426
345
  deleteUsageInfo: _,
427
346
  showDeleteWarning: v,
428
- loadItems: k,
429
- loadMore: A,
430
- search: j,
431
- filterByCategory: M,
432
- sortBy: N,
433
- navigateToFolder: P,
434
- showFrequentlyUsed: F,
435
- uploadFile: I,
436
- uploadFiles: L,
437
- moveSelected: R,
438
- updateFile: z,
439
- deleteSelected: B,
440
- isImportingFromUrl: b,
441
- importFromUrlError: x,
442
- importFromUrl: G,
443
- toggleSelection: K,
444
- clearSelection: q,
445
- selectItem: J,
446
- loadFolders: Y,
447
- createFolder: ee,
448
- renameFolder: te,
449
- deleteFolder: ne,
450
- findFolderInTree: X,
451
- loadFrequentlyUsed: V,
452
- checkUsageBeforeDelete: H,
453
- confirmDelete: U,
454
- cancelDelete: W,
455
- isReplacing: S,
456
- replaceError: C,
457
- showReplaceWarning: T,
458
- pendingReplaceItem: E,
459
- replaceUsageInfo: D,
460
- checkUsageBeforeReplace: re,
461
- cancelReplace: ie,
462
- replaceFile: ae,
463
- replaceMediaDirectly: oe
347
+ loadItems: F,
348
+ loadMore: I,
349
+ search: L,
350
+ filterByCategory: R,
351
+ sortBy: z,
352
+ navigateToFolder: B,
353
+ showFrequentlyUsed: V,
354
+ uploadFile: H,
355
+ uploadFiles: U,
356
+ moveSelected: W,
357
+ updateFile: G,
358
+ deleteSelected: te,
359
+ isImportingFromUrl: x,
360
+ importFromUrlError: S,
361
+ importFromUrl: Y,
362
+ toggleSelection: ie,
363
+ clearSelection: ae,
364
+ selectItem: oe,
365
+ loadFolders: X,
366
+ createFolder: ce,
367
+ renameFolder: ue,
368
+ deleteFolder: de,
369
+ findFolderInTree: le,
370
+ loadFrequentlyUsed: q,
371
+ checkUsageBeforeDelete: ne,
372
+ confirmDelete: re,
373
+ cancelDelete: J,
374
+ isReplacing: C,
375
+ replaceError: w,
376
+ showReplaceWarning: E,
377
+ pendingReplaceItem: D,
378
+ replaceUsageInfo: O,
379
+ checkUsageBeforeReplace: fe,
380
+ cancelReplace: pe,
381
+ replaceFile: me,
382
+ replaceMediaDirectly: he,
383
+ storageInfo: k,
384
+ loadStorage: se
464
385
  };
465
386
  }
466
387
  //#endregion
467
388
  //#region src/keys.ts
468
- var he = Symbol("templaticalMediaPlanConfig"), ge = Symbol("templaticalMediaPopoverTarget"), _e = Symbol("templaticalMediaTranslations"), ve = Symbol("templaticalMediaUiTheme"), ye = Symbol("templaticalMediaUiLocale"), be = /* @__PURE__ */ fe({ default: () => xe }), xe = { mediaLibrary: {
389
+ var de = Symbol("templaticalMediaLimits"), fe = Symbol("templaticalMediaPopoverTarget"), pe = Symbol("templaticalMediaTranslations"), Z = Symbol("templaticalMediaUiTheme"), me = Symbol("templaticalMediaUiLocale"), he = /* @__PURE__ */ le({ default: () => ge }), ge = { mediaLibrary: {
469
390
  title: "Media Library",
470
391
  searchPlaceholder: "Search files...",
471
392
  allFiles: "All Files",
@@ -477,6 +398,7 @@ var he = Symbol("templaticalMediaPlanConfig"), ge = Symbol("templaticalMediaPopo
477
398
  newFolder: "New Folder",
478
399
  folderName: "Folder name",
479
400
  noFiles: "No files found",
401
+ noSearchResults: "No files match your search",
480
402
  dropOrClick: "Drop files here or click to upload",
481
403
  acceptedFormats: "Images, PDF, Video, Audio, Documents (max 10MB)",
482
404
  uploading: "Uploading...",
@@ -522,11 +444,6 @@ var he = Symbol("templaticalMediaPlanConfig"), ge = Symbol("templaticalMediaPopo
522
444
  import: "Import",
523
445
  importing: "Importing...",
524
446
  importError: "Failed to import from URL",
525
- conversionLabel: "Size",
526
- conversionOriginal: "Original",
527
- conversionSmall: "Small (150px)",
528
- conversionMedium: "Medium (600px)",
529
- conversionLarge: "Large (1200px)",
530
447
  replaceFile: "Replace File",
531
448
  replaceWarningTitle: "Replace File",
532
449
  replaceWarningMessage: "You are about to replace this file. The replacement must have the same file extension ({extension}).",
@@ -551,8 +468,8 @@ var he = Symbol("templaticalMediaPlanConfig"), ge = Symbol("templaticalMediaPopo
551
468
  } };
552
469
  //#endregion
553
470
  //#region src/composables/useI18n.ts
554
- function Z(e) {
555
- let t = e ?? _(_e, null), n = (v(t) ? t.value : t) ?? xe;
471
+ function Q(e) {
472
+ let t = e ?? p(pe, null), n = (m(t) ? t.value : t) ?? ge;
556
473
  function r(e, t) {
557
474
  return e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : `{${n}}`);
558
475
  }
@@ -563,86 +480,104 @@ function Z(e) {
563
480
  }
564
481
  //#endregion
565
482
  //#region src/components/media/MediaBreadcrumb.vue?vue&type=script&setup=true&lang.ts
566
- var Se = {
483
+ var _e = {
567
484
  key: 0,
568
485
  class: "tpl:flex tpl:items-center tpl:gap-1 tpl:text-xs",
569
486
  style: { color: "var(--tpl-text-muted)" }
570
- }, Ce = ["onClick"], we = {
487
+ }, ve = ["onClick"], ye = {
571
488
  key: 1,
572
489
  style: { color: "var(--tpl-text)" }
573
- }, Te = /* @__PURE__ */ h({
490
+ }, be = /* @__PURE__ */ d({
574
491
  __name: "MediaBreadcrumb",
575
492
  props: {
576
493
  folders: {},
577
494
  currentFolderId: {}
578
495
  },
579
496
  emits: ["navigate"],
580
- setup(e, { emit: t }) {
581
- let n = e, r = t, { t: a } = Z(), o = s(() => {
582
- if (!n.currentFolderId) return [];
497
+ setup(t, { emit: n }) {
498
+ let i = t, a = n, { t: l } = Q(), d = r(() => {
499
+ if (!i.currentFolderId) return [];
583
500
  let e = [];
584
- return c(n.folders, n.currentFolderId, e), e;
501
+ return f(i.folders, i.currentFolderId, e), e;
585
502
  });
586
- function c(e, t, n) {
503
+ function f(e, t, n) {
587
504
  for (let r of e) {
588
505
  if (r.id === t) return n.push(r), !0;
589
- if (r.children && c(r.children, t, n)) return n.unshift(r), !0;
506
+ if (f(r.children, t, n)) return n.unshift(r), !0;
590
507
  }
591
508
  return !1;
592
509
  }
593
- return (e, t) => o.value.length > 0 ? (S(), d("div", Se, [f("button", {
510
+ return (t, n) => d.value.length > 0 ? (v(), s("div", _e, [c("button", {
594
511
  class: "tpl:transition-colors tpl:duration-150 tpl:hover:underline",
595
512
  style: { color: "var(--tpl-primary)" },
596
- onClick: t[0] ||= (e) => r("navigate", null)
597
- }, D(k(a).mediaLibrary.allFiles), 1), (S(!0), d(i, null, T(o.value, (e, t) => (S(), d(i, { key: e.id }, [m(k(L), {
513
+ onClick: n[0] ||= (e) => a("navigate", null)
514
+ }, C(E(l).mediaLibrary.allFiles), 1), (v(!0), s(e, null, x(d.value, (t, n) => (v(), s(e, { key: t.id }, [u(E(P), {
598
515
  size: 12,
599
516
  "stroke-width": 2
600
- }), t < o.value.length - 1 ? (S(), d("button", {
517
+ }), n < d.value.length - 1 ? (v(), s("button", {
601
518
  key: 0,
602
519
  class: "tpl:transition-colors tpl:duration-150 tpl:hover:underline",
603
520
  style: { color: "var(--tpl-primary)" },
604
- onClick: (t) => r("navigate", e.id)
605
- }, D(e.name), 9, Ce)) : (S(), d("span", we, D(e.name), 1))], 64))), 128))])) : u("", !0);
606
- }
607
- });
608
- //#endregion
609
- //#region src/composables/useMediaCategories.ts
610
- function Q(e) {
611
- let t = e ?? _(he, null);
612
- if (!t) throw Error("[Templatical] useMediaCategories() needs a plan config in scope. Render it under <MediaLibraryModal> (pass its `planConfig` prop) or provide PLAN_CONFIG_KEY yourself.");
613
- let n = s(() => t.config.value?.media ?? null), r = s(() => n.value?.use_media_library ?? !0), i = s(() => n.value?.categories ?? null), a = s(() => i.value ? Object.values(i.value).flatMap((e) => e.mime_types) : []), o = s(() => a.value.join(",")), c = s(() => n.value?.max_file_size ?? 0);
521
+ onClick: (e) => a("navigate", t.id)
522
+ }, C(t.name), 9, ve)) : (v(), s("span", ye, C(t.name), 1))], 64))), 128))])) : o("", !0);
523
+ }
524
+ }), xe = [
525
+ "images",
526
+ "documents",
527
+ "videos",
528
+ "audio"
529
+ ];
530
+ function $(e) {
531
+ let t = e ?? p(de, null);
532
+ if (!t) throw Error("[Templatical] useMediaCategories() needs media limits in scope. Render it under <MediaLibraryModal> or provide MEDIA_LIMITS_KEY yourself.");
533
+ let n = t, i = r(() => !0), a = r(() => n.maxFileSize ?? Infinity), o = r(() => {
534
+ let e = n.accept;
535
+ if (e && e.length > 0) return e;
536
+ let t = n.mimeTypes;
537
+ return t ? Object.keys(t) : xe;
538
+ }), s = r(() => {
539
+ let e = n.mimeTypes;
540
+ return e ? o.value.flatMap((t) => e[t] ?? []) : [];
541
+ }), c = r(() => s.value.join(","));
614
542
  function l(e, t) {
615
- return i.value ? !t || t.length === 0 ? a.value.includes(e) : t.some((t) => i.value[t]?.mime_types.includes(e)) : !1;
543
+ let r = n.mimeTypes;
544
+ return !r || (t && t.length > 0 ? t : Object.keys(r)).some((t) => r[t]?.includes(e) ?? !1);
616
545
  }
617
546
  function u(e) {
618
- return i.value ? i.value.images?.mime_types.includes(e) ?? !1 : !1;
547
+ return l(e.type) && e.size <= a.value;
619
548
  }
620
549
  function d(e) {
621
- if (!i.value) return null;
622
- for (let [t, n] of Object.entries(i.value)) if (n.mime_types.includes(e)) return t;
550
+ let t = n.mimeTypes;
551
+ return t ? t.images?.includes(e) ?? !1 : e.startsWith("image/");
552
+ }
553
+ function f(e) {
554
+ let t = n.mimeTypes;
555
+ if (!t) return null;
556
+ for (let [n, r] of Object.entries(t)) if (r?.includes(e)) return n;
623
557
  return null;
624
558
  }
625
559
  return {
626
- isMediaLibraryEnabled: r,
627
- allAcceptedMimeTypes: a,
628
- allAcceptedInputString: o,
629
- maxFileSize: c,
630
- availableCategories: s(() => i.value ? Object.keys(i.value) : []),
560
+ isMediaLibraryEnabled: i,
561
+ allAcceptedMimeTypes: s,
562
+ allAcceptedInputString: c,
563
+ maxFileSize: a,
564
+ availableCategories: o,
631
565
  isAcceptedMimeType: l,
632
- isImageMimeType: u,
633
- getCategoryForMimeType: d
566
+ isAcceptedFile: u,
567
+ isImageMimeType: d,
568
+ getCategoryForMimeType: f
634
569
  };
635
570
  }
636
571
  //#endregion
637
572
  //#region src/composables/useImageCrop.ts
638
- var Ee = {
573
+ var Se = {
639
574
  free: void 0,
640
575
  square: 1,
641
576
  landscape43: 4 / 3,
642
577
  landscape169: 16 / 9,
643
578
  original: void 0
644
579
  };
645
- function De(e) {
580
+ function Ce(e) {
646
581
  return e === "image/png" || e === "image/gif" ? {
647
582
  mimeType: "image/png",
648
583
  quality: 1
@@ -654,7 +589,7 @@ function De(e) {
654
589
  quality: .92
655
590
  };
656
591
  }
657
- function Oe(e, t, n) {
592
+ function we(e, t, n) {
658
593
  let r = e.width, i = e.height;
659
594
  if (!t && !n) return e;
660
595
  let a = r, o = i;
@@ -668,7 +603,7 @@ function Oe(e, t, n) {
668
603
  let c = s.getContext("2d");
669
604
  return c && (c.imageSmoothingEnabled = !0, c.imageSmoothingQuality = "high", c.drawImage(e, 0, 0, a, o)), s;
670
605
  }
671
- function ke(e, t, n) {
606
+ function Te(e, t, n) {
672
607
  return new Promise((r, i) => {
673
608
  e.toBlob((e) => {
674
609
  if (!e) {
@@ -680,7 +615,7 @@ function ke(e, t, n) {
680
615
  }, n.mimeType, n.quality);
681
616
  });
682
617
  }
683
- function Ae(e, t, n, r) {
618
+ function Ee(e, t, n, r) {
684
619
  let i = e, a = t;
685
620
  if (n && i > n) {
686
621
  let e = n / i;
@@ -697,101 +632,101 @@ function Ae(e, t, n, r) {
697
632
  }
698
633
  //#endregion
699
634
  //#region src/components/media/MediaEditModal.vue?vue&type=script&setup=true&lang.ts
700
- var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne = {
635
+ var De = ["data-tpl-theme"], Oe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, ke = {
701
636
  class: "tpl:text-sm tpl:font-semibold",
702
637
  style: { color: "var(--tpl-text)" }
703
- }, Pe = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto tpl:px-5" }, Fe = {
638
+ }, Ae = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto tpl:px-5" }, je = {
704
639
  key: 0,
705
640
  class: "tpl:mb-4"
706
- }, Ie = {
641
+ }, Me = {
707
642
  class: "tpl:relative tpl:mb-3 tpl:overflow-hidden tpl:rounded-md tpl:border",
708
643
  style: {
709
644
  "border-color": "var(--tpl-border)",
710
645
  height: "300px",
711
646
  "background-color": "var(--tpl-bg)"
712
647
  }
713
- }, Le = { class: "tpl:space-y-3" }, Re = {
648
+ }, Ne = { class: "tpl:space-y-3" }, Pe = {
714
649
  class: "tpl:mb-1.5 tpl:block tpl:text-xs tpl:font-medium",
715
650
  style: { color: "var(--tpl-text-muted)" }
716
- }, ze = { class: "tpl:flex tpl:flex-wrap tpl:gap-1.5" }, Be = ["onClick"], Ve = { class: "tpl:flex tpl:gap-3" }, He = { class: "tpl:flex-1" }, Ue = {
651
+ }, Fe = { class: "tpl:flex tpl:flex-wrap tpl:gap-1.5" }, Ie = ["onClick"], Le = { class: "tpl:flex tpl:gap-3" }, Re = { class: "tpl:flex-1" }, ze = {
717
652
  class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
718
653
  style: { color: "var(--tpl-text-muted)" }
719
- }, We = {
654
+ }, Be = {
720
655
  class: "tpl:font-normal",
721
656
  style: { color: "var(--tpl-text-dim)" }
722
- }, Ge = { class: "tpl:relative" }, Ke = ["value", "placeholder"], qe = {
657
+ }, Ve = { class: "tpl:relative" }, He = ["value", "placeholder"], Ue = {
723
658
  class: "tpl:absolute tpl:top-1/2 tpl:right-2.5 tpl:-translate-y-1/2 tpl:text-xs",
724
659
  style: { color: "var(--tpl-text-dim)" }
725
- }, Je = { class: "tpl:flex-1" }, Ye = {
660
+ }, We = { class: "tpl:flex-1" }, Ge = {
726
661
  class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
727
662
  style: { color: "var(--tpl-text-muted)" }
728
- }, Xe = {
663
+ }, Ke = {
729
664
  class: "tpl:font-normal",
730
665
  style: { color: "var(--tpl-text-dim)" }
731
- }, Ze = { class: "tpl:relative" }, Qe = ["value", "placeholder"], $e = {
666
+ }, qe = { class: "tpl:relative" }, Je = ["value", "placeholder"], Ye = {
732
667
  class: "tpl:absolute tpl:top-1/2 tpl:right-2.5 tpl:-translate-y-1/2 tpl:text-xs",
733
668
  style: { color: "var(--tpl-text-dim)" }
734
- }, et = {
669
+ }, Xe = {
735
670
  key: 0,
736
671
  class: "tpl:flex tpl:items-center tpl:gap-1 tpl:text-xs",
737
672
  style: { color: "var(--tpl-text-muted)" }
738
- }, tt = {
673
+ }, Ze = {
739
674
  class: "tpl:font-medium",
740
675
  style: { color: "var(--tpl-text)" }
741
- }, nt = { class: "tpl:mb-3" }, rt = {
676
+ }, Qe = { class: "tpl:mb-3" }, $e = {
742
677
  class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
743
678
  style: { color: "var(--tpl-text-muted)" }
744
- }, it = ["autofocus"], at = {
679
+ }, et = ["autofocus"], tt = {
745
680
  key: 1,
746
681
  class: "tpl:mb-4"
747
- }, ot = {
682
+ }, nt = {
748
683
  class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
749
684
  style: { color: "var(--tpl-text-muted)" }
750
- }, st = ["placeholder"], ct = { class: "tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2 tpl:p-5 tpl:pt-4" }, lt = ["disabled"], ut = /*@__PURE__*/ h({
685
+ }, rt = ["placeholder"], it = { class: "tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2 tpl:p-5 tpl:pt-4" }, at = ["disabled"], ot = /*@__PURE__*/ d({
751
686
  __name: "MediaEditModal",
752
687
  props: {
753
688
  visible: { type: Boolean },
754
689
  item: {}
755
690
  },
756
691
  emits: ["save", "close"],
757
- setup(e, { emit: t }) {
758
- let n = e, r = t, { t: c } = Z(), h = _(ve, null), g = _(ge, w(null)), v = c.mediaLibrary, { isImageMimeType: x } = Q(), C = w(""), E = w(""), O = w(null), P = w("free"), I = w(void 0), L = w(void 0), R = w(""), z = w(""), B = w(void 0), V = w(null), H = w(!1), U = w(!1), W = w(!1), G = s(() => n.item ? [
692
+ setup(i, { emit: d }) {
693
+ let f = i, m = d, { t: _ } = Q(), y = p(Z, null), S = p(fe, b(null)), w = _.mediaLibrary, { isImageMimeType: T } = $(), j = b(""), N = b(""), P = b(null), F = b("free"), I = b(void 0), L = b(void 0), R = b(""), z = b(""), B = b(void 0), V = b(null), H = b(!1), U = b(!1), W = b(!1), G = r(() => f.item ? [
759
694
  "image/jpeg",
760
695
  "image/png",
761
696
  "image/webp",
762
697
  "image/gif"
763
- ].includes(n.item.mime_type) : !1), K = s(() => P.value === "original" ? B.value : Ee[P.value]), q = s(() => V.value ? Ae(V.value.width, V.value.height, I.value, L.value) : null);
764
- j(() => n.visible, (e) => {
765
- e && n.item && (C.value = n.item.filename, E.value = n.item.alt_text || "", P.value = "free", I.value = void 0, L.value = void 0, R.value = "", z.value = "", B.value = void 0, V.value = null, H.value = !1, W.value = !1, n.item.width && n.item.height && (B.value = n.item.width / n.item.height));
698
+ ].includes(f.item.mimeType ?? "") : !1), ee = r(() => F.value === "original" ? B.value : Se[F.value]), K = r(() => V.value ? Ee(V.value.width, V.value.height, I.value, L.value) : null);
699
+ O(() => f.visible, (e) => {
700
+ e && f.item && (j.value = f.item.filename ?? "", N.value = f.item.alt ?? "", F.value = "free", I.value = void 0, L.value = void 0, R.value = "", z.value = "", B.value = void 0, V.value = null, H.value = !1, W.value = !1, f.item.width && f.item.height && (B.value = f.item.width / f.item.height));
766
701
  });
767
- function J(e) {
702
+ function te(e) {
768
703
  e.coordinates && (V.value = {
769
704
  width: Math.round(e.coordinates.width),
770
705
  height: Math.round(e.coordinates.height)
771
706
  }, W.value = !0);
772
707
  }
773
- function Y() {
774
- H.value = !0, !B.value && n.item?.width && n.item?.height && (B.value = n.item.width / n.item.height);
708
+ function q() {
709
+ H.value = !0, !B.value && f.item?.width && f.item?.height && (B.value = f.item.width / f.item.height);
775
710
  }
776
- function ee(e) {
711
+ function ne(e) {
777
712
  let t = e.target.value;
778
713
  R.value = t, I.value = t && parseInt(t, 10) || void 0;
779
714
  }
780
- function X(e) {
715
+ function J(e) {
781
716
  let t = e.target.value;
782
717
  z.value = t, L.value = t && parseInt(t, 10) || void 0;
783
718
  }
784
- async function te() {
785
- let e = C.value.trim();
786
- if (!e || !n.item || U.value) return;
787
- let t = x(n.item.mime_type), i;
788
- if (G.value && O.value && W.value) {
719
+ async function Y() {
720
+ let e = j.value.trim();
721
+ if (!e || !f.item || U.value) return;
722
+ let t = T(f.item.mimeType ?? ""), n;
723
+ if (G.value && P.value && W.value) {
789
724
  U.value = !0;
790
725
  try {
791
- let { canvas: e } = O.value.getResult();
726
+ let { canvas: e } = P.value.getResult();
792
727
  if (e) {
793
- let t = Oe(e, I.value, L.value), r = De(n.item.mime_type);
794
- i = { file: await ke(t, n.item.filename, r) };
728
+ let t = we(e, I.value, L.value), r = Ce(f.item.mimeType ?? "");
729
+ n = { file: await Te(t, f.item.filename ?? "image", r) };
795
730
  }
796
731
  } catch {
797
732
  U.value = !1;
@@ -799,12 +734,12 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
799
734
  }
800
735
  U.value = !1;
801
736
  }
802
- r("save", n.item.id, e, t ? E.value : void 0, i), r("close");
737
+ m("save", f.item.id, e, t ? N.value : void 0, n), m("close");
803
738
  }
804
- function ne(e) {
805
- e.key === "Enter" && !U.value && (e.preventDefault(), te()), e.key === "Escape" && r("close");
739
+ function ie(e) {
740
+ e.key === "Enter" && !U.value && (e.preventDefault(), Y()), e.key === "Escape" && m("close");
806
741
  }
807
- return (t, n) => (S(), l(a, { to: k(g) || "body" }, [m(o, {
742
+ return (r, d) => (v(), a(t, { to: E(S) || "body" }, [u(n, {
808
743
  "enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
809
744
  "enter-from-class": "tpl:opacity-0",
810
745
  "enter-to-class": "tpl:opacity-100",
@@ -812,47 +747,47 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
812
747
  "leave-from-class": "tpl:opacity-100",
813
748
  "leave-to-class": "tpl:opacity-0"
814
749
  }, {
815
- default: M(() => [e.visible && e.item ? (S(), d("div", {
750
+ default: k(() => [i.visible && i.item ? (v(), s("div", {
816
751
  key: 0,
817
- "data-tpl-theme": k(h),
818
- class: "tpl tpl:fixed tpl:inset-0 tpl:z-[10000] tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
752
+ "data-tpl-theme": E(y),
753
+ class: "tpl tpl:fixed tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
819
754
  style: { "background-color": "var(--tpl-overlay)" },
820
- onClick: n[3] ||= F((e) => r("close"), ["self"]),
821
- onKeydown: ne
822
- }, [f("div", {
823
- class: y(["tpl:flex tpl:max-h-[90%] tpl:w-full tpl:flex-col tpl:overflow-hidden tpl:rounded-lg tpl:shadow-xl", G.value ? "tpl:max-w-2xl" : "tpl:max-w-sm"]),
755
+ onClick: d[3] ||= M((e) => m("close"), ["self"]),
756
+ onKeydown: ie
757
+ }, [c("div", {
758
+ class: h(["tpl:flex tpl:max-h-[90%] tpl:w-full tpl:flex-col tpl:overflow-hidden tpl:rounded-lg tpl:shadow-xl", G.value ? "tpl:max-w-2xl" : "tpl:max-w-sm"]),
824
759
  style: { "background-color": "var(--tpl-bg-elevated)" }
825
760
  }, [
826
- f("div", Me, [f("h3", Ne, D(k(c).mediaLibrary.editFile), 1)]),
827
- f("div", Pe, [
828
- G.value ? (S(), d("div", Fe, [f("div", Ie, [m(k(re), {
761
+ c("div", Oe, [c("h3", ke, C(E(_).mediaLibrary.editFile), 1)]),
762
+ c("div", Ae, [
763
+ G.value ? (v(), s("div", je, [c("div", Me, [u(E(re), {
829
764
  ref_key: "cropperRef",
830
- ref: O,
831
- src: e.item.url,
832
- "stencil-props": { aspectRatio: K.value },
765
+ ref: P,
766
+ src: i.item.url,
767
+ "stencil-props": { aspectRatio: ee.value },
833
768
  class: "tpl:h-full tpl:w-full",
834
769
  "background-class": "tpl-cropper-background",
835
- onChange: J,
836
- onReady: Y
837
- }, null, 8, ["src", "stencil-props"])]), f("div", Le, [
838
- f("div", null, [f("label", Re, D(k(c).mediaLibrary.cropAspectRatio), 1), f("div", ze, [(S(), d(i, null, T([
770
+ onChange: te,
771
+ onReady: q
772
+ }, null, 8, ["src", "stencil-props"])]), c("div", Ne, [
773
+ c("div", null, [c("label", Pe, C(E(_).mediaLibrary.cropAspectRatio), 1), c("div", Fe, [(v(), s(e, null, x([
839
774
  "free",
840
775
  "square",
841
776
  "landscape43",
842
777
  "landscape169",
843
778
  "original"
844
- ], (e) => f("button", {
779
+ ], (e) => c("button", {
845
780
  key: e,
846
781
  type: "button",
847
782
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-2.5 tpl:py-1 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
848
- style: b({
849
- borderColor: P.value === e ? "var(--tpl-primary)" : "var(--tpl-border)",
850
- backgroundColor: P.value === e ? "var(--tpl-primary-light)" : "var(--tpl-bg)",
851
- color: P.value === e ? "var(--tpl-primary)" : "var(--tpl-text)"
783
+ style: g({
784
+ borderColor: F.value === e ? "var(--tpl-primary)" : "var(--tpl-border)",
785
+ backgroundColor: F.value === e ? "var(--tpl-primary-light)" : "var(--tpl-bg)",
786
+ color: F.value === e ? "var(--tpl-primary)" : "var(--tpl-text)"
852
787
  }),
853
- onClick: (t) => P.value = e
854
- }, D(k(v)[`crop${e.charAt(0).toUpperCase()}${e.slice(1)}`]), 13, Be)), 64))])]),
855
- f("div", Ve, [f("div", He, [f("label", Ue, [p(D(k(c).mediaLibrary.cropMaxWidth) + " ", 1), f("span", We, D(k(c).mediaLibrary.cropOptional), 1)]), f("div", Ge, [f("input", {
788
+ onClick: (t) => F.value = e
789
+ }, C(E(w)[`crop${e.charAt(0).toUpperCase()}${e.slice(1)}`]), 13, Ie)), 64))])]),
790
+ c("div", Le, [c("div", Re, [c("label", ze, [l(C(E(_).mediaLibrary.cropMaxWidth) + " ", 1), c("span", Be, C(E(_).mediaLibrary.cropOptional), 1)]), c("div", Ve, [c("input", {
856
791
  value: R.value,
857
792
  type: "number",
858
793
  min: "1",
@@ -863,8 +798,8 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
863
798
  color: "var(--tpl-text)"
864
799
  },
865
800
  placeholder: V.value?.width?.toString() || "",
866
- onInput: ee
867
- }, null, 40, Ke), f("span", qe, D(k(c).mediaLibrary.cropPixels), 1)])]), f("div", Je, [f("label", Ye, [p(D(k(c).mediaLibrary.cropMaxHeight) + " ", 1), f("span", Xe, D(k(c).mediaLibrary.cropOptional), 1)]), f("div", Ze, [f("input", {
801
+ onInput: ne
802
+ }, null, 40, He), c("span", Ue, C(E(_).mediaLibrary.cropPixels), 1)])]), c("div", We, [c("label", Ge, [l(C(E(_).mediaLibrary.cropMaxHeight) + " ", 1), c("span", Ke, C(E(_).mediaLibrary.cropOptional), 1)]), c("div", qe, [c("input", {
868
803
  value: z.value,
869
804
  type: "number",
870
805
  min: "1",
@@ -875,12 +810,12 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
875
810
  color: "var(--tpl-text)"
876
811
  },
877
812
  placeholder: V.value?.height?.toString() || "",
878
- onInput: X
879
- }, null, 40, Qe), f("span", $e, D(k(c).mediaLibrary.cropPixels), 1)])])]),
880
- q.value ? (S(), d("div", et, [f("span", null, D(k(c).mediaLibrary.cropOutputSize) + ": ", 1), f("span", tt, D(q.value.width) + " x " + D(q.value.height) + " " + D(k(c).mediaLibrary.cropPixels), 1)])) : u("", !0)
881
- ])])) : u("", !0),
882
- f("div", nt, [f("label", rt, D(k(c).mediaLibrary.fileName), 1), N(f("input", {
883
- "onUpdate:modelValue": n[0] ||= (e) => C.value = e,
813
+ onInput: J
814
+ }, null, 40, Je), c("span", Ye, C(E(_).mediaLibrary.cropPixels), 1)])])]),
815
+ K.value ? (v(), s("div", Xe, [c("span", null, C(E(_).mediaLibrary.cropOutputSize) + ": ", 1), c("span", Ze, C(K.value.width) + " x " + C(K.value.height) + " " + C(E(_).mediaLibrary.cropPixels), 1)])) : o("", !0)
816
+ ])])) : o("", !0),
817
+ c("div", Qe, [c("label", $e, C(E(_).mediaLibrary.fileName), 1), A(c("input", {
818
+ "onUpdate:modelValue": d[0] ||= (e) => j.value = e,
884
819
  type: "text",
885
820
  class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
886
821
  style: {
@@ -889,9 +824,9 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
889
824
  color: "var(--tpl-text)"
890
825
  },
891
826
  autofocus: !G.value
892
- }, null, 8, it), [[A, C.value]])]),
893
- k(x)(e.item.mime_type) ? (S(), d("div", at, [f("label", ot, D(k(c).mediaLibrary.altText), 1), N(f("input", {
894
- "onUpdate:modelValue": n[1] ||= (e) => E.value = e,
827
+ }, null, 8, et), [[D, j.value]])]),
828
+ E(T)(i.item.mimeType ?? "") ? (v(), s("div", tt, [c("label", nt, C(E(_).mediaLibrary.altText), 1), A(c("input", {
829
+ "onUpdate:modelValue": d[1] ||= (e) => N.value = e,
895
830
  type: "text",
896
831
  class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
897
832
  style: {
@@ -899,46 +834,49 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
899
834
  "background-color": "var(--tpl-bg)",
900
835
  color: "var(--tpl-text)"
901
836
  },
902
- placeholder: k(c).mediaLibrary.altTextPlaceholder
903
- }, null, 8, st), [[A, E.value]])])) : u("", !0)
837
+ placeholder: E(_).mediaLibrary.altTextPlaceholder
838
+ }, null, 8, rt), [[D, N.value]])])) : o("", !0)
904
839
  ]),
905
- f("div", ct, [f("button", {
840
+ c("div", it, [c("button", {
906
841
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
907
842
  style: {
908
843
  "border-color": "var(--tpl-border)",
909
844
  color: "var(--tpl-text)",
910
845
  "background-color": "var(--tpl-bg)"
911
846
  },
912
- onClick: n[2] ||= (e) => r("close")
913
- }, D(k(c).mediaLibrary.cancel), 1), f("button", {
847
+ onClick: d[2] ||= (e) => m("close")
848
+ }, C(E(_).mediaLibrary.cancel), 1), c("button", {
914
849
  class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
915
850
  style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
916
851
  disabled: U.value,
917
- onClick: te
918
- }, D(U.value ? k(c).mediaLibrary.saving : k(c).mediaLibrary.saveChanges), 9, lt)])
919
- ], 2)], 40, je)) : u("", !0)]),
852
+ onClick: Y
853
+ }, C(U.value ? E(_).mediaLibrary.saving : E(_).mediaLibrary.saveChanges), 9, at)])
854
+ ], 2)], 40, De)) : o("", !0)]),
920
855
  _: 1
921
856
  })], 8, ["to"]));
922
857
  }
923
- }), dt = (e, t) => {
858
+ }), st = (e, t) => {
924
859
  let n = e.__vccOpts || e;
925
860
  for (let [e, r] of t) n[e] = r;
926
861
  return n;
927
- }, ft = /*#__PURE__*/ dt(ut, [["__scopeId", "data-v-72091aa5"]]), pt = {
862
+ }, ct = /*#__PURE__*/ st(ot, [["__scopeId", "data-v-c7f50076"]]), lt = {
928
863
  key: 1,
929
864
  class: "tpl:size-4 tpl:shrink-0"
930
- }, mt = {
865
+ }, ut = {
931
866
  key: 0,
932
867
  class: "tpl:truncate"
933
- }, ht = {
868
+ }, dt = {
934
869
  key: 3,
935
870
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:gap-0.5 tpl:opacity-0 tpl:transition-opacity tpl:group-hover:opacity-100"
936
- }, gt = ["title"], _t = ["title"], vt = { key: 0 }, yt = ["placeholder"], bt = /* @__PURE__ */ h({
871
+ }, ft = ["title"], pt = ["title"], mt = { key: 0 }, ht = ["placeholder"], gt = /* @__PURE__ */ d({
937
872
  __name: "MediaFolderTreeNode",
938
873
  props: {
939
874
  folder: {},
940
875
  currentFolderId: {},
941
- depth: {}
876
+ depth: {},
877
+ canCreateFolder: { type: Boolean },
878
+ canRenameFolder: { type: Boolean },
879
+ canDeleteFolder: { type: Boolean }
942
880
  },
943
881
  emits: [
944
882
  "navigate",
@@ -946,64 +884,64 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
946
884
  "renameFolder",
947
885
  "deleteFolder"
948
886
  ],
949
- setup(e, { emit: t }) {
950
- let n = e, r = t, { t: a } = Z(), o = w(!1), c = w(!1), p = w(""), h = w(!1), g = w(""), _ = s(() => (n.folder.children?.length ?? 0) > 0), v = s(() => n.depth < 4), x = s(() => n.currentFolderId === n.folder.id), C = s(() => !n.currentFolderId || !n.folder.children ? !1 : j(n.folder.children, n.currentFolderId)), O = s(() => o.value || C.value);
951
- function j(e, t) {
952
- for (let n of e) if (n.id === t || n.children && j(n.children, t)) return !0;
887
+ setup(t, { emit: n }) {
888
+ let i = t, l = n, { t: d } = Q(), f = b(!1), p = b(!1), m = b(""), _ = b(!1), y = b(""), w = r(() => i.folder.children.length > 0), T = r(() => i.depth < 4), O = r(() => i.currentFolderId === i.folder.id), k = r(() => i.currentFolderId ? F(i.folder.children, i.currentFolderId) : !1), N = r(() => f.value || k.value);
889
+ function F(e, t) {
890
+ for (let n of e) if (n.id === t || F(n.children, t)) return !0;
953
891
  return !1;
954
892
  }
955
- function M() {
956
- o.value = !o.value;
957
- }
958
893
  function I() {
959
- c.value = !0, p.value = n.folder.name;
894
+ f.value = !f.value;
960
895
  }
961
896
  function R() {
962
- let e = p.value.trim();
963
- e && e !== n.folder.name && r("renameFolder", n.folder.id, e), c.value = !1, p.value = "";
897
+ p.value = !0, m.value = i.folder.name;
964
898
  }
965
899
  function z() {
966
- c.value = !1, p.value = "";
900
+ let e = m.value.trim();
901
+ e && e !== i.folder.name && l("renameFolder", i.folder.id, e), p.value = !1, m.value = "";
902
+ }
903
+ function B() {
904
+ p.value = !1, m.value = "";
967
905
  }
968
906
  function V() {
969
- h.value = !0, g.value = "", o.value = !0;
907
+ _.value = !0, y.value = "", f.value = !0;
970
908
  }
971
909
  function H() {
972
- g.value.trim() && r("createFolder", g.value.trim(), n.folder.id), h.value = !1, g.value = "";
910
+ y.value.trim() && l("createFolder", y.value.trim(), i.folder.id), _.value = !1, y.value = "";
973
911
  }
974
- function U() {
975
- h.value = !1, g.value = "";
912
+ function G() {
913
+ _.value = !1, y.value = "";
976
914
  }
977
- return (t, n) => {
978
- let o = E("MediaFolderTreeNode", !0);
979
- return S(), d("div", null, [f("div", {
915
+ return (n, r) => {
916
+ let i = S("MediaFolderTreeNode", !0);
917
+ return v(), s("div", null, [c("div", {
980
918
  class: "tpl:group tpl:flex tpl:w-full tpl:items-center tpl:gap-1 tpl:py-1.5 tpl:pr-2 tpl:text-left tpl:text-xs tpl:transition-all tpl:duration-150",
981
- style: b({
982
- paddingLeft: `${e.depth * 16 + 8}px`,
983
- backgroundColor: x.value ? "var(--tpl-bg-active)" : "transparent",
984
- color: x.value ? "var(--tpl-primary)" : "var(--tpl-text)"
919
+ style: g({
920
+ paddingLeft: `${t.depth * 16 + 8}px`,
921
+ backgroundColor: O.value ? "var(--tpl-bg-active)" : "transparent",
922
+ color: O.value ? "var(--tpl-primary)" : "var(--tpl-text)"
985
923
  })
986
924
  }, [
987
- _.value || h.value ? (S(), d("button", {
925
+ w.value || _.value ? (v(), s("button", {
988
926
  key: 0,
989
927
  class: "tpl:flex tpl:size-4 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
990
- onClick: F(M, ["stop"])
991
- }, [m(k(L), {
992
- class: y(["tpl:transition-transform tpl:duration-150", { "tpl:rotate-90": O.value }]),
928
+ onClick: M(I, ["stop"])
929
+ }, [u(E(P), {
930
+ class: h(["tpl:transition-transform tpl:duration-150", { "tpl:rotate-90": N.value }]),
993
931
  size: 10,
994
932
  "stroke-width": 2
995
- }, null, 8, ["class"])])) : (S(), d("span", pt)),
996
- f("button", {
933
+ }, null, 8, ["class"])])) : (v(), s("span", lt)),
934
+ c("button", {
997
935
  class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-1.5",
998
- onClick: n[0] ||= (t) => r("navigate", e.folder.id)
999
- }, [m(k(B), {
936
+ onClick: r[0] ||= (e) => l("navigate", t.folder.id)
937
+ }, [u(E(L), {
1000
938
  class: "tpl:shrink-0",
1001
939
  size: 14,
1002
940
  "stroke-width": 1.5
1003
- }), c.value ? u("", !0) : (S(), d("span", mt, D(e.folder.name), 1))]),
1004
- c.value ? N((S(), d("input", {
941
+ }), p.value ? o("", !0) : (v(), s("span", ut, C(t.folder.name), 1))]),
942
+ p.value ? A((v(), s("input", {
1005
943
  key: 2,
1006
- "onUpdate:modelValue": n[1] ||= (e) => p.value = e,
944
+ "onUpdate:modelValue": r[1] ||= (e) => m.value = e,
1007
945
  type: "text",
1008
946
  class: "tpl:min-w-0 tpl:flex-1 tpl:rounded tpl:border tpl:px-1.5 tpl:py-0.5 tpl:text-xs tpl:outline-none",
1009
947
  style: {
@@ -1012,56 +950,64 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
1012
950
  color: "var(--tpl-text)"
1013
951
  },
1014
952
  autofocus: "",
1015
- onKeydown: [P(R, ["enter"]), P(z, ["escape"])],
1016
- onBlur: R,
1017
- onClick: n[2] ||= F(() => {}, ["stop"])
1018
- }, null, 544)), [[A, p.value]]) : u("", !0),
1019
- c.value ? u("", !0) : (S(), d("span", ht, [
1020
- v.value ? (S(), d("button", {
953
+ onKeydown: [j(z, ["enter"]), j(B, ["escape"])],
954
+ onBlur: z,
955
+ onClick: r[2] ||= M(() => {}, ["stop"])
956
+ }, null, 544)), [[D, m.value]]) : o("", !0),
957
+ p.value ? o("", !0) : (v(), s("span", dt, [
958
+ T.value && t.canCreateFolder ? (v(), s("button", {
1021
959
  key: 0,
1022
960
  class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
1023
- title: k(a).mediaLibrary.addSubfolder,
1024
- onClick: F(V, ["stop"])
1025
- }, [m(k(q), {
961
+ title: E(d).mediaLibrary.addSubfolder,
962
+ onClick: M(V, ["stop"])
963
+ }, [u(E(W), {
1026
964
  size: 12,
1027
965
  "stroke-width": 2
1028
- })], 8, gt)) : u("", !0),
1029
- f("button", {
966
+ })], 8, ft)) : o("", !0),
967
+ t.canRenameFolder ? (v(), s("button", {
968
+ key: 1,
1030
969
  class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
1031
- title: k(a).mediaLibrary.renameFolder,
1032
- onClick: F(I, ["stop"])
1033
- }, [m(k(K), {
970
+ title: E(d).mediaLibrary.renameFolder,
971
+ onClick: M(R, ["stop"])
972
+ }, [u(E(U), {
1034
973
  size: 12,
1035
974
  "stroke-width": 2
1036
- })], 8, _t),
1037
- f("button", {
975
+ })], 8, pt)) : o("", !0),
976
+ t.canDeleteFolder ? (v(), s("button", {
977
+ key: 2,
1038
978
  class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
1039
- onClick: n[3] ||= F((t) => r("deleteFolder", e.folder.id), ["stop"])
1040
- }, [m(k(X), {
979
+ onClick: r[3] ||= M((e) => l("deleteFolder", t.folder.id), ["stop"])
980
+ }, [u(E(te), {
1041
981
  size: 12,
1042
982
  "stroke-width": 2,
1043
983
  style: { color: "var(--tpl-danger)" }
1044
- })])
984
+ })])) : o("", !0)
1045
985
  ]))
1046
- ], 4), O.value ? (S(), d("div", vt, [(S(!0), d(i, null, T(e.folder.children, (t) => (S(), l(o, {
1047
- key: t.id,
1048
- folder: t,
1049
- "current-folder-id": e.currentFolderId,
1050
- depth: e.depth + 1,
1051
- onNavigate: n[4] ||= (e) => r("navigate", e),
1052
- onCreateFolder: n[5] ||= (e, t) => r("createFolder", e, t),
1053
- onRenameFolder: n[6] ||= (e, t) => r("renameFolder", e, t),
1054
- onDeleteFolder: n[7] ||= (e) => r("deleteFolder", e)
986
+ ], 4), N.value ? (v(), s("div", mt, [(v(!0), s(e, null, x(t.folder.children, (e) => (v(), a(i, {
987
+ key: e.id,
988
+ folder: e,
989
+ "current-folder-id": t.currentFolderId,
990
+ depth: t.depth + 1,
991
+ "can-create-folder": t.canCreateFolder,
992
+ "can-rename-folder": t.canRenameFolder,
993
+ "can-delete-folder": t.canDeleteFolder,
994
+ onNavigate: r[4] ||= (e) => l("navigate", e),
995
+ onCreateFolder: r[5] ||= (e, t) => l("createFolder", e, t),
996
+ onRenameFolder: r[6] ||= (e, t) => l("renameFolder", e, t),
997
+ onDeleteFolder: r[7] ||= (e) => l("deleteFolder", e)
1055
998
  }, null, 8, [
1056
999
  "folder",
1057
1000
  "current-folder-id",
1058
- "depth"
1059
- ]))), 128)), h.value ? (S(), d("div", {
1001
+ "depth",
1002
+ "can-create-folder",
1003
+ "can-rename-folder",
1004
+ "can-delete-folder"
1005
+ ]))), 128)), _.value ? (v(), s("div", {
1060
1006
  key: 0,
1061
- style: b({ paddingLeft: `${(e.depth + 1) * 16 + 8}px` }),
1007
+ style: g({ paddingLeft: `${(t.depth + 1) * 16 + 8}px` }),
1062
1008
  class: "tpl:py-1.5 tpl:pr-2"
1063
- }, [N(f("input", {
1064
- "onUpdate:modelValue": n[8] ||= (e) => g.value = e,
1009
+ }, [A(c("input", {
1010
+ "onUpdate:modelValue": r[8] ||= (e) => y.value = e,
1065
1011
  type: "text",
1066
1012
  class: "tpl:w-full tpl:rounded tpl:border tpl:px-2 tpl:py-1 tpl:text-xs tpl:outline-none",
1067
1013
  style: {
@@ -1069,23 +1015,29 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
1069
1015
  "background-color": "var(--tpl-bg)",
1070
1016
  color: "var(--tpl-text)"
1071
1017
  },
1072
- placeholder: k(a).mediaLibrary.subfolderName,
1018
+ placeholder: E(d).mediaLibrary.subfolderName,
1073
1019
  autofocus: "",
1074
- onKeydown: [P(H, ["enter"]), P(U, ["escape"])],
1020
+ onKeydown: [j(H, ["enter"]), j(G, ["escape"])],
1075
1021
  onBlur: H
1076
- }, null, 40, yt), [[A, g.value]])], 4)) : u("", !0)])) : u("", !0)]);
1022
+ }, null, 40, ht), [[D, y.value]])], 4)) : o("", !0)])) : o("", !0)]);
1077
1023
  };
1078
1024
  }
1079
- }), xt = { class: "tpl:flex tpl:h-full tpl:flex-col tpl:overflow-y-auto" }, St = {
1025
+ }), _t = {
1026
+ "data-testid": "media-folder-tree",
1027
+ class: "tpl:flex tpl:h-full tpl:flex-col tpl:overflow-y-auto"
1028
+ }, vt = {
1080
1029
  key: 0,
1081
1030
  class: "tpl:px-3 tpl:py-2"
1082
- }, Ct = ["placeholder"], wt = /* @__PURE__ */ h({
1031
+ }, yt = ["placeholder"], bt = /* @__PURE__ */ d({
1083
1032
  __name: "MediaFolderTree",
1084
1033
  props: {
1085
1034
  folders: {},
1086
1035
  currentFolderId: {},
1087
1036
  viewMode: {},
1088
- hasFrequentlyUsed: { type: Boolean }
1037
+ hasFrequentlyUsed: { type: Boolean },
1038
+ canCreateFolder: { type: Boolean },
1039
+ canRenameFolder: { type: Boolean },
1040
+ canDeleteFolder: { type: Boolean }
1089
1041
  },
1090
1042
  emits: [
1091
1043
  "navigate",
@@ -1094,41 +1046,50 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
1094
1046
  "deleteFolder",
1095
1047
  "showFrequentlyUsed"
1096
1048
  ],
1097
- setup(e, { emit: t }) {
1098
- let n = t, { t: r } = Z(), a = w(!1), o = w("");
1099
- function s() {
1100
- a.value = !0, o.value = "";
1049
+ setup(t, { emit: n }) {
1050
+ let r = n, { t: i } = Q(), d = b(!1), f = b("");
1051
+ function p() {
1052
+ d.value = !0, f.value = "";
1101
1053
  }
1102
- function c() {
1103
- o.value.trim() && n("createFolder", o.value.trim()), a.value = !1, o.value = "";
1054
+ function m() {
1055
+ f.value.trim() && r("createFolder", f.value.trim()), d.value = !1, f.value = "";
1104
1056
  }
1105
1057
  function h() {
1106
- a.value = !1, o.value = "";
1058
+ d.value = !1, f.value = "";
1107
1059
  }
1108
- return (t, g) => (S(), d("div", xt, [
1109
- f("button", {
1060
+ return (n, _) => (v(), s("div", _t, [
1061
+ c("button", {
1110
1062
  class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-2 tpl:px-3 tpl:py-2 tpl:text-left tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
1111
- style: b({
1112
- backgroundColor: e.viewMode === "files" && e.currentFolderId === null ? "var(--tpl-bg-active)" : "transparent",
1113
- color: e.viewMode === "files" && e.currentFolderId === null ? "var(--tpl-primary)" : "var(--tpl-text)"
1063
+ style: g({
1064
+ backgroundColor: t.viewMode === "files" && t.currentFolderId === null ? "var(--tpl-bg-active)" : "transparent",
1065
+ color: t.viewMode === "files" && t.currentFolderId === null ? "var(--tpl-primary)" : "var(--tpl-text)"
1114
1066
  }),
1115
- onClick: g[0] ||= (e) => n("navigate", null)
1116
- }, [m(k(z), {
1067
+ onClick: _[0] ||= (e) => r("navigate", null)
1068
+ }, [u(E(I), {
1117
1069
  size: 14,
1118
1070
  "stroke-width": 1.5
1119
- }), p(" " + D(k(r).mediaLibrary.allFiles), 1)], 4),
1120
- (S(!0), d(i, null, T(e.folders, (t) => (S(), l(bt, {
1121
- key: t.id,
1122
- folder: t,
1123
- "current-folder-id": e.currentFolderId,
1071
+ }), l(" " + C(E(i).mediaLibrary.allFiles), 1)], 4),
1072
+ (v(!0), s(e, null, x(t.folders, (e) => (v(), a(gt, {
1073
+ key: e.id,
1074
+ folder: e,
1075
+ "current-folder-id": t.currentFolderId,
1124
1076
  depth: 0,
1125
- onNavigate: g[1] ||= (e) => n("navigate", e),
1126
- onCreateFolder: g[2] ||= (e, t) => n("createFolder", e, t),
1127
- onRenameFolder: g[3] ||= (e, t) => n("renameFolder", e, t),
1128
- onDeleteFolder: g[4] ||= (e) => n("deleteFolder", e)
1129
- }, null, 8, ["folder", "current-folder-id"]))), 128)),
1130
- a.value ? (S(), d("div", St, [N(f("input", {
1131
- "onUpdate:modelValue": g[5] ||= (e) => o.value = e,
1077
+ "can-create-folder": t.canCreateFolder,
1078
+ "can-rename-folder": t.canRenameFolder,
1079
+ "can-delete-folder": t.canDeleteFolder,
1080
+ onNavigate: _[1] ||= (e) => r("navigate", e),
1081
+ onCreateFolder: _[2] ||= (e, t) => r("createFolder", e, t),
1082
+ onRenameFolder: _[3] ||= (e, t) => r("renameFolder", e, t),
1083
+ onDeleteFolder: _[4] ||= (e) => r("deleteFolder", e)
1084
+ }, null, 8, [
1085
+ "folder",
1086
+ "current-folder-id",
1087
+ "can-create-folder",
1088
+ "can-rename-folder",
1089
+ "can-delete-folder"
1090
+ ]))), 128)),
1091
+ d.value ? (v(), s("div", vt, [A(c("input", {
1092
+ "onUpdate:modelValue": _[5] ||= (e) => f.value = e,
1132
1093
  type: "text",
1133
1094
  class: "tpl:w-full tpl:rounded tpl:border tpl:px-2 tpl:py-1 tpl:text-xs tpl:outline-none",
1134
1095
  style: {
@@ -1136,37 +1097,38 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
1136
1097
  "background-color": "var(--tpl-bg)",
1137
1098
  color: "var(--tpl-text)"
1138
1099
  },
1139
- placeholder: k(r).mediaLibrary.folderName,
1100
+ placeholder: E(i).mediaLibrary.folderName,
1140
1101
  autofocus: "",
1141
- onKeydown: [P(c, ["enter"]), P(h, ["escape"])],
1142
- onBlur: c
1143
- }, null, 40, Ct), [[A, o.value]])])) : u("", !0),
1144
- a.value ? u("", !0) : (S(), d("button", {
1102
+ onKeydown: [j(m, ["enter"]), j(h, ["escape"])],
1103
+ onBlur: m
1104
+ }, null, 40, yt), [[D, f.value]])])) : o("", !0),
1105
+ !d.value && t.canCreateFolder ? (v(), s("button", {
1145
1106
  key: 1,
1146
1107
  class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-2 tpl:px-3 tpl:py-2 tpl:text-left tpl:text-xs tpl:transition-all tpl:duration-150",
1147
1108
  style: { color: "var(--tpl-text-muted)" },
1148
- onClick: s
1149
- }, [m(k(q), {
1109
+ onClick: p
1110
+ }, [u(E(W), {
1150
1111
  size: 14,
1151
1112
  "stroke-width": 1.5
1152
- }), p(" " + D(k(r).mediaLibrary.newFolder), 1)])),
1153
- g[7] ||= f("div", { class: "tpl:flex-1" }, null, -1),
1154
- e.hasFrequentlyUsed ? (S(), d("button", {
1113
+ }), l(" " + C(E(i).mediaLibrary.newFolder), 1)])) : o("", !0),
1114
+ _[7] ||= c("div", { class: "tpl:flex-1" }, null, -1),
1115
+ t.hasFrequentlyUsed ? (v(), s("button", {
1155
1116
  key: 2,
1117
+ "data-testid": "media-frequently-used",
1156
1118
  class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-2 tpl:border-t tpl:px-3 tpl:py-2 tpl:text-left tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
1157
- style: b({
1119
+ style: g({
1158
1120
  borderColor: "var(--tpl-border)",
1159
- backgroundColor: e.viewMode === "frequently-used" ? "var(--tpl-bg-active)" : "transparent",
1160
- color: e.viewMode === "frequently-used" ? "var(--tpl-primary)" : "var(--tpl-text)"
1121
+ backgroundColor: t.viewMode === "frequently-used" ? "var(--tpl-bg-active)" : "transparent",
1122
+ color: t.viewMode === "frequently-used" ? "var(--tpl-primary)" : "var(--tpl-text)"
1161
1123
  }),
1162
- onClick: g[6] ||= (e) => n("showFrequentlyUsed")
1163
- }, [m(k(ee), {
1124
+ onClick: _[6] ||= (e) => r("showFrequentlyUsed")
1125
+ }, [u(E(K), {
1164
1126
  size: 14,
1165
1127
  "stroke-width": 1.5
1166
- }), p(" " + D(k(r).mediaLibrary.frequentlyUsed), 1)], 4)) : u("", !0)
1128
+ }), l(" " + C(E(i).mediaLibrary.frequentlyUsed), 1)], 4)) : o("", !0)
1167
1129
  ]));
1168
1130
  }
1169
- }), Tt = { class: "tpl:flex tpl:aspect-square tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2" }, Et = /* @__PURE__ */ h({
1131
+ }), xt = { class: "tpl:flex tpl:aspect-square tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2" }, St = /* @__PURE__ */ d({
1170
1132
  __name: "MediaFileIcon",
1171
1133
  props: { mimeType: {} },
1172
1134
  setup(e) {
@@ -1261,13 +1223,13 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
1261
1223
  bgColor: "#f0fdfa",
1262
1224
  icon: "audio"
1263
1225
  }
1264
- }, r = {
1226
+ }, i = {
1265
1227
  label: "FILE",
1266
1228
  color: "#6b7280",
1267
1229
  bgColor: "#f9fafb",
1268
1230
  icon: "document"
1269
- }, i = s(() => n[t.mimeType] ?? r);
1270
- return (e, t) => (S(), d("div", Tt, [i.value.icon === "document" ? (S(), d("svg", {
1231
+ }, a = r(() => n[t.mimeType] ?? i);
1232
+ return (e, t) => (v(), s("div", xt, [a.value.icon === "document" ? (v(), s("svg", {
1271
1233
  key: 0,
1272
1234
  width: "60",
1273
1235
  height: "60",
@@ -1275,23 +1237,23 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
1275
1237
  fill: "none",
1276
1238
  stroke: "currentColor",
1277
1239
  "stroke-width": "1.5",
1278
- style: b({ color: i.value.color })
1240
+ style: g({ color: a.value.color })
1279
1241
  }, [...t[0] ||= [
1280
- f("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }, null, -1),
1281
- f("polyline", { points: "14 2 14 8 20 8" }, null, -1),
1282
- f("line", {
1242
+ c("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }, null, -1),
1243
+ c("polyline", { points: "14 2 14 8 20 8" }, null, -1),
1244
+ c("line", {
1283
1245
  x1: "8",
1284
1246
  y1: "13",
1285
1247
  x2: "16",
1286
1248
  y2: "13"
1287
1249
  }, null, -1),
1288
- f("line", {
1250
+ c("line", {
1289
1251
  x1: "8",
1290
1252
  y1: "17",
1291
1253
  x2: "12",
1292
1254
  y2: "17"
1293
1255
  }, null, -1)
1294
- ]], 4)) : i.value.icon === "video" ? (S(), d("svg", {
1256
+ ]], 4)) : a.value.icon === "video" ? (v(), s("svg", {
1295
1257
  key: 1,
1296
1258
  width: "40",
1297
1259
  height: "40",
@@ -1299,18 +1261,18 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
1299
1261
  fill: "none",
1300
1262
  stroke: "currentColor",
1301
1263
  "stroke-width": "1.5",
1302
- style: b({ color: i.value.color })
1303
- }, [...t[1] ||= [f("rect", {
1264
+ style: g({ color: a.value.color })
1265
+ }, [...t[1] ||= [c("rect", {
1304
1266
  x: "2",
1305
1267
  y: "4",
1306
1268
  width: "20",
1307
1269
  height: "16",
1308
1270
  rx: "2"
1309
- }, null, -1), f("polygon", {
1271
+ }, null, -1), c("polygon", {
1310
1272
  points: "10,8 16,12 10,16",
1311
1273
  fill: "currentColor",
1312
1274
  stroke: "none"
1313
- }, null, -1)]], 4)) : (S(), d("svg", {
1275
+ }, null, -1)]], 4)) : (v(), s("svg", {
1314
1276
  key: 2,
1315
1277
  width: "40",
1316
1278
  height: "40",
@@ -1318,28 +1280,28 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
1318
1280
  fill: "none",
1319
1281
  stroke: "currentColor",
1320
1282
  "stroke-width": "1.5",
1321
- style: b({ color: i.value.color })
1283
+ style: g({ color: a.value.color })
1322
1284
  }, [...t[2] ||= [
1323
- f("path", { d: "M9 18V5l12-2v13" }, null, -1),
1324
- f("circle", {
1285
+ c("path", { d: "M9 18V5l12-2v13" }, null, -1),
1286
+ c("circle", {
1325
1287
  cx: "6",
1326
1288
  cy: "18",
1327
1289
  r: "3"
1328
1290
  }, null, -1),
1329
- f("circle", {
1291
+ c("circle", {
1330
1292
  cx: "18",
1331
1293
  cy: "16",
1332
1294
  r: "3"
1333
1295
  }, null, -1)
1334
- ]], 4)), f("span", {
1296
+ ]], 4)), c("span", {
1335
1297
  class: "tpl:text-xs tpl:font-bold tpl:tracking-wider",
1336
- style: b({ color: i.value.color })
1337
- }, D(i.value.label), 5)]));
1298
+ style: g({ color: a.value.color })
1299
+ }, C(a.value.label), 5)]));
1338
1300
  }
1339
1301
  });
1340
1302
  //#endregion
1341
1303
  //#region src/utils/formatAbsoluteDate.ts
1342
- function Dt(e, t, n) {
1304
+ function Ct(e, t, n) {
1343
1305
  let r = new Date(e);
1344
1306
  if (Number.isNaN(r.getTime())) return "";
1345
1307
  let i = t?.trim().replace(/_/g, "-") || void 0;
@@ -1351,48 +1313,56 @@ function Dt(e, t, n) {
1351
1313
  }
1352
1314
  //#endregion
1353
1315
  //#region src/components/media/MediaGrid.vue?vue&type=script&setup=true&lang.ts
1354
- var Ot = { class: "tpl:p-4" }, kt = {
1316
+ var wt = { class: "tpl:p-4" }, Tt = {
1355
1317
  key: 1,
1356
1318
  class: "tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:py-16"
1357
- }, At = {
1319
+ }, Et = {
1358
1320
  class: "tpl:text-xs",
1359
1321
  style: { color: "var(--tpl-text-muted)" }
1360
- }, jt = {
1322
+ }, Dt = {
1361
1323
  key: 2,
1362
1324
  class: "tpl:grid tpl:grid-cols-4 tpl:gap-3"
1363
- }, Mt = ["onClick"], Nt = { class: "tpl:aspect-square" }, Pt = ["src", "alt"], Ft = { class: "tpl:px-2 tpl:py-1.5" }, It = {
1325
+ }, Ot = [
1326
+ "data-media-id",
1327
+ "onClick",
1328
+ "onDblclick"
1329
+ ], kt = { class: "tpl:aspect-square" }, At = ["src", "alt"], jt = { class: "tpl:px-2 tpl:py-1.5" }, Mt = {
1364
1330
  class: "tpl:truncate tpl:text-[10px] tpl:font-medium",
1365
1331
  style: { color: "var(--tpl-text)" }
1366
- }, Lt = {
1332
+ }, Nt = {
1367
1333
  class: "tpl:flex tpl:justify-between tpl:text-[9px]",
1368
1334
  style: { color: "var(--tpl-text-muted)" }
1369
- }, Rt = { key: 0 }, zt = { class: "tpl:absolute tpl:top-1.5 tpl:left-1.5 tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, Bt = ["title", "onClick"], Vt = ["title", "onClick"], Ht = {
1335
+ }, Pt = { key: 0 }, Ft = { key: 1 }, It = { class: "tpl:absolute tpl:top-1.5 tpl:left-1.5 tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, Lt = ["title", "onClick"], Rt = ["title", "onClick"], zt = {
1370
1336
  key: 0,
1371
1337
  class: "tpl:absolute tpl:top-1.5 tpl:right-1.5 tpl:flex tpl:size-5 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
1372
1338
  style: { "background-color": "var(--tpl-primary)" }
1373
- }, Ut = {
1339
+ }, Bt = {
1374
1340
  key: 3,
1375
1341
  class: "tpl:flex tpl:flex-col tpl:gap-1"
1376
- }, Wt = ["onClick"], Gt = {
1342
+ }, Vt = [
1343
+ "data-media-id",
1344
+ "onClick",
1345
+ "onDblclick"
1346
+ ], Ht = {
1377
1347
  class: "tpl:size-10 tpl:shrink-0 tpl:overflow-hidden tpl:rounded",
1378
1348
  style: { "background-color": "var(--tpl-bg-hover)" }
1379
- }, Kt = ["src", "alt"], qt = {
1349
+ }, Ut = ["src", "alt"], Wt = {
1380
1350
  key: 1,
1381
1351
  class: "tpl-list-icon tpl:size-full"
1382
- }, Jt = { class: "tpl:min-w-0 tpl:flex-1" }, Yt = {
1352
+ }, Gt = { class: "tpl:min-w-0 tpl:flex-1" }, Kt = {
1383
1353
  class: "tpl:truncate tpl:text-xs tpl:font-medium",
1384
1354
  style: { color: "var(--tpl-text)" }
1385
- }, Xt = {
1355
+ }, qt = {
1386
1356
  class: "tpl:text-[10px]",
1387
1357
  style: { color: "var(--tpl-text-muted)" }
1388
- }, Zt = { class: "tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, Qt = ["title", "onClick"], $t = ["title", "onClick"], en = {
1358
+ }, Jt = { class: "tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, Yt = ["title", "onClick"], Xt = ["title", "onClick"], Zt = {
1389
1359
  key: 0,
1390
1360
  class: "tpl:flex tpl:size-5 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
1391
1361
  style: { "background-color": "var(--tpl-primary)" }
1392
- }, tn = {
1362
+ }, Qt = {
1393
1363
  key: 4,
1394
1364
  class: "tpl:flex tpl:justify-center tpl:py-4"
1395
- }, nn = /*#__PURE__*/ dt(/* @__PURE__ */ h({
1365
+ }, $t = /*#__PURE__*/ st(/* @__PURE__ */ d({
1396
1366
  __name: "MediaGrid",
1397
1367
  props: {
1398
1368
  items: {},
@@ -1400,158 +1370,202 @@ var Ot = { class: "tpl:p-4" }, kt = {
1400
1370
  isLoading: { type: Boolean },
1401
1371
  hasMore: { type: Boolean },
1402
1372
  accept: {},
1403
- layout: {}
1373
+ layout: {},
1374
+ searchQuery: {},
1375
+ canUpdate: { type: Boolean },
1376
+ canReplace: { type: Boolean }
1404
1377
  },
1405
1378
  emits: [
1406
1379
  "select",
1407
1380
  "toggle",
1408
1381
  "loadMore",
1409
1382
  "edit",
1410
- "replace"
1383
+ "replace",
1384
+ "confirm"
1411
1385
  ],
1412
- setup(e, { emit: t }) {
1413
- let n = e, r = t, { isAcceptedMimeType: a, isImageMimeType: o } = Q();
1414
- function s(e) {
1415
- return !n.accept || n.accept.length === 0 || a(e.mime_type, n.accept);
1386
+ setup(t, { emit: n }) {
1387
+ let r = t, i = n, { isAcceptedMimeType: d, isImageMimeType: f } = $();
1388
+ function m(e) {
1389
+ return e.mimeType ?? "";
1390
+ }
1391
+ function _(e) {
1392
+ return e.thumbnailUrl ?? e.url;
1393
+ }
1394
+ function y(e) {
1395
+ return !r.accept || r.accept.length === 0 || d(m(e), r.accept);
1416
1396
  }
1417
- function c(e) {
1418
- r("select", e);
1397
+ function S(e) {
1398
+ return r.canUpdate === !0 && e.canUpdate !== !1;
1419
1399
  }
1420
- let { t: h } = Z(), g = _(ye, null), v = w(null);
1421
- ue(v, ([{ isIntersecting: e }]) => {
1422
- e && n.hasMore && !n.isLoading && r("loadMore");
1400
+ function w(e) {
1401
+ return r.canReplace === !0 && e.canUpdate !== !1;
1402
+ }
1403
+ function T(e, t) {
1404
+ if (t.metaKey || t.ctrlKey) {
1405
+ i("toggle", e.id);
1406
+ return;
1407
+ }
1408
+ i("select", e);
1409
+ }
1410
+ function D(e) {
1411
+ y(e) && i("confirm", e);
1412
+ }
1413
+ let { t: O } = Q(), k = p(me, null), A = b(null);
1414
+ X(A, ([{ isIntersecting: e }]) => {
1415
+ e && r.hasMore && !r.isLoading && i("loadMore");
1423
1416
  }, { threshold: .1 });
1424
- function x(e) {
1417
+ function j(e) {
1425
1418
  return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1048576).toFixed(1)} MB`;
1426
1419
  }
1427
- function C(e) {
1428
- return Dt(e, g?.value, {
1420
+ function P(e) {
1421
+ return Ct(e, k?.value, {
1429
1422
  year: "numeric",
1430
1423
  month: "short",
1431
1424
  day: "numeric"
1432
1425
  });
1433
1426
  }
1434
- return (t, n) => (S(), d("div", Ot, [
1435
- e.isLoading && e.items.length === 0 ? (S(), d("div", {
1427
+ return (n, r) => (v(), s("div", wt, [
1428
+ t.isLoading && t.items.length === 0 ? (v(), s("div", {
1436
1429
  key: 0,
1437
- class: y(e.layout === "list" ? "tpl:flex tpl:flex-col tpl:gap-1" : "tpl:grid tpl:grid-cols-4 tpl:gap-3")
1438
- }, [(S(), d(i, null, T(8, (t) => f("div", {
1439
- key: t,
1440
- class: y(["tpl-pulse tpl:rounded-lg", e.layout === "list" ? "tpl:h-12" : "tpl:aspect-square"]),
1441
- style: { "background-color": "var(--tpl-bg-hover)" }
1442
- }, null, 2)), 64))], 2)) : e.items.length === 0 ? (S(), d("div", kt, [m(k(z), {
1430
+ role: "status",
1431
+ "aria-busy": "true",
1432
+ class: h(t.layout === "list" ? "tpl:flex tpl:flex-col tpl:gap-1" : "tpl:grid tpl:grid-cols-4 tpl:gap-3")
1433
+ }, [(v(), s(e, null, x(8, (e) => c("div", {
1434
+ key: e,
1435
+ class: h(["tpl-pulse tpl:rounded-lg", t.layout === "list" ? "tpl:h-12" : "tpl:aspect-square"]),
1436
+ style: { "background-color": "var(--tpl-bg-hover)" },
1437
+ "aria-hidden": "true"
1438
+ }, null, 2)), 64))], 2)) : t.items.length === 0 ? (v(), s("div", Tt, [u(E(I), {
1443
1439
  class: "tpl:mb-3",
1444
1440
  size: 40,
1445
1441
  "stroke-width": 1,
1446
1442
  style: { color: "var(--tpl-text-dim)" }
1447
- }), f("p", At, D(k(h).mediaLibrary.noFiles), 1)])) : e.layout === "list" ? (S(), d("div", Ut, [(S(!0), d(i, null, T(e.items, (t) => (S(), d("div", {
1448
- key: t.id,
1449
- class: y(["tpl-media-list-item tpl:group tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-3 tpl:rounded-lg tpl:px-3 tpl:py-2 tpl:transition-all tpl:duration-150", [!s(t) && !e.selectedIds.has(t.id) ? "tpl:opacity-60" : ""]]),
1450
- style: b({ backgroundColor: e.selectedIds.has(t.id) ? "var(--tpl-bg-hover)" : "transparent" }),
1451
- onClick: (e) => c(t)
1443
+ }), c("p", Et, C(t.searchQuery ? E(O).mediaLibrary.noSearchResults : E(O).mediaLibrary.noFiles), 1)])) : t.layout === "list" ? (v(), s("div", Bt, [(v(!0), s(e, null, x(t.items, (n) => (v(), s("div", {
1444
+ key: n.id,
1445
+ "data-testid": "media-library-item",
1446
+ class: h(["tpl-media-list-item tpl:group tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-3 tpl:rounded-lg tpl:px-3 tpl:py-2 tpl:transition-all tpl:duration-150", [!y(n) && !t.selectedIds.has(n.id) ? "tpl:opacity-60" : ""]]),
1447
+ "data-media-id": n.id,
1448
+ style: g({ backgroundColor: t.selectedIds.has(n.id) ? "var(--tpl-bg-hover)" : "transparent" }),
1449
+ onClick: (e) => T(n, e),
1450
+ onDblclick: (e) => D(n)
1452
1451
  }, [
1453
- f("div", Gt, [k(o)(t.mime_type) ? (S(), d("img", {
1452
+ c("div", Ht, [E(f)(m(n)) ? (v(), s("img", {
1454
1453
  key: 0,
1455
- src: t.small_url || t.url,
1456
- alt: t.filename,
1454
+ src: _(n),
1455
+ alt: n.filename || n.url,
1457
1456
  class: "tpl:size-full tpl:object-cover",
1458
1457
  loading: "lazy"
1459
- }, null, 8, Kt)) : (S(), d("div", qt, [m(Et, { "mime-type": t.mime_type }, null, 8, ["mime-type"])]))]),
1460
- f("div", Jt, [f("p", Yt, D(t.filename), 1), f("p", Xt, [p(D(x(t.size)) + " · " + D(C(t.created_at)) + " ", 1), k(o)(t.mime_type) && t.width && t.height ? (S(), d(i, { key: 0 }, [p(" · " + D(t.width) + "×" + D(t.height), 1)], 64)) : u("", !0)])]),
1461
- f("div", Zt, [f("button", {
1458
+ }, null, 8, Ut)) : (v(), s("div", Wt, [u(St, { "mime-type": m(n) }, null, 8, ["mime-type"])]))]),
1459
+ c("div", Gt, [c("p", Kt, C(n.filename || n.url), 1), c("p", qt, [
1460
+ n.size == null ? o("", !0) : (v(), s(e, { key: 0 }, [l(C(j(n.size)), 1)], 64)),
1461
+ n.createdAt ? (v(), s(e, { key: 1 }, [n.size == null ? o("", !0) : (v(), s(e, { key: 0 }, [l(" · ")], 64)), l(" " + C(P(n.createdAt)), 1)], 64)) : o("", !0),
1462
+ E(f)(m(n)) && n.width && n.height ? (v(), s(e, { key: 2 }, [l(" · " + C(n.width) + "×" + C(n.height), 1)], 64)) : o("", !0)
1463
+ ])]),
1464
+ c("div", Jt, [S(n) ? (v(), s("button", {
1465
+ key: 0,
1466
+ "data-testid": "media-edit",
1462
1467
  class: "tpl:flex tpl:size-6 tpl:shrink-0 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded",
1463
1468
  style: { color: "var(--tpl-text-muted)" },
1464
- title: k(h).mediaLibrary.editFile,
1465
- onClick: F((e) => r("edit", t), ["stop"])
1466
- }, [m(k(K), {
1469
+ title: E(O).mediaLibrary.editFile,
1470
+ onClick: M((e) => i("edit", n), ["stop"])
1471
+ }, [u(E(U), {
1467
1472
  size: 12,
1468
1473
  "stroke-width": 2
1469
- })], 8, Qt), f("button", {
1474
+ })], 8, Yt)) : o("", !0), w(n) ? (v(), s("button", {
1475
+ key: 1,
1476
+ "data-testid": "media-replace",
1470
1477
  class: "tpl:flex tpl:size-6 tpl:shrink-0 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded",
1471
1478
  style: { color: "var(--tpl-text-muted)" },
1472
- title: k(h).mediaLibrary.replaceFile,
1473
- onClick: F((e) => r("replace", t), ["stop"])
1474
- }, [m(k(J), {
1479
+ title: E(O).mediaLibrary.replaceFile,
1480
+ onClick: M((e) => i("replace", n), ["stop"])
1481
+ }, [u(E(G), {
1475
1482
  size: 12,
1476
1483
  "stroke-width": 2
1477
- })], 8, $t)]),
1478
- e.selectedIds.has(t.id) ? (S(), d("div", en, [m(k(I), {
1484
+ })], 8, Xt)) : o("", !0)]),
1485
+ t.selectedIds.has(n.id) ? (v(), s("div", Zt, [u(E(N), {
1479
1486
  size: 12,
1480
1487
  "stroke-width": 3
1481
- })])) : u("", !0)
1482
- ], 14, Wt))), 128))])) : (S(), d("div", jt, [(S(!0), d(i, null, T(e.items, (t) => (S(), d("div", {
1483
- key: t.id,
1484
- class: y(["tpl-media-item tpl:group tpl:relative tpl:overflow-hidden tpl:rounded-lg tpl:border-2 tpl:transition-all tpl:duration-150", [
1488
+ })])) : o("", !0)
1489
+ ], 46, Vt))), 128))])) : (v(), s("div", Dt, [(v(!0), s(e, null, x(t.items, (e) => (v(), s("div", {
1490
+ key: e.id,
1491
+ "data-testid": "media-library-item",
1492
+ class: h(["tpl-media-item tpl:group tpl:relative tpl:overflow-hidden tpl:rounded-lg tpl:border-2 tpl:transition-all tpl:duration-150", [
1485
1493
  "tpl:cursor-pointer",
1486
- !s(t) && !e.selectedIds.has(t.id) ? "tpl:opacity-60" : "",
1487
- e.selectedIds.has(t.id) ? "tpl-media-item--selected" : ""
1494
+ !y(e) && !t.selectedIds.has(e.id) ? "tpl:opacity-60" : "",
1495
+ t.selectedIds.has(e.id) ? "tpl-media-item--selected" : ""
1488
1496
  ]]),
1489
- style: b({
1490
- borderColor: e.selectedIds.has(t.id) ? "var(--tpl-primary)" : "transparent",
1491
- backgroundColor: !s(t) && !e.selectedIds.has(t.id) ? "var(--tpl-bg)" : "var(--tpl-bg-hover)"
1497
+ "data-media-id": e.id,
1498
+ style: g({
1499
+ borderColor: t.selectedIds.has(e.id) ? "var(--tpl-primary)" : "transparent",
1500
+ backgroundColor: !y(e) && !t.selectedIds.has(e.id) ? "var(--tpl-bg)" : "var(--tpl-bg-hover)"
1492
1501
  }),
1493
- onClick: (e) => c(t)
1502
+ onClick: (t) => T(e, t),
1503
+ onDblclick: (t) => D(e)
1494
1504
  }, [
1495
- f("div", Nt, [k(o)(t.mime_type) ? (S(), d("img", {
1505
+ c("div", kt, [E(f)(m(e)) ? (v(), s("img", {
1496
1506
  key: 0,
1497
- src: t.small_url || t.url,
1498
- alt: t.filename,
1507
+ src: _(e),
1508
+ alt: e.filename || e.url,
1499
1509
  class: "tpl:size-full tpl:object-cover",
1500
1510
  loading: "lazy"
1501
- }, null, 8, Pt)) : (S(), l(Et, {
1511
+ }, null, 8, At)) : (v(), a(St, {
1502
1512
  key: 1,
1503
- "mime-type": t.mime_type
1513
+ "mime-type": m(e)
1504
1514
  }, null, 8, ["mime-type"]))]),
1505
- f("div", Ft, [f("p", It, D(t.filename), 1), f("p", Lt, [f("span", null, D(x(t.size)), 1), k(o)(t.mime_type) && t.width && t.height ? (S(), d("span", Rt, D(t.width) + "×" + D(t.height), 1)) : u("", !0)])]),
1506
- f("div", zt, [f("button", {
1515
+ c("div", jt, [c("p", Mt, C(e.filename || e.url), 1), c("p", Nt, [e.size == null ? o("", !0) : (v(), s("span", Pt, C(j(e.size)), 1)), E(f)(m(e)) && e.width && e.height ? (v(), s("span", Ft, C(e.width) + "×" + C(e.height), 1)) : o("", !0)])]),
1516
+ c("div", It, [S(e) ? (v(), s("button", {
1517
+ key: 0,
1518
+ "data-testid": "media-edit",
1507
1519
  class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
1508
1520
  style: { "background-color": "rgba(0, 0, 0, 0.6)" },
1509
- title: k(h).mediaLibrary.editFile,
1510
- onClick: F((e) => r("edit", t), ["stop"])
1511
- }, [m(k(K), {
1521
+ title: E(O).mediaLibrary.editFile,
1522
+ onClick: M((t) => i("edit", e), ["stop"])
1523
+ }, [u(E(U), {
1512
1524
  size: 11,
1513
1525
  "stroke-width": 2
1514
- })], 8, Bt), f("button", {
1526
+ })], 8, Lt)) : o("", !0), w(e) ? (v(), s("button", {
1527
+ key: 1,
1528
+ "data-testid": "media-replace",
1515
1529
  class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
1516
1530
  style: { "background-color": "rgba(0, 0, 0, 0.6)" },
1517
- title: k(h).mediaLibrary.replaceFile,
1518
- onClick: F((e) => r("replace", t), ["stop"])
1519
- }, [m(k(J), {
1531
+ title: E(O).mediaLibrary.replaceFile,
1532
+ onClick: M((t) => i("replace", e), ["stop"])
1533
+ }, [u(E(G), {
1520
1534
  size: 11,
1521
1535
  "stroke-width": 2
1522
- })], 8, Vt)]),
1523
- e.selectedIds.has(t.id) ? (S(), d("div", Ht, [m(k(I), {
1536
+ })], 8, Rt)) : o("", !0)]),
1537
+ t.selectedIds.has(e.id) ? (v(), s("div", zt, [u(E(N), {
1524
1538
  size: 12,
1525
1539
  "stroke-width": 3
1526
- })])) : u("", !0)
1527
- ], 14, Mt))), 128))])),
1528
- f("div", {
1540
+ })])) : o("", !0)
1541
+ ], 46, Ot))), 128))])),
1542
+ c("div", {
1529
1543
  ref_key: "sentinelRef",
1530
- ref: v,
1544
+ ref: A,
1531
1545
  class: "tpl:h-4"
1532
1546
  }, null, 512),
1533
- e.isLoading && e.items.length > 0 ? (S(), d("div", tn, [m(k(W), {
1547
+ t.isLoading && t.items.length > 0 ? (v(), s("div", Qt, [u(E(V), {
1534
1548
  class: "tpl-spinner",
1535
1549
  size: 20,
1536
1550
  "stroke-width": 2,
1537
1551
  style: { color: "var(--tpl-primary)" }
1538
- })])) : u("", !0)
1552
+ })])) : o("", !0)
1539
1553
  ]));
1540
1554
  }
1541
- }), [["__scopeId", "data-v-5b4cc2c6"]]), rn = ["data-tpl-theme"], an = {
1555
+ }), [["__scopeId", "data-v-02bd861d"]]), en = ["data-tpl-theme"], tn = {
1542
1556
  class: "tpl:max-h-[90%] tpl:w-full tpl:max-w-sm tpl:overflow-y-auto tpl:rounded-lg tpl:p-5 tpl:shadow-xl",
1543
1557
  style: { "background-color": "var(--tpl-bg-elevated)" }
1544
- }, on = {
1558
+ }, nn = {
1545
1559
  class: "tpl:mb-4 tpl:text-sm tpl:font-semibold",
1546
1560
  style: { color: "var(--tpl-text)" }
1547
- }, sn = { class: "tpl:mb-3" }, cn = ["placeholder", "disabled"], ln = {
1561
+ }, rn = { class: "tpl:mb-3" }, an = ["placeholder", "disabled"], on = {
1548
1562
  key: 0,
1549
1563
  class: "tpl:mb-3 tpl:text-xs",
1550
1564
  style: { color: "var(--tpl-danger)" }
1551
- }, un = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, dn = ["disabled"], fn = ["disabled"], pn = {
1565
+ }, sn = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, cn = ["disabled"], ln = ["disabled"], un = {
1552
1566
  key: 0,
1553
1567
  class: "tpl:flex tpl:items-center tpl:gap-1.5"
1554
- }, mn = { key: 1 }, hn = /* @__PURE__ */ h({
1568
+ }, dn = { key: 1 }, fn = /* @__PURE__ */ d({
1555
1569
  __name: "MediaImportUrlModal",
1556
1570
  props: {
1557
1571
  visible: { type: Boolean },
@@ -1559,22 +1573,22 @@ var Ot = { class: "tpl:p-4" }, kt = {
1559
1573
  error: {}
1560
1574
  },
1561
1575
  emits: ["import", "close"],
1562
- setup(e, { emit: t }) {
1563
- let n = e, r = t, { t: i } = Z(), s = _(ve, null), c = _(ge, w(null)), h = w("");
1564
- j(() => n.visible, (e) => {
1565
- e && (h.value = "");
1576
+ setup(e, { emit: r }) {
1577
+ let i = e, d = r, { t: f } = Q(), m = p(Z, null), g = p(fe, b(null)), _ = b("");
1578
+ O(() => i.visible, (e) => {
1579
+ e && (_.value = "");
1566
1580
  });
1567
- function g() {
1568
- let e = h.value.trim();
1569
- e && !n.isImporting && r("import", e);
1581
+ function y() {
1582
+ let e = _.value.trim();
1583
+ e && !i.isImporting && d("import", e);
1570
1584
  }
1571
- function v() {
1572
- n.isImporting || r("close");
1585
+ function x() {
1586
+ i.isImporting || d("close");
1573
1587
  }
1574
- function b(e) {
1575
- e.key === "Enter" && (e.preventDefault(), g()), e.key === "Escape" && v();
1588
+ function S(e) {
1589
+ e.key === "Enter" && (e.preventDefault(), y()), e.key === "Escape" && x();
1576
1590
  }
1577
- return (t, n) => (S(), l(a, { to: k(c) || "body" }, [m(o, {
1591
+ return (r, i) => (v(), a(t, { to: E(g) || "body" }, [u(n, {
1578
1592
  "enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
1579
1593
  "enter-from-class": "tpl:opacity-0",
1580
1594
  "enter-to-class": "tpl:opacity-100",
@@ -1582,17 +1596,17 @@ var Ot = { class: "tpl:p-4" }, kt = {
1582
1596
  "leave-from-class": "tpl:opacity-100",
1583
1597
  "leave-to-class": "tpl:opacity-0"
1584
1598
  }, {
1585
- default: M(() => [e.visible ? (S(), d("div", {
1599
+ default: k(() => [e.visible ? (v(), s("div", {
1586
1600
  key: 0,
1587
- "data-tpl-theme": k(s),
1588
- class: "tpl tpl:fixed tpl:inset-0 tpl:z-[10000] tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
1601
+ "data-tpl-theme": E(m),
1602
+ class: "tpl tpl:fixed tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
1589
1603
  style: { "background-color": "var(--tpl-overlay)" },
1590
- onClick: F(v, ["self"]),
1591
- onKeydown: b
1592
- }, [f("div", an, [
1593
- f("h3", on, D(k(i).mediaLibrary.importFromUrl), 1),
1594
- f("div", sn, [N(f("input", {
1595
- "onUpdate:modelValue": n[0] ||= (e) => h.value = e,
1604
+ onClick: M(x, ["self"]),
1605
+ onKeydown: S
1606
+ }, [c("div", tn, [
1607
+ c("h3", nn, C(E(f).mediaLibrary.importFromUrl), 1),
1608
+ c("div", rn, [A(c("input", {
1609
+ "onUpdate:modelValue": i[0] ||= (e) => _.value = e,
1596
1610
  type: "url",
1597
1611
  class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
1598
1612
  style: {
@@ -1600,59 +1614,59 @@ var Ot = { class: "tpl:p-4" }, kt = {
1600
1614
  "background-color": "var(--tpl-bg)",
1601
1615
  color: "var(--tpl-text)"
1602
1616
  },
1603
- placeholder: k(i).mediaLibrary.importUrlPlaceholder,
1617
+ placeholder: E(f).mediaLibrary.importUrlPlaceholder,
1604
1618
  disabled: e.isImporting,
1605
1619
  autofocus: ""
1606
- }, null, 8, cn), [[A, h.value]])]),
1607
- e.error ? (S(), d("p", ln, D(e.error), 1)) : u("", !0),
1608
- f("div", un, [f("button", {
1609
- class: y(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150", { "tpl:cursor-not-allowed tpl:opacity-50": e.isImporting }]),
1620
+ }, null, 8, an), [[D, _.value]])]),
1621
+ e.error ? (v(), s("p", on, C(e.error), 1)) : o("", !0),
1622
+ c("div", sn, [c("button", {
1623
+ class: h(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150", { "tpl:cursor-not-allowed tpl:opacity-50": e.isImporting }]),
1610
1624
  style: {
1611
1625
  "border-color": "var(--tpl-border)",
1612
1626
  color: "var(--tpl-text)",
1613
1627
  "background-color": "var(--tpl-bg)"
1614
1628
  },
1615
1629
  disabled: e.isImporting,
1616
- onClick: v
1617
- }, D(k(i).mediaLibrary.cancel), 11, dn), f("button", {
1630
+ onClick: x
1631
+ }, C(E(f).mediaLibrary.cancel), 11, cn), c("button", {
1618
1632
  class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
1619
1633
  style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
1620
- disabled: !h.value.trim() || e.isImporting,
1621
- onClick: g
1622
- }, [e.isImporting ? (S(), d("span", pn, [m(k(W), {
1634
+ disabled: !_.value.trim() || e.isImporting,
1635
+ onClick: y
1636
+ }, [e.isImporting ? (v(), s("span", un, [u(E(V), {
1623
1637
  class: "tpl:animate-spin",
1624
1638
  size: 12,
1625
1639
  "stroke-width": 2
1626
- }), p(" " + D(k(i).mediaLibrary.importing), 1)])) : (S(), d("span", mn, D(k(i).mediaLibrary.import), 1))], 8, fn)])
1627
- ])], 40, rn)) : u("", !0)]),
1640
+ }), l(" " + C(E(f).mediaLibrary.importing), 1)])) : (v(), s("span", dn, C(E(f).mediaLibrary.import), 1))], 8, ln)])
1641
+ ])], 40, en)) : o("", !0)]),
1628
1642
  _: 1
1629
1643
  })], 8, ["to"]));
1630
1644
  }
1631
- }), gn = { class: "tpl:max-h-56 tpl:overflow-y-auto tpl:py-1" }, _n = ["disabled", "onClick"], vn = { class: "tpl:truncate" }, yn = {
1645
+ }), pn = { class: "tpl:max-h-56 tpl:overflow-y-auto tpl:py-1" }, mn = ["disabled", "onClick"], hn = { class: "tpl:truncate" }, gn = {
1632
1646
  key: 0,
1633
1647
  class: "tpl:shrink-0",
1634
1648
  style: { color: "var(--tpl-text-dim)" }
1635
- }, bn = /* @__PURE__ */ h({
1649
+ }, _n = /* @__PURE__ */ d({
1636
1650
  __name: "MediaMovePicker",
1637
1651
  props: {
1638
1652
  folders: {},
1639
1653
  currentFolderId: {}
1640
1654
  },
1641
1655
  emits: ["select", "close"],
1642
- setup(e, { emit: t }) {
1643
- let n = t, { t: r } = Z(), a = w(null);
1644
- function o(e, t = 0) {
1656
+ setup(t, { emit: n }) {
1657
+ let r = n, { t: i } = Q(), a = b(null);
1658
+ function d(e, t = 0) {
1645
1659
  let n = [];
1646
1660
  for (let r of e) n.push({
1647
1661
  id: r.id,
1648
1662
  name: r.name,
1649
1663
  depth: t
1650
- }), r.children?.length && n.push(...o(r.children, t + 1));
1664
+ }), r.children.length && n.push(...d(r.children, t + 1));
1651
1665
  return n;
1652
1666
  }
1653
- return ie(a, () => {
1654
- n("close");
1655
- }), (t, s) => (S(), d("div", {
1667
+ return J(a, () => {
1668
+ r("close");
1669
+ }), (n, f) => (v(), s("div", {
1656
1670
  ref_key: "pickerRef",
1657
1671
  ref: a,
1658
1672
  class: "tpl:absolute tpl:bottom-full tpl:left-0 tpl:z-10 tpl:mb-2 tpl:w-56 tpl:overflow-hidden tpl:rounded-lg tpl:border tpl:shadow-lg",
@@ -1660,193 +1674,139 @@ var Ot = { class: "tpl:p-4" }, kt = {
1660
1674
  "border-color": "var(--tpl-border)",
1661
1675
  "background-color": "var(--tpl-bg-elevated)"
1662
1676
  }
1663
- }, [f("div", gn, [e.currentFolderId === null ? u("", !0) : (S(), d("button", {
1677
+ }, [c("div", pn, [t.currentFolderId === null ? o("", !0) : (v(), s("button", {
1664
1678
  key: 0,
1665
1679
  class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-1.5 tpl:px-3 tpl:py-1.5 tpl:text-left tpl:text-xs tpl:transition-colors tpl:duration-100",
1666
1680
  style: { color: "var(--tpl-text)" },
1667
- onClick: s[0] ||= (e) => n("select", null)
1668
- }, [m(k(z), {
1681
+ onClick: f[0] ||= (e) => r("select", null)
1682
+ }, [u(E(I), {
1669
1683
  class: "tpl:shrink-0",
1670
1684
  size: 14,
1671
1685
  "stroke-width": 1.5
1672
- }), p(" " + D(k(r).mediaLibrary.moveToRoot), 1)])), (S(!0), d(i, null, T(o(e.folders), (t) => (S(), d("button", {
1673
- key: t.id,
1686
+ }), l(" " + C(E(i).mediaLibrary.moveToRoot), 1)])), (v(!0), s(e, null, x(d(t.folders), (e) => (v(), s("button", {
1687
+ key: e.id,
1674
1688
  class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-1.5 tpl:py-1.5 tpl:pr-3 tpl:text-left tpl:text-xs tpl:transition-colors tpl:duration-100",
1675
- style: b({
1676
- paddingLeft: `${t.depth * 16 + 12}px`,
1677
- color: t.id === e.currentFolderId ? "var(--tpl-text-dim)" : "var(--tpl-text)",
1678
- opacity: t.id === e.currentFolderId ? .5 : 1
1689
+ style: g({
1690
+ paddingLeft: `${e.depth * 16 + 12}px`,
1691
+ color: e.id === t.currentFolderId ? "var(--tpl-text-dim)" : "var(--tpl-text)",
1692
+ opacity: e.id === t.currentFolderId ? .5 : 1
1679
1693
  }),
1680
- disabled: t.id === e.currentFolderId,
1681
- onClick: (e) => n("select", t.id)
1694
+ disabled: e.id === t.currentFolderId,
1695
+ onClick: (t) => r("select", e.id)
1682
1696
  }, [
1683
- m(k(B), {
1697
+ u(E(L), {
1684
1698
  class: "tpl:shrink-0",
1685
1699
  size: 14,
1686
1700
  "stroke-width": 1.5
1687
1701
  }),
1688
- f("span", vn, D(t.name), 1),
1689
- t.id === e.currentFolderId ? (S(), d("span", yn, D(k(r).mediaLibrary.currentFolder), 1)) : u("", !0)
1690
- ], 12, _n))), 128))])], 512));
1702
+ c("span", hn, C(e.name), 1),
1703
+ e.id === t.currentFolderId ? (v(), s("span", gn, C(E(i).mediaLibrary.currentFolder), 1)) : o("", !0)
1704
+ ], 12, mn))), 128))])], 512));
1691
1705
  }
1692
- }), xn = { class: "tpl:flex tpl:items-center tpl:gap-3" }, Sn = ["src", "alt"], Cn = {
1706
+ }), vn = { class: "tpl:flex tpl:items-center tpl:gap-3" }, yn = ["src", "alt"], bn = {
1693
1707
  key: 1,
1694
1708
  class: "tpl:flex tpl:size-10 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:overflow-hidden tpl:rounded",
1695
1709
  style: { border: "1px solid var(--tpl-border)" }
1696
- }, wn = { class: "tpl:min-w-0 tpl:flex-1" }, Tn = {
1710
+ }, xn = { class: "tpl:min-w-0 tpl:flex-1" }, Sn = {
1697
1711
  class: "tpl:truncate tpl:text-xs tpl:font-medium",
1698
1712
  style: { color: "var(--tpl-text)" }
1699
- }, En = {
1713
+ }, Cn = {
1700
1714
  class: "tpl:mt-0.5 tpl:text-[10px]",
1701
1715
  style: { color: "var(--tpl-text-muted)" }
1702
- }, Dn = {
1703
- key: 2,
1704
- class: "tpl:shrink-0"
1705
- }, On = {
1706
- class: "tpl:block tpl:text-[10px]",
1707
- style: { color: "var(--tpl-text-muted)" }
1708
- }, kn = ["value"], An = ["value"], jn = /*#__PURE__*/ dt(/* @__PURE__ */ h({
1716
+ }, wn = /*#__PURE__*/ st(/* @__PURE__ */ d({
1709
1717
  __name: "MediaPreviewPanel",
1710
1718
  props: {
1711
1719
  item: {},
1712
- folders: {},
1713
- selectedConversion: {}
1720
+ folders: {}
1714
1721
  },
1715
- emits: ["update:selectedConversion"],
1716
- setup(e, { emit: t }) {
1717
- let n = e, r = t, { t: a } = Z(), o = _(ye, null), { isImageMimeType: c } = Q(), l = s(() => {
1718
- if (!C.value || !n.item.conversions_generated) return [];
1719
- let e = [];
1720
- return n.item.small_url && e.push({
1721
- value: "small",
1722
- label: a.mediaLibrary.conversionSmall,
1723
- url: n.item.small_url
1724
- }), n.item.medium_url && e.push({
1725
- value: "medium",
1726
- label: a.mediaLibrary.conversionMedium,
1727
- url: n.item.medium_url
1728
- }), n.item.large_url && e.push({
1729
- value: "large",
1730
- label: a.mediaLibrary.conversionLarge,
1731
- url: n.item.large_url
1732
- }), e.push({
1733
- value: "original",
1734
- label: a.mediaLibrary.conversionOriginal,
1735
- url: n.item.url
1736
- }), e;
1737
- }), h = s(() => C.value && l.value.length > 1), g = s(() => {
1738
- if (!C.value) return null;
1739
- switch (n.selectedConversion) {
1740
- case "small": return n.item.small_url || n.item.url;
1741
- case "medium": return n.item.medium_url || n.item.url;
1742
- case "large": return n.item.large_url || n.item.url;
1743
- default: return n.item.url;
1744
- }
1745
- });
1746
- function v(e) {
1747
- let t = e.target;
1748
- r("update:selectedConversion", t.value);
1749
- }
1750
- function b(e, t, n = []) {
1722
+ setup(t) {
1723
+ let n = t, i = p(me, null), { isImageMimeType: a } = $();
1724
+ function d(e, t, n = []) {
1751
1725
  for (let r of e) {
1752
1726
  let e = [...n, r.name];
1753
1727
  if (r.id === t) return e;
1754
- if (r.children) {
1755
- let n = b(r.children, t, e);
1728
+ if (r.children.length) {
1729
+ let n = d(r.children, t, e);
1756
1730
  if (n) return n;
1757
1731
  }
1758
1732
  }
1759
1733
  return null;
1760
1734
  }
1761
- let x = s(() => {
1762
- if (!n.item.folder_id || !n.folders) return null;
1763
- let e = b(n.folders, n.item.folder_id);
1735
+ let f = r(() => {
1736
+ if (!n.item.folderId || !n.folders) return null;
1737
+ let e = d(n.folders, n.item.folderId);
1764
1738
  return e ? e.join("/") : null;
1765
- }), C = s(() => c(n.item.mime_type));
1766
- function w(e) {
1739
+ }), m = r(() => n.item.mimeType ?? ""), g = r(() => a(m.value));
1740
+ function _(e) {
1767
1741
  return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1048576).toFixed(1)} MB`;
1768
1742
  }
1769
- function E(e) {
1770
- return Dt(e, o?.value, {
1743
+ function y(e) {
1744
+ return Ct(e, i?.value, {
1771
1745
  year: "numeric",
1772
1746
  month: "short",
1773
1747
  day: "numeric"
1774
1748
  });
1775
1749
  }
1776
- return (t, n) => (S(), d("div", xn, [
1777
- C.value ? (S(), d("img", {
1778
- key: 0,
1779
- src: g.value ?? void 0,
1780
- alt: e.item.alt_text || e.item.filename,
1781
- class: "tpl:size-10 tpl:shrink-0 tpl:rounded tpl:object-cover",
1782
- style: { border: "1px solid var(--tpl-border)" }
1783
- }, null, 8, Sn)) : (S(), d("div", Cn, [m(Et, {
1784
- "mime-type": e.item.mime_type,
1785
- class: "tpl-preview-icon"
1786
- }, null, 8, ["mime-type"])])),
1787
- f("div", wn, [
1788
- f("p", Tn, D(e.item.filename), 1),
1789
- f("p", En, [
1790
- p(D(w(e.item.size)) + " · " + D(E(e.item.created_at)) + " ", 1),
1791
- C.value && e.item.width && e.item.height ? (S(), d(i, { key: 0 }, [p(" · " + D(e.item.width) + "×" + D(e.item.height) + "px ", 1)], 64)) : u("", !0),
1792
- x.value ? (S(), d(i, { key: 1 }, [
1793
- n[0] ||= p(" · ", -1),
1794
- m(k(B), {
1795
- class: "tpl:mb-px tpl:inline",
1796
- size: 9,
1797
- "stroke-width": 2
1798
- }),
1799
- p(" " + D(x.value), 1)
1800
- ], 64)) : u("", !0)
1801
- ]),
1802
- C.value ? (S(), d("p", {
1803
- key: 0,
1804
- class: y(["tpl:mt-0.5 tpl:truncate tpl:text-[10px] tpl:italic", { "tpl:invisible": !e.item.alt_text }]),
1805
- style: { color: "var(--tpl-text-dim)" }
1806
- }, D(e.item.alt_text || "\xA0"), 3)) : u("", !0)
1750
+ let b = r(() => n.item.filename || n.item.url);
1751
+ return (n, r) => (v(), s("div", vn, [g.value ? (v(), s("img", {
1752
+ key: 0,
1753
+ src: t.item.url,
1754
+ alt: t.item.alt || b.value,
1755
+ class: "tpl:size-10 tpl:shrink-0 tpl:rounded tpl:object-cover",
1756
+ style: { border: "1px solid var(--tpl-border)" }
1757
+ }, null, 8, yn)) : (v(), s("div", bn, [u(St, {
1758
+ "mime-type": m.value,
1759
+ class: "tpl-preview-icon"
1760
+ }, null, 8, ["mime-type"])])), c("div", xn, [
1761
+ c("p", Sn, C(b.value), 1),
1762
+ c("p", Cn, [
1763
+ t.item.size == null ? o("", !0) : (v(), s(e, { key: 0 }, [l(C(_(t.item.size)), 1)], 64)),
1764
+ t.item.createdAt ? (v(), s(e, { key: 1 }, [t.item.size == null ? o("", !0) : (v(), s(e, { key: 0 }, [l(" · ")], 64)), l(" " + C(y(t.item.createdAt)), 1)], 64)) : o("", !0),
1765
+ g.value && t.item.width && t.item.height ? (v(), s(e, { key: 2 }, [l(" · " + C(t.item.width) + "×" + C(t.item.height) + "px ", 1)], 64)) : o("", !0),
1766
+ f.value ? (v(), s(e, { key: 3 }, [
1767
+ r[0] ||= l(" · ", -1),
1768
+ u(E(L), {
1769
+ class: "tpl:mb-px tpl:inline",
1770
+ size: 9,
1771
+ "stroke-width": 2
1772
+ }),
1773
+ l(" " + C(f.value), 1)
1774
+ ], 64)) : o("", !0)
1807
1775
  ]),
1808
- h.value ? (S(), d("div", Dn, [f("label", On, D(k(a).mediaLibrary.conversionLabel), 1), f("select", {
1809
- class: "tpl:mt-0.5 tpl:rounded-md tpl:border tpl:py-1 tpl:pr-6 tpl:pl-2 tpl:text-xs tpl:outline-none",
1810
- style: {
1811
- "border-color": "var(--tpl-border)",
1812
- "background-color": "var(--tpl-bg)",
1813
- color: "var(--tpl-text)"
1814
- },
1815
- value: e.selectedConversion,
1816
- onChange: v
1817
- }, [(S(!0), d(i, null, T(l.value, (e) => (S(), d("option", {
1818
- key: e.value,
1819
- value: e.value
1820
- }, D(e.label), 9, An))), 128))], 40, kn)])) : u("", !0)
1821
- ]));
1776
+ g.value ? (v(), s("p", {
1777
+ key: 0,
1778
+ class: h(["tpl:mt-0.5 tpl:truncate tpl:text-[10px] tpl:italic", { "tpl:invisible": !t.item.alt }]),
1779
+ style: { color: "var(--tpl-text-dim)" }
1780
+ }, C(t.item.alt || "\xA0"), 3)) : o("", !0)
1781
+ ])]));
1822
1782
  }
1823
- }), [["__scopeId", "data-v-79f055d7"]]), Mn = ["data-tpl-theme"], Nn = {
1783
+ }), [["__scopeId", "data-v-c7fe5962"]]), Tn = ["data-tpl-theme"], En = {
1824
1784
  class: "tpl:max-h-[90%] tpl:w-full tpl:max-w-sm tpl:overflow-y-auto tpl:rounded-lg tpl:p-5 tpl:shadow-xl",
1825
1785
  style: { "background-color": "var(--tpl-bg-elevated)" }
1826
- }, Pn = {
1786
+ }, Dn = {
1827
1787
  class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
1828
1788
  style: { color: "var(--tpl-text)" }
1829
- }, Fn = {
1789
+ }, On = {
1830
1790
  class: "tpl:mb-2 tpl:text-xs",
1831
1791
  style: { color: "var(--tpl-text-muted)" }
1832
- }, In = {
1792
+ }, kn = {
1833
1793
  key: 0,
1834
1794
  class: "tpl:mb-3 tpl:text-xs",
1835
1795
  style: { color: "var(--tpl-warning)" }
1836
- }, Ln = {
1796
+ }, An = {
1837
1797
  class: "tpl:mb-3 tpl:rounded tpl:border tpl:p-2",
1838
1798
  style: { "border-color": "var(--tpl-border)" }
1839
- }, Rn = {
1799
+ }, jn = {
1840
1800
  class: "tpl:truncate tpl:text-xs tpl:font-medium",
1841
1801
  style: { color: "var(--tpl-text)" }
1842
- }, zn = { class: "tpl:mb-4" }, Bn = {
1802
+ }, Mn = { class: "tpl:mb-4" }, Nn = {
1843
1803
  class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
1844
1804
  style: { color: "var(--tpl-text-muted)" }
1845
- }, Vn = ["accept"], Hn = {
1805
+ }, Pn = ["accept"], Fn = {
1846
1806
  key: 1,
1847
1807
  class: "tpl:mb-3 tpl:text-xs",
1848
1808
  style: { color: "var(--tpl-danger)" }
1849
- }, Un = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Wn = ["disabled"], Gn = ["disabled"], Kn = /* @__PURE__ */ h({
1809
+ }, In = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Ln = ["disabled"], Rn = ["disabled"], zn = /* @__PURE__ */ d({
1850
1810
  __name: "MediaReplaceModal",
1851
1811
  props: {
1852
1812
  visible: { type: Boolean },
@@ -1856,26 +1816,26 @@ var Ot = { class: "tpl:p-4" }, kt = {
1856
1816
  error: {}
1857
1817
  },
1858
1818
  emits: ["replace", "close"],
1859
- setup(e, { emit: t }) {
1860
- let n = e, r = t, { t: i } = Z(), c = _(ve, null), p = _(ge, w(null)), h = w(null), g = w(null), v = s(() => {
1861
- if (!n.item) return "";
1862
- let e = n.item.filename.split(".");
1819
+ setup(e, { emit: i }) {
1820
+ let l = e, d = i, { t: f } = Q(), m = p(Z, null), h = p(fe, b(null)), g = b(null), _ = b(null), y = r(() => {
1821
+ if (!l.item) return "";
1822
+ let e = (l.item.filename ?? "").split(".");
1863
1823
  return e.length > 1 ? e[e.length - 1].toLowerCase() : "";
1864
- }), y = s(() => v.value ? `.${v.value}` : "*"), b = s(() => (n.usageInfo?.template_count ?? 0) > 0);
1865
- j(() => n.visible, (e) => {
1866
- e || (g.value = null, h.value && (h.value.value = ""));
1824
+ }), x = r(() => y.value ? `.${y.value}` : "*"), S = r(() => (l.usageInfo?.templateCount ?? 0) > 0);
1825
+ O(() => l.visible, (e) => {
1826
+ e || (_.value = null, g.value && (g.value.value = ""));
1867
1827
  });
1868
- function x(e) {
1828
+ function w(e) {
1869
1829
  let t = e.target;
1870
- t.files && t.files.length > 0 && (g.value = t.files[0]);
1830
+ t.files && t.files.length > 0 && (_.value = t.files[0]);
1871
1831
  }
1872
- function C() {
1873
- g.value && r("replace", g.value);
1832
+ function T() {
1833
+ _.value && d("replace", _.value);
1874
1834
  }
1875
- function T(e) {
1876
- e.key === "Escape" && r("close");
1835
+ function D(e) {
1836
+ e.key === "Escape" && d("close");
1877
1837
  }
1878
- return (t, n) => (S(), l(a, { to: k(p) || "body" }, [m(o, {
1838
+ return (r, i) => (v(), a(t, { to: E(h) || "body" }, [u(n, {
1879
1839
  "enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
1880
1840
  "enter-from-class": "tpl:opacity-0",
1881
1841
  "enter-to-class": "tpl:opacity-100",
@@ -1883,33 +1843,33 @@ var Ot = { class: "tpl:p-4" }, kt = {
1883
1843
  "leave-from-class": "tpl:opacity-100",
1884
1844
  "leave-to-class": "tpl:opacity-0"
1885
1845
  }, {
1886
- default: M(() => [e.visible && e.item ? (S(), d("div", {
1846
+ default: k(() => [e.visible && e.item ? (v(), s("div", {
1887
1847
  key: 0,
1888
- "data-tpl-theme": k(c),
1889
- class: "tpl tpl:fixed tpl:inset-0 tpl:z-[10000] tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
1848
+ "data-tpl-theme": E(m),
1849
+ class: "tpl tpl:fixed tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
1890
1850
  style: { "background-color": "var(--tpl-overlay)" },
1891
- onClick: n[1] ||= F((e) => r("close"), ["self"]),
1892
- onKeydown: T
1893
- }, [f("div", Nn, [
1894
- f("h3", Pn, D(k(i).mediaLibrary.replaceWarningTitle), 1),
1895
- f("p", Fn, D(k(i).mediaLibrary.replaceWarningMessage.replace("{extension}", `.${v.value}`)), 1),
1896
- b.value ? (S(), d("p", In, D(k(i).mediaLibrary.replaceWarningUsageNote.replace("{count}", e.usageInfo.template_count.toString())), 1)) : u("", !0),
1897
- f("div", Ln, [f("p", Rn, D(e.item.filename), 1)]),
1898
- f("div", zn, [f("label", Bn, D(k(i).mediaLibrary.replaceSelectFile), 1), f("input", {
1851
+ onClick: i[1] ||= M((e) => d("close"), ["self"]),
1852
+ onKeydown: D
1853
+ }, [c("div", En, [
1854
+ c("h3", Dn, C(E(f).mediaLibrary.replaceWarningTitle), 1),
1855
+ c("p", On, C(E(f).mediaLibrary.replaceWarningMessage.replace("{extension}", `.${y.value}`)), 1),
1856
+ S.value ? (v(), s("p", kn, C(E(f).mediaLibrary.replaceWarningUsageNote.replace("{count}", e.usageInfo.templateCount.toString())), 1)) : o("", !0),
1857
+ c("div", An, [c("p", jn, C(e.item.filename), 1)]),
1858
+ c("div", Mn, [c("label", Nn, C(E(f).mediaLibrary.replaceSelectFile), 1), c("input", {
1899
1859
  ref_key: "fileInputRef",
1900
- ref: h,
1860
+ ref: g,
1901
1861
  type: "file",
1902
- accept: y.value,
1862
+ accept: x.value,
1903
1863
  class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs",
1904
1864
  style: {
1905
1865
  "border-color": "var(--tpl-border)",
1906
1866
  "background-color": "var(--tpl-bg)",
1907
1867
  color: "var(--tpl-text)"
1908
1868
  },
1909
- onChange: x
1910
- }, null, 40, Vn)]),
1911
- e.error ? (S(), d("p", Hn, D(e.error), 1)) : u("", !0),
1912
- f("div", Un, [f("button", {
1869
+ onChange: w
1870
+ }, null, 40, Pn)]),
1871
+ e.error ? (v(), s("p", Fn, C(e.error), 1)) : o("", !0),
1872
+ c("div", In, [c("button", {
1913
1873
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
1914
1874
  style: {
1915
1875
  "border-color": "var(--tpl-border)",
@@ -1917,93 +1877,94 @@ var Ot = { class: "tpl:p-4" }, kt = {
1917
1877
  "background-color": "var(--tpl-bg)"
1918
1878
  },
1919
1879
  disabled: e.isReplacing,
1920
- onClick: n[0] ||= (e) => r("close")
1921
- }, D(k(i).mediaLibrary.cancel), 9, Wn), f("button", {
1880
+ onClick: i[0] ||= (e) => d("close")
1881
+ }, C(E(f).mediaLibrary.cancel), 9, Ln), c("button", {
1922
1882
  class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
1923
1883
  style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
1924
- disabled: !g.value || e.isReplacing,
1925
- onClick: C
1926
- }, D(e.isReplacing ? k(i).mediaLibrary.replacing : k(i).mediaLibrary.replace), 9, Gn)])
1927
- ])], 40, Mn)) : u("", !0)]),
1884
+ disabled: !_.value || e.isReplacing,
1885
+ onClick: T
1886
+ }, C(e.isReplacing ? E(f).mediaLibrary.replacing : E(f).mediaLibrary.replace), 9, Rn)])
1887
+ ])], 40, Tn)) : o("", !0)]),
1928
1888
  _: 1
1929
1889
  })], 8, ["to"]));
1930
1890
  }
1931
- }), qn = {
1891
+ }), Bn = {
1932
1892
  key: 0,
1933
1893
  class: "tpl:flex tpl:items-center tpl:gap-2"
1934
- }, Jn = {
1894
+ }, Vn = {
1935
1895
  class: "tpl:text-xs",
1936
1896
  style: { color: "var(--tpl-text-muted)" }
1937
- }, Yn = {
1897
+ }, Hn = {
1938
1898
  class: "tpl:text-xs",
1939
1899
  style: { color: "var(--tpl-text-muted)" }
1940
- }, Xn = {
1900
+ }, Un = {
1941
1901
  class: "tpl:mt-1 tpl:text-[10px]",
1942
1902
  style: { color: "var(--tpl-text-dim)" }
1943
- }, Zn = /* @__PURE__ */ h({
1903
+ }, Wn = /* @__PURE__ */ d({
1944
1904
  __name: "MediaUploadZone",
1945
1905
  props: {
1946
1906
  isUploading: { type: Boolean },
1947
1907
  uploadProgress: {}
1948
1908
  },
1949
1909
  emits: ["upload"],
1950
- setup(e, { emit: t }) {
1951
- let n = t, { t: r, format: a } = Z(), { allAcceptedMimeTypes: o, allAcceptedInputString: s, maxFileSize: c } = Q(), l = w();
1952
- function u(e) {
1910
+ setup(t, { emit: n }) {
1911
+ let r = n, { t: i, format: a } = Q(), { allAcceptedInputString: o, isAcceptedFile: l } = $(), d = b();
1912
+ function f(e) {
1953
1913
  let t = [];
1954
- for (let n of Array.from(e)) o.value.includes(n.type) && n.size <= c.value && t.push(n);
1914
+ for (let n of Array.from(e)) l(n) && t.push(n);
1955
1915
  return t;
1956
1916
  }
1957
1917
  function p(e) {
1958
- let t = u(e);
1959
- t.length && n("upload", t);
1918
+ let t = f(e);
1919
+ t.length && r("upload", t);
1960
1920
  }
1961
- let { isOverDropZone: h } = se(l, { onDrop: (e) => {
1921
+ let { isOverDropZone: m } = ae(d, { onDrop: (e) => {
1962
1922
  e?.length && p(e);
1963
- } }), { open: g, onChange: _ } = le({
1964
- accept: s.value,
1923
+ } }), { open: g, onChange: _ } = se({
1924
+ accept: o.value,
1965
1925
  multiple: !0
1966
1926
  });
1967
1927
  return _((e) => {
1968
1928
  e?.length && p(e);
1969
- }), (t, n) => (S(), d("div", {
1929
+ }), (n, r) => (v(), s("div", {
1970
1930
  ref_key: "dropZoneRef",
1971
- ref: l,
1972
- class: y(["tpl-upload-zone tpl:flex tpl:cursor-pointer tpl:flex-col tpl:items-center tpl:justify-center tpl:rounded-lg tpl:border-2 tpl:border-dashed tpl:p-5 tpl:text-center tpl:transition-all tpl:duration-150", k(h) ? "tpl-upload-zone-active" : ""]),
1931
+ ref: d,
1932
+ "data-testid": "media-upload-zone",
1933
+ class: h(["tpl-upload-zone tpl:flex tpl:cursor-pointer tpl:flex-col tpl:items-center tpl:justify-center tpl:rounded-lg tpl:border-2 tpl:border-dashed tpl:p-5 tpl:text-center tpl:transition-all tpl:duration-150", E(m) ? "tpl-upload-zone-active" : ""]),
1973
1934
  style: {
1974
1935
  "border-color": "var(--tpl-border-light)",
1975
1936
  "background-color": "var(--tpl-bg)"
1976
1937
  },
1977
- onClick: n[0] ||= (e) => k(g)()
1978
- }, [e.isUploading ? (S(), d("div", qn, [m(k(W), {
1938
+ onClick: r[0] ||= (e) => E(g)()
1939
+ }, [t.isUploading ? (v(), s("div", Bn, [u(E(V), {
1979
1940
  class: "tpl-spinner",
1980
1941
  size: 20,
1981
1942
  "stroke-width": 2,
1982
1943
  style: { color: "var(--tpl-primary)" }
1983
- }), f("span", Jn, D(e.uploadProgress && e.uploadProgress.total > 1 ? k(a)(k(r).mediaLibrary.uploadingProgress, {
1984
- current: e.uploadProgress.current,
1985
- total: e.uploadProgress.total
1986
- }) : k(r).mediaLibrary.uploading), 1)])) : (S(), d(i, { key: 1 }, [
1987
- m(k(te), {
1944
+ }), c("span", Vn, C(t.uploadProgress && t.uploadProgress.total > 1 ? E(a)(E(i).mediaLibrary.uploadingProgress, {
1945
+ current: t.uploadProgress.current,
1946
+ total: t.uploadProgress.total
1947
+ }) : E(i).mediaLibrary.uploading), 1)])) : (v(), s(e, { key: 1 }, [
1948
+ u(E(q), {
1988
1949
  class: "tpl:mb-2",
1989
1950
  size: 24,
1990
1951
  "stroke-width": 1.5,
1991
1952
  style: { color: "var(--tpl-text-dim)" }
1992
1953
  }),
1993
- f("p", Yn, D(k(r).mediaLibrary.dropOrClick), 1),
1994
- f("p", Xn, D(k(r).mediaLibrary.acceptedFormats), 1)
1954
+ c("p", Hn, C(E(i).mediaLibrary.dropOrClick), 1),
1955
+ c("p", Un, C(E(i).mediaLibrary.acceptedFormats), 1)
1995
1956
  ], 64))], 2));
1996
1957
  }
1997
- }), Qn = [
1958
+ }), Gn = [
1998
1959
  "width",
1999
1960
  "height",
2000
1961
  "viewBox"
2001
- ], $n = [
1962
+ ], Kn = [
2002
1963
  "cx",
2003
1964
  "cy",
2004
1965
  "r",
2005
1966
  "stroke-width"
2006
- ], er = [
1967
+ ], qn = [
2007
1968
  "cx",
2008
1969
  "cy",
2009
1970
  "r",
@@ -2011,14 +1972,14 @@ var Ot = { class: "tpl:p-4" }, kt = {
2011
1972
  "stroke",
2012
1973
  "stroke-dasharray",
2013
1974
  "stroke-dashoffset"
2014
- ], tr = {
1975
+ ], Jn = {
2015
1976
  key: 0,
2016
1977
  class: "tpl:absolute tpl:top-full tpl:left-1/2 tpl:z-50 tpl:mt-2 tpl:-translate-x-1/2 tpl:rounded-md tpl:px-2.5 tpl:py-1.5 tpl:text-xs tpl:whitespace-nowrap tpl:shadow-lg",
2017
1978
  style: {
2018
1979
  "background-color": "var(--tpl-text)",
2019
1980
  color: "var(--tpl-bg-elevated)"
2020
1981
  }
2021
- }, nr = /* @__PURE__ */ h({
1982
+ }, Yn = /* @__PURE__ */ d({
2022
1983
  __name: "StorageProgressRing",
2023
1984
  props: {
2024
1985
  usedBytes: {},
@@ -2026,8 +1987,8 @@ var Ot = { class: "tpl:p-4" }, kt = {
2026
1987
  size: {}
2027
1988
  },
2028
1989
  setup(e) {
2029
- let t = e, { t: n, format: r } = Z(), i = w(!1), a = s(() => t.size ?? 24), c = s(() => Math.max(2, a.value / 8)), l = s(() => (a.value - c.value) / 2), h = s(() => 2 * Math.PI * l.value), g = s(() => t.limitBytes <= 0 ? 0 : Math.min(100, t.usedBytes / t.limitBytes * 100)), _ = s(() => h.value - g.value / 100 * h.value), v = s(() => g.value >= 95 ? "var(--tpl-danger)" : g.value >= 75 ? "var(--tpl-warning, #f59e0b)" : "var(--tpl-primary)");
2030
- function y(e) {
1990
+ let t = e, { t: i, format: a } = Q(), d = b(!1), f = r(() => t.size ?? 24), p = r(() => Math.max(2, f.value / 8)), m = r(() => (f.value - p.value) / 2), h = r(() => 2 * Math.PI * m.value), g = r(() => t.limitBytes <= 0 ? 0 : Math.min(100, t.usedBytes / t.limitBytes * 100)), _ = r(() => h.value - g.value / 100 * h.value), y = r(() => g.value >= 95 ? "var(--tpl-danger)" : g.value >= 75 ? "var(--tpl-warning, #f59e0b)" : "var(--tpl-primary)");
1991
+ function x(e) {
2031
1992
  if (e === 0) return "0 B";
2032
1993
  let t = 1024, n = [
2033
1994
  "B",
@@ -2037,39 +1998,40 @@ var Ot = { class: "tpl:p-4" }, kt = {
2037
1998
  ], r = Math.floor(Math.log(e) / Math.log(t)), i = e / t ** r, a = +(r >= 2);
2038
1999
  return `${i.toFixed(a)} ${n[r]}`;
2039
2000
  }
2040
- let b = s(() => y(t.usedBytes)), x = s(() => y(t.limitBytes)), C = s(() => Math.max(0, t.limitBytes - t.usedBytes)), T = s(() => y(C.value)), E = s(() => r(n.mediaLibrary.storageTooltip, {
2041
- used: b.value,
2042
- total: x.value,
2043
- remaining: T.value
2001
+ let S = r(() => x(t.usedBytes)), w = r(() => x(t.limitBytes)), T = r(() => Math.max(0, t.limitBytes - t.usedBytes)), E = r(() => x(T.value)), D = r(() => a(i.mediaLibrary.storageTooltip, {
2002
+ used: S.value,
2003
+ total: w.value,
2004
+ remaining: E.value
2044
2005
  }));
2045
- return (e, t) => (S(), d("div", {
2006
+ return (e, t) => (v(), s("div", {
2007
+ "data-testid": "media-storage-ring",
2046
2008
  class: "tpl:relative tpl:inline-flex tpl:cursor-help tpl:items-center tpl:justify-center",
2047
- onMouseenter: t[0] ||= (e) => i.value = !0,
2048
- onMouseleave: t[1] ||= (e) => i.value = !1
2049
- }, [(S(), d("svg", {
2050
- width: a.value,
2051
- height: a.value,
2009
+ onMouseenter: t[0] ||= (e) => d.value = !0,
2010
+ onMouseleave: t[1] ||= (e) => d.value = !1
2011
+ }, [(v(), s("svg", {
2012
+ width: f.value,
2013
+ height: f.value,
2052
2014
  class: "tpl:-rotate-90",
2053
- viewBox: `0 0 ${a.value} ${a.value}`
2054
- }, [f("circle", {
2055
- cx: a.value / 2,
2056
- cy: a.value / 2,
2057
- r: l.value,
2015
+ viewBox: `0 0 ${f.value} ${f.value}`
2016
+ }, [c("circle", {
2017
+ cx: f.value / 2,
2018
+ cy: f.value / 2,
2019
+ r: m.value,
2058
2020
  fill: "none",
2059
- "stroke-width": c.value,
2021
+ "stroke-width": p.value,
2060
2022
  style: { stroke: "var(--tpl-border)" }
2061
- }, null, 8, $n), f("circle", {
2062
- cx: a.value / 2,
2063
- cy: a.value / 2,
2064
- r: l.value,
2023
+ }, null, 8, Kn), c("circle", {
2024
+ cx: f.value / 2,
2025
+ cy: f.value / 2,
2026
+ r: m.value,
2065
2027
  fill: "none",
2066
- "stroke-width": c.value,
2067
- stroke: v.value,
2028
+ "stroke-width": p.value,
2029
+ stroke: y.value,
2068
2030
  "stroke-linecap": "round",
2069
2031
  "stroke-dasharray": h.value,
2070
2032
  "stroke-dashoffset": _.value,
2071
2033
  class: "tpl:transition-all tpl:duration-300 tpl:ease-out"
2072
- }, null, 8, er)], 8, Qn)), m(o, {
2034
+ }, null, 8, qn)], 8, Gn)), u(n, {
2073
2035
  "enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
2074
2036
  "enter-from-class": "tpl:opacity-0 tpl:translate-y-1",
2075
2037
  "enter-to-class": "tpl:opacity-100 tpl:translate-y-0",
@@ -2077,58 +2039,62 @@ var Ot = { class: "tpl:p-4" }, kt = {
2077
2039
  "leave-from-class": "tpl:opacity-100 tpl:translate-y-0",
2078
2040
  "leave-to-class": "tpl:opacity-0 tpl:translate-y-1"
2079
2041
  }, {
2080
- default: M(() => [i.value ? (S(), d("div", tr, [p(D(E.value) + " ", 1), t[2] ||= f("div", {
2042
+ default: k(() => [d.value ? (v(), s("div", Jn, [l(C(D.value) + " ", 1), t[2] ||= c("div", {
2081
2043
  class: "tpl:absolute tpl:-top-1 tpl:left-1/2 tpl:size-2 tpl:-translate-x-1/2 tpl:rotate-45",
2082
2044
  style: { "background-color": "var(--tpl-text)" }
2083
- }, null, -1)])) : u("", !0)]),
2045
+ }, null, -1)])) : o("", !0)]),
2084
2046
  _: 1
2085
2047
  })], 32));
2086
2048
  }
2087
2049
  });
2088
2050
  //#endregion
2051
+ //#region src/utils/treeFolders.ts
2052
+ function Xn(e) {
2053
+ let t = /* @__PURE__ */ new Map();
2054
+ for (let n of e) t.set(n.id, {
2055
+ ...n,
2056
+ children: []
2057
+ });
2058
+ let n = [];
2059
+ for (let e of t.values()) {
2060
+ let r = e.parentId ?? null, i = r ? t.get(r) : void 0;
2061
+ i ? i.children.push(e) : n.push(e);
2062
+ }
2063
+ return n;
2064
+ }
2065
+ //#endregion
2089
2066
  //#region src/composables/useMediaLibraryUI.ts
2090
- function rr(e) {
2067
+ function Zn(e) {
2091
2068
  let { library: t, translations: n } = e;
2092
- function r() {
2069
+ function i() {
2093
2070
  return "value" in n && typeof n.value == "object" ? n.value : n;
2094
2071
  }
2095
- let i = w("grid"), a = w(!1), o = w(""), c = w("original"), l = w(null), u = w(!1), d = w(!1), f = s(() => {
2096
- let e = t.previewItem.value;
2097
- if (!e) return null;
2098
- switch (c.value) {
2099
- case "small": return e.small_url || e.url;
2100
- case "medium": return e.medium_url || e.url;
2101
- case "large": return e.large_url || e.url;
2102
- default: return e.url;
2103
- }
2104
- }), p = s(() => t.frequentlyUsedItems.value.length > 0), m = s(() => t.viewMode.value === "frequently-used" ? t.frequentlyUsedItems.value : t.items.value), h = s(() => Object.values(t.deleteUsageInfo.value).some((e) => e.template_count > 0)), g = {
2105
- images: () => r().mediaLibrary.filterImages,
2106
- documents: () => r().mediaLibrary.filterDocuments,
2107
- videos: () => r().mediaLibrary.filterVideos,
2108
- audio: () => r().mediaLibrary.filterAudio
2072
+ let a = b("grid"), o = b(!1), s = b(""), c = b(null), l = b(!1), u = b(!1), d = r(() => t.previewItem.value?.url ?? null), f = r(() => t.frequentlyUsedItems.value.length > 0), p = r(() => t.viewMode.value === "frequently-used" ? t.frequentlyUsedItems.value : t.items.value), m = r(() => Object.values(t.deleteUsageInfo.value).some((e) => e.templateCount > 0)), h = r(() => Xn(t.folders.value)), g = {
2073
+ images: () => i().mediaLibrary.filterImages,
2074
+ documents: () => i().mediaLibrary.filterDocuments,
2075
+ videos: () => i().mediaLibrary.filterVideos,
2076
+ audio: () => i().mediaLibrary.filterAudio
2109
2077
  };
2110
2078
  function _(e) {
2111
2079
  return g[e]?.() ?? e;
2112
2080
  }
2113
- j(a, (e) => {
2081
+ O(o, (e) => {
2114
2082
  e && t.loadFolders();
2115
- }), j(() => t.previewItem.value?.id, () => {
2116
- c.value = "original";
2117
2083
  });
2118
- let v = oe((e) => {
2084
+ let v = ie((e) => {
2119
2085
  t.search(e);
2120
2086
  }, 300);
2121
2087
  function y(e) {
2122
- o.value = e, v(e);
2088
+ s.value = e, v(e);
2123
2089
  }
2124
- let { copy: b, copied: x } = ae({
2090
+ let { copy: x, copied: S } = Y({
2125
2091
  copiedDuring: 2e3,
2126
2092
  legacy: !0
2127
2093
  });
2128
- async function S(e) {
2094
+ async function C(e) {
2129
2095
  await t.uploadFiles(e);
2130
2096
  }
2131
- function C(e) {
2097
+ function w(e) {
2132
2098
  t.selectItem(e);
2133
2099
  }
2134
2100
  async function T(e, n) {
@@ -2140,17 +2106,17 @@ function rr(e) {
2140
2106
  async function D(e) {
2141
2107
  await t.deleteFolder(e);
2142
2108
  }
2143
- function O(e) {
2144
- l.value = e;
2109
+ function k(e) {
2110
+ c.value = e;
2145
2111
  }
2146
- async function k(e, n, r, i) {
2147
- i && await t.replaceMediaDirectly(e, i.file), await t.updateFile(e, n, r), l.value = null;
2112
+ async function A(e, n, r, i) {
2113
+ i && await t.replaceMediaDirectly(e, i.file), await t.updateFile(e, n, r), c.value = null;
2148
2114
  }
2149
- async function A(e) {
2150
- await t.importFromUrl(e) && (u.value = !1);
2115
+ async function j(e) {
2116
+ await t.importFromUrl(e) && (l.value = !1);
2151
2117
  }
2152
2118
  async function M(e) {
2153
- d.value = !1, await t.moveSelected(e);
2119
+ u.value = !1, await t.moveSelected(e);
2154
2120
  }
2155
2121
  async function N() {
2156
2122
  await t.checkUsageBeforeDelete();
@@ -2162,32 +2128,32 @@ function rr(e) {
2162
2128
  await t.replaceFile(e);
2163
2129
  }
2164
2130
  function I() {
2165
- t.clearSelection(), t.cancelDelete(), t.cancelReplace(), o.value = "", t.categoryFilter.value = null, t.sortOption.value = "newest", t.viewMode.value = "files", l.value = null, u.value = !1, c.value = "original";
2131
+ t.clearSelection(), t.cancelDelete(), t.cancelReplace(), s.value = "", t.searchQuery.value = "", t.categoryFilter.value = null, t.sortOption.value = "newest", t.viewMode.value = "files", c.value = null, l.value = !1;
2166
2132
  }
2167
2133
  return {
2168
- layoutMode: i,
2169
- showSidebar: a,
2170
- searchInput: o,
2171
- selectedConversion: c,
2172
- editingItem: l,
2173
- showImportUrlModal: u,
2174
- showMovePicker: d,
2175
- selectedUrl: f,
2176
- hasFrequentlyUsed: p,
2177
- displayItems: m,
2178
- hasUsedFiles: h,
2179
- copy: b,
2180
- copied: x,
2134
+ layoutMode: a,
2135
+ showSidebar: o,
2136
+ searchInput: s,
2137
+ editingItem: c,
2138
+ showImportUrlModal: l,
2139
+ showMovePicker: u,
2140
+ selectedUrl: d,
2141
+ hasFrequentlyUsed: f,
2142
+ displayItems: p,
2143
+ hasUsedFiles: m,
2144
+ folderTree: h,
2145
+ copy: x,
2146
+ copied: S,
2181
2147
  getCategoryLabel: _,
2182
2148
  handleSearchInput: y,
2183
- handleUpload: S,
2184
- handleSelect: C,
2149
+ handleUpload: C,
2150
+ handleSelect: w,
2185
2151
  handleCreateFolder: T,
2186
2152
  handleRenameFolder: E,
2187
2153
  handleDeleteFolder: D,
2188
- handleEditItem: O,
2189
- handleEditSave: k,
2190
- handleImportFromUrl: A,
2154
+ handleEditItem: k,
2155
+ handleEditSave: A,
2156
+ handleImportFromUrl: j,
2191
2157
  handleMoveToFolder: M,
2192
2158
  handleDeleteClick: N,
2193
2159
  handleReplaceItem: P,
@@ -2197,39 +2163,39 @@ function rr(e) {
2197
2163
  }
2198
2164
  //#endregion
2199
2165
  //#region src/i18n/index.ts
2200
- var ir = /* #__PURE__ */ Object.assign({
2201
- "./locales/ca.ts": () => import("./ca-DnghH5Xn.js"),
2202
- "./locales/de.ts": () => import("./de-ByQyu2jv.js"),
2203
- "./locales/en.ts": () => Promise.resolve().then(() => be),
2204
- "./locales/es.ts": () => import("./es-Bcp-DbmC.js"),
2205
- "./locales/fr.ts": () => import("./fr-DXb0cCZG.js"),
2206
- "./locales/nl.ts": () => import("./nl-DGT1t3Be.js"),
2207
- "./locales/pt-BR.ts": () => import("./pt-BR-C0Hzc26R.js")
2166
+ var Qn = /* #__PURE__ */ Object.assign({
2167
+ "./locales/ca.ts": () => import("./ca-CGf3MuE2.js"),
2168
+ "./locales/de.ts": () => import("./de-D5ebAV5i.js"),
2169
+ "./locales/en.ts": () => Promise.resolve().then(() => he),
2170
+ "./locales/es.ts": () => import("./es-BG--QNW0.js"),
2171
+ "./locales/fr.ts": () => import("./fr-Mdi4AlCR.js"),
2172
+ "./locales/nl.ts": () => import("./nl-D-6hT8te.js"),
2173
+ "./locales/pt-BR.ts": () => import("./pt-BR-DMfAgDWi.js")
2208
2174
  });
2209
- function ar(e) {
2175
+ function $n(e) {
2210
2176
  return Object.keys(e).map((e) => e.match(/\/([^/]+)\.ts$/)?.[1]).filter((e) => !!e);
2211
2177
  }
2212
- var or = ar(ir);
2213
- function sr(e) {
2178
+ var er = $n(Qn);
2179
+ function tr(e) {
2214
2180
  return e.trim().replace(/_/g, "-").toLowerCase();
2215
2181
  }
2216
- function cr(e) {
2217
- let t = sr(e);
2218
- return or.find((e) => sr(e) === t);
2182
+ function nr(e) {
2183
+ let t = tr(e);
2184
+ return er.find((e) => tr(e) === t);
2219
2185
  }
2220
- function lr(e) {
2221
- return sr(e).split("-")[0];
2186
+ function rr(e) {
2187
+ return tr(e).split("-")[0];
2222
2188
  }
2223
- function ur(e) {
2224
- return cr(e) ?? cr(lr(e)) ?? "en";
2189
+ function ir(e) {
2190
+ return nr(e) ?? nr(rr(e)) ?? "en";
2225
2191
  }
2226
- async function dr(e) {
2227
- let t = ir[`./locales/${ur(e)}.ts`];
2192
+ async function ar(e) {
2193
+ let t = Qn[`./locales/${ir(e)}.ts`];
2228
2194
  return (await t()).default;
2229
2195
  }
2230
2196
  //#endregion
2231
2197
  //#region src/components/MediaLibraryModal.vue?vue&type=script&setup=true&lang.ts
2232
- var fr = ["data-tpl-theme"], pr = {
2198
+ var or = ["data-tpl-theme"], sr = {
2233
2199
  class: "tpl-media-modal tpl-scale-in tpl:flex tpl:flex-col tpl:overflow-hidden tpl:rounded-[var(--tpl-radius-lg)]",
2234
2200
  style: {
2235
2201
  width: "900px",
@@ -2240,107 +2206,148 @@ var fr = ["data-tpl-theme"], pr = {
2240
2206
  border: "1px solid var(--tpl-border)",
2241
2207
  "box-shadow": "var(--tpl-shadow-xl)"
2242
2208
  }
2243
- }, mr = {
2209
+ }, cr = {
2244
2210
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-3.5",
2245
2211
  style: { "border-color": "var(--tpl-border)" }
2246
- }, hr = {
2212
+ }, lr = {
2247
2213
  class: "tpl:text-sm tpl:font-semibold",
2248
2214
  style: { color: "var(--tpl-text)" }
2249
- }, gr = { class: "tpl:flex tpl:items-center tpl:gap-3" }, _r = { class: "tpl:relative" }, vr = ["value", "placeholder"], yr = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, br = {
2215
+ }, ur = { class: "tpl:flex tpl:items-center tpl:gap-3" }, dr = { class: "tpl:relative" }, fr = [
2216
+ "value",
2217
+ "disabled",
2218
+ "placeholder"
2219
+ ], pr = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, mr = {
2250
2220
  key: 0,
2251
2221
  class: "tpl:flex tpl:w-48 tpl:shrink-0 tpl:flex-col tpl:border-r",
2252
2222
  style: {
2253
2223
  "border-color": "var(--tpl-border)",
2254
2224
  "background-color": "var(--tpl-bg)"
2255
2225
  }
2256
- }, xr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, Sr = {
2226
+ }, hr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, gr = {
2257
2227
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-4 tpl:py-2.5",
2258
2228
  style: { "border-color": "var(--tpl-border)" }
2259
- }, Cr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, wr = ["title"], Tr = {
2260
- key: 0,
2229
+ }, _r = { class: "tpl:flex tpl:items-center tpl:gap-2" }, vr = ["title"], yr = {
2230
+ key: 1,
2261
2231
  class: "tpl:text-xs tpl:font-medium",
2262
2232
  style: { color: "var(--tpl-text)" }
2263
- }, Er = {
2233
+ }, br = {
2264
2234
  class: "tpl:flex tpl:rounded-md tpl:p-0.5",
2265
2235
  style: {
2266
2236
  border: "1px solid var(--tpl-border)",
2267
2237
  "background-color": "var(--tpl-bg)"
2268
2238
  }
2269
- }, Dr = ["title"], Or = ["title"], kr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Ar = ["value"], jr = { value: "" }, Mr = ["value"], Nr = ["value"], Pr = { value: "newest" }, Fr = { value: "oldest" }, Ir = { value: "name_asc" }, Lr = { value: "name_desc" }, Rr = { value: "size_asc" }, zr = { value: "size_desc" }, Br = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, Vr = {
2239
+ }, xr = ["title"], Sr = ["title"], Cr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, wr = ["value"], Tr = { value: "" }, Er = ["value"], Dr = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, Or = {
2270
2240
  key: 0,
2271
2241
  class: "tpl:px-4 tpl:pt-3"
2272
- }, Hr = {
2242
+ }, kr = {
2273
2243
  class: "tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5",
2274
2244
  style: {
2275
2245
  "background-color": "var(--tpl-bg-elevated)",
2276
2246
  "box-shadow": "var(--tpl-shadow-xl)"
2277
2247
  }
2278
- }, Ur = {
2248
+ }, Ar = {
2279
2249
  class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
2280
2250
  style: { color: "var(--tpl-text)" }
2281
- }, Wr = {
2251
+ }, jr = {
2282
2252
  key: 0,
2253
+ "data-testid": "media-delete-usage",
2283
2254
  class: "tpl:mb-4 tpl:text-xs",
2284
2255
  style: { color: "var(--tpl-text-muted)" }
2285
- }, Gr = {
2256
+ }, Mr = {
2286
2257
  key: 1,
2287
2258
  class: "tpl:mb-4 tpl:max-h-32 tpl:overflow-y-auto tpl:rounded tpl:border tpl:p-2",
2288
2259
  style: { "border-color": "var(--tpl-border)" }
2289
- }, Kr = { class: "tpl:font-medium" }, qr = { style: { color: "var(--tpl-text-muted)" } }, Jr = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Yr = {
2260
+ }, Nr = { class: "tpl:font-medium" }, Pr = { style: { color: "var(--tpl-text-muted)" } }, Fr = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Ir = {
2290
2261
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3",
2291
2262
  style: { "border-color": "var(--tpl-border)" }
2292
- }, Xr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, Zr = { class: "tpl:flex tpl:items-center tpl:gap-5" }, Qr = {
2263
+ }, Lr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, Rr = { class: "tpl:flex tpl:items-center tpl:gap-5" }, zr = {
2293
2264
  key: 0,
2294
2265
  class: "tpl:flex tpl:items-center tpl:gap-2"
2295
- }, $r = { class: "tpl:relative" }, ei = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ti = ["disabled"], ni = /* @__PURE__ */ h({
2266
+ }, Br = {
2267
+ key: 1,
2268
+ class: "tpl:relative"
2269
+ }, Vr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Hr = ["disabled"], Ur = /* @__PURE__ */ d({
2296
2270
  __name: "MediaLibraryModal",
2297
2271
  props: {
2298
2272
  visible: { type: Boolean },
2273
+ provider: {},
2299
2274
  accept: {},
2300
- authManager: {},
2301
- projectId: {},
2302
- planConfig: {},
2303
2275
  popoverTarget: {},
2304
2276
  locale: {},
2305
- uiTheme: {}
2277
+ uiTheme: {},
2278
+ templateId: {},
2279
+ onError: { type: Function }
2306
2280
  },
2307
2281
  emits: ["close", "select"],
2308
- setup(e, { emit: t }) {
2309
- let n = e, r = t, c = w(null);
2310
- j(() => n.locale, async (e) => {
2311
- c.value = await dr(e ?? "en");
2312
- }, { immediate: !0 }), C(_e, c);
2313
- let h = s(() => c.value), g = s(() => n.uiTheme);
2314
- C(ve, g);
2315
- let _ = O(() => n.popoverTarget ?? null);
2316
- C(ge, _), C(ye, O(() => n.locale)), C(he, n.planConfig);
2317
- let v = s(() => n.planConfig.config.value?.storage.used_bytes ?? 0), x = s(() => n.planConfig.config.value?.storage.limit_bytes ?? 0), { isAcceptedMimeType: E, availableCategories: A } = Q(n.planConfig), N = me({
2318
- projectId: n.projectId,
2319
- authManager: n.authManager
2320
- }), P = rr({
2321
- library: N,
2322
- translations: h
2323
- });
2324
- j(() => n.visible, (e) => {
2325
- e ? (N.loadItems(), N.loadFrequentlyUsed()) : P.resetUI();
2282
+ setup(i, { emit: d }) {
2283
+ let f = i, p = d, m = b(null);
2284
+ O(() => f.locale, async (e) => {
2285
+ m.value = await ar(e ?? "en");
2286
+ }, { immediate: !0 }), y(pe, m);
2287
+ let _ = r(() => m.value), S = r(() => f.uiTheme);
2288
+ y(Z, S);
2289
+ let T = w(() => f.popoverTarget ?? null);
2290
+ y(fe, T), y(me, w(() => f.locale));
2291
+ let D = {
2292
+ get maxFileSize() {
2293
+ return f.provider.maxFileSize;
2294
+ },
2295
+ get mimeTypes() {
2296
+ return f.provider.mimeTypes;
2297
+ },
2298
+ get accept() {
2299
+ return f.accept;
2300
+ }
2301
+ };
2302
+ y(de, D);
2303
+ let { isAcceptedMimeType: A, availableCategories: j } = $(D), P = ue({
2304
+ provider: f.provider,
2305
+ templateId: () => f.templateId,
2306
+ onError: (e) => f.onError?.(e)
2307
+ }), I = Zn({
2308
+ library: P,
2309
+ translations: _
2310
+ }), L = r(() => typeof f.provider.create == "function"), V = r(() => f.provider.folders !== !1), U = r(() => typeof f.provider.importFromUrl == "function"), W = r(() => typeof f.provider.delete == "function"), G = r(() => typeof f.provider.update == "function"), K = r(() => typeof f.provider.replace == "function"), te = r(() => typeof f.provider.frequentlyUsed == "function"), q = r(() => {
2311
+ let e = f.provider.folders;
2312
+ return e !== !1 && typeof e.move == "function";
2313
+ }), re = r(() => {
2314
+ let e = f.provider.folders;
2315
+ return e !== !1 && typeof e.create == "function";
2316
+ }), J = r(() => {
2317
+ let e = f.provider.folders;
2318
+ return e !== !1 && typeof e.update == "function";
2319
+ }), Y = r(() => {
2320
+ let e = f.provider.folders;
2321
+ return e !== !1 && typeof e.delete == "function";
2322
+ }), ie = r(() => P.isLoading.value && I.displayItems.value.length === 0), ae = r(() => {
2323
+ let e = P.previewItem.value;
2324
+ return e ? !f.accept?.length || A(e.mimeType ?? "", f.accept) : !1;
2325
+ }), se = r(() => {
2326
+ if (!W.value) return 0;
2327
+ let e = 0;
2328
+ for (let t of P.selectedItems.value) I.displayItems.value.find((e) => e.id === t)?.canDelete !== !1 && (e += 1);
2329
+ return e;
2326
2330
  });
2327
- function L(e) {
2328
- e.key === "Escape" && r("close");
2331
+ O(() => f.visible, (e) => {
2332
+ e ? (f.accept?.length === 1 && (P.categoryFilter.value = f.accept[0]), P.loadItems(), P.loadFrequentlyUsed(), P.loadStorage()) : I.resetUI();
2333
+ }, { immediate: !0 });
2334
+ function X(e) {
2335
+ e.key === "Escape" && p("close");
2329
2336
  }
2330
- ce(document, "keydown", L);
2331
- function z() {
2332
- return N.previewItem.value ? !n.accept?.length || E(N.previewItem.value.mime_type, n.accept) : !1;
2337
+ oe(document, "keydown", X);
2338
+ function ce() {
2339
+ ae.value && P.previewItem.value && (p("select", P.previewItem.value), p("close"));
2333
2340
  }
2334
- function B() {
2335
- if (z()) {
2336
- let e = N.previewItem.value, t = {
2337
- ...e,
2338
- url: P.selectedUrl.value || e.url
2339
- };
2340
- r("select", t), r("close");
2341
- }
2341
+ function le(e) {
2342
+ let t = e.target.value;
2343
+ P.filterByCategory(t || null);
2342
2344
  }
2343
- return (t, n) => (S(), l(a, { to: e.popoverTarget || "body" }, [m(o, {
2345
+ async function he() {
2346
+ let e = /* @__PURE__ */ new Set();
2347
+ for (let t of P.selectedItems.value) I.displayItems.value.find((e) => e.id === t)?.canDelete !== !1 && e.add(t);
2348
+ P.selectedItems.value = e, await I.handleDeleteClick();
2349
+ }
2350
+ return (r, d) => (v(), a(t, { to: i.popoverTarget || "body" }, [u(n, {
2344
2351
  "enter-active-class": "tpl:transition tpl:duration-200",
2345
2352
  "enter-from-class": "tpl:opacity-0",
2346
2353
  "enter-to-class": "tpl:opacity-100",
@@ -2348,45 +2355,48 @@ var fr = ["data-tpl-theme"], pr = {
2348
2355
  "leave-from-class": "tpl:opacity-100",
2349
2356
  "leave-to-class": "tpl:opacity-0"
2350
2357
  }, {
2351
- default: M(() => [e.visible && c.value ? (S(), d("div", {
2358
+ default: k(() => [i.visible && m.value ? (v(), s("div", {
2352
2359
  key: 0,
2353
- "data-tpl-theme": g.value,
2354
- class: "tpl tpl-media-overlay tpl:fixed tpl:inset-0 tpl:z-[9999] tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
2355
- onClick: n[18] ||= F((e) => r("close"), ["self"])
2356
- }, [f("div", pr, [
2357
- f("div", mr, [f("h2", hr, D(h.value.mediaLibrary.title), 1), f("div", gr, [
2358
- m(nr, {
2359
- "used-bytes": v.value,
2360
- "limit-bytes": x.value,
2360
+ "data-testid": "media-library-modal",
2361
+ "data-tpl-theme": S.value,
2362
+ class: "tpl tpl-media-overlay tpl:fixed tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
2363
+ onClick: d[14] ||= M((e) => p("close"), ["self"])
2364
+ }, [c("div", sr, [
2365
+ c("div", cr, [c("h2", lr, C(_.value.mediaLibrary.title), 1), c("div", ur, [
2366
+ E(P).storageInfo.value ? (v(), a(Yn, {
2367
+ key: 0,
2368
+ "used-bytes": E(P).storageInfo.value.usedBytes,
2369
+ "limit-bytes": E(P).storageInfo.value.limitBytes,
2361
2370
  size: 22
2362
- }, null, 8, ["used-bytes", "limit-bytes"]),
2363
- f("div", _r, [f("input", {
2364
- value: k(P).searchInput.value,
2371
+ }, null, 8, ["used-bytes", "limit-bytes"])) : o("", !0),
2372
+ c("div", dr, [c("input", {
2373
+ value: E(I).searchInput.value,
2365
2374
  type: "text",
2366
- class: "tpl:w-52 tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-3 tpl:pl-8 tpl:text-xs tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:outline-none tpl:focus:shadow-[var(--tpl-ring)]",
2375
+ disabled: ie.value,
2376
+ class: "tpl:w-52 tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-3 tpl:pl-8 tpl:text-xs tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:outline-none tpl:focus:shadow-[var(--tpl-ring)] tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
2367
2377
  style: {
2368
2378
  "border-color": "var(--tpl-border)",
2369
2379
  "background-color": "var(--tpl-bg)",
2370
2380
  color: "var(--tpl-text)"
2371
2381
  },
2372
- placeholder: h.value.mediaLibrary.searchPlaceholder,
2373
- onInput: n[0] ||= (e) => k(P).handleSearchInput(e.target.value)
2374
- }, null, 40, vr), m(k(Y), {
2382
+ placeholder: _.value.mediaLibrary.searchPlaceholder,
2383
+ onInput: d[0] ||= (e) => E(I).handleSearchInput(e.target.value)
2384
+ }, null, 40, fr), u(E(ee), {
2375
2385
  class: "tpl:absolute tpl:top-1/2 tpl:left-2.5 tpl:-translate-y-1/2",
2376
2386
  size: 13,
2377
2387
  "stroke-width": 2,
2378
2388
  style: { color: "var(--tpl-text-dim)" }
2379
2389
  })]),
2380
- f("button", {
2390
+ c("button", {
2381
2391
  class: "tpl:flex tpl:size-7 tpl:items-center tpl:justify-center tpl:rounded-md tpl:transition-all tpl:duration-150",
2382
2392
  style: { color: "var(--tpl-text-muted)" },
2383
- onClick: n[1] ||= (e) => r("close")
2384
- }, [m(k(ne), {
2393
+ onClick: d[1] ||= (e) => p("close")
2394
+ }, [u(E(ne), {
2385
2395
  size: 18,
2386
2396
  "stroke-width": 2
2387
2397
  })])
2388
2398
  ])]),
2389
- f("div", yr, [m(o, {
2399
+ c("div", pr, [u(n, {
2390
2400
  "enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
2391
2401
  "enter-from-class": "tpl:-ml-48 tpl:opacity-0",
2392
2402
  "enter-to-class": "tpl:ml-0 tpl:opacity-100",
@@ -2394,76 +2404,84 @@ var fr = ["data-tpl-theme"], pr = {
2394
2404
  "leave-from-class": "tpl:ml-0 tpl:opacity-100",
2395
2405
  "leave-to-class": "tpl:-ml-48 tpl:opacity-0"
2396
2406
  }, {
2397
- default: M(() => [k(P).showSidebar.value ? (S(), d("div", br, [m(wt, {
2398
- folders: k(N).folders.value,
2399
- "current-folder-id": k(N).currentFolderId.value,
2400
- "view-mode": k(N).viewMode.value,
2401
- "has-frequently-used": k(P).hasFrequentlyUsed.value,
2402
- onNavigate: k(N).navigateToFolder,
2403
- onCreateFolder: k(P).handleCreateFolder,
2404
- onRenameFolder: k(P).handleRenameFolder,
2405
- onDeleteFolder: k(P).handleDeleteFolder,
2406
- onShowFrequentlyUsed: k(N).showFrequentlyUsed
2407
+ default: k(() => [V.value && E(I).showSidebar.value ? (v(), s("div", mr, [u(bt, {
2408
+ folders: E(I).folderTree.value,
2409
+ "current-folder-id": E(P).currentFolderId.value,
2410
+ "view-mode": E(P).viewMode.value,
2411
+ "has-frequently-used": te.value && E(I).hasFrequentlyUsed.value,
2412
+ "can-create-folder": re.value,
2413
+ "can-rename-folder": J.value,
2414
+ "can-delete-folder": Y.value,
2415
+ onNavigate: E(P).navigateToFolder,
2416
+ onCreateFolder: E(I).handleCreateFolder,
2417
+ onRenameFolder: E(I).handleRenameFolder,
2418
+ onDeleteFolder: E(I).handleDeleteFolder,
2419
+ onShowFrequentlyUsed: E(P).showFrequentlyUsed
2407
2420
  }, null, 8, [
2408
2421
  "folders",
2409
2422
  "current-folder-id",
2410
2423
  "view-mode",
2411
2424
  "has-frequently-used",
2425
+ "can-create-folder",
2426
+ "can-rename-folder",
2427
+ "can-delete-folder",
2412
2428
  "onNavigate",
2413
2429
  "onCreateFolder",
2414
2430
  "onRenameFolder",
2415
2431
  "onDeleteFolder",
2416
2432
  "onShowFrequentlyUsed"
2417
- ])])) : u("", !0)]),
2433
+ ])])) : o("", !0)]),
2418
2434
  _: 1
2419
- }), f("div", xr, [f("div", Sr, [f("div", Cr, [
2420
- f("button", {
2435
+ }), c("div", hr, [c("div", gr, [c("div", _r, [
2436
+ V.value ? (v(), s("button", {
2437
+ key: 0,
2438
+ "data-testid": "media-folder-toggle",
2421
2439
  class: "tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:transition-all tpl:duration-150",
2422
- style: b({
2423
- color: k(P).showSidebar.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2424
- backgroundColor: k(P).showSidebar.value ? "var(--tpl-bg)" : "transparent",
2425
- border: k(P).showSidebar.value ? "1px solid var(--tpl-border)" : "1px solid transparent"
2440
+ style: g({
2441
+ color: E(I).showSidebar.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2442
+ backgroundColor: E(I).showSidebar.value ? "var(--tpl-bg)" : "transparent",
2443
+ border: E(I).showSidebar.value ? "1px solid var(--tpl-border)" : "1px solid transparent"
2426
2444
  }),
2427
- title: k(P).showSidebar.value ? h.value.mediaLibrary.hideFolders : h.value.mediaLibrary.showFolders,
2428
- onClick: n[2] ||= (e) => k(P).showSidebar.value = !k(P).showSidebar.value
2429
- }, [m(k(G), {
2445
+ title: E(I).showSidebar.value ? _.value.mediaLibrary.hideFolders : _.value.mediaLibrary.showFolders,
2446
+ onClick: d[2] ||= (e) => E(I).showSidebar.value = !E(I).showSidebar.value
2447
+ }, [u(E(H), {
2430
2448
  size: 16,
2431
2449
  "stroke-width": 2
2432
- })], 12, wr),
2433
- k(N).viewMode.value === "frequently-used" ? (S(), d("span", Tr, D(h.value.mediaLibrary.frequentlyUsed), 1)) : (S(), l(Te, {
2434
- key: 1,
2435
- folders: k(N).folders.value,
2436
- "current-folder-id": k(N).currentFolderId.value,
2437
- onNavigate: k(N).navigateToFolder
2450
+ })], 12, vr)) : o("", !0),
2451
+ E(P).viewMode.value === "frequently-used" ? (v(), s("span", yr, C(_.value.mediaLibrary.frequentlyUsed), 1)) : (v(), a(be, {
2452
+ key: 2,
2453
+ folders: E(I).folderTree.value,
2454
+ "current-folder-id": E(P).currentFolderId.value,
2455
+ onNavigate: E(P).navigateToFolder
2438
2456
  }, null, 8, [
2439
2457
  "folders",
2440
2458
  "current-folder-id",
2441
2459
  "onNavigate"
2442
2460
  ])),
2443
- f("div", Er, [f("button", {
2461
+ c("div", br, [c("button", {
2444
2462
  class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
2445
- style: b({
2446
- color: k(P).layoutMode.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2447
- backgroundColor: k(P).layoutMode.value === "grid" ? "var(--tpl-bg-elevated)" : "transparent"
2463
+ style: g({
2464
+ color: E(I).layoutMode.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2465
+ backgroundColor: E(I).layoutMode.value === "grid" ? "var(--tpl-bg-elevated)" : "transparent"
2448
2466
  }),
2449
- title: h.value.mediaLibrary.viewGrid,
2450
- onClick: n[3] ||= (e) => k(P).layoutMode.value = "grid"
2451
- }, [m(k(V), {
2467
+ title: _.value.mediaLibrary.viewGrid,
2468
+ onClick: d[3] ||= (e) => E(I).layoutMode.value = "grid"
2469
+ }, [u(E(R), {
2452
2470
  size: 14,
2453
2471
  "stroke-width": 2
2454
- })], 12, Dr), f("button", {
2472
+ })], 12, xr), c("button", {
2455
2473
  class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
2456
- style: b({
2457
- color: k(P).layoutMode.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2458
- backgroundColor: k(P).layoutMode.value === "list" ? "var(--tpl-bg-elevated)" : "transparent"
2474
+ style: g({
2475
+ color: E(I).layoutMode.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2476
+ backgroundColor: E(I).layoutMode.value === "list" ? "var(--tpl-bg-elevated)" : "transparent"
2459
2477
  }),
2460
- title: h.value.mediaLibrary.viewList,
2461
- onClick: n[4] ||= (e) => k(P).layoutMode.value = "list"
2462
- }, [m(k(U), {
2478
+ title: _.value.mediaLibrary.viewList,
2479
+ onClick: d[4] ||= (e) => E(I).layoutMode.value = "list"
2480
+ }, [u(E(B), {
2463
2481
  size: 14,
2464
2482
  "stroke-width": 2
2465
- })], 12, Or)])
2466
- ]), f("div", kr, [k(A).length > 1 ? (S(), d("select", {
2483
+ })], 12, Sr)])
2484
+ ]), c("div", Cr, [E(j).length > 1 ? (v(), s("select", {
2467
2485
  key: 0,
2468
2486
  class: "tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-7 tpl:pl-2.5 tpl:text-xs tpl:transition-all tpl:duration-150 tpl:outline-none",
2469
2487
  style: {
@@ -2471,58 +2489,49 @@ var fr = ["data-tpl-theme"], pr = {
2471
2489
  "background-color": "var(--tpl-bg)",
2472
2490
  color: "var(--tpl-text)"
2473
2491
  },
2474
- value: k(N).categoryFilter.value ?? "",
2475
- onChange: n[5] ||= (e) => k(N).filterByCategory(e.target.value || null)
2476
- }, [f("option", jr, D(h.value.mediaLibrary.filterAll), 1), (S(!0), d(i, null, T(k(A), (e) => (S(), d("option", {
2492
+ value: E(P).categoryFilter.value ?? "",
2493
+ onChange: le
2494
+ }, [c("option", Tr, C(_.value.mediaLibrary.filterAll), 1), (v(!0), s(e, null, x(E(j), (e) => (v(), s("option", {
2477
2495
  key: e,
2478
2496
  value: e
2479
- }, D(k(P).getCategoryLabel(e)), 9, Mr))), 128))], 40, Ar)) : u("", !0), f("select", {
2480
- class: "tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-7 tpl:pl-2.5 tpl:text-xs tpl:transition-all tpl:duration-150 tpl:outline-none",
2481
- style: {
2482
- "border-color": "var(--tpl-border)",
2483
- "background-color": "var(--tpl-bg)",
2484
- color: "var(--tpl-text)"
2485
- },
2486
- value: k(N).sortOption.value,
2487
- onChange: n[6] ||= (e) => k(N).sortBy(e.target.value)
2488
- }, [
2489
- f("option", Pr, D(h.value.mediaLibrary.sortNewest), 1),
2490
- f("option", Fr, D(h.value.mediaLibrary.sortOldest), 1),
2491
- f("option", Ir, D(h.value.mediaLibrary.sortNameAsc), 1),
2492
- f("option", Lr, D(h.value.mediaLibrary.sortNameDesc), 1),
2493
- f("option", Rr, D(h.value.mediaLibrary.sortSizeAsc), 1),
2494
- f("option", zr, D(h.value.mediaLibrary.sortSizeDesc), 1)
2495
- ], 40, Nr)])]), f("div", Br, [k(N).viewMode.value === "files" ? (S(), d("div", Vr, [m(Zn, {
2496
- "is-uploading": k(N).isUploading.value,
2497
- "upload-progress": k(N).uploadProgress.value,
2498
- onUpload: k(P).handleUpload
2497
+ }, C(E(I).getCategoryLabel(e)), 9, Er))), 128))], 40, wr)) : o("", !0)])]), c("div", Dr, [E(P).viewMode.value === "files" && (L.value || U.value) ? (v(), s("div", Or, [L.value ? (v(), a(Wn, {
2498
+ key: 0,
2499
+ "is-uploading": E(P).isUploading.value,
2500
+ "upload-progress": E(P).uploadProgress.value,
2501
+ onUpload: E(I).handleUpload
2499
2502
  }, null, 8, [
2500
2503
  "is-uploading",
2501
2504
  "upload-progress",
2502
2505
  "onUpload"
2503
- ]), f("button", {
2506
+ ])) : o("", !0), U.value ? (v(), s("button", {
2507
+ key: 1,
2508
+ "data-testid": "media-import-url",
2504
2509
  class: "tpl:mt-2 tpl:flex tpl:w-full tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded-md tpl:border tpl:border-dashed tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2505
2510
  style: {
2506
2511
  "border-color": "var(--tpl-border)",
2507
2512
  color: "var(--tpl-text-muted)",
2508
2513
  "background-color": "var(--tpl-bg)"
2509
2514
  },
2510
- onClick: n[7] ||= (e) => k(P).showImportUrlModal.value = !0
2511
- }, [m(k(H), {
2515
+ onClick: d[5] ||= (e) => E(I).showImportUrlModal.value = !0
2516
+ }, [u(E(z), {
2512
2517
  size: 14,
2513
2518
  "stroke-width": 2
2514
- }), p(" " + D(h.value.mediaLibrary.importFromUrl), 1)])])) : u("", !0), m(nn, {
2515
- items: k(P).displayItems.value,
2516
- "selected-ids": k(N).selectedItems.value,
2517
- "is-loading": k(N).isLoading.value,
2518
- "has-more": k(N).viewMode.value === "files" && k(N).hasMore.value,
2519
- accept: e.accept,
2520
- layout: k(P).layoutMode.value,
2521
- onSelect: k(P).handleSelect,
2522
- onToggle: k(N).toggleSelection,
2523
- onLoadMore: k(N).loadMore,
2524
- onEdit: k(P).handleEditItem,
2525
- onReplace: k(P).handleReplaceItem
2519
+ }), l(" " + C(_.value.mediaLibrary.importFromUrl), 1)])) : o("", !0)])) : o("", !0), u($t, {
2520
+ items: E(I).displayItems.value,
2521
+ "selected-ids": E(P).selectedItems.value,
2522
+ "is-loading": E(P).isLoading.value,
2523
+ "has-more": E(P).viewMode.value === "files" && E(P).hasMore.value,
2524
+ accept: i.accept,
2525
+ layout: E(I).layoutMode.value,
2526
+ "search-query": E(P).searchQuery.value,
2527
+ "can-update": G.value,
2528
+ "can-replace": K.value,
2529
+ onSelect: E(I).handleSelect,
2530
+ onToggle: E(P).toggleSelection,
2531
+ onLoadMore: E(P).loadMore,
2532
+ onEdit: E(I).handleEditItem,
2533
+ onReplace: E(I).handleReplaceItem,
2534
+ onConfirm: ce
2526
2535
  }, null, 8, [
2527
2536
  "items",
2528
2537
  "selected-ids",
@@ -2530,42 +2539,45 @@ var fr = ["data-tpl-theme"], pr = {
2530
2539
  "has-more",
2531
2540
  "accept",
2532
2541
  "layout",
2542
+ "search-query",
2543
+ "can-update",
2544
+ "can-replace",
2533
2545
  "onSelect",
2534
2546
  "onToggle",
2535
2547
  "onLoadMore",
2536
2548
  "onEdit",
2537
2549
  "onReplace"
2538
2550
  ])])])]),
2539
- m(hn, {
2540
- visible: k(P).showImportUrlModal.value,
2541
- "is-importing": k(N).isImportingFromUrl.value,
2542
- error: k(N).importFromUrlError.value,
2543
- onImport: k(P).handleImportFromUrl,
2544
- onClose: n[8] ||= (e) => k(P).showImportUrlModal.value = !1
2551
+ u(fn, {
2552
+ visible: E(I).showImportUrlModal.value,
2553
+ "is-importing": E(P).isImportingFromUrl.value,
2554
+ error: E(P).importFromUrlError.value,
2555
+ onImport: E(I).handleImportFromUrl,
2556
+ onClose: d[6] ||= (e) => E(I).showImportUrlModal.value = !1
2545
2557
  }, null, 8, [
2546
2558
  "visible",
2547
2559
  "is-importing",
2548
2560
  "error",
2549
2561
  "onImport"
2550
2562
  ]),
2551
- m(ft, {
2552
- visible: !!k(P).editingItem.value,
2553
- item: k(P).editingItem.value,
2554
- onSave: k(P).handleEditSave,
2555
- onClose: n[9] ||= (e) => k(P).editingItem.value = null
2563
+ u(ct, {
2564
+ visible: !!E(I).editingItem.value,
2565
+ item: E(I).editingItem.value,
2566
+ onSave: E(I).handleEditSave,
2567
+ onClose: d[7] ||= (e) => E(I).editingItem.value = null
2556
2568
  }, null, 8, [
2557
2569
  "visible",
2558
2570
  "item",
2559
2571
  "onSave"
2560
2572
  ]),
2561
- m(Kn, {
2562
- visible: k(N).showReplaceWarning.value,
2563
- item: k(N).pendingReplaceItem.value,
2564
- "usage-info": k(N).replaceUsageInfo.value,
2565
- "is-replacing": k(N).isReplacing.value,
2566
- error: k(N).replaceError.value,
2567
- onReplace: k(P).handleReplaceFile,
2568
- onClose: k(N).cancelReplace
2573
+ u(zn, {
2574
+ visible: E(P).showReplaceWarning.value,
2575
+ item: E(P).pendingReplaceItem.value,
2576
+ "usage-info": E(P).replaceUsageInfo.value,
2577
+ "is-replacing": E(P).isReplacing.value,
2578
+ error: E(P).replaceError.value,
2579
+ onReplace: E(I).handleReplaceFile,
2580
+ onClose: E(P).cancelReplace
2569
2581
  }, null, 8, [
2570
2582
  "visible",
2571
2583
  "item",
@@ -2575,7 +2587,7 @@ var fr = ["data-tpl-theme"], pr = {
2575
2587
  "onReplace",
2576
2588
  "onClose"
2577
2589
  ]),
2578
- m(o, {
2590
+ u(n, {
2579
2591
  "enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
2580
2592
  "enter-from-class": "tpl:opacity-0",
2581
2593
  "enter-to-class": "tpl:opacity-100",
@@ -2583,7 +2595,7 @@ var fr = ["data-tpl-theme"], pr = {
2583
2595
  "leave-from-class": "tpl:opacity-100",
2584
2596
  "leave-to-class": "tpl:opacity-0"
2585
2597
  }, {
2586
- default: M(() => [k(N).showDeleteWarning.value ? (S(), d("div", {
2598
+ default: k(() => [E(P).showDeleteWarning.value ? (v(), s("div", {
2587
2599
  key: 0,
2588
2600
  class: "tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-lg)]",
2589
2601
  style: {
@@ -2591,112 +2603,108 @@ var fr = ["data-tpl-theme"], pr = {
2591
2603
  "backdrop-filter": "blur(8px)",
2592
2604
  "-webkit-backdrop-filter": "blur(8px)"
2593
2605
  },
2594
- onClick: n[12] ||= F((...e) => k(N).cancelDelete && k(N).cancelDelete(...e), ["self"])
2595
- }, [f("div", Hr, [
2596
- f("h3", Ur, D(h.value.mediaLibrary.deleteWarningTitle), 1),
2597
- f("p", {
2598
- class: y(["tpl:text-xs", k(P).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
2606
+ onClick: d[10] ||= M((...e) => E(P).cancelDelete && E(P).cancelDelete(...e), ["self"])
2607
+ }, [c("div", kr, [
2608
+ c("h3", Ar, C(_.value.mediaLibrary.deleteWarningTitle), 1),
2609
+ c("p", {
2610
+ class: h(["tpl:text-xs", E(I).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
2599
2611
  style: { color: "var(--tpl-text-muted)" }
2600
- }, D(h.value.mediaLibrary.deleteWarningMessage), 3),
2601
- k(P).hasUsedFiles.value ? (S(), d("p", Wr, D(h.value.mediaLibrary.deleteWarningUsageNote), 1)) : u("", !0),
2602
- k(P).hasUsedFiles.value ? (S(), d("div", Gr, [(S(!0), d(i, null, T(k(N).deleteUsageInfo.value, (e, t) => (S(), d("div", {
2603
- key: t,
2612
+ }, C(_.value.mediaLibrary.deleteWarningMessage), 3),
2613
+ E(I).hasUsedFiles.value ? (v(), s("p", jr, C(_.value.mediaLibrary.deleteWarningUsageNote), 1)) : o("", !0),
2614
+ E(I).hasUsedFiles.value ? (v(), s("div", Mr, [(v(!0), s(e, null, x(E(P).deleteUsageInfo.value, (t, n) => (v(), s("div", {
2615
+ key: n,
2604
2616
  class: "tpl:text-xs",
2605
2617
  style: { color: "var(--tpl-text)" }
2606
- }, [e.template_count > 0 ? (S(), d(i, { key: 0 }, [f("span", Kr, D(k(P).displayItems.value.find((e) => e.id === t)?.filename || t), 1), f("span", qr, " - " + D(h.value.mediaLibrary.usedInTemplates.replace("{count}", e.template_count.toString())), 1)], 64)) : u("", !0)]))), 128))])) : u("", !0),
2607
- f("div", Jr, [f("button", {
2618
+ }, [t.templateCount > 0 ? (v(), s(e, { key: 0 }, [c("span", Nr, C(E(I).displayItems.value.find((e) => e.id === n)?.filename || n), 1), c("span", Pr, " - " + C(_.value.mediaLibrary.usedInTemplates.replace("{count}", t.templateCount.toString())), 1)], 64)) : o("", !0)]))), 128))])) : o("", !0),
2619
+ c("div", Fr, [c("button", {
2608
2620
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2609
2621
  style: {
2610
2622
  "border-color": "var(--tpl-border)",
2611
2623
  color: "var(--tpl-text)",
2612
2624
  "background-color": "var(--tpl-bg)"
2613
2625
  },
2614
- onClick: n[10] ||= (...e) => k(N).cancelDelete && k(N).cancelDelete(...e)
2615
- }, D(h.value.mediaLibrary.cancel), 1), f("button", {
2626
+ onClick: d[8] ||= (...e) => E(P).cancelDelete && E(P).cancelDelete(...e)
2627
+ }, C(_.value.mediaLibrary.cancel), 1), c("button", {
2616
2628
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2617
2629
  style: {
2618
2630
  "border-color": "var(--tpl-danger)",
2619
2631
  color: "var(--tpl-danger)",
2620
2632
  "background-color": "var(--tpl-danger-light)"
2621
2633
  },
2622
- onClick: n[11] ||= (...e) => k(N).confirmDelete && k(N).confirmDelete(...e)
2623
- }, D(k(P).hasUsedFiles.value ? h.value.mediaLibrary.deleteAnyway : h.value.mediaLibrary.confirmDelete), 1)])
2624
- ])])) : u("", !0)]),
2634
+ onClick: d[9] ||= (...e) => E(P).confirmDelete && E(P).confirmDelete(...e)
2635
+ }, C(E(I).hasUsedFiles.value ? _.value.mediaLibrary.deleteAnyway : _.value.mediaLibrary.confirmDelete), 1)])
2636
+ ])])) : o("", !0)]),
2625
2637
  _: 1
2626
2638
  }),
2627
- f("div", Yr, [f("div", Xr, [k(N).previewItem.value ? (S(), l(jn, {
2639
+ c("div", Ir, [c("div", Lr, [E(P).previewItem.value ? (v(), a(wn, {
2628
2640
  key: 0,
2629
- "selected-conversion": k(P).selectedConversion.value,
2630
- "onUpdate:selectedConversion": n[13] ||= (e) => k(P).selectedConversion.value = e,
2631
- item: k(N).previewItem.value,
2632
- folders: k(N).folders.value
2633
- }, null, 8, [
2634
- "selected-conversion",
2635
- "item",
2636
- "folders"
2637
- ])) : u("", !0)]), f("div", Zr, [k(N).selectedItems.value.size > 0 ? (S(), d("div", Qr, [k(N).previewItem.value ? (S(), d("button", {
2641
+ item: E(P).previewItem.value,
2642
+ folders: E(I).folderTree.value
2643
+ }, null, 8, ["item", "folders"])) : o("", !0)]), c("div", Rr, [E(P).selectedItems.value.size > 0 ? (v(), s("div", zr, [E(P).previewItem.value ? (v(), s("button", {
2638
2644
  key: 0,
2639
2645
  class: "tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-1 tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2640
- style: b({
2641
- borderColor: k(P).copied.value ? "var(--tpl-success)" : "var(--tpl-border)",
2642
- color: k(P).copied.value ? "var(--tpl-success)" : "var(--tpl-text)",
2646
+ style: g({
2647
+ borderColor: E(I).copied.value ? "var(--tpl-success)" : "var(--tpl-border)",
2648
+ color: E(I).copied.value ? "var(--tpl-success)" : "var(--tpl-text)",
2643
2649
  backgroundColor: "var(--tpl-bg)"
2644
2650
  }),
2645
- onClick: n[14] ||= (e) => k(P).copy(k(P).selectedUrl.value)
2646
- }, [k(P).copied.value ? (S(), l(k(I), {
2651
+ onClick: d[11] ||= (e) => E(I).copy(E(I).selectedUrl.value)
2652
+ }, [E(I).copied.value ? (v(), a(E(N), {
2647
2653
  key: 1,
2648
2654
  size: 12,
2649
2655
  "stroke-width": 2
2650
- })) : (S(), l(k(R), {
2656
+ })) : (v(), a(E(F), {
2651
2657
  key: 0,
2652
2658
  size: 12,
2653
2659
  "stroke-width": 2
2654
- })), p(" " + D(k(P).copied.value ? h.value.mediaLibrary.copied : h.value.mediaLibrary.copyUrl), 1)], 4)) : u("", !0), f("div", $r, [f("button", {
2660
+ })), l(" " + C(E(I).copied.value ? _.value.mediaLibrary.copied : _.value.mediaLibrary.copyUrl), 1)], 4)) : o("", !0), q.value ? (v(), s("div", Br, [c("button", {
2655
2661
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2656
2662
  style: {
2657
2663
  "border-color": "var(--tpl-border)",
2658
2664
  color: "var(--tpl-text)",
2659
2665
  "background-color": "var(--tpl-bg)"
2660
2666
  },
2661
- onClick: n[15] ||= (e) => k(P).showMovePicker.value = !k(P).showMovePicker.value
2662
- }, D(h.value.mediaLibrary.moveSelected), 1), k(P).showMovePicker.value ? (S(), l(bn, {
2667
+ onClick: d[12] ||= (e) => E(I).showMovePicker.value = !E(I).showMovePicker.value
2668
+ }, C(_.value.mediaLibrary.moveSelected), 1), E(I).showMovePicker.value ? (v(), a(_n, {
2663
2669
  key: 0,
2664
- folders: k(N).folders.value,
2665
- "current-folder-id": k(N).currentFolderId.value,
2666
- onSelect: k(P).handleMoveToFolder,
2667
- onClose: n[16] ||= (e) => k(P).showMovePicker.value = !1
2670
+ folders: E(I).folderTree.value,
2671
+ "current-folder-id": E(P).currentFolderId.value,
2672
+ onSelect: E(I).handleMoveToFolder,
2673
+ onClose: d[13] ||= (e) => E(I).showMovePicker.value = !1
2668
2674
  }, null, 8, [
2669
2675
  "folders",
2670
2676
  "current-folder-id",
2671
2677
  "onSelect"
2672
- ])) : u("", !0)])])) : u("", !0), f("div", ei, [k(N).selectedItems.value.size > 0 ? (S(), d("button", {
2678
+ ])) : o("", !0)])) : o("", !0)])) : o("", !0), c("div", Vr, [se.value > 0 ? (v(), s("button", {
2673
2679
  key: 0,
2680
+ "data-testid": "media-delete",
2674
2681
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2675
2682
  style: {
2676
2683
  "border-color": "var(--tpl-danger)",
2677
2684
  color: "var(--tpl-danger)",
2678
2685
  "background-color": "var(--tpl-danger-light)"
2679
2686
  },
2680
- onClick: n[17] ||= (...e) => k(P).handleDeleteClick && k(P).handleDeleteClick(...e)
2681
- }, D(h.value.mediaLibrary.deleteSelected), 1)) : u("", !0), f("button", {
2687
+ onClick: he
2688
+ }, C(_.value.mediaLibrary.deleteSelected), 1)) : o("", !0), c("button", {
2689
+ "data-testid": "media-confirm",
2682
2690
  class: "tpl:cursor-pointer tpl:rounded-md tpl:px-4 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
2683
2691
  style: {
2684
2692
  "background-color": "var(--tpl-primary)",
2685
2693
  color: "var(--tpl-bg)"
2686
2694
  },
2687
- disabled: !z(),
2688
- onClick: B
2689
- }, D(e.accept?.length ? h.value.mediaLibrary.selectImage : h.value.mediaLibrary.selectFile), 9, ti)])])])
2690
- ])], 8, fr)) : u("", !0)]),
2695
+ disabled: !ae.value,
2696
+ onClick: ce
2697
+ }, C(i.accept?.length ? _.value.mediaLibrary.selectImage : _.value.mediaLibrary.selectFile), 9, Hr)])])])
2698
+ ])], 8, or)) : o("", !0)]),
2691
2699
  _: 1
2692
2700
  })], 8, ["to"]));
2693
2701
  }
2694
2702
  });
2695
2703
  //#endregion
2696
2704
  //#region src/composables/useMediaPicker.ts
2697
- function ri() {
2698
- let e = _("onRequestMedia"), t = w(!1), n = s(() => !!e);
2699
- async function r(n) {
2705
+ function Wr() {
2706
+ let e = p("onRequestMedia"), t = b(!1), n = r(() => !!e);
2707
+ async function i(n) {
2700
2708
  if (!e) return null;
2701
2709
  t.value = !0;
2702
2710
  try {
@@ -2708,12 +2716,12 @@ function ri() {
2708
2716
  return {
2709
2717
  isPluggableMediaEnabled: n,
2710
2718
  isRequesting: t,
2711
- requestMedia: r
2719
+ requestMedia: i
2712
2720
  };
2713
2721
  }
2714
2722
  //#endregion
2715
2723
  //#region src/standalone/MediaLibrary.vue?vue&type=script&setup=true&lang.ts
2716
- var ii = {
2724
+ var Gr = {
2717
2725
  class: "tpl tpl:flex tpl:flex-col tpl:overflow-hidden tpl:rounded-[var(--tpl-radius-lg)]",
2718
2726
  style: {
2719
2727
  width: "100%",
@@ -2721,121 +2729,154 @@ var ii = {
2721
2729
  "background-color": "var(--tpl-bg-elevated)",
2722
2730
  border: "1px solid var(--tpl-border)"
2723
2731
  }
2724
- }, ai = {
2732
+ }, Kr = {
2725
2733
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-3.5",
2726
2734
  style: { "border-color": "var(--tpl-border)" }
2727
- }, oi = {
2735
+ }, qr = {
2728
2736
  class: "tpl:text-sm tpl:font-semibold",
2729
2737
  style: { color: "var(--tpl-text)" }
2730
- }, si = { class: "tpl:flex tpl:items-center tpl:gap-3" }, ci = { class: "tpl:relative" }, li = ["value", "placeholder"], ui = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, di = {
2738
+ }, Jr = { class: "tpl:flex tpl:items-center tpl:gap-3" }, Yr = { class: "tpl:relative" }, Xr = [
2739
+ "value",
2740
+ "disabled",
2741
+ "placeholder"
2742
+ ], Zr = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, Qr = {
2731
2743
  key: 0,
2732
2744
  class: "tpl:flex tpl:w-48 tpl:shrink-0 tpl:flex-col tpl:border-r",
2733
2745
  style: {
2734
2746
  "border-color": "var(--tpl-border)",
2735
2747
  "background-color": "var(--tpl-bg)"
2736
2748
  }
2737
- }, fi = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, pi = {
2749
+ }, $r = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, ei = {
2738
2750
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-4 tpl:py-2.5",
2739
2751
  style: { "border-color": "var(--tpl-border)" }
2740
- }, mi = { class: "tpl:flex tpl:items-center tpl:gap-2" }, hi = ["title"], gi = {
2741
- key: 0,
2752
+ }, ti = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ni = ["title"], ri = {
2753
+ key: 1,
2742
2754
  class: "tpl:text-xs tpl:font-medium",
2743
2755
  style: { color: "var(--tpl-text)" }
2744
- }, _i = {
2756
+ }, ii = {
2745
2757
  class: "tpl:flex tpl:rounded-md tpl:p-0.5",
2746
2758
  style: {
2747
2759
  border: "1px solid var(--tpl-border)",
2748
2760
  "background-color": "var(--tpl-bg)"
2749
2761
  }
2750
- }, vi = ["title"], yi = ["title"], bi = { class: "tpl:flex tpl:items-center tpl:gap-2" }, xi = ["value"], Si = { value: "" }, Ci = ["value"], wi = ["value"], Ti = { value: "newest" }, Ei = { value: "oldest" }, Di = { value: "name_asc" }, Oi = { value: "name_desc" }, ki = { value: "size_asc" }, Ai = { value: "size_desc" }, ji = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, Mi = {
2762
+ }, ai = ["title"], oi = ["title"], si = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ci = ["value"], li = { value: "" }, ui = ["value"], di = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, fi = {
2751
2763
  key: 0,
2752
2764
  class: "tpl:px-4 tpl:pt-3"
2753
- }, Ni = {
2765
+ }, pi = {
2754
2766
  class: "tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5",
2755
2767
  style: {
2756
2768
  "background-color": "var(--tpl-bg-elevated)",
2757
2769
  "box-shadow": "var(--tpl-shadow-xl)"
2758
2770
  }
2759
- }, Pi = {
2771
+ }, mi = {
2760
2772
  class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
2761
2773
  style: { color: "var(--tpl-text)" }
2762
- }, Fi = {
2774
+ }, hi = {
2763
2775
  key: 0,
2776
+ "data-testid": "media-delete-usage",
2764
2777
  class: "tpl:mb-4 tpl:text-xs",
2765
2778
  style: { color: "var(--tpl-text-muted)" }
2766
- }, Ii = {
2779
+ }, gi = {
2767
2780
  key: 1,
2768
2781
  class: "tpl:mb-4 tpl:max-h-32 tpl:overflow-y-auto tpl:rounded tpl:border tpl:p-2",
2769
2782
  style: { "border-color": "var(--tpl-border)" }
2770
- }, Li = { class: "tpl:font-medium" }, Ri = { style: { color: "var(--tpl-text-muted)" } }, zi = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Bi = {
2783
+ }, _i = { class: "tpl:font-medium" }, vi = { style: { color: "var(--tpl-text-muted)" } }, yi = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, bi = {
2771
2784
  class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3",
2772
2785
  style: { "border-color": "var(--tpl-border)" }
2773
- }, Vi = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, Hi = { class: "tpl:flex tpl:items-center tpl:gap-5" }, Ui = {
2786
+ }, xi = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, Si = { class: "tpl:flex tpl:items-center tpl:gap-5" }, Ci = {
2774
2787
  key: 0,
2775
2788
  class: "tpl:flex tpl:items-center tpl:gap-2"
2776
- }, Wi = { class: "tpl:relative" }, Gi = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Ki = ["disabled"], qi = /* @__PURE__ */ h({
2789
+ }, wi = {
2790
+ key: 1,
2791
+ class: "tpl:relative"
2792
+ }, Ti = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Ei = ["disabled"], Di = /* @__PURE__ */ d({
2777
2793
  __name: "MediaLibrary",
2778
2794
  props: {
2779
- authManager: {},
2780
- projectId: {},
2781
- planConfig: {},
2795
+ provider: {},
2782
2796
  translations: {},
2783
2797
  onSelect: { type: Function },
2784
- onError: { type: Function }
2798
+ accept: {},
2799
+ locale: {}
2785
2800
  },
2786
2801
  emits: ["ready"],
2787
- setup(e, { emit: t }) {
2788
- let n = e, r = t, a = s(() => n.translations);
2789
- C(_e, w(n.translations));
2790
- let c = {
2791
- config: w(n.planConfig),
2792
- isLoading: w(!1),
2793
- hasFeature: (e) => n.planConfig.features[e] ?? !1,
2794
- features: s(() => n.planConfig.features),
2795
- fetchConfig: async () => {}
2802
+ setup(t, { emit: i }) {
2803
+ let d = t, f = i, p = r(() => d.translations);
2804
+ y(pe, b(d.translations)), y(me, w(() => d.locale));
2805
+ let m = {
2806
+ get maxFileSize() {
2807
+ return d.provider.maxFileSize;
2808
+ },
2809
+ get mimeTypes() {
2810
+ return d.provider.mimeTypes;
2811
+ },
2812
+ get accept() {
2813
+ return d.accept;
2814
+ }
2796
2815
  };
2797
- C(he, c);
2798
- let h = s(() => n.planConfig.storage.used_bytes ?? 0), g = s(() => n.planConfig.storage.limit_bytes ?? 0), { availableCategories: _ } = Q(c), v = me({
2799
- projectId: n.projectId,
2800
- authManager: n.authManager,
2801
- onError: n.onError
2802
- }), E = rr({
2803
- library: v,
2804
- translations: a
2816
+ y(de, m);
2817
+ let { isAcceptedMimeType: S, availableCategories: T } = $(m), D = ue({ provider: d.provider }), O = Zn({
2818
+ library: D,
2819
+ translations: p
2820
+ }), A = r(() => typeof d.provider.create == "function"), j = r(() => d.provider.folders !== !1), P = r(() => typeof d.provider.importFromUrl == "function"), I = r(() => typeof d.provider.delete == "function"), L = r(() => typeof d.provider.update == "function"), V = r(() => typeof d.provider.replace == "function"), U = r(() => typeof d.provider.frequentlyUsed == "function"), W = r(() => {
2821
+ let e = d.provider.folders;
2822
+ return e !== !1 && typeof e.move == "function";
2823
+ }), G = r(() => {
2824
+ let e = d.provider.folders;
2825
+ return e !== !1 && typeof e.create == "function";
2826
+ }), K = r(() => {
2827
+ let e = d.provider.folders;
2828
+ return e !== !1 && typeof e.update == "function";
2829
+ }), te = r(() => {
2830
+ let e = d.provider.folders;
2831
+ return e !== !1 && typeof e.delete == "function";
2832
+ }), q = r(() => D.isLoading.value && O.displayItems.value.length === 0), ne = r(() => {
2833
+ let e = D.previewItem.value;
2834
+ return e ? !d.accept?.length || S(e.mimeType ?? "", d.accept) : !1;
2835
+ }), re = r(() => {
2836
+ if (!I.value) return 0;
2837
+ let e = 0;
2838
+ for (let t of D.selectedItems.value) O.displayItems.value.find((e) => e.id === t)?.canDelete !== !1 && (e += 1);
2839
+ return e;
2805
2840
  });
2806
- function O() {
2807
- if (!v.previewItem.value) return;
2808
- let e = v.previewItem.value, t = {
2809
- ...e,
2810
- url: E.selectedUrl.value || e.url
2811
- };
2812
- n.onSelect?.(t);
2813
- }
2814
- return x(() => {
2815
- v.loadItems(), v.loadFrequentlyUsed(), r("ready");
2816
- }), (t, n) => (S(), d("div", ii, [
2817
- f("div", ai, [f("h2", oi, D(a.value.mediaLibrary.title), 1), f("div", si, [m(nr, {
2818
- "used-bytes": h.value,
2819
- "limit-bytes": g.value,
2841
+ function J() {
2842
+ d.onSelect && ne.value && D.previewItem.value && d.onSelect(D.previewItem.value);
2843
+ }
2844
+ function Y(e) {
2845
+ let t = e.target.value;
2846
+ D.filterByCategory(t || null);
2847
+ }
2848
+ async function ie() {
2849
+ let e = /* @__PURE__ */ new Set();
2850
+ for (let t of D.selectedItems.value) O.displayItems.value.find((e) => e.id === t)?.canDelete !== !1 && e.add(t);
2851
+ D.selectedItems.value = e, await O.handleDeleteClick();
2852
+ }
2853
+ return _(() => {
2854
+ d.accept?.length === 1 && (D.categoryFilter.value = d.accept[0]), D.loadItems(), D.loadFrequentlyUsed(), D.loadStorage(), f("ready");
2855
+ }), (r, i) => (v(), s("div", Gr, [
2856
+ c("div", Kr, [c("h2", qr, C(p.value.mediaLibrary.title), 1), c("div", Jr, [E(D).storageInfo.value ? (v(), a(Yn, {
2857
+ key: 0,
2858
+ "used-bytes": E(D).storageInfo.value.usedBytes,
2859
+ "limit-bytes": E(D).storageInfo.value.limitBytes,
2820
2860
  size: 22
2821
- }, null, 8, ["used-bytes", "limit-bytes"]), f("div", ci, [f("input", {
2822
- value: k(E).searchInput.value,
2861
+ }, null, 8, ["used-bytes", "limit-bytes"])) : o("", !0), c("div", Yr, [c("input", {
2862
+ value: E(O).searchInput.value,
2823
2863
  type: "text",
2824
- class: "tpl:w-52 tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-3 tpl:pl-8 tpl:text-xs tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:outline-none tpl:focus:shadow-[var(--tpl-ring)]",
2864
+ disabled: q.value,
2865
+ class: "tpl:w-52 tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-3 tpl:pl-8 tpl:text-xs tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:outline-none tpl:focus:shadow-[var(--tpl-ring)] tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
2825
2866
  style: {
2826
2867
  "border-color": "var(--tpl-border)",
2827
2868
  "background-color": "var(--tpl-bg)",
2828
2869
  color: "var(--tpl-text)"
2829
2870
  },
2830
- placeholder: a.value.mediaLibrary.searchPlaceholder,
2831
- onInput: n[0] ||= (e) => k(E).handleSearchInput(e.target.value)
2832
- }, null, 40, li), m(k(Y), {
2871
+ placeholder: p.value.mediaLibrary.searchPlaceholder,
2872
+ onInput: i[0] ||= (e) => E(O).handleSearchInput(e.target.value)
2873
+ }, null, 40, Xr), u(E(ee), {
2833
2874
  class: "tpl:absolute tpl:top-1/2 tpl:left-2.5 tpl:-translate-y-1/2",
2834
2875
  size: 13,
2835
2876
  "stroke-width": 2,
2836
2877
  style: { color: "var(--tpl-text-dim)" }
2837
2878
  })])])]),
2838
- f("div", ui, [m(o, {
2879
+ c("div", Zr, [u(n, {
2839
2880
  "enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
2840
2881
  "enter-from-class": "tpl:-ml-48 tpl:opacity-0",
2841
2882
  "enter-to-class": "tpl:ml-0 tpl:opacity-100",
@@ -2843,76 +2884,84 @@ var ii = {
2843
2884
  "leave-from-class": "tpl:ml-0 tpl:opacity-100",
2844
2885
  "leave-to-class": "tpl:-ml-48 tpl:opacity-0"
2845
2886
  }, {
2846
- default: M(() => [k(E).showSidebar.value ? (S(), d("div", di, [m(wt, {
2847
- folders: k(v).folders.value,
2848
- "current-folder-id": k(v).currentFolderId.value,
2849
- "view-mode": k(v).viewMode.value,
2850
- "has-frequently-used": k(E).hasFrequentlyUsed.value,
2851
- onNavigate: k(v).navigateToFolder,
2852
- onCreateFolder: k(E).handleCreateFolder,
2853
- onRenameFolder: k(E).handleRenameFolder,
2854
- onDeleteFolder: k(E).handleDeleteFolder,
2855
- onShowFrequentlyUsed: k(v).showFrequentlyUsed
2887
+ default: k(() => [j.value && E(O).showSidebar.value ? (v(), s("div", Qr, [u(bt, {
2888
+ folders: E(O).folderTree.value,
2889
+ "current-folder-id": E(D).currentFolderId.value,
2890
+ "view-mode": E(D).viewMode.value,
2891
+ "has-frequently-used": U.value && E(O).hasFrequentlyUsed.value,
2892
+ "can-create-folder": G.value,
2893
+ "can-rename-folder": K.value,
2894
+ "can-delete-folder": te.value,
2895
+ onNavigate: E(D).navigateToFolder,
2896
+ onCreateFolder: E(O).handleCreateFolder,
2897
+ onRenameFolder: E(O).handleRenameFolder,
2898
+ onDeleteFolder: E(O).handleDeleteFolder,
2899
+ onShowFrequentlyUsed: E(D).showFrequentlyUsed
2856
2900
  }, null, 8, [
2857
2901
  "folders",
2858
2902
  "current-folder-id",
2859
2903
  "view-mode",
2860
2904
  "has-frequently-used",
2905
+ "can-create-folder",
2906
+ "can-rename-folder",
2907
+ "can-delete-folder",
2861
2908
  "onNavigate",
2862
2909
  "onCreateFolder",
2863
2910
  "onRenameFolder",
2864
2911
  "onDeleteFolder",
2865
2912
  "onShowFrequentlyUsed"
2866
- ])])) : u("", !0)]),
2913
+ ])])) : o("", !0)]),
2867
2914
  _: 1
2868
- }), f("div", fi, [f("div", pi, [f("div", mi, [
2869
- f("button", {
2915
+ }), c("div", $r, [c("div", ei, [c("div", ti, [
2916
+ j.value ? (v(), s("button", {
2917
+ key: 0,
2918
+ "data-testid": "media-folder-toggle",
2870
2919
  class: "tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:transition-all tpl:duration-150",
2871
- style: b({
2872
- color: k(E).showSidebar.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2873
- backgroundColor: k(E).showSidebar.value ? "var(--tpl-bg)" : "transparent",
2874
- border: k(E).showSidebar.value ? "1px solid var(--tpl-border)" : "1px solid transparent"
2920
+ style: g({
2921
+ color: E(O).showSidebar.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2922
+ backgroundColor: E(O).showSidebar.value ? "var(--tpl-bg)" : "transparent",
2923
+ border: E(O).showSidebar.value ? "1px solid var(--tpl-border)" : "1px solid transparent"
2875
2924
  }),
2876
- title: k(E).showSidebar.value ? a.value.mediaLibrary.hideFolders : a.value.mediaLibrary.showFolders,
2877
- onClick: n[1] ||= (e) => k(E).showSidebar.value = !k(E).showSidebar.value
2878
- }, [m(k(G), {
2925
+ title: E(O).showSidebar.value ? p.value.mediaLibrary.hideFolders : p.value.mediaLibrary.showFolders,
2926
+ onClick: i[1] ||= (e) => E(O).showSidebar.value = !E(O).showSidebar.value
2927
+ }, [u(E(H), {
2879
2928
  size: 16,
2880
2929
  "stroke-width": 2
2881
- })], 12, hi),
2882
- k(v).viewMode.value === "frequently-used" ? (S(), d("span", gi, D(a.value.mediaLibrary.frequentlyUsed), 1)) : (S(), l(Te, {
2883
- key: 1,
2884
- folders: k(v).folders.value,
2885
- "current-folder-id": k(v).currentFolderId.value,
2886
- onNavigate: k(v).navigateToFolder
2930
+ })], 12, ni)) : o("", !0),
2931
+ E(D).viewMode.value === "frequently-used" ? (v(), s("span", ri, C(p.value.mediaLibrary.frequentlyUsed), 1)) : (v(), a(be, {
2932
+ key: 2,
2933
+ folders: E(O).folderTree.value,
2934
+ "current-folder-id": E(D).currentFolderId.value,
2935
+ onNavigate: E(D).navigateToFolder
2887
2936
  }, null, 8, [
2888
2937
  "folders",
2889
2938
  "current-folder-id",
2890
2939
  "onNavigate"
2891
2940
  ])),
2892
- f("div", _i, [f("button", {
2941
+ c("div", ii, [c("button", {
2893
2942
  class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
2894
- style: b({
2895
- color: k(E).layoutMode.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2896
- backgroundColor: k(E).layoutMode.value === "grid" ? "var(--tpl-bg-elevated)" : "transparent"
2943
+ style: g({
2944
+ color: E(O).layoutMode.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2945
+ backgroundColor: E(O).layoutMode.value === "grid" ? "var(--tpl-bg-elevated)" : "transparent"
2897
2946
  }),
2898
- title: a.value.mediaLibrary.viewGrid,
2899
- onClick: n[2] ||= (e) => k(E).layoutMode.value = "grid"
2900
- }, [m(k(V), {
2947
+ title: p.value.mediaLibrary.viewGrid,
2948
+ onClick: i[2] ||= (e) => E(O).layoutMode.value = "grid"
2949
+ }, [u(E(R), {
2901
2950
  size: 14,
2902
2951
  "stroke-width": 2
2903
- })], 12, vi), f("button", {
2952
+ })], 12, ai), c("button", {
2904
2953
  class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
2905
- style: b({
2906
- color: k(E).layoutMode.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2907
- backgroundColor: k(E).layoutMode.value === "list" ? "var(--tpl-bg-elevated)" : "transparent"
2954
+ style: g({
2955
+ color: E(O).layoutMode.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
2956
+ backgroundColor: E(O).layoutMode.value === "list" ? "var(--tpl-bg-elevated)" : "transparent"
2908
2957
  }),
2909
- title: a.value.mediaLibrary.viewList,
2910
- onClick: n[3] ||= (e) => k(E).layoutMode.value = "list"
2911
- }, [m(k(U), {
2958
+ title: p.value.mediaLibrary.viewList,
2959
+ onClick: i[3] ||= (e) => E(O).layoutMode.value = "list"
2960
+ }, [u(E(B), {
2912
2961
  size: 14,
2913
2962
  "stroke-width": 2
2914
- })], 12, yi)])
2915
- ]), f("div", bi, [k(_).length > 1 ? (S(), d("select", {
2963
+ })], 12, oi)])
2964
+ ]), c("div", si, [E(T).length > 1 ? (v(), s("select", {
2916
2965
  key: 0,
2917
2966
  class: "tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-7 tpl:pl-2.5 tpl:text-xs tpl:transition-all tpl:duration-150 tpl:outline-none",
2918
2967
  style: {
@@ -2920,99 +2969,95 @@ var ii = {
2920
2969
  "background-color": "var(--tpl-bg)",
2921
2970
  color: "var(--tpl-text)"
2922
2971
  },
2923
- value: k(v).categoryFilter.value ?? "",
2924
- onChange: n[4] ||= (e) => k(v).filterByCategory(e.target.value || null)
2925
- }, [f("option", Si, D(a.value.mediaLibrary.filterAll), 1), (S(!0), d(i, null, T(k(_), (e) => (S(), d("option", {
2972
+ value: E(D).categoryFilter.value ?? "",
2973
+ onChange: Y
2974
+ }, [c("option", li, C(p.value.mediaLibrary.filterAll), 1), (v(!0), s(e, null, x(E(T), (e) => (v(), s("option", {
2926
2975
  key: e,
2927
2976
  value: e
2928
- }, D(k(E).getCategoryLabel(e)), 9, Ci))), 128))], 40, xi)) : u("", !0), f("select", {
2929
- class: "tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-7 tpl:pl-2.5 tpl:text-xs tpl:transition-all tpl:duration-150 tpl:outline-none",
2930
- style: {
2931
- "border-color": "var(--tpl-border)",
2932
- "background-color": "var(--tpl-bg)",
2933
- color: "var(--tpl-text)"
2934
- },
2935
- value: k(v).sortOption.value,
2936
- onChange: n[5] ||= (e) => k(v).sortBy(e.target.value)
2937
- }, [
2938
- f("option", Ti, D(a.value.mediaLibrary.sortNewest), 1),
2939
- f("option", Ei, D(a.value.mediaLibrary.sortOldest), 1),
2940
- f("option", Di, D(a.value.mediaLibrary.sortNameAsc), 1),
2941
- f("option", Oi, D(a.value.mediaLibrary.sortNameDesc), 1),
2942
- f("option", ki, D(a.value.mediaLibrary.sortSizeAsc), 1),
2943
- f("option", Ai, D(a.value.mediaLibrary.sortSizeDesc), 1)
2944
- ], 40, wi)])]), f("div", ji, [k(v).viewMode.value === "files" ? (S(), d("div", Mi, [m(Zn, {
2945
- "is-uploading": k(v).isUploading.value,
2946
- "upload-progress": k(v).uploadProgress.value,
2947
- onUpload: k(E).handleUpload
2977
+ }, C(E(O).getCategoryLabel(e)), 9, ui))), 128))], 40, ci)) : o("", !0)])]), c("div", di, [E(D).viewMode.value === "files" && (A.value || P.value) ? (v(), s("div", fi, [A.value ? (v(), a(Wn, {
2978
+ key: 0,
2979
+ "is-uploading": E(D).isUploading.value,
2980
+ "upload-progress": E(D).uploadProgress.value,
2981
+ onUpload: E(O).handleUpload
2948
2982
  }, null, 8, [
2949
2983
  "is-uploading",
2950
2984
  "upload-progress",
2951
2985
  "onUpload"
2952
- ]), f("button", {
2986
+ ])) : o("", !0), P.value ? (v(), s("button", {
2987
+ key: 1,
2988
+ "data-testid": "media-import-url",
2953
2989
  class: "tpl:mt-2 tpl:flex tpl:w-full tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded-md tpl:border tpl:border-dashed tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
2954
2990
  style: {
2955
2991
  "border-color": "var(--tpl-border)",
2956
2992
  color: "var(--tpl-text-muted)",
2957
2993
  "background-color": "var(--tpl-bg)"
2958
2994
  },
2959
- onClick: n[6] ||= (e) => k(E).showImportUrlModal.value = !0
2960
- }, [m(k(H), {
2995
+ onClick: i[4] ||= (e) => E(O).showImportUrlModal.value = !0
2996
+ }, [u(E(z), {
2961
2997
  size: 14,
2962
2998
  "stroke-width": 2
2963
- }), p(" " + D(a.value.mediaLibrary.importFromUrl), 1)])])) : u("", !0), m(nn, {
2964
- items: k(E).displayItems.value,
2965
- "selected-ids": k(v).selectedItems.value,
2966
- "is-loading": k(v).isLoading.value,
2967
- "has-more": k(v).viewMode.value === "files" && k(v).hasMore.value,
2968
- layout: k(E).layoutMode.value,
2969
- onSelect: k(E).handleSelect,
2970
- onToggle: k(v).toggleSelection,
2971
- onLoadMore: k(v).loadMore,
2972
- onEdit: k(E).handleEditItem,
2973
- onReplace: k(E).handleReplaceItem
2999
+ }), l(" " + C(p.value.mediaLibrary.importFromUrl), 1)])) : o("", !0)])) : o("", !0), u($t, {
3000
+ items: E(O).displayItems.value,
3001
+ "selected-ids": E(D).selectedItems.value,
3002
+ "is-loading": E(D).isLoading.value,
3003
+ "has-more": E(D).viewMode.value === "files" && E(D).hasMore.value,
3004
+ accept: t.accept,
3005
+ layout: E(O).layoutMode.value,
3006
+ "search-query": E(D).searchQuery.value,
3007
+ "can-update": L.value,
3008
+ "can-replace": V.value,
3009
+ onSelect: E(O).handleSelect,
3010
+ onToggle: E(D).toggleSelection,
3011
+ onLoadMore: E(D).loadMore,
3012
+ onEdit: E(O).handleEditItem,
3013
+ onReplace: E(O).handleReplaceItem,
3014
+ onConfirm: J
2974
3015
  }, null, 8, [
2975
3016
  "items",
2976
3017
  "selected-ids",
2977
3018
  "is-loading",
2978
3019
  "has-more",
3020
+ "accept",
2979
3021
  "layout",
3022
+ "search-query",
3023
+ "can-update",
3024
+ "can-replace",
2980
3025
  "onSelect",
2981
3026
  "onToggle",
2982
3027
  "onLoadMore",
2983
3028
  "onEdit",
2984
3029
  "onReplace"
2985
3030
  ])])])]),
2986
- m(hn, {
2987
- visible: k(E).showImportUrlModal.value,
2988
- "is-importing": k(v).isImportingFromUrl.value,
2989
- error: k(v).importFromUrlError.value,
2990
- onImport: k(E).handleImportFromUrl,
2991
- onClose: n[7] ||= (e) => k(E).showImportUrlModal.value = !1
3031
+ u(fn, {
3032
+ visible: E(O).showImportUrlModal.value,
3033
+ "is-importing": E(D).isImportingFromUrl.value,
3034
+ error: E(D).importFromUrlError.value,
3035
+ onImport: E(O).handleImportFromUrl,
3036
+ onClose: i[5] ||= (e) => E(O).showImportUrlModal.value = !1
2992
3037
  }, null, 8, [
2993
3038
  "visible",
2994
3039
  "is-importing",
2995
3040
  "error",
2996
3041
  "onImport"
2997
3042
  ]),
2998
- m(ft, {
2999
- visible: !!k(E).editingItem.value,
3000
- item: k(E).editingItem.value,
3001
- onSave: k(E).handleEditSave,
3002
- onClose: n[8] ||= (e) => k(E).editingItem.value = null
3043
+ u(ct, {
3044
+ visible: !!E(O).editingItem.value,
3045
+ item: E(O).editingItem.value,
3046
+ onSave: E(O).handleEditSave,
3047
+ onClose: i[6] ||= (e) => E(O).editingItem.value = null
3003
3048
  }, null, 8, [
3004
3049
  "visible",
3005
3050
  "item",
3006
3051
  "onSave"
3007
3052
  ]),
3008
- m(Kn, {
3009
- visible: k(v).showReplaceWarning.value,
3010
- item: k(v).pendingReplaceItem.value,
3011
- "usage-info": k(v).replaceUsageInfo.value,
3012
- "is-replacing": k(v).isReplacing.value,
3013
- error: k(v).replaceError.value,
3014
- onReplace: k(E).handleReplaceFile,
3015
- onClose: k(v).cancelReplace
3053
+ u(zn, {
3054
+ visible: E(D).showReplaceWarning.value,
3055
+ item: E(D).pendingReplaceItem.value,
3056
+ "usage-info": E(D).replaceUsageInfo.value,
3057
+ "is-replacing": E(D).isReplacing.value,
3058
+ error: E(D).replaceError.value,
3059
+ onReplace: E(O).handleReplaceFile,
3060
+ onClose: E(D).cancelReplace
3016
3061
  }, null, 8, [
3017
3062
  "visible",
3018
3063
  "item",
@@ -3022,7 +3067,7 @@ var ii = {
3022
3067
  "onReplace",
3023
3068
  "onClose"
3024
3069
  ]),
3025
- m(o, {
3070
+ u(n, {
3026
3071
  "enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
3027
3072
  "enter-from-class": "tpl:opacity-0",
3028
3073
  "enter-to-class": "tpl:opacity-100",
@@ -3030,154 +3075,147 @@ var ii = {
3030
3075
  "leave-from-class": "tpl:opacity-100",
3031
3076
  "leave-to-class": "tpl:opacity-0"
3032
3077
  }, {
3033
- default: M(() => [k(v).showDeleteWarning.value ? (S(), d("div", {
3078
+ default: k(() => [E(D).showDeleteWarning.value ? (v(), s("div", {
3034
3079
  key: 0,
3035
3080
  class: "tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-lg)]",
3036
3081
  style: {
3037
- "background-color": "rgba(0, 0, 0, 0.5)",
3082
+ "background-color": "var(--tpl-overlay)",
3038
3083
  "backdrop-filter": "blur(8px)",
3039
3084
  "-webkit-backdrop-filter": "blur(8px)"
3040
3085
  },
3041
- onClick: n[11] ||= F((...e) => k(v).cancelDelete && k(v).cancelDelete(...e), ["self"])
3042
- }, [f("div", Ni, [
3043
- f("h3", Pi, D(a.value.mediaLibrary.deleteWarningTitle), 1),
3044
- f("p", {
3045
- class: y(["tpl:text-xs", k(E).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
3086
+ onClick: i[9] ||= M((...e) => E(D).cancelDelete && E(D).cancelDelete(...e), ["self"])
3087
+ }, [c("div", pi, [
3088
+ c("h3", mi, C(p.value.mediaLibrary.deleteWarningTitle), 1),
3089
+ c("p", {
3090
+ class: h(["tpl:text-xs", E(O).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
3046
3091
  style: { color: "var(--tpl-text-muted)" }
3047
- }, D(a.value.mediaLibrary.deleteWarningMessage), 3),
3048
- k(E).hasUsedFiles.value ? (S(), d("p", Fi, D(a.value.mediaLibrary.deleteWarningUsageNote), 1)) : u("", !0),
3049
- k(E).hasUsedFiles.value ? (S(), d("div", Ii, [(S(!0), d(i, null, T(k(v).deleteUsageInfo.value, (e, t) => (S(), d("div", {
3050
- key: t,
3092
+ }, C(p.value.mediaLibrary.deleteWarningMessage), 3),
3093
+ E(O).hasUsedFiles.value ? (v(), s("p", hi, C(p.value.mediaLibrary.deleteWarningUsageNote), 1)) : o("", !0),
3094
+ E(O).hasUsedFiles.value ? (v(), s("div", gi, [(v(!0), s(e, null, x(E(D).deleteUsageInfo.value, (t, n) => (v(), s("div", {
3095
+ key: n,
3051
3096
  class: "tpl:text-xs",
3052
3097
  style: { color: "var(--tpl-text)" }
3053
- }, [e.template_count > 0 ? (S(), d(i, { key: 0 }, [f("span", Li, D(k(E).displayItems.value.find((e) => e.id === t)?.filename || t), 1), f("span", Ri, " - " + D(a.value.mediaLibrary.usedInTemplates.replace("{count}", e.template_count.toString())), 1)], 64)) : u("", !0)]))), 128))])) : u("", !0),
3054
- f("div", zi, [f("button", {
3098
+ }, [t.templateCount > 0 ? (v(), s(e, { key: 0 }, [c("span", _i, C(E(O).displayItems.value.find((e) => e.id === n)?.filename || n), 1), c("span", vi, " - " + C(p.value.mediaLibrary.usedInTemplates.replace("{count}", t.templateCount.toString())), 1)], 64)) : o("", !0)]))), 128))])) : o("", !0),
3099
+ c("div", yi, [c("button", {
3055
3100
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
3056
3101
  style: {
3057
3102
  "border-color": "var(--tpl-border)",
3058
3103
  color: "var(--tpl-text)",
3059
3104
  "background-color": "var(--tpl-bg)"
3060
3105
  },
3061
- onClick: n[9] ||= (...e) => k(v).cancelDelete && k(v).cancelDelete(...e)
3062
- }, D(a.value.mediaLibrary.cancel), 1), f("button", {
3106
+ onClick: i[7] ||= (...e) => E(D).cancelDelete && E(D).cancelDelete(...e)
3107
+ }, C(p.value.mediaLibrary.cancel), 1), c("button", {
3063
3108
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
3064
3109
  style: {
3065
3110
  "border-color": "var(--tpl-danger)",
3066
3111
  color: "var(--tpl-danger)",
3067
3112
  "background-color": "var(--tpl-danger-light)"
3068
3113
  },
3069
- onClick: n[10] ||= (...e) => k(v).confirmDelete && k(v).confirmDelete(...e)
3070
- }, D(k(E).hasUsedFiles.value ? a.value.mediaLibrary.deleteAnyway : a.value.mediaLibrary.confirmDelete), 1)])
3071
- ])])) : u("", !0)]),
3114
+ onClick: i[8] ||= (...e) => E(D).confirmDelete && E(D).confirmDelete(...e)
3115
+ }, C(E(O).hasUsedFiles.value ? p.value.mediaLibrary.deleteAnyway : p.value.mediaLibrary.confirmDelete), 1)])
3116
+ ])])) : o("", !0)]),
3072
3117
  _: 1
3073
3118
  }),
3074
- f("div", Bi, [f("div", Vi, [k(v).previewItem.value ? (S(), l(jn, {
3119
+ c("div", bi, [c("div", xi, [E(D).previewItem.value ? (v(), a(wn, {
3075
3120
  key: 0,
3076
- "selected-conversion": k(E).selectedConversion.value,
3077
- "onUpdate:selectedConversion": n[12] ||= (e) => k(E).selectedConversion.value = e,
3078
- item: k(v).previewItem.value,
3079
- folders: k(v).folders.value
3080
- }, null, 8, [
3081
- "selected-conversion",
3082
- "item",
3083
- "folders"
3084
- ])) : u("", !0)]), f("div", Hi, [k(v).selectedItems.value.size > 0 ? (S(), d("div", Ui, [k(v).previewItem.value ? (S(), d("button", {
3121
+ item: E(D).previewItem.value,
3122
+ folders: E(O).folderTree.value
3123
+ }, null, 8, ["item", "folders"])) : o("", !0)]), c("div", Si, [E(D).selectedItems.value.size > 0 ? (v(), s("div", Ci, [E(D).previewItem.value ? (v(), s("button", {
3085
3124
  key: 0,
3086
3125
  class: "tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-1 tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
3087
- style: b({
3088
- borderColor: k(E).copied.value ? "var(--tpl-success)" : "var(--tpl-border)",
3089
- color: k(E).copied.value ? "var(--tpl-success)" : "var(--tpl-text)",
3126
+ style: g({
3127
+ borderColor: E(O).copied.value ? "var(--tpl-success)" : "var(--tpl-border)",
3128
+ color: E(O).copied.value ? "var(--tpl-success)" : "var(--tpl-text)",
3090
3129
  backgroundColor: "var(--tpl-bg)"
3091
3130
  }),
3092
- onClick: n[13] ||= (e) => k(E).copy(k(E).selectedUrl.value)
3093
- }, [k(E).copied.value ? (S(), l(k(I), {
3131
+ onClick: i[10] ||= (e) => E(O).copy(E(O).selectedUrl.value)
3132
+ }, [E(O).copied.value ? (v(), a(E(N), {
3094
3133
  key: 1,
3095
3134
  size: 12,
3096
3135
  "stroke-width": 2
3097
- })) : (S(), l(k(R), {
3136
+ })) : (v(), a(E(F), {
3098
3137
  key: 0,
3099
3138
  size: 12,
3100
3139
  "stroke-width": 2
3101
- })), p(" " + D(k(E).copied.value ? a.value.mediaLibrary.copied : a.value.mediaLibrary.copyUrl), 1)], 4)) : u("", !0), f("div", Wi, [f("button", {
3140
+ })), l(" " + C(E(O).copied.value ? p.value.mediaLibrary.copied : p.value.mediaLibrary.copyUrl), 1)], 4)) : o("", !0), W.value ? (v(), s("div", wi, [c("button", {
3102
3141
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
3103
3142
  style: {
3104
3143
  "border-color": "var(--tpl-border)",
3105
3144
  color: "var(--tpl-text)",
3106
3145
  "background-color": "var(--tpl-bg)"
3107
3146
  },
3108
- onClick: n[14] ||= (e) => k(E).showMovePicker.value = !k(E).showMovePicker.value
3109
- }, D(a.value.mediaLibrary.moveSelected), 1), k(E).showMovePicker.value ? (S(), l(bn, {
3147
+ onClick: i[11] ||= (e) => E(O).showMovePicker.value = !E(O).showMovePicker.value
3148
+ }, C(p.value.mediaLibrary.moveSelected), 1), E(O).showMovePicker.value ? (v(), a(_n, {
3110
3149
  key: 0,
3111
- folders: k(v).folders.value,
3112
- "current-folder-id": k(v).currentFolderId.value,
3113
- onSelect: k(E).handleMoveToFolder,
3114
- onClose: n[15] ||= (e) => k(E).showMovePicker.value = !1
3150
+ folders: E(O).folderTree.value,
3151
+ "current-folder-id": E(D).currentFolderId.value,
3152
+ onSelect: E(O).handleMoveToFolder,
3153
+ onClose: i[12] ||= (e) => E(O).showMovePicker.value = !1
3115
3154
  }, null, 8, [
3116
3155
  "folders",
3117
3156
  "current-folder-id",
3118
3157
  "onSelect"
3119
- ])) : u("", !0)])])) : u("", !0), f("div", Gi, [k(v).selectedItems.value.size > 0 ? (S(), d("button", {
3158
+ ])) : o("", !0)])) : o("", !0)])) : o("", !0), c("div", Ti, [re.value > 0 ? (v(), s("button", {
3120
3159
  key: 0,
3160
+ "data-testid": "media-delete",
3121
3161
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
3122
3162
  style: {
3123
3163
  "border-color": "var(--tpl-danger)",
3124
3164
  color: "var(--tpl-danger)",
3125
3165
  "background-color": "var(--tpl-danger-light)"
3126
3166
  },
3127
- onClick: n[16] ||= (...e) => k(E).handleDeleteClick && k(E).handleDeleteClick(...e)
3128
- }, D(a.value.mediaLibrary.deleteSelected), 1)) : u("", !0), e.onSelect ? (S(), d("button", {
3167
+ onClick: ie
3168
+ }, C(p.value.mediaLibrary.deleteSelected), 1)) : o("", !0), t.onSelect ? (v(), s("button", {
3129
3169
  key: 1,
3170
+ "data-testid": "media-select",
3130
3171
  class: "tpl:cursor-pointer tpl:rounded-md tpl:px-4 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
3131
3172
  style: {
3132
3173
  "background-color": "var(--tpl-primary)",
3133
3174
  color: "var(--tpl-bg)"
3134
3175
  },
3135
- disabled: !k(v).previewItem.value,
3136
- onClick: O
3137
- }, D(a.value.mediaLibrary.selectFile), 9, Ki)) : u("", !0)])])])
3176
+ disabled: !ne.value,
3177
+ onClick: J
3178
+ }, C(t.accept?.length ? p.value.mediaLibrary.selectImage : p.value.mediaLibrary.selectFile), 9, Ei)) : o("", !0)])])])
3138
3179
  ]));
3139
3180
  }
3140
- }), $ = null, Ji = w(null);
3141
- async function Yi(e) {
3142
- let n = typeof e.container == "string" ? document.querySelector(e.container) : e.container;
3143
- if (!n) throw Error(`Container element not found: ${e.container}`);
3144
- let i = r(e.auth, e.onError);
3145
- await i.initialize();
3146
- let a = await new t(i).fetchConfig(), o = await dr(e.locale ?? "en");
3147
- return Zi(n, e.theme), $ && Xi(), new Promise((t, r) => {
3181
+ }), Oi = null, ki = b(null);
3182
+ async function Ai(e) {
3183
+ let t = typeof e.container == "string" ? document.querySelector(e.container) : e.container;
3184
+ if (!t) throw Error(`Container element not found: ${e.container}`);
3185
+ let n = await ar(e.locale ?? "en");
3186
+ return Mi(t, e.theme), Oi && ji(), new Promise((r, a) => {
3148
3187
  try {
3149
- $ = c({ setup() {
3150
- let r = () => {
3151
- t({
3152
- setTheme: (e) => Zi(n, e),
3153
- unmount: Xi
3188
+ Oi = i({ setup() {
3189
+ let i = () => {
3190
+ r({
3191
+ setTheme: (e) => Mi(t, e),
3192
+ unmount: ji
3154
3193
  });
3155
3194
  };
3156
- return () => g(qi, {
3157
- authManager: i,
3158
- projectId: i.projectId,
3159
- planConfig: a,
3160
- translations: o,
3195
+ return () => f(Di, {
3196
+ provider: e.provider,
3197
+ translations: n,
3161
3198
  onSelect: e.onSelect,
3162
- onError: e.onError,
3163
- ref: Ji,
3164
- onReady: r
3199
+ accept: e.accept,
3200
+ locale: e.locale,
3201
+ ref: ki,
3202
+ onReady: i
3165
3203
  });
3166
- } }), $.mount(n);
3204
+ } }), Oi.mount(t);
3167
3205
  } catch (e) {
3168
- r(e);
3206
+ a(e);
3169
3207
  }
3170
3208
  });
3171
3209
  }
3172
- function Xi() {
3173
- $ && ($.unmount(), $ = null, Ji.value = null);
3210
+ function ji() {
3211
+ Oi && (Oi.unmount(), Oi = null, ki.value = null);
3174
3212
  }
3175
- function Zi(e, t) {
3213
+ function Mi(e, t) {
3176
3214
  t && (t.primaryColor && e.style.setProperty("--tpl-primary", t.primaryColor), t.borderRadius !== void 0 && (e.style.setProperty("--tpl-radius", `${t.borderRadius}px`), e.style.setProperty("--tpl-radius-sm", `${Math.max(0, t.borderRadius - 3)}px`), e.style.setProperty("--tpl-radius-lg", `${t.borderRadius + 4}px`)));
3177
3215
  }
3178
3216
  typeof window < "u" && (window.TemplaticalMedia = {
3179
- init: Yi,
3180
- unmount: Xi
3217
+ init: Ai,
3218
+ unmount: ji
3181
3219
  });
3182
3220
  //#endregion
3183
- export { pe as MediaApiClient, ni as MediaLibraryModal, Yi as init, Xi as unmount, Z as useI18n, Q as useMediaCategories, me as useMediaLibrary, ri as useMediaPicker };
3221
+ export { Ur as MediaLibraryModal, Ai as init, ji as unmount, Q as useI18n, $ as useMediaCategories, ue as useMediaLibrary, Wr as useMediaPicker };