@tinyuploader/vue
Version:
```bash npm i @tinyuploader/vue -S ```
1,180 lines • 69.1 kB
JavaScript
var nt = { exports: {} };
(function(e, t) {
(function(s) {
e.exports = s();
})(function(s) {
var l = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
function h(u, o) {
var a = u[0], i = u[1], n = u[2], r = u[3];
a += (i & n | ~i & r) + o[0] - 680876936 | 0, a = (a << 7 | a >>> 25) + i | 0, r += (a & i | ~a & n) + o[1] - 389564586 | 0, r = (r << 12 | r >>> 20) + a | 0, n += (r & a | ~r & i) + o[2] + 606105819 | 0, n = (n << 17 | n >>> 15) + r | 0, i += (n & r | ~n & a) + o[3] - 1044525330 | 0, i = (i << 22 | i >>> 10) + n | 0, a += (i & n | ~i & r) + o[4] - 176418897 | 0, a = (a << 7 | a >>> 25) + i | 0, r += (a & i | ~a & n) + o[5] + 1200080426 | 0, r = (r << 12 | r >>> 20) + a | 0, n += (r & a | ~r & i) + o[6] - 1473231341 | 0, n = (n << 17 | n >>> 15) + r | 0, i += (n & r | ~n & a) + o[7] - 45705983 | 0, i = (i << 22 | i >>> 10) + n | 0, a += (i & n | ~i & r) + o[8] + 1770035416 | 0, a = (a << 7 | a >>> 25) + i | 0, r += (a & i | ~a & n) + o[9] - 1958414417 | 0, r = (r << 12 | r >>> 20) + a | 0, n += (r & a | ~r & i) + o[10] - 42063 | 0, n = (n << 17 | n >>> 15) + r | 0, i += (n & r | ~n & a) + o[11] - 1990404162 | 0, i = (i << 22 | i >>> 10) + n | 0, a += (i & n | ~i & r) + o[12] + 1804603682 | 0, a = (a << 7 | a >>> 25) + i | 0, r += (a & i | ~a & n) + o[13] - 40341101 | 0, r = (r << 12 | r >>> 20) + a | 0, n += (r & a | ~r & i) + o[14] - 1502002290 | 0, n = (n << 17 | n >>> 15) + r | 0, i += (n & r | ~n & a) + o[15] + 1236535329 | 0, i = (i << 22 | i >>> 10) + n | 0, a += (i & r | n & ~r) + o[1] - 165796510 | 0, a = (a << 5 | a >>> 27) + i | 0, r += (a & n | i & ~n) + o[6] - 1069501632 | 0, r = (r << 9 | r >>> 23) + a | 0, n += (r & i | a & ~i) + o[11] + 643717713 | 0, n = (n << 14 | n >>> 18) + r | 0, i += (n & a | r & ~a) + o[0] - 373897302 | 0, i = (i << 20 | i >>> 12) + n | 0, a += (i & r | n & ~r) + o[5] - 701558691 | 0, a = (a << 5 | a >>> 27) + i | 0, r += (a & n | i & ~n) + o[10] + 38016083 | 0, r = (r << 9 | r >>> 23) + a | 0, n += (r & i | a & ~i) + o[15] - 660478335 | 0, n = (n << 14 | n >>> 18) + r | 0, i += (n & a | r & ~a) + o[4] - 405537848 | 0, i = (i << 20 | i >>> 12) + n | 0, a += (i & r | n & ~r) + o[9] + 568446438 | 0, a = (a << 5 | a >>> 27) + i | 0, r += (a & n | i & ~n) + o[14] - 1019803690 | 0, r = (r << 9 | r >>> 23) + a | 0, n += (r & i | a & ~i) + o[3] - 187363961 | 0, n = (n << 14 | n >>> 18) + r | 0, i += (n & a | r & ~a) + o[8] + 1163531501 | 0, i = (i << 20 | i >>> 12) + n | 0, a += (i & r | n & ~r) + o[13] - 1444681467 | 0, a = (a << 5 | a >>> 27) + i | 0, r += (a & n | i & ~n) + o[2] - 51403784 | 0, r = (r << 9 | r >>> 23) + a | 0, n += (r & i | a & ~i) + o[7] + 1735328473 | 0, n = (n << 14 | n >>> 18) + r | 0, i += (n & a | r & ~a) + o[12] - 1926607734 | 0, i = (i << 20 | i >>> 12) + n | 0, a += (i ^ n ^ r) + o[5] - 378558 | 0, a = (a << 4 | a >>> 28) + i | 0, r += (a ^ i ^ n) + o[8] - 2022574463 | 0, r = (r << 11 | r >>> 21) + a | 0, n += (r ^ a ^ i) + o[11] + 1839030562 | 0, n = (n << 16 | n >>> 16) + r | 0, i += (n ^ r ^ a) + o[14] - 35309556 | 0, i = (i << 23 | i >>> 9) + n | 0, a += (i ^ n ^ r) + o[1] - 1530992060 | 0, a = (a << 4 | a >>> 28) + i | 0, r += (a ^ i ^ n) + o[4] + 1272893353 | 0, r = (r << 11 | r >>> 21) + a | 0, n += (r ^ a ^ i) + o[7] - 155497632 | 0, n = (n << 16 | n >>> 16) + r | 0, i += (n ^ r ^ a) + o[10] - 1094730640 | 0, i = (i << 23 | i >>> 9) + n | 0, a += (i ^ n ^ r) + o[13] + 681279174 | 0, a = (a << 4 | a >>> 28) + i | 0, r += (a ^ i ^ n) + o[0] - 358537222 | 0, r = (r << 11 | r >>> 21) + a | 0, n += (r ^ a ^ i) + o[3] - 722521979 | 0, n = (n << 16 | n >>> 16) + r | 0, i += (n ^ r ^ a) + o[6] + 76029189 | 0, i = (i << 23 | i >>> 9) + n | 0, a += (i ^ n ^ r) + o[9] - 640364487 | 0, a = (a << 4 | a >>> 28) + i | 0, r += (a ^ i ^ n) + o[12] - 421815835 | 0, r = (r << 11 | r >>> 21) + a | 0, n += (r ^ a ^ i) + o[15] + 530742520 | 0, n = (n << 16 | n >>> 16) + r | 0, i += (n ^ r ^ a) + o[2] - 995338651 | 0, i = (i << 23 | i >>> 9) + n | 0, a += (n ^ (i | ~r)) + o[0] - 198630844 | 0, a = (a << 6 | a >>> 26) + i | 0, r += (i ^ (a | ~n)) + o[7] + 1126891415 | 0, r = (r << 10 | r >>> 22) + a | 0, n += (a ^ (r | ~i)) + o[14] - 1416354905 | 0, n = (n << 15 | n >>> 17) + r | 0, i += (r ^ (n | ~a)) + o[5] - 57434055 | 0, i = (i << 21 | i >>> 11) + n | 0, a += (n ^ (i | ~r)) + o[12] + 1700485571 | 0, a = (a << 6 | a >>> 26) + i | 0, r += (i ^ (a | ~n)) + o[3] - 1894986606 | 0, r = (r << 10 | r >>> 22) + a | 0, n += (a ^ (r | ~i)) + o[10] - 1051523 | 0, n = (n << 15 | n >>> 17) + r | 0, i += (r ^ (n | ~a)) + o[1] - 2054922799 | 0, i = (i << 21 | i >>> 11) + n | 0, a += (n ^ (i | ~r)) + o[8] + 1873313359 | 0, a = (a << 6 | a >>> 26) + i | 0, r += (i ^ (a | ~n)) + o[15] - 30611744 | 0, r = (r << 10 | r >>> 22) + a | 0, n += (a ^ (r | ~i)) + o[6] - 1560198380 | 0, n = (n << 15 | n >>> 17) + r | 0, i += (r ^ (n | ~a)) + o[13] + 1309151649 | 0, i = (i << 21 | i >>> 11) + n | 0, a += (n ^ (i | ~r)) + o[4] - 145523070 | 0, a = (a << 6 | a >>> 26) + i | 0, r += (i ^ (a | ~n)) + o[11] - 1120210379 | 0, r = (r << 10 | r >>> 22) + a | 0, n += (a ^ (r | ~i)) + o[2] + 718787259 | 0, n = (n << 15 | n >>> 17) + r | 0, i += (r ^ (n | ~a)) + o[9] - 343485551 | 0, i = (i << 21 | i >>> 11) + n | 0, u[0] = a + u[0] | 0, u[1] = i + u[1] | 0, u[2] = n + u[2] | 0, u[3] = r + u[3] | 0;
}
function c(u) {
var o = [], a;
for (a = 0; a < 64; a += 4)
o[a >> 2] = u.charCodeAt(a) + (u.charCodeAt(a + 1) << 8) + (u.charCodeAt(a + 2) << 16) + (u.charCodeAt(a + 3) << 24);
return o;
}
function f(u) {
var o = [], a;
for (a = 0; a < 64; a += 4)
o[a >> 2] = u[a] + (u[a + 1] << 8) + (u[a + 2] << 16) + (u[a + 3] << 24);
return o;
}
function m(u) {
var o = u.length, a = [1732584193, -271733879, -1732584194, 271733878], i, n, r, b, A, x;
for (i = 64; i <= o; i += 64)
h(a, c(u.substring(i - 64, i)));
for (u = u.substring(i - 64), n = u.length, r = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i = 0; i < n; i += 1)
r[i >> 2] |= u.charCodeAt(i) << (i % 4 << 3);
if (r[i >> 2] |= 128 << (i % 4 << 3), i > 55)
for (h(a, r), i = 0; i < 16; i += 1)
r[i] = 0;
return b = o * 8, b = b.toString(16).match(/(.*?)(.{0,8})$/), A = parseInt(b[2], 16), x = parseInt(b[1], 16) || 0, r[14] = A, r[15] = x, h(a, r), a;
}
function _(u) {
var o = u.length, a = [1732584193, -271733879, -1732584194, 271733878], i, n, r, b, A, x;
for (i = 64; i <= o; i += 64)
h(a, f(u.subarray(i - 64, i)));
for (u = i - 64 < o ? u.subarray(i - 64) : new Uint8Array(0), n = u.length, r = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i = 0; i < n; i += 1)
r[i >> 2] |= u[i] << (i % 4 << 3);
if (r[i >> 2] |= 128 << (i % 4 << 3), i > 55)
for (h(a, r), i = 0; i < 16; i += 1)
r[i] = 0;
return b = o * 8, b = b.toString(16).match(/(.*?)(.{0,8})$/), A = parseInt(b[2], 16), x = parseInt(b[1], 16) || 0, r[14] = A, r[15] = x, h(a, r), a;
}
function y(u) {
var o = "", a;
for (a = 0; a < 4; a += 1)
o += l[u >> a * 8 + 4 & 15] + l[u >> a * 8 & 15];
return o;
}
function g(u) {
var o;
for (o = 0; o < u.length; o += 1)
u[o] = y(u[o]);
return u.join("");
}
g(m("hello")), typeof ArrayBuffer < "u" && !ArrayBuffer.prototype.slice && function() {
function u(o, a) {
return o = o | 0 || 0, o < 0 ? Math.max(o + a, 0) : Math.min(o, a);
}
ArrayBuffer.prototype.slice = function(o, a) {
var i = this.byteLength, n = u(o, i), r = i, b, A, x, O;
return a !== s && (r = u(a, i)), n > r ? new ArrayBuffer(0) : (b = r - n, A = new ArrayBuffer(b), x = new Uint8Array(A), O = new Uint8Array(this, n, b), x.set(O), A);
};
}();
function $(u) {
return /[\u0080-\uFFFF]/.test(u) && (u = unescape(encodeURIComponent(u))), u;
}
function F(u, o) {
var a = u.length, i = new ArrayBuffer(a), n = new Uint8Array(i), r;
for (r = 0; r < a; r += 1)
n[r] = u.charCodeAt(r);
return o ? n : i;
}
function k(u) {
return String.fromCharCode.apply(null, new Uint8Array(u));
}
function C(u, o, a) {
var i = new Uint8Array(u.byteLength + o.byteLength);
return i.set(new Uint8Array(u)), i.set(new Uint8Array(o), u.byteLength), a ? i : i.buffer;
}
function U(u) {
var o = [], a = u.length, i;
for (i = 0; i < a - 1; i += 2)
o.push(parseInt(u.substr(i, 2), 16));
return String.fromCharCode.apply(String, o);
}
function S() {
this.reset();
}
return S.prototype.append = function(u) {
return this.appendBinary($(u)), this;
}, S.prototype.appendBinary = function(u) {
this._buff += u, this._length += u.length;
var o = this._buff.length, a;
for (a = 64; a <= o; a += 64)
h(this._hash, c(this._buff.substring(a - 64, a)));
return this._buff = this._buff.substring(a - 64), this;
}, S.prototype.end = function(u) {
var o = this._buff, a = o.length, i, n = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], r;
for (i = 0; i < a; i += 1)
n[i >> 2] |= o.charCodeAt(i) << (i % 4 << 3);
return this._finish(n, a), r = g(this._hash), u && (r = U(r)), this.reset(), r;
}, S.prototype.reset = function() {
return this._buff = "", this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this;
}, S.prototype.getState = function() {
return {
buff: this._buff,
length: this._length,
hash: this._hash.slice()
};
}, S.prototype.setState = function(u) {
return this._buff = u.buff, this._length = u.length, this._hash = u.hash, this;
}, S.prototype.destroy = function() {
delete this._hash, delete this._buff, delete this._length;
}, S.prototype._finish = function(u, o) {
var a = o, i, n, r;
if (u[a >> 2] |= 128 << (a % 4 << 3), a > 55)
for (h(this._hash, u), a = 0; a < 16; a += 1)
u[a] = 0;
i = this._length * 8, i = i.toString(16).match(/(.*?)(.{0,8})$/), n = parseInt(i[2], 16), r = parseInt(i[1], 16) || 0, u[14] = n, u[15] = r, h(this._hash, u);
}, S.hash = function(u, o) {
return S.hashBinary($(u), o);
}, S.hashBinary = function(u, o) {
var a = m(u), i = g(a);
return o ? U(i) : i;
}, S.ArrayBuffer = function() {
this.reset();
}, S.ArrayBuffer.prototype.append = function(u) {
var o = C(this._buff.buffer, u, !0), a = o.length, i;
for (this._length += u.byteLength, i = 64; i <= a; i += 64)
h(this._hash, f(o.subarray(i - 64, i)));
return this._buff = i - 64 < a ? new Uint8Array(o.buffer.slice(i - 64)) : new Uint8Array(0), this;
}, S.ArrayBuffer.prototype.end = function(u) {
var o = this._buff, a = o.length, i = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], n, r;
for (n = 0; n < a; n += 1)
i[n >> 2] |= o[n] << (n % 4 << 3);
return this._finish(i, a), r = g(this._hash), u && (r = U(r)), this.reset(), r;
}, S.ArrayBuffer.prototype.reset = function() {
return this._buff = new Uint8Array(0), this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this;
}, S.ArrayBuffer.prototype.getState = function() {
var u = S.prototype.getState.call(this);
return u.buff = k(u.buff), u;
}, S.ArrayBuffer.prototype.setState = function(u) {
return u.buff = F(u.buff, !0), S.prototype.setState.call(this, u);
}, S.ArrayBuffer.prototype.destroy = S.prototype.destroy, S.ArrayBuffer.prototype._finish = S.prototype._finish, S.ArrayBuffer.hash = function(u, o) {
var a = _(new Uint8Array(u)), i = g(a);
return o ? U(i) : i;
}, S;
});
})(nt);
const lt = nt.exports;
var ut = Object.defineProperty, ht = (e, t, s) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, d = (e, t, s) => ht(e, typeof t != "symbol" ? t + "" : t, s);
const E = (e, t) => toString.call(e).slice(8, -1).toLowerCase() === t, z = function(e) {
return typeof e == "function";
}, ct = (e) => E(e, "object"), q = (e) => ct(e) && e !== null, j = (e) => E(e, "array"), dt = (e) => e && z(e.then), pt = function(e) {
return E(e, "string");
}, ft = function(e) {
return E(e, "boolean");
};
let mt = 0;
const D = (e = "id") => `${e}-${+new Date()}-${mt++}`;
function L(e, t, s) {
if (j(e)) {
const c = e;
for (var l = 0, h = c.length; l < h && t.call(s, c[l], l, c) !== !1; l++)
;
} else {
const c = e;
for (const f in c)
if (Object.prototype.hasOwnProperty.call(c, f) && t.call(s, c[f], f, c) === !1)
break;
}
}
function M() {
var e, t, s, l, h, c, f = arguments[0] || {}, m = 1, _ = arguments.length, y = !1;
for (typeof f == "boolean" && (y = f, f = arguments[1] || {}, m++), typeof f != "object" && !z(f) && (f = {}), m === _ && (f = this, m--); m < _; m++)
if ((e = arguments[m]) != null)
for (t in e)
s = f[t], l = e[t], f !== l && (y && l && (q(l) || (h = j(l))) ? (h ? (h = !1, c = s && j(s) ? s : []) : c = s && q(s) ? s : {}, f[t] = M(y, c, l)) : l !== void 0 && (f[t] = l));
return f;
}
const P = (e) => typeof e == "function" ? e() || {} : q(e) ? e : {}, _t = (e) => {
if (!e || isNaN(Number(e)) || Number(e) <= 0 || e === "")
return "0 B";
const t = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], s = 1024, l = Number(e), h = Math.floor(Math.log(l) / Math.log(s));
return `${(l / Math.pow(s, h)).toFixed(2)} ${t[Math.min(h, t.length - 1)]}`;
}, gt = (e, t = 300) => {
let s = 0;
return function(...l) {
let h = +/* @__PURE__ */ new Date();
h - s > t && (s = h, e.apply(this, l));
};
};
class vt {
constructor(t) {
d(this, "uploader"), d(this, "listeners"), d(this, "inputs"), this.uploader = t, this.listeners = [], this.inputs = [];
}
assignBrowse(t, s = {}) {
if (!t) {
console.warn("DOM \u8282\u70B9\u4E0D\u5B58\u5728");
return;
}
const l = this.createOrGetInput(t);
this.setInputAttributes(l, s), this.attachBrowseEvents(t, l);
}
assignDrop(t) {
if (!t) {
console.warn("DOM \u8282\u70B9\u4E0D\u5B58\u5728");
return;
}
const s = (h) => h.preventDefault(), l = {
dragover: s,
dragenter: s,
dragleave: s,
drop: this.handleDrop.bind(this)
};
L(l, (h, c) => {
t.addEventListener(c, h, { passive: !1 }), this.listeners.push({ node: t, event: c, handler: h });
});
}
createOrGetInput(t) {
if (t instanceof HTMLInputElement && t.tagName === "INPUT" && t.type === "file")
return t;
const s = document.createElement("input");
return s.type = "file", M(s.style, {
visibility: "hidden",
position: "absolute",
width: "1px",
height: "1px"
}), t.appendChild(s), this.inputs.push(s), s;
}
setInputAttributes(t, s) {
L(s, (l, h) => t.setAttribute(h, l)), t.toggleAttribute("multiple", !!s.multiple);
}
attachBrowseEvents(t, s) {
const l = () => s.click(), h = (c) => {
const f = c.target;
this.uploader.addFiles(f.files), f.value = "";
};
t.addEventListener("click", l, { passive: !0 }), s.addEventListener("change", h, { passive: !0 }), this.listeners.push(
{ node: t, event: "click", handler: l },
{ node: s, event: "change", handler: h }
);
}
handleDrop(t) {
var s;
t.preventDefault(), t.stopPropagation(), t instanceof DragEvent && this.uploader.addFiles((s = t.dataTransfer) == null ? void 0 : s.files);
}
destroy() {
return this.listeners.forEach(({ node: t, event: s, handler: l }) => {
t.removeEventListener(s, l);
}), this.listeners = [], this.inputs.forEach((t) => {
t.parentNode && t.parentNode.removeChild(t);
}), this.inputs = [], this;
}
}
class yt {
constructor() {
d(this, "events"), this.events = /* @__PURE__ */ new Map();
}
on(t, s) {
if (!z(s))
return;
const l = this.events.get(t) || [];
l.includes(s) || (l.push(s), this.events.set(t, l));
}
off(t, s) {
var l;
if (!this.events.has(t))
return;
if (!s) {
this.events.set(t, []);
return;
}
const h = (l = this.events.get(t)) == null ? void 0 : l.filter((c) => c !== s);
this.events.set(t, h);
}
emit(t, ...s) {
const l = this.events.get(t);
l && l.length && l.forEach((h) => h(...s));
}
once(t, s) {
if (!z(s))
return;
const l = (...h) => {
s(...h), this.off(t, l);
};
this.on(t, l);
}
clear(t) {
if (!t) {
this.events.clear();
return;
}
this.events.has(t) && this.events.set(t, []);
}
}
const p = {
Init: "init",
AddFail: "addFail",
Reading: "reading",
Ready: "ready",
CheckFail: "checkFail",
Uploading: "uploading",
UploadSuccess: "uploadSuccess",
UploadFail: "uploadFail",
Success: "success",
Fail: "fail",
Pause: "pause",
Resume: "resume",
Removed: "removed"
}, w = {
Ready: "ready",
Pending: "pending",
Uploading: "uploading",
Success: "success",
Fail: "fail"
}, v = {
Exceed: "exceed",
FileAdded: "fileAdded",
FileAddFail: "fileAddFail",
FilesAdded: "filesAdded",
FileChange: "fileChange",
FileRemove: "fileRemove",
FileReadStart: "fileReadStart",
FileReadProgress: "fileReadProgress",
FileReadEnd: "fileReadEnd",
FileReadFail: "fileReadFail",
FilePause: "filePause",
FileResume: "fileResume",
FileProgress: "fileProgress",
FileUploadSuccess: "fileUploadSuccess",
FileUploadFail: "fileUploadFail",
FileSuccess: "fileSuccess",
FileFail: "fileFail",
AllFileSuccess: "allFileSuccess"
}, B = {
None: "none",
Part: "part",
WaitMerge: "waitMerge",
Success: "success"
}, N = {
Check: "check",
Upload: "upload",
Merge: "merge"
};
function Ft(e) {
const {
method: t = "POST",
withCredentials: s = !0,
responseType: l = "json",
action: h,
data: c,
headers: f,
onSuccess: m,
onFail: _,
onProgress: y
} = e;
let g = new XMLHttpRequest();
g.responseType = l, g.withCredentials = s, g.open(t, h, !0);
const $ = new FormData();
return Object.entries(c).forEach(([F, k]) => $.append(F, k)), "setRequestHeader" in g && Object.entries(f).forEach(([F, k]) => g.setRequestHeader(F, k)), g.addEventListener("timeout", () => {
_ && _(new Error("Request timed out"), g);
}), g.upload.addEventListener("progress", (F) => {
y && y(F);
}), g.addEventListener(
"error",
(F) => {
_ && _(F, g);
},
!1
), g.addEventListener("readystatechange", (F) => {
if (g.readyState === 4) {
if (g.status < 200 || g.status >= 300) {
_ && _(new Error(`xhr: status === ${g.status}`), g);
return;
}
m && m(F, g);
}
}), g.send($), {
abort() {
g.abort(), g = null;
}
};
}
class St {
constructor(t, s) {
d(this, "uploader"), d(this, "options"), d(this, "file"), d(this, "fileId"), d(this, "rawFile"), d(this, "fileHash"), d(this, "filename"), d(this, "totalSize"), d(this, "chunkSize"), d(this, "totalChunks"), d(this, "uid"), d(this, "chunkIndex"), d(this, "status"), d(this, "startByte"), d(this, "endByte"), d(this, "size"), d(this, "maxRetries"), d(this, "progress"), d(this, "fakeProgress"), d(this, "timer"), d(this, "request"), d(this, "customRequest"), this.uploader = t.uploader, this.options = t.uploader.options, this.file = t, this.rawFile = t.rawFile, this.fileId = t.uid, this.fileHash = t.hash, this.filename = t.name, this.totalSize = t.size, this.chunkSize = this.options.chunkSize, this.totalChunks = t.totalChunks, this.uid = D(), this.chunkIndex = s, this.status = w.Ready, this.startByte = this.chunkSize * s, this.endByte = Math.min(this.startByte + this.chunkSize, this.totalSize), this.size = this.endByte - this.startByte, this.maxRetries = this.options.maxRetries, this.progress = 0, this.fakeProgress = 0, this.timer = null, this.request = null, this.customRequest = this.options.customRequest || Ft;
}
onSuccess(t, s, l, h) {
this.options.requestSucceed(s) ? (this.status = w.Success, this.file.removeUploadingChunk(this), this.file.isUploading() && this.file.upload(), l(this)) : this.onFail(t, h);
}
onFail(t, s) {
var l;
this.progress = 0, this.file.setProgress(), !((l = this.request) != null && l.canceled) && (this.maxRetries <= 0 ? (this.file.removeUploadingChunk(this), this.status = w.Fail, this.file.isUploading() && this.file.upload(), s(t, this)) : this.timer = setTimeout(() => {
this.send(), this.maxRetries--, clearTimeout(this.timer);
}, this.options.retryInterval));
}
onProgress(t) {
this.progress = Math.min(1, t.loaded / t.total), this.fakeProgress = Math.max(this.progress, this.fakeProgress), this.status = w.Uploading, this.file.changeStatus(p.Uploading), this.file.setProgress();
}
prepare() {
const { name: t, data: s, processData: l } = this.options, { data: h } = this.file, c = {
[t]: this.file.rawFile.slice(this.startByte, this.endByte),
hash: this.fileHash,
id: this.uid,
fileId: this.fileId,
index: this.chunkIndex,
filename: this.filename,
size: this.size,
totalSize: this.totalSize,
totalChunks: this.totalChunks,
...P(s),
...h
};
return z(l) && l(c, N.Upload) || c;
}
send() {
this.status = w.Pending;
const { action: t, headers: s, withCredentials: l, name: h } = this.options;
return new Promise((c, f) => {
this.request = this.customRequest({
action: t,
name: h,
withCredentials: l,
headers: P(s),
data: this.prepare(),
query: {
...P(this.options.data),
...this.file.data
},
onSuccess: (m, _) => this.onSuccess(m, _, c, f),
onFail: (m) => this.onFail(m, f),
onProgress: (m) => this.onProgress(m)
}), this.request.canceled = !1;
});
}
abort() {
this.status = w.Ready, this.request && (this.request.canceled = !0, this.request.abort()), this.timer && clearTimeout(this.timer);
}
}
class I {
constructor(t, s, l) {
d(this, "uploader"), d(this, "options"), d(this, "hasher"), d(this, "id"), d(this, "uid"), d(this, "status"), d(this, "prevStatusLastRecord"), d(this, "rawFile"), d(this, "name"), d(this, "size"), d(this, "type"), d(this, "hash"), d(this, "url"), d(this, "progress"), d(this, "chunkSize"), d(this, "chunks"), d(this, "totalChunks"), d(this, "uploadingChunks"), d(this, "readProgress"), d(this, "errorMessage"), d(this, "data"), d(this, "abortRead"), this.uploader = s, this.options = this.uploader.options, this.hasher = this.uploader.hasher, this.prevStatusLastRecord = [], this.rawFile = t, this.name = t.name, this.size = t.size, this.type = t.type, this.hash = "", this.url = "", this.status = "", this.progress = 0, this.chunkSize = this.options.chunkSize, this.chunks = [], this.totalChunks = 0, this.uploadingChunks = /* @__PURE__ */ new Set(), this.readProgress = 0, this.errorMessage = "", this.data = {}, this.uid = this.generateId(), l ? (Object.keys(l).forEach((h) => {
this[h] = l[h];
}), this.name = l.name, this.url = l.url, this.readProgress = 1, this.progress = 1, this.changeStatus(p.Success)) : this.changeStatus(p.Init);
}
generateId() {
const { customGenerateUid: t } = this.options;
return !t || !z(t) ? D() : t(this) || D();
}
setErrorMessage(t) {
return this.errorMessage = String(t), this;
}
setData(t) {
return this.data = { ...this.data, ...t }, this;
}
get renderSize() {
return _t(this.size);
}
changeStatus(t) {
(t !== this.status || t === p.Reading) && (this.prevStatusLastRecord.push(this.status), this.status = t, this.uploader && this.uploader.emitCallback && this.uploader.emitCallback(v.FileChange, this));
}
isInit() {
return this.status === p.Init;
}
isAddFail() {
return this.status === p.AddFail;
}
isReading() {
return this.status === p.Reading;
}
isReady() {
return this.status === p.Ready;
}
isCheckFail() {
return this.status === p.CheckFail;
}
isUploading() {
return this.status === p.Uploading;
}
isUploadSuccess() {
return this.status === p.UploadSuccess;
}
isUploadFail() {
return this.status === p.UploadFail;
}
isSuccess() {
return this.status === p.Success;
}
isFail() {
return this.status === p.Fail;
}
isPause() {
return this.status === p.Pause;
}
isResume() {
return this.status === p.Resume;
}
createChunks() {
this.totalChunks = Math.ceil(this.size / this.chunkSize) || 1, this.chunks = Array.from({ length: this.totalChunks }, (t, s) => new St(this, s));
}
async read() {
if (!this.options.withHash) {
this.createChunks(), this.changeStatus(p.Ready);
return;
}
this.uploader.emitCallback(v.FileReadStart, this), this.changeStatus(p.Reading);
try {
const t = Date.now(), { hash: s, progress: l } = await this._computeHash();
this.hash = s, this.readProgress = l, this.uploader.emitCallback(v.FileReadEnd, this), console.log(
`${this.options.useWebWoker ? "Web Worker" : "Main Thread"} read file took`,
(Date.now() - t) / 1e3,
"s"
), this.abortRead = null;
} catch (t) {
throw console.warn(t.message), t && t.message && t.message.toLowerCase().includes("cancel") || this.setErrorMessage("File read failed"), this.changeStatus(p.Init), this.uploader.emitCallback(v.FileReadFail, this), new Error("File read failed");
}
this.createChunks(), this.changeStatus(p.Ready);
}
async _computeHash() {
try {
const t = gt((c) => {
this.readProgress = c, this.uploader.emitCallback(v.FileReadProgress, this);
}, 200);
if (this.options.useWebWoker && this.hasher.hashionName !== "sparkMd5Webworker")
throw new Error(`
Please install "SparkWorker" plugin -> npm i hashion;
https://www.npmjs.com/package/hashion
`);
const { promise: s, abort: l } = this.hasher.computedHash(
{
file: this.rawFile,
chunkSize: this.chunkSize
},
({ progress: c }) => t(c)
);
this.abortRead = l;
const h = await s;
return t(h.progress), h;
} catch (t) {
throw t;
}
}
_processData(t) {
const { data: s, processData: l } = this.options, h = { ...P(s), ...this.data };
return z(l) && l(h, t) || h;
}
async checkRequest() {
const { checkRequest: t } = this.options;
if (!z(t))
return Promise.resolve();
const s = (h) => {
this.chunks.forEach((c) => {
c.status = h, h === w.Success && (c.progress = 1, c.fakeProgress = 1);
});
}, l = {
[B.Part]: (h) => {
this.chunks.forEach((c) => {
h.includes(c.chunkIndex) && (c.status = w.Success, c.progress = 1, c.fakeProgress = 1);
});
},
[B.WaitMerge]: () => {
this.changeStatus(p.UploadSuccess), s(w.Success);
},
[B.Success]: (h) => {
this.changeStatus(p.Success), s(w.Success), this.url = h;
},
[B.None]: () => {
}
};
try {
const h = await Promise.resolve(
t(this, this._processData(N.Check), P(this.options.headers))
);
if (!h || !h.status)
throw new Error("Invalid check response format");
const c = l[h.status];
if (!c)
throw new Error(`Unknown check status: ${h.status}`);
return c(h.data), Promise.resolve();
} catch (h) {
this.changeStatus(p.CheckFail), this.uploader.upload();
const c = new Error(`Check request failed: ${h.message}`);
throw c.originalError = h, c;
}
}
addUploadingChunk(t) {
this.uploadingChunks.add(t);
}
removeUploadingChunk(t) {
this.uploadingChunks.delete(t);
}
async upload() {
if (this.isInit() && await this.read(), this.isReady() && this.options.checkRequest && (await this.checkRequest(), this.status === p.Pause))
return;
if (this.isUploadSuccess())
return this.merge();
if (this.isSuccess())
return this.success();
const t = this.chunks.filter((s) => s.status === w.Ready);
if (L(t, () => {
if (this.uploadingChunks.size >= this.options.maxConcurrency)
return !1;
const s = t.shift();
if (s)
this.addUploadingChunk(s);
else
return !1;
}), this.uploadingChunks.size > 0) {
const s = [...this.uploadingChunks].filter(
(l) => l.status === w.Ready
);
Promise.race(s.map((l) => l.send()));
return;
}
this.chunks.some((s) => s.status === w.Fail) ? this.uploadFail() : (this.uploadSuccess(), this.setProgress(), this.merge());
}
setProgress() {
const t = this.chunks.reduce((s, l) => {
const h = this.options.fakeProgress ? l.fakeProgress : l.progress;
return s += h * (l.size / this.size);
}, 0);
this.progress = Math.min(1, t), (this.isUploadSuccess() || this.isSuccess()) && (this.progress = 1), this.uploader.emitCallback(v.FileProgress, this);
}
uploadFail() {
this.changeStatus(p.UploadFail), this.uploader.emitCallback(v.FileUploadFail, this), this._continueUpload();
}
uploadSuccess() {
this.changeStatus(p.UploadSuccess), this.uploader.emitCallback(v.FileUploadSuccess, this);
}
async merge() {
const { mergeRequest: t } = this.options;
if (!z(t))
return this.success();
try {
const s = t(
this,
this._processData(N.Merge),
P(this.options.headers)
), l = await Promise.resolve(s);
ft(l) ? l ? this.success() : this.mergeFail() : (this.url = l, this.success());
} catch (s) {
console.log(s), this.mergeFail();
}
}
mergeFail() {
this.changeStatus(p.Fail), this.uploader.emitCallback(v.FileFail, this), this._continueUpload();
}
success() {
this.changeStatus(p.Success), this.progress = 1, this.uploader.emitCallback(v.FileSuccess, this), this._continueUpload();
}
_continueUpload() {
const t = this.uploader.fileList.find((s) => s.isPause());
t && t.resume(), this.uploader.upload();
}
cancel() {
this.uploadingChunks.forEach((t) => t.abort()), this.uploadingChunks.clear();
}
async remove() {
this.abortRead && this.abortRead(), setTimeout(() => {
this.cancel(), this.chunks = [], this.changeStatus("removed");
const t = this.uploader.fileList.indexOf(this);
t > -1 && this.uploader.fileList.splice(t, 1), this.uploader.emitCallback(v.FileRemove, this), this.uploader.upload();
}, 0);
}
pause() {
this.abortRead && this.abortRead(), setTimeout(() => {
this.cancel(), this.changeStatus(p.Pause), this.uploader.emitCallback(v.FilePause, this), this.uploader.upload();
}, 0);
}
resume() {
this.isPause() && (this.changeStatus(p.Resume), this.uploader.emitCallback(v.FileResume, this), this.uploader.upload());
}
retry() {
if (!this.isAddFail()) {
if (this.isCheckFail()) {
this.changeStatus(p.Ready), this.upload();
return;
}
if (this.isUploadSuccess() || this.isFail()) {
this.merge();
return;
}
this.isUploadFail() && (L(this.chunks, (t) => {
t.status === w.Fail && (t.status = w.Ready, t.maxRetries = t.options.maxRetries);
}), this.upload());
}
}
}
const bt = {
accept: "*",
multiple: !0,
fileList: [],
limit: 10,
autoUpload: !0,
customGenerateUid: void 0,
beforeAdd: (e) => !0,
beforeRemove: (e) => !0,
addFailToRemove: !0,
chunkSize: 2 * 1024 * 1024,
fakeProgress: !0,
withHash: !0,
useWebWoker: !1,
name: "file",
action: "",
customRequest: null,
withCredentials: !0,
headers: {},
data: {},
requestSucceed: (e) => [200, 201, 202, 206].includes(e.status),
maxConcurrency: 6,
maxRetries: 3,
retryInterval: 1e3,
checkRequest: (e) => ({ status: B.None }),
mergeRequest: (e) => !0,
processData: (e, t) => e
};
var wt = Object.defineProperty, Rt = (e, t, s) => t in e ? wt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, W = (e, t, s) => Rt(e, typeof t != "symbol" ? t + "" : t, s);
class Ct {
constructor(t, s) {
W(this, "hashCarrier"), W(this, "hashionName"), this.hashionName = t.name, this.hashCarrier = new t(s);
}
computedHash({ file: t, chunkSize: s }, l) {
let h;
return {
promise: new Promise((c, f) => {
Promise.resolve(
this.hashCarrier.computeHash(
{
file: t,
chunkSize: s
},
(m, { progress: _, hash: y, time: g }) => {
m && f(m), _ === 100 && c({ progress: _, hash: y, time: g }), l && l({ progress: _ });
}
)
).then((m) => {
h = { abort: m == null ? void 0 : m.abort, reject: f };
});
}),
abort: () => {
h && (h.abort && h.abort(), h.reject(new Error("Canceled promise to rejected")));
}
};
}
}
var $t = Object.defineProperty, zt = (e, t, s) => t in e ? $t(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, T = (e, t, s) => zt(e, typeof t != "symbol" ? t + "" : t, s);
const kt = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;
class H {
constructor() {
T(this, "name"), this.name = "spark-md5";
}
async computeHash(t, s) {
const { file: l, chunkSize: h } = t;
let c = !1;
const f = new lt.ArrayBuffer(), m = new FileReader(), _ = Math.ceil(l.size / h), y = Date.now();
let g = 0;
const $ = new AbortController(), F = $.signal;
F.addEventListener("abort", () => {
c || (m.abort(), s(new Error("Hash calculation cancelled"), { progress: 0 }));
}), m.onload = function(C) {
var U;
if (!F.aborted)
if (f.append((U = C.target) == null ? void 0 : U.result), g++, g < _)
k(), s(null, {
progress: g / _ * 100
});
else {
c = !0, s(null, {
hash: f.end(),
time: Date.now() - y,
progress: 100
});
return;
}
}, m.onerror = function(C) {
F.aborted || (console.warn("spark-md5: Hash calculation error"), s(C, { progress: 0 }));
};
function k() {
if (F.aborted)
return;
const C = g * h, U = C + h >= l.size ? l.size : C + h;
m.readAsArrayBuffer(kt.call(l, C, U));
}
return k(), {
abort: () => $.abort()
};
}
}
T(H, "pluginName", "hash-plugin"), T(H, "name", "spark-md5");
class Ut {
constructor(t) {
d(this, "container"), d(this, "event"), d(this, "options"), d(this, "hasher"), d(this, "fileList"), this.container = new vt(this), this.event = new yt(), this.options = M(bt, t), this.hasher = null, this.fileList = (this.options.fileList || []).map((s) => new I(s, this, s)), this._setupFileListeners(), this.use(H);
}
on(t, s) {
this.event.on(t, s);
}
emit(t, ...s) {
this.event.emit(t, ...s);
}
emitCallback(t, ...s) {
this.emit(t, ...s, this.fileList);
}
updateData(t) {
this.options.data = t;
}
updateHeaders(t) {
this.options.headers = t;
}
setOption(t) {
this.options = M(this.options, t);
}
use(t) {
t.pluginName === "hash-plugin" && (this.hasher = new Ct(t));
}
formatAccept(t) {
return pt(t) ? t : Array.isArray(t) ? t.join(",") : "";
}
assignBrowse(t, s = {}) {
const { accept: l, ...h } = s, c = {
multiple: this.options.multiple,
accept: this.formatAccept(l || this.options.accept)
};
this.container.assignBrowse(t, M({}, c, h));
}
assignDrop(t) {
this.container.assignDrop(t);
}
_setupFileListeners() {
const t = (s, l) => {
!l.length || l.every((h) => h.isSuccess()) && this.emit(v.AllFileSuccess, this.fileList);
};
this.on(v.FileSuccess, t), this.on(v.FileRemove, t);
}
setDefaultFileList(t) {
t.forEach((s) => {
this.fileList.push(new I(s, this, s));
});
}
async addFiles(t) {
const { limit: s, multiple: l, addFailToRemove: h, beforeAdd: c, autoUpload: f } = this.options;
let m = [...t];
if (m.length === 0)
return;
if (s > 0 && m.length + this.fileList.length > s) {
this.emitCallback(v.Exceed, m);
return;
}
l || (m = m.slice(0, 1));
const _ = m.map((y) => new I(y, this, null));
await Promise.all(_.map((y) => this._handleFileAdd(y, c))), this.fileList = this.fileList.filter((y) => y.isAddFail() && h ? (this.doRemove(y), !1) : !0), _.length > 0 && this.emitCallback(v.FilesAdded, this.fileList), f && this.submit();
}
async _handleFileAdd(t, s) {
try {
if (z(s) && await s(t) === !1)
throw new Error("Before add rejected");
this.emitCallback(v.FileAdded, t);
} catch {
t.changeStatus(p.AddFail), this.emitCallback(v.FileAddFail, t);
}
this.fileList.push(t);
}
async upload() {
if (this.fileList.length !== 0)
for (let t = 0; t < this.fileList.length; t++) {
const s = this.fileList[t];
if (!(s.isAddFail() || s.isCheckFail())) {
if (s.isUploading() || s.isReading())
return;
if (s.isResume()) {
const l = s.prevStatusLastRecord[s.prevStatusLastRecord.length - 2];
l && s.changeStatus(l), s.upload();
return;
}
if (s.isReady() || s.isInit()) {
s.upload();
return;
}
}
}
}
submit() {
this.upload();
}
remove(t) {
const { beforeRemove: s } = this.options;
if (!s)
this.doRemove(t);
else if (z(s)) {
const l = s(t);
dt(l) ? l.then(() => {
this.doRemove(t);
}) : l !== !1 && this.doRemove(t);
}
}
clear() {
for (let t = this.fileList.length - 1; t >= 0; t--)
this.fileList[t].remove();
this.fileList = [];
}
doRemove(t) {
if (!t) {
this.clear();
return;
}
t.remove();
}
pause(t) {
!t || this.fileList.indexOf(t) > -1 && t.pause();
}
resume(t) {
!t || (this.fileList.filter((s) => s.isUploading() || s.isReading()).forEach((s) => {
s.pause();
}), t.resume());
}
retry(t) {
!t || (this.fileList.filter((s) => s.isUploading() || s.isReading()).forEach((s) => {
s.pause();
}), this.fileList.indexOf(t) > -1 && t.retry());
}
destroy() {
this.clear(), this.event.clear(), this.container.destroy();
}
}
var At = function() {
var e = this, t = e.$createElement, s = e._self._c || t;
return s("svg", {
staticClass: "tiny-uploader-icon tiny-uploader-icon-upload",
attrs: {
t: "1722479862858",
viewBox: "0 0 1024 1024",
version: "1.1",
xmlns: "http://www.w3.org/2000/svg",
"p-id": "20916",
width: e.size,
height: e.size
}
}, [s("path", {
attrs: {
d: "M789.464615 885.799385h-168.448c-70.025846 0-125.794462-58.958769-125.794461-130.244923v-243.239385c0-9.846154 8.310154-18.432 17.801846-18.432 9.491692 0 17.801846 8.585846 17.801846 18.432v242.018461c0 51.593846 40.329846 93.380923 90.190769 93.380924h168.448c84.283077 0 154.269538-65.102769 158.995693-148.637539 2.363077-44.228923-11.815385-87.236923-41.511385-119.177846-29.656615-31.940923-68.804923-50.412308-112.718769-50.412308h-3.544616a19.298462 19.298462 0 0 1-14.25723-6.104615c-3.544615-4.923077-4.726154-9.846154-3.544616-15.990154 7.089231-35.603692 8.270769-72.467692 1.181539-108.110769-20.164923-119.177846-116.302769-210.077538-232.566154-223.586462-74.752-8.625231-148.322462 15.950769-205.272615 68.804923a278.134154 278.134154 0 0 0-89.009231 203.933539c0 8.585846-5.907692 17.211077-15.399385 18.432-92.553846 13.508923-160.177231 98.264615-156.632615 196.529231 3.544615 100.785231 90.190769 184.32 192.196923 184.32h81.92c9.452308 0 17.762462 8.585846 17.762461 18.432s-8.270769 17.211077-18.983384 17.211076H266.24c-119.847385 0-221.892923-98.304-226.619077-218.702769-4.765538-111.812923 68.804923-208.856615 172.032-232.211692 4.726154-82.313846 40.329846-159.704615 100.824615-215.000615 64.078769-58.958769 147.140923-87.236923 233.787077-77.39077 131.702154 13.508923 240.836923 117.956923 263.404308 253.085539 5.907692 34.422154 7.089231 67.584 2.363077 100.745846a179.790769 179.790769 0 0 1 121.028923 61.44c36.785231 40.566154 54.587077 92.16 51.003077 147.416615-5.907692 102.006154-91.372308 183.059692-194.56 183.059693z",
"p-id": "20917"
}
}), s("path", {
attrs: {
d: "M652.996923 649.924923a17.486769 17.486769 0 0 1-12.996923-4.923077l-128.157538-133.907692-128.157539 132.686769a16.817231 16.817231 0 0 1-24.891077 0 18.235077 18.235077 0 0 1 0-25.796923l141.193846-146.195692c7.089231-7.404308 18.983385-7.404308 24.891077 0l141.193846 146.195692c7.128615 7.364923 7.128615 18.432 0 25.796923a18.786462 18.786462 0 0 1-13.036307 6.144z",
"p-id": "20918"
}
})]);
}, xt = [];
function R(e, t, s, l, h, c, f, m) {
var _ = typeof e == "function" ? e.options : e;
t && (_.render = t, _.staticRenderFns = s, _._compiled = !0), l && (_.functional = !0), c && (_._scopeId = "data-v-" + c);
var y;
if (f ? (y = function(F) {
F = F || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !F && typeof __VUE_SSR_CONTEXT__ < "u" && (F = __VUE_SSR_CONTEXT__), h && h.call(this, F), F && F._registeredComponents && F._registeredComponents.add(f);
}, _._ssrRegister = y) : h && (y = m ? function() {
h.call(
this,
(_.functional ? this.parent : this).$root.$options.shadowRoot
);
} : h), y)
if (_.functional) {
_._injectStyles = y;
var g = _.render;
_.render = function(k, C) {
return y.call(C), g(k, C);
};
} else {
var $ = _.beforeCreate;
_.beforeCreate = $ ? [].concat($, y) : [y];
}
return {
exports: e,
options: _
};
}
const Pt = {
props: {
size: {
type: Number,
default: 32
}
}
}, V = {};
var Bt = /* @__PURE__ */ R(
Pt,
At,
xt,
!1,
Mt,
null,
null,
null
);
function Mt(e) {
for (let t in V)
this[t] = V[t];
}
const Lt = /* @__PURE__ */ function() {
return Bt.exports;
}();
var Et = function() {
var e = this, t = e.$createElement, s = e._self._c || t;
return s("span", {
staticClass: "tiny-uploader-button"
}, [e._t("default")], 2);
}, It = [];
const qt = {}, G = {};
var jt = /* @__PURE__ */ R(
qt,
Et,
It,
!1,
Dt,
null,
null,
null
);
function Dt(e) {
for (let t in G)
this[t] = G[t];
}
const Nt = /* @__PURE__ */ function() {
return jt.exports;
}(), ot = {
inject: ["instance"],
computed: {
uploader() {
return this.instance();
}
}
};
var Tt = function() {
var e = this, t = e.$createElement, s = e._self._c || t;
return s("div", {
ref: "dropRef",
staticClass: "tiny-uploader-drop"
}, [e._t("default")], 2);
}, Ht = [];
const Ot = {
mixins: [ot],
mounted() {
this.$nextTick(() => {
this.uploader.assignBrowse(this.$refs.dropRef), this.uploader.assignDrop(this.$refs.dropRef);
});
}
}, X = {};
var Wt = /* @__PURE__ */ R(
Ot,
Tt,
Ht,
!1,
Vt,
null,
null,
null
);
function Vt(e) {
for (let t in X)
this[t] = X[t];
}
const Gt = /* @__PURE__ */ function() {
return Wt.exports;
}();
var Xt = function() {
var e = this, t = e.$createElement, s = e._self._c || t;
return s("svg", {
staticClass: "tiny-uploader-icon tiny-uploader-icon-file",
attrs: {
t: "1720146896680",
viewBox: "0 0 1024 1024",
version: "1.1",
xmlns: "http://www.w3.org/2000/svg",
"p-id": "69323",
width: e.size,
height: e.size
}
}, [s("path", {
attrs: {
d: "M842.666667 285.866667l-187.733334-187.733334c-14.933333-14.933333-32-21.333333-53.333333-21.333333H234.666667C194.133333 74.666667 160 108.8 160 149.333333v725.333334c0 40.533333 34.133333 74.666667 74.666667 74.666666h554.666666c40.533333 0 74.666667-34.133333 74.666667-74.666666V337.066667c0-19.2-8.533333-38.4-21.333333-51.2z m-44.8 44.8c-2.133333 2.133333-4.266667 0-8.533334 0h-170.666666c-6.4 0-10.666667-4.266667-10.666667-10.666667V149.333333c0-2.133333 0-6.4-2.133333-8.533333 0 0 2.133333 0 2.133333 2.133333l189.866667 187.733334z m-8.533334 554.666666H234.666667c-6.4 0-10.666667-4.266667-10.666667-10.666666V149.333333c0-6.4 4.266667-10.666667 10.666667-10.666666h311.466666c-2.133333 4.266667-2.133333 6.4-2.133333 10.666666v170.666667c0 40.533333 34.133333 74.666667 74.666667 74.666667h170.666666c4.266667 0 6.4 0 10.666667-2.133334V874.666667c0 6.4-4.266667 10.666667-10.666667 10.666666z",
fill: "#666666",
"p-id": "69324"
}
}), s("path", {
attrs: {
d: "M640 693.333333H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM640 522.666667H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM341.333333 416h85.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-85.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32z",
fill: "#666666",
"p-id": "69325"
}
})]);
}, Yt = [];
const Zt = {
props: {
size: {
type: Number,
default: 32
}
}
}, Y = {};
var Jt = /* @__PURE__ */ R(
Zt,
Xt,
Yt,
!1,
Kt,
null,
null,
null
);
function Kt(e) {
for (let t in Y)
this[t] = Y[t];
}
const Qt = /* @__PURE__ */ function() {
return Jt.exports;
}();
var te = function() {
var e = this, t = e.$createElement, s = e._self._c || t;
return s("svg", {
staticClass: "tiny-uploader-icon tiny-uploader-icon--loading",
attrs: {
t: "1744164716366",
viewBox: "0 0 1024 1024",
version: "1.1",
xmlns: "http://www.w3.org/2000/svg",
"p-id": "10889",
width: e.size,
height: e.size
}
}, [s("path", {
attrs: {
d: "M876.864 782.592c3.264 0 6.272-3.2 6.272-6.656 0-3.456-3.008-6.592-6.272-6.592-3.264 0-6.272 3.2-6.272 6.592 0 3.456 3.008 6.656 6.272 6.656z m-140.544 153.344c2.304 2.432 5.568 3.84 8.768 3.84a12.16 12.16 0 0 0 8.832-3.84 13.76 13.76 0 0 0 0-18.56 12.224 12.224 0 0 0-8.832-3.84 12.16 12.16 0 0 0-8.768 3.84 13.696 13.696 0 0 0 0 18.56zM552.32 1018.24c3.456 3.648 8.32 5.76 13.184 5.76a18.368 18.368 0 0 0 13.184-5.76 20.608 20.608 0 0 0 0-27.968 18.368 18.368 0 0 0-13.184-5.824 18.368 18.368 0 0 0-13.184 5.76 20.608 20.608 0 0 0 0 28.032z m-198.336-5.76c4.608 4.8 11.072 7.68 17.6 7.68a24.448 24.448 0 0 0 17.536-7.68 27.456 27.456 0 0 0 0-37.248 24.448 24.448 0 0 0-17.536-7.68 24.448 24.448 0 0 0-17.6 7.68 27.52 27.52 0 0 0 0 37.184z m-175.68-91.84c5.76 6.08 13.824 9.6 21.952 9.6a30.592 30.592 0 0 0 22.016-9.6 34.368 34.368 0 0 0 0-46.592 30.592 30.592 0 0 0-22.016-9.6 30.592 30.592 0 0 0-21.952 9.6 34.368 34.368 0 0 0 0 46.592z m-121.152-159.36c6.912 7.36 16.64 11.648 26.368 11.648a36.736 36.736 0 0 0 26.432-11.584 41.28 41.28 0 0 0 0-55.936 36.736 36.736 0 0 0-26.432-11.584 36.8 36.8 0 0 0-26.368 11.52 41.28 41.28 0 0 0 0 56zM12.736 564.672a42.88 42.88 0 0 0 30.784 13.44 42.88 42.88 0 0 0 30.784-13.44 48.128 48.128 0 0 0 0-65.216 42.88 42.88 0 0 0-30.72-13.44 42.88 42.88 0 0 0-30.848 13.44 48.128 48.128 0 0 0 0 65.216z m39.808-195.392a48.96 48.96 0 0 0 35.2 15.36 48.96 48.96 0 0 0 35.2-15.36 54.976 54.976 0 0 0 0-74.56 48.96 48.96 0 0 0-35.2-15.424 48.96 48.96 0 0 0-35.2 15.424 54.976 54.976 0 0 0 0 74.56zM168.32 212.48c10.368 11.008 24.96 17.408 39.68 17.408 14.592 0 29.184-6.4 39.552-17.408a61.888 61.888 0 0 0 0-83.84 55.104 55.104 0 0 0-39.616-17.408c-14.656 0-29.248 6.4-39.616 17.408a61.888 61.888 0 0 0 0 83.84zM337.344 124.8c11.52 12.16 27.712 19.264 43.968 19.264 16.256 0 32.448-7.04 43.968-19.264a68.672 68.672 0 0 0 0-93.184 61.248 61.248 0 0 0-43.968-19.264 61.248 61.248 0 0 0-43.968 19.264 68.736 68.736 0 0 0 0 93.184z m189.632-1.088c12.672 13.44 30.528 21.248 48.448 21.248s35.712-7.808 48.384-21.248a75.584 75.584 0 0 0 0-102.464A67.392 67.392 0 0 0 575.36 0c-17.92 0-35.776 7.808-48.448 21.248a75.584 75.584 0 0 0 0 102.464z m173.824 86.592c13.824 14.592 33.28 23.104 52.736 23.104 19.584 0 39.04-8.512 52.8-23.104a82.432 82.432 0 0 0 0-111.744 73.472 73.472 0 0 0-52.8-23.168c-19.52 0-38.912 8.512-52.736 23.168a82.432 82.432 0 0 0 0 111.744z m124.032 158.528c14.976 15.872 36.032 25.088 57.216 25.088 21.12 0 42.24-9.216 57.152-25.088a89.344 89.344 0 0 0 0-121.088 79.616 79.616 0 0 0-57.152-25.088c-21.184 0-42.24 9.216-57.216 25.088a89.344 89.344 0 0 0 0 121.088z m50.432 204.032c16.128 17.088 38.784 27.008 61.632 27.008 22.784 0 45.44-9.92 61.568-27.008a96.256 96.256 0 0 0 0-130.432 85.76 85.76 0 0 0-61.568-27.072c-22.848 0-45.44 9.984-61.632 27.072a96.192 96.192 0 0 0 0 130.432z",
fill: "#262626",
"p-id": "10890"
}
})]);
}, ee = [];
const se = {
props: {
size: {
type: Number,
default: 32
}
}
}, Z = {};
var ie = /* @__PURE__ */ R(
se,
te,
ee,
!1,
ae,
null,
null,
null
);
function ae(e) {
for (let t in Z)
this[t] = Z[t];
}
const re = /* @__PURE__ */ function() {
return ie.exports;
}();
var ne = function() {
var e = this, t = e.$createElement, s = e._self._c || t;
return s("svg", {
staticClass: "tiny-uploader-icon tiny-uploader-icon-pause",
attrs: {
t: "1720146081573",
viewBox: "0 0 1024 1024",
version: "1.1",
xmlns: "http://www.w3.org/2000/svg",
"p-id": "50387",
width: e.size,
height: e.size
}
}, [s("path", {
attrs: {
d: "M640.229819 336.813079c30.19669 0 54.674007 24.477317 54.674006 54.674007v244.423206c0 30.19669-24.477317 54.674007-54.674006 54.674007s-54.674007-24.477317-54.674007-54.674007V391.487086c-0.009999-30.19669 24.477317-54.674007 54.