@addsign/moje-agenda-shared-lib 2.0.52 → 2.0.53
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.
- package/dist/Combination-DK1PD8Kn.js +1162 -0
- package/dist/Combination-DK1PD8Kn.js.map +1 -0
- package/dist/Dialog-BCdHj5XF.js +424 -0
- package/dist/Dialog-BCdHj5XF.js.map +1 -0
- package/dist/assets/style.css +3 -3
- package/dist/components/Attachments.js +2 -2
- package/dist/components/datatable/DataTable.js +2 -2
- package/dist/components/datatable/DataTableServer.js +175 -141
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBar.js +2 -2
- package/dist/components/form/AutocompleteSearchBarServer.js +2 -2
- package/dist/components/form/FileInput.js +2 -2
- package/dist/components/form/FileInputMultiple.js +2 -2
- package/dist/components/form/FormField.js +2 -2
- package/dist/components/form/PositionsSelectorSingle.js +2 -2
- package/dist/components/form/SelectField.js +2 -2
- package/dist/components/layout/Neoptimizovano.js +2 -2
- package/dist/components/profiles/ProfileOverview.js +2 -2
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/select.js.map +1 -1
- package/dist/index-BDmNRBtj.js +28864 -0
- package/dist/index-BDmNRBtj.js.map +1 -0
- package/dist/index-BE-ioJyt.js +2399 -0
- package/dist/index-BE-ioJyt.js.map +1 -0
- package/dist/index-BP2JKuhl.js +18 -0
- package/dist/index-BP2JKuhl.js.map +1 -0
- package/dist/index-BwPkj4HH.js +2203 -0
- package/dist/index-BwPkj4HH.js.map +1 -0
- package/dist/index-CZ8q92_F.js +234 -0
- package/dist/index-CZ8q92_F.js.map +1 -0
- package/dist/index-Cz20_uvt.js +36 -0
- package/dist/index-Cz20_uvt.js.map +1 -0
- package/dist/index.es-Dtj1Qgb9.js +9600 -0
- package/dist/index.es-Dtj1Qgb9.js.map +1 -0
- package/dist/jspdf.plugin.autotable-DuWOu3BU.js +11475 -0
- package/dist/jspdf.plugin.autotable-DuWOu3BU.js.map +1 -0
- package/dist/popover--cBqrVd7.js +319 -0
- package/dist/popover--cBqrVd7.js.map +1 -0
- package/lib/components/datatable/DataTableServer.tsx +86 -42
- package/lib/components/ui/select.tsx +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2399 @@
|
|
|
1
|
+
import React__default, { useMemo, useRef, useReducer, useEffect, useCallback, forwardRef, useImperativeHandle, Fragment as Fragment$1 } from "react";
|
|
2
|
+
import { a as getAugmentedNamespace, g as getDefaultExportFromCjs } from "./_commonjsHelpers-LQfde5yM.js";
|
|
3
|
+
import { _ as __awaiter, a as __generator, b as __spreadArray, c as __read } from "./Combination-DK1PD8Kn.js";
|
|
4
|
+
function _mergeNamespaces(n2, m2) {
|
|
5
|
+
for (var i = 0; i < m2.length; i++) {
|
|
6
|
+
const e2 = m2[i];
|
|
7
|
+
if (typeof e2 !== "string" && !Array.isArray(e2)) {
|
|
8
|
+
for (const k2 in e2) {
|
|
9
|
+
if (k2 !== "default" && !(k2 in n2)) {
|
|
10
|
+
const d2 = Object.getOwnPropertyDescriptor(e2, k2);
|
|
11
|
+
if (d2) {
|
|
12
|
+
Object.defineProperty(n2, k2, d2.get ? d2 : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: () => e2[k2]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return Object.freeze(Object.defineProperty(n2, Symbol.toStringTag, { value: "Module" }));
|
|
22
|
+
}
|
|
23
|
+
var propTypes = { exports: {} };
|
|
24
|
+
var reactIs = { exports: {} };
|
|
25
|
+
var reactIs_production_min$1 = {};
|
|
26
|
+
/** @license React v16.13.1
|
|
27
|
+
* react-is.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/
|
|
34
|
+
var b = "function" === typeof Symbol && Symbol.for, c = b ? Symbol.for("react.element") : 60103, d = b ? Symbol.for("react.portal") : 60106, e = b ? Symbol.for("react.fragment") : 60107, f = b ? Symbol.for("react.strict_mode") : 60108, g = b ? Symbol.for("react.profiler") : 60114, h = b ? Symbol.for("react.provider") : 60109, k = b ? Symbol.for("react.context") : 60110, l = b ? Symbol.for("react.async_mode") : 60111, m = b ? Symbol.for("react.concurrent_mode") : 60111, n = b ? Symbol.for("react.forward_ref") : 60112, p = b ? Symbol.for("react.suspense") : 60113, q = b ? Symbol.for("react.suspense_list") : 60120, r = b ? Symbol.for("react.memo") : 60115, t = b ? Symbol.for("react.lazy") : 60116, v = b ? Symbol.for("react.block") : 60121, w = b ? Symbol.for("react.fundamental") : 60117, x = b ? Symbol.for("react.responder") : 60118, y = b ? Symbol.for("react.scope") : 60119;
|
|
35
|
+
function z(a) {
|
|
36
|
+
if ("object" === typeof a && null !== a) {
|
|
37
|
+
var u = a.$$typeof;
|
|
38
|
+
switch (u) {
|
|
39
|
+
case c:
|
|
40
|
+
switch (a = a.type, a) {
|
|
41
|
+
case l:
|
|
42
|
+
case m:
|
|
43
|
+
case e:
|
|
44
|
+
case g:
|
|
45
|
+
case f:
|
|
46
|
+
case p:
|
|
47
|
+
return a;
|
|
48
|
+
default:
|
|
49
|
+
switch (a = a && a.$$typeof, a) {
|
|
50
|
+
case k:
|
|
51
|
+
case n:
|
|
52
|
+
case t:
|
|
53
|
+
case r:
|
|
54
|
+
case h:
|
|
55
|
+
return a;
|
|
56
|
+
default:
|
|
57
|
+
return u;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
case d:
|
|
61
|
+
return u;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function A(a) {
|
|
66
|
+
return z(a) === m;
|
|
67
|
+
}
|
|
68
|
+
var AsyncMode = reactIs_production_min$1.AsyncMode = l;
|
|
69
|
+
var ConcurrentMode = reactIs_production_min$1.ConcurrentMode = m;
|
|
70
|
+
var ContextConsumer = reactIs_production_min$1.ContextConsumer = k;
|
|
71
|
+
var ContextProvider = reactIs_production_min$1.ContextProvider = h;
|
|
72
|
+
var Element = reactIs_production_min$1.Element = c;
|
|
73
|
+
var ForwardRef = reactIs_production_min$1.ForwardRef = n;
|
|
74
|
+
var Fragment = reactIs_production_min$1.Fragment = e;
|
|
75
|
+
var Lazy = reactIs_production_min$1.Lazy = t;
|
|
76
|
+
var Memo = reactIs_production_min$1.Memo = r;
|
|
77
|
+
var Portal = reactIs_production_min$1.Portal = d;
|
|
78
|
+
var Profiler = reactIs_production_min$1.Profiler = g;
|
|
79
|
+
var StrictMode = reactIs_production_min$1.StrictMode = f;
|
|
80
|
+
var Suspense = reactIs_production_min$1.Suspense = p;
|
|
81
|
+
var isAsyncMode = reactIs_production_min$1.isAsyncMode = function(a) {
|
|
82
|
+
return A(a) || z(a) === l;
|
|
83
|
+
};
|
|
84
|
+
var isConcurrentMode = reactIs_production_min$1.isConcurrentMode = A;
|
|
85
|
+
var isContextConsumer = reactIs_production_min$1.isContextConsumer = function(a) {
|
|
86
|
+
return z(a) === k;
|
|
87
|
+
};
|
|
88
|
+
var isContextProvider = reactIs_production_min$1.isContextProvider = function(a) {
|
|
89
|
+
return z(a) === h;
|
|
90
|
+
};
|
|
91
|
+
var isElement = reactIs_production_min$1.isElement = function(a) {
|
|
92
|
+
return "object" === typeof a && null !== a && a.$$typeof === c;
|
|
93
|
+
};
|
|
94
|
+
var isForwardRef = reactIs_production_min$1.isForwardRef = function(a) {
|
|
95
|
+
return z(a) === n;
|
|
96
|
+
};
|
|
97
|
+
var isFragment = reactIs_production_min$1.isFragment = function(a) {
|
|
98
|
+
return z(a) === e;
|
|
99
|
+
};
|
|
100
|
+
var isLazy = reactIs_production_min$1.isLazy = function(a) {
|
|
101
|
+
return z(a) === t;
|
|
102
|
+
};
|
|
103
|
+
var isMemo = reactIs_production_min$1.isMemo = function(a) {
|
|
104
|
+
return z(a) === r;
|
|
105
|
+
};
|
|
106
|
+
var isPortal = reactIs_production_min$1.isPortal = function(a) {
|
|
107
|
+
return z(a) === d;
|
|
108
|
+
};
|
|
109
|
+
var isProfiler = reactIs_production_min$1.isProfiler = function(a) {
|
|
110
|
+
return z(a) === g;
|
|
111
|
+
};
|
|
112
|
+
var isStrictMode = reactIs_production_min$1.isStrictMode = function(a) {
|
|
113
|
+
return z(a) === f;
|
|
114
|
+
};
|
|
115
|
+
var isSuspense = reactIs_production_min$1.isSuspense = function(a) {
|
|
116
|
+
return z(a) === p;
|
|
117
|
+
};
|
|
118
|
+
var isValidElementType = reactIs_production_min$1.isValidElementType = function(a) {
|
|
119
|
+
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
120
|
+
};
|
|
121
|
+
var typeOf = reactIs_production_min$1.typeOf = z;
|
|
122
|
+
const reactIs_production_min = /* @__PURE__ */ _mergeNamespaces({
|
|
123
|
+
__proto__: null,
|
|
124
|
+
AsyncMode,
|
|
125
|
+
ConcurrentMode,
|
|
126
|
+
ContextConsumer,
|
|
127
|
+
ContextProvider,
|
|
128
|
+
Element,
|
|
129
|
+
ForwardRef,
|
|
130
|
+
Fragment,
|
|
131
|
+
Lazy,
|
|
132
|
+
Memo,
|
|
133
|
+
Portal,
|
|
134
|
+
Profiler,
|
|
135
|
+
StrictMode,
|
|
136
|
+
Suspense,
|
|
137
|
+
default: reactIs_production_min$1,
|
|
138
|
+
isAsyncMode,
|
|
139
|
+
isConcurrentMode,
|
|
140
|
+
isContextConsumer,
|
|
141
|
+
isContextProvider,
|
|
142
|
+
isElement,
|
|
143
|
+
isForwardRef,
|
|
144
|
+
isFragment,
|
|
145
|
+
isLazy,
|
|
146
|
+
isMemo,
|
|
147
|
+
isPortal,
|
|
148
|
+
isProfiler,
|
|
149
|
+
isStrictMode,
|
|
150
|
+
isSuspense,
|
|
151
|
+
isValidElementType,
|
|
152
|
+
typeOf
|
|
153
|
+
}, [reactIs_production_min$1]);
|
|
154
|
+
const require$$0$1 = /* @__PURE__ */ getAugmentedNamespace(reactIs_production_min);
|
|
155
|
+
var reactIs_development$1 = {};
|
|
156
|
+
/** @license React v16.13.1
|
|
157
|
+
* react-is.development.js
|
|
158
|
+
*
|
|
159
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
160
|
+
*
|
|
161
|
+
* This source code is licensed under the MIT license found in the
|
|
162
|
+
* LICENSE file in the root directory of this source tree.
|
|
163
|
+
*/
|
|
164
|
+
var typeOf_1;
|
|
165
|
+
var isValidElementType_1;
|
|
166
|
+
var isSuspense_1;
|
|
167
|
+
var isStrictMode_1;
|
|
168
|
+
var isProfiler_1;
|
|
169
|
+
var isPortal_1;
|
|
170
|
+
var isMemo_1;
|
|
171
|
+
var isLazy_1;
|
|
172
|
+
var isFragment_1;
|
|
173
|
+
var isForwardRef_1;
|
|
174
|
+
var isElement_1;
|
|
175
|
+
var isContextProvider_1;
|
|
176
|
+
var isContextConsumer_1;
|
|
177
|
+
var isConcurrentMode_1;
|
|
178
|
+
var isAsyncMode_1;
|
|
179
|
+
var Suspense_1;
|
|
180
|
+
var StrictMode_1;
|
|
181
|
+
var Profiler_1;
|
|
182
|
+
var Portal_1;
|
|
183
|
+
var Memo_1;
|
|
184
|
+
var Lazy_1;
|
|
185
|
+
var Fragment_1;
|
|
186
|
+
var ForwardRef_1;
|
|
187
|
+
var Element_1;
|
|
188
|
+
var ContextProvider_1;
|
|
189
|
+
var ContextConsumer_1;
|
|
190
|
+
var ConcurrentMode_1;
|
|
191
|
+
var AsyncMode_1;
|
|
192
|
+
if (process.env.NODE_ENV !== "production") {
|
|
193
|
+
(function() {
|
|
194
|
+
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
195
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
|
|
196
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
|
|
197
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
|
|
198
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
|
|
199
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
|
|
200
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
|
|
201
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
|
|
202
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
|
|
203
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
|
|
204
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
|
|
205
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
|
|
206
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
|
|
207
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
|
|
208
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
|
|
209
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
|
|
210
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
|
|
211
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
|
|
212
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
|
|
213
|
+
function isValidElementType2(type) {
|
|
214
|
+
return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
215
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
216
|
+
}
|
|
217
|
+
function typeOf2(object) {
|
|
218
|
+
if (typeof object === "object" && object !== null) {
|
|
219
|
+
var $$typeof = object.$$typeof;
|
|
220
|
+
switch ($$typeof) {
|
|
221
|
+
case REACT_ELEMENT_TYPE:
|
|
222
|
+
var type = object.type;
|
|
223
|
+
switch (type) {
|
|
224
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
225
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
226
|
+
case REACT_FRAGMENT_TYPE:
|
|
227
|
+
case REACT_PROFILER_TYPE:
|
|
228
|
+
case REACT_STRICT_MODE_TYPE:
|
|
229
|
+
case REACT_SUSPENSE_TYPE:
|
|
230
|
+
return type;
|
|
231
|
+
default:
|
|
232
|
+
var $$typeofType = type && type.$$typeof;
|
|
233
|
+
switch ($$typeofType) {
|
|
234
|
+
case REACT_CONTEXT_TYPE:
|
|
235
|
+
case REACT_FORWARD_REF_TYPE:
|
|
236
|
+
case REACT_LAZY_TYPE:
|
|
237
|
+
case REACT_MEMO_TYPE:
|
|
238
|
+
case REACT_PROVIDER_TYPE:
|
|
239
|
+
return $$typeofType;
|
|
240
|
+
default:
|
|
241
|
+
return $$typeof;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
case REACT_PORTAL_TYPE:
|
|
245
|
+
return $$typeof;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return void 0;
|
|
249
|
+
}
|
|
250
|
+
var AsyncMode2 = REACT_ASYNC_MODE_TYPE;
|
|
251
|
+
var ConcurrentMode2 = REACT_CONCURRENT_MODE_TYPE;
|
|
252
|
+
var ContextConsumer2 = REACT_CONTEXT_TYPE;
|
|
253
|
+
var ContextProvider2 = REACT_PROVIDER_TYPE;
|
|
254
|
+
var Element2 = REACT_ELEMENT_TYPE;
|
|
255
|
+
var ForwardRef2 = REACT_FORWARD_REF_TYPE;
|
|
256
|
+
var Fragment2 = REACT_FRAGMENT_TYPE;
|
|
257
|
+
var Lazy2 = REACT_LAZY_TYPE;
|
|
258
|
+
var Memo2 = REACT_MEMO_TYPE;
|
|
259
|
+
var Portal2 = REACT_PORTAL_TYPE;
|
|
260
|
+
var Profiler2 = REACT_PROFILER_TYPE;
|
|
261
|
+
var StrictMode2 = REACT_STRICT_MODE_TYPE;
|
|
262
|
+
var Suspense2 = REACT_SUSPENSE_TYPE;
|
|
263
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
264
|
+
function isAsyncMode2(object) {
|
|
265
|
+
{
|
|
266
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
267
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
268
|
+
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return isConcurrentMode2(object) || typeOf2(object) === REACT_ASYNC_MODE_TYPE;
|
|
272
|
+
}
|
|
273
|
+
function isConcurrentMode2(object) {
|
|
274
|
+
return typeOf2(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
275
|
+
}
|
|
276
|
+
function isContextConsumer2(object) {
|
|
277
|
+
return typeOf2(object) === REACT_CONTEXT_TYPE;
|
|
278
|
+
}
|
|
279
|
+
function isContextProvider2(object) {
|
|
280
|
+
return typeOf2(object) === REACT_PROVIDER_TYPE;
|
|
281
|
+
}
|
|
282
|
+
function isElement2(object) {
|
|
283
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
284
|
+
}
|
|
285
|
+
function isForwardRef2(object) {
|
|
286
|
+
return typeOf2(object) === REACT_FORWARD_REF_TYPE;
|
|
287
|
+
}
|
|
288
|
+
function isFragment2(object) {
|
|
289
|
+
return typeOf2(object) === REACT_FRAGMENT_TYPE;
|
|
290
|
+
}
|
|
291
|
+
function isLazy2(object) {
|
|
292
|
+
return typeOf2(object) === REACT_LAZY_TYPE;
|
|
293
|
+
}
|
|
294
|
+
function isMemo2(object) {
|
|
295
|
+
return typeOf2(object) === REACT_MEMO_TYPE;
|
|
296
|
+
}
|
|
297
|
+
function isPortal2(object) {
|
|
298
|
+
return typeOf2(object) === REACT_PORTAL_TYPE;
|
|
299
|
+
}
|
|
300
|
+
function isProfiler2(object) {
|
|
301
|
+
return typeOf2(object) === REACT_PROFILER_TYPE;
|
|
302
|
+
}
|
|
303
|
+
function isStrictMode2(object) {
|
|
304
|
+
return typeOf2(object) === REACT_STRICT_MODE_TYPE;
|
|
305
|
+
}
|
|
306
|
+
function isSuspense2(object) {
|
|
307
|
+
return typeOf2(object) === REACT_SUSPENSE_TYPE;
|
|
308
|
+
}
|
|
309
|
+
AsyncMode_1 = reactIs_development$1.AsyncMode = AsyncMode2;
|
|
310
|
+
ConcurrentMode_1 = reactIs_development$1.ConcurrentMode = ConcurrentMode2;
|
|
311
|
+
ContextConsumer_1 = reactIs_development$1.ContextConsumer = ContextConsumer2;
|
|
312
|
+
ContextProvider_1 = reactIs_development$1.ContextProvider = ContextProvider2;
|
|
313
|
+
Element_1 = reactIs_development$1.Element = Element2;
|
|
314
|
+
ForwardRef_1 = reactIs_development$1.ForwardRef = ForwardRef2;
|
|
315
|
+
Fragment_1 = reactIs_development$1.Fragment = Fragment2;
|
|
316
|
+
Lazy_1 = reactIs_development$1.Lazy = Lazy2;
|
|
317
|
+
Memo_1 = reactIs_development$1.Memo = Memo2;
|
|
318
|
+
Portal_1 = reactIs_development$1.Portal = Portal2;
|
|
319
|
+
Profiler_1 = reactIs_development$1.Profiler = Profiler2;
|
|
320
|
+
StrictMode_1 = reactIs_development$1.StrictMode = StrictMode2;
|
|
321
|
+
Suspense_1 = reactIs_development$1.Suspense = Suspense2;
|
|
322
|
+
isAsyncMode_1 = reactIs_development$1.isAsyncMode = isAsyncMode2;
|
|
323
|
+
isConcurrentMode_1 = reactIs_development$1.isConcurrentMode = isConcurrentMode2;
|
|
324
|
+
isContextConsumer_1 = reactIs_development$1.isContextConsumer = isContextConsumer2;
|
|
325
|
+
isContextProvider_1 = reactIs_development$1.isContextProvider = isContextProvider2;
|
|
326
|
+
isElement_1 = reactIs_development$1.isElement = isElement2;
|
|
327
|
+
isForwardRef_1 = reactIs_development$1.isForwardRef = isForwardRef2;
|
|
328
|
+
isFragment_1 = reactIs_development$1.isFragment = isFragment2;
|
|
329
|
+
isLazy_1 = reactIs_development$1.isLazy = isLazy2;
|
|
330
|
+
isMemo_1 = reactIs_development$1.isMemo = isMemo2;
|
|
331
|
+
isPortal_1 = reactIs_development$1.isPortal = isPortal2;
|
|
332
|
+
isProfiler_1 = reactIs_development$1.isProfiler = isProfiler2;
|
|
333
|
+
isStrictMode_1 = reactIs_development$1.isStrictMode = isStrictMode2;
|
|
334
|
+
isSuspense_1 = reactIs_development$1.isSuspense = isSuspense2;
|
|
335
|
+
isValidElementType_1 = reactIs_development$1.isValidElementType = isValidElementType2;
|
|
336
|
+
typeOf_1 = reactIs_development$1.typeOf = typeOf2;
|
|
337
|
+
})();
|
|
338
|
+
}
|
|
339
|
+
const reactIs_development = /* @__PURE__ */ _mergeNamespaces({
|
|
340
|
+
__proto__: null,
|
|
341
|
+
get AsyncMode() {
|
|
342
|
+
return AsyncMode_1;
|
|
343
|
+
},
|
|
344
|
+
get ConcurrentMode() {
|
|
345
|
+
return ConcurrentMode_1;
|
|
346
|
+
},
|
|
347
|
+
get ContextConsumer() {
|
|
348
|
+
return ContextConsumer_1;
|
|
349
|
+
},
|
|
350
|
+
get ContextProvider() {
|
|
351
|
+
return ContextProvider_1;
|
|
352
|
+
},
|
|
353
|
+
get Element() {
|
|
354
|
+
return Element_1;
|
|
355
|
+
},
|
|
356
|
+
get ForwardRef() {
|
|
357
|
+
return ForwardRef_1;
|
|
358
|
+
},
|
|
359
|
+
get Fragment() {
|
|
360
|
+
return Fragment_1;
|
|
361
|
+
},
|
|
362
|
+
get Lazy() {
|
|
363
|
+
return Lazy_1;
|
|
364
|
+
},
|
|
365
|
+
get Memo() {
|
|
366
|
+
return Memo_1;
|
|
367
|
+
},
|
|
368
|
+
get Portal() {
|
|
369
|
+
return Portal_1;
|
|
370
|
+
},
|
|
371
|
+
get Profiler() {
|
|
372
|
+
return Profiler_1;
|
|
373
|
+
},
|
|
374
|
+
get StrictMode() {
|
|
375
|
+
return StrictMode_1;
|
|
376
|
+
},
|
|
377
|
+
get Suspense() {
|
|
378
|
+
return Suspense_1;
|
|
379
|
+
},
|
|
380
|
+
default: reactIs_development$1,
|
|
381
|
+
get isAsyncMode() {
|
|
382
|
+
return isAsyncMode_1;
|
|
383
|
+
},
|
|
384
|
+
get isConcurrentMode() {
|
|
385
|
+
return isConcurrentMode_1;
|
|
386
|
+
},
|
|
387
|
+
get isContextConsumer() {
|
|
388
|
+
return isContextConsumer_1;
|
|
389
|
+
},
|
|
390
|
+
get isContextProvider() {
|
|
391
|
+
return isContextProvider_1;
|
|
392
|
+
},
|
|
393
|
+
get isElement() {
|
|
394
|
+
return isElement_1;
|
|
395
|
+
},
|
|
396
|
+
get isForwardRef() {
|
|
397
|
+
return isForwardRef_1;
|
|
398
|
+
},
|
|
399
|
+
get isFragment() {
|
|
400
|
+
return isFragment_1;
|
|
401
|
+
},
|
|
402
|
+
get isLazy() {
|
|
403
|
+
return isLazy_1;
|
|
404
|
+
},
|
|
405
|
+
get isMemo() {
|
|
406
|
+
return isMemo_1;
|
|
407
|
+
},
|
|
408
|
+
get isPortal() {
|
|
409
|
+
return isPortal_1;
|
|
410
|
+
},
|
|
411
|
+
get isProfiler() {
|
|
412
|
+
return isProfiler_1;
|
|
413
|
+
},
|
|
414
|
+
get isStrictMode() {
|
|
415
|
+
return isStrictMode_1;
|
|
416
|
+
},
|
|
417
|
+
get isSuspense() {
|
|
418
|
+
return isSuspense_1;
|
|
419
|
+
},
|
|
420
|
+
get isValidElementType() {
|
|
421
|
+
return isValidElementType_1;
|
|
422
|
+
},
|
|
423
|
+
get typeOf() {
|
|
424
|
+
return typeOf_1;
|
|
425
|
+
}
|
|
426
|
+
}, [reactIs_development$1]);
|
|
427
|
+
const require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(reactIs_development);
|
|
428
|
+
if (process.env.NODE_ENV === "production") {
|
|
429
|
+
reactIs.exports = require$$0$1;
|
|
430
|
+
} else {
|
|
431
|
+
reactIs.exports = require$$1$1;
|
|
432
|
+
}
|
|
433
|
+
var reactIsExports = reactIs.exports;
|
|
434
|
+
/*
|
|
435
|
+
object-assign
|
|
436
|
+
(c) Sindre Sorhus
|
|
437
|
+
@license MIT
|
|
438
|
+
*/
|
|
439
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
440
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
441
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
442
|
+
function toObject(val) {
|
|
443
|
+
if (val === null || val === void 0) {
|
|
444
|
+
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
445
|
+
}
|
|
446
|
+
return Object(val);
|
|
447
|
+
}
|
|
448
|
+
function shouldUseNative() {
|
|
449
|
+
try {
|
|
450
|
+
if (!Object.assign) {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
var test1 = new String("abc");
|
|
454
|
+
test1[5] = "de";
|
|
455
|
+
if (Object.getOwnPropertyNames(test1)[0] === "5") {
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
var test2 = {};
|
|
459
|
+
for (var i = 0; i < 10; i++) {
|
|
460
|
+
test2["_" + String.fromCharCode(i)] = i;
|
|
461
|
+
}
|
|
462
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function(n2) {
|
|
463
|
+
return test2[n2];
|
|
464
|
+
});
|
|
465
|
+
if (order2.join("") !== "0123456789") {
|
|
466
|
+
return false;
|
|
467
|
+
}
|
|
468
|
+
var test3 = {};
|
|
469
|
+
"abcdefghijklmnopqrst".split("").forEach(function(letter) {
|
|
470
|
+
test3[letter] = letter;
|
|
471
|
+
});
|
|
472
|
+
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
return true;
|
|
476
|
+
} catch (err) {
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
var objectAssign = shouldUseNative() ? Object.assign : function(target, source) {
|
|
481
|
+
var from;
|
|
482
|
+
var to = toObject(target);
|
|
483
|
+
var symbols;
|
|
484
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
485
|
+
from = Object(arguments[s]);
|
|
486
|
+
for (var key in from) {
|
|
487
|
+
if (hasOwnProperty.call(from, key)) {
|
|
488
|
+
to[key] = from[key];
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (getOwnPropertySymbols) {
|
|
492
|
+
symbols = getOwnPropertySymbols(from);
|
|
493
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
494
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
495
|
+
to[symbols[i]] = from[symbols[i]];
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return to;
|
|
501
|
+
};
|
|
502
|
+
const index = /* @__PURE__ */ getDefaultExportFromCjs(objectAssign);
|
|
503
|
+
const objectAssign$1 = /* @__PURE__ */ _mergeNamespaces({
|
|
504
|
+
__proto__: null,
|
|
505
|
+
default: index
|
|
506
|
+
}, [objectAssign]);
|
|
507
|
+
const require$$1 = /* @__PURE__ */ getAugmentedNamespace(objectAssign$1);
|
|
508
|
+
var ReactPropTypesSecret$2 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
509
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$2;
|
|
510
|
+
const ReactPropTypesSecret$3 = /* @__PURE__ */ getDefaultExportFromCjs(ReactPropTypesSecret_1);
|
|
511
|
+
const ReactPropTypesSecret$4 = /* @__PURE__ */ _mergeNamespaces({
|
|
512
|
+
__proto__: null,
|
|
513
|
+
default: ReactPropTypesSecret$3
|
|
514
|
+
}, [ReactPropTypesSecret_1]);
|
|
515
|
+
const require$$0 = /* @__PURE__ */ getAugmentedNamespace(ReactPropTypesSecret$4);
|
|
516
|
+
var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
517
|
+
const has$3 = /* @__PURE__ */ getDefaultExportFromCjs(has$2);
|
|
518
|
+
const has$4 = /* @__PURE__ */ _mergeNamespaces({
|
|
519
|
+
__proto__: null,
|
|
520
|
+
default: has$3
|
|
521
|
+
}, [has$2]);
|
|
522
|
+
const require$$3 = /* @__PURE__ */ getAugmentedNamespace(has$4);
|
|
523
|
+
var printWarning$1 = function() {
|
|
524
|
+
};
|
|
525
|
+
if (process.env.NODE_ENV !== "production") {
|
|
526
|
+
var ReactPropTypesSecret$1 = require$$0;
|
|
527
|
+
var loggedTypeFailures = {};
|
|
528
|
+
var has$1 = require$$3;
|
|
529
|
+
printWarning$1 = function(text) {
|
|
530
|
+
var message = "Warning: " + text;
|
|
531
|
+
if (typeof console !== "undefined") {
|
|
532
|
+
console.error(message);
|
|
533
|
+
}
|
|
534
|
+
try {
|
|
535
|
+
throw new Error(message);
|
|
536
|
+
} catch (x2) {
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
|
|
541
|
+
if (process.env.NODE_ENV !== "production") {
|
|
542
|
+
for (var typeSpecName in typeSpecs) {
|
|
543
|
+
if (has$1(typeSpecs, typeSpecName)) {
|
|
544
|
+
var error;
|
|
545
|
+
try {
|
|
546
|
+
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
547
|
+
var err = Error(
|
|
548
|
+
(componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
|
|
549
|
+
);
|
|
550
|
+
err.name = "Invariant Violation";
|
|
551
|
+
throw err;
|
|
552
|
+
}
|
|
553
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
|
554
|
+
} catch (ex) {
|
|
555
|
+
error = ex;
|
|
556
|
+
}
|
|
557
|
+
if (error && !(error instanceof Error)) {
|
|
558
|
+
printWarning$1(
|
|
559
|
+
(componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
563
|
+
loggedTypeFailures[error.message] = true;
|
|
564
|
+
var stack = getStack ? getStack() : "";
|
|
565
|
+
printWarning$1(
|
|
566
|
+
"Failed " + location + " type: " + error.message + (stack != null ? stack : "")
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
checkPropTypes$1.resetWarningCache = function() {
|
|
574
|
+
if (process.env.NODE_ENV !== "production") {
|
|
575
|
+
loggedTypeFailures = {};
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
var checkPropTypes_1 = checkPropTypes$1;
|
|
579
|
+
const checkPropTypes$2 = /* @__PURE__ */ getDefaultExportFromCjs(checkPropTypes_1);
|
|
580
|
+
const checkPropTypes$3 = /* @__PURE__ */ _mergeNamespaces({
|
|
581
|
+
__proto__: null,
|
|
582
|
+
default: checkPropTypes$2
|
|
583
|
+
}, [checkPropTypes_1]);
|
|
584
|
+
const require$$4 = /* @__PURE__ */ getAugmentedNamespace(checkPropTypes$3);
|
|
585
|
+
var ReactIs$1 = reactIsExports;
|
|
586
|
+
var assign = require$$1;
|
|
587
|
+
var ReactPropTypesSecret = require$$0;
|
|
588
|
+
var has = require$$3;
|
|
589
|
+
var checkPropTypes = require$$4;
|
|
590
|
+
var printWarning = function() {
|
|
591
|
+
};
|
|
592
|
+
if (process.env.NODE_ENV !== "production") {
|
|
593
|
+
printWarning = function(text) {
|
|
594
|
+
var message = "Warning: " + text;
|
|
595
|
+
if (typeof console !== "undefined") {
|
|
596
|
+
console.error(message);
|
|
597
|
+
}
|
|
598
|
+
try {
|
|
599
|
+
throw new Error(message);
|
|
600
|
+
} catch (x2) {
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
function emptyFunctionThatReturnsNull() {
|
|
605
|
+
return null;
|
|
606
|
+
}
|
|
607
|
+
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
608
|
+
var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
|
|
609
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
610
|
+
function getIteratorFn(maybeIterable) {
|
|
611
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
612
|
+
if (typeof iteratorFn === "function") {
|
|
613
|
+
return iteratorFn;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
var ANONYMOUS = "<<anonymous>>";
|
|
617
|
+
var ReactPropTypes = {
|
|
618
|
+
array: createPrimitiveTypeChecker("array"),
|
|
619
|
+
bigint: createPrimitiveTypeChecker("bigint"),
|
|
620
|
+
bool: createPrimitiveTypeChecker("boolean"),
|
|
621
|
+
func: createPrimitiveTypeChecker("function"),
|
|
622
|
+
number: createPrimitiveTypeChecker("number"),
|
|
623
|
+
object: createPrimitiveTypeChecker("object"),
|
|
624
|
+
string: createPrimitiveTypeChecker("string"),
|
|
625
|
+
symbol: createPrimitiveTypeChecker("symbol"),
|
|
626
|
+
any: createAnyTypeChecker(),
|
|
627
|
+
arrayOf: createArrayOfTypeChecker,
|
|
628
|
+
element: createElementTypeChecker(),
|
|
629
|
+
elementType: createElementTypeTypeChecker(),
|
|
630
|
+
instanceOf: createInstanceTypeChecker,
|
|
631
|
+
node: createNodeChecker(),
|
|
632
|
+
objectOf: createObjectOfTypeChecker,
|
|
633
|
+
oneOf: createEnumTypeChecker,
|
|
634
|
+
oneOfType: createUnionTypeChecker,
|
|
635
|
+
shape: createShapeTypeChecker,
|
|
636
|
+
exact: createStrictShapeTypeChecker
|
|
637
|
+
};
|
|
638
|
+
function is(x2, y2) {
|
|
639
|
+
if (x2 === y2) {
|
|
640
|
+
return x2 !== 0 || 1 / x2 === 1 / y2;
|
|
641
|
+
} else {
|
|
642
|
+
return x2 !== x2 && y2 !== y2;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
function PropTypeError(message, data) {
|
|
646
|
+
this.message = message;
|
|
647
|
+
this.data = data && typeof data === "object" ? data : {};
|
|
648
|
+
this.stack = "";
|
|
649
|
+
}
|
|
650
|
+
PropTypeError.prototype = Error.prototype;
|
|
651
|
+
function createChainableTypeChecker(validate) {
|
|
652
|
+
if (process.env.NODE_ENV !== "production") {
|
|
653
|
+
var manualPropTypeCallCache = {};
|
|
654
|
+
var manualPropTypeWarningCount = 0;
|
|
655
|
+
}
|
|
656
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
657
|
+
componentName = componentName || ANONYMOUS;
|
|
658
|
+
propFullName = propFullName || propName;
|
|
659
|
+
if (secret !== ReactPropTypesSecret) {
|
|
660
|
+
if (throwOnDirectAccess) {
|
|
661
|
+
var err = new Error(
|
|
662
|
+
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
|
|
663
|
+
);
|
|
664
|
+
err.name = "Invariant Violation";
|
|
665
|
+
throw err;
|
|
666
|
+
} else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
|
|
667
|
+
var cacheKey = componentName + ":" + propName;
|
|
668
|
+
if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
|
|
669
|
+
manualPropTypeWarningCount < 3) {
|
|
670
|
+
printWarning(
|
|
671
|
+
"You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
|
|
672
|
+
);
|
|
673
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
674
|
+
manualPropTypeWarningCount++;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
if (props[propName] == null) {
|
|
679
|
+
if (isRequired) {
|
|
680
|
+
if (props[propName] === null) {
|
|
681
|
+
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
|
|
682
|
+
}
|
|
683
|
+
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
|
|
684
|
+
}
|
|
685
|
+
return null;
|
|
686
|
+
} else {
|
|
687
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
691
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
692
|
+
return chainedCheckType;
|
|
693
|
+
}
|
|
694
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
695
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
696
|
+
var propValue = props[propName];
|
|
697
|
+
var propType = getPropType(propValue);
|
|
698
|
+
if (propType !== expectedType) {
|
|
699
|
+
var preciseType = getPreciseType(propValue);
|
|
700
|
+
return new PropTypeError(
|
|
701
|
+
"Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
|
|
702
|
+
{ expectedType }
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
return null;
|
|
706
|
+
}
|
|
707
|
+
return createChainableTypeChecker(validate);
|
|
708
|
+
}
|
|
709
|
+
function createAnyTypeChecker() {
|
|
710
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
711
|
+
}
|
|
712
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
713
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
714
|
+
if (typeof typeChecker !== "function") {
|
|
715
|
+
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
|
|
716
|
+
}
|
|
717
|
+
var propValue = props[propName];
|
|
718
|
+
if (!Array.isArray(propValue)) {
|
|
719
|
+
var propType = getPropType(propValue);
|
|
720
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
|
|
721
|
+
}
|
|
722
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
723
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
|
|
724
|
+
if (error instanceof Error) {
|
|
725
|
+
return error;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
return null;
|
|
729
|
+
}
|
|
730
|
+
return createChainableTypeChecker(validate);
|
|
731
|
+
}
|
|
732
|
+
function createElementTypeChecker() {
|
|
733
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
734
|
+
var propValue = props[propName];
|
|
735
|
+
if (!isValidElement(propValue)) {
|
|
736
|
+
var propType = getPropType(propValue);
|
|
737
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
|
|
738
|
+
}
|
|
739
|
+
return null;
|
|
740
|
+
}
|
|
741
|
+
return createChainableTypeChecker(validate);
|
|
742
|
+
}
|
|
743
|
+
function createElementTypeTypeChecker() {
|
|
744
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
745
|
+
var propValue = props[propName];
|
|
746
|
+
if (!ReactIs$1.isValidElementType(propValue)) {
|
|
747
|
+
var propType = getPropType(propValue);
|
|
748
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
|
|
749
|
+
}
|
|
750
|
+
return null;
|
|
751
|
+
}
|
|
752
|
+
return createChainableTypeChecker(validate);
|
|
753
|
+
}
|
|
754
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
755
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
756
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
757
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
758
|
+
var actualClassName = getClassName(props[propName]);
|
|
759
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
|
|
760
|
+
}
|
|
761
|
+
return null;
|
|
762
|
+
}
|
|
763
|
+
return createChainableTypeChecker(validate);
|
|
764
|
+
}
|
|
765
|
+
function createEnumTypeChecker(expectedValues) {
|
|
766
|
+
if (!Array.isArray(expectedValues)) {
|
|
767
|
+
if (process.env.NODE_ENV !== "production") {
|
|
768
|
+
if (arguments.length > 1) {
|
|
769
|
+
printWarning(
|
|
770
|
+
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
|
|
771
|
+
);
|
|
772
|
+
} else {
|
|
773
|
+
printWarning("Invalid argument supplied to oneOf, expected an array.");
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
return emptyFunctionThatReturnsNull;
|
|
777
|
+
}
|
|
778
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
779
|
+
var propValue = props[propName];
|
|
780
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
781
|
+
if (is(propValue, expectedValues[i])) {
|
|
782
|
+
return null;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
786
|
+
var type = getPreciseType(value);
|
|
787
|
+
if (type === "symbol") {
|
|
788
|
+
return String(value);
|
|
789
|
+
}
|
|
790
|
+
return value;
|
|
791
|
+
});
|
|
792
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
|
|
793
|
+
}
|
|
794
|
+
return createChainableTypeChecker(validate);
|
|
795
|
+
}
|
|
796
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
797
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
798
|
+
if (typeof typeChecker !== "function") {
|
|
799
|
+
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
|
|
800
|
+
}
|
|
801
|
+
var propValue = props[propName];
|
|
802
|
+
var propType = getPropType(propValue);
|
|
803
|
+
if (propType !== "object") {
|
|
804
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
|
|
805
|
+
}
|
|
806
|
+
for (var key in propValue) {
|
|
807
|
+
if (has(propValue, key)) {
|
|
808
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
809
|
+
if (error instanceof Error) {
|
|
810
|
+
return error;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
return null;
|
|
815
|
+
}
|
|
816
|
+
return createChainableTypeChecker(validate);
|
|
817
|
+
}
|
|
818
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
819
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
820
|
+
process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
|
|
821
|
+
return emptyFunctionThatReturnsNull;
|
|
822
|
+
}
|
|
823
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
824
|
+
var checker = arrayOfTypeCheckers[i];
|
|
825
|
+
if (typeof checker !== "function") {
|
|
826
|
+
printWarning(
|
|
827
|
+
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."
|
|
828
|
+
);
|
|
829
|
+
return emptyFunctionThatReturnsNull;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
833
|
+
var expectedTypes = [];
|
|
834
|
+
for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
|
|
835
|
+
var checker2 = arrayOfTypeCheckers[i2];
|
|
836
|
+
var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
837
|
+
if (checkerResult == null) {
|
|
838
|
+
return null;
|
|
839
|
+
}
|
|
840
|
+
if (checkerResult.data && has(checkerResult.data, "expectedType")) {
|
|
841
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
|
|
845
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
|
|
846
|
+
}
|
|
847
|
+
return createChainableTypeChecker(validate);
|
|
848
|
+
}
|
|
849
|
+
function createNodeChecker() {
|
|
850
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
851
|
+
if (!isNode(props[propName])) {
|
|
852
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
|
|
853
|
+
}
|
|
854
|
+
return null;
|
|
855
|
+
}
|
|
856
|
+
return createChainableTypeChecker(validate);
|
|
857
|
+
}
|
|
858
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
859
|
+
return new PropTypeError(
|
|
860
|
+
(componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
864
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
865
|
+
var propValue = props[propName];
|
|
866
|
+
var propType = getPropType(propValue);
|
|
867
|
+
if (propType !== "object") {
|
|
868
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
869
|
+
}
|
|
870
|
+
for (var key in shapeTypes) {
|
|
871
|
+
var checker = shapeTypes[key];
|
|
872
|
+
if (typeof checker !== "function") {
|
|
873
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
874
|
+
}
|
|
875
|
+
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
876
|
+
if (error) {
|
|
877
|
+
return error;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
return null;
|
|
881
|
+
}
|
|
882
|
+
return createChainableTypeChecker(validate);
|
|
883
|
+
}
|
|
884
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
885
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
886
|
+
var propValue = props[propName];
|
|
887
|
+
var propType = getPropType(propValue);
|
|
888
|
+
if (propType !== "object") {
|
|
889
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
890
|
+
}
|
|
891
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
|
892
|
+
for (var key in allKeys) {
|
|
893
|
+
var checker = shapeTypes[key];
|
|
894
|
+
if (has(shapeTypes, key) && typeof checker !== "function") {
|
|
895
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
896
|
+
}
|
|
897
|
+
if (!checker) {
|
|
898
|
+
return new PropTypeError(
|
|
899
|
+
"Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
|
|
900
|
+
);
|
|
901
|
+
}
|
|
902
|
+
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
903
|
+
if (error) {
|
|
904
|
+
return error;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
return null;
|
|
908
|
+
}
|
|
909
|
+
return createChainableTypeChecker(validate);
|
|
910
|
+
}
|
|
911
|
+
function isNode(propValue) {
|
|
912
|
+
switch (typeof propValue) {
|
|
913
|
+
case "number":
|
|
914
|
+
case "string":
|
|
915
|
+
case "undefined":
|
|
916
|
+
return true;
|
|
917
|
+
case "boolean":
|
|
918
|
+
return !propValue;
|
|
919
|
+
case "object":
|
|
920
|
+
if (Array.isArray(propValue)) {
|
|
921
|
+
return propValue.every(isNode);
|
|
922
|
+
}
|
|
923
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
924
|
+
return true;
|
|
925
|
+
}
|
|
926
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
927
|
+
if (iteratorFn) {
|
|
928
|
+
var iterator = iteratorFn.call(propValue);
|
|
929
|
+
var step;
|
|
930
|
+
if (iteratorFn !== propValue.entries) {
|
|
931
|
+
while (!(step = iterator.next()).done) {
|
|
932
|
+
if (!isNode(step.value)) {
|
|
933
|
+
return false;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
} else {
|
|
937
|
+
while (!(step = iterator.next()).done) {
|
|
938
|
+
var entry = step.value;
|
|
939
|
+
if (entry) {
|
|
940
|
+
if (!isNode(entry[1])) {
|
|
941
|
+
return false;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
} else {
|
|
947
|
+
return false;
|
|
948
|
+
}
|
|
949
|
+
return true;
|
|
950
|
+
default:
|
|
951
|
+
return false;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
function isSymbol(propType, propValue) {
|
|
955
|
+
if (propType === "symbol") {
|
|
956
|
+
return true;
|
|
957
|
+
}
|
|
958
|
+
if (!propValue) {
|
|
959
|
+
return false;
|
|
960
|
+
}
|
|
961
|
+
if (propValue["@@toStringTag"] === "Symbol") {
|
|
962
|
+
return true;
|
|
963
|
+
}
|
|
964
|
+
if (typeof Symbol === "function" && propValue instanceof Symbol) {
|
|
965
|
+
return true;
|
|
966
|
+
}
|
|
967
|
+
return false;
|
|
968
|
+
}
|
|
969
|
+
function getPropType(propValue) {
|
|
970
|
+
var propType = typeof propValue;
|
|
971
|
+
if (Array.isArray(propValue)) {
|
|
972
|
+
return "array";
|
|
973
|
+
}
|
|
974
|
+
if (propValue instanceof RegExp) {
|
|
975
|
+
return "object";
|
|
976
|
+
}
|
|
977
|
+
if (isSymbol(propType, propValue)) {
|
|
978
|
+
return "symbol";
|
|
979
|
+
}
|
|
980
|
+
return propType;
|
|
981
|
+
}
|
|
982
|
+
function getPreciseType(propValue) {
|
|
983
|
+
if (typeof propValue === "undefined" || propValue === null) {
|
|
984
|
+
return "" + propValue;
|
|
985
|
+
}
|
|
986
|
+
var propType = getPropType(propValue);
|
|
987
|
+
if (propType === "object") {
|
|
988
|
+
if (propValue instanceof Date) {
|
|
989
|
+
return "date";
|
|
990
|
+
} else if (propValue instanceof RegExp) {
|
|
991
|
+
return "regexp";
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
return propType;
|
|
995
|
+
}
|
|
996
|
+
function getPostfixForTypeWarning(value) {
|
|
997
|
+
var type = getPreciseType(value);
|
|
998
|
+
switch (type) {
|
|
999
|
+
case "array":
|
|
1000
|
+
case "object":
|
|
1001
|
+
return "an " + type;
|
|
1002
|
+
case "boolean":
|
|
1003
|
+
case "date":
|
|
1004
|
+
case "regexp":
|
|
1005
|
+
return "a " + type;
|
|
1006
|
+
default:
|
|
1007
|
+
return type;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
function getClassName(propValue) {
|
|
1011
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1012
|
+
return ANONYMOUS;
|
|
1013
|
+
}
|
|
1014
|
+
return propValue.constructor.name;
|
|
1015
|
+
}
|
|
1016
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
1017
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
1018
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1019
|
+
return ReactPropTypes;
|
|
1020
|
+
};
|
|
1021
|
+
var factoryWithThrowingShims;
|
|
1022
|
+
var hasRequiredFactoryWithThrowingShims;
|
|
1023
|
+
function requireFactoryWithThrowingShims() {
|
|
1024
|
+
if (hasRequiredFactoryWithThrowingShims)
|
|
1025
|
+
return factoryWithThrowingShims;
|
|
1026
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
|
1027
|
+
var ReactPropTypesSecret2 = require$$0;
|
|
1028
|
+
function emptyFunction() {
|
|
1029
|
+
}
|
|
1030
|
+
function emptyFunctionWithReset() {
|
|
1031
|
+
}
|
|
1032
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1033
|
+
factoryWithThrowingShims = function() {
|
|
1034
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1035
|
+
if (secret === ReactPropTypesSecret2) {
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
var err = new Error(
|
|
1039
|
+
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
|
|
1040
|
+
);
|
|
1041
|
+
err.name = "Invariant Violation";
|
|
1042
|
+
throw err;
|
|
1043
|
+
}
|
|
1044
|
+
shim.isRequired = shim;
|
|
1045
|
+
function getShim() {
|
|
1046
|
+
return shim;
|
|
1047
|
+
}
|
|
1048
|
+
var ReactPropTypes = {
|
|
1049
|
+
array: shim,
|
|
1050
|
+
bigint: shim,
|
|
1051
|
+
bool: shim,
|
|
1052
|
+
func: shim,
|
|
1053
|
+
number: shim,
|
|
1054
|
+
object: shim,
|
|
1055
|
+
string: shim,
|
|
1056
|
+
symbol: shim,
|
|
1057
|
+
any: shim,
|
|
1058
|
+
arrayOf: getShim,
|
|
1059
|
+
element: shim,
|
|
1060
|
+
elementType: shim,
|
|
1061
|
+
instanceOf: getShim,
|
|
1062
|
+
node: shim,
|
|
1063
|
+
objectOf: getShim,
|
|
1064
|
+
oneOf: getShim,
|
|
1065
|
+
oneOfType: getShim,
|
|
1066
|
+
shape: getShim,
|
|
1067
|
+
exact: getShim,
|
|
1068
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1069
|
+
resetWarningCache: emptyFunction
|
|
1070
|
+
};
|
|
1071
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1072
|
+
return ReactPropTypes;
|
|
1073
|
+
};
|
|
1074
|
+
return factoryWithThrowingShims;
|
|
1075
|
+
}
|
|
1076
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1077
|
+
var ReactIs = reactIsExports;
|
|
1078
|
+
var throwOnDirectAccess = true;
|
|
1079
|
+
propTypes.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
|
1080
|
+
} else {
|
|
1081
|
+
propTypes.exports = requireFactoryWithThrowingShims()();
|
|
1082
|
+
}
|
|
1083
|
+
var propTypesExports = propTypes.exports;
|
|
1084
|
+
const PropTypes = /* @__PURE__ */ getDefaultExportFromCjs(propTypesExports);
|
|
1085
|
+
var COMMON_MIME_TYPES = /* @__PURE__ */ new Map([
|
|
1086
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
|
1087
|
+
["aac", "audio/aac"],
|
|
1088
|
+
["abw", "application/x-abiword"],
|
|
1089
|
+
["arc", "application/x-freearc"],
|
|
1090
|
+
["avif", "image/avif"],
|
|
1091
|
+
["avi", "video/x-msvideo"],
|
|
1092
|
+
["azw", "application/vnd.amazon.ebook"],
|
|
1093
|
+
["bin", "application/octet-stream"],
|
|
1094
|
+
["bmp", "image/bmp"],
|
|
1095
|
+
["bz", "application/x-bzip"],
|
|
1096
|
+
["bz2", "application/x-bzip2"],
|
|
1097
|
+
["cda", "application/x-cdf"],
|
|
1098
|
+
["csh", "application/x-csh"],
|
|
1099
|
+
["css", "text/css"],
|
|
1100
|
+
["csv", "text/csv"],
|
|
1101
|
+
["doc", "application/msword"],
|
|
1102
|
+
["docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
1103
|
+
["eot", "application/vnd.ms-fontobject"],
|
|
1104
|
+
["epub", "application/epub+zip"],
|
|
1105
|
+
["gz", "application/gzip"],
|
|
1106
|
+
["gif", "image/gif"],
|
|
1107
|
+
["heic", "image/heic"],
|
|
1108
|
+
["heif", "image/heif"],
|
|
1109
|
+
["htm", "text/html"],
|
|
1110
|
+
["html", "text/html"],
|
|
1111
|
+
["ico", "image/vnd.microsoft.icon"],
|
|
1112
|
+
["ics", "text/calendar"],
|
|
1113
|
+
["jar", "application/java-archive"],
|
|
1114
|
+
["jpeg", "image/jpeg"],
|
|
1115
|
+
["jpg", "image/jpeg"],
|
|
1116
|
+
["js", "text/javascript"],
|
|
1117
|
+
["json", "application/json"],
|
|
1118
|
+
["jsonld", "application/ld+json"],
|
|
1119
|
+
["mid", "audio/midi"],
|
|
1120
|
+
["midi", "audio/midi"],
|
|
1121
|
+
["mjs", "text/javascript"],
|
|
1122
|
+
["mp3", "audio/mpeg"],
|
|
1123
|
+
["mp4", "video/mp4"],
|
|
1124
|
+
["mpeg", "video/mpeg"],
|
|
1125
|
+
["mpkg", "application/vnd.apple.installer+xml"],
|
|
1126
|
+
["odp", "application/vnd.oasis.opendocument.presentation"],
|
|
1127
|
+
["ods", "application/vnd.oasis.opendocument.spreadsheet"],
|
|
1128
|
+
["odt", "application/vnd.oasis.opendocument.text"],
|
|
1129
|
+
["oga", "audio/ogg"],
|
|
1130
|
+
["ogv", "video/ogg"],
|
|
1131
|
+
["ogx", "application/ogg"],
|
|
1132
|
+
["opus", "audio/opus"],
|
|
1133
|
+
["otf", "font/otf"],
|
|
1134
|
+
["png", "image/png"],
|
|
1135
|
+
["pdf", "application/pdf"],
|
|
1136
|
+
["php", "application/x-httpd-php"],
|
|
1137
|
+
["ppt", "application/vnd.ms-powerpoint"],
|
|
1138
|
+
["pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"],
|
|
1139
|
+
["rar", "application/vnd.rar"],
|
|
1140
|
+
["rtf", "application/rtf"],
|
|
1141
|
+
["sh", "application/x-sh"],
|
|
1142
|
+
["svg", "image/svg+xml"],
|
|
1143
|
+
["swf", "application/x-shockwave-flash"],
|
|
1144
|
+
["tar", "application/x-tar"],
|
|
1145
|
+
["tif", "image/tiff"],
|
|
1146
|
+
["tiff", "image/tiff"],
|
|
1147
|
+
["ts", "video/mp2t"],
|
|
1148
|
+
["ttf", "font/ttf"],
|
|
1149
|
+
["txt", "text/plain"],
|
|
1150
|
+
["vsd", "application/vnd.visio"],
|
|
1151
|
+
["wav", "audio/wav"],
|
|
1152
|
+
["weba", "audio/webm"],
|
|
1153
|
+
["webm", "video/webm"],
|
|
1154
|
+
["webp", "image/webp"],
|
|
1155
|
+
["woff", "font/woff"],
|
|
1156
|
+
["woff2", "font/woff2"],
|
|
1157
|
+
["xhtml", "application/xhtml+xml"],
|
|
1158
|
+
["xls", "application/vnd.ms-excel"],
|
|
1159
|
+
["xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
1160
|
+
["xml", "application/xml"],
|
|
1161
|
+
["xul", "application/vnd.mozilla.xul+xml"],
|
|
1162
|
+
["zip", "application/zip"],
|
|
1163
|
+
["7z", "application/x-7z-compressed"],
|
|
1164
|
+
// Others
|
|
1165
|
+
["mkv", "video/x-matroska"],
|
|
1166
|
+
["mov", "video/quicktime"],
|
|
1167
|
+
["msg", "application/vnd.ms-outlook"]
|
|
1168
|
+
]);
|
|
1169
|
+
function toFileWithPath(file, path) {
|
|
1170
|
+
var f2 = withMimeType(file);
|
|
1171
|
+
if (typeof f2.path !== "string") {
|
|
1172
|
+
var webkitRelativePath = file.webkitRelativePath;
|
|
1173
|
+
Object.defineProperty(f2, "path", {
|
|
1174
|
+
value: typeof path === "string" ? path : typeof webkitRelativePath === "string" && webkitRelativePath.length > 0 ? webkitRelativePath : file.name,
|
|
1175
|
+
writable: false,
|
|
1176
|
+
configurable: false,
|
|
1177
|
+
enumerable: true
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
return f2;
|
|
1181
|
+
}
|
|
1182
|
+
function withMimeType(file) {
|
|
1183
|
+
var name = file.name;
|
|
1184
|
+
var hasExtension = name && name.lastIndexOf(".") !== -1;
|
|
1185
|
+
if (hasExtension && !file.type) {
|
|
1186
|
+
var ext = name.split(".").pop().toLowerCase();
|
|
1187
|
+
var type = COMMON_MIME_TYPES.get(ext);
|
|
1188
|
+
if (type) {
|
|
1189
|
+
Object.defineProperty(file, "type", {
|
|
1190
|
+
value: type,
|
|
1191
|
+
writable: false,
|
|
1192
|
+
configurable: false,
|
|
1193
|
+
enumerable: true
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
return file;
|
|
1198
|
+
}
|
|
1199
|
+
var FILES_TO_IGNORE = [
|
|
1200
|
+
// Thumbnail cache files for macOS and Windows
|
|
1201
|
+
".DS_Store",
|
|
1202
|
+
"Thumbs.db"
|
|
1203
|
+
// Windows
|
|
1204
|
+
];
|
|
1205
|
+
function fromEvent(evt) {
|
|
1206
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
1207
|
+
return __generator(this, function(_a) {
|
|
1208
|
+
if (isObject(evt) && isDataTransfer(evt.dataTransfer)) {
|
|
1209
|
+
return [2, getDataTransferFiles(evt.dataTransfer, evt.type)];
|
|
1210
|
+
} else if (isChangeEvt(evt)) {
|
|
1211
|
+
return [2, getInputFiles(evt)];
|
|
1212
|
+
} else if (Array.isArray(evt) && evt.every(function(item) {
|
|
1213
|
+
return "getFile" in item && typeof item.getFile === "function";
|
|
1214
|
+
})) {
|
|
1215
|
+
return [2, getFsHandleFiles(evt)];
|
|
1216
|
+
}
|
|
1217
|
+
return [2, []];
|
|
1218
|
+
});
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
function isDataTransfer(value) {
|
|
1222
|
+
return isObject(value);
|
|
1223
|
+
}
|
|
1224
|
+
function isChangeEvt(value) {
|
|
1225
|
+
return isObject(value) && isObject(value.target);
|
|
1226
|
+
}
|
|
1227
|
+
function isObject(v2) {
|
|
1228
|
+
return typeof v2 === "object" && v2 !== null;
|
|
1229
|
+
}
|
|
1230
|
+
function getInputFiles(evt) {
|
|
1231
|
+
return fromList(evt.target.files).map(function(file) {
|
|
1232
|
+
return toFileWithPath(file);
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
function getFsHandleFiles(handles) {
|
|
1236
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
1237
|
+
var files;
|
|
1238
|
+
return __generator(this, function(_a) {
|
|
1239
|
+
switch (_a.label) {
|
|
1240
|
+
case 0:
|
|
1241
|
+
return [4, Promise.all(handles.map(function(h2) {
|
|
1242
|
+
return h2.getFile();
|
|
1243
|
+
}))];
|
|
1244
|
+
case 1:
|
|
1245
|
+
files = _a.sent();
|
|
1246
|
+
return [2, files.map(function(file) {
|
|
1247
|
+
return toFileWithPath(file);
|
|
1248
|
+
})];
|
|
1249
|
+
}
|
|
1250
|
+
});
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
function getDataTransferFiles(dt, type) {
|
|
1254
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
1255
|
+
var items, files;
|
|
1256
|
+
return __generator(this, function(_a) {
|
|
1257
|
+
switch (_a.label) {
|
|
1258
|
+
case 0:
|
|
1259
|
+
if (!dt.items)
|
|
1260
|
+
return [3, 2];
|
|
1261
|
+
items = fromList(dt.items).filter(function(item) {
|
|
1262
|
+
return item.kind === "file";
|
|
1263
|
+
});
|
|
1264
|
+
if (type !== "drop") {
|
|
1265
|
+
return [2, items];
|
|
1266
|
+
}
|
|
1267
|
+
return [4, Promise.all(items.map(toFilePromises))];
|
|
1268
|
+
case 1:
|
|
1269
|
+
files = _a.sent();
|
|
1270
|
+
return [2, noIgnoredFiles(flatten(files))];
|
|
1271
|
+
case 2:
|
|
1272
|
+
return [2, noIgnoredFiles(fromList(dt.files).map(function(file) {
|
|
1273
|
+
return toFileWithPath(file);
|
|
1274
|
+
}))];
|
|
1275
|
+
}
|
|
1276
|
+
});
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
function noIgnoredFiles(files) {
|
|
1280
|
+
return files.filter(function(file) {
|
|
1281
|
+
return FILES_TO_IGNORE.indexOf(file.name) === -1;
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
function fromList(items) {
|
|
1285
|
+
if (items === null) {
|
|
1286
|
+
return [];
|
|
1287
|
+
}
|
|
1288
|
+
var files = [];
|
|
1289
|
+
for (var i = 0; i < items.length; i++) {
|
|
1290
|
+
var file = items[i];
|
|
1291
|
+
files.push(file);
|
|
1292
|
+
}
|
|
1293
|
+
return files;
|
|
1294
|
+
}
|
|
1295
|
+
function toFilePromises(item) {
|
|
1296
|
+
if (typeof item.webkitGetAsEntry !== "function") {
|
|
1297
|
+
return fromDataTransferItem(item);
|
|
1298
|
+
}
|
|
1299
|
+
var entry = item.webkitGetAsEntry();
|
|
1300
|
+
if (entry && entry.isDirectory) {
|
|
1301
|
+
return fromDirEntry(entry);
|
|
1302
|
+
}
|
|
1303
|
+
return fromDataTransferItem(item);
|
|
1304
|
+
}
|
|
1305
|
+
function flatten(items) {
|
|
1306
|
+
return items.reduce(function(acc, files) {
|
|
1307
|
+
return __spreadArray(__spreadArray([], __read(acc), false), __read(Array.isArray(files) ? flatten(files) : [files]), false);
|
|
1308
|
+
}, []);
|
|
1309
|
+
}
|
|
1310
|
+
function fromDataTransferItem(item) {
|
|
1311
|
+
var file = item.getAsFile();
|
|
1312
|
+
if (!file) {
|
|
1313
|
+
return Promise.reject("".concat(item, " is not a File"));
|
|
1314
|
+
}
|
|
1315
|
+
var fwp = toFileWithPath(file);
|
|
1316
|
+
return Promise.resolve(fwp);
|
|
1317
|
+
}
|
|
1318
|
+
function fromEntry(entry) {
|
|
1319
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
1320
|
+
return __generator(this, function(_a) {
|
|
1321
|
+
return [2, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
|
|
1322
|
+
});
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
function fromDirEntry(entry) {
|
|
1326
|
+
var reader = entry.createReader();
|
|
1327
|
+
return new Promise(function(resolve, reject) {
|
|
1328
|
+
var entries = [];
|
|
1329
|
+
function readEntries() {
|
|
1330
|
+
var _this = this;
|
|
1331
|
+
reader.readEntries(function(batch) {
|
|
1332
|
+
return __awaiter(_this, void 0, void 0, function() {
|
|
1333
|
+
var files, err_1, items;
|
|
1334
|
+
return __generator(this, function(_a) {
|
|
1335
|
+
switch (_a.label) {
|
|
1336
|
+
case 0:
|
|
1337
|
+
if (!!batch.length)
|
|
1338
|
+
return [3, 5];
|
|
1339
|
+
_a.label = 1;
|
|
1340
|
+
case 1:
|
|
1341
|
+
_a.trys.push([1, 3, , 4]);
|
|
1342
|
+
return [4, Promise.all(entries)];
|
|
1343
|
+
case 2:
|
|
1344
|
+
files = _a.sent();
|
|
1345
|
+
resolve(files);
|
|
1346
|
+
return [3, 4];
|
|
1347
|
+
case 3:
|
|
1348
|
+
err_1 = _a.sent();
|
|
1349
|
+
reject(err_1);
|
|
1350
|
+
return [3, 4];
|
|
1351
|
+
case 4:
|
|
1352
|
+
return [3, 6];
|
|
1353
|
+
case 5:
|
|
1354
|
+
items = Promise.all(batch.map(fromEntry));
|
|
1355
|
+
entries.push(items);
|
|
1356
|
+
readEntries();
|
|
1357
|
+
_a.label = 6;
|
|
1358
|
+
case 6:
|
|
1359
|
+
return [
|
|
1360
|
+
2
|
|
1361
|
+
/*return*/
|
|
1362
|
+
];
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
});
|
|
1366
|
+
}, function(err) {
|
|
1367
|
+
reject(err);
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
readEntries();
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
function fromFileEntry(entry) {
|
|
1374
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
1375
|
+
return __generator(this, function(_a) {
|
|
1376
|
+
return [2, new Promise(function(resolve, reject) {
|
|
1377
|
+
entry.file(function(file) {
|
|
1378
|
+
var fwp = toFileWithPath(file, entry.fullPath);
|
|
1379
|
+
resolve(fwp);
|
|
1380
|
+
}, function(err) {
|
|
1381
|
+
reject(err);
|
|
1382
|
+
});
|
|
1383
|
+
})];
|
|
1384
|
+
});
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
var _default = function(file, acceptedFiles) {
|
|
1388
|
+
if (file && acceptedFiles) {
|
|
1389
|
+
var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(",");
|
|
1390
|
+
var fileName = file.name || "";
|
|
1391
|
+
var mimeType = (file.type || "").toLowerCase();
|
|
1392
|
+
var baseMimeType = mimeType.replace(/\/.*$/, "");
|
|
1393
|
+
return acceptedFilesArray.some(function(type) {
|
|
1394
|
+
var validType = type.trim().toLowerCase();
|
|
1395
|
+
if (validType.charAt(0) === ".") {
|
|
1396
|
+
return fileName.toLowerCase().endsWith(validType);
|
|
1397
|
+
} else if (validType.endsWith("/*")) {
|
|
1398
|
+
return baseMimeType === validType.replace(/\/.*$/, "");
|
|
1399
|
+
}
|
|
1400
|
+
return mimeType === validType;
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
return true;
|
|
1404
|
+
};
|
|
1405
|
+
function _toConsumableArray$1(arr) {
|
|
1406
|
+
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
|
|
1407
|
+
}
|
|
1408
|
+
function _nonIterableSpread$1() {
|
|
1409
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1410
|
+
}
|
|
1411
|
+
function _iterableToArray$1(iter) {
|
|
1412
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
1413
|
+
return Array.from(iter);
|
|
1414
|
+
}
|
|
1415
|
+
function _arrayWithoutHoles$1(arr) {
|
|
1416
|
+
if (Array.isArray(arr))
|
|
1417
|
+
return _arrayLikeToArray$1(arr);
|
|
1418
|
+
}
|
|
1419
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
1420
|
+
var keys = Object.keys(object);
|
|
1421
|
+
if (Object.getOwnPropertySymbols) {
|
|
1422
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1423
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
1424
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1425
|
+
})), keys.push.apply(keys, symbols);
|
|
1426
|
+
}
|
|
1427
|
+
return keys;
|
|
1428
|
+
}
|
|
1429
|
+
function _objectSpread$1(target) {
|
|
1430
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1431
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
1432
|
+
i % 2 ? ownKeys$1(Object(source), true).forEach(function(key) {
|
|
1433
|
+
_defineProperty$1(target, key, source[key]);
|
|
1434
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function(key) {
|
|
1435
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
return target;
|
|
1439
|
+
}
|
|
1440
|
+
function _defineProperty$1(obj, key, value) {
|
|
1441
|
+
if (key in obj) {
|
|
1442
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
1443
|
+
} else {
|
|
1444
|
+
obj[key] = value;
|
|
1445
|
+
}
|
|
1446
|
+
return obj;
|
|
1447
|
+
}
|
|
1448
|
+
function _slicedToArray$1(arr, i) {
|
|
1449
|
+
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
|
|
1450
|
+
}
|
|
1451
|
+
function _nonIterableRest$1() {
|
|
1452
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1453
|
+
}
|
|
1454
|
+
function _unsupportedIterableToArray$1(o, minLen) {
|
|
1455
|
+
if (!o)
|
|
1456
|
+
return;
|
|
1457
|
+
if (typeof o === "string")
|
|
1458
|
+
return _arrayLikeToArray$1(o, minLen);
|
|
1459
|
+
var n2 = Object.prototype.toString.call(o).slice(8, -1);
|
|
1460
|
+
if (n2 === "Object" && o.constructor)
|
|
1461
|
+
n2 = o.constructor.name;
|
|
1462
|
+
if (n2 === "Map" || n2 === "Set")
|
|
1463
|
+
return Array.from(o);
|
|
1464
|
+
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2))
|
|
1465
|
+
return _arrayLikeToArray$1(o, minLen);
|
|
1466
|
+
}
|
|
1467
|
+
function _arrayLikeToArray$1(arr, len) {
|
|
1468
|
+
if (len == null || len > arr.length)
|
|
1469
|
+
len = arr.length;
|
|
1470
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
1471
|
+
arr2[i] = arr[i];
|
|
1472
|
+
}
|
|
1473
|
+
return arr2;
|
|
1474
|
+
}
|
|
1475
|
+
function _iterableToArrayLimit$1(arr, i) {
|
|
1476
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1477
|
+
if (_i == null)
|
|
1478
|
+
return;
|
|
1479
|
+
var _arr = [];
|
|
1480
|
+
var _n = true;
|
|
1481
|
+
var _d = false;
|
|
1482
|
+
var _s, _e;
|
|
1483
|
+
try {
|
|
1484
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
1485
|
+
_arr.push(_s.value);
|
|
1486
|
+
if (i && _arr.length === i)
|
|
1487
|
+
break;
|
|
1488
|
+
}
|
|
1489
|
+
} catch (err) {
|
|
1490
|
+
_d = true;
|
|
1491
|
+
_e = err;
|
|
1492
|
+
} finally {
|
|
1493
|
+
try {
|
|
1494
|
+
if (!_n && _i["return"] != null)
|
|
1495
|
+
_i["return"]();
|
|
1496
|
+
} finally {
|
|
1497
|
+
if (_d)
|
|
1498
|
+
throw _e;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
return _arr;
|
|
1502
|
+
}
|
|
1503
|
+
function _arrayWithHoles$1(arr) {
|
|
1504
|
+
if (Array.isArray(arr))
|
|
1505
|
+
return arr;
|
|
1506
|
+
}
|
|
1507
|
+
var FILE_INVALID_TYPE = "file-invalid-type";
|
|
1508
|
+
var FILE_TOO_LARGE = "file-too-large";
|
|
1509
|
+
var FILE_TOO_SMALL = "file-too-small";
|
|
1510
|
+
var TOO_MANY_FILES = "too-many-files";
|
|
1511
|
+
var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr2(accept) {
|
|
1512
|
+
accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
|
|
1513
|
+
var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept;
|
|
1514
|
+
return {
|
|
1515
|
+
code: FILE_INVALID_TYPE,
|
|
1516
|
+
message: "File type must be ".concat(messageSuffix)
|
|
1517
|
+
};
|
|
1518
|
+
};
|
|
1519
|
+
var getTooLargeRejectionErr = function getTooLargeRejectionErr2(maxSize) {
|
|
1520
|
+
return {
|
|
1521
|
+
code: FILE_TOO_LARGE,
|
|
1522
|
+
message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes")
|
|
1523
|
+
};
|
|
1524
|
+
};
|
|
1525
|
+
var getTooSmallRejectionErr = function getTooSmallRejectionErr2(minSize) {
|
|
1526
|
+
return {
|
|
1527
|
+
code: FILE_TOO_SMALL,
|
|
1528
|
+
message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes")
|
|
1529
|
+
};
|
|
1530
|
+
};
|
|
1531
|
+
var TOO_MANY_FILES_REJECTION = {
|
|
1532
|
+
code: TOO_MANY_FILES,
|
|
1533
|
+
message: "Too many files"
|
|
1534
|
+
};
|
|
1535
|
+
function fileAccepted(file, accept) {
|
|
1536
|
+
var isAcceptable = file.type === "application/x-moz-file" || _default(file, accept);
|
|
1537
|
+
return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
|
|
1538
|
+
}
|
|
1539
|
+
function fileMatchSize(file, minSize, maxSize) {
|
|
1540
|
+
if (isDefined(file.size)) {
|
|
1541
|
+
if (isDefined(minSize) && isDefined(maxSize)) {
|
|
1542
|
+
if (file.size > maxSize)
|
|
1543
|
+
return [false, getTooLargeRejectionErr(maxSize)];
|
|
1544
|
+
if (file.size < minSize)
|
|
1545
|
+
return [false, getTooSmallRejectionErr(minSize)];
|
|
1546
|
+
} else if (isDefined(minSize) && file.size < minSize)
|
|
1547
|
+
return [false, getTooSmallRejectionErr(minSize)];
|
|
1548
|
+
else if (isDefined(maxSize) && file.size > maxSize)
|
|
1549
|
+
return [false, getTooLargeRejectionErr(maxSize)];
|
|
1550
|
+
}
|
|
1551
|
+
return [true, null];
|
|
1552
|
+
}
|
|
1553
|
+
function isDefined(value) {
|
|
1554
|
+
return value !== void 0 && value !== null;
|
|
1555
|
+
}
|
|
1556
|
+
function allFilesAccepted(_ref) {
|
|
1557
|
+
var files = _ref.files, accept = _ref.accept, minSize = _ref.minSize, maxSize = _ref.maxSize, multiple = _ref.multiple, maxFiles = _ref.maxFiles, validator = _ref.validator;
|
|
1558
|
+
if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
|
|
1559
|
+
return false;
|
|
1560
|
+
}
|
|
1561
|
+
return files.every(function(file) {
|
|
1562
|
+
var _fileAccepted = fileAccepted(file, accept), _fileAccepted2 = _slicedToArray$1(_fileAccepted, 1), accepted = _fileAccepted2[0];
|
|
1563
|
+
var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1), sizeMatch = _fileMatchSize2[0];
|
|
1564
|
+
var customErrors = validator ? validator(file) : null;
|
|
1565
|
+
return accepted && sizeMatch && !customErrors;
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
function isPropagationStopped(event) {
|
|
1569
|
+
if (typeof event.isPropagationStopped === "function") {
|
|
1570
|
+
return event.isPropagationStopped();
|
|
1571
|
+
} else if (typeof event.cancelBubble !== "undefined") {
|
|
1572
|
+
return event.cancelBubble;
|
|
1573
|
+
}
|
|
1574
|
+
return false;
|
|
1575
|
+
}
|
|
1576
|
+
function isEvtWithFiles(event) {
|
|
1577
|
+
if (!event.dataTransfer) {
|
|
1578
|
+
return !!event.target && !!event.target.files;
|
|
1579
|
+
}
|
|
1580
|
+
return Array.prototype.some.call(event.dataTransfer.types, function(type) {
|
|
1581
|
+
return type === "Files" || type === "application/x-moz-file";
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
function onDocumentDragOver(event) {
|
|
1585
|
+
event.preventDefault();
|
|
1586
|
+
}
|
|
1587
|
+
function isIe(userAgent) {
|
|
1588
|
+
return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1;
|
|
1589
|
+
}
|
|
1590
|
+
function isEdge(userAgent) {
|
|
1591
|
+
return userAgent.indexOf("Edge/") !== -1;
|
|
1592
|
+
}
|
|
1593
|
+
function isIeOrEdge() {
|
|
1594
|
+
var userAgent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.navigator.userAgent;
|
|
1595
|
+
return isIe(userAgent) || isEdge(userAgent);
|
|
1596
|
+
}
|
|
1597
|
+
function composeEventHandlers() {
|
|
1598
|
+
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1599
|
+
fns[_key] = arguments[_key];
|
|
1600
|
+
}
|
|
1601
|
+
return function(event) {
|
|
1602
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1603
|
+
args[_key2 - 1] = arguments[_key2];
|
|
1604
|
+
}
|
|
1605
|
+
return fns.some(function(fn) {
|
|
1606
|
+
if (!isPropagationStopped(event) && fn) {
|
|
1607
|
+
fn.apply(void 0, [event].concat(args));
|
|
1608
|
+
}
|
|
1609
|
+
return isPropagationStopped(event);
|
|
1610
|
+
});
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
function canUseFileSystemAccessAPI() {
|
|
1614
|
+
return "showOpenFilePicker" in window;
|
|
1615
|
+
}
|
|
1616
|
+
function pickerOptionsFromAccept(accept) {
|
|
1617
|
+
if (isDefined(accept)) {
|
|
1618
|
+
var acceptForPicker = Object.entries(accept).filter(function(_ref2) {
|
|
1619
|
+
var _ref3 = _slicedToArray$1(_ref2, 2), mimeType = _ref3[0], ext = _ref3[1];
|
|
1620
|
+
var ok = true;
|
|
1621
|
+
if (!isMIMEType(mimeType)) {
|
|
1622
|
+
console.warn('Skipped "'.concat(mimeType, '" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.'));
|
|
1623
|
+
ok = false;
|
|
1624
|
+
}
|
|
1625
|
+
if (!Array.isArray(ext) || !ext.every(isExt)) {
|
|
1626
|
+
console.warn('Skipped "'.concat(mimeType, '" because an invalid file extension was provided.'));
|
|
1627
|
+
ok = false;
|
|
1628
|
+
}
|
|
1629
|
+
return ok;
|
|
1630
|
+
}).reduce(function(agg, _ref4) {
|
|
1631
|
+
var _ref5 = _slicedToArray$1(_ref4, 2), mimeType = _ref5[0], ext = _ref5[1];
|
|
1632
|
+
return _objectSpread$1(_objectSpread$1({}, agg), {}, _defineProperty$1({}, mimeType, ext));
|
|
1633
|
+
}, {});
|
|
1634
|
+
return [{
|
|
1635
|
+
// description is required due to https://crbug.com/1264708
|
|
1636
|
+
description: "Files",
|
|
1637
|
+
accept: acceptForPicker
|
|
1638
|
+
}];
|
|
1639
|
+
}
|
|
1640
|
+
return accept;
|
|
1641
|
+
}
|
|
1642
|
+
function acceptPropAsAcceptAttr(accept) {
|
|
1643
|
+
if (isDefined(accept)) {
|
|
1644
|
+
return Object.entries(accept).reduce(function(a, _ref6) {
|
|
1645
|
+
var _ref7 = _slicedToArray$1(_ref6, 2), mimeType = _ref7[0], ext = _ref7[1];
|
|
1646
|
+
return [].concat(_toConsumableArray$1(a), [mimeType], _toConsumableArray$1(ext));
|
|
1647
|
+
}, []).filter(function(v2) {
|
|
1648
|
+
return isMIMEType(v2) || isExt(v2);
|
|
1649
|
+
}).join(",");
|
|
1650
|
+
}
|
|
1651
|
+
return void 0;
|
|
1652
|
+
}
|
|
1653
|
+
function isAbort(v2) {
|
|
1654
|
+
return v2 instanceof DOMException && (v2.name === "AbortError" || v2.code === v2.ABORT_ERR);
|
|
1655
|
+
}
|
|
1656
|
+
function isSecurityError(v2) {
|
|
1657
|
+
return v2 instanceof DOMException && (v2.name === "SecurityError" || v2.code === v2.SECURITY_ERR);
|
|
1658
|
+
}
|
|
1659
|
+
function isMIMEType(v2) {
|
|
1660
|
+
return v2 === "audio/*" || v2 === "video/*" || v2 === "image/*" || v2 === "text/*" || /\w+\/[-+.\w]+/g.test(v2);
|
|
1661
|
+
}
|
|
1662
|
+
function isExt(v2) {
|
|
1663
|
+
return /^.*\.[\w]+$/.test(v2);
|
|
1664
|
+
}
|
|
1665
|
+
var _excluded = ["children"], _excluded2 = ["open"], _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"], _excluded4 = ["refKey", "onChange", "onClick"];
|
|
1666
|
+
function _toConsumableArray(arr) {
|
|
1667
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
1668
|
+
}
|
|
1669
|
+
function _nonIterableSpread() {
|
|
1670
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1671
|
+
}
|
|
1672
|
+
function _iterableToArray(iter) {
|
|
1673
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
1674
|
+
return Array.from(iter);
|
|
1675
|
+
}
|
|
1676
|
+
function _arrayWithoutHoles(arr) {
|
|
1677
|
+
if (Array.isArray(arr))
|
|
1678
|
+
return _arrayLikeToArray(arr);
|
|
1679
|
+
}
|
|
1680
|
+
function _slicedToArray(arr, i) {
|
|
1681
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
1682
|
+
}
|
|
1683
|
+
function _nonIterableRest() {
|
|
1684
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1685
|
+
}
|
|
1686
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
1687
|
+
if (!o)
|
|
1688
|
+
return;
|
|
1689
|
+
if (typeof o === "string")
|
|
1690
|
+
return _arrayLikeToArray(o, minLen);
|
|
1691
|
+
var n2 = Object.prototype.toString.call(o).slice(8, -1);
|
|
1692
|
+
if (n2 === "Object" && o.constructor)
|
|
1693
|
+
n2 = o.constructor.name;
|
|
1694
|
+
if (n2 === "Map" || n2 === "Set")
|
|
1695
|
+
return Array.from(o);
|
|
1696
|
+
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2))
|
|
1697
|
+
return _arrayLikeToArray(o, minLen);
|
|
1698
|
+
}
|
|
1699
|
+
function _arrayLikeToArray(arr, len) {
|
|
1700
|
+
if (len == null || len > arr.length)
|
|
1701
|
+
len = arr.length;
|
|
1702
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
1703
|
+
arr2[i] = arr[i];
|
|
1704
|
+
}
|
|
1705
|
+
return arr2;
|
|
1706
|
+
}
|
|
1707
|
+
function _iterableToArrayLimit(arr, i) {
|
|
1708
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1709
|
+
if (_i == null)
|
|
1710
|
+
return;
|
|
1711
|
+
var _arr = [];
|
|
1712
|
+
var _n = true;
|
|
1713
|
+
var _d = false;
|
|
1714
|
+
var _s, _e;
|
|
1715
|
+
try {
|
|
1716
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
1717
|
+
_arr.push(_s.value);
|
|
1718
|
+
if (i && _arr.length === i)
|
|
1719
|
+
break;
|
|
1720
|
+
}
|
|
1721
|
+
} catch (err) {
|
|
1722
|
+
_d = true;
|
|
1723
|
+
_e = err;
|
|
1724
|
+
} finally {
|
|
1725
|
+
try {
|
|
1726
|
+
if (!_n && _i["return"] != null)
|
|
1727
|
+
_i["return"]();
|
|
1728
|
+
} finally {
|
|
1729
|
+
if (_d)
|
|
1730
|
+
throw _e;
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
return _arr;
|
|
1734
|
+
}
|
|
1735
|
+
function _arrayWithHoles(arr) {
|
|
1736
|
+
if (Array.isArray(arr))
|
|
1737
|
+
return arr;
|
|
1738
|
+
}
|
|
1739
|
+
function ownKeys(object, enumerableOnly) {
|
|
1740
|
+
var keys = Object.keys(object);
|
|
1741
|
+
if (Object.getOwnPropertySymbols) {
|
|
1742
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1743
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
1744
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1745
|
+
})), keys.push.apply(keys, symbols);
|
|
1746
|
+
}
|
|
1747
|
+
return keys;
|
|
1748
|
+
}
|
|
1749
|
+
function _objectSpread(target) {
|
|
1750
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1751
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
1752
|
+
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
1753
|
+
_defineProperty(target, key, source[key]);
|
|
1754
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
1755
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
return target;
|
|
1759
|
+
}
|
|
1760
|
+
function _defineProperty(obj, key, value) {
|
|
1761
|
+
if (key in obj) {
|
|
1762
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
1763
|
+
} else {
|
|
1764
|
+
obj[key] = value;
|
|
1765
|
+
}
|
|
1766
|
+
return obj;
|
|
1767
|
+
}
|
|
1768
|
+
function _objectWithoutProperties(source, excluded) {
|
|
1769
|
+
if (source == null)
|
|
1770
|
+
return {};
|
|
1771
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
1772
|
+
var key, i;
|
|
1773
|
+
if (Object.getOwnPropertySymbols) {
|
|
1774
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
1775
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
1776
|
+
key = sourceSymbolKeys[i];
|
|
1777
|
+
if (excluded.indexOf(key) >= 0)
|
|
1778
|
+
continue;
|
|
1779
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
|
1780
|
+
continue;
|
|
1781
|
+
target[key] = source[key];
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
return target;
|
|
1785
|
+
}
|
|
1786
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
1787
|
+
if (source == null)
|
|
1788
|
+
return {};
|
|
1789
|
+
var target = {};
|
|
1790
|
+
var sourceKeys = Object.keys(source);
|
|
1791
|
+
var key, i;
|
|
1792
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
1793
|
+
key = sourceKeys[i];
|
|
1794
|
+
if (excluded.indexOf(key) >= 0)
|
|
1795
|
+
continue;
|
|
1796
|
+
target[key] = source[key];
|
|
1797
|
+
}
|
|
1798
|
+
return target;
|
|
1799
|
+
}
|
|
1800
|
+
var Dropzone = /* @__PURE__ */ forwardRef(function(_ref, ref) {
|
|
1801
|
+
var children = _ref.children, params = _objectWithoutProperties(_ref, _excluded);
|
|
1802
|
+
var _useDropzone = useDropzone(params), open = _useDropzone.open, props = _objectWithoutProperties(_useDropzone, _excluded2);
|
|
1803
|
+
useImperativeHandle(ref, function() {
|
|
1804
|
+
return {
|
|
1805
|
+
open
|
|
1806
|
+
};
|
|
1807
|
+
}, [open]);
|
|
1808
|
+
return /* @__PURE__ */ React__default.createElement(Fragment$1, null, children(_objectSpread(_objectSpread({}, props), {}, {
|
|
1809
|
+
open
|
|
1810
|
+
})));
|
|
1811
|
+
});
|
|
1812
|
+
Dropzone.displayName = "Dropzone";
|
|
1813
|
+
var defaultProps = {
|
|
1814
|
+
disabled: false,
|
|
1815
|
+
getFilesFromEvent: fromEvent,
|
|
1816
|
+
maxSize: Infinity,
|
|
1817
|
+
minSize: 0,
|
|
1818
|
+
multiple: true,
|
|
1819
|
+
maxFiles: 0,
|
|
1820
|
+
preventDropOnDocument: true,
|
|
1821
|
+
noClick: false,
|
|
1822
|
+
noKeyboard: false,
|
|
1823
|
+
noDrag: false,
|
|
1824
|
+
noDragEventsBubbling: false,
|
|
1825
|
+
validator: null,
|
|
1826
|
+
useFsAccessApi: true,
|
|
1827
|
+
autoFocus: false
|
|
1828
|
+
};
|
|
1829
|
+
Dropzone.defaultProps = defaultProps;
|
|
1830
|
+
Dropzone.propTypes = {
|
|
1831
|
+
/**
|
|
1832
|
+
* Render function that exposes the dropzone state and prop getter fns
|
|
1833
|
+
*
|
|
1834
|
+
* @param {object} params
|
|
1835
|
+
* @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render
|
|
1836
|
+
* @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render
|
|
1837
|
+
* @param {Function} params.open Open the native file selection dialog
|
|
1838
|
+
* @param {boolean} params.isFocused Dropzone area is in focus
|
|
1839
|
+
* @param {boolean} params.isFileDialogActive File dialog is opened
|
|
1840
|
+
* @param {boolean} params.isDragActive Active drag is in progress
|
|
1841
|
+
* @param {boolean} params.isDragAccept Dragged files are accepted
|
|
1842
|
+
* @param {boolean} params.isDragReject Some dragged files are rejected
|
|
1843
|
+
* @param {File[]} params.acceptedFiles Accepted files
|
|
1844
|
+
* @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
|
|
1845
|
+
*/
|
|
1846
|
+
children: PropTypes.func,
|
|
1847
|
+
/**
|
|
1848
|
+
* Set accepted file types.
|
|
1849
|
+
* Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
|
|
1850
|
+
* Keep in mind that mime type determination is not reliable across platforms. CSV files,
|
|
1851
|
+
* for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
|
|
1852
|
+
* Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
|
|
1853
|
+
*/
|
|
1854
|
+
accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),
|
|
1855
|
+
/**
|
|
1856
|
+
* Allow drag 'n' drop (or selection from the file dialog) of multiple files
|
|
1857
|
+
*/
|
|
1858
|
+
multiple: PropTypes.bool,
|
|
1859
|
+
/**
|
|
1860
|
+
* If false, allow dropped items to take over the current browser window
|
|
1861
|
+
*/
|
|
1862
|
+
preventDropOnDocument: PropTypes.bool,
|
|
1863
|
+
/**
|
|
1864
|
+
* If true, disables click to open the native file selection dialog
|
|
1865
|
+
*/
|
|
1866
|
+
noClick: PropTypes.bool,
|
|
1867
|
+
/**
|
|
1868
|
+
* If true, disables SPACE/ENTER to open the native file selection dialog.
|
|
1869
|
+
* Note that it also stops tracking the focus state.
|
|
1870
|
+
*/
|
|
1871
|
+
noKeyboard: PropTypes.bool,
|
|
1872
|
+
/**
|
|
1873
|
+
* If true, disables drag 'n' drop
|
|
1874
|
+
*/
|
|
1875
|
+
noDrag: PropTypes.bool,
|
|
1876
|
+
/**
|
|
1877
|
+
* If true, stops drag event propagation to parents
|
|
1878
|
+
*/
|
|
1879
|
+
noDragEventsBubbling: PropTypes.bool,
|
|
1880
|
+
/**
|
|
1881
|
+
* Minimum file size (in bytes)
|
|
1882
|
+
*/
|
|
1883
|
+
minSize: PropTypes.number,
|
|
1884
|
+
/**
|
|
1885
|
+
* Maximum file size (in bytes)
|
|
1886
|
+
*/
|
|
1887
|
+
maxSize: PropTypes.number,
|
|
1888
|
+
/**
|
|
1889
|
+
* Maximum accepted number of files
|
|
1890
|
+
* The default value is 0 which means there is no limitation to how many files are accepted.
|
|
1891
|
+
*/
|
|
1892
|
+
maxFiles: PropTypes.number,
|
|
1893
|
+
/**
|
|
1894
|
+
* Enable/disable the dropzone
|
|
1895
|
+
*/
|
|
1896
|
+
disabled: PropTypes.bool,
|
|
1897
|
+
/**
|
|
1898
|
+
* Use this to provide a custom file aggregator
|
|
1899
|
+
*
|
|
1900
|
+
* @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
|
|
1901
|
+
*/
|
|
1902
|
+
getFilesFromEvent: PropTypes.func,
|
|
1903
|
+
/**
|
|
1904
|
+
* Cb for when closing the file dialog with no selection
|
|
1905
|
+
*/
|
|
1906
|
+
onFileDialogCancel: PropTypes.func,
|
|
1907
|
+
/**
|
|
1908
|
+
* Cb for when opening the file dialog
|
|
1909
|
+
*/
|
|
1910
|
+
onFileDialogOpen: PropTypes.func,
|
|
1911
|
+
/**
|
|
1912
|
+
* Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
|
|
1913
|
+
* to open the file picker instead of using an `<input type="file">` click event.
|
|
1914
|
+
*/
|
|
1915
|
+
useFsAccessApi: PropTypes.bool,
|
|
1916
|
+
/**
|
|
1917
|
+
* Set to true to focus the root element on render
|
|
1918
|
+
*/
|
|
1919
|
+
autoFocus: PropTypes.bool,
|
|
1920
|
+
/**
|
|
1921
|
+
* Cb for when the `dragenter` event occurs.
|
|
1922
|
+
*
|
|
1923
|
+
* @param {DragEvent} event
|
|
1924
|
+
*/
|
|
1925
|
+
onDragEnter: PropTypes.func,
|
|
1926
|
+
/**
|
|
1927
|
+
* Cb for when the `dragleave` event occurs
|
|
1928
|
+
*
|
|
1929
|
+
* @param {DragEvent} event
|
|
1930
|
+
*/
|
|
1931
|
+
onDragLeave: PropTypes.func,
|
|
1932
|
+
/**
|
|
1933
|
+
* Cb for when the `dragover` event occurs
|
|
1934
|
+
*
|
|
1935
|
+
* @param {DragEvent} event
|
|
1936
|
+
*/
|
|
1937
|
+
onDragOver: PropTypes.func,
|
|
1938
|
+
/**
|
|
1939
|
+
* Cb for when the `drop` event occurs.
|
|
1940
|
+
* Note that this callback is invoked after the `getFilesFromEvent` callback is done.
|
|
1941
|
+
*
|
|
1942
|
+
* Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
|
|
1943
|
+
* `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension.
|
|
1944
|
+
* If `multiple` is set to false and additional files are dropped,
|
|
1945
|
+
* all files besides the first will be rejected.
|
|
1946
|
+
* Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
|
|
1947
|
+
*
|
|
1948
|
+
* Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
|
|
1949
|
+
* If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
|
|
1950
|
+
*
|
|
1951
|
+
* `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
|
|
1952
|
+
* For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
|
|
1953
|
+
*
|
|
1954
|
+
* ```js
|
|
1955
|
+
* function onDrop(acceptedFiles) {
|
|
1956
|
+
* const req = request.post('/upload')
|
|
1957
|
+
* acceptedFiles.forEach(file => {
|
|
1958
|
+
* req.attach(file.name, file)
|
|
1959
|
+
* })
|
|
1960
|
+
* req.end(callback)
|
|
1961
|
+
* }
|
|
1962
|
+
* ```
|
|
1963
|
+
*
|
|
1964
|
+
* @param {File[]} acceptedFiles
|
|
1965
|
+
* @param {FileRejection[]} fileRejections
|
|
1966
|
+
* @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
|
|
1967
|
+
*/
|
|
1968
|
+
onDrop: PropTypes.func,
|
|
1969
|
+
/**
|
|
1970
|
+
* Cb for when the `drop` event occurs.
|
|
1971
|
+
* Note that if no files are accepted, this callback is not invoked.
|
|
1972
|
+
*
|
|
1973
|
+
* @param {File[]} files
|
|
1974
|
+
* @param {(DragEvent|Event)} event
|
|
1975
|
+
*/
|
|
1976
|
+
onDropAccepted: PropTypes.func,
|
|
1977
|
+
/**
|
|
1978
|
+
* Cb for when the `drop` event occurs.
|
|
1979
|
+
* Note that if no files are rejected, this callback is not invoked.
|
|
1980
|
+
*
|
|
1981
|
+
* @param {FileRejection[]} fileRejections
|
|
1982
|
+
* @param {(DragEvent|Event)} event
|
|
1983
|
+
*/
|
|
1984
|
+
onDropRejected: PropTypes.func,
|
|
1985
|
+
/**
|
|
1986
|
+
* Cb for when there's some error from any of the promises.
|
|
1987
|
+
*
|
|
1988
|
+
* @param {Error} error
|
|
1989
|
+
*/
|
|
1990
|
+
onError: PropTypes.func,
|
|
1991
|
+
/**
|
|
1992
|
+
* Custom validation function. It must return null if there's no errors.
|
|
1993
|
+
* @param {File} file
|
|
1994
|
+
* @returns {FileError|FileError[]|null}
|
|
1995
|
+
*/
|
|
1996
|
+
validator: PropTypes.func
|
|
1997
|
+
};
|
|
1998
|
+
var initialState = {
|
|
1999
|
+
isFocused: false,
|
|
2000
|
+
isFileDialogActive: false,
|
|
2001
|
+
isDragActive: false,
|
|
2002
|
+
isDragAccept: false,
|
|
2003
|
+
isDragReject: false,
|
|
2004
|
+
acceptedFiles: [],
|
|
2005
|
+
fileRejections: []
|
|
2006
|
+
};
|
|
2007
|
+
function useDropzone() {
|
|
2008
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2009
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), accept = _defaultProps$props.accept, disabled = _defaultProps$props.disabled, getFilesFromEvent = _defaultProps$props.getFilesFromEvent, maxSize = _defaultProps$props.maxSize, minSize = _defaultProps$props.minSize, multiple = _defaultProps$props.multiple, maxFiles = _defaultProps$props.maxFiles, onDragEnter = _defaultProps$props.onDragEnter, onDragLeave = _defaultProps$props.onDragLeave, onDragOver = _defaultProps$props.onDragOver, onDrop = _defaultProps$props.onDrop, onDropAccepted = _defaultProps$props.onDropAccepted, onDropRejected = _defaultProps$props.onDropRejected, onFileDialogCancel = _defaultProps$props.onFileDialogCancel, onFileDialogOpen = _defaultProps$props.onFileDialogOpen, useFsAccessApi = _defaultProps$props.useFsAccessApi, autoFocus = _defaultProps$props.autoFocus, preventDropOnDocument = _defaultProps$props.preventDropOnDocument, noClick = _defaultProps$props.noClick, noKeyboard = _defaultProps$props.noKeyboard, noDrag = _defaultProps$props.noDrag, noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling, onError = _defaultProps$props.onError, validator = _defaultProps$props.validator;
|
|
2010
|
+
var acceptAttr = useMemo(function() {
|
|
2011
|
+
return acceptPropAsAcceptAttr(accept);
|
|
2012
|
+
}, [accept]);
|
|
2013
|
+
var pickerTypes = useMemo(function() {
|
|
2014
|
+
return pickerOptionsFromAccept(accept);
|
|
2015
|
+
}, [accept]);
|
|
2016
|
+
var onFileDialogOpenCb = useMemo(function() {
|
|
2017
|
+
return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop;
|
|
2018
|
+
}, [onFileDialogOpen]);
|
|
2019
|
+
var onFileDialogCancelCb = useMemo(function() {
|
|
2020
|
+
return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop;
|
|
2021
|
+
}, [onFileDialogCancel]);
|
|
2022
|
+
var rootRef = useRef(null);
|
|
2023
|
+
var inputRef = useRef(null);
|
|
2024
|
+
var _useReducer = useReducer(reducer, initialState), _useReducer2 = _slicedToArray(_useReducer, 2), state = _useReducer2[0], dispatch = _useReducer2[1];
|
|
2025
|
+
var isFocused = state.isFocused, isFileDialogActive = state.isFileDialogActive;
|
|
2026
|
+
var fsAccessApiWorksRef = useRef(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI());
|
|
2027
|
+
var onWindowFocus = function onWindowFocus2() {
|
|
2028
|
+
if (!fsAccessApiWorksRef.current && isFileDialogActive) {
|
|
2029
|
+
setTimeout(function() {
|
|
2030
|
+
if (inputRef.current) {
|
|
2031
|
+
var files = inputRef.current.files;
|
|
2032
|
+
if (!files.length) {
|
|
2033
|
+
dispatch({
|
|
2034
|
+
type: "closeDialog"
|
|
2035
|
+
});
|
|
2036
|
+
onFileDialogCancelCb();
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
}, 300);
|
|
2040
|
+
}
|
|
2041
|
+
};
|
|
2042
|
+
useEffect(function() {
|
|
2043
|
+
window.addEventListener("focus", onWindowFocus, false);
|
|
2044
|
+
return function() {
|
|
2045
|
+
window.removeEventListener("focus", onWindowFocus, false);
|
|
2046
|
+
};
|
|
2047
|
+
}, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]);
|
|
2048
|
+
var dragTargetsRef = useRef([]);
|
|
2049
|
+
var onDocumentDrop = function onDocumentDrop2(event) {
|
|
2050
|
+
if (rootRef.current && rootRef.current.contains(event.target)) {
|
|
2051
|
+
return;
|
|
2052
|
+
}
|
|
2053
|
+
event.preventDefault();
|
|
2054
|
+
dragTargetsRef.current = [];
|
|
2055
|
+
};
|
|
2056
|
+
useEffect(function() {
|
|
2057
|
+
if (preventDropOnDocument) {
|
|
2058
|
+
document.addEventListener("dragover", onDocumentDragOver, false);
|
|
2059
|
+
document.addEventListener("drop", onDocumentDrop, false);
|
|
2060
|
+
}
|
|
2061
|
+
return function() {
|
|
2062
|
+
if (preventDropOnDocument) {
|
|
2063
|
+
document.removeEventListener("dragover", onDocumentDragOver);
|
|
2064
|
+
document.removeEventListener("drop", onDocumentDrop);
|
|
2065
|
+
}
|
|
2066
|
+
};
|
|
2067
|
+
}, [rootRef, preventDropOnDocument]);
|
|
2068
|
+
useEffect(function() {
|
|
2069
|
+
if (!disabled && autoFocus && rootRef.current) {
|
|
2070
|
+
rootRef.current.focus();
|
|
2071
|
+
}
|
|
2072
|
+
return function() {
|
|
2073
|
+
};
|
|
2074
|
+
}, [rootRef, autoFocus, disabled]);
|
|
2075
|
+
var onErrCb = useCallback(function(e2) {
|
|
2076
|
+
if (onError) {
|
|
2077
|
+
onError(e2);
|
|
2078
|
+
} else {
|
|
2079
|
+
console.error(e2);
|
|
2080
|
+
}
|
|
2081
|
+
}, [onError]);
|
|
2082
|
+
var onDragEnterCb = useCallback(function(event) {
|
|
2083
|
+
event.preventDefault();
|
|
2084
|
+
event.persist();
|
|
2085
|
+
stopPropagation(event);
|
|
2086
|
+
dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
|
|
2087
|
+
if (isEvtWithFiles(event)) {
|
|
2088
|
+
Promise.resolve(getFilesFromEvent(event)).then(function(files) {
|
|
2089
|
+
if (isPropagationStopped(event) && !noDragEventsBubbling) {
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
2092
|
+
var fileCount = files.length;
|
|
2093
|
+
var isDragAccept = fileCount > 0 && allFilesAccepted({
|
|
2094
|
+
files,
|
|
2095
|
+
accept: acceptAttr,
|
|
2096
|
+
minSize,
|
|
2097
|
+
maxSize,
|
|
2098
|
+
multiple,
|
|
2099
|
+
maxFiles,
|
|
2100
|
+
validator
|
|
2101
|
+
});
|
|
2102
|
+
var isDragReject = fileCount > 0 && !isDragAccept;
|
|
2103
|
+
dispatch({
|
|
2104
|
+
isDragAccept,
|
|
2105
|
+
isDragReject,
|
|
2106
|
+
isDragActive: true,
|
|
2107
|
+
type: "setDraggedFiles"
|
|
2108
|
+
});
|
|
2109
|
+
if (onDragEnter) {
|
|
2110
|
+
onDragEnter(event);
|
|
2111
|
+
}
|
|
2112
|
+
}).catch(function(e2) {
|
|
2113
|
+
return onErrCb(e2);
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2116
|
+
}, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]);
|
|
2117
|
+
var onDragOverCb = useCallback(function(event) {
|
|
2118
|
+
event.preventDefault();
|
|
2119
|
+
event.persist();
|
|
2120
|
+
stopPropagation(event);
|
|
2121
|
+
var hasFiles = isEvtWithFiles(event);
|
|
2122
|
+
if (hasFiles && event.dataTransfer) {
|
|
2123
|
+
try {
|
|
2124
|
+
event.dataTransfer.dropEffect = "copy";
|
|
2125
|
+
} catch (_unused) {
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
if (hasFiles && onDragOver) {
|
|
2129
|
+
onDragOver(event);
|
|
2130
|
+
}
|
|
2131
|
+
return false;
|
|
2132
|
+
}, [onDragOver, noDragEventsBubbling]);
|
|
2133
|
+
var onDragLeaveCb = useCallback(function(event) {
|
|
2134
|
+
event.preventDefault();
|
|
2135
|
+
event.persist();
|
|
2136
|
+
stopPropagation(event);
|
|
2137
|
+
var targets = dragTargetsRef.current.filter(function(target) {
|
|
2138
|
+
return rootRef.current && rootRef.current.contains(target);
|
|
2139
|
+
});
|
|
2140
|
+
var targetIdx = targets.indexOf(event.target);
|
|
2141
|
+
if (targetIdx !== -1) {
|
|
2142
|
+
targets.splice(targetIdx, 1);
|
|
2143
|
+
}
|
|
2144
|
+
dragTargetsRef.current = targets;
|
|
2145
|
+
if (targets.length > 0) {
|
|
2146
|
+
return;
|
|
2147
|
+
}
|
|
2148
|
+
dispatch({
|
|
2149
|
+
type: "setDraggedFiles",
|
|
2150
|
+
isDragActive: false,
|
|
2151
|
+
isDragAccept: false,
|
|
2152
|
+
isDragReject: false
|
|
2153
|
+
});
|
|
2154
|
+
if (isEvtWithFiles(event) && onDragLeave) {
|
|
2155
|
+
onDragLeave(event);
|
|
2156
|
+
}
|
|
2157
|
+
}, [rootRef, onDragLeave, noDragEventsBubbling]);
|
|
2158
|
+
var setFiles = useCallback(function(files, event) {
|
|
2159
|
+
var acceptedFiles = [];
|
|
2160
|
+
var fileRejections = [];
|
|
2161
|
+
files.forEach(function(file) {
|
|
2162
|
+
var _fileAccepted = fileAccepted(file, acceptAttr), _fileAccepted2 = _slicedToArray(_fileAccepted, 2), accepted = _fileAccepted2[0], acceptError = _fileAccepted2[1];
|
|
2163
|
+
var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray(_fileMatchSize, 2), sizeMatch = _fileMatchSize2[0], sizeError = _fileMatchSize2[1];
|
|
2164
|
+
var customErrors = validator ? validator(file) : null;
|
|
2165
|
+
if (accepted && sizeMatch && !customErrors) {
|
|
2166
|
+
acceptedFiles.push(file);
|
|
2167
|
+
} else {
|
|
2168
|
+
var errors = [acceptError, sizeError];
|
|
2169
|
+
if (customErrors) {
|
|
2170
|
+
errors = errors.concat(customErrors);
|
|
2171
|
+
}
|
|
2172
|
+
fileRejections.push({
|
|
2173
|
+
file,
|
|
2174
|
+
errors: errors.filter(function(e2) {
|
|
2175
|
+
return e2;
|
|
2176
|
+
})
|
|
2177
|
+
});
|
|
2178
|
+
}
|
|
2179
|
+
});
|
|
2180
|
+
if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
|
|
2181
|
+
acceptedFiles.forEach(function(file) {
|
|
2182
|
+
fileRejections.push({
|
|
2183
|
+
file,
|
|
2184
|
+
errors: [TOO_MANY_FILES_REJECTION]
|
|
2185
|
+
});
|
|
2186
|
+
});
|
|
2187
|
+
acceptedFiles.splice(0);
|
|
2188
|
+
}
|
|
2189
|
+
dispatch({
|
|
2190
|
+
acceptedFiles,
|
|
2191
|
+
fileRejections,
|
|
2192
|
+
type: "setFiles"
|
|
2193
|
+
});
|
|
2194
|
+
if (onDrop) {
|
|
2195
|
+
onDrop(acceptedFiles, fileRejections, event);
|
|
2196
|
+
}
|
|
2197
|
+
if (fileRejections.length > 0 && onDropRejected) {
|
|
2198
|
+
onDropRejected(fileRejections, event);
|
|
2199
|
+
}
|
|
2200
|
+
if (acceptedFiles.length > 0 && onDropAccepted) {
|
|
2201
|
+
onDropAccepted(acceptedFiles, event);
|
|
2202
|
+
}
|
|
2203
|
+
}, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
|
|
2204
|
+
var onDropCb = useCallback(function(event) {
|
|
2205
|
+
event.preventDefault();
|
|
2206
|
+
event.persist();
|
|
2207
|
+
stopPropagation(event);
|
|
2208
|
+
dragTargetsRef.current = [];
|
|
2209
|
+
if (isEvtWithFiles(event)) {
|
|
2210
|
+
Promise.resolve(getFilesFromEvent(event)).then(function(files) {
|
|
2211
|
+
if (isPropagationStopped(event) && !noDragEventsBubbling) {
|
|
2212
|
+
return;
|
|
2213
|
+
}
|
|
2214
|
+
setFiles(files, event);
|
|
2215
|
+
}).catch(function(e2) {
|
|
2216
|
+
return onErrCb(e2);
|
|
2217
|
+
});
|
|
2218
|
+
}
|
|
2219
|
+
dispatch({
|
|
2220
|
+
type: "reset"
|
|
2221
|
+
});
|
|
2222
|
+
}, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]);
|
|
2223
|
+
var openFileDialog = useCallback(function() {
|
|
2224
|
+
if (fsAccessApiWorksRef.current) {
|
|
2225
|
+
dispatch({
|
|
2226
|
+
type: "openDialog"
|
|
2227
|
+
});
|
|
2228
|
+
onFileDialogOpenCb();
|
|
2229
|
+
var opts = {
|
|
2230
|
+
multiple,
|
|
2231
|
+
types: pickerTypes
|
|
2232
|
+
};
|
|
2233
|
+
window.showOpenFilePicker(opts).then(function(handles) {
|
|
2234
|
+
return getFilesFromEvent(handles);
|
|
2235
|
+
}).then(function(files) {
|
|
2236
|
+
setFiles(files, null);
|
|
2237
|
+
dispatch({
|
|
2238
|
+
type: "closeDialog"
|
|
2239
|
+
});
|
|
2240
|
+
}).catch(function(e2) {
|
|
2241
|
+
if (isAbort(e2)) {
|
|
2242
|
+
onFileDialogCancelCb(e2);
|
|
2243
|
+
dispatch({
|
|
2244
|
+
type: "closeDialog"
|
|
2245
|
+
});
|
|
2246
|
+
} else if (isSecurityError(e2)) {
|
|
2247
|
+
fsAccessApiWorksRef.current = false;
|
|
2248
|
+
if (inputRef.current) {
|
|
2249
|
+
inputRef.current.value = null;
|
|
2250
|
+
inputRef.current.click();
|
|
2251
|
+
} else {
|
|
2252
|
+
onErrCb(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."));
|
|
2253
|
+
}
|
|
2254
|
+
} else {
|
|
2255
|
+
onErrCb(e2);
|
|
2256
|
+
}
|
|
2257
|
+
});
|
|
2258
|
+
return;
|
|
2259
|
+
}
|
|
2260
|
+
if (inputRef.current) {
|
|
2261
|
+
dispatch({
|
|
2262
|
+
type: "openDialog"
|
|
2263
|
+
});
|
|
2264
|
+
onFileDialogOpenCb();
|
|
2265
|
+
inputRef.current.value = null;
|
|
2266
|
+
inputRef.current.click();
|
|
2267
|
+
}
|
|
2268
|
+
}, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]);
|
|
2269
|
+
var onKeyDownCb = useCallback(function(event) {
|
|
2270
|
+
if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
|
|
2271
|
+
return;
|
|
2272
|
+
}
|
|
2273
|
+
if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) {
|
|
2274
|
+
event.preventDefault();
|
|
2275
|
+
openFileDialog();
|
|
2276
|
+
}
|
|
2277
|
+
}, [rootRef, openFileDialog]);
|
|
2278
|
+
var onFocusCb = useCallback(function() {
|
|
2279
|
+
dispatch({
|
|
2280
|
+
type: "focus"
|
|
2281
|
+
});
|
|
2282
|
+
}, []);
|
|
2283
|
+
var onBlurCb = useCallback(function() {
|
|
2284
|
+
dispatch({
|
|
2285
|
+
type: "blur"
|
|
2286
|
+
});
|
|
2287
|
+
}, []);
|
|
2288
|
+
var onClickCb = useCallback(function() {
|
|
2289
|
+
if (noClick) {
|
|
2290
|
+
return;
|
|
2291
|
+
}
|
|
2292
|
+
if (isIeOrEdge()) {
|
|
2293
|
+
setTimeout(openFileDialog, 0);
|
|
2294
|
+
} else {
|
|
2295
|
+
openFileDialog();
|
|
2296
|
+
}
|
|
2297
|
+
}, [noClick, openFileDialog]);
|
|
2298
|
+
var composeHandler = function composeHandler2(fn) {
|
|
2299
|
+
return disabled ? null : fn;
|
|
2300
|
+
};
|
|
2301
|
+
var composeKeyboardHandler = function composeKeyboardHandler2(fn) {
|
|
2302
|
+
return noKeyboard ? null : composeHandler(fn);
|
|
2303
|
+
};
|
|
2304
|
+
var composeDragHandler = function composeDragHandler2(fn) {
|
|
2305
|
+
return noDrag ? null : composeHandler(fn);
|
|
2306
|
+
};
|
|
2307
|
+
var stopPropagation = function stopPropagation2(event) {
|
|
2308
|
+
if (noDragEventsBubbling) {
|
|
2309
|
+
event.stopPropagation();
|
|
2310
|
+
}
|
|
2311
|
+
};
|
|
2312
|
+
var getRootProps = useMemo(function() {
|
|
2313
|
+
return function() {
|
|
2314
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref2$refKey = _ref2.refKey, refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey, role = _ref2.role, onKeyDown = _ref2.onKeyDown, onFocus = _ref2.onFocus, onBlur = _ref2.onBlur, onClick = _ref2.onClick, onDragEnter2 = _ref2.onDragEnter, onDragOver2 = _ref2.onDragOver, onDragLeave2 = _ref2.onDragLeave, onDrop2 = _ref2.onDrop, rest = _objectWithoutProperties(_ref2, _excluded3);
|
|
2315
|
+
return _objectSpread(_objectSpread(_defineProperty({
|
|
2316
|
+
onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
|
|
2317
|
+
onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
|
|
2318
|
+
onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
|
|
2319
|
+
onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
|
|
2320
|
+
onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter2, onDragEnterCb)),
|
|
2321
|
+
onDragOver: composeDragHandler(composeEventHandlers(onDragOver2, onDragOverCb)),
|
|
2322
|
+
onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave2, onDragLeaveCb)),
|
|
2323
|
+
onDrop: composeDragHandler(composeEventHandlers(onDrop2, onDropCb)),
|
|
2324
|
+
role: typeof role === "string" && role !== "" ? role : "presentation"
|
|
2325
|
+
}, refKey, rootRef), !disabled && !noKeyboard ? {
|
|
2326
|
+
tabIndex: 0
|
|
2327
|
+
} : {}), rest);
|
|
2328
|
+
};
|
|
2329
|
+
}, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
|
|
2330
|
+
var onInputElementClick = useCallback(function(event) {
|
|
2331
|
+
event.stopPropagation();
|
|
2332
|
+
}, []);
|
|
2333
|
+
var getInputProps = useMemo(function() {
|
|
2334
|
+
return function() {
|
|
2335
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, onChange = _ref3.onChange, onClick = _ref3.onClick, rest = _objectWithoutProperties(_ref3, _excluded4);
|
|
2336
|
+
var inputProps = _defineProperty({
|
|
2337
|
+
accept: acceptAttr,
|
|
2338
|
+
multiple,
|
|
2339
|
+
type: "file",
|
|
2340
|
+
style: {
|
|
2341
|
+
display: "none"
|
|
2342
|
+
},
|
|
2343
|
+
onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
|
|
2344
|
+
onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
|
|
2345
|
+
tabIndex: -1
|
|
2346
|
+
}, refKey, inputRef);
|
|
2347
|
+
return _objectSpread(_objectSpread({}, inputProps), rest);
|
|
2348
|
+
};
|
|
2349
|
+
}, [inputRef, accept, multiple, onDropCb, disabled]);
|
|
2350
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
2351
|
+
isFocused: isFocused && !disabled,
|
|
2352
|
+
getRootProps,
|
|
2353
|
+
getInputProps,
|
|
2354
|
+
rootRef,
|
|
2355
|
+
inputRef,
|
|
2356
|
+
open: composeHandler(openFileDialog)
|
|
2357
|
+
});
|
|
2358
|
+
}
|
|
2359
|
+
function reducer(state, action) {
|
|
2360
|
+
switch (action.type) {
|
|
2361
|
+
case "focus":
|
|
2362
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
2363
|
+
isFocused: true
|
|
2364
|
+
});
|
|
2365
|
+
case "blur":
|
|
2366
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
2367
|
+
isFocused: false
|
|
2368
|
+
});
|
|
2369
|
+
case "openDialog":
|
|
2370
|
+
return _objectSpread(_objectSpread({}, initialState), {}, {
|
|
2371
|
+
isFileDialogActive: true
|
|
2372
|
+
});
|
|
2373
|
+
case "closeDialog":
|
|
2374
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
2375
|
+
isFileDialogActive: false
|
|
2376
|
+
});
|
|
2377
|
+
case "setDraggedFiles":
|
|
2378
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
2379
|
+
isDragActive: action.isDragActive,
|
|
2380
|
+
isDragAccept: action.isDragAccept,
|
|
2381
|
+
isDragReject: action.isDragReject
|
|
2382
|
+
});
|
|
2383
|
+
case "setFiles":
|
|
2384
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
2385
|
+
acceptedFiles: action.acceptedFiles,
|
|
2386
|
+
fileRejections: action.fileRejections
|
|
2387
|
+
});
|
|
2388
|
+
case "reset":
|
|
2389
|
+
return _objectSpread({}, initialState);
|
|
2390
|
+
default:
|
|
2391
|
+
return state;
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
function noop() {
|
|
2395
|
+
}
|
|
2396
|
+
export {
|
|
2397
|
+
useDropzone as u
|
|
2398
|
+
};
|
|
2399
|
+
//# sourceMappingURL=index-BE-ioJyt.js.map
|