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