inertia-bootstrap-forms 1.0.71 → 1.0.72
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.
|
@@ -294,7 +294,7 @@ var Zc = function(t, e) {
|
|
|
294
294
|
function Qc(t) {
|
|
295
295
|
var e, i = t.state, n = t.name, r = t.options, s = i.elements.arrow, o = i.modifiersData.popperOffsets, a = lt(i.placement), l = cs(a), u = [Ie, He].indexOf(a) >= 0, c = u ? "height" : "width";
|
|
296
296
|
if (!(!s || !o)) {
|
|
297
|
-
var d = Zc(r.padding, i), p = us(s), _ = l === "y" ? ke : Ie, h = l === "y" ? Re : He, f = i.rects.reference[c] + i.rects.reference[l] - o[l] - i.rects.popper[c], g = o[l] - i.rects.reference[l], m = on(s), b = m ? l === "y" ? m.clientHeight || 0 : m.clientWidth || 0 : 0,
|
|
297
|
+
var d = Zc(r.padding, i), p = us(s), _ = l === "y" ? ke : Ie, h = l === "y" ? Re : He, f = i.rects.reference[c] + i.rects.reference[l] - o[l] - i.rects.popper[c], g = o[l] - i.rects.reference[l], m = on(s), b = m ? l === "y" ? m.clientHeight || 0 : m.clientWidth || 0 : 0, S = f / 2 - g / 2, E = d[_], w = b - p[c] - d[h], y = b / 2 - p[c] / 2 + S, $ = Ki(E, y, w), F = l;
|
|
298
298
|
i.modifiersData[n] = (e = {}, e[F] = $, e.centerOffset = $ - y, e);
|
|
299
299
|
}
|
|
300
300
|
}
|
|
@@ -336,20 +336,20 @@ function js(t) {
|
|
|
336
336
|
y: f
|
|
337
337
|
};
|
|
338
338
|
_ = g.x, f = g.y;
|
|
339
|
-
var m = o.hasOwnProperty("x"), b = o.hasOwnProperty("y"),
|
|
339
|
+
var m = o.hasOwnProperty("x"), b = o.hasOwnProperty("y"), S = Ie, E = ke, w = window;
|
|
340
340
|
if (u) {
|
|
341
341
|
var y = on(i), $ = "clientHeight", F = "clientWidth";
|
|
342
342
|
if (y === Be(i) && (y = Mt(i), _t(y).position !== "static" && a === "absolute" && ($ = "scrollHeight", F = "scrollWidth")), y = y, r === ke || (r === Ie || r === He) && s === gi) {
|
|
343
343
|
E = Re;
|
|
344
|
-
var P = d && y ===
|
|
344
|
+
var P = d && y === w && w.visualViewport ? w.visualViewport.height : (
|
|
345
345
|
// $FlowFixMe[prop-missing]
|
|
346
346
|
y[$]
|
|
347
347
|
);
|
|
348
348
|
f -= P - n.height, f *= l ? 1 : -1;
|
|
349
349
|
}
|
|
350
350
|
if (r === Ie || (r === ke || r === Re) && s === gi) {
|
|
351
|
-
|
|
352
|
-
var B = d && y ===
|
|
351
|
+
S = He;
|
|
352
|
+
var B = d && y === w && w.visualViewport ? w.visualViewport.width : (
|
|
353
353
|
// $FlowFixMe[prop-missing]
|
|
354
354
|
y[F]
|
|
355
355
|
);
|
|
@@ -367,9 +367,9 @@ function js(t) {
|
|
|
367
367
|
};
|
|
368
368
|
if (_ = K.x, f = K.y, l) {
|
|
369
369
|
var ne;
|
|
370
|
-
return Object.assign({}, L, (ne = {}, ne[E] = b ? "0" : "", ne[
|
|
370
|
+
return Object.assign({}, L, (ne = {}, ne[E] = b ? "0" : "", ne[S] = m ? "0" : "", ne.transform = (w.devicePixelRatio || 1) <= 1 ? "translate(" + _ + "px, " + f + "px)" : "translate3d(" + _ + "px, " + f + "px, 0)", ne));
|
|
371
371
|
}
|
|
372
|
-
return Object.assign({}, L, (e = {}, e[E] = b ? f + "px" : "", e[
|
|
372
|
+
return Object.assign({}, L, (e = {}, e[E] = b ? f + "px" : "", e[S] = m ? _ + "px" : "", e.transform = "", e));
|
|
373
373
|
}
|
|
374
374
|
function id(t) {
|
|
375
375
|
var e = t.state, i = t.options, n = i.gpuAcceleration, r = n === void 0 ? !0 : n, s = i.adaptive, o = s === void 0 ? !0 : s, a = i.roundOffsets, l = a === void 0 ? !0 : a, u = {
|
|
@@ -569,15 +569,15 @@ function cl(t) {
|
|
|
569
569
|
}
|
|
570
570
|
function yi(t, e) {
|
|
571
571
|
e === void 0 && (e = {});
|
|
572
|
-
var i = e, n = i.placement, r = n === void 0 ? t.placement : n, s = i.strategy, o = s === void 0 ? t.strategy : s, a = i.boundary, l = a === void 0 ? qa : a, u = i.rootBoundary, c = u === void 0 ? ss : u, d = i.elementContext, p = d === void 0 ? oi : d, _ = i.altBoundary, h = _ === void 0 ? !1 : _, f = i.padding, g = f === void 0 ? 0 : f, m = ol(typeof g != "number" ? g : al(g, Oi)), b = p === oi ? Ka : oi,
|
|
572
|
+
var i = e, n = i.placement, r = n === void 0 ? t.placement : n, s = i.strategy, o = s === void 0 ? t.strategy : s, a = i.boundary, l = a === void 0 ? qa : a, u = i.rootBoundary, c = u === void 0 ? ss : u, d = i.elementContext, p = d === void 0 ? oi : d, _ = i.altBoundary, h = _ === void 0 ? !1 : _, f = i.padding, g = f === void 0 ? 0 : f, m = ol(typeof g != "number" ? g : al(g, Oi)), b = p === oi ? Ka : oi, S = t.rects.popper, E = t.elements[h ? b : p], w = cd(Zt(E) ? E : E.contextElement || Mt(t.elements.popper), l, c, o), y = vi(t.elements.reference), $ = cl({
|
|
573
573
|
reference: y,
|
|
574
|
-
element:
|
|
574
|
+
element: S,
|
|
575
575
|
placement: r
|
|
576
|
-
}), F = Ir(Object.assign({},
|
|
577
|
-
top:
|
|
578
|
-
bottom: P.bottom -
|
|
579
|
-
left:
|
|
580
|
-
right: P.right -
|
|
576
|
+
}), F = Ir(Object.assign({}, S, $)), P = p === oi ? F : y, B = {
|
|
577
|
+
top: w.top - P.top + m.top,
|
|
578
|
+
bottom: P.bottom - w.bottom + m.bottom,
|
|
579
|
+
left: w.left - P.left + m.left,
|
|
580
|
+
right: P.right - w.right + m.right
|
|
581
581
|
}, L = t.modifiersData.offset;
|
|
582
582
|
if (p === oi && L) {
|
|
583
583
|
var K = L[r];
|
|
@@ -617,7 +617,7 @@ function fd(t) {
|
|
|
617
617
|
function hd(t) {
|
|
618
618
|
var e = t.state, i = t.options, n = t.name;
|
|
619
619
|
if (!e.modifiersData[n]._skip) {
|
|
620
|
-
for (var r = i.mainAxis, s = r === void 0 ? !0 : r, o = i.altAxis, a = o === void 0 ? !0 : o, l = i.fallbackPlacements, u = i.padding, c = i.boundary, d = i.rootBoundary, p = i.altBoundary, _ = i.flipVariations, h = _ === void 0 ? !0 : _, f = i.allowedAutoPlacements, g = e.options.placement, m = lt(g), b = m === g,
|
|
620
|
+
for (var r = i.mainAxis, s = r === void 0 ? !0 : r, o = i.altAxis, a = o === void 0 ? !0 : o, l = i.fallbackPlacements, u = i.padding, c = i.boundary, d = i.rootBoundary, p = i.altBoundary, _ = i.flipVariations, h = _ === void 0 ? !0 : _, f = i.allowedAutoPlacements, g = e.options.placement, m = lt(g), b = m === g, S = l || (b || !h ? [wn(g)] : fd(g)), E = [g].concat(S).reduce(function(Ce, ye) {
|
|
621
621
|
return Ce.concat(lt(ye) === zn ? dd(e, {
|
|
622
622
|
placement: ye,
|
|
623
623
|
boundary: c,
|
|
@@ -626,7 +626,7 @@ function hd(t) {
|
|
|
626
626
|
flipVariations: h,
|
|
627
627
|
allowedAutoPlacements: f
|
|
628
628
|
}) : ye);
|
|
629
|
-
}, []),
|
|
629
|
+
}, []), w = e.rects.reference, y = e.rects.popper, $ = /* @__PURE__ */ new Map(), F = !0, P = E[0], B = 0; B < E.length; B++) {
|
|
630
630
|
var L = E[B], K = lt(L), ne = bi(L) === Xt, Y = [ke, Re].indexOf(K) >= 0, le = Y ? "width" : "height", re = yi(e, {
|
|
631
631
|
placement: L,
|
|
632
632
|
boundary: c,
|
|
@@ -634,7 +634,7 @@ function hd(t) {
|
|
|
634
634
|
altBoundary: p,
|
|
635
635
|
padding: u
|
|
636
636
|
}), be = Y ? ne ? He : Ie : ne ? Re : ke;
|
|
637
|
-
|
|
637
|
+
w[le] > y[le] && (be = wn(be));
|
|
638
638
|
var tt = wn(be), Ne = [];
|
|
639
639
|
if (s && Ne.push(re[K] <= 0), a && Ne.push(re[be] <= 0, re[tt] <= 0), Ne.every(function(Ce) {
|
|
640
640
|
return Ce;
|
|
@@ -760,7 +760,7 @@ function bd(t) {
|
|
|
760
760
|
rootBoundary: u,
|
|
761
761
|
padding: d,
|
|
762
762
|
altBoundary: c
|
|
763
|
-
}), m = lt(e.placement), b = bi(e.placement),
|
|
763
|
+
}), m = lt(e.placement), b = bi(e.placement), S = !b, E = cs(m), w = vd(E), y = e.modifiersData.popperOffsets, $ = e.rects.reference, F = e.rects.popper, P = typeof f == "function" ? f(Object.assign({}, e.rects, {
|
|
764
764
|
placement: e.placement
|
|
765
765
|
})) : f, B = typeof P == "number" ? {
|
|
766
766
|
mainAxis: P,
|
|
@@ -777,12 +777,12 @@ function bd(t) {
|
|
|
777
777
|
var ne, Y = E === "y" ? ke : Ie, le = E === "y" ? Re : He, re = E === "y" ? "height" : "width", be = y[E], tt = be + g[Y], Ne = be - g[le], Te = _ ? -F[re] / 2 : 0, xe = b === Xt ? $[re] : F[re], Ue = b === Xt ? -F[re] : -$[re], C = e.elements.arrow, Ce = _ && C ? us(C) : {
|
|
778
778
|
width: 0,
|
|
779
779
|
height: 0
|
|
780
|
-
}, ye = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : sl(), wt = ye[Y], St = ye[le], ze = Ki(0, $[re], Ce[re]), Pi =
|
|
780
|
+
}, ye = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : sl(), wt = ye[Y], St = ye[le], ze = Ki(0, $[re], Ce[re]), Pi = S ? $[re] / 2 - Te - ze - wt - B.mainAxis : xe - ze - wt - B.mainAxis, Mi = S ? -$[re] / 2 + Te + ze + St + B.mainAxis : Ue + ze + St + B.mainAxis, Dt = e.elements.arrow && on(e.elements.arrow), $i = Dt ? E === "y" ? Dt.clientTop || 0 : Dt.clientLeft || 0 : 0, it = (ne = L == null ? void 0 : L[E]) != null ? ne : 0, Ye = be + Pi - it - $i, ft = be + Mi - it, Fe = Ki(_ ? Mn(tt, Ye) : tt, be, _ ? Gt(Ne, ft) : Ne);
|
|
781
781
|
y[E] = Fe, K[E] = Fe - be;
|
|
782
782
|
}
|
|
783
783
|
if (a) {
|
|
784
|
-
var ht, Di = E === "x" ? ke : Ie, Ni = E === "x" ? Re : He, se = y[
|
|
785
|
-
y[
|
|
784
|
+
var ht, Di = E === "x" ? ke : Ie, Ni = E === "x" ? Re : He, se = y[w], Le = w === "y" ? "height" : "width", nt = se + g[Di], Li = se - g[Ni], Pe = [ke, Ie].indexOf(m) !== -1, an = (ht = L == null ? void 0 : L[w]) != null ? ht : 0, ln = Pe ? nt : se - $[Le] - F[Le] - an + B.altAxis, ni = Pe ? se + $[Le] + F[Le] - an - B.altAxis : Li, Vi = _ && Pe ? Xc(ln, se, ni) : Ki(_ ? ln : nt, se, _ ? ni : Li);
|
|
785
|
+
y[w] = Vi, K[w] = Vi - se;
|
|
786
786
|
}
|
|
787
787
|
e.modifiersData[n] = K;
|
|
788
788
|
}
|
|
@@ -934,7 +934,7 @@ function Kn(t) {
|
|
|
934
934
|
u.reset = !1, b = -1;
|
|
935
935
|
continue;
|
|
936
936
|
}
|
|
937
|
-
var
|
|
937
|
+
var S = u.orderedModifiers[b], E = S.fn, w = S.options, y = w === void 0 ? {} : w, $ = S.name;
|
|
938
938
|
typeof E == "function" && (u = E({
|
|
939
939
|
state: u,
|
|
940
940
|
options: y,
|
|
@@ -963,16 +963,16 @@ function Kn(t) {
|
|
|
963
963
|
});
|
|
964
964
|
function _() {
|
|
965
965
|
u.orderedModifiers.forEach(function(f) {
|
|
966
|
-
var g = f.name, m = f.options, b = m === void 0 ? {} : m,
|
|
967
|
-
if (typeof
|
|
968
|
-
var E =
|
|
966
|
+
var g = f.name, m = f.options, b = m === void 0 ? {} : m, S = f.effect;
|
|
967
|
+
if (typeof S == "function") {
|
|
968
|
+
var E = S({
|
|
969
969
|
state: u,
|
|
970
970
|
name: g,
|
|
971
971
|
instance: p,
|
|
972
972
|
options: b
|
|
973
|
-
}),
|
|
973
|
+
}), w = function() {
|
|
974
974
|
};
|
|
975
|
-
c.push(E ||
|
|
975
|
+
c.push(E || w);
|
|
976
976
|
}
|
|
977
977
|
});
|
|
978
978
|
}
|
|
@@ -4861,8 +4861,8 @@ function ug(t, e, i, {
|
|
|
4861
4861
|
}
|
|
4862
4862
|
}
|
|
4863
4863
|
h = -1;
|
|
4864
|
-
let b = [],
|
|
4865
|
-
const
|
|
4864
|
+
let b = [], S = 1, E = c + d;
|
|
4865
|
+
const w = 1 << c - 1;
|
|
4866
4866
|
for (let $ = 0; $ < c; $ += 1) {
|
|
4867
4867
|
let F = 0, P = E;
|
|
4868
4868
|
for (; F < P; )
|
|
@@ -4878,14 +4878,14 @@ function ug(t, e, i, {
|
|
|
4878
4878
|
K[L + 1] = (1 << $) - 1;
|
|
4879
4879
|
for (let Y = L; Y >= B; Y -= 1) {
|
|
4880
4880
|
let le = Y - 1, re = i[t.charAt(le)];
|
|
4881
|
-
if (f && (g[le] = +!!re), K[Y] = (K[Y + 1] << 1 | 1) & re, $ && (K[Y] |= (b[Y + 1] | b[Y]) << 1 | 1 | b[Y + 1]), K[Y] &
|
|
4881
|
+
if (f && (g[le] = +!!re), K[Y] = (K[Y + 1] << 1 | 1) & re, $ && (K[Y] |= (b[Y + 1] | b[Y]) << 1 | 1 | b[Y + 1]), K[Y] & w && (S = mn(e, {
|
|
4882
4882
|
errors: $,
|
|
4883
4883
|
currentLocation: le,
|
|
4884
4884
|
expectedLocation: p,
|
|
4885
4885
|
distance: r,
|
|
4886
4886
|
ignoreLocation: u
|
|
4887
|
-
}),
|
|
4888
|
-
if (_ =
|
|
4887
|
+
}), S <= _)) {
|
|
4888
|
+
if (_ = S, h = le, h <= p)
|
|
4889
4889
|
break;
|
|
4890
4890
|
B = Math.max(1, 2 * p - h);
|
|
4891
4891
|
}
|
|
@@ -4903,7 +4903,7 @@ function ug(t, e, i, {
|
|
|
4903
4903
|
const y = {
|
|
4904
4904
|
isMatch: h >= 0,
|
|
4905
4905
|
// Count exact matches (those with a score of 0) to be "almost" exact
|
|
4906
|
-
score: Math.max(1e-3,
|
|
4906
|
+
score: Math.max(1e-3, S)
|
|
4907
4907
|
};
|
|
4908
4908
|
if (f) {
|
|
4909
4909
|
const $ = lg(g, a);
|
|
@@ -4989,7 +4989,7 @@ class Gl {
|
|
|
4989
4989
|
const {
|
|
4990
4990
|
isMatch: m,
|
|
4991
4991
|
score: b,
|
|
4992
|
-
indices:
|
|
4992
|
+
indices: S
|
|
4993
4993
|
} = ug(e, h, f, {
|
|
4994
4994
|
location: r + g,
|
|
4995
4995
|
distance: s,
|
|
@@ -4999,7 +4999,7 @@ class Gl {
|
|
|
4999
4999
|
includeMatches: n,
|
|
5000
5000
|
ignoreLocation: u
|
|
5001
5001
|
});
|
|
5002
|
-
m && (p = !0), d += b, m &&
|
|
5002
|
+
m && (p = !0), d += b, m && S && (c = [...c, ...S]);
|
|
5003
5003
|
});
|
|
5004
5004
|
let _ = {
|
|
5005
5005
|
isMatch: p,
|
|
@@ -5716,8 +5716,8 @@ var Pg = function(t) {
|
|
|
5716
5716
|
if (e.labelDescription) {
|
|
5717
5717
|
var b = "".concat(e.elementId, "-description");
|
|
5718
5718
|
g.setAttribute("aria-describedby", b);
|
|
5719
|
-
var
|
|
5720
|
-
pt(
|
|
5719
|
+
var S = document.createElement("span");
|
|
5720
|
+
pt(S, r, e.labelDescription), S.id = b, x(S, d), f.appendChild(S);
|
|
5721
5721
|
}
|
|
5722
5722
|
return e.selected && x(f, u), e.placeholder && x(f, p), f.setAttribute("role", e.group ? "treeitem" : "option"), f.dataset.choice = "", f.dataset.id = e.id, f.dataset.value = h, i && (f.dataset.selectText = i), e.group && (f.dataset.groupId = "".concat(e.group.id)), mr(f, e, !1), e.disabled ? (x(f, c), f.dataset.choiceDisabled = "", f.setAttribute("aria-disabled", "true")) : (x(f, l), f.dataset.choiceSelectable = ""), f;
|
|
5723
5723
|
},
|
|
@@ -6029,9 +6029,9 @@ var Pg = function(t) {
|
|
|
6029
6029
|
}, p = !1, _ = function(h, f, g) {
|
|
6030
6030
|
r ? h.sort(Em) : n.shouldSort && h.sort(n.sorter);
|
|
6031
6031
|
var m = h.length;
|
|
6032
|
-
m = !f && l && m > l ? l : m, m--, h.every(function(b,
|
|
6032
|
+
m = !f && l && m > l ? l : m, m--, h.every(function(b, S) {
|
|
6033
6033
|
var E = b.choiceEl || e._templates.choice(n, b, n.itemSelectText, g);
|
|
6034
|
-
return b.choiceEl = E, c.appendChild(E), (r || !b.selected) && (p = !0),
|
|
6034
|
+
return b.choiceEl = E, c.appendChild(E), (r || !b.selected) && (p = !0), S < m;
|
|
6035
6035
|
});
|
|
6036
6036
|
};
|
|
6037
6037
|
a.length && (n.resetScrollPosition && requestAnimationFrame(function() {
|
|
@@ -7780,7 +7780,7 @@ function $1(t, e = {}) {
|
|
|
7780
7780
|
function h(g, m = {}) {
|
|
7781
7781
|
c = g;
|
|
7782
7782
|
const b = l = {};
|
|
7783
|
-
return t == null || m.hard || f.stiffness >= 1 && f.damping >= 1 ? (_ = !0, o = Mo(), u = g, i.set(t = c), Promise.resolve()) : (m.soft && (p = 1 / ((m.soft === !0 ? 0.5 : +m.soft) * 60), d = 0), a || (o = Mo(), _ = !1, a = p1((
|
|
7783
|
+
return t == null || m.hard || f.stiffness >= 1 && f.damping >= 1 ? (_ = !0, o = Mo(), u = g, i.set(t = c), Promise.resolve()) : (m.soft && (p = 1 / ((m.soft === !0 ? 0.5 : +m.soft) * 60), d = 0), a || (o = Mo(), _ = !1, a = p1((S) => {
|
|
7784
7784
|
if (_)
|
|
7785
7785
|
return _ = !1, a = null, !1;
|
|
7786
7786
|
d = Math.min(d + p, 1);
|
|
@@ -7788,12 +7788,12 @@ function $1(t, e = {}) {
|
|
|
7788
7788
|
inv_mass: d,
|
|
7789
7789
|
opts: f,
|
|
7790
7790
|
settled: !0,
|
|
7791
|
-
dt: (
|
|
7792
|
-
},
|
|
7793
|
-
return o =
|
|
7794
|
-
})), new Promise((
|
|
7791
|
+
dt: (S - o) * 60 / 1e3
|
|
7792
|
+
}, w = Br(E, u, t, c);
|
|
7793
|
+
return o = S, u = t, i.set(t = w), E.settled && (a = null), !E.settled;
|
|
7794
|
+
})), new Promise((S) => {
|
|
7795
7795
|
a.promise.then(() => {
|
|
7796
|
-
b === l &&
|
|
7796
|
+
b === l && S();
|
|
7797
7797
|
});
|
|
7798
7798
|
}));
|
|
7799
7799
|
}
|
|
@@ -8637,7 +8637,7 @@ function j1(t) {
|
|
|
8637
8637
|
}
|
|
8638
8638
|
const Jo = 500;
|
|
8639
8639
|
function R1(t, e, i) {
|
|
8640
|
-
let n, r, { range: s = !1 } = e, { min: o = 0 } = e, { max: a = 100 } = e, { step: l = 1 } = e, { value: u = (a + o) / 2 } = e, { values: c = [u] } = e, { vertical: d = !1 } = e, { reversed: p = !1 } = e, { hoverable: _ = !0 } = e, { disabled: h = !1 } = e, { limits: f = null } = e, { pipstep: g = void 0 } = e, { all: m = !0 } = e, { first: b = void 0 } = e, { last:
|
|
8640
|
+
let n, r, { range: s = !1 } = e, { min: o = 0 } = e, { max: a = 100 } = e, { step: l = 1 } = e, { value: u = (a + o) / 2 } = e, { values: c = [u] } = e, { vertical: d = !1 } = e, { reversed: p = !1 } = e, { hoverable: _ = !0 } = e, { disabled: h = !1 } = e, { limits: f = null } = e, { pipstep: g = void 0 } = e, { all: m = !0 } = e, { first: b = void 0 } = e, { last: S = void 0 } = e, { rest: E = void 0 } = e, { prefix: w = "" } = e, { suffix: y = "" } = e, { formatter: $ = (C, Ce, ye) => C } = e, { precision: F = 2 } = e, { focus: P } = e, { orientationStart: B } = e, { moveHandle: L } = e, K = null, ne = 0, Y = 1;
|
|
8641
8641
|
function le(C) {
|
|
8642
8642
|
K = ci(C);
|
|
8643
8643
|
}
|
|
@@ -8659,7 +8659,7 @@ function R1(t, e, i) {
|
|
|
8659
8659
|
re(a, C);
|
|
8660
8660
|
};
|
|
8661
8661
|
return t.$$set = (C) => {
|
|
8662
|
-
"range" in C && i(0, s = C.range), "min" in C && i(1, o = C.min), "max" in C && i(2, a = C.max), "step" in C && i(3, l = C.step), "value" in C && i(24, u = C.value), "values" in C && i(4, c = C.values), "vertical" in C && i(5, d = C.vertical), "reversed" in C && i(6, p = C.reversed), "hoverable" in C && i(7, _ = C.hoverable), "disabled" in C && i(8, h = C.disabled), "limits" in C && i(9, f = C.limits), "pipstep" in C && i(25, g = C.pipstep), "all" in C && i(10, m = C.all), "first" in C && i(11, b = C.first), "last" in C && i(12,
|
|
8662
|
+
"range" in C && i(0, s = C.range), "min" in C && i(1, o = C.min), "max" in C && i(2, a = C.max), "step" in C && i(3, l = C.step), "value" in C && i(24, u = C.value), "values" in C && i(4, c = C.values), "vertical" in C && i(5, d = C.vertical), "reversed" in C && i(6, p = C.reversed), "hoverable" in C && i(7, _ = C.hoverable), "disabled" in C && i(8, h = C.disabled), "limits" in C && i(9, f = C.limits), "pipstep" in C && i(25, g = C.pipstep), "all" in C && i(10, m = C.all), "first" in C && i(11, b = C.first), "last" in C && i(12, S = C.last), "rest" in C && i(13, E = C.rest), "prefix" in C && i(14, w = C.prefix), "suffix" in C && i(15, y = C.suffix), "formatter" in C && i(16, $ = C.formatter), "precision" in C && i(17, F = C.precision), "focus" in C && i(18, P = C.focus), "orientationStart" in C && i(19, B = C.orientationStart), "moveHandle" in C && i(26, L = C.moveHandle);
|
|
8663
8663
|
}, t.$$.update = () => {
|
|
8664
8664
|
if (t.$$.dirty[0] & /*vertical*/
|
|
8665
8665
|
32 && i(27, n = d ? 50 : 100), t.$$.dirty[0] & /*max, min, step, stepMax*/
|
|
@@ -8680,9 +8680,9 @@ function R1(t, e, i) {
|
|
|
8680
8680
|
f,
|
|
8681
8681
|
m,
|
|
8682
8682
|
b,
|
|
8683
|
-
w,
|
|
8684
|
-
E,
|
|
8685
8683
|
S,
|
|
8684
|
+
E,
|
|
8685
|
+
w,
|
|
8686
8686
|
y,
|
|
8687
8687
|
$,
|
|
8688
8688
|
F,
|
|
@@ -9384,7 +9384,7 @@ function B1(t) {
|
|
|
9384
9384
|
), b = (
|
|
9385
9385
|
/*suffix*/
|
|
9386
9386
|
t[26] && ua(t)
|
|
9387
|
-
),
|
|
9387
|
+
), S = (
|
|
9388
9388
|
/*prefix*/
|
|
9389
9389
|
t[25] && ca(t)
|
|
9390
9390
|
), E = (
|
|
@@ -9393,24 +9393,24 @@ function B1(t) {
|
|
|
9393
9393
|
);
|
|
9394
9394
|
return {
|
|
9395
9395
|
c() {
|
|
9396
|
-
m && m.c(), e = ot(), i = new Qt(!1), r = ot(), b && b.c(), s = Oe(), a = ve(o), l = ve("-"), c = ve(u), d = Oe(),
|
|
9396
|
+
m && m.c(), e = ot(), i = new Qt(!1), r = ot(), b && b.c(), s = Oe(), a = ve(o), l = ve("-"), c = ve(u), d = Oe(), S && S.c(), p = ot(), _ = new Qt(!1), f = ot(), E && E.c(), g = ot(), i.a = r, _.a = f;
|
|
9397
9397
|
},
|
|
9398
|
-
m(
|
|
9399
|
-
m && m.m(
|
|
9398
|
+
m(w, y) {
|
|
9399
|
+
m && m.m(w, y), z(w, e, y), i.m(n, w, y), z(w, r, y), b && b.m(w, y), z(w, s, y), z(w, a, y), z(w, l, y), z(w, c, y), z(w, d, y), S && S.m(w, y), z(w, p, y), _.m(h, w, y), z(w, f, y), E && E.m(w, y), z(w, g, y);
|
|
9400
9400
|
},
|
|
9401
|
-
p(
|
|
9401
|
+
p(w, y) {
|
|
9402
9402
|
/*prefix*/
|
|
9403
|
-
|
|
9403
|
+
w[25] ? m ? m.p(w, y) : (m = la(w), m.c(), m.m(e.parentNode, e)) : m && (m.d(1), m = null), y[0] & /*reversed, range, max, values, min*/
|
|
9404
9404
|
67606 && n !== (n = /*first*/
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9405
|
+
w[31] + "") && i.p(n), /*suffix*/
|
|
9406
|
+
w[26] ? b ? b.p(w, y) : (b = ua(w), b.c(), b.m(s.parentNode, s)) : b && (b.d(1), b = null), /*prefix*/
|
|
9407
|
+
w[25] ? S ? S.p(w, y) : (S = ca(w), S.c(), S.m(p.parentNode, p)) : S && (S.d(1), S = null), y[0] & /*reversed, range, max, values, min*/
|
|
9408
9408
|
67606 && h !== (h = /*second*/
|
|
9409
|
-
|
|
9410
|
-
|
|
9409
|
+
w[102] + "") && _.p(h), /*suffix*/
|
|
9410
|
+
w[26] ? E ? E.p(w, y) : (E = da(w), E.c(), E.m(g.parentNode, g)) : E && (E.d(1), E = null);
|
|
9411
9411
|
},
|
|
9412
|
-
d(
|
|
9413
|
-
|
|
9412
|
+
d(w) {
|
|
9413
|
+
w && (U(e), U(r), i.d(), U(s), U(a), U(l), U(c), U(d), U(p), U(f), _.d(), U(g)), m && m.d(w), b && b.d(w), S && S.d(w), E && E.d(w);
|
|
9414
9414
|
}
|
|
9415
9415
|
};
|
|
9416
9416
|
}
|
|
@@ -10059,7 +10059,7 @@ function z1(t, e) {
|
|
|
10059
10059
|
function q1(t, e, i) {
|
|
10060
10060
|
let n, r, s, o, a = et, l = () => (a(), a = h1(Pe, (v) => i(42, o = v)), Pe);
|
|
10061
10061
|
t.$$.on_destroy.push(() => a());
|
|
10062
|
-
let { slider: u = void 0 } = e, { precision: c = 2 } = e, { range: d = !1 } = e, { pushy: p = !1 } = e, { draggy: _ = !1 } = e, { min: h = 0 } = e, { max: f = 100 } = e, { step: g = 1 } = e, { values: m = [_e((f + h) / 2, c)] } = e, { value: b = m[0] } = e, { vertical:
|
|
10062
|
+
let { slider: u = void 0 } = e, { precision: c = 2 } = e, { range: d = !1 } = e, { pushy: p = !1 } = e, { draggy: _ = !1 } = e, { min: h = 0 } = e, { max: f = 100 } = e, { step: g = 1 } = e, { values: m = [_e((f + h) / 2, c)] } = e, { value: b = m[0] } = e, { vertical: S = !1 } = e, { float: E = !1 } = e, { rangeFloat: w = !1 } = e, { reversed: y = !1 } = e, { hoverable: $ = !0 } = e, { disabled: F = !1 } = e, { limits: P = null } = e, { rangeGapMin: B = 0 } = e, { rangeGapMax: L = 1 / 0 } = e, { pips: K = !1 } = e, { pipstep: ne = void 0 } = e, { all: Y = !0 } = e, { first: le = void 0 } = e, { last: re = void 0 } = e, { rest: be = void 0 } = e, { prefix: tt = "" } = e, { suffix: Ne = "" } = e, { formatter: Te = (v, A, ee) => v } = e, { handleFormatter: xe = Te } = e, { rangeFormatter: Ue = null } = e, { ariaLabels: C = [] } = e, { id: Ce = void 0 } = e, { class: ye = "" } = e, { style: wt = void 0 } = e, { darkmode: St = !1 } = e, { springValues: ze = { stiffness: 0.15, damping: 0.4 } } = e, { spring: Pi = !0 } = e;
|
|
10063
10063
|
const Mi = S1();
|
|
10064
10064
|
let Dt = !1, $i = 0, it = !1, Ye = !1, ft = !1, Fe = !1, ht = !1, Di = [1, 1], Ni = !1, se = -1, Le = [], nt = [], Li = 0, Pe;
|
|
10065
10065
|
const an = () => {
|
|
@@ -10102,7 +10102,7 @@ function q1(t, e, i) {
|
|
|
10102
10102
|
return requestAnimationFrame(() => {
|
|
10103
10103
|
if (v) {
|
|
10104
10104
|
const A = v.getBoundingClientRect();
|
|
10105
|
-
i(37, Li =
|
|
10105
|
+
i(37, Li = S ? A.height : A.width);
|
|
10106
10106
|
}
|
|
10107
10107
|
});
|
|
10108
10108
|
}
|
|
@@ -10125,23 +10125,23 @@ function q1(t, e, i) {
|
|
|
10125
10125
|
}
|
|
10126
10126
|
function ec(v) {
|
|
10127
10127
|
if (!u) return 0;
|
|
10128
|
-
const { pointerVal: A } = gn(u, v,
|
|
10128
|
+
const { pointerVal: A } = gn(u, v, S, y, h, f);
|
|
10129
10129
|
let ee = 0;
|
|
10130
10130
|
return d === !0 && m[0] === m[1] ? A > m[1] ? ee = 1 : ee = 0 : ee = m.indexOf([...m].sort((we, Ve) => Math.abs(A - we) - Math.abs(A - Ve))[0]), ee;
|
|
10131
10131
|
}
|
|
10132
10132
|
function tr(v) {
|
|
10133
10133
|
if (!u || !Ye) return;
|
|
10134
|
-
const { pointerVal: A } = gn(u, v,
|
|
10134
|
+
const { pointerVal: A } = gn(u, v, S, y, h, f);
|
|
10135
10135
|
Et(se, A);
|
|
10136
10136
|
}
|
|
10137
10137
|
function tc(v) {
|
|
10138
10138
|
if (!u || !_ || !Fe || d === "min" || d === "max") return;
|
|
10139
|
-
const { pointerVal: A } = gn(u, v,
|
|
10139
|
+
const { pointerVal: A } = gn(u, v, S, y, h, f);
|
|
10140
10140
|
Di = [m[0] - A, m[1] - A];
|
|
10141
10141
|
}
|
|
10142
10142
|
function ic(v) {
|
|
10143
10143
|
if (!u || !_ || !Fe || d === "min" || d === "max") return;
|
|
10144
|
-
const { pointerVal: A } = gn(u, v,
|
|
10144
|
+
const { pointerVal: A } = gn(u, v, S, y, h, f);
|
|
10145
10145
|
i(36, se = -1), Et(0, A + Di[0], !1), Et(1, A + Di[1], !0);
|
|
10146
10146
|
}
|
|
10147
10147
|
function Et(v, A, ee = !0) {
|
|
@@ -10267,7 +10267,7 @@ function q1(t, e, i) {
|
|
|
10267
10267
|
});
|
|
10268
10268
|
}
|
|
10269
10269
|
return t.$$set = (v) => {
|
|
10270
|
-
"slider" in v && i(0, u = v.slider), "precision" in v && i(10, c = v.precision), "range" in v && i(11, d = v.range), "pushy" in v && i(59, p = v.pushy), "draggy" in v && i(12, _ = v.draggy), "min" in v && i(1, h = v.min), "max" in v && i(2, f = v.max), "step" in v && i(3, g = v.step), "values" in v && i(4, m = v.values), "value" in v && i(9, b = v.value), "vertical" in v && i(13,
|
|
10270
|
+
"slider" in v && i(0, u = v.slider), "precision" in v && i(10, c = v.precision), "range" in v && i(11, d = v.range), "pushy" in v && i(59, p = v.pushy), "draggy" in v && i(12, _ = v.draggy), "min" in v && i(1, h = v.min), "max" in v && i(2, f = v.max), "step" in v && i(3, g = v.step), "values" in v && i(4, m = v.values), "value" in v && i(9, b = v.value), "vertical" in v && i(13, S = v.vertical), "float" in v && i(14, E = v.float), "rangeFloat" in v && i(15, w = v.rangeFloat), "reversed" in v && i(16, y = v.reversed), "hoverable" in v && i(17, $ = v.hoverable), "disabled" in v && i(18, F = v.disabled), "limits" in v && i(19, P = v.limits), "rangeGapMin" in v && i(57, B = v.rangeGapMin), "rangeGapMax" in v && i(58, L = v.rangeGapMax), "pips" in v && i(20, K = v.pips), "pipstep" in v && i(21, ne = v.pipstep), "all" in v && i(22, Y = v.all), "first" in v && i(31, le = v.first), "last" in v && i(23, re = v.last), "rest" in v && i(24, be = v.rest), "prefix" in v && i(25, tt = v.prefix), "suffix" in v && i(26, Ne = v.suffix), "formatter" in v && i(5, Te = v.formatter), "handleFormatter" in v && i(6, xe = v.handleFormatter), "rangeFormatter" in v && i(7, Ue = v.rangeFormatter), "ariaLabels" in v && i(8, C = v.ariaLabels), "id" in v && i(27, Ce = v.id), "class" in v && i(28, ye = v.class), "style" in v && i(29, wt = v.style), "darkmode" in v && i(30, St = v.darkmode), "springValues" in v && i(60, ze = v.springValues), "spring" in v && i(61, Pi = v.spring);
|
|
10271
10271
|
}, t.$$.update = () => {
|
|
10272
10272
|
t.$$.dirty[0] & /*value*/
|
|
10273
10273
|
512 && an(), t.$$.dirty[0] & /*range, min, max, step, precision, limits, slider, values, value*/
|
|
@@ -10288,8 +10288,8 @@ function q1(t, e, i) {
|
|
|
10288
10288
|
128 && un(), t.$$.dirty[1] & /*springValues*/
|
|
10289
10289
|
536870912 && Zu(), t.$$.dirty[0] & /*range, values*/
|
|
10290
10290
|
2064 && i(41, n = d === !0 && m.length === 2 || (d === "min" || d === "max") && m.length === 1), t.$$.dirty[0] & /*vertical, reversed*/
|
|
10291
|
-
73728 && i(40, r =
|
|
10292
|
-
73728 && i(39, s =
|
|
10291
|
+
73728 && i(40, r = S ? y ? "top" : "bottom" : y ? "right" : "left"), t.$$.dirty[0] & /*vertical, reversed*/
|
|
10292
|
+
73728 && i(39, s = S ? y ? "bottom" : "top" : y ? "left" : "right");
|
|
10293
10293
|
}, [
|
|
10294
10294
|
u,
|
|
10295
10295
|
h,
|
|
@@ -10304,9 +10304,9 @@ function q1(t, e, i) {
|
|
|
10304
10304
|
c,
|
|
10305
10305
|
d,
|
|
10306
10306
|
_,
|
|
10307
|
-
w,
|
|
10308
|
-
E,
|
|
10309
10307
|
S,
|
|
10308
|
+
E,
|
|
10309
|
+
w,
|
|
10310
10310
|
y,
|
|
10311
10311
|
$,
|
|
10312
10312
|
F,
|
|
@@ -10786,8 +10786,8 @@ function Vn() {
|
|
|
10786
10786
|
Vn.__r = 0;
|
|
10787
10787
|
}
|
|
10788
10788
|
function bu(t, e, i, n, r, s, o, a, l, u, c) {
|
|
10789
|
-
var d, p, _, h, f, g, m, b = n && n.__k || _u,
|
|
10790
|
-
for (l = X1(i, e, b, l,
|
|
10789
|
+
var d, p, _, h, f, g, m, b = n && n.__k || _u, S = e.length;
|
|
10790
|
+
for (l = X1(i, e, b, l, S), d = 0; d < S; d++) (_ = i.__k[d]) != null && (p = _.__i == -1 ? Qi : b[_.__i] || Qi, _.__i = d, g = Os(t, _, p, r, s, o, a, l, u, c), h = _.__e, _.ref && p.ref != _.ref && (p.ref && Ts(p.ref, null, _), c.push(_.ref, _.__c || h, _)), f == null && h != null && (f = h), (m = !!(4 & _.__u)) || p.__k === _.__k ? l = yu(_, l, t, m) : typeof _.type == "function" && g !== void 0 ? l = g : h && (l = h.nextSibling), _.__u &= -7);
|
|
10791
10791
|
return i.__e = f, l;
|
|
10792
10792
|
}
|
|
10793
10793
|
function X1(t, e, i, n, r) {
|
|
@@ -10848,16 +10848,16 @@ function ga(t) {
|
|
|
10848
10848
|
};
|
|
10849
10849
|
}
|
|
10850
10850
|
function Os(t, e, i, n, r, s, o, a, l, u) {
|
|
10851
|
-
var c, d, p, _, h, f, g, m, b,
|
|
10851
|
+
var c, d, p, _, h, f, g, m, b, S, E, w, y, $, F, P, B, L = e.type;
|
|
10852
10852
|
if (e.constructor !== void 0) return null;
|
|
10853
10853
|
128 & i.__u && (l = !!(32 & i.__u), s = [a = e.__e = i.__e]), (c = te.__b) && c(e);
|
|
10854
10854
|
e: if (typeof L == "function") try {
|
|
10855
|
-
if (m = e.props, b = "prototype" in L && L.prototype.render,
|
|
10855
|
+
if (m = e.props, b = "prototype" in L && L.prototype.render, S = (c = L.contextType) && n[c.__c], E = c ? S ? S.props.value : c.__ : n, i.__c ? g = (d = e.__c = i.__c).__ = d.__E : (b ? e.__c = d = new L(m, E) : (e.__c = d = new In(m, E), d.constructor = L, d.render = J1), S && S.sub(d), d.state || (d.state = {}), d.__n = n, p = d.__d = !0, d.__h = [], d._sb = []), b && d.__s == null && (d.__s = d.state), b && L.getDerivedStateFromProps != null && (d.__s == d.state && (d.__s = gt({}, d.__s)), gt(d.__s, L.getDerivedStateFromProps(m, d.__s))), _ = d.props, h = d.state, d.__v = e, p) b && L.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), b && d.componentDidMount != null && d.__h.push(d.componentDidMount);
|
|
10856
10856
|
else {
|
|
10857
10857
|
if (b && L.getDerivedStateFromProps == null && m !== _ && d.componentWillReceiveProps != null && d.componentWillReceiveProps(m, E), e.__v == i.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(m, d.__s, E) === !1) {
|
|
10858
10858
|
for (e.__v != i.__v && (d.props = m, d.state = d.__s, d.__d = !1), e.__e = i.__e, e.__k = i.__k, e.__k.some(function(K) {
|
|
10859
10859
|
K && (K.__ = e);
|
|
10860
|
-
}),
|
|
10860
|
+
}), w = 0; w < d._sb.length; w++) d.__h.push(d._sb[w]);
|
|
10861
10861
|
d._sb = [], d.__h.length && o.push(d);
|
|
10862
10862
|
break e;
|
|
10863
10863
|
}
|
|
@@ -11879,13 +11879,13 @@ function Dv(t, e, i) {
|
|
|
11879
11879
|
function b(y) {
|
|
11880
11880
|
return a = void 0, p && n ? _(y) : (n = r = void 0, o);
|
|
11881
11881
|
}
|
|
11882
|
-
function
|
|
11882
|
+
function S() {
|
|
11883
11883
|
a !== void 0 && clearTimeout(a), u = 0, n = l = r = a = void 0;
|
|
11884
11884
|
}
|
|
11885
11885
|
function E() {
|
|
11886
11886
|
return a === void 0 ? o : b(Er());
|
|
11887
11887
|
}
|
|
11888
|
-
function
|
|
11888
|
+
function w() {
|
|
11889
11889
|
var y = Er(), $ = g(y);
|
|
11890
11890
|
if (n = arguments, r = this, l = y, $) {
|
|
11891
11891
|
if (a === void 0)
|
|
@@ -11895,7 +11895,7 @@ function Dv(t, e, i) {
|
|
|
11895
11895
|
}
|
|
11896
11896
|
return a === void 0 && (a = setTimeout(m, e)), o;
|
|
11897
11897
|
}
|
|
11898
|
-
return
|
|
11898
|
+
return w.cancel = S, w.flush = E, w;
|
|
11899
11899
|
}
|
|
11900
11900
|
var Nv = Dv, Lv = Nv, Vv = Ps, jv = "Expected a function";
|
|
11901
11901
|
function Rv(t, e, i) {
|
|
@@ -13135,16 +13135,16 @@ const Zv = {
|
|
|
13135
13135
|
}), o.value.on("upload-progress", (f, g) => n("upload-progress", f, g)), o.value.on("upload-pause", (f, g) => n("upload-pause", f, g)), o.value.on("cancel-all", () => n("cancel-all")), o.value.on("retry-all", () => n("retry-all")), o.value.on("upload-stalled", (f, g) => n("upload-stalled", f, g)), o.value.on("upload-retry", (f) => n("upload-retry", f)), o.value.on("complete", (f) => n("complete", f)), o.value.on("error", (f) => {
|
|
13136
13136
|
n("error", f);
|
|
13137
13137
|
}), o.value.on("upload-error", (f, g, m) => {
|
|
13138
|
-
var
|
|
13139
|
-
const b = ((
|
|
13138
|
+
var S;
|
|
13139
|
+
const b = ((S = JSON.parse(m.response)) == null ? void 0 : S.message) ?? g;
|
|
13140
13140
|
c(b), n("upload-error", f, g, m, b);
|
|
13141
13141
|
}), o.value.on("restriction-failed", (f, g) => {
|
|
13142
13142
|
c(g.message), n("restriction-failed", f, g);
|
|
13143
13143
|
}), sn(() => {
|
|
13144
|
-
var g, m
|
|
13144
|
+
var g, m;
|
|
13145
13145
|
let f;
|
|
13146
|
-
i.useXHR && import("./index-
|
|
13147
|
-
f =
|
|
13146
|
+
i.useXHR && import("./index-n4pmiUiF.js").then((b) => {
|
|
13147
|
+
f = b.default, o.value.use(f, {
|
|
13148
13148
|
method: "POST",
|
|
13149
13149
|
endpoint: i.url,
|
|
13150
13150
|
headers: {
|
|
@@ -13152,7 +13152,7 @@ const Zv = {
|
|
|
13152
13152
|
},
|
|
13153
13153
|
...i.XHRConfig
|
|
13154
13154
|
});
|
|
13155
|
-
}), (m = (g = o.value) == null ? void 0 : g.opts) != null && m.restrictions && (
|
|
13155
|
+
}), (m = (g = o.value) == null ? void 0 : g.opts) != null && m.restrictions && (r.value = _(o.value.opts.restrictions));
|
|
13156
13156
|
}), ja(() => {
|
|
13157
13157
|
o.value && o.value.destroy();
|
|
13158
13158
|
});
|
|
@@ -13172,15 +13172,15 @@ const Zv = {
|
|
|
13172
13172
|
allowedFileTypes: g,
|
|
13173
13173
|
maxFileSize: m,
|
|
13174
13174
|
minFileSize: b,
|
|
13175
|
-
maxNumberOfFiles:
|
|
13175
|
+
maxNumberOfFiles: S,
|
|
13176
13176
|
minNumberOfFiles: E,
|
|
13177
|
-
maxTotalFileSize:
|
|
13177
|
+
maxTotalFileSize: w
|
|
13178
13178
|
} = f, y = [];
|
|
13179
13179
|
if (g && g.length) {
|
|
13180
13180
|
const $ = g.map((F) => F.replace(".", "")).join("، ");
|
|
13181
13181
|
y.push(`فقط فایلهای ${$}`);
|
|
13182
13182
|
}
|
|
13183
|
-
return
|
|
13183
|
+
return S && y.push(`امکان انتخاب حداکثر ${S} فایل`), E && y.push(`حداقل ${E} فایل نیاز است`), m && y.push(`با حداکثر حجم ${p(m)} کیلوبایت برای هر فایل`), b && y.push(`با حداقل حجم ${p(b)} کیلوبایت برای هر فایل`), w && y.push(`و مجموع حجم کل حداکثر ${p(w)} کیلوبایت`), y.length ? y.join("، ") + " مجاز است." : "";
|
|
13184
13184
|
}
|
|
13185
13185
|
return (f, g) => o.value ? (I(), M("div", {
|
|
13186
13186
|
key: 0,
|
|
@@ -5,7 +5,7 @@ var et = (i) => {
|
|
|
5
5
|
var ct = (i, e, t) => e in i ? pt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
6
6
|
var y = (i, e, t) => ct(i, typeof e != "symbol" ? e + "" : e, t), G = (i, e, t) => e.has(i) || et("Cannot " + t);
|
|
7
7
|
var r = (i, e, t) => (G(i, e, "read from private field"), t ? t.call(i) : e.get(i)), m = (i, e, t) => e.has(i) ? et("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), c = (i, e, t, s) => (G(i, e, "write to private field"), s ? s.call(i, t) : e.set(i, t), t), g = (i, e, t) => (G(i, e, "access private method"), t);
|
|
8
|
-
import { T as mt } from "./index-
|
|
8
|
+
import { T as mt } from "./index-BzMXMMgb.js";
|
|
9
9
|
class K extends Error {
|
|
10
10
|
constructor(t, s = null) {
|
|
11
11
|
super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as n, C as s, a as u, b as p, c as o, _ as e, d as I, E as i, F as r, f as l, m as c, G as m, L as b, M as S, h as C, g as d, P as x, Q as g, R as h, j as k, l as y, S as F, k as P, i as T, n as A, o as B, p as E, e as L } from "./index-
|
|
1
|
+
import { A as n, C as s, a as u, b as p, c as o, _ as e, d as I, E as i, F as r, f as l, m as c, G as m, L as b, M as S, h as C, g as d, P as x, Q as g, R as h, j as k, l as y, S as F, k as P, i as T, n as A, o as B, p as E, e as L } from "./index-BzMXMMgb.js";
|
|
2
2
|
export {
|
|
3
3
|
n as AmountInput,
|
|
4
4
|
s as CaptchaInput,
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
* ${l.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:o.length}),details:a},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(o,a);{const l=new Error(a);throw l.errors=o,l}}this.setState({files:n}),i.forEach(a=>{this.emit("file-added",a)}),this.emit("files-added",i),i.length>5?this.log(`Added batch of ${i.length} files`):Object.values(i).forEach(a=>{this.log(`Added file: ${a.name}
|
|
17
17
|
id: ${a.id}
|
|
18
18
|
type: ${a.type}`)}),i.length>0&&V(this,L,Fs).call(this)}removeFiles(e){const{files:n,currentUploads:i}=this.getState(),r={...n},s={...i},o=Object.create(null);e.forEach(d=>{n[d]&&(o[d]=n[d],delete r[d])});function a(d){return o[d]===void 0}Object.keys(s).forEach(d=>{const f=i[d].fileIDs.filter(a);if(f.length===0){delete s[d];return}const{capabilities:p}=this.getState();if(f.length!==i[d].fileIDs.length&&!p.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");s[d]={...i[d],fileIDs:f}});const l={currentUploads:s,files:r};Object.keys(r).length===0&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),S(this,Yt).call(this);const c=Object.keys(o);c.forEach(d=>{this.emit("file-removed",o[d])}),c.length>5?this.log(`Removed ${c.length} files`):this.log(`Removed files: ${c.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;const n=this.getFile(e),r=!(n.isPaused||!1);return this.setFileState(e,{isPaused:r}),this.emit("upload-pause",n,r),r}pauseAll(){const e={...this.getState().files};Object.keys(e).filter(i=>!e[i].progress.uploadComplete&&e[i].progress.uploadStarted).forEach(i=>{const r={...e[i],isPaused:!0};e[i]=r}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){const e={...this.getState().files};Object.keys(e).filter(i=>!e[i].progress.uploadComplete&&e[i].progress.uploadStarted).forEach(i=>{const r={...e[i],isPaused:!1,error:null};e[i]=r}),this.setState({files:e}),this.emit("resume-all")}async retryAll(){const e=await V(this,L,Ms).call(this);return this.emit("complete",e),e}cancelAll(){this.emit("cancel-all");const{files:e}=this.getState(),n=Object.keys(e);n.length&&this.removeFiles(n),this.setState(Yi)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));const n=V(this,L,ui).call(this,[e],{forceAllowNewUpload:!0});return V(this,L,di).call(this,n)}logout(){this.iteratePlugins(e=>{var n,i;(i=(n=e.provider)==null?void 0:n.logout)==null||i.call(n)})}[Symbol.for("uppy test: updateTotalProgress")](){return V(this,L,Ds).call(this)}updateOnlineStatus(){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)}getID(){return this.opts.id}use(e,...n){if(typeof e!="function"){const o=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(o)}const i=new e(this,...n),r=i.id;if(!r)throw new Error("Your plugin must have an id");if(!i.type)throw new Error("Your plugin must have a type");const s=this.getPlugin(r);if(s){const o=`Already found a plugin named '${s.id}'. Tried to use: '${r}'.
|
|
19
|
-
Uppy plugins must have unique \`id\` options.`;throw new Error(o)}return e.VERSION&&this.log(`Using ${r} v${e.VERSION}`),i.type in S(this,ze)?S(this,ze)[i.type].push(i):S(this,ze)[i.type]=[i],i.install(),this.emit("plugin-added",i),this}getPlugin(e){for(const n of Object.values(S(this,ze))){const i=n.find(r=>r.id===e);if(i!=null)return i}}[Symbol.for("uppy test: getPlugins")](e){return S(this,ze)[e]}iteratePlugins(e){Object.values(S(this,ze)).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const n=S(this,ze)[e.type],i=n.findIndex(o=>o.id===e.id);i!==-1&&n.splice(i,1);const s={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(s)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),S(this,Qn).call(this),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",S(this,kt)),window.removeEventListener("offline",S(this,kt)))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,n="info",i=3e3){const r=typeof e=="object";this.setState({info:[...this.getState().info,{type:n,message:r?e.message:e,details:r?e.details:null}]}),setTimeout(()=>this.hideInfo(),i),this.emit("info-visible")}log(e,n){const{logger:i}=this.opts;switch(n){case"error":i.error(e);break;case"warning":i.warn(e);break;default:i.debug(e);break}}registerRequestClient(e,n){S(this,Zn).set(e,n)}getRequestClientForFile(e){if(!("remote"in e&&e.remote))throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const n=S(this,Zn).get(e.remote.requestClientId);if(n==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return n}async restore(e){this.log(`Core: Running restored upload "${e}"`);const n=await V(this,L,di).call(this,e);return this.emit("complete",n),n}[Symbol.for("uppy test: createUpload")](...e){return V(this,L,ui).call(this,...e)}addResultData(e,n){if(!V(this,L,nu).call(this,e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}const{currentUploads:i}=this.getState(),r={...i[e],result:{...i[e].result,...n}};this.setState({currentUploads:{...i,[e]:r}})}async upload(){var r;(r=S(this,ze).uploader)!=null&&r.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(V(this,L,Ps).call(this).length>0){const s=await V(this,L,Ms).call(this);if(!(this.getFiles().filter(a=>a.progress.uploadStarted==null).length>0))return this.emit("complete",s),s;({files:e}=this.getState())}const i=this.opts.onBeforeUpload(e);if(i===!1)throw new Error("Not starting the upload because onBeforeUpload returned false");i&&typeof i=="object"&&(e=i,this.setState({files:e}));try{if(S(this,qe).validateMinNumberOfFiles(e),!V(this,L,Qc).call(this,e))throw new xe(this.i18n("missingRequiredMetaField"));const{currentUploads:s}=this.getState(),o=Object.values(s).flatMap(d=>d.fileIDs),a=Object.keys(e).filter(d=>{const f=this.getFile(d);return f&&!f.progress.uploadStarted&&!o.includes(d)}),l=V(this,L,ui).call(this,a),c=await V(this,L,di).call(this,l);return this.emit("complete",c),c}catch(s){throw V(this,L,Zt).call(this,[s]),s}}};ze=new WeakMap,qe=new WeakMap,Qn=new WeakMap,Wt=new WeakMap,Tn=new WeakMap,Fn=new WeakMap,Gt=new WeakMap,L=new WeakSet,Zt=function(e){for(const o of e)o.isRestriction?this.emit("restriction-failed",o.file,o):this.emit("error",o,o.file),this.log(o,"warning");const n=e.filter(o=>o.isUserFacing),i=4,r=n.slice(0,i),s=n.slice(i);r.forEach(({message:o,details:a=""})=>{this.info({message:o,details:a},"error",this.opts.infoTimeout)}),s.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:s.length})})},Ts=function(e){const{missingFields:n,error:i}=S(this,qe).getMissingRequiredMetaFields(e);return n.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:n,error:i.message}),this.log(i.message),this.emit("restriction-failed",e,i),!1):(n.length===0&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)},Qc=function(e){let n=!0;for(const i of Object.values(e))V(this,L,Ts).call(this,i)||(n=!1);return n},Zc=function(e){const{allowNewUpload:n}=this.getState();if(n===!1){const i=new xe(this.i18n("noMoreFilesAllowed"),{file:e});throw V(this,L,Zt).call(this,[i]),i}},Jc=function(e){const n=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e,meta:{},isRemote:!1,source:void 0,preview:void 0}:e,i=Sc(n),r=X0(i,n),s=wc(r).extension,o=w_(n,this.getID()),a={...n.meta,name:r,type:i},l=Number.isFinite(n.data.size)?n.data.size:null;return{source:n.source||"",id:o,name:r,extension:s||"",meta:{...this.getState().meta,...a},type:i,progress:{percentage:0,bytesUploaded:!1,bytesTotal:l,uploadComplete:!1,uploadStarted:null},size:l,isGhost:!1,...n.isRemote?{isRemote:!0,remote:n.remote,data:n.data}:{isRemote:!1,data:n.data},preview:n.preview}},Fs=function(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))},Ns=function(e){let{files:n}=this.getState(),i={...n};const r=[],s=[];for(const o of e)try{let a=V(this,L,Jc).call(this,o);V(this,L,Zc).call(this,a);const l=n[a.id],c=l==null?void 0:l.isGhost;if(c&&!a.isRemote){if(a.data==null)throw new Error("File data is missing");a={...l,isGhost:!1,data:a.data},this.log(`Replaced the blob in the restored ghost file: ${a.name}, ${a.id}`)}const d=this.opts.onBeforeFileAdded(a,i);if(n=this.getState().files,i={...n,...i},!d&&this.checkIfFileAlreadyExists(a.id))throw new xe(this.i18n("noDuplicates",{fileName:a.name??this.i18n("unnamed")}),{file:a});if(d===!1&&!c)throw new xe("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:a});typeof d=="object"&&d!==null&&(a=d),S(this,qe).validateSingleFile(a),i[a.id]=a,r.push(a)}catch(a){s.push(a)}try{S(this,qe).validateAggregateRestrictions(Object.values(n),r)}catch(o){return s.push(o),{nextFilesState:n,validFilesToAdd:[],errors:s}}return{nextFilesState:i,validFilesToAdd:r,errors:s}},Ps=function(){const{files:e}=this.getState();return Object.keys(e).filter(n=>{const i=e[n];return i.error&&(!i.missingRequiredMetaFields||i.missingRequiredMetaFields.length===0)})},Ms=async function(){const e=V(this,L,Ps).call(this),n={...this.getState().files};if(e.forEach(r=>{n[r]={...n[r],isPaused:!1,error:null}}),this.setState({files:n,error:null}),this.emit("retry-all",this.getFilesByIds(e)),e.length===0)return{successful:[],failed:[]};const i=V(this,L,ui).call(this,e,{forceAllowNewUpload:!0});return V(this,L,di).call(this,i)},Zi=new WeakMap,Ds=function(){const e=V(this,L,eu).call(this);let n=null;e!=null&&(n=Math.round(e*100),n>100?n=100:n<0&&(n=0)),this.emit("progress",n??0),this.setState({totalProgress:n??0})},Yt=new WeakMap,eu=function(){const n=this.getFiles().filter(l=>l.progress.uploadStarted||l.progress.preprocess||l.progress.postprocess);if(n.length===0)return 0;if(n.every(l=>l.progress.uploadComplete))return 1;const i=l=>l.progress.bytesTotal!=null&&l.progress.bytesTotal!==0,r=n.filter(i),s=n.filter(l=>!i(l));if(r.every(l=>l.progress.uploadComplete)&&s.length>0&&!s.every(l=>l.progress.uploadComplete))return null;const o=r.reduce((l,c)=>l+(c.progress.bytesTotal??0),0),a=r.reduce((l,c)=>l+(c.progress.bytesUploaded||0),0);return o===0?0:a/o},tu=function(){const e=(r,s,o)=>{let a=r.message||"Unknown error";r.details&&(a+=` ${r.details}`),this.setState({error:a}),s!=null&&s.id in this.getState().files&&this.setFileState(s.id,{error:a,response:o})};this.on("error",e),this.on("upload-error",(r,s,o)=>{if(e(s,r,o),typeof s=="object"&&s.message){this.log(s.message,"error");const a=new Error(this.i18n("failedToUpload",{file:(r==null?void 0:r.name)??""}));a.isUserFacing=!0,a.details=s.message,s.details&&(a.details+=` ${s.details}`),V(this,L,Zt).call(this,[a])}else V(this,L,Zt).call(this,[s])});let n=null;this.on("upload-stalled",(r,s)=>{const{message:o}=r,a=s.map(l=>l.meta.name).join(", ");n||(this.info({message:o,details:a},"warning",this.opts.infoTimeout),n=setTimeout(()=>{n=null},this.opts.infoTimeout)),this.log(`${o} ${a}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const i=r=>{const s=r.filter(a=>{const l=a!=null&&this.getFile(a.id);return l||this.log(`Not setting progress for a file that has been removed: ${a==null?void 0:a.id}`),l}),o=Object.fromEntries(s.map(a=>[a.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:a.size}}]));this.patchFilesState(o)};this.on("upload-start",i),this.on("upload-progress",S(this,Zi)),this.on("upload-success",(r,s)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r==null?void 0:r.id}`);return}const o=this.getFile(r.id).progress,a=S(this,Gt).size>0;this.setFileState(r.id,{progress:{...o,postprocess:a?{mode:"indeterminate"}:void 0,uploadComplete:!0,...!a&&{complete:!0},percentage:100,bytesUploaded:o.bytesTotal},response:s,uploadURL:s.uploadURL,isPaused:!1}),r.size==null&&this.setFileState(r.id,{size:s.bytesUploaded||o.bytesTotal}),S(this,Yt).call(this)}),this.on("preprocess-progress",(r,s)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r==null?void 0:r.id}`);return}this.setFileState(r.id,{progress:{...this.getFile(r.id).progress,preprocess:s}})}),this.on("preprocess-complete",r=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r==null?void 0:r.id}`);return}const s={...this.getState().files};s[r.id]={...s[r.id],progress:{...s[r.id].progress}},delete s[r.id].progress.preprocess,this.setState({files:s})}),this.on("postprocess-progress",(r,s)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r==null?void 0:r.id}`);return}this.setFileState(r.id,{progress:{...this.getState().files[r.id].progress,postprocess:s}})}),this.on("postprocess-complete",r=>{const s=r&&this.getFile(r.id);if(s==null){this.log(`Not setting progress for a file that has been removed: ${r==null?void 0:r.id}`);return}const{postprocess:o,...a}=s.progress;this.patchFilesState({[s.id]:{progress:{...a,complete:!0}}})}),this.on("restored",()=>{S(this,Yt).call(this)}),this.on("dashboard:file-edit-complete",r=>{r&&V(this,L,Ts).call(this,r)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",S(this,kt)),window.addEventListener("offline",S(this,kt)),setTimeout(S(this,kt),3e3))},kt=new WeakMap,Zn=new WeakMap,ui=function(e,n={}){const{forceAllowNewUpload:i=!1}=n,{allowNewUpload:r,currentUploads:s}=this.getState();if(!r&&!i)throw new Error("Cannot create a new upload: already uploading.");const o=G0();return this.emit("upload",o,this.getFilesByIds(e)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...s,[o]:{fileIDs:e,step:0,result:{}}}}),o},nu=function(e){const{currentUploads:n}=this.getState();return n[e]},$s=function(e){const{[e]:n,...i}=this.getState().currentUploads;this.setState({currentUploads:i})},di=async function(e){const n=()=>{const{currentUploads:o}=this.getState();return o[e]};let i=n();if(!i)throw new Error("Nonexistent upload");const r=[...S(this,Tn),...S(this,Fn),...S(this,Gt)];try{for(let o=i.step||0;o<r.length;o++){const a=r[o];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...i,step:o}}});const{fileIDs:l}=i;if(await a(l,e),i=n(),!i)break}}catch(o){throw V(this,L,$s).call(this,e),o}if(i){i.fileIDs.forEach(c=>{const d=this.getFile(c);d!=null&&d.progress.postprocess&&this.emit("postprocess-complete",d)});const o=i.fileIDs.map(c=>this.getFile(c)),a=o.filter(c=>!c.error),l=o.filter(c=>c.error);this.addResultData(e,{successful:a,failed:l,uploadID:e}),i=n()}let s;return i&&(s=i.result,V(this,L,$s).call(this,e)),s==null&&(this.log(`Not setting result for an upload that has been removed: ${e}`),s={successful:[],failed:[],uploadID:e}),s},j(Ji,"VERSION",Y0.version);let Ss=Ji;const J0={key:0,class:"uppy-input-area--caption small text-body-secondary fst-italic"},eb={__name:"UppyInput",props:{name:{type:String,required:!0},multiple:{type:Boolean,default:!1},useXHR:{type:Boolean,default:!0},XHRConfig:{type:Object,default:{}},url:{type:String,default:"/upload"},config:{type:Object,default:()=>({})},errorHandler:{type:Function,default:null},showRestrictionCaption:{type:Boolean,default:!0}},emits:["update:modelValue","file-added","file-removed","beforeUpload","progress","upload","upload-progress","upload-error","upload-success","upload-pause","complete","error","upload-retry","upload-stalled","retry-all","cancel-all","restriction-failed"],setup(t,{emit:e}){var m;const n=t,i=e,r=u.ref(null),s=u.ref(null),o=u.shallowRef(null),a=u.inject("form",{value:{},errors:{},getID:h=>h}),l=u.inject("group",null),c=u.computed({get(){var h;return(h=l==null?void 0:l.value)!=null&&h.name?l.value.getData(n.name):a.value[n.name]},set(h){var b;(b=l==null?void 0:l.value)!=null&&b.name?l.value.setData(n.name,h):a.value[n.name]=h,i("update:modelValue",h)}});o.value=new Ss({id:n.name,autoProceed:!0,...n.config,restrictions:{maxNumberOfFiles:n.multiple?null:1,...((m=n.config)==null?void 0:m.restrictions)||{}}}),o.value.on("before-upload",h=>{i("beforeUpload",h)}),o.value.on("upload-success",(h,b)=>{const g=b.body??b;if(n.multiple){const v=Array.isArray(c.value)?c.value:[];c.value=[...v,g]}else c.value=g;i("upload-success",h,b)}),o.value.on("file-added",h=>i("file-added",h)),o.value.on("file-removed",h=>{var g;const b=((g=h.response)==null?void 0:g.body)??h.response;n.multiple&&Array.isArray(c.value)?c.value=c.value.filter(v=>JSON.stringify(v)!==JSON.stringify(b)):c.value=null,b&&fetch(n.url,{method:"DELETE",headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/json"},body:JSON.stringify(b)}),i("file-removed",h)}),o.value.on("progress",h=>{a.value.uploading=h>=100||h<=0?null:h,i("progress",h)}),o.value.on("upload-progress",(h,b)=>i("upload-progress",h,b)),o.value.on("upload-pause",(h,b)=>i("upload-pause",h,b)),o.value.on("cancel-all",()=>i("cancel-all")),o.value.on("retry-all",()=>i("retry-all")),o.value.on("upload-stalled",(h,b)=>i("upload-stalled",h,b)),o.value.on("upload-retry",h=>i("upload-retry",h)),o.value.on("complete",h=>i("complete",h)),o.value.on("error",h=>{i("error",h)}),o.value.on("upload-error",(h,b,g)=>{var C;const v=((C=JSON.parse(g.response))==null?void 0:C.message)??b;d(v),i("upload-error",h,b,g,v)}),o.value.on("restriction-failed",(h,b)=>{d(b.message),i("restriction-failed",h,b)}),u.onMounted(()=>{var b,g,v,C;let h;n.useXHR&&Promise.resolve().then(()=>sb).then(k=>{h=k.default,o.value.use(h,{method:"POST",endpoint:n.url,headers:{accept:"application/json"},...n.XHRConfig})}),(g=(b=o.value)==null?void 0:b.opts)!=null&&g.restrictions&&(console.log((C=(v=o.value)==null?void 0:v.opts)==null?void 0:C.restrictions),r.value=_(o.value.opts.restrictions),console.log("restrictionCaption",r.value))}),u.onBeforeUnmount(()=>{o.value&&o.value.destroy()});function d(h){n.errorHandler?n.errorHandler(h):h&&f(h)}function f(h){const b=document.createElement("div");b.textContent=h,b.className="uppy-error",s.value&&(s.value.prepend(b),setTimeout(()=>b.remove(),3e3))}function p(h){return h?Math.round(h/1024):null}function _(h){if(!h)return"";const{allowedFileTypes:b,maxFileSize:g,minFileSize:v,maxNumberOfFiles:C,minNumberOfFiles:k,maxTotalFileSize:w}=h,E=[];if(b&&b.length){const M=b.map(T=>T.replace(".","")).join("، ");E.push(`فقط فایلهای ${M}`)}return C&&E.push(`امکان انتخاب حداکثر ${C} فایل`),k&&E.push(`حداقل ${k} فایل نیاز است`),g&&E.push(`با حداکثر حجم ${p(g)} کیلوبایت برای هر فایل`),v&&E.push(`با حداقل حجم ${p(v)} کیلوبایت برای هر فایل`),w&&E.push(`و مجموع حجم کل حداکثر ${p(w)} کیلوبایت`),E.length?E.join("، ")+" مجاز است.":""}return(h,b)=>o.value?(u.openBlock(),u.createElementBlock("div",{key:0,class:"uppy-input-area",ref_key:"inputEl",ref:s},[u.createVNode(u.unref(c_),{name:"uu"+t.name,uppy:o.value},{default:u.withCtx(()=>[u.renderSlot(h.$slots,"default",{uppy:o.value},()=>[u.createVNode(u.unref(d_),{class:"uppy-file-lists"}),u.createVNode(u.unref(u_))])]),_:3},8,["name","uppy"]),r.value?(u.openBlock(),u.createElementBlock("div",J0,u.toDisplayString(r.value),1)):u.createCommentVNode("",!0)],512)):u.createCommentVNode("",!0)}},tb={version:"5.1.1"},nb={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function ib(t,e){let n=e;return n||(n=new Error("Upload error")),typeof n=="string"&&(n=new Error(n)),n instanceof Error||(n=Object.assign(new Error("Upload error"),{data:n})),E_(t)?(n=new bs(n,t),n):(n.request=t,n)}function Rc(t){return t.data.slice(0,t.data.size,t.meta.type)}const rb={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""};class Hc extends I_{constructor(n,i){super(n,{...rb,fieldName:i.bundle?"files[]":"file",...i});K(this,it);K(this,Nn);j(this,"requests");j(this,"uploaderEvents");K(this,Jn,async n=>{if(n.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[vs]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");const i=this.uppy.getFilesByIds(n),r=g_(i),s=__(r);if(this.uppy.emit("upload-start",s),this.opts.bundle){if(r.some(a=>a.isRemote))throw new Error("Can’t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await V(this,it,ru).call(this,r)}else await V(this,it,ou).call(this,r)});if(this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=nb,this.i18nInit(),vs in this.opts?this.requests=this.opts[vs]:this.requests=new C_(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if((i==null?void 0:i.allowedMetaFields)===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),re(this,Nn,r=>async(s,o)=>{var a,l;try{const c=await h_(s,{...o,onBeforeRequest:(p,_)=>{var m,h;return(h=(m=this.opts).onBeforeRequest)==null?void 0:h.call(m,p,_,r)},shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:p=>{const _=Math.ceil(p/1e3),m=new Error(this.i18n("uploadStalled",{seconds:_}));this.uppy.emit("upload-stalled",m,r)},onUploadProgress:p=>{if(p.lengthComputable)for(const{id:_}of r){const m=this.uppy.getFile(_);m!=null&&this.uppy.emit("upload-progress",m,{uploadStarted:m.progress.uploadStarted??0,bytesUploaded:p.loaded/p.total*m.size,bytesTotal:m.size})}}});let d=await((l=(a=this.opts).getResponseData)==null?void 0:l.call(a,c));if(c.responseType==="json")d??(d=c.response);else try{d??(d=JSON.parse(c.responseText))}catch(p){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:p})}const f=typeof(d==null?void 0:d.url)=="string"?d.url:void 0;for(const{id:p}of r)this.uppy.emit("upload-success",this.uppy.getFile(p),{status:c.status,body:d,uploadURL:f});return c}catch(c){if(c.name==="AbortError")return;const d=c.request;for(const f of r)this.uppy.emit("upload-error",this.uppy.getFile(f.id),ib(d,c),d);throw c}})}getOptions(n){const i=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...i||{},...n.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(n):Object.assign(s.headers,this.opts.headers),i&&Object.assign(s.headers,i.headers),n.xhrUpload&&Object.assign(s.headers,n.xhrUpload.headers),s}addMetadata(n,i,r){kc(r.allowedMetaFields,i).forEach(o=>{const a=i[o];Array.isArray(a)?a.forEach(l=>n.append(o,l)):n.append(o,a)})}createFormDataUpload(n,i){const r=new FormData;this.addMetadata(r,n.meta,i);const s=Rc(n);return n.name?r.append(i.fieldName,s,n.meta.name):r.append(i.fieldName,s),r}createBundledUpload(n,i){const r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,i),n.forEach(o=>{const a=this.getOptions(o),l=Rc(o);o.name?r.append(a.fieldName,l,o.name):r.append(a.fieldName,l)}),r}install(){if(this.opts.bundle){const{capabilities:n}=this.uppy.getState();this.uppy.setState({capabilities:{...n,individualCancellation:!1}})}this.uppy.addUploader(S(this,Jn))}uninstall(){if(this.opts.bundle){const{capabilities:n}=this.uppy.getState();this.uppy.setState({capabilities:{...n,individualCancellation:!0}})}this.uppy.removeUploader(S(this,Jn))}}Nn=new WeakMap,it=new WeakSet,iu=async function(n){const i=new O_(this.uppy),r=new AbortController,s=this.requests.wrapPromiseFunction(async()=>{const o=this.getOptions(n),a=S(this,Nn).call(this,[n]),l=o.formData?this.createFormDataUpload(n,o):n.data,c=typeof o.endpoint=="string"?o.endpoint:await o.endpoint(n);return a(c,{...o,body:l,signal:r.signal})});i.onFileRemove(n.id,()=>r.abort()),i.onCancelAll(n.id,()=>{r.abort()});try{await s()}catch(o){if(o.message!=="Cancelled")throw o}finally{i.remove()}},ru=async function(n){const i=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{const o=this.uppy.getState().xhrUpload??{},a=S(this,Nn).call(this,n),l=this.createBundledUpload(n,{...this.opts,...o}),c=typeof this.opts.endpoint=="string"?this.opts.endpoint:await this.opts.endpoint(n);return a(c,{...this.opts,body:l,signal:i.signal})});function s(){i.abort()}this.uppy.once("cancel-all",s);try{await r()}catch(o){if(o.message!=="Cancelled")throw o}finally{this.uppy.off("cancel-all",s)}},su=function(n){var s;const i=this.getOptions(n),r=kc(i.allowedMetaFields,n.meta);return{...(s=n.remote)==null?void 0:s.body,protocol:"multipart",endpoint:i.endpoint,size:n.data.size,fieldname:i.fieldName,metadata:Object.fromEntries(r.map(o=>[o,n.meta[o]])),httpMethod:i.method,useFormData:i.formData,headers:i.headers}},ou=async function(n){await Promise.allSettled(n.map(i=>{if(i.isRemote){const r=()=>this.requests,s=new AbortController,o=l=>{l.id===i.id&&s.abort()};this.uppy.on("file-removed",o);const a=this.uppy.getRequestClientForFile(i).uploadRemoteFile(i,V(this,it,su).call(this,i),{signal:s.signal,getQueue:r});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",o)},{priority:-1})(),a}return V(this,it,iu).call(this,i)}))},Jn=new WeakMap,j(Hc,"VERSION",tb.version);const sb=Object.freeze(Object.defineProperty({__proto__:null,default:Hc},Symbol.toStringTag,{value:"Module"}));F.AmountInput=bh,F.CaptchaInput=Oh,F.CheckboxButtonInput=Mh,F.CheckboxInput=jh,F.CheckboxToggle=zh,F.DropzoneInput=qg,F.EditorInput=Zh,F.EmailInput=pp,F.FileInput=dp,F.FormContainer=Ep,F.FormLabel=Ip,F.GroupControl=ua,F.LocationInput=Fp,F.MobileInput=Mp,F.MultiQuantityInput=Kp,F.PasswordInput=Lp,F.PersianDatePickerInput=Yh,F.QuantityInput=da,F.RangeSliderInput=U1,F.SecondarySubmitButton=Xp,F.Select2Input=Ag,F.SimpleUploader=r1,F.StarRatingInput=Ng,F.SubmitButton=Lg,F.TelInput=Rg,F.TextAreaInput=zg,F.TextInput=Ln,F.UppyInput=eb,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
|
19
|
+
Uppy plugins must have unique \`id\` options.`;throw new Error(o)}return e.VERSION&&this.log(`Using ${r} v${e.VERSION}`),i.type in S(this,ze)?S(this,ze)[i.type].push(i):S(this,ze)[i.type]=[i],i.install(),this.emit("plugin-added",i),this}getPlugin(e){for(const n of Object.values(S(this,ze))){const i=n.find(r=>r.id===e);if(i!=null)return i}}[Symbol.for("uppy test: getPlugins")](e){return S(this,ze)[e]}iteratePlugins(e){Object.values(S(this,ze)).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const n=S(this,ze)[e.type],i=n.findIndex(o=>o.id===e.id);i!==-1&&n.splice(i,1);const s={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(s)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),S(this,Qn).call(this),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",S(this,kt)),window.removeEventListener("offline",S(this,kt)))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,n="info",i=3e3){const r=typeof e=="object";this.setState({info:[...this.getState().info,{type:n,message:r?e.message:e,details:r?e.details:null}]}),setTimeout(()=>this.hideInfo(),i),this.emit("info-visible")}log(e,n){const{logger:i}=this.opts;switch(n){case"error":i.error(e);break;case"warning":i.warn(e);break;default:i.debug(e);break}}registerRequestClient(e,n){S(this,Zn).set(e,n)}getRequestClientForFile(e){if(!("remote"in e&&e.remote))throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const n=S(this,Zn).get(e.remote.requestClientId);if(n==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return n}async restore(e){this.log(`Core: Running restored upload "${e}"`);const n=await V(this,L,di).call(this,e);return this.emit("complete",n),n}[Symbol.for("uppy test: createUpload")](...e){return V(this,L,ui).call(this,...e)}addResultData(e,n){if(!V(this,L,nu).call(this,e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}const{currentUploads:i}=this.getState(),r={...i[e],result:{...i[e].result,...n}};this.setState({currentUploads:{...i,[e]:r}})}async upload(){var r;(r=S(this,ze).uploader)!=null&&r.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(V(this,L,Ps).call(this).length>0){const s=await V(this,L,Ms).call(this);if(!(this.getFiles().filter(a=>a.progress.uploadStarted==null).length>0))return this.emit("complete",s),s;({files:e}=this.getState())}const i=this.opts.onBeforeUpload(e);if(i===!1)throw new Error("Not starting the upload because onBeforeUpload returned false");i&&typeof i=="object"&&(e=i,this.setState({files:e}));try{if(S(this,qe).validateMinNumberOfFiles(e),!V(this,L,Qc).call(this,e))throw new xe(this.i18n("missingRequiredMetaField"));const{currentUploads:s}=this.getState(),o=Object.values(s).flatMap(d=>d.fileIDs),a=Object.keys(e).filter(d=>{const f=this.getFile(d);return f&&!f.progress.uploadStarted&&!o.includes(d)}),l=V(this,L,ui).call(this,a),c=await V(this,L,di).call(this,l);return this.emit("complete",c),c}catch(s){throw V(this,L,Zt).call(this,[s]),s}}};ze=new WeakMap,qe=new WeakMap,Qn=new WeakMap,Wt=new WeakMap,Tn=new WeakMap,Fn=new WeakMap,Gt=new WeakMap,L=new WeakSet,Zt=function(e){for(const o of e)o.isRestriction?this.emit("restriction-failed",o.file,o):this.emit("error",o,o.file),this.log(o,"warning");const n=e.filter(o=>o.isUserFacing),i=4,r=n.slice(0,i),s=n.slice(i);r.forEach(({message:o,details:a=""})=>{this.info({message:o,details:a},"error",this.opts.infoTimeout)}),s.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:s.length})})},Ts=function(e){const{missingFields:n,error:i}=S(this,qe).getMissingRequiredMetaFields(e);return n.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:n,error:i.message}),this.log(i.message),this.emit("restriction-failed",e,i),!1):(n.length===0&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)},Qc=function(e){let n=!0;for(const i of Object.values(e))V(this,L,Ts).call(this,i)||(n=!1);return n},Zc=function(e){const{allowNewUpload:n}=this.getState();if(n===!1){const i=new xe(this.i18n("noMoreFilesAllowed"),{file:e});throw V(this,L,Zt).call(this,[i]),i}},Jc=function(e){const n=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e,meta:{},isRemote:!1,source:void 0,preview:void 0}:e,i=Sc(n),r=X0(i,n),s=wc(r).extension,o=w_(n,this.getID()),a={...n.meta,name:r,type:i},l=Number.isFinite(n.data.size)?n.data.size:null;return{source:n.source||"",id:o,name:r,extension:s||"",meta:{...this.getState().meta,...a},type:i,progress:{percentage:0,bytesUploaded:!1,bytesTotal:l,uploadComplete:!1,uploadStarted:null},size:l,isGhost:!1,...n.isRemote?{isRemote:!0,remote:n.remote,data:n.data}:{isRemote:!1,data:n.data},preview:n.preview}},Fs=function(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))},Ns=function(e){let{files:n}=this.getState(),i={...n};const r=[],s=[];for(const o of e)try{let a=V(this,L,Jc).call(this,o);V(this,L,Zc).call(this,a);const l=n[a.id],c=l==null?void 0:l.isGhost;if(c&&!a.isRemote){if(a.data==null)throw new Error("File data is missing");a={...l,isGhost:!1,data:a.data},this.log(`Replaced the blob in the restored ghost file: ${a.name}, ${a.id}`)}const d=this.opts.onBeforeFileAdded(a,i);if(n=this.getState().files,i={...n,...i},!d&&this.checkIfFileAlreadyExists(a.id))throw new xe(this.i18n("noDuplicates",{fileName:a.name??this.i18n("unnamed")}),{file:a});if(d===!1&&!c)throw new xe("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:a});typeof d=="object"&&d!==null&&(a=d),S(this,qe).validateSingleFile(a),i[a.id]=a,r.push(a)}catch(a){s.push(a)}try{S(this,qe).validateAggregateRestrictions(Object.values(n),r)}catch(o){return s.push(o),{nextFilesState:n,validFilesToAdd:[],errors:s}}return{nextFilesState:i,validFilesToAdd:r,errors:s}},Ps=function(){const{files:e}=this.getState();return Object.keys(e).filter(n=>{const i=e[n];return i.error&&(!i.missingRequiredMetaFields||i.missingRequiredMetaFields.length===0)})},Ms=async function(){const e=V(this,L,Ps).call(this),n={...this.getState().files};if(e.forEach(r=>{n[r]={...n[r],isPaused:!1,error:null}}),this.setState({files:n,error:null}),this.emit("retry-all",this.getFilesByIds(e)),e.length===0)return{successful:[],failed:[]};const i=V(this,L,ui).call(this,e,{forceAllowNewUpload:!0});return V(this,L,di).call(this,i)},Zi=new WeakMap,Ds=function(){const e=V(this,L,eu).call(this);let n=null;e!=null&&(n=Math.round(e*100),n>100?n=100:n<0&&(n=0)),this.emit("progress",n??0),this.setState({totalProgress:n??0})},Yt=new WeakMap,eu=function(){const n=this.getFiles().filter(l=>l.progress.uploadStarted||l.progress.preprocess||l.progress.postprocess);if(n.length===0)return 0;if(n.every(l=>l.progress.uploadComplete))return 1;const i=l=>l.progress.bytesTotal!=null&&l.progress.bytesTotal!==0,r=n.filter(i),s=n.filter(l=>!i(l));if(r.every(l=>l.progress.uploadComplete)&&s.length>0&&!s.every(l=>l.progress.uploadComplete))return null;const o=r.reduce((l,c)=>l+(c.progress.bytesTotal??0),0),a=r.reduce((l,c)=>l+(c.progress.bytesUploaded||0),0);return o===0?0:a/o},tu=function(){const e=(r,s,o)=>{let a=r.message||"Unknown error";r.details&&(a+=` ${r.details}`),this.setState({error:a}),s!=null&&s.id in this.getState().files&&this.setFileState(s.id,{error:a,response:o})};this.on("error",e),this.on("upload-error",(r,s,o)=>{if(e(s,r,o),typeof s=="object"&&s.message){this.log(s.message,"error");const a=new Error(this.i18n("failedToUpload",{file:(r==null?void 0:r.name)??""}));a.isUserFacing=!0,a.details=s.message,s.details&&(a.details+=` ${s.details}`),V(this,L,Zt).call(this,[a])}else V(this,L,Zt).call(this,[s])});let n=null;this.on("upload-stalled",(r,s)=>{const{message:o}=r,a=s.map(l=>l.meta.name).join(", ");n||(this.info({message:o,details:a},"warning",this.opts.infoTimeout),n=setTimeout(()=>{n=null},this.opts.infoTimeout)),this.log(`${o} ${a}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const i=r=>{const s=r.filter(a=>{const l=a!=null&&this.getFile(a.id);return l||this.log(`Not setting progress for a file that has been removed: ${a==null?void 0:a.id}`),l}),o=Object.fromEntries(s.map(a=>[a.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:a.size}}]));this.patchFilesState(o)};this.on("upload-start",i),this.on("upload-progress",S(this,Zi)),this.on("upload-success",(r,s)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r==null?void 0:r.id}`);return}const o=this.getFile(r.id).progress,a=S(this,Gt).size>0;this.setFileState(r.id,{progress:{...o,postprocess:a?{mode:"indeterminate"}:void 0,uploadComplete:!0,...!a&&{complete:!0},percentage:100,bytesUploaded:o.bytesTotal},response:s,uploadURL:s.uploadURL,isPaused:!1}),r.size==null&&this.setFileState(r.id,{size:s.bytesUploaded||o.bytesTotal}),S(this,Yt).call(this)}),this.on("preprocess-progress",(r,s)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r==null?void 0:r.id}`);return}this.setFileState(r.id,{progress:{...this.getFile(r.id).progress,preprocess:s}})}),this.on("preprocess-complete",r=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r==null?void 0:r.id}`);return}const s={...this.getState().files};s[r.id]={...s[r.id],progress:{...s[r.id].progress}},delete s[r.id].progress.preprocess,this.setState({files:s})}),this.on("postprocess-progress",(r,s)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r==null?void 0:r.id}`);return}this.setFileState(r.id,{progress:{...this.getState().files[r.id].progress,postprocess:s}})}),this.on("postprocess-complete",r=>{const s=r&&this.getFile(r.id);if(s==null){this.log(`Not setting progress for a file that has been removed: ${r==null?void 0:r.id}`);return}const{postprocess:o,...a}=s.progress;this.patchFilesState({[s.id]:{progress:{...a,complete:!0}}})}),this.on("restored",()=>{S(this,Yt).call(this)}),this.on("dashboard:file-edit-complete",r=>{r&&V(this,L,Ts).call(this,r)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",S(this,kt)),window.addEventListener("offline",S(this,kt)),setTimeout(S(this,kt),3e3))},kt=new WeakMap,Zn=new WeakMap,ui=function(e,n={}){const{forceAllowNewUpload:i=!1}=n,{allowNewUpload:r,currentUploads:s}=this.getState();if(!r&&!i)throw new Error("Cannot create a new upload: already uploading.");const o=G0();return this.emit("upload",o,this.getFilesByIds(e)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...s,[o]:{fileIDs:e,step:0,result:{}}}}),o},nu=function(e){const{currentUploads:n}=this.getState();return n[e]},$s=function(e){const{[e]:n,...i}=this.getState().currentUploads;this.setState({currentUploads:i})},di=async function(e){const n=()=>{const{currentUploads:o}=this.getState();return o[e]};let i=n();if(!i)throw new Error("Nonexistent upload");const r=[...S(this,Tn),...S(this,Fn),...S(this,Gt)];try{for(let o=i.step||0;o<r.length;o++){const a=r[o];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...i,step:o}}});const{fileIDs:l}=i;if(await a(l,e),i=n(),!i)break}}catch(o){throw V(this,L,$s).call(this,e),o}if(i){i.fileIDs.forEach(c=>{const d=this.getFile(c);d!=null&&d.progress.postprocess&&this.emit("postprocess-complete",d)});const o=i.fileIDs.map(c=>this.getFile(c)),a=o.filter(c=>!c.error),l=o.filter(c=>c.error);this.addResultData(e,{successful:a,failed:l,uploadID:e}),i=n()}let s;return i&&(s=i.result,V(this,L,$s).call(this,e)),s==null&&(this.log(`Not setting result for an upload that has been removed: ${e}`),s={successful:[],failed:[],uploadID:e}),s},j(Ji,"VERSION",Y0.version);let Ss=Ji;const J0={key:0,class:"uppy-input-area--caption small text-body-secondary fst-italic"},eb={__name:"UppyInput",props:{name:{type:String,required:!0},multiple:{type:Boolean,default:!1},useXHR:{type:Boolean,default:!0},XHRConfig:{type:Object,default:{}},url:{type:String,default:"/upload"},config:{type:Object,default:()=>({})},errorHandler:{type:Function,default:null},showRestrictionCaption:{type:Boolean,default:!0}},emits:["update:modelValue","file-added","file-removed","beforeUpload","progress","upload","upload-progress","upload-error","upload-success","upload-pause","complete","error","upload-retry","upload-stalled","retry-all","cancel-all","restriction-failed"],setup(t,{emit:e}){var m;const n=t,i=e,r=u.ref(null),s=u.ref(null),o=u.shallowRef(null),a=u.inject("form",{value:{},errors:{},getID:h=>h}),l=u.inject("group",null),c=u.computed({get(){var h;return(h=l==null?void 0:l.value)!=null&&h.name?l.value.getData(n.name):a.value[n.name]},set(h){var b;(b=l==null?void 0:l.value)!=null&&b.name?l.value.setData(n.name,h):a.value[n.name]=h,i("update:modelValue",h)}});o.value=new Ss({id:n.name,autoProceed:!0,...n.config,restrictions:{maxNumberOfFiles:n.multiple?null:1,...((m=n.config)==null?void 0:m.restrictions)||{}}}),o.value.on("before-upload",h=>{i("beforeUpload",h)}),o.value.on("upload-success",(h,b)=>{const g=b.body??b;if(n.multiple){const v=Array.isArray(c.value)?c.value:[];c.value=[...v,g]}else c.value=g;i("upload-success",h,b)}),o.value.on("file-added",h=>i("file-added",h)),o.value.on("file-removed",h=>{var g;const b=((g=h.response)==null?void 0:g.body)??h.response;n.multiple&&Array.isArray(c.value)?c.value=c.value.filter(v=>JSON.stringify(v)!==JSON.stringify(b)):c.value=null,b&&fetch(n.url,{method:"DELETE",headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/json"},body:JSON.stringify(b)}),i("file-removed",h)}),o.value.on("progress",h=>{a.value.uploading=h>=100||h<=0?null:h,i("progress",h)}),o.value.on("upload-progress",(h,b)=>i("upload-progress",h,b)),o.value.on("upload-pause",(h,b)=>i("upload-pause",h,b)),o.value.on("cancel-all",()=>i("cancel-all")),o.value.on("retry-all",()=>i("retry-all")),o.value.on("upload-stalled",(h,b)=>i("upload-stalled",h,b)),o.value.on("upload-retry",h=>i("upload-retry",h)),o.value.on("complete",h=>i("complete",h)),o.value.on("error",h=>{i("error",h)}),o.value.on("upload-error",(h,b,g)=>{var C;const v=((C=JSON.parse(g.response))==null?void 0:C.message)??b;d(v),i("upload-error",h,b,g,v)}),o.value.on("restriction-failed",(h,b)=>{d(b.message),i("restriction-failed",h,b)}),u.onMounted(()=>{var b,g;let h;n.useXHR&&Promise.resolve().then(()=>sb).then(v=>{h=v.default,o.value.use(h,{method:"POST",endpoint:n.url,headers:{accept:"application/json"},...n.XHRConfig})}),(g=(b=o.value)==null?void 0:b.opts)!=null&&g.restrictions&&(r.value=_(o.value.opts.restrictions))}),u.onBeforeUnmount(()=>{o.value&&o.value.destroy()});function d(h){n.errorHandler?n.errorHandler(h):h&&f(h)}function f(h){const b=document.createElement("div");b.textContent=h,b.className="uppy-error",s.value&&(s.value.prepend(b),setTimeout(()=>b.remove(),3e3))}function p(h){return h?Math.round(h/1024):null}function _(h){if(!h)return"";const{allowedFileTypes:b,maxFileSize:g,minFileSize:v,maxNumberOfFiles:C,minNumberOfFiles:k,maxTotalFileSize:w}=h,E=[];if(b&&b.length){const M=b.map(T=>T.replace(".","")).join("، ");E.push(`فقط فایلهای ${M}`)}return C&&E.push(`امکان انتخاب حداکثر ${C} فایل`),k&&E.push(`حداقل ${k} فایل نیاز است`),g&&E.push(`با حداکثر حجم ${p(g)} کیلوبایت برای هر فایل`),v&&E.push(`با حداقل حجم ${p(v)} کیلوبایت برای هر فایل`),w&&E.push(`و مجموع حجم کل حداکثر ${p(w)} کیلوبایت`),E.length?E.join("، ")+" مجاز است.":""}return(h,b)=>o.value?(u.openBlock(),u.createElementBlock("div",{key:0,class:"uppy-input-area",ref_key:"inputEl",ref:s},[u.createVNode(u.unref(c_),{name:"uu"+t.name,uppy:o.value},{default:u.withCtx(()=>[u.renderSlot(h.$slots,"default",{uppy:o.value},()=>[u.createVNode(u.unref(d_),{class:"uppy-file-lists"}),u.createVNode(u.unref(u_))])]),_:3},8,["name","uppy"]),r.value?(u.openBlock(),u.createElementBlock("div",J0,u.toDisplayString(r.value),1)):u.createCommentVNode("",!0)],512)):u.createCommentVNode("",!0)}},tb={version:"5.1.1"},nb={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function ib(t,e){let n=e;return n||(n=new Error("Upload error")),typeof n=="string"&&(n=new Error(n)),n instanceof Error||(n=Object.assign(new Error("Upload error"),{data:n})),E_(t)?(n=new bs(n,t),n):(n.request=t,n)}function Rc(t){return t.data.slice(0,t.data.size,t.meta.type)}const rb={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""};class Hc extends I_{constructor(n,i){super(n,{...rb,fieldName:i.bundle?"files[]":"file",...i});K(this,it);K(this,Nn);j(this,"requests");j(this,"uploaderEvents");K(this,Jn,async n=>{if(n.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[vs]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");const i=this.uppy.getFilesByIds(n),r=g_(i),s=__(r);if(this.uppy.emit("upload-start",s),this.opts.bundle){if(r.some(a=>a.isRemote))throw new Error("Can’t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await V(this,it,ru).call(this,r)}else await V(this,it,ou).call(this,r)});if(this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=nb,this.i18nInit(),vs in this.opts?this.requests=this.opts[vs]:this.requests=new C_(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if((i==null?void 0:i.allowedMetaFields)===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),re(this,Nn,r=>async(s,o)=>{var a,l;try{const c=await h_(s,{...o,onBeforeRequest:(p,_)=>{var m,h;return(h=(m=this.opts).onBeforeRequest)==null?void 0:h.call(m,p,_,r)},shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:p=>{const _=Math.ceil(p/1e3),m=new Error(this.i18n("uploadStalled",{seconds:_}));this.uppy.emit("upload-stalled",m,r)},onUploadProgress:p=>{if(p.lengthComputable)for(const{id:_}of r){const m=this.uppy.getFile(_);m!=null&&this.uppy.emit("upload-progress",m,{uploadStarted:m.progress.uploadStarted??0,bytesUploaded:p.loaded/p.total*m.size,bytesTotal:m.size})}}});let d=await((l=(a=this.opts).getResponseData)==null?void 0:l.call(a,c));if(c.responseType==="json")d??(d=c.response);else try{d??(d=JSON.parse(c.responseText))}catch(p){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:p})}const f=typeof(d==null?void 0:d.url)=="string"?d.url:void 0;for(const{id:p}of r)this.uppy.emit("upload-success",this.uppy.getFile(p),{status:c.status,body:d,uploadURL:f});return c}catch(c){if(c.name==="AbortError")return;const d=c.request;for(const f of r)this.uppy.emit("upload-error",this.uppy.getFile(f.id),ib(d,c),d);throw c}})}getOptions(n){const i=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...i||{},...n.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(n):Object.assign(s.headers,this.opts.headers),i&&Object.assign(s.headers,i.headers),n.xhrUpload&&Object.assign(s.headers,n.xhrUpload.headers),s}addMetadata(n,i,r){kc(r.allowedMetaFields,i).forEach(o=>{const a=i[o];Array.isArray(a)?a.forEach(l=>n.append(o,l)):n.append(o,a)})}createFormDataUpload(n,i){const r=new FormData;this.addMetadata(r,n.meta,i);const s=Rc(n);return n.name?r.append(i.fieldName,s,n.meta.name):r.append(i.fieldName,s),r}createBundledUpload(n,i){const r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,i),n.forEach(o=>{const a=this.getOptions(o),l=Rc(o);o.name?r.append(a.fieldName,l,o.name):r.append(a.fieldName,l)}),r}install(){if(this.opts.bundle){const{capabilities:n}=this.uppy.getState();this.uppy.setState({capabilities:{...n,individualCancellation:!1}})}this.uppy.addUploader(S(this,Jn))}uninstall(){if(this.opts.bundle){const{capabilities:n}=this.uppy.getState();this.uppy.setState({capabilities:{...n,individualCancellation:!0}})}this.uppy.removeUploader(S(this,Jn))}}Nn=new WeakMap,it=new WeakSet,iu=async function(n){const i=new O_(this.uppy),r=new AbortController,s=this.requests.wrapPromiseFunction(async()=>{const o=this.getOptions(n),a=S(this,Nn).call(this,[n]),l=o.formData?this.createFormDataUpload(n,o):n.data,c=typeof o.endpoint=="string"?o.endpoint:await o.endpoint(n);return a(c,{...o,body:l,signal:r.signal})});i.onFileRemove(n.id,()=>r.abort()),i.onCancelAll(n.id,()=>{r.abort()});try{await s()}catch(o){if(o.message!=="Cancelled")throw o}finally{i.remove()}},ru=async function(n){const i=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{const o=this.uppy.getState().xhrUpload??{},a=S(this,Nn).call(this,n),l=this.createBundledUpload(n,{...this.opts,...o}),c=typeof this.opts.endpoint=="string"?this.opts.endpoint:await this.opts.endpoint(n);return a(c,{...this.opts,body:l,signal:i.signal})});function s(){i.abort()}this.uppy.once("cancel-all",s);try{await r()}catch(o){if(o.message!=="Cancelled")throw o}finally{this.uppy.off("cancel-all",s)}},su=function(n){var s;const i=this.getOptions(n),r=kc(i.allowedMetaFields,n.meta);return{...(s=n.remote)==null?void 0:s.body,protocol:"multipart",endpoint:i.endpoint,size:n.data.size,fieldname:i.fieldName,metadata:Object.fromEntries(r.map(o=>[o,n.meta[o]])),httpMethod:i.method,useFormData:i.formData,headers:i.headers}},ou=async function(n){await Promise.allSettled(n.map(i=>{if(i.isRemote){const r=()=>this.requests,s=new AbortController,o=l=>{l.id===i.id&&s.abort()};this.uppy.on("file-removed",o);const a=this.uppy.getRequestClientForFile(i).uploadRemoteFile(i,V(this,it,su).call(this,i),{signal:s.signal,getQueue:r});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",o)},{priority:-1})(),a}return V(this,it,iu).call(this,i)}))},Jn=new WeakMap,j(Hc,"VERSION",tb.version);const sb=Object.freeze(Object.defineProperty({__proto__:null,default:Hc},Symbol.toStringTag,{value:"Module"}));F.AmountInput=bh,F.CaptchaInput=Oh,F.CheckboxButtonInput=Mh,F.CheckboxInput=jh,F.CheckboxToggle=zh,F.DropzoneInput=qg,F.EditorInput=Zh,F.EmailInput=pp,F.FileInput=dp,F.FormContainer=Ep,F.FormLabel=Ip,F.GroupControl=ua,F.LocationInput=Fp,F.MobileInput=Mp,F.MultiQuantityInput=Kp,F.PasswordInput=Lp,F.PersianDatePickerInput=Yh,F.QuantityInput=da,F.RangeSliderInput=U1,F.SecondarySubmitButton=Xp,F.Select2Input=Ag,F.SimpleUploader=r1,F.StarRatingInput=Ng,F.SubmitButton=Lg,F.TelInput=Rg,F.TextAreaInput=zg,F.TextInput=Ln,F.UppyInput=eb,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
package/src/UppyInput.vue
CHANGED
|
@@ -164,9 +164,7 @@ onMounted(() => {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
if(uppy.value?.opts?.restrictions){
|
|
167
|
-
console.log(uppy.value?.opts?.restrictions);
|
|
168
167
|
restrictionCaption.value = buildRestrictionsCaption(uppy.value.opts.restrictions)
|
|
169
|
-
console.log('restrictionCaption', restrictionCaption.value);
|
|
170
168
|
}
|
|
171
169
|
});
|
|
172
170
|
|