inertia-bootstrap-forms 2.1.21 → 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 (59) hide show
  1. package/README.fa.md +468 -0
  2. package/README.md +322 -714
  3. package/dist/inertia-bootstrap-forms.cjs.js +1 -0
  4. package/dist/inertia-bootstrap-forms.es.js +3524 -30
  5. package/index.d.ts +143 -507
  6. package/package.json +89 -70
  7. package/src/AmountInput.vue +81 -76
  8. package/src/CaptchaInput.vue +87 -88
  9. package/src/CheckboxButtonInput.vue +56 -69
  10. package/src/CheckboxInput.vue +60 -79
  11. package/src/CheckboxToggle.vue +53 -136
  12. package/src/ChipsInput.vue +157 -0
  13. package/src/ComboboxInput.vue +556 -0
  14. package/src/DropzoneInput.vue +125 -103
  15. package/src/EditorInput.vue +47 -106
  16. package/src/EmailInput.vue +16 -15
  17. package/src/FileInput.vue +189 -179
  18. package/src/FormAdornInput.vue +75 -0
  19. package/src/FormContainer.vue +288 -251
  20. package/src/FormField.vue +59 -0
  21. package/src/FormLabel.vue +27 -27
  22. package/src/GroupControl.vue +55 -53
  23. package/src/LocationInput.vue +79 -72
  24. package/src/MobileInput.vue +21 -13
  25. package/src/MultiQuantityInput.vue +109 -181
  26. package/src/OTPInput.vue +144 -76
  27. package/src/PasswordInput.vue +151 -17
  28. package/src/PersianDatePickerInput.vue +63 -166
  29. package/src/QuantityInput.vue +100 -119
  30. package/src/RangeInput.vue +96 -0
  31. package/src/SimpleUploader.vue +8 -143
  32. package/src/StarRatingInput.vue +114 -138
  33. package/src/SubmitButton.vue +39 -24
  34. package/src/SwitchInput.vue +58 -83
  35. package/src/TelInput.vue +86 -120
  36. package/src/TextAreaInput.vue +29 -33
  37. package/src/TextInput.vue +42 -51
  38. package/src/UppyInput.vue +237 -324
  39. package/src/composables/useBsInstance.js +66 -0
  40. package/src/composables/useChoice.js +34 -0
  41. package/src/composables/useDisposables.js +59 -0
  42. package/src/composables/useField.js +121 -0
  43. package/src/composables/useFormApi.js +12 -0
  44. package/src/i18n.js +120 -0
  45. package/src/index.js +123 -42
  46. package/src/utils/bootstrap.js +48 -0
  47. package/src/utils/digits.js +21 -0
  48. package/src/utils/http.js +15 -0
  49. package/dist/choices-KiM-I_0P.js +0 -2955
  50. package/dist/dropdown-yh2aQrbw-XuCU1v1F.js +0 -1543
  51. package/dist/index-BRtKc2RA.js +0 -604
  52. package/dist/index-_x4UqcXz.js +0 -4938
  53. package/dist/inertia-bootstrap-forms.umd.js +0 -19
  54. package/dist/range-slider-pips-DTDOg3Q9.js +0 -3506
  55. package/dist/style.css +0 -1
  56. package/src/css/from-select.scss +0 -384
  57. package/src/css/loader.gif +0 -0
  58. package/src/css/location.scss +0 -44
  59. package/src/css/simple-upload.scss +0 -54
@@ -1,4938 +0,0 @@
1
- var Bn = Object.defineProperty;
2
- var Mt = (t) => {
3
- throw TypeError(t);
4
- };
5
- var jn = (t, e, n) => e in t ? Bn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
- var B = (t, e, n) => jn(t, typeof e != "symbol" ? e + "" : e, n), Ke = (t, e, n) => e.has(t) || Mt("Cannot " + n);
7
- var w = (t, e, n) => (Ke(t, e, "read from private field"), n ? n.call(t) : e.get(t)), x = (t, e, n) => e.has(t) ? Mt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), Ue = (t, e, n, r) => (Ke(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), F = (t, e, n) => (Ke(t, e, "access private method"), n);
8
- import { createElementBlock as g, openBlock as m, renderSlot as O, normalizeClass as R, ref as G, onMounted as ye, onBeforeUnmount as gt, createElementVNode as b, defineComponent as E, inject as T, computed as q, resolveComponent as L, createBlock as ee, withCtx as ie, withDirectives as te, createVNode as Q, vModelText as Me, createTextVNode as yt, toDisplayString as W, vModelDynamic as Ge, defineAsyncComponent as Ln, createCommentVNode as j, mergeProps as en, Fragment as ve, renderList as _e, normalizeStyle as vt, toRef as qn, reactive as tn, withModifiers as nn, resolveDirective as xn, vModelSelect as Hn, markRaw as Gn, provide as Wn, watch as Fe, h as rn, shallowRef as Yn, unref as Je } from "vue";
9
- import Xn from "@tinymce/tinymce-vue";
10
- import { useForm as Zn } from "@inertiajs/vue3";
11
- import { LMarker as Kn, LTileLayer as Jn, LMap as Qn } from "@vue-leaflet/vue-leaflet";
12
- import { VueTelInput as er } from "vue-tel-input";
13
- import tr from "dropzone";
14
- function nr(t, e, n = {}) {
15
- let r = null;
16
- ye(async () => {
17
- r = (typeof e == "function" ? await e() : e).getOrCreateInstance(t.value, n), typeof document < "u" && document.addEventListener("inertia:start", o);
18
- }), gt(() => {
19
- typeof document < "u" && document.removeEventListener("inertia:start", o), s();
20
- });
21
- const s = function() {
22
- r && (r.dispose(), r = null);
23
- }, o = async function(i) {
24
- var a, l, u;
25
- const d = ((l = (a = i == null ? void 0 : i.detail) == null ? void 0 : a.visit) == null ? void 0 : l.method) ?? null;
26
- (!d || d === "get") && r && typeof r.hide == "function" && (await r.hide(), (u = document == null ? void 0 : document.querySelectorAll(".modal-backdrop")) == null || u.forEach((p) => p.remove()));
27
- };
28
- return {
29
- getInstance: () => r
30
- };
31
- }
32
- const be = (t, e) => {
33
- const n = t.__vccOpts || t;
34
- for (const [r, s] of e)
35
- n[r] = s;
36
- return n;
37
- }, rr = {}, sr = { class: "dropdown" };
38
- function ir(t, e, n, r, s, o) {
39
- return m(), g("div", sr, [
40
- O(t.$slots, "default")
41
- ]);
42
- }
43
- const or = /* @__PURE__ */ be(rr, [["render", ir]]), ar = {}, lr = { class: "dropdown-menu" };
44
- function ur(t, e, n, r, s, o) {
45
- return m(), g("div", lr, [
46
- O(t.$slots, "default")
47
- ]);
48
- }
49
- const dr = /* @__PURE__ */ be(ar, [["render", ur]]), pr = {
50
- __name: "DropdownToggle",
51
- props: {},
52
- setup(t, { expose: e }) {
53
- const n = G(null), { getInstance: r } = nr(n, () => import("./dropdown-yh2aQrbw-XuCU1v1F.js").then((s) => s.default));
54
- return e({ show: () => {
55
- var s;
56
- return (s = r()) == null ? void 0 : s.show();
57
- }, hide: () => {
58
- var s;
59
- return (s = r()) == null ? void 0 : s.hide();
60
- } }), (s, o) => (m(), g("button", {
61
- class: "dropdown-toggle",
62
- type: "button",
63
- ref_key: "el",
64
- ref: n,
65
- "data-bs-toggle": "dropdown",
66
- "aria-expanded": "false"
67
- }, [
68
- O(s.$slots, "default")
69
- ], 512));
70
- }
71
- }, cr = {}, fr = { class: "input-group" };
72
- function mr(t, e, n, r, s, o) {
73
- return m(), g("div", fr, [
74
- O(t.$slots, "default")
75
- ]);
76
- }
77
- const _t = /* @__PURE__ */ be(cr, [["render", mr]]), hr = {}, gr = { class: "input-group-text" };
78
- function yr(t, e, n, r, s, o) {
79
- return m(), g("div", gr, [
80
- O(t.$slots, "default")
81
- ]);
82
- }
83
- const bt = /* @__PURE__ */ be(hr, [["render", yr]]), vr = {
84
- props: {
85
- type: {
86
- type: String,
87
- default: "border",
88
- required: !1
89
- },
90
- size: {
91
- type: String,
92
- default: "sm",
93
- required: !1
94
- }
95
- }
96
- };
97
- function _r(t, e, n, r, s, o) {
98
- return m(), g("i", {
99
- class: R(["align-middle", "spinner-" + this.type + " spinner-" + this.type + "-" + this.size]),
100
- role: "status"
101
- }, e[0] || (e[0] = [
102
- b("span", { class: "visually-hidden" }, "Loading...", -1)
103
- ]), 2);
104
- }
105
- const br = /* @__PURE__ */ be(vr, [["render", _r]]), wr = {
106
- props: {
107
- type: {
108
- type: String,
109
- default: "warning"
110
- }
111
- }
112
- };
113
- function $r(t, e, n, r, s, o) {
114
- return m(), g("div", {
115
- class: R(["alert", "alert-" + n.type])
116
- }, [
117
- O(t.$slots, "default")
118
- ], 2);
119
- }
120
- const Sr = /* @__PURE__ */ be(wr, [["render", $r]]), V = (t, e) => {
121
- const n = t.__vccOpts || t;
122
- for (const [r, s] of e)
123
- n[r] = s;
124
- return n;
125
- }, Fr = E({
126
- components: { InputGroup: _t, InputGroupText: bt },
127
- props: {
128
- name: {
129
- type: String,
130
- required: !0
131
- },
132
- required: Boolean,
133
- disabled: Boolean,
134
- readonly: Boolean,
135
- inputClass: String,
136
- placeholder: {
137
- type: String,
138
- default: "عدد را وارد کنید"
139
- },
140
- unit: {
141
- type: String,
142
- default: "عدد"
143
- }
144
- },
145
- setup(t) {
146
- let e = T("form", {
147
- errors: {},
148
- getID(l) {
149
- return l;
150
- }
151
- }), n = T("group", {});
152
- const r = q({
153
- get() {
154
- var l;
155
- return n.value && e.value[n.value.name] ? (l = n.value) == null ? void 0 : l.getData(t.name) : e.value[t.name];
156
- },
157
- set(l) {
158
- var u;
159
- (u = n == null ? void 0 : n.value) != null && u.name ? n.value.setData(t.name, l) : e.value[t.name] = l;
160
- }
161
- }), s = "۰۱۲۳۴۵۶۷۸۹", o = "٠١٢٣٤٥٦٧٨٩";
162
- function i(l) {
163
- return String(l).replace(/[۰-۹٠-٩]/g, (u) => {
164
- const d = s.indexOf(u);
165
- return d !== -1 ? d : o.indexOf(u);
166
- });
167
- }
168
- const a = q({
169
- get() {
170
- const l = r.value;
171
- return l == null || l === "" ? "" : Number(l).toLocaleString("en-US");
172
- },
173
- set(l) {
174
- const u = i(l).replace(/\D/g, "");
175
- r.value = u === "" ? null : parseInt(u, 10);
176
- }
177
- });
178
- return { modelValue: r, displayValue: a, form: e, group: n };
179
- }
180
- }), Tr = ["name", "disabled", "readonly", "placeholder"];
181
- function kr(t, e, n, r, s, o) {
182
- const i = L("InputGroupText"), a = L("InputGroup");
183
- return m(), ee(a, null, {
184
- default: ie(() => [
185
- te(b("input", {
186
- name: t.name,
187
- "onUpdate:modelValue": e[0] || (e[0] = (l) => t.displayValue = l),
188
- class: R(["form-control fanum", t.inputClass, { "is-invalid": t.form.errors[t.name] }]),
189
- disabled: t.disabled || t.form.processing,
190
- readonly: t.readonly,
191
- placeholder: t.placeholder,
192
- type: "tel"
193
- }, null, 10, Tr), [
194
- [Me, t.displayValue]
195
- ]),
196
- Q(i, { class: "fanum" }, {
197
- default: ie(() => [
198
- yt(W(t.unit), 1)
199
- ]),
200
- _: 1
201
- }),
202
- O(t.$slots, "suffix")
203
- ]),
204
- _: 3
205
- });
206
- }
207
- const Ba = /* @__PURE__ */ V(Fr, [["render", kr]]), Ir = E({
208
- props: {
209
- name: {
210
- type: String,
211
- required: !0
212
- }
213
- },
214
- computed: {
215
- inputID() {
216
- return this.form.getID(this);
217
- }
218
- },
219
- setup(t) {
220
- let e = T("form", {
221
- errors: {},
222
- getID(s) {
223
- return s;
224
- }
225
- }), n = T("group", {});
226
- return { modelValue: q({
227
- get() {
228
- var s;
229
- return n.value && e.value[n.value.name] ? (s = n.value) == null ? void 0 : s.getData(t.name) : e.value[t.name];
230
- },
231
- set(s) {
232
- var o;
233
- (o = n == null ? void 0 : n.value) != null && o.name ? n.value.setData(t.name, s) : e.value[t.name] = s;
234
- }
235
- }), form: e, group: n };
236
- }
237
- }), Er = ["name", "id", "disabled"];
238
- function Cr(t, e, n, r, s, o) {
239
- var i, a;
240
- return te((m(), g("input", {
241
- name: t.name,
242
- id: t.inputID,
243
- "onUpdate:modelValue": e[0] || (e[0] = (l) => t.modelValue = l),
244
- class: R([{ "is-invalid": ((i = t.form) == null ? void 0 : i.errors[t.name]) !== void 0 }, "form-control"]),
245
- disabled: (a = t.form) == null ? void 0 : a.processing,
246
- type: "text"
247
- }, null, 10, Er)), [
248
- [Me, t.modelValue]
249
- ]);
250
- }
251
- const We = /* @__PURE__ */ V(Ir, [["render", Cr]]), Vr = E({
252
- components: { TextInput: We },
253
- props: {
254
- name: {
255
- type: String,
256
- default: "captcha",
257
- required: !1
258
- },
259
- url: {
260
- type: String,
261
- default: "/captcha/default",
262
- required: !1
263
- },
264
- modelValue: "",
265
- required: Boolean,
266
- placeholder: {
267
- default: "کد امنیتی روبرو را وارد کنید"
268
- }
269
- },
270
- emits: ["update:modelValue"],
271
- inject: ["form"],
272
- watch: {
273
- "form.processing": {
274
- handler: function(t, e) {
275
- t !== e && !t && (this.getSrc(), this.emptyField());
276
- },
277
- deep: !1,
278
- immediate: !1
279
- }
280
- },
281
- methods: {
282
- emptyField() {
283
- this.form && (this.form[this.name] = null);
284
- },
285
- async getSrc() {
286
- this.loading = !0, this.src = this.url + "?t=" + Math.random();
287
- let t = this;
288
- setTimeout(function() {
289
- t.loading = !1;
290
- }, 500);
291
- }
292
- },
293
- data() {
294
- return {
295
- loading: !1,
296
- src: this.url + Math.random()
297
- };
298
- }
299
- }), Mr = { class: "input-group captcha" }, Ur = ["src"], Ar = {
300
- key: 1,
301
- class: "placeholder-wave captcha-holder"
302
- }, Dr = ["disabled"];
303
- function Nr(t, e, n, r, s, o) {
304
- const i = L("TextInput");
305
- return m(), g("div", Mr, [
306
- Q(i, {
307
- name: t.name,
308
- class: "text-start",
309
- type: "tel"
310
- }, null, 8, ["name"]),
311
- t.loading ? (m(), g("div", Ar, e[2] || (e[2] = [
312
- b("div", { class: "placeholder w-100 h-100" }, null, -1)
313
- ]))) : (m(), g("img", {
314
- key: 0,
315
- src: t.src,
316
- alt: "captcha",
317
- onClick: e[0] || (e[0] = (...a) => t.getSrc && t.getSrc(...a)),
318
- class: "captcha-holder"
319
- }, null, 8, Ur)),
320
- b("button", {
321
- type: "button",
322
- disabled: t.form.processing || t.loading,
323
- onClick: e[1] || (e[1] = (...a) => t.getSrc && t.getSrc(...a)),
324
- class: "btn btn-secondary border-0"
325
- }, e[3] || (e[3] = [
326
- b("i", { class: "fal fa-sync-alt align-middle" }, null, -1)
327
- ]), 8, Dr)
328
- ]);
329
- }
330
- const ja = /* @__PURE__ */ V(Vr, [["render", Nr]]), Pr = E({
331
- emits: ["change"],
332
- props: {
333
- name: {
334
- type: String,
335
- required: !0
336
- },
337
- id: {
338
- type: String,
339
- default: "",
340
- required: !1
341
- },
342
- value: {
343
- type: String,
344
- default: "yes",
345
- required: !1
346
- },
347
- type: {
348
- type: String,
349
- default: "radio",
350
- required: !1
351
- }
352
- },
353
- methods: {
354
- change(t) {
355
- this.$emit("change", t);
356
- }
357
- },
358
- setup(t) {
359
- let e = T("form");
360
- return e === void 0 && (e = {
361
- errors: {},
362
- getID(n) {
363
- return n;
364
- }
365
- }), { form: e };
366
- }
367
- }), zr = ["for"], Or = ["name", "id", "disabled", "type", "value"];
368
- function Rr(t, e, n, r, s, o) {
369
- var i, a;
370
- return m(), g("label", {
371
- class: R(["btn-label", { active: t.form[t.name] === t.value || t.form[t.name] === !0 }]),
372
- for: t.form.getID(t.name) + (t.id || t.value)
373
- }, [
374
- te(b("input", {
375
- name: t.name,
376
- id: t.form.getID(t.name) + (t.id || t.value),
377
- "onUpdate:modelValue": e[0] || (e[0] = (l) => t.form[t.name] = l),
378
- class: R([{ "is-invalid": (i = t.form) == null ? void 0 : i.errors[t.name] }, "btn-check"]),
379
- disabled: (a = t.form) == null ? void 0 : a.processing,
380
- type: t.type,
381
- value: t.value,
382
- onChange: e[1] || (e[1] = (...l) => t.change && t.change(...l)),
383
- autocomplete: "off"
384
- }, null, 42, Or), [
385
- [Ge, t.form[t.name]]
386
- ]),
387
- O(t.$slots, "default")
388
- ], 10, zr);
389
- }
390
- const La = /* @__PURE__ */ V(Pr, [["render", Rr]]), Br = E({
391
- props: {
392
- name: {
393
- type: String,
394
- required: !0
395
- },
396
- id: {
397
- type: String,
398
- default: "",
399
- required: !1
400
- },
401
- value: {
402
- type: [String, Number],
403
- default: "yes",
404
- required: !1
405
- },
406
- type: {
407
- type: String,
408
- default: "checkbox",
409
- required: !1
410
- }
411
- },
412
- computed: {
413
- inputID() {
414
- return this.form.getID(this);
415
- }
416
- },
417
- setup(t) {
418
- let e = T("form", {
419
- errors: {},
420
- getID(s) {
421
- return s;
422
- }
423
- }), n = T("group", {});
424
- return { modelValue: q({
425
- get() {
426
- var s;
427
- return n.value && e.value[n.value.name] ? (s = n.value) == null ? void 0 : s.getData(t.name) : e.value[t.name];
428
- },
429
- set(s) {
430
- var o;
431
- (o = n == null ? void 0 : n.value) != null && o.name ? n.value.setData(t.name, s) : e.value[t.name] = s;
432
- }
433
- }), form: e, group: n };
434
- }
435
- }), jr = { class: "form-check" }, Lr = ["name", "id", "disabled", "type", "value"], qr = ["for"];
436
- function xr(t, e, n, r, s, o) {
437
- var i, a;
438
- return m(), g("div", jr, [
439
- te(b("input", {
440
- name: t.name,
441
- id: t.inputID,
442
- "onUpdate:modelValue": e[0] || (e[0] = (l) => t.modelValue = l),
443
- class: R([{ "is-invalid": (i = t.form) == null ? void 0 : i.errors[t.name] }, "form-check-input"]),
444
- disabled: (a = t.form) == null ? void 0 : a.processing,
445
- type: t.type,
446
- value: t.value,
447
- onChange: e[1] || (e[1] = (l) => t.$emit("change", l))
448
- }, null, 42, Lr), [
449
- [Ge, t.modelValue]
450
- ]),
451
- b("label", {
452
- class: "form-check-label",
453
- for: t.inputID
454
- }, [
455
- O(t.$slots, "default")
456
- ], 8, qr)
457
- ]);
458
- }
459
- const qa = /* @__PURE__ */ V(Br, [["render", xr]]), Hr = E({
460
- props: {
461
- name: {
462
- type: String,
463
- required: !0
464
- },
465
- id: {
466
- type: String,
467
- default: "",
468
- required: !1
469
- },
470
- value: {
471
- type: [String, Number],
472
- default: "yes",
473
- required: !1
474
- },
475
- type: {
476
- type: String,
477
- default: "checkbox",
478
- required: !1
479
- },
480
- disabled: {
481
- type: Boolean,
482
- default: !1,
483
- required: !1
484
- },
485
- readonly: {
486
- type: Boolean,
487
- default: !1
488
- },
489
- hideInput: {
490
- type: Boolean,
491
- default: !1
492
- }
493
- },
494
- computed: {
495
- inputID() {
496
- return this.form.getID(this) + (this.value || "");
497
- },
498
- selectedValue() {
499
- return this.modelValue && typeof this.modelValue == "object" ? Object.values(this.modelValue) : this.modelValue ? [this.modelValue] : null;
500
- }
501
- },
502
- setup(t) {
503
- let e = T("form", {
504
- errors: {},
505
- getID(s) {
506
- return s;
507
- }
508
- }), n = T("group", {});
509
- return { modelValue: q({
510
- get() {
511
- var s;
512
- return n.value && e.value[n.value.name] ? (s = n.value) == null ? void 0 : s.getData(t.name) : e.value[t.name];
513
- },
514
- set(s) {
515
- var o;
516
- (o = n == null ? void 0 : n.value) != null && o.name ? n.value.setData(t.name, s) : e.value[t.name] = s;
517
- }
518
- }), form: e, group: n };
519
- }
520
- }), Gr = ["for"], Wr = ["name", "id", "disabled", "type", "value", "readonly"];
521
- function Yr(t, e, n, r, s, o) {
522
- var i, a, l;
523
- return m(), g("label", {
524
- class: R(["form-check-toggle", {
525
- "form-check-toggle--active": (t.selectedValue || []).includes(t.value),
526
- disabled: t.disabled || t.readonly,
527
- "is-invalid": (i = t.form) == null ? void 0 : i.errors[t.name]
528
- }]),
529
- for: t.inputID
530
- }, [
531
- te(b("input", {
532
- name: t.name,
533
- id: t.inputID,
534
- "onUpdate:modelValue": e[0] || (e[0] = (u) => t.modelValue = u),
535
- class: R([{ "is-invalid": (a = t.form) == null ? void 0 : a.errors[t.name], "form-check-toggle--input-hide": t.hideInput }, "form-check-toggle--input form-check-input"]),
536
- disabled: ((l = t.form) == null ? void 0 : l.processing) || t.disabled,
537
- type: t.type,
538
- value: t.value,
539
- readonly: t.readonly,
540
- onChange: e[1] || (e[1] = (u) => t.$emit("change", u))
541
- }, null, 42, Wr), [
542
- [Ge, t.modelValue]
543
- ]),
544
- O(t.$slots, "default")
545
- ], 10, Gr);
546
- }
547
- const xa = /* @__PURE__ */ V(Hr, [["render", Yr]]), Xr = E({
548
- props: {
549
- name: {
550
- type: String,
551
- required: !0
552
- },
553
- id: {
554
- type: String,
555
- default: "",
556
- required: !1
557
- },
558
- value: {
559
- type: [String, Number],
560
- default: null,
561
- required: !1
562
- },
563
- disabled: {
564
- type: Boolean,
565
- default: !1
566
- },
567
- type: {
568
- type: String,
569
- default: "checkbox",
570
- required: !1
571
- }
572
- },
573
- computed: {
574
- inputID() {
575
- return this.form.getID(this);
576
- }
577
- },
578
- setup(t) {
579
- let e = T("form", {
580
- errors: {},
581
- getID(s) {
582
- return s;
583
- }
584
- }), n = T("group", {});
585
- return { modelValue: q({
586
- get() {
587
- var s;
588
- return n.value && e.value[n.value.name] ? (s = n.value) == null ? void 0 : s.getData(t.name) : e.value[t.name];
589
- },
590
- set(s) {
591
- var o;
592
- (o = n == null ? void 0 : n.value) != null && o.name ? n.value.setData(t.name, s) : e.value[t.name] = s;
593
- }
594
- }), form: e, group: n };
595
- }
596
- }), Zr = ["name", "id", "disabled", "type", "value"], Kr = ["for"];
597
- function Jr(t, e, n, r, s, o) {
598
- var i, a;
599
- return m(), g("div", {
600
- class: R(["form-check form-switch", { disabled: t.disabled }])
601
- }, [
602
- te(b("input", {
603
- name: t.name,
604
- id: t.inputID,
605
- "onUpdate:modelValue": e[0] || (e[0] = (l) => t.modelValue = l),
606
- class: R([{ "is-invalid": (i = t.form) == null ? void 0 : i.errors[t.name] }, "form-check-input"]),
607
- disabled: ((a = t.form) == null ? void 0 : a.processing) || t.disabled,
608
- type: t.type,
609
- value: t.value,
610
- onChange: e[1] || (e[1] = (l) => t.$emit("change", l))
611
- }, null, 42, Zr), [
612
- [Ge, t.modelValue]
613
- ]),
614
- b("label", {
615
- class: "form-check-label",
616
- for: t.inputID
617
- }, [
618
- O(t.$slots, "default")
619
- ], 8, Kr)
620
- ], 2);
621
- }
622
- const Ha = /* @__PURE__ */ V(Xr, [["render", Jr]]), Qr = Ln(
623
- () => import("vue3-persian-datetime-picker")
624
- );
625
- let Ae;
626
- const es = E({
627
- components: { Vue3PersianDatetimePicker: Qr },
628
- emits: ["update:modelValue", "change"],
629
- props: {
630
- name: {
631
- type: String,
632
- required: !0
633
- },
634
- calendar: {
635
- type: String,
636
- default: "date"
637
- },
638
- view: {
639
- type: String,
640
- default: "date"
641
- },
642
- disabled: Boolean,
643
- min: String,
644
- max: String,
645
- range: Boolean,
646
- locale: {
647
- default: "fa"
648
- },
649
- format: {
650
- type: String,
651
- default: "jYYYY/jMM/jDD"
652
- },
653
- inputFormat: {
654
- type: String,
655
- default: null
656
- },
657
- simple: {
658
- type: Boolean,
659
- default: !1
660
- },
661
- placeholder: String
662
- },
663
- setup(t) {
664
- let e = T("form", {
665
- errors: {},
666
- getID(s) {
667
- return s;
668
- }
669
- }), n = T("group", {});
670
- return { modelValue: q({
671
- get() {
672
- var s;
673
- return n.value && e.value[n.value.name] ? (s = n.value) == null ? void 0 : s.getData(t.name) : e.value[t.name];
674
- },
675
- set(s) {
676
- var o;
677
- (o = n == null ? void 0 : n.value) != null && o.name ? n.value.setData(t.name, s) : e.value[t.name] = s;
678
- }
679
- }), form: e, group: n };
680
- },
681
- watch: {
682
- modelValue: (t, e) => {
683
- Ae == null || Ae.$emit("change", t, e);
684
- }
685
- },
686
- methods: {
687
- clear() {
688
- this.modelValue = null;
689
- }
690
- },
691
- mounted() {
692
- Ae = this;
693
- },
694
- computed: {
695
- isSsr() {
696
- return !window || typeof window > "u";
697
- },
698
- inputID() {
699
- return this.form.getID(this);
700
- }
701
- },
702
- data() {
703
- return {};
704
- }
705
- });
706
- function ts(t, e, n, r, s, o) {
707
- var a;
708
- const i = L("Vue3PersianDatetimePicker");
709
- return t.isSsr ? j("", !0) : (m(), ee(i, en({
710
- key: 0,
711
- modelValue: t.modelValue,
712
- "onUpdate:modelValue": e[0] || (e[0] = (l) => t.modelValue = l),
713
- type: t.calendar,
714
- editable: "",
715
- jumpminute: "15",
716
- disabled: ((a = t.form) == null ? void 0 : a.processing) || t.disabled,
717
- roundminute: !0,
718
- showNowBtn: !0,
719
- autoSubmit: !0,
720
- inputFormat: t.inputFormat ? t.inputFormat : t.format,
721
- "input-class": "form-control fanum"
722
- }, t.$props), null, 16, ["modelValue", "type", "disabled", "inputFormat"]));
723
- }
724
- const Ga = /* @__PURE__ */ V(es, [["render", ts]]), ns = E({
725
- emits: ["update:modelValue", "setContent"],
726
- components: { Editor: Xn },
727
- props: {
728
- name: {
729
- type: String,
730
- required: !0
731
- },
732
- placeholder: {
733
- type: String,
734
- default: ""
735
- },
736
- disabled: {
737
- type: Boolean,
738
- default: !1
739
- },
740
- modelValue: String,
741
- options: {
742
- type: Object,
743
- default: {},
744
- required: !1
745
- }
746
- },
747
- setup(t, { expose: e, emit: n }) {
748
- const r = G(null), s = G(null), o = (u, d) => {
749
- s.value = d;
750
- };
751
- e({
752
- editor: () => s.value
753
- });
754
- let i = T("form", {
755
- errors: {},
756
- getID(u) {
757
- return u;
758
- }
759
- }), a = T("group", {});
760
- return { modelValue: q({
761
- get() {
762
- var u;
763
- return a.value && i.value[a.value.name] ? (u = a.value) == null ? void 0 : u.getData(t.name) : i.value[t.name];
764
- },
765
- set(u) {
766
- var d;
767
- (d = a == null ? void 0 : a.value) != null && d.name ? a.value.setData(t.name, u) : i.value[t.name] = u;
768
- }
769
- }), form: i, group: a, editorRef: r, handleInit: o };
770
- }
771
- });
772
- function rs(t, e, n, r, s, o) {
773
- const i = L("Editor");
774
- return m(), ee(i, {
775
- ref: "editorRef",
776
- onInit: t.handleInit,
777
- modelValue: t.modelValue,
778
- "onUpdate:modelValue": e[0] || (e[0] = (a) => t.modelValue = a),
779
- class: "tiny-editor-input-el",
780
- init: {
781
- disabled: this.disabled,
782
- placeholder: this.placeholder,
783
- ...t.options
784
- }
785
- }, null, 8, ["onInit", "modelValue", "init"]);
786
- }
787
- const Wa = /* @__PURE__ */ V(ns, [["render", rs]]), ss = E({
788
- props: {
789
- modelValue: "",
790
- name: {
791
- type: String,
792
- required: !0
793
- },
794
- multiple: {
795
- type: Boolean,
796
- default: !1
797
- },
798
- endpoint: {
799
- type: String,
800
- default: "/upload"
801
- }
802
- },
803
- setup(t) {
804
- let e = T("form");
805
- return e === void 0 && (e = {
806
- errors: {},
807
- getID(n) {
808
- }
809
- }), { form: e };
810
- },
811
- computed: {
812
- inputID() {
813
- var t;
814
- return (t = this.form) == null ? void 0 : t.getID(this);
815
- },
816
- allFiles() {
817
- return this.files;
818
- }
819
- },
820
- methods: {
821
- addFile(t) {
822
- let e = {
823
- id: crypto.randomUUID(),
824
- percent: 0,
825
- error: 0,
826
- file: t
827
- };
828
- this.multiple ? this.files.push(e) : this.files = [e], this.uploadFile(e), this.$refs.input.value = "";
829
- },
830
- calculatePercent(t, e) {
831
- t.lengthComputable && (this.files.find((n) => n.id === e.id).percent = Math.round(t.loaded / t.total * 100));
832
- },
833
- addFileToInputValue(t, e) {
834
- this.files.find((n) => n.id === t.id).path = e.data.path, this.form[this.name] = this.multiple ? this.files.map((n) => n.path) : this.files[0].path, this.$emit("update:modelValue", this.form[this.name]);
835
- },
836
- async uploadFile(t) {
837
- let e = this, n = new FormData();
838
- n.append("file", t.file), e.files.find((r) => r.id === t.id).error = "", await axios.post(
839
- this.endpoint,
840
- n,
841
- {
842
- headers: {
843
- "Content-Type": "multipart/form-data"
844
- },
845
- onUploadProgress: (r) => e.calculatePercent(r, t)
846
- }
847
- ).then(function(r) {
848
- if (r.errors)
849
- throw r;
850
- e.addFileToInputValue(t, r);
851
- }).catch(function(r) {
852
- var s, o;
853
- e.files.find((i) => i.id === t.id).error = ((o = (s = r.response) == null ? void 0 : s.data) == null ? void 0 : o.message) || r.message;
854
- });
855
- },
856
- async deleteFile(t) {
857
- this.files = this.files.filter((e) => e.id !== t.id), await axios.delete(this.endpoint, {
858
- data: t.path
859
- });
860
- },
861
- fileSelected(t) {
862
- Array.from(t.target.files).forEach((e) => this.addFile(e));
863
- }
864
- },
865
- data() {
866
- return {
867
- files: []
868
- };
869
- }
870
- }), is = { class: "file-input-uploader" }, os = ["name", "id", "disabled", "multiple"], as = { class: "file-input-uploader--list" }, ls = ["id"], us = {
871
- key: 0,
872
- class: "file-input-uploader--progress"
873
- }, ds = {
874
- key: 1,
875
- class: "file-input-uploader--list-error"
876
- }, ps = {
877
- class: "file-input-uploader--list-item--size",
878
- dir: "ltr"
879
- }, cs = { class: "file-input-uploader--list-item--actions" }, fs = ["onClick"], ms = ["onClick"];
880
- function hs(t, e, n, r, s, o) {
881
- var i, a;
882
- return m(), g("div", is, [
883
- b("input", {
884
- ref: "input",
885
- name: t.name,
886
- id: t.inputID,
887
- class: R([{ "is-invalid": ((i = t.form) == null ? void 0 : i.errors[t.name]) !== void 0 }, "form-control"]),
888
- disabled: (a = t.form) == null ? void 0 : a.processing,
889
- type: "file",
890
- multiple: t.multiple,
891
- onChange: e[0] || (e[0] = (...l) => t.fileSelected && t.fileSelected(...l))
892
- }, null, 42, os),
893
- b("div", as, [
894
- (m(!0), g(ve, null, _e(t.allFiles, (l) => (m(), g("div", {
895
- id: "file-" + l.id,
896
- class: "file-input-uploader--list-item"
897
- }, [
898
- l.percent && l.percent < 100 ? (m(), g("div", us, [
899
- b("div", {
900
- style: vt({ width: l.percent + "%" })
901
- }, null, 4)
902
- ])) : j("", !0),
903
- b("div", null, W(l.file.name), 1),
904
- l.error ? (m(), g("div", ds, W(l.error), 1)) : j("", !0),
905
- b("div", ps, W(Math.round(l.file.size / 1024)) + "Kb", 1),
906
- b("div", cs, [
907
- l.error ? (m(), g("button", {
908
- key: 0,
909
- onClick: (u) => t.uploadFile(l),
910
- type: "button",
911
- class: "file-input-uploader--list-item--btn"
912
- }, e[1] || (e[1] = [
913
- b("svg", {
914
- fill: "#000000",
915
- width: "800px",
916
- height: "800px",
917
- viewBox: "0 0 24 24",
918
- xmlns: "http://www.w3.org/2000/svg"
919
- }, [
920
- b("path", { d: "M1,12A11,11,0,0,1,17.882,2.7l1.411-1.41A1,1,0,0,1,21,2V6a1,1,0,0,1-1,1H16a1,1,0,0,1-.707-1.707l1.128-1.128A8.994,8.994,0,0,0,3,12a1,1,0,0,1-2,0Zm21-1a1,1,0,0,0-1,1,9.01,9.01,0,0,1-9,9,8.9,8.9,0,0,1-4.42-1.166l1.127-1.127A1,1,0,0,0,8,17H4a1,1,0,0,0-1,1v4a1,1,0,0,0,.617.924A.987.987,0,0,0,4,23a1,1,0,0,0,.707-.293L6.118,21.3A10.891,10.891,0,0,0,12,23,11.013,11.013,0,0,0,23,12,1,1,0,0,0,22,11Z" })
921
- ], -1)
922
- ]), 8, fs)) : j("", !0),
923
- l.path || l.error ? (m(), g("button", {
924
- key: 1,
925
- onClick: (u) => t.deleteFile(l),
926
- type: "button",
927
- class: "file-input-uploader--list-item--btn"
928
- }, e[2] || (e[2] = [
929
- b("svg", {
930
- fill: "#000000",
931
- width: "800px",
932
- height: "800px",
933
- viewBox: "0 0 24 24",
934
- xmlns: "http://www.w3.org/2000/svg"
935
- }, [
936
- b("path", { d: "M12,23A11,11,0,1,0,1,12,11.013,11.013,0,0,0,12,23ZM12,3a9,9,0,1,1-9,9A9.01,9.01,0,0,1,12,3ZM8.293,14.293,10.586,12,8.293,9.707A1,1,0,0,1,9.707,8.293L12,10.586l2.293-2.293a1,1,0,0,1,1.414,1.414L13.414,12l2.293,2.293a1,1,0,1,1-1.414,1.414L12,13.414,9.707,15.707a1,1,0,0,1-1.414-1.414Z" })
937
- ], -1)
938
- ]), 8, ms)) : j("", !0)
939
- ])
940
- ], 8, ls))), 256))
941
- ])
942
- ]);
943
- }
944
- const Ya = /* @__PURE__ */ V(ss, [["render", hs]]), gs = E({
945
- components: {
946
- TextInput: We
947
- },
948
- props: {
949
- FileInput: {
950
- type: String,
951
- default: "email",
952
- required: !0
953
- }
954
- }
955
- });
956
- function ys(t, e, n, r, s, o) {
957
- const i = L("TextInput");
958
- return m(), ee(i, {
959
- name: t.name,
960
- placeholder: "ایمیل خود را وارد کنید",
961
- type: "email"
962
- }, null, 8, ["name"]);
963
- }
964
- const Xa = /* @__PURE__ */ V(gs, [["render", ys]]), vs = E({
965
- props: {
966
- name: {
967
- type: String,
968
- required: !0
969
- }
970
- },
971
- setup(t, e) {
972
- return { form: T("form", {
973
- errors: {},
974
- getID(r) {
975
- return r;
976
- }
977
- }) };
978
- },
979
- provide() {
980
- return {
981
- group: q(() => this)
982
- };
983
- },
984
- mounted() {
985
- var t, e;
986
- (e = (t = this.$refs.groupEl) == null ? void 0 : t.parentNode) == null || e.parentNode.querySelectorAll(".form-control-group").forEach((n, r) => {
987
- n === this.$refs.groupEl && (this.groupID = r.toString());
988
- });
989
- },
990
- methods: {
991
- setData(t, e) {
992
- var n;
993
- this.form[this.name] || (this.form[this.name] = {}), this.groupID && ((n = this.form[this.name]) == null ? void 0 : n.length) >= 0 ? (this.form[this.name][this.groupID] || (this.form[this.name][this.groupID] = {}), this.form[this.name][this.groupID][t] = e) : this.form[this.name][t] = e;
994
- },
995
- getData(t) {
996
- var e, n;
997
- return this.groupID && ((e = this.form[this.name]) == null ? void 0 : e.length) >= 0 ? ((n = this.form[this.name][this.groupID]) == null ? void 0 : n[t]) || null : this.form[this.name][t];
998
- }
999
- },
1000
- data() {
1001
- return {
1002
- groupID: "0"
1003
- };
1004
- }
1005
- }), _s = ["data-name", "data-group-id"];
1006
- function bs(t, e, n, r, s, o) {
1007
- return m(), g("div", {
1008
- class: "form-control-group",
1009
- "data-name": t.name,
1010
- "data-group-id": t.groupID,
1011
- ref: "groupEl"
1012
- }, [
1013
- O(t.$slots, "default")
1014
- ], 8, _s);
1015
- }
1016
- const ws = /* @__PURE__ */ V(vs, [["render", bs]]), $s = E({
1017
- components: { Alert: Sr },
1018
- emits: ["submit", "reset", "onStart", "onFinish", "onSuccess", "onError", "change"],
1019
- props: {
1020
- url: {
1021
- type: String,
1022
- default: "",
1023
- required: !1
1024
- },
1025
- method: {
1026
- default: "post"
1027
- },
1028
- autoTab: {
1029
- type: Boolean,
1030
- default: !0
1031
- },
1032
- only: {
1033
- type: Array,
1034
- default: [],
1035
- required: !1
1036
- },
1037
- modelValue: {
1038
- type: Object,
1039
- default: {},
1040
- required: !1
1041
- },
1042
- options: {
1043
- type: Object,
1044
- default: {},
1045
- required: !1
1046
- },
1047
- resetOnSuccess: {
1048
- type: Boolean,
1049
- default: !1
1050
- },
1051
- submitHandler: {
1052
- type: Function,
1053
- default: null,
1054
- required: !1
1055
- }
1056
- },
1057
- setup(t) {
1058
- const e = qn("formEl"), n = tn(t.modelValue), r = Zn({
1059
- hasMessage: !1,
1060
- successMessage: null,
1061
- ...t.options,
1062
- ...n
1063
- });
1064
- return r.getID = function(s) {
1065
- var i, a;
1066
- const o = [];
1067
- return (i = e.value) != null && i.id && o.push((a = e.value) == null ? void 0 : a.id), typeof s === String && o.push(s), s.group && (s.group.name || s.group.groupID) && (s.group.name && o.push(s.group.name), s.group.groupID && o.push(s.group.groupID)), s.name && o.push(s.name), s.value && o.push(s.value), o.join("-");
1068
- }, { form: r, formData: n, formEl: e };
1069
- },
1070
- provide() {
1071
- return {
1072
- form: q(() => this.form)
1073
- };
1074
- },
1075
- watch: {
1076
- form: {
1077
- handler: function(t) {
1078
- const {
1079
- isDirty: e,
1080
- errors: n,
1081
- hasErrors: r,
1082
- hasMessage: s,
1083
- successMessage: o,
1084
- processing: i,
1085
- progress: a,
1086
- wasSuccessful: l,
1087
- uploading: u,
1088
- recentlySuccessful: d,
1089
- __rememberable: p,
1090
- ...c
1091
- } = t;
1092
- this.$emit("change", c), this.$emit("update:modelValue", c);
1093
- },
1094
- deep: !0
1095
- }
1096
- },
1097
- methods: {
1098
- handleAutoTab(t) {
1099
- var r;
1100
- if (((r = this.formEl) == null ? void 0 : r.dataset.autotab) !== "true") return;
1101
- const e = t.target;
1102
- if (!["INPUT", "TEXTAREA"].includes(e.tagName)) return;
1103
- const n = e.maxLength;
1104
- n > 0 && e.value.length >= n && this.focusNextField(e);
1105
- },
1106
- handleAutoSubmitLength(t) {
1107
- const e = t.target;
1108
- if (!["INPUT", "TEXTAREA"].includes(e.tagName)) return;
1109
- const n = parseInt(e.dataset.autoSubmitLength, 10);
1110
- !isNaN(n) && e.value.length >= n && this.submit();
1111
- },
1112
- focusNextField(t) {
1113
- const e = Array.from(
1114
- this.formEl.querySelectorAll("input, select, textarea")
1115
- ).filter(
1116
- (s) => !s.disabled && s.tabIndex !== -1 && s.type !== "hidden" && s.offsetParent !== null
1117
- ), n = e.indexOf(t), r = e[n + 1];
1118
- r && (r.focus(), r.tagName !== "SELECT" && typeof r.select == "function" && r.select());
1119
- },
1120
- reset() {
1121
- this.form.reset();
1122
- },
1123
- async submit(t) {
1124
- const e = this.modelValue;
1125
- this.submitHandler ? await this.submitHandler(t) : (this.$emit("submit", t), await this.form.transform(function(n) {
1126
- delete n.hasMessage, delete n.successMessage;
1127
- let r = JSON.stringify({
1128
- ...e,
1129
- ...n
1130
- });
1131
- const s = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g], o = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g];
1132
- for (let i = 0; i < 10; i++)
1133
- r = r.replace(s[i], i).replace(o[i], i);
1134
- return JSON.parse(r.toLocaleString("en-US"));
1135
- }).submit(this.method.toString(), this.url, {
1136
- only: this.only,
1137
- onStart: () => {
1138
- this.form.hasMessage && (this.form.hasMessage = !1), this.form.successMessage && (this.form.hasMessage = null), this.$emit("onStart"), this.form.clearErrors();
1139
- },
1140
- onFinish: (n) => {
1141
- this.$emit("onFinish", n);
1142
- },
1143
- onError: (n) => {
1144
- this.$emit("onError", n);
1145
- },
1146
- onSuccess: (n) => {
1147
- var r, s, o;
1148
- this.resetOnSuccess && ((r = this.form) == null || r.reset()), (s = n == null ? void 0 : n.props) != null && s.message && (this.form.hasMessage = !0, this.form.successMessage = (o = n == null ? void 0 : n.props) == null ? void 0 : o.message), this.$emit("onSuccess", n);
1149
- }
1150
- }));
1151
- }
1152
- },
1153
- expose: ["submit", "reset"]
1154
- }), Ss = ["action", "method", "data-autotab", "novalidate"], Fs = { class: "list-unstyled p-0 m-0 fanum" }, Ts = ["innerHTML"];
1155
- function ks(t, e, n, r, s, o) {
1156
- const i = L("Alert");
1157
- return m(), g("form", {
1158
- ref: "formEl",
1159
- action: t.url,
1160
- method: t.method,
1161
- "data-autotab": t.autoTab ? "true" : "",
1162
- onInput: e[0] || (e[0] = (a) => {
1163
- t.handleAutoTab(a), t.handleAutoSubmitLength(a);
1164
- }),
1165
- onSubmit: e[1] || (e[1] = nn((...a) => t.submit && t.submit(...a), ["prevent"])),
1166
- onReset: e[2] || (e[2] = (a) => t.$emit("reset")),
1167
- class: R({ "form-processing": t.form.processing }),
1168
- novalidate: !!Object.values(t.form.errors).length
1169
- }, [
1170
- O(t.$slots, "errors", {}, () => [
1171
- t.form.hasErrors ? (m(), ee(i, {
1172
- key: 0,
1173
- type: "danger"
1174
- }, {
1175
- default: ie(() => [
1176
- b("ul", Fs, [
1177
- (m(!0), g(ve, null, _e(t.form.errors, (a) => (m(), g("li", { innerHTML: a }, null, 8, Ts))), 256))
1178
- ])
1179
- ]),
1180
- _: 1
1181
- })) : j("", !0)
1182
- ]),
1183
- O(t.$slots, "message", {}, () => [
1184
- t.form.hasMessage && t.form.successMessage ? (m(), ee(i, {
1185
- key: 0,
1186
- type: "success",
1187
- innerHTML: t.form.successMessage
1188
- }, null, 8, ["innerHTML"])) : j("", !0)
1189
- ]),
1190
- O(t.$slots, "default", {
1191
- form: t.form,
1192
- submit: t.submit
1193
- })
1194
- ], 42, Ss);
1195
- }
1196
- const Za = /* @__PURE__ */ V($s, [["render", ks]]), Is = E({
1197
- props: {
1198
- default: !1,
1199
- required: !1
1200
- },
1201
- emits: ["update:modelValue"],
1202
- mounted() {
1203
- var e;
1204
- const t = this.$el.nextElementSibling;
1205
- t && (this.forId = t.id || ((e = t.querySelector("[id]")) == null ? void 0 : e.id) || null);
1206
- },
1207
- data() {
1208
- return {
1209
- forId: null
1210
- };
1211
- }
1212
- }), Es = ["for"], Cs = {
1213
- key: 0,
1214
- class: "text-danger"
1215
- };
1216
- function Vs(t, e, n, r, s, o) {
1217
- return m(), g("label", {
1218
- class: "mb-2 d-block",
1219
- for: t.forId
1220
- }, [
1221
- O(t.$slots, "default", {}, void 0, !0),
1222
- t.required ? (m(), g("span", Cs, "*")) : j("", !0)
1223
- ], 8, Es);
1224
- }
1225
- const Ka = /* @__PURE__ */ V(Is, [["render", Vs], ["__scopeId", "data-v-1ee6dec3"]]), Ms = E({
1226
- name: "LocationInput",
1227
- components: {
1228
- LMap: Qn,
1229
- LTileLayer: Jn,
1230
- LMarker: Kn
1231
- },
1232
- props: {
1233
- name: {
1234
- type: String,
1235
- default: "location",
1236
- required: !1
1237
- },
1238
- disabled: {
1239
- type: [Boolean, String],
1240
- default: !1
1241
- },
1242
- readonly: {
1243
- type: [Boolean, String],
1244
- default: !1
1245
- },
1246
- modelValue: Object
1247
- },
1248
- setup(t) {
1249
- let e = T("form");
1250
- return e === void 0 && (e = {
1251
- errors: {},
1252
- zoom: 8,
1253
- center: [47.41322, -1.219482],
1254
- getID(n) {
1255
- }
1256
- }), { form: e };
1257
- },
1258
- methods: {
1259
- setMarker(t) {
1260
- var e, n, r, s, o, i;
1261
- this.readonly || (this.marker = {
1262
- lat: ((e = t == null ? void 0 : t.latlng) == null ? void 0 : e.lat) || ((r = (n = t == null ? void 0 : t.target) == null ? void 0 : n._latlng) == null ? void 0 : r.lat),
1263
- lng: ((s = t == null ? void 0 : t.latlng) == null ? void 0 : s.lng) || ((i = (o = t == null ? void 0 : t.target) == null ? void 0 : o._latlng) == null ? void 0 : i.lng)
1264
- }, this.$emit("update:modelValue", this.marker), this.form[this.name] = this.marker);
1265
- }
1266
- },
1267
- data() {
1268
- var t, e, n, r, s, o, i, a;
1269
- return {
1270
- zoom: 13,
1271
- marker: {
1272
- lat: ((t = this.modelValue) == null ? void 0 : t.lat) || ((e = this.form[this.name]) == null ? void 0 : e.lat) || null,
1273
- lng: ((n = this.modelValue) == null ? void 0 : n.lng) || ((r = this.form[this.name]) == null ? void 0 : r.lng) || null
1274
- },
1275
- center: {
1276
- lat: ((s = this.modelValue) == null ? void 0 : s.lat) || ((o = this.form[this.name]) == null ? void 0 : o.lat) || 35.69293,
1277
- lng: ((i = this.modelValue) == null ? void 0 : i.lng) || ((a = this.form[this.name]) == null ? void 0 : a.lng) || 51.36372
1278
- }
1279
- };
1280
- }
1281
- });
1282
- function Us(t, e, n, r, s, o) {
1283
- var u;
1284
- const i = L("l-tile-layer"), a = L("LMarker"), l = L("l-map");
1285
- return m(), g("div", {
1286
- class: R(["location-map-container", { disabled: t.disabled || t.form.processing, "is-invalid": ((u = t.form) == null ? void 0 : u.errors[t.name]) !== void 0 }])
1287
- }, [
1288
- Q(l, {
1289
- ref: "map",
1290
- zoom: t.zoom,
1291
- "onUpdate:zoom": e[0] || (e[0] = (d) => t.zoom = d),
1292
- useGlobalLeaflet: !1,
1293
- center: this.center,
1294
- onClick: t.setMarker
1295
- }, {
1296
- default: ie(() => [
1297
- Q(i, {
1298
- url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
1299
- "layer-type": "base",
1300
- name: "OpenStreetMap"
1301
- }),
1302
- t.marker ? (m(), ee(a, {
1303
- key: 0,
1304
- "lat-lng": t.marker,
1305
- draggable: !t.readonly && !t.disabled,
1306
- onDragend: t.setMarker
1307
- }, null, 8, ["lat-lng", "draggable", "onDragend"])) : j("", !0)
1308
- ]),
1309
- _: 1
1310
- }, 8, ["zoom", "center", "onClick"])
1311
- ], 2);
1312
- }
1313
- const Ja = /* @__PURE__ */ V(Ms, [["render", Us]]), As = E({
1314
- components: {
1315
- TextInput: We
1316
- },
1317
- props: {
1318
- name: {
1319
- type: String,
1320
- default: "mobile",
1321
- required: !0
1322
- }
1323
- }
1324
- });
1325
- function Ds(t, e, n, r, s, o) {
1326
- const i = L("TextInput");
1327
- return m(), ee(i, {
1328
- name: t.name,
1329
- placeholder: "موبایل خود را وارد کنید",
1330
- type: "tel",
1331
- class: "form-control-mobile fanum"
1332
- }, null, 8, ["name"]);
1333
- }
1334
- const Qa = /* @__PURE__ */ V(As, [["render", Ds]]), Ns = E({
1335
- components: {
1336
- TextInput: We
1337
- },
1338
- props: {
1339
- name: {
1340
- type: String,
1341
- default: "password",
1342
- required: !0
1343
- }
1344
- }
1345
- });
1346
- function Ps(t, e, n, r, s, o) {
1347
- const i = L("TextInput");
1348
- return m(), ee(i, {
1349
- name: t.name,
1350
- placeholder: "گذرواژه خود را وارد کنید",
1351
- type: "password"
1352
- }, null, 8, ["name"]);
1353
- }
1354
- const el = /* @__PURE__ */ V(Ns, [["render", Ps]]), zs = E({
1355
- components: { InputGroup: _t, InputGroupText: bt },
1356
- props: {
1357
- name: {
1358
- type: String,
1359
- required: !0
1360
- },
1361
- required: Boolean,
1362
- disabled: Boolean,
1363
- readonly: Boolean,
1364
- unit: {
1365
- type: String,
1366
- default: "عدد"
1367
- },
1368
- min: {
1369
- type: Number,
1370
- default: 0
1371
- },
1372
- max: {
1373
- type: Number,
1374
- default: null
1375
- }
1376
- },
1377
- setup(t) {
1378
- let e = T("form"), n = T("group", {});
1379
- e === void 0 && (e = {
1380
- errors: {},
1381
- getID(s) {
1382
- }
1383
- }), e[t.name] || (e[t.name] = t.min);
1384
- const r = q({
1385
- get() {
1386
- var s;
1387
- return n.value && e.value[n.value.name] ? (s = n.value) == null ? void 0 : s.getData(t.name) : e.value[t.name];
1388
- },
1389
- set(s) {
1390
- var o;
1391
- (o = n == null ? void 0 : n.value) != null && o.name ? n.value.setData(t.name, s) : e.value[t.name] = s;
1392
- }
1393
- });
1394
- return r.value || (r.value = t.min), { modelValue: r, group: n, form: e };
1395
- },
1396
- methods: {
1397
- onChange(t) {
1398
- var n;
1399
- let e = parseFloat(this.$number.toEnglish((n = t.detail) == null ? void 0 : n.unmasked)) || 1;
1400
- this.$emit("update:modelValue", e), this.modelValue = e;
1401
- },
1402
- increment() {
1403
- (!this.max || this.max < this.modelValue) && (this.modelValue = this.modelValue + 1);
1404
- },
1405
- decrement() {
1406
- (!this.min || this.min < this.modelValue) && this.modelValue > 1 && (this.modelValue = this.modelValue - 1);
1407
- }
1408
- },
1409
- data() {
1410
- return {};
1411
- }
1412
- }), Os = ["name", "value", "disabled", "readonly"];
1413
- function Rs(t, e, n, r, s, o) {
1414
- const i = L("InputGroupText"), a = L("InputGroup"), l = xn("maska");
1415
- return m(), ee(a, { class: "input-group-quantity" }, {
1416
- default: ie(() => [
1417
- b("button", {
1418
- onClick: e[0] || (e[0] = (...u) => t.increment && t.increment(...u)),
1419
- type: "button",
1420
- class: "btn"
1421
- }, e[3] || (e[3] = [
1422
- b("svg", {
1423
- width: "800px",
1424
- height: "800px",
1425
- viewBox: "0 0 24 24",
1426
- fill: "none",
1427
- xmlns: "http://www.w3.org/2000/svg"
1428
- }, [
1429
- b("path", {
1430
- d: "M13 3C13 2.44772 12.5523 2 12 2C11.4477 2 11 2.44772 11 3V11H3C2.44772 11 2 11.4477 2 12C2 12.5523 2.44772 13 3 13H11V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V13H21C21.5523 13 22 12.5523 22 12C22 11.4477 21.5523 11 21 11H13V3Z",
1431
- fill: "#0F0F0F"
1432
- })
1433
- ], -1)
1434
- ])),
1435
- te(b("input", {
1436
- name: t.name,
1437
- value: this.modelValue,
1438
- "data-maska": "###,###,###,###,###,###,###",
1439
- "data-maska-reversed": "",
1440
- onMaska: e[1] || (e[1] = (...u) => t.onChange && t.onChange(...u)),
1441
- class: R([{ "is-invalid": t.form.errors[t.name] }, "form-control fanum text-center"]),
1442
- disabled: t.disabled || t.form.processing,
1443
- readonly: t.readonly,
1444
- type: "tel"
1445
- }, null, 42, Os), [
1446
- [l]
1447
- ]),
1448
- b("button", {
1449
- onClick: e[2] || (e[2] = (...u) => t.decrement && t.decrement(...u)),
1450
- type: "button",
1451
- class: "btn"
1452
- }, e[4] || (e[4] = [
1453
- b("svg", {
1454
- width: "800px",
1455
- height: "800px",
1456
- viewBox: "0 0 20 20",
1457
- xmlns: "http://www.w3.org/2000/svg",
1458
- fill: "none"
1459
- }, [
1460
- b("path", {
1461
- fill: "#000000",
1462
- "fill-rule": "evenodd",
1463
- d: "M18 10a1 1 0 01-1 1H3a1 1 0 110-2h14a1 1 0 011 1z"
1464
- })
1465
- ], -1)
1466
- ])),
1467
- Q(i, { class: "fanum" }, {
1468
- default: ie(() => [
1469
- yt(W(t.unit), 1)
1470
- ]),
1471
- _: 1
1472
- }),
1473
- O(t.$slots, "suffix")
1474
- ]),
1475
- _: 3
1476
- });
1477
- }
1478
- const Bs = /* @__PURE__ */ V(zs, [["render", Rs]]), js = E({
1479
- components: { GroupControl: ws, QuantityInput: Bs, InputGroup: _t, InputGroupText: bt, Dropdown: or, DropdownToggle: pr, DropdownMenu: dr },
1480
- props: {
1481
- name: {
1482
- type: String,
1483
- required: !0
1484
- },
1485
- required: Boolean,
1486
- disabled: Boolean,
1487
- readonly: Boolean,
1488
- options: {
1489
- type: Array,
1490
- default: [],
1491
- required: !0
1492
- },
1493
- max: {
1494
- type: Number,
1495
- default: null
1496
- },
1497
- totalMax: {
1498
- type: Number,
1499
- default: null
1500
- },
1501
- min: {
1502
- type: Number,
1503
- default: 0
1504
- },
1505
- totalMin: {
1506
- type: Number,
1507
- default: null
1508
- },
1509
- unit: {
1510
- type: String,
1511
- default: "Number"
1512
- }
1513
- },
1514
- setup(t) {
1515
- let e = T("form"), n = T("group", {});
1516
- return e === void 0 && (e = {
1517
- errors: {},
1518
- getID(s) {
1519
- }
1520
- }), e[t.name] || (e[t.name] = t.min), { modelValue: q({
1521
- get() {
1522
- var s;
1523
- return n.value && e.value[n.value.name] ? (s = n.value) == null ? void 0 : s.getData(t.name) : e.value[t.name];
1524
- },
1525
- set(s) {
1526
- var o;
1527
- (o = n == null ? void 0 : n.value) != null && o.name ? n.value.setData(t.name, s) : e.value[t.name] = s;
1528
- }
1529
- }), form: e };
1530
- },
1531
- computed: {
1532
- totalQuantity() {
1533
- return this.modelValue ? Object.values(this.modelValue).reduce((t, e) => t + e, 0) : this.options.length;
1534
- }
1535
- },
1536
- methods: {
1537
- show() {
1538
- this.showDropdown = !this.showDropdown;
1539
- },
1540
- clickOnOutside(t) {
1541
- this.$refs.input.contains(t.target) || (this.showDropdown = !1);
1542
- }
1543
- },
1544
- mounted() {
1545
- typeof window < "u" && window.addEventListener("click", this.clickOnOutside);
1546
- },
1547
- beforeUnmount() {
1548
- typeof window < "u" && window.removeEventListener("click", this.clickOnOutside);
1549
- },
1550
- data() {
1551
- return {
1552
- showDropdown: !1
1553
- };
1554
- }
1555
- }), Ls = {
1556
- ref: "input",
1557
- class: "multi-quantity-input fanum"
1558
- }, qs = { class: "row align-items-center justify-content-between g-0" }, xs = ["innerHTML"], Hs = { class: "col-auto" };
1559
- function Gs(t, e, n, r, s, o) {
1560
- const i = L("QuantityInput"), a = L("GroupControl");
1561
- return m(), g("div", Ls, [
1562
- b("button", {
1563
- type: "button",
1564
- class: "form-control fanum dropdown-toggle",
1565
- onClick: e[0] || (e[0] = nn((...l) => t.show && t.show(...l), ["prevent"]))
1566
- }, W(t.totalQuantity) + " " + W(t.unit), 1),
1567
- b("div", {
1568
- class: R(["multi-quantity-input--dropdown", { show: t.showDropdown }])
1569
- }, [
1570
- Q(a, { name: t.name }, {
1571
- default: ie(() => [
1572
- (m(!0), g(ve, null, _e(t.options, (l, u) => (m(), g("div", qs, [
1573
- b("div", {
1574
- class: "col-auto",
1575
- innerHTML: (l == null ? void 0 : l.name) || l
1576
- }, null, 8, xs),
1577
- b("div", Hs, [
1578
- Q(i, {
1579
- name: u,
1580
- min: l.min || t.min,
1581
- max: l.max || t.max
1582
- }, null, 8, ["name", "min", "max"])
1583
- ])
1584
- ]))), 256))
1585
- ]),
1586
- _: 1
1587
- }, 8, ["name"])
1588
- ], 2)
1589
- ], 512);
1590
- }
1591
- const tl = /* @__PURE__ */ V(js, [["render", Gs]]), Ws = E({
1592
- emits: ["update:modelValue", "search", "searching", "change", "selected"],
1593
- props: {
1594
- name: {
1595
- type: String,
1596
- required: !0
1597
- },
1598
- modelValue: "",
1599
- label: {
1600
- type: String,
1601
- default: null
1602
- },
1603
- key: {
1604
- type: String,
1605
- default: null
1606
- },
1607
- placeholder: {
1608
- type: String,
1609
- default: "Click to choice"
1610
- },
1611
- searchPlaceholder: {
1612
- type: String,
1613
- default: "Type for search..."
1614
- },
1615
- multiple: {
1616
- type: Boolean,
1617
- default: !1
1618
- },
1619
- required: {
1620
- type: Boolean,
1621
- default: !1
1622
- },
1623
- config: {
1624
- type: Object,
1625
- default: {}
1626
- },
1627
- locale: {
1628
- type: String,
1629
- default: "en"
1630
- },
1631
- options: Array,
1632
- searchEnabled: {
1633
- type: Boolean,
1634
- default: !1
1635
- },
1636
- hideDropdown: {
1637
- type: Boolean,
1638
- default: !1
1639
- },
1640
- search: {
1641
- type: Object,
1642
- default: {
1643
- url: null
1644
- }
1645
- }
1646
- },
1647
- setup(t) {
1648
- let e = T("form", {
1649
- errors: {},
1650
- getID(s) {
1651
- return s;
1652
- }
1653
- }), n = T("group", {});
1654
- return { modelValue: q({
1655
- get() {
1656
- var s;
1657
- return n.value && e.value[n.value.name] ? (s = n.value) == null ? void 0 : s.getData(t.name) : e.value[t.name];
1658
- },
1659
- set(s) {
1660
- var o;
1661
- (o = n == null ? void 0 : n.value) != null && o.name ? n.value.setData(t.name, s) : e.value[t.name] = s;
1662
- }
1663
- }), form: e, group: n };
1664
- },
1665
- computed: {
1666
- selectedValue() {
1667
- return this.multiple ? this.modelValue && typeof this.modelValue == "object" ? Object.values(this.modelValue) : this.modelValue ? [this.modelValue] : null : this.modelValue;
1668
- }
1669
- },
1670
- watch: {
1671
- options: {
1672
- handler: function(t, e) {
1673
- setTimeout(() => this.init(), 300);
1674
- },
1675
- deep: !0
1676
- }
1677
- },
1678
- methods: {
1679
- getKeyFromItem(t) {
1680
- var e;
1681
- return (e = (this.key ? t[this.key] : (t == null ? void 0 : t.id) ?? (t == null ? void 0 : t.name) ?? (t == null ? void 0 : t.label) ?? (t == null ? void 0 : t.value)) ?? t) == null ? void 0 : e.toString();
1682
- },
1683
- getLabelFromItem(t) {
1684
- return (this.label ? t[this.label] : (t == null ? void 0 : t.name) ?? (t == null ? void 0 : t.label) ?? (t == null ? void 0 : t.value)) ?? t;
1685
- },
1686
- selected(t) {
1687
- var e;
1688
- return this.multiple ? (this.selectedValue || []).includes(this.getKeyFromItem(t)) : this.getKeyFromItem(t) === ((e = this.modelValue) == null ? void 0 : e.toString());
1689
- },
1690
- init() {
1691
- var t, e;
1692
- this.ChoicesClass && (this.choices && this.destroy(), typeof window < "u" && this.locale === "en" && document.dir === "rtl" && (this.currentLocale = "fa"), this.choices = new this.ChoicesClass(this.$refs.input, {
1693
- searchEnabled: this.searchEnabled || !!((t = this.search) != null && t.url),
1694
- searchChoices: this.searchEnabled && !((e = this.search) != null && e.url),
1695
- removeItemButton: !0,
1696
- placeholderValue: this.placeholder,
1697
- searchPlaceholderValue: this.placeholder,
1698
- shouldSort: !1,
1699
- itemSelectText: null,
1700
- ...this.localeTranslates[this.currentLocale],
1701
- ...this.config
1702
- }), this.$refs.input.addEventListener("search", this.searchHandle));
1703
- },
1704
- destroy() {
1705
- var t;
1706
- this.$refs.input.removeEventListener("search", this.searchHandle), (t = this.choices) == null || t.destroy();
1707
- },
1708
- searchHandle(t) {
1709
- this.$emit("search", t), clearTimeout(this.searchDebounceTimer), this.showLoading(), this.searchDebounceTimer = setTimeout(() => {
1710
- this.doSearch(t.detail.value);
1711
- }, 400);
1712
- },
1713
- async showLoading() {
1714
- this.loading = !0, await this.choices.setChoices(
1715
- [{ value: "", label: this.localeTranslates[this.currentLocale].searchingPlaceholder || "Searching...", disabled: !0 }],
1716
- "value",
1717
- "label",
1718
- !0
1719
- // replaceChoices
1720
- );
1721
- },
1722
- async doSearch(t) {
1723
- var e;
1724
- if (this.$emit("searching", t), !!((e = this.search) != null && e.url)) {
1725
- this.searchController && this.searchController.abort(), this.searchController = new AbortController();
1726
- try {
1727
- const r = await (await fetch(this.search.url + "?query=" + encodeURIComponent(t), {
1728
- method: "POST",
1729
- signal: this.searchController.signal
1730
- })).json();
1731
- await this.choices.setChoices(
1732
- r.map((s) => ({
1733
- value: this.getKeyFromItem(s),
1734
- label: this.getLabelFromItem(s)
1735
- })),
1736
- "value",
1737
- "label",
1738
- !0
1739
- ), this.loading = !1;
1740
- } catch (n) {
1741
- n.name !== "AbortError" && (this.loading = !1, console.error(n), await this.choices.setChoices([], "value", "label", !0));
1742
- }
1743
- }
1744
- }
1745
- },
1746
- mounted() {
1747
- import("./choices-KiM-I_0P.js").then(({ default: t }) => {
1748
- this.ChoicesClass = t, this.init();
1749
- });
1750
- },
1751
- beforeUnmount() {
1752
- this.destroy();
1753
- },
1754
- data() {
1755
- return {
1756
- ChoicesClass: null,
1757
- choices: null,
1758
- loading: !1,
1759
- searchDebounceTimer: null,
1760
- searchController: null,
1761
- currentLocale: this.locale,
1762
- localeTranslates: {
1763
- fa: {
1764
- placeholderValue: "انتخاب کنید...",
1765
- searchPlaceholderValue: "برای جستجو تایپ کنید...",
1766
- searchingPlaceholder: "در حال جستجو...",
1767
- loadingText: "در حال جستجو...",
1768
- noResultsText: "نتیجه ای یافت نشد",
1769
- noChoicesText: "گزینه ای وجود ندارد"
1770
- }
1771
- }
1772
- };
1773
- }
1774
- }), Ys = ["name", "id"], Xs = ["value", "selected"];
1775
- function Zs(t, e, n, r, s, o) {
1776
- return m(), g("div", {
1777
- class: R(["select2-controller", {
1778
- "is-invalid": t.form.errors[t.name],
1779
- "select2-dropdown-hidden": t.hideDropdown === !0
1780
- }])
1781
- }, [
1782
- te(b("select", en(t.$props, {
1783
- name: t.name,
1784
- id: t.name,
1785
- "onUpdate:modelValue": e[0] || (e[0] = (i) => t.modelValue = i),
1786
- class: ["form-control-select", {
1787
- "form-control-select--loading": t.loading,
1788
- "is-invalid": t.form.errors[t.name]
1789
- }],
1790
- ref: "input"
1791
- }), [
1792
- (m(!0), g(ve, null, _e(t.options, (i, a) => (m(), g("option", {
1793
- value: t.getKeyFromItem(i),
1794
- selected: t.selected(i)
1795
- }, W(t.getLabelFromItem(i)), 9, Xs))), 256))
1796
- ], 16, Ys), [
1797
- [Hn, t.modelValue]
1798
- ])
1799
- ], 2);
1800
- }
1801
- const nl = /* @__PURE__ */ V(Ws, [["render", Zs]]), Ks = E({
1802
- emits: ["update:modelValue"],
1803
- props: {
1804
- name: {
1805
- type: String,
1806
- default: null
1807
- },
1808
- modelValue: {
1809
- type: Number,
1810
- default: 0
1811
- },
1812
- value: {
1813
- type: Number,
1814
- default: 0
1815
- },
1816
- maxStars: {
1817
- type: Number,
1818
- default: 5
1819
- },
1820
- precision: {
1821
- type: Number,
1822
- default: 2
1823
- },
1824
- showValue: {
1825
- type: Boolean,
1826
- default: !0
1827
- },
1828
- readonly: {
1829
- type: Boolean,
1830
- default: !1
1831
- }
1832
- },
1833
- setup(t) {
1834
- let e = T("form");
1835
- return e === void 0 && (e = {
1836
- errors: {},
1837
- getID(n) {
1838
- }
1839
- }), { form: e };
1840
- },
1841
- computed: {
1842
- displayRating() {
1843
- return (this.hoveredRating ?? this.modelValue ?? (this.name ? this.form[this.name] : null) ?? this.value).toFixed(1);
1844
- }
1845
- },
1846
- methods: {
1847
- getStarFill(t) {
1848
- const e = this.hoveredRating ?? (this.modelValue || this.form[this.name]), n = Math.floor(e), r = e - n;
1849
- return t <= n ? 100 : t === n + 1 ? r * 100 : 0;
1850
- },
1851
- setHover(t) {
1852
- if (this.readonly) return;
1853
- const e = this.$refs.ratingContainer.getBoundingClientRect();
1854
- let n = t.clientX - e.left;
1855
- this.isRTL && (n = e.width - (t.clientX - e.left));
1856
- const r = e.width / this.maxStars;
1857
- let s = Math.round(n / r * this.precision) / this.precision;
1858
- s = Math.min(s, this.maxStars), this.hoveredRating = s;
1859
- },
1860
- updateRating() {
1861
- this.readonly || (this.name && (this.form[this.name] = this.hoveredRating.toFixed(1)), this.$emit("update:modelValue", this.hoveredRating.toFixed(1)));
1862
- },
1863
- resetHover() {
1864
- this.readonly || (this.hoveredRating = null);
1865
- }
1866
- },
1867
- mounted() {
1868
- typeof window < "u" && this.$refs.ratingContainer && (this.isRTL = getComputedStyle(this.$refs.ratingContainer).direction === "rtl");
1869
- },
1870
- data() {
1871
- return {
1872
- hoveredRating: parseFloat(this.modelValue || ((this.name ? this.form[this.name] : null) ?? this.value)),
1873
- isRTL: !1
1874
- };
1875
- }
1876
- }), Js = { class: "star-rating" }, Qs = {
1877
- key: 0,
1878
- class: "rating-value fanum"
1879
- };
1880
- function ei(t, e, n, r, s, o) {
1881
- return m(), g("div", Js, [
1882
- b("div", {
1883
- class: "star-rating-container",
1884
- ref: "ratingContainer",
1885
- onMouseleave: e[0] || (e[0] = (...i) => t.resetHover && t.resetHover(...i)),
1886
- onMousemove: e[1] || (e[1] = (...i) => t.setHover && t.setHover(...i)),
1887
- onClick: e[2] || (e[2] = (...i) => t.updateRating && t.updateRating(...i))
1888
- }, [
1889
- (m(!0), g(ve, null, _e(t.maxStars, (i) => (m(), g("div", {
1890
- key: i,
1891
- class: "star-wrapper"
1892
- }, [
1893
- e[3] || (e[3] = b("div", { class: "star-bg" }, "★", -1)),
1894
- b("span", {
1895
- class: "star-overlay",
1896
- style: vt({ width: t.getStarFill(i) + "%" })
1897
- }, "★", 4)
1898
- ]))), 128))
1899
- ], 544),
1900
- t.showValue && t.displayRating > 0 ? (m(), g("div", Qs, W(t.displayRating), 1)) : j("", !0)
1901
- ]);
1902
- }
1903
- const rl = /* @__PURE__ */ V(Ks, [["render", ei]]), ti = E({
1904
- components: {
1905
- Spinner: br
1906
- },
1907
- inject: ["form"],
1908
- props: {
1909
- disabled: {
1910
- type: Boolean,
1911
- default: !1
1912
- }
1913
- }
1914
- }), ni = ["disabled"], ri = {
1915
- key: 0,
1916
- class: "submit-upload-percent"
1917
- };
1918
- function si(t, e, n, r, s, o) {
1919
- var a, l, u, d;
1920
- const i = L("Spinner");
1921
- return m(), g("button", {
1922
- type: "submit",
1923
- disabled: t.disabled || ((a = t.form) == null ? void 0 : a.processing) || ((l = t.form) == null ? void 0 : l.uploading)
1924
- }, [
1925
- (u = t.form) != null && u.processing || (d = t.form) != null && d.uploading ? (m(), ee(i, { key: 0 })) : j("", !0),
1926
- O(t.$slots, "default", { form: t.form }, () => [
1927
- e[0] || (e[0] = yt(" تایید و ثبت اطلاعات "))
1928
- ]),
1929
- O(t.$slots, "progress", {}, () => {
1930
- var p, c;
1931
- return [
1932
- (p = t.form) != null && p.uploading ? (m(), g("span", ri, W((c = t.form) == null ? void 0 : c.uploading) + "%", 1)) : j("", !0)
1933
- ];
1934
- })
1935
- ], 8, ni);
1936
- }
1937
- const sl = /* @__PURE__ */ V(ti, [["render", si]]), ii = E({
1938
- components: {
1939
- VueTelInput: er
1940
- },
1941
- props: {
1942
- name: {
1943
- type: String,
1944
- default: "email",
1945
- required: !0
1946
- },
1947
- placeHolder: {
1948
- type: String,
1949
- default: "000 000 0000"
1950
- }
1951
- },
1952
- setup(t) {
1953
- let e = T("form");
1954
- return e === void 0 && (e = {
1955
- errors: {},
1956
- getID(n) {
1957
- }
1958
- }), { form: e };
1959
- },
1960
- methods: {
1961
- inputEvent(t, e) {
1962
- this.form[this.name] = e.number, this.valid = e.valid;
1963
- }
1964
- },
1965
- data() {
1966
- return {
1967
- defaultValue: this.form[this.name],
1968
- valid: null
1969
- };
1970
- }
1971
- }), oi = {
1972
- class: "telephone-input input-group fanum",
1973
- dir: "ltr"
1974
- };
1975
- function ai(t, e, n, r, s, o) {
1976
- var a;
1977
- const i = L("vue-tel-input");
1978
- return m(), g("div", oi, [
1979
- Q(i, {
1980
- mode: "national",
1981
- validCharactersOnly: !0,
1982
- defaultCountry: "ir",
1983
- preferredCountries: ["ir", "us", "tr", "ca"],
1984
- dropdownOptions: {
1985
- showDialCodeInList: !0,
1986
- showDialCodeInSelection: !0,
1987
- showSearchBox: !0,
1988
- searchBoxPlaceholder: "Search...",
1989
- showFlags: !1
1990
- },
1991
- onOnInput: t.inputEvent,
1992
- inputOptions: {
1993
- placeholder: t.placeHolder
1994
- },
1995
- modelValue: t.defaultValue,
1996
- "onUpdate:modelValue": e[0] || (e[0] = (l) => t.defaultValue = l),
1997
- styleClasses: "form-control form-control-tel fanum " + (t.valid === !1 || ((a = t.form) == null ? void 0 : a.errors[t.name]) !== void 0 ? " is-invalid" : "")
1998
- }, null, 8, ["onOnInput", "inputOptions", "modelValue", "styleClasses"])
1999
- ]);
2000
- }
2001
- const il = /* @__PURE__ */ V(ii, [["render", ai]]), li = E({
2002
- props: {
2003
- name: {
2004
- type: String,
2005
- required: !0
2006
- }
2007
- },
2008
- setup(t) {
2009
- let e = T("form", {
2010
- errors: {},
2011
- getID(s) {
2012
- return s;
2013
- }
2014
- }), n = T("group", {});
2015
- return { modelValue: q({
2016
- get() {
2017
- var s;
2018
- return n.value && e.value[n.value.name] ? (s = n.value) == null ? void 0 : s.getData(t.name) : e.value[t.name];
2019
- },
2020
- set(s) {
2021
- var o;
2022
- (o = n == null ? void 0 : n.value) != null && o.name ? n.value.setData(t.name, s) : e.value[t.name] = s;
2023
- }
2024
- }), form: e, group: n };
2025
- }
2026
- }), ui = ["name", "disabled"];
2027
- function di(t, e, n, r, s, o) {
2028
- var i, a;
2029
- return te((m(), g("textarea", {
2030
- name: t.name,
2031
- "onUpdate:modelValue": e[0] || (e[0] = (l) => t.modelValue = l),
2032
- class: R([{ "is-invalid": ((i = t.form) == null ? void 0 : i.errors[t.name]) !== void 0 }, "form-control"]),
2033
- disabled: (a = t.form) == null ? void 0 : a.processing
2034
- }, null, 10, ui)), [
2035
- [Me, t.modelValue]
2036
- ]);
2037
- }
2038
- const ol = /* @__PURE__ */ V(li, [["render", di]]), pi = E({
2039
- props: {
2040
- name: {
2041
- type: String,
2042
- required: !0
2043
- },
2044
- maxLength: {
2045
- type: Number,
2046
- default: 5
2047
- },
2048
- placeholder: {
2049
- type: String,
2050
- default: ""
2051
- }
2052
- },
2053
- computed: {
2054
- inputID() {
2055
- return this.form.getID(this);
2056
- },
2057
- placeholderLines() {
2058
- return this.placeholder ? this.placeholder : "_".repeat(this.maxLength);
2059
- }
2060
- },
2061
- setup(t) {
2062
- let e = T("form", {
2063
- errors: {},
2064
- getID(s) {
2065
- return s;
2066
- }
2067
- }), n = T("group", {});
2068
- return { modelValue: q({
2069
- get() {
2070
- var s;
2071
- return n.value && e.value[n.value.name] ? (s = n.value) == null ? void 0 : s.getData(t.name) : e.value[t.name];
2072
- },
2073
- set(s) {
2074
- var o;
2075
- (o = n == null ? void 0 : n.value) != null && o.name ? n.value.setData(t.name, s) : e.value[t.name] = s;
2076
- }
2077
- }), form: e, group: n };
2078
- }
2079
- }), ci = ["name", "id", "disabled", "placeholder", "maxlength", "data-auto-submit-length"];
2080
- function fi(t, e, n, r, s, o) {
2081
- var i, a;
2082
- return te((m(), g("input", {
2083
- name: t.name,
2084
- id: t.inputID,
2085
- "onUpdate:modelValue": e[0] || (e[0] = (l) => t.modelValue = l),
2086
- class: R([{ "is-invalid": ((i = t.form) == null ? void 0 : i.errors[t.name]) !== void 0 }, "form-control form-control-otp fanum"]),
2087
- disabled: (a = t.form) == null ? void 0 : a.processing,
2088
- placeholder: t.placeholderLines,
2089
- maxlength: t.maxLength,
2090
- "data-auto-submit-length": t.maxLength,
2091
- type: "tel"
2092
- }, null, 10, ci)), [
2093
- [Me, t.modelValue]
2094
- ]);
2095
- }
2096
- const al = /* @__PURE__ */ V(pi, [["render", fi]]), ll = {
2097
- __name: "DropzoneInput",
2098
- props: {
2099
- name: {
2100
- type: String,
2101
- required: !0
2102
- },
2103
- multiple: {
2104
- type: Boolean,
2105
- default: !1
2106
- },
2107
- modelValue: String,
2108
- url: { type: String, default: "/upload" },
2109
- options: { type: Object, default: () => ({}) }
2110
- },
2111
- emits: ["update:modelValue"],
2112
- setup(t, { emit: e }) {
2113
- const n = t, r = e, s = T("form", {
2114
- value: {},
2115
- errors: {},
2116
- getID: (u) => u
2117
- }), o = T("group", null), i = G(null), a = G(null), l = q({
2118
- get() {
2119
- var u;
2120
- return (u = o == null ? void 0 : o.value) != null && u.name ? o.value.getData(n.name) : s.value[n.name];
2121
- },
2122
- set(u) {
2123
- var d;
2124
- (d = o == null ? void 0 : o.value) != null && d.name ? o.value.setData(n.name, u) : s.value[n.name] = u, r("update:modelValue", u);
2125
- }
2126
- });
2127
- return ye(() => {
2128
- a.value = new tr(i.value, {
2129
- url: n.url,
2130
- addRemoveLinks: !0,
2131
- maxFiles: n.multiple ? null : 1,
2132
- ...n.options
2133
- }), a.value.on("error", (u, d) => {
2134
- let p = "خطا در آپلود";
2135
- typeof d == "string" && (p = d), d != null && d.message && (p = d.message), u.previewElement.classList.add("dz-error");
2136
- const c = u.previewElement.querySelector("[data-dz-errormessage]");
2137
- c && (c.textContent = p);
2138
- }), a.value.on("success", (u, d) => {
2139
- const p = d.data ?? d;
2140
- n.multiple ? l.value = [...l.value || [], p] : l.value = p;
2141
- }), a.value.on("removedfile", async (u) => {
2142
- let d = u.xhr.response;
2143
- if (d)
2144
- try {
2145
- d = JSON.parse(d), l.value = (l.value || []).filter((p) => p.path !== d.path), await fetch(n.url, {
2146
- method: "DELETE",
2147
- headers: {
2148
- "Content-Type": "application/json",
2149
- Accept: "application/json"
2150
- },
2151
- body: d.path
2152
- });
2153
- } catch (p) {
2154
- console.error("حذف فایل در سرور با خطا مواجه شد", p);
2155
- }
2156
- });
2157
- }), (u, d) => (m(), g("div", {
2158
- class: "inertia-dropzone-input dropzone",
2159
- ref_key: "dz",
2160
- ref: i
2161
- }, null, 512));
2162
- }
2163
- }, mi = E({
2164
- props: {
2165
- modelValue: "",
2166
- name: {
2167
- type: String,
2168
- required: !0
2169
- },
2170
- multiple: {
2171
- type: Boolean,
2172
- default: !1
2173
- },
2174
- endpoint: {
2175
- type: String,
2176
- default: "/upload"
2177
- }
2178
- },
2179
- setup(t) {
2180
- let e = T("form");
2181
- return e === void 0 && (e = {
2182
- errors: {},
2183
- getID(n) {
2184
- }
2185
- }), { form: e };
2186
- },
2187
- computed: {
2188
- allFiles() {
2189
- return this.files;
2190
- }
2191
- },
2192
- methods: {
2193
- addFile(t) {
2194
- let e = {
2195
- id: crypto.randomUUID(),
2196
- percent: 0,
2197
- error: 0,
2198
- file: t
2199
- };
2200
- this.multiple ? this.files.push(e) : this.files = [e], this.uploadFile(e), this.$refs.input.value = "";
2201
- },
2202
- calculatePercent(t, e) {
2203
- t.lengthComputable && (this.files.find((n) => n.id === e.id).percent = Math.round(t.loaded / t.total * 100));
2204
- },
2205
- addFileToInputValue(t, e) {
2206
- var n;
2207
- this.files.find((r) => r.id === t.id).path = ((n = e.data) == null ? void 0 : n.path) || e.path, this.form[this.name] = this.multiple ? this.files.map((r) => r.path) : this.files[0].path, this.$emit("update:modelValue", this.form[this.name]);
2208
- },
2209
- async uploadFile(t) {
2210
- let e = this, n = new FormData();
2211
- n.append("file", t.file), e.files.find((r) => r.id === t.id).error = "", await fetch(
2212
- this.endpoint,
2213
- {
2214
- method: "POST",
2215
- headers: {
2216
- Accept: "application/json"
2217
- },
2218
- body: n
2219
- }
2220
- ).then((r) => r.json()).then(function(r) {
2221
- if (r.errors)
2222
- throw r;
2223
- e.addFileToInputValue(t, r);
2224
- }).catch(function(r) {
2225
- var s, o;
2226
- console.error("error on uploader", r), e.files.find((i) => i.id === t.id).error = ((o = (s = r.response) == null ? void 0 : s.data) == null ? void 0 : o.message) || r.message;
2227
- });
2228
- },
2229
- async deleteFile(t) {
2230
- this.files = this.files.filter((e) => e.id !== t.id), await fetch(this.endpoint, {
2231
- method: "DELETE",
2232
- body: t.path
2233
- });
2234
- },
2235
- fileSelected(t) {
2236
- Array.from(t.target.files).forEach((e) => this.addFile(e));
2237
- }
2238
- },
2239
- data() {
2240
- return {
2241
- files: []
2242
- };
2243
- }
2244
- }), hi = { class: "file-input-uploader" }, gi = ["name", "disabled", "multiple"], yi = { class: "file-input-uploader--list" }, vi = ["id"], _i = {
2245
- key: 0,
2246
- class: "file-input-uploader--progress"
2247
- }, bi = {
2248
- key: 1,
2249
- class: "file-input-uploader--list-error"
2250
- }, wi = {
2251
- class: "file-input-uploader--list-item--size",
2252
- dir: "ltr"
2253
- }, $i = { class: "file-input-uploader--list-item--actions" }, Si = ["onClick"], Fi = ["onClick"];
2254
- function Ti(t, e, n, r, s, o) {
2255
- var i, a;
2256
- return m(), g("div", hi, [
2257
- b("input", {
2258
- ref: "input",
2259
- name: t.name,
2260
- class: R([{ "is-invalid": ((i = t.form) == null ? void 0 : i.errors[t.name]) !== void 0 }, "form-control"]),
2261
- disabled: (a = t.form) == null ? void 0 : a.processing,
2262
- type: "file",
2263
- multiple: t.multiple,
2264
- onChange: e[0] || (e[0] = (...l) => t.fileSelected && t.fileSelected(...l))
2265
- }, null, 42, gi),
2266
- b("div", yi, [
2267
- (m(!0), g(ve, null, _e(t.allFiles, (l) => (m(), g("div", {
2268
- id: "file-" + l.id,
2269
- class: "file-input-uploader--list-item"
2270
- }, [
2271
- l.percent && l.percent < 100 ? (m(), g("div", _i, [
2272
- b("div", {
2273
- style: vt({ width: l.percent + "%" })
2274
- }, null, 4)
2275
- ])) : j("", !0),
2276
- b("div", null, W(l.file.name), 1),
2277
- l.error ? (m(), g("div", bi, W(l.error), 1)) : j("", !0),
2278
- b("div", wi, W(Math.round(l.file.size / 1024)) + "Kb", 1),
2279
- b("div", $i, [
2280
- l.error ? (m(), g("button", {
2281
- key: 0,
2282
- onClick: (u) => t.uploadFile(l),
2283
- type: "button",
2284
- class: "file-input-uploader--list-item--btn"
2285
- }, e[1] || (e[1] = [
2286
- b("svg", {
2287
- fill: "#000000",
2288
- width: "800px",
2289
- height: "800px",
2290
- viewBox: "0 0 24 24",
2291
- xmlns: "http://www.w3.org/2000/svg"
2292
- }, [
2293
- b("path", { d: "M1,12A11,11,0,0,1,17.882,2.7l1.411-1.41A1,1,0,0,1,21,2V6a1,1,0,0,1-1,1H16a1,1,0,0,1-.707-1.707l1.128-1.128A8.994,8.994,0,0,0,3,12a1,1,0,0,1-2,0Zm21-1a1,1,0,0,0-1,1,9.01,9.01,0,0,1-9,9,8.9,8.9,0,0,1-4.42-1.166l1.127-1.127A1,1,0,0,0,8,17H4a1,1,0,0,0-1,1v4a1,1,0,0,0,.617.924A.987.987,0,0,0,4,23a1,1,0,0,0,.707-.293L6.118,21.3A10.891,10.891,0,0,0,12,23,11.013,11.013,0,0,0,23,12,1,1,0,0,0,22,11Z" })
2294
- ], -1)
2295
- ]), 8, Si)) : j("", !0),
2296
- l.path || l.error ? (m(), g("button", {
2297
- key: 1,
2298
- onClick: (u) => t.deleteFile(l),
2299
- type: "button",
2300
- class: "file-input-uploader--list-item--btn"
2301
- }, e[2] || (e[2] = [
2302
- b("svg", {
2303
- fill: "#000000",
2304
- width: "800px",
2305
- height: "800px",
2306
- viewBox: "0 0 24 24",
2307
- xmlns: "http://www.w3.org/2000/svg"
2308
- }, [
2309
- b("path", { d: "M12,23A11,11,0,1,0,1,12,11.013,11.013,0,0,0,12,23ZM12,3a9,9,0,1,1-9,9A9.01,9.01,0,0,1,12,3ZM8.293,14.293,10.586,12,8.293,9.707A1,1,0,0,1,9.707,8.293L12,10.586l2.293-2.293a1,1,0,0,1,1.414,1.414L13.414,12l2.293,2.293a1,1,0,1,1-1.414,1.414L12,13.414,9.707,15.707a1,1,0,0,1-1.414-1.414Z" })
2310
- ], -1)
2311
- ]), 8, Fi)) : j("", !0)
2312
- ])
2313
- ], 8, vi))), 256))
2314
- ])
2315
- ]);
2316
- }
2317
- const ul = /* @__PURE__ */ V(mi, [["render", Ti]]), ki = E({
2318
- emits: ["update:modelValue", "change"],
2319
- props: {
2320
- name: {
2321
- type: String,
2322
- default: null
2323
- },
2324
- modelValue: {
2325
- type: Number,
2326
- default: 0
2327
- },
2328
- value: {
2329
- type: Number,
2330
- default: 0
2331
- },
2332
- min: {
2333
- type: Number,
2334
- default: 1
2335
- },
2336
- max: {
2337
- type: Number,
2338
- default: 100
2339
- },
2340
- step: {
2341
- type: Number,
2342
- default: 1
2343
- },
2344
- readonly: {
2345
- type: Boolean,
2346
- default: !1
2347
- },
2348
- range: {
2349
- type: Boolean,
2350
- default: !1
2351
- },
2352
- options: {
2353
- type: Object,
2354
- default: {}
2355
- }
2356
- },
2357
- setup(t) {
2358
- let e = T("form", {
2359
- errors: {},
2360
- getID(s) {
2361
- return s;
2362
- }
2363
- }), n = T("group", {});
2364
- return { modelValue: q({
2365
- get() {
2366
- var s;
2367
- return n.value && e.value[n.value.name] ? (s = n.value) == null ? void 0 : s.getData(t.name) : e.value[t.name];
2368
- },
2369
- set(s) {
2370
- var o;
2371
- (o = n == null ? void 0 : n.value) != null && o.name ? n.value.setData(t.name, s) : e.value[t.name] = s;
2372
- }
2373
- }), form: e, group: n };
2374
- },
2375
- methods: {},
2376
- mounted() {
2377
- import("./range-slider-pips-DTDOg3Q9.js").then(({ default: t }) => {
2378
- let e = this;
2379
- this.rangeSliderEn = new t({
2380
- target: this.$refs.rangeSliderEl,
2381
- props: {
2382
- values: this.modelValue,
2383
- pips: !0,
2384
- // ... بقیه props
2385
- min: this.min || null,
2386
- max: this.max || null,
2387
- ...this.options
2388
- }
2389
- }).$on("change", function(n) {
2390
- var s, o;
2391
- e.$emit("change", n);
2392
- const r = e.range ? (s = n.detail) == null ? void 0 : s.values : (o = n.detail) == null ? void 0 : o.value;
2393
- e.modelValue = r, e.$emit("update:modelValue", r);
2394
- });
2395
- });
2396
- },
2397
- beforeUnmount() {
2398
- },
2399
- data() {
2400
- return {
2401
- rangeSliderEn: null
2402
- };
2403
- }
2404
- }), Ii = {
2405
- class: "range-input",
2406
- ref: "rangeSliderEl",
2407
- dir: "ltr"
2408
- };
2409
- function Ei(t, e, n, r, s, o) {
2410
- return m(), g("div", Ii, [
2411
- te(b("input", {
2412
- "onUpdate:modelValue": e[0] || (e[0] = (i) => t.modelValue = i),
2413
- type: "hidden"
2414
- }, null, 512), [
2415
- [Me, t.modelValue]
2416
- ])
2417
- ], 512);
2418
- }
2419
- const dl = /* @__PURE__ */ V(ki, [["render", Ei]]);
2420
- var Ye, C, sn, ae, Ut, on, an, ln, wt, nt, rt, Te = {}, un = [], Ci = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Xe = Array.isArray;
2421
- function re(t, e) {
2422
- for (var n in e) t[n] = e[n];
2423
- return t;
2424
- }
2425
- function $t(t) {
2426
- t && t.parentNode && t.parentNode.removeChild(t);
2427
- }
2428
- function St(t, e, n) {
2429
- var r, s, o, i = {};
2430
- for (o in e) o == "key" ? r = e[o] : o == "ref" ? s = e[o] : i[o] = e[o];
2431
- if (arguments.length > 2 && (i.children = arguments.length > 3 ? Ye.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (o in t.defaultProps) i[o] === void 0 && (i[o] = t.defaultProps[o]);
2432
- return Oe(t, i, r, s, null);
2433
- }
2434
- function Oe(t, e, n, r, s) {
2435
- var o = { type: t, props: e, key: n, ref: r, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: s ?? ++sn, __i: -1, __u: 0 };
2436
- return s == null && C.vnode != null && C.vnode(o), o;
2437
- }
2438
- function he(t) {
2439
- return t.children;
2440
- }
2441
- function Re(t, e) {
2442
- this.props = t, this.context = e;
2443
- }
2444
- function ge(t, e) {
2445
- if (e == null) return t.__ ? ge(t.__, t.__i + 1) : null;
2446
- for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
2447
- return typeof t.type == "function" ? ge(t) : null;
2448
- }
2449
- function dn(t) {
2450
- var e, n;
2451
- if ((t = t.__) != null && t.__c != null) {
2452
- for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) {
2453
- t.__e = t.__c.base = n.__e;
2454
- break;
2455
- }
2456
- return dn(t);
2457
- }
2458
- }
2459
- function At(t) {
2460
- (!t.__d && (t.__d = !0) && ae.push(t) && !Le.__r++ || Ut != C.debounceRendering) && ((Ut = C.debounceRendering) || on)(Le);
2461
- }
2462
- function Le() {
2463
- for (var t, e, n, r, s, o, i, a = 1; ae.length; ) ae.length > a && ae.sort(an), t = ae.shift(), a = ae.length, t.__d && (n = void 0, r = void 0, s = (r = (e = t).__v).__e, o = [], i = [], e.__P && ((n = re({}, r)).__v = r.__v + 1, C.vnode && C.vnode(n), Ft(e.__P, n, r, e.__n, e.__P.namespaceURI, 32 & r.__u ? [s] : null, o, s ?? ge(r), !!(32 & r.__u), i), n.__v = r.__v, n.__.__k[n.__i] = n, fn(o, n, i), r.__e = r.__ = null, n.__e != s && dn(n)));
2464
- Le.__r = 0;
2465
- }
2466
- function pn(t, e, n, r, s, o, i, a, l, u, d) {
2467
- var p, c, h, v, M, A, k, I = r && r.__k || un, Y = e.length;
2468
- for (l = Vi(n, e, I, l, Y), p = 0; p < Y; p++) (h = n.__k[p]) != null && (c = h.__i == -1 ? Te : I[h.__i] || Te, h.__i = p, A = Ft(t, h, c, s, o, i, a, l, u, d), v = h.__e, h.ref && c.ref != h.ref && (c.ref && Tt(c.ref, null, h), d.push(h.ref, h.__c || v, h)), M == null && v != null && (M = v), (k = !!(4 & h.__u)) || c.__k === h.__k ? l = cn(h, l, t, k) : typeof h.type == "function" && A !== void 0 ? l = A : v && (l = v.nextSibling), h.__u &= -7);
2469
- return n.__e = M, l;
2470
- }
2471
- function Vi(t, e, n, r, s) {
2472
- var o, i, a, l, u, d = n.length, p = d, c = 0;
2473
- for (t.__k = new Array(s), o = 0; o < s; o++) (i = e[o]) != null && typeof i != "boolean" && typeof i != "function" ? (typeof i == "string" || typeof i == "number" || typeof i == "bigint" || i.constructor == String ? i = t.__k[o] = Oe(null, i, null, null, null) : Xe(i) ? i = t.__k[o] = Oe(he, { children: i }, null, null, null) : i.constructor === void 0 && i.__b > 0 ? i = t.__k[o] = Oe(i.type, i.props, i.key, i.ref ? i.ref : null, i.__v) : t.__k[o] = i, l = o + c, i.__ = t, i.__b = t.__b + 1, a = null, (u = i.__i = Mi(i, n, l, p)) != -1 && (p--, (a = n[u]) && (a.__u |= 2)), a == null || a.__v == null ? (u == -1 && (s > d ? c-- : s < d && c++), typeof i.type != "function" && (i.__u |= 4)) : u != l && (u == l - 1 ? c-- : u == l + 1 ? c++ : (u > l ? c-- : c++, i.__u |= 4))) : t.__k[o] = null;
2474
- if (p) for (o = 0; o < d; o++) (a = n[o]) != null && !(2 & a.__u) && (a.__e == r && (r = ge(a)), hn(a, a));
2475
- return r;
2476
- }
2477
- function cn(t, e, n, r) {
2478
- var s, o;
2479
- if (typeof t.type == "function") {
2480
- for (s = t.__k, o = 0; s && o < s.length; o++) s[o] && (s[o].__ = t, e = cn(s[o], e, n, r));
2481
- return e;
2482
- }
2483
- t.__e != e && (r && (e && t.type && !e.parentNode && (e = ge(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
2484
- do
2485
- e = e && e.nextSibling;
2486
- while (e != null && e.nodeType == 8);
2487
- return e;
2488
- }
2489
- function Mi(t, e, n, r) {
2490
- var s, o, i, a = t.key, l = t.type, u = e[n], d = u != null && (2 & u.__u) == 0;
2491
- if (u === null && a == null || d && a == u.key && l == u.type) return n;
2492
- if (r > (d ? 1 : 0)) {
2493
- for (s = n - 1, o = n + 1; s >= 0 || o < e.length; ) if ((u = e[i = s >= 0 ? s-- : o++]) != null && !(2 & u.__u) && a == u.key && l == u.type) return i;
2494
- }
2495
- return -1;
2496
- }
2497
- function Dt(t, e, n) {
2498
- e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || Ci.test(e) ? n : n + "px";
2499
- }
2500
- function De(t, e, n, r, s) {
2501
- var o, i;
2502
- e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
2503
- else {
2504
- if (typeof r == "string" && (t.style.cssText = r = ""), r) for (e in r) n && e in n || Dt(t.style, e, "");
2505
- if (n) for (e in n) r && n[e] == r[e] || Dt(t.style, e, n[e]);
2506
- }
2507
- else if (e[0] == "o" && e[1] == "n") o = e != (e = e.replace(ln, "$1")), i = e.toLowerCase(), e = i in t || e == "onFocusOut" || e == "onFocusIn" ? i.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + o] = n, n ? r ? n.u = r.u : (n.u = wt, t.addEventListener(e, o ? rt : nt, o)) : t.removeEventListener(e, o ? rt : nt, o);
2508
- else {
2509
- if (s == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
2510
- else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try {
2511
- t[e] = n ?? "";
2512
- break e;
2513
- } catch {
2514
- }
2515
- typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
2516
- }
2517
- }
2518
- function Nt(t) {
2519
- return function(e) {
2520
- if (this.l) {
2521
- var n = this.l[e.type + t];
2522
- if (e.t == null) e.t = wt++;
2523
- else if (e.t < n.u) return;
2524
- return n(C.event ? C.event(e) : e);
2525
- }
2526
- };
2527
- }
2528
- function Ft(t, e, n, r, s, o, i, a, l, u) {
2529
- var d, p, c, h, v, M, A, k, I, Y, f, _, $, U, P, H, ne, D = e.type;
2530
- if (e.constructor !== void 0) return null;
2531
- 128 & n.__u && (l = !!(32 & n.__u), o = [a = e.__e = n.__e]), (d = C.__b) && d(e);
2532
- e: if (typeof D == "function") try {
2533
- if (k = e.props, I = "prototype" in D && D.prototype.render, Y = (d = D.contextType) && r[d.__c], f = d ? Y ? Y.props.value : d.__ : r, n.__c ? A = (p = e.__c = n.__c).__ = p.__E : (I ? e.__c = p = new D(k, f) : (e.__c = p = new Re(k, f), p.constructor = D, p.render = Ai), Y && Y.sub(p), p.state || (p.state = {}), p.__n = r, c = p.__d = !0, p.__h = [], p._sb = []), I && p.__s == null && (p.__s = p.state), I && D.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = re({}, p.__s)), re(p.__s, D.getDerivedStateFromProps(k, p.__s))), h = p.props, v = p.state, p.__v = e, c) I && D.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), I && p.componentDidMount != null && p.__h.push(p.componentDidMount);
2534
- else {
2535
- if (I && D.getDerivedStateFromProps == null && k !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(k, f), e.__v == n.__v || !p.__e && p.shouldComponentUpdate != null && p.shouldComponentUpdate(k, p.__s, f) === !1) {
2536
- for (e.__v != n.__v && (p.props = k, p.state = p.__s, p.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(X) {
2537
- X && (X.__ = e);
2538
- }), _ = 0; _ < p._sb.length; _++) p.__h.push(p._sb[_]);
2539
- p._sb = [], p.__h.length && i.push(p);
2540
- break e;
2541
- }
2542
- p.componentWillUpdate != null && p.componentWillUpdate(k, p.__s, f), I && p.componentDidUpdate != null && p.__h.push(function() {
2543
- p.componentDidUpdate(h, v, M);
2544
- });
2545
- }
2546
- if (p.context = f, p.props = k, p.__P = t, p.__e = !1, $ = C.__r, U = 0, I) {
2547
- for (p.state = p.__s, p.__d = !1, $ && $(e), d = p.render(p.props, p.state, p.context), P = 0; P < p._sb.length; P++) p.__h.push(p._sb[P]);
2548
- p._sb = [];
2549
- } else do
2550
- p.__d = !1, $ && $(e), d = p.render(p.props, p.state, p.context), p.state = p.__s;
2551
- while (p.__d && ++U < 25);
2552
- p.state = p.__s, p.getChildContext != null && (r = re(re({}, r), p.getChildContext())), I && !c && p.getSnapshotBeforeUpdate != null && (M = p.getSnapshotBeforeUpdate(h, v)), H = d, d != null && d.type === he && d.key == null && (H = mn(d.props.children)), a = pn(t, Xe(H) ? H : [H], e, n, r, s, o, i, a, l, u), p.base = e.__e, e.__u &= -161, p.__h.length && i.push(p), A && (p.__E = p.__ = null);
2553
- } catch (X) {
2554
- if (e.__v = null, l || o != null) if (X.then) {
2555
- for (e.__u |= l ? 160 : 128; a && a.nodeType == 8 && a.nextSibling; ) a = a.nextSibling;
2556
- o[o.indexOf(a)] = null, e.__e = a;
2557
- } else {
2558
- for (ne = o.length; ne--; ) $t(o[ne]);
2559
- st(e);
2560
- }
2561
- else e.__e = n.__e, e.__k = n.__k, X.then || st(e);
2562
- C.__e(X, e, n);
2563
- }
2564
- else o == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : a = e.__e = Ui(n.__e, e, n, r, s, o, i, l, u);
2565
- return (d = C.diffed) && d(e), 128 & e.__u ? void 0 : a;
2566
- }
2567
- function st(t) {
2568
- t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(st);
2569
- }
2570
- function fn(t, e, n) {
2571
- for (var r = 0; r < n.length; r++) Tt(n[r], n[++r], n[++r]);
2572
- C.__c && C.__c(e, t), t.some(function(s) {
2573
- try {
2574
- t = s.__h, s.__h = [], t.some(function(o) {
2575
- o.call(s);
2576
- });
2577
- } catch (o) {
2578
- C.__e(o, s.__v);
2579
- }
2580
- });
2581
- }
2582
- function mn(t) {
2583
- return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : Xe(t) ? t.map(mn) : re({}, t);
2584
- }
2585
- function Ui(t, e, n, r, s, o, i, a, l) {
2586
- var u, d, p, c, h, v, M, A = n.props || Te, k = e.props, I = e.type;
2587
- if (I == "svg" ? s = "http://www.w3.org/2000/svg" : I == "math" ? s = "http://www.w3.org/1998/Math/MathML" : s || (s = "http://www.w3.org/1999/xhtml"), o != null) {
2588
- for (u = 0; u < o.length; u++) if ((h = o[u]) && "setAttribute" in h == !!I && (I ? h.localName == I : h.nodeType == 3)) {
2589
- t = h, o[u] = null;
2590
- break;
2591
- }
2592
- }
2593
- if (t == null) {
2594
- if (I == null) return document.createTextNode(k);
2595
- t = document.createElementNS(s, I, k.is && k), a && (C.__m && C.__m(e, o), a = !1), o = null;
2596
- }
2597
- if (I == null) A === k || a && t.data == k || (t.data = k);
2598
- else {
2599
- if (o = o && Ye.call(t.childNodes), !a && o != null) for (A = {}, u = 0; u < t.attributes.length; u++) A[(h = t.attributes[u]).name] = h.value;
2600
- for (u in A) if (h = A[u], u != "children") {
2601
- if (u == "dangerouslySetInnerHTML") p = h;
2602
- else if (!(u in k)) {
2603
- if (u == "value" && "defaultValue" in k || u == "checked" && "defaultChecked" in k) continue;
2604
- De(t, u, null, h, s);
2605
- }
2606
- }
2607
- for (u in k) h = k[u], u == "children" ? c = h : u == "dangerouslySetInnerHTML" ? d = h : u == "value" ? v = h : u == "checked" ? M = h : a && typeof h != "function" || A[u] === h || De(t, u, h, A[u], s);
2608
- if (d) a || p && (d.__html == p.__html || d.__html == t.innerHTML) || (t.innerHTML = d.__html), e.__k = [];
2609
- else if (p && (t.innerHTML = ""), pn(e.type == "template" ? t.content : t, Xe(c) ? c : [c], e, n, r, I == "foreignObject" ? "http://www.w3.org/1999/xhtml" : s, o, i, o ? o[0] : n.__k && ge(n, 0), a, l), o != null) for (u = o.length; u--; ) $t(o[u]);
2610
- a || (u = "value", I == "progress" && v == null ? t.removeAttribute("value") : v != null && (v !== t[u] || I == "progress" && !v || I == "option" && v != A[u]) && De(t, u, v, A[u], s), u = "checked", M != null && M != t[u] && De(t, u, M, A[u], s));
2611
- }
2612
- return t;
2613
- }
2614
- function Tt(t, e, n) {
2615
- try {
2616
- if (typeof t == "function") {
2617
- var r = typeof t.__u == "function";
2618
- r && t.__u(), r && e == null || (t.__u = t(e));
2619
- } else t.current = e;
2620
- } catch (s) {
2621
- C.__e(s, n);
2622
- }
2623
- }
2624
- function hn(t, e, n) {
2625
- var r, s;
2626
- if (C.unmount && C.unmount(t), (r = t.ref) && (r.current && r.current != t.__e || Tt(r, null, e)), (r = t.__c) != null) {
2627
- if (r.componentWillUnmount) try {
2628
- r.componentWillUnmount();
2629
- } catch (o) {
2630
- C.__e(o, e);
2631
- }
2632
- r.base = r.__P = null;
2633
- }
2634
- if (r = t.__k) for (s = 0; s < r.length; s++) r[s] && hn(r[s], e, n || typeof t.type != "function");
2635
- n || $t(t.__e), t.__c = t.__ = t.__e = void 0;
2636
- }
2637
- function Ai(t, e, n) {
2638
- return this.constructor(t, n);
2639
- }
2640
- function gn(t, e, n) {
2641
- var r, s, o, i;
2642
- e == document && (e = document.documentElement), C.__ && C.__(t, e), s = (r = !1) ? null : e.__k, o = [], i = [], Ft(e, t = e.__k = St(he, null, [t]), s || Te, Te, e.namespaceURI, s ? null : e.firstChild ? Ye.call(e.childNodes) : null, o, s ? s.__e : e.firstChild, r, i), fn(o, t, i);
2643
- }
2644
- Ye = un.slice, C = { __e: function(t, e, n, r) {
2645
- for (var s, o, i; e = e.__; ) if ((s = e.__c) && !s.__) try {
2646
- if ((o = s.constructor) && o.getDerivedStateFromError != null && (s.setState(o.getDerivedStateFromError(t)), i = s.__d), s.componentDidCatch != null && (s.componentDidCatch(t, r || {}), i = s.__d), i) return s.__E = s;
2647
- } catch (a) {
2648
- t = a;
2649
- }
2650
- throw t;
2651
- } }, sn = 0, Re.prototype.setState = function(t, e) {
2652
- var n;
2653
- n = this.__s != null && this.__s != this.state ? this.__s : this.__s = re({}, this.state), typeof t == "function" && (t = t(re({}, n), this.props)), t && re(n, t), t != null && this.__v && (e && this._sb.push(e), At(this));
2654
- }, Re.prototype.forceUpdate = function(t) {
2655
- this.__v && (this.__e = !0, t && this.__h.push(t), At(this));
2656
- }, Re.prototype.render = he, ae = [], on = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, an = function(t, e) {
2657
- return t.__v.__b - e.__v.__b;
2658
- }, Le.__r = 0, ln = /(PointerCapture)$|Capture$/i, wt = 0, nt = Nt(!1), rt = Nt(!0);
2659
- var Di = 0;
2660
- function S(t, e, n, r, s, o) {
2661
- e || (e = {});
2662
- var i, a, l = e;
2663
- if ("ref" in l) for (a in l = {}, e) a == "ref" ? i = e[a] : l[a] = e[a];
2664
- var u = { type: t, props: l, key: n, ref: i, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Di, __i: -1, __u: 0, __source: s, __self: o };
2665
- if (typeof t == "function" && (i = t.defaultProps)) for (a in i) l[a] === void 0 && (l[a] = i[a]);
2666
- return C.vnode && C.vnode(u), u;
2667
- }
2668
- function yn(t) {
2669
- var e, n, r = "";
2670
- if (typeof t == "string" || typeof t == "number") r += t;
2671
- else if (typeof t == "object") if (Array.isArray(t)) {
2672
- var s = t.length;
2673
- for (e = 0; e < s; e++) t[e] && (n = yn(t[e])) && (r && (r += " "), r += n);
2674
- } else for (n in t) t[n] && (r && (r += " "), r += n);
2675
- return r;
2676
- }
2677
- function vn() {
2678
- for (var t, e, n = 0, r = "", s = arguments.length; n < s; n++) (t = arguments[n]) && (e = yn(t)) && (r && (r += " "), r += e);
2679
- return r;
2680
- }
2681
- var ke, N, Qe, Pt, it = 0, _n = [], z = C, zt = z.__b, Ot = z.__r, Rt = z.diffed, Bt = z.__c, jt = z.unmount, Lt = z.__;
2682
- function kt(t, e) {
2683
- z.__h && z.__h(N, t, it || e), it = 0;
2684
- var n = N.__H || (N.__H = { __: [], __h: [] });
2685
- return t >= n.__.length && n.__.push({}), n.__[t];
2686
- }
2687
- function Ni(t) {
2688
- return it = 1, Pi(Sn, t);
2689
- }
2690
- function Pi(t, e, n) {
2691
- var r = kt(ke++, 2);
2692
- if (r.t = t, !r.__c && (r.__ = [Sn(void 0, e), function(a) {
2693
- var l = r.__N ? r.__N[0] : r.__[0], u = r.t(l, a);
2694
- l !== u && (r.__N = [u, r.__[1]], r.__c.setState({}));
2695
- }], r.__c = N, !N.__f)) {
2696
- var s = function(a, l, u) {
2697
- if (!r.__c.__H) return !0;
2698
- var d = r.__c.__H.__.filter(function(c) {
2699
- return !!c.__c;
2700
- });
2701
- if (d.every(function(c) {
2702
- return !c.__N;
2703
- })) return !o || o.call(this, a, l, u);
2704
- var p = r.__c.props !== a;
2705
- return d.forEach(function(c) {
2706
- if (c.__N) {
2707
- var h = c.__[0];
2708
- c.__ = c.__N, c.__N = void 0, h !== c.__[0] && (p = !0);
2709
- }
2710
- }), o && o.call(this, a, l, u) || p;
2711
- };
2712
- N.__f = !0;
2713
- var o = N.shouldComponentUpdate, i = N.componentWillUpdate;
2714
- N.componentWillUpdate = function(a, l, u) {
2715
- if (this.__e) {
2716
- var d = o;
2717
- o = void 0, s(a, l, u), o = d;
2718
- }
2719
- i && i.call(this, a, l, u);
2720
- }, N.shouldComponentUpdate = s;
2721
- }
2722
- return r.__N || r.__;
2723
- }
2724
- function bn(t, e) {
2725
- var n = kt(ke++, 3);
2726
- !z.__s && $n(n.__H, e) && (n.__ = t, n.u = e, N.__H.__h.push(n));
2727
- }
2728
- function wn(t, e) {
2729
- var n = kt(ke++, 7);
2730
- return $n(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
2731
- }
2732
- function zi() {
2733
- for (var t; t = _n.shift(); ) if (t.__P && t.__H) try {
2734
- t.__H.__h.forEach(Be), t.__H.__h.forEach(ot), t.__H.__h = [];
2735
- } catch (e) {
2736
- t.__H.__h = [], z.__e(e, t.__v);
2737
- }
2738
- }
2739
- z.__b = function(t) {
2740
- N = null, zt && zt(t);
2741
- }, z.__ = function(t, e) {
2742
- t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Lt && Lt(t, e);
2743
- }, z.__r = function(t) {
2744
- Ot && Ot(t), ke = 0;
2745
- var e = (N = t.__c).__H;
2746
- e && (Qe === N ? (e.__h = [], N.__h = [], e.__.forEach(function(n) {
2747
- n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
2748
- })) : (e.__h.forEach(Be), e.__h.forEach(ot), e.__h = [], ke = 0)), Qe = N;
2749
- }, z.diffed = function(t) {
2750
- Rt && Rt(t);
2751
- var e = t.__c;
2752
- e && e.__H && (e.__H.__h.length && (_n.push(e) !== 1 && Pt === z.requestAnimationFrame || ((Pt = z.requestAnimationFrame) || Oi)(zi)), e.__H.__.forEach(function(n) {
2753
- n.u && (n.__H = n.u), n.u = void 0;
2754
- })), Qe = N = null;
2755
- }, z.__c = function(t, e) {
2756
- e.some(function(n) {
2757
- try {
2758
- n.__h.forEach(Be), n.__h = n.__h.filter(function(r) {
2759
- return !r.__ || ot(r);
2760
- });
2761
- } catch (r) {
2762
- e.some(function(s) {
2763
- s.__h && (s.__h = []);
2764
- }), e = [], z.__e(r, n.__v);
2765
- }
2766
- }), Bt && Bt(t, e);
2767
- }, z.unmount = function(t) {
2768
- jt && jt(t);
2769
- var e, n = t.__c;
2770
- n && n.__H && (n.__H.__.forEach(function(r) {
2771
- try {
2772
- Be(r);
2773
- } catch (s) {
2774
- e = s;
2775
- }
2776
- }), n.__H = void 0, e && z.__e(e, n.__v));
2777
- };
2778
- var qt = typeof requestAnimationFrame == "function";
2779
- function Oi(t) {
2780
- var e, n = function() {
2781
- clearTimeout(r), qt && cancelAnimationFrame(e), setTimeout(t);
2782
- }, r = setTimeout(n, 35);
2783
- qt && (e = requestAnimationFrame(n));
2784
- }
2785
- function Be(t) {
2786
- var e = N, n = t.__c;
2787
- typeof n == "function" && (t.__c = void 0, n()), N = e;
2788
- }
2789
- function ot(t) {
2790
- var e = N;
2791
- t.__c = t.__(), N = e;
2792
- }
2793
- function $n(t, e) {
2794
- return !t || t.length !== e.length || e.some(function(n, r) {
2795
- return n !== t[r];
2796
- });
2797
- }
2798
- function Sn(t, e) {
2799
- return typeof e == "function" ? e(t) : e;
2800
- }
2801
- function Ri(t, e = {}) {
2802
- const n = `uppy-dropzone-file-input-${t.uppy.getID()}`, r = (d) => {
2803
- var c, h;
2804
- d.preventDefault(), d.stopPropagation();
2805
- const p = Array.from(((c = d.dataTransfer) == null ? void 0 : c.files) ?? []);
2806
- p.length && ((h = e.onDrop) == null || h.call(e, p), t.uppy.addFiles(p.map((v) => ({
2807
- name: v.name,
2808
- type: v.type,
2809
- data: v
2810
- }))));
2811
- }, s = (d) => {
2812
- var p;
2813
- d.preventDefault(), d.stopPropagation(), (p = e.onDragOver) == null || p.call(e, d);
2814
- }, o = (d) => {
2815
- var p;
2816
- d.preventDefault(), d.stopPropagation(), (p = e.onDragEnter) == null || p.call(e, d);
2817
- }, i = (d) => {
2818
- var p;
2819
- d.preventDefault(), d.stopPropagation(), (p = e.onDragLeave) == null || p.call(e, d);
2820
- }, a = () => {
2821
- if (e.noClick)
2822
- return;
2823
- const d = document.getElementById(n);
2824
- d == null || d.click();
2825
- }, l = (d) => {
2826
- (d.key === " " || d.key === "Enter" || d.keyCode === 32 || d.keyCode === 13) && a();
2827
- }, u = (d) => {
2828
- var h;
2829
- const p = d.target, c = Array.from(p.files ?? []);
2830
- c.length && ((h = e.onFileInputChange) == null || h.call(e, c), t.uppy.addFiles(c.map((v) => ({
2831
- source: "drag-drop",
2832
- name: v.name,
2833
- type: v.type,
2834
- data: v
2835
- }))), p.value = "");
2836
- };
2837
- return {
2838
- getRootProps: () => ({
2839
- onDragEnter: o,
2840
- onDragOver: s,
2841
- onDragLeave: i,
2842
- onDrop: r,
2843
- onClick: a,
2844
- onKeyPress: l
2845
- }),
2846
- getInputProps: () => {
2847
- var c;
2848
- const { restrictions: d } = t.uppy.opts, p = (c = d.allowedFileTypes) == null ? void 0 : c.join(", ");
2849
- return {
2850
- id: n,
2851
- type: "file",
2852
- multiple: d.maxNumberOfFiles !== 1,
2853
- accept: p,
2854
- onChange: u
2855
- };
2856
- }
2857
- };
2858
- }
2859
- function Bi(t) {
2860
- const { width: e, height: n, note: r, noClick: s, ctx: o } = t;
2861
- if (!o.uppy)
2862
- throw new Error("Dropzone must be used within a UppyContextProvider");
2863
- const { getRootProps: i, getInputProps: a } = wn(() => Ri(o, { noClick: s }), [o, s]);
2864
- return S("div", { className: "uppy-reset", "data-uppy-element": "dropzone", role: "presentation", children: [S("input", { ...a(), tabIndex: -1, name: "uppy-dropzone-file-input", className: "uppy:hidden" }), S("div", {
2865
- ...i(),
2866
- // biome-ignore lint/a11y/noNoninteractiveTabindex: it is also a button. getRootProps returns keyboard event handlers
2867
- tabIndex: 0,
2868
- style: {
2869
- width: e || "100%",
2870
- height: n || "100%"
2871
- },
2872
- className: vn("uppy:border-2 uppy:border-dashed uppy:border-gray-300", "uppy:rounded-lg uppy:p-6 uppy:bg-gray-50", "uppy:transition-colors uppy:duration-200", {
2873
- "uppy:cursor-pointer uppy:hover:bg-blue-50": !s
2874
- }),
2875
- children: [S("div", { className: "uppy:flex uppy:flex-col uppy:items-center uppy:justify-center uppy:h-full uppy:space-y-3", children: S("p", { className: "uppy:text-gray-600", children: "Drop files here or click to add them" }) }), r ? S("div", { className: "uppy:text-sm uppy:text-gray-500", children: r }) : null]
2876
- })] });
2877
- }
2878
- const ji = [
2879
- "B",
2880
- "kB",
2881
- "MB",
2882
- "GB",
2883
- "TB",
2884
- "PB",
2885
- "EB",
2886
- "ZB",
2887
- "YB"
2888
- ], Li = [
2889
- "B",
2890
- "KiB",
2891
- "MiB",
2892
- "GiB",
2893
- "TiB",
2894
- "PiB",
2895
- "EiB",
2896
- "ZiB",
2897
- "YiB"
2898
- ], qi = [
2899
- "b",
2900
- "kbit",
2901
- "Mbit",
2902
- "Gbit",
2903
- "Tbit",
2904
- "Pbit",
2905
- "Ebit",
2906
- "Zbit",
2907
- "Ybit"
2908
- ], xi = [
2909
- "b",
2910
- "kibit",
2911
- "Mibit",
2912
- "Gibit",
2913
- "Tibit",
2914
- "Pibit",
2915
- "Eibit",
2916
- "Zibit",
2917
- "Yibit"
2918
- ], xt = (t, e, n) => {
2919
- let r = t;
2920
- return typeof e == "string" || Array.isArray(e) ? r = t.toLocaleString(e, n) : (e === !0 || n !== void 0) && (r = t.toLocaleString(void 0, n)), r;
2921
- };
2922
- function Hi(t, e) {
2923
- if (!Number.isFinite(t))
2924
- throw new TypeError(`Expected a finite number, got ${typeof t}: ${t}`);
2925
- e = {
2926
- bits: !1,
2927
- binary: !1,
2928
- space: !0,
2929
- ...e
2930
- };
2931
- const n = e.bits ? e.binary ? xi : qi : e.binary ? Li : ji, r = e.space ? " " : "";
2932
- if (e.signed && t === 0)
2933
- return ` 0${r}${n[0]}`;
2934
- const s = t < 0, o = s ? "-" : e.signed ? "+" : "";
2935
- s && (t = -t);
2936
- let i;
2937
- if (e.minimumFractionDigits !== void 0 && (i = { minimumFractionDigits: e.minimumFractionDigits }), e.maximumFractionDigits !== void 0 && (i = { maximumFractionDigits: e.maximumFractionDigits, ...i }), t < 1) {
2938
- const d = xt(t, e.locale, i);
2939
- return o + d + r + n[0];
2940
- }
2941
- const a = Math.min(Math.floor(e.binary ? Math.log(t) / Math.log(1024) : Math.log10(t) / 3), n.length - 1);
2942
- t /= (e.binary ? 1024 : 1e3) ** a, i || (t = t.toPrecision(3));
2943
- const l = xt(Number(t), e.locale, i), u = n[a];
2944
- return o + l + r + u;
2945
- }
2946
- function Gi(t) {
2947
- const [e, n] = Ni(() => []), { ctx: r, editFile: s, imageThumbnail: o } = t;
2948
- return bn(() => {
2949
- var a;
2950
- const i = (l, u, d) => {
2951
- d != null && d.files && n(Object.values(d.files));
2952
- };
2953
- return (a = r.uppy) == null || a.on("state-update", i), () => {
2954
- var l;
2955
- (l = r.uppy) == null || l.off("state-update", i);
2956
- };
2957
- }, [r.uppy]), S("ul", { "data-uppy-element": "files-list", className: "uppy-reset uppy:my-4", children: e == null ? void 0 : e.map((i) => {
2958
- var a, l, u;
2959
- return S("li", { children: S(he, { children: [S("div", { className: "uppy:flex uppy:items-center uppy:gap-2", children: [S("div", { className: "uppy:w-[32px] uppy:h-[32px]", children: S(Wi, { width: "32px", height: "32px", file: i, images: o }) }), S("p", { className: "uppy:truncate", children: i.name }), S("p", { className: "uppy:text-gray-500 uppy:tabular-nums uppy:min-w-18 uppy:text-right uppy:ml-auto", children: Hi(i.size || 0) }), S(he, { children: [s && S("button", { type: "button", className: "uppy:flex uppy:rounded uppy:text-blue-500 uppy:hover:text-blue-700 uppy:bg-transparent uppy:transition-colors", onClick: () => {
2960
- s(i);
2961
- }, children: "edit" }), S("button", { type: "button", className: "uppy:flex uppy:rounded uppy:text-blue-500 uppy:hover:text-blue-700 uppy:bg-transparent uppy:transition-colors", onClick: () => {
2962
- var d;
2963
- (d = r.uppy) == null || d.removeFile(i.id);
2964
- }, children: "remove" })] })] }), S("progress", { max: "100", className: vn("uppy:w-full uppy:h-[2px] uppy:appearance-none uppy:bg-gray-100 uppy:rounded-full uppy:overflow-hidden uppy:[&::-webkit-progress-bar]:bg-gray-100 uppy:block uppy:my-2", {
2965
- "uppy:[&::-webkit-progress-value]:bg-green-500 uppy:[&::-moz-progress-bar]:bg-green-500": (a = i.progress) == null ? void 0 : a.uploadComplete,
2966
- "uppy:[&::-webkit-progress-value]:bg-red-500 uppy:[&::-moz-progress-bar]:bg-red-500": i.error,
2967
- "uppy:[&::-webkit-progress-value]:bg-blue-500 uppy:[&::-moz-progress-bar]:bg-blue-500": !((l = i.progress) != null && l.uploadComplete) && !i.error
2968
- }), value: ((u = i.progress) == null ? void 0 : u.percentage) || 0 })] }) }, i.id);
2969
- }) });
2970
- }
2971
- function Wi(t) {
2972
- var d, p;
2973
- const e = t.width || "100%", n = t.height || "100%", r = ((d = t.file.type) == null ? void 0 : d.split("/")[0]) || "", s = ((p = t.file.type) == null ? void 0 : p.split("/")[1]) || "", o = t.file.type.startsWith("image/"), i = r === "application" && [
2974
- "zip",
2975
- "x-7z-compressed",
2976
- "x-zip-compressed",
2977
- "x-rar-compressed",
2978
- "x-tar",
2979
- "x-gzip",
2980
- "x-apple-diskimage"
2981
- ].includes(s), a = r === "application" && s === "pdf", l = wn(() => {
2982
- if (!t.images)
2983
- return "";
2984
- if (t.file.isRemote)
2985
- return t.file.preview;
2986
- if (t.file.data == null)
2987
- throw new Error("File data is empty");
2988
- return URL.createObjectURL(t.file.data);
2989
- }, [t.file.data, t.images, t.file.isRemote, t.file.preview]), u = t.images && o && l;
2990
- return bn(() => () => {
2991
- l && URL.revokeObjectURL(l);
2992
- }, [l]), S("div", { "data-uppy-element": "thumbnail", className: "uppy:relative uppy:overflow-hidden uppy:bg-gray-100 uppy:rounded-lg uppy:flex uppy:items-center uppy:justify-center", style: {
2993
- width: e,
2994
- height: n,
2995
- aspectRatio: "1"
2996
- }, children: [u ? S("img", { className: "uppy:w-full uppy:h-full uppy:object-cover", src: l, alt: t.file.name }) : null, u ? null : S("div", { className: "uppy:flex uppy:flex-col uppy:items-center uppy:justify-center uppy:w-full uppy:h-full", children: S("div", { className: "uppy:flex-1 uppy:flex uppy:items-center uppy:justify-center uppy:w-full", children: [t.file.type ? null : S("svg", { "aria-hidden": "true", className: "uppy:w-3/4 uppy:h-3/4", viewBox: "0 0 25 25", children: S("g", { fill: "#A7AFB7", "fill-rule": "nonzero", children: [S("path", { d: "M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z" }), S("path", { d: "M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z" })] }) }), r === "text" ? S("svg", { "aria-hidden": "true", className: "uppy:w-3/4 uppy:h-3/4", viewBox: "0 0 25 25", children: S("path", { d: "M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z", fill: "#5A5E69", "fill-rule": "nonzero" }) }) : null, r === "image" && !u ? S("svg", { "aria-hidden": "true", className: "uppy:w-3/4 uppy:h-3/4", viewBox: "0 0 25 25", children: S("g", { fill: "#686DE0", "fill-rule": "evenodd", children: [S("path", { d: "M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z", "fill-rule": "nonzero" }), S("path", { d: "M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z", "fill-rule": "nonzero" }), S("circle", { cx: "7.5", cy: "9.5", r: "1.5" })] }) }) : null, r === "audio" ? S("svg", { "aria-hidden": "true", className: "uppy:w-3/4 uppy:h-3/4", viewBox: "0 0 25 25", children: S("path", { d: "M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z", fill: "#049BCF", "fill-rule": "nonzero" }) }) : null, r === "video" ? S("svg", { "aria-hidden": "true", className: "uppy:w-3/4 uppy:h-3/4", viewBox: "0 0 25 25", children: S("path", { d: "M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z", fill: "#19AF67", "fill-rule": "nonzero" }) }) : null, a ? S("svg", { "aria-hidden": "true", className: "uppy:w-3/4 uppy:h-3/4", viewBox: "0 0 25 25", children: S("path", { d: "M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z", fill: "#E2514A", "fill-rule": "nonzero" }) }) : null, i ? S("svg", { "aria-hidden": "true", className: "uppy:w-3/4 uppy:h-3/4", viewBox: "0 0 25 25", children: S("path", { d: "M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z", fill: "#00C469", "fill-rule": "nonzero" }) }) : null, t.file.type && !r && !a && !i ? S("svg", { "aria-hidden": "true", className: "uppy:w-3/4 uppy:h-3/4", viewBox: "0 0 25 25", children: S("g", { fill: "#A7AFB7", "fill-rule": "nonzero", children: [S("path", { d: "M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z" }), S("path", { d: "M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z" })] }) }) : null] }) })] });
2997
- }
2998
- function Yi({ uppy: t, onStatusChange: e, onProgressChange: n }) {
2999
- const r = () => {
3000
- e("ready");
3001
- }, s = () => {
3002
- t.getFiles().length === 0 && e("init");
3003
- }, o = () => {
3004
- e("uploading");
3005
- }, i = () => {
3006
- e("uploading");
3007
- }, a = (c) => {
3008
- var h, v;
3009
- ((h = c == null ? void 0 : c.failed) != null && h.length || (v = c == null ? void 0 : c.successful) != null && v.length) && (e("complete"), n(0));
3010
- }, l = () => {
3011
- e("error"), n(0);
3012
- }, u = () => {
3013
- e("init"), n(0);
3014
- }, d = () => {
3015
- e("paused");
3016
- }, p = (c) => {
3017
- n(c);
3018
- };
3019
- return t.on("file-added", r), t.on("file-removed", s), t.on("progress", p), t.on("upload", o), t.on("complete", a), t.on("error", l), t.on("cancel-all", u), t.on("pause-all", d), t.on("resume-all", i), {
3020
- cleanup: () => {
3021
- t.off("file-added", r), t.off("progress", p), t.off("upload", o), t.off("complete", a), t.off("error", l), t.off("cancel-all", u), t.off("pause-all", d), t.off("resume-all", i);
3022
- }
3023
- };
3024
- }
3025
- const Fn = Symbol("uppy"), Xi = E({
3026
- name: "UppyContextProvider",
3027
- props: {
3028
- uppy: {
3029
- type: Object,
3030
- required: !0
3031
- }
3032
- },
3033
- setup(t, { slots: e }) {
3034
- const n = G("init"), r = G(0), s = tn({
3035
- uppy: Gn(t.uppy),
3036
- status: "init",
3037
- progress: 0
3038
- });
3039
- Wn(Fn, s);
3040
- let o;
3041
- return ye(() => {
3042
- if (!t.uppy)
3043
- throw new Error("UppyContextProvider: passing `uppy` as a prop is required");
3044
- o = Yi({
3045
- uppy: t.uppy,
3046
- onStatusChange: (i) => {
3047
- n.value = i, s.status = i;
3048
- },
3049
- onProgressChange: (i) => {
3050
- r.value = i, s.progress = i;
3051
- }
3052
- });
3053
- }), gt(() => {
3054
- o == null || o.cleanup();
3055
- }), () => {
3056
- var i;
3057
- return (i = e.default) == null ? void 0 : i.call(e);
3058
- };
3059
- }
3060
- });
3061
- function Tn() {
3062
- const t = T(Fn);
3063
- return t || {
3064
- uppy: void 0,
3065
- status: "init",
3066
- progress: 0
3067
- };
3068
- }
3069
- const Zi = E({
3070
- name: "Dropzone",
3071
- props: ["width", "height", "note", "noClick"],
3072
- setup(t) {
3073
- const e = G(null), n = Tn();
3074
- function r() {
3075
- e.value && gn(St(Bi, {
3076
- ...t,
3077
- ctx: n
3078
- }), e.value);
3079
- }
3080
- return ye(() => {
3081
- r();
3082
- }), Fe(n, () => {
3083
- r();
3084
- }), Fe(() => t, () => {
3085
- r();
3086
- }, { deep: !0 }), () => rn("div", { ref: e });
3087
- }
3088
- }), Ki = E({
3089
- name: "FilesList",
3090
- props: ["editFile", "imageThumbnail"],
3091
- setup(t) {
3092
- const e = G(null), n = Tn();
3093
- function r() {
3094
- e.value && gn(St(Gi, {
3095
- ...t,
3096
- ctx: n
3097
- }), e.value);
3098
- }
3099
- return ye(() => {
3100
- r();
3101
- }), Fe(n, () => {
3102
- r();
3103
- }), Fe(() => t, () => {
3104
- r();
3105
- }, { deep: !0 }), () => rn("div", { ref: e });
3106
- }
3107
- });
3108
- function kn(t) {
3109
- const e = t.lastIndexOf(".");
3110
- return e === -1 || e === t.length - 1 ? {
3111
- name: t,
3112
- extension: void 0
3113
- } : {
3114
- name: t.slice(0, e),
3115
- extension: t.slice(e + 1)
3116
- };
3117
- }
3118
- const Ht = {
3119
- __proto__: null,
3120
- md: "text/markdown",
3121
- markdown: "text/markdown",
3122
- mp4: "video/mp4",
3123
- mp3: "audio/mp3",
3124
- svg: "image/svg+xml",
3125
- jpg: "image/jpeg",
3126
- png: "image/png",
3127
- webp: "image/webp",
3128
- gif: "image/gif",
3129
- heic: "image/heic",
3130
- heif: "image/heif",
3131
- yaml: "text/yaml",
3132
- yml: "text/yaml",
3133
- csv: "text/csv",
3134
- tsv: "text/tab-separated-values",
3135
- tab: "text/tab-separated-values",
3136
- avi: "video/x-msvideo",
3137
- mks: "video/x-matroska",
3138
- mkv: "video/x-matroska",
3139
- mov: "video/quicktime",
3140
- dicom: "application/dicom",
3141
- doc: "application/msword",
3142
- msg: "application/vnd.ms-outlook",
3143
- docm: "application/vnd.ms-word.document.macroenabled.12",
3144
- docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
3145
- dot: "application/msword",
3146
- dotm: "application/vnd.ms-word.template.macroenabled.12",
3147
- dotx: "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
3148
- xla: "application/vnd.ms-excel",
3149
- xlam: "application/vnd.ms-excel.addin.macroenabled.12",
3150
- xlc: "application/vnd.ms-excel",
3151
- xlf: "application/x-xliff+xml",
3152
- xlm: "application/vnd.ms-excel",
3153
- xls: "application/vnd.ms-excel",
3154
- xlsb: "application/vnd.ms-excel.sheet.binary.macroenabled.12",
3155
- xlsm: "application/vnd.ms-excel.sheet.macroenabled.12",
3156
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
3157
- xlt: "application/vnd.ms-excel",
3158
- xltm: "application/vnd.ms-excel.template.macroenabled.12",
3159
- xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
3160
- xlw: "application/vnd.ms-excel",
3161
- txt: "text/plain",
3162
- text: "text/plain",
3163
- conf: "text/plain",
3164
- log: "text/plain",
3165
- pdf: "application/pdf",
3166
- zip: "application/zip",
3167
- "7z": "application/x-7z-compressed",
3168
- rar: "application/x-rar-compressed",
3169
- tar: "application/x-tar",
3170
- gz: "application/gzip",
3171
- dmg: "application/x-apple-diskimage"
3172
- };
3173
- function In(t) {
3174
- var n;
3175
- if (t.type)
3176
- return t.type;
3177
- const e = t.name ? (n = kn(t.name).extension) == null ? void 0 : n.toLowerCase() : null;
3178
- return e && e in Ht ? Ht[e] : "application/octet-stream";
3179
- }
3180
- function Ji(t) {
3181
- return t.charCodeAt(0).toString(32);
3182
- }
3183
- function Gt(t) {
3184
- let e = "";
3185
- return t.replace(/[^A-Z0-9]/gi, (n) => (e += `-${Ji(n)}`, "/")) + e;
3186
- }
3187
- function Qi(t, e) {
3188
- var r;
3189
- let n = e || "uppy";
3190
- return typeof t.name == "string" && (n += `-${Gt(t.name.toLowerCase())}`), t.type !== void 0 && (n += `-${t.type}`), t.meta && typeof t.meta.relativePath == "string" && (n += `-${Gt(t.meta.relativePath.toLowerCase())}`), ((r = t.data) == null ? void 0 : r.size) !== void 0 && (n += `-${t.data.size}`), t.data.lastModified !== void 0 && (n += `-${t.data.lastModified}`), n;
3191
- }
3192
- function eo(t) {
3193
- return !t.isRemote || !t.remote ? !1 : (/* @__PURE__ */ new Set([
3194
- "box",
3195
- "dropbox",
3196
- "drive",
3197
- "facebook",
3198
- "unsplash"
3199
- ])).has(t.remote.provider);
3200
- }
3201
- function to(t, e) {
3202
- if (eo(t))
3203
- return t.id;
3204
- const n = In(t);
3205
- return Qi({
3206
- ...t,
3207
- type: n
3208
- }, e);
3209
- }
3210
- function et(t) {
3211
- return t < 10 ? `0${t}` : t.toString();
3212
- }
3213
- function je() {
3214
- const t = /* @__PURE__ */ new Date(), e = et(t.getHours()), n = et(t.getMinutes()), r = et(t.getSeconds());
3215
- return `${e}:${n}:${r}`;
3216
- }
3217
- function no(t, e, n) {
3218
- const r = [];
3219
- return t.forEach((s) => typeof s != "string" ? r.push(s) : e[Symbol.split](s).forEach((o, i, a) => {
3220
- o !== "" && r.push(o), i < a.length - 1 && r.push(n);
3221
- })), r;
3222
- }
3223
- /**
3224
- * Takes a string with placeholder variables like `%{smart_count} file selected`
3225
- * and replaces it with values from options `{smart_count: 5}`
3226
- *
3227
- * @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
3228
- * taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
3229
- *
3230
- * @param phrase that needs interpolation, with placeholders
3231
- * @param options with values that will be used to replace placeholders
3232
- */
3233
- function Wt(t, e) {
3234
- const n = /\$/g, r = "$$$$";
3235
- let s = [t];
3236
- if (e == null)
3237
- return s;
3238
- for (const o of Object.keys(e))
3239
- if (o !== "_") {
3240
- let i = e[o];
3241
- typeof i == "string" && (i = n[Symbol.replace](i, r)), s = no(s, new RegExp(`%\\{${o}\\}`, "g"), i);
3242
- }
3243
- return s;
3244
- }
3245
- const ro = (t) => {
3246
- throw new Error(`missing string: ${t}`);
3247
- };
3248
- var Ie, Ee, at;
3249
- class so {
3250
- constructor(e, { onMissingKey: n = ro } = {}) {
3251
- x(this, Ee);
3252
- B(this, "locale");
3253
- x(this, Ie);
3254
- this.locale = {
3255
- strings: {},
3256
- pluralize(r) {
3257
- return r === 1 ? 0 : 1;
3258
- }
3259
- }, Array.isArray(e) ? e.forEach(F(this, Ee, at), this) : F(this, Ee, at).call(this, e), Ue(this, Ie, n);
3260
- }
3261
- /**
3262
- * Public translate method
3263
- *
3264
- * @param key
3265
- * @param options with values that will be used later to replace placeholders in string
3266
- * @returns string translated (and interpolated)
3267
- */
3268
- translate(e, n) {
3269
- return this.translateArray(e, n).join("");
3270
- }
3271
- /**
3272
- * Get a translation and return the translated and interpolated parts as an array.
3273
- *
3274
- * @returns The translated and interpolated parts, in order.
3275
- */
3276
- translateArray(e, n) {
3277
- let r = this.locale.strings[e];
3278
- if (r == null && (w(this, Ie).call(this, e), r = e), typeof r == "object") {
3279
- if (n && typeof n.smart_count < "u") {
3280
- const o = this.locale.pluralize(n.smart_count);
3281
- return Wt(r[o], n);
3282
- }
3283
- throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}");
3284
- }
3285
- if (typeof r != "string")
3286
- throw new Error("string was not a string");
3287
- return Wt(r, n);
3288
- }
3289
- }
3290
- Ie = new WeakMap(), Ee = new WeakSet(), at = function(e) {
3291
- if (!(e != null && e.strings))
3292
- return;
3293
- const n = this.locale;
3294
- Object.assign(this.locale, {
3295
- strings: { ...n.strings, ...e.strings },
3296
- pluralize: e.pluralize || n.pluralize
3297
- });
3298
- };
3299
- const io = {
3300
- debug: () => {
3301
- },
3302
- warn: () => {
3303
- },
3304
- error: (...t) => console.error(`[Uppy] [${je()}]`, ...t)
3305
- }, oo = {
3306
- debug: (...t) => console.debug(`[Uppy] [${je()}]`, ...t),
3307
- warn: (...t) => console.warn(`[Uppy] [${je()}]`, ...t),
3308
- error: (...t) => console.error(`[Uppy] [${je()}]`, ...t)
3309
- };
3310
- var Ne = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
3311
- function Ze(t) {
3312
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
3313
- }
3314
- var ao = function(e) {
3315
- if (typeof e != "number" || Number.isNaN(e))
3316
- throw new TypeError(`Expected a number, got ${typeof e}`);
3317
- const n = e < 0;
3318
- let r = Math.abs(e);
3319
- if (n && (r = -r), r === 0)
3320
- return "0 B";
3321
- const s = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], o = Math.min(Math.floor(Math.log(r) / Math.log(1024)), s.length - 1), i = Number(r / 1024 ** o), a = s[o];
3322
- return `${i >= 10 || i % 1 === 0 ? Math.round(i) : i.toFixed(1)} ${a}`;
3323
- };
3324
- const Pe = /* @__PURE__ */ Ze(ao);
3325
- function En(t, e) {
3326
- this.text = t = t || "", this.hasWild = ~t.indexOf("*"), this.separator = e, this.parts = t.split(e);
3327
- }
3328
- En.prototype.match = function(t) {
3329
- var e = !0, n = this.parts, r, s = n.length, o;
3330
- if (typeof t == "string" || t instanceof String)
3331
- if (!this.hasWild && this.text != t)
3332
- e = !1;
3333
- else {
3334
- for (o = (t || "").split(this.separator), r = 0; e && r < s; r++)
3335
- n[r] !== "*" && (r < o.length ? e = n[r] === o[r] : e = !1);
3336
- e = e && o;
3337
- }
3338
- else if (typeof t.splice == "function")
3339
- for (e = [], r = t.length; r--; )
3340
- this.match(t[r]) && (e[e.length] = t[r]);
3341
- else if (typeof t == "object") {
3342
- e = {};
3343
- for (var i in t)
3344
- this.match(i) && (e[i] = t[i]);
3345
- }
3346
- return e;
3347
- };
3348
- var lo = function(t, e, n) {
3349
- var r = new En(t, n || /[\/\.]/);
3350
- return typeof e < "u" ? r.match(e) : r;
3351
- }, uo = lo, po = /[\/\+\.]/, co = function(t, e) {
3352
- function n(r) {
3353
- var s = uo(r, t, po);
3354
- return s && s.length >= 2;
3355
- }
3356
- return e ? n(e.split(";")[0]) : n;
3357
- };
3358
- const fo = /* @__PURE__ */ Ze(co), mo = {
3359
- maxFileSize: null,
3360
- minFileSize: null,
3361
- maxTotalFileSize: null,
3362
- maxNumberOfFiles: null,
3363
- minNumberOfFiles: null,
3364
- allowedFileTypes: null,
3365
- requiredMetaFields: []
3366
- };
3367
- class J extends Error {
3368
- constructor(n, r) {
3369
- super(n);
3370
- B(this, "isUserFacing");
3371
- B(this, "file");
3372
- B(this, "isRestriction", !0);
3373
- this.isUserFacing = (r == null ? void 0 : r.isUserFacing) ?? !0, r != null && r.file && (this.file = r.file);
3374
- }
3375
- }
3376
- class ho {
3377
- constructor(e, n) {
3378
- B(this, "getI18n");
3379
- B(this, "getOpts");
3380
- this.getI18n = n, this.getOpts = () => {
3381
- var s;
3382
- const r = e();
3383
- if (((s = r.restrictions) == null ? void 0 : s.allowedFileTypes) != null && !Array.isArray(r.restrictions.allowedFileTypes))
3384
- throw new TypeError("`restrictions.allowedFileTypes` must be an array");
3385
- return r;
3386
- };
3387
- }
3388
- // Because these operations are slow, we cannot run them for every file (if we are adding multiple files)
3389
- validateAggregateRestrictions(e, n) {
3390
- const { maxTotalFileSize: r, maxNumberOfFiles: s } = this.getOpts().restrictions;
3391
- if (s && e.filter((i) => !i.isGhost).length + n.length > s)
3392
- throw new J(`${this.getI18n()("youCanOnlyUploadX", {
3393
- smart_count: s
3394
- })}`);
3395
- if (r) {
3396
- const o = [...e, ...n].reduce((i, a) => i + (a.size ?? 0), 0);
3397
- if (o > r)
3398
- throw new J(this.getI18n()("aggregateExceedsSize", {
3399
- sizeAllowed: Pe(r),
3400
- size: Pe(o)
3401
- }));
3402
- }
3403
- }
3404
- validateSingleFile(e) {
3405
- const { maxFileSize: n, minFileSize: r, allowedFileTypes: s } = this.getOpts().restrictions;
3406
- if (s && !s.some((i) => i.includes("/") ? e.type ? fo(e.type.replace(/;.*?$/, ""), i) : !1 : i[0] === "." && e.extension ? e.extension.toLowerCase() === i.slice(1).toLowerCase() : !1)) {
3407
- const i = s.join(", ");
3408
- throw new J(this.getI18n()("youCanOnlyUploadFileTypes", {
3409
- types: i
3410
- }), { file: e });
3411
- }
3412
- if (n && e.size != null && e.size > n)
3413
- throw new J(this.getI18n()("exceedsSize", {
3414
- size: Pe(n),
3415
- file: e.name ?? this.getI18n()("unnamed")
3416
- }), { file: e });
3417
- if (r && e.size != null && e.size < r)
3418
- throw new J(this.getI18n()("inferiorSize", {
3419
- size: Pe(r)
3420
- }), { file: e });
3421
- }
3422
- validate(e, n) {
3423
- n.forEach((r) => {
3424
- this.validateSingleFile(r);
3425
- }), this.validateAggregateRestrictions(e, n);
3426
- }
3427
- validateMinNumberOfFiles(e) {
3428
- const { minNumberOfFiles: n } = this.getOpts().restrictions;
3429
- if (n && Object.keys(e).length < n)
3430
- throw new J(this.getI18n()("youHaveToAtLeastSelectX", {
3431
- smart_count: n
3432
- }));
3433
- }
3434
- getMissingRequiredMetaFields(e) {
3435
- const n = new J(this.getI18n()("missingRequiredMetaFieldOnFile", {
3436
- fileName: e.name ?? this.getI18n()("unnamed")
3437
- })), { requiredMetaFields: r } = this.getOpts().restrictions, s = [];
3438
- for (const o of r)
3439
- (!Object.hasOwn(e.meta, o) || e.meta[o] === "") && s.push(o);
3440
- return { missingFields: s, error: n };
3441
- }
3442
- }
3443
- const go = "5.0.0", yo = {
3444
- version: go
3445
- };
3446
- var ce, qe, Vn;
3447
- class Cn {
3448
- constructor() {
3449
- x(this, qe);
3450
- B(this, "state", {});
3451
- x(this, ce, /* @__PURE__ */ new Set());
3452
- }
3453
- getState() {
3454
- return this.state;
3455
- }
3456
- setState(e) {
3457
- const n = { ...this.state }, r = { ...this.state, ...e };
3458
- this.state = r, F(this, qe, Vn).call(this, n, r, e);
3459
- }
3460
- subscribe(e) {
3461
- return w(this, ce).add(e), () => {
3462
- w(this, ce).delete(e);
3463
- };
3464
- }
3465
- }
3466
- ce = new WeakMap(), qe = new WeakSet(), Vn = function(...e) {
3467
- w(this, ce).forEach((n) => {
3468
- n(...e);
3469
- });
3470
- }, B(Cn, "VERSION", yo.version);
3471
- function vo(t) {
3472
- var e = typeof t;
3473
- return t != null && (e == "object" || e == "function");
3474
- }
3475
- var It = vo, _o = typeof Ne == "object" && Ne && Ne.Object === Object && Ne, bo = _o, wo = bo, $o = typeof self == "object" && self && self.Object === Object && self, So = wo || $o || Function("return this")(), Mn = So, Fo = Mn, To = function() {
3476
- return Fo.Date.now();
3477
- }, ko = To, Io = /\s/;
3478
- function Eo(t) {
3479
- for (var e = t.length; e-- && Io.test(t.charAt(e)); )
3480
- ;
3481
- return e;
3482
- }
3483
- var Co = Eo, Vo = Co, Mo = /^\s+/;
3484
- function Uo(t) {
3485
- return t && t.slice(0, Vo(t) + 1).replace(Mo, "");
3486
- }
3487
- var Ao = Uo, Do = Mn, No = Do.Symbol, Un = No, Yt = Un, An = Object.prototype, Po = An.hasOwnProperty, zo = An.toString, we = Yt ? Yt.toStringTag : void 0;
3488
- function Oo(t) {
3489
- var e = Po.call(t, we), n = t[we];
3490
- try {
3491
- t[we] = void 0;
3492
- var r = !0;
3493
- } catch {
3494
- }
3495
- var s = zo.call(t);
3496
- return r && (e ? t[we] = n : delete t[we]), s;
3497
- }
3498
- var Ro = Oo, Bo = Object.prototype, jo = Bo.toString;
3499
- function Lo(t) {
3500
- return jo.call(t);
3501
- }
3502
- var qo = Lo, Xt = Un, xo = Ro, Ho = qo, Go = "[object Null]", Wo = "[object Undefined]", Zt = Xt ? Xt.toStringTag : void 0;
3503
- function Yo(t) {
3504
- return t == null ? t === void 0 ? Wo : Go : Zt && Zt in Object(t) ? xo(t) : Ho(t);
3505
- }
3506
- var Xo = Yo;
3507
- function Zo(t) {
3508
- return t != null && typeof t == "object";
3509
- }
3510
- var Ko = Zo, Jo = Xo, Qo = Ko, ea = "[object Symbol]";
3511
- function ta(t) {
3512
- return typeof t == "symbol" || Qo(t) && Jo(t) == ea;
3513
- }
3514
- var na = ta, ra = Ao, Kt = It, sa = na, Jt = NaN, ia = /^[-+]0x[0-9a-f]+$/i, oa = /^0b[01]+$/i, aa = /^0o[0-7]+$/i, la = parseInt;
3515
- function ua(t) {
3516
- if (typeof t == "number")
3517
- return t;
3518
- if (sa(t))
3519
- return Jt;
3520
- if (Kt(t)) {
3521
- var e = typeof t.valueOf == "function" ? t.valueOf() : t;
3522
- t = Kt(e) ? e + "" : e;
3523
- }
3524
- if (typeof t != "string")
3525
- return t === 0 ? t : +t;
3526
- t = ra(t);
3527
- var n = oa.test(t);
3528
- return n || aa.test(t) ? la(t.slice(2), n ? 2 : 8) : ia.test(t) ? Jt : +t;
3529
- }
3530
- var da = ua, pa = It, tt = ko, Qt = da, ca = "Expected a function", fa = Math.max, ma = Math.min;
3531
- function ha(t, e, n) {
3532
- var r, s, o, i, a, l, u = 0, d = !1, p = !1, c = !0;
3533
- if (typeof t != "function")
3534
- throw new TypeError(ca);
3535
- e = Qt(e) || 0, pa(n) && (d = !!n.leading, p = "maxWait" in n, o = p ? fa(Qt(n.maxWait) || 0, e) : o, c = "trailing" in n ? !!n.trailing : c);
3536
- function h($) {
3537
- var U = r, P = s;
3538
- return r = s = void 0, u = $, i = t.apply(P, U), i;
3539
- }
3540
- function v($) {
3541
- return u = $, a = setTimeout(k, e), d ? h($) : i;
3542
- }
3543
- function M($) {
3544
- var U = $ - l, P = $ - u, H = e - U;
3545
- return p ? ma(H, o - P) : H;
3546
- }
3547
- function A($) {
3548
- var U = $ - l, P = $ - u;
3549
- return l === void 0 || U >= e || U < 0 || p && P >= o;
3550
- }
3551
- function k() {
3552
- var $ = tt();
3553
- if (A($))
3554
- return I($);
3555
- a = setTimeout(k, M($));
3556
- }
3557
- function I($) {
3558
- return a = void 0, c && r ? h($) : (r = s = void 0, i);
3559
- }
3560
- function Y() {
3561
- a !== void 0 && clearTimeout(a), u = 0, r = l = s = a = void 0;
3562
- }
3563
- function f() {
3564
- return a === void 0 ? i : I(tt());
3565
- }
3566
- function _() {
3567
- var $ = tt(), U = A($);
3568
- if (r = arguments, s = this, l = $, U) {
3569
- if (a === void 0)
3570
- return v(l);
3571
- if (p)
3572
- return clearTimeout(a), a = setTimeout(k, e), h(l);
3573
- }
3574
- return a === void 0 && (a = setTimeout(k, e)), i;
3575
- }
3576
- return _.cancel = Y, _.flush = f, _;
3577
- }
3578
- var ga = ha, ya = ga, va = It, _a = "Expected a function";
3579
- function ba(t, e, n) {
3580
- var r = !0, s = !0;
3581
- if (typeof t != "function")
3582
- throw new TypeError(_a);
3583
- return va(n) && (r = "leading" in n ? !!n.leading : r, s = "trailing" in n ? !!n.trailing : s), ya(t, e, {
3584
- leading: r,
3585
- maxWait: e,
3586
- trailing: s
3587
- });
3588
- }
3589
- var wa = ba;
3590
- const $a = /* @__PURE__ */ Ze(wa);
3591
- var Sa = function() {
3592
- var e = {}, n = e._fns = {};
3593
- e.emit = function(i, a, l, u, d, p, c) {
3594
- var h = r(i);
3595
- h.length && s(i, h, [a, l, u, d, p, c]);
3596
- }, e.on = function(i, a) {
3597
- n[i] || (n[i] = []), n[i].push(a);
3598
- }, e.once = function(i, a) {
3599
- function l() {
3600
- a.apply(this, arguments), e.off(i, l);
3601
- }
3602
- this.on(i, l);
3603
- }, e.off = function(i, a) {
3604
- var l = [];
3605
- if (i && a) {
3606
- var u = this._fns[i], d = 0, p = u ? u.length : 0;
3607
- for (d; d < p; d++)
3608
- u[d] !== a && l.push(u[d]);
3609
- }
3610
- l.length ? this._fns[i] = l : delete this._fns[i];
3611
- };
3612
- function r(o) {
3613
- var i = n[o] ? n[o] : [], a = o.indexOf(":"), l = a === -1 ? [o] : [o.substring(0, a), o.substring(a + 1)], u = Object.keys(n), d = 0, p = u.length;
3614
- for (d; d < p; d++) {
3615
- var c = u[d];
3616
- if (c === "*" && (i = i.concat(n[c])), l.length === 2 && l[0] === c) {
3617
- i = i.concat(n[c]);
3618
- break;
3619
- }
3620
- }
3621
- return i;
3622
- }
3623
- function s(o, i, a) {
3624
- var l = 0, u = i.length;
3625
- for (l; l < u && i[l]; l++)
3626
- i[l].event = o, i[l].apply(i[l], a);
3627
- }
3628
- return e;
3629
- };
3630
- const Fa = /* @__PURE__ */ Ze(Sa);
3631
- let Ta = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", ka = (t = 21) => {
3632
- let e = "", n = t | 0;
3633
- for (; n--; )
3634
- e += Ta[Math.random() * 64 | 0];
3635
- return e;
3636
- };
3637
- const Ia = "5.2.0", Ea = {
3638
- version: Ia
3639
- };
3640
- function Ca(t, e) {
3641
- return e.name ? e.name : t.split("/")[0] === "image" ? `${t.split("/")[0]}.${t.split("/")[1]}` : "noname";
3642
- }
3643
- const Va = {
3644
- strings: {
3645
- addBulkFilesFailed: {
3646
- 0: "Failed to add %{smart_count} file due to an internal error",
3647
- 1: "Failed to add %{smart_count} files due to internal errors"
3648
- },
3649
- youCanOnlyUploadX: {
3650
- 0: "You can only upload %{smart_count} file",
3651
- 1: "You can only upload %{smart_count} files"
3652
- },
3653
- youHaveToAtLeastSelectX: {
3654
- 0: "You have to select at least %{smart_count} file",
3655
- 1: "You have to select at least %{smart_count} files"
3656
- },
3657
- aggregateExceedsSize: "You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",
3658
- exceedsSize: "%{file} exceeds maximum allowed size of %{size}",
3659
- missingRequiredMetaField: "Missing required meta fields",
3660
- missingRequiredMetaFieldOnFile: "Missing required meta fields in %{fileName}",
3661
- inferiorSize: "This file is smaller than the allowed size of %{size}",
3662
- youCanOnlyUploadFileTypes: "You can only upload: %{types}",
3663
- noMoreFilesAllowed: "Cannot add more files",
3664
- noDuplicates: "Cannot add the duplicate file '%{fileName}', it already exists",
3665
- companionError: "Connection with Companion failed",
3666
- authAborted: "Authentication aborted",
3667
- companionUnauthorizeHint: "To unauthorize to your %{provider} account, please go to %{url}",
3668
- failedToUpload: "Failed to upload %{file}",
3669
- noInternetConnection: "No Internet connection",
3670
- connectedToInternet: "Connected to the Internet",
3671
- // Strings for remote providers
3672
- noFilesFound: "You have no files or folders here",
3673
- noSearchResults: "Unfortunately, there are no results for this search",
3674
- selectX: {
3675
- 0: "Select %{smart_count}",
3676
- 1: "Select %{smart_count}"
3677
- },
3678
- allFilesFromFolderNamed: "All files from folder %{name}",
3679
- openFolderNamed: "Open folder %{name}",
3680
- cancel: "Cancel",
3681
- logOut: "Log out",
3682
- logIn: "Log in",
3683
- pickFiles: "Pick files",
3684
- pickPhotos: "Pick photos",
3685
- filter: "Filter",
3686
- resetFilter: "Reset filter",
3687
- loading: "Loading...",
3688
- loadedXFiles: "Loaded %{numFiles} files",
3689
- authenticateWithTitle: "Please authenticate with %{pluginName} to select files",
3690
- authenticateWith: "Connect to %{pluginName}",
3691
- signInWithGoogle: "Sign in with Google",
3692
- searchImages: "Search for images",
3693
- enterTextToSearch: "Enter text to search for images",
3694
- search: "Search",
3695
- resetSearch: "Reset search",
3696
- emptyFolderAdded: "No files were added from empty folder",
3697
- addedNumFiles: "Added %{numFiles} file(s)",
3698
- folderAlreadyAdded: 'The folder "%{folder}" was already added',
3699
- folderAdded: {
3700
- 0: "Added %{smart_count} file from %{folder}",
3701
- 1: "Added %{smart_count} files from %{folder}"
3702
- },
3703
- additionalRestrictionsFailed: "%{count} additional restrictions were not fulfilled",
3704
- unnamed: "Unnamed",
3705
- pleaseWait: "Please wait"
3706
- }
3707
- };
3708
- function Ma(t) {
3709
- if (t == null && typeof navigator < "u" && (t = navigator.userAgent), !t)
3710
- return !0;
3711
- const e = /Edge\/(\d+\.\d+)/.exec(t);
3712
- if (!e)
3713
- return !0;
3714
- const r = e[1].split(".", 2), s = parseInt(r[0], 10), o = parseInt(r[1], 10);
3715
- return s < 15 || s === 15 && o < 15063 || s > 18 || s === 18 && o >= 18218;
3716
- }
3717
- const ze = {
3718
- totalProgress: 0,
3719
- allowNewUpload: !0,
3720
- error: null,
3721
- recoveredState: null
3722
- };
3723
- var Z, K, Ce, le, fe, me, ue, y, oe, ut, Dn, Nn, Pn, dt, pt, ct, ft, xe, mt, de, zn, On, se, Ve, $e, Rn, ht, Se;
3724
- const He = class He {
3725
- /**
3726
- * Instantiate Uppy
3727
- */
3728
- constructor(e) {
3729
- x(this, y);
3730
- x(this, Z, /* @__PURE__ */ Object.create(null));
3731
- x(this, K);
3732
- x(this, Ce);
3733
- x(this, le, Fa());
3734
- x(this, fe, /* @__PURE__ */ new Set());
3735
- x(this, me, /* @__PURE__ */ new Set());
3736
- x(this, ue, /* @__PURE__ */ new Set());
3737
- B(this, "defaultLocale");
3738
- B(this, "locale");
3739
- // The user optionally passes in options, but we set defaults for missing options.
3740
- // We consider all options present after the contructor has run.
3741
- B(this, "opts");
3742
- B(this, "store");
3743
- // Warning: do not use this from a plugin, as it will cause the plugins' translations to be missing
3744
- B(this, "i18n");
3745
- B(this, "i18nArray");
3746
- B(this, "scheduledAutoProceed", null);
3747
- B(this, "wasOffline", !1);
3748
- x(this, xe, (e, n) => {
3749
- const r = e ? this.getFile(e.id) : void 0;
3750
- if (e == null || !r) {
3751
- this.log(`Not setting progress for a file that has been removed: ${e == null ? void 0 : e.id}`);
3752
- return;
3753
- }
3754
- if (r.progress.percentage === 100) {
3755
- this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);
3756
- return;
3757
- }
3758
- const s = {
3759
- bytesTotal: n.bytesTotal,
3760
- // bytesTotal may be null or zero; in that case we can't divide by it
3761
- percentage: n.bytesTotal != null && Number.isFinite(n.bytesTotal) && n.bytesTotal > 0 ? Math.round(n.bytesUploaded / n.bytesTotal * 100) : void 0
3762
- };
3763
- r.progress.uploadStarted != null ? this.setFileState(e.id, {
3764
- progress: {
3765
- ...r.progress,
3766
- ...s,
3767
- bytesUploaded: n.bytesUploaded
3768
- }
3769
- }) : this.setFileState(e.id, {
3770
- progress: {
3771
- ...r.progress,
3772
- ...s
3773
- }
3774
- }), w(this, de).call(this);
3775
- });
3776
- // ___Why throttle at 500ms?
3777
- // - We must throttle at >250ms for superfocus in Dashboard to work well
3778
- // (because animation takes 0.25s, and we want to wait for all animations to be over before refocusing).
3779
- // [Practical Check]: if thottle is at 100ms, then if you are uploading a file,
3780
- // and click 'ADD MORE FILES', - focus won't activate in Firefox.
3781
- // - We must throttle at around >500ms to avoid performance lags.
3782
- // [Practical Check] Firefox, try to upload a big file for a prolonged period of time. Laptop will start to heat up.
3783
- x(this, de, $a(() => F(this, y, mt).call(this), 500, { leading: !0, trailing: !0 }));
3784
- x(this, se, this.updateOnlineStatus.bind(this));
3785
- // We need to store request clients by a unique ID, so we can share RequestClient instances across files
3786
- // this allows us to do rate limiting and synchronous operations like refreshing provider tokens
3787
- // example: refreshing tokens: if each file has their own requestclient,
3788
- // we don't have any way to synchronize all requests in order to
3789
- // - block all requests
3790
- // - refresh the token
3791
- // - unblock all requests and allow them to run with a the new access token
3792
- // back when we had a requestclient per file, once an access token expired,
3793
- // all 6 files would go ahead and refresh the token at the same time
3794
- // (calling /refresh-token up to 6 times), which will probably fail for some providers
3795
- x(this, Ve, /* @__PURE__ */ new Map());
3796
- this.defaultLocale = Va;
3797
- const n = {
3798
- id: "uppy",
3799
- autoProceed: !1,
3800
- allowMultipleUploadBatches: !0,
3801
- debug: !1,
3802
- restrictions: mo,
3803
- meta: {},
3804
- onBeforeFileAdded: (s, o) => !Object.hasOwn(o, s.id),
3805
- onBeforeUpload: (s) => s,
3806
- store: new Cn(),
3807
- logger: io,
3808
- infoTimeout: 5e3
3809
- }, r = { ...n, ...e };
3810
- this.opts = {
3811
- ...r,
3812
- restrictions: {
3813
- ...n.restrictions,
3814
- ...e == null ? void 0 : e.restrictions
3815
- }
3816
- }, e != null && e.logger && e.debug ? this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.", "warning") : e != null && e.debug && (this.opts.logger = oo), this.log(`Using Core v${He.VERSION}`), this.i18nInit(), this.store = this.opts.store, this.setState({
3817
- ...ze,
3818
- plugins: {},
3819
- files: {},
3820
- currentUploads: {},
3821
- capabilities: {
3822
- uploadProgress: Ma(),
3823
- individualCancellation: !0,
3824
- resumableUploads: !1
3825
- },
3826
- meta: { ...this.opts.meta },
3827
- info: []
3828
- }), Ue(this, K, new ho(() => this.opts, () => this.i18n)), Ue(this, Ce, this.store.subscribe((s, o, i) => {
3829
- this.emit("state-update", s, o, i), this.updateAll(o);
3830
- })), this.opts.debug && typeof window < "u" && (window[this.opts.id] = this), F(this, y, On).call(this);
3831
- }
3832
- emit(e, ...n) {
3833
- w(this, le).emit(e, ...n);
3834
- }
3835
- on(e, n) {
3836
- return w(this, le).on(e, n), this;
3837
- }
3838
- once(e, n) {
3839
- return w(this, le).once(e, n), this;
3840
- }
3841
- off(e, n) {
3842
- return w(this, le).off(e, n), this;
3843
- }
3844
- /**
3845
- * Iterate on all plugins and run `update` on them.
3846
- * Called each time state changes.
3847
- *
3848
- */
3849
- updateAll(e) {
3850
- this.iteratePlugins((n) => {
3851
- n.update(e);
3852
- });
3853
- }
3854
- /**
3855
- * Updates state with a patch
3856
- */
3857
- setState(e) {
3858
- this.store.setState(e);
3859
- }
3860
- /**
3861
- * Returns current state.
3862
- */
3863
- getState() {
3864
- return this.store.getState();
3865
- }
3866
- patchFilesState(e) {
3867
- const n = this.getState().files;
3868
- this.setState({
3869
- files: {
3870
- ...n,
3871
- ...Object.fromEntries(Object.entries(e).map(([r, s]) => [
3872
- r,
3873
- {
3874
- ...n[r],
3875
- ...s
3876
- }
3877
- ]))
3878
- }
3879
- });
3880
- }
3881
- /**
3882
- * Shorthand to set state for a specific file.
3883
- */
3884
- setFileState(e, n) {
3885
- if (!this.getState().files[e])
3886
- throw new Error(`Can’t set state for ${e} (the file could have been removed)`);
3887
- this.patchFilesState({ [e]: n });
3888
- }
3889
- i18nInit() {
3890
- const e = (r) => this.log(`Missing i18n string: ${r}`, "error"), n = new so([this.defaultLocale, this.opts.locale], {
3891
- onMissingKey: e
3892
- });
3893
- this.i18n = n.translate.bind(n), this.i18nArray = n.translateArray.bind(n), this.locale = n.locale;
3894
- }
3895
- setOptions(e) {
3896
- this.opts = {
3897
- ...this.opts,
3898
- ...e,
3899
- restrictions: {
3900
- ...this.opts.restrictions,
3901
- ...e == null ? void 0 : e.restrictions
3902
- }
3903
- }, e.meta && this.setMeta(e.meta), this.i18nInit(), e.locale && this.iteratePlugins((n) => {
3904
- n.setOptions(e);
3905
- }), this.setState(void 0);
3906
- }
3907
- resetProgress() {
3908
- const e = {
3909
- percentage: 0,
3910
- bytesUploaded: !1,
3911
- uploadComplete: !1,
3912
- uploadStarted: null
3913
- }, n = { ...this.getState().files }, r = /* @__PURE__ */ Object.create(null);
3914
- Object.keys(n).forEach((s) => {
3915
- r[s] = {
3916
- ...n[s],
3917
- progress: {
3918
- ...n[s].progress,
3919
- ...e
3920
- },
3921
- // @ts-expect-error these typed are inserted
3922
- // into the namespace in their respective packages
3923
- // but core isn't ware of those
3924
- tus: void 0,
3925
- transloadit: void 0
3926
- };
3927
- }), this.setState({ files: r, ...ze });
3928
- }
3929
- clear() {
3930
- const { capabilities: e, currentUploads: n } = this.getState();
3931
- if (Object.keys(n).length > 0 && !e.individualCancellation)
3932
- throw new Error("The installed uploader plugin does not allow removing files during an upload.");
3933
- this.setState({ ...ze, files: {} });
3934
- }
3935
- addPreProcessor(e) {
3936
- w(this, fe).add(e);
3937
- }
3938
- removePreProcessor(e) {
3939
- return w(this, fe).delete(e);
3940
- }
3941
- addPostProcessor(e) {
3942
- w(this, ue).add(e);
3943
- }
3944
- removePostProcessor(e) {
3945
- return w(this, ue).delete(e);
3946
- }
3947
- addUploader(e) {
3948
- w(this, me).add(e);
3949
- }
3950
- removeUploader(e) {
3951
- return w(this, me).delete(e);
3952
- }
3953
- setMeta(e) {
3954
- const n = { ...this.getState().meta, ...e }, r = { ...this.getState().files };
3955
- Object.keys(r).forEach((s) => {
3956
- r[s] = {
3957
- ...r[s],
3958
- meta: { ...r[s].meta, ...e }
3959
- };
3960
- }), this.log("Adding metadata:"), this.log(e), this.setState({
3961
- meta: n,
3962
- files: r
3963
- });
3964
- }
3965
- setFileMeta(e, n) {
3966
- const r = { ...this.getState().files };
3967
- if (!r[e]) {
3968
- this.log(`Was trying to set metadata for a file that has been removed: ${e}`);
3969
- return;
3970
- }
3971
- const s = { ...r[e].meta, ...n };
3972
- r[e] = { ...r[e], meta: s }, this.setState({ files: r });
3973
- }
3974
- /**
3975
- * Get a file object.
3976
- */
3977
- getFile(e) {
3978
- return this.getState().files[e];
3979
- }
3980
- /**
3981
- * Get all files in an array.
3982
- */
3983
- getFiles() {
3984
- const { files: e } = this.getState();
3985
- return Object.values(e);
3986
- }
3987
- getFilesByIds(e) {
3988
- return e.map((n) => this.getFile(n));
3989
- }
3990
- getObjectOfFilesPerState() {
3991
- const { files: e, totalProgress: n, error: r } = this.getState(), s = Object.values(e), o = [], i = [], a = [], l = [], u = [], d = [], p = [], c = [], h = [];
3992
- for (const v of s) {
3993
- const { progress: M } = v;
3994
- !M.uploadComplete && M.uploadStarted && (o.push(v), v.isPaused || c.push(v)), M.uploadStarted || i.push(v), (M.uploadStarted || M.preprocess || M.postprocess) && a.push(v), M.uploadStarted && l.push(v), v.isPaused && u.push(v), M.uploadComplete && d.push(v), v.error && p.push(v), (M.preprocess || M.postprocess) && h.push(v);
3995
- }
3996
- return {
3997
- newFiles: i,
3998
- startedFiles: a,
3999
- uploadStartedFiles: l,
4000
- pausedFiles: u,
4001
- completeFiles: d,
4002
- erroredFiles: p,
4003
- inProgressFiles: o,
4004
- inProgressNotPausedFiles: c,
4005
- processingFiles: h,
4006
- isUploadStarted: l.length > 0,
4007
- isAllComplete: n === 100 && d.length === s.length && h.length === 0,
4008
- isAllErrored: !!r && p.length === s.length,
4009
- isAllPaused: o.length !== 0 && u.length === o.length,
4010
- isUploadInProgress: o.length > 0,
4011
- isSomeGhost: s.some((v) => v.isGhost)
4012
- };
4013
- }
4014
- validateRestrictions(e, n = this.getFiles()) {
4015
- try {
4016
- w(this, K).validate(n, [e]);
4017
- } catch (r) {
4018
- return r;
4019
- }
4020
- return null;
4021
- }
4022
- validateSingleFile(e) {
4023
- try {
4024
- w(this, K).validateSingleFile(e);
4025
- } catch (n) {
4026
- return n.message;
4027
- }
4028
- return null;
4029
- }
4030
- validateAggregateRestrictions(e) {
4031
- const n = this.getFiles();
4032
- try {
4033
- w(this, K).validateAggregateRestrictions(n, e);
4034
- } catch (r) {
4035
- return r.message;
4036
- }
4037
- return null;
4038
- }
4039
- checkIfFileAlreadyExists(e) {
4040
- const { files: n } = this.getState();
4041
- return !!(n[e] && !n[e].isGhost);
4042
- }
4043
- /**
4044
- * Add a new file to `state.files`. This will run `onBeforeFileAdded`,
4045
- * try to guess file type in a clever way, check file against restrictions,
4046
- * and start an upload if `autoProceed === true`.
4047
- */
4048
- addFile(e) {
4049
- const { nextFilesState: n, validFilesToAdd: r, errors: s } = F(this, y, pt).call(this, [e]), o = s.filter((a) => a.isRestriction);
4050
- if (F(this, y, oe).call(this, o), s.length > 0)
4051
- throw s[0];
4052
- this.setState({ files: n });
4053
- const [i] = r;
4054
- return this.emit("file-added", i), this.emit("files-added", r), this.log(`Added file: ${i.name}, ${i.id}, mime type: ${i.type}`), F(this, y, dt).call(this), i.id;
4055
- }
4056
- /**
4057
- * Add multiple files to `state.files`. See the `addFile()` documentation.
4058
- *
4059
- * If an error occurs while adding a file, it is logged and the user is notified.
4060
- * This is good for UI plugins, but not for programmatic use.
4061
- * Programmatic users should usually still use `addFile()` on individual files.
4062
- */
4063
- addFiles(e) {
4064
- const { nextFilesState: n, validFilesToAdd: r, errors: s } = F(this, y, pt).call(this, e), o = s.filter((a) => a.isRestriction);
4065
- F(this, y, oe).call(this, o);
4066
- const i = s.filter((a) => !a.isRestriction);
4067
- if (i.length > 0) {
4068
- let a = `Multiple errors occurred while adding files:
4069
- `;
4070
- if (i.forEach((l) => {
4071
- a += `
4072
- * ${l.message}`;
4073
- }), this.info({
4074
- message: this.i18n("addBulkFilesFailed", {
4075
- smart_count: i.length
4076
- }),
4077
- details: a
4078
- }, "error", this.opts.infoTimeout), typeof AggregateError == "function")
4079
- throw new AggregateError(i, a);
4080
- {
4081
- const l = new Error(a);
4082
- throw l.errors = i, l;
4083
- }
4084
- }
4085
- this.setState({ files: n }), r.forEach((a) => {
4086
- this.emit("file-added", a);
4087
- }), this.emit("files-added", r), r.length > 5 ? this.log(`Added batch of ${r.length} files`) : Object.values(r).forEach((a) => {
4088
- this.log(`Added file: ${a.name}
4089
- id: ${a.id}
4090
- type: ${a.type}`);
4091
- }), r.length > 0 && F(this, y, dt).call(this);
4092
- }
4093
- removeFiles(e) {
4094
- const { files: n, currentUploads: r } = this.getState(), s = { ...n }, o = { ...r }, i = /* @__PURE__ */ Object.create(null);
4095
- e.forEach((d) => {
4096
- n[d] && (i[d] = n[d], delete s[d]);
4097
- });
4098
- function a(d) {
4099
- return i[d] === void 0;
4100
- }
4101
- Object.keys(o).forEach((d) => {
4102
- const p = r[d].fileIDs.filter(a);
4103
- if (p.length === 0) {
4104
- delete o[d];
4105
- return;
4106
- }
4107
- const { capabilities: c } = this.getState();
4108
- if (p.length !== r[d].fileIDs.length && !c.individualCancellation)
4109
- throw new Error("The installed uploader plugin does not allow removing files during an upload.");
4110
- o[d] = {
4111
- ...r[d],
4112
- fileIDs: p
4113
- };
4114
- });
4115
- const l = {
4116
- currentUploads: o,
4117
- files: s
4118
- };
4119
- Object.keys(s).length === 0 && (l.allowNewUpload = !0, l.error = null, l.recoveredState = null), this.setState(l), w(this, de).call(this);
4120
- const u = Object.keys(i);
4121
- u.forEach((d) => {
4122
- this.emit("file-removed", i[d]);
4123
- }), u.length > 5 ? this.log(`Removed ${u.length} files`) : this.log(`Removed files: ${u.join(", ")}`);
4124
- }
4125
- removeFile(e) {
4126
- this.removeFiles([e]);
4127
- }
4128
- pauseResume(e) {
4129
- if (!this.getState().capabilities.resumableUploads || this.getFile(e).progress.uploadComplete)
4130
- return;
4131
- const n = this.getFile(e), s = !(n.isPaused || !1);
4132
- return this.setFileState(e, {
4133
- isPaused: s
4134
- }), this.emit("upload-pause", n, s), s;
4135
- }
4136
- pauseAll() {
4137
- const e = { ...this.getState().files };
4138
- Object.keys(e).filter((r) => !e[r].progress.uploadComplete && e[r].progress.uploadStarted).forEach((r) => {
4139
- const s = { ...e[r], isPaused: !0 };
4140
- e[r] = s;
4141
- }), this.setState({ files: e }), this.emit("pause-all");
4142
- }
4143
- resumeAll() {
4144
- const e = { ...this.getState().files };
4145
- Object.keys(e).filter((r) => !e[r].progress.uploadComplete && e[r].progress.uploadStarted).forEach((r) => {
4146
- const s = {
4147
- ...e[r],
4148
- isPaused: !1,
4149
- error: null
4150
- };
4151
- e[r] = s;
4152
- }), this.setState({ files: e }), this.emit("resume-all");
4153
- }
4154
- async retryAll() {
4155
- const e = await F(this, y, ft).call(this);
4156
- return this.emit("complete", e), e;
4157
- }
4158
- cancelAll() {
4159
- this.emit("cancel-all");
4160
- const { files: e } = this.getState(), n = Object.keys(e);
4161
- n.length && this.removeFiles(n), this.setState(ze);
4162
- }
4163
- /**
4164
- * Retry a specific file that has errored.
4165
- */
4166
- retryUpload(e) {
4167
- this.setFileState(e, {
4168
- error: null,
4169
- isPaused: !1
4170
- }), this.emit("upload-retry", this.getFile(e));
4171
- const n = F(this, y, $e).call(this, [e], {
4172
- forceAllowNewUpload: !0
4173
- // create new upload even if allowNewUpload: false
4174
- });
4175
- return F(this, y, Se).call(this, n);
4176
- }
4177
- logout() {
4178
- this.iteratePlugins((e) => {
4179
- var n, r;
4180
- (r = (n = e.provider) == null ? void 0 : n.logout) == null || r.call(n);
4181
- });
4182
- }
4183
- [Symbol.for("uppy test: updateTotalProgress")]() {
4184
- return F(this, y, mt).call(this);
4185
- }
4186
- updateOnlineStatus() {
4187
- window.navigator.onLine ?? !0 ? (this.emit("is-online"), this.wasOffline && (this.emit("back-online"), this.info(this.i18n("connectedToInternet"), "success", 3e3), this.wasOffline = !1)) : (this.emit("is-offline"), this.info(this.i18n("noInternetConnection"), "error", 0), this.wasOffline = !0);
4188
- }
4189
- getID() {
4190
- return this.opts.id;
4191
- }
4192
- /**
4193
- * Registers a plugin with Core.
4194
- */
4195
- use(e, ...n) {
4196
- if (typeof e != "function") {
4197
- const i = `Expected a plugin class, but got ${e === null ? "null" : typeof e}. Please verify that the plugin was imported and spelled correctly.`;
4198
- throw new TypeError(i);
4199
- }
4200
- const r = new e(this, ...n), s = r.id;
4201
- if (!s)
4202
- throw new Error("Your plugin must have an id");
4203
- if (!r.type)
4204
- throw new Error("Your plugin must have a type");
4205
- const o = this.getPlugin(s);
4206
- if (o) {
4207
- const i = `Already found a plugin named '${o.id}'. Tried to use: '${s}'.
4208
- Uppy plugins must have unique \`id\` options.`;
4209
- throw new Error(i);
4210
- }
4211
- return e.VERSION && this.log(`Using ${s} v${e.VERSION}`), r.type in w(this, Z) ? w(this, Z)[r.type].push(r) : w(this, Z)[r.type] = [r], r.install(), this.emit("plugin-added", r), this;
4212
- }
4213
- getPlugin(e) {
4214
- for (const n of Object.values(w(this, Z))) {
4215
- const r = n.find((s) => s.id === e);
4216
- if (r != null)
4217
- return r;
4218
- }
4219
- }
4220
- [Symbol.for("uppy test: getPlugins")](e) {
4221
- return w(this, Z)[e];
4222
- }
4223
- /**
4224
- * Iterate through all `use`d plugins.
4225
- *
4226
- */
4227
- iteratePlugins(e) {
4228
- Object.values(w(this, Z)).flat(1).forEach(e);
4229
- }
4230
- /**
4231
- * Uninstall and remove a plugin.
4232
- *
4233
- * @param {object} instance The plugin instance to remove.
4234
- */
4235
- removePlugin(e) {
4236
- this.log(`Removing plugin ${e.id}`), this.emit("plugin-remove", e), e.uninstall && e.uninstall();
4237
- const n = w(this, Z)[e.type], r = n.findIndex((i) => i.id === e.id);
4238
- r !== -1 && n.splice(r, 1);
4239
- const o = {
4240
- plugins: {
4241
- ...this.getState().plugins,
4242
- [e.id]: void 0
4243
- }
4244
- };
4245
- this.setState(o);
4246
- }
4247
- /**
4248
- * Uninstall all plugins and close down this Uppy instance.
4249
- */
4250
- destroy() {
4251
- this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`), this.cancelAll(), w(this, Ce).call(this), this.iteratePlugins((e) => {
4252
- this.removePlugin(e);
4253
- }), typeof window < "u" && window.removeEventListener && (window.removeEventListener("online", w(this, se)), window.removeEventListener("offline", w(this, se)));
4254
- }
4255
- hideInfo() {
4256
- const { info: e } = this.getState();
4257
- this.setState({ info: e.slice(1) }), this.emit("info-hidden");
4258
- }
4259
- /**
4260
- * Set info message in `state.info`, so that UI plugins like `Informer`
4261
- * can display the message.
4262
- */
4263
- info(e, n = "info", r = 3e3) {
4264
- const s = typeof e == "object";
4265
- this.setState({
4266
- info: [
4267
- ...this.getState().info,
4268
- {
4269
- type: n,
4270
- message: s ? e.message : e,
4271
- details: s ? e.details : null
4272
- }
4273
- ]
4274
- }), setTimeout(() => this.hideInfo(), r), this.emit("info-visible");
4275
- }
4276
- /**
4277
- * Passes messages to a function, provided in `opts.logger`.
4278
- * If `opts.logger: Uppy.debugLogger` or `opts.debug: true`, logs to the browser console.
4279
- */
4280
- log(e, n) {
4281
- const { logger: r } = this.opts;
4282
- switch (n) {
4283
- case "error":
4284
- r.error(e);
4285
- break;
4286
- case "warning":
4287
- r.warn(e);
4288
- break;
4289
- default:
4290
- r.debug(e);
4291
- break;
4292
- }
4293
- }
4294
- registerRequestClient(e, n) {
4295
- w(this, Ve).set(e, n);
4296
- }
4297
- /** @protected */
4298
- getRequestClientForFile(e) {
4299
- if (!("remote" in e && e.remote))
4300
- throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);
4301
- const n = w(this, Ve).get(e.remote.requestClientId);
4302
- if (n == null)
4303
- throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);
4304
- return n;
4305
- }
4306
- /**
4307
- * Restore an upload by its ID.
4308
- */
4309
- async restore(e) {
4310
- this.log(`Core: Running restored upload "${e}"`);
4311
- const n = await F(this, y, Se).call(this, e);
4312
- return this.emit("complete", n), n;
4313
- }
4314
- [Symbol.for("uppy test: createUpload")](...e) {
4315
- return F(this, y, $e).call(this, ...e);
4316
- }
4317
- /**
4318
- * Add data to an upload's result object.
4319
- */
4320
- addResultData(e, n) {
4321
- if (!F(this, y, Rn).call(this, e)) {
4322
- this.log(`Not setting result for an upload that has been removed: ${e}`);
4323
- return;
4324
- }
4325
- const { currentUploads: r } = this.getState(), s = {
4326
- ...r[e],
4327
- result: { ...r[e].result, ...n }
4328
- };
4329
- this.setState({
4330
- currentUploads: { ...r, [e]: s }
4331
- });
4332
- }
4333
- /**
4334
- * Start an upload for all the files that are not currently being uploaded.
4335
- */
4336
- async upload() {
4337
- var s;
4338
- (s = w(this, Z).uploader) != null && s.length || this.log("No uploader type plugins are used", "warning");
4339
- let { files: e } = this.getState();
4340
- if (F(this, y, ct).call(this).length > 0) {
4341
- const o = await F(this, y, ft).call(this);
4342
- if (!(this.getFiles().filter((a) => a.progress.uploadStarted == null).length > 0))
4343
- return this.emit("complete", o), o;
4344
- ({ files: e } = this.getState());
4345
- }
4346
- const r = this.opts.onBeforeUpload(e);
4347
- if (r === !1)
4348
- throw new Error("Not starting the upload because onBeforeUpload returned false");
4349
- r && typeof r == "object" && (e = r, this.setState({
4350
- files: e
4351
- }));
4352
- try {
4353
- if (w(this, K).validateMinNumberOfFiles(e), !F(this, y, Dn).call(this, e))
4354
- throw new J(this.i18n("missingRequiredMetaField"));
4355
- const { currentUploads: o } = this.getState(), i = Object.values(o).flatMap((d) => d.fileIDs), a = Object.keys(e).filter((d) => {
4356
- const p = this.getFile(d);
4357
- return p && !p.progress.uploadStarted && !i.includes(d);
4358
- }), l = F(this, y, $e).call(this, a), u = await F(this, y, Se).call(this, l);
4359
- return this.emit("complete", u), u;
4360
- } catch (o) {
4361
- throw F(this, y, oe).call(this, [o]), o;
4362
- }
4363
- }
4364
- };
4365
- Z = new WeakMap(), K = new WeakMap(), Ce = new WeakMap(), le = new WeakMap(), fe = new WeakMap(), me = new WeakMap(), ue = new WeakMap(), y = new WeakSet(), oe = function(e) {
4366
- for (const i of e)
4367
- i.isRestriction ? this.emit("restriction-failed", i.file, i) : this.emit("error", i, i.file), this.log(i, "warning");
4368
- const n = e.filter((i) => i.isUserFacing), r = 4, s = n.slice(0, r), o = n.slice(r);
4369
- s.forEach(({ message: i, details: a = "" }) => {
4370
- this.info({ message: i, details: a }, "error", this.opts.infoTimeout);
4371
- }), o.length > 0 && this.info({
4372
- message: this.i18n("additionalRestrictionsFailed", {
4373
- count: o.length
4374
- })
4375
- });
4376
- }, ut = function(e) {
4377
- const { missingFields: n, error: r } = w(this, K).getMissingRequiredMetaFields(e);
4378
- return n.length > 0 ? (this.setFileState(e.id, {
4379
- missingRequiredMetaFields: n,
4380
- error: r.message
4381
- }), this.log(r.message), this.emit("restriction-failed", e, r), !1) : (n.length === 0 && e.missingRequiredMetaFields && this.setFileState(e.id, {
4382
- missingRequiredMetaFields: []
4383
- }), !0);
4384
- }, Dn = function(e) {
4385
- let n = !0;
4386
- for (const r of Object.values(e))
4387
- F(this, y, ut).call(this, r) || (n = !1);
4388
- return n;
4389
- }, Nn = function(e) {
4390
- const { allowNewUpload: n } = this.getState();
4391
- if (n === !1) {
4392
- const r = new J(this.i18n("noMoreFilesAllowed"), {
4393
- file: e
4394
- });
4395
- throw F(this, y, oe).call(this, [r]), r;
4396
- }
4397
- }, /**
4398
- * Create a file state object based on user-provided `addFile()` options.
4399
- */
4400
- Pn = function(e) {
4401
- const n = e instanceof File ? {
4402
- name: e.name,
4403
- type: e.type,
4404
- size: e.size,
4405
- data: e,
4406
- meta: {},
4407
- isRemote: !1,
4408
- source: void 0,
4409
- preview: void 0
4410
- } : e, r = In(n), s = Ca(r, n), o = kn(s).extension, i = to(n, this.getID()), a = {
4411
- ...n.meta,
4412
- name: s,
4413
- type: r
4414
- }, l = Number.isFinite(n.data.size) ? n.data.size : null;
4415
- return {
4416
- source: n.source || "",
4417
- id: i,
4418
- name: s,
4419
- extension: o || "",
4420
- meta: {
4421
- ...this.getState().meta,
4422
- ...a
4423
- },
4424
- type: r,
4425
- progress: {
4426
- percentage: 0,
4427
- bytesUploaded: !1,
4428
- bytesTotal: l,
4429
- uploadComplete: !1,
4430
- uploadStarted: null
4431
- },
4432
- size: l,
4433
- isGhost: !1,
4434
- ...n.isRemote ? {
4435
- isRemote: !0,
4436
- remote: n.remote,
4437
- data: n.data
4438
- } : {
4439
- isRemote: !1,
4440
- data: n.data
4441
- },
4442
- preview: n.preview
4443
- };
4444
- }, // Schedule an upload if `autoProceed` is enabled.
4445
- dt = function() {
4446
- this.opts.autoProceed && !this.scheduledAutoProceed && (this.scheduledAutoProceed = setTimeout(() => {
4447
- this.scheduledAutoProceed = null, this.upload().catch((e) => {
4448
- e.isRestriction || this.log(e.stack || e.message || e);
4449
- });
4450
- }, 4));
4451
- }, pt = function(e) {
4452
- let { files: n } = this.getState(), r = { ...n };
4453
- const s = [], o = [];
4454
- for (const i of e)
4455
- try {
4456
- let a = F(this, y, Pn).call(this, i);
4457
- F(this, y, Nn).call(this, a);
4458
- const l = n[a.id], u = l == null ? void 0 : l.isGhost;
4459
- if (u && !a.isRemote) {
4460
- if (a.data == null)
4461
- throw new Error("File data is missing");
4462
- a = {
4463
- ...l,
4464
- isGhost: !1,
4465
- data: a.data
4466
- }, this.log(`Replaced the blob in the restored ghost file: ${a.name}, ${a.id}`);
4467
- }
4468
- const d = this.opts.onBeforeFileAdded(a, r);
4469
- if (n = this.getState().files, r = { ...n, ...r }, !d && this.checkIfFileAlreadyExists(a.id))
4470
- throw new J(this.i18n("noDuplicates", {
4471
- fileName: a.name ?? this.i18n("unnamed")
4472
- }), { file: a });
4473
- if (d === !1 && !u)
4474
- throw new J("Cannot add the file because onBeforeFileAdded returned false.", { isUserFacing: !1, file: a });
4475
- typeof d == "object" && d !== null && (a = d), w(this, K).validateSingleFile(a), r[a.id] = a, s.push(a);
4476
- } catch (a) {
4477
- o.push(a);
4478
- }
4479
- try {
4480
- w(this, K).validateAggregateRestrictions(Object.values(n), s);
4481
- } catch (i) {
4482
- return o.push(i), {
4483
- nextFilesState: n,
4484
- validFilesToAdd: [],
4485
- errors: o
4486
- };
4487
- }
4488
- return {
4489
- nextFilesState: r,
4490
- validFilesToAdd: s,
4491
- errors: o
4492
- };
4493
- }, ct = function() {
4494
- const { files: e } = this.getState();
4495
- return Object.keys(e).filter((n) => {
4496
- const r = e[n];
4497
- return r.error && (!r.missingRequiredMetaFields || r.missingRequiredMetaFields.length === 0);
4498
- });
4499
- }, ft = async function() {
4500
- const e = F(this, y, ct).call(this), n = { ...this.getState().files };
4501
- if (e.forEach((s) => {
4502
- n[s] = {
4503
- ...n[s],
4504
- isPaused: !1,
4505
- error: null
4506
- };
4507
- }), this.setState({
4508
- files: n,
4509
- error: null
4510
- }), this.emit("retry-all", this.getFilesByIds(e)), e.length === 0)
4511
- return {
4512
- successful: [],
4513
- failed: []
4514
- };
4515
- const r = F(this, y, $e).call(this, e, {
4516
- forceAllowNewUpload: !0
4517
- // create new upload even if allowNewUpload: false
4518
- });
4519
- return F(this, y, Se).call(this, r);
4520
- }, xe = new WeakMap(), mt = function() {
4521
- const e = F(this, y, zn).call(this);
4522
- let n = null;
4523
- e != null && (n = Math.round(e * 100), n > 100 ? n = 100 : n < 0 && (n = 0)), this.emit("progress", n ?? 0), this.setState({
4524
- totalProgress: n ?? 0
4525
- });
4526
- }, de = new WeakMap(), zn = function() {
4527
- const n = this.getFiles().filter((l) => l.progress.uploadStarted || l.progress.preprocess || l.progress.postprocess);
4528
- if (n.length === 0)
4529
- return 0;
4530
- if (n.every((l) => l.progress.uploadComplete))
4531
- return 1;
4532
- const r = (l) => l.progress.bytesTotal != null && l.progress.bytesTotal !== 0, s = n.filter(r), o = n.filter((l) => !r(l));
4533
- if (s.every((l) => l.progress.uploadComplete) && o.length > 0 && !o.every((l) => l.progress.uploadComplete))
4534
- return null;
4535
- const i = s.reduce((l, u) => l + (u.progress.bytesTotal ?? 0), 0), a = s.reduce((l, u) => l + (u.progress.bytesUploaded || 0), 0);
4536
- return i === 0 ? 0 : a / i;
4537
- }, /**
4538
- * Registers listeners for all global actions, like:
4539
- * `error`, `file-removed`, `upload-progress`
4540
- */
4541
- On = function() {
4542
- const e = (s, o, i) => {
4543
- let a = s.message || "Unknown error";
4544
- s.details && (a += ` ${s.details}`), this.setState({ error: a }), o != null && o.id in this.getState().files && this.setFileState(o.id, {
4545
- error: a,
4546
- response: i
4547
- });
4548
- };
4549
- this.on("error", e), this.on("upload-error", (s, o, i) => {
4550
- if (e(o, s, i), typeof o == "object" && o.message) {
4551
- this.log(o.message, "error");
4552
- const a = new Error(this.i18n("failedToUpload", { file: (s == null ? void 0 : s.name) ?? "" }));
4553
- a.isUserFacing = !0, a.details = o.message, o.details && (a.details += ` ${o.details}`), F(this, y, oe).call(this, [a]);
4554
- } else
4555
- F(this, y, oe).call(this, [o]);
4556
- });
4557
- let n = null;
4558
- this.on("upload-stalled", (s, o) => {
4559
- const { message: i } = s, a = o.map((l) => l.meta.name).join(", ");
4560
- n || (this.info({ message: i, details: a }, "warning", this.opts.infoTimeout), n = setTimeout(() => {
4561
- n = null;
4562
- }, this.opts.infoTimeout)), this.log(`${i} ${a}`.trim(), "warning");
4563
- }), this.on("upload", () => {
4564
- this.setState({ error: null });
4565
- });
4566
- const r = (s) => {
4567
- const o = s.filter((a) => {
4568
- const l = a != null && this.getFile(a.id);
4569
- return l || this.log(`Not setting progress for a file that has been removed: ${a == null ? void 0 : a.id}`), l;
4570
- }), i = Object.fromEntries(o.map((a) => [
4571
- a.id,
4572
- {
4573
- progress: {
4574
- uploadStarted: Date.now(),
4575
- uploadComplete: !1,
4576
- bytesUploaded: 0,
4577
- bytesTotal: a.size
4578
- }
4579
- }
4580
- ]));
4581
- this.patchFilesState(i);
4582
- };
4583
- this.on("upload-start", r), this.on("upload-progress", w(this, xe)), this.on("upload-success", (s, o) => {
4584
- if (s == null || !this.getFile(s.id)) {
4585
- this.log(`Not setting progress for a file that has been removed: ${s == null ? void 0 : s.id}`);
4586
- return;
4587
- }
4588
- const i = this.getFile(s.id).progress, a = w(this, ue).size > 0;
4589
- this.setFileState(s.id, {
4590
- progress: {
4591
- ...i,
4592
- postprocess: a ? {
4593
- mode: "indeterminate"
4594
- } : void 0,
4595
- uploadComplete: !0,
4596
- ...!a && { complete: !0 },
4597
- percentage: 100,
4598
- bytesUploaded: i.bytesTotal
4599
- },
4600
- response: o,
4601
- uploadURL: o.uploadURL,
4602
- isPaused: !1
4603
- }), s.size == null && this.setFileState(s.id, {
4604
- size: o.bytesUploaded || i.bytesTotal
4605
- }), w(this, de).call(this);
4606
- }), this.on("preprocess-progress", (s, o) => {
4607
- if (s == null || !this.getFile(s.id)) {
4608
- this.log(`Not setting progress for a file that has been removed: ${s == null ? void 0 : s.id}`);
4609
- return;
4610
- }
4611
- this.setFileState(s.id, {
4612
- progress: { ...this.getFile(s.id).progress, preprocess: o }
4613
- });
4614
- }), this.on("preprocess-complete", (s) => {
4615
- if (s == null || !this.getFile(s.id)) {
4616
- this.log(`Not setting progress for a file that has been removed: ${s == null ? void 0 : s.id}`);
4617
- return;
4618
- }
4619
- const o = { ...this.getState().files };
4620
- o[s.id] = {
4621
- ...o[s.id],
4622
- progress: { ...o[s.id].progress }
4623
- }, delete o[s.id].progress.preprocess, this.setState({ files: o });
4624
- }), this.on("postprocess-progress", (s, o) => {
4625
- if (s == null || !this.getFile(s.id)) {
4626
- this.log(`Not setting progress for a file that has been removed: ${s == null ? void 0 : s.id}`);
4627
- return;
4628
- }
4629
- this.setFileState(s.id, {
4630
- progress: {
4631
- ...this.getState().files[s.id].progress,
4632
- postprocess: o
4633
- }
4634
- });
4635
- }), this.on("postprocess-complete", (s) => {
4636
- const o = s && this.getFile(s.id);
4637
- if (o == null) {
4638
- this.log(`Not setting progress for a file that has been removed: ${s == null ? void 0 : s.id}`);
4639
- return;
4640
- }
4641
- const { postprocess: i, ...a } = o.progress;
4642
- this.patchFilesState({
4643
- [o.id]: {
4644
- progress: {
4645
- ...a,
4646
- complete: !0
4647
- }
4648
- }
4649
- });
4650
- }), this.on("restored", () => {
4651
- w(this, de).call(this);
4652
- }), this.on("dashboard:file-edit-complete", (s) => {
4653
- s && F(this, y, ut).call(this, s);
4654
- }), typeof window < "u" && window.addEventListener && (window.addEventListener("online", w(this, se)), window.addEventListener("offline", w(this, se)), setTimeout(w(this, se), 3e3));
4655
- }, se = new WeakMap(), Ve = new WeakMap(), /**
4656
- * Create an upload for a bunch of files.
4657
- *
4658
- */
4659
- $e = function(e, n = {}) {
4660
- const { forceAllowNewUpload: r = !1 } = n, { allowNewUpload: s, currentUploads: o } = this.getState();
4661
- if (!s && !r)
4662
- throw new Error("Cannot create a new upload: already uploading.");
4663
- const i = ka();
4664
- return this.emit("upload", i, this.getFilesByIds(e)), this.setState({
4665
- allowNewUpload: this.opts.allowMultipleUploadBatches !== !1 && this.opts.allowMultipleUploads !== !1,
4666
- currentUploads: {
4667
- ...o,
4668
- [i]: {
4669
- fileIDs: e,
4670
- step: 0,
4671
- result: {}
4672
- }
4673
- }
4674
- }), i;
4675
- }, Rn = function(e) {
4676
- const { currentUploads: n } = this.getState();
4677
- return n[e];
4678
- }, /**
4679
- * Remove an upload, eg. if it has been canceled or completed.
4680
- *
4681
- */
4682
- ht = function(e) {
4683
- const { [e]: n, ...r } = this.getState().currentUploads;
4684
- this.setState({
4685
- currentUploads: r
4686
- });
4687
- }, Se = async function(e) {
4688
- const n = () => {
4689
- const { currentUploads: i } = this.getState();
4690
- return i[e];
4691
- };
4692
- let r = n();
4693
- if (!r)
4694
- throw new Error("Nonexistent upload");
4695
- const s = [
4696
- ...w(this, fe),
4697
- ...w(this, me),
4698
- ...w(this, ue)
4699
- ];
4700
- try {
4701
- for (let i = r.step || 0; i < s.length; i++) {
4702
- const a = s[i];
4703
- this.setState({
4704
- currentUploads: {
4705
- ...this.getState().currentUploads,
4706
- [e]: {
4707
- ...r,
4708
- step: i
4709
- }
4710
- }
4711
- });
4712
- const { fileIDs: l } = r;
4713
- if (await a(l, e), r = n(), !r)
4714
- break;
4715
- }
4716
- } catch (i) {
4717
- throw F(this, y, ht).call(this, e), i;
4718
- }
4719
- if (r) {
4720
- r.fileIDs.forEach((u) => {
4721
- const d = this.getFile(u);
4722
- d != null && d.progress.postprocess && this.emit("postprocess-complete", d);
4723
- });
4724
- const i = r.fileIDs.map((u) => this.getFile(u)), a = i.filter((u) => !u.error), l = i.filter((u) => u.error);
4725
- this.addResultData(e, { successful: a, failed: l, uploadID: e }), r = n();
4726
- }
4727
- let o;
4728
- return r && (o = r.result, F(this, y, ht).call(this, e)), o == null && (this.log(`Not setting result for an upload that has been removed: ${e}`), o = {
4729
- successful: [],
4730
- failed: [],
4731
- uploadID: e
4732
- }), o;
4733
- }, B(He, "VERSION", Ea.version);
4734
- let lt = He;
4735
- const Ua = {
4736
- key: 0,
4737
- class: "uppy-input-area--caption small text-body-secondary fst-italic"
4738
- }, pl = {
4739
- __name: "UppyInput",
4740
- props: {
4741
- name: { type: String, required: !0 },
4742
- multiple: { type: Boolean, default: !1 },
4743
- useXHR: { type: Boolean, default: !0 },
4744
- XHRConfig: { type: Object, default: {} },
4745
- url: { type: String, default: "/upload" },
4746
- config: { type: Object, default: () => ({}) },
4747
- errorHandler: { type: Function, default: null },
4748
- showRestrictionCaption: { type: Boolean, default: !0 }
4749
- },
4750
- emits: [
4751
- "update:modelValue",
4752
- "file-added",
4753
- "file-removed",
4754
- "beforeUpload",
4755
- "progress",
4756
- "upload",
4757
- "upload-progress",
4758
- "upload-error",
4759
- "upload-success",
4760
- "upload-pause",
4761
- "complete",
4762
- "error",
4763
- "upload-retry",
4764
- "upload-stalled",
4765
- "retry-all",
4766
- "cancel-all",
4767
- "restriction-failed"
4768
- ],
4769
- setup(t, { emit: e }) {
4770
- var Y;
4771
- const n = t, r = e, s = G(null), o = G(null), i = Yn(null), a = G(!1), l = G(!1), u = G(0), d = T("form", { value: {}, errors: {}, getID: (f) => f }), p = T("group", null), c = q({
4772
- get() {
4773
- var f;
4774
- return (f = p == null ? void 0 : p.value) != null && f.name ? p.value.getData(n.name) : d.value[n.name];
4775
- },
4776
- set(f) {
4777
- var _;
4778
- (_ = p == null ? void 0 : p.value) != null && _.name ? p.value.setData(n.name, f) : d.value[n.name] = f, r("update:modelValue", f);
4779
- }
4780
- });
4781
- i.value = new lt({
4782
- id: n.name,
4783
- autoProceed: !0,
4784
- ...n.config,
4785
- restrictions: {
4786
- maxNumberOfFiles: n.multiple ? null : 1,
4787
- ...((Y = n.config) == null ? void 0 : Y.restrictions) || {}
4788
- }
4789
- }), i.value.on("upload", () => {
4790
- u.value = i.value.getFiles().filter((f) => !f.progress.uploadComplete).length, r("upload");
4791
- }), i.value.on("before-upload", (f) => {
4792
- r("beforeUpload", f);
4793
- }), i.value.on("upload-success", (f, _) => {
4794
- u.value = Math.max(0, u.value - 1);
4795
- const $ = _.body ?? _;
4796
- if (n.multiple) {
4797
- const U = Array.isArray(c.value) ? c.value : [];
4798
- c.value = [...U, $];
4799
- } else
4800
- c.value = $;
4801
- r("upload-success", f, _);
4802
- }), i.value.on("file-added", (f) => r("file-added", f)), i.value.on("file-removed", (f) => {
4803
- var $;
4804
- const _ = (($ = f.response) == null ? void 0 : $.body) ?? f.response;
4805
- n.multiple && Array.isArray(c.value) ? c.value = c.value.filter((U) => JSON.stringify(U) !== JSON.stringify(_)) : c.value = null, _ && !a.value && !l.value && fetch(n.url, {
4806
- method: "DELETE",
4807
- headers: {
4808
- "X-Requested-With": "XMLHttpRequest",
4809
- "Content-Type": "application/json"
4810
- },
4811
- body: JSON.stringify(_)
4812
- }), r("file-removed", f);
4813
- }), i.value.on("progress", (f) => {
4814
- f <= 0 ? d.value.uploading = null : f >= 100 ? d.value.uploading = u.value > 0 ? 99 : null : d.value.uploading = f, r("progress", f);
4815
- }), i.value.on("upload-progress", (f, _) => r("upload-progress", f, _)), i.value.on("upload-pause", (f, _) => r("upload-pause", f, _)), i.value.on("cancel-all", () => r("cancel-all")), i.value.on("retry-all", () => r("retry-all")), i.value.on("upload-stalled", (f, _) => r("upload-stalled", f, _)), i.value.on("upload-retry", (f) => r("upload-retry", f)), i.value.on("complete", (f) => {
4816
- u.value = 0, d.value.uploading = null, r("complete", f);
4817
- }), i.value.on("error", (f) => {
4818
- r("error", f);
4819
- }), i.value.on("upload-error", (f, _, $) => {
4820
- var P;
4821
- u.value = Math.max(0, u.value - 1);
4822
- const U = ((P = JSON.parse($.response)) == null ? void 0 : P.message) ?? _;
4823
- v(U), r("upload-error", f, _, $, U);
4824
- }), i.value.on("restriction-failed", (f, _) => {
4825
- v(_.message), r("restriction-failed", f, _);
4826
- }), Fe(() => {
4827
- var f;
4828
- return (f = d.value) == null ? void 0 : f.wasSuccessful;
4829
- }, (f, _) => {
4830
- f === !0 && _ === !1 && h();
4831
- }), ye(() => {
4832
- var f, _, $, U, P, H, ne, D;
4833
- n.useXHR && import("./index-BRtKc2RA.js").then((X) => {
4834
- const pe = X.default;
4835
- i.value.use(pe, {
4836
- method: "POST",
4837
- endpoint: n.url,
4838
- headers: {
4839
- accept: "application/json"
4840
- },
4841
- ...n.XHRConfig
4842
- });
4843
- }), (_ = (f = i.value) == null ? void 0 : f.opts) != null && _.restrictions && (s.value = I(i.value.opts.restrictions)), o && ((H = (P = (U = ($ = i.value) == null ? void 0 : $.opts) == null ? void 0 : U.locale) == null ? void 0 : P.strings) != null && H.dropzoneText) && ((D = (ne = o.value) == null ? void 0 : ne.querySelectorAll('[data-uppy-element="dropzone"]>div>div>p')) == null || D.forEach((X) => {
4844
- var pe, Et, Ct, Vt;
4845
- X.innerHTML = (Vt = (Ct = (Et = (pe = i.value) == null ? void 0 : pe.opts) == null ? void 0 : Et.locale) == null ? void 0 : Ct.strings) == null ? void 0 : Vt.dropzoneText;
4846
- }));
4847
- }), gt(() => {
4848
- l.value = !0, i.value && i.value.destroy();
4849
- });
4850
- function h() {
4851
- i.value && (a.value = !0, i.value.cancelAll(), a.value = !1, c.value = n.multiple ? [] : null);
4852
- }
4853
- function v(f) {
4854
- n.errorHandler ? n.errorHandler(f) : f && M(f);
4855
- }
4856
- function M(f) {
4857
- if (typeof window < "u") {
4858
- const _ = document == null ? void 0 : document.createElement("div");
4859
- _.textContent = f, _.className = "uppy-error", o.value && (o.value.prepend(_), setTimeout(() => _.remove(), 3e3));
4860
- }
4861
- }
4862
- const A = ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
4863
- function k(f) {
4864
- let _ = 0, $ = parseInt(f, 10) || 0;
4865
- for (; $ >= 1024 && ++_; )
4866
- $ = $ / 1024;
4867
- return $.toFixed($ < 10 && _ > 0 ? 1 : 0) + A[_];
4868
- }
4869
- function I(f) {
4870
- if (!f) return "";
4871
- const {
4872
- allowedFileTypes: _,
4873
- maxFileSize: $,
4874
- minFileSize: U,
4875
- maxNumberOfFiles: P,
4876
- minNumberOfFiles: H,
4877
- maxTotalFileSize: ne
4878
- } = f, D = [];
4879
- if (_ && _.length) {
4880
- const X = _.map((pe) => pe.replace(".", "")).join("، ");
4881
- D.push(`فقط فایل‌های ${X}`);
4882
- }
4883
- return P && P > 1 && D.push(`امکان انتخاب حداکثر ${P} فایل`), H && D.push(`حداقل ${H} فایل نیاز است`), $ && D.push(`با حداکثر حجم ${k($)} برای هر فایل`), U && D.push(`با حداقل حجم ${k(U)} برای هر فایل`), ne && D.push(`و مجموع حجم کل حداکثر ${k(ne)}`), D.length ? D.join("، ") + " مجاز است." : "";
4884
- }
4885
- return (f, _) => i.value ? (m(), g("div", {
4886
- key: 0,
4887
- class: "uppy-input-area",
4888
- ref_key: "inputEl",
4889
- ref: o
4890
- }, [
4891
- Q(Je(Xi), {
4892
- name: "uu" + t.name,
4893
- uppy: i.value
4894
- }, {
4895
- default: ie(() => [
4896
- O(f.$slots, "default", { uppy: i.value }, () => [
4897
- Q(Je(Ki), { class: "uppy-file-lists" }),
4898
- Q(Je(Zi), { class: "uppy-drop-zone" })
4899
- ])
4900
- ]),
4901
- _: 3
4902
- }, 8, ["name", "uppy"]),
4903
- s.value ? (m(), g("div", Ua, W(s.value), 1)) : j("", !0)
4904
- ], 512)) : j("", !0);
4905
- }
4906
- };
4907
- export {
4908
- Ba as A,
4909
- ja as C,
4910
- Xa as E,
4911
- Ya as F,
4912
- ws as G,
4913
- Ja as L,
4914
- Qa as M,
4915
- al as O,
4916
- Ga as P,
4917
- Bs as Q,
4918
- dl as R,
4919
- Ha as S,
4920
- so as T,
4921
- ll as _,
4922
- La as a,
4923
- qa as b,
4924
- xa as c,
4925
- Wa as d,
4926
- ul as e,
4927
- pl as f,
4928
- Za as g,
4929
- el as h,
4930
- tl as i,
4931
- sl as j,
4932
- rl as k,
4933
- nl as l,
4934
- Ka as m,
4935
- il as n,
4936
- ol as o,
4937
- We as p
4938
- };