handy-uploader 2.0.3 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +290 -292
  2. package/dist/components/handyUploader.vue.d.ts +3 -3
  3. package/dist/composables/deprecation.d.ts +2 -0
  4. package/dist/composables/useErrorHandler.d.ts +4 -0
  5. package/dist/composables/useFileUpload.d.ts +5 -0
  6. package/dist/core/attachments.d.ts +91 -0
  7. package/dist/core/fileUtils.d.ts +56 -0
  8. package/dist/core/index.d.ts +3 -0
  9. package/dist/core/videoThumbnail.d.ts +32 -0
  10. package/dist/element/HandyUploaderElement.d.ts +20 -0
  11. package/dist/element/index.d.ts +21 -0
  12. package/dist/element/types.d.ts +108 -0
  13. package/dist/element.mjs +6178 -0
  14. package/dist/handy-uploader.cjs +1 -0
  15. package/dist/handy-uploader.css +1 -1
  16. package/dist/handy-uploader.mjs +1110 -0
  17. package/dist/language-CYpPw-mk.mjs +551 -0
  18. package/dist/language-fvWXvWRx.js +1 -0
  19. package/dist/lib/index.d.ts +8 -19
  20. package/dist/lib/language.d.ts +3 -0
  21. package/dist/lib/shared.d.ts +5 -0
  22. package/dist/lib/vuetify.d.ts +15 -0
  23. package/dist/types/index.d.ts +4 -0
  24. package/dist/utils/fileUtils.d.ts +1 -56
  25. package/dist/vue/components/HandyDialog.vue.d.ts +31 -0
  26. package/dist/vue/components/HandyDropzone.vue.d.ts +38 -0
  27. package/dist/vue/components/HandyFileIcon.vue.d.ts +9 -0
  28. package/dist/vue/components/HandyFileList.vue.d.ts +65 -0
  29. package/dist/vue/components/HandyIcon.vue.d.ts +10 -0
  30. package/dist/vue/components/HandyUploader.vue.d.ts +137 -0
  31. package/dist/vue/index.d.ts +9 -0
  32. package/dist/vue/types.d.ts +5 -0
  33. package/dist/vue/useUploader.d.ts +46 -0
  34. package/dist/vuetify.cjs +1 -0
  35. package/dist/vuetify.mjs +1875 -0
  36. package/package.json +59 -16
  37. package/dist/handy-uploader.es.js +0 -2308
  38. package/dist/handy-uploader.umd.js +0 -1
@@ -0,0 +1,1875 @@
1
+ import { defineComponent as J, computed as Q, resolveComponent as f, openBlock as d, createElementBlock as w, createVNode as s, withCtx as o, createTextVNode as _, toDisplayString as y, ref as Z, watch as S, onMounted as ke, Fragment as H, renderList as W, createBlock as v, createElementVNode as D, unref as G, mergeProps as R, createCommentVNode as A, withDirectives as pe, vShow as ge, reactive as we, onBeforeMount as $e, onDeactivated as Ae } from "vue";
2
+ import { z as Le, m as se, u as re, g as ce, b as Ve, A as de, B as ue, c as Te, r as ze, l as Be, j as Se, a as Ue, y as Ie, x as Ee, i as Pe, k as me, q as je } from "./language-CYpPw-mk.mjs";
3
+ import { C as St, e as Ut, h as It, f as Et, d as Pt, n as jt, o as Mt, t as Ht, v as Nt, p as Ot, w as qt, s as Rt } from "./language-CYpPw-mk.mjs";
4
+ const te = /* @__PURE__ */ J({
5
+ __name: "SelectFileIconType",
6
+ props: {
7
+ fileFormat: {},
8
+ size: { default: 30 }
9
+ },
10
+ setup(l) {
11
+ const i = l, t = Q(() => {
12
+ const e = `file.${i.fileFormat}`;
13
+ return Le(e);
14
+ });
15
+ return (e, m) => {
16
+ const C = f("v-icon");
17
+ return d(), w("div", null, [
18
+ s(C, {
19
+ size: i.size,
20
+ color: t.value.color
21
+ }, {
22
+ default: o(() => [
23
+ _(y(t.value.icon), 1)
24
+ ]),
25
+ _: 1
26
+ }, 8, ["size", "color"])
27
+ ]);
28
+ };
29
+ }
30
+ }), Me = {
31
+ key: 0,
32
+ style: { height: "200px", display: "flex", "align-items": "center", "justify-content": "center", "background-color": "#f5f5f5", overflow: "hidden" }
33
+ }, He = ["src", "onError"], Ne = {
34
+ key: 1,
35
+ style: { height: "200px", "background-color": "#f5f5f5", position: "relative", overflow: "hidden", display: "flex", "align-items": "center", "justify-content": "center" }
36
+ }, Oe = ["src", "onError"], qe = {
37
+ key: 1,
38
+ style: { width: "100%", height: "100%", background: "#e0e0e0", display: "flex", "align-items": "center", "justify-content": "center" }
39
+ }, Re = {
40
+ class: "d-flex justify-center align-center",
41
+ style: { position: "absolute", top: "50%", left: "50%", transform: "translate(-50%, -50%)", background: "rgba(0,0,0,0.7)", "border-radius": "50%", width: "60px", height: "60px", cursor: "pointer" }
42
+ }, We = {
43
+ key: 2,
44
+ class: "d-flex justify-center align-center",
45
+ style: { height: "200px", "background-color": "#f5f5f5" }
46
+ }, Xe = { class: "BYekan" }, Ye = { class: "BYekan" }, Ge = { key: 0 }, he = /* @__PURE__ */ J({
47
+ __name: "ThumbnailUploader",
48
+ props: {
49
+ lang: { default: "en" },
50
+ documentAttachment: {},
51
+ thumb: { type: Boolean, default: !0 },
52
+ cols: { default: 4 },
53
+ editPermission: { type: Boolean, default: !0 },
54
+ deletePermission: { type: Boolean, default: !0 },
55
+ selectedLang: {},
56
+ cardType: {},
57
+ outlined: { type: Boolean, default: !1 },
58
+ raised: { type: Boolean, default: !1 },
59
+ shaped: { type: Boolean, default: !1 },
60
+ tile: { type: Boolean, default: !1 }
61
+ },
62
+ emits: ["openDeleteDialog", "openEditDocumentDialog"],
63
+ setup(l, { emit: i }) {
64
+ const t = (n) => {
65
+ const a = re(n);
66
+ return console.log("🔍 isImageFile check:", n, "→", a), a;
67
+ }, e = l, m = i, C = (n) => {
68
+ const a = ce(n) === "video";
69
+ return console.log("🎥 Checking if video file:", n, "result:", a, "fileType:", ce(n)), a;
70
+ }, V = (n) => {
71
+ var r;
72
+ if (!n.base64 || !n.format)
73
+ return console.error("❌ Missing base64 or format for:", n.name, { base64: !!n.base64, format: n.format }), "";
74
+ const a = Ve(n.base64, n.format);
75
+ return console.log("🖼️ Image source for:", n.name, {
76
+ format: n.format,
77
+ base64Length: ((r = n.base64) == null ? void 0 : r.length) || 0,
78
+ srcLength: a.length,
79
+ srcPreview: a.substring(0, 100) + "..."
80
+ }), a;
81
+ }, k = (n) => {
82
+ var a;
83
+ console.error("Image failed to load:", {
84
+ name: n.name,
85
+ format: n.format,
86
+ base64Length: ((a = n.base64) == null ? void 0 : a.length) || 0
87
+ });
88
+ }, z = Z(0), g = Te(() => z.value++), h = (n) => (z.value, g.get(n)), U = (n) => {
89
+ console.error("Video thumbnail failed to load:", { name: n.name, format: n.format }), g.invalidate(n);
90
+ }, L = (n) => ({
91
+ icon: ue(n),
92
+ color: de(n)
93
+ }), B = (n) => n.tags.length > 0 || !!n.description, j = (n) => {
94
+ n.showDetailState = !n.showDetailState;
95
+ }, I = (n, a) => {
96
+ m("openDeleteDialog", n, a);
97
+ }, M = (n, a) => {
98
+ m("openEditDocumentDialog", n, a);
99
+ }, u = () => {
100
+ if (g.retain(e.documentAttachment.map((a) => a.file)), !e.thumb) return;
101
+ console.log("🎯 Generating thumbnails for videos, total attachments:", e.documentAttachment.length);
102
+ const n = e.documentAttachment.filter((a) => C(a.file.name));
103
+ console.log("📹 Found video attachments:", n.length, n.map((a) => a.file.name)), n.forEach((a) => {
104
+ console.log("🎬 Processing video:", a.file.name), h(a.file);
105
+ });
106
+ };
107
+ return S(() => e.documentAttachment, u, { immediate: !0 }), ke(u), (n, a) => {
108
+ const r = f("v-icon"), c = f("v-card-subtitle"), x = f("v-chip"), b = f("v-divider"), T = f("v-btn"), F = f("v-tooltip"), N = f("v-spacer"), K = f("v-card-actions"), ee = f("v-chip-group"), q = f("v-card-text"), le = f("v-expand-transition"), oe = f("v-card"), ne = f("v-col"), ae = f("v-row");
109
+ return d(), w("div", null, [
110
+ s(ae, null, {
111
+ default: o(() => [
112
+ (d(!0), w(H, null, W(l.documentAttachment, ($, X) => (d(), v(ne, {
113
+ key: `attachment-${X}`,
114
+ cols: "12",
115
+ md: l.cols,
116
+ xs: "12"
117
+ }, {
118
+ default: o(() => [
119
+ s(oe, {
120
+ shaped: l.shaped,
121
+ outlined: l.outlined,
122
+ raised: l.raised,
123
+ tile: l.tile,
124
+ class: "mx-auto",
125
+ "max-width": "344"
126
+ }, {
127
+ default: o(() => [
128
+ l.thumb && t($.file.name) ? (d(), w("div", Me, [
129
+ D("img", {
130
+ src: V($.file),
131
+ style: { "max-width": "100%", "max-height": "100%", "object-fit": "contain" },
132
+ onError: (E) => k($.file)
133
+ }, null, 40, He)
134
+ ])) : l.thumb && C($.file.name) ? (d(), w("div", Ne, [
135
+ h($.file) ? (d(), w("img", {
136
+ key: 0,
137
+ src: h($.file),
138
+ style: { width: "100%", height: "100%", "object-fit": "cover" },
139
+ onError: (E) => U($.file)
140
+ }, null, 40, Oe)) : (d(), w("div", qe, [
141
+ s(r, {
142
+ size: "60",
143
+ color: "grey"
144
+ }, {
145
+ default: o(() => [...a[0] || (a[0] = [
146
+ _("mdi-video", -1)
147
+ ])]),
148
+ _: 1
149
+ })
150
+ ])),
151
+ D("div", Re, [
152
+ s(r, {
153
+ color: "white",
154
+ size: "30"
155
+ }, {
156
+ default: o(() => [...a[1] || (a[1] = [
157
+ _("mdi-play", -1)
158
+ ])]),
159
+ _: 1
160
+ })
161
+ ])
162
+ ])) : (d(), w("div", We, [
163
+ s(r, {
164
+ size: "120",
165
+ color: L($.file.name).color
166
+ }, {
167
+ default: o(() => [
168
+ _(y(L($.file.name).icon), 1)
169
+ ]),
170
+ _: 2
171
+ }, 1032, ["color"])
172
+ ])),
173
+ s(c, { class: "text-truncate py-2" }, {
174
+ default: o(() => [
175
+ _(y($.file.name), 1)
176
+ ]),
177
+ _: 2
178
+ }, 1024),
179
+ s(c, { class: "pt-2 pb-3" }, {
180
+ default: o(() => [
181
+ s(x, {
182
+ color: G(se)($.file.size).color,
183
+ label: "",
184
+ "text-color": "white"
185
+ }, {
186
+ default: o(() => [
187
+ _(y(G(se)($.file.size).text) + " ", 1),
188
+ s(r, { right: "" }, {
189
+ default: o(() => [...a[2] || (a[2] = [
190
+ _("mdi-harddisk", -1)
191
+ ])]),
192
+ _: 1
193
+ })
194
+ ]),
195
+ _: 2
196
+ }, 1032, ["color"])
197
+ ]),
198
+ _: 2
199
+ }, 1024),
200
+ s(b, { class: "mx-4" }),
201
+ s(K, { style: { padding: "0" } }, {
202
+ default: o(() => [
203
+ s(F, { right: "" }, {
204
+ activator: o(({ props: E }) => [
205
+ l.deletePermission ? (d(), v(T, R({
206
+ key: 0,
207
+ text: "",
208
+ fab: ""
209
+ }, { ref_for: !0 }, E, {
210
+ onClick: (Y) => I(X, "")
211
+ }), {
212
+ default: o(() => [
213
+ s(r, { color: "red" }, {
214
+ default: o(() => [...a[3] || (a[3] = [
215
+ _("mdi-trash-can-outline", -1)
216
+ ])]),
217
+ _: 1
218
+ })
219
+ ]),
220
+ _: 1
221
+ }, 16, ["onClick"])) : A("", !0)
222
+ ]),
223
+ default: o(() => [
224
+ D("span", Xe, y(l.selectedLang[l.lang].delete), 1)
225
+ ]),
226
+ _: 2
227
+ }, 1024),
228
+ s(F, { right: "" }, {
229
+ activator: o(({ props: E }) => [
230
+ l.editPermission ? (d(), v(T, R({
231
+ key: 0,
232
+ text: "",
233
+ fab: ""
234
+ }, { ref_for: !0 }, E, {
235
+ onClick: (Y) => M($, X)
236
+ }), {
237
+ default: o(() => [
238
+ s(r, { color: "green" }, {
239
+ default: o(() => [...a[4] || (a[4] = [
240
+ _("mdi-pencil-outline", -1)
241
+ ])]),
242
+ _: 1
243
+ })
244
+ ]),
245
+ _: 1
246
+ }, 16, ["onClick"])) : A("", !0)
247
+ ]),
248
+ default: o(() => [
249
+ D("span", Ye, y(l.selectedLang[l.lang].edit), 1)
250
+ ]),
251
+ _: 2
252
+ }, 1024),
253
+ s(N),
254
+ B($.file) ? (d(), v(T, {
255
+ key: 0,
256
+ icon: "",
257
+ onClick: (E) => j($.file)
258
+ }, {
259
+ default: o(() => [
260
+ s(r, null, {
261
+ default: o(() => [
262
+ _(y($.file.showDetailState ? "mdi-chevron-up" : "mdi-chevron-down"), 1)
263
+ ]),
264
+ _: 2
265
+ }, 1024)
266
+ ]),
267
+ _: 2
268
+ }, 1032, ["onClick"])) : A("", !0)
269
+ ]),
270
+ _: 2
271
+ }, 1024),
272
+ s(le, null, {
273
+ default: o(() => [
274
+ B($.file) ? pe((d(), w("div", Ge, [
275
+ s(b),
276
+ $.file.tags.length ? (d(), v(ee, {
277
+ key: 0,
278
+ multiple: "",
279
+ "active-class": "primary--text",
280
+ class: "pa-2"
281
+ }, {
282
+ default: o(() => [
283
+ (d(!0), w(H, null, W($.file.tags, (E, Y) => (d(), v(x, {
284
+ key: `tag-${Y}`,
285
+ class: "ma-1"
286
+ }, {
287
+ default: o(() => [
288
+ _(y(E), 1)
289
+ ]),
290
+ _: 2
291
+ }, 1024))), 128))
292
+ ]),
293
+ _: 2
294
+ }, 1024)) : A("", !0),
295
+ $.file.description ? (d(), v(q, {
296
+ key: 1,
297
+ class: "text-justify"
298
+ }, {
299
+ default: o(() => [
300
+ _(y($.file.description), 1)
301
+ ]),
302
+ _: 2
303
+ }, 1024)) : A("", !0)
304
+ ], 512)), [
305
+ [ge, $.file.showDetailState]
306
+ ]) : A("", !0)
307
+ ]),
308
+ _: 2
309
+ }, 1024)
310
+ ]),
311
+ _: 2
312
+ }, 1032, ["shaped", "outlined", "raised", "tile"])
313
+ ]),
314
+ _: 2
315
+ }, 1032, ["md"]))), 128))
316
+ ]),
317
+ _: 1
318
+ })
319
+ ]);
320
+ };
321
+ }
322
+ }), Ke = {
323
+ class: "text-left",
324
+ style: { width: "80px" }
325
+ }, Je = { class: "text-center" }, Qe = {
326
+ class: "text-left",
327
+ style: { width: "120px" }
328
+ }, Ze = {
329
+ class: "text-left",
330
+ style: { width: "120px" }
331
+ }, et = { class: "text-center pa-3" }, tt = { class: "text-left pa-3" }, lt = { class: "text-left pa-3" }, ot = { class: "text-center pa-2" }, nt = { class: "d-flex justify-center ga-1" }, at = /* @__PURE__ */ J({
332
+ __name: "TableUploader",
333
+ props: {
334
+ documentAttachment: {},
335
+ thumb: { type: Boolean, default: !0 },
336
+ lang: { default: "en" },
337
+ cols: { default: 4 },
338
+ editPermission: { type: Boolean, default: !0 },
339
+ deletePermission: { type: Boolean, default: !0 },
340
+ tableThumbColumn: { type: Boolean },
341
+ tableFixedHeader: { type: Boolean, default: !0 },
342
+ tableHeight: { default: 400 },
343
+ selectedLang: {}
344
+ },
345
+ emits: ["openDeleteDialog", "openEditDocumentDialog"],
346
+ setup(l, { emit: i }) {
347
+ const t = l, e = i, m = (g) => g ? re(g) : !1, C = (g) => {
348
+ const h = g / 1e3, U = h / 1024;
349
+ return U >= 1 ? `${U.toFixed(1)} MB` : `${h.toFixed(1)} KB`;
350
+ }, V = (g) => {
351
+ const h = g / 1024e3;
352
+ return h < 1 ? "success" : h < 5 ? "warning" : "error";
353
+ }, k = (g, h) => {
354
+ e("openDeleteDialog", g, h);
355
+ }, z = (g, h) => {
356
+ e("openEditDocumentDialog", g, h);
357
+ };
358
+ return (g, h) => {
359
+ const U = f("v-img"), L = f("v-icon"), B = f("v-tooltip"), j = f("v-chip"), I = f("v-btn"), M = f("v-table"), u = f("v-col"), n = f("v-row");
360
+ return d(), w("div", null, [
361
+ s(n, null, {
362
+ default: o(() => [
363
+ s(u, { cols: "12" }, {
364
+ default: o(() => [
365
+ s(M, {
366
+ "fixed-header": t.tableFixedHeader,
367
+ height: t.tableHeight + "px",
368
+ class: "elevation-1"
369
+ }, {
370
+ default: o(() => [
371
+ D("thead", null, [
372
+ D("tr", null, [
373
+ D("th", Ke, y(t.selectedLang[l.lang].table.thumb), 1),
374
+ D("th", Je, y(t.selectedLang[l.lang].table.name), 1),
375
+ D("th", Qe, y(t.selectedLang[l.lang].table.size), 1),
376
+ D("th", Ze, y(t.selectedLang[l.lang].table.action.action), 1)
377
+ ])
378
+ ]),
379
+ D("tbody", null, [
380
+ (d(!0), w(H, null, W(t.documentAttachment, (a, r) => (d(), w("tr", {
381
+ key: `attachment-${r}`,
382
+ class: "table-row"
383
+ }, [
384
+ D("td", et, [
385
+ s(B, { location: "top" }, {
386
+ activator: o(({ props: c }) => [
387
+ D("div", R({
388
+ class: "d-flex justify-center align-center",
389
+ style: { height: "60px", width: "60px" }
390
+ }, { ref_for: !0 }, c), [
391
+ m(a.file.name) ? (d(), w(H, { key: 0 }, [
392
+ t.thumb && a.file.base64 ? (d(), v(U, {
393
+ key: 0,
394
+ style: { height: "40px", width: "40px" },
395
+ src: "data:" + a.file.format + ";base64," + a.file.base64,
396
+ height: "40",
397
+ width: "40",
398
+ class: "rounded",
399
+ contain: ""
400
+ }, null, 8, ["src"])) : (d(), v(L, {
401
+ key: 1,
402
+ size: "40",
403
+ color: "deep-purple"
404
+ }, {
405
+ default: o(() => [...h[0] || (h[0] = [
406
+ _(" mdi-file-image-outline ", -1)
407
+ ])]),
408
+ _: 1
409
+ }))
410
+ ], 64)) : (d(), v(L, {
411
+ key: 1,
412
+ icon: G(ue)(a.file.name),
413
+ color: G(de)(a.file.name),
414
+ size: "40"
415
+ }, null, 8, ["icon", "color"]))
416
+ ], 16)
417
+ ]),
418
+ default: o(() => [
419
+ D("span", null, y(a.file.name), 1)
420
+ ]),
421
+ _: 2
422
+ }, 1024)
423
+ ]),
424
+ D("td", tt, [
425
+ s(B, { location: "top" }, {
426
+ activator: o(({ props: c }) => [
427
+ D("span", R({ ref_for: !0 }, c), y((() => {
428
+ const x = a.file.name.split(".").pop(), b = a.file.name.slice(0, a.file.name.lastIndexOf("."));
429
+ return `${b.length > 10 ? b.slice(0, 10) + "..." : b}.${x}`;
430
+ })()), 17)
431
+ ]),
432
+ default: o(() => [
433
+ D("span", null, y(a.file.name), 1)
434
+ ]),
435
+ _: 2
436
+ }, 1024)
437
+ ]),
438
+ D("td", lt, [
439
+ s(j, {
440
+ color: V(a.file.size),
441
+ variant: "tonal",
442
+ size: "small",
443
+ class: "text-caption"
444
+ }, {
445
+ default: o(() => [
446
+ _(y(C(a.file.size)), 1)
447
+ ]),
448
+ _: 2
449
+ }, 1032, ["color"])
450
+ ]),
451
+ D("td", ot, [
452
+ D("div", nt, [
453
+ l.editPermission ? (d(), v(B, {
454
+ key: 0,
455
+ location: "top"
456
+ }, {
457
+ activator: o(({ props: c }) => [
458
+ s(I, R({
459
+ icon: "",
460
+ size: "small",
461
+ color: "success",
462
+ variant: "text"
463
+ }, { ref_for: !0 }, c, {
464
+ onClick: (x) => z(a, r)
465
+ }), {
466
+ default: o(() => [
467
+ s(L, { size: "18" }, {
468
+ default: o(() => [...h[1] || (h[1] = [
469
+ _("mdi-pencil-outline", -1)
470
+ ])]),
471
+ _: 1
472
+ })
473
+ ]),
474
+ _: 1
475
+ }, 16, ["onClick"])
476
+ ]),
477
+ default: o(() => [
478
+ D("span", null, y(l.selectedLang[l.lang].edit), 1)
479
+ ]),
480
+ _: 2
481
+ }, 1024)) : A("", !0),
482
+ l.deletePermission ? (d(), v(B, {
483
+ key: 1,
484
+ location: "top"
485
+ }, {
486
+ activator: o(({ props: c }) => [
487
+ s(I, R({
488
+ icon: "",
489
+ size: "small",
490
+ color: "error",
491
+ variant: "text"
492
+ }, { ref_for: !0 }, c, {
493
+ onClick: (x) => k(r, "")
494
+ }), {
495
+ default: o(() => [
496
+ s(L, { size: "18" }, {
497
+ default: o(() => [...h[2] || (h[2] = [
498
+ _("mdi-delete", -1)
499
+ ])]),
500
+ _: 1
501
+ })
502
+ ]),
503
+ _: 1
504
+ }, 16, ["onClick"])
505
+ ]),
506
+ default: o(() => [
507
+ D("span", null, y(l.selectedLang[l.lang].table.action.deleteTooltip), 1)
508
+ ]),
509
+ _: 2
510
+ }, 1024)) : A("", !0)
511
+ ])
512
+ ])
513
+ ]))), 128))
514
+ ])
515
+ ]),
516
+ _: 1
517
+ }, 8, ["fixed-header", "height"])
518
+ ]),
519
+ _: 1
520
+ })
521
+ ]),
522
+ _: 1
523
+ })
524
+ ]);
525
+ };
526
+ }
527
+ }), ve = (l, i) => {
528
+ const t = l.__vccOpts || l;
529
+ for (const [e, m] of i)
530
+ t[e] = m;
531
+ return t;
532
+ }, be = /* @__PURE__ */ ve(at, [["__scopeId", "data-v-d05b814b"]]), it = {
533
+ class: "d-flex align-center pa-3",
534
+ style: { height: "100%" }
535
+ }, st = {
536
+ class: "flex-grow-1 pr-4",
537
+ style: { "max-width": "60%" }
538
+ }, rt = {
539
+ class: "text-subtitle-1 font-weight-medium mb-2",
540
+ style: { overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap", "max-width": "100%" }
541
+ }, dt = {
542
+ class: "flex-shrink-0",
543
+ style: { "min-width": "80px" }
544
+ }, ut = {
545
+ key: 0,
546
+ class: "thumbnail-container"
547
+ }, ct = {
548
+ key: 1,
549
+ class: "d-flex align-center justify-center"
550
+ }, mt = { class: "d-flex gap-2 pb-1" }, ft = /* @__PURE__ */ J({
551
+ __name: "SimpleUploader",
552
+ props: {
553
+ documentAttachment: {},
554
+ lang: { default: "en" },
555
+ thumb: { type: Boolean, default: !0 },
556
+ cols: { default: 4 },
557
+ editPermission: { type: Boolean, default: !0 },
558
+ cardType: {},
559
+ outlined: { type: Boolean },
560
+ raised: { type: Boolean },
561
+ shaped: { type: Boolean },
562
+ tile: { type: Boolean },
563
+ deletePermission: { type: Boolean, default: !0 },
564
+ selectedLang: {}
565
+ },
566
+ emits: ["setCardTheme", "openDeleteDialog", "openEditDocumentDialog"],
567
+ setup(l, { emit: i }) {
568
+ const t = l, e = i, m = (g) => {
569
+ const h = g / 1e3;
570
+ return h < 1024 ? `${h.toFixed(1)} ${t.selectedLang[t.lang].size.kb}` : `${(h / 1024).toFixed(1)} ${t.selectedLang[t.lang].size.mb}`;
571
+ }, C = (g) => {
572
+ var h;
573
+ return ["jpg", "jpeg", "png", "tif", "bmp"].includes(((h = g.split(".").pop()) == null ? void 0 : h.toLowerCase()) || "");
574
+ }, V = (g) => g.base64 ? g.base64.startsWith("data:") ? g.base64 : `data:${g.format};base64,${g.base64}` : "", k = (g, h) => e("openDeleteDialog", g, h), z = (g, h) => e("openEditDocumentDialog", g, h);
575
+ return (g, h) => {
576
+ const U = f("v-icon"), L = f("v-chip"), B = f("v-img"), j = f("v-divider"), I = f("v-btn"), M = f("v-tooltip"), u = f("v-chip-group"), n = f("v-card-text"), a = f("v-expand-transition"), r = f("v-card"), c = f("v-col"), x = f("v-row");
577
+ return d(), w("div", null, [
578
+ s(x, null, {
579
+ default: o(() => [
580
+ (d(!0), w(H, null, W(t.documentAttachment, (b, T) => (d(), v(c, {
581
+ key: `attachment-${T}`,
582
+ cols: "12",
583
+ sm: "6",
584
+ md: "4",
585
+ lg: "3"
586
+ }, {
587
+ default: o(() => [
588
+ s(r, {
589
+ class: "file-card",
590
+ shaped: t.shaped,
591
+ outlined: t.outlined,
592
+ raised: t.raised,
593
+ tile: t.tile,
594
+ height: "180"
595
+ }, {
596
+ default: o(() => [
597
+ D("div", it, [
598
+ D("div", st, [
599
+ D("div", rt, y(b.file.name), 1),
600
+ s(L, {
601
+ color: "teal",
602
+ variant: "flat",
603
+ size: "small",
604
+ class: "text-white mb-2"
605
+ }, {
606
+ default: o(() => [
607
+ s(U, {
608
+ start: "",
609
+ size: "16"
610
+ }, {
611
+ default: o(() => [...h[0] || (h[0] = [
612
+ _("mdi-harddisk", -1)
613
+ ])]),
614
+ _: 1
615
+ }),
616
+ _(" " + y(m(b.file.size)), 1)
617
+ ]),
618
+ _: 2
619
+ }, 1024)
620
+ ]),
621
+ D("div", dt, [
622
+ C(b.file.name) && t.thumb ? (d(), w("div", ut, [
623
+ s(B, {
624
+ src: V(b.file),
625
+ height: "80",
626
+ width: "80",
627
+ cover: "",
628
+ class: "rounded"
629
+ }, null, 8, ["src"])
630
+ ])) : (d(), w("div", ct, [
631
+ s(U, {
632
+ color: G(de)(b.file.name),
633
+ size: "60"
634
+ }, {
635
+ default: o(() => [
636
+ _(y(G(ue)(b.file.name)), 1)
637
+ ]),
638
+ _: 2
639
+ }, 1032, ["color"])
640
+ ]))
641
+ ])
642
+ ]),
643
+ s(j, { class: "my-2" }),
644
+ D("div", mt, [
645
+ s(M, { bottom: "" }, {
646
+ activator: o(({ props: F }) => [
647
+ t.deletePermission ? (d(), v(I, R({
648
+ key: 0,
649
+ icon: "",
650
+ variant: "text",
651
+ size: "small"
652
+ }, { ref_for: !0 }, F, {
653
+ onClick: (N) => k(T, "")
654
+ }), {
655
+ default: o(() => [
656
+ s(U, {
657
+ color: "red",
658
+ size: "20"
659
+ }, {
660
+ default: o(() => [...h[1] || (h[1] = [
661
+ _("mdi-delete-outline", -1)
662
+ ])]),
663
+ _: 1
664
+ })
665
+ ]),
666
+ _: 1
667
+ }, 16, ["onClick"])) : A("", !0)
668
+ ]),
669
+ default: o(() => [
670
+ D("span", null, y(t.selectedLang[l.lang].delete), 1)
671
+ ]),
672
+ _: 2
673
+ }, 1024),
674
+ s(M, { bottom: "" }, {
675
+ activator: o(({ props: F }) => [
676
+ t.editPermission ? (d(), v(I, R({
677
+ key: 0,
678
+ icon: "",
679
+ variant: "text",
680
+ size: "small"
681
+ }, { ref_for: !0 }, F, {
682
+ onClick: (N) => z(b, T)
683
+ }), {
684
+ default: o(() => [
685
+ s(U, {
686
+ color: "green",
687
+ size: "20"
688
+ }, {
689
+ default: o(() => [...h[2] || (h[2] = [
690
+ _("mdi-pencil-outline", -1)
691
+ ])]),
692
+ _: 1
693
+ })
694
+ ]),
695
+ _: 1
696
+ }, 16, ["onClick"])) : A("", !0)
697
+ ]),
698
+ default: o(() => [
699
+ D("span", null, y(t.selectedLang[l.lang].edit), 1)
700
+ ]),
701
+ _: 2
702
+ }, 1024)
703
+ ]),
704
+ s(a, null, {
705
+ default: o(() => [
706
+ pe(D("div", null, [
707
+ s(j),
708
+ b.file.tags.length ? (d(), v(u, {
709
+ key: 0,
710
+ multiple: "",
711
+ "active-class": "primary--text",
712
+ style: { padding: "8px" }
713
+ }, {
714
+ default: o(() => [
715
+ (d(!0), w(H, null, W(b.file.tags, (F, N) => (d(), v(L, {
716
+ key: `tag-${N}`,
717
+ style: { margin: "5px" }
718
+ }, {
719
+ default: o(() => [
720
+ _(y(F), 1)
721
+ ]),
722
+ _: 2
723
+ }, 1024))), 128))
724
+ ]),
725
+ _: 2
726
+ }, 1024)) : A("", !0),
727
+ b.file.description ? (d(), v(n, {
728
+ key: 1,
729
+ style: { "text-align": "justify" }
730
+ }, {
731
+ default: o(() => [
732
+ _(y(b.file.description), 1)
733
+ ]),
734
+ _: 2
735
+ }, 1024)) : A("", !0)
736
+ ], 512), [
737
+ [ge, b.file.showDetailState]
738
+ ])
739
+ ]),
740
+ _: 2
741
+ }, 1024)
742
+ ]),
743
+ _: 2
744
+ }, 1032, ["shaped", "outlined", "raised", "tile"])
745
+ ]),
746
+ _: 2
747
+ }, 1024))), 128))
748
+ ]),
749
+ _: 1
750
+ })
751
+ ]);
752
+ };
753
+ }
754
+ }), _e = /* @__PURE__ */ ve(ft, [["__scopeId", "data-v-f7000da4"]]), ye = /* @__PURE__ */ J({
755
+ __name: "InsertButton",
756
+ props: {
757
+ documentAttachment: {},
758
+ badgeCounter: { type: Boolean },
759
+ btnColor: {},
760
+ lang: {},
761
+ maxFileCount: {},
762
+ selectedLang: {}
763
+ },
764
+ emits: ["openInputDocumentModal"],
765
+ setup(l, { emit: i }) {
766
+ const t = i, e = l, m = Q(() => e.documentAttachment.length >= e.maxFileCount), C = () => {
767
+ t("openInputDocumentModal");
768
+ };
769
+ return (V, k) => {
770
+ const z = f("v-btn"), g = f("v-badge");
771
+ return d(), w("div", null, [
772
+ e.badgeCounter ? (d(), w(H, { key: 0 }, [
773
+ e.documentAttachment.length > 0 ? (d(), v(g, {
774
+ key: 0,
775
+ bordered: "",
776
+ color: m.value ? "error" : "success",
777
+ overlap: "",
778
+ content: l.documentAttachment.length
779
+ }, {
780
+ default: o(() => [
781
+ s(z, {
782
+ color: e.btnColor,
783
+ disabled: m.value,
784
+ onClick: C,
785
+ class: "mb-4"
786
+ }, {
787
+ default: o(() => [
788
+ _(y(e.selectedLang[l.lang].insertFile), 1)
789
+ ]),
790
+ _: 1
791
+ }, 8, ["color", "disabled"])
792
+ ]),
793
+ _: 1
794
+ }, 8, ["color", "content"])) : (d(), v(z, {
795
+ key: 1,
796
+ color: e.btnColor,
797
+ disabled: m.value,
798
+ onClick: C,
799
+ class: "mb-4"
800
+ }, {
801
+ default: o(() => [
802
+ _(y(e.selectedLang[l.lang].insertFile), 1)
803
+ ]),
804
+ _: 1
805
+ }, 8, ["color", "disabled"]))
806
+ ], 64)) : A("", !0),
807
+ e.badgeCounter ? A("", !0) : (d(), v(z, {
808
+ key: 1,
809
+ color: l.btnColor,
810
+ disabled: m.value,
811
+ onClick: C,
812
+ class: "mb-4"
813
+ }, {
814
+ default: o(() => [
815
+ _(y(e.selectedLang[l.lang].insertFile), 1)
816
+ ]),
817
+ _: 1
818
+ }, 8, ["color", "disabled"]))
819
+ ]);
820
+ };
821
+ }
822
+ });
823
+ function pt(l) {
824
+ const i = ["simple", "thumbnail", "table"], t = { isValid: !0, errors: [], warnings: [] };
825
+ return typeof l != "string" ? (t.isValid = !1, t.errors.push("File uploader type must be a string")) : i.includes(l) || (t.isValid = !1, t.errors.push(`File uploader type must be one of: ${i.join(", ")}`)), t;
826
+ }
827
+ function gt(l) {
828
+ const i = ["default", "outlined", "shaped", "raised", "tile"], t = { isValid: !0, errors: [], warnings: [] };
829
+ return l !== void 0 && typeof l != "string" ? (t.isValid = !1, t.errors.push("Card type must be a string")) : l && !i.includes(l) && (t.isValid = !1, t.errors.push(`Card type must be one of: ${i.join(", ")}`)), t;
830
+ }
831
+ function ht(l) {
832
+ const i = ["en", "fa", "fr", "ch", "ar"], t = { isValid: !0, errors: [], warnings: [] };
833
+ return typeof l != "string" ? (t.isValid = !1, t.errors.push("Language code must be a string")) : i.includes(l) || (t.isValid = !1, t.errors.push(`Language code must be one of: ${i.join(", ")}`)), t;
834
+ }
835
+ function vt(l) {
836
+ const i = { isValid: !0, errors: [], warnings: [] };
837
+ return typeof l != "number" ? (i.isValid = !1, i.errors.push("File size must be a number")) : l <= 0 ? (i.isValid = !1, i.errors.push("File size must be greater than 0")) : l > 100 * 1024 * 1024 && i.warnings.push("File size limit is very large (>100MB), consider reducing for better performance"), i;
838
+ }
839
+ function bt(l) {
840
+ const i = { isValid: !0, errors: [], warnings: [] };
841
+ return typeof l != "number" ? (i.isValid = !1, i.errors.push("File count must be a number")) : l < 0 ? (i.isValid = !1, i.errors.push("File count cannot be negative")) : l > 100 && i.warnings.push("File count limit is very high (>100), consider reducing for better performance"), i;
842
+ }
843
+ function _t(l) {
844
+ const i = { isValid: !0, errors: [], warnings: [] };
845
+ return typeof l != "number" ? (i.isValid = !1, i.errors.push("Compression level must be a number")) : l < 0 || l > 1 ? (i.isValid = !1, i.errors.push("Compression level must be between 0 and 1")) : l < 0.1 ? i.warnings.push("Very low compression level may result in poor image quality") : l > 0.9 && i.warnings.push("Very high compression level may not reduce file size significantly"), i;
846
+ }
847
+ function yt(l) {
848
+ const i = { isValid: !0, errors: [], warnings: [] };
849
+ return l !== void 0 && typeof l != "string" ? (i.isValid = !1, i.errors.push("File accept pattern must be a string")) : l && l.trim() === "" && i.warnings.push("Empty file accept pattern will accept all files"), i;
850
+ }
851
+ function xt(l) {
852
+ const i = { isValid: !0, errors: [], warnings: [] };
853
+ return typeof l != "number" ? (i.isValid = !1, i.errors.push("Columns count must be a number")) : (l < 1 || l > 12) && (i.isValid = !1, i.errors.push("Columns count must be between 1 and 12")), i;
854
+ }
855
+ function Ft(l) {
856
+ const i = { isValid: !0, errors: [], warnings: [] };
857
+ return l !== void 0 && typeof l != "number" ? (i.isValid = !1, i.errors.push("Table height must be a number")) : l && l < 100 ? i.warnings.push("Table height is very small (<100px), content may not be visible") : l && l > 1e3 && i.warnings.push("Table height is very large (>1000px), consider reducing for better UX"), i;
858
+ }
859
+ function Dt(l) {
860
+ const i = { isValid: !0, errors: [], warnings: [] };
861
+ return Array.isArray(l) ? (l.forEach((t, e) => {
862
+ if (!t || typeof t != "object") {
863
+ i.errors.push(`Attachment at index ${e} must be an object`);
864
+ return;
865
+ }
866
+ if (!t.file || typeof t.file != "object") {
867
+ i.errors.push(`Attachment at index ${e} must have a file property`);
868
+ return;
869
+ }
870
+ const m = t.file;
871
+ ["name", "format", "base64", "size"].forEach((V) => {
872
+ V in m || i.errors.push(`File at index ${e} is missing required field: ${V}`);
873
+ }), m.name && typeof m.name != "string" && i.errors.push(`File name at index ${e} must be a string`), m.format && typeof m.format != "string" && i.errors.push(`File format at index ${e} must be a string`), m.base64 && typeof m.base64 != "string" && i.errors.push(`File base64 at index ${e} must be a string`), m.size && typeof m.size != "number" && i.errors.push(`File size at index ${e} must be a number`), m.tags && !Array.isArray(m.tags) && i.errors.push(`File tags at index ${e} must be an array`);
874
+ }), i.errors.length > 0 && (i.isValid = !1), i) : (i.isValid = !1, i.errors.push("Document attachment must be an array"), i);
875
+ }
876
+ function Ct(l) {
877
+ const i = { isValid: !0, errors: [], warnings: [] };
878
+ return [
879
+ { key: "fileUploaderType", validator: pt },
880
+ { key: "cardType", validator: gt },
881
+ { key: "lang", validator: ht },
882
+ { key: "maxFileSize", validator: vt },
883
+ { key: "maxFileCount", validator: bt },
884
+ { key: "imageCompressLevel", validator: _t },
885
+ { key: "fileAccept", validator: yt },
886
+ { key: "cols", validator: xt },
887
+ { key: "tableHeight", validator: Ft },
888
+ { key: "documentAttachment", validator: Dt }
889
+ ].forEach(({ key: e, validator: m }) => {
890
+ if (e in l) {
891
+ const C = m(l[e]);
892
+ i.errors.push(...C.errors.map((V) => `${e}: ${V}`)), i.warnings.push(...C.warnings.map((V) => `${e}: ${V}`)), C.isValid || (i.isValid = !1);
893
+ }
894
+ }), i;
895
+ }
896
+ const kt = /* @__PURE__ */ J({
897
+ __name: "handyUploader",
898
+ props: {
899
+ documentAttachment: {},
900
+ lang: { default: "en" },
901
+ maxFileSize: { default: 5242880 },
902
+ fileUploaderType: { default: "thumbnail" },
903
+ maxFileCount: { default: 10 },
904
+ badgeCounter: { type: Boolean, default: !0 },
905
+ btnColor: { default: "info" },
906
+ imageCompressor: { type: Boolean },
907
+ imageCompressLevel: { default: 0.8 },
908
+ fileAccept: {},
909
+ thumb: { type: Boolean, default: !0 },
910
+ tableThumbColumn: { type: Boolean },
911
+ tableFixedHeader: { type: Boolean, default: !0 },
912
+ tableHeight: { default: 400 },
913
+ rtlSupport: { type: Boolean, default: !1 },
914
+ changeFileName: { type: Boolean, default: !1 },
915
+ addFileDescription: { type: Boolean, default: !1 },
916
+ addFileTag: { type: Boolean, default: !1 },
917
+ tags: {},
918
+ customLang: { default: null },
919
+ insertPermission: { type: Boolean, default: !0 },
920
+ cols: { default: 3 },
921
+ editPermission: { type: Boolean, default: !0 },
922
+ deletePermission: { type: Boolean, default: !0 },
923
+ cardType: { default: "default" },
924
+ outlined: { type: Boolean },
925
+ raised: { type: Boolean },
926
+ shaped: { type: Boolean },
927
+ tile: { type: Boolean }
928
+ },
929
+ emits: [
930
+ "updateCardType",
931
+ "updateBadgeCounter",
932
+ "updateMaxFileCount",
933
+ "updateMaxFileSize",
934
+ "updateImageCompressor",
935
+ "updateImageCompressLevel",
936
+ "updateFileAccept",
937
+ "updateThumb",
938
+ "updateChangeFileName",
939
+ "updateAddFileDescription",
940
+ "updateTableThumbColumn",
941
+ "updateTableFixedHeader",
942
+ "updateTableHeight",
943
+ "updateLang",
944
+ "updateDocumentAttachment"
945
+ ],
946
+ setup(l, { emit: i }) {
947
+ const t = l;
948
+ if (process.env.NODE_ENV === "development") {
949
+ const u = Ct(t);
950
+ u.isValid || console.error("HandyUploader prop validation failed:", u.errors), u.warnings.length > 0 && console.warn("HandyUploader prop validation warnings:", u.warnings);
951
+ }
952
+ const e = we({
953
+ insertDocumentDialog: !1,
954
+ editDocumentDialog: !1,
955
+ deleteDocumentDialog: !1,
956
+ tempAttachment: [],
957
+ tempAttachmentChanged: [],
958
+ fileUploaderSnackBarAlert: !1,
959
+ fileUploaderSnackText: "",
960
+ fileUploaderSnackBarAlertColor: "green",
961
+ readerFile: null,
962
+ registryDocFile: [],
963
+ documentAttachmentAPI: [],
964
+ btnLoader: !1,
965
+ showDetail: !1,
966
+ showDetailState: [],
967
+ selectedIndex: 0,
968
+ selectedId: "",
969
+ returnedRecord: {},
970
+ outlined: !1,
971
+ raised: !1,
972
+ shaped: !1,
973
+ tile: !1,
974
+ selectedLang: {},
975
+ beforeInsertAttachments: {},
976
+ attachmentIndex: 0
977
+ }), m = i;
978
+ $e(() => {
979
+ k(), e.registryDocFile = t.documentAttachment, t.rtlSupport && z(), g();
980
+ });
981
+ let C = 0;
982
+ S(
983
+ () => e.tempAttachment,
984
+ async (u) => {
985
+ const n = ++C;
986
+ if (u && u.length > 0) {
987
+ e.btnLoader = !0;
988
+ const a = await ze(u);
989
+ if (n !== C || !e.insertDocumentDialog) return;
990
+ e.tempAttachmentChanged = a, e.btnLoader = !1;
991
+ } else
992
+ e.tempAttachmentChanged = [];
993
+ }
994
+ ), S(() => t.cardType, (u) => {
995
+ m("updateCardType", u), g();
996
+ }), S(() => t.badgeCounter, (u) => {
997
+ m("updateBadgeCounter", u);
998
+ }), S(() => t.maxFileCount, (u) => {
999
+ m("updateMaxFileCount", u);
1000
+ }), S(() => t.maxFileSize, (u) => {
1001
+ m("updateMaxFileSize", u);
1002
+ }), S(() => t.maxFileSize, (u) => {
1003
+ m("updateMaxFileSize", u);
1004
+ }), S(() => t.imageCompressor, (u) => {
1005
+ m("updateImageCompressor", u);
1006
+ }), S(() => t.imageCompressLevel, (u) => {
1007
+ m("updateImageCompressLevel", u);
1008
+ }), S(() => t.fileAccept, (u) => {
1009
+ m("updateFileAccept", u);
1010
+ }), S(() => t.thumb, (u) => {
1011
+ m("updateThumb", u);
1012
+ }), S(() => t.changeFileName, (u) => {
1013
+ m("updateChangeFileName", u);
1014
+ }), S(() => t.addFileDescription, (u) => {
1015
+ m("updateAddFileDescription", u);
1016
+ }), S(() => t.addFileTag, (u) => {
1017
+ m("updateAddFileDescription", u);
1018
+ }), S(() => t.tableThumbColumn, (u) => {
1019
+ m("updateTableThumbColumn", u);
1020
+ }), S(() => t.tableFixedHeader, (u) => {
1021
+ m("updateTableFixedHeader", u);
1022
+ }), S(() => t.tableHeight, (u) => {
1023
+ m("updateTableHeight", u);
1024
+ }), S(() => t.lang, (u) => {
1025
+ m("updateLang", u);
1026
+ }), Ae(() => {
1027
+ e.registryDocFile = [];
1028
+ });
1029
+ const V = () => {
1030
+ e.btnLoader = !1, e.tempAttachment = [], e.insertDocumentDialog = !0;
1031
+ }, k = () => {
1032
+ t.customLang !== null ? e.selectedLang = t.customLang : e.selectedLang = Be;
1033
+ }, z = () => {
1034
+ }, g = () => {
1035
+ const n = {
1036
+ default: { outlined: !1, raised: !1, shaped: !1, tile: !1 },
1037
+ outlined: { outlined: !0, raised: !1, shaped: !1, tile: !1 },
1038
+ shaped: { outlined: !1, raised: !1, shaped: !0, tile: !1 },
1039
+ raised: { outlined: !1, raised: !0, shaped: !1, tile: !1 },
1040
+ tile: { outlined: !1, raised: !1, shaped: !1, tile: !0 }
1041
+ }[t.cardType || "default"];
1042
+ e.outlined = n.outlined, e.raised = n.raised, e.shaped = n.shaped, e.tile = n.tile;
1043
+ }, h = (u, n) => {
1044
+ e.fileUploaderSnackText = u, e.fileUploaderSnackBarAlertColor = n, e.fileUploaderSnackBarAlert = !0;
1045
+ }, U = (u) => {
1046
+ const n = e.selectedLang[t.lang];
1047
+ switch (u.code) {
1048
+ case "maxFileCount":
1049
+ return `${n.maxFileCountAlert} ${t.maxFileCount}`;
1050
+ case "maxFileSize":
1051
+ return `${n.maxFileSizeAlert} ${Number((t.maxFileSize / (1024 * 1024)).toFixed(1))} ${n.size.mb}`;
1052
+ default:
1053
+ return "File could not be processed due to an invalid format.";
1054
+ }
1055
+ }, L = async () => {
1056
+ e.btnLoader = !0;
1057
+ const { accepted: u, errors: n } = await Ue(e.tempAttachmentChanged, {
1058
+ currentCount: t.documentAttachment.length,
1059
+ maxFileCount: t.maxFileCount,
1060
+ maxFileSize: t.maxFileSize,
1061
+ imageCompressor: t.imageCompressor,
1062
+ imageCompressLevel: t.imageCompressLevel
1063
+ });
1064
+ u.length > 0 && (e.registryDocFile.push(...u), m("updateDocumentAttachment", e.registryDocFile));
1065
+ const a = n[n.length - 1];
1066
+ a && h(U(a), "red"), e.documentAttachmentAPI = [], e.tempAttachmentChanged = [], e.insertDocumentDialog = !1, e.btnLoader = !1;
1067
+ }, B = (u, n) => {
1068
+ e.btnLoader = !1, e.selectedIndex = u, e.selectedId = n, e.deleteDocumentDialog = !0;
1069
+ }, j = () => {
1070
+ e.registryDocFile.splice(e.selectedIndex, 1), m("updateDocumentAttachment", e.registryDocFile), e.deleteDocumentDialog = !1;
1071
+ }, I = (u, n) => {
1072
+ C++, e.btnLoader = !1, e.attachmentIndex = n, e.editDocumentDialog = !0, e.tempAttachmentChanged = [u];
1073
+ }, M = () => {
1074
+ const u = [...t.documentAttachment];
1075
+ u.splice(
1076
+ e.attachmentIndex,
1077
+ 1,
1078
+ e.tempAttachmentChanged[0]
1079
+ ), m("updateDocumentAttachment", u), e.editDocumentDialog = !1;
1080
+ };
1081
+ return (u, n) => {
1082
+ const a = f("v-col"), r = f("v-row"), c = f("v-icon"), x = f("v-card-title"), b = f("v-file-input"), T = f("v-expansion-panel-title"), F = f("v-text-field"), N = f("v-textarea"), K = f("v-autocomplete"), ee = f("v-img"), q = f("v-card"), le = f("v-expansion-panel-text"), oe = f("v-expansion-panel"), ne = f("v-expansion-panels"), ae = f("v-list-item-title"), $ = f("v-list-item"), X = f("v-card-text"), E = f("v-btn"), Y = f("v-card-actions"), ie = f("v-dialog"), Fe = f("v-snackbar"), De = f("v-spacer"), Ce = f("v-container");
1083
+ return d(), v(Ce, null, {
1084
+ default: o(() => [
1085
+ s(r, null, {
1086
+ default: o(() => [
1087
+ s(a, {
1088
+ cols: "12",
1089
+ md: "12",
1090
+ xs: "12"
1091
+ }, {
1092
+ default: o(() => [
1093
+ t.insertPermission ? (d(), v(ye, {
1094
+ key: 0,
1095
+ documentAttachment: t.documentAttachment,
1096
+ selectedLang: e.selectedLang,
1097
+ lang: t.lang,
1098
+ badgeCounter: t.badgeCounter,
1099
+ btnColor: t.btnColor,
1100
+ maxFileCount: t.maxFileCount,
1101
+ onOpenInputDocumentModal: V
1102
+ }, null, 8, ["documentAttachment", "selectedLang", "lang", "badgeCounter", "btnColor", "maxFileCount"])) : A("", !0),
1103
+ t.fileUploaderType === "simple" ? (d(), v(_e, {
1104
+ key: 1,
1105
+ documentAttachment: t.documentAttachment,
1106
+ cols: t.cols,
1107
+ thumb: t.thumb,
1108
+ outlined: e.outlined,
1109
+ raised: e.raised,
1110
+ shaped: e.shaped,
1111
+ tile: e.tile,
1112
+ lang: t.lang,
1113
+ cardType: t.cardType,
1114
+ deletePermission: t.deletePermission,
1115
+ editPermission: t.editPermission,
1116
+ selectedLang: e.selectedLang,
1117
+ onSetCardTheme: g,
1118
+ onOpenDeleteDialog: B,
1119
+ onOpenEditDocumentDialog: I
1120
+ }, null, 8, ["documentAttachment", "cols", "thumb", "outlined", "raised", "shaped", "tile", "lang", "cardType", "deletePermission", "editPermission", "selectedLang"])) : A("", !0),
1121
+ t.fileUploaderType === "thumbnail" ? (d(), v(he, {
1122
+ key: 2,
1123
+ documentAttachment: t.documentAttachment,
1124
+ cols: t.cols,
1125
+ thumb: t.thumb,
1126
+ outlined: e.outlined,
1127
+ raised: e.raised,
1128
+ shaped: e.shaped,
1129
+ tile: e.tile,
1130
+ lang: t.lang,
1131
+ cardType: t.cardType,
1132
+ deletePermission: t.deletePermission,
1133
+ editPermission: t.editPermission,
1134
+ selectedLang: e.selectedLang,
1135
+ onSetCardTheme: g,
1136
+ onOpenDeleteDialog: n[0] || (n[0] = (p, O) => B(p, O)),
1137
+ onOpenEditDocumentDialog: n[1] || (n[1] = (p, O) => I(p, O))
1138
+ }, null, 8, ["documentAttachment", "cols", "thumb", "outlined", "raised", "shaped", "tile", "lang", "cardType", "deletePermission", "editPermission", "selectedLang"])) : A("", !0),
1139
+ t.fileUploaderType === "table" ? (d(), v(be, {
1140
+ key: 3,
1141
+ documentAttachment: t.documentAttachment,
1142
+ cols: t.cols,
1143
+ thumb: t.thumb,
1144
+ outlined: e.outlined,
1145
+ raised: e.raised,
1146
+ shaped: e.shaped,
1147
+ tile: e.tile,
1148
+ lang: t.lang,
1149
+ tableThumbColumn: t.tableThumbColumn,
1150
+ tableFixedHeader: t.tableFixedHeader,
1151
+ tableHeight: t.tableHeight,
1152
+ cardType: t.cardType,
1153
+ deletePermission: t.deletePermission,
1154
+ editPermission: t.editPermission,
1155
+ selectedLang: e.selectedLang,
1156
+ onSetCardTheme: g,
1157
+ onOpenDeleteDialog: B,
1158
+ onOpenEditDocumentDialog: I
1159
+ }, null, 8, ["documentAttachment", "cols", "thumb", "outlined", "raised", "shaped", "tile", "lang", "tableThumbColumn", "tableFixedHeader", "tableHeight", "cardType", "deletePermission", "editPermission", "selectedLang"])) : A("", !0)
1160
+ ]),
1161
+ _: 1
1162
+ })
1163
+ ]),
1164
+ _: 1
1165
+ }),
1166
+ s(r, { justify: "center" }, {
1167
+ default: o(() => [
1168
+ s(ie, {
1169
+ modelValue: e.insertDocumentDialog,
1170
+ "onUpdate:modelValue": n[5] || (n[5] = (p) => e.insertDocumentDialog = p),
1171
+ scrollable: !1,
1172
+ persistent: "",
1173
+ width: "50%"
1174
+ }, {
1175
+ default: o(() => [
1176
+ s(q, null, {
1177
+ default: o(() => [
1178
+ s(x, null, {
1179
+ default: o(() => [
1180
+ s(c, {
1181
+ onClick: n[2] || (n[2] = (p) => e.insertDocumentDialog = !1)
1182
+ }, {
1183
+ default: o(() => [...n[12] || (n[12] = [
1184
+ _("mdi-close", -1)
1185
+ ])]),
1186
+ _: 1
1187
+ })
1188
+ ]),
1189
+ _: 1
1190
+ }),
1191
+ s(X, null, {
1192
+ default: o(() => [
1193
+ e.tempAttachment.length === 0 ? (d(), w(H, { key: 0 }, [
1194
+ t.fileAccept !== "" ? (d(), v(b, {
1195
+ key: 0,
1196
+ multiple: "",
1197
+ accept: t.fileAccept,
1198
+ chip: "",
1199
+ modelValue: e.tempAttachment,
1200
+ "onUpdate:modelValue": n[3] || (n[3] = (p) => e.tempAttachment = p),
1201
+ label: e.selectedLang[l.lang].insertNewFile
1202
+ }, null, 8, ["accept", "modelValue", "label"])) : (d(), v(b, {
1203
+ key: 1,
1204
+ multiple: "",
1205
+ modelValue: e.tempAttachment,
1206
+ "onUpdate:modelValue": n[4] || (n[4] = (p) => e.tempAttachment = p),
1207
+ label: e.selectedLang[l.lang].insertNewFile
1208
+ }, null, 8, ["modelValue", "label"]))
1209
+ ], 64)) : (d(), w(H, { key: 1 }, [
1210
+ t.addFileTag || t.addFileDescription || t.changeFileName ? (d(), v(ne, { key: 0 }, {
1211
+ default: o(() => [
1212
+ (d(!0), w(H, null, W(e.tempAttachmentChanged, (p, O) => (d(), v(oe, {
1213
+ key: `attachment-${O}`
1214
+ }, {
1215
+ default: o(() => [
1216
+ s(T, null, {
1217
+ default: o(() => [
1218
+ _(y(p.file.name), 1)
1219
+ ]),
1220
+ _: 2
1221
+ }, 1024),
1222
+ s(le, null, {
1223
+ default: o(() => [
1224
+ s(r, {
1225
+ align: "center",
1226
+ justify: "center"
1227
+ }, {
1228
+ default: o(() => [
1229
+ s(a, {
1230
+ cols: "12",
1231
+ lg: "9",
1232
+ md: "9",
1233
+ xs: "12"
1234
+ }, {
1235
+ default: o(() => [
1236
+ t.changeFileName ? (d(), v(F, {
1237
+ key: 0,
1238
+ label: e.selectedLang[l.lang].fileName,
1239
+ modelValue: p.file.name,
1240
+ "onUpdate:modelValue": (P) => p.file.name = P
1241
+ }, null, 8, ["label", "modelValue", "onUpdate:modelValue"])) : A("", !0),
1242
+ t.addFileDescription ? (d(), v(N, {
1243
+ key: 1,
1244
+ label: e.selectedLang[l.lang].fileDescription,
1245
+ "auto-grow": "",
1246
+ "row-height": "1",
1247
+ modelValue: p.file.description,
1248
+ "onUpdate:modelValue": (P) => p.file.description = P
1249
+ }, null, 8, ["label", "modelValue", "onUpdate:modelValue"])) : A("", !0),
1250
+ t.addFileTag ? (d(), v(K, {
1251
+ key: 2,
1252
+ modelValue: p.file.tags,
1253
+ "onUpdate:modelValue": (P) => p.file.tags = P,
1254
+ items: t.tags,
1255
+ dense: "",
1256
+ chips: "",
1257
+ label: e.selectedLang[l.lang].fileTags,
1258
+ multiple: ""
1259
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "items", "label"])) : A("", !0)
1260
+ ]),
1261
+ _: 2
1262
+ }, 1024),
1263
+ s(a, {
1264
+ align: "center",
1265
+ cols: "12",
1266
+ lg: "3",
1267
+ md: "3",
1268
+ xs: "12"
1269
+ }, {
1270
+ default: o(() => [
1271
+ p.file.format === "jpg" || p.file.format === "jpeg" || p.file.format === "png" || p.file.format === "tif" || p.file.format === "bmp" ? (d(), v(q, { key: 0 }, {
1272
+ default: o(() => [
1273
+ s(ee, {
1274
+ src: "data:" + p.file.format + ";base64," + p.file.base64
1275
+ }, null, 8, ["src"])
1276
+ ]),
1277
+ _: 2
1278
+ }, 1024)) : (d(), v(te, {
1279
+ key: 1,
1280
+ "file-format": p.file.format,
1281
+ size: 60
1282
+ }, null, 8, ["file-format"]))
1283
+ ]),
1284
+ _: 2
1285
+ }, 1024)
1286
+ ]),
1287
+ _: 2
1288
+ }, 1024)
1289
+ ]),
1290
+ _: 2
1291
+ }, 1024)
1292
+ ]),
1293
+ _: 2
1294
+ }, 1024))), 128))
1295
+ ]),
1296
+ _: 1
1297
+ })) : (d(), v(q, {
1298
+ key: 1,
1299
+ class: "mx-auto",
1300
+ tile: ""
1301
+ }, {
1302
+ default: o(() => [
1303
+ (d(!0), w(H, null, W(e.tempAttachmentChanged, (p, O) => (d(), v($, {
1304
+ key: `attachment-${O}`,
1305
+ style: { "border-bottom": "1px solid #E0E0E0" }
1306
+ }, {
1307
+ default: o(() => [
1308
+ s(ae, null, {
1309
+ default: o(() => [
1310
+ s(te, {
1311
+ "file-format": p.file.format,
1312
+ size: 24
1313
+ }, null, 8, ["file-format"]),
1314
+ _(" " + y(G(Se)(p.file.name, p.file.format)), 1)
1315
+ ]),
1316
+ _: 2
1317
+ }, 1024)
1318
+ ]),
1319
+ _: 2
1320
+ }, 1024))), 128))
1321
+ ]),
1322
+ _: 1
1323
+ }))
1324
+ ], 64))
1325
+ ]),
1326
+ _: 1
1327
+ }),
1328
+ s(Y, null, {
1329
+ default: o(() => [
1330
+ s(E, {
1331
+ disabled: e.tempAttachment == null || e.btnLoader,
1332
+ loading: e.btnLoader,
1333
+ color: t.btnColor,
1334
+ onClick: L
1335
+ }, {
1336
+ default: o(() => [
1337
+ _(y(e.selectedLang[l.lang].add), 1)
1338
+ ]),
1339
+ _: 1
1340
+ }, 8, ["disabled", "loading", "color"])
1341
+ ]),
1342
+ _: 1
1343
+ })
1344
+ ]),
1345
+ _: 1
1346
+ })
1347
+ ]),
1348
+ _: 1
1349
+ }, 8, ["modelValue"])
1350
+ ]),
1351
+ _: 1
1352
+ }),
1353
+ s(r, { justify: "center" }, {
1354
+ default: o(() => [
1355
+ s(ie, {
1356
+ modelValue: e.editDocumentDialog,
1357
+ "onUpdate:modelValue": n[7] || (n[7] = (p) => e.editDocumentDialog = p),
1358
+ scrollable: !1,
1359
+ persistent: "",
1360
+ width: "50%"
1361
+ }, {
1362
+ default: o(() => [
1363
+ s(q, null, {
1364
+ default: o(() => [
1365
+ s(x, null, {
1366
+ default: o(() => [
1367
+ s(c, {
1368
+ onClick: n[6] || (n[6] = (p) => e.editDocumentDialog = !1)
1369
+ }, {
1370
+ default: o(() => [...n[13] || (n[13] = [
1371
+ _("mdi-close", -1)
1372
+ ])]),
1373
+ _: 1
1374
+ })
1375
+ ]),
1376
+ _: 1
1377
+ }),
1378
+ (d(!0), w(H, null, W(e.tempAttachmentChanged, (p, O) => (d(), v(X, {
1379
+ key: `attachment-${O}`
1380
+ }, {
1381
+ default: o(() => [
1382
+ s(r, {
1383
+ align: "center",
1384
+ justify: "center"
1385
+ }, {
1386
+ default: o(() => [
1387
+ s(a, {
1388
+ cols: "12",
1389
+ lg: "9",
1390
+ md: "9",
1391
+ xs: "12"
1392
+ }, {
1393
+ default: o(() => [
1394
+ t.changeFileName ? (d(), v(F, {
1395
+ key: 0,
1396
+ label: e.selectedLang[l.lang].fileName,
1397
+ modelValue: p.file.name,
1398
+ "onUpdate:modelValue": (P) => p.file.name = P
1399
+ }, null, 8, ["label", "modelValue", "onUpdate:modelValue"])) : A("", !0),
1400
+ t.addFileDescription ? (d(), v(N, {
1401
+ key: 1,
1402
+ label: e.selectedLang[l.lang].fileDescription,
1403
+ "auto-grow": "",
1404
+ "row-height": "1",
1405
+ modelValue: p.file.description,
1406
+ "onUpdate:modelValue": (P) => p.file.description = P
1407
+ }, null, 8, ["label", "modelValue", "onUpdate:modelValue"])) : A("", !0),
1408
+ t.addFileTag ? (d(), v(K, {
1409
+ key: 2,
1410
+ modelValue: p.file.tags,
1411
+ "onUpdate:modelValue": (P) => p.file.tags = P,
1412
+ items: t.tags,
1413
+ dense: "",
1414
+ chips: "",
1415
+ label: e.selectedLang[l.lang].fileTags,
1416
+ multiple: ""
1417
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "items", "label"])) : A("", !0)
1418
+ ]),
1419
+ _: 2
1420
+ }, 1024),
1421
+ s(a, {
1422
+ align: "center",
1423
+ cols: "12",
1424
+ lg: "3",
1425
+ md: "3",
1426
+ xs: "12"
1427
+ }, {
1428
+ default: o(() => {
1429
+ var P;
1430
+ return [
1431
+ p.file.name && ["jpg", "jpeg", "png", "tif", "bmp"].includes(
1432
+ ((P = p.file.name.split(".").pop()) == null ? void 0 : P.toLowerCase()) || ""
1433
+ ) ? (d(), v(q, { key: 0 }, {
1434
+ default: o(() => [
1435
+ s(ee, {
1436
+ src: "data:" + p.file.format + ";base64," + p.file.base64
1437
+ }, null, 8, ["src"])
1438
+ ]),
1439
+ _: 2
1440
+ }, 1024)) : (d(), v(te, {
1441
+ key: 1,
1442
+ "file-format": p.file.format,
1443
+ size: 60
1444
+ }, null, 8, ["file-format"]))
1445
+ ];
1446
+ }),
1447
+ _: 2
1448
+ }, 1024)
1449
+ ]),
1450
+ _: 2
1451
+ }, 1024)
1452
+ ]),
1453
+ _: 2
1454
+ }, 1024))), 128)),
1455
+ s(Y, null, {
1456
+ default: o(() => [
1457
+ s(E, {
1458
+ disabled: e.tempAttachment === null || e.btnLoader,
1459
+ loading: e.btnLoader,
1460
+ color: t.btnColor,
1461
+ onClick: M
1462
+ }, {
1463
+ default: o(() => [
1464
+ _(y(e.selectedLang[l.lang].edit), 1)
1465
+ ]),
1466
+ _: 1
1467
+ }, 8, ["disabled", "loading", "color"])
1468
+ ]),
1469
+ _: 1
1470
+ })
1471
+ ]),
1472
+ _: 1
1473
+ })
1474
+ ]),
1475
+ _: 1
1476
+ }, 8, ["modelValue"])
1477
+ ]),
1478
+ _: 1
1479
+ }),
1480
+ s(Fe, {
1481
+ modelValue: e.fileUploaderSnackBarAlert,
1482
+ "onUpdate:modelValue": n[9] || (n[9] = (p) => e.fileUploaderSnackBarAlert = p),
1483
+ right: "",
1484
+ bottom: "",
1485
+ color: e.fileUploaderSnackBarAlertColor,
1486
+ timeout: 3e3
1487
+ }, {
1488
+ default: o(() => [
1489
+ _(y(e.fileUploaderSnackText) + " ", 1),
1490
+ s(E, {
1491
+ color: "white",
1492
+ text: "",
1493
+ onClick: n[8] || (n[8] = (p) => e.fileUploaderSnackBarAlert = !1)
1494
+ }, {
1495
+ default: o(() => [
1496
+ s(c, null, {
1497
+ default: o(() => [...n[14] || (n[14] = [
1498
+ _("mdi-close", -1)
1499
+ ])]),
1500
+ _: 1
1501
+ })
1502
+ ]),
1503
+ _: 1
1504
+ })
1505
+ ]),
1506
+ _: 1
1507
+ }, 8, ["modelValue", "color"]),
1508
+ s(r, { justify: "center" }, {
1509
+ default: o(() => [
1510
+ s(ie, {
1511
+ modelValue: e.deleteDocumentDialog,
1512
+ "onUpdate:modelValue": n[11] || (n[11] = (p) => e.deleteDocumentDialog = p),
1513
+ persistent: "",
1514
+ width: "30%"
1515
+ }, {
1516
+ default: o(() => [
1517
+ s(q, null, {
1518
+ default: o(() => [
1519
+ s(x, null, {
1520
+ default: o(() => [
1521
+ s(c, { color: "red" })
1522
+ ]),
1523
+ _: 1
1524
+ }),
1525
+ s(X, null, {
1526
+ default: o(() => [
1527
+ _(y(e.selectedLang[l.lang].deleteDialog.message), 1)
1528
+ ]),
1529
+ _: 1
1530
+ }),
1531
+ s(Y, null, {
1532
+ default: o(() => [
1533
+ s(De),
1534
+ s(E, {
1535
+ color: "green darken-1",
1536
+ text: "",
1537
+ onClick: n[10] || (n[10] = (p) => e.deleteDocumentDialog = !1)
1538
+ }, {
1539
+ default: o(() => [
1540
+ _(y(e.selectedLang[l.lang].deleteDialog.cancel), 1)
1541
+ ]),
1542
+ _: 1
1543
+ }),
1544
+ s(E, {
1545
+ color: "primary",
1546
+ disabled: e.btnLoader,
1547
+ loading: e.btnLoader,
1548
+ onClick: j
1549
+ }, {
1550
+ default: o(() => [
1551
+ _(y(e.selectedLang[l.lang].delete), 1)
1552
+ ]),
1553
+ _: 1
1554
+ }, 8, ["disabled", "loading"])
1555
+ ]),
1556
+ _: 1
1557
+ })
1558
+ ]),
1559
+ _: 1
1560
+ })
1561
+ ]),
1562
+ _: 1
1563
+ }, 8, ["modelValue"])
1564
+ ]),
1565
+ _: 1
1566
+ })
1567
+ ]),
1568
+ _: 1
1569
+ });
1570
+ };
1571
+ }
1572
+ }), fe = /* @__PURE__ */ new Set();
1573
+ function xe(l, i) {
1574
+ fe.has(l) || (fe.add(l), console.warn(
1575
+ `[handy-uploader] ${l}() is deprecated and will be removed in the next major version. Use ${i} instead.`
1576
+ ));
1577
+ }
1578
+ function Lt(l, i = {}) {
1579
+ xe("useFileUpload", "useUploader");
1580
+ const {
1581
+ maxFileSize: t = 5 * 1024 * 1024,
1582
+ // 5MB default
1583
+ maxFileCount: e = 10,
1584
+ imageCompressor: m = !1,
1585
+ imageCompressLevel: C = 0.8,
1586
+ fileAccept: V = "*"
1587
+ } = i, k = Z(!1), z = Z({
1588
+ show: !1,
1589
+ text: "",
1590
+ color: "success"
1591
+ }), g = Q(() => l.value.length), h = Q(() => g.value < e), U = Q(
1592
+ () => l.value.reduce((a, r) => a + r.file.size, 0)
1593
+ );
1594
+ function L(a, r = "success") {
1595
+ z.value = { show: !0, text: a, color: r };
1596
+ }
1597
+ function B(a) {
1598
+ var r;
1599
+ if (!Ie(a.size, t))
1600
+ return {
1601
+ valid: !1,
1602
+ error: `File size exceeds maximum allowed size of ${(t / 1048576).toFixed(1)}MB`
1603
+ };
1604
+ if (!Ee(g.value, e))
1605
+ return {
1606
+ valid: !1,
1607
+ error: `Maximum file count of ${e} reached`
1608
+ };
1609
+ if (V !== "*") {
1610
+ const c = V.split(",").map((F) => F.trim()), x = `.${(r = a.name.split(".").pop()) == null ? void 0 : r.toLowerCase()}`, b = a.type;
1611
+ if (!c.some((F) => F.startsWith(".") ? F === x : F.includes("/*") ? b.startsWith(F.replace("/*", "")) : F === b))
1612
+ return {
1613
+ valid: !1,
1614
+ error: `File type not accepted. Allowed types: ${V}`
1615
+ };
1616
+ }
1617
+ return { valid: !0 };
1618
+ }
1619
+ async function j(a) {
1620
+ let r;
1621
+ if (m && re(a.name, a.type))
1622
+ try {
1623
+ r = (await Pe(a, C)).split(",")[1];
1624
+ } catch (b) {
1625
+ console.warn("Image compression failed, using original file:", b), r = await me(a);
1626
+ }
1627
+ else
1628
+ r = await me(a);
1629
+ const c = se(a.size), x = je(a.name);
1630
+ return {
1631
+ base64: r,
1632
+ size: c.text,
1633
+ name: a.name,
1634
+ tags: [],
1635
+ description: "",
1636
+ showDetailState: !1,
1637
+ format: x
1638
+ };
1639
+ }
1640
+ async function I(a) {
1641
+ if (k.value) return !1;
1642
+ k.value = !0;
1643
+ const r = Array.from(a), c = [];
1644
+ for (const x of r) {
1645
+ const b = B(x);
1646
+ b.valid ? c.push(x) : L(b.error, "error");
1647
+ }
1648
+ if (c.length === 0)
1649
+ return k.value = !1, !1;
1650
+ try {
1651
+ const b = (await Promise.all(
1652
+ c.map((F) => j(F))
1653
+ )).map((F) => {
1654
+ var N;
1655
+ return {
1656
+ file: {
1657
+ name: F.name,
1658
+ format: F.format,
1659
+ base64: F.base64,
1660
+ size: ((N = c.find((K) => K.name === F.name)) == null ? void 0 : N.size) || 0,
1661
+ tags: F.tags,
1662
+ description: F.description,
1663
+ showDetailState: F.showDetailState
1664
+ }
1665
+ };
1666
+ });
1667
+ l.value.push(...b);
1668
+ const T = c.length === 1 ? `File "${c[0].name}" uploaded successfully` : `${c.length} files uploaded successfully`;
1669
+ return L(T, "success"), !0;
1670
+ } catch (x) {
1671
+ return console.error("File upload error:", x), L("Failed to upload files. Please try again.", "error"), !1;
1672
+ } finally {
1673
+ k.value = !1;
1674
+ }
1675
+ }
1676
+ function M(a) {
1677
+ if (a >= 0 && a < l.value.length) {
1678
+ const r = l.value[a];
1679
+ return l.value.splice(a, 1), L(`File "${r.file.name}" removed`, "warning"), !0;
1680
+ }
1681
+ return !1;
1682
+ }
1683
+ function u(a, r) {
1684
+ if (a >= 0 && a < l.value.length) {
1685
+ const c = l.value[a].file;
1686
+ return Object.assign(c, r), L("File updated successfully", "success"), !0;
1687
+ }
1688
+ return !1;
1689
+ }
1690
+ function n() {
1691
+ const a = l.value.length;
1692
+ l.value.splice(0), L(`${a} files cleared`, "warning");
1693
+ }
1694
+ return {
1695
+ // State
1696
+ isUploading: k,
1697
+ snackbar: z,
1698
+ // Computed
1699
+ fileCount: g,
1700
+ canAddMoreFiles: h,
1701
+ totalSize: U,
1702
+ // Methods
1703
+ uploadFiles: I,
1704
+ removeFile: M,
1705
+ updateFileMetadata: u,
1706
+ clearAllFiles: n,
1707
+ validateFile: B,
1708
+ showSnackbar: L
1709
+ };
1710
+ }
1711
+ function Vt(l = {}) {
1712
+ xe("useErrorHandler", "the errors from useUploader");
1713
+ const {
1714
+ maxErrors: i = 10,
1715
+ autoRemoveTimeout: t = 5e3,
1716
+ logToConsole: e = !0
1717
+ } = l, m = Z([]), C = Z(!1);
1718
+ function V() {
1719
+ return `error_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
1720
+ }
1721
+ function k(r, c = "error", x, b) {
1722
+ const T = {
1723
+ id: V(),
1724
+ message: r,
1725
+ type: c,
1726
+ timestamp: /* @__PURE__ */ new Date(),
1727
+ context: x,
1728
+ action: b
1729
+ };
1730
+ return e && (c === "error" ? console.error : c === "warning" ? console.warn : c === "info" ? console.info : console.log)(`[${c.toUpperCase()}] ${r}`, x || ""), m.value.unshift(T), m.value.length > i && (m.value = m.value.slice(0, i)), t > 0 && setTimeout(() => {
1731
+ z(T.id);
1732
+ }, t), T.id;
1733
+ }
1734
+ function z(r) {
1735
+ const c = m.value.findIndex((x) => x.id === r);
1736
+ return c !== -1 ? (m.value.splice(c, 1), !0) : !1;
1737
+ }
1738
+ function g() {
1739
+ m.value = [];
1740
+ }
1741
+ function h(r) {
1742
+ m.value = m.value.filter((c) => c.type !== r);
1743
+ }
1744
+ async function U(r, c, x) {
1745
+ C.value = !0;
1746
+ try {
1747
+ return await r();
1748
+ } catch (b) {
1749
+ const T = c || (b instanceof Error ? b.message : "An unexpected error occurred");
1750
+ return k(T, "error", {
1751
+ ...x,
1752
+ originalError: b instanceof Error ? b.message : String(b)
1753
+ }), null;
1754
+ } finally {
1755
+ C.value = !1;
1756
+ }
1757
+ }
1758
+ function L(r, c, x) {
1759
+ return r || k(c, "error", x), r;
1760
+ }
1761
+ function B(r, c) {
1762
+ return k(r, "success", c);
1763
+ }
1764
+ function j(r, c) {
1765
+ return k(r, "warning", c);
1766
+ }
1767
+ function I(r, c) {
1768
+ return k(r, "info", c);
1769
+ }
1770
+ function M(r) {
1771
+ return m.value.filter((c) => c.type === r);
1772
+ }
1773
+ function u() {
1774
+ return m.value[0] || null;
1775
+ }
1776
+ function n(r) {
1777
+ return r ? m.value.some((c) => c.type === r) : m.value.length > 0;
1778
+ }
1779
+ const a = {
1780
+ fileSizeExceeded: (r, c) => k(
1781
+ `File "${r}" exceeds maximum size of ${(c / (1024 * 1024)).toFixed(1)}MB`,
1782
+ "error",
1783
+ { fileName: r, maxSize: c, category: "file-upload" }
1784
+ ),
1785
+ fileCountExceeded: (r) => k(
1786
+ `Maximum file count of ${r} reached`,
1787
+ "error",
1788
+ { maxCount: r, category: "file-upload" }
1789
+ ),
1790
+ invalidFileType: (r, c) => k(
1791
+ `File "${r}" type not allowed. Accepted types: ${c}`,
1792
+ "error",
1793
+ { fileName: r, allowedTypes: c, category: "file-upload" }
1794
+ ),
1795
+ uploadFailed: (r, c) => k(
1796
+ `Failed to upload "${r}"${c ? `: ${c}` : ""}`,
1797
+ "error",
1798
+ { fileName: r, reason: c, category: "file-upload" }
1799
+ ),
1800
+ compressionFailed: (r) => k(
1801
+ `Image compression failed for "${r}", using original file`,
1802
+ "warning",
1803
+ { fileName: r, category: "file-upload" }
1804
+ )
1805
+ };
1806
+ return {
1807
+ // State
1808
+ errors: m,
1809
+ isLoading: C,
1810
+ // Methods
1811
+ addError: k,
1812
+ removeError: z,
1813
+ clearErrors: g,
1814
+ clearErrorsByType: h,
1815
+ handleAsync: U,
1816
+ validate: L,
1817
+ showSuccess: B,
1818
+ showWarning: j,
1819
+ showInfo: I,
1820
+ getErrorsByType: M,
1821
+ getLatestError: u,
1822
+ hasErrors: n,
1823
+ // File upload specific
1824
+ fileUploadErrors: a
1825
+ };
1826
+ }
1827
+ const wt = {
1828
+ ThumbnailUploader: he,
1829
+ TableUploader: be,
1830
+ SimpleUploader: _e,
1831
+ HandyUploader: kt,
1832
+ InsertButton: ye,
1833
+ SelectFileIconType: te
1834
+ };
1835
+ function Tt(l) {
1836
+ for (const [i, t] of Object.entries(wt)) l.component(i, t);
1837
+ }
1838
+ export {
1839
+ St as COMPRESSIBLE_EXTENSIONS,
1840
+ kt as HandyUploader,
1841
+ ye as InsertButton,
1842
+ te as SelectFileIconType,
1843
+ _e as SimpleUploader,
1844
+ be as TableUploader,
1845
+ he as ThumbnailUploader,
1846
+ Ut as base64ByteLength,
1847
+ It as compressDataUrl,
1848
+ Pe as compressImage,
1849
+ Ve as constructImageDataUrl,
1850
+ Te as createVideoThumbnailCache,
1851
+ wt as default,
1852
+ me as fileToBase64,
1853
+ Et as filterByAccept,
1854
+ Pt as formatBytes,
1855
+ se as formatFileSize,
1856
+ jt as generateVideoThumbnail,
1857
+ Mt as getFileIcon,
1858
+ ce as getFileType,
1859
+ je as getMimeTypeFromExtension,
1860
+ Ht as getVideoDataUrl,
1861
+ Tt as install,
1862
+ re as isImageFile,
1863
+ Se as joinFileName,
1864
+ Be as languageData,
1865
+ Nt as matchesAccept,
1866
+ Ot as precheckFiles,
1867
+ Ue as prepareAttachments,
1868
+ qt as readFileAsDataUrl,
1869
+ ze as readFiles,
1870
+ Rt as splitFileName,
1871
+ Vt as useErrorHandler,
1872
+ Lt as useFileUpload,
1873
+ Ee as validateFileCount,
1874
+ Ie as validateFileSize
1875
+ };