wcz-test 7.0.2 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/DialogsContext-8xfQ3X-k.js +285 -0
  2. package/dist/DialogsContext-8xfQ3X-k.js.map +1 -0
  3. package/dist/{DialogsHooks-BZUdpDVJ.js → DialogsHooks-BXfwbYWP.js} +14 -14
  4. package/dist/{DialogsHooks-BZUdpDVJ.js.map → DialogsHooks-BXfwbYWP.js.map} +1 -1
  5. package/dist/FileMeta-CDQ1BQUH.js +21 -0
  6. package/dist/FileMeta-CDQ1BQUH.js.map +1 -0
  7. package/dist/RouterListItemButton-DrW6M53Y.js +17 -0
  8. package/dist/{RouterListItemButton-C_jUvB6C.js.map → RouterListItemButton-DrW6M53Y.js.map} +1 -1
  9. package/dist/components.js +1158 -1132
  10. package/dist/components.js.map +1 -1
  11. package/dist/exports/components.d.ts +14 -0
  12. package/dist/exports/hooks.d.ts +6 -0
  13. package/dist/exports/index.d.ts +4 -0
  14. package/dist/exports/models.d.ts +24 -0
  15. package/dist/exports/query.d.ts +2 -0
  16. package/dist/exports/utils.d.ts +5 -0
  17. package/dist/exports/vite.d.ts +1 -0
  18. package/dist/hooks.js +466 -421
  19. package/dist/hooks.js.map +1 -1
  20. package/dist/index-DchOf6FV.js +2756 -0
  21. package/dist/index-DchOf6FV.js.map +1 -0
  22. package/dist/{index-Y_pgyGkL.js → index-De6Lo0ff.js} +531 -603
  23. package/dist/index-De6Lo0ff.js.map +1 -0
  24. package/dist/index.js +822 -666
  25. package/dist/index.js.map +1 -1
  26. package/dist/models.js +2 -2
  27. package/dist/query.js +6 -0
  28. package/dist/query.js.map +1 -0
  29. package/dist/utils-Dttzp8un.js +10879 -0
  30. package/dist/utils-Dttzp8un.js.map +1 -0
  31. package/dist/utils.js +271 -8
  32. package/dist/utils.js.map +1 -1
  33. package/dist/vite.js +53 -26
  34. package/dist/vite.js.map +1 -1
  35. package/package.json +6 -10
  36. package/dist/ApprovalStatus-lESbUD_x.js +0 -7
  37. package/dist/ApprovalStatus-lESbUD_x.js.map +0 -1
  38. package/dist/DialogsContext-CGAKEKKW.js +0 -546
  39. package/dist/DialogsContext-CGAKEKKW.js.map +0 -1
  40. package/dist/FileHooks-CstZ4QII.js +0 -2699
  41. package/dist/FileHooks-CstZ4QII.js.map +0 -1
  42. package/dist/FileMeta-Bzeo3ie9.js +0 -18
  43. package/dist/FileMeta-Bzeo3ie9.js.map +0 -1
  44. package/dist/GraphQueries-Bx0CzlWR.js +0 -28020
  45. package/dist/GraphQueries-Bx0CzlWR.js.map +0 -1
  46. package/dist/RouterListItemButton-C_jUvB6C.js +0 -18
  47. package/dist/auth.d.ts +0 -8
  48. package/dist/auth.js +0 -6
  49. package/dist/auth.js.map +0 -1
  50. package/dist/bun-sqlite-dialect-CZjbVcY_.js +0 -143
  51. package/dist/bun-sqlite-dialect-CZjbVcY_.js.map +0 -1
  52. package/dist/compiler-runtime-BNHg76kC.js +0 -37
  53. package/dist/compiler-runtime-BNHg76kC.js.map +0 -1
  54. package/dist/components.d.ts +0 -44
  55. package/dist/hooks.d.ts +0 -26
  56. package/dist/index-BT7qlAad.js +0 -159
  57. package/dist/index-BT7qlAad.js.map +0 -1
  58. package/dist/index-Biz5inV2.js +0 -268
  59. package/dist/index-Biz5inV2.js.map +0 -1
  60. package/dist/index-Phhmhd_m.js +0 -227
  61. package/dist/index-Phhmhd_m.js.map +0 -1
  62. package/dist/index-Y_pgyGkL.js.map +0 -1
  63. package/dist/index.d.ts +0 -20
  64. package/dist/models.d.ts +0 -107
  65. package/dist/node-sqlite-dialect-CSXFdUmA.js +0 -143
  66. package/dist/node-sqlite-dialect-CSXFdUmA.js.map +0 -1
  67. package/dist/queries.d.ts +0 -95
  68. package/dist/queries.js +0 -567
  69. package/dist/queries.js.map +0 -1
  70. package/dist/utils-araYIHAE.js +0 -81
  71. package/dist/utils-araYIHAE.js.map +0 -1
  72. package/dist/utils.d.ts +0 -14
  73. package/dist/vite.d.ts +0 -5
@@ -1,2699 +0,0 @@
1
- import { c as G } from "./compiler-runtime-BNHg76kC.js";
2
- import { useQuery as qe, useMutation as ye, useQueryClient as Pe } from "@tanstack/react-query";
3
- import { useState as It } from "react";
4
- import { u as qt } from "./index-Biz5inV2.js";
5
- import V from "zod";
6
- import { F as dt } from "./FileMeta-Bzeo3ie9.js";
7
- import { t as Nt, h as K } from "./utils-araYIHAE.js";
8
- import { a as yt } from "./index-Y_pgyGkL.js";
9
- var ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
10
- function mt(e) {
11
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
12
- }
13
- var be = { exports: {} }, Dt = be.exports, Me;
14
- function Ht() {
15
- return Me || (Me = 1, (function(e, t) {
16
- (function(r, n) {
17
- n();
18
- })(Dt, function() {
19
- function r(f, v) {
20
- return typeof v > "u" ? v = { autoBom: !1 } : typeof v != "object" && (console.warn("Deprecated: Expected third argument to be a object"), v = { autoBom: !v }), v.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(f.type) ? new Blob(["\uFEFF", f], { type: f.type }) : f;
21
- }
22
- function n(f, v, P) {
23
- var S = new XMLHttpRequest();
24
- S.open("GET", f), S.responseType = "blob", S.onload = function() {
25
- c(S.response, v, P);
26
- }, S.onerror = function() {
27
- console.error("could not download file");
28
- }, S.send();
29
- }
30
- function o(f) {
31
- var v = new XMLHttpRequest();
32
- v.open("HEAD", f, !1);
33
- try {
34
- v.send();
35
- } catch {
36
- }
37
- return 200 <= v.status && 299 >= v.status;
38
- }
39
- function s(f) {
40
- try {
41
- f.dispatchEvent(new MouseEvent("click"));
42
- } catch {
43
- var v = document.createEvent("MouseEvents");
44
- v.initMouseEvent("click", !0, !0, window, 0, 0, 0, 80, 20, !1, !1, !1, !1, 0, null), f.dispatchEvent(v);
45
- }
46
- }
47
- var l = typeof window == "object" && window.window === window ? window : typeof self == "object" && self.self === self ? self : typeof ee == "object" && ee.global === ee ? ee : void 0, p = l.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), c = l.saveAs || (typeof window != "object" || window !== l ? function() {
48
- } : "download" in HTMLAnchorElement.prototype && !p ? function(f, v, P) {
49
- var S = l.URL || l.webkitURL, A = document.createElement("a");
50
- v = v || f.name || "download", A.download = v, A.rel = "noopener", typeof f == "string" ? (A.href = f, A.origin === location.origin ? s(A) : o(A.href) ? n(f, v, P) : s(A, A.target = "_blank")) : (A.href = S.createObjectURL(f), setTimeout(function() {
51
- S.revokeObjectURL(A.href);
52
- }, 4e4), setTimeout(function() {
53
- s(A);
54
- }, 0));
55
- } : "msSaveOrOpenBlob" in navigator ? function(f, v, P) {
56
- if (v = v || f.name || "download", typeof f != "string") navigator.msSaveOrOpenBlob(r(f, P), v);
57
- else if (o(f)) n(f, v, P);
58
- else {
59
- var S = document.createElement("a");
60
- S.href = f, S.target = "_blank", setTimeout(function() {
61
- s(S);
62
- });
63
- }
64
- } : function(f, v, P, S) {
65
- if (S = S || open("", "_blank"), S && (S.document.title = S.document.body.innerText = "downloading..."), typeof f == "string") return n(f, v, P);
66
- var A = f.type === "application/octet-stream", D = /constructor/i.test(l.HTMLElement) || l.safari, T = /CriOS\/[\d]+/.test(navigator.userAgent);
67
- if ((T || A && D || p) && typeof FileReader < "u") {
68
- var R = new FileReader();
69
- R.onloadend = function() {
70
- var y = R.result;
71
- y = T ? y : y.replace(/^data:[^;]*;/, "data:attachment/file;"), S ? S.location.href = y : location = y, S = null;
72
- }, R.readAsDataURL(f);
73
- } else {
74
- var H = l.URL || l.webkitURL, g = H.createObjectURL(f);
75
- S ? S.location = g : location.href = g, S = null, setTimeout(function() {
76
- H.revokeObjectURL(g);
77
- }, 4e4);
78
- }
79
- });
80
- l.saveAs = c.saveAs = c, e.exports = c;
81
- });
82
- })(be)), be.exports;
83
- }
84
- var Bt = Ht();
85
- const zt = /* @__PURE__ */ mt(Bt);
86
- function je(e) {
87
- "@babel/helpers - typeof";
88
- return je = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
89
- return typeof t;
90
- } : function(t) {
91
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
92
- }, je(e);
93
- }
94
- function Mt(e, t, r) {
95
- return Object.defineProperty(e, "prototype", { writable: !1 }), e;
96
- }
97
- function Gt(e, t) {
98
- if (!(e instanceof t))
99
- throw new TypeError("Cannot call a class as a function");
100
- }
101
- function Kt(e, t, r) {
102
- return t = le(t), Yt(e, Ne() ? Reflect.construct(t, r || [], le(e).constructor) : t.apply(e, r));
103
- }
104
- function Yt(e, t) {
105
- if (t && (je(t) === "object" || typeof t == "function"))
106
- return t;
107
- if (t !== void 0)
108
- throw new TypeError("Derived constructors may only return object or undefined");
109
- return Vt(e);
110
- }
111
- function Vt(e) {
112
- if (e === void 0)
113
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
114
- return e;
115
- }
116
- function Wt(e, t) {
117
- if (typeof t != "function" && t !== null)
118
- throw new TypeError("Super expression must either be null or a function");
119
- e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && se(e, t);
120
- }
121
- function ke(e) {
122
- var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
123
- return ke = function(n) {
124
- if (n === null || !Qt(n)) return n;
125
- if (typeof n != "function")
126
- throw new TypeError("Super expression must either be null or a function");
127
- if (typeof t < "u") {
128
- if (t.has(n)) return t.get(n);
129
- t.set(n, o);
130
- }
131
- function o() {
132
- return Xt(n, arguments, le(this).constructor);
133
- }
134
- return o.prototype = Object.create(n.prototype, { constructor: { value: o, enumerable: !1, writable: !0, configurable: !0 } }), se(o, n);
135
- }, ke(e);
136
- }
137
- function Xt(e, t, r) {
138
- if (Ne()) return Reflect.construct.apply(null, arguments);
139
- var n = [null];
140
- n.push.apply(n, t);
141
- var o = new (e.bind.apply(e, n))();
142
- return r && se(o, r.prototype), o;
143
- }
144
- function Ne() {
145
- try {
146
- var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
147
- }));
148
- } catch {
149
- }
150
- return (Ne = function() {
151
- return !!e;
152
- })();
153
- }
154
- function Qt(e) {
155
- try {
156
- return Function.toString.call(e).indexOf("[native code]") !== -1;
157
- } catch {
158
- return typeof e == "function";
159
- }
160
- }
161
- function se(e, t) {
162
- return se = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, o) {
163
- return n.__proto__ = o, n;
164
- }, se(e, t);
165
- }
166
- function le(e) {
167
- return le = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(r) {
168
- return r.__proto__ || Object.getPrototypeOf(r);
169
- }, le(e);
170
- }
171
- var me = /* @__PURE__ */ (function(e) {
172
- function t(r) {
173
- var n, o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, l = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
174
- if (Gt(this, t), n = Kt(this, t, [r]), n.originalRequest = s, n.originalResponse = l, n.causingError = o, o != null && (r += ", caused by ".concat(o.toString())), s != null) {
175
- var p = s.getHeader("X-Request-ID") || "n/a", c = s.getMethod(), f = s.getURL(), v = l ? l.getStatus() : "n/a", P = l ? l.getBody() || "" : "n/a";
176
- r += ", originated from request (method: ".concat(c, ", url: ").concat(f, ", response code: ").concat(v, ", response text: ").concat(P, ", request id: ").concat(p, ")");
177
- }
178
- return n.message = r, n;
179
- }
180
- return Wt(t, e), Mt(t);
181
- })(/* @__PURE__ */ ke(Error));
182
- function fe(e) {
183
- "@babel/helpers - typeof";
184
- return fe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
185
- return typeof t;
186
- } : function(t) {
187
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
188
- }, fe(e);
189
- }
190
- function Zt(e, t) {
191
- if (!(e instanceof t))
192
- throw new TypeError("Cannot call a class as a function");
193
- }
194
- function Jt(e, t) {
195
- for (var r = 0; r < t.length; r++) {
196
- var n = t[r];
197
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, tr(n.key), n);
198
- }
199
- }
200
- function er(e, t, r) {
201
- return t && Jt(e.prototype, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
202
- }
203
- function tr(e) {
204
- var t = rr(e, "string");
205
- return fe(t) == "symbol" ? t : t + "";
206
- }
207
- function rr(e, t) {
208
- if (fe(e) != "object" || !e) return e;
209
- var r = e[Symbol.toPrimitive];
210
- if (r !== void 0) {
211
- var n = r.call(e, t);
212
- if (fe(n) != "object") return n;
213
- throw new TypeError("@@toPrimitive must return a primitive value.");
214
- }
215
- return String(e);
216
- }
217
- var nr = /* @__PURE__ */ (function() {
218
- function e() {
219
- Zt(this, e);
220
- }
221
- return er(e, [{
222
- key: "listAllUploads",
223
- value: function() {
224
- return Promise.resolve([]);
225
- }
226
- }, {
227
- key: "findUploadsByFingerprint",
228
- value: function(r) {
229
- return Promise.resolve([]);
230
- }
231
- }, {
232
- key: "removeUpload",
233
- value: function(r) {
234
- return Promise.resolve();
235
- }
236
- }, {
237
- key: "addUpload",
238
- value: function(r, n) {
239
- return Promise.resolve(null);
240
- }
241
- }]);
242
- })();
243
- const vt = "3.7.8", or = vt, ie = typeof Buffer == "function", Ge = typeof TextDecoder == "function" ? new TextDecoder() : void 0, Ke = typeof TextEncoder == "function" ? new TextEncoder() : void 0, ir = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", ae = Array.prototype.slice.call(ir), ve = ((e) => {
244
- let t = {};
245
- return e.forEach((r, n) => t[r] = n), t;
246
- })(ae), ar = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, C = String.fromCharCode.bind(String), Ye = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : (e) => new Uint8Array(Array.prototype.slice.call(e, 0)), gt = (e) => e.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), bt = (e) => e.replace(/[^A-Za-z0-9\+\/]/g, ""), _t = (e) => {
247
- let t, r, n, o, s = "";
248
- const l = e.length % 3;
249
- for (let p = 0; p < e.length; ) {
250
- if ((r = e.charCodeAt(p++)) > 255 || (n = e.charCodeAt(p++)) > 255 || (o = e.charCodeAt(p++)) > 255)
251
- throw new TypeError("invalid character found");
252
- t = r << 16 | n << 8 | o, s += ae[t >> 18 & 63] + ae[t >> 12 & 63] + ae[t >> 6 & 63] + ae[t & 63];
253
- }
254
- return l ? s.slice(0, l - 3) + "===".substring(l) : s;
255
- }, De = typeof btoa == "function" ? (e) => btoa(e) : ie ? (e) => Buffer.from(e, "binary").toString("base64") : _t, Te = ie ? (e) => Buffer.from(e).toString("base64") : (e) => {
256
- let r = [];
257
- for (let n = 0, o = e.length; n < o; n += 4096)
258
- r.push(C.apply(null, e.subarray(n, n + 4096)));
259
- return De(r.join(""));
260
- }, _e = (e, t = !1) => t ? gt(Te(e)) : Te(e), ur = (e) => {
261
- if (e.length < 2) {
262
- var t = e.charCodeAt(0);
263
- return t < 128 ? e : t < 2048 ? C(192 | t >>> 6) + C(128 | t & 63) : C(224 | t >>> 12 & 15) + C(128 | t >>> 6 & 63) + C(128 | t & 63);
264
- } else {
265
- var t = 65536 + (e.charCodeAt(0) - 55296) * 1024 + (e.charCodeAt(1) - 56320);
266
- return C(240 | t >>> 18 & 7) + C(128 | t >>> 12 & 63) + C(128 | t >>> 6 & 63) + C(128 | t & 63);
267
- }
268
- }, sr = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, wt = (e) => e.replace(sr, ur), Ve = ie ? (e) => Buffer.from(e, "utf8").toString("base64") : Ke ? (e) => Te(Ke.encode(e)) : (e) => De(wt(e)), re = (e, t = !1) => t ? gt(Ve(e)) : Ve(e), We = (e) => re(e, !0), lr = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, fr = (e) => {
269
- switch (e.length) {
270
- case 4:
271
- var t = (7 & e.charCodeAt(0)) << 18 | (63 & e.charCodeAt(1)) << 12 | (63 & e.charCodeAt(2)) << 6 | 63 & e.charCodeAt(3), r = t - 65536;
272
- return C((r >>> 10) + 55296) + C((r & 1023) + 56320);
273
- case 3:
274
- return C((15 & e.charCodeAt(0)) << 12 | (63 & e.charCodeAt(1)) << 6 | 63 & e.charCodeAt(2));
275
- default:
276
- return C((31 & e.charCodeAt(0)) << 6 | 63 & e.charCodeAt(1));
277
- }
278
- }, St = (e) => e.replace(lr, fr), Ut = (e) => {
279
- if (e = e.replace(/\s+/g, ""), !ar.test(e))
280
- throw new TypeError("malformed base64.");
281
- e += "==".slice(2 - (e.length & 3));
282
- let t, r, n, o = [];
283
- for (let s = 0; s < e.length; )
284
- t = ve[e.charAt(s++)] << 18 | ve[e.charAt(s++)] << 12 | (r = ve[e.charAt(s++)]) << 6 | (n = ve[e.charAt(s++)]), r === 64 ? o.push(C(t >> 16 & 255)) : n === 64 ? o.push(C(t >> 16 & 255, t >> 8 & 255)) : o.push(C(t >> 16 & 255, t >> 8 & 255, t & 255));
285
- return o.join("");
286
- }, He = typeof atob == "function" ? (e) => atob(bt(e)) : ie ? (e) => Buffer.from(e, "base64").toString("binary") : Ut, Et = ie ? (e) => Ye(Buffer.from(e, "base64")) : (e) => Ye(He(e).split("").map((t) => t.charCodeAt(0))), Pt = (e) => Et(xt(e)), cr = ie ? (e) => Buffer.from(e, "base64").toString("utf8") : Ge ? (e) => Ge.decode(Et(e)) : (e) => St(He(e)), xt = (e) => bt(e.replace(/[-_]/g, (t) => t == "-" ? "+" : "/")), Le = (e) => cr(xt(e)), pr = (e) => {
287
- if (typeof e != "string")
288
- return !1;
289
- const t = e.replace(/\s+/g, "").replace(/={0,2}$/, "");
290
- return !/[^\s0-9a-zA-Z\+/]/.test(t) || !/[^\s0-9a-zA-Z\-_]/.test(t);
291
- }, Ot = (e) => ({
292
- value: e,
293
- enumerable: !1,
294
- writable: !0,
295
- configurable: !0
296
- }), Rt = function() {
297
- const e = (t, r) => Object.defineProperty(String.prototype, t, Ot(r));
298
- e("fromBase64", function() {
299
- return Le(this);
300
- }), e("toBase64", function(t) {
301
- return re(this, t);
302
- }), e("toBase64URI", function() {
303
- return re(this, !0);
304
- }), e("toBase64URL", function() {
305
- return re(this, !0);
306
- }), e("toUint8Array", function() {
307
- return Pt(this);
308
- });
309
- }, jt = function() {
310
- const e = (t, r) => Object.defineProperty(Uint8Array.prototype, t, Ot(r));
311
- e("toBase64", function(t) {
312
- return _e(this, t);
313
- }), e("toBase64URI", function() {
314
- return _e(this, !0);
315
- }), e("toBase64URL", function() {
316
- return _e(this, !0);
317
- });
318
- }, hr = () => {
319
- Rt(), jt();
320
- }, dr = {
321
- version: vt,
322
- VERSION: or,
323
- atob: He,
324
- atobPolyfill: Ut,
325
- btoa: De,
326
- btoaPolyfill: _t,
327
- fromBase64: Le,
328
- toBase64: re,
329
- encode: re,
330
- encodeURI: We,
331
- encodeURL: We,
332
- utob: wt,
333
- btou: St,
334
- decode: Le,
335
- isValid: pr,
336
- fromUint8Array: _e,
337
- toUint8Array: Pt,
338
- extendString: Rt,
339
- extendUint8Array: jt,
340
- extendBuiltins: hr
341
- };
342
- var xe, Xe;
343
- function yr() {
344
- return Xe || (Xe = 1, xe = function(t, r) {
345
- if (r = r.split(":")[0], t = +t, !t) return !1;
346
- switch (r) {
347
- case "http":
348
- case "ws":
349
- return t !== 80;
350
- case "https":
351
- case "wss":
352
- return t !== 443;
353
- case "ftp":
354
- return t !== 21;
355
- case "gopher":
356
- return t !== 70;
357
- case "file":
358
- return !1;
359
- }
360
- return t !== 0;
361
- }), xe;
362
- }
363
- var ge = {}, Qe;
364
- function mr() {
365
- if (Qe) return ge;
366
- Qe = 1;
367
- var e = Object.prototype.hasOwnProperty, t;
368
- function r(l) {
369
- try {
370
- return decodeURIComponent(l.replace(/\+/g, " "));
371
- } catch {
372
- return null;
373
- }
374
- }
375
- function n(l) {
376
- try {
377
- return encodeURIComponent(l);
378
- } catch {
379
- return null;
380
- }
381
- }
382
- function o(l) {
383
- for (var p = /([^=?#&]+)=?([^&]*)/g, c = {}, f; f = p.exec(l); ) {
384
- var v = r(f[1]), P = r(f[2]);
385
- v === null || P === null || v in c || (c[v] = P);
386
- }
387
- return c;
388
- }
389
- function s(l, p) {
390
- p = p || "";
391
- var c = [], f, v;
392
- typeof p != "string" && (p = "?");
393
- for (v in l)
394
- if (e.call(l, v)) {
395
- if (f = l[v], !f && (f === null || f === t || isNaN(f)) && (f = ""), v = n(v), f = n(f), v === null || f === null) continue;
396
- c.push(v + "=" + f);
397
- }
398
- return c.length ? p + c.join("&") : "";
399
- }
400
- return ge.stringify = s, ge.parse = o, ge;
401
- }
402
- var Oe, Ze;
403
- function vr() {
404
- if (Ze) return Oe;
405
- Ze = 1;
406
- var e = yr(), t = mr(), r = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, n = /[\n\r\t]/g, o = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, s = /:\d+$/, l = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, p = /^[a-zA-Z]:/;
407
- function c(g) {
408
- return (g || "").toString().replace(r, "");
409
- }
410
- var f = [
411
- ["#", "hash"],
412
- // Extract from the back.
413
- ["?", "query"],
414
- // Extract from the back.
415
- function(y, _) {
416
- return S(_.protocol) ? y.replace(/\\/g, "/") : y;
417
- },
418
- ["/", "pathname"],
419
- // Extract from the back.
420
- ["@", "auth", 1],
421
- // Extract from the front.
422
- [NaN, "host", void 0, 1, 1],
423
- // Set left over value.
424
- [/:(\d*)$/, "port", void 0, 1],
425
- // RegExp the back.
426
- [NaN, "hostname", void 0, 1, 1]
427
- // Set left over.
428
- ], v = { hash: 1, query: 1 };
429
- function P(g) {
430
- var y;
431
- typeof window < "u" ? y = window : typeof ee < "u" ? y = ee : typeof self < "u" ? y = self : y = {};
432
- var _ = y.location || {};
433
- g = g || _;
434
- var m = {}, x = typeof g, U;
435
- if (g.protocol === "blob:")
436
- m = new T(unescape(g.pathname), {});
437
- else if (x === "string") {
438
- m = new T(g, {});
439
- for (U in v) delete m[U];
440
- } else if (x === "object") {
441
- for (U in g)
442
- U in v || (m[U] = g[U]);
443
- m.slashes === void 0 && (m.slashes = o.test(g.href));
444
- }
445
- return m;
446
- }
447
- function S(g) {
448
- return g === "file:" || g === "ftp:" || g === "http:" || g === "https:" || g === "ws:" || g === "wss:";
449
- }
450
- function A(g, y) {
451
- g = c(g), g = g.replace(n, ""), y = y || {};
452
- var _ = l.exec(g), m = _[1] ? _[1].toLowerCase() : "", x = !!_[2], U = !!_[3], k = 0, O;
453
- return x ? U ? (O = _[2] + _[3] + _[4], k = _[2].length + _[3].length) : (O = _[2] + _[4], k = _[2].length) : U ? (O = _[3] + _[4], k = _[3].length) : O = _[4], m === "file:" ? k >= 2 && (O = O.slice(2)) : S(m) ? O = _[4] : m ? x && (O = O.slice(2)) : k >= 2 && S(y.protocol) && (O = _[4]), {
454
- protocol: m,
455
- slashes: x || S(m),
456
- slashesCount: k,
457
- rest: O
458
- };
459
- }
460
- function D(g, y) {
461
- if (g === "") return y;
462
- for (var _ = (y || "/").split("/").slice(0, -1).concat(g.split("/")), m = _.length, x = _[m - 1], U = !1, k = 0; m--; )
463
- _[m] === "." ? _.splice(m, 1) : _[m] === ".." ? (_.splice(m, 1), k++) : k && (m === 0 && (U = !0), _.splice(m, 1), k--);
464
- return U && _.unshift(""), (x === "." || x === "..") && _.push(""), _.join("/");
465
- }
466
- function T(g, y, _) {
467
- if (g = c(g), g = g.replace(n, ""), !(this instanceof T))
468
- return new T(g, y, _);
469
- var m, x, U, k, O, B, M = f.slice(), Q = typeof y, w = this, z = 0;
470
- for (Q !== "object" && Q !== "string" && (_ = y, y = null), _ && typeof _ != "function" && (_ = t.parse), y = P(y), x = A(g || "", y), m = !x.protocol && !x.slashes, w.slashes = x.slashes || m && y.slashes, w.protocol = x.protocol || y.protocol || "", g = x.rest, (x.protocol === "file:" && (x.slashesCount !== 2 || p.test(g)) || !x.slashes && (x.protocol || x.slashesCount < 2 || !S(w.protocol))) && (M[3] = [/(.*)/, "pathname"]); z < M.length; z++) {
471
- if (k = M[z], typeof k == "function") {
472
- g = k(g, w);
473
- continue;
474
- }
475
- U = k[0], B = k[1], U !== U ? w[B] = g : typeof U == "string" ? (O = U === "@" ? g.lastIndexOf(U) : g.indexOf(U), ~O && (typeof k[2] == "number" ? (w[B] = g.slice(0, O), g = g.slice(O + k[2])) : (w[B] = g.slice(O), g = g.slice(0, O)))) : (O = U.exec(g)) && (w[B] = O[1], g = g.slice(0, O.index)), w[B] = w[B] || m && k[3] && y[B] || "", k[4] && (w[B] = w[B].toLowerCase());
476
- }
477
- _ && (w.query = _(w.query)), m && y.slashes && w.pathname.charAt(0) !== "/" && (w.pathname !== "" || y.pathname !== "") && (w.pathname = D(w.pathname, y.pathname)), w.pathname.charAt(0) !== "/" && S(w.protocol) && (w.pathname = "/" + w.pathname), e(w.port, w.protocol) || (w.host = w.hostname, w.port = ""), w.username = w.password = "", w.auth && (O = w.auth.indexOf(":"), ~O ? (w.username = w.auth.slice(0, O), w.username = encodeURIComponent(decodeURIComponent(w.username)), w.password = w.auth.slice(O + 1), w.password = encodeURIComponent(decodeURIComponent(w.password))) : w.username = encodeURIComponent(decodeURIComponent(w.auth)), w.auth = w.password ? w.username + ":" + w.password : w.username), w.origin = w.protocol !== "file:" && S(w.protocol) && w.host ? w.protocol + "//" + w.host : "null", w.href = w.toString();
478
- }
479
- function R(g, y, _) {
480
- var m = this;
481
- switch (g) {
482
- case "query":
483
- typeof y == "string" && y.length && (y = (_ || t.parse)(y)), m[g] = y;
484
- break;
485
- case "port":
486
- m[g] = y, e(y, m.protocol) ? y && (m.host = m.hostname + ":" + y) : (m.host = m.hostname, m[g] = "");
487
- break;
488
- case "hostname":
489
- m[g] = y, m.port && (y += ":" + m.port), m.host = y;
490
- break;
491
- case "host":
492
- m[g] = y, s.test(y) ? (y = y.split(":"), m.port = y.pop(), m.hostname = y.join(":")) : (m.hostname = y, m.port = "");
493
- break;
494
- case "protocol":
495
- m.protocol = y.toLowerCase(), m.slashes = !_;
496
- break;
497
- case "pathname":
498
- case "hash":
499
- if (y) {
500
- var x = g === "pathname" ? "/" : "#";
501
- m[g] = y.charAt(0) !== x ? x + y : y;
502
- } else
503
- m[g] = y;
504
- break;
505
- case "username":
506
- case "password":
507
- m[g] = encodeURIComponent(y);
508
- break;
509
- case "auth":
510
- var U = y.indexOf(":");
511
- ~U ? (m.username = y.slice(0, U), m.username = encodeURIComponent(decodeURIComponent(m.username)), m.password = y.slice(U + 1), m.password = encodeURIComponent(decodeURIComponent(m.password))) : m.username = encodeURIComponent(decodeURIComponent(y));
512
- }
513
- for (var k = 0; k < f.length; k++) {
514
- var O = f[k];
515
- O[4] && (m[O[1]] = m[O[1]].toLowerCase());
516
- }
517
- return m.auth = m.password ? m.username + ":" + m.password : m.username, m.origin = m.protocol !== "file:" && S(m.protocol) && m.host ? m.protocol + "//" + m.host : "null", m.href = m.toString(), m;
518
- }
519
- function H(g) {
520
- (!g || typeof g != "function") && (g = t.stringify);
521
- var y, _ = this, m = _.host, x = _.protocol;
522
- x && x.charAt(x.length - 1) !== ":" && (x += ":");
523
- var U = x + (_.protocol && _.slashes || S(_.protocol) ? "//" : "");
524
- return _.username ? (U += _.username, _.password && (U += ":" + _.password), U += "@") : _.password ? (U += ":" + _.password, U += "@") : _.protocol !== "file:" && S(_.protocol) && !m && _.pathname !== "/" && (U += "@"), (m[m.length - 1] === ":" || s.test(_.hostname) && !_.port) && (m += ":"), U += m + _.pathname, y = typeof _.query == "object" ? g(_.query) : _.query, y && (U += y.charAt(0) !== "?" ? "?" + y : y), _.hash && (U += _.hash), U;
525
- }
526
- return T.prototype = { set: R, toString: H }, T.extractProtocol = A, T.location = P, T.trimLeft = c, T.qs = t, Oe = T, Oe;
527
- }
528
- var gr = vr();
529
- const br = /* @__PURE__ */ mt(gr);
530
- function _r() {
531
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
532
- var t = Math.random() * 16 | 0, r = e === "x" ? t : t & 3 | 8;
533
- return r.toString(16);
534
- });
535
- }
536
- function Ae() {
537
- Ae = function() {
538
- return t;
539
- };
540
- var e, t = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(u, i, a) {
541
- u[i] = a.value;
542
- }, s = typeof Symbol == "function" ? Symbol : {}, l = s.iterator || "@@iterator", p = s.asyncIterator || "@@asyncIterator", c = s.toStringTag || "@@toStringTag";
543
- function f(u, i, a) {
544
- return Object.defineProperty(u, i, { value: a, enumerable: !0, configurable: !0, writable: !0 }), u[i];
545
- }
546
- try {
547
- f({}, "");
548
- } catch {
549
- f = function(a, h, b) {
550
- return a[h] = b;
551
- };
552
- }
553
- function v(u, i, a, h) {
554
- var b = i && i.prototype instanceof H ? i : H, d = Object.create(b.prototype), E = new z(h || []);
555
- return o(d, "_invoke", { value: B(u, a, E) }), d;
556
- }
557
- function P(u, i, a) {
558
- try {
559
- return { type: "normal", arg: u.call(i, a) };
560
- } catch (h) {
561
- return { type: "throw", arg: h };
562
- }
563
- }
564
- t.wrap = v;
565
- var S = "suspendedStart", A = "suspendedYield", D = "executing", T = "completed", R = {};
566
- function H() {
567
- }
568
- function g() {
569
- }
570
- function y() {
571
- }
572
- var _ = {};
573
- f(_, l, function() {
574
- return this;
575
- });
576
- var m = Object.getPrototypeOf, x = m && m(m(Y([])));
577
- x && x !== r && n.call(x, l) && (_ = x);
578
- var U = y.prototype = H.prototype = Object.create(_);
579
- function k(u) {
580
- ["next", "throw", "return"].forEach(function(i) {
581
- f(u, i, function(a) {
582
- return this._invoke(i, a);
583
- });
584
- });
585
- }
586
- function O(u, i) {
587
- function a(b, d, E, j) {
588
- var L = P(u[b], u, d);
589
- if (L.type !== "throw") {
590
- var I = L.arg, F = I.value;
591
- return F && W(F) == "object" && n.call(F, "__await") ? i.resolve(F.__await).then(function(q) {
592
- a("next", q, E, j);
593
- }, function(q) {
594
- a("throw", q, E, j);
595
- }) : i.resolve(F).then(function(q) {
596
- I.value = q, E(I);
597
- }, function(q) {
598
- return a("throw", q, E, j);
599
- });
600
- }
601
- j(L.arg);
602
- }
603
- var h;
604
- o(this, "_invoke", { value: function(d, E) {
605
- function j() {
606
- return new i(function(L, I) {
607
- a(d, E, L, I);
608
- });
609
- }
610
- return h = h ? h.then(j, j) : j();
611
- } });
612
- }
613
- function B(u, i, a) {
614
- var h = S;
615
- return function(b, d) {
616
- if (h === D) throw Error("Generator is already running");
617
- if (h === T) {
618
- if (b === "throw") throw d;
619
- return { value: e, done: !0 };
620
- }
621
- for (a.method = b, a.arg = d; ; ) {
622
- var E = a.delegate;
623
- if (E) {
624
- var j = M(E, a);
625
- if (j) {
626
- if (j === R) continue;
627
- return j;
628
- }
629
- }
630
- if (a.method === "next") a.sent = a._sent = a.arg;
631
- else if (a.method === "throw") {
632
- if (h === S) throw h = T, a.arg;
633
- a.dispatchException(a.arg);
634
- } else a.method === "return" && a.abrupt("return", a.arg);
635
- h = D;
636
- var L = P(u, i, a);
637
- if (L.type === "normal") {
638
- if (h = a.done ? T : A, L.arg === R) continue;
639
- return { value: L.arg, done: a.done };
640
- }
641
- L.type === "throw" && (h = T, a.method = "throw", a.arg = L.arg);
642
- }
643
- };
644
- }
645
- function M(u, i) {
646
- var a = i.method, h = u.iterator[a];
647
- if (h === e) return i.delegate = null, a === "throw" && u.iterator.return && (i.method = "return", i.arg = e, M(u, i), i.method === "throw") || a !== "return" && (i.method = "throw", i.arg = new TypeError("The iterator does not provide a '" + a + "' method")), R;
648
- var b = P(h, u.iterator, i.arg);
649
- if (b.type === "throw") return i.method = "throw", i.arg = b.arg, i.delegate = null, R;
650
- var d = b.arg;
651
- return d ? d.done ? (i[u.resultName] = d.value, i.next = u.nextLoc, i.method !== "return" && (i.method = "next", i.arg = e), i.delegate = null, R) : d : (i.method = "throw", i.arg = new TypeError("iterator result is not an object"), i.delegate = null, R);
652
- }
653
- function Q(u) {
654
- var i = { tryLoc: u[0] };
655
- 1 in u && (i.catchLoc = u[1]), 2 in u && (i.finallyLoc = u[2], i.afterLoc = u[3]), this.tryEntries.push(i);
656
- }
657
- function w(u) {
658
- var i = u.completion || {};
659
- i.type = "normal", delete i.arg, u.completion = i;
660
- }
661
- function z(u) {
662
- this.tryEntries = [{ tryLoc: "root" }], u.forEach(Q, this), this.reset(!0);
663
- }
664
- function Y(u) {
665
- if (u || u === "") {
666
- var i = u[l];
667
- if (i) return i.call(u);
668
- if (typeof u.next == "function") return u;
669
- if (!isNaN(u.length)) {
670
- var a = -1, h = function b() {
671
- for (; ++a < u.length; ) if (n.call(u, a)) return b.value = u[a], b.done = !1, b;
672
- return b.value = e, b.done = !0, b;
673
- };
674
- return h.next = h;
675
- }
676
- }
677
- throw new TypeError(W(u) + " is not iterable");
678
- }
679
- return g.prototype = y, o(U, "constructor", { value: y, configurable: !0 }), o(y, "constructor", { value: g, configurable: !0 }), g.displayName = f(y, c, "GeneratorFunction"), t.isGeneratorFunction = function(u) {
680
- var i = typeof u == "function" && u.constructor;
681
- return !!i && (i === g || (i.displayName || i.name) === "GeneratorFunction");
682
- }, t.mark = function(u) {
683
- return Object.setPrototypeOf ? Object.setPrototypeOf(u, y) : (u.__proto__ = y, f(u, c, "GeneratorFunction")), u.prototype = Object.create(U), u;
684
- }, t.awrap = function(u) {
685
- return { __await: u };
686
- }, k(O.prototype), f(O.prototype, p, function() {
687
- return this;
688
- }), t.AsyncIterator = O, t.async = function(u, i, a, h, b) {
689
- b === void 0 && (b = Promise);
690
- var d = new O(v(u, i, a, h), b);
691
- return t.isGeneratorFunction(i) ? d : d.next().then(function(E) {
692
- return E.done ? E.value : d.next();
693
- });
694
- }, k(U), f(U, c, "Generator"), f(U, l, function() {
695
- return this;
696
- }), f(U, "toString", function() {
697
- return "[object Generator]";
698
- }), t.keys = function(u) {
699
- var i = Object(u), a = [];
700
- for (var h in i) a.push(h);
701
- return a.reverse(), function b() {
702
- for (; a.length; ) {
703
- var d = a.pop();
704
- if (d in i) return b.value = d, b.done = !1, b;
705
- }
706
- return b.done = !0, b;
707
- };
708
- }, t.values = Y, z.prototype = { constructor: z, reset: function(i) {
709
- if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(w), !i) for (var a in this) a.charAt(0) === "t" && n.call(this, a) && !isNaN(+a.slice(1)) && (this[a] = e);
710
- }, stop: function() {
711
- this.done = !0;
712
- var i = this.tryEntries[0].completion;
713
- if (i.type === "throw") throw i.arg;
714
- return this.rval;
715
- }, dispatchException: function(i) {
716
- if (this.done) throw i;
717
- var a = this;
718
- function h(I, F) {
719
- return E.type = "throw", E.arg = i, a.next = I, F && (a.method = "next", a.arg = e), !!F;
720
- }
721
- for (var b = this.tryEntries.length - 1; b >= 0; --b) {
722
- var d = this.tryEntries[b], E = d.completion;
723
- if (d.tryLoc === "root") return h("end");
724
- if (d.tryLoc <= this.prev) {
725
- var j = n.call(d, "catchLoc"), L = n.call(d, "finallyLoc");
726
- if (j && L) {
727
- if (this.prev < d.catchLoc) return h(d.catchLoc, !0);
728
- if (this.prev < d.finallyLoc) return h(d.finallyLoc);
729
- } else if (j) {
730
- if (this.prev < d.catchLoc) return h(d.catchLoc, !0);
731
- } else {
732
- if (!L) throw Error("try statement without catch or finally");
733
- if (this.prev < d.finallyLoc) return h(d.finallyLoc);
734
- }
735
- }
736
- }
737
- }, abrupt: function(i, a) {
738
- for (var h = this.tryEntries.length - 1; h >= 0; --h) {
739
- var b = this.tryEntries[h];
740
- if (b.tryLoc <= this.prev && n.call(b, "finallyLoc") && this.prev < b.finallyLoc) {
741
- var d = b;
742
- break;
743
- }
744
- }
745
- d && (i === "break" || i === "continue") && d.tryLoc <= a && a <= d.finallyLoc && (d = null);
746
- var E = d ? d.completion : {};
747
- return E.type = i, E.arg = a, d ? (this.method = "next", this.next = d.finallyLoc, R) : this.complete(E);
748
- }, complete: function(i, a) {
749
- if (i.type === "throw") throw i.arg;
750
- return i.type === "break" || i.type === "continue" ? this.next = i.arg : i.type === "return" ? (this.rval = this.arg = i.arg, this.method = "return", this.next = "end") : i.type === "normal" && a && (this.next = a), R;
751
- }, finish: function(i) {
752
- for (var a = this.tryEntries.length - 1; a >= 0; --a) {
753
- var h = this.tryEntries[a];
754
- if (h.finallyLoc === i) return this.complete(h.completion, h.afterLoc), w(h), R;
755
- }
756
- }, catch: function(i) {
757
- for (var a = this.tryEntries.length - 1; a >= 0; --a) {
758
- var h = this.tryEntries[a];
759
- if (h.tryLoc === i) {
760
- var b = h.completion;
761
- if (b.type === "throw") {
762
- var d = b.arg;
763
- w(h);
764
- }
765
- return d;
766
- }
767
- }
768
- throw Error("illegal catch attempt");
769
- }, delegateYield: function(i, a, h) {
770
- return this.delegate = { iterator: Y(i), resultName: a, nextLoc: h }, this.method === "next" && (this.arg = e), R;
771
- } }, t;
772
- }
773
- function Je(e, t, r, n, o, s, l) {
774
- try {
775
- var p = e[s](l), c = p.value;
776
- } catch (f) {
777
- r(f);
778
- return;
779
- }
780
- p.done ? t(c) : Promise.resolve(c).then(n, o);
781
- }
782
- function wr(e) {
783
- return function() {
784
- var t = this, r = arguments;
785
- return new Promise(function(n, o) {
786
- var s = e.apply(t, r);
787
- function l(c) {
788
- Je(s, n, o, l, p, "next", c);
789
- }
790
- function p(c) {
791
- Je(s, n, o, l, p, "throw", c);
792
- }
793
- l(void 0);
794
- });
795
- };
796
- }
797
- function kt(e, t) {
798
- return Er(e) || Ur(e, t) || Tt(e, t) || Sr();
799
- }
800
- function Sr() {
801
- throw new TypeError(`Invalid attempt to destructure non-iterable instance.
802
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
803
- }
804
- function Ur(e, t) {
805
- var r = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
806
- if (r != null) {
807
- var n, o, s, l, p = [], c = !0, f = !1;
808
- try {
809
- if (s = (r = r.call(e)).next, t !== 0) for (; !(c = (n = s.call(r)).done) && (p.push(n.value), p.length !== t); c = !0) ;
810
- } catch (v) {
811
- f = !0, o = v;
812
- } finally {
813
- try {
814
- if (!c && r.return != null && (l = r.return(), Object(l) !== l)) return;
815
- } finally {
816
- if (f) throw o;
817
- }
818
- }
819
- return p;
820
- }
821
- }
822
- function Er(e) {
823
- if (Array.isArray(e)) return e;
824
- }
825
- function W(e) {
826
- "@babel/helpers - typeof";
827
- return W = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
828
- return typeof t;
829
- } : function(t) {
830
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
831
- }, W(e);
832
- }
833
- function Pr(e, t) {
834
- var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
835
- if (!r) {
836
- if (Array.isArray(e) || (r = Tt(e)) || t) {
837
- r && (e = r);
838
- var n = 0, o = function() {
839
- };
840
- return { s: o, n: function() {
841
- return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] };
842
- }, e: function(f) {
843
- throw f;
844
- }, f: o };
845
- }
846
- throw new TypeError(`Invalid attempt to iterate non-iterable instance.
847
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
848
- }
849
- var s = !0, l = !1, p;
850
- return { s: function() {
851
- r = r.call(e);
852
- }, n: function() {
853
- var f = r.next();
854
- return s = f.done, f;
855
- }, e: function(f) {
856
- l = !0, p = f;
857
- }, f: function() {
858
- try {
859
- !s && r.return != null && r.return();
860
- } finally {
861
- if (l) throw p;
862
- }
863
- } };
864
- }
865
- function Tt(e, t) {
866
- if (e) {
867
- if (typeof e == "string") return et(e, t);
868
- var r = Object.prototype.toString.call(e).slice(8, -1);
869
- if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
870
- if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return et(e, t);
871
- }
872
- }
873
- function et(e, t) {
874
- (t == null || t > e.length) && (t = e.length);
875
- for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
876
- return n;
877
- }
878
- function tt(e, t) {
879
- var r = Object.keys(e);
880
- if (Object.getOwnPropertySymbols) {
881
- var n = Object.getOwnPropertySymbols(e);
882
- t && (n = n.filter(function(o) {
883
- return Object.getOwnPropertyDescriptor(e, o).enumerable;
884
- })), r.push.apply(r, n);
885
- }
886
- return r;
887
- }
888
- function Z(e) {
889
- for (var t = 1; t < arguments.length; t++) {
890
- var r = arguments[t] != null ? arguments[t] : {};
891
- t % 2 ? tt(Object(r), !0).forEach(function(n) {
892
- xr(e, n, r[n]);
893
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : tt(Object(r)).forEach(function(n) {
894
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
895
- });
896
- }
897
- return e;
898
- }
899
- function xr(e, t, r) {
900
- return t = Lt(t), t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
901
- }
902
- function Or(e, t) {
903
- if (!(e instanceof t))
904
- throw new TypeError("Cannot call a class as a function");
905
- }
906
- function rt(e, t) {
907
- for (var r = 0; r < t.length; r++) {
908
- var n = t[r];
909
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, Lt(n.key), n);
910
- }
911
- }
912
- function Rr(e, t, r) {
913
- return t && rt(e.prototype, t), r && rt(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e;
914
- }
915
- function Lt(e) {
916
- var t = jr(e, "string");
917
- return W(t) == "symbol" ? t : t + "";
918
- }
919
- function jr(e, t) {
920
- if (W(e) != "object" || !e) return e;
921
- var r = e[Symbol.toPrimitive];
922
- if (r !== void 0) {
923
- var n = r.call(e, t);
924
- if (W(n) != "object") return n;
925
- throw new TypeError("@@toPrimitive must return a primitive value.");
926
- }
927
- return String(e);
928
- }
929
- var we = "tus-v1", Se = "ietf-draft-03", ue = "ietf-draft-05", kr = {
930
- endpoint: null,
931
- uploadUrl: null,
932
- metadata: {},
933
- metadataForPartialUploads: {},
934
- fingerprint: null,
935
- uploadSize: null,
936
- onProgress: null,
937
- onChunkComplete: null,
938
- onSuccess: null,
939
- onError: null,
940
- onUploadUrlAvailable: null,
941
- overridePatchMethod: !1,
942
- headers: {},
943
- addRequestId: !1,
944
- onBeforeRequest: null,
945
- onAfterResponse: null,
946
- onShouldRetry: At,
947
- chunkSize: Number.POSITIVE_INFINITY,
948
- retryDelays: [0, 1e3, 3e3, 5e3],
949
- parallelUploads: 1,
950
- parallelUploadBoundaries: null,
951
- storeFingerprintForResuming: !0,
952
- removeFingerprintOnSuccess: !1,
953
- uploadLengthDeferred: !1,
954
- uploadDataDuringCreation: !1,
955
- urlStorage: null,
956
- fileReader: null,
957
- httpStack: null,
958
- protocol: we
959
- }, Ue = /* @__PURE__ */ (function() {
960
- function e(t, r) {
961
- Or(this, e), "resume" in r && console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."), this.options = r, this.options.chunkSize = Number(this.options.chunkSize), this._urlStorage = this.options.urlStorage, this.file = t, this.url = null, this._req = null, this._fingerprint = null, this._urlStorageKey = null, this._offset = null, this._aborted = !1, this._size = null, this._source = null, this._retryAttempt = 0, this._retryTimeout = null, this._offsetBeforeRetry = 0, this._parallelUploads = null, this._parallelUploadUrls = null;
962
- }
963
- return Rr(e, [{
964
- key: "findPreviousUploads",
965
- value: function() {
966
- var r = this;
967
- return this.options.fingerprint(this.file, this.options).then(function(n) {
968
- return r._urlStorage.findUploadsByFingerprint(n);
969
- });
970
- }
971
- }, {
972
- key: "resumeFromPreviousUpload",
973
- value: function(r) {
974
- this.url = r.uploadUrl || null, this._parallelUploadUrls = r.parallelUploadUrls || null, this._urlStorageKey = r.urlStorageKey;
975
- }
976
- }, {
977
- key: "start",
978
- value: function() {
979
- var r = this, n = this.file;
980
- if (!n) {
981
- this._emitError(new Error("tus: no file or stream to upload provided"));
982
- return;
983
- }
984
- if (![we, Se, ue].includes(this.options.protocol)) {
985
- this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));
986
- return;
987
- }
988
- if (!this.options.endpoint && !this.options.uploadUrl && !this.url) {
989
- this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));
990
- return;
991
- }
992
- var o = this.options.retryDelays;
993
- if (o != null && Object.prototype.toString.call(o) !== "[object Array]") {
994
- this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));
995
- return;
996
- }
997
- if (this.options.parallelUploads > 1)
998
- for (var s = 0, l = ["uploadUrl", "uploadSize", "uploadLengthDeferred"]; s < l.length; s++) {
999
- var p = l[s];
1000
- if (this.options[p]) {
1001
- this._emitError(new Error("tus: cannot use the ".concat(p, " option when parallelUploads is enabled")));
1002
- return;
1003
- }
1004
- }
1005
- if (this.options.parallelUploadBoundaries) {
1006
- if (this.options.parallelUploads <= 1) {
1007
- this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));
1008
- return;
1009
- }
1010
- if (this.options.parallelUploads !== this.options.parallelUploadBoundaries.length) {
1011
- this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));
1012
- return;
1013
- }
1014
- }
1015
- this.options.fingerprint(n, this.options).then(function(c) {
1016
- return r._fingerprint = c, r._source ? r._source : r.options.fileReader.openFile(n, r.options.chunkSize);
1017
- }).then(function(c) {
1018
- if (r._source = c, r.options.uploadLengthDeferred)
1019
- r._size = null;
1020
- else if (r.options.uploadSize != null) {
1021
- if (r._size = Number(r.options.uploadSize), Number.isNaN(r._size)) {
1022
- r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));
1023
- return;
1024
- }
1025
- } else if (r._size = r._source.size, r._size == null) {
1026
- r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));
1027
- return;
1028
- }
1029
- r.options.parallelUploads > 1 || r._parallelUploadUrls != null ? r._startParallelUpload() : r._startSingleUpload();
1030
- }).catch(function(c) {
1031
- r._emitError(c);
1032
- });
1033
- }
1034
- /**
1035
- * Initiate the uploading procedure for a parallelized upload, where one file is split into
1036
- * multiple request which are run in parallel.
1037
- *
1038
- * @api private
1039
- */
1040
- }, {
1041
- key: "_startParallelUpload",
1042
- value: function() {
1043
- var r, n = this, o = this._size, s = 0;
1044
- this._parallelUploads = [];
1045
- var l = this._parallelUploadUrls != null ? this._parallelUploadUrls.length : this.options.parallelUploads, p = (r = this.options.parallelUploadBoundaries) !== null && r !== void 0 ? r : Lr(this._source.size, l);
1046
- this._parallelUploadUrls && p.forEach(function(v, P) {
1047
- v.uploadUrl = n._parallelUploadUrls[P] || null;
1048
- }), this._parallelUploadUrls = new Array(p.length);
1049
- var c = p.map(function(v, P) {
1050
- var S = 0;
1051
- return n._source.slice(v.start, v.end).then(function(A) {
1052
- var D = A.value;
1053
- return new Promise(function(T, R) {
1054
- var H = Z(Z({}, n.options), {}, {
1055
- // If available, the partial upload should be resumed from a previous URL.
1056
- uploadUrl: v.uploadUrl || null,
1057
- // We take manually care of resuming for partial uploads, so they should
1058
- // not be stored in the URL storage.
1059
- storeFingerprintForResuming: !1,
1060
- removeFingerprintOnSuccess: !1,
1061
- // Reset the parallelUploads option to not cause recursion.
1062
- parallelUploads: 1,
1063
- // Reset this option as we are not doing a parallel upload.
1064
- parallelUploadBoundaries: null,
1065
- metadata: n.options.metadataForPartialUploads,
1066
- // Add the header to indicate the this is a partial upload.
1067
- headers: Z(Z({}, n.options.headers), {}, {
1068
- "Upload-Concat": "partial"
1069
- }),
1070
- // Reject or resolve the promise if the upload errors or completes.
1071
- onSuccess: T,
1072
- onError: R,
1073
- // Based in the progress for this partial upload, calculate the progress
1074
- // for the entire final upload.
1075
- onProgress: function(_) {
1076
- s = s - S + _, S = _, n._emitProgress(s, o);
1077
- },
1078
- // Wait until every partial upload has an upload URL, so we can add
1079
- // them to the URL storage.
1080
- onUploadUrlAvailable: function() {
1081
- n._parallelUploadUrls[P] = g.url, n._parallelUploadUrls.filter(function(_) {
1082
- return !!_;
1083
- }).length === p.length && n._saveUploadInUrlStorage();
1084
- }
1085
- }), g = new e(D, H);
1086
- g.start(), n._parallelUploads.push(g);
1087
- });
1088
- });
1089
- }), f;
1090
- Promise.all(c).then(function() {
1091
- f = n._openRequest("POST", n.options.endpoint), f.setHeader("Upload-Concat", "final;".concat(n._parallelUploadUrls.join(" ")));
1092
- var v = nt(n.options.metadata);
1093
- return v !== "" && f.setHeader("Upload-Metadata", v), n._sendRequest(f, null);
1094
- }).then(function(v) {
1095
- if (!J(v.getStatus(), 200)) {
1096
- n._emitHttpError(f, v, "tus: unexpected response while creating upload");
1097
- return;
1098
- }
1099
- var P = v.getHeader("Location");
1100
- if (P == null) {
1101
- n._emitHttpError(f, v, "tus: invalid or missing Location header");
1102
- return;
1103
- }
1104
- n.url = ut(n.options.endpoint, P), "Created upload at ".concat(n.url), n._emitSuccess(v);
1105
- }).catch(function(v) {
1106
- n._emitError(v);
1107
- });
1108
- }
1109
- /**
1110
- * Initiate the uploading procedure for a non-parallel upload. Here the entire file is
1111
- * uploaded in a sequential matter.
1112
- *
1113
- * @api private
1114
- */
1115
- }, {
1116
- key: "_startSingleUpload",
1117
- value: function() {
1118
- if (this._aborted = !1, this.url != null) {
1119
- "Resuming upload from previous URL: ".concat(this.url), this._resumeUpload();
1120
- return;
1121
- }
1122
- if (this.options.uploadUrl != null) {
1123
- "Resuming upload from provided URL: ".concat(this.options.uploadUrl), this.url = this.options.uploadUrl, this._resumeUpload();
1124
- return;
1125
- }
1126
- this._createUpload();
1127
- }
1128
- /**
1129
- * Abort any running request and stop the current upload. After abort is called, no event
1130
- * handler will be invoked anymore. You can use the `start` method to resume the upload
1131
- * again.
1132
- * If `shouldTerminate` is true, the `terminate` function will be called to remove the
1133
- * current upload from the server.
1134
- *
1135
- * @param {boolean} shouldTerminate True if the upload should be deleted from the server.
1136
- * @return {Promise} The Promise will be resolved/rejected when the requests finish.
1137
- */
1138
- }, {
1139
- key: "abort",
1140
- value: function(r) {
1141
- var n = this;
1142
- if (this._parallelUploads != null) {
1143
- var o = Pr(this._parallelUploads), s;
1144
- try {
1145
- for (o.s(); !(s = o.n()).done; ) {
1146
- var l = s.value;
1147
- l.abort(r);
1148
- }
1149
- } catch (p) {
1150
- o.e(p);
1151
- } finally {
1152
- o.f();
1153
- }
1154
- }
1155
- return this._req !== null && this._req.abort(), this._aborted = !0, this._retryTimeout != null && (clearTimeout(this._retryTimeout), this._retryTimeout = null), !r || this.url == null ? Promise.resolve() : e.terminate(this.url, this.options).then(function() {
1156
- return n._removeFromUrlStorage();
1157
- });
1158
- }
1159
- }, {
1160
- key: "_emitHttpError",
1161
- value: function(r, n, o, s) {
1162
- this._emitError(new me(o, s, r, n));
1163
- }
1164
- }, {
1165
- key: "_emitError",
1166
- value: function(r) {
1167
- var n = this;
1168
- if (!this._aborted) {
1169
- if (this.options.retryDelays != null) {
1170
- var o = this._offset != null && this._offset > this._offsetBeforeRetry;
1171
- if (o && (this._retryAttempt = 0), at(r, this._retryAttempt, this.options)) {
1172
- var s = this.options.retryDelays[this._retryAttempt++];
1173
- this._offsetBeforeRetry = this._offset, this._retryTimeout = setTimeout(function() {
1174
- n.start();
1175
- }, s);
1176
- return;
1177
- }
1178
- }
1179
- if (typeof this.options.onError == "function")
1180
- this.options.onError(r);
1181
- else
1182
- throw r;
1183
- }
1184
- }
1185
- /**
1186
- * Publishes notification if the upload has been successfully completed.
1187
- *
1188
- * @param {object} lastResponse Last HTTP response.
1189
- * @api private
1190
- */
1191
- }, {
1192
- key: "_emitSuccess",
1193
- value: function(r) {
1194
- this.options.removeFingerprintOnSuccess && this._removeFromUrlStorage(), typeof this.options.onSuccess == "function" && this.options.onSuccess({
1195
- lastResponse: r
1196
- });
1197
- }
1198
- /**
1199
- * Publishes notification when data has been sent to the server. This
1200
- * data may not have been accepted by the server yet.
1201
- *
1202
- * @param {number} bytesSent Number of bytes sent to the server.
1203
- * @param {number} bytesTotal Total number of bytes to be sent to the server.
1204
- * @api private
1205
- */
1206
- }, {
1207
- key: "_emitProgress",
1208
- value: function(r, n) {
1209
- typeof this.options.onProgress == "function" && this.options.onProgress(r, n);
1210
- }
1211
- /**
1212
- * Publishes notification when a chunk of data has been sent to the server
1213
- * and accepted by the server.
1214
- * @param {number} chunkSize Size of the chunk that was accepted by the server.
1215
- * @param {number} bytesAccepted Total number of bytes that have been
1216
- * accepted by the server.
1217
- * @param {number} bytesTotal Total number of bytes to be sent to the server.
1218
- * @api private
1219
- */
1220
- }, {
1221
- key: "_emitChunkComplete",
1222
- value: function(r, n, o) {
1223
- typeof this.options.onChunkComplete == "function" && this.options.onChunkComplete(r, n, o);
1224
- }
1225
- /**
1226
- * Create a new upload using the creation extension by sending a POST
1227
- * request to the endpoint. After successful creation the file will be
1228
- * uploaded
1229
- *
1230
- * @api private
1231
- */
1232
- }, {
1233
- key: "_createUpload",
1234
- value: function() {
1235
- var r = this;
1236
- if (!this.options.endpoint) {
1237
- this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));
1238
- return;
1239
- }
1240
- var n = this._openRequest("POST", this.options.endpoint);
1241
- this.options.uploadLengthDeferred ? n.setHeader("Upload-Defer-Length", "1") : n.setHeader("Upload-Length", "".concat(this._size));
1242
- var o = nt(this.options.metadata);
1243
- o !== "" && n.setHeader("Upload-Metadata", o);
1244
- var s;
1245
- this.options.uploadDataDuringCreation && !this.options.uploadLengthDeferred ? (this._offset = 0, s = this._addChunkToRequest(n)) : ((this.options.protocol === Se || this.options.protocol === ue) && n.setHeader("Upload-Complete", "?0"), s = this._sendRequest(n, null)), s.then(function(l) {
1246
- if (!J(l.getStatus(), 200)) {
1247
- r._emitHttpError(n, l, "tus: unexpected response while creating upload");
1248
- return;
1249
- }
1250
- var p = l.getHeader("Location");
1251
- if (p == null) {
1252
- r._emitHttpError(n, l, "tus: invalid or missing Location header");
1253
- return;
1254
- }
1255
- if (r.url = ut(r.options.endpoint, p), "Created upload at ".concat(r.url), typeof r.options.onUploadUrlAvailable == "function" && r.options.onUploadUrlAvailable(), r._size === 0) {
1256
- r._emitSuccess(l), r._source.close();
1257
- return;
1258
- }
1259
- r._saveUploadInUrlStorage().then(function() {
1260
- r.options.uploadDataDuringCreation ? r._handleUploadResponse(n, l) : (r._offset = 0, r._performUpload());
1261
- });
1262
- }).catch(function(l) {
1263
- r._emitHttpError(n, null, "tus: failed to create upload", l);
1264
- });
1265
- }
1266
- /*
1267
- * Try to resume an existing upload. First a HEAD request will be sent
1268
- * to retrieve the offset. If the request fails a new upload will be
1269
- * created. In the case of a successful response the file will be uploaded.
1270
- *
1271
- * @api private
1272
- */
1273
- }, {
1274
- key: "_resumeUpload",
1275
- value: function() {
1276
- var r = this, n = this._openRequest("HEAD", this.url), o = this._sendRequest(n, null);
1277
- o.then(function(s) {
1278
- var l = s.getStatus();
1279
- if (!J(l, 200)) {
1280
- if (l === 423) {
1281
- r._emitHttpError(n, s, "tus: upload is currently locked; retry later");
1282
- return;
1283
- }
1284
- if (J(l, 400) && r._removeFromUrlStorage(), !r.options.endpoint) {
1285
- r._emitHttpError(n, s, "tus: unable to resume upload (new upload cannot be created without an endpoint)");
1286
- return;
1287
- }
1288
- r.url = null, r._createUpload();
1289
- return;
1290
- }
1291
- var p = Number.parseInt(s.getHeader("Upload-Offset"), 10);
1292
- if (Number.isNaN(p)) {
1293
- r._emitHttpError(n, s, "tus: invalid or missing offset value");
1294
- return;
1295
- }
1296
- var c = Number.parseInt(s.getHeader("Upload-Length"), 10);
1297
- if (Number.isNaN(c) && !r.options.uploadLengthDeferred && r.options.protocol === we) {
1298
- r._emitHttpError(n, s, "tus: invalid or missing length value");
1299
- return;
1300
- }
1301
- typeof r.options.onUploadUrlAvailable == "function" && r.options.onUploadUrlAvailable(), r._saveUploadInUrlStorage().then(function() {
1302
- if (p === c) {
1303
- r._emitProgress(c, c), r._emitSuccess(s);
1304
- return;
1305
- }
1306
- r._offset = p, r._performUpload();
1307
- });
1308
- }).catch(function(s) {
1309
- r._emitHttpError(n, null, "tus: failed to resume upload", s);
1310
- });
1311
- }
1312
- /**
1313
- * Start uploading the file using PATCH requests. The file will be divided
1314
- * into chunks as specified in the chunkSize option. During the upload
1315
- * the onProgress event handler may be invoked multiple times.
1316
- *
1317
- * @api private
1318
- */
1319
- }, {
1320
- key: "_performUpload",
1321
- value: function() {
1322
- var r = this;
1323
- if (!this._aborted) {
1324
- var n;
1325
- this.options.overridePatchMethod ? (n = this._openRequest("POST", this.url), n.setHeader("X-HTTP-Method-Override", "PATCH")) : n = this._openRequest("PATCH", this.url), n.setHeader("Upload-Offset", "".concat(this._offset));
1326
- var o = this._addChunkToRequest(n);
1327
- o.then(function(s) {
1328
- if (!J(s.getStatus(), 200)) {
1329
- r._emitHttpError(n, s, "tus: unexpected response while uploading chunk");
1330
- return;
1331
- }
1332
- r._handleUploadResponse(n, s);
1333
- }).catch(function(s) {
1334
- r._aborted || r._emitHttpError(n, null, "tus: failed to upload chunk at offset ".concat(r._offset), s);
1335
- });
1336
- }
1337
- }
1338
- /**
1339
- * _addChunktoRequest reads a chunk from the source and sends it using the
1340
- * supplied request object. It will not handle the response.
1341
- *
1342
- * @api private
1343
- */
1344
- }, {
1345
- key: "_addChunkToRequest",
1346
- value: function(r) {
1347
- var n = this, o = this._offset, s = this._offset + this.options.chunkSize;
1348
- return r.setProgressHandler(function(l) {
1349
- n._emitProgress(o + l, n._size);
1350
- }), this.options.protocol === we ? r.setHeader("Content-Type", "application/offset+octet-stream") : this.options.protocol === ue && r.setHeader("Content-Type", "application/partial-upload"), (s === Number.POSITIVE_INFINITY || s > this._size) && !this.options.uploadLengthDeferred && (s = this._size), this._source.slice(o, s).then(function(l) {
1351
- var p = l.value, c = l.done, f = p != null && p.size ? p.size : 0;
1352
- n.options.uploadLengthDeferred && c && (n._size = n._offset + f, r.setHeader("Upload-Length", "".concat(n._size)));
1353
- var v = n._offset + f;
1354
- return !n.options.uploadLengthDeferred && c && v !== n._size ? Promise.reject(new Error("upload was configured with a size of ".concat(n._size, " bytes, but the source is done after ").concat(v, " bytes"))) : p === null ? n._sendRequest(r) : ((n.options.protocol === Se || n.options.protocol === ue) && r.setHeader("Upload-Complete", c ? "?1" : "?0"), n._emitProgress(n._offset, n._size), n._sendRequest(r, p));
1355
- });
1356
- }
1357
- /**
1358
- * _handleUploadResponse is used by requests that haven been sent using _addChunkToRequest
1359
- * and already have received a response.
1360
- *
1361
- * @api private
1362
- */
1363
- }, {
1364
- key: "_handleUploadResponse",
1365
- value: function(r, n) {
1366
- var o = Number.parseInt(n.getHeader("Upload-Offset"), 10);
1367
- if (Number.isNaN(o)) {
1368
- this._emitHttpError(r, n, "tus: invalid or missing offset value");
1369
- return;
1370
- }
1371
- if (this._emitProgress(o, this._size), this._emitChunkComplete(o - this._offset, o, this._size), this._offset = o, o === this._size) {
1372
- this._emitSuccess(n), this._source.close();
1373
- return;
1374
- }
1375
- this._performUpload();
1376
- }
1377
- /**
1378
- * Create a new HTTP request object with the given method and URL.
1379
- *
1380
- * @api private
1381
- */
1382
- }, {
1383
- key: "_openRequest",
1384
- value: function(r, n) {
1385
- var o = ot(r, n, this.options);
1386
- return this._req = o, o;
1387
- }
1388
- /**
1389
- * Remove the entry in the URL storage, if it has been saved before.
1390
- *
1391
- * @api private
1392
- */
1393
- }, {
1394
- key: "_removeFromUrlStorage",
1395
- value: function() {
1396
- var r = this;
1397
- this._urlStorageKey && (this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n) {
1398
- r._emitError(n);
1399
- }), this._urlStorageKey = null);
1400
- }
1401
- /**
1402
- * Add the upload URL to the URL storage, if possible.
1403
- *
1404
- * @api private
1405
- */
1406
- }, {
1407
- key: "_saveUploadInUrlStorage",
1408
- value: function() {
1409
- var r = this;
1410
- if (!this.options.storeFingerprintForResuming || !this._fingerprint || this._urlStorageKey !== null)
1411
- return Promise.resolve();
1412
- var n = {
1413
- size: this._size,
1414
- metadata: this.options.metadata,
1415
- creationTime: (/* @__PURE__ */ new Date()).toString()
1416
- };
1417
- return this._parallelUploads ? n.parallelUploadUrls = this._parallelUploadUrls : n.uploadUrl = this.url, this._urlStorage.addUpload(this._fingerprint, n).then(function(o) {
1418
- r._urlStorageKey = o;
1419
- });
1420
- }
1421
- /**
1422
- * Send a request with the provided body.
1423
- *
1424
- * @api private
1425
- */
1426
- }, {
1427
- key: "_sendRequest",
1428
- value: function(r) {
1429
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
1430
- return it(r, n, this.options);
1431
- }
1432
- }], [{
1433
- key: "terminate",
1434
- value: function(r) {
1435
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = ot("DELETE", r, n);
1436
- return it(o, null, n).then(function(s) {
1437
- if (s.getStatus() !== 204)
1438
- throw new me("tus: unexpected response while terminating upload", null, o, s);
1439
- }).catch(function(s) {
1440
- if (s instanceof me || (s = new me("tus: failed to terminate upload", s, o, null)), !at(s, 0, n))
1441
- throw s;
1442
- var l = n.retryDelays[0], p = n.retryDelays.slice(1), c = Z(Z({}, n), {}, {
1443
- retryDelays: p
1444
- });
1445
- return new Promise(function(f) {
1446
- return setTimeout(f, l);
1447
- }).then(function() {
1448
- return e.terminate(r, c);
1449
- });
1450
- });
1451
- }
1452
- }]);
1453
- })();
1454
- function nt(e) {
1455
- return Object.entries(e).map(function(t) {
1456
- var r = kt(t, 2), n = r[0], o = r[1];
1457
- return "".concat(n, " ").concat(dr.encode(String(o)));
1458
- }).join(",");
1459
- }
1460
- function J(e, t) {
1461
- return e >= t && e < t + 100;
1462
- }
1463
- function ot(e, t, r) {
1464
- var n = r.httpStack.createRequest(e, t);
1465
- r.protocol === Se ? n.setHeader("Upload-Draft-Interop-Version", "5") : r.protocol === ue ? n.setHeader("Upload-Draft-Interop-Version", "6") : n.setHeader("Tus-Resumable", "1.0.0");
1466
- for (var o = r.headers || {}, s = 0, l = Object.entries(o); s < l.length; s++) {
1467
- var p = kt(l[s], 2), c = p[0], f = p[1];
1468
- n.setHeader(c, f);
1469
- }
1470
- if (r.addRequestId) {
1471
- var v = _r();
1472
- n.setHeader("X-Request-ID", v);
1473
- }
1474
- return n;
1475
- }
1476
- function it(e, t, r) {
1477
- return Fe.apply(this, arguments);
1478
- }
1479
- function Fe() {
1480
- return Fe = wr(/* @__PURE__ */ Ae().mark(function e(t, r, n) {
1481
- var o;
1482
- return Ae().wrap(function(l) {
1483
- for (; ; ) switch (l.prev = l.next) {
1484
- case 0:
1485
- if (typeof n.onBeforeRequest != "function") {
1486
- l.next = 3;
1487
- break;
1488
- }
1489
- return l.next = 3, n.onBeforeRequest(t);
1490
- case 3:
1491
- return l.next = 5, t.send(r);
1492
- case 5:
1493
- if (o = l.sent, typeof n.onAfterResponse != "function") {
1494
- l.next = 9;
1495
- break;
1496
- }
1497
- return l.next = 9, n.onAfterResponse(t, o);
1498
- case 9:
1499
- return l.abrupt("return", o);
1500
- case 10:
1501
- case "end":
1502
- return l.stop();
1503
- }
1504
- }, e);
1505
- })), Fe.apply(this, arguments);
1506
- }
1507
- function Tr() {
1508
- var e = !0;
1509
- return typeof navigator < "u" && navigator.onLine === !1 && (e = !1), e;
1510
- }
1511
- function at(e, t, r) {
1512
- return r.retryDelays == null || t >= r.retryDelays.length || e.originalRequest == null ? !1 : r && typeof r.onShouldRetry == "function" ? r.onShouldRetry(e, t, r) : At(e);
1513
- }
1514
- function At(e) {
1515
- var t = e.originalResponse ? e.originalResponse.getStatus() : 0;
1516
- return (!J(t, 400) || t === 409 || t === 423) && Tr();
1517
- }
1518
- function ut(e, t) {
1519
- return new br(t, e).toString();
1520
- }
1521
- function Lr(e, t) {
1522
- for (var r = Math.floor(e / t), n = [], o = 0; o < t; o++)
1523
- n.push({
1524
- start: r * o,
1525
- end: r * (o + 1)
1526
- });
1527
- return n[t - 1].end = e, n;
1528
- }
1529
- Ue.defaultOptions = kr;
1530
- var Ft = function() {
1531
- return typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
1532
- };
1533
- function Ar(e) {
1534
- return new Promise(function(t, r) {
1535
- var n = new XMLHttpRequest();
1536
- n.responseType = "blob", n.onload = function() {
1537
- var o = n.response;
1538
- t(o);
1539
- }, n.onerror = function(o) {
1540
- r(o);
1541
- }, n.open("GET", e), n.send();
1542
- });
1543
- }
1544
- var Fr = function() {
1545
- return typeof window < "u" && (typeof window.PhoneGap < "u" || typeof window.Cordova < "u" || typeof window.cordova < "u");
1546
- };
1547
- function Cr(e) {
1548
- return new Promise(function(t, r) {
1549
- var n = new FileReader();
1550
- n.onload = function() {
1551
- var o = new Uint8Array(n.result);
1552
- t({
1553
- value: o
1554
- });
1555
- }, n.onerror = function(o) {
1556
- r(o);
1557
- }, n.readAsArrayBuffer(e);
1558
- });
1559
- }
1560
- function ce(e) {
1561
- "@babel/helpers - typeof";
1562
- return ce = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
1563
- return typeof t;
1564
- } : function(t) {
1565
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1566
- }, ce(e);
1567
- }
1568
- function $r(e, t) {
1569
- if (!(e instanceof t))
1570
- throw new TypeError("Cannot call a class as a function");
1571
- }
1572
- function Ir(e, t) {
1573
- for (var r = 0; r < t.length; r++) {
1574
- var n = t[r];
1575
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, Nr(n.key), n);
1576
- }
1577
- }
1578
- function qr(e, t, r) {
1579
- return t && Ir(e.prototype, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1580
- }
1581
- function Nr(e) {
1582
- var t = Dr(e, "string");
1583
- return ce(t) == "symbol" ? t : t + "";
1584
- }
1585
- function Dr(e, t) {
1586
- if (ce(e) != "object" || !e) return e;
1587
- var r = e[Symbol.toPrimitive];
1588
- if (r !== void 0) {
1589
- var n = r.call(e, t);
1590
- if (ce(n) != "object") return n;
1591
- throw new TypeError("@@toPrimitive must return a primitive value.");
1592
- }
1593
- return String(e);
1594
- }
1595
- var st = /* @__PURE__ */ (function() {
1596
- function e(t) {
1597
- $r(this, e), this._file = t, this.size = t.size;
1598
- }
1599
- return qr(e, [{
1600
- key: "slice",
1601
- value: function(r, n) {
1602
- if (Fr())
1603
- return Cr(this._file.slice(r, n));
1604
- var o = this._file.slice(r, n), s = n >= this.size;
1605
- return Promise.resolve({
1606
- value: o,
1607
- done: s
1608
- });
1609
- }
1610
- }, {
1611
- key: "close",
1612
- value: function() {
1613
- }
1614
- }]);
1615
- })();
1616
- function pe(e) {
1617
- "@babel/helpers - typeof";
1618
- return pe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
1619
- return typeof t;
1620
- } : function(t) {
1621
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1622
- }, pe(e);
1623
- }
1624
- function Hr(e, t) {
1625
- if (!(e instanceof t))
1626
- throw new TypeError("Cannot call a class as a function");
1627
- }
1628
- function Br(e, t) {
1629
- for (var r = 0; r < t.length; r++) {
1630
- var n = t[r];
1631
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, Mr(n.key), n);
1632
- }
1633
- }
1634
- function zr(e, t, r) {
1635
- return t && Br(e.prototype, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1636
- }
1637
- function Mr(e) {
1638
- var t = Gr(e, "string");
1639
- return pe(t) == "symbol" ? t : t + "";
1640
- }
1641
- function Gr(e, t) {
1642
- if (pe(e) != "object" || !e) return e;
1643
- var r = e[Symbol.toPrimitive];
1644
- if (r !== void 0) {
1645
- var n = r.call(e, t);
1646
- if (pe(n) != "object") return n;
1647
- throw new TypeError("@@toPrimitive must return a primitive value.");
1648
- }
1649
- return String(e);
1650
- }
1651
- function lt(e) {
1652
- return e === void 0 ? 0 : e.size !== void 0 ? e.size : e.length;
1653
- }
1654
- function Kr(e, t) {
1655
- if (e.concat)
1656
- return e.concat(t);
1657
- if (e instanceof Blob)
1658
- return new Blob([e, t], {
1659
- type: e.type
1660
- });
1661
- if (e.set) {
1662
- var r = new e.constructor(e.length + t.length);
1663
- return r.set(e), r.set(t, e.length), r;
1664
- }
1665
- throw new Error("Unknown data type");
1666
- }
1667
- var Yr = /* @__PURE__ */ (function() {
1668
- function e(t) {
1669
- Hr(this, e), this._buffer = void 0, this._bufferOffset = 0, this._reader = t, this._done = !1;
1670
- }
1671
- return zr(e, [{
1672
- key: "slice",
1673
- value: function(r, n) {
1674
- return r < this._bufferOffset ? Promise.reject(new Error("Requested data is before the reader's current offset")) : this._readUntilEnoughDataOrDone(r, n);
1675
- }
1676
- }, {
1677
- key: "_readUntilEnoughDataOrDone",
1678
- value: function(r, n) {
1679
- var o = this, s = n <= this._bufferOffset + lt(this._buffer);
1680
- if (this._done || s) {
1681
- var l = this._getDataFromBuffer(r, n), p = l == null ? this._done : !1;
1682
- return Promise.resolve({
1683
- value: l,
1684
- done: p
1685
- });
1686
- }
1687
- return this._reader.read().then(function(c) {
1688
- var f = c.value, v = c.done;
1689
- return v ? o._done = !0 : o._buffer === void 0 ? o._buffer = f : o._buffer = Kr(o._buffer, f), o._readUntilEnoughDataOrDone(r, n);
1690
- });
1691
- }
1692
- }, {
1693
- key: "_getDataFromBuffer",
1694
- value: function(r, n) {
1695
- r > this._bufferOffset && (this._buffer = this._buffer.slice(r - this._bufferOffset), this._bufferOffset = r);
1696
- var o = lt(this._buffer) === 0;
1697
- return this._done && o ? null : this._buffer.slice(0, n - r);
1698
- }
1699
- }, {
1700
- key: "close",
1701
- value: function() {
1702
- this._reader.cancel && this._reader.cancel();
1703
- }
1704
- }]);
1705
- })();
1706
- function X(e) {
1707
- "@babel/helpers - typeof";
1708
- return X = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
1709
- return typeof t;
1710
- } : function(t) {
1711
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1712
- }, X(e);
1713
- }
1714
- function Ce() {
1715
- Ce = function() {
1716
- return t;
1717
- };
1718
- var e, t = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(u, i, a) {
1719
- u[i] = a.value;
1720
- }, s = typeof Symbol == "function" ? Symbol : {}, l = s.iterator || "@@iterator", p = s.asyncIterator || "@@asyncIterator", c = s.toStringTag || "@@toStringTag";
1721
- function f(u, i, a) {
1722
- return Object.defineProperty(u, i, { value: a, enumerable: !0, configurable: !0, writable: !0 }), u[i];
1723
- }
1724
- try {
1725
- f({}, "");
1726
- } catch {
1727
- f = function(a, h, b) {
1728
- return a[h] = b;
1729
- };
1730
- }
1731
- function v(u, i, a, h) {
1732
- var b = i && i.prototype instanceof H ? i : H, d = Object.create(b.prototype), E = new z(h || []);
1733
- return o(d, "_invoke", { value: B(u, a, E) }), d;
1734
- }
1735
- function P(u, i, a) {
1736
- try {
1737
- return { type: "normal", arg: u.call(i, a) };
1738
- } catch (h) {
1739
- return { type: "throw", arg: h };
1740
- }
1741
- }
1742
- t.wrap = v;
1743
- var S = "suspendedStart", A = "suspendedYield", D = "executing", T = "completed", R = {};
1744
- function H() {
1745
- }
1746
- function g() {
1747
- }
1748
- function y() {
1749
- }
1750
- var _ = {};
1751
- f(_, l, function() {
1752
- return this;
1753
- });
1754
- var m = Object.getPrototypeOf, x = m && m(m(Y([])));
1755
- x && x !== r && n.call(x, l) && (_ = x);
1756
- var U = y.prototype = H.prototype = Object.create(_);
1757
- function k(u) {
1758
- ["next", "throw", "return"].forEach(function(i) {
1759
- f(u, i, function(a) {
1760
- return this._invoke(i, a);
1761
- });
1762
- });
1763
- }
1764
- function O(u, i) {
1765
- function a(b, d, E, j) {
1766
- var L = P(u[b], u, d);
1767
- if (L.type !== "throw") {
1768
- var I = L.arg, F = I.value;
1769
- return F && X(F) == "object" && n.call(F, "__await") ? i.resolve(F.__await).then(function(q) {
1770
- a("next", q, E, j);
1771
- }, function(q) {
1772
- a("throw", q, E, j);
1773
- }) : i.resolve(F).then(function(q) {
1774
- I.value = q, E(I);
1775
- }, function(q) {
1776
- return a("throw", q, E, j);
1777
- });
1778
- }
1779
- j(L.arg);
1780
- }
1781
- var h;
1782
- o(this, "_invoke", { value: function(d, E) {
1783
- function j() {
1784
- return new i(function(L, I) {
1785
- a(d, E, L, I);
1786
- });
1787
- }
1788
- return h = h ? h.then(j, j) : j();
1789
- } });
1790
- }
1791
- function B(u, i, a) {
1792
- var h = S;
1793
- return function(b, d) {
1794
- if (h === D) throw Error("Generator is already running");
1795
- if (h === T) {
1796
- if (b === "throw") throw d;
1797
- return { value: e, done: !0 };
1798
- }
1799
- for (a.method = b, a.arg = d; ; ) {
1800
- var E = a.delegate;
1801
- if (E) {
1802
- var j = M(E, a);
1803
- if (j) {
1804
- if (j === R) continue;
1805
- return j;
1806
- }
1807
- }
1808
- if (a.method === "next") a.sent = a._sent = a.arg;
1809
- else if (a.method === "throw") {
1810
- if (h === S) throw h = T, a.arg;
1811
- a.dispatchException(a.arg);
1812
- } else a.method === "return" && a.abrupt("return", a.arg);
1813
- h = D;
1814
- var L = P(u, i, a);
1815
- if (L.type === "normal") {
1816
- if (h = a.done ? T : A, L.arg === R) continue;
1817
- return { value: L.arg, done: a.done };
1818
- }
1819
- L.type === "throw" && (h = T, a.method = "throw", a.arg = L.arg);
1820
- }
1821
- };
1822
- }
1823
- function M(u, i) {
1824
- var a = i.method, h = u.iterator[a];
1825
- if (h === e) return i.delegate = null, a === "throw" && u.iterator.return && (i.method = "return", i.arg = e, M(u, i), i.method === "throw") || a !== "return" && (i.method = "throw", i.arg = new TypeError("The iterator does not provide a '" + a + "' method")), R;
1826
- var b = P(h, u.iterator, i.arg);
1827
- if (b.type === "throw") return i.method = "throw", i.arg = b.arg, i.delegate = null, R;
1828
- var d = b.arg;
1829
- return d ? d.done ? (i[u.resultName] = d.value, i.next = u.nextLoc, i.method !== "return" && (i.method = "next", i.arg = e), i.delegate = null, R) : d : (i.method = "throw", i.arg = new TypeError("iterator result is not an object"), i.delegate = null, R);
1830
- }
1831
- function Q(u) {
1832
- var i = { tryLoc: u[0] };
1833
- 1 in u && (i.catchLoc = u[1]), 2 in u && (i.finallyLoc = u[2], i.afterLoc = u[3]), this.tryEntries.push(i);
1834
- }
1835
- function w(u) {
1836
- var i = u.completion || {};
1837
- i.type = "normal", delete i.arg, u.completion = i;
1838
- }
1839
- function z(u) {
1840
- this.tryEntries = [{ tryLoc: "root" }], u.forEach(Q, this), this.reset(!0);
1841
- }
1842
- function Y(u) {
1843
- if (u || u === "") {
1844
- var i = u[l];
1845
- if (i) return i.call(u);
1846
- if (typeof u.next == "function") return u;
1847
- if (!isNaN(u.length)) {
1848
- var a = -1, h = function b() {
1849
- for (; ++a < u.length; ) if (n.call(u, a)) return b.value = u[a], b.done = !1, b;
1850
- return b.value = e, b.done = !0, b;
1851
- };
1852
- return h.next = h;
1853
- }
1854
- }
1855
- throw new TypeError(X(u) + " is not iterable");
1856
- }
1857
- return g.prototype = y, o(U, "constructor", { value: y, configurable: !0 }), o(y, "constructor", { value: g, configurable: !0 }), g.displayName = f(y, c, "GeneratorFunction"), t.isGeneratorFunction = function(u) {
1858
- var i = typeof u == "function" && u.constructor;
1859
- return !!i && (i === g || (i.displayName || i.name) === "GeneratorFunction");
1860
- }, t.mark = function(u) {
1861
- return Object.setPrototypeOf ? Object.setPrototypeOf(u, y) : (u.__proto__ = y, f(u, c, "GeneratorFunction")), u.prototype = Object.create(U), u;
1862
- }, t.awrap = function(u) {
1863
- return { __await: u };
1864
- }, k(O.prototype), f(O.prototype, p, function() {
1865
- return this;
1866
- }), t.AsyncIterator = O, t.async = function(u, i, a, h, b) {
1867
- b === void 0 && (b = Promise);
1868
- var d = new O(v(u, i, a, h), b);
1869
- return t.isGeneratorFunction(i) ? d : d.next().then(function(E) {
1870
- return E.done ? E.value : d.next();
1871
- });
1872
- }, k(U), f(U, c, "Generator"), f(U, l, function() {
1873
- return this;
1874
- }), f(U, "toString", function() {
1875
- return "[object Generator]";
1876
- }), t.keys = function(u) {
1877
- var i = Object(u), a = [];
1878
- for (var h in i) a.push(h);
1879
- return a.reverse(), function b() {
1880
- for (; a.length; ) {
1881
- var d = a.pop();
1882
- if (d in i) return b.value = d, b.done = !1, b;
1883
- }
1884
- return b.done = !0, b;
1885
- };
1886
- }, t.values = Y, z.prototype = { constructor: z, reset: function(i) {
1887
- if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(w), !i) for (var a in this) a.charAt(0) === "t" && n.call(this, a) && !isNaN(+a.slice(1)) && (this[a] = e);
1888
- }, stop: function() {
1889
- this.done = !0;
1890
- var i = this.tryEntries[0].completion;
1891
- if (i.type === "throw") throw i.arg;
1892
- return this.rval;
1893
- }, dispatchException: function(i) {
1894
- if (this.done) throw i;
1895
- var a = this;
1896
- function h(I, F) {
1897
- return E.type = "throw", E.arg = i, a.next = I, F && (a.method = "next", a.arg = e), !!F;
1898
- }
1899
- for (var b = this.tryEntries.length - 1; b >= 0; --b) {
1900
- var d = this.tryEntries[b], E = d.completion;
1901
- if (d.tryLoc === "root") return h("end");
1902
- if (d.tryLoc <= this.prev) {
1903
- var j = n.call(d, "catchLoc"), L = n.call(d, "finallyLoc");
1904
- if (j && L) {
1905
- if (this.prev < d.catchLoc) return h(d.catchLoc, !0);
1906
- if (this.prev < d.finallyLoc) return h(d.finallyLoc);
1907
- } else if (j) {
1908
- if (this.prev < d.catchLoc) return h(d.catchLoc, !0);
1909
- } else {
1910
- if (!L) throw Error("try statement without catch or finally");
1911
- if (this.prev < d.finallyLoc) return h(d.finallyLoc);
1912
- }
1913
- }
1914
- }
1915
- }, abrupt: function(i, a) {
1916
- for (var h = this.tryEntries.length - 1; h >= 0; --h) {
1917
- var b = this.tryEntries[h];
1918
- if (b.tryLoc <= this.prev && n.call(b, "finallyLoc") && this.prev < b.finallyLoc) {
1919
- var d = b;
1920
- break;
1921
- }
1922
- }
1923
- d && (i === "break" || i === "continue") && d.tryLoc <= a && a <= d.finallyLoc && (d = null);
1924
- var E = d ? d.completion : {};
1925
- return E.type = i, E.arg = a, d ? (this.method = "next", this.next = d.finallyLoc, R) : this.complete(E);
1926
- }, complete: function(i, a) {
1927
- if (i.type === "throw") throw i.arg;
1928
- return i.type === "break" || i.type === "continue" ? this.next = i.arg : i.type === "return" ? (this.rval = this.arg = i.arg, this.method = "return", this.next = "end") : i.type === "normal" && a && (this.next = a), R;
1929
- }, finish: function(i) {
1930
- for (var a = this.tryEntries.length - 1; a >= 0; --a) {
1931
- var h = this.tryEntries[a];
1932
- if (h.finallyLoc === i) return this.complete(h.completion, h.afterLoc), w(h), R;
1933
- }
1934
- }, catch: function(i) {
1935
- for (var a = this.tryEntries.length - 1; a >= 0; --a) {
1936
- var h = this.tryEntries[a];
1937
- if (h.tryLoc === i) {
1938
- var b = h.completion;
1939
- if (b.type === "throw") {
1940
- var d = b.arg;
1941
- w(h);
1942
- }
1943
- return d;
1944
- }
1945
- }
1946
- throw Error("illegal catch attempt");
1947
- }, delegateYield: function(i, a, h) {
1948
- return this.delegate = { iterator: Y(i), resultName: a, nextLoc: h }, this.method === "next" && (this.arg = e), R;
1949
- } }, t;
1950
- }
1951
- function ft(e, t, r, n, o, s, l) {
1952
- try {
1953
- var p = e[s](l), c = p.value;
1954
- } catch (f) {
1955
- r(f);
1956
- return;
1957
- }
1958
- p.done ? t(c) : Promise.resolve(c).then(n, o);
1959
- }
1960
- function Vr(e) {
1961
- return function() {
1962
- var t = this, r = arguments;
1963
- return new Promise(function(n, o) {
1964
- var s = e.apply(t, r);
1965
- function l(c) {
1966
- ft(s, n, o, l, p, "next", c);
1967
- }
1968
- function p(c) {
1969
- ft(s, n, o, l, p, "throw", c);
1970
- }
1971
- l(void 0);
1972
- });
1973
- };
1974
- }
1975
- function Wr(e, t) {
1976
- if (!(e instanceof t))
1977
- throw new TypeError("Cannot call a class as a function");
1978
- }
1979
- function Xr(e, t) {
1980
- for (var r = 0; r < t.length; r++) {
1981
- var n = t[r];
1982
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, Zr(n.key), n);
1983
- }
1984
- }
1985
- function Qr(e, t, r) {
1986
- return t && Xr(e.prototype, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1987
- }
1988
- function Zr(e) {
1989
- var t = Jr(e, "string");
1990
- return X(t) == "symbol" ? t : t + "";
1991
- }
1992
- function Jr(e, t) {
1993
- if (X(e) != "object" || !e) return e;
1994
- var r = e[Symbol.toPrimitive];
1995
- if (r !== void 0) {
1996
- var n = r.call(e, t);
1997
- if (X(n) != "object") return n;
1998
- throw new TypeError("@@toPrimitive must return a primitive value.");
1999
- }
2000
- return String(e);
2001
- }
2002
- var en = /* @__PURE__ */ (function() {
2003
- function e() {
2004
- Wr(this, e);
2005
- }
2006
- return Qr(e, [{
2007
- key: "openFile",
2008
- value: (function() {
2009
- var t = Vr(/* @__PURE__ */ Ce().mark(function n(o, s) {
2010
- var l;
2011
- return Ce().wrap(function(c) {
2012
- for (; ; ) switch (c.prev = c.next) {
2013
- case 0:
2014
- if (!(Ft() && o && typeof o.uri < "u")) {
2015
- c.next = 11;
2016
- break;
2017
- }
2018
- return c.prev = 1, c.next = 4, Ar(o.uri);
2019
- case 4:
2020
- return l = c.sent, c.abrupt("return", new st(l));
2021
- case 8:
2022
- throw c.prev = 8, c.t0 = c.catch(1), new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(c.t0));
2023
- case 11:
2024
- if (!(typeof o.slice == "function" && typeof o.size < "u")) {
2025
- c.next = 13;
2026
- break;
2027
- }
2028
- return c.abrupt("return", Promise.resolve(new st(o)));
2029
- case 13:
2030
- if (typeof o.read != "function") {
2031
- c.next = 18;
2032
- break;
2033
- }
2034
- if (s = Number(s), Number.isFinite(s)) {
2035
- c.next = 17;
2036
- break;
2037
- }
2038
- return c.abrupt("return", Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));
2039
- case 17:
2040
- return c.abrupt("return", Promise.resolve(new Yr(o, s)));
2041
- case 18:
2042
- return c.abrupt("return", Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));
2043
- case 19:
2044
- case "end":
2045
- return c.stop();
2046
- }
2047
- }, n, null, [[1, 8]]);
2048
- }));
2049
- function r(n, o) {
2050
- return t.apply(this, arguments);
2051
- }
2052
- return r;
2053
- })()
2054
- }]);
2055
- })();
2056
- function tn(e, t) {
2057
- return Ft() ? Promise.resolve(rn(e, t)) : Promise.resolve(["tus-br", e.name, e.type, e.size, e.lastModified, t.endpoint].join("-"));
2058
- }
2059
- function rn(e, t) {
2060
- var r = e.exif ? nn(JSON.stringify(e.exif)) : "noexif";
2061
- return ["tus-rn", e.name || "noname", e.size || "nosize", r, t.endpoint].join("/");
2062
- }
2063
- function nn(e) {
2064
- var t = 0;
2065
- if (e.length === 0)
2066
- return t;
2067
- for (var r = 0; r < e.length; r++) {
2068
- var n = e.charCodeAt(r);
2069
- t = (t << 5) - t + n, t &= t;
2070
- }
2071
- return t;
2072
- }
2073
- function he(e) {
2074
- "@babel/helpers - typeof";
2075
- return he = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
2076
- return typeof t;
2077
- } : function(t) {
2078
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
2079
- }, he(e);
2080
- }
2081
- function Be(e, t) {
2082
- if (!(e instanceof t))
2083
- throw new TypeError("Cannot call a class as a function");
2084
- }
2085
- function on(e, t) {
2086
- for (var r = 0; r < t.length; r++) {
2087
- var n = t[r];
2088
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, an(n.key), n);
2089
- }
2090
- }
2091
- function ze(e, t, r) {
2092
- return t && on(e.prototype, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
2093
- }
2094
- function an(e) {
2095
- var t = un(e, "string");
2096
- return he(t) == "symbol" ? t : t + "";
2097
- }
2098
- function un(e, t) {
2099
- if (he(e) != "object" || !e) return e;
2100
- var r = e[Symbol.toPrimitive];
2101
- if (r !== void 0) {
2102
- var n = r.call(e, t);
2103
- if (he(n) != "object") return n;
2104
- throw new TypeError("@@toPrimitive must return a primitive value.");
2105
- }
2106
- return String(e);
2107
- }
2108
- var sn = /* @__PURE__ */ (function() {
2109
- function e() {
2110
- Be(this, e);
2111
- }
2112
- return ze(e, [{
2113
- key: "createRequest",
2114
- value: function(r, n) {
2115
- return new ln(r, n);
2116
- }
2117
- }, {
2118
- key: "getName",
2119
- value: function() {
2120
- return "XHRHttpStack";
2121
- }
2122
- }]);
2123
- })(), ln = /* @__PURE__ */ (function() {
2124
- function e(t, r) {
2125
- Be(this, e), this._xhr = new XMLHttpRequest(), this._xhr.open(t, r, !0), this._method = t, this._url = r, this._headers = {};
2126
- }
2127
- return ze(e, [{
2128
- key: "getMethod",
2129
- value: function() {
2130
- return this._method;
2131
- }
2132
- }, {
2133
- key: "getURL",
2134
- value: function() {
2135
- return this._url;
2136
- }
2137
- }, {
2138
- key: "setHeader",
2139
- value: function(r, n) {
2140
- this._xhr.setRequestHeader(r, n), this._headers[r] = n;
2141
- }
2142
- }, {
2143
- key: "getHeader",
2144
- value: function(r) {
2145
- return this._headers[r];
2146
- }
2147
- }, {
2148
- key: "setProgressHandler",
2149
- value: function(r) {
2150
- "upload" in this._xhr && (this._xhr.upload.onprogress = function(n) {
2151
- n.lengthComputable && r(n.loaded);
2152
- });
2153
- }
2154
- }, {
2155
- key: "send",
2156
- value: function() {
2157
- var r = this, n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
2158
- return new Promise(function(o, s) {
2159
- r._xhr.onload = function() {
2160
- o(new fn(r._xhr));
2161
- }, r._xhr.onerror = function(l) {
2162
- s(l);
2163
- }, r._xhr.send(n);
2164
- });
2165
- }
2166
- }, {
2167
- key: "abort",
2168
- value: function() {
2169
- return this._xhr.abort(), Promise.resolve();
2170
- }
2171
- }, {
2172
- key: "getUnderlyingObject",
2173
- value: function() {
2174
- return this._xhr;
2175
- }
2176
- }]);
2177
- })(), fn = /* @__PURE__ */ (function() {
2178
- function e(t) {
2179
- Be(this, e), this._xhr = t;
2180
- }
2181
- return ze(e, [{
2182
- key: "getStatus",
2183
- value: function() {
2184
- return this._xhr.status;
2185
- }
2186
- }, {
2187
- key: "getHeader",
2188
- value: function(r) {
2189
- return this._xhr.getResponseHeader(r);
2190
- }
2191
- }, {
2192
- key: "getBody",
2193
- value: function() {
2194
- return this._xhr.responseText;
2195
- }
2196
- }, {
2197
- key: "getUnderlyingObject",
2198
- value: function() {
2199
- return this._xhr;
2200
- }
2201
- }]);
2202
- })();
2203
- function de(e) {
2204
- "@babel/helpers - typeof";
2205
- return de = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
2206
- return typeof t;
2207
- } : function(t) {
2208
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
2209
- }, de(e);
2210
- }
2211
- function cn(e, t) {
2212
- if (!(e instanceof t))
2213
- throw new TypeError("Cannot call a class as a function");
2214
- }
2215
- function pn(e, t) {
2216
- for (var r = 0; r < t.length; r++) {
2217
- var n = t[r];
2218
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, dn(n.key), n);
2219
- }
2220
- }
2221
- function hn(e, t, r) {
2222
- return t && pn(e.prototype, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
2223
- }
2224
- function dn(e) {
2225
- var t = yn(e, "string");
2226
- return de(t) == "symbol" ? t : t + "";
2227
- }
2228
- function yn(e, t) {
2229
- if (de(e) != "object" || !e) return e;
2230
- var r = e[Symbol.toPrimitive];
2231
- if (r !== void 0) {
2232
- var n = r.call(e, t);
2233
- if (de(n) != "object") return n;
2234
- throw new TypeError("@@toPrimitive must return a primitive value.");
2235
- }
2236
- return String(e);
2237
- }
2238
- var $e = !1;
2239
- try {
2240
- $e = "localStorage" in window;
2241
- var Re = "tusSupport", ct = localStorage.getItem(Re);
2242
- localStorage.setItem(Re, ct), ct === null && localStorage.removeItem(Re);
2243
- } catch (e) {
2244
- if (e.code === e.SECURITY_ERR || e.code === e.QUOTA_EXCEEDED_ERR)
2245
- $e = !1;
2246
- else
2247
- throw e;
2248
- }
2249
- var mn = $e, vn = /* @__PURE__ */ (function() {
2250
- function e() {
2251
- cn(this, e);
2252
- }
2253
- return hn(e, [{
2254
- key: "findAllUploads",
2255
- value: function() {
2256
- var r = this._findEntries("tus::");
2257
- return Promise.resolve(r);
2258
- }
2259
- }, {
2260
- key: "findUploadsByFingerprint",
2261
- value: function(r) {
2262
- var n = this._findEntries("tus::".concat(r, "::"));
2263
- return Promise.resolve(n);
2264
- }
2265
- }, {
2266
- key: "removeUpload",
2267
- value: function(r) {
2268
- return localStorage.removeItem(r), Promise.resolve();
2269
- }
2270
- }, {
2271
- key: "addUpload",
2272
- value: function(r, n) {
2273
- var o = Math.round(Math.random() * 1e12), s = "tus::".concat(r, "::").concat(o);
2274
- return localStorage.setItem(s, JSON.stringify(n)), Promise.resolve(s);
2275
- }
2276
- }, {
2277
- key: "_findEntries",
2278
- value: function(r) {
2279
- for (var n = [], o = 0; o < localStorage.length; o++) {
2280
- var s = localStorage.key(o);
2281
- if (s.indexOf(r) === 0)
2282
- try {
2283
- var l = JSON.parse(localStorage.getItem(s));
2284
- l.urlStorageKey = s, n.push(l);
2285
- } catch {
2286
- }
2287
- }
2288
- return n;
2289
- }
2290
- }]);
2291
- })();
2292
- function ne(e) {
2293
- "@babel/helpers - typeof";
2294
- return ne = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
2295
- return typeof t;
2296
- } : function(t) {
2297
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
2298
- }, ne(e);
2299
- }
2300
- function gn(e, t) {
2301
- if (!(e instanceof t))
2302
- throw new TypeError("Cannot call a class as a function");
2303
- }
2304
- function bn(e, t) {
2305
- for (var r = 0; r < t.length; r++) {
2306
- var n = t[r];
2307
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, $t(n.key), n);
2308
- }
2309
- }
2310
- function _n(e, t, r) {
2311
- return r && bn(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e;
2312
- }
2313
- function wn(e, t, r) {
2314
- return t = Ee(t), Sn(e, Ct() ? Reflect.construct(t, r || [], Ee(e).constructor) : t.apply(e, r));
2315
- }
2316
- function Sn(e, t) {
2317
- if (t && (ne(t) === "object" || typeof t == "function"))
2318
- return t;
2319
- if (t !== void 0)
2320
- throw new TypeError("Derived constructors may only return object or undefined");
2321
- return Un(e);
2322
- }
2323
- function Un(e) {
2324
- if (e === void 0)
2325
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2326
- return e;
2327
- }
2328
- function Ct() {
2329
- try {
2330
- var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2331
- }));
2332
- } catch {
2333
- }
2334
- return (Ct = function() {
2335
- return !!e;
2336
- })();
2337
- }
2338
- function Ee(e) {
2339
- return Ee = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(r) {
2340
- return r.__proto__ || Object.getPrototypeOf(r);
2341
- }, Ee(e);
2342
- }
2343
- function En(e, t) {
2344
- if (typeof t != "function" && t !== null)
2345
- throw new TypeError("Super expression must either be null or a function");
2346
- e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && Ie(e, t);
2347
- }
2348
- function Ie(e, t) {
2349
- return Ie = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, o) {
2350
- return n.__proto__ = o, n;
2351
- }, Ie(e, t);
2352
- }
2353
- function pt(e, t) {
2354
- var r = Object.keys(e);
2355
- if (Object.getOwnPropertySymbols) {
2356
- var n = Object.getOwnPropertySymbols(e);
2357
- t && (n = n.filter(function(o) {
2358
- return Object.getOwnPropertyDescriptor(e, o).enumerable;
2359
- })), r.push.apply(r, n);
2360
- }
2361
- return r;
2362
- }
2363
- function te(e) {
2364
- for (var t = 1; t < arguments.length; t++) {
2365
- var r = arguments[t] != null ? arguments[t] : {};
2366
- t % 2 ? pt(Object(r), !0).forEach(function(n) {
2367
- Pn(e, n, r[n]);
2368
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : pt(Object(r)).forEach(function(n) {
2369
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
2370
- });
2371
- }
2372
- return e;
2373
- }
2374
- function Pn(e, t, r) {
2375
- return t = $t(t), t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
2376
- }
2377
- function $t(e) {
2378
- var t = xn(e, "string");
2379
- return ne(t) == "symbol" ? t : t + "";
2380
- }
2381
- function xn(e, t) {
2382
- if (ne(e) != "object" || !e) return e;
2383
- var r = e[Symbol.toPrimitive];
2384
- if (r !== void 0) {
2385
- var n = r.call(e, t);
2386
- if (ne(n) != "object") return n;
2387
- throw new TypeError("@@toPrimitive must return a primitive value.");
2388
- }
2389
- return (t === "string" ? String : Number)(e);
2390
- }
2391
- var ht = te(te({}, Ue.defaultOptions), {}, {
2392
- httpStack: new sn(),
2393
- fileReader: new en(),
2394
- urlStorage: mn ? new vn() : new nr(),
2395
- fingerprint: tn
2396
- }), On = /* @__PURE__ */ (function(e) {
2397
- function t() {
2398
- var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2399
- return gn(this, t), n = te(te({}, ht), n), wn(this, t, [r, n]);
2400
- }
2401
- return En(t, e), _n(t, null, [{
2402
- key: "terminate",
2403
- value: function(n) {
2404
- var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2405
- return o = te(te({}, ht), o), Ue.terminate(n, o);
2406
- }
2407
- }]);
2408
- })(Ue);
2409
- const $ = "file", oe = 1e3 * 60 * 60, N = Nt(yt.VITE_APP_TITLE);
2410
- V.object({
2411
- appName: V.string().min(1).max(255).default(N).optional(),
2412
- subId: V.uuid()
2413
- });
2414
- const Jn = (e, t) => {
2415
- const r = G.c(12);
2416
- let n;
2417
- r[0] !== e.appName || r[1] !== e.subId ? (n = new URLSearchParams(), n.append("appName", e.appName ?? N), n.append("subId", e.subId), r[0] = e.appName, r[1] = e.subId, r[2] = n) : n = r[2];
2418
- const o = e.appName ?? N;
2419
- let s;
2420
- r[3] !== e.subId || r[4] !== o ? (s = [$, "meta", o, e.subId], r[3] = e.subId, r[4] = o, r[5] = s) : s = r[5];
2421
- let l;
2422
- r[6] !== n ? (l = (c) => {
2423
- const {
2424
- signal: f
2425
- } = c;
2426
- return K.request({
2427
- url: `/${$}/v1/meta?${n.toString()}`,
2428
- method: "GET",
2429
- signal: f
2430
- }).then(Rn);
2431
- }, r[6] = n, r[7] = l) : l = r[7];
2432
- let p;
2433
- return r[8] !== t || r[9] !== s || r[10] !== l ? (p = {
2434
- ...t,
2435
- queryKey: s,
2436
- queryFn: l,
2437
- staleTime: oe,
2438
- gcTime: oe,
2439
- refetchOnWindowFocus: !1
2440
- }, r[8] = t, r[9] = s, r[10] = l, r[11] = p) : p = r[11], qe(p);
2441
- };
2442
- V.object({
2443
- appName: V.string().min(1).max(255).default(N).optional(),
2444
- meta: dt.nullish()
2445
- });
2446
- const eo = (e, t) => {
2447
- const r = G.c(13);
2448
- let n;
2449
- r[0] !== e.appName || r[1] !== e.meta?.id ? (n = new URLSearchParams(), n.append("appName", e.appName ?? N), n.append("id", e.meta?.id ?? ""), r[0] = e.appName, r[1] = e.meta?.id, r[2] = n) : n = r[2];
2450
- const o = e.appName ?? N, s = e.meta?.id;
2451
- let l;
2452
- r[3] !== o || r[4] !== s ? (l = [$, "thumbnail", o, s], r[3] = o, r[4] = s, r[5] = l) : l = r[5];
2453
- let p;
2454
- r[6] !== n ? (p = (v) => {
2455
- const {
2456
- signal: P
2457
- } = v;
2458
- return K.request({
2459
- url: `/${$}/v1/thumbnail?${n.toString()}`,
2460
- method: "GET",
2461
- signal: P,
2462
- responseType: "blob"
2463
- }).then(jn);
2464
- }, r[6] = n, r[7] = p) : p = r[7];
2465
- const c = !!e.meta && t?.enabled !== !1;
2466
- let f;
2467
- return r[8] !== t || r[9] !== l || r[10] !== p || r[11] !== c ? (f = {
2468
- ...t,
2469
- queryKey: l,
2470
- queryFn: p,
2471
- select: kn,
2472
- staleTime: oe,
2473
- gcTime: oe,
2474
- refetchOnWindowFocus: !1,
2475
- enabled: c
2476
- }, r[8] = t, r[9] = l, r[10] = p, r[11] = c, r[12] = f) : f = r[12], qe(f);
2477
- };
2478
- V.object({
2479
- appName: V.string().min(1).max(255).default(N).optional(),
2480
- meta: dt.nullish()
2481
- });
2482
- const to = (e, t) => {
2483
- const r = G.c(13);
2484
- let n;
2485
- r[0] !== e.appName || r[1] !== e.meta?.id ? (n = new URLSearchParams(), n.append("appName", e.appName ?? N), n.append("id", e.meta?.id ?? ""), r[0] = e.appName, r[1] = e.meta?.id, r[2] = n) : n = r[2];
2486
- const o = e.appName ?? N, s = e.meta?.id;
2487
- let l;
2488
- r[3] !== o || r[4] !== s ? (l = [$, o, s], r[3] = o, r[4] = s, r[5] = l) : l = r[5];
2489
- let p;
2490
- r[6] !== n ? (p = (v) => {
2491
- const {
2492
- signal: P
2493
- } = v;
2494
- return K.request({
2495
- url: `/${$}/v1?${n.toString()}`,
2496
- method: "GET",
2497
- signal: P,
2498
- responseType: "blob"
2499
- }).then(Tn);
2500
- }, r[6] = n, r[7] = p) : p = r[7];
2501
- const c = !!e.meta && t?.enabled !== !1;
2502
- let f;
2503
- return r[8] !== t || r[9] !== l || r[10] !== p || r[11] !== c ? (f = {
2504
- ...t,
2505
- queryKey: l,
2506
- queryFn: p,
2507
- select: Ln,
2508
- staleTime: oe,
2509
- gcTime: oe,
2510
- refetchOnWindowFocus: !1,
2511
- enabled: c
2512
- }, r[8] = t, r[9] = l, r[10] = p, r[11] = c, r[12] = f) : f = r[12], qe(f);
2513
- }, ro = (e) => {
2514
- const t = G.c(2);
2515
- let r;
2516
- return t[0] !== e ? (r = {
2517
- ...e,
2518
- mutationFn: Fn,
2519
- onSuccess: Cn
2520
- }, t[0] = e, t[1] = r) : r = t[1], ye(r);
2521
- }, no = (e) => {
2522
- const t = G.c(2);
2523
- let r;
2524
- return t[0] !== e ? (r = {
2525
- ...e,
2526
- mutationFn: In,
2527
- onSuccess: qn
2528
- }, t[0] = e, t[1] = r) : r = t[1], ye(r);
2529
- }, oo = (e) => {
2530
- const t = G.c(5), r = Pe();
2531
- let n;
2532
- t[0] !== r ? (n = () => r.invalidateQueries({
2533
- queryKey: [$, "meta"],
2534
- exact: !1
2535
- }), t[0] = r, t[1] = n) : n = t[1];
2536
- let o;
2537
- return t[2] !== e || t[3] !== n ? (o = {
2538
- ...e,
2539
- mutationFn: Dn,
2540
- onSettled: n
2541
- }, t[2] = e, t[3] = n, t[4] = o) : o = t[4], ye(o);
2542
- }, io = (e) => {
2543
- const t = G.c(5), r = Pe();
2544
- let n;
2545
- t[0] !== r ? (n = () => r.invalidateQueries({
2546
- queryKey: [$, "meta"],
2547
- exact: !1
2548
- }), t[0] = r, t[1] = n) : n = t[1];
2549
- let o;
2550
- return t[2] !== e || t[3] !== n ? (o = {
2551
- ...e,
2552
- mutationFn: Bn,
2553
- onSettled: n
2554
- }, t[2] = e, t[3] = n, t[4] = o) : o = t[4], ye(o);
2555
- }, ao = (e) => {
2556
- const t = G.c(5), r = Pe();
2557
- let n;
2558
- t[0] !== r ? (n = () => r.invalidateQueries({
2559
- queryKey: [$, "meta"],
2560
- exact: !1
2561
- }), t[0] = r, t[1] = n) : n = t[1];
2562
- let o;
2563
- return t[2] !== e || t[3] !== n ? (o = {
2564
- ...e,
2565
- mutationFn: Mn,
2566
- onSettled: n
2567
- }, t[2] = e, t[3] = n, t[4] = o) : o = t[4], ye(o);
2568
- }, uo = (e) => {
2569
- const t = G.c(8), {
2570
- subId: r,
2571
- onSuccess: n,
2572
- onError: o
2573
- } = e, [s, l] = It(0), p = Pe();
2574
- let c;
2575
- t[0] !== o || t[1] !== n || t[2] !== p || t[3] !== r ? (c = async (P) => {
2576
- if (!r)
2577
- throw new Error("subId is required for file upload");
2578
- const S = {
2579
- id: qt(),
2580
- appName: N,
2581
- subId: r,
2582
- fileName: P.name
2583
- }, A = new On(P, {
2584
- endpoint: `${yt.VITE_API_URL}/${$}/v1/upload`,
2585
- chunkSize: 1048576,
2586
- metadata: {
2587
- id: S.id,
2588
- appName: S.appName,
2589
- subId: S.subId,
2590
- fileName: S.fileName,
2591
- fileExtension: P.type
2592
- },
2593
- headers: {
2594
- Authorization: "Bearer YOUR_ACCESS_TOKEN_HERE"
2595
- },
2596
- onError: (T) => {
2597
- l(0), o?.(T);
2598
- },
2599
- onProgress: (T, R) => {
2600
- l(T / R * 100);
2601
- },
2602
- onSuccess: () => {
2603
- l(0), p.invalidateQueries({
2604
- queryKey: [$, "meta", r],
2605
- exact: !1
2606
- }), n?.(S);
2607
- }
2608
- }), D = await A.findPreviousUploads();
2609
- D.length > 0 && A.resumeFromPreviousUpload(D[0]), A.start();
2610
- }, t[0] = o, t[1] = n, t[2] = p, t[3] = r, t[4] = c) : c = t[4];
2611
- const f = c;
2612
- let v;
2613
- return t[5] !== f || t[6] !== s ? (v = {
2614
- mutate: f,
2615
- progress: s
2616
- }, t[5] = f, t[6] = s, t[7] = v) : v = t[7], v;
2617
- };
2618
- function Rn(e) {
2619
- return e.data;
2620
- }
2621
- function jn(e) {
2622
- return e.data;
2623
- }
2624
- function kn(e) {
2625
- return URL.createObjectURL(e);
2626
- }
2627
- function Tn(e) {
2628
- return e.data;
2629
- }
2630
- function Ln(e) {
2631
- return URL.createObjectURL(e);
2632
- }
2633
- function An(e) {
2634
- return e.data;
2635
- }
2636
- function Fn(e) {
2637
- return K.request({
2638
- url: `/${$}/v1/download?appName=${N}&id=${e.id}`,
2639
- method: "GET",
2640
- responseType: "blob"
2641
- }).then(An);
2642
- }
2643
- function Cn(e, t) {
2644
- return zt(e, `${t.fileName}.${t.fileExtension}`);
2645
- }
2646
- function $n(e) {
2647
- return e.data;
2648
- }
2649
- function In(e) {
2650
- return K.request({
2651
- url: `/${$}/v1?appName=${N}&id=${e.id}`,
2652
- method: "GET",
2653
- responseType: "blob"
2654
- }).then($n);
2655
- }
2656
- function qn(e) {
2657
- window.open(URL.createObjectURL(e));
2658
- }
2659
- function Nn(e) {
2660
- return e.data;
2661
- }
2662
- function Dn(e) {
2663
- return K.request({
2664
- url: `/${$}/v1/meta?appName=${N}&id=${e.id}`,
2665
- method: "PUT",
2666
- data: e
2667
- }).then(Nn);
2668
- }
2669
- function Hn(e) {
2670
- return e.data;
2671
- }
2672
- function Bn(e) {
2673
- return K.request({
2674
- url: `/${$}/v1?appName=${N}&id=${e.id}`,
2675
- method: "DELETE"
2676
- }).then(Hn);
2677
- }
2678
- function zn(e) {
2679
- return e.data;
2680
- }
2681
- function Mn(e) {
2682
- return K.request({
2683
- url: `/${$}/v1?appName=${N}&subId=${e}`,
2684
- method: "DELETE"
2685
- }).then(zn);
2686
- }
2687
- export {
2688
- eo as a,
2689
- to as b,
2690
- ro as c,
2691
- no as d,
2692
- oo as e,
2693
- io as f,
2694
- ao as g,
2695
- uo as h,
2696
- mt as i,
2697
- Jn as u
2698
- };
2699
- //# sourceMappingURL=FileHooks-CstZ4QII.js.map