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