willba-component-library 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/.storybook/main.ts +19 -0
  2. package/.storybook/preview.ts +15 -0
  3. package/lib/components/Button/Button.d.ts +29 -0
  4. package/lib/components/Button/Button.stories.d.ts +7 -0
  5. package/lib/index.d.ts +30 -0
  6. package/lib/index.esm.js +108 -0
  7. package/lib/index.esm.js.map +1 -0
  8. package/lib/index.js +110 -0
  9. package/lib/index.js.map +1 -0
  10. package/package.json +33 -14
  11. package/rollup.config.mjs +46 -0
  12. package/src/components/Button/Button.stories.tsx +34 -0
  13. package/src/components/Button/Button.tsx +54 -0
  14. package/src/components/Button/button.css +30 -0
  15. package/src/index.ts +3 -0
  16. package/stories/Button.stories.ts +50 -0
  17. package/stories/Button.tsx +48 -0
  18. package/stories/Configure.mdx +364 -0
  19. package/stories/Header.stories.ts +27 -0
  20. package/stories/Header.tsx +56 -0
  21. package/stories/Page.stories.ts +29 -0
  22. package/stories/Page.tsx +73 -0
  23. package/stories/assets/accessibility.png +0 -0
  24. package/stories/assets/accessibility.svg +5 -0
  25. package/stories/assets/addon-library.png +0 -0
  26. package/stories/assets/assets.png +0 -0
  27. package/stories/assets/context.png +0 -0
  28. package/stories/assets/discord.svg +15 -0
  29. package/stories/assets/docs.png +0 -0
  30. package/stories/assets/figma-plugin.png +0 -0
  31. package/stories/assets/github.svg +3 -0
  32. package/stories/assets/share.png +0 -0
  33. package/stories/assets/styling.png +0 -0
  34. package/stories/assets/testing.png +0 -0
  35. package/stories/assets/theming.png +0 -0
  36. package/stories/assets/tutorials.svg +12 -0
  37. package/stories/assets/youtube.svg +4 -0
  38. package/stories/button.css +30 -0
  39. package/stories/header.css +32 -0
  40. package/stories/page.css +69 -0
  41. package/tsconfig.json +23 -0
  42. package/dist/cjs/index.js +0 -2638
  43. package/dist/cjs/index.js.map +0 -1
  44. package/dist/cjs/types/components/Button/Button.d.ts +0 -7
  45. package/dist/cjs/types/components/FilterBar/FilterBar.d.ts +0 -2
  46. package/dist/cjs/types/components/FilterBar/index.d.ts +0 -1
  47. package/dist/cjs/types/components/index.d.ts +0 -2
  48. package/dist/cjs/types/index.d.ts +0 -1
  49. package/dist/esm/index.js +0 -2635
  50. package/dist/esm/index.js.map +0 -1
  51. package/dist/esm/types/components/Button/Button.d.ts +0 -7
  52. package/dist/esm/types/components/FilterBar/FilterBar.d.ts +0 -2
  53. package/dist/esm/types/components/FilterBar/index.d.ts +0 -1
  54. package/dist/esm/types/components/index.d.ts +0 -2
  55. package/dist/esm/types/index.d.ts +0 -1
  56. package/dist/index.d.ts +0 -10
  57. /package/{dist/cjs/types → lib}/components/Button/index.d.ts +0 -0
  58. /package/{dist/esm/types/components/Button/index.d.ts → src/components/Button/index.ts} +0 -0
package/dist/cjs/index.js DELETED
@@ -1,2638 +0,0 @@
1
- 'use strict';
2
-
3
- function getDefaultExportFromCjs (x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
- }
6
-
7
- var react = {exports: {}};
8
-
9
- var react_production_min = {};
10
-
11
- /*
12
- object-assign
13
- (c) Sindre Sorhus
14
- @license MIT
15
- */
16
-
17
- var objectAssign;
18
- var hasRequiredObjectAssign;
19
-
20
- function requireObjectAssign () {
21
- if (hasRequiredObjectAssign) return objectAssign;
22
- hasRequiredObjectAssign = 1;
23
- /* eslint-disable no-unused-vars */
24
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
25
- var hasOwnProperty = Object.prototype.hasOwnProperty;
26
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
27
-
28
- function toObject(val) {
29
- if (val === null || val === undefined) {
30
- throw new TypeError('Object.assign cannot be called with null or undefined');
31
- }
32
-
33
- return Object(val);
34
- }
35
-
36
- function shouldUseNative() {
37
- try {
38
- if (!Object.assign) {
39
- return false;
40
- }
41
-
42
- // Detect buggy property enumeration order in older V8 versions.
43
-
44
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
45
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
46
- test1[5] = 'de';
47
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
48
- return false;
49
- }
50
-
51
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
52
- var test2 = {};
53
- for (var i = 0; i < 10; i++) {
54
- test2['_' + String.fromCharCode(i)] = i;
55
- }
56
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
57
- return test2[n];
58
- });
59
- if (order2.join('') !== '0123456789') {
60
- return false;
61
- }
62
-
63
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
64
- var test3 = {};
65
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
66
- test3[letter] = letter;
67
- });
68
- if (Object.keys(Object.assign({}, test3)).join('') !==
69
- 'abcdefghijklmnopqrst') {
70
- return false;
71
- }
72
-
73
- return true;
74
- } catch (err) {
75
- // We don't expect any of the above to throw, but better to be safe.
76
- return false;
77
- }
78
- }
79
-
80
- objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
81
- var from;
82
- var to = toObject(target);
83
- var symbols;
84
-
85
- for (var s = 1; s < arguments.length; s++) {
86
- from = Object(arguments[s]);
87
-
88
- for (var key in from) {
89
- if (hasOwnProperty.call(from, key)) {
90
- to[key] = from[key];
91
- }
92
- }
93
-
94
- if (getOwnPropertySymbols) {
95
- symbols = getOwnPropertySymbols(from);
96
- for (var i = 0; i < symbols.length; i++) {
97
- if (propIsEnumerable.call(from, symbols[i])) {
98
- to[symbols[i]] = from[symbols[i]];
99
- }
100
- }
101
- }
102
- }
103
-
104
- return to;
105
- };
106
- return objectAssign;
107
- }
108
-
109
- /** @license React v17.0.2
110
- * react.production.min.js
111
- *
112
- * Copyright (c) Facebook, Inc. and its affiliates.
113
- *
114
- * This source code is licensed under the MIT license found in the
115
- * LICENSE file in the root directory of this source tree.
116
- */
117
-
118
- var hasRequiredReact_production_min;
119
-
120
- function requireReact_production_min () {
121
- if (hasRequiredReact_production_min) return react_production_min;
122
- hasRequiredReact_production_min = 1;
123
- var l=requireObjectAssign(),n=60103,p=60106;react_production_min.Fragment=60107;react_production_min.StrictMode=60108;react_production_min.Profiler=60114;var q=60109,r=60110,t=60112;react_production_min.Suspense=60113;var u=60115,v=60116;
124
- if("function"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w("react.element");p=w("react.portal");react_production_min.Fragment=w("react.fragment");react_production_min.StrictMode=w("react.strict_mode");react_production_min.Profiler=w("react.profiler");q=w("react.provider");r=w("react.context");t=w("react.forward_ref");react_production_min.Suspense=w("react.suspense");u=w("react.memo");v=w("react.lazy");}var x="function"===typeof Symbol&&Symbol.iterator;
125
- function y(a){if(null===a||"object"!==typeof a)return null;a=x&&a[x]||a["@@iterator"];return "function"===typeof a?a:null}function z(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return "Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}
126
- var A={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B={};function C(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A;}C.prototype.isReactComponent={};C.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error(z(85));this.updater.enqueueSetState(this,a,b,"setState");};C.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};
127
- function D(){}D.prototype=C.prototype;function E(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A;}var F=E.prototype=new D;F.constructor=E;l(F,C.prototype);F.isPureReactComponent=!0;var G={current:null},H=Object.prototype.hasOwnProperty,I={key:!0,ref:!0,__self:!0,__source:!0};
128
- function J(a,b,c){var e,d={},k=null,h=null;if(null!=b)for(e in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)H.call(b,e)&&!I.hasOwnProperty(e)&&(d[e]=b[e]);var g=arguments.length-2;if(1===g)d.children=c;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];d.children=f;}if(a&&a.defaultProps)for(e in g=a.defaultProps,g)void 0===d[e]&&(d[e]=g[e]);return {$$typeof:n,type:a,key:k,ref:h,props:d,_owner:G.current}}
129
- function K(a,b){return {$$typeof:n,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function L(a){return "object"===typeof a&&null!==a&&a.$$typeof===n}function escape(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var M=/\/+/g;function N(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
130
- function O(a,b,c,e,d){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case n:case p:h=!0;}}if(h)return h=a,d=d(h),a=""===e?"."+N(h,0):e,Array.isArray(d)?(c="",null!=a&&(c=a.replace(M,"$&/")+"/"),O(d,b,c,"",function(a){return a})):null!=d&&(L(d)&&(d=K(d,c+(!d.key||h&&h.key===d.key?"":(""+d.key).replace(M,"$&/")+"/")+a)),b.push(d)),1;h=0;e=""===e?".":e+":";if(Array.isArray(a))for(var g=
131
- 0;g<a.length;g++){k=a[g];var f=e+N(k,g);h+=O(k,b,c,f,d);}else if(f=y(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=e+N(k,g++),h+=O(k,b,c,f,d);else if("object"===k)throw b=""+a,Error(z(31,"[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b));return h}function P(a,b,c){if(null==a)return a;var e=[],d=0;O(a,e,"","",function(a){return b.call(c,a,d++)});return e}
132
- function Q(a){if(-1===a._status){var b=a._result;b=b();a._status=0;a._result=b;b.then(function(b){0===a._status&&(b=b.default,a._status=1,a._result=b);},function(b){0===a._status&&(a._status=2,a._result=b);});}if(1===a._status)return a._result;throw a._result;}var R={current:null};function S(){var a=R.current;if(null===a)throw Error(z(321));return a}var T={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:G,IsSomeRendererActing:{current:!1},assign:l};
133
- react_production_min.Children={map:P,forEach:function(a,b,c){P(a,function(){b.apply(this,arguments);},c);},count:function(a){var b=0;P(a,function(){b++;});return b},toArray:function(a){return P(a,function(a){return a})||[]},only:function(a){if(!L(a))throw Error(z(143));return a}};react_production_min.Component=C;react_production_min.PureComponent=E;react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T;
134
- react_production_min.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(z(267,a));var e=l({},a.props),d=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=G.current);void 0!==b.key&&(d=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)H.call(b,f)&&!I.hasOwnProperty(f)&&(e[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)e.children=c;else if(1<f){g=Array(f);for(var m=0;m<f;m++)g[m]=arguments[m+2];e.children=g;}return {$$typeof:n,type:a.type,
135
- key:d,ref:k,props:e,_owner:h}};react_production_min.createContext=function(a,b){void 0===b&&(b=null);a={$$typeof:r,_calculateChangedBits:b,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:q,_context:a};return a.Consumer=a};react_production_min.createElement=J;react_production_min.createFactory=function(a){var b=J.bind(null,a);b.type=a;return b};react_production_min.createRef=function(){return {current:null}};react_production_min.forwardRef=function(a){return {$$typeof:t,render:a}};react_production_min.isValidElement=L;
136
- react_production_min.lazy=function(a){return {$$typeof:v,_payload:{_status:-1,_result:a},_init:Q}};react_production_min.memo=function(a,b){return {$$typeof:u,type:a,compare:void 0===b?null:b}};react_production_min.useCallback=function(a,b){return S().useCallback(a,b)};react_production_min.useContext=function(a,b){return S().useContext(a,b)};react_production_min.useDebugValue=function(){};react_production_min.useEffect=function(a,b){return S().useEffect(a,b)};react_production_min.useImperativeHandle=function(a,b,c){return S().useImperativeHandle(a,b,c)};
137
- react_production_min.useLayoutEffect=function(a,b){return S().useLayoutEffect(a,b)};react_production_min.useMemo=function(a,b){return S().useMemo(a,b)};react_production_min.useReducer=function(a,b,c){return S().useReducer(a,b,c)};react_production_min.useRef=function(a){return S().useRef(a)};react_production_min.useState=function(a){return S().useState(a)};react_production_min.version="17.0.2";
138
- return react_production_min;
139
- }
140
-
141
- var react_development = {};
142
-
143
- /** @license React v17.0.2
144
- * react.development.js
145
- *
146
- * Copyright (c) Facebook, Inc. and its affiliates.
147
- *
148
- * This source code is licensed under the MIT license found in the
149
- * LICENSE file in the root directory of this source tree.
150
- */
151
-
152
- var hasRequiredReact_development;
153
-
154
- function requireReact_development () {
155
- if (hasRequiredReact_development) return react_development;
156
- hasRequiredReact_development = 1;
157
- (function (exports) {
158
-
159
- if (process.env.NODE_ENV !== "production") {
160
- (function() {
161
-
162
- var _assign = requireObjectAssign();
163
-
164
- // TODO: this is special because it gets imported during build.
165
- var ReactVersion = '17.0.2';
166
-
167
- // ATTENTION
168
- // When adding new symbols to this file,
169
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
170
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
171
- // nor polyfill, then a plain number is used for performance.
172
- var REACT_ELEMENT_TYPE = 0xeac7;
173
- var REACT_PORTAL_TYPE = 0xeaca;
174
- exports.Fragment = 0xeacb;
175
- exports.StrictMode = 0xeacc;
176
- exports.Profiler = 0xead2;
177
- var REACT_PROVIDER_TYPE = 0xeacd;
178
- var REACT_CONTEXT_TYPE = 0xeace;
179
- var REACT_FORWARD_REF_TYPE = 0xead0;
180
- exports.Suspense = 0xead1;
181
- var REACT_SUSPENSE_LIST_TYPE = 0xead8;
182
- var REACT_MEMO_TYPE = 0xead3;
183
- var REACT_LAZY_TYPE = 0xead4;
184
- var REACT_BLOCK_TYPE = 0xead9;
185
- var REACT_SERVER_BLOCK_TYPE = 0xeada;
186
- var REACT_FUNDAMENTAL_TYPE = 0xead5;
187
- var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
188
- var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
189
-
190
- if (typeof Symbol === 'function' && Symbol.for) {
191
- var symbolFor = Symbol.for;
192
- REACT_ELEMENT_TYPE = symbolFor('react.element');
193
- REACT_PORTAL_TYPE = symbolFor('react.portal');
194
- exports.Fragment = symbolFor('react.fragment');
195
- exports.StrictMode = symbolFor('react.strict_mode');
196
- exports.Profiler = symbolFor('react.profiler');
197
- REACT_PROVIDER_TYPE = symbolFor('react.provider');
198
- REACT_CONTEXT_TYPE = symbolFor('react.context');
199
- REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
200
- exports.Suspense = symbolFor('react.suspense');
201
- REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
202
- REACT_MEMO_TYPE = symbolFor('react.memo');
203
- REACT_LAZY_TYPE = symbolFor('react.lazy');
204
- REACT_BLOCK_TYPE = symbolFor('react.block');
205
- REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
206
- REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
207
- symbolFor('react.scope');
208
- symbolFor('react.opaque.id');
209
- REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
210
- symbolFor('react.offscreen');
211
- REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
212
- }
213
-
214
- var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
215
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
216
- function getIteratorFn(maybeIterable) {
217
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
218
- return null;
219
- }
220
-
221
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
222
-
223
- if (typeof maybeIterator === 'function') {
224
- return maybeIterator;
225
- }
226
-
227
- return null;
228
- }
229
-
230
- /**
231
- * Keeps track of the current dispatcher.
232
- */
233
- var ReactCurrentDispatcher = {
234
- /**
235
- * @internal
236
- * @type {ReactComponent}
237
- */
238
- current: null
239
- };
240
-
241
- /**
242
- * Keeps track of the current batch's configuration such as how long an update
243
- * should suspend for if it needs to.
244
- */
245
- var ReactCurrentBatchConfig = {
246
- transition: 0
247
- };
248
-
249
- /**
250
- * Keeps track of the current owner.
251
- *
252
- * The current owner is the component who should own any components that are
253
- * currently being constructed.
254
- */
255
- var ReactCurrentOwner = {
256
- /**
257
- * @internal
258
- * @type {ReactComponent}
259
- */
260
- current: null
261
- };
262
-
263
- var ReactDebugCurrentFrame = {};
264
- var currentExtraStackFrame = null;
265
- function setExtraStackFrame(stack) {
266
- {
267
- currentExtraStackFrame = stack;
268
- }
269
- }
270
-
271
- {
272
- ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
273
- {
274
- currentExtraStackFrame = stack;
275
- }
276
- }; // Stack implementation injected by the current renderer.
277
-
278
-
279
- ReactDebugCurrentFrame.getCurrentStack = null;
280
-
281
- ReactDebugCurrentFrame.getStackAddendum = function () {
282
- var stack = ''; // Add an extra top frame while an element is being validated
283
-
284
- if (currentExtraStackFrame) {
285
- stack += currentExtraStackFrame;
286
- } // Delegate to the injected renderer-specific implementation
287
-
288
-
289
- var impl = ReactDebugCurrentFrame.getCurrentStack;
290
-
291
- if (impl) {
292
- stack += impl() || '';
293
- }
294
-
295
- return stack;
296
- };
297
- }
298
-
299
- /**
300
- * Used by act() to track whether you're inside an act() scope.
301
- */
302
- var IsSomeRendererActing = {
303
- current: false
304
- };
305
-
306
- var ReactSharedInternals = {
307
- ReactCurrentDispatcher: ReactCurrentDispatcher,
308
- ReactCurrentBatchConfig: ReactCurrentBatchConfig,
309
- ReactCurrentOwner: ReactCurrentOwner,
310
- IsSomeRendererActing: IsSomeRendererActing,
311
- // Used by renderers to avoid bundling object-assign twice in UMD bundles:
312
- assign: _assign
313
- };
314
-
315
- {
316
- ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
317
- }
318
-
319
- // by calls to these methods by a Babel plugin.
320
- //
321
- // In PROD (or in packages without access to React internals),
322
- // they are left as they are instead.
323
-
324
- function warn(format) {
325
- {
326
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
327
- args[_key - 1] = arguments[_key];
328
- }
329
-
330
- printWarning('warn', format, args);
331
- }
332
- }
333
- function error(format) {
334
- {
335
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
336
- args[_key2 - 1] = arguments[_key2];
337
- }
338
-
339
- printWarning('error', format, args);
340
- }
341
- }
342
-
343
- function printWarning(level, format, args) {
344
- // When changing this logic, you might want to also
345
- // update consoleWithStackDev.www.js as well.
346
- {
347
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
348
- var stack = ReactDebugCurrentFrame.getStackAddendum();
349
-
350
- if (stack !== '') {
351
- format += '%s';
352
- args = args.concat([stack]);
353
- }
354
-
355
- var argsWithFormat = args.map(function (item) {
356
- return '' + item;
357
- }); // Careful: RN currently depends on this prefix
358
-
359
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
360
- // breaks IE9: https://github.com/facebook/react/issues/13610
361
- // eslint-disable-next-line react-internal/no-production-logging
362
-
363
- Function.prototype.apply.call(console[level], console, argsWithFormat);
364
- }
365
- }
366
-
367
- var didWarnStateUpdateForUnmountedComponent = {};
368
-
369
- function warnNoop(publicInstance, callerName) {
370
- {
371
- var _constructor = publicInstance.constructor;
372
- var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
373
- var warningKey = componentName + "." + callerName;
374
-
375
- if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
376
- return;
377
- }
378
-
379
- error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
380
-
381
- didWarnStateUpdateForUnmountedComponent[warningKey] = true;
382
- }
383
- }
384
- /**
385
- * This is the abstract API for an update queue.
386
- */
387
-
388
-
389
- var ReactNoopUpdateQueue = {
390
- /**
391
- * Checks whether or not this composite component is mounted.
392
- * @param {ReactClass} publicInstance The instance we want to test.
393
- * @return {boolean} True if mounted, false otherwise.
394
- * @protected
395
- * @final
396
- */
397
- isMounted: function (publicInstance) {
398
- return false;
399
- },
400
-
401
- /**
402
- * Forces an update. This should only be invoked when it is known with
403
- * certainty that we are **not** in a DOM transaction.
404
- *
405
- * You may want to call this when you know that some deeper aspect of the
406
- * component's state has changed but `setState` was not called.
407
- *
408
- * This will not invoke `shouldComponentUpdate`, but it will invoke
409
- * `componentWillUpdate` and `componentDidUpdate`.
410
- *
411
- * @param {ReactClass} publicInstance The instance that should rerender.
412
- * @param {?function} callback Called after component is updated.
413
- * @param {?string} callerName name of the calling function in the public API.
414
- * @internal
415
- */
416
- enqueueForceUpdate: function (publicInstance, callback, callerName) {
417
- warnNoop(publicInstance, 'forceUpdate');
418
- },
419
-
420
- /**
421
- * Replaces all of the state. Always use this or `setState` to mutate state.
422
- * You should treat `this.state` as immutable.
423
- *
424
- * There is no guarantee that `this.state` will be immediately updated, so
425
- * accessing `this.state` after calling this method may return the old value.
426
- *
427
- * @param {ReactClass} publicInstance The instance that should rerender.
428
- * @param {object} completeState Next state.
429
- * @param {?function} callback Called after component is updated.
430
- * @param {?string} callerName name of the calling function in the public API.
431
- * @internal
432
- */
433
- enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
434
- warnNoop(publicInstance, 'replaceState');
435
- },
436
-
437
- /**
438
- * Sets a subset of the state. This only exists because _pendingState is
439
- * internal. This provides a merging strategy that is not available to deep
440
- * properties which is confusing. TODO: Expose pendingState or don't use it
441
- * during the merge.
442
- *
443
- * @param {ReactClass} publicInstance The instance that should rerender.
444
- * @param {object} partialState Next partial state to be merged with state.
445
- * @param {?function} callback Called after component is updated.
446
- * @param {?string} Name of the calling function in the public API.
447
- * @internal
448
- */
449
- enqueueSetState: function (publicInstance, partialState, callback, callerName) {
450
- warnNoop(publicInstance, 'setState');
451
- }
452
- };
453
-
454
- var emptyObject = {};
455
-
456
- {
457
- Object.freeze(emptyObject);
458
- }
459
- /**
460
- * Base class helpers for the updating state of a component.
461
- */
462
-
463
-
464
- function Component(props, context, updater) {
465
- this.props = props;
466
- this.context = context; // If a component has string refs, we will assign a different object later.
467
-
468
- this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
469
- // renderer.
470
-
471
- this.updater = updater || ReactNoopUpdateQueue;
472
- }
473
-
474
- Component.prototype.isReactComponent = {};
475
- /**
476
- * Sets a subset of the state. Always use this to mutate
477
- * state. You should treat `this.state` as immutable.
478
- *
479
- * There is no guarantee that `this.state` will be immediately updated, so
480
- * accessing `this.state` after calling this method may return the old value.
481
- *
482
- * There is no guarantee that calls to `setState` will run synchronously,
483
- * as they may eventually be batched together. You can provide an optional
484
- * callback that will be executed when the call to setState is actually
485
- * completed.
486
- *
487
- * When a function is provided to setState, it will be called at some point in
488
- * the future (not synchronously). It will be called with the up to date
489
- * component arguments (state, props, context). These values can be different
490
- * from this.* because your function may be called after receiveProps but before
491
- * shouldComponentUpdate, and this new state, props, and context will not yet be
492
- * assigned to this.
493
- *
494
- * @param {object|function} partialState Next partial state or function to
495
- * produce next partial state to be merged with current state.
496
- * @param {?function} callback Called after state is updated.
497
- * @final
498
- * @protected
499
- */
500
-
501
- Component.prototype.setState = function (partialState, callback) {
502
- if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
503
- {
504
- throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
505
- }
506
- }
507
-
508
- this.updater.enqueueSetState(this, partialState, callback, 'setState');
509
- };
510
- /**
511
- * Forces an update. This should only be invoked when it is known with
512
- * certainty that we are **not** in a DOM transaction.
513
- *
514
- * You may want to call this when you know that some deeper aspect of the
515
- * component's state has changed but `setState` was not called.
516
- *
517
- * This will not invoke `shouldComponentUpdate`, but it will invoke
518
- * `componentWillUpdate` and `componentDidUpdate`.
519
- *
520
- * @param {?function} callback Called after update is complete.
521
- * @final
522
- * @protected
523
- */
524
-
525
-
526
- Component.prototype.forceUpdate = function (callback) {
527
- this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
528
- };
529
- /**
530
- * Deprecated APIs. These APIs used to exist on classic React classes but since
531
- * we would like to deprecate them, we're not going to move them over to this
532
- * modern base class. Instead, we define a getter that warns if it's accessed.
533
- */
534
-
535
-
536
- {
537
- var deprecatedAPIs = {
538
- isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
539
- replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
540
- };
541
-
542
- var defineDeprecationWarning = function (methodName, info) {
543
- Object.defineProperty(Component.prototype, methodName, {
544
- get: function () {
545
- warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
546
-
547
- return undefined;
548
- }
549
- });
550
- };
551
-
552
- for (var fnName in deprecatedAPIs) {
553
- if (deprecatedAPIs.hasOwnProperty(fnName)) {
554
- defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
555
- }
556
- }
557
- }
558
-
559
- function ComponentDummy() {}
560
-
561
- ComponentDummy.prototype = Component.prototype;
562
- /**
563
- * Convenience component with default shallow equality check for sCU.
564
- */
565
-
566
- function PureComponent(props, context, updater) {
567
- this.props = props;
568
- this.context = context; // If a component has string refs, we will assign a different object later.
569
-
570
- this.refs = emptyObject;
571
- this.updater = updater || ReactNoopUpdateQueue;
572
- }
573
-
574
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
575
- pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
576
-
577
- _assign(pureComponentPrototype, Component.prototype);
578
-
579
- pureComponentPrototype.isPureReactComponent = true;
580
-
581
- // an immutable object with a single mutable value
582
- function createRef() {
583
- var refObject = {
584
- current: null
585
- };
586
-
587
- {
588
- Object.seal(refObject);
589
- }
590
-
591
- return refObject;
592
- }
593
-
594
- function getWrappedName(outerType, innerType, wrapperName) {
595
- var functionName = innerType.displayName || innerType.name || '';
596
- return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
597
- }
598
-
599
- function getContextName(type) {
600
- return type.displayName || 'Context';
601
- }
602
-
603
- function getComponentName(type) {
604
- if (type == null) {
605
- // Host root, text node or just invalid type.
606
- return null;
607
- }
608
-
609
- {
610
- if (typeof type.tag === 'number') {
611
- error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
612
- }
613
- }
614
-
615
- if (typeof type === 'function') {
616
- return type.displayName || type.name || null;
617
- }
618
-
619
- if (typeof type === 'string') {
620
- return type;
621
- }
622
-
623
- switch (type) {
624
- case exports.Fragment:
625
- return 'Fragment';
626
-
627
- case REACT_PORTAL_TYPE:
628
- return 'Portal';
629
-
630
- case exports.Profiler:
631
- return 'Profiler';
632
-
633
- case exports.StrictMode:
634
- return 'StrictMode';
635
-
636
- case exports.Suspense:
637
- return 'Suspense';
638
-
639
- case REACT_SUSPENSE_LIST_TYPE:
640
- return 'SuspenseList';
641
- }
642
-
643
- if (typeof type === 'object') {
644
- switch (type.$$typeof) {
645
- case REACT_CONTEXT_TYPE:
646
- var context = type;
647
- return getContextName(context) + '.Consumer';
648
-
649
- case REACT_PROVIDER_TYPE:
650
- var provider = type;
651
- return getContextName(provider._context) + '.Provider';
652
-
653
- case REACT_FORWARD_REF_TYPE:
654
- return getWrappedName(type, type.render, 'ForwardRef');
655
-
656
- case REACT_MEMO_TYPE:
657
- return getComponentName(type.type);
658
-
659
- case REACT_BLOCK_TYPE:
660
- return getComponentName(type._render);
661
-
662
- case REACT_LAZY_TYPE:
663
- {
664
- var lazyComponent = type;
665
- var payload = lazyComponent._payload;
666
- var init = lazyComponent._init;
667
-
668
- try {
669
- return getComponentName(init(payload));
670
- } catch (x) {
671
- return null;
672
- }
673
- }
674
- }
675
- }
676
-
677
- return null;
678
- }
679
-
680
- var hasOwnProperty = Object.prototype.hasOwnProperty;
681
- var RESERVED_PROPS = {
682
- key: true,
683
- ref: true,
684
- __self: true,
685
- __source: true
686
- };
687
- var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
688
-
689
- {
690
- didWarnAboutStringRefs = {};
691
- }
692
-
693
- function hasValidRef(config) {
694
- {
695
- if (hasOwnProperty.call(config, 'ref')) {
696
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
697
-
698
- if (getter && getter.isReactWarning) {
699
- return false;
700
- }
701
- }
702
- }
703
-
704
- return config.ref !== undefined;
705
- }
706
-
707
- function hasValidKey(config) {
708
- {
709
- if (hasOwnProperty.call(config, 'key')) {
710
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
711
-
712
- if (getter && getter.isReactWarning) {
713
- return false;
714
- }
715
- }
716
- }
717
-
718
- return config.key !== undefined;
719
- }
720
-
721
- function defineKeyPropWarningGetter(props, displayName) {
722
- var warnAboutAccessingKey = function () {
723
- {
724
- if (!specialPropKeyWarningShown) {
725
- specialPropKeyWarningShown = true;
726
-
727
- error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
728
- }
729
- }
730
- };
731
-
732
- warnAboutAccessingKey.isReactWarning = true;
733
- Object.defineProperty(props, 'key', {
734
- get: warnAboutAccessingKey,
735
- configurable: true
736
- });
737
- }
738
-
739
- function defineRefPropWarningGetter(props, displayName) {
740
- var warnAboutAccessingRef = function () {
741
- {
742
- if (!specialPropRefWarningShown) {
743
- specialPropRefWarningShown = true;
744
-
745
- error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
746
- }
747
- }
748
- };
749
-
750
- warnAboutAccessingRef.isReactWarning = true;
751
- Object.defineProperty(props, 'ref', {
752
- get: warnAboutAccessingRef,
753
- configurable: true
754
- });
755
- }
756
-
757
- function warnIfStringRefCannotBeAutoConverted(config) {
758
- {
759
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
760
- var componentName = getComponentName(ReactCurrentOwner.current.type);
761
-
762
- if (!didWarnAboutStringRefs[componentName]) {
763
- error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
764
-
765
- didWarnAboutStringRefs[componentName] = true;
766
- }
767
- }
768
- }
769
- }
770
- /**
771
- * Factory method to create a new React element. This no longer adheres to
772
- * the class pattern, so do not use new to call it. Also, instanceof check
773
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
774
- * if something is a React Element.
775
- *
776
- * @param {*} type
777
- * @param {*} props
778
- * @param {*} key
779
- * @param {string|object} ref
780
- * @param {*} owner
781
- * @param {*} self A *temporary* helper to detect places where `this` is
782
- * different from the `owner` when React.createElement is called, so that we
783
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
784
- * functions, and as long as `this` and owner are the same, there will be no
785
- * change in behavior.
786
- * @param {*} source An annotation object (added by a transpiler or otherwise)
787
- * indicating filename, line number, and/or other information.
788
- * @internal
789
- */
790
-
791
-
792
- var ReactElement = function (type, key, ref, self, source, owner, props) {
793
- var element = {
794
- // This tag allows us to uniquely identify this as a React Element
795
- $$typeof: REACT_ELEMENT_TYPE,
796
- // Built-in properties that belong on the element
797
- type: type,
798
- key: key,
799
- ref: ref,
800
- props: props,
801
- // Record the component responsible for creating this element.
802
- _owner: owner
803
- };
804
-
805
- {
806
- // The validation flag is currently mutative. We put it on
807
- // an external backing store so that we can freeze the whole object.
808
- // This can be replaced with a WeakMap once they are implemented in
809
- // commonly used development environments.
810
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
811
- // the validation flag non-enumerable (where possible, which should
812
- // include every environment we run tests in), so the test framework
813
- // ignores it.
814
-
815
- Object.defineProperty(element._store, 'validated', {
816
- configurable: false,
817
- enumerable: false,
818
- writable: true,
819
- value: false
820
- }); // self and source are DEV only properties.
821
-
822
- Object.defineProperty(element, '_self', {
823
- configurable: false,
824
- enumerable: false,
825
- writable: false,
826
- value: self
827
- }); // Two elements created in two different places should be considered
828
- // equal for testing purposes and therefore we hide it from enumeration.
829
-
830
- Object.defineProperty(element, '_source', {
831
- configurable: false,
832
- enumerable: false,
833
- writable: false,
834
- value: source
835
- });
836
-
837
- if (Object.freeze) {
838
- Object.freeze(element.props);
839
- Object.freeze(element);
840
- }
841
- }
842
-
843
- return element;
844
- };
845
- /**
846
- * Create and return a new ReactElement of the given type.
847
- * See https://reactjs.org/docs/react-api.html#createelement
848
- */
849
-
850
- function createElement(type, config, children) {
851
- var propName; // Reserved names are extracted
852
-
853
- var props = {};
854
- var key = null;
855
- var ref = null;
856
- var self = null;
857
- var source = null;
858
-
859
- if (config != null) {
860
- if (hasValidRef(config)) {
861
- ref = config.ref;
862
-
863
- {
864
- warnIfStringRefCannotBeAutoConverted(config);
865
- }
866
- }
867
-
868
- if (hasValidKey(config)) {
869
- key = '' + config.key;
870
- }
871
-
872
- self = config.__self === undefined ? null : config.__self;
873
- source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
874
-
875
- for (propName in config) {
876
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
877
- props[propName] = config[propName];
878
- }
879
- }
880
- } // Children can be more than one argument, and those are transferred onto
881
- // the newly allocated props object.
882
-
883
-
884
- var childrenLength = arguments.length - 2;
885
-
886
- if (childrenLength === 1) {
887
- props.children = children;
888
- } else if (childrenLength > 1) {
889
- var childArray = Array(childrenLength);
890
-
891
- for (var i = 0; i < childrenLength; i++) {
892
- childArray[i] = arguments[i + 2];
893
- }
894
-
895
- {
896
- if (Object.freeze) {
897
- Object.freeze(childArray);
898
- }
899
- }
900
-
901
- props.children = childArray;
902
- } // Resolve default props
903
-
904
-
905
- if (type && type.defaultProps) {
906
- var defaultProps = type.defaultProps;
907
-
908
- for (propName in defaultProps) {
909
- if (props[propName] === undefined) {
910
- props[propName] = defaultProps[propName];
911
- }
912
- }
913
- }
914
-
915
- {
916
- if (key || ref) {
917
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
918
-
919
- if (key) {
920
- defineKeyPropWarningGetter(props, displayName);
921
- }
922
-
923
- if (ref) {
924
- defineRefPropWarningGetter(props, displayName);
925
- }
926
- }
927
- }
928
-
929
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
930
- }
931
- function cloneAndReplaceKey(oldElement, newKey) {
932
- var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
933
- return newElement;
934
- }
935
- /**
936
- * Clone and return a new ReactElement using element as the starting point.
937
- * See https://reactjs.org/docs/react-api.html#cloneelement
938
- */
939
-
940
- function cloneElement(element, config, children) {
941
- if (!!(element === null || element === undefined)) {
942
- {
943
- throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
944
- }
945
- }
946
-
947
- var propName; // Original props are copied
948
-
949
- var props = _assign({}, element.props); // Reserved names are extracted
950
-
951
-
952
- var key = element.key;
953
- var ref = element.ref; // Self is preserved since the owner is preserved.
954
-
955
- var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
956
- // transpiler, and the original source is probably a better indicator of the
957
- // true owner.
958
-
959
- var source = element._source; // Owner will be preserved, unless ref is overridden
960
-
961
- var owner = element._owner;
962
-
963
- if (config != null) {
964
- if (hasValidRef(config)) {
965
- // Silently steal the ref from the parent.
966
- ref = config.ref;
967
- owner = ReactCurrentOwner.current;
968
- }
969
-
970
- if (hasValidKey(config)) {
971
- key = '' + config.key;
972
- } // Remaining properties override existing props
973
-
974
-
975
- var defaultProps;
976
-
977
- if (element.type && element.type.defaultProps) {
978
- defaultProps = element.type.defaultProps;
979
- }
980
-
981
- for (propName in config) {
982
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
983
- if (config[propName] === undefined && defaultProps !== undefined) {
984
- // Resolve default props
985
- props[propName] = defaultProps[propName];
986
- } else {
987
- props[propName] = config[propName];
988
- }
989
- }
990
- }
991
- } // Children can be more than one argument, and those are transferred onto
992
- // the newly allocated props object.
993
-
994
-
995
- var childrenLength = arguments.length - 2;
996
-
997
- if (childrenLength === 1) {
998
- props.children = children;
999
- } else if (childrenLength > 1) {
1000
- var childArray = Array(childrenLength);
1001
-
1002
- for (var i = 0; i < childrenLength; i++) {
1003
- childArray[i] = arguments[i + 2];
1004
- }
1005
-
1006
- props.children = childArray;
1007
- }
1008
-
1009
- return ReactElement(element.type, key, ref, self, source, owner, props);
1010
- }
1011
- /**
1012
- * Verifies the object is a ReactElement.
1013
- * See https://reactjs.org/docs/react-api.html#isvalidelement
1014
- * @param {?object} object
1015
- * @return {boolean} True if `object` is a ReactElement.
1016
- * @final
1017
- */
1018
-
1019
- function isValidElement(object) {
1020
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1021
- }
1022
-
1023
- var SEPARATOR = '.';
1024
- var SUBSEPARATOR = ':';
1025
- /**
1026
- * Escape and wrap key so it is safe to use as a reactid
1027
- *
1028
- * @param {string} key to be escaped.
1029
- * @return {string} the escaped key.
1030
- */
1031
-
1032
- function escape(key) {
1033
- var escapeRegex = /[=:]/g;
1034
- var escaperLookup = {
1035
- '=': '=0',
1036
- ':': '=2'
1037
- };
1038
- var escapedString = key.replace(escapeRegex, function (match) {
1039
- return escaperLookup[match];
1040
- });
1041
- return '$' + escapedString;
1042
- }
1043
- /**
1044
- * TODO: Test that a single child and an array with one item have the same key
1045
- * pattern.
1046
- */
1047
-
1048
-
1049
- var didWarnAboutMaps = false;
1050
- var userProvidedKeyEscapeRegex = /\/+/g;
1051
-
1052
- function escapeUserProvidedKey(text) {
1053
- return text.replace(userProvidedKeyEscapeRegex, '$&/');
1054
- }
1055
- /**
1056
- * Generate a key string that identifies a element within a set.
1057
- *
1058
- * @param {*} element A element that could contain a manual key.
1059
- * @param {number} index Index that is used if a manual key is not provided.
1060
- * @return {string}
1061
- */
1062
-
1063
-
1064
- function getElementKey(element, index) {
1065
- // Do some typechecking here since we call this blindly. We want to ensure
1066
- // that we don't block potential future ES APIs.
1067
- if (typeof element === 'object' && element !== null && element.key != null) {
1068
- // Explicit key
1069
- return escape('' + element.key);
1070
- } // Implicit key determined by the index in the set
1071
-
1072
-
1073
- return index.toString(36);
1074
- }
1075
-
1076
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
1077
- var type = typeof children;
1078
-
1079
- if (type === 'undefined' || type === 'boolean') {
1080
- // All of the above are perceived as null.
1081
- children = null;
1082
- }
1083
-
1084
- var invokeCallback = false;
1085
-
1086
- if (children === null) {
1087
- invokeCallback = true;
1088
- } else {
1089
- switch (type) {
1090
- case 'string':
1091
- case 'number':
1092
- invokeCallback = true;
1093
- break;
1094
-
1095
- case 'object':
1096
- switch (children.$$typeof) {
1097
- case REACT_ELEMENT_TYPE:
1098
- case REACT_PORTAL_TYPE:
1099
- invokeCallback = true;
1100
- }
1101
-
1102
- }
1103
- }
1104
-
1105
- if (invokeCallback) {
1106
- var _child = children;
1107
- var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
1108
- // so that it's consistent if the number of children grows:
1109
-
1110
- var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
1111
-
1112
- if (Array.isArray(mappedChild)) {
1113
- var escapedChildKey = '';
1114
-
1115
- if (childKey != null) {
1116
- escapedChildKey = escapeUserProvidedKey(childKey) + '/';
1117
- }
1118
-
1119
- mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
1120
- return c;
1121
- });
1122
- } else if (mappedChild != null) {
1123
- if (isValidElement(mappedChild)) {
1124
- mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
1125
- // traverseAllChildren used to do for objects as children
1126
- escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
1127
- mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
1128
- escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
1129
- }
1130
-
1131
- array.push(mappedChild);
1132
- }
1133
-
1134
- return 1;
1135
- }
1136
-
1137
- var child;
1138
- var nextName;
1139
- var subtreeCount = 0; // Count of children found in the current subtree.
1140
-
1141
- var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1142
-
1143
- if (Array.isArray(children)) {
1144
- for (var i = 0; i < children.length; i++) {
1145
- child = children[i];
1146
- nextName = nextNamePrefix + getElementKey(child, i);
1147
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1148
- }
1149
- } else {
1150
- var iteratorFn = getIteratorFn(children);
1151
-
1152
- if (typeof iteratorFn === 'function') {
1153
- var iterableChildren = children;
1154
-
1155
- {
1156
- // Warn about using Maps as children
1157
- if (iteratorFn === iterableChildren.entries) {
1158
- if (!didWarnAboutMaps) {
1159
- warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
1160
- }
1161
-
1162
- didWarnAboutMaps = true;
1163
- }
1164
- }
1165
-
1166
- var iterator = iteratorFn.call(iterableChildren);
1167
- var step;
1168
- var ii = 0;
1169
-
1170
- while (!(step = iterator.next()).done) {
1171
- child = step.value;
1172
- nextName = nextNamePrefix + getElementKey(child, ii++);
1173
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1174
- }
1175
- } else if (type === 'object') {
1176
- var childrenString = '' + children;
1177
-
1178
- {
1179
- {
1180
- throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." );
1181
- }
1182
- }
1183
- }
1184
- }
1185
-
1186
- return subtreeCount;
1187
- }
1188
-
1189
- /**
1190
- * Maps children that are typically specified as `props.children`.
1191
- *
1192
- * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1193
- *
1194
- * The provided mapFunction(child, index) will be called for each
1195
- * leaf child.
1196
- *
1197
- * @param {?*} children Children tree container.
1198
- * @param {function(*, int)} func The map function.
1199
- * @param {*} context Context for mapFunction.
1200
- * @return {object} Object containing the ordered map of results.
1201
- */
1202
- function mapChildren(children, func, context) {
1203
- if (children == null) {
1204
- return children;
1205
- }
1206
-
1207
- var result = [];
1208
- var count = 0;
1209
- mapIntoArray(children, result, '', '', function (child) {
1210
- return func.call(context, child, count++);
1211
- });
1212
- return result;
1213
- }
1214
- /**
1215
- * Count the number of children that are typically specified as
1216
- * `props.children`.
1217
- *
1218
- * See https://reactjs.org/docs/react-api.html#reactchildrencount
1219
- *
1220
- * @param {?*} children Children tree container.
1221
- * @return {number} The number of children.
1222
- */
1223
-
1224
-
1225
- function countChildren(children) {
1226
- var n = 0;
1227
- mapChildren(children, function () {
1228
- n++; // Don't return anything
1229
- });
1230
- return n;
1231
- }
1232
-
1233
- /**
1234
- * Iterates through children that are typically specified as `props.children`.
1235
- *
1236
- * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1237
- *
1238
- * The provided forEachFunc(child, index) will be called for each
1239
- * leaf child.
1240
- *
1241
- * @param {?*} children Children tree container.
1242
- * @param {function(*, int)} forEachFunc
1243
- * @param {*} forEachContext Context for forEachContext.
1244
- */
1245
- function forEachChildren(children, forEachFunc, forEachContext) {
1246
- mapChildren(children, function () {
1247
- forEachFunc.apply(this, arguments); // Don't return anything.
1248
- }, forEachContext);
1249
- }
1250
- /**
1251
- * Flatten a children object (typically specified as `props.children`) and
1252
- * return an array with appropriately re-keyed children.
1253
- *
1254
- * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1255
- */
1256
-
1257
-
1258
- function toArray(children) {
1259
- return mapChildren(children, function (child) {
1260
- return child;
1261
- }) || [];
1262
- }
1263
- /**
1264
- * Returns the first child in a collection of children and verifies that there
1265
- * is only one child in the collection.
1266
- *
1267
- * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1268
- *
1269
- * The current implementation of this function assumes that a single child gets
1270
- * passed without a wrapper, but the purpose of this helper function is to
1271
- * abstract away the particular structure of children.
1272
- *
1273
- * @param {?object} children Child collection structure.
1274
- * @return {ReactElement} The first and only `ReactElement` contained in the
1275
- * structure.
1276
- */
1277
-
1278
-
1279
- function onlyChild(children) {
1280
- if (!isValidElement(children)) {
1281
- {
1282
- throw Error( "React.Children.only expected to receive a single React element child." );
1283
- }
1284
- }
1285
-
1286
- return children;
1287
- }
1288
-
1289
- function createContext(defaultValue, calculateChangedBits) {
1290
- if (calculateChangedBits === undefined) {
1291
- calculateChangedBits = null;
1292
- } else {
1293
- {
1294
- if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
1295
- error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
1296
- }
1297
- }
1298
- }
1299
-
1300
- var context = {
1301
- $$typeof: REACT_CONTEXT_TYPE,
1302
- _calculateChangedBits: calculateChangedBits,
1303
- // As a workaround to support multiple concurrent renderers, we categorize
1304
- // some renderers as primary and others as secondary. We only expect
1305
- // there to be two concurrent renderers at most: React Native (primary) and
1306
- // Fabric (secondary); React DOM (primary) and React ART (secondary).
1307
- // Secondary renderers store their context values on separate fields.
1308
- _currentValue: defaultValue,
1309
- _currentValue2: defaultValue,
1310
- // Used to track how many concurrent renderers this context currently
1311
- // supports within in a single renderer. Such as parallel server rendering.
1312
- _threadCount: 0,
1313
- // These are circular
1314
- Provider: null,
1315
- Consumer: null
1316
- };
1317
- context.Provider = {
1318
- $$typeof: REACT_PROVIDER_TYPE,
1319
- _context: context
1320
- };
1321
- var hasWarnedAboutUsingNestedContextConsumers = false;
1322
- var hasWarnedAboutUsingConsumerProvider = false;
1323
- var hasWarnedAboutDisplayNameOnConsumer = false;
1324
-
1325
- {
1326
- // A separate object, but proxies back to the original context object for
1327
- // backwards compatibility. It has a different $$typeof, so we can properly
1328
- // warn for the incorrect usage of Context as a Consumer.
1329
- var Consumer = {
1330
- $$typeof: REACT_CONTEXT_TYPE,
1331
- _context: context,
1332
- _calculateChangedBits: context._calculateChangedBits
1333
- }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1334
-
1335
- Object.defineProperties(Consumer, {
1336
- Provider: {
1337
- get: function () {
1338
- if (!hasWarnedAboutUsingConsumerProvider) {
1339
- hasWarnedAboutUsingConsumerProvider = true;
1340
-
1341
- error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
1342
- }
1343
-
1344
- return context.Provider;
1345
- },
1346
- set: function (_Provider) {
1347
- context.Provider = _Provider;
1348
- }
1349
- },
1350
- _currentValue: {
1351
- get: function () {
1352
- return context._currentValue;
1353
- },
1354
- set: function (_currentValue) {
1355
- context._currentValue = _currentValue;
1356
- }
1357
- },
1358
- _currentValue2: {
1359
- get: function () {
1360
- return context._currentValue2;
1361
- },
1362
- set: function (_currentValue2) {
1363
- context._currentValue2 = _currentValue2;
1364
- }
1365
- },
1366
- _threadCount: {
1367
- get: function () {
1368
- return context._threadCount;
1369
- },
1370
- set: function (_threadCount) {
1371
- context._threadCount = _threadCount;
1372
- }
1373
- },
1374
- Consumer: {
1375
- get: function () {
1376
- if (!hasWarnedAboutUsingNestedContextConsumers) {
1377
- hasWarnedAboutUsingNestedContextConsumers = true;
1378
-
1379
- error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
1380
- }
1381
-
1382
- return context.Consumer;
1383
- }
1384
- },
1385
- displayName: {
1386
- get: function () {
1387
- return context.displayName;
1388
- },
1389
- set: function (displayName) {
1390
- if (!hasWarnedAboutDisplayNameOnConsumer) {
1391
- warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
1392
-
1393
- hasWarnedAboutDisplayNameOnConsumer = true;
1394
- }
1395
- }
1396
- }
1397
- }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1398
-
1399
- context.Consumer = Consumer;
1400
- }
1401
-
1402
- {
1403
- context._currentRenderer = null;
1404
- context._currentRenderer2 = null;
1405
- }
1406
-
1407
- return context;
1408
- }
1409
-
1410
- var Uninitialized = -1;
1411
- var Pending = 0;
1412
- var Resolved = 1;
1413
- var Rejected = 2;
1414
-
1415
- function lazyInitializer(payload) {
1416
- if (payload._status === Uninitialized) {
1417
- var ctor = payload._result;
1418
- var thenable = ctor(); // Transition to the next state.
1419
-
1420
- var pending = payload;
1421
- pending._status = Pending;
1422
- pending._result = thenable;
1423
- thenable.then(function (moduleObject) {
1424
- if (payload._status === Pending) {
1425
- var defaultExport = moduleObject.default;
1426
-
1427
- {
1428
- if (defaultExport === undefined) {
1429
- error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
1430
- 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
1431
- }
1432
- } // Transition to the next state.
1433
-
1434
-
1435
- var resolved = payload;
1436
- resolved._status = Resolved;
1437
- resolved._result = defaultExport;
1438
- }
1439
- }, function (error) {
1440
- if (payload._status === Pending) {
1441
- // Transition to the next state.
1442
- var rejected = payload;
1443
- rejected._status = Rejected;
1444
- rejected._result = error;
1445
- }
1446
- });
1447
- }
1448
-
1449
- if (payload._status === Resolved) {
1450
- return payload._result;
1451
- } else {
1452
- throw payload._result;
1453
- }
1454
- }
1455
-
1456
- function lazy(ctor) {
1457
- var payload = {
1458
- // We use these fields to store the result.
1459
- _status: -1,
1460
- _result: ctor
1461
- };
1462
- var lazyType = {
1463
- $$typeof: REACT_LAZY_TYPE,
1464
- _payload: payload,
1465
- _init: lazyInitializer
1466
- };
1467
-
1468
- {
1469
- // In production, this would just set it on the object.
1470
- var defaultProps;
1471
- var propTypes; // $FlowFixMe
1472
-
1473
- Object.defineProperties(lazyType, {
1474
- defaultProps: {
1475
- configurable: true,
1476
- get: function () {
1477
- return defaultProps;
1478
- },
1479
- set: function (newDefaultProps) {
1480
- error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1481
-
1482
- defaultProps = newDefaultProps; // Match production behavior more closely:
1483
- // $FlowFixMe
1484
-
1485
- Object.defineProperty(lazyType, 'defaultProps', {
1486
- enumerable: true
1487
- });
1488
- }
1489
- },
1490
- propTypes: {
1491
- configurable: true,
1492
- get: function () {
1493
- return propTypes;
1494
- },
1495
- set: function (newPropTypes) {
1496
- error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1497
-
1498
- propTypes = newPropTypes; // Match production behavior more closely:
1499
- // $FlowFixMe
1500
-
1501
- Object.defineProperty(lazyType, 'propTypes', {
1502
- enumerable: true
1503
- });
1504
- }
1505
- }
1506
- });
1507
- }
1508
-
1509
- return lazyType;
1510
- }
1511
-
1512
- function forwardRef(render) {
1513
- {
1514
- if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1515
- error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1516
- } else if (typeof render !== 'function') {
1517
- error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1518
- } else {
1519
- if (render.length !== 0 && render.length !== 2) {
1520
- error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
1521
- }
1522
- }
1523
-
1524
- if (render != null) {
1525
- if (render.defaultProps != null || render.propTypes != null) {
1526
- error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
1527
- }
1528
- }
1529
- }
1530
-
1531
- var elementType = {
1532
- $$typeof: REACT_FORWARD_REF_TYPE,
1533
- render: render
1534
- };
1535
-
1536
- {
1537
- var ownName;
1538
- Object.defineProperty(elementType, 'displayName', {
1539
- enumerable: false,
1540
- configurable: true,
1541
- get: function () {
1542
- return ownName;
1543
- },
1544
- set: function (name) {
1545
- ownName = name;
1546
-
1547
- if (render.displayName == null) {
1548
- render.displayName = name;
1549
- }
1550
- }
1551
- });
1552
- }
1553
-
1554
- return elementType;
1555
- }
1556
-
1557
- // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1558
-
1559
- var enableScopeAPI = false; // Experimental Create Event Handle API.
1560
-
1561
- function isValidElementType(type) {
1562
- if (typeof type === 'string' || typeof type === 'function') {
1563
- return true;
1564
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1565
-
1566
-
1567
- if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
1568
- return true;
1569
- }
1570
-
1571
- if (typeof type === 'object' && type !== null) {
1572
- if (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_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
1573
- return true;
1574
- }
1575
- }
1576
-
1577
- return false;
1578
- }
1579
-
1580
- function memo(type, compare) {
1581
- {
1582
- if (!isValidElementType(type)) {
1583
- error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1584
- }
1585
- }
1586
-
1587
- var elementType = {
1588
- $$typeof: REACT_MEMO_TYPE,
1589
- type: type,
1590
- compare: compare === undefined ? null : compare
1591
- };
1592
-
1593
- {
1594
- var ownName;
1595
- Object.defineProperty(elementType, 'displayName', {
1596
- enumerable: false,
1597
- configurable: true,
1598
- get: function () {
1599
- return ownName;
1600
- },
1601
- set: function (name) {
1602
- ownName = name;
1603
-
1604
- if (type.displayName == null) {
1605
- type.displayName = name;
1606
- }
1607
- }
1608
- });
1609
- }
1610
-
1611
- return elementType;
1612
- }
1613
-
1614
- function resolveDispatcher() {
1615
- var dispatcher = ReactCurrentDispatcher.current;
1616
-
1617
- if (!(dispatcher !== null)) {
1618
- {
1619
- throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
1620
- }
1621
- }
1622
-
1623
- return dispatcher;
1624
- }
1625
-
1626
- function useContext(Context, unstable_observedBits) {
1627
- var dispatcher = resolveDispatcher();
1628
-
1629
- {
1630
- if (unstable_observedBits !== undefined) {
1631
- error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : '');
1632
- } // TODO: add a more generic warning for invalid values.
1633
-
1634
-
1635
- if (Context._context !== undefined) {
1636
- var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
1637
- // and nobody should be using this in existing code.
1638
-
1639
- if (realContext.Consumer === Context) {
1640
- error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
1641
- } else if (realContext.Provider === Context) {
1642
- error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1643
- }
1644
- }
1645
- }
1646
-
1647
- return dispatcher.useContext(Context, unstable_observedBits);
1648
- }
1649
- function useState(initialState) {
1650
- var dispatcher = resolveDispatcher();
1651
- return dispatcher.useState(initialState);
1652
- }
1653
- function useReducer(reducer, initialArg, init) {
1654
- var dispatcher = resolveDispatcher();
1655
- return dispatcher.useReducer(reducer, initialArg, init);
1656
- }
1657
- function useRef(initialValue) {
1658
- var dispatcher = resolveDispatcher();
1659
- return dispatcher.useRef(initialValue);
1660
- }
1661
- function useEffect(create, deps) {
1662
- var dispatcher = resolveDispatcher();
1663
- return dispatcher.useEffect(create, deps);
1664
- }
1665
- function useLayoutEffect(create, deps) {
1666
- var dispatcher = resolveDispatcher();
1667
- return dispatcher.useLayoutEffect(create, deps);
1668
- }
1669
- function useCallback(callback, deps) {
1670
- var dispatcher = resolveDispatcher();
1671
- return dispatcher.useCallback(callback, deps);
1672
- }
1673
- function useMemo(create, deps) {
1674
- var dispatcher = resolveDispatcher();
1675
- return dispatcher.useMemo(create, deps);
1676
- }
1677
- function useImperativeHandle(ref, create, deps) {
1678
- var dispatcher = resolveDispatcher();
1679
- return dispatcher.useImperativeHandle(ref, create, deps);
1680
- }
1681
- function useDebugValue(value, formatterFn) {
1682
- {
1683
- var dispatcher = resolveDispatcher();
1684
- return dispatcher.useDebugValue(value, formatterFn);
1685
- }
1686
- }
1687
-
1688
- // Helpers to patch console.logs to avoid logging during side-effect free
1689
- // replaying on render function. This currently only patches the object
1690
- // lazily which won't cover if the log function was extracted eagerly.
1691
- // We could also eagerly patch the method.
1692
- var disabledDepth = 0;
1693
- var prevLog;
1694
- var prevInfo;
1695
- var prevWarn;
1696
- var prevError;
1697
- var prevGroup;
1698
- var prevGroupCollapsed;
1699
- var prevGroupEnd;
1700
-
1701
- function disabledLog() {}
1702
-
1703
- disabledLog.__reactDisabledLog = true;
1704
- function disableLogs() {
1705
- {
1706
- if (disabledDepth === 0) {
1707
- /* eslint-disable react-internal/no-production-logging */
1708
- prevLog = console.log;
1709
- prevInfo = console.info;
1710
- prevWarn = console.warn;
1711
- prevError = console.error;
1712
- prevGroup = console.group;
1713
- prevGroupCollapsed = console.groupCollapsed;
1714
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
1715
-
1716
- var props = {
1717
- configurable: true,
1718
- enumerable: true,
1719
- value: disabledLog,
1720
- writable: true
1721
- }; // $FlowFixMe Flow thinks console is immutable.
1722
-
1723
- Object.defineProperties(console, {
1724
- info: props,
1725
- log: props,
1726
- warn: props,
1727
- error: props,
1728
- group: props,
1729
- groupCollapsed: props,
1730
- groupEnd: props
1731
- });
1732
- /* eslint-enable react-internal/no-production-logging */
1733
- }
1734
-
1735
- disabledDepth++;
1736
- }
1737
- }
1738
- function reenableLogs() {
1739
- {
1740
- disabledDepth--;
1741
-
1742
- if (disabledDepth === 0) {
1743
- /* eslint-disable react-internal/no-production-logging */
1744
- var props = {
1745
- configurable: true,
1746
- enumerable: true,
1747
- writable: true
1748
- }; // $FlowFixMe Flow thinks console is immutable.
1749
-
1750
- Object.defineProperties(console, {
1751
- log: _assign({}, props, {
1752
- value: prevLog
1753
- }),
1754
- info: _assign({}, props, {
1755
- value: prevInfo
1756
- }),
1757
- warn: _assign({}, props, {
1758
- value: prevWarn
1759
- }),
1760
- error: _assign({}, props, {
1761
- value: prevError
1762
- }),
1763
- group: _assign({}, props, {
1764
- value: prevGroup
1765
- }),
1766
- groupCollapsed: _assign({}, props, {
1767
- value: prevGroupCollapsed
1768
- }),
1769
- groupEnd: _assign({}, props, {
1770
- value: prevGroupEnd
1771
- })
1772
- });
1773
- /* eslint-enable react-internal/no-production-logging */
1774
- }
1775
-
1776
- if (disabledDepth < 0) {
1777
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
1778
- }
1779
- }
1780
- }
1781
-
1782
- var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1783
- var prefix;
1784
- function describeBuiltInComponentFrame(name, source, ownerFn) {
1785
- {
1786
- if (prefix === undefined) {
1787
- // Extract the VM specific prefix used by each line.
1788
- try {
1789
- throw Error();
1790
- } catch (x) {
1791
- var match = x.stack.trim().match(/\n( *(at )?)/);
1792
- prefix = match && match[1] || '';
1793
- }
1794
- } // We use the prefix to ensure our stacks line up with native stack frames.
1795
-
1796
-
1797
- return '\n' + prefix + name;
1798
- }
1799
- }
1800
- var reentry = false;
1801
- var componentFrameCache;
1802
-
1803
- {
1804
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
1805
- componentFrameCache = new PossiblyWeakMap();
1806
- }
1807
-
1808
- function describeNativeComponentFrame(fn, construct) {
1809
- // If something asked for a stack inside a fake render, it should get ignored.
1810
- if (!fn || reentry) {
1811
- return '';
1812
- }
1813
-
1814
- {
1815
- var frame = componentFrameCache.get(fn);
1816
-
1817
- if (frame !== undefined) {
1818
- return frame;
1819
- }
1820
- }
1821
-
1822
- var control;
1823
- reentry = true;
1824
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
1825
-
1826
- Error.prepareStackTrace = undefined;
1827
- var previousDispatcher;
1828
-
1829
- {
1830
- previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
1831
- // for warnings.
1832
-
1833
- ReactCurrentDispatcher$1.current = null;
1834
- disableLogs();
1835
- }
1836
-
1837
- try {
1838
- // This should throw.
1839
- if (construct) {
1840
- // Something should be setting the props in the constructor.
1841
- var Fake = function () {
1842
- throw Error();
1843
- }; // $FlowFixMe
1844
-
1845
-
1846
- Object.defineProperty(Fake.prototype, 'props', {
1847
- set: function () {
1848
- // We use a throwing setter instead of frozen or non-writable props
1849
- // because that won't throw in a non-strict mode function.
1850
- throw Error();
1851
- }
1852
- });
1853
-
1854
- if (typeof Reflect === 'object' && Reflect.construct) {
1855
- // We construct a different control for this case to include any extra
1856
- // frames added by the construct call.
1857
- try {
1858
- Reflect.construct(Fake, []);
1859
- } catch (x) {
1860
- control = x;
1861
- }
1862
-
1863
- Reflect.construct(fn, [], Fake);
1864
- } else {
1865
- try {
1866
- Fake.call();
1867
- } catch (x) {
1868
- control = x;
1869
- }
1870
-
1871
- fn.call(Fake.prototype);
1872
- }
1873
- } else {
1874
- try {
1875
- throw Error();
1876
- } catch (x) {
1877
- control = x;
1878
- }
1879
-
1880
- fn();
1881
- }
1882
- } catch (sample) {
1883
- // This is inlined manually because closure doesn't do it for us.
1884
- if (sample && control && typeof sample.stack === 'string') {
1885
- // This extracts the first frame from the sample that isn't also in the control.
1886
- // Skipping one frame that we assume is the frame that calls the two.
1887
- var sampleLines = sample.stack.split('\n');
1888
- var controlLines = control.stack.split('\n');
1889
- var s = sampleLines.length - 1;
1890
- var c = controlLines.length - 1;
1891
-
1892
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
1893
- // We expect at least one stack frame to be shared.
1894
- // Typically this will be the root most one. However, stack frames may be
1895
- // cut off due to maximum stack limits. In this case, one maybe cut off
1896
- // earlier than the other. We assume that the sample is longer or the same
1897
- // and there for cut off earlier. So we should find the root most frame in
1898
- // the sample somewhere in the control.
1899
- c--;
1900
- }
1901
-
1902
- for (; s >= 1 && c >= 0; s--, c--) {
1903
- // Next we find the first one that isn't the same which should be the
1904
- // frame that called our sample function and the control.
1905
- if (sampleLines[s] !== controlLines[c]) {
1906
- // In V8, the first line is describing the message but other VMs don't.
1907
- // If we're about to return the first line, and the control is also on the same
1908
- // line, that's a pretty good indicator that our sample threw at same line as
1909
- // the control. I.e. before we entered the sample frame. So we ignore this result.
1910
- // This can happen if you passed a class to function component, or non-function.
1911
- if (s !== 1 || c !== 1) {
1912
- do {
1913
- s--;
1914
- c--; // We may still have similar intermediate frames from the construct call.
1915
- // The next one that isn't the same should be our match though.
1916
-
1917
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
1918
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
1919
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
1920
-
1921
- {
1922
- if (typeof fn === 'function') {
1923
- componentFrameCache.set(fn, _frame);
1924
- }
1925
- } // Return the line we found.
1926
-
1927
-
1928
- return _frame;
1929
- }
1930
- } while (s >= 1 && c >= 0);
1931
- }
1932
-
1933
- break;
1934
- }
1935
- }
1936
- }
1937
- } finally {
1938
- reentry = false;
1939
-
1940
- {
1941
- ReactCurrentDispatcher$1.current = previousDispatcher;
1942
- reenableLogs();
1943
- }
1944
-
1945
- Error.prepareStackTrace = previousPrepareStackTrace;
1946
- } // Fallback to just using the name if we couldn't make it throw.
1947
-
1948
-
1949
- var name = fn ? fn.displayName || fn.name : '';
1950
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
1951
-
1952
- {
1953
- if (typeof fn === 'function') {
1954
- componentFrameCache.set(fn, syntheticFrame);
1955
- }
1956
- }
1957
-
1958
- return syntheticFrame;
1959
- }
1960
- function describeFunctionComponentFrame(fn, source, ownerFn) {
1961
- {
1962
- return describeNativeComponentFrame(fn, false);
1963
- }
1964
- }
1965
-
1966
- function shouldConstruct(Component) {
1967
- var prototype = Component.prototype;
1968
- return !!(prototype && prototype.isReactComponent);
1969
- }
1970
-
1971
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
1972
-
1973
- if (type == null) {
1974
- return '';
1975
- }
1976
-
1977
- if (typeof type === 'function') {
1978
- {
1979
- return describeNativeComponentFrame(type, shouldConstruct(type));
1980
- }
1981
- }
1982
-
1983
- if (typeof type === 'string') {
1984
- return describeBuiltInComponentFrame(type);
1985
- }
1986
-
1987
- switch (type) {
1988
- case exports.Suspense:
1989
- return describeBuiltInComponentFrame('Suspense');
1990
-
1991
- case REACT_SUSPENSE_LIST_TYPE:
1992
- return describeBuiltInComponentFrame('SuspenseList');
1993
- }
1994
-
1995
- if (typeof type === 'object') {
1996
- switch (type.$$typeof) {
1997
- case REACT_FORWARD_REF_TYPE:
1998
- return describeFunctionComponentFrame(type.render);
1999
-
2000
- case REACT_MEMO_TYPE:
2001
- // Memo may contain any component type so we recursively resolve it.
2002
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
2003
-
2004
- case REACT_BLOCK_TYPE:
2005
- return describeFunctionComponentFrame(type._render);
2006
-
2007
- case REACT_LAZY_TYPE:
2008
- {
2009
- var lazyComponent = type;
2010
- var payload = lazyComponent._payload;
2011
- var init = lazyComponent._init;
2012
-
2013
- try {
2014
- // Lazy may contain any component type so we recursively resolve it.
2015
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
2016
- } catch (x) {}
2017
- }
2018
- }
2019
- }
2020
-
2021
- return '';
2022
- }
2023
-
2024
- var loggedTypeFailures = {};
2025
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
2026
-
2027
- function setCurrentlyValidatingElement(element) {
2028
- {
2029
- if (element) {
2030
- var owner = element._owner;
2031
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2032
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
2033
- } else {
2034
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
2035
- }
2036
- }
2037
- }
2038
-
2039
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
2040
- {
2041
- // $FlowFixMe This is okay but Flow doesn't know it.
2042
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
2043
-
2044
- for (var typeSpecName in typeSpecs) {
2045
- if (has(typeSpecs, typeSpecName)) {
2046
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
2047
- // fail the render phase where it didn't fail before. So we log it.
2048
- // After these have been cleaned up, we'll let them throw.
2049
-
2050
- try {
2051
- // This is intentionally an invariant that gets caught. It's the same
2052
- // behavior as without this statement except with a better message.
2053
- if (typeof typeSpecs[typeSpecName] !== 'function') {
2054
- var err = Error((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`.');
2055
- err.name = 'Invariant Violation';
2056
- throw err;
2057
- }
2058
-
2059
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
2060
- } catch (ex) {
2061
- error$1 = ex;
2062
- }
2063
-
2064
- if (error$1 && !(error$1 instanceof Error)) {
2065
- setCurrentlyValidatingElement(element);
2066
-
2067
- error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
2068
-
2069
- setCurrentlyValidatingElement(null);
2070
- }
2071
-
2072
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
2073
- // Only monitor this failure once because there tends to be a lot of the
2074
- // same error.
2075
- loggedTypeFailures[error$1.message] = true;
2076
- setCurrentlyValidatingElement(element);
2077
-
2078
- error('Failed %s type: %s', location, error$1.message);
2079
-
2080
- setCurrentlyValidatingElement(null);
2081
- }
2082
- }
2083
- }
2084
- }
2085
- }
2086
-
2087
- function setCurrentlyValidatingElement$1(element) {
2088
- {
2089
- if (element) {
2090
- var owner = element._owner;
2091
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2092
- setExtraStackFrame(stack);
2093
- } else {
2094
- setExtraStackFrame(null);
2095
- }
2096
- }
2097
- }
2098
-
2099
- var propTypesMisspellWarningShown;
2100
-
2101
- {
2102
- propTypesMisspellWarningShown = false;
2103
- }
2104
-
2105
- function getDeclarationErrorAddendum() {
2106
- if (ReactCurrentOwner.current) {
2107
- var name = getComponentName(ReactCurrentOwner.current.type);
2108
-
2109
- if (name) {
2110
- return '\n\nCheck the render method of `' + name + '`.';
2111
- }
2112
- }
2113
-
2114
- return '';
2115
- }
2116
-
2117
- function getSourceInfoErrorAddendum(source) {
2118
- if (source !== undefined) {
2119
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
2120
- var lineNumber = source.lineNumber;
2121
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
2122
- }
2123
-
2124
- return '';
2125
- }
2126
-
2127
- function getSourceInfoErrorAddendumForProps(elementProps) {
2128
- if (elementProps !== null && elementProps !== undefined) {
2129
- return getSourceInfoErrorAddendum(elementProps.__source);
2130
- }
2131
-
2132
- return '';
2133
- }
2134
- /**
2135
- * Warn if there's no key explicitly set on dynamic arrays of children or
2136
- * object keys are not valid. This allows us to keep track of children between
2137
- * updates.
2138
- */
2139
-
2140
-
2141
- var ownerHasKeyUseWarning = {};
2142
-
2143
- function getCurrentComponentErrorInfo(parentType) {
2144
- var info = getDeclarationErrorAddendum();
2145
-
2146
- if (!info) {
2147
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
2148
-
2149
- if (parentName) {
2150
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2151
- }
2152
- }
2153
-
2154
- return info;
2155
- }
2156
- /**
2157
- * Warn if the element doesn't have an explicit key assigned to it.
2158
- * This element is in an array. The array could grow and shrink or be
2159
- * reordered. All children that haven't already been validated are required to
2160
- * have a "key" property assigned to it. Error statuses are cached so a warning
2161
- * will only be shown once.
2162
- *
2163
- * @internal
2164
- * @param {ReactElement} element Element that requires a key.
2165
- * @param {*} parentType element's parent's type.
2166
- */
2167
-
2168
-
2169
- function validateExplicitKey(element, parentType) {
2170
- if (!element._store || element._store.validated || element.key != null) {
2171
- return;
2172
- }
2173
-
2174
- element._store.validated = true;
2175
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2176
-
2177
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2178
- return;
2179
- }
2180
-
2181
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2182
- // property, it may be the creator of the child that's responsible for
2183
- // assigning it a key.
2184
-
2185
- var childOwner = '';
2186
-
2187
- if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2188
- // Give the component that originally created this child.
2189
- childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
2190
- }
2191
-
2192
- {
2193
- setCurrentlyValidatingElement$1(element);
2194
-
2195
- error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
2196
-
2197
- setCurrentlyValidatingElement$1(null);
2198
- }
2199
- }
2200
- /**
2201
- * Ensure that every element either is passed in a static location, in an
2202
- * array with an explicit keys property defined, or in an object literal
2203
- * with valid key property.
2204
- *
2205
- * @internal
2206
- * @param {ReactNode} node Statically passed child of any type.
2207
- * @param {*} parentType node's parent's type.
2208
- */
2209
-
2210
-
2211
- function validateChildKeys(node, parentType) {
2212
- if (typeof node !== 'object') {
2213
- return;
2214
- }
2215
-
2216
- if (Array.isArray(node)) {
2217
- for (var i = 0; i < node.length; i++) {
2218
- var child = node[i];
2219
-
2220
- if (isValidElement(child)) {
2221
- validateExplicitKey(child, parentType);
2222
- }
2223
- }
2224
- } else if (isValidElement(node)) {
2225
- // This element was passed in a valid location.
2226
- if (node._store) {
2227
- node._store.validated = true;
2228
- }
2229
- } else if (node) {
2230
- var iteratorFn = getIteratorFn(node);
2231
-
2232
- if (typeof iteratorFn === 'function') {
2233
- // Entry iterators used to provide implicit keys,
2234
- // but now we print a separate warning for them later.
2235
- if (iteratorFn !== node.entries) {
2236
- var iterator = iteratorFn.call(node);
2237
- var step;
2238
-
2239
- while (!(step = iterator.next()).done) {
2240
- if (isValidElement(step.value)) {
2241
- validateExplicitKey(step.value, parentType);
2242
- }
2243
- }
2244
- }
2245
- }
2246
- }
2247
- }
2248
- /**
2249
- * Given an element, validate that its props follow the propTypes definition,
2250
- * provided by the type.
2251
- *
2252
- * @param {ReactElement} element
2253
- */
2254
-
2255
-
2256
- function validatePropTypes(element) {
2257
- {
2258
- var type = element.type;
2259
-
2260
- if (type === null || type === undefined || typeof type === 'string') {
2261
- return;
2262
- }
2263
-
2264
- var propTypes;
2265
-
2266
- if (typeof type === 'function') {
2267
- propTypes = type.propTypes;
2268
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2269
- // Inner props are checked in the reconciler.
2270
- type.$$typeof === REACT_MEMO_TYPE)) {
2271
- propTypes = type.propTypes;
2272
- } else {
2273
- return;
2274
- }
2275
-
2276
- if (propTypes) {
2277
- // Intentionally inside to avoid triggering lazy initializers:
2278
- var name = getComponentName(type);
2279
- checkPropTypes(propTypes, element.props, 'prop', name, element);
2280
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2281
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2282
-
2283
- var _name = getComponentName(type);
2284
-
2285
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2286
- }
2287
-
2288
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2289
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2290
- }
2291
- }
2292
- }
2293
- /**
2294
- * Given a fragment, validate that it can only be provided with fragment props
2295
- * @param {ReactElement} fragment
2296
- */
2297
-
2298
-
2299
- function validateFragmentProps(fragment) {
2300
- {
2301
- var keys = Object.keys(fragment.props);
2302
-
2303
- for (var i = 0; i < keys.length; i++) {
2304
- var key = keys[i];
2305
-
2306
- if (key !== 'children' && key !== 'key') {
2307
- setCurrentlyValidatingElement$1(fragment);
2308
-
2309
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2310
-
2311
- setCurrentlyValidatingElement$1(null);
2312
- break;
2313
- }
2314
- }
2315
-
2316
- if (fragment.ref !== null) {
2317
- setCurrentlyValidatingElement$1(fragment);
2318
-
2319
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
2320
-
2321
- setCurrentlyValidatingElement$1(null);
2322
- }
2323
- }
2324
- }
2325
- function createElementWithValidation(type, props, children) {
2326
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2327
- // succeed and there will likely be errors in render.
2328
-
2329
- if (!validType) {
2330
- var info = '';
2331
-
2332
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2333
- info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
2334
- }
2335
-
2336
- var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2337
-
2338
- if (sourceInfo) {
2339
- info += sourceInfo;
2340
- } else {
2341
- info += getDeclarationErrorAddendum();
2342
- }
2343
-
2344
- var typeString;
2345
-
2346
- if (type === null) {
2347
- typeString = 'null';
2348
- } else if (Array.isArray(type)) {
2349
- typeString = 'array';
2350
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2351
- typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
2352
- info = ' Did you accidentally export a JSX literal instead of a component?';
2353
- } else {
2354
- typeString = typeof type;
2355
- }
2356
-
2357
- {
2358
- error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
2359
- }
2360
- }
2361
-
2362
- var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
2363
- // TODO: Drop this when these are no longer allowed as the type argument.
2364
-
2365
- if (element == null) {
2366
- return element;
2367
- } // Skip key warning if the type isn't valid since our key validation logic
2368
- // doesn't expect a non-string/function type and can throw confusing errors.
2369
- // We don't want exception behavior to differ between dev and prod.
2370
- // (Rendering will throw with a helpful message and as soon as the type is
2371
- // fixed, the key warnings will appear.)
2372
-
2373
-
2374
- if (validType) {
2375
- for (var i = 2; i < arguments.length; i++) {
2376
- validateChildKeys(arguments[i], type);
2377
- }
2378
- }
2379
-
2380
- if (type === exports.Fragment) {
2381
- validateFragmentProps(element);
2382
- } else {
2383
- validatePropTypes(element);
2384
- }
2385
-
2386
- return element;
2387
- }
2388
- var didWarnAboutDeprecatedCreateFactory = false;
2389
- function createFactoryWithValidation(type) {
2390
- var validatedFactory = createElementWithValidation.bind(null, type);
2391
- validatedFactory.type = type;
2392
-
2393
- {
2394
- if (!didWarnAboutDeprecatedCreateFactory) {
2395
- didWarnAboutDeprecatedCreateFactory = true;
2396
-
2397
- warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
2398
- } // Legacy hook: remove it
2399
-
2400
-
2401
- Object.defineProperty(validatedFactory, 'type', {
2402
- enumerable: false,
2403
- get: function () {
2404
- warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2405
-
2406
- Object.defineProperty(this, 'type', {
2407
- value: type
2408
- });
2409
- return type;
2410
- }
2411
- });
2412
- }
2413
-
2414
- return validatedFactory;
2415
- }
2416
- function cloneElementWithValidation(element, props, children) {
2417
- var newElement = cloneElement.apply(this, arguments);
2418
-
2419
- for (var i = 2; i < arguments.length; i++) {
2420
- validateChildKeys(arguments[i], newElement.type);
2421
- }
2422
-
2423
- validatePropTypes(newElement);
2424
- return newElement;
2425
- }
2426
-
2427
- {
2428
-
2429
- try {
2430
- var frozenObject = Object.freeze({});
2431
- /* eslint-disable no-new */
2432
-
2433
- new Map([[frozenObject, null]]);
2434
- new Set([frozenObject]);
2435
- /* eslint-enable no-new */
2436
- } catch (e) {
2437
- }
2438
- }
2439
-
2440
- var createElement$1 = createElementWithValidation ;
2441
- var cloneElement$1 = cloneElementWithValidation ;
2442
- var createFactory = createFactoryWithValidation ;
2443
- var Children = {
2444
- map: mapChildren,
2445
- forEach: forEachChildren,
2446
- count: countChildren,
2447
- toArray: toArray,
2448
- only: onlyChild
2449
- };
2450
-
2451
- exports.Children = Children;
2452
- exports.Component = Component;
2453
- exports.PureComponent = PureComponent;
2454
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2455
- exports.cloneElement = cloneElement$1;
2456
- exports.createContext = createContext;
2457
- exports.createElement = createElement$1;
2458
- exports.createFactory = createFactory;
2459
- exports.createRef = createRef;
2460
- exports.forwardRef = forwardRef;
2461
- exports.isValidElement = isValidElement;
2462
- exports.lazy = lazy;
2463
- exports.memo = memo;
2464
- exports.useCallback = useCallback;
2465
- exports.useContext = useContext;
2466
- exports.useDebugValue = useDebugValue;
2467
- exports.useEffect = useEffect;
2468
- exports.useImperativeHandle = useImperativeHandle;
2469
- exports.useLayoutEffect = useLayoutEffect;
2470
- exports.useMemo = useMemo;
2471
- exports.useReducer = useReducer;
2472
- exports.useRef = useRef;
2473
- exports.useState = useState;
2474
- exports.version = ReactVersion;
2475
- })();
2476
- }
2477
- } (react_development));
2478
- return react_development;
2479
- }
2480
-
2481
- if (process.env.NODE_ENV === 'production') {
2482
- react.exports = requireReact_production_min();
2483
- } else {
2484
- react.exports = requireReact_development();
2485
- }
2486
-
2487
- var reactExports = react.exports;
2488
- var React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
2489
-
2490
- function styleInject(css, ref) {
2491
- if ( ref === void 0 ) ref = {};
2492
- var insertAt = ref.insertAt;
2493
-
2494
- if (!css || typeof document === 'undefined') { return; }
2495
-
2496
- var head = document.head || document.getElementsByTagName('head')[0];
2497
- var style = document.createElement('style');
2498
- style.type = 'text/css';
2499
-
2500
- if (insertAt === 'top') {
2501
- if (head.firstChild) {
2502
- head.insertBefore(style, head.firstChild);
2503
- } else {
2504
- head.appendChild(style);
2505
- }
2506
- } else {
2507
- head.appendChild(style);
2508
- }
2509
-
2510
- if (style.styleSheet) {
2511
- style.styleSheet.cssText = css;
2512
- } else {
2513
- style.appendChild(document.createTextNode(css));
2514
- }
2515
- }
2516
-
2517
- var css_248z = "button {\n font-size: 70px;\n}";
2518
- styleInject(css_248z);
2519
-
2520
- const Button = (props) => {
2521
- const [testHook, setTestHook] = reactExports.useState(2);
2522
- console.log(testHook);
2523
- return React.createElement("button", null, props.label);
2524
- };
2525
-
2526
- function FilterBar() {
2527
- const [selectedFilter, setSelectedFilter] = reactExports.useState(false);
2528
- // const [startDate, setStartDate] = useState(0);
2529
- // const [endDate, setEndDate] = useState(0);
2530
- const [guestsAdults, setGuestsAdults] = reactExports.useState(0);
2531
- const [guestsKids, setGuestsKids] = reactExports.useState(0);
2532
- const [categories, setCategories] = reactExports.useState(0);
2533
- const handleSelectedFilter = (id) => {
2534
- setSelectedFilter(id);
2535
- };
2536
- const handleSubmit = () => {
2537
- const queryParams = new URLSearchParams();
2538
- const params = {
2539
- // startDate,
2540
- // endDate,
2541
- guestsAdults,
2542
- guestsKids,
2543
- categories,
2544
- };
2545
- for (const [key, value] of Object.entries(params)) {
2546
- if (value) {
2547
- queryParams.append(key, value.toString());
2548
- }
2549
- }
2550
- const url = `http://localhost:4000/en/events/?${queryParams.toString()}`;
2551
- window.location.href = url;
2552
- handleSelectedFilter(false);
2553
- };
2554
- return (React.createElement("div", { className: "search-widget" },
2555
- React.createElement("div", { className: "search-widget-header" },
2556
- React.createElement(SelectButton, { label: "Start date", onClick: () => handleSelectedFilter(1) }),
2557
- React.createElement(Divider, null),
2558
- React.createElement(SelectButton, { label: "End date", onClick: () => handleSelectedFilter(2) }),
2559
- React.createElement(Divider, null),
2560
- React.createElement(Divider, null),
2561
- React.createElement(SubmitButton, { onClick: handleSubmit }))));
2562
- }
2563
- const Divider = () => {
2564
- return React.createElement("div", { className: "search-widget-divider" });
2565
- };
2566
- const SubmitButton = ({ onClick }) => {
2567
- return (React.createElement("button", { className: "search-widget-submit-button", onClick: onClick }, "Apply filters"));
2568
- };
2569
- const SelectButton = ({ label, onClick }) => {
2570
- return (React.createElement("button", { className: "search-widget-select-button", onClick: onClick }, label));
2571
- };
2572
- // const Guests = ({
2573
- // guestsAdults,
2574
- // guestsKids,
2575
- // decrementAdults,
2576
- // incrementAdults,
2577
- // decrementKids,
2578
- // incrementKids,
2579
- // }: any) => {
2580
- // return (
2581
- // <div className="search-widget-guests">
2582
- // <h3>Guests</h3>
2583
- // <p>Who's coming?</p>
2584
- // <div className="guests-filter-container">
2585
- // <div className="guests-filter-inner">
2586
- // <span>Adults</span>
2587
- // <div>
2588
- // <button onClick={decrementAdults} disabled={guestsAdults < 1}>
2589
- // -
2590
- // </button>
2591
- // <span>{guestsAdults}</span>
2592
- // <button onClick={incrementAdults}>+</button>
2593
- // </div>
2594
- // </div>
2595
- // <div className="guests-filter-inner">
2596
- // <span>Kids</span>
2597
- // <div>
2598
- // <button onClick={decrementKids} disabled={guestsKids < 1}>
2599
- // -
2600
- // </button>
2601
- // <span>{guestsKids}</span>
2602
- // <button onClick={incrementKids}>+</button>
2603
- // </div>
2604
- // </div>
2605
- // </div>
2606
- // </div>
2607
- // )
2608
- // }
2609
- // const Categories = ({ categories, setCategories }: any) => {
2610
- // const categoriesPlaceholder = ['Weekend', 'Week', 'Summer camp', 'Winter camp']
2611
- // const [selectedCategory, setSelectedCategory] = useState('')
2612
- // const handleCategoryChange = (selectedCategory: any) => {
2613
- // setSelectedCategory(selectedCategory)
2614
- // setCategories(selectedCategory) // Update the parent component's state with the selected category
2615
- // }
2616
- // return (
2617
- // <div className="search-widget-categories">
2618
- // <h3>CATEGORY</h3>
2619
- // <div className="categories-filter-inner">
2620
- // {categoriesPlaceholder.map((itm, idx) => (
2621
- // <div key={idx}>
2622
- // <input
2623
- // type="radio"
2624
- // value={itm}
2625
- // checked={selectedCategory === itm}
2626
- // onChange={() => handleCategoryChange(itm)}
2627
- // />
2628
- // <span>{itm}</span>
2629
- // </div>
2630
- // ))}
2631
- // </div>
2632
- // </div>
2633
- // )
2634
- // }
2635
-
2636
- exports.Button = Button;
2637
- exports.FilterBar = FilterBar;
2638
- //# sourceMappingURL=index.js.map