strapi-custom-auth 1.1.27
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/README.md +1 -0
- package/dist/_chunks/App-B-bQ656I.mjs +1866 -0
- package/dist/_chunks/App-CdSJ6UQk.js +1869 -0
- package/dist/_chunks/en-B4KWt_jN.js +4 -0
- package/dist/_chunks/en-Byx4XI2L.mjs +4 -0
- package/dist/admin/index.js +64 -0
- package/dist/admin/index.mjs +65 -0
- package/dist/server/index.js +39256 -0
- package/dist/server/index.mjs +39243 -0
- package/package.json +65 -0
|
@@ -0,0 +1,1869 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const admin = require("@strapi/strapi/admin");
|
|
5
|
+
const reactRouterDom = require("react-router-dom");
|
|
6
|
+
const React$1 = require("react");
|
|
7
|
+
const styled = require("styled-components");
|
|
8
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
9
|
+
const React__default$1 = /* @__PURE__ */ _interopDefault(React$1);
|
|
10
|
+
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
11
|
+
function getDefaultExportFromCjs(x) {
|
|
12
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
13
|
+
}
|
|
14
|
+
var propTypes = { exports: {} };
|
|
15
|
+
var reactIs = { exports: {} };
|
|
16
|
+
var reactIs_production_min = {};
|
|
17
|
+
/** @license React v16.13.1
|
|
18
|
+
* react-is.production.min.js
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the MIT license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/
|
|
25
|
+
var hasRequiredReactIs_production_min;
|
|
26
|
+
function requireReactIs_production_min() {
|
|
27
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
28
|
+
hasRequiredReactIs_production_min = 1;
|
|
29
|
+
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;
|
|
30
|
+
function z(a) {
|
|
31
|
+
if ("object" === typeof a && null !== a) {
|
|
32
|
+
var u = a.$$typeof;
|
|
33
|
+
switch (u) {
|
|
34
|
+
case c:
|
|
35
|
+
switch (a = a.type, a) {
|
|
36
|
+
case l:
|
|
37
|
+
case m:
|
|
38
|
+
case e:
|
|
39
|
+
case g:
|
|
40
|
+
case f:
|
|
41
|
+
case p:
|
|
42
|
+
return a;
|
|
43
|
+
default:
|
|
44
|
+
switch (a = a && a.$$typeof, a) {
|
|
45
|
+
case k:
|
|
46
|
+
case n:
|
|
47
|
+
case t:
|
|
48
|
+
case r:
|
|
49
|
+
case h:
|
|
50
|
+
return a;
|
|
51
|
+
default:
|
|
52
|
+
return u;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
case d:
|
|
56
|
+
return u;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function A(a) {
|
|
61
|
+
return z(a) === m;
|
|
62
|
+
}
|
|
63
|
+
reactIs_production_min.AsyncMode = l;
|
|
64
|
+
reactIs_production_min.ConcurrentMode = m;
|
|
65
|
+
reactIs_production_min.ContextConsumer = k;
|
|
66
|
+
reactIs_production_min.ContextProvider = h;
|
|
67
|
+
reactIs_production_min.Element = c;
|
|
68
|
+
reactIs_production_min.ForwardRef = n;
|
|
69
|
+
reactIs_production_min.Fragment = e;
|
|
70
|
+
reactIs_production_min.Lazy = t;
|
|
71
|
+
reactIs_production_min.Memo = r;
|
|
72
|
+
reactIs_production_min.Portal = d;
|
|
73
|
+
reactIs_production_min.Profiler = g;
|
|
74
|
+
reactIs_production_min.StrictMode = f;
|
|
75
|
+
reactIs_production_min.Suspense = p;
|
|
76
|
+
reactIs_production_min.isAsyncMode = function(a) {
|
|
77
|
+
return A(a) || z(a) === l;
|
|
78
|
+
};
|
|
79
|
+
reactIs_production_min.isConcurrentMode = A;
|
|
80
|
+
reactIs_production_min.isContextConsumer = function(a) {
|
|
81
|
+
return z(a) === k;
|
|
82
|
+
};
|
|
83
|
+
reactIs_production_min.isContextProvider = function(a) {
|
|
84
|
+
return z(a) === h;
|
|
85
|
+
};
|
|
86
|
+
reactIs_production_min.isElement = function(a) {
|
|
87
|
+
return "object" === typeof a && null !== a && a.$$typeof === c;
|
|
88
|
+
};
|
|
89
|
+
reactIs_production_min.isForwardRef = function(a) {
|
|
90
|
+
return z(a) === n;
|
|
91
|
+
};
|
|
92
|
+
reactIs_production_min.isFragment = function(a) {
|
|
93
|
+
return z(a) === e;
|
|
94
|
+
};
|
|
95
|
+
reactIs_production_min.isLazy = function(a) {
|
|
96
|
+
return z(a) === t;
|
|
97
|
+
};
|
|
98
|
+
reactIs_production_min.isMemo = function(a) {
|
|
99
|
+
return z(a) === r;
|
|
100
|
+
};
|
|
101
|
+
reactIs_production_min.isPortal = function(a) {
|
|
102
|
+
return z(a) === d;
|
|
103
|
+
};
|
|
104
|
+
reactIs_production_min.isProfiler = function(a) {
|
|
105
|
+
return z(a) === g;
|
|
106
|
+
};
|
|
107
|
+
reactIs_production_min.isStrictMode = function(a) {
|
|
108
|
+
return z(a) === f;
|
|
109
|
+
};
|
|
110
|
+
reactIs_production_min.isSuspense = function(a) {
|
|
111
|
+
return z(a) === p;
|
|
112
|
+
};
|
|
113
|
+
reactIs_production_min.isValidElementType = function(a) {
|
|
114
|
+
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);
|
|
115
|
+
};
|
|
116
|
+
reactIs_production_min.typeOf = z;
|
|
117
|
+
return reactIs_production_min;
|
|
118
|
+
}
|
|
119
|
+
var reactIs_development = {};
|
|
120
|
+
/** @license React v16.13.1
|
|
121
|
+
* react-is.development.js
|
|
122
|
+
*
|
|
123
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
124
|
+
*
|
|
125
|
+
* This source code is licensed under the MIT license found in the
|
|
126
|
+
* LICENSE file in the root directory of this source tree.
|
|
127
|
+
*/
|
|
128
|
+
var hasRequiredReactIs_development;
|
|
129
|
+
function requireReactIs_development() {
|
|
130
|
+
if (hasRequiredReactIs_development) return reactIs_development;
|
|
131
|
+
hasRequiredReactIs_development = 1;
|
|
132
|
+
if (process.env.NODE_ENV !== "production") {
|
|
133
|
+
(function() {
|
|
134
|
+
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
135
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
|
|
136
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
|
|
137
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
|
|
138
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
|
|
139
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
|
|
140
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
|
|
141
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
|
|
142
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
|
|
143
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
|
|
144
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
|
|
145
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
|
|
146
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
|
|
147
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
|
|
148
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
|
|
149
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
|
|
150
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
|
|
151
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
|
|
152
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
|
|
153
|
+
function isValidElementType(type) {
|
|
154
|
+
return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
155
|
+
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);
|
|
156
|
+
}
|
|
157
|
+
function typeOf(object) {
|
|
158
|
+
if (typeof object === "object" && object !== null) {
|
|
159
|
+
var $$typeof = object.$$typeof;
|
|
160
|
+
switch ($$typeof) {
|
|
161
|
+
case REACT_ELEMENT_TYPE:
|
|
162
|
+
var type = object.type;
|
|
163
|
+
switch (type) {
|
|
164
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
165
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
166
|
+
case REACT_FRAGMENT_TYPE:
|
|
167
|
+
case REACT_PROFILER_TYPE:
|
|
168
|
+
case REACT_STRICT_MODE_TYPE:
|
|
169
|
+
case REACT_SUSPENSE_TYPE:
|
|
170
|
+
return type;
|
|
171
|
+
default:
|
|
172
|
+
var $$typeofType = type && type.$$typeof;
|
|
173
|
+
switch ($$typeofType) {
|
|
174
|
+
case REACT_CONTEXT_TYPE:
|
|
175
|
+
case REACT_FORWARD_REF_TYPE:
|
|
176
|
+
case REACT_LAZY_TYPE:
|
|
177
|
+
case REACT_MEMO_TYPE:
|
|
178
|
+
case REACT_PROVIDER_TYPE:
|
|
179
|
+
return $$typeofType;
|
|
180
|
+
default:
|
|
181
|
+
return $$typeof;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
case REACT_PORTAL_TYPE:
|
|
185
|
+
return $$typeof;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return void 0;
|
|
189
|
+
}
|
|
190
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
191
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
192
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
193
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
194
|
+
var Element2 = REACT_ELEMENT_TYPE;
|
|
195
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
196
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
197
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
198
|
+
var Memo = REACT_MEMO_TYPE;
|
|
199
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
200
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
201
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
202
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
203
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
204
|
+
function isAsyncMode(object) {
|
|
205
|
+
{
|
|
206
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
207
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
208
|
+
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.");
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
212
|
+
}
|
|
213
|
+
function isConcurrentMode(object) {
|
|
214
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
215
|
+
}
|
|
216
|
+
function isContextConsumer(object) {
|
|
217
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
218
|
+
}
|
|
219
|
+
function isContextProvider(object) {
|
|
220
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
221
|
+
}
|
|
222
|
+
function isElement(object) {
|
|
223
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
224
|
+
}
|
|
225
|
+
function isForwardRef(object) {
|
|
226
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
227
|
+
}
|
|
228
|
+
function isFragment(object) {
|
|
229
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
230
|
+
}
|
|
231
|
+
function isLazy(object) {
|
|
232
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
233
|
+
}
|
|
234
|
+
function isMemo(object) {
|
|
235
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
236
|
+
}
|
|
237
|
+
function isPortal(object) {
|
|
238
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
239
|
+
}
|
|
240
|
+
function isProfiler(object) {
|
|
241
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
242
|
+
}
|
|
243
|
+
function isStrictMode(object) {
|
|
244
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
245
|
+
}
|
|
246
|
+
function isSuspense(object) {
|
|
247
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
248
|
+
}
|
|
249
|
+
reactIs_development.AsyncMode = AsyncMode;
|
|
250
|
+
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
251
|
+
reactIs_development.ContextConsumer = ContextConsumer;
|
|
252
|
+
reactIs_development.ContextProvider = ContextProvider;
|
|
253
|
+
reactIs_development.Element = Element2;
|
|
254
|
+
reactIs_development.ForwardRef = ForwardRef;
|
|
255
|
+
reactIs_development.Fragment = Fragment;
|
|
256
|
+
reactIs_development.Lazy = Lazy;
|
|
257
|
+
reactIs_development.Memo = Memo;
|
|
258
|
+
reactIs_development.Portal = Portal;
|
|
259
|
+
reactIs_development.Profiler = Profiler;
|
|
260
|
+
reactIs_development.StrictMode = StrictMode;
|
|
261
|
+
reactIs_development.Suspense = Suspense;
|
|
262
|
+
reactIs_development.isAsyncMode = isAsyncMode;
|
|
263
|
+
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
264
|
+
reactIs_development.isContextConsumer = isContextConsumer;
|
|
265
|
+
reactIs_development.isContextProvider = isContextProvider;
|
|
266
|
+
reactIs_development.isElement = isElement;
|
|
267
|
+
reactIs_development.isForwardRef = isForwardRef;
|
|
268
|
+
reactIs_development.isFragment = isFragment;
|
|
269
|
+
reactIs_development.isLazy = isLazy;
|
|
270
|
+
reactIs_development.isMemo = isMemo;
|
|
271
|
+
reactIs_development.isPortal = isPortal;
|
|
272
|
+
reactIs_development.isProfiler = isProfiler;
|
|
273
|
+
reactIs_development.isStrictMode = isStrictMode;
|
|
274
|
+
reactIs_development.isSuspense = isSuspense;
|
|
275
|
+
reactIs_development.isValidElementType = isValidElementType;
|
|
276
|
+
reactIs_development.typeOf = typeOf;
|
|
277
|
+
})();
|
|
278
|
+
}
|
|
279
|
+
return reactIs_development;
|
|
280
|
+
}
|
|
281
|
+
var hasRequiredReactIs;
|
|
282
|
+
function requireReactIs() {
|
|
283
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
|
284
|
+
hasRequiredReactIs = 1;
|
|
285
|
+
if (process.env.NODE_ENV === "production") {
|
|
286
|
+
reactIs.exports = requireReactIs_production_min();
|
|
287
|
+
} else {
|
|
288
|
+
reactIs.exports = requireReactIs_development();
|
|
289
|
+
}
|
|
290
|
+
return reactIs.exports;
|
|
291
|
+
}
|
|
292
|
+
/*
|
|
293
|
+
object-assign
|
|
294
|
+
(c) Sindre Sorhus
|
|
295
|
+
@license MIT
|
|
296
|
+
*/
|
|
297
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
298
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
299
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
300
|
+
function toObject(val) {
|
|
301
|
+
if (val === null || val === void 0) {
|
|
302
|
+
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
303
|
+
}
|
|
304
|
+
return Object(val);
|
|
305
|
+
}
|
|
306
|
+
function shouldUseNative() {
|
|
307
|
+
try {
|
|
308
|
+
if (!Object.assign) {
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
var test1 = new String("abc");
|
|
312
|
+
test1[5] = "de";
|
|
313
|
+
if (Object.getOwnPropertyNames(test1)[0] === "5") {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
var test2 = {};
|
|
317
|
+
for (var i = 0; i < 10; i++) {
|
|
318
|
+
test2["_" + String.fromCharCode(i)] = i;
|
|
319
|
+
}
|
|
320
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
|
|
321
|
+
return test2[n];
|
|
322
|
+
});
|
|
323
|
+
if (order2.join("") !== "0123456789") {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
var test3 = {};
|
|
327
|
+
"abcdefghijklmnopqrst".split("").forEach(function(letter) {
|
|
328
|
+
test3[letter] = letter;
|
|
329
|
+
});
|
|
330
|
+
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
return true;
|
|
334
|
+
} catch (err) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
var objectAssign = shouldUseNative() ? Object.assign : function(target, source) {
|
|
339
|
+
var from;
|
|
340
|
+
var to = toObject(target);
|
|
341
|
+
var symbols;
|
|
342
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
343
|
+
from = Object(arguments[s]);
|
|
344
|
+
for (var key in from) {
|
|
345
|
+
if (hasOwnProperty.call(from, key)) {
|
|
346
|
+
to[key] = from[key];
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (getOwnPropertySymbols) {
|
|
350
|
+
symbols = getOwnPropertySymbols(from);
|
|
351
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
352
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
353
|
+
to[symbols[i]] = from[symbols[i]];
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return to;
|
|
359
|
+
};
|
|
360
|
+
const objectAssign$1 = /* @__PURE__ */ getDefaultExportFromCjs(objectAssign);
|
|
361
|
+
var ReactPropTypesSecret_1;
|
|
362
|
+
var hasRequiredReactPropTypesSecret;
|
|
363
|
+
function requireReactPropTypesSecret() {
|
|
364
|
+
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
365
|
+
hasRequiredReactPropTypesSecret = 1;
|
|
366
|
+
var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
367
|
+
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
368
|
+
return ReactPropTypesSecret_1;
|
|
369
|
+
}
|
|
370
|
+
var has;
|
|
371
|
+
var hasRequiredHas;
|
|
372
|
+
function requireHas() {
|
|
373
|
+
if (hasRequiredHas) return has;
|
|
374
|
+
hasRequiredHas = 1;
|
|
375
|
+
has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
376
|
+
return has;
|
|
377
|
+
}
|
|
378
|
+
var checkPropTypes_1;
|
|
379
|
+
var hasRequiredCheckPropTypes;
|
|
380
|
+
function requireCheckPropTypes() {
|
|
381
|
+
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
|
|
382
|
+
hasRequiredCheckPropTypes = 1;
|
|
383
|
+
var printWarning = function() {
|
|
384
|
+
};
|
|
385
|
+
if (process.env.NODE_ENV !== "production") {
|
|
386
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
387
|
+
var loggedTypeFailures = {};
|
|
388
|
+
var has2 = requireHas();
|
|
389
|
+
printWarning = function(text) {
|
|
390
|
+
var message = "Warning: " + text;
|
|
391
|
+
if (typeof console !== "undefined") {
|
|
392
|
+
console.error(message);
|
|
393
|
+
}
|
|
394
|
+
try {
|
|
395
|
+
throw new Error(message);
|
|
396
|
+
} catch (x) {
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
401
|
+
if (process.env.NODE_ENV !== "production") {
|
|
402
|
+
for (var typeSpecName in typeSpecs) {
|
|
403
|
+
if (has2(typeSpecs, typeSpecName)) {
|
|
404
|
+
var error;
|
|
405
|
+
try {
|
|
406
|
+
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
407
|
+
var err = Error(
|
|
408
|
+
(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`."
|
|
409
|
+
);
|
|
410
|
+
err.name = "Invariant Violation";
|
|
411
|
+
throw err;
|
|
412
|
+
}
|
|
413
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
414
|
+
} catch (ex) {
|
|
415
|
+
error = ex;
|
|
416
|
+
}
|
|
417
|
+
if (error && !(error instanceof Error)) {
|
|
418
|
+
printWarning(
|
|
419
|
+
(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)."
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
423
|
+
loggedTypeFailures[error.message] = true;
|
|
424
|
+
var stack = getStack ? getStack() : "";
|
|
425
|
+
printWarning(
|
|
426
|
+
"Failed " + location + " type: " + error.message + (stack != null ? stack : "")
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
checkPropTypes.resetWarningCache = function() {
|
|
434
|
+
if (process.env.NODE_ENV !== "production") {
|
|
435
|
+
loggedTypeFailures = {};
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
checkPropTypes_1 = checkPropTypes;
|
|
439
|
+
return checkPropTypes_1;
|
|
440
|
+
}
|
|
441
|
+
var factoryWithTypeCheckers;
|
|
442
|
+
var hasRequiredFactoryWithTypeCheckers;
|
|
443
|
+
function requireFactoryWithTypeCheckers() {
|
|
444
|
+
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
|
|
445
|
+
hasRequiredFactoryWithTypeCheckers = 1;
|
|
446
|
+
var ReactIs = requireReactIs();
|
|
447
|
+
var assign = objectAssign;
|
|
448
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
449
|
+
var has2 = requireHas();
|
|
450
|
+
var checkPropTypes = requireCheckPropTypes();
|
|
451
|
+
var printWarning = function() {
|
|
452
|
+
};
|
|
453
|
+
if (process.env.NODE_ENV !== "production") {
|
|
454
|
+
printWarning = function(text) {
|
|
455
|
+
var message = "Warning: " + text;
|
|
456
|
+
if (typeof console !== "undefined") {
|
|
457
|
+
console.error(message);
|
|
458
|
+
}
|
|
459
|
+
try {
|
|
460
|
+
throw new Error(message);
|
|
461
|
+
} catch (x) {
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
function emptyFunctionThatReturnsNull() {
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
469
|
+
var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
|
|
470
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
471
|
+
function getIteratorFn(maybeIterable) {
|
|
472
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
473
|
+
if (typeof iteratorFn === "function") {
|
|
474
|
+
return iteratorFn;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
var ANONYMOUS = "<<anonymous>>";
|
|
478
|
+
var ReactPropTypes = {
|
|
479
|
+
array: createPrimitiveTypeChecker("array"),
|
|
480
|
+
bigint: createPrimitiveTypeChecker("bigint"),
|
|
481
|
+
bool: createPrimitiveTypeChecker("boolean"),
|
|
482
|
+
func: createPrimitiveTypeChecker("function"),
|
|
483
|
+
number: createPrimitiveTypeChecker("number"),
|
|
484
|
+
object: createPrimitiveTypeChecker("object"),
|
|
485
|
+
string: createPrimitiveTypeChecker("string"),
|
|
486
|
+
symbol: createPrimitiveTypeChecker("symbol"),
|
|
487
|
+
any: createAnyTypeChecker(),
|
|
488
|
+
arrayOf: createArrayOfTypeChecker,
|
|
489
|
+
element: createElementTypeChecker(),
|
|
490
|
+
elementType: createElementTypeTypeChecker(),
|
|
491
|
+
instanceOf: createInstanceTypeChecker,
|
|
492
|
+
node: createNodeChecker(),
|
|
493
|
+
objectOf: createObjectOfTypeChecker,
|
|
494
|
+
oneOf: createEnumTypeChecker,
|
|
495
|
+
oneOfType: createUnionTypeChecker,
|
|
496
|
+
shape: createShapeTypeChecker,
|
|
497
|
+
exact: createStrictShapeTypeChecker
|
|
498
|
+
};
|
|
499
|
+
function is(x, y) {
|
|
500
|
+
if (x === y) {
|
|
501
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
502
|
+
} else {
|
|
503
|
+
return x !== x && y !== y;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
function PropTypeError(message, data) {
|
|
507
|
+
this.message = message;
|
|
508
|
+
this.data = data && typeof data === "object" ? data : {};
|
|
509
|
+
this.stack = "";
|
|
510
|
+
}
|
|
511
|
+
PropTypeError.prototype = Error.prototype;
|
|
512
|
+
function createChainableTypeChecker(validate) {
|
|
513
|
+
if (process.env.NODE_ENV !== "production") {
|
|
514
|
+
var manualPropTypeCallCache = {};
|
|
515
|
+
var manualPropTypeWarningCount = 0;
|
|
516
|
+
}
|
|
517
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
518
|
+
componentName = componentName || ANONYMOUS;
|
|
519
|
+
propFullName = propFullName || propName;
|
|
520
|
+
if (secret !== ReactPropTypesSecret) {
|
|
521
|
+
if (throwOnDirectAccess) {
|
|
522
|
+
var err = new Error(
|
|
523
|
+
"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"
|
|
524
|
+
);
|
|
525
|
+
err.name = "Invariant Violation";
|
|
526
|
+
throw err;
|
|
527
|
+
} else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
|
|
528
|
+
var cacheKey = componentName + ":" + propName;
|
|
529
|
+
if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
|
|
530
|
+
manualPropTypeWarningCount < 3) {
|
|
531
|
+
printWarning(
|
|
532
|
+
"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."
|
|
533
|
+
);
|
|
534
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
535
|
+
manualPropTypeWarningCount++;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (props[propName] == null) {
|
|
540
|
+
if (isRequired) {
|
|
541
|
+
if (props[propName] === null) {
|
|
542
|
+
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
|
|
543
|
+
}
|
|
544
|
+
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
|
|
545
|
+
}
|
|
546
|
+
return null;
|
|
547
|
+
} else {
|
|
548
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
552
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
553
|
+
return chainedCheckType;
|
|
554
|
+
}
|
|
555
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
556
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
557
|
+
var propValue = props[propName];
|
|
558
|
+
var propType = getPropType(propValue);
|
|
559
|
+
if (propType !== expectedType) {
|
|
560
|
+
var preciseType = getPreciseType(propValue);
|
|
561
|
+
return new PropTypeError(
|
|
562
|
+
"Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
|
|
563
|
+
{ expectedType }
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
return null;
|
|
567
|
+
}
|
|
568
|
+
return createChainableTypeChecker(validate);
|
|
569
|
+
}
|
|
570
|
+
function createAnyTypeChecker() {
|
|
571
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
572
|
+
}
|
|
573
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
574
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
575
|
+
if (typeof typeChecker !== "function") {
|
|
576
|
+
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
|
|
577
|
+
}
|
|
578
|
+
var propValue = props[propName];
|
|
579
|
+
if (!Array.isArray(propValue)) {
|
|
580
|
+
var propType = getPropType(propValue);
|
|
581
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
|
|
582
|
+
}
|
|
583
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
584
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
|
|
585
|
+
if (error instanceof Error) {
|
|
586
|
+
return error;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
return null;
|
|
590
|
+
}
|
|
591
|
+
return createChainableTypeChecker(validate);
|
|
592
|
+
}
|
|
593
|
+
function createElementTypeChecker() {
|
|
594
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
595
|
+
var propValue = props[propName];
|
|
596
|
+
if (!isValidElement(propValue)) {
|
|
597
|
+
var propType = getPropType(propValue);
|
|
598
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
|
|
599
|
+
}
|
|
600
|
+
return null;
|
|
601
|
+
}
|
|
602
|
+
return createChainableTypeChecker(validate);
|
|
603
|
+
}
|
|
604
|
+
function createElementTypeTypeChecker() {
|
|
605
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
606
|
+
var propValue = props[propName];
|
|
607
|
+
if (!ReactIs.isValidElementType(propValue)) {
|
|
608
|
+
var propType = getPropType(propValue);
|
|
609
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
|
|
610
|
+
}
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
return createChainableTypeChecker(validate);
|
|
614
|
+
}
|
|
615
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
616
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
617
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
618
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
619
|
+
var actualClassName = getClassName(props[propName]);
|
|
620
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
|
|
621
|
+
}
|
|
622
|
+
return null;
|
|
623
|
+
}
|
|
624
|
+
return createChainableTypeChecker(validate);
|
|
625
|
+
}
|
|
626
|
+
function createEnumTypeChecker(expectedValues) {
|
|
627
|
+
if (!Array.isArray(expectedValues)) {
|
|
628
|
+
if (process.env.NODE_ENV !== "production") {
|
|
629
|
+
if (arguments.length > 1) {
|
|
630
|
+
printWarning(
|
|
631
|
+
"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])."
|
|
632
|
+
);
|
|
633
|
+
} else {
|
|
634
|
+
printWarning("Invalid argument supplied to oneOf, expected an array.");
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return emptyFunctionThatReturnsNull;
|
|
638
|
+
}
|
|
639
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
640
|
+
var propValue = props[propName];
|
|
641
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
642
|
+
if (is(propValue, expectedValues[i])) {
|
|
643
|
+
return null;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
647
|
+
var type = getPreciseType(value);
|
|
648
|
+
if (type === "symbol") {
|
|
649
|
+
return String(value);
|
|
650
|
+
}
|
|
651
|
+
return value;
|
|
652
|
+
});
|
|
653
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
|
|
654
|
+
}
|
|
655
|
+
return createChainableTypeChecker(validate);
|
|
656
|
+
}
|
|
657
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
658
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
659
|
+
if (typeof typeChecker !== "function") {
|
|
660
|
+
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
|
|
661
|
+
}
|
|
662
|
+
var propValue = props[propName];
|
|
663
|
+
var propType = getPropType(propValue);
|
|
664
|
+
if (propType !== "object") {
|
|
665
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
|
|
666
|
+
}
|
|
667
|
+
for (var key in propValue) {
|
|
668
|
+
if (has2(propValue, key)) {
|
|
669
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
670
|
+
if (error instanceof Error) {
|
|
671
|
+
return error;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
return null;
|
|
676
|
+
}
|
|
677
|
+
return createChainableTypeChecker(validate);
|
|
678
|
+
}
|
|
679
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
680
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
681
|
+
process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
|
|
682
|
+
return emptyFunctionThatReturnsNull;
|
|
683
|
+
}
|
|
684
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
685
|
+
var checker = arrayOfTypeCheckers[i];
|
|
686
|
+
if (typeof checker !== "function") {
|
|
687
|
+
printWarning(
|
|
688
|
+
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."
|
|
689
|
+
);
|
|
690
|
+
return emptyFunctionThatReturnsNull;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
694
|
+
var expectedTypes = [];
|
|
695
|
+
for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
|
|
696
|
+
var checker2 = arrayOfTypeCheckers[i2];
|
|
697
|
+
var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
698
|
+
if (checkerResult == null) {
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
701
|
+
if (checkerResult.data && has2(checkerResult.data, "expectedType")) {
|
|
702
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
|
|
706
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
|
|
707
|
+
}
|
|
708
|
+
return createChainableTypeChecker(validate);
|
|
709
|
+
}
|
|
710
|
+
function createNodeChecker() {
|
|
711
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
712
|
+
if (!isNode(props[propName])) {
|
|
713
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
|
|
714
|
+
}
|
|
715
|
+
return null;
|
|
716
|
+
}
|
|
717
|
+
return createChainableTypeChecker(validate);
|
|
718
|
+
}
|
|
719
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
720
|
+
return new PropTypeError(
|
|
721
|
+
(componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
725
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
726
|
+
var propValue = props[propName];
|
|
727
|
+
var propType = getPropType(propValue);
|
|
728
|
+
if (propType !== "object") {
|
|
729
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
730
|
+
}
|
|
731
|
+
for (var key in shapeTypes) {
|
|
732
|
+
var checker = shapeTypes[key];
|
|
733
|
+
if (typeof checker !== "function") {
|
|
734
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
735
|
+
}
|
|
736
|
+
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
737
|
+
if (error) {
|
|
738
|
+
return error;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return null;
|
|
742
|
+
}
|
|
743
|
+
return createChainableTypeChecker(validate);
|
|
744
|
+
}
|
|
745
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
746
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
747
|
+
var propValue = props[propName];
|
|
748
|
+
var propType = getPropType(propValue);
|
|
749
|
+
if (propType !== "object") {
|
|
750
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
751
|
+
}
|
|
752
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
|
753
|
+
for (var key in allKeys) {
|
|
754
|
+
var checker = shapeTypes[key];
|
|
755
|
+
if (has2(shapeTypes, key) && typeof checker !== "function") {
|
|
756
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
757
|
+
}
|
|
758
|
+
if (!checker) {
|
|
759
|
+
return new PropTypeError(
|
|
760
|
+
"Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
|
|
761
|
+
);
|
|
762
|
+
}
|
|
763
|
+
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
764
|
+
if (error) {
|
|
765
|
+
return error;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
return null;
|
|
769
|
+
}
|
|
770
|
+
return createChainableTypeChecker(validate);
|
|
771
|
+
}
|
|
772
|
+
function isNode(propValue) {
|
|
773
|
+
switch (typeof propValue) {
|
|
774
|
+
case "number":
|
|
775
|
+
case "string":
|
|
776
|
+
case "undefined":
|
|
777
|
+
return true;
|
|
778
|
+
case "boolean":
|
|
779
|
+
return !propValue;
|
|
780
|
+
case "object":
|
|
781
|
+
if (Array.isArray(propValue)) {
|
|
782
|
+
return propValue.every(isNode);
|
|
783
|
+
}
|
|
784
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
785
|
+
return true;
|
|
786
|
+
}
|
|
787
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
788
|
+
if (iteratorFn) {
|
|
789
|
+
var iterator = iteratorFn.call(propValue);
|
|
790
|
+
var step;
|
|
791
|
+
if (iteratorFn !== propValue.entries) {
|
|
792
|
+
while (!(step = iterator.next()).done) {
|
|
793
|
+
if (!isNode(step.value)) {
|
|
794
|
+
return false;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
} else {
|
|
798
|
+
while (!(step = iterator.next()).done) {
|
|
799
|
+
var entry = step.value;
|
|
800
|
+
if (entry) {
|
|
801
|
+
if (!isNode(entry[1])) {
|
|
802
|
+
return false;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
} else {
|
|
808
|
+
return false;
|
|
809
|
+
}
|
|
810
|
+
return true;
|
|
811
|
+
default:
|
|
812
|
+
return false;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
function isSymbol(propType, propValue) {
|
|
816
|
+
if (propType === "symbol") {
|
|
817
|
+
return true;
|
|
818
|
+
}
|
|
819
|
+
if (!propValue) {
|
|
820
|
+
return false;
|
|
821
|
+
}
|
|
822
|
+
if (propValue["@@toStringTag"] === "Symbol") {
|
|
823
|
+
return true;
|
|
824
|
+
}
|
|
825
|
+
if (typeof Symbol === "function" && propValue instanceof Symbol) {
|
|
826
|
+
return true;
|
|
827
|
+
}
|
|
828
|
+
return false;
|
|
829
|
+
}
|
|
830
|
+
function getPropType(propValue) {
|
|
831
|
+
var propType = typeof propValue;
|
|
832
|
+
if (Array.isArray(propValue)) {
|
|
833
|
+
return "array";
|
|
834
|
+
}
|
|
835
|
+
if (propValue instanceof RegExp) {
|
|
836
|
+
return "object";
|
|
837
|
+
}
|
|
838
|
+
if (isSymbol(propType, propValue)) {
|
|
839
|
+
return "symbol";
|
|
840
|
+
}
|
|
841
|
+
return propType;
|
|
842
|
+
}
|
|
843
|
+
function getPreciseType(propValue) {
|
|
844
|
+
if (typeof propValue === "undefined" || propValue === null) {
|
|
845
|
+
return "" + propValue;
|
|
846
|
+
}
|
|
847
|
+
var propType = getPropType(propValue);
|
|
848
|
+
if (propType === "object") {
|
|
849
|
+
if (propValue instanceof Date) {
|
|
850
|
+
return "date";
|
|
851
|
+
} else if (propValue instanceof RegExp) {
|
|
852
|
+
return "regexp";
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
return propType;
|
|
856
|
+
}
|
|
857
|
+
function getPostfixForTypeWarning(value) {
|
|
858
|
+
var type = getPreciseType(value);
|
|
859
|
+
switch (type) {
|
|
860
|
+
case "array":
|
|
861
|
+
case "object":
|
|
862
|
+
return "an " + type;
|
|
863
|
+
case "boolean":
|
|
864
|
+
case "date":
|
|
865
|
+
case "regexp":
|
|
866
|
+
return "a " + type;
|
|
867
|
+
default:
|
|
868
|
+
return type;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
function getClassName(propValue) {
|
|
872
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
873
|
+
return ANONYMOUS;
|
|
874
|
+
}
|
|
875
|
+
return propValue.constructor.name;
|
|
876
|
+
}
|
|
877
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
878
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
879
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
880
|
+
return ReactPropTypes;
|
|
881
|
+
};
|
|
882
|
+
return factoryWithTypeCheckers;
|
|
883
|
+
}
|
|
884
|
+
var factoryWithThrowingShims;
|
|
885
|
+
var hasRequiredFactoryWithThrowingShims;
|
|
886
|
+
function requireFactoryWithThrowingShims() {
|
|
887
|
+
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
888
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
|
889
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
890
|
+
function emptyFunction() {
|
|
891
|
+
}
|
|
892
|
+
function emptyFunctionWithReset() {
|
|
893
|
+
}
|
|
894
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
895
|
+
factoryWithThrowingShims = function() {
|
|
896
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
897
|
+
if (secret === ReactPropTypesSecret) {
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
var err = new Error(
|
|
901
|
+
"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"
|
|
902
|
+
);
|
|
903
|
+
err.name = "Invariant Violation";
|
|
904
|
+
throw err;
|
|
905
|
+
}
|
|
906
|
+
shim.isRequired = shim;
|
|
907
|
+
function getShim() {
|
|
908
|
+
return shim;
|
|
909
|
+
}
|
|
910
|
+
var ReactPropTypes = {
|
|
911
|
+
array: shim,
|
|
912
|
+
bigint: shim,
|
|
913
|
+
bool: shim,
|
|
914
|
+
func: shim,
|
|
915
|
+
number: shim,
|
|
916
|
+
object: shim,
|
|
917
|
+
string: shim,
|
|
918
|
+
symbol: shim,
|
|
919
|
+
any: shim,
|
|
920
|
+
arrayOf: getShim,
|
|
921
|
+
element: shim,
|
|
922
|
+
elementType: shim,
|
|
923
|
+
instanceOf: getShim,
|
|
924
|
+
node: shim,
|
|
925
|
+
objectOf: getShim,
|
|
926
|
+
oneOf: getShim,
|
|
927
|
+
oneOfType: getShim,
|
|
928
|
+
shape: getShim,
|
|
929
|
+
exact: getShim,
|
|
930
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
931
|
+
resetWarningCache: emptyFunction
|
|
932
|
+
};
|
|
933
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
934
|
+
return ReactPropTypes;
|
|
935
|
+
};
|
|
936
|
+
return factoryWithThrowingShims;
|
|
937
|
+
}
|
|
938
|
+
if (process.env.NODE_ENV !== "production") {
|
|
939
|
+
var ReactIs = requireReactIs();
|
|
940
|
+
var throwOnDirectAccess = true;
|
|
941
|
+
propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
942
|
+
} else {
|
|
943
|
+
propTypes.exports = requireFactoryWithThrowingShims()();
|
|
944
|
+
}
|
|
945
|
+
var propTypesExports = propTypes.exports;
|
|
946
|
+
const PropTypes = /* @__PURE__ */ getDefaultExportFromCjs(propTypesExports);
|
|
947
|
+
function _interopDefault$1(ex) {
|
|
948
|
+
return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
|
|
949
|
+
}
|
|
950
|
+
var React = React__default$1.default;
|
|
951
|
+
var React__default = _interopDefault$1(React);
|
|
952
|
+
function _defineProperty(obj, key, value) {
|
|
953
|
+
if (key in obj) {
|
|
954
|
+
Object.defineProperty(obj, key, {
|
|
955
|
+
value,
|
|
956
|
+
enumerable: true,
|
|
957
|
+
configurable: true,
|
|
958
|
+
writable: true
|
|
959
|
+
});
|
|
960
|
+
} else {
|
|
961
|
+
obj[key] = value;
|
|
962
|
+
}
|
|
963
|
+
return obj;
|
|
964
|
+
}
|
|
965
|
+
function _inheritsLoose(subClass, superClass) {
|
|
966
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
967
|
+
subClass.prototype.constructor = subClass;
|
|
968
|
+
subClass.__proto__ = superClass;
|
|
969
|
+
}
|
|
970
|
+
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
971
|
+
function withSideEffect(reducePropsToState3, handleStateChangeOnClient, mapStateOnServer3) {
|
|
972
|
+
if (typeof reducePropsToState3 !== "function") {
|
|
973
|
+
throw new Error("Expected reducePropsToState to be a function.");
|
|
974
|
+
}
|
|
975
|
+
if (typeof handleStateChangeOnClient !== "function") {
|
|
976
|
+
throw new Error("Expected handleStateChangeOnClient to be a function.");
|
|
977
|
+
}
|
|
978
|
+
if (typeof mapStateOnServer3 !== "undefined" && typeof mapStateOnServer3 !== "function") {
|
|
979
|
+
throw new Error("Expected mapStateOnServer to either be undefined or a function.");
|
|
980
|
+
}
|
|
981
|
+
function getDisplayName(WrappedComponent) {
|
|
982
|
+
return WrappedComponent.displayName || WrappedComponent.name || "Component";
|
|
983
|
+
}
|
|
984
|
+
return function wrap(WrappedComponent) {
|
|
985
|
+
if (typeof WrappedComponent !== "function") {
|
|
986
|
+
throw new Error("Expected WrappedComponent to be a React component.");
|
|
987
|
+
}
|
|
988
|
+
var mountedInstances = [];
|
|
989
|
+
var state;
|
|
990
|
+
function emitChange() {
|
|
991
|
+
state = reducePropsToState3(mountedInstances.map(function(instance) {
|
|
992
|
+
return instance.props;
|
|
993
|
+
}));
|
|
994
|
+
if (SideEffect.canUseDOM) {
|
|
995
|
+
handleStateChangeOnClient(state);
|
|
996
|
+
} else if (mapStateOnServer3) {
|
|
997
|
+
state = mapStateOnServer3(state);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
var SideEffect = /* @__PURE__ */ function(_PureComponent) {
|
|
1001
|
+
_inheritsLoose(SideEffect2, _PureComponent);
|
|
1002
|
+
function SideEffect2() {
|
|
1003
|
+
return _PureComponent.apply(this, arguments) || this;
|
|
1004
|
+
}
|
|
1005
|
+
SideEffect2.peek = function peek() {
|
|
1006
|
+
return state;
|
|
1007
|
+
};
|
|
1008
|
+
SideEffect2.rewind = function rewind() {
|
|
1009
|
+
if (SideEffect2.canUseDOM) {
|
|
1010
|
+
throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");
|
|
1011
|
+
}
|
|
1012
|
+
var recordedState = state;
|
|
1013
|
+
state = void 0;
|
|
1014
|
+
mountedInstances = [];
|
|
1015
|
+
return recordedState;
|
|
1016
|
+
};
|
|
1017
|
+
var _proto = SideEffect2.prototype;
|
|
1018
|
+
_proto.UNSAFE_componentWillMount = function UNSAFE_componentWillMount() {
|
|
1019
|
+
mountedInstances.push(this);
|
|
1020
|
+
emitChange();
|
|
1021
|
+
};
|
|
1022
|
+
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
1023
|
+
emitChange();
|
|
1024
|
+
};
|
|
1025
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1026
|
+
var index = mountedInstances.indexOf(this);
|
|
1027
|
+
mountedInstances.splice(index, 1);
|
|
1028
|
+
emitChange();
|
|
1029
|
+
};
|
|
1030
|
+
_proto.render = function render() {
|
|
1031
|
+
return React__default.createElement(WrappedComponent, this.props);
|
|
1032
|
+
};
|
|
1033
|
+
return SideEffect2;
|
|
1034
|
+
}(React.PureComponent);
|
|
1035
|
+
_defineProperty(SideEffect, "displayName", "SideEffect(" + getDisplayName(WrappedComponent) + ")");
|
|
1036
|
+
_defineProperty(SideEffect, "canUseDOM", canUseDOM);
|
|
1037
|
+
return SideEffect;
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
var lib = withSideEffect;
|
|
1041
|
+
const withSideEffect$1 = /* @__PURE__ */ getDefaultExportFromCjs(lib);
|
|
1042
|
+
var hasElementType = typeof Element !== "undefined";
|
|
1043
|
+
var hasMap = typeof Map === "function";
|
|
1044
|
+
var hasSet = typeof Set === "function";
|
|
1045
|
+
var hasArrayBuffer = typeof ArrayBuffer === "function" && !!ArrayBuffer.isView;
|
|
1046
|
+
function equal(a, b) {
|
|
1047
|
+
if (a === b) return true;
|
|
1048
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
1049
|
+
if (a.constructor !== b.constructor) return false;
|
|
1050
|
+
var length, i, keys;
|
|
1051
|
+
if (Array.isArray(a)) {
|
|
1052
|
+
length = a.length;
|
|
1053
|
+
if (length != b.length) return false;
|
|
1054
|
+
for (i = length; i-- !== 0; )
|
|
1055
|
+
if (!equal(a[i], b[i])) return false;
|
|
1056
|
+
return true;
|
|
1057
|
+
}
|
|
1058
|
+
var it;
|
|
1059
|
+
if (hasMap && a instanceof Map && b instanceof Map) {
|
|
1060
|
+
if (a.size !== b.size) return false;
|
|
1061
|
+
it = a.entries();
|
|
1062
|
+
while (!(i = it.next()).done)
|
|
1063
|
+
if (!b.has(i.value[0])) return false;
|
|
1064
|
+
it = a.entries();
|
|
1065
|
+
while (!(i = it.next()).done)
|
|
1066
|
+
if (!equal(i.value[1], b.get(i.value[0]))) return false;
|
|
1067
|
+
return true;
|
|
1068
|
+
}
|
|
1069
|
+
if (hasSet && a instanceof Set && b instanceof Set) {
|
|
1070
|
+
if (a.size !== b.size) return false;
|
|
1071
|
+
it = a.entries();
|
|
1072
|
+
while (!(i = it.next()).done)
|
|
1073
|
+
if (!b.has(i.value[0])) return false;
|
|
1074
|
+
return true;
|
|
1075
|
+
}
|
|
1076
|
+
if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
1077
|
+
length = a.length;
|
|
1078
|
+
if (length != b.length) return false;
|
|
1079
|
+
for (i = length; i-- !== 0; )
|
|
1080
|
+
if (a[i] !== b[i]) return false;
|
|
1081
|
+
return true;
|
|
1082
|
+
}
|
|
1083
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
1084
|
+
if (a.valueOf !== Object.prototype.valueOf && typeof a.valueOf === "function" && typeof b.valueOf === "function") return a.valueOf() === b.valueOf();
|
|
1085
|
+
if (a.toString !== Object.prototype.toString && typeof a.toString === "function" && typeof b.toString === "function") return a.toString() === b.toString();
|
|
1086
|
+
keys = Object.keys(a);
|
|
1087
|
+
length = keys.length;
|
|
1088
|
+
if (length !== Object.keys(b).length) return false;
|
|
1089
|
+
for (i = length; i-- !== 0; )
|
|
1090
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
1091
|
+
if (hasElementType && a instanceof Element) return false;
|
|
1092
|
+
for (i = length; i-- !== 0; ) {
|
|
1093
|
+
if ((keys[i] === "_owner" || keys[i] === "__v" || keys[i] === "__o") && a.$$typeof) {
|
|
1094
|
+
continue;
|
|
1095
|
+
}
|
|
1096
|
+
if (!equal(a[keys[i]], b[keys[i]])) return false;
|
|
1097
|
+
}
|
|
1098
|
+
return true;
|
|
1099
|
+
}
|
|
1100
|
+
return a !== a && b !== b;
|
|
1101
|
+
}
|
|
1102
|
+
var reactFastCompare = function isEqual(a, b) {
|
|
1103
|
+
try {
|
|
1104
|
+
return equal(a, b);
|
|
1105
|
+
} catch (error) {
|
|
1106
|
+
if ((error.message || "").match(/stack|recursion/i)) {
|
|
1107
|
+
console.warn("react-fast-compare cannot handle circular refs");
|
|
1108
|
+
return false;
|
|
1109
|
+
}
|
|
1110
|
+
throw error;
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
const isEqual2 = /* @__PURE__ */ getDefaultExportFromCjs(reactFastCompare);
|
|
1114
|
+
var ATTRIBUTE_NAMES = {
|
|
1115
|
+
BODY: "bodyAttributes",
|
|
1116
|
+
HTML: "htmlAttributes",
|
|
1117
|
+
TITLE: "titleAttributes"
|
|
1118
|
+
};
|
|
1119
|
+
var TAG_NAMES = {
|
|
1120
|
+
BASE: "base",
|
|
1121
|
+
BODY: "body",
|
|
1122
|
+
HEAD: "head",
|
|
1123
|
+
HTML: "html",
|
|
1124
|
+
LINK: "link",
|
|
1125
|
+
META: "meta",
|
|
1126
|
+
NOSCRIPT: "noscript",
|
|
1127
|
+
SCRIPT: "script",
|
|
1128
|
+
STYLE: "style",
|
|
1129
|
+
TITLE: "title"
|
|
1130
|
+
};
|
|
1131
|
+
var VALID_TAG_NAMES = Object.keys(TAG_NAMES).map(function(name) {
|
|
1132
|
+
return TAG_NAMES[name];
|
|
1133
|
+
});
|
|
1134
|
+
var TAG_PROPERTIES = {
|
|
1135
|
+
CHARSET: "charset",
|
|
1136
|
+
CSS_TEXT: "cssText",
|
|
1137
|
+
HREF: "href",
|
|
1138
|
+
HTTPEQUIV: "http-equiv",
|
|
1139
|
+
INNER_HTML: "innerHTML",
|
|
1140
|
+
ITEM_PROP: "itemprop",
|
|
1141
|
+
NAME: "name",
|
|
1142
|
+
PROPERTY: "property",
|
|
1143
|
+
REL: "rel",
|
|
1144
|
+
SRC: "src",
|
|
1145
|
+
TARGET: "target"
|
|
1146
|
+
};
|
|
1147
|
+
var REACT_TAG_MAP = {
|
|
1148
|
+
accesskey: "accessKey",
|
|
1149
|
+
charset: "charSet",
|
|
1150
|
+
class: "className",
|
|
1151
|
+
contenteditable: "contentEditable",
|
|
1152
|
+
contextmenu: "contextMenu",
|
|
1153
|
+
"http-equiv": "httpEquiv",
|
|
1154
|
+
itemprop: "itemProp",
|
|
1155
|
+
tabindex: "tabIndex"
|
|
1156
|
+
};
|
|
1157
|
+
var HELMET_PROPS = {
|
|
1158
|
+
DEFAULT_TITLE: "defaultTitle",
|
|
1159
|
+
DEFER: "defer",
|
|
1160
|
+
ENCODE_SPECIAL_CHARACTERS: "encodeSpecialCharacters",
|
|
1161
|
+
ON_CHANGE_CLIENT_STATE: "onChangeClientState",
|
|
1162
|
+
TITLE_TEMPLATE: "titleTemplate"
|
|
1163
|
+
};
|
|
1164
|
+
var HTML_TAG_MAP = Object.keys(REACT_TAG_MAP).reduce(function(obj, key) {
|
|
1165
|
+
obj[REACT_TAG_MAP[key]] = key;
|
|
1166
|
+
return obj;
|
|
1167
|
+
}, {});
|
|
1168
|
+
var SELF_CLOSING_TAGS = [TAG_NAMES.NOSCRIPT, TAG_NAMES.SCRIPT, TAG_NAMES.STYLE];
|
|
1169
|
+
var HELMET_ATTRIBUTE = "data-react-helmet";
|
|
1170
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
|
|
1171
|
+
return typeof obj;
|
|
1172
|
+
} : function(obj) {
|
|
1173
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1174
|
+
};
|
|
1175
|
+
var classCallCheck = function(instance, Constructor) {
|
|
1176
|
+
if (!(instance instanceof Constructor)) {
|
|
1177
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
var createClass = /* @__PURE__ */ function() {
|
|
1181
|
+
function defineProperties(target, props) {
|
|
1182
|
+
for (var i = 0; i < props.length; i++) {
|
|
1183
|
+
var descriptor = props[i];
|
|
1184
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1185
|
+
descriptor.configurable = true;
|
|
1186
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1187
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return function(Constructor, protoProps, staticProps) {
|
|
1191
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1192
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1193
|
+
return Constructor;
|
|
1194
|
+
};
|
|
1195
|
+
}();
|
|
1196
|
+
var _extends = Object.assign || function(target) {
|
|
1197
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1198
|
+
var source = arguments[i];
|
|
1199
|
+
for (var key in source) {
|
|
1200
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1201
|
+
target[key] = source[key];
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
return target;
|
|
1206
|
+
};
|
|
1207
|
+
var inherits = function(subClass, superClass) {
|
|
1208
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
1209
|
+
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1210
|
+
}
|
|
1211
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1212
|
+
constructor: {
|
|
1213
|
+
value: subClass,
|
|
1214
|
+
enumerable: false,
|
|
1215
|
+
writable: true,
|
|
1216
|
+
configurable: true
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1220
|
+
};
|
|
1221
|
+
var objectWithoutProperties = function(obj, keys) {
|
|
1222
|
+
var target = {};
|
|
1223
|
+
for (var i in obj) {
|
|
1224
|
+
if (keys.indexOf(i) >= 0) continue;
|
|
1225
|
+
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
|
|
1226
|
+
target[i] = obj[i];
|
|
1227
|
+
}
|
|
1228
|
+
return target;
|
|
1229
|
+
};
|
|
1230
|
+
var possibleConstructorReturn = function(self, call) {
|
|
1231
|
+
if (!self) {
|
|
1232
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1233
|
+
}
|
|
1234
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1235
|
+
};
|
|
1236
|
+
var encodeSpecialCharacters = function encodeSpecialCharacters2(str) {
|
|
1237
|
+
var encode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
1238
|
+
if (encode === false) {
|
|
1239
|
+
return String(str);
|
|
1240
|
+
}
|
|
1241
|
+
return String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1242
|
+
};
|
|
1243
|
+
var getTitleFromPropsList = function getTitleFromPropsList2(propsList) {
|
|
1244
|
+
var innermostTitle = getInnermostProperty(propsList, TAG_NAMES.TITLE);
|
|
1245
|
+
var innermostTemplate = getInnermostProperty(propsList, HELMET_PROPS.TITLE_TEMPLATE);
|
|
1246
|
+
if (innermostTemplate && innermostTitle) {
|
|
1247
|
+
return innermostTemplate.replace(/%s/g, function() {
|
|
1248
|
+
return Array.isArray(innermostTitle) ? innermostTitle.join("") : innermostTitle;
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
var innermostDefaultTitle = getInnermostProperty(propsList, HELMET_PROPS.DEFAULT_TITLE);
|
|
1252
|
+
return innermostTitle || innermostDefaultTitle || void 0;
|
|
1253
|
+
};
|
|
1254
|
+
var getOnChangeClientState = function getOnChangeClientState2(propsList) {
|
|
1255
|
+
return getInnermostProperty(propsList, HELMET_PROPS.ON_CHANGE_CLIENT_STATE) || function() {
|
|
1256
|
+
};
|
|
1257
|
+
};
|
|
1258
|
+
var getAttributesFromPropsList = function getAttributesFromPropsList2(tagType, propsList) {
|
|
1259
|
+
return propsList.filter(function(props) {
|
|
1260
|
+
return typeof props[tagType] !== "undefined";
|
|
1261
|
+
}).map(function(props) {
|
|
1262
|
+
return props[tagType];
|
|
1263
|
+
}).reduce(function(tagAttrs, current) {
|
|
1264
|
+
return _extends({}, tagAttrs, current);
|
|
1265
|
+
}, {});
|
|
1266
|
+
};
|
|
1267
|
+
var getBaseTagFromPropsList = function getBaseTagFromPropsList2(primaryAttributes, propsList) {
|
|
1268
|
+
return propsList.filter(function(props) {
|
|
1269
|
+
return typeof props[TAG_NAMES.BASE] !== "undefined";
|
|
1270
|
+
}).map(function(props) {
|
|
1271
|
+
return props[TAG_NAMES.BASE];
|
|
1272
|
+
}).reverse().reduce(function(innermostBaseTag, tag) {
|
|
1273
|
+
if (!innermostBaseTag.length) {
|
|
1274
|
+
var keys = Object.keys(tag);
|
|
1275
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1276
|
+
var attributeKey = keys[i];
|
|
1277
|
+
var lowerCaseAttributeKey = attributeKey.toLowerCase();
|
|
1278
|
+
if (primaryAttributes.indexOf(lowerCaseAttributeKey) !== -1 && tag[lowerCaseAttributeKey]) {
|
|
1279
|
+
return innermostBaseTag.concat(tag);
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
return innermostBaseTag;
|
|
1284
|
+
}, []);
|
|
1285
|
+
};
|
|
1286
|
+
var getTagsFromPropsList = function getTagsFromPropsList2(tagName, primaryAttributes, propsList) {
|
|
1287
|
+
var approvedSeenTags = {};
|
|
1288
|
+
return propsList.filter(function(props) {
|
|
1289
|
+
if (Array.isArray(props[tagName])) {
|
|
1290
|
+
return true;
|
|
1291
|
+
}
|
|
1292
|
+
if (typeof props[tagName] !== "undefined") {
|
|
1293
|
+
warn("Helmet: " + tagName + ' should be of type "Array". Instead found type "' + _typeof(props[tagName]) + '"');
|
|
1294
|
+
}
|
|
1295
|
+
return false;
|
|
1296
|
+
}).map(function(props) {
|
|
1297
|
+
return props[tagName];
|
|
1298
|
+
}).reverse().reduce(function(approvedTags, instanceTags) {
|
|
1299
|
+
var instanceSeenTags = {};
|
|
1300
|
+
instanceTags.filter(function(tag) {
|
|
1301
|
+
var primaryAttributeKey = void 0;
|
|
1302
|
+
var keys2 = Object.keys(tag);
|
|
1303
|
+
for (var i2 = 0; i2 < keys2.length; i2++) {
|
|
1304
|
+
var attributeKey2 = keys2[i2];
|
|
1305
|
+
var lowerCaseAttributeKey = attributeKey2.toLowerCase();
|
|
1306
|
+
if (primaryAttributes.indexOf(lowerCaseAttributeKey) !== -1 && !(primaryAttributeKey === TAG_PROPERTIES.REL && tag[primaryAttributeKey].toLowerCase() === "canonical") && !(lowerCaseAttributeKey === TAG_PROPERTIES.REL && tag[lowerCaseAttributeKey].toLowerCase() === "stylesheet")) {
|
|
1307
|
+
primaryAttributeKey = lowerCaseAttributeKey;
|
|
1308
|
+
}
|
|
1309
|
+
if (primaryAttributes.indexOf(attributeKey2) !== -1 && (attributeKey2 === TAG_PROPERTIES.INNER_HTML || attributeKey2 === TAG_PROPERTIES.CSS_TEXT || attributeKey2 === TAG_PROPERTIES.ITEM_PROP)) {
|
|
1310
|
+
primaryAttributeKey = attributeKey2;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
if (!primaryAttributeKey || !tag[primaryAttributeKey]) {
|
|
1314
|
+
return false;
|
|
1315
|
+
}
|
|
1316
|
+
var value = tag[primaryAttributeKey].toLowerCase();
|
|
1317
|
+
if (!approvedSeenTags[primaryAttributeKey]) {
|
|
1318
|
+
approvedSeenTags[primaryAttributeKey] = {};
|
|
1319
|
+
}
|
|
1320
|
+
if (!instanceSeenTags[primaryAttributeKey]) {
|
|
1321
|
+
instanceSeenTags[primaryAttributeKey] = {};
|
|
1322
|
+
}
|
|
1323
|
+
if (!approvedSeenTags[primaryAttributeKey][value]) {
|
|
1324
|
+
instanceSeenTags[primaryAttributeKey][value] = true;
|
|
1325
|
+
return true;
|
|
1326
|
+
}
|
|
1327
|
+
return false;
|
|
1328
|
+
}).reverse().forEach(function(tag) {
|
|
1329
|
+
return approvedTags.push(tag);
|
|
1330
|
+
});
|
|
1331
|
+
var keys = Object.keys(instanceSeenTags);
|
|
1332
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1333
|
+
var attributeKey = keys[i];
|
|
1334
|
+
var tagUnion = objectAssign$1({}, approvedSeenTags[attributeKey], instanceSeenTags[attributeKey]);
|
|
1335
|
+
approvedSeenTags[attributeKey] = tagUnion;
|
|
1336
|
+
}
|
|
1337
|
+
return approvedTags;
|
|
1338
|
+
}, []).reverse();
|
|
1339
|
+
};
|
|
1340
|
+
var getInnermostProperty = function getInnermostProperty2(propsList, property) {
|
|
1341
|
+
for (var i = propsList.length - 1; i >= 0; i--) {
|
|
1342
|
+
var props = propsList[i];
|
|
1343
|
+
if (props.hasOwnProperty(property)) {
|
|
1344
|
+
return props[property];
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
return null;
|
|
1348
|
+
};
|
|
1349
|
+
var reducePropsToState = function reducePropsToState2(propsList) {
|
|
1350
|
+
return {
|
|
1351
|
+
baseTag: getBaseTagFromPropsList([TAG_PROPERTIES.HREF, TAG_PROPERTIES.TARGET], propsList),
|
|
1352
|
+
bodyAttributes: getAttributesFromPropsList(ATTRIBUTE_NAMES.BODY, propsList),
|
|
1353
|
+
defer: getInnermostProperty(propsList, HELMET_PROPS.DEFER),
|
|
1354
|
+
encode: getInnermostProperty(propsList, HELMET_PROPS.ENCODE_SPECIAL_CHARACTERS),
|
|
1355
|
+
htmlAttributes: getAttributesFromPropsList(ATTRIBUTE_NAMES.HTML, propsList),
|
|
1356
|
+
linkTags: getTagsFromPropsList(TAG_NAMES.LINK, [TAG_PROPERTIES.REL, TAG_PROPERTIES.HREF], propsList),
|
|
1357
|
+
metaTags: getTagsFromPropsList(TAG_NAMES.META, [TAG_PROPERTIES.NAME, TAG_PROPERTIES.CHARSET, TAG_PROPERTIES.HTTPEQUIV, TAG_PROPERTIES.PROPERTY, TAG_PROPERTIES.ITEM_PROP], propsList),
|
|
1358
|
+
noscriptTags: getTagsFromPropsList(TAG_NAMES.NOSCRIPT, [TAG_PROPERTIES.INNER_HTML], propsList),
|
|
1359
|
+
onChangeClientState: getOnChangeClientState(propsList),
|
|
1360
|
+
scriptTags: getTagsFromPropsList(TAG_NAMES.SCRIPT, [TAG_PROPERTIES.SRC, TAG_PROPERTIES.INNER_HTML], propsList),
|
|
1361
|
+
styleTags: getTagsFromPropsList(TAG_NAMES.STYLE, [TAG_PROPERTIES.CSS_TEXT], propsList),
|
|
1362
|
+
title: getTitleFromPropsList(propsList),
|
|
1363
|
+
titleAttributes: getAttributesFromPropsList(ATTRIBUTE_NAMES.TITLE, propsList)
|
|
1364
|
+
};
|
|
1365
|
+
};
|
|
1366
|
+
var rafPolyfill = function() {
|
|
1367
|
+
var clock = Date.now();
|
|
1368
|
+
return function(callback) {
|
|
1369
|
+
var currentTime = Date.now();
|
|
1370
|
+
if (currentTime - clock > 16) {
|
|
1371
|
+
clock = currentTime;
|
|
1372
|
+
callback(currentTime);
|
|
1373
|
+
} else {
|
|
1374
|
+
setTimeout(function() {
|
|
1375
|
+
rafPolyfill(callback);
|
|
1376
|
+
}, 0);
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
}();
|
|
1380
|
+
var cafPolyfill = function cafPolyfill2(id) {
|
|
1381
|
+
return clearTimeout(id);
|
|
1382
|
+
};
|
|
1383
|
+
var requestAnimationFrame = typeof window !== "undefined" ? window.requestAnimationFrame && window.requestAnimationFrame.bind(window) || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || rafPolyfill : global.requestAnimationFrame || rafPolyfill;
|
|
1384
|
+
var cancelAnimationFrame = typeof window !== "undefined" ? window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || cafPolyfill : global.cancelAnimationFrame || cafPolyfill;
|
|
1385
|
+
var warn = function warn2(msg) {
|
|
1386
|
+
return console && typeof console.warn === "function" && console.warn(msg);
|
|
1387
|
+
};
|
|
1388
|
+
var _helmetCallback = null;
|
|
1389
|
+
var handleClientStateChange = function handleClientStateChange2(newState) {
|
|
1390
|
+
if (_helmetCallback) {
|
|
1391
|
+
cancelAnimationFrame(_helmetCallback);
|
|
1392
|
+
}
|
|
1393
|
+
if (newState.defer) {
|
|
1394
|
+
_helmetCallback = requestAnimationFrame(function() {
|
|
1395
|
+
commitTagChanges(newState, function() {
|
|
1396
|
+
_helmetCallback = null;
|
|
1397
|
+
});
|
|
1398
|
+
});
|
|
1399
|
+
} else {
|
|
1400
|
+
commitTagChanges(newState);
|
|
1401
|
+
_helmetCallback = null;
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
var commitTagChanges = function commitTagChanges2(newState, cb) {
|
|
1405
|
+
var baseTag = newState.baseTag, bodyAttributes = newState.bodyAttributes, htmlAttributes = newState.htmlAttributes, linkTags = newState.linkTags, metaTags = newState.metaTags, noscriptTags = newState.noscriptTags, onChangeClientState = newState.onChangeClientState, scriptTags = newState.scriptTags, styleTags = newState.styleTags, title = newState.title, titleAttributes = newState.titleAttributes;
|
|
1406
|
+
updateAttributes(TAG_NAMES.BODY, bodyAttributes);
|
|
1407
|
+
updateAttributes(TAG_NAMES.HTML, htmlAttributes);
|
|
1408
|
+
updateTitle(title, titleAttributes);
|
|
1409
|
+
var tagUpdates = {
|
|
1410
|
+
baseTag: updateTags(TAG_NAMES.BASE, baseTag),
|
|
1411
|
+
linkTags: updateTags(TAG_NAMES.LINK, linkTags),
|
|
1412
|
+
metaTags: updateTags(TAG_NAMES.META, metaTags),
|
|
1413
|
+
noscriptTags: updateTags(TAG_NAMES.NOSCRIPT, noscriptTags),
|
|
1414
|
+
scriptTags: updateTags(TAG_NAMES.SCRIPT, scriptTags),
|
|
1415
|
+
styleTags: updateTags(TAG_NAMES.STYLE, styleTags)
|
|
1416
|
+
};
|
|
1417
|
+
var addedTags = {};
|
|
1418
|
+
var removedTags = {};
|
|
1419
|
+
Object.keys(tagUpdates).forEach(function(tagType) {
|
|
1420
|
+
var _tagUpdates$tagType = tagUpdates[tagType], newTags = _tagUpdates$tagType.newTags, oldTags = _tagUpdates$tagType.oldTags;
|
|
1421
|
+
if (newTags.length) {
|
|
1422
|
+
addedTags[tagType] = newTags;
|
|
1423
|
+
}
|
|
1424
|
+
if (oldTags.length) {
|
|
1425
|
+
removedTags[tagType] = tagUpdates[tagType].oldTags;
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
cb && cb();
|
|
1429
|
+
onChangeClientState(newState, addedTags, removedTags);
|
|
1430
|
+
};
|
|
1431
|
+
var flattenArray = function flattenArray2(possibleArray) {
|
|
1432
|
+
return Array.isArray(possibleArray) ? possibleArray.join("") : possibleArray;
|
|
1433
|
+
};
|
|
1434
|
+
var updateTitle = function updateTitle2(title, attributes) {
|
|
1435
|
+
if (typeof title !== "undefined" && document.title !== title) {
|
|
1436
|
+
document.title = flattenArray(title);
|
|
1437
|
+
}
|
|
1438
|
+
updateAttributes(TAG_NAMES.TITLE, attributes);
|
|
1439
|
+
};
|
|
1440
|
+
var updateAttributes = function updateAttributes2(tagName, attributes) {
|
|
1441
|
+
var elementTag = document.getElementsByTagName(tagName)[0];
|
|
1442
|
+
if (!elementTag) {
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
var helmetAttributeString = elementTag.getAttribute(HELMET_ATTRIBUTE);
|
|
1446
|
+
var helmetAttributes = helmetAttributeString ? helmetAttributeString.split(",") : [];
|
|
1447
|
+
var attributesToRemove = [].concat(helmetAttributes);
|
|
1448
|
+
var attributeKeys = Object.keys(attributes);
|
|
1449
|
+
for (var i = 0; i < attributeKeys.length; i++) {
|
|
1450
|
+
var attribute = attributeKeys[i];
|
|
1451
|
+
var value = attributes[attribute] || "";
|
|
1452
|
+
if (elementTag.getAttribute(attribute) !== value) {
|
|
1453
|
+
elementTag.setAttribute(attribute, value);
|
|
1454
|
+
}
|
|
1455
|
+
if (helmetAttributes.indexOf(attribute) === -1) {
|
|
1456
|
+
helmetAttributes.push(attribute);
|
|
1457
|
+
}
|
|
1458
|
+
var indexToSave = attributesToRemove.indexOf(attribute);
|
|
1459
|
+
if (indexToSave !== -1) {
|
|
1460
|
+
attributesToRemove.splice(indexToSave, 1);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
for (var _i = attributesToRemove.length - 1; _i >= 0; _i--) {
|
|
1464
|
+
elementTag.removeAttribute(attributesToRemove[_i]);
|
|
1465
|
+
}
|
|
1466
|
+
if (helmetAttributes.length === attributesToRemove.length) {
|
|
1467
|
+
elementTag.removeAttribute(HELMET_ATTRIBUTE);
|
|
1468
|
+
} else if (elementTag.getAttribute(HELMET_ATTRIBUTE) !== attributeKeys.join(",")) {
|
|
1469
|
+
elementTag.setAttribute(HELMET_ATTRIBUTE, attributeKeys.join(","));
|
|
1470
|
+
}
|
|
1471
|
+
};
|
|
1472
|
+
var updateTags = function updateTags2(type, tags) {
|
|
1473
|
+
var headElement = document.head || document.querySelector(TAG_NAMES.HEAD);
|
|
1474
|
+
var tagNodes = headElement.querySelectorAll(type + "[" + HELMET_ATTRIBUTE + "]");
|
|
1475
|
+
var oldTags = Array.prototype.slice.call(tagNodes);
|
|
1476
|
+
var newTags = [];
|
|
1477
|
+
var indexToDelete = void 0;
|
|
1478
|
+
if (tags && tags.length) {
|
|
1479
|
+
tags.forEach(function(tag) {
|
|
1480
|
+
var newElement = document.createElement(type);
|
|
1481
|
+
for (var attribute in tag) {
|
|
1482
|
+
if (tag.hasOwnProperty(attribute)) {
|
|
1483
|
+
if (attribute === TAG_PROPERTIES.INNER_HTML) {
|
|
1484
|
+
newElement.innerHTML = tag.innerHTML;
|
|
1485
|
+
} else if (attribute === TAG_PROPERTIES.CSS_TEXT) {
|
|
1486
|
+
if (newElement.styleSheet) {
|
|
1487
|
+
newElement.styleSheet.cssText = tag.cssText;
|
|
1488
|
+
} else {
|
|
1489
|
+
newElement.appendChild(document.createTextNode(tag.cssText));
|
|
1490
|
+
}
|
|
1491
|
+
} else {
|
|
1492
|
+
var value = typeof tag[attribute] === "undefined" ? "" : tag[attribute];
|
|
1493
|
+
newElement.setAttribute(attribute, value);
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
newElement.setAttribute(HELMET_ATTRIBUTE, "true");
|
|
1498
|
+
if (oldTags.some(function(existingTag, index) {
|
|
1499
|
+
indexToDelete = index;
|
|
1500
|
+
return newElement.isEqualNode(existingTag);
|
|
1501
|
+
})) {
|
|
1502
|
+
oldTags.splice(indexToDelete, 1);
|
|
1503
|
+
} else {
|
|
1504
|
+
newTags.push(newElement);
|
|
1505
|
+
}
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
oldTags.forEach(function(tag) {
|
|
1509
|
+
return tag.parentNode.removeChild(tag);
|
|
1510
|
+
});
|
|
1511
|
+
newTags.forEach(function(tag) {
|
|
1512
|
+
return headElement.appendChild(tag);
|
|
1513
|
+
});
|
|
1514
|
+
return {
|
|
1515
|
+
oldTags,
|
|
1516
|
+
newTags
|
|
1517
|
+
};
|
|
1518
|
+
};
|
|
1519
|
+
var generateElementAttributesAsString = function generateElementAttributesAsString2(attributes) {
|
|
1520
|
+
return Object.keys(attributes).reduce(function(str, key) {
|
|
1521
|
+
var attr = typeof attributes[key] !== "undefined" ? key + '="' + attributes[key] + '"' : "" + key;
|
|
1522
|
+
return str ? str + " " + attr : attr;
|
|
1523
|
+
}, "");
|
|
1524
|
+
};
|
|
1525
|
+
var generateTitleAsString = function generateTitleAsString2(type, title, attributes, encode) {
|
|
1526
|
+
var attributeString = generateElementAttributesAsString(attributes);
|
|
1527
|
+
var flattenedTitle = flattenArray(title);
|
|
1528
|
+
return attributeString ? "<" + type + " " + HELMET_ATTRIBUTE + '="true" ' + attributeString + ">" + encodeSpecialCharacters(flattenedTitle, encode) + "</" + type + ">" : "<" + type + " " + HELMET_ATTRIBUTE + '="true">' + encodeSpecialCharacters(flattenedTitle, encode) + "</" + type + ">";
|
|
1529
|
+
};
|
|
1530
|
+
var generateTagsAsString = function generateTagsAsString2(type, tags, encode) {
|
|
1531
|
+
return tags.reduce(function(str, tag) {
|
|
1532
|
+
var attributeHtml = Object.keys(tag).filter(function(attribute) {
|
|
1533
|
+
return !(attribute === TAG_PROPERTIES.INNER_HTML || attribute === TAG_PROPERTIES.CSS_TEXT);
|
|
1534
|
+
}).reduce(function(string, attribute) {
|
|
1535
|
+
var attr = typeof tag[attribute] === "undefined" ? attribute : attribute + '="' + encodeSpecialCharacters(tag[attribute], encode) + '"';
|
|
1536
|
+
return string ? string + " " + attr : attr;
|
|
1537
|
+
}, "");
|
|
1538
|
+
var tagContent = tag.innerHTML || tag.cssText || "";
|
|
1539
|
+
var isSelfClosing = SELF_CLOSING_TAGS.indexOf(type) === -1;
|
|
1540
|
+
return str + "<" + type + " " + HELMET_ATTRIBUTE + '="true" ' + attributeHtml + (isSelfClosing ? "/>" : ">" + tagContent + "</" + type + ">");
|
|
1541
|
+
}, "");
|
|
1542
|
+
};
|
|
1543
|
+
var convertElementAttributestoReactProps = function convertElementAttributestoReactProps2(attributes) {
|
|
1544
|
+
var initProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1545
|
+
return Object.keys(attributes).reduce(function(obj, key) {
|
|
1546
|
+
obj[REACT_TAG_MAP[key] || key] = attributes[key];
|
|
1547
|
+
return obj;
|
|
1548
|
+
}, initProps);
|
|
1549
|
+
};
|
|
1550
|
+
var convertReactPropstoHtmlAttributes = function convertReactPropstoHtmlAttributes2(props) {
|
|
1551
|
+
var initAttributes = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1552
|
+
return Object.keys(props).reduce(function(obj, key) {
|
|
1553
|
+
obj[HTML_TAG_MAP[key] || key] = props[key];
|
|
1554
|
+
return obj;
|
|
1555
|
+
}, initAttributes);
|
|
1556
|
+
};
|
|
1557
|
+
var generateTitleAsReactComponent = function generateTitleAsReactComponent2(type, title, attributes) {
|
|
1558
|
+
var _initProps;
|
|
1559
|
+
var initProps = (_initProps = {
|
|
1560
|
+
key: title
|
|
1561
|
+
}, _initProps[HELMET_ATTRIBUTE] = true, _initProps);
|
|
1562
|
+
var props = convertElementAttributestoReactProps(attributes, initProps);
|
|
1563
|
+
return [React__default$1.default.createElement(TAG_NAMES.TITLE, props, title)];
|
|
1564
|
+
};
|
|
1565
|
+
var generateTagsAsReactComponent = function generateTagsAsReactComponent2(type, tags) {
|
|
1566
|
+
return tags.map(function(tag, i) {
|
|
1567
|
+
var _mappedTag;
|
|
1568
|
+
var mappedTag = (_mappedTag = {
|
|
1569
|
+
key: i
|
|
1570
|
+
}, _mappedTag[HELMET_ATTRIBUTE] = true, _mappedTag);
|
|
1571
|
+
Object.keys(tag).forEach(function(attribute) {
|
|
1572
|
+
var mappedAttribute = REACT_TAG_MAP[attribute] || attribute;
|
|
1573
|
+
if (mappedAttribute === TAG_PROPERTIES.INNER_HTML || mappedAttribute === TAG_PROPERTIES.CSS_TEXT) {
|
|
1574
|
+
var content = tag.innerHTML || tag.cssText;
|
|
1575
|
+
mappedTag.dangerouslySetInnerHTML = { __html: content };
|
|
1576
|
+
} else {
|
|
1577
|
+
mappedTag[mappedAttribute] = tag[attribute];
|
|
1578
|
+
}
|
|
1579
|
+
});
|
|
1580
|
+
return React__default$1.default.createElement(type, mappedTag);
|
|
1581
|
+
});
|
|
1582
|
+
};
|
|
1583
|
+
var getMethodsForTag = function getMethodsForTag2(type, tags, encode) {
|
|
1584
|
+
switch (type) {
|
|
1585
|
+
case TAG_NAMES.TITLE:
|
|
1586
|
+
return {
|
|
1587
|
+
toComponent: function toComponent() {
|
|
1588
|
+
return generateTitleAsReactComponent(type, tags.title, tags.titleAttributes);
|
|
1589
|
+
},
|
|
1590
|
+
toString: function toString() {
|
|
1591
|
+
return generateTitleAsString(type, tags.title, tags.titleAttributes, encode);
|
|
1592
|
+
}
|
|
1593
|
+
};
|
|
1594
|
+
case ATTRIBUTE_NAMES.BODY:
|
|
1595
|
+
case ATTRIBUTE_NAMES.HTML:
|
|
1596
|
+
return {
|
|
1597
|
+
toComponent: function toComponent() {
|
|
1598
|
+
return convertElementAttributestoReactProps(tags);
|
|
1599
|
+
},
|
|
1600
|
+
toString: function toString() {
|
|
1601
|
+
return generateElementAttributesAsString(tags);
|
|
1602
|
+
}
|
|
1603
|
+
};
|
|
1604
|
+
default:
|
|
1605
|
+
return {
|
|
1606
|
+
toComponent: function toComponent() {
|
|
1607
|
+
return generateTagsAsReactComponent(type, tags);
|
|
1608
|
+
},
|
|
1609
|
+
toString: function toString() {
|
|
1610
|
+
return generateTagsAsString(type, tags, encode);
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
};
|
|
1615
|
+
var mapStateOnServer = function mapStateOnServer2(_ref) {
|
|
1616
|
+
var baseTag = _ref.baseTag, bodyAttributes = _ref.bodyAttributes, encode = _ref.encode, htmlAttributes = _ref.htmlAttributes, linkTags = _ref.linkTags, metaTags = _ref.metaTags, noscriptTags = _ref.noscriptTags, scriptTags = _ref.scriptTags, styleTags = _ref.styleTags, _ref$title = _ref.title, title = _ref$title === void 0 ? "" : _ref$title, titleAttributes = _ref.titleAttributes;
|
|
1617
|
+
return {
|
|
1618
|
+
base: getMethodsForTag(TAG_NAMES.BASE, baseTag, encode),
|
|
1619
|
+
bodyAttributes: getMethodsForTag(ATTRIBUTE_NAMES.BODY, bodyAttributes, encode),
|
|
1620
|
+
htmlAttributes: getMethodsForTag(ATTRIBUTE_NAMES.HTML, htmlAttributes, encode),
|
|
1621
|
+
link: getMethodsForTag(TAG_NAMES.LINK, linkTags, encode),
|
|
1622
|
+
meta: getMethodsForTag(TAG_NAMES.META, metaTags, encode),
|
|
1623
|
+
noscript: getMethodsForTag(TAG_NAMES.NOSCRIPT, noscriptTags, encode),
|
|
1624
|
+
script: getMethodsForTag(TAG_NAMES.SCRIPT, scriptTags, encode),
|
|
1625
|
+
style: getMethodsForTag(TAG_NAMES.STYLE, styleTags, encode),
|
|
1626
|
+
title: getMethodsForTag(TAG_NAMES.TITLE, { title, titleAttributes }, encode)
|
|
1627
|
+
};
|
|
1628
|
+
};
|
|
1629
|
+
var Helmet = function Helmet2(Component) {
|
|
1630
|
+
var _class, _temp;
|
|
1631
|
+
return _temp = _class = function(_React$Component) {
|
|
1632
|
+
inherits(HelmetWrapper, _React$Component);
|
|
1633
|
+
function HelmetWrapper() {
|
|
1634
|
+
classCallCheck(this, HelmetWrapper);
|
|
1635
|
+
return possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
|
1636
|
+
}
|
|
1637
|
+
HelmetWrapper.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
|
1638
|
+
return !isEqual2(this.props, nextProps);
|
|
1639
|
+
};
|
|
1640
|
+
HelmetWrapper.prototype.mapNestedChildrenToProps = function mapNestedChildrenToProps(child, nestedChildren) {
|
|
1641
|
+
if (!nestedChildren) {
|
|
1642
|
+
return null;
|
|
1643
|
+
}
|
|
1644
|
+
switch (child.type) {
|
|
1645
|
+
case TAG_NAMES.SCRIPT:
|
|
1646
|
+
case TAG_NAMES.NOSCRIPT:
|
|
1647
|
+
return {
|
|
1648
|
+
innerHTML: nestedChildren
|
|
1649
|
+
};
|
|
1650
|
+
case TAG_NAMES.STYLE:
|
|
1651
|
+
return {
|
|
1652
|
+
cssText: nestedChildren
|
|
1653
|
+
};
|
|
1654
|
+
}
|
|
1655
|
+
throw new Error("<" + child.type + " /> elements are self-closing and can not contain children. Refer to our API for more information.");
|
|
1656
|
+
};
|
|
1657
|
+
HelmetWrapper.prototype.flattenArrayTypeChildren = function flattenArrayTypeChildren(_ref) {
|
|
1658
|
+
var _babelHelpers$extends;
|
|
1659
|
+
var child = _ref.child, arrayTypeChildren = _ref.arrayTypeChildren, newChildProps = _ref.newChildProps, nestedChildren = _ref.nestedChildren;
|
|
1660
|
+
return _extends({}, arrayTypeChildren, (_babelHelpers$extends = {}, _babelHelpers$extends[child.type] = [].concat(arrayTypeChildren[child.type] || [], [_extends({}, newChildProps, this.mapNestedChildrenToProps(child, nestedChildren))]), _babelHelpers$extends));
|
|
1661
|
+
};
|
|
1662
|
+
HelmetWrapper.prototype.mapObjectTypeChildren = function mapObjectTypeChildren(_ref2) {
|
|
1663
|
+
var _babelHelpers$extends2, _babelHelpers$extends3;
|
|
1664
|
+
var child = _ref2.child, newProps = _ref2.newProps, newChildProps = _ref2.newChildProps, nestedChildren = _ref2.nestedChildren;
|
|
1665
|
+
switch (child.type) {
|
|
1666
|
+
case TAG_NAMES.TITLE:
|
|
1667
|
+
return _extends({}, newProps, (_babelHelpers$extends2 = {}, _babelHelpers$extends2[child.type] = nestedChildren, _babelHelpers$extends2.titleAttributes = _extends({}, newChildProps), _babelHelpers$extends2));
|
|
1668
|
+
case TAG_NAMES.BODY:
|
|
1669
|
+
return _extends({}, newProps, {
|
|
1670
|
+
bodyAttributes: _extends({}, newChildProps)
|
|
1671
|
+
});
|
|
1672
|
+
case TAG_NAMES.HTML:
|
|
1673
|
+
return _extends({}, newProps, {
|
|
1674
|
+
htmlAttributes: _extends({}, newChildProps)
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
return _extends({}, newProps, (_babelHelpers$extends3 = {}, _babelHelpers$extends3[child.type] = _extends({}, newChildProps), _babelHelpers$extends3));
|
|
1678
|
+
};
|
|
1679
|
+
HelmetWrapper.prototype.mapArrayTypeChildrenToProps = function mapArrayTypeChildrenToProps(arrayTypeChildren, newProps) {
|
|
1680
|
+
var newFlattenedProps = _extends({}, newProps);
|
|
1681
|
+
Object.keys(arrayTypeChildren).forEach(function(arrayChildName) {
|
|
1682
|
+
var _babelHelpers$extends4;
|
|
1683
|
+
newFlattenedProps = _extends({}, newFlattenedProps, (_babelHelpers$extends4 = {}, _babelHelpers$extends4[arrayChildName] = arrayTypeChildren[arrayChildName], _babelHelpers$extends4));
|
|
1684
|
+
});
|
|
1685
|
+
return newFlattenedProps;
|
|
1686
|
+
};
|
|
1687
|
+
HelmetWrapper.prototype.warnOnInvalidChildren = function warnOnInvalidChildren(child, nestedChildren) {
|
|
1688
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1689
|
+
if (!VALID_TAG_NAMES.some(function(name) {
|
|
1690
|
+
return child.type === name;
|
|
1691
|
+
})) {
|
|
1692
|
+
if (typeof child.type === "function") {
|
|
1693
|
+
return warn("You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.");
|
|
1694
|
+
}
|
|
1695
|
+
return warn("Only elements types " + VALID_TAG_NAMES.join(", ") + " are allowed. Helmet does not support rendering <" + child.type + "> elements. Refer to our API for more information.");
|
|
1696
|
+
}
|
|
1697
|
+
if (nestedChildren && typeof nestedChildren !== "string" && (!Array.isArray(nestedChildren) || nestedChildren.some(function(nestedChild) {
|
|
1698
|
+
return typeof nestedChild !== "string";
|
|
1699
|
+
}))) {
|
|
1700
|
+
throw new Error("Helmet expects a string as a child of <" + child.type + ">. Did you forget to wrap your children in braces? ( <" + child.type + ">{``}</" + child.type + "> ) Refer to our API for more information.");
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
return true;
|
|
1704
|
+
};
|
|
1705
|
+
HelmetWrapper.prototype.mapChildrenToProps = function mapChildrenToProps(children, newProps) {
|
|
1706
|
+
var _this2 = this;
|
|
1707
|
+
var arrayTypeChildren = {};
|
|
1708
|
+
React__default$1.default.Children.forEach(children, function(child) {
|
|
1709
|
+
if (!child || !child.props) {
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
var _child$props = child.props, nestedChildren = _child$props.children, childProps = objectWithoutProperties(_child$props, ["children"]);
|
|
1713
|
+
var newChildProps = convertReactPropstoHtmlAttributes(childProps);
|
|
1714
|
+
_this2.warnOnInvalidChildren(child, nestedChildren);
|
|
1715
|
+
switch (child.type) {
|
|
1716
|
+
case TAG_NAMES.LINK:
|
|
1717
|
+
case TAG_NAMES.META:
|
|
1718
|
+
case TAG_NAMES.NOSCRIPT:
|
|
1719
|
+
case TAG_NAMES.SCRIPT:
|
|
1720
|
+
case TAG_NAMES.STYLE:
|
|
1721
|
+
arrayTypeChildren = _this2.flattenArrayTypeChildren({
|
|
1722
|
+
child,
|
|
1723
|
+
arrayTypeChildren,
|
|
1724
|
+
newChildProps,
|
|
1725
|
+
nestedChildren
|
|
1726
|
+
});
|
|
1727
|
+
break;
|
|
1728
|
+
default:
|
|
1729
|
+
newProps = _this2.mapObjectTypeChildren({
|
|
1730
|
+
child,
|
|
1731
|
+
newProps,
|
|
1732
|
+
newChildProps,
|
|
1733
|
+
nestedChildren
|
|
1734
|
+
});
|
|
1735
|
+
break;
|
|
1736
|
+
}
|
|
1737
|
+
});
|
|
1738
|
+
newProps = this.mapArrayTypeChildrenToProps(arrayTypeChildren, newProps);
|
|
1739
|
+
return newProps;
|
|
1740
|
+
};
|
|
1741
|
+
HelmetWrapper.prototype.render = function render() {
|
|
1742
|
+
var _props = this.props, children = _props.children, props = objectWithoutProperties(_props, ["children"]);
|
|
1743
|
+
var newProps = _extends({}, props);
|
|
1744
|
+
if (children) {
|
|
1745
|
+
newProps = this.mapChildrenToProps(children, newProps);
|
|
1746
|
+
}
|
|
1747
|
+
return React__default$1.default.createElement(Component, newProps);
|
|
1748
|
+
};
|
|
1749
|
+
createClass(HelmetWrapper, null, [{
|
|
1750
|
+
key: "canUseDOM",
|
|
1751
|
+
// Component.peek comes from react-side-effect:
|
|
1752
|
+
// For testing, you may use a static peek() method available on the returned component.
|
|
1753
|
+
// It lets you get the current state without resetting the mounted instance stack.
|
|
1754
|
+
// Don’t use it for anything other than testing.
|
|
1755
|
+
/**
|
|
1756
|
+
* @param {Object} base: {"target": "_blank", "href": "http://mysite.com/"}
|
|
1757
|
+
* @param {Object} bodyAttributes: {"className": "root"}
|
|
1758
|
+
* @param {String} defaultTitle: "Default Title"
|
|
1759
|
+
* @param {Boolean} defer: true
|
|
1760
|
+
* @param {Boolean} encodeSpecialCharacters: true
|
|
1761
|
+
* @param {Object} htmlAttributes: {"lang": "en", "amp": undefined}
|
|
1762
|
+
* @param {Array} link: [{"rel": "canonical", "href": "http://mysite.com/example"}]
|
|
1763
|
+
* @param {Array} meta: [{"name": "description", "content": "Test description"}]
|
|
1764
|
+
* @param {Array} noscript: [{"innerHTML": "<img src='http://mysite.com/js/test.js'"}]
|
|
1765
|
+
* @param {Function} onChangeClientState: "(newState) => console.log(newState)"
|
|
1766
|
+
* @param {Array} script: [{"type": "text/javascript", "src": "http://mysite.com/js/test.js"}]
|
|
1767
|
+
* @param {Array} style: [{"type": "text/css", "cssText": "div { display: block; color: blue; }"}]
|
|
1768
|
+
* @param {String} title: "Title"
|
|
1769
|
+
* @param {Object} titleAttributes: {"itemprop": "name"}
|
|
1770
|
+
* @param {String} titleTemplate: "MySite.com - %s"
|
|
1771
|
+
*/
|
|
1772
|
+
set: function set$$1(canUseDOM2) {
|
|
1773
|
+
Component.canUseDOM = canUseDOM2;
|
|
1774
|
+
}
|
|
1775
|
+
}]);
|
|
1776
|
+
return HelmetWrapper;
|
|
1777
|
+
}(React__default$1.default.Component), _class.propTypes = {
|
|
1778
|
+
base: PropTypes.object,
|
|
1779
|
+
bodyAttributes: PropTypes.object,
|
|
1780
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
1781
|
+
defaultTitle: PropTypes.string,
|
|
1782
|
+
defer: PropTypes.bool,
|
|
1783
|
+
encodeSpecialCharacters: PropTypes.bool,
|
|
1784
|
+
htmlAttributes: PropTypes.object,
|
|
1785
|
+
link: PropTypes.arrayOf(PropTypes.object),
|
|
1786
|
+
meta: PropTypes.arrayOf(PropTypes.object),
|
|
1787
|
+
noscript: PropTypes.arrayOf(PropTypes.object),
|
|
1788
|
+
onChangeClientState: PropTypes.func,
|
|
1789
|
+
script: PropTypes.arrayOf(PropTypes.object),
|
|
1790
|
+
style: PropTypes.arrayOf(PropTypes.object),
|
|
1791
|
+
title: PropTypes.string,
|
|
1792
|
+
titleAttributes: PropTypes.object,
|
|
1793
|
+
titleTemplate: PropTypes.string
|
|
1794
|
+
}, _class.defaultProps = {
|
|
1795
|
+
defer: true,
|
|
1796
|
+
encodeSpecialCharacters: true
|
|
1797
|
+
}, _class.peek = Component.peek, _class.rewind = function() {
|
|
1798
|
+
var mappedState = Component.rewind();
|
|
1799
|
+
if (!mappedState) {
|
|
1800
|
+
mappedState = mapStateOnServer({
|
|
1801
|
+
baseTag: [],
|
|
1802
|
+
bodyAttributes: {},
|
|
1803
|
+
encodeSpecialCharacters: true,
|
|
1804
|
+
htmlAttributes: {},
|
|
1805
|
+
linkTags: [],
|
|
1806
|
+
metaTags: [],
|
|
1807
|
+
noscriptTags: [],
|
|
1808
|
+
scriptTags: [],
|
|
1809
|
+
styleTags: [],
|
|
1810
|
+
title: "",
|
|
1811
|
+
titleAttributes: {}
|
|
1812
|
+
});
|
|
1813
|
+
}
|
|
1814
|
+
return mappedState;
|
|
1815
|
+
}, _temp;
|
|
1816
|
+
};
|
|
1817
|
+
var NullComponent = function NullComponent2() {
|
|
1818
|
+
return null;
|
|
1819
|
+
};
|
|
1820
|
+
var HelmetSideEffects = withSideEffect$1(reducePropsToState, handleClientStateChange, mapStateOnServer)(NullComponent);
|
|
1821
|
+
var HelmetExport = Helmet(HelmetSideEffects);
|
|
1822
|
+
HelmetExport.renderStatic = HelmetExport.rewind;
|
|
1823
|
+
styled__default.default.div`
|
|
1824
|
+
margin: 10px 0 0 0;
|
|
1825
|
+
|
|
1826
|
+
& button {
|
|
1827
|
+
margin: 0 0 0 auto;
|
|
1828
|
+
}
|
|
1829
|
+
`;
|
|
1830
|
+
styled__default.default.p`
|
|
1831
|
+
font-size: 16px;
|
|
1832
|
+
margin: 20px 0;
|
|
1833
|
+
`;
|
|
1834
|
+
styled__default.default.div`
|
|
1835
|
+
margin-left: -250px;
|
|
1836
|
+
position: fixed;
|
|
1837
|
+
left: 50%;
|
|
1838
|
+
top: 2.875rem;
|
|
1839
|
+
z-index: 10;
|
|
1840
|
+
width: 31.25rem;
|
|
1841
|
+
`;
|
|
1842
|
+
const HomePage = () => {
|
|
1843
|
+
useIntl();
|
|
1844
|
+
const [ssoRoles, setSSORoles] = React$1.useState([]);
|
|
1845
|
+
const [roles, setRoles] = React$1.useState([]);
|
|
1846
|
+
React$1.useState(false);
|
|
1847
|
+
React$1.useState(false);
|
|
1848
|
+
React$1.useEffect(() => {
|
|
1849
|
+
const init = async () => {
|
|
1850
|
+
const ssoRoleResponse = await axios.get(`/strapi-custom-auth/custom-auth-roles`);
|
|
1851
|
+
setSSORoles(ssoRoleResponse.data);
|
|
1852
|
+
const roleResponse = await axios.get(`/admin/roles`);
|
|
1853
|
+
setRoles(roleResponse.data.data);
|
|
1854
|
+
};
|
|
1855
|
+
init();
|
|
1856
|
+
}, [setSSORoles, setRoles]);
|
|
1857
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1858
|
+
/* @__PURE__ */ jsxRuntime.jsx(HelmetExport, { title: "Strapi Custom Auth" }),
|
|
1859
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: "ciaoooo" })
|
|
1860
|
+
] });
|
|
1861
|
+
};
|
|
1862
|
+
const HomePage$1 = React$1.memo(HomePage);
|
|
1863
|
+
const App = () => {
|
|
1864
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1865
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(HomePage$1, {}) }),
|
|
1866
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Error, {}) })
|
|
1867
|
+
] });
|
|
1868
|
+
};
|
|
1869
|
+
exports.App = App;
|